You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
NewEduCoderBuild/p__knowledgegraph__Statisti...

1 line
929 KiB

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

(self.webpackChunk=self.webpackChunk||[]).push([[4339],{65030:function(t,e,n){"use strict";n.d(e,{Z:function(){return H}});var i=n(33885),r=n(42978),s=n(75931),a=n(43403),o=n(92310),l=n.n(o),u=n(29301),h=n(76846),c=n(96452),d=n(6089),f=n(80402),p=n(34280),g=n(49658),_=n(59301),m=n(54476),v=n(77900),y=n(8654);function b(t){var e=t.prefixCls,n=t.align,i=t.arrow,r=t.arrowPos,s=i||{},a=s.className,o=s.content,u=r.x,h=void 0===u?0:u,c=r.y,d=void 0===c?0:c,f=_.useRef();if(!n||!n.points)return null;var p={position:"absolute"};if(!1!==n.autoArrow){var g=n.points[0],m=n.points[1],v=g[0],y=g[1],b=m[0],E=m[1];v!==b&&["t","b"].includes(v)?"t"===v?p.top=0:p.bottom=0:p.top=d,y!==E&&["l","r"].includes(y)?"l"===y?p.left=0:p.right=0:p.left=h}return _.createElement("div",{ref:f,className:l()("".concat(e,"-arrow"),a),style:p},o)}function E(t){var e=t.prefixCls,n=t.open,i=t.zIndex,r=t.mask,s=t.motion;return r?_.createElement(v.default,(0,m.Z)({},s,{motionAppear:!0,visible:n,removeOnLeave:!0}),(function(t){var n=t.className;return _.createElement("div",{style:{zIndex:i},className:l()("".concat(e,"-mask"),n)})})):null}var w=_.memo((function(t){return t.children}),(function(t,e){return e.cache}));var T=_.forwardRef((function(t,e){var n=t.popup,s=t.className,a=t.prefixCls,o=t.style,h=t.target,c=t.onVisibleChanged,d=t.open,f=t.keepDom,g=t.fresh,T=t.onClick,k=t.mask,S=t.arrow,A=t.arrowPos,D=t.align,C=t.motion,x=t.maskMotion,R=t.forceRender,L=t.getPopupContainer,I=t.autoDestroy,P=t.portal,O=t.zIndex,F=t.onMouseEnter,M=t.onMouseLeave,N=t.onPointerEnter,B=t.onPointerDownCapture,U=t.ready,$=t.offsetX,G=t.offsetY,K=t.offsetR,j=t.offsetB,V=t.onAlign,Z=t.onPrepare,z=t.stretch,H=t.targetWidth,W=t.targetHeight,Y="function"==typeof n?n():n,q=d||f,Q=(null==L?void 0:L.length)>0,X=_.useState(!L||!Q),J=(0,r.Z)(X,2),tt=J[0],et=J[1];if((0,p.Z)((function(){!tt&&Q&&h&&et(!0)}),[tt,Q,h]),!tt)return null;var nt="auto",it={left:"-1000vw",top:"-1000vh",right:nt,bottom:nt};if(U||!d){var rt,st=D.points,at=D.dynamicInset||(null===(rt=D._experimental)||void 0===rt?void 0:rt.dynamicInset),ot=at&&"r"===st[0][1],lt=at&&"b"===st[0][0];ot?(it.right=K,it.left=nt):(it.left=$,it.right=nt),lt?(it.bottom=j,it.top=nt):(it.top=G,it.bottom=nt)}var ut={};return z&&(z.includes("height")&&W?ut.height=W:z.includes("minHeight")&&W&&(ut.minHeight=W),z.includes("width")&&H?ut.width=H:z.includes("minWidth")&&H&&(ut.minWidth=H)),d||(ut.pointerEvents="none"),_.createElement(P,{open:R||q,getContainer:L&&function(){return L(h)},autoDestroy:I},_.createElement(E,{prefixCls:a,open:d,zIndex:O,mask:k,motion:x}),_.createElement(u.Z,{onResize:V,disabled:!d},(function(t){return _.createElement(v.default,(0,m.Z)({motionAppear:!0,motionEnter:!0,motionLeave:!0,removeOnLeave:!1,forceRender:R,leavedClassName:"".concat(a,"-hidden")},C,{onAppearPrepare:Z,onEnterPrepare:Z,visible:d,onVisibleChanged:function(t){var e;null==C||null===(e=C.onVisibleChanged)||void 0===e||e.call(C,t),c(t)}}),(function(n,r){var u=n.className,h=n.style,c=l()(a,u,s);return _.createElement("div",{ref:(0,y.sQ)(t,e,r),className:c,style:(0,i.Z)((0,i.Z)((0,i.Z)((0,i.Z)({"--arrow-x":"".concat(A.x||0,"px"),"--arrow-y":"".concat(A.y||0,"px")},it),ut),h),{},{boxSizing:"border-box",zIndex:O},o),onMouseEnter:F,onMouseLeave:M,onPointerEnter:N,onClick:T,onPointerDownCapture:B},S&&_.createElement(b,{prefixCls:a,arrow:S,arrowPos:A,align:D}),_.createElement(w,{cache:!d&&!g},Y))}))})))}));var k=_.forwardRef((function(t,e){var n=t.children,i=t.getTriggerDOMNode,r=(0,y.Yr)(n),s=_.useCallback((function(t){(0,y.mH)(e,i?i(t):t)}),[i]),a=(0,y.x1)(s,(0,y.C4)(n));return r?_.cloneElement(n,{ref:a}):n})),S=_.createContext(null);function A(t){return t?Array.isArray(t)?t:[t]:[]}function D(t,e,n,i){return _.useMemo((function(){var r=A(null!=n?n:e),s=A(null!=i?i:e),a=new Set(r),o=new Set(s);return t&&(a.has("hover")&&(a.delete("hover"),a.add("click")),o.has("hover")&&(o.delete("hover"),o.add("click"))),[a,o]}),[t,e,n,i])}var C=n(29194);function x(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2?arguments[2]:void 0;return n?t[0]===e[0]:t[0]===e[0]&&t[1]===e[1]}function R(t,e,n,i){for(var r=n.points,s=Object.keys(t),a=0;a<s.length;a+=1){var o,l=s[a];if(x(null===(o=t[l])||void 0===o?void 0:o.points,r,i))return"".concat(e,"-placement-").concat(l)}return""}function L(t,e,n,i){return e||(n?{motionName:"".concat(t,"-").concat(n)}:i?{motionName:i}:null)}function I(t){return t.ownerDocument.defaultView}function P(t){for(var e=[],n=null==t?void 0:t.parentElement,i=["hidden","scroll","clip","auto"];n;){var r=I(n).getComputedStyle(n);[r.overflowX,r.overflowY,r.overflow].some((function(t){return i.includes(t)}))&&e.push(n),n=n.parentElement}return e}function O(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return Number.isNaN(t)?e:t}function F(t){return O(parseFloat(t),0)}function M(t,e){var n=(0,i.Z)({},t);return(e||[]).forEach((function(t){if(!(t instanceof HTMLBodyElement||t instanceof HTMLHtmlElement)){var e=I(t).getComputedStyle(t),i=e.overflow,r=e.overflowClipMargin,s=e.borderTopWidth,a=e.borderBottomWidth,o=e.borderLeftWidth,l=e.borderRightWidth,u=t.getBoundingClientRect(),h=t.offsetHeight,c=t.clientHeight,d=t.offsetWidth,f=t.clientWidth,p=F(s),g=F(a),_=F(o),m=F(l),v=O(Math.round(u.width/d*1e3)/1e3),y=O(Math.round(u.height/h*1e3)/1e3),b=(d-f-_-m)*v,E=(h-c-p-g)*y,w=p*y,T=g*y,k=_*v,S=m*v,A=0,D=0;if("clip"===i){var C=F(r);A=C*v,D=C*y}var x=u.x+k-A,R=u.y+w-D,L=x+u.width+2*A-k-S-b,P=R+u.height+2*D-w-T-E;n.left=Math.max(n.left,x),n.top=Math.max(n.top,R),n.right=Math.min(n.right,L),n.bottom=Math.min(n.bottom,P)}})),n}function N(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n="".concat(e),i=n.match(/^(.*)\%$/);return i?t*(parseFloat(i[1])/100):parseFloat(n)}function B(t,e){var n=e||[],i=(0,r.Z)(n,2),s=i[0],a=i[1];return[N(t.width,s),N(t.height,a)]}function U(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return[t[0],t[1]]}function $(t,e){var n,i=e[0],r=e[1];return n="t"===i?t.y:"b"===i?t.y+t.height:t.y+t.height/2,{x:"l"===r?t.x:"r"===r?t.x+t.width:t.x+t.width/2,y:n}}function G(t,e){var n={t:"b",b:"t",l:"r",r:"l"};return t.map((function(t,i){return i===e?n[t]||"c":t})).join("")}function K(t,e,n,s,a,o,l){var u=_.useState({ready:!1,offsetX:0,offsetY:0,offsetR:0,offsetB:0,arrowX:0,arrowY:0,scaleX:1,scaleY:1,align:a[s]||{}}),c=(0,r.Z)(u,2),f=c[0],g=c[1],m=_.useRef(0),v=_.useMemo((function(){return e?P(e):[]}),[e]),y=_.useRef({});t||(y.current={});var b=(0,d.Z)((function(){if(e&&n&&t){var u,c,d,f,p,_=e,m=_.ownerDocument,b=I(_),E=b.getComputedStyle(_).position,w=_.style.left,T=_.style.top,k=_.style.right,S=_.style.bottom,A=_.style.overflow,D=(0,i.Z)((0,i.Z)({},a[s]),o),x=m.createElement("div");if(null===(u=_.parentElement)||void 0===u||u.appendChild(x),x.style.left="".concat(_.offsetLeft,"px"),x.style.top="".concat(_.offsetTop,"px"),x.style.position=E,x.style.height="".concat(_.offsetHeight,"px"),x.style.width="".concat(_.offsetWidth,"px"),_.style.left="0",_.style.top="0",_.style.right="auto",_.style.bottom="auto",_.style.overflow="hidden",Array.isArray(n))p={x:n[0],y:n[1],width:0,height:0};else{var R,L,P=n.getBoundingClientRect();P.x=null!==(R=P.x)&&void 0!==R?R:P.left,P.y=null!==(L=P.y)&&void 0!==L?L:P.top,p={x:P.x,y:P.y,width:P.width,height:P.height}}var F=_.getBoundingClientRect(),N=b.getComputedStyle(_),K=N.height,j=N.width;F.x=null!==(c=F.x)&&void 0!==c?c:F.left,F.y=null!==(d=F.y)&&void 0!==d?d:F.top;var V=m.documentElement,Z=V.clientWidth,z=V.clientHeight,H=V.scrollWidth,W=V.scrollHeight,Y=V.scrollTop,q=V.scrollLeft,Q=F.height,X=F.width,J=p.height,tt=p.width,et={left:0,top:0,right:Z,bottom:z},nt={left:-q,top:-Y,right:H-q,bottom:W-Y},it=D.htmlRegion,rt="visible",st="visibleFirst";"scroll"!==it&&it!==st&&(it=rt);var at=it===st,ot=M(nt,v),lt=M(et,v),ut=it===rt?lt:ot,ht=at?lt:ut;_.style.left="auto",_.style.top="auto",_.style.right="0",_.style.bottom="0";var ct=_.getBoundingClientRect();_.style.left=w,_.style.top=T,_.style.right=k,_.style.bottom=S,_.style.overflow=A,null===(f=_.parentElement)||void 0===f||f.removeChild(x);var dt=O(Math.round(X/parseFloat(j)*1e3)/1e3),ft=O(Math.round(Q/parseFloat(K)*1e3)/1e3);if(0===dt||0===ft||(0,h.Sh)(n)&&!(0,C.Z)(n))return;var pt=D.offset,gt=D.targetOffset,_t=B(F,pt),mt=(0,r.Z)(_t,2),vt=mt[0],yt=mt[1],bt=B(p,gt),Et=(0,r.Z)(bt,2),wt=Et[0],Tt=Et[1];p.x-=wt,p.y-=Tt;var kt=D.points||[],St=(0,r.Z)(kt,2),At=St[0],Dt=U(St[1]),Ct=U(At),xt=$(p,Dt),Rt=$(F,Ct),Lt=(0,i.Z)({},D),It=xt.x-Rt.x+vt,Pt=xt.y-Rt.y+yt;function Ae(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:ut,i=F.x+t,r=F.y+e,s=i+X,a=r+Q,o=Math.max(i,n.left),l=Math.max(r,n.top),u=Math.min(s,n.right),h=Math.min(a,n.bottom);return Math.max(0,(u-o)*(h-l))}var Ot,Ft,Mt,Nt,Bt=Ae(It,Pt),Ut=Ae(It,Pt,lt),$t=$(p,["t","l"]),Gt=$(F,["t","l"]),Kt=$(p,["b","r"]),jt=$(F,["b","r"]),Vt=D.overflow||{},Zt=Vt.adjustX,zt=Vt.adjustY,Ht=Vt.shiftX,Wt=Vt.shiftY,Yt=function(t){return"boolean"==typeof t?t:t>=0};function De(){Ot=F.y+Pt,Ft=Ot+Q,Mt=F.x+It,Nt=Mt+X}De();var qt=Yt(zt),Qt=Ct[0]===Dt[0];if(qt&&"t"===Ct[0]&&(Ft>ht.bottom||y.current.bt)){var Xt=Pt;Qt?Xt-=Q-J:Xt=$t.y-jt.y-yt;var Jt=Ae(It,Xt),te=Ae(It,Xt,lt);Jt>Bt||Jt===Bt&&(!at||te>=Ut)?(y.current.bt=!0,Pt=Xt,yt=-yt,Lt.points=[G(Ct,0),G(Dt,0)]):y.current.bt=!1}if(qt&&"b"===Ct[0]&&(Ot<ht.top||y.current.tb)){var ee=Pt;Qt?ee+=Q-J:ee=Kt.y-Gt.y-yt;var ne=Ae(It,ee),ie=Ae(It,ee,lt);ne>Bt||ne===Bt&&(!at||ie>=Ut)?(y.current.tb=!0,Pt=ee,yt=-yt,Lt.points=[G(Ct,0),G(Dt,0)]):y.current.tb=!1}var re=Yt(Zt),se=Ct[1]===Dt[1];if(re&&"l"===Ct[1]&&(Nt>ht.right||y.current.rl)){var ae=It;se?ae-=X-tt:ae=$t.x-jt.x-vt;var oe=Ae(ae,Pt),le=Ae(ae,Pt,lt);oe>Bt||oe===Bt&&(!at||le>=Ut)?(y.current.rl=!0,It=ae,vt=-vt,Lt.points=[G(Ct,1),G(Dt,1)]):y.current.rl=!1}if(re&&"r"===Ct[1]&&(Mt<ht.left||y.current.lr)){var ue=It;se?ue+=X-tt:ue=Kt.x-Gt.x-vt;var he=Ae(ue,Pt),ce=Ae(ue,Pt,lt);he>Bt||he===Bt&&(!at||ce>=Ut)?(y.current.lr=!0,It=ue,vt=-vt,Lt.points=[G(Ct,1),G(Dt,1)]):y.current.lr=!1}De();var de=!0===Ht?0:Ht;"number"==typeof de&&(Mt<lt.left&&(It-=Mt-lt.left-vt,p.x+tt<lt.left+de&&(It+=p.x-lt.left+tt-de)),Nt>lt.right&&(It-=Nt-lt.right-vt,p.x>lt.right-de&&(It+=p.x-lt.right+de)));var fe=!0===Wt?0:Wt;"number"==typeof fe&&(Ot<lt.top&&(Pt-=Ot-lt.top-yt,p.y+J<lt.top+fe&&(Pt+=p.y-lt.top+J-fe)),Ft>lt.bottom&&(Pt-=Ft-lt.bottom-yt,p.y>lt.bottom-fe&&(Pt+=p.y-lt.bottom+fe)));var pe=F.x+It,ge=pe+X,_e=F.y+Pt,me=_e+Q,ve=p.x,ye=ve+tt,be=p.y,Ee=be+J,we=(Math.max(pe,ve)+Math.min(ge,ye))/2-pe,Te=(Math.max(_e,be)+Math.min(me,Ee))/2-_e;null==l||l(e,Lt);var ke=ct.right-F.x-(It+F.width),Se=ct.bottom-F.y-(Pt+F.height);1===dt&&(It=Math.round(It),ke=Math.round(ke)),1===ft&&(Pt=Math.round(Pt),Se=Math.round(Se)),g({ready:!0,offsetX:It/dt,offsetY:Pt/ft,offsetR:ke/dt,offsetB:Se/ft,arrowX:we/dt,arrowY:Te/ft,scaleX:dt,scaleY:ft,align:Lt})}})),E=function(){g((function(t){return(0,i.Z)((0,i.Z)({},t),{},{ready:!1})}))};return(0,p.Z)(E,[s]),(0,p.Z)((function(){t||E()}),[t]),[f.ready,f.offsetX,f.offsetY,f.offsetR,f.offsetB,f.arrowX,f.arrowY,f.scaleX,f.scaleY,f.align,function(){m.current+=1;var t=m.current;Promise.resolve().then((function(){m.current===t&&b()}))}]}var j=n(94480);function V(t,e,n,i,r){(0,p.Z)((function(){if(t&&e&&n){var s=n,a=P(e),o=P(s),l=I(s),u=new Set([l].concat((0,j.Z)(a),(0,j.Z)(o)));function h(){i(),r()}return u.forEach((function(t){t.addEventListener("scroll",h,{passive:!0})})),l.addEventListener("resize",h,{passive:!0}),i(),function(){u.forEach((function(t){t.removeEventListener("scroll",h),l.removeEventListener("resize",h)}))}}}),[t,e,n])}n(48736);function Z(t,e,n,i,r,s,a,o){var l=_.useRef(t);l.current=t;var u=_.useRef(!1);return _.useEffect((function(){if(e&&i&&(!r||s)){var t=function(){u.current=!1},h=function(t){var e;!l.current||a((null===(e=t.composedPath)||void 0===e||null===(e=e.call(t))||void 0===e?void 0:e[0])||t.target)||u.current||o(!1)},d=I(i);d.addEventListener("pointerdown",t,!0),d.addEventListener("mousedown",h,!0),d.addEventListener("contextmenu",h,!0);var f=(0,c.A)(n);return f&&(f.addEventListener("mousedown",h,!0),f.addEventListener("contextmenu",h,!0)),function(){d.removeEventListener("pointerdown",t,!0),d.removeEventListener("mousedown",h,!0),d.removeEventListener("contextmenu",h,!0),f&&(f.removeEventListener("mousedown",h,!0),f.removeEventListener("contextmenu",h,!0))}}}),[e,n,i,r,s]),function(){u.current=!0}}var z=["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"];var H=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:a.Z,e=_.forwardRef((function(e,n){var a=e.prefixCls,o=void 0===a?"rc-trigger-popup":a,m=e.children,v=e.action,y=void 0===v?"hover":v,b=e.showAction,E=e.hideAction,w=e.popupVisible,A=e.defaultPopupVisible,C=e.onPopupVisibleChange,x=e.afterPopupVisibleChange,I=e.mouseEnterDelay,P=e.mouseLeaveDelay,O=void 0===P?.1:P,F=e.focusDelay,M=e.blurDelay,N=e.mask,B=e.maskClosable,U=void 0===B||B,$=e.getPopupContainer,G=e.forceRender,j=e.autoDestroy,H=e.destroyPopupOnHide,W=e.popup,Y=e.popupClassName,q=e.popupStyle,Q=e.popupPlacement,X=e.builtinPlacements,J=void 0===X?{}:X,tt=e.popupAlign,et=e.zIndex,nt=e.stretch,it=e.getPopupClassNameFromAlign,rt=e.fresh,st=e.alignPoint,at=e.onPopupClick,ot=e.onPopupAlign,lt=e.arrow,ut=e.popupMotion,ht=e.maskMotion,ct=e.popupTransitionName,dt=e.popupAnimation,ft=e.maskTransitionName,pt=e.maskAnimation,gt=e.className,_t=e.getTriggerDOMNode,mt=(0,s.Z)(e,z),vt=j||H||!1,yt=_.useState(!1),bt=(0,r.Z)(yt,2),Et=bt[0],wt=bt[1];(0,p.Z)((function(){wt((0,g.Z)())}),[]);var Tt=_.useRef({}),kt=_.useContext(S),St=_.useMemo((function(){return{registerSubPopup:function(t,e){Tt.current[t]=e,null==kt||kt.registerSubPopup(t,e)}}}),[kt]),At=(0,f.Z)(),Dt=_.useState(null),Ct=(0,r.Z)(Dt,2),xt=Ct[0],Rt=Ct[1],Lt=_.useRef(null),It=(0,d.Z)((function(t){Lt.current=t,(0,h.Sh)(t)&&xt!==t&&Rt(t),null==kt||kt.registerSubPopup(At,t)})),Pt=_.useState(null),Ot=(0,r.Z)(Pt,2),Ft=Ot[0],Mt=Ot[1],Nt=_.useRef(null),Bt=(0,d.Z)((function(t){(0,h.Sh)(t)&&Ft!==t&&(Mt(t),Nt.current=t)})),Ut=_.Children.only(m),$t=(null==Ut?void 0:Ut.props)||{},Gt={},Kt=(0,d.Z)((function(t){var e,n,i=Ft;return(null==i?void 0:i.contains(t))||(null===(e=(0,c.A)(i))||void 0===e?void 0:e.host)===t||t===i||(null==xt?void 0:xt.contains(t))||(null===(n=(0,c.A)(xt))||void 0===n?void 0:n.host)===t||t===xt||Object.values(Tt.current).some((function(e){return(null==e?void 0:e.contains(t))||t===e}))})),jt=L(o,ut,dt,ct),Vt=L(o,ht,pt,ft),Zt=_.useState(A||!1),zt=(0,r.Z)(Zt,2),Ht=zt[0],Wt=zt[1],Yt=null!=w?w:Ht,qt=(0,d.Z)((function(t){void 0===w&&Wt(t)}));(0,p.Z)((function(){Wt(w||!1)}),[w]);var Qt=_.useRef(Yt);Qt.current=Yt;var Xt=_.useRef([]);Xt.current=[];var Jt=(0,d.Z)((function(t){var e;qt(t),(null!==(e=Xt.current[Xt.current.length-1])&&void 0!==e?e:Yt)!==t&&(Xt.current.push(t),null==C||C(t))})),te=_.useRef(),ee=function(){clearTimeout(te.current)},ne=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;ee(),0===e?Jt(t):te.current=setTimeout((function(){Jt(t)}),1e3*e)};_.useEffect((function(){return ee}),[]);var ie=_.useState(!1),re=(0,r.Z)(ie,2),se=re[0],ae=re[1];(0,p.Z)((function(t){t&&!Yt||ae(!0)}),[Yt]);var oe=_.useState(null),le=(0,r.Z)(oe,2),ue=le[0],he=le[1],ce=_.useState(null),de=(0,r.Z)(ce,2),fe=de[0],pe=de[1],ge=function(t){pe([t.clientX,t.clientY])},_e=K(Yt,xt,st&&null!==fe?fe:Ft,Q,J,tt,ot),me=(0,r.Z)(_e,11),ve=me[0],ye=me[1],be=me[2],Ee=me[3],we=me[4],Te=me[5],ke=me[6],Se=me[7],Ae=me[8],De=me[9],Ce=me[10],xe=D(Et,y,b,E),Re=(0,r.Z)(xe,2),Le=Re[0],Ie=Re[1],Pe=Le.has("click"),Oe=Ie.has("click")||Ie.has("contextMenu"),Fe=(0,d.Z)((function(){se||Ce()}));V(Yt,Ft,xt,Fe,(function(){Qt.current&&st&&Oe&&ne(!1)})),(0,p.Z)((function(){Fe()}),[fe,Q]),(0,p.Z)((function(){!Yt||null!=J&&J[Q]||Fe()}),[JSON.stringify(tt)]);var Me=_.useMemo((function(){var t=R(J,o,De,st);return l()(t,null==it?void 0:it(De))}),[De,it,J,o,st]);_.useImperativeHandle(n,(function(){return{nativeElement:Nt.current,popupElement:Lt.current,forceAlign:Fe}}));var Ne=_.useState(0),Be=(0,r.Z)(Ne,2),Ue=Be[0],$e=Be[1],Ge=_.useState(0),Ke=(0,r.Z)(Ge,2),je=Ke[0],Ve=Ke[1],Ze=function(){if(nt&&Ft){var t=Ft.getBoundingClientRect();$e(t.width),Ve(t.height)}};function ze(t,e,n,i){Gt[t]=function(r){var s;null==i||i(r),ne(e,n);for(var a=arguments.length,o=new Array(a>1?a-1:0),l=1;l<a;l++)o[l-1]=arguments[l];null===(s=$t[t])||void 0===s||s.call.apply(s,[$t,r].concat(o))}}(0,p.Z)((function(){ue&&(Ce(),ue(),he(null))}),[ue]),(Pe||Oe)&&(Gt.onClick=function(t){var e;Qt.current&&Oe?ne(!1):!Qt.current&&Pe&&(ge(t),ne(!0));for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];null===(e=$t.onClick)||void 0===e||e.call.apply(e,[$t,t].concat(i))});var He,We,Ye=Z(Yt,Oe,Ft,xt,N,U,Kt,ne),qe=Le.has("hover"),Qe=Ie.has("hover");qe&&(ze("onMouseEnter",!0,I,(function(t){ge(t)})),ze("onPointerEnter",!0,I,(function(t){ge(t)})),He=function(t){(Yt||se)&&null!=xt&&xt.contains(t.target)&&ne(!0,I)},st&&(Gt.onMouseMove=function(t){var e;null===(e=$t.onMouseMove)||void 0===e||e.call($t,t)})),Qe&&(ze("onMouseLeave",!1,O),ze("onPointerLeave",!1,O),We=function(){ne(!1,O)}),Le.has("focus")&&ze("onFocus",!0,F),Ie.has("focus")&&ze("onBlur",!1,M),Le.has("contextMenu")&&(Gt.onContextMenu=function(t){var e;Qt.current&&Ie.has("contextMenu")?ne(!1):(ge(t),ne(!0)),t.preventDefault();for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];null===(e=$t.onContextMenu)||void 0===e||e.call.apply(e,[$t,t].concat(i))}),gt&&(Gt.className=l()($t.className,gt));var Xe=_.useRef(!1);Xe.current||(Xe.current=G||Yt||se);var Je=(0,i.Z)((0,i.Z)({},$t),Gt),tn={};["onContextMenu","onClick","onMouseDown","onTouchStart","onMouseEnter","onMouseLeave","onFocus","onBlur"].forEach((function(t){mt[t]&&(tn[t]=function(){for(var e,n=arguments.length,i=new Array(n),r=0;r<n;r++)i[r]=arguments[r];null===(e=Je[t])||void 0===e||e.call.apply(e,[Je].concat(i)),mt[t].apply(mt,i)})}));var en=_.cloneElement(Ut,(0,i.Z)((0,i.Z)({},Je),tn)),nn={x:Te,y:ke},rn=lt?(0,i.Z)({},!0!==lt?lt:{}):null;return _.createElement(_.Fragment,null,_.createElement(u.Z,{disabled:!Yt,ref:Bt,onResize:function(){Ze(),Fe()}},_.createElement(k,{getTriggerDOMNode:_t},en)),Xe.current&&_.createElement(S.Provider,{value:St},_.createElement(T,{portal:t,ref:It,prefixCls:o,popup:W,className:l()(Y,Me),style:q,target:Ft,onMouseEnter:He,onMouseLeave:We,onPointerEnter:He,zIndex:et,open:Yt,keepDom:se,fresh:rt,onClick:at,onPointerDownCapture:Ye,mask:N,motion:jt,maskMotion:Vt,onVisibleChanged:function(t){ae(!1),Ce(),null==x||x(t)},onPrepare:function(){return new Promise((function(t){Ze(),he((function(){return t}))}))},forceRender:G,autoDestroy:vt,getPopupContainer:$,align:De,arrow:rn,arrowPos:nn,ready:ve,offsetX:ye,offsetY:be,offsetR:Ee,offsetB:we,onAlign:Fe,stretch:nt,targetWidth:Ue/Se,targetHeight:je/Ae})))}));return e}(a.Z)},21361:function(t,e,n){"use strict";n.r(e),n.d(e,{default:function(){return C}});var i=n(82242),r=n.n(i),s=n(7557),a=n.n(s),o=n(41498),l=n.n(o),u=n(37205),h=n.n(u),c=n(79800),d=n.n(c),f=n(59301),p=n(5030),g=n.p+"static/detailTitle3.35713931.png",_=n(18645),m=n(48289),v=n(25399),y=n(29787),b=n(60242),E=n(62878),w=n(35218),T=n(11046),k=n(90059),S=n(53483),A=n(67310),D=n(37712),C=(0,p.connect)((function(t){return{pathsDetail:t.pathsDetail}}))((function(t){var e,i,s,o,u=t.pathsDetail,c=(t.dispatch,(0,p.useParams)()),C=(0,f.useState)(1),x=d()(C,2),R=x[0],L=x[1],I=(0,T.U)(w.Cc,{subject_id:null==c?void 0:c.pathId,uuid:null==c?void 0:c.learningpathId}),P=d()(I,4),O=P[1],F=P[2],M=P[3],N=(0,f.useState)([]),B=d()(N,2),U=B[0],$=B[1],G=(0,f.useState)(!1),K=d()(G,2),j=K[0],V=K[1],Z=(0,f.useState)({}),z=d()(Z,2),H=z[0],W=z[1],Y=(0,f.useState)(!1),q=d()(Y,2),Q=q[0],X=q[1],J=[3,2,1];(0,f.useEffect)((function(){F({})}),[]),(0,f.useEffect)((function(){var t;if(null!=u&&null!==(t=u.detail)&&void 0!==t&&t.nodes&&1===R){var e,n=h()(null==u||null===(e=u.detail)||void 0===e?void 0:e.nodes);$(null==n?void 0:n.splice(1)),L(2)}}),[null==u||null===(e=u.detail)||void 0===e?void 0:e.nodes]);var tt=(0,f.useMemo)((function(){return[{title:"标签节点名称",width:"240rem",ellipsis:!0,dataIndex:"name",render:function(t){return(0,D.jsx)(v.Z,{title:t,children:t})}},{title:"已关联资源数",ellipsis:!0,dataIndex:"resource_count"},{title:"实训",ellipsis:!0,dataIndex:"shixun"},{title:"视频",ellipsis:!0,dataIndex:"video"},{title:"课件",ellipsis:!0,dataIndex:"attachment"},{title:"试卷",ellipsis:!0,dataIndex:"examination_bank"},{title:"作业",ellipsis:!0,dataIndex:"homework"},{title:"其他",ellipsis:!0,dataIndex:"other"},{title:"查看",ellipsis:!0,dataIndex:"look",render:function(t,e){return(0,D.jsx)("a",{style:{color:"#18D6FF"},onClick:function(){it(e)},children:"查看详情"})}}]}),[]),et=function(){var t=l()(a()().mark((function t(){return a()().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:F({});case 1:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),nt=(0,f.useMemo)((function(){var t,e,n=(null==M||null===(t=M.data)||void 0===t?void 0:t.relation_resource_count)||0,i=n+((null==M||null===(e=M.data)||void 0===e?void 0:e.no_relation_resource_count)||0);return i>0?Math.round(n/i*100):0}),[null==M?void 0:M.data]),it=function(){var t=l()(a()().mark((function t(e){var n,i,s,o;return a()().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return X(!0),t.next=3,(0,A.ZP)("/api/knowledge/v2/get_node.json",{method:"get",params:{depth:0,subject_id:null==c?void 0:c.pathId,nodeUuid:null==e?void 0:e.knowledge_uuid}});case 3:0===(null==(n=t.sent)?void 0:n.status)&&(null==n||null===(i=n.data)||void 0===i||null===(i=i.nodes)||void 0===i?void 0:i.length)>0&&((o=null==n||null===(s=n.data)||void 0===s||null===(s=s.nodes)||void 0===s||null===(s=s.map((function(t){var e,i,s,a,o,l,u,h,c,d,f,p=null==n||null===(e=n.data)||void 0===e?void 0:e.resource_count;return r()(r()({},null==t?void 0:t.properties),{},{rootNodeUuid:null==t||null===(i=t.properties)||void 0===i?void 0:i.rootNodeUuid,id:null==t||null===(s=t.properties)||void 0===s?void 0:s.uuid,name:null==t||null===(a=t.properties)||void 0===a?void 0:a.name,description:null==t||null===(o=t.properties)||void 0===o?void 0:o.description,nodeType:null==t||null===(l=t.properties)||void 0===l?void 0:l.nodeType,tags:(null==t||null===(u=t.properties)||void 0===u?void 0:u.tags)&&(null==t||null===(h=t.properties)||void 0===h||null===(h=h.tags)||void 0===h||null===(h=h.split(""))||void 0===h?void 0:h.map((function(t){return{name:t}})))||[],colorType:parseInt(null==t||null===(c=t.properties)||void 0===c?void 0:c.color)>3?"3":null==t||null===(d=t.properties)||void 0===d?void 0:d.color,activeColor:"#FA6400",size:J[(null==t||null===(f=t.properties)||void 0===f?void 0:f.color)-1]||1,shape:"circle",hide:!1,isExtendedState:!0,currentResourceTotal:p})})))||void 0===s?void 0:s[0]).resourceid=null==e?void 0:e.id,o.tpacti=null==e?void 0:e.knowledge_uuid,W(o),V(!0)),X(!1);case 6:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}();return(0,D.jsxs)(y.Z,{spinning:O||Q,children:[(0,D.jsxs)("div",{className:"w-full c-white text-14px-rem",style:{background:"#030616 url(".concat(m,") 0 0 / 100% auto no-repeat"),height:"100vh",overflow:"auto"},children:[(0,D.jsx)("div",{className:"w-full flex item-center justify-center",style:{background:"#030616 url(".concat(g,") 0 0 / 100% 100% no-repeat"),height:"108rem"}}),(0,D.jsxs)("div",{className:"ml-auto mr-auto flex flex-col mt-20px-rem",style:{width:"1200rem"},children:[(0,D.jsxs)("div",{className:"w-full flex item-center gap-64px-rem",style:{background:"#030616 url(".concat(_,") 0 0 / 100% 100% no-repeat"),height:"156rem",padding:"0 64px",justifyContent:"space-around"},children:[(0,D.jsxs)("div",{className:"flex item-center gap-16px-rem",children:[(0,D.jsx)("img",{src:n(76296),width:65,height:80,style:{width:"65rem",height:"80rem"}}),(0,D.jsxs)("div",{className:"flex flex-col",children:[(0,D.jsx)("div",{className:"text-500",children:"已关联资源标签节点数"}),(0,D.jsx)("div",{className:"text-20px-rem multi_ellipsis1 blod",style:{color:"#7FBEFF"},children:(null==M||null===(i=M.data)||void 0===i?void 0:i.relation_resource_count)||0})]})]}),(0,D.jsxs)("div",{className:"flex item-center gap-16px-rem",children:[(0,D.jsx)("img",{src:n(30757),width:65,height:80,style:{width:"65rem",height:"80rem"}}),(0,D.jsxs)("div",{className:"flex flex-col",children:[(0,D.jsx)("div",{className:"text-500",children:"未关联资源标签节点数"}),(0,D.jsx)("div",{className:"text-20px-rem multi_ellipsis1 blod",style:{color:"#86A0FF"},children:(null==M||null===(s=M.data)||void 0===s?void 0:s.no_relation_resource_count)||0})]})]}),(0,D.jsxs)("div",{className:"flex item-center gap-16px-rem",children:[(0,D.jsx)(b.Z,{type:"circle",percent:nt,showInfo:!1,size:65,strokeWidth:18,trailColor:"rgba(100, 135, 188, 0.40)",strokeColor:"#1BBDE0"}),(0,D.jsxs)("div",{className:"flex flex-col text-nowrap",children:[(0,D.jsxs)("div",{children:["知识点建设率 ",(0,D.jsxs)(v.Z,{title:"资源建设率 = 图谱中已关联资源的标签节点数 / 图谱标签节点总数",children:[(0,D.jsx)("i",{className:"iconfont icon-xiaowenhao2",style:{fontSize:"16rem"}})," "]})]}),(0,D.jsxs)("div",{className:"text-24px-rem ",style:{color:"#1BBDE0",fontWeight:800},children:[nt,"%"]})]})]})]}),(0,D.jsxs)("div",{className:"flex flex-col mt-22px-rem gap-12px-rem pb-20px",children:[(0,D.jsx)("div",{className:"w-full flex item-center justify-center px-30px-rem rounded-2px-rem gap-16px-rem sticky ".concat(E.Z.TableMyHeader),style:{height:"40rem",top:0},children:null==tt?void 0:tt.map((function(t,e){return(0,D.jsx)("div",{className:"minW-0 ".concat(null!=t&&t.ellipsis?"multi_ellipsis1":""),style:{flex:null!=t&&t.width?"":1,width:(null==t?void 0:t.width)||""},children:null==t?void 0:t.title},e)}))}),0==(null==M?void 0:M.total_count)?(0,D.jsx)(k.Z,{}):null==M||null===(o=M.data)||void 0===o||null===(o=o.knowledge_infos)||void 0===o?void 0:o.map((function(t,e){return(0,D.jsx)("div",{style:{height:"54rem"},className:"w-full flex item-center justify-center px-30px-rem rounded-2px-rem gap-16px-rem ".concat(E.Z.TableMyDiv),children:null==tt?void 0:tt.map((function(n,i){var r;return(0,D.jsx)("div",{className:"minW-0 ".concat(null!=n&&n.ellipsis?"multi_ellipsis1":""),style:{flex:null!=n&&n.width?"":1,width:(null==n?void 0:n.width)||""},children:(null==n||null===(r=n.render)||void 0===r?void 0:r.call(n,null==t?void 0:t[null==n?void 0:n.dataIndex],t,e))||(null==t?void 0:t[null==n?void 0:n.dataIndex])},i)}))},e)}))]})]})]}),(0,D.jsx)(S.Z,{initdata:et,uuid:null==c?void 0:c.learningpathId,setshow:function(){},getData:et,containerRef:function(){},showdetail:j,setshowdetail:V,items:H,Tabsdatas:U,tpacti:null==H?void 0:H.tpacti})]})}))},64018:function(){window.PR_SHOULD_USE_CONTINUATION=!0,function(){var t=window,e=["break,continue,do,else,for,if,return,while"],n=[[e,"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"],"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],i=[n,"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"],r=[n,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],s=[n,"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"],a=[n,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],o="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",l=[e,"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"],u=[e,"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"],h=[e,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],c=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,d="str",f="com",p="typ",g="lit",_="pun",m="pln",v="atv";function y(t,e,n,i,r){if(n){var s={sourceNode:t,pre:1,langExtension:null,numberLines:null,sourceCode:n,spans:null,basePos:e,decorations:null};i(s),r.push.apply(r,s.decorations)}}var b=/\S/;function E(t){for(var e=void 0,n=t.firstChild;n;n=n.nextSibling){var i=n.nodeType;e=1===i?e?t:n:3===i&&b.test(n.nodeValue)?t:e}return e===t?void 0:e}function w(t,e){var n,i={};!function(){for(var r=t.concat(e),s=[],a={},o=0,l=r.length;o<l;++o){var u=r[o],h=u[3];if(h)for(var c=h.length;--c>=0;)i[h.charAt(c)]=u;var d=u[1],f=""+d;a.hasOwnProperty(f)||(s.push(d),a[f]=null)}s.push(/[\0-\uffff]/),n=function(t){for(var e=0,n=!1,i=!1,r=0,s=t.length;r<s;++r)if((d=t[r]).ignoreCase)i=!0;else if(/[a-z]/i.test(d.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){n=!0,i=!1;break}var a={b:8,t:9,n:10,v:11,f:12,r:13};function o(t){var e=t.charCodeAt(0);if(92!==e)return e;var n=t.charAt(1);return(e=a[n])||("0"<=n&&n<="7"?parseInt(t.substring(1),8):"u"===n||"x"===n?parseInt(t.substring(2),16):t.charCodeAt(1))}function l(t){if(t<32)return(t<16?"\\x0":"\\x")+t.toString(16);var e=String.fromCharCode(t);return"\\"===e||"-"===e||"]"===e||"^"===e?"\\"+e:e}function u(t){var e=t.substring(1,t.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")),n=[],i="^"===e[0],r=["["];i&&r.push("^");for(var s=i?1:0,a=e.length;s<a;++s){var u=e[s];if(/\\[bdsw]/i.test(u))r.push(u);else{var h,c=o(u);s+2<a&&"-"===e[s+1]?(h=o(e[s+2]),s+=2):h=c,n.push([c,h]),h<65||c>122||(h<65||c>90||n.push([32|Math.max(65,c),32|Math.min(h,90)]),h<97||c>122||n.push([-33&Math.max(97,c),-33&Math.min(h,122)]))}}n.sort((function(t,e){return t[0]-e[0]||e[1]-t[1]}));var d=[],f=[];for(s=0;s<n.length;++s)(p=n[s])[0]<=f[1]+1?f[1]=Math.max(f[1],p[1]):d.push(f=p);for(s=0;s<d.length;++s){var p=d[s];r.push(l(p[0])),p[1]>p[0]&&(p[1]+1>p[0]&&r.push("-"),r.push(l(p[1])))}return r.push("]"),r.join("")}function h(t){for(var i=t.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")),r=i.length,s=[],a=0,o=0;a<r;++a)"("===(c=i[a])?++o:"\\"===c.charAt(0)&&(h=+c.substring(1))&&(h<=o?s[h]=-1:i[a]=l(h));for(a=1;a<s.length;++a)-1===s[a]&&(s[a]=++e);for(a=0,o=0;a<r;++a)if("("===(c=i[a]))s[++o]||(i[a]="(?:");else if("\\"===c.charAt(0)){var h;(h=+c.substring(1))&&h<=o&&(i[a]="\\"+s[h])}for(a=0;a<r;++a)"^"===i[a]&&"^"!==i[a+1]&&(i[a]="");if(t.ignoreCase&&n)for(a=0;a<r;++a){var c,d=(c=i[a]).charAt(0);c.length>=2&&"["===d?i[a]=u(c):"\\"!==d&&(i[a]=c.replace(/[a-zA-Z]/g,(function(t){var e=t.charCodeAt(0);return"["+String.fromCharCode(-33&e,32|e)+"]"})))}return i.join("")}var c=[];for(r=0,s=t.length;r<s;++r){var d;if((d=t[r]).global||d.multiline)throw new Error(""+d);c.push("(?:"+h(d)+")")}return new RegExp(c.join("|"),i?"gi":"g")}(s)}();var r=e.length,s=function(t){for(var a=t.sourceCode,o=t.basePos,l=t.sourceNode,u=[o,m],h=0,c=a.match(n)||[],d={},f=0,p=c.length;f<p;++f){var g,_=c[f],v=d[_],b=void 0;if("string"==typeof v)g=!1;else{var E=i[_.charAt(0)];if(E)b=_.match(E[1]),v=E[0];else{for(var w=0;w<r;++w)if(E=e[w],b=_.match(E[1])){v=E[0];break}b||(v=m)}!(g=v.length>=5&&"lang-"===v.substring(0,5))||b&&"string"==typeof b[1]||(g=!1,v="src"),g||(d[_]=v)}var T=h;if(h+=_.length,g){var k=b[1],S=_.indexOf(k),A=S+k.length;b[2]&&(S=(A=_.length-b[2].length)-k.length);var D=v.substring(5);y(l,o+T,_.substring(0,S),s,u),y(l,o+T+S,k,C(D,k),u),y(l,o+T+A,_.substring(A),s,u)}else u.push(o+T,v)}t.decorations=u};return s}function T(t){var e=[],n=[];t.tripleQuotedStrings?e.push([d,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,"'\""]):t.multiLineStrings?e.push([d,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):e.push([d,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,"\"'"]),t.verbatimStrings&&n.push([d,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var i=t.hashComments;i&&(t.cStyleComments?(i>1?e.push([f,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):e.push([f,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),n.push([d,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):e.push([f,/^#[^\r\n]*/,null,"#"])),t.cStyleComments&&(n.push([f,/^\/\/[^\r\n]*/,null]),n.push([f,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var r=t.regexLiterals;if(r){var s=r>1?"":"\n\r",a=s?".":"[\\S\\s]",o="/(?=[^/*"+s+"])(?:[^/\\x5B\\x5C"+s+"]|\\x5C"+a+"|\\x5B(?:[^\\x5C\\x5D"+s+"]|\\x5C"+a+")*(?:\\x5D|$))+/";n.push(["lang-regex",RegExp("^(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*("+o+")")])}var l=t.types;l&&n.push([p,l]);var u=(""+t.keywords).replace(/^ | $/g,"");u.length&&n.push(["kwd",new RegExp("^(?:"+u.replace(/[\s,]+/g,"|")+")\\b"),null]),e.push([m,/^\s+/,null," \r\n\t "]);var h="^.[^\\s\\w.$@'\"`/\\\\]*";return t.regexLiterals&&(h+="(?!s*/)"),n.push([g,/^@[a-z_$][a-z_$@0-9]*/i,null],[p,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[m,/^[a-z_$][a-z_$@0-9]*/i,null],[g,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[m,/^\\[\s\S]?/,null],[_,new RegExp(h),null]),w(e,n)}var k=T({keywords:[i,s,r,a,o,l,u,h],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function S(t,e,n){for(var i=/(?:^|\s)nocode(?:\s|$)/,r=/\r\n?|\n/,s=t.ownerDocument,a=s.createElement("li");t.firstChild;)a.appendChild(t.firstChild);var o=[a];function l(t){var e=t.nodeType;if(1!=e||i.test(t.className)){if((3==e||4==e)&&n){var a=t.nodeValue,o=a.match(r);if(o){var h=a.substring(0,o.index);t.nodeValue=h;var c=a.substring(o.index+o[0].length);if(c)t.parentNode.insertBefore(s.createTextNode(c),t.nextSibling);u(t),h||t.parentNode.removeChild(t)}}}else if("br"===t.nodeName)u(t),t.parentNode&&t.parentNode.removeChild(t);else for(var d=t.firstChild;d;d=d.nextSibling)l(d)}function u(t){for(;!t.nextSibling;)if(!(t=t.parentNode))return;for(var e,n=function t(e,n){var i=n?e.cloneNode(!1):e,r=e.parentNode;if(r){var s=t(r,1),a=e.nextSibling;s.appendChild(i);for(var o=a;o;o=a)a=o.nextSibling,s.appendChild(o)}return i}(t.nextSibling,0);(e=n.parentNode)&&1===e.nodeType;)n=e;o.push(n)}for(var h=0;h<o.length;++h)l(o[h]);e===(0|e)&&o[0].setAttribute("value",e);var c=s.createElement("ol");c.className="linenums";for(var d=Math.max(0,e-1|0)||0,f=(h=0,o.length);h<f;++h)(a=o[h]).className="L"+(h+d)%10,a.firstChild||a.appendChild(s.createTextNode(" ")),c.appendChild(a);t.appendChild(c)}var A={};function D(e,n){for(var i=n.length;--i>=0;){var r=n[i];A.hasOwnProperty(r)?t.console&&console.warn("cannot override language handler %s",r):A[r]=e}}function C(t,e){return t&&A.hasOwnProperty(t)||(t=/^\s*</.test(e)?"default-markup":"default-code"),A[t]}function x(e){var n,i,r,s,a,o,l,u=e.langExtension;try{var h=(n=e.sourceNode,i=e.pre,r=/(?:^|\s)nocode(?:\s|$)/,s=[],a=0,o=[],l=0,function t(e){var n=e.nodeType;if(1==n){if(r.test(e.className))return;for(var u=e.firstChild;u;u=u.nextSibling)t(u);var h=e.nodeName.toLowerCase();"br"!==h&&"li"!==h||(s[l]="\n",o[l<<1]=a++,o[l++<<1|1]=e)}else if(3==n||4==n){var c=e.nodeValue;c.length&&(c=i?c.replace(/\r\n?/g,"\n"):c.replace(/[ \t\r\n]+/g," "),s[l]=c,o[l<<1]=a,a+=c.length,o[l++<<1|1]=e)}}(n),{sourceCode:s.join("").replace(/\n$/,""),spans:o}),c=h.sourceCode;e.sourceCode=c,e.spans=h.spans,e.basePos=0,C(u,c)(e),function(t){var e=/\bMSIE\s(\d+)/.exec(navigator.userAgent);e=e&&+e[1]<=8;var n,i,r=/\n/g,s=t.sourceCode,a=s.length,o=0,l=t.spans,u=l.length,h=0,c=t.decorations,d=c.length,f=0;for(c[d]=a,i=n=0;i<d;)c[i]!==c[i+2]?(c[n++]=c[i++],c[n++]=c[i++]):i+=2;for(d=n,i=n=0;i<d;){for(var p=c[i],g=c[i+1],_=i+2;_+2<=d&&c[_+1]===g;)_+=2;c[n++]=p,c[n++]=g,i=_}d=c.length=n;var m=t.sourceNode,v="";m&&(v=m.style.display,m.style.display="none");try{for(;h<u;){l[h];var y,b=l[h+2]||a,E=c[f+2]||a,w=(_=Math.min(b,E),l[h+1]);if(1!==w.nodeType&&(y=s.substring(o,_))){e&&(y=y.replace(r,"\r")),w.nodeValue=y;var T=w.ownerDocument,k=T.createElement("span");k.className=c[f+1];var S=w.parentNode;S.replaceChild(k,w),k.appendChild(w),o<b&&(l[h+1]=w=T.createTextNode(s.substring(_,b)),S.insertBefore(w,k.nextSibling))}(o=_)>=b&&(h+=2),o>=E&&(f+=2)}}finally{m&&(m.style.display=v)}}(e)}catch(e){t.console&&console.log(e&&e.stack||e)}}function R(t,e,n){var i=n||!1,r=e||null,s=document.createElement("div");return s.innerHTML="<pre>"+t+"</pre>",s=s.firstChild,i&&S(s,i,!0),x({langExtension:r,numberLines:i,sourceNode:s,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null}),s.innerHTML}function L(e,n){var i=n||document.body,r=i.ownerDocument||document;function s(t){return i.getElementsByTagName(t)}for(var a=[s("pre"),s("code"),s("xmp")],o=[],l=0;l<a.length;++l)for(var u=0,h=a[l].length;u<h;++u)o.push(a[l][u]);a=null;var c=Date;c.now||(c={now:function(){return+new Date}});var d=0,f=/\blang(?:uage)?-([\w.]+)(?!\S)/,p=/\bprettyprint\b/,g=/\bprettyprinted\b/,_=/pre|xmp/i,m=/^code$/i,v=/^(?:pre|code|xmp)$/i,y={};!function n(){for(var i=t.PR_SHOULD_USE_CONTINUATION?c.now()+250:1/0;d<o.length&&c.now()<i;d++){for(var s=o[d],a=y,l=s;l=l.previousSibling;){var u=l.nodeType,h=(7===u||8===u)&&l.nodeValue;if(h?!/^\??prettify\b/.test(h):3!==u||/\S/.test(l.nodeValue))break;if(h){a={},h.replace(/\b(\w+)=([\w:.%+-]+)/g,(function(t,e,n){a[e]=n}));break}}var b=s.className;if((a!==y||p.test(b))&&!g.test(b)){for(var w=!1,T=s.parentNode;T;T=T.parentNode){var k=T.tagName;if(v.test(k)&&T.className&&p.test(T.className)){w=!0;break}}if(!w){s.className+=" prettyprinted";var A,D,C=a.lang;if(!C)!(C=b.match(f))&&(A=E(s))&&m.test(A.tagName)&&(C=A.className.match(f)),C&&(C=C[1]);if(_.test(s.tagName))D=1;else{var R=s.currentStyle,L=r.defaultView,I=R?R.whiteSpace:L&&L.getComputedStyle?L.getComputedStyle(s,null).getPropertyValue("white-space"):0;D=I&&"pre"===I.substring(0,3)}var P=a.linenums;(P="true"===P||+P)||(P=!!(P=b.match(/\blinenums\b(?::(\d+))?/))&&(!P[1]||!P[1].length||+P[1])),P&&S(s,P,D),x({langExtension:C,sourceNode:s,numberLines:P,pre:D,sourceCode:null,basePos:null,spans:null,decorations:null})}}}d<o.length?t.setTimeout(n,250):"function"==typeof e&&e()}()}D(k,["default-code"]),D(w([],[[m,/^[^<?]+/],["dec",/^<!\w[^>]*(?:>|$)/],[f,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[_,/^(?:<[%?]|[%?]>)/],["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"]),D(w([[m,/^[\s]+/,null," \t\r\n"],[v,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[_,/^[=<>\/]+/],["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"]),D(w([],[[v,/^[\s\S]+/]]),["uq.val"]),D(T({keywords:i,hashComments:!0,cStyleComments:!0,types:c}),["c","cc","cpp","cxx","cyc","m"]),D(T({keywords:"null,true,false"}),["json"]),D(T({keywords:s,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:c}),["cs"]),D(T({keywords:r,cStyleComments:!0}),["java"]),D(T({keywords:h,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),D(T({keywords:l,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),D(T({keywords:o,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),D(T({keywords:u,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),D(T({keywords:a,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),D(T({keywords:"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",hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),D(w([],[[d,/^[\s\S]+/]]),["regex"]);var I=t.PR={createSimpleLexer:w,registerLangHandler:D,sourceDecorator:T,PR_ATTRIB_NAME:"atn",PR_ATTRIB_VALUE:v,PR_COMMENT:f,PR_DECLARATION:"dec",PR_KEYWORD:"kwd",PR_LITERAL:g,PR_NOCODE:"nocode",PR_PLAIN:m,PR_PUNCTUATION:_,PR_SOURCE:"src",PR_STRING:d,PR_TAG:"tag",PR_TYPE:p,prettyPrintOne:R,prettyPrint:L},P=t.define;"function"==typeof P&&P.amd&&P("google-code-prettify",[],(function(){return I}))}()},25769:function(t,e,n){"use strict";var i=n(98040),r={"text/plain":"Text","text/html":"Url",default:"Text"};t.exports=function(t,e){var n,s,a,o,l,u,h=!1;e||(e={}),n=e.debug||!1;try{if(a=i(),o=document.createRange(),l=document.getSelection(),(u=document.createElement("span")).textContent=t,u.ariaHidden="true",u.style.all="unset",u.style.position="fixed",u.style.top=0,u.style.clip="rect(0, 0, 0, 0)",u.style.whiteSpace="pre",u.style.webkitUserSelect="text",u.style.MozUserSelect="text",u.style.msUserSelect="text",u.style.userSelect="text",u.addEventListener("copy",(function(i){if(i.stopPropagation(),e.format)if(i.preventDefault(),void 0===i.clipboardData){n&&console.warn("unable to use e.clipboardData"),n&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var s=r[e.format]||r.default;window.clipboardData.setData(s,t)}else i.clipboardData.clearData(),i.clipboardData.setData(e.format,t);e.onCopy&&(i.preventDefault(),e.onCopy(i.clipboardData))})),document.body.appendChild(u),o.selectNodeContents(u),l.addRange(o),!document.execCommand("copy"))throw new Error("copy command was unsuccessful");h=!0}catch(i){n&&console.error("unable to copy using execCommand: ",i),n&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(e.format||"text",t),e.onCopy&&e.onCopy(window.clipboardData),h=!0}catch(i){n&&console.error("unable to copy using clipboardData: ",i),n&&console.error("falling back to prompt"),s=function(t){var e=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return t.replace(/#{\s*key\s*}/g,e)}("message"in e?e.message:"Copy to clipboard: #{key}, Enter"),window.prompt(s,t)}}finally{l&&("function"==typeof l.removeRange?l.removeRange(o):l.removeAllRanges()),u&&document.body.removeChild(u),a()}return h}},53184:function(t,e,n){"use strict";var i,r;i=[n(58553),n(87804),n(40998)],void 0===(r=function(t,e,n){return function(t,e,n){var i=function(e,n){return t.js_beautify(e,n)};return i.js=t.js_beautify,i.css=e.css_beautify,i.html=n.html_beautify,i.js_beautify=t.js_beautify,i.css_beautify=e.css_beautify,i.html_beautify=n.html_beautify,i}(t,e,n)}.apply(e,i))||(t.exports=r)},87804:function(t,e){var n;!function(){var i;!function(){"use strict";var t=[,,function(t){function e(t){this.__parent=t,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}function n(t,e){this.__cache=[""],this.__indent_size=t.indent_size,this.__indent_string=t.indent_char,t.indent_with_tabs||(this.__indent_string=new Array(t.indent_size+1).join(t.indent_char)),e=e||"",t.indent_level>0&&(e=new Array(t.indent_level+1).join(this.__indent_string)),this.__base_string=e,this.__base_string_length=e.length}function i(t,i){this.__indent_cache=new n(t,i),this.raw=!1,this._end_with_newline=t.end_with_newline,this.indent_size=t.indent_size,this.wrap_line_length=t.wrap_line_length,this.indent_empty_lines=t.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new e(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}e.prototype.clone_empty=function(){var t=new e(this.__parent);return t.set_indent(this.__indent_count,this.__alignment_count),t},e.prototype.item=function(t){return t<0?this.__items[this.__items.length+t]:this.__items[t]},e.prototype.has_match=function(t){for(var e=this.__items.length-1;e>=0;e--)if(this.__items[e].match(t))return!0;return!1},e.prototype.set_indent=function(t,e){this.is_empty()&&(this.__indent_count=t||0,this.__alignment_count=e||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},e.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)},e.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},e.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var t=this.__parent.current_line;return t.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),t.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),t.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count," "===t.__items[0]&&(t.__items.splice(0,1),t.__character_count-=1),!0}return!1},e.prototype.is_empty=function(){return 0===this.__items.length},e.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},e.prototype.push=function(t){this.__items.push(t);var e=t.lastIndexOf("\n");-1!==e?this.__character_count=t.length-e:this.__character_count+=t.length},e.prototype.pop=function(){var t=null;return this.is_empty()||(t=this.__items.pop(),this.__character_count-=t.length),t},e.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},e.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},e.prototype.trim=function(){for(;" "===this.last();)this.__items.pop(),this.__character_count-=1},e.prototype.toString=function(){var t="";return this.is_empty()?this.__parent.indent_empty_lines&&(t=this.__parent.get_indent_string(this.__indent_count)):(t=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),t+=this.__items.join("")),t},n.prototype.get_indent_size=function(t,e){var n=this.__base_string_length;return e=e||0,t<0&&(n=0),n+=t*this.__indent_size,n+=e},n.prototype.get_indent_string=function(t,e){var n=this.__base_string;return e=e||0,t<0&&(t=0,n=""),e+=t*this.__indent_size,this.__ensure_cache(e),n+=this.__cache[e]},n.prototype.__ensure_cache=function(t){for(;t>=this.__cache.length;)this.__add_column()},n.prototype.__add_column=function(){var t=this.__cache.length,e=0,n="";this.__indent_size&&t>=this.__indent_size&&(t-=(e=Math.floor(t/this.__indent_size))*this.__indent_size,n=new Array(e+1).join(this.__indent_string)),t&&(n+=new Array(t+1).join(" ")),this.__cache.push(n)},i.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},i.prototype.get_line_number=function(){return this.__lines.length},i.prototype.get_indent_string=function(t,e){return this.__indent_cache.get_indent_string(t,e)},i.prototype.get_indent_size=function(t,e){return this.__indent_cache.get_indent_size(t,e)},i.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},i.prototype.add_new_line=function(t){return!(this.is_empty()||!t&&this.just_added_newline())&&(this.raw||this.__add_outputline(),!0)},i.prototype.get_code=function(t){this.trim(!0);var e=this.current_line.pop();e&&("\n"===e[e.length-1]&&(e=e.replace(/\n+$/g,"")),this.current_line.push(e)),this._end_with_newline&&this.__add_outputline();var n=this.__lines.join("\n");return"\n"!==t&&(n=n.replace(/[\n]/g,t)),n},i.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},i.prototype.set_indent=function(t,e){return t=t||0,e=e||0,this.next_line.set_indent(t,e),this.__lines.length>1?(this.current_line.set_indent(t,e),!0):(this.current_line.set_indent(),!1)},i.prototype.add_raw_token=function(t){for(var e=0;e<t.newlines;e++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(t.whitespace_before),this.current_line.push(t.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},i.prototype.add_token=function(t){this.__add_space_before_token(),this.current_line.push(t),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},i.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(" "))},i.prototype.remove_indent=function(t){for(var e=this.__lines.length;t<e;)this.__lines[t]._remove_indent(),t++;this.current_line._remove_wrap_indent()},i.prototype.trim=function(t){for(t=void 0!==t&&t,this.current_line.trim();t&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},i.prototype.just_added_newline=function(){return this.current_line.is_empty()},i.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},i.prototype.ensure_empty_line_above=function(t,n){for(var i=this.__lines.length-2;i>=0;){var r=this.__lines[i];if(r.is_empty())break;if(0!==r.item(0).indexOf(t)&&r.item(-1)!==n){this.__lines.splice(i+1,0,new e(this)),this.previous_line=this.__lines[this.__lines.length-2];break}i--}},t.exports.Output=i},,,,function(t){function e(t,e){this.raw_options=n(t,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","\t"===this.indent_char),this.indent_with_tabs&&(this.indent_char="\t",1===this.indent_size&&(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"])}function n(t,e){var n,r={};for(n in t=i(t))n!==e&&(r[n]=t[n]);if(e&&t[e])for(n in t[e])r[n]=t[e][n];return r}function i(t){var e,n={};for(e in t){n[e.replace(/-/g,"_")]=t[e]}return n}e.prototype._get_array=function(t,e){var n=this.raw_options[t],i=e||[];return"object"==typeof n?null!==n&&"function"==typeof n.concat&&(i=n.concat()):"string"==typeof n&&(i=n.split(/[^a-zA-Z0-9_\/\-]+/)),i},e.prototype._get_boolean=function(t,e){var n=this.raw_options[t];return void 0===n?!!e:!!n},e.prototype._get_characters=function(t,e){var n=this.raw_options[t],i=e||"";return"string"==typeof n&&(i=n.replace(/\\r/,"\r").replace(/\\n/,"\n").replace(/\\t/,"\t")),i},e.prototype._get_number=function(t,e){var n=this.raw_options[t];e=parseInt(e,10),isNaN(e)&&(e=0);var i=parseInt(n,10);return isNaN(i)&&(i=e),i},e.prototype._get_selection=function(t,e,n){var i=this._get_selection_list(t,e,n);if(1!==i.length)throw new Error("Invalid Option Value: The option '"+t+"' can only be one of the following values:\n"+e+"\nYou passed in: '"+this.raw_options[t]+"'");return i[0]},e.prototype._get_selection_list=function(t,e,n){if(!e||0===e.length)throw new Error("Selection list cannot be empty.");if(n=n||[e[0]],!this._is_valid_selection(n,e))throw new Error("Invalid Default Value!");var i=this._get_array(t,n);if(!this._is_valid_selection(i,e))throw new Error("Invalid Option Value: The option '"+t+"' can contain only the following values:\n"+e+"\nYou passed in: '"+this.raw_options[t]+"'");return i},e.prototype._is_valid_selection=function(t,e){return t.length&&e.length&&!t.some((function(t){return-1===e.indexOf(t)}))},t.exports.Options=e,t.exports.normalizeOpts=i,t.exports.mergeOpts=n},,function(t){var e=RegExp.prototype.hasOwnProperty("sticky");function n(t){this.__input=t||"",this.__input_length=this.__input.length,this.__position=0}n.prototype.restart=function(){this.__position=0},n.prototype.back=function(){this.__position>0&&(this.__position-=1)},n.prototype.hasNext=function(){return this.__position<this.__input_length},n.prototype.next=function(){var t=null;return this.hasNext()&&(t=this.__input.charAt(this.__position),this.__position+=1),t},n.prototype.peek=function(t){var e=null;return t=t||0,(t+=this.__position)>=0&&t<this.__input_length&&(e=this.__input.charAt(t)),e},n.prototype.__match=function(t,n){t.lastIndex=n;var i=t.exec(this.__input);return!i||e&&t.sticky||i.index!==n&&(i=null),i},n.prototype.test=function(t,e){return e=e||0,(e+=this.__position)>=0&&e<this.__input_length&&!!this.__match(t,e)},n.prototype.testChar=function(t,e){var n=this.peek(e);return t.lastIndex=0,null!==n&&t.test(n)},n.prototype.match=function(t){var e=this.__match(t,this.__position);return e?this.__position+=e[0].length:e=null,e},n.prototype.read=function(t,e,n){var i,r="";return t&&(i=this.match(t))&&(r+=i[0]),!e||!i&&t||(r+=this.readUntil(e,n)),r},n.prototype.readUntil=function(t,e){var n,i=this.__position;t.lastIndex=this.__position;var r=t.exec(this.__input);return r?(i=r.index,e&&(i+=r[0].length)):i=this.__input_length,n=this.__input.substring(this.__position,i),this.__position=i,n},n.prototype.readUntilAfter=function(t){return this.readUntil(t,!0)},n.prototype.get_regexp=function(t,n){var i=null,r="g";return n&&e&&(r="y"),"string"==typeof t&&""!==t?i=new RegExp(t,r):t&&(i=new RegExp(t.source,r)),i},n.prototype.get_literal_regexp=function(t){return RegExp(t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},n.prototype.peekUntilAfter=function(t){var e=this.__position,n=this.readUntilAfter(t);return this.__position=e,n},n.prototype.lookBack=function(t){var e=this.__position-1;return e>=t.length&&this.__input.substring(e-t.length,e).toLowerCase()===t},t.exports.InputScanner=n},,,,,function(t){function e(t,e){t="string"==typeof t?t:t.source,e="string"==typeof e?e:e.source,this.__directives_block_pattern=new RegExp(t+/ beautify( \w+[:]\w+)+ /.source+e,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(t+/\sbeautify\signore:end\s/.source+e,"g")}e.prototype.get_directives=function(t){if(!t.match(this.__directives_block_pattern))return null;var e={};this.__directive_pattern.lastIndex=0;for(var n=this.__directive_pattern.exec(t);n;)e[n[1]]=n[2],n=this.__directive_pattern.exec(t);return e},e.prototype.readIgnored=function(t){return t.readUntilAfter(this.__directives_end_ignore_pattern)},t.exports.Directives=e},,function(t,e,n){var i=n(16).Beautifier,r=n(17).Options;t.exports=function(t,e){return new i(t,e).beautify()},t.exports.defaultOptions=function(){return new r}},function(t,e,n){var i=n(17).Options,r=n(2).Output,s=n(8).InputScanner,a=new(0,n(13).Directives)(/\/\*/,/\*\//),o=/\r\n|[\r\n]/,l=/\r\n|[\r\n]/g,u=/\s/,h=/(?:\s|\n)+/g,c=/\/\*(?:[\s\S]*?)((?:\*\/)|$)/g,d=/\/\/(?:[^\n\r\u2028\u2029]*)/g;function f(t,e){this._source_text=t||"",this._options=new i(e),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"]}f.prototype.eatString=function(t){var e="";for(this._ch=this._input.next();this._ch;){if(e+=this._ch,"\\"===this._ch)e+=this._input.next();else if(-1!==t.indexOf(this._ch)||"\n"===this._ch)break;this._ch=this._input.next()}return e},f.prototype.eatWhitespace=function(t){for(var e=u.test(this._input.peek()),n=0;u.test(this._input.peek());)this._ch=this._input.next(),t&&"\n"===this._ch&&(0===n||n<this._options.max_preserve_newlines)&&(n++,this._output.add_new_line(!0));return e},f.prototype.foundNestedPseudoClass=function(){for(var t=0,e=1,n=this._input.peek(e);n;){if("{"===n)return!0;if("("===n)t+=1;else if(")"===n){if(0===t)return!1;t-=1}else if(";"===n||"}"===n)return!1;e++,n=this._input.peek(e)}return!1},f.prototype.print_string=function(t){this._output.set_indent(this._indentLevel),this._output.non_breaking_space=!0,this._output.add_token(t)},f.prototype.preserveSingleSpace=function(t){t&&(this._output.space_before_token=!0)},f.prototype.indent=function(){this._indentLevel++},f.prototype.outdent=function(){this._indentLevel>0&&this._indentLevel--},f.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var t=this._source_text,e=this._options.eol;"auto"===e&&(e="\n",t&&o.test(t||"")&&(e=t.match(o)[0]));var n=(t=t.replace(l,"\n")).match(/^[\t ]*/)[0];this._output=new r(this._options,n),this._input=new s(t),this._indentLevel=0,this._nestedLevel=0,this._ch=null;for(var i,f,p=0,g=!1,_=!1,m=!1,v=!1,y=!1,b=this._ch,E=!1;i=""!==this._input.read(h),f=b,this._ch=this._input.next(),"\\"===this._ch&&this._input.hasNext()&&(this._ch+=this._input.next()),b=this._ch,this._ch;)if("/"===this._ch&&"*"===this._input.peek()){this._output.add_new_line(),this._input.back();var w=this._input.read(c),T=a.get_directives(w);T&&"start"===T.ignore&&(w+=a.readIgnored(this._input)),this.print_string(w),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(d)),this.eatWhitespace(!0);else if("$"===this._ch){this.preserveSingleSpace(i),this.print_string(this._ch);var k=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);k.match(/[ :]$/)&&(k=this.eatString(": ").replace(/\s+$/,""),this.print_string(k),this._output.space_before_token=!0),0===p&&-1!==k.indexOf(":")&&(_=!0,this.indent())}else if("@"===this._ch)if(this.preserveSingleSpace(i),"{"===this._input.peek())this.print_string(this._ch+this.eatString("}"));else{this.print_string(this._ch);var S=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);S.match(/[ :]$/)&&(S=this.eatString(": ").replace(/\s+$/,""),this.print_string(S),this._output.space_before_token=!0),0===p&&-1!==S.indexOf(":")?(_=!0,this.indent()):S in this.NESTED_AT_RULE?(this._nestedLevel+=1,S in this.CONDITIONAL_GROUP_RULE&&(m=!0)):0!==p||_||(v=!0)}else if("#"===this._ch&&"{"===this._input.peek())this.preserveSingleSpace(i),this.print_string(this._ch+this.eatString("}"));else if("{"===this._ch)_&&(_=!1,this.outdent()),v=!1,m?(m=!1,g=this._indentLevel>=this._nestedLevel):g=this._indentLevel>=this._nestedLevel-1,this._options.newline_between_rules&&g&&this._output.previous_line&&"{"!==this._output.previous_line.item(-1)&&this._output.ensure_empty_line_above("/",","),this._output.space_before_token=!0,"expand"===this._options.brace_style?(this._output.add_new_line(),this.print_string(this._ch),this.indent(),this._output.set_indent(this._indentLevel)):("("===f?this._output.space_before_token=!1:","!==f&&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(),"{"===f&&this._output.trim(!0),_&&(this.outdent(),_=!1),this.print_string(this._ch),g=!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),"expand"===this._options.brace_style&&this._output.add_new_line(!0));else if(":"===this._ch){for(var A=0;A<this.NON_SEMICOLON_NEWLINE_PROPERTY.length;A++)if(this._input.lookBack(this.NON_SEMICOLON_NEWLINE_PROPERTY[A])){E=!0;break}!g&&!m||this._input.lookBack("&")||this.foundNestedPseudoClass()||this._input.lookBack("(")||v||0!==p?(this._input.lookBack(" ")&&(this._output.space_before_token=!0),":"===this._input.peek()?(this._ch=this._input.next(),this.print_string("::")):this.print_string(":")):(this.print_string(":"),_||(_=!0,this._output.space_before_token=!0,this.eatWhitespace(!0),this.indent()))}else if('"'===this._ch||"'"===this._ch){var D='"'===f||"'"===f;this.preserveSingleSpace(D||i),this.print_string(this._ch+this.eatString(this._ch)),this.eatWhitespace(!0)}else if(";"===this._ch)E=!1,0===p?(_&&(this.outdent(),_=!1),v=!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(),p++,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(")")),p&&(p--,this.outdent()));else{var C=!1;this._input.lookBack("with")&&(C=!0),this.preserveSingleSpace(i||C),this.print_string(this._ch),_&&"$"===f&&this._options.selector_separator_newline?(this._output.add_new_line(),y=!0):(this.eatWhitespace(),p++,this.indent())}else if(")"===this._ch)p&&(p--,this.outdent()),y&&";"===this._input.peek()&&this._options.selector_separator_newline&&(y=!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||_&&!y||0!==p||v?this._output.space_before_token=!0:this._output.add_new_line();else if(">"!==this._ch&&"+"!==this._ch&&"~"!==this._ch||_||0!==p)if("]"===this._ch)this.print_string(this._ch);else if("["===this._ch)this.preserveSingleSpace(i),this.print_string(this._ch);else if("="===this._ch)this.eatWhitespace(),this.print_string("="),u.test(this._ch)&&(this._ch="");else if("!"!==this._ch||this._input.lookBack("\\")){var x='"'===f||"'"===f;this.preserveSingleSpace(x||i),this.print_string(this._ch),!this._output.just_added_newline()&&"\n"===this._input.peek()&&E&&this._output.add_new_line()}else this._output.space_before_token=!0,this.print_string(this._ch);else 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&&u.test(this._ch)&&(this._ch=""));return this._output.get_code(e)},t.exports.Beautifier=f},function(t,e,n){var i=n(6).Options;function r(t){i.call(this,t,"css"),this.selector_separator_newline=this._get_boolean("selector_separator_newline",!0),this.newline_between_rules=this._get_boolean("newline_between_rules",!0);var e=this._get_boolean("space_around_selector_separator");this.space_around_combinator=this._get_boolean("space_around_combinator")||e;var n=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_style="collapse";for(var r=0;r<n.length;r++)"expand"!==n[r]?this.brace_style="collapse":this.brace_style=n[r]}r.prototype=new i,t.exports.Options=r}],e={};var n=function n(i){var r=e[i];if(void 0!==r)return r.exports;var s=e[i]={exports:{}};return t[i](s,s.exports,n),s.exports}(15);i=n}();var r=i;void 0===(n=function(){return{css_beautify:r}}.apply(e,[]))||(t.exports=n)}()},40998:function(t,e,n){var i,r;!function(){var s;!function(){"use strict";var t=[,,function(t){function e(t){this.__parent=t,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}function n(t,e){this.__cache=[""],this.__indent_size=t.indent_size,this.__indent_string=t.indent_char,t.indent_with_tabs||(this.__indent_string=new Array(t.indent_size+1).join(t.indent_char)),e=e||"",t.indent_level>0&&(e=new Array(t.indent_level+1).join(this.__indent_string)),this.__base_string=e,this.__base_string_length=e.length}function i(t,i){this.__indent_cache=new n(t,i),this.raw=!1,this._end_with_newline=t.end_with_newline,this.indent_size=t.indent_size,this.wrap_line_length=t.wrap_line_length,this.indent_empty_lines=t.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new e(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}e.prototype.clone_empty=function(){var t=new e(this.__parent);return t.set_indent(this.__indent_count,this.__alignment_count),t},e.prototype.item=function(t){return t<0?this.__items[this.__items.length+t]:this.__items[t]},e.prototype.has_match=function(t){for(var e=this.__items.length-1;e>=0;e--)if(this.__items[e].match(t))return!0;return!1},e.prototype.set_indent=function(t,e){this.is_empty()&&(this.__indent_count=t||0,this.__alignment_count=e||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},e.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)},e.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},e.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var t=this.__parent.current_line;return t.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),t.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),t.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count," "===t.__items[0]&&(t.__items.splice(0,1),t.__character_count-=1),!0}return!1},e.prototype.is_empty=function(){return 0===this.__items.length},e.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},e.prototype.push=function(t){this.__items.push(t);var e=t.lastIndexOf("\n");-1!==e?this.__character_count=t.length-e:this.__character_count+=t.length},e.prototype.pop=function(){var t=null;return this.is_empty()||(t=this.__items.pop(),this.__character_count-=t.length),t},e.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},e.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},e.prototype.trim=function(){for(;" "===this.last();)this.__items.pop(),this.__character_count-=1},e.prototype.toString=function(){var t="";return this.is_empty()?this.__parent.indent_empty_lines&&(t=this.__parent.get_indent_string(this.__indent_count)):(t=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),t+=this.__items.join("")),t},n.prototype.get_indent_size=function(t,e){var n=this.__base_string_length;return e=e||0,t<0&&(n=0),n+=t*this.__indent_size,n+=e},n.prototype.get_indent_string=function(t,e){var n=this.__base_string;return e=e||0,t<0&&(t=0,n=""),e+=t*this.__indent_size,this.__ensure_cache(e),n+=this.__cache[e]},n.prototype.__ensure_cache=function(t){for(;t>=this.__cache.length;)this.__add_column()},n.prototype.__add_column=function(){var t=this.__cache.length,e=0,n="";this.__indent_size&&t>=this.__indent_size&&(t-=(e=Math.floor(t/this.__indent_size))*this.__indent_size,n=new Array(e+1).join(this.__indent_string)),t&&(n+=new Array(t+1).join(" ")),this.__cache.push(n)},i.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},i.prototype.get_line_number=function(){return this.__lines.length},i.prototype.get_indent_string=function(t,e){return this.__indent_cache.get_indent_string(t,e)},i.prototype.get_indent_size=function(t,e){return this.__indent_cache.get_indent_size(t,e)},i.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},i.prototype.add_new_line=function(t){return!(this.is_empty()||!t&&this.just_added_newline())&&(this.raw||this.__add_outputline(),!0)},i.prototype.get_code=function(t){this.trim(!0);var e=this.current_line.pop();e&&("\n"===e[e.length-1]&&(e=e.replace(/\n+$/g,"")),this.current_line.push(e)),this._end_with_newline&&this.__add_outputline();var n=this.__lines.join("\n");return"\n"!==t&&(n=n.replace(/[\n]/g,t)),n},i.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},i.prototype.set_indent=function(t,e){return t=t||0,e=e||0,this.next_line.set_indent(t,e),this.__lines.length>1?(this.current_line.set_indent(t,e),!0):(this.current_line.set_indent(),!1)},i.prototype.add_raw_token=function(t){for(var e=0;e<t.newlines;e++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(t.whitespace_before),this.current_line.push(t.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},i.prototype.add_token=function(t){this.__add_space_before_token(),this.current_line.push(t),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},i.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(" "))},i.prototype.remove_indent=function(t){for(var e=this.__lines.length;t<e;)this.__lines[t]._remove_indent(),t++;this.current_line._remove_wrap_indent()},i.prototype.trim=function(t){for(t=void 0!==t&&t,this.current_line.trim();t&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},i.prototype.just_added_newline=function(){return this.current_line.is_empty()},i.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},i.prototype.ensure_empty_line_above=function(t,n){for(var i=this.__lines.length-2;i>=0;){var r=this.__lines[i];if(r.is_empty())break;if(0!==r.item(0).indexOf(t)&&r.item(-1)!==n){this.__lines.splice(i+1,0,new e(this)),this.previous_line=this.__lines[this.__lines.length-2];break}i--}},t.exports.Output=i},function(t){t.exports.Token=function(t,e,n,i){this.type=t,this.text=e,this.comments_before=null,this.newlines=n||0,this.whitespace_before=i||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}},,,function(t){function e(t,e){this.raw_options=n(t,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","\t"===this.indent_char),this.indent_with_tabs&&(this.indent_char="\t",1===this.indent_size&&(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"])}function n(t,e){var n,r={};for(n in t=i(t))n!==e&&(r[n]=t[n]);if(e&&t[e])for(n in t[e])r[n]=t[e][n];return r}function i(t){var e,n={};for(e in t){n[e.replace(/-/g,"_")]=t[e]}return n}e.prototype._get_array=function(t,e){var n=this.raw_options[t],i=e||[];return"object"==typeof n?null!==n&&"function"==typeof n.concat&&(i=n.concat()):"string"==typeof n&&(i=n.split(/[^a-zA-Z0-9_\/\-]+/)),i},e.prototype._get_boolean=function(t,e){var n=this.raw_options[t];return void 0===n?!!e:!!n},e.prototype._get_characters=function(t,e){var n=this.raw_options[t],i=e||"";return"string"==typeof n&&(i=n.replace(/\\r/,"\r").replace(/\\n/,"\n").replace(/\\t/,"\t")),i},e.prototype._get_number=function(t,e){var n=this.raw_options[t];e=parseInt(e,10),isNaN(e)&&(e=0);var i=parseInt(n,10);return isNaN(i)&&(i=e),i},e.prototype._get_selection=function(t,e,n){var i=this._get_selection_list(t,e,n);if(1!==i.length)throw new Error("Invalid Option Value: The option '"+t+"' can only be one of the following values:\n"+e+"\nYou passed in: '"+this.raw_options[t]+"'");return i[0]},e.prototype._get_selection_list=function(t,e,n){if(!e||0===e.length)throw new Error("Selection list cannot be empty.");if(n=n||[e[0]],!this._is_valid_selection(n,e))throw new Error("Invalid Default Value!");var i=this._get_array(t,n);if(!this._is_valid_selection(i,e))throw new Error("Invalid Option Value: The option '"+t+"' can contain only the following values:\n"+e+"\nYou passed in: '"+this.raw_options[t]+"'");return i},e.prototype._is_valid_selection=function(t,e){return t.length&&e.length&&!t.some((function(t){return-1===e.indexOf(t)}))},t.exports.Options=e,t.exports.normalizeOpts=i,t.exports.mergeOpts=n},,function(t){var e=RegExp.prototype.hasOwnProperty("sticky");function n(t){this.__input=t||"",this.__input_length=this.__input.length,this.__position=0}n.prototype.restart=function(){this.__position=0},n.prototype.back=function(){this.__position>0&&(this.__position-=1)},n.prototype.hasNext=function(){return this.__position<this.__input_length},n.prototype.next=function(){var t=null;return this.hasNext()&&(t=this.__input.charAt(this.__position),this.__position+=1),t},n.prototype.peek=function(t){var e=null;return t=t||0,(t+=this.__position)>=0&&t<this.__input_length&&(e=this.__input.charAt(t)),e},n.prototype.__match=function(t,n){t.lastIndex=n;var i=t.exec(this.__input);return!i||e&&t.sticky||i.index!==n&&(i=null),i},n.prototype.test=function(t,e){return e=e||0,(e+=this.__position)>=0&&e<this.__input_length&&!!this.__match(t,e)},n.prototype.testChar=function(t,e){var n=this.peek(e);return t.lastIndex=0,null!==n&&t.test(n)},n.prototype.match=function(t){var e=this.__match(t,this.__position);return e?this.__position+=e[0].length:e=null,e},n.prototype.read=function(t,e,n){var i,r="";return t&&(i=this.match(t))&&(r+=i[0]),!e||!i&&t||(r+=this.readUntil(e,n)),r},n.prototype.readUntil=function(t,e){var n,i=this.__position;t.lastIndex=this.__position;var r=t.exec(this.__input);return r?(i=r.index,e&&(i+=r[0].length)):i=this.__input_length,n=this.__input.substring(this.__position,i),this.__position=i,n},n.prototype.readUntilAfter=function(t){return this.readUntil(t,!0)},n.prototype.get_regexp=function(t,n){var i=null,r="g";return n&&e&&(r="y"),"string"==typeof t&&""!==t?i=new RegExp(t,r):t&&(i=new RegExp(t.source,r)),i},n.prototype.get_literal_regexp=function(t){return RegExp(t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},n.prototype.peekUntilAfter=function(t){var e=this.__position,n=this.readUntilAfter(t);return this.__position=e,n},n.prototype.lookBack=function(t){var e=this.__position-1;return e>=t.length&&this.__input.substring(e-t.length,e).toLowerCase()===t},t.exports.InputScanner=n},function(t,e,n){var i=n(8).InputScanner,r=n(3).Token,s=n(10).TokenStream,a=n(11).WhitespacePattern,o={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},l=function(t,e){this._input=new i(t),this._options=e||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new a(this._input)};l.prototype.tokenize=function(){var t;this._input.restart(),this.__tokens=new s,this._reset();for(var e=new r(o.START,""),n=null,i=[],a=new s;e.type!==o.EOF;){for(t=this._get_next_token(e,n);this._is_comment(t);)a.add(t),t=this._get_next_token(e,n);a.isEmpty()||(t.comments_before=a,a=new s),t.parent=n,this._is_opening(t)?(i.push(n),n=t):n&&this._is_closing(t,n)&&(t.opened=n,n.closed=t,n=i.pop(),t.parent=n),t.previous=e,e.next=t,this.__tokens.add(t),e=t}return this.__tokens},l.prototype._is_first_token=function(){return this.__tokens.isEmpty()},l.prototype._reset=function(){},l.prototype._get_next_token=function(t,e){this._readWhitespace();var n=this._input.read(/.+/g);return n?this._create_token(o.RAW,n):this._create_token(o.EOF,"")},l.prototype._is_comment=function(t){return!1},l.prototype._is_opening=function(t){return!1},l.prototype._is_closing=function(t,e){return!1},l.prototype._create_token=function(t,e){return new r(t,e,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token)},l.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},t.exports.Tokenizer=l,t.exports.TOKEN=o},function(t){function e(t){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=t}e.prototype.restart=function(){this.__position=0},e.prototype.isEmpty=function(){return 0===this.__tokens_length},e.prototype.hasNext=function(){return this.__position<this.__tokens_length},e.prototype.next=function(){var t=null;return this.hasNext()&&(t=this.__tokens[this.__position],this.__position+=1),t},e.prototype.peek=function(t){var e=null;return t=t||0,(t+=this.__position)>=0&&t<this.__tokens_length&&(e=this.__tokens[t]),e},e.prototype.add=function(t){this.__parent_token&&(t.parent=this.__parent_token),this.__tokens.push(t),this.__tokens_length+=1},t.exports.TokenStream=e},function(t,e,n){var i=n(12).Pattern;function r(t,e){i.call(this,t,e),e?this._line_regexp=this._input.get_regexp(e._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}r.prototype=new i,r.prototype.__set_whitespace_patterns=function(t,e){t+="\\t ",e+="\\n\\r",this._match_pattern=this._input.get_regexp("["+t+e+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+e+"]")},r.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var t=this._input.read(this._match_pattern);if(" "===t)this.whitespace_before_token=" ";else if(t){var e=this.__split(this._newline_regexp,t);this.newline_count=e.length-1,this.whitespace_before_token=e[this.newline_count]}return t},r.prototype.matching=function(t,e){var n=this._create();return n.__set_whitespace_patterns(t,e),n._update(),n},r.prototype._create=function(){return new r(this._input,this)},r.prototype.__split=function(t,e){t.lastIndex=0;for(var n=0,i=[],r=t.exec(e);r;)i.push(e.substring(n,r.index)),n=r.index+r[0].length,r=t.exec(e);return n<e.length?i.push(e.substring(n,e.length)):i.push(""),i},t.exports.WhitespacePattern=r},function(t){function e(t,e){this._input=t,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,e&&(this._starting_pattern=this._input.get_regexp(e._starting_pattern,!0),this._match_pattern=this._input.get_regexp(e._match_pattern,!0),this._until_pattern=this._input.get_regexp(e._until_pattern),this._until_after=e._until_after)}e.prototype.read=function(){var t=this._input.read(this._starting_pattern);return this._starting_pattern&&!t||(t+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),t},e.prototype.read_match=function(){return this._input.match(this._match_pattern)},e.prototype.until_after=function(t){var e=this._create();return e._until_after=!0,e._until_pattern=this._input.get_regexp(t),e._update(),e},e.prototype.until=function(t){var e=this._create();return e._until_after=!1,e._until_pattern=this._input.get_regexp(t),e._update(),e},e.prototype.starting_with=function(t){var e=this._create();return e._starting_pattern=this._input.get_regexp(t,!0),e._update(),e},e.prototype.matching=function(t){var e=this._create();return e._match_pattern=this._input.get_regexp(t,!0),e._update(),e},e.prototype._create=function(){return new e(this._input,this)},e.prototype._update=function(){},t.exports.Pattern=e},function(t){function e(t,e){t="string"==typeof t?t:t.source,e="string"==typeof e?e:e.source,this.__directives_block_pattern=new RegExp(t+/ beautify( \w+[:]\w+)+ /.source+e,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(t+/\sbeautify\signore:end\s/.source+e,"g")}e.prototype.get_directives=function(t){if(!t.match(this.__directives_block_pattern))return null;var e={};this.__directive_pattern.lastIndex=0;for(var n=this.__directive_pattern.exec(t);n;)e[n[1]]=n[2],n=this.__directive_pattern.exec(t);return e},e.prototype.readIgnored=function(t){return t.readUntilAfter(this.__directives_end_ignore_pattern)},t.exports.Directives=e},function(t,e,n){var i=n(12).Pattern,r={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1,angular:!1};function s(t,e){i.call(this,t,e),this.__template_pattern=null,this._disabled=Object.assign({},r),this._excluded=Object.assign({},r),e&&(this.__template_pattern=this._input.get_regexp(e.__template_pattern),this._excluded=Object.assign(this._excluded,e._excluded),this._disabled=Object.assign(this._disabled,e._disabled));var n=new i(t);this.__patterns={handlebars_comment:n.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:n.starting_with(/{{{/).until_after(/}}}/),handlebars:n.starting_with(/{{/).until_after(/}}/),php:n.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:n.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:n.starting_with(/{%/).until_after(/%}/),django_value:n.starting_with(/{{/).until_after(/}}/),django_comment:n.starting_with(/{#/).until_after(/#}/),smarty:n.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:n.starting_with(/{\*/).until_after(/\*}/),smarty_literal:n.starting_with(/{literal}/).until_after(/{\/literal}/)}}s.prototype=new i,s.prototype._create=function(){return new s(this._input,this)},s.prototype._update=function(){this.__set_templated_pattern()},s.prototype.disable=function(t){var e=this._create();return e._disabled[t]=!0,e._update(),e},s.prototype.read_options=function(t){var e=this._create();for(var n in r)e._disabled[n]=-1===t.templating.indexOf(n);return e._update(),e},s.prototype.exclude=function(t){var e=this._create();return e._excluded[t]=!0,e._update(),e},s.prototype.read=function(){var t="";t=this._match_pattern?this._input.read(this._starting_pattern):this._input.read(this._starting_pattern,this.__template_pattern);for(var e=this._read_template();e;)this._match_pattern?e+=this._input.read(this._match_pattern):e+=this._input.readUntil(this.__template_pattern),t+=e,e=this._read_template();return this._until_after&&(t+=this._input.readUntilAfter(this._until_pattern)),t},s.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("|")+")")},s.prototype._read_template=function(){var t="",e=this._input.peek();if("<"===e){var n=this._input.peek(1);this._disabled.php||this._excluded.php||"?"!==n||(t=t||this.__patterns.php.read()),this._disabled.erb||this._excluded.erb||"%"!==n||(t=t||this.__patterns.erb.read())}else"{"===e&&(this._disabled.handlebars||this._excluded.handlebars||(t=(t=(t=t||this.__patterns.handlebars_comment.read())||this.__patterns.handlebars_unescaped.read())||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=t||this.__patterns.django_comment.read())||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(t=(t=(t=t||this.__patterns.smarty_comment.read())||this.__patterns.smarty_literal.read())||this.__patterns.smarty.read()));return t},t.exports.TemplatablePattern=s},,,,function(t,e,n){var i=n(19).Beautifier,r=n(20).Options;t.exports=function(t,e,n,r){return new i(t,e,n,r).beautify()},t.exports.defaultOptions=function(){return new r}},function(t,e,n){var i=n(20).Options,r=n(2).Output,s=n(21).Tokenizer,a=n(21).TOKEN,o=/\r\n|[\r\n]/,l=/\r\n|[\r\n]/g,u=function(t,e){this.indent_level=0,this.alignment_size=0,this.max_preserve_newlines=t.max_preserve_newlines,this.preserve_newlines=t.preserve_newlines,this._output=new r(t,e)};u.prototype.current_line_has_match=function(t){return this._output.current_line.has_match(t)},u.prototype.set_space_before_token=function(t,e){this._output.space_before_token=t,this._output.non_breaking_space=e},u.prototype.set_wrap_point=function(){this._output.set_indent(this.indent_level,this.alignment_size),this._output.set_wrap_point()},u.prototype.add_raw_token=function(t){this._output.add_raw_token(t)},u.prototype.print_preserved_newlines=function(t){var e=0;t.type!==a.TEXT&&t.previous.type!==a.TEXT&&(e=t.newlines?1:0),this.preserve_newlines&&(e=t.newlines<this.max_preserve_newlines+1?t.newlines:this.max_preserve_newlines+1);for(var n=0;n<e;n++)this.print_newline(n>0);return 0!==e},u.prototype.traverse_whitespace=function(t){return!(!t.whitespace_before&&!t.newlines)&&(this.print_preserved_newlines(t)||(this._output.space_before_token=!0),!0)},u.prototype.previous_token_wrapped=function(){return this._output.previous_token_wrapped},u.prototype.print_newline=function(t){this._output.add_new_line(t)},u.prototype.print_token=function(t){t.text&&(this._output.set_indent(this.indent_level,this.alignment_size),this._output.add_token(t.text))},u.prototype.indent=function(){this.indent_level++},u.prototype.deindent=function(){this.indent_level>0&&(this.indent_level--,this._output.set_indent(this.indent_level,this.alignment_size))},u.prototype.get_full_indent=function(t){return(t=this.indent_level+(t||0))<1?"":this._output.get_indent_string(t)};var h=function(t,e){var n=null,i=null;return e.closed?("script"===t?n="text/javascript":"style"===t&&(n="text/css"),n=function(t){for(var e=null,n=t.next;n.type!==a.EOF&&t.closed!==n;){if(n.type===a.ATTRIBUTE&&"type"===n.text){n.next&&n.next.type===a.EQUALS&&n.next.next&&n.next.next.type===a.VALUE&&(e=n.next.next.text);break}n=n.next}return e}(e)||n,n.search("text/css")>-1?i="css":n.search(/module|((text|application|dojo)\/(x-)?(javascript|ecmascript|jscript|livescript|(ld\+)?json|method|aspect))/)>-1?i="javascript":n.search(/(text|application|dojo)\/(x-)?(html)/)>-1?i="html":n.search(/test\/null/)>-1&&(i="null"),i):null};function c(t,e){return-1!==e.indexOf(t)}function d(t,e,n){this.parent=t||null,this.tag=e?e.tag_name:"",this.indent_level=n||0,this.parser_token=e||null}function f(t){this._printer=t,this._current_frame=null}function p(t,e,n,r){this._source_text=t||"",e=e||{},this._js_beautify=n,this._css_beautify=r,this._tag_stack=null;var s=new i(e,"html");this._options=s,this._is_wrap_attributes_force="force"===this._options.wrap_attributes.substr(0,"force".length),this._is_wrap_attributes_force_expand_multiline="force-expand-multiline"===this._options.wrap_attributes,this._is_wrap_attributes_force_aligned="force-aligned"===this._options.wrap_attributes,this._is_wrap_attributes_aligned_multiple="aligned-multiple"===this._options.wrap_attributes,this._is_wrap_attributes_preserve="preserve"===this._options.wrap_attributes.substr(0,"preserve".length),this._is_wrap_attributes_preserve_aligned="preserve-aligned"===this._options.wrap_attributes}f.prototype.get_parser_token=function(){return this._current_frame?this._current_frame.parser_token:null},f.prototype.record_tag=function(t){var e=new d(this._current_frame,t,this._printer.indent_level);this._current_frame=e},f.prototype._try_pop_frame=function(t){var e=null;return t&&(e=t.parser_token,this._printer.indent_level=t.indent_level,this._current_frame=t.parent),e},f.prototype._get_frame=function(t,e){for(var n=this._current_frame;n&&-1===t.indexOf(n.tag);){if(e&&-1!==e.indexOf(n.tag)){n=null;break}n=n.parent}return n},f.prototype.try_pop=function(t,e){var n=this._get_frame([t],e);return this._try_pop_frame(n)},f.prototype.indent_to_tag=function(t){var e=this._get_frame(t);e&&(this._printer.indent_level=e.indent_level)},p.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var t=this._source_text,e=this._options.eol;"auto"===this._options.eol&&(e="\n",t&&o.test(t)&&(e=t.match(o)[0]));var n=(t=t.replace(l,"\n")).match(/^[\t ]*/)[0],i={text:"",type:""},r=new g(this._options),h=new u(this._options,n),c=new s(t,this._options).tokenize();this._tag_stack=new f(h);for(var d=null,p=c.next();p.type!==a.EOF;)p.type===a.TAG_OPEN||p.type===a.COMMENT?r=d=this._handle_tag_open(h,p,r,i,c):p.type===a.ATTRIBUTE||p.type===a.EQUALS||p.type===a.VALUE||p.type===a.TEXT&&!r.tag_complete?d=this._handle_inside_tag(h,p,r,i):p.type===a.TAG_CLOSE?d=this._handle_tag_close(h,p,r):p.type===a.TEXT?d=this._handle_text(h,p,r):p.type===a.CONTROL_FLOW_OPEN?d=this._handle_control_flow_open(h,p):p.type===a.CONTROL_FLOW_CLOSE?d=this._handle_control_flow_close(h,p):h.add_raw_token(p),i=d,p=c.next();return h._output.get_code(e)},p.prototype._handle_control_flow_open=function(t,e){var n={text:e.text,type:e.type};return t.set_space_before_token(e.newlines||""!==e.whitespace_before,!0),e.newlines?t.print_preserved_newlines(e):t.set_space_before_token(e.newlines||""!==e.whitespace_before,!0),t.print_token(e),t.indent(),n},p.prototype._handle_control_flow_close=function(t,e){var n={text:e.text,type:e.type};return t.deindent(),e.newlines?t.print_preserved_newlines(e):t.set_space_before_token(e.newlines||""!==e.whitespace_before,!0),t.print_token(e),n},p.prototype._handle_tag_close=function(t,e,n){var i={text:e.text,type:e.type};return t.alignment_size=0,n.tag_complete=!0,t.set_space_before_token(e.newlines||""!==e.whitespace_before,!0),n.is_unformatted?t.add_raw_token(e):("<"===n.tag_start_char&&(t.set_space_before_token("/"===e.text[0],!0),this._is_wrap_attributes_force_expand_multiline&&n.has_wrapped_attrs&&t.print_newline(!1)),t.print_token(e)),!n.indent_content||n.is_unformatted||n.is_content_unformatted||(t.indent(),n.indent_content=!1),n.is_inline_element||n.is_unformatted||n.is_content_unformatted||t.set_wrap_point(),i},p.prototype._handle_inside_tag=function(t,e,n,i){var r=n.has_wrapped_attrs,s={text:e.text,type:e.type};return t.set_space_before_token(e.newlines||""!==e.whitespace_before,!0),n.is_unformatted?t.add_raw_token(e):"{"===n.tag_start_char&&e.type===a.TEXT?t.print_preserved_newlines(e)?(e.newlines=0,t.add_raw_token(e)):t.print_token(e):(e.type===a.ATTRIBUTE?t.set_space_before_token(!0):(e.type===a.EQUALS||e.type===a.VALUE&&e.previous.type===a.EQUALS)&&t.set_space_before_token(!1),e.type===a.ATTRIBUTE&&"<"===n.tag_start_char&&((this._is_wrap_attributes_preserve||this._is_wrap_attributes_preserve_aligned)&&(t.traverse_whitespace(e),r=r||0!==e.newlines),this._is_wrap_attributes_force&&n.attr_count>=this._options.wrap_attributes_min_attrs&&(i.type!==a.TAG_OPEN||this._is_wrap_attributes_force_expand_multiline)&&(t.print_newline(!1),r=!0)),t.print_token(e),r=r||t.previous_token_wrapped(),n.has_wrapped_attrs=r),s},p.prototype._handle_text=function(t,e,n){var i={text:e.text,type:"TK_CONTENT"};return n.custom_beautifier_name?this._print_custom_beatifier_text(t,e,n):n.is_unformatted||n.is_content_unformatted?t.add_raw_token(e):(t.traverse_whitespace(e),t.print_token(e)),i},p.prototype._print_custom_beatifier_text=function(t,e,n){var i=this;if(""!==e.text){var r,s=e.text,a=1,o="",l="";"javascript"===n.custom_beautifier_name&&"function"==typeof this._js_beautify?r=this._js_beautify:"css"===n.custom_beautifier_name&&"function"==typeof this._css_beautify?r=this._css_beautify:"html"===n.custom_beautifier_name&&(r=function(t,e){return new p(t,e,i._js_beautify,i._css_beautify).beautify()}),"keep"===this._options.indent_scripts?a=0:"separate"===this._options.indent_scripts&&(a=-t.indent_level);var u=t.get_full_indent(a);if(s=s.replace(/\n[ \t]*$/,""),"html"!==n.custom_beautifier_name&&"<"===s[0]&&s.match(/^(<!--|<!\[CDATA\[)/)){var h=/^(<!--[^\n]*|<!\[CDATA\[)(\n?)([ \t\n]*)([\s\S]*)(-->|]]>)$/.exec(s);if(!h)return void t.add_raw_token(e);o=u+h[1]+"\n",s=h[4],h[5]&&(l=u+h[5]),s=s.replace(/\n[ \t]*$/,""),(h[2]||-1!==h[3].indexOf("\n"))&&(h=h[3].match(/[ \t]+$/))&&(e.whitespace_before=h[0])}if(s)if(r){var c=function(){this.eol="\n"};c.prototype=this._options.raw_options,s=r(u+s,new c)}else{var d=e.whitespace_before;d&&(s=s.replace(new RegExp("\n("+d+")?","g"),"\n")),s=u+s.replace(/\n/g,"\n"+u)}o&&(s=s?o+s+"\n"+l:o+l),t.print_newline(!1),s&&(e.text=s,e.whitespace_before="",e.newlines=0,t.add_raw_token(e),t.print_newline(!0))}},p.prototype._handle_tag_open=function(t,e,n,i,r){var s=this._get_tag_open_token(e);if(!n.is_unformatted&&!n.is_content_unformatted||n.is_empty_element||e.type!==a.TAG_OPEN||s.is_start_tag?(t.traverse_whitespace(e),this._set_tag_position(t,e,s,n,i),s.is_inline_element||t.set_wrap_point(),t.print_token(e)):(t.add_raw_token(e),s.start_tag_token=this._tag_stack.try_pop(s.tag_name)),s.is_start_tag&&this._is_wrap_attributes_force){var o,l=0;do{(o=r.peek(l)).type===a.ATTRIBUTE&&(s.attr_count+=1),l+=1}while(o.type!==a.EOF&&o.type!==a.TAG_CLOSE)}return(this._is_wrap_attributes_force_aligned||this._is_wrap_attributes_aligned_multiple||this._is_wrap_attributes_preserve_aligned)&&(s.alignment_size=e.text.length+1),s.tag_complete||s.is_unformatted||(t.alignment_size=s.alignment_size),s};var g=function(t,e,n){if(this.parent=e||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="",n){var i;this.tag_start_char=n.text[0],this.text=n.text,"<"===this.tag_start_char?(i=n.text.match(/^<([^\s>]*)/),this.tag_check=i?i[1]:""):(i=n.text.match(/^{{~?(?:[\^]|#\*?)?([^\s}]+)/),this.tag_check=i?i[1]:"",(n.text.startsWith("{{#>")||n.text.startsWith("{{~#>"))&&">"===this.tag_check[0]&&(">"===this.tag_check&&null!==n.next?this.tag_check=n.next.text.split(" ")[0]:this.tag_check=n.text.split(">")[1])),this.tag_check=this.tag_check.toLowerCase(),n.type===a.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||n.closed&&"/>"===n.closed.text;var r=2;"{"===this.tag_start_char&&this.text.length>=3&&"~"===this.text.charAt(2)&&(r=3),this.is_end_tag=this.is_end_tag||"{"===this.tag_start_char&&(!t.indent_handlebars||this.text.length<3||/[^#\^]/.test(this.text.charAt(r)))}else this.tag_complete=!0};p.prototype._get_tag_open_token=function(t){var e=new g(this._options,this._tag_stack.get_parser_token(),t);return e.alignment_size=this._options.wrap_attributes_indent_size,e.is_end_tag=e.is_end_tag||c(e.tag_check,this._options.void_elements),e.is_empty_element=e.tag_complete||e.is_start_tag&&e.is_end_tag,e.is_unformatted=!e.tag_complete&&c(e.tag_check,this._options.unformatted),e.is_content_unformatted=!e.is_empty_element&&c(e.tag_check,this._options.content_unformatted),e.is_inline_element=c(e.tag_name,this._options.inline)||this._options.inline_custom_elements&&e.tag_name.includes("-")||"{"===e.tag_start_char,e},p.prototype._set_tag_position=function(t,e,n,i,r){if(n.is_empty_element||(n.is_end_tag?n.start_tag_token=this._tag_stack.try_pop(n.tag_name):(this._do_optional_end_element(n)&&(n.is_inline_element||t.print_newline(!1)),this._tag_stack.record_tag(n),"script"!==n.tag_name&&"style"!==n.tag_name||n.is_unformatted||n.is_content_unformatted||(n.custom_beautifier_name=h(n.tag_check,e)))),c(n.tag_check,this._options.extra_liners)&&(t.print_newline(!1),t._output.just_added_blankline()||t.print_newline(!0)),n.is_empty_element){if("{"===n.tag_start_char&&"else"===n.tag_check)this._tag_stack.indent_to_tag(["if","unless","each"]),n.indent_content=!0,t.current_line_has_match(/{{#if/)||t.print_newline(!1);"!--"===n.tag_name&&r.type===a.TAG_CLOSE&&i.is_end_tag&&-1===n.text.indexOf("\n")||(n.is_inline_element||n.is_unformatted||t.print_newline(!1),this._calcluate_parent_multiline(t,n))}else if(n.is_end_tag){var s=!1;s=(s=n.start_tag_token&&n.start_tag_token.multiline_content)||!n.is_inline_element&&!(i.is_inline_element||i.is_unformatted)&&!(r.type===a.TAG_CLOSE&&n.start_tag_token===i)&&"TK_CONTENT"!==r.type,(n.is_content_unformatted||n.is_unformatted)&&(s=!1),s&&t.print_newline(!1)}else n.indent_content=!n.custom_beautifier_name,"<"===n.tag_start_char&&("html"===n.tag_name?n.indent_content=this._options.indent_inner_html:"head"===n.tag_name?n.indent_content=this._options.indent_head_inner_html:"body"===n.tag_name&&(n.indent_content=this._options.indent_body_inner_html)),n.is_inline_element||n.is_unformatted||"TK_CONTENT"===r.type&&!n.is_content_unformatted||t.print_newline(!1),this._calcluate_parent_multiline(t,n)},p.prototype._calcluate_parent_multiline=function(t,e){!e.parent||!t._output.just_added_newline()||(e.is_inline_element||e.is_unformatted)&&e.parent.is_inline_element||(e.parent.multiline_content=!0)};var _=["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"],m=["a","audio","del","ins","map","noscript","video"];p.prototype._do_optional_end_element=function(t){var e=null;if(!t.is_empty_element&&t.is_start_tag&&t.parent){if("body"===t.tag_name)e=e||this._tag_stack.try_pop("head");else if("li"===t.tag_name)e=e||this._tag_stack.try_pop("li",["ol","ul","menu"]);else if("dd"===t.tag_name||"dt"===t.tag_name)e=(e=e||this._tag_stack.try_pop("dt",["dl"]))||this._tag_stack.try_pop("dd",["dl"]);else if("p"===t.parent.tag_name&&-1!==_.indexOf(t.tag_name)){var n=t.parent.parent;n&&-1!==m.indexOf(n.tag_name)||(e=e||this._tag_stack.try_pop("p"))}else"rp"===t.tag_name||"rt"===t.tag_name?e=(e=e||this._tag_stack.try_pop("rt",["ruby","rtc"]))||this._tag_stack.try_pop("rp",["ruby","rtc"]):"optgroup"===t.tag_name?e=e||this._tag_stack.try_pop("optgroup",["select"]):"option"===t.tag_name?e=e||this._tag_stack.try_pop("option",["select","datalist","optgroup"]):"colgroup"===t.tag_name?e=e||this._tag_stack.try_pop("caption",["table"]):"thead"===t.tag_name?e=(e=e||this._tag_stack.try_pop("caption",["table"]))||this._tag_stack.try_pop("colgroup",["table"]):"tbody"===t.tag_name||"tfoot"===t.tag_name?e=(e=(e=(e=e||this._tag_stack.try_pop("caption",["table"]))||this._tag_stack.try_pop("colgroup",["table"]))||this._tag_stack.try_pop("thead",["table"]))||this._tag_stack.try_pop("tbody",["table"]):"tr"===t.tag_name?e=(e=(e=e||this._tag_stack.try_pop("caption",["table"]))||this._tag_stack.try_pop("colgroup",["table"]))||this._tag_stack.try_pop("tr",["table","thead","tbody","tfoot"]):"th"!==t.tag_name&&"td"!==t.tag_name||(e=(e=e||this._tag_stack.try_pop("td",["table","thead","tbody","tfoot","tr"]))||this._tag_stack.try_pop("th",["table","thead","tbody","tfoot","tr"]));return t.parent=this._tag_stack.get_parser_token(),e}},t.exports.Beautifier=p},function(t,e,n){var i=n(6).Options;function r(t){i.call(this,t,"html"),1===this.templating.length&&"auto"===this.templating[0]&&(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"])}r.prototype=new i,t.exports.Options=r},function(t,e,n){var i=n(9).Tokenizer,r=n(9).TOKEN,s=n(13).Directives,a=n(14).TemplatablePattern,o=n(12).Pattern,l={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:r.START,RAW:r.RAW,EOF:r.EOF},u=new s(/<\!--/,/-->/),h=function(t,e){i.call(this,t,e),this._current_tag_name="";var n=new a(this._input).read_options(this._options),r=new o(this._input);if(this.__patterns={word:n.until(/[\n\r\t <]/),word_control_flow_close_excluded:n.until(/[\n\r\t <}]/),single_quote:n.until_after(/'/),double_quote:n.until_after(/"/),attribute:n.until(/[\n\r\t =>]|\/>/),element_name:n.until(/[\n\r\t >\/]/),angular_control_flow_start:r.matching(/\@[a-zA-Z]+[^({]*[({]/),handlebars_comment:r.starting_with(/{{!--/).until_after(/--}}/),handlebars:r.starting_with(/{{/).until_after(/}}/),handlebars_open:r.until(/[\n\r\t }]/),handlebars_raw_close:r.until(/}}/),comment:r.starting_with(/<!--/).until_after(/-->/),cdata:r.starting_with(/<!\[CDATA\[/).until_after(/]]>/),conditional_comment:r.starting_with(/<!\[/).until_after(/]>/),processing:r.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 s=this._input.get_literal_regexp(this._options.unformatted_content_delimiter);this.__patterns.unformatted_content_delimiter=r.matching(s).until_after(s)}};(h.prototype=new i)._is_comment=function(t){return!1},h.prototype._is_opening=function(t){return t.type===l.TAG_OPEN||t.type===l.CONTROL_FLOW_OPEN},h.prototype._is_closing=function(t,e){return t.type===l.TAG_CLOSE&&e&&((">"===t.text||"/>"===t.text)&&"<"===e.text[0]||"}}"===t.text&&"{"===e.text[0]&&"{"===e.text[1])||t.type===l.CONTROL_FLOW_CLOSE&&"}"===t.text&&e.text.endsWith("{")},h.prototype._reset=function(){this._current_tag_name=""},h.prototype._get_next_token=function(t,e){var n=null;this._readWhitespace();var i=this._input.peek();return null===i?this._create_token(l.EOF,""):n=(n=(n=(n=(n=(n=(n=(n=(n=(n=(n=n||this._read_open_handlebars(i,e))||this._read_attribute(i,t,e))||this._read_close(i,e))||this._read_script_and_style(i,t))||this._read_control_flows(i,e))||this._read_raw_content(i,t,e))||this._read_content_word(i,e))||this._read_comment_or_cdata(i))||this._read_processing(i))||this._read_open(i,e))||this._create_token(l.UNKNOWN,this._input.next())},h.prototype._read_comment_or_cdata=function(t){var e=null,n=null,i=null;"<"===t&&("!"===this._input.peek(1)&&((n=this.__patterns.comment.read())?(i=u.get_directives(n))&&"start"===i.ignore&&(n+=u.readIgnored(this._input)):n=this.__patterns.cdata.read()),n&&((e=this._create_token(l.COMMENT,n)).directives=i));return e},h.prototype._read_processing=function(t){var e=null,n=null;if("<"===t){var i=this._input.peek(1);"!"!==i&&"?"!==i||(n=(n=this.__patterns.conditional_comment.read())||this.__patterns.processing.read()),n&&((e=this._create_token(l.COMMENT,n)).directives=null)}return e},h.prototype._read_open=function(t,e){var n=null,i=null;return e&&e.type!==l.CONTROL_FLOW_OPEN||"<"===t&&(n=this._input.next(),"/"===this._input.peek()&&(n+=this._input.next()),n+=this.__patterns.element_name.read(),i=this._create_token(l.TAG_OPEN,n)),i},h.prototype._read_open_handlebars=function(t,e){var n=null,i=null;return e&&e.type!==l.CONTROL_FLOW_OPEN||(this._options.templating.includes("angular")||this._options.indent_handlebars)&&"{"===t&&"{"===this._input.peek(1)&&(this._options.indent_handlebars&&"!"===this._input.peek(2)?(n=(n=this.__patterns.handlebars_comment.read())||this.__patterns.handlebars.read(),i=this._create_token(l.COMMENT,n)):(n=this.__patterns.handlebars_open.read(),i=this._create_token(l.TAG_OPEN,n))),i},h.prototype._read_control_flows=function(t,e){var n="",i=null;if(!this._options.templating.includes("angular"))return i;if("@"===t){if(""===(n=this.__patterns.angular_control_flow_start.read()))return i;for(var r=n.endsWith("(")?1:0,s=0;!n.endsWith("{")||r!==s;){var a=this._input.next();if(null===a)break;"("===a?r++:")"===a&&s++,n+=a}i=this._create_token(l.CONTROL_FLOW_OPEN,n)}else"}"===t&&e&&e.type===l.CONTROL_FLOW_OPEN&&(n=this._input.next(),i=this._create_token(l.CONTROL_FLOW_CLOSE,n));return i},h.prototype._read_close=function(t,e){var n=null,i=null;return e&&e.type===l.TAG_OPEN&&("<"===e.text[0]&&(">"===t||"/"===t&&">"===this._input.peek(1))?(n=this._input.next(),"/"===t&&(n+=this._input.next()),i=this._create_token(l.TAG_CLOSE,n)):"{"===e.text[0]&&"}"===t&&"}"===this._input.peek(1)&&(this._input.next(),this._input.next(),i=this._create_token(l.TAG_CLOSE,"}}"))),i},h.prototype._read_attribute=function(t,e,n){var i=null,r="";if(n&&"<"===n.text[0])if("="===t)i=this._create_token(l.EQUALS,this._input.next());else if('"'===t||"'"===t){var s=this._input.next();s+='"'===t?this.__patterns.double_quote.read():this.__patterns.single_quote.read(),i=this._create_token(l.VALUE,s)}else(r=this.__patterns.attribute.read())&&(i=e.type===l.EQUALS?this._create_token(l.VALUE,r):this._create_token(l.ATTRIBUTE,r));return i},h.prototype._is_content_unformatted=function(t){return-1===this._options.void_elements.indexOf(t)&&(-1!==this._options.content_unformatted.indexOf(t)||-1!==this._options.unformatted.indexOf(t))},h.prototype._read_raw_content=function(t,e,n){var i="";if(n&&"{"===n.text[0])i=this.__patterns.handlebars_raw_close.read();else if(e.type===l.TAG_CLOSE&&"<"===e.opened.text[0]&&"/"!==e.text[0]){var r=e.opened.text.substr(1).toLowerCase();this._is_content_unformatted(r)&&(i=this._input.readUntil(new RegExp("</"+r+"[\\n\\r\\t ]*?>","ig")))}return i?this._create_token(l.TEXT,i):null},h.prototype._read_script_and_style=function(t,e){if(e.type===l.TAG_CLOSE&&"<"===e.opened.text[0]&&"/"!==e.text[0]){var n=e.opened.text.substr(1).toLowerCase();if("script"===n||"style"===n){var i=this._read_comment_or_cdata(t);if(i)return i.type=l.TEXT,i;var r=this._input.readUntil(new RegExp("</"+n+"[\\n\\r\\t ]*?>","ig"));if(r)return this._create_token(l.TEXT,r)}}return null},h.prototype._read_content_word=function(t,e){var n="";return this._options.unformatted_content_delimiter&&t===this._options.unformatted_content_delimiter[0]&&(n=this.__patterns.unformatted_content_delimiter.read()),n||(n=e&&e.type===l.CONTROL_FLOW_OPEN?this.__patterns.word_control_flow_close_excluded.read():this.__patterns.word.read()),n?this._create_token(l.TEXT,n):null},t.exports.Tokenizer=h,t.exports.TOKEN=l}],e={};var n=function n(i){var r=e[i];if(void 0!==r)return r.exports;var s=e[i]={exports:{}};return t[i](s,s.exports,n),s.exports}(18);s=n}();var a=s;i=[n,n(58553),n(87804)],r=function(t){var e=n(58553),i=n(87804);return{html_beautify:function(t,n){return a(t,n,e.js_beautify,i.css_beautify)}}}.apply(e,i),void 0===r||(t.exports=r)}()},58553:function(t,e){var n;!function(){var i;!function(){"use strict";var t=[function(t,e,n){var i=n(1).Beautifier,r=n(5).Options;t.exports=function(t,e){return new i(t,e).beautify()},t.exports.defaultOptions=function(){return new r}},function(t,e,n){var i=n(2).Output,r=n(3).Token,s=n(4),a=n(5).Options,o=n(7).Tokenizer,l=n(7).line_starters,u=n(7).positionable_operators,h=n(7).TOKEN;function c(t,e){return-1!==e.indexOf(t)}function d(t,e){return t&&t.type===h.RESERVED&&t.text===e}function f(t,e){return t&&t.type===h.RESERVED&&c(t.text,e)}var p=["case","return","do","if","throw","else","await","break","continue","async"],g=function(t){for(var e={},n=0;n<t.length;n++)e[t[n].replace(/-/g,"_")]=t[n];return e}(["before-newline","after-newline","preserve-newline"]),_=[g.before_newline,g.preserve_newline],m="BlockStatement",v="Statement",y="ObjectLiteral",b="ArrayLiteral",E="ForInitializer",w="Conditional",T="Expression";function k(t,e){e.multiline_frame||e.mode===E||e.mode===w||t.remove_indent(e.start_line_index)}function S(t){return t===b}function A(t){return c(t,[T,E,w])}function D(t,e){e=e||{},this._source_text=t||"",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 a(e)}D.prototype.create_flags=function(t,e){var n=0;return t&&(n=t.indentation_level,!this._output.just_added_newline()&&t.line_indent_level>n&&(n=t.line_indent_level)),{mode:e,parent:t,last_token:t?t.last_token:new r(h.START_BLOCK,""),last_word:t?t.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:n,alignment:0,line_indent_level:t?t.line_indent_level:n,start_line_index:this._output.get_line_number(),ternary_depth:0}},D.prototype._reset=function(t){var e=t.match(/^[\t ]*/)[0];this._last_last_text="",this._output=new i(this._options,e),this._output.raw=this._options.test_output_raw,this._flag_store=[],this.set_mode(m);var n=new o(t,this._options);return this._tokens=n.tokenize(),t},D.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var t=this._reset(this._source_text),e=this._options.eol;"auto"===this._options.eol&&(e="\n",t&&s.lineBreak.test(t||"")&&(e=t.match(s.lineBreak)[0]));for(var n=this._tokens.next();n;)this.handle_token(n),this._last_last_text=this._flags.last_token.text,this._flags.last_token=n,n=this._tokens.next();return this._output.get_code(e)},D.prototype.handle_token=function(t,e){t.type===h.START_EXPR?this.handle_start_expr(t):t.type===h.END_EXPR?this.handle_end_expr(t):t.type===h.START_BLOCK?this.handle_start_block(t):t.type===h.END_BLOCK?this.handle_end_block(t):t.type===h.WORD||t.type===h.RESERVED?this.handle_word(t):t.type===h.SEMICOLON?this.handle_semicolon(t):t.type===h.STRING?this.handle_string(t):t.type===h.EQUALS?this.handle_equals(t):t.type===h.OPERATOR?this.handle_operator(t):t.type===h.COMMA?this.handle_comma(t):t.type===h.BLOCK_COMMENT?this.handle_block_comment(t,e):t.type===h.COMMENT?this.handle_comment(t,e):t.type===h.DOT?this.handle_dot(t):t.type===h.EOF?this.handle_eof(t):(t.type,h.UNKNOWN,this.handle_unknown(t,e))},D.prototype.handle_whitespace_and_comments=function(t,e){var n=t.newlines,i=this._options.keep_array_indentation&&S(this._flags.mode);if(t.comments_before)for(var r=t.comments_before.next();r;)this.handle_whitespace_and_comments(r,e),this.handle_token(r,e),r=t.comments_before.next();if(i)for(var s=0;s<n;s+=1)this.print_newline(s>0,e);else if(this._options.max_preserve_newlines&&n>this._options.max_preserve_newlines&&(n=this._options.max_preserve_newlines),this._options.preserve_newlines&&n>1){this.print_newline(!1,e);for(var a=1;a<n;a+=1)this.print_newline(!0,e)}};var C=["async","break","continue","return","throw","yield"];D.prototype.allow_wrap_or_preserved_newline=function(t,e){if(e=void 0!==e&&e,!this._output.just_added_newline()){var n=this._options.preserve_newlines&&t.newlines||e;if(c(this._flags.last_token.text,u)||c(t.text,u)){var i=c(this._flags.last_token.text,u)&&c(this._options.operator_position,_)||c(t.text,u);n=n&&i}if(n)this.print_newline(!1,!0);else if(this._options.wrap_line_length){if(f(this._flags.last_token,C))return;this._output.set_wrap_point()}}},D.prototype.print_newline=function(t,e){if(!e&&";"!==this._flags.last_token.text&&","!==this._flags.last_token.text&&"="!==this._flags.last_token.text&&(this._flags.last_token.type!==h.OPERATOR||"--"===this._flags.last_token.text||"++"===this._flags.last_token.text))for(var n=this._tokens.peek();!(this._flags.mode!==v||this._flags.if_block&&d(n,"else")||this._flags.do_block);)this.restore_mode();this._output.add_new_line(t)&&(this._flags.multiline_frame=!0)},D.prototype.print_token_line_indentation=function(t){this._output.just_added_newline()&&(this._options.keep_array_indentation&&t.newlines&&("["===t.text||S(this._flags.mode))?(this._output.current_line.set_indent(-1),this._output.current_line.push(t.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))},D.prototype.print_token=function(t){if(this._output.raw)this._output.add_raw_token(t);else{if(this._options.comma_first&&t.previous&&t.previous.type===h.COMMA&&this._output.just_added_newline()&&","===this._output.previous_line.last()){var e=this._output.previous_line.pop();this._output.previous_line.is_empty()&&(this._output.previous_line.push(e),this._output.trim(!0),this._output.current_line.pop(),this._output.trim()),this.print_token_line_indentation(t),this._output.add_token(","),this._output.space_before_token=!0}this.print_token_line_indentation(t),this._output.non_breaking_space=!0,this._output.add_token(t.text),this._output.previous_token_wrapped&&(this._flags.multiline_frame=!0)}},D.prototype.indent=function(){this._flags.indentation_level+=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},D.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))},D.prototype.set_mode=function(t){this._flags?(this._flag_store.push(this._flags),this._previous_flags=this._flags):this._previous_flags=this.create_flags(null,t),this._flags=this.create_flags(this._previous_flags,t),this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},D.prototype.restore_mode=function(){this._flag_store.length>0&&(this._previous_flags=this._flags,this._flags=this._flag_store.pop(),this._previous_flags.mode===v&&k(this._output,this._previous_flags),this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},D.prototype.start_of_object_property=function(){return this._flags.parent.mode===y&&this._flags.mode===v&&(":"===this._flags.last_token.text&&0===this._flags.ternary_depth||f(this._flags.last_token,["get","set"]))},D.prototype.start_of_statement=function(t){var e=!1;return!!(e=(e=(e=(e=(e=(e=(e=e||f(this._flags.last_token,["var","let","const"])&&t.type===h.WORD)||d(this._flags.last_token,"do"))||!(this._flags.parent.mode===y&&this._flags.mode===v)&&f(this._flags.last_token,C)&&!t.newlines)||d(this._flags.last_token,"else")&&!(d(t,"if")&&!t.comments_before))||this._flags.last_token.type===h.END_EXPR&&(this._previous_flags.mode===E||this._previous_flags.mode===w))||this._flags.last_token.type===h.WORD&&this._flags.mode===m&&!this._flags.in_case&&!("--"===t.text||"++"===t.text)&&"function"!==this._last_last_text&&t.type!==h.WORD&&t.type!==h.RESERVED)||this._flags.mode===y&&(":"===this._flags.last_token.text&&0===this._flags.ternary_depth||f(this._flags.last_token,["get","set"])))&&(this.set_mode(v),this.indent(),this.handle_whitespace_and_comments(t,!0),this.start_of_object_property()||this.allow_wrap_or_preserved_newline(t,f(t,["do","for","if","while"])),!0)},D.prototype.handle_start_expr=function(t){this.start_of_statement(t)||this.handle_whitespace_and_comments(t);var e=T;if("["===t.text){if(this._flags.last_token.type===h.WORD||")"===this._flags.last_token.text)return f(this._flags.last_token,l)&&(this._output.space_before_token=!0),this.print_token(t),this.set_mode(e),this.indent(),void(this._options.space_in_paren&&(this._output.space_before_token=!0));e=b,S(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()),c(this._flags.last_token.type,[h.START_EXPR,h.END_EXPR,h.WORD,h.OPERATOR,h.DOT])||(this._output.space_before_token=!0)}else{if(this._flags.last_token.type===h.RESERVED)"for"===this._flags.last_token.text?(this._output.space_before_token=this._options.space_before_conditional,e=E):c(this._flags.last_token.text,["if","while","switch"])?(this._output.space_before_token=this._options.space_before_conditional,e=w):c(this._flags.last_word,["await","async"])?this._output.space_before_token=!0:"import"===this._flags.last_token.text&&""===t.whitespace_before?this._output.space_before_token=!1:(c(this._flags.last_token.text,l)||"catch"===this._flags.last_token.text)&&(this._output.space_before_token=!0);else if(this._flags.last_token.type===h.EQUALS||this._flags.last_token.type===h.OPERATOR)this.start_of_object_property()||this.allow_wrap_or_preserved_newline(t);else if(this._flags.last_token.type===h.WORD){this._output.space_before_token=!1;var n=this._tokens.peek(-3);if(this._options.space_after_named_function&&n){var i=this._tokens.peek(-4);f(n,["async","function"])||"*"===n.text&&f(i,["async","function"])?this._output.space_before_token=!0:this._flags.mode===y?"{"!==n.text&&","!==n.text&&("*"!==n.text||"{"!==i.text&&","!==i.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(t);(this._flags.last_token.type===h.RESERVED&&("function"===this._flags.last_word||"typeof"===this._flags.last_word)||"*"===this._flags.last_token.text&&(c(this._last_last_text,["function","yield"])||this._flags.mode===y&&c(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===h.START_BLOCK?this.print_newline():this._flags.last_token.type!==h.END_EXPR&&this._flags.last_token.type!==h.START_EXPR&&this._flags.last_token.type!==h.END_BLOCK&&"."!==this._flags.last_token.text&&this._flags.last_token.type!==h.COMMA||this.allow_wrap_or_preserved_newline(t,t.newlines),this.print_token(t),this.set_mode(e),this._options.space_in_paren&&(this._output.space_before_token=!0),this.indent()},D.prototype.handle_end_expr=function(t){for(;this._flags.mode===v;)this.restore_mode();this.handle_whitespace_and_comments(t),this._flags.multiline_frame&&this.allow_wrap_or_preserved_newline(t,"]"===t.text&&S(this._flags.mode)&&!this._options.keep_array_indentation),this._options.space_in_paren&&(this._flags.last_token.type!==h.START_EXPR||this._options.space_in_empty_paren?this._output.space_before_token=!0:(this._output.trim(),this._output.space_before_token=!1)),this.deindent(),this.print_token(t),this.restore_mode(),k(this._output,this._previous_flags),this._flags.do_while&&this._previous_flags.mode===w&&(this._previous_flags.mode=T,this._flags.do_block=!1,this._flags.do_while=!1)},D.prototype.handle_start_block=function(t){this.handle_whitespace_and_comments(t);var e=this._tokens.peek(),n=this._tokens.peek(1);"switch"===this._flags.last_word&&this._flags.last_token.type===h.END_EXPR?(this.set_mode(m),this._flags.in_case_statement=!0):this._flags.case_body?this.set_mode(m):n&&(c(n.text,[":",","])&&c(e.type,[h.STRING,h.WORD,h.RESERVED])||c(e.text,["get","set","..."])&&c(n.type,[h.WORD,h.RESERVED]))?c(this._last_last_text,["class","interface"])&&!c(n.text,[":",","])?this.set_mode(m):this.set_mode(y):this._flags.last_token.type===h.OPERATOR&&"=>"===this._flags.last_token.text?this.set_mode(m):c(this._flags.last_token.type,[h.EQUALS,h.START_EXPR,h.COMMA,h.OPERATOR])||f(this._flags.last_token,["return","throw","import","default"])?this.set_mode(y):this.set_mode(m),this._flags.last_token&&f(this._flags.last_token.previous,["class","extends"])&&(this._flags.class_start_block=!0);var i=!e.comments_before&&"}"===e.text,r=i&&"function"===this._flags.last_word&&this._flags.last_token.type===h.END_EXPR;if(this._options.brace_preserve_inline){var s=0,a=null;this._flags.inline_frame=!0;do{if(s+=1,(a=this._tokens.peek(s-1)).newlines){this._flags.inline_frame=!1;break}}while(a.type!==h.EOF&&(a.type!==h.END_BLOCK||a.opened!==t))}("expand"===this._options.brace_style||"none"===this._options.brace_style&&t.newlines)&&!this._flags.inline_frame?this._flags.last_token.type!==h.OPERATOR&&(r||this._flags.last_token.type===h.EQUALS||f(this._flags.last_token,p)&&"else"!==this._flags.last_token.text)?this._output.space_before_token=!0:this.print_newline(!1,!0):(!S(this._previous_flags.mode)||this._flags.last_token.type!==h.START_EXPR&&this._flags.last_token.type!==h.COMMA||((this._flags.last_token.type===h.COMMA||this._options.space_in_paren)&&(this._output.space_before_token=!0),(this._flags.last_token.type===h.COMMA||this._flags.last_token.type===h.START_EXPR&&this._flags.inline_frame)&&(this.allow_wrap_or_preserved_newline(t),this._previous_flags.multiline_frame=this._previous_flags.multiline_frame||this._flags.multiline_frame,this._flags.multiline_frame=!1)),this._flags.last_token.type!==h.OPERATOR&&this._flags.last_token.type!==h.START_EXPR&&(c(this._flags.last_token.type,[h.START_BLOCK,h.SEMICOLON])&&!this._flags.inline_frame?this.print_newline():this._output.space_before_token=!0)),this.print_token(t),this.indent(),i||this._options.brace_preserve_inline&&this._flags.inline_frame||this.print_newline()},D.prototype.handle_end_block=function(t){for(this.handle_whitespace_and_comments(t);this._flags.mode===v;)this.restore_mode();var e=this._flags.last_token.type===h.START_BLOCK;this._flags.inline_frame&&!e?this._output.space_before_token=!0:"expand"===this._options.brace_style?e||this.print_newline():e||(S(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(t)},D.prototype.handle_word=function(t){if(t.type===h.RESERVED)if(c(t.text,["set","get"])&&this._flags.mode!==y)t.type=h.WORD;else if("import"===t.text&&c(this._tokens.peek().text,["(","."]))t.type=h.WORD;else if(c(t.text,["as","from"])&&!this._flags.import_block)t.type=h.WORD;else if(this._flags.mode===y){":"===this._tokens.peek().text&&(t.type=h.WORD)}if(this.start_of_statement(t)?f(this._flags.last_token,["var","let","const"])&&t.type===h.WORD&&(this._flags.declaration_statement=!0):!t.newlines||A(this._flags.mode)||this._flags.last_token.type===h.OPERATOR&&"--"!==this._flags.last_token.text&&"++"!==this._flags.last_token.text||this._flags.last_token.type===h.EQUALS||!this._options.preserve_newlines&&f(this._flags.last_token,["var","let","const","set","get"])?this.handle_whitespace_and_comments(t):(this.handle_whitespace_and_comments(t),this.print_newline()),this._flags.do_block&&!this._flags.do_while){if(d(t,"while"))return this._output.space_before_token=!0,this.print_token(t),this._output.space_before_token=!0,void(this._flags.do_while=!0);this.print_newline(),this._flags.do_block=!1}if(this._flags.if_block)if(!this._flags.else_block&&d(t,"else"))this._flags.else_block=!0;else{for(;this._flags.mode===v;)this.restore_mode();this._flags.if_block=!1,this._flags.else_block=!1}if(this._flags.in_case_statement&&f(t,["case","default"]))return 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(t),void(this._flags.in_case=!0);if(this._flags.last_token.type!==h.COMMA&&this._flags.last_token.type!==h.START_EXPR&&this._flags.last_token.type!==h.EQUALS&&this._flags.last_token.type!==h.OPERATOR||this.start_of_object_property()||c(this._flags.last_token.text,["+","-"])&&":"===this._last_last_text&&this._flags.parent.mode===y||this.allow_wrap_or_preserved_newline(t),d(t,"function"))return(c(this._flags.last_token.text,["}",";"])||this._output.just_added_newline()&&!c(this._flags.last_token.text,["(","[","{",":","=",","])&&this._flags.last_token.type!==h.OPERATOR)&&(this._output.just_added_blankline()||t.comments_before||(this.print_newline(),this.print_newline(!0))),this._flags.last_token.type===h.RESERVED||this._flags.last_token.type===h.WORD?f(this._flags.last_token,["get","set","new","export"])||f(this._flags.last_token,C)||d(this._flags.last_token,"default")&&"export"===this._last_last_text||"declare"===this._flags.last_token.text?this._output.space_before_token=!0:this.print_newline():this._flags.last_token.type===h.OPERATOR||"="===this._flags.last_token.text?this._output.space_before_token=!0:(this._flags.multiline_frame||!A(this._flags.mode)&&!S(this._flags.mode))&&this.print_newline(),this.print_token(t),void(this._flags.last_word=t.text);var e="NONE";(this._flags.last_token.type===h.END_BLOCK?this._previous_flags.inline_frame?e="SPACE":f(t,["else","catch","finally","from"])?"expand"===this._options.brace_style||"end-expand"===this._options.brace_style||"none"===this._options.brace_style&&t.newlines?e="NEWLINE":(e="SPACE",this._output.space_before_token=!0):e="NEWLINE":this._flags.last_token.type===h.SEMICOLON&&this._flags.mode===m?e="NEWLINE":this._flags.last_token.type===h.SEMICOLON&&A(this._flags.mode)?e="SPACE":this._flags.last_token.type===h.STRING?e="NEWLINE":this._flags.last_token.type===h.RESERVED||this._flags.last_token.type===h.WORD||"*"===this._flags.last_token.text&&(c(this._last_last_text,["function","yield"])||this._flags.mode===y&&c(this._last_last_text,["{",","]))?e="SPACE":this._flags.last_token.type===h.START_BLOCK?e=this._flags.inline_frame?"SPACE":"NEWLINE":this._flags.last_token.type===h.END_EXPR&&(this._output.space_before_token=!0,e="NEWLINE"),f(t,l)&&")"!==this._flags.last_token.text&&(e=this._flags.inline_frame||"else"===this._flags.last_token.text||"export"===this._flags.last_token.text?"SPACE":"NEWLINE"),f(t,["else","catch","finally"]))?(this._flags.last_token.type!==h.END_BLOCK||this._previous_flags.mode!==m||"expand"===this._options.brace_style||"end-expand"===this._options.brace_style||"none"===this._options.brace_style&&t.newlines)&&!this._flags.inline_frame?this.print_newline():(this._output.trim(!0),"}"!==this._output.current_line.last()&&this.print_newline(),this._output.space_before_token=!0):"NEWLINE"===e?f(this._flags.last_token,p)||"declare"===this._flags.last_token.text&&f(t,["var","let","const"])?this._output.space_before_token=!0:this._flags.last_token.type!==h.END_EXPR?this._flags.last_token.type===h.START_EXPR&&f(t,["var","let","const"])||":"===this._flags.last_token.text||(d(t,"if")&&d(t.previous,"else")?this._output.space_before_token=!0:this.print_newline()):f(t,l)&&")"!==this._flags.last_token.text&&this.print_newline():this._flags.multiline_frame&&S(this._flags.mode)&&","===this._flags.last_token.text&&"}"===this._last_last_text?this.print_newline():"SPACE"===e&&(this._output.space_before_token=!0);!t.previous||t.previous.type!==h.WORD&&t.previous.type!==h.RESERVED||(this._output.space_before_token=!0),this.print_token(t),this._flags.last_word=t.text,t.type===h.RESERVED&&("do"===t.text?this._flags.do_block=!0:"if"===t.text?this._flags.if_block=!0:"import"===t.text?this._flags.import_block=!0:this._flags.import_block&&d(t,"from")&&(this._flags.import_block=!1))},D.prototype.handle_semicolon=function(t){this.start_of_statement(t)?this._output.space_before_token=!1:this.handle_whitespace_and_comments(t);for(var e=this._tokens.peek();!(this._flags.mode!==v||this._flags.if_block&&d(e,"else")||this._flags.do_block);)this.restore_mode();this._flags.import_block&&(this._flags.import_block=!1),this.print_token(t)},D.prototype.handle_string=function(t){(!t.text.startsWith("`")||0!==t.newlines||""!==t.whitespace_before||")"!==t.previous.text&&this._flags.last_token.type!==h.WORD)&&(this.start_of_statement(t)?this._output.space_before_token=!0:(this.handle_whitespace_and_comments(t),this._flags.last_token.type===h.RESERVED||this._flags.last_token.type===h.WORD||this._flags.inline_frame?this._output.space_before_token=!0:this._flags.last_token.type===h.COMMA||this._flags.last_token.type===h.START_EXPR||this._flags.last_token.type===h.EQUALS||this._flags.last_token.type===h.OPERATOR?this.start_of_object_property()||this.allow_wrap_or_preserved_newline(t):!t.text.startsWith("`")||this._flags.last_token.type!==h.END_EXPR||"]"!==t.previous.text&&")"!==t.previous.text||0!==t.newlines?this.print_newline():this._output.space_before_token=!0)),this.print_token(t)},D.prototype.handle_equals=function(t){this.start_of_statement(t)||this.handle_whitespace_and_comments(t),this._flags.declaration_statement&&(this._flags.declaration_assignment=!0),this._output.space_before_token=!0,this.print_token(t),this._output.space_before_token=!0},D.prototype.handle_comma=function(t){this.handle_whitespace_and_comments(t,!0),this.print_token(t),this._output.space_before_token=!0,this._flags.declaration_statement?(A(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(t)):this._flags.mode===y||this._flags.mode===v&&this._flags.parent.mode===y?(this._flags.mode===v&&this.restore_mode(),this._flags.inline_frame||this.print_newline()):this._options.comma_first&&this.allow_wrap_or_preserved_newline(t)},D.prototype.handle_operator=function(t){var e="*"===t.text&&(f(this._flags.last_token,["function","yield"])||c(this._flags.last_token.type,[h.START_BLOCK,h.COMMA,h.END_BLOCK,h.SEMICOLON])),n=c(t.text,["-","+"])&&(c(this._flags.last_token.type,[h.START_BLOCK,h.START_EXPR,h.EQUALS,h.OPERATOR])||c(this._flags.last_token.text,l)||","===this._flags.last_token.text);if(this.start_of_statement(t));else{var i=!e;this.handle_whitespace_and_comments(t,i)}if("*"!==t.text||this._flags.last_token.type!==h.DOT)if("::"!==t.text)if(c(t.text,["-","+"])&&this.start_of_object_property())this.print_token(t);else{if(this._flags.last_token.type===h.OPERATOR&&c(this._options.operator_position,_)&&this.allow_wrap_or_preserved_newline(t),":"===t.text&&this._flags.in_case)return this.print_token(t),this._flags.in_case=!1,this._flags.case_body=!0,void(this._tokens.peek().type!==h.START_BLOCK?(this.indent(),this.print_newline(),this._flags.case_block=!1):(this._flags.case_block=!0,this._output.space_before_token=!0));var r=!0,s=!0,a=!1;if(":"===t.text?0===this._flags.ternary_depth?r=!1:(this._flags.ternary_depth-=1,a=!0):"?"===t.text&&(this._flags.ternary_depth+=1),!n&&!e&&this._options.preserve_newlines&&c(t.text,u)){var o=":"===t.text,d=o&&a,y=o&&!a;switch(this._options.operator_position){case g.before_newline:return this._output.space_before_token=!y,this.print_token(t),o&&!d||this.allow_wrap_or_preserved_newline(t),void(this._output.space_before_token=!0);case g.after_newline:return this._output.space_before_token=!0,!o||d?this._tokens.peek().newlines?this.print_newline(!1,!0):this.allow_wrap_or_preserved_newline(t):this._output.space_before_token=!1,this.print_token(t),void(this._output.space_before_token=!0);case g.preserve_newline:return y||this.allow_wrap_or_preserved_newline(t),r=!(this._output.just_added_newline()||y),this._output.space_before_token=r,this.print_token(t),void(this._output.space_before_token=!0)}}if(e){this.allow_wrap_or_preserved_newline(t),r=!1;var b=this._tokens.peek();s=b&&c(b.type,[h.WORD,h.RESERVED])}else if("..."===t.text)this.allow_wrap_or_preserved_newline(t),r=this._flags.last_token.type===h.START_BLOCK,s=!1;else if(c(t.text,["--","++","!","~"])||n){if(this._flags.last_token.type!==h.COMMA&&this._flags.last_token.type!==h.START_EXPR||this.allow_wrap_or_preserved_newline(t),r=!1,s=!1,t.newlines&&("--"===t.text||"++"===t.text||"~"===t.text)){var E=f(this._flags.last_token,p)&&t.newlines;E&&(this._previous_flags.if_block||this._previous_flags.else_block)&&this.restore_mode(),this.print_newline(E,!0)}";"===this._flags.last_token.text&&A(this._flags.mode)&&(r=!0),this._flags.last_token.type===h.RESERVED?r=!0:this._flags.last_token.type===h.END_EXPR?r=!("]"===this._flags.last_token.text&&("--"===t.text||"++"===t.text)):this._flags.last_token.type===h.OPERATOR&&(r=c(t.text,["--","-","++","+"])&&c(this._flags.last_token.text,["--","-","++","+"]),c(t.text,["+","-"])&&c(this._flags.last_token.text,["--","++"])&&(s=!0)),(this._flags.mode!==m||this._flags.inline_frame)&&this._flags.mode!==v||"{"!==this._flags.last_token.text&&";"!==this._flags.last_token.text||this.print_newline()}this._output.space_before_token=this._output.space_before_token||r,this.print_token(t),this._output.space_before_token=s}else this.print_token(t);else this.print_token(t)},D.prototype.handle_block_comment=function(t,e){return this._output.raw?(this._output.add_raw_token(t),void(t.directives&&"end"===t.directives.preserve&&(this._output.raw=this._options.test_output_raw))):t.directives?(this.print_newline(!1,e),this.print_token(t),"start"===t.directives.preserve&&(this._output.raw=!0),void this.print_newline(!1,!0)):s.newline.test(t.text)||t.newlines?void this.print_block_commment(t,e):(this._output.space_before_token=!0,this.print_token(t),void(this._output.space_before_token=!0))},D.prototype.print_block_commment=function(t,e){var n,i=function(t){for(var e=[],n=(t=t.replace(s.allLineBreaks,"\n")).indexOf("\n");-1!==n;)e.push(t.substring(0,n)),n=(t=t.substring(n+1)).indexOf("\n");return t.length&&e.push(t),e}(t.text),r=!1,a=!1,o=t.whitespace_before,l=o.length;if(this.print_newline(!1,e),this.print_token_line_indentation(t),this._output.add_token(i[0]),this.print_newline(!1,e),i.length>1){for(r=function(t,e){for(var n=0;n<t.length;n++)if(t[n].trim().charAt(0)!==e)return!1;return!0}(i=i.slice(1),"*"),a=function(t,e){for(var n,i=0,r=t.length;i<r;i++)if((n=t[i])&&0!==n.indexOf(e))return!1;return!0}(i,o),r&&(this._flags.alignment=1),n=0;n<i.length;n++)r?(this.print_token_line_indentation(t),this._output.add_token(i[n].replace(/^\s+/g,""))):a&&i[n]?(this.print_token_line_indentation(t),this._output.add_token(i[n].substring(l))):(this._output.current_line.set_indent(-1),this._output.add_token(i[n])),this.print_newline(!1,e);this._flags.alignment=0}},D.prototype.handle_comment=function(t,e){t.newlines?this.print_newline(!1,e):this._output.trim(!0),this._output.space_before_token=!0,this.print_token(t),this.print_newline(!1,e)},D.prototype.handle_dot=function(t){this.start_of_statement(t)||this.handle_whitespace_and_comments(t,!0),this._flags.last_token.text.match("^[0-9]+$")&&(this._output.space_before_token=!0),f(this._flags.last_token,p)?this._output.space_before_token=!1:this.allow_wrap_or_preserved_newline(t,")"===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(t)},D.prototype.handle_unknown=function(t,e){this.print_token(t),"\n"===t.text[t.text.length-1]&&this.print_newline(!1,e)},D.prototype.handle_eof=function(t){for(;this._flags.mode===v;)this.restore_mode();this.handle_whitespace_and_comments(t)},t.exports.Beautifier=D},function(t){function e(t){this.__parent=t,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}function n(t,e){this.__cache=[""],this.__indent_size=t.indent_size,this.__indent_string=t.indent_char,t.indent_with_tabs||(this.__indent_string=new Array(t.indent_size+1).join(t.indent_char)),e=e||"",t.indent_level>0&&(e=new Array(t.indent_level+1).join(this.__indent_string)),this.__base_string=e,this.__base_string_length=e.length}function i(t,i){this.__indent_cache=new n(t,i),this.raw=!1,this._end_with_newline=t.end_with_newline,this.indent_size=t.indent_size,this.wrap_line_length=t.wrap_line_length,this.indent_empty_lines=t.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new e(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}e.prototype.clone_empty=function(){var t=new e(this.__parent);return t.set_indent(this.__indent_count,this.__alignment_count),t},e.prototype.item=function(t){return t<0?this.__items[this.__items.length+t]:this.__items[t]},e.prototype.has_match=function(t){for(var e=this.__items.length-1;e>=0;e--)if(this.__items[e].match(t))return!0;return!1},e.prototype.set_indent=function(t,e){this.is_empty()&&(this.__indent_count=t||0,this.__alignment_count=e||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},e.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)},e.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},e.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var t=this.__parent.current_line;return t.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),t.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),t.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count," "===t.__items[0]&&(t.__items.splice(0,1),t.__character_count-=1),!0}return!1},e.prototype.is_empty=function(){return 0===this.__items.length},e.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},e.prototype.push=function(t){this.__items.push(t);var e=t.lastIndexOf("\n");-1!==e?this.__character_count=t.length-e:this.__character_count+=t.length},e.prototype.pop=function(){var t=null;return this.is_empty()||(t=this.__items.pop(),this.__character_count-=t.length),t},e.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},e.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},e.prototype.trim=function(){for(;" "===this.last();)this.__items.pop(),this.__character_count-=1},e.prototype.toString=function(){var t="";return this.is_empty()?this.__parent.indent_empty_lines&&(t=this.__parent.get_indent_string(this.__indent_count)):(t=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),t+=this.__items.join("")),t},n.prototype.get_indent_size=function(t,e){var n=this.__base_string_length;return e=e||0,t<0&&(n=0),n+=t*this.__indent_size,n+=e},n.prototype.get_indent_string=function(t,e){var n=this.__base_string;return e=e||0,t<0&&(t=0,n=""),e+=t*this.__indent_size,this.__ensure_cache(e),n+=this.__cache[e]},n.prototype.__ensure_cache=function(t){for(;t>=this.__cache.length;)this.__add_column()},n.prototype.__add_column=function(){var t=this.__cache.length,e=0,n="";this.__indent_size&&t>=this.__indent_size&&(t-=(e=Math.floor(t/this.__indent_size))*this.__indent_size,n=new Array(e+1).join(this.__indent_string)),t&&(n+=new Array(t+1).join(" ")),this.__cache.push(n)},i.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},i.prototype.get_line_number=function(){return this.__lines.length},i.prototype.get_indent_string=function(t,e){return this.__indent_cache.get_indent_string(t,e)},i.prototype.get_indent_size=function(t,e){return this.__indent_cache.get_indent_size(t,e)},i.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},i.prototype.add_new_line=function(t){return!(this.is_empty()||!t&&this.just_added_newline())&&(this.raw||this.__add_outputline(),!0)},i.prototype.get_code=function(t){this.trim(!0);var e=this.current_line.pop();e&&("\n"===e[e.length-1]&&(e=e.replace(/\n+$/g,"")),this.current_line.push(e)),this._end_with_newline&&this.__add_outputline();var n=this.__lines.join("\n");return"\n"!==t&&(n=n.replace(/[\n]/g,t)),n},i.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},i.prototype.set_indent=function(t,e){return t=t||0,e=e||0,this.next_line.set_indent(t,e),this.__lines.length>1?(this.current_line.set_indent(t,e),!0):(this.current_line.set_indent(),!1)},i.prototype.add_raw_token=function(t){for(var e=0;e<t.newlines;e++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(t.whitespace_before),this.current_line.push(t.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},i.prototype.add_token=function(t){this.__add_space_before_token(),this.current_line.push(t),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},i.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(" "))},i.prototype.remove_indent=function(t){for(var e=this.__lines.length;t<e;)this.__lines[t]._remove_indent(),t++;this.current_line._remove_wrap_indent()},i.prototype.trim=function(t){for(t=void 0!==t&&t,this.current_line.trim();t&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},i.prototype.just_added_newline=function(){return this.current_line.is_empty()},i.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},i.prototype.ensure_empty_line_above=function(t,n){for(var i=this.__lines.length-2;i>=0;){var r=this.__lines[i];if(r.is_empty())break;if(0!==r.item(0).indexOf(t)&&r.item(-1)!==n){this.__lines.splice(i+1,0,new e(this)),this.previous_line=this.__lines[this.__lines.length-2];break}i--}},t.exports.Output=i},function(t){t.exports.Token=function(t,e,n,i){this.type=t,this.text=e,this.comments_before=null,this.newlines=n||0,this.whitespace_before=i||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}},function(t,e){var n="\\x24\\x30-\\x39\\x41-\\x5a\\x5f\\x61-\\x7a",i="\\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",r="\\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",s="\\\\u[0-9a-fA-F]{4}|\\\\u\\{[0-9a-fA-F]+\\}",a="(?:"+s+"|[\\x23\\x24\\x40\\x41-\\x5a\\x5f\\x61-\\x7a"+i+"])",o="(?:"+s+"|["+n+i+r+"])*";e.identifier=new RegExp(a+o,"g"),e.identifierStart=new RegExp(a),e.identifierMatch=new RegExp("(?:"+s+"|["+n+i+r+"])+");e.newline=/[\n\r\u2028\u2029]/,e.lineBreak=new RegExp("\r\n|"+e.newline.source),e.allLineBreaks=new RegExp(e.lineBreak.source,"g")},function(t,e,n){var i=n(6).Options,r=["before-newline","after-newline","preserve-newline"];function s(t){i.call(this,t,"js");var e=this.raw_options.brace_style||null;"expand-strict"===e?this.raw_options.brace_style="expand":"collapse-preserve-inline"===e?this.raw_options.brace_style="collapse,preserve-inline":void 0!==this.raw_options.braces_on_own_line&&(this.raw_options.brace_style=this.raw_options.braces_on_own_line?"expand":"collapse");var n=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_preserve_inline=!1,this.brace_style="collapse";for(var s=0;s<n.length;s++)"preserve-inline"===n[s]?this.brace_preserve_inline=!0:this.brace_style=n[s];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",r),this.test_output_raw=this._get_boolean("test_output_raw"),this.jslint_happy&&(this.space_after_anon_function=!0)}s.prototype=new i,t.exports.Options=s},function(t){function e(t,e){this.raw_options=n(t,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","\t"===this.indent_char),this.indent_with_tabs&&(this.indent_char="\t",1===this.indent_size&&(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"])}function n(t,e){var n,r={};for(n in t=i(t))n!==e&&(r[n]=t[n]);if(e&&t[e])for(n in t[e])r[n]=t[e][n];return r}function i(t){var e,n={};for(e in t){n[e.replace(/-/g,"_")]=t[e]}return n}e.prototype._get_array=function(t,e){var n=this.raw_options[t],i=e||[];return"object"==typeof n?null!==n&&"function"==typeof n.concat&&(i=n.concat()):"string"==typeof n&&(i=n.split(/[^a-zA-Z0-9_\/\-]+/)),i},e.prototype._get_boolean=function(t,e){var n=this.raw_options[t];return void 0===n?!!e:!!n},e.prototype._get_characters=function(t,e){var n=this.raw_options[t],i=e||"";return"string"==typeof n&&(i=n.replace(/\\r/,"\r").replace(/\\n/,"\n").replace(/\\t/,"\t")),i},e.prototype._get_number=function(t,e){var n=this.raw_options[t];e=parseInt(e,10),isNaN(e)&&(e=0);var i=parseInt(n,10);return isNaN(i)&&(i=e),i},e.prototype._get_selection=function(t,e,n){var i=this._get_selection_list(t,e,n);if(1!==i.length)throw new Error("Invalid Option Value: The option '"+t+"' can only be one of the following values:\n"+e+"\nYou passed in: '"+this.raw_options[t]+"'");return i[0]},e.prototype._get_selection_list=function(t,e,n){if(!e||0===e.length)throw new Error("Selection list cannot be empty.");if(n=n||[e[0]],!this._is_valid_selection(n,e))throw new Error("Invalid Default Value!");var i=this._get_array(t,n);if(!this._is_valid_selection(i,e))throw new Error("Invalid Option Value: The option '"+t+"' can contain only the following values:\n"+e+"\nYou passed in: '"+this.raw_options[t]+"'");return i},e.prototype._is_valid_selection=function(t,e){return t.length&&e.length&&!t.some((function(t){return-1===e.indexOf(t)}))},t.exports.Options=e,t.exports.normalizeOpts=i,t.exports.mergeOpts=n},function(t,e,n){var i=n(8).InputScanner,r=n(9).Tokenizer,s=n(9).TOKEN,a=n(13).Directives,o=n(4),l=n(12).Pattern,u=n(14).TemplatablePattern;function h(t,e){return-1!==e.indexOf(t)}var c={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:s.START,RAW:s.RAW,EOF:s.EOF},d=new a(/\/\*/,/\*\//),f=/0[xX][0123456789abcdefABCDEF_]*n?|0[oO][01234567_]*n?|0[bB][01_]*n?|\d[\d_]*n|(?:\.\d[\d_]*|\d[\d_]*\.?[\d_]*)(?:[eE][+-]?[\d_]+)?/,p=/[0-9]/,g=/[^\d\.]/,_=">>> === !== &&= ??= ||= << && >= ** != == <= >> || ?? |> < / - + > : & % ? ^ | *".split(" "),m=">>>= ... >>= <<= === >>> !== **= &&= ??= ||= => ^= :: /= << <= == && -= >= >> != -- += ** || ?? ++ %= &= *= |= |> = ! ? > < : / ^ - + * & % ~ |";m=(m="\\?\\.(?!\\d) "+(m=m.replace(/[-[\]{}()*+?.,\\^$|#]/g,"\\$&"))).replace(/ /g,"|");var v,y=new RegExp(m),b="continue,try,throw,return,var,let,const,if,switch,case,default,for,while,break,function,import,export".split(","),E=b.concat(["do","in","of","else","get","set","new","catch","finally","typeof","yield","async","await","from","as","class","extends"]),w=new RegExp("^(?:"+E.join("|")+")$"),T=function(t,e){r.call(this,t,e),this._patterns.whitespace=this._patterns.whitespace.matching(/\u00A0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff/.source,/\u2028\u2029/.source);var n=new l(this._input),i=new u(this._input).read_options(this._options);this.__patterns={template:i,identifier:i.starting_with(o.identifier).matching(o.identifierMatch),number:n.matching(f),punct:n.matching(y),comment:n.starting_with(/\/\//).until(/[\n\r\u2028\u2029]/),block_comment:n.starting_with(/\/\*/).until_after(/\*\//),html_comment_start:n.matching(/<!--/),html_comment_end:n.matching(/-->/),include:n.starting_with(/#include/).until_after(o.lineBreak),shebang:n.starting_with(/#!/).until_after(o.lineBreak),xml:n.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:i.until(/['\\\n\r\u2028\u2029]/),double_quote:i.until(/["\\\n\r\u2028\u2029]/),template_text:i.until(/[`\\$]/),template_expression:i.until(/[`}\\]/)}};(T.prototype=new r)._is_comment=function(t){return t.type===c.COMMENT||t.type===c.BLOCK_COMMENT||t.type===c.UNKNOWN},T.prototype._is_opening=function(t){return t.type===c.START_BLOCK||t.type===c.START_EXPR},T.prototype._is_closing=function(t,e){return(t.type===c.END_BLOCK||t.type===c.END_EXPR)&&e&&("]"===t.text&&"["===e.text||")"===t.text&&"("===e.text||"}"===t.text&&"{"===e.text)},T.prototype._reset=function(){v=!1},T.prototype._get_next_token=function(t,e){var n=null;this._readWhitespace();var i=this._input.peek();return null===i?this._create_token(c.EOF,""):n=(n=(n=(n=(n=(n=(n=(n=(n=(n=n||this._read_non_javascript(i))||this._read_string(i))||this._read_pair(i,this._input.peek(1)))||this._read_word(t))||this._read_singles(i))||this._read_comment(i))||this._read_regexp(i,t))||this._read_xml(i,t))||this._read_punctuation())||this._create_token(c.UNKNOWN,this._input.next())},T.prototype._read_word=function(t){var e;return""!==(e=this.__patterns.identifier.read())?(e=e.replace(o.allLineBreaks,"\n"),t.type!==c.DOT&&(t.type!==c.RESERVED||"set"!==t.text&&"get"!==t.text)&&w.test(e)?"in"!==e&&"of"!==e||t.type!==c.WORD&&t.type!==c.STRING?this._create_token(c.RESERVED,e):this._create_token(c.OPERATOR,e):this._create_token(c.WORD,e)):""!==(e=this.__patterns.number.read())?this._create_token(c.WORD,e):void 0},T.prototype._read_singles=function(t){var e=null;return"("===t||"["===t?e=this._create_token(c.START_EXPR,t):")"===t||"]"===t?e=this._create_token(c.END_EXPR,t):"{"===t?e=this._create_token(c.START_BLOCK,t):"}"===t?e=this._create_token(c.END_BLOCK,t):";"===t?e=this._create_token(c.SEMICOLON,t):"."===t&&g.test(this._input.peek(1))?e=this._create_token(c.DOT,t):","===t&&(e=this._create_token(c.COMMA,t)),e&&this._input.next(),e},T.prototype._read_pair=function(t,e){var n=null;return"#"===t&&"{"===e&&(n=this._create_token(c.START_BLOCK,t+e)),n&&(this._input.next(),this._input.next()),n},T.prototype._read_punctuation=function(){var t=this.__patterns.punct.read();if(""!==t)return"="===t?this._create_token(c.EQUALS,t):"?."===t?this._create_token(c.DOT,t):this._create_token(c.OPERATOR,t)},T.prototype._read_non_javascript=function(t){var e="";if("#"===t){if(this._is_first_token()&&(e=this.__patterns.shebang.read()))return this._create_token(c.UNKNOWN,e.trim()+"\n");if(e=this.__patterns.include.read())return this._create_token(c.UNKNOWN,e.trim()+"\n");t=this._input.next();var n="#";if(this._input.hasNext()&&this._input.testChar(p)){do{n+=t=this._input.next()}while(this._input.hasNext()&&"#"!==t&&"="!==t);return"#"===t||("["===this._input.peek()&&"]"===this._input.peek(1)?(n+="[]",this._input.next(),this._input.next()):"{"===this._input.peek()&&"}"===this._input.peek(1)&&(n+="{}",this._input.next(),this._input.next())),this._create_token(c.WORD,n)}this._input.back()}else if("<"===t&&this._is_first_token()){if(e=this.__patterns.html_comment_start.read()){for(;this._input.hasNext()&&!this._input.testChar(o.newline);)e+=this._input.next();return v=!0,this._create_token(c.COMMENT,e)}}else if(v&&"-"===t&&(e=this.__patterns.html_comment_end.read()))return v=!1,this._create_token(c.COMMENT,e);return null},T.prototype._read_comment=function(t){var e=null;if("/"===t){var n="";if("*"===this._input.peek(1)){n=this.__patterns.block_comment.read();var i=d.get_directives(n);i&&"start"===i.ignore&&(n+=d.readIgnored(this._input)),n=n.replace(o.allLineBreaks,"\n"),(e=this._create_token(c.BLOCK_COMMENT,n)).directives=i}else"/"===this._input.peek(1)&&(n=this.__patterns.comment.read(),e=this._create_token(c.COMMENT,n))}return e},T.prototype._read_string=function(t){if("`"===t||"'"===t||'"'===t){var e=this._input.next();return this.has_char_escapes=!1,e+="`"===t?this._read_string_recursive("`",!0,"${"):this._read_string_recursive(t),this.has_char_escapes&&this._options.unescape_strings&&(e=function(t){var e="",n=0,r=new i(t),s=null;for(;r.hasNext();)if((s=r.match(/([\s]|[^\\]|\\\\)+/g))&&(e+=s[0]),"\\"===r.peek()){if(r.next(),"x"===r.peek())s=r.match(/x([0-9A-Fa-f]{2})/g);else{if("u"!==r.peek()){e+="\\",r.hasNext()&&(e+=r.next());continue}(s=r.match(/u([0-9A-Fa-f]{4})/g))||(s=r.match(/u\{([0-9A-Fa-f]+)\}/g))}if(!s)return t;if((n=parseInt(s[1],16))>126&&n<=255&&0===s[0].indexOf("x"))return t;e+=n>=0&&n<32||n>1114111?"\\"+s[0]:34===n||39===n||92===n?"\\"+String.fromCharCode(n):String.fromCharCode(n)}return e}(e)),this._input.peek()===t&&(e+=this._input.next()),e=e.replace(o.allLineBreaks,"\n"),this._create_token(c.STRING,e)}return null},T.prototype._allow_regexp_or_xml=function(t){return t.type===c.RESERVED&&h(t.text,["return","case","throw","else","do","typeof","yield"])||t.type===c.END_EXPR&&")"===t.text&&t.opened.previous.type===c.RESERVED&&h(t.opened.previous.text,["if","while","for"])||h(t.type,[c.COMMENT,c.START_EXPR,c.START_BLOCK,c.START,c.END_BLOCK,c.OPERATOR,c.EQUALS,c.EOF,c.SEMICOLON,c.COMMA])},T.prototype._read_regexp=function(t,e){if("/"===t&&this._allow_regexp_or_xml(e)){for(var n=this._input.next(),i=!1,r=!1;this._input.hasNext()&&(i||r||this._input.peek()!==t)&&!this._input.testChar(o.newline);)n+=this._input.peek(),i?i=!1:(i="\\"===this._input.peek(),"["===this._input.peek()?r=!0:"]"===this._input.peek()&&(r=!1)),this._input.next();return this._input.peek()===t&&(n+=this._input.next(),n+=this._input.read(o.identifier)),this._create_token(c.STRING,n)}return null},T.prototype._read_xml=function(t,e){if(this._options.e4x&&"<"===t&&this._allow_regexp_or_xml(e)){var n="",i=this.__patterns.xml.read_match();if(i){for(var r=i[2].replace(/^{\s+/,"{").replace(/\s+}$/,"}"),s=0===r.indexOf("{"),a=0;i;){var l=!!i[1],u=i[2];if(!(!!i[i.length-1]||"![CDATA["===u.slice(0,8))&&(u===r||s&&u.replace(/^{\s+/,"{").replace(/\s+}$/,"}"))&&(l?--a:++a),n+=i[0],a<=0)break;i=this.__patterns.xml.read_match()}return i||(n+=this._input.match(/[\s\S]*/g)[0]),n=n.replace(o.allLineBreaks,"\n"),this._create_token(c.STRING,n)}}return null},T.prototype._read_string_recursive=function(t,e,n){var i,r;"'"===t?r=this.__patterns.single_quote:'"'===t?r=this.__patterns.double_quote:"`"===t?r=this.__patterns.template_text:"}"===t&&(r=this.__patterns.template_expression);for(var s=r.read(),a="";this._input.hasNext();){if((a=this._input.next())===t||!e&&o.newline.test(a)){this._input.back();break}"\\"===a&&this._input.hasNext()?("x"===(i=this._input.peek())||"u"===i?this.has_char_escapes=!0:"\r"===i&&"\n"===this._input.peek(1)&&this._input.next(),a+=this._input.next()):n&&("${"===n&&"$"===a&&"{"===this._input.peek()&&(a+=this._input.next()),n===a&&(a+="`"===t?this._read_string_recursive("}",e,"`"):this._read_string_recursive("`",e,"${"),this._input.hasNext()&&(a+=this._input.next()))),s+=a+=r.read()}return s},t.exports.Tokenizer=T,t.exports.TOKEN=c,t.exports.positionable_operators=_.slice(),t.exports.line_starters=b.slice()},function(t){var e=RegExp.prototype.hasOwnProperty("sticky");function n(t){this.__input=t||"",this.__input_length=this.__input.length,this.__position=0}n.prototype.restart=function(){this.__position=0},n.prototype.back=function(){this.__position>0&&(this.__position-=1)},n.prototype.hasNext=function(){return this.__position<this.__input_length},n.prototype.next=function(){var t=null;return this.hasNext()&&(t=this.__input.charAt(this.__position),this.__position+=1),t},n.prototype.peek=function(t){var e=null;return t=t||0,(t+=this.__position)>=0&&t<this.__input_length&&(e=this.__input.charAt(t)),e},n.prototype.__match=function(t,n){t.lastIndex=n;var i=t.exec(this.__input);return!i||e&&t.sticky||i.index!==n&&(i=null),i},n.prototype.test=function(t,e){return e=e||0,(e+=this.__position)>=0&&e<this.__input_length&&!!this.__match(t,e)},n.prototype.testChar=function(t,e){var n=this.peek(e);return t.lastIndex=0,null!==n&&t.test(n)},n.prototype.match=function(t){var e=this.__match(t,this.__position);return e?this.__position+=e[0].length:e=null,e},n.prototype.read=function(t,e,n){var i,r="";return t&&(i=this.match(t))&&(r+=i[0]),!e||!i&&t||(r+=this.readUntil(e,n)),r},n.prototype.readUntil=function(t,e){var n,i=this.__position;t.lastIndex=this.__position;var r=t.exec(this.__input);return r?(i=r.index,e&&(i+=r[0].length)):i=this.__input_length,n=this.__input.substring(this.__position,i),this.__position=i,n},n.prototype.readUntilAfter=function(t){return this.readUntil(t,!0)},n.prototype.get_regexp=function(t,n){var i=null,r="g";return n&&e&&(r="y"),"string"==typeof t&&""!==t?i=new RegExp(t,r):t&&(i=new RegExp(t.source,r)),i},n.prototype.get_literal_regexp=function(t){return RegExp(t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},n.prototype.peekUntilAfter=function(t){var e=this.__position,n=this.readUntilAfter(t);return this.__position=e,n},n.prototype.lookBack=function(t){var e=this.__position-1;return e>=t.length&&this.__input.substring(e-t.length,e).toLowerCase()===t},t.exports.InputScanner=n},function(t,e,n){var i=n(8).InputScanner,r=n(3).Token,s=n(10).TokenStream,a=n(11).WhitespacePattern,o={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},l=function(t,e){this._input=new i(t),this._options=e||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new a(this._input)};l.prototype.tokenize=function(){var t;this._input.restart(),this.__tokens=new s,this._reset();for(var e=new r(o.START,""),n=null,i=[],a=new s;e.type!==o.EOF;){for(t=this._get_next_token(e,n);this._is_comment(t);)a.add(t),t=this._get_next_token(e,n);a.isEmpty()||(t.comments_before=a,a=new s),t.parent=n,this._is_opening(t)?(i.push(n),n=t):n&&this._is_closing(t,n)&&(t.opened=n,n.closed=t,n=i.pop(),t.parent=n),t.previous=e,e.next=t,this.__tokens.add(t),e=t}return this.__tokens},l.prototype._is_first_token=function(){return this.__tokens.isEmpty()},l.prototype._reset=function(){},l.prototype._get_next_token=function(t,e){this._readWhitespace();var n=this._input.read(/.+/g);return n?this._create_token(o.RAW,n):this._create_token(o.EOF,"")},l.prototype._is_comment=function(t){return!1},l.prototype._is_opening=function(t){return!1},l.prototype._is_closing=function(t,e){return!1},l.prototype._create_token=function(t,e){return new r(t,e,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token)},l.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},t.exports.Tokenizer=l,t.exports.TOKEN=o},function(t){function e(t){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=t}e.prototype.restart=function(){this.__position=0},e.prototype.isEmpty=function(){return 0===this.__tokens_length},e.prototype.hasNext=function(){return this.__position<this.__tokens_length},e.prototype.next=function(){var t=null;return this.hasNext()&&(t=this.__tokens[this.__position],this.__position+=1),t},e.prototype.peek=function(t){var e=null;return t=t||0,(t+=this.__position)>=0&&t<this.__tokens_length&&(e=this.__tokens[t]),e},e.prototype.add=function(t){this.__parent_token&&(t.parent=this.__parent_token),this.__tokens.push(t),this.__tokens_length+=1},t.exports.TokenStream=e},function(t,e,n){var i=n(12).Pattern;function r(t,e){i.call(this,t,e),e?this._line_regexp=this._input.get_regexp(e._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}r.prototype=new i,r.prototype.__set_whitespace_patterns=function(t,e){t+="\\t ",e+="\\n\\r",this._match_pattern=this._input.get_regexp("["+t+e+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+e+"]")},r.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var t=this._input.read(this._match_pattern);if(" "===t)this.whitespace_before_token=" ";else if(t){var e=this.__split(this._newline_regexp,t);this.newline_count=e.length-1,this.whitespace_before_token=e[this.newline_count]}return t},r.prototype.matching=function(t,e){var n=this._create();return n.__set_whitespace_patterns(t,e),n._update(),n},r.prototype._create=function(){return new r(this._input,this)},r.prototype.__split=function(t,e){t.lastIndex=0;for(var n=0,i=[],r=t.exec(e);r;)i.push(e.substring(n,r.index)),n=r.index+r[0].length,r=t.exec(e);return n<e.length?i.push(e.substring(n,e.length)):i.push(""),i},t.exports.WhitespacePattern=r},function(t){function e(t,e){this._input=t,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,e&&(this._starting_pattern=this._input.get_regexp(e._starting_pattern,!0),this._match_pattern=this._input.get_regexp(e._match_pattern,!0),this._until_pattern=this._input.get_regexp(e._until_pattern),this._until_after=e._until_after)}e.prototype.read=function(){var t=this._input.read(this._starting_pattern);return this._starting_pattern&&!t||(t+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),t},e.prototype.read_match=function(){return this._input.match(this._match_pattern)},e.prototype.until_after=function(t){var e=this._create();return e._until_after=!0,e._until_pattern=this._input.get_regexp(t),e._update(),e},e.prototype.until=function(t){var e=this._create();return e._until_after=!1,e._until_pattern=this._input.get_regexp(t),e._update(),e},e.prototype.starting_with=function(t){var e=this._create();return e._starting_pattern=this._input.get_regexp(t,!0),e._update(),e},e.prototype.matching=function(t){var e=this._create();return e._match_pattern=this._input.get_regexp(t,!0),e._update(),e},e.prototype._create=function(){return new e(this._input,this)},e.prototype._update=function(){},t.exports.Pattern=e},function(t){function e(t,e){t="string"==typeof t?t:t.source,e="string"==typeof e?e:e.source,this.__directives_block_pattern=new RegExp(t+/ beautify( \w+[:]\w+)+ /.source+e,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(t+/\sbeautify\signore:end\s/.source+e,"g")}e.prototype.get_directives=function(t){if(!t.match(this.__directives_block_pattern))return null;var e={};this.__directive_pattern.lastIndex=0;for(var n=this.__directive_pattern.exec(t);n;)e[n[1]]=n[2],n=this.__directive_pattern.exec(t);return e},e.prototype.readIgnored=function(t){return t.readUntilAfter(this.__directives_end_ignore_pattern)},t.exports.Directives=e},function(t,e,n){var i=n(12).Pattern,r={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1,angular:!1};function s(t,e){i.call(this,t,e),this.__template_pattern=null,this._disabled=Object.assign({},r),this._excluded=Object.assign({},r),e&&(this.__template_pattern=this._input.get_regexp(e.__template_pattern),this._excluded=Object.assign(this._excluded,e._excluded),this._disabled=Object.assign(this._disabled,e._disabled));var n=new i(t);this.__patterns={handlebars_comment:n.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:n.starting_with(/{{{/).until_after(/}}}/),handlebars:n.starting_with(/{{/).until_after(/}}/),php:n.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:n.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:n.starting_with(/{%/).until_after(/%}/),django_value:n.starting_with(/{{/).until_after(/}}/),django_comment:n.starting_with(/{#/).until_after(/#}/),smarty:n.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:n.starting_with(/{\*/).until_after(/\*}/),smarty_literal:n.starting_with(/{literal}/).until_after(/{\/literal}/)}}s.prototype=new i,s.prototype._create=function(){return new s(this._input,this)},s.prototype._update=function(){this.__set_templated_pattern()},s.prototype.disable=function(t){var e=this._create();return e._disabled[t]=!0,e._update(),e},s.prototype.read_options=function(t){var e=this._create();for(var n in r)e._disabled[n]=-1===t.templating.indexOf(n);return e._update(),e},s.prototype.exclude=function(t){var e=this._create();return e._excluded[t]=!0,e._update(),e},s.prototype.read=function(){var t="";t=this._match_pattern?this._input.read(this._starting_pattern):this._input.read(this._starting_pattern,this.__template_pattern);for(var e=this._read_template();e;)this._match_pattern?e+=this._input.read(this._match_pattern):e+=this._input.readUntil(this.__template_pattern),t+=e,e=this._read_template();return this._until_after&&(t+=this._input.readUntilAfter(this._until_pattern)),t},s.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("|")+")")},s.prototype._read_template=function(){var t="",e=this._input.peek();if("<"===e){var n=this._input.peek(1);this._disabled.php||this._excluded.php||"?"!==n||(t=t||this.__patterns.php.read()),this._disabled.erb||this._excluded.erb||"%"!==n||(t=t||this.__patterns.erb.read())}else"{"===e&&(this._disabled.handlebars||this._excluded.handlebars||(t=(t=(t=t||this.__patterns.handlebars_comment.read())||this.__patterns.handlebars_unescaped.read())||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=t||this.__patterns.django_comment.read())||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(t=(t=(t=t||this.__patterns.smarty_comment.read())||this.__patterns.smarty_literal.read())||this.__patterns.smarty.read()));return t},t.exports.TemplatablePattern=s}],e={};var n=function n(i){var r=e[i];if(void 0!==r)return r.exports;var s=e[i]={exports:{}};return t[i](s,s.exports,n),s.exports}(0);i=n}();var r=i;void 0===(n=function(){return{js_beautify:r}}.apply(e,[]))||(t.exports=n)}()},32834:function(t){t.exports=function(){"use strict";function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function e(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}function n(t,e){if(t){if("string"==typeof t)return i(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(t,e):void 0}}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n<e;n++)i[n]=t[n];return i}function r(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(i)return(i=i.call(t)).next.bind(i);if(Array.isArray(t)||(i=n(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s={exports:{}};function a(){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 o(t){s.exports.defaults=t}s.exports={defaults:a(),getDefaults:a,changeDefaults:o};var l=/[&<>"']/,u=/[&<>"']/g,h=/[<>"']|&(?!#?\w+;)/,c=/[<>"']|&(?!#?\w+;)/g,d={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},f=function(t){return d[t]};function p(t,e){if(e){if(l.test(t))return t.replace(u,f)}else if(h.test(t))return t.replace(c,f);return t}var g=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function _(t){return t.replace(g,(function(t,e){return"colon"===(e=e.toLowerCase())?":":"#"===e.charAt(0)?"x"===e.charAt(1)?String.fromCharCode(parseInt(e.substring(2),16)):String.fromCharCode(+e.substring(1)):""}))}var m=/(^|[^\[])\^/g;function v(t,e){t=t.source||t,e=e||"";var n={replace:function(e,i){return i=(i=i.source||i).replace(m,"$1"),t=t.replace(e,i),n},getRegex:function(){return new RegExp(t,e)}};return n}var y=/[^\w:]/g,b=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function E(t,e,n){if(t){var i;try{i=decodeURIComponent(_(n)).replace(y,"").toLowerCase()}catch(t){return null}if(0===i.indexOf("javascript:")||0===i.indexOf("vbscript:")||0===i.indexOf("data:"))return null}e&&!b.test(n)&&(n=A(e,n));try{n=encodeURI(n).replace(/%25/g,"%")}catch(t){return null}return n}var w={},T=/^[^:]+:\/*[^/]*$/,k=/^([^:]+:)[\s\S]*$/,S=/^([^:]+:\/*[^/]*)[\s\S]*$/;function A(t,e){w[" "+t]||(T.test(t)?w[" "+t]=t+"/":w[" "+t]=x(t,"/",!0));var n=-1===(t=w[" "+t]).indexOf(":");return"//"===e.substring(0,2)?n?e:t.replace(k,"$1")+e:"/"===e.charAt(0)?n?e:t.replace(S,"$1")+e:t+e}function D(t){for(var e,n,i=1;i<arguments.length;i++)for(n in e=arguments[i])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}function C(t,e){var n=t.replace(/\|/g,(function(t,e,n){for(var i=!1,r=e;--r>=0&&"\\"===n[r];)i=!i;return i?"|":" |"})).split(/ \|/),i=0;if(n.length>e)n.splice(e);else for(;n.length<e;)n.push("");for(;i<n.length;i++)n[i]=n[i].trim().replace(/\\\|/g,"|");return n}function x(t,e,n){var i=t.length;if(0===i)return"";for(var r=0;r<i;){var s=t.charAt(i-r-1);if(s!==e||n){if(s===e||!n)break;r++}else r++}return t.substr(0,i-r)}function R(t,e){if(-1===t.indexOf(e[1]))return-1;for(var n=t.length,i=0,r=0;r<n;r++)if("\\"===t[r])r++;else if(t[r]===e[0])i++;else if(t[r]===e[1]&&--i<0)return r;return-1}function L(t){t&&t.sanitize&&!t.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 I(t,e){if(e<1)return"";for(var n="";e>1;)1&e&&(n+=t),e>>=1,t+=t;return n+t}var P={escape:p,unescape:_,edit:v,cleanUrl:E,resolveUrl:A,noopTest:{exec:function(){}},merge:D,splitCells:C,rtrim:x,findClosingBracket:R,checkSanitizeDeprecation:L,repeatString:I},O=s.exports.defaults,F=P.rtrim,M=P.splitCells,N=P.escape,B=P.findClosingBracket;function U(t,e,n){var i=e.href,r=e.title?N(e.title):null,s=t[1].replace(/\\([\[\]])/g,"$1");return"!"!==t[0].charAt(0)?{type:"link",raw:n,href:i,title:r,text:s}:{type:"image",raw:n,href:i,title:r,text:N(s)}}function $(t,e){var n=t.match(/^(\s+)(?:```)/);if(null===n)return e;var i=n[1];return e.split("\n").map((function(t){var e=t.match(/^\s+/);return null===e?t:e[0].length>=i.length?t.slice(i.length):t})).join("\n")}var G=function(){function t(t){this.options=t||O}var e=t.prototype;return e.space=function(t){var e=this.rules.block.newline.exec(t);if(e)return e[0].length>1?{type:"space",raw:e[0]}:{raw:"\n"}},e.code=function(t){var e=this.rules.block.code.exec(t);if(e){var n=e[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?n:F(n,"\n")}}},e.fences=function(t){var e=this.rules.block.fences.exec(t);if(e){var n=e[0],i=$(n,e[3]||"");return{type:"code",raw:n,lang:e[2]?e[2].trim():e[2],text:i}}},e.heading=function(t){var e=this.rules.block.heading.exec(t);if(e){var n=e[2].trim();if(/#$/.test(n)){var i=F(n,"#");this.options.pedantic?n=i.trim():i&&!/ $/.test(i)||(n=i.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:n}}},e.nptable=function(t){var e=this.rules.block.nptable.exec(t);if(e){var n={type:"table",header:M(e[1].replace(/^ *| *\| *$/g,"")),align:e[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:e[3]?e[3].replace(/\n$/,"").split("\n"):[],raw:e[0]};if(n.header.length===n.align.length){var i,r=n.align.length;for(i=0;i<r;i++)/^ *-+: *$/.test(n.align[i])?n.align[i]="right":/^ *:-+: *$/.test(n.align[i])?n.align[i]="center":/^ *:-+ *$/.test(n.align[i])?n.align[i]="left":n.align[i]=null;for(r=n.cells.length,i=0;i<r;i++)n.cells[i]=M(n.cells[i],n.header.length);return n}}},e.hr=function(t){var e=this.rules.block.hr.exec(t);if(e)return{type:"hr",raw:e[0]}},e.blockquote=function(t){var e=this.rules.block.blockquote.exec(t);if(e){var n=e[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:e[0],text:n}}},e.list=function(t){var e=this.rules.block.list.exec(t);if(e){var n,i,r,s,a,o,l,u,h,c=e[0],d=e[2],f=d.length>1,p={type:"list",raw:c,ordered:f,start:f?+d.slice(0,-1):"",loose:!1,items:[]},g=e[0].match(this.rules.block.item),_=!1,m=g.length;r=this.rules.block.listItemStart.exec(g[0]);for(var v=0;v<m;v++){if(c=n=g[v],this.options.pedantic||(h=n.match(new RegExp("\\n\\s*\\n {0,"+(r[0].length-1)+"}\\S")))&&(a=n.length-h.index+g.slice(v+1).join("\n").length,p.raw=p.raw.substring(0,p.raw.length-a),c=n=n.substring(0,h.index),m=v+1),v!==m-1){if(s=this.rules.block.listItemStart.exec(g[v+1]),this.options.pedantic?s[1].length>r[1].length:s[1].length>=r[0].length||s[1].length>3){g.splice(v,2,g[v]+(!this.options.pedantic&&s[1].length<r[0].length&&!g[v].match(/\n$/)?"":"\n")+g[v+1]),v--,m--;continue}(!this.options.pedantic||this.options.smartLists?s[2][s[2].length-1]!==d[d.length-1]:f===(1===s[2].length))&&(a=g.slice(v+1).join("\n").length,p.raw=p.raw.substring(0,p.raw.length-a),v=m-1),r=s}i=n.length,~(n=n.replace(/^ *([*+-]|\d+[.)]) ?/,"")).indexOf("\n ")&&(i-=n.length,n=this.options.pedantic?n.replace(/^ {1,4}/gm,""):n.replace(new RegExp("^ {1,"+i+"}","gm"),"")),n=F(n,"\n"),v!==m-1&&(c+="\n"),o=_||/\n\n(?!\s*$)/.test(c),v!==m-1&&(_="\n\n"===c.slice(-2),o||(o=_)),o&&(p.loose=!0),this.options.gfm&&(u=void 0,(l=/^\[[ xX]\] /.test(n))&&(u=" "!==n[1],n=n.replace(/^\[[ xX]\] +/,""))),p.items.push({type:"list_item",raw:c,task:l,checked:u,loose:o,text:n})}return p}},e.html=function(t){var e=this.rules.block.html.exec(t);if(e)return{type:this.options.sanitize?"paragraph":"html",raw:e[0],pre:!this.options.sanitizer&&("pre"===e[1]||"script"===e[1]||"style"===e[1]),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(e[0]):N(e[0]):e[0]}},e.def=function(t){var e=this.rules.block.def.exec(t);if(e)return e[3]&&(e[3]=e[3].substring(1,e[3].length-1)),{type:"def",tag:e[1].toLowerCase().replace(/\s+/g," "),raw:e[0],href:e[2],title:e[3]}},e.table=function(t){var e=this.rules.block.table.exec(t);if(e){var n={type:"table",header:M(e[1].replace(/^ *| *\| *$/g,"")),align:e[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:e[3]?e[3].replace(/\n$/,"").split("\n"):[]};if(n.header.length===n.align.length){n.raw=e[0];var i,r=n.align.length;for(i=0;i<r;i++)/^ *-+: *$/.test(n.align[i])?n.align[i]="right":/^ *:-+: *$/.test(n.align[i])?n.align[i]="center":/^ *:-+ *$/.test(n.align[i])?n.align[i]="left":n.align[i]=null;for(r=n.cells.length,i=0;i<r;i++)n.cells[i]=M(n.cells[i].replace(/^ *\| *| *\| *$/g,""),n.header.length);return n}}},e.lheading=function(t){var e=this.rules.block.lheading.exec(t);if(e)return{type:"heading",raw:e[0],depth:"="===e[2].charAt(0)?1:2,text:e[1]}},e.paragraph=function(t){var e=this.rules.block.paragraph.exec(t);if(e)return{type:"paragraph",raw:e[0],text:"\n"===e[1].charAt(e[1].length-1)?e[1].slice(0,-1):e[1]}},e.text=function(t){var e=this.rules.block.text.exec(t);if(e)return{type:"text",raw:e[0],text:e[0]}},e.escape=function(t){var e=this.rules.inline.escape.exec(t);if(e)return{type:"escape",raw:e[0],text:N(e[1])}},e.tag=function(t,e,n){var i=this.rules.inline.tag.exec(t);if(i)return!e&&/^<a /i.test(i[0])?e=!0:e&&/^<\/a>/i.test(i[0])&&(e=!1),!n&&/^<(pre|code|kbd|script)(\s|>)/i.test(i[0])?n=!0:n&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(i[0])&&(n=!1),{type:this.options.sanitize?"text":"html",raw:i[0],inLink:e,inRawBlock:n,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(i[0]):N(i[0]):i[0]}},e.link=function(t){var e=this.rules.inline.link.exec(t);if(e){var n=e[2].trim();if(!this.options.pedantic&&/^</.test(n)){if(!/>$/.test(n))return;var i=F(n.slice(0,-1),"\\");if((n.length-i.length)%2==0)return}else{var r=B(e[2],"()");if(r>-1){var s=(0===e[0].indexOf("!")?5:4)+e[1].length+r;e[2]=e[2].substring(0,r),e[0]=e[0].substring(0,s).trim(),e[3]=""}}var a=e[2],o="";if(this.options.pedantic){var l=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(a);l&&(a=l[1],o=l[3])}else o=e[3]?e[3].slice(1,-1):"";return a=a.trim(),/^</.test(a)&&(a=this.options.pedantic&&!/>$/.test(n)?a.slice(1):a.slice(1,-1)),U(e,{href:a?a.replace(this.rules.inline._escapes,"$1"):a,title:o?o.replace(this.rules.inline._escapes,"$1"):o},e[0])}},e.reflink=function(t,e){var n;if((n=this.rules.inline.reflink.exec(t))||(n=this.rules.inline.nolink.exec(t))){var i=(n[2]||n[1]).replace(/\s+/g," ");if(!(i=e[i.toLowerCase()])||!i.href){var r=n[0].charAt(0);return{type:"text",raw:r,text:r}}return U(n,i,n[0])}},e.emStrong=function(t,e,n){void 0===n&&(n="");var i=this.rules.inline.emStrong.lDelim.exec(t);if(i&&(!i[3]||!n.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 r=i[1]||i[2]||"";if(!r||r&&(""===n||this.rules.inline.punctuation.exec(n))){var s,a,o=i[0].length-1,l=o,u=0,h="*"===i[0][0]?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(h.lastIndex=0,e=e.slice(-1*t.length+o);null!=(i=h.exec(e));)if(s=i[1]||i[2]||i[3]||i[4]||i[5]||i[6])if(a=s.length,i[3]||i[4])l+=a;else if(!((i[5]||i[6])&&o%3)||(o+a)%3){if(!((l-=a)>0))return a=Math.min(a,a+l+u),Math.min(o,a)%2?{type:"em",raw:t.slice(0,o+i.index+a+1),text:t.slice(1,o+i.index+a)}:{type:"strong",raw:t.slice(0,o+i.index+a+1),text:t.slice(2,o+i.index+a-1)}}else u+=a}}},e.codespan=function(t){var e=this.rules.inline.code.exec(t);if(e){var n=e[2].replace(/\n/g," "),i=/[^ ]/.test(n),r=/^ /.test(n)&&/ $/.test(n);return i&&r&&(n=n.substring(1,n.length-1)),n=N(n,!0),{type:"codespan",raw:e[0],text:n}}},e.br=function(t){var e=this.rules.inline.br.exec(t);if(e)return{type:"br",raw:e[0]}},e.del=function(t){var e=this.rules.inline.del.exec(t);if(e)return{type:"del",raw:e[0],text:e[2]}},e.autolink=function(t,e){var n,i,r=this.rules.inline.autolink.exec(t);if(r)return i="@"===r[2]?"mailto:"+(n=N(this.options.mangle?e(r[1]):r[1])):n=N(r[1]),{type:"link",raw:r[0],text:n,href:i,tokens:[{type:"text",raw:n,text:n}]}},e.url=function(t,e){var n;if(n=this.rules.inline.url.exec(t)){var i,r;if("@"===n[2])r="mailto:"+(i=N(this.options.mangle?e(n[0]):n[0]));else{var s;do{s=n[0],n[0]=this.rules.inline._backpedal.exec(n[0])[0]}while(s!==n[0]);i=N(n[0]),r="www."===n[1]?"http://"+i:i}return{type:"link",raw:n[0],text:i,href:r,tokens:[{type:"text",raw:i,text:i}]}}},e.inlineText=function(t,e,n){var i,r=this.rules.inline.text.exec(t);if(r)return i=e?this.options.sanitize?this.options.sanitizer?this.options.sanitizer(r[0]):N(r[0]):r[0]:N(this.options.smartypants?n(r[0]):r[0]),{type:"text",raw:r[0],text:i}},t}(),K=P.noopTest,j=P.edit,V=P.merge,Z={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:K,table:K,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html| +\n)[^\n]+)*)/,text:/^[^\n]+/,_label:/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,_title:/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/};Z.def=j(Z.def).replace("label",Z._label).replace("title",Z._title).getRegex(),Z.bullet=/(?:[*+-]|\d{1,9}[.)])/,Z.item=/^( *)(bull) ?[^\n]*(?:\n(?! *bull ?)[^\n]*)*/,Z.item=j(Z.item,"gm").replace(/bull/g,Z.bullet).getRegex(),Z.listItemStart=j(/^( *)(bull) */).replace("bull",Z.bullet).getRegex(),Z.list=j(Z.list).replace(/bull/g,Z.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+Z.def.source+")").getRegex(),Z._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",Z._comment=/<!--(?!-?>)[\s\S]*?(?:-->|$)/,Z.html=j(Z.html,"i").replace("comment",Z._comment).replace("tag",Z._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Z.paragraph=j(Z._paragraph).replace("hr",Z.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",Z._tag).getRegex(),Z.blockquote=j(Z.blockquote).replace("paragraph",Z.paragraph).getRegex(),Z.normal=V({},Z),Z.gfm=V({},Z.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*|$)"}),Z.gfm.nptable=j(Z.gfm.nptable).replace("hr",Z.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",Z._tag).getRegex(),Z.gfm.table=j(Z.gfm.table).replace("hr",Z.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",Z._tag).getRegex(),Z.pedantic=V({},Z.normal,{html:j("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",Z._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:K,paragraph:j(Z.normal._paragraph).replace("hr",Z.hr).replace("heading"," *#{1,6} *[^\n]").replace("lheading",Z.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var z={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:K,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:K,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,punctuation:/^([\spunctuation])/,_punctuation:"!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~"};z.punctuation=j(z.punctuation).replace(/punctuation/g,z._punctuation).getRegex(),z.blockSkip=/\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g,z.escapedEmSt=/\\\*|\\_/g,z._comment=j(Z._comment).replace("(?:--\x3e|$)","--\x3e").getRegex(),z.emStrong.lDelim=j(z.emStrong.lDelim).replace(/punct/g,z._punctuation).getRegex(),z.emStrong.rDelimAst=j(z.emStrong.rDelimAst,"g").replace(/punct/g,z._punctuation).getRegex(),z.emStrong.rDelimUnd=j(z.emStrong.rDelimUnd,"g").replace(/punct/g,z._punctuation).getRegex(),z._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,z._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,z._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])?)+(?![-_])/,z.autolink=j(z.autolink).replace("scheme",z._scheme).replace("email",z._email).getRegex(),z._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,z.tag=j(z.tag).replace("comment",z._comment).replace("attribute",z._attribute).getRegex(),z._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,z._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/,z._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,z.link=j(z.link).replace("label",z._label).replace("href",z._href).replace("title",z._title).getRegex(),z.reflink=j(z.reflink).replace("label",z._label).getRegex(),z.reflinkSearch=j(z.reflinkSearch,"g").replace("reflink",z.reflink).replace("nolink",z.nolink).getRegex(),z.normal=V({},z),z.pedantic=V({},z.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:j(/^!?\[(label)\]\((.*?)\)/).replace("label",z._label).getRegex(),reflink:j(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",z._label).getRegex()}),z.gfm=V({},z.normal,{escape:j(z.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.!#$%&'*+\/=?_`{\|}~-]+@)))/}),z.gfm.url=j(z.gfm.url,"i").replace("email",z.gfm._extended_email).getRegex(),z.breaks=V({},z.gfm,{br:j(z.br).replace("{2,}","*").getRegex(),text:j(z.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var H={block:Z,inline:z},W=G,Y=s.exports.defaults,q=H.block,Q=H.inline,X=P.repeatString;function J(t){return t.replace(/---/g,"—").replace(/--/g,"").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1").replace(/'/g,"").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…")}function tt(t){var e,n,i="",r=t.length;for(e=0;e<r;e++)n=t.charCodeAt(e),Math.random()>.5&&(n="x"+n.toString(16)),i+="&#"+n+";";return i}var et=function(){function t(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||Y,this.options.tokenizer=this.options.tokenizer||new W,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var e={block:q.normal,inline:Q.normal};this.options.pedantic?(e.block=q.pedantic,e.inline=Q.pedantic):this.options.gfm&&(e.block=q.gfm,this.options.breaks?e.inline=Q.breaks:e.inline=Q.gfm),this.tokenizer.rules=e}t.lex=function(e,n){return new t(n).lex(e)},t.lexInline=function(e,n){return new t(n).inlineTokens(e)};var n=t.prototype;return n.lex=function(t){return t=t.replace(/\r\n|\r/g,"\n").replace(/\t/g," "),this.blockTokens(t,this.tokens,!0),this.inline(this.tokens),this.tokens},n.blockTokens=function(t,e,n){var i,r,s,a;for(void 0===e&&(e=[]),void 0===n&&(n=!0),this.options.pedantic&&(t=t.replace(/^ +$/gm,""));t;)if(i=this.tokenizer.space(t))t=t.substring(i.raw.length),i.type&&e.push(i);else if(i=this.tokenizer.code(t))t=t.substring(i.raw.length),(a=e[e.length-1])&&"paragraph"===a.type?(a.raw+="\n"+i.raw,a.text+="\n"+i.text):e.push(i);else if(i=this.tokenizer.fences(t))t=t.substring(i.raw.length),e.push(i);else if(i=this.tokenizer.heading(t))t=t.substring(i.raw.length),e.push(i);else if(i=this.tokenizer.nptable(t))t=t.substring(i.raw.length),e.push(i);else if(i=this.tokenizer.hr(t))t=t.substring(i.raw.length),e.push(i);else if(i=this.tokenizer.blockquote(t))t=t.substring(i.raw.length),i.tokens=this.blockTokens(i.text,[],n),e.push(i);else if(i=this.tokenizer.list(t)){for(t=t.substring(i.raw.length),s=i.items.length,r=0;r<s;r++)i.items[r].tokens=this.blockTokens(i.items[r].text,[],!1);e.push(i)}else if(i=this.tokenizer.html(t))t=t.substring(i.raw.length),e.push(i);else if(n&&(i=this.tokenizer.def(t)))t=t.substring(i.raw.length),this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title});else if(i=this.tokenizer.table(t))t=t.substring(i.raw.length),e.push(i);else if(i=this.tokenizer.lheading(t))t=t.substring(i.raw.length),e.push(i);else if(n&&(i=this.tokenizer.paragraph(t)))t=t.substring(i.raw.length),e.push(i);else if(i=this.tokenizer.text(t))t=t.substring(i.raw.length),(a=e[e.length-1])&&"text"===a.type?(a.raw+="\n"+i.raw,a.text+="\n"+i.text):e.push(i);else if(t){var o="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(o);break}throw new Error(o)}return e},n.inline=function(t){var e,n,i,r,s,a,o=t.length;for(e=0;e<o;e++)switch((a=t[e]).type){case"paragraph":case"text":case"heading":a.tokens=[],this.inlineTokens(a.text,a.tokens);break;case"table":for(a.tokens={header:[],cells:[]},r=a.header.length,n=0;n<r;n++)a.tokens.header[n]=[],this.inlineTokens(a.header[n],a.tokens.header[n]);for(r=a.cells.length,n=0;n<r;n++)for(s=a.cells[n],a.tokens.cells[n]=[],i=0;i<s.length;i++)a.tokens.cells[n][i]=[],this.inlineTokens(s[i],a.tokens.cells[n][i]);break;case"blockquote":this.inline(a.tokens);break;case"list":for(r=a.items.length,n=0;n<r;n++)this.inline(a.items[n].tokens)}return t},n.inlineTokens=function(t,e,n,i){var r,s;void 0===e&&(e=[]),void 0===n&&(n=!1),void 0===i&&(i=!1);var a,o,l,u=t;if(this.tokens.links){var h=Object.keys(this.tokens.links);if(h.length>0)for(;null!=(a=this.tokenizer.rules.inline.reflinkSearch.exec(u));)h.includes(a[0].slice(a[0].lastIndexOf("[")+1,-1))&&(u=u.slice(0,a.index)+"["+X("a",a[0].length-2)+"]"+u.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(a=this.tokenizer.rules.inline.blockSkip.exec(u));)u=u.slice(0,a.index)+"["+X("a",a[0].length-2)+"]"+u.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;null!=(a=this.tokenizer.rules.inline.escapedEmSt.exec(u));)u=u.slice(0,a.index)+"++"+u.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex);for(;t;)if(o||(l=""),o=!1,r=this.tokenizer.escape(t))t=t.substring(r.raw.length),e.push(r);else if(r=this.tokenizer.tag(t,n,i)){t=t.substring(r.raw.length),n=r.inLink,i=r.inRawBlock;var c=e[e.length-1];c&&"text"===r.type&&"text"===c.type?(c.raw+=r.raw,c.text+=r.text):e.push(r)}else if(r=this.tokenizer.link(t))t=t.substring(r.raw.length),"link"===r.type&&(r.tokens=this.inlineTokens(r.text,[],!0,i)),e.push(r);else if(r=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(r.raw.length);var d=e[e.length-1];"link"===r.type?(r.tokens=this.inlineTokens(r.text,[],!0,i),e.push(r)):d&&"text"===r.type&&"text"===d.type?(d.raw+=r.raw,d.text+=r.text):e.push(r)}else if(r=this.tokenizer.emStrong(t,u,l))t=t.substring(r.raw.length),r.tokens=this.inlineTokens(r.text,[],n,i),e.push(r);else if(r=this.tokenizer.codespan(t))t=t.substring(r.raw.length),e.push(r);else if(r=this.tokenizer.br(t))t=t.substring(r.raw.length),e.push(r);else if(r=this.tokenizer.del(t))t=t.substring(r.raw.length),r.tokens=this.inlineTokens(r.text,[],n,i),e.push(r);else if(r=this.tokenizer.autolink(t,tt))t=t.substring(r.raw.length),e.push(r);else if(n||!(r=this.tokenizer.url(t,tt))){if(r=this.tokenizer.inlineText(t,i,J))t=t.substring(r.raw.length),"_"!==r.raw.slice(-1)&&(l=r.raw.slice(-1)),o=!0,(s=e[e.length-1])&&"text"===s.type?(s.raw+=r.raw,s.text+=r.text):e.push(r);else if(t){var f="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(f);break}throw new Error(f)}}else t=t.substring(r.raw.length),e.push(r);return e},e(t,null,[{key:"rules",get:function(){return{block:q,inline:Q}}}]),t}(),nt=s.exports.defaults,it=P.cleanUrl,rt=P.escape,st=function(){function t(t){this.options=t||nt}var e=t.prototype;return e.code=function(t,e,n){var i=(e||"").match(/\S*/)[0];if(this.options.highlight){var r=this.options.highlight(t,i);null!=r&&r!==t&&(n=!0,t=r)}return t=t.replace(/\n$/,"")+"\n",i?'<pre><code class="'+this.options.langPrefix+rt(i,!0)+'">'+(n?t:rt(t,!0))+"</code></pre>\n":"<pre><code>"+(n?t:rt(t,!0))+"</code></pre>\n"},e.blockquote=function(t){return"<blockquote>\n"+t+"</blockquote>\n"},e.html=function(t){return t},e.heading=function(t,e,n,i){return this.options.headerIds?"<h"+e+' id="'+this.options.headerPrefix+i.slug(n)+'">'+t+"</h"+e+">\n":"<h"+e+">"+t+"</h"+e+">\n"},e.hr=function(){return this.options.xhtml?"<hr/>\n":"<hr>\n"},e.list=function(t,e,n){var i=e?"ol":"ul";return"<"+i+(e&&1!==n?' start="'+n+'"':"")+">\n"+t+"</"+i+">\n"},e.listitem=function(t){return"<li>"+t+"</li>\n"},e.checkbox=function(t){return"<input "+(t?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},e.paragraph=function(t){return"<p>"+t+"</p>\n"},e.table=function(t,e){return e&&(e="<tbody>"+e+"</tbody>"),"<table>\n<thead>\n"+t+"</thead>\n"+e+"</table>\n"},e.tablerow=function(t){return"<tr>\n"+t+"</tr>\n"},e.tablecell=function(t,e){var n=e.header?"th":"td";return(e.align?"<"+n+' align="'+e.align+'">':"<"+n+">")+t+"</"+n+">\n"},e.strong=function(t){return"<strong>"+t+"</strong>"},e.em=function(t){return"<em>"+t+"</em>"},e.codespan=function(t){return"<code>"+t+"</code>"},e.br=function(){return this.options.xhtml?"<br/>":"<br>"},e.del=function(t){return"<del>"+t+"</del>"},e.link=function(t,e,n){if(null===(t=it(this.options.sanitize,this.options.baseUrl,t)))return n;var i='<a href="'+rt(t)+'"';return e&&(i+=' title="'+e+'"'),i+=">"+n+"</a>"},e.image=function(t,e,n){if(null===(t=it(this.options.sanitize,this.options.baseUrl,t)))return n;var i='<img src="'+t+'" alt="'+n+'"';return e&&(i+=' title="'+e+'"'),i+=this.options.xhtml?"/>":">"},e.text=function(t){return t},t}(),at=function(){function t(){}var e=t.prototype;return e.strong=function(t){return t},e.em=function(t){return t},e.codespan=function(t){return t},e.del=function(t){return t},e.html=function(t){return t},e.text=function(t){return t},e.link=function(t,e,n){return""+n},e.image=function(t,e,n){return""+n},e.br=function(){return""},t}(),ot=function(){function t(){this.seen={}}var e=t.prototype;return e.serialize=function(t){return t.toLowerCase().trim().replace(/<[!\/a-z].*?>/gi,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-")},e.getNextSafeSlug=function(t,e){var n=t,i=0;if(this.seen.hasOwnProperty(n)){i=this.seen[t];do{n=t+"-"+ ++i}while(this.seen.hasOwnProperty(n))}return e||(this.seen[t]=i,this.seen[n]=0),n},e.slug=function(t,e){void 0===e&&(e={});var n=this.serialize(t);return this.getNextSafeSlug(n,e.dryrun)},t}(),lt=st,ut=at,ht=ot,ct=s.exports.defaults,dt=P.unescape,ft=et,pt=function(){function t(t){this.options=t||ct,this.options.renderer=this.options.renderer||new lt,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new ut,this.slugger=new ht}t.parse=function(e,n){return new t(n).parse(e)},t.parseInline=function(e,n){return new t(n).parseInline(e)};var e=t.prototype;return e.parse=function(t,e){void 0===e&&(e=!0);var n,i,r,s,a,o,l,u,h,c,d,f,p,g,_,m,v,y,b="",E=t.length;for(n=0;n<E;n++)switch((c=t[n]).type){case"space":continue;case"hr":b+=this.renderer.hr();continue;case"heading":b+=this.renderer.heading(this.parseInline(c.tokens),c.depth,dt(this.parseInline(c.tokens,this.textRenderer)),this.slugger);continue;case"code":b+=this.renderer.code(c.text,c.lang,c.escaped);continue;case"table":for(u="",l="",s=c.header.length,i=0;i<s;i++)l+=this.renderer.tablecell(this.parseInline(c.tokens.header[i]),{header:!0,align:c.align[i]});for(u+=this.renderer.tablerow(l),h="",s=c.cells.length,i=0;i<s;i++){for(l="",a=(o=c.tokens.cells[i]).length,r=0;r<a;r++)l+=this.renderer.tablecell(this.parseInline(o[r]),{header:!1,align:c.align[r]});h+=this.renderer.tablerow(l)}b+=this.renderer.table(u,h);continue;case"blockquote":h=this.parse(c.tokens),b+=this.renderer.blockquote(h);continue;case"list":for(d=c.ordered,f=c.start,p=c.loose,s=c.items.length,h="",i=0;i<s;i++)m=(_=c.items[i]).checked,v=_.task,g="",_.task&&(y=this.renderer.checkbox(m),p?_.tokens.length>0&&"text"===_.tokens[0].type?(_.tokens[0].text=y+" "+_.tokens[0].text,_.tokens[0].tokens&&_.tokens[0].tokens.length>0&&"text"===_.tokens[0].tokens[0].type&&(_.tokens[0].tokens[0].text=y+" "+_.tokens[0].tokens[0].text)):_.tokens.unshift({type:"text",text:y}):g+=y),g+=this.parse(_.tokens,p),h+=this.renderer.listitem(g,v,m);b+=this.renderer.list(h,d,f);continue;case"html":b+=this.renderer.html(c.text);continue;case"paragraph":b+=this.renderer.paragraph(this.parseInline(c.tokens));continue;case"text":for(h=c.tokens?this.parseInline(c.tokens):c.text;n+1<E&&"text"===t[n+1].type;)h+="\n"+((c=t[++n]).tokens?this.parseInline(c.tokens):c.text);b+=e?this.renderer.paragraph(h):h;continue;default:var w='Token with "'+c.type+'" type was not found.';if(this.options.silent)return void console.error(w);throw new Error(w)}return b},e.parseInline=function(t,e){e=e||this.renderer;var n,i,r="",s=t.length;for(n=0;n<s;n++)switch((i=t[n]).type){case"escape":case"text":r+=e.text(i.text);break;case"html":r+=e.html(i.text);break;case"link":r+=e.link(i.href,i.title,this.parseInline(i.tokens,e));break;case"image":r+=e.image(i.href,i.title,i.text);break;case"strong":r+=e.strong(this.parseInline(i.tokens,e));break;case"em":r+=e.em(this.parseInline(i.tokens,e));break;case"codespan":r+=e.codespan(i.text);break;case"br":r+=e.br();break;case"del":r+=e.del(this.parseInline(i.tokens,e));break;default:var a='Token with "'+i.type+'" type was not found.';if(this.options.silent)return void console.error(a);throw new Error(a)}return r},t}(),gt=G,_t=st,mt=at,vt=ot,yt=P.merge,bt=P.checkSanitizeDeprecation,Et=P.escape,wt=s.exports.getDefaults,Tt=s.exports.changeDefaults,kt=s.exports.defaults;function St(t,e,n){if(null==t)throw new Error("marked(): input parameter is undefined or null");if("string"!=typeof t)throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected");if("function"==typeof e&&(n=e,e=null),e=yt({},St.defaults,e||{}),bt(e),n){var i,r=e.highlight;try{i=ft.lex(t,e)}catch(t){return n(t)}var s=function(t){var s;if(!t)try{e.walkTokens&&St.walkTokens(i,e.walkTokens),s=pt.parse(i,e)}catch(e){t=e}return e.highlight=r,t?n(t):n(null,s)};if(!r||r.length<3)return s();if(delete e.highlight,!i.length)return s();var a=0;return St.walkTokens(i,(function(t){"code"===t.type&&(a++,setTimeout((function(){r(t.text,t.lang,(function(e,n){if(e)return s(e);null!=n&&n!==t.text&&(t.text=n,t.escaped=!0),0==--a&&s()}))}),0))})),void(0===a&&s())}try{var o=ft.lex(t,e);return e.walkTokens&&St.walkTokens(o,e.walkTokens),pt.parse(o,e)}catch(t){if(t.message+="\nPlease report this to https://github.com/markedjs/marked.",e.silent)return"<p>An error occurred:</p><pre>"+Et(t.message+"",!0)+"</pre>";throw t}}return St.options=St.setOptions=function(t){return yt(St.defaults,t),Tt(St.defaults),St},St.getDefaults=wt,St.defaults=kt,St.use=function(t){var e=yt({},t);if(t.renderer&&function(){var n=St.defaults.renderer||new _t,i=function(e){var i=n[e];n[e]=function(){for(var r=arguments.length,s=new Array(r),a=0;a<r;a++)s[a]=arguments[a];var o=t.renderer[e].apply(n,s);return!1===o&&(o=i.apply(n,s)),o}};for(var r in t.renderer)i(r);e.renderer=n}(),t.tokenizer&&function(){var n=St.defaults.tokenizer||new gt,i=function(e){var i=n[e];n[e]=function(){for(var r=arguments.length,s=new Array(r),a=0;a<r;a++)s[a]=arguments[a];var o=t.tokenizer[e].apply(n,s);return!1===o&&(o=i.apply(n,s)),o}};for(var r in t.tokenizer)i(r);e.tokenizer=n}(),t.walkTokens){var n=St.defaults.walkTokens;e.walkTokens=function(e){t.walkTokens(e),n&&n(e)}}St.setOptions(e)},St.walkTokens=function(t,e){for(var n,i=r(t);!(n=i()).done;){var s=n.value;switch(e(s),s.type){case"table":for(var a,o=r(s.tokens.header);!(a=o()).done;){var l=a.value;St.walkTokens(l,e)}for(var u,h=r(s.tokens.cells);!(u=h()).done;)for(var c,d=r(u.value);!(c=d()).done;){var f=c.value;St.walkTokens(f,e)}break;case"list":St.walkTokens(s.items,e);break;default:s.tokens&&St.walkTokens(s.tokens,e)}}},St.parseInline=function(t,e){if(null==t)throw new Error("marked.parseInline(): input parameter is undefined or null");if("string"!=typeof t)throw new Error("marked.parseInline(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected");e=yt({},St.defaults,e||{}),bt(e);try{var n=ft.lexInline(t,e);return e.walkTokens&&St.walkTokens(n,e.walkTokens),pt.parseInline(n,e)}catch(t){if(t.message+="\nPlease report this to https://github.com/markedjs/marked.",e.silent)return"<p>An error occurred:</p><pre>"+Et(t.message+"",!0)+"</pre>";throw t}},St.Parser=pt,St.parser=pt.parse,St.Renderer=_t,St.TextRenderer=mt,St.Lexer=ft,St.lexer=ft.lex,St.Tokenizer=gt,St.Slugger=vt,St.parse=St,St}()},11690:function(t){const e=/[&<>"']/,n=/[&<>"']/g,i=/[<>"']|&(?!#?\w+;)/,r=/[<>"']|&(?!#?\w+;)/g,s={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},a=t=>s[t];const o=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function l(t){return t.replace(o,((t,e)=>"colon"===(e=e.toLowerCase())?":":"#"===e.charAt(0)?"x"===e.charAt(1)?String.fromCharCode(parseInt(e.substring(2),16)):String.fromCharCode(+e.substring(1)):""))}const u=/(^|[^\[])\^/g;const h=/[^\w:]/g,c=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;const d={},f=/^[^:]+:\/*[^/]*$/,p=/^([^:]+:)[\s\S]*$/,g=/^([^:]+:\/*[^/]*)[\s\S]*$/;function _(t,e){d[" "+t]||(f.test(t)?d[" "+t]=t+"/":d[" "+t]=m(t,"/",!0));const n=-1===(t=d[" "+t]).indexOf(":");return"//"===e.substring(0,2)?n?e:t.replace(p,"$1")+e:"/"===e.charAt(0)?n?e:t.replace(g,"$1")+e:t+e}function m(t,e,n){const i=t.length;if(0===i)return"";let r=0;for(;r<i;){const s=t.charAt(i-r-1);if(s!==e||n){if(s===e||!n)break;r++}else r++}return t.substr(0,i-r)}t.exports={escape:function(t,s){if(s){if(e.test(t))return t.replace(n,a)}else if(i.test(t))return t.replace(r,a);return t},unescape:l,edit:function(t,e){t=t.source||t,e=e||"";const n={replace:(e,i)=>(i=(i=i.source||i).replace(u,"$1"),t=t.replace(e,i),n),getRegex:()=>new RegExp(t,e)};return n},cleanUrl:function(t,e,n){if(t){let t;try{t=decodeURIComponent(l(n)).replace(h,"").toLowerCase()}catch(t){return null}if(0===t.indexOf("javascript:")||0===t.indexOf("vbscript:")||0===t.indexOf("data:"))return null}e&&!c.test(n)&&(n=_(e,n));try{n=encodeURI(n).replace(/%25/g,"%")}catch(t){return null}return n},resolveUrl:_,noopTest:{exec:function(){}},merge:function(t){let e,n,i=1;for(;i<arguments.length;i++)for(n in e=arguments[i],e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t},splitCells:function(t,e){const n=t.replace(/\|/g,((t,e,n)=>{let i=!1,r=e;for(;--r>=0&&"\\"===n[r];)i=!i;return i?"|":" |"})).split(/ \|/);let i=0;if(n.length>e)n.splice(e);else for(;n.length<e;)n.push("");for(;i<n.length;i++)n[i]=n[i].trim().replace(/\\\|/g,"|");return n},rtrim:m,findClosingBracket:function(t,e){if(-1===t.indexOf(e[1]))return-1;const n=t.length;let i=0,r=0;for(;r<n;r++)if("\\"===t[r])r++;else if(t[r]===e[0])i++;else if(t[r]===e[1]&&(i--,i<0))return r;return-1},checkSanitizeDeprecation:function(t){t&&t.sanitize&&!t.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")},repeatString:function(t,e){if(e<1)return"";let n="";for(;e>1;)1&e&&(n+=t),e>>=1,t+=t;return n+t}}},75918:function(t,e,n){"use strict";n.d(e,{Wi:function(){return l},Z0:function(){return u},aU:function(){return o},eZ:function(){return c},wY:function(){return h}});var i=n(4348),r=n(69323),s=n(13268),a=function(t,e,n,i){return new(n||(n=Promise))((function(r,s){function a(t){try{l(i.next(t))}catch(t){s(t)}}function o(t){try{l(i.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,o)}l((i=i.apply(t,e||[])).next())}))};class o extends r.JT{constructor(t,e="",n="",r=!0,s){super(),this._onDidChange=this._register(new i.Q5),this.onDidChange=this._onDidChange.event,this._enabled=!0,this._id=t,this._label=e,this._cssClass=n,this._enabled=r,this._actionCallback=s}get id(){return this._id}get label(){return this._label}set label(t){this._setLabel(t)}_setLabel(t){this._label!==t&&(this._label=t,this._onDidChange.fire({label:t}))}get tooltip(){return this._tooltip||""}set tooltip(t){this._setTooltip(t)}_setTooltip(t){this._tooltip!==t&&(this._tooltip=t,this._onDidChange.fire({tooltip:t}))}get class(){return this._cssClass}set class(t){this._setClass(t)}_setClass(t){this._cssClass!==t&&(this._cssClass=t,this._onDidChange.fire({class:t}))}get enabled(){return this._enabled}set enabled(t){this._setEnabled(t)}_setEnabled(t){this._enabled!==t&&(this._enabled=t,this._onDidChange.fire({enabled:t}))}get checked(){return this._checked}set checked(t){this._setChecked(t)}_setChecked(t){this._checked!==t&&(this._checked=t,this._onDidChange.fire({checked:t}))}run(t,e){return a(this,void 0,void 0,(function*(){this._actionCallback&&(yield this._actionCallback(t))}))}}class l extends r.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(t,e){return a(this,void 0,void 0,(function*(){if(!t.enabled)return;let n;this._onBeforeRun.fire({action:t});try{yield this.runAction(t,e)}catch(t){n=t}this._onDidRun.fire({action:t,error:n})}))}runAction(t,e){return a(this,void 0,void 0,(function*(){yield t.run(e)}))}}class u extends o{constructor(t){super(u.ID,t,t?"separator text":"separator"),this.checked=!1,this.enabled=!1}}u.ID="vs.actions.separator";class h{constructor(t,e,n,i){this.tooltip="",this.enabled=!0,this.checked=!1,this.id=t,this.label=e,this.class=i,this._actions=n}get actions(){return this._actions}dispose(){}run(){return a(this,void 0,void 0,(function*(){}))}}class c extends o{constructor(){super(c.ID,s.N("submenu.empty","(empty)"),void 0,!1)}}c.ID="vs.actions.empty"},76068:function(t,e,n){"use strict";function i(t,e){if(!t)throw new Error(e?`Assertion failed (${e})`:"Assertion Failed")}n.d(e,{ok:function(){return i}})},52615:function(t,e,n){"use strict";n.d(e,{CM:function(){return a},JL:function(){return o},dT:function(){return u},fK:function(){return s},lA:function(){return l}});var i=n(4348);const r=new class{constructor(){this._icons=new Map,this._onDidRegister=new i.Q5}add(t){const e=this._icons.get(t.id);e?t.description?e.description=t.description:console.error(`Duplicate registration of codicon ${t.id}`):(this._icons.set(t.id,t),this._onDidRegister.fire(t))}get(t){return this._icons.get(t)}get all(){return this._icons.values()}get onDidRegister(){return this._onDidRegister.event}},s=r;function a(t,e){return new l(t,e)}function o(t){return t?t.replace(/\$\((.*?)\)/g,((t,e)=>` ${e} `)).trim():""}class l{constructor(t,e,n){this.id=t,this.definition=e,this.description=n,r.add(this)}get classNames(){return"codicon codicon-"+this.id}get classNamesArray(){return["codicon","codicon-"+this.id]}get cssSelector(){return".codicon.codicon-"+this.id}}var u;!function(t){t.iconNameSegment="[A-Za-z0-9]+",t.iconNameExpression="[A-Za-z0-9\\-]+",t.iconModifierExpression="~[A-Za-z]+";const e=new RegExp(`^(${t.iconNameExpression})(${t.iconModifierExpression})?$`);function n(t){if(t instanceof l)return["codicon","codicon-"+t.id];const i=e.exec(t.id);if(!i)return n(l.error);let[,r,s]=i;const a=["codicon","codicon-"+r];return s&&a.push("codicon-modifier-"+s.substr(1)),a}t.asClassNameArray=n,t.asClassName=function(t){return n(t).join(" ")},t.asCSSSelector=function(t){return"."+n(t).join(".")}}(u||(u={})),function(t){t.add=new t("add",{fontCharacter:"\\ea60"}),t.plus=new t("plus",t.add.definition),t.gistNew=new t("gist-new",t.add.definition),t.repoCreate=new t("repo-create",t.add.definition),t.lightbulb=new t("lightbulb",{fontCharacter:"\\ea61"}),t.lightBulb=new t("light-bulb",{fontCharacter:"\\ea61"}),t.repo=new t("repo",{fontCharacter:"\\ea62"}),t.repoDelete=new t("repo-delete",{fontCharacter:"\\ea62"}),t.gistFork=new t("gist-fork",{fontCharacter:"\\ea63"}),t.repoForked=new t("repo-forked",{fontCharacter:"\\ea63"}),t.gitPullRequest=new t("git-pull-request",{fontCharacter:"\\ea64"}),t.gitPullRequestAbandoned=new t("git-pull-request-abandoned",{fontCharacter:"\\ea64"}),t.recordKeys=new t("record-keys",{fontCharacter:"\\ea65"}),t.keyboard=new t("keyboard",{fontCharacter:"\\ea65"}),t.tag=new t("tag",{fontCharacter:"\\ea66"}),t.tagAdd=new t("tag-add",{fontCharacter:"\\ea66"}),t.tagRemove=new t("tag-remove",{fontCharacter:"\\ea66"}),t.person=new t("person",{fontCharacter:"\\ea67"}),t.personFollow=new t("person-follow",{fontCharacter:"\\ea67"}),t.personOutline=new t("person-outline",{fontCharacter:"\\ea67"}),t.personFilled=new t("person-filled",{fontCharacter:"\\ea67"}),t.gitBranch=new t("git-branch",{fontCharacter:"\\ea68"}),t.gitBranchCreate=new t("git-branch-create",{fontCharacter:"\\ea68"}),t.gitBranchDelete=new t("git-branch-delete",{fontCharacter:"\\ea68"}),t.sourceControl=new t("source-control",{fontCharacter:"\\ea68"}),t.mirror=new t("mirror",{fontCharacter:"\\ea69"}),t.mirrorPublic=new t("mirror-public",{fontCharacter:"\\ea69"}),t.star=new t("star",{fontCharacter:"\\ea6a"}),t.starAdd=new t("star-add",{fontCharacter:"\\ea6a"}),t.starDelete=new t("star-delete",{fontCharacter:"\\ea6a"}),t.starEmpty=new t("star-empty",{fontCharacter:"\\ea6a"}),t.comment=new t("comment",{fontCharacter:"\\ea6b"}),t.commentAdd=new t("comment-add",{fontCharacter:"\\ea6b"}),t.alert=new t("alert",{fontCharacter:"\\ea6c"}),t.warning=new t("warning",{fontCharacter:"\\ea6c"}),t.search=new t("search",{fontCharacter:"\\ea6d"}),t.searchSave=new t("search-save",{fontCharacter:"\\ea6d"}),t.logOut=new t("log-out",{fontCharacter:"\\ea6e"}),t.signOut=new t("sign-out",{fontCharacter:"\\ea6e"}),t.logIn=new t("log-in",{fontCharacter:"\\ea6f"}),t.signIn=new t("sign-in",{fontCharacter:"\\ea6f"}),t.eye=new t("eye",{fontCharacter:"\\ea70"}),t.eyeUnwatch=new t("eye-unwatch",{fontCharacter:"\\ea70"}),t.eyeWatch=new t("eye-watch",{fontCharacter:"\\ea70"}),t.circleFilled=new t("circle-filled",{fontCharacter:"\\ea71"}),t.primitiveDot=new t("primitive-dot",{fontCharacter:"\\ea71"}),t.closeDirty=new t("close-dirty",{fontCharacter:"\\ea71"}),t.debugBreakpoint=new t("debug-breakpoint",{fontCharacter:"\\ea71"}),t.debugBreakpointDisabled=new t("debug-breakpoint-disabled",{fontCharacter:"\\ea71"}),t.debugHint=new t("debug-hint",{fontCharacter:"\\ea71"}),t.primitiveSquare=new t("primitive-square",{fontCharacter:"\\ea72"}),t.edit=new t("edit",{fontCharacter:"\\ea73"}),t.pencil=new t("pencil",{fontCharacter:"\\ea73"}),t.info=new t("info",{fontCharacter:"\\ea74"}),t.issueOpened=new t("issue-opened",{fontCharacter:"\\ea74"}),t.gistPrivate=new t("gist-private",{fontCharacter:"\\ea75"}),t.gitForkPrivate=new t("git-fork-private",{fontCharacter:"\\ea75"}),t.lock=new t("lock",{fontCharacter:"\\ea75"}),t.mirrorPrivate=new t("mirror-private",{fontCharacter:"\\ea75"}),t.close=new t("close",{fontCharacter:"\\ea76"}),t.removeClose=new t("remove-close",{fontCharacter:"\\ea76"}),t.x=new t("x",{fontCharacter:"\\ea76"}),t.repoSync=new t("repo-sync",{fontCharacter:"\\ea77"}),t.sync=new t("sync",{fontCharacter:"\\ea77"}),t.clone=new t("clone",{fontCharacter:"\\ea78"}),t.desktopDownload=new t("desktop-download",{fontCharacter:"\\ea78"}),t.beaker=new t("beaker",{fontCharacter:"\\ea79"}),t.microscope=new t("microscope",{fontCharacter:"\\ea79"}),t.vm=new t("vm",{fontCharacter:"\\ea7a"}),t.deviceDesktop=new t("device-desktop",{fontCharacter:"\\ea7a"}),t.file=new t("file",{fontCharacter:"\\ea7b"}),t.fileText=new t("file-text",{fontCharacter:"\\ea7b"}),t.more=new t("more",{fontCharacter:"\\ea7c"}),t.ellipsis=new t("ellipsis",{fontCharacter:"\\ea7c"}),t.kebabHorizontal=new t("kebab-horizontal",{fontCharacter:"\\ea7c"}),t.mailReply=new t("mail-reply",{fontCharacter:"\\ea7d"}),t.reply=new t("reply",{fontCharacter:"\\ea7d"}),t.organization=new t("organization",{fontCharacter:"\\ea7e"}),t.organizationFilled=new t("organization-filled",{fontCharacter:"\\ea7e"}),t.organizationOutline=new t("organization-outline",{fontCharacter:"\\ea7e"}),t.newFile=new t("new-file",{fontCharacter:"\\ea7f"}),t.fileAdd=new t("file-add",{fontCharacter:"\\ea7f"}),t.newFolder=new t("new-folder",{fontCharacter:"\\ea80"}),t.fileDirectoryCreate=new t("file-directory-create",{fontCharacter:"\\ea80"}),t.trash=new t("trash",{fontCharacter:"\\ea81"}),t.trashcan=new t("trashcan",{fontCharacter:"\\ea81"}),t.history=new t("history",{fontCharacter:"\\ea82"}),t.clock=new t("clock",{fontCharacter:"\\ea82"}),t.folder=new t("folder",{fontCharacter:"\\ea83"}),t.fileDirectory=new t("file-directory",{fontCharacter:"\\ea83"}),t.symbolFolder=new t("symbol-folder",{fontCharacter:"\\ea83"}),t.logoGithub=new t("logo-github",{fontCharacter:"\\ea84"}),t.markGithub=new t("mark-github",{fontCharacter:"\\ea84"}),t.github=new t("github",{fontCharacter:"\\ea84"}),t.terminal=new t("terminal",{fontCharacter:"\\ea85"}),t.console=new t("console",{fontCharacter:"\\ea85"}),t.repl=new t("repl",{fontCharacter:"\\ea85"}),t.zap=new t("zap",{fontCharacter:"\\ea86"}),t.symbolEvent=new t("symbol-event",{fontCharacter:"\\ea86"}),t.error=new t("error",{fontCharacter:"\\ea87"}),t.stop=new t("stop",{fontCharacter:"\\ea87"}),t.variable=new t("variable",{fontCharacter:"\\ea88"}),t.symbolVariable=new t("symbol-variable",{fontCharacter:"\\ea88"}),t.array=new t("array",{fontCharacter:"\\ea8a"}),t.symbolArray=new t("symbol-array",{fontCharacter:"\\ea8a"}),t.symbolModule=new t("symbol-module",{fontCharacter:"\\ea8b"}),t.symbolPackage=new t("symbol-package",{fontCharacter:"\\ea8b"}),t.symbolNamespace=new t("symbol-namespace",{fontCharacter:"\\ea8b"}),t.symbolObject=new t("symbol-object",{fontCharacter:"\\ea8b"}),t.symbolMethod=new t("symbol-method",{fontCharacter:"\\ea8c"}),t.symbolFunction=new t("symbol-function",{fontCharacter:"\\ea8c"}),t.symbolConstructor=new t("symbol-constructor",{fontCharacter:"\\ea8c"}),t.symbolBoolean=new t("symbol-boolean",{fontCharacter:"\\ea8f"}),t.symbolNull=new t("symbol-null",{fontCharacter:"\\ea8f"}),t.symbolNumeric=new t("symbol-numeric",{fontCharacter:"\\ea90"}),t.symbolNumber=new t("symbol-number",{fontCharacter:"\\ea90"}),t.symbolStructure=new t("symbol-structure",{fontCharacter:"\\ea91"}),t.symbolStruct=new t("symbol-struct",{fontCharacter:"\\ea91"}),t.symbolParameter=new t("symbol-parameter",{fontCharacter:"\\ea92"}),t.symbolTypeParameter=new t("symbol-type-parameter",{fontCharacter:"\\ea92"}),t.symbolKey=new t("symbol-key",{fontCharacter:"\\ea93"}),t.symbolText=new t("symbol-text",{fontCharacter:"\\ea93"}),t.symbolReference=new t("symbol-reference",{fontCharacter:"\\ea94"}),t.goToFile=new t("go-to-file",{fontCharacter:"\\ea94"}),t.symbolEnum=new t("symbol-enum",{fontCharacter:"\\ea95"}),t.symbolValue=new t("symbol-value",{fontCharacter:"\\ea95"}),t.symbolRuler=new t("symbol-ruler",{fontCharacter:"\\ea96"}),t.symbolUnit=new t("symbol-unit",{fontCharacter:"\\ea96"}),t.activateBreakpoints=new t("activate-breakpoints",{fontCharacter:"\\ea97"}),t.archive=new t("archive",{fontCharacter:"\\ea98"}),t.arrowBoth=new t("arrow-both",{fontCharacter:"\\ea99"}),t.arrowDown=new t("arrow-down",{fontCharacter:"\\ea9a"}),t.arrowLeft=new t("arrow-left",{fontCharacter:"\\ea9b"}),t.arrowRight=new t("arrow-right",{fontCharacter:"\\ea9c"}),t.arrowSmallDown=new t("arrow-small-down",{fontCharacter:"\\ea9d"}),t.arrowSmallLeft=new t("arrow-small-left",{fontCharacter:"\\ea9e"}),t.arrowSmallRight=new t("arrow-small-right",{fontCharacter:"\\ea9f"}),t.arrowSmallUp=new t("arrow-small-up",{fontCharacter:"\\eaa0"}),t.arrowUp=new t("arrow-up",{fontCharacter:"\\eaa1"}),t.bell=new t("bell",{fontCharacter:"\\eaa2"}),t.bold=new t("bold",{fontCharacter:"\\eaa3"}),t.book=new t("book",{fontCharacter:"\\eaa4"}),t.bookmark=new t("bookmark",{fontCharacter:"\\eaa5"}),t.debugBreakpointConditionalUnverified=new t("debug-breakpoint-conditional-unverified",{fontCharacter:"\\eaa6"}),t.debugBreakpointConditional=new t("debug-breakpoint-conditional",{fontCharacter:"\\eaa7"}),t.debugBreakpointConditionalDisabled=new t("debug-breakpoint-conditional-disabled",{fontCharacter:"\\eaa7"}),t.debugBreakpointDataUnverified=new t("debug-breakpoint-data-unverified",{fontCharacter:"\\eaa8"}),t.debugBreakpointData=new t("debug-breakpoint-data",{fontCharacter:"\\eaa9"}),t.debugBreakpointDataDisabled=new t("debug-breakpoint-data-disabled",{fontCharacter:"\\eaa9"}),t.debugBreakpointLogUnverified=new t("debug-breakpoint-log-unverified",{fontCharacter:"\\eaaa"}),t.debugBreakpointLog=new t("debug-breakpoint-log",{fontCharacter:"\\eaab"}),t.debugBreakpointLogDisabled=new t("debug-breakpoint-log-disabled",{fontCharacter:"\\eaab"}),t.briefcase=new t("briefcase",{fontCharacter:"\\eaac"}),t.broadcast=new t("broadcast",{fontCharacter:"\\eaad"}),t.browser=new t("browser",{fontCharacter:"\\eaae"}),t.bug=new t("bug",{fontCharacter:"\\eaaf"}),t.calendar=new t("calendar",{fontCharacter:"\\eab0"}),t.caseSensitive=new t("case-sensitive",{fontCharacter:"\\eab1"}),t.check=new t("check",{fontCharacter:"\\eab2"}),t.checklist=new t("checklist",{fontCharacter:"\\eab3"}),t.chevronDown=new t("chevron-down",{fontCharacter:"\\eab4"}),t.dropDownButton=new t("drop-down-button",t.chevronDown.definition),t.chevronLeft=new t("chevron-left",{fontCharacter:"\\eab5"}),t.chevronRight=new t("chevron-right",{fontCharacter:"\\eab6"}),t.chevronUp=new t("chevron-up",{fontCharacter:"\\eab7"}),t.chromeClose=new t("chrome-close",{fontCharacter:"\\eab8"}),t.chromeMaximize=new t("chrome-maximize",{fontCharacter:"\\eab9"}),t.chromeMinimize=new t("chrome-minimize",{fontCharacter:"\\eaba"}),t.chromeRestore=new t("chrome-restore",{fontCharacter:"\\eabb"}),t.circleOutline=new t("circle-outline",{fontCharacter:"\\eabc"}),t.debugBreakpointUnverified=new t("debug-breakpoint-unverified",{fontCharacter:"\\eabc"}),t.circleSlash=new t("circle-slash",{fontCharacter:"\\eabd"}),t.circuitBoard=new t("circuit-board",{fontCharacter:"\\eabe"}),t.clearAll=new t("clear-all",{fontCharacter:"\\eabf"}),t.clippy=new t("clippy",{fontCharacter:"\\eac0"}),t.closeAll=new t("close-all",{fontCharacter:"\\eac1"}),t.cloudDownload=new t("cloud-download",{fontCharacter:"\\eac2"}),t.cloudUpload=new t("cloud-upload",{fontCharacter:"\\eac3"}),t.code=new t("code",{fontCharacter:"\\eac4"}),t.collapseAll=new t("collapse-all",{fontCharacter:"\\eac5"}),t.colorMode=new t("color-mode",{fontCharacter:"\\eac6"}),t.commentDiscussion=new t("comment-discussion",{fontCharacter:"\\eac7"}),t.compareChanges=new t("compare-changes",{fontCharacter:"\\eafd"}),t.creditCard=new t("credit-card",{fontCharacter:"\\eac9"}),t.dash=new t("dash",{fontCharacter:"\\eacc"}),t.dashboard=new t("dashboard",{fontCharacter:"\\eacd"}),t.database=new t("database",{fontCharacter:"\\eace"}),t.debugContinue=new t("debug-continue",{fontCharacter:"\\eacf"}),t.debugDisconnect=new t("debug-disconnect",{fontCharacter:"\\ead0"}),t.debugPause=new t("debug-pause",{fontCharacter:"\\ead1"}),t.debugRestart=new t("debug-restart",{fontCharacter:"\\ead2"}),t.debugStart=new t("debug-start",{fontCharacter:"\\ead3"}),t.debugStepInto=new t("debug-step-into",{fontCharacter:"\\ead4"}),t.debugStepOut=new t("debug-step-out",{fontCharacter:"\\ead5"}),t.debugStepOver=new t("debug-step-over",{fontCharacter:"\\ead6"}),t.debugStop=new t("debug-stop",{fontCharacter:"\\ead7"}),t.debug=new t("debug",{fontCharacter:"\\ead8"}),t.deviceCameraVideo=new t("device-camera-video",{fontCharacter:"\\ead9"}),t.deviceCamera=new t("device-camera",{fontCharacter:"\\eada"}),t.deviceMobile=new t("device-mobile",{fontCharacter:"\\eadb"}),t.diffAdded=new t("diff-added",{fontCharacter:"\\eadc"}),t.diffIgnored=new t("diff-ignored",{fontCharacter:"\\eadd"}),t.diffModified=new t("diff-modified",{fontCharacter:"\\eade"}),t.diffRemoved=new t("diff-removed",{fontCharacter:"\\eadf"}),t.diffRenamed=new t("diff-renamed",{fontCharacter:"\\eae0"}),t.diff=new t("diff",{fontCharacter:"\\eae1"}),t.discard=new t("discard",{fontCharacter:"\\eae2"}),t.editorLayout=new t("editor-layout",{fontCharacter:"\\eae3"}),t.emptyWindow=new t("empty-window",{fontCharacter:"\\eae4"}),t.exclude=new t("exclude",{fontCharacter:"\\eae5"}),t.extensions=new t("extensions",{fontCharacter:"\\eae6"}),t.eyeClosed=new t("eye-closed",{fontCharacter:"\\eae7"}),t.fileBinary=new t("file-binary",{fontCharacter:"\\eae8"}),t.fileCode=new t("file-code",{fontCharacter:"\\eae9"}),t.fileMedia=new t("file-media",{fontCharacter:"\\eaea"}),t.filePdf=new t("file-pdf",{fontCharacter:"\\eaeb"}),t.fileSubmodule=new t("file-submodule",{fontCharacter:"\\eaec"}),t.fileSymlinkDirectory=new t("file-symlink-directory",{fontCharacter:"\\eaed"}),t.fileSymlinkFile=new t("file-symlink-file",{fontCharacter:"\\eaee"}),t.fileZip=new t("file-zip",{fontCharacter:"\\eaef"}),t.files=new t("files",{fontCharacter:"\\eaf0"}),t.filter=new t("filter",{fontCharacter:"\\eaf1"}),t.flame=new t("flame",{fontCharacter:"\\eaf2"}),t.foldDown=new t("fold-down",{fontCharacter:"\\eaf3"}),t.foldUp=new t("fold-up",{fontCharacter:"\\eaf4"}),t.fold=new t("fold",{fontCharacter:"\\eaf5"}),t.folderActive=new t("folder-active",{fontCharacter:"\\eaf6"}),t.folderOpened=new t("folder-opened",{fontCharacter:"\\eaf7"}),t.gear=new t("gear",{fontCharacter:"\\eaf8"}),t.gift=new t("gift",{fontCharacter:"\\eaf9"}),t.gistSecret=new t("gist-secret",{fontCharacter:"\\eafa"}),t.gist=new t("gist",{fontCharacter:"\\eafb"}),t.gitCommit=new t("git-commit",{fontCharacter:"\\eafc"}),t.gitCompare=new t("git-compare",{fontCharacter:"\\eafd"}),t.gitMerge=new t("git-merge",{fontCharacter:"\\eafe"}),t.githubAction=new t("github-action",{fontCharacter:"\\eaff"}),t.githubAlt=new t("github-alt",{fontCharacter:"\\eb00"}),t.globe=new t("globe",{fontCharacter:"\\eb01"}),t.grabber=new t("grabber",{fontCharacter:"\\eb02"}),t.graph=new t("graph",{fontCharacter:"\\eb03"}),t.gripper=new t("gripper",{fontCharacter:"\\eb04"}),t.heart=new t("heart",{fontCharacter:"\\eb05"}),t.home=new t("home",{fontCharacter:"\\eb06"}),t.horizontalRule=new t("horizontal-rule",{fontCharacter:"\\eb07"}),t.hubot=new t("hubot",{fontCharacter:"\\eb08"}),t.inbox=new t("inbox",{fontCharacter:"\\eb09"}),t.issueClosed=new t("issue-closed",{fontCharacter:"\\eba4"}),t.issueReopened=new t("issue-reopened",{fontCharacter:"\\eb0b"}),t.issues=new t("issues",{fontCharacter:"\\eb0c"}),t.italic=new t("italic",{fontCharacter:"\\eb0d"}),t.jersey=new t("jersey",{fontCharacter:"\\eb0e"}),t.json=new t("json",{fontCharacter:"\\eb0f"}),t.kebabVertical=new t("kebab-vertical",{fontCharacter:"\\eb10"}),t.key=new t("key",{fontCharacter:"\\eb11"}),t.law=new t("law",{fontCharacter:"\\eb12"}),t.lightbulbAutofix=new t("lightbulb-autofix",{fontCharacter:"\\eb13"}),t.linkExternal=new t("link-external",{fontCharacter:"\\eb14"}),t.link=new t("link",{fontCharacter:"\\eb15"}),t.listOrdered=new t("list-ordered",{fontCharacter:"\\eb16"}),t.listUnordered=new t("list-unordered",{fontCharacter:"\\eb17"}),t.liveShare=new t("live-share",{fontCharacter:"\\eb18"}),t.loading=new t("loading",{fontCharacter:"\\eb19"}),t.location=new t("location",{fontCharacter:"\\eb1a"}),t.mailRead=new t("mail-read",{fontCharacter:"\\eb1b"}),t.mail=new t("mail",{fontCharacter:"\\eb1c"}),t.markdown=new t("markdown",{fontCharacter:"\\eb1d"}),t.megaphone=new t("megaphone",{fontCharacter:"\\eb1e"}),t.mention=new t("mention",{fontCharacter:"\\eb1f"}),t.milestone=new t("milestone",{fontCharacter:"\\eb20"}),t.mortarBoard=new t("mortar-board",{fontCharacter:"\\eb21"}),t.move=new t("move",{fontCharacter:"\\eb22"}),t.multipleWindows=new t("multiple-windows",{fontCharacter:"\\eb23"}),t.mute=new t("mute",{fontCharacter:"\\eb24"}),t.noNewline=new t("no-newline",{fontCharacter:"\\eb25"}),t.note=new t("note",{fontCharacter:"\\eb26"}),t.octoface=new t("octoface",{fontCharacter:"\\eb27"}),t.openPreview=new t("open-preview",{fontCharacter:"\\eb28"}),t.package_=new t("package",{fontCharacter:"\\eb29"}),t.paintcan=new t("paintcan",{fontCharacter:"\\eb2a"}),t.pin=new t("pin",{fontCharacter:"\\eb2b"}),t.play=new t("play",{fontCharacter:"\\eb2c"}),t.run=new t("run",{fontCharacter:"\\eb2c"}),t.plug=new t("plug",{fontCharacter:"\\eb2d"}),t.preserveCase=new t("preserve-case",{fontCharacter:"\\eb2e"}),t.preview=new t("preview",{fontCharacter:"\\eb2f"}),t.project=new t("project",{fontCharacter:"\\eb30"}),t.pulse=new t("pulse",{fontCharacter:"\\eb31"}),t.question=new t("question",{fontCharacter:"\\eb32"}),t.quote=new t("quote",{fontCharacter:"\\eb33"}),t.radioTower=new t("radio-tower",{fontCharacter:"\\eb34"}),t.reactions=new t("reactions",{fontCharacter:"\\eb35"}),t.references=new t("references",{fontCharacter:"\\eb36"}),t.refresh=new t("refresh",{fontCharacter:"\\eb37"}),t.regex=new t("regex",{fontCharacter:"\\eb38"}),t.remoteExplorer=new t("remote-explorer",{fontCharacter:"\\eb39"}),t.remote=new t("remote",{fontCharacter:"\\eb3a"}),t.remove=new t("remove",{fontCharacter:"\\eb3b"}),t.replaceAll=new t("replace-all",{fontCharacter:"\\eb3c"}),t.replace=new t("replace",{fontCharacter:"\\eb3d"}),t.repoClone=new t("repo-clone",{fontCharacter:"\\eb3e"}),t.repoForcePush=new t("repo-force-push",{fontCharacter:"\\eb3f"}),t.repoPull=new t("repo-pull",{fontCharacter:"\\eb40"}),t.repoPush=new t("repo-push",{fontCharacter:"\\eb41"}),t.report=new t("report",{fontCharacter:"\\eb42"}),t.requestChanges=new t("request-changes",{fontCharacter:"\\eb43"}),t.rocket=new t("rocket",{fontCharacter:"\\eb44"}),t.rootFolderOpened=new t("root-folder-opened",{fontCharacter:"\\eb45"}),t.rootFolder=new t("root-folder",{fontCharacter:"\\eb46"}),t.rss=new t("rss",{fontCharacter:"\\eb47"}),t.ruby=new t("ruby",{fontCharacter:"\\eb48"}),t.saveAll=new t("save-all",{fontCharacter:"\\eb49"}),t.saveAs=new t("save-as",{fontCharacter:"\\eb4a"}),t.save=new t("save",{fontCharacter:"\\eb4b"}),t.screenFull=new t("screen-full",{fontCharacter:"\\eb4c"}),t.screenNormal=new t("screen-normal",{fontCharacter:"\\eb4d"}),t.searchStop=new t("search-stop",{fontCharacter:"\\eb4e"}),t.server=new t("server",{fontCharacter:"\\eb50"}),t.settingsGear=new t("settings-gear",{fontCharacter:"\\eb51"}),t.settings=new t("settings",{fontCharacter:"\\eb52"}),t.shield=new t("shield",{fontCharacter:"\\eb53"}),t.smiley=new t("smiley",{fontCharacter:"\\eb54"}),t.sortPrecedence=new t("sort-precedence",{fontCharacter:"\\eb55"}),t.splitHorizontal=new t("split-horizontal",{fontCharacter:"\\eb56"}),t.splitVertical=new t("split-vertical",{fontCharacter:"\\eb57"}),t.squirrel=new t("squirrel",{fontCharacter:"\\eb58"}),t.starFull=new t("star-full",{fontCharacter:"\\eb59"}),t.starHalf=new t("star-half",{fontCharacter:"\\eb5a"}),t.symbolClass=new t("symbol-class",{fontCharacter:"\\eb5b"}),t.symbolColor=new t("symbol-color",{fontCharacter:"\\eb5c"}),t.symbolConstant=new t("symbol-constant",{fontCharacter:"\\eb5d"}),t.symbolEnumMember=new t("symbol-enum-member",{fontCharacter:"\\eb5e"}),t.symbolField=new t("symbol-field",{fontCharacter:"\\eb5f"}),t.symbolFile=new t("symbol-file",{fontCharacter:"\\eb60"}),t.symbolInterface=new t("symbol-interface",{fontCharacter:"\\eb61"}),t.symbolKeyword=new t("symbol-keyword",{fontCharacter:"\\eb62"}),t.symbolMisc=new t("symbol-misc",{fontCharacter:"\\eb63"}),t.symbolOperator=new t("symbol-operator",{fontCharacter:"\\eb64"}),t.symbolProperty=new t("symbol-property",{fontCharacter:"\\eb65"}),t.wrench=new t("wrench",{fontCharacter:"\\eb65"}),t.wrenchSubaction=new t("wrench-subaction",{fontCharacter:"\\eb65"}),t.symbolSnippet=new t("symbol-snippet",{fontCharacter:"\\eb66"}),t.tasklist=new t("tasklist",{fontCharacter:"\\eb67"}),t.telescope=new t("telescope",{fontCharacter:"\\eb68"}),t.textSize=new t("text-size",{fontCharacter:"\\eb69"}),t.threeBars=new t("three-bars",{fontCharacter:"\\eb6a"}),t.thumbsdown=new t("thumbsdown",{fontCharacter:"\\eb6b"}),t.thumbsup=new t("thumbsup",{fontCharacter:"\\eb6c"}),t.tools=new t("tools",{fontCharacter:"\\eb6d"}),t.triangleDown=new t("triangle-down",{fontCharacter:"\\eb6e"}),t.triangleLeft=new t("triangle-left",{fontCharacter:"\\eb6f"}),t.triangleRight=new t("triangle-right",{fontCharacter:"\\eb70"}),t.triangleUp=new t("triangle-up",{fontCharacter:"\\eb71"}),t.twitter=new t("twitter",{fontCharacter:"\\eb72"}),t.unfold=new t("unfold",{fontCharacter:"\\eb73"}),t.unlock=new t("unlock",{fontCharacter:"\\eb74"}),t.unmute=new t("unmute",{fontCharacter:"\\eb75"}),t.unverified=new t("unverified",{fontCharacter:"\\eb76"}),t.verified=new t("verified",{fontCharacter:"\\eb77"}),t.versions=new t("versions",{fontCharacter:"\\eb78"}),t.vmActive=new t("vm-active",{fontCharacter:"\\eb79"}),t.vmOutline=new t("vm-outline",{fontCharacter:"\\eb7a"}),t.vmRunning=new t("vm-running",{fontCharacter:"\\eb7b"}),t.watch=new t("watch",{fontCharacter:"\\eb7c"}),t.whitespace=new t("whitespace",{fontCharacter:"\\eb7d"}),t.wholeWord=new t("whole-word",{fontCharacter:"\\eb7e"}),t.window=new t("window",{fontCharacter:"\\eb7f"}),t.wordWrap=new t("word-wrap",{fontCharacter:"\\eb80"}),t.zoomIn=new t("zoom-in",{fontCharacter:"\\eb81"}),t.zoomOut=new t("zoom-out",{fontCharacter:"\\eb82"}),t.listFilter=new t("list-filter",{fontCharacter:"\\eb83"}),t.listFlat=new t("list-flat",{fontCharacter:"\\eb84"}),t.listSelection=new t("list-selection",{fontCharacter:"\\eb85"}),t.selection=new t("selection",{fontCharacter:"\\eb85"}),t.listTree=new t("list-tree",{fontCharacter:"\\eb86"}),t.debugBreakpointFunctionUnverified=new t("debug-breakpoint-function-unverified",{fontCharacter:"\\eb87"}),t.debugBreakpointFunction=new t("debug-breakpoint-function",{fontCharacter:"\\eb88"}),t.debugBreakpointFunctionDisabled=new t("debug-breakpoint-function-disabled",{fontCharacter:"\\eb88"}),t.debugStackframeActive=new t("debug-stackframe-active",{fontCharacter:"\\eb89"}),t.debugStackframeDot=new t("debug-stackframe-dot",{fontCharacter:"\\eb8a"}),t.debugStackframe=new t("debug-stackframe",{fontCharacter:"\\eb8b"}),t.debugStackframeFocused=new t("debug-stackframe-focused",{fontCharacter:"\\eb8b"}),t.debugBreakpointUnsupported=new t("debug-breakpoint-unsupported",{fontCharacter:"\\eb8c"}),t.symbolString=new t("symbol-string",{fontCharacter:"\\eb8d"}),t.debugReverseContinue=new t("debug-reverse-continue",{fontCharacter:"\\eb8e"}),t.debugStepBack=new t("debug-step-back",{fontCharacter:"\\eb8f"}),t.debugRestartFrame=new t("debug-restart-frame",{fontCharacter:"\\eb90"}),t.callIncoming=new t("call-incoming",{fontCharacter:"\\eb92"}),t.callOutgoing=new t("call-outgoing",{fontCharacter:"\\eb93"}),t.menu=new t("menu",{fontCharacter:"\\eb94"}),t.expandAll=new t("expand-all",{fontCharacter:"\\eb95"}),t.feedback=new t("feedback",{fontCharacter:"\\eb96"}),t.groupByRefType=new t("group-by-ref-type",{fontCharacter:"\\eb97"}),t.ungroupByRefType=new t("ungroup-by-ref-type",{fontCharacter:"\\eb98"}),t.account=new t("account",{fontCharacter:"\\eb99"}),t.bellDot=new t("bell-dot",{fontCharacter:"\\eb9a"}),t.debugConsole=new t("debug-console",{fontCharacter:"\\eb9b"}),t.library=new t("library",{fontCharacter:"\\eb9c"}),t.output=new t("output",{fontCharacter:"\\eb9d"}),t.runAll=new t("run-all",{fontCharacter:"\\eb9e"}),t.syncIgnored=new t("sync-ignored",{fontCharacter:"\\eb9f"}),t.pinned=new t("pinned",{fontCharacter:"\\eba0"}),t.githubInverted=new t("github-inverted",{fontCharacter:"\\eba1"}),t.debugAlt=new t("debug-alt",{fontCharacter:"\\eb91"}),t.serverProcess=new t("server-process",{fontCharacter:"\\eba2"}),t.serverEnvironment=new t("server-environment",{fontCharacter:"\\eba3"}),t.pass=new t("pass",{fontCharacter:"\\eba4"}),t.stopCircle=new t("stop-circle",{fontCharacter:"\\eba5"}),t.playCircle=new t("play-circle",{fontCharacter:"\\eba6"}),t.record=new t("record",{fontCharacter:"\\eba7"}),t.debugAltSmall=new t("debug-alt-small",{fontCharacter:"\\eba8"}),t.vmConnect=new t("vm-connect",{fontCharacter:"\\eba9"}),t.cloud=new t("cloud",{fontCharacter:"\\ebaa"}),t.merge=new t("merge",{fontCharacter:"\\ebab"}),t.exportIcon=new t("export",{fontCharacter:"\\ebac"}),t.graphLeft=new t("graph-left",{fontCharacter:"\\ebad"}),t.magnet=new t("magnet",{fontCharacter:"\\ebae"}),t.notebook=new t("notebook",{fontCharacter:"\\ebaf"}),t.redo=new t("redo",{fontCharacter:"\\ebb0"}),t.checkAll=new t("check-all",{fontCharacter:"\\ebb1"}),t.pinnedDirty=new t("pinned-dirty",{fontCharacter:"\\ebb2"}),t.passFilled=new t("pass-filled",{fontCharacter:"\\ebb3"}),t.circleLargeFilled=new t("circle-large-filled",{fontCharacter:"\\ebb4"}),t.circleLargeOutline=new t("circle-large-outline",{fontCharacter:"\\ebb5"}),t.combine=new t("combine",{fontCharacter:"\\ebb6"}),t.gather=new t("gather",{fontCharacter:"\\ebb6"}),t.table=new t("table",{fontCharacter:"\\ebb7"}),t.variableGroup=new t("variable-group",{fontCharacter:"\\ebb8"}),t.typeHierarchy=new t("type-hierarchy",{fontCharacter:"\\ebb9"}),t.typeHierarchySub=new t("type-hierarchy-sub",{fontCharacter:"\\ebba"}),t.typeHierarchySuper=new t("type-hierarchy-super",{fontCharacter:"\\ebbb"}),t.gitPullRequestCreate=new t("git-pull-request-create",{fontCharacter:"\\ebbc"}),t.runAbove=new t("run-above",{fontCharacter:"\\ebbd"}),t.runBelow=new t("run-below",{fontCharacter:"\\ebbe"}),t.notebookTemplate=new t("notebook-template",{fontCharacter:"\\ebbf"}),t.debugRerun=new t("debug-rerun",{fontCharacter:"\\ebc0"}),t.workspaceTrusted=new t("workspace-trusted",{fontCharacter:"\\ebc1"}),t.workspaceUntrusted=new t("workspace-untrusted",{fontCharacter:"\\ebc2"}),t.workspaceUnspecified=new t("workspace-unspecified",{fontCharacter:"\\ebc3"}),t.terminalCmd=new t("terminal-cmd",{fontCharacter:"\\ebc4"}),t.terminalDebian=new t("terminal-debian",{fontCharacter:"\\ebc5"}),t.terminalLinux=new t("terminal-linux",{fontCharacter:"\\ebc6"}),t.terminalPowershell=new t("terminal-powershell",{fontCharacter:"\\ebc7"}),t.terminalTmux=new t("terminal-tmux",{fontCharacter:"\\ebc8"}),t.terminalUbuntu=new t("terminal-ubuntu",{fontCharacter:"\\ebc9"}),t.terminalBash=new t("terminal-bash",{fontCharacter:"\\ebca"}),t.arrowSwap=new t("arrow-swap",{fontCharacter:"\\ebcb"}),t.copy=new t("copy",{fontCharacter:"\\ebcc"}),t.personAdd=new t("person-add",{fontCharacter:"\\ebcd"}),t.filterFilled=new t("filter-filled",{fontCharacter:"\\ebce"}),t.wand=new t("wand",{fontCharacter:"\\ebcf"}),t.debugLineByLine=new t("debug-line-by-line",{fontCharacter:"\\ebd0"}),t.inspect=new t("inspect",{fontCharacter:"\\ebd1"}),t.layers=new t("layers",{fontCharacter:"\\ebd2"}),t.layersDot=new t("layers-dot",{fontCharacter:"\\ebd3"}),t.layersActive=new t("layers-active",{fontCharacter:"\\ebd4"}),t.compass=new t("compass",{fontCharacter:"\\ebd5"}),t.compassDot=new t("compass-dot",{fontCharacter:"\\ebd6"}),t.compassActive=new t("compass-active",{fontCharacter:"\\ebd7"}),t.azure=new t("azure",{fontCharacter:"\\ebd8"}),t.issueDraft=new t("issue-draft",{fontCharacter:"\\ebd9"}),t.gitPullRequestClosed=new t("git-pull-request-closed",{fontCharacter:"\\ebda"}),t.gitPullRequestDraft=new t("git-pull-request-draft",{fontCharacter:"\\ebdb"}),t.debugAll=new t("debug-all",{fontCharacter:"\\ebdc"}),t.debugCoverage=new t("debug-coverage",{fontCharacter:"\\ebdd"}),t.runErrors=new t("run-errors",{fontCharacter:"\\ebde"}),t.folderLibrary=new t("folder-library",{fontCharacter:"\\ebdf"}),t.debugContinueSmall=new t("debug-continue-small",{fontCharacter:"\\ebe0"}),t.beakerStop=new t("beaker-stop",{fontCharacter:"\\ebe1"}),t.graphLine=new t("graph-line",{fontCharacter:"\\ebe2"}),t.graphScatter=new t("graph-scatter",{fontCharacter:"\\ebe3"}),t.pieChart=new t("pie-chart",{fontCharacter:"\\ebe4"}),t.bracket=new t("bracket",t.json.definition),t.bracketDot=new t("bracket-dot",{fontCharacter:"\\ebe5"}),t.bracketError=new t("bracket-error",{fontCharacter:"\\ebe6"}),t.lockSmall=new t("lock-small",{fontCharacter:"\\ebe7"}),t.azureDevops=new t("azure-devops",{fontCharacter:"\\ebe8"}),t.verifiedFilled=new t("verified-filled",{fontCharacter:"\\ebe9"})}(l||(l={}))},79881:function(t,e,n){"use strict";n.d(e,{B8:function(){return d},Cp:function(){return s},F0:function(){return u},L6:function(){return c},VV:function(){return l},b1:function(){return h},dL:function(){return r},ri:function(){return a}});const i=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(t){setTimeout((()=>{if(t.stack)throw new Error(t.message+"\n\n"+t.stack);throw t}),0)}}emit(t){this.listeners.forEach((e=>{e(t)}))}onUnexpectedError(t){this.unexpectedErrorHandler(t),this.emit(t)}onUnexpectedExternalError(t){this.unexpectedErrorHandler(t)}};function r(t){l(t)||i.onUnexpectedError(t)}function s(t){l(t)||i.onUnexpectedExternalError(t)}function a(t){if(t instanceof Error){let{name:e,message:n}=t;return{$isError:!0,name:e,message:n,stack:t.stacktrace||t.stack}}return t}const o="Canceled";function l(t){return t instanceof Error&&t.name===o&&t.message===o}function u(){const t=new Error(o);return t.name=t.message,t}function h(t){return t?new Error(`Illegal argument: ${t}`):new Error("Illegal argument")}function c(t){return t?new Error(`Illegal state: ${t}`):new Error("Illegal state")}class d extends Error{constructor(t){super("NotSupported"),t&&(this.message=t)}}},4348:function(t,e,n){"use strict";n.d(e,{D0:function(){return c},E7:function(){return d},K3:function(){return h},Q5:function(){return u},ZD:function(){return f},ju:function(){return i}});var i,r=n(79881),s=n(69323),a=n(34502),o=n(95830);!function(t){function e(t){return(e,n=null,i)=>{let r,s=!1;return r=t((t=>{if(!s)return r?r.dispose():s=!0,e.call(n,t)}),null,i),s&&r.dispose(),r}}function n(t,e){return o(((n,i=null,r)=>t((t=>n.call(i,e(t))),null,r)))}function i(t,e){return o(((n,i=null,r)=>t((t=>{e(t),n.call(i,t)}),null,r)))}function r(t,e){return o(((n,i=null,r)=>t((t=>e(t)&&n.call(i,t)),null,r)))}function a(t,e,i){let r=i;return n(t,(t=>(r=e(r,t),r)))}function o(t){let e;const n=new u({onFirstListenerAdd(){e=t(n.fire,n)},onLastListenerRemove(){e.dispose()}});return n.event}function l(t,e,n=100,i=!1,r){let s,a,o,l=0;const h=new u({leakWarningThreshold:r,onFirstListenerAdd(){s=t((t=>{l++,a=e(a,t),i&&!o&&(h.fire(a),a=void 0),clearTimeout(o),o=setTimeout((()=>{const t=a;a=void 0,o=void 0,(!i||l>1)&&h.fire(t),l=0}),n)}))},onLastListenerRemove(){s.dispose()}});return h.event}function h(t,e=((t,e)=>t===e)){let n,i=!0;return r(t,(t=>{const r=i||!e(t,n);return i=!1,n=t,r}))}t.None=()=>s.JT.None,t.once=e,t.map=n,t.forEach=i,t.filter=r,t.signal=function(t){return t},t.any=function(...t){return(e,n=null,i)=>(0,s.F8)(...t.map((t=>t((t=>e.call(n,t)),null,i))))},t.reduce=a,t.debounce=l,t.latch=h,t.split=function(e,n){return[t.filter(e,n),t.filter(e,(t=>!n(t)))]},t.buffer=function(t,e=!1,n=[]){let i=n.slice(),r=t((t=>{i?i.push(t):a.fire(t)}));const s=()=>{i&&i.forEach((t=>a.fire(t))),i=null},a=new u({onFirstListenerAdd(){r||(r=t((t=>a.fire(t))))},onFirstListenerDidAdd(){i&&(e?setTimeout(s):s())},onLastListenerRemove(){r&&r.dispose(),r=null}});return a.event};class c{constructor(t){this.event=t}map(t){return new c(n(this.event,t))}forEach(t){return new c(i(this.event,t))}filter(t){return new c(r(this.event,t))}reduce(t,e){return new c(a(this.event,t,e))}latch(){return new c(h(this.event))}debounce(t,e=100,n=!1,i){return new c(l(this.event,t,e,n,i))}on(t,e,n){return this.event(t,e,n)}once(t,n,i){return e(this.event)(t,n,i)}}t.chain=function(t){return new c(t)},t.fromNodeEventEmitter=function(t,e,n=(t=>t)){const i=(...t)=>r.fire(n(...t)),r=new u({onFirstListenerAdd:()=>t.on(e,i),onLastListenerRemove:()=>t.removeListener(e,i)});return r.event},t.fromDOMEventEmitter=function(t,e,n=(t=>t)){const i=(...t)=>r.fire(n(...t)),r=new u({onFirstListenerAdd:()=>t.addEventListener(e,i),onLastListenerRemove:()=>t.removeEventListener(e,i)});return r.event},t.toPromise=function(t){return new Promise((n=>e(t)(n)))}}(i||(i={}));class l{constructor(t){this._listenerCount=0,this._invocationCount=0,this._elapsedOverall=0,this._name=`${t}_${l._idPool++}`}start(t){this._stopWatch=new o.G(!0),this._listenerCount=t}stop(){if(this._stopWatch){const t=this._stopWatch.elapsed();this._elapsedOverall+=t,this._invocationCount+=1,console.info(`did FIRE ${this._name}: elapsed_ms: ${t.toFixed(5)}, listener: ${this._listenerCount} (elapsed_overall: ${this._elapsedOverall.toFixed(2)}, invocations: ${this._invocationCount})`),this._stopWatch=void 0}}}l._idPool=0;class u{constructor(t){var e;this._disposed=!1,this._options=t,this._leakageMon=void 0,this._perfMon=(null===(e=this._options)||void 0===e?void 0:e._profName)?new l(this._options._profName):void 0}get event(){return this._event||(this._event=(t,e,n)=>{var i;this._listeners||(this._listeners=new a.S);const r=this._listeners.isEmpty();r&&this._options&&this._options.onFirstListenerAdd&&this._options.onFirstListenerAdd(this);const o=this._listeners.push(e?[t,e]:t);r&&this._options&&this._options.onFirstListenerDidAdd&&this._options.onFirstListenerDidAdd(this),this._options&&this._options.onListenerDidAdd&&this._options.onListenerDidAdd(this,t,e);const l=null===(i=this._leakageMon)||void 0===i?void 0:i.check(this._listeners.size),u=(0,s.OF)((()=>{if(l&&l(),!this._disposed&&(o(),this._options&&this._options.onLastListenerRemove)){this._listeners&&!this._listeners.isEmpty()||this._options.onLastListenerRemove(this)}}));return n instanceof s.SL?n.add(u):Array.isArray(n)&&n.push(u),u}),this._event}fire(t){var e,n;if(this._listeners){this._deliveryQueue||(this._deliveryQueue=new a.S);for(let e of this._listeners)this._deliveryQueue.push([e,t]);for(null===(e=this._perfMon)||void 0===e||e.start(this._deliveryQueue.size);this._deliveryQueue.size>0;){const[t,e]=this._deliveryQueue.shift();try{"function"==typeof t?t.call(void 0,e):t[0].call(t[1],e)}catch(t){(0,r.dL)(t)}}null===(n=this._perfMon)||void 0===n||n.stop()}}dispose(){var t,e,n,i,r;this._disposed||(this._disposed=!0,null===(t=this._listeners)||void 0===t||t.clear(),null===(e=this._deliveryQueue)||void 0===e||e.clear(),null===(i=null===(n=this._options)||void 0===n?void 0:n.onLastListenerRemove)||void 0===i||i.call(n),null===(r=this._leakageMon)||void 0===r||r.dispose())}}class h extends u{constructor(t){super(t),this._isPaused=0,this._eventQueue=new a.S,this._mergeFn=null==t?void 0:t.merge}pause(){this._isPaused++}resume(){if(0!==this._isPaused&&0==--this._isPaused)if(this._mergeFn){const t=Array.from(this._eventQueue);this._eventQueue.clear(),super.fire(this._mergeFn(t))}else for(;!this._isPaused&&0!==this._eventQueue.size;)super.fire(this._eventQueue.shift())}fire(t){this._listeners&&(0!==this._isPaused?this._eventQueue.push(t):super.fire(t))}}class c extends h{constructor(t){var e;super(t),this._delay=null!==(e=t.delay)&&void 0!==e?e:100}fire(t){this._handle||(this.pause(),this._handle=setTimeout((()=>{this._handle=void 0,this.resume()}),this._delay)),super.fire(t)}}class d{constructor(){this.buffers=[]}wrapEvent(t){return(e,n,i)=>t((t=>{const i=this.buffers[this.buffers.length-1];i?i.push((()=>e.call(n,t))):e.call(n,t)}),void 0,i)}bufferEvents(t){const e=[];this.buffers.push(e);const n=t();return this.buffers.pop(),e.forEach((t=>t())),n}}class f{constructor(){this.listening=!1,this.inputEvent=i.None,this.inputEventListener=s.JT.None,this.emitter=new u({onFirstListenerDidAdd:()=>{this.listening=!0,this.inputEventListener=this.inputEvent(this.emitter.fire,this.emitter)},onLastListenerRemove:()=>{this.listening=!1,this.inputEventListener.dispose()}}),this.event=this.emitter.event}set input(t){this.inputEvent=t,this.listening&&(this.inputEventListener.dispose(),this.inputEventListener=t(this.emitter.fire,this.emitter))}dispose(){this.inputEventListener.dispose(),this.emitter.dispose()}}},17845:function(t,e,n){"use strict";function i(t){const e=this;let n,i=!1;return function(){return i||(i=!0,n=t.apply(e,arguments)),n}}n.d(e,{I:function(){return i}})},88226:function(t,e,n){"use strict";var i;n.d(e,{$:function(){return i}}),function(t){t.is=function(t){return t&&"object"==typeof t&&"function"==typeof t[Symbol.iterator]};const e=Object.freeze([]);t.empty=function(){return e},t.single=function*(t){yield t},t.from=function(t){return t||e},t.isEmpty=function(t){return!t||!0===t[Symbol.iterator]().next().done},t.first=function(t){return t[Symbol.iterator]().next().value},t.some=function(t,e){for(const n of t)if(e(n))return!0;return!1},t.find=function(t,e){for(const n of t)if(e(n))return n},t.filter=function*(t,e){for(const n of t)e(n)&&(yield n)},t.map=function*(t,e){let n=0;for(const i of t)yield e(i,n++)},t.concat=function*(...t){for(const e of t)for(const t of e)yield t},t.concatNested=function*(t){for(const e of t)for(const t of e)yield t},t.reduce=function(t,e,n){let i=n;for(const n of t)i=e(i,n);return i},t.slice=function*(t,e,n=t.length){for(e<0&&(e+=t.length),n<0?n+=t.length:n>t.length&&(n=t.length);e<n;e++)yield t[e]},t.consume=function(e,n=Number.POSITIVE_INFINITY){const i=[];if(0===n)return[i,e];const r=e[Symbol.iterator]();for(let e=0;e<n;e++){const e=r.next();if(e.done)return[i,t.empty()];i.push(e.value)}return[i,{[Symbol.iterator](){return r}}]},t.equals=function(t,e,n=((t,e)=>t===e)){const i=t[Symbol.iterator](),r=e[Symbol.iterator]();for(;;){const t=i.next(),e=r.next();if(t.done!==e.done)return!1;if(t.done)return!0;if(!n(t.value,e.value))return!1}}}(i||(i={}))},69323:function(t,e,n){"use strict";n.d(e,{B9:function(){return d},F8:function(){return f},JT:function(){return _},Jz:function(){return v},OF:function(){return p},SL:function(){return g},Wf:function(){return c},XK:function(){return m},dk:function(){return u}});var i=n(17845),r=n(88226);let s=null;function a(t){return null==s||s.trackDisposable(t),t}function o(t){null==s||s.markAsDisposed(t)}function l(t,e){null==s||s.setParent(t,e)}function u(t){return null==s||s.markAsSingleton(t),t}class h extends Error{constructor(t){super(`Encountered errors while disposing of store. Errors: [${t.join(", ")}]`),this.errors=t}}function c(t){return"function"==typeof t.dispose&&0===t.dispose.length}function d(t){if(r.$.is(t)){let e=[];for(const n of t)if(n)try{n.dispose()}catch(t){e.push(t)}if(1===e.length)throw e[0];if(e.length>1)throw new h(e);return Array.isArray(t)?[]:t}if(t)return t.dispose(),t}function f(...t){const e=p((()=>d(t)));return function(t,e){if(s)for(const n of t)s.setParent(n,e)}(t,e),e}function p(t){const e=a({dispose:(0,i.I)((()=>{o(e),t()}))});return e}class g{constructor(){this._toDispose=new Set,this._isDisposed=!1,a(this)}dispose(){this._isDisposed||(o(this),this._isDisposed=!0,this.clear())}clear(){try{d(this._toDispose.values())}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw new Error("Cannot register a disposable on itself!");return l(t,this),this._isDisposed?g.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(t),t}}g.DISABLE_DISPOSED_WARNING=!1;class _{constructor(){this._store=new g,a(this),l(this._store,this)}dispose(){o(this),this._store.dispose()}_register(t){if(t===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(t)}}_.None=Object.freeze({dispose(){}});class m{constructor(){this._isDisposed=!1,a(this)}get value(){return this._isDisposed?void 0:this._value}set value(t){var e;this._isDisposed||t===this._value||(null===(e=this._value)||void 0===e||e.dispose(),t&&l(t,this),this._value=t)}clear(){this.value=void 0}dispose(){var t;this._isDisposed=!0,o(this),null===(t=this._value)||void 0===t||t.dispose(),this._value=void 0}clearAndLeak(){const t=this._value;return this._value=void 0,t&&l(t,null),t}}class v{constructor(t){this.object=t}dispose(){}}},34502:function(t,e,n){"use strict";n.d(e,{S:function(){return r}});class i{constructor(t){this.element=t,this.next=i.Undefined,this.prev=i.Undefined}}i.Undefined=new i(void 0);class r{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 t=this._first;for(;t!==i.Undefined;){const e=t.next;t.prev=i.Undefined,t.next=i.Undefined,t=e}this._first=i.Undefined,this._last=i.Undefined,this._size=0}unshift(t){return this._insert(t,!1)}push(t){return this._insert(t,!0)}_insert(t,e){const n=new i(t);if(this._first===i.Undefined)this._first=n,this._last=n;else if(e){const t=this._last;this._last=n,n.prev=t,t.next=n}else{const t=this._first;this._first=n,n.next=t,t.prev=n}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(n))}}shift(){if(this._first!==i.Undefined){const t=this._first.element;return this._remove(this._first),t}}pop(){if(this._last!==i.Undefined){const t=this._last.element;return this._remove(this._last),t}}_remove(t){if(t.prev!==i.Undefined&&t.next!==i.Undefined){const e=t.prev;e.next=t.next,t.next.prev=e}else t.prev===i.Undefined&&t.next===i.Undefined?(this._first=i.Undefined,this._last=i.Undefined):t.next===i.Undefined?(this._last=this._last.prev,this._last.next=i.Undefined):t.prev===i.Undefined&&(this._first=this._first.next,this._first.prev=i.Undefined);this._size-=1}*[Symbol.iterator](){let t=this._first;for(;t!==i.Undefined;)yield t.element,t=t.next}}},23345:function(t,e,n){"use strict";n.d(e,{$L:function(){return S},ED:function(){return E},IJ:function(){return T},OS:function(){return x},WE:function(){return D},dz:function(){return w},gn:function(){return A},li:function(){return m},r:function(){return I},tY:function(){return k},xS:function(){return C}});var i,r=n(97671);const s="en";let a,o,l=!1,u=!1,h=!1,c=!1,d=!1,f=!1,p=!1,g=null,_=null;const m="object"==typeof self?self:"object"==typeof n.g?n.g:{};let v;void 0!==m.vscode&&void 0!==m.vscode.process?v=m.vscode.process:void 0!==r&&(v=r);const y="string"==typeof(null===(i=null==v?void 0:v.versions)||void 0===i?void 0:i.electron)&&"renderer"===v.type;if("object"!=typeof navigator||y)if("object"==typeof v){l="win32"===v.platform,u="darwin"===v.platform,h="linux"===v.platform,c=h&&!!v.env.SNAP&&!!v.env.SNAP_REVISION,a=s,g=s;const t=v.env.VSCODE_NLS_CONFIG;if(t)try{const e=JSON.parse(t),n=e.availableLanguages["*"];a=e.locale,g=n||s,_=e._translationsConfigFile}catch(t){}d=!0}else console.error("Unable to resolve platform.");else o=navigator.userAgent,l=o.indexOf("Windows")>=0,u=o.indexOf("Macintosh")>=0,p=(o.indexOf("Macintosh")>=0||o.indexOf("iPad")>=0||o.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,h=o.indexOf("Linux")>=0,f=!0,a=navigator.language,g=a;let b=0;u?b=1:l?b=3:h&&(b=2);const E=l,w=u,T=h,k=d,S=f,A=p,D=o,C=function(){if(m.setImmediate)return m.setImmediate.bind(m);if("function"==typeof m.postMessage&&!m.importScripts){let t=[];m.addEventListener("message",(e=>{if(e.data&&e.data.vscodeSetImmediateId)for(let n=0,i=t.length;n<i;n++){const i=t[n];if(i.id===e.data.vscodeSetImmediateId)return t.splice(n,1),void i.callback()}}));let e=0;return n=>{const i=++e;t.push({id:i,callback:n}),m.postMessage({vscodeSetImmediateId:i},"*")}}if("function"==typeof(null==v?void 0:v.nextTick))return v.nextTick.bind(v);const t=Promise.resolve();return e=>t.then(e)}(),x=u||p?2:l?1:3;let R=!0,L=!1;function I(){if(!L){L=!0;const t=new Uint8Array(2);t[0]=1,t[1]=2;const e=new Uint16Array(t.buffer);R=513===e[0]}return R}},95830:function(t,e,n){"use strict";n.d(e,{G:function(){return s}});var i=n(23345);const r=i.li.performance&&"function"==typeof i.li.performance.now;class s{constructor(t){this._highResolution=r&&t,this._startTime=this._now(),this._stopTime=-1}static create(t=!0){return new s(t)}stop(){this._stopTime=this._now()}elapsed(){return-1!==this._stopTime?this._stopTime-this._startTime:this._now()-this._startTime}_now(){return this._highResolution?i.li.performance.now():Date.now()}}},82983:function(t,e,n){"use strict";function i(t){return!t||"string"!=typeof t||0===t.trim().length}n.d(e,{$i:function(){return K},C8:function(){return H},GF:function(){return f},HO:function(){return M},IO:function(){return p},K7:function(){return z},Kw:function(){return q},LC:function(){return m},Mh:function(){return C},P1:function(){return x},PJ:function(){return Q},Qe:function(){return j},R1:function(){return d},RP:function(){return $},S6:function(){return X},TT:function(){return E},Ut:function(){return B},V8:function(){return v},WU:function(){return s},YK:function(){return L},YU:function(){return a},ZG:function(){return R},ZH:function(){return P},ab:function(){return V},c1:function(){return W},df:function(){return S},ec:function(){return o},fi:function(){return J},fy:function(){return l},j3:function(){return u},j_:function(){return T},m5:function(){return i},mK:function(){return k},mr:function(){return g},oH:function(){return et},oL:function(){return h},ok:function(){return D},ow:function(){return y},qq:function(){return A},qu:function(){return b},rL:function(){return I},uS:function(){return Y},un:function(){return c},uq:function(){return _},vH:function(){return F},xe:function(){return Z},zY:function(){return w}});const r=/{(\d+)}/g;function s(t,...e){return 0===e.length?t:t.replace(r,(function(t,n){const i=parseInt(n,10);return isNaN(i)||i<0||i>=e.length?t:e[i]}))}function a(t){return t.replace(/[<>&]/g,(function(t){switch(t){case"<":return"&lt;";case">":return"&gt;";case"&":return"&amp;";default:return t}}))}function o(t){return t.replace(/[\\\{\}\*\+\?\|\^\$\.\[\]\(\)]/g,"\\$&")}function l(t,e=" "){return h(u(t,e),e)}function u(t,e){if(!t||!e)return t;const n=e.length;if(0===n||0===t.length)return t;let i=0;for(;t.indexOf(e,i)===i;)i+=n;return t.substring(i)}function h(t,e){if(!t||!e)return t;const n=e.length,i=t.length;if(0===n||0===i)return t;let r=i,s=-1;for(;s=t.lastIndexOf(e,r-1),-1!==s&&s+n===r;){if(0===s)return"";r=s}return t.substring(0,r)}function c(t){return t.replace(/[\-\\\{\}\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&").replace(/[\*]/g,".*")}function d(t){return t.replace(/\*/g,"")}function f(t,e,n={}){if(!t)throw new Error("Cannot create regex from empty string");e||(t=o(t)),n.wholeWord&&(/\B/.test(t.charAt(0))||(t="\\b"+t),/\B/.test(t.charAt(t.length-1))||(t+="\\b"));let i="";return n.global&&(i+="g"),n.matchCase||(i+="i"),n.multiline&&(i+="m"),n.unicode&&(i+="u"),new RegExp(t,i)}function p(t){if("^"===t.source||"^$"===t.source||"$"===t.source||"^\\s*$"===t.source)return!1;return!(!t.exec("")||0!==t.lastIndex)}function g(t){return(t.global?"g":"")+(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.unicode?"u":"")}function _(t){return t.split(/\r\n|\r|\n/)}function m(t){for(let e=0,n=t.length;e<n;e++){const n=t.charCodeAt(e);if(32!==n&&9!==n)return e}return-1}function v(t,e=0,n=t.length){for(let i=e;i<n;i++){const n=t.charCodeAt(i);if(32!==n&&9!==n)return t.substring(e,i)}return t.substring(e,n)}function y(t,e=t.length-1){for(let n=e;n>=0;n--){const e=t.charCodeAt(n);if(32!==e&&9!==e)return n}return-1}function b(t,e){return t<e?-1:t>e?1:0}function E(t,e,n=0,i=t.length,r=0,s=e.length){for(;n<i&&r<s;n++,r++){let i=t.charCodeAt(n),s=e.charCodeAt(r);if(i<s)return-1;if(i>s)return 1}const a=i-n,o=s-r;return a<o?-1:a>o?1:0}function w(t,e){return T(t,e,0,t.length,0,e.length)}function T(t,e,n=0,i=t.length,r=0,s=e.length){for(;n<i&&r<s;n++,r++){let a=t.charCodeAt(n),o=e.charCodeAt(r);if(a===o)continue;if(a>=128||o>=128)return E(t.toLowerCase(),e.toLowerCase(),n,i,r,s);k(a)&&(a-=32),k(o)&&(o-=32);const l=a-o;if(0!==l)return l}const a=i-n,o=s-r;return a<o?-1:a>o?1:0}function k(t){return t>=97&&t<=122}function S(t){return t>=65&&t<=90}function A(t,e){return t.length===e.length&&0===T(t,e)}function D(t,e){const n=e.length;return!(e.length>t.length)&&0===T(t,e,0,n)}function C(t,e){let n,i=Math.min(t.length,e.length);for(n=0;n<i;n++)if(t.charCodeAt(n)!==e.charCodeAt(n))return n;return i}function x(t,e){let n,i=Math.min(t.length,e.length);const r=t.length-1,s=e.length-1;for(n=0;n<i;n++)if(t.charCodeAt(r-n)!==e.charCodeAt(s-n))return n;return i}function R(t){return 55296<=t&&t<=56319}function L(t){return 56320<=t&&t<=57343}function I(t,e){return e-56320+(t-55296<<10)+65536}function P(t,e,n){const i=t.charCodeAt(n);if(R(i)&&n+1<e){const e=t.charCodeAt(n+1);if(L(e))return I(i,e)}return i}function O(t,e){const n=t.charCodeAt(e-1);if(L(n)&&e>1){const i=t.charCodeAt(e-2);if(R(i))return I(i,n)}return n}function F(t,e){const n=tt.getInstance(),i=e,r=t.length,s=P(t,r,e);e+=s>=65536?2:1;let a=n.getGraphemeBreakType(s);for(;e<r;){const i=P(t,r,e),s=n.getGraphemeBreakType(i);if(J(a,s))break;e+=i>=65536?2:1,a=s}return e-i}function M(t,e){const n=tt.getInstance(),i=e,r=O(t,e);e-=r>=65536?2:1;let s=n.getGraphemeBreakType(r);for(;e>0;){const i=O(t,e),r=n.getGraphemeBreakType(i);if(J(r,s))break;e-=i>=65536?2:1,s=r}return i-e}const N=/(?:[\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 B(t){return N.test(t)}const U=/(?:[\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 $(t){return U.test(t)}const G=/^[\t\n\r\x20-\x7E]*$/;function K(t){return G.test(t)}const j=/[\u2028\u2029]/;function V(t){return j.test(t)}function Z(t){for(let e=0,n=t.length;e<n;e++)if(z(t.charCodeAt(e)))return!0;return!1}function z(t){return(t=+t)>=11904&&t<=55215||t>=63744&&t<=64255||t>=65281&&t<=65374}function H(t){return t>=127462&&t<=127487||8986===t||8987===t||9200===t||9203===t||t>=9728&&t<=10175||11088===t||11093===t||t>=127744&&t<=128591||t>=128640&&t<=128764||t>=128992&&t<=129003||t>=129280&&t<=129535||t>=129648&&t<=129750}const W=String.fromCharCode(65279);function Y(t){return!!(t&&t.length>0&&65279===t.charCodeAt(0))}function q(t,e=!1){return!!t&&(e&&(t=t.replace(/\\./g,"")),t.toLowerCase()!==t)}function Q(t){return(t%=52)<26?String.fromCharCode(97+t):String.fromCharCode(65+t-26)}function X(t){return tt.getInstance().getGraphemeBreakType(t)}function J(t,e){return 0===t?5!==e&&7!==e:(2!==t||3!==e)&&(4===t||2===t||3===t||(4===e||2===e||3===e||(8!==t||8!==e&&9!==e&&11!==e&&12!==e)&&((11!==t&&9!==t||9!==e&&10!==e)&&((12!==t&&10!==t||10!==e)&&(5!==e&&13!==e&&(7!==e&&(1!==t&&((13!==t||14!==e)&&(6!==t||6!==e)))))))))}class tt{constructor(){this._data=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]")}static getInstance(){return tt._INSTANCE||(tt._INSTANCE=new tt),tt._INSTANCE}getGraphemeBreakType(t){if(t<32)return 10===t?3:13===t?2:4;if(t<127)return 0;const e=this._data,n=e.length/3;let i=1;for(;i<=n;)if(t<e[3*i])i*=2;else{if(!(t>e[3*i+1]))return e[3*i+2];i=2*i+1}return 0}}function et(t,e){if(0===t)return 0;const n=function(t,e){let n=O(e,t);t-=nt(n);for(;it(n)||65039===n||8419===n;){if(0===t)return;n=O(e,t),t-=nt(n)}if(!H(n))return;if(t>=0){const n=O(e,t);8205===n&&(t-=nt(n))}return t}(t,e);if(void 0!==n)return n;return t-=nt(O(e,t))}function nt(t){return t>=65536?2:1}function it(t){return 127995<=t&&t<=127999}tt._INSTANCE=null},72999:function(t,e,n){"use strict";function i(t){return Array.isArray(t)}function r(t){return"string"==typeof t}function s(t){return!("object"!=typeof t||null===t||Array.isArray(t)||t instanceof RegExp||t instanceof Date)}function a(t){return"number"==typeof t&&!isNaN(t)}function o(t){return!0===t||!1===t}function l(t){return void 0===t}function u(t){return!h(t)}function h(t){return l(t)||null===t}function c(t,e){if(!t)throw new Error(e?`Unexpected type, expected '${e}'`:"Unexpected type")}function d(t){if(h(t))throw new Error("Assertion Failed: argument is undefined or null");return t}function f(t){return"function"==typeof t}function p(t,e){const n=Math.min(t.length,e.length);for(let i=0;i<n;i++)g(t[i],e[i])}function g(t,e){if(r(e)){if(typeof t!==e)throw new Error(`argument does not match constraint: typeof ${e}`)}else if(f(e)){try{if(t instanceof e)return}catch(t){}if(!h(t)&&t.constructor===e)return;if(1===e.length&&!0===e.call(void 0,t))return;throw new Error("argument does not match one of these constraints: arg instanceof constraint, arg.constructor === constraint, nor constraint(arg) === true")}}function _(t){const e=[];for(const n of function(t){let e=[],n=Object.getPrototypeOf(t);for(;Object.prototype!==n;)e=e.concat(Object.getOwnPropertyNames(n)),n=Object.getPrototypeOf(n);return e}(t))"function"==typeof t[n]&&e.push(n);return e}function m(t,e){const n=t=>function(){const n=Array.prototype.slice.call(arguments,0);return e(t,n)};let i={};for(const e of t)i[e]=n(e);return i}function v(t){return null===t?void 0:t}function y(t,e="Unreachable"){throw new Error(e)}n.d(e,{$E:function(){return _},$K:function(){return u},D8:function(){return p},HD:function(){return r},IU:function(){return m},Jp:function(){return h},Kn:function(){return s},cW:function(){return d},f6:function(){return v},hj:function(){return a},jn:function(){return o},kJ:function(){return i},mf:function(){return f},o8:function(){return l},p_:function(){return c},vE:function(){return y}})},13268:function(t,e,n){"use strict";function i(t,e,...n){return function(t,e){let n;return n=0===e.length?t:t.replace(/\{(\d+)\}/g,(function(t,n){const i=n[0];return void 0!==e[i]?e[i]:t})),n}(e,n)}n.d(e,{N:function(){return i}})},96236:function(t,e,n){"use strict";n.d(e,{BH:function(){return v},NZ:function(){return y},U8:function(){return b},co:function(){return m},eH:function(){return _},vr:function(){return g}});var i=n(75918),r=n(52615),s=n(4348),a=n(88226),o=n(69323),l=n(34502),u=n(35884),h=n(90689),c=n(16925),d=n(49055),f=function(t,e,n,i){var r,s=arguments.length,a=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,i);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,n,a):r(e,n))||a);return s>3&&a&&Object.defineProperty(e,n,a),a},p=function(t,e){return function(n,i){e(n,i,t)}};function g(t){return void 0!==t.command}class _{constructor(t){this.id=_._idPool++,this._debugName=t}}_._idPool=0,_.CommandPalette=new _("CommandPalette"),_.EditorContext=new _("EditorContext"),_.SimpleEditorContext=new _("SimpleEditorContext"),_.EditorContextCopy=new _("EditorContextCopy"),_.EditorContextPeek=new _("EditorContextPeek"),_.MenubarEditMenu=new _("MenubarEditMenu"),_.MenubarCopy=new _("MenubarCopy"),_.MenubarGoMenu=new _("MenubarGoMenu"),_.MenubarSelectionMenu=new _("MenubarSelectionMenu"),_.InlineCompletionsActions=new _("InlineCompletionsActions");const m=(0,c.yh)("menuService"),v=new class{constructor(){this._commands=new Map,this._menuItems=new Map,this._onDidChangeMenu=new s.Q5,this.onDidChangeMenu=this._onDidChangeMenu.event,this._commandPaletteChangeEvent={has:t=>t===_.CommandPalette}}addCommand(t){return this.addCommands(a.$.single(t))}addCommands(t){for(const e of t)this._commands.set(e.id,e);return this._onDidChangeMenu.fire(this._commandPaletteChangeEvent),(0,o.OF)((()=>{let e=!1;for(const n of t)e=this._commands.delete(n.id)||e;e&&this._onDidChangeMenu.fire(this._commandPaletteChangeEvent)}))}getCommand(t){return this._commands.get(t)}getCommands(){const t=new Map;return this._commands.forEach(((e,n)=>t.set(n,e))),t}appendMenuItem(t,e){return this.appendMenuItems(a.$.single({id:t,item:e}))}appendMenuItems(t){const e=new Set,n=new l.S;for(const{id:i,item:r}of t){let t=this._menuItems.get(i);t||(t=new l.S,this._menuItems.set(i,t)),n.push(t.push(r)),e.add(i)}return this._onDidChangeMenu.fire(e),(0,o.OF)((()=>{if(n.size>0){for(let t of n)t();this._onDidChangeMenu.fire(e),n.clear()}}))}getMenuItems(t){let e;return e=this._menuItems.has(t)?[...this._menuItems.get(t)]:[],t===_.CommandPalette&&this._appendImplicitItems(e),e}_appendImplicitItems(t){const e=new Set;for(const n of t)g(n)&&(e.add(n.command.id),n.alt&&e.add(n.alt.id));this._commands.forEach(((n,i)=>{e.has(i)||t.push({command:n})}))}};class y extends i.wY{constructor(t,e,n,i){super(`submenuitem.${t.submenu.id}`,"string"==typeof t.title?t.title:t.title.value,[],"submenu"),this.item=t,this._menuService=e,this._contextKeyService=n,this._options=i}get actions(){const t=[],e=this._menuService.createMenu(this.item.submenu,this._contextKeyService),n=e.getActions(this._options);e.dispose();for(const[,e]of n)e.length>0&&(t.push(...e),t.push(new i.Z0));return t.length&&t.pop(),t}}let b=class t{constructor(e,n,i,s,a){var o,l;if(this._commandService=a,this.id=e.id,this.label=(null==i?void 0:i.renderShortTitle)&&e.shortTitle?"string"==typeof e.shortTitle?e.shortTitle:e.shortTitle.value:"string"==typeof e.title?e.title:e.title.value,this.tooltip=null!==(l="string"==typeof e.tooltip?e.tooltip:null===(o=e.tooltip)||void 0===o?void 0:o.value)&&void 0!==l?l:"",this.enabled=!e.precondition||s.contextMatchesRules(e.precondition),this.checked=void 0,e.toggled){const t=e.toggled.condition?e.toggled:{condition:e.toggled};this.checked=s.contextMatchesRules(t.condition),this.checked&&t.tooltip&&(this.tooltip="string"==typeof t.tooltip?t.tooltip:t.tooltip.value),t.title&&(this.label="string"==typeof t.title?t.title:t.title.value)}this.item=e,this.alt=n?new t(n,void 0,i,s,a):void 0,this._options=i,d.kS.isThemeIcon(e.icon)&&(this.class=r.dT.asClassName(e.icon))}dispose(){}run(...t){var e,n;let i=[];return(null===(e=this._options)||void 0===e?void 0:e.arg)&&(i=[...i,this._options.arg]),(null===(n=this._options)||void 0===n?void 0:n.shouldForwardArgs)&&(i=[...i,...t]),this._commandService.executeCommand(this.id,...i)}};b=f([p(3,h.i6),p(4,u.H)],b)},35884:function(t,e,n){"use strict";n.d(e,{H:function(){return l},P:function(){return u}});var i=n(4348),r=n(88226),s=n(69323),a=n(34502),o=n(72999);const l=(0,n(16925).yh)("commandService"),u=new class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new i.Q5,this.onDidRegisterCommand=this._onDidRegisterCommand.event}registerCommand(t,e){if(!t)throw new Error("invalid command");if("string"==typeof t){if(!e)throw new Error("invalid command");return this.registerCommand({id:t,handler:e})}if(t.description){const e=[];for(let n of t.description.args)e.push(n.constraint);const n=t.handler;t.handler=function(t,...i){return(0,o.D8)(i,e),n(t,...i)}}const{id:n}=t;let i=this._commands.get(n);i||(i=new a.S,this._commands.set(n,i));let r=i.unshift(t),l=(0,s.OF)((()=>{r();const t=this._commands.get(n);(null==t?void 0:t.isEmpty())&&this._commands.delete(n)}));return this._onDidRegisterCommand.fire(n),l}registerCommandAlias(t,e){return u.registerCommand(t,((t,...n)=>t.get(l).executeCommand(e,...n)))}getCommand(t){const e=this._commands.get(t);if(e&&!e.isEmpty())return r.$.first(e)}getCommands(){const t=new Map;for(const e of this._commands.keys()){const n=this.getCommand(e);n&&t.set(e,n)}return t}};u.registerCommand("noop",(()=>{}))},90689:function(t,e,n){"use strict";n.d(e,{Ao:function(){return u},Eq:function(){return I},Fb:function(){return h},K8:function(){return F},i6:function(){return L},uy:function(){return R}});var i=n(23345),r=n(82983),s=n(16925);let a=i.WE||"";const o=new Map;o.set("false",!1),o.set("true",!0),o.set("isMac",i.dz),o.set("isLinux",i.IJ),o.set("isWindows",i.ED),o.set("isWeb",i.$L),o.set("isMacNative",i.dz&&!i.$L),o.set("isEdge",a.indexOf("Edg/")>=0),o.set("isFirefox",a.indexOf("Firefox")>=0),o.set("isChrome",a.indexOf("Chrome")>=0),o.set("isSafari",a.indexOf("Safari")>=0);const l=Object.prototype.hasOwnProperty;class u{static has(t){return p.create(t)}static equals(t,e){return g.create(t,e)}static regex(t,e){return S.create(t,e)}static not(t){return y.create(t)}static and(...t){return C.create(t,null)}static or(...t){return x.create(t,null,!0)}static deserialize(t,e=!1){if(t)return this._deserializeOrExpression(t,e)}static _deserializeOrExpression(t,e){let n=t.split("||");return x.create(n.map((t=>this._deserializeAndExpression(t,e))),null,!0)}static _deserializeAndExpression(t,e){let n=t.split("&&");return C.create(n.map((t=>this._deserializeOne(t,e))),null)}static _deserializeOne(t,e){if((t=t.trim()).indexOf("!=")>=0){let n=t.split("!=");return v.create(n[0].trim(),this._deserializeValue(n[1],e))}if(t.indexOf("==")>=0){let n=t.split("==");return g.create(n[0].trim(),this._deserializeValue(n[1],e))}if(t.indexOf("=~")>=0){let n=t.split("=~");return S.create(n[0].trim(),this._deserializeRegexValue(n[1],e))}if(t.indexOf(" in ")>=0){let e=t.split(" in ");return _.create(e[0].trim(),e[1].trim())}if(/^[^<=>]+>=[^<=>]+$/.test(t)){const e=t.split(">=");return w.create(e[0].trim(),e[1].trim())}if(/^[^<=>]+>[^<=>]+$/.test(t)){const e=t.split(">");return E.create(e[0].trim(),e[1].trim())}if(/^[^<=>]+<=[^<=>]+$/.test(t)){const e=t.split("<=");return k.create(e[0].trim(),e[1].trim())}if(/^[^<=>]+<[^<=>]+$/.test(t)){const e=t.split("<");return T.create(e[0].trim(),e[1].trim())}return/^\!\s*/.test(t)?y.create(t.substr(1).trim()):p.create(t)}static _deserializeValue(t,e){if("true"===(t=t.trim()))return!0;if("false"===t)return!1;let n=/^'([^']*)'$/.exec(t);return n?n[1].trim():t}static _deserializeRegexValue(t,e){if((0,r.m5)(t)){if(e)throw new Error("missing regexp-value for =~-expression");return console.warn("missing regexp-value for =~-expression"),null}let n=t.indexOf("/"),i=t.lastIndexOf("/");if(n===i||n<0){if(e)throw new Error(`bad regexp-value '${t}', missing /-enclosure`);return console.warn(`bad regexp-value '${t}', missing /-enclosure`),null}let s=t.slice(n+1,i),a="i"===t[i+1]?"i":"";try{return new RegExp(s,a)}catch(n){if(e)throw new Error(`bad regexp-value '${t}', parse error: ${n}`);return console.warn(`bad regexp-value '${t}', parse error: ${n}`),null}}}function h(t,e){const n=t?t.substituteConstants():void 0,i=e?e.substituteConstants():void 0;return!n&&!i||!(!n||!i)&&n.equals(i)}function c(t,e){return t.cmp(e)}class d{constructor(){this.type=0}cmp(t){return this.type-t.type}equals(t){return t.type===this.type}substituteConstants(){return this}evaluate(t){return!1}serialize(){return"false"}keys(){return[]}negate(){return f.INSTANCE}}d.INSTANCE=new d;class f{constructor(){this.type=1}cmp(t){return this.type-t.type}equals(t){return t.type===this.type}substituteConstants(){return this}evaluate(t){return!0}serialize(){return"true"}keys(){return[]}negate(){return d.INSTANCE}}f.INSTANCE=new f;class p{constructor(t,e){this.key=t,this.negated=e,this.type=2}static create(t,e=null){const n=o.get(t);return"boolean"==typeof n?n?f.INSTANCE:d.INSTANCE:new p(t,e)}cmp(t){return t.type!==this.type?this.type-t.type:P(this.key,t.key)}equals(t){return t.type===this.type&&this.key===t.key}substituteConstants(){const t=o.get(this.key);return"boolean"==typeof t?t?f.INSTANCE:d.INSTANCE:this}evaluate(t){return!!t.getValue(this.key)}serialize(){return this.key}keys(){return[this.key]}negate(){return this.negated||(this.negated=y.create(this.key,this)),this.negated}}class g{constructor(t,e,n){this.key=t,this.value=e,this.negated=n,this.type=4}static create(t,e,n=null){if("boolean"==typeof e)return e?p.create(t,n):y.create(t,n);const i=o.get(t);if("boolean"==typeof i){return e===(i?"true":"false")?f.INSTANCE:d.INSTANCE}return new g(t,e,n)}cmp(t){return t.type!==this.type?this.type-t.type:O(this.key,this.value,t.key,t.value)}equals(t){return t.type===this.type&&(this.key===t.key&&this.value===t.value)}substituteConstants(){const t=o.get(this.key);if("boolean"==typeof t){const e=t?"true":"false";return this.value===e?f.INSTANCE:d.INSTANCE}return this}evaluate(t){return t.getValue(this.key)==this.value}serialize(){return`${this.key} == '${this.value}'`}keys(){return[this.key]}negate(){return this.negated||(this.negated=v.create(this.key,this.value,this)),this.negated}}class _{constructor(t,e){this.key=t,this.valueKey=e,this.type=10,this.negated=null}static create(t,e){return new _(t,e)}cmp(t){return t.type!==this.type?this.type-t.type:O(this.key,this.valueKey,t.key,t.valueKey)}equals(t){return t.type===this.type&&(this.key===t.key&&this.valueKey===t.valueKey)}substituteConstants(){return this}evaluate(t){const e=t.getValue(this.valueKey),n=t.getValue(this.key);return Array.isArray(e)?e.indexOf(n)>=0:"string"==typeof n&&"object"==typeof e&&null!==e&&l.call(e,n)}serialize(){return`${this.key} in '${this.valueKey}'`}keys(){return[this.key,this.valueKey]}negate(){return this.negated||(this.negated=m.create(this)),this.negated}}class m{constructor(t){this._actual=t,this.type=11}static create(t){return new m(t)}cmp(t){return t.type!==this.type?this.type-t.type:this._actual.cmp(t._actual)}equals(t){return t.type===this.type&&this._actual.equals(t._actual)}substituteConstants(){return this}evaluate(t){return!this._actual.evaluate(t)}serialize(){throw new Error("Method not implemented.")}keys(){return this._actual.keys()}negate(){return this._actual}}class v{constructor(t,e,n){this.key=t,this.value=e,this.negated=n,this.type=5}static create(t,e,n=null){if("boolean"==typeof e)return e?y.create(t,n):p.create(t,n);const i=o.get(t);if("boolean"==typeof i){return e===(i?"true":"false")?d.INSTANCE:f.INSTANCE}return new v(t,e,n)}cmp(t){return t.type!==this.type?this.type-t.type:O(this.key,this.value,t.key,t.value)}equals(t){return t.type===this.type&&(this.key===t.key&&this.value===t.value)}substituteConstants(){const t=o.get(this.key);if("boolean"==typeof t){const e=t?"true":"false";return this.value===e?d.INSTANCE:f.INSTANCE}return this}evaluate(t){return t.getValue(this.key)!=this.value}serialize(){return`${this.key} != '${this.value}'`}keys(){return[this.key]}negate(){return this.negated||(this.negated=g.create(this.key,this.value,this)),this.negated}}class y{constructor(t,e){this.key=t,this.negated=e,this.type=3}static create(t,e=null){const n=o.get(t);return"boolean"==typeof n?n?d.INSTANCE:f.INSTANCE:new y(t,e)}cmp(t){return t.type!==this.type?this.type-t.type:P(this.key,t.key)}equals(t){return t.type===this.type&&this.key===t.key}substituteConstants(){const t=o.get(this.key);return"boolean"==typeof t?t?d.INSTANCE:f.INSTANCE:this}evaluate(t){return!t.getValue(this.key)}serialize(){return`!${this.key}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=p.create(this.key,this)),this.negated}}function b(t,e){if("string"==typeof t){const e=parseFloat(t);isNaN(e)||(t=e)}return"string"==typeof t||"number"==typeof t?e(t):d.INSTANCE}class E{constructor(t,e,n){this.key=t,this.value=e,this.negated=n,this.type=12}static create(t,e,n=null){return b(e,(e=>new E(t,e,n)))}cmp(t){return t.type!==this.type?this.type-t.type:O(this.key,this.value,t.key,t.value)}equals(t){return t.type===this.type&&(this.key===t.key&&this.value===t.value)}substituteConstants(){return this}evaluate(t){return"string"!=typeof this.value&&parseFloat(t.getValue(this.key))>this.value}serialize(){return`${this.key} > ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=k.create(this.key,this.value,this)),this.negated}}class w{constructor(t,e,n){this.key=t,this.value=e,this.negated=n,this.type=13}static create(t,e,n=null){return b(e,(e=>new w(t,e,n)))}cmp(t){return t.type!==this.type?this.type-t.type:O(this.key,this.value,t.key,t.value)}equals(t){return t.type===this.type&&(this.key===t.key&&this.value===t.value)}substituteConstants(){return this}evaluate(t){return"string"!=typeof this.value&&parseFloat(t.getValue(this.key))>=this.value}serialize(){return`${this.key} >= ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=T.create(this.key,this.value,this)),this.negated}}class T{constructor(t,e,n){this.key=t,this.value=e,this.negated=n,this.type=14}static create(t,e,n=null){return b(e,(e=>new T(t,e,n)))}cmp(t){return t.type!==this.type?this.type-t.type:O(this.key,this.value,t.key,t.value)}equals(t){return t.type===this.type&&(this.key===t.key&&this.value===t.value)}substituteConstants(){return this}evaluate(t){return"string"!=typeof this.value&&parseFloat(t.getValue(this.key))<this.value}serialize(){return`${this.key} < ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=w.create(this.key,this.value,this)),this.negated}}class k{constructor(t,e,n){this.key=t,this.value=e,this.negated=n,this.type=15}static create(t,e,n=null){return b(e,(e=>new k(t,e,n)))}cmp(t){return t.type!==this.type?this.type-t.type:O(this.key,this.value,t.key,t.value)}equals(t){return t.type===this.type&&(this.key===t.key&&this.value===t.value)}substituteConstants(){return this}evaluate(t){return"string"!=typeof this.value&&parseFloat(t.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 S{constructor(t,e){this.key=t,this.regexp=e,this.type=7,this.negated=null}static create(t,e){return new S(t,e)}cmp(t){if(t.type!==this.type)return this.type-t.type;if(this.key<t.key)return-1;if(this.key>t.key)return 1;const e=this.regexp?this.regexp.source:"",n=t.regexp?t.regexp.source:"";return e<n?-1:e>n?1:0}equals(t){if(t.type===this.type){const e=this.regexp?this.regexp.source:"",n=t.regexp?t.regexp.source:"";return this.key===t.key&&e===n}return!1}substituteConstants(){return this}evaluate(t){let e=t.getValue(this.key);return!!this.regexp&&this.regexp.test(e)}serialize(){const t=this.regexp?`/${this.regexp.source}/${this.regexp.ignoreCase?"i":""}`:"/invalid/";return`${this.key} =~ ${t}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=A.create(this)),this.negated}}class A{constructor(t){this._actual=t,this.type=8}static create(t){return new A(t)}cmp(t){return t.type!==this.type?this.type-t.type:this._actual.cmp(t._actual)}equals(t){return t.type===this.type&&this._actual.equals(t._actual)}substituteConstants(){return this}evaluate(t){return!this._actual.evaluate(t)}serialize(){throw new Error("Method not implemented.")}keys(){return this._actual.keys()}negate(){return this._actual}}function D(t){let e=null;for(let n=0,i=t.length;n<i;n++){const i=t[n].substituteConstants();if(t[n]!==i&&null===e){e=[];for(let i=0;i<n;i++)e[i]=t[i]}null!==e&&(e[n]=i)}return null===e?t:e}class C{constructor(t,e){this.expr=t,this.negated=e,this.type=6}static create(t,e){return C._normalizeArr(t,e)}cmp(t){if(t.type!==this.type)return this.type-t.type;if(this.expr.length<t.expr.length)return-1;if(this.expr.length>t.expr.length)return 1;for(let e=0,n=this.expr.length;e<n;e++){const n=c(this.expr[e],t.expr[e]);if(0!==n)return n}return 0}equals(t){if(t.type===this.type){if(this.expr.length!==t.expr.length)return!1;for(let e=0,n=this.expr.length;e<n;e++)if(!this.expr[e].equals(t.expr[e]))return!1;return!0}return!1}substituteConstants(){const t=D(this.expr);return t===this.expr?this:C.create(t,this.negated)}evaluate(t){for(let e=0,n=this.expr.length;e<n;e++)if(!this.expr[e].evaluate(t))return!1;return!0}static _normalizeArr(t,e){const n=[];let i=!1;for(const e of t)if(e)if(1!==e.type){if(0===e.type)return d.INSTANCE;6!==e.type?n.push(e):n.push(...e.expr)}else i=!0;if(0===n.length&&i)return f.INSTANCE;if(0!==n.length){if(1===n.length)return n[0];n.sort(c);for(let t=1;t<n.length;t++)n[t-1].equals(n[t])&&(n.splice(t,1),t--);if(1===n.length)return n[0];for(;n.length>1;){const t=n[n.length-1];if(9!==t.type)break;n.pop();const e=n.pop(),i=0===n.length,r=x.create(t.expr.map((t=>C.create([t,e],null))),null,i);r&&(n.push(r),n.sort(c))}return 1===n.length?n[0]:new C(n,e)}}serialize(){return this.expr.map((t=>t.serialize())).join(" && ")}keys(){const t=[];for(let e of this.expr)t.push(...e.keys());return t}negate(){if(!this.negated){const t=[];for(let e of this.expr)t.push(e.negate());this.negated=x.create(t,this,!0)}return this.negated}}class x{constructor(t,e){this.expr=t,this.negated=e,this.type=9}static create(t,e,n){return x._normalizeArr(t,e,n)}cmp(t){if(t.type!==this.type)return this.type-t.type;if(this.expr.length<t.expr.length)return-1;if(this.expr.length>t.expr.length)return 1;for(let e=0,n=this.expr.length;e<n;e++){const n=c(this.expr[e],t.expr[e]);if(0!==n)return n}return 0}equals(t){if(t.type===this.type){if(this.expr.length!==t.expr.length)return!1;for(let e=0,n=this.expr.length;e<n;e++)if(!this.expr[e].equals(t.expr[e]))return!1;return!0}return!1}substituteConstants(){const t=D(this.expr);return t===this.expr?this:x.create(t,this.negated,!1)}evaluate(t){for(let e=0,n=this.expr.length;e<n;e++)if(this.expr[e].evaluate(t))return!0;return!1}static _normalizeArr(t,e,n){let i=[],r=!1;if(t){for(let e=0,n=t.length;e<n;e++){const n=t[e];if(n)if(0!==n.type){if(1===n.type)return f.INSTANCE;9!==n.type?i.push(n):i=i.concat(n.expr)}else r=!0}if(0===i.length&&r)return d.INSTANCE;i.sort(c)}if(0!==i.length){if(1===i.length)return i[0];for(let t=1;t<i.length;t++)i[t-1].equals(i[t])&&(i.splice(t,1),t--);if(1===i.length)return i[0];if(n){for(let t=0;t<i.length;t++)for(let e=t+1;e<i.length;e++)F(i[t],i[e])&&(i.splice(e,1),e--);if(1===i.length)return i[0]}return new x(i,e)}}serialize(){return this.expr.map((t=>t.serialize())).join(" || ")}keys(){const t=[];for(let e of this.expr)t.push(...e.keys());return t}negate(){if(!this.negated){let t=[];for(let e of this.expr)t.push(e.negate());for(;t.length>1;){const e=t.shift(),n=t.shift(),i=[];for(const t of M(e))for(const e of M(n))i.push(C.create([t,e],null));const r=0===t.length;t.unshift(x.create(i,null,r))}this.negated=t[0]}return this.negated}}class R extends p{constructor(t,e,n){super(t,null),this._defaultValue=e,"object"==typeof n?R._info.push(Object.assign(Object.assign({},n),{key:t})):!0!==n&&R._info.push({key:t,description:n,type:null!=e?typeof e:void 0})}static all(){return R._info.values()}bindTo(t){return t.createKey(this.key,this._defaultValue)}getValue(t){return t.getContextKeyValue(this.key)}toNegated(){return this.negate()}isEqualTo(t){return g.create(this.key,t)}}R._info=[];const L=(0,s.yh)("contextKeyService"),I="setContext";function P(t,e){return t<e?-1:t>e?1:0}function O(t,e,n,i){return t<n?-1:t>n?1:e<i?-1:e>i?1:0}function F(t,e){if(6===e.type&&9!==t.type&&6!==t.type)for(const n of e.expr)if(t.equals(n))return!0;const n=M(t.negate()).concat(M(e));n.sort(c);for(let t=0;t<n.length;t++){const e=n[t].negate();for(let i=t+1;i<n.length;i++){const t=n[i];if(e.equals(t))return!0}}return!1}function M(t){return 9===t.type?t.expr:[t]}},16925:function(t,e,n){"use strict";var i;n.d(e,{I8:function(){return i},TG:function(){return r},jt:function(){return o},yh:function(){return a}}),function(t){t.serviceIds=new Map,t.DI_TARGET="$di$target",t.DI_DEPENDENCIES="$di$dependencies",t.getServiceDependencies=function(e){return e[t.DI_DEPENDENCIES]||[]}}(i||(i={}));const r=a("instantiationService");function s(t,e,n,r){e[i.DI_TARGET]===e?e[i.DI_DEPENDENCIES].push({id:t,index:n,optional:r}):(e[i.DI_DEPENDENCIES]=[{id:t,index:n,optional:r}],e[i.DI_TARGET]=e)}function a(t){if(i.serviceIds.has(t))return i.serviceIds.get(t);const e=function(t,n,i){if(3!==arguments.length)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");s(e,t,i,!1)};return e.toString=()=>t,i.serviceIds.set(t,e),e}function o(t){return function(e,n,i){if(3!==arguments.length)throw new Error("@optional-decorator can only be used to decorate a parameter");s(t,e,i,!0)}}},44650:function(t,e,n){"use strict";n.d(e,{B:function(){return s}});var i=n(76068),r=n(72999);const s=new class{constructor(){this.data=new Map}add(t,e){i.ok(r.HD(t)),i.ok(r.Kn(e)),i.ok(!this.data.has(t),"There is already an extension with this id"),this.data.set(t,e)}as(t){return this.data.get(t)||null}}},66213:function(t,e,n){"use strict";var i;n.d(e,{e:function(){return i}}),function(t){t.DARK="dark",t.LIGHT="light",t.HIGH_CONTRAST="hc"}(i||(i={}))},49055:function(t,e,n){"use strict";n.d(e,{EN:function(){return d},IP:function(){return p},Ic:function(){return _},XE:function(){return u},bB:function(){return m},kS:function(){return c},m6:function(){return f}});var i=n(52615),r=n(4348),s=n(69323),a=n(16925),o=n(44650),l=n(66213);const u=(0,a.yh)("themeService");var h,c;function d(t){return{id:t}}function f(t){switch(t){case l.e.DARK:return"vs-dark";case l.e.HIGH_CONTRAST:return"hc-black";default:return"vs"}}!function(t){t.isThemeColor=function(t){return t&&"object"==typeof t&&"string"==typeof t.id}}(h||(h={})),function(t){t.isThemeIcon=function(t){return t&&"object"==typeof t&&"string"==typeof t.id&&(void 0===t.color||h.isThemeColor(t.color))};const e=new RegExp(`^\\$\\((${i.dT.iconNameExpression}(?:${i.dT.iconModifierExpression})?)\\)$`);t.fromString=function(t){const n=e.exec(t);if(!n)return;let[,i]=n;return{id:i}},t.modify=function(t,e){let n=t.id;const i=n.lastIndexOf("~");return-1!==i&&(n=n.substring(0,i)),e&&(n=`${n}~${e}`),{id:n}},t.isEqual=function(t,e){var n,i;return t.id===e.id&&(null===(n=t.color)||void 0===n?void 0:n.id)===(null===(i=e.color)||void 0===i?void 0:i.id)},t.asThemeIcon=function(t,e){return{id:t.id,color:e?d(e):void 0}},t.asClassNameArray=i.dT.asClassNameArray,t.asClassName=i.dT.asClassName,t.asCSSSelector=i.dT.asCSSSelector}(c||(c={}));const p={ThemingContribution:"base.contributions.theming"};let g=new class{constructor(){this.themingParticipants=[],this.themingParticipants=[],this.onThemingParticipantAddedEmitter=new r.Q5}onColorThemeChange(t){return this.themingParticipants.push(t),this.onThemingParticipantAddedEmitter.fire(t),(0,s.OF)((()=>{const e=this.themingParticipants.indexOf(t);this.themingParticipants.splice(e,1)}))}getThemingParticipants(){return this.themingParticipants}};function _(t){return g.onColorThemeChange(t)}o.B.add(p.ThemingContribution,g);class m extends s.JT{constructor(t){super(),this.themeService=t,this.theme=t.getColorTheme(),this._register(this.themeService.onDidColorThemeChange((t=>this.onThemeChange(t))))}onThemeChange(t){this.theme=t,this.updateStyles()}updateStyles(){}}},16632:function(t,e,n){"use strict";var i=n(54476),r=n(33885),s=n(20068),a=n(42978),o=n(75931),l=n(92310),u=n.n(l),h=n(18929),c=n(59301),d=["prefixCls","className","style","checked","disabled","defaultChecked","type","title","onChange"],f=(0,c.forwardRef)((function(t,e){var n=t.prefixCls,l=void 0===n?"rc-checkbox":n,f=t.className,p=t.style,g=t.checked,_=t.disabled,m=t.defaultChecked,v=void 0!==m&&m,y=t.type,b=void 0===y?"checkbox":y,E=t.title,w=t.onChange,T=(0,o.Z)(t,d),k=(0,c.useRef)(null),S=(0,c.useRef)(null),A=(0,h.Z)(v,{value:g}),D=(0,a.Z)(A,2),C=D[0],x=D[1];(0,c.useImperativeHandle)(e,(function(){return{focus:function(t){var e;null===(e=k.current)||void 0===e||e.focus(t)},blur:function(){var t;null===(t=k.current)||void 0===t||t.blur()},input:k.current,nativeElement:S.current}}));var R=u()(l,f,(0,s.Z)((0,s.Z)({},"".concat(l,"-checked"),C),"".concat(l,"-disabled"),_));return c.createElement("span",{className:R,title:E,style:p,ref:S},c.createElement("input",(0,i.Z)({},T,{className:"".concat(l,"-input"),ref:k,onChange:function(e){_||("checked"in t||x(e.target.checked),null==w||w({target:(0,r.Z)((0,r.Z)({},t),{},{type:b,checked:e.target.checked}),stopPropagation:function(){e.stopPropagation()},preventDefault:function(){e.preventDefault()},nativeEvent:e.nativeEvent}))},disabled:_,checked:!!C,type:b})),c.createElement("span",{className:"".concat(l,"-inner")}))}));e.Z=f},96478:function(t,e,n){"use strict";n.d(e,{Z:function(){return w}});var i=n(54476),r=n(20068),s=n(42978),a=n(75931),o=n(65030),l=n(92310),u=n.n(l),h=n(8654),c=n(59301),d=n(10228),f=n(16089),p=d.Z.ESC,g=d.Z.TAB;var _=(0,c.forwardRef)((function(t,e){var n=t.overlay,i=t.arrow,r=t.prefixCls,s=(0,c.useMemo)((function(){return"function"==typeof n?n():n}),[n]),a=(0,h.sQ)(e,(0,h.C4)(s));return c.createElement(c.Fragment,null,i&&c.createElement("div",{className:"".concat(r,"-arrow")}),c.cloneElement(s,{ref:(0,h.Yr)(s)?a:void 0}))})),m={adjustX:1,adjustY:1},v=[0,0],y={topLeft:{points:["bl","tl"],overflow:m,offset:[0,-4],targetOffset:v},top:{points:["bc","tc"],overflow:m,offset:[0,-4],targetOffset:v},topRight:{points:["br","tr"],overflow:m,offset:[0,-4],targetOffset:v},bottomLeft:{points:["tl","bl"],overflow:m,offset:[0,4],targetOffset:v},bottom:{points:["tc","bc"],overflow:m,offset:[0,4],targetOffset:v},bottomRight:{points:["tr","br"],overflow:m,offset:[0,4],targetOffset:v}},b=["arrow","prefixCls","transitionName","animation","align","placement","placements","getPopupContainer","showAction","hideAction","overlayClassName","overlayStyle","visible","trigger","autoFocus","overlay","children","onVisibleChange"];function E(t,e){var n,l=t.arrow,d=void 0!==l&&l,m=t.prefixCls,v=void 0===m?"rc-dropdown":m,E=t.transitionName,w=t.animation,T=t.align,k=t.placement,S=void 0===k?"bottomLeft":k,A=t.placements,D=void 0===A?y:A,C=t.getPopupContainer,x=t.showAction,R=t.hideAction,L=t.overlayClassName,I=t.overlayStyle,P=t.visible,O=t.trigger,F=void 0===O?["hover"]:O,M=t.autoFocus,N=t.overlay,B=t.children,U=t.onVisibleChange,$=(0,a.Z)(t,b),G=c.useState(),K=(0,s.Z)(G,2),j=K[0],V=K[1],Z="visible"in t?P:j,z=c.useRef(null),H=c.useRef(null),W=c.useRef(null);c.useImperativeHandle(e,(function(){return z.current}));var Y=function(t){V(t),null==U||U(t)};!function(t){var e=t.visible,n=t.triggerRef,i=t.onVisibleChange,r=t.autoFocus,s=t.overlayRef,a=c.useRef(!1),o=function(){var t,r;e&&(null===(t=n.current)||void 0===t||null===(r=t.focus)||void 0===r||r.call(t),null==i||i(!1))},l=function(){var t;return!(null===(t=s.current)||void 0===t||!t.focus||(s.current.focus(),a.current=!0,0))},u=function(t){switch(t.keyCode){case p:o();break;case g:var e=!1;a.current||(e=l()),e?t.preventDefault():o()}};c.useEffect((function(){return e?(window.addEventListener("keydown",u),r&&(0,f.Z)(l,3),function(){window.removeEventListener("keydown",u),a.current=!1}):function(){a.current=!1}}),[e])}({visible:Z,triggerRef:W,onVisibleChange:Y,autoFocus:M,overlayRef:H});var q,Q,X,J=function(){return c.createElement(_,{ref:H,overlay:N,prefixCls:v,arrow:d})},tt=c.cloneElement(B,{className:u()(null===(n=B.props)||void 0===n?void 0:n.className,Z&&(q=t.openClassName,void 0!==q?q:"".concat(v,"-open"))),ref:(0,h.Yr)(B)?(0,h.sQ)(W,(0,h.C4)(B)):void 0}),et=R;return et||-1===F.indexOf("contextMenu")||(et=["click"]),c.createElement(o.Z,(0,i.Z)({builtinPlacements:D},$,{prefixCls:v,ref:z,popupClassName:u()(L,(0,r.Z)({},"".concat(v,"-show-arrow"),d)),popupStyle:I,action:F,showAction:x,hideAction:et,popupPlacement:S,popupAlign:T,popupTransitionName:E,popupAnimation:w,popupVisible:Z,stretch:(Q=t.minOverlayWidthMatchTrigger,X=t.alignPoint,("minOverlayWidthMatchTrigger"in t?Q:!X)?"minWidth":""),popup:"function"==typeof N?J:J(),onPopupVisibleChange:Y,onPopupClick:function(e){var n=t.onOverlayClick;V(!1),n&&n(e)},getPopupContainer:C}),tt)}var w=c.forwardRef(E)},66003:function(t,e,n){"use strict";n.d(e,{Z:function(){return l}});var i=n(75931),r=n(33885),s=n(76190),a=n(59301),o=["show"];function l(t,e){return a.useMemo((function(){var n={};e&&(n.show="object"===(0,s.Z)(e)&&e.formatter?e.formatter:!!e);var a=n=(0,r.Z)((0,r.Z)({},n),t),l=a.show,u=(0,i.Z)(a,o);return(0,r.Z)((0,r.Z)({},u),{},{show:!!l,showFormatter:"function"==typeof l?l:void 0,strategy:u.strategy||function(t){return t.length}})}),[t,e])}},36901:function(t,e,n){"use strict";n.r(e),n.d(e,{BaseInput:function(){return c},default:function(){return y}});var i=n(33885),r=n(54476),s=n(20068),a=n(76190),o=n(92310),l=n.n(o),u=n(59301),h=n(30292),c=u.forwardRef((function(t,e){var n,o,c,d=t.inputElement,f=t.children,p=t.prefixCls,g=t.prefix,_=t.suffix,m=t.addonBefore,v=t.addonAfter,y=t.className,b=t.style,E=t.disabled,w=t.readOnly,T=t.focused,k=t.triggerFocus,S=t.allowClear,A=t.value,D=t.handleReset,C=t.hidden,x=t.classes,R=t.classNames,L=t.dataAttrs,I=t.styles,P=t.components,O=t.onClear,F=null!=f?f:d,M=(null==P?void 0:P.affixWrapper)||"span",N=(null==P?void 0:P.groupWrapper)||"span",B=(null==P?void 0:P.wrapper)||"span",U=(null==P?void 0:P.groupAddon)||"span",$=(0,u.useRef)(null),G=(0,h.X3)(t),K=(0,u.cloneElement)(F,{value:A,className:l()(null===(n=F.props)||void 0===n?void 0:n.className,!G&&(null==R?void 0:R.variant))||null}),j=(0,u.useRef)(null);if(u.useImperativeHandle(e,(function(){return{nativeElement:j.current||$.current}})),G){var V=null;if(S){var Z=!E&&!w&&A,z="".concat(p,"-clear-icon"),H="object"===(0,a.Z)(S)&&null!=S&&S.clearIcon?S.clearIcon:"✖";V=u.createElement("button",{type:"button",tabIndex:-1,onClick:function(t){null==D||D(t),null==O||O()},onMouseDown:function(t){return t.preventDefault()},className:l()(z,(0,s.Z)((0,s.Z)({},"".concat(z,"-hidden"),!Z),"".concat(z,"-has-suffix"),!!_))},H)}var W="".concat(p,"-affix-wrapper"),Y=l()(W,(0,s.Z)((0,s.Z)((0,s.Z)((0,s.Z)((0,s.Z)({},"".concat(p,"-disabled"),E),"".concat(W,"-disabled"),E),"".concat(W,"-focused"),T),"".concat(W,"-readonly"),w),"".concat(W,"-input-with-clear-btn"),_&&S&&A),null==x?void 0:x.affixWrapper,null==R?void 0:R.affixWrapper,null==R?void 0:R.variant),q=(_||S)&&u.createElement("span",{className:l()("".concat(p,"-suffix"),null==R?void 0:R.suffix),style:null==I?void 0:I.suffix},V,_);K=u.createElement(M,(0,r.Z)({className:Y,style:null==I?void 0:I.affixWrapper,onClick:function(t){var e;null!==(e=$.current)&&void 0!==e&&e.contains(t.target)&&(null==k||k())}},null==L?void 0:L.affixWrapper,{ref:$}),g&&u.createElement("span",{className:l()("".concat(p,"-prefix"),null==R?void 0:R.prefix),style:null==I?void 0:I.prefix},g),K,q)}if((0,h.He)(t)){var Q="".concat(p,"-group"),X="".concat(Q,"-addon"),J="".concat(Q,"-wrapper"),tt=l()("".concat(p,"-wrapper"),Q,null==x?void 0:x.wrapper,null==R?void 0:R.wrapper),et=l()(J,(0,s.Z)({},"".concat(J,"-disabled"),E),null==x?void 0:x.group,null==R?void 0:R.groupWrapper);K=u.createElement(N,{className:et,ref:j},u.createElement(B,{className:tt},m&&u.createElement(U,{className:X},m),K,v&&u.createElement(U,{className:X},v)))}return u.cloneElement(K,{className:l()(null===(o=K.props)||void 0===o?void 0:o.className,y)||null,style:(0,i.Z)((0,i.Z)({},null===(c=K.props)||void 0===c?void 0:c.style),b),hidden:C})})),d=n(94480),f=n(42978),p=n(75931),g=n(18929),_=n(2738),m=n(66003),v=["autoComplete","onChange","onFocus","onBlur","onPressEnter","onKeyDown","onKeyUp","prefixCls","disabled","htmlSize","className","maxLength","suffix","showCount","count","type","classes","classNames","styles","onCompositionStart","onCompositionEnd"],y=(0,u.forwardRef)((function(t,e){var n=t.autoComplete,a=t.onChange,o=t.onFocus,y=t.onBlur,b=t.onPressEnter,E=t.onKeyDown,w=t.onKeyUp,T=t.prefixCls,k=void 0===T?"rc-input":T,S=t.disabled,A=t.htmlSize,D=t.className,C=t.maxLength,x=t.suffix,R=t.showCount,L=t.count,I=t.type,P=void 0===I?"text":I,O=t.classes,F=t.classNames,M=t.styles,N=t.onCompositionStart,B=t.onCompositionEnd,U=(0,p.Z)(t,v),$=(0,u.useState)(!1),G=(0,f.Z)($,2),K=G[0],j=G[1],V=(0,u.useRef)(!1),Z=(0,u.useRef)(!1),z=(0,u.useRef)(null),H=(0,u.useRef)(null),W=function(t){z.current&&(0,h.nH)(z.current,t)},Y=(0,g.Z)(t.defaultValue,{value:t.value}),q=(0,f.Z)(Y,2),Q=q[0],X=q[1],J=null==Q?"":String(Q),tt=(0,u.useState)(null),et=(0,f.Z)(tt,2),nt=et[0],it=et[1],rt=(0,m.Z)(L,R),st=rt.max||C,at=rt.strategy(J),ot=!!st&&at>st;(0,u.useImperativeHandle)(e,(function(){var t;return{focus:W,blur:function(){var t;null===(t=z.current)||void 0===t||t.blur()},setSelectionRange:function(t,e,n){var i;null===(i=z.current)||void 0===i||i.setSelectionRange(t,e,n)},select:function(){var t;null===(t=z.current)||void 0===t||t.select()},input:z.current,nativeElement:(null===(t=H.current)||void 0===t?void 0:t.nativeElement)||z.current}})),(0,u.useEffect)((function(){Z.current&&(Z.current=!1),j((function(t){return(!t||!S)&&t}))}),[S]);var lt=function(t,e,n){var i,r,s=e;if(!V.current&&rt.exceedFormatter&&rt.max&&rt.strategy(e)>rt.max)e!==(s=rt.exceedFormatter(e,{max:rt.max}))&&it([(null===(i=z.current)||void 0===i?void 0:i.selectionStart)||0,(null===(r=z.current)||void 0===r?void 0:r.selectionEnd)||0]);else if("compositionEnd"===n.source)return;X(s),z.current&&(0,h.rJ)(z.current,t,a,s)};(0,u.useEffect)((function(){var t;nt&&(null===(t=z.current)||void 0===t||t.setSelectionRange.apply(t,(0,d.Z)(nt)))}),[nt]);var ut,ht=function(t){lt(t,t.target.value,{source:"change"})},ct=function(t){V.current=!1,lt(t,t.currentTarget.value,{source:"compositionEnd"}),null==B||B(t)},dt=function(t){b&&"Enter"===t.key&&!Z.current&&(Z.current=!0,b(t)),null==E||E(t)},ft=function(t){"Enter"===t.key&&(Z.current=!1),null==w||w(t)},pt=function(t){j(!0),null==o||o(t)},gt=function(t){Z.current&&(Z.current=!1),j(!1),null==y||y(t)},_t=ot&&"".concat(k,"-out-of-range");return u.createElement(c,(0,r.Z)({},U,{prefixCls:k,className:l()(D,_t),handleReset:function(t){X(""),W(),z.current&&(0,h.rJ)(z.current,t,a)},value:J,focused:K,triggerFocus:W,suffix:function(){var t=Number(st)>0;if(x||rt.show){var e=rt.showFormatter?rt.showFormatter({value:J,count:at,maxLength:st}):"".concat(at).concat(t?" / ".concat(st):"");return u.createElement(u.Fragment,null,rt.show&&u.createElement("span",{className:l()("".concat(k,"-show-count-suffix"),(0,s.Z)({},"".concat(k,"-show-count-has-suffix"),!!x),null==F?void 0:F.count),style:(0,i.Z)({},null==M?void 0:M.count)},e),x)}return null}(),disabled:S,classes:O,classNames:F,styles:M}),(ut=(0,_.Z)(t,["prefixCls","onPressEnter","addonBefore","addonAfter","prefix","suffix","allowClear","defaultValue","showCount","count","classes","htmlSize","styles","classNames","onClear"]),u.createElement("input",(0,r.Z)({autoComplete:n},ut,{onChange:ht,onFocus:pt,onBlur:gt,onKeyDown:dt,onKeyUp:ft,className:l()(k,(0,s.Z)({},"".concat(k,"-disabled"),S),null==F?void 0:F.input),style:null==M?void 0:M.input,ref:z,size:A,type:P,onCompositionStart:function(t){V.current=!0,null==N||N(t)},onCompositionEnd:ct}))))}))},30292:function(t,e,n){"use strict";function i(t){return!(!t.addonBefore&&!t.addonAfter)}function r(t){return!!(t.prefix||t.suffix||t.allowClear)}function s(t,e,n){var i=e.cloneNode(!0),r=Object.create(t,{target:{value:i},currentTarget:{value:i}});return i.value=n,"number"==typeof e.selectionStart&&"number"==typeof e.selectionEnd&&(i.selectionStart=e.selectionStart,i.selectionEnd=e.selectionEnd),i.setSelectionRange=function(){e.setSelectionRange.apply(e,arguments)},r}function a(t,e,n,i){if(n){var r=e;"click"!==e.type?"file"===t.type||void 0===i?n(r):n(r=s(e,t,i)):n(r=s(e,t,""))}}function o(t,e){if(t){t.focus(e);var n=(e||{}).cursor;if(n){var i=t.value.length;switch(n){case"start":t.setSelectionRange(0,0);break;case"end":t.setSelectionRange(i,i);break;default:t.setSelectionRange(0,i)}}}}n.d(e,{He:function(){return i},X3:function(){return r},nH:function(){return o},rJ:function(){return a}})},28321:function(t,e,n){"use strict";n.d(e,{iz:function(){return $t},ck:function(){return yt},BW:function(){return jt},sN:function(){return yt},Wd:function(){return Bt},ZP:function(){return Qt},Xl:function(){return C}});var i=n(54476),r=n(20068),s=n(33885),a=n(94480),o=n(42978),l=n(75931),u=n(92310),h=n.n(u),c=n(11780),d=n(18929),f=n(13697),p=n(48736),g=n(59301),_=n(4676),m=g.createContext(null);function v(t,e){return void 0===t?null:"".concat(t,"-").concat(e)}function y(t){return v(g.useContext(m),t)}var b=n(80547),E=["children","locked"],w=g.createContext(null);function T(t){var e=t.children,n=t.locked,i=(0,l.Z)(t,E),r=g.useContext(w),a=(0,b.Z)((function(){return t=r,e=i,n=(0,s.Z)({},t),Object.keys(e).forEach((function(t){var i=e[t];void 0!==i&&(n[t]=i)})),n;var t,e,n}),[r,i],(function(t,e){return!(n||t[0]===e[0]&&(0,f.Z)(t[1],e[1],!0))}));return g.createElement(w.Provider,{value:a},e)}var k=[],S=g.createContext(null);function A(){return g.useContext(S)}var D=g.createContext(k);function C(t){var e=g.useContext(D);return g.useMemo((function(){return void 0!==t?[].concat((0,a.Z)(e),[t]):e}),[e,t])}var x=g.createContext(null),R=g.createContext({}),L=n(29194);function I(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if((0,L.Z)(t)){var n=t.nodeName.toLowerCase(),i=["input","select","textarea","button"].includes(n)||t.isContentEditable||"a"===n&&!!t.getAttribute("href"),r=t.getAttribute("tabindex"),s=Number(r),a=null;return r&&!Number.isNaN(s)?a=s:i&&null===a&&(a=0),i&&t.disabled&&(a=null),null!==a&&(a>=0||e&&a<0)}return!1}function P(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=(0,a.Z)(t.querySelectorAll("*")).filter((function(t){return I(t,e)}));return I(t,e)&&n.unshift(t),n}var O=n(10228),F=n(16089),M=O.Z.LEFT,N=O.Z.RIGHT,B=O.Z.UP,U=O.Z.DOWN,$=O.Z.ENTER,G=O.Z.ESC,K=O.Z.HOME,j=O.Z.END,V=[B,U,M,N];function Z(t,e){return P(t,!0).filter((function(t){return e.has(t)}))}function z(t,e,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;if(!t)return null;var r=Z(t,e),s=r.length,a=r.findIndex((function(t){return n===t}));return i<0?-1===a?a=s-1:a-=1:i>0&&(a+=1),r[a=(a+s)%s]}var H=function(t,e){var n=new Set,i=new Map,r=new Map;return t.forEach((function(t){var s=document.querySelector("[data-menu-id='".concat(v(e,t),"']"));s&&(n.add(s),r.set(s,t),i.set(t,s))})),{elements:n,key2element:i,element2key:r}};function W(t,e,n,i,s,a,o,l,u,h){var c=g.useRef(),d=g.useRef();d.current=e;var f=function(){F.Z.cancel(c.current)};return g.useEffect((function(){return function(){f()}}),[]),function(p){var g=p.which;if([].concat(V,[$,G,K,j]).includes(g)){var _=a(),m=H(_,i),v=m,y=v.elements,b=v.key2element,E=v.element2key,w=function(t,e){for(var n=t||document.activeElement;n;){if(e.has(n))return n;n=n.parentElement}return null}(b.get(e),y),T=E.get(w),k=function(t,e,n,i){var s,a="prev",o="next",l="children",u="parent";if("inline"===t&&i===$)return{inlineTrigger:!0};var h=(0,r.Z)((0,r.Z)({},B,a),U,o),c=(0,r.Z)((0,r.Z)((0,r.Z)((0,r.Z)({},M,n?o:a),N,n?a:o),U,l),$,l),d=(0,r.Z)((0,r.Z)((0,r.Z)((0,r.Z)((0,r.Z)((0,r.Z)({},B,a),U,o),$,l),G,u),M,n?l:u),N,n?u:l);switch(null===(s={inline:h,horizontal:c,vertical:d,inlineSub:h,horizontalSub:d,verticalSub:d}["".concat(t).concat(e?"":"Sub")])||void 0===s?void 0:s[i]){case a:return{offset:-1,sibling:!0};case o:return{offset:1,sibling:!0};case u:return{offset:-1,sibling:!1};case l:return{offset:1,sibling:!1};default:return null}}(t,1===o(T,!0).length,n,g);if(!k&&g!==K&&g!==j)return;(V.includes(g)||[K,j].includes(g))&&p.preventDefault();var S=function(t){if(t){var e=t,n=t.querySelector("a");null!=n&&n.getAttribute("href")&&(e=n);var i=E.get(t);l(i),f(),c.current=(0,F.Z)((function(){d.current===i&&e.focus()}))}};if([K,j].includes(g)||k.sibling||!w){var A,D,C=Z(A=w&&"inline"!==t?function(t){for(var e=t;e;){if(e.getAttribute("data-menu-list"))return e;e=e.parentElement}return null}(w):s.current,y);D=g===K?C[0]:g===j?C[C.length-1]:z(A,y,w,k.offset),S(D)}else if(k.inlineTrigger)u(T);else if(k.offset>0)u(T,!0),f(),c.current=(0,F.Z)((function(){m=H(_,i);var t=w.getAttribute("aria-controls"),e=z(document.getElementById(t),m.elements);S(e)}),5);else if(k.offset<0){var x=o(T,!0),R=x[x.length-2],L=b.get(R);u(R,!1),S(L)}}null==h||h(p)}}var Y="__RC_UTIL_PATH_SPLIT__",q=function(t){return t.join(Y)},Q="rc-menu-more";function X(){var t=g.useState({}),e=(0,o.Z)(t,2)[1],n=(0,g.useRef)(new Map),i=(0,g.useRef)(new Map),r=g.useState([]),s=(0,o.Z)(r,2),l=s[0],u=s[1],h=(0,g.useRef)(0),c=(0,g.useRef)(!1),d=(0,g.useCallback)((function(t,r){var s=q(r);i.current.set(s,t),n.current.set(t,s),h.current+=1;var a,o=h.current;a=function(){o===h.current&&(c.current||e({}))},Promise.resolve().then(a)}),[]),f=(0,g.useCallback)((function(t,e){var r=q(e);i.current.delete(r),n.current.delete(t)}),[]),p=(0,g.useCallback)((function(t){u(t)}),[]),_=(0,g.useCallback)((function(t,e){var i=n.current.get(t)||"",r=i.split(Y);return e&&l.includes(r[0])&&r.unshift(Q),r}),[l]),m=(0,g.useCallback)((function(t,e){return t.filter((function(t){return void 0!==t})).some((function(t){return _(t,!0).includes(e)}))}),[_]),v=(0,g.useCallback)((function(t){var e="".concat(n.current.get(t)).concat(Y),r=new Set;return(0,a.Z)(i.current.keys()).forEach((function(t){t.startsWith(e)&&r.add(i.current.get(t))})),r}),[]);return g.useEffect((function(){return function(){c.current=!0}}),[]),{registerPath:d,unregisterPath:f,refreshOverflowKeys:p,isSubPathKey:m,getKeyPath:_,getKeys:function(){var t=(0,a.Z)(n.current.keys());return l.length&&t.push(Q),t},getSubPathKeys:v}}function J(t){var e=g.useRef(t);e.current=t;var n=g.useCallback((function(){for(var t,n=arguments.length,i=new Array(n),r=0;r<n;r++)i[r]=arguments[r];return null===(t=e.current)||void 0===t?void 0:t.call.apply(t,[e].concat(i))}),[]);return t?n:void 0}var tt=Math.random().toFixed(5).toString().slice(2),et=0;var nt=n(67732),it=n(83652),rt=n(42403),st=n(158),at=n(2738),ot=n(8654);function lt(t,e,n,i){var r=g.useContext(w),s=r.activeKey,a=r.onActive,o=r.onInactive,l={active:s===t};return e||(l.onMouseEnter=function(e){null==n||n({key:t,domEvent:e}),a(t)},l.onMouseLeave=function(e){null==i||i({key:t,domEvent:e}),o(t)}),l}function ut(t){var e=g.useContext(w),n=e.mode,i=e.rtl,r=e.inlineIndent;if("inline"!==n)return null;return i?{paddingRight:t*r}:{paddingLeft:t*r}}function ht(t){var e,n=t.icon,i=t.props,r=t.children;return null===n||!1===n?null:("function"==typeof n?e=g.createElement(n,(0,s.Z)({},i)):"boolean"!=typeof n&&(e=n),e||r||null)}var ct=["item"];function dt(t){var e=t.item,n=(0,l.Z)(t,ct);return Object.defineProperty(n,"item",{get:function(){return(0,p.ZP)(!1,"`info.item` is deprecated since we will move to function component that not provides React Node instance in future."),e}}),n}var ft=["title","attribute","elementRef"],pt=["style","className","eventKey","warnKey","disabled","itemIcon","children","role","onMouseEnter","onMouseLeave","onClick","onKeyDown","onFocus"],gt=["active"],_t=function(t){(0,rt.Z)(n,t);var e=(0,st.Z)(n);function n(){return(0,nt.Z)(this,n),e.apply(this,arguments)}return(0,it.Z)(n,[{key:"render",value:function(){var t=this.props,e=t.title,n=t.attribute,r=t.elementRef,s=(0,l.Z)(t,ft),a=(0,at.Z)(s,["eventKey","popupClassName","popupOffset","onTitleClick"]);return(0,p.ZP)(!n,"`attribute` of Menu.Item is deprecated. Please pass attribute directly."),g.createElement(c.Z.Item,(0,i.Z)({},n,{title:"string"==typeof e?e:void 0},a,{ref:r}))}}]),n}(g.Component),mt=g.forwardRef((function(t,e){var n=t.style,o=t.className,u=t.eventKey,c=(t.warnKey,t.disabled),d=t.itemIcon,f=t.children,p=t.role,_=t.onMouseEnter,m=t.onMouseLeave,v=t.onClick,b=t.onKeyDown,E=t.onFocus,T=(0,l.Z)(t,pt),k=y(u),S=g.useContext(w),A=S.prefixCls,D=S.onItemClick,x=S.disabled,L=S.overflowDisabled,I=S.itemIcon,P=S.selectedKeys,F=S.onActive,M=g.useContext(R)._internalRenderMenuItem,N="".concat(A,"-item"),B=g.useRef(),U=g.useRef(),$=x||c,G=(0,ot.x1)(e,U),K=C(u);var j=function(t){return{key:u,keyPath:(0,a.Z)(K).reverse(),item:B.current,domEvent:t}},V=d||I,Z=lt(u,$,_,m),z=Z.active,H=(0,l.Z)(Z,gt),W=P.includes(u),Y=ut(K.length),q={};"option"===t.role&&(q["aria-selected"]=W);var Q=g.createElement(_t,(0,i.Z)({ref:B,elementRef:G,role:null===p?"none":p||"menuitem",tabIndex:c?null:-1,"data-menu-id":L&&k?null:k},(0,at.Z)(T,["extra"]),H,q,{component:"li","aria-disabled":c,style:(0,s.Z)((0,s.Z)({},Y),n),className:h()(N,(0,r.Z)((0,r.Z)((0,r.Z)({},"".concat(N,"-active"),z),"".concat(N,"-selected"),W),"".concat(N,"-disabled"),$),o),onClick:function(t){if(!$){var e=j(t);null==v||v(dt(e)),D(e)}},onKeyDown:function(t){if(null==b||b(t),t.which===O.Z.ENTER){var e=j(t);null==v||v(dt(e)),D(e)}},onFocus:function(t){F(u),null==E||E(t)}}),f,g.createElement(ht,{props:(0,s.Z)((0,s.Z)({},t),{},{isSelected:W}),icon:V}));return M&&(Q=M(Q,t,{selected:W})),Q}));function vt(t,e){var n=t.eventKey,r=A(),s=C(n);return g.useEffect((function(){if(r)return r.registerPath(n,s),function(){r.unregisterPath(n,s)}}),[s]),r?null:g.createElement(mt,(0,i.Z)({},t,{ref:e}))}var yt=g.forwardRef(vt),bt=["className","children"],Et=function(t,e){var n=t.className,r=t.children,s=(0,l.Z)(t,bt),a=g.useContext(w),o=a.prefixCls,u=a.mode,c=a.rtl;return g.createElement("ul",(0,i.Z)({className:h()(o,c&&"".concat(o,"-rtl"),"".concat(o,"-sub"),"".concat(o,"-").concat("inline"===u?"inline":"vertical"),n),role:"menu"},s,{"data-menu-list":!0,ref:e}),r)},wt=g.forwardRef(Et);wt.displayName="SubMenuList";var Tt=wt,kt=n(11592);function St(t,e){return(0,kt.Z)(t).map((function(t,n){if(g.isValidElement(t)){var i,r,s=t.key,o=null!==(i=null===(r=t.props)||void 0===r?void 0:r.eventKey)&&void 0!==i?i:s;null==o&&(o="tmp_key-".concat([].concat((0,a.Z)(e),[n]).join("-")));var l={key:o,eventKey:o};return g.cloneElement(t,l)}return t}))}var At=n(65030),Dt={adjustX:1,adjustY:1},Ct={topLeft:{points:["bl","tl"],overflow:Dt},topRight:{points:["br","tr"],overflow:Dt},bottomLeft:{points:["tl","bl"],overflow:Dt},bottomRight:{points:["tr","br"],overflow:Dt},leftTop:{points:["tr","tl"],overflow:Dt},leftBottom:{points:["br","bl"],overflow:Dt},rightTop:{points:["tl","tr"],overflow:Dt},rightBottom:{points:["bl","br"],overflow:Dt}},xt={topLeft:{points:["bl","tl"],overflow:Dt},topRight:{points:["br","tr"],overflow:Dt},bottomLeft:{points:["tl","bl"],overflow:Dt},bottomRight:{points:["tr","br"],overflow:Dt},rightTop:{points:["tr","tl"],overflow:Dt},rightBottom:{points:["br","bl"],overflow:Dt},leftTop:{points:["tl","tr"],overflow:Dt},leftBottom:{points:["bl","br"],overflow:Dt}};function Rt(t,e,n){return e||(n?n[t]||n.other:void 0)}var Lt={horizontal:"bottomLeft",vertical:"rightTop","vertical-left":"rightTop","vertical-right":"leftTop"};function It(t){var e=t.prefixCls,n=t.visible,i=t.children,a=t.popup,l=t.popupStyle,u=t.popupClassName,c=t.popupOffset,d=t.disabled,f=t.mode,p=t.onVisibleChange,_=g.useContext(w),m=_.getPopupContainer,v=_.rtl,y=_.subMenuOpenDelay,b=_.subMenuCloseDelay,E=_.builtinPlacements,T=_.triggerSubMenuAction,k=_.forceSubMenuRender,S=_.rootClassName,A=_.motion,D=_.defaultMotions,C=g.useState(!1),x=(0,o.Z)(C,2),R=x[0],L=x[1],I=v?(0,s.Z)((0,s.Z)({},xt),E):(0,s.Z)((0,s.Z)({},Ct),E),P=Lt[f],O=Rt(f,A,D),M=g.useRef(O);"inline"!==f&&(M.current=O);var N=(0,s.Z)((0,s.Z)({},M.current),{},{leavedClassName:"".concat(e,"-hidden"),removeOnLeave:!1,motionAppear:!0}),B=g.useRef();return g.useEffect((function(){return B.current=(0,F.Z)((function(){L(n)})),function(){F.Z.cancel(B.current)}}),[n]),g.createElement(At.Z,{prefixCls:e,popupClassName:h()("".concat(e,"-popup"),(0,r.Z)({},"".concat(e,"-rtl"),v),u,S),stretch:"horizontal"===f?"minWidth":null,getPopupContainer:m,builtinPlacements:I,popupPlacement:P,popupVisible:R,popup:a,popupStyle:l,popupAlign:c&&{offset:c},action:d?[]:[T],mouseEnterDelay:y,mouseLeaveDelay:b,onPopupVisibleChange:p,forceRender:k,popupMotion:N,fresh:!0},i)}var Pt=n(77900);function Ot(t){var e=t.id,n=t.open,r=t.keyPath,a=t.children,l="inline",u=g.useContext(w),h=u.prefixCls,c=u.forceSubMenuRender,d=u.motion,f=u.defaultMotions,p=u.mode,_=g.useRef(!1);_.current=p===l;var m=g.useState(!_.current),v=(0,o.Z)(m,2),y=v[0],b=v[1],E=!!_.current&&n;g.useEffect((function(){_.current&&b(!1)}),[p]);var k=(0,s.Z)({},Rt(l,d,f));r.length>1&&(k.motionAppear=!1);var S=k.onVisibleChanged;return k.onVisibleChanged=function(t){return _.current||t||b(!0),null==S?void 0:S(t)},y?null:g.createElement(T,{mode:l,locked:!_.current},g.createElement(Pt.default,(0,i.Z)({visible:E},k,{forceRender:c,removeOnLeave:!1,leavedClassName:"".concat(h,"-hidden")}),(function(t){var n=t.className,i=t.style;return g.createElement(Tt,{id:e,className:n,style:i},a)})))}var Ft=["style","className","title","eventKey","warnKey","disabled","internalPopupClose","children","itemIcon","expandIcon","popupClassName","popupOffset","popupStyle","onClick","onMouseEnter","onMouseLeave","onTitleClick","onTitleMouseEnter","onTitleMouseLeave"],Mt=["active"],Nt=g.forwardRef((function(t,e){var n=t.style,a=t.className,u=t.title,d=t.eventKey,f=(t.warnKey,t.disabled),p=t.internalPopupClose,_=t.children,m=t.itemIcon,v=t.expandIcon,b=t.popupClassName,E=t.popupOffset,k=t.popupStyle,S=t.onClick,A=t.onMouseEnter,D=t.onMouseLeave,L=t.onTitleClick,I=t.onTitleMouseEnter,P=t.onTitleMouseLeave,O=(0,l.Z)(t,Ft),F=y(d),M=g.useContext(w),N=M.prefixCls,B=M.mode,U=M.openKeys,$=M.disabled,G=M.overflowDisabled,K=M.activeKey,j=M.selectedKeys,V=M.itemIcon,Z=M.expandIcon,z=M.onItemClick,H=M.onOpenChange,W=M.onActive,Y=g.useContext(R)._internalRenderSubMenuItem,q=g.useContext(x).isSubPathKey,Q=C(),X="".concat(N,"-submenu"),tt=$||f,et=g.useRef(),nt=g.useRef();var it=null!=m?m:V,rt=null!=v?v:Z,st=U.includes(d),at=!G&&st,ot=q(j,d),ct=lt(d,tt,I,P),ft=ct.active,pt=(0,l.Z)(ct,Mt),gt=g.useState(!1),_t=(0,o.Z)(gt,2),mt=_t[0],vt=_t[1],yt=function(t){tt||vt(t)},bt=g.useMemo((function(){return ft||"inline"!==B&&(mt||q([K],d))}),[B,ft,K,mt,d,q]),Et=ut(Q.length),wt=J((function(t){null==S||S(dt(t)),z(t)})),kt=F&&"".concat(F,"-popup"),St=g.useMemo((function(){return g.createElement(ht,{icon:"horizontal"!==B?rt:void 0,props:(0,s.Z)((0,s.Z)({},t),{},{isOpen:at,isSubMenu:!0})},g.createElement("i",{className:"".concat(X,"-arrow")}))}),[B,rt,t,at,X]),At=g.createElement("div",(0,i.Z)({role:"menuitem",style:Et,className:"".concat(X,"-title"),tabIndex:tt?null:-1,ref:et,title:"string"==typeof u?u:null,"data-menu-id":G&&F?null:F,"aria-expanded":at,"aria-haspopup":!0,"aria-controls":kt,"aria-disabled":tt,onClick:function(t){tt||(null==L||L({key:d,domEvent:t}),"inline"===B&&H(d,!st))},onFocus:function(){W(d)}},pt),u,St),Dt=g.useRef(B);if("inline"!==B&&Q.length>1?Dt.current="vertical":Dt.current=B,!G){var Ct=Dt.current;At=g.createElement(It,{mode:Ct,prefixCls:X,visible:!p&&at&&"inline"!==B,popupClassName:b,popupOffset:E,popupStyle:k,popup:g.createElement(T,{mode:"horizontal"===Ct?"vertical":Ct},g.createElement(Tt,{id:kt,ref:nt},_)),disabled:tt,onVisibleChange:function(t){"inline"!==B&&H(d,t)}},At)}var xt=g.createElement(c.Z.Item,(0,i.Z)({ref:e,role:"none"},O,{component:"li",style:n,className:h()(X,"".concat(X,"-").concat(B),a,(0,r.Z)((0,r.Z)((0,r.Z)((0,r.Z)({},"".concat(X,"-open"),at),"".concat(X,"-active"),bt),"".concat(X,"-selected"),ot),"".concat(X,"-disabled"),tt)),onMouseEnter:function(t){yt(!0),null==A||A({key:d,domEvent:t})},onMouseLeave:function(t){yt(!1),null==D||D({key:d,domEvent:t})}}),At,!G&&g.createElement(Ot,{id:kt,open:at,keyPath:Q},_));return Y&&(xt=Y(xt,t,{selected:ot,active:bt,open:at,disabled:tt})),g.createElement(T,{onItemClick:wt,mode:"horizontal"===B?"vertical":B,itemIcon:it,expandIcon:rt},xt)}));var Bt=g.forwardRef((function(t,e){var n,r=t.eventKey,s=t.children,a=C(r),o=St(s,a),l=A();return g.useEffect((function(){if(l)return l.registerPath(r,a),function(){l.unregisterPath(r,a)}}),[a]),n=l?o:g.createElement(Nt,(0,i.Z)({ref:e},t),o),g.createElement(D.Provider,{value:a},n)})),Ut=n(76190);function $t(t){var e=t.className,n=t.style,i=g.useContext(w).prefixCls;return A()?null:g.createElement("li",{role:"separator",className:h()("".concat(i,"-item-divider"),e),style:n})}var Gt=["className","title","eventKey","children"],Kt=g.forwardRef((function(t,e){var n=t.className,r=t.title,s=(t.eventKey,t.children),a=(0,l.Z)(t,Gt),o=g.useContext(w).prefixCls,u="".concat(o,"-item-group");return g.createElement("li",(0,i.Z)({ref:e,role:"presentation"},a,{onClick:function(t){return t.stopPropagation()},className:h()(u,n)}),g.createElement("div",{role:"presentation",className:"".concat(u,"-title"),title:"string"==typeof r?r:void 0},r),g.createElement("ul",{role:"group",className:"".concat(u,"-list")},s))}));var jt=g.forwardRef((function(t,e){var n=t.eventKey,r=St(t.children,C(n));return A()?r:g.createElement(Kt,(0,i.Z)({ref:e},(0,at.Z)(t,["warnKey"])),r)})),Vt=["label","children","key","type","extra"];function Zt(t,e,n){var r=e.item,s=e.group,a=e.submenu,o=e.divider;return(t||[]).map((function(t,u){if(t&&"object"===(0,Ut.Z)(t)){var h=t,c=h.label,d=h.children,f=h.key,p=h.type,_=h.extra,m=(0,l.Z)(h,Vt),v=null!=f?f:"tmp-".concat(u);return d||"group"===p?"group"===p?g.createElement(s,(0,i.Z)({key:v},m,{title:c}),Zt(d,e,n)):g.createElement(a,(0,i.Z)({key:v},m,{title:c}),Zt(d,e,n)):"divider"===p?g.createElement(o,(0,i.Z)({key:v},m)):g.createElement(r,(0,i.Z)({key:v},m,{extra:_}),c,(!!_||0===_)&&g.createElement("span",{className:"".concat(n,"-item-extra")},_))}return null})).filter((function(t){return t}))}function zt(t,e,n,i,r){var a=t,o=(0,s.Z)({divider:$t,item:yt,group:jt,submenu:Bt},i);return e&&(a=Zt(e,o,r)),St(a,n)}var Ht=["prefixCls","rootClassName","style","className","tabIndex","items","children","direction","id","mode","inlineCollapsed","disabled","disabledOverflow","subMenuOpenDelay","subMenuCloseDelay","forceSubMenuRender","defaultOpenKeys","openKeys","activeKey","defaultActiveFirst","selectable","multiple","defaultSelectedKeys","selectedKeys","onSelect","onDeselect","inlineIndent","motion","defaultMotions","triggerSubMenuAction","builtinPlacements","itemIcon","expandIcon","overflowedIndicator","overflowedIndicatorPopupClassName","getPopupContainer","onClick","onOpenChange","onKeyDown","openAnimation","openTransitionName","_internalRenderMenuItem","_internalRenderSubMenuItem","_internalComponents"],Wt=[],Yt=g.forwardRef((function(t,e){var n,u=t,p=u.prefixCls,v=void 0===p?"rc-menu":p,y=u.rootClassName,b=u.style,E=u.className,w=u.tabIndex,k=void 0===w?0:w,A=u.items,D=u.children,C=u.direction,L=u.id,I=u.mode,P=void 0===I?"vertical":I,O=u.inlineCollapsed,F=u.disabled,M=u.disabledOverflow,N=u.subMenuOpenDelay,B=void 0===N?.1:N,U=u.subMenuCloseDelay,$=void 0===U?.1:U,G=u.forceSubMenuRender,K=u.defaultOpenKeys,j=u.openKeys,V=u.activeKey,z=u.defaultActiveFirst,Y=u.selectable,q=void 0===Y||Y,nt=u.multiple,it=void 0!==nt&&nt,rt=u.defaultSelectedKeys,st=u.selectedKeys,at=u.onSelect,ot=u.onDeselect,lt=u.inlineIndent,ut=void 0===lt?24:lt,ht=u.motion,ct=u.defaultMotions,ft=u.triggerSubMenuAction,pt=void 0===ft?"hover":ft,gt=u.builtinPlacements,_t=u.itemIcon,mt=u.expandIcon,vt=u.overflowedIndicator,bt=void 0===vt?"...":vt,Et=u.overflowedIndicatorPopupClassName,wt=u.getPopupContainer,Tt=u.onClick,kt=u.onOpenChange,St=u.onKeyDown,At=(u.openAnimation,u.openTransitionName,u._internalRenderMenuItem),Dt=u._internalRenderSubMenuItem,Ct=u._internalComponents,xt=(0,l.Z)(u,Ht),Rt=g.useMemo((function(){return[zt(D,A,Wt,Ct,v),zt(D,A,Wt,{},v)]}),[D,A,Ct]),Lt=(0,o.Z)(Rt,2),It=Lt[0],Pt=Lt[1],Ot=g.useState(!1),Ft=(0,o.Z)(Ot,2),Mt=Ft[0],Nt=Ft[1],Ut=g.useRef(),$t=function(t){var e=(0,d.Z)(t,{value:t}),n=(0,o.Z)(e,2),i=n[0],r=n[1];return g.useEffect((function(){et+=1;var t="".concat(tt,"-").concat(et);r("rc-menu-uuid-".concat(t))}),[]),i}(L),Gt="rtl"===C;var Kt=(0,d.Z)(K,{value:j,postState:function(t){return t||Wt}}),jt=(0,o.Z)(Kt,2),Vt=jt[0],Zt=jt[1],Yt=function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];function n(){Zt(t),null==kt||kt(t)}e?(0,_.flushSync)(n):n()},qt=g.useState(Vt),Qt=(0,o.Z)(qt,2),Xt=Qt[0],Jt=Qt[1],te=g.useRef(!1),ee=g.useMemo((function(){return"inline"!==P&&"vertical"!==P||!O?[P,!1]:["vertical",O]}),[P,O]),ne=(0,o.Z)(ee,2),ie=ne[0],re=ne[1],se="inline"===ie,ae=g.useState(ie),oe=(0,o.Z)(ae,2),le=oe[0],ue=oe[1],he=g.useState(re),ce=(0,o.Z)(he,2),de=ce[0],fe=ce[1];g.useEffect((function(){ue(ie),fe(re),te.current&&(se?Zt(Xt):Yt(Wt))}),[ie,re]);var pe=g.useState(0),ge=(0,o.Z)(pe,2),_e=ge[0],me=ge[1],ve=_e>=It.length-1||"horizontal"!==le||M;g.useEffect((function(){se&&Jt(Vt)}),[Vt]),g.useEffect((function(){return te.current=!0,function(){te.current=!1}}),[]);var ye=X(),be=ye.registerPath,Ee=ye.unregisterPath,we=ye.refreshOverflowKeys,Te=ye.isSubPathKey,ke=ye.getKeyPath,Se=ye.getKeys,Ae=ye.getSubPathKeys,De=g.useMemo((function(){return{registerPath:be,unregisterPath:Ee}}),[be,Ee]),Ce=g.useMemo((function(){return{isSubPathKey:Te}}),[Te]);g.useEffect((function(){we(ve?Wt:It.slice(_e+1).map((function(t){return t.key})))}),[_e,ve]);var xe=(0,d.Z)(V||z&&(null===(n=It[0])||void 0===n?void 0:n.key),{value:V}),Re=(0,o.Z)(xe,2),Le=Re[0],Ie=Re[1],Pe=J((function(t){Ie(t)})),Oe=J((function(){Ie(void 0)}));(0,g.useImperativeHandle)(e,(function(){return{list:Ut.current,focus:function(t){var e,n,i=Se(),r=H(i,$t),s=r.elements,a=r.key2element,o=r.element2key,l=Z(Ut.current,s),u=null!=Le?Le:l[0]?o.get(l[0]):null===(e=It.find((function(t){return!t.props.disabled})))||void 0===e?void 0:e.key,h=a.get(u);u&&h&&(null==h||null===(n=h.focus)||void 0===n||n.call(h,t))}}}));var Fe=(0,d.Z)(rt||[],{value:st,postState:function(t){return Array.isArray(t)?t:null==t?Wt:[t]}}),Me=(0,o.Z)(Fe,2),Ne=Me[0],Be=Me[1],Ue=J((function(t){null==Tt||Tt(dt(t)),function(t){if(q){var e,n=t.key,i=Ne.includes(n);e=it?i?Ne.filter((function(t){return t!==n})):[].concat((0,a.Z)(Ne),[n]):[n],Be(e);var r=(0,s.Z)((0,s.Z)({},t),{},{selectedKeys:e});i?null==ot||ot(r):null==at||at(r)}!it&&Vt.length&&"inline"!==le&&Yt(Wt)}(t)})),$e=J((function(t,e){var n=Vt.filter((function(e){return e!==t}));if(e)n.push(t);else if("inline"!==le){var i=Ae(t);n=n.filter((function(t){return!i.has(t)}))}(0,f.Z)(Vt,n,!0)||Yt(n,!0)})),Ge=W(le,Le,Gt,$t,Ut,Se,ke,Ie,(function(t,e){var n=null!=e?e:!Vt.includes(t);$e(t,n)}),St);g.useEffect((function(){Nt(!0)}),[]);var Ke=g.useMemo((function(){return{_internalRenderMenuItem:At,_internalRenderSubMenuItem:Dt}}),[At,Dt]),je="horizontal"!==le||M?It:It.map((function(t,e){return g.createElement(T,{key:t.key,overflowDisabled:e>_e},t)})),Ve=g.createElement(c.Z,(0,i.Z)({id:L,ref:Ut,prefixCls:"".concat(v,"-overflow"),component:"ul",itemComponent:yt,className:h()(v,"".concat(v,"-root"),"".concat(v,"-").concat(le),E,(0,r.Z)((0,r.Z)({},"".concat(v,"-inline-collapsed"),de),"".concat(v,"-rtl"),Gt),y),dir:C,style:b,role:"menu",tabIndex:k,data:je,renderRawItem:function(t){return t},renderRawRest:function(t){var e=t.length,n=e?It.slice(-e):null;return g.createElement(Bt,{eventKey:Q,title:bt,disabled:ve,internalPopupClose:0===e,popupClassName:Et},n)},maxCount:"horizontal"!==le||M?c.Z.INVALIDATE:c.Z.RESPONSIVE,ssr:"full","data-menu-list":!0,onVisibleChange:function(t){me(t)},onKeyDown:Ge},xt));return g.createElement(R.Provider,{value:Ke},g.createElement(m.Provider,{value:$t},g.createElement(T,{prefixCls:v,rootClassName:y,mode:le,openKeys:Vt,rtl:Gt,disabled:F,motion:Mt?ht:null,defaultMotions:Mt?ct:null,activeKey:Le,onActive:Pe,onInactive:Oe,selectedKeys:Ne,inlineIndent:ut,subMenuOpenDelay:B,subMenuCloseDelay:$,forceSubMenuRender:G,builtinPlacements:gt,triggerSubMenuAction:pt,getPopupContainer:wt,itemIcon:_t,expandIcon:mt,onItemClick:Ue,onOpenChange:$e},g.createElement(x.Provider,{value:Ce},Ve),g.createElement("div",{style:{display:"none"},"aria-hidden":!0},g.createElement(S.Provider,{value:De},Pt)))))})),qt=Yt;qt.Item=yt,qt.SubMenu=Bt,qt.ItemGroup=jt,qt.Divider=$t;var Qt=qt},11780:function(t,e,n){"use strict";n.d(e,{Z:function(){return F}});var i=n(54476),r=n(33885),s=n(42978),a=n(75931),o=n(59301),l=n(92310),u=n.n(l),h=n(29301),c=n(34280),d=["prefixCls","invalidate","item","renderItem","responsive","responsiveDisabled","registerSize","itemKey","className","style","children","display","order","component"],f=void 0;function p(t,e){var n=t.prefixCls,s=t.invalidate,l=t.item,c=t.renderItem,p=t.responsive,g=t.responsiveDisabled,_=t.registerSize,m=t.itemKey,v=t.className,y=t.style,b=t.children,E=t.display,w=t.order,T=t.component,k=void 0===T?"div":T,S=(0,a.Z)(t,d),A=p&&!E;function D(t){_(m,t)}o.useEffect((function(){return function(){D(null)}}),[]);var C,x=c&&l!==f?c(l,{index:w}):b;s||(C={opacity:A?0:1,height:A?0:f,overflowY:A?"hidden":f,order:p?w:f,pointerEvents:A?"none":f,position:A?"absolute":f});var R={};A&&(R["aria-hidden"]=!0);var L=o.createElement(k,(0,i.Z)({className:u()(!s&&n,v),style:(0,r.Z)((0,r.Z)({},C),y)},R,S,{ref:e}),x);return p&&(L=o.createElement(h.Z,{onResize:function(t){D(t.offsetWidth)},disabled:g},L)),L}var g=o.forwardRef(p);g.displayName="Item";var _=g,m=n(6089),v=n(4676),y=n(16089);function b(){var t=o.useRef(null);return function(e){t.current||(t.current=[],function(t){if("undefined"==typeof MessageChannel)(0,y.Z)(t);else{var e=new MessageChannel;e.port1.onmessage=function(){return t()},e.port2.postMessage(void 0)}}((function(){(0,v.unstable_batchedUpdates)((function(){t.current.forEach((function(t){t()})),t.current=null}))}))),t.current.push(e)}}function E(t,e){var n=o.useState(e),i=(0,s.Z)(n,2),r=i[0],a=i[1];return[r,(0,m.Z)((function(e){t((function(){a(e)}))}))]}var w=o.createContext(null),T=["component"],k=["className"],S=["className"],A=function(t,e){var n=o.useContext(w);if(!n){var r=t.component,s=void 0===r?"div":r,l=(0,a.Z)(t,T);return o.createElement(s,(0,i.Z)({},l,{ref:e}))}var h=n.className,c=(0,a.Z)(n,k),d=t.className,f=(0,a.Z)(t,S);return o.createElement(w.Provider,{value:null},o.createElement(_,(0,i.Z)({ref:e,className:u()(h,d)},c,f)))},D=o.forwardRef(A);D.displayName="RawItem";var C=D,x=["prefixCls","data","renderItem","renderRawItem","itemKey","itemWidth","ssr","style","className","maxCount","renderRest","renderRawRest","suffix","component","itemComponent","onVisibleChange"],R="responsive",L="invalidate";function I(t){return"+ ".concat(t.length," ...")}function P(t,e){var n=t.prefixCls,l=void 0===n?"rc-overflow":n,d=t.data,f=void 0===d?[]:d,p=t.renderItem,g=t.renderRawItem,m=t.itemKey,v=t.itemWidth,y=void 0===v?10:v,T=t.ssr,k=t.style,S=t.className,A=t.maxCount,D=t.renderRest,C=t.renderRawRest,P=t.suffix,O=t.component,F=void 0===O?"div":O,M=t.itemComponent,N=t.onVisibleChange,B=(0,a.Z)(t,x),U="full"===T,$=b(),G=E($,null),K=(0,s.Z)(G,2),j=K[0],V=K[1],Z=j||0,z=E($,new Map),H=(0,s.Z)(z,2),W=H[0],Y=H[1],q=E($,0),Q=(0,s.Z)(q,2),X=Q[0],J=Q[1],tt=E($,0),et=(0,s.Z)(tt,2),nt=et[0],it=et[1],rt=E($,0),st=(0,s.Z)(rt,2),at=st[0],ot=st[1],lt=(0,o.useState)(null),ut=(0,s.Z)(lt,2),ht=ut[0],ct=ut[1],dt=(0,o.useState)(null),ft=(0,s.Z)(dt,2),pt=ft[0],gt=ft[1],_t=o.useMemo((function(){return null===pt&&U?Number.MAX_SAFE_INTEGER:pt||0}),[pt,j]),mt=(0,o.useState)(!1),vt=(0,s.Z)(mt,2),yt=vt[0],bt=vt[1],Et="".concat(l,"-item"),wt=Math.max(X,nt),Tt=A===R,kt=f.length&&Tt,St=A===L,At=kt||"number"==typeof A&&f.length>A,Dt=(0,o.useMemo)((function(){var t=f;return kt?t=null===j&&U?f:f.slice(0,Math.min(f.length,Z/y)):"number"==typeof A&&(t=f.slice(0,A)),t}),[f,y,j,A,kt]),Ct=(0,o.useMemo)((function(){return kt?f.slice(_t+1):f.slice(Dt.length)}),[f,Dt,kt,_t]),xt=(0,o.useCallback)((function(t,e){var n;return"function"==typeof m?m(t):null!==(n=m&&(null==t?void 0:t[m]))&&void 0!==n?n:e}),[m]),Rt=(0,o.useCallback)(p||function(t){return t},[p]);function Lt(t,e,n){(pt!==t||void 0!==e&&e!==ht)&&(gt(t),n||(bt(t<f.length-1),null==N||N(t)),void 0!==e&&ct(e))}function It(t,e){Y((function(n){var i=new Map(n);return null===e?i.delete(t):i.set(t,e),i}))}function Pt(t){return W.get(xt(Dt[t],t))}(0,c.Z)((function(){if(Z&&"number"==typeof wt&&Dt){var t=at,e=Dt.length,n=e-1;if(!e)return void Lt(0,null);for(var i=0;i<e;i+=1){var r=Pt(i);if(U&&(r=r||0),void 0===r){Lt(i-1,void 0,!0);break}if(t+=r,0===n&&t<=Z||i===n-1&&t+Pt(n)<=Z){Lt(n,null);break}if(t+wt>Z){Lt(i-1,t-r-at+nt);break}}P&&Pt(0)+at>Z&&ct(null)}}),[Z,W,nt,at,xt,Dt]);var Ot=yt&&!!Ct.length,Ft={};null!==ht&&kt&&(Ft={position:"absolute",left:ht,top:0});var Mt={prefixCls:Et,responsive:kt,component:M,invalidate:St},Nt=g?function(t,e){var n=xt(t,e);return o.createElement(w.Provider,{key:n,value:(0,r.Z)((0,r.Z)({},Mt),{},{order:e,item:t,itemKey:n,registerSize:It,display:e<=_t})},g(t,e))}:function(t,e){var n=xt(t,e);return o.createElement(_,(0,i.Z)({},Mt,{order:e,key:n,item:t,renderItem:Rt,itemKey:n,registerSize:It,display:e<=_t}))},Bt={order:Ot?_t:Number.MAX_SAFE_INTEGER,className:"".concat(Et,"-rest"),registerSize:function(t,e){it(e),J(nt)},display:Ot},Ut=D||I,$t=C?o.createElement(w.Provider,{value:(0,r.Z)((0,r.Z)({},Mt),Bt)},C(Ct)):o.createElement(_,(0,i.Z)({},Mt,Bt),"function"==typeof Ut?Ut(Ct):Ut),Gt=o.createElement(F,(0,i.Z)({className:u()(!St&&l,S),style:k,ref:e},B),Dt.map(Nt),At?$t:null,P&&o.createElement(_,(0,i.Z)({},Mt,{responsive:Tt,responsiveDisabled:!kt,order:_t,className:"".concat(Et,"-suffix"),registerSize:function(t,e){ot(e)},display:!0,style:Ft}),P));return Tt?o.createElement(h.Z,{onResize:function(t,e){V(e.clientWidth)},disabled:!kt},Gt):Gt}var O=o.forwardRef(P);O.displayName="Overflow",O.Item=C,O.RESPONSIVE=R,O.INVALIDATE=L;var F=O},29301:function(t,e,n){"use strict";n.d(e,{Z:function(){return T}});var i=n(54476),r=n(59301),s=n(11592),a=(n(48736),n(33885)),o=n(76190),l=n(76846),u=n(8654),h=r.createContext(null);var c=n(76374),d=new Map;var f=new c.Z((function(t){t.forEach((function(t){var e,n=t.target;null===(e=d.get(n))||void 0===e||e.forEach((function(t){return t(n)}))}))}));var p=n(67732),g=n(83652),_=n(42403),m=n(158),v=function(t){(0,_.Z)(n,t);var e=(0,m.Z)(n);function n(){return(0,p.Z)(this,n),e.apply(this,arguments)}return(0,g.Z)(n,[{key:"render",value:function(){return this.props.children}}]),n}(r.Component);function y(t,e){var n=t.children,i=t.disabled,s=r.useRef(null),c=r.useRef(null),p=r.useContext(h),g="function"==typeof n,_=g?n(s):n,m=r.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),y=!g&&r.isValidElement(_)&&(0,u.Yr)(_),b=y?(0,u.C4)(_):null,E=(0,u.x1)(b,s),w=function(){var t;return(0,l.ZP)(s.current)||(s.current&&"object"===(0,o.Z)(s.current)?(0,l.ZP)(null===(t=s.current)||void 0===t?void 0:t.nativeElement):null)||(0,l.ZP)(c.current)};r.useImperativeHandle(e,(function(){return w()}));var T=r.useRef(t);T.current=t;var k=r.useCallback((function(t){var e=T.current,n=e.onResize,i=e.data,r=t.getBoundingClientRect(),s=r.width,o=r.height,l=t.offsetWidth,u=t.offsetHeight,h=Math.floor(s),c=Math.floor(o);if(m.current.width!==h||m.current.height!==c||m.current.offsetWidth!==l||m.current.offsetHeight!==u){var d={width:h,height:c,offsetWidth:l,offsetHeight:u};m.current=d;var f=l===Math.round(s)?s:l,g=u===Math.round(o)?o:u,_=(0,a.Z)((0,a.Z)({},d),{},{offsetWidth:f,offsetHeight:g});null==p||p(_,t,i),n&&Promise.resolve().then((function(){n(_,t)}))}}),[]);return r.useEffect((function(){var t,e,n=w();return n&&!i&&(t=n,e=k,d.has(t)||(d.set(t,new Set),f.observe(t)),d.get(t).add(e)),function(){return function(t,e){d.has(t)&&(d.get(t).delete(e),d.get(t).size||(f.unobserve(t),d.delete(t)))}(n,k)}}),[s.current,i]),r.createElement(v,{ref:c},y?r.cloneElement(_,{ref:E}):_)}var b=r.forwardRef(y);function E(t,e){var n=t.children;return("function"==typeof n?[n]:(0,s.Z)(n)).map((function(n,s){var a=(null==n?void 0:n.key)||"".concat("rc-observer-key","-").concat(s);return r.createElement(b,(0,i.Z)({},t,{key:a,ref:0===s?e:void 0}),n)}))}var w=r.forwardRef(E);w.Collection=function(t){var e=t.children,n=t.onBatchResize,i=r.useRef(0),s=r.useRef([]),a=r.useContext(h),o=r.useCallback((function(t,e,r){i.current+=1;var o=i.current;s.current.push({size:t,element:e,data:r}),Promise.resolve().then((function(){o===i.current&&(null==n||n(s.current),s.current=[])})),null==a||a(t,e,r)}),[n,a]);return r.createElement(h.Provider,{value:o},e)};var T=w},29443:function(t,e,n){"use strict";n.d(e,{Z:function(){return X}});var i=n(54476),r=n(20068),s=n(33885),a=n(42978),o=n(76190),l=n(75931),u=n(92310),h=n.n(u),c=n(18929),d=n(49658),f=n(59301),p=(0,f.createContext)(null),g=n(94480),_=n(29301),m=n(6089),v=n(8654),y=n(16089),b=function(t){var e=t.activeTabOffset,n=t.horizontal,i=t.rtl,r=t.indicator,s=void 0===r?{}:r,o=s.size,l=s.align,u=void 0===l?"center":l,h=(0,f.useState)(),c=(0,a.Z)(h,2),d=c[0],p=c[1],g=(0,f.useRef)(),_=f.useCallback((function(t){return"function"==typeof o?o(t):"number"==typeof o?o:t}),[o]);function m(){y.Z.cancel(g.current)}return(0,f.useEffect)((function(){var t={};if(e)if(n){t.width=_(e.width);var r=i?"right":"left";"start"===u&&(t[r]=e[r]),"center"===u&&(t[r]=e[r]+e.width/2,t.transform=i?"translateX(50%)":"translateX(-50%)"),"end"===u&&(t[r]=e[r]+e.width,t.transform="translateX(-100%)")}else t.height=_(e.height),"start"===u&&(t.top=e.top),"center"===u&&(t.top=e.top+e.height/2,t.transform="translateY(-50%)"),"end"===u&&(t.top=e.top+e.height,t.transform="translateY(-100%)");return m(),g.current=(0,y.Z)((function(){p(t)})),m}),[e,n,i,u,_]),{style:d}},E={width:0,height:0,left:0,top:0};function w(t,e){var n=f.useRef(t),i=f.useState({}),r=(0,a.Z)(i,2)[1];return[n.current,function(t){var i="function"==typeof t?t(n.current):t;i!==n.current&&e(i,n.current),n.current=i,r({})}]}var T=Math.pow(.995,20);var k=n(34280);function S(t){var e=(0,f.useState)(0),n=(0,a.Z)(e,2),i=n[0],r=n[1],s=(0,f.useRef)(0),o=(0,f.useRef)();return o.current=t,(0,k.o)((function(){var t;null===(t=o.current)||void 0===t||t.call(o)}),[i]),function(){s.current===i&&(s.current+=1,r(s.current))}}var A={width:0,height:0,left:0,top:0,right:0};function D(t){var e;return t instanceof Map?(e={},t.forEach((function(t,n){e[n]=t}))):e=t,JSON.stringify(e)}function C(t){return String(t).replace(/"/g,"TABS_DQ")}function x(t,e,n,i){return!(!n||i||!1===t||void 0===t&&(!1===e||null===e))}var R=f.forwardRef((function(t,e){var n=t.prefixCls,i=t.editable,r=t.locale,s=t.style;return i&&!1!==i.showAdd?f.createElement("button",{ref:e,type:"button",className:"".concat(n,"-nav-add"),style:s,"aria-label":(null==r?void 0:r.addAriaLabel)||"Add tab",onClick:function(t){i.onEdit("add",{event:t})}},i.addIcon||"+"):null}));var L=f.forwardRef((function(t,e){var n,i=t.position,r=t.prefixCls,s=t.extra;if(!s)return null;var a={};return"object"!==(0,o.Z)(s)||f.isValidElement(s)?a.right=s:a=s,"right"===i&&(n=a.right),"left"===i&&(n=a.left),n?f.createElement("div",{className:"".concat(r,"-extra-content"),ref:e},n):null})),I=n(96478),P=n(28321),O=n(10228),F=f.forwardRef((function(t,e){var n=t.prefixCls,s=t.id,o=t.tabs,l=t.locale,u=t.mobile,c=t.more,d=void 0===c?{}:c,p=t.style,g=t.className,_=t.editable,m=t.tabBarGutter,v=t.rtl,y=t.removeAriaLabel,b=t.onTabClick,E=t.getPopupContainer,w=t.popupClassName,T=(0,f.useState)(!1),k=(0,a.Z)(T,2),S=k[0],A=k[1],D=(0,f.useState)(null),C=(0,a.Z)(D,2),L=C[0],F=C[1],M=d.icon,N=void 0===M?"More":M,B="".concat(s,"-more-popup"),U="".concat(n,"-dropdown"),$=null!==L?"".concat(B,"-").concat(L):null,G=null==l?void 0:l.dropdownAriaLabel;var K=f.createElement(P.ZP,{onClick:function(t){var e=t.key,n=t.domEvent;b(e,n),A(!1)},prefixCls:"".concat(U,"-menu"),id:B,tabIndex:-1,role:"listbox","aria-activedescendant":$,selectedKeys:[L],"aria-label":void 0!==G?G:"expanded dropdown"},o.map((function(t){var e=t.closable,n=t.disabled,i=t.closeIcon,r=t.key,a=t.label,o=x(e,i,_,n);return f.createElement(P.sN,{key:r,id:"".concat(B,"-").concat(r),role:"option","aria-controls":s&&"".concat(s,"-panel-").concat(r),disabled:n},f.createElement("span",null,a),o&&f.createElement("button",{type:"button","aria-label":y||"remove",tabIndex:0,className:"".concat(U,"-menu-item-remove"),onClick:function(t){t.stopPropagation(),function(t,e){t.preventDefault(),t.stopPropagation(),_.onEdit("remove",{key:e,event:t})}(t,r)}},i||_.removeIcon||"×"))})));function j(t){for(var e=o.filter((function(t){return!t.disabled})),n=e.findIndex((function(t){return t.key===L}))||0,i=e.length,r=0;r<i;r+=1){var s=e[n=(n+t+i)%i];if(!s.disabled)return void F(s.key)}}(0,f.useEffect)((function(){var t=document.getElementById($);t&&t.scrollIntoView&&t.scrollIntoView(!1)}),[L]),(0,f.useEffect)((function(){S||F(null)}),[S]);var V=(0,r.Z)({},v?"marginRight":"marginLeft",m);o.length||(V.visibility="hidden",V.order=1);var Z=h()((0,r.Z)({},"".concat(U,"-rtl"),v)),z=u?null:f.createElement(I.Z,(0,i.Z)({prefixCls:U,overlay:K,visible:!!o.length&&S,onVisibleChange:A,overlayClassName:h()(Z,w),mouseEnterDelay:.1,mouseLeaveDelay:.1,getPopupContainer:E},d),f.createElement("button",{type:"button",className:"".concat(n,"-nav-more"),style:V,"aria-haspopup":"listbox","aria-controls":B,id:"".concat(s,"-more"),"aria-expanded":S,onKeyDown:function(t){var e=t.which;if(S)switch(e){case O.Z.UP:j(-1),t.preventDefault();break;case O.Z.DOWN:j(1),t.preventDefault();break;case O.Z.ESC:A(!1);break;case O.Z.SPACE:case O.Z.ENTER:null!==L&&b(L,t)}else[O.Z.DOWN,O.Z.SPACE,O.Z.ENTER].includes(e)&&(A(!0),t.preventDefault())}},N));return f.createElement("div",{className:h()("".concat(n,"-nav-operations"),g),style:p,ref:e},z,f.createElement(R,{prefixCls:n,locale:l,editable:_}))})),M=f.memo(F,(function(t,e){return e.tabMoving})),N=function(t){var e=t.prefixCls,n=t.id,i=t.active,s=t.focus,a=t.tab,o=a.key,l=a.label,u=a.disabled,c=a.closeIcon,d=a.icon,p=t.closable,g=t.renderWrapper,_=t.removeAriaLabel,m=t.editable,v=t.onClick,y=t.onFocus,b=t.onBlur,E=t.onKeyDown,w=t.onMouseDown,T=t.onMouseUp,k=t.style,S=t.tabCount,A=t.currentPosition,D="".concat(e,"-tab"),R=x(p,c,m,u);function L(t){u||v(t)}var I=f.useMemo((function(){return d&&"string"==typeof l?f.createElement("span",null,l):l}),[l,d]),P=f.useRef(null);f.useEffect((function(){s&&P.current&&P.current.focus()}),[s]);var O=f.createElement("div",{key:o,"data-node-key":C(o),className:h()(D,(0,r.Z)((0,r.Z)((0,r.Z)((0,r.Z)({},"".concat(D,"-with-remove"),R),"".concat(D,"-active"),i),"".concat(D,"-disabled"),u),"".concat(D,"-focus"),s)),style:k,onClick:L},f.createElement("div",{ref:P,role:"tab","aria-selected":i,id:n&&"".concat(n,"-tab-").concat(o),className:"".concat(D,"-btn"),"aria-controls":n&&"".concat(n,"-panel-").concat(o),"aria-disabled":u,tabIndex:u?null:i?0:-1,onClick:function(t){t.stopPropagation(),L(t)},onKeyDown:E,onMouseDown:w,onMouseUp:T,onFocus:y,onBlur:b},s&&f.createElement("div",{"aria-live":"polite",style:{width:0,height:0,position:"absolute",overflow:"hidden",opacity:0}},"Tab ".concat(A," of ").concat(S)),d&&f.createElement("span",{className:"".concat(D,"-icon")},d),l&&I),R&&f.createElement("button",{type:"button",role:"tab","aria-label":_||"remove",tabIndex:i?0:-1,className:"".concat(D,"-remove"),onClick:function(t){var e;t.stopPropagation(),(e=t).preventDefault(),e.stopPropagation(),m.onEdit("remove",{key:o,event:e})}},c||m.removeIcon||"×"));return g?g(O):O},B=function(t){var e=t.current||{},n=e.offsetWidth,i=void 0===n?0:n,r=e.offsetHeight,s=void 0===r?0:r;if(t.current){var a=t.current.getBoundingClientRect(),o=a.width,l=a.height;if(Math.abs(o-i)<1)return[o,l]}return[i,s]},U=function(t,e){return t[e?0:1]},$=f.forwardRef((function(t,e){var n=t.className,o=t.style,l=t.id,u=t.animated,c=t.activeKey,d=t.rtl,y=t.extra,k=t.editable,I=t.locale,P=t.tabPosition,O=t.tabBarGutter,F=t.children,$=t.onTabClick,G=t.onTabScroll,K=t.indicator,j=f.useContext(p),V=j.prefixCls,Z=j.tabs,z=(0,f.useRef)(null),H=(0,f.useRef)(null),W=(0,f.useRef)(null),Y=(0,f.useRef)(null),q=(0,f.useRef)(null),Q=(0,f.useRef)(null),X=(0,f.useRef)(null),J="top"===P||"bottom"===P,tt=w(0,(function(t,e){J&&G&&G({direction:t>e?"left":"right"})})),et=(0,a.Z)(tt,2),nt=et[0],it=et[1],rt=w(0,(function(t,e){!J&&G&&G({direction:t>e?"top":"bottom"})})),st=(0,a.Z)(rt,2),at=st[0],ot=st[1],lt=(0,f.useState)([0,0]),ut=(0,a.Z)(lt,2),ht=ut[0],ct=ut[1],dt=(0,f.useState)([0,0]),ft=(0,a.Z)(dt,2),pt=ft[0],gt=ft[1],_t=(0,f.useState)([0,0]),mt=(0,a.Z)(_t,2),vt=mt[0],yt=mt[1],bt=(0,f.useState)([0,0]),Et=(0,a.Z)(bt,2),wt=Et[0],Tt=Et[1],kt=function(t){var e=(0,f.useRef)([]),n=(0,f.useState)({}),i=(0,a.Z)(n,2)[1],r=(0,f.useRef)("function"==typeof t?t():t),s=S((function(){var t=r.current;e.current.forEach((function(e){t=e(t)})),e.current=[],r.current=t,i({})}));return[r.current,function(t){e.current.push(t),s()}]}(new Map),St=(0,a.Z)(kt,2),At=St[0],Dt=St[1],Ct=function(t,e,n){return(0,f.useMemo)((function(){for(var n,i=new Map,r=e.get(null===(n=t[0])||void 0===n?void 0:n.key)||E,a=r.left+r.width,o=0;o<t.length;o+=1){var l,u=t[o].key,h=e.get(u);h||(h=e.get(null===(l=t[o-1])||void 0===l?void 0:l.key)||E);var c=i.get(u)||(0,s.Z)({},h);c.right=a-c.left-c.width,i.set(u,c)}return i}),[t.map((function(t){return t.key})).join("_"),e,n])}(Z,At,pt[0]),xt=U(ht,J),Rt=U(pt,J),Lt=U(vt,J),It=U(wt,J),Pt=Math.floor(xt)<Math.floor(Rt+Lt),Ot=Pt?xt-It:xt-Lt,Ft="".concat(V,"-nav-operations-hidden"),Mt=0,Nt=0;function Bt(t){return t<Mt?Mt:t>Nt?Nt:t}J&&d?(Mt=0,Nt=Math.max(0,Rt-Ot)):(Mt=Math.min(0,Ot-Rt),Nt=0);var Ut=(0,f.useRef)(null),$t=(0,f.useState)(),Gt=(0,a.Z)($t,2),Kt=Gt[0],jt=Gt[1];function Vt(){jt(Date.now())}function Zt(){Ut.current&&clearTimeout(Ut.current)}!function(t,e){var n=(0,f.useState)(),i=(0,a.Z)(n,2),r=i[0],s=i[1],o=(0,f.useState)(0),l=(0,a.Z)(o,2),u=l[0],h=l[1],c=(0,f.useState)(0),d=(0,a.Z)(c,2),p=d[0],g=d[1],_=(0,f.useState)(),m=(0,a.Z)(_,2),v=m[0],y=m[1],b=(0,f.useRef)(),E=(0,f.useRef)(),w=(0,f.useRef)(null);w.current={onTouchStart:function(t){var e=t.touches[0],n=e.screenX,i=e.screenY;s({x:n,y:i}),window.clearInterval(b.current)},onTouchMove:function(t){if(r){var n=t.touches[0],i=n.screenX,a=n.screenY;s({x:i,y:a});var o=i-r.x,l=a-r.y;e(o,l);var c=Date.now();h(c),g(c-u),y({x:o,y:l})}},onTouchEnd:function(){if(r&&(s(null),y(null),v)){var t=v.x/p,n=v.y/p,i=Math.abs(t),a=Math.abs(n);if(Math.max(i,a)<.1)return;var o=t,l=n;b.current=window.setInterval((function(){Math.abs(o)<.01&&Math.abs(l)<.01?window.clearInterval(b.current):e(20*(o*=T),20*(l*=T))}),20)}},onWheel:function(t){var n=t.deltaX,i=t.deltaY,r=0,s=Math.abs(n),a=Math.abs(i);s===a?r="x"===E.current?n:i:s>a?(r=n,E.current="x"):(r=i,E.current="y"),e(-r,-r)&&t.preventDefault()}},f.useEffect((function(){function e(t){w.current.onTouchMove(t)}function n(t){w.current.onTouchEnd(t)}return document.addEventListener("touchmove",e,{passive:!1}),document.addEventListener("touchend",n,{passive:!0}),t.current.addEventListener("touchstart",(function(t){w.current.onTouchStart(t)}),{passive:!0}),t.current.addEventListener("wheel",(function(t){w.current.onWheel(t)}),{passive:!1}),function(){document.removeEventListener("touchmove",e),document.removeEventListener("touchend",n)}}),[])}(Y,(function(t,e){function n(t,e){t((function(t){return Bt(t+e)}))}return!!Pt&&(J?n(it,t):n(ot,e),Zt(),Vt(),!0)})),(0,f.useEffect)((function(){return Zt(),Kt&&(Ut.current=setTimeout((function(){jt(0)}),100)),Zt}),[Kt]);var zt=function(t,e,n,i,r,s,a){var o,l,u,h=a.tabs,c=a.tabPosition,d=a.rtl;return["top","bottom"].includes(c)?(o="width",l=d?"right":"left",u=Math.abs(n)):(o="height",l="top",u=-n),(0,f.useMemo)((function(){if(!h.length)return[0,0];for(var n=h.length,i=n,r=0;r<n;r+=1){var s=t.get(h[r].key)||A;if(Math.floor(s[l]+s[o])>Math.floor(u+e)){i=r-1;break}}for(var a=0,c=n-1;c>=0;c-=1)if((t.get(h[c].key)||A)[l]<u){a=c+1;break}return a>=i?[0,0]:[a,i]}),[t,e,i,r,s,u,c,h.map((function(t){return t.key})).join("_"),d])}(Ct,Ot,J?nt:at,Rt,Lt,It,(0,s.Z)((0,s.Z)({},t),{},{tabs:Z})),Ht=(0,a.Z)(zt,2),Wt=Ht[0],Yt=Ht[1],qt=(0,m.Z)((function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:c,e=Ct.get(t)||{width:0,height:0,left:0,right:0,top:0};if(J){var n=nt;d?e.right<nt?n=e.right:e.right+e.width>nt+Ot&&(n=e.right+e.width-Ot):e.left<-nt?n=-e.left:e.left+e.width>-nt+Ot&&(n=-(e.left+e.width-Ot)),ot(0),it(Bt(n))}else{var i=at;e.top<-at?i=-e.top:e.top+e.height>-at+Ot&&(i=-(e.top+e.height-Ot)),it(0),ot(Bt(i))}})),Qt=(0,f.useState)(),Xt=(0,a.Z)(Qt,2),Jt=Xt[0],te=Xt[1],ee=(0,f.useState)(!1),ne=(0,a.Z)(ee,2),ie=ne[0],re=ne[1],se=Z.filter((function(t){return!t.disabled})).map((function(t){return t.key})),ae=function(t){var e=se.indexOf(Jt||c),n=se.length,i=se[(e+t+n)%n];te(i)},oe=function(t){var e=t.code,n=d&&J,i=se[0],r=se[se.length-1];switch(e){case"ArrowLeft":J&&ae(n?1:-1);break;case"ArrowRight":J&&ae(n?-1:1);break;case"ArrowUp":t.preventDefault(),J||ae(-1);break;case"ArrowDown":t.preventDefault(),J||ae(1);break;case"Home":t.preventDefault(),te(i);break;case"End":t.preventDefault(),te(r);break;case"Enter":case"Space":t.preventDefault(),$(c,t);break;case"Backspace":case"Delete":var s=se.indexOf(Jt),a=Z.find((function(t){return t.key===Jt}));x(null==a?void 0:a.closable,null==a?void 0:a.closeIcon,k,null==a?void 0:a.disabled)&&(t.preventDefault(),t.stopPropagation(),k.onEdit("remove",{key:Jt,event:t}),s===se.length-1?ae(-1):ae(1))}},le={};J?le[d?"marginRight":"marginLeft"]=O:le.marginTop=O;var ue=Z.map((function(t,e){var n=t.key;return f.createElement(N,{id:l,prefixCls:V,key:n,tab:t,style:0===e?void 0:le,closable:t.closable,editable:k,active:n===c,focus:n===Jt,renderWrapper:F,removeAriaLabel:null==I?void 0:I.removeAriaLabel,tabCount:se.length,currentPosition:e+1,onClick:function(t){$(n,t)},onKeyDown:oe,onFocus:function(){ie||te(n),qt(n),Vt(),Y.current&&(d||(Y.current.scrollLeft=0),Y.current.scrollTop=0)},onBlur:function(){te(void 0)},onMouseDown:function(){re(!0)},onMouseUp:function(){re(!1)}})})),he=function(){return Dt((function(){var t,e=new Map,n=null===(t=q.current)||void 0===t?void 0:t.getBoundingClientRect();return Z.forEach((function(t){var i,r=t.key,s=null===(i=q.current)||void 0===i?void 0:i.querySelector('[data-node-key="'.concat(C(r),'"]'));if(s){var o=function(t,e){var n=t.offsetWidth,i=t.offsetHeight,r=t.offsetTop,s=t.offsetLeft,a=t.getBoundingClientRect(),o=a.width,l=a.height,u=a.left,h=a.top;return Math.abs(o-n)<1?[o,l,u-e.left,h-e.top]:[n,i,s,r]}(s,n),l=(0,a.Z)(o,4),u=l[0],h=l[1],c=l[2],d=l[3];e.set(r,{width:u,height:h,left:c,top:d})}})),e}))};(0,f.useEffect)((function(){he()}),[Z.map((function(t){return t.key})).join("_")]);var ce=S((function(){var t=B(z),e=B(H),n=B(W);ct([t[0]-e[0]-n[0],t[1]-e[1]-n[1]]);var i=B(X);yt(i);var r=B(Q);Tt(r);var s=B(q);gt([s[0]-i[0],s[1]-i[1]]),he()})),de=Z.slice(0,Wt),fe=Z.slice(Yt+1),pe=[].concat((0,g.Z)(de),(0,g.Z)(fe)),ge=Ct.get(c),_e=b({activeTabOffset:ge,horizontal:J,indicator:K,rtl:d}).style;(0,f.useEffect)((function(){qt()}),[c,Mt,Nt,D(ge),D(Ct),J]),(0,f.useEffect)((function(){ce()}),[d]);var me,ve,ye,be,Ee=!!pe.length,we="".concat(V,"-nav-wrap");return J?d?(ve=nt>0,me=nt!==Nt):(me=nt<0,ve=nt!==Mt):(ye=at<0,be=at!==Mt),f.createElement(_.Z,{onResize:ce},f.createElement("div",{ref:(0,v.x1)(e,z),role:"tablist","aria-orientation":J?"horizontal":"vertical",className:h()("".concat(V,"-nav"),n),style:o,onKeyDown:function(){Vt()}},f.createElement(L,{ref:H,position:"left",extra:y,prefixCls:V}),f.createElement(_.Z,{onResize:ce},f.createElement("div",{className:h()(we,(0,r.Z)((0,r.Z)((0,r.Z)((0,r.Z)({},"".concat(we,"-ping-left"),me),"".concat(we,"-ping-right"),ve),"".concat(we,"-ping-top"),ye),"".concat(we,"-ping-bottom"),be)),ref:Y},f.createElement(_.Z,{onResize:ce},f.createElement("div",{ref:q,className:"".concat(V,"-nav-list"),style:{transform:"translate(".concat(nt,"px, ").concat(at,"px)"),transition:Kt?"none":void 0}},ue,f.createElement(R,{ref:X,prefixCls:V,locale:I,editable:k,style:(0,s.Z)((0,s.Z)({},0===ue.length?void 0:le),{},{visibility:Ee?"hidden":null})}),f.createElement("div",{className:h()("".concat(V,"-ink-bar"),(0,r.Z)({},"".concat(V,"-ink-bar-animated"),u.inkBar)),style:_e}))))),f.createElement(M,(0,i.Z)({},t,{removeAriaLabel:null==I?void 0:I.removeAriaLabel,ref:Q,prefixCls:V,tabs:pe,className:!Ee&&Ft,tabMoving:!!Kt})),f.createElement(L,{ref:W,position:"right",extra:y,prefixCls:V})))})),G=$;var K=f.forwardRef((function(t,e){var n=t.prefixCls,i=t.className,r=t.style,s=t.id,a=t.active,o=t.tabKey,l=t.children;return f.createElement("div",{id:s&&"".concat(s,"-panel-").concat(o),role:"tabpanel",tabIndex:a?0:-1,"aria-labelledby":s&&"".concat(s,"-tab-").concat(o),"aria-hidden":!a,style:r,className:h()(n,a&&"".concat(n,"-active"),i),ref:e},l)})),j=["renderTabBar"],V=["label","key"];var Z=function(t){var e=t.renderTabBar,n=(0,l.Z)(t,j),r=f.useContext(p).tabs;return e?e((0,s.Z)((0,s.Z)({},n),{},{panes:r.map((function(t){var e=t.label,n=t.key,r=(0,l.Z)(t,V);return f.createElement(K,(0,i.Z)({tab:e,key:n,tabKey:n},r))}))}),G):f.createElement(G,n)},z=n(77900),H=["key","forceRender","style","className","destroyInactiveTabPane"],W=function(t){var e=t.id,n=t.activeKey,a=t.animated,o=t.tabPosition,u=t.destroyInactiveTabPane,c=f.useContext(p),d=c.prefixCls,g=c.tabs,_=a.tabPane,m="".concat(d,"-tabpane");return f.createElement("div",{className:h()("".concat(d,"-content-holder"))},f.createElement("div",{className:h()("".concat(d,"-content"),"".concat(d,"-content-").concat(o),(0,r.Z)({},"".concat(d,"-content-animated"),_))},g.map((function(t){var r=t.key,o=t.forceRender,c=t.style,d=t.className,p=t.destroyInactiveTabPane,g=(0,l.Z)(t,H),v=r===n;return f.createElement(z.default,(0,i.Z)({key:r,visible:v,forceRender:o,removeOnLeave:!(!u&&!p),leavedClassName:"".concat(m,"-hidden")},a.tabPaneMotion),(function(t,n){var a=t.style,o=t.className;return f.createElement(K,(0,i.Z)({},g,{prefixCls:m,id:e,tabKey:r,animated:_,active:v,style:(0,s.Z)((0,s.Z)({},c),a),className:h()(d,o),ref:n}))}))}))))};n(48736);var Y=["id","prefixCls","className","items","direction","activeKey","defaultActiveKey","editable","animated","tabPosition","tabBarGutter","tabBarStyle","tabBarExtraContent","locale","more","destroyInactiveTabPane","renderTabBar","onChange","onTabClick","onTabScroll","getPopupContainer","popupClassName","indicator"],q=0,Q=f.forwardRef((function(t,e){var n=t.id,u=t.prefixCls,g=void 0===u?"rc-tabs":u,_=t.className,m=t.items,v=t.direction,y=t.activeKey,b=t.defaultActiveKey,E=t.editable,w=t.animated,T=t.tabPosition,k=void 0===T?"top":T,S=t.tabBarGutter,A=t.tabBarStyle,D=t.tabBarExtraContent,C=t.locale,x=t.more,R=t.destroyInactiveTabPane,L=t.renderTabBar,I=t.onChange,P=t.onTabClick,O=t.onTabScroll,F=t.getPopupContainer,M=t.popupClassName,N=t.indicator,B=(0,l.Z)(t,Y),U=f.useMemo((function(){return(m||[]).filter((function(t){return t&&"object"===(0,o.Z)(t)&&"key"in t}))}),[m]),$="rtl"===v,G=function(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{inkBar:!0,tabPane:!1};return(t=!1===e?{inkBar:!1,tabPane:!1}:!0===e?{inkBar:!0,tabPane:!1}:(0,s.Z)({inkBar:!0},"object"===(0,o.Z)(e)?e:{})).tabPaneMotion&&void 0===t.tabPane&&(t.tabPane=!0),!t.tabPaneMotion&&t.tabPane&&(t.tabPane=!1),t}(w),K=(0,f.useState)(!1),j=(0,a.Z)(K,2),V=j[0],z=j[1];(0,f.useEffect)((function(){z((0,d.Z)())}),[]);var H=(0,c.Z)((function(){var t;return null===(t=U[0])||void 0===t?void 0:t.key}),{value:y,defaultValue:b}),Q=(0,a.Z)(H,2),X=Q[0],J=Q[1],tt=(0,f.useState)((function(){return U.findIndex((function(t){return t.key===X}))})),et=(0,a.Z)(tt,2),nt=et[0],it=et[1];(0,f.useEffect)((function(){var t,e=U.findIndex((function(t){return t.key===X}));-1===e&&(e=Math.max(0,Math.min(nt,U.length-1)),J(null===(t=U[e])||void 0===t?void 0:t.key));it(e)}),[U.map((function(t){return t.key})).join("_"),X,nt]);var rt=(0,c.Z)(null,{value:n}),st=(0,a.Z)(rt,2),at=st[0],ot=st[1];(0,f.useEffect)((function(){n||(ot("rc-tabs-".concat(q)),q+=1)}),[]);var lt={id:at,activeKey:X,animated:G,tabPosition:k,rtl:$,mobile:V},ut=(0,s.Z)((0,s.Z)({},lt),{},{editable:E,locale:C,more:x,tabBarGutter:S,onTabClick:function(t,e){null==P||P(t,e);var n=t!==X;J(t),n&&(null==I||I(t))},onTabScroll:O,extra:D,style:A,panes:null,getPopupContainer:F,popupClassName:M,indicator:N});return f.createElement(p.Provider,{value:{tabs:U,prefixCls:g}},f.createElement("div",(0,i.Z)({ref:e,id:n,className:h()(g,"".concat(g,"-").concat(k),(0,r.Z)((0,r.Z)((0,r.Z)({},"".concat(g,"-mobile"),V),"".concat(g,"-editable"),E),"".concat(g,"-rtl"),$),_)},B),f.createElement(Z,(0,i.Z)({},ut,{renderTabBar:L})),f.createElement(W,(0,i.Z)({destroyInactiveTabPane:R},lt,{animated:G}))))}));var X=Q},29125:function(t,e,n){"use strict";n.d(e,{G:function(){return a},Z:function(){return v}});var i=n(92310),r=n.n(i),s=n(59301);function a(t){var e=t.children,n=t.prefixCls,i=t.id,a=t.overlayInnerStyle,o=t.bodyClassName,l=t.className,u=t.style;return s.createElement("div",{className:r()("".concat(n,"-content"),l),style:u},s.createElement("div",{className:r()("".concat(n,"-inner"),o),id:i,role:"tooltip",style:a},"function"==typeof e?e():e))}var o=n(54476),l=n(33885),u=n(75931),h=n(65030),c={shiftX:64,adjustY:1},d={adjustX:1,shiftY:!0},f=[0,0],p={left:{points:["cr","cl"],overflow:d,offset:[-4,0],targetOffset:f},right:{points:["cl","cr"],overflow:d,offset:[4,0],targetOffset:f},top:{points:["bc","tc"],overflow:c,offset:[0,-4],targetOffset:f},bottom:{points:["tc","bc"],overflow:c,offset:[0,4],targetOffset:f},topLeft:{points:["bl","tl"],overflow:c,offset:[0,-4],targetOffset:f},leftTop:{points:["tr","tl"],overflow:d,offset:[-4,0],targetOffset:f},topRight:{points:["br","tr"],overflow:c,offset:[0,-4],targetOffset:f},rightTop:{points:["tl","tr"],overflow:d,offset:[4,0],targetOffset:f},bottomRight:{points:["tr","br"],overflow:c,offset:[0,4],targetOffset:f},rightBottom:{points:["bl","br"],overflow:d,offset:[4,0],targetOffset:f},bottomLeft:{points:["tl","bl"],overflow:c,offset:[0,4],targetOffset:f},leftBottom:{points:["br","bl"],overflow:d,offset:[-4,0],targetOffset:f}},g=n(80402),_=["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","motion","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle","arrowContent","overlay","id","showArrow","classNames","styles"],m=function(t,e){var n=t.overlayClassName,i=t.trigger,c=void 0===i?["hover"]:i,d=t.mouseEnterDelay,f=void 0===d?0:d,m=t.mouseLeaveDelay,v=void 0===m?.1:m,y=t.overlayStyle,b=t.prefixCls,E=void 0===b?"rc-tooltip":b,w=t.children,T=t.onVisibleChange,k=t.afterVisibleChange,S=t.transitionName,A=t.animation,D=t.motion,C=t.placement,x=void 0===C?"right":C,R=t.align,L=void 0===R?{}:R,I=t.destroyTooltipOnHide,P=void 0!==I&&I,O=t.defaultVisible,F=t.getTooltipContainer,M=t.overlayInnerStyle,N=(t.arrowContent,t.overlay),B=t.id,U=t.showArrow,$=void 0===U||U,G=t.classNames,K=t.styles,j=(0,u.Z)(t,_),V=(0,g.Z)(B),Z=(0,s.useRef)(null);(0,s.useImperativeHandle)(e,(function(){return Z.current}));var z=(0,l.Z)({},j);"visible"in t&&(z.popupVisible=t.visible);var H,W,Y;return s.createElement(h.Z,(0,o.Z)({popupClassName:r()(n,null==G?void 0:G.root),prefixCls:E,popup:function(){return s.createElement(a,{key:"content",prefixCls:E,id:V,bodyClassName:null==G?void 0:G.body,overlayInnerStyle:(0,l.Z)((0,l.Z)({},M),null==K?void 0:K.body)},N)},action:c,builtinPlacements:p,popupPlacement:x,ref:Z,popupAlign:L,getPopupContainer:F,onPopupVisibleChange:T,afterPopupVisibleChange:k,popupTransitionName:S,popupAnimation:A,popupMotion:D,defaultPopupVisible:O,autoDestroy:P,mouseLeaveDelay:v,popupStyle:(0,l.Z)((0,l.Z)({},y),null==K?void 0:K.root),mouseEnterDelay:f,arrow:$},z),(H=s.Children.only(w),W=(null==H?void 0:H.props)||{},Y=(0,l.Z)((0,l.Z)({},W),{},{"aria-describedby":N?V:null}),s.cloneElement(w,Y)))},v=(0,s.forwardRef)(m)},49658:function(t,e){"use strict";e.Z=function(){if("undefined"==typeof navigator||"undefined"==typeof window)return!1;var t=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(t)||/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(null==t?void 0:t.substr(0,4))}},83145:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CopyToClipboard=void 0;var i=s(n(59301)),r=s(n(25769));function s(t){return t&&t.__esModule?t:{default:t}}function a(t){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},a(t)}function o(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,i)}return n}function l(t,e){if(null==t)return{};var n,i,r=function(t,e){if(null==t)return{};var n,i,r={},s=Object.keys(t);for(i=0;i<s.length;i++)n=s[i],e.indexOf(n)>=0||(r[n]=t[n]);return r}(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)n=s[i],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function u(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function h(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function c(t,e){return!e||"object"!==a(e)&&"function"!=typeof e?f(t):e}function d(t){return d=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},d(t)}function f(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function p(t,e){return p=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},p(t,e)}function g(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var _=function(t){function e(){var t,n;u(this,e);for(var s=arguments.length,a=new Array(s),o=0;o<s;o++)a[o]=arguments[o];return g(f(n=c(this,(t=d(e)).call.apply(t,[this].concat(a)))),"onClick",(function(t){var e=n.props,s=e.text,a=e.onCopy,o=e.children,l=e.options,u=i.default.Children.only(o),h=(0,r.default)(s,l);a&&a(s,h),u&&u.props&&"function"==typeof u.props.onClick&&u.props.onClick(t)})),n}var n,s,a;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&p(t,e)}(e,t),n=e,s=[{key:"render",value:function(){var t=this.props,e=(t.text,t.onCopy,t.options,t.children),n=l(t,["text","onCopy","options","children"]),r=i.default.Children.only(e);return i.default.cloneElement(r,function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?o(n,!0).forEach((function(e){g(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):o(n).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}({},n,{onClick:this.onClick}))}}],s&&h(n.prototype,s),a&&h(n,a),e}(i.default.PureComponent);e.CopyToClipboard=_,g(_,"defaultProps",{onCopy:void 0,options:void 0})},56102:function(t,e,n){"use strict";var i=n(83145).CopyToClipboard;i.CopyToClipboard=i,t.exports=i},76374:function(t,e,n){"use strict";var i=function(){if("undefined"!=typeof Map)return Map;function t(t,e){var n=-1;return t.some((function(t,i){return t[0]===e&&(n=i,!0)})),n}return function(){function e(){this.__entries__=[]}return Object.defineProperty(e.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),e.prototype.get=function(e){var n=t(this.__entries__,e),i=this.__entries__[n];return i&&i[1]},e.prototype.set=function(e,n){var i=t(this.__entries__,e);~i?this.__entries__[i][1]=n:this.__entries__.push([e,n])},e.prototype.delete=function(e){var n=this.__entries__,i=t(n,e);~i&&n.splice(i,1)},e.prototype.has=function(e){return!!~t(this.__entries__,e)},e.prototype.clear=function(){this.__entries__.splice(0)},e.prototype.forEach=function(t,e){void 0===e&&(e=null);for(var n=0,i=this.__entries__;n<i.length;n++){var r=i[n];t.call(e,r[1],r[0])}},e}()}(),r="undefined"!=typeof window&&"undefined"!=typeof document&&window.document===document,s=void 0!==n.g&&n.g.Math===Math?n.g:"undefined"!=typeof self&&self.Math===Math?self:"undefined"!=typeof window&&window.Math===Math?window:Function("return this")(),a="function"==typeof requestAnimationFrame?requestAnimationFrame.bind(s):function(t){return setTimeout((function(){return t(Date.now())}),1e3/60)};var o=["top","right","bottom","left","width","height","size","weight"],l="undefined"!=typeof MutationObserver,u=function(){function t(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=function(t,e){var n=!1,i=!1,r=0;function s(){n&&(n=!1,t()),i&&l()}function o(){a(s)}function l(){var t=Date.now();if(n){if(t-r<2)return;i=!0}else n=!0,i=!1,setTimeout(o,e);r=t}return l}(this.refresh.bind(this),20)}return t.prototype.addObserver=function(t){~this.observers_.indexOf(t)||this.observers_.push(t),this.connected_||this.connect_()},t.prototype.removeObserver=function(t){var e=this.observers_,n=e.indexOf(t);~n&&e.splice(n,1),!e.length&&this.connected_&&this.disconnect_()},t.prototype.refresh=function(){this.updateObservers_()&&this.refresh()},t.prototype.updateObservers_=function(){var t=this.observers_.filter((function(t){return t.gatherActive(),t.hasActive()}));return t.forEach((function(t){return t.broadcastActive()})),t.length>0},t.prototype.connect_=function(){r&&!this.connected_&&(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),l?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},t.prototype.disconnect_=function(){r&&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)},t.prototype.onTransitionEnd_=function(t){var e=t.propertyName,n=void 0===e?"":e;o.some((function(t){return!!~n.indexOf(t)}))&&this.refresh()},t.getInstance=function(){return this.instance_||(this.instance_=new t),this.instance_},t.instance_=null,t}(),h=function(t,e){for(var n=0,i=Object.keys(e);n<i.length;n++){var r=i[n];Object.defineProperty(t,r,{value:e[r],enumerable:!1,writable:!1,configurable:!0})}return t},c=function(t){return t&&t.ownerDocument&&t.ownerDocument.defaultView||s},d=v(0,0,0,0);function f(t){return parseFloat(t)||0}function p(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];return e.reduce((function(e,n){return e+f(t["border-"+n+"-width"])}),0)}function g(t){var e=t.clientWidth,n=t.clientHeight;if(!e&&!n)return d;var i=c(t).getComputedStyle(t),r=function(t){for(var e={},n=0,i=["top","right","bottom","left"];n<i.length;n++){var r=i[n],s=t["padding-"+r];e[r]=f(s)}return e}(i),s=r.left+r.right,a=r.top+r.bottom,o=f(i.width),l=f(i.height);if("border-box"===i.boxSizing&&(Math.round(o+s)!==e&&(o-=p(i,"left","right")+s),Math.round(l+a)!==n&&(l-=p(i,"top","bottom")+a)),!function(t){return t===c(t).document.documentElement}(t)){var u=Math.round(o+s)-e,h=Math.round(l+a)-n;1!==Math.abs(u)&&(o-=u),1!==Math.abs(h)&&(l-=h)}return v(r.left,r.top,o,l)}var _="undefined"!=typeof SVGGraphicsElement?function(t){return t instanceof c(t).SVGGraphicsElement}:function(t){return t instanceof c(t).SVGElement&&"function"==typeof t.getBBox};function m(t){return r?_(t)?function(t){var e=t.getBBox();return v(0,0,e.width,e.height)}(t):g(t):d}function v(t,e,n,i){return{x:t,y:e,width:n,height:i}}var y=function(){function t(t){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=v(0,0,0,0),this.target=t}return t.prototype.isActive=function(){var t=m(this.target);return this.contentRect_=t,t.width!==this.broadcastWidth||t.height!==this.broadcastHeight},t.prototype.broadcastRect=function(){var t=this.contentRect_;return this.broadcastWidth=t.width,this.broadcastHeight=t.height,t},t}(),b=function(t,e){var n,i,r,s,a,o,l,u=(i=(n=e).x,r=n.y,s=n.width,a=n.height,o="undefined"!=typeof DOMRectReadOnly?DOMRectReadOnly:Object,l=Object.create(o.prototype),h(l,{x:i,y:r,width:s,height:a,top:r,right:i+s,bottom:a+r,left:i}),l);h(this,{target:t,contentRect:u})},E=function(){function t(t,e,n){if(this.activeObservations_=[],this.observations_=new i,"function"!=typeof t)throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=t,this.controller_=e,this.callbackCtx_=n}return t.prototype.observe=function(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if("undefined"!=typeof Element&&Element instanceof Object){if(!(t instanceof c(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var e=this.observations_;e.has(t)||(e.set(t,new y(t)),this.controller_.addObserver(this),this.controller_.refresh())}},t.prototype.unobserve=function(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if("undefined"!=typeof Element&&Element instanceof Object){if(!(t instanceof c(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var e=this.observations_;e.has(t)&&(e.delete(t),e.size||this.controller_.removeObserver(this))}},t.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},t.prototype.gatherActive=function(){var t=this;this.clearActive(),this.observations_.forEach((function(e){e.isActive()&&t.activeObservations_.push(e)}))},t.prototype.broadcastActive=function(){if(this.hasActive()){var t=this.callbackCtx_,e=this.activeObservations_.map((function(t){return new b(t.target,t.broadcastRect())}));this.callback_.call(t,e,t),this.clearActive()}},t.prototype.clearActive=function(){this.activeObservations_.splice(0)},t.prototype.hasActive=function(){return this.activeObservations_.length>0},t}(),w="undefined"!=typeof WeakMap?new WeakMap:new i,T=function t(e){if(!(this instanceof t))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var n=u.getInstance(),i=new E(e,n,this);w.set(this,i)};["observe","unobserve","disconnect"].forEach((function(t){T.prototype[t]=function(){var e;return(e=w.get(this))[t].apply(e,arguments)}}));var k=void 0!==s.ResizeObserver?s.ResizeObserver:T;e.Z=k},98040:function(t){t.exports=function(){var t=document.getSelection();if(!t.rangeCount)return function(){};for(var e=document.activeElement,n=[],i=0;i<t.rangeCount;i++)n.push(t.getRangeAt(i));switch(e.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":e.blur();break;default:e=null}return t.removeAllRanges(),function(){"Caret"===t.type&&t.removeAllRanges(),t.rangeCount||n.forEach((function(e){t.addRange(e)})),e&&e.focus()}}},18645:function(t,e,n){"use strict";t.exports=n.p+"static/detailbg1.e67ff29c.png"},76296:function(t){"use strict";t.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEIAAABMCAYAAADZXmGYAAAAAXNSR0IArs4c6QAAHBJJREFUeF7NfAl4HcWV7l/V2719Fy2WLMnyChiMjU2MMeAAIcALMCwBMoEBEhiWB4nDkgmZlwQSiF54IYTAgJkAIQnwWEISEwgEwhAY9h2zGIPB4AULG1myduluvVW971R3X13JMpaMMa/59Mm6t7uqzl//+c85VdUwfI6XlFIHUO0A1SWguwroZ4yJz2NIbGd3KqWkPlMA6jygGoAWj0ECrg902UAXY8zbmWPbaUBIKU0ANS4wgXlIbsNIYRjoQQhIfmcA8pkCEc1+2gEmcg9ZAHycRknDAAHRAWDgs3SbzwQImv1CAXW6jgnMhIntJDk9ZkTISQnX99Fl25+N2+wwIKSUNNtVDjAhmv1y29uJw6jkMYAgMNCb2MFu86mBkFImikCd5qLWZ+UJHKcHbNftMhDIB0V0LFmCgZaWTxdttgsIKSUpfbXrop6ZsD0P29XOdpk/ykPkNvDQmUqhe3ujzbgMkFKmikVM0HXUeADlAP9fXRIItNBtOhljhfEMbptAUNKTy6EGJuo5QwL4fGd/jMbJQDj5oGh1VFerJE1u67lRgahIeurzHqpYRdKzrQZ35PfeGMONAcinuwozujzMrDW13LyqxPI6XeY9GFwz4KSBTkC5jb+18Q0DgsJePo9aw1DCt62kZ1w2j9WocTUKYG2uZN+8rvCDrMWPnpHS+aSkAQHWYTH88vAG82nPC3MXchvLMHr6NqFr0qQt3UYBQeLnANOD7Uh6PisDxwIIMeH4ZzsuTyfZ8buldexZZWJmyoIrJVbmvGKDzs8+qjG5enhbhuQCuYyFdsbYQPxdDITZVfDm0oe2EaYwn6eBYwHB84AHNuYaLl/R8+Be9YbeZOuYlTExM2PCERLvDrhoHfAf/fXeTZf6FRmtAQ9kog1DwMBbcbZaBmJTwZtLjYdghIDsHDAMSTPrweODPvS8E9iarouEkMVM0vAlIH1F78o8Mxznt57dsP9/dRRv3G2igRpLw8SEholJDYGQ+Ljg46NBtvqZL6b/xTdTnKbXMAyV6ERzHQBY8YlAxDNi2/SgR2BtU3VHzmIM6ghaVvxJM2PI+1p793yn4B3tCTafIZhmcW7onCGp84KlaWszXL46J209snfG3liEN6xW+T8v9+x+04rue7INBrJJjqTOkOAMgQT6HAHhstfW/tOEb8G2uW0YI20YOxDxqA0DLHQZTw4ZGFcBYyHy0D3EsiQg7mrNz32+v3gx55ib1RjPGAxpgyOlcVgag8GZitO+ZCgJuEyI5+ZXJZbMzRgbieqG4clrH+2ZcdX9m++EYDb/sg1NZ2AMEAHgOwzHNFs/ffiYqX/fygjHD8QQIAYzDY/pniHIoO2pIXyAXbq8++zNvn9OtQ6zytKQNbgCIa3Tj2IDTMagkVESKAmJQU+g32f99Qb/xdET7CdOPL/1a28O5M4XOZliWaMg9+MZmAzqR+dyRpXxt+Vfa7wym0ySwaNd2w9EKKKAbRssBVCWIgqj+8BWaXLmyx0/zgtxYl2CocrUkIlBMDiyOkdG50jpXFFc5xTRoMQv7wv0uAIdThA8trSw5vVf5/fQJ6PjyCOTPz/hjNpVv3pq82mbIfZKJNjglxqNR+4+avLT5HqfwNdPB0Rlw8wAtxmYrhuBF7rNVjNVCu8nPdOxuMMNzp1oM1RbIQvIFeh3VmeoMjRUmxrSGoetM+jEc4RA5HyBPi9ARynAxryHF+4pvnb517P/fsS+VXkTBk+iINDfDRhJCbuqrIg7BYiYISYDtw1wqSPwvC2FlaLCZW/1LnyoLXdjU5prExIcGZMjGRlMLlFlcNSYIRDEDGKFwUKVLgUS+SAEotMJsLkUIOez/sVTEqd9oTq7Gcb4xRzAjmPESLQDBs02wHQJ4QLlRdjBYlE77Mnu3+m6mNeQ0hQbSAdI5W2NKW0gNyEgak2OKl1DSmcwGAuBII3wBQb9AE4g4Qig2xHQwO/733Nqr9zO+mf7gEjqCIq+p7W73CbBm2xq+aREUGRDi69lhhjgJoOmSwSugeAHL3Qt/MvG/M0NacbqbQ1ZkyOhMZhaCATNPgFRS6ywNMUOcpkQCAm3Yl27EAh0uwHaiwE2FfzSuVNSJy5qylItMd5rfEAkDUO83luqfaRj4JuBpn8po8kJaYNxS9d6zCB4eW42cceuSaODjahKKRHiDFpVEmyfv264vM0NjqmzOWqToVuYnMHUoUJlWgsjR7XJUU16YWiwI8G0NXIhBk9IDPgC/V4QukhJoK0oMNWUV105v+ne7WDF2IEgEK5e1XHIulJwWbXJa2tNhjpLxwSTBsrgg6HLCQYtqV197MTkIyPBiLJUOeOe1gcTKUyuTXFYBlPGmxqUGFoa6QFDKooaISAaGhOa6ofuIbEsBgK5QGDAFQqQHidARzGAzoxH75nNf4Kqus+GESRwSz7oX/Bq3rmhPoEECdgES8OkpI6mhK4EjTK4LjfAunzgJ5i49IxpVf8dpsND1/Pt+ezpj7X/DTZPT6zS0JzWYBKIgkgP5R7kJjTzVSbHFFtXfVAkoTyCwiexIRbMvB9FEEeoCJJh2rt/mmtc4FXX9RkhK7e5xhKNbmyMaM/55rnLu+5tTMlm2wjje31CwzTbQHPSUDQmIDodH60FD6sGg74zpqROnJO0BvRIxalaue3dnqbvPzv4ANKakU5xVCeYco3qBFdZoBtIJHSGJgLYJpHksMhtOIcW5REEBP0Ug5AZBV9iml/AqYleNKcT0k7ZeTC2Brq5xKtuXkGZ8BjosW0giA2LX+38yvuuf1VDEsqf0wZDXULH1KSO5pSOqogRFM42FDysy/noXufdbTztrNyQkbUDnpjo5mRdYLBU167iYGQ0Tbc1VCW5KuqoniA2NKU0BbByFc4UCJRek1DyKHwGgpL7EAyKGPP8PnzXaIORrgIyNUA6G8bZwa6CEPJiPn32sjEwY9tAkDbs//cPf6ZZOLbaCjM8ivmk6A2J8IeoS4zoJQUv+WgvBFj2nIvumzxgTwfQKe8UQMCBg3WgRgPSGpIJhpRJbTJwDkxJ66hNcPU35Q0aC7/TSXCico+CBrkSlaJCCNzgvYnmTBJIpIDsBCBdEzoEJVTdG1Z78w49bRtZJRFm20AQI/a8r/XmVBXbL22GvkoCRwJJfkyhjpQ8gETek+h3A/Q4Ah+878r8zz2fVUmPZXifLnlnfcpYt+kId1FgyUakOViSI2EyWDoD14ApqRAIMppAIBZQf/R3yG9GC0cqKSHgm908bpUvg5HxhgWkqgA7EzKiMAB0bgic5jknWDP32rQN99g2EMSIOX9Yt6SYEgdnE2EVqBGVGZQ/J+KsjwGOHwrZIKl5P9ZcXpO96NCF6d66tO4ZBqRueHLBjRsu2TDgn4QUB2wOWAwGJUwEREZHEhK97Q4apiRhmtRf7BayDAYVX7TOsIvTh7v8Z4GqGkDTAd0CDNpWpcEUgf7N0p2xz4nm7P037hAgDvjDmgs+lOLsVIYp0VLDo8JOFXdD/ksDJN/NOxL1gfHA6ydN/1nRG75ucPlz3XPueLX3dliSKyASTO3lMZ1hckbH5mU9cDZ4qJuSxdRDU6qai8oMZQtNtvIyqkT7Sni+dB/q6zMhI4hWsQ85JSA30Okf8+0T9Eyt86mBoAZufK1vxtVv9vwR1dC1aJZoVZxFI4xjpIBEEABBgclTp6XPu+rAuje3HICHvW/cuKSv5B4IiwSHfI3AYDDyHrx3BoBuHfUHZFE/1wotp58oahDYjivQ+UEO+XVFXNywCtfu+j6QygB6tL0S+EB+UKJ26jXeVxf/KQqln4TFtl2DnqZqce5vW1s6PO+ryISDDnlasWClpoqKAaAG+nPLz2j63tC27dAYSHOueKFr1s3P9d4KXSYUCAQICerKHPkXmJvA5JOrFPsqeyF36G8tYfDtAqTvAw0G9Ck2fmm+0Xcxe90EZ7YakpA51E25Df988Z1jCJ1jE8u4oQ+6S8kT/9y2JCflPrAlELmiAoNAIEwdIBXwD353XMPiA5vt/tEGQUXYW4OD9dcsy7WUpFiUSHD4LvDBKw7aXxkEkgESh2RgT9dVNkZuSMdJ3H4PubdzEGsIbR04wFJAcMlKZ81K/9vvd+lbK1Yt25P6FLP2fVdOnd07BibEQxwbI+K7P8z55tn3bjrvwx73ZGkwGxo5MPXMwHzpNGbNh35z7MT/XNhs5UZbj/AZ+DWre76Vlzi1xmQ2FVZUYVImSRV760YHtz/ci82764oNFFKlK+GvyUN86AIDGrCLBcy2ACbABXNO3C1z2V8Or34Shj3GyR/1tvEBEbqJIe5+q7PhwXfy+63p96dLxtiMlL7hiL1SyxbvU7WxOCKtjrslEH74dtfPGJdHZQ2oGoLS84ZEmJDFKXZrzsOVr/Tgo14feM8D1pdCZZxgAKQZdNAoULnMpjPmpFt+c9DE1+Ol6E+BxPiBiDsjX08anlr+KnoGHXLa+oqURHDh291ndwv/QgKB1hyoVplqG5ic1NXaAzVEUajPF3i+vYAll2+C/7EAJgBYYAANmgKEcz4wc4L1t1v/R+1tB05MDewAEManEeNFW5XeAO8UYkGbG5zT8mb3/KwpdUqlaZU6BmKKbURASFVdUjW5Lu/irr/24OMNDjBTQ21ax5w6C4dMT+G4Xau6Giz5f5OcP5zQddKh8gG08Y6x4v7tZ8TWOiUABIO+2fMP6xPy1EIQzHu1o4R71+dQZ4e1A2WiyjWSYXVJGSoxIsE58kGAtqKPtpyPn8ytU9llTDVVTjKAMw5D49065AMZrt1naWgH5SvRbs12ALLjgNANQxQDP7nRcY/qD+TpRSGmB0IoIx5Ym8OLXQ6qLEq+KKUO3aPG5Ki1wiqTgKD1B0rVe0oCq3pdLNlvolqfCP8Lo3VcW6s0nKpSxgom8Jil4c6MEOthGOM9pLZjXEOTCHJBUPuRECf2+uJfikLUi0CEoU/NHnD/qhye6CypspuSMNICtTRH65RGWGpTiKwzaaYZcp7A2l4fvz+oQYFTZkKcZEcUiUEhcHWNewbnLyWluDMDsRzh8v1YSvDtB4KEUhqQ3Y5oWldyT+n35XHFQFTTykmcDlOxRCYQEE+0FnDP+zmkM1yBQMMLK0soV1GJk2RosDlSBlPFW29OYOnhTaquUWl2xAi6ldosl2GRqSHw1BaXlsbfMILgzzWW/gwVq2MAZPyuQQxoC/xd1jvB6T1ucJQT0B6tAKeaIzo8SQAwVZOEg+4pBrj0H12QVRy6onpEcVLTiDn0Ca1HZEyG7oLA/CoLV+wXLrnFXB/pHsSE8jJUBUsUQziXOmOtJsRdWY5/6LpOx4e25jZjA4IEkBLJ1W4wd33JOavXZ4uKnmdSvaGMl+HMEx04fUa/IxAUKzhw20t9eLm9BKSj2jpOnsnvZbhUV5/S1cJP72CAu7/SiBkZo1yCK3ArNEJxovz3iO8q7tM1Wt/gnQZwf4aJv1i63jVKpPlkIOIQ+F7JWbS+JL7R4/oLHS+IbA47D6vRcFAaDVaGLCCGKI1QvTJVml/9aBe6fREWWlQfxR5MAiElDItD+MB5c7I4Z3ZVNNthO7HhsQsMY0kFKPH3ZeeJQKHJMXVtwIB8JM21pUkN62NibnVhpqvg7VXyoS8bKB32kSv+tcf193D8gNgeGhnNeAhAyAYV5uLfMjReUTeqUun7wZLALU/04KNufzgYVFK6QCLBcN6iGpyyR7Zc6qv1D2VMNOsVs13pGuUQW6EZ9P0WgHCuDlgkdO2phBB3Zk3t3ai+HX4+4rW2NttJVP/0pe7Sae1OMNn3gyFDozAWGx4CE/qpmgkSvshp4/ivyTD4xStNkkss/8jBsg8K2NjtQ/oSls0xd4qF0/apwuxaS+16V4bJeHEm1JzQ7VQojWc7npAogajUEvpIMbWyYI6oYOpaYDL+VgL+rVnDuIUxpnbL1fNH/6Ft2scFb83xC1PCTsJoL/qMBlae9YpOyyyo0IPRWBK7TSimIUsoGqg2o8+o9wZLVztfQ6IbMqFSD8psjKJSWScq9GK0JCwWXRWMo3sNzuRmx5ev9JYKX8gEkw6qrx8sA3HsHR9PffidfCvTpNxvr4T/tQVpXhCB1uvSssuQyoczPKTaZZbEA4zAiWeTBDPWDCWuEaDqsyh6NCZ0tbtVbjdyNbp/OENCgGIgY/esZMJIcY11jAylVfGcL+TLvUWs6CuxwQC5Xy1oamyMXoNQ7Sgg3i60qt0UWnZIQB4yPym+Mtdmfb7PB9wwV4hDY4y+GkycRMXiWQYl+o4MjilN4loGJGQK7WXQFl8ZsApKD2NPrHKRdgwBEjNuSMBjd6LfpM8lKeUbPSW82ldCrxOoxRQGnrt+/0mjALEiAqIiac9kmTxioS0X7ppgmx2P0U50bHjljITARLoRUz8S2LKWxAIbsUQJomRoTOpqsyhOmCqBjTVI3VuW+y2Zolwn6jcW2HBPhMl3+ovsxW5HdhQ9FtBER27HGcvdtKh5OBBH/37dtEdWyvWq6FdvGtEVPyRRXcfl1w9KY/pEjW12fLW/MERzAiccSMiaCkDKoMSJ11AUiO+n9YlqYoRaKa+Y1YiBKhJVRg9qU/U/PLGK71HZLWNYm3PxbGdRrs+7jMYbWxXPM9d4/tZFzQ3DXOOkpVL724q133GL/FLpy0a1ELnFoRuJ5im6PP6LKUysYayzFKjlyljkyou6XFYo9ghQKrUkijgERE3kGirsRkIaa4jSjjIow0Nque8IFNKBj51APtmRx5oBl7mk+JWpC/1bU+ez1mUN9uM/7T/pz/E57WFAnfdQ26x3OsRDL650mhDIlNKMkRcDZu9hyiP3TTDaaKKdrjChimYoDq2x6EUjiWes7PcRKI12JJaVIW+E+IbsidsfcpMwZ6HzYww0Mc91FeWK3hKjvdGRDCDKJjXuzrT1Jy29dOr182f0VZqm7r9tTWGKL73/yZmoTev6Td/+Y1dxsIddETjyZAQBZdrDL6KaDrlgnokjFyZYCUKdcYoHGydhauhRdl12pWiG4ohDaxO0lRjPnHKzOFdRj5NRFTtgkZtQuwRA0ZN4vrOAl7uL6uRdePeQW9Pfmq7nMkzcvqg+8fM90taXXcmODnzxYO3M6odPZsxVfV//Xs+lAcP+lskuumCXmtZKi6sv27h3Ludf6TvsSAh/xKoQRRim9lj239fEl75gIS8CFCJBjQW0EoDKpIymkmahWQFRUXZX7JuEoIQ5SCimoTbQDhll7S91lvBcR0FtN0qi5ZD9YQ2kaW6GY2mTxloeOHzq2ti2p6TU3/+g94iiZCcGMnje1Nlf2Q2rV1sDpeqzfIF5lqlffcmeNZSPly+a/OxlHx1U6AuuDRy+LxAMAR7fJYGEDXz5QBMLZpno9QN4gsYSR5mhKnWI4mGhphhhauVVqcowPYxhKlMNQXmj28HjmwroKPhlKYudWOUOnMuUwf8xSZOXPH7EjOVb+nf4yc9f75gXJK1rMkxeWXalq1fmGrvdwoV+gEHDLN5y1bxpvcMaWCo185XWU7yidol0xRzIUV7YlRLV9QyHHmhh9xka+lwBClnlkDssPQ+NarbDsxZbyyPKm8MSeH/Aw399nMf6QU8tcof1a5yHKgRgm/yViQZalh01/R/hUdAtr0tfW99U4PaFFjBQI/Sbf7Rvbf8WmnLx8s3z8yWxWABPfmX/hntPjnLxuLlJLW12d5//baeIH8BHQwhIxMmYnhJomsJx5CEm6uqZAiTWADXjcdUKYJKto7YcNUIBKafbLFzv3JD38fcNebzT64AigYpQysSoX07HlvmHdSZa9t6l+Kd758xRfj/yOvOpDxN6InGWzvhe1RquvWphw7r4ni2AUM1Lyc58sf1o15cn6zy46a6Dp7wystFsy4baUrf8vluQ30VAOw9kLDVXuVomMXUXjqMOs5BMQy3HVaa9ZM9kYoTFo9wgig60w8gZuooEQAGvdTrqWOEwh40qMJOzrjqLXbVnOv2bx45sHP2tYSnZN15oPyoQ8tSUod1y66KGF0baMyoQ8U0tr7XZb/aKb/mMNdsWbrj34OaPRjYw8Serd+3tTlzileQ3EQRW+H1FUkYJmiYxd56OAw8woCUlSpThRCl5ZdSgZIhyATow9vjHeby0qYQ8ic0Wl4oEg2lN/nZWKvurV45voDeFR71OeGrjF3yfnWNw/sbefNVdLYceOurrTJ8IRNzySU90NXc7hX93Jd9gd3ff8tgZe2+BvH3x+vnOoP7LoCQPgxwZYUKi6Caw7wE69ltgwOFCvRGvXEMdRmHqeNAzbUU8s6GAwdKIs+Sx9+mGa2ny/km2dvm6r+864u2cISyOe6itrlcT/2Zw5jb53f95z7HzhmveCNjGBET8zKEPty7o93GBxvhDx7w5+YEtXjqVYInvth7m5XBV4Mh9txDUyHMowiw6yMS8vQ213E+HTl/d7OC/1+UxUNjK+2dcE5auPd1o4n+1nj7zja0x4KSlK83VeupcjfPZjbq89u/HTivrwNaeqeTwJ90z7LsWKfm997ee4gbyoGTg3bHi1N230I8vt0j9hc3rv+kX9B9Jx99j1PdeBFBVx7Df4TreyhewuZ8OLavFzOFaQ6vUprYsa2hX9Jy528Of9OrinkvXHyMYOy6lyaVvfG36k2M2qsKZx/OMuverD67KrMhb57sCNTUmrlt58oz2kY3MaVmZXtOWXOzmtR9KX0wYVsMQO8j9Z3hAU/zmRyy2qigA13lrysIVDcV1d6+56OitnoDZ/fb3Z+V143sm56/ua+Tvuvfk0aPGDmXEyMZm37F2anvAvs9l0LoX1296+qwZpZH3TPp+W11Xr/sDNy/PRyDtMkNISKe7QGPkDooMnNL33kSCX5X0+n7Tc9EB5TfxRrY76473JnQE1vcMLoNJcuC65WfNH1Y/jGd2x6URn9Rw/a1rDyp57HRTike7Fu/2QBzpK5+p/96G3Xp62GVBwTsFQpgq0k71gIZIGDUtb5n8dxMziV9tOGdq29b6+6dHVlsvfijPZJo+J2nzmzedMf298Rg92r07DAhqfMEtrxmrRe0prht8qVrD9e0XzFw5Wqf2d9YudAa0XwRFeRgmOwxNzNN09lBNVruk67xdP9iaUZTuVy9Ze5jPcJqliT/3fGfm41GF9Wlx2LJa/dQtAtjthtXZtoB9VwTMrjbFf7RfNHPL1wikZKlvrz/SzQZnJqdp1w1cMGML0a0cS+b6dXt4rrjY0OWrDTruXnPRzG2dmhuXKTuUESN7zlz73u6ua5yvSblqYpN++/pR9GNbo538Hxtquxz3QjDBq238elRQt9XIGL7/TIGI+0//Ys1hviu/KXXtj86Pd3l8DOPCgluksapj9Td8pn/RMPl1uR9+eh34TKPGWIyie+YsXWmufdc6LQj4Isvk1+cu27ph6ZZ1X3IDnGPo7J7cT2c8NprwjrXfsd63UxgxzNeveb/O6dHPh+AskdBvGGiZQv+bJXVlWtbu7jp8MWSwdrd9dv3typPD1aOdce10IIaM/nBWKccu1ph8sSoVPNKb088FY+malHVdR0vj5p1hfGUfnxsQ8SCsH310BEo4wbBxU+7Kqe/sbADi/v4f+lz97xYENYMAAAAASUVORK5CYII="},30757:function(t){"use strict";t.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEQAAABMCAYAAADUQBHfAAAAAXNSR0IArs4c6QAAH5JJREFUeF7FfAl0nUeV5q2qf3/7k2QtlmzLTkxsZbdJCAFis44hhGZJSJpu0j0zjc+wZBrmsHRPM4hzukP3YQ8wEGAG0jTQOExDSA8hIZAQZ2FJIAlxdjveLUuy3v7+terO3Prfk2XHi+Qoye9jS++9f6n71b3f/e6tembwIh+IyG/dWy9yjJylI73TY4xFL+aQ2Iv58Jsen8qVc5lSS8VWCCGYAWJPv1u9IJerMsbkizG2FwWQO555xlFGrgfQcLpGhwBQAIAAABzDTmq2U9lUhgZjDF9IYF5QQO64A41oTbNsRDIHNgCP2LOeXw8BshYiIRVxK7TRPfTyEea/UKC8IICMjyO/5OpqnjNW8gUT9gKsU0QyMmrlVvQdWs9YvIBLT+nU5x2QWycw48lKDze4OXeEUcSYZeFxw+HozxMflC9Y7Q3DeeIXdUrWzuOi5w2QbdvQOuBOloSbd6OwxizbPiEXcLISjw/QrC1SJWCVqxuXQAtg8fll0QHZgijK+xpFmyUZzlwWhQGDDnVa6GhQIhYc97l0zok+p+vpHBk1I4m9lY2jjHh40Y5FAwQR2S1Pz+QyHhQU5+JYI1wsQLr3VgjIQbRy+3O19esXh18WBZB796Drw6EyN8QRPLFo03aSG2UsW7bqYeNXK4r18efIL88JkC3btlkrR9bmVey7R4+Z8uSz3pwnQse7tvv+0Z93X3OFCcRebf2QTtOnpF9OCRDKhA/urObDfDFrMJ/P087n/TQdQkHAQmEGtcZE7Y2nn056b0HHwgBBZA8dBK8h2gUUzDhVD1jQCE/x5BYCmu24ddFwvraQMmDegJDcdr0VBcP0F6KrTtGcxbmM4kYokApb9du/0tsaHz+5fjkpINfff7957up1eRb7Hg2TMzjpNYtjzuLdhYCxExUlYaZ2sjLguMaNI/JLK5BL0M9xALbYQFC8k8kFFxS0U+Np4IwBC5+H59H96ZlBJINXDmRJ7R6zDDgGIMju33/ABbNQSDgTxBM0QLvD2mEAzHZSY+ayPZ1DpWr3s+PNr61QPdmK7S2P1If31uJlu+q4gmGSAyHw/AGzVbLZrpGsufOVq0p7CoaKBGfHJO3umOaO52Q+1b2m1W5jf6an+cDt0LziiiPbDEcAcv/9aGYGGnnHypnYmcGTPWQ+n3se4FS7xa75+cEzt01HlycIGxWDYUR0BeO65OUcYKzXBlMwNDjzBce9BUv8fLTIf/wfVxf+qLwM8vbihqv0QOVa0B4YYK2uHUcA8je/2dtzXjY21/eu0B5A7jsfg090jlSgNv9i+9hvD0QfTgA2Gpw5HHD2xpylrlewOawsWsRRYHCuATIFOYcKbMFuO73X/exfrnIfDznjHmSe07BoglpUCWWA7azOGPBUeWLjRpZom+femQCRtaZdcBw8d8TDNZ6HjGVOCRTysN9Mzljv/+X0f2nF8v2CQU57glZMqNGm3wkAsns0b4NjMDAEgMHoJwPOEEw6gTEwBTSyFvvyX53Z+5UBy01OdbK6nj8hfKNSDw2JiLndpf3HByRupmm1DTBYdvC1I8sVzcdCBkAP/cYf9xU+/0DtOgX89YZQjOKCalkCQb/QfsEgZzHo9wS4hgBySEGAcNCAGJyB0B7D6EK0OEPB4NZNQ4VrLh7ONxYyJvKK6XaLhYzxQ1FoVBqRIDAylq0O3L7jwObN6zXJPttDuoAQJm2AvOPg6T0eru/tw+w8Qgg9wG/8el/hCw/UvyURXk52k5Gck1ek/iiUBEvF0JP3oNVsQT7raVdRiYKenAtZm4EfIOQ8RpkBQpl6Ut7mBAi6Fr/7dcvz/+ni3vmBQhPkM2DTsW/ur9d04ek4DkAQQGzZqlLZcWDz+nkAMhtObQAKowuHXdWfyQD9IW4QXE+4TmeUlunnPU/tdzbfW/taomCTDhHNEQgMEeLpvVAo5cG2bWj7AfT1FKHaiqDgmcCQQSuWMFxyYefuGKZ3JLD0XAtGe02YaktyEBjOm/DwzoNwweoBzNri1uVO8L41vW44Wiyr1Y4nm3N0UndMxJZS+Ma+etVoNTjv9gpyeRspK1YhgOiuffvm5SFHM5ehHCw6Hr5hmas8zCK57NHZ6GX/+sR/qwTqI6iUzh9cxhAf2Al8aCUAKii4hg4JSeFiIkSKQ8YAoJtNVBIo5QW0Awb1qoQlAwYMZATo+zAAz+TQjhX0ZQwouEIpFX95fz385mOTqpixzOgdp+cnN5+daQJkoc2AyahttAQzEh6mQAQAU2HISEfkLMQAHLBswOmZ7fsX5iFzkWkDRErhBUt71FifhwRM9+P/fNv2M+/ZH9+UEVHOkCHUqk1IvB6ARAFYJlgCIe8AuAaAYMQXXBNolEgwDQHTLQU5l8Pe6QRQIZQLBki/CetGe8ExOTBAiBWAYzJ6TeFTO6NgvrVXmE997f6DSx+ZSFbmXVb/xw3Dj5y3ErF1jL4MARNUKWYCaDc4dwwpp7fu339KHnIELm2AZcWyOr8XcXnfErVrCvhlNz72TYXqUvPQNDR2NoAv80Dl+zR3cEOALQCKDoGhUsIUHKJYwXQthP6yA4lkkDU57JyO4PRBF3IWh0QqKLoCHINrLyF2pyA0BEPKQBzUz8Y3LL862wS44emKe+1t+ze0fez/2Jt7/v01y5gPxBVHHRqUgP4GoNDB5tbtzx2Q7jMi5eBYyVVfuK9+7hOHkh8rmTi8WYdkfx1gpAxge8B0Ck0zRsYC8AylDa3MtKDck4NQcSi7DDwjVSghAizPmZCxuXauhh/B3pkWnLu8DIpSFTKNi2Uw5Bzay3P8sj9fU3w0EdyYDIC/46u7NvntePRf3rPs+qV5VNExkkEaQgHM+IhDBwf3nTztzkP6UOhMNhzrN7uavbur7IOKiXdRpsC6BIgRwGYAWZ4yK6T6QnAGDouAcQ5BAlDyOFiCQDJ0GM20IihlTBjtcbq6BNsRsihRGgTyFETSJqhBtgVXrgnf/Miryp9shsyg5/zyyab9N9+ZGB/pt2++6X29dzdDLo4Jis4yBZV70p2HDjkJIF5sq399stH3zAQMD/fB5O66+d1YypdoeUGBTgsFNDxi0I6nEyxKSoBaHdzeAsl0yFsMbJPCgYHNOUy3E1hasGAob+qw4hxQKcpgCL/ffhBWD5XBc8xU0QqtZtEQ/Kkrx7KbBnKWVpuUYTZ9fudl7RqsuWO8/x85uCwOGZ/bvO42sxNlK+O5AmIohT94hA1t3x2ctXal9TvbEe4j+9TWBJUu+1LJNVfmdAojvw1AbVdkwG0BSzIURggWhRTnYHEG1XYCy8oulD1Dcw7TAkYxpQBm2jINO1uASY6XCjjkAP4ZJf6mt68b3h4Gvk7/7/76rgue2pu846d/O/QRz3WZjYBhELDkqGLRULZKngsgBMa/PZT0Pv4Mu/T0VfYt71prTnz7cX/D/hr7nlRKz2SX+AiW2aUWUliNOkAml4YQZ5C1GBTtdM2J6pYwUVCrtGHN8jLkLANcM+UdMlwqBD9G2DfTAIMhrBoopumYA5oMVH+eb77q7J5bDQZcoY+bPjf5lnZdrX3wn0b/oRGAFmO6L4KAcRjybgglCpUxVNq/kR2vlpmjVI8VNcQb190k/9LLwuPXbMrcY3GfXbcV/rQRi886QoHJEfwENT9oQMhf4iiVvXaOUgwwi3iAOAWg1yOjFXDOIIhTfdKfNSBvpZnFNlJGJFAoEg+1KSUrGMhZnVSsvUT1uvzjm88v35BwEA/siMz3fmvPtX095s9+9bFlt3UBORYohkL16IGFKtUOMiTMvn9/a+SZp+MP/cnr7I+tzrDIyFvy+ntb10gw/9YVqA0lr6iECJFE7SzYoFARALaVFkU8rWtsjpC304KOmKZSaYKdcaGcNcEWAhzBwDZEWssQNxA9JQoafgBRuw1jK5akzia4Knns7z988fD11cDnb/3MrjdNVJO3/dPV/e/fdHo2CI/KMnM9RTk2Prrj0QVK9y4ghiW/8KP2ZaGP5378ne4n25gYhmHJH/whel+sxMcTKdMQQQCf3D9EwOp06hmGCRT43SKPvIIAtATXmYdMrrZjyLoGFByuq1wChTyDsg95UFoFcy3xW+0ARvtymmeE4Cpv499/9JLer13+P3ev3/Zk8omz17h/952rhx6J06L6WUcXFD/wQT1ZPnBKadcwYvnFH7KrohiWX3uF86kpTAyMpbr5SeNdvhSfQSV1rBNdKKWgESloT04B5Ht0tunWNgaXOlzmpmJkCPV6AD1FD3I2B1fQ+WnI6VYAZxokQwiIpYJQKrBUAkNlDzjjqi/D/vstdzWe2TOR/N3AMvszt75/5BfHA2MuOi3fx1MHRCn86u1wfmVSvvfdb7LeM1BCJJK96QljQyth31VSaTNpwHTUqxUIjZzOvKYgl0+LPNkpgGjGtWATDOJEQlirw+BQjzbc4rwTKgiCc32ObgWw1KMQFdz3y6fhwktGoZCx1IOPBVsP7I57Viw3/uGm9624ez5g0BifEyB0g4f3oPWzrfFXMwX2vf/6lsxtEHF+185o2YEWuxMBnUSSDlAQxRKm9uyG4tJhHSaEFAGRUE7sgEI+QMbqYk9RycOg6AK4ptCGUzqmcwmAFBDqkaSedrCdwHQzBgcEVCakUk38+YaXZcc/e1n/3vmCsSiAkCD7yp3++VMHkmuLS2D8vZdm7ztQU9avdqifc4CXkMEKGLSCEBoRp91AOvYpHZOHaEAUQqK9BNMij3OQQQCYxNCrBZtuI4GjwyZVpAQIhY1NfRNgsGMqhsndkQZrdIXz9AdfV9j00oFsuNDVgefsIYQqxrb6X7c3XjlzEP6HlYEfrz/P/fZ0pD6kFH+vUqir15m9k5AZ6NHG0iyTWNOhQn0RSTyjNNdo0zkDSZIfAMoZEmSpUKPOmkPhonuNAEEEMFNVUJlM9+P1DxkwOmjjUJZff91rln1iZ+RbC10yWRRANCiWrW66qzXy1FPwEUzUardXPNGz1HirYTBjcucUtJ+ahsK6EXBzrt7Woj0ElQaFgJCKAEnTNBkeBwEI04RyhmR52lOlQk9GDGo1Bf6MgjhCcAscBpYa0F8wtbI1BEQXDGWuvGb1kq1Vs21GjPFGCMKd5zrrogFCoJBIC4Qlg332VTsOJdf+7rG2GxARCAkYtcEYzEE2JzQX6MqdQoZSMwNIJJEreY0CVAziWg1otdgxXYgDBUmLgaSSVCC4eQ65EoOekgDPot4rZfDUg84fsvB968u7FPLPWUr9KEhUHHMmaE1pPuGTICj/4d9MbNy48Thd95Mo1W7KCgNLXrzUW3JaT/avXcO4HFDmHpkO4f0/OQjTBxPQ/byOJiHhrImV/knb7mkYETLaXTrFD1WwFgczg2BlATIeB5dSsME119D9SIdQiFFsWIaAT7yqB4bzFt1SKcDfcRSfiiPr1zwDrBX6pl5oO0EvOAXEPcEyxEkAacZSjTie85rRnqsyhvEBBBykFEjzT2P+3qMNuOGhOkSSZDwZzHTvw49SMiXjCSdFupOnRMsFg2hmCkTGg1w+C5YGQIHOQuRdjGvVmmYlkvFkIYMrz8zD29bkdGgR/1ABCIyFqNRPODc+HfjhLt8UFtU3xxJn9N4pA0LhkQQBu/LMVRvKtvlRBDhLKZVi32na0O8UBtfeewju3x9oLiCeoPfiJM0qdG7KHenPSKGW44EvQVgCsnaqMyjMBE+zkPaKOVmHPOT8IRc+9vJefe7ctYMuJzHGp6SU3xCMfaseybaKmHGsHTwLBoTql1ak1GtWlc5YnrE+agj+WoWKljr1QFJuSEv+tOTg0E4S+ORd0/DoVJoWI+0VqGdQZxoiVECotWII2/ShVinAohCs3pz2BvISahyR15FXhAmDICJ9o+DsIQeuf/OwbjqnR3cER/oB7YJGgMfjGD8bg3Mr1btHa5QFcQjxxFlDXt/63vxmy+BXKyVz+vEsldTaPQ43P2ZnioxoRwo+/etD8Lt9qaeQ8NLCTKbeUWvH0K5FaRlLdh2sAsw0AVYPUh4GYXEQujuGIClNU7gBg1etysDn37SU1miAI2mS9P10B3j6uuu03X3SjLEEAbZGMXy6geqPGQDW5ZWTA1Jr2k1TqmW5ovXqkdzlOcv6a6nUcCoaUp448fatdMlAx6dC+MGjNfjho039O/VHCRjqe0zOBGk3Xgc/pR0EaCUAeVNnltmJp6IHqXXI4D0XleEDL+vr1Dg0nJQcCGiaJL0SrDtm3YWA7jpc2qMRwFoxqh9FkfqiZOwAtQpOCMgH791TxqRhX7py5OLhrPgoAlunFK2YHL0V4GgXTV/PZpKO5+qlSwawoxLBP/+xBvfvCyFMEJpBApUqfQuk014jkglIv1PTVAEYnVU++tVkcPGqDHz4kn44Z4k7WweloZp6BAFBeNI4iXNSEQhpV6gz+lQU6uVR5AwnY4lfr0Txd0MQjfiR304eM+3+Ymf1/IG89QnO2SZUSL2+jnroREPHO+jGqfEpN6RDO2phtGOrLt0767pPV0K4dXsLfvpEA5454Ovw0Uc3RZCnMATDABgomPCq1Tm46pwynNPvzGbwY2WLudOjJ6HTbzmaX7qOo7N/h1/8WH1G7nf+ZWws/Z5Ox6fGOYyvNe76q9f+JG9br7I4d5DWFjXZdW7b+fXZ31/oPvYwr3SletrHONIEeunHEnbWIth+KIBnZmKoByREELKWgBUlA1b12LCqaEPeMfWKHo0j5awOf3VKgdQbUuXbbRXMjrjbeOkQbpfqusFEgCQKwwMtf8qPog2vXd6/owMIsos+d6MzFQxkv/zusZstwdYbwOOSbXKDcxMVdSpQ5/5nHZ276/qTiohOBu6Sfrqw1HECqmES2gGndOmuQZNKG6wr2o5GSwVbmpHoUtIhGccC17a6fqhvSCGQ7pSg6w/zBvEKXUc8ku4y6DDeEWuuKKf8qD3RDM0EsG0hv+hNq/qe1IBsGB83JqxXFKQwl3zuyrXfzVrGeRQIElFmOI9ztk2ikMZ75KEx6JLsYefsgqFnpJOESJBFcdLZSYsaFOISSseRlu7pA6hVyFDp2KduPCUOAiyWEmzTgCWFDDWDnj0xs6CnH3VDVL848jNshHG4r+FDW6KFoLhgbEbMAoKMXT6+xdpRWNkz06qNfPHPzv561ubn0MgpvGkyGWBUtm2Vtw2bJqVLrzQPR4fD7EiP2EPMIEySTtqkrKJ0E7oRIfhSdkgybREQAASKwQU4XIFBswxMg0bzXPAc6Mt6aYh03JH4THYJvRNaGocuEGmhjL6UyUQ9kNUwMRkgZRcg3wfGZhjwl79lZd8TMI5cA7K73LdkoslGvvSuM7+etfiZ1P7TPEfNHr3AjMrmPBrOutw2uKkOe2MnHrpTcThSZ7mGEkgitRjT7osIrVhBM5TQVmRKil5XcBJ12YKDzRRYnZvEmg1podyGwUIWEqV0yu0eBBD1V+igLE2hQmmeDgWYTLeiuBokhkRlxLSA3Fkfph0ynPFKEMFFV5xxFCDVJi6/9PzB17/6jL6/cG22TEtt/SCK93RdBBQkeceMhrKOJRjTCwSHs0unWNPYHHaR7rXk9mlGUlpoBVTfJLS0kHKGXqWjMEQAU9cxlE4praZjoOp2pJTTPVWtazspPZ2KNP0Sb6QcoiW0qvhRNNGKWCyVpf1hTtuBQFGMVabb0fW/373nU19648vq4+PjnI2Nb7GcwkBP3U+WcRD9+ZzR886XLn3d2sHcpYxhjgZDKlErRWSQUDZHjJdmPdXnWVanx9OZrHTW5pYXNBn6UqpbEqlnV2+hUVL3XqkNS+5Li08ax85Mdxe46K2MY0JPxk2bTXMYpFNIzb7XyUIYShlPNEPViqUpEQRxmL5Oz6kGLp5uRvfd8eT0db/ZMXNP6PiVp695YwgECGy4wzjrDa0cOrmBOMIBDliQCTgvWZoffPv6gbf15uwLk0Tqr33QbOp4pcYNonIED1flMzzvGPRlMe2Ix0vL3ZmkDBMrpZvKFJq65dgJgbQeShOoSTximbq/St2zuV+26qbYuSUMZUGqPw+1o3gmiA1ENOl+JIYJhFQkMmyGyTNbd1S//aM/7LmHmTjRx70Jux7W7xynfohO8sBOu+4pq2DXclGj0RsjKykJRY7cA4b2hjN6xzas6XmnY/KVUXepck4oRRKTgYwdnVHOmQZjWswdwamzvjPHe2bDP9UQdAF1v7ppMg2VVK12SpS0s3ZE0XD4FWdMNcI4mm5HPJTK7F6m70Gkq8cLlccONn/03d/uvflQzZ90M0bFFGzaSYzmfR96ObWi9LC7XMzGtjxqOjv2u6FZyINSpVCGRcF5HmPlOS7PvPm8wUvOHM5dxpkqEZ8QiaWd8tQZBYd4TSmnhnIOaZduNaK9qbsXtdt9PzpvkrG07JCaeGRQ6JLgONUT5aUYVXioFUIzlhY5WHflsLOzjVw22lsNtv7wwYnv/H5n/RnPlTVHmBWJSb1Y2xncOf4XtMF59qFHyovLUQyN/bs9mB30IuHnYwklJbHIOGRRSndZOdf3xvN739qfty5WqKxQN91SEUShROFZtI34rHIOSq5lSUS9z2yuZO7G8iwoHWupm34szzoM3mFYtPACiBthEjWi2EZEQ7ckOyfTeAzOVcVPnvrF45Ub/u3hvb8zuVk1XVbxuFGV5qS/snRpeONR27rneMiRc7Zh/A5jqm/KYdayTNxqF1nMyyB5HjhkpUrsdaM9q1+xunRFxhZnkNFafaZJVRsfSSWX5d3o7L6CYRvCILVLMrvrwt2dibNJmjKL9pDUP+YWbR0u1Hfv5DTVljJohrGhEE2pUO84ID+iLh3dJUSc/v2exo3fv3fvTxuJmjY8XrWSpOZElWZQXBo8sHldcrxvdB5Djx+eu7HxLWb2tGWOP+Pn49AqJjIp0zIql8w1hHA3nrPkFS8ZzPyJIbCPshDdjAiz01lHg0Fybl8heUmZ9vzNDaNuQyntqNF1h3VFmjp1iuyk0c6IMFYqaoRSRUraqNSsZKWwJf6RCOH2Q/7W798/ccND+6q7Miavcdua4dJuDooD/i0zv41hfPyE3/k9ESDpOMaRb1h+pxVWbK8l40KUyLJSUGTCyCJKp7/glV53du9l/SV7o1LSoVSqW6edJYZEIfY4ZviywTL0Z2xb6c5yenSDQNcsc9LTbF3WRQIwrodJ7EtlccZILTOpl03TliQwoab9+NGbH5r85588ePAB0+U1y1YzDnPqItrVvu8+iODGK+b1nyucHJDOoLphJPhSj7VVsa2ghFFcNAyRkQrtsRXFVReuyr0z6xprk5hmTyvctIuVFmtytOhFFw2WhGdya26FSo/QDek5R4dPpJ9gGEppxEqZSqKu5RjnKpGJXtwIE5y8b1ftB9ffvetnfhLPeLZZccGo+uVaszzy+vDOzqb+o4n8eK/nDUh6A2Rj4zeaYXmZk2NJNghYWWJcAmA5Q2LGEMy9cG3PhacPZt4mGA50dwLQLNJmFwkMDUB5wWApPLsv53BgtKNE88ZcQMi5EsQoJN2jiCcU1yt+HTnOOSPpEj451b7tG3fv3fLEZGOX52DdM+xKYhuNWjgZPP2BTVGnrzhfLGa9dkEX6JMv3yJWjPWZmXzoWVYuF4ZJWSZYBFR5jswpZJ3SxWt7Ni0pWq9FJT0Sp1qid4RoggqLtog2jPTiioJnKYW8sykGJUISKkX4mSReycXCWOpqO9ZCnsmpZvTwD39/4IafPHzwIdcWddPFiozNWh7Av69+UQjz+G7dInnIUbfZgmJd5QFbhe2MillJh1GiCgZClkTd6EBudN1p+be7pjhHAgpdDzFqGqfNjigBuarkRq9Z3idKtiECqWKJKBjxxGFBQlmMsGGNMDlw5/aZ733z7t2/DKJoxvWgKnhxJhI13zFy4Ymyx3xnfYEhc8zbsrHxbWZY3uX0s4FsJW6XZKKKCFhgyDyB4Jx3enHd6IB3ucFhaVpJd0WdSsOIQ3zVGUPRQMbJEGRUXXdaz5p7pcLgoYnmT794x/Ybdx1s7c+4rCYcc4a3/NYSLw5uuWZTtFj/McJiANLJRuN8BSy3cktOc402z4dxUlbAC4iK9ItTcEV+3Rk9ry9njf/AQOVoI25HtVNWkn+6ZigcyXmebgkCUINKV4H7a8Efvv3rvf/7lm2Tjxser3kKqlKk4fGG/x8e8/nq6Xy9o5v5FnL+yc/dskWsq7i2OlTIsIJRaPpRicLJBFptTeyBcm5obDTzDs+GlypEQ5fhCuSfrR0Ol2Ztj0ASnONMEO3+v9smv/P1rbvvVoaa8UynylhUlaHfLresMC3GFv9YPA85cmxs3fXXG83qgGNkBzPgB+UkSkrIeZ4xzAgw7TXLvLOWD3pXCAErpET152PD4XDW8RLA+m931W7+3B07/s/eWnAw77EqMF5te9Aw9uwPt41fHi9WeBwLzucLkCPCqFg412FyptBKrKKKk5JhshyCcjOumTlrtPjqct5847vXDpkK2YNf2rr723c+NrkjY0PV4qqCgteKRQju3LUhei7ZY76+9PwC0h3F5VvE0JhrZ7NZz7JUIU54SfmsxIXyQDGzXPJ61i0t5W7bdvBBAFmzMuaMCbLOba+VO9CInq/weOE95KgwgvE7xFgfOCoSOUPKgh9AUdiWh1HIkJnNfE7UILFqTj5oBokTPLB5PfHEiYvg+U79PM97YTzkiMEgO+26W6ysdF1mFLzAb2QswRkmSdvEpJHrN8I7d/0qOlkRNk/7FnzaiwBIZ4zj43xT+QJz94xrQh9A3xQkfWun4huvmF8RtmBL53nB/wMjwfnDaT4WWAAAAABJRU5ErkJggg=="},44523:function(t,e,n){"use strict";n.d(e,{ZP:function(){return hl}});const i=Number.isFinite||function(t){return"number"==typeof t&&isFinite(t)},r=Number.isSafeInteger||function(t){return"number"==typeof t&&Math.abs(t)<=s},s=Number.MAX_SAFE_INTEGER||9007199254740991;let a=function(t){return t.NETWORK_ERROR="networkError",t.MEDIA_ERROR="mediaError",t.KEY_SYSTEM_ERROR="keySystemError",t.MUX_ERROR="muxError",t.OTHER_ERROR="otherError",t}({}),o=function(t){return t.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",t.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",t.KEY_SYSTEM_NO_SESSION="keySystemNoSession",t.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",t.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",t.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",t.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",t.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",t.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",t.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",t.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR="keySystemDestroyMediaKeysError",t.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR="keySystemDestroyCloseSessionError",t.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR="keySystemDestroyRemoveSessionError",t.MANIFEST_LOAD_ERROR="manifestLoadError",t.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",t.MANIFEST_PARSING_ERROR="manifestParsingError",t.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",t.LEVEL_EMPTY_ERROR="levelEmptyError",t.LEVEL_LOAD_ERROR="levelLoadError",t.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",t.LEVEL_PARSING_ERROR="levelParsingError",t.LEVEL_SWITCH_ERROR="levelSwitchError",t.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",t.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",t.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",t.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",t.FRAG_LOAD_ERROR="fragLoadError",t.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",t.FRAG_DECRYPT_ERROR="fragDecryptError",t.FRAG_PARSING_ERROR="fragParsingError",t.FRAG_GAP="fragGap",t.REMUX_ALLOC_ERROR="remuxAllocError",t.KEY_LOAD_ERROR="keyLoadError",t.KEY_LOAD_TIMEOUT="keyLoadTimeOut",t.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",t.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",t.BUFFER_APPEND_ERROR="bufferAppendError",t.BUFFER_APPENDING_ERROR="bufferAppendingError",t.BUFFER_STALLED_ERROR="bufferStalledError",t.BUFFER_FULL_ERROR="bufferFullError",t.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",t.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",t.ASSET_LIST_LOAD_ERROR="assetListLoadError",t.ASSET_LIST_LOAD_TIMEOUT="assetListLoadTimeout",t.ASSET_LIST_PARSING_ERROR="assetListParsingError",t.INTERSTITIAL_ASSET_ITEM_ERROR="interstitialAssetItemError",t.INTERNAL_EXCEPTION="internalException",t.INTERNAL_ABORTED="aborted",t.ATTACH_MEDIA_ERROR="attachMediaError",t.UNKNOWN="unknown",t}({}),l=function(t){return t.MEDIA_ATTACHING="hlsMediaAttaching",t.MEDIA_ATTACHED="hlsMediaAttached",t.MEDIA_DETACHING="hlsMediaDetaching",t.MEDIA_DETACHED="hlsMediaDetached",t.MEDIA_ENDED="hlsMediaEnded",t.STALL_RESOLVED="hlsStallResolved",t.BUFFER_RESET="hlsBufferReset",t.BUFFER_CODECS="hlsBufferCodecs",t.BUFFER_CREATED="hlsBufferCreated",t.BUFFER_APPENDING="hlsBufferAppending",t.BUFFER_APPENDED="hlsBufferAppended",t.BUFFER_EOS="hlsBufferEos",t.BUFFERED_TO_END="hlsBufferedToEnd",t.BUFFER_FLUSHING="hlsBufferFlushing",t.BUFFER_FLUSHED="hlsBufferFlushed",t.MANIFEST_LOADING="hlsManifestLoading",t.MANIFEST_LOADED="hlsManifestLoaded",t.MANIFEST_PARSED="hlsManifestParsed",t.LEVEL_SWITCHING="hlsLevelSwitching",t.LEVEL_SWITCHED="hlsLevelSwitched",t.LEVEL_LOADING="hlsLevelLoading",t.LEVEL_LOADED="hlsLevelLoaded",t.LEVEL_UPDATED="hlsLevelUpdated",t.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",t.LEVELS_UPDATED="hlsLevelsUpdated",t.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",t.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",t.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",t.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",t.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",t.AUDIO_TRACK_UPDATED="hlsAudioTrackUpdated",t.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",t.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",t.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",t.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",t.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",t.SUBTITLE_TRACK_UPDATED="hlsSubtitleTrackUpdated",t.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",t.CUES_PARSED="hlsCuesParsed",t.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",t.INIT_PTS_FOUND="hlsInitPtsFound",t.FRAG_LOADING="hlsFragLoading",t.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",t.FRAG_LOADED="hlsFragLoaded",t.FRAG_DECRYPTED="hlsFragDecrypted",t.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",t.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",t.FRAG_PARSING_METADATA="hlsFragParsingMetadata",t.FRAG_PARSED="hlsFragParsed",t.FRAG_BUFFERED="hlsFragBuffered",t.FRAG_CHANGED="hlsFragChanged",t.FPS_DROP="hlsFpsDrop",t.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",t.MAX_AUTO_LEVEL_UPDATED="hlsMaxAutoLevelUpdated",t.ERROR="hlsError",t.DESTROYING="hlsDestroying",t.KEY_LOADING="hlsKeyLoading",t.KEY_LOADED="hlsKeyLoaded",t.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",t.BACK_BUFFER_REACHED="hlsBackBufferReached",t.STEERING_MANIFEST_LOADED="hlsSteeringManifestLoaded",t.ASSET_LIST_LOADING="hlsAssetListLoading",t.ASSET_LIST_LOADED="hlsAssetListLoaded",t.INTERSTITIALS_UPDATED="hlsInterstitialsUpdated",t.INTERSTITIALS_BUFFERED_TO_BOUNDARY="hlsInterstitialsBufferedToBoundary",t.INTERSTITIAL_ASSET_PLAYER_CREATED="hlsInterstitialAssetPlayerCreated",t.INTERSTITIAL_STARTED="hlsInterstitialStarted",t.INTERSTITIAL_ASSET_STARTED="hlsInterstitialAssetStarted",t.INTERSTITIAL_ASSET_ENDED="hlsInterstitialAssetEnded",t.INTERSTITIAL_ASSET_ERROR="hlsInterstitialAssetError",t.INTERSTITIAL_ENDED="hlsInterstitialEnded",t.INTERSTITIALS_PRIMARY_RESUMED="hlsInterstitialsPrimaryResumed",t.PLAYOUT_LIMIT_REACHED="hlsPlayoutLimitReached",t.EVENT_CUE_ENTER="hlsEventCueEnter",t}({});var u="manifest",h="level",c="audioTrack",d="subtitleTrack",f="main",p="audio",g="subtitle";class _{constructor(t,e=0,n=0){this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=t,this.alpha_=t?Math.exp(Math.log(.5)/t):0,this.estimate_=e,this.totalWeight_=n}sample(t,e){const n=Math.pow(this.alpha_,t);this.estimate_=e*(1-n)+n*this.estimate_,this.totalWeight_+=t}getTotalWeight(){return this.totalWeight_}getEstimate(){if(this.alpha_){const t=1-Math.pow(this.alpha_,this.totalWeight_);if(t)return this.estimate_/t}return this.estimate_}}class m{constructor(t,e,n,i=100){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=n,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new _(t),this.fast_=new _(e),this.defaultTTFB_=i,this.ttfb_=new _(t)}update(t,e){const{slow_:n,fast_:i,ttfb_:r}=this;n.halfLife!==t&&(this.slow_=new _(t,n.getEstimate(),n.getTotalWeight())),i.halfLife!==e&&(this.fast_=new _(e,i.getEstimate(),i.getTotalWeight())),r.halfLife!==t&&(this.ttfb_=new _(t,r.getEstimate(),r.getTotalWeight()))}sample(t,e){const n=(t=Math.max(t,this.minDelayMs_))/1e3,i=8*e/n;this.fast_.sample(n,i),this.slow_.sample(n,i)}sampleTTFB(t){const e=t/1e3,n=Math.sqrt(2)*Math.exp(-Math.pow(e,2)/2);this.ttfb_.sample(n,Math.max(t,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 v(t,e,n){return(e=function(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e);if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function y(){return y=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)({}).hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},y.apply(null,arguments)}function b(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,i)}return n}function E(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?b(Object(n),!0).forEach((function(e){v(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):b(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}class w{constructor(t,e){this.trace=void 0,this.debug=void 0,this.log=void 0,this.warn=void 0,this.info=void 0,this.error=void 0;const n=`[${t}]:`;this.trace=T,this.debug=e.debug.bind(null,n),this.log=e.log.bind(null,n),this.warn=e.warn.bind(null,n),this.info=e.info.bind(null,n),this.error=e.error.bind(null,n)}}const T=function(){},k={trace:T,debug:T,log:T,warn:T,info:T,error:T};function S(){return y({},k)}function A(t,e,n){return e[t]?e[t].bind(e):function(t,e){const n=self.console[t];return n?n.bind(self.console,`${e?"["+e+"] ":""}[${t}] >`):T}(t,n)}const D=S();const C=D;function x(t=!0){if("undefined"==typeof self)return;return(t||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function R(t,e){const n=Object.keys(t),i=Object.keys(e),r=n.length,s=i.length;return!r||!s||r===s&&!n.some((t=>-1===i.indexOf(t)))}function L(t,e=!1){if("undefined"!=typeof TextDecoder){const n=new TextDecoder("utf-8").decode(t);if(e){const t=n.indexOf("\0");return-1!==t?n.substring(0,t):n}return n.replace(/\0/g,"")}const n=t.length;let i,r,s,a="",o=0;for(;o<n;){if(i=t[o++],0===i&&e)return a;if(0!==i&&3!==i)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=t[o++],a+=String.fromCharCode((31&i)<<6|63&r);break;case 14:r=t[o++],s=t[o++],a+=String.fromCharCode((15&i)<<12|(63&r)<<6|(63&s)<<0)}}return a}function I(t){let e="";for(let n=0;n<t.length;n++){let i=t[n].toString(16);i.length<2&&(i="0"+i),e+=i}return e}function P(t){return Uint8Array.from(t.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}function O(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var F,M={exports:{}};var N,B,U,$,G,K=(F||(F=1,N=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,B=/^(?=([^\/?#]*))\1([^]*)$/,U=/(?:\/|^)\.(?=\/)/g,$=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,M.exports=G={buildAbsoluteURL:function(t,e,n){if(n=n||{},t=t.trim(),!(e=e.trim())){if(!n.alwaysNormalize)return t;var i=G.parseURL(t);if(!i)throw new Error("Error trying to parse base URL.");return i.path=G.normalizePath(i.path),G.buildURLFromParts(i)}var r=G.parseURL(e);if(!r)throw new Error("Error trying to parse relative URL.");if(r.scheme)return n.alwaysNormalize?(r.path=G.normalizePath(r.path),G.buildURLFromParts(r)):e;var s=G.parseURL(t);if(!s)throw new Error("Error trying to parse base URL.");if(!s.netLoc&&s.path&&"/"!==s.path[0]){var a=B.exec(s.path);s.netLoc=a[1],s.path=a[2]}s.netLoc&&!s.path&&(s.path="/");var o={scheme:s.scheme,netLoc:r.netLoc,path:null,params:r.params,query:r.query,fragment:r.fragment};if(!r.netLoc&&(o.netLoc=s.netLoc,"/"!==r.path[0]))if(r.path){var l=s.path,u=l.substring(0,l.lastIndexOf("/")+1)+r.path;o.path=G.normalizePath(u)}else o.path=s.path,r.params||(o.params=s.params,r.query||(o.query=s.query));return null===o.path&&(o.path=n.alwaysNormalize?G.normalizePath(r.path):r.path),G.buildURLFromParts(o)},parseURL:function(t){var e=N.exec(t);return e?{scheme:e[1]||"",netLoc:e[2]||"",path:e[3]||"",params:e[4]||"",query:e[5]||"",fragment:e[6]||""}:null},normalizePath:function(t){for(t=t.split("").reverse().join("").replace(U,"");t.length!==(t=t.replace($,"")).length;);return t.split("").reverse().join("")},buildURLFromParts:function(t){return t.scheme+t.netLoc+t.path+t.params+t.query+t.fragment}}),M.exports);class j{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",Z="video",z="audiovideo";class H{constructor(t){this._byteRange=null,this._url=null,this._stats=null,this._streams=null,this.base=void 0,this.relurl=void 0,"string"==typeof t&&(t={url:t}),this.base=t,function(t,e){const n=Q(t,e);n&&(n.enumerable=!0,Object.defineProperty(t,e,n))}(this,"stats")}setByteRange(t,e){const n=t.split("@",2);let i;i=1===n.length?(null==e?void 0:e.byteRangeEndOffset)||0:parseInt(n[1]),this._byteRange=[i,parseInt(n[0])+i]}get baseurl(){return this.base.url}get byteRange(){return null===this._byteRange?[]:this._byteRange}get byteRangeStartOffset(){return this.byteRange[0]}get byteRangeEndOffset(){return this.byteRange[1]}get elementaryStreams(){return null===this._streams&&(this._streams={[V]:null,[Z]:null,[z]:null}),this._streams}set elementaryStreams(t){this._streams=t}get hasStats(){return null!==this._stats}get hasStreams(){return null!==this._streams}get stats(){return null===this._stats&&(this._stats=new j),this._stats}set stats(t){this._stats=t}get url(){return!this._url&&this.baseurl&&this.relurl&&(this._url=K.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(t){this._url=t}clearElementaryStreamInfo(){const{elementaryStreams:t}=this;t[V]=null,t[Z]=null,t[z]=null}}function W(t){return"initSegment"!==t.sn}class Y extends H{constructor(t,e){super(e),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=t}get byteLength(){if(this.hasStats){const t=this.stats.total;if(t)return t}if(this.byteRange.length){const t=this.byteRange[0],e=this.byteRange[1];if(i(t)&&i(e))return e-t}return null}get bitrate(){return this.byteLength?8*this.byteLength/this.duration:this._bitrate?this._bitrate:null}set bitrate(t){this._bitrate=t}get decryptdata(){const{levelkeys:t}=this;if(!t&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkeys&&!this.levelkeys.NONE){const t=this.levelkeys.identity;if(t)this._decryptdata=t.getDecryptData(this.sn);else{const t=Object.keys(this.levelkeys);if(1===t.length){const e=this._decryptdata=this.levelkeys[t[0]]||null;if(e)return e.getDecryptData(this.sn)}}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(null===this.programDateTime)return null;const t=i(this.duration)?this.duration:0;return this.programDateTime+1e3*t}get encrypted(){var t;if(null!=(t=this._decryptdata)&&t.encrypted)return!0;if(this.levelkeys){var e;const t=Object.keys(this.levelkeys),n=t.length;if(n>1||1===n&&null!=(e=this.levelkeys[t[0]])&&e.encrypted)return!0}return!1}get programDateTime(){return null===this._programDateTime&&this.rawProgramDateTime&&(this.programDateTime=Date.parse(this.rawProgramDateTime)),this._programDateTime}set programDateTime(t){i(t)?this._programDateTime=t:this._programDateTime=this.rawProgramDateTime=null}get ref(){return W(this)?(this._ref||(this._ref={base:this.base,start:this.start,duration:this.duration,sn:this.sn,programDateTime:this.programDateTime}),this._ref):null}addStart(t){this.setStart(this.start+t)}setStart(t){this.start=t,this._ref&&(this._ref.start=t)}setDuration(t){this.duration=t,this._ref&&(this._ref.duration=t)}setKeyFormat(t){if(this.levelkeys){const e=this.levelkeys[t];e&&!this._decryptdata&&(this._decryptdata=e.getDecryptData(this.sn))}}abortRequests(){var t,e;null==(t=this.loader)||t.abort(),null==(e=this.keyLoader)||e.abort()}setElementaryStreamInfo(t,e,n,i,r,s=!1){const{elementaryStreams:a}=this,o=a[t];o?(o.startPTS=Math.min(o.startPTS,e),o.endPTS=Math.max(o.endPTS,n),o.startDTS=Math.min(o.startDTS,i),o.endDTS=Math.max(o.endDTS,r)):a[t]={startPTS:e,endPTS:n,startDTS:i,endDTS:r,partial:s}}}class q extends H{constructor(t,e,n,i,r){super(n),this.fragOffset=0,this.duration=0,this.gap=!1,this.independent=!1,this.relurl=void 0,this.fragment=void 0,this.index=void 0,this.duration=t.decimalFloatingPoint("DURATION"),this.gap=t.bool("GAP"),this.independent=t.bool("INDEPENDENT"),this.relurl=t.enumeratedString("URI"),this.fragment=e,this.index=i;const s=t.enumeratedString("BYTERANGE");s&&this.setByteRange(s,r),r&&(this.fragOffset=r.fragOffset+r.duration)}get start(){return this.fragment.start+this.fragOffset}get end(){return this.start+this.duration}get loaded(){const{elementaryStreams:t}=this;return!!(t.audio||t.video||t.audiovideo)}}function Q(t,e){const n=Object.getPrototypeOf(t);if(n){const t=Object.getOwnPropertyDescriptor(n,e);return t||Q(n,e)}}const X=Math.pow(2,32)-1,J=[].push,tt={video:1,audio:2,id3:3,text:4};function et(t){return String.fromCharCode.apply(null,t)}function nt(t,e){const n=t[e]<<8|t[e+1];return n<0?65536+n:n}function it(t,e){const n=st(t,e);return n<0?4294967296+n:n}function rt(t,e){let n=it(t,e);return n*=Math.pow(2,32),n+=it(t,e+4),n}function st(t,e){return t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}function at(t,e){const n=[];if(!e.length)return n;const i=t.byteLength;for(let r=0;r<i;){const s=it(t,r),a=s>1?r+s:i;if(et(t.subarray(r+4,r+8))===e[0])if(1===e.length)n.push(t.subarray(r+8,a));else{const i=at(t.subarray(r+8,a),e.slice(1));i.length&&J.apply(n,i)}r=a}return n}function ot(t){const e=[],n=t[0];let i=8;const r=it(t,i);i+=4;let s=0,a=0;0===n?(s=it(t,i),a=it(t,i+4),i+=8):(s=rt(t,i),a=rt(t,i+8),i+=16),i+=2;let o=t.length+a;const l=nt(t,i);i+=2;for(let n=0;n<l;n++){let n=i;const s=it(t,n);n+=4;const a=2147483647&s;if(1===(2147483648&s)>>>31)return C.warn("SIDX has hierarchical references (not supported)"),null;const l=it(t,n);n+=4,e.push({referenceSize:a,subsegmentDuration:l,info:{duration:l/r,start:o,end:o+a-1}}),o+=a,n+=4,i=n}return{earliestPresentationTime:s,timescale:r,version:n,referencesCount:l,references:e}}function lt(t){const e=[],n=at(t,["moov","trak"]);for(let t=0;t<n.length;t++){const i=n[t],r=at(i,["tkhd"])[0];if(r){let t=r[0];const n=it(r,0===t?12:20),s=at(i,["mdia","mdhd"])[0];if(s){t=s[0];const r=it(s,0===t?12:20),a=at(i,["mdia","hdlr"])[0];if(a){const t=et(a.subarray(8,12)),s={soun:V,vide:Z}[t],o=ut(at(i,["mdia","minf","stbl","stsd"])[0]);s?(e[n]={timescale:r,type:s,stsd:o},e[s]=E({timescale:r,id:n},o)):e[n]={timescale:r,type:t,stsd:o}}}}}return at(t,["moov","mvex","trex"]).forEach((t=>{const n=it(t,4),i=e[n];i&&(i.default={duration:it(t,12),flags:it(t,20)})})),e}function ut(t){const e=t.subarray(8),n=e.subarray(86),i=et(e.subarray(4,8));let r,s=i;const a="enca"===i||"encv"===i;if(a){const t=at(e,[i])[0];at(t.subarray("enca"===i?28:78),["sinf"]).forEach((t=>{const e=at(t,["schm"])[0];if(e){const n=et(e.subarray(4,8));if("cbcs"===n||"cenc"===n){const e=at(t,["frma"])[0];e&&(s=et(e))}}}))}const o=s;switch(s){case"avc1":case"avc2":case"avc3":case"avc4":{const t=at(n,["avcC"])[0];t&&t.length>3&&(s+="."+dt(t[1])+dt(t[2])+dt(t[3]),r=ht("avc1"===o?"dva1":"dvav",n));break}case"mp4a":{const t=at(e,[i])[0],n=at(t.subarray(28),["esds"])[0];if(n&&n.length>7){let t=4;if(3!==n[t++])break;t=ct(n,t),t+=2;const e=n[t++];if(128&e&&(t+=2),64&e&&(t+=n[t++]),4!==n[t++])break;t=ct(n,t);const i=n[t++];if(64!==i)break;if(s+="."+dt(i),t+=12,5!==n[t++])break;t=ct(n,t);const r=n[t++];let a=(248&r)>>3;31===a&&(a+=1+((7&r)<<3)+((224&n[t])>>5)),s+="."+a}break}case"hvc1":case"hev1":{const t=at(n,["hvcC"])[0];if(t&&t.length>12){const e=t[1],n=["","A","B","C"][e>>6],i=31&e,r=it(t,2),a=(32&e)>>5?"H":"L",o=t[12],l=t.subarray(6,12);s+="."+n+i,s+="."+function(t){let e=0;for(let n=0;n<32;n++)e|=(t>>n&1)<<31-n;return e>>>0}(r).toString(16).toUpperCase(),s+="."+a+o;let u="";for(let t=l.length;t--;){const e=l[t];if(e||u){u="."+e.toString(16).toUpperCase()+u}}s+=u}r=ht("hev1"==o?"dvhe":"dvh1",n);break}case"dvh1":case"dvhe":case"dvav":case"dva1":case"dav1":s=ht(s,n)||s;break;case"vp09":{const t=at(n,["vpcC"])[0];if(t&&t.length>6){const e=t[4],n=t[5],i=t[6]>>4&15;s+="."+ft(e)+"."+ft(n)+"."+ft(i)}break}case"av01":{const t=at(n,["av1C"])[0];if(t&&t.length>2){const e=t[1]>>>5,i=31&t[1],a=t[2]>>>7?"H":"M",o=(64&t[2])>>6,l=(32&t[2])>>5,u=2===e&&o?l?12:10:o?10:8,h=(16&t[2])>>4,c=(8&t[2])>>3,d=(4&t[2])>>2,f=3&t[2],p=1,g=1,_=1,m=0;s+="."+e+"."+ft(i)+a+"."+ft(u)+"."+h+"."+c+d+f+"."+ft(p)+"."+ft(g)+"."+ft(_)+"."+m,r=ht("dav1",n)}break}}return{codec:s,encrypted:a,supplemental:r}}function ht(t,e){const n=at(e,["dvvC"]),i=n.length?n[0]:at(e,["dvcC"])[0];if(i){const e=i[2]>>1&127,n=i[2]<<5&32|i[3]>>3&31;return t+"."+ft(e)+"."+ft(n)}}function ct(t,e){const n=e+5;for(;128&t[e++]&&e<n;);return e}function dt(t){return("0"+t.toString(16).toUpperCase()).slice(-2)}function ft(t){return(t<10?"0":"")+t}function pt(t){const e=at(t,["schm"])[0];if(e){const n=et(e.subarray(4,8));if("cbcs"===n||"cenc"===n)return at(t,["schi","tenc"])[0]}return null}function gt(t,e){const n=new Uint8Array(t.length+e.length);return n.set(t),n.set(e,t.length),n}function _t(t,e){const n=[],i=e.samples,r=e.timescale,s=e.id;let a=!1;return at(i,["moof"]).map((o=>{const l=o.byteOffset-8;at(o,["traf"]).map((o=>{const u=at(o,["tfdt"]).map((t=>{const e=t[0];let n=it(t,4);return 1===e&&(n*=Math.pow(2,32),n+=it(t,8)),n/r}))[0];return void 0!==u&&(t=u),at(o,["tfhd"]).map((u=>{const h=it(u,4),c=16777215&it(u,0);let d=0;const f=0!=(16&c);let p=0;const g=0!=(32&c);let _=8;h===s&&(0!=(1&c)&&(_+=8),0!=(2&c)&&(_+=4),0!=(8&c)&&(d=it(u,_),_+=4),f&&(p=it(u,_),_+=4),g&&(_+=4),"video"===e.type&&(a=mt(e.codec)),at(o,["trun"]).map((s=>{const o=s[0],u=16777215&it(s,0),h=0!=(1&u);let c=0;const f=0!=(4&u),g=0!=(256&u);let _=0;const m=0!=(512&u);let v=0;const y=0!=(1024&u),b=0!=(2048&u);let E=0;const w=it(s,4);let T=8;h&&(c=it(s,T),T+=4),f&&(T+=4);let k=c+l;for(let l=0;l<w;l++){if(g?(_=it(s,T),T+=4):_=d,m?(v=it(s,T),T+=4):v=p,y&&(T+=4),b&&(E=0===o?it(s,T):st(s,T),T+=4),e.type===Z){let e=0;for(;e<v;){const s=it(i,k);if(k+=4,vt(a,i[k])){yt(i.subarray(k,k+s),a?2:1,t+E/r,n)}k+=s,e+=s+4}}t+=_/r}})))}))}))})),n}function mt(t){if(!t)return!1;const e=t.substring(0,4);return"hvc1"===e||"hev1"===e||"dvh1"===e||"dvhe"===e}function vt(t,e){if(t){const t=e>>1&63;return 39===t||40===t}return 6===(31&e)}function yt(t,e,n,i){const r=bt(t);let s=0;s+=e;let a=0,o=0,l=0;for(;s<r.length;){a=0;do{if(s>=r.length)break;l=r[s++],a+=l}while(255===l);o=0;do{if(s>=r.length)break;l=r[s++],o+=l}while(255===l);const t=r.length-s;let e=s;if(o<t)s+=o;else if(o>t){C.error(`Malformed SEI payload. ${o} is too small, only ${t} bytes left to parse.`);break}if(4===a){if(181===r[e++]){const t=nt(r,e);if(e+=2,49===t){const t=it(r,e);if(e+=4,1195456820===t){const t=r[e++];if(3===t){const s=r[e++],o=64&s,l=o?2+3*(31&s):0,u=new Uint8Array(l);if(o){u[0]=s;for(let t=1;t<l;t++)u[t]=r[e++]}i.push({type:t,payloadType:a,pts:n,bytes:u})}}}}}else if(5===a&&o>16){const t=[];for(let n=0;n<16;n++){const i=r[e++].toString(16);t.push(1==i.length?"0"+i:i),3!==n&&5!==n&&7!==n&&9!==n||t.push("-")}const s=o-16,l=new Uint8Array(s);for(let t=0;t<s;t++)l[t]=r[e++];i.push({payloadType:a,pts:n,uuid:t.join(""),userData:L(l),userDataBytes:l})}}}function bt(t){const e=t.byteLength,n=[];let i=1;for(;i<e-2;)0===t[i]&&0===t[i+1]&&3===t[i+2]?(n.push(i+2),i+=2):i++;if(0===n.length)return t;const r=e-n.length,s=new Uint8Array(r);let a=0;for(i=0;i<r;a++,i++)a===n[0]&&(a++,n.shift()),s[i]=t[a];return s}function Et(t,e,n){if(16!==t.byteLength)throw new RangeError("Invalid system id");let i,r,s;i=0,r=new Uint8Array,s=new Uint8Array;const a=new Uint8Array(4);return n.byteLength>0&&new DataView(a.buffer).setUint32(0,n.byteLength,!1),function(t,...e){const n=e.length;let i=8,r=n;for(;r--;)i+=e[r].byteLength;const s=new Uint8Array(i);for(s[0]=i>>24&255,s[1]=i>>16&255,s[2]=i>>8&255,s[3]=255&i,s.set(t,4),r=0,i=8;r<n;r++)s.set(e[r],i),i+=e[r].byteLength;return s}([112,115,115,104],new Uint8Array([0,0,0,0]),t,s,r,a,n)}function wt(t){const e=t.getUint32(0),n=t.byteOffset,i=t.byteLength;if(i<e)return{offset:n,size:i};if(1886614376!==t.getUint32(4))return{offset:n,size:e};const r=t.getUint32(8)>>>24;if(0!==r&&1!==r)return{offset:n,size:e};const s=t.buffer,a=I(new Uint8Array(s,n+12,16));let o=null,l=null,u=0;if(0===r)u=28;else{const r=t.getUint32(28);if(!r||i<32+16*r)return{offset:n,size:e};o=[];for(let t=0;t<r;t++)o.push(new Uint8Array(s,n+32+16*t,16));u=32+16*r}if(!u)return{offset:n,size:e};const h=t.getUint32(u);return e-32<h?{offset:n,size:e}:(l=new Uint8Array(s,n+u+4,h),{version:r,systemId:a,kids:o,data:l,offset:n,size:e})}const Tt=()=>/\(Windows.+Firefox\//i.test(navigator.userAgent),kt={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 St(t,e){const n=kt[e];return!!n&&!!n[t.slice(0,4)]}function At(t,e,n=!0){return!t.split(",").some((t=>!Dt(t,e,n)))}function Dt(t,e,n=!0){var i;const r=x(n);return null!=(i=null==r?void 0:r.isTypeSupported(Ct(t,e)))&&i}function Ct(t,e){return`${e}/mp4;codecs=${t}`}function xt(t){if(t){const e=t.substring(0,4);return kt.video[e]}return 2}function Rt(t){const e=Tt();return t.split(",").reduce(((t,n)=>{const i=e&&mt(n)?9:kt.video[n];return i?(2*i+t)/(t?3:2):(kt.audio[n]+t)/(t?2:1)}),0)}const Lt={};const It=/flac|opus|mp4a\.40\.34/i;function Pt(t,e=!0){return t.replace(It,(t=>function(t,e=!0){if(Lt[t])return Lt[t];const n={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"],"mp4a.40.34":["mp3"]}[t];for(let r=0;r<n.length;r++){var i;if(Dt(n[r],"audio",e))return Lt[t]=n[r],n[r];if("mp3"===n[r]&&null!=(i=x(e))&&i.isTypeSupported("audio/mpeg"))return""}return t}(t.toLowerCase(),e)))}function Ot(t,e){if(t&&(t.length>4||-1!==["ac-3","ec-3","alac","fLaC","Opus"].indexOf(t))&&(Ft(t,"audio")||Ft(t,"video")))return t;if(e){const n=e.split(",");if(n.length>1){if(t)for(let e=n.length;e--;)if(n[e].substring(0,4)===t.substring(0,4))return n[e];return n[0]}}return e||t}function Ft(t,e){return St(t,e)&&Dt(t,e)}function Mt(t){if(t.startsWith("av01.")){const e=t.split("."),n=["0","111","01","01","01","0"];for(let t=e.length;t>4&&t<10;t++)e[t]=n[t-4];return e.join(".")}return t}function Nt(t){const e=x(t)||{isTypeSupported:()=>!1};return{mpeg:e.isTypeSupported("audio/mpeg"),mp3:e.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:e.isTypeSupported('audio/mp4; codecs="ac-3"')}}function Bt(t){return t.replace(/^.+codecs=["']?([^"']+).*$/,"$1")}const Ut={supported:!1,smooth:!1,powerEfficient:!1},$t={supported:!0,configurations:[],decodingInfoResults:[{supported:!0,powerEfficient:!0,smooth:!0}]};function Gt(t,e){return{supported:!1,configurations:e,decodingInfoResults:[Ut],error:t}}function Kt(t,e,n,r,s,a){const o=t.videoCodec,l=t.audioCodec?t.audioGroups:null,u=null==a?void 0:a.audioCodec,h=null==a?void 0:a.channels,c=h?parseInt(h):u?1/0:2;let d=null;if(null!=l&&l.length)try{d=1===l.length&&l[0]?e.groups[l[0]].channels:l.reduce(((t,n)=>{if(n){const i=e.groups[n];if(!i)throw new Error(`Audio track group ${n} not found`);Object.keys(i.channels).forEach((e=>{t[e]=(t[e]||0)+i.channels[e]}))}return t}),{2:0})}catch(t){return!0}return void 0!==o&&(o.split(",").some((t=>mt(t)))||t.width>1920&&t.height>1088||t.height>1920&&t.width>1088||t.frameRate>Math.max(r,30)||"SDR"!==t.videoRange&&t.videoRange!==n||t.bitrate>Math.max(s,8e6))||!!d&&i(c)&&Object.keys(d).some((t=>parseInt(t)>c))}function jt(t,e,n,i={}){const r=t.videoCodec;if(!r&&!t.audioCodec||!n)return Promise.resolve($t);const s=[],a=function(t){var e;const n=null==(e=t.videoCodec)?void 0:e.split(","),i=Zt(t),r=t.width||640,s=t.height||480,a=t.frameRate||30,o=t.videoRange.toLowerCase();return n?n.map((t=>{const e={contentType:Ct(Mt(t),"video"),width:r,height:s,bitrate:i,framerate:a};return"sdr"!==o&&(e.transferFunction=o),e})):[]}(t),o=a.length,l=function(t,e,n){var i;const r=null==(i=t.audioCodec)?void 0:i.split(","),s=Zt(t);if(r&&t.audioGroups)return t.audioGroups.reduce(((t,i)=>{var a;const o=i?null==(a=e.groups[i])?void 0:a.tracks:null;return o?o.reduce(((t,e)=>{if(e.groupId===i){const i=parseFloat(e.channels||"");r.forEach((e=>{const r={contentType:Ct(e,"audio"),bitrate:n?Vt(e,s):s};i&&(r.channels=""+i),t.push(r)}))}return t}),t):t}),[]);return[]}(t,e,o>0),u=l.length;for(let t=o||1*u||1;t--;){const e={type:"media-source"};if(o&&(e.video=a[t%o]),u){e.audio=l[t%u];const n=e.audio.bitrate;e.video&&n&&(e.video.bitrate-=n)}s.push(e)}if(r){const t=navigator.userAgent;if(r.split(",").some((t=>mt(t)))&&Tt())return Promise.resolve(Gt(new Error(`Overriding Windows Firefox HEVC MediaCapabilities result based on user-agent string: (${t})`),s))}return Promise.all(s.map((t=>{const e=function(t){let e="";const{audio:n,video:i}=t;if(i){e+=`${Bt(i.contentType)}_r${i.height}x${i.width}f${Math.ceil(i.framerate)}${i.transferFunction||"sd"}_${Math.ceil(i.bitrate/1e5)}`}if(n){e+=`${i?"_":""}${Bt(n.contentType)}_c${n.channels}`}return e}(t);return i[e]||(i[e]=n.decodingInfo(t))}))).then((t=>({supported:!t.some((t=>!t.supported)),configurations:s,decodingInfoResults:t}))).catch((t=>({supported:!1,configurations:s,decodingInfoResults:[],error:t})))}function Vt(t,e){if(e<=1)return 1;let n=128e3;return"ec-3"===t?n=768e3:"ac-3"===t&&(n=64e4),Math.min(e/2,n)}function Zt(t){return 1e3*Math.ceil(Math.max(.9*t.bitrate,t.averageBitrate)/1e3)||1}const zt=["NONE","TYPE-0","TYPE-1",null];const Ht=["SDR","PQ","HLG"];var Wt="",Yt="YES",qt="v2";function Qt(t){const{canSkipUntil:e,canSkipDateRanges:n,age:i}=t;return e&&i<e/2?n?qt:Yt:Wt}class Xt{constructor(t,e,n){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=t,this.part=e,this.skip=n}addDirectives(t){const e=new self.URL(t);return void 0!==this.msn&&e.searchParams.set("_HLS_msn",this.msn.toString()),void 0!==this.part&&e.searchParams.set("_HLS_part",this.part.toString()),this.skip&&e.searchParams.set("_HLS_skip",this.skip),e.href}}class Jt{constructor(t){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=[t.url],this._attrs=[t.attrs],this.bitrate=t.bitrate,t.details&&(this.details=t.details),this.id=t.id||0,this.name=t.name,this.width=t.width||0,this.height=t.height||0,this.frameRate=t.attrs.optionalFloat("FRAME-RATE",0),this._avgBitrate=t.attrs.decimalInteger("AVERAGE-BANDWIDTH"),this.audioCodec=t.audioCodec,this.videoCodec=t.videoCodec,this.codecSet=[t.videoCodec,t.audioCodec].filter((t=>!!t)).map((t=>t.substring(0,4))).join(","),"supplemental"in t){var e;this.supplemental=t.supplemental;const n=null==(e=t.supplemental)?void 0:e.videoCodec;n&&n!==t.videoCodec&&(this.codecSet+=`,${n.substring(0,4)}`)}this.addGroupId("audio",t.attrs.AUDIO),this.addGroupId("text",t.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(t){return te(this._audioGroups,t)}hasSubtitleGroup(t){return te(this._subtitleGroups,t)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(t,e){if(e)if("audio"===t){let t=this._audioGroups;t||(t=this._audioGroups=[]),-1===t.indexOf(e)&&t.push(e)}else if("text"===t){let t=this._subtitleGroups;t||(t=this._subtitleGroups=[]),-1===t.indexOf(e)&&t.push(e)}}get urlId(){return 0}set urlId(t){}get audioGroupIds(){return this.audioGroups?[this.audioGroupId]:void 0}get textGroupIds(){return this.subtitleGroups?[this.textGroupId]:void 0}get audioGroupId(){var t;return null==(t=this.audioGroups)?void 0:t[0]}get textGroupId(){var t;return null==(t=this.subtitleGroups)?void 0:t[0]}addFallback(){}}function te(t,e){return!(!e||!t)&&-1!==t.indexOf(e)}function ee(t,e){let n=!1,i=[];if(t&&(n="SDR"!==t,i=[t]),e){i=e.allowedVideoRanges||Ht.slice(0);const t="SDR"!==i.join("")&&!e.videoCodec;n=void 0!==e.preferHDR?e.preferHDR:t&&function(){if("function"==typeof matchMedia){const t=matchMedia("(dynamic-range: high)"),e=matchMedia("bad query");if(t.media!==e.media)return!0===t.matches}return!1}(),n||(i=["SDR"])}return{preferHDR:n,allowedVideoRanges:i}}const ne=(t,e)=>JSON.stringify(t,(t=>{const e=new WeakSet;return(n,i)=>{if(t&&(i=t(n,i)),"object"==typeof i&&null!==i){if(e.has(i))return;e.add(i)}return i}})(e));function ie(t,e){C.log(`[abr] start candidates with "${t}" ignored because ${e}`)}function re(t){return t.reduce(((t,e)=>{let n=t.groups[e.groupId];n||(n=t.groups[e.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),n.tracks.push(e);const i=e.channels||"2";return n.channels[i]=(n.channels[i]||0)+1,n.hasDefault=n.hasDefault||e.default,n.hasAutoSelect=n.hasAutoSelect||e.autoselect,n.hasDefault&&(t.hasDefaultAudio=!0),n.hasAutoSelect&&(t.hasAutoSelectAudio=!0),t}),{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function se(t){if(!t)return t;const{lang:e,assocLang:n,characteristics:i,channels:r,audioCodec:s}=t;return{lang:e,assocLang:n,characteristics:i,channels:r,audioCodec:s}}function ae(t,e,n){if("attrs"in t){const n=e.indexOf(t);if(-1!==n)return n}for(let i=0;i<e.length;i++){if(oe(t,e[i],n))return i}return-1}function oe(t,e,n){const{groupId:i,name:r,lang:s,assocLang:a,default:o}=t,l=t.forced;return(void 0===i||e.groupId===i)&&(void 0===r||e.name===r)&&(void 0===s||function(t,e="--"){if(t.length===e.length)return t===e;return t.startsWith(e)||e.startsWith(t)}(s,e.lang))&&(void 0===s||e.assocLang===a)&&(void 0===o||e.default===o)&&(void 0===l||e.forced===l)&&(!("characteristics"in t)||function(t,e=""){const n=t.split(","),i=e.split(",");return n.length===i.length&&!n.some((t=>-1===i.indexOf(t)))}(t.characteristics||"",e.characteristics))&&(void 0===n||n(t,e))}function le(t,e){const{audioCodec:n,channels:i}=t;return!(void 0!==n&&(e.audioCodec||"").substring(0,4)!==n.substring(0,4)||void 0!==i&&i!==(e.channels||"2"))}function ue(t,e,n){for(let i=e;i>-1;i--)if(n(t[i]))return i;for(let i=e+1;i<t.length;i++)if(n(t[i]))return i;return-1}function he(t,e){var n;return!!t&&t!==(null==(n=e.loadLevelObj)?void 0:n.uri)}const ce=function(t,e){let n=0,i=t.length-1,r=null,s=null;for(;n<=i;){r=(n+i)/2|0,s=t[r];const a=e(s);if(a>0)n=r+1;else{if(!(a<0))return s;i=r-1}}return null};function de(t,e,n=0,i=0,r=.005){let s=null;if(t){s=e[1+t.sn-e[0].sn]||null;const i=t.endDTS-n;i>0&&i<15e-7&&(n+=15e-7),s&&t.level!==s.level&&s.end<=t.end&&(s=e[2+t.sn-e[0].sn]||null)}else 0===n&&0===e[0].start&&(s=e[0]);if(s&&((!t||t.level===s.level)&&0===fe(n,i,s)||function(t,e,n){if(e&&0===e.start&&e.level<t.level&&(e.endPTS||0)>0){const i=e.tagList.reduce(((t,e)=>("INF"===e[0]&&(t+=parseFloat(e[1])),t)),n);return t.start<=i}return!1}(s,t,Math.min(r,i))))return s;const a=ce(e,fe.bind(null,n,i));return!a||a===t&&s?s:a}function fe(t=0,e=0,n){if(n.start<=t&&n.start+n.duration>t)return 0;const i=Math.min(e,n.duration+(n.deltaPTS?n.deltaPTS:0));return n.start+n.duration-i<=t?1:n.start-i>t&&n.start?-1:0}function pe(t,e,n){const i=1e3*Math.min(e,n.duration+(n.deltaPTS?n.deltaPTS:0));return(n.endProgramDateTime||0)-i>t}function ge(t,e,n){if(t&&t.startCC<=e&&t.endCC>=e){let i=t.fragments;const{fragmentHint:r}=t;let s;return r&&(i=i.concat(r)),ce(i,(t=>t.cc<e?1:t.cc>e?-1:(s=t,t.end<=n?1:t.start>n?-1:0))),s||null}return null}function _e(t){switch(t.details){case o.FRAG_LOAD_TIMEOUT:case o.KEY_LOAD_TIMEOUT:case o.LEVEL_LOAD_TIMEOUT:case o.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function me(t){return t.details.startsWith("key")}function ve(t){return me(t)&&!!t.frag&&!t.frag.decryptdata}function ye(t,e){const n=_e(e);return t.default[(n?"timeout":"error")+"Retry"]}function be(t,e){const n="linear"===t.backoff?1:Math.pow(2,e);return Math.min(n*t.retryDelayMs,t.maxRetryDelayMs)}function Ee(t){return E(E({},t),{errorRetry:null,timeoutRetry:null})}function we(t,e,n,i){if(!t)return!1;const r=null==i?void 0:i.code,s=e<t.maxNumRetry&&(function(t){return Te(t)||!!t&&(t<400||t>499)}(r)||!!n);return t.shouldRetry?t.shouldRetry(t,e,n,i,s):s}function Te(t){return 0===t&&!1===navigator.onLine}var ke=0,Se=2,Ae=3,De=5,Ce=0,xe=1,Re=2,Le=4;function Ie(t){const e={action:ke,flags:Ce};return t&&(e.resolved=!0),e}var Pe="NOT_LOADED",Oe="APPENDING",Fe="PARTIAL",Me="OK";class Ne{constructor(t){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=t,this._registerListeners()}_registerListeners(){const{hls:t}=this;t&&(t.on(l.MANIFEST_LOADING,this.onManifestLoading,this),t.on(l.BUFFER_APPENDED,this.onBufferAppended,this),t.on(l.FRAG_BUFFERED,this.onFragBuffered,this),t.on(l.FRAG_LOADED,this.onFragLoaded,this))}_unregisterListeners(){const{hls:t}=this;t&&(t.off(l.MANIFEST_LOADING,this.onManifestLoading,this),t.off(l.BUFFER_APPENDED,this.onBufferAppended,this),t.off(l.FRAG_BUFFERED,this.onFragBuffered,this),t.off(l.FRAG_LOADED,this.onFragLoaded,this))}destroy(){this._unregisterListeners(),this.hls=this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null}getAppendedFrag(t,e){const n=this.activePartLists[e];if(n)for(let e=n.length;e--;){const i=n[e];if(!i)break;if(i.start<=t&&t<=i.end&&i.loaded)return i}return this.getBufferedFrag(t,e)}getBufferedFrag(t,e){return this.getFragAtPos(t,e,!0)}getFragAtPos(t,e,n){const{fragments:i}=this,r=Object.keys(i);for(let s=r.length;s--;){const a=i[r[s]];if((null==a?void 0:a.body.type)===e&&(!n||a.buffered)){const e=a.body;if(e.start<=t&&t<=e.end)return e}}return null}detectEvictedFragments(t,e,n,i,r){this.timeRanges&&(this.timeRanges[t]=e);const s=(null==i?void 0:i.fragment.sn)||-1;Object.keys(this.fragments).forEach((i=>{const a=this.fragments[i];if(!a)return;if(s>=a.body.sn)return;if(!a.buffered&&(!a.loaded||r))return void(a.body.type===n&&this.removeFragment(a.body));const o=a.range[t];o&&(0!==o.time.length?o.time.some((t=>{const n=!this.isTimeBuffered(t.startPTS,t.endPTS,e);return n&&this.removeFragment(a.body),n})):this.removeFragment(a.body))}))}detectPartialFragments(t){const e=this.timeRanges;if(!e||"initSegment"===t.frag.sn)return;const n=t.frag,i=Ue(n),r=this.fragments[i];if(!r||r.buffered&&n.gap)return;const s=!n.relurl;if(Object.keys(e).forEach((i=>{const a=n.elementaryStreams[i];if(!a)return;const o=e[i],l=s||!0===a.partial;r.range[i]=this.getBufferedTimes(n,t.part,l,o)})),r.loaded=null,Object.keys(r.range).length){r.buffered=!0;(r.body.endList=n.endList||r.body.endList)&&(this.endListFragments[r.body.type]=r),Be(r)||this.removeParts(n.sn-1,n.type)}else this.removeFragment(r.body)}removeParts(t,e){const n=this.activePartLists[e];n&&(this.activePartLists[e]=$e(n,(e=>e.fragment.sn>=t)))}fragBuffered(t,e){const n=Ue(t);let i=this.fragments[n];!i&&e&&(i=this.fragments[n]={body:t,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},t.gap&&(this.hasGaps=!0)),i&&(i.loaded=null,i.buffered=!0)}getBufferedTimes(t,e,n,i){const r={time:[],partial:n},s=t.start,a=t.end,o=t.minEndPTS||a,l=t.maxStartPTS||s;for(let t=0;t<i.length;t++){const e=i.start(t)-this.bufferPadding,n=i.end(t)+this.bufferPadding;if(l>=e&&o<=n){r.time.push({startPTS:Math.max(s,i.start(t)),endPTS:Math.min(a,i.end(t))});break}if(s<n&&a>e){const e=Math.max(s,i.start(t)),n=Math.min(a,i.end(t));n>e&&(r.partial=!0,r.time.push({startPTS:e,endPTS:n}))}else if(a<=e)break}return r}getPartialFragment(t){let e,n,i,r=null,s=0;const{bufferPadding:a,fragments:o}=this;return Object.keys(o).forEach((l=>{const u=o[l];u&&Be(u)&&(n=u.body.start-a,i=u.body.end+a,t>=n&&t<=i&&(e=Math.min(t-n,i-t),s<=e&&(r=u.body,s=e)))})),r}isEndListAppended(t){const e=this.endListFragments[t];return void 0!==e&&(e.buffered||Be(e))}getState(t){const e=Ue(t),n=this.fragments[e];return n?n.buffered?Be(n)?Fe:Me:Oe:Pe}isTimeBuffered(t,e,n){let i,r;for(let s=0;s<n.length;s++){if(i=n.start(s)-this.bufferPadding,r=n.end(s)+this.bufferPadding,t>=i&&e<=r)return!0;if(e<=i)return!1}return!1}onManifestLoading(){this.removeAllFragments()}onFragLoaded(t,e){if("initSegment"===e.frag.sn||e.frag.bitrateTest)return;const n=e.frag,i=e.part?null:e,r=Ue(n);this.fragments[r]={body:n,appendedPTS:null,loaded:i,buffered:!1,range:Object.create(null)}}onBufferAppended(t,e){const{frag:n,part:i,timeRanges:r,type:s}=e;if("initSegment"===n.sn)return;const a=n.type;if(i){let t=this.activePartLists[a];t||(this.activePartLists[a]=t=[]),t.push(i)}this.timeRanges=r;const o=r[s];this.detectEvictedFragments(s,o,a,i)}onFragBuffered(t,e){this.detectPartialFragments(e)}hasFragment(t){const e=Ue(t);return!!this.fragments[e]}hasFragments(t){const{fragments:e}=this,n=Object.keys(e);if(!t)return n.length>0;for(let i=n.length;i--;){const r=e[n[i]];if((null==r?void 0:r.body.type)===t)return!0}return!1}hasParts(t){var e;return!(null==(e=this.activePartLists[t])||!e.length)}removeFragmentsInRange(t,e,n,i,r){i&&!this.hasGaps||Object.keys(this.fragments).forEach((s=>{const a=this.fragments[s];if(!a)return;const o=a.body;o.type!==n||i&&!o.gap||o.start<e&&o.end>t&&(a.buffered||r)&&this.removeFragment(o)}))}removeFragment(t){const e=Ue(t);t.clearElementaryStreamInfo();const n=this.activePartLists[t.type];if(n){const e=t.sn;this.activePartLists[t.type]=$e(n,(t=>t.fragment.sn!==e))}delete this.fragments[e],t.endList&&delete this.endListFragments[t.type]}removeAllFragments(){var t;this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1;const e=null==(t=this.hls)||null==(t=t.latestLevelDetails)?void 0:t.partList;e&&e.forEach((t=>t.clearElementaryStreamInfo()))}}function Be(t){var e,n,i;return t.buffered&&!!(t.body.gap||null!=(e=t.range.video)&&e.partial||null!=(n=t.range.audio)&&n.partial||null!=(i=t.range.audiovideo)&&i.partial)}function Ue(t){return`${t.type}_${t.level}_${t.sn}`}function $e(t,e){return t.filter((t=>{const n=e(t);return n||t.clearElementaryStreamInfo(),n}))}var Ge=0,Ke=1;class je{constructor(t,e,n){this.subtle=void 0,this.aesIV=void 0,this.aesMode=void 0,this.subtle=t,this.aesIV=e,this.aesMode=n}decrypt(t,e){switch(this.aesMode){case Ge:return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},e,t);case Ke:return this.subtle.decrypt({name:"AES-CTR",counter:this.aesIV,length:64},e,t);default:throw new Error(`[AESCrypto] invalid aes mode ${this.aesMode}`)}}}class Ve{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_(t){const e=new DataView(t),n=new Uint32Array(4);for(let t=0;t<4;t++)n[t]=e.getUint32(4*t);return n}initTable(){const t=this.sBox,e=this.invSBox,n=this.subMix,i=n[0],r=n[1],s=n[2],a=n[3],o=this.invSubMix,l=o[0],u=o[1],h=o[2],c=o[3],d=new Uint32Array(256);let f=0,p=0,g=0;for(g=0;g<256;g++)d[g]=g<128?g<<1:g<<1^283;for(g=0;g<256;g++){let n=p^p<<1^p<<2^p<<3^p<<4;n=n>>>8^255&n^99,t[f]=n,e[n]=f;const o=d[f],g=d[o],_=d[g];let m=257*d[n]^16843008*n;i[f]=m<<24|m>>>8,r[f]=m<<16|m>>>16,s[f]=m<<8|m>>>24,a[f]=m,m=16843009*_^65537*g^257*o^16843008*f,l[n]=m<<24|m>>>8,u[n]=m<<16|m>>>16,h[n]=m<<8|m>>>24,c[n]=m,f?(f=o^d[d[d[_^o]]],p^=d[d[p]]):f=p=1}}expandKey(t){const e=this.uint8ArrayToUint32Array_(t);let n=!0,i=0;for(;i<e.length&&n;)n=e[i]===this.key[i],i++;if(n)return;this.key=e;const r=this.keySize=e.length;if(4!==r&&6!==r&&8!==r)throw new Error("Invalid aes key size="+r);const s=this.ksRows=4*(r+6+1);let a,o;const l=this.keySchedule=new Uint32Array(s),u=this.invKeySchedule=new Uint32Array(s),h=this.sBox,c=this.rcon,d=this.invSubMix,f=d[0],p=d[1],g=d[2],_=d[3];let m,v;for(a=0;a<s;a++)a<r?m=l[a]=e[a]:(v=m,a%r==0?(v=v<<8|v>>>24,v=h[v>>>24]<<24|h[v>>>16&255]<<16|h[v>>>8&255]<<8|h[255&v],v^=c[a/r|0]<<24):r>6&&a%r==4&&(v=h[v>>>24]<<24|h[v>>>16&255]<<16|h[v>>>8&255]<<8|h[255&v]),l[a]=m=(l[a-r]^v)>>>0);for(o=0;o<s;o++)a=s-o,v=3&o?l[a]:l[a-4],u[o]=o<4||a<=4?v:f[h[v>>>24]]^p[h[v>>>16&255]]^g[h[v>>>8&255]]^_[h[255&v]],u[o]=u[o]>>>0}networkToHostOrderSwap(t){return t<<24|(65280&t)<<8|(16711680&t)>>8|t>>>24}decrypt(t,e,n){const i=this.keySize+6,r=this.invKeySchedule,s=this.invSBox,a=this.invSubMix,o=a[0],l=a[1],u=a[2],h=a[3],c=this.uint8ArrayToUint32Array_(n);let d=c[0],f=c[1],p=c[2],g=c[3];const _=new Int32Array(t),m=new Int32Array(_.length);let v,y,b,E,w,T,k,S,A,D,C,x,R,L;const I=this.networkToHostOrderSwap;for(;e<_.length;){for(A=I(_[e]),D=I(_[e+1]),C=I(_[e+2]),x=I(_[e+3]),w=A^r[0],T=x^r[1],k=C^r[2],S=D^r[3],R=4,L=1;L<i;L++)v=o[w>>>24]^l[T>>16&255]^u[k>>8&255]^h[255&S]^r[R],y=o[T>>>24]^l[k>>16&255]^u[S>>8&255]^h[255&w]^r[R+1],b=o[k>>>24]^l[S>>16&255]^u[w>>8&255]^h[255&T]^r[R+2],E=o[S>>>24]^l[w>>16&255]^u[T>>8&255]^h[255&k]^r[R+3],w=v,T=y,k=b,S=E,R+=4;v=s[w>>>24]<<24^s[T>>16&255]<<16^s[k>>8&255]<<8^s[255&S]^r[R],y=s[T>>>24]<<24^s[k>>16&255]<<16^s[S>>8&255]<<8^s[255&w]^r[R+1],b=s[k>>>24]<<24^s[S>>16&255]<<16^s[w>>8&255]<<8^s[255&T]^r[R+2],E=s[S>>>24]<<24^s[w>>16&255]<<16^s[T>>8&255]<<8^s[255&k]^r[R+3],m[e]=I(v^d),m[e+1]=I(E^f),m[e+2]=I(b^p),m[e+3]=I(y^g),d=A,f=D,p=C,g=x,e+=4}return m.buffer}}class Ze{constructor(t,e,n){this.subtle=void 0,this.key=void 0,this.aesMode=void 0,this.subtle=t,this.key=e,this.aesMode=n}expandKey(){const t=function(t){switch(t){case Ge:return"AES-CBC";case Ke:return"AES-CTR";default:throw new Error(`[FastAESKey] invalid aes mode ${t}`)}}(this.aesMode);return this.subtle.importKey("raw",this.key,{name:t},!1,["encrypt","decrypt"])}}class ze{constructor(t,{removePKCS7Padding:e=!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=t.enableSoftwareAES,this.removePKCS7Padding=e,e)try{const t=self.crypto;t&&(this.subtle=t.subtle||t.webkitSubtle)}catch(t){}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:t,remainderData:e}=this;if(!t||e)return this.reset(),null;const n=new Uint8Array(t);return this.reset(),this.removePKCS7Padding?function(t){const e=t.byteLength,n=e&&new DataView(t.buffer).getUint8(e-1);return n?t.slice(0,e-n):t}(n):n}reset(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)}decrypt(t,e,n,i){return this.useSoftware?new Promise(((r,s)=>{const a=ArrayBuffer.isView(t)?t:new Uint8Array(t);this.softwareDecrypt(a,e,n,i);const o=this.flush();o?r(o.buffer):s(new Error("[softwareDecrypt] Failed to decrypt data"))})):this.webCryptoDecrypt(new Uint8Array(t),e,n,i)}softwareDecrypt(t,e,n,i){const{currentIV:r,currentResult:s,remainderData:a}=this;if(i!==Ge||16!==e.byteLength)return C.warn("SoftwareDecrypt: can only handle AES-128-CBC"),null;this.logOnce("JS AES decrypt"),a&&(t=gt(a,t),this.remainderData=null);const o=this.getValidChunk(t);if(!o.length)return null;r&&(n=r);let l=this.softwareDecrypter;l||(l=this.softwareDecrypter=new Ve),l.expandKey(e);const u=s;return this.currentResult=l.decrypt(o.buffer,0,n),this.currentIV=o.slice(-16).buffer,u||null}webCryptoDecrypt(t,e,n,i){if(this.key!==e||!this.fastAesKey){if(!this.subtle)return Promise.resolve(this.onWebCryptoError(t,e,n,i));this.key=e,this.fastAesKey=new Ze(this.subtle,e,i)}return this.fastAesKey.expandKey().then((e=>{if(!this.subtle)return Promise.reject(new Error("web crypto not initialized"));this.logOnce("WebCrypto AES decrypt");return new je(this.subtle,new Uint8Array(n),i).decrypt(t.buffer,e)})).catch((r=>(C.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${r.name}: ${r.message}`),this.onWebCryptoError(t,e,n,i))))}onWebCryptoError(t,e,n,i){const r=this.enableSoftwareAES;if(r){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(t,e,n,i);const r=this.flush();if(r)return r.buffer}throw new Error("WebCrypto"+(r?" and softwareDecrypt":"")+": failed to decrypt data")}getValidChunk(t){let e=t;const n=t.length-t.length%16;return n!==t.length&&(e=t.slice(0,n),this.remainderData=t.slice(n)),e}logOnce(t){this.logEnabled&&(C.log(`[decrypter]: ${t}`),this.logEnabled=!1)}}const He=Math.pow(2,17);class We{constructor(t){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=t}destroy(){this.loader&&(this.loader.destroy(),this.loader=null)}abort(){this.loader&&this.loader.abort()}load(t,e){const n=t.url;if(!n)return Promise.reject(new Qe({type:a.NETWORK_ERROR,details:o.FRAG_LOAD_ERROR,fatal:!1,frag:t,error:new Error("Fragment does not have a "+(n?"part list":"url")),networkDetails:null}));this.abort();const i=this.config,r=i.fLoader,s=i.loader;return new Promise(((l,u)=>{if(this.loader&&this.loader.destroy(),t.gap){if(t.tagList.some((t=>"GAP"===t[0])))return void u(qe(t));t.gap=!1}const h=this.loader=r?new r(i):new s(i),c=Ye(t);t.loader=h;const d=Ee(i.fragLoadPolicy.default),f={loadPolicy:d,timeout:d.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:"initSegment"===t.sn?1/0:He};t.stats=h.stats;const p={onSuccess:(e,n,i,r)=>{this.resetLoader(t,h);let s=e.data;i.resetIV&&t.decryptdata&&(t.decryptdata.iv=new Uint8Array(s.slice(0,16)),s=s.slice(16)),l({frag:t,part:null,payload:s,networkDetails:r})},onError:(e,i,r,s)=>{this.resetLoader(t,h),u(new Qe({type:a.NETWORK_ERROR,details:o.FRAG_LOAD_ERROR,fatal:!1,frag:t,response:E({url:n,data:void 0},e),error:new Error(`HTTP Error ${e.code} ${e.text}`),networkDetails:r,stats:s}))},onAbort:(e,n,i)=>{this.resetLoader(t,h),u(new Qe({type:a.NETWORK_ERROR,details:o.INTERNAL_ABORTED,fatal:!1,frag:t,error:new Error("Aborted"),networkDetails:i,stats:e}))},onTimeout:(e,n,i)=>{this.resetLoader(t,h),u(new Qe({type:a.NETWORK_ERROR,details:o.FRAG_LOAD_TIMEOUT,fatal:!1,frag:t,error:new Error(`Timeout after ${f.timeout}ms`),networkDetails:i,stats:e}))}};e&&(p.onProgress=(n,i,r,s)=>e({frag:t,part:null,payload:r,networkDetails:s})),h.load(c,f,p)}))}loadPart(t,e,n){this.abort();const i=this.config,r=i.fLoader,s=i.loader;return new Promise(((l,u)=>{if(this.loader&&this.loader.destroy(),t.gap||e.gap)return void u(qe(t,e));const h=this.loader=r?new r(i):new s(i),c=Ye(t,e);t.loader=h;const d=Ee(i.fragLoadPolicy.default),f={loadPolicy:d,timeout:d.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:He};e.stats=h.stats,h.load(c,f,{onSuccess:(i,r,s,a)=>{this.resetLoader(t,h),this.updateStatsFromPart(t,e);const o={frag:t,part:e,payload:i.data,networkDetails:a};n(o),l(o)},onError:(n,i,r,s)=>{this.resetLoader(t,h),u(new Qe({type:a.NETWORK_ERROR,details:o.FRAG_LOAD_ERROR,fatal:!1,frag:t,part:e,response:E({url:c.url,data:void 0},n),error:new Error(`HTTP Error ${n.code} ${n.text}`),networkDetails:r,stats:s}))},onAbort:(n,i,r)=>{t.stats.aborted=e.stats.aborted,this.resetLoader(t,h),u(new Qe({type:a.NETWORK_ERROR,details:o.INTERNAL_ABORTED,fatal:!1,frag:t,part:e,error:new Error("Aborted"),networkDetails:r,stats:n}))},onTimeout:(n,i,r)=>{this.resetLoader(t,h),u(new Qe({type:a.NETWORK_ERROR,details:o.FRAG_LOAD_TIMEOUT,fatal:!1,frag:t,part:e,error:new Error(`Timeout after ${f.timeout}ms`),networkDetails:r,stats:n}))}})}))}updateStatsFromPart(t,e){const n=t.stats,i=e.stats,r=i.total;if(n.loaded+=i.loaded,r){const i=Math.round(t.duration/e.duration),s=Math.min(Math.round(n.loaded/r),i),a=(i-s)*Math.round(n.loaded/s);n.total=n.loaded+a}else n.total=Math.max(n.loaded,n.total);const s=n.loading,a=i.loading;s.start?s.first+=a.first-a.start:(s.start=a.start,s.first=a.first),s.end=a.end}resetLoader(t,e){t.loader=null,this.loader===e&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),e.destroy()}}function Ye(t,e=null){const n=e||t,r={frag:t,part:e,responseType:"arraybuffer",url:n.url,headers:{},rangeStart:0,rangeEnd:0},s=n.byteRangeStartOffset,a=n.byteRangeEndOffset;if(i(s)&&i(a)){var o;let e=s,n=a;if("initSegment"===t.sn&&("AES-128"===(l=null==(o=t.decryptdata)?void 0:o.method)||"AES-256"===l)){const t=a-s;t%16&&(n=a+(16-t%16)),0!==s&&(r.resetIV=!0,e=s-16)}r.rangeStart=e,r.rangeEnd=n}var l;return r}function qe(t,e){const n=new Error(`GAP ${t.gap?"tag":"attribute"} found`),i={type:a.MEDIA_ERROR,details:o.FRAG_GAP,fatal:!1,frag:t,error:n,networkDetails:null};return e&&(i.part=e),(e||t).stats.aborted=!0,new Qe(i)}class Qe extends Error{constructor(t){super(t.error.message),this.data=void 0,this.data=t}}class Xe extends w{constructor(t,e){super(t,e),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(t){return!this._tickInterval&&(this._tickCallCount=0,this._tickInterval=self.setInterval(this._boundTick,t),!0)}clearInterval(){return!!this._tickInterval&&(self.clearInterval(this._tickInterval),this._tickInterval=null,!0)}clearNextTick(){return!!this._tickTimer&&(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0)}tick(){this._tickCallCount++,1===this._tickCallCount&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)}tickImmediate(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)}doTick(){}}class Je{constructor(t,e,n,i=0,r=-1,s=!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={start:0,executeStart:0,executeEnd:0,end:0},this.buffering={audio:{start:0,executeStart:0,executeEnd:0,end:0},video:{start:0,executeStart:0,executeEnd:0,end:0},audiovideo:{start:0,executeStart:0,executeEnd:0,end:0}},this.level=t,this.sn=e,this.id=n,this.size=i,this.part=r,this.partial=s}}const tn={length:0,start:()=>0,end:()=>0};class en{static isBuffered(t,e){if(t){const n=en.getBuffered(t);for(let t=n.length;t--;)if(e>=n.start(t)&&e<=n.end(t))return!0}return!1}static bufferedRanges(t){if(t){const e=en.getBuffered(t);return en.timeRangesToArray(e)}return[]}static timeRangesToArray(t){const e=[];for(let n=0;n<t.length;n++)e.push({start:t.start(n),end:t.end(n)});return e}static bufferInfo(t,e,n){if(t){const i=en.bufferedRanges(t);if(i.length)return en.bufferedInfo(i,e,n)}return{len:0,start:e,end:e,bufferedIndex:-1}}static bufferedInfo(t,e,n){e=Math.max(0,e),t.length>1&&t.sort(((t,e)=>t.start-e.start||e.end-t.end));let i=-1,r=[];if(n)for(let s=0;s<t.length;s++){e>=t[s].start&&e<=t[s].end&&(i=s);const a=r.length;if(a){const e=r[a-1].end;t[s].start-e<n?t[s].end>e&&(r[a-1].end=t[s].end):r.push(t[s])}else r.push(t[s])}else r=t;let s,a=0,o=e,l=e;for(let t=0;t<r.length;t++){const u=r[t].start,h=r[t].end;if(-1===i&&e>=u&&e<=h&&(i=t),e+n>=u&&e<h)o=u,l=h,a=l-e;else if(e+n<u){s=u;break}}return{len:a,start:o||0,end:l||0,nextStart:s,buffered:t,bufferedIndex:i}}static getBuffered(t){try{return t.buffered||tn}catch(t){return C.log("failed to get media.buffered",t),tn}}}const nn=/\{\$([a-zA-Z0-9-_]+)\}/g;function rn(t){return nn.test(t)}function sn(t,e){if(null!==t.variableList||t.hasVariableRefs){const n=t.variableList;return e.replace(nn,(e=>{const i=e.substring(2,e.length-1),r=null==n?void 0:n[i];return void 0===r?(t.playlistParsingError||(t.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${i}"`)),e):r}))}return e}function an(t,e,n){let i,r,s=t.variableList;if(s||(t.variableList=s={}),"QUERYPARAM"in e){i=e.QUERYPARAM;try{const t=new self.URL(n).searchParams;if(!t.has(i))throw new Error(`"${i}" does not match any query parameter in URI: "${n}"`);r=t.get(i)}catch(e){t.playlistParsingError||(t.playlistParsingError=new Error(`EXT-X-DEFINE QUERYPARAM: ${e.message}`))}}else i=e.NAME,r=e.VALUE;i in s?t.playlistParsingError||(t.playlistParsingError=new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${i}"`)):s[i]=r||""}function on(t,e,n){const i=e.IMPORT;if(n&&i in n){let e=t.variableList;e||(t.variableList=e={}),e[i]=n[i]}else t.playlistParsingError||(t.playlistParsingError=new Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${i}"`))}const ln=/^(\d+)x(\d+)$/,un=/(.+?)=(".*?"|.*?)(?:,|$)/g;class hn{constructor(t,e){"string"==typeof t&&(t=hn.parseAttrList(t,e)),y(this,t)}get clientAttrs(){return Object.keys(this).filter((t=>"X-"===t.substring(0,2)))}decimalInteger(t){const e=parseInt(this[t],10);return e>Number.MAX_SAFE_INTEGER?1/0:e}hexadecimalInteger(t){if(this[t]){let e=(this[t]||"0x").slice(2);e=(1&e.length?"0":"")+e;const n=new Uint8Array(e.length/2);for(let t=0;t<e.length/2;t++)n[t]=parseInt(e.slice(2*t,2*t+2),16);return n}return null}hexadecimalIntegerAsNumber(t){const e=parseInt(this[t],16);return e>Number.MAX_SAFE_INTEGER?1/0:e}decimalFloatingPoint(t){return parseFloat(this[t])}optionalFloat(t,e){const n=this[t];return n?parseFloat(n):e}enumeratedString(t){return this[t]}enumeratedStringList(t,e){const n=this[t];return(n?n.split(/[ ,]+/):[]).reduce(((t,e)=>(t[e.toLowerCase()]=!0,t)),e)}bool(t){return"YES"===this[t]}decimalResolution(t){const e=ln.exec(this[t]);if(null!==e)return{width:parseInt(e[1],10),height:parseInt(e[2],10)}}static parseAttrList(t,e){let n;const i={};for(un.lastIndex=0;null!==(n=un.exec(t));){const r=n[1].trim();let s=n[2];const a=0===s.indexOf('"')&&s.lastIndexOf('"')===s.length-1;let o=!1;if(a)s=s.slice(1,-1);else switch(r){case"IV":case"SCTE35-CMD":case"SCTE35-IN":case"SCTE35-OUT":o=!0}if(e&&(a||o))s=sn(e,s);else if(!o&&!a)switch(r){case"CLOSED-CAPTIONS":if("NONE"===s)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":C.warn(`${t}: attribute ${r} is missing quotes`)}i[r]=s}return i}}function cn(t){return"SCTE35-OUT"===t||"SCTE35-IN"===t||"SCTE35-CMD"===t}class dn{constructor(t,e,n=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=(null==e?void 0:e.tagAnchor)||null,this.tagOrder=null!=(r=null==e?void 0:e.tagOrder)?r:n,e){const n=e.attr;for(const e in n)if(Object.prototype.hasOwnProperty.call(t,e)&&t[e]!==n[e]){C.warn(`DATERANGE tag attribute: "${e}" does not match for tags with ID: "${t.ID}"`),this._badValueForSameId=e;break}t=y(new hn({}),n,t)}if(this.attr=t,e?(this._startDate=e._startDate,this._cue=e._cue,this._endDate=e._endDate,this._dateAtEnd=e._dateAtEnd):this._startDate=new Date(t["START-DATE"]),"END-DATE"in this.attr){const t=(null==e?void 0:e.endDate)||new Date(this.attr["END-DATE"]);i(t.getTime())&&(this._endDate=t)}}get id(){return this.attr.ID}get class(){return this.attr.CLASS}get cue(){const t=this._cue;return void 0===t?this._cue=this.attr.enumeratedStringList(this.attr.CUE?"CUE":"X-CUE",{pre:!1,post:!1,once:!1}):t}get startTime(){const{tagAnchor:t}=this;return null===t||null===t.programDateTime?(C.warn(`Expected tagAnchor Fragment with PDT set for DateRange "${this.id}": ${t}`),NaN):t.start+(this.startDate.getTime()-t.programDateTime)/1e3}get startDate(){return this._startDate}get endDate(){const t=this._endDate||this._dateAtEnd;if(t)return t;const e=this.duration;return null!==e?this._dateAtEnd=new Date(this._startDate.getTime()+1e3*e):null}get duration(){if("DURATION"in this.attr){const t=this.attr.decimalFloatingPoint("DURATION");if(i(t))return t}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"com.apple.hls.interstitial"===this.class}get isValid(){return!!this.id&&!this._badValueForSameId&&i(this.startDate.getTime())&&(null===this.duration||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)}}class fn{constructor(t){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=t}reloaded(t){if(!t)return this.advanced=!0,void(this.updated=!0);const e=this.lastPartSn-t.lastPartSn,n=this.lastPartIndex-t.lastPartIndex;this.updated=this.endSN!==t.endSN||!!n||!!e||!this.live,this.advanced=this.endSN>t.endSN||e>0||0===e&&n>0,this.updated||this.advanced?this.misses=Math.floor(.6*t.misses):this.misses=t.misses+1}hasKey(t){return this.encryptedFragments.some((e=>{let n=e.decryptdata;return n||(e.setKeyFormat(t.keyFormat),n=e.decryptdata),!!n&&t.matches(n)}))}get hasProgramDateTime(){return!!this.fragments.length&&i(this.fragments[this.fragments.length-1].programDateTime)}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||10}get drift(){const t=this.driftEndTime-this.driftStartTime;if(t>0){return 1e3*(this.driftEnd-this.driftStart)/t}return 1}get edge(){return this.partEnd||this.fragmentEnd}get partEnd(){var t;return null!=(t=this.partList)&&t.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 t;return null!=(t=this.partList)&&t.length?this.partList[this.partList.length-1].index:-1}get maxPartIndex(){const t=this.partList;if(t){const e=this.lastPartIndex;if(-1!==e){for(let n=t.length;n--;)if(t[n].index>e)return t[n].index;return e}}return 0}get lastPartSn(){var t;return null!=(t=this.partList)&&t.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}get expired(){if(this.live&&this.age&&this.misses<3){const t=this.partEnd-this.fragmentStart;return this.age>Math.max(t,this.totalduration)+this.levelTargetDuration}return!1}}function pn(t,e){return t.length===e.length&&!t.some(((t,n)=>t!==e[n]))}function gn(t,e){return!t&&!e||!(!t||!e)&&pn(t,e)}function _n(t){return"AES-128"===t||"AES-256"===t||"AES-256-CTR"===t}function mn(t){switch(t){case"AES-128":case"AES-256":return Ge;case"AES-256-CTR":return Ke;default:throw new Error(`invalid full segment method ${t}`)}}function vn(t){return Uint8Array.from(atob(t),(t=>t.charCodeAt(0)))}function yn(t){return Uint8Array.from(unescape(encodeURIComponent(t)),(t=>t.charCodeAt(0)))}function bn(t){const e=function(t,e,n){const i=t[e];t[e]=t[n],t[n]=i};e(t,0,3),e(t,1,2),e(t,4,5),e(t,6,7)}function En(t){const e=t.split(":");let n=null;if("data"===e[0]&&2===e.length){const t=e[1].split(";"),i=t[t.length-1].split(",");if(2===i.length){const e="base64"===i[0],r=i[1];e?(t.splice(-1,1),n=vn(r)):n=function(t){const e=yn(t).subarray(0,16),n=new Uint8Array(16);return n.set(e,16-e.length),n}(r)}}return n}const wn="undefined"!=typeof self?self:void 0;var Tn={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},kn="org.w3.clearkey",Sn="com.apple.streamingkeydelivery",An="com.microsoft.playready",Dn="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed";function Cn(t){switch(t){case Sn:return Tn.FAIRPLAY;case An:return Tn.PLAYREADY;case Dn:return Tn.WIDEVINE;case kn:return Tn.CLEARKEY}}function xn(t){switch(t){case Tn.FAIRPLAY:return Sn;case Tn.PLAYREADY:return An;case Tn.WIDEVINE:return Dn;case Tn.CLEARKEY:return kn}}function Rn(t){const{drmSystems:e,widevineLicenseUrl:n}=t,i=e?[Tn.FAIRPLAY,Tn.WIDEVINE,Tn.PLAYREADY,Tn.CLEARKEY].filter((t=>!!e[t])):[];return!i[Tn.WIDEVINE]&&n&&i.push(Tn.WIDEVINE),i}const Ln=null!=wn&&null!=(In=wn.navigator)&&In.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null;var In;let Pn={};class On{static clearKeyUriToKeyIdMap(){Pn={}}static setKeyIdForUri(t,e){Pn[t]=e}constructor(t,e,n,i=[1],r=null,s){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=t,this.uri=e,this.keyFormat=n,this.keyFormatVersions=i,this.iv=r,this.encrypted=!!t&&"NONE"!==t,this.isCommonEncryption=this.encrypted&&!_n(t),null!=s&&s.startsWith("0x")&&(this.keyId=new Uint8Array(P(s)))}matches(t){return t.uri===this.uri&&t.method===this.method&&t.encrypted===this.encrypted&&t.keyFormat===this.keyFormat&&pn(t.keyFormatVersions,this.keyFormatVersions)&&gn(t.iv,this.iv)&&gn(t.keyId,this.keyId)}isSupported(){if(this.method){if(_n(this.method)||"NONE"===this.method)return!0;if("identity"===this.keyFormat)return"SAMPLE-AES"===this.method;switch(this.keyFormat){case Sn:case Dn:case An:case kn:return-1!==["SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)}}return!1}getDecryptData(t){if(!this.encrypted||!this.uri)return null;if(_n(this.method)){let e=this.iv;e||("number"!=typeof t&&(C.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),t=0),e=function(t){const e=new Uint8Array(16);for(let n=12;n<16;n++)e[n]=t>>8*(15-n)&255;return e}(t));return new On(this.method,this.uri,"identity",this.keyFormatVersions,e)}if(this.pssh&&this.keyId)return this;const e=En(this.uri);if(e)switch(this.keyFormat){case Dn:if(this.pssh=e,!this.keyId){const t=function(t){const e=[];if(t instanceof ArrayBuffer){const n=t.byteLength;let i=0;for(;i+32<n;){const n=wt(new DataView(t,i));e.push(n),i+=n.size}}return e}(e.buffer);if(t.length){var n;const e=t[0];this.keyId=null!=(n=e.kids)&&n.length?e.kids[0]:null}}if(!this.keyId){const t=e.length-22;this.keyId=e.subarray(t,t+16)}break;case An:{const t=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=Et(t,0,e),this.keyId=function(t){const e=new Uint16Array(t.buffer,t.byteOffset,t.byteLength/2),n=String.fromCharCode.apply(null,Array.from(e)),i=n.substring(n.indexOf("<"),n.length),r=(new DOMParser).parseFromString(i,"text/xml").getElementsByTagName("KID")[0];if(r){const t=r.childNodes[0]?r.childNodes[0].nodeValue:r.getAttribute("VALUE");if(t){const e=vn(t).subarray(0,16);return bn(e),e}}return null}(e);break}default:{let t=e.subarray(0,16);if(16!==t.length){const e=new Uint8Array(16);e.set(t,16-t.length),t=e}this.keyId=t;break}}if(!this.keyId||16!==this.keyId.byteLength){let t=Pn[this.uri];if(!t){const e=Object.keys(Pn).length%Number.MAX_SAFE_INTEGER;t=new Uint8Array(16);new DataView(t.buffer,12,4).setUint32(0,e),On.setKeyIdForUri(this.uri,t)}this.keyId=t}return this}}const Fn=/#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,Mn=/#EXT-X-MEDIA:(.*)/g,Nn=/^#EXT(?:INF|-X-TARGETDURATION):/m,Bn=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[^\r\n]*)/.source,/#.*/.source].join("|"),"g"),Un=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 $n{static findGroup(t,e){for(let n=0;n<t.length;n++){const i=t[n];if(i.id===e)return i}}static resolve(t,e){return K.buildAbsoluteURL(e,t,{alwaysNormalize:!0})}static isMediaPlaylist(t){return Nn.test(t)}static parseMasterPlaylist(t,e){const n={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:rn(t)},i=[];if(Fn.lastIndex=0,!t.startsWith("#EXTM3U"))return n.playlistParsingError=new Error("no EXTM3U delimiter"),n;let r;for(;null!=(r=Fn.exec(t));)if(r[1]){var s;const t=new hn(r[1],n),a=sn(n,r[2]),o={attrs:t,bitrate:t.decimalInteger("BANDWIDTH")||t.decimalInteger("AVERAGE-BANDWIDTH"),name:t.NAME,url:$n.resolve(a,e)},l=t.decimalResolution("RESOLUTION");l&&(o.width=l.width,o.height=l.height),Zn(t.CODECS,o);const u=t["SUPPLEMENTAL-CODECS"];u&&(o.supplemental={},Zn(u,o.supplemental)),null!=(s=o.unknownCodecs)&&s.length||i.push(o),n.levels.push(o)}else if(r[3]){const t=r[3],i=r[4];switch(t){case"SESSION-DATA":{const t=new hn(i,n),e=t["DATA-ID"];e&&(null===n.sessionData&&(n.sessionData={}),n.sessionData[e]=t);break}case"SESSION-KEY":{const t=jn(i,e,n);t.encrypted&&t.isSupported()?(null===n.sessionKeys&&(n.sessionKeys=[]),n.sessionKeys.push(t)):C.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${i}"`);break}case"DEFINE":an(n,new hn(i,n),e);break;case"CONTENT-STEERING":{const t=new hn(i,n);n.contentSteering={uri:$n.resolve(t["SERVER-URI"],e),pathwayId:t["PATHWAY-ID"]||"."};break}case"START":n.startTimeOffset=Vn(i)}}const a=i.length>0&&i.length<n.levels.length;return n.levels=a?i:n.levels,0===n.levels.length&&(n.playlistParsingError=new Error("no levels found in manifest")),n}static parseMasterPlaylistMedia(t,e,n){let i;const r={},s=n.levels,a={AUDIO:s.map((t=>({id:t.attrs.AUDIO,audioCodec:t.audioCodec}))),SUBTITLES:s.map((t=>({id:t.attrs.SUBTITLES,textCodec:t.textCodec}))),"CLOSED-CAPTIONS":[]};let o=0;for(Mn.lastIndex=0;null!==(i=Mn.exec(t));){const t=new hn(i[1],n),s=t.TYPE;if(s){const n=a[s],i=r[s]||[];r[s]=i;const l=t.LANGUAGE,u=t["ASSOC-LANGUAGE"],h=t.CHANNELS,c=t.CHARACTERISTICS,d=t["INSTREAM-ID"],f={attrs:t,bitrate:0,id:o++,groupId:t["GROUP-ID"]||"",name:t.NAME||l||"",type:s,default:t.bool("DEFAULT"),autoselect:t.bool("AUTOSELECT"),forced:t.bool("FORCED"),lang:l,url:t.URI?$n.resolve(t.URI,e):""};if(u&&(f.assocLang=u),h&&(f.channels=h),c&&(f.characteristics=c),d&&(f.instreamId=d),null!=n&&n.length){const t=$n.findGroup(n,f.groupId)||n[0];zn(f,t,"audioCodec"),zn(f,t,"textCodec")}i.push(f)}}return r}static parseLevelPlaylist(t,e,n,r,s,a){var o;const l={url:e},u=new fn(e),h=u.fragments,c=[];let d,f,p,g,_=null,m=0,v=0,b=0,E=0,w=0,T=null,k=new Y(r,l),S=-1,A=!1,D=null;if(Bn.lastIndex=0,u.m3u8=t,u.hasVariableRefs=rn(t),"#EXTM3U"!==(null==(o=Bn.exec(t))?void 0:o[0]))return u.playlistParsingError=new Error("Missing format identifier #EXTM3U"),u;for(;null!==(d=Bn.exec(t));){A&&(A=!1,k=new Y(r,l),k.playlistOffset=b,k.setStart(b),k.sn=m,k.cc=E,w&&(k.bitrate=w),k.level=n,_&&(k.initSegment=_,_.rawProgramDateTime&&(k.rawProgramDateTime=_.rawProgramDateTime,_.rawProgramDateTime=null),D&&(k.setByteRange(D),D=null)));const t=d[1];if(t){k.duration=parseFloat(t);const e=(" "+d[2]).slice(1);k.title=e||null,k.tagList.push(e?["INF",t,e]:["INF",t])}else if(d[3]){if(i(k.duration)){k.playlistOffset=b,k.setStart(b),p&&Yn(k,p,u),k.sn=m,k.level=n,k.cc=E,h.push(k);const t=(" "+d[3]).slice(1);k.relurl=sn(u,t),Hn(k,T,c),T=k,b+=k.duration,m++,v=0,A=!0}}else{if(d=d[0].match(Un),!d){C.warn("No matches on slow regex match for level playlist!");continue}for(f=1;f<d.length&&void 0===d[f];f++);const t=(" "+d[f]).slice(1),s=(" "+d[f+1]).slice(1),o=d[f+2]?(" "+d[f+2]).slice(1):null;switch(t){case"BYTERANGE":T?k.setByteRange(s,T):k.setByteRange(s);break;case"PROGRAM-DATE-TIME":k.rawProgramDateTime=s,k.tagList.push(["PROGRAM-DATE-TIME",s]),-1===S&&(S=h.length);break;case"PLAYLIST-TYPE":u.type&&qn(u,t,d),u.type=s.toUpperCase();break;case"MEDIA-SEQUENCE":0!==u.startSN?qn(u,t,d):h.length>0&&Qn(u,t,d),m=u.startSN=parseInt(s);break;case"SKIP":{u.skippedSegments&&qn(u,t,d);const e=new hn(s,u),n=e.decimalInteger("SKIPPED-SEGMENTS");if(i(n)){u.skippedSegments+=n;for(let t=n;t--;)h.push(null);m+=n}const r=e.enumeratedString("RECENTLY-REMOVED-DATERANGES");r&&(u.recentlyRemovedDateranges=(u.recentlyRemovedDateranges||[]).concat(r.split("\t")));break}case"TARGETDURATION":0!==u.targetduration&&qn(u,t,d),u.targetduration=Math.max(parseInt(s),1);break;case"VERSION":null!==u.version&&qn(u,t,d),u.version=parseInt(s);break;case"INDEPENDENT-SEGMENTS":break;case"ENDLIST":u.live||qn(u,t,d),u.live=!1;break;case"#":(s||o)&&k.tagList.push(o?[s,o]:[s]);break;case"DISCONTINUITY":E++,k.tagList.push(["DIS"]);break;case"GAP":k.gap=!0,k.tagList.push([t]);break;case"BITRATE":k.tagList.push([t,s]),w=1e3*parseInt(s),i(w)?k.bitrate=w:w=0;break;case"DATERANGE":{const t=new hn(s,u),e=new dn(t,u.dateRanges[t.ID],u.dateRangeTagCount);u.dateRangeTagCount++,e.isValid||u.skippedSegments?u.dateRanges[e.id]=e:C.warn(`Ignoring invalid DATERANGE tag: "${s}"`),k.tagList.push(["EXT-X-DATERANGE",s]);break}case"DEFINE":{const t=new hn(s,u);"IMPORT"in t?on(u,t,a):an(u,t,e)}break;case"DISCONTINUITY-SEQUENCE":0!==u.startCC?qn(u,t,d):h.length>0&&Qn(u,t,d),u.startCC=E=parseInt(s);break;case"KEY":{const t=jn(s,e,u);if(t.isSupported()){if("NONE"===t.method){p=void 0;break}p||(p={});const e=p[t.keyFormat];null!=e&&e.matches(t)||(e&&(p=y({},p)),p[t.keyFormat]=t)}else C.warn(`[Keys] Ignoring unsupported EXT-X-KEY tag: "${s}"`);break}case"START":u.startTimeOffset=Vn(s);break;case"MAP":{const t=new hn(s,u);if(k.duration){const e=new Y(r,l);Wn(e,t,n,p),_=e,k.initSegment=_,_.rawProgramDateTime&&!k.rawProgramDateTime&&(k.rawProgramDateTime=_.rawProgramDateTime)}else{const e=k.byteRangeEndOffset;if(e){const t=k.byteRangeStartOffset;D=`${e-t}@${t}`}else D=null;Wn(k,t,n,p),_=k,A=!0}_.cc=E;break}case"SERVER-CONTROL":g&&qn(u,t,d),g=new hn(s),u.canBlockReload=g.bool("CAN-BLOCK-RELOAD"),u.canSkipUntil=g.optionalFloat("CAN-SKIP-UNTIL",0),u.canSkipDateRanges=u.canSkipUntil>0&&g.bool("CAN-SKIP-DATERANGES"),u.partHoldBack=g.optionalFloat("PART-HOLD-BACK",0),u.holdBack=g.optionalFloat("HOLD-BACK",0);break;case"PART-INF":{u.partTarget&&qn(u,t,d);const e=new hn(s);u.partTarget=e.decimalFloatingPoint("PART-TARGET");break}case"PART":{let t=u.partList;t||(t=u.partList=[]);const e=v>0?t[t.length-1]:void 0,n=v++,i=new hn(s,u),r=new q(i,k,l,n,e);t.push(r),k.duration+=r.duration;break}case"PRELOAD-HINT":{const t=new hn(s,u);u.preloadHint=t;break}case"RENDITION-REPORT":{const t=new hn(s,u);u.renditionReports=u.renditionReports||[],u.renditionReports.push(t);break}default:C.warn(`line parsed but not handled: ${d}`)}}}T&&!T.relurl?(h.pop(),b-=T.duration,u.partList&&(u.fragmentHint=T)):u.partList&&(Hn(k,T,c),k.cc=E,u.fragmentHint=k,p&&Yn(k,p,u)),u.targetduration||(u.playlistParsingError=new Error("Missing Target Duration"));const x=h.length,R=h[0],L=h[x-1];if(b+=u.skippedSegments*u.targetduration,b>0&&x&&L){u.averagetargetduration=b/x;const t=L.sn;u.endSN="initSegment"!==t?t:0,u.live||(L.endList=!0),S>0&&(!function(t,e){let n=t[e];for(let i=e;i--;){const e=t[i];if(!e)return;e.programDateTime=n.programDateTime-1e3*e.duration,n=e}}(h,S),R&&c.unshift(R))}return u.fragmentHint&&(b+=u.fragmentHint.duration),u.totalduration=b,c.length&&u.dateRangeTagCount&&R&&Gn(c,u),u.endCC=E,u}}function Gn(t,e){let n=t.length;if(!n){if(!e.hasProgramDateTime)return;{const i=e.fragments[e.fragments.length-1];t.push(i),n++}}const i=t[n-1],r=e.live?1/0:e.totalduration,s=Object.keys(e.dateRanges);for(let o=s.length;o--;){const l=e.dateRanges[s[o]],u=l.startDate.getTime();l.tagAnchor=i.ref;for(let i=n;i--;){var a;if((null==(a=t[i])?void 0:a.sn)<e.startSN)break;const n=Kn(e,u,t,i,r);if(-1!==n){l.tagAnchor=e.fragments[n].ref;break}}}}function Kn(t,e,n,i,r){const s=n[i];if(s){const o=s.programDateTime;if(e>=o||0===i){var a;if(e<=o+1e3*(((null==(a=n[i+1])?void 0:a.start)||r)-s.start)){const r=n[i].sn-t.startSN;if(r<0)return-1;const s=t.fragments;if(s.length>n.length){for(let a=(n[i+1]||s[s.length-1]).sn-t.startSN;a>r;a--){const t=s[a].programDateTime;if(e>=t&&e<t+1e3*s[a].duration)return a}}return r}}}return-1}function jn(t,e,n){var i,r;const s=new hn(t,n),a=null!=(i=s.METHOD)?i:"",o=s.URI,l=s.hexadecimalInteger("IV"),u=s.KEYFORMATVERSIONS,h=null!=(r=s.KEYFORMAT)?r:"identity";o&&s.IV&&!l&&C.error(`Invalid IV: ${s.IV}`);const c=o?$n.resolve(o,e):"",d=(u||"1").split("/").map(Number).filter(Number.isFinite);return new On(a,c,h,d,l,s.KEYID)}function Vn(t){const e=new hn(t).decimalFloatingPoint("TIME-OFFSET");return i(e)?e:null}function Zn(t,e){let n=(t||"").split(/[ ,]+/).filter((t=>t));["video","audio","text"].forEach((t=>{const i=n.filter((e=>St(e,t)));i.length&&(e[`${t}Codec`]=i.map((t=>t.split("/")[0])).join(","),n=n.filter((t=>-1===i.indexOf(t))))})),e.unknownCodecs=n}function zn(t,e,n){const i=e[n];i&&(t[n]=i)}function Hn(t,e,n){t.rawProgramDateTime?n.push(t):null!=e&&e.programDateTime&&(t.programDateTime=e.endProgramDateTime)}function Wn(t,e,n,i){t.relurl=e.URI,e.BYTERANGE&&t.setByteRange(e.BYTERANGE),t.level=n,t.sn="initSegment",i&&(t.levelkeys=i),t.initSegment=null}function Yn(t,e,n){t.levelkeys=e;const{encryptedFragments:i}=n;i.length&&i[i.length-1].levelkeys===e||!Object.keys(e).some((t=>e[t].isCommonEncryption))||i.push(t)}function qn(t,e,n){t.playlistParsingError=new Error(`#EXT-X-${e} must not appear more than once (${n[0]})`)}function Qn(t,e,n){t.playlistParsingError=new Error(`#EXT-X-${e} must appear before the first Media Segment (${n[0]})`)}function Xn(t,e){const n=e.startPTS;if(i(n)){let i,r=0;e.sn>t.sn?(r=n-t.start,i=t):(r=t.start-n,i=e),i.duration!==r&&i.setDuration(r)}else if(e.sn>t.sn){t.cc===e.cc&&t.minEndPTS?e.setStart(t.start+(t.minEndPTS-t.start)):e.setStart(t.start+t.duration)}else e.setStart(Math.max(t.start-e.duration,0))}function Jn(t,e,n,r,s,a,o){r-n<=0&&(o.warn("Fragment should have a positive duration",e),r=n+e.duration,a=s+e.duration);let l=n,u=r;const h=e.startPTS,c=e.endPTS;if(i(h)){const d=Math.abs(h-n);t&&d>t.totalduration?o.warn(`media timestamps and playlist times differ by ${d}s for level ${e.level} ${t.url}`):i(e.deltaPTS)?e.deltaPTS=Math.max(d,e.deltaPTS):e.deltaPTS=d,l=Math.max(n,h),n=Math.min(n,h),s=void 0!==e.startDTS?Math.min(s,e.startDTS):s,u=Math.min(r,c),r=Math.max(r,c),a=void 0!==e.endDTS?Math.max(a,e.endDTS):a}const d=n-e.start;0!==e.start&&e.setStart(n),e.setDuration(r-e.start),e.startPTS=n,e.maxStartPTS=l,e.startDTS=s,e.endPTS=r,e.minEndPTS=u,e.endDTS=a;const f=e.sn;if(!t||f<t.startSN||f>t.endSN)return 0;let p;const g=f-t.startSN,_=t.fragments;for(_[g]=e,p=g;p>0;p--)Xn(_[p],_[p-1]);for(p=g;p<_.length-1;p++)Xn(_[p],_[p+1]);return t.fragmentHint&&Xn(_[_.length-1],t.fragmentHint),t.PTSKnown=t.alignedSliding=!0,d}function ti(t,e,n){if(t===e)return;let r=null;const s=t.fragments;for(let t=s.length-1;t>=0;t--){const e=s[t].initSegment;if(e){r=e;break}}let a;t.fragmentHint&&delete t.fragmentHint.endPTS,function(t,e,n){const i=e.skippedSegments,r=Math.max(t.startSN,e.startSN)-e.startSN,s=(t.fragmentHint?1:0)+(i?e.endSN:Math.min(t.endSN,e.endSN))-e.startSN,a=e.startSN-t.startSN,o=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments,l=t.fragmentHint?t.fragments.concat(t.fragmentHint):t.fragments;for(let u=r;u<=s;u++){const r=l[a+u];let s=o[u];if(i&&!s&&r&&(s=e.fragments[u]=r),r&&s){n(r,s,u,o);const i=r.relurl,a=s.relurl;if(i&&ui(i,a))return void(e.playlistParsingError=ei(`media sequence mismatch ${s.sn}:`,t,e,r,s));if(r.cc!==s.cc)return void(e.playlistParsingError=ei(`discontinuity sequence mismatch (${r.cc}!=${s.cc})`,t,e,r,s))}}}(t,e,((t,n,s,o)=>{if((!e.startCC||e.skippedSegments)&&n.cc!==t.cc){const i=t.cc-n.cc;for(let t=s;t<o.length;t++)o[t].cc+=i;e.endCC=o[o.length-1].cc}i(t.startPTS)&&i(t.endPTS)&&(n.setStart(n.startPTS=t.startPTS),n.startDTS=t.startDTS,n.maxStartPTS=t.maxStartPTS,n.endPTS=t.endPTS,n.endDTS=t.endDTS,n.minEndPTS=t.minEndPTS,n.setDuration(t.endPTS-t.startPTS),n.duration&&(a=n),e.PTSKnown=e.alignedSliding=!0),t.hasStreams&&(n.elementaryStreams=t.elementaryStreams),n.loader=t.loader,t.hasStats&&(n.stats=t.stats),t.initSegment&&(n.initSegment=t.initSegment,r=t.initSegment)}));const o=e.fragments,l=e.fragmentHint?o.concat(e.fragmentHint):o;if(r&&l.forEach((t=>{var e;!t||t.initSegment&&t.initSegment.relurl!==(null==(e=r)?void 0:e.relurl)||(t.initSegment=r)})),e.skippedSegments){if(e.deltaUpdateFailed=o.some((t=>!t)),e.deltaUpdateFailed){n.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let t=e.skippedSegments;t--;)o.shift();e.startSN=o[0].sn}else{e.canSkipDateRanges&&(e.dateRanges=function(t,e,n){const{dateRanges:i,recentlyRemovedDateranges:r}=e,s=y({},t);r&&r.forEach((t=>{delete s[t]}));const a=Object.keys(s).length;if(!a)return i;return Object.keys(i).forEach((t=>{const e=s[t],r=new dn(i[t].attr,e);r.isValid?(s[t]=r,e||(r.tagOrder+=a)):n.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${ne(i[t].attr)}"`)})),s}(t.dateRanges,e,n));const i=t.fragments.filter((t=>t.rawProgramDateTime));if(t.hasProgramDateTime&&!e.hasProgramDateTime)for(let t=1;t<l.length;t++)null===l[t].programDateTime&&Hn(l[t],l[t-1],i);Gn(i,e)}e.endCC=o[o.length-1].cc}if(!e.startCC){var u;const n=si(t,e.startSN-1);e.startCC=null!=(u=null==n?void 0:n.cc)?u:o[0].cc}!function(t,e,n){if(t&&e){let i=0;for(let r=0,s=t.length;r<=s;r++){const s=t[r],a=e[r+i];s&&a&&s.index===a.index&&s.fragment.sn===a.fragment.sn?n(s,a):i--}}}(t.partList,e.partList,((t,e)=>{e.elementaryStreams=t.elementaryStreams,e.stats=t.stats})),a?Jn(e,a,a.startPTS,a.endPTS,a.startDTS,a.endDTS,n):ni(t,e),o.length&&(e.totalduration=e.edge-o[0].start),e.driftStartTime=t.driftStartTime,e.driftStart=t.driftStart;const h=e.advancedDateTime;if(e.advanced&&h){const t=e.edge;e.driftStart||(e.driftStartTime=h,e.driftStart=t),e.driftEndTime=h,e.driftEnd=t}else e.driftEndTime=t.driftEndTime,e.driftEnd=t.driftEnd,e.advancedDateTime=t.advancedDateTime;-1===e.requestScheduled&&(e.requestScheduled=t.requestScheduled)}function ei(t,e,n,i,r){return new Error(`${t} ${r.url}\nPlaylist starting @${e.startSN}\n${e.m3u8}\n\nPlaylist starting @${n.startSN}\n${n.m3u8}`)}function ni(t,e,n=!0){const i=e.startSN+e.skippedSegments-t.startSN,r=t.fragments,s=i>=0;let a=0;if(s&&i<r.length)a=r[i].start;else if(s&&e.startSN===t.endSN+1)a=t.fragmentEnd;else if(s&&n)a=t.fragmentStart+i*e.levelTargetDuration;else{if(e.skippedSegments||0!==e.fragmentStart)return;a=t.fragmentStart}ii(e,a)}function ii(t,e){if(e){const n=t.fragments;for(let i=t.skippedSegments;i<n.length;i++)n[i].addStart(e);t.fragmentHint&&t.fragmentHint.addStart(e)}}function ri(t,e=1/0){let n=1e3*t.targetduration;if(t.updated){const i=t.fragments,r=4;if(i.length&&n*r>e){const t=1e3*i[i.length-1].duration;t<n&&(n=t)}}else n/=2;return Math.round(n)}function si(t,e,n){if(!t)return null;let i=t.fragments[e-t.startSN];return i||(i=t.fragmentHint,i&&i.sn===e?i:e<t.startSN&&n&&n.sn===e?n:null)}function ai(t,e,n){return t?oi(t.partList,e,n):null}function oi(t,e,n){if(t)for(let i=t.length;i--;){const r=t[i];if(r.index===n&&r.fragment.sn===e)return r}return null}function li(t){t.forEach(((t,e)=>{var n;null==(n=t.details)||n.fragments.forEach((t=>{t.level=e,t.initSegment&&(t.initSegment.level=e)}))}))}function ui(t,e){return!(t===e||!e)&&hi(t)!==hi(e)}function hi(t){return t.replace(/\?[^?]*$/,"")}function ci(t,e){for(let i=0,r=t.length;i<r;i++){var n;if((null==(n=t[i])?void 0:n.cc)===e)return t[i]}return null}function di(t,e){const n=t.start+e;t.startPTS=n,t.setStart(n),t.endPTS=n+t.duration}function fi(t,e){const n=e.fragments;for(let e=0,i=n.length;e<i;e++)di(n[e],t);e.fragmentHint&&di(e.fragmentHint,t),e.alignedSliding=!0}function pi(t,e){if(!function(t,e){return!!(t&&e.startCC<t.endCC&&e.endCC>t.startCC)}(e,t))return;const n=Math.min(e.endCC,t.endCC),i=ci(e.fragments,n),r=ci(t.fragments,n);if(!i||!r)return;C.log(`Aligning playlist at start of dicontinuity sequence ${n}`);fi(i.start-r.start,t)}function gi(t,e){if(!t.hasProgramDateTime||!e.hasProgramDateTime)return;const n=t.fragments,i=e.fragments;if(!n.length||!i.length)return;let r,s;const a=Math.min(e.endCC,t.endCC);e.startCC<a&&t.startCC<a&&(r=ci(i,a),s=ci(n,a)),r&&s||(r=i[Math.floor(i.length/2)],s=ci(n,r.cc)||n[Math.floor(n.length/2)]);const o=r.programDateTime,l=s.programDateTime;if(!o||!l)return;fi((l-o)/1e3-(s.start-r.start),t)}function _i(t,e,n){mi(t,e,n),t.addEventListener(e,n)}function mi(t,e,n){t.removeEventListener(e,n)}const vi=function(t){let e="";const n=t.length;for(let i=0;i<n;i++)e+=`[${t.start(i).toFixed(3)}-${t.end(i).toFixed(3)}]`;return e},yi="STOPPED",bi="IDLE",Ei="KEY_LOADING",wi="FRAG_LOADING",Ti="FRAG_LOADING_WAITING_RETRY",ki="WAITING_TRACK",Si="PARSING",Ai="PARSED",Di="ENDED",Ci="ERROR",xi="WAITING_INIT_PTS",Ri="WAITING_LEVEL";class Li extends Xe{constructor(t,e,n,r,s){super(r,t.logger),this.hls=void 0,this.fragPrevious=null,this.fragCurrent=null,this.fragmentTracker=void 0,this.transmuxer=null,this._state=yi,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:t,fragCurrent:e,media:n,mediaBuffer:r,state:s}=this,a=n?n.currentTime:0,o=en.bufferInfo(r||n,a,t.maxBufferHole),l=!o.len;if(this.log(`Media seeking to ${i(a)?a.toFixed(3):a}, state: ${s}, ${l?"out of":"in"} buffer`),this.state===Di)this.resetLoadingState();else if(e){const n=t.maxFragLookUpTolerance,i=e.start-n,r=e.start+e.duration+n;if(l||r<o.start||i>o.end){const t=a>r;(a<i||t)&&(t&&e.loader&&(this.log(`Cancelling fragment load for seek (sn: ${e.sn})`),e.abortRequests(),this.resetLoadingState()),this.fragPrevious=null)}}if(n){this.fragmentTracker.removeFragmentsInRange(a,1/0,this.playlistType,!0);if(a>this.lastCurrentTime&&(this.lastCurrentTime=a),!this.loadingParts){const t=Math.max(o.end,a),e=this.shouldLoadParts(this.getLevelDetails(),t);e&&(this.log(`LL-Part loading ON after seeking to ${a.toFixed(2)} with buffer @${t.toFixed(2)}`),this.loadingParts=e)}}this.hls.hasEnoughToStart||(this.log(`Setting ${l?"startPosition":"nextLoadPosition"} to ${a} for seek without enough to start`),this.nextLoadPosition=a,l&&(this.startPosition=a)),l&&this.state===bi&&this.tickImmediate()},this.onMediaEnded=()=>{this.log("setting startPosition to 0 because media ended"),this.startPosition=this.lastCurrentTime=0},this.playlistType=s,this.hls=t,this.fragmentLoader=new We(t.config),this.keyLoader=n,this.fragmentTracker=e,this.config=t.config,this.decrypter=new ze(t.config)}registerListeners(){const{hls:t}=this;t.on(l.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(l.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(l.MANIFEST_LOADING,this.onManifestLoading,this),t.on(l.MANIFEST_LOADED,this.onManifestLoaded,this),t.on(l.ERROR,this.onError,this)}unregisterListeners(){const{hls:t}=this;t.off(l.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(l.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(l.MANIFEST_LOADING,this.onManifestLoading,this),t.off(l.MANIFEST_LOADED,this.onManifestLoaded,this),t.off(l.ERROR,this.onError,this)}doTick(){this.onTickEnd()}onTickEnd(){}startLoad(t){}stopLoad(){if(this.state===yi)return;this.fragmentLoader.abort(),this.keyLoader.abort(this.playlistType);const t=this.fragCurrent;null!=t&&t.loader&&(t.abortRequests(),this.fragmentTracker.removeFragment(t)),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=yi}get startPositionValue(){const{nextLoadPosition:t,startPosition:e}=this;return-1===e&&t?t:e}get bufferingEnabled(){return this.buffering}pauseBuffering(){this.buffering=!1}resumeBuffering(){this.buffering=!0}get inFlightFrag(){return{frag:this.fragCurrent,state:this.state}}_streamEnded(t,e){if(e.live||!this.media)return!1;const n=t.end||0,i=this.config.timelineOffset||0;if(n<=i)return!1;const r=t.buffered;this.config.maxBufferHole&&r&&r.length>1&&(t=en.bufferedInfo(r,t.start,0));const s=t.nextStart;if(s&&s>i&&s<e.edge)return!1;if(this.media.currentTime<t.start)return!1;const a=e.partList;if(null!=a&&a.length){const t=a[a.length-1];return en.isBuffered(this.media,t.start+t.duration/2)}const o=e.fragments[e.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(o)}getLevelDetails(){if(this.levels&&null!==this.levelLastLoaded)return this.levelLastLoaded.details}get timelineOffset(){const t=this.config.timelineOffset;var e;return t?(null==(e=this.getLevelDetails())?void 0:e.appliedTimelineOffset)||t:0}onMediaAttached(t,e){const n=this.media=this.mediaBuffer=e.media;_i(n,"seeking",this.onMediaSeeking),_i(n,"ended",this.onMediaEnded);const i=this.config;this.levels&&i.autoStartLoad&&this.state===yi&&this.startLoad(i.startPosition)}onMediaDetaching(t,e){const n=!!e.transferMedia,i=this.media;if(null!==i){if(i.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),mi(i,"seeking",this.onMediaSeeking),mi(i,"ended",this.onMediaEnded),this.keyLoader&&!n&&this.keyLoader.detach(),this.media=this.mediaBuffer=null,this.loopSn=void 0,n)return this.resetLoadingState(),void this.resetTransmuxer();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(t,e){}onManifestLoaded(t,e){this.startTimeOffset=e.startTimeOffset}onHandlerDestroying(){this.stopLoad(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),super.onHandlerDestroying(),this.hls=this.onMediaSeeking=this.onMediaEnded=null}onHandlerDestroyed(){this.state=yi,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(t,e,n){this.startFragRequested=!0,this._loadFragForPlayback(t,e,n)}_loadFragForPlayback(t,e,n){this._doFragLoad(t,e,n,(t=>{const e=t.frag;if(this.fragContextChanged(e))return this.warn(`${e.type} sn: ${e.sn}${t.part?" part: "+t.part.index:""} of ${this.fragInfo(e,!1,t.part)}) was dropped during download.`),void this.fragmentTracker.removeFragment(e);e.stats.chunkCount++,this._handleFragmentLoadProgress(t)})).then((t=>{if(!t)return;const e=this.state,n=t.frag;this.fragContextChanged(n)?(e===wi||!this.fragCurrent&&e===Si)&&(this.fragmentTracker.removeFragment(n),this.state=bi):("payload"in t&&(this.log(`Loaded ${n.type} sn: ${n.sn} of ${this.playlistLabel()} ${n.level}`),this.hls.trigger(l.FRAG_LOADED,t)),this._handleFragmentLoadComplete(t))})).catch((e=>{this.state!==yi&&this.state!==Ci&&(this.warn(`Frag error: ${(null==e?void 0:e.message)||e}`),this.resetFragmentLoading(t))}))}clearTrackerIfNeeded(t){var e;const{fragmentTracker:n}=this;if(n.getState(t)===Oe){const e=t.type,i=this.getFwdBufferInfo(this.mediaBuffer,e),r=Math.max(t.duration,i?i.len:this.config.maxBufferLength),s=this.backtrackFragment;(1===(s?t.sn-s.sn:0)||this.reduceMaxBufferLength(r,t.duration))&&n.removeFragment(t)}else 0===(null==(e=this.mediaBuffer)?void 0:e.buffered.length)?n.removeAllFragments():n.hasParts(t.type)&&(n.detectPartialFragments({frag:t,part:null,stats:t.stats,id:t.type}),n.getState(t)===Fe&&n.removeFragment(t))}checkLiveUpdate(t){if(t.updated&&!t.live){const e=t.fragments[t.fragments.length-1];this.fragmentTracker.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type})}t.fragments[0]||(t.deltaUpdateFailed=!0)}waitForLive(t){const e=t.details;return(null==e?void 0:e.live)&&"EVENT"!==e.type&&(this.levelLastLoaded!==t||e.expired)}flushMainBuffer(t,e,n=null){if(!(t-e))return;const i={startOffset:t,endOffset:e,type:n};this.hls.trigger(l.BUFFER_FLUSHING,i)}_loadInitSegment(t,e){this._doFragLoad(t,e).then((t=>{const e=null==t?void 0:t.frag;if(!e||this.fragContextChanged(e)||!this.levels)throw new Error("init load aborted");return t})).then((t=>{const{hls:e}=this,{frag:n,payload:i}=t,r=n.decryptdata;if(i&&i.byteLength>0&&null!=r&&r.key&&r.iv&&_n(r.method)){const s=self.performance.now();return this.decrypter.decrypt(new Uint8Array(i),r.key.buffer,r.iv.buffer,mn(r.method)).catch((t=>{throw e.trigger(l.ERROR,{type:a.MEDIA_ERROR,details:o.FRAG_DECRYPT_ERROR,fatal:!1,error:t,reason:t.message,frag:n}),t})).then((i=>{const r=self.performance.now();return e.trigger(l.FRAG_DECRYPTED,{frag:n,payload:i,stats:{tstart:s,tdecrypt:r}}),t.payload=i,this.completeInitSegmentLoad(t)}))}return this.completeInitSegmentLoad(t)})).catch((e=>{this.state!==yi&&this.state!==Ci&&(this.warn(e),this.resetFragmentLoading(t))}))}completeInitSegmentLoad(t){const{levels:e}=this;if(!e)throw new Error("init load aborted, missing levels");const n=t.frag.stats;this.state!==yi&&(this.state=bi),t.frag.data=new Uint8Array(t.payload),n.parsing.start=n.buffering.start=self.performance.now(),n.parsing.end=n.buffering.end=self.performance.now(),this.tick()}unhandledEncryptionError(t,e){var n,i;const r=t.tracks;if(r&&!e.encrypted&&(null!=(n=r.audio)&&n.encrypted||null!=(i=r.video)&&i.encrypted)&&(!this.config.emeEnabled||!this.keyLoader.emeController)){const t=this.media,n=new Error(`Encrypted track with no key in ${this.fragInfo(e)} (media ${t?"attached mediaKeys: "+t.mediaKeys:"detached"})`);return this.warn(n.message),!t||t.mediaKeys?!1:(this.hls.trigger(l.ERROR,{type:a.KEY_SYSTEM_ERROR,details:o.KEY_SYSTEM_NO_KEYS,fatal:!1,error:n,frag:e}),this.resetTransmuxer(),!0)}return!1}fragContextChanged(t){const{fragCurrent:e}=this;return!t||!e||t.sn!==e.sn||t.level!==e.level}fragBufferedComplete(t,e){const n=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log(`Buffered ${t.type} sn: ${t.sn}${e?" part: "+e.index:""} of ${this.fragInfo(t,!1,e)} > buffer:${n?vi(en.getBuffered(n)):"(detached)"})`),W(t)){var i;if(t.type!==g){const e=t.elementaryStreams;if(!Object.keys(e).some((t=>!!e[t])))return void(this.state=bi)}const e=null==(i=this.levels)?void 0:i[t.level];null!=e&&e.fragmentError&&(this.log(`Resetting level fragment error count of ${e.fragmentError} on frag buffered`),e.fragmentError=0)}this.state=bi}_handleFragmentLoadComplete(t){const{transmuxer:e}=this;if(!e)return;const{frag:n,part:i,partsLoaded:r}=t,s=!r||0===r.length||r.some((t=>!t)),a=new Je(n.level,n.sn,n.stats.chunkCount+1,0,i?i.index:-1,!s);e.flush(a)}_handleFragmentLoadProgress(t){}_doFragLoad(t,e,n=null,r){var s;this.fragCurrent=t;const a=e.details;if(!this.levels||!a)throw new Error(`frag load aborted, missing level${a?"":" detail"}s`);let o=null;if(!t.encrypted||null!=(s=t.decryptdata)&&s.key)t.encrypted||(o=this.keyLoader.loadClear(t,a.encryptedFragments,this.startFragRequested),o&&this.log("[eme] blocking frag load until media-keys acquired"));else if(this.log(`Loading key for ${t.sn} of [${a.startSN}-${a.endSN}], ${this.playlistLabel()} ${t.level}`),this.state=Ei,this.fragCurrent=t,o=this.keyLoader.load(t).then((t=>{if(!this.fragContextChanged(t.frag))return this.hls.trigger(l.KEY_LOADED,t),this.state===Ei&&(this.state=bi),t})),this.hls.trigger(l.KEY_LOADING,{frag:t}),null===this.fragCurrent)return this.log("context changed in KEY_LOADING"),Promise.resolve(null);const u=this.fragPrevious;if(W(t)&&(!u||t.sn!==u.sn)){const n=this.shouldLoadParts(e.details,t.end);n!==this.loadingParts&&(this.log(`LL-Part loading ${n?"ON":"OFF"} loading sn ${null==u?void 0:u.sn}->${t.sn}`),this.loadingParts=n)}if(n=Math.max(t.start,n||0),this.loadingParts&&W(t)){const i=a.partList;if(i&&r){n>a.fragmentEnd&&a.fragmentHint&&(t=a.fragmentHint);const s=this.getNextPart(i,t,n);if(s>-1){const u=i[s];let h;return t=this.fragCurrent=u.fragment,this.log(`Loading ${t.type} sn: ${t.sn} part: ${u.index} (${s}/${i.length-1}) of ${this.fragInfo(t,!1,u)}) cc: ${t.cc} [${a.startSN}-${a.endSN}], target: ${parseFloat(n.toFixed(3))}`),this.nextLoadPosition=u.start+u.duration,this.state=wi,h=o?o.then((n=>!n||this.fragContextChanged(n.frag)?null:this.doFragPartsLoad(t,u,e,r))).catch((t=>this.handleFragLoadError(t))):this.doFragPartsLoad(t,u,e,r).catch((t=>this.handleFragLoadError(t))),this.hls.trigger(l.FRAG_LOADING,{frag:t,part:u,targetBufferTime:n}),null===this.fragCurrent?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):h}if(!t.url||this.loadedEndOfParts(i,n))return Promise.resolve(null)}}var h;if(W(t)&&this.loadingParts)this.log(`LL-Part loading OFF after next part miss @${n.toFixed(2)} Check buffer at sn: ${t.sn} loaded parts: ${null==(h=a.partList)?void 0:h.filter((t=>t.loaded)).map((t=>`[${t.start}-${t.end}]`))}`),this.loadingParts=!1;else if(!t.url)return Promise.resolve(null);this.log(`Loading ${t.type} sn: ${t.sn} of ${this.fragInfo(t,!1)}) cc: ${t.cc} ${"["+a.startSN+"-"+a.endSN+"]"}, target: ${parseFloat(n.toFixed(3))}`),i(t.sn)&&!this.bitrateTest&&(this.nextLoadPosition=t.start+t.duration),this.state=wi;const c=this.config.progressive;let d;return d=c&&o?o.then((e=>!e||this.fragContextChanged(e.frag)?null:this.fragmentLoader.load(t,r))).catch((t=>this.handleFragLoadError(t))):Promise.all([this.fragmentLoader.load(t,c?r:void 0),o]).then((([t])=>(!c&&r&&r(t),t))).catch((t=>this.handleFragLoadError(t))),this.hls.trigger(l.FRAG_LOADING,{frag:t,targetBufferTime:n}),null===this.fragCurrent?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):d}doFragPartsLoad(t,e,n,i){return new Promise(((r,s)=>{var a;const o=[],u=null==(a=n.details)?void 0:a.partList,h=e=>{this.fragmentLoader.loadPart(t,e,i).then((i=>{o[e.index]=i;const s=i.part;this.hls.trigger(l.FRAG_LOADED,i);const a=ai(n.details,t.sn,e.index+1)||oi(u,t.sn,e.index+1);if(!a)return r({frag:t,part:s,partsLoaded:o});h(a)})).catch(s)};h(e)}))}handleFragLoadError(t){if("data"in t){const e=t.data;e.frag&&e.details===o.INTERNAL_ABORTED?this.handleFragLoadAborted(e.frag,e.part):e.frag&&e.type===a.KEY_SYSTEM_ERROR?(e.frag.abortRequests(),this.resetStartWhenNotLoaded(),this.resetFragmentLoading(e.frag)):this.hls.trigger(l.ERROR,e)}else this.hls.trigger(l.ERROR,{type:a.OTHER_ERROR,details:o.INTERNAL_EXCEPTION,err:t,error:t,fatal:!0});return null}_handleTransmuxerFlush(t){const e=this.getCurrentContext(t);if(!e||this.state!==Si)return void(this.fragCurrent||this.state===yi||this.state===Ci||(this.state=bi));const{frag:n,part:i,level:r}=e,s=self.performance.now();n.stats.parsing.end=s,i&&(i.stats.parsing.end=s);const a=this.getLevelDetails(),o=a&&n.sn>a.endSN||this.shouldLoadParts(a,n.end);o!==this.loadingParts&&(this.log(`LL-Part loading ${o?"ON":"OFF"} after parsing segment ending @${n.end.toFixed(2)}`),this.loadingParts=o),this.updateLevelTiming(n,i,r,t.partial)}shouldLoadParts(t,e){if(this.config.lowLatencyMode){if(!t)return this.loadingParts;if(t.partList){var n;const r=t.partList[0];if(r.fragment.type===g)return!1;if(e>=r.end+((null==(n=t.fragmentHint)?void 0:n.duration)||0)){var i;if((this.hls.hasEnoughToStart?(null==(i=this.media)?void 0:i.currentTime)||this.lastCurrentTime:this.getLoadPosition())>r.start-r.fragment.duration)return!0}}}return!1}getCurrentContext(t){const{levels:e,fragCurrent:n}=this,{level:i,sn:r,part:s}=t;if(null==e||!e[i])return this.warn(`Levels object was unset while buffering fragment ${r} of ${this.playlistLabel()} ${i}. The current chunk will not be buffered.`),null;const a=e[i],o=a.details,l=s>-1?ai(o,r,s):null,u=l?l.fragment:si(o,r,n);return u?(n&&n!==u&&(u.stats=n.stats),{frag:u,part:l,level:a}):null}bufferFragmentData(t,e,n,i,r){if(this.state!==Si)return;const{data1:s,data2:a}=t;let o=s;if(a&&(o=gt(s,a)),!o.length)return;const u=this.initPTS[e.cc],h=u?-u.baseTime/u.timescale:void 0,c={type:t.type,frag:e,part:n,chunkMeta:i,offset:h,parent:e.type,data:o};if(this.hls.trigger(l.BUFFER_APPENDING,c),t.dropped&&t.independent&&!n){if(r)return;this.flushBufferGap(e)}}flushBufferGap(t){const e=this.media;if(!e)return;if(!en.isBuffered(e,e.currentTime))return void this.flushMainBuffer(0,t.start);const n=e.currentTime,i=en.bufferInfo(e,n,0),r=t.duration,s=Math.min(2*this.config.maxFragLookUpTolerance,.25*r),a=Math.max(Math.min(t.start-s,i.end-s),n+s);t.start-a>s&&this.flushMainBuffer(a,t.start)}getFwdBufferInfo(t,e){var n;const r=this.getLoadPosition();if(!i(r))return null;const s=this.lastCurrentTime>r||null!=(n=this.media)&&n.paused?0:this.config.maxBufferHole;return this.getFwdBufferInfoAtPos(t,r,e,s)}getFwdBufferInfoAtPos(t,e,n,i){const r=en.bufferInfo(t,e,i);if(0===r.len&&void 0!==r.nextStart){const s=this.fragmentTracker.getBufferedFrag(e,n);if(s&&(r.nextStart<=s.end||s.gap)){const n=Math.max(Math.min(r.nextStart,s.end)-e,i);return en.bufferInfo(t,e,n)}}return r}getMaxBufferLength(t){const{config:e}=this;let n;return n=t?Math.max(8*e.maxBufferSize/t,e.maxBufferLength):e.maxBufferLength,Math.min(n,e.maxMaxBufferLength)}reduceMaxBufferLength(t,e){const n=this.config,i=Math.max(Math.min(t-e,n.maxBufferLength),e),r=Math.max(t-3*e,n.maxMaxBufferLength/2,i);return r>=i&&(n.maxMaxBufferLength=r,this.warn(`Reduce max buffer length to ${r}s`),!0)}getAppendedFrag(t,e=f){const n=this.fragmentTracker?this.fragmentTracker.getAppendedFrag(t,e):null;return n&&"fragment"in n?n.fragment:n}getNextFragment(t,e){const n=e.fragments,i=n.length;if(!i)return null;const{config:r}=this,s=n[0].start,a=r.lowLatencyMode&&!!e.partList;let o=null;if(e.live){const n=r.initialLiveManifestSize;if(i<n)return this.warn(`Not enough fragments to start playback (have: ${i}, need: ${n})`),null;if(!e.PTSKnown&&!this.startFragRequested&&-1===this.startPosition||t<s){var l;a&&!this.loadingParts&&(this.log("LL-Part loading ON for initial live fragment"),this.loadingParts=!0),o=this.getInitialLiveFragment(e);const n=this.hls.startPosition,i=this.hls.liveSyncPosition,r=o?(-1!==n&&n>=s?n:i)||o.start:t;this.log(`Setting startPosition to ${r} to match start frag at live edge. mainStart: ${n} liveSyncPosition: ${i} frag.start: ${null==(l=o)?void 0:l.start}`),this.startPosition=this.nextLoadPosition=r}}else t<=s&&(o=n[0]);if(!o){const n=this.loadingParts?e.partEnd:e.fragmentEnd;o=this.getFragmentAtPosition(t,n,e)}let u=this.filterReplacedPrimary(o,e);if(!u&&o){const t=o.sn-e.startSN;u=this.filterReplacedPrimary(n[t+1]||null,e)}return this.mapToInitFragWhenRequired(u)}isLoopLoading(t,e){const n=this.fragmentTracker.getState(t);return(n===Me||n===Fe&&!!t.gap)&&this.nextLoadPosition>e}getNextFragmentLoopLoading(t,e,n,i,r){let s=null;if(t.gap&&(s=this.getNextFragment(this.nextLoadPosition,e),s&&!s.gap&&n.nextStart)){const t=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,n.nextStart,i,0);if(null!==t&&n.len+t.len>=r){const t=s.sn;return this.loopSn!==t&&(this.log(`buffer full after gaps in "${i}" playlist starting at sn: ${t}`),this.loopSn=t),null}}return this.loopSn=void 0,s}get primaryPrefetch(){if(Ii(this.config)){var t;if(null==(t=this.hls.interstitialsManager)||null==(t=t.playingItem)?void 0:t.event)return!0}return!1}filterReplacedPrimary(t,e){if(!t)return t;if(Ii(this.config)&&t.type!==g){const n=this.hls.interstitialsManager,i=null==n?void 0:n.bufferingItem;if(i){const n=i.event;if(n){if(n.appendInPlace||Math.abs(t.start-i.start)>1||0===i.start)return null}else{if(t.end<=i.start&&!1===(null==e?void 0:e.live))return null;if(t.start>i.end&&i.nextEvent&&(i.nextEvent.appendInPlace||t.start-i.end>1))return null}}const r=null==n?void 0:n.playerQueue;if(r)for(let e=r.length;e--;){const n=r[e].interstitial;if(n.appendInPlace&&t.start>=n.startTime&&t.end<=n.resumeTime)return null}}return t}mapToInitFragWhenRequired(t){return null==t||!t.initSegment||t.initSegment.data||this.bitrateTest?t:t.initSegment}getNextPart(t,e,n){let i=-1,r=!1,s=!0;for(let a=0,o=t.length;a<o;a++){const o=t[a];if(s=s&&!o.independent,i>-1&&n<o.start)break;const l=o.loaded;l?i=-1:(r||(o.independent||s)&&o.fragment===e)&&(o.fragment!==e&&this.warn(`Need buffer at ${n} but next unloaded part starts at ${o.start}`),i=a),r=l}return i}loadedEndOfParts(t,e){let n;for(let i=t.length;i--;){if(n=t[i],!n.loaded)return!1;if(e>n.start)return!0}return!1}getInitialLiveFragment(t){const e=t.fragments,n=this.fragPrevious;let r=null;if(n){if(t.hasProgramDateTime&&(this.log(`Live playlist, switching playlist, load frag with same PDT: ${n.programDateTime}`),r=function(t,e,n){if(null===e||!Array.isArray(t)||!t.length||!i(e))return null;if(e<(t[0].programDateTime||0))return null;if(e>=(t[t.length-1].endProgramDateTime||0))return null;for(let i=0;i<t.length;++i){const r=t[i];if(pe(e,n,r))return r}return null}(e,n.endProgramDateTime,this.config.maxFragLookUpTolerance)),!r){const i=n.sn+1;if(i>=t.startSN&&i<=t.endSN){const s=e[i-t.startSN];n.cc===s.cc&&(r=s,this.log(`Live playlist, switching playlist, load frag with next SN: ${r.sn}`))}r||(r=ge(t,n.cc,n.end),r&&this.log(`Live playlist, switching playlist, load frag with same CC: ${r.sn}`))}}else{const e=this.hls.liveSyncPosition;null!==e&&(r=this.getFragmentAtPosition(e,this.bitrateTest?t.fragmentEnd:t.edge,t))}return r}getFragmentAtPosition(t,e,n){const{config:i}=this;let{fragPrevious:r}=this,{fragments:s,endSN:a}=n;const{fragmentHint:o}=n,{maxFragLookUpTolerance:l}=i,u=n.partList,h=!!(this.loadingParts&&null!=u&&u.length&&o);let c;if(h&&!this.bitrateTest&&u[u.length-1].fragment.sn===o.sn&&(s=s.concat(o),a=o.sn),t<e){var d;c=de(r,s,t,t<this.lastCurrentTime||t>e-l||null!=(d=this.media)&&d.paused||!this.startFragRequested?0:l)}else c=s[s.length-1];if(c){const t=c.sn-n.startSN,e=this.fragmentTracker.getState(c);if((e===Me||e===Fe&&c.gap)&&(r=c),r&&c.sn===r.sn&&(!h||u[0].fragment.sn>c.sn||!n.live)){if(c.level===r.level){const e=s[t+1];c=c.sn<a&&this.fragmentTracker.getState(e)!==Me?e:null}}}return c}alignPlaylists(t,e,n){const r=t.fragments.length;if(!r)return this.warn("No fragments in live playlist"),0;const s=t.fragmentStart,a=!e,o=t.alignedSliding&&i(s);if(a||!o&&!s){!function(t,e){t&&(pi(e,t),e.alignedSliding||gi(e,t),e.alignedSliding||e.skippedSegments||ni(t,e,!1))}(n,t);const i=t.fragmentStart;return this.log(`Live playlist sliding: ${i.toFixed(2)} start-sn: ${e?e.startSN:"na"}->${t.startSN} fragments: ${r}`),i}return s}waitForCdnTuneIn(t){return t.live&&t.canBlockReload&&t.partTarget&&t.tuneInGoal>Math.max(t.partHoldBack,3*t.partTarget)}setStartPosition(t,e){let n=this.startPosition;n<e&&(n=-1);const r=this.timelineOffset;if(-1===n){const s=null!==this.startTimeOffset,a=s?this.startTimeOffset:t.startTimeOffset;null!==a&&i(a)?(n=e+a,a<0&&(n+=t.edge),n=Math.min(Math.max(e,n),e+t.totalduration),this.log(`Setting startPosition to ${n} for start time offset ${a} found in ${s?"multivariant":"media"} playlist`),this.startPosition=n):t.live?(n=this.hls.liveSyncPosition||e,this.log(`Setting startPosition to -1 to start at live edge ${n}`),this.startPosition=-1):(this.log("setting startPosition to 0 by default"),this.startPosition=n=0),this.lastCurrentTime=n+r}this.nextLoadPosition=n+r}getLoadPosition(){var t;const{media:e}=this;let n=0;return null!=(t=this.hls)&&t.hasEnoughToStart&&e?n=e.currentTime:this.nextLoadPosition>=0&&(n=this.nextLoadPosition),n}handleFragLoadAborted(t,e){this.transmuxer&&t.type===this.playlistType&&W(t)&&t.stats.aborted&&(this.log(`Fragment ${t.sn}${e?" part "+e.index:""} of ${this.playlistLabel()} ${t.level} was aborted`),this.resetFragmentLoading(t))}resetFragmentLoading(t){this.fragCurrent&&(this.fragContextChanged(t)||this.state===Ti)||(this.state=bi)}onFragmentOrKeyLoadError(t,e){var n;if(e.chunkMeta&&!e.frag){const t=this.getCurrentContext(e.chunkMeta);t&&(e.frag=t.frag)}const i=e.frag;if(!i||i.type!==t||!this.levels)return;var r;if(this.fragContextChanged(i))return void this.warn(`Frag load error must match current frag to retry ${i.url} > ${null==(r=this.fragCurrent)?void 0:r.url}`);const s=e.details===o.FRAG_GAP;s&&this.fragmentTracker.fragBuffered(i,!0);const a=e.errorAction;if(!a)return void(this.state=Ci);const{action:l,flags:u,retryCount:h=0,retryConfig:c}=a,d=!!c,f=d&&l===De,p=d&&!a.resolved&&u===xe,g=null==(n=this.hls.latestLevelDetails)?void 0:n.live;if(!f&&p&&W(i)&&!i.endList&&g&&!ve(e))this.resetFragmentErrors(t),this.treatAsGap(i),a.resolved=!0;else if((f||p)&&h<c.maxNumRetry){var _;const n=Te(null==(_=e.response)?void 0:_.code),r=be(c,h);if(this.resetStartWhenNotLoaded(),this.retryDate=self.performance.now()+r,this.state=Ti,a.resolved=!0,n)return this.log("Waiting for connection (offline)"),this.retryDate=1/0,void(e.reason="offline");this.warn(`Fragment ${i.sn} of ${t} ${i.level} errored with ${e.details}, retrying loading ${h+1}/${c.maxNumRetry} in ${r}ms`)}else if(c){if(this.resetFragmentErrors(t),!(h<c.maxNumRetry))return void this.warn(`${e.details} reached or exceeded max retry (${h})`);s||l===Ae||(a.resolved=!0)}else this.state=l===Se?Ri:Ci;this.tickImmediate()}checkRetryDate(){const t=self.performance.now(),e=this.retryDate,n=e===1/0;(!e||t>=e||n&&!Te(0))&&(n&&this.log("Connection restored (online)"),this.resetStartWhenNotLoaded(),this.state=bi)}reduceLengthAndFlushBuffer(t){if(this.state===Si||this.state===Ai){const e=t.frag,n=t.parent,i=this.getFwdBufferInfo(this.mediaBuffer,n),r=i&&i.len>.5;r&&this.reduceMaxBufferLength(i.len,(null==e?void 0:e.duration)||10);const s=!r;return s&&this.warn(`Buffer full error while media.currentTime (${this.getLoadPosition()}) is not buffered, flush ${n} buffer`),e&&(this.fragmentTracker.removeFragment(e),this.nextLoadPosition=e.start),this.resetLoadingState(),s}return!1}resetFragmentErrors(t){t===p&&(this.fragCurrent=null),this.hls.hasEnoughToStart||(this.startFragRequested=!1),this.state!==yi&&(this.state=bi)}afterBufferFlushed(t,e,n){if(!t)return;const i=en.getBuffered(t);this.fragmentTracker.detectEvictedFragments(e,i,n),this.state===Di&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state!==yi&&(this.state=bi)}resetStartWhenNotLoaded(){if(!this.hls.hasEnoughToStart){this.startFragRequested=!1;const t=this.levelLastLoaded,e=t?t.details:null;null!=e&&e.live?(this.log("resetting startPosition for live start"),this.startPosition=-1,this.setStartPosition(e,e.fragmentStart),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}}resetWhenMissingContext(t){this.log(`Loading context changed while buffering sn ${t.sn} of ${this.playlistLabel()} ${-1===t.level?"<removed>":t.level}. This chunk will not be buffered.`),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(),this.resetLoadingState()}removeUnbufferedFrags(t=0){this.fragmentTracker.removeFragmentsInRange(t,1/0,this.playlistType,!1,!0)}updateLevelTiming(t,e,n,i){const r=n.details;if(!r)return void this.warn("level.details undefined");var s;if(!Object.keys(t.elementaryStreams).reduce(((e,s)=>{const a=t.elementaryStreams[s];if(a){const o=a.endPTS-a.startPTS;if(o<=0)return this.warn(`Could not parse fragment ${t.sn} ${s} duration reliably (${o})`),e||!1;const u=i?0:Jn(r,t,a.startPTS,a.endPTS,a.startDTS,a.endDTS,this);return this.hls.trigger(l.LEVEL_PTS_UPDATED,{details:r,level:n,drift:u,type:s,frag:t,start:a.startPTS,end:a.endPTS}),!0}return e}),!1)&&(0===n.fragmentError&&this.treatAsGap(t,n),null===(null==(s=this.transmuxer)?void 0:s.error))){const e=new Error(`Found no media in fragment ${t.sn} of ${this.playlistLabel()} ${t.level} resetting transmuxer to fallback to playlist timing`);if(this.warn(e.message),this.hls.trigger(l.ERROR,{type:a.MEDIA_ERROR,details:o.FRAG_PARSING_ERROR,fatal:!1,error:e,frag:t,reason:`Found no media in msn ${t.sn} of ${this.playlistLabel()} "${n.url}"`}),!this.hls)return;this.resetTransmuxer()}this.state=Ai,this.log(`Parsed ${t.type} sn: ${t.sn}${e?" part: "+e.index:""} of ${this.fragInfo(t,!1,e)})`),this.hls.trigger(l.FRAG_PARSED,{frag:t,part:e})}playlistLabel(){return this.playlistType===f?"level":"track"}fragInfo(t,e=!0,n){var i,r;return`${this.playlistLabel()} ${t.level} (${n?"part":"frag"}:[${(null!=(i=e&&!n?t.startPTS:(n||t).start)?i:NaN).toFixed(3)}-${(null!=(r=e&&!n?t.endPTS:(n||t).end)?r:NaN).toFixed(3)}]${n&&"main"===t.type?"INDEPENDENT="+(n.independent?"YES":"NO"):""}`}treatAsGap(t,e){e&&e.fragmentError++,t.gap=!0,this.fragmentTracker.removeFragment(t),this.fragmentTracker.fragBuffered(t,!0)}resetTransmuxer(){var t;null==(t=this.transmuxer)||t.reset()}recoverWorkerError(t){"demuxerWorker"===t.event&&(this.fragmentTracker.removeAllFragments(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),this.resetStartWhenNotLoaded(),this.resetLoadingState())}set state(t){const e=this._state;e!==t&&(this._state=t,this.log(`${e}->${t}`))}get state(){return this._state}}function Ii(t){return!!t.interstitialsController&&!1!==t.enableInterstitialPlayback}class Pi{constructor(){this.chunks=[],this.dataLength=0}push(t){this.chunks.push(t),this.dataLength+=t.length}flush(){const{chunks:t,dataLength:e}=this;let n;return t.length?(n=1===t.length?t[0]:function(t,e){const n=new Uint8Array(e);let i=0;for(let e=0;e<t.length;e++){const r=t[e];n.set(r,i),i+=r.length}return n}(t,e),this.reset(),n):new Uint8Array(0)}reset(){this.chunks.length=0,this.dataLength=0}}var Oi,Fi={exports:{}};var Mi=(Oi||(Oi=1,function(t){var e=Object.prototype.hasOwnProperty,n="~";function i(){}function r(t,e,n){this.fn=t,this.context=e,this.once=n||!1}function s(t,e,i,s,a){if("function"!=typeof i)throw new TypeError("The listener must be a function");var o=new r(i,s||t,a),l=n?n+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],o]:t._events[l].push(o):(t._events[l]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new i:delete t._events[e]}function o(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(n=!1)),o.prototype.eventNames=function(){var t,i,r=[];if(0===this._eventsCount)return r;for(i in t=this._events)e.call(t,i)&&r.push(n?i.slice(1):i);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(t)):r},o.prototype.listeners=function(t){var e=n?n+t:t,i=this._events[e];if(!i)return[];if(i.fn)return[i.fn];for(var r=0,s=i.length,a=new Array(s);r<s;r++)a[r]=i[r].fn;return a},o.prototype.listenerCount=function(t){var e=n?n+t:t,i=this._events[e];return i?i.fn?1:i.length:0},o.prototype.emit=function(t,e,i,r,s,a){var o=n?n+t:t;if(!this._events[o])return!1;var l,u,h=this._events[o],c=arguments.length;if(h.fn){switch(h.once&&this.removeListener(t,h.fn,void 0,!0),c){case 1:return h.fn.call(h.context),!0;case 2:return h.fn.call(h.context,e),!0;case 3:return h.fn.call(h.context,e,i),!0;case 4:return h.fn.call(h.context,e,i,r),!0;case 5:return h.fn.call(h.context,e,i,r,s),!0;case 6:return h.fn.call(h.context,e,i,r,s,a),!0}for(u=1,l=new Array(c-1);u<c;u++)l[u-1]=arguments[u];h.fn.apply(h.context,l)}else{var d,f=h.length;for(u=0;u<f;u++)switch(h[u].once&&this.removeListener(t,h[u].fn,void 0,!0),c){case 1:h[u].fn.call(h[u].context);break;case 2:h[u].fn.call(h[u].context,e);break;case 3:h[u].fn.call(h[u].context,e,i);break;case 4:h[u].fn.call(h[u].context,e,i,r);break;default:if(!l)for(d=1,l=new Array(c-1);d<c;d++)l[d-1]=arguments[d];h[u].fn.apply(h[u].context,l)}}return!0},o.prototype.on=function(t,e,n){return s(this,t,e,n,!1)},o.prototype.once=function(t,e,n){return s(this,t,e,n,!0)},o.prototype.removeListener=function(t,e,i,r){var s=n?n+t:t;if(!this._events[s])return this;if(!e)return a(this,s),this;var o=this._events[s];if(o.fn)o.fn!==e||r&&!o.once||i&&o.context!==i||a(this,s);else{for(var l=0,u=[],h=o.length;l<h;l++)(o[l].fn!==e||r&&!o[l].once||i&&o[l].context!==i)&&u.push(o[l]);u.length?this._events[s]=1===u.length?u[0]:u:a(this,s)}return this},o.prototype.removeAllListeners=function(t){var e;return t?(e=n?n+t:t,this._events[e]&&a(this,e)):(this._events=new i,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=n,o.EventEmitter=o,t.exports=o}(Fi)),Fi.exports),Ni=O(Mi);const Bi="1.6.12",Ui={};function $i(t,e){return e+10<=t.length&&51===t[e]&&68===t[e+1]&&73===t[e+2]&&t[e+3]<255&&t[e+4]<255&&t[e+6]<128&&t[e+7]<128&&t[e+8]<128&&t[e+9]<128}function Gi(t,e){return e+10<=t.length&&73===t[e]&&68===t[e+1]&&51===t[e+2]&&t[e+3]<255&&t[e+4]<255&&t[e+6]<128&&t[e+7]<128&&t[e+8]<128&&t[e+9]<128}function Ki(t,e){let n=0;return n=(127&t[e])<<21,n|=(127&t[e+1])<<14,n|=(127&t[e+2])<<7,n|=127&t[e+3],n}function ji(t,e){const n=e;let i=0;for(;Gi(t,e);){i+=10;i+=Ki(t,e+6),$i(t,e+10)&&(i+=10),e+=i}if(i>0)return t.subarray(n,n+i)}function Vi(t,e){return 255===t[e]&&240==(246&t[e+1])}function Zi(t,e){return 1&t[e+1]?7:9}function zi(t,e){return(3&t[e+3])<<11|t[e+4]<<3|(224&t[e+5])>>>5}function Hi(t,e){return e+1<t.length&&Vi(t,e)}function Wi(t,e){if(Hi(t,e)){const n=Zi(t,e);if(e+n>=t.length)return!1;const i=zi(t,e);if(i<=n)return!1;const r=e+i;return r===t.length||Hi(t,r)}return!1}function Yi(t,e,n,i,r){if(!t.samplerate){const s=function(t,e,n,i){const r=e[n+2],s=r>>2&15;if(s>12){const e=new Error(`invalid ADTS sampling index:${s}`);return void t.emit(l.ERROR,l.ERROR,{type:a.MEDIA_ERROR,details:o.FRAG_PARSING_ERROR,fatal:!0,error:e,reason:e.message})}const u=1+(r>>6&3),h=e[n+3]>>6&3|(1&r)<<2,c="mp4a.40."+u,d=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350][s];let f=s;5!==u&&29!==u||(f-=3);const p=[u<<3|(14&f)>>1,(1&f)<<7|h<<3];return C.log(`manifest codec:${i}, parsed codec:${c}, channels:${h}, rate:${d} (ADTS object type:${u} sampling index:${s})`),{config:p,samplerate:d,channelCount:h,codec:c,parsedCodec:c,manifestCodec:i}}(e,n,i,r);if(!s)return;y(t,s)}}function qi(t){return 9216e4/t}function Qi(t,e,n,i,r){const s=i+r*qi(t.samplerate),a=function(t,e){const n=Zi(t,e);if(e+n<=t.length){const i=zi(t,e)-n;if(i>0)return{headerLength:n,frameLength:i}}}(e,n);let o;if(a){const{frameLength:i,headerLength:r}=a,l=r+i,u=Math.max(0,n+l-e.length);u?(o=new Uint8Array(l-r),o.set(e.subarray(n+r,e.length),0)):o=e.subarray(n+r,n+l);const h={unit:o,pts:s};return u||t.samples.push(h),{sample:h,length:l,missing:u}}const l=e.length-n;o=new Uint8Array(l),o.set(e.subarray(n,e.length),0);return{sample:{unit:o,pts:s},length:l,missing:-1}}function Xi(t,e){return Gi(t,e)&&Ki(t,e+6)+10<=t.length-e}function Ji(t,e=0,n=1/0){return function(t,e,n,i){const r=function(t){return t instanceof ArrayBuffer?t:t.buffer}(t);let s=1;"BYTES_PER_ELEMENT"in i&&(s=i.BYTES_PER_ELEMENT);const a=(c=t,c&&c.buffer instanceof ArrayBuffer&&void 0!==c.byteLength&&void 0!==c.byteOffset?t.byteOffset:0),o=(a+t.byteLength)/s,l=(a+e)/s,u=Math.floor(Math.max(0,Math.min(l,o))),h=Math.floor(Math.min(u+Math.max(n,0),o));var c;return new i(r,u,h-u)}(t,e,n,Uint8Array)}function tr(t){const e={key:t.type,description:"",data:"",mimeType:null,pictureType:null};if(t.size<2)return;if(3!==t.data[0])return void console.log("Ignore frame with unrecognized character encoding");const n=t.data.subarray(1).indexOf(0);if(-1===n)return;const i=L(Ji(t.data,1,n)),r=t.data[2+n],s=t.data.subarray(3+n).indexOf(0);if(-1===s)return;const a=L(Ji(t.data,3+n,s));let o;return o="--\x3e"===i?L(Ji(t.data,4+n+s)):function(t){return t instanceof ArrayBuffer?t:0==t.byteOffset&&t.byteLength==t.buffer.byteLength?t.buffer:new Uint8Array(t).buffer}(t.data.subarray(4+n+s)),e.mimeType=i,e.pictureType=r,e.description=a,e.data=o,e}function er(t){return"PRIV"===t.type?function(t){if(t.size<2)return;const e=L(t.data,!0),n=new Uint8Array(t.data.subarray(e.length+1));return{key:t.type,info:e,data:n.buffer}}(t):"W"===t.type[0]?function(t){if("WXXX"===t.type){if(t.size<2)return;let e=1;const n=L(t.data.subarray(e),!0);e+=n.length+1;const i=L(t.data.subarray(e));return{key:t.type,info:n,data:i}}const e=L(t.data);return{key:t.type,info:"",data:e}}(t):"APIC"===t.type?tr(t):function(t){if(t.size<2)return;if("TXXX"===t.type){let e=1;const n=L(t.data.subarray(e),!0);e+=n.length+1;const i=L(t.data.subarray(e));return{key:t.type,info:n,data:i}}const e=L(t.data.subarray(1));return{key:t.type,info:"",data:e}}(t)}function nr(t){const e=String.fromCharCode(t[0],t[1],t[2],t[3]),n=Ki(t,4);return{type:e,size:n,data:t.subarray(10,10+n)}}function ir(t){let e=0;const n=[];for(;Gi(t,e);){const i=Ki(t,e+6);t[e+5]>>6&1&&(e+=10),e+=10;const r=e+i;for(;e+10<r;){const i=nr(t.subarray(e)),r=er(i);r&&n.push(r),e+=i.size+10}$i(t,e)&&(e+=10)}return n}function rr(t){return t&&"PRIV"===t.key&&"com.apple.streaming.transportStreamTimestamp"===t.info}function sr(t){if(8===t.data.byteLength){const e=new Uint8Array(t.data),n=1&e[3];let i=(e[4]<<23)+(e[5]<<15)+(e[6]<<7)+e[7];return i/=45,n&&(i+=47721858.84),Math.round(i)}}function ar(t){const e=ir(t);for(let t=0;t<e.length;t++){const n=e[t];if(rr(n))return sr(n)}}let or=function(t){return t.audioId3="org.id3",t.dateRange="com.apple.quicktime.HLS",t.emsg="https://aomedia.org/emsg/ID3",t.misbklv="urn:misb:KLV:bin:1910.1",t}({});function lr(t="",e=9e4){return{type:t,id:-1,pid:-1,inputTimeScale:e,sequenceNumber:-1,samples:[],dropped:0}}class ur{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(t,e,n,i){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}}resetTimeStamp(t){this.initPTS=t,this.resetContiguity()}resetContiguity(){this.basePTS=null,this.lastPTS=null,this.frameIndex=0}canParse(t,e){return!1}appendFrame(t,e,n){}demux(t,e){this.cachedData&&(t=gt(this.cachedData,t),this.cachedData=null);let n,r=ji(t,0),s=r?r.length:0;const a=this._audioTrack,o=this._id3Track,l=r?ar(r):void 0,u=t.length;for((null===this.basePTS||0===this.frameIndex&&i(l))&&(this.basePTS=hr(l,e,this.initPTS),this.lastPTS=this.basePTS),null===this.lastPTS&&(this.lastPTS=this.basePTS),r&&r.length>0&&o.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:r,type:or.audioId3,duration:Number.POSITIVE_INFINITY});s<u;){if(this.canParse(t,s)){const e=this.appendFrame(a,t,s);e?(this.frameIndex++,this.lastPTS=e.sample.pts,s+=e.length,n=s):s=u}else Xi(t,s)?(r=ji(t,s),o.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:r,type:or.audioId3,duration:Number.POSITIVE_INFINITY}),s+=r.length,n=s):s++;if(s===u&&n!==u){const e=t.slice(n);this.cachedData?this.cachedData=gt(this.cachedData,e):this.cachedData=e}}return{audioTrack:a,videoTrack:lr(),id3Track:o,textTrack:lr()}}demuxSampleAes(t,e,n){return Promise.reject(new Error(`[${this}] This demuxer does not support Sample-AES decryption`))}flush(t){const e=this.cachedData;return e&&(this.cachedData=null,this.demux(e,0)),{audioTrack:this._audioTrack,videoTrack:lr(),id3Track:this._id3Track,textTrack:lr()}}destroy(){this.cachedData=null,this._audioTrack=this._id3Track=void 0}}const hr=(t,e,n)=>{if(i(t))return 90*t;return 9e4*e+(n?9e4*n.baseTime/n.timescale:0)};let cr=null;const dr=[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],fr=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],pr=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],gr=[0,1,1,4];function _r(t,e,n,i,r){if(n+24>e.length)return;const s=mr(e,n);if(s&&n+s.frameLength<=e.length){const a=i+r*(9e4*s.samplesPerFrame/s.sampleRate),o={unit:e.subarray(n,n+s.frameLength),pts:a,dts:a};return t.config=[],t.channelCount=s.channelCount,t.samplerate=s.sampleRate,t.samples.push(o),{sample:o,length:s.frameLength,missing:0}}}function mr(t,e){const n=t[e+1]>>3&3,i=t[e+1]>>1&3,r=t[e+2]>>4&15,s=t[e+2]>>2&3;if(1!==n&&0!==r&&15!==r&&3!==s){const a=t[e+2]>>1&1,o=t[e+3]>>6,l=1e3*dr[14*(3===n?3-i:3===i?3:4)+r-1],u=fr[3*(3===n?0:2===n?1:2)+s],h=3===o?1:2,c=pr[n][i],d=gr[i],f=8*c*d,p=Math.floor(c*l/u+a)*d;if(null===cr){const t=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);cr=t?parseInt(t[1]):0}return!!cr&&cr<=87&&2===i&&l>=224e3&&0===o&&(t[e+3]=128|t[e+3]),{sampleRate:u,channelCount:h,frameLength:p,samplesPerFrame:f}}}function vr(t,e){return 255===t[e]&&224==(224&t[e+1])&&0!=(6&t[e+1])}function yr(t,e){return e+1<t.length&&vr(t,e)}function br(t,e){if(e+1<t.length&&vr(t,e)){const n=4,i=mr(t,e);let r=n;null!=i&&i.frameLength&&(r=i.frameLength);const s=e+r;return s===t.length||yr(t,s)}return!1}const Er=(t,e)=>{let n=0,i=5;e+=i;const r=new Uint32Array(1),s=new Uint32Array(1),a=new Uint8Array(1);for(;i>0;){a[0]=t[e];const o=Math.min(i,8),l=8-o;s[0]=4278190080>>>24+l<<l,r[0]=(a[0]&s[0])>>l,n=n?n<<o|r[0]:r[0],e+=1,i-=o}return n};class wr extends ur{constructor(t){super(),this.observer=void 0,this.observer=t}resetInitSegment(t,e,n,i){super.resetInitSegment(t,e,n,i),this._audioTrack={container:"audio/ac-3",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"ac3",samples:[],manifestCodec:e,duration:i,inputTimeScale:9e4,dropped:0}}canParse(t,e){return e+64<t.length}appendFrame(t,e,n){const i=Tr(t,e,n,this.basePTS,this.frameIndex);if(-1!==i){return{sample:t.samples[t.samples.length-1],length:i,missing:0}}}static probe(t){if(!t)return!1;const e=ji(t,0);if(!e)return!1;const n=e.length;return 11===t[n]&&119===t[n+1]&&void 0!==ar(e)&&Er(t,n)<16}}function Tr(t,e,n,i,r){if(n+8>e.length)return-1;if(11!==e[n]||119!==e[n+1])return-1;const s=e[n+4]>>6;if(s>=3)return-1;const a=[48e3,44100,32e3][s],o=63&e[n+4],l=2*[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][3*o+s];if(n+l>e.length)return-1;const u=e[n+6]>>5;let h=0;2===u?h+=2:(1&u&&1!==u&&(h+=2),4&u&&(h+=2));const c=(e[n+6]<<8|e[n+7])>>12-h&1,d=[2,1,2,3,3,4,4,5][u]+c,f=e[n+5]>>3,p=7&e[n+5],g=new Uint8Array([s<<6|f<<1|p>>2,(3&p)<<6|u<<3|c<<2|o>>4,o<<4&224]),_=i+r*(1536/a*9e4),m=e.subarray(n,n+l);return t.config=g,t.channelCount=d,t.samplerate=a,t.samples.push({unit:m,pts:_}),l}const kr=/\/emsg[-/]ID3/i;function Sr(t,e){return i(t.presentationTime)?t.presentationTime/t.timeScale:e+t.presentationTimeDelta/t.timeScale}class Ar{constructor(t,e,n){this.keyData=void 0,this.decrypter=void 0,this.keyData=n,this.decrypter=new ze(e,{removePKCS7Padding:!1})}decryptBuffer(t){return this.decrypter.decrypt(t,this.keyData.key.buffer,this.keyData.iv.buffer,Ge)}decryptAacSample(t,e,n){const i=t[e].unit;if(i.length<=16)return;const r=i.subarray(16,i.length-i.length%16),s=r.buffer.slice(r.byteOffset,r.byteOffset+r.length);this.decryptBuffer(s).then((r=>{const s=new Uint8Array(r);i.set(s,16),this.decrypter.isSync()||this.decryptAacSamples(t,e+1,n)})).catch(n)}decryptAacSamples(t,e,n){for(;;e++){if(e>=t.length)return void n();if(!(t[e].unit.length<32)&&(this.decryptAacSample(t,e,n),!this.decrypter.isSync()))return}}getAvcEncryptedData(t){const e=16*Math.floor((t.length-48)/160)+16,n=new Int8Array(e);let i=0;for(let e=32;e<t.length-16;e+=160,i+=16)n.set(t.subarray(e,e+16),i);return n}getAvcDecryptedUnit(t,e){const n=new Uint8Array(e);let i=0;for(let e=32;e<t.length-16;e+=160,i+=16)t.set(n.subarray(i,i+16),e);return t}decryptAvcSample(t,e,n,i,r){const s=bt(r.data),a=this.getAvcEncryptedData(s);this.decryptBuffer(a.buffer).then((a=>{r.data=this.getAvcDecryptedUnit(s,a),this.decrypter.isSync()||this.decryptAvcSamples(t,e,n+1,i)})).catch(i)}decryptAvcSamples(t,e,n,i){if(t instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;e++,n=0){if(e>=t.length)return void i();const r=t[e].units;for(;!(n>=r.length);n++){const s=r[n];if(!(s.data.length<=48||1!==s.type&&5!==s.type||(this.decryptAvcSample(t,e,n,i,s),this.decrypter.isSync())))return}}}}class Dr{constructor(){this.VideoSample=null}createVideoSample(t,e,n){return{key:t,frame:!1,pts:e,dts:n,units:[],length:0}}getLastNalUnit(t){var e;let n,i=this.VideoSample;if(i&&0!==i.units.length||(i=t[t.length-1]),null!=(e=i)&&e.units){const t=i.units;n=t[t.length-1]}return n}pushAccessUnit(t,e){if(t.units.length&&t.frame){if(void 0===t.pts){const n=e.samples,i=n.length;if(!i)return void e.dropped++;{const e=n[i-1];t.pts=e.pts,t.dts=e.dts}}e.samples.push(t)}}parseNALu(t,e,n){const i=e.byteLength;let r=t.naluState||0;const s=r,a=[];let o,l,u,h=0,c=-1,d=0;for(-1===r&&(c=0,d=this.getNALuType(e,0),r=0,h=1);h<i;)if(o=e[h++],r)if(1!==r)if(o)if(1===o){if(l=h-r-1,c>=0){const t={data:e.subarray(c,l),type:d};a.push(t)}else{const n=this.getLastNalUnit(t.samples);n&&(s&&h<=4-s&&n.state&&(n.data=n.data.subarray(0,n.data.byteLength-s)),l>0&&(n.data=gt(n.data,e.subarray(0,l)),n.state=0))}h<i?(u=this.getNALuType(e,h),c=h,d=u,r=0):r=-1}else r=0;else r=3;else r=o?0:2;else r=o?0:1;if(c>=0&&r>=0){const t={data:e.subarray(c,i),type:d,state:r};a.push(t)}if(0===a.length){const n=this.getLastNalUnit(t.samples);n&&(n.data=gt(n.data,e))}return t.naluState=r,a}}class Cr{constructor(t){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=t,this.bytesAvailable=t.byteLength,this.word=0,this.bitsAvailable=0}loadWord(){const t=this.data,e=this.bytesAvailable,n=t.byteLength-e,i=new Uint8Array(4),r=Math.min(4,e);if(0===r)throw new Error("no bytes available");i.set(t.subarray(n,n+r)),this.word=new DataView(i.buffer).getUint32(0),this.bitsAvailable=8*r,this.bytesAvailable-=r}skipBits(t){let e;t=Math.min(t,8*this.bytesAvailable+this.bitsAvailable),this.bitsAvailable>t?(this.word<<=t,this.bitsAvailable-=t):(e=(t-=this.bitsAvailable)>>3,t-=e<<3,this.bytesAvailable-=e,this.loadWord(),this.word<<=t,this.bitsAvailable-=t)}readBits(t){let e=Math.min(this.bitsAvailable,t);const n=this.word>>>32-e;if(t>32&&C.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=e,this.bitsAvailable>0)this.word<<=e;else{if(!(this.bytesAvailable>0))throw new Error("no bits available");this.loadWord()}return e=t-e,e>0&&this.bitsAvailable?n<<e|this.readBits(e):n}skipLZ(){let t;for(t=0;t<this.bitsAvailable;++t)if(0!=(this.word&2147483648>>>t))return this.word<<=t,this.bitsAvailable-=t,t;return this.loadWord(),t+this.skipLZ()}skipUEG(){this.skipBits(1+this.skipLZ())}skipEG(){this.skipBits(1+this.skipLZ())}readUEG(){const t=this.skipLZ();return this.readBits(t+1)-1}readEG(){const t=this.readUEG();return 1&t?1+t>>>1:-1*(t>>>1)}readBoolean(){return 1===this.readBits(1)}readUByte(){return this.readBits(8)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}}class xr extends Dr{parsePES(t,e,n,i){const r=this.parseNALu(t,n.data,i);let s,a=this.VideoSample,o=!1;n.data=null,a&&r.length&&!t.audFound&&(this.pushAccessUnit(a,t),a=this.VideoSample=this.createVideoSample(!1,n.pts,n.dts)),r.forEach((i=>{var r,l;switch(i.type){case 1:{let e=!1;s=!0;const r=i.data;if(o&&r.length>4){const t=this.readSliceType(r);2!==t&&4!==t&&7!==t&&9!==t||(e=!0)}var u;if(e)null!=(u=a)&&u.frame&&!a.key&&(this.pushAccessUnit(a,t),a=this.VideoSample=null);a||(a=this.VideoSample=this.createVideoSample(!0,n.pts,n.dts)),a.frame=!0,a.key=e;break}case 5:s=!0,null!=(r=a)&&r.frame&&!a.key&&(this.pushAccessUnit(a,t),a=this.VideoSample=null),a||(a=this.VideoSample=this.createVideoSample(!0,n.pts,n.dts)),a.key=!0,a.frame=!0;break;case 6:s=!0,yt(i.data,1,n.pts,e.samples);break;case 7:{var h,c;s=!0,o=!0;const e=i.data,n=this.readSPS(e);if(!t.sps||t.width!==n.width||t.height!==n.height||(null==(h=t.pixelRatio)?void 0:h[0])!==n.pixelRatio[0]||(null==(c=t.pixelRatio)?void 0:c[1])!==n.pixelRatio[1]){t.width=n.width,t.height=n.height,t.pixelRatio=n.pixelRatio,t.sps=[e];const i=e.subarray(1,4);let r="avc1.";for(let t=0;t<3;t++){let e=i[t].toString(16);e.length<2&&(e="0"+e),r+=e}t.codec=r}break}case 8:s=!0,t.pps=[i.data];break;case 9:s=!0,t.audFound=!0,null!=(l=a)&&l.frame&&(this.pushAccessUnit(a,t),a=null),a||(a=this.VideoSample=this.createVideoSample(!1,n.pts,n.dts));break;case 12:s=!0;break;default:s=!1}if(a&&s){a.units.push(i)}})),i&&a&&(this.pushAccessUnit(a,t),this.VideoSample=null)}getNALuType(t,e){return 31&t[e]}readSliceType(t){const e=new Cr(t);return e.readUByte(),e.readUEG(),e.readUEG()}skipScalingList(t,e){let n,i=8,r=8;for(let s=0;s<t;s++)0!==r&&(n=e.readEG(),r=(i+n+256)%256),i=0===r?i:r}readSPS(t){const e=new Cr(t);let n,i,r,s=0,a=0,o=0,l=0;const u=e.readUByte.bind(e),h=e.readBits.bind(e),c=e.readUEG.bind(e),d=e.readBoolean.bind(e),f=e.skipBits.bind(e),p=e.skipEG.bind(e),g=e.skipUEG.bind(e),_=this.skipScalingList.bind(this);u();const m=u();if(h(5),f(3),u(),g(),100===m||110===m||122===m||244===m||44===m||83===m||86===m||118===m||128===m){const t=c();if(3===t&&f(1),g(),g(),f(1),d())for(i=3!==t?8:12,r=0;r<i;r++)d()&&_(r<6?16:64,e)}g();const v=c();if(0===v)c();else if(1===v)for(f(1),p(),p(),n=c(),r=0;r<n;r++)p();g(),f(1);const y=c(),b=c(),E=h(1);0===E&&f(1),f(1),d()&&(s=c(),a=c(),o=c(),l=c());let w=[1,1];if(d()&&d()){switch(u()){case 1:w=[1,1];break;case 2:w=[12,11];break;case 3:w=[10,11];break;case 4:w=[16,11];break;case 5:w=[40,33];break;case 6:w=[24,11];break;case 7:w=[20,11];break;case 8:w=[32,11];break;case 9:w=[80,33];break;case 10:w=[18,11];break;case 11:w=[15,11];break;case 12:w=[64,33];break;case 13:w=[160,99];break;case 14:w=[4,3];break;case 15:w=[3,2];break;case 16:w=[2,1];break;case 255:w=[u()<<8|u(),u()<<8|u()]}}return{width:Math.ceil(16*(y+1)-2*s-2*a),height:(2-E)*(b+1)*16-(E?2:4)*(o+l),pixelRatio:w}}}class Rr extends Dr{constructor(...t){super(...t),this.initVPS=null}parsePES(t,e,n,i){const r=this.parseNALu(t,n.data,i);let s,a=this.VideoSample,o=!1;n.data=null,a&&r.length&&!t.audFound&&(this.pushAccessUnit(a,t),a=this.VideoSample=this.createVideoSample(!1,n.pts,n.dts)),r.forEach((i=>{var r,l;switch(i.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,n.pts,n.dts)),a.frame=!0,s=!0;break;case 16:case 17:case 18:case 21:var u;if(s=!0,o)null!=(u=a)&&u.frame&&!a.key&&(this.pushAccessUnit(a,t),a=this.VideoSample=null);a||(a=this.VideoSample=this.createVideoSample(!0,n.pts,n.dts)),a.key=!0,a.frame=!0;break;case 19:case 20:s=!0,null!=(r=a)&&r.frame&&!a.key&&(this.pushAccessUnit(a,t),a=this.VideoSample=null),a||(a=this.VideoSample=this.createVideoSample(!0,n.pts,n.dts)),a.key=!0,a.frame=!0;break;case 39:s=!0,yt(i.data,2,n.pts,e.samples);break;case 32:s=!0,t.vps||("object"!=typeof t.params&&(t.params={}),t.params=y(t.params,this.readVPS(i.data)),this.initVPS=i.data),t.vps=[i.data];break;case 33:if(s=!0,o=!0,void 0===t.vps||t.vps[0]===this.initVPS||void 0===t.sps||this.matchSPS(t.sps[0],i.data)||(this.initVPS=t.vps[0],t.sps=t.pps=void 0),!t.sps){const e=this.readSPS(i.data);t.width=e.width,t.height=e.height,t.pixelRatio=e.pixelRatio,t.codec=e.codecString,t.sps=[],"object"!=typeof t.params&&(t.params={});for(const n in e.params)t.params[n]=e.params[n]}this.pushParameterSet(t.sps,i.data,t.vps),a||(a=this.VideoSample=this.createVideoSample(!0,n.pts,n.dts)),a.key=!0;break;case 34:if(s=!0,"object"==typeof t.params){if(!t.pps){t.pps=[];const e=this.readPPS(i.data);for(const n in e)t.params[n]=e[n]}this.pushParameterSet(t.pps,i.data,t.vps)}break;case 35:s=!0,t.audFound=!0,null!=(l=a)&&l.frame&&(this.pushAccessUnit(a,t),a=null),a||(a=this.VideoSample=this.createVideoSample(!1,n.pts,n.dts));break;default:s=!1}if(a&&s){a.units.push(i)}})),i&&a&&(this.pushAccessUnit(a,t),this.VideoSample=null)}pushParameterSet(t,e,n){(n&&n[0]===this.initVPS||!n&&!t.length)&&t.push(e)}getNALuType(t,e){return(126&t[e])>>>1}ebsp2rbsp(t){const e=new Uint8Array(t.byteLength);let n=0;for(let i=0;i<t.byteLength;i++)i>=2&&3===t[i]&&0===t[i-1]&&0===t[i-2]||(e[n]=t[i],n++);return new Uint8Array(e.buffer,0,n)}pushAccessUnit(t,e){super.pushAccessUnit(t,e),this.initVPS&&(this.initVPS=null)}readVPS(t){const e=new Cr(t);e.readUByte(),e.readUByte(),e.readBits(4),e.skipBits(2),e.readBits(6);return{numTemporalLayers:e.readBits(3)+1,temporalIdNested:e.readBoolean()}}readSPS(t){const e=new Cr(this.ebsp2rbsp(t));e.readUByte(),e.readUByte(),e.readBits(4);const n=e.readBits(3);e.readBoolean();const i=e.readBits(2),r=e.readBoolean(),s=e.readBits(5),a=e.readUByte(),o=e.readUByte(),l=e.readUByte(),u=e.readUByte(),h=e.readUByte(),c=e.readUByte(),d=e.readUByte(),f=e.readUByte(),p=e.readUByte(),g=e.readUByte(),_=e.readUByte(),m=[],v=[];for(let t=0;t<n;t++)m.push(e.readBoolean()),v.push(e.readBoolean());if(n>0)for(let t=n;t<8;t++)e.readBits(2);for(let t=0;t<n;t++)m[t]&&(e.readUByte(),e.readUByte(),e.readUByte(),e.readUByte(),e.readUByte(),e.readUByte(),e.readUByte(),e.readUByte(),e.readUByte(),e.readUByte(),e.readUByte()),v[t]&&e.readUByte();e.readUEG();const y=e.readUEG();3==y&&e.skipBits(1);const b=e.readUEG(),E=e.readUEG(),w=e.readBoolean();let T=0,k=0,S=0,A=0;w&&(T+=e.readUEG(),k+=e.readUEG(),S+=e.readUEG(),A+=e.readUEG());const D=e.readUEG(),C=e.readUEG(),x=e.readUEG();for(let t=e.readBoolean()?0:n;t<=n;t++)e.skipUEG(),e.skipUEG(),e.skipUEG();e.skipUEG(),e.skipUEG(),e.skipUEG(),e.skipUEG(),e.skipUEG(),e.skipUEG();if(e.readBoolean()){if(e.readBoolean())for(let t=0;t<4;t++)for(let n=0;n<(3===t?2:6);n++){if(e.readBoolean()){const n=Math.min(64,1<<4+(t<<1));t>1&&e.readEG();for(let t=0;t<n;t++)e.readEG()}else e.readUEG()}}e.readBoolean(),e.readBoolean();e.readBoolean()&&(e.readUByte(),e.skipUEG(),e.skipUEG(),e.readBoolean());const R=e.readUEG();let L=0;for(let t=0;t<R;t++){let n=!1;if(0!==t&&(n=e.readBoolean()),n){t===R&&e.readUEG(),e.readBoolean(),e.readUEG();let n=0;for(let t=0;t<=L;t++){const t=e.readBoolean();let i=!1;t||(i=e.readBoolean()),(t||i)&&n++}L=n}else{const t=e.readUEG(),n=e.readUEG();L=t+n;for(let n=0;n<t;n++)e.readUEG(),e.readBoolean();for(let t=0;t<n;t++)e.readUEG(),e.readBoolean()}}if(e.readBoolean()){const t=e.readUEG();for(let n=0;n<t;n++){for(let t=0;t<x+4;t++)e.readBits(1);e.readBits(1)}}let I=0,P=1,O=1,F=!0,M=1,N=0;e.readBoolean(),e.readBoolean();let B=!1;if(e.readBoolean()){if(e.readBoolean()){const t=e.readUByte();t>0&&t<16?(P=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2][t-1],O=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1][t-1]):255===t&&(P=e.readBits(16),O=e.readBits(16))}e.readBoolean()&&e.readBoolean();if(e.readBoolean()){e.readBits(3),e.readBoolean();e.readBoolean()&&(e.readUByte(),e.readUByte(),e.readUByte())}e.readBoolean()&&(e.readUEG(),e.readUEG()),e.readBoolean(),e.readBoolean(),e.readBoolean(),B=e.readBoolean(),B&&(e.skipUEG(),e.skipUEG(),e.skipUEG(),e.skipUEG());if(e.readBoolean()){M=e.readBits(32),N=e.readBits(32);e.readBoolean()&&e.readUEG();if(e.readBoolean()){const t=e.readBoolean(),i=e.readBoolean();let r=!1;(t||i)&&(r=e.readBoolean(),r&&(e.readUByte(),e.readBits(5),e.readBoolean(),e.readBits(5)),e.readBits(4),e.readBits(4),r&&e.readBits(4),e.readBits(5),e.readBits(5),e.readBits(5));for(let s=0;s<=n;s++){F=e.readBoolean();let n=!1;F||e.readBoolean()?e.readEG():n=e.readBoolean();const s=n?1:e.readUEG()+1;if(t)for(let t=0;t<s;t++)e.readUEG(),e.readUEG(),r&&(e.readUEG(),e.readUEG()),e.skipBits(1);if(i)for(let t=0;t<s;t++)e.readUEG(),e.readUEG(),r&&(e.readUEG(),e.readUEG()),e.skipBits(1)}}}e.readBoolean()&&(e.readBoolean(),e.readBoolean(),e.readBoolean(),I=e.readUEG())}let U=b,$=E;if(w){let t=1,e=1;1===y?t=e=2:2==y&&(t=2),U=b-t*k-t*T,$=E-e*A-e*S}const G=i?["A","B","C"][i]:"",K=a<<24|o<<16|l<<8|u;let j=0;for(let t=0;t<32;t++)j=(j|(K>>t&1)<<31-t)>>>0;let V=j.toString(16);1===s&&"2"===V&&(V="6");return{codecString:`hvc1.${G}${s}.${V}.${r?"H":"L"}${_}.B0`,params:{general_tier_flag:r,general_profile_idc:s,general_profile_space:i,general_profile_compatibility_flags:[a,o,l,u],general_constraint_indicator_flags:[h,c,d,f,p,g],general_level_idc:_,bit_depth:D+8,bit_depth_luma_minus8:D,bit_depth_chroma_minus8:C,min_spatial_segmentation_idc:I,chroma_format_idc:y,frame_rate:{fixed:F,fps:N/M}},width:U,height:$,pixelRatio:[P,O]}}readPPS(t){const e=new Cr(this.ebsp2rbsp(t));e.readUByte(),e.readUByte(),e.skipUEG(),e.skipUEG(),e.skipBits(2),e.skipBits(3),e.skipBits(2),e.skipUEG(),e.skipUEG(),e.skipEG(),e.skipBits(2);e.readBoolean()&&e.skipUEG(),e.skipEG(),e.skipEG(),e.skipBits(4);const n=e.readBoolean(),i=e.readBoolean();let r=1;return i&&n?r=0:i?r=3:n&&(r=2),{parallelismType:r}}matchSPS(t,e){return String.fromCharCode.apply(null,t).substr(3)===String.fromCharCode.apply(null,e).substr(3)}}const Lr=188;class Ir{constructor(t,e,n,i){this.logger=void 0,this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._pmtId=-1,this._videoTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.remainderData=null,this.videoParser=void 0,this.observer=t,this.config=e,this.typeSupported=n,this.logger=i,this.videoParser=null}static probe(t,e){const n=Ir.syncOffset(t);return n>0&&e.warn(`MPEG2-TS detected but first sync word found @ offset ${n}`),-1!==n}static syncOffset(t){const e=t.length;let n=Math.min(940,e-Lr)+1,i=0;for(;i<n;){let r=!1,s=-1,a=0;for(let o=i;o<e;o+=Lr){if(71!==t[o]||e-o!==Lr&&71!==t[o+Lr]){if(a)return-1;break}if(a++,-1===s&&(s=o,0!==s&&(n=Math.min(s+18612,t.length-Lr)+1)),r||(r=0===Pr(t,o)),r&&a>1&&(0===s&&a>2||o+Lr>n))return s}i++}return-1}static createTrack(t,e){return{container:"video"===t||"audio"===t?"video/mp2t":void 0,type:t,id:tt[t],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:"audio"===t?e:void 0}}resetInitSegment(t,e,n,i){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=Ir.createTrack("video"),this._videoTrack.duration=i,this._audioTrack=Ir.createTrack("audio",i),this._id3Track=Ir.createTrack("id3"),this._txtTrack=Ir.createTrack("text"),this._audioTrack.segmentCodec="aac",this.videoParser=null,this.aacOverFlow=null,this.remainderData=null,this.audioCodec=e,this.videoCodec=n}resetTimeStamp(){}resetContiguity(){const{_audioTrack:t,_videoTrack:e,_id3Track:n}=this;t&&(t.pesData=null),e&&(e.pesData=null),n&&(n.pesData=null),this.aacOverFlow=null,this.remainderData=null}demux(t,e,n=!1,i=!1){let r;n||(this.sampleAes=null);const s=this._videoTrack,a=this._audioTrack,o=this._id3Track,l=this._txtTrack;let u=s.pid,h=s.pesData,c=a.pid,d=o.pid,f=a.pesData,p=o.pesData,g=null,_=this.pmtParsed,m=this._pmtId,v=t.length;if(this.remainderData&&(v=(t=gt(this.remainderData,t)).length,this.remainderData=null),v<Lr&&!i)return this.remainderData=t,{audioTrack:a,videoTrack:s,id3Track:o,textTrack:l};const y=Math.max(0,Ir.syncOffset(t));v-=(v-y)%Lr,v<t.byteLength&&!i&&(this.remainderData=new Uint8Array(t.buffer,v,t.buffer.byteLength-v));let b=0;for(let e=y;e<v;e+=Lr)if(71===t[e]){const i=!!(64&t[e+1]),v=Pr(t,e);let b;if((48&t[e+3])>>4>1){if(b=e+5+t[e+4],b===e+Lr)continue}else b=e+4;switch(v){case u:i&&(h&&(r=Br(h,this.logger))&&(this.readyVideoParser(s.segmentCodec),null!==this.videoParser&&this.videoParser.parsePES(s,l,r,!1)),h={data:[],size:0}),h&&(h.data.push(t.subarray(b,e+Lr)),h.size+=e+Lr-b);break;case c:if(i){if(f&&(r=Br(f,this.logger)))switch(a.segmentCodec){case"aac":this.parseAACPES(a,r);break;case"mp3":this.parseMPEGPES(a,r);break;case"ac3":this.parseAC3PES(a,r)}f={data:[],size:0}}f&&(f.data.push(t.subarray(b,e+Lr)),f.size+=e+Lr-b);break;case d:i&&(p&&(r=Br(p,this.logger))&&this.parseID3PES(o,r),p={data:[],size:0}),p&&(p.data.push(t.subarray(b,e+Lr)),p.size+=e+Lr-b);break;case 0:i&&(b+=t[b]+1),m=this._pmtId=Or(t,b);break;case m:{i&&(b+=t[b]+1);const r=Fr(t,b,this.typeSupported,n,this.observer,this.logger);u=r.videoPid,u>0&&(s.pid=u,s.segmentCodec=r.segmentVideoCodec),c=r.audioPid,c>0&&(a.pid=c,a.segmentCodec=r.segmentAudioCodec),d=r.id3Pid,d>0&&(o.pid=d),null===g||_||(this.logger.warn(`MPEG-TS PMT found at ${e} after unknown PID '${g}'. Backtracking to sync byte @${y} to parse all TS packets.`),g=null,e=y-188),_=this.pmtParsed=!0;break}case 17:case 8191:break;default:g=v}}else b++;b>0&&Mr(this.observer,new Error(`Found ${b} TS packet/s that do not start with 0x47`),void 0,this.logger),s.pesData=h,a.pesData=f,o.pesData=p;const E={audioTrack:a,videoTrack:s,id3Track:o,textTrack:l};return i&&this.extractRemainingSamples(E),E}flush(){const{remainderData:t}=this;let e;return this.remainderData=null,e=t?this.demux(t,-1,!1,!0):{videoTrack:this._videoTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(e),this.sampleAes?this.decrypt(e,this.sampleAes):e}extractRemainingSamples(t){const{audioTrack:e,videoTrack:n,id3Track:i,textTrack:r}=t,s=n.pesData,a=e.pesData,o=i.pesData;let l;if(s&&(l=Br(s,this.logger))?(this.readyVideoParser(n.segmentCodec),null!==this.videoParser&&(this.videoParser.parsePES(n,r,l,!0),n.pesData=null)):n.pesData=s,a&&(l=Br(a,this.logger))){switch(e.segmentCodec){case"aac":this.parseAACPES(e,l);break;case"mp3":this.parseMPEGPES(e,l);break;case"ac3":this.parseAC3PES(e,l)}e.pesData=null}else null!=a&&a.size&&this.logger.log("last AAC PES packet truncated,might overlap between fragments"),e.pesData=a;o&&(l=Br(o,this.logger))?(this.parseID3PES(i,l),i.pesData=null):i.pesData=o}demuxSampleAes(t,e,n){const i=this.demux(t,n,!0,!this.config.progressive),r=this.sampleAes=new Ar(this.observer,this.config,e);return this.decrypt(i,r)}readyVideoParser(t){null===this.videoParser&&("avc"===t?this.videoParser=new xr:"hevc"===t&&(this.videoParser=new Rr))}decrypt(t,e){return new Promise((n=>{const{audioTrack:i,videoTrack:r}=t;i.samples&&"aac"===i.segmentCodec?e.decryptAacSamples(i.samples,0,(()=>{r.samples?e.decryptAvcSamples(r.samples,0,0,(()=>{n(t)})):n(t)})):r.samples&&e.decryptAvcSamples(r.samples,0,0,(()=>{n(t)}))}))}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(t,e){let n=0;const i=this.aacOverFlow;let r,s,a,o=e.data;if(i){this.aacOverFlow=null;const e=i.missing,r=i.sample.unit.byteLength;if(-1===e)o=gt(i.sample.unit,o);else{const s=r-e;i.sample.unit.set(o.subarray(0,e),s),t.samples.push(i.sample),n=i.missing}}for(r=n,s=o.length;r<s-1&&!Hi(o,r);r++);if(r!==n){let t;const e=r<s-1;if(t=e?`AAC PES did not start with ADTS header,offset:${r}`:"No ADTS header found in AAC PES",Mr(this.observer,new Error(t),e,this.logger),!e)return}if(Yi(t,this.observer,o,r,this.audioCodec),void 0!==e.pts)a=e.pts;else{if(!i)return void this.logger.warn("[tsdemuxer]: AAC PES unknown PTS");{const e=qi(t.samplerate);a=i.sample.pts+e}}let l,u=0;for(;r<s;){if(l=Qi(t,o,r,a,u),r+=l.length,l.missing){this.aacOverFlow=l;break}for(u++;r<s-1&&!Hi(o,r);r++);}}parseMPEGPES(t,e){const n=e.data,i=n.length;let r=0,s=0;const a=e.pts;if(void 0!==a)for(;s<i;)if(yr(n,s)){const e=_r(t,n,s,a,r);if(!e)break;s+=e.length,r++}else s++;else this.logger.warn("[tsdemuxer]: MPEG PES unknown PTS")}parseAC3PES(t,e){{const n=e.data,i=e.pts;if(void 0===i)return void this.logger.warn("[tsdemuxer]: AC3 PES unknown PTS");const r=n.length;let s,a=0,o=0;for(;o<r&&(s=Tr(t,n,o,i,a++))>0;)o+=s}}parseID3PES(t,e){if(void 0===e.pts)return void this.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");const n=y({},e,{type:this._videoTrack?or.emsg:or.audioId3,duration:Number.POSITIVE_INFINITY});t.samples.push(n)}}function Pr(t,e){return((31&t[e+1])<<8)+t[e+2]}function Or(t,e){return(31&t[e+10])<<8|t[e+11]}function Fr(t,e,n,i,r,s){const a={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},o=e+3+((15&t[e+1])<<8|t[e+2])-4;for(e+=12+((15&t[e+10])<<8|t[e+11]);e<o;){const o=Pr(t,e),l=(15&t[e+3])<<8|t[e+4];switch(t[e]){case 207:if(!i){Nr("ADTS AAC",s);break}case 15:-1===a.audioPid&&(a.audioPid=o);break;case 21:-1===a.id3Pid&&(a.id3Pid=o);break;case 219:if(!i){Nr("H.264",s);break}case 27:-1===a.videoPid&&(a.videoPid=o);break;case 3:case 4:n.mpeg||n.mp3?-1===a.audioPid&&(a.audioPid=o,a.segmentAudioCodec="mp3"):s.log("MPEG audio found, not supported in this browser");break;case 193:if(!i){Nr("AC-3",s);break}case 129:n.ac3?-1===a.audioPid&&(a.audioPid=o,a.segmentAudioCodec="ac3"):s.log("AC-3 audio found, not supported in this browser");break;case 6:if(-1===a.audioPid&&l>0){let i=e+5,r=l;for(;r>2;){if(106===t[i])!0!==n.ac3?s.log("AC-3 audio found, not supported in this browser for now"):(a.audioPid=o,a.segmentAudioCodec="ac3");const e=t[i+1]+2;i+=e,r-=e}}break;case 194:case 135:return Mr(r,new Error("Unsupported EC-3 in M2TS found"),void 0,s),a;case 36:-1===a.videoPid&&(a.videoPid=o,a.segmentVideoCodec="hevc",s.log("HEVC in M2TS found"))}e+=l+5}return a}function Mr(t,e,n,i){i.warn(`parsing error: ${e.message}`),t.emit(l.ERROR,l.ERROR,{type:a.MEDIA_ERROR,details:o.FRAG_PARSING_ERROR,fatal:!1,levelRetry:n,error:e,reason:e.message})}function Nr(t,e){e.log(`${t} with AES-128-CBC encryption found in unencrypted stream`)}function Br(t,e){let n,i,r,s,a,o=0;const l=t.data;if(!t||0===t.size)return null;for(;l[0].length<19&&l.length>1;)l[0]=gt(l[0],l[1]),l.splice(1,1);n=l[0];if(1===(n[0]<<16)+(n[1]<<8)+n[2]){if(i=(n[4]<<8)+n[5],i&&i>t.size-6)return null;const u=n[7];192&u&&(s=536870912*(14&n[9])+4194304*(255&n[10])+16384*(254&n[11])+128*(255&n[12])+(254&n[13])/2,64&u?(a=536870912*(14&n[14])+4194304*(255&n[15])+16384*(254&n[16])+128*(255&n[17])+(254&n[18])/2,s-a>54e5&&(e.warn(`${Math.round((s-a)/9e4)}s delta between PTS and DTS, align them`),s=a)):a=s),r=n[8];let h=r+9;if(t.size<=h)return null;t.size-=h;const c=new Uint8Array(t.size);for(let t=0,e=l.length;t<e;t++){n=l[t];let e=n.byteLength;if(h){if(h>e){h-=e;continue}n=n.subarray(h),e-=h,h=0}c.set(n,o),o+=e}return i&&(i-=r+3),{data:c,pts:s,dts:a,len:i}}return null}class Ur{static getSilentFrame(t,e){if("mp4a.40.2"===t){if(1===e)return new Uint8Array([0,200,0,128,35,128]);if(2===e)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(3===e)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(4===e)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(5===e)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(6===e)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])}else{if(1===e)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(2===e)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(3===e)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])}}}const $r=Math.pow(2,32)-1;class Gr{static init(){let t;for(t in Gr.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:[]},Gr.types)Gr.types.hasOwnProperty(t)&&(Gr.types[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)]);const e=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),n=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);Gr.HDLR_TYPES={video:e,audio:n};const i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),r=new Uint8Array([0,0,0,0,0,0,0,0]);Gr.STTS=Gr.STSC=Gr.STCO=r,Gr.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),Gr.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),Gr.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),Gr.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);const s=new Uint8Array([105,115,111,109]),a=new Uint8Array([97,118,99,49]),o=new Uint8Array([0,0,0,1]);Gr.FTYP=Gr.box(Gr.types.ftyp,s,o,s,a),Gr.DINF=Gr.box(Gr.types.dinf,Gr.box(Gr.types.dref,i))}static box(t,...e){let n=8,i=e.length;const r=i;for(;i--;)n+=e[i].byteLength;const s=new Uint8Array(n);for(s[0]=n>>24&255,s[1]=n>>16&255,s[2]=n>>8&255,s[3]=255&n,s.set(t,4),i=0,n=8;i<r;i++)s.set(e[i],n),n+=e[i].byteLength;return s}static hdlr(t){return Gr.box(Gr.types.hdlr,Gr.HDLR_TYPES[t])}static mdat(t){return Gr.box(Gr.types.mdat,t)}static mdhd(t,e){e*=t;const n=Math.floor(e/($r+1)),i=Math.floor(e%($r+1));return Gr.box(Gr.types.mdhd,new Uint8Array([1,0,0,0,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,255&t,n>>24,n>>16&255,n>>8&255,255&n,i>>24,i>>16&255,i>>8&255,255&i,85,196,0,0]))}static mdia(t){return Gr.box(Gr.types.mdia,Gr.mdhd(t.timescale||0,t.duration||0),Gr.hdlr(t.type),Gr.minf(t))}static mfhd(t){return Gr.box(Gr.types.mfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t]))}static minf(t){return"audio"===t.type?Gr.box(Gr.types.minf,Gr.box(Gr.types.smhd,Gr.SMHD),Gr.DINF,Gr.stbl(t)):Gr.box(Gr.types.minf,Gr.box(Gr.types.vmhd,Gr.VMHD),Gr.DINF,Gr.stbl(t))}static moof(t,e,n){return Gr.box(Gr.types.moof,Gr.mfhd(t),Gr.traf(n,e))}static moov(t){let e=t.length;const n=[];for(;e--;)n[e]=Gr.trak(t[e]);return Gr.box.apply(null,[Gr.types.moov,Gr.mvhd(t[0].timescale||0,t[0].duration||0)].concat(n).concat(Gr.mvex(t)))}static mvex(t){let e=t.length;const n=[];for(;e--;)n[e]=Gr.trex(t[e]);return Gr.box.apply(null,[Gr.types.mvex,...n])}static mvhd(t,e){e*=t;const n=Math.floor(e/($r+1)),i=Math.floor(e%($r+1)),r=new Uint8Array([1,0,0,0,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,255&t,n>>24,n>>16&255,n>>8&255,255&n,i>>24,i>>16&255,i>>8&255,255&i,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 Gr.box(Gr.types.mvhd,r)}static sdtp(t){const e=t.samples||[],n=new Uint8Array(4+e.length);let i,r;for(i=0;i<e.length;i++)r=e[i].flags,n[i+4]=r.dependsOn<<4|r.isDependedOn<<2|r.hasRedundancy;return Gr.box(Gr.types.sdtp,n)}static stbl(t){return Gr.box(Gr.types.stbl,Gr.stsd(t),Gr.box(Gr.types.stts,Gr.STTS),Gr.box(Gr.types.stsc,Gr.STSC),Gr.box(Gr.types.stsz,Gr.STSZ),Gr.box(Gr.types.stco,Gr.STCO))}static avc1(t){let e,n,i,r=[],s=[];for(e=0;e<t.sps.length;e++)n=t.sps[e],i=n.byteLength,r.push(i>>>8&255),r.push(255&i),r=r.concat(Array.prototype.slice.call(n));for(e=0;e<t.pps.length;e++)n=t.pps[e],i=n.byteLength,s.push(i>>>8&255),s.push(255&i),s=s.concat(Array.prototype.slice.call(n));const a=Gr.box(Gr.types.avcC,new Uint8Array([1,r[3],r[4],r[5],255,224|t.sps.length].concat(r).concat([t.pps.length]).concat(s))),o=t.width,l=t.height,u=t.pixelRatio[0],h=t.pixelRatio[1];return Gr.box(Gr.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,o>>8&255,255&o,l>>8&255,255&l,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),a,Gr.box(Gr.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),Gr.box(Gr.types.pasp,new Uint8Array([u>>24,u>>16&255,u>>8&255,255&u,h>>24,h>>16&255,h>>8&255,255&h])))}static esds(t){const e=t.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,...e,6,1,2])}static audioStsd(t){const e=t.samplerate||0;return new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t.channelCount||0,0,16,0,0,0,0,e>>8&255,255&e,0,0])}static mp4a(t){return Gr.box(Gr.types.mp4a,Gr.audioStsd(t),Gr.box(Gr.types.esds,Gr.esds(t)))}static mp3(t){return Gr.box(Gr.types[".mp3"],Gr.audioStsd(t))}static ac3(t){return Gr.box(Gr.types["ac-3"],Gr.audioStsd(t),Gr.box(Gr.types.dac3,t.config))}static stsd(t){const{segmentCodec:e}=t;if("audio"===t.type){if("aac"===e)return Gr.box(Gr.types.stsd,Gr.STSD,Gr.mp4a(t));if("ac3"===e&&t.config)return Gr.box(Gr.types.stsd,Gr.STSD,Gr.ac3(t));if("mp3"===e&&"mp3"===t.codec)return Gr.box(Gr.types.stsd,Gr.STSD,Gr.mp3(t))}else{if(!t.pps||!t.sps)throw new Error("video track missing pps or sps");if("avc"===e)return Gr.box(Gr.types.stsd,Gr.STSD,Gr.avc1(t));if("hevc"===e&&t.vps)return Gr.box(Gr.types.stsd,Gr.STSD,Gr.hvc1(t))}throw new Error(`unsupported ${t.type} segment codec (${e}/${t.codec})`)}static tkhd(t){const e=t.id,n=(t.duration||0)*(t.timescale||0),i=t.width||0,r=t.height||0,s=Math.floor(n/($r+1)),a=Math.floor(n%($r+1));return Gr.box(Gr.types.tkhd,new Uint8Array([1,0,0,7,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,255&e,0,0,0,0,s>>24,s>>16&255,s>>8&255,255&s,a>>24,a>>16&255,a>>8&255,255&a,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,i>>8&255,255&i,0,0,r>>8&255,255&r,0,0]))}static traf(t,e){const n=Gr.sdtp(t),i=t.id,r=Math.floor(e/($r+1)),s=Math.floor(e%($r+1));return Gr.box(Gr.types.traf,Gr.box(Gr.types.tfhd,new Uint8Array([0,0,0,0,i>>24,i>>16&255,i>>8&255,255&i])),Gr.box(Gr.types.tfdt,new Uint8Array([1,0,0,0,r>>24,r>>16&255,r>>8&255,255&r,s>>24,s>>16&255,s>>8&255,255&s])),Gr.trun(t,n.length+16+20+8+16+8+8),n)}static trak(t){return t.duration=t.duration||4294967295,Gr.box(Gr.types.trak,Gr.tkhd(t),Gr.mdia(t))}static trex(t){const e=t.id;return Gr.box(Gr.types.trex,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,255&e,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}static trun(t,e){const n=t.samples||[],i=n.length,r=12+16*i,s=new Uint8Array(r);let a,o,l,u,h,c;for(e+=8+r,s.set(["video"===t.type?1:0,0,15,1,i>>>24&255,i>>>16&255,i>>>8&255,255&i,e>>>24&255,e>>>16&255,e>>>8&255,255&e],0),a=0;a<i;a++)o=n[a],l=o.duration,u=o.size,h=o.flags,c=o.cts,s.set([l>>>24&255,l>>>16&255,l>>>8&255,255&l,u>>>24&255,u>>>16&255,u>>>8&255,255&u,h.isLeading<<2|h.dependsOn,h.isDependedOn<<6|h.hasRedundancy<<4|h.paddingValue<<1|h.isNonSync,61440&h.degradPrio,15&h.degradPrio,c>>>24&255,c>>>16&255,c>>>8&255,255&c],12+16*a);return Gr.box(Gr.types.trun,s)}static initSegment(t){Gr.types||Gr.init();const e=Gr.moov(t);return gt(Gr.FTYP,e)}static hvc1(t){const e=t.params,n=[t.vps,t.sps,t.pps],i=new Uint8Array([1,e.general_profile_space<<6|(e.general_tier_flag?32:0)|e.general_profile_idc,e.general_profile_compatibility_flags[0],e.general_profile_compatibility_flags[1],e.general_profile_compatibility_flags[2],e.general_profile_compatibility_flags[3],e.general_constraint_indicator_flags[0],e.general_constraint_indicator_flags[1],e.general_constraint_indicator_flags[2],e.general_constraint_indicator_flags[3],e.general_constraint_indicator_flags[4],e.general_constraint_indicator_flags[5],e.general_level_idc,240|e.min_spatial_segmentation_idc>>8,255&e.min_spatial_segmentation_idc,252|e.parallelismType,252|e.chroma_format_idc,248|e.bit_depth_luma_minus8,248|e.bit_depth_chroma_minus8,0,parseInt(e.frame_rate.fps),3|e.temporal_id_nested<<2|e.num_temporal_layers<<3|(e.frame_rate.fixed?64:0),n.length]);let r=i.length;for(let t=0;t<n.length;t+=1){r+=3;for(let e=0;e<n[t].length;e+=1)r+=2+n[t][e].length}const s=new Uint8Array(r);s.set(i,0),r=i.length;const a=n.length-1;for(let t=0;t<n.length;t+=1){s.set(new Uint8Array([32+t|(t===a?128:0),0,n[t].length]),r),r+=3;for(let e=0;e<n[t].length;e+=1)s.set(new Uint8Array([n[t][e].length>>8,255&n[t][e].length]),r),r+=2,s.set(n[t][e],r),r+=n[t][e].length}const o=Gr.box(Gr.types.hvcC,s),l=t.width,u=t.height,h=t.pixelRatio[0],c=t.pixelRatio[1];return Gr.box(Gr.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,l>>8&255,255&l,u>>8&255,255&u,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),o,Gr.box(Gr.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),Gr.box(Gr.types.pasp,new Uint8Array([h>>24,h>>16&255,h>>8&255,255&h,c>>24,c>>16&255,c>>8&255,255&c])))}}Gr.types=void 0,Gr.HDLR_TYPES=void 0,Gr.STTS=void 0,Gr.STSC=void 0,Gr.STCO=void 0,Gr.STSZ=void 0,Gr.VMHD=void 0,Gr.SMHD=void 0,Gr.STSD=void 0,Gr.FTYP=void 0,Gr.DINF=void 0;function Kr(t,e,n=1,i=!1){const r=t*e*n;return i?Math.round(r):r}function jr(t,e=!1){return Kr(t,1e3,1/9e4,e)}let Vr,Zr=null,zr=null;function Hr(t,e,n,i){return{duration:e,size:n,cts:i,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:t?2:1,isNonSync:t?0:1}}}class Wr extends w{constructor(t,e,n,i){if(super("mp4-remuxer",i),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextVideoTs=null,this.nextAudioTs=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.videoTrackConfig=void 0,this.observer=t,this.config=e,this.typeSupported=n,this.ISGenerated=!1,null===Zr){const t=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Zr=t?parseInt(t[1]):0}if(null===zr){const t=navigator.userAgent.match(/Safari\/(\d+)/i);zr=t?parseInt(t[1]):0}}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(t){this.log("initPTS & initDTS reset"),this._initPTS=this._initDTS=t}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(t){let e=!1;const n=t[0].pts,i=t.reduce(((t,i)=>{let r=i.pts,s=r-t;return s<-4294967296&&(e=!0,r=Yr(r,n),s=r-t),s>0?t:r}),n);return e&&this.debug("PTS rollover detected"),i}remux(t,e,n,i,r,s,a,o){let l,u,h,c,d,f,g=r,_=r;const m=t.pid>-1,v=e.pid>-1,y=e.samples.length,b=t.samples.length>0,E=a&&y>0||y>1;if((!m||b)&&(!v||E)||this.ISGenerated||a){if(this.ISGenerated){var w,T,k,S;const t=this.videoTrackConfig;(t&&(e.width!==t.width||e.height!==t.height||(null==(w=e.pixelRatio)?void 0:w[0])!==(null==(T=t.pixelRatio)?void 0:T[0])||(null==(k=e.pixelRatio)?void 0:k[1])!==(null==(S=t.pixelRatio)?void 0:S[1]))||!t&&E||null===this.nextAudioTs&&b)&&this.resetInitSegment()}this.ISGenerated||(h=this.generateIS(t,e,r,s));const n=this.isVideoContiguous;let i,a=-1;if(E&&(a=function(t){for(let e=0;e<t.length;e++)if(t[e].key)return e;return-1}(e.samples),!n&&this.config.forceKeyFrameOnDiscontinuity))if(f=!0,a>0){this.warn(`Dropped ${a} out of ${y} video samples due to a missing keyframe`);const t=this.getVideoStartPts(e.samples);e.samples=e.samples.slice(a),e.dropped+=a,_+=(e.samples[0].pts-t)/e.inputTimeScale,i=_}else-1===a&&(this.warn(`No keyframe found out of ${y} video samples`),f=!1);if(this.ISGenerated){if(b&&E){const n=this.getVideoStartPts(e.samples),i=(Yr(t.samples[0].pts,n)-n)/e.inputTimeScale;g+=Math.max(0,i),_+=Math.max(0,-i)}if(b){if(t.samplerate||(this.warn("regenerate InitSegment as audio detected"),h=this.generateIS(t,e,r,s)),u=this.remuxAudio(t,g,this.isAudioContiguous,s,v||E||o===p?_:void 0),E){const i=u?u.endPTS-u.startPTS:0;e.inputTimeScale||(this.warn("regenerate InitSegment as video detected"),h=this.generateIS(t,e,r,s)),l=this.remuxVideo(e,_,n,i)}}else E&&(l=this.remuxVideo(e,_,n,0));l&&(l.firstKeyFrame=a,l.independent=-1!==a,l.firstKeyFramePTS=i)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(n.samples.length&&(d=qr(n,r,this._initPTS,this._initDTS)),i.samples.length&&(c=Qr(i,r,this._initPTS))),{audio:u,video:l,initSegment:h,independent:f,text:c,id3:d}}generateIS(t,e,n,i){const r=t.samples,s=e.samples,a=this.typeSupported,o={},l=this._initPTS;let u,h,c,d=!l||i,f="audio/mp4",p=-1;if(d&&(u=h=1/0),t.config&&r.length){switch(t.timescale=t.samplerate,t.segmentCodec){case"mp3":a.mpeg?(f="audio/mpeg",t.codec=""):a.mp3&&(t.codec="mp3");break;case"ac3":t.codec="ac-3"}o.audio={id:"audio",container:f,codec:t.codec,initSegment:"mp3"===t.segmentCodec&&a.mpeg?new Uint8Array(0):Gr.initSegment([t]),metadata:{channelCount:t.channelCount}},d&&(p=t.id,c=t.inputTimeScale,l&&c===l.timescale?d=!1:u=h=r[0].pts-Math.round(c*n))}if(e.sps&&e.pps&&s.length){if(e.timescale=e.inputTimeScale,o.video={id:"main",container:"video/mp4",codec:e.codec,initSegment:Gr.initSegment([e]),metadata:{width:e.width,height:e.height}},d)if(p=e.id,c=e.inputTimeScale,l&&c===l.timescale)d=!1;else{const t=this.getVideoStartPts(s),e=Math.round(c*n);h=Math.min(h,Yr(s[0].dts,t)-e),u=Math.min(u,t-e)}this.videoTrackConfig={width:e.width,height:e.height,pixelRatio:e.pixelRatio}}if(Object.keys(o).length)return this.ISGenerated=!0,d?(l&&this.warn(`Timestamps at playlist time: ${i?"":"~"}${n} ${u/c} != initPTS: ${l.baseTime/l.timescale} (${l.baseTime}/${l.timescale}) trackId: ${l.trackId}`),this.log(`Found initPTS at playlist time: ${n} offset: ${u/c} (${u}/${c}) trackId: ${p}`),this._initPTS={baseTime:u,timescale:c,trackId:p},this._initDTS={baseTime:h,timescale:c,trackId:p}):u=c=void 0,{tracks:o,initPTS:u,timescale:c,trackId:p}}remuxVideo(t,e,n,i){const r=t.inputTimeScale,s=t.samples,u=[],h=s.length,c=this._initPTS,d=c.baseTime*r/c.timescale;let f,p,g=this.nextVideoTs,_=8,m=this.videoSampleDuration,v=Number.POSITIVE_INFINITY,b=Number.NEGATIVE_INFINITY,E=!1;if(!n||null===g){const t=d+e*r,i=s[0].pts-Yr(s[0].dts,s[0].pts);Zr&&null!==g&&Math.abs(t-i-(g+d))<15e3?n=!0:g=t-i-d}const w=g+d;for(let t=0;t<h;t++){const e=s[t];e.pts=Yr(e.pts,w),e.dts=Yr(e.dts,w),e.dts<s[t>0?t-1:t].dts&&(E=!0)}E&&s.sort((function(t,e){const n=t.dts-e.dts,i=t.pts-e.pts;return n||i})),f=s[0].dts,p=s[s.length-1].dts;const T=p-f,k=T?Math.round(T/(h-1)):m||t.inputTimeScale/30;if(n){const n=f-w,i=n>k,r=n<-1;if((i||r)&&(i?this.warn(`${(t.segmentCodec||"").toUpperCase()}: ${jr(n,!0)} ms (${n}dts) hole between fragments detected at ${e.toFixed(3)}`):this.warn(`${(t.segmentCodec||"").toUpperCase()}: ${jr(-n,!0)} ms (${n}dts) overlapping between fragments detected at ${e.toFixed(3)}`),!r||w>=s[0].pts||Zr)){f=w;const t=s[0].pts-n;if(i)s[0].dts=f,s[0].pts=t;else{let e=!0;for(let i=0;i<s.length&&!(s[i].dts>t&&e);i++){const t=s[i].pts;if(s[i].dts-=n,s[i].pts-=n,i<s.length-1){const n=s[i+1].pts;e=n<=s[i].pts==n<=t}}}this.log(`Video: Initial PTS/DTS adjusted: ${jr(t,!0)}/${jr(f,!0)}, delta: ${jr(n,!0)} ms`)}}f=Math.max(0,f);let S=0,A=0,D=f;for(let t=0;t<h;t++){const e=s[t],n=e.units,i=n.length;let r=0;for(let t=0;t<i;t++)r+=n[t].data.length;A+=r,S+=i,e.length=r,e.dts<D?(e.dts=D,D+=k/4|0||1):D=e.dts,v=Math.min(e.pts,v),b=Math.max(e.pts,b)}p=s[h-1].dts;const C=A+4*S+8;let x;try{x=new Uint8Array(C)}catch(t){return void this.observer.emit(l.ERROR,l.ERROR,{type:a.MUX_ERROR,details:o.REMUX_ALLOC_ERROR,fatal:!1,error:t,bytes:C,reason:`fail allocating video mdat ${C}`})}const R=new DataView(x.buffer);R.setUint32(0,C),x.set(Gr.types.mdat,4);let L=!1,I=Number.POSITIVE_INFINITY,P=Number.POSITIVE_INFINITY,O=Number.NEGATIVE_INFINITY,F=Number.NEGATIVE_INFINITY;for(let t=0;t<h;t++){const e=s[t],n=e.units;let a,o=0;for(let t=0,e=n.length;t<e;t++){const e=n[t],i=e.data,r=e.data.byteLength;R.setUint32(_,r),_+=4,x.set(i,_),_+=r,o+=4+r}if(t<h-1)m=s[t+1].dts-e.dts,a=s[t+1].pts-e.pts;else{const n=this.config,o=t>0?e.dts-s[t-1].dts:k;if(a=t>0?e.pts-s[t-1].pts:k,n.stretchShortVideoTrack&&null!==this.nextAudioTs){const t=Math.floor(n.maxBufferHole*r),s=(i?v+i*r:this.nextAudioTs+d)-e.pts;s>t?(m=s-o,m<0?m=o:L=!0,this.log(`It is approximately ${s/90} ms to the next segment; using duration ${m/90} ms for the last video frame.`)):m=o}else m=o}const l=Math.round(e.pts-e.dts);I=Math.min(I,m),O=Math.max(O,m),P=Math.min(P,a),F=Math.max(F,a),u.push(Hr(e.key,m,o,l))}if(u.length)if(Zr){if(Zr<70){const t=u[0].flags;t.dependsOn=2,t.isNonSync=0}}else if(zr&&F-P<O-I&&k/O<.025&&0===u[0].cts){this.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");let t=f;for(let e=0,n=u.length;e<n;e++){const i=t+u[e].duration,r=t+u[e].cts;if(e<n-1){const t=i+u[e+1].cts;u[e].duration=t-r}else u[e].duration=e?u[e-1].duration:k;u[e].cts=0,t=i}}m=L||!m?k:m;const M=p+m;this.nextVideoTs=g=M-d,this.videoSampleDuration=m,this.isVideoContiguous=!0;const N={data1:Gr.moof(t.sequenceNumber++,f,y(t,{samples:u})),data2:x,startPTS:(v-d)/r,endPTS:(b+m-d)/r,startDTS:(f-d)/r,endDTS:g/r,type:"video",hasAudio:!1,hasVideo:!0,nb:u.length,dropped:t.dropped};return t.samples=[],t.dropped=0,N}getSamplesPerFrame(t){switch(t.segmentCodec){case"mp3":return 1152;case"ac3":return 1536;default:return 1024}}remuxAudio(t,e,n,i,r){const s=t.inputTimeScale,u=s/(t.samplerate?t.samplerate:s),h=this.getSamplesPerFrame(t),c=h*u,d=this._initPTS,f="mp3"===t.segmentCodec&&this.typeSupported.mpeg,p=[],g=void 0!==r;let _=t.samples,m=f?0:8,v=this.nextAudioTs||-1;const b=d.baseTime*s/d.timescale,E=b+e*s;if(this.isAudioContiguous=n=n||_.length&&v>0&&(i&&Math.abs(E-(v+b))<9e3||Math.abs(Yr(_[0].pts,E)-(v+b))<20*c),_.forEach((function(t){t.pts=Yr(t.pts,E)})),!n||v<0){if(_=_.filter((t=>t.pts>=0)),!_.length)return;v=0===r?0:i&&!g?Math.max(0,E-b):_[0].pts-b}if("aac"===t.segmentCodec){const e=this.config.maxAudioFramesDrift;for(let n=0,i=v+b;n<_.length;n++){const r=_[n],a=r.pts,o=a-i,l=Math.abs(1e3*o/s);if(o<=-e*c&&g)0===n&&(this.warn(`Audio frame @ ${(a/s).toFixed(3)}s overlaps marker by ${Math.round(1e3*o/s)} ms.`),this.nextAudioTs=v=a-b,i=a);else if(o>=e*c&&l<1e4&&g){let e=Math.round(o/c);for(i=a-e*c;i<0&&e&&c;)e--,i+=c;0===n&&(this.nextAudioTs=v=i-b),this.warn(`Injecting ${e} audio frames @ ${((i-b)/s).toFixed(3)}s due to ${Math.round(1e3*o/s)} ms gap.`);for(let s=0;s<e;s++){let e=Ur.getSilentFrame(t.parsedCodec||t.manifestCodec||t.codec,t.channelCount);e||(this.log("Unable to get silent frame for given audio codec; duplicating last frame instead."),e=r.unit.subarray()),_.splice(n,0,{unit:e,pts:i}),i+=c,n++}}r.pts=i,i+=c}}let w,T=null,k=null,S=0,A=_.length;for(;A--;)S+=_[A].unit.byteLength;for(let e=0,i=_.length;e<i;e++){const i=_[e],r=i.unit;let s=i.pts;if(null!==k){p[e-1].duration=Math.round((s-k)/u)}else{if(n&&"aac"===t.segmentCodec&&(s=v+b),T=s,!(S>0))return;S+=m;try{w=new Uint8Array(S)}catch(t){return void this.observer.emit(l.ERROR,l.ERROR,{type:a.MUX_ERROR,details:o.REMUX_ALLOC_ERROR,fatal:!1,error:t,bytes:S,reason:`fail allocating audio mdat ${S}`})}if(!f){new DataView(w.buffer).setUint32(0,S),w.set(Gr.types.mdat,4)}}w.set(r,m);const c=r.byteLength;m+=c,p.push(Hr(!0,h,c,0)),k=s}const D=p.length;if(!D)return;const C=p[p.length-1];v=k-b,this.nextAudioTs=v+u*C.duration;const x=f?new Uint8Array(0):Gr.moof(t.sequenceNumber++,T/u,y({},t,{samples:p}));t.samples=[];const R=(T-b)/s,L=v/s,I={data1:x,data2:w,startPTS:R,endPTS:L,startDTS:R,endDTS:L,type:"audio",hasAudio:!0,hasVideo:!1,nb:D};return this.isAudioContiguous=!0,I}}function Yr(t,e){let n;if(null===e)return t;for(n=e<t?-8589934592:8589934592;Math.abs(t-e)>4294967296;)t+=n;return t}function qr(t,e,n,i){const r=t.samples.length;if(!r)return;const s=t.inputTimeScale;for(let a=0;a<r;a++){const r=t.samples[a];r.pts=Yr(r.pts-n.baseTime*s/n.timescale,e*s)/s,r.dts=Yr(r.dts-i.baseTime*s/i.timescale,e*s)/s}const a=t.samples;return t.samples=[],{samples:a}}function Qr(t,e,n){const i=t.samples.length;if(!i)return;const r=t.inputTimeScale;for(let s=0;s<i;s++){const i=t.samples[s];i.pts=Yr(i.pts-n.baseTime*r/n.timescale,e*r)/r}t.samples.sort(((t,e)=>t.pts-e.pts));const s=t.samples;return t.samples=[],{samples:s}}function Xr(t,e,n=!1){return void 0!==(null==t?void 0:t.start)?(t.start+(n?t.duration:0))/t.timescale:e}function Jr(t,e,n){const i=t.codec;if(i&&i.length>4)return i;if(e===V){if("ec-3"===i||"ac-3"===i||"alac"===i)return i;if("fLaC"===i||"Opus"===i){return Pt(i,!1)}return n.warn(`Unhandled audio codec "${i}" in mp4 MAP`),i||"mp4a"}return n.warn(`Unhandled video codec "${i}" in mp4 MAP`),i||"avc1"}try{Vr=self.performance.now.bind(self.performance)}catch(t){Vr=Date.now}const ts=[{demux:class{constructor(t,e){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=e}resetTimeStamp(){}resetInitSegment(t,e,n,i){const r=this.videoTrack=lr("video",1),s=this.audioTrack=lr("audio",1),a=this.txtTrack=lr("text",1);if(this.id3Track=lr("id3",1),this.timeOffset=0,null==t||!t.byteLength)return;const o=lt(t);if(o.video){const{id:t,timescale:e,codec:n,supplemental:i}=o.video;r.id=t,r.timescale=a.timescale=e,r.codec=n,r.supplemental=i}if(o.audio){const{id:t,timescale:e,codec:n}=o.audio;s.id=t,s.timescale=e,s.codec=n}a.id=tt.text,r.sampleDuration=0,r.duration=s.duration=i}resetContiguity(){this.remainderData=null}static probe(t){return function(t){const e=t.byteLength;for(let n=0;n<e;){const i=it(t,n);if(i>8&&109===t[n+4]&&111===t[n+5]&&111===t[n+6]&&102===t[n+7])return!0;n=i>1?n+i:e}return!1}(t)}demux(t,e){this.timeOffset=e;let n=t;const i=this.videoTrack,r=this.txtTrack;if(this.config.progressive){this.remainderData&&(n=gt(this.remainderData,t));const e=function(t){const e={valid:null,remainder:null},n=at(t,["moof"]);if(n.length<2)return e.remainder=t,e;const i=n[n.length-1];return e.valid=t.slice(0,i.byteOffset-8),e.remainder=t.slice(i.byteOffset-8),e}(n);this.remainderData=e.remainder,i.samples=e.valid||new Uint8Array}else i.samples=n;const s=this.extractID3Track(i,e);return r.samples=_t(e,i),{videoTrack:i,audioTrack:this.audioTrack,id3Track:s,textTrack:this.txtTrack}}flush(){const t=this.timeOffset,e=this.videoTrack,n=this.txtTrack;e.samples=this.remainderData||new Uint8Array,this.remainderData=null;const i=this.extractID3Track(e,this.timeOffset);return n.samples=_t(t,e),{videoTrack:e,audioTrack:lr(),id3Track:i,textTrack:lr()}}extractID3Track(t,e){const n=this.id3Track;if(t.samples.length){const i=at(t.samples,["emsg"]);i&&i.forEach((t=>{const i=function(t){const e=t[0];let n="",i="",s=0,a=0,o=0,l=0,u=0,h=0;if(0===e){for(;"\0"!==et(t.subarray(h,h+1));)n+=et(t.subarray(h,h+1)),h+=1;for(n+=et(t.subarray(h,h+1)),h+=1;"\0"!==et(t.subarray(h,h+1));)i+=et(t.subarray(h,h+1)),h+=1;i+=et(t.subarray(h,h+1)),h+=1,s=it(t,12),a=it(t,16),l=it(t,20),u=it(t,24),h=28}else if(1===e){h+=4,s=it(t,h),h+=4;const e=it(t,h);h+=4;const a=it(t,h);for(h+=4,o=2**32*e+a,r(o)||(o=Number.MAX_SAFE_INTEGER,C.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),l=it(t,h),h+=4,u=it(t,h),h+=4;"\0"!==et(t.subarray(h,h+1));)n+=et(t.subarray(h,h+1)),h+=1;for(n+=et(t.subarray(h,h+1)),h+=1;"\0"!==et(t.subarray(h,h+1));)i+=et(t.subarray(h,h+1)),h+=1;i+=et(t.subarray(h,h+1)),h+=1}return{schemeIdUri:n,value:i,timeScale:s,presentationTime:o,presentationTimeDelta:a,eventDuration:l,id:u,payload:t.subarray(h,t.byteLength)}}(t);if(kr.test(i.schemeIdUri)){const t=Sr(i,e);let r=4294967295===i.eventDuration?Number.POSITIVE_INFINITY:i.eventDuration/i.timeScale;r<=.001&&(r=Number.POSITIVE_INFINITY);const s=i.payload;n.samples.push({data:s,len:s.byteLength,dts:t,pts:t,type:or.emsg,duration:r})}else if(this.config.enableEmsgKLVMetadata&&i.schemeIdUri.startsWith("urn:misb:KLV:bin:1910.1")){const t=Sr(i,e);n.samples.push({data:i.payload,len:i.payload.byteLength,dts:t,pts:t,type:or.misbklv,duration:Number.POSITIVE_INFINITY})}}))}return n}demuxSampleAes(t,e,n){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))}destroy(){this.config=null,this.remainderData=null,this.videoTrack=this.audioTrack=this.id3Track=this.txtTrack=void 0}},remux:class extends w{constructor(t,e,n,i){super("passthrough-remuxer",i),this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=null,this.initTracks=void 0,this.lastEndTime=null,this.isVideoContiguous=!1}destroy(){}resetTimeStamp(t){this.lastEndTime=null;const e=this.initPTS;e&&t&&e.baseTime===t.baseTime&&e.timescale===t.timescale||(this.initPTS=t)}resetNextTimestamp(){this.isVideoContiguous=!1,this.lastEndTime=null}resetInitSegment(t,e,n,i){this.audioCodec=e,this.videoCodec=n,this.generateInitSegment(t,i),this.emitInitSegment=!0}generateInitSegment(t,e){let{audioCodec:n,videoCodec:i}=this;if(null==t||!t.byteLength)return this.initTracks=void 0,void(this.initData=void 0);const{audio:r,video:s}=this.initData=lt(t);if(e)!function(t,e){if(!t||!e)return;const n=e.keyId;n&&e.isCommonEncryption&&at(t,["moov","trak"]).forEach((t=>{const e=at(t,["mdia","minf","stbl","stsd"])[0].subarray(8);let i=at(e,["enca"]);const r=i.length>0;r||(i=at(e,["encv"])),i.forEach((t=>{at(r?t.subarray(28):t.subarray(78),["sinf"]).forEach((t=>{const e=pt(t);if(e){const t=e.subarray(8,24);t.some((t=>0!==t))||(C.log(`[eme] Patching keyId in 'enc${r?"a":"v"}>sinf>>tenc' box: ${I(t)} -> ${I(n)}`),e.set(n,8))}}))}))}))}(t,e);else{const t=r||s;null!=t&&t.encrypted&&this.warn(`Init segment with encrypted track with has no key ("${t.codec}")!`)}r&&(n=Jr(r,V,this)),s&&(i=Jr(s,Z,this));const a={};r&&s?a.audiovideo={container:"video/mp4",codec:n+","+i,supplemental:s.supplemental,encrypted:s.encrypted,initSegment:t,id:"main"}:r?a.audio={container:"audio/mp4",codec:n,encrypted:r.encrypted,initSegment:t,id:"audio"}:s?a.video={container:"video/mp4",codec:i,supplemental:s.supplemental,encrypted:s.encrypted,initSegment:t,id:"main"}:this.warn("initSegment does not contain moov or trak boxes."),this.initTracks=a}remux(t,e,n,r,s,a){var o,l;let{initPTS:u,lastEndTime:h}=this;const c={audio:void 0,video:void 0,text:r,id3:n,initSegment:void 0};i(h)||(h=this.lastEndTime=s||0);const d=e.samples;if(!d.length)return c;const f={initPTS:void 0,timescale:void 0,trackId:void 0};let p=this.initData;if(null!=(o=p)&&o.length||(this.generateInitSegment(d),p=this.initData),null==(l=p)||!l.length)return this.warn("Failed to generate initSegment."),c;this.emitInitSegment&&(f.tracks=this.initTracks,this.emitInitSegment=!1);const g=function(t,e,n){const r={},s=at(t,["moof","traf"]);for(let t=0;t<s.length;t++){const a=s[t],o=at(a,["tfhd"])[0],l=it(o,4),u=e[l];if(!u)continue;r[l]||(r[l]={start:NaN,duration:0,sampleCount:0,timescale:u.timescale,type:u.type});const h=r[l],c=at(a,["tfdt"])[0];if(c){const t=c[0];let e=it(c,4);1===t&&(e===X?n.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"):(e*=X+1,e+=it(c,8))),i(e)&&(!i(h.start)||e<h.start)&&(h.start=e)}const d=u.default,f=it(o,0)|(null==d?void 0:d.flags);let p=(null==d?void 0:d.duration)||0;8&f&&(p=it(o,2&f?12:8));const g=at(a,["trun"]);let _=h.start||0,m=0,v=p;for(let t=0;t<g.length;t++){const e=g[t],n=it(e,4),i=h.sampleCount;h.sampleCount+=n;const r=1&e[3],s=4&e[3],a=1&e[2],o=2&e[2],l=4&e[2],u=8&e[2];let c=8,d=n;for(r&&(c+=4),s&&n&&(1&e[c+1]||void 0!==h.keyFrameIndex||(h.keyFrameIndex=i),c+=4,a?(v=it(e,c),c+=4):v=p,o&&(c+=4),u&&(c+=4),_+=v,m+=v,d--);d--;)a?(v=it(e,c),c+=4):v=p,o&&(c+=4),l&&(1&e[c+1]||void 0===h.keyFrameIndex&&(h.keyFrameIndex=h.sampleCount-(d+1),h.keyFrameStart=_),c+=4),u&&(c+=4),_+=v,m+=v;!m&&p&&(m+=p*n)}h.duration+=m}if(!Object.keys(r).some((t=>r[t].duration))){let e=1/0,n=0;const s=at(t,["sidx"]);for(let t=0;t<s.length;t++){const i=ot(s[t]);if(null!=i&&i.references){e=Math.min(e,i.earliestPresentationTime/i.timescale);const t=i.references.reduce(((t,e)=>t+e.info.duration||0),0);n=Math.max(n,t+i.earliestPresentationTime/i.timescale)}}n&&i(n)&&Object.keys(r).forEach((t=>{r[t].duration||(r[t].duration=n*r[t].timescale-r[t].start)}))}return r}(d,p,this),_=p.audio?g[p.audio.id]:null,m=p.video?g[p.video.id]:null,v=Xr(m,1/0),y=Xr(_,1/0),b=Xr(m,0,!0),E=Xr(_,0,!0);let w=s,T=0;const k=_&&(!m||!u&&y<v||u&&u.trackId===p.audio.id),S=k?_:m;if(S){const t=S.timescale,e=S.start-s*t,n=k?p.audio.id:p.video.id;w=S.start/t,T=k?E-y:b-v,!a&&u||!function(t,e,n,i){if(null===t)return!0;const r=Math.max(i,1),s=e-t.baseTime/t.timescale;return Math.abs(s-n)>r}(u,w,s,T)&&t===u.timescale||(u&&this.warn(`Timestamps at playlist time: ${a?"":"~"}${s} ${e/t} != initPTS: ${u.baseTime/u.timescale} (${u.baseTime}/${u.timescale}) trackId: ${u.trackId}`),this.log(`Found initPTS at playlist time: ${s} offset: ${w-s} (${e}/${t}) trackId: ${n}`),u=null,f.initPTS=e,f.timescale=t,f.trackId=n)}else this.warn(`No audio or video samples found for initPTS at playlist time: ${s}`);u?(f.initPTS=u.baseTime,f.timescale=u.timescale,f.trackId=u.trackId):(f.timescale&&void 0!==f.trackId&&void 0!==f.initPTS||(this.warn("Could not set initPTS"),f.initPTS=w,f.timescale=1,f.trackId=-1),this.initPTS=u={baseTime:f.initPTS,timescale:f.timescale,trackId:f.trackId});const A=w-u.baseTime/u.timescale,D=A+T;T>0?this.lastEndTime=D:(this.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const C=!!p.audio,x=!!p.video;let R="";C&&(R+="audio"),x&&(R+="video");const L={data1:d,startPTS:A,startDTS:A,endPTS:D,endDTS:D,type:R,hasAudio:C,hasVideo:x,nb:1,dropped:0,encrypted:!!p.audio&&p.audio.encrypted||!!p.video&&p.video.encrypted};c.audio=C&&!x?L:void 0,c.video=x?L:void 0;const I=null==m?void 0:m.sampleCount;if(I){const t=m.keyFrameIndex,e=-1!==t;L.nb=I,L.dropped=0===t||this.isVideoContiguous?0:e?t:I,L.independent=e,L.firstKeyFrame=t,e&&m.keyFrameStart&&(L.firstKeyFramePTS=(m.keyFrameStart-u.baseTime)/u.timescale),this.isVideoContiguous||(c.independent=e),this.isVideoContiguous||(this.isVideoContiguous=e),L.dropped&&this.warn(`fmp4 does not start with IDR: firstIDR ${t}/${I} dropped: ${L.dropped} start: ${L.firstKeyFramePTS||"NA"}`)}return c.initSegment=f,c.id3=qr(n,s,u,u),r.samples.length&&(c.text=Qr(r,s,u)),c}}},{demux:Ir,remux:Wr},{demux:class extends ur{constructor(t,e){super(),this.observer=void 0,this.config=void 0,this.observer=t,this.config=e}resetInitSegment(t,e,n,i){super.resetInitSegment(t,e,n,i),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:e,duration:i,inputTimeScale:9e4,dropped:0}}static probe(t,e){if(!t)return!1;const n=ji(t,0);let i=(null==n?void 0:n.length)||0;if(br(t,i))return!1;for(let n=t.length;i<n;i++)if(Wi(t,i))return e.log("ADTS sync word found !"),!0;return!1}canParse(t,e){return function(t,e){return function(t,e){return e+5<t.length}(t,e)&&Vi(t,e)&&zi(t,e)<=t.length-e}(t,e)}appendFrame(t,e,n){Yi(t,this.observer,e,n,t.manifestCodec);const i=Qi(t,e,n,this.basePTS,this.frameIndex);if(i&&0===i.missing)return i}},remux:Wr},{demux:class extends ur{resetInitSegment(t,e,n,i){super.resetInitSegment(t,e,n,i),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:e,duration:i,inputTimeScale:9e4,dropped:0}}static probe(t){if(!t)return!1;const e=ji(t,0);let n=(null==e?void 0:e.length)||0;if(e&&11===t[n]&&119===t[n+1]&&void 0!==ar(e)&&Er(t,n)<=16)return!1;for(let e=t.length;n<e;n++)if(br(t,n))return C.log("MPEG Audio sync word found !"),!0;return!1}canParse(t,e){return function(t,e){return vr(t,e)&&4<=t.length-e}(t,e)}appendFrame(t,e,n){if(null!==this.basePTS)return _r(t,e,n,this.basePTS,this.frameIndex)}},remux:Wr}];ts.splice(2,0,{demux:wr,remux:Wr});class es{constructor(t,e,n,i,r,s){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=t,this.typeSupported=e,this.config=n,this.id=r,this.logger=s}configure(t){this.transmuxConfig=t,this.decrypter&&this.decrypter.reset()}push(t,e,n,i){const r=n.transmuxing;r.executeStart=Vr();let s=new Uint8Array(t);const{currentTransmuxState:u,transmuxConfig:h}=this;i&&(this.currentTransmuxState=i);const{contiguous:c,discontinuity:d,trackSwitch:f,accurateTimeOffset:p,timeOffset:g,initSegmentChange:_}=i||u,{audioCodec:m,videoCodec:v,defaultInitPts:y,duration:b,initSegmentData:E}=h,w=function(t,e){let n=null;t.byteLength>0&&null!=(null==e?void 0:e.key)&&null!==e.iv&&null!=e.method&&(n=e);return n}(s,e);if(w&&_n(w.method)){const t=this.getDecrypter(),e=mn(w.method);if(!t.isSync())return this.asyncResult=!0,this.decryptionPromise=t.webCryptoDecrypt(s,w.key.buffer,w.iv.buffer,e).then((t=>{const e=this.push(t,null,n);return this.decryptionPromise=null,e})),this.decryptionPromise;{let i=t.softwareDecrypt(s,w.key.buffer,w.iv.buffer,e);if(n.part>-1){const e=t.flush();i=e?e.buffer:e}if(!i)return r.executeEnd=Vr(),ns(n);s=new Uint8Array(i)}}const T=this.needsProbing(d,f);if(T){const t=this.configureTransmuxer(s);if(t)return this.logger.warn(`[transmuxer] ${t.message}`),this.observer.emit(l.ERROR,l.ERROR,{type:a.MEDIA_ERROR,details:o.FRAG_PARSING_ERROR,fatal:!1,error:t,reason:t.message}),r.executeEnd=Vr(),ns(n)}(d||f||_||T)&&this.resetInitSegment(E,m,v,b,e),(d||_||T)&&this.resetInitialTimestamp(y),c||this.resetContiguity();const k=this.transmux(s,w,g,p,n);this.asyncResult=is(k);const S=this.currentTransmuxState;return S.contiguous=!0,S.discontinuity=!1,S.trackSwitch=!1,r.executeEnd=Vr(),k}flush(t){const e=t.transmuxing;e.executeStart=Vr();const{decrypter:n,currentTransmuxState:i,decryptionPromise:r}=this;if(r)return this.asyncResult=!0,r.then((()=>this.flush(t)));const s=[],{timeOffset:a}=i;if(n){const e=n.flush();e&&s.push(this.push(e.buffer,null,t))}const{demuxer:o,remuxer:l}=this;if(!o||!l){e.executeEnd=Vr();const n=[ns(t)];return this.asyncResult?Promise.resolve(n):n}const u=o.flush(a);return is(u)?(this.asyncResult=!0,u.then((e=>(this.flushRemux(s,e,t),s)))):(this.flushRemux(s,u,t),this.asyncResult?Promise.resolve(s):s)}flushRemux(t,e,n){const{audioTrack:i,videoTrack:r,id3Track:s,textTrack:a}=e,{accurateTimeOffset:o,timeOffset:l}=this.currentTransmuxState;this.logger.log(`[transmuxer.ts]: Flushed ${this.id} sn: ${n.sn}${n.part>-1?" part: "+n.part:""} of ${this.id===f?"level":"track"} ${n.level}`);const u=this.remuxer.remux(i,r,s,a,l,o,!0,this.id);t.push({remuxResult:u,chunkMeta:n}),n.transmuxing.executeEnd=Vr()}resetInitialTimestamp(t){const{demuxer:e,remuxer:n}=this;e&&n&&(e.resetTimeStamp(t),n.resetTimeStamp(t))}resetContiguity(){const{demuxer:t,remuxer:e}=this;t&&e&&(t.resetContiguity(),e.resetNextTimestamp())}resetInitSegment(t,e,n,i,r){const{demuxer:s,remuxer:a}=this;s&&a&&(s.resetInitSegment(t,e,n,i),a.resetInitSegment(t,e,n,r))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}transmux(t,e,n,i,r){let s;return s=e&&"SAMPLE-AES"===e.method?this.transmuxSampleAes(t,e,n,i,r):this.transmuxUnencrypted(t,n,i,r),s}transmuxUnencrypted(t,e,n,i){const{audioTrack:r,videoTrack:s,id3Track:a,textTrack:o}=this.demuxer.demux(t,e,!1,!this.config.progressive);return{remuxResult:this.remuxer.remux(r,s,a,o,e,n,!1,this.id),chunkMeta:i}}transmuxSampleAes(t,e,n,i,r){return this.demuxer.demuxSampleAes(t,e,n).then((t=>({remuxResult:this.remuxer.remux(t.audioTrack,t.videoTrack,t.id3Track,t.textTrack,n,i,!1,this.id),chunkMeta:r})))}configureTransmuxer(t){const{config:e,observer:n,typeSupported:i}=this;let r;for(let e=0,n=ts.length;e<n;e++){var s;if(null!=(s=ts[e].demux)&&s.probe(t,this.logger)){r=ts[e];break}}if(!r)return new Error("Failed to find demuxer by probing fragment data");const a=this.demuxer,o=this.remuxer,l=r.remux,u=r.demux;o&&o instanceof l||(this.remuxer=new l(n,e,i,this.logger)),a&&a instanceof u||(this.demuxer=new u(n,e,i,this.logger),this.probe=u.probe)}needsProbing(t,e){return!this.demuxer||!this.remuxer||t||e}getDecrypter(){let t=this.decrypter;return t||(t=this.decrypter=new ze(this.config)),t}}const ns=t=>({remuxResult:{},chunkMeta:t});function is(t){return"then"in t&&t.then instanceof Function}class rs{constructor(t,e,n,i,r){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=t,this.videoCodec=e,this.initSegmentData=n,this.duration=i,this.defaultInitPts=r||null}}class ss{constructor(t,e,n,i,r,s){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=t,this.contiguous=e,this.accurateTimeOffset=n,this.trackSwitch=i,this.timeOffset=r,this.initSegmentChange=s}}let as=0;class os{constructor(t,e,n,i){this.error=null,this.hls=void 0,this.id=void 0,this.instanceNo=as++,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=t=>{const e=t.data,n=this.hls;if(n&&null!=e&&e.event&&e.instanceNo===this.instanceNo)switch(e.event){case"init":{var i;const t=null==(i=this.workerContext)?void 0:i.objectURL;t&&self.URL.revokeObjectURL(t);break}case"transmuxComplete":this.handleTransmuxComplete(e.data);break;case"flush":this.onFlush(e.data);break;case"workerLog":n.logger[e.data.logType]&&n.logger[e.data.logType](e.data.message);break;default:e.data=e.data||{},e.data.frag=this.frag,e.data.part=this.part,e.data.id=this.id,n.trigger(e.event,e.data)}},this.onWorkerError=t=>{if(!this.hls)return;const e=new Error(`${t.message} (${t.filename}:${t.lineno})`);this.hls.config.enableWorker=!1,this.hls.logger.warn(`Error in "${this.id}" Web Worker, fallback to inline`),this.hls.trigger(l.ERROR,{type:a.OTHER_ERROR,details:o.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:e})};const r=t.config;this.hls=t,this.id=e,this.useWorker=!!r.enableWorker,this.onTransmuxComplete=n,this.onFlush=i;const s=(t,e)=>{(e=e||{}).frag=this.frag||void 0,t===l.ERROR&&(e.parent=this.id,e.part=this.part,this.error=e.error),this.hls.trigger(t,e)};this.observer=new Ni,this.observer.on(l.FRAG_DECRYPTED,s),this.observer.on(l.ERROR,s);const u=Nt(r.preferManagedMediaSource);if(this.useWorker&&"undefined"!=typeof Worker){const n=this.hls.logger;if(r.workerPath||"function"==typeof __HLS_WORKER_BUNDLE__){try{r.workerPath?(n.log(`loading Web Worker ${r.workerPath} for "${e}"`),this.workerContext=function(t){const e=Ui[t];if(e)return e.clientCount++,e;const n=new self.URL(t,self.location.href).href,i={worker:new self.Worker(n),scriptURL:n,clientCount:1};return Ui[t]=i,i}(r.workerPath)):(n.log(`injecting Web Worker for "${e}"`),this.workerContext=function(){const t=Ui[Bi];if(t)return t.clientCount++,t;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"}),n=self.URL.createObjectURL(e),i={worker:new self.Worker(n),objectURL:n,clientCount:1};return Ui[Bi]=i,i}());const{worker:t}=this.workerContext;t.addEventListener("message",this.onWorkerMessage),t.addEventListener("error",this.onWorkerError),t.postMessage({instanceNo:this.instanceNo,cmd:"init",typeSupported:u,id:e,config:ne(r)})}catch(i){n.warn(`Error setting up "${e}" Web Worker, fallback to inline`,i),this.terminateWorker(),this.error=null,this.transmuxer=new es(this.observer,u,r,"",e,t.logger)}return}}this.transmuxer=new es(this.observer,u,r,"",e,t.logger)}reset(){if(this.frag=null,this.part=null,this.workerContext){const t=this.instanceNo;this.instanceNo=as++;const e=this.hls.config,n=Nt(e.preferManagedMediaSource);this.workerContext.worker.postMessage({instanceNo:this.instanceNo,cmd:"reset",resetNo:t,typeSupported:n,id:this.id,config:ne(e)})}}terminateWorker(){if(this.workerContext){const{worker:t}=this.workerContext;this.workerContext=null,t.removeEventListener("message",this.onWorkerMessage),t.removeEventListener("error",this.onWorkerError),function(t){const e=Ui[t||Bi];if(e&&1==e.clientCount--){const{worker:n,objectURL:i}=e;delete Ui[t||Bi],i&&self.URL.revokeObjectURL(i),n.terminate()}}(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 t=this.observer;t&&t.removeAllListeners(),this.frag=null,this.part=null,this.observer=null,this.hls=null}push(t,e,n,i,r,s,a,o,l,u){var h,c;l.transmuxing.start=self.performance.now();const{instanceNo:d,transmuxer:p}=this,g=s?s.start:r.start,_=r.decryptdata,m=this.frag,v=!(m&&r.cc===m.cc),y=!(m&&l.level===m.level),b=m?l.sn-m.sn:-1,E=this.part?l.part-this.part.index:-1,w=0===b&&l.id>1&&l.id===(null==m?void 0:m.stats.chunkCount),T=!y&&(1===b||0===b&&(1===E||w&&E<=0)),k=self.performance.now();(y||b||0===r.stats.parsing.start)&&(r.stats.parsing.start=k),!s||!E&&T||(s.stats.parsing.start=k);const S=!(m&&(null==(h=r.initSegment)?void 0:h.url)===(null==(c=m.initSegment)?void 0:c.url)),A=new ss(v,T,o,y,g,S);if(!T||v||S){this.hls.logger.log(`[transmuxer-interface]: Starting new transmux session for ${r.type} sn: ${l.sn}${l.part>-1?" part: "+l.part:""} ${this.id===f?"level":"track"}: ${l.level} id: ${l.id}\n discontinuity: ${v}\n trackSwitch: ${y}\n contiguous: ${T}\n accurateTimeOffset: ${o}\n timeOffset: ${g}\n initSegmentChange: ${S}`);const t=new rs(n,i,e,a,u);this.configureTransmuxer(t)}if(this.frag=r,this.part=s,this.workerContext)this.workerContext.worker.postMessage({instanceNo:d,cmd:"demux",data:t,decryptdata:_,chunkMeta:l,state:A},t instanceof ArrayBuffer?[t]:[]);else if(p){const e=p.push(t,_,l,A);is(e)?e.then((t=>{this.handleTransmuxComplete(t)})).catch((t=>{this.transmuxerError(t,l,"transmuxer-interface push error")})):this.handleTransmuxComplete(e)}}flush(t){t.transmuxing.start=self.performance.now();const{instanceNo:e,transmuxer:n}=this;if(this.workerContext)this.workerContext.worker.postMessage({instanceNo:e,cmd:"flush",chunkMeta:t});else if(n){const e=n.flush(t);is(e)?e.then((e=>{this.handleFlushResult(e,t)})).catch((e=>{this.transmuxerError(e,t,"transmuxer-interface flush error")})):this.handleFlushResult(e,t)}}transmuxerError(t,e,n){this.hls&&(this.error=t,this.hls.trigger(l.ERROR,{type:a.MEDIA_ERROR,details:o.FRAG_PARSING_ERROR,chunkMeta:e,frag:this.frag||void 0,part:this.part||void 0,fatal:!1,error:t,err:t,reason:n}))}handleFlushResult(t,e){t.forEach((t=>{this.handleTransmuxComplete(t)})),this.onFlush(e)}configureTransmuxer(t){const{instanceNo:e,transmuxer:n}=this;this.workerContext?this.workerContext.worker.postMessage({instanceNo:e,cmd:"configure",config:t}):n&&n.configure(t)}handleTransmuxComplete(t){t.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(t)}}class ls extends w{constructor(t,e){super(e,t.logger),this.hls=void 0,this.canLoad=!1,this.timer=-1,this.hls=t}destroy(){this.clearTimer(),this.hls=this.log=this.warn=null}clearTimer(){-1!==this.timer&&(self.clearTimeout(this.timer),this.timer=-1)}startLoad(){this.canLoad=!0,this.loadPlaylist()}stopLoad(){this.canLoad=!1,this.clearTimer()}switchParams(t,e,n){const i=null==e?void 0:e.renditionReports;if(i){let r=-1;for(let n=0;n<i.length;n++){const s=i[n];let a;try{a=new self.URL(s.URI,e.url).href}catch(t){this.warn(`Could not construct new URL for Rendition Report: ${t}`),a=s.URI||""}if(a===t){r=n;break}a===t.substring(0,a.length)&&(r=n)}if(-1!==r){const t=i[r],s=parseInt(t["LAST-MSN"])||e.lastPartSn;let a=parseInt(t["LAST-PART"])||e.lastPartIndex;if(this.hls.config.lowLatencyMode){const t=Math.min(e.age-e.partTarget,e.targetduration);a>=0&&t>e.partTarget&&(a+=1)}const o=n&&Qt(n);return new Xt(s,a>=0?a:void 0,o)}}}loadPlaylist(t){this.clearTimer()}loadingPlaylist(t,e){this.clearTimer()}shouldLoadPlaylist(t){return this.canLoad&&!!t&&!!t.url&&(!t.details||t.details.live)}getUrlWithDirectives(t,e){if(e)try{return e.addDirectives(t)}catch(t){this.warn(`Could not construct new URL with HLS Delivery Directives: ${t}`)}return t}playlistLoaded(t,e,n){const{details:i,stats:r}=e,s=self.performance.now(),u=r.loading.first?Math.max(0,s-r.loading.first):0;i.advancedDateTime=Date.now()-u;const h=this.hls.config.timelineOffset;if(h!==i.appliedTimelineOffset){const t=Math.max(h||0,0);i.appliedTimelineOffset=t,i.fragments.forEach((e=>{e.setStart(e.playlistOffset+t)}))}if(i.live||null!=n&&n.live){const h="levelInfo"in e?e.levelInfo:e.track;if(i.reloaded(n),n&&i.fragments.length>0){ti(n,i,this);const t=i.playlistParsingError;if(t){this.warn(t);const n=this.hls;if(!n.config.ignorePlaylistParsingErrors){var c;const{networkDetails:s}=e;return void n.trigger(l.ERROR,{type:a.NETWORK_ERROR,details:o.LEVEL_PARSING_ERROR,fatal:!1,url:i.url,error:t,reason:t.message,level:e.level||void 0,parent:null==(c=i.fragments[0])?void 0:c.type,networkDetails:s,stats:r})}i.playlistParsingError=null}}-1===i.requestScheduled&&(i.requestScheduled=r.loading.start);const d=this.hls.mainForwardBufferInfo,f=d?d.end-d.len:0,p=ri(i,1e3*(i.edge-f));if(i.requestScheduled+p<s?i.requestScheduled=s:i.requestScheduled+=p,this.log(`live playlist ${t} ${i.advanced?"REFRESHED "+i.lastPartSn+"-"+i.lastPartIndex:i.updated?"UPDATED":"MISSED"}`),!this.canLoad||!i.live)return;let g,_,m;if(i.canBlockReload&&i.endSN&&i.advanced){const t=this.hls.config.lowLatencyMode,r=i.lastPartSn,a=i.endSN,o=i.lastPartIndex,l=r===a;-1!==o?l?(_=a+1,m=t?0:o):(_=r,m=t?o+1:i.maxPartIndex):_=a+1;const u=i.age,c=u+i.ageHeader;let d=Math.min(c-i.partTarget,1.5*i.targetduration);if(d>0){if(c>3*i.targetduration)this.log(`Playlist last advanced ${u.toFixed(2)}s ago. Omitting segment and part directives.`),_=void 0,m=void 0;else if(null!=n&&n.tuneInGoal&&c-i.partTarget>n.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${n.tuneInGoal} to: ${d} with playlist age: ${i.age}`),d=0;else{const t=Math.floor(d/i.targetduration);if(_+=t,void 0!==m){m+=Math.round(d%i.targetduration/i.partTarget)}this.log(`CDN Tune-in age: ${i.ageHeader}s last advanced ${u.toFixed(2)}s goal: ${d} skip sn ${t} to part ${m}`)}i.tuneInGoal=d}if(g=this.getDeliveryDirectives(i,e.deliveryDirectives,_,m),t||!l)return i.requestScheduled=s,void this.loadingPlaylist(h,g)}else(i.canBlockReload||i.canSkipUntil)&&(g=this.getDeliveryDirectives(i,e.deliveryDirectives,_,m));g&&void 0!==_&&i.canBlockReload&&(i.requestScheduled=r.loading.first+Math.max(p-2*u,p/2)),this.scheduleLoading(h,g,i)}else this.clearTimer()}scheduleLoading(t,e,n){const i=n||t.details;if(!i)return void this.loadingPlaylist(t,e);const r=self.performance.now(),s=i.requestScheduled;if(r>=s)return void this.loadingPlaylist(t,e);const a=s-r;this.log(`reload live playlist ${t.name||t.bitrate+"bps"} in ${Math.round(a)} ms`),this.clearTimer(),this.timer=self.setTimeout((()=>this.loadingPlaylist(t,e)),a)}getDeliveryDirectives(t,e,n,i){let r=Qt(t);return null!=e&&e.skip&&t.deltaUpdateFailed&&(n=e.msn,i=e.part,r=Wt),new Xt(n,i,r)}checkRetry(t){const e=t.details,n=_e(t),i=t.errorAction,{action:r,retryCount:s=0,retryConfig:a}=i||{},o=!!i&&!!a&&(r===De||!i.resolved&&r===Se);if(o){var l;if(s>=a.maxNumRetry)return!1;if(n&&null!=(l=t.context)&&l.deliveryDirectives)this.warn(`Retrying playlist loading ${s+1}/${a.maxNumRetry} after "${e}" without delivery-directives`),this.loadPlaylist();else{const t=be(a,s);this.clearTimer(),this.timer=self.setTimeout((()=>this.loadPlaylist()),t),this.warn(`Retrying playlist loading ${s+1}/${a.maxNumRetry} after "${e}" in ${t}ms`)}t.levelRetry=!0,i.resolved=!0}return o}}function us(t,e){if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(!hs(t[n].attrs,e[n].attrs))return!1;return!0}function hs(t,e,n){const i=t["STABLE-RENDITION-ID"];return i&&!n?i===e["STABLE-RENDITION-ID"]:!(n||["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED","ASSOC-LANGUAGE"]).some((n=>t[n]!==e[n]))}function cs(t,e){return e.label.toLowerCase()===t.name.toLowerCase()&&(!e.language||e.language.toLowerCase()===(t.lang||"").toLowerCase())}class ds{constructor(t){this.tracks=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.tracks=t}destroy(){this.tracks=this.queues=null}append(t,e,n){if(null===this.queues||null===this.tracks)return;const i=this.queues[e];i.push(t),1!==i.length||n||this.executeNext(e)}appendBlocker(t){return new Promise((e=>{const n={label:"async-blocker",execute:e,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.append(n,t)}))}prependBlocker(t){return new Promise((e=>{if(this.queues){const n={label:"async-blocker-prepend",execute:e,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.queues[t].unshift(n)}}))}removeBlockers(){null!==this.queues&&[this.queues.video,this.queues.audio,this.queues.audiovideo].forEach((t=>{var e;const n=null==(e=t[0])?void 0:e.label;"async-blocker"!==n&&"async-blocker-prepend"!==n||(t[0].execute(),t.splice(0,1))}))}unblockAudio(t){if(null===this.queues)return;this.queues.audio[0]===t&&this.shiftAndExecuteNext("audio")}executeNext(t){if(null===this.queues||null===this.tracks)return;const e=this.queues[t];if(e.length){const i=e[0];try{i.execute()}catch(e){var n;if(i.onError(e),null===this.queues||null===this.tracks)return;const r=null==(n=this.tracks[t])?void 0:n.buffer;null!=r&&r.updating||this.shiftAndExecuteNext(t)}}}shiftAndExecuteNext(t){null!==this.queues&&(this.queues[t].shift(),this.executeNext(t))}current(t){var e;return(null==(e=this.queues)?void 0:e[t][0])||null}toString(){const{queues:t,tracks:e}=this;return null===t||null===e?"<destroyed>":`\n${this.list("video")}\n${this.list("audio")}\n${this.list("audiovideo")}}`}list(t){var e,n;return null!=(e=this.queues)&&e[t]||null!=(n=this.tracks)&&n[t]?`${t}: (${this.listSbInfo(t)}) ${this.listOps(t)}`:""}listSbInfo(t){var e;const n=null==(e=this.tracks)?void 0:e[t],i=null==n?void 0:n.buffer;return i?`SourceBuffer${i.updating?" updating":""}${n.ended?" ended":""}${n.ending?" ending":""}`:"none"}listOps(t){var e;return(null==(e=this.queues)?void 0:e[t].map((t=>t.label)).join(", "))||""}}const fs=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/,ps="HlsJsTrackRemovedError";class gs extends Error{constructor(t){super(t),this.name=ps}}function _s(t){const e=t.querySelectorAll("source");[].slice.call(e).forEach((e=>{t.removeChild(e)}))}function ms(t){return"audio"===t?1:0}class vs{constructor(t){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=t,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}setStreamController(t){this.streamController=t}destroy(){this.hls&&this.unregisterListener(),this.timer&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null}registerListeners(){const{hls:t}=this;t.on(l.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),t.on(l.MEDIA_ATTACHING,this.onMediaAttaching,this),t.on(l.MANIFEST_PARSED,this.onManifestParsed,this),t.on(l.LEVELS_UPDATED,this.onLevelsUpdated,this),t.on(l.BUFFER_CODECS,this.onBufferCodecs,this),t.on(l.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){const{hls:t}=this;t.off(l.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),t.off(l.MEDIA_ATTACHING,this.onMediaAttaching,this),t.off(l.MANIFEST_PARSED,this.onManifestParsed,this),t.off(l.LEVELS_UPDATED,this.onLevelsUpdated,this),t.off(l.BUFFER_CODECS,this.onBufferCodecs,this),t.off(l.MEDIA_DETACHING,this.onMediaDetaching,this)}onFpsDropLevelCapping(t,e){const n=this.hls.levels[e.droppedLevel];this.isLevelAllowed(n)&&this.restrictedLevels.push({bitrate:n.bitrate,height:n.height,width:n.width})}onMediaAttaching(t,e){this.media=e.media instanceof HTMLVideoElement?e.media:null,this.clientRect=null,this.timer&&this.hls.levels.length&&this.detectPlayerSize()}onManifestParsed(t,e){const n=this.hls;this.restrictedLevels=[],this.firstLevel=e.firstLevel,n.config.capLevelToPlayerSize&&e.video&&this.startCapping()}onLevelsUpdated(t,e){this.timer&&i(this.autoLevelCapping)&&this.detectPlayerSize()}onBufferCodecs(t,e){this.hls.config.capLevelToPlayerSize&&e.video&&this.startCapping()}onMediaDetaching(){this.stopCapping(),this.media=null}detectPlayerSize(){if(this.media){if(this.mediaHeight<=0||this.mediaWidth<=0)return void(this.clientRect=null);const t=this.hls.levels;if(t.length){const e=this.hls,n=this.getMaxLevel(t.length-1);n!==this.autoLevelCapping&&e.logger.log(`Setting autoLevelCapping to ${n}: ${t[n].height}p@${t[n].bitrate} for media ${this.mediaWidth}x${this.mediaHeight}`),e.autoLevelCapping=n,e.autoLevelEnabled&&e.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=e.autoLevelCapping}}}getMaxLevel(t){const e=this.hls.levels;if(!e.length)return-1;const n=e.filter(((e,n)=>this.isLevelAllowed(e)&&n<=t));return this.clientRect=null,vs.getMaxLevelByMediaSize(n,this.mediaWidth,this.mediaHeight)}startCapping(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())}stopCapping(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)}getDimensions(){if(this.clientRect)return this.clientRect;const t=this.media,e={width:0,height:0};if(t){const n=t.getBoundingClientRect();e.width=n.width,e.height=n.height,e.width||e.height||(e.width=n.right-n.left||t.width||0,e.height=n.bottom-n.top||t.height||0)}return this.clientRect=e,e}get mediaWidth(){return this.getDimensions().width*this.contentScaleFactor}get mediaHeight(){return this.getDimensions().height*this.contentScaleFactor}get contentScaleFactor(){let t=1;if(!this.hls.config.ignoreDevicePixelRatio)try{t=self.devicePixelRatio}catch(t){}return Math.min(t,this.hls.config.maxDevicePixelRatio)}isLevelAllowed(t){return!this.restrictedLevels.some((e=>t.bitrate===e.bitrate&&t.width===e.width&&t.height===e.height))}static getMaxLevelByMediaSize(t,e,n){if(null==t||!t.length)return-1;let i=t.length-1;const r=Math.max(e,n);for(let e=0;e<t.length;e+=1){const n=t[e];if((n.width>=r||n.height>=r)&&(s=n,!(a=t[e+1])||s.width!==a.width||s.height!==a.height)){i=e;break}}var s,a;return i}}const ys={MANIFEST:"m",AUDIO:"a",VIDEO:"v",MUXED:"av",INIT:"i",CAPTION:"c",TIMED_TEXT:"tt",KEY:"k",OTHER:"o"},bs={HLS:"h"};class Es{constructor(t,e){Array.isArray(t)&&(t=t.map((t=>t instanceof Es?t:new Es(t)))),this.value=t,this.params=e}}function ws(t,e,n,i){return new Error(`failed to ${t} "${r=e,Array.isArray(r)?JSON.stringify(r):r instanceof Map?"Map{}":r instanceof Set?"Set{}":"object"==typeof r?JSON.stringify(r):String(r)}" as ${n}`,{cause:i});var r}function Ts(t,e,n){return ws("serialize",t,e,n)}class ks{constructor(t){this.description=t}}const Ss="Bare Item";function As(t){if(!1===ArrayBuffer.isView(t))throw Ts(t,"Byte Sequence");return`:${e=t,btoa(String.fromCharCode(...e))}:`;var e}function Ds(t){if(function(t){return t<-999999999999999||999999999999999<t}(t))throw Ts(t,"Integer");return t.toString()}function Cs(t,e){if(t<0)return-Cs(-t,e);const n=Math.pow(10,e);if(Math.abs(t*n%1-.5)<Number.EPSILON){const e=Math.floor(t*n);return(e%2==0?e:e+1)/n}return Math.round(t*n)/n}function xs(t){const e=Cs(t,3);if(Math.floor(Math.abs(e)).toString().length>12)throw Ts(t,"Decimal");const n=e.toString();return n.includes(".")?n:`${n}.0`}const Rs=/[\x00-\x1f\x7f]+/;function Ls(t){const e=(n=t).description||n.toString().slice(7,-1);var n;if(!1===/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e))throw Ts(e,"Token");return e}function Is(t){switch(typeof t){case"number":if(!i(t))throw Ts(t,Ss);return Number.isInteger(t)?Ds(t):xs(t);case"string":return function(t){if(Rs.test(t))throw Ts(t,"String");return`"${t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}(t);case"symbol":return Ls(t);case"boolean":return function(t){if("boolean"!=typeof t)throw Ts(t,"Boolean");return t?"?1":"?0"}(t);case"object":if(t instanceof Date)return function(t){return`@${Ds(t.getTime()/1e3)}`}(t);if(t instanceof Uint8Array)return As(t);if(t instanceof ks)return Ls(t);default:throw Ts(t,Ss)}}function Ps(t){if(!1===/^[a-z*][a-z0-9\-_.*]*$/.test(t))throw Ts(t,"Key");return t}function Os(t){return null==t?"":Object.entries(t).map((([t,e])=>!0===e?`;${Ps(t)}`:`;${Ps(t)}=${Is(e)}`)).join("")}function Fs(t){return t instanceof Es?`${Is(t.value)}${Os(t.params)}`:Is(t)}function Ms(t,e={whitespace:!0}){if("object"!=typeof t||null==t)throw Ts(t,"Dict");const n=t instanceof Map?t.entries():Object.entries(t),i=(null==e?void 0:e.whitespace)?" ":"";return Array.from(n).map((([t,e])=>{e instanceof Es==!1&&(e=new Es(e));let n=Ps(t);var i;return!0===e.value?n+=Os(e.params):(n+="=",Array.isArray(e.value)?n+=`(${(i=e).value.map(Fs).join(" ")})${Os(i.params)}`:n+=Fs(e)),n})).join(`,${i}`)}function Ns(t,e){return Ms(t,e)}const Bs="CMCD-Object",Us="CMCD-Request",$s="CMCD-Session",Gs="CMCD-Status",Ks={br:Bs,ab:Bs,d:Bs,ot:Bs,tb:Bs,tpb:Bs,lb:Bs,tab:Bs,lab:Bs,url:Bs,pb:Us,bl:Us,tbl:Us,dl:Us,ltc:Us,mtp:Us,nor:Us,nrr:Us,rc:Us,sn:Us,sta:Us,su:Us,ttfb:Us,ttfbb:Us,ttlb:Us,cmsdd:Us,cmsds:Us,smrt:Us,df:Us,cs:Us,ts:Us,cid:$s,pr:$s,sf:$s,sid:$s,st:$s,v:$s,msd:$s,bs:Gs,bsd:Gs,cdn:Gs,rtp:Gs,bg:Gs,pt:Gs,ec:Gs,e:Gs},js=Us;function Vs(t,e){const n={};if(!t)return n;const i=Object.keys(t),r=e?(s=e,Object.keys(s).reduce(((t,e)=>{var n;return null===(n=s[e])||void 0===n||n.forEach((n=>t[n]=e)),t}),{})):{};var s;return i.reduce(((e,n)=>{var i;const s=Ks[n]||r[n]||js;return(null!==(i=e[s])&&void 0!==i?i:e[s]={})[n]=t[n],e}),n)}const Zs="event";const zs=t=>Math.round(t),Hs=(t,e)=>Array.isArray(t)?t.map((t=>Hs(t,e))):t instanceof Es&&"string"==typeof t.value?new Es(Hs(t.value,e),t.params):(e.baseUrl&&(t=function(t,e){const n=new URL(t),i=new URL(e);if(n.origin!==i.origin)return t;const r=n.pathname.split("/").slice(1),s=i.pathname.split("/").slice(1,-1);for(;r[0]===s[0];)r.shift(),s.shift();for(;s.length;)s.shift(),r.unshift("..");return r.join("/")+n.search+n.hash}(t,e.baseUrl)),1===e.version?encodeURIComponent(t):t),Ws=t=>100*zs(t/100),Ys={br:zs,d:zs,bl:Ws,dl:Ws,mtp:Ws,nor:(t,e)=>{let n=t;return e.version>=2&&(t instanceof Es&&"string"==typeof t.value?n=new Es([t]):"string"==typeof t&&(n=[t])),Hs(n,e)},rtp:Ws,tb:zs},qs="request",Qs="response",Xs=["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"],Js=["e"],ta=/^[a-zA-Z0-9-.]+-[a-zA-Z0-9-.]+$/;function ea(t){return ta.test(t)}const na=["d","dl","nor","ot","rtp","su"];const ia=["cmsdd","cmsds","rc","smrt","ttfb","ttfbb","ttlb","url"];const ra=["bl","br","bs","cid","d","dl","mtp","nor","nrr","ot","pr","rtp","sf","sid","st","su","tb","v"];function sa(t){return ra.includes(t)||ea(t)}const aa={[Qs]:function(t){return Xs.includes(t)||na.includes(t)||ia.includes(t)||ea(t)},[Zs]:function(t){return Xs.includes(t)||Js.includes(t)||ea(t)},[qs]:function(t){return Xs.includes(t)||na.includes(t)||ea(t)}};function oa(t,e={}){const n={};if(null==t||"object"!=typeof t)return n;const r=e.version||t.v||1,s=e.reportingMode||qs,a=1===r?sa:aa[s];let o=Object.keys(t).filter(a);const l=e.filter;"function"==typeof l&&(o=o.filter(l));const u=s===Qs||s===Zs;u&&!o.includes("ts")&&o.push("ts"),r>1&&!o.includes("v")&&o.push("v");const h=y({},Ys,e.formatters),c={version:r,reportingMode:s,baseUrl:e.baseUrl};return o.sort().forEach((e=>{let s=t[e];const a=h[e];if("function"==typeof a&&(s=a(s,c)),"v"===e){if(1===r)return;s=r}"pr"==e&&1===s||(u&&"ts"===e&&!i(s)&&(s=Date.now()),function(t){return"number"==typeof t?i(t):null!=t&&""!==t&&!1!==t}(s)&&(function(t){return["ot","sf","st","e","sta"].includes(t)}(e)&&"string"==typeof s&&(s=new ks(s)),n[e]=s))})),n}function la(t,e,n){return y(t,function(t,e={}){const n={};if(!t)return n;const i=Vs(oa(t,e),null==e?void 0:e.customHeaderMap);return Object.entries(i).reduce(((t,[e,n])=>{const i=Ns(n,{whitespace:!1});return i&&(t[e]=i),t}),n)}(e,n))}function ua(t,e={}){if(!t)return"";const n=function(t,e={}){return t?Ns(oa(t,e),{whitespace:!1}):""}(t,e);return encodeURIComponent(n)}const ha=/CMCD=[^&#]+/;function ca(t,e,n){const i=function(t,e={}){return t?`CMCD=${ua(t,e)}`:""}(e,n);if(!i)return t;if(ha.test(t))return t.replace(ha,i);const r=t.includes("?")?"&":"?";return`${t}${r}${i}`}function da(t,e,n,i){t&&Object.keys(e).forEach((r=>{const s=t.filter((t=>t.groupId===r)).map((t=>{const s=y({},t);return s.details=void 0,s.attrs=new hn(s.attrs),s.url=s.attrs.URI=fa(t.url,t.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",n),s.groupId=s.attrs["GROUP-ID"]=e[r],s.attrs["PATHWAY-ID"]=i,s}));t.push(...s)}))}function fa(t,e,n,i){const{HOST:r,PARAMS:s,[n]:a}=i;let o;e&&(o=null==a?void 0:a[e],o&&(t=o));const l=new self.URL(t);return r&&!o&&(l.host=r),s&&Object.keys(s).sort().forEach((t=>{t&&l.searchParams.set(t,s[t])})),l.href}class pa extends w{constructor(t){super("eme",t.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=pa.CDMCleanupPromise?[pa.CDMCleanupPromise]:[],this.bannedKeyIds={},this.onMediaEncrypted=t=>{const{initDataType:e,initData:n}=t,i=`"${t.type}" event: init data type: "${e}"`;if(this.debug(i),null!==n){if(!this.keyFormatPromise){let t=Object.keys(this.keySystemAccessPromises);t.length||(t=Rn(this.config));const e=t.map(xn).filter((t=>!!t));this.keyFormatPromise=this.getKeyFormatPromise(e)}this.keyFormatPromise.then((r=>{const s=Cn(r);if("sinf"!==e||s!==Tn.FAIRPLAY)return void this.log(`Ignoring "${t.type}" event with init data type: "${e}" for selected key-system ${s}`);let a;try{const t=et(new Uint8Array(n)),e=pt(vn(JSON.parse(t).sinf));if(!e)throw new Error("'schm' box missing or not cbcs/cenc with schi > tenc");a=new Uint8Array(e.subarray(8,24))}catch(t){return void this.warn(`${i} Failed to parse sinf: ${t}`)}const o=I(a),{keyIdToKeySessionPromise:l,mediaKeySessions:u}=this;let h=l[o];for(let t=0;t<u.length;t++){const i=u[t],r=i.decryptdata;if(!r.keyId)continue;const s=I(r.keyId);if(pn(a,r.keyId)||-1!==r.uri.replace(/-/g,"").indexOf(o)){if(h=l[s],!h)continue;if(r.pssh)break;delete l[s],r.pssh=new Uint8Array(n),r.keyId=a,h=l[o]=h.then((()=>this.generateRequestWithPreferredKeySession(i,e,n,"encrypted-event-key-match"))),h.catch((t=>this.handleError(t)));break}}h||this.handleError(new Error(`Key ID ${o} not encountered in playlist. Key-system sessions ${u.length}.`))})).catch((t=>this.handleError(t)))}},this.onWaitingForKey=t=>{this.log(`"${t.type}" event`)},this.hls=t,this.config=t.config,this.registerListeners()}destroy(){this.onDestroying(),this.onMediaDetached();const t=this.config;t.requestMediaKeySystemAccessFunc=null,t.licenseXhrSetup=t.licenseResponseCallback=void 0,t.drmSystems=t.drmSystemOptions={},this.hls=this.config=this.keyIdToKeySessionPromise=null,this.onMediaEncrypted=this.onWaitingForKey=null}registerListeners(){this.hls.on(l.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(l.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(l.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(l.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.on(l.DESTROYING,this.onDestroying,this)}unregisterListeners(){this.hls.off(l.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(l.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(l.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(l.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.off(l.DESTROYING,this.onDestroying,this)}getLicenseServerUrl(t){const{drmSystems:e,widevineLicenseUrl:n}=this.config,i=null==e?void 0:e[t];return i?i.licenseUrl:t===Tn.WIDEVINE&&n?n:void 0}getLicenseServerUrlOrThrow(t){const e=this.getLicenseServerUrl(t);if(void 0===e)throw new Error(`no license server URL configured for key-system "${t}"`);return e}getServerCertificateUrl(t){const{drmSystems:e}=this.config,n=null==e?void 0:e[t];if(n)return n.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${t}"]`)}attemptKeySystemAccess(t){const e=this.hls.levels,n=(t,e,n)=>!!t&&n.indexOf(t)===e,i=e.map((t=>t.audioCodec)).filter(n),r=e.map((t=>t.videoCodec)).filter(n);return i.length+r.length===0&&r.push("avc1.42e01e"),new Promise(((e,n)=>{const s=t=>{const l=t.shift();this.getMediaKeysPromise(l,i,r).then((t=>e({keySystem:l,mediaKeys:t}))).catch((e=>{t.length?s(t):n(e instanceof ma?e:new ma({type:a.KEY_SYSTEM_ERROR,details:o.KEY_SYSTEM_NO_ACCESS,error:e,fatal:!0},e.message))}))};s(t)}))}requestMediaKeySystemAccess(t,e){const{requestMediaKeySystemAccessFunc:n}=this.config;if("function"!=typeof n){let t=`Configured requestMediaKeySystemAccess is not a function ${n}`;return null===Ln&&"http:"===self.location.protocol&&(t=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(new Error(t))}return n(t,e)}getMediaKeysPromise(t,e,n){var i;const r=function(t,e,n,i){let r;switch(t){case Tn.FAIRPLAY:r=["cenc","sinf"];break;case Tn.WIDEVINE:case Tn.PLAYREADY:r=["cenc"];break;case Tn.CLEARKEY:r=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${t}`)}return function(t,e,n,i){return[{initDataTypes:t,persistentState:i.persistentState||"optional",distinctiveIdentifier:i.distinctiveIdentifier||"optional",sessionTypes:i.sessionTypes||[i.sessionType||"temporary"],audioCapabilities:e.map((t=>({contentType:`audio/mp4; codecs=${t}`,robustness:i.audioRobustness||"",encryptionScheme:i.audioEncryptionScheme||null}))),videoCapabilities:n.map((t=>({contentType:`video/mp4; codecs=${t}`,robustness:i.videoRobustness||"",encryptionScheme:i.videoEncryptionScheme||null})))}]}(r,e,n,i)}(t,e,n,this.config.drmSystemOptions||{});let s=this.keySystemAccessPromises[t],a=null==(i=s)?void 0:i.keySystemAccess;if(!a){this.log(`Requesting encrypted media "${t}" key-system access with config: ${ne(r)}`),a=this.requestMediaKeySystemAccess(t,r);const e=s=this.keySystemAccessPromises[t]={keySystemAccess:a};return a.catch((e=>{this.log(`Failed to obtain access to key-system "${t}": ${e}`)})),a.then((n=>{this.log(`Access for key-system "${n.keySystem}" obtained`);const i=this.fetchServerCertificate(t);this.log(`Create media-keys for "${t}"`);const r=e.mediaKeys=n.createMediaKeys().then((n=>(this.log(`Media-keys created for "${t}"`),e.hasMediaKeys=!0,i.then((e=>e?this.setMediaKeysServerCertificate(n,t,e):n)))));return r.catch((e=>{this.error(`Failed to create media-keys for "${t}"}: ${e}`)})),r}))}return a.then((()=>s.mediaKeys))}createMediaKeySessionContext({decryptdata:t,keySystem:e,mediaKeys:n}){this.log(`Creating key-system session "${e}" keyId: ${I(t.keyId||[])} keyUri: ${t.uri}`);const i=n.createSession(),r={decryptdata:t,keySystem:e,mediaKeys:n,mediaKeysSession:i,keyStatus:"status-pending"};return this.mediaKeySessions.push(r),r}renewKeySession(t){const e=t.decryptdata;if(e.pssh){const n=this.createMediaKeySessionContext(t),i=ga(e),r="cenc";this.keyIdToKeySessionPromise[i]=this.generateRequestWithPreferredKeySession(n,r,e.pssh.buffer,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(t)}updateKeySession(t,e){const n=t.mediaKeysSession;return this.log(`Updating key-session "${n.sessionId}" for keyId ${I(t.decryptdata.keyId||[])}\n } (data length: ${e.byteLength})`),n.update(e)}getSelectedKeySystemFormats(){return Object.keys(this.keySystemAccessPromises).map((t=>({keySystem:t,hasMediaKeys:this.keySystemAccessPromises[t].hasMediaKeys}))).filter((({hasMediaKeys:t})=>!!t)).map((({keySystem:t})=>xn(t))).filter((t=>!!t))}getKeySystemAccess(t){return this.getKeySystemSelectionPromise(t).then((({keySystem:t,mediaKeys:e})=>this.attemptSetMediaKeys(t,e)))}selectKeySystem(t){return new Promise(((e,n)=>{this.getKeySystemSelectionPromise(t).then((({keySystem:t})=>{const i=xn(t);i?e(i):n(new Error(`Unable to find format for key-system "${t}"`))})).catch(n)}))}selectKeySystemFormat(t){const e=Object.keys(t.levelkeys||{});return this.keyFormatPromise||(this.log(`Selecting key-system from fragment (sn: ${t.sn} ${t.type}: ${t.level}) key formats ${e.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(e)),this.keyFormatPromise}getKeyFormatPromise(t){const e=Rn(this.config),n=t.map(Cn).filter((t=>!!t&&-1!==e.indexOf(t)));return this.selectKeySystem(n)}getKeyStatus(t){const{mediaKeySessions:e}=this;for(let n=0;n<e.length;n++){const i=_a(t,e[n]);if(i)return i}}loadKey(t){const e=t.keyInfo.decryptdata,n=ga(e),i=this.bannedKeyIds[n];if(i||"internal-error"===this.getKeyStatus(e)){const n=va(i||"internal-error",e);return this.handleError(n,t.frag),Promise.reject(n)}const r=`(keyId: ${n} format: "${e.keyFormat}" method: ${e.method} uri: ${e.uri})`;this.log(`Starting session for key ${r}`);const s=this.keyIdToKeySessionPromise[n];if(!s){const i=this.getKeySystemForKeyPromise(e).then((({keySystem:n,mediaKeys:i})=>(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${t.frag.sn} ${t.frag.type}: ${t.frag.level} using key ${r}`),this.attemptSetMediaKeys(n,i).then((()=>(this.throwIfDestroyed(),this.createMediaKeySessionContext({keySystem:n,mediaKeys:i,decryptdata:e}))))))).then((t=>{const n=e.pssh?e.pssh.buffer:null;return this.generateRequestWithPreferredKeySession(t,"cenc",n,"playlist-key")}));return i.catch((e=>this.handleError(e,t.frag))),this.keyIdToKeySessionPromise[n]=i,i}return s.catch((n=>{if(n instanceof ma){const i=E({},n.data);"internal-error"===this.getKeyStatus(e)&&(i.decryptdata=e);const r=new ma(i,n.message);this.handleError(r,t.frag)}})),s}throwIfDestroyed(t="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(t,e){if(this.hls)if(t instanceof ma){e&&(t.data.frag=e);const n=t.data.decryptdata;this.error(`${t.message}${n?` (${I(n.keyId||[])})`:""}`),this.hls.trigger(l.ERROR,t.data)}else this.error(t.message),this.hls.trigger(l.ERROR,{type:a.KEY_SYSTEM_ERROR,details:o.KEY_SYSTEM_NO_KEYS,error:t,fatal:!0})}getKeySystemForKeyPromise(t){const e=ga(t),n=this.keyIdToKeySessionPromise[e];if(!n){const e=Cn(t.keyFormat),n=e?[e]:Rn(this.config);return this.attemptKeySystemAccess(n)}return n}getKeySystemSelectionPromise(t){if(t.length||(t=Rn(this.config)),0===t.length)throw new ma({type:a.KEY_SYSTEM_ERROR,details:o.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${ne({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(t)}attemptSetMediaKeys(t,e){if(this.mediaKeys===e)return Promise.resolve();const n=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${t}"`);const i=Promise.all(n).then((()=>{if(!this.media)throw this.mediaKeys=null,new Error("Attempted to set mediaKeys without media element attached");return this.media.setMediaKeys(e)}));return this.mediaKeys=e,this.setMediaKeysQueue.push(i),i.then((()=>{this.log(`Media-keys set for "${t}"`),n.push(i),this.setMediaKeysQueue=this.setMediaKeysQueue.filter((t=>-1===n.indexOf(t)))}))}generateRequestWithPreferredKeySession(t,e,n,i){var r;const s=null==(r=this.config.drmSystems)||null==(r=r[t.keySystem])?void 0:r.generateRequest;if(s)try{const i=s.call(this.hls,e,n,t);if(!i)throw new Error("Invalid response from configured generateRequest filter");e=i.initDataType,n=i.initData?i.initData:null,t.decryptdata.pssh=n?new Uint8Array(n):null}catch(t){if(this.warn(t.message),this.hls&&this.hls.config.debug)throw t}if(null===n)return this.log(`Skipping key-session request for "${i}" (no initData)`),Promise.resolve(t);const l=ga(t.decryptdata),u=t.decryptdata.uri;this.log(`Generating key-session request for "${i}" keyId: ${l} URI: ${u} (init data type: ${e} length: ${n.byteLength})`);const h=new Ni,c=t._onmessage=e=>{const n=t.mediaKeysSession;if(!n)return void h.emit("error",new Error("invalid state"));const{messageType:i,message:r}=e;this.log(`"${i}" message event for session "${n.sessionId}" message size: ${r.byteLength}`),"license-request"===i||"license-renewal"===i?this.renewLicense(t,r).catch((t=>{h.eventNames().length?h.emit("error",t):this.handleError(t)})):"license-release"===i?t.keySystem===Tn.FAIRPLAY&&this.updateKeySession(t,yn("acknowledged")).then((()=>this.removeSession(t))).catch((t=>this.handleError(t))):this.warn(`unhandled media key message type "${i}"`)},d=(t,e)=>{let n;e.keyStatus=t,t.startsWith("usable")?h.emit("resolved"):"internal-error"===t||"output-restricted"===t||"output-downscaled"===t?n=va(t,e.decryptdata):"expired"===t?n=new Error(`key expired (keyId: ${l})`):"released"===t?n=new Error("key released"):"status-pending"===t||this.warn(`unhandled key status change "${t}" (keyId: ${l})`),n&&(h.eventNames().length?h.emit("error",n):this.handleError(n))},f=t._onkeystatuseschange=e=>{if(!t.mediaKeysSession)return void h.emit("error",new Error("invalid state"));const n=this.getKeyStatuses(t);if(!Object.keys(n).some((t=>"status-pending"!==n[t])))return;if("expired"===n[l])return this.log(`Expired key ${ne(n)} in key-session "${t.mediaKeysSession.sessionId}"`),void this.renewKeySession(t);let i=n[l];if(i)d(i,t);else{var r;const e=0;t.keyStatusTimeouts||(t.keyStatusTimeouts={}),(r=t.keyStatusTimeouts)[l]||(r[l]=self.setTimeout((()=>{if(!t.mediaKeysSession||!this.mediaKeys)return;const n=this.getKeyStatus(t.decryptdata);if(n&&"status-pending"!==n)return this.log(`No status for keyId ${l} in key-session "${t.mediaKeysSession.sessionId}". Using session key-status ${n} from other session.`),d(n,t);this.log(`key status for ${l} in key-session "${t.mediaKeysSession.sessionId}" timed out after ${e}ms`),i="internal-error",d(i,t)}),e)),this.log(`No status for keyId ${l} (${ne(n)}).`)}};_i(t.mediaKeysSession,"message",c),_i(t.mediaKeysSession,"keystatuseschange",f);const p=new Promise(((t,e)=>{h.on("error",e),h.on("resolved",t)}));return t.mediaKeysSession.generateRequest(e,n).then((()=>{this.log(`Request generated for key-session "${t.mediaKeysSession.sessionId}" keyId: ${l} URI: ${u}`)})).catch((e=>{throw new ma({type:a.KEY_SYSTEM_ERROR,details:o.KEY_SYSTEM_NO_SESSION,error:e,decryptdata:t.decryptdata,fatal:!1},`Error generating key-session request: ${e}`)})).then((()=>p)).catch((e=>(h.removeAllListeners(),this.removeSession(t).then((()=>{throw e}))))).then((()=>(h.removeAllListeners(),t)))}getKeyStatuses(t){const e={};return t.mediaKeysSession.keyStatuses.forEach(((n,i)=>{if("string"==typeof i&&"object"==typeof n){const t=i;i=n,n=t}const r="buffer"in i?new Uint8Array(i.buffer,i.byteOffset,i.byteLength):new Uint8Array(i);t.keySystem===Tn.PLAYREADY&&16===r.length&&bn(r);const s=I(r);"internal-error"===n&&(this.bannedKeyIds[s]=n),this.log(`key status change "${n}" for keyStatuses keyId: ${s} key-session "${t.mediaKeysSession.sessionId}"`),e[s]=n})),e}fetchServerCertificate(t){const e=this.config,n=new(0,e.loader)(e),i=this.getServerCertificateUrl(t);return i?(this.log(`Fetching server certificate for "${t}"`),new Promise(((r,s)=>{const l={responseType:"arraybuffer",url:i},u=e.certLoadPolicy.default,h={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},c={onSuccess:(t,e,n,i)=>{r(t.data)},onError:(e,n,r,u)=>{s(new ma({type:a.KEY_SYSTEM_ERROR,details:o.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:r,response:E({url:l.url,data:void 0},e)},`"${t}" certificate request failed (${i}). Status: ${e.code} (${e.text})`))},onTimeout:(e,n,r)=>{s(new ma({type:a.KEY_SYSTEM_ERROR,details:o.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:r,response:{url:l.url,data:void 0}},`"${t}" certificate request timed out (${i})`))},onAbort:(t,e,n)=>{s(new Error("aborted"))}};n.load(l,h,c)}))):Promise.resolve()}setMediaKeysServerCertificate(t,e,n){return new Promise(((i,r)=>{t.setServerCertificate(n).then((r=>{this.log(`setServerCertificate ${r?"success":"not supported by CDM"} (${n.byteLength}) on "${e}"`),i(t)})).catch((t=>{r(new ma({type:a.KEY_SYSTEM_ERROR,details:o.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:t,fatal:!0},t.message))}))}))}renewLicense(t,e){return this.requestLicense(t,new Uint8Array(e)).then((e=>this.updateKeySession(t,new Uint8Array(e)).catch((e=>{throw new ma({type:a.KEY_SYSTEM_ERROR,details:o.KEY_SYSTEM_SESSION_UPDATE_FAILED,decryptdata:t.decryptdata,error:e,fatal:!1},e.message)}))))}unpackPlayReadyKeyMessage(t,e){const n=String.fromCharCode.apply(null,new Uint16Array(e.buffer));if(!n.includes("PlayReadyKeyMessage"))return t.setRequestHeader("Content-Type","text/xml; charset=utf-8"),e;const i=(new DOMParser).parseFromString(n,"application/xml"),r=i.querySelectorAll("HttpHeader");if(r.length>0){let e;for(let n=0,i=r.length;n<i;n++){var s,a;e=r[n];const i=null==(s=e.querySelector("name"))?void 0:s.textContent,o=null==(a=e.querySelector("value"))?void 0:a.textContent;i&&o&&t.setRequestHeader(i,o)}}const o=i.querySelector("Challenge"),l=null==o?void 0:o.textContent;if(!l)throw new Error("Cannot find <Challenge> in key message");return yn(atob(l))}setupLicenseXHR(t,e,n,i){const r=this.config.licenseXhrSetup;return r?Promise.resolve().then((()=>{if(!n.decryptdata)throw new Error("Key removed");return r.call(this.hls,t,e,n,i)})).catch((s=>{if(!n.decryptdata)throw s;return t.open("POST",e,!0),r.call(this.hls,t,e,n,i)})).then((n=>{t.readyState||t.open("POST",e,!0);return{xhr:t,licenseChallenge:n||i}})):(t.open("POST",e,!0),Promise.resolve({xhr:t,licenseChallenge:i}))}requestLicense(t,e){const n=this.config.keyLoadPolicy.default;return new Promise(((i,r)=>{const s=this.getLicenseServerUrlOrThrow(t.keySystem);this.log(`Sending license request to URL: ${s}`);const l=new XMLHttpRequest;l.responseType="arraybuffer",l.onreadystatechange=()=>{if(!this.hls||!t.mediaKeysSession)return r(new Error("invalid state"));if(4===l.readyState)if(200===l.status){this._requestLicenseFailureCount=0;let e=l.response;this.log(`License received ${e instanceof ArrayBuffer?e.byteLength:e}`);const n=this.config.licenseResponseCallback;if(n)try{e=n.call(this.hls,l,s,t)}catch(t){this.error(t)}i(e)}else{const u=n.errorRetry,h=u?u.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>h||l.status>=400&&l.status<500)r(new ma({type:a.KEY_SYSTEM_ERROR,details:o.KEY_SYSTEM_LICENSE_REQUEST_FAILED,decryptdata:t.decryptdata,fatal:!0,networkDetails:l,response:{url:s,data:void 0,code:l.status,text:l.statusText}},`License Request XHR failed (${s}). Status: ${l.status} (${l.statusText})`));else{const n=h-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${n} attempts left`),this.requestLicense(t,e).then(i,r)}}},t.licenseXhr&&t.licenseXhr.readyState!==XMLHttpRequest.DONE&&t.licenseXhr.abort(),t.licenseXhr=l,this.setupLicenseXHR(l,s,t,e).then((({xhr:e,licenseChallenge:n})=>{t.keySystem==Tn.PLAYREADY&&(n=this.unpackPlayReadyKeyMessage(e,n)),e.send(n)})).catch(r)}))}onDestroying(){this.unregisterListeners(),this._clear()}onMediaAttached(t,e){if(!this.config.emeEnabled)return;const n=e.media;this.media=n,_i(n,"encrypted",this.onMediaEncrypted),_i(n,"waitingforkey",this.onWaitingForKey)}onMediaDetached(){const t=this.media;t&&(mi(t,"encrypted",this.onMediaEncrypted),mi(t,"waitingforkey",this.onWaitingForKey),this.media=null,this.mediaKeys=null)}_clear(){var t;if(this._requestLicenseFailureCount=0,this.keyIdToKeySessionPromise={},this.bannedKeyIds={},!this.mediaKeys&&!this.mediaKeySessions.length)return;const e=this.media,n=this.mediaKeySessions.slice();this.mediaKeySessions=[],this.mediaKeys=null,On.clearKeyUriToKeyIdMap();const i=n.length;pa.CDMCleanupPromise=Promise.all(n.map((t=>this.removeSession(t))).concat((null==e||null==(t=e.setMediaKeys(null))?void 0:t.catch((t=>{this.log(`Could not clear media keys: ${t}`),this.hls&&this.hls.trigger(l.ERROR,{type:a.OTHER_ERROR,details:o.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR,fatal:!1,error:new Error(`Could not clear media keys: ${t}`)})})))||Promise.resolve())).catch((t=>{this.log(`Could not close sessions and clear media keys: ${t}`),this.hls&&this.hls.trigger(l.ERROR,{type:a.OTHER_ERROR,details:o.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close sessions and clear media keys: ${t}`)})})).then((()=>{i&&this.log("finished closing key sessions and clearing media keys")}))}onManifestLoading(){this.keyFormatPromise=null,this.bannedKeyIds={}}onManifestLoaded(t,{sessionKeys:e}){if(e&&this.config.emeEnabled&&!this.keyFormatPromise){const t=e.reduce(((t,e)=>(-1===t.indexOf(e.keyFormat)&&t.push(e.keyFormat),t)),[]);this.log(`Selecting key-system from session-keys ${t.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(t)}}removeSession(t){const{mediaKeysSession:e,licenseXhr:n,decryptdata:i}=t;if(e){this.log(`Remove licenses and keys and close session "${e.sessionId}" keyId: ${I((null==i?void 0:i.keyId)||[])}`),t._onmessage&&(e.removeEventListener("message",t._onmessage),t._onmessage=void 0),t._onkeystatuseschange&&(e.removeEventListener("keystatuseschange",t._onkeystatuseschange),t._onkeystatuseschange=void 0),n&&n.readyState!==XMLHttpRequest.DONE&&n.abort(),t.mediaKeysSession=t.decryptdata=t.licenseXhr=void 0;const r=this.mediaKeySessions.indexOf(t);r>-1&&this.mediaKeySessions.splice(r,1);const{keyStatusTimeouts:s}=t;s&&Object.keys(s).forEach((t=>self.clearTimeout(s[t])));const{drmSystemOptions:u}=this.config,h=function(t){var e;return!(!t||"persistent-license"!==t.sessionType&&(null==(e=t.sessionTypes)||!e.some((t=>"persistent-license"===t))))}(u)?new Promise(((t,n)=>{self.setTimeout((()=>n(new Error("MediaKeySession.remove() timeout"))),8e3),e.remove().then(t).catch(n)})):Promise.resolve();return h.catch((t=>{this.log(`Could not remove session: ${t}`),this.hls&&this.hls.trigger(l.ERROR,{type:a.OTHER_ERROR,details:o.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR,fatal:!1,error:new Error(`Could not remove session: ${t}`)})})).then((()=>e.close())).catch((t=>{this.log(`Could not close session: ${t}`),this.hls&&this.hls.trigger(l.ERROR,{type:a.OTHER_ERROR,details:o.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close session: ${t}`)})}))}return Promise.resolve()}}function ga(t){if(!t)throw new Error("Could not read keyId of undefined decryptdata");if(null===t.keyId)throw new Error("keyId is null");return I(t.keyId)}function _a(t,e){return t.keyId&&e.mediaKeysSession.keyStatuses.has(t.keyId)?e.mediaKeysSession.keyStatuses.get(t.keyId):t.matches(e.decryptdata)?e.keyStatus:void 0}pa.CDMCleanupPromise=void 0;class ma extends Error{constructor(t,e){super(e),this.data=void 0,t.error||(t.error=new Error(e)),this.data=t,t.err=t.error}}function va(t,e){const n="output-restricted"===t,i=n?o.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:o.KEY_SYSTEM_STATUS_INTERNAL_ERROR;return new ma({type:a.KEY_SYSTEM_ERROR,details:i,fatal:!1,decryptdata:e},n?"HDCP level output restricted":`key status changed to "${t}"`)}function ya(t,e){let n;try{n=new Event("addtrack")}catch(t){n=document.createEvent("Event"),n.initEvent("addtrack",!1,!1)}n.track=t,e.dispatchEvent(n)}function ba(t,e){const n=t.mode;if("disabled"===n&&(t.mode="hidden"),t.cues&&!t.cues.getCueById(e.id))try{if(t.addCue(e),!t.cues.getCueById(e.id))throw new Error(`addCue is failed for: ${e}`)}catch(n){C.debug(`[texttrack-utils]: ${n}`);try{const n=new self.TextTrackCue(e.startTime,e.endTime,e.text);n.id=e.id,t.addCue(n)}catch(t){C.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${t}`)}}"disabled"===n&&(t.mode=n)}function Ea(t,e){const n=t.mode;if("disabled"===n&&(t.mode="hidden"),t.cues)for(let n=t.cues.length;n--;)e&&t.cues[n].removeEventListener("enter",e),t.removeCue(t.cues[n]);"disabled"===n&&(t.mode=n)}function wa(t,e,n,i){const r=t.mode;if("disabled"===r&&(t.mode="hidden"),t.cues&&t.cues.length>0){const r=function(t,e,n){const i=[],r=function(t,e){if(e<=t[0].startTime)return 0;const n=t.length-1;if(e>t[n].endTime)return-1;let i,r=0,s=n;for(;r<=s;)if(i=Math.floor((s+r)/2),e<t[i].startTime)s=i-1;else{if(!(e>t[i].startTime&&r<n))return i;r=i+1}return t[r].startTime-e<e-t[s].startTime?r:s}(t,e);if(r>-1)for(let s=r,a=t.length;s<a;s++){const r=t[s];if(r.startTime>=e&&r.endTime<=n)i.push(r);else if(r.startTime>n)return i}return i}(t.cues,e,n);for(let e=0;e<r.length;e++)i&&!i(r[e])||t.removeCue(r[e])}"disabled"===r&&(t.mode=r)}function Ta(t){const e=[];for(let n=0;n<t.length;n++){const i=t[n];"subtitles"!==i.kind&&"captions"!==i.kind||!i.label||e.push(t[n])}return e}function ka(t){let e=5381,n=t.length;for(;n;)e=33*e^t.charCodeAt(--n);return(e>>>0).toString()}const Sa=.025;let Aa=function(t){return t[t.Point=0]="Point",t[t.Range=1]="Range",t}({});function Da(t,e,n){return`${t.identifier}-${n+1}-${ka(e)}`}class Ca{constructor(t,e){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=e,this.dateRange=t,this.setDateRange(t)}setDateRange(t){this.dateRange=t,this.resumeOffset=t.attr.optionalFloat("X-RESUME-OFFSET",this.resumeOffset),this.playoutLimit=t.attr.optionalFloat("X-PLAYOUT-LIMIT",this.playoutLimit),this.restrictions=t.attr.enumeratedStringList("X-RESTRICT",this.restrictions),this.snapOptions=t.attr.enumeratedStringList("X-SNAP",this.snapOptions)}reset(){var t;this.appendInPlaceStarted=!1,null==(t=this.assetListLoader)||t.destroy(),this.assetListLoader=void 0,this.supplementsPrimary||(this.assetListResponse=null,this.assetList=[],this._duration=null)}isAssetPastPlayoutLimit(t){var e;if(t>0&&t>=this.assetList.length)return!0;const n=this.playoutLimit;if(t<=0||isNaN(n))return!1;if(0===n)return!0;return((null==(e=this.assetList[t])?void 0:e.startOffset)||0)>n}findAssetIndex(t){return this.assetList.indexOf(t)}get identifier(){return this.dateRange.id}get startDate(){return this.dateRange.startDate}get startTime(){const t=this.dateRange.startTime;if(this.snapOptions.out){const e=this.dateRange.tagAnchor;if(e)return xa(t,e)}return t}get startOffset(){return this.cue.pre?0:this.startTime}get startIsAligned(){if(0===this.startTime||this.snapOptions.out)return!0;const t=this.dateRange.tagAnchor;if(t){const e=this.dateRange.startTime;return e-xa(e,t)<.1}return!1}get resumptionOffset(){const t=this.resumeOffset,e=i(t)?t:this.duration;return this.cumulativeDuration+e}get resumeTime(){const t=this.startOffset+this.resumptionOffset;if(this.snapOptions.in){const e=this.resumeAnchor;if(e)return xa(t,e)}return t}get appendInPlace(){return!!this.appendInPlaceStarted||!this.appendInPlaceDisabled&&!(this.cue.once||this.cue.pre||!this.startIsAligned||!(isNaN(this.playoutLimit)&&isNaN(this.resumeOffset)||this.resumeOffset&&this.duration&&Math.abs(this.resumeOffset-this.duration)<Sa))}set appendInPlace(t){this.appendInPlaceStarted?this.resetOnResume=!t:this.appendInPlaceDisabled=!t}get timelineStart(){return null!==this._timelineStart?this._timelineStart:this.startTime}set timelineStart(t){this._timelineStart=t}get duration(){const t=this.playoutLimit;let e;return e=null!==this._duration?this._duration:this.dateRange.duration?this.dateRange.duration:this.dateRange.plannedDuration||0,!isNaN(t)&&t<e&&(e=t),e}set duration(t){this._duration=t}get cue(){return this.dateRange.cue}get timelineOccupancy(){return"RANGE"===this.dateRange.attr["X-TIMELINE-OCCUPIES"]?Aa.Range:Aa.Point}get supplementsPrimary(){return"PRIMARY"===this.dateRange.attr["X-TIMELINE-STYLE"]}get contentMayVary(){return"NO"!==this.dateRange.attr["X-CONTENT-MAY-VARY"]}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||null!==this.assetListResponse}toString(){return`["${(t=this).identifier}" ${t.cue.pre?"<pre>":t.cue.post?"<post>":""}${t.timelineStart.toFixed(2)}-${t.resumeTime.toFixed(2)}]`;var t}}function xa(t,e){return t-e.start<e.duration/2&&!(Math.abs(t-(e.start+e.duration))<Sa)?e.start:e.start+e.duration}function Ra(t,e,n){const i=new self.URL(t,n);return"data:"!==i.protocol&&i.searchParams.set("_HLS_primary_id",e),i}function La(t,e){for(;null!=(n=t.assetList[++e])&&n.error;)var n;return e}function Ia(t){const e=t.timelineStart,n=t.duration||0;return`["${t.identifier}" ${e.toFixed(2)}-${(e+n).toFixed(2)}]`}class Pa{constructor(t,e,n,i){this.hls=void 0,this.interstitial=void 0,this.assetItem=void 0,this.tracks=null,this.hasDetails=!1,this.mediaAttached=null,this._currentTime=void 0,this._bufferedEosTime=void 0,this.checkPlayout=()=>{this.reachedPlayout(this.currentTime)&&this.hls&&this.hls.trigger(l.PLAYOUT_LIMIT_REACHED,{})};const r=this.hls=new t(e);this.interstitial=n,this.assetItem=i;const s=()=>{this.hasDetails=!0};r.once(l.LEVEL_LOADED,s),r.once(l.AUDIO_TRACK_LOADED,s),r.once(l.SUBTITLE_TRACK_LOADED,s),r.on(l.MEDIA_ATTACHING,((t,{media:e})=>{this.removeMediaListeners(),this.mediaAttached=e;this.interstitial.playoutLimit&&(e.addEventListener("timeupdate",this.checkPlayout),this.appendInPlace&&r.on(l.BUFFER_APPENDED,(()=>{const t=this.bufferedEnd;this.reachedPlayout(t)&&(this._bufferedEosTime=t,r.trigger(l.BUFFERED_TO_END,void 0))})))}))}get appendInPlace(){return this.interstitial.appendInPlace}loadSource(){const t=this.hls;if(t)if(t.url)t.levels.length&&!t.started&&t.startLoad(-1,!0);else{let e=this.assetItem.uri;try{e=Ra(e,t.config.primarySessionId||"").href}catch(t){}t.loadSource(e)}}bufferedInPlaceToEnd(t){var e;if(!this.appendInPlace)return!1;if(null!=(e=this.hls)&&e.bufferedToEnd)return!0;if(!t)return!1;const n=Math.min(this._bufferedEosTime||1/0,this.duration),i=this.timelineOffset,r=en.bufferInfo(t,i,0);return this.getAssetTime(r.end)>=n-.02}reachedPlayout(t){const e=this.interstitial.playoutLimit;return this.startOffset+t>=e}get destroyed(){var t;return!(null!=(t=this.hls)&&t.userConfig)}get assetId(){return this.assetItem.identifier}get interstitialId(){return this.assetItem.parentIdentifier}get media(){var t;return(null==(t=this.hls)?void 0:t.media)||null}get bufferedEnd(){const t=this.media||this.mediaAttached;if(!t)return this._bufferedEosTime?this._bufferedEosTime:this.currentTime;const e=en.bufferInfo(t,t.currentTime,.001);return this.getAssetTime(e.end)}get currentTime(){const t=this.media||this.mediaAttached;return t?this.getAssetTime(t.currentTime):this._currentTime||0}get duration(){const t=this.assetItem.duration;if(!t)return 0;const e=this.interstitial.playoutLimit;if(e){const n=e-this.startOffset;if(n>0&&n<t)return n}return t}get remaining(){const t=this.duration;return t?Math.max(0,t-this.currentTime):0}get startOffset(){return this.assetItem.startOffset}get timelineOffset(){var t;return(null==(t=this.hls)?void 0:t.config.timelineOffset)||0}set timelineOffset(t){const e=this.timelineOffset;if(t!==e){const n=t-e;if(Math.abs(n)>1/9e4&&this.hls){if(this.hasDetails)throw new Error("Cannot set timelineOffset after playlists are loaded");this.hls.config.timelineOffset=t}}}getAssetTime(t){const e=this.timelineOffset,n=this.duration;return Math.min(Math.max(0,t-e),n)}removeMediaListeners(){const t=this.mediaAttached;t&&(this._currentTime=t.currentTime,this.bufferSnapShot(),t.removeEventListener("timeupdate",this.checkPlayout))}bufferSnapShot(){var t;this.mediaAttached&&(null!=(t=this.hls)&&t.bufferedToEnd&&(this._bufferedEosTime=this.bufferedEnd))}destroy(){this.removeMediaListeners(),this.hls&&this.hls.destroy(),this.hls=null,this.tracks=this.mediaAttached=this.checkPlayout=null}attachMedia(t){var e;this.loadSource(),null==(e=this.hls)||e.attachMedia(t)}detachMedia(){var t;this.removeMediaListeners(),this.mediaAttached=null,null==(t=this.hls)||t.detachMedia()}resumeBuffering(){var t;null==(t=this.hls)||t.resumeBuffering()}pauseBuffering(){var t;null==(t=this.hls)||t.pauseBuffering()}transferMedia(){var t;return this.bufferSnapShot(),(null==(t=this.hls)?void 0:t.transferMedia())||null}resetDetails(){const t=this.hls;if(t&&this.hasDetails){t.stopLoad();const e=t=>delete t.details;t.levels.forEach(e),t.allAudioTracks.forEach(e),t.allSubtitleTracks.forEach(e),this.hasDetails=!1}}on(t,e,n){var i;null==(i=this.hls)||i.on(t,e)}once(t,e,n){var i;null==(i=this.hls)||i.once(t,e)}off(t,e,n){var i;null==(i=this.hls)||i.off(t,e)}toString(){var t;return`HlsAssetPlayer: ${Ia(this.assetItem)} ${null==(t=this.hls)?void 0:t.sessionId} ${this.appendInPlace?"append-in-place":""}`}}class Oa extends w{constructor(t,e){super("interstitials-sched",e),this.onScheduleUpdate=void 0,this.eventMap={},this.events=null,this.items=null,this.durations={primary:0,playout:0,integrated:0},this.onScheduleUpdate=t}destroy(){this.reset(),this.onScheduleUpdate=null}reset(){this.eventMap={},this.setDurations(0,0,0),this.events&&this.events.forEach((t=>t.reset())),this.events=this.items=null}resetErrorsInRange(t,e){return this.events?this.events.reduce(((n,i)=>t<=i.startOffset&&e>i.startOffset?(delete i.error,n+1):n),0):0}get duration(){const t=this.items;return t?t[t.length-1].end:0}get length(){return this.items?this.items.length:0}getEvent(t){return t&&this.eventMap[t]||null}hasEvent(t){return t in this.eventMap}findItemIndex(t,e){if(t.event)return this.findEventIndex(t.event.identifier);let n=-1;t.nextEvent?n=this.findEventIndex(t.nextEvent.identifier)-1:t.previousEvent&&(n=this.findEventIndex(t.previousEvent.identifier)+1);const i=this.items;if(i)for(i[n]||(void 0===e&&(e=t.start),n=this.findItemIndexAtTime(e));n>=0&&null!=(r=i[n])&&r.event;){var r;n--}return n}findItemIndexAtTime(t,e){const n=this.items;if(n)for(let i=0;i<n.length;i++){let r=n[i];if(e&&"primary"!==e&&(r=r[e]),t===r.start||t>r.start&&t<r.end)return i}return-1}findJumpRestrictedIndex(t,e){const n=this.items;if(n)for(let i=t;i<=e&&n[i];i++){const t=n[i].event;if(null!=t&&t.restrictions.jump&&!t.appendInPlace)return i}return-1}findEventIndex(t){const e=this.items;if(e)for(let i=e.length;i--;){var n;if((null==(n=e[i].event)?void 0:n.identifier)===t)return i}return-1}findAssetIndex(t,e){const n=t.assetList,i=n.length;if(i>1)for(let t=0;t<i;t++){const r=n[t];if(!r.error){const n=r.timelineStart;if(e===n||e>n&&(e<n+(r.duration||0)||t===i-1))return t}}return 0}get assetIdAtEnd(){var t;const e=null==(t=this.items)||null==(t=t[this.length-1])?void 0:t.event;if(e){const t=e.assetList,n=t[t.length-1];if(n)return n.identifier}return null}parseInterstitialDateRanges(t,e){const n=t.main.details,{dateRanges:i}=n,r=this.events,s=this.parseDateRanges(i,{url:n.url},e),a=Object.keys(i),o=r?r.filter((t=>!a.includes(t.identifier))):[];s.length&&s.sort(((t,e)=>{const n=t.cue.pre,i=t.cue.post,r=e.cue.pre,s=e.cue.post;if(n&&!r)return-1;if(r&&!n)return 1;if(i&&!s)return 1;if(s&&!i)return-1;if(!(n||r||i||s)){const n=t.startTime,i=e.startTime;if(n!==i)return n-i}return t.dateRange.tagOrder-e.dateRange.tagOrder})),this.events=s,o.forEach((t=>{this.removeEvent(t)})),this.updateSchedule(t,o)}updateSchedule(t,e=[],n=!1){const i=this.events||[];if(i.length||e.length||this.length<2){const r=this.items,s=this.parseSchedule(i,t);(n||e.length||(null==r?void 0:r.length)!==s.length||s.some(((t,e)=>Math.abs(t.playout.start-r[e].playout.start)>.005||Math.abs(t.playout.end-r[e].playout.end)>.005)))&&(this.items=s,this.onScheduleUpdate(e,r))}}parseDateRanges(t,e,n){const i=[],r=Object.keys(t);for(let s=0;s<r.length;s++){const a=r[s],o=t[a];if(o.isInterstitial){let t=this.eventMap[a];t?t.setDateRange(o):(t=new Ca(o,e),this.eventMap[a]=t,!1===n&&(t.appendInPlace=n)),i.push(t)}}return i}parseSchedule(t,e){const n=[],i=e.main.details,r=i.live?1/0:i.edge;let s=0;if((t=t.filter((t=>!(t.error||t.cue.once&&t.hasPlayed)))).length){this.resolveOffsets(t,e);let i=0,o=0;if(t.forEach(((e,a)=>{const l=e.cue.pre,u=e.cue.post,h=t[a-1]||null,c=e.appendInPlace,d=u?r:e.startOffset,f=e.duration,p=e.timelineOccupancy===Aa.Range?f:0,g=e.resumptionOffset,_=(null==h?void 0:h.startTime)===d,m=d+e.cumulativeDuration;let v=c?m+f:d+g;if(l||!u&&d<=0){const t=o;o+=p,e.timelineStart=m;const i=s;s+=f,n.push({event:e,start:m,end:v,playout:{start:i,end:s},integrated:{start:t,end:o}})}else{if(!(d<=r))return;{if(!_){const r=d-i;if(r>.033){const l=i,u=o;o+=r;const h=s;s+=r;const c={previousEvent:t[a-1]||null,nextEvent:e,start:l,end:l+r,playout:{start:h,end:s},integrated:{start:u,end:o}};n.push(c)}else r>0&&h&&(h.cumulativeDuration+=r,n[n.length-1].end=d)}u&&(v=m),e.timelineStart=m;const r=o;o+=p;const l=s;s+=f,n.push({event:e,start:m,end:v,playout:{start:l,end:s},integrated:{start:r,end:o}})}}const y=e.resumeTime;i=u||y>r?r:y})),i<r){var a;const t=i,e=o,l=r-i;o+=l;const u=s;s+=l,n.push({previousEvent:(null==(a=n[n.length-1])?void 0:a.event)||null,nextEvent:null,start:i,end:t+l,playout:{start:u,end:s},integrated:{start:e,end:o}})}this.setDurations(r,s,o)}else{const t=0;n.push({previousEvent:null,nextEvent:null,start:t,end:r,playout:{start:t,end:r},integrated:{start:t,end:r}}),this.setDurations(r,r,r)}return n}setDurations(t,e,n){this.durations={primary:t,playout:e,integrated:n}}resolveOffsets(t,e){const n=e.main.details,r=n.live?1/0:n.edge;let s=0,a=-1;t.forEach(((o,l)=>{const u=o.cue.pre,h=o.cue.post,c=u?0:h?r:o.startTime;this.updateAssetDurations(o);if(a===c?o.cumulativeDuration=s:(s=0,a=c),!h&&o.snapOptions.in&&(o.resumeAnchor=de(null,n.fragments,o.startOffset+o.resumptionOffset,0,0)||void 0),o.appendInPlace&&!o.appendInPlaceStarted){this.primaryCanResumeInPlaceAt(o,e)||(o.appendInPlace=!1)}if(!o.appendInPlace&&l+1<t.length){t[l+1].startTime-t[l].resumeTime<.033&&(t[l+1].appendInPlace=!1,t[l+1].appendInPlace&&this.warn(`Could not change append strategy for abutting event ${o}`))}const d=i(o.resumeOffset)?o.resumeOffset:o.duration;s+=d}))}primaryCanResumeInPlaceAt(t,e){const n=t.resumeTime,i=t.startTime+t.resumptionOffset;if(Math.abs(n-i)>Sa)return this.log(`"${t.identifier}" resumption ${n} not aligned with estimated timeline end ${i}`),!1;return!Object.keys(e).some((i=>{const r=e[i].details,s=r.edge;if(n>=s)return this.log(`"${t.identifier}" resumption ${n} past ${i} playlist end ${s}`),!1;const a=de(null,r.fragments,n);if(!a)return this.log(`"${t.identifier}" resumption ${n} does not align with any fragments in ${i} playlist (${r.fragStart}-${r.fragmentEnd})`),!0;const o="audio"===i?.175:0;return!(Math.abs(a.start-n)<Sa+o||Math.abs(a.end-n)<Sa+o)&&(this.log(`"${t.identifier}" resumption ${n} not aligned with ${i} fragment bounds (${a.start}-${a.end} sn: ${a.sn} cc: ${a.cc})`),!0)}))}updateAssetDurations(t){if(!t.assetListLoaded)return;const e=t.timelineStart;let n=0,i=!1,r=!1;for(let s=0;s<t.assetList.length;s++){const a=t.assetList[s],o=e+n;a.startOffset=n,a.timelineStart=o,i||(i=null===a.duration),r||(r=!!a.error);n+=a.error?0:a.duration||0}t.duration=i&&!r?Math.max(n,t.duration):n}removeEvent(t){t.reset(),delete this.eventMap[t.identifier]}}function Fa(t){return`[${t.event?'"'+t.event.identifier+'"':"primary"}: ${t.start.toFixed(2)}-${t.end.toFixed(2)}]`}class Ma{constructor(t){this.hls=void 0,this.hls=t}destroy(){this.hls=null}loadAssetList(t,e){const n=t.assetListUrl;let i;try{i=Ra(n,this.hls.sessionId,t.baseUrl)}catch(e){const i=this.assignAssetListError(t,o.ASSET_LIST_LOAD_ERROR,e,n);return void this.hls.trigger(l.ERROR,i)}e&&"data:"!==i.protocol&&i.searchParams.set("_HLS_start_offset",""+e);const r=this.hls.config,s=new(0,r.loader)(r),a={responseType:"json",url:i.href},u=r.interstitialAssetListLoadPolicy.default,h={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},c={onSuccess:(e,n,i,r)=>{const s=e.data,a=null==s?void 0:s.ASSETS;if(Array.isArray(a))t.assetListResponse=s,this.hls.trigger(l.ASSET_LIST_LOADED,{event:t,assetListResponse:s,networkDetails:r});else{const e=this.assignAssetListError(t,o.ASSET_LIST_PARSING_ERROR,new Error("Invalid interstitial asset list"),i.url,n,r);this.hls.trigger(l.ERROR,e)}},onError:(e,n,i,r)=>{const s=this.assignAssetListError(t,o.ASSET_LIST_LOAD_ERROR,new Error(`Error loading X-ASSET-LIST: HTTP status ${e.code} ${e.text} (${n.url})`),n.url,r,i);this.hls.trigger(l.ERROR,s)},onTimeout:(e,n,i)=>{const r=this.assignAssetListError(t,o.ASSET_LIST_LOAD_TIMEOUT,new Error(`Timeout loading X-ASSET-LIST (${n.url})`),n.url,e,i);this.hls.trigger(l.ERROR,r)}};return s.load(a,h,c),this.hls.trigger(l.ASSET_LIST_LOADING,{event:t}),s}assignAssetListError(t,e,n,i,r,s){return t.error=n,{type:a.NETWORK_ERROR,details:e,fatal:!1,interstitial:t,url:i,error:n,networkDetails:s,stats:r}}}function Na(t){null==t||t.play().catch((()=>{}))}function Ba(t,e){return`[${t}] Advancing timeline position to ${e}`}class Ua{constructor(t){this.buffered=void 0;const e=(e,n,i)=>{if((n>>>=0)>i-1)throw new DOMException(`Failed to execute '${e}' on 'TimeRanges': The index provided (${n}) is greater than the maximum bound (${i})`);return t[n][e]};this.buffered={get length(){return t.length},end(n){return e("end",n,t.length)},start(n){return e("start",n,t.length)}}}}const $a={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},Ga=t=>String.fromCharCode($a[t]||t),Ka=15,ja=100,Va={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},Za={17:2,18:4,21:6,22:8,23:10,19:13,20:15},za={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},Ha={25:2,26:4,29:6,30:8,31:10,27:13,28:15},Wa=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class Ya{constructor(){this.time=null,this.verboseLevel=0}log(t,e){if(this.verboseLevel>=t){const n="function"==typeof e?e():e;C.log(`${this.time} [${t}] ${n}`)}}}const qa=function(t){const e=[];for(let n=0;n<t.length;n++)e.push(t[n].toString(16));return e};class Qa{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(t){const e=["foreground","underline","italics","background","flash"];for(let n=0;n<e.length;n++){const i=e[n];t.hasOwnProperty(i)&&(this[i]=t[i])}}isDefault(){return"white"===this.foreground&&!this.underline&&!this.italics&&"black"===this.background&&!this.flash}equals(t){return this.foreground===t.foreground&&this.underline===t.underline&&this.italics===t.italics&&this.background===t.background&&this.flash===t.flash}copy(t){this.foreground=t.foreground,this.underline=t.underline,this.italics=t.italics,this.background=t.background,this.flash=t.flash}toString(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash}}class Xa{constructor(){this.uchar=" ",this.penState=new Qa}reset(){this.uchar=" ",this.penState.reset()}setChar(t,e){this.uchar=t,this.penState.copy(e)}setPenState(t){this.penState.copy(t)}equals(t){return this.uchar===t.uchar&&this.penState.equals(t.penState)}copy(t){this.uchar=t.uchar,this.penState.copy(t.penState)}isEmpty(){return" "===this.uchar&&this.penState.isDefault()}}class Ja{constructor(t){this.chars=[],this.pos=0,this.currPenState=new Qa,this.cueStartTime=null,this.logger=void 0;for(let t=0;t<ja;t++)this.chars.push(new Xa);this.logger=t}equals(t){for(let e=0;e<ja;e++)if(!this.chars[e].equals(t.chars[e]))return!1;return!0}copy(t){for(let e=0;e<ja;e++)this.chars[e].copy(t.chars[e])}isEmpty(){let t=!0;for(let e=0;e<ja;e++)if(!this.chars[e].isEmpty()){t=!1;break}return t}setCursor(t){this.pos!==t&&(this.pos=t),this.pos<0?(this.logger.log(3,"Negative cursor position "+this.pos),this.pos=0):this.pos>ja&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=ja)}moveCursor(t){const e=this.pos+t;if(t>1)for(let t=this.pos+1;t<e+1;t++)this.chars[t].setPenState(this.currPenState);this.setCursor(e)}backSpace(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)}insertChar(t){t>=144&&this.backSpace();const e=Ga(t);this.pos>=ja?this.logger.log(0,(()=>"Cannot insert "+t.toString(16)+" ("+e+") at position "+this.pos+". Skipping it!")):(this.chars[this.pos].setChar(e,this.currPenState),this.moveCursor(1))}clearFromPos(t){let e;for(e=t;e<ja;e++)this.chars[e].reset()}clear(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()}clearToEndOfRow(){this.clearFromPos(this.pos)}getTextString(){const t=[];let e=!0;for(let n=0;n<ja;n++){const i=this.chars[n].uchar;" "!==i&&(e=!1),t.push(i)}return e?"":t.join("")}setPenStyles(t){this.currPenState.setStyles(t);this.chars[this.pos].setPenState(this.currPenState)}}class to{constructor(t){this.rows=[],this.currRow=14,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(let e=0;e<Ka;e++)this.rows.push(new Ja(t));this.logger=t}reset(){for(let t=0;t<Ka;t++)this.rows[t].clear();this.currRow=14}equals(t){let e=!0;for(let n=0;n<Ka;n++)if(!this.rows[n].equals(t.rows[n])){e=!1;break}return e}copy(t){for(let e=0;e<Ka;e++)this.rows[e].copy(t.rows[e])}isEmpty(){let t=!0;for(let e=0;e<Ka;e++)if(!this.rows[e].isEmpty()){t=!1;break}return t}backSpace(){this.rows[this.currRow].backSpace()}clearToEndOfRow(){this.rows[this.currRow].clearToEndOfRow()}insertChar(t){this.rows[this.currRow].insertChar(t)}setPen(t){this.rows[this.currRow].setPenStyles(t)}moveCursor(t){this.rows[this.currRow].moveCursor(t)}setCursor(t){this.logger.log(2,"setCursor: "+t);this.rows[this.currRow].setCursor(t)}setPAC(t){this.logger.log(2,(()=>"pacData = "+ne(t)));let e=t.row-1;if(this.nrRollUpRows&&e<this.nrRollUpRows-1&&(e=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==e){for(let t=0;t<Ka;t++)this.rows[t].clear();const t=this.currRow+1-this.nrRollUpRows,n=this.lastOutputScreen;if(n){const i=n.rows[t].cueStartTime,r=this.logger.time;if(null!==i&&null!==r&&i<r)for(let i=0;i<this.nrRollUpRows;i++)this.rows[e-this.nrRollUpRows+i+1].copy(n.rows[t+i])}}this.currRow=e;const n=this.rows[this.currRow];if(null!==t.indent){const e=t.indent,i=Math.max(e-1,0);n.setCursor(t.indent),t.color=n.chars[i].penState.foreground}const i={foreground:t.color,underline:t.underline,italics:t.italics,background:"black",flash:!1};this.setPen(i)}setBkgData(t){this.logger.log(2,(()=>"bkgData = "+ne(t))),this.backSpace(),this.setPen(t),this.insertChar(32)}setRollUpRows(t){this.nrRollUpRows=t}rollUp(){if(null===this.nrRollUpRows)return void this.logger.log(3,"roll_up but nrRollUpRows not set yet");this.logger.log(1,(()=>this.getDisplayText()));const t=this.currRow+1-this.nrRollUpRows,e=this.rows.splice(t,1)[0];e.clear(),this.rows.splice(this.currRow,0,e),this.logger.log(2,"Rolling up")}getDisplayText(t){t=t||!1;const e=[];let n="",i=-1;for(let n=0;n<Ka;n++){const r=this.rows[n].getTextString();r&&(i=n+1,t?e.push("Row "+i+": '"+r+"'"):e.push(r.trim()))}return e.length>0&&(n=t?"["+e.join(" | ")+"]":e.join("\n")),n}getTextAndFormat(){return this.rows}}class eo{constructor(t,e,n){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=t,this.outputFilter=e,this.mode=null,this.verbose=0,this.displayedMemory=new to(n),this.nonDisplayedMemory=new to(n),this.lastOutputScreen=new to(n),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=n}reset(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null}getHandler(){return this.outputFilter}setHandler(t){this.outputFilter=t}setPAC(t){this.writeScreen.setPAC(t)}setBkgData(t){this.writeScreen.setBkgData(t)}setMode(t){t!==this.mode&&(this.mode=t,this.logger.log(2,(()=>"MODE="+t)),"MODE_POP-ON"===this.mode?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),"MODE_ROLL-UP"!==this.mode&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=t)}insertChars(t){for(let e=0;e<t.length;e++)this.writeScreen.insertChar(t[e]);const e=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(2,(()=>e+": "+this.writeScreen.getDisplayText(!0))),"MODE_PAINT-ON"!==this.mode&&"MODE_ROLL-UP"!==this.mode||(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"),"MODE_TEXT"!==this.mode&&(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(t){this.logger.log(2,"RU("+t+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(t)}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"),"MODE_POP-ON"===this.mode){const t=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=t,this.writeScreen=this.nonDisplayedMemory,this.logger.log(1,(()=>"DISP: "+this.displayedMemory.getDisplayText()))}this.outputDataUpdate(!0)}ccTO(t){this.logger.log(2,"TO("+t+") - Tab Offset"),this.writeScreen.moveCursor(t)}ccMIDROW(t){const e={flash:!1};if(e.underline=t%2==1,e.italics=t>=46,e.italics)e.foreground="white";else{const n=Math.floor(t/2)-16,i=["white","green","blue","cyan","red","yellow","magenta"];e.foreground=i[n]}this.logger.log(2,"MIDROW: "+ne(e)),this.writeScreen.setPen(e)}outputDataUpdate(t=!1){const e=this.logger.time;null!==e&&this.outputFilter&&(null!==this.cueStartTime||this.displayedMemory.isEmpty()?this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,e,this.lastOutputScreen),t&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:e):this.cueStartTime=e,this.lastOutputScreen.copy(this.displayedMemory))}cueSplitAtTime(t){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,t,this.displayedMemory),this.cueStartTime=t))}}class no{constructor(t,e,n){this.channels=void 0,this.currentChannel=0,this.cmdHistory={a:null,b:null},this.logger=void 0;const i=this.logger=new Ya;this.channels=[null,new eo(t,e,i),new eo(t+1,n,i)]}getHandler(t){return this.channels[t].getHandler()}setHandler(t,e){this.channels[t].setHandler(e)}addData(t,e){this.logger.time=t;for(let t=0;t<e.length;t+=2){const n=127&e[t],i=127&e[t+1];let r=!1,s=null;if(0===n&&0===i)continue;this.logger.log(3,(()=>"["+qa([e[t],e[t+1]])+"] -> ("+qa([n,i])+")"));const a=this.cmdHistory;if(n>=16&&n<=31){if(ro(n,i,a)){io(null,null,a),this.logger.log(3,(()=>"Repeated command ("+qa([n,i])+") is dropped"));continue}io(n,i,this.cmdHistory),r=this.parseCmd(n,i),r||(r=this.parseMidrow(n,i)),r||(r=this.parsePAC(n,i)),r||(r=this.parseBackgroundAttributes(n,i))}else io(null,null,a);if(!r&&(s=this.parseChars(n,i),s)){const t=this.currentChannel;if(t&&t>0){this.channels[t].insertChars(s)}else this.logger.log(2,"No channel found yet. TEXT-MODE?")}r||s||this.logger.log(2,(()=>"Couldn't parse cleaned data "+qa([n,i])+" orig: "+qa([e[t],e[t+1]])))}}parseCmd(t,e){if(!((20===t||28===t||21===t||29===t)&&e>=32&&e<=47)&&!((23===t||31===t)&&e>=33&&e<=35))return!1;const n=20===t||21===t||23===t?1:2,i=this.channels[n];return 20===t||21===t||28===t||29===t?32===e?i.ccRCL():33===e?i.ccBS():34===e?i.ccAOF():35===e?i.ccAON():36===e?i.ccDER():37===e?i.ccRU(2):38===e?i.ccRU(3):39===e?i.ccRU(4):40===e?i.ccFON():41===e?i.ccRDC():42===e?i.ccTR():43===e?i.ccRTD():44===e?i.ccEDM():45===e?i.ccCR():46===e?i.ccENM():47===e&&i.ccEOC():i.ccTO(e-32),this.currentChannel=n,!0}parseMidrow(t,e){let n=0;if((17===t||25===t)&&e>=32&&e<=47){if(n=17===t?1:2,n!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;const i=this.channels[n];return!!i&&(i.ccMIDROW(e),this.logger.log(3,(()=>"MIDROW ("+qa([t,e])+")")),!0)}return!1}parsePAC(t,e){let n;if(!((t>=17&&t<=23||t>=25&&t<=31)&&e>=64&&e<=127)&&!((16===t||24===t)&&e>=64&&e<=95))return!1;const i=t<=23?1:2;n=e>=64&&e<=95?1===i?Va[t]:za[t]:1===i?Za[t]:Ha[t];const r=this.channels[i];return!!r&&(r.setPAC(this.interpretPAC(n,e)),this.currentChannel=i,!0)}interpretPAC(t,e){let n;const i={color:null,italics:!1,indent:null,underline:!1,row:t};return n=e>95?e-96:e-64,i.underline=1==(1&n),n<=13?i.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(n/2)]:n<=15?(i.italics=!0,i.color="white"):i.indent=4*Math.floor((n-16)/2),i}parseChars(t,e){let n,i=null,r=null;if(t>=25?(n=2,r=t-8):(n=1,r=t),r>=17&&r<=19){let t;t=17===r?e+80:18===r?e+112:e+144,this.logger.log(2,(()=>"Special char '"+Ga(t)+"' in channel "+n)),i=[t]}else t>=32&&t<=127&&(i=0===e?[t]:[t,e]);return i&&this.logger.log(3,(()=>"Char codes = "+qa(i).join(","))),i}parseBackgroundAttributes(t,e){if(!((16===t||24===t)&&e>=32&&e<=47)&&!((23===t||31===t)&&e>=45&&e<=47))return!1;let n;const i={};16===t||24===t?(n=Math.floor((e-32)/2),i.background=Wa[n],e%2==1&&(i.background=i.background+"_semi")):45===e?i.background="transparent":(i.foreground="black",47===e&&(i.underline=!0));const r=t<=23?1:2;return this.channels[r].setBkgData(i),!0}reset(){for(let t=0;t<Object.keys(this.channels).length;t++){const e=this.channels[t];e&&e.reset()}io(null,null,this.cmdHistory)}cueSplitAtTime(t){for(let e=0;e<this.channels.length;e++){const n=this.channels[e];n&&n.cueSplitAtTime(t)}}}function io(t,e,n){n.a=t,n.b=e}function ro(t,e,n){return n.a===t&&n.b===e}var so=function(){if(null!=wn&&wn.VTTCue)return self.VTTCue;const t=["","lr","rl"],e=["start","middle","end","left","right"];function n(t,e){if("string"!=typeof e)return!1;if(!Array.isArray(t))return!1;const n=e.toLowerCase();return!!~t.indexOf(n)&&n}function i(t){return n(e,t)}function r(t,...e){let n=1;for(;n<arguments.length;n++){const e=arguments[n];for(const n in e)t[n]=e[n]}return t}function s(e,s,a){const o=this,l={enumerable:!0};o.hasBeenReset=!1;let u="",h=!1,c=e,d=s,f=a,p=null,g="",_=!0,m="auto",v="start",y=50,b="middle",E=50,w="middle";Object.defineProperty(o,"id",r({},l,{get:function(){return u},set:function(t){u=""+t}})),Object.defineProperty(o,"pauseOnExit",r({},l,{get:function(){return h},set:function(t){h=!!t}})),Object.defineProperty(o,"startTime",r({},l,{get:function(){return c},set:function(t){if("number"!=typeof t)throw new TypeError("Start time must be set to a number.");c=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"endTime",r({},l,{get:function(){return d},set:function(t){if("number"!=typeof t)throw new TypeError("End time must be set to a number.");d=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"text",r({},l,{get:function(){return f},set:function(t){f=""+t,this.hasBeenReset=!0}})),Object.defineProperty(o,"region",r({},l,{get:function(){return p},set:function(t){p=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"vertical",r({},l,{get:function(){return g},set:function(e){const i=function(e){return n(t,e)}(e);if(!1===i)throw new SyntaxError("An invalid or illegal string was specified.");g=i,this.hasBeenReset=!0}})),Object.defineProperty(o,"snapToLines",r({},l,{get:function(){return _},set:function(t){_=!!t,this.hasBeenReset=!0}})),Object.defineProperty(o,"line",r({},l,{get:function(){return m},set:function(t){if("number"!=typeof t&&"auto"!==t)throw new SyntaxError("An invalid number or illegal string was specified.");m=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"lineAlign",r({},l,{get:function(){return v},set:function(t){const e=i(t);if(!e)throw new SyntaxError("An invalid or illegal string was specified.");v=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"position",r({},l,{get:function(){return y},set:function(t){if(t<0||t>100)throw new Error("Position must be between 0 and 100.");y=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"positionAlign",r({},l,{get:function(){return b},set:function(t){const e=i(t);if(!e)throw new SyntaxError("An invalid or illegal string was specified.");b=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"size",r({},l,{get:function(){return E},set:function(t){if(t<0||t>100)throw new Error("Size must be between 0 and 100.");E=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"align",r({},l,{get:function(){return w},set:function(t){const e=i(t);if(!e)throw new SyntaxError("An invalid or illegal string was specified.");w=e,this.hasBeenReset=!0}})),o.displayState=void 0}return s.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},s}();class ao{decode(t,e){if(!t)return"";if("string"!=typeof t)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(t))}}function oo(t){function e(t,e,n,i){return 3600*(0|t)+60*(0|e)+(0|n)+parseFloat(i||0)}const n=t.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return n?parseFloat(n[2])>59?e(n[2],n[3],0,n[4]):e(n[1],n[2],n[3],n[4]):null}class lo{constructor(){this.values=Object.create(null)}set(t,e){this.get(t)||""===e||(this.values[t]=e)}get(t,e,n){return n?this.has(t)?this.values[t]:e[n]:this.has(t)?this.values[t]:e}has(t){return t in this.values}alt(t,e,n){for(let i=0;i<n.length;++i)if(e===n[i]){this.set(t,e);break}}integer(t,e){/^-?\d+$/.test(e)&&this.set(t,parseInt(e,10))}percent(t,e){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(e)){const n=parseFloat(e);if(n>=0&&n<=100)return this.set(t,n),!0}return!1}}function uo(t,e,n,i){const r=i?t.split(i):[t];for(const t in r){if("string"!=typeof r[t])continue;const i=r[t].split(n);if(2!==i.length)continue;e(i[0],i[1])}}const ho=new so(0,0,""),co="middle"===ho.align?"middle":"center";function fo(t,e,n){const i=t;function r(){const e=oo(t);if(null===e)throw new Error("Malformed timestamp: "+i);return t=t.replace(/^[^\sa-zA-Z-]+/,""),e}function s(){t=t.replace(/^\s+/,"")}if(s(),e.startTime=r(),s(),"--\x3e"!==t.slice(0,3))throw new Error("Malformed time stamp (time stamps must be separated by '--\x3e'): "+i);t=t.slice(3),s(),e.endTime=r(),s(),function(t,e){const i=new lo;uo(t,(function(t,e){let r;switch(t){case"region":for(let r=n.length-1;r>=0;r--)if(n[r].id===e){i.set(t,n[r].region);break}break;case"vertical":i.alt(t,e,["rl","lr"]);break;case"line":r=e.split(","),i.integer(t,r[0]),i.percent(t,r[0])&&i.set("snapToLines",!1),i.alt(t,r[0],["auto"]),2===r.length&&i.alt("lineAlign",r[1],["start",co,"end"]);break;case"position":r=e.split(","),i.percent(t,r[0]),2===r.length&&i.alt("positionAlign",r[1],["start",co,"end","line-left","line-right","auto"]);break;case"size":i.percent(t,e);break;case"align":i.alt(t,e,["start",co,"end","left","right"])}}),/:/,/\s/),e.region=i.get("region",null),e.vertical=i.get("vertical","");let r=i.get("line","auto");"auto"===r&&-1===ho.line&&(r=-1),e.line=r,e.lineAlign=i.get("lineAlign","start"),e.snapToLines=i.get("snapToLines",!0),e.size=i.get("size",100),e.align=i.get("align",co);let s=i.get("position","auto");"auto"===s&&50===ho.position&&(s="start"===e.align||"left"===e.align?0:"end"===e.align||"right"===e.align?100:50),e.position=s}(t,e)}function po(t){return t.replace(/<br(?: \/)?>/gi,"\n")}class go{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new ao,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}parse(t){const e=this;function n(){let t=e.buffer,n=0;for(t=po(t);n<t.length&&"\r"!==t[n]&&"\n"!==t[n];)++n;const i=t.slice(0,n);return"\r"===t[n]&&++n,"\n"===t[n]&&++n,e.buffer=t.slice(n),i}t&&(e.buffer+=e.decoder.decode(t,{stream:!0}));try{let t="";if("INITIAL"===e.state){if(!/\r\n|\n/.test(e.buffer))return this;t=n();const i=t.match(/^()?WEBVTT([ \t].*)?$/);if(null==i||!i[0])throw new Error("Malformed WebVTT signature.");e.state="HEADER"}let i=!1;for(;e.buffer;){if(!/\r\n|\n/.test(e.buffer))return this;switch(i?i=!1:t=n(),e.state){case"HEADER":/:/.test(t)?uo(t,(function(t,e){}),/:/):t||(e.state="ID");continue;case"NOTE":t||(e.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(t)){e.state="NOTE";break}if(!t)continue;if(e.cue=new so(0,0,""),e.state="CUE",-1===t.indexOf("--\x3e")){e.cue.id=t;continue}case"CUE":if(!e.cue){e.state="BADCUE";continue}try{fo(t,e.cue,e.regionList)}catch(t){e.cue=null,e.state="BADCUE";continue}e.state="CUETEXT";continue;case"CUETEXT":{const n=-1!==t.indexOf("--\x3e");if(!t||n&&(i=!0)){e.oncue&&e.cue&&e.oncue(e.cue),e.cue=null,e.state="ID";continue}if(null===e.cue)continue;e.cue.text&&(e.cue.text+="\n"),e.cue.text+=t}continue;case"BADCUE":t||(e.state="ID")}}}catch(t){"CUETEXT"===e.state&&e.cue&&e.oncue&&e.oncue(e.cue),e.cue=null,e.state="INITIAL"===e.state?"BADWEBVTT":"BADCUE"}return this}flush(){const t=this;try{if((t.cue||"HEADER"===t.state)&&(t.buffer+="\n\n",t.parse()),"INITIAL"===t.state||"BADWEBVTT"===t.state)throw new Error("Malformed WebVTT signature.")}catch(e){t.onparsingerror&&t.onparsingerror(e)}return t.onflush&&t.onflush(),this}}const _o=/\r\n|\n\r|\n|\r/g,mo=function(t,e,n=0){return t.slice(n,n+e.length)===e};function vo(t,e,n){return ka(t.toString())+ka(e.toString())+ka(n)}function yo(t,e,n,r,s,a,o){const l=new go,u=L(new Uint8Array(t)).trim().replace(_o,"\n").split("\n"),h=[],c=e?function(t,e=1){return Kr(t,9e4,1/e)}(e.baseTime,e.timescale):0;let d,f="00:00.000",p=0,g=0,_=!0;l.oncue=function(t){const i=n[r];let a=n.ccOffset;const o=(p-c)/9e4;if(null!=i&&i.new&&(void 0!==g?a=n.ccOffset=i.start:function(t,e,n){let i=t[e],r=t[i.prevCC];if(!r||!r.new&&i.new)return t.ccOffset=t.presentationOffset=i.start,void(i.new=!1);for(;null!=(s=r)&&s.new;){var s;t.ccOffset+=i.start-r.start,i.new=!1,i=r,r=t[i.prevCC]}t.presentationOffset=n}(n,r,o)),o){if(!e)return void(d=new Error("Missing initPTS for VTT MPEGTS"));a=o-n.presentationOffset}const l=t.endTime-t.startTime,u=Yr(9e4*(t.startTime+a-g),9e4*s)/9e4;t.startTime=Math.max(u,0),t.endTime=Math.max(u+l,0);const f=t.text.trim();t.text=decodeURIComponent(encodeURIComponent(f)),t.id||(t.id=vo(t.startTime,t.endTime,f)),t.endTime>0&&h.push(t)},l.onparsingerror=function(t){d=t},l.onflush=function(){d?o(d):a(h)},u.forEach((t=>{if(_){if(mo(t,"X-TIMESTAMP-MAP=")){_=!1,t.slice(16).split(",").forEach((t=>{mo(t,"LOCAL:")?f=t.slice(6):mo(t,"MPEGTS:")&&(p=parseInt(t.slice(7)))}));try{g=function(t){let e=parseInt(t.slice(-3));const n=parseInt(t.slice(-6,-4)),r=parseInt(t.slice(-9,-7)),s=t.length>9?parseInt(t.substring(0,t.indexOf(":"))):0;if(!(i(e)&&i(n)&&i(r)&&i(s)))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${t}`);return e+=1e3*n,e+=6e4*r,e+=36e5*s,e}(f)/1e3}catch(t){d=t}return}""===t&&(_=!1)}l.parse(t+"\n")})),l.flush()}const bo="stpp.ttml.im1t",Eo=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,wo=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,To={left:"start",center:"center",right:"end",start:"start",end:"end"};function ko(t,e,n,i){const r=at(new Uint8Array(t),["mdat"]);if(0===r.length)return void i(new Error("Could not parse IMSC1 mdat"));const s=r.map((t=>L(t))),a=function(t,e,n=1,i=!1){return Kr(t,e,1/n,i)}(e.baseTime,1,e.timescale);try{s.forEach((t=>n(function(t,e){const n=(new DOMParser).parseFromString(t,"text/xml"),i=n.getElementsByTagName("tt")[0];if(!i)throw new Error("Invalid ttml");const r={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},s=Object.keys(r).reduce(((t,e)=>(t[e]=i.getAttribute(`ttp:${e}`)||r[e],t)),{}),a="preserve"!==i.getAttribute("xml:space"),o=Ao(So(i,"styling","style")),l=Ao(So(i,"layout","region")),u=So(i,"body","[begin]");return[].map.call(u,(t=>{const n=Do(t,a);if(!n||!t.hasAttribute("begin"))return null;const i=Ro(t.getAttribute("begin"),s),r=Ro(t.getAttribute("dur"),s);let u=Ro(t.getAttribute("end"),s);if(null===i)throw xo(t);if(null===u){if(null===r)throw xo(t);u=i+r}const h=new so(i-e,u-e,n);h.id=vo(h.startTime,h.endTime,h.text);const c=function(t,e,n){const i="http://www.w3.org/ns/ttml#styling";let r=null;const s=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],a=null!=t&&t.hasAttribute("style")?t.getAttribute("style"):null;a&&n.hasOwnProperty(a)&&(r=n[a]);return s.reduce(((n,s)=>{const a=Co(e,i,s)||Co(t,i,s)||Co(r,i,s);return a&&(n[s]=a),n}),{})}(l[t.getAttribute("region")],o[t.getAttribute("style")],o),{textAlign:d}=c;if(d){const t=To[d];t&&(h.lineAlign=t),h.align=d}return y(h,c),h})).filter((t=>null!==t))}(t,a))))}catch(t){i(t)}}function So(t,e,n){const i=t.getElementsByTagName(e)[0];return i?[].slice.call(i.querySelectorAll(n)):[]}function Ao(t){return t.reduce(((t,e)=>{const n=e.getAttribute("xml:id");return n&&(t[n]=e),t}),{})}function Do(t,e){return[].slice.call(t.childNodes).reduce(((t,n,i)=>{var r;return"br"===n.nodeName&&i?t+"\n":null!=(r=n.childNodes)&&r.length?Do(n,e):e?t+n.textContent.trim().replace(/\s+/g," "):t+n.textContent}),"")}function Co(t,e,n){return t&&t.hasAttributeNS(e,n)?t.getAttributeNS(e,n):null}function xo(t){return new Error(`Could not parse ttml timestamp ${t}`)}function Ro(t,e){if(!t)return null;let n=oo(t);return null===n&&(Eo.test(t)?n=function(t,e){const n=Eo.exec(t),i=(0|n[4])+(0|n[5])/e.subFrameRate;return 3600*(0|n[1])+60*(0|n[2])+(0|n[3])+i/e.frameRate}(t,e):wo.test(t)&&(n=function(t,e){const n=wo.exec(t),i=Number(n[1]);switch(n[2]){case"h":return 3600*i;case"m":return 60*i;case"ms":return 1e3*i;case"f":return i/e.frameRate;case"t":return i/e.tickRate}return i}(t,e))),n}class Lo{constructor(t,e){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=t,this.trackName=e}dispatchCue(){null!==this.startTime&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)}newCue(t,e,n){(null===this.startTime||this.startTime>t)&&(this.startTime=t),this.endTime=e,this.screen=n,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}}function Io(t){return t.characteristics&&/transcribes-spoken-dialog/gi.test(t.characteristics)&&/describes-music-and-sound/gi.test(t.characteristics)?"captions":"subtitles"}function Po(t,e){return!!t&&t.kind===Io(e)&&cs(e,t)}const Oo=/\s/,Fo={newCue(t,e,n,i){const r=[];let s,a,o,l,u;const h=self.VTTCue||self.TextTrackCue;for(let d=0;d<i.rows.length;d++)if(s=i.rows[d],o=!0,l=0,u="",!s.isEmpty()){var c;for(let t=0;t<s.chars.length;t++)Oo.test(s.chars[t].uchar)&&o?l++:(u+=s.chars[t].uchar,o=!1);s.cueStartTime=e,e===n&&(n+=1e-4),l>=16?l--:l++;const i=po(u.trim()),f=vo(e,n,i);null!=t&&null!=(c=t.cues)&&c.getCueById(f)||(a=new h(e,n,i),a.id=f,a.line=d+1,a.align="left",a.position=10+Math.min(80,10*Math.floor(8*l/32)),r.push(a))}return t&&r.length&&(r.sort(((t,e)=>"auto"===t.line||"auto"===e.line?0:t.line>8&&e.line>8?e.line-t.line:t.line-e.line)),r.forEach((e=>ba(t,e)))),r}};const Mo=/(\d+)-(\d+)\/(\d+)/;class No{constructor(t){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=t.fetchSetup||Bo,this.controller=new self.AbortController,this.stats=new j}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 t;this.abortInternal(),null!=(t=this.callbacks)&&t.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)}load(t,e,n){const r=this.stats;if(r.loading.start)throw new Error("Loader can only be used once.");r.loading.start=self.performance.now();const s=function(t,e){const n={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(y({},t.headers))};t.rangeEnd&&n.headers.set("Range","bytes="+t.rangeStart+"-"+String(t.rangeEnd-1));return n}(t,this.controller.signal),a="arraybuffer"===t.responseType,o=a?"byteLength":"length",{maxTimeToFirstByteMs:l,maxLoadTimeMs:u}=e.loadPolicy;this.context=t,this.config=e,this.callbacks=n,this.request=this.fetchSetup(t,s),self.clearTimeout(this.requestTimeout),e.timeout=l&&i(l)?l:u,this.requestTimeout=self.setTimeout((()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(r,t,this.response))}),e.timeout);(is(this.request)?this.request.then(self.fetch):self.fetch(this.request)).then((n=>{var s;this.response=this.loader=n;const o=Math.max(self.performance.now(),r.loading.start);if(self.clearTimeout(this.requestTimeout),e.timeout=u,this.requestTimeout=self.setTimeout((()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(r,t,this.response))}),u-(o-r.loading.start)),!n.ok){const{status:t,statusText:e}=n;throw new Uo(e||"fetch, bad network response",t,n)}r.loading.first=o,r.total=function(t){const e=t.get("Content-Range");if(e){const t=function(t){const e=Mo.exec(t);if(e)return parseInt(e[2])-parseInt(e[1])+1}(e);if(i(t))return t}const n=t.get("Content-Length");if(n)return parseInt(n)}(n.headers)||r.total;const l=null==(s=this.callbacks)?void 0:s.onProgress;return l&&i(e.highWaterMark)?this.loadProgressively(n,r,t,e.highWaterMark,l):a?n.arrayBuffer():"json"===t.responseType?n.json():n.text()})).then((n=>{var s,a;const l=this.response;if(!l)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),r.loading.end=Math.max(self.performance.now(),r.loading.first);const u=n[o];u&&(r.loaded=r.total=u);const h={url:l.url,data:n,code:l.status},c=null==(s=this.callbacks)?void 0:s.onProgress;c&&!i(e.highWaterMark)&&c(r,t,n,l),null==(a=this.callbacks)||a.onSuccess(h,r,t,l)})).catch((e=>{var n;if(self.clearTimeout(this.requestTimeout),r.aborted)return;const i=e&&e.code||0,s=e?e.message:null;null==(n=this.callbacks)||n.onError({code:i,text:s},t,e?e.details:null,r)}))}getCacheAge(){let t=null;if(this.response){const e=this.response.headers.get("age");t=e?parseFloat(e):null}return t}getResponseHeader(t){return this.response?this.response.headers.get(t):null}loadProgressively(t,e,n,i=0,r){const s=new Pi,a=t.body.getReader(),o=()=>a.read().then((a=>{if(a.done)return s.dataLength&&r(e,n,s.flush().buffer,t),Promise.resolve(new ArrayBuffer(0));const l=a.value,u=l.length;return e.loaded+=u,u<i||s.dataLength?(s.push(l),s.dataLength>=i&&r(e,n,s.flush().buffer,t)):r(e,n,l.buffer,t),o()})).catch((()=>Promise.reject()));return o()}}function Bo(t,e){return new self.Request(t.url,e)}class Uo extends Error{constructor(t,e,n){super(t),this.code=void 0,this.details=void 0,this.code=e,this.details=n}}const $o=/^age:\s*[\d.]+\s*$/im;class Go{constructor(t){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=t&&t.xhrSetup||null,this.stats=new j,this.retryDelay=0}destroy(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null,this.context=null,this.xhrSetup=null}abortInternal(){const t=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),t&&(t.onreadystatechange=null,t.onprogress=null,4!==t.readyState&&(this.stats.aborted=!0,t.abort()))}abort(){var t;this.abortInternal(),null!=(t=this.callbacks)&&t.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)}load(t,e,n){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=t,this.config=e,this.callbacks=n,this.loadInternal()}loadInternal(){const{config:t,context:e}=this;if(!t||!e)return;const n=this.loader=new self.XMLHttpRequest,i=this.stats;i.loading.first=0,i.loaded=0,i.aborted=!1;const r=this.xhrSetup;r?Promise.resolve().then((()=>{if(this.loader===n&&!this.stats.aborted)return r(n,e.url)})).catch((t=>{if(this.loader===n&&!this.stats.aborted)return n.open("GET",e.url,!0),r(n,e.url)})).then((()=>{this.loader!==n||this.stats.aborted||this.openAndSendXhr(n,e,t)})).catch((t=>{var r;null==(r=this.callbacks)||r.onError({code:n.status,text:t.message},e,n,i)})):this.openAndSendXhr(n,e,t)}openAndSendXhr(t,e,n){t.readyState||t.open("GET",e.url,!0);const r=e.headers,{maxTimeToFirstByteMs:s,maxLoadTimeMs:a}=n.loadPolicy;if(r)for(const e in r)t.setRequestHeader(e,r[e]);e.rangeEnd&&t.setRequestHeader("Range","bytes="+e.rangeStart+"-"+(e.rangeEnd-1)),t.onreadystatechange=this.readystatechange.bind(this),t.onprogress=this.loadprogress.bind(this),t.responseType=e.responseType,self.clearTimeout(this.requestTimeout),n.timeout=s&&i(s)?s:a,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),n.timeout),t.send()}readystatechange(){const{context:t,loader:e,stats:n}=this;if(!t||!e)return;const i=e.readyState,r=this.config;if(!n.aborted&&i>=2&&(0===n.loading.first&&(n.loading.first=Math.max(self.performance.now(),n.loading.start),r.timeout!==r.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),r.timeout=r.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),r.loadPolicy.maxLoadTimeMs-(n.loading.first-n.loading.start)))),4===i)){self.clearTimeout(this.requestTimeout),e.onreadystatechange=null,e.onprogress=null;const i=e.status,l="text"===e.responseType?e.responseText:null;if(i>=200&&i<300){const r=null!=l?l:e.response;if(null!=r){var s,a;n.loading.end=Math.max(self.performance.now(),n.loading.first);const o="arraybuffer"===e.responseType?r.byteLength:r.length;n.loaded=n.total=o,n.bwEstimate=8e3*n.total/(n.loading.end-n.loading.first);const l=null==(s=this.callbacks)?void 0:s.onProgress;l&&l(n,t,r,e);const u={url:e.responseURL,data:r,code:i};return void(null==(a=this.callbacks)||a.onSuccess(u,n,t,e))}}const u=r.loadPolicy.errorRetry;var o;if(we(u,n.retry,!1,{url:t.url,data:void 0,code:i}))this.retry(u);else C.error(`${i} while loading ${t.url}`),null==(o=this.callbacks)||o.onError({code:i,text:e.statusText},t,e,n)}}loadtimeout(){if(!this.config)return;const t=this.config.loadPolicy.timeoutRetry;if(we(t,this.stats.retry,!0))this.retry(t);else{var e;C.warn(`timeout while loading ${null==(e=this.context)?void 0:e.url}`);const t=this.callbacks;t&&(this.abortInternal(),t.onTimeout(this.stats,this.context,this.loader))}}retry(t){const{context:e,stats:n}=this;this.retryDelay=be(t,n.retry),n.retry++,C.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${null==e?void 0:e.url}, retrying ${n.retry}/${t.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(t){const e=this.stats;e.loaded=t.loaded,t.lengthComputable&&(e.total=t.total)}getCacheAge(){let t=null;if(this.loader&&$o.test(this.loader.getAllResponseHeaders())){const e=this.loader.getResponseHeader("age");t=e?parseFloat(e):null}return t}getResponseHeader(t){return this.loader&&new RegExp(`^${t}:\\s*[\\d.]+\\s*$`,"im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(t):null}}const Ko=E(E({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,maxDevicePixelRatio:Number.POSITIVE_INFINITY,preferManagedMediaSource:!0,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,startOnSegmentBoundary:!1,maxBufferSize:6e7,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:Go,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:class extends w{constructor(t){super("abr",t.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 e;const{fragCurrent:n,partCurrent:r,hls:s}=this,{autoLevelEnabled:a,media:o}=s;if(!n||!o)return;const u=performance.now(),h=r?r.stats:n.stats,c=r?r.duration:n.duration,d=u-h.loading.start,f=s.minAutoLevel,p=n.level,g=this._nextAutoLevel;if(h.aborted||h.loaded&&h.loaded===h.total||p<=f)return this.clearTimer(),void(this._nextAutoLevel=-1);if(!a)return;const _=g>-1&&g!==p,m=!!t||_;if(!m&&(o.paused||!o.playbackRate||!o.readyState))return;const v=s.mainForwardBufferInfo;if(!m&&null===v)return;const y=this.bwEstimator.getEstimateTTFB(),b=Math.abs(o.playbackRate);if(d<=Math.max(y,c/(2*b)*1e3))return;const E=v?v.len/b:0,w=h.loading.first?h.loading.first-h.loading.start:-1,T=h.loaded&&w>-1,k=this.getBwEstimate(),S=s.levels,A=S[p],D=Math.max(h.loaded,Math.round(c*(n.bitrate||A.averageBitrate)/8));let C=T?d-w:d;C<1&&T&&(C=Math.min(d,8*h.loaded/k));const x=T?1e3*h.loaded/C:0,R=y/1e3,L=x?(D-h.loaded)/x:8*D/k+R;if(L<=E)return;const I=x?8*x:k,P=!0===(null==(e=(null==t?void 0:t.details)||this.hls.latestLevelDetails)?void 0:e.live),O=this.hls.config.abrBandWidthUpFactor;let F,M=Number.POSITIVE_INFINITY;for(F=p-1;F>f;F--){const t=S[F].maxBitrate,e=!S[F].details||P;if(M=this.getTimeToLoadFrag(R,I,c*t,e),M<Math.min(E,c+R))break}if(M>=L)return;if(M>10*c)return;T?this.bwEstimator.sample(d-Math.min(y,w),h.loaded):this.bwEstimator.sampleTTFB(d);const N=S[F].maxBitrate;this.getBwEstimate()*O>N&&this.resetEstimator(N);const B=this.findBestLevel(N,f,F,0,E,1,1);B>-1&&(F=B),this.warn(`Fragment ${n.sn}${r?" part "+r.index:""} of level ${p} is loading too slowly;\n Fragment duration: ${n.duration.toFixed(3)}\n Time to underbuffer: ${E.toFixed(3)} s\n Estimated load time for current fragment: ${L.toFixed(3)} s\n Estimated load time for down switch fragment: ${M.toFixed(3)} s\n TTFB estimate: ${0|w} ms\n Current BW estimate: ${i(k)?0|k:"Unknown"} bps\n New BW estimate: ${0|this.getBwEstimate()} bps\n Switching to level ${F} @ ${0|N} bps`),s.nextLoadLevel=s.nextAutoLevel=F,this.clearTimer();const U=()=>{if(this.clearTimer(),this.fragCurrent===n&&this.hls.loadLevel===F&&F>0){const t=this.getStarvationDelay();if(this.warn(`Aborting inflight request ${F>0?"and switching down":""}\n Fragment duration: ${n.duration.toFixed(3)} s\n Time to underbuffer: ${t.toFixed(3)} s`),n.abortRequests(),this.fragCurrent=this.partCurrent=null,F>f){let e=this.findBestLevel(this.hls.levels[f].bitrate,f,F,0,t,1,1);-1===e&&(e=f),this.hls.nextLoadLevel=this.hls.nextAutoLevel=e,this.resetEstimator(this.hls.levels[e].bitrate)}}};_||L>2*M?U():this.timer=self.setInterval(U,1e3*M),s.trigger(l.FRAG_LOAD_EMERGENCY_ABORTED,{frag:n,part:r,stats:h})},this.hls=t,this.bwEstimator=this.initEstimator(),this.registerListeners()}resetEstimator(t){t&&(this.log(`setting initial bwe to ${t}`),this.hls.config.abrEwmaDefaultEstimate=t),this.firstSelection=-1,this.bwEstimator=this.initEstimator()}initEstimator(){const t=this.hls.config;return new m(t.abrEwmaSlowVoD,t.abrEwmaFastVoD,t.abrEwmaDefaultEstimate)}registerListeners(){const{hls:t}=this;t.on(l.MANIFEST_LOADING,this.onManifestLoading,this),t.on(l.FRAG_LOADING,this.onFragLoading,this),t.on(l.FRAG_LOADED,this.onFragLoaded,this),t.on(l.FRAG_BUFFERED,this.onFragBuffered,this),t.on(l.LEVEL_SWITCHING,this.onLevelSwitching,this),t.on(l.LEVEL_LOADED,this.onLevelLoaded,this),t.on(l.LEVELS_UPDATED,this.onLevelsUpdated,this),t.on(l.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),t.on(l.ERROR,this.onError,this)}unregisterListeners(){const{hls:t}=this;t&&(t.off(l.MANIFEST_LOADING,this.onManifestLoading,this),t.off(l.FRAG_LOADING,this.onFragLoading,this),t.off(l.FRAG_LOADED,this.onFragLoaded,this),t.off(l.FRAG_BUFFERED,this.onFragBuffered,this),t.off(l.LEVEL_SWITCHING,this.onLevelSwitching,this),t.off(l.LEVEL_LOADED,this.onLevelLoaded,this),t.off(l.LEVELS_UPDATED,this.onLevelsUpdated,this),t.off(l.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),t.off(l.ERROR,this.onError,this))}destroy(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=this.supportedCache=null,this.fragCurrent=this.partCurrent=null}onManifestLoading(t,e){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(t,e){const n=e.frag;if(!this.ignoreFragment(n)){var i;if(!n.bitrateTest)this.fragCurrent=n,this.partCurrent=null!=(i=e.part)?i:null;this.clearTimer(),this.timer=self.setInterval(this._abandonRulesCheck,100)}}onLevelSwitching(t,e){this.clearTimer()}onError(t,e){if(!e.fatal)switch(e.details){case o.BUFFER_ADD_CODEC_ERROR:case o.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case o.FRAG_LOAD_TIMEOUT:{const t=e.frag,{fragCurrent:n,partCurrent:i}=this;if(t&&n&&t.sn===n.sn&&t.level===n.level){const e=performance.now(),n=i?i.stats:t.stats,r=e-n.loading.start,s=n.loading.first?n.loading.first-n.loading.start:-1;if(n.loaded&&s>-1){const t=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(r-Math.min(t,s),n.loaded)}else this.bwEstimator.sampleTTFB(r)}break}}}getTimeToLoadFrag(t,e,n,i){return t+n/e+(i?t+this.lastLevelLoadSec:0)}onLevelLoaded(t,e){const n=this.hls.config,{loading:r}=e.stats,s=r.end-r.first;i(s)&&(this.lastLevelLoadSec=s/1e3),e.details.live?this.bwEstimator.update(n.abrEwmaSlowLive,n.abrEwmaFastLive):this.bwEstimator.update(n.abrEwmaSlowVoD,n.abrEwmaFastVoD),this.timer>-1&&this._abandonRulesCheck(e.levelInfo)}onFragLoaded(t,{frag:e,part:n}){const i=n?n.stats:e.stats;if(e.type===f&&this.bwEstimator.sampleTTFB(i.loading.first-i.loading.start),!this.ignoreFragment(e)){if(this.clearTimer(),e.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){const t=n?n.duration:e.duration,r=this.hls.levels[e.level],s=(r.loaded?r.loaded.bytes:0)+i.loaded,a=(r.loaded?r.loaded.duration:0)+t;r.loaded={bytes:s,duration:a},r.realBitrate=Math.round(8*s/a)}if(e.bitrateTest){const t={stats:i,frag:e,part:n,id:e.type};this.onFragBuffered(l.FRAG_BUFFERED,t),e.bitrateTest=!1}else this.lastLoadedFragLevel=e.level}}onFragBuffered(t,e){const{frag:n,part:i}=e,r=null!=i&&i.stats.loaded?i.stats:n.stats;if(r.aborted)return;if(this.ignoreFragment(n))return;const s=r.parsing.end-r.loading.start-Math.min(r.loading.first-r.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(s,r.loaded),r.bwEstimate=this.getBwEstimate(),n.bitrateTest?this.bitrateTestDelay=s/1e3:this.bitrateTestDelay=0}ignoreFragment(t){return t.type!==f||"initSegment"===t.sn}clearTimer(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)}get firstAutoLevel(){const{maxAutoLevel:t,minAutoLevel:e}=this.hls,n=this.getBwEstimate(),i=this.hls.config.maxStarvationDelay,r=this.findBestLevel(n,e,t,0,i,1,1);if(r>-1)return r;const s=this.hls.firstLevel,a=Math.min(Math.max(s,e),t);return this.warn(`Could not find best starting auto level. Defaulting to first in playlist ${s} clamped to ${a}`),a}get forcedAutoLevel(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}get nextAutoLevel(){const t=this.forcedAutoLevel,e=this.bwEstimator.canEstimate(),n=this.lastLoadedFragLevel>-1;if(!(-1===t||e&&n&&this.nextAutoLevelKey!==this.getAutoLevelKey()))return t;const i=e&&n?this.getNextABRAutoLevel():this.firstAutoLevel;if(-1!==t){const e=this.hls.levels;if(e.length>Math.max(t,i)&&e[t].loadError<=e[i].loadError)return t}return this._nextAutoLevel=i,this.nextAutoLevelKey=this.getAutoLevelKey(),i}getAutoLevelKey(){return`${this.getBwEstimate()}_${this.getStarvationDelay().toFixed(2)}`}getNextABRAutoLevel(){const{fragCurrent:t,partCurrent:e,hls:n}=this;if(n.levels.length<=1)return n.loadLevel;const{maxAutoLevel:i,config:r,minAutoLevel:s}=n,a=e?e.duration:t?t.duration:0,o=this.getBwEstimate(),l=this.getStarvationDelay();let u=r.abrBandWidthFactor,h=r.abrBandWidthUpFactor;if(l){const t=this.findBestLevel(o,s,i,l,0,u,h);if(t>=0)return this.rebufferNotice=-1,t}let c=a?Math.min(a,r.maxStarvationDelay):r.maxStarvationDelay;if(!l){const t=this.bitrateTestDelay;if(t){c=(a?Math.min(a,r.maxLoadingDelay):r.maxLoadingDelay)-t,this.info(`bitrate test took ${Math.round(1e3*t)}ms, set first fragment max fetchDuration to ${Math.round(1e3*c)} ms`),u=h=1}}const d=this.findBestLevel(o,s,i,l,c,u,h);if(this.rebufferNotice!==d&&(this.rebufferNotice=d,this.info(`${l?"rebuffering expected":"buffer is empty"}, optimal quality level ${d}`)),d>-1)return d;const f=n.levels[s],p=n.loadLevelObj;return p&&(null==f?void 0:f.bitrate)<p.bitrate?s:n.loadLevel}getStarvationDelay(){const t=this.hls,e=t.media;if(!e)return 1/0;const n=e&&0!==e.playbackRate?Math.abs(e.playbackRate):1,i=t.mainForwardBufferInfo;return(i?i.len:0)/n}getBwEstimate(){return this.bwEstimator.canEstimate()?this.bwEstimator.getEstimate():this.hls.config.abrEwmaDefaultEstimate}findBestLevel(t,e,n,r,s,a,o){var l;const u=r+s,h=this.lastLoadedFragLevel,c=-1===h?this.hls.firstLevel:h,{fragCurrent:d,partCurrent:f}=this,{levels:p,allAudioTracks:g,loadLevel:_,config:m}=this.hls;if(1===p.length)return 0;const v=p[c],y=!(null==(l=this.hls.latestLevelDetails)||!l.live),b=-1===_||-1===h;let E,w="SDR",T=(null==v?void 0:v.frameRate)||0;const{audioPreference:k,videoPreference:S}=m,A=this.audioTracksByGroup||(this.audioTracksByGroup=re(g));let D=-1;if(b){if(-1!==this.firstSelection)return this.firstSelection;const r=this.codecTiers||(this.codecTiers=function(t,e,n,i){return t.slice(n,i+1).reduce(((t,n,i)=>{if(!n.codecSet)return t;const r=n.audioGroups;let s=t[n.codecSet];s||(t[n.codecSet]=s={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,minIndex:i,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!r,fragmentError:0}),s.minBitrate=Math.min(s.minBitrate,n.bitrate);const a=Math.min(n.height,n.width);return s.minHeight=Math.min(s.minHeight,a),s.minFramerate=Math.min(s.minFramerate,n.frameRate),s.minIndex=Math.min(s.minIndex,i),s.maxScore=Math.max(s.maxScore,n.score),s.fragmentError+=n.fragmentError,s.videoRanges[n.videoRange]=(s.videoRanges[n.videoRange]||0)+1,r&&r.forEach((t=>{if(!t)return;const n=e.groups[t];n&&(s.hasDefaultAudio=s.hasDefaultAudio||e.hasDefaultAudio?n.hasDefault:n.hasAutoSelect||!e.hasDefaultAudio&&!e.hasAutoSelectAudio,Object.keys(n.channels).forEach((t=>{s.channels[t]=(s.channels[t]||0)+n.channels[t]})))})),t}),{})}(p,A,e,n)),s=function(t,e,n,r,s){const a=Object.keys(t),o=null==r?void 0:r.channels,l=null==r?void 0:r.audioCodec,u=null==s?void 0:s.videoCodec,h=o&&2===parseInt(o);let c=!1,d=!1,f=1/0,p=1/0,g=1/0,_=1/0,m=0,v=[];const{preferHDR:y,allowedVideoRanges:b}=ee(e,s);for(let e=a.length;e--;){const n=t[a[e]];c||(c=n.channels[2]>0),f=Math.min(f,n.minHeight),p=Math.min(p,n.minFramerate),g=Math.min(g,n.minBitrate),b.filter((t=>n.videoRanges[t]>0)).length>0&&(d=!0)}f=i(f)?f:0,p=i(p)?p:0;const E=Math.max(1080,f),w=Math.max(30,p);g=i(g)?g:n,n=Math.max(g,n),d||(e=void 0);const T=a.length>1;return{codecSet:a.reduce(((e,i)=>{const r=t[i];if(i===e)return e;if(v=d?b.filter((t=>r.videoRanges[t]>0)):[],T){if(r.minBitrate>n)return ie(i,`min bitrate of ${r.minBitrate} > current estimate of ${n}`),e;if(!r.hasDefaultAudio)return ie(i,"no renditions with default or auto-select sound found"),e;if(l&&i.indexOf(l.substring(0,4))%5!=0)return ie(i,`audio codec preference "${l}" not found`),e;if(o&&!h){if(!r.channels[o])return ie(i,`no renditions with ${o} channel sound found (channels options: ${Object.keys(r.channels)})`),e}else if((!l||h)&&c&&0===r.channels[2])return ie(i,"no renditions with stereo sound found"),e;if(r.minHeight>E)return ie(i,`min resolution of ${r.minHeight} > maximum of ${E}`),e;if(r.minFramerate>w)return ie(i,`min framerate of ${r.minFramerate} > maximum of ${w}`),e;if(!v.some((t=>r.videoRanges[t]>0)))return ie(i,`no variants with VIDEO-RANGE of ${ne(v)} found`),e;if(u&&i.indexOf(u.substring(0,4))%5!=0)return ie(i,`video codec preference "${u}" not found`),e;if(r.maxScore<m)return ie(i,`max score of ${r.maxScore} < selected max of ${m}`),e}return e&&(Rt(i)>=Rt(e)||r.fragmentError>t[e].fragmentError)?e:(_=r.minIndex,m=r.maxScore,i)}),void 0),videoRanges:v,preferHDR:y,minFramerate:p,minBitrate:g,minIndex:_}}(r,w,t,k,S),{codecSet:a,videoRanges:o,minFramerate:l,minBitrate:u,minIndex:h,preferHDR:c}=s;D=h,E=a,w=c?o[o.length-1]:o[0],T=l,t=Math.max(t,u),this.log(`picked start tier ${ne(s)}`)}else E=null==v?void 0:v.codecSet,w=null==v?void 0:v.videoRange;const C=f?f.duration:d?d.duration:0,x=this.bwEstimator.getEstimateTTFB()/1e3,R=[];for(let l=n;l>=e;l--){var L;const e=p[l],d=l>c;if(!e)continue;if(m.useMediaCapabilities&&!e.supportedResult&&!e.supportedPromise){const n=navigator.mediaCapabilities;"function"==typeof(null==n?void 0:n.decodingInfo)&&Kt(e,A,w,T,t,k)?(e.supportedPromise=jt(e,A,n,this.supportedCache),e.supportedPromise.then((t=>{if(!this.hls)return;e.supportedResult=t;const n=this.hls.levels,i=n.indexOf(e);t.error?this.warn(`MediaCapabilities decodingInfo error: "${t.error}" for level ${i} ${ne(t)}`):t.supported?t.decodingInfoResults.some((t=>!1===t.smooth||!1===t.powerEfficient))&&this.log(`MediaCapabilities decodingInfo for level ${i} not smooth or powerEfficient: ${ne(t)}`):(this.warn(`Unsupported MediaCapabilities decodingInfo result for level ${i} ${ne(t)}`),i>-1&&n.length>1&&(this.log(`Removing unsupported level ${i}`),this.hls.removeLevel(i),-1===this.hls.loadLevel&&(this.hls.nextLoadLevel=0)))})).catch((t=>{this.warn(`Error handling MediaCapabilities decodingInfo: ${t}`)}))):e.supportedResult=$t}if((E&&e.codecSet!==E||w&&e.videoRange!==w||d&&T>e.frameRate||!d&&T>0&&T<e.frameRate||null!=(L=e.supportedResult)&&null!=(L=L.decodingInfoResults)&&L.some((t=>!1===t.smooth)))&&(!b||l!==D)){R.push(l);continue}const g=e.details,v=(f?null==g?void 0:g.partTarget:null==g?void 0:g.averagetargetduration)||C;let S;S=d?o*t:a*t;const I=C&&r>=2*C&&0===s?e.averageBitrate:e.maxBitrate,P=this.getTimeToLoadFrag(x,S,I*v,void 0===g);if(S>=I&&(l===h||0===e.loadError&&0===e.fragmentError)&&(P<=x||!i(P)||y&&!this.bitrateTestDelay||P<u)){const t=this.forcedAutoLevel;return l===_||-1!==t&&t===_||(R.length&&this.trace(`Skipped level(s) ${R.join(",")} of ${n} max with CODECS and VIDEO-RANGE:"${p[R[0]].codecs}" ${p[R[0]].videoRange}; not compatible with "${E}" ${w}`),this.info(`switch candidate:${c}->${l} adjustedbw(${Math.round(S)})-bitrate=${Math.round(S-I)} ttfb:${x.toFixed(1)} avgDuration:${v.toFixed(1)} maxFetchDuration:${u.toFixed(1)} fetchDuration:${P.toFixed(1)} firstSelection:${b} codecSet:${e.codecSet} videoRange:${e.videoRange} hls.loadLevel:${_}`)),b&&(this.firstSelection=l),l}}return-1}set nextAutoLevel(t){const e=this.deriveNextAutoLevel(t);this._nextAutoLevel!==e&&(this.nextAutoLevelKey="",this._nextAutoLevel=e)}deriveNextAutoLevel(t){const{maxAutoLevel:e,minAutoLevel:n}=this.hls;return Math.min(Math.max(t,n),e)}},bufferController:class extends w{constructor(t,e){var n;super("buffer-controller",t.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=t=>{var e;this.hls&&"open"===(null==(e=this.mediaSource)?void 0:e.readyState)&&this.hls.pauseBuffering()},this._onStartStreaming=t=>{this.hls&&this.hls.resumeBuffering()},this._onMediaSourceOpen=t=>{const{media:e,mediaSource:n}=this;t&&this.log("Media source opened"),e&&n&&(n.removeEventListener("sourceopen",this._onMediaSourceOpen),e.removeEventListener("emptied",this._onMediaEmptied),this.updateDuration(),this.hls.trigger(l.MEDIA_ATTACHED,{media:e,mediaSource:n}),null!==this.mediaSource&&this.checkPendingTracks())},this._onMediaSourceClose=()=>{this.log("Media source closed")},this._onMediaSourceEnded=()=>{this.log("Media source ended")},this._onMediaEmptied=()=>{const{mediaSrc:t,_objectUrl:e}=this;t!==e&&this.error(`Media element src was set while attaching MediaSource (${e} > ${t})`)},this.hls=t,this.fragmentTracker=e,this.appendSource=(n=x(t.config.preferManagedMediaSource),"undefined"!=typeof self&&n===self.ManagedMediaSource),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:t}=this;t.on(l.MEDIA_ATTACHING,this.onMediaAttaching,this),t.on(l.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(l.MANIFEST_LOADING,this.onManifestLoading,this),t.on(l.MANIFEST_PARSED,this.onManifestParsed,this),t.on(l.BUFFER_RESET,this.onBufferReset,this),t.on(l.BUFFER_APPENDING,this.onBufferAppending,this),t.on(l.BUFFER_CODECS,this.onBufferCodecs,this),t.on(l.BUFFER_EOS,this.onBufferEos,this),t.on(l.BUFFER_FLUSHING,this.onBufferFlushing,this),t.on(l.LEVEL_UPDATED,this.onLevelUpdated,this),t.on(l.FRAG_PARSED,this.onFragParsed,this),t.on(l.FRAG_CHANGED,this.onFragChanged,this),t.on(l.ERROR,this.onError,this)}unregisterListeners(){const{hls:t}=this;t.off(l.MEDIA_ATTACHING,this.onMediaAttaching,this),t.off(l.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(l.MANIFEST_LOADING,this.onManifestLoading,this),t.off(l.MANIFEST_PARSED,this.onManifestParsed,this),t.off(l.BUFFER_RESET,this.onBufferReset,this),t.off(l.BUFFER_APPENDING,this.onBufferAppending,this),t.off(l.BUFFER_CODECS,this.onBufferCodecs,this),t.off(l.BUFFER_EOS,this.onBufferEos,this),t.off(l.BUFFER_FLUSHING,this.onBufferFlushing,this),t.off(l.LEVEL_UPDATED,this.onLevelUpdated,this),t.off(l.FRAG_PARSED,this.onFragParsed,this),t.off(l.FRAG_CHANGED,this.onFragChanged,this),t.off(l.ERROR,this.onError,this)}transferMedia(){const{media:t,mediaSource:e}=this;if(!t)return null;const n={};if(this.operationQueue){const t=this.isUpdating();t||this.operationQueue.removeBlockers();const e=this.isQueued();(t||e)&&this.warn(`Transfering MediaSource with${e?" operations in queue":""}${t?" updating SourceBuffer(s)":""} ${this.operationQueue}`),this.operationQueue.destroy()}const i=this.transferData;return!this.sourceBufferCount&&i&&i.mediaSource===e?y(n,i.tracks):this.sourceBuffers.forEach((t=>{const[e]=t;e&&(n[e]=y({},this.tracks[e]),this.removeBuffer(e)),t[0]=t[1]=null})),{media:t,mediaSource:e,tracks:n}}initTracks(){this.sourceBuffers=[[null,null],[null,null]],this.tracks={},this.resetQueue(),this.resetAppendErrors(),this.lastMpegAudioChunk=this.blockedAudioAppend=null,this.lastVideoAppendEnd=0}onManifestLoading(){this.bufferCodecEventsTotal=0,this.details=null}onManifestParsed(t,e){var n;let i=2;(e.audio&&!e.video||!e.altAudio)&&(i=1),this.bufferCodecEventsTotal=i,this.log(`${i} bufferCodec event(s) expected.`),null!=(n=this.transferData)&&n.mediaSource&&this.sourceBufferCount&&i&&this.bufferCreated()}onMediaAttaching(t,e){const n=this.media=e.media;this.transferData=this.overrides=void 0;const i=x(this.appendSource);if(i){const t=!!e.mediaSource;(t||e.overrides)&&(this.transferData=e,this.overrides=e.overrides);const r=this.mediaSource=e.mediaSource||new i;if(this.assignMediaSource(r),t)this._objectUrl=n.src,this.attachTransferred();else{const t=this._objectUrl=self.URL.createObjectURL(r);if(this.appendSource)try{n.removeAttribute("src");const e=self.ManagedMediaSource;n.disableRemotePlayback=n.disableRemotePlayback||e&&r instanceof e,_s(n),function(t,e){const n=self.document.createElement("source");n.type="video/mp4",n.src=e,t.appendChild(n)}(n,t),n.load()}catch(e){n.src=t}else n.src=t}n.addEventListener("emptied",this._onMediaEmptied)}}assignMediaSource(t){var e,n;this.log(`${(null==(e=this.transferData)?void 0:e.mediaSource)===t?"transferred":"created"} media source: ${null==(n=t.constructor)?void 0:n.name}`),t.addEventListener("sourceopen",this._onMediaSourceOpen),t.addEventListener("sourceended",this._onMediaSourceEnded),t.addEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(t.addEventListener("startstreaming",this._onStartStreaming),t.addEventListener("endstreaming",this._onEndStreaming))}attachTransferred(){const t=this.media,e=this.transferData;if(!e||!t)return;const n=this.tracks,i=e.tracks,r=i?Object.keys(i):null,s=r?r.length:0,a=()=>{Promise.resolve().then((()=>{this.media&&this.mediaSourceOpenOrEnded&&this._onMediaSourceOpen()}))};if(i&&r&&s){if(!this.tracksReady)return this.hls.config.startFragPrefetch=!0,void this.log("attachTransferred: waiting for SourceBuffer track info");if(this.log(`attachTransferred: (bufferCodecEventsTotal ${this.bufferCodecEventsTotal})\nrequired tracks: ${ne(n,((t,e)=>"initSegment"===t?void 0:e))};\ntransfer tracks: ${ne(i,((t,e)=>"initSegment"===t?void 0:e))}}`),!R(i,n)){e.mediaSource=null,e.tracks=void 0;const r=t.currentTime,s=this.details,a=Math.max(r,(null==s?void 0:s.fragments[0].start)||0);return a-r>1?void this.log(`attachTransferred: waiting for playback to reach new tracks start time ${r} -> ${a}`):(this.warn(`attachTransferred: resetting MediaSource for incompatible tracks ("${Object.keys(i)}"->"${Object.keys(n)}") start time: ${a} currentTime: ${r}`),this.onMediaDetaching(l.MEDIA_DETACHING,{}),this.onMediaAttaching(l.MEDIA_ATTACHING,e),void(t.currentTime=a))}this.transferData=void 0,r.forEach((t=>{const e=t,n=i[e];if(n){const t=n.buffer;if(t){const i=this.fragmentTracker,r=n.id;if(i.hasFragments(r)||i.hasParts(r)){const n=en.getBuffered(t);i.detectEvictedFragments(e,n,r,null,!0)}const s=ms(e),a=[e,t];this.sourceBuffers[s]=a,t.updating&&this.operationQueue&&this.operationQueue.prependBlocker(e),this.trackSourceBuffer(e,n)}}})),a(),this.bufferCreated()}else this.log("attachTransferred: MediaSource w/o SourceBuffers"),a()}get mediaSourceOpenOrEnded(){var t;const e=null==(t=this.mediaSource)?void 0:t.readyState;return"open"===e||"ended"===e}onMediaDetaching(t,e){const n=!!e.transferMedia;this.transferData=this.overrides=void 0;const{media:i,mediaSource:r,_objectUrl:s}=this;if(r){if(this.log("media source "+(n?"transferring":"detaching")),n)this.sourceBuffers.forEach((([t])=>{t&&this.removeBuffer(t)})),this.resetQueue();else{if(this.mediaSourceOpenOrEnded){const t="open"===r.readyState;try{const e=r.sourceBuffers;for(let n=e.length;n--;)t&&e[n].abort(),r.removeSourceBuffer(e[n]);t&&r.endOfStream()}catch(t){this.warn(`onMediaDetaching: ${t.message} while calling endOfStream`)}}this.sourceBufferCount&&this.onBufferReset()}r.removeEventListener("sourceopen",this._onMediaSourceOpen),r.removeEventListener("sourceended",this._onMediaSourceEnded),r.removeEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(r.removeEventListener("startstreaming",this._onStartStreaming),r.removeEventListener("endstreaming",this._onEndStreaming)),this.mediaSource=null,this._objectUrl=null}i&&(i.removeEventListener("emptied",this._onMediaEmptied),n||(s&&self.URL.revokeObjectURL(s),this.mediaSrc===s?(i.removeAttribute("src"),this.appendSource&&_s(i),i.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.media=null),this.hls.trigger(l.MEDIA_DETACHED,e)}onBufferReset(){this.sourceBuffers.forEach((([t])=>{t&&this.resetBuffer(t)})),this.initTracks()}resetBuffer(t){var e;const n=null==(e=this.tracks[t])?void 0:e.buffer;if(this.removeBuffer(t),n)try{var i;null!=(i=this.mediaSource)&&i.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(n)}catch(e){this.warn(`onBufferReset ${t}`,e)}delete this.tracks[t]}removeBuffer(t){this.removeBufferListeners(t),this.sourceBuffers[ms(t)]=[null,null];const e=this.tracks[t];e&&(e.buffer=void 0)}resetQueue(){this.operationQueue&&this.operationQueue.destroy(),this.operationQueue=new ds(this.tracks)}onBufferCodecs(t,e){var n;const i=this.tracks,r=Object.keys(e);this.log(`BUFFER_CODECS: "${r}" (current SB count ${this.sourceBufferCount})`);const s="audiovideo"in e&&(i.audio||i.video)||i.audiovideo&&("audio"in e||"video"in e),a=!s&&this.sourceBufferCount&&this.media&&r.some((t=>!i[t]));s||a?this.warn(`Unsupported transition between "${Object.keys(i)}" and "${r}" SourceBuffers`):(r.forEach((t=>{var n,r;const s=e[t],{id:a,codec:o,levelCodec:l,container:u,metadata:h,supplemental:c}=s;let d=i[t];const f=null==(n=this.transferData)||null==(n=n.tracks)?void 0:n[t],p=null!=f&&f.buffer?f:d,g=(null==p?void 0:p.pendingCodec)||(null==p?void 0:p.codec),_=null==p?void 0:p.levelCodec;d||(d=i[t]={buffer:void 0,listeners:[],codec:o,supplemental:c,container:u,levelCodec:l,metadata:h,id:a});const m=Ot(g,_),v=null==m?void 0:m.replace(fs,"$1");let y=Ot(o,l);const b=null==(r=y)?void 0:r.replace(fs,"$1");y&&m&&v!==b&&("audio"===t.slice(0,5)&&(y=Pt(y,this.appendSource)),this.log(`switching codec ${g} to ${y}`),y!==(d.pendingCodec||d.codec)&&(d.pendingCodec=y),d.container=u,this.appendChangeType(t,u,y))})),(this.tracksReady||this.sourceBufferCount)&&(e.tracks=this.sourceBufferTracks),this.sourceBufferCount||(this.bufferCodecEventsTotal>1&&!this.tracks.video&&!e.video&&"main"===(null==(n=e.audio)?void 0:n.id)&&(this.log("Main audio-only"),this.bufferCodecEventsTotal=1),this.mediaSourceOpenOrEnded&&this.checkPendingTracks()))}get sourceBufferTracks(){return Object.keys(this.tracks).reduce(((t,e)=>{const n=this.tracks[e];return t[e]={id:n.id,container:n.container,codec:n.codec,levelCodec:n.levelCodec},t}),{})}appendChangeType(t,e,n){const i=`${e};codecs=${n}`,r={label:`change-type=${i}`,execute:()=>{const r=this.tracks[t];if(r){const s=r.buffer;null!=s&&s.changeType&&(this.log(`changing ${t} sourceBuffer type to ${i}`),s.changeType(i),r.codec=n,r.container=e)}this.shiftAndExecuteNext(t)},onStart:()=>{},onComplete:()=>{},onError:e=>{this.warn(`Failed to change ${t} SourceBuffer type`,e)}};this.append(r,t,this.isPending(this.tracks[t]))}blockAudio(t){var e;const n=t.start,i=n+.05*t.duration;if(!0===(null==(e=this.fragmentTracker.getAppendedFrag(n,f))?void 0:e.gap))return;const r={label:"block-audio",execute:()=>{var t;const e=this.tracks.video;(this.lastVideoAppendEnd>i||null!=e&&e.buffer&&en.isBuffered(e.buffer,i)||!0===(null==(t=this.fragmentTracker.getAppendedFrag(i,f))?void 0:t.gap))&&(this.blockedAudioAppend=null,this.shiftAndExecuteNext("audio"))},onStart:()=>{},onComplete:()=>{},onError:t=>{this.warn("Error executing block-audio operation",t)}};this.blockedAudioAppend={op:r,frag:t},this.append(r,"audio",!0)}unblockAudio(){const{blockedAudioAppend:t,operationQueue:e}=this;t&&e&&(this.blockedAudioAppend=null,e.unblockAudio(t.op))}onBufferAppending(t,e){const{tracks:n}=this,{data:r,type:s,parent:u,frag:h,part:c,chunkMeta:d,offset:p}=e,g=d.buffering[s],{sn:_,cc:m}=h,v=self.performance.now();g.start=v;const y=h.stats.buffering,b=c?c.stats.buffering:null;0===y.start&&(y.start=v),b&&0===b.start&&(b.start=v);const E=n.audio;let w=!1;"audio"===s&&"audio/mpeg"===(null==E?void 0:E.container)&&(w=!this.lastMpegAudioChunk||1===d.id||this.lastMpegAudioChunk.sn!==d.sn,this.lastMpegAudioChunk=d);const T=n.video,k=null==T?void 0:T.buffer;if(k&&"initSegment"!==_){const t=c||h,e=this.blockedAudioAppend;if("audio"!==s||"main"===u||this.blockedAudioAppend||T.ending||T.ended){if("video"===s){const n=t.end;if(e){const t=e.frag.start;(n>t||n<this.lastVideoAppendEnd||en.isBuffered(k,t))&&this.unblockAudio()}this.lastVideoAppendEnd=n}}else{const e=t.start+.05*t.duration,n=k.buffered,i=this.currentOp("video");n.length||i?!i&&!en.isBuffered(k,e)&&this.lastVideoAppendEnd<e&&this.blockAudio(t):this.blockAudio(t)}}const S=(c||h).start,A={label:`append-${s}`,execute:()=>{var t;g.executeStart=self.performance.now();const e=null==(t=this.tracks[s])?void 0:t.buffer;e&&(w?this.updateTimestampOffset(e,S,.1,s,_,m):void 0!==p&&i(p)&&this.updateTimestampOffset(e,p,1e-6,s,_,m)),this.appendExecutor(r,s)},onStart:()=>{},onComplete:()=>{const t=self.performance.now();g.executeEnd=g.end=t,0===y.first&&(y.first=t),b&&0===b.first&&(b.first=t);const e={};this.sourceBuffers.forEach((([t,n])=>{t&&(e[t]=en.getBuffered(n))})),this.appendErrors[s]=0,"audio"===s||"video"===s?this.appendErrors.audiovideo=0:(this.appendErrors.audio=0,this.appendErrors.video=0),this.hls.trigger(l.BUFFER_APPENDED,{type:s,frag:h,part:c,chunkMeta:d,parent:h.type,timeRanges:e})},onError:t=>{var e;const n={type:a.MEDIA_ERROR,parent:h.type,details:o.BUFFER_APPEND_ERROR,sourceBufferName:s,frag:h,part:c,chunkMeta:d,error:t,err:t,fatal:!1},i=null==(e=this.media)?void 0:e.error;if(t.code===DOMException.QUOTA_EXCEEDED_ERR||"QuotaExceededError"==t.name||"quota"in t)n.details=o.BUFFER_FULL_ERROR;else if(t.code===DOMException.INVALID_STATE_ERR&&this.mediaSourceOpenOrEnded&&!i)n.errorAction=Ie(!0);else if(t.name===ps&&0===this.sourceBufferCount)n.errorAction=Ie(!0);else{const t=++this.appendErrors[s];this.warn(`Failed ${t}/${this.hls.config.appendErrorMaxRetry} times to append segment in "${s}" sourceBuffer (${i||"no media error"})`),(t>=this.hls.config.appendErrorMaxRetry||i)&&(n.fatal=!0)}this.hls.trigger(l.ERROR,n)}};this.log(`queuing "${s}" append sn: ${_}${c?" p: "+c.index:""} of ${h.type===f?"level":"track"} ${h.level} cc: ${m}`),this.append(A,s,this.isPending(this.tracks[s]))}getFlushOp(t,e,n){return this.log(`queuing "${t}" remove ${e}-${n}`),{label:"remove",execute:()=>{this.removeExecutor(t,e,n)},onStart:()=>{},onComplete:()=>{this.hls.trigger(l.BUFFER_FLUSHED,{type:t})},onError:i=>{this.warn(`Failed to remove ${e}-${n} from "${t}" SourceBuffer`,i)}}}onBufferFlushing(t,e){const{type:n,startOffset:i,endOffset:r}=e;n?this.append(this.getFlushOp(n,i,r),n):this.sourceBuffers.forEach((([t])=>{t&&this.append(this.getFlushOp(t,i,r),t)}))}onFragParsed(t,e){const{frag:n,part:i}=e,r=[],s=i?i.elementaryStreams:n.elementaryStreams;s[z]?r.push("audiovideo"):(s[V]&&r.push("audio"),s[Z]&&r.push("video"));0===r.length&&this.warn(`Fragments must have at least one ElementaryStreamType set. type: ${n.type} level: ${n.level} sn: ${n.sn}`),this.blockBuffers((()=>{const t=self.performance.now();n.stats.buffering.end=t,i&&(i.stats.buffering.end=t);const e=i?i.stats:n.stats;this.hls.trigger(l.FRAG_BUFFERED,{frag:n,part:i,stats:e,id:n.type})}),r).catch((t=>{this.warn(`Fragment buffered callback ${t}`),this.stepOperationQueue(this.sourceBufferTypes)}))}onFragChanged(t,e){this.trimBuffers()}get bufferedToEnd(){return this.sourceBufferCount>0&&!this.sourceBuffers.some((([t])=>{if(t){const e=this.tracks[t];if(e)return!e.ended||e.ending}return!1}))}onBufferEos(t,e){var n;this.sourceBuffers.forEach((([t])=>{if(t){const n=this.tracks[t];e.type&&e.type!==t||(n.ending=!0,n.ended||(n.ended=!0,this.log(`${t} buffer reached EOS`)))}}));const i=!1!==(null==(n=this.overrides)?void 0:n.endOfStream);this.sourceBufferCount>0&&!this.sourceBuffers.some((([t])=>{var e;return t&&!(null!=(e=this.tracks[t])&&e.ended)}))?i?(this.log("Queueing EOS"),this.blockUntilOpen((()=>{this.tracksEnded();const{mediaSource:t}=this;t&&"open"===t.readyState?(this.log("Calling mediaSource.endOfStream()"),t.endOfStream(),this.hls.trigger(l.BUFFERED_TO_END,void 0)):t&&this.log(`Could not call mediaSource.endOfStream(). mediaSource.readyState: ${t.readyState}`)}))):(this.tracksEnded(),this.hls.trigger(l.BUFFERED_TO_END,void 0)):"video"===e.type&&this.unblockAudio()}tracksEnded(){this.sourceBuffers.forEach((([t])=>{if(null!==t){const e=this.tracks[t];e&&(e.ending=!1)}}))}onLevelUpdated(t,{details:e}){e.fragments.length&&(this.details=e,this.updateDuration())}updateDuration(){this.blockUntilOpen((()=>{const t=this.getDurationAndRange();t&&this.updateMediaSource(t)}))}onError(t,e){if(e.details===o.BUFFER_APPEND_ERROR&&e.frag){var n;const t=null==(n=e.errorAction)?void 0:n.nextAutoLevel;i(t)&&t!==e.frag.level&&this.resetAppendErrors()}}resetAppendErrors(){this.appendErrors={audio:0,video:0,audiovideo:0}}trimBuffers(){const{hls:t,details:e,media:n}=this;if(!n||null===e)return;if(!this.sourceBufferCount)return;const r=t.config,s=n.currentTime,a=e.levelTargetDuration,o=e.live&&null!==r.liveBackBufferLength?r.liveBackBufferLength:r.backBufferLength;if(i(o)&&o>=0){const t=Math.max(o,a),e=Math.floor(s/a)*a-t;this.flushBackBuffer(s,a,e)}const l=r.frontBufferFlushThreshold;if(i(l)&&l>0){const t=Math.max(r.maxBufferLength,l),e=Math.max(t,a),n=Math.floor(s/a)*a+e;this.flushFrontBuffer(s,a,n)}}flushBackBuffer(t,e,n){this.sourceBuffers.forEach((([t,e])=>{if(e){const r=en.getBuffered(e);if(r.length>0&&n>r.start(0)){var i;this.hls.trigger(l.BACK_BUFFER_REACHED,{bufferEnd:n});const e=this.tracks[t];if(null!=(i=this.details)&&i.live)this.hls.trigger(l.LIVE_BACK_BUFFER_REACHED,{bufferEnd:n});else if(null!=e&&e.ended)return void this.log(`Cannot flush ${t} back buffer while SourceBuffer is in ended state`);this.hls.trigger(l.BUFFER_FLUSHING,{startOffset:0,endOffset:n,type:t})}}}))}flushFrontBuffer(t,e,n){this.sourceBuffers.forEach((([e,i])=>{if(i){const r=en.getBuffered(i),s=r.length;if(s<2)return;const a=r.start(s-1),o=r.end(s-1);if(n>a||t>=a&&t<=o)return;this.hls.trigger(l.BUFFER_FLUSHING,{startOffset:a,endOffset:1/0,type:e})}}))}getDurationAndRange(){var t;const{details:e,mediaSource:n}=this;if(!e||!this.media||"open"!==(null==n?void 0:n.readyState))return null;const r=e.edge;if(e.live&&this.hls.config.liveDurationInfinity){if(e.fragments.length&&n.setLiveSeekableRange){const t=Math.max(0,e.fragmentStart);return{duration:1/0,start:t,end:Math.max(t,r)}}return{duration:1/0}}const s=null==(t=this.overrides)?void 0:t.duration;if(s)return i(s)?{duration:s}:null;const a=this.media.duration;return r>(i(n.duration)?n.duration:0)&&r>a||!i(a)?{duration:r}:null}updateMediaSource({duration:t,start:e,end:n}){const r=this.mediaSource;this.media&&r&&"open"===r.readyState&&(r.duration!==t&&(i(t)&&this.log(`Updating MediaSource duration to ${t.toFixed(3)}`),r.duration=t),void 0!==e&&void 0!==n&&(this.log(`MediaSource duration is set to ${r.duration}. Setting seekable range to ${e}-${n}.`),r.setLiveSeekableRange(e,n)))}get tracksReady(){const t=this.pendingTrackCount;return t>0&&(t>=this.bufferCodecEventsTotal||this.isPending(this.tracks.audiovideo))}checkPendingTracks(){const{bufferCodecEventsTotal:t,pendingTrackCount:e,tracks:n}=this;if(this.log(`checkPendingTracks (pending: ${e} codec events expected: ${t}) ${ne(n)}`),this.tracksReady){var i;const t=null==(i=this.transferData)?void 0:i.tracks;t&&Object.keys(t).length?this.attachTransferred():this.createSourceBuffers()}}bufferCreated(){if(this.sourceBufferCount){const t={};this.sourceBuffers.forEach((([e,n])=>{if(e){const i=this.tracks[e];t[e]={buffer:n,container:i.container,codec:i.codec,supplemental:i.supplemental,levelCodec:i.levelCodec,id:i.id,metadata:i.metadata}}})),this.hls.trigger(l.BUFFER_CREATED,{tracks:t}),this.log(`SourceBuffers created. Running queue: ${this.operationQueue}`),this.sourceBuffers.forEach((([t])=>{this.executeNext(t)}))}else{const t=new Error("could not create source buffer for media codec(s)");this.hls.trigger(l.ERROR,{type:a.MEDIA_ERROR,details:o.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:t,reason:t.message})}}createSourceBuffers(){const{tracks:t,sourceBuffers:e,mediaSource:n}=this;if(!n)throw new Error("createSourceBuffers called when mediaSource was null");for(const r in t){const s=r,u=t[s];if(this.isPending(u)){const t=this.getTrackCodec(u,s),r=`${u.container};codecs=${t}`;u.codec=t,this.log(`creating sourceBuffer(${r})${this.currentOp(s)?" Queued":""} ${ne(u)}`);try{const t=n.addSourceBuffer(r),i=ms(s),a=[s,t];e[i]=a,u.buffer=t}catch(t){var i;return this.error(`error while trying to add sourceBuffer: ${t.message}`),this.shiftAndExecuteNext(s),null==(i=this.operationQueue)||i.removeBlockers(),delete this.tracks[s],void this.hls.trigger(l.ERROR,{type:a.MEDIA_ERROR,details:o.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:t,sourceBufferName:s,mimeType:r,parent:u.id})}this.trackSourceBuffer(s,u)}}this.bufferCreated()}getTrackCodec(t,e){const n=t.supplemental;let i=t.codec;n&&("video"===e||"audiovideo"===e)&&At(n,"video")&&(i=function(t,e){const n=[];if(t){const e=t.split(",");for(let t=0;t<e.length;t++)St(e[t],"video")||n.push(e[t])}return e&&n.push(e),n.join(",")}(i,n));const r=Ot(i,t.levelCodec);return r?"audio"===e.slice(0,5)?Pt(r,this.appendSource):r:""}trackSourceBuffer(t,e){const n=e.buffer;if(!n)return;const i=this.getTrackCodec(e,t);this.tracks[t]={buffer:n,codec:i,container:e.container,levelCodec:e.levelCodec,supplemental:e.supplemental,metadata:e.metadata,id:e.id,listeners:[]},this.removeBufferListeners(t),this.addBufferListener(t,"updatestart",this.onSBUpdateStart),this.addBufferListener(t,"updateend",this.onSBUpdateEnd),this.addBufferListener(t,"error",this.onSBUpdateError),this.appendSource&&this.addBufferListener(t,"bufferedchange",((t,e)=>{const n=e.removedRanges;null!=n&&n.length&&this.hls.trigger(l.BUFFER_FLUSHED,{type:t})}))}get mediaSrc(){var t,e;const n=(null==(t=this.media)||null==(e=t.querySelector)?void 0:e.call(t,"source"))||this.media;return null==n?void 0:n.src}onSBUpdateStart(t){const e=this.currentOp(t);e&&e.onStart()}onSBUpdateEnd(t){var e;if("closed"===(null==(e=this.mediaSource)?void 0:e.readyState))return void this.resetBuffer(t);const n=this.currentOp(t);n&&(n.onComplete(),this.shiftAndExecuteNext(t))}onSBUpdateError(t,e){var n;const i=new Error(`${t} SourceBuffer error. MediaSource readyState: ${null==(n=this.mediaSource)?void 0:n.readyState}`);this.error(`${i}`,e),this.hls.trigger(l.ERROR,{type:a.MEDIA_ERROR,details:o.BUFFER_APPENDING_ERROR,sourceBufferName:t,error:i,fatal:!1});const r=this.currentOp(t);r&&r.onError(i)}updateTimestampOffset(t,e,n,i,r,s){const a=e-t.timestampOffset;Math.abs(a)>=n&&(this.log(`Updating ${i} SourceBuffer timestampOffset to ${e} (sn: ${r} cc: ${s})`),t.timestampOffset=e)}removeExecutor(t,e,n){const{media:r,mediaSource:s}=this,a=this.tracks[t],o=null==a?void 0:a.buffer;if(!r||!s||!o)return this.warn(`Attempting to remove from the ${t} SourceBuffer, but it does not exist`),void this.shiftAndExecuteNext(t);const l=i(r.duration)?r.duration:1/0,u=i(s.duration)?s.duration:1/0,h=Math.max(0,e),c=Math.min(n,l,u);c>h&&(!a.ending||a.ended)?(a.ended=!1,this.log(`Removing [${h},${c}] from the ${t} SourceBuffer`),o.remove(h,c)):this.shiftAndExecuteNext(t)}appendExecutor(t,e){const n=this.tracks[e],i=null==n?void 0:n.buffer;if(!i)throw new gs(`Attempting to append to the ${e} SourceBuffer, but it does not exist`);n.ending=!1,n.ended=!1,i.appendBuffer(t)}blockUntilOpen(t){if(this.isUpdating()||this.isQueued())this.blockBuffers(t).catch((t=>{this.warn(`SourceBuffer blocked callback ${t}`),this.stepOperationQueue(this.sourceBufferTypes)}));else try{t()}catch(t){this.warn(`Callback run without blocking ${this.operationQueue} ${t}`)}}isUpdating(){return this.sourceBuffers.some((([t,e])=>t&&e.updating))}isQueued(){return this.sourceBuffers.some((([t])=>t&&!!this.currentOp(t)))}isPending(t){return!!t&&!t.buffer}blockBuffers(t,e=this.sourceBufferTypes){if(!e.length)return this.log("Blocking operation requested, but no SourceBuffers exist"),Promise.resolve().then(t);const{operationQueue:n}=this,i=e.map((t=>this.appendBlocker(t)));return e.length>1&&!!this.blockedAudioAppend&&this.unblockAudio(),Promise.all(i).then((e=>{n===this.operationQueue&&(t(),this.stepOperationQueue(this.sourceBufferTypes))}))}stepOperationQueue(t){t.forEach((t=>{var e;const n=null==(e=this.tracks[t])?void 0:e.buffer;n&&!n.updating&&this.shiftAndExecuteNext(t)}))}append(t,e,n){this.operationQueue&&this.operationQueue.append(t,e,n)}appendBlocker(t){if(this.operationQueue)return this.operationQueue.appendBlocker(t)}currentOp(t){return this.operationQueue?this.operationQueue.current(t):null}executeNext(t){t&&this.operationQueue&&this.operationQueue.executeNext(t)}shiftAndExecuteNext(t){this.operationQueue&&this.operationQueue.shiftAndExecuteNext(t)}get pendingTrackCount(){return Object.keys(this.tracks).reduce(((t,e)=>t+(this.isPending(this.tracks[e])?1:0)),0)}get sourceBufferCount(){return this.sourceBuffers.reduce(((t,[e])=>t+(e?1:0)),0)}get sourceBufferTypes(){return this.sourceBuffers.map((([t])=>t)).filter((t=>!!t))}addBufferListener(t,e,n){const i=this.tracks[t];if(!i)return;const r=i.buffer;if(!r)return;const s=n.bind(this,t);i.listeners.push({event:e,listener:s}),r.addEventListener(e,s)}removeBufferListeners(t){const e=this.tracks[t];if(!e)return;const n=e.buffer;n&&(e.listeners.forEach((t=>{n.removeEventListener(t.event,t.listener)})),e.listeners.length=0)}},capLevelController:vs,errorController:class extends w{constructor(t){super("error-controller",t.logger),this.hls=void 0,this.playlistError=0,this.hls=t,this.registerListeners()}registerListeners(){const t=this.hls;t.on(l.ERROR,this.onError,this),t.on(l.MANIFEST_LOADING,this.onManifestLoading,this),t.on(l.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){const t=this.hls;t&&(t.off(l.ERROR,this.onError,this),t.off(l.ERROR,this.onErrorOut,this),t.off(l.MANIFEST_LOADING,this.onManifestLoading,this),t.off(l.LEVEL_UPDATED,this.onLevelUpdated,this))}destroy(){this.unregisterListeners(),this.hls=null}startLoad(t){}stopLoad(){this.playlistError=0}getVariantLevelIndex(t){return(null==t?void 0:t.type)===f?t.level:this.getVariantIndex()}getVariantIndex(){var t;const e=this.hls,n=e.currentLevel;return null!=(t=e.loadLevelObj)&&t.details||-1===n?e.loadLevel:n}variantHasKey(t,e){if(t){var n;if(null!=(n=t.details)&&n.hasKey(e))return!0;const i=t.audioGroups;if(i){return this.hls.allAudioTracks.filter((t=>i.indexOf(t.groupId)>=0)).some((t=>{var n;return null==(n=t.details)?void 0:n.hasKey(e)}))}}return!1}onManifestLoading(){this.playlistError=0}onLevelUpdated(){this.playlistError=0}onError(t,e){var n;if(e.fatal)return;const i=this.hls,r=e.context;switch(e.details){case o.FRAG_LOAD_ERROR:case o.FRAG_LOAD_TIMEOUT:case o.KEY_LOAD_ERROR:case o.KEY_LOAD_TIMEOUT:return void(e.errorAction=this.getFragRetryOrSwitchAction(e));case o.FRAG_PARSING_ERROR:if(null!=(n=e.frag)&&n.gap)return void(e.errorAction=Ie());case o.FRAG_GAP:case o.FRAG_DECRYPT_ERROR:return e.errorAction=this.getFragRetryOrSwitchAction(e),void(e.errorAction.action=Se);case o.LEVEL_EMPTY_ERROR:case o.LEVEL_PARSING_ERROR:{var s;const t=e.parent===f?e.level:i.loadLevel;e.details===o.LEVEL_EMPTY_ERROR&&null!=(s=e.context)&&null!=(s=s.levelDetails)&&s.live?e.errorAction=this.getPlaylistRetryOrSwitchAction(e,t):(e.levelRetry=!1,e.errorAction=this.getLevelSwitchAction(e,t))}return;case o.LEVEL_LOAD_ERROR:case o.LEVEL_LOAD_TIMEOUT:return void("number"==typeof(null==r?void 0:r.level)&&(e.errorAction=this.getPlaylistRetryOrSwitchAction(e,r.level)));case o.AUDIO_TRACK_LOAD_ERROR:case o.AUDIO_TRACK_LOAD_TIMEOUT:case o.SUBTITLE_LOAD_ERROR:case o.SUBTITLE_TRACK_LOAD_TIMEOUT:if(r){const t=i.loadLevelObj;if(t&&(r.type===c&&t.hasAudioGroup(r.groupId)||r.type===d&&t.hasSubtitleGroup(r.groupId)))return e.errorAction=this.getPlaylistRetryOrSwitchAction(e,i.loadLevel),e.errorAction.action=Se,void(e.errorAction.flags=xe)}return;case o.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:return void(e.errorAction={action:Se,flags:Re});case o.KEY_SYSTEM_SESSION_UPDATE_FAILED:case o.KEY_SYSTEM_STATUS_INTERNAL_ERROR:case o.KEY_SYSTEM_NO_SESSION:return void(e.errorAction={action:Se,flags:Le});case o.BUFFER_ADD_CODEC_ERROR:case o.REMUX_ALLOC_ERROR:case o.BUFFER_APPEND_ERROR:var l;if(!e.errorAction)e.errorAction=this.getLevelSwitchAction(e,null!=(l=e.level)?l:i.loadLevel);return;case o.INTERNAL_EXCEPTION:case o.BUFFER_APPENDING_ERROR:case o.BUFFER_FULL_ERROR:case o.LEVEL_SWITCH_ERROR:case o.BUFFER_STALLED_ERROR:case o.BUFFER_SEEK_OVER_HOLE:case o.BUFFER_NUDGE_ON_STALL:return void(e.errorAction=Ie())}e.type===a.KEY_SYSTEM_ERROR&&(e.levelRetry=!1,e.errorAction=Ie())}getPlaylistRetryOrSwitchAction(t,e){const n=ye(this.hls.config.playlistLoadPolicy,t),i=this.playlistError++;if(we(n,i,_e(t),t.response))return{action:De,flags:Ce,retryConfig:n,retryCount:i};const r=this.getLevelSwitchAction(t,e);return n&&(r.retryConfig=n,r.retryCount=i),r}getFragRetryOrSwitchAction(t){const e=this.hls,n=this.getVariantLevelIndex(t.frag),i=e.levels[n],{fragLoadPolicy:r,keyLoadPolicy:s}=e.config,a=ye(me(t)?s:r,t),l=e.levels.reduce(((t,e)=>t+e.fragmentError),0);if(i&&(t.details!==o.FRAG_GAP&&i.fragmentError++,!ve(t))){if(we(a,l,_e(t),t.response))return{action:De,flags:Ce,retryConfig:a,retryCount:l}}const u=this.getLevelSwitchAction(t,n);return a&&(u.retryConfig=a,u.retryCount=l),u}getLevelSwitchAction(t,e){const n=this.hls;null==e&&(e=n.loadLevel);const i=this.hls.levels[e];if(i){var r,s;const e=t.details;i.loadError++,e===o.BUFFER_APPEND_ERROR&&i.fragmentError++;let u=-1;const{levels:h,loadLevel:_,minAutoLevel:m,maxAutoLevel:v}=n;n.autoLevelEnabled||n.config.preserveManualLevelOnError||(n.loadLevel=-1);const y=null==(r=t.frag)?void 0:r.type,b=(y===p&&e===o.FRAG_PARSING_ERROR||"audio"===t.sourceBufferName&&(e===o.BUFFER_ADD_CODEC_ERROR||e===o.BUFFER_APPEND_ERROR))&&h.some((({audioCodec:t})=>i.audioCodec!==t)),E="video"===t.sourceBufferName&&(e===o.BUFFER_ADD_CODEC_ERROR||e===o.BUFFER_APPEND_ERROR)&&h.some((({codecSet:t,audioCodec:e})=>i.codecSet!==t&&i.audioCodec===e)),{type:w,groupId:T}=null!=(s=t.context)?s:{};for(let n=h.length;n--;){const r=(n+_)%h.length;if(r!==_&&r>=m&&r<=v&&0===h[r].loadError){var a,l;const n=h[r];if(e===o.FRAG_GAP&&y===f&&t.frag){const e=h[r].details;if(e){const n=de(t.frag,e.fragments,t.frag.start);if(null!=n&&n.gap)continue}}else{if(w===c&&n.hasAudioGroup(T)||w===d&&n.hasSubtitleGroup(T))continue;if(y===p&&null!=(a=i.audioGroups)&&a.some((t=>n.hasAudioGroup(t)))||y===g&&null!=(l=i.subtitleGroups)&&l.some((t=>n.hasSubtitleGroup(t)))||b&&i.audioCodec===n.audioCodec||E&&i.codecSet===n.codecSet||!b&&i.codecSet!==n.codecSet)continue}u=r;break}}if(u>-1&&n.loadLevel!==u)return t.levelRetry=!0,this.playlistError=0,{action:Se,flags:Ce,nextAutoLevel:u}}return{action:Se,flags:xe}}onErrorOut(t,e){var n;switch(null==(n=e.errorAction)?void 0:n.action){case ke:break;case Se:this.sendAlternateToPenaltyBox(e),e.errorAction.resolved||e.details===o.FRAG_GAP?/MediaSource readyState: ended/.test(e.error.message)&&(this.warn(`MediaSource ended after "${e.sourceBufferName}" sourceBuffer append error. Attempting to recover from media error.`),this.hls.recoverMediaError()):e.fatal=!0}e.fatal&&this.hls.stopLoad()}sendAlternateToPenaltyBox(t){const e=this.hls,n=t.errorAction;if(!n)return;const{flags:i}=n,r=n.nextAutoLevel;switch(i){case Ce:this.switchLevel(t,r);break;case Re:{const i=this.getVariantLevelIndex(t.frag),r=e.levels[i],s=null==r?void 0:r.attrs["HDCP-LEVEL"];if(n.hdcpLevel=s,"NONE"===s)this.warn("HDCP policy resticted output with HDCP-LEVEL=NONE");else if(s){e.maxHdcpLevel=zt[zt.indexOf(s)-1],n.resolved=!0,this.warn(`Restricting playback to HDCP-LEVEL of "${e.maxHdcpLevel}" or lower`);break}}case Le:{const e=t.decryptdata;if(e){const i=this.hls.levels,r=i.length;for(let n=r;n--;){var s,a;if(this.variantHasKey(i[n],e))this.log(`Banned key found in level ${n} (${i[n].bitrate}bps) or audio group "${null==(s=i[n].audioGroups)?void 0:s.join(",")}" (${null==(a=t.frag)?void 0:a.type} fragment) ${I(e.keyId||[])}`),i[n].fragmentError++,i[n].loadError++,this.log(`Removing level ${n} with key error (${t.error})`),this.hls.removeLevel(n)}const o=t.frag;if(this.hls.levels.length<r)n.resolved=!0;else if(o&&o.type!==f){const t=o.decryptdata;t&&!e.matches(t)&&(n.resolved=!0)}}break}}n.resolved||this.switchLevel(t,r)}switchLevel(t,e){if(void 0!==e&&t.errorAction&&(this.warn(`switching to level ${e} after ${t.details}`),this.hls.nextAutoLevel=e,t.errorAction.resolved=!0,this.hls.nextLoadLevel=this.hls.nextAutoLevel,t.details===o.BUFFER_ADD_CODEC_ERROR&&t.mimeType&&"audiovideo"!==t.sourceBufferName)){const e=Bt(t.mimeType),n=this.hls.levels;for(let i=n.length;i--;)n[i][`${t.sourceBufferName}Codec`]===e&&(this.log(`Removing level ${i} for ${t.details} ("${e}" not supported)`),this.hls.removeLevel(i))}}},fpsController:class{constructor(t){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=t,this.registerListeners()}setStreamController(t){this.streamController=t}registerListeners(){this.hls.on(l.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.on(l.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListeners(){this.hls.off(l.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.off(l.MEDIA_DETACHING,this.onMediaDetaching,this)}destroy(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null}onMediaAttaching(t,e){const n=this.hls.config;if(n.capLevelOnFPSDrop){const t=e.media instanceof self.HTMLVideoElement?e.media:null;this.media=t,t&&"function"==typeof t.getVideoPlaybackQuality&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),n.fpsDroppedMonitoringPeriod)}}onMediaDetaching(){this.media=null}checkFPS(t,e,n){const i=performance.now();if(e){if(this.lastTime){const t=i-this.lastTime,r=n-this.lastDroppedFrames,s=e-this.lastDecodedFrames,a=1e3*r/t,o=this.hls;if(o.trigger(l.FPS_DROP,{currentDropped:r,currentDecoded:s,totalDroppedFrames:n}),a>0&&r>o.config.fpsDroppedMonitoringThreshold*s){let t=o.currentLevel;o.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+t),t>0&&(-1===o.autoLevelCapping||o.autoLevelCapping>=t)&&(t-=1,o.trigger(l.FPS_DROP_LEVEL_CAPPING,{level:t,droppedLevel:o.currentLevel}),o.autoLevelCapping=t,this.streamController.nextLevelSwitch())}}this.lastTime=i,this.lastDroppedFrames=n,this.lastDecodedFrames=e}}checkFPSInterval(){const t=this.media;if(t)if(this.isVideoPlaybackQualityAvailable){const e=t.getVideoPlaybackQuality();this.checkFPS(t,e.totalVideoFrames,e.droppedVideoFrames)}else this.checkFPS(t,t.webkitDecodedFrameCount,t.webkitDroppedFrameCount)}},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:Ln,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:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null}},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},{cueHandler:Fo,enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}),{},{subtitleStreamController:class extends Li{constructor(t,e,n){super(t,e,n,"subtitle-stream-controller",g),this.currentTrackId=-1,this.tracksBuffered=[],this.mainDetails=null,this.registerListeners()}onHandlerDestroying(){this.unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null}registerListeners(){super.registerListeners();const{hls:t}=this;t.on(l.LEVEL_LOADED,this.onLevelLoaded,this),t.on(l.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.on(l.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),t.on(l.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.on(l.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),t.on(l.BUFFER_FLUSHING,this.onBufferFlushing,this)}unregisterListeners(){super.unregisterListeners();const{hls:t}=this;t.off(l.LEVEL_LOADED,this.onLevelLoaded,this),t.off(l.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.off(l.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),t.off(l.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.off(l.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),t.off(l.BUFFER_FLUSHING,this.onBufferFlushing,this)}startLoad(t,e){this.stopLoad(),this.state=bi,this.setInterval(500),this.nextLoadPosition=this.lastCurrentTime=t+this.timelineOffset,this.startPosition=e?-1:t,this.tick()}onManifestLoading(){super.onManifestLoading(),this.mainDetails=null}onMediaDetaching(t,e){this.tracksBuffered=[],super.onMediaDetaching(t,e)}onLevelLoaded(t,e){this.mainDetails=e.details}onSubtitleFragProcessed(t,e){const{frag:n,success:i}=e;if(this.fragContextChanged(n)||(W(n)&&(this.fragPrevious=n),this.state=bi),!i)return;const r=this.tracksBuffered[this.currentTrackId];if(!r)return;let s;const a=n.start;for(let t=0;t<r.length;t++)if(a>=r[t].start&&a<=r[t].end){s=r[t];break}const o=n.start+n.duration;s?s.end=o:(s={start:a,end:o},r.push(s)),this.fragmentTracker.fragBuffered(n),this.fragBufferedComplete(n,null),this.media&&this.tick()}onBufferFlushing(t,e){const{startOffset:n,endOffset:i}=e;if(0===n&&i!==Number.POSITIVE_INFINITY){const t=i-1;if(t<=0)return;e.endOffsetSubtitles=Math.max(0,t),this.tracksBuffered.forEach((e=>{for(let n=0;n<e.length;)if(e[n].end<=t)e.shift();else{if(!(e[n].start<t))break;e[n].start=t,n++}})),this.fragmentTracker.removeFragmentsInRange(n,t,g)}}onError(t,e){const n=e.frag;(null==n?void 0:n.type)===g&&(e.details===o.FRAG_GAP&&this.fragmentTracker.fragBuffered(n,!0),this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==yi&&(this.state=bi))}onSubtitleTracksUpdated(t,{subtitleTracks:e}){this.levels&&us(this.levels,e)?this.levels=e.map((t=>new Jt(t))):(this.tracksBuffered=[],this.levels=e.map((t=>{const e=new Jt(t);return this.tracksBuffered[e.id]=[],e})),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,g),this.fragPrevious=null,this.mediaBuffer=null)}onSubtitleTrackSwitch(t,e){var n;if(this.currentTrackId=e.id,null==(n=this.levels)||!n.length||-1===this.currentTrackId)return void this.clearInterval();const i=this.levels[this.currentTrackId];null!=i&&i.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,i&&this.state!==yi&&this.setInterval(500)}onSubtitleTrackLoaded(t,e){var n;const{currentTrackId:i,levels:r}=this,{details:s,id:a}=e;if(!r)return void this.warn(`Subtitle tracks were reset while loading level ${a}`);const o=r[a];if(a>=r.length||!o)return;this.log(`Subtitle track ${a} loaded [${s.startSN},${s.endSN}]${s.lastPartSn?`[part-${s.lastPartSn}-${s.lastPartIndex}]`:""},duration:${s.totalduration}`),this.mediaBuffer=this.mediaBufferTimeRanges;let u=0;if(s.live||null!=(n=o.details)&&n.live){if(s.deltaUpdateFailed)return;const t=this.mainDetails;if(!t)return void(this.startFragRequested=!1);const e=t.fragments[0];var h;if(o.details)u=this.alignPlaylists(s,o.details,null==(h=this.levelLastLoaded)?void 0:h.details),0===u&&e&&(u=e.start,ii(s,u));else s.hasProgramDateTime&&t.hasProgramDateTime?(gi(s,t),u=s.fragmentStart):e&&(u=e.start,ii(s,u));t&&!this.startFragRequested&&this.setStartPosition(t,u)}if(o.details=s,this.levelLastLoaded=o,a===i&&(this.hls.trigger(l.SUBTITLE_TRACK_UPDATED,{details:s,id:a,groupId:e.groupId}),this.tick(),s.live&&!this.fragCurrent&&this.media&&this.state===bi)){de(null,s.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),o.details=void 0)}}_handleFragmentLoadComplete(t){const{frag:e,payload:n}=t,i=e.decryptdata,r=this.hls;if(!this.fragContextChanged(e)&&n&&n.byteLength>0&&null!=i&&i.key&&i.iv&&_n(i.method)){const t=performance.now();this.decrypter.decrypt(new Uint8Array(n),i.key.buffer,i.iv.buffer,mn(i.method)).catch((t=>{throw r.trigger(l.ERROR,{type:a.MEDIA_ERROR,details:o.FRAG_DECRYPT_ERROR,fatal:!1,error:t,reason:t.message,frag:e}),t})).then((n=>{const i=performance.now();r.trigger(l.FRAG_DECRYPTED,{frag:e,payload:n,stats:{tstart:t,tdecrypt:i}})})).catch((t=>{this.warn(`${t.name}: ${t.message}`),this.state=bi}))}}doTick(){if(this.media){if(this.state===bi){const{currentTrackId:t,levels:e}=this,n=null==e?void 0:e[t];if(!n||!e.length||!n.details)return;if(this.waitForLive(n))return;const{config:i}=this,r=this.getLoadPosition(),s=en.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],r,i.maxBufferHole),{end:a,len:o}=s,l=n.details;if(o>this.hls.maxBufferLength+l.levelTargetDuration)return;const u=l.fragments,h=u.length,c=l.edge;let d=null;const f=this.fragPrevious;if(a<c){const t=i.maxFragLookUpTolerance,e=a>c-t?0:t;d=de(f,u,Math.max(u[0].start,a),e),!d&&f&&f.start<u[0].start&&(d=u[0])}else d=u[h-1];if(d=this.filterReplacedPrimary(d,n.details),!d)return;const p=u[d.sn-l.startSN-1];if(p&&p.cc===d.cc&&this.fragmentTracker.getState(p)===Pe&&(d=p),this.fragmentTracker.getState(d)===Pe){const t=this.mapToInitFragWhenRequired(d);t&&this.loadFragment(t,n,a)}}}else this.state=bi}loadFragment(t,e,n){W(t)?super.loadFragment(t,e,n):this._loadInitSegment(t,e)}get mediaBufferTimeRanges(){return new Ua(this.tracksBuffered[this.currentTrackId]||[])}},subtitleTrackController:class extends ls{constructor(t){super(t,"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 e=Ta(this.media.textTracks);for(let n=0;n<e.length;n++)if("hidden"===e[n].mode)t=e[n];else if("showing"===e[n].mode){t=e[n];break}const n=this.findTrackForTextTrack(t);this.subtitleTrack!==n&&this.setSubtitleTrack(n)},this.registerListeners()}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,this.onTextTracksChanged=this.asyncPollTrackChange=null,super.destroy()}get subtitleDisplay(){return this._subtitleDisplay}set subtitleDisplay(t){this._subtitleDisplay=t,this.trackId>-1&&this.toggleTrackModes()}registerListeners(){const{hls:t}=this;t.on(l.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(l.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(l.MANIFEST_LOADING,this.onManifestLoading,this),t.on(l.MANIFEST_PARSED,this.onManifestParsed,this),t.on(l.LEVEL_LOADING,this.onLevelLoading,this),t.on(l.LEVEL_SWITCHING,this.onLevelSwitching,this),t.on(l.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.on(l.ERROR,this.onError,this)}unregisterListeners(){const{hls:t}=this;t.off(l.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(l.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(l.MANIFEST_LOADING,this.onManifestLoading,this),t.off(l.MANIFEST_PARSED,this.onManifestParsed,this),t.off(l.LEVEL_LOADING,this.onLevelLoading,this),t.off(l.LEVEL_SWITCHING,this.onLevelSwitching,this),t.off(l.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.off(l.ERROR,this.onError,this)}onMediaAttached(t,e){this.media=e.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(t){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.onTextTracksChanged,t)}onMediaDetaching(t,e){const n=this.media;if(!n)return;const i=!!e.transferMedia;if(self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||n.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),this.subtitleTrack=-1,this.media=null,i)return;Ta(n.textTracks).forEach((t=>{Ea(t)}))}onManifestLoading(){this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0}onManifestParsed(t,e){this.tracks=e.subtitleTracks}onSubtitleTrackLoaded(t,e){const{id:n,groupId:i,details:r}=e,s=this.tracksInGroup[n];if(!s||s.groupId!==i)return void this.warn(`Subtitle track with id:${n} and group:${i} not found in active group ${null==s?void 0:s.groupId}`);const a=s.details;s.details=e.details,this.log(`Subtitle track ${n} "${s.name}" lang:${s.lang} group:${i} loaded [${r.startSN}-${r.endSN}]`),n===this.trackId&&this.playlistLoaded(n,e,a)}onLevelLoading(t,e){this.switchLevel(e.level)}onLevelSwitching(t,e){this.switchLevel(e.level)}switchLevel(t){const e=this.hls.levels[t];if(!e)return;const n=e.subtitleGroups||null,i=this.groupIds;let r=this.currentTrack;if(!n||(null==i?void 0:i.length)!==(null==n?void 0:n.length)||null!=n&&n.some((t=>-1===(null==i?void 0:i.indexOf(t))))){this.groupIds=n,this.trackId=-1,this.currentTrack=null;const t=this.tracks.filter((t=>!n||-1!==n.indexOf(t.groupId)));if(t.length)this.selectDefaultTrack&&!t.some((t=>t.default))&&(this.selectDefaultTrack=!1),t.forEach(((t,e)=>{t.id=e}));else if(!r&&!this.tracksInGroup.length)return;this.tracksInGroup=t;const e=this.hls.config.subtitlePreference;if(!r&&e){this.selectDefaultTrack=!1;const n=ae(e,t);if(n>-1)r=t[n];else{const t=ae(e,this.tracks);r=this.tracks[t]}}let i=this.findTrackId(r);-1===i&&r&&(i=this.findTrackId(null));const s={subtitleTracks:t};this.log(`Updating subtitle tracks, ${t.length} track(s) found in "${null==n?void 0:n.join(",")}" group-id`),this.hls.trigger(l.SUBTITLE_TRACKS_UPDATED,s),-1!==i&&-1===this.trackId&&this.setSubtitleTrack(i)}}findTrackId(t){const e=this.tracksInGroup,n=this.selectDefaultTrack;for(let i=0;i<e.length;i++){const r=e[i];if((!n||r.default)&&(n||t)&&(!t||oe(r,t)))return i}if(t){for(let n=0;n<e.length;n++){const i=e[n];if(hs(t.attrs,i.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return n}for(let n=0;n<e.length;n++){const i=e[n];if(hs(t.attrs,i.attrs,["LANGUAGE"]))return n}}return-1}findTrackForTextTrack(t){if(t){const e=this.tracksInGroup;for(let n=0;n<e.length;n++){if(cs(e[n],t))return n}}return-1}onError(t,e){!e.fatal&&e.context&&(e.context.type!==d||e.context.id!==this.trackId||this.groupIds&&-1===this.groupIds.indexOf(e.context.groupId)||this.checkRetry(e))}get allSubtitleTracks(){return this.tracks}get subtitleTracks(){return this.tracksInGroup}get subtitleTrack(){return this.trackId}set subtitleTrack(t){this.selectDefaultTrack=!1,this.setSubtitleTrack(t)}setSubtitleOption(t){if(this.hls.config.subtitlePreference=t,t){if(-1===t.id)return this.setSubtitleTrack(-1),null;const e=this.allSubtitleTracks;if(this.selectDefaultTrack=!1,e.length){const n=this.currentTrack;if(n&&oe(t,n))return n;const i=ae(t,this.tracksInGroup);if(i>-1){const t=this.tracksInGroup[i];return this.setSubtitleTrack(i),t}if(n)return null;{const n=ae(t,e);if(n>-1)return e[n]}}}return null}loadPlaylist(t){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentTrack)&&this.scheduleLoading(this.currentTrack,t)}loadingPlaylist(t,e){super.loadingPlaylist(t,e);const n=t.id,i=t.groupId,r=this.getUrlWithDirectives(t.url,e),s=t.details,a=null==s?void 0:s.age;this.log(`Loading subtitle ${n} "${t.name}" lang:${t.lang} group:${i}${void 0!==(null==e?void 0:e.msn)?" at sn "+e.msn+" part "+e.part:""}${a&&s.live?" age "+a.toFixed(1)+(s.type?" "+s.type||0:""):""} ${r}`),this.hls.trigger(l.SUBTITLE_TRACK_LOADING,{url:r,id:n,groupId:i,deliveryDirectives:e||null,track:t})}toggleTrackModes(){const{media:t}=this;if(!t)return;const e=Ta(t.textTracks),n=this.currentTrack;let i;if(n&&(i=e.filter((t=>cs(n,t)))[0],i||this.warn(`Unable to find subtitle TextTrack with name "${n.name}" and language "${n.lang}"`)),[].slice.call(e).forEach((t=>{"disabled"!==t.mode&&t!==i&&(t.mode="disabled")})),i){const t=this.subtitleDisplay?"showing":"hidden";i.mode!==t&&(i.mode=t)}}setSubtitleTrack(t){const e=this.tracksInGroup;if(!this.media)return void(this.queuedDefaultTrack=t);if(t<-1||t>=e.length||!i(t))return void this.warn(`Invalid subtitle track id: ${t}`);this.selectDefaultTrack=!1;const n=this.currentTrack,r=e[t]||null;if(this.trackId=t,this.currentTrack=r,this.toggleTrackModes(),!r)return void this.hls.trigger(l.SUBTITLE_TRACK_SWITCH,{id:t});const s=!!r.details&&!r.details.live;if(t===this.trackId&&r===n&&s)return;this.log(`Switching to subtitle-track ${t}`+(r?` "${r.name}" lang:${r.lang} group:${r.groupId}`:""));const{id:a,groupId:o="",name:u,type:h,url:c}=r;this.hls.trigger(l.SUBTITLE_TRACK_SWITCH,{id:a,groupId:o,name:u,type:h,url:c});const d=this.switchParams(r.url,null==n?void 0:n.details,r.details);this.loadPlaylist(d)}},timelineController:class{constructor(t){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={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}},this.captionsProperties=void 0,this.hls=t,this.config=t.config,this.Cues=t.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}},t.on(l.MEDIA_ATTACHING,this.onMediaAttaching,this),t.on(l.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(l.MANIFEST_LOADING,this.onManifestLoading,this),t.on(l.MANIFEST_LOADED,this.onManifestLoaded,this),t.on(l.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.on(l.FRAG_LOADING,this.onFragLoading,this),t.on(l.FRAG_LOADED,this.onFragLoaded,this),t.on(l.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),t.on(l.FRAG_DECRYPTED,this.onFragDecrypted,this),t.on(l.INIT_PTS_FOUND,this.onInitPtsFound,this),t.on(l.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),t.on(l.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:t}=this;t.off(l.MEDIA_ATTACHING,this.onMediaAttaching,this),t.off(l.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(l.MANIFEST_LOADING,this.onManifestLoading,this),t.off(l.MANIFEST_LOADED,this.onManifestLoaded,this),t.off(l.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.off(l.FRAG_LOADING,this.onFragLoading,this),t.off(l.FRAG_LOADED,this.onFragLoaded,this),t.off(l.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),t.off(l.FRAG_DECRYPTED,this.onFragDecrypted,this),t.off(l.INIT_PTS_FOUND,this.onInitPtsFound,this),t.off(l.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),t.off(l.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.media=null,this.cea608Parser1=this.cea608Parser2=void 0}initCea608Parsers(){const t=new Lo(this,"textTrack1"),e=new Lo(this,"textTrack2"),n=new Lo(this,"textTrack3"),i=new Lo(this,"textTrack4");this.cea608Parser1=new no(1,t,e),this.cea608Parser2=new no(3,n,i)}addCues(t,e,n,i,r){let s=!1;for(let t=r.length;t--;){const i=r[t],l=(a=i[0],o=i[1],u=e,h=n,Math.min(o,h)-Math.max(a,u));if(l>=0&&(i[0]=Math.min(i[0],e),i[1]=Math.max(i[1],n),s=!0,l/(n-e)>.5))return}var a,o,u,h;if(s||r.push([e,n]),this.config.renderTextTracksNatively){const r=this.captionsTracks[t];this.Cues.newCue(r,e,n,i)}else{const r=this.Cues.newCue(null,e,n,i);this.hls.trigger(l.CUES_PARSED,{type:"captions",cues:r,track:t})}}onInitPtsFound(t,{frag:e,id:n,initPTS:i,timescale:r,trackId:s}){const{unparsedVttFrags:a}=this;n===f&&(this.initPTS[e.cc]={baseTime:i,timescale:r,trackId:s}),a.length&&(this.unparsedVttFrags=[],a.forEach((t=>{this.initPTS[t.frag.cc]?this.onFragLoaded(l.FRAG_LOADED,t):this.hls.trigger(l.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:t.frag,error:new Error("Subtitle discontinuity domain does not match main")})})))}getExistingTrack(t,e){const{media:n}=this;if(n)for(let i=0;i<n.textTracks.length;i++){const r=n.textTracks[i];if(Po(r,{name:t,lang:e,characteristics:"transcribes-spoken-dialog,describes-music-and-sound"}))return r}return null}createCaptionsTrack(t){this.config.renderTextTracksNatively?this.createNativeTrack(t):this.createNonNativeTrack(t)}createNativeTrack(t){if(this.captionsTracks[t])return;const{captionsProperties:e,captionsTracks:n,media:i}=this,{label:r,languageCode:s}=e[t],a=this.getExistingTrack(r,s);if(a)n[t]=a,Ea(n[t]),ya(n[t],i);else{const e=this.createTextTrack("captions",r,s);e&&(e[t]=!0,n[t]=e)}}createNonNativeTrack(t){if(this.nonNativeCaptionsTracks[t])return;const e=this.captionsProperties[t];if(!e)return;const n={_id:t,label:e.label,kind:"captions",default:!!e.media&&!!e.media.default,closedCaptions:e.media};this.nonNativeCaptionsTracks[t]=n,this.hls.trigger(l.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[n]})}createTextTrack(t,e,n){const i=this.media;if(i)return i.addTextTrack(t,e,n)}onMediaAttaching(t,e){this.media=e.media,e.mediaSource||this._cleanTracks()}onMediaDetaching(t,e){const n=!!e.transferMedia;if(this.media=null,n)return;const{captionsTracks:i}=this;Object.keys(i).forEach((t=>{Ea(i[t]),delete i[t]})),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}},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:t}=this;if(!t)return;const e=t.textTracks;if(e)for(let t=0;t<e.length;t++)Ea(e[t])}onSubtitleTracksUpdated(t,e){const n=e.subtitleTracks||[],i=n.some((t=>t.textCodec===bo));if(this.config.enableWebVTT||i&&this.config.enableIMSC1){if(us(this.tracks,n))return void(this.tracks=n);if(this.textTracks=[],this.tracks=n,this.config.renderTextTracksNatively){const t=this.media,e=t?Ta(t.textTracks):null;if(this.tracks.forEach(((t,n)=>{let i;if(e){let n=null;for(let i=0;i<e.length;i++)if(e[i]&&Po(e[i],t)){n=e[i],e[i]=null;break}n&&(i=n)}if(i)Ea(i);else{const e=Io(t);i=this.createTextTrack(e,t.name,t.lang),i&&(i.mode="disabled")}i&&this.textTracks.push(i)})),null!=e&&e.length){const t=e.filter((t=>null!==t)).map((t=>t.label));t.length&&this.hls.logger.warn(`Media element contains unused subtitle tracks: ${t.join(", ")}. Replace media element for each source to clear TextTracks and captions menu.`)}}else if(this.tracks.length){const t=this.tracks.map((t=>({label:t.name,kind:t.type.toLowerCase(),default:t.default,subtitleTrack:t})));this.hls.trigger(l.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:t})}}}onManifestLoaded(t,e){this.config.enableCEA708Captions&&e.captions&&e.captions.forEach((t=>{const e=/(?:CC|SERVICE)([1-4])/.exec(t.instreamId);if(!e)return;const n=`textTrack${e[1]}`,i=this.captionsProperties[n];i&&(i.label=t.name,t.lang&&(i.languageCode=t.lang),i.media=t)}))}closedCaptionsForLevel(t){const e=this.hls.levels[t.level];return null==e?void 0:e.attrs["CLOSED-CAPTIONS"]}onFragLoading(t,e){if(this.enabled&&e.frag.type===f){var n,i;const{cea608Parser1:t,cea608Parser2:r,lastSn:s}=this,{cc:a,sn:o}=e.frag,l=null!=(n=null==(i=e.part)?void 0:i.index)?n:-1;t&&r&&(o!==s+1||o===s&&l!==this.lastPartIndex+1||a!==this.lastCc)&&(t.reset(),r.reset()),this.lastCc=a,this.lastSn=o,this.lastPartIndex=l}}onFragLoaded(t,e){const{frag:n,payload:i}=e;if(n.type===g)if(i.byteLength){const t=n.decryptdata,r="stats"in e;if(null==t||!t.encrypted||r){const t=this.tracks[n.level],r=this.vttCCs;r[n.cc]||(r[n.cc]={start:n.start,prevCC:this.prevCC,new:!0},this.prevCC=n.cc),t&&t.textCodec===bo?this._parseIMSC1(n,i):this._parseVTTs(e)}}else this.hls.trigger(l.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:n,error:new Error("Empty subtitle payload")})}_parseIMSC1(t,e){const n=this.hls;ko(e,this.initPTS[t.cc],(e=>{this._appendCues(e,t.level),n.trigger(l.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:t})}),(e=>{n.logger.log(`Failed to parse IMSC1: ${e}`),n.trigger(l.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:t,error:e})}))}_parseVTTs(t){var e;const{frag:n,payload:i}=t,{initPTS:r,unparsedVttFrags:s}=this,a=r.length-1;if(!r[n.cc]&&-1===a)return void s.push(t);const o=this.hls;yo(null!=(e=n.initSegment)&&e.data?gt(n.initSegment.data,new Uint8Array(i)).buffer:i,this.initPTS[n.cc],this.vttCCs,n.cc,n.start,(t=>{this._appendCues(t,n.level),o.trigger(l.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:n})}),(e=>{const r="Missing initPTS for VTT MPEGTS"===e.message;r?s.push(t):this._fallbackToIMSC1(n,i),o.logger.log(`Failed to parse VTT cue: ${e}`),r&&a>n.cc||o.trigger(l.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:n,error:e})}))}_fallbackToIMSC1(t,e){const n=this.tracks[t.level];n.textCodec||ko(e,this.initPTS[t.cc],(()=>{n.textCodec=bo,this._parseIMSC1(t,e)}),(()=>{n.textCodec="wvtt"}))}_appendCues(t,e){const n=this.hls;if(this.config.renderTextTracksNatively){const n=this.textTracks[e];if(!n||"disabled"===n.mode)return;t.forEach((t=>ba(n,t)))}else{const i=this.tracks[e];if(!i)return;const r=i.default?"default":"subtitles"+e;n.trigger(l.CUES_PARSED,{type:"subtitles",cues:t,track:r})}}onFragDecrypted(t,e){const{frag:n}=e;n.type===g&&this.onFragLoaded(l.FRAG_LOADED,e)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(t,e){if(!this.enabled||!this.config.enableCEA708Captions)return;const{frag:n,samples:i}=e;if(n.type!==f||"NONE"!==this.closedCaptionsForLevel(n))for(let t=0;t<i.length;t++){const e=i[t].bytes;if(e){this.cea608Parser1||this.initCea608Parsers();const n=this.extractCea608Data(e);this.cea608Parser1.addData(i[t].pts,n[0]),this.cea608Parser2.addData(i[t].pts,n[1])}}}onBufferFlushing(t,{startOffset:e,endOffset:n,endOffsetSubtitles:i,type:r}){const{media:s}=this;if(s&&!(s.currentTime<n)){if(!r||"video"===r){const{captionsTracks:t}=this;Object.keys(t).forEach((i=>wa(t[i],e,n)))}if(this.config.renderTextTracksNatively&&0===e&&void 0!==i){const{textTracks:t}=this;Object.keys(t).forEach((n=>wa(t[n],e,i)))}}}extractCea608Data(t){const e=[[],[]],n=31&t[0];let i=2;for(let r=0;r<n;r++){const n=t[i++],r=127&t[i++],s=127&t[i++];if(0===r&&0===s)continue;if(0!=(4&n)){const t=3&n;0!==t&&1!==t||(e[t].push(r),e[t].push(s))}}return e}},audioStreamController:class extends Li{constructor(t,e,n){super(t,e,n,"audio-stream-controller",p),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:t}=this;t.on(l.LEVEL_LOADED,this.onLevelLoaded,this),t.on(l.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),t.on(l.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.on(l.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.on(l.BUFFER_RESET,this.onBufferReset,this),t.on(l.BUFFER_CREATED,this.onBufferCreated,this),t.on(l.BUFFER_FLUSHING,this.onBufferFlushing,this),t.on(l.BUFFER_FLUSHED,this.onBufferFlushed,this),t.on(l.INIT_PTS_FOUND,this.onInitPtsFound,this),t.on(l.FRAG_LOADING,this.onFragLoading,this),t.on(l.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){const{hls:t}=this;t&&(super.unregisterListeners(),t.off(l.LEVEL_LOADED,this.onLevelLoaded,this),t.off(l.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),t.off(l.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.off(l.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.off(l.BUFFER_RESET,this.onBufferReset,this),t.off(l.BUFFER_CREATED,this.onBufferCreated,this),t.off(l.BUFFER_FLUSHING,this.onBufferFlushing,this),t.off(l.BUFFER_FLUSHED,this.onBufferFlushed,this),t.off(l.INIT_PTS_FOUND,this.onInitPtsFound,this),t.off(l.FRAG_LOADING,this.onFragLoading,this),t.off(l.FRAG_BUFFERED,this.onFragBuffered,this))}onInitPtsFound(t,{frag:e,id:n,initPTS:i,timescale:r,trackId:s}){if(n===f){const t=e.cc,n=this.fragCurrent;if(this.initPTS[t]={baseTime:i,timescale:r,trackId:s},this.log(`InitPTS for cc: ${t} found from main: ${i/r} (${i}/${r}) trackId: ${s}`),this.mainAnchor=e,this.state===xi){const n=this.waitingData;(!n&&!this.loadingParts||n&&n.frag.cc!==t)&&this.syncWithAnchor(e,null==n?void 0:n.frag)}else!this.hls.hasEnoughToStart&&n&&n.cc!==t?(n.abortRequests(),this.syncWithAnchor(e,n)):this.state===bi&&this.tick()}}getLoadPosition(){return!this.startFragRequested&&this.nextLoadPosition>=0?this.nextLoadPosition:super.getLoadPosition()}syncWithAnchor(t,e){var n;const i=(null==(n=this.mainFragLoading)?void 0:n.frag)||null;if(e&&(null==i?void 0:i.cc)===e.cc)return;const r=(i||t).cc,s=ge(this.getLevelDetails(),r,this.getLoadPosition());s&&(this.log(`Syncing with main frag at ${s.start} cc ${s.cc}`),this.startFragRequested=!1,this.nextLoadPosition=s.start,this.resetLoadingState(),this.state===bi&&this.doTickIdle())}startLoad(t,e){if(!this.levels)return this.startPosition=t,void(this.state=yi);const n=this.lastCurrentTime;this.stopLoad(),this.setInterval(100),n>0&&-1===t?(this.log(`Override startPosition with lastCurrentTime @${n.toFixed(3)}`),t=n,this.state=bi):this.state=ki,this.nextLoadPosition=this.lastCurrentTime=t+this.timelineOffset,this.startPosition=e?-1:t,this.tick()}doTick(){switch(this.state){case bi:this.doTickIdle();break;case ki:{const{levels:t,trackId:e}=this,n=null==t?void 0:t[e],i=null==n?void 0:n.details;if(i&&!this.waitForLive(n)){if(this.waitForCdnTuneIn(i))break;this.state=xi}break}case Ti:this.checkRetryDate();break;case xi:{const t=this.waitingData;if(t){const{frag:e,part:n,cache:i,complete:r}=t,s=this.mainAnchor;if(void 0!==this.initPTS[e.cc]){this.waitingData=null,this.state=wi;const t={frag:e,part:n,payload:i.flush().buffer,networkDetails:null};this._handleFragmentLoadProgress(t),r&&super._handleFragmentLoadComplete(t)}else s&&s.cc!==t.frag.cc&&this.syncWithAnchor(s,t.frag)}else this.state=bi}}this.onTickEnd()}resetLoadingState(){const t=this.waitingData;t&&(this.fragmentTracker.removeFragment(t.frag),this.waitingData=null),super.resetLoadingState()}onTickEnd(){const{media:t}=this;null!=t&&t.readyState&&(this.lastCurrentTime=t.currentTime)}doTickIdle(){var t;const{hls:e,levels:n,media:i,trackId:r}=this,s=e.config;if(!this.buffering||!i&&!this.primaryPrefetch&&(this.startFragRequested||!s.startFragPrefetch)||null==n||!n[r])return;const a=n[r],o=a.details;if(!o||this.waitForLive(a)||this.waitForCdnTuneIn(o))return this.state=ki,void(this.startFragRequested=!1);const u=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&u&&(this.bufferFlushed=!1,this.afterBufferFlushed(u,V,p));const h=this.getFwdBufferInfo(u,p);if(null===h)return;if(!this.switchingTrack&&this._streamEnded(h,o))return e.trigger(l.BUFFER_EOS,{type:"audio"}),void(this.state=Di);const c=h.len,d=e.maxBufferLength,g=o.fragments,_=g[0].start,m=this.getLoadPosition(),v=this.flushing?m:h.end;if(this.switchingTrack&&i){const t=m;o.PTSKnown&&t<_&&(h.end>_||h.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),i.currentTime=_+.05)}if(c>=d&&!this.switchingTrack&&v<g[g.length-1].start)return;let y=this.getNextFragment(v,o);if(y&&this.isLoopLoading(y,v)&&(y=this.getNextFragmentLoopLoading(y,o,h,f,d)),!y)return void(this.bufferFlushed=!0);let b=(null==(t=this.mainFragLoading)?void 0:t.frag)||null;if(!this.audioOnly&&this.startFragRequested&&b&&W(y)&&!y.endList&&(!o.live||!this.loadingParts&&v<this.hls.liveSyncPosition)&&(this.fragmentTracker.getState(b)===Me&&(this.mainFragLoading=b=null),b&&W(b))){if(y.start>b.end){const t=this.fragmentTracker.getFragAtPos(v,f);t&&t.end>b.end&&(b=t,this.mainFragLoading={frag:t,targetBufferTime:null})}if(y.start>b.end)return}this.loadFragment(y,a,v)}onMediaDetaching(t,e){this.bufferFlushed=this.flushing=!1,super.onMediaDetaching(t,e)}onAudioTracksUpdated(t,{audioTracks:e}){this.resetTransmuxer(),this.levels=e.map((t=>new Jt(t)))}onAudioTrackSwitching(t,e){const n=!!e.url;this.trackId=e.id;const{fragCurrent:i}=this;i&&(i.abortRequests(),this.removeUnbufferedFrags(i.start)),this.resetLoadingState(),n?(this.switchingTrack=e,this.flushAudioIfNeeded(e),this.state!==yi&&(this.setInterval(100),this.state=bi,this.tick())):(this.resetTransmuxer(),this.switchingTrack=null,this.bufferedTrack=e,this.clearInterval())}onManifestLoading(){super.onManifestLoading(),this.bufferFlushed=this.flushing=this.audioOnly=!1,this.resetItem(),this.trackId=-1}onLevelLoaded(t,e){this.mainDetails=e.details;const n=this.cachedTrackLoadedData;n&&(this.cachedTrackLoadedData=null,this.onAudioTrackLoaded(l.AUDIO_TRACK_LOADED,n))}onAudioTrackLoaded(t,e){var n;const{levels:i}=this,{details:r,id:s,groupId:a,track:o}=e;if(!i)return void this.warn(`Audio tracks reset while loading track ${s} "${o.name}" of "${a}"`);const u=this.mainDetails;if(!u||r.endCC>u.endCC||u.expired)return this.cachedTrackLoadedData=e,void(this.state!==yi&&(this.state=ki));this.cachedTrackLoadedData=null,this.log(`Audio track ${s} "${o.name}" of "${a}" loaded [${r.startSN},${r.endSN}]${r.lastPartSn?`[part-${r.lastPartSn}-${r.lastPartIndex}]`:""},duration:${r.totalduration}`);const h=i[s];let c=0;if(r.live||null!=(n=h.details)&&n.live){if(this.checkLiveUpdate(r),r.deltaUpdateFailed)return;var d;if(h.details)c=this.alignPlaylists(r,h.details,null==(d=this.levelLastLoaded)?void 0:d.details);r.alignedSliding||(pi(r,u),r.alignedSliding||gi(r,u),c=r.fragmentStart)}h.details=r,this.levelLastLoaded=h,this.startFragRequested||this.setStartPosition(u,c),this.hls.trigger(l.AUDIO_TRACK_UPDATED,{details:r,id:s,groupId:e.groupId}),this.state!==ki||this.waitForCdnTuneIn(r)||(this.state=bi),this.tick()}_handleFragmentLoadProgress(t){var e;const n=t.frag,{part:i,payload:r}=t,{config:s,trackId:a,levels:o}=this;if(!o)return void this.warn(`Audio tracks were reset while fragment load was in progress. Fragment ${n.sn} of level ${n.level} will not be buffered`);const l=o[a];if(!l)return void this.warn("Audio track is undefined on fragment load progress");const u=l.details;if(!u)return this.warn("Audio track details undefined on fragment load progress"),void this.removeUnbufferedFrags(n.start);const h=s.defaultAudioCodec||l.audioCodec||"mp4a.40.2";let c=this.transmuxer;c||(c=this.transmuxer=new os(this.hls,p,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const d=this.initPTS[n.cc],f=null==(e=n.initSegment)?void 0:e.data;if(void 0!==d){const t=!1,e=i?i.index:-1,s=-1!==e,a=new Je(n.level,n.sn,n.stats.chunkCount,r.byteLength,e,s);c.push(r,f,h,"",n,i,u.totalduration,t,a,d)}else{this.log(`Unknown video PTS for cc ${n.cc}, waiting for video PTS before demuxing audio frag ${n.sn} of [${u.startSN} ,${u.endSN}],track ${a}`);const{cache:t}=this.waitingData=this.waitingData||{frag:n,part:i,cache:new Pi,complete:!1};t.push(new Uint8Array(r)),this.state!==yi&&(this.state=xi)}}_handleFragmentLoadComplete(t){this.waitingData?this.waitingData.complete=!0:super._handleFragmentLoadComplete(t)}onBufferReset(){this.mediaBuffer=null}onBufferCreated(t,e){this.bufferFlushed=this.flushing=!1;const n=e.tracks.audio;n&&(this.mediaBuffer=n.buffer||null)}onFragLoading(t,e){!this.audioOnly&&e.frag.type===f&&W(e.frag)&&(this.mainFragLoading=e,this.state===bi&&this.tick())}onFragBuffered(t,e){const{frag:n,part:i}=e;if(n.type===p)if(this.fragContextChanged(n))this.warn(`Fragment ${n.sn}${i?" p: "+i.index:""} of level ${n.level} finished buffering, but was aborted. state: ${this.state}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:"false"}`);else{if(W(n)){this.fragPrevious=n;const t=this.switchingTrack;t&&(this.bufferedTrack=t,this.switchingTrack=null,this.hls.trigger(l.AUDIO_TRACK_SWITCHED,E({},t)))}this.fragBufferedComplete(n,i),this.media&&this.tick()}else this.audioOnly||n.type!==f||n.elementaryStreams.video||n.elementaryStreams.audiovideo||(this.audioOnly=!0,this.mainFragLoading=null)}onError(t,e){var n;if(e.fatal)this.state=Ci;else switch(e.details){case o.FRAG_GAP:case o.FRAG_PARSING_ERROR:case o.FRAG_DECRYPT_ERROR:case o.FRAG_LOAD_ERROR:case o.FRAG_LOAD_TIMEOUT:case o.KEY_LOAD_ERROR:case o.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(p,e);break;case o.AUDIO_TRACK_LOAD_ERROR:case o.AUDIO_TRACK_LOAD_TIMEOUT:case o.LEVEL_PARSING_ERROR:e.levelRetry||this.state!==ki||(null==(n=e.context)?void 0:n.type)!==c||(this.state=bi);break;case o.BUFFER_ADD_CODEC_ERROR:case o.BUFFER_APPEND_ERROR:if("audio"!==e.parent)return;this.reduceLengthAndFlushBuffer(e)||this.resetLoadingState();break;case o.BUFFER_FULL_ERROR:if("audio"!==e.parent)return;this.reduceLengthAndFlushBuffer(e)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case o.INTERNAL_EXCEPTION:this.recoverWorkerError(e)}}onBufferFlushing(t,{type:e}){e!==Z&&(this.flushing=!0)}onBufferFlushed(t,{type:e}){if(e!==Z){this.flushing=!1,this.bufferFlushed=!0,this.state===Di&&(this.state=bi);const t=this.mediaBuffer||this.media;t&&(this.afterBufferFlushed(t,e,p),this.tick())}}_handleTransmuxComplete(t){var e;const n="audio",{hls:i}=this,{remuxResult:r,chunkMeta:s}=t,a=this.getCurrentContext(s);if(!a)return void this.resetWhenMissingContext(s);const{frag:o,part:u,level:h}=a,{details:c}=h,{audio:d,text:f,id3:p,initSegment:g}=r;if(!this.fragContextChanged(o)&&c){if(this.state=Si,this.switchingTrack&&d&&this.completeAudioSwitch(this.switchingTrack),null!=g&&g.tracks){const t=o.initSegment||o;if(this.unhandledEncryptionError(g,o))return;this._bufferInitSegment(h,g.tracks,t,s),i.trigger(l.FRAG_PARSING_INIT_SEGMENT,{frag:t,id:n,tracks:g.tracks})}if(d){const{startPTS:t,endPTS:e,startDTS:n,endDTS:i}=d;u&&(u.elementaryStreams[V]={startPTS:t,endPTS:e,startDTS:n,endDTS:i}),o.setElementaryStreamInfo(V,t,e,n,i),this.bufferFragmentData(d,o,u,s)}if(null!=p&&null!=(e=p.samples)&&e.length){const t=y({id:n,frag:o,details:c},p);i.trigger(l.FRAG_PARSING_METADATA,t)}if(f){const t=y({id:n,frag:o,details:c},f);i.trigger(l.FRAG_PARSING_USERDATA,t)}}else this.fragmentTracker.removeFragment(o)}_bufferInitSegment(t,e,n,i){if(this.state!==Si)return;if(e.video&&delete e.video,e.audiovideo&&delete e.audiovideo,!e.audio)return;const r=e.audio;r.id=p;const s=t.audioCodec;this.log(`Init audio buffer, container:${r.container}, codecs[level/parsed]=[${s}/${r.codec}]`),s&&1===s.split(",").length&&(r.levelCodec=s),this.hls.trigger(l.BUFFER_CODECS,e);const a=r.initSegment;if(null!=a&&a.byteLength){const t={type:"audio",frag:n,part:null,chunkMeta:i,parent:n.type,data:a};this.hls.trigger(l.BUFFER_APPENDING,t)}this.tickImmediate()}loadFragment(t,e,n){const i=this.fragmentTracker.getState(t);var r;if(this.switchingTrack||i===Pe||i===Fe)if(W(t))if(null!=(r=e.details)&&r.live&&!this.initPTS[t.cc]){this.log(`Waiting for video PTS in continuity counter ${t.cc} of live stream before loading audio fragment ${t.sn} of level ${this.trackId}`),this.state=xi;const n=this.mainDetails;n&&n.fragmentStart!==e.details.fragmentStart&&gi(e.details,n)}else super.loadFragment(t,e,n);else this._loadInitSegment(t,e);else this.clearTrackerIfNeeded(t)}flushAudioIfNeeded(t){if(this.media&&this.bufferedTrack){const{name:e,lang:n,assocLang:i,characteristics:r,audioCodec:s,channels:a}=this.bufferedTrack;oe({name:e,lang:n,assocLang:i,characteristics:r,audioCodec:s,channels:a},t,le)||(he(t.url,this.hls)?(this.log("Switching audio track : flushing all audio"),super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"),this.bufferedTrack=null):this.bufferedTrack=t)}}completeAudioSwitch(t){const{hls:e}=this;this.flushAudioIfNeeded(t),this.bufferedTrack=t,this.switchingTrack=null,e.trigger(l.AUDIO_TRACK_SWITCHED,E({},t))}},audioTrackController:class extends ls{constructor(t){super(t,"audio-track-controller"),this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.registerListeners()}registerListeners(){const{hls:t}=this;t.on(l.MANIFEST_LOADING,this.onManifestLoading,this),t.on(l.MANIFEST_PARSED,this.onManifestParsed,this),t.on(l.LEVEL_LOADING,this.onLevelLoading,this),t.on(l.LEVEL_SWITCHING,this.onLevelSwitching,this),t.on(l.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.on(l.ERROR,this.onError,this)}unregisterListeners(){const{hls:t}=this;t.off(l.MANIFEST_LOADING,this.onManifestLoading,this),t.off(l.MANIFEST_PARSED,this.onManifestParsed,this),t.off(l.LEVEL_LOADING,this.onLevelLoading,this),t.off(l.LEVEL_SWITCHING,this.onLevelSwitching,this),t.off(l.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.off(l.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(t,e){this.tracks=e.audioTracks||[]}onAudioTrackLoaded(t,e){const{id:n,groupId:i,details:r}=e,s=this.tracksInGroup[n];if(!s||s.groupId!==i)return void this.warn(`Audio track with id:${n} and group:${i} not found in active group ${null==s?void 0:s.groupId}`);const a=s.details;s.details=e.details,this.log(`Audio track ${n} "${s.name}" lang:${s.lang} group:${i} loaded [${r.startSN}-${r.endSN}]`),n===this.trackId&&this.playlistLoaded(n,e,a)}onLevelLoading(t,e){this.switchLevel(e.level)}onLevelSwitching(t,e){this.switchLevel(e.level)}switchLevel(t){const e=this.hls.levels[t];if(!e)return;const n=e.audioGroups||null,i=this.groupIds;let r=this.currentTrack;if(!n||(null==i?void 0:i.length)!==(null==n?void 0:n.length)||null!=n&&n.some((t=>-1===(null==i?void 0:i.indexOf(t))))){this.groupIds=n,this.trackId=-1,this.currentTrack=null;const t=this.tracks.filter((t=>!n||-1!==n.indexOf(t.groupId)));if(t.length)this.selectDefaultTrack&&!t.some((t=>t.default))&&(this.selectDefaultTrack=!1),t.forEach(((t,e)=>{t.id=e}));else if(!r&&!this.tracksInGroup.length)return;this.tracksInGroup=t;const e=this.hls.config.audioPreference;if(!r&&e){const n=ae(e,t,le);if(n>-1)r=t[n];else{const t=ae(e,this.tracks);r=this.tracks[t]}}let i=this.findTrackId(r);-1===i&&r&&(i=this.findTrackId(null));const u={audioTracks:t};this.log(`Updating audio tracks, ${t.length} track(s) found in group(s): ${null==n?void 0:n.join(",")}`),this.hls.trigger(l.AUDIO_TRACKS_UPDATED,u);const h=this.trackId;if(-1!==i&&-1===h)this.setAudioTrack(i);else if(t.length&&-1===h){var s;const e=new Error(`No audio track selected for current audio group-ID(s): ${null==(s=this.groupIds)?void 0:s.join(",")} track count: ${t.length}`);this.warn(e.message),this.hls.trigger(l.ERROR,{type:a.MEDIA_ERROR,details:o.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:e})}}}onError(t,e){!e.fatal&&e.context&&(e.context.type!==c||e.context.id!==this.trackId||this.groupIds&&-1===this.groupIds.indexOf(e.context.groupId)||this.checkRetry(e))}get allAudioTracks(){return this.tracks}get audioTracks(){return this.tracksInGroup}get audioTrack(){return this.trackId}set audioTrack(t){this.selectDefaultTrack=!1,this.setAudioTrack(t)}setAudioOption(t){const e=this.hls;if(e.config.audioPreference=t,t){const n=this.allAudioTracks;if(this.selectDefaultTrack=!1,n.length){const i=this.currentTrack;if(i&&oe(t,i,le))return i;const r=ae(t,this.tracksInGroup,le);if(r>-1){const t=this.tracksInGroup[r];return this.setAudioTrack(r),t}if(i){let i=e.loadLevel;-1===i&&(i=e.firstAutoLevel);const r=function(t,e,n,i,r){const s=e[i],a=e.reduce(((t,e,n)=>{const i=e.uri;return(t[i]||(t[i]=[])).push(n),t}),{})[s.uri];a.length>1&&(i=Math.max.apply(Math,a));const o=s.videoRange,l=s.frameRate,u=s.codecSet.substring(0,4),h=ue(e,i,(e=>{if(e.videoRange!==o||e.frameRate!==l||e.codecSet.substring(0,4)!==u)return!1;const i=e.audioGroups,s=n.filter((t=>!i||-1!==i.indexOf(t.groupId)));return ae(t,s,r)>-1}));return h>-1?h:ue(e,i,(e=>{const i=e.audioGroups,s=n.filter((t=>!i||-1!==i.indexOf(t.groupId)));return ae(t,s,r)>-1}))}(t,e.levels,n,i,le);if(-1===r)return null;e.nextLoadLevel=r}if(t.channels||t.audioCodec){const e=ae(t,n);if(e>-1)return n[e]}}}return null}setAudioTrack(t){const e=this.tracksInGroup;if(t<0||t>=e.length)return void this.warn(`Invalid audio track id: ${t}`);this.selectDefaultTrack=!1;const n=this.currentTrack,i=e[t],r=i.details&&!i.details.live;if(t===this.trackId&&i===n&&r)return;if(this.log(`Switching to audio-track ${t} "${i.name}" lang:${i.lang} group:${i.groupId} channels:${i.channels}`),this.trackId=t,this.currentTrack=i,this.hls.trigger(l.AUDIO_TRACK_SWITCHING,E({},i)),r)return;const s=this.switchParams(i.url,null==n?void 0:n.details,i.details);this.loadPlaylist(s)}findTrackId(t){const e=this.tracksInGroup;for(let n=0;n<e.length;n++){const i=e[n];if((!this.selectDefaultTrack||i.default)&&(!t||oe(t,i,le)))return n}if(t){const{name:n,lang:i,assocLang:r,characteristics:s,audioCodec:a,channels:o}=t;for(let t=0;t<e.length;t++){if(oe({name:n,lang:i,assocLang:r,characteristics:s,audioCodec:a,channels:o},e[t],le))return t}for(let n=0;n<e.length;n++){const i=e[n];if(hs(t.attrs,i.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return n}for(let n=0;n<e.length;n++){const i=e[n];if(hs(t.attrs,i.attrs,["LANGUAGE"]))return n}}return-1}loadPlaylist(t){super.loadPlaylist();const e=this.currentTrack;this.shouldLoadPlaylist(e)&&he(e.url,this.hls)&&this.scheduleLoading(e,t)}loadingPlaylist(t,e){super.loadingPlaylist(t,e);const n=t.id,i=t.groupId,r=this.getUrlWithDirectives(t.url,e),s=t.details,a=null==s?void 0:s.age;this.log(`Loading audio-track ${n} "${t.name}" lang:${t.lang} group:${i}${void 0!==(null==e?void 0:e.msn)?" at sn "+e.msn+" part "+e.part:""}${a&&s.live?" age "+a.toFixed(1)+(s.type?" "+s.type||0:""):""} ${r}`),this.hls.trigger(l.AUDIO_TRACK_LOADING,{url:r,id:n,groupId:i,deliveryDirectives:e||null,track:t})}},emeController:pa,cmcdController:class{constructor(t){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=t=>{try{this.apply(t,{ot:ys.MANIFEST,su:!this.initialized})}catch(t){this.hls.logger.warn("Could not generate manifest CMCD data.",t)}},this.applyFragmentData=t=>{try{const{frag:e,part:n}=t,i=this.hls.levels[e.level],r=this.getObjectType(e),s={d:1e3*(n||e).duration,ot:r};r!==ys.VIDEO&&r!==ys.AUDIO&&r!=ys.MUXED||(s.br=i.bitrate/1e3,s.tb=this.getTopBandwidth(r)/1e3,s.bl=this.getBufferLength(r));const a=n?this.getNextPart(n):this.getNextFrag(e);null!=a&&a.url&&a.url!==e.url&&(s.nor=a.url),this.apply(t,s)}catch(t){this.hls.logger.warn("Could not generate segment CMCD data.",t)}},this.hls=t;const e=this.config=t.config,{cmcd:n}=e;null!=n&&(e.pLoader=this.createPlaylistLoader(),e.fLoader=this.createFragmentLoader(),this.sid=n.sessionId||t.sessionId,this.cid=n.contentId,this.useHeaders=!0===n.useHeaders,this.includeKeys=n.includeKeys,this.registerListeners())}registerListeners(){const t=this.hls;t.on(l.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(l.MEDIA_DETACHED,this.onMediaDetached,this),t.on(l.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){const t=this.hls;t.off(l.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(l.MEDIA_DETACHED,this.onMediaDetached,this),t.off(l.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(t,e){this.media=e.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(t,e){var n,i;this.audioBuffer=null==(n=e.tracks.audio)?void 0:n.buffer,this.videoBuffer=null==(i=e.tracks.video)?void 0:i.buffer}createData(){var t;return{v:1,sf:bs.HLS,sid:this.sid,cid:this.cid,pr:null==(t=this.media)?void 0:t.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(t,e={}){y(e,this.createData());const n=e.ot===ys.INIT||e.ot===ys.VIDEO||e.ot===ys.MUXED;this.starved&&n&&(e.bs=!0,e.su=!0,this.starved=!1),null==e.su&&(e.su=this.buffering);const{includeKeys:i}=this;i&&(e=Object.keys(e).reduce(((t,n)=>(i.includes(n)&&(t[n]=e[n]),t)),{}));const r={baseUrl:t.url};this.useHeaders?(t.headers||(t.headers={}),la(t.headers,e,r)):t.url=ca(t.url,e,r)}getNextFrag(t){var e;const n=null==(e=this.hls.levels[t.level])?void 0:e.details;if(n){const e=t.sn-n.startSN;return n.fragments[e+1]}}getNextPart(t){var e;const{index:n,fragment:i}=t,r=null==(e=this.hls.levels[i.level])||null==(e=e.details)?void 0:e.partList;if(r){const{sn:t}=i;for(let e=r.length-1;e>=0;e--){const i=r[e];if(i.index===n&&i.fragment.sn===t)return r[e+1]}}}getObjectType(t){const{type:e}=t;return"subtitle"===e?ys.TIMED_TEXT:"initSegment"===t.sn?ys.INIT:"audio"===e?ys.AUDIO:"main"===e?this.hls.audioTracks.length?ys.VIDEO:ys.MUXED:void 0}getTopBandwidth(t){let e,n=0;const i=this.hls;if(t===ys.AUDIO)e=i.audioTracks;else{const t=i.maxAutoLevel,n=t>-1?t+1:i.levels.length;e=i.levels.slice(0,n)}return e.forEach((t=>{t.bitrate>n&&(n=t.bitrate)})),n>0?n:NaN}getBufferLength(t){const e=this.media,n=t===ys.AUDIO?this.audioBuffer:this.videoBuffer;if(!n||!e)return NaN;return 1e3*en.bufferInfo(n,e.currentTime,this.config.maxBufferHole).len}createPlaylistLoader(){const{pLoader:t}=this.config,e=this.applyPlaylistData,n=t||this.config.loader;return class{constructor(t){this.loader=void 0,this.loader=new n(t)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(t,n,i){e(t),this.loader.load(t,n,i)}}}createFragmentLoader(){const{fLoader:t}=this.config,e=this.applyFragmentData,n=t||this.config.loader;return class{constructor(t){this.loader=void 0,this.loader=new n(t)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(t,n,i){e(t),this.loader.load(t,n,i)}}}},contentSteeringController:class extends w{constructor(t){super("content-steering",t.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=t,this.registerListeners()}registerListeners(){const t=this.hls;t.on(l.MANIFEST_LOADING,this.onManifestLoading,this),t.on(l.MANIFEST_LOADED,this.onManifestLoaded,this),t.on(l.MANIFEST_PARSED,this.onManifestParsed,this),t.on(l.ERROR,this.onError,this)}unregisterListeners(){const t=this.hls;t&&(t.off(l.MANIFEST_LOADING,this.onManifestLoading,this),t.off(l.MANIFEST_LOADED,this.onManifestLoaded,this),t.off(l.MANIFEST_PARSED,this.onManifestParsed,this),t.off(l.ERROR,this.onError,this))}pathways(){return(this.levels||[]).reduce(((t,e)=>(-1===t.indexOf(e.pathwayId)&&t.push(e.pathwayId),t)),[])}get pathwayPriority(){return this._pathwayPriority}set pathwayPriority(t){this.updatePathwayPriority(t)}startLoad(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){const t=1e3*this.timeToLoad-(performance.now()-this.updated);if(t>0)return void this.scheduleRefresh(this.uri,t)}this.loadSteeringManifest(this.uri)}}stopLoad(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),this.clearTimeout()}clearTimeout(){-1!==this.reloadTimer&&(self.clearTimeout(this.reloadTimer),this.reloadTimer=-1)}destroy(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null}removeLevel(t){const e=this.levels;e&&(this.levels=e.filter((e=>e!==t)))}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(t,e){const{contentSteering:n}=e;null!==n&&(this.pathwayId=n.pathwayId,this.uri=n.uri,this.started&&this.startLoad())}onManifestParsed(t,e){this.audioTracks=e.audioTracks,this.subtitleTracks=e.subtitleTracks}onError(t,e){const{errorAction:n}=e;if((null==n?void 0:n.action)===Se&&n.flags===xe){const t=this.levels;let i=this._pathwayPriority,r=this.pathwayId;if(e.context){const{groupId:n,pathwayId:i,type:s}=e.context;n&&t?r=this.getPathwayForGroupId(n,s,r):i&&(r=i)}r in this.penalizedPathways||(this.penalizedPathways[r]=performance.now()),!i&&t&&(i=this.pathways()),i&&i.length>1&&(this.updatePathwayPriority(i),n.resolved=this.pathwayId!==r),e.details!==o.BUFFER_APPEND_ERROR||e.fatal?n.resolved||this.warn(`Could not resolve ${e.details} ("${e.error.message}") with content-steering for Pathway: ${r} levels: ${t?t.length:t} priorities: ${ne(i)} penalized: ${ne(this.penalizedPathways)}`):n.resolved=!0}}filterParsedLevels(t){this.levels=t;let e=this.getLevelsForPathway(this.pathwayId);if(0===e.length){const n=t[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${n}"`),e=this.getLevelsForPathway(n),this.pathwayId=n}return e.length!==t.length&&this.log(`Found ${e.length}/${t.length} levels in Pathway "${this.pathwayId}"`),e}getLevelsForPathway(t){return null===this.levels?[]:this.levels.filter((e=>t===e.pathwayId))}updatePathwayPriority(t){let e;this._pathwayPriority=t;const n=this.penalizedPathways,i=performance.now();Object.keys(n).forEach((t=>{i-n[t]>3e5&&delete n[t]}));for(let i=0;i<t.length;i++){const r=t[i];if(r in n)continue;if(r===this.pathwayId)return;const s=this.hls.nextLoadLevel,a=this.hls.levels[s];if(e=this.getLevelsForPathway(r),e.length>0){this.log(`Setting Pathway to "${r}"`),this.pathwayId=r,li(e),this.hls.trigger(l.LEVELS_UPDATED,{levels:e});const t=this.hls.levels[s];a&&t&&this.levels&&(t.attrs["STABLE-VARIANT-ID"]!==a.attrs["STABLE-VARIANT-ID"]&&t.bitrate!==a.bitrate&&this.log(`Unstable Pathways change from bitrate ${a.bitrate} to ${t.bitrate}`),this.hls.nextLoadLevel=s);break}}}getPathwayForGroupId(t,e,n){const i=this.getLevelsForPathway(n).concat(this.levels||[]);for(let n=0;n<i.length;n++)if(e===c&&i[n].hasAudioGroup(t)||e===d&&i[n].hasSubtitleGroup(t))return i[n].pathwayId;return n}clonePathways(t){const e=this.levels;if(!e)return;const n={},i={};t.forEach((t=>{const{ID:r,"BASE-ID":s,"URI-REPLACEMENT":a}=t;if(e.some((t=>t.pathwayId===r)))return;const o=this.getLevelsForPathway(s).map((t=>{const e=new hn(t.attrs);e["PATHWAY-ID"]=r;const s=e.AUDIO&&`${e.AUDIO}_clone_${r}`,o=e.SUBTITLES&&`${e.SUBTITLES}_clone_${r}`;s&&(n[e.AUDIO]=s,e.AUDIO=s),o&&(i[e.SUBTITLES]=o,e.SUBTITLES=o);const l=fa(t.uri,e["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",a),u=new Jt({attrs:e,audioCodec:t.audioCodec,bitrate:t.bitrate,height:t.height,name:t.name,url:l,videoCodec:t.videoCodec,width:t.width});if(t.audioGroups)for(let e=1;e<t.audioGroups.length;e++)u.addGroupId("audio",`${t.audioGroups[e]}_clone_${r}`);if(t.subtitleGroups)for(let e=1;e<t.subtitleGroups.length;e++)u.addGroupId("text",`${t.subtitleGroups[e]}_clone_${r}`);return u}));e.push(...o),da(this.audioTracks,n,a,r),da(this.subtitleTracks,i,a,r)}))}loadSteeringManifest(t){const e=this.hls.config,n=e.loader;let i;this.loader&&this.loader.destroy(),this.loader=new n(e);try{i=new self.URL(t)}catch(e){return this.enabled=!1,void this.log(`Failed to parse Steering Manifest URI: ${t}`)}if("data:"!==i.protocol){const t=0|(this.hls.bandwidthEstimate||e.abrEwmaDefaultEstimate);i.searchParams.set("_HLS_pathway",this.pathwayId),i.searchParams.set("_HLS_throughput",""+t)}const r={responseType:"json",url:i.href},s=e.steeringManifestLoadPolicy.default,a=s.errorRetry||s.timeoutRetry||{},o={loadPolicy:s,timeout:s.maxLoadTimeMs,maxRetry:a.maxNumRetry||0,retryDelay:a.retryDelayMs||0,maxRetryDelay:a.maxRetryDelayMs||0},u={onSuccess:(t,e,n,r)=>{this.log(`Loaded steering manifest: "${i}"`);const s=t.data;if(1!==(null==s?void 0:s.VERSION))return void this.log(`Steering VERSION ${s.VERSION} not supported!`);this.updated=performance.now(),this.timeToLoad=s.TTL;const{"RELOAD-URI":a,"PATHWAY-CLONES":o,"PATHWAY-PRIORITY":u}=s;if(a)try{this.uri=new self.URL(a,i).href}catch(t){return this.enabled=!1,void this.log(`Failed to parse Steering Manifest RELOAD-URI: ${a}`)}this.scheduleRefresh(this.uri||n.url),o&&this.clonePathways(o);const h={steeringManifest:s,url:i.toString()};this.hls.trigger(l.STEERING_MANIFEST_LOADED,h),u&&this.updatePathwayPriority(u)},onError:(t,e,n,i)=>{if(this.log(`Error loading steering manifest: ${t.code} ${t.text} (${e.url})`),this.stopLoad(),410===t.code)return this.enabled=!1,void this.log(`Steering manifest ${e.url} no longer available`);let r=1e3*this.timeToLoad;if(429!==t.code)this.scheduleRefresh(this.uri||e.url,r);else{const t=this.loader;if("function"==typeof(null==t?void 0:t.getResponseHeader)){const e=t.getResponseHeader("Retry-After");e&&(r=1e3*parseFloat(e))}this.log(`Steering manifest ${e.url} rate limited`)}},onTimeout:(t,e,n)=>{this.log(`Timeout loading steering manifest (${e.url})`),this.scheduleRefresh(this.uri||e.url)}};this.log(`Requesting steering manifest: ${i}`),this.loader.load(r,o,u)}scheduleRefresh(t,e=1e3*this.timeToLoad){this.clearTimeout(),this.reloadTimer=self.setTimeout((()=>{var e;const n=null==(e=this.hls)?void 0:e.media;!n||n.ended?this.scheduleRefresh(t,1e3*this.timeToLoad):this.loadSteeringManifest(t)}),e)}},interstitialsController:class extends w{constructor(t,e){super("interstitials",t.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 t=this.currentTime;if(void 0===t||this.playbackDisabled||!this.schedule)return;const e=t-this.timelinePos;if(Math.abs(e)<1/7056e5)return;const n=e<=-.01;this.timelinePos=t,this.bufferedPos=t;const i=this.playingItem;if(!i)return void this.checkBuffer();if(n){this.schedule.resetErrorsInRange(t,t-e)&&this.updateSchedule(!0)}if(this.checkBuffer(),n&&t<i.start||t>=i.end){var r;const e=this.findItemIndex(i);let s=this.schedule.findItemIndexAtTime(t);if(-1===s&&(s=e+(n?-1:1),this.log(`seeked ${n?"back ":""}to position not covered by schedule ${t} (resolving from ${e} to ${s})`)),!this.isInterstitial(i)&&null!=(r=this.media)&&r.paused&&(this.shouldPlay=!1),!n&&s>e){const t=this.schedule.findJumpRestrictedIndex(e+1,s);if(t>e)return void this.setSchedulePosition(t)}return void this.setSchedulePosition(s)}const s=this.playingAsset;if(!s){if(this.playingLastItem&&this.isInterstitial(i)){const e=i.event.assetList[0];e&&(this.endedItem=this.playingItem,this.playingItem=null,this.setScheduleToAssetAtTime(t,e))}return}const a=s.timelineStart,o=s.duration||0;var l;(n&&t<a||t>=a+o)&&(null!=(l=i.event)&&l.appendInPlace&&(this.clearInterstitial(i.event,i),this.flushFrontBuffer(t)),this.setScheduleToAssetAtTime(t,s))},this.onTimeupdate=()=>{const t=this.currentTime;if(void 0===t||this.playbackDisabled)return;if(!(t>this.timelinePos))return;this.timelinePos=t,t>this.bufferedPos&&this.checkBuffer();const e=this.playingItem;if(!e||this.playingLastItem)return;if(t>=e.end){this.timelinePos=e.end;const t=this.findItemIndex(e);this.setSchedulePosition(t+1)}const n=this.playingAsset;if(!n)return;t>=n.timelineStart+(n.duration||0)&&this.setScheduleToAssetAtTime(t,n)},this.onScheduleUpdate=(t,e)=>{const n=this.schedule;if(!n)return;const i=this.playingItem,r=n.events||[],s=n.items||[],a=n.durations,o=t.map((t=>t.identifier)),u=!(!r.length&&!o.length);(u||e)&&this.log(`INTERSTITIALS_UPDATED (${r.length}): ${r}\nSchedule: ${s.map((t=>Fa(t)))} pos: ${this.timelinePos}`),o.length&&this.log(`Removed events ${o}`);let h=null,c=null;i&&(h=this.updateItem(i,this.timelinePos),this.itemsMatch(i,h)?this.playingItem=h:this.waitingItem=this.endedItem=null),this.waitingItem=this.updateItem(this.waitingItem),this.endedItem=this.updateItem(this.endedItem);const d=this.bufferingItem;if(d&&(c=this.updateItem(d,this.bufferedPos),this.itemsMatch(d,c)?this.bufferingItem=c:d.event&&(this.bufferingItem=this.playingItem,this.clearInterstitial(d.event,null))),t.forEach((t=>{t.assetList.forEach((t=>{this.clearAssetPlayer(t.identifier,null)}))})),this.playerQueue.forEach((t=>{if(t.interstitial.appendInPlace){const e=t.assetItem.timelineStart,n=t.timelineOffset-e;if(n)try{t.timelineOffset=e}catch(i){Math.abs(n)>Sa&&this.warn(`${i} ("${t.assetId}" ${t.timelineOffset}->${e})`)}}})),u||e){if(this.hls.trigger(l.INTERSTITIALS_UPDATED,{events:r.slice(0),schedule:s.slice(0),durations:a,removedIds:o}),this.isInterstitial(i)&&o.includes(i.event.identifier))return this.warn(`Interstitial "${i.event.identifier}" removed while playing`),void this.primaryFallback(i.event);i&&this.trimInPlace(h,i),d&&c!==h&&this.trimInPlace(c,d),this.checkBuffer()}},this.hls=t,this.HlsPlayerClass=e,this.assetListLoader=new Ma(t),this.schedule=new Oa(this.onScheduleUpdate,t.logger),this.registerListeners()}registerListeners(){const t=this.hls;t&&(t.on(l.MEDIA_ATTACHING,this.onMediaAttaching,this),t.on(l.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(l.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(l.MANIFEST_LOADING,this.onManifestLoading,this),t.on(l.LEVEL_UPDATED,this.onLevelUpdated,this),t.on(l.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.on(l.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),t.on(l.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),t.on(l.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),t.on(l.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),t.on(l.ASSET_LIST_LOADED,this.onAssetListLoaded,this),t.on(l.BUFFER_APPENDED,this.onBufferAppended,this),t.on(l.BUFFER_FLUSHED,this.onBufferFlushed,this),t.on(l.BUFFERED_TO_END,this.onBufferedToEnd,this),t.on(l.MEDIA_ENDED,this.onMediaEnded,this),t.on(l.ERROR,this.onError,this),t.on(l.DESTROYING,this.onDestroying,this))}unregisterListeners(){const t=this.hls;t&&(t.off(l.MEDIA_ATTACHING,this.onMediaAttaching,this),t.off(l.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(l.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(l.MANIFEST_LOADING,this.onManifestLoading,this),t.off(l.LEVEL_UPDATED,this.onLevelUpdated,this),t.off(l.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.off(l.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),t.off(l.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),t.off(l.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),t.off(l.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),t.off(l.ASSET_LIST_LOADED,this.onAssetListLoaded,this),t.off(l.BUFFER_CODECS,this.onBufferCodecs,this),t.off(l.BUFFER_APPENDED,this.onBufferAppended,this),t.off(l.BUFFER_FLUSHED,this.onBufferFlushed,this),t.off(l.BUFFERED_TO_END,this.onBufferedToEnd,this),t.off(l.MEDIA_ENDED,this.onMediaEnded,this),t.off(l.ERROR,this.onError,this),t.off(l.DESTROYING,this.onDestroying,this))}startLoad(){this.resumeBuffering()}stopLoad(){this.pauseBuffering()}resumeBuffering(){var t;null==(t=this.getBufferingPlayer())||t.resumeBuffering()}pauseBuffering(){var t;null==(t=this.getBufferingPlayer())||t.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 t=this.primaryMedia||this.media;t&&this.removeMediaListeners(t)}removeMediaListeners(t){mi(t,"play",this.onPlay),mi(t,"pause",this.onPause),mi(t,"seeking",this.onSeeking),mi(t,"timeupdate",this.onTimeupdate)}onMediaAttaching(t,e){const n=this.media=e.media;_i(n,"seeking",this.onSeeking),_i(n,"timeupdate",this.onTimeupdate),_i(n,"play",this.onPlay),_i(n,"pause",this.onPause)}onMediaAttached(t,e){const n=this.effectivePlayingItem,i=this.detachedData;if(this.detachedData=null,null===n)this.checkStart();else if(!i){this.clearScheduleState();const t=this.findItemIndex(n);this.setSchedulePosition(t)}}clearScheduleState(){this.log("clear schedule state"),this.playingItem=this.bufferingItem=this.waitingItem=this.endedItem=this.playingAsset=this.endedAsset=this.bufferingAsset=null}onMediaDetaching(t,e){const n=!!e.transferMedia,i=this.media;if(this.media=null,!n&&(i&&this.removeMediaListeners(i),this.detachedData)){const t=this.getBufferingPlayer();t&&(this.log(`Removing schedule state for detachedData and ${t}`),this.playingAsset=this.endedAsset=this.bufferingAsset=this.bufferingItem=this.waitingItem=this.detachedData=null,t.detachMedia()),this.shouldPlay=!1}}get interstitialsManager(){if(!this.hls)return null;if(this.manager)return this.manager;const t=this,e=()=>t.bufferingItem||t.waitingItem,n=e=>e?t.getAssetPlayer(e.identifier):e,i=(e,i,s,a,o)=>{if(e){let l=e[i].start;const u=e.event;if(u){if("playout"===i||u.timelineOccupancy!==Aa.Point){const t=n(s);(null==t?void 0:t.interstitial)===u&&(l+=t.assetItem.startOffset+t[o])}}else{l+=("bufferedPos"===a?r():t[a])-e.start}return l}return 0},r=()=>{const e=t.bufferedPos;return e===Number.MAX_VALUE?s("primary"):Math.max(e,0)},s=e=>{var n,i;return null!=(n=t.primaryDetails)&&n.live?t.primaryDetails.edge:(null==(i=t.schedule)?void 0:i.durations[e])||0},a=(e,r)=>{var s,a;const o=t.effectivePlayingItem;if(null!=o&&null!=(s=o.event)&&s.restrictions.skip||!t.schedule)return;t.log(`seek to ${e} "${r}"`);const l=t.effectivePlayingItem,u=t.schedule.findItemIndexAtTime(e,r),h=null==(a=t.schedule.items)?void 0:a[u],c=t.getBufferingPlayer(),d=null==c?void 0:c.interstitial,f=null==d?void 0:d.appendInPlace,p=l&&t.itemsMatch(l,h);if(l&&(f||p)){const s=n(t.playingAsset),a=(null==s?void 0:s.media)||t.primaryMedia;if(a){const n="primary"===r?a.currentTime:i(l,r,t.playingAsset,"timelinePos","currentTime"),o=e-n,u=(f?n:a.currentTime)+o;if(u>=0&&(!s||f||u<=s.duration))return void(a.currentTime=u)}}if(h){let n=e;if("primary"!==r){const t=e-h[r].start;n=h.start+t}const i=!t.isInterstitial(h);if(t.isInterstitial(l)&&!l.event.appendInPlace||!i&&!h.event.appendInPlace){if(l){const s=t.findItemIndex(l);if(u>s){const e=t.schedule.findJumpRestrictedIndex(s+1,u);if(e>s)return void t.setSchedulePosition(e)}let a=0;if(i)t.timelinePos=n,t.checkBuffer();else{const t=h.event.assetList,n=e-(h[r]||h).start;for(let e=t.length;e--;){const i=t[e];if(i.duration&&n>=i.startOffset&&n<i.startOffset+i.duration){a=e;break}}}t.setSchedulePosition(u,a)}}else{const e=t.media||(f?null==c?void 0:c.media:null);e&&(e.currentTime=n)}}},o=()=>{const n=t.effectivePlayingItem;if(t.isInterstitial(n))return n;const i=e();return t.isInterstitial(i)?i:null},l={get bufferedEnd(){const n=e(),r=t.bufferingItem;var s;return r&&r===n&&(i(r,"playout",t.bufferingAsset,"bufferedPos","bufferedEnd")-r.playout.start||(null==(s=t.bufferingAsset)?void 0:s.startOffset))||0},get currentTime(){const e=o(),n=t.effectivePlayingItem;return n&&n===e?i(n,"playout",t.effectivePlayingAsset,"timelinePos","currentTime")-n.playout.start:0},set currentTime(e){const n=o(),i=t.effectivePlayingItem;i&&i===n&&a(e+i.playout.start,"playout")},get duration(){const t=o();return t?t.playout.end-t.playout.start:0},get assetPlayers(){var e;const n=null==(e=o())?void 0:e.event.assetList;return n?n.map((e=>t.getAssetPlayer(e.identifier))):[]},get playingIndex(){var e;const n=null==(e=o())?void 0:e.event;return n&&t.effectivePlayingAsset?n.findAssetIndex(t.effectivePlayingAsset):-1},get scheduleItem(){return o()}};return this.manager={get events(){var e;return(null==(e=t.schedule)||null==(e=e.events)?void 0:e.slice(0))||[]},get schedule(){var e;return(null==(e=t.schedule)||null==(e=e.items)?void 0:e.slice(0))||[]},get interstitialPlayer(){return o()?l:null},get playerQueue(){return t.playerQueue.slice(0)},get bufferingAsset(){return t.bufferingAsset},get bufferingItem(){return e()},get bufferingIndex(){const n=e();return t.findItemIndex(n)},get playingAsset(){return t.effectivePlayingAsset},get playingItem(){return t.effectivePlayingItem},get playingIndex(){const e=t.effectivePlayingItem;return t.findItemIndex(e)},primary:{get bufferedEnd(){return r()},get currentTime(){const e=t.timelinePos;return e>0?e:0},set currentTime(t){a(t,"primary")},get duration(){return s("primary")},get seekableStart(){var e;return(null==(e=t.primaryDetails)?void 0:e.fragmentStart)||0}},integrated:{get bufferedEnd(){return i(e(),"integrated",t.bufferingAsset,"bufferedPos","bufferedEnd")},get currentTime(){return i(t.effectivePlayingItem,"integrated",t.effectivePlayingAsset,"timelinePos","currentTime")},set currentTime(t){a(t,"integrated")},get duration(){return s("integrated")},get seekableStart(){var e;return((e,n)=>{var i;if(0!==e&&"primary"!==n&&null!=(i=t.schedule)&&i.length){var r;const i=t.schedule.findItemIndexAtTime(e),s=null==(r=t.schedule.items)?void 0:r[i];if(s)return e+(s[n].start-s.start)}return e})((null==(e=t.primaryDetails)?void 0:e.fragmentStart)||0,"integrated")}},skip:()=>{const e=t.effectivePlayingItem,n=null==e?void 0:e.event;if(n&&!n.restrictions.skip){const i=t.findItemIndex(e);if(n.appendInPlace){const t=e.playout.start+e.event.duration;a(t+.001,"playout")}else t.advanceAfterAssetEnded(n,i,1/0)}}}}get effectivePlayingItem(){return this.waitingItem||this.playingItem||this.endedItem}get effectivePlayingAsset(){return this.playingAsset||this.endedAsset}get playingLastItem(){var t;const e=this.playingItem,n=null==(t=this.schedule)?void 0:t.items;return!!(this.playbackStarted&&e&&n)&&this.findItemIndex(e)===n.length-1}get playbackStarted(){return null!==this.effectivePlayingItem}get currentTime(){var t,e;if(null===this.mediaSelection)return;const n=this.waitingItem||this.playingItem;if(this.isInterstitial(n)&&!n.event.appendInPlace)return;let r=this.media;!r&&null!=(t=this.bufferingItem)&&null!=(t=t.event)&&t.appendInPlace&&(r=this.primaryMedia);const s=null==(e=r)?void 0:e.currentTime;return void 0!==s&&i(s)?s:void 0}get primaryMedia(){var t;return this.media||(null==(t=this.detachedData)?void 0:t.media)||null}isInterstitial(t){return!(null==t||!t.event)}retreiveMediaSource(t,e){const n=this.getAssetPlayer(t);n&&this.transferMediaFromPlayer(n,e)}transferMediaFromPlayer(t,e){const n=t.interstitial.appendInPlace,i=t.media;if(n&&i===this.primaryMedia){if(this.bufferingAsset=null,(!e||this.isInterstitial(e)&&!e.event.appendInPlace)&&e&&i)return void(this.detachedData={media:i});const n=t.transferMedia();this.log(`transfer MediaSource from ${t} ${ne(n)}`),this.detachedData=n}else e&&i&&(this.shouldPlay||(this.shouldPlay=!i.paused))}transferMediaTo(t,e){var n,i;if(t.media===e)return;let r=null;const s=this.hls,a=t!==s,o=a&&t.interstitial.appendInPlace,l=null==(n=this.detachedData)?void 0:n.mediaSource;let u;if(s.media)o&&(r=s.transferMedia(),this.detachedData=r),u="Primary";else if(l){const t=this.getBufferingPlayer();t?(r=t.transferMedia(),u=`${t}`):u="detached MediaSource"}else u="detached media";if(!r)if(l)r=this.detachedData,this.log(`using detachedData: MediaSource ${ne(r)}`);else if(!this.detachedData||s.media===e){const t=this.playerQueue;t.length>1&&t.forEach((t=>{if(a&&t.interstitial.appendInPlace!==o){const e=t.interstitial;this.clearInterstitial(t.interstitial,null),e.appendInPlace=!1,e.appendInPlace&&this.warn(`Could not change append strategy for queued assets ${e}`)}})),this.hls.detachMedia(),this.detachedData={media:e}}const h=r&&"mediaSource"in r&&"closed"!==(null==(i=r.mediaSource)?void 0:i.readyState),c=h&&r?r:e;this.log(`${h?"transfering MediaSource":"attaching media"} to ${a?t:"Primary"} from ${u} (media.currentTime: ${e.currentTime})`);const d=this.schedule;if(c===r&&d){const e=a&&t.assetId===d.assetIdAtEnd;c.overrides={duration:d.duration,endOfStream:!a||e,cueRemoval:!a}}t.attachMedia(c)}onInterstitialCueEnter(){this.onTimeupdate()}checkStart(){const t=this.schedule,e=null==t?void 0:t.events;if(!e||this.playbackDisabled||!this.media)return;-1===this.bufferedPos&&(this.bufferedPos=0);const n=this.timelinePos,i=this.effectivePlayingItem;if(-1===n){const n=this.hls.startPosition;if(this.log(Ba("checkStart",n)),this.timelinePos=n,e.length&&e[0].cue.pre){const n=t.findEventIndex(e[0].identifier);this.setSchedulePosition(n)}else if(n>=0||!this.primaryLive){const e=this.timelinePos=n>0?n:0,i=t.findItemIndexAtTime(e);this.setSchedulePosition(i)}}else if(i&&!this.playingItem){const e=t.findItemIndex(i);this.setSchedulePosition(e)}}advanceAssetBuffering(t,e){const n=t.event,i=n.findAssetIndex(e),r=La(n,i);if(n.isAssetPastPlayoutLimit(r)){if(this.schedule){var s;const e=null==(s=this.schedule.items)?void 0:s[this.findItemIndex(t)+1];e&&this.bufferedToItem(e)}}else this.bufferedToEvent(t,r)}advanceAfterAssetEnded(t,e,n){const i=La(t,n);if(t.isAssetPastPlayoutLimit(i)){if(this.schedule){const n=this.schedule.items;if(n){const i=e+1;if(i>=n.length)return void this.setSchedulePosition(-1);const r=t.resumeTime;this.timelinePos<r&&(this.log(Ba("advanceAfterAssetEnded",r)),this.timelinePos=r,t.appendInPlace&&this.advanceInPlace(r),this.checkBuffer(this.bufferedPos<r)),this.setSchedulePosition(i)}}}else{if(t.appendInPlace){const e=t.assetList[i];e&&this.advanceInPlace(e.timelineStart)}this.setSchedulePosition(e,i)}}setScheduleToAssetAtTime(t,e){const n=this.schedule;if(!n)return;const i=e.parentIdentifier,r=n.getEvent(i);if(r){const e=n.findEventIndex(i),s=n.findAssetIndex(r,t);this.advanceAfterAssetEnded(r,e,s-1)}}setSchedulePosition(t,e){var n;const i=null==(n=this.schedule)?void 0:n.items;if(!i||this.playbackDisabled)return;const r=t>=0?i[t]:null;this.log(`setSchedulePosition ${t}, ${e} (${r?Fa(r):r}) pos: ${this.timelinePos}`);const s=this.waitingItem||this.playingItem,a=this.playingLastItem;if(this.isInterstitial(s)){const n=s.event,h=this.playingAsset,c=null==h?void 0:h.identifier,d=c?this.getAssetPlayer(c):null;if(d&&c&&(!this.eventItemsMatch(s,r)||void 0!==e&&c!==n.assetList[e].identifier)){var o;const e=n.findAssetIndex(h);if(this.log(`INTERSTITIAL_ASSET_ENDED ${e+1}/${n.assetList.length} ${Ia(h)}`),this.endedAsset=h,this.playingAsset=null,this.hls.trigger(l.INTERSTITIAL_ASSET_ENDED,{asset:h,assetListIndex:e,event:n,schedule:i.slice(0),scheduleIndex:t,player:d}),s!==this.playingItem)return void(this.itemsMatch(s,this.playingItem)&&!this.playingAsset&&this.advanceAfterAssetEnded(n,this.findItemIndex(this.playingItem),e));this.retreiveMediaSource(c,r),!d.media||null!=(o=this.detachedData)&&o.mediaSource||d.detachMedia()}if(!this.eventItemsMatch(s,r)&&(this.endedItem=s,this.playingItem=null,this.log(`INTERSTITIAL_ENDED ${n} ${Fa(s)}`),n.hasPlayed=!0,this.hls.trigger(l.INTERSTITIAL_ENDED,{event:n,schedule:i.slice(0),scheduleIndex:t}),n.cue.once)){var u;this.updateSchedule();const t=null==(u=this.schedule)?void 0:u.items;if(r&&t){const n=this.findItemIndex(r);this.advanceSchedule(n,t,e,s,a)}return}}this.advanceSchedule(t,i,e,s,a)}advanceSchedule(t,e,n,i,r){const s=this.schedule;if(!s)return;const a=e[t]||null,o=this.primaryMedia,u=this.playerQueue;if(u.length&&u.forEach((e=>{const n=e.interstitial,i=s.findEventIndex(n.identifier);(i<t||i>t+1)&&this.clearInterstitial(n,a)})),this.isInterstitial(a)){this.timelinePos=Math.min(Math.max(this.timelinePos,a.start),a.end);const r=a.event;if(void 0===n){const e=La(r,(n=s.findAssetIndex(r,this.timelinePos))-1);if(r.isAssetPastPlayoutLimit(e)||r.appendInPlace&&this.timelinePos===a.end)return void this.advanceAfterAssetEnded(r,t,n);n=e}const u=this.waitingItem;this.assetsBuffered(a,o)||this.setBufferingItem(a);let h=this.preloadAssets(r,n);if(this.eventItemsMatch(a,u||i)||(this.waitingItem=a,this.log(`INTERSTITIAL_STARTED ${Fa(a)} ${r.appendInPlace?"append in place":""}`),this.hls.trigger(l.INTERSTITIAL_STARTED,{event:r,schedule:e.slice(0),scheduleIndex:t})),!r.assetListLoaded)return void this.log(`Waiting for ASSET-LIST to complete loading ${r}`);if(r.assetListLoader&&(r.assetListLoader.destroy(),r.assetListLoader=void 0),!o)return void this.log(`Waiting for attachMedia to start Interstitial ${r}`);this.waitingItem=this.endedItem=null,this.playingItem=a;const c=r.assetList[n];if(!c)return void this.advanceAfterAssetEnded(r,t,n||0);if(h||(h=this.getAssetPlayer(c.identifier)),null===h||h.destroyed){const t=r.assetList.length;this.warn(`asset ${n+1}/${t} player destroyed ${r}`),h=this.createAssetPlayer(r,c,n),h.loadSource()}if(!this.eventItemsMatch(a,this.bufferingItem)&&r.appendInPlace&&this.isAssetBuffered(c))return;this.startAssetPlayer(h,n,e,t,o),this.shouldPlay&&Na(h.media)}else a?(this.resumePrimary(a,t,i),this.shouldPlay&&Na(this.hls.media)):r&&this.isInterstitial(i)&&(this.endedItem=null,this.playingItem=i,i.event.appendInPlace||this.attachPrimary(s.durations.primary,null))}get playbackDisabled(){return!1===this.hls.config.enableInterstitialPlayback}get primaryDetails(){var t;return null==(t=this.mediaSelection)?void 0:t.main.details}get primaryLive(){var t;return!(null==(t=this.primaryDetails)||!t.live)}resumePrimary(t,e,n){var i,r;if(this.playingItem=t,this.playingAsset=this.endedAsset=null,this.waitingItem=this.endedItem=null,this.bufferedToItem(t),this.log(`resuming ${Fa(t)}`),null==(i=this.detachedData)||!i.mediaSource){let n=this.timelinePos;(n<t.start||n>=t.end)&&(n=this.getPrimaryResumption(t,e),this.log(Ba("resumePrimary",n)),this.timelinePos=n),this.attachPrimary(n,t)}if(!n)return;const s=null==(r=this.schedule)?void 0:r.items;s&&(this.log(`INTERSTITIALS_PRIMARY_RESUMED ${Fa(t)}`),this.hls.trigger(l.INTERSTITIALS_PRIMARY_RESUMED,{schedule:s.slice(0),scheduleIndex:e}),this.checkBuffer())}getPrimaryResumption(t,e){const n=t.start;if(this.primaryLive){const t=this.primaryDetails;if(0===e)return this.hls.startPosition;if(t&&(n<t.fragmentStart||n>t.edge))return this.hls.liveSyncPosition||-1}return n}isAssetBuffered(t){const e=this.getAssetPlayer(t.identifier);if(null!=e&&e.hls)return e.hls.bufferedToEnd;return en.bufferInfo(this.primaryMedia,this.timelinePos,0).end+1>=t.timelineStart+(t.duration||0)}attachPrimary(t,e,n){e?this.setBufferingItem(e):this.bufferingItem=this.playingItem,this.bufferingAsset=null;const i=this.primaryMedia;if(!i)return;const r=this.hls;r.media?this.checkBuffer():(this.transferMediaTo(r,i),n&&this.startLoadingPrimaryAt(t,n)),n||(this.log(Ba("attachPrimary",t)),this.timelinePos=t,this.startLoadingPrimaryAt(t,n))}startLoadingPrimaryAt(t,e){var n;const i=this.hls;!i.loadingEnabled||!i.media||Math.abs(((null==(n=i.mainForwardBufferInfo)?void 0:n.start)||i.media.currentTime)-t)>.5?i.startLoad(t,e):i.bufferingEnabled||i.resumeBuffering()}onManifestLoading(){var t;this.stopLoad(),null==(t=this.schedule)||t.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(l.BUFFER_CODECS,this.onBufferCodecs,this),this.hls.on(l.BUFFER_CODECS,this.onBufferCodecs,this)}onLevelUpdated(t,e){if(-1===e.level||!this.schedule)return;const n=this.hls.levels[e.level];if(!n.details)return;const i=E(E({},this.mediaSelection||this.altSelection),{},{main:n});this.mediaSelection=i,this.schedule.parseInterstitialDateRanges(i,this.hls.config.interstitialAppendInPlace),!this.effectivePlayingItem&&this.schedule.items&&this.checkStart()}onAudioTrackUpdated(t,e){const n=this.hls.audioTracks[e.id],i=this.mediaSelection;if(!i)return void(this.altSelection=E(E({},this.altSelection),{},{audio:n}));const r=E(E({},i),{},{audio:n});this.mediaSelection=r}onSubtitleTrackUpdated(t,e){const n=this.hls.subtitleTracks[e.id],i=this.mediaSelection;if(!i)return void(this.altSelection=E(E({},this.altSelection),{},{subtitles:n}));const r=E(E({},i),{},{subtitles:n});this.mediaSelection=r}onAudioTrackSwitching(t,e){const n=se(e);this.playerQueue.forEach((({hls:t})=>t&&(t.setAudioOption(e)||t.setAudioOption(n))))}onSubtitleTrackSwitch(t,e){const n=se(e);this.playerQueue.forEach((({hls:t})=>t&&(t.setSubtitleOption(e)||-1!==e.id&&t.setSubtitleOption(n))))}onBufferCodecs(t,e){const n=e.tracks;n&&(this.requiredTracks=n)}onBufferAppended(t,e){this.checkBuffer()}onBufferFlushed(t,e){const n=this.playingItem;if(n&&!this.itemsMatch(n,this.bufferingItem)&&!this.isInterstitial(n)){const t=this.timelinePos;this.bufferedPos=t,this.checkBuffer()}}onBufferedToEnd(t){if(!this.schedule)return;const e=this.schedule.events;if(this.bufferedPos<Number.MAX_VALUE&&e){for(let t=0;t<e.length;t++){const i=e[t];if(i.cue.post){var n;const t=this.schedule.findEventIndex(i.identifier),e=null==(n=this.schedule.items)?void 0:n[t];this.isInterstitial(e)&&this.eventItemsMatch(e,this.bufferingItem)&&this.bufferedToItem(e,0);break}}this.bufferedPos=Number.MAX_VALUE}}onMediaEnded(t){const e=this.playingItem;if(!this.playingLastItem&&e){const t=this.findItemIndex(e);this.setSchedulePosition(t+1)}else this.shouldPlay=!1}updateItem(t,e){var n;const i=null==(n=this.schedule)?void 0:n.items;if(t&&i){return i[this.findItemIndex(t,e)]||null}return null}trimInPlace(t,e){if(this.isInterstitial(t)&&t.event.appendInPlace&&e.end-t.end>.25){t.event.assetList.forEach(((e,n)=>{t.event.isAssetPastPlayoutLimit(n)&&this.clearAssetPlayer(e.identifier,null)}));const n=t.end+.25,i=en.bufferInfo(this.primaryMedia,n,0);if(i.end>n||(i.nextStart||0)>n){this.log(`trim buffered interstitial ${Fa(t)} (was ${Fa(e)})`);const i=!0;this.attachPrimary(n,null,i),this.flushFrontBuffer(n)}}}itemsMatch(t,e){return!!e&&(t===e||t.event&&e.event&&this.eventItemsMatch(t,e)||!t.event&&!e.event&&this.findItemIndex(t)===this.findItemIndex(e))}eventItemsMatch(t,e){var n;return!!e&&(t===e||t.event.identifier===(null==(n=e.event)?void 0:n.identifier))}findItemIndex(t,e){return t&&this.schedule?this.schedule.findItemIndex(t,e):-1}updateSchedule(t=!1){var e;const n=this.mediaSelection;n&&(null==(e=this.schedule)||e.updateSchedule(n,[],t))}checkBuffer(t){var e;const n=null==(e=this.schedule)?void 0:e.items;if(!n)return;const i=en.bufferInfo(this.primaryMedia,this.timelinePos,0);t&&(this.bufferedPos=this.timelinePos),t||(t=i.len<1),this.updateBufferedPos(i.end,n,t)}updateBufferedPos(t,e,n){const i=this.schedule,r=this.bufferingItem;if(this.bufferedPos>t||!i)return;if(1===e.length&&this.itemsMatch(e[0],r))return void(this.bufferedPos=t);const s=this.playingItem,a=this.findItemIndex(s);let o=i.findItemIndexAtTime(t);if(this.bufferedPos<t){var l;const n=this.findItemIndex(r),i=Math.min(n+1,e.length-1),s=e[i];if((-1===o&&r&&t>=r.end||null!=(l=s.event)&&l.appendInPlace&&t+.01>=s.start)&&(o=i),this.isInterstitial(r)){const t=r.event;if(i-a>1&&!1===t.appendInPlace)return;if(0===t.assetList.length&&t.assetListLoader)return}if(this.bufferedPos=t,o>n&&o>a)this.bufferedToItem(s);else{const e=this.primaryDetails;this.primaryLive&&e&&t>e.edge-e.targetduration&&s.start<e.edge+this.hls.config.interstitialLiveLookAhead&&this.isInterstitial(s)&&this.preloadAssets(s.event,0)}}else n&&s&&!this.itemsMatch(s,r)&&(o===a?this.bufferedToItem(s):o===a+1&&this.bufferedToItem(e[o]))}assetsBuffered(t,e){return 0!==t.event.assetList.length&&!t.event.assetList.some((t=>{const n=this.getAssetPlayer(t.identifier);return!(null!=n&&n.bufferedInPlaceToEnd(e))}))}setBufferingItem(t){const e=this.bufferingItem,n=this.schedule;if(!this.itemsMatch(t,e)&&n){const{items:i,events:r}=n;if(!i||!r)return e;const s=this.isInterstitial(t),a=this.getBufferingPlayer();this.bufferingItem=t,this.bufferedPos=Math.max(t.start,Math.min(t.end,this.timelinePos));const o=a?a.remaining:e?e.end-this.timelinePos:0;if(this.log(`INTERSTITIALS_BUFFERED_TO_BOUNDARY ${Fa(t)}`+(e?` (${o.toFixed(2)} remaining)`:"")),!this.playbackDisabled)if(s){const e=n.findAssetIndex(t.event,this.bufferedPos);t.event.assetList.forEach(((t,n)=>{const i=this.getAssetPlayer(t.identifier);i&&(n===e&&i.loadSource(),i.resumeBuffering())}))}else this.hls.resumeBuffering(),this.playerQueue.forEach((t=>t.pauseBuffering()));this.hls.trigger(l.INTERSTITIALS_BUFFERED_TO_BOUNDARY,{events:r.slice(0),schedule:i.slice(0),bufferingIndex:this.findItemIndex(t),playingIndex:this.findItemIndex(this.playingItem)})}else this.bufferingItem!==t&&(this.bufferingItem=t);return e}bufferedToItem(t,e=0){const n=this.setBufferingItem(t);if(!this.playbackDisabled)if(this.isInterstitial(t))this.bufferedToEvent(t,e);else if(null!==n){this.bufferingAsset=null;const e=this.detachedData;if(e)if(e.mediaSource){const e=!0;this.attachPrimary(t.start,t,e)}else this.preloadPrimary(t);else this.preloadPrimary(t)}}preloadPrimary(t){const e=this.findItemIndex(t),n=this.getPrimaryResumption(t,e);this.startLoadingPrimaryAt(n)}bufferedToEvent(t,e){const n=t.event,i=0===n.assetList.length&&!n.assetListLoader,r=n.cue.once;if(i||!r){const t=this.preloadAssets(n,e);if(null!=t&&t.interstitial.appendInPlace){const e=this.primaryMedia;e&&this.bufferAssetPlayer(t,e)}}}preloadAssets(t,e){const n=t.assetUrl,i=t.assetList.length,r=0===i&&!t.assetListLoader,s=t.cue.once;if(r){const r=t.timelineStart;if(t.appendInPlace){var a;const e=this.playingItem;this.isInterstitial(e)||(null==e||null==(a=e.nextEvent)?void 0:a.identifier)!==t.identifier||this.flushFrontBuffer(r+.25)}let s,o=0;if(!this.playingItem&&this.primaryLive&&(o=this.hls.startPosition,-1===o&&(o=this.hls.liveSyncPosition||0)),o&&!t.cue.pre&&!t.cue.post){const t=o-r;t>0&&(s=Math.round(1e3*t)/1e3)}if(this.log(`Load interstitial asset ${e+1}/${n?1:i} ${t}${s?` live-start: ${o} start-offset: ${s}`:""}`),n)return this.createAsset(t,0,0,r,t.duration,n);const l=this.assetListLoader.loadAssetList(t,s);l&&(t.assetListLoader=l)}else if(!s&&i){for(let n=e;n<i;n++){const e=t.assetList[n],i=this.getAssetPlayerQueueIndex(e.identifier);-1!==i&&!this.playerQueue[i].destroyed||e.error||this.createAssetPlayer(t,e,n)}const n=t.assetList[e];if(n){const t=this.getAssetPlayer(n.identifier);return t&&t.loadSource(),t}}return null}flushFrontBuffer(t){const e=this.requiredTracks;if(!e)return;this.log(`Removing front buffer starting at ${t}`);Object.keys(e).forEach((e=>{this.hls.trigger(l.BUFFER_FLUSHING,{startOffset:t,endOffset:1/0,type:e})}))}getAssetPlayerQueueIndex(t){const e=this.playerQueue;for(let n=0;n<e.length;n++)if(t===e[n].assetId)return n;return-1}getAssetPlayer(t){const e=this.getAssetPlayerQueueIndex(t);return this.playerQueue[e]||null}getBufferingPlayer(){const{playerQueue:t,primaryMedia:e}=this;if(e)for(let n=0;n<t.length;n++)if(t[n].media===e)return t[n];return null}createAsset(t,e,n,i,r,s){const a={parentIdentifier:t.identifier,identifier:Da(t,s,e),duration:r,startOffset:n,timelineStart:i,uri:s};return this.createAssetPlayer(t,a,e)}createAssetPlayer(t,e,n){const i=this.hls,r=i.userConfig;let s=r.videoPreference;const u=i.loadLevelObj||i.levels[i.currentLevel];(s||u)&&(s=y({},s),u.videoCodec&&(s.videoCodec=u.videoCodec),u.videoRange&&(s.allowedVideoRanges=[u.videoRange]));const h=i.audioTracks[i.audioTrack],c=i.subtitleTracks[i.subtitleTrack];let d=0;if(this.primaryLive||t.appendInPlace){const t=this.timelinePos-e.timelineStart;if(t>1){const n=e.duration;n&&t<n&&(d=t)}}const f=e.identifier,p=E(E({},r),{},{maxMaxBufferLength:Math.min(180,i.config.maxMaxBufferLength),autoStartLoad:!0,startFragPrefetch:!0,primarySessionId:i.sessionId,assetPlayerId:f,abrEwmaDefaultEstimate:i.bandwidthEstimate,interstitialsController:void 0,startPosition:d,liveDurationInfinity:!1,testBandwidth:!1,videoPreference:s,audioPreference:h||r.audioPreference,subtitlePreference:c||r.subtitlePreference});t.appendInPlace&&(t.appendInPlaceStarted=!0,e.timelineStart&&(p.timelineOffset=e.timelineStart));const g=p.cmcd;null!=g&&g.sessionId&&g.contentId&&(p.cmcd=y({},g,{contentId:ka(e.uri)})),this.getAssetPlayer(f)&&this.warn(`Duplicate date range identifier ${t} and asset ${f}`);const _=new Pa(this.HlsPlayerClass,p,t,e);this.playerQueue.push(_),t.assetList[n]=e;let m=!0;const v=i=>{if(i.live){var r;const e=new Error(`Interstitials MUST be VOD assets ${t}`),i={fatal:!0,type:a.OTHER_ERROR,details:o.INTERSTITIAL_ASSET_ITEM_ERROR,error:e},s=(null==(r=this.schedule)?void 0:r.findEventIndex(t.identifier))||-1;return void this.handleAssetItemError(i,t,s,n,e.message)}const s=i.edge-i.fragmentStart,l=e.duration;(m||null===l||s>l)&&(m=!1,this.log(`Interstitial asset "${f}" duration change ${l} > ${s}`),e.duration=s,this.updateSchedule())};_.on(l.LEVEL_UPDATED,((t,{details:e})=>v(e))),_.on(l.LEVEL_PTS_UPDATED,((t,{details:e})=>v(e))),_.on(l.EVENT_CUE_ENTER,(()=>this.onInterstitialCueEnter()));const b=(t,e)=>{const n=this.getAssetPlayer(f);if(n&&e.tracks){n.off(l.BUFFER_CODECS,b),n.tracks=e.tracks;const t=this.primaryMedia;this.bufferingAsset===n.assetItem&&t&&!n.media&&this.bufferAssetPlayer(n,t)}};_.on(l.BUFFER_CODECS,b);_.on(l.BUFFERED_TO_END,(()=>{var n;const i=this.getAssetPlayer(f);if(this.log(`buffered to end of asset ${i}`),!i||!this.schedule)return;const r=this.schedule.findEventIndex(t.identifier),s=null==(n=this.schedule.items)?void 0:n[r];this.isInterstitial(s)&&this.advanceAssetBuffering(s,e)}));const w=e=>()=>{if(!this.getAssetPlayer(f)||!this.schedule)return;this.shouldPlay=!0;const n=this.schedule.findEventIndex(t.identifier);this.advanceAfterAssetEnded(t,n,e)};return _.once(l.MEDIA_ENDED,w(n)),_.once(l.PLAYOUT_LIMIT_REACHED,w(1/0)),_.on(l.ERROR,((e,i)=>{if(!this.schedule)return;const r=this.getAssetPlayer(f);if(i.details===o.BUFFER_STALLED_ERROR)return null!=r&&r.appendInPlace?void this.handleInPlaceStall(t):(this.onTimeupdate(),void this.checkBuffer(!0));this.handleAssetItemError(i,t,this.schedule.findEventIndex(t.identifier),n,`Asset player error ${i.error} ${t}`)})),_.on(l.DESTROYING,(()=>{if(!this.getAssetPlayer(f)||!this.schedule)return;const e=new Error(`Asset player destroyed unexpectedly ${f}`),i={fatal:!0,type:a.OTHER_ERROR,details:o.INTERSTITIAL_ASSET_ITEM_ERROR,error:e};this.handleAssetItemError(i,t,this.schedule.findEventIndex(t.identifier),n,e.message)})),this.log(`INTERSTITIAL_ASSET_PLAYER_CREATED ${Ia(e)}`),this.hls.trigger(l.INTERSTITIAL_ASSET_PLAYER_CREATED,{asset:e,assetListIndex:n,event:t,player:_}),_}clearInterstitial(t,e){t.assetList.forEach((t=>{this.clearAssetPlayer(t.identifier,e)})),t.reset()}resetAssetPlayer(t){const e=this.getAssetPlayerQueueIndex(t);if(-1!==e){this.log(`reset asset player "${t}" after error`);const n=this.playerQueue[e];this.transferMediaFromPlayer(n,null),n.resetDetails()}}clearAssetPlayer(t,e){const n=this.getAssetPlayerQueueIndex(t);if(-1!==n){const t=this.playerQueue[n];this.log(`clear ${t} toSegment: ${e?Fa(e):e}`),this.transferMediaFromPlayer(t,e),this.playerQueue.splice(n,1),t.destroy()}}emptyPlayerQueue(){let t;for(;t=this.playerQueue.pop();)t.destroy();this.playerQueue=[]}startAssetPlayer(t,e,n,i,r){const{interstitial:s,assetItem:a,assetId:o}=t,u=s.assetList.length,h=this.playingAsset;this.endedAsset=null,this.playingAsset=a,h&&h.identifier===o||(h&&(this.clearAssetPlayer(h.identifier,n[i]),delete h.error),this.log(`INTERSTITIAL_ASSET_STARTED ${e+1}/${u} ${Ia(a)}`),this.hls.trigger(l.INTERSTITIAL_ASSET_STARTED,{asset:a,assetListIndex:e,event:s,schedule:n.slice(0),scheduleIndex:i,player:t})),this.bufferAssetPlayer(t,r)}bufferAssetPlayer(t,e){var n,i;if(!this.schedule)return;const{interstitial:r,assetItem:s}=t,l=this.schedule.findEventIndex(r.identifier),u=null==(n=this.schedule.items)?void 0:n[l];if(!u)return;t.loadSource(),this.setBufferingItem(u),this.bufferingAsset=s;const h=this.getBufferingPlayer();if(h===t)return;const c=r.appendInPlace;if(c&&!1===(null==h?void 0:h.interstitial.appendInPlace))return;const d=(null==h?void 0:h.tracks)||(null==(i=this.detachedData)?void 0:i.tracks)||this.requiredTracks;if(c&&s!==this.playingAsset){if(!t.tracks)return void this.log(`Waiting for track info before buffering ${t}`);if(d&&!R(d,t.tracks)){const e=new Error(`Asset ${Ia(s)} SourceBuffer tracks ('${Object.keys(t.tracks)}') are not compatible with primary content tracks ('${Object.keys(d)}')`),n={fatal:!0,type:a.OTHER_ERROR,details:o.INTERSTITIAL_ASSET_ITEM_ERROR,error:e},i=r.findAssetIndex(s);return void this.handleAssetItemError(n,r,l,i,e.message)}}this.transferMediaTo(t,e)}handleInPlaceStall(t){const e=this.schedule,n=this.primaryMedia;if(!e||!n)return;const i=n.currentTime,r=e.findAssetIndex(t,i),s=t.assetList[r];if(s){const a=this.getAssetPlayer(s.identifier);if(a){const o=a.currentTime||i-s.timelineStart,l=a.duration-o;if(this.warn(`Stalled at ${o} of ${o+l} in ${a} ${t} (media.currentTime: ${i})`),o&&(l/n.playbackRate<.5||a.bufferedInPlaceToEnd(n))&&a.hls){const n=e.findEventIndex(t.identifier);this.advanceAfterAssetEnded(t,n,r)}}}}advanceInPlace(t){const e=this.primaryMedia;e&&e.currentTime<t&&(e.currentTime=t)}handleAssetItemError(t,e,n,i,r){if(t.details===o.BUFFER_STALLED_ERROR)return;const s=e.assetList[i]||null;if(this.warn(`INTERSTITIAL_ASSET_ERROR ${s?Ia(s):s} ${t.error}`),!this.schedule)return;const a=(null==s?void 0:s.identifier)||"",u=this.getAssetPlayerQueueIndex(a),h=this.playerQueue[u]||null,c=this.schedule.items,d=y({},t,{fatal:!1,errorAction:Ie(!0),asset:s,assetListIndex:i,event:e,schedule:c,scheduleIndex:n,player:h});if(this.hls.trigger(l.INTERSTITIAL_ASSET_ERROR,d),!t.fatal)return;const f=this.playingAsset,p=this.bufferingAsset,g=new Error(r);if(s&&(this.clearAssetPlayer(a,null),s.error=g),e.assetList.some((t=>!t.error)))for(let t=i;t<e.assetList.length;t++)this.resetAssetPlayer(e.assetList[t].identifier);else e.error=g;this.updateSchedule(!0),e.error?this.primaryFallback(e):f&&f.identifier===a?this.advanceAfterAssetEnded(e,n,i):p&&p.identifier===a&&this.isInterstitial(this.bufferingItem)&&this.advanceAssetBuffering(this.bufferingItem,p)}primaryFallback(t){const e=t.timelineStart,n=this.effectivePlayingItem;if(n){this.log(`Fallback to primary from event "${t.identifier}" start: ${e} pos: ${this.timelinePos} playing: ${Fa(n)} error: ${t.error}`);let i=this.timelinePos;-1===i&&(i=this.hls.startPosition);const r=this.updateItem(n,i);if(this.itemsMatch(n,r)&&this.clearInterstitial(t,null),t.appendInPlace&&(this.attachPrimary(e,null),this.flushFrontBuffer(e)),!this.schedule)return;const s=this.schedule.findItemIndexAtTime(i);this.setSchedulePosition(s)}else this.checkStart()}onAssetListLoaded(t,e){var n,i;const r=e.event,s=r.identifier,a=e.assetListResponse.ASSETS;if(null==(n=this.schedule)||!n.hasEvent(s))return;const o=r.timelineStart,l=r.duration;let u=0;a.forEach(((t,e)=>{const n=parseFloat(t.DURATION);this.createAsset(r,e,u,o+u,n,t.URI),u+=n})),r.duration=u,this.log(`Loaded asset-list with duration: ${u} (was: ${l}) ${r}`);const h=this.waitingItem,c=(null==h?void 0:h.event.identifier)===s;this.updateSchedule();const d=null==(i=this.bufferingItem)?void 0:i.event;if(c){var f;const t=this.schedule.findEventIndex(s),e=null==(f=this.schedule.items)?void 0:f[t];if(e){if(!this.playingItem&&this.timelinePos>e.end){if(this.schedule.findItemIndexAtTime(this.timelinePos)!==t)return r.error=new Error(`Interstitial no longer within playback range ${this.timelinePos} ${r}`),this.updateSchedule(!0),void this.primaryFallback(r)}this.setBufferingItem(e)}this.setSchedulePosition(t)}else if((null==d?void 0:d.identifier)===s){const t=r.assetList[0];if(t){const e=this.getAssetPlayer(t.identifier);if(d.appendInPlace){const t=this.primaryMedia;e&&t&&this.bufferAssetPlayer(e,t)}else e&&e.loadSource()}}}onError(t,e){if(this.schedule)switch(e.details){case o.ASSET_LIST_PARSING_ERROR:case o.ASSET_LIST_LOAD_ERROR:case o.ASSET_LIST_LOAD_TIMEOUT:{const t=e.interstitial;t&&(this.updateSchedule(!0),this.primaryFallback(t));break}case o.BUFFER_STALLED_ERROR:{const t=this.endedItem||this.waitingItem||this.playingItem;if(this.isInterstitial(t)&&t.event.appendInPlace)return void this.handleInPlaceStall(t.event);this.log(`Primary player stall @${this.timelinePos} bufferedPos: ${this.bufferedPos}`),this.onTimeupdate(),this.checkBuffer(!0);break}}}}});function jo(t){return t&&"object"==typeof t?Array.isArray(t)?t.map(jo):Object.keys(t).reduce(((e,n)=>(e[n]=jo(t[n]),e)),{}):t}function Vo(t,e){const n=t.loader;if(n!==No&&n!==Go)e.log("[config]: Custom loader detected, cannot enable progressive streaming"),t.progressive=!1;else{(function(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(t){}return!1})()&&(t.loader=No,t.progressive=!0,t.enableSoftwareAES=!0,e.log("[config]: Progressive streaming enabled, using FetchLoader"))}}class Zo extends Xe{constructor(t,e){super("gap-controller",t.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 t;null!=(t=this.media)&&t.seeking||(this.waiting=self.performance.now(),this.tick())},this.onMediaEnded=()=>{var t;this.hls&&(this.ended=(null==(t=this.media)?void 0:t.currentTime)||1,this.hls.trigger(l.MEDIA_ENDED,{stalled:!1}))},this.hls=t,this.fragmentTracker=e,this.registerListeners()}registerListeners(){const{hls:t}=this;t&&(t.on(l.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(l.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(l.BUFFER_APPENDED,this.onBufferAppended,this))}unregisterListeners(){const{hls:t}=this;t&&(t.off(l.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(l.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(l.BUFFER_APPENDED,this.onBufferAppended,this))}destroy(){super.destroy(),this.unregisterListeners(),this.media=this.hls=this.fragmentTracker=null,this.mediaSource=void 0}onMediaAttached(t,e){this.setInterval(100),this.mediaSource=e.mediaSource;const n=this.media=e.media;_i(n,"playing",this.onMediaPlaying),_i(n,"waiting",this.onMediaWaiting),_i(n,"ended",this.onMediaEnded)}onMediaDetaching(t,e){this.clearInterval();const{media:n}=this;n&&(mi(n,"playing",this.onMediaPlaying),mi(n,"waiting",this.onMediaWaiting),mi(n,"ended",this.onMediaEnded),this.media=null),this.mediaSource=void 0}onBufferAppended(t,e){this.buffered=e.timeRanges}get hasBuffered(){return Object.keys(this.buffered).length>0}tick(){var t;if(null==(t=this.media)||!t.readyState||!this.hasBuffered)return;const e=this.media.currentTime;this.poll(e,this.lastCurrentTime),this.lastCurrentTime=e}poll(t,e){var n,i;const r=null==(n=this.hls)?void 0:n.config;if(!r)return;const s=this.media;if(!s)return;const{seeking:a}=s,o=this.seeking&&!a,u=!this.seeking&&a,h=s.paused&&!a||s.ended||0===s.playbackRate;if(this.seeking=a,t!==e)return e&&(this.ended=0),this.moved=!0,a||(this.nudgeRetry=0,r.nudgeOnVideoHole&&!h&&t>e&&this.nudgeOnVideoHole(t,e)),void(0===this.waiting&&this.stallResolved(t));if(u||o)return void(o&&this.stallResolved(t));if(h)return this.nudgeRetry=0,this.stallResolved(t),void(!this.ended&&s.ended&&this.hls&&(this.ended=t||1,this.hls.trigger(l.MEDIA_ENDED,{stalled:!1})));if(!en.getBuffered(s).length)return void(this.nudgeRetry=0);const c=en.bufferInfo(s,t,0),d=c.nextStart||0,f=this.fragmentTracker;if(a&&f&&this.hls){const e=zo(this.hls.inFlightFragments,t),n=c.len>2,i=!d||e||d-t>2&&!f.getPartialFragment(t);if(n||i)return;this.moved=!1}const p=null==(i=this.hls)?void 0:i.latestLevelDetails;if(!this.moved&&null!==this.stalled&&f){if(!(c.len>0)&&!d)return;const e=Math.max(d,c.start||0)-t,n=!(null==p||!p.live)?2*p.targetduration:2,i=Wo(t,f);if(e>0&&(e<=n||i))return void(s.paused||this._trySkipBufferHole(i))}const g=r.detectStallWithCurrentTimeMs,_=self.performance.now(),m=this.waiting;let v=this.stalled;if(null===v){if(!(m>0&&_-m<g))return void(this.stalled=_);v=this.stalled=m}const y=_-v;if(!a&&(y>=g||m)&&this.hls){var b;if("ended"===(null==(b=this.mediaSource)?void 0:b.readyState)&&(null==p||!p.live)&&Math.abs(t-((null==p?void 0:p.edge)||0))<1){if(this.ended)return;return this.ended=t||1,void this.hls.trigger(l.MEDIA_ENDED,{stalled:!0})}if(this._reportStall(c),!this.media||!this.hls)return}const E=en.bufferInfo(s,t,r.maxBufferHole);this._tryFixBufferStall(E,y,t)}stallResolved(t){const e=this.stalled;if(e&&this.hls&&(this.stalled=null,this.stallReported)){const n=self.performance.now()-e;this.log(`playback not stuck anymore @${t}, after ${Math.round(n)}ms`),this.stallReported=!1,this.waiting=0,this.hls.trigger(l.STALL_RESOLVED,{})}}nudgeOnVideoHole(t,e){var n;const i=this.buffered.video;if(this.hls&&this.media&&this.fragmentTracker&&null!=(n=this.buffered.audio)&&n.length&&i&&i.length>1&&t>i.end(0)){const n=en.bufferedInfo(en.timeRangesToArray(this.buffered.audio),t,0);if(n.len>1&&e>=n.start){const n=en.timeRangesToArray(i),r=en.bufferedInfo(n,e,0).bufferedIndex;if(r>-1&&r<n.length-1){const e=en.bufferedInfo(n,t,0).bufferedIndex,i=n[r].end,s=n[r+1].start;if((-1===e||e>r)&&s-i<1&&t-i<2){const n=new Error(`nudging playhead to flush pipeline after video hole. currentTime: ${t} hole: ${i} -> ${s} buffered index: ${e}`);this.warn(n.message),this.media.currentTime+=1e-6;let r=Wo(t,this.fragmentTracker);r&&"fragment"in r?r=r.fragment:r||(r=void 0);const u=en.bufferInfo(this.media,t,0);this.hls.trigger(l.ERROR,{type:a.MEDIA_ERROR,details:o.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:n,reason:n.message,frag:r,buffer:u.len,bufferInfo:u})}}}}}_tryFixBufferStall(t,e,n){var i,r;const{fragmentTracker:s,media:a}=this,o=null==(i=this.hls)?void 0:i.config;if(!a||!s||!o)return;const l=null==(r=this.hls)?void 0:r.latestLevelDetails,u=Wo(n,s);if(u||null!=l&&l.live&&n<l.fragmentStart){if(this._trySkipBufferHole(u)||!this.media)return}const h=t.buffered,c=this.adjacentTraversal(t,n);(h&&h.length>1&&t.len>o.maxBufferHole||t.nextStart&&(t.nextStart-n<o.maxBufferHole||c))&&(e>1e3*o.highBufferWatchdogPeriod||this.waiting)&&(this.warn("Trying to nudge playhead over buffer-hole"),this._tryNudgeBuffer(t))}adjacentTraversal(t,e){const n=this.fragmentTracker,i=t.nextStart;if(n&&i){const t=n.getFragAtPos(e,f),r=n.getFragAtPos(i,f);if(t&&r)return r.sn-t.sn<2}return!1}_reportStall(t){const{hls:e,media:n,stallReported:i,stalled:r}=this;if(!i&&null!==r&&n&&e){this.stallReported=!0;const i=new Error(`Playback stalling at @${n.currentTime} due to low buffer (${ne(t)})`);this.warn(i.message),e.trigger(l.ERROR,{type:a.MEDIA_ERROR,details:o.BUFFER_STALLED_ERROR,fatal:!1,error:i,buffer:t.len,bufferInfo:t,stalled:{start:r}})}}_trySkipBufferHole(t){var e;const{fragmentTracker:n,media:i}=this,r=null==(e=this.hls)?void 0:e.config;if(!i||!n||!r)return 0;const s=i.currentTime,u=en.bufferInfo(i,s,0),h=s<u.start?u.start:u.nextStart;if(h&&this.hls){const e=u.len<=r.maxBufferHole,d=u.len>0&&u.len<1&&i.readyState<3,p=h-s;if(p>0&&(e||d)){if(p>r.maxBufferHole){let e=!1;if(0===s){const t=n.getAppendedFrag(0,f);t&&h<t.end&&(e=!0)}if(!e&&t){var c;if(null==(c=this.hls.loadLevelObj)||!c.details)return 0;if(zo(this.hls.inFlightFragments,h))return 0;let e=!1,i=t.end;for(;i<h;){const t=Wo(i,n);if(!t){e=!0;break}i+=t.duration}if(e)return 0}}const e=Math.max(h+.05,s+.1);if(this.warn(`skipping hole, adjusting currentTime from ${s} to ${e}`),this.moved=!0,i.currentTime=e,null==t||!t.gap){const n=new Error(`fragment loaded with buffer holes, seeking from ${s} to ${e}`),i={type:a.MEDIA_ERROR,details:o.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:n,reason:n.message,buffer:u.len,bufferInfo:u};t&&("fragment"in t?i.part=t:i.frag=t),this.hls.trigger(l.ERROR,i)}return e}}return 0}_tryNudgeBuffer(t){const{hls:e,media:n,nudgeRetry:i}=this,r=null==e?void 0:e.config;if(!n||!r)return 0;const s=n.currentTime;if(this.nudgeRetry++,i<r.nudgeMaxRetry){const u=s+(i+1)*r.nudgeOffset,h=new Error(`Nudging 'currentTime' from ${s} to ${u}`);this.warn(h.message),n.currentTime=u,e.trigger(l.ERROR,{type:a.MEDIA_ERROR,details:o.BUFFER_NUDGE_ON_STALL,error:h,fatal:!1,buffer:t.len,bufferInfo:t})}else{const n=new Error(`Playhead still not moving while enough data buffered @${s} after ${r.nudgeMaxRetry} nudges`);this.error(n.message),e.trigger(l.ERROR,{type:a.MEDIA_ERROR,details:o.BUFFER_STALLED_ERROR,error:n,fatal:!0,buffer:t.len,bufferInfo:t})}}}function zo(t,e){const n=Ho(t.main);if(n&&n.start<=e)return n;const i=Ho(t.audio);return i&&i.start<=e?i:null}function Ho(t){if(!t)return null;switch(t.state){case bi:case yi:case Di:case Ci:return null}return t.frag}function Wo(t,e){return e.getAppendedFrag(t,f)||e.getPartialFragment(t)}function Yo(){if("undefined"!=typeof self)return self.VTTCue||self.TextTrackCue}function qo(t,e,n,i,r){let s=new t(e,n,"");try{s.value=i,r&&(s.type=r)}catch(a){s=new t(e,n,ne(r?E({type:r},i):i))}return s}const Qo=(()=>{const t=Yo();try{t&&new t(0,Number.POSITIVE_INFINITY,"")}catch(t){return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();class Xo{constructor(t){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(l.EVENT_CUE_ENTER,{})},this.hls=t,this._registerListeners()}destroy(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=this.onEventCueEnter=null}_registerListeners(){const{hls:t}=this;t&&(t.on(l.MEDIA_ATTACHING,this.onMediaAttaching,this),t.on(l.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(l.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(l.MANIFEST_LOADING,this.onManifestLoading,this),t.on(l.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),t.on(l.BUFFER_FLUSHING,this.onBufferFlushing,this),t.on(l.LEVEL_UPDATED,this.onLevelUpdated,this),t.on(l.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}_unregisterListeners(){const{hls:t}=this;t&&(t.off(l.MEDIA_ATTACHING,this.onMediaAttaching,this),t.off(l.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(l.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(l.MANIFEST_LOADING,this.onManifestLoading,this),t.off(l.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),t.off(l.BUFFER_FLUSHING,this.onBufferFlushing,this),t.off(l.LEVEL_UPDATED,this.onLevelUpdated,this),t.off(l.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}onMediaAttaching(t,e){var n;this.media=e.media,!1===(null==(n=e.overrides)?void 0:n.cueRemoval)&&(this.removeCues=!1)}onMediaAttached(){var t;const e=null==(t=this.hls)?void 0:t.latestLevelDetails;e&&this.updateDateRangeCues(e)}onMediaDetaching(t,e){this.media=null;!!e.transferMedia||(this.id3Track&&(this.removeCues&&Ea(this.id3Track,this.onEventCueEnter),this.id3Track=null),this.dateRangeCuesAppended={})}onManifestLoading(){this.dateRangeCuesAppended={}}createTrack(t){const e=this.getID3Track(t.textTracks);return e.mode="hidden",e}getID3Track(t){if(this.media){for(let e=0;e<t.length;e++){const n=t[e];if("metadata"===n.kind&&"id3"===n.label)return ya(n,this.media),n}return this.media.addTextTrack("metadata","id3")}}onFragParsingMetadata(t,e){if(!this.media||!this.hls)return;const{enableEmsgMetadataCues:n,enableID3MetadataCues:i}=this.hls.config;if(!n&&!i)return;const{samples:r}=e;this.id3Track||(this.id3Track=this.createTrack(this.media));const s=Yo();if(s)for(let t=0;t<r.length;t++){const e=r[t].type;if(e===or.emsg&&!n||!i)continue;const a=ir(r[t].data),o=r[t].pts;let l=o+r[t].duration;l>Qo&&(l=Qo);l-o<=0&&(l=o+.25);for(let t=0;t<a.length;t++){const n=a[t];if(!rr(n)){this.updateId3CueEnds(o,e);const t=qo(s,o,l,n,e);t&&this.id3Track.addCue(t)}}}}updateId3CueEnds(t,e){var n;const i=null==(n=this.id3Track)?void 0:n.cues;if(i)for(let n=i.length;n--;){const r=i[n];r.type===e&&r.startTime<t&&r.endTime===Qo&&(r.endTime=t)}}onBufferFlushing(t,{startOffset:e,endOffset:n,type:i}){const{id3Track:r,hls:s}=this;if(!s)return;const{config:{enableEmsgMetadataCues:a,enableID3MetadataCues:o}}=s;if(r&&(a||o)){let t;t="audio"===i?t=>t.type===or.audioId3&&o:"video"===i?t=>t.type===or.emsg&&a:t=>t.type===or.audioId3&&o||t.type===or.emsg&&a,wa(r,e,n,t)}}onLevelUpdated(t,{details:e}){this.updateDateRangeCues(e,!0)}onLevelPtsUpdated(t,e){Math.abs(e.drift)>.01&&this.updateDateRangeCues(e.details)}updateDateRangeCues(t,e){if(!this.hls||!this.media)return;const{assetPlayerId:n,timelineOffset:r,enableDateRangeMetadataCues:s,interstitialsController:a}=this.hls.config;if(!s)return;const o=Yo();if(n&&r&&!a){const{fragmentStart:e,fragmentEnd:i}=t;let r=this.assetCue;r?(r.startTime=e,r.endTime=i):o&&(r=this.assetCue=qo(o,e,i,{assetPlayerId:this.hls.config.assetPlayerId},"hlsjs.interstitial.asset"),r&&(r.id=n,this.id3Track||(this.id3Track=this.createTrack(this.media)),this.id3Track.addCue(r),r.addEventListener("enter",this.onEventCueEnter)))}if(!t.hasProgramDateTime)return;const{id3Track:l}=this,{dateRanges:u}=t,h=Object.keys(u);let c=this.dateRangeCuesAppended;var d;if(l&&e)if(null!=(d=l.cues)&&d.length){const t=Object.keys(c).filter((t=>!h.includes(t)));for(let e=t.length;e--;){var f;const n=t[e],i=null==(f=c[n])?void 0:f.cues;delete c[n],i&&Object.keys(i).forEach((t=>{const e=i[t];if(e){e.removeEventListener("enter",this.onEventCueEnter);try{l.removeCue(e)}catch(t){}}}))}}else c=this.dateRangeCuesAppended={};const p=t.fragments[t.fragments.length-1];if(0!==h.length&&i(null==p?void 0:p.programDateTime)){this.id3Track||(this.id3Track=this.createTrack(this.media));for(let t=0;t<h.length;t++){const e=h[t],n=u[e],i=n.startTime,r=c[e],s=(null==r?void 0:r.cues)||{};let l=(null==r?void 0:r.durationKnown)||!1,d=Qo;const{duration:f,endDate:p}=n;if(p&&null!==f)d=i+f,l=!0;else if(n.endOnNext&&!l){const t=h.reduce(((t,e)=>{if(e!==n.id){const i=u[e];if(i.class===n.class&&i.startDate>n.startDate&&(!t||n.startDate<t.startDate))return i}return t}),null);t&&(d=t.startTime,l=!0)}const _=Object.keys(n.attr);for(let t=0;t<_.length;t++){const u=_[t];if("ID"===(g=u)||"CLASS"===g||"CUE"===g||"START-DATE"===g||"DURATION"===g||"END-DATE"===g||"END-ON-NEXT"===g)continue;const h=s[u];if(h)!l||null!=r&&r.durationKnown?Math.abs(h.startTime-i)>.01&&(h.startTime=i,h.endTime=d):h.endTime=d;else if(o){let t=n.attr[u];cn(u)&&(t=P(t));const r=qo(o,i,d,{key:u,data:t},or.dateRange);r&&(r.id=e,this.id3Track.addCue(r),s[u]=r,a&&("X-ASSET-LIST"!==u&&"X-ASSET-URL"!==u||r.addEventListener("enter",this.onEventCueEnter)))}}c[e]={cues:s,dateRange:n,durationKnown:l}}var g}}}class Jo{constructor(t){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,e=this.levelDetails;if(!t||!e)return;this.currentTime=t.currentTime;const n=this.computeLatency();if(null===n)return;this._latency=n;const{lowLatencyMode:i,maxLiveSyncPlaybackRate:r}=this.config;if(!i||1===r||!e.live)return;const s=this.targetLatency;if(null===s)return;const a=n-s;if(a<Math.min(this.maxLatency,s+e.targetduration)&&a>.05&&this.forwardBufferLength>1){const e=Math.min(2,Math.max(1,r)),n=Math.round(2/(1+Math.exp(-.75*a-this.edgeStalled))*20)/20,i=Math.min(e,Math.max(1,n));this.changeMediaPlaybackRate(t,i)}else 1!==t.playbackRate&&0!==t.playbackRate&&this.changeMediaPlaybackRate(t,1)},this.hls=t,this.config=t.config,this.registerListeners()}get levelDetails(){var t;return(null==(t=this.hls)?void 0:t.latestLevelDetails)||null}get latency(){return this._latency||0}get maxLatency(){const{config:t}=this;if(void 0!==t.liveMaxLatencyDuration)return t.liveMaxLatencyDuration;const e=this.levelDetails;return e?t.liveMaxLatencyDurationCount*e.targetduration:0}get targetLatency(){const t=this.levelDetails;if(null===t||null===this.hls)return null;const{holdBack:e,partHoldBack:n,targetduration:i}=t,{liveSyncDuration:r,liveSyncDurationCount:s,lowLatencyMode:a}=this.config,o=this.hls.userConfig;let l=a&&n||e;(this._targetLatencyUpdated||o.liveSyncDuration||o.liveSyncDurationCount||0===l)&&(l=void 0!==r?r:s*i);const u=i;return l+Math.min(this.stallCount*this.config.liveSyncOnStallIncrease,u)}set targetLatency(t){this.stallCount=0,this.config.liveSyncDuration=t,this._targetLatencyUpdated=!0}get liveSyncPosition(){const t=this.estimateLiveEdge(),e=this.targetLatency;if(null===t||null===e)return null;const n=this.levelDetails;if(null===n)return null;const i=n.edge,r=t-e-this.edgeStalled,s=i-n.totalduration,a=i-(this.config.lowLatencyMode&&n.partTarget||n.targetduration);return Math.min(Math.max(s,r),a)}get drift(){const t=this.levelDetails;return null===t?1:t.drift}get edgeStalled(){const t=this.levelDetails;if(null===t)return 0;const e=3*(this.config.lowLatencyMode&&t.partTarget||t.targetduration);return Math.max(t.age-e,0)}get forwardBufferLength(){const{media:t}=this,e=this.levelDetails;if(!t||!e)return 0;const n=t.buffered.length;return(n?t.buffered.end(n-1):e.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.hls=null}registerListeners(){const{hls:t}=this;t&&(t.on(l.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(l.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(l.MANIFEST_LOADING,this.onManifestLoading,this),t.on(l.LEVEL_UPDATED,this.onLevelUpdated,this),t.on(l.ERROR,this.onError,this))}unregisterListeners(){const{hls:t}=this;t&&(t.off(l.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(l.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(l.MANIFEST_LOADING,this.onManifestLoading,this),t.off(l.LEVEL_UPDATED,this.onLevelUpdated,this),t.off(l.ERROR,this.onError,this))}onMediaAttached(t,e){this.media=e.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(t,{details:e}){e.advanced&&this.onTimeupdate(),!e.live&&this.media&&this.media.removeEventListener("timeupdate",this.onTimeupdate)}onError(t,e){var n;e.details===o.BUFFER_STALLED_ERROR&&(this.stallCount++,this.hls&&null!=(n=this.levelDetails)&&n.live&&this.hls.logger.warn("[latency-controller]: Stall detected, adjusting target latency"))}changeMediaPlaybackRate(t,e){var n,i;t.playbackRate!==e&&(null==(n=this.hls)||n.logger.debug(`[latency-controller]: latency=${this.latency.toFixed(3)}, targetLatency=${null==(i=this.targetLatency)?void 0:i.toFixed(3)}, forwardBufferLength=${this.forwardBufferLength.toFixed(3)}: adjusting playback rate from ${t.playbackRate} to ${e}`),t.playbackRate=e)}estimateLiveEdge(){const t=this.levelDetails;return null===t?null:t.edge+t.age}computeLatency(){const t=this.estimateLiveEdge();return null===t?null:t-this.currentTime}}class tl extends ls{constructor(t,e){super(t,"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=e,this._registerListeners()}_registerListeners(){const{hls:t}=this;t.on(l.MANIFEST_LOADING,this.onManifestLoading,this),t.on(l.MANIFEST_LOADED,this.onManifestLoaded,this),t.on(l.LEVEL_LOADED,this.onLevelLoaded,this),t.on(l.LEVELS_UPDATED,this.onLevelsUpdated,this),t.on(l.FRAG_BUFFERED,this.onFragBuffered,this),t.on(l.ERROR,this.onError,this)}_unregisterListeners(){const{hls:t}=this;t.off(l.MANIFEST_LOADING,this.onManifestLoading,this),t.off(l.MANIFEST_LOADED,this.onManifestLoaded,this),t.off(l.LEVEL_LOADED,this.onLevelLoaded,this),t.off(l.LEVELS_UPDATED,this.onLevelsUpdated,this),t.off(l.FRAG_BUFFERED,this.onFragBuffered,this),t.off(l.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(t,e){this.resetLevels()}onManifestLoaded(t,e){const n=this.hls.config.preferManagedMediaSource,i=[],r={},s={};let a=!1,o=!1,l=!1;e.levels.forEach((t=>{const e=t.attrs;let{audioCodec:u,videoCodec:h}=t;u&&(t.audioCodec=u=Pt(u,n)||void 0),h&&(h=t.videoCodec=function(t){const e=t.split(",");for(let t=0;t<e.length;t++){const n=e[t].split(".");n.length>2&&"avc1"===n[0]&&(e[t]=`avc1.${parseInt(n[1]).toString(16)}${("000"+parseInt(n[2]).toString(16)).slice(-4)}`)}return e.join(",")}(h));const{width:c,height:d,unknownCodecs:f}=t,p=(null==f?void 0:f.length)||0;if(a||(a=!(!c||!d)),o||(o=!!h),l||(l=!!u),p||u&&!this.isAudioSupported(u)||h&&!this.isVideoSupported(h))return void this.log(`Some or all CODECS not supported "${e.CODECS}"`);const{CODECS:g,"FRAME-RATE":_,"HDCP-LEVEL":m,"PATHWAY-ID":v,RESOLUTION:y,"VIDEO-RANGE":b}=e,E=`${`${v||"."}-`}${t.bitrate}-${y}-${_}-${g}-${b}-${m}`;if(r[E])if(r[E].uri===t.url||t.attrs["PATHWAY-ID"])r[E].addGroupId("audio",e.AUDIO),r[E].addGroupId("text",e.SUBTITLES);else{const e=s[E]+=1;t.attrs["PATHWAY-ID"]=new Array(e+1).join(".");const n=this.createLevel(t);r[E]=n,i.push(n)}else{const e=this.createLevel(t);r[E]=e,s[E]=1,i.push(e)}})),this.filterAndSortMediaOptions(i,e,a,o,l)}createLevel(t){const e=new Jt(t),n=t.supplemental;if(null!=n&&n.videoCodec&&!this.isVideoSupported(n.videoCodec)){const t=new Error(`SUPPLEMENTAL-CODECS not supported "${n.videoCodec}"`);this.log(t.message),e.supportedResult=Gt(t,[])}return e}isAudioSupported(t){return At(t,"audio",this.hls.config.preferManagedMediaSource)}isVideoSupported(t){return At(t,"video",this.hls.config.preferManagedMediaSource)}filterAndSortMediaOptions(t,e,n,i,r){var s;let u=[],h=[],c=t;const d=(null==(s=e.stats)?void 0:s.parsing)||{};if((n||i)&&r&&(c=c.filter((({videoCodec:t,videoRange:e,width:n,height:i})=>{return(!!t||!(!n||!i))&&(!!(r=e)&&Ht.indexOf(r)>-1);var r}))),0===c.length)return Promise.resolve().then((()=>{if(this.hls){let t="no level with compatible codecs found in manifest",n=t;e.levels.length&&(n=`one or more CODECS in variant not supported: ${ne(e.levels.map((t=>t.attrs.CODECS)).filter(((t,e,n)=>n.indexOf(t)===e)))}`,this.warn(n),t+=` (${n})`);const i=new Error(t);this.hls.trigger(l.ERROR,{type:a.MEDIA_ERROR,details:o.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:e.url,error:i,reason:n})}})),void(d.end=performance.now());e.audioTracks&&(u=e.audioTracks.filter((t=>!t.audioCodec||this.isAudioSupported(t.audioCodec))),el(u)),e.subtitles&&(h=e.subtitles,el(h));const f=c.slice(0);c.sort(((t,e)=>{if(t.attrs["HDCP-LEVEL"]!==e.attrs["HDCP-LEVEL"])return(t.attrs["HDCP-LEVEL"]||"")>(e.attrs["HDCP-LEVEL"]||"")?1:-1;if(n&&t.height!==e.height)return t.height-e.height;if(t.frameRate!==e.frameRate)return t.frameRate-e.frameRate;if(t.videoRange!==e.videoRange)return Ht.indexOf(t.videoRange)-Ht.indexOf(e.videoRange);if(t.videoCodec!==e.videoCodec){const n=xt(t.videoCodec),i=xt(e.videoCodec);if(n!==i)return i-n}if(t.uri===e.uri&&t.codecSet!==e.codecSet){const n=Rt(t.codecSet),i=Rt(e.codecSet);if(n!==i)return i-n}return t.averageBitrate!==e.averageBitrate?t.averageBitrate-e.averageBitrate:0}));let p=f[0];if(this.steering&&(c=this.steering.filterParsedLevels(c),c.length!==f.length))for(let t=0;t<f.length;t++)if(f[t].pathwayId===c[0].pathwayId){p=f[t];break}this._levels=c;for(let t=0;t<c.length;t++)if(c[t]===p){var g;this._firstLevel=t;const e=p.bitrate,n=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${c.length} level(s) found, first bitrate: ${e}`),void 0===(null==(g=this.hls.userConfig)?void 0:g.abrEwmaDefaultEstimate)){const t=Math.min(e,this.hls.config.abrEwmaDefaultEstimateMax);t>n&&n===this.hls.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=t)}break}const _=r&&!i,m=this.hls.config,v=!(!m.audioStreamController||!m.audioTrackController),y={levels:c,audioTracks:u,subtitleTracks:h,sessionData:e.sessionData,sessionKeys:e.sessionKeys,firstLevel:this._firstLevel,stats:e.stats,audio:r,video:i,altAudio:v&&!_&&u.some((t=>!!t.url))};d.end=performance.now(),this.hls.trigger(l.MANIFEST_PARSED,y)}get levels(){return 0===this._levels.length?null:this._levels}get loadLevelObj(){return this.currentLevel}get level(){return this.currentLevelIndex}set level(t){const e=this._levels;if(0===e.length)return;if(t<0||t>=e.length){const n=new Error("invalid level idx"),i=t<0;if(this.hls.trigger(l.ERROR,{type:a.OTHER_ERROR,details:o.LEVEL_SWITCH_ERROR,level:t,fatal:i,error:n,reason:n.message}),i)return;t=Math.min(t,e.length-1)}const n=this.currentLevelIndex,i=this.currentLevel,r=i?i.attrs["PATHWAY-ID"]:void 0,s=e[t],u=s.attrs["PATHWAY-ID"];if(this.currentLevelIndex=t,this.currentLevel=s,n===t&&i&&r===u)return;this.log(`Switching to level ${t} (${s.height?s.height+"p ":""}${s.videoRange?s.videoRange+" ":""}${s.codecSet?s.codecSet+" ":""}@${s.bitrate})${u?" with Pathway "+u:""} from level ${n}${r?" with Pathway "+r:""}`);const h={level:t,attrs:s.attrs,details:s.details,bitrate:s.bitrate,averageBitrate:s.averageBitrate,maxBitrate:s.maxBitrate,realBitrate:s.realBitrate,width:s.width,height:s.height,codecSet:s.codecSet,audioCodec:s.audioCodec,videoCodec:s.videoCodec,audioGroups:s.audioGroups,subtitleGroups:s.subtitleGroups,loaded:s.loaded,loadError:s.loadError,fragmentError:s.fragmentError,name:s.name,id:s.id,uri:s.uri,url:s.url,urlId:0,audioGroupIds:s.audioGroupIds,textGroupIds:s.textGroupIds};this.hls.trigger(l.LEVEL_SWITCHING,h);const c=s.details;if(!c||c.live){const t=this.switchParams(s.uri,null==i?void 0:i.details,c);this.loadPlaylist(t)}}get manualLevel(){return this.manualLevelIndex}set manualLevel(t){this.manualLevelIndex=t,void 0===this._startLevel&&(this._startLevel=t),-1!==t&&(this.level=t)}get firstLevel(){return this._firstLevel}set firstLevel(t){this._firstLevel=t}get startLevel(){if(void 0===this._startLevel){const t=this.hls.config.startLevel;return void 0!==t?t:this.hls.firstAutoLevel}return this._startLevel}set startLevel(t){this._startLevel=t}get pathways(){return this.steering?this.steering.pathways():[]}get pathwayPriority(){return this.steering?this.steering.pathwayPriority:null}set pathwayPriority(t){if(this.steering){const e=this.steering.pathways(),n=t.filter((t=>-1!==e.indexOf(t)));if(t.length<1)return void this.warn(`pathwayPriority ${t} should contain at least one pathway from list: ${e}`);this.steering.pathwayPriority=n}}onError(t,e){!e.fatal&&e.context&&e.context.type===h&&e.context.level===this.level&&this.checkRetry(e)}onFragBuffered(t,{frag:e}){if(void 0!==e&&e.type===f){const t=e.elementaryStreams;if(!Object.keys(t).some((e=>!!t[e])))return;const n=this._levels[e.level];null!=n&&n.loadError&&(this.log(`Resetting level error count of ${n.loadError} on frag buffered`),n.loadError=0)}}onLevelLoaded(t,e){var n;const{level:i,details:r}=e,s=e.levelInfo;var a;if(!s)return this.warn(`Invalid level index ${i}`),void(null!=(a=e.deliveryDirectives)&&a.skip&&(r.deltaUpdateFailed=!0));if(s===this.currentLevel||e.withoutMultiVariant){0===s.fragmentError&&(s.loadError=0);let t=s.details;t===e.details&&t.advanced&&(t=void 0),this.playlistLoaded(i,e,t)}else null!=(n=e.deliveryDirectives)&&n.skip&&(r.deltaUpdateFailed=!0)}loadPlaylist(t){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentLevel)&&this.scheduleLoading(this.currentLevel,t)}loadingPlaylist(t,e){super.loadingPlaylist(t,e);const n=this.getUrlWithDirectives(t.uri,e),i=this.currentLevelIndex,r=t.attrs["PATHWAY-ID"],s=t.details,a=null==s?void 0:s.age;this.log(`Loading level index ${i}${void 0!==(null==e?void 0:e.msn)?" at sn "+e.msn+" part "+e.part:""}${r?" Pathway "+r:""}${a&&s.live?" age "+a.toFixed(1)+(s.type?" "+s.type||0:""):""} ${n}`),this.hls.trigger(l.LEVEL_LOADING,{url:n,level:i,levelInfo:t,pathwayId:t.attrs["PATHWAY-ID"],id:0,deliveryDirectives:e||null})}get nextLoadLevel(){return-1!==this.manualLevelIndex?this.manualLevelIndex:this.hls.nextAutoLevel}set nextLoadLevel(t){this.level=t,-1===this.manualLevelIndex&&(this.hls.nextAutoLevel=t)}removeLevel(t){var e;if(1===this._levels.length)return;const n=this._levels.filter(((e,n)=>n!==t||(this.steering&&this.steering.removeLevel(e),e===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,e.details&&e.details.fragments.forEach((t=>t.level=-1))),!1)));li(n),this._levels=n,this.currentLevelIndex>-1&&null!=(e=this.currentLevel)&&e.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.manualLevelIndex>-1&&(this.manualLevelIndex=this.currentLevelIndex);const i=n.length-1;this._firstLevel=Math.min(this._firstLevel,i),this._startLevel&&(this._startLevel=Math.min(this._startLevel,i)),this.hls.trigger(l.LEVELS_UPDATED,{levels:n})}onLevelsUpdated(t,{levels:e}){this._levels=e}checkMaxAutoUpdated(){const{autoLevelCapping:t,maxAutoLevel:e,maxHdcpLevel:n}=this.hls;this._maxAutoLevel!==e&&(this._maxAutoLevel=e,this.hls.trigger(l.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:t,levels:this.levels,maxAutoLevel:e,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:n}))}}function el(t){const e={};t.forEach((t=>{const n=t.groupId||"";t.id=e[n]=e[n]||0,e[n]++}))}function nl(){return self.SourceBuffer||self.WebKitSourceBuffer}function il(){if(!x())return!1;const t=nl();return!t||t.prototype&&"function"==typeof t.prototype.appendBuffer&&"function"==typeof t.prototype.remove}class rl extends Li{constructor(t,e,n){super(t,e,n,"stream-controller",f),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 t=this.media,e=t?t.currentTime:null;if(null===e||!i(e))return;if(this.log(`Media seeked to ${e.toFixed(3)}`),!this.getBufferedFrag(e))return;const n=this.getFwdBufferInfoAtPos(t,e,f,0);null!==n&&0!==n.len?this.tick():this.warn(`Main forward buffer length at ${e} on "seeked" event ${n?n.len:"empty"})`)},this.registerListeners()}registerListeners(){super.registerListeners();const{hls:t}=this;t.on(l.MANIFEST_PARSED,this.onManifestParsed,this),t.on(l.LEVEL_LOADING,this.onLevelLoading,this),t.on(l.LEVEL_LOADED,this.onLevelLoaded,this),t.on(l.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),t.on(l.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.on(l.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),t.on(l.BUFFER_CREATED,this.onBufferCreated,this),t.on(l.BUFFER_FLUSHED,this.onBufferFlushed,this),t.on(l.LEVELS_UPDATED,this.onLevelsUpdated,this),t.on(l.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){super.unregisterListeners();const{hls:t}=this;t.off(l.MANIFEST_PARSED,this.onManifestParsed,this),t.off(l.LEVEL_LOADED,this.onLevelLoaded,this),t.off(l.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),t.off(l.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.off(l.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),t.off(l.BUFFER_CREATED,this.onBufferCreated,this),t.off(l.BUFFER_FLUSHED,this.onBufferFlushed,this),t.off(l.LEVELS_UPDATED,this.onLevelsUpdated,this),t.off(l.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this.onMediaPlaying=this.onMediaSeeked=null,this.unregisterListeners(),super.onHandlerDestroying()}startLoad(t,e){if(this.levels){const{lastCurrentTime:n,hls:i}=this;if(this.stopLoad(),this.setInterval(100),this.level=-1,!this.startFragRequested){let t=i.startLevel;-1===t&&(i.config.testBandwidth&&this.levels.length>1?(t=0,this.bitrateTest=!0):t=i.firstAutoLevel),i.nextLoadLevel=t,this.level=i.loadLevel,this._hasEnoughToStart=!!e}n>0&&-1===t&&!e&&(this.log(`Override startPosition with lastCurrentTime @${n.toFixed(3)}`),t=n),this.state=bi,this.nextLoadPosition=this.lastCurrentTime=t+this.timelineOffset,this.startPosition=e?-1:t,this.tick()}else this._forceStartLoad=!0,this.state=yi}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case Ri:{const{levels:t,level:e}=this,n=null==t?void 0:t[e],i=null==n?void 0:n.details;if(i&&(!i.live||this.levelLastLoaded===n&&!this.waitForLive(n))){if(this.waitForCdnTuneIn(i))break;this.state=bi;break}if(this.hls.nextLoadLevel!==this.level){this.state=bi;break}break}case Ti:this.checkRetryDate()}this.state===bi&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){var t;super.onTickEnd(),null!=(t=this.media)&&t.readyState&&!1===this.media.seeking&&(this.lastCurrentTime=this.media.currentTime),this.checkFragmentChanged()}doTickIdle(){const{hls:t,levelLastLoaded:e,levels:n,media:i}=this;if(null===e||!i&&!this.primaryPrefetch&&(this.startFragRequested||!t.config.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;const r=this.buffering?t.nextLoadLevel:t.loadLevel;if(null==n||!n[r])return;const s=n[r],a=this.getMainFwdBufferInfo();if(null===a)return;const o=this.getLevelDetails();if(o&&this._streamEnded(a,o)){const t={};return 2===this.altAudio&&(t.type="video"),this.hls.trigger(l.BUFFER_EOS,t),void(this.state=Di)}if(!this.buffering)return;t.loadLevel!==r&&-1===t.manualLevel&&this.log(`Adapting to level ${r} from level ${this.level}`),this.level=t.nextLoadLevel=r;const u=s.details;if(!u||this.state===Ri||this.waitForLive(s))return this.level=r,this.state=Ri,void(this.startFragRequested=!1);const h=a.len,c=this.getMaxBufferLength(s.maxBitrate);if(h>=c)return;this.backtrackFragment&&this.backtrackFragment.start>a.end&&(this.backtrackFragment=null);const d=this.backtrackFragment?this.backtrackFragment.start:a.end;let p=this.getNextFragment(d,u);if(this.couldBacktrack&&!this.fragPrevious&&p&&W(p)&&this.fragmentTracker.getState(p)!==Me){var g;const t=(null!=(g=this.backtrackFragment)?g:p).sn-u.startSN,e=u.fragments[t-1];e&&p.cc===e.cc&&(p=e,this.fragmentTracker.removeFragment(e))}else this.backtrackFragment&&a.len&&(this.backtrackFragment=null);if(p&&this.isLoopLoading(p,d)){if(!p.gap){const t=this.audioOnly&&!this.altAudio?V:Z,e=(t===Z?this.videoBuffer:this.mediaBuffer)||this.media;e&&this.afterBufferFlushed(e,t,f)}p=this.getNextFragmentLoopLoading(p,u,a,f,c)}p&&(!p.initSegment||p.initSegment.data||this.bitrateTest||(p=p.initSegment),this.loadFragment(p,s,d))}loadFragment(t,e,n){const i=this.fragmentTracker.getState(t);i===Pe||i===Fe?W(t)?this.bitrateTest?(this.log(`Fragment ${t.sn} of level ${t.level} is being downloaded to test bitrate and will not be buffered`),this._loadBitrateTestFrag(t,e)):super.loadFragment(t,e,n):this._loadInitSegment(t,e):this.clearTrackerIfNeeded(t)}getBufferedFrag(t){return this.fragmentTracker.getBufferedFrag(t,f)}followingBufferedFrag(t){return t?this.getBufferedFrag(t.end+.5):null}immediateLevelSwitch(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)}nextLevelSwitch(){const{levels:t,media:e}=this;if(null!=e&&e.readyState){let n;const i=this.getAppendedFrag(e.currentTime);i&&i.start>1&&this.flushMainBuffer(0,i.start-1);const r=this.getLevelDetails();if(null!=r&&r.live){const t=this.getMainFwdBufferInfo();if(!t||t.len<2*r.targetduration)return}if(!e.paused&&t){const e=t[this.hls.nextLoadLevel],i=this.fragLastKbps;n=i&&this.fragCurrent?this.fragCurrent.duration*e.maxBitrate/(1e3*i)+1:0}else n=0;const s=this.getBufferedFrag(e.currentTime+n);if(s){const t=this.followingBufferedFrag(s);if(t){this.abortCurrentFrag();const e=t.maxStartPTS?t.maxStartPTS:t.start,n=t.duration,i=Math.max(s.end,e+Math.min(Math.max(n-this.config.maxFragLookUpTolerance,n*(this.couldBacktrack?.5:.125)),n*(this.couldBacktrack?.75:.25)));this.flushMainBuffer(i,Number.POSITIVE_INFINITY)}}}}abortCurrentFrag(){const t=this.fragCurrent;switch(this.fragCurrent=null,this.backtrackFragment=null,t&&(t.abortRequests(),this.fragmentTracker.removeFragment(t)),this.state){case Ei:case wi:case Ti:case Si:case Ai:this.state=bi}this.nextLoadPosition=this.getLoadPosition()}flushMainBuffer(t,e){super.flushMainBuffer(t,e,2===this.altAudio?"video":null)}onMediaAttached(t,e){super.onMediaAttached(t,e);const n=e.media;_i(n,"playing",this.onMediaPlaying),_i(n,"seeked",this.onMediaSeeked)}onMediaDetaching(t,e){const{media:n}=this;n&&(mi(n,"playing",this.onMediaPlaying),mi(n,"seeked",this.onMediaSeeked)),this.videoBuffer=null,this.fragPlaying=null,super.onMediaDetaching(t,e);!!e.transferMedia||(this._hasEnoughToStart=!1)}onManifestLoading(){super.onManifestLoading(),this.log("Trigger BUFFER_RESET"),this.hls.trigger(l.BUFFER_RESET,void 0),this.couldBacktrack=!1,this.fragLastKbps=0,this.fragPlaying=this.backtrackFragment=null,this.altAudio=0,this.audioOnly=!1}onManifestParsed(t,e){let n=!1,i=!1;for(let t=0;t<e.levels.length;t++){const r=e.levels[t].audioCodec;r&&(n=n||-1!==r.indexOf("mp4a.40.2"),i=i||-1!==r.indexOf("mp4a.40.5"))}this.audioCodecSwitch=n&&i&&!function(){var t;const e=nl();return"function"==typeof(null==e||null==(t=e.prototype)?void 0:t.changeType)}(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=e.levels,this.startFragRequested=!1}onLevelLoading(t,e){const{levels:n}=this;if(!n||this.state!==bi)return;const i=e.levelInfo;(!i.details||i.details.live&&(this.levelLastLoaded!==i||i.details.expired)||this.waitForCdnTuneIn(i.details))&&(this.state=Ri)}onLevelLoaded(t,e){var n;const{levels:i,startFragRequested:r}=this,s=e.level,a=e.details,o=a.totalduration;if(!i)return void this.warn(`Levels were reset while loading level ${s}`);this.log(`Level ${s} loaded [${a.startSN},${a.endSN}]${a.lastPartSn?`[part-${a.lastPartSn}-${a.lastPartIndex}]`:""}, cc [${a.startCC}, ${a.endCC}] duration:${o}`);const u=e.levelInfo,h=this.fragCurrent;!h||this.state!==wi&&this.state!==Ti||h.level!==e.level&&h.loader&&this.abortCurrentFrag();let c=0;if(a.live||null!=(n=u.details)&&n.live){var d;if(this.checkLiveUpdate(a),a.deltaUpdateFailed)return;c=this.alignPlaylists(a,u.details,null==(d=this.levelLastLoaded)?void 0:d.details)}if(u.details=a,this.levelLastLoaded=u,r||this.setStartPosition(a,c),this.hls.trigger(l.LEVEL_UPDATED,{details:a,level:s}),this.state===Ri){if(this.waitForCdnTuneIn(a))return;this.state=bi}r&&a.live&&this.synchronizeToLiveEdge(a),this.tick()}synchronizeToLiveEdge(t){const{config:e,media:n}=this;if(!n)return;const i=this.hls.liveSyncPosition,r=this.getLoadPosition(),s=t.fragmentStart,a=t.edge,o=r>=s-e.maxFragLookUpTolerance&&r<=a;if(null!==i&&n.duration>i&&(r<i||!o)){const s=void 0!==e.liveMaxLatencyDuration?e.liveMaxLatencyDuration:e.liveMaxLatencyDurationCount*t.targetduration;if((!o&&n.readyState<4||r<a-s)&&(this._hasEnoughToStart||(this.nextLoadPosition=i),n.readyState))if(this.warn(`Playback: ${r.toFixed(3)} is located too far from the end of live sliding playlist: ${a}, reset currentTime to : ${i.toFixed(3)}`),"buffered"===this.config.liveSyncMode){var l;const t=en.bufferInfo(n,i,0);if(null==(l=t.buffered)||!l.length)return void(n.currentTime=i);if(t.start<=r)return void(n.currentTime=i);const{nextStart:e}=en.bufferedInfo(t.buffered,r,0);e&&(n.currentTime=e)}else n.currentTime=i}}_handleFragmentLoadProgress(t){var e;const n=t.frag,{part:i,payload:r}=t,{levels:s}=this;if(!s)return void this.warn(`Levels were reset while fragment load was in progress. Fragment ${n.sn} of level ${n.level} will not be buffered`);const a=s[n.level];if(!a)return void this.warn(`Level ${n.level} not found on progress`);const o=a.details;if(!o)return this.warn(`Dropping fragment ${n.sn} of level ${n.level} after level details were reset`),void this.fragmentTracker.removeFragment(n);const l=a.videoCodec,u=o.PTSKnown||!o.live,h=null==(e=n.initSegment)?void 0:e.data,c=this._getAudioCodec(a),d=this.transmuxer=this.transmuxer||new os(this.hls,f,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),p=i?i.index:-1,g=-1!==p,_=new Je(n.level,n.sn,n.stats.chunkCount,r.byteLength,p,g),m=this.initPTS[n.cc];d.push(r,h,c,l,n,i,o.totalduration,u,_,m)}onAudioTrackSwitching(t,e){const n=this.hls,i=2===this.altAudio;if(he(e.url,n))this.altAudio=1;else{if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;const t=this.fragCurrent;t&&(this.log("Switching to main audio track, cancel main fragment load"),t.abortRequests(),this.fragmentTracker.removeFragment(t)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();if(i)return this.fragmentTracker.removeAllFragments(),n.once(l.BUFFER_FLUSHED,(()=>{this.hls&&this.hls.trigger(l.AUDIO_TRACK_SWITCHED,e)})),void n.trigger(l.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null});n.trigger(l.AUDIO_TRACK_SWITCHED,e)}}onAudioTrackSwitched(t,e){const n=he(e.url,this.hls);if(n){const t=this.videoBuffer;t&&this.mediaBuffer!==t&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=t)}this.altAudio=n?2:0,this.tick()}onBufferCreated(t,e){const n=e.tracks;let i,r,s=!1;for(const t in n){const e=n[t];if("main"===e.id){if(r=t,i=e,"video"===t){const e=n[t];e&&(this.videoBuffer=e.buffer)}}else s=!0}s&&i?(this.log(`Alternate track found, use ${r}.buffered to schedule main fragment loading`),this.mediaBuffer=i.buffer):this.mediaBuffer=this.media}onFragBuffered(t,e){const{frag:n,part:i}=e,r=n.type===f;if(r){if(this.fragContextChanged(n))return this.warn(`Fragment ${n.sn}${i?" p: "+i.index:""} of level ${n.level} finished buffering, but was aborted. state: ${this.state}`),void(this.state===Ai&&(this.state=bi));const t=i?i.stats:n.stats;this.fragLastKbps=Math.round(8*t.total/(t.buffering.end-t.loading.first)),W(n)&&(this.fragPrevious=n),this.fragBufferedComplete(n,i)}const s=this.media;s&&(!this._hasEnoughToStart&&en.getBuffered(s).length&&(this._hasEnoughToStart=!0,this.seekToStartPos()),r&&this.tick())}get hasEnoughToStart(){return this._hasEnoughToStart}onError(t,e){var n;if(e.fatal)this.state=Ci;else switch(e.details){case o.FRAG_GAP:case o.FRAG_PARSING_ERROR:case o.FRAG_DECRYPT_ERROR:case o.FRAG_LOAD_ERROR:case o.FRAG_LOAD_TIMEOUT:case o.KEY_LOAD_ERROR:case o.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(f,e);break;case o.LEVEL_LOAD_ERROR:case o.LEVEL_LOAD_TIMEOUT:case o.LEVEL_PARSING_ERROR:e.levelRetry||this.state!==Ri||(null==(n=e.context)?void 0:n.type)!==h||(this.state=bi);break;case o.BUFFER_ADD_CODEC_ERROR:case o.BUFFER_APPEND_ERROR:if("main"!==e.parent)return;this.reduceLengthAndFlushBuffer(e)&&this.resetLoadingState();break;case o.BUFFER_FULL_ERROR:if("main"!==e.parent)return;if(this.reduceLengthAndFlushBuffer(e)){!this.config.interstitialsController&&this.config.assetPlayerId?this._hasEnoughToStart=!0:this.flushMainBuffer(0,Number.POSITIVE_INFINITY)}break;case o.INTERNAL_EXCEPTION:this.recoverWorkerError(e)}}onFragLoadEmergencyAborted(){this.state=bi,this._hasEnoughToStart||(this.startFragRequested=!1,this.nextLoadPosition=this.lastCurrentTime),this.tickImmediate()}onBufferFlushed(t,{type:e}){if(e!==V||!this.altAudio){const t=(e===Z?this.videoBuffer:this.mediaBuffer)||this.media;t&&(this.afterBufferFlushed(t,e,f),this.tick())}}onLevelsUpdated(t,e){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level,-1===this.level&&this.resetWhenMissingContext(this.fragCurrent)),this.levels=e.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){const{media:t}=this;if(!t)return;const e=t.currentTime;let n=this.startPosition;if(n>=0&&e<n){if(t.seeking)return void this.log(`could not seek to ${n}, already seeking at ${e}`);const i=this.timelineOffset;i&&n&&(n+=i);const r=this.getLevelDetails(),s=en.getBuffered(t),a=s.length?s.start(0):0,o=a-n,l=Math.max(this.config.maxBufferHole,this.config.maxFragLookUpTolerance);(this.config.startOnSegmentBoundary||o>0&&(o<l||this.loadingParts&&o<2*((null==r?void 0:r.partTarget)||0)))&&(this.log(`adjusting start position by ${o} to match buffer start`),n+=o,this.startPosition=n),e<n&&(this.log(`seek to target start position ${n} from current time ${e} buffer start ${a}`),t.currentTime=n)}}_getAudioCodec(t){let e=this.config.defaultAudioCodec||t.audioCodec;return this.audioCodecSwap&&e&&(this.log("Swapping audio codec"),e=-1!==e.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5"),e}_loadBitrateTestFrag(t,e){t.bitrateTest=!0,this._doFragLoad(t,e).then((t=>{const{hls:n}=this,i=null==t?void 0:t.frag;if(!i||this.fragContextChanged(i))return;e.fragmentError=0,this.state=bi,this.startFragRequested=!1,this.bitrateTest=!1;const r=i.stats;r.parsing.start=r.parsing.end=r.buffering.start=r.buffering.end=self.performance.now(),n.trigger(l.FRAG_LOADED,t),i.bitrateTest=!1})).catch((e=>{this.state!==yi&&this.state!==Ci&&(this.warn(e),this.resetFragmentLoading(t))}))}_handleTransmuxComplete(t){const e=this.playlistType,{hls:n}=this,{remuxResult:r,chunkMeta:s}=t,a=this.getCurrentContext(s);if(!a)return void this.resetWhenMissingContext(s);const{frag:o,part:u,level:h}=a,{video:c,text:d,id3:f,initSegment:p}=r,{details:g}=h,_=this.altAudio?void 0:r.audio;if(this.fragContextChanged(o))this.fragmentTracker.removeFragment(o);else{if(this.state=Si,p){const t=p.tracks;if(t){const i=o.initSegment||o;if(this.unhandledEncryptionError(p,o))return;this._bufferInitSegment(h,t,i,s),n.trigger(l.FRAG_PARSING_INIT_SEGMENT,{frag:i,id:e,tracks:t})}const r=p.initPTS,a=p.timescale,u=this.initPTS[o.cc];if(i(r)&&(!u||u.baseTime!==r||u.timescale!==a)){const t=p.trackId;this.initPTS[o.cc]={baseTime:r,timescale:a,trackId:t},n.trigger(l.INIT_PTS_FOUND,{frag:o,id:e,initPTS:r,timescale:a,trackId:t})}}if(c&&g){_&&"audiovideo"===c.type&&this.logMuxedErr(o);const t=g.fragments[o.sn-1-g.startSN],e=o.sn===g.startSN,n=!t||o.cc>t.cc;if(!1!==r.independent){const{startPTS:t,endPTS:i,startDTS:r,endDTS:a}=c;if(u)u.elementaryStreams[c.type]={startPTS:t,endPTS:i,startDTS:r,endDTS:a};else if(c.firstKeyFrame&&c.independent&&1===s.id&&!n&&(this.couldBacktrack=!0),c.dropped&&c.independent){const r=this.getMainFwdBufferInfo(),s=(r?r.end:this.getLoadPosition())+this.config.maxBufferHole,l=c.firstKeyFramePTS?c.firstKeyFramePTS:t;if(!e&&s<l-this.config.maxBufferHole&&!n)return void this.backtrack(o);n&&(o.gap=!0),o.setElementaryStreamInfo(c.type,o.start,i,o.start,a,!0)}else e&&t-(g.appliedTimelineOffset||0)>2&&(o.gap=!0);o.setElementaryStreamInfo(c.type,t,i,r,a),this.backtrackFragment&&(this.backtrackFragment=o),this.bufferFragmentData(c,o,u,s,e||n)}else{if(!e&&!n)return void this.backtrack(o);o.gap=!0}}if(_){const{startPTS:t,endPTS:e,startDTS:n,endDTS:i}=_;u&&(u.elementaryStreams[V]={startPTS:t,endPTS:e,startDTS:n,endDTS:i}),o.setElementaryStreamInfo(V,t,e,n,i),this.bufferFragmentData(_,o,u,s)}if(g&&null!=f&&f.samples.length){const t={id:e,frag:o,details:g,samples:f.samples};n.trigger(l.FRAG_PARSING_METADATA,t)}if(g&&d){const t={id:e,frag:o,details:g,samples:d.samples};n.trigger(l.FRAG_PARSING_USERDATA,t)}}}logMuxedErr(t){this.warn(`${W(t)?"Media":"Init"} segment with muxed audiovideo where only video expected: ${t.url}`)}_bufferInitSegment(t,e,n,i){if(this.state!==Si)return;this.audioOnly=!!e.audio&&!e.video,this.altAudio&&!this.audioOnly&&(delete e.audio,e.audiovideo&&this.logMuxedErr(n));const{audio:r,video:s,audiovideo:a}=e;if(r){const n=t.audioCodec;let i=Ot(r.codec,n);"mp4a"===i&&(i="mp4a.40.5");const s=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){i&&(i=-1!==i.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5");const t=r.metadata;t&&"channelCount"in t&&1!==(t.channelCount||1)&&-1===s.indexOf("firefox")&&(i="mp4a.40.5")}i&&-1!==i.indexOf("mp4a.40.5")&&-1!==s.indexOf("android")&&"audio/mpeg"!==r.container&&(i="mp4a.40.2",this.log(`Android: force audio codec to ${i}`)),n&&n!==i&&this.log(`Swapping manifest audio codec "${n}" for "${i}"`),r.levelCodec=i,r.id=f,this.log(`Init audio buffer, container:${r.container}, codecs[selected/level/parsed]=[${i||""}/${n||""}/${r.codec}]`),delete e.audiovideo}if(s){s.levelCodec=t.videoCodec,s.id=f;const n=s.codec;if(4===(null==n?void 0:n.length))switch(n){case"hvc1":case"hev1":s.codec="hvc1.1.6.L120.90";break;case"av01":s.codec="av01.0.04M.08";break;case"avc1":s.codec="avc1.42e01e"}this.log(`Init video buffer, container:${s.container}, codecs[level/parsed]=[${t.videoCodec||""}/${n}]${s.codec!==n?" parsed-corrected="+s.codec:""}${s.supplemental?" supplemental="+s.supplemental:""}`),delete e.audiovideo}a&&(this.log(`Init audiovideo buffer, container:${a.container}, codecs[level/parsed]=[${t.codecs}/${a.codec}]`),delete e.video,delete e.audio);const o=Object.keys(e);if(o.length){if(this.hls.trigger(l.BUFFER_CODECS,e),!this.hls)return;o.forEach((t=>{const r=e[t].initSegment;null!=r&&r.byteLength&&this.hls.trigger(l.BUFFER_APPENDING,{type:t,data:r,frag:n,part:null,chunkMeta:i,parent:n.type})}))}this.tickImmediate()}getMainFwdBufferInfo(){const t=this.mediaBuffer&&2===this.altAudio?this.mediaBuffer:this.media;return this.getFwdBufferInfo(t,f)}get maxBufferLength(){const{levels:t,level:e}=this,n=null==t?void 0:t[e];return n?this.getMaxBufferLength(n.maxBitrate):this.config.maxBufferLength}backtrack(t){this.couldBacktrack=!0,this.backtrackFragment=t,this.resetTransmuxer(),this.flushBufferGap(t),this.fragmentTracker.removeFragment(t),this.fragPrevious=null,this.nextLoadPosition=t.start,this.state=bi}checkFragmentChanged(){const t=this.media;let e=null;if(t&&t.readyState>1&&!1===t.seeking){const n=t.currentTime;if(en.isBuffered(t,n)?e=this.getAppendedFrag(n):en.isBuffered(t,n+.1)&&(e=this.getAppendedFrag(n+.1)),e){this.backtrackFragment=null;const t=this.fragPlaying,n=e.level;t&&e.sn===t.sn&&t.level===n||(this.fragPlaying=e,this.hls.trigger(l.FRAG_CHANGED,{frag:e}),t&&t.level===n||this.hls.trigger(l.LEVEL_SWITCHED,{level:n}))}}}get nextLevel(){const t=this.nextBufferedFrag;return t?t.level:-1}get currentFrag(){var t;if(this.fragPlaying)return this.fragPlaying;const e=(null==(t=this.media)?void 0:t.currentTime)||this.lastCurrentTime;return i(e)?this.getAppendedFrag(e):null}get currentProgramDateTime(){var t;const e=(null==(t=this.media)?void 0:t.currentTime)||this.lastCurrentTime;if(i(e)){const t=this.getLevelDetails(),n=this.currentFrag||(t?de(null,t.fragments,e):null);if(n){const t=n.programDateTime;if(null!==t){const i=t+1e3*(e-n.start);return new Date(i)}}}return null}get currentLevel(){const t=this.currentFrag;return t?t.level:-1}get nextBufferedFrag(){const t=this.currentFrag;return t?this.followingBufferedFrag(t):null}get forceStartLoad(){return this._forceStartLoad}}class sl extends w{constructor(t,e){super("key-loader",e),this.config=void 0,this.keyIdToKeyInfo={},this.emeController=null,this.config=t}abort(t){for(const n in this.keyIdToKeyInfo){const i=this.keyIdToKeyInfo[n].loader;if(i){var e;if(t&&t!==(null==(e=i.context)?void 0:e.frag.type))return;i.abort()}}}detach(){for(const t in this.keyIdToKeyInfo){const e=this.keyIdToKeyInfo[t];(e.mediaKeySessionContext||e.decryptdata.isCommonEncryption)&&delete this.keyIdToKeyInfo[t]}}destroy(){this.detach();for(const t in this.keyIdToKeyInfo){const e=this.keyIdToKeyInfo[t].loader;e&&e.destroy()}this.keyIdToKeyInfo={}}createKeyLoadError(t,e=o.KEY_LOAD_ERROR,n,i,r){return new Qe({type:a.NETWORK_ERROR,details:e,fatal:!1,frag:t,response:r,error:n,networkDetails:i})}loadClear(t,e,n){if(this.emeController&&this.config.emeEnabled&&!this.emeController.getSelectedKeySystemFormats().length){if(e.length)for(let i=0,r=e.length;i<r;i++){const s=e[i];if(t.cc<=s.cc&&(!W(t)||!W(s)||t.sn<s.sn)||!n&&i==r-1)return this.emeController.selectKeySystemFormat(s).then((t=>{if(!this.emeController)return;s.setKeyFormat(t);const e=Cn(t);return e?this.emeController.getKeySystemAccess([e]):void 0}))}if(this.config.requireKeySystemAccessOnStart){const t=Rn(this.config);if(t.length)return this.emeController.getKeySystemAccess(t)}}return null}load(t){return!t.decryptdata&&t.encrypted&&this.emeController&&this.config.emeEnabled?this.emeController.selectKeySystemFormat(t).then((e=>this.loadInternal(t,e))):this.loadInternal(t)}loadInternal(t,e){var n,i;e&&t.setKeyFormat(e);const r=t.decryptdata;if(!r){const n=new Error(e?`Expected frag.decryptdata to be defined after setting format ${e}`:`Missing decryption data on fragment in onKeyLoading (emeEnabled with controller: ${this.emeController&&this.config.emeEnabled})`);return Promise.reject(this.createKeyLoadError(t,o.KEY_LOAD_ERROR,n))}const s=r.uri;if(!s)return Promise.reject(this.createKeyLoadError(t,o.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${s}"`)));const a=al(r);let l=this.keyIdToKeyInfo[a];if(null!=(n=l)&&n.decryptdata.key)return r.key=l.decryptdata.key,Promise.resolve({frag:t,keyInfo:l});if(this.emeController&&null!=(i=l)&&i.keyLoadPromise){switch(this.emeController.getKeyStatus(l.decryptdata)){case"usable":case"usable-in-future":return l.keyLoadPromise.then((e=>{const{keyInfo:n}=e;return r.key=n.decryptdata.key,{frag:t,keyInfo:n}}))}}switch(this.log(`${this.keyIdToKeyInfo[a]?"Rel":"L"}oading${r.keyId?" keyId: "+I(r.keyId):""} URI: ${r.uri} from ${t.type} ${t.level}`),l=this.keyIdToKeyInfo[a]={decryptdata:r,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},r.method){case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return"identity"===r.keyFormat?this.loadKeyHTTP(l,t):this.loadKeyEME(l,t);case"AES-128":case"AES-256":case"AES-256-CTR":return this.loadKeyHTTP(l,t);default:return Promise.reject(this.createKeyLoadError(t,o.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${r.method}"`)))}}loadKeyEME(t,e){const n={frag:e,keyInfo:t};if(this.emeController&&this.config.emeEnabled){const i=this.emeController.loadKey(n);return(t.keyLoadPromise=i.then((e=>(t.mediaKeySessionContext=e,n)))).catch((n=>{throw t.keyLoadPromise=null,"data"in n&&(n.data.frag=e),n}))}return Promise.resolve(n)}loadKeyHTTP(t,e){const n=this.config,i=new(0,n.loader)(n);return e.keyLoader=t.loader=i,t.keyLoadPromise=new Promise(((r,s)=>{const a={keyInfo:t,frag:e,responseType:"arraybuffer",url:t.decryptdata.uri},l=n.keyLoadPolicy.default,u={loadPolicy:l,timeout:l.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},h={onSuccess:(t,e,n,i)=>{const{frag:a,keyInfo:l}=n,u=al(l.decryptdata);if(!a.decryptdata||l!==this.keyIdToKeyInfo[u])return s(this.createKeyLoadError(a,o.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),i));l.decryptdata.key=a.decryptdata.key=new Uint8Array(t.data),a.keyLoader=null,l.loader=null,r({frag:a,keyInfo:l})},onError:(t,n,i,r)=>{this.resetLoader(n),s(this.createKeyLoadError(e,o.KEY_LOAD_ERROR,new Error(`HTTP Error ${t.code} loading key ${t.text}`),i,E({url:a.url,data:void 0},t)))},onTimeout:(t,n,i)=>{this.resetLoader(n),s(this.createKeyLoadError(e,o.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),i))},onAbort:(t,n,i)=>{this.resetLoader(n),s(this.createKeyLoadError(e,o.INTERNAL_ABORTED,new Error("key loading aborted"),i))}};i.load(a,u,h)}))}resetLoader(t){const{frag:e,keyInfo:n,url:i}=t,r=n.loader;e.keyLoader===r&&(e.keyLoader=null,n.loader=null);const s=al(n.decryptdata)||i;delete this.keyIdToKeyInfo[s],r&&r.destroy()}}function al(t){if(t.keyFormat!==Sn){const e=t.keyId;if(e)return I(e)}return t.uri}function ol(t){const{type:e}=t;switch(e){case c:return p;case d:return g;default:return f}}function ll(t,e){let n=t.url;return void 0!==n&&0!==n.indexOf("data:")||(n=e.url),n}class ul{constructor(t){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.onManifestLoaded=this.checkAutostartLoad,this.hls=t,this.registerListeners()}startLoad(t){}stopLoad(){this.destroyInternalLoaders()}registerListeners(){const{hls:t}=this;t.on(l.MANIFEST_LOADING,this.onManifestLoading,this),t.on(l.LEVEL_LOADING,this.onLevelLoading,this),t.on(l.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),t.on(l.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),t.on(l.LEVELS_UPDATED,this.onLevelsUpdated,this)}unregisterListeners(){const{hls:t}=this;t.off(l.MANIFEST_LOADING,this.onManifestLoading,this),t.off(l.LEVEL_LOADING,this.onLevelLoading,this),t.off(l.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),t.off(l.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),t.off(l.LEVELS_UPDATED,this.onLevelsUpdated,this)}createInternalLoader(t){const e=this.hls.config,n=e.pLoader,i=e.loader,r=new(n||i)(e);return this.loaders[t.type]=r,r}getInternalLoader(t){return this.loaders[t.type]}resetInternalLoader(t){this.loaders[t]&&delete this.loaders[t]}destroyInternalLoaders(){for(const t in this.loaders){const e=this.loaders[t];e&&e.destroy(),this.resetInternalLoader(t)}}destroy(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()}onManifestLoading(t,e){const{url:n}=e;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:u,url:n,deliveryDirectives:null,levelOrTrack:null})}onLevelLoading(t,e){const{id:n,level:i,pathwayId:r,url:s,deliveryDirectives:a,levelInfo:o}=e;this.load({id:n,level:i,pathwayId:r,responseType:"text",type:h,url:s,deliveryDirectives:a,levelOrTrack:o})}onAudioTrackLoading(t,e){const{id:n,groupId:i,url:r,deliveryDirectives:s,track:a}=e;this.load({id:n,groupId:i,level:null,responseType:"text",type:c,url:r,deliveryDirectives:s,levelOrTrack:a})}onSubtitleTrackLoading(t,e){const{id:n,groupId:i,url:r,deliveryDirectives:s,track:a}=e;this.load({id:n,groupId:i,level:null,responseType:"text",type:d,url:r,deliveryDirectives:s,levelOrTrack:a})}onLevelsUpdated(t,e){const n=this.loaders[h];if(n){const t=n.context;t&&!e.levels.some((e=>e===t.levelOrTrack))&&(n.abort(),delete this.loaders[h])}}load(t){var e;const n=this.hls.config;let r,s=this.getInternalLoader(t);if(s){const e=this.hls.logger,n=s.context;if(n&&n.levelOrTrack===t.levelOrTrack&&(n.url===t.url||n.deliveryDirectives&&!t.deliveryDirectives))return void(n.url===t.url?e.log(`[playlist-loader]: ignore ${t.url} ongoing request`):e.log(`[playlist-loader]: ignore ${t.url} in favor of ${n.url}`));e.log(`[playlist-loader]: aborting previous loader for type: ${t.type}`),s.abort()}if(r=t.type===u?n.manifestLoadPolicy.default:y({},n.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),s=this.createInternalLoader(t),i(null==(e=t.deliveryDirectives)?void 0:e.part)){let e;if(t.type===h&&null!==t.level?e=this.hls.levels[t.level].details:t.type===c&&null!==t.id?e=this.hls.audioTracks[t.id].details:t.type===d&&null!==t.id&&(e=this.hls.subtitleTracks[t.id].details),e){const t=e.partTarget,n=e.targetduration;if(t&&n){const e=1e3*Math.max(3*t,.8*n);r=y({},r,{maxTimeToFirstByteMs:Math.min(e,r.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(e,r.maxTimeToFirstByteMs)})}}}const a=r.errorRetry||r.timeoutRetry||{},o={loadPolicy:r,timeout:r.maxLoadTimeMs,maxRetry:a.maxNumRetry||0,retryDelay:a.retryDelayMs||0,maxRetryDelay:a.maxRetryDelayMs||0},l={onSuccess:(t,e,n,i)=>{const r=this.getInternalLoader(n);this.resetInternalLoader(n.type);const s=t.data;e.parsing.start=performance.now(),$n.isMediaPlaylist(s)||n.type!==u?this.handleTrackOrLevelPlaylist(t,e,n,i||null,r):this.handleMasterPlaylist(t,e,n,i)},onError:(t,e,n,i)=>{this.handleNetworkError(e,n,!1,t,i)},onTimeout:(t,e,n)=>{this.handleNetworkError(e,n,!0,void 0,t)}};s.load(t,o,l)}checkAutostartLoad(){if(!this.hls)return;const{config:{autoStartLoad:t,startPosition:e},forceStartLoad:n}=this.hls;(t||n)&&(this.hls.logger.log(`${t?"auto":"force"} startLoad with configured startPosition ${e}`),this.hls.startLoad(e))}handleMasterPlaylist(t,e,n,i){const r=this.hls,s=t.data,a=ll(t,n),o=$n.parseMasterPlaylist(s,a);if(o.playlistParsingError)return e.parsing.end=performance.now(),void this.handleManifestParsingError(t,n,o.playlistParsingError,i,e);const{contentSteering:u,levels:h,sessionData:c,sessionKeys:d,startTimeOffset:f,variableList:p}=o;this.variableList=p,h.forEach((t=>{const{unknownCodecs:e}=t;if(e){const{preferManagedMediaSource:n}=this.hls.config;let{audioCodec:i,videoCodec:r}=t;for(let s=e.length;s--;){const a=e[s];At(a,"audio",n)?(t.audioCodec=i=i?`${i},${a}`:a,kt.audio[i.substring(0,4)]=2,e.splice(s,1)):At(a,"video",n)&&(t.videoCodec=r=r?`${r},${a}`:a,kt.video[r.substring(0,4)]=2,e.splice(s,1))}}}));const{AUDIO:g=[],SUBTITLES:_,"CLOSED-CAPTIONS":m}=$n.parseMasterPlaylistMedia(s,a,o);if(g.length){g.some((t=>!t.url))||!h[0].audioCodec||h[0].attrs.AUDIO||(this.hls.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),g.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new hn({}),bitrate:0,url:""}))}r.trigger(l.MANIFEST_LOADED,{levels:h,audioTracks:g,subtitles:_,captions:m,contentSteering:u,url:a,stats:e,networkDetails:i,sessionData:c,sessionKeys:d,startTimeOffset:f,variableList:p})}handleTrackOrLevelPlaylist(t,e,n,r,s){const a=this.hls,{id:o,level:h,type:c}=n,d=ll(t,n),f=i(h)?h:i(o)?o:0,p=ol(n),g=$n.parseLevelPlaylist(t.data,d,f,p,0,this.variableList);if(c===u){const t={attrs:new hn({}),bitrate:0,details:g,name:"",url:d};g.requestScheduled=e.loading.start+ri(g,0),a.trigger(l.MANIFEST_LOADED,{levels:[t],audioTracks:[],url:d,stats:e,networkDetails:r,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}e.parsing.end=performance.now(),n.levelDetails=g,this.handlePlaylistLoaded(g,t,e,n,r,s)}handleManifestParsingError(t,e,n,i,r){this.hls.trigger(l.ERROR,{type:a.NETWORK_ERROR,details:o.MANIFEST_PARSING_ERROR,fatal:e.type===u,url:t.url,err:n,error:n,reason:n.message,response:t,context:e,networkDetails:i,stats:r})}handleNetworkError(t,e,n=!1,i,r){let s=`A network ${n?"timeout":"error"+(i?" (status "+i.code+")":"")} occurred while loading ${t.type}`;t.type===h?s+=`: ${t.level} id: ${t.id}`:t.type!==c&&t.type!==d||(s+=` id: ${t.id} group-id: "${t.groupId}"`);const f=new Error(s);this.hls.logger.warn(`[playlist-loader]: ${s}`);let p=o.UNKNOWN,g=!1;const _=this.getInternalLoader(t);switch(t.type){case u:p=n?o.MANIFEST_LOAD_TIMEOUT:o.MANIFEST_LOAD_ERROR,g=!0;break;case h:p=n?o.LEVEL_LOAD_TIMEOUT:o.LEVEL_LOAD_ERROR,g=!1;break;case c:p=n?o.AUDIO_TRACK_LOAD_TIMEOUT:o.AUDIO_TRACK_LOAD_ERROR,g=!1;break;case d:p=n?o.SUBTITLE_TRACK_LOAD_TIMEOUT:o.SUBTITLE_LOAD_ERROR,g=!1}_&&this.resetInternalLoader(t.type);const m={type:a.NETWORK_ERROR,details:p,fatal:g,url:t.url,loader:_,context:t,error:f,networkDetails:e,stats:r};if(i){const n=(null==e?void 0:e.url)||t.url;m.response=E({url:n,data:void 0},i)}this.hls.trigger(l.ERROR,m)}handlePlaylistLoaded(t,e,n,i,r,s){const p=this.hls,{type:g,level:_,levelOrTrack:m,id:v,groupId:y,deliveryDirectives:b}=i,E=ll(e,i),w=ol(i);let T="number"==typeof i.level&&w===f?_:void 0;const k=t.playlistParsingError;if(k){if(this.hls.logger.warn(`${k} ${t.url}`),!p.config.ignorePlaylistParsingErrors)return void p.trigger(l.ERROR,{type:a.NETWORK_ERROR,details:o.LEVEL_PARSING_ERROR,fatal:!1,url:E,error:k,reason:k.message,response:e,context:i,level:T,parent:w,networkDetails:r,stats:n});t.playlistParsingError=null}if(t.fragments.length)switch(t.live&&s&&(s.getCacheAge&&(t.ageHeader=s.getCacheAge()||0),s.getCacheAge&&!isNaN(t.ageHeader)||(t.ageHeader=0)),g){case u:case h:if(T)if(m){if(m!==p.levels[T]){const t=p.levels.indexOf(m);t>-1&&(T=t)}}else T=0;p.trigger(l.LEVEL_LOADED,{details:t,levelInfo:m||p.levels[0],level:T||0,id:v||0,stats:n,networkDetails:r,deliveryDirectives:b,withoutMultiVariant:g===u});break;case c:p.trigger(l.AUDIO_TRACK_LOADED,{details:t,track:m,id:v||0,groupId:y||"",stats:n,networkDetails:r,deliveryDirectives:b});break;case d:p.trigger(l.SUBTITLE_TRACK_LOADED,{details:t,track:m,id:v||0,groupId:y||"",stats:n,networkDetails:r,deliveryDirectives:b})}else{const s=t.playlistParsingError=new Error("No Segments found in Playlist");p.trigger(l.ERROR,{type:a.NETWORK_ERROR,details:o.LEVEL_EMPTY_ERROR,fatal:!1,url:E,error:s,reason:s.message,response:e,context:i,level:T,parent:w,networkDetails:r,stats:n})}}}class hl{static get version(){return Bi}static isMSESupported(){return il()}static isSupported(){return function(){if(!il())return!1;const t=x();return"function"==typeof(null==t?void 0:t.isTypeSupported)&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some((e=>t.isTypeSupported(Ct(e,"video"))))||["mp4a.40.2","fLaC"].some((e=>t.isTypeSupported(Ct(e,"audio")))))}()}static getMediaSource(){return x()}static get Events(){return l}static get MetadataSchema(){return or}static get ErrorTypes(){return a}static get ErrorDetails(){return o}static get DefaultConfig(){return hl.defaultConfig?hl.defaultConfig:Ko}static set DefaultConfig(t){hl.defaultConfig=t}constructor(t={}){this.config=void 0,this.userConfig=void 0,this.logger=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new Ni,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 e=this.logger=function(t,e,n){const i=S();if("object"==typeof console&&!0===t||"object"==typeof t){const r=["debug","log","info","warn","error"];r.forEach((e=>{i[e]=A(e,t,n)}));try{i.log(`Debug logs enabled for "${e}" in hls.js version 1.6.12`)}catch(t){return S()}r.forEach((e=>{D[e]=A(e,t)}))}else y(D,i);return i}(t.debug||!1,"Hls instance",t.assetPlayerId),n=this.config=function(t,e,n){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(void 0!==e.liveMaxLatencyDurationCount&&(void 0===e.liveSyncDurationCount||e.liveMaxLatencyDurationCount<=e.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(void 0!==e.liveMaxLatencyDuration&&(void 0===e.liveSyncDuration||e.liveMaxLatencyDuration<=e.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');const i=jo(t),r=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return["manifest","level","frag"].forEach((t=>{const s=`${"level"===t?"playlist":t}LoadPolicy`,a=void 0===e[s],o=[];r.forEach((n=>{const r=`${t}Loading${n}`,l=e[r];if(void 0!==l&&a){o.push(r);const t=i[s].default;switch(e[s]={default:t},n){case"TimeOut":t.maxLoadTimeMs=l,t.maxTimeToFirstByteMs=l;break;case"MaxRetry":t.errorRetry.maxNumRetry=l,t.timeoutRetry.maxNumRetry=l;break;case"RetryDelay":t.errorRetry.retryDelayMs=l,t.timeoutRetry.retryDelayMs=l;break;case"MaxRetryTimeout":t.errorRetry.maxRetryDelayMs=l,t.timeoutRetry.maxRetryDelayMs=l}}})),o.length&&n.warn(`hls.js config: "${o.join('", "')}" setting(s) are deprecated, use "${s}": ${ne(e[s])}`)})),E(E({},i),e)}(hl.DefaultConfig,t,e);this.userConfig=t,n.progressive&&Vo(n,e);const{abrController:i,bufferController:r,capLevelController:s,errorController:a,fpsController:o}=n,u=new a(this),h=this.abrController=new i(this),c=new Ne(this),d=n.interstitialsController,f=d?this.interstitialsController=new d(this,hl):null,p=this.bufferController=new r(this,c),g=this.capLevelController=new s(this),_=new o(this),m=new ul(this),v=n.contentSteeringController,b=v?new v(this):null,w=this.levelController=new tl(this,b),T=new Xo(this),k=new sl(this.config,this.logger),C=this.streamController=new rl(this,c,k),x=this.gapController=new Zo(this,c);g.setStreamController(C),_.setStreamController(C);const R=[m,w,C];f&&R.splice(1,0,f),b&&R.splice(1,0,b),this.networkControllers=R;const L=[h,p,x,g,_,T,c];this.audioTrackController=this.createController(n.audioTrackController,R);const I=n.audioStreamController;I&&R.push(this.audioStreamController=new I(this,c,k)),this.subtitleTrackController=this.createController(n.subtitleTrackController,R);const P=n.subtitleStreamController;P&&R.push(this.subtititleStreamController=new P(this,c,k)),this.createController(n.timelineController,L),k.emeController=this.emeController=this.createController(n.emeController,L),this.cmcdController=this.createController(n.cmcdController,L),this.latencyController=this.createController(Jo,L),this.coreComponents=L,R.push(u);const O=u.onErrorOut;"function"==typeof O&&this.on(l.ERROR,O,u),this.on(l.MANIFEST_LOADED,m.onManifestLoaded,m)}createController(t,e){if(t){const n=new t(this);return e&&e.push(n),n}return null}on(t,e,n=this){this._emitter.on(t,e,n)}once(t,e,n=this){this._emitter.once(t,e,n)}removeAllListeners(t){this._emitter.removeAllListeners(t)}off(t,e,n=this,i){this._emitter.off(t,e,n,i)}listeners(t){return this._emitter.listeners(t)}emit(t,e,n){return this._emitter.emit(t,e,n)}trigger(t,e){if(this.config.debug)return this.emit(t,t,e);try{return this.emit(t,t,e)}catch(e){if(this.logger.error("An internal error happened while handling event "+t+'. Error message: "'+e.message+'". Here is a stacktrace:',e),!this.triggeringException){this.triggeringException=!0;const n=t===l.ERROR;this.trigger(l.ERROR,{type:a.OTHER_ERROR,details:o.INTERNAL_EXCEPTION,fatal:n,event:t,error:e}),this.triggeringException=!1}}return!1}listenerCount(t){return this._emitter.listenerCount(t)}destroy(){this.logger.log("destroy"),this.trigger(l.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 t=this.config;t.xhrSetup=t.fetchSetup=void 0,this.userConfig=null}attachMedia(t){if(!t||"media"in t&&!t.media){const e=new Error(`attachMedia failed: invalid argument (${t})`);return void this.trigger(l.ERROR,{type:a.OTHER_ERROR,details:o.ATTACH_MEDIA_ERROR,fatal:!0,error:e})}this.logger.log("attachMedia"),this._media&&(this.logger.warn("media must be detached before attaching"),this.detachMedia());const e="media"in t,n=e?t.media:t,i=e?t:{media:n};this._media=n,this.trigger(l.MEDIA_ATTACHING,i)}detachMedia(){this.logger.log("detachMedia"),this.trigger(l.MEDIA_DETACHING,{}),this._media=null}transferMedia(){this._media=null;const t=this.bufferController.transferMedia();return this.trigger(l.MEDIA_DETACHING,{transferMedia:t}),t}loadSource(t){this.stopLoad();const e=this.media,n=this._url,i=this._url=K.buildAbsoluteURL(self.location.href,t,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.logger.log(`loadSource:${i}`),e&&n&&(n!==i||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(e)),this.trigger(l.MANIFEST_LOADING,{url:t})}get url(){return this._url}get hasEnoughToStart(){return this.streamController.hasEnoughToStart}get startPosition(){return this.streamController.startPositionValue}startLoad(t=-1,e){this.logger.log(`startLoad(${t+(e?", <skip seek to start>":"")})`),this.started=!0,this.resumeBuffering();for(let n=0;n<this.networkControllers.length&&(this.networkControllers[n].startLoad(t,e),this.started&&this.networkControllers);n++);}stopLoad(){this.logger.log("stopLoad"),this.started=!1;for(let t=0;t<this.networkControllers.length&&(this.networkControllers[t].stopLoad(),!this.started&&this.networkControllers);t++);}get loadingEnabled(){return this.started}get bufferingEnabled(){return this.streamController.bufferingEnabled}resumeBuffering(){this.bufferingEnabled||(this.logger.log("resume buffering"),this.networkControllers.forEach((t=>{t.resumeBuffering&&t.resumeBuffering()})))}pauseBuffering(){this.bufferingEnabled&&(this.logger.log("pause buffering"),this.networkControllers.forEach((t=>{t.pauseBuffering&&t.pauseBuffering()})))}get inFlightFragments(){const t={[f]:this.streamController.inFlightFrag};return this.audioStreamController&&(t[p]=this.audioStreamController.inFlightFrag),this.subtititleStreamController&&(t[g]=this.subtititleStreamController.inFlightFrag),t}swapAudioCodec(){this.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()}recoverMediaError(){this.logger.log("recoverMediaError");const t=this._media,e=null==t?void 0:t.currentTime;this.detachMedia(),t&&(this.attachMedia(t),e&&this.startLoad(e))}removeLevel(t){this.levelController.removeLevel(t)}get sessionId(){let t=this._sessionId;return t||(t=this._sessionId=function(){try{return crypto.randomUUID()}catch(t){try{const t=URL.createObjectURL(new Blob),e=t.toString();return URL.revokeObjectURL(t),e.slice(e.lastIndexOf("/")+1)}catch(t){let e=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(t=>{const n=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"==t?n:3&n|8).toString(16)}))}}}()),t}get levels(){const t=this.levelController.levels;return t||[]}get latestLevelDetails(){return this.streamController.getLevelDetails()||null}get loadLevelObj(){return this.levelController.loadLevelObj}get currentLevel(){return this.streamController.currentLevel}set currentLevel(t){this.logger.log(`set currentLevel:${t}`),this.levelController.manualLevel=t,this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(t){this.logger.log(`set nextLevel:${t}`),this.levelController.manualLevel=t,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(t){this.logger.log(`set loadLevel:${t}`),this.levelController.manualLevel=t}get nextLoadLevel(){return this.levelController.nextLoadLevel}set nextLoadLevel(t){this.levelController.nextLoadLevel=t}get firstLevel(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)}set firstLevel(t){this.logger.log(`set firstLevel:${t}`),this.levelController.firstLevel=t}get startLevel(){const t=this.levelController.startLevel;return-1===t&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:t}set startLevel(t){this.logger.log(`set startLevel:${t}`),-1!==t&&(t=Math.max(t,this.minAutoLevel)),this.levelController.startLevel=t}get capLevelToPlayerSize(){return this.config.capLevelToPlayerSize}set capLevelToPlayerSize(t){const e=!!t;e!==this.config.capLevelToPlayerSize&&(e?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=e)}get autoLevelCapping(){return this._autoLevelCapping}get bandwidthEstimate(){const{bwEstimator:t}=this.abrController;return t?t.getEstimate():NaN}set bandwidthEstimate(t){this.abrController.resetEstimator(t)}get abrEwmaDefaultEstimate(){const{bwEstimator:t}=this.abrController;return t?t.defaultEstimate:NaN}get ttfbEstimate(){const{bwEstimator:t}=this.abrController;return t?t.getEstimateTTFB():NaN}set autoLevelCapping(t){this._autoLevelCapping!==t&&(this.logger.log(`set autoLevelCapping:${t}`),this._autoLevelCapping=t,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(t){(function(t){return zt.indexOf(t)>-1})(t)&&this._maxHdcpLevel!==t&&(this._maxHdcpLevel=t,this.levelController.checkMaxAutoUpdated())}get autoLevelEnabled(){return-1===this.levelController.manualLevel}get manualLevel(){return this.levelController.manualLevel}get minAutoLevel(){const{levels:t,config:{minAutoBitrate:e}}=this;if(!t)return 0;const n=t.length;for(let i=0;i<n;i++)if(t[i].maxBitrate>=e)return i;return 0}get maxAutoLevel(){const{levels:t,autoLevelCapping:e,maxHdcpLevel:n}=this;let i;if(i=-1===e&&null!=t&&t.length?t.length-1:e,n)for(let e=i;e--;){const i=t[e].attrs["HDCP-LEVEL"];if(i&&i<=n)return e}return i}get firstAutoLevel(){return this.abrController.firstAutoLevel}get nextAutoLevel(){return this.abrController.nextAutoLevel}set nextAutoLevel(t){this.abrController.nextAutoLevel=t}get playingDate(){return this.streamController.currentProgramDateTime}get mainForwardBufferInfo(){return this.streamController.getMainFwdBufferInfo()}get maxBufferLength(){return this.streamController.maxBufferLength}setAudioOption(t){var e;return(null==(e=this.audioTrackController)?void 0:e.setAudioOption(t))||null}setSubtitleOption(t){var e;return(null==(e=this.subtitleTrackController)?void 0:e.setSubtitleOption(t))||null}get allAudioTracks(){const t=this.audioTrackController;return t?t.allAudioTracks:[]}get audioTracks(){const t=this.audioTrackController;return t?t.audioTracks:[]}get audioTrack(){const t=this.audioTrackController;return t?t.audioTrack:-1}set audioTrack(t){const e=this.audioTrackController;e&&(e.audioTrack=t)}get allSubtitleTracks(){const t=this.subtitleTrackController;return t?t.allSubtitleTracks:[]}get subtitleTracks(){const t=this.subtitleTrackController;return t?t.subtitleTracks:[]}get subtitleTrack(){const t=this.subtitleTrackController;return t?t.subtitleTrack:-1}get media(){return this._media}set subtitleTrack(t){const e=this.subtitleTrackController;e&&(e.subtitleTrack=t)}get subtitleDisplay(){const t=this.subtitleTrackController;return!!t&&t.subtitleDisplay}set subtitleDisplay(t){const e=this.subtitleTrackController;e&&(e.subtitleDisplay=t)}get lowLatencyMode(){return this.config.lowLatencyMode}set lowLatencyMode(t){this.config.lowLatencyMode=t}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(t){this.latencyController.targetLatency=t}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(t){this.levelController.pathwayPriority=t}get bufferedToEnd(){var t;return!(null==(t=this.bufferController)||!t.bufferedToEnd)}get interstitialsManager(){var t;return(null==(t=this.interstitialsController)?void 0:t.interstitialsManager)||null}getMediaDecodingInfo(t,e=this.allAudioTracks){return jt(t,re(e),navigator.mediaCapabilities)}}hl.defaultConfig=void 0}}]);