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.
1 line
1.1 MiB
1 line
1.1 MiB
(self.webpackChunk=self.webpackChunk||[]).push([[6444],{65030:function(e,t,n){"use strict";n.d(t,{Z:function(){return z}});var i=n(33885),r=n(42978),s=n(75931),a=n(43403),o=n(92310),l=n.n(o),u=n(29301),c=n(76846),h=n(96452),d=n(6089),f=n(80402),p=n(34280),_=n(49658),g=n(59301),m=n(54476),v=n(77900),y=n(8654);function b(e){var t=e.prefixCls,n=e.align,i=e.arrow,r=e.arrowPos,s=i||{},a=s.className,o=s.content,u=r.x,c=void 0===u?0:u,h=r.y,d=void 0===h?0:h,f=g.useRef();if(!n||!n.points)return null;var p={position:"absolute"};if(!1!==n.autoArrow){var _=n.points[0],m=n.points[1],v=_[0],y=_[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=c}return g.createElement("div",{ref:f,className:l()("".concat(t,"-arrow"),a),style:p},o)}function E(e){var t=e.prefixCls,n=e.open,i=e.zIndex,r=e.mask,s=e.motion;return r?g.createElement(v.default,(0,m.Z)({},s,{motionAppear:!0,visible:n,removeOnLeave:!0}),(function(e){var n=e.className;return g.createElement("div",{style:{zIndex:i},className:l()("".concat(t,"-mask"),n)})})):null}var w=g.memo((function(e){return e.children}),(function(e,t){return t.cache}));var k=g.forwardRef((function(e,t){var n=e.popup,s=e.className,a=e.prefixCls,o=e.style,c=e.target,h=e.onVisibleChanged,d=e.open,f=e.keepDom,_=e.fresh,k=e.onClick,S=e.mask,T=e.arrow,A=e.arrowPos,C=e.align,R=e.motion,L=e.maskMotion,x=e.forceRender,I=e.getPopupContainer,D=e.autoDestroy,P=e.portal,O=e.zIndex,M=e.onMouseEnter,N=e.onMouseLeave,F=e.onPointerEnter,B=e.onPointerDownCapture,U=e.ready,K=e.offsetX,$=e.offsetY,G=e.offsetR,j=e.offsetB,V=e.onAlign,Z=e.onPrepare,H=e.stretch,z=e.targetWidth,W=e.targetHeight,q="function"==typeof n?n():n,Y=d||f,X=(null==I?void 0:I.length)>0,Q=g.useState(!I||!X),J=(0,r.Z)(Q,2),ee=J[0],te=J[1];if((0,p.Z)((function(){!ee&&X&&c&&te(!0)}),[ee,X,c]),!ee)return null;var ne="auto",ie={left:"-1000vw",top:"-1000vh",right:ne,bottom:ne};if(U||!d){var re,se=C.points,ae=C.dynamicInset||(null===(re=C._experimental)||void 0===re?void 0:re.dynamicInset),oe=ae&&"r"===se[0][1],le=ae&&"b"===se[0][0];oe?(ie.right=G,ie.left=ne):(ie.left=K,ie.right=ne),le?(ie.bottom=j,ie.top=ne):(ie.top=$,ie.bottom=ne)}var ue={};return H&&(H.includes("height")&&W?ue.height=W:H.includes("minHeight")&&W&&(ue.minHeight=W),H.includes("width")&&z?ue.width=z:H.includes("minWidth")&&z&&(ue.minWidth=z)),d||(ue.pointerEvents="none"),g.createElement(P,{open:x||Y,getContainer:I&&function(){return I(c)},autoDestroy:D},g.createElement(E,{prefixCls:a,open:d,zIndex:O,mask:S,motion:L}),g.createElement(u.Z,{onResize:V,disabled:!d},(function(e){return g.createElement(v.default,(0,m.Z)({motionAppear:!0,motionEnter:!0,motionLeave:!0,removeOnLeave:!1,forceRender:x,leavedClassName:"".concat(a,"-hidden")},R,{onAppearPrepare:Z,onEnterPrepare:Z,visible:d,onVisibleChanged:function(e){var t;null==R||null===(t=R.onVisibleChanged)||void 0===t||t.call(R,e),h(e)}}),(function(n,r){var u=n.className,c=n.style,h=l()(a,u,s);return g.createElement("div",{ref:(0,y.sQ)(e,t,r),className:h,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")},ie),ue),c),{},{boxSizing:"border-box",zIndex:O},o),onMouseEnter:M,onMouseLeave:N,onPointerEnter:F,onClick:k,onPointerDownCapture:B},T&&g.createElement(b,{prefixCls:a,arrow:T,arrowPos:A,align:C}),g.createElement(w,{cache:!d&&!_},q))}))})))}));var S=g.forwardRef((function(e,t){var n=e.children,i=e.getTriggerDOMNode,r=(0,y.Yr)(n),s=g.useCallback((function(e){(0,y.mH)(t,i?i(e):e)}),[i]),a=(0,y.x1)(s,(0,y.C4)(n));return r?g.cloneElement(n,{ref:a}):n})),T=g.createContext(null);function A(e){return e?Array.isArray(e)?e:[e]:[]}function C(e,t,n,i){return g.useMemo((function(){var r=A(null!=n?n:t),s=A(null!=i?i:t),a=new Set(r),o=new Set(s);return e&&(a.has("hover")&&(a.delete("hover"),a.add("click")),o.has("hover")&&(o.delete("hover"),o.add("click"))),[a,o]}),[e,t,n,i])}var R=n(29194);function L(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2?arguments[2]:void 0;return n?e[0]===t[0]:e[0]===t[0]&&e[1]===t[1]}function x(e,t,n,i){for(var r=n.points,s=Object.keys(e),a=0;a<s.length;a+=1){var o,l=s[a];if(L(null===(o=e[l])||void 0===o?void 0:o.points,r,i))return"".concat(t,"-placement-").concat(l)}return""}function I(e,t,n,i){return t||(n?{motionName:"".concat(e,"-").concat(n)}:i?{motionName:i}:null)}function D(e){return e.ownerDocument.defaultView}function P(e){for(var t=[],n=null==e?void 0:e.parentElement,i=["hidden","scroll","clip","auto"];n;){var r=D(n).getComputedStyle(n);[r.overflowX,r.overflowY,r.overflow].some((function(e){return i.includes(e)}))&&t.push(n),n=n.parentElement}return t}function O(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return Number.isNaN(e)?t:e}function M(e){return O(parseFloat(e),0)}function N(e,t){var n=(0,i.Z)({},e);return(t||[]).forEach((function(e){if(!(e instanceof HTMLBodyElement||e instanceof HTMLHtmlElement)){var t=D(e).getComputedStyle(e),i=t.overflow,r=t.overflowClipMargin,s=t.borderTopWidth,a=t.borderBottomWidth,o=t.borderLeftWidth,l=t.borderRightWidth,u=e.getBoundingClientRect(),c=e.offsetHeight,h=e.clientHeight,d=e.offsetWidth,f=e.clientWidth,p=M(s),_=M(a),g=M(o),m=M(l),v=O(Math.round(u.width/d*1e3)/1e3),y=O(Math.round(u.height/c*1e3)/1e3),b=(d-f-g-m)*v,E=(c-h-p-_)*y,w=p*y,k=_*y,S=g*v,T=m*v,A=0,C=0;if("clip"===i){var R=M(r);A=R*v,C=R*y}var L=u.x+S-A,x=u.y+w-C,I=L+u.width+2*A-S-T-b,P=x+u.height+2*C-w-k-E;n.left=Math.max(n.left,L),n.top=Math.max(n.top,x),n.right=Math.min(n.right,I),n.bottom=Math.min(n.bottom,P)}})),n}function F(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n="".concat(t),i=n.match(/^(.*)\%$/);return i?e*(parseFloat(i[1])/100):parseFloat(n)}function B(e,t){var n=t||[],i=(0,r.Z)(n,2),s=i[0],a=i[1];return[F(e.width,s),F(e.height,a)]}function U(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return[e[0],e[1]]}function K(e,t){var n,i=t[0],r=t[1];return n="t"===i?e.y:"b"===i?e.y+e.height:e.y+e.height/2,{x:"l"===r?e.x:"r"===r?e.x+e.width:e.x+e.width/2,y:n}}function $(e,t){var n={t:"b",b:"t",l:"r",r:"l"};return e.map((function(e,i){return i===t?n[e]||"c":e})).join("")}function G(e,t,n,s,a,o,l){var u=g.useState({ready:!1,offsetX:0,offsetY:0,offsetR:0,offsetB:0,arrowX:0,arrowY:0,scaleX:1,scaleY:1,align:a[s]||{}}),h=(0,r.Z)(u,2),f=h[0],_=h[1],m=g.useRef(0),v=g.useMemo((function(){return t?P(t):[]}),[t]),y=g.useRef({});e||(y.current={});var b=(0,d.Z)((function(){if(t&&n&&e){var u,h,d,f,p,g=t,m=g.ownerDocument,b=D(g),E=b.getComputedStyle(g).position,w=g.style.left,k=g.style.top,S=g.style.right,T=g.style.bottom,A=g.style.overflow,C=(0,i.Z)((0,i.Z)({},a[s]),o),L=m.createElement("div");if(null===(u=g.parentElement)||void 0===u||u.appendChild(L),L.style.left="".concat(g.offsetLeft,"px"),L.style.top="".concat(g.offsetTop,"px"),L.style.position=E,L.style.height="".concat(g.offsetHeight,"px"),L.style.width="".concat(g.offsetWidth,"px"),g.style.left="0",g.style.top="0",g.style.right="auto",g.style.bottom="auto",g.style.overflow="hidden",Array.isArray(n))p={x:n[0],y:n[1],width:0,height:0};else{var x,I,P=n.getBoundingClientRect();P.x=null!==(x=P.x)&&void 0!==x?x:P.left,P.y=null!==(I=P.y)&&void 0!==I?I:P.top,p={x:P.x,y:P.y,width:P.width,height:P.height}}var M=g.getBoundingClientRect(),F=b.getComputedStyle(g),G=F.height,j=F.width;M.x=null!==(h=M.x)&&void 0!==h?h:M.left,M.y=null!==(d=M.y)&&void 0!==d?d:M.top;var V=m.documentElement,Z=V.clientWidth,H=V.clientHeight,z=V.scrollWidth,W=V.scrollHeight,q=V.scrollTop,Y=V.scrollLeft,X=M.height,Q=M.width,J=p.height,ee=p.width,te={left:0,top:0,right:Z,bottom:H},ne={left:-Y,top:-q,right:z-Y,bottom:W-q},ie=C.htmlRegion,re="visible",se="visibleFirst";"scroll"!==ie&&ie!==se&&(ie=re);var ae=ie===se,oe=N(ne,v),le=N(te,v),ue=ie===re?le:oe,ce=ae?le:ue;g.style.left="auto",g.style.top="auto",g.style.right="0",g.style.bottom="0";var he=g.getBoundingClientRect();g.style.left=w,g.style.top=k,g.style.right=S,g.style.bottom=T,g.style.overflow=A,null===(f=g.parentElement)||void 0===f||f.removeChild(L);var de=O(Math.round(Q/parseFloat(j)*1e3)/1e3),fe=O(Math.round(X/parseFloat(G)*1e3)/1e3);if(0===de||0===fe||(0,c.Sh)(n)&&!(0,R.Z)(n))return;var pe=C.offset,_e=C.targetOffset,ge=B(M,pe),me=(0,r.Z)(ge,2),ve=me[0],ye=me[1],be=B(p,_e),Ee=(0,r.Z)(be,2),we=Ee[0],ke=Ee[1];p.x-=we,p.y-=ke;var Se=C.points||[],Te=(0,r.Z)(Se,2),Ae=Te[0],Ce=U(Te[1]),Re=U(Ae),Le=K(p,Ce),xe=K(M,Re),Ie=(0,i.Z)({},C),De=Le.x-xe.x+ve,Pe=Le.y-xe.y+ye;function At(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:ue,i=M.x+e,r=M.y+t,s=i+Q,a=r+X,o=Math.max(i,n.left),l=Math.max(r,n.top),u=Math.min(s,n.right),c=Math.min(a,n.bottom);return Math.max(0,(u-o)*(c-l))}var Oe,Me,Ne,Fe,Be=At(De,Pe),Ue=At(De,Pe,le),Ke=K(p,["t","l"]),$e=K(M,["t","l"]),Ge=K(p,["b","r"]),je=K(M,["b","r"]),Ve=C.overflow||{},Ze=Ve.adjustX,He=Ve.adjustY,ze=Ve.shiftX,We=Ve.shiftY,qe=function(e){return"boolean"==typeof e?e:e>=0};function Ct(){Oe=M.y+Pe,Me=Oe+X,Ne=M.x+De,Fe=Ne+Q}Ct();var Ye=qe(He),Xe=Re[0]===Ce[0];if(Ye&&"t"===Re[0]&&(Me>ce.bottom||y.current.bt)){var Qe=Pe;Xe?Qe-=X-J:Qe=Ke.y-je.y-ye;var Je=At(De,Qe),et=At(De,Qe,le);Je>Be||Je===Be&&(!ae||et>=Ue)?(y.current.bt=!0,Pe=Qe,ye=-ye,Ie.points=[$(Re,0),$(Ce,0)]):y.current.bt=!1}if(Ye&&"b"===Re[0]&&(Oe<ce.top||y.current.tb)){var tt=Pe;Xe?tt+=X-J:tt=Ge.y-$e.y-ye;var nt=At(De,tt),it=At(De,tt,le);nt>Be||nt===Be&&(!ae||it>=Ue)?(y.current.tb=!0,Pe=tt,ye=-ye,Ie.points=[$(Re,0),$(Ce,0)]):y.current.tb=!1}var rt=qe(Ze),st=Re[1]===Ce[1];if(rt&&"l"===Re[1]&&(Fe>ce.right||y.current.rl)){var at=De;st?at-=Q-ee:at=Ke.x-je.x-ve;var ot=At(at,Pe),lt=At(at,Pe,le);ot>Be||ot===Be&&(!ae||lt>=Ue)?(y.current.rl=!0,De=at,ve=-ve,Ie.points=[$(Re,1),$(Ce,1)]):y.current.rl=!1}if(rt&&"r"===Re[1]&&(Ne<ce.left||y.current.lr)){var ut=De;st?ut+=Q-ee:ut=Ge.x-$e.x-ve;var ct=At(ut,Pe),ht=At(ut,Pe,le);ct>Be||ct===Be&&(!ae||ht>=Ue)?(y.current.lr=!0,De=ut,ve=-ve,Ie.points=[$(Re,1),$(Ce,1)]):y.current.lr=!1}Ct();var dt=!0===ze?0:ze;"number"==typeof dt&&(Ne<le.left&&(De-=Ne-le.left-ve,p.x+ee<le.left+dt&&(De+=p.x-le.left+ee-dt)),Fe>le.right&&(De-=Fe-le.right-ve,p.x>le.right-dt&&(De+=p.x-le.right+dt)));var ft=!0===We?0:We;"number"==typeof ft&&(Oe<le.top&&(Pe-=Oe-le.top-ye,p.y+J<le.top+ft&&(Pe+=p.y-le.top+J-ft)),Me>le.bottom&&(Pe-=Me-le.bottom-ye,p.y>le.bottom-ft&&(Pe+=p.y-le.bottom+ft)));var pt=M.x+De,_t=pt+Q,gt=M.y+Pe,mt=gt+X,vt=p.x,yt=vt+ee,bt=p.y,Et=bt+J,wt=(Math.max(pt,vt)+Math.min(_t,yt))/2-pt,kt=(Math.max(gt,bt)+Math.min(mt,Et))/2-gt;null==l||l(t,Ie);var St=he.right-M.x-(De+M.width),Tt=he.bottom-M.y-(Pe+M.height);1===de&&(De=Math.round(De),St=Math.round(St)),1===fe&&(Pe=Math.round(Pe),Tt=Math.round(Tt)),_({ready:!0,offsetX:De/de,offsetY:Pe/fe,offsetR:St/de,offsetB:Tt/fe,arrowX:wt/de,arrowY:kt/fe,scaleX:de,scaleY:fe,align:Ie})}})),E=function(){_((function(e){return(0,i.Z)((0,i.Z)({},e),{},{ready:!1})}))};return(0,p.Z)(E,[s]),(0,p.Z)((function(){e||E()}),[e]),[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 e=m.current;Promise.resolve().then((function(){m.current===e&&b()}))}]}var j=n(94480);function V(e,t,n,i,r){(0,p.Z)((function(){if(e&&t&&n){var s=n,a=P(t),o=P(s),l=D(s),u=new Set([l].concat((0,j.Z)(a),(0,j.Z)(o)));function c(){i(),r()}return u.forEach((function(e){e.addEventListener("scroll",c,{passive:!0})})),l.addEventListener("resize",c,{passive:!0}),i(),function(){u.forEach((function(e){e.removeEventListener("scroll",c),l.removeEventListener("resize",c)}))}}}),[e,t,n])}n(48736);function Z(e,t,n,i,r,s,a,o){var l=g.useRef(e);l.current=e;var u=g.useRef(!1);return g.useEffect((function(){if(t&&i&&(!r||s)){var e=function(){u.current=!1},c=function(e){var t;!l.current||a((null===(t=e.composedPath)||void 0===t||null===(t=t.call(e))||void 0===t?void 0:t[0])||e.target)||u.current||o(!1)},d=D(i);d.addEventListener("pointerdown",e,!0),d.addEventListener("mousedown",c,!0),d.addEventListener("contextmenu",c,!0);var f=(0,h.A)(n);return f&&(f.addEventListener("mousedown",c,!0),f.addEventListener("contextmenu",c,!0)),function(){d.removeEventListener("pointerdown",e,!0),d.removeEventListener("mousedown",c,!0),d.removeEventListener("contextmenu",c,!0),f&&(f.removeEventListener("mousedown",c,!0),f.removeEventListener("contextmenu",c,!0))}}}),[t,n,i,r,s]),function(){u.current=!0}}var H=["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 z=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:a.Z,t=g.forwardRef((function(t,n){var a=t.prefixCls,o=void 0===a?"rc-trigger-popup":a,m=t.children,v=t.action,y=void 0===v?"hover":v,b=t.showAction,E=t.hideAction,w=t.popupVisible,A=t.defaultPopupVisible,R=t.onPopupVisibleChange,L=t.afterPopupVisibleChange,D=t.mouseEnterDelay,P=t.mouseLeaveDelay,O=void 0===P?.1:P,M=t.focusDelay,N=t.blurDelay,F=t.mask,B=t.maskClosable,U=void 0===B||B,K=t.getPopupContainer,$=t.forceRender,j=t.autoDestroy,z=t.destroyPopupOnHide,W=t.popup,q=t.popupClassName,Y=t.popupStyle,X=t.popupPlacement,Q=t.builtinPlacements,J=void 0===Q?{}:Q,ee=t.popupAlign,te=t.zIndex,ne=t.stretch,ie=t.getPopupClassNameFromAlign,re=t.fresh,se=t.alignPoint,ae=t.onPopupClick,oe=t.onPopupAlign,le=t.arrow,ue=t.popupMotion,ce=t.maskMotion,he=t.popupTransitionName,de=t.popupAnimation,fe=t.maskTransitionName,pe=t.maskAnimation,_e=t.className,ge=t.getTriggerDOMNode,me=(0,s.Z)(t,H),ve=j||z||!1,ye=g.useState(!1),be=(0,r.Z)(ye,2),Ee=be[0],we=be[1];(0,p.Z)((function(){we((0,_.Z)())}),[]);var ke=g.useRef({}),Se=g.useContext(T),Te=g.useMemo((function(){return{registerSubPopup:function(e,t){ke.current[e]=t,null==Se||Se.registerSubPopup(e,t)}}}),[Se]),Ae=(0,f.Z)(),Ce=g.useState(null),Re=(0,r.Z)(Ce,2),Le=Re[0],xe=Re[1],Ie=g.useRef(null),De=(0,d.Z)((function(e){Ie.current=e,(0,c.Sh)(e)&&Le!==e&&xe(e),null==Se||Se.registerSubPopup(Ae,e)})),Pe=g.useState(null),Oe=(0,r.Z)(Pe,2),Me=Oe[0],Ne=Oe[1],Fe=g.useRef(null),Be=(0,d.Z)((function(e){(0,c.Sh)(e)&&Me!==e&&(Ne(e),Fe.current=e)})),Ue=g.Children.only(m),Ke=(null==Ue?void 0:Ue.props)||{},$e={},Ge=(0,d.Z)((function(e){var t,n,i=Me;return(null==i?void 0:i.contains(e))||(null===(t=(0,h.A)(i))||void 0===t?void 0:t.host)===e||e===i||(null==Le?void 0:Le.contains(e))||(null===(n=(0,h.A)(Le))||void 0===n?void 0:n.host)===e||e===Le||Object.values(ke.current).some((function(t){return(null==t?void 0:t.contains(e))||e===t}))})),je=I(o,ue,de,he),Ve=I(o,ce,pe,fe),Ze=g.useState(A||!1),He=(0,r.Z)(Ze,2),ze=He[0],We=He[1],qe=null!=w?w:ze,Ye=(0,d.Z)((function(e){void 0===w&&We(e)}));(0,p.Z)((function(){We(w||!1)}),[w]);var Xe=g.useRef(qe);Xe.current=qe;var Qe=g.useRef([]);Qe.current=[];var Je=(0,d.Z)((function(e){var t;Ye(e),(null!==(t=Qe.current[Qe.current.length-1])&&void 0!==t?t:qe)!==e&&(Qe.current.push(e),null==R||R(e))})),et=g.useRef(),tt=function(){clearTimeout(et.current)},nt=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;tt(),0===t?Je(e):et.current=setTimeout((function(){Je(e)}),1e3*t)};g.useEffect((function(){return tt}),[]);var it=g.useState(!1),rt=(0,r.Z)(it,2),st=rt[0],at=rt[1];(0,p.Z)((function(e){e&&!qe||at(!0)}),[qe]);var ot=g.useState(null),lt=(0,r.Z)(ot,2),ut=lt[0],ct=lt[1],ht=g.useState(null),dt=(0,r.Z)(ht,2),ft=dt[0],pt=dt[1],_t=function(e){pt([e.clientX,e.clientY])},gt=G(qe,Le,se&&null!==ft?ft:Me,X,J,ee,oe),mt=(0,r.Z)(gt,11),vt=mt[0],yt=mt[1],bt=mt[2],Et=mt[3],wt=mt[4],kt=mt[5],St=mt[6],Tt=mt[7],At=mt[8],Ct=mt[9],Rt=mt[10],Lt=C(Ee,y,b,E),xt=(0,r.Z)(Lt,2),It=xt[0],Dt=xt[1],Pt=It.has("click"),Ot=Dt.has("click")||Dt.has("contextMenu"),Mt=(0,d.Z)((function(){st||Rt()}));V(qe,Me,Le,Mt,(function(){Xe.current&&se&&Ot&&nt(!1)})),(0,p.Z)((function(){Mt()}),[ft,X]),(0,p.Z)((function(){!qe||null!=J&&J[X]||Mt()}),[JSON.stringify(ee)]);var Nt=g.useMemo((function(){var e=x(J,o,Ct,se);return l()(e,null==ie?void 0:ie(Ct))}),[Ct,ie,J,o,se]);g.useImperativeHandle(n,(function(){return{nativeElement:Fe.current,popupElement:Ie.current,forceAlign:Mt}}));var Ft=g.useState(0),Bt=(0,r.Z)(Ft,2),Ut=Bt[0],Kt=Bt[1],$t=g.useState(0),Gt=(0,r.Z)($t,2),jt=Gt[0],Vt=Gt[1],Zt=function(){if(ne&&Me){var e=Me.getBoundingClientRect();Kt(e.width),Vt(e.height)}};function Ht(e,t,n,i){$e[e]=function(r){var s;null==i||i(r),nt(t,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=Ke[e])||void 0===s||s.call.apply(s,[Ke,r].concat(o))}}(0,p.Z)((function(){ut&&(Rt(),ut(),ct(null))}),[ut]),(Pt||Ot)&&($e.onClick=function(e){var t;Xe.current&&Ot?nt(!1):!Xe.current&&Pt&&(_t(e),nt(!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===(t=Ke.onClick)||void 0===t||t.call.apply(t,[Ke,e].concat(i))});var zt,Wt,qt=Z(qe,Ot,Me,Le,F,U,Ge,nt),Yt=It.has("hover"),Xt=Dt.has("hover");Yt&&(Ht("onMouseEnter",!0,D,(function(e){_t(e)})),Ht("onPointerEnter",!0,D,(function(e){_t(e)})),zt=function(e){(qe||st)&&null!=Le&&Le.contains(e.target)&&nt(!0,D)},se&&($e.onMouseMove=function(e){var t;null===(t=Ke.onMouseMove)||void 0===t||t.call(Ke,e)})),Xt&&(Ht("onMouseLeave",!1,O),Ht("onPointerLeave",!1,O),Wt=function(){nt(!1,O)}),It.has("focus")&&Ht("onFocus",!0,M),Dt.has("focus")&&Ht("onBlur",!1,N),It.has("contextMenu")&&($e.onContextMenu=function(e){var t;Xe.current&&Dt.has("contextMenu")?nt(!1):(_t(e),nt(!0)),e.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===(t=Ke.onContextMenu)||void 0===t||t.call.apply(t,[Ke,e].concat(i))}),_e&&($e.className=l()(Ke.className,_e));var Qt=g.useRef(!1);Qt.current||(Qt.current=$||qe||st);var Jt=(0,i.Z)((0,i.Z)({},Ke),$e),en={};["onContextMenu","onClick","onMouseDown","onTouchStart","onMouseEnter","onMouseLeave","onFocus","onBlur"].forEach((function(e){me[e]&&(en[e]=function(){for(var t,n=arguments.length,i=new Array(n),r=0;r<n;r++)i[r]=arguments[r];null===(t=Jt[e])||void 0===t||t.call.apply(t,[Jt].concat(i)),me[e].apply(me,i)})}));var tn=g.cloneElement(Ue,(0,i.Z)((0,i.Z)({},Jt),en)),nn={x:kt,y:St},rn=le?(0,i.Z)({},!0!==le?le:{}):null;return g.createElement(g.Fragment,null,g.createElement(u.Z,{disabled:!qe,ref:Be,onResize:function(){Zt(),Mt()}},g.createElement(S,{getTriggerDOMNode:ge},tn)),Qt.current&&g.createElement(T.Provider,{value:Te},g.createElement(k,{portal:e,ref:De,prefixCls:o,popup:W,className:l()(q,Nt),style:Y,target:Me,onMouseEnter:zt,onMouseLeave:Wt,onPointerEnter:zt,zIndex:te,open:qe,keepDom:st,fresh:re,onClick:ae,onPointerDownCapture:qt,mask:F,motion:je,maskMotion:Ve,onVisibleChanged:function(e){at(!1),Rt(),null==L||L(e)},onPrepare:function(){return new Promise((function(e){Zt(),ct((function(){return e}))}))},forceRender:$,autoDestroy:ve,getPopupContainer:K,align:Ct,arrow:rn,arrowPos:nn,ready:vt,offsetX:yt,offsetY:bt,offsetR:Et,offsetB:wt,onAlign:Mt,stretch:ne,targetWidth:Ut/Tt,targetHeight:jt/At})))}));return t}(a.Z)},50184:function(e,t,n){"use strict";var i=n(82242),r=n.n(i),s=(n(59301),n(93314)),a=n(99571),o=n(37712);t.Z=function(e){var t=e.img,n=e.buttonProps,i=void 0===n?{}:n,l=e.styles,u=void 0===l?{}:l,c=e.customText,h=e.ButtonText,d=e.ButtonClick,f=e.Buttonclass,p=e.ButtonTwo,_=e.imgStyles,g=e.loading,m=void 0!==g&&g,v=e.className,y=void 0===v?"":v;return(0,o.jsxs)("section",{className:"tc animated fadeIn ".concat(y),style:r()({color:"#999",margin:"100px auto",visibility:m?"hidden":"visible"},u),children:[(0,o.jsx)("img",{src:t||s,style:r()(r()({},_),{},{pointerEvents:"none",userSelect:"none"})}),(0,o.jsx)("p",{className:"mt20 font14",children:c||"暂时还没有相关数据哦!"}),h&&(0,o.jsx)(a.ZP,r()(r()({className:f,onClick:d},i),{},{children:h})),p&&p]})}},4896:function(e,t,n){"use strict";n.d(t,{Z:function(){return k}});var i=n(82242),r=n.n(i),s=n(7557),a=n.n(s),o=n(41498),l=n.n(o),u=n(79800),c=n.n(u),h=n(59301),d={wrp:"wrp___dq7YK",bgBlack:"bgBlack___ARIUV",monaco:"monaco___VnZC3",darkBlue:"darkBlue___UprA9",close:"close___LKoWu",embed:"embed___hvpEJ"},f=n(99571),p=n(70557),_=n(54501),g=n(25399),m=n(89728),v=n(31005),y=n(50184),b=n(62233),E=n(49656),w=n(37712),k=function(e){var t,n,i,s,o,u,k=e.editOffice,S=void 0===k?"view":k,T=e.data,A=e.issaver,C=e.onSaver,R=(e.theme,e.type),L=e.filename,x=e.monacoEditor,I=e.className,D=e.style,P=e.close,O=e.onClose,M=e.hasMask,N=e.disabledDownload,F=e.onImgDimensions,B=e.showNodata,U=e.recordInfo,K=(0,h.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),$=c()(K,2),G=($[0],$[1],(0,h.useState)("")),j=c()(G,2),V=(j[0],j[1]),Z=(0,h.useState)(),H=c()(Z,2),z=H[0],W=H[1],q="build"===window.ENV?"/react/build":"",Y=location.host.startsWith("localhost")?b.Z.PROXY_SERVER:b.Z.API_SERVER,X=(0,h.useRef)();null!==(t=T)&&void 0!==t&&t.startsWith("/api")&&"txt"!==R&&(T=b.Z.API_SERVER+T);function Q(e){return J.apply(this,arguments)}function J(){return(J=l()(a()().mark((function e(t){return a()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:"pdfdata"===t.data.type&&(C(t.data.data),window.removeEventListener("message",Q,!1)),console.log("mess---:",t.data);case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}L&&x&&(x.filename=L),(0,h.useEffect)((function(){var e,t=null===(e=document.cookie)||void 0===e||null===(e=e.replace(/\s/g,""))||void 0===e?void 0:e.split(";");null==t||t.map((function(e){var t=e.split("=");"_educoder_session"===t[0]&&V(t[1])}))}),[]),(0,h.useEffect)((function(){var e;"office"===R&&(T.indexOf("bigfilescdn.")>-1||T.indexOf("bigfiles1")>-1?W({url:T,fileType:(e=T,e.substring(e.lastIndexOf("/")+1).split(".").pop()),model:T.indexOf("model=edit")?"edit":"view"}):ee())}),[R,T]);var ee=function(){var e=l()(a()().mark((function e(){var t,n,i;return a()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return console.log("data:",T),t=T,T.startsWith("http")||(t=location.origin+t),n=new URL(t).pathname.split("/").pop(),e.next=6,(0,v.gJ)({attachment_id:n});case 6:(i=e.sent).url=Y+i.url,W(i);case 9:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),te=function(){T.startsWith("http")||T.startsWith("blob:")?ne():(0,m.Sv)(L||"educoder",T,L)},ne=function(){U&&(0,E.fc)({id:null==U?void 0:U.id,watch_type:1,course_id:null==U?void 0:U.course_id}),(0,m.Nd)(L||"educoder",decodeURIComponent(T))};return(0,w.jsxs)("div",{style:r()({},D||{}),className:"".concat(M&&d.bgBlack," ").concat(R?d.wrp:"hide"),children:[P&&(0,w.jsxs)("div",{className:d.close,ref:X,children:[!!F&&(0,w.jsx)(g.Z,{title:"点击对图片进行批注",getPopupContainer:function(){return X.current},children:(0,w.jsx)("span",{onClick:function(){O(),F()},children:(0,w.jsx)("i",{className:"icon-yulanpizhu"})})}),!N&&(0,w.jsx)(g.Z,{title:"点击下载此文件",getPopupContainer:function(){return X.current},children:(0,w.jsx)("span",{onClick:ne,children:(0,w.jsx)("i",{className:"icon-quxiaozhiding"})})}),A&&(0,w.jsx)(g.Z,{title:"保存pdf并退出",getPopupContainer:function(){return X.current},children:(0,w.jsx)("span",{className:"",onClick:function(){var e=document.getElementById("pdfiframe");window.addEventListener("message",Q,!1),setTimeout((function(){e.contentWindow.postMessage("getData","*")}),300)},children:(0,w.jsx)("i",{className:"icon-baocun"})})}),(0,w.jsx)(g.Z,{title:"关闭",getPopupContainer:function(){return X.current},children:(0,w.jsx)("span",{className:"",onClick:function(){O()},children:(0,w.jsx)("i",{className:"icon-guanbi1"})})})]}),(0,w.jsx)("div",{className:"".concat(d[I]," ").concat(I," ").concat(d.monaco," ").concat("txt"===R?"show":"hide"),children:"txt"===R&&(0,w.jsx)(w.Fragment,{children:(0,w.jsx)(_.ZP,r()({},x))})}),"audio"===R&&(0,w.jsx)("audio",{src:"".concat((null===(n=T)||void 0===n?void 0:n.indexOf("http://"))>-1||(null===(i=T)||void 0===i?void 0:i.indexOf("https://"))>-1?"":"data:audio/mp3;base64,").concat(T),autoPlay:!0}),"video"===R&&(0,w.jsx)(w.Fragment,{children:(null===(s=T)||void 0===s?void 0:s.indexOf("http"))>-1?(0,w.jsx)("video",{controls:!0,src:"".concat(T),autoPlay:!0}):(0,w.jsx)("video",{controls:!0,src:"data:video/mp4;base64,".concat(T),autoPlay:!0})}),"office"===R&&z&&(0,w.jsx)("iframe",{src:"".concat(q,"/office.html?key=").concat(z.key,"&url=").concat(btoa(z.url),"&callbackUrl=").concat(Y+(z.callbackUrl||""),"&fileType=").concat(z.fileType,"&title=").concat(z.title||"","&model=").concat(S,"&officeServer=").concat(b.Z.ONLYOFFICE,"&disabledDownload=").concat(!!N)}),"html"===R&&(0,w.jsx)("iframe",{src:T+"&disposition=inline"}),"pdf"===R&&(0,w.jsx)("iframe",{id:"pdfiframe",src:"".concat(q,"/js/pdfview/index.html?filename=").concat(L||"educoder.pdf","&url=").concat(encodeURIComponent(T),"&disabledDownload=").concat(!!N,"&model=").concat(S)}),"image"===R&&(0,w.jsx)("img",{src:"".concat((null===(o=T)||void 0===o?void 0:o.indexOf("http://"))>-1||(null===(u=T)||void 0===u?void 0:u.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(T)}),("other"===R||"download"===R)&&(0,w.jsx)(w.Fragment,{children:B?(0,w.jsx)(y.Z,{customText:"当前文件不支持预览,可点击下载查看",ButtonTwo:(0,w.jsx)(f.ZP,{icon:(0,w.jsx)("i",{className:"iconfont icon-xiazai4 font14"}),type:"primary",size:"middle",onClick:te,disabled:N,children:"下载"})}):(0,w.jsxs)(f.ZP,{type:"primary",size:"middle",onClick:te,disabled:N,children:[(0,w.jsx)(p.Z,{}),"点击下载"]})}),"flowChart"===R&&(0,w.jsx)("div",{className:"embed",children:(0,w.jsx)("iframe",{src:"/drawio/src/main/webapp/viewer.html?id=".concat(T||"","&gapi=0&od=0&db=0&gh=0&gl=0"),width:"100%",height:"100%",frameBorder:"0"})})]})}},84193:function(e,t,n){"use strict";n.d(t,{Z:function(){return k}});var i=n(79800),r=n.n(i),s=n(7557),a=n.n(s),o=n(41498),l=n.n(o),u=n(59301),c=n(6767),h=n(75727),d=n(7804),f=n(80360),p=n(47389),_=n(56102),g=n(86838),m={watermark:"watermark___hNYlv",videovideo:"videovideo___ovOkV",animate__loop:"animate__loop___mvL6s",upDown:"upDown___SlgHv",container:"container___g1WYG","video-container":"video-container___XPkWR","video-controls":"video-controls___to0Zq",hide:"hide___NA3DV","video-progress":"video-progress___gqHsd",seek:"seek___iZHBm","seek-tooltip":"seek-tooltip___uWyXx","bottom-controls":"bottom-controls___uoIBm","left-controls":"left-controls___mBEx4","right-controls":"right-controls___e9L6r",rateOverlay:"rateOverlay___HHBWe",controlText:"controlText___M_BWR","volume-controls":"volume-controls___fa3mE","fullscreen-button":"fullscreen-button___ur0es","fullscreen-button1":"fullscreen-button1___rfaXm","pip-button":"pip-button___GFO8W","playback-animation":"playback-animation___ndURq",volume:"volume___OTmpP",hidden:"hidden___o7GkT"},v=n(37712);function y(e){if(isNaN(e))return{minutes:"00",seconds:"00"};var t=new Date(1e3*e).toISOString().substr(11,8);return{hour:t.substr(0,2),minutes:t.substr(3,2),seconds:t.substr(6,2)}}function b(e,t){return e-t}function E(e){e.sort(b);for(var t=0,n=0;n<e.length-1;n++){var i=Math.abs(e[n+1]-e[n]);i<21&&(t+=i)}return t}Object.defineProperty(HTMLMediaElement.prototype,"playing",{get:function(){return!!(this.currentTime>0&&!this.paused&&!this.ended&&this.readyState>2)}});var w=/(android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini)/i,k=(0,u.forwardRef)((function(e,t){var n,i=e.allow_skip,s=e.src,o=e.toLog,b=e.videoId,k=e.logWatchHistory,S=e.courseId,T=void 0===S?null:S,A=e.startTime,C=e.handlePause,R=void 0===C?function(){}:C,L=e.handlePlay,x=void 0===L?function(){}:L,I=e.handlePlayEnded,D=void 0===I?function(){}:I,P=e.autoPlay,O=void 0!==P&&P,M=e.onPlayEnded,N=void 0===M?function(){}:M,F=e.isShowWaterMark,B=void 0===F||F,U="flv"===(null==s||null===(n=s.split("."))||void 0===n?void 0:n.pop()),K=(0,u.useRef)(),$=(0,u.useRef)(),G=(0,u.useRef)(),j=(0,u.useRef)(),V=(0,u.useRef)(),Z=(0,u.useRef)(),H=(0,u.useRef)(),z=(0,u.useRef)(),W=(0,u.useRef)(),q=(0,u.useRef)(),Y=(0,u.useRef)(),X=(0,u.useRef)(),Q=(0,u.useRef)(),J=(0,u.useRef)(),ee=navigator.userAgent.toLowerCase().match(w),te=ee?ee[0]:"pc",ne=(0,u.useRef)(!1),ie=(0,p.eY)(),re=0,se=0,ae=0,oe=null,le=!1,ue=20,ce=1,he=!1,de=!1,fe=[];(0,u.useImperativeHandle)(t,(function(){return{getLastUpdatedTime:function(){return K.current.currentTime},getDuration:function(){return K.current.duration}}})),c.ZP.config({maxCount:1,getContainer:function(){return G.current}});var pe=(0,u.useCallback)((function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n={point:K.current.currentTime};function i(){return r.apply(this,arguments)}function r(){return(r=l()(a()().mark((function t(){var i;return a()().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return he=!0,t.next=3,null==k?void 0:k(n);case 3:i=t.sent,oe=i,he=!1,e&&e();case 7:case"end":return t.stop()}}),t)})))).apply(this,arguments)}oe?(n.log_id=oe,n.watch_duration=E(fe),n.total_duration=se):(T?(n.video_id=parseInt(b,10),n.course_id=T):n.video_id=b,n.duration=re,n.device=te),t&&(n.ed="1"),i()}),[b,T]);function _e(){K.current.paused?(j.current.style.display="none",V.current.style.display="block"):(j.current.style.display="block",V.current.style.display="none")}function ge(){Y.current.style.display="none",Q.current.style.display="none",X.current.style.display="none",K.current.muted||0===K.current.volume?Y.current.style.display="block":K.current.volume>0&&K.current.volume<=.5?Q.current.style.display="block":X.current.style.display="block"}(0,u.useEffect)((function(){K.current&&(j.current.style.display="none",V.current.style.display="block"),c.ZP.destroy();var e=null;return d.Z.isSupported&&U&&s&&(null==s?void 0:s.indexOf(".m3u8"))<0?(e=d.Z.createPlayer({type:"flv",volume:.8,cors:!0,url:s,muted:!1}),K.current&&(e.attachMediaElement(K.current),e.load())):K.current.setAttribute("src",s),ge(),function(){e&&(e.unload(),e.pause(),e.destroy(),e=null)}}),[K,U,s]),(0,u.useEffect)((function(){document.getElementById("play"),document.querySelectorAll(".playback-icons use");function e(){x(),A&&!ne.current&&(K.current.currentTime=A),ne.current=!0,fe.push(K.current.currentTime),le||(le=!0,o&&pe())}function t(){return n.apply(this,arguments)}function n(){return(n=l()(a()().mark((function e(){return a()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:_e(),fe.push(K.current.currentTime),o&&pe((function(){oe=null,ae=0,le=!1,he=!1,de=!1,fe=[],se=0,ce=1}),!0),N();case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function r(){Z.current.value=Math.round(K.current.currentTime),H.current.value=Math.round(K.current.currentTime)}function s(){var e,t,n,i,r,s=Math.round(null===(e=K.current)||void 0===e?void 0:e.duration);null===(t=Z.current)||void 0===t||null===(n=t.setAttribute)||void 0===n||n.call(t,"max",s),null===(i=H.current)||void 0===i||null===(r=i.setAttribute)||void 0===r||r.call(i,"max",s);var a,o,l=y(s);z.current&&(z.current.innerText="".concat(l.hour>0?l.hour+":":"").concat(l.minutes,":").concat(l.seconds),null===(a=(o=z.current).setAttribute)||void 0===a||a.call(o,"datetime","".concat(l.hour>0?" "+l.hour+" ":"").concat(l.minutes,"m ").concat(l.seconds,"s")))}function u(){try{var e=Math.round(K.current.duration);Z.current.setAttribute("max",e),H.current.setAttribute("max",e);var t=y(e);z.current.innerText="".concat(t.hour>0?t.hour+":":"").concat(t.minutes,":").concat(t.seconds),z.current.setAttribute("datetime","".concat(t.hour>0?" "+t.hour+" ":"").concat(t.minutes,"m ").concat(t.seconds,"s")),r(),function(){var e=y(Math.round(K.current.currentTime));W.current.innerText="".concat(e.hour>0?e.hour+":":"").concat(e.minutes,":").concat(e.seconds),W.current.setAttribute("datetime","".concat(e.hour>0?" "+e.hour+" ":"").concat(e.minutes,"m ").concat(e.seconds,"s"))}();var n=$.current.getBoundingClientRect();n.width,n.height,n.x,n.y;if(!de){var i=K.current.currentTime,s=i-ae;Math.abs(s)<10?(se+=Math.abs(s),ae=i,he||se-ce*ue>=0&&(ce++,fe.push(ae),o&&pe())):(ae=i,o&&pe())}}catch(e){console.log("videoplaying:",e)}}function h(){de=!0}function d(){K.current.playing&&fe.push(K.current.currentTime,ae),ae=K.current.currentTime,de=!1}function f(){(re=K.current.duration)<=20&&(ue=re/3),K.current.addEventListener("play",e)}function p(){R()}function _(e){if(i){var t=e.target.dataset.seek?e.target.dataset.seek:e.target.value;K.current.currentTime=t,H.current.value=t,Z.current.value=t}else c.ZP.warning("该视频禁止快进/后退播放")}function m(e){var t=Math.round(e.offsetX/e.target.clientWidth*parseInt(e.target.getAttribute("max"),10));Z.current.setAttribute("data-seek",t);var n=y(t);q.current.textContent="".concat(n.hour>0?n.hour+":":"").concat(n.minutes,":").concat(n.seconds);var i=K.current.getBoundingClientRect();q.current.style.left="".concat(e.pageX-i.left,"px")}function v(e){switch(e.code){case"Space":e.preventDefault(),be();break;case"ArrowRight":if(e.preventDefault(),!i){c.ZP.warning("该视频禁止快进/后退播放");break}if(K.current.currentTime>=K.current.duration)break;K.current.currentTime=parseInt(K.current.currentTime)+5,r();break;case"ArrowLeft":if(e.preventDefault(),!i){c.ZP.warning("该视频禁止快进/后退播放");break}if(0===K.current.currentTime)break;K.current.currentTime=parseInt(K.current.currentTime)-5,r();break;case"ArrowUp":e.preventDefault(),K.current.volume<1&&(K.current.volume=(parseInt(10*K.current.volume)+1)/10);break;case"ArrowDown":e.preventDefault(),K.current.volume>0&&(K.current.volume=(parseInt(10*K.current.volume)-1)/10)}}return G.current.addEventListener((0,g.gH)(),(function(e){e.preventDefault(),(0,g.vp)()?(K.current.style.width="100%",K.current.style.height="100%"):K.current.style.cssText=""})),K.current.addEventListener("canplay",f),K.current.addEventListener("ended",t),K.current.addEventListener("seeking",h),K.current.addEventListener("seeked",d),K.current.addEventListener("loadedmetadata",s),Z.current.addEventListener("mousemove",m),Z.current.addEventListener("input",_),K.current.addEventListener("timeupdate",u),K.current.addEventListener("pause",p),K.current.addEventListener("volumechange",ge),document.addEventListener("keydown",v),function(){var n,i,r,a,l,c,g,y,b,E,w,k;null===(n=K.current)||void 0===n||n.removeEventListener("canplay",f),null===(i=K.current)||void 0===i||i.removeEventListener("play",e),null===(r=K.current)||void 0===r||r.removeEventListener("ended",t),null===(a=K.current)||void 0===a||a.removeEventListener("seeking",h),null===(l=K.current)||void 0===l||l.removeEventListener("seeked",d),null===(c=Z.current)||void 0===c||c.removeEventListener("mousemove",m),null===(g=Z.current)||void 0===g||g.removeEventListener("input",_),null===(y=K.current)||void 0===y||y.removeEventListener("timeupdate",u),null===(b=K.current)||void 0===b||b.removeEventListener("pause",p),null===(E=K.current)||void 0===E||E.removeEventListener("loadedmetadata",s),null===(w=K.current)||void 0===w||w.removeEventListener("volumechange",ge),document.removeEventListener("keydown",v),null!==(k=K.current)&&void 0!==k&&k.playing&&(fe.push(ae,K.current.currentTime),o&&pe())}}),[K,s]),(0,u.useEffect)((function(){if(K.current.onended=function(){D(K)},K.current.oncontextmenu=function(){return!1},(null==s?void 0:s.indexOf(".m3u8"))>-1)if(K.current.canPlayType("application/vnd.apple.mpegurl"))K.current.src=s;else if(f.ZP.isSupported()){var e=new f.ZP;e.loadSource(s),e.attachMedia(K.current)}}),[s]);var me=(0,u.useState)(1),ve=r()(me,2),ye=(ve[0],ve[1]),be=function(){K.current.paused||K.current.ended?K.current.play():K.current.pause(),_e()};return(0,v.jsxs)("div",{style:{position:"relative"},ref:G,children:[(0,v.jsx)("div",{ref:$,className:"".concat(m.watermark," animated_alternate animate__animated_10s animate__infinite animate__stepstart ").concat(m.animate__loop),children:B&&ie?ie.login:" "}),(0,v.jsx)("div",{className:m.container,children:(0,v.jsxs)("div",{className:m["video-container"],id:"video-container",children:[(0,v.jsx)("div",{className:m["playback-animation"],id:"playback-animation",children:(0,v.jsxs)("svg",{className:m["playback-icons"],children:[(0,v.jsx)("use",{className:"hidden",href:"#play-icon"}),(0,v.jsx)("use",{href:"#pause"})]})}),(0,v.jsx)("video",{className:m.video,id:"video",preload:"auto",disablePictureInPicture:!0,ref:K,autoPlay:O}),(0,v.jsxs)("div",{className:"".concat(m["video-controls"]," "),id:"video-controls",children:[(0,v.jsxs)("div",{className:m["bottom-controls"],children:[(0,v.jsxs)("div",{className:m["left-controls"],children:[(0,v.jsx)("button",{"data-title":"播放/暂停",id:"play",onClick:be,children:(0,v.jsxs)("svg",{className:m["playback-icons"],children:[(0,v.jsx)("use",{ref:V,href:"#play-icon"}),(0,v.jsx)("use",{ref:j,style:{display:"none"},href:"#pause"})]})}),(0,v.jsxs)("div",{className:m.time,children:[(0,v.jsx)("time",{id:"time-elapsed",ref:W,children:"00:00"}),(0,v.jsx)("span",{children:" / "}),(0,v.jsx)("time",{id:"duration",ref:z,children:"00:00"})]})]}),(0,v.jsxs)("div",{className:m["right-controls"],children:[i&&(0,v.jsx)(h.Z,{placement:"top",overlayClassName:m.rateOverlay,getPopupContainer:function(e){return e.parentNode},menu:{items:[{key:"1",label:(0,v.jsx)("span",{onClick:function(){ye(1),K.current.playbackRate=1},children:"1.0x"})},{key:"2",label:(0,v.jsx)("span",{onClick:function(){ye(1.5),K.current.playbackRate=1.5},children:"1.5x"})},{key:"3",label:(0,v.jsx)("span",{onClick:function(){ye(2),K.current.playbackRate=2},children:"2.0x"})}]},children:(0,v.jsx)("div",{className:"".concat(m.controlText," mr5"),children:"倍速"})}),(0,v.jsx)(_.CopyToClipboard,{text:s,onCopy:function(){return c.ZP.success("复制成功")},children:(0,v.jsx)("button",{"data-title":"复制链接",children:(0,v.jsx)("i",{className:"icon-lianjie2 iconfont",style:{fontSize:"12px",color:"white"}})})}),(0,v.jsxs)("div",{className:m["volume-controls"],children:[(0,v.jsxs)("button",{"data-title":"开启/关闭声音",className:m["volume-button"],id:"volume-button",onClick:function(){K.current.muted=!K.current.muted,K.current.muted?(J.current.setAttribute("data-volume",volume.value),J.current.value=0):J.current.value=J.current.dataset.volume},children:[(0,v.jsx)("i",{ref:Y,className:"icon-a-bianzu8 iconfont",style:{fontSize:"14px",color:"white"}}),(0,v.jsx)("i",{ref:Q,className:"icon-shengyinkaibeifen iconfont",style:{fontSize:"14px",color:"white"}}),(0,v.jsx)("i",{ref:X,className:"icon-shengyinkai iconfont",style:{fontSize:"14px",color:"white"}})]}),(0,v.jsx)("input",{className:m.volume,id:"volume",value:"1","data-mute":"0.5",type:"range",max:"1",min:"0",step:"0.01",ref:J,style:{display:"none"},onClick:ge})]}),(0,v.jsx)("button",{"data-title":"全屏/退出全屏",className:m["fullscreen-button"],onClick:function(){(0,g.vp)()?(0,g.BU)():(0,g.Dj)(G.current)},children:(0,v.jsx)("i",{className:"icon-fangda1 iconfont",style:{fontSize:"12px",color:"white"}})})]})]}),(0,v.jsxs)("div",{className:m["video-progress"],children:[(0,v.jsx)("progress",{ref:H,value:"0",min:"0"}),(0,v.jsx)("input",{className:m.seek,ref:Z,value:"0",min:"0",type:"range",step:"1"}),(0,v.jsx)("div",{className:m["seek-tooltip"],ref:q,id:"seek-tooltip",children:"00:00"})]})]})]})}),(0,v.jsx)("svg",{style:{display:"none"},children:(0,v.jsxs)("defs",{children:[(0,v.jsx)("symbol",{id:"pause",viewBox:"0 0 24 24",children:(0,v.jsx)("path",{d:"M14.016 5.016h3.984v13.969h-3.984v-13.969zM6 18.984v-13.969h3.984v13.969h-3.984z"})}),(0,v.jsx)("symbol",{id:"play-icon",viewBox:"0 0 24 24",children:(0,v.jsx)("path",{d:"M8.016 5.016l10.969 6.984-10.969 6.984v-13.969z"})}),(0,v.jsx)("symbol",{id:"volume-high",viewBox:"0 0 24 24",children:(0,v.jsx)("path",{d:"M14.016 3.234q3.047 0.656 5.016 3.117t1.969 5.648-1.969 5.648-5.016 3.117v-2.063q2.203-0.656 3.586-2.484t1.383-4.219-1.383-4.219-3.586-2.484v-2.063zM16.5 12q0 2.813-2.484 4.031v-8.063q1.031 0.516 1.758 1.688t0.727 2.344zM3 9h3.984l5.016-5.016v16.031l-5.016-5.016h-3.984v-6z"})}),(0,v.jsx)("symbol",{id:"volume-low",viewBox:"0 0 24 24",children:(0,v.jsx)("path",{d:"M5.016 9h3.984l5.016-5.016v16.031l-5.016-5.016h-3.984v-6zM18.516 12q0 2.766-2.531 4.031v-8.063q1.031 0.516 1.781 1.711t0.75 2.32z"})}),(0,v.jsx)("symbol",{id:"volume-mute",viewBox:"0 0 24 24",children:(0,v.jsx)("path",{d:"M12 3.984v4.219l-2.109-2.109zM4.266 3l16.734 16.734-1.266 1.266-2.063-2.063q-1.547 1.313-3.656 1.828v-2.063q1.172-0.328 2.25-1.172l-4.266-4.266v6.75l-5.016-5.016h-3.984v-6h4.734l-4.734-4.734zM18.984 12q0-2.391-1.383-4.219t-3.586-2.484v-2.063q3.047 0.656 5.016 3.117t1.969 5.648q0 2.203-1.031 4.172l-1.5-1.547q0.516-1.266 0.516-2.625zM16.5 12q0 0.422-0.047 0.609l-2.438-2.438v-2.203q1.031 0.516 1.758 1.688t0.727 2.344z"})}),(0,v.jsx)("symbol",{id:"fullscreen",viewBox:"0 0 24 24",children:(0,v.jsx)("path",{d:"M14.016 5.016h4.969v4.969h-1.969v-3h-3v-1.969zM17.016 17.016v-3h1.969v4.969h-4.969v-1.969h3zM5.016 9.984v-4.969h4.969v1.969h-3v3h-1.969zM6.984 14.016v3h3v1.969h-4.969v-4.969h1.969z"})}),(0,v.jsx)("symbol",{id:"fullscreen-exit",viewBox:"0 0 24 24",children:(0,v.jsx)("path",{d:"M15.984 8.016h3v1.969h-4.969v-4.969h1.969v3zM14.016 18.984v-4.969h4.969v1.969h-3v3h-1.969zM8.016 8.016v-3h1.969v4.969h-4.969v-1.969h3zM5.016 15.984v-1.969h4.969v4.969h-1.969v-3h-3z"})}),(0,v.jsx)("symbol",{id:"pip",viewBox:"0 0 24 24",children:(0,v.jsx)("path",{d:"M21 19.031v-14.063h-18v14.063h18zM23.016 18.984q0 0.797-0.609 1.406t-1.406 0.609h-18q-0.797 0-1.406-0.609t-0.609-1.406v-14.016q0-0.797 0.609-1.383t1.406-0.586h18q0.797 0 1.406 0.586t0.609 1.383v14.016zM18.984 11.016v6h-7.969v-6h7.969z"})})]})})]})}))},54501:function(e,t,n){"use strict";n.d(t,{SV:function(){return X},ZP:function(){return Y}});var i=n(82242),r=n.n(i),s=n(37205),a=n.n(s),o=n(91232),l=n.n(o),u=n(79800),c=n.n(u),h=n(39647),d=n.n(h),f=n(7557),p=n.n(f),_=n(41498),g=n.n(_),m=n(59301),v=n(76374),y=["print","auto","break","case","char","const","continue","default","do","double","else","enum","extern","float","for","goto","if","int","long","register","return","short","signed","sizeof","static","struct","switch","typedef","union","unsigned","void","volatile","while"],b={quickKey:[{label:"main",content:["public static void main(String[] args) {","\t$0","}"].join("\n")},{label:"System.out.println",content:["System.out.println($0)"].join("\n")},{label:"System.out.print",content:["System.out.print($0)"].join("\n")}],keywords:["abstract","continue","for","new","switch","assert","default","goto","package","synchronized","boolean","do","if","private","this","break","double","implements","protected","throw","byte","else","import","public","throws","case","enum","instanceof","return","transient","catch","extends","int","short","try","char","final","interface","static","void","class","finally","long","strictfp","volatile","const","float","native","super","while","true","false"]},E={keywords:["abstract","amp","array","auto","bool","break","case","catch","char","class","const","constexpr","const_cast","continue","cpu","decltype","default","delegate","delete","do","double","dynamic_cast","each","else","enum","event","explicit","export","extern","false","final","finally","float","friend","gcnew","generic","goto","in","initonly","inline","int","interface","interior_ptr","internal","literal","long","mutable","namespace","new","noexcept","nullptr","__nullptr","operator","override","partial","pascal","pin_ptr","private","property","protected","public","ref","register","reinterpret_cast","restrict","return","safe_cast","sealed","short","signed","sizeof","static","static_assert","static_cast","struct","switch","template","this","thread_local","throw","tile_static","true","try","typedef","typeid","typename","union","unsigned","using","virtual","void","volatile","wchar_t","where","while","_asm","_based","_cdecl","_declspec","_fastcall","_if_exists","_if_not_exists","_inline","_multiple_inheritance","_pascal","_single_inheritance","_stdcall","_virtual_inheritance","_w64","__abstract","__alignof","__asm","__assume","__based","__box","__builtin_alignof","__cdecl","__clrcall","__declspec","__delegate","__event","__except","__fastcall","__finally","__forceinline","__gc","__hook","__identifier","__if_exists","__if_not_exists","__inline","__int128","__int16","__int32","__int64","__int8","__interface","__leave","__m128","__m128d","__m128i","__m256","__m256d","__m256i","__m64","__multiple_inheritance","__newslot","__nogc","__noop","__nounwind","__novtordisp","__pascal","__pin","__pragma","__property","__ptr32","__ptr64","__raise","__restrict","__resume","__sealed","__single_inheritance","__stdcall","__super","__thiscall","__try","__try_cast","__typeof","__unaligned","__unhook","__uuidof","__value","__virtual_inheritance","__w64","__wchar_t"],operators:["=",">","<","!","~","?",":","==","<=",">=","!=","&&","||","++","--","+","-","*","/","&","|","^","%","<<",">>",">>>","+=","-=","*=","/=","&=","|=","^=","%=","<<=",">>=",">>>="],quickKey:[{label:"ifelse",content:["if (${1:condition}) {","\t$0","} else {","\t","}"].join("\n")},{label:"include",content:"include<$0>"},{label:"printf",content:"printf($0)"},{label:"system",content:'system("$0")'},{label:"main",content:["int main () {","\t$0","}"].join("\n")},{label:"if",content:["if () {","\t$0","}"].join("\n")},{label:"for",content:["for(int j=0 ; j<10; j++){","\t$0","}"].join("\n")},{label:"trycatch",content:["try{","\t$0","}catch(ExceptionName e){","}"].join("\n")},{label:"using namespace std;",content:["using namespace std;"].join("\n")},{label:"include <iostream>",content:["#include <iostream>"].join("\n")},{label:"include <vector>",content:["#include <vector>"].join("\n")},{label:"include <cstdio>",content:["#include <cstdio>"].join("\n")},{label:"include <cstring>",content:["#include <cstring>"].join("\n")},{label:"include <sstream>",content:["#include <sstream>"].join("\n")},{label:"include <fstream>",content:["#include <fstream>"].join("\n")},{label:"include <map>",content:["#include <map>"].join("\n")},{label:"include <string>",content:["#include <string>"].join("\n")},{label:"include <cmath>",content:["#include <cmath>"].join("\n")}]},w={keywords:["and","as","assert","break","class","continue","def","del","elif","else","except","exec","finally","for","from","global","if","import","in","is","lambda","None","not","or","pass","raise","return","self","try","while","with","yield","int","float","long","complex","hex","abs","all","any","apply","basestring","bin","bool","buffer","bytearray","callable","chr","classmethod","cmp","coerce","compile","complex","delattr","dict","dir","divmod","enumerate","eval","execfile","file","filter","format","frozenset","getattr","globals","hasattr","hash","help","id","input","intern","isinstance","issubclass","iter","len","locals","list","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","reversed","range","raw_input","reduce","reload","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","unichr","unicode","vars","xrange","zip","True","False","__dict__","__methods__","__members__","__class__","__bases__","__name__","__mro__","__subclasses__","__init__","__import__"],quickKey:[{label:"print",content:["print($0)"].join("\n")}]},k={keywords:["asInstanceOf","catch","class","classOf","def","do","else","extends","finally","for","foreach","forSome","if","import","isInstanceOf","macro","match","new","object","package","return","throw","trait","try","type","until","val","var","while","with","yield","given","enum","then"],quickKey:[{label:"println",content:["println($0)"].join("\n")}]},S=n(53184),T=n.n(S),A={languages:["c","abap","apex","azcli","bat","cameligo","clojure","coffee","cpp","csharp","csp","css","dockerfile","fsharp","go","graphql","handlebars","html","ini","java","javascript","json","kotlin","less","lua","markdown","mips","msdax","mysql","objective-c","pascal","pascaligo","perl","pgsql","php","postiats","powerquery","powershell","pug","python","r","razor","redis","redshift","restructuredtext","ruby","rust","sb","scheme","scss","shell","solidity","sophia","sql","st","swift","tcl","twig","vb","xml","yaml'"],tables:{users:["name","id","email","phone","password"],roles:["id","name","order","created_at","updated_at","deleted_at"]}},C=function(e,t,n,i){e.languages.registerCompletionItemProvider(t,{provideCompletionItems:function(t,r){var s=t.getWordUntilPosition(r),o={startLineNumber:r.lineNumber,endLineNumber:r.lineNumber,startColumn:s.startColumn,endColumn:s.endColumn},l=t.getLineContent(r.lineNumber).substring(s.startColumn-2,s.endColumn),u=function(e,t,n,i){var r=t.getValueInRange({startLineNumber:1,startColumn:1,endLineNumber:n.lineNumber,endColumn:n.column});return Array.from(new Set(r.match(/\b\w{2,}\b/g)||[])).map((function(t){return{label:t,kind:e.languages.CompletionItemKind.Text,insertText:t,range:i}}))}(e,t,r,o);return{suggestions:[].concat(a()(u),a()(n.map((function(t){return{label:t,kind:e.languages.CompletionItemKind.Keyword,documentation:t,insertText:t,insertTextRules:e.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:o}}))),a()(i.map((function(t){return{label:t.label,kind:e.languages.CompletionItemKind.Snippet,documentation:t.content,insertText:l.startsWith("#")?t.content.replace(/#/,""):t.content,insertTextRules:e.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:o}}))))}}})},R=n(82100),L=n.n(R),x=n(29186),I=n.n(x),D=n(85573),P=n.n(D),O=function(){function e(t,n,i){var r=this;L()(this,e),this.placeholder=t,this.editor=n,this.monaco=i,n.onDidChangeModelContent((function(){return r.onDidChangeModelContent()})),this.onDidChangeModelContent()}return I()(e,[{key:"onDidChangeModelContent",value:function(){""===this.editor.getValue()?this.editor.addContentWidget(this):this.editor.removeContentWidget(this)}},{key:"getId",value:function(){return e.ID}},{key:"getDomNode",value:function(){return this.domNode||(this.domNode=document.createElement("div"),this.domNode.style.width="max-content",this.domNode.textContent=this.placeholder,this.domNode.style.fontStyle="initial",this.domNode.style.color="#D7D7D7",this.domNode.style.pointerEvents="none",this.editor.applyFontInfo(this.domNode)),this.domNode}},{key:"getPosition",value:function(){return{position:{lineNumber:1,column:1},preference:[this.monaco.editor.ContentWidgetPositionPreference.EXACT]}}},{key:"dispose",value:function(){this.editor.removeContentWidget(this)}}]),e}();P()(O,"ID","editor.widget.placeholderHint");var M=O,N=n(96236),F=n(6767),B=n(25399),U=n(89392),K=n(89794),$=n(56102),G=n(37712),j=["width","height","value","language","style","options","overrideServices","theme","onEditBlur","isCopy","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","onBreakPoint","breakPointValue","filename","errorLine","errorContent","highlightLine","openBreakPoint","placeholder","showMiniMap"];function V(e){return/^\d+$/.test(e)?"".concat(e,"px"):e}function Z(){}var H={"Python3.6":"python","Python2.7":"python",Dynamips:"cpp",Java:"java",Web:"php",Html:"html",Hive:"sql",Hadoop:"java",SDL:"cpp",PHP:"php",Matlab:"python",Git:"python",Python:"python","C/C++":"cpp","C++":"cpp",C:"cpp",Ruby:"ruby",Shell:"shell",JavaScript:"javascript",Perl6:"perl",Kotlin:"kotlin",Elixir:"elixir",Android:"java",JavaWeb:"java",Go:"go",Spark:"sql",MachineLearning:"python",Verilog:"xml","Verilog/VNC":"xml",Docker:"dockerfile","C#":"csharp",SQLite3:"sql",Oracle:"sql",Vhdl:"vhdl",R:"r",Swift:"swift",SQLServer:"mysql",MySQL:"mysql",Mongo:"sql",PostgreSql:"pgsql",Hbase:"powershell",Sqoop:"sql",Nasm:"cpp",Kafka:"java",Flink:"java",Sml:"javascript",OpenGL:"cpp",Perl5:"perl",Orange:"python",Scala:"scale",solidity:"sol"};function z(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=e;if(Array.isArray(e)){for(var n=0;n<e.length;n++){var i=H[e[n]];if(i)return i}return t[0]}return H[t]||t}var W=null,q=function(){var e=g()(p()().mark((function e(){return p()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,navigator.clipboard.writeText(" ");case 3:console.log("内容已自动复制到剪贴板:"),e.next=9;break;case 6:e.prev=6,e.t0=e.catch(0),console.error("自动复制失败:",e.t0);case 9:case"end":return e.stop()}}),e,null,[[0,6]])})));return function(){return e.apply(this,arguments)}}(),Y=function(e){var t=e.width,i=void 0===t?"100%":t,s=e.height,o=void 0===s?"100%":s,u=e.value,h=e.language,f=void 0===h?"javascript":h,_=e.style,S=void 0===_?{}:_,R=e.options,L=void 0===R?{}:R,x=e.overrideServices,I=void 0===x?{}:x,D=e.theme,P=void 0===D?"vs-dark":D,O=e.onEditBlur,H=e.isCopy,Y=void 0!==H&&H,X=e.onSave,Q=e.autoHeight,J=void 0!==Q&&Q,ee=e.forbidCopy,te=void 0!==ee&&ee,ne=e.onChange,ie=void 0===ne?Z:ne,re=e.editorDidMount,se=void 0===re?Z:re,ae=e.onFocus,oe=void 0===ae?Z:ae,le=e.onBreakPoint,ue=void 0===le?Z:le,ce=e.breakPointValue,he=void 0===ce?[]:ce,de=e.filename,fe=void 0===de?"educoder.txt":de,pe=e.errorLine,_e=e.errorContent,ge=void 0===_e?"":_e,me=e.highlightLine,ve=e.openBreakPoint,ye=void 0!==ve&&ve,be=e.placeholder,Ee=void 0===be?"":be,we=e.showMiniMap,ke=void 0===we||we,Se=(d()(e,j),(0,m.useRef)()),Te=(0,m.useRef)({}),Ae=(0,m.useRef)(),Ce=(0,m.useRef)(),Re=(0,m.useRef)([]),Le=(0,m.useRef)(!1),xe=(0,m.useRef)(),Ie=(0,m.useRef)(),De=(0,m.useRef)(!1),Pe=(0,m.useState)(!1),Oe=c()(Pe,2),Me=Oe[0],Ne=Oe[1];(0,m.useEffect)((function(){var e=K.Z.subscribe("formatDocument",(function(e){var t,n=Te.current.instance;null==n||null===(t=n.getAction)||void 0===t||t.call(n,"editor.action.formatDocument").run()}));return window.updateMonacoValue=function(e){ie(e)},e}),[]),(0,m.useEffect)((function(){var e,t=Te.current.instance;(Ce.current&&clearTimeout(Ce.current),Ce.current=setTimeout((function(){!function(){var e=Te.current.instance;if(null!=u&&e&&Me){var t=e.getModel();t&&u!==t.getValue()&&(!0,t.setValue(u),e.layout(),!1)}}()}),500),u&&null!=u&&u.length)&&(null==t||null===(e=t.updateOptions)||void 0===e||e.call(t,{lineNumbersMinChars:Math.max(Math.floor(Math.log10(u.split(/\r\n|\r|\n/g).length))+3,5)}))}),[u,Me,Te.current]),(0,m.useEffect)((function(){if(pe&&Te.current&&Te.current.instance){var e=Te.current.instance;e.changeViewZones((function(e){var t=document.createElement("div");t.style.padding="10px 20px",t.style.width="calc(100% - 20px)",t.className="my-error-line-wrp",t.innerHTML=ge,e.addZone({afterLineNumber:pe||11,heightInLines:3,domNode:t})}));var t={domNode:null,getId:function(){return"my.overlay.widget"},getDomNode:function(){return this.domNode||(this.domNode=document.createElement("div"),this.domNode.innerHTML="",this.domNode.style.width="100%",this.domNode.style.padding="20px 100px",this.domNode.style.right="0px",this.domNode.style.top="50px",this.domNode.style.position="relative",this.domNode.style.color="#333"),this.domNode},getPosition:function(){return null}};e.addOverlayWidget(t),e.revealPositionInCenter({lineNumber:20,column:1})}}),[pe,Te.current,Me]);var Fe=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;if(!e||""===e.trim())return!0;for(var n=Te.current.instance.getModel(),i=n.getLineTokens(t),r=!1,s=0;s<2;s++)1===i.getStandardTokenType(s)&&(r=!0);return r};function Be(e){(window.navigator.platform.match("Mac")?e.metaKey:e.ctrlKey)&&83==e.keyCode&&(e.preventDefault(),X())}(0,m.useEffect)((function(){var e,t=null===(e=Te.current)||void 0===e?void 0:e.instance;if(t&&Me&&te){var n=t.onDidBlurEditorWidget((function(){De.current=!1})),i=t.onDidFocusEditorText((function(){De.current=!0}));return function(){n.dispose(),i.dispose()}}}),[Te.current,Me,te]),(0,m.useEffect)((function(){var e;if(null!==(e=Te.current)&&void 0!==e&&e.instance&&Me&&ye){var t=Te.current.instance,n=t.getModel();if(!n)return;!function(){var e,i=[],r=[],s=n.getAllDecorations(),a=l()(s);try{for(a.s();!(e=a.n()).done;){var o,u=e.value;if("highlighted-line"===u.options.className)i.push(null==u||null===(o=u.range)||void 0===o?void 0:o.startLineNumber),r.push(null==u?void 0:u.id)}}catch(e){a.e(e)}finally{a.f()}if(me!==i[0]){n.deltaDecorations(r,[]);var c=n.getLineCount();me&&me<=c&&(t.deltaDecorations([],[{range:new W.Range(me,1,me,n.getLineMaxColumn(me)),options:{isWholeLine:!0,className:"highlighted-line"}}]),t.revealLineInCenter(me))}}();var i=function(){var e,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],i=[],r=[],s=n.getAllDecorations(),a=l()(s);try{for(a.s();!(e=a.n()).done;){var o,u=e.value;if("breakpoints-select"===u.options.linesDecorationsClassName)i.push(null==u||null===(o=u.range)||void 0===o?void 0:o.startLineNumber),r.push(null==u?void 0:u.id)}}catch(e){a.e(e)}finally{a.f()}if(t)return{lines:i,ids:r};ue(i)},r=function(){var e=g()(p()().mark((function e(t){var r;return p()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r={range:new W.Range(t,1,t,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints-select"}},e.next=3,n.deltaDecorations([],[r]);case 3:i();case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),s=function(){var e=g()(p()().mark((function e(r){var s,a,o,u,c;return p()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:s=[],a=t.getLineDecorations(r),o=l()(a);try{for(o.s();!(u=o.n()).done;)"breakpoints-select"===(c=u.value).options.linesDecorationsClassName&&s.push(c.id)}catch(e){o.e(e)}finally{o.f()}return e.next=6,n.deltaDecorations(s,[]);case 6:i();case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),a=function(e){var n,i=t.getLineDecorations(e),r=l()(i);try{for(r.s();!(n=r.n()).done;){if("breakpoints-select"===n.value.options.linesDecorationsClassName)return!0}}catch(e){r.e(e)}finally{r.f()}return!1};if(!(0,U.isEqual)(he,i(!0).lines)){n.deltaDecorations(i(!0).ids,[]);var o=he.map((function(e){return{range:new W.Range(e,1,e,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints-select"}}}));n.deltaDecorations([],o)}var u=t.onDidChangeModelContent((function(e){var o=t.getPosition();if(o){var l=o.lineNumber;clearTimeout(Ie.current),Ie.current=setTimeout((function(){Fe(n.getLineContent(l),l)?s(l):a(l)?(s(l),r(l)):i()}),100)}})),c=t.onMouseDown((function(e){var t;if(e.target.detail&&null!==(t=e.target)&&void 0!==t&&null!==(t=t.element)&&void 0!==t&&null!==(t=t.className)&&void 0!==t&&t.includes("line-numbers")){var i=e.target.position.lineNumber;if(Fe(n.getLineContent(i),i))return;a(i)?s(i):r(i)}})),h=function(){Re.current=t.deltaDecorations(Re.current,[])},d=t.onMouseMove((function(e){var i;if(h(),e.target.detail&&null!==(i=e.target)&&void 0!==i&&null!==(i=i.element)&&void 0!==i&&null!==(i=i.className)&&void 0!==i&&i.includes("line-numbers")){var r=e.target.position.lineNumber;if(Fe(n.getLineContent(r),r))return;!function(e){var n={range:new W.Range(e,1,e,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints-fake"}};Re.current=t.deltaDecorations(Re.current,[n])}(r)}})),f=t.onMouseLeave((function(){h()}));return function(){u.dispose(),c.dispose(),d.dispose(),f.dispose()}}}),[Te.current,Me,he,me,ye,f]),(0,m.useEffect)((function(){var e;null!==(e=Te.current)&&void 0!==e&&e.instance&&ye&&Te.current.instance.setPosition({lineNumber:0,column:0})}),[me]);var Ue=function(){if(J&&Te.current.instance){var e=Te.current.instance.getContentHeight();We(e<o?o:e)}else We(o)};var Ke=function(e){if(De.current){var t=e.keyCode,n=e.ctrlKey,i=e.metaKey,r=e.target;return"paste"!==e.type&&(67!==t&&86!==t||!i&&!n)||"TEXTAREA"!==r.nodeName||(F.ZP.warning({content:decodeURIComponent("该任务关卡设置了禁止复制粘贴,请手动输入代码。"),key:"monaco-editor-tip"}),e.preventDefault()),!1}};function $e(e,t){var n,i,r=window.URL||window.webkitURL||window,s=new Blob([t]),a=document.createElementNS("http://www.w3.org/1999/xhtml","a");a.href=r.createObjectURL(s),a.download=e,n=a,(i=document.createEvent("MouseEvents")).initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),n.dispatchEvent(i)}(0,m.useEffect)((function(){Ue()}),[Ue]),(0,m.useEffect)((function(){Se.current&&!Me&&Promise.all([n.e(8909),n.e(2460)]).then(n.bind(n,71448)).then((function(e){try{W=e,Te.current.instance=W.editor.create(Se.current,{value:u,language:z(f),theme:P,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0,autoIndent:!0,contextmenu:!0,formatOnType:!0,minimap:{enabled:ke||!1}},I);var t=Te.current.instance,n=N.BH._menuItems,i=a()(n).find((function(e){return"EditorContext"==e[0]._debugName}))[1];if(se(t,W),setTimeout((function(){Ue(),Te.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){$e(fe||"educoder.txt",t.getValue())}})}),500),Te.current.subscription=t.onDidChangeModelContent((function(e){Le.current?clearTimeout(xe.current):(Ue(),ie(t.getValue(),e)),xe.current=setTimeout((function(){Le.current=!1}),500)})),window.Monaco||function(e){A.languages.forEach((function(t){e.languages.registerDocumentFormattingEditProvider(t,{provideDocumentFormattingEdits:function(e){return g()(p()().mark((function t(){var n;return p()().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=T()(e.getValue(),{indent_size:2,indent_char:" ",max_preserve_newlines:2,preserve_newlines:!0,keep_array_indentation:!0,break_chained_methods:!1,indent_scripts:"normal",brace_style:"collapse",space_before_conditional:!0,unescape_strings:!1,jslint_happy:!1,end_with_newline:!0,wrap_line_length:0,indent_inner_html:!1,comma_first:!1,e4x:!1,indent_empty_lines:!1}),t.abrupt("return",[{range:e.getFullModelRange(),text:n}]);case 2:case"end":return t.stop()}}),t)})))()}})})),C(e,"java",b.keywords,b.quickKey),C(e,"cpp",E.keywords,E.quickKey),C(e,"c",y,[]),C(e,"python",w.keywords,w.quickKey),C(e,"scala",k.keywords,k.quickKey)}(W,z(f)),te&&(!function(e,t){var n=e._first;do{var i;t.includes(null===(i=n.element)||void 0===i||null===(i=i.command)||void 0===i?void 0:i.id)&&e._remove(n)}while(n=n.next)}(i,["editor.action.clipboardCopyWithSyntaxHighlightingAction","editor.action.quickCommand","editor.action.clipboardCopyAction","editor.action.clipboardPasteAction","editor.action.clipboardCutAction"]),Se.current.classList.add("noCopyPaste"),window.removeEventListener("keydown",Ke),window.removeEventListener("paste",Ke),window.addEventListener("keydown",Ke),window.addEventListener("paste",Ke)),window.Monaco=W,O&&t.onDidBlurEditorWidget((function(){O(t.getValue())})),oe&&t.onDidFocusEditorText((function(){te&&q(),oe(t.getValue())})),te){q();try{t.onDidPaste((function(e){var n=t.getSelection(),i=Te.current.pastePos||{};new W.Range(i.startLineNumber||n.endLineNumber,i.startColumn||n.endColumn,i.endLineNumber||n.endLineNumber,i.endColumn||n.endColumn);t.executeEdits("",[{range:e.range,text:""}])}))}catch(e){}}var r=function(){var e;return Se.current&&(e=new v.Z((function(e){var t,n=l()(e);try{for(n.s();!(t=n.n()).done;){var i=t.value;(i.target.offsetHeight>0||i.target.offsetWidth>0)&&Te.current.instance.layout()}}catch(e){n.e(e)}finally{n.f()}}))).observe(Se.current),e}();return Ee&&"string"==typeof Ee&&new M(Ee,t,W),Ne(!0),function(){var e=Te.current.instance;e.dispose();var t=e.getModel();t&&t.dispose(),Te.current.subscription&&Te.current.subscription.dispose(),r.unobserve(Se.current)}}catch(e){}}))}),[]),(0,m.useEffect)((function(){if(Te.current.instance&&Me)return document.addEventListener("keydown",Be,!1),function(){document.removeEventListener("keydown",Be)}}),[X,Me]),(0,m.useEffect)((function(){var e=Te.current.instance;if(e&&Me){var t=z(f);W.editor.setModelLanguage(e.getModel(),t)}}),[f,Me]),(0,m.useEffect)((function(){Te.current.instance&&Me&&W.editor.setTheme(P)}),[P,Me]),(0,m.useEffect)((function(){var e=Te.current.instance;Ae.current=L,e&&Me&&(e.updateOptions(r()({},L)),setTimeout((function(){e.getModel().updateOptions(r()({},L))}),200))}),[JSON.stringify(L),Me]),(0,m.useEffect)((function(){var e=Te.current.instance;e&&Me&&e.layout()}),[i,o,Me]);var Ge=(0,m.useState)(V(i)),je=c()(Ge,2),Ve=je[0],Ze=(je[1],(0,m.useState)(V(o))),He=c()(Ze,2),ze=He[0],We=He[1],qe=r()(r()({},S),{},{width:Ve,height:ze,position:"relative"});return(0,G.jsx)("div",{className:"my-monaco-editor",ref:Se,style:qe,children:Y&&(0,G.jsx)($.CopyToClipboard,{text:u,onCopy:function(){return F.ZP.success("复制成功")},children:(0,G.jsx)(B.Z,{title:"复制代码",children:(0,G.jsxs)("div",{style:{position:"absolute",top:0,right:10,cursor:"pointer",zIndex:10,color:"#165DFF"},children:[(0,G.jsx)("i",{className:"iconfont icon-fuzhi8",style:{fontSize:14}})," 复制代码"]})})})})};function X(e){var t=e.width,i=void 0===t?"100%":t,s=e.height,a=void 0===s?"100%":s,o=e.original,u=e.modified,h=e.language,d=e.options,f=void 0===d?{}:d,p=(0,m.useRef)(),_=(0,m.useState)(null),g=c()(_,2),y=g[0],b=g[1];(0,m.useEffect)((function(){return p.current&&Promise.all([n.e(8909),n.e(9404)]).then(n.bind(n,2550)).then((function(e){var t=(W=e).editor.createDiffEditor(p.current,r()(r()({enableSplitViewResizing:!1,scrollBeyondLastLine:!1,roundedSelection:!1,renderIndicators:!1,useShadows:!1,horizontal:"hidden",lineNumbers:"off",wordWrap:"off",ignoreTrimWhitespace:!1,"semanticHighlighting.enabled":!0,followsCaret:!0,ignoreCharChanges:!0,minimap:{enabled:!1},readOnly:!0},f),{},{wordWrap:!0}));b(t);var n=function(e){var t;return p.current&&(t=new v.Z((function(t){var n,i=l()(t);try{for(i.s();!(n=i.n()).done;){var r=n.value;(r.target.offsetHeight>0||r.target.offsetWidth>0)&&e.layout()}}catch(e){i.e(e)}finally{i.f()}}))).observe(p.current),t}(t);return function(){t.dispose();var e=t.getModel();e&&e.dispose(),n.unobserve(p.current)}})),function(){window.removeEventListener("keydown",checkPaste),window.removeEventListener("paste",checkPaste)}}),[]),(0,m.useEffect)((function(){y&&y.setModel({original:W.editor.createModel(o,h),modified:W.editor.createModel(u,h)})}),[o,u,h,y]);var E={width:V(i),height:V(a)};return(0,G.jsx)("div",{className:"my-diff-editor",ref:p,style:E})}},14077:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});var i=n(59301);function r(e,t){var n=(0,i.useRef)();(0,i.useEffect)((function(){n.current=e})),(0,i.useEffect)((function(){if(null!==t){var e=setInterval((function(){n.current()}),t);return function(){return clearInterval(e)}}}),[t])}},68536:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return H},formatQuery:function(){return Z}});var i=n(7557),r=n.n(i),s=n(41498),a=n.n(s),o=n(82242),l=n.n(o),u=n(39647),c=n.n(u),h=n(59301),d=n(56565),f=n(29787),p="bg___eq_Aq",_="container___j770l",g="widthle___ouh1T",m=n(24334),v=n(84193),y=n(62957),b=n(58018),E=n(71411),w=n(584),k={contentWrap:"contentWrap___xMJQi",title:"title___z4t4P",footer:"footer___CLzrT",footer_left:"footer_left___N2sZZ",footer_bfcs:"footer_bfcs___UmvUE",footer_bfcs_value:"footer_bfcs_value___yiYga",pingfen:"pingfen___aEEMe",fenshu:"fenshu___I6HCo",radioGroup:"radioGroup___RT1dL",wrap:"wrap___QZGSJ",introName:"introName___m17tA",rating:"rating___MXLBr",modalRating:"modalRating___aluwj",zdbf:"zdbf___9PNEF"},S=n(14077),T=n(64957),A=n(89728),C=n(37712),R=["videoDetail","globalSetting","loading","dispatch"],L=(0,d.connect)((function(e){var t=e.videoDetail,n=e.loading;return{videoDetail:t,globalSetting:e.globalSetting,loading:n}}))((function(e){var t=e.videoDetail,n=(e.globalSetting,e.loading,e.dispatch),i=(c()(e,R),t.queryParams),s=t.selectParams,o=t.videoList,u=(i.subject_id,i.videoId),d=s.checkBoxValue,f=s.radioValue,p={videoId:u},_=(0,h.useRef)(),g=(0,h.useRef)(),A=((0,h.useRef)(),(0,h.useRef)(5)),L=(t.detail||{}).video_item;(0,S.Z)(a()(r()().mark((function e(){return r()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!g.current){e.next=5;break}return console.log("videoRef lastUpdatedTime: ",_.current.getLastUpdatedTime()),console.log(_.current),e.next=5,x();case 5:case"end":return e.stop()}}),e)}))),1e3*A.current);var x=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=e?{is_f:1}:{};return(0,T.DH)(l()(l()({},t),{id:p.videoId,point:_.current.getLastUpdatedTime(),total:_.current.getDuration()}))};return(0,C.jsx)("aside",{className:k.contentWrap,children:(0,C.jsxs)("aside",{className:k.wrap,children:[(0,C.jsx)("header",{}),(0,C.jsx)("div",{className:k.title,children:null==L?void 0:L.name}),null!=L&&L.can_edit||null!=L&&L.is_public?(0,C.jsx)(v.Z,{ref:_,startTime:null==L?void 0:L.last_point,src:null!=L&&L.is_link?null==L?void 0:L.link:(null==L?void 0:L.play_url)&&m.Base64.decode(null==L?void 0:L.play_url),videoId:null==L?void 0:L.video_id,logWatchHistory:function(e){return"1"===e.ed&&(g.current=!1,x(!0)),g.current||e.ed||(g.current=!0,A.current=_.current.getDuration()<=5?1:5,x()),n({type:"userDetail/logWatchHistory",payload:e})},handlePause:function(){g.current=!1},handlePlay:function(){g.current=!0},allow_skip:null==L?void 0:L.allow_skip,handlePlayEnded:function(e){var t=window.filterVideoSign,i=t.findIndex((function(e){return e.id===u}));if(!(i===t.length-1)){var r=t[i+1].id,s=t[i+1].can_view,a=t[i+1].link,o=t[i+1].is_public;if(window.checkBoxValue){if(a)return void window.open(a);if(!s)return void y.Z.info({centered:!0,width:400,okText:"知道啦",icon:null,content:(0,C.jsx)("div",{className:"tc font14",children:"下一条视频为创建者所属单位内部教学资料,外单位用户无观看权限"})});if(!o)return void y.Z.info({centered:!0,width:400,okText:"知道啦",icon:null,content:(0,C.jsx)("div",{className:"tc font14",children:"下一条视频暂未公开,敬请期待"})});n({type:"videoDetail/handleListItemClick",payload:{videoId:r}}),window.videoTimer=setTimeout((function(){e.current.play()}),2e3)}}},toLog:function(){}}):(0,C.jsx)(w.Z,{description:"当前视频暂未公开,敬请期待"}),(0,C.jsxs)("div",{className:k.footer,children:[(0,C.jsxs)("div",{className:k.footer_left,children:[(0,C.jsx)("div",{className:k.pingfen,children:"评分"}),(0,C.jsx)(b.Z,{value:null==L?void 0:L.star,disabled:!0,className:k.rating,style:{color:"#FFA100",fontSize:12,marginLeft:10}}),(0,C.jsxs)("div",{className:k.fenshu,children:[(null==L?void 0:L.star)||0,"分"]})]}),null!=L&&L.can_edit||null!=L&&L.is_public?(0,C.jsx)("div",{children:(0,C.jsx)("div",{className:k.checkBox,children:o.findIndex((function(e){return e.id===u}))===o.length-1?(0,C.jsx)("div",{children:"当前已是最后一个视频"}):(0,C.jsxs)("div",{children:[(0,C.jsx)(E.Z,{onChange:function(e){!function(e,t){if("checkBox"===e){var i=t;return window.checkBoxValue=i,void n({type:"videoDetail/setSelectValue",payload:{radioValue:f,checkBoxValue:i}})}n({type:"videoDetail/setSelectValue",payload:{checkBoxValue:d,radioValue:t.target.value}})}("checkBox",e)},defaultChecked:d,size:"small"}),(0,C.jsx)("span",{className:k.zdbf,children:"自动播放下一个视频"})]})})}):null]}),(0,C.jsx)("div",{className:"mt10",children:(null==L?void 0:L.description)&&(0,C.jsxs)("span",{className:k.introName,children:["简介:",L.description]})})]})})})),x=n(37205),I=n.n(x),D=n(79800),P=n.n(D),O=n(6767),M=n(18287),N={flex_box_center:"flex_box_center___yWqSL",flex_space_between:"flex_space_between___LgFmv",flex_box_vertical_center:"flex_box_vertical_center____lt6U",flex_box_center_end:"flex_box_center_end___UqkaD",flex_box_column:"flex_box_column___V8XLF",list:"list___8tjfT",tree_style:"tree_style___ZzDvO",title:"title___IVfkQ",gray:"gray___RnyYk",brght:"brght___EWRNa",s1:"s1___dPBQg",s3:"s3___SRBBG",active:"active___hsNCX",tree_line:"tree_line___EGn30",tabs_style:"tabs_style___Nwkiq",tabs_item:"tabs_item___Vzu_U",tabs_item_active:"tabs_item_active___BcIwZ"},F=n(31005),B=n(16650),U=n(62233),K=["dispatch","pathsDetail","videoDetail","user"],$=[{name:"实践项目",type:"Shixun",icon:(0,C.jsx)("i",{className:"iconfont icon-shixun2 font20"}),bq:(0,C.jsx)("span",{style:{border:"1px solid #FF9D18",color:"#FF9D18"},className:N.s1,children:"实训"})},{name:"视频项目",type:"VideoItem",icon:(0,C.jsx)("i",{className:"iconfont icon-shipin font20"}),bq:(0,C.jsx)("span",{style:{border:"1px solid #9B18FF",color:"#9B18FF"},className:N.s1,children:"视频"})},{name:"教学课件",type:"Attachment",icon:(0,C.jsx)("i",{className:"iconfont icon-jiaoxueanli font20"}),bq:(0,C.jsx)("span",{style:{border:"1px solid #3061D0",color:"#3061D0"},className:N.s1,children:"资料"})},{name:"空目录",type:"StageCatalog",icon:(0,C.jsx)("i",{className:"iconfont icon-kongbai font20"}),bq:(0,C.jsx)("span",{})}],G=(0,d.connect)((function(e){var t=e.user,n=e.videoDetail,i=e.loading;return{user:t,videoDetail:n,globalSetting:e.globalSetting,loading:i,pathsDetail:e.pathsDetail}}))((function(e){var t=e.dispatch,n=e.pathsDetail,i=e.videoDetail,s=e.user,o=(c()(e,K),i.queryParams),u=i.stages,f=(i.cust_seq,i.active),p=o.subject_id,_=o.course_id,g=(0,d.useParams)(),m=(0,d.useSearchParams)(),v=(P()(m,1)[0],(0,h.useState)([])),b=P()(v,2),E=b[0],w=b[1],k=(0,h.useState)([(null==f?void 0:f.id)||Number(g.videoId)]),S=P()(k,2),R=S[0],L=S[1],x=(0,h.useState)("课程资源目录"),D=P()(x,2),G=D[0],j=D[1],V=[".PDF",".DOC",".DOCX",".XLS",".XLSX",".PPT",".PPTX"];(0,h.useEffect)((function(){t(p?{type:"videoDetail/getStageData",payload:{subject_id:p,page_type:"video"}}:{type:"videoDetail/getCourseStageData",payload:{coursesId:_}})}),[]),(0,h.useEffect)((function(){Z()}),[null==i?void 0:i.stages]);var Z=function(){var e=E;u.forEach((function(t,n){e.push({title:(0,C.jsx)("div",{title:t.stage_name,className:N.title,children:t.stage_name}),value:null==t?void 0:t.stage_id,key:null==t?void 0:t.stage_id,icon:(0,C.jsx)("i",{className:"iconfont icon-wenjianjia2 c-light-primary mr10",style:{lineHeight:"19px"}}),children:H(t.items||[])})})),w(e)},H=function(e){function t(e){var n,i=e.children,r=Array.isArray(i)&&i.length>0,s=null==e?void 0:e.id,a=e.name,o=e.item_type,l=e.id,u=null===(n=$.find((function(e){return e.type===o})))||void 0===n?void 0:n.bq,c=N.brght;f.id===l&&"".concat(c," ").concat(N.active);return{title:(0,C.jsxs)("div",{onClick:function(){return Y(e)},className:c,title:a,children:[u,(0,C.jsx)("div",{className:N.s3,children:a})]}),value:s,key:s,icon:(0,C.jsx)("i",{className:"iconfont icon-wenjianjia2 c-light-primary mr10",style:{lineHeight:"19px"}}),children:r?null==i?void 0:i.map((function(e){return t(e)})):[]}}return null==e?void 0:e.map((function(e){return t(e)}))},z=function(){var e=a()(r()().mark((function e(n,i){var s;return r()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t({type:"globalSetting/setGlobalLoading",payload:{show:!0,text:"正在进入实践项目,请稍后..."}}),!i){e.next=7;break}return e.next=4,(0,B.BK)({id:n});case 4:e.t0=e.sent,e.next=10;break;case 7:return e.next=9,(0,B.Ir)({id:n});case 9:e.t0=e.sent;case 10:if(s=e.t0,t({type:"globalSetting/setGlobalLoading",payload:{show:!1,text:""}}),!(null!=s&&s.game_identifier||null!=s&&s.identifier)){e.next=15;break}return(0,A.xg)(i?"/tasks/".concat(null==s?void 0:s.identifier,"/jupyter"):"/tasks/".concat(s.game_identifier)),e.abrupt("return");case 15:2===(null==s?void 0:s.status)?q(null==s?void 0:s.message):3===(null==s?void 0:s.status)&&W(null==s?void 0:s.message);case 16:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),W=function(e){y.Z.confirm({centered:!0,title:"提示",okText:"确定",cancelText:"取消",content:(0,C.jsxs)("div",{className:"tc font16",children:["目前该实践项目尚在内测中,将于",e,"之后开放,谢谢!"]})})},q=function e(t){var n,i;t=null!==(n=t)&&void 0!==n&&n.includes(".json")?t:"".concat(t,".json"),y.Z.confirm({centered:!0,title:"提示",okText:"确定",cancelText:"取消",content:(0,C.jsx)("div",{className:"tc font16",children:"实训已经更新了,正在为您重置!"}),onOk:(i=a()(r()().mark((function n(){var i,s;return r()().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,(0,F.L8)({url:t});case 2:if(i=n.sent){n.next=5;break}return n.abrupt("return");case 5:return O.ZP.success("重置成功,正在进入实践项目!"),n.next=8,(0,B.Ir)({id:i.shixun_identifier});case 8:if(null==(s=n.sent)||!s.game_identifier){n.next=12;break}return(0,A.xg)("/tasks/".concat(s.game_identifier)),n.abrupt("return");case 12:2===(null==s?void 0:s.status)?e(null==s?void 0:s.message):3===(null==s?void 0:s.status)&&W(null==s?void 0:s.message);case 13:case"end":return n.stop()}}),n)}))),function(){return i.apply(this,arguments)})})},Y=function(e){if("StageCatalog"!==(null==e?void 0:e.item_type)){clearTimeout(window.videoTimer);var i,r,a=e.id,u=e.item_type,c=e.identifier,h=e.is_jupyter,d=e.url,f=e.link;if("VideoItem"===u&&!f)return null!==(i=s.userInfo)&&void 0!==i&&i.admin||null!==(r=s.userInfo)&&void 0!==r&&r.business||e.can_view?(t({type:"videoDetail/handleListItemClick",payload:{videoId:a}}),void t({type:"videoDetail/getVideoDetail",payload:l()(l()({id:a},o),{},{videoId:a}),callback:function(t){!t||!t.video_item||t.video_item.can_edit||e.is_public||y.Z.info({centered:!0,width:400,okText:"知道啦",icon:null,content:(0,C.jsx)("div",{className:"tc font14",children:"当前视频暂未公开,敬请期待"})})}})):void y.Z.info({centered:!0,width:400,okText:"知道啦",icon:null,content:(0,C.jsx)("div",{className:"tc font14",children:"当前视频为创建者所属单位内部教学资料,外单位用户无观看权限"})});if("VideoItem"===u&&f)return e.link&&(0,T.DH)({is_f:1,id:e.id,point:0,total:0}),void window.open(f);if("Shixun"!==u){if("Attachment"===u){var p,_;if(f)return void(0,A.xg)(f);var g,m=null==e||null===(p=e.name)||void 0===p?void 0:p.substr(null==e||null===(_=e.name)||void 0===_?void 0:_.lastIndexOf("."));return V.includes(m.toUpperCase())?void t({type:"videoDetail/handleListItemClick",payload:{attachmentId:a}}):null!==(g=n.detail)&&void 0!==g&&g.allow_download?void(0,A.FH)(e.name,U.Z.API_SERVER+e.url):void O.ZP.info("教学课件不支持下载")}window.open(U.Z.IMG_SERVER+d)}else z(c,h)}};return(0,C.jsxs)("aside",{className:N.list,children:[(0,C.jsx)("div",{className:N.tabs_style,children:(0,C.jsxs)("div",{className:N.tabs_item,onClick:function(){j("课程资源目录")},children:["课程资源目录","课程资源目录"==G&&(0,C.jsx)("div",{className:N.tabs_item_active})]})}),(0,C.jsx)("div",{className:N.tree_style,children:(null==E?void 0:E.length)>0&&(0,C.jsx)(M.Z,{selectedKeys:R,onSelect:function(e,t){L(I()(e))},blockNode:!0,treeData:E,defaultExpandAll:!0,className:N.tree_line})})]})})),j=n(4896),V=["videoDetail","globalSetting","loading","pathsDetail","dispatch"],Z=function(e){var t=e.subject_id;return{subject_id:t,course_id:t}},H=(0,d.connect)((function(e){var t=e.videoDetail,n=e.loading;return{videoDetail:t,globalSetting:e.globalSetting,loading:n,pathsDetail:e.pathsDetail}}))((function(e){var t,n,i=e.videoDetail,s=(e.globalSetting,e.loading,e.pathsDetail),o=e.dispatch,u=(c()(e,V),i.queryParams),d=(i.videoList,i.attachmentList,i.active),m=u.subject_id;u.videoId;function v(){return(v=a()(r()().mark((function e(){return r()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,o({type:"pathsDetail/getPathsDetail",payload:{id:m}});case 2:e.sent;case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}(0,h.useEffect)((function(){if(d){var e=d.item_type,t=d.id;"VideoItem"===e&&o({type:"videoDetail/getVideoDetail",payload:l()(l()({},u),{},{id:t})})}}),[d.id]),console.log("---",d),(0,h.useEffect)((function(){m&&function(){v.apply(this,arguments)}()}),[]),(0,h.useEffect)((function(){var e;(0,A.Dk)(null===(e=i.detail)||void 0===e||null===(e=e.video_item)||void 0===e?void 0:e.name)}),[i]);var y={width:1200};return d&&"Attachment"===d.item_type&&"application/pdf"===d.content_type&&(y={width:1250,marginLeft:(document.body.clientWidth-1200)/2}),(0,C.jsx)(f.Z,{spinning:!1,children:(0,C.jsx)("section",{className:p,children:(0,C.jsxs)("div",{className:_,style:y,children:[(0,C.jsx)(G,{}),d&&"VideoItem"===d.item_type&&(0,C.jsx)(L,{}),d&&"Attachment"===d.item_type&&"application/pdf"===d.content_type&&d.url&&(0,C.jsx)("div",{className:g,children:(0,C.jsx)(j.Z,{disabledDownload:!(null!==(t=s.detail)&&void 0!==t&&t.allow_download),type:"pdf",filename:d.name,data:U.Z.API_SERVER+d.url,style:{position:"absolute",zIndex:1}})}),d&&"Attachment"===d.item_type&&["application/msword","application/vnd.ms-excel","application/vnd.ms-powerpoint","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.openxmlformats-officedocument.wordprocessingml.document"].includes(d.content_type)&&d.url&&(0,C.jsx)("div",{className:g,children:(0,C.jsx)(j.Z,{disabledDownload:!(null!==(n=s.detail)&&void 0!==n&&n.allow_download),type:"office",data:U.Z.API_SERVER+d.url,style:{position:"absolute",zIndex:1}})})]})})})}))},86838:function(e,t,n){"use strict";function i(e){try{e.mozRequestFullScreen?e.mozRequestFullScreen():e.webkitRequestFullScreen&&e.webkitRequestFullScreen()}catch(e){console.log(e,":e")}}function r(){window.top.document.webkitExitFullscreen?window.top.document.webkitExitFullscreen():document.exitFullscreen?window.top.document.exitFullscreen():document.msExitFullscreen?window.top.document.msExitFullscreen():document.mozCancelFullScreen&&window.top.document.mozCancelFullScreen()}n.d(t,{BU:function(){return r},Dj:function(){return i},gH:function(){return s},vp:function(){return a}});var s=function(){return document.webkitExitFullscreen?"webkitfullscreenchange":document.exitFullscreen?"fullscreenchange":document.msExitFullscreen?"msfullscreenchange":document.mozCancelFullScreen?"mozfullscreenchange":void 0};function a(){var e=window.top.document.fullscreenElement||window.top.document.mozFullscreenElement||window.top.document.webkitFullscreenElement;document.fullscreenEnabled||document.mozFullscreenEnabled||document.webkitFullscreenEnabled;return console.log("fullscreenElement",e),window.isFullScreen?window.isFullScreen:null!=e}},7804:function(e,t,n){"use strict";n.d(t,{Z:function(){return ke}});var i=n(31468),r=n.n(i),s=n(82100),a=n.n(s),o=n(29186),l=n.n(o),u=function(){function e(){a()(this,e)}return l()(e,null,[{key:"install",value:function(){Object.setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Object.assign=Object.assign||function(e){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),n=1;n<arguments.length;n++){var i=arguments[n];if(null!=i)for(var r in i)i.hasOwnProperty(r)&&(t[r]=i[r])}return t},"function"!=typeof self.Promise&&n(3867).polyfill()}}]),e}();u.install();var c=u,h=n(86204),d=n.n(h),f=function(){function e(){a()(this,e)}return l()(e,null,[{key:"e",value:function(t,n){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var i="[".concat(t,"] > ").concat(n);e.ENABLE_CALLBACK&&e.emitter.emit("log","error",i),e.ENABLE_ERROR&&(console.error?console.error(i):console.warn?console.warn(i):console.log(i))}},{key:"i",value:function(t,n){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var i="[".concat(t,"] > ").concat(n);e.ENABLE_CALLBACK&&e.emitter.emit("log","info",i),e.ENABLE_INFO&&(console.info?console.info(i):console.log(i))}},{key:"w",value:function(t,n){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var i="[".concat(t,"] > ").concat(n);e.ENABLE_CALLBACK&&e.emitter.emit("log","warn",i),e.ENABLE_WARN&&(console.warn?console.warn(i):console.log(i))}},{key:"d",value:function(t,n){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var i="[".concat(t,"] > ").concat(n);e.ENABLE_CALLBACK&&e.emitter.emit("log","debug",i),e.ENABLE_DEBUG&&(console.debug?console.debug(i):console.log(i))}},{key:"v",value:function(t,n){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var i="[".concat(t,"] > ").concat(n);e.ENABLE_CALLBACK&&e.emitter.emit("log","verbose",i),e.ENABLE_VERBOSE&&console.log(i)}}]),e}();f.GLOBAL_TAG="flv.js",f.FORCE_GLOBAL_TAG=!1,f.ENABLE_ERROR=!0,f.ENABLE_INFO=!0,f.ENABLE_WARN=!0,f.ENABLE_DEBUG=!0,f.ENABLE_VERBOSE=!0,f.ENABLE_CALLBACK=!1,f.emitter=new(d());var p=f,_=function(){function e(){a()(this,e),this._firstCheckpoint=0,this._lastCheckpoint=0,this._intervalBytes=0,this._totalBytes=0,this._lastSecondBytes=0,self.performance&&self.performance.now?this._now=self.performance.now.bind(self.performance):this._now=Date.now}return l()(e,[{key:"reset",value:function(){this._firstCheckpoint=this._lastCheckpoint=0,this._totalBytes=this._intervalBytes=0,this._lastSecondBytes=0}},{key:"addBytes",value:function(e){0===this._firstCheckpoint?(this._firstCheckpoint=this._now(),this._lastCheckpoint=this._firstCheckpoint,this._intervalBytes+=e,this._totalBytes+=e):this._now()-this._lastCheckpoint<1e3?(this._intervalBytes+=e,this._totalBytes+=e):(this._lastSecondBytes=this._intervalBytes,this._intervalBytes=e,this._totalBytes+=e,this._lastCheckpoint=this._now())}},{key:"currentKBps",get:function(){this.addBytes(0);var e=(this._now()-this._lastCheckpoint)/1e3;return 0==e&&(e=1),this._intervalBytes/e/1024}},{key:"lastSecondKBps",get:function(){return this.addBytes(0),0!==this._lastSecondBytes?this._lastSecondBytes/1024:this._now()-this._lastCheckpoint>=500?this.currentKBps:0}},{key:"averageKBps",get:function(){var e=(this._now()-this._firstCheckpoint)/1e3;return this._totalBytes/e/1024}}]),e}(),g=n(80619),m=n.n(g),v=n(47074),y=n.n(v),b=function(){function e(t){a()(this,e),this._message=t}return l()(e,[{key:"name",get:function(){return"RuntimeException"}},{key:"message",get:function(){return this._message}},{key:"toString",value:function(){return this.name+": "+this.message}}]),e}(),E=function(e){m()(n,e);var t=y()(n);function n(e){return a()(this,n),t.call(this,e)}return l()(n,[{key:"name",get:function(){return"IllegalStateException"}}]),n}(b),w=function(e){m()(n,e);var t=y()(n);function n(e){return a()(this,n),t.call(this,e)}return l()(n,[{key:"name",get:function(){return"InvalidArgumentException"}}]),n}(b),k=function(e){m()(n,e);var t=y()(n);function n(e){return a()(this,n),t.call(this,e)}return l()(n,[{key:"name",get:function(){return"NotImplementedException"}}]),n}(b),S={kIdle:0,kConnecting:1,kBuffering:2,kError:3,kComplete:4},T={OK:"OK",EXCEPTION:"Exception",HTTP_STATUS_CODE_INVALID:"HttpStatusCodeInvalid",CONNECTING_TIMEOUT:"ConnectingTimeout",EARLY_EOF:"EarlyEof",UNRECOVERABLE_EARLY_EOF:"UnrecoverableEarlyEof"},A=function(){function e(t){a()(this,e),this._type=t||"undefined",this._status=S.kIdle,this._needStash=!1,this._onContentLengthKnown=null,this._onURLRedirect=null,this._onDataArrival=null,this._onError=null,this._onComplete=null}return l()(e,[{key:"destroy",value:function(){this._status=S.kIdle,this._onContentLengthKnown=null,this._onURLRedirect=null,this._onDataArrival=null,this._onError=null,this._onComplete=null}},{key:"isWorking",value:function(){return this._status===S.kConnecting||this._status===S.kBuffering}},{key:"type",get:function(){return this._type}},{key:"status",get:function(){return this._status}},{key:"needStashBuffer",get:function(){return this._needStash}},{key:"onContentLengthKnown",get:function(){return this._onContentLengthKnown},set:function(e){this._onContentLengthKnown=e}},{key:"onURLRedirect",get:function(){return this._onURLRedirect},set:function(e){this._onURLRedirect=e}},{key:"onDataArrival",get:function(){return this._onDataArrival},set:function(e){this._onDataArrival=e}},{key:"onError",get:function(){return this._onError},set:function(e){this._onError=e}},{key:"onComplete",get:function(){return this._onComplete},set:function(e){this._onComplete=e}},{key:"open",value:function(e,t){throw new k("Unimplemented abstract function!")}},{key:"abort",value:function(){throw new k("Unimplemented abstract function!")}}]),e}(),C=n(4811),R=n.n(C),L=n(34577),x=n.n(L),I={};!function(){var e=self.navigator.userAgent.toLowerCase(),t=/(edge)\/([\w.]+)/.exec(e)||/(opr)[\/]([\w.]+)/.exec(e)||/(chrome)[ \/]([\w.]+)/.exec(e)||/(iemobile)[\/]([\w.]+)/.exec(e)||/(version)(applewebkit)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+).*(version)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||e.indexOf("trident")>=0&&/(rv)(?::| )([\w.]+)/.exec(e)||e.indexOf("compatible")<0&&/(firefox)[ \/]([\w.]+)/.exec(e)||[],n=/(ipad)/.exec(e)||/(ipod)/.exec(e)||/(windows phone)/.exec(e)||/(iphone)/.exec(e)||/(kindle)/.exec(e)||/(android)/.exec(e)||/(windows)/.exec(e)||/(mac)/.exec(e)||/(linux)/.exec(e)||/(cros)/.exec(e)||[],i={browser:t[5]||t[3]||t[1]||"",version:t[2]||t[4]||"0",majorVersion:t[4]||t[2]||"0",platform:n[0]||""},r={};if(i.browser){r[i.browser]=!0;var s=i.majorVersion.split(".");r.version={major:parseInt(i.majorVersion,10),string:i.version},s.length>1&&(r.version.minor=parseInt(s[1],10)),s.length>2&&(r.version.build=parseInt(s[2],10))}if(i.platform&&(r[i.platform]=!0),(r.chrome||r.opr||r.safari)&&(r.webkit=!0),r.rv||r.iemobile){r.rv&&delete r.rv;var a="msie";i.browser=a,r[a]=!0}if(r.edge){delete r.edge;var o="msedge";i.browser=o,r[o]=!0}if(r.opr){var l="opera";i.browser=l,r[l]=!0}if(r.safari&&r.android){var u="android";i.browser=u,r[u]=!0}for(var c in r.name=i.browser,r.platform=i.platform,I)I.hasOwnProperty(c)&&delete I[c];Object.assign(I,r)}();var D=I,P=function(e){m()(n,e);var t=y()(n);function n(e,i){var r;return a()(this,n),(r=t.call(this,"fetch-stream-loader")).TAG="FetchStreamLoader",r._seekHandler=e,r._config=i,r._needStash=!0,r._requestAbort=!1,r._contentLength=null,r._receivedLength=0,r}return l()(n,[{key:"destroy",value:function(){this.isWorking()&&this.abort(),R()(x()(n.prototype),"destroy",this).call(this)}},{key:"open",value:function(e,t){var n=this;this._dataSource=e,this._range=t;var i=e.url;this._config.reuseRedirectedURL&&null!=e.redirectedURL&&(i=e.redirectedURL);var s=this._seekHandler.getConfig(i,t),a=new self.Headers;if("object"===r()(s.headers)){var o=s.headers;for(var l in o)o.hasOwnProperty(l)&&a.append(l,o[l])}var u={method:"GET",headers:a,mode:"cors",cache:"default",referrerPolicy:"no-referrer-when-downgrade"};if("object"===r()(this._config.headers))for(var c in this._config.headers)a.append(c,this._config.headers[c]);!1===e.cors&&(u.mode="same-origin"),e.withCredentials&&(u.credentials="include"),e.referrerPolicy&&(u.referrerPolicy=e.referrerPolicy),this._status=S.kConnecting,self.fetch(s.url,u).then((function(e){if(n._requestAbort)return n._requestAbort=!1,void(n._status=S.kIdle);if(e.ok&&e.status>=200&&e.status<=299){if(e.url!==s.url&&n._onURLRedirect){var t=n._seekHandler.removeURLParameters(e.url);n._onURLRedirect(t)}var i=e.headers.get("Content-Length");return null!=i&&(n._contentLength=parseInt(i),0!==n._contentLength&&n._onContentLengthKnown&&n._onContentLengthKnown(n._contentLength)),n._pump.call(n,e.body.getReader())}if(n._status=S.kError,!n._onError)throw new b("FetchStreamLoader: Http code invalid, "+e.status+" "+e.statusText);n._onError(T.HTTP_STATUS_CODE_INVALID,{code:e.status,msg:e.statusText})})).catch((function(e){if(n._status=S.kError,!n._onError)throw e;n._onError(T.EXCEPTION,{code:-1,msg:e.message})}))}},{key:"abort",value:function(){this._requestAbort=!0}},{key:"_pump",value:function(e){var t=this;return e.read().then((function(n){if(n.done)if(null!==t._contentLength&&t._receivedLength<t._contentLength){t._status=S.kError;var i=T.EARLY_EOF,r={code:-1,msg:"Fetch stream meet Early-EOF"};if(!t._onError)throw new b(r.msg);t._onError(i,r)}else t._status=S.kComplete,t._onComplete&&t._onComplete(t._range.from,t._range.from+t._receivedLength-1);else{if(!0===t._requestAbort)return t._requestAbort=!1,t._status=S.kComplete,e.cancel();t._status=S.kBuffering;var s=n.value.buffer,a=t._range.from+t._receivedLength;t._receivedLength+=s.byteLength,t._onDataArrival&&t._onDataArrival(s,a,t._receivedLength),t._pump(e)}})).catch((function(e){if(11!==e.code||!D.msedge){t._status=S.kError;var n=0,i=null;if(19!==e.code&&"network error"!==e.message||!(null===t._contentLength||null!==t._contentLength&&t._receivedLength<t._contentLength)?(n=T.EXCEPTION,i={code:e.code,msg:e.message}):(n=T.EARLY_EOF,i={code:e.code,msg:"Fetch stream meet Early-EOF"}),!t._onError)throw new b(i.msg);t._onError(n,i)}}))}}],[{key:"isSupported",value:function(){try{var e=D.msedge&&D.version.minor>=15048,t=!D.msedge||e;return self.fetch&&self.ReadableStream&&t}catch(e){return!1}}}]),n}(A),O=function(e){m()(n,e);var t=y()(n);function n(e,i){var r;return a()(this,n),(r=t.call(this,"xhr-moz-chunked-loader")).TAG="MozChunkedLoader",r._seekHandler=e,r._config=i,r._needStash=!0,r._xhr=null,r._requestAbort=!1,r._contentLength=null,r._receivedLength=0,r}return l()(n,[{key:"destroy",value:function(){this.isWorking()&&this.abort(),this._xhr&&(this._xhr.onreadystatechange=null,this._xhr.onprogress=null,this._xhr.onloadend=null,this._xhr.onerror=null,this._xhr=null),R()(x()(n.prototype),"destroy",this).call(this)}},{key:"open",value:function(e,t){this._dataSource=e,this._range=t;var n=e.url;this._config.reuseRedirectedURL&&null!=e.redirectedURL&&(n=e.redirectedURL);var i=this._seekHandler.getConfig(n,t);this._requestURL=i.url;var s=this._xhr=new XMLHttpRequest;if(s.open("GET",i.url,!0),s.responseType="moz-chunked-arraybuffer",s.onreadystatechange=this._onReadyStateChange.bind(this),s.onprogress=this._onProgress.bind(this),s.onloadend=this._onLoadEnd.bind(this),s.onerror=this._onXhrError.bind(this),e.withCredentials&&(s.withCredentials=!0),"object"===r()(i.headers)){var a=i.headers;for(var o in a)a.hasOwnProperty(o)&&s.setRequestHeader(o,a[o])}if("object"===r()(this._config.headers)){var l=this._config.headers;for(var u in l)l.hasOwnProperty(u)&&s.setRequestHeader(u,l[u])}this._status=S.kConnecting,s.send()}},{key:"abort",value:function(){this._requestAbort=!0,this._xhr&&this._xhr.abort(),this._status=S.kComplete}},{key:"_onReadyStateChange",value:function(e){var t=e.target;if(2===t.readyState){if(null!=t.responseURL&&t.responseURL!==this._requestURL&&this._onURLRedirect){var n=this._seekHandler.removeURLParameters(t.responseURL);this._onURLRedirect(n)}if(0!==t.status&&(t.status<200||t.status>299)){if(this._status=S.kError,!this._onError)throw new b("MozChunkedLoader: Http code invalid, "+t.status+" "+t.statusText);this._onError(T.HTTP_STATUS_CODE_INVALID,{code:t.status,msg:t.statusText})}else this._status=S.kBuffering}}},{key:"_onProgress",value:function(e){if(this._status!==S.kError){null===this._contentLength&&null!==e.total&&0!==e.total&&(this._contentLength=e.total,this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength));var t=e.target.response,n=this._range.from+this._receivedLength;this._receivedLength+=t.byteLength,this._onDataArrival&&this._onDataArrival(t,n,this._receivedLength)}}},{key:"_onLoadEnd",value:function(e){!0!==this._requestAbort?this._status!==S.kError&&(this._status=S.kComplete,this._onComplete&&this._onComplete(this._range.from,this._range.from+this._receivedLength-1)):this._requestAbort=!1}},{key:"_onXhrError",value:function(e){this._status=S.kError;var t=0,n=null;if(this._contentLength&&e.loaded<this._contentLength?(t=T.EARLY_EOF,n={code:-1,msg:"Moz-Chunked stream meet Early-Eof"}):(t=T.EXCEPTION,n={code:-1,msg:e.constructor.name+" "+e.type}),!this._onError)throw new b(n.msg);this._onError(t,n)}}],[{key:"isSupported",value:function(){try{var e=new XMLHttpRequest;return e.open("GET","https://example.com",!0),e.responseType="moz-chunked-arraybuffer","moz-chunked-arraybuffer"===e.responseType}catch(e){return p.w("MozChunkedLoader",e.message),!1}}}]),n}(A),M=function(e){m()(n,e);var t=y()(n);function n(e,i){var r;return a()(this,n),(r=t.call(this,"xhr-range-loader")).TAG="RangeLoader",r._seekHandler=e,r._config=i,r._needStash=!1,r._chunkSizeKBList=[128,256,384,512,768,1024,1536,2048,3072,4096,5120,6144,7168,8192],r._currentChunkSizeKB=384,r._currentSpeedNormalized=0,r._zeroSpeedChunkCount=0,r._xhr=null,r._speedSampler=new _,r._requestAbort=!1,r._waitForTotalLength=!1,r._totalLengthReceived=!1,r._currentRequestURL=null,r._currentRedirectedURL=null,r._currentRequestRange=null,r._totalLength=null,r._contentLength=null,r._receivedLength=0,r._lastTimeLoaded=0,r}return l()(n,[{key:"destroy",value:function(){this.isWorking()&&this.abort(),this._xhr&&(this._xhr.onreadystatechange=null,this._xhr.onprogress=null,this._xhr.onload=null,this._xhr.onerror=null,this._xhr=null),R()(x()(n.prototype),"destroy",this).call(this)}},{key:"currentSpeed",get:function(){return this._speedSampler.lastSecondKBps}},{key:"open",value:function(e,t){this._dataSource=e,this._range=t,this._status=S.kConnecting;var n=!1;null!=this._dataSource.filesize&&0!==this._dataSource.filesize&&(n=!0,this._totalLength=this._dataSource.filesize),this._totalLengthReceived||n?this._openSubRange():(this._waitForTotalLength=!0,this._internalOpen(this._dataSource,{from:0,to:-1}))}},{key:"_openSubRange",value:function(){var e=1024*this._currentChunkSizeKB,t=this._range.from+this._receivedLength,n=t+e;null!=this._contentLength&&n-this._range.from>=this._contentLength&&(n=this._range.from+this._contentLength-1),this._currentRequestRange={from:t,to:n},this._internalOpen(this._dataSource,this._currentRequestRange)}},{key:"_internalOpen",value:function(e,t){this._lastTimeLoaded=0;var n=e.url;this._config.reuseRedirectedURL&&(null!=this._currentRedirectedURL?n=this._currentRedirectedURL:null!=e.redirectedURL&&(n=e.redirectedURL));var i=this._seekHandler.getConfig(n,t);this._currentRequestURL=i.url;var s=this._xhr=new XMLHttpRequest;if(s.open("GET",i.url,!0),s.responseType="arraybuffer",s.onreadystatechange=this._onReadyStateChange.bind(this),s.onprogress=this._onProgress.bind(this),s.onload=this._onLoad.bind(this),s.onerror=this._onXhrError.bind(this),e.withCredentials&&(s.withCredentials=!0),"object"===r()(i.headers)){var a=i.headers;for(var o in a)a.hasOwnProperty(o)&&s.setRequestHeader(o,a[o])}if("object"===r()(this._config.headers)){var l=this._config.headers;for(var u in l)l.hasOwnProperty(u)&&s.setRequestHeader(u,l[u])}s.send()}},{key:"abort",value:function(){this._requestAbort=!0,this._internalAbort(),this._status=S.kComplete}},{key:"_internalAbort",value:function(){this._xhr&&(this._xhr.onreadystatechange=null,this._xhr.onprogress=null,this._xhr.onload=null,this._xhr.onerror=null,this._xhr.abort(),this._xhr=null)}},{key:"_onReadyStateChange",value:function(e){var t=e.target;if(2===t.readyState){if(null!=t.responseURL){var n=this._seekHandler.removeURLParameters(t.responseURL);t.responseURL!==this._currentRequestURL&&n!==this._currentRedirectedURL&&(this._currentRedirectedURL=n,this._onURLRedirect&&this._onURLRedirect(n))}if(t.status>=200&&t.status<=299){if(this._waitForTotalLength)return;this._status=S.kBuffering}else{if(this._status=S.kError,!this._onError)throw new b("RangeLoader: Http code invalid, "+t.status+" "+t.statusText);this._onError(T.HTTP_STATUS_CODE_INVALID,{code:t.status,msg:t.statusText})}}}},{key:"_onProgress",value:function(e){if(this._status!==S.kError){if(null===this._contentLength){var t=!1;if(this._waitForTotalLength){this._waitForTotalLength=!1,this._totalLengthReceived=!0,t=!0;var n=e.total;this._internalAbort(),null!=n&0!==n&&(this._totalLength=n)}if(-1===this._range.to?this._contentLength=this._totalLength-this._range.from:this._contentLength=this._range.to-this._range.from+1,t)return void this._openSubRange();this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength)}var i=e.loaded-this._lastTimeLoaded;this._lastTimeLoaded=e.loaded,this._speedSampler.addBytes(i)}}},{key:"_normalizeSpeed",value:function(e){var t=this._chunkSizeKBList,n=t.length-1,i=0,r=0,s=n;if(e<t[0])return t[0];for(;r<=s;){if((i=r+Math.floor((s-r)/2))===n||e>=t[i]&&e<t[i+1])return t[i];t[i]<e?r=i+1:s=i-1}}},{key:"_onLoad",value:function(e){if(this._status!==S.kError)if(this._waitForTotalLength)this._waitForTotalLength=!1;else{this._lastTimeLoaded=0;var t=this._speedSampler.lastSecondKBps;if(0===t&&(this._zeroSpeedChunkCount++,this._zeroSpeedChunkCount>=3&&(t=this._speedSampler.currentKBps)),0!==t){var n=this._normalizeSpeed(t);this._currentSpeedNormalized!==n&&(this._currentSpeedNormalized=n,this._currentChunkSizeKB=n)}var i=e.target.response,r=this._range.from+this._receivedLength;this._receivedLength+=i.byteLength;var s=!1;null!=this._contentLength&&this._receivedLength<this._contentLength?this._openSubRange():s=!0,this._onDataArrival&&this._onDataArrival(i,r,this._receivedLength),s&&(this._status=S.kComplete,this._onComplete&&this._onComplete(this._range.from,this._range.from+this._receivedLength-1))}}},{key:"_onXhrError",value:function(e){this._status=S.kError;var t=0,n=null;if(this._contentLength&&this._receivedLength>0&&this._receivedLength<this._contentLength?(t=T.EARLY_EOF,n={code:-1,msg:"RangeLoader meet Early-Eof"}):(t=T.EXCEPTION,n={code:-1,msg:e.constructor.name+" "+e.type}),!this._onError)throw new b(n.msg);this._onError(t,n)}}],[{key:"isSupported",value:function(){try{var e=new XMLHttpRequest;return e.open("GET","https://example.com",!0),e.responseType="arraybuffer","arraybuffer"===e.responseType}catch(e){return p.w("RangeLoader",e.message),!1}}}]),n}(A),N=function(e){m()(n,e);var t=y()(n);function n(){var e;return a()(this,n),(e=t.call(this,"websocket-loader")).TAG="WebSocketLoader",e._needStash=!0,e._ws=null,e._requestAbort=!1,e._receivedLength=0,e}return l()(n,[{key:"destroy",value:function(){this._ws&&this.abort(),R()(x()(n.prototype),"destroy",this).call(this)}},{key:"open",value:function(e){try{var t=this._ws=new self.WebSocket(e.url);t.binaryType="arraybuffer",t.onopen=this._onWebSocketOpen.bind(this),t.onclose=this._onWebSocketClose.bind(this),t.onmessage=this._onWebSocketMessage.bind(this),t.onerror=this._onWebSocketError.bind(this),this._status=S.kConnecting}catch(e){this._status=S.kError;var n={code:e.code,msg:e.message};if(!this._onError)throw new b(n.msg);this._onError(T.EXCEPTION,n)}}},{key:"abort",value:function(){var e=this._ws;!e||0!==e.readyState&&1!==e.readyState||(this._requestAbort=!0,e.close()),this._ws=null,this._status=S.kComplete}},{key:"_onWebSocketOpen",value:function(e){this._status=S.kBuffering}},{key:"_onWebSocketClose",value:function(e){!0!==this._requestAbort?(this._status=S.kComplete,this._onComplete&&this._onComplete(0,this._receivedLength-1)):this._requestAbort=!1}},{key:"_onWebSocketMessage",value:function(e){var t=this;if(e.data instanceof ArrayBuffer)this._dispatchArrayBuffer(e.data);else if(e.data instanceof Blob){var n=new FileReader;n.onload=function(){t._dispatchArrayBuffer(n.result)},n.readAsArrayBuffer(e.data)}else{this._status=S.kError;var i={code:-1,msg:"Unsupported WebSocket message type: "+e.data.constructor.name};if(!this._onError)throw new b(i.msg);this._onError(T.EXCEPTION,i)}}},{key:"_dispatchArrayBuffer",value:function(e){var t=e,n=this._receivedLength;this._receivedLength+=t.byteLength,this._onDataArrival&&this._onDataArrival(t,n,this._receivedLength)}},{key:"_onWebSocketError",value:function(e){this._status=S.kError;var t={code:e.code,msg:e.message};if(!this._onError)throw new b(t.msg);this._onError(T.EXCEPTION,t)}}],[{key:"isSupported",value:function(){try{return void 0!==self.WebSocket}catch(e){return!1}}}]),n}(A),F=function(){function e(t){a()(this,e),this._zeroStart=t||!1}return l()(e,[{key:"getConfig",value:function(e,t){var n,i={};0!==t.from||-1!==t.to?(n=-1!==t.to?"bytes=".concat(t.from.toString(),"-").concat(t.to.toString()):"bytes=".concat(t.from.toString(),"-"),i.Range=n):this._zeroStart&&(i.Range="bytes=0-");return{url:e,headers:i}}},{key:"removeURLParameters",value:function(e){return e}}]),e}(),B=function(){function e(t,n){a()(this,e),this._startName=t,this._endName=n}return l()(e,[{key:"getConfig",value:function(e,t){var n=e;if(0!==t.from||-1!==t.to){var i=!0;-1===n.indexOf("?")&&(n+="?",i=!1),i&&(n+="&"),n+="".concat(this._startName,"=").concat(t.from.toString()),-1!==t.to&&(n+="&".concat(this._endName,"=").concat(t.to.toString()))}return{url:n,headers:{}}}},{key:"removeURLParameters",value:function(e){var t=e.split("?")[0],n=void 0,i=e.indexOf("?");-1!==i&&(n=e.substring(i+1));var r="";if(null!=n&&n.length>0)for(var s=n.split("&"),a=0;a<s.length;a++){var o=s[a].split("="),l=a>0;o[0]!==this._startName&&o[0]!==this._endName&&(l&&(r+="&"),r+=s[a])}return 0===r.length?t:t+"?"+r}}]),e}(),U=function(){function e(t,n,i){a()(this,e),this.TAG="IOController",this._config=n,this._extraData=i,this._stashInitialSize=393216,null!=n.stashInitialSize&&n.stashInitialSize>0&&(this._stashInitialSize=n.stashInitialSize),this._stashUsed=0,this._stashSize=this._stashInitialSize,this._bufferSize=3145728,this._stashBuffer=new ArrayBuffer(this._bufferSize),this._stashByteStart=0,this._enableStash=!0,!1===n.enableStashBuffer&&(this._enableStash=!1),this._loader=null,this._loaderClass=null,this._seekHandler=null,this._dataSource=t,this._isWebSocketURL=/wss?:\/\/(.+?)/.test(t.url),this._refTotalLength=t.filesize?t.filesize:null,this._totalLength=this._refTotalLength,this._fullRequestFlag=!1,this._currentRange=null,this._redirectedURL=null,this._speedNormalized=0,this._speedSampler=new _,this._speedNormalizeList=[64,128,256,384,512,768,1024,1536,2048,3072,4096],this._isEarlyEofReconnecting=!1,this._paused=!1,this._resumeFrom=0,this._onDataArrival=null,this._onSeeked=null,this._onError=null,this._onComplete=null,this._onRedirect=null,this._onRecoveredEarlyEof=null,this._selectSeekHandler(),this._selectLoader(),this._createLoader()}return l()(e,[{key:"destroy",value:function(){this._loader.isWorking()&&this._loader.abort(),this._loader.destroy(),this._loader=null,this._loaderClass=null,this._dataSource=null,this._stashBuffer=null,this._stashUsed=this._stashSize=this._bufferSize=this._stashByteStart=0,this._currentRange=null,this._speedSampler=null,this._isEarlyEofReconnecting=!1,this._onDataArrival=null,this._onSeeked=null,this._onError=null,this._onComplete=null,this._onRedirect=null,this._onRecoveredEarlyEof=null,this._extraData=null}},{key:"isWorking",value:function(){return this._loader&&this._loader.isWorking()&&!this._paused}},{key:"isPaused",value:function(){return this._paused}},{key:"status",get:function(){return this._loader.status}},{key:"extraData",get:function(){return this._extraData},set:function(e){this._extraData=e}},{key:"onDataArrival",get:function(){return this._onDataArrival},set:function(e){this._onDataArrival=e}},{key:"onSeeked",get:function(){return this._onSeeked},set:function(e){this._onSeeked=e}},{key:"onError",get:function(){return this._onError},set:function(e){this._onError=e}},{key:"onComplete",get:function(){return this._onComplete},set:function(e){this._onComplete=e}},{key:"onRedirect",get:function(){return this._onRedirect},set:function(e){this._onRedirect=e}},{key:"onRecoveredEarlyEof",get:function(){return this._onRecoveredEarlyEof},set:function(e){this._onRecoveredEarlyEof=e}},{key:"currentURL",get:function(){return this._dataSource.url}},{key:"hasRedirect",get:function(){return null!=this._redirectedURL||null!=this._dataSource.redirectedURL}},{key:"currentRedirectedURL",get:function(){return this._redirectedURL||this._dataSource.redirectedURL}},{key:"currentSpeed",get:function(){return this._loaderClass===M?this._loader.currentSpeed:this._speedSampler.lastSecondKBps}},{key:"loaderType",get:function(){return this._loader.type}},{key:"_selectSeekHandler",value:function(){var e=this._config;if("range"===e.seekType)this._seekHandler=new F(this._config.rangeLoadZeroStart);else if("param"===e.seekType){var t=e.seekParamStart||"bstart",n=e.seekParamEnd||"bend";this._seekHandler=new B(t,n)}else{if("custom"!==e.seekType)throw new w("Invalid seekType in config: ".concat(e.seekType));if("function"!=typeof e.customSeekHandler)throw new w("Custom seekType specified in config but invalid customSeekHandler!");this._seekHandler=new e.customSeekHandler}}},{key:"_selectLoader",value:function(){if(null!=this._config.customLoader)this._loaderClass=this._config.customLoader;else if(this._isWebSocketURL)this._loaderClass=N;else if(P.isSupported())this._loaderClass=P;else if(O.isSupported())this._loaderClass=O;else{if(!M.isSupported())throw new b("Your browser doesn't support xhr with arraybuffer responseType!");this._loaderClass=M}}},{key:"_createLoader",value:function(){this._loader=new this._loaderClass(this._seekHandler,this._config),!1===this._loader.needStashBuffer&&(this._enableStash=!1),this._loader.onContentLengthKnown=this._onContentLengthKnown.bind(this),this._loader.onURLRedirect=this._onURLRedirect.bind(this),this._loader.onDataArrival=this._onLoaderChunkArrival.bind(this),this._loader.onComplete=this._onLoaderComplete.bind(this),this._loader.onError=this._onLoaderError.bind(this)}},{key:"open",value:function(e){this._currentRange={from:0,to:-1},e&&(this._currentRange.from=e),this._speedSampler.reset(),e||(this._fullRequestFlag=!0),this._loader.open(this._dataSource,Object.assign({},this._currentRange))}},{key:"abort",value:function(){this._loader.abort(),this._paused&&(this._paused=!1,this._resumeFrom=0)}},{key:"pause",value:function(){this.isWorking()&&(this._loader.abort(),0!==this._stashUsed?(this._resumeFrom=this._stashByteStart,this._currentRange.to=this._stashByteStart-1):this._resumeFrom=this._currentRange.to+1,this._stashUsed=0,this._stashByteStart=0,this._paused=!0)}},{key:"resume",value:function(){if(this._paused){this._paused=!1;var e=this._resumeFrom;this._resumeFrom=0,this._internalSeek(e,!0)}}},{key:"seek",value:function(e){this._paused=!1,this._stashUsed=0,this._stashByteStart=0,this._internalSeek(e,!0)}},{key:"_internalSeek",value:function(e,t){this._loader.isWorking()&&this._loader.abort(),this._flushStashBuffer(t),this._loader.destroy(),this._loader=null;var n={from:e,to:-1};this._currentRange={from:n.from,to:-1},this._speedSampler.reset(),this._stashSize=this._stashInitialSize,this._createLoader(),this._loader.open(this._dataSource,n),this._onSeeked&&this._onSeeked()}},{key:"updateUrl",value:function(e){if(!e||"string"!=typeof e||0===e.length)throw new w("Url must be a non-empty string!");this._dataSource.url=e}},{key:"_expandBuffer",value:function(e){for(var t=this._stashSize;t+1048576<e;)t*=2;if((t+=1048576)!==this._bufferSize){var n=new ArrayBuffer(t);if(this._stashUsed>0){var i=new Uint8Array(this._stashBuffer,0,this._stashUsed);new Uint8Array(n,0,t).set(i,0)}this._stashBuffer=n,this._bufferSize=t}}},{key:"_normalizeSpeed",value:function(e){var t=this._speedNormalizeList,n=t.length-1,i=0,r=0,s=n;if(e<t[0])return t[0];for(;r<=s;){if((i=r+Math.floor((s-r)/2))===n||e>=t[i]&&e<t[i+1])return t[i];t[i]<e?r=i+1:s=i-1}}},{key:"_adjustStashSize",value:function(e){var t=0;(t=this._config.isLive||e<512?e:e>=512&&e<=1024?Math.floor(1.5*e):2*e)>8192&&(t=8192);var n=1024*t+1048576;this._bufferSize<n&&this._expandBuffer(n),this._stashSize=1024*t}},{key:"_dispatchChunks",value:function(e,t){return this._currentRange.to=t+e.byteLength-1,this._onDataArrival(e,t)}},{key:"_onURLRedirect",value:function(e){this._redirectedURL=e,this._onRedirect&&this._onRedirect(e)}},{key:"_onContentLengthKnown",value:function(e){e&&this._fullRequestFlag&&(this._totalLength=e,this._fullRequestFlag=!1)}},{key:"_onLoaderChunkArrival",value:function(e,t,n){if(!this._onDataArrival)throw new E("IOController: No existing consumer (onDataArrival) callback!");if(!this._paused){this._isEarlyEofReconnecting&&(this._isEarlyEofReconnecting=!1,this._onRecoveredEarlyEof&&this._onRecoveredEarlyEof()),this._speedSampler.addBytes(e.byteLength);var i=this._speedSampler.lastSecondKBps;if(0!==i){var r=this._normalizeSpeed(i);this._speedNormalized!==r&&(this._speedNormalized=r,this._adjustStashSize(r))}if(this._enableStash)if(0===this._stashUsed&&0===this._stashByteStart&&(this._stashByteStart=t),this._stashUsed+e.byteLength<=this._stashSize){new Uint8Array(this._stashBuffer,0,this._stashSize).set(new Uint8Array(e),this._stashUsed),this._stashUsed+=e.byteLength}else{var s=new Uint8Array(this._stashBuffer,0,this._bufferSize);if(this._stashUsed>0){var a=this._stashBuffer.slice(0,this._stashUsed),o=this._dispatchChunks(a,this._stashByteStart);if(o<a.byteLength){if(o>0){var l=new Uint8Array(a,o);s.set(l,0),this._stashUsed=l.byteLength,this._stashByteStart+=o}}else this._stashUsed=0,this._stashByteStart+=o;this._stashUsed+e.byteLength>this._bufferSize&&(this._expandBuffer(this._stashUsed+e.byteLength),s=new Uint8Array(this._stashBuffer,0,this._bufferSize)),s.set(new Uint8Array(e),this._stashUsed),this._stashUsed+=e.byteLength}else{var u=this._dispatchChunks(e,t);if(u<e.byteLength){var c=e.byteLength-u;c>this._bufferSize&&(this._expandBuffer(c),s=new Uint8Array(this._stashBuffer,0,this._bufferSize)),s.set(new Uint8Array(e,u),0),this._stashUsed+=c,this._stashByteStart=t+u}}}else if(0===this._stashUsed){var h=this._dispatchChunks(e,t);if(h<e.byteLength){var d=e.byteLength-h;d>this._bufferSize&&this._expandBuffer(d),new Uint8Array(this._stashBuffer,0,this._bufferSize).set(new Uint8Array(e,h),0),this._stashUsed+=d,this._stashByteStart=t+h}}else{this._stashUsed+e.byteLength>this._bufferSize&&this._expandBuffer(this._stashUsed+e.byteLength);var f=new Uint8Array(this._stashBuffer,0,this._bufferSize);f.set(new Uint8Array(e),this._stashUsed),this._stashUsed+=e.byteLength;var p=this._dispatchChunks(this._stashBuffer.slice(0,this._stashUsed),this._stashByteStart);if(p<this._stashUsed&&p>0){var _=new Uint8Array(this._stashBuffer,p);f.set(_,0)}this._stashUsed-=p,this._stashByteStart+=p}}}},{key:"_flushStashBuffer",value:function(e){if(this._stashUsed>0){var t=this._stashBuffer.slice(0,this._stashUsed),n=this._dispatchChunks(t,this._stashByteStart),i=t.byteLength-n;if(n<t.byteLength){if(!e){if(n>0){var r=new Uint8Array(this._stashBuffer,0,this._bufferSize),s=new Uint8Array(t,n);r.set(s,0),this._stashUsed=s.byteLength,this._stashByteStart+=n}return 0}p.w(this.TAG,"".concat(i," bytes unconsumed data remain when flush buffer, dropped"))}return this._stashUsed=0,this._stashByteStart=0,i}return 0}},{key:"_onLoaderComplete",value:function(e,t){this._flushStashBuffer(!0),this._onComplete&&this._onComplete(this._extraData)}},{key:"_onLoaderError",value:function(e,t){if(p.e(this.TAG,"Loader error, code = ".concat(t.code,", msg = ").concat(t.msg)),this._flushStashBuffer(!1),this._isEarlyEofReconnecting&&(this._isEarlyEofReconnecting=!1,e=T.UNRECOVERABLE_EARLY_EOF),e===T.EARLY_EOF){if(!this._config.isLive&&this._totalLength){var n=this._currentRange.to+1;return void(n<this._totalLength&&(p.w(this.TAG,"Connection lost, trying reconnect..."),this._isEarlyEofReconnecting=!0,this._internalSeek(n,!1)))}e=T.UNRECOVERABLE_EARLY_EOF}if(!this._onError)throw new b("IOException: "+t.msg);this._onError(e,t)}}]),e}(),K={enableWorker:!1,enableStashBuffer:!0,stashInitialSize:void 0,isLive:!1,lazyLoad:!0,lazyLoadMaxDuration:180,lazyLoadRecoverDuration:30,deferLoadAfterSourceOpen:!0,autoCleanupMaxBackwardDuration:180,autoCleanupMinBackwardDuration:120,statisticsInfoReportInterval:600,fixAudioTimestampGap:!0,accurateSeek:!1,seekType:"range",seekParamStart:"bstart",seekParamEnd:"bend",rangeLoadZeroStart:!1,customSeekHandler:void 0,reuseRedirectedURL:!1,headers:void 0,customLoader:void 0};function $(){return Object.assign({},K)}var G=function(){function e(){a()(this,e)}return l()(e,null,[{key:"supportMSEH264Playback",value:function(){return window.MediaSource&&window.MediaSource.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"')}},{key:"supportNetworkStreamIO",value:function(){var e=new U({},$()),t=e.loaderType;return e.destroy(),"fetch-stream-loader"==t||"xhr-moz-chunked-loader"==t}},{key:"getNetworkLoaderTypeName",value:function(){var e=new U({},$()),t=e.loaderType;return e.destroy(),t}},{key:"supportNativeMediaPlayback",value:function(t){null==e.videoElement&&(e.videoElement=window.document.createElement("video"));var n=e.videoElement.canPlayType(t);return"probably"===n||"maybe"==n}},{key:"getFeatureList",value:function(){var t={mseFlvPlayback:!1,mseLiveFlvPlayback:!1,networkStreamIO:!1,networkLoaderName:"",nativeMP4H264Playback:!1,nativeWebmVP8Playback:!1,nativeWebmVP9Playback:!1};return t.mseFlvPlayback=e.supportMSEH264Playback(),t.networkStreamIO=e.supportNetworkStreamIO(),t.networkLoaderName=e.getNetworkLoaderTypeName(),t.mseLiveFlvPlayback=t.mseFlvPlayback&&t.networkStreamIO,t.nativeMP4H264Playback=e.supportNativeMediaPlayback('video/mp4; codecs="avc1.42001E, mp4a.40.2"'),t.nativeWebmVP8Playback=e.supportNativeMediaPlayback('video/webm; codecs="vp8.0, vorbis"'),t.nativeWebmVP9Playback=e.supportNativeMediaPlayback('video/webm; codecs="vp9"'),t}}]),e}(),j=G,V={ERROR:"error",LOADING_COMPLETE:"loading_complete",RECOVERED_EARLY_EOF:"recovered_early_eof",MEDIA_INFO:"media_info",METADATA_ARRIVED:"metadata_arrived",SCRIPTDATA_ARRIVED:"scriptdata_arrived",STATISTICS_INFO:"statistics_info"},Z=function(){function e(){a()(this,e)}return l()(e,null,[{key:"forceGlobalTag",get:function(){return p.FORCE_GLOBAL_TAG},set:function(t){p.FORCE_GLOBAL_TAG=t,e._notifyChange()}},{key:"globalTag",get:function(){return p.GLOBAL_TAG},set:function(t){p.GLOBAL_TAG=t,e._notifyChange()}},{key:"enableAll",get:function(){return p.ENABLE_VERBOSE&&p.ENABLE_DEBUG&&p.ENABLE_INFO&&p.ENABLE_WARN&&p.ENABLE_ERROR},set:function(t){p.ENABLE_VERBOSE=t,p.ENABLE_DEBUG=t,p.ENABLE_INFO=t,p.ENABLE_WARN=t,p.ENABLE_ERROR=t,e._notifyChange()}},{key:"enableDebug",get:function(){return p.ENABLE_DEBUG},set:function(t){p.ENABLE_DEBUG=t,e._notifyChange()}},{key:"enableVerbose",get:function(){return p.ENABLE_VERBOSE},set:function(t){p.ENABLE_VERBOSE=t,e._notifyChange()}},{key:"enableInfo",get:function(){return p.ENABLE_INFO},set:function(t){p.ENABLE_INFO=t,e._notifyChange()}},{key:"enableWarn",get:function(){return p.ENABLE_WARN},set:function(t){p.ENABLE_WARN=t,e._notifyChange()}},{key:"enableError",get:function(){return p.ENABLE_ERROR},set:function(t){p.ENABLE_ERROR=t,e._notifyChange()}},{key:"getConfig",value:function(){return{globalTag:p.GLOBAL_TAG,forceGlobalTag:p.FORCE_GLOBAL_TAG,enableVerbose:p.ENABLE_VERBOSE,enableDebug:p.ENABLE_DEBUG,enableInfo:p.ENABLE_INFO,enableWarn:p.ENABLE_WARN,enableError:p.ENABLE_ERROR,enableCallback:p.ENABLE_CALLBACK}}},{key:"applyConfig",value:function(e){p.GLOBAL_TAG=e.globalTag,p.FORCE_GLOBAL_TAG=e.forceGlobalTag,p.ENABLE_VERBOSE=e.enableVerbose,p.ENABLE_DEBUG=e.enableDebug,p.ENABLE_INFO=e.enableInfo,p.ENABLE_WARN=e.enableWarn,p.ENABLE_ERROR=e.enableError,p.ENABLE_CALLBACK=e.enableCallback}},{key:"_notifyChange",value:function(){var t=e.emitter;if(t.listenerCount("change")>0){var n=e.getConfig();t.emit("change",n)}}},{key:"registerListener",value:function(t){e.emitter.addListener("change",t)}},{key:"removeListener",value:function(t){e.emitter.removeListener("change",t)}},{key:"addLogListener",value:function(t){p.emitter.addListener("log",t),p.emitter.listenerCount("log")>0&&(p.ENABLE_CALLBACK=!0,e._notifyChange())}},{key:"removeLogListener",value:function(t){p.emitter.removeListener("log",t),0===p.emitter.listenerCount("log")&&(p.ENABLE_CALLBACK=!1,e._notifyChange())}}]),e}();Z.emitter=new(d());var H=Z,z=function(){function e(){a()(this,e),this.mimeType=null,this.duration=null,this.hasAudio=null,this.hasVideo=null,this.audioCodec=null,this.videoCodec=null,this.audioDataRate=null,this.videoDataRate=null,this.audioSampleRate=null,this.audioChannelCount=null,this.width=null,this.height=null,this.fps=null,this.profile=null,this.level=null,this.refFrames=null,this.chromaFormat=null,this.sarNum=null,this.sarDen=null,this.metadata=null,this.segments=null,this.segmentCount=null,this.hasKeyframesIndex=null,this.keyframesIndex=null}return l()(e,[{key:"isComplete",value:function(){var e=!1===this.hasAudio||!0===this.hasAudio&&null!=this.audioCodec&&null!=this.audioSampleRate&&null!=this.audioChannelCount,t=!1===this.hasVideo||!0===this.hasVideo&&null!=this.videoCodec&&null!=this.width&&null!=this.height&&null!=this.fps&&null!=this.profile&&null!=this.level&&null!=this.refFrames&&null!=this.chromaFormat&&null!=this.sarNum&&null!=this.sarDen;return null!=this.mimeType&&null!=this.duration&&null!=this.metadata&&null!=this.hasKeyframesIndex&&e&&t}},{key:"isSeekable",value:function(){return!0===this.hasKeyframesIndex}},{key:"getNearestKeyframe",value:function(e){if(null==this.keyframesIndex)return null;var t=this.keyframesIndex,n=this._search(t.times,e);return{index:n,milliseconds:t.times[n],fileposition:t.filepositions[n]}}},{key:"_search",value:function(e,t){var n=0,i=e.length-1,r=0,s=0,a=i;for(t<e[0]&&(n=0,s=a+1);s<=a;){if((r=s+Math.floor((a-s)/2))===i||t>=e[r]&&t<e[r+1]){n=r;break}e[r]<t?s=r+1:a=r-1}return n}}]),e}();function W(e,t,n){var i=e;if(t+n<i.length){for(;n--;)if(128!=(192&i[++t]))return!1;return!0}return!1}var q,Y=function(e){for(var t=[],n=e,i=0,r=e.length;i<r;)if(n[i]<128)t.push(String.fromCharCode(n[i])),++i;else{if(n[i]<192);else if(n[i]<224){if(W(n,i,1)){var s=(31&n[i])<<6|63&n[i+1];if(s>=128){t.push(String.fromCharCode(65535&s)),i+=2;continue}}}else if(n[i]<240){if(W(n,i,2)){var a=(15&n[i])<<12|(63&n[i+1])<<6|63&n[i+2];if(a>=2048&&55296!=(63488&a)){t.push(String.fromCharCode(65535&a)),i+=3;continue}}}else if(n[i]<248&&W(n,i,3)){var o=(7&n[i])<<18|(63&n[i+1])<<12|(63&n[i+2])<<6|63&n[i+3];if(o>65536&&o<1114112){o-=65536,t.push(String.fromCharCode(o>>>10|55296)),t.push(String.fromCharCode(1023&o|56320)),i+=4;continue}}t.push(String.fromCharCode(65533)),++i}return t.join("")},X=(q=new ArrayBuffer(2),new DataView(q).setInt16(0,256,!0),256===new Int16Array(q)[0]),Q=function(){function e(){a()(this,e)}return l()(e,null,[{key:"parseScriptData",value:function(t,n,i){var r={};try{var s=e.parseValue(t,n,i),a=e.parseValue(t,n+s.size,i-s.size);r[s.data]=a.data}catch(e){p.e("AMF",e.toString())}return r}},{key:"parseObject",value:function(t,n,i){if(i<3)throw new E("Data not enough when parse ScriptDataObject");var r=e.parseString(t,n,i),s=e.parseValue(t,n+r.size,i-r.size),a=s.objectEnd;return{data:{name:r.data,value:s.data},size:r.size+s.size,objectEnd:a}}},{key:"parseVariable",value:function(t,n,i){return e.parseObject(t,n,i)}},{key:"parseString",value:function(e,t,n){if(n<2)throw new E("Data not enough when parse String");var i=new DataView(e,t,n).getUint16(0,!X);return{data:i>0?Y(new Uint8Array(e,t+2,i)):"",size:2+i}}},{key:"parseLongString",value:function(e,t,n){if(n<4)throw new E("Data not enough when parse LongString");var i=new DataView(e,t,n).getUint32(0,!X);return{data:i>0?Y(new Uint8Array(e,t+4,i)):"",size:4+i}}},{key:"parseDate",value:function(e,t,n){if(n<10)throw new E("Data size invalid when parse Date");var i=new DataView(e,t,n),r=i.getFloat64(0,!X),s=i.getInt16(8,!X);return{data:new Date(r+=60*s*1e3),size:10}}},{key:"parseValue",value:function(t,n,i){if(i<1)throw new E("Data not enough when parse Value");var r,s=new DataView(t,n,i),a=1,o=s.getUint8(0),l=!1;try{switch(o){case 0:r=s.getFloat64(1,!X),a+=8;break;case 1:r=!!s.getUint8(1),a+=1;break;case 2:var u=e.parseString(t,n+1,i-1);r=u.data,a+=u.size;break;case 3:r={};var c=0;for(9==(16777215&s.getUint32(i-4,!X))&&(c=3);a<i-4;){var h=e.parseObject(t,n+a,i-a-c);if(h.objectEnd)break;r[h.data.name]=h.data.value,a+=h.size}if(a<=i-3)9===(16777215&s.getUint32(a-1,!X))&&(a+=3);break;case 8:r={},a+=4;var d=0;for(9==(16777215&s.getUint32(i-4,!X))&&(d=3);a<i-8;){var f=e.parseVariable(t,n+a,i-a-d);if(f.objectEnd)break;r[f.data.name]=f.data.value,a+=f.size}if(a<=i-3)9===(16777215&s.getUint32(a-1,!X))&&(a+=3);break;case 9:r=void 0,a=1,l=!0;break;case 10:r=[];var _=s.getUint32(1,!X);a+=4;for(var g=0;g<_;g++){var m=e.parseValue(t,n+a,i-a);r.push(m.data),a+=m.size}break;case 11:var v=e.parseDate(t,n+1,i-1);r=v.data,a+=v.size;break;case 12:var y=e.parseString(t,n+1,i-1);r=y.data,a+=y.size;break;default:a=i,p.w("AMF","Unsupported AMF value type "+o)}}catch(e){p.e("AMF",e.toString())}return{data:r,size:a,objectEnd:l}}}]),e}(),J=function(){function e(t){a()(this,e),this.TAG="ExpGolomb",this._buffer=t,this._buffer_index=0,this._total_bytes=t.byteLength,this._total_bits=8*t.byteLength,this._current_word=0,this._current_word_bits_left=0}return l()(e,[{key:"destroy",value:function(){this._buffer=null}},{key:"_fillCurrentWord",value:function(){var e=this._total_bytes-this._buffer_index;if(e<=0)throw new E("ExpGolomb: _fillCurrentWord() but no bytes available");var t=Math.min(4,e),n=new Uint8Array(4);n.set(this._buffer.subarray(this._buffer_index,this._buffer_index+t)),this._current_word=new DataView(n.buffer).getUint32(0,!1),this._buffer_index+=t,this._current_word_bits_left=8*t}},{key:"readBits",value:function(e){if(e>32)throw new w("ExpGolomb: readBits() bits exceeded max 32bits!");if(e<=this._current_word_bits_left){var t=this._current_word>>>32-e;return this._current_word<<=e,this._current_word_bits_left-=e,t}var n=this._current_word_bits_left?this._current_word:0;n>>>=32-this._current_word_bits_left;var i=e-this._current_word_bits_left;this._fillCurrentWord();var r=Math.min(i,this._current_word_bits_left),s=this._current_word>>>32-r;return this._current_word<<=r,this._current_word_bits_left-=r,n=n<<r|s}},{key:"readBool",value:function(){return 1===this.readBits(1)}},{key:"readByte",value:function(){return this.readBits(8)}},{key:"_skipLeadingZero",value:function(){var e;for(e=0;e<this._current_word_bits_left;e++)if(0!=(this._current_word&2147483648>>>e))return this._current_word<<=e,this._current_word_bits_left-=e,e;return this._fillCurrentWord(),e+this._skipLeadingZero()}},{key:"readUEG",value:function(){var e=this._skipLeadingZero();return this.readBits(e+1)-1}},{key:"readSEG",value:function(){var e=this.readUEG();return 1&e?e+1>>>1:-1*(e>>>1)}}]),e}(),ee=function(){function e(){a()(this,e)}return l()(e,null,[{key:"_ebsp2rbsp",value:function(e){for(var t=e,n=t.byteLength,i=new Uint8Array(n),r=0,s=0;s<n;s++)s>=2&&3===t[s]&&0===t[s-1]&&0===t[s-2]||(i[r]=t[s],r++);return new Uint8Array(i.buffer,0,r)}},{key:"parseSPS",value:function(t){var n=e._ebsp2rbsp(t),i=new J(n);i.readByte();var r=i.readByte();i.readByte();var s=i.readByte();i.readUEG();var a=e.getProfileString(r),o=e.getLevelString(s),l=1,u=420,c=8;if((100===r||110===r||122===r||244===r||44===r||83===r||86===r||118===r||128===r||138===r||144===r)&&(3===(l=i.readUEG())&&i.readBits(1),l<=3&&(u=[0,420,422,444][l]),c=i.readUEG()+8,i.readUEG(),i.readBits(1),i.readBool()))for(var h=3!==l?8:12,d=0;d<h;d++)i.readBool()&&(d<6?e._skipScalingList(i,16):e._skipScalingList(i,64));i.readUEG();var f=i.readUEG();if(0===f)i.readUEG();else if(1===f){i.readBits(1),i.readSEG(),i.readSEG();for(var p=i.readUEG(),_=0;_<p;_++)i.readSEG()}var g=i.readUEG();i.readBits(1);var m=i.readUEG(),v=i.readUEG(),y=i.readBits(1);0===y&&i.readBits(1),i.readBits(1);var b=0,E=0,w=0,k=0;i.readBool()&&(b=i.readUEG(),E=i.readUEG(),w=i.readUEG(),k=i.readUEG());var S=1,T=1,A=0,C=!0,R=0,L=0;if(i.readBool()){if(i.readBool()){var x=i.readByte();x>0&&x<16?(S=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2][x-1],T=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1][x-1]):255===x&&(S=i.readByte()<<8|i.readByte(),T=i.readByte()<<8|i.readByte())}if(i.readBool()&&i.readBool(),i.readBool()&&(i.readBits(4),i.readBool()&&i.readBits(24)),i.readBool()&&(i.readUEG(),i.readUEG()),i.readBool()){var I=i.readBits(32),D=i.readBits(32);C=i.readBool(),A=(R=D)/(L=2*I)}}var P=1;1===S&&1===T||(P=S/T);var O=0,M=0;0===l?(O=1,M=2-y):(O=3===l?1:2,M=(1===l?2:1)*(2-y));var N=16*(m+1),F=16*(v+1)*(2-y);N-=(b+E)*O,F-=(w+k)*M;var B=Math.ceil(N*P);return i.destroy(),i=null,{profile_string:a,level_string:o,bit_depth:c,ref_frames:g,chroma_format:u,chroma_format_string:e.getChromaFormatString(u),frame_rate:{fixed:C,fps:A,fps_den:L,fps_num:R},sar_ratio:{width:S,height:T},codec_size:{width:N,height:F},present_size:{width:B,height:F}}}},{key:"_skipScalingList",value:function(e,t){for(var n=8,i=8,r=0;r<t;r++)0!==i&&(i=(n+e.readSEG()+256)%256),n=0===i?n:i}},{key:"getProfileString",value:function(e){switch(e){case 66:return"Baseline";case 77:return"Main";case 88:return"Extended";case 100:return"High";case 110:return"High10";case 122:return"High422";case 244:return"High444";default:return"Unknown"}}},{key:"getLevelString",value:function(e){return(e/10).toFixed(1)}},{key:"getChromaFormatString",value:function(e){switch(e){case 420:return"4:2:0";case 422:return"4:2:2";case 444:return"4:4:4";default:return"Unknown"}}}]),e}(),te={OK:"OK",FORMAT_ERROR:"FormatError",FORMAT_UNSUPPORTED:"FormatUnsupported",CODEC_UNSUPPORTED:"CodecUnsupported"};var ne=function(){function e(t,n){a()(this,e),this.TAG="FLVDemuxer",this._config=n,this._onError=null,this._onMediaInfo=null,this._onMetaDataArrived=null,this._onScriptDataArrived=null,this._onTrackMetadata=null,this._onDataAvailable=null,this._dataOffset=t.dataOffset,this._firstParse=!0,this._dispatch=!1,this._hasAudio=t.hasAudioTrack,this._hasVideo=t.hasVideoTrack,this._hasAudioFlagOverrided=!1,this._hasVideoFlagOverrided=!1,this._audioInitialMetadataDispatched=!1,this._videoInitialMetadataDispatched=!1,this._mediaInfo=new z,this._mediaInfo.hasAudio=this._hasAudio,this._mediaInfo.hasVideo=this._hasVideo,this._metadata=null,this._audioMetadata=null,this._videoMetadata=null,this._naluLengthSize=4,this._timestampBase=0,this._timescale=1e3,this._duration=0,this._durationOverrided=!1,this._referenceFrameRate={fixed:!0,fps:23.976,fps_num:23976,fps_den:1e3},this._flvSoundRateTable=[5500,11025,22050,44100,48e3],this._mpegSamplingRates=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],this._mpegAudioV10SampleRateTable=[44100,48e3,32e3,0],this._mpegAudioV20SampleRateTable=[22050,24e3,16e3,0],this._mpegAudioV25SampleRateTable=[11025,12e3,8e3,0],this._mpegAudioL1BitRateTable=[0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,-1],this._mpegAudioL2BitRateTable=[0,32,48,56,64,80,96,112,128,160,192,224,256,320,384,-1],this._mpegAudioL3BitRateTable=[0,32,40,48,56,64,80,96,112,128,160,192,224,256,320,-1],this._videoTrack={type:"video",id:1,sequenceNumber:0,samples:[],length:0},this._audioTrack={type:"audio",id:2,sequenceNumber:0,samples:[],length:0},this._littleEndian=function(){var e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),256===new Int16Array(e)[0]}()}return l()(e,[{key:"destroy",value:function(){this._mediaInfo=null,this._metadata=null,this._audioMetadata=null,this._videoMetadata=null,this._videoTrack=null,this._audioTrack=null,this._onError=null,this._onMediaInfo=null,this._onMetaDataArrived=null,this._onScriptDataArrived=null,this._onTrackMetadata=null,this._onDataAvailable=null}},{key:"bindDataSource",value:function(e){return e.onDataArrival=this.parseChunks.bind(this),this}},{key:"onTrackMetadata",get:function(){return this._onTrackMetadata},set:function(e){this._onTrackMetadata=e}},{key:"onMediaInfo",get:function(){return this._onMediaInfo},set:function(e){this._onMediaInfo=e}},{key:"onMetaDataArrived",get:function(){return this._onMetaDataArrived},set:function(e){this._onMetaDataArrived=e}},{key:"onScriptDataArrived",get:function(){return this._onScriptDataArrived},set:function(e){this._onScriptDataArrived=e}},{key:"onError",get:function(){return this._onError},set:function(e){this._onError=e}},{key:"onDataAvailable",get:function(){return this._onDataAvailable},set:function(e){this._onDataAvailable=e}},{key:"timestampBase",get:function(){return this._timestampBase},set:function(e){this._timestampBase=e}},{key:"overridedDuration",get:function(){return this._duration},set:function(e){this._durationOverrided=!0,this._duration=e,this._mediaInfo.duration=e}},{key:"overridedHasAudio",set:function(e){this._hasAudioFlagOverrided=!0,this._hasAudio=e,this._mediaInfo.hasAudio=e}},{key:"overridedHasVideo",set:function(e){this._hasVideoFlagOverrided=!0,this._hasVideo=e,this._mediaInfo.hasVideo=e}},{key:"resetMediaInfo",value:function(){this._mediaInfo=new z}},{key:"_isInitialMetadataDispatched",value:function(){return this._hasAudio&&this._hasVideo?this._audioInitialMetadataDispatched&&this._videoInitialMetadataDispatched:this._hasAudio&&!this._hasVideo?this._audioInitialMetadataDispatched:!(this._hasAudio||!this._hasVideo)&&this._videoInitialMetadataDispatched}},{key:"parseChunks",value:function(t,n){if(!(this._onError&&this._onMediaInfo&&this._onTrackMetadata&&this._onDataAvailable))throw new E("Flv: onError & onMediaInfo & onTrackMetadata & onDataAvailable callback must be specified");var i=0,r=this._littleEndian;if(0===n){if(!(t.byteLength>13))return 0;i=e.probe(t).dataOffset}this._firstParse&&(this._firstParse=!1,n+i!==this._dataOffset&&p.w(this.TAG,"First time parsing but chunk byteStart invalid!"),0!==new DataView(t,i).getUint32(0,!r)&&p.w(this.TAG,"PrevTagSize0 !== 0 !!!"),i+=4);for(;i<t.byteLength;){this._dispatch=!0;var s=new DataView(t,i);if(i+11+4>t.byteLength)break;var a=s.getUint8(0),o=16777215&s.getUint32(0,!r);if(i+11+o+4>t.byteLength)break;if(8===a||9===a||18===a){var l=s.getUint8(4),u=s.getUint8(5),c=s.getUint8(6)|u<<8|l<<16|s.getUint8(7)<<24;0!==(16777215&s.getUint32(7,!r))&&p.w(this.TAG,"Meet tag which has StreamID != 0!");var h=i+11;switch(a){case 8:this._parseAudioData(t,h,o,c);break;case 9:this._parseVideoData(t,h,o,c,n+i);break;case 18:this._parseScriptData(t,h,o)}var d=s.getUint32(11+o,!r);d!==11+o&&p.w(this.TAG,"Invalid PrevTagSize ".concat(d)),i+=11+o+4}else p.w(this.TAG,"Unsupported tag type ".concat(a,", skipped")),i+=11+o+4}return this._isInitialMetadataDispatched()&&this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack),i}},{key:"_parseScriptData",value:function(e,t,n){var i=Q.parseScriptData(e,t,n);if(i.hasOwnProperty("onMetaData")){if(null==i.onMetaData||"object"!==r()(i.onMetaData))return void p.w(this.TAG,"Invalid onMetaData structure!");this._metadata&&p.w(this.TAG,"Found another onMetaData tag!"),this._metadata=i;var s=this._metadata.onMetaData;if(this._onMetaDataArrived&&this._onMetaDataArrived(Object.assign({},s)),"boolean"==typeof s.hasAudio&&!1===this._hasAudioFlagOverrided&&(this._hasAudio=s.hasAudio,this._mediaInfo.hasAudio=this._hasAudio),"boolean"==typeof s.hasVideo&&!1===this._hasVideoFlagOverrided&&(this._hasVideo=s.hasVideo,this._mediaInfo.hasVideo=this._hasVideo),"number"==typeof s.audiodatarate&&(this._mediaInfo.audioDataRate=s.audiodatarate),"number"==typeof s.videodatarate&&(this._mediaInfo.videoDataRate=s.videodatarate),"number"==typeof s.width&&(this._mediaInfo.width=s.width),"number"==typeof s.height&&(this._mediaInfo.height=s.height),"number"==typeof s.duration){if(!this._durationOverrided){var a=Math.floor(s.duration*this._timescale);this._duration=a,this._mediaInfo.duration=a}}else this._mediaInfo.duration=0;if("number"==typeof s.framerate){var o=Math.floor(1e3*s.framerate);if(o>0){var l=o/1e3;this._referenceFrameRate.fixed=!0,this._referenceFrameRate.fps=l,this._referenceFrameRate.fps_num=o,this._referenceFrameRate.fps_den=1e3,this._mediaInfo.fps=l}}if("object"===r()(s.keyframes)){this._mediaInfo.hasKeyframesIndex=!0;var u=s.keyframes;this._mediaInfo.keyframesIndex=this._parseKeyframesIndex(u),s.keyframes=null}else this._mediaInfo.hasKeyframesIndex=!1;this._dispatch=!1,this._mediaInfo.metadata=s,p.v(this.TAG,"Parsed onMetaData"),this._mediaInfo.isComplete()&&this._onMediaInfo(this._mediaInfo)}Object.keys(i).length>0&&this._onScriptDataArrived&&this._onScriptDataArrived(Object.assign({},i))}},{key:"_parseKeyframesIndex",value:function(e){for(var t=[],n=[],i=1;i<e.times.length;i++){var r=this._timestampBase+Math.floor(1e3*e.times[i]);t.push(r),n.push(e.filepositions[i])}return{times:t,filepositions:n}}},{key:"_parseAudioData",value:function(e,t,n,i){if(n<=1)p.w(this.TAG,"Flv: Invalid audio packet, missing SoundData payload!");else if(!0!==this._hasAudioFlagOverrided||!1!==this._hasAudio){this._littleEndian;var r=new DataView(e,t,n).getUint8(0),s=r>>>4;if(2===s||10===s){var a=0,o=(12&r)>>>2;if(o>=0&&o<=4){a=this._flvSoundRateTable[o];var l=1&r,u=this._audioMetadata,c=this._audioTrack;if(u||(!1===this._hasAudio&&!1===this._hasAudioFlagOverrided&&(this._hasAudio=!0,this._mediaInfo.hasAudio=!0),(u=this._audioMetadata={}).type="audio",u.id=c.id,u.timescale=this._timescale,u.duration=this._duration,u.audioSampleRate=a,u.channelCount=0===l?1:2),10===s){var h=this._parseAACAudioData(e,t+1,n-1);if(null==h)return;if(0===h.packetType){u.config&&p.w(this.TAG,"Found another AudioSpecificConfig!");var d=h.data;u.audioSampleRate=d.samplingRate,u.channelCount=d.channelCount,u.codec=d.codec,u.originalCodec=d.originalCodec,u.config=d.config,u.refSampleDuration=1024/u.audioSampleRate*u.timescale,p.v(this.TAG,"Parsed AudioSpecificConfig"),this._isInitialMetadataDispatched()?this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack):this._audioInitialMetadataDispatched=!0,this._dispatch=!1,this._onTrackMetadata("audio",u);var f=this._mediaInfo;f.audioCodec=u.originalCodec,f.audioSampleRate=u.audioSampleRate,f.audioChannelCount=u.channelCount,f.hasVideo?null!=f.videoCodec&&(f.mimeType='video/x-flv; codecs="'+f.videoCodec+","+f.audioCodec+'"'):f.mimeType='video/x-flv; codecs="'+f.audioCodec+'"',f.isComplete()&&this._onMediaInfo(f)}else if(1===h.packetType){var _=this._timestampBase+i,g={unit:h.data,length:h.data.byteLength,dts:_,pts:_};c.samples.push(g),c.length+=h.data.length}else p.e(this.TAG,"Flv: Unsupported AAC data type ".concat(h.packetType))}else if(2===s){if(!u.codec){var m=this._parseMP3AudioData(e,t+1,n-1,!0);if(null==m)return;u.audioSampleRate=m.samplingRate,u.channelCount=m.channelCount,u.codec=m.codec,u.originalCodec=m.originalCodec,u.refSampleDuration=1152/u.audioSampleRate*u.timescale,p.v(this.TAG,"Parsed MPEG Audio Frame Header"),this._audioInitialMetadataDispatched=!0,this._onTrackMetadata("audio",u);var v=this._mediaInfo;v.audioCodec=u.codec,v.audioSampleRate=u.audioSampleRate,v.audioChannelCount=u.channelCount,v.audioDataRate=m.bitRate,v.hasVideo?null!=v.videoCodec&&(v.mimeType='video/x-flv; codecs="'+v.videoCodec+","+v.audioCodec+'"'):v.mimeType='video/x-flv; codecs="'+v.audioCodec+'"',v.isComplete()&&this._onMediaInfo(v)}var y=this._parseMP3AudioData(e,t+1,n-1,!1);if(null==y)return;var b=this._timestampBase+i,E={unit:y,length:y.byteLength,dts:b,pts:b};c.samples.push(E),c.length+=y.length}}else this._onError(te.FORMAT_ERROR,"Flv: Invalid audio sample rate idx: "+o)}else this._onError(te.CODEC_UNSUPPORTED,"Flv: Unsupported audio codec idx: "+s)}}},{key:"_parseAACAudioData",value:function(e,t,n){if(!(n<=1)){var i={},r=new Uint8Array(e,t,n);return i.packetType=r[0],0===r[0]?i.data=this._parseAACAudioSpecificConfig(e,t+1,n-1):i.data=r.subarray(1),i}p.w(this.TAG,"Flv: Invalid AAC packet, missing AACPacketType or/and Data!")}},{key:"_parseAACAudioSpecificConfig",value:function(e,t,n){var i,r,s=new Uint8Array(e,t,n),a=null,o=0,l=null;if(o=i=s[0]>>>3,(r=(7&s[0])<<1|s[1]>>>7)<0||r>=this._mpegSamplingRates.length)this._onError(te.FORMAT_ERROR,"Flv: AAC invalid sampling frequency index!");else{var u=this._mpegSamplingRates[r],c=(120&s[1])>>>3;if(!(c<0||c>=8)){5===o&&(l=(7&s[1])<<1|s[2]>>>7,(124&s[2])>>>2);var h=self.navigator.userAgent.toLowerCase();return-1!==h.indexOf("firefox")?r>=6?(o=5,a=new Array(4),l=r-3):(o=2,a=new Array(2),l=r):-1!==h.indexOf("android")?(o=2,a=new Array(2),l=r):(o=5,l=r,a=new Array(4),r>=6?l=r-3:1===c&&(o=2,a=new Array(2),l=r)),a[0]=o<<3,a[0]|=(15&r)>>>1,a[1]=(15&r)<<7,a[1]|=(15&c)<<3,5===o&&(a[1]|=(15&l)>>>1,a[2]=(1&l)<<7,a[2]|=8,a[3]=0),{config:a,samplingRate:u,channelCount:c,codec:"mp4a.40."+o,originalCodec:"mp4a.40."+i}}this._onError(te.FORMAT_ERROR,"Flv: AAC invalid channel configuration")}}},{key:"_parseMP3AudioData",value:function(e,t,n,i){if(!(n<4)){this._littleEndian;var r=new Uint8Array(e,t,n),s=null;if(i){if(255!==r[0])return;var a=r[1]>>>3&3,o=(6&r[1])>>1,l=(240&r[2])>>>4,u=(12&r[2])>>>2,c=3!==(r[3]>>>6&3)?2:1,h=0,d=0;switch(a){case 0:h=this._mpegAudioV25SampleRateTable[u];break;case 2:h=this._mpegAudioV20SampleRateTable[u];break;case 3:h=this._mpegAudioV10SampleRateTable[u]}switch(o){case 1:34,l<this._mpegAudioL3BitRateTable.length&&(d=this._mpegAudioL3BitRateTable[l]);break;case 2:33,l<this._mpegAudioL2BitRateTable.length&&(d=this._mpegAudioL2BitRateTable[l]);break;case 3:32,l<this._mpegAudioL1BitRateTable.length&&(d=this._mpegAudioL1BitRateTable[l])}s={bitRate:d,samplingRate:h,channelCount:c,codec:"mp3",originalCodec:"mp3"}}else s=r;return s}p.w(this.TAG,"Flv: Invalid MP3 packet, header missing!")}},{key:"_parseVideoData",value:function(e,t,n,i,r){if(n<=1)p.w(this.TAG,"Flv: Invalid video packet, missing VideoData payload!");else if(!0!==this._hasVideoFlagOverrided||!1!==this._hasVideo){var s=new Uint8Array(e,t,n)[0],a=(240&s)>>>4,o=15&s;7===o?this._parseAVCVideoPacket(e,t+1,n-1,i,r,a):this._onError(te.CODEC_UNSUPPORTED,"Flv: Unsupported codec in video frame: ".concat(o))}}},{key:"_parseAVCVideoPacket",value:function(e,t,n,i,r,s){if(n<4)p.w(this.TAG,"Flv: Invalid AVC packet, missing AVCPacketType or/and CompositionTime");else{var a=this._littleEndian,o=new DataView(e,t,n),l=o.getUint8(0),u=(16777215&o.getUint32(0,!a))<<8>>8;if(0===l)this._parseAVCDecoderConfigurationRecord(e,t+4,n-4);else if(1===l)this._parseAVCVideoData(e,t+4,n-4,i,r,s,u);else if(2!==l)return void this._onError(te.FORMAT_ERROR,"Flv: Invalid video packet type ".concat(l))}}},{key:"_parseAVCDecoderConfigurationRecord",value:function(e,t,n){if(n<7)p.w(this.TAG,"Flv: Invalid AVCDecoderConfigurationRecord, lack of data!");else{var i=this._videoMetadata,r=this._videoTrack,s=this._littleEndian,a=new DataView(e,t,n);i?void 0!==i.avcc&&p.w(this.TAG,"Found another AVCDecoderConfigurationRecord!"):(!1===this._hasVideo&&!1===this._hasVideoFlagOverrided&&(this._hasVideo=!0,this._mediaInfo.hasVideo=!0),(i=this._videoMetadata={}).type="video",i.id=r.id,i.timescale=this._timescale,i.duration=this._duration);var o=a.getUint8(0),l=a.getUint8(1);a.getUint8(2),a.getUint8(3);if(1===o&&0!==l)if(this._naluLengthSize=1+(3&a.getUint8(4)),3===this._naluLengthSize||4===this._naluLengthSize){var u=31&a.getUint8(5);if(0!==u){u>1&&p.w(this.TAG,"Flv: Strange AVCDecoderConfigurationRecord: SPS Count = ".concat(u));for(var c=6,h=0;h<u;h++){var d=a.getUint16(c,!s);if(c+=2,0!==d){var f=new Uint8Array(e,t+c,d);c+=d;var _=ee.parseSPS(f);if(0===h){i.codecWidth=_.codec_size.width,i.codecHeight=_.codec_size.height,i.presentWidth=_.present_size.width,i.presentHeight=_.present_size.height,i.profile=_.profile_string,i.level=_.level_string,i.bitDepth=_.bit_depth,i.chromaFormat=_.chroma_format,i.sarRatio=_.sar_ratio,i.frameRate=_.frame_rate,!1!==_.frame_rate.fixed&&0!==_.frame_rate.fps_num&&0!==_.frame_rate.fps_den||(i.frameRate=this._referenceFrameRate);var g=i.frameRate.fps_den,m=i.frameRate.fps_num;i.refSampleDuration=i.timescale*(g/m);for(var v=f.subarray(1,4),y="avc1.",b=0;b<3;b++){var E=v[b].toString(16);E.length<2&&(E="0"+E),y+=E}i.codec=y;var w=this._mediaInfo;w.width=i.codecWidth,w.height=i.codecHeight,w.fps=i.frameRate.fps,w.profile=i.profile,w.level=i.level,w.refFrames=_.ref_frames,w.chromaFormat=_.chroma_format_string,w.sarNum=i.sarRatio.width,w.sarDen=i.sarRatio.height,w.videoCodec=y,w.hasAudio?null!=w.audioCodec&&(w.mimeType='video/x-flv; codecs="'+w.videoCodec+","+w.audioCodec+'"'):w.mimeType='video/x-flv; codecs="'+w.videoCodec+'"',w.isComplete()&&this._onMediaInfo(w)}}}var k=a.getUint8(c);if(0!==k){k>1&&p.w(this.TAG,"Flv: Strange AVCDecoderConfigurationRecord: PPS Count = ".concat(k)),c++;for(var S=0;S<k;S++){var T=a.getUint16(c,!s);c+=2,0!==T&&(c+=T)}i.avcc=new Uint8Array(n),i.avcc.set(new Uint8Array(e,t,n),0),p.v(this.TAG,"Parsed AVCDecoderConfigurationRecord"),this._isInitialMetadataDispatched()?this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack):this._videoInitialMetadataDispatched=!0,this._dispatch=!1,this._onTrackMetadata("video",i)}else this._onError(te.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord: No PPS")}else this._onError(te.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord: No SPS")}else this._onError(te.FORMAT_ERROR,"Flv: Strange NaluLengthSizeMinusOne: ".concat(this._naluLengthSize-1));else this._onError(te.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord")}}},{key:"_parseAVCVideoData",value:function(e,t,n,i,r,s,a){for(var o=this._littleEndian,l=new DataView(e,t,n),u=[],c=0,h=0,d=this._naluLengthSize,f=this._timestampBase+i,_=1===s;h<n;){if(h+4>=n){p.w(this.TAG,"Malformed Nalu near timestamp ".concat(f,", offset = ").concat(h,", dataSize = ").concat(n));break}var g=l.getUint32(h,!o);if(3===d&&(g>>>=8),g>n-d)return void p.w(this.TAG,"Malformed Nalus near timestamp ".concat(f,", NaluSize > DataSize!"));var m=31&l.getUint8(h+d);5===m&&(_=!0);var v=new Uint8Array(e,t+h,d+g),y={type:m,data:v};u.push(y),c+=v.byteLength,h+=d+g}if(u.length){var b=this._videoTrack,E={units:u,length:c,isKeyframe:_,dts:f,cts:a,pts:f+a};_&&(E.fileposition=r),b.samples.push(E),b.length+=c}}}],[{key:"probe",value:function(e){var t=new Uint8Array(e),n={match:!1};if(70!==t[0]||76!==t[1]||86!==t[2]||1!==t[3])return n;var i,r,s=(4&t[4])>>>2!=0,a=0!=(1&t[4]),o=(i=t)[r=5]<<24|i[r+1]<<16|i[r+2]<<8|i[r+3];return o<9?n:{match:!0,consumed:o,dataOffset:o,hasAudioTrack:s,hasVideoTrack:a}}}]),e}(),ie=ne,re=function(){function e(){a()(this,e)}return l()(e,null,[{key:"init",value:function(){for(var t in e.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[],".mp3":[]},e.types)e.types.hasOwnProperty(t)&&(e.types[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)]);var n=e.constants={};n.FTYP=new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]),n.STSD_PREFIX=new Uint8Array([0,0,0,0,0,0,0,1]),n.STTS=new Uint8Array([0,0,0,0,0,0,0,0]),n.STSC=n.STCO=n.STTS,n.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),n.HDLR_VIDEO=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.HDLR_AUDIO=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]),n.DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),n.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),n.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}},{key:"box",value:function(e){for(var t=8,n=null,i=Array.prototype.slice.call(arguments,1),r=i.length,s=0;s<r;s++)t+=i[s].byteLength;(n=new Uint8Array(t))[0]=t>>>24&255,n[1]=t>>>16&255,n[2]=t>>>8&255,n[3]=255&t,n.set(e,4);for(var a=8,o=0;o<r;o++)n.set(i[o],a),a+=i[o].byteLength;return n}},{key:"generateInitSegment",value:function(t){var n=e.box(e.types.ftyp,e.constants.FTYP),i=e.moov(t),r=new Uint8Array(n.byteLength+i.byteLength);return r.set(n,0),r.set(i,n.byteLength),r}},{key:"moov",value:function(t){var n=e.mvhd(t.timescale,t.duration),i=e.trak(t),r=e.mvex(t);return e.box(e.types.moov,n,i,r)}},{key:"mvhd",value:function(t,n){return e.box(e.types.mvhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,n>>>24&255,n>>>16&255,n>>>8&255,255&n,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]))}},{key:"trak",value:function(t){return e.box(e.types.trak,e.tkhd(t),e.mdia(t))}},{key:"tkhd",value:function(t){var n=t.id,i=t.duration,r=t.presentWidth,s=t.presentHeight;return e.box(e.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,n>>>24&255,n>>>16&255,n>>>8&255,255&n,0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,r>>>8&255,255&r,0,0,s>>>8&255,255&s,0,0]))}},{key:"mdia",value:function(t){return e.box(e.types.mdia,e.mdhd(t),e.hdlr(t),e.minf(t))}},{key:"mdhd",value:function(t){var n=t.timescale,i=t.duration;return e.box(e.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,n>>>24&255,n>>>16&255,n>>>8&255,255&n,i>>>24&255,i>>>16&255,i>>>8&255,255&i,85,196,0,0]))}},{key:"hdlr",value:function(t){var n=null;return n="audio"===t.type?e.constants.HDLR_AUDIO:e.constants.HDLR_VIDEO,e.box(e.types.hdlr,n)}},{key:"minf",value:function(t){var n=null;return n="audio"===t.type?e.box(e.types.smhd,e.constants.SMHD):e.box(e.types.vmhd,e.constants.VMHD),e.box(e.types.minf,n,e.dinf(),e.stbl(t))}},{key:"dinf",value:function(){return e.box(e.types.dinf,e.box(e.types.dref,e.constants.DREF))}},{key:"stbl",value:function(t){return e.box(e.types.stbl,e.stsd(t),e.box(e.types.stts,e.constants.STTS),e.box(e.types.stsc,e.constants.STSC),e.box(e.types.stsz,e.constants.STSZ),e.box(e.types.stco,e.constants.STCO))}},{key:"stsd",value:function(t){return"audio"===t.type?"mp3"===t.codec?e.box(e.types.stsd,e.constants.STSD_PREFIX,e.mp3(t)):e.box(e.types.stsd,e.constants.STSD_PREFIX,e.mp4a(t)):e.box(e.types.stsd,e.constants.STSD_PREFIX,e.avc1(t))}},{key:"mp3",value:function(t){var n=t.channelCount,i=t.audioSampleRate,r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,n,0,16,0,0,0,0,i>>>8&255,255&i,0,0]);return e.box(e.types[".mp3"],r)}},{key:"mp4a",value:function(t){var n=t.channelCount,i=t.audioSampleRate,r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,n,0,16,0,0,0,0,i>>>8&255,255&i,0,0]);return e.box(e.types.mp4a,r,e.esds(t))}},{key:"esds",value:function(t){var n=t.config||[],i=n.length,r=new Uint8Array([0,0,0,0,3,23+i,0,1,0,4,15+i,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([i]).concat(n).concat([6,1,2]));return e.box(e.types.esds,r)}},{key:"avc1",value:function(t){var n=t.avcc,i=t.codecWidth,r=t.codecHeight,s=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,i>>>8&255,255&i,r>>>8&255,255&r,0,72,0,0,0,72,0,0,0,0,0,0,0,1,10,120,113,113,47,102,108,118,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return e.box(e.types.avc1,s,e.box(e.types.avcC,n))}},{key:"mvex",value:function(t){return e.box(e.types.mvex,e.trex(t))}},{key:"trex",value:function(t){var n=t.id,i=new Uint8Array([0,0,0,0,n>>>24&255,n>>>16&255,n>>>8&255,255&n,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return e.box(e.types.trex,i)}},{key:"moof",value:function(t,n){return e.box(e.types.moof,e.mfhd(t.sequenceNumber),e.traf(t,n))}},{key:"mfhd",value:function(t){var n=new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t]);return e.box(e.types.mfhd,n)}},{key:"traf",value:function(t,n){var i=t.id,r=e.box(e.types.tfhd,new Uint8Array([0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i])),s=e.box(e.types.tfdt,new Uint8Array([0,0,0,0,n>>>24&255,n>>>16&255,n>>>8&255,255&n])),a=e.sdtp(t),o=e.trun(t,a.byteLength+16+16+8+16+8+8);return e.box(e.types.traf,r,s,o,a)}},{key:"sdtp",value:function(t){for(var n=t.samples||[],i=n.length,r=new Uint8Array(4+i),s=0;s<i;s++){var a=n[s].flags;r[s+4]=a.isLeading<<6|a.dependsOn<<4|a.isDependedOn<<2|a.hasRedundancy}return e.box(e.types.sdtp,r)}},{key:"trun",value:function(t,n){var i=t.samples||[],r=i.length,s=12+16*r,a=new Uint8Array(s);n+=8+s,a.set([0,0,15,1,r>>>24&255,r>>>16&255,r>>>8&255,255&r,n>>>24&255,n>>>16&255,n>>>8&255,255&n],0);for(var o=0;o<r;o++){var l=i[o].duration,u=i[o].size,c=i[o].flags,h=i[o].cts;a.set([l>>>24&255,l>>>16&255,l>>>8&255,255&l,u>>>24&255,u>>>16&255,u>>>8&255,255&u,c.isLeading<<2|c.dependsOn,c.isDependedOn<<6|c.hasRedundancy<<4|c.isNonSync,0,0,h>>>24&255,h>>>16&255,h>>>8&255,255&h],12+16*o)}return e.box(e.types.trun,a)}},{key:"mdat",value:function(t){return e.box(e.types.mdat,t)}}]),e}();re.init();var se=re,ae=function(){function e(){a()(this,e)}return l()(e,null,[{key:"getSilentFrame",value:function(e,t){if("mp4a.40.2"===e){if(1===t)return new Uint8Array([0,200,0,128,35,128]);if(2===t)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(3===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(4===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(5===t)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===t)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===t)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===t)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===t)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])}return null}}]),e}(),oe=l()((function e(t,n,i,r,s){a()(this,e),this.dts=t,this.pts=n,this.duration=i,this.originalDts=r,this.isSyncPoint=s,this.fileposition=null})),le=function(){function e(){a()(this,e),this.beginDts=0,this.endDts=0,this.beginPts=0,this.endPts=0,this.originalBeginDts=0,this.originalEndDts=0,this.syncPoints=[],this.firstSample=null,this.lastSample=null}return l()(e,[{key:"appendSyncPoint",value:function(e){e.isSyncPoint=!0,this.syncPoints.push(e)}}]),e}(),ue=function(){function e(){a()(this,e),this._list=[]}return l()(e,[{key:"clear",value:function(){this._list=[]}},{key:"appendArray",value:function(e){var t=this._list;0!==e.length&&(t.length>0&&e[0].originalDts<t[t.length-1].originalDts&&this.clear(),Array.prototype.push.apply(t,e))}},{key:"getLastSyncPointBeforeDts",value:function(e){if(0==this._list.length)return null;var t=this._list,n=0,i=t.length-1,r=0,s=0,a=i;for(e<t[0].dts&&(n=0,s=a+1);s<=a;){if((r=s+Math.floor((a-s)/2))===i||e>=t[r].dts&&e<t[r+1].dts){n=r;break}t[r].dts<e?s=r+1:a=r-1}return this._list[n]}}]),e}(),ce=function(){function e(t){a()(this,e),this._type=t,this._list=[],this._lastAppendLocation=-1}return l()(e,[{key:"type",get:function(){return this._type}},{key:"length",get:function(){return this._list.length}},{key:"isEmpty",value:function(){return 0===this._list.length}},{key:"clear",value:function(){this._list=[],this._lastAppendLocation=-1}},{key:"_searchNearestSegmentBefore",value:function(e){var t=this._list;if(0===t.length)return-2;var n=t.length-1,i=0,r=0,s=n,a=0;if(e<t[0].originalBeginDts)return a=-1;for(;r<=s;){if((i=r+Math.floor((s-r)/2))===n||e>t[i].lastSample.originalDts&&e<t[i+1].originalBeginDts){a=i;break}t[i].originalBeginDts<e?r=i+1:s=i-1}return a}},{key:"_searchNearestSegmentAfter",value:function(e){return this._searchNearestSegmentBefore(e)+1}},{key:"append",value:function(e){var t=this._list,n=e,i=this._lastAppendLocation,r=0;-1!==i&&i<t.length&&n.originalBeginDts>=t[i].lastSample.originalDts&&(i===t.length-1||i<t.length-1&&n.originalBeginDts<t[i+1].originalBeginDts)?r=i+1:t.length>0&&(r=this._searchNearestSegmentBefore(n.originalBeginDts)+1),this._lastAppendLocation=r,this._list.splice(r,0,n)}},{key:"getLastSegmentBefore",value:function(e){var t=this._searchNearestSegmentBefore(e);return t>=0?this._list[t]:null}},{key:"getLastSampleBefore",value:function(e){var t=this.getLastSegmentBefore(e);return null!=t?t.lastSample:null}},{key:"getLastSyncPointBefore",value:function(e){for(var t=this._searchNearestSegmentBefore(e),n=this._list[t].syncPoints;0===n.length&&t>0;)t--,n=this._list[t].syncPoints;return n.length>0?n[n.length-1]:null}}]),e}(),he=function(){function e(t){a()(this,e),this.TAG="MP4Remuxer",this._config=t,this._isLive=!0===t.isLive,this._dtsBase=-1,this._dtsBaseInited=!1,this._audioDtsBase=1/0,this._videoDtsBase=1/0,this._audioNextDts=void 0,this._videoNextDts=void 0,this._audioStashedLastSample=null,this._videoStashedLastSample=null,this._audioMeta=null,this._videoMeta=null,this._audioSegmentInfoList=new ce("audio"),this._videoSegmentInfoList=new ce("video"),this._onInitSegment=null,this._onMediaSegment=null,this._forceFirstIDR=!(!D.chrome||!(D.version.major<50||50===D.version.major&&D.version.build<2661)),this._fillSilentAfterSeek=D.msedge||D.msie,this._mp3UseMpegAudio=!D.firefox,this._fillAudioTimestampGap=this._config.fixAudioTimestampGap}return l()(e,[{key:"destroy",value:function(){this._dtsBase=-1,this._dtsBaseInited=!1,this._audioMeta=null,this._videoMeta=null,this._audioSegmentInfoList.clear(),this._audioSegmentInfoList=null,this._videoSegmentInfoList.clear(),this._videoSegmentInfoList=null,this._onInitSegment=null,this._onMediaSegment=null}},{key:"bindDataSource",value:function(e){return e.onDataAvailable=this.remux.bind(this),e.onTrackMetadata=this._onTrackMetadataReceived.bind(this),this}},{key:"onInitSegment",get:function(){return this._onInitSegment},set:function(e){this._onInitSegment=e}},{key:"onMediaSegment",get:function(){return this._onMediaSegment},set:function(e){this._onMediaSegment=e}},{key:"insertDiscontinuity",value:function(){this._audioNextDts=this._videoNextDts=void 0}},{key:"seek",value:function(e){this._audioStashedLastSample=null,this._videoStashedLastSample=null,this._videoSegmentInfoList.clear(),this._audioSegmentInfoList.clear()}},{key:"remux",value:function(e,t){if(!this._onMediaSegment)throw new E("MP4Remuxer: onMediaSegment callback must be specificed!");this._dtsBaseInited||this._calculateDtsBase(e,t),this._remuxVideo(t),this._remuxAudio(e)}},{key:"_onTrackMetadataReceived",value:function(e,t){var n=null,i="mp4",r=t.codec;if("audio"===e)this._audioMeta=t,"mp3"===t.codec&&this._mp3UseMpegAudio?(i="mpeg",r="",n=new Uint8Array):n=se.generateInitSegment(t);else{if("video"!==e)return;this._videoMeta=t,n=se.generateInitSegment(t)}if(!this._onInitSegment)throw new E("MP4Remuxer: onInitSegment callback must be specified!");this._onInitSegment(e,{type:e,data:n.buffer,codec:r,container:"".concat(e,"/").concat(i),mediaDuration:t.duration})}},{key:"_calculateDtsBase",value:function(e,t){this._dtsBaseInited||(e.samples&&e.samples.length&&(this._audioDtsBase=e.samples[0].dts),t.samples&&t.samples.length&&(this._videoDtsBase=t.samples[0].dts),this._dtsBase=Math.min(this._audioDtsBase,this._videoDtsBase),this._dtsBaseInited=!0)}},{key:"flushStashedSamples",value:function(){var e=this._videoStashedLastSample,t=this._audioStashedLastSample,n={type:"video",id:1,sequenceNumber:0,samples:[],length:0};null!=e&&(n.samples.push(e),n.length=e.length);var i={type:"audio",id:2,sequenceNumber:0,samples:[],length:0};null!=t&&(i.samples.push(t),i.length=t.length),this._videoStashedLastSample=null,this._audioStashedLastSample=null,this._remuxVideo(n,!0),this._remuxAudio(i,!0)}},{key:"_remuxAudio",value:function(e,t){if(null!=this._audioMeta){var n,i=e,r=i.samples,s=void 0,a=-1,o=this._audioMeta.refSampleDuration,l="mp3"===this._audioMeta.codec&&this._mp3UseMpegAudio,u=this._dtsBaseInited&&void 0===this._audioNextDts,c=!1;if(r&&0!==r.length&&(1!==r.length||t)){var h=0,d=null,f=0;l?(h=0,f=i.length):(h=8,f=8+i.length);var _=null;if(r.length>1&&(f-=(_=r.pop()).length),null!=this._audioStashedLastSample){var g=this._audioStashedLastSample;this._audioStashedLastSample=null,r.unshift(g),f+=g.length}null!=_&&(this._audioStashedLastSample=_);var m=r[0].dts-this._dtsBase;if(this._audioNextDts)s=m-this._audioNextDts;else if(this._audioSegmentInfoList.isEmpty())s=0,this._fillSilentAfterSeek&&!this._videoSegmentInfoList.isEmpty()&&"mp3"!==this._audioMeta.originalCodec&&(c=!0);else{var v=this._audioSegmentInfoList.getLastSampleBefore(m);if(null!=v){var y=m-(v.originalDts+v.duration);y<=3&&(y=0),s=m-(v.dts+v.duration+y)}else s=0}if(c){var b=m-s,E=this._videoSegmentInfoList.getLastSegmentBefore(m);if(null!=E&&E.beginDts<b){var w=ae.getSilentFrame(this._audioMeta.originalCodec,this._audioMeta.channelCount);if(w){var k=E.beginDts,S=b-E.beginDts;p.v(this.TAG,"InsertPrefixSilentAudio: dts: ".concat(k,", duration: ").concat(S)),r.unshift({unit:w,dts:k,pts:k}),f+=w.byteLength}}else c=!1}for(var T=[],A=0;A<r.length;A++){var C=r[A],R=C.unit,L=C.dts-this._dtsBase,x=L-s;-1===a&&(a=x);var I=0;if(A!==r.length-1)I=r[A+1].dts-this._dtsBase-s-x;else if(null!=_)I=_.dts-this._dtsBase-s-x;else I=T.length>=1?T[T.length-1].duration:Math.floor(o);var P=!1,O=null;if(I>1.5*o&&"mp3"!==this._audioMeta.codec&&this._fillAudioTimestampGap&&!D.safari){P=!0;var M=Math.abs(I-o),N=Math.ceil(M/o),F=x+o;p.w(this.TAG,"Large audio timestamp gap detected, may cause AV sync to drift. Silent frames will be generated to avoid unsync.\n"+"dts: ".concat(x+I," ms, expected: ").concat(x+Math.round(o)," ms, ")+"delta: ".concat(Math.round(M)," ms, generate: ").concat(N," frames"));var B=ae.getSilentFrame(this._audioMeta.originalCodec,this._audioMeta.channelCount);null==B&&(p.w(this.TAG,"Unable to generate silent frame for "+"".concat(this._audioMeta.originalCodec," with ").concat(this._audioMeta.channelCount," channels, repeat last frame")),B=R),O=[];for(var U=0;U<N;U++){var K=Math.round(F);if(O.length>0){var $=O[O.length-1];$.duration=K-$.dts}var G={dts:K,pts:K,cts:0,unit:B,size:B.byteLength,duration:0,originalDts:L,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}};O.push(G),f+=G.size,F+=o}var j=O[O.length-1];j.duration=x+I-j.dts,I=Math.round(o)}T.push({dts:x,pts:x,cts:0,unit:C.unit,size:C.unit.byteLength,duration:I,originalDts:L,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}}),P&&T.push.apply(T,O)}l?d=new Uint8Array(f):((d=new Uint8Array(f))[0]=f>>>24&255,d[1]=f>>>16&255,d[2]=f>>>8&255,d[3]=255&f,d.set(se.types.mdat,4));for(var V=0;V<T.length;V++){var Z=T[V].unit;d.set(Z,h),h+=Z.byteLength}var H=T[T.length-1];n=H.dts+H.duration,this._audioNextDts=n;var z=new le;z.beginDts=a,z.endDts=n,z.beginPts=a,z.endPts=n,z.originalBeginDts=T[0].originalDts,z.originalEndDts=H.originalDts+H.duration,z.firstSample=new oe(T[0].dts,T[0].pts,T[0].duration,T[0].originalDts,!1),z.lastSample=new oe(H.dts,H.pts,H.duration,H.originalDts,!1),this._isLive||this._audioSegmentInfoList.append(z),i.samples=T,i.sequenceNumber++;var W=null;W=l?new Uint8Array:se.moof(i,a),i.samples=[],i.length=0;var q={type:"audio",data:this._mergeBoxes(W,d).buffer,sampleCount:T.length,info:z};l&&u&&(q.timestampOffset=a),this._onMediaSegment("audio",q)}}}},{key:"_remuxVideo",value:function(e,t){if(null!=this._videoMeta){var n,i,r=e,s=r.samples,a=void 0,o=-1,l=-1;if(s&&0!==s.length&&(1!==s.length||t)){var u=8,c=null,h=8+e.length,d=null;if(s.length>1&&(h-=(d=s.pop()).length),null!=this._videoStashedLastSample){var f=this._videoStashedLastSample;this._videoStashedLastSample=null,s.unshift(f),h+=f.length}null!=d&&(this._videoStashedLastSample=d);var p=s[0].dts-this._dtsBase;if(this._videoNextDts)a=p-this._videoNextDts;else if(this._videoSegmentInfoList.isEmpty())a=0;else{var _=this._videoSegmentInfoList.getLastSampleBefore(p);if(null!=_){var g=p-(_.originalDts+_.duration);g<=3&&(g=0),a=p-(_.dts+_.duration+g)}else a=0}for(var m=new le,v=[],y=0;y<s.length;y++){var b=s[y],E=b.dts-this._dtsBase,w=b.isKeyframe,k=E-a,S=b.cts,T=k+S;-1===o&&(o=k,l=T);var A=0;if(y!==s.length-1)A=s[y+1].dts-this._dtsBase-a-k;else if(null!=d)A=d.dts-this._dtsBase-a-k;else A=v.length>=1?v[v.length-1].duration:Math.floor(this._videoMeta.refSampleDuration);if(w){var C=new oe(k,T,A,b.dts,!0);C.fileposition=b.fileposition,m.appendSyncPoint(C)}v.push({dts:k,pts:T,cts:S,units:b.units,size:b.length,isKeyframe:w,duration:A,originalDts:E,flags:{isLeading:0,dependsOn:w?2:1,isDependedOn:w?1:0,hasRedundancy:0,isNonSync:w?0:1}})}(c=new Uint8Array(h))[0]=h>>>24&255,c[1]=h>>>16&255,c[2]=h>>>8&255,c[3]=255&h,c.set(se.types.mdat,4);for(var R=0;R<v.length;R++)for(var L=v[R].units;L.length;){var x=L.shift().data;c.set(x,u),u+=x.byteLength}var I=v[v.length-1];if(n=I.dts+I.duration,i=I.pts+I.duration,this._videoNextDts=n,m.beginDts=o,m.endDts=n,m.beginPts=l,m.endPts=i,m.originalBeginDts=v[0].originalDts,m.originalEndDts=I.originalDts+I.duration,m.firstSample=new oe(v[0].dts,v[0].pts,v[0].duration,v[0].originalDts,v[0].isKeyframe),m.lastSample=new oe(I.dts,I.pts,I.duration,I.originalDts,I.isKeyframe),this._isLive||this._videoSegmentInfoList.append(m),r.samples=v,r.sequenceNumber++,this._forceFirstIDR){var D=v[0].flags;D.dependsOn=2,D.isNonSync=0}var P=se.moof(r,o);r.samples=[],r.length=0,this._onMediaSegment("video",{type:"video",data:this._mergeBoxes(P,c).buffer,sampleCount:v.length,info:m})}}}},{key:"_mergeBoxes",value:function(e,t){var n=new Uint8Array(e.byteLength+t.byteLength);return n.set(e,0),n.set(t,e.byteLength),n}}]),e}(),de={IO_ERROR:"io_error",DEMUX_ERROR:"demux_error",INIT_SEGMENT:"init_segment",MEDIA_SEGMENT:"media_segment",LOADING_COMPLETE:"loading_complete",RECOVERED_EARLY_EOF:"recovered_early_eof",MEDIA_INFO:"media_info",METADATA_ARRIVED:"metadata_arrived",SCRIPTDATA_ARRIVED:"scriptdata_arrived",STATISTICS_INFO:"statistics_info",RECOMMEND_SEEKPOINT:"recommend_seekpoint"},fe=function(){function e(t,n){a()(this,e),this.TAG="TransmuxingController",this._emitter=new(d()),this._config=n,t.segments||(t.segments=[{duration:t.duration,filesize:t.filesize,url:t.url}]),"boolean"!=typeof t.cors&&(t.cors=!0),"boolean"!=typeof t.withCredentials&&(t.withCredentials=!1),this._mediaDataSource=t,this._currentSegmentIndex=0;var i=0;this._mediaDataSource.segments.forEach((function(e){e.timestampBase=i,i+=e.duration,e.cors=t.cors,e.withCredentials=t.withCredentials,n.referrerPolicy&&(e.referrerPolicy=n.referrerPolicy)})),isNaN(i)||this._mediaDataSource.duration===i||(this._mediaDataSource.duration=i),this._mediaInfo=null,this._demuxer=null,this._remuxer=null,this._ioctl=null,this._pendingSeekTime=null,this._pendingResolveSeekPoint=null,this._statisticsReporter=null}return l()(e,[{key:"destroy",value:function(){this._mediaInfo=null,this._mediaDataSource=null,this._statisticsReporter&&this._disableStatisticsReporter(),this._ioctl&&(this._ioctl.destroy(),this._ioctl=null),this._demuxer&&(this._demuxer.destroy(),this._demuxer=null),this._remuxer&&(this._remuxer.destroy(),this._remuxer=null),this._emitter.removeAllListeners(),this._emitter=null}},{key:"on",value:function(e,t){this._emitter.addListener(e,t)}},{key:"off",value:function(e,t){this._emitter.removeListener(e,t)}},{key:"start",value:function(){this._loadSegment(0),this._enableStatisticsReporter()}},{key:"_loadSegment",value:function(e,t){this._currentSegmentIndex=e;var n=this._mediaDataSource.segments[e],i=this._ioctl=new U(n,this._config,e);i.onError=this._onIOException.bind(this),i.onSeeked=this._onIOSeeked.bind(this),i.onComplete=this._onIOComplete.bind(this),i.onRedirect=this._onIORedirect.bind(this),i.onRecoveredEarlyEof=this._onIORecoveredEarlyEof.bind(this),t?this._demuxer.bindDataSource(this._ioctl):i.onDataArrival=this._onInitChunkArrival.bind(this),i.open(t)}},{key:"stop",value:function(){this._internalAbort(),this._disableStatisticsReporter()}},{key:"_internalAbort",value:function(){this._ioctl&&(this._ioctl.destroy(),this._ioctl=null)}},{key:"pause",value:function(){this._ioctl&&this._ioctl.isWorking()&&(this._ioctl.pause(),this._disableStatisticsReporter())}},{key:"resume",value:function(){this._ioctl&&this._ioctl.isPaused()&&(this._ioctl.resume(),this._enableStatisticsReporter())}},{key:"seek",value:function(e){if(null!=this._mediaInfo&&this._mediaInfo.isSeekable()){var t=this._searchSegmentIndexContains(e);if(t===this._currentSegmentIndex){var n=this._mediaInfo.segments[t];if(null==n)this._pendingSeekTime=e;else{var i=n.getNearestKeyframe(e);this._remuxer.seek(i.milliseconds),this._ioctl.seek(i.fileposition),this._pendingResolveSeekPoint=i.milliseconds}}else{var r=this._mediaInfo.segments[t];if(null==r)this._pendingSeekTime=e,this._internalAbort(),this._remuxer.seek(),this._remuxer.insertDiscontinuity(),this._loadSegment(t);else{var s=r.getNearestKeyframe(e);this._internalAbort(),this._remuxer.seek(e),this._remuxer.insertDiscontinuity(),this._demuxer.resetMediaInfo(),this._demuxer.timestampBase=this._mediaDataSource.segments[t].timestampBase,this._loadSegment(t,s.fileposition),this._pendingResolveSeekPoint=s.milliseconds,this._reportSegmentMediaInfo(t)}}this._enableStatisticsReporter()}}},{key:"_searchSegmentIndexContains",value:function(e){for(var t=this._mediaDataSource.segments,n=t.length-1,i=0;i<t.length;i++)if(e<t[i].timestampBase){n=i-1;break}return n}},{key:"_onInitChunkArrival",value:function(e,t){var n=this,i=null,r=0;if(t>0)this._demuxer.bindDataSource(this._ioctl),this._demuxer.timestampBase=this._mediaDataSource.segments[this._currentSegmentIndex].timestampBase,r=this._demuxer.parseChunks(e,t);else if((i=ie.probe(e)).match){this._demuxer=new ie(i,this._config),this._remuxer||(this._remuxer=new he(this._config));var s=this._mediaDataSource;null==s.duration||isNaN(s.duration)||(this._demuxer.overridedDuration=s.duration),"boolean"==typeof s.hasAudio&&(this._demuxer.overridedHasAudio=s.hasAudio),"boolean"==typeof s.hasVideo&&(this._demuxer.overridedHasVideo=s.hasVideo),this._demuxer.timestampBase=s.segments[this._currentSegmentIndex].timestampBase,this._demuxer.onError=this._onDemuxException.bind(this),this._demuxer.onMediaInfo=this._onMediaInfo.bind(this),this._demuxer.onMetaDataArrived=this._onMetaDataArrived.bind(this),this._demuxer.onScriptDataArrived=this._onScriptDataArrived.bind(this),this._remuxer.bindDataSource(this._demuxer.bindDataSource(this._ioctl)),this._remuxer.onInitSegment=this._onRemuxerInitSegmentArrival.bind(this),this._remuxer.onMediaSegment=this._onRemuxerMediaSegmentArrival.bind(this),r=this._demuxer.parseChunks(e,t)}else i=null,p.e(this.TAG,"Non-FLV, Unsupported media type!"),Promise.resolve().then((function(){n._internalAbort()})),this._emitter.emit(de.DEMUX_ERROR,te.FORMAT_UNSUPPORTED,"Non-FLV, Unsupported media type"),r=0;return r}},{key:"_onMediaInfo",value:function(e){var t=this;null==this._mediaInfo&&(this._mediaInfo=Object.assign({},e),this._mediaInfo.keyframesIndex=null,this._mediaInfo.segments=[],this._mediaInfo.segmentCount=this._mediaDataSource.segments.length,Object.setPrototypeOf(this._mediaInfo,z.prototype));var n=Object.assign({},e);Object.setPrototypeOf(n,z.prototype),this._mediaInfo.segments[this._currentSegmentIndex]=n,this._reportSegmentMediaInfo(this._currentSegmentIndex),null!=this._pendingSeekTime&&Promise.resolve().then((function(){var e=t._pendingSeekTime;t._pendingSeekTime=null,t.seek(e)}))}},{key:"_onMetaDataArrived",value:function(e){this._emitter.emit(de.METADATA_ARRIVED,e)}},{key:"_onScriptDataArrived",value:function(e){this._emitter.emit(de.SCRIPTDATA_ARRIVED,e)}},{key:"_onIOSeeked",value:function(){this._remuxer.insertDiscontinuity()}},{key:"_onIOComplete",value:function(e){var t=e+1;t<this._mediaDataSource.segments.length?(this._internalAbort(),this._remuxer.flushStashedSamples(),this._loadSegment(t)):(this._remuxer.flushStashedSamples(),this._emitter.emit(de.LOADING_COMPLETE),this._disableStatisticsReporter())}},{key:"_onIORedirect",value:function(e){var t=this._ioctl.extraData;this._mediaDataSource.segments[t].redirectedURL=e}},{key:"_onIORecoveredEarlyEof",value:function(){this._emitter.emit(de.RECOVERED_EARLY_EOF)}},{key:"_onIOException",value:function(e,t){p.e(this.TAG,"IOException: type = ".concat(e,", code = ").concat(t.code,", msg = ").concat(t.msg)),this._emitter.emit(de.IO_ERROR,e,t),this._disableStatisticsReporter()}},{key:"_onDemuxException",value:function(e,t){p.e(this.TAG,"DemuxException: type = ".concat(e,", info = ").concat(t)),this._emitter.emit(de.DEMUX_ERROR,e,t)}},{key:"_onRemuxerInitSegmentArrival",value:function(e,t){this._emitter.emit(de.INIT_SEGMENT,e,t)}},{key:"_onRemuxerMediaSegmentArrival",value:function(e,t){if(null==this._pendingSeekTime&&(this._emitter.emit(de.MEDIA_SEGMENT,e,t),null!=this._pendingResolveSeekPoint&&"video"===e)){var n=t.info.syncPoints,i=this._pendingResolveSeekPoint;this._pendingResolveSeekPoint=null,D.safari&&n.length>0&&n[0].originalDts===i&&(i=n[0].pts),this._emitter.emit(de.RECOMMEND_SEEKPOINT,i)}}},{key:"_enableStatisticsReporter",value:function(){null==this._statisticsReporter&&(this._statisticsReporter=self.setInterval(this._reportStatisticsInfo.bind(this),this._config.statisticsInfoReportInterval))}},{key:"_disableStatisticsReporter",value:function(){this._statisticsReporter&&(self.clearInterval(this._statisticsReporter),this._statisticsReporter=null)}},{key:"_reportSegmentMediaInfo",value:function(e){var t=this._mediaInfo.segments[e],n=Object.assign({},t);n.duration=this._mediaInfo.duration,n.segmentCount=this._mediaInfo.segmentCount,delete n.segments,delete n.keyframesIndex,this._emitter.emit(de.MEDIA_INFO,n)}},{key:"_reportStatisticsInfo",value:function(){var e={};e.url=this._ioctl.currentURL,e.hasRedirect=this._ioctl.hasRedirect,e.hasRedirect&&(e.redirectedURL=this._ioctl.currentRedirectedURL),e.speed=this._ioctl.currentSpeed,e.loaderType=this._ioctl.loaderType,e.currentSegmentIndex=this._currentSegmentIndex,e.totalSegmentCount=this._mediaDataSource.segments.length,this._emitter.emit(de.STATISTICS_INFO,e)}}]),e}(),pe=function(e){var t=null,n=function(t,n){e.postMessage({msg:"logcat_callback",data:{type:t,logcat:n}})}.bind(this);function i(t,n){var i={msg:de.INIT_SEGMENT,data:{type:t,data:n}};e.postMessage(i,[n.data])}function r(t,n){var i={msg:de.MEDIA_SEGMENT,data:{type:t,data:n}};e.postMessage(i,[n.data])}function s(){var t={msg:de.LOADING_COMPLETE};e.postMessage(t)}function a(){var t={msg:de.RECOVERED_EARLY_EOF};e.postMessage(t)}function o(t){var n={msg:de.MEDIA_INFO,data:t};e.postMessage(n)}function l(t){var n={msg:de.METADATA_ARRIVED,data:t};e.postMessage(n)}function u(t){var n={msg:de.SCRIPTDATA_ARRIVED,data:t};e.postMessage(n)}function h(t){var n={msg:de.STATISTICS_INFO,data:t};e.postMessage(n)}function d(t,n){e.postMessage({msg:de.IO_ERROR,data:{type:t,info:n}})}function f(t,n){e.postMessage({msg:de.DEMUX_ERROR,data:{type:t,info:n}})}function p(t){e.postMessage({msg:de.RECOMMEND_SEEKPOINT,data:t})}c.install(),e.addEventListener("message",(function(c){switch(c.data.cmd){case"init":(t=new fe(c.data.param[0],c.data.param[1])).on(de.IO_ERROR,d.bind(this)),t.on(de.DEMUX_ERROR,f.bind(this)),t.on(de.INIT_SEGMENT,i.bind(this)),t.on(de.MEDIA_SEGMENT,r.bind(this)),t.on(de.LOADING_COMPLETE,s.bind(this)),t.on(de.RECOVERED_EARLY_EOF,a.bind(this)),t.on(de.MEDIA_INFO,o.bind(this)),t.on(de.METADATA_ARRIVED,l.bind(this)),t.on(de.SCRIPTDATA_ARRIVED,u.bind(this)),t.on(de.STATISTICS_INFO,h.bind(this)),t.on(de.RECOMMEND_SEEKPOINT,p.bind(this));break;case"destroy":t&&(t.destroy(),t=null),e.postMessage({msg:"destroyed"});break;case"start":t.start();break;case"stop":t.stop();break;case"seek":t.seek(c.data.param);break;case"pause":t.pause();break;case"resume":t.resume();break;case"logging_config":var _=c.data.param;H.applyConfig(_),!0===_.enableCallback?H.addLogListener(n):H.removeLogListener(n)}}))},_e=function(){function e(t,i){if(a()(this,e),this.TAG="Transmuxer",this._emitter=new(d()),i.enableWorker&&"undefined"!=typeof Worker)try{var r=n(82059);this._worker=r(pe),this._workerDestroying=!1,this._worker.addEventListener("message",this._onWorkerMessage.bind(this)),this._worker.postMessage({cmd:"init",param:[t,i]}),this.e={onLoggingConfigChanged:this._onLoggingConfigChanged.bind(this)},H.registerListener(this.e.onLoggingConfigChanged),this._worker.postMessage({cmd:"logging_config",param:H.getConfig()})}catch(e){p.e(this.TAG,"Error while initialize transmuxing worker, fallback to inline transmuxing"),this._worker=null,this._controller=new fe(t,i)}else this._controller=new fe(t,i);if(this._controller){var s=this._controller;s.on(de.IO_ERROR,this._onIOError.bind(this)),s.on(de.DEMUX_ERROR,this._onDemuxError.bind(this)),s.on(de.INIT_SEGMENT,this._onInitSegment.bind(this)),s.on(de.MEDIA_SEGMENT,this._onMediaSegment.bind(this)),s.on(de.LOADING_COMPLETE,this._onLoadingComplete.bind(this)),s.on(de.RECOVERED_EARLY_EOF,this._onRecoveredEarlyEof.bind(this)),s.on(de.MEDIA_INFO,this._onMediaInfo.bind(this)),s.on(de.METADATA_ARRIVED,this._onMetaDataArrived.bind(this)),s.on(de.SCRIPTDATA_ARRIVED,this._onScriptDataArrived.bind(this)),s.on(de.STATISTICS_INFO,this._onStatisticsInfo.bind(this)),s.on(de.RECOMMEND_SEEKPOINT,this._onRecommendSeekpoint.bind(this))}}return l()(e,[{key:"destroy",value:function(){this._worker?this._workerDestroying||(this._workerDestroying=!0,this._worker.postMessage({cmd:"destroy"}),H.removeListener(this.e.onLoggingConfigChanged),this.e=null):(this._controller.destroy(),this._controller=null),this._emitter.removeAllListeners(),this._emitter=null}},{key:"on",value:function(e,t){this._emitter.addListener(e,t)}},{key:"off",value:function(e,t){this._emitter.removeListener(e,t)}},{key:"hasWorker",value:function(){return null!=this._worker}},{key:"open",value:function(){this._worker?this._worker.postMessage({cmd:"start"}):this._controller.start()}},{key:"close",value:function(){this._worker?this._worker.postMessage({cmd:"stop"}):this._controller.stop()}},{key:"seek",value:function(e){this._worker?this._worker.postMessage({cmd:"seek",param:e}):this._controller.seek(e)}},{key:"pause",value:function(){this._worker?this._worker.postMessage({cmd:"pause"}):this._controller.pause()}},{key:"resume",value:function(){this._worker?this._worker.postMessage({cmd:"resume"}):this._controller.resume()}},{key:"_onInitSegment",value:function(e,t){var n=this;Promise.resolve().then((function(){n._emitter.emit(de.INIT_SEGMENT,e,t)}))}},{key:"_onMediaSegment",value:function(e,t){var n=this;Promise.resolve().then((function(){n._emitter.emit(de.MEDIA_SEGMENT,e,t)}))}},{key:"_onLoadingComplete",value:function(){var e=this;Promise.resolve().then((function(){e._emitter.emit(de.LOADING_COMPLETE)}))}},{key:"_onRecoveredEarlyEof",value:function(){var e=this;Promise.resolve().then((function(){e._emitter.emit(de.RECOVERED_EARLY_EOF)}))}},{key:"_onMediaInfo",value:function(e){var t=this;Promise.resolve().then((function(){t._emitter.emit(de.MEDIA_INFO,e)}))}},{key:"_onMetaDataArrived",value:function(e){var t=this;Promise.resolve().then((function(){t._emitter.emit(de.METADATA_ARRIVED,e)}))}},{key:"_onScriptDataArrived",value:function(e){var t=this;Promise.resolve().then((function(){t._emitter.emit(de.SCRIPTDATA_ARRIVED,e)}))}},{key:"_onStatisticsInfo",value:function(e){var t=this;Promise.resolve().then((function(){t._emitter.emit(de.STATISTICS_INFO,e)}))}},{key:"_onIOError",value:function(e,t){var n=this;Promise.resolve().then((function(){n._emitter.emit(de.IO_ERROR,e,t)}))}},{key:"_onDemuxError",value:function(e,t){var n=this;Promise.resolve().then((function(){n._emitter.emit(de.DEMUX_ERROR,e,t)}))}},{key:"_onRecommendSeekpoint",value:function(e){var t=this;Promise.resolve().then((function(){t._emitter.emit(de.RECOMMEND_SEEKPOINT,e)}))}},{key:"_onLoggingConfigChanged",value:function(e){this._worker&&this._worker.postMessage({cmd:"logging_config",param:e})}},{key:"_onWorkerMessage",value:function(e){var t=e.data,n=t.data;if("destroyed"===t.msg||this._workerDestroying)return this._workerDestroying=!1,this._worker.terminate(),void(this._worker=null);switch(t.msg){case de.INIT_SEGMENT:case de.MEDIA_SEGMENT:this._emitter.emit(t.msg,n.type,n.data);break;case de.LOADING_COMPLETE:case de.RECOVERED_EARLY_EOF:this._emitter.emit(t.msg);break;case de.MEDIA_INFO:Object.setPrototypeOf(n,z.prototype),this._emitter.emit(t.msg,n);break;case de.METADATA_ARRIVED:case de.SCRIPTDATA_ARRIVED:case de.STATISTICS_INFO:this._emitter.emit(t.msg,n);break;case de.IO_ERROR:case de.DEMUX_ERROR:this._emitter.emit(t.msg,n.type,n.info);break;case de.RECOMMEND_SEEKPOINT:this._emitter.emit(t.msg,n);break;case"logcat_callback":p.emitter.emit("log",n.type,n.logcat)}}}]),e}(),ge={ERROR:"error",SOURCE_OPEN:"source_open",UPDATE_END:"update_end",BUFFER_FULL:"buffer_full"},me=function(){function e(t){a()(this,e),this.TAG="MSEController",this._config=t,this._emitter=new(d()),this._config.isLive&&null==this._config.autoCleanupSourceBuffer&&(this._config.autoCleanupSourceBuffer=!0),this.e={onSourceOpen:this._onSourceOpen.bind(this),onSourceEnded:this._onSourceEnded.bind(this),onSourceClose:this._onSourceClose.bind(this),onSourceBufferError:this._onSourceBufferError.bind(this),onSourceBufferUpdateEnd:this._onSourceBufferUpdateEnd.bind(this)},this._mediaSource=null,this._mediaSourceObjectURL=null,this._mediaElement=null,this._isBufferFull=!1,this._hasPendingEos=!1,this._requireSetMediaDuration=!1,this._pendingMediaDuration=0,this._pendingSourceBufferInit=[],this._mimeTypes={video:null,audio:null},this._sourceBuffers={video:null,audio:null},this._lastInitSegments={video:null,audio:null},this._pendingSegments={video:[],audio:[]},this._pendingRemoveRanges={video:[],audio:[]},this._idrList=new ue}return l()(e,[{key:"destroy",value:function(){(this._mediaElement||this._mediaSource)&&this.detachMediaElement(),this.e=null,this._emitter.removeAllListeners(),this._emitter=null}},{key:"on",value:function(e,t){this._emitter.addListener(e,t)}},{key:"off",value:function(e,t){this._emitter.removeListener(e,t)}},{key:"attachMediaElement",value:function(e){if(this._mediaSource)throw new E("MediaSource has been attached to an HTMLMediaElement!");var t=this._mediaSource=new window.MediaSource;t.addEventListener("sourceopen",this.e.onSourceOpen),t.addEventListener("sourceended",this.e.onSourceEnded),t.addEventListener("sourceclose",this.e.onSourceClose),this._mediaElement=e,this._mediaSourceObjectURL=window.URL.createObjectURL(this._mediaSource),e.src=this._mediaSourceObjectURL}},{key:"detachMediaElement",value:function(){if(this._mediaSource){var e=this._mediaSource;for(var t in this._sourceBuffers){var n=this._pendingSegments[t];n.splice(0,n.length),this._pendingSegments[t]=null,this._pendingRemoveRanges[t]=null,this._lastInitSegments[t]=null;var i=this._sourceBuffers[t];if(i){if("closed"!==e.readyState){try{e.removeSourceBuffer(i)}catch(e){p.e(this.TAG,e.message)}i.removeEventListener("error",this.e.onSourceBufferError),i.removeEventListener("updateend",this.e.onSourceBufferUpdateEnd)}this._mimeTypes[t]=null,this._sourceBuffers[t]=null}}if("open"===e.readyState)try{e.endOfStream()}catch(e){p.e(this.TAG,e.message)}e.removeEventListener("sourceopen",this.e.onSourceOpen),e.removeEventListener("sourceended",this.e.onSourceEnded),e.removeEventListener("sourceclose",this.e.onSourceClose),this._pendingSourceBufferInit=[],this._isBufferFull=!1,this._idrList.clear(),this._mediaSource=null}this._mediaElement&&(this._mediaElement.src="",this._mediaElement.removeAttribute("src"),this._mediaElement=null),this._mediaSourceObjectURL&&(window.URL.revokeObjectURL(this._mediaSourceObjectURL),this._mediaSourceObjectURL=null)}},{key:"appendInitSegment",value:function(e,t){if(!this._mediaSource||"open"!==this._mediaSource.readyState)return this._pendingSourceBufferInit.push(e),void this._pendingSegments[e.type].push(e);var n=e,i="".concat(n.container);n.codec&&n.codec.length>0&&(i+=";codecs=".concat(n.codec));var r=!1;if(p.v(this.TAG,"Received Initialization Segment, mimeType: "+i),this._lastInitSegments[n.type]=n,i!==this._mimeTypes[n.type]){if(this._mimeTypes[n.type])p.v(this.TAG,"Notice: ".concat(n.type," mimeType changed, origin: ").concat(this._mimeTypes[n.type],", target: ").concat(i));else{r=!0;try{var s=this._sourceBuffers[n.type]=this._mediaSource.addSourceBuffer(i);s.addEventListener("error",this.e.onSourceBufferError),s.addEventListener("updateend",this.e.onSourceBufferUpdateEnd)}catch(e){return p.e(this.TAG,e.message),void this._emitter.emit(ge.ERROR,{code:e.code,msg:e.message})}}this._mimeTypes[n.type]=i}t||this._pendingSegments[n.type].push(n),r||this._sourceBuffers[n.type]&&!this._sourceBuffers[n.type].updating&&this._doAppendSegments(),D.safari&&"audio/mpeg"===n.container&&n.mediaDuration>0&&(this._requireSetMediaDuration=!0,this._pendingMediaDuration=n.mediaDuration/1e3,this._updateMediaSourceDuration())}},{key:"appendMediaSegment",value:function(e){var t=e;this._pendingSegments[t.type].push(t),this._config.autoCleanupSourceBuffer&&this._needCleanupSourceBuffer()&&this._doCleanupSourceBuffer();var n=this._sourceBuffers[t.type];!n||n.updating||this._hasPendingRemoveRanges()||this._doAppendSegments()}},{key:"seek",value:function(e){for(var t in this._sourceBuffers)if(this._sourceBuffers[t]){var n=this._sourceBuffers[t];if("open"===this._mediaSource.readyState)try{n.abort()}catch(e){p.e(this.TAG,e.message)}this._idrList.clear();var i=this._pendingSegments[t];if(i.splice(0,i.length),"closed"!==this._mediaSource.readyState){for(var r=0;r<n.buffered.length;r++){var s=n.buffered.start(r),a=n.buffered.end(r);this._pendingRemoveRanges[t].push({start:s,end:a})}if(n.updating||this._doRemoveRanges(),D.safari){var o=this._lastInitSegments[t];o&&(this._pendingSegments[t].push(o),n.updating||this._doAppendSegments())}}}}},{key:"endOfStream",value:function(){var e=this._mediaSource,t=this._sourceBuffers;e&&"open"===e.readyState?t.video&&t.video.updating||t.audio&&t.audio.updating?this._hasPendingEos=!0:(this._hasPendingEos=!1,e.endOfStream()):e&&"closed"===e.readyState&&this._hasPendingSegments()&&(this._hasPendingEos=!0)}},{key:"getNearestKeyframe",value:function(e){return this._idrList.getLastSyncPointBeforeDts(e)}},{key:"_needCleanupSourceBuffer",value:function(){if(!this._config.autoCleanupSourceBuffer)return!1;var e=this._mediaElement.currentTime;for(var t in this._sourceBuffers){var n=this._sourceBuffers[t];if(n){var i=n.buffered;if(i.length>=1&&e-i.start(0)>=this._config.autoCleanupMaxBackwardDuration)return!0}}return!1}},{key:"_doCleanupSourceBuffer",value:function(){var e=this._mediaElement.currentTime;for(var t in this._sourceBuffers){var n=this._sourceBuffers[t];if(n){for(var i=n.buffered,r=!1,s=0;s<i.length;s++){var a=i.start(s),o=i.end(s);if(a<=e&&e<o+3){if(e-a>=this._config.autoCleanupMaxBackwardDuration){r=!0;var l=e-this._config.autoCleanupMinBackwardDuration;this._pendingRemoveRanges[t].push({start:a,end:l})}}else o<e&&(r=!0,this._pendingRemoveRanges[t].push({start:a,end:o}))}r&&!n.updating&&this._doRemoveRanges()}}}},{key:"_updateMediaSourceDuration",value:function(){var e=this._sourceBuffers;if(0!==this._mediaElement.readyState&&"open"===this._mediaSource.readyState&&!(e.video&&e.video.updating||e.audio&&e.audio.updating)){var t=this._mediaSource.duration,n=this._pendingMediaDuration;n>0&&(isNaN(t)||n>t)&&(p.v(this.TAG,"Update MediaSource duration from ".concat(t," to ").concat(n)),this._mediaSource.duration=n),this._requireSetMediaDuration=!1,this._pendingMediaDuration=0}}},{key:"_doRemoveRanges",value:function(){for(var e in this._pendingRemoveRanges)if(this._sourceBuffers[e]&&!this._sourceBuffers[e].updating)for(var t=this._sourceBuffers[e],n=this._pendingRemoveRanges[e];n.length&&!t.updating;){var i=n.shift();t.remove(i.start,i.end)}}},{key:"_doAppendSegments",value:function(){var e=this._pendingSegments;for(var t in e)if(this._sourceBuffers[t]&&!this._sourceBuffers[t].updating&&e[t].length>0){var n=e[t].shift();if(n.timestampOffset){var i=this._sourceBuffers[t].timestampOffset,r=n.timestampOffset/1e3;Math.abs(i-r)>.1&&(p.v(this.TAG,"Update MPEG audio timestampOffset from ".concat(i," to ").concat(r)),this._sourceBuffers[t].timestampOffset=r),delete n.timestampOffset}if(!n.data||0===n.data.byteLength)continue;try{this._sourceBuffers[t].appendBuffer(n.data),this._isBufferFull=!1,"video"===t&&n.hasOwnProperty("info")&&this._idrList.appendArray(n.info.syncPoints)}catch(e){this._pendingSegments[t].unshift(n),22===e.code?(this._isBufferFull||this._emitter.emit(ge.BUFFER_FULL),this._isBufferFull=!0):(p.e(this.TAG,e.message),this._emitter.emit(ge.ERROR,{code:e.code,msg:e.message}))}}}},{key:"_onSourceOpen",value:function(){if(p.v(this.TAG,"MediaSource onSourceOpen"),this._mediaSource.removeEventListener("sourceopen",this.e.onSourceOpen),this._pendingSourceBufferInit.length>0)for(var e=this._pendingSourceBufferInit;e.length;){var t=e.shift();this.appendInitSegment(t,!0)}this._hasPendingSegments()&&this._doAppendSegments(),this._emitter.emit(ge.SOURCE_OPEN)}},{key:"_onSourceEnded",value:function(){p.v(this.TAG,"MediaSource onSourceEnded")}},{key:"_onSourceClose",value:function(){p.v(this.TAG,"MediaSource onSourceClose"),this._mediaSource&&null!=this.e&&(this._mediaSource.removeEventListener("sourceopen",this.e.onSourceOpen),this._mediaSource.removeEventListener("sourceended",this.e.onSourceEnded),this._mediaSource.removeEventListener("sourceclose",this.e.onSourceClose))}},{key:"_hasPendingSegments",value:function(){var e=this._pendingSegments;return e.video.length>0||e.audio.length>0}},{key:"_hasPendingRemoveRanges",value:function(){var e=this._pendingRemoveRanges;return e.video.length>0||e.audio.length>0}},{key:"_onSourceBufferUpdateEnd",value:function(){this._requireSetMediaDuration?this._updateMediaSourceDuration():this._hasPendingRemoveRanges()?this._doRemoveRanges():this._hasPendingSegments()?this._doAppendSegments():this._hasPendingEos&&this.endOfStream(),this._emitter.emit(ge.UPDATE_END)}},{key:"_onSourceBufferError",value:function(e){p.e(this.TAG,"SourceBuffer Error: ".concat(e))}}]),e}(),ve={NETWORK_ERROR:"NetworkError",MEDIA_ERROR:"MediaError",OTHER_ERROR:"OtherError"},ye={NETWORK_EXCEPTION:T.EXCEPTION,NETWORK_STATUS_CODE_INVALID:T.HTTP_STATUS_CODE_INVALID,NETWORK_TIMEOUT:T.CONNECTING_TIMEOUT,NETWORK_UNRECOVERABLE_EARLY_EOF:T.UNRECOVERABLE_EARLY_EOF,MEDIA_MSE_ERROR:"MediaMSEError",MEDIA_FORMAT_ERROR:te.FORMAT_ERROR,MEDIA_FORMAT_UNSUPPORTED:te.FORMAT_UNSUPPORTED,MEDIA_CODEC_UNSUPPORTED:te.CODEC_UNSUPPORTED},be=function(){function e(t,n){if(a()(this,e),this.TAG="FlvPlayer",this._type="FlvPlayer",this._emitter=new(d()),this._config=$(),"object"===r()(n)&&Object.assign(this._config,n),"flv"!==t.type.toLowerCase())throw new w("FlvPlayer requires an flv MediaDataSource input!");!0===t.isLive&&(this._config.isLive=!0),this.e={onvLoadedMetadata:this._onvLoadedMetadata.bind(this),onvSeeking:this._onvSeeking.bind(this),onvCanPlay:this._onvCanPlay.bind(this),onvStalled:this._onvStalled.bind(this),onvProgress:this._onvProgress.bind(this)},self.performance&&self.performance.now?this._now=self.performance.now.bind(self.performance):this._now=Date.now,this._pendingSeekTime=null,this._requestSetTime=!1,this._seekpointRecord=null,this._progressChecker=null,this._mediaDataSource=t,this._mediaElement=null,this._msectl=null,this._transmuxer=null,this._mseSourceOpened=!1,this._hasPendingLoad=!1,this._receivedCanPlay=!1,this._mediaInfo=null,this._statisticsInfo=null;var i=D.chrome&&(D.version.major<50||50===D.version.major&&D.version.build<2661);this._alwaysSeekKeyframe=!!(i||D.msedge||D.msie),this._alwaysSeekKeyframe&&(this._config.accurateSeek=!1)}return l()(e,[{key:"destroy",value:function(){null!=this._progressChecker&&(window.clearInterval(this._progressChecker),this._progressChecker=null),this._transmuxer&&this.unload(),this._mediaElement&&this.detachMediaElement(),this.e=null,this._mediaDataSource=null,this._emitter.removeAllListeners(),this._emitter=null}},{key:"on",value:function(e,t){var n=this;e===V.MEDIA_INFO?null!=this._mediaInfo&&Promise.resolve().then((function(){n._emitter.emit(V.MEDIA_INFO,n.mediaInfo)})):e===V.STATISTICS_INFO&&null!=this._statisticsInfo&&Promise.resolve().then((function(){n._emitter.emit(V.STATISTICS_INFO,n.statisticsInfo)})),this._emitter.addListener(e,t)}},{key:"off",value:function(e,t){this._emitter.removeListener(e,t)}},{key:"attachMediaElement",value:function(e){var t=this;if(this._mediaElement=e,e.addEventListener("loadedmetadata",this.e.onvLoadedMetadata),e.addEventListener("seeking",this.e.onvSeeking),e.addEventListener("canplay",this.e.onvCanPlay),e.addEventListener("stalled",this.e.onvStalled),e.addEventListener("progress",this.e.onvProgress),this._msectl=new me(this._config),this._msectl.on(ge.UPDATE_END,this._onmseUpdateEnd.bind(this)),this._msectl.on(ge.BUFFER_FULL,this._onmseBufferFull.bind(this)),this._msectl.on(ge.SOURCE_OPEN,(function(){t._mseSourceOpened=!0,t._hasPendingLoad&&(t._hasPendingLoad=!1,t.load())})),this._msectl.on(ge.ERROR,(function(e){t._emitter.emit(V.ERROR,ve.MEDIA_ERROR,ye.MEDIA_MSE_ERROR,e)})),this._msectl.attachMediaElement(e),null!=this._pendingSeekTime)try{e.currentTime=this._pendingSeekTime,this._pendingSeekTime=null}catch(e){}}},{key:"detachMediaElement",value:function(){this._mediaElement&&(this._msectl.detachMediaElement(),this._mediaElement.removeEventListener("loadedmetadata",this.e.onvLoadedMetadata),this._mediaElement.removeEventListener("seeking",this.e.onvSeeking),this._mediaElement.removeEventListener("canplay",this.e.onvCanPlay),this._mediaElement.removeEventListener("stalled",this.e.onvStalled),this._mediaElement.removeEventListener("progress",this.e.onvProgress),this._mediaElement=null),this._msectl&&(this._msectl.destroy(),this._msectl=null)}},{key:"load",value:function(){var e=this;if(!this._mediaElement)throw new E("HTMLMediaElement must be attached before load()!");if(this._transmuxer)throw new E("FlvPlayer.load() has been called, please call unload() first!");this._hasPendingLoad||(this._config.deferLoadAfterSourceOpen&&!1===this._mseSourceOpened?this._hasPendingLoad=!0:(this._mediaElement.readyState>0&&(this._requestSetTime=!0,this._mediaElement.currentTime=0),this._transmuxer=new _e(this._mediaDataSource,this._config),this._transmuxer.on(de.INIT_SEGMENT,(function(t,n){e._msectl.appendInitSegment(n)})),this._transmuxer.on(de.MEDIA_SEGMENT,(function(t,n){if(e._msectl.appendMediaSegment(n),e._config.lazyLoad&&!e._config.isLive){var i=e._mediaElement.currentTime;n.info.endDts>=1e3*(i+e._config.lazyLoadMaxDuration)&&null==e._progressChecker&&(p.v(e.TAG,"Maximum buffering duration exceeded, suspend transmuxing task"),e._suspendTransmuxer())}})),this._transmuxer.on(de.LOADING_COMPLETE,(function(){e._msectl.endOfStream(),e._emitter.emit(V.LOADING_COMPLETE)})),this._transmuxer.on(de.RECOVERED_EARLY_EOF,(function(){e._emitter.emit(V.RECOVERED_EARLY_EOF)})),this._transmuxer.on(de.IO_ERROR,(function(t,n){e._emitter.emit(V.ERROR,ve.NETWORK_ERROR,t,n)})),this._transmuxer.on(de.DEMUX_ERROR,(function(t,n){e._emitter.emit(V.ERROR,ve.MEDIA_ERROR,t,{code:-1,msg:n})})),this._transmuxer.on(de.MEDIA_INFO,(function(t){e._mediaInfo=t,e._emitter.emit(V.MEDIA_INFO,Object.assign({},t))})),this._transmuxer.on(de.METADATA_ARRIVED,(function(t){e._emitter.emit(V.METADATA_ARRIVED,t)})),this._transmuxer.on(de.SCRIPTDATA_ARRIVED,(function(t){e._emitter.emit(V.SCRIPTDATA_ARRIVED,t)})),this._transmuxer.on(de.STATISTICS_INFO,(function(t){e._statisticsInfo=e._fillStatisticsInfo(t),e._emitter.emit(V.STATISTICS_INFO,Object.assign({},e._statisticsInfo))})),this._transmuxer.on(de.RECOMMEND_SEEKPOINT,(function(t){e._mediaElement&&!e._config.accurateSeek&&(e._requestSetTime=!0,e._mediaElement.currentTime=t/1e3)})),this._transmuxer.open()))}},{key:"unload",value:function(){this._mediaElement&&this._mediaElement.pause(),this._msectl&&this._msectl.seek(0),this._transmuxer&&(this._transmuxer.close(),this._transmuxer.destroy(),this._transmuxer=null)}},{key:"play",value:function(){return this._mediaElement.play()}},{key:"pause",value:function(){this._mediaElement.pause()}},{key:"type",get:function(){return this._type}},{key:"buffered",get:function(){return this._mediaElement.buffered}},{key:"duration",get:function(){return this._mediaElement.duration}},{key:"volume",get:function(){return this._mediaElement.volume},set:function(e){this._mediaElement.volume=e}},{key:"muted",get:function(){return this._mediaElement.muted},set:function(e){this._mediaElement.muted=e}},{key:"currentTime",get:function(){return this._mediaElement?this._mediaElement.currentTime:0},set:function(e){this._mediaElement?this._internalSeek(e):this._pendingSeekTime=e}},{key:"mediaInfo",get:function(){return Object.assign({},this._mediaInfo)}},{key:"statisticsInfo",get:function(){return null==this._statisticsInfo&&(this._statisticsInfo={}),this._statisticsInfo=this._fillStatisticsInfo(this._statisticsInfo),Object.assign({},this._statisticsInfo)}},{key:"_fillStatisticsInfo",value:function(e){if(e.playerType=this._type,!(this._mediaElement instanceof HTMLVideoElement))return e;var t=!0,n=0,i=0;if(this._mediaElement.getVideoPlaybackQuality){var r=this._mediaElement.getVideoPlaybackQuality();n=r.totalVideoFrames,i=r.droppedVideoFrames}else null!=this._mediaElement.webkitDecodedFrameCount?(n=this._mediaElement.webkitDecodedFrameCount,i=this._mediaElement.webkitDroppedFrameCount):t=!1;return t&&(e.decodedFrames=n,e.droppedFrames=i),e}},{key:"_onmseUpdateEnd",value:function(){if(this._config.lazyLoad&&!this._config.isLive){for(var e=this._mediaElement.buffered,t=this._mediaElement.currentTime,n=0,i=0;i<e.length;i++){var r=e.start(i),s=e.end(i);if(r<=t&&t<s){r,n=s;break}}n>=t+this._config.lazyLoadMaxDuration&&null==this._progressChecker&&(p.v(this.TAG,"Maximum buffering duration exceeded, suspend transmuxing task"),this._suspendTransmuxer())}}},{key:"_onmseBufferFull",value:function(){p.v(this.TAG,"MSE SourceBuffer is full, suspend transmuxing task"),null==this._progressChecker&&this._suspendTransmuxer()}},{key:"_suspendTransmuxer",value:function(){this._transmuxer&&(this._transmuxer.pause(),null==this._progressChecker&&(this._progressChecker=window.setInterval(this._checkProgressAndResume.bind(this),1e3)))}},{key:"_checkProgressAndResume",value:function(){for(var e=this._mediaElement.currentTime,t=this._mediaElement.buffered,n=!1,i=0;i<t.length;i++){var r=t.start(i),s=t.end(i);if(e>=r&&e<s){e>=s-this._config.lazyLoadRecoverDuration&&(n=!0);break}}n&&(window.clearInterval(this._progressChecker),this._progressChecker=null,n&&(p.v(this.TAG,"Continue loading from paused position"),this._transmuxer.resume()))}},{key:"_isTimepointBuffered",value:function(e){for(var t=this._mediaElement.buffered,n=0;n<t.length;n++){var i=t.start(n),r=t.end(n);if(e>=i&&e<r)return!0}return!1}},{key:"_internalSeek",value:function(e){var t=this._isTimepointBuffered(e),n=!1,i=0;if(e<1&&this._mediaElement.buffered.length>0){var r=this._mediaElement.buffered.start(0);(r<1&&e<r||D.safari)&&(n=!0,i=D.safari?.1:r)}if(n)this._requestSetTime=!0,this._mediaElement.currentTime=i;else if(t){if(this._alwaysSeekKeyframe){var s=this._msectl.getNearestKeyframe(Math.floor(1e3*e));this._requestSetTime=!0,this._mediaElement.currentTime=null!=s?s.dts/1e3:e}else this._requestSetTime=!0,this._mediaElement.currentTime=e;null!=this._progressChecker&&this._checkProgressAndResume()}else null!=this._progressChecker&&(window.clearInterval(this._progressChecker),this._progressChecker=null),this._msectl.seek(e),this._transmuxer.seek(Math.floor(1e3*e)),this._config.accurateSeek&&(this._requestSetTime=!0,this._mediaElement.currentTime=e)}},{key:"_checkAndApplyUnbufferedSeekpoint",value:function(){if(this._seekpointRecord)if(this._seekpointRecord.recordTime<=this._now()-100){var e=this._mediaElement.currentTime;this._seekpointRecord=null,this._isTimepointBuffered(e)||(null!=this._progressChecker&&(window.clearTimeout(this._progressChecker),this._progressChecker=null),this._msectl.seek(e),this._transmuxer.seek(Math.floor(1e3*e)),this._config.accurateSeek&&(this._requestSetTime=!0,this._mediaElement.currentTime=e))}else window.setTimeout(this._checkAndApplyUnbufferedSeekpoint.bind(this),50)}},{key:"_checkAndResumeStuckPlayback",value:function(e){var t=this._mediaElement;if(e||!this._receivedCanPlay||t.readyState<2){var n=t.buffered;n.length>0&&t.currentTime<n.start(0)&&(p.w(this.TAG,"Playback seems stuck at ".concat(t.currentTime,", seek to ").concat(n.start(0))),this._requestSetTime=!0,this._mediaElement.currentTime=n.start(0),this._mediaElement.removeEventListener("progress",this.e.onvProgress))}else this._mediaElement.removeEventListener("progress",this.e.onvProgress)}},{key:"_onvLoadedMetadata",value:function(e){null!=this._pendingSeekTime&&(this._mediaElement.currentTime=this._pendingSeekTime,this._pendingSeekTime=null)}},{key:"_onvSeeking",value:function(e){var t=this._mediaElement.currentTime,n=this._mediaElement.buffered;if(this._requestSetTime)this._requestSetTime=!1;else{if(t<1&&n.length>0){var i=n.start(0);if(i<1&&t<i||D.safari)return this._requestSetTime=!0,void(this._mediaElement.currentTime=D.safari?.1:i)}if(this._isTimepointBuffered(t)){if(this._alwaysSeekKeyframe){var r=this._msectl.getNearestKeyframe(Math.floor(1e3*t));null!=r&&(this._requestSetTime=!0,this._mediaElement.currentTime=r.dts/1e3)}null!=this._progressChecker&&this._checkProgressAndResume()}else this._seekpointRecord={seekPoint:t,recordTime:this._now()},window.setTimeout(this._checkAndApplyUnbufferedSeekpoint.bind(this),50)}}},{key:"_onvCanPlay",value:function(e){this._receivedCanPlay=!0,this._mediaElement.removeEventListener("canplay",this.e.onvCanPlay)}},{key:"_onvStalled",value:function(e){this._checkAndResumeStuckPlayback(!0)}},{key:"_onvProgress",value:function(e){this._checkAndResumeStuckPlayback()}}]),e}(),Ee=function(){function e(t,n){if(a()(this,e),this.TAG="NativePlayer",this._type="NativePlayer",this._emitter=new(d()),this._config=$(),"object"===r()(n)&&Object.assign(this._config,n),"flv"===t.type.toLowerCase())throw new w("NativePlayer does't support flv MediaDataSource input!");if(t.hasOwnProperty("segments"))throw new w("NativePlayer(".concat(t.type,") doesn't support multipart playback!"));this.e={onvLoadedMetadata:this._onvLoadedMetadata.bind(this)},this._pendingSeekTime=null,this._statisticsReporter=null,this._mediaDataSource=t,this._mediaElement=null}return l()(e,[{key:"destroy",value:function(){this._mediaElement&&(this.unload(),this.detachMediaElement()),this.e=null,this._mediaDataSource=null,this._emitter.removeAllListeners(),this._emitter=null}},{key:"on",value:function(e,t){var n=this;e===V.MEDIA_INFO?null!=this._mediaElement&&0!==this._mediaElement.readyState&&Promise.resolve().then((function(){n._emitter.emit(V.MEDIA_INFO,n.mediaInfo)})):e===V.STATISTICS_INFO&&null!=this._mediaElement&&0!==this._mediaElement.readyState&&Promise.resolve().then((function(){n._emitter.emit(V.STATISTICS_INFO,n.statisticsInfo)})),this._emitter.addListener(e,t)}},{key:"off",value:function(e,t){this._emitter.removeListener(e,t)}},{key:"attachMediaElement",value:function(e){if(this._mediaElement=e,e.addEventListener("loadedmetadata",this.e.onvLoadedMetadata),null!=this._pendingSeekTime)try{e.currentTime=this._pendingSeekTime,this._pendingSeekTime=null}catch(e){}}},{key:"detachMediaElement",value:function(){this._mediaElement&&(this._mediaElement.src="",this._mediaElement.removeAttribute("src"),this._mediaElement.removeEventListener("loadedmetadata",this.e.onvLoadedMetadata),this._mediaElement=null),null!=this._statisticsReporter&&(window.clearInterval(this._statisticsReporter),this._statisticsReporter=null)}},{key:"load",value:function(){if(!this._mediaElement)throw new E("HTMLMediaElement must be attached before load()!");this._mediaElement.src=this._mediaDataSource.url,this._mediaElement.readyState>0&&(this._mediaElement.currentTime=0),this._mediaElement.preload="auto",this._mediaElement.load(),this._statisticsReporter=window.setInterval(this._reportStatisticsInfo.bind(this),this._config.statisticsInfoReportInterval)}},{key:"unload",value:function(){this._mediaElement&&(this._mediaElement.src="",this._mediaElement.removeAttribute("src")),null!=this._statisticsReporter&&(window.clearInterval(this._statisticsReporter),this._statisticsReporter=null)}},{key:"play",value:function(){return this._mediaElement.play()}},{key:"pause",value:function(){this._mediaElement.pause()}},{key:"type",get:function(){return this._type}},{key:"buffered",get:function(){return this._mediaElement.buffered}},{key:"duration",get:function(){return this._mediaElement.duration}},{key:"volume",get:function(){return this._mediaElement.volume},set:function(e){this._mediaElement.volume=e}},{key:"muted",get:function(){return this._mediaElement.muted},set:function(e){this._mediaElement.muted=e}},{key:"currentTime",get:function(){return this._mediaElement?this._mediaElement.currentTime:0},set:function(e){this._mediaElement?this._mediaElement.currentTime=e:this._pendingSeekTime=e}},{key:"mediaInfo",get:function(){var e={mimeType:(this._mediaElement instanceof HTMLAudioElement?"audio/":"video/")+this._mediaDataSource.type};return this._mediaElement&&(e.duration=Math.floor(1e3*this._mediaElement.duration),this._mediaElement instanceof HTMLVideoElement&&(e.width=this._mediaElement.videoWidth,e.height=this._mediaElement.videoHeight)),e}},{key:"statisticsInfo",get:function(){var e={playerType:this._type,url:this._mediaDataSource.url};if(!(this._mediaElement instanceof HTMLVideoElement))return e;var t=!0,n=0,i=0;if(this._mediaElement.getVideoPlaybackQuality){var r=this._mediaElement.getVideoPlaybackQuality();n=r.totalVideoFrames,i=r.droppedVideoFrames}else null!=this._mediaElement.webkitDecodedFrameCount?(n=this._mediaElement.webkitDecodedFrameCount,i=this._mediaElement.webkitDroppedFrameCount):t=!1;return t&&(e.decodedFrames=n,e.droppedFrames=i),e}},{key:"_onvLoadedMetadata",value:function(e){null!=this._pendingSeekTime&&(this._mediaElement.currentTime=this._pendingSeekTime,this._pendingSeekTime=null),this._emitter.emit(V.MEDIA_INFO,this.mediaInfo)}},{key:"_reportStatisticsInfo",value:function(){this._emitter.emit(V.STATISTICS_INFO,this.statisticsInfo)}}]),e}();c.install();var we={createPlayer:function(e,t){var n=e;if(null==n||"object"!==r()(n))throw new w("MediaDataSource must be an javascript object!");if(!n.hasOwnProperty("type"))throw new w("MediaDataSource must has type field to indicate video file type!");return"flv"===n.type?new be(n,t):new Ee(n,t)},isSupported:function(){return j.supportMSEH264Playback()},getFeatureList:function(){return j.getFeatureList()}};we.BaseLoader=A,we.LoaderStatus=S,we.LoaderErrors=T,we.Events=V,we.ErrorTypes=ve,we.ErrorDetails=ye,we.FlvPlayer=be,we.NativePlayer=Ee,we.LoggingControl=H,Object.defineProperty(we,"version",{enumerable:!0,get:function(){return"__VERSION__"}});var ke=we},25769:function(e,t,n){"use strict";var i=n(98040),r={"text/plain":"Text","text/html":"Url",default:"Text"};e.exports=function(e,t){var n,s,a,o,l,u,c=!1;t||(t={}),n=t.debug||!1;try{if(a=i(),o=document.createRange(),l=document.getSelection(),(u=document.createElement("span")).textContent=e,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(),t.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[t.format]||r.default;window.clipboardData.setData(s,e)}else i.clipboardData.clearData(),i.clipboardData.setData(t.format,e);t.onCopy&&(i.preventDefault(),t.onCopy(i.clipboardData))})),document.body.appendChild(u),o.selectNodeContents(u),l.addRange(o),!document.execCommand("copy"))throw new Error("copy command was unsuccessful");c=!0}catch(i){n&&console.error("unable to copy using execCommand: ",i),n&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),c=!0}catch(i){n&&console.error("unable to copy using clipboardData: ",i),n&&console.error("falling back to prompt"),s=function(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}("message"in t?t.message:"Copy to clipboard: #{key}, Enter"),window.prompt(s,e)}}finally{l&&("function"==typeof l.removeRange?l.removeRange(o):l.removeAllRanges()),u&&document.body.removeChild(u),a()}return c}},3867:function(e,t,n){var i=n(97671);e.exports=function(){"use strict";function e(e){var t=typeof e;return null!==e&&("object"===t||"function"===t)}function t(e){return"function"==typeof e}var r=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},s=0,a=void 0,o=void 0,l=function(e,t){E[s]=e,E[s+1]=t,2===(s+=2)&&(o?o(w):S())};function u(e){o=e}function c(e){l=e}var h="undefined"!=typeof window?window:void 0,d=h||{},f=d.MutationObserver||d.WebKitMutationObserver,p="undefined"==typeof self&&void 0!==i&&"[object process]"==={}.toString.call(i),_="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function g(){return function(){return i.nextTick(w)}}function m(){return void 0!==a?function(){a(w)}:b()}function v(){var e=0,t=new f(w),n=document.createTextNode("");return t.observe(n,{characterData:!0}),function(){n.data=e=++e%2}}function y(){var e=new MessageChannel;return e.port1.onmessage=w,function(){return e.port2.postMessage(0)}}function b(){var e=setTimeout;return function(){return e(w,1)}}var E=new Array(1e3);function w(){for(var e=0;e<s;e+=2)(0,E[e])(E[e+1]),E[e]=void 0,E[e+1]=void 0;s=0}function k(){try{var e=Function("return this")().require("vertx");return a=e.runOnLoop||e.runOnContext,m()}catch(e){return b()}}var S=void 0;function T(e,t){var n=this,i=new this.constructor(R);void 0===i[C]&&W(i);var r=n._state;if(r){var s=arguments[r-1];l((function(){return V(r,i,s,n._result)}))}else G(n,i,e,t);return i}function A(e){var t=this;if(e&&"object"==typeof e&&e.constructor===t)return e;var n=new t(R);return B(n,e),n}S=p?g():f?v():_?y():void 0===h?k():b();var C=Math.random().toString(36).substring(2);function R(){}var L=void 0,x=1,I=2;function D(){return new TypeError("You cannot resolve a promise with itself")}function P(){return new TypeError("A promises callback cannot return that same promise.")}function O(e,t,n,i){try{e.call(t,n,i)}catch(e){return e}}function M(e,t,n){l((function(e){var i=!1,r=O(n,t,(function(n){i||(i=!0,t!==n?B(e,n):K(e,n))}),(function(t){i||(i=!0,$(e,t))}),"Settle: "+(e._label||" unknown promise"));!i&&r&&(i=!0,$(e,r))}),e)}function N(e,t){t._state===x?K(e,t._result):t._state===I?$(e,t._result):G(t,void 0,(function(t){return B(e,t)}),(function(t){return $(e,t)}))}function F(e,n,i){n.constructor===e.constructor&&i===T&&n.constructor.resolve===A?N(e,n):void 0===i?K(e,n):t(i)?M(e,n,i):K(e,n)}function B(t,n){if(t===n)$(t,D());else if(e(n)){var i=void 0;try{i=n.then}catch(e){return void $(t,e)}F(t,n,i)}else K(t,n)}function U(e){e._onerror&&e._onerror(e._result),j(e)}function K(e,t){e._state===L&&(e._result=t,e._state=x,0!==e._subscribers.length&&l(j,e))}function $(e,t){e._state===L&&(e._state=I,e._result=t,l(U,e))}function G(e,t,n,i){var r=e._subscribers,s=r.length;e._onerror=null,r[s]=t,r[s+x]=n,r[s+I]=i,0===s&&e._state&&l(j,e)}function j(e){var t=e._subscribers,n=e._state;if(0!==t.length){for(var i=void 0,r=void 0,s=e._result,a=0;a<t.length;a+=3)i=t[a],r=t[a+n],i?V(n,i,r,s):r(s);e._subscribers.length=0}}function V(e,n,i,r){var s=t(i),a=void 0,o=void 0,l=!0;if(s){try{a=i(r)}catch(e){l=!1,o=e}if(n===a)return void $(n,P())}else a=r;n._state!==L||(s&&l?B(n,a):!1===l?$(n,o):e===x?K(n,a):e===I&&$(n,a))}function Z(e,t){try{t((function(t){B(e,t)}),(function(t){$(e,t)}))}catch(t){$(e,t)}}var H=0;function z(){return H++}function W(e){e[C]=H++,e._state=void 0,e._result=void 0,e._subscribers=[]}function q(){return new Error("Array Methods must be provided an Array")}var Y=function(){function e(e,t){this._instanceConstructor=e,this.promise=new e(R),this.promise[C]||W(this.promise),r(t)?(this.length=t.length,this._remaining=t.length,this._result=new Array(this.length),0===this.length?K(this.promise,this._result):(this.length=this.length||0,this._enumerate(t),0===this._remaining&&K(this.promise,this._result))):$(this.promise,q())}return e.prototype._enumerate=function(e){for(var t=0;this._state===L&&t<e.length;t++)this._eachEntry(e[t],t)},e.prototype._eachEntry=function(e,t){var n=this._instanceConstructor,i=n.resolve;if(i===A){var r=void 0,s=void 0,a=!1;try{r=e.then}catch(e){a=!0,s=e}if(r===T&&e._state!==L)this._settledAt(e._state,t,e._result);else if("function"!=typeof r)this._remaining--,this._result[t]=e;else if(n===ne){var o=new n(R);a?$(o,s):F(o,e,r),this._willSettleAt(o,t)}else this._willSettleAt(new n((function(t){return t(e)})),t)}else this._willSettleAt(i(e),t)},e.prototype._settledAt=function(e,t,n){var i=this.promise;i._state===L&&(this._remaining--,e===I?$(i,n):this._result[t]=n),0===this._remaining&&K(i,this._result)},e.prototype._willSettleAt=function(e,t){var n=this;G(e,void 0,(function(e){return n._settledAt(x,t,e)}),(function(e){return n._settledAt(I,t,e)}))},e}();function X(e){return new Y(this,e).promise}function Q(e){var t=this;return r(e)?new t((function(n,i){for(var r=e.length,s=0;s<r;s++)t.resolve(e[s]).then(n,i)})):new t((function(e,t){return t(new TypeError("You must pass an array to race."))}))}function J(e){var t=new this(R);return $(t,e),t}function ee(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function te(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}var ne=function(){function e(t){this[C]=z(),this._result=this._state=void 0,this._subscribers=[],R!==t&&("function"!=typeof t&&ee(),this instanceof e?Z(this,t):te())}return e.prototype.catch=function(e){return this.then(null,e)},e.prototype.finally=function(e){var n=this,i=n.constructor;return t(e)?n.then((function(t){return i.resolve(e()).then((function(){return t}))}),(function(t){return i.resolve(e()).then((function(){throw t}))})):n.then(e,e)},e}();function ie(){var e=void 0;if(void 0!==n.g)e=n.g;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var t=e.Promise;if(t){var i=null;try{i=Object.prototype.toString.call(t.resolve())}catch(e){}if("[object Promise]"===i&&!t.cast)return}e.Promise=ne}return ne.prototype.then=T,ne.all=X,ne.race=Q,ne.resolve=A,ne.reject=J,ne._setScheduler=u,ne._setAsap=c,ne._asap=l,ne.polyfill=ie,ne.Promise=ne,ne}()},86204:function(e){"use strict";var t,n="object"==typeof Reflect?Reflect:null,i=n&&"function"==typeof n.apply?n.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};t=n&&"function"==typeof n.ownKeys?n.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var r=Number.isNaN||function(e){return e!=e};function s(){s.init.call(this)}e.exports=s,e.exports.once=function(e,t){return new Promise((function(n,i){function r(n){e.removeListener(t,s),i(n)}function s(){"function"==typeof e.removeListener&&e.removeListener("error",r),n([].slice.call(arguments))}_(e,t,s,{once:!0}),"error"!==t&&function(e,t,n){"function"==typeof e.on&&_(e,"error",t,n)}(e,r,{once:!0})}))},s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var a=10;function o(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function l(e){return void 0===e._maxListeners?s.defaultMaxListeners:e._maxListeners}function u(e,t,n,i){var r,s,a;if(o(n),void 0===(s=e._events)?(s=e._events=Object.create(null),e._eventsCount=0):(void 0!==s.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),s=e._events),a=s[t]),void 0===a)a=s[t]=n,++e._eventsCount;else if("function"==typeof a?a=s[t]=i?[n,a]:[a,n]:i?a.unshift(n):a.push(n),(r=l(e))>0&&a.length>r&&!a.warned){a.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=a.length,function(e){console&&console.warn&&console.warn(e)}(u)}return e}function c(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function h(e,t,n){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},r=c.bind(i);return r.listener=n,i.wrapFn=r,r}function d(e,t,n){var i=e._events;if(void 0===i)return[];var r=i[t];return void 0===r?[]:"function"==typeof r?n?[r.listener||r]:[r]:n?function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(r):p(r,r.length)}function f(e){var t=this._events;if(void 0!==t){var n=t[e];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function p(e,t){for(var n=new Array(t),i=0;i<t;++i)n[i]=e[i];return n}function _(e,t,n,i){if("function"==typeof e.on)i.once?e.once(t,n):e.on(t,n);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function r(s){i.once&&e.removeEventListener(t,r),n(s)}))}}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return a},set:function(e){if("number"!=typeof e||e<0||r(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");a=e}}),s.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||r(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},s.prototype.getMaxListeners=function(){return l(this)},s.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var r="error"===e,s=this._events;if(void 0!==s)r=r&&void 0===s.error;else if(!r)return!1;if(r){var a;if(t.length>0&&(a=t[0]),a instanceof Error)throw a;var o=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw o.context=a,o}var l=s[e];if(void 0===l)return!1;if("function"==typeof l)i(l,this,t);else{var u=l.length,c=p(l,u);for(n=0;n<u;++n)i(c[n],this,t)}return!0},s.prototype.addListener=function(e,t){return u(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return u(this,e,t,!0)},s.prototype.once=function(e,t){return o(t),this.on(e,h(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){return o(t),this.prependListener(e,h(this,e,t)),this},s.prototype.removeListener=function(e,t){var n,i,r,s,a;if(o(t),void 0===(i=this._events))return this;if(void 0===(n=i[e]))return this;if(n===t||n.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(r=-1,s=n.length-1;s>=0;s--)if(n[s]===t||n[s].listener===t){a=n[s].listener,r=s;break}if(r<0)return this;0===r?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,r),1===n.length&&(i[e]=n[0]),void 0!==i.removeListener&&this.emit("removeListener",e,a||t)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(e){var t,n,i;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[e]),this;if(0===arguments.length){var r,s=Object.keys(n);for(i=0;i<s.length;++i)"removeListener"!==(r=s[i])&&this.removeAllListeners(r);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(void 0!==t)for(i=t.length-1;i>=0;i--)this.removeListener(e,t[i]);return this},s.prototype.listeners=function(e){return d(this,e,!0)},s.prototype.rawListeners=function(e){return d(this,e,!1)},s.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):f.call(e,t)},s.prototype.listenerCount=f,s.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},24334:function(e,t,n){var i,r;r="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==n.g?n.g:this,e.exports=function(n){"use strict";var r,s=(n=n||{}).Base64,a="2.6.4",o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",l=function(e){for(var t={},n=0,i=e.length;n<i;n++)t[e.charAt(n)]=n;return t}(o),u=String.fromCharCode,c=function(e){if(e.length<2)return(t=e.charCodeAt(0))<128?e:t<2048?u(192|t>>>6)+u(128|63&t):u(224|t>>>12&15)+u(128|t>>>6&63)+u(128|63&t);var t=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return u(240|t>>>18&7)+u(128|t>>>12&63)+u(128|t>>>6&63)+u(128|63&t)},h=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,d=function(e){return e.replace(h,c)},f=function(e){var t=[0,2,1][e.length%3],n=e.charCodeAt(0)<<16|(e.length>1?e.charCodeAt(1):0)<<8|(e.length>2?e.charCodeAt(2):0);return[o.charAt(n>>>18),o.charAt(n>>>12&63),t>=2?"=":o.charAt(n>>>6&63),t>=1?"=":o.charAt(63&n)].join("")},p=n.btoa&&"function"==typeof n.btoa?function(e){return n.btoa(e)}:function(e){if(e.match(/[^\x00-\xFF]/))throw new RangeError("The string contains invalid characters.");return e.replace(/[\s\S]{1,3}/g,f)},_=function(e){return p(d(String(e)))},g=function(e){return e.replace(/[+\/]/g,(function(e){return"+"==e?"-":"_"})).replace(/=/g,"")},m=function(e,t){return t?g(_(e)):_(e)},v=function(e){return m(e,!0)};n.Uint8Array&&(r=function(e,t){for(var n="",i=0,r=e.length;i<r;i+=3){var s=e[i],a=e[i+1],l=e[i+2],u=s<<16|a<<8|l;n+=o.charAt(u>>>18)+o.charAt(u>>>12&63)+(void 0!==a?o.charAt(u>>>6&63):"=")+(void 0!==l?o.charAt(63&u):"=")}return t?g(n):n});var y,b=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,E=function(e){switch(e.length){case 4:var t=((7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3))-65536;return u(55296+(t>>>10))+u(56320+(1023&t));case 3:return u((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return u((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},w=function(e){return e.replace(b,E)},k=function(e){var t=e.length,n=t%4,i=(t>0?l[e.charAt(0)]<<18:0)|(t>1?l[e.charAt(1)]<<12:0)|(t>2?l[e.charAt(2)]<<6:0)|(t>3?l[e.charAt(3)]:0),r=[u(i>>>16),u(i>>>8&255),u(255&i)];return r.length-=[0,0,2,1][n],r.join("")},S=n.atob&&"function"==typeof n.atob?function(e){return n.atob(e)}:function(e){return e.replace(/\S{1,4}/g,k)},T=function(e){return S(String(e).replace(/[^A-Za-z0-9\+\/]/g,""))},A=function(e){return w(S(e))},C=function(e){return String(e).replace(/[-_]/g,(function(e){return"-"==e?"+":"/"})).replace(/[^A-Za-z0-9\+\/]/g,"")},R=function(e){return A(C(e))};n.Uint8Array&&(y=function(e){return Uint8Array.from(T(C(e)),(function(e){return e.charCodeAt(0)}))});var L=function(){var e=n.Base64;return n.Base64=s,e};if(n.Base64={VERSION:a,atob:T,btoa:p,fromBase64:R,toBase64:m,utob:d,encode:m,encodeURI:v,btou:w,decode:R,noConflict:L,fromUint8Array:r,toUint8Array:y},"function"==typeof Object.defineProperty){var x=function(e){return{value:e,enumerable:!1,writable:!0,configurable:!0}};n.Base64.extendString=function(){Object.defineProperty(String.prototype,"fromBase64",x((function(){return R(this)}))),Object.defineProperty(String.prototype,"toBase64",x((function(e){return m(this,e)}))),Object.defineProperty(String.prototype,"toBase64URI",x((function(){return m(this,!0)})))}}return n.Meteor&&(Base64=n.Base64),e.exports?e.exports.Base64=n.Base64:void 0===(i=function(){return n.Base64}.apply(t,[]))||(e.exports=i),{Base64:n.Base64}}(r)},53184:function(e,t,n){"use strict";var i,r;i=[n(58553),n(87804),n(40998)],void 0===(r=function(e,t,n){return function(e,t,n){var i=function(t,n){return e.js_beautify(t,n)};return i.js=e.js_beautify,i.css=t.css_beautify,i.html=n.html_beautify,i.js_beautify=e.js_beautify,i.css_beautify=t.css_beautify,i.html_beautify=n.html_beautify,i}(e,t,n)}.apply(t,i))||(e.exports=r)},87804:function(e,t){var n;!function(){var i;!function(){"use strict";var e=[,,function(e){function t(e){this.__parent=e,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(e,t){this.__cache=[""],this.__indent_size=e.indent_size,this.__indent_string=e.indent_char,e.indent_with_tabs||(this.__indent_string=new Array(e.indent_size+1).join(e.indent_char)),t=t||"",e.indent_level>0&&(t=new Array(e.indent_level+1).join(this.__indent_string)),this.__base_string=t,this.__base_string_length=t.length}function i(e,i){this.__indent_cache=new n(e,i),this.raw=!1,this._end_with_newline=e.end_with_newline,this.indent_size=e.indent_size,this.wrap_line_length=e.wrap_line_length,this.indent_empty_lines=e.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new t(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}t.prototype.clone_empty=function(){var e=new t(this.__parent);return e.set_indent(this.__indent_count,this.__alignment_count),e},t.prototype.item=function(e){return e<0?this.__items[this.__items.length+e]:this.__items[e]},t.prototype.has_match=function(e){for(var t=this.__items.length-1;t>=0;t--)if(this.__items[t].match(e))return!0;return!1},t.prototype.set_indent=function(e,t){this.is_empty()&&(this.__indent_count=e||0,this.__alignment_count=t||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},t.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)},t.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},t.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var e=this.__parent.current_line;return e.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),e.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),e.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count," "===e.__items[0]&&(e.__items.splice(0,1),e.__character_count-=1),!0}return!1},t.prototype.is_empty=function(){return 0===this.__items.length},t.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},t.prototype.push=function(e){this.__items.push(e);var t=e.lastIndexOf("\n");-1!==t?this.__character_count=e.length-t:this.__character_count+=e.length},t.prototype.pop=function(){var e=null;return this.is_empty()||(e=this.__items.pop(),this.__character_count-=e.length),e},t.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},t.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},t.prototype.trim=function(){for(;" "===this.last();)this.__items.pop(),this.__character_count-=1},t.prototype.toString=function(){var e="";return this.is_empty()?this.__parent.indent_empty_lines&&(e=this.__parent.get_indent_string(this.__indent_count)):(e=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),e+=this.__items.join("")),e},n.prototype.get_indent_size=function(e,t){var n=this.__base_string_length;return t=t||0,e<0&&(n=0),n+=e*this.__indent_size,n+=t},n.prototype.get_indent_string=function(e,t){var n=this.__base_string;return t=t||0,e<0&&(e=0,n=""),t+=e*this.__indent_size,this.__ensure_cache(t),n+=this.__cache[t]},n.prototype.__ensure_cache=function(e){for(;e>=this.__cache.length;)this.__add_column()},n.prototype.__add_column=function(){var e=this.__cache.length,t=0,n="";this.__indent_size&&e>=this.__indent_size&&(e-=(t=Math.floor(e/this.__indent_size))*this.__indent_size,n=new Array(t+1).join(this.__indent_string)),e&&(n+=new Array(e+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(e,t){return this.__indent_cache.get_indent_string(e,t)},i.prototype.get_indent_size=function(e,t){return this.__indent_cache.get_indent_size(e,t)},i.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},i.prototype.add_new_line=function(e){return!(this.is_empty()||!e&&this.just_added_newline())&&(this.raw||this.__add_outputline(),!0)},i.prototype.get_code=function(e){this.trim(!0);var t=this.current_line.pop();t&&("\n"===t[t.length-1]&&(t=t.replace(/\n+$/g,"")),this.current_line.push(t)),this._end_with_newline&&this.__add_outputline();var n=this.__lines.join("\n");return"\n"!==e&&(n=n.replace(/[\n]/g,e)),n},i.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},i.prototype.set_indent=function(e,t){return e=e||0,t=t||0,this.next_line.set_indent(e,t),this.__lines.length>1?(this.current_line.set_indent(e,t),!0):(this.current_line.set_indent(),!1)},i.prototype.add_raw_token=function(e){for(var t=0;t<e.newlines;t++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(e.whitespace_before),this.current_line.push(e.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},i.prototype.add_token=function(e){this.__add_space_before_token(),this.current_line.push(e),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(e){for(var t=this.__lines.length;e<t;)this.__lines[e]._remove_indent(),e++;this.current_line._remove_wrap_indent()},i.prototype.trim=function(e){for(e=void 0!==e&&e,this.current_line.trim();e&&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(e,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(e)&&r.item(-1)!==n){this.__lines.splice(i+1,0,new t(this)),this.previous_line=this.__lines[this.__lines.length-2];break}i--}},e.exports.Output=i},,,,function(e){function t(e,t){this.raw_options=n(e,t),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(e,t){var n,r={};for(n in e=i(e))n!==t&&(r[n]=e[n]);if(t&&e[t])for(n in e[t])r[n]=e[t][n];return r}function i(e){var t,n={};for(t in e){n[t.replace(/-/g,"_")]=e[t]}return n}t.prototype._get_array=function(e,t){var n=this.raw_options[e],i=t||[];return"object"==typeof n?null!==n&&"function"==typeof n.concat&&(i=n.concat()):"string"==typeof n&&(i=n.split(/[^a-zA-Z0-9_\/\-]+/)),i},t.prototype._get_boolean=function(e,t){var n=this.raw_options[e];return void 0===n?!!t:!!n},t.prototype._get_characters=function(e,t){var n=this.raw_options[e],i=t||"";return"string"==typeof n&&(i=n.replace(/\\r/,"\r").replace(/\\n/,"\n").replace(/\\t/,"\t")),i},t.prototype._get_number=function(e,t){var n=this.raw_options[e];t=parseInt(t,10),isNaN(t)&&(t=0);var i=parseInt(n,10);return isNaN(i)&&(i=t),i},t.prototype._get_selection=function(e,t,n){var i=this._get_selection_list(e,t,n);if(1!==i.length)throw new Error("Invalid Option Value: The option '"+e+"' can only be one of the following values:\n"+t+"\nYou passed in: '"+this.raw_options[e]+"'");return i[0]},t.prototype._get_selection_list=function(e,t,n){if(!t||0===t.length)throw new Error("Selection list cannot be empty.");if(n=n||[t[0]],!this._is_valid_selection(n,t))throw new Error("Invalid Default Value!");var i=this._get_array(e,n);if(!this._is_valid_selection(i,t))throw new Error("Invalid Option Value: The option '"+e+"' can contain only the following values:\n"+t+"\nYou passed in: '"+this.raw_options[e]+"'");return i},t.prototype._is_valid_selection=function(e,t){return e.length&&t.length&&!e.some((function(e){return-1===t.indexOf(e)}))},e.exports.Options=t,e.exports.normalizeOpts=i,e.exports.mergeOpts=n},,function(e){var t=RegExp.prototype.hasOwnProperty("sticky");function n(e){this.__input=e||"",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 e=null;return this.hasNext()&&(e=this.__input.charAt(this.__position),this.__position+=1),e},n.prototype.peek=function(e){var t=null;return e=e||0,(e+=this.__position)>=0&&e<this.__input_length&&(t=this.__input.charAt(e)),t},n.prototype.__match=function(e,n){e.lastIndex=n;var i=e.exec(this.__input);return!i||t&&e.sticky||i.index!==n&&(i=null),i},n.prototype.test=function(e,t){return t=t||0,(t+=this.__position)>=0&&t<this.__input_length&&!!this.__match(e,t)},n.prototype.testChar=function(e,t){var n=this.peek(t);return e.lastIndex=0,null!==n&&e.test(n)},n.prototype.match=function(e){var t=this.__match(e,this.__position);return t?this.__position+=t[0].length:t=null,t},n.prototype.read=function(e,t,n){var i,r="";return e&&(i=this.match(e))&&(r+=i[0]),!t||!i&&e||(r+=this.readUntil(t,n)),r},n.prototype.readUntil=function(e,t){var n,i=this.__position;e.lastIndex=this.__position;var r=e.exec(this.__input);return r?(i=r.index,t&&(i+=r[0].length)):i=this.__input_length,n=this.__input.substring(this.__position,i),this.__position=i,n},n.prototype.readUntilAfter=function(e){return this.readUntil(e,!0)},n.prototype.get_regexp=function(e,n){var i=null,r="g";return n&&t&&(r="y"),"string"==typeof e&&""!==e?i=new RegExp(e,r):e&&(i=new RegExp(e.source,r)),i},n.prototype.get_literal_regexp=function(e){return RegExp(e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},n.prototype.peekUntilAfter=function(e){var t=this.__position,n=this.readUntilAfter(e);return this.__position=t,n},n.prototype.lookBack=function(e){var t=this.__position-1;return t>=e.length&&this.__input.substring(t-e.length,t).toLowerCase()===e},e.exports.InputScanner=n},,,,,function(e){function t(e,t){e="string"==typeof e?e:e.source,t="string"==typeof t?t:t.source,this.__directives_block_pattern=new RegExp(e+/ beautify( \w+[:]\w+)+ /.source+t,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(e+/\sbeautify\signore:end\s/.source+t,"g")}t.prototype.get_directives=function(e){if(!e.match(this.__directives_block_pattern))return null;var t={};this.__directive_pattern.lastIndex=0;for(var n=this.__directive_pattern.exec(e);n;)t[n[1]]=n[2],n=this.__directive_pattern.exec(e);return t},t.prototype.readIgnored=function(e){return e.readUntilAfter(this.__directives_end_ignore_pattern)},e.exports.Directives=t},,function(e,t,n){var i=n(16).Beautifier,r=n(17).Options;e.exports=function(e,t){return new i(e,t).beautify()},e.exports.defaultOptions=function(){return new r}},function(e,t,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/,c=/(?:\s|\n)+/g,h=/\/\*(?:[\s\S]*?)((?:\*\/)|$)/g,d=/\/\/(?:[^\n\r\u2028\u2029]*)/g;function f(e,t){this._source_text=e||"",this._options=new i(t),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(e){var t="";for(this._ch=this._input.next();this._ch;){if(t+=this._ch,"\\"===this._ch)t+=this._input.next();else if(-1!==e.indexOf(this._ch)||"\n"===this._ch)break;this._ch=this._input.next()}return t},f.prototype.eatWhitespace=function(e){for(var t=u.test(this._input.peek()),n=0;u.test(this._input.peek());)this._ch=this._input.next(),e&&"\n"===this._ch&&(0===n||n<this._options.max_preserve_newlines)&&(n++,this._output.add_new_line(!0));return t},f.prototype.foundNestedPseudoClass=function(){for(var e=0,t=1,n=this._input.peek(t);n;){if("{"===n)return!0;if("("===n)e+=1;else if(")"===n){if(0===e)return!1;e-=1}else if(";"===n||"}"===n)return!1;t++,n=this._input.peek(t)}return!1},f.prototype.print_string=function(e){this._output.set_indent(this._indentLevel),this._output.non_breaking_space=!0,this._output.add_token(e)},f.prototype.preserveSingleSpace=function(e){e&&(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 e=this._source_text,t=this._options.eol;"auto"===t&&(t="\n",e&&o.test(e||"")&&(t=e.match(o)[0]));var n=(e=e.replace(l,"\n")).match(/^[\t ]*/)[0];this._output=new r(this._options,n),this._input=new s(e),this._indentLevel=0,this._nestedLevel=0,this._ch=null;for(var i,f,p=0,_=!1,g=!1,m=!1,v=!1,y=!1,b=this._ch,E=!1;i=""!==this._input.read(c),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(h),k=a.get_directives(w);k&&"start"===k.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 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(":")&&(g=!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 T=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);T.match(/[ :]$/)&&(T=this.eatString(": ").replace(/\s+$/,""),this.print_string(T),this._output.space_before_token=!0),0===p&&-1!==T.indexOf(":")?(g=!0,this.indent()):T in this.NESTED_AT_RULE?(this._nestedLevel+=1,T in this.CONDITIONAL_GROUP_RULE&&(m=!0)):0!==p||g||(v=!0)}else if("#"===this._ch&&"{"===this._input.peek())this.preserveSingleSpace(i),this.print_string(this._ch+this.eatString("}"));else if("{"===this._ch)g&&(g=!1,this.outdent()),v=!1,m?(m=!1,_=this._indentLevel>=this._nestedLevel):_=this._indentLevel>=this._nestedLevel-1,this._options.newline_between_rules&&_&&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),g&&(this.outdent(),g=!1),this.print_string(this._ch),_=!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}!_&&!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(":"),g||(g=!0,this._output.space_before_token=!0,this.eatWhitespace(!0),this.indent()))}else if('"'===this._ch||"'"===this._ch){var C='"'===f||"'"===f;this.preserveSingleSpace(C||i),this.print_string(this._ch+this.eatString(this._ch)),this.eatWhitespace(!0)}else if(";"===this._ch)E=!1,0===p?(g&&(this.outdent(),g=!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 R=!1;this._input.lookBack("with")&&(R=!0),this.preserveSingleSpace(i||R),this.print_string(this._ch),g&&"$"===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||g&&!y||0!==p||v?this._output.space_before_token=!0:this._output.add_new_line();else if(">"!==this._ch&&"+"!==this._ch&&"~"!==this._ch||g||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 L='"'===f||"'"===f;this.preserveSingleSpace(L||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(t)},e.exports.Beautifier=f},function(e,t,n){var i=n(6).Options;function r(e){i.call(this,e,"css"),this.selector_separator_newline=this._get_boolean("selector_separator_newline",!0),this.newline_between_rules=this._get_boolean("newline_between_rules",!0);var t=this._get_boolean("space_around_selector_separator");this.space_around_combinator=this._get_boolean("space_around_combinator")||t;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,e.exports.Options=r}],t={};var n=function n(i){var r=t[i];if(void 0!==r)return r.exports;var s=t[i]={exports:{}};return e[i](s,s.exports,n),s.exports}(15);i=n}();var r=i;void 0===(n=function(){return{css_beautify:r}}.apply(t,[]))||(e.exports=n)}()},40998:function(e,t,n){var i,r;!function(){var s;!function(){"use strict";var e=[,,function(e){function t(e){this.__parent=e,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(e,t){this.__cache=[""],this.__indent_size=e.indent_size,this.__indent_string=e.indent_char,e.indent_with_tabs||(this.__indent_string=new Array(e.indent_size+1).join(e.indent_char)),t=t||"",e.indent_level>0&&(t=new Array(e.indent_level+1).join(this.__indent_string)),this.__base_string=t,this.__base_string_length=t.length}function i(e,i){this.__indent_cache=new n(e,i),this.raw=!1,this._end_with_newline=e.end_with_newline,this.indent_size=e.indent_size,this.wrap_line_length=e.wrap_line_length,this.indent_empty_lines=e.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new t(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}t.prototype.clone_empty=function(){var e=new t(this.__parent);return e.set_indent(this.__indent_count,this.__alignment_count),e},t.prototype.item=function(e){return e<0?this.__items[this.__items.length+e]:this.__items[e]},t.prototype.has_match=function(e){for(var t=this.__items.length-1;t>=0;t--)if(this.__items[t].match(e))return!0;return!1},t.prototype.set_indent=function(e,t){this.is_empty()&&(this.__indent_count=e||0,this.__alignment_count=t||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},t.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)},t.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},t.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var e=this.__parent.current_line;return e.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),e.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),e.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count," "===e.__items[0]&&(e.__items.splice(0,1),e.__character_count-=1),!0}return!1},t.prototype.is_empty=function(){return 0===this.__items.length},t.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},t.prototype.push=function(e){this.__items.push(e);var t=e.lastIndexOf("\n");-1!==t?this.__character_count=e.length-t:this.__character_count+=e.length},t.prototype.pop=function(){var e=null;return this.is_empty()||(e=this.__items.pop(),this.__character_count-=e.length),e},t.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},t.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},t.prototype.trim=function(){for(;" "===this.last();)this.__items.pop(),this.__character_count-=1},t.prototype.toString=function(){var e="";return this.is_empty()?this.__parent.indent_empty_lines&&(e=this.__parent.get_indent_string(this.__indent_count)):(e=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),e+=this.__items.join("")),e},n.prototype.get_indent_size=function(e,t){var n=this.__base_string_length;return t=t||0,e<0&&(n=0),n+=e*this.__indent_size,n+=t},n.prototype.get_indent_string=function(e,t){var n=this.__base_string;return t=t||0,e<0&&(e=0,n=""),t+=e*this.__indent_size,this.__ensure_cache(t),n+=this.__cache[t]},n.prototype.__ensure_cache=function(e){for(;e>=this.__cache.length;)this.__add_column()},n.prototype.__add_column=function(){var e=this.__cache.length,t=0,n="";this.__indent_size&&e>=this.__indent_size&&(e-=(t=Math.floor(e/this.__indent_size))*this.__indent_size,n=new Array(t+1).join(this.__indent_string)),e&&(n+=new Array(e+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(e,t){return this.__indent_cache.get_indent_string(e,t)},i.prototype.get_indent_size=function(e,t){return this.__indent_cache.get_indent_size(e,t)},i.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},i.prototype.add_new_line=function(e){return!(this.is_empty()||!e&&this.just_added_newline())&&(this.raw||this.__add_outputline(),!0)},i.prototype.get_code=function(e){this.trim(!0);var t=this.current_line.pop();t&&("\n"===t[t.length-1]&&(t=t.replace(/\n+$/g,"")),this.current_line.push(t)),this._end_with_newline&&this.__add_outputline();var n=this.__lines.join("\n");return"\n"!==e&&(n=n.replace(/[\n]/g,e)),n},i.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},i.prototype.set_indent=function(e,t){return e=e||0,t=t||0,this.next_line.set_indent(e,t),this.__lines.length>1?(this.current_line.set_indent(e,t),!0):(this.current_line.set_indent(),!1)},i.prototype.add_raw_token=function(e){for(var t=0;t<e.newlines;t++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(e.whitespace_before),this.current_line.push(e.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},i.prototype.add_token=function(e){this.__add_space_before_token(),this.current_line.push(e),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(e){for(var t=this.__lines.length;e<t;)this.__lines[e]._remove_indent(),e++;this.current_line._remove_wrap_indent()},i.prototype.trim=function(e){for(e=void 0!==e&&e,this.current_line.trim();e&&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(e,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(e)&&r.item(-1)!==n){this.__lines.splice(i+1,0,new t(this)),this.previous_line=this.__lines[this.__lines.length-2];break}i--}},e.exports.Output=i},function(e){e.exports.Token=function(e,t,n,i){this.type=e,this.text=t,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(e){function t(e,t){this.raw_options=n(e,t),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(e,t){var n,r={};for(n in e=i(e))n!==t&&(r[n]=e[n]);if(t&&e[t])for(n in e[t])r[n]=e[t][n];return r}function i(e){var t,n={};for(t in e){n[t.replace(/-/g,"_")]=e[t]}return n}t.prototype._get_array=function(e,t){var n=this.raw_options[e],i=t||[];return"object"==typeof n?null!==n&&"function"==typeof n.concat&&(i=n.concat()):"string"==typeof n&&(i=n.split(/[^a-zA-Z0-9_\/\-]+/)),i},t.prototype._get_boolean=function(e,t){var n=this.raw_options[e];return void 0===n?!!t:!!n},t.prototype._get_characters=function(e,t){var n=this.raw_options[e],i=t||"";return"string"==typeof n&&(i=n.replace(/\\r/,"\r").replace(/\\n/,"\n").replace(/\\t/,"\t")),i},t.prototype._get_number=function(e,t){var n=this.raw_options[e];t=parseInt(t,10),isNaN(t)&&(t=0);var i=parseInt(n,10);return isNaN(i)&&(i=t),i},t.prototype._get_selection=function(e,t,n){var i=this._get_selection_list(e,t,n);if(1!==i.length)throw new Error("Invalid Option Value: The option '"+e+"' can only be one of the following values:\n"+t+"\nYou passed in: '"+this.raw_options[e]+"'");return i[0]},t.prototype._get_selection_list=function(e,t,n){if(!t||0===t.length)throw new Error("Selection list cannot be empty.");if(n=n||[t[0]],!this._is_valid_selection(n,t))throw new Error("Invalid Default Value!");var i=this._get_array(e,n);if(!this._is_valid_selection(i,t))throw new Error("Invalid Option Value: The option '"+e+"' can contain only the following values:\n"+t+"\nYou passed in: '"+this.raw_options[e]+"'");return i},t.prototype._is_valid_selection=function(e,t){return e.length&&t.length&&!e.some((function(e){return-1===t.indexOf(e)}))},e.exports.Options=t,e.exports.normalizeOpts=i,e.exports.mergeOpts=n},,function(e){var t=RegExp.prototype.hasOwnProperty("sticky");function n(e){this.__input=e||"",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 e=null;return this.hasNext()&&(e=this.__input.charAt(this.__position),this.__position+=1),e},n.prototype.peek=function(e){var t=null;return e=e||0,(e+=this.__position)>=0&&e<this.__input_length&&(t=this.__input.charAt(e)),t},n.prototype.__match=function(e,n){e.lastIndex=n;var i=e.exec(this.__input);return!i||t&&e.sticky||i.index!==n&&(i=null),i},n.prototype.test=function(e,t){return t=t||0,(t+=this.__position)>=0&&t<this.__input_length&&!!this.__match(e,t)},n.prototype.testChar=function(e,t){var n=this.peek(t);return e.lastIndex=0,null!==n&&e.test(n)},n.prototype.match=function(e){var t=this.__match(e,this.__position);return t?this.__position+=t[0].length:t=null,t},n.prototype.read=function(e,t,n){var i,r="";return e&&(i=this.match(e))&&(r+=i[0]),!t||!i&&e||(r+=this.readUntil(t,n)),r},n.prototype.readUntil=function(e,t){var n,i=this.__position;e.lastIndex=this.__position;var r=e.exec(this.__input);return r?(i=r.index,t&&(i+=r[0].length)):i=this.__input_length,n=this.__input.substring(this.__position,i),this.__position=i,n},n.prototype.readUntilAfter=function(e){return this.readUntil(e,!0)},n.prototype.get_regexp=function(e,n){var i=null,r="g";return n&&t&&(r="y"),"string"==typeof e&&""!==e?i=new RegExp(e,r):e&&(i=new RegExp(e.source,r)),i},n.prototype.get_literal_regexp=function(e){return RegExp(e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},n.prototype.peekUntilAfter=function(e){var t=this.__position,n=this.readUntilAfter(e);return this.__position=t,n},n.prototype.lookBack=function(e){var t=this.__position-1;return t>=e.length&&this.__input.substring(t-e.length,t).toLowerCase()===e},e.exports.InputScanner=n},function(e,t,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(e,t){this._input=new i(e),this._options=t||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new a(this._input)};l.prototype.tokenize=function(){var e;this._input.restart(),this.__tokens=new s,this._reset();for(var t=new r(o.START,""),n=null,i=[],a=new s;t.type!==o.EOF;){for(e=this._get_next_token(t,n);this._is_comment(e);)a.add(e),e=this._get_next_token(t,n);a.isEmpty()||(e.comments_before=a,a=new s),e.parent=n,this._is_opening(e)?(i.push(n),n=e):n&&this._is_closing(e,n)&&(e.opened=n,n.closed=e,n=i.pop(),e.parent=n),e.previous=t,t.next=e,this.__tokens.add(e),t=e}return this.__tokens},l.prototype._is_first_token=function(){return this.__tokens.isEmpty()},l.prototype._reset=function(){},l.prototype._get_next_token=function(e,t){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(e){return!1},l.prototype._is_opening=function(e){return!1},l.prototype._is_closing=function(e,t){return!1},l.prototype._create_token=function(e,t){return new r(e,t,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token)},l.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},e.exports.Tokenizer=l,e.exports.TOKEN=o},function(e){function t(e){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=e}t.prototype.restart=function(){this.__position=0},t.prototype.isEmpty=function(){return 0===this.__tokens_length},t.prototype.hasNext=function(){return this.__position<this.__tokens_length},t.prototype.next=function(){var e=null;return this.hasNext()&&(e=this.__tokens[this.__position],this.__position+=1),e},t.prototype.peek=function(e){var t=null;return e=e||0,(e+=this.__position)>=0&&e<this.__tokens_length&&(t=this.__tokens[e]),t},t.prototype.add=function(e){this.__parent_token&&(e.parent=this.__parent_token),this.__tokens.push(e),this.__tokens_length+=1},e.exports.TokenStream=t},function(e,t,n){var i=n(12).Pattern;function r(e,t){i.call(this,e,t),t?this._line_regexp=this._input.get_regexp(t._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}r.prototype=new i,r.prototype.__set_whitespace_patterns=function(e,t){e+="\\t ",t+="\\n\\r",this._match_pattern=this._input.get_regexp("["+e+t+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+t+"]")},r.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var e=this._input.read(this._match_pattern);if(" "===e)this.whitespace_before_token=" ";else if(e){var t=this.__split(this._newline_regexp,e);this.newline_count=t.length-1,this.whitespace_before_token=t[this.newline_count]}return e},r.prototype.matching=function(e,t){var n=this._create();return n.__set_whitespace_patterns(e,t),n._update(),n},r.prototype._create=function(){return new r(this._input,this)},r.prototype.__split=function(e,t){e.lastIndex=0;for(var n=0,i=[],r=e.exec(t);r;)i.push(t.substring(n,r.index)),n=r.index+r[0].length,r=e.exec(t);return n<t.length?i.push(t.substring(n,t.length)):i.push(""),i},e.exports.WhitespacePattern=r},function(e){function t(e,t){this._input=e,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,t&&(this._starting_pattern=this._input.get_regexp(t._starting_pattern,!0),this._match_pattern=this._input.get_regexp(t._match_pattern,!0),this._until_pattern=this._input.get_regexp(t._until_pattern),this._until_after=t._until_after)}t.prototype.read=function(){var e=this._input.read(this._starting_pattern);return this._starting_pattern&&!e||(e+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),e},t.prototype.read_match=function(){return this._input.match(this._match_pattern)},t.prototype.until_after=function(e){var t=this._create();return t._until_after=!0,t._until_pattern=this._input.get_regexp(e),t._update(),t},t.prototype.until=function(e){var t=this._create();return t._until_after=!1,t._until_pattern=this._input.get_regexp(e),t._update(),t},t.prototype.starting_with=function(e){var t=this._create();return t._starting_pattern=this._input.get_regexp(e,!0),t._update(),t},t.prototype.matching=function(e){var t=this._create();return t._match_pattern=this._input.get_regexp(e,!0),t._update(),t},t.prototype._create=function(){return new t(this._input,this)},t.prototype._update=function(){},e.exports.Pattern=t},function(e){function t(e,t){e="string"==typeof e?e:e.source,t="string"==typeof t?t:t.source,this.__directives_block_pattern=new RegExp(e+/ beautify( \w+[:]\w+)+ /.source+t,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(e+/\sbeautify\signore:end\s/.source+t,"g")}t.prototype.get_directives=function(e){if(!e.match(this.__directives_block_pattern))return null;var t={};this.__directive_pattern.lastIndex=0;for(var n=this.__directive_pattern.exec(e);n;)t[n[1]]=n[2],n=this.__directive_pattern.exec(e);return t},t.prototype.readIgnored=function(e){return e.readUntilAfter(this.__directives_end_ignore_pattern)},e.exports.Directives=t},function(e,t,n){var i=n(12).Pattern,r={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1,angular:!1};function s(e,t){i.call(this,e,t),this.__template_pattern=null,this._disabled=Object.assign({},r),this._excluded=Object.assign({},r),t&&(this.__template_pattern=this._input.get_regexp(t.__template_pattern),this._excluded=Object.assign(this._excluded,t._excluded),this._disabled=Object.assign(this._disabled,t._disabled));var n=new i(e);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(e){var t=this._create();return t._disabled[e]=!0,t._update(),t},s.prototype.read_options=function(e){var t=this._create();for(var n in r)t._disabled[n]=-1===e.templating.indexOf(n);return t._update(),t},s.prototype.exclude=function(e){var t=this._create();return t._excluded[e]=!0,t._update(),t},s.prototype.read=function(){var e="";e=this._match_pattern?this._input.read(this._starting_pattern):this._input.read(this._starting_pattern,this.__template_pattern);for(var t=this._read_template();t;)this._match_pattern?t+=this._input.read(this._match_pattern):t+=this._input.readUntil(this.__template_pattern),e+=t,t=this._read_template();return this._until_after&&(e+=this._input.readUntilAfter(this._until_pattern)),e},s.prototype.__set_templated_pattern=function(){var e=[];this._disabled.php||e.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||e.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.angular||e.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||e.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(e.push(this.__patterns.django._starting_pattern.source),e.push(this.__patterns.django_value._starting_pattern.source),e.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||e.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&e.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+e.join("|")+")")},s.prototype._read_template=function(){var e="",t=this._input.peek();if("<"===t){var n=this._input.peek(1);this._disabled.php||this._excluded.php||"?"!==n||(e=e||this.__patterns.php.read()),this._disabled.erb||this._excluded.erb||"%"!==n||(e=e||this.__patterns.erb.read())}else"{"===t&&(this._disabled.handlebars||this._excluded.handlebars||(e=(e=(e=e||this.__patterns.handlebars_comment.read())||this.__patterns.handlebars_unescaped.read())||this.__patterns.handlebars.read()),this._disabled.django||(this._excluded.django||this._excluded.handlebars||(e=e||this.__patterns.django_value.read()),this._excluded.django||(e=(e=e||this.__patterns.django_comment.read())||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(e=(e=(e=e||this.__patterns.smarty_comment.read())||this.__patterns.smarty_literal.read())||this.__patterns.smarty.read()));return e},e.exports.TemplatablePattern=s},,,,function(e,t,n){var i=n(19).Beautifier,r=n(20).Options;e.exports=function(e,t,n,r){return new i(e,t,n,r).beautify()},e.exports.defaultOptions=function(){return new r}},function(e,t,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(e,t){this.indent_level=0,this.alignment_size=0,this.max_preserve_newlines=e.max_preserve_newlines,this.preserve_newlines=e.preserve_newlines,this._output=new r(e,t)};u.prototype.current_line_has_match=function(e){return this._output.current_line.has_match(e)},u.prototype.set_space_before_token=function(e,t){this._output.space_before_token=e,this._output.non_breaking_space=t},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(e){this._output.add_raw_token(e)},u.prototype.print_preserved_newlines=function(e){var t=0;e.type!==a.TEXT&&e.previous.type!==a.TEXT&&(t=e.newlines?1:0),this.preserve_newlines&&(t=e.newlines<this.max_preserve_newlines+1?e.newlines:this.max_preserve_newlines+1);for(var n=0;n<t;n++)this.print_newline(n>0);return 0!==t},u.prototype.traverse_whitespace=function(e){return!(!e.whitespace_before&&!e.newlines)&&(this.print_preserved_newlines(e)||(this._output.space_before_token=!0),!0)},u.prototype.previous_token_wrapped=function(){return this._output.previous_token_wrapped},u.prototype.print_newline=function(e){this._output.add_new_line(e)},u.prototype.print_token=function(e){e.text&&(this._output.set_indent(this.indent_level,this.alignment_size),this._output.add_token(e.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(e){return(e=this.indent_level+(e||0))<1?"":this._output.get_indent_string(e)};var c=function(e,t){var n=null,i=null;return t.closed?("script"===e?n="text/javascript":"style"===e&&(n="text/css"),n=function(e){for(var t=null,n=e.next;n.type!==a.EOF&&e.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&&(t=n.next.next.text);break}n=n.next}return t}(t)||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 h(e,t){return-1!==t.indexOf(e)}function d(e,t,n){this.parent=e||null,this.tag=t?t.tag_name:"",this.indent_level=n||0,this.parser_token=t||null}function f(e){this._printer=e,this._current_frame=null}function p(e,t,n,r){this._source_text=e||"",t=t||{},this._js_beautify=n,this._css_beautify=r,this._tag_stack=null;var s=new i(t,"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(e){var t=new d(this._current_frame,e,this._printer.indent_level);this._current_frame=t},f.prototype._try_pop_frame=function(e){var t=null;return e&&(t=e.parser_token,this._printer.indent_level=e.indent_level,this._current_frame=e.parent),t},f.prototype._get_frame=function(e,t){for(var n=this._current_frame;n&&-1===e.indexOf(n.tag);){if(t&&-1!==t.indexOf(n.tag)){n=null;break}n=n.parent}return n},f.prototype.try_pop=function(e,t){var n=this._get_frame([e],t);return this._try_pop_frame(n)},f.prototype.indent_to_tag=function(e){var t=this._get_frame(e);t&&(this._printer.indent_level=t.indent_level)},p.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var e=this._source_text,t=this._options.eol;"auto"===this._options.eol&&(t="\n",e&&o.test(e)&&(t=e.match(o)[0]));var n=(e=e.replace(l,"\n")).match(/^[\t ]*/)[0],i={text:"",type:""},r=new _(this._options),c=new u(this._options,n),h=new s(e,this._options).tokenize();this._tag_stack=new f(c);for(var d=null,p=h.next();p.type!==a.EOF;)p.type===a.TAG_OPEN||p.type===a.COMMENT?r=d=this._handle_tag_open(c,p,r,i,h):p.type===a.ATTRIBUTE||p.type===a.EQUALS||p.type===a.VALUE||p.type===a.TEXT&&!r.tag_complete?d=this._handle_inside_tag(c,p,r,i):p.type===a.TAG_CLOSE?d=this._handle_tag_close(c,p,r):p.type===a.TEXT?d=this._handle_text(c,p,r):p.type===a.CONTROL_FLOW_OPEN?d=this._handle_control_flow_open(c,p):p.type===a.CONTROL_FLOW_CLOSE?d=this._handle_control_flow_close(c,p):c.add_raw_token(p),i=d,p=h.next();return c._output.get_code(t)},p.prototype._handle_control_flow_open=function(e,t){var n={text:t.text,type:t.type};return e.set_space_before_token(t.newlines||""!==t.whitespace_before,!0),t.newlines?e.print_preserved_newlines(t):e.set_space_before_token(t.newlines||""!==t.whitespace_before,!0),e.print_token(t),e.indent(),n},p.prototype._handle_control_flow_close=function(e,t){var n={text:t.text,type:t.type};return e.deindent(),t.newlines?e.print_preserved_newlines(t):e.set_space_before_token(t.newlines||""!==t.whitespace_before,!0),e.print_token(t),n},p.prototype._handle_tag_close=function(e,t,n){var i={text:t.text,type:t.type};return e.alignment_size=0,n.tag_complete=!0,e.set_space_before_token(t.newlines||""!==t.whitespace_before,!0),n.is_unformatted?e.add_raw_token(t):("<"===n.tag_start_char&&(e.set_space_before_token("/"===t.text[0],!0),this._is_wrap_attributes_force_expand_multiline&&n.has_wrapped_attrs&&e.print_newline(!1)),e.print_token(t)),!n.indent_content||n.is_unformatted||n.is_content_unformatted||(e.indent(),n.indent_content=!1),n.is_inline_element||n.is_unformatted||n.is_content_unformatted||e.set_wrap_point(),i},p.prototype._handle_inside_tag=function(e,t,n,i){var r=n.has_wrapped_attrs,s={text:t.text,type:t.type};return e.set_space_before_token(t.newlines||""!==t.whitespace_before,!0),n.is_unformatted?e.add_raw_token(t):"{"===n.tag_start_char&&t.type===a.TEXT?e.print_preserved_newlines(t)?(t.newlines=0,e.add_raw_token(t)):e.print_token(t):(t.type===a.ATTRIBUTE?e.set_space_before_token(!0):(t.type===a.EQUALS||t.type===a.VALUE&&t.previous.type===a.EQUALS)&&e.set_space_before_token(!1),t.type===a.ATTRIBUTE&&"<"===n.tag_start_char&&((this._is_wrap_attributes_preserve||this._is_wrap_attributes_preserve_aligned)&&(e.traverse_whitespace(t),r=r||0!==t.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)&&(e.print_newline(!1),r=!0)),e.print_token(t),r=r||e.previous_token_wrapped(),n.has_wrapped_attrs=r),s},p.prototype._handle_text=function(e,t,n){var i={text:t.text,type:"TK_CONTENT"};return n.custom_beautifier_name?this._print_custom_beatifier_text(e,t,n):n.is_unformatted||n.is_content_unformatted?e.add_raw_token(t):(e.traverse_whitespace(t),e.print_token(t)),i},p.prototype._print_custom_beatifier_text=function(e,t,n){var i=this;if(""!==t.text){var r,s=t.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(e,t){return new p(e,t,i._js_beautify,i._css_beautify).beautify()}),"keep"===this._options.indent_scripts?a=0:"separate"===this._options.indent_scripts&&(a=-e.indent_level);var u=e.get_full_indent(a);if(s=s.replace(/\n[ \t]*$/,""),"html"!==n.custom_beautifier_name&&"<"===s[0]&&s.match(/^(<!--|<!\[CDATA\[)/)){var c=/^(<!--[^\n]*|<!\[CDATA\[)(\n?)([ \t\n]*)([\s\S]*)(-->|]]>)$/.exec(s);if(!c)return void e.add_raw_token(t);o=u+c[1]+"\n",s=c[4],c[5]&&(l=u+c[5]),s=s.replace(/\n[ \t]*$/,""),(c[2]||-1!==c[3].indexOf("\n"))&&(c=c[3].match(/[ \t]+$/))&&(t.whitespace_before=c[0])}if(s)if(r){var h=function(){this.eol="\n"};h.prototype=this._options.raw_options,s=r(u+s,new h)}else{var d=t.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),e.print_newline(!1),s&&(t.text=s,t.whitespace_before="",t.newlines=0,e.add_raw_token(t),e.print_newline(!0))}},p.prototype._handle_tag_open=function(e,t,n,i,r){var s=this._get_tag_open_token(t);if(!n.is_unformatted&&!n.is_content_unformatted||n.is_empty_element||t.type!==a.TAG_OPEN||s.is_start_tag?(e.traverse_whitespace(t),this._set_tag_position(e,t,s,n,i),s.is_inline_element||e.set_wrap_point(),e.print_token(t)):(e.add_raw_token(t),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=t.text.length+1),s.tag_complete||s.is_unformatted||(e.alignment_size=s.alignment_size),s};var _=function(e,t,n){if(this.parent=t||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&&(!e.indent_handlebars||this.text.length<3||/[^#\^]/.test(this.text.charAt(r)))}else this.tag_complete=!0};p.prototype._get_tag_open_token=function(e){var t=new _(this._options,this._tag_stack.get_parser_token(),e);return t.alignment_size=this._options.wrap_attributes_indent_size,t.is_end_tag=t.is_end_tag||h(t.tag_check,this._options.void_elements),t.is_empty_element=t.tag_complete||t.is_start_tag&&t.is_end_tag,t.is_unformatted=!t.tag_complete&&h(t.tag_check,this._options.unformatted),t.is_content_unformatted=!t.is_empty_element&&h(t.tag_check,this._options.content_unformatted),t.is_inline_element=h(t.tag_name,this._options.inline)||this._options.inline_custom_elements&&t.tag_name.includes("-")||"{"===t.tag_start_char,t},p.prototype._set_tag_position=function(e,t,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||e.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=c(n.tag_check,t)))),h(n.tag_check,this._options.extra_liners)&&(e.print_newline(!1),e._output.just_added_blankline()||e.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,e.current_line_has_match(/{{#if/)||e.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||e.print_newline(!1),this._calcluate_parent_multiline(e,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&&e.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||e.print_newline(!1),this._calcluate_parent_multiline(e,n)},p.prototype._calcluate_parent_multiline=function(e,t){!t.parent||!e._output.just_added_newline()||(t.is_inline_element||t.is_unformatted)&&t.parent.is_inline_element||(t.parent.multiline_content=!0)};var g=["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(e){var t=null;if(!e.is_empty_element&&e.is_start_tag&&e.parent){if("body"===e.tag_name)t=t||this._tag_stack.try_pop("head");else if("li"===e.tag_name)t=t||this._tag_stack.try_pop("li",["ol","ul","menu"]);else if("dd"===e.tag_name||"dt"===e.tag_name)t=(t=t||this._tag_stack.try_pop("dt",["dl"]))||this._tag_stack.try_pop("dd",["dl"]);else if("p"===e.parent.tag_name&&-1!==g.indexOf(e.tag_name)){var n=e.parent.parent;n&&-1!==m.indexOf(n.tag_name)||(t=t||this._tag_stack.try_pop("p"))}else"rp"===e.tag_name||"rt"===e.tag_name?t=(t=t||this._tag_stack.try_pop("rt",["ruby","rtc"]))||this._tag_stack.try_pop("rp",["ruby","rtc"]):"optgroup"===e.tag_name?t=t||this._tag_stack.try_pop("optgroup",["select"]):"option"===e.tag_name?t=t||this._tag_stack.try_pop("option",["select","datalist","optgroup"]):"colgroup"===e.tag_name?t=t||this._tag_stack.try_pop("caption",["table"]):"thead"===e.tag_name?t=(t=t||this._tag_stack.try_pop("caption",["table"]))||this._tag_stack.try_pop("colgroup",["table"]):"tbody"===e.tag_name||"tfoot"===e.tag_name?t=(t=(t=(t=t||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"===e.tag_name?t=(t=(t=t||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"!==e.tag_name&&"td"!==e.tag_name||(t=(t=t||this._tag_stack.try_pop("td",["table","thead","tbody","tfoot","tr"]))||this._tag_stack.try_pop("th",["table","thead","tbody","tfoot","tr"]));return e.parent=this._tag_stack.get_parser_token(),t}},e.exports.Beautifier=p},function(e,t,n){var i=n(6).Options;function r(e){i.call(this,e,"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,e.exports.Options=r},function(e,t,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(/<\!--/,/-->/),c=function(e,t){i.call(this,e,t),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)}};(c.prototype=new i)._is_comment=function(e){return!1},c.prototype._is_opening=function(e){return e.type===l.TAG_OPEN||e.type===l.CONTROL_FLOW_OPEN},c.prototype._is_closing=function(e,t){return e.type===l.TAG_CLOSE&&t&&((">"===e.text||"/>"===e.text)&&"<"===t.text[0]||"}}"===e.text&&"{"===t.text[0]&&"{"===t.text[1])||e.type===l.CONTROL_FLOW_CLOSE&&"}"===e.text&&t.text.endsWith("{")},c.prototype._reset=function(){this._current_tag_name=""},c.prototype._get_next_token=function(e,t){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,t))||this._read_attribute(i,e,t))||this._read_close(i,t))||this._read_script_and_style(i,e))||this._read_control_flows(i,t))||this._read_raw_content(i,e,t))||this._read_content_word(i,t))||this._read_comment_or_cdata(i))||this._read_processing(i))||this._read_open(i,t))||this._create_token(l.UNKNOWN,this._input.next())},c.prototype._read_comment_or_cdata=function(e){var t=null,n=null,i=null;"<"===e&&("!"===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&&((t=this._create_token(l.COMMENT,n)).directives=i));return t},c.prototype._read_processing=function(e){var t=null,n=null;if("<"===e){var i=this._input.peek(1);"!"!==i&&"?"!==i||(n=(n=this.__patterns.conditional_comment.read())||this.__patterns.processing.read()),n&&((t=this._create_token(l.COMMENT,n)).directives=null)}return t},c.prototype._read_open=function(e,t){var n=null,i=null;return t&&t.type!==l.CONTROL_FLOW_OPEN||"<"===e&&(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},c.prototype._read_open_handlebars=function(e,t){var n=null,i=null;return t&&t.type!==l.CONTROL_FLOW_OPEN||(this._options.templating.includes("angular")||this._options.indent_handlebars)&&"{"===e&&"{"===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},c.prototype._read_control_flows=function(e,t){var n="",i=null;if(!this._options.templating.includes("angular"))return i;if("@"===e){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"}"===e&&t&&t.type===l.CONTROL_FLOW_OPEN&&(n=this._input.next(),i=this._create_token(l.CONTROL_FLOW_CLOSE,n));return i},c.prototype._read_close=function(e,t){var n=null,i=null;return t&&t.type===l.TAG_OPEN&&("<"===t.text[0]&&(">"===e||"/"===e&&">"===this._input.peek(1))?(n=this._input.next(),"/"===e&&(n+=this._input.next()),i=this._create_token(l.TAG_CLOSE,n)):"{"===t.text[0]&&"}"===e&&"}"===this._input.peek(1)&&(this._input.next(),this._input.next(),i=this._create_token(l.TAG_CLOSE,"}}"))),i},c.prototype._read_attribute=function(e,t,n){var i=null,r="";if(n&&"<"===n.text[0])if("="===e)i=this._create_token(l.EQUALS,this._input.next());else if('"'===e||"'"===e){var s=this._input.next();s+='"'===e?this.__patterns.double_quote.read():this.__patterns.single_quote.read(),i=this._create_token(l.VALUE,s)}else(r=this.__patterns.attribute.read())&&(i=t.type===l.EQUALS?this._create_token(l.VALUE,r):this._create_token(l.ATTRIBUTE,r));return i},c.prototype._is_content_unformatted=function(e){return-1===this._options.void_elements.indexOf(e)&&(-1!==this._options.content_unformatted.indexOf(e)||-1!==this._options.unformatted.indexOf(e))},c.prototype._read_raw_content=function(e,t,n){var i="";if(n&&"{"===n.text[0])i=this.__patterns.handlebars_raw_close.read();else if(t.type===l.TAG_CLOSE&&"<"===t.opened.text[0]&&"/"!==t.text[0]){var r=t.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},c.prototype._read_script_and_style=function(e,t){if(t.type===l.TAG_CLOSE&&"<"===t.opened.text[0]&&"/"!==t.text[0]){var n=t.opened.text.substr(1).toLowerCase();if("script"===n||"style"===n){var i=this._read_comment_or_cdata(e);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},c.prototype._read_content_word=function(e,t){var n="";return this._options.unformatted_content_delimiter&&e===this._options.unformatted_content_delimiter[0]&&(n=this.__patterns.unformatted_content_delimiter.read()),n||(n=t&&t.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},e.exports.Tokenizer=c,e.exports.TOKEN=l}],t={};var n=function n(i){var r=t[i];if(void 0!==r)return r.exports;var s=t[i]={exports:{}};return e[i](s,s.exports,n),s.exports}(18);s=n}();var a=s;i=[n,n(58553),n(87804)],r=function(e){var t=n(58553),i=n(87804);return{html_beautify:function(e,n){return a(e,n,t.js_beautify,i.css_beautify)}}}.apply(t,i),void 0===r||(e.exports=r)}()},58553:function(e,t){var n;!function(){var i;!function(){"use strict";var e=[function(e,t,n){var i=n(1).Beautifier,r=n(5).Options;e.exports=function(e,t){return new i(e,t).beautify()},e.exports.defaultOptions=function(){return new r}},function(e,t,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,c=n(7).TOKEN;function h(e,t){return-1!==t.indexOf(e)}function d(e,t){return e&&e.type===c.RESERVED&&e.text===t}function f(e,t){return e&&e.type===c.RESERVED&&h(e.text,t)}var p=["case","return","do","if","throw","else","await","break","continue","async"],_=function(e){for(var t={},n=0;n<e.length;n++)t[e[n].replace(/-/g,"_")]=e[n];return t}(["before-newline","after-newline","preserve-newline"]),g=[_.before_newline,_.preserve_newline],m="BlockStatement",v="Statement",y="ObjectLiteral",b="ArrayLiteral",E="ForInitializer",w="Conditional",k="Expression";function S(e,t){t.multiline_frame||t.mode===E||t.mode===w||e.remove_indent(t.start_line_index)}function T(e){return e===b}function A(e){return h(e,[k,E,w])}function C(e,t){t=t||{},this._source_text=e||"",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(t)}C.prototype.create_flags=function(e,t){var n=0;return e&&(n=e.indentation_level,!this._output.just_added_newline()&&e.line_indent_level>n&&(n=e.line_indent_level)),{mode:t,parent:e,last_token:e?e.last_token:new r(c.START_BLOCK,""),last_word:e?e.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:e?e.line_indent_level:n,start_line_index:this._output.get_line_number(),ternary_depth:0}},C.prototype._reset=function(e){var t=e.match(/^[\t ]*/)[0];this._last_last_text="",this._output=new i(this._options,t),this._output.raw=this._options.test_output_raw,this._flag_store=[],this.set_mode(m);var n=new o(e,this._options);return this._tokens=n.tokenize(),e},C.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var e=this._reset(this._source_text),t=this._options.eol;"auto"===this._options.eol&&(t="\n",e&&s.lineBreak.test(e||"")&&(t=e.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(t)},C.prototype.handle_token=function(e,t){e.type===c.START_EXPR?this.handle_start_expr(e):e.type===c.END_EXPR?this.handle_end_expr(e):e.type===c.START_BLOCK?this.handle_start_block(e):e.type===c.END_BLOCK?this.handle_end_block(e):e.type===c.WORD||e.type===c.RESERVED?this.handle_word(e):e.type===c.SEMICOLON?this.handle_semicolon(e):e.type===c.STRING?this.handle_string(e):e.type===c.EQUALS?this.handle_equals(e):e.type===c.OPERATOR?this.handle_operator(e):e.type===c.COMMA?this.handle_comma(e):e.type===c.BLOCK_COMMENT?this.handle_block_comment(e,t):e.type===c.COMMENT?this.handle_comment(e,t):e.type===c.DOT?this.handle_dot(e):e.type===c.EOF?this.handle_eof(e):(e.type,c.UNKNOWN,this.handle_unknown(e,t))},C.prototype.handle_whitespace_and_comments=function(e,t){var n=e.newlines,i=this._options.keep_array_indentation&&T(this._flags.mode);if(e.comments_before)for(var r=e.comments_before.next();r;)this.handle_whitespace_and_comments(r,t),this.handle_token(r,t),r=e.comments_before.next();if(i)for(var s=0;s<n;s+=1)this.print_newline(s>0,t);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,t);for(var a=1;a<n;a+=1)this.print_newline(!0,t)}};var R=["async","break","continue","return","throw","yield"];C.prototype.allow_wrap_or_preserved_newline=function(e,t){if(t=void 0!==t&&t,!this._output.just_added_newline()){var n=this._options.preserve_newlines&&e.newlines||t;if(h(this._flags.last_token.text,u)||h(e.text,u)){var i=h(this._flags.last_token.text,u)&&h(this._options.operator_position,g)||h(e.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,R))return;this._output.set_wrap_point()}}},C.prototype.print_newline=function(e,t){if(!t&&";"!==this._flags.last_token.text&&","!==this._flags.last_token.text&&"="!==this._flags.last_token.text&&(this._flags.last_token.type!==c.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(e)&&(this._flags.multiline_frame=!0)},C.prototype.print_token_line_indentation=function(e){this._output.just_added_newline()&&(this._options.keep_array_indentation&&e.newlines&&("["===e.text||T(this._flags.mode))?(this._output.current_line.set_indent(-1),this._output.current_line.push(e.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))},C.prototype.print_token=function(e){if(this._output.raw)this._output.add_raw_token(e);else{if(this._options.comma_first&&e.previous&&e.previous.type===c.COMMA&&this._output.just_added_newline()&&","===this._output.previous_line.last()){var t=this._output.previous_line.pop();this._output.previous_line.is_empty()&&(this._output.previous_line.push(t),this._output.trim(!0),this._output.current_line.pop(),this._output.trim()),this.print_token_line_indentation(e),this._output.add_token(","),this._output.space_before_token=!0}this.print_token_line_indentation(e),this._output.non_breaking_space=!0,this._output.add_token(e.text),this._output.previous_token_wrapped&&(this._flags.multiline_frame=!0)}},C.prototype.indent=function(){this._flags.indentation_level+=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},C.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))},C.prototype.set_mode=function(e){this._flags?(this._flag_store.push(this._flags),this._previous_flags=this._flags):this._previous_flags=this.create_flags(null,e),this._flags=this.create_flags(this._previous_flags,e),this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},C.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&&S(this._output,this._previous_flags),this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},C.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"]))},C.prototype.start_of_statement=function(e){var t=!1;return!!(t=(t=(t=(t=(t=(t=(t=t||f(this._flags.last_token,["var","let","const"])&&e.type===c.WORD)||d(this._flags.last_token,"do"))||!(this._flags.parent.mode===y&&this._flags.mode===v)&&f(this._flags.last_token,R)&&!e.newlines)||d(this._flags.last_token,"else")&&!(d(e,"if")&&!e.comments_before))||this._flags.last_token.type===c.END_EXPR&&(this._previous_flags.mode===E||this._previous_flags.mode===w))||this._flags.last_token.type===c.WORD&&this._flags.mode===m&&!this._flags.in_case&&!("--"===e.text||"++"===e.text)&&"function"!==this._last_last_text&&e.type!==c.WORD&&e.type!==c.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(e,!0),this.start_of_object_property()||this.allow_wrap_or_preserved_newline(e,f(e,["do","for","if","while"])),!0)},C.prototype.handle_start_expr=function(e){this.start_of_statement(e)||this.handle_whitespace_and_comments(e);var t=k;if("["===e.text){if(this._flags.last_token.type===c.WORD||")"===this._flags.last_token.text)return f(this._flags.last_token,l)&&(this._output.space_before_token=!0),this.print_token(e),this.set_mode(t),this.indent(),void(this._options.space_in_paren&&(this._output.space_before_token=!0));t=b,T(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()),h(this._flags.last_token.type,[c.START_EXPR,c.END_EXPR,c.WORD,c.OPERATOR,c.DOT])||(this._output.space_before_token=!0)}else{if(this._flags.last_token.type===c.RESERVED)"for"===this._flags.last_token.text?(this._output.space_before_token=this._options.space_before_conditional,t=E):h(this._flags.last_token.text,["if","while","switch"])?(this._output.space_before_token=this._options.space_before_conditional,t=w):h(this._flags.last_word,["await","async"])?this._output.space_before_token=!0:"import"===this._flags.last_token.text&&""===e.whitespace_before?this._output.space_before_token=!1:(h(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===c.EQUALS||this._flags.last_token.type===c.OPERATOR)this.start_of_object_property()||this.allow_wrap_or_preserved_newline(e);else if(this._flags.last_token.type===c.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(e);(this._flags.last_token.type===c.RESERVED&&("function"===this._flags.last_word||"typeof"===this._flags.last_word)||"*"===this._flags.last_token.text&&(h(this._last_last_text,["function","yield"])||this._flags.mode===y&&h(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===c.START_BLOCK?this.print_newline():this._flags.last_token.type!==c.END_EXPR&&this._flags.last_token.type!==c.START_EXPR&&this._flags.last_token.type!==c.END_BLOCK&&"."!==this._flags.last_token.text&&this._flags.last_token.type!==c.COMMA||this.allow_wrap_or_preserved_newline(e,e.newlines),this.print_token(e),this.set_mode(t),this._options.space_in_paren&&(this._output.space_before_token=!0),this.indent()},C.prototype.handle_end_expr=function(e){for(;this._flags.mode===v;)this.restore_mode();this.handle_whitespace_and_comments(e),this._flags.multiline_frame&&this.allow_wrap_or_preserved_newline(e,"]"===e.text&&T(this._flags.mode)&&!this._options.keep_array_indentation),this._options.space_in_paren&&(this._flags.last_token.type!==c.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(e),this.restore_mode(),S(this._output,this._previous_flags),this._flags.do_while&&this._previous_flags.mode===w&&(this._previous_flags.mode=k,this._flags.do_block=!1,this._flags.do_while=!1)},C.prototype.handle_start_block=function(e){this.handle_whitespace_and_comments(e);var t=this._tokens.peek(),n=this._tokens.peek(1);"switch"===this._flags.last_word&&this._flags.last_token.type===c.END_EXPR?(this.set_mode(m),this._flags.in_case_statement=!0):this._flags.case_body?this.set_mode(m):n&&(h(n.text,[":",","])&&h(t.type,[c.STRING,c.WORD,c.RESERVED])||h(t.text,["get","set","..."])&&h(n.type,[c.WORD,c.RESERVED]))?h(this._last_last_text,["class","interface"])&&!h(n.text,[":",","])?this.set_mode(m):this.set_mode(y):this._flags.last_token.type===c.OPERATOR&&"=>"===this._flags.last_token.text?this.set_mode(m):h(this._flags.last_token.type,[c.EQUALS,c.START_EXPR,c.COMMA,c.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=!t.comments_before&&"}"===t.text,r=i&&"function"===this._flags.last_word&&this._flags.last_token.type===c.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!==c.EOF&&(a.type!==c.END_BLOCK||a.opened!==e))}("expand"===this._options.brace_style||"none"===this._options.brace_style&&e.newlines)&&!this._flags.inline_frame?this._flags.last_token.type!==c.OPERATOR&&(r||this._flags.last_token.type===c.EQUALS||f(this._flags.last_token,p)&&"else"!==this._flags.last_token.text)?this._output.space_before_token=!0:this.print_newline(!1,!0):(!T(this._previous_flags.mode)||this._flags.last_token.type!==c.START_EXPR&&this._flags.last_token.type!==c.COMMA||((this._flags.last_token.type===c.COMMA||this._options.space_in_paren)&&(this._output.space_before_token=!0),(this._flags.last_token.type===c.COMMA||this._flags.last_token.type===c.START_EXPR&&this._flags.inline_frame)&&(this.allow_wrap_or_preserved_newline(e),this._previous_flags.multiline_frame=this._previous_flags.multiline_frame||this._flags.multiline_frame,this._flags.multiline_frame=!1)),this._flags.last_token.type!==c.OPERATOR&&this._flags.last_token.type!==c.START_EXPR&&(h(this._flags.last_token.type,[c.START_BLOCK,c.SEMICOLON])&&!this._flags.inline_frame?this.print_newline():this._output.space_before_token=!0)),this.print_token(e),this.indent(),i||this._options.brace_preserve_inline&&this._flags.inline_frame||this.print_newline()},C.prototype.handle_end_block=function(e){for(this.handle_whitespace_and_comments(e);this._flags.mode===v;)this.restore_mode();var t=this._flags.last_token.type===c.START_BLOCK;this._flags.inline_frame&&!t?this._output.space_before_token=!0:"expand"===this._options.brace_style?t||this.print_newline():t||(T(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(e)},C.prototype.handle_word=function(e){if(e.type===c.RESERVED)if(h(e.text,["set","get"])&&this._flags.mode!==y)e.type=c.WORD;else if("import"===e.text&&h(this._tokens.peek().text,["(","."]))e.type=c.WORD;else if(h(e.text,["as","from"])&&!this._flags.import_block)e.type=c.WORD;else if(this._flags.mode===y){":"===this._tokens.peek().text&&(e.type=c.WORD)}if(this.start_of_statement(e)?f(this._flags.last_token,["var","let","const"])&&e.type===c.WORD&&(this._flags.declaration_statement=!0):!e.newlines||A(this._flags.mode)||this._flags.last_token.type===c.OPERATOR&&"--"!==this._flags.last_token.text&&"++"!==this._flags.last_token.text||this._flags.last_token.type===c.EQUALS||!this._options.preserve_newlines&&f(this._flags.last_token,["var","let","const","set","get"])?this.handle_whitespace_and_comments(e):(this.handle_whitespace_and_comments(e),this.print_newline()),this._flags.do_block&&!this._flags.do_while){if(d(e,"while"))return this._output.space_before_token=!0,this.print_token(e),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(e,"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(e,["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(e),void(this._flags.in_case=!0);if(this._flags.last_token.type!==c.COMMA&&this._flags.last_token.type!==c.START_EXPR&&this._flags.last_token.type!==c.EQUALS&&this._flags.last_token.type!==c.OPERATOR||this.start_of_object_property()||h(this._flags.last_token.text,["+","-"])&&":"===this._last_last_text&&this._flags.parent.mode===y||this.allow_wrap_or_preserved_newline(e),d(e,"function"))return(h(this._flags.last_token.text,["}",";"])||this._output.just_added_newline()&&!h(this._flags.last_token.text,["(","[","{",":","=",","])&&this._flags.last_token.type!==c.OPERATOR)&&(this._output.just_added_blankline()||e.comments_before||(this.print_newline(),this.print_newline(!0))),this._flags.last_token.type===c.RESERVED||this._flags.last_token.type===c.WORD?f(this._flags.last_token,["get","set","new","export"])||f(this._flags.last_token,R)||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===c.OPERATOR||"="===this._flags.last_token.text?this._output.space_before_token=!0:(this._flags.multiline_frame||!A(this._flags.mode)&&!T(this._flags.mode))&&this.print_newline(),this.print_token(e),void(this._flags.last_word=e.text);var t="NONE";(this._flags.last_token.type===c.END_BLOCK?this._previous_flags.inline_frame?t="SPACE":f(e,["else","catch","finally","from"])?"expand"===this._options.brace_style||"end-expand"===this._options.brace_style||"none"===this._options.brace_style&&e.newlines?t="NEWLINE":(t="SPACE",this._output.space_before_token=!0):t="NEWLINE":this._flags.last_token.type===c.SEMICOLON&&this._flags.mode===m?t="NEWLINE":this._flags.last_token.type===c.SEMICOLON&&A(this._flags.mode)?t="SPACE":this._flags.last_token.type===c.STRING?t="NEWLINE":this._flags.last_token.type===c.RESERVED||this._flags.last_token.type===c.WORD||"*"===this._flags.last_token.text&&(h(this._last_last_text,["function","yield"])||this._flags.mode===y&&h(this._last_last_text,["{",","]))?t="SPACE":this._flags.last_token.type===c.START_BLOCK?t=this._flags.inline_frame?"SPACE":"NEWLINE":this._flags.last_token.type===c.END_EXPR&&(this._output.space_before_token=!0,t="NEWLINE"),f(e,l)&&")"!==this._flags.last_token.text&&(t=this._flags.inline_frame||"else"===this._flags.last_token.text||"export"===this._flags.last_token.text?"SPACE":"NEWLINE"),f(e,["else","catch","finally"]))?(this._flags.last_token.type!==c.END_BLOCK||this._previous_flags.mode!==m||"expand"===this._options.brace_style||"end-expand"===this._options.brace_style||"none"===this._options.brace_style&&e.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"===t?f(this._flags.last_token,p)||"declare"===this._flags.last_token.text&&f(e,["var","let","const"])?this._output.space_before_token=!0:this._flags.last_token.type!==c.END_EXPR?this._flags.last_token.type===c.START_EXPR&&f(e,["var","let","const"])||":"===this._flags.last_token.text||(d(e,"if")&&d(e.previous,"else")?this._output.space_before_token=!0:this.print_newline()):f(e,l)&&")"!==this._flags.last_token.text&&this.print_newline():this._flags.multiline_frame&&T(this._flags.mode)&&","===this._flags.last_token.text&&"}"===this._last_last_text?this.print_newline():"SPACE"===t&&(this._output.space_before_token=!0);!e.previous||e.previous.type!==c.WORD&&e.previous.type!==c.RESERVED||(this._output.space_before_token=!0),this.print_token(e),this._flags.last_word=e.text,e.type===c.RESERVED&&("do"===e.text?this._flags.do_block=!0:"if"===e.text?this._flags.if_block=!0:"import"===e.text?this._flags.import_block=!0:this._flags.import_block&&d(e,"from")&&(this._flags.import_block=!1))},C.prototype.handle_semicolon=function(e){this.start_of_statement(e)?this._output.space_before_token=!1:this.handle_whitespace_and_comments(e);for(var t=this._tokens.peek();!(this._flags.mode!==v||this._flags.if_block&&d(t,"else")||this._flags.do_block);)this.restore_mode();this._flags.import_block&&(this._flags.import_block=!1),this.print_token(e)},C.prototype.handle_string=function(e){(!e.text.startsWith("`")||0!==e.newlines||""!==e.whitespace_before||")"!==e.previous.text&&this._flags.last_token.type!==c.WORD)&&(this.start_of_statement(e)?this._output.space_before_token=!0:(this.handle_whitespace_and_comments(e),this._flags.last_token.type===c.RESERVED||this._flags.last_token.type===c.WORD||this._flags.inline_frame?this._output.space_before_token=!0:this._flags.last_token.type===c.COMMA||this._flags.last_token.type===c.START_EXPR||this._flags.last_token.type===c.EQUALS||this._flags.last_token.type===c.OPERATOR?this.start_of_object_property()||this.allow_wrap_or_preserved_newline(e):!e.text.startsWith("`")||this._flags.last_token.type!==c.END_EXPR||"]"!==e.previous.text&&")"!==e.previous.text||0!==e.newlines?this.print_newline():this._output.space_before_token=!0)),this.print_token(e)},C.prototype.handle_equals=function(e){this.start_of_statement(e)||this.handle_whitespace_and_comments(e),this._flags.declaration_statement&&(this._flags.declaration_assignment=!0),this._output.space_before_token=!0,this.print_token(e),this._output.space_before_token=!0},C.prototype.handle_comma=function(e){this.handle_whitespace_and_comments(e,!0),this.print_token(e),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(e)):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(e)},C.prototype.handle_operator=function(e){var t="*"===e.text&&(f(this._flags.last_token,["function","yield"])||h(this._flags.last_token.type,[c.START_BLOCK,c.COMMA,c.END_BLOCK,c.SEMICOLON])),n=h(e.text,["-","+"])&&(h(this._flags.last_token.type,[c.START_BLOCK,c.START_EXPR,c.EQUALS,c.OPERATOR])||h(this._flags.last_token.text,l)||","===this._flags.last_token.text);if(this.start_of_statement(e));else{var i=!t;this.handle_whitespace_and_comments(e,i)}if("*"!==e.text||this._flags.last_token.type!==c.DOT)if("::"!==e.text)if(h(e.text,["-","+"])&&this.start_of_object_property())this.print_token(e);else{if(this._flags.last_token.type===c.OPERATOR&&h(this._options.operator_position,g)&&this.allow_wrap_or_preserved_newline(e),":"===e.text&&this._flags.in_case)return this.print_token(e),this._flags.in_case=!1,this._flags.case_body=!0,void(this._tokens.peek().type!==c.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(":"===e.text?0===this._flags.ternary_depth?r=!1:(this._flags.ternary_depth-=1,a=!0):"?"===e.text&&(this._flags.ternary_depth+=1),!n&&!t&&this._options.preserve_newlines&&h(e.text,u)){var o=":"===e.text,d=o&&a,y=o&&!a;switch(this._options.operator_position){case _.before_newline:return this._output.space_before_token=!y,this.print_token(e),o&&!d||this.allow_wrap_or_preserved_newline(e),void(this._output.space_before_token=!0);case _.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(e):this._output.space_before_token=!1,this.print_token(e),void(this._output.space_before_token=!0);case _.preserve_newline:return y||this.allow_wrap_or_preserved_newline(e),r=!(this._output.just_added_newline()||y),this._output.space_before_token=r,this.print_token(e),void(this._output.space_before_token=!0)}}if(t){this.allow_wrap_or_preserved_newline(e),r=!1;var b=this._tokens.peek();s=b&&h(b.type,[c.WORD,c.RESERVED])}else if("..."===e.text)this.allow_wrap_or_preserved_newline(e),r=this._flags.last_token.type===c.START_BLOCK,s=!1;else if(h(e.text,["--","++","!","~"])||n){if(this._flags.last_token.type!==c.COMMA&&this._flags.last_token.type!==c.START_EXPR||this.allow_wrap_or_preserved_newline(e),r=!1,s=!1,e.newlines&&("--"===e.text||"++"===e.text||"~"===e.text)){var E=f(this._flags.last_token,p)&&e.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===c.RESERVED?r=!0:this._flags.last_token.type===c.END_EXPR?r=!("]"===this._flags.last_token.text&&("--"===e.text||"++"===e.text)):this._flags.last_token.type===c.OPERATOR&&(r=h(e.text,["--","-","++","+"])&&h(this._flags.last_token.text,["--","-","++","+"]),h(e.text,["+","-"])&&h(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(e),this._output.space_before_token=s}else this.print_token(e);else this.print_token(e)},C.prototype.handle_block_comment=function(e,t){return this._output.raw?(this._output.add_raw_token(e),void(e.directives&&"end"===e.directives.preserve&&(this._output.raw=this._options.test_output_raw))):e.directives?(this.print_newline(!1,t),this.print_token(e),"start"===e.directives.preserve&&(this._output.raw=!0),void this.print_newline(!1,!0)):s.newline.test(e.text)||e.newlines?void this.print_block_commment(e,t):(this._output.space_before_token=!0,this.print_token(e),void(this._output.space_before_token=!0))},C.prototype.print_block_commment=function(e,t){var n,i=function(e){for(var t=[],n=(e=e.replace(s.allLineBreaks,"\n")).indexOf("\n");-1!==n;)t.push(e.substring(0,n)),n=(e=e.substring(n+1)).indexOf("\n");return e.length&&t.push(e),t}(e.text),r=!1,a=!1,o=e.whitespace_before,l=o.length;if(this.print_newline(!1,t),this.print_token_line_indentation(e),this._output.add_token(i[0]),this.print_newline(!1,t),i.length>1){for(r=function(e,t){for(var n=0;n<e.length;n++)if(e[n].trim().charAt(0)!==t)return!1;return!0}(i=i.slice(1),"*"),a=function(e,t){for(var n,i=0,r=e.length;i<r;i++)if((n=e[i])&&0!==n.indexOf(t))return!1;return!0}(i,o),r&&(this._flags.alignment=1),n=0;n<i.length;n++)r?(this.print_token_line_indentation(e),this._output.add_token(i[n].replace(/^\s+/g,""))):a&&i[n]?(this.print_token_line_indentation(e),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,t);this._flags.alignment=0}},C.prototype.handle_comment=function(e,t){e.newlines?this.print_newline(!1,t):this._output.trim(!0),this._output.space_before_token=!0,this.print_token(e),this.print_newline(!1,t)},C.prototype.handle_dot=function(e){this.start_of_statement(e)||this.handle_whitespace_and_comments(e,!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(e,")"===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(e)},C.prototype.handle_unknown=function(e,t){this.print_token(e),"\n"===e.text[e.text.length-1]&&this.print_newline(!1,t)},C.prototype.handle_eof=function(e){for(;this._flags.mode===v;)this.restore_mode();this.handle_whitespace_and_comments(e)},e.exports.Beautifier=C},function(e){function t(e){this.__parent=e,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(e,t){this.__cache=[""],this.__indent_size=e.indent_size,this.__indent_string=e.indent_char,e.indent_with_tabs||(this.__indent_string=new Array(e.indent_size+1).join(e.indent_char)),t=t||"",e.indent_level>0&&(t=new Array(e.indent_level+1).join(this.__indent_string)),this.__base_string=t,this.__base_string_length=t.length}function i(e,i){this.__indent_cache=new n(e,i),this.raw=!1,this._end_with_newline=e.end_with_newline,this.indent_size=e.indent_size,this.wrap_line_length=e.wrap_line_length,this.indent_empty_lines=e.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new t(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}t.prototype.clone_empty=function(){var e=new t(this.__parent);return e.set_indent(this.__indent_count,this.__alignment_count),e},t.prototype.item=function(e){return e<0?this.__items[this.__items.length+e]:this.__items[e]},t.prototype.has_match=function(e){for(var t=this.__items.length-1;t>=0;t--)if(this.__items[t].match(e))return!0;return!1},t.prototype.set_indent=function(e,t){this.is_empty()&&(this.__indent_count=e||0,this.__alignment_count=t||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},t.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)},t.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},t.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var e=this.__parent.current_line;return e.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),e.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),e.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count," "===e.__items[0]&&(e.__items.splice(0,1),e.__character_count-=1),!0}return!1},t.prototype.is_empty=function(){return 0===this.__items.length},t.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},t.prototype.push=function(e){this.__items.push(e);var t=e.lastIndexOf("\n");-1!==t?this.__character_count=e.length-t:this.__character_count+=e.length},t.prototype.pop=function(){var e=null;return this.is_empty()||(e=this.__items.pop(),this.__character_count-=e.length),e},t.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},t.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},t.prototype.trim=function(){for(;" "===this.last();)this.__items.pop(),this.__character_count-=1},t.prototype.toString=function(){var e="";return this.is_empty()?this.__parent.indent_empty_lines&&(e=this.__parent.get_indent_string(this.__indent_count)):(e=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),e+=this.__items.join("")),e},n.prototype.get_indent_size=function(e,t){var n=this.__base_string_length;return t=t||0,e<0&&(n=0),n+=e*this.__indent_size,n+=t},n.prototype.get_indent_string=function(e,t){var n=this.__base_string;return t=t||0,e<0&&(e=0,n=""),t+=e*this.__indent_size,this.__ensure_cache(t),n+=this.__cache[t]},n.prototype.__ensure_cache=function(e){for(;e>=this.__cache.length;)this.__add_column()},n.prototype.__add_column=function(){var e=this.__cache.length,t=0,n="";this.__indent_size&&e>=this.__indent_size&&(e-=(t=Math.floor(e/this.__indent_size))*this.__indent_size,n=new Array(t+1).join(this.__indent_string)),e&&(n+=new Array(e+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(e,t){return this.__indent_cache.get_indent_string(e,t)},i.prototype.get_indent_size=function(e,t){return this.__indent_cache.get_indent_size(e,t)},i.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},i.prototype.add_new_line=function(e){return!(this.is_empty()||!e&&this.just_added_newline())&&(this.raw||this.__add_outputline(),!0)},i.prototype.get_code=function(e){this.trim(!0);var t=this.current_line.pop();t&&("\n"===t[t.length-1]&&(t=t.replace(/\n+$/g,"")),this.current_line.push(t)),this._end_with_newline&&this.__add_outputline();var n=this.__lines.join("\n");return"\n"!==e&&(n=n.replace(/[\n]/g,e)),n},i.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},i.prototype.set_indent=function(e,t){return e=e||0,t=t||0,this.next_line.set_indent(e,t),this.__lines.length>1?(this.current_line.set_indent(e,t),!0):(this.current_line.set_indent(),!1)},i.prototype.add_raw_token=function(e){for(var t=0;t<e.newlines;t++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(e.whitespace_before),this.current_line.push(e.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},i.prototype.add_token=function(e){this.__add_space_before_token(),this.current_line.push(e),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(e){for(var t=this.__lines.length;e<t;)this.__lines[e]._remove_indent(),e++;this.current_line._remove_wrap_indent()},i.prototype.trim=function(e){for(e=void 0!==e&&e,this.current_line.trim();e&&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(e,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(e)&&r.item(-1)!==n){this.__lines.splice(i+1,0,new t(this)),this.previous_line=this.__lines[this.__lines.length-2];break}i--}},e.exports.Output=i},function(e){e.exports.Token=function(e,t,n,i){this.type=e,this.text=t,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(e,t){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+"])*";t.identifier=new RegExp(a+o,"g"),t.identifierStart=new RegExp(a),t.identifierMatch=new RegExp("(?:"+s+"|["+n+i+r+"])+");t.newline=/[\n\r\u2028\u2029]/,t.lineBreak=new RegExp("\r\n|"+t.newline.source),t.allLineBreaks=new RegExp(t.lineBreak.source,"g")},function(e,t,n){var i=n(6).Options,r=["before-newline","after-newline","preserve-newline"];function s(e){i.call(this,e,"js");var t=this.raw_options.brace_style||null;"expand-strict"===t?this.raw_options.brace_style="expand":"collapse-preserve-inline"===t?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,e.exports.Options=s},function(e){function t(e,t){this.raw_options=n(e,t),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(e,t){var n,r={};for(n in e=i(e))n!==t&&(r[n]=e[n]);if(t&&e[t])for(n in e[t])r[n]=e[t][n];return r}function i(e){var t,n={};for(t in e){n[t.replace(/-/g,"_")]=e[t]}return n}t.prototype._get_array=function(e,t){var n=this.raw_options[e],i=t||[];return"object"==typeof n?null!==n&&"function"==typeof n.concat&&(i=n.concat()):"string"==typeof n&&(i=n.split(/[^a-zA-Z0-9_\/\-]+/)),i},t.prototype._get_boolean=function(e,t){var n=this.raw_options[e];return void 0===n?!!t:!!n},t.prototype._get_characters=function(e,t){var n=this.raw_options[e],i=t||"";return"string"==typeof n&&(i=n.replace(/\\r/,"\r").replace(/\\n/,"\n").replace(/\\t/,"\t")),i},t.prototype._get_number=function(e,t){var n=this.raw_options[e];t=parseInt(t,10),isNaN(t)&&(t=0);var i=parseInt(n,10);return isNaN(i)&&(i=t),i},t.prototype._get_selection=function(e,t,n){var i=this._get_selection_list(e,t,n);if(1!==i.length)throw new Error("Invalid Option Value: The option '"+e+"' can only be one of the following values:\n"+t+"\nYou passed in: '"+this.raw_options[e]+"'");return i[0]},t.prototype._get_selection_list=function(e,t,n){if(!t||0===t.length)throw new Error("Selection list cannot be empty.");if(n=n||[t[0]],!this._is_valid_selection(n,t))throw new Error("Invalid Default Value!");var i=this._get_array(e,n);if(!this._is_valid_selection(i,t))throw new Error("Invalid Option Value: The option '"+e+"' can contain only the following values:\n"+t+"\nYou passed in: '"+this.raw_options[e]+"'");return i},t.prototype._is_valid_selection=function(e,t){return e.length&&t.length&&!e.some((function(e){return-1===t.indexOf(e)}))},e.exports.Options=t,e.exports.normalizeOpts=i,e.exports.mergeOpts=n},function(e,t,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 c(e,t){return-1!==t.indexOf(e)}var h={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]/,_=/[^\d\.]/,g=">>> === !== &&= ??= ||= << && >= ** != == <= >> || ?? |> < / - + > : & % ? ^ | *".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("|")+")$"),k=function(e,t){r.call(this,e,t),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(/[`}\\]/)}};(k.prototype=new r)._is_comment=function(e){return e.type===h.COMMENT||e.type===h.BLOCK_COMMENT||e.type===h.UNKNOWN},k.prototype._is_opening=function(e){return e.type===h.START_BLOCK||e.type===h.START_EXPR},k.prototype._is_closing=function(e,t){return(e.type===h.END_BLOCK||e.type===h.END_EXPR)&&t&&("]"===e.text&&"["===t.text||")"===e.text&&"("===t.text||"}"===e.text&&"{"===t.text)},k.prototype._reset=function(){v=!1},k.prototype._get_next_token=function(e,t){var n=null;this._readWhitespace();var i=this._input.peek();return null===i?this._create_token(h.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(e))||this._read_singles(i))||this._read_comment(i))||this._read_regexp(i,e))||this._read_xml(i,e))||this._read_punctuation())||this._create_token(h.UNKNOWN,this._input.next())},k.prototype._read_word=function(e){var t;return""!==(t=this.__patterns.identifier.read())?(t=t.replace(o.allLineBreaks,"\n"),e.type!==h.DOT&&(e.type!==h.RESERVED||"set"!==e.text&&"get"!==e.text)&&w.test(t)?"in"!==t&&"of"!==t||e.type!==h.WORD&&e.type!==h.STRING?this._create_token(h.RESERVED,t):this._create_token(h.OPERATOR,t):this._create_token(h.WORD,t)):""!==(t=this.__patterns.number.read())?this._create_token(h.WORD,t):void 0},k.prototype._read_singles=function(e){var t=null;return"("===e||"["===e?t=this._create_token(h.START_EXPR,e):")"===e||"]"===e?t=this._create_token(h.END_EXPR,e):"{"===e?t=this._create_token(h.START_BLOCK,e):"}"===e?t=this._create_token(h.END_BLOCK,e):";"===e?t=this._create_token(h.SEMICOLON,e):"."===e&&_.test(this._input.peek(1))?t=this._create_token(h.DOT,e):","===e&&(t=this._create_token(h.COMMA,e)),t&&this._input.next(),t},k.prototype._read_pair=function(e,t){var n=null;return"#"===e&&"{"===t&&(n=this._create_token(h.START_BLOCK,e+t)),n&&(this._input.next(),this._input.next()),n},k.prototype._read_punctuation=function(){var e=this.__patterns.punct.read();if(""!==e)return"="===e?this._create_token(h.EQUALS,e):"?."===e?this._create_token(h.DOT,e):this._create_token(h.OPERATOR,e)},k.prototype._read_non_javascript=function(e){var t="";if("#"===e){if(this._is_first_token()&&(t=this.__patterns.shebang.read()))return this._create_token(h.UNKNOWN,t.trim()+"\n");if(t=this.__patterns.include.read())return this._create_token(h.UNKNOWN,t.trim()+"\n");e=this._input.next();var n="#";if(this._input.hasNext()&&this._input.testChar(p)){do{n+=e=this._input.next()}while(this._input.hasNext()&&"#"!==e&&"="!==e);return"#"===e||("["===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(h.WORD,n)}this._input.back()}else if("<"===e&&this._is_first_token()){if(t=this.__patterns.html_comment_start.read()){for(;this._input.hasNext()&&!this._input.testChar(o.newline);)t+=this._input.next();return v=!0,this._create_token(h.COMMENT,t)}}else if(v&&"-"===e&&(t=this.__patterns.html_comment_end.read()))return v=!1,this._create_token(h.COMMENT,t);return null},k.prototype._read_comment=function(e){var t=null;if("/"===e){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"),(t=this._create_token(h.BLOCK_COMMENT,n)).directives=i}else"/"===this._input.peek(1)&&(n=this.__patterns.comment.read(),t=this._create_token(h.COMMENT,n))}return t},k.prototype._read_string=function(e){if("`"===e||"'"===e||'"'===e){var t=this._input.next();return this.has_char_escapes=!1,t+="`"===e?this._read_string_recursive("`",!0,"${"):this._read_string_recursive(e),this.has_char_escapes&&this._options.unescape_strings&&(t=function(e){var t="",n=0,r=new i(e),s=null;for(;r.hasNext();)if((s=r.match(/([\s]|[^\\]|\\\\)+/g))&&(t+=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()){t+="\\",r.hasNext()&&(t+=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 e;if((n=parseInt(s[1],16))>126&&n<=255&&0===s[0].indexOf("x"))return e;t+=n>=0&&n<32||n>1114111?"\\"+s[0]:34===n||39===n||92===n?"\\"+String.fromCharCode(n):String.fromCharCode(n)}return t}(t)),this._input.peek()===e&&(t+=this._input.next()),t=t.replace(o.allLineBreaks,"\n"),this._create_token(h.STRING,t)}return null},k.prototype._allow_regexp_or_xml=function(e){return e.type===h.RESERVED&&c(e.text,["return","case","throw","else","do","typeof","yield"])||e.type===h.END_EXPR&&")"===e.text&&e.opened.previous.type===h.RESERVED&&c(e.opened.previous.text,["if","while","for"])||c(e.type,[h.COMMENT,h.START_EXPR,h.START_BLOCK,h.START,h.END_BLOCK,h.OPERATOR,h.EQUALS,h.EOF,h.SEMICOLON,h.COMMA])},k.prototype._read_regexp=function(e,t){if("/"===e&&this._allow_regexp_or_xml(t)){for(var n=this._input.next(),i=!1,r=!1;this._input.hasNext()&&(i||r||this._input.peek()!==e)&&!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()===e&&(n+=this._input.next(),n+=this._input.read(o.identifier)),this._create_token(h.STRING,n)}return null},k.prototype._read_xml=function(e,t){if(this._options.e4x&&"<"===e&&this._allow_regexp_or_xml(t)){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(h.STRING,n)}}return null},k.prototype._read_string_recursive=function(e,t,n){var i,r;"'"===e?r=this.__patterns.single_quote:'"'===e?r=this.__patterns.double_quote:"`"===e?r=this.__patterns.template_text:"}"===e&&(r=this.__patterns.template_expression);for(var s=r.read(),a="";this._input.hasNext();){if((a=this._input.next())===e||!t&&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+="`"===e?this._read_string_recursive("}",t,"`"):this._read_string_recursive("`",t,"${"),this._input.hasNext()&&(a+=this._input.next()))),s+=a+=r.read()}return s},e.exports.Tokenizer=k,e.exports.TOKEN=h,e.exports.positionable_operators=g.slice(),e.exports.line_starters=b.slice()},function(e){var t=RegExp.prototype.hasOwnProperty("sticky");function n(e){this.__input=e||"",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 e=null;return this.hasNext()&&(e=this.__input.charAt(this.__position),this.__position+=1),e},n.prototype.peek=function(e){var t=null;return e=e||0,(e+=this.__position)>=0&&e<this.__input_length&&(t=this.__input.charAt(e)),t},n.prototype.__match=function(e,n){e.lastIndex=n;var i=e.exec(this.__input);return!i||t&&e.sticky||i.index!==n&&(i=null),i},n.prototype.test=function(e,t){return t=t||0,(t+=this.__position)>=0&&t<this.__input_length&&!!this.__match(e,t)},n.prototype.testChar=function(e,t){var n=this.peek(t);return e.lastIndex=0,null!==n&&e.test(n)},n.prototype.match=function(e){var t=this.__match(e,this.__position);return t?this.__position+=t[0].length:t=null,t},n.prototype.read=function(e,t,n){var i,r="";return e&&(i=this.match(e))&&(r+=i[0]),!t||!i&&e||(r+=this.readUntil(t,n)),r},n.prototype.readUntil=function(e,t){var n,i=this.__position;e.lastIndex=this.__position;var r=e.exec(this.__input);return r?(i=r.index,t&&(i+=r[0].length)):i=this.__input_length,n=this.__input.substring(this.__position,i),this.__position=i,n},n.prototype.readUntilAfter=function(e){return this.readUntil(e,!0)},n.prototype.get_regexp=function(e,n){var i=null,r="g";return n&&t&&(r="y"),"string"==typeof e&&""!==e?i=new RegExp(e,r):e&&(i=new RegExp(e.source,r)),i},n.prototype.get_literal_regexp=function(e){return RegExp(e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},n.prototype.peekUntilAfter=function(e){var t=this.__position,n=this.readUntilAfter(e);return this.__position=t,n},n.prototype.lookBack=function(e){var t=this.__position-1;return t>=e.length&&this.__input.substring(t-e.length,t).toLowerCase()===e},e.exports.InputScanner=n},function(e,t,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(e,t){this._input=new i(e),this._options=t||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new a(this._input)};l.prototype.tokenize=function(){var e;this._input.restart(),this.__tokens=new s,this._reset();for(var t=new r(o.START,""),n=null,i=[],a=new s;t.type!==o.EOF;){for(e=this._get_next_token(t,n);this._is_comment(e);)a.add(e),e=this._get_next_token(t,n);a.isEmpty()||(e.comments_before=a,a=new s),e.parent=n,this._is_opening(e)?(i.push(n),n=e):n&&this._is_closing(e,n)&&(e.opened=n,n.closed=e,n=i.pop(),e.parent=n),e.previous=t,t.next=e,this.__tokens.add(e),t=e}return this.__tokens},l.prototype._is_first_token=function(){return this.__tokens.isEmpty()},l.prototype._reset=function(){},l.prototype._get_next_token=function(e,t){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(e){return!1},l.prototype._is_opening=function(e){return!1},l.prototype._is_closing=function(e,t){return!1},l.prototype._create_token=function(e,t){return new r(e,t,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token)},l.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},e.exports.Tokenizer=l,e.exports.TOKEN=o},function(e){function t(e){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=e}t.prototype.restart=function(){this.__position=0},t.prototype.isEmpty=function(){return 0===this.__tokens_length},t.prototype.hasNext=function(){return this.__position<this.__tokens_length},t.prototype.next=function(){var e=null;return this.hasNext()&&(e=this.__tokens[this.__position],this.__position+=1),e},t.prototype.peek=function(e){var t=null;return e=e||0,(e+=this.__position)>=0&&e<this.__tokens_length&&(t=this.__tokens[e]),t},t.prototype.add=function(e){this.__parent_token&&(e.parent=this.__parent_token),this.__tokens.push(e),this.__tokens_length+=1},e.exports.TokenStream=t},function(e,t,n){var i=n(12).Pattern;function r(e,t){i.call(this,e,t),t?this._line_regexp=this._input.get_regexp(t._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}r.prototype=new i,r.prototype.__set_whitespace_patterns=function(e,t){e+="\\t ",t+="\\n\\r",this._match_pattern=this._input.get_regexp("["+e+t+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+t+"]")},r.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var e=this._input.read(this._match_pattern);if(" "===e)this.whitespace_before_token=" ";else if(e){var t=this.__split(this._newline_regexp,e);this.newline_count=t.length-1,this.whitespace_before_token=t[this.newline_count]}return e},r.prototype.matching=function(e,t){var n=this._create();return n.__set_whitespace_patterns(e,t),n._update(),n},r.prototype._create=function(){return new r(this._input,this)},r.prototype.__split=function(e,t){e.lastIndex=0;for(var n=0,i=[],r=e.exec(t);r;)i.push(t.substring(n,r.index)),n=r.index+r[0].length,r=e.exec(t);return n<t.length?i.push(t.substring(n,t.length)):i.push(""),i},e.exports.WhitespacePattern=r},function(e){function t(e,t){this._input=e,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,t&&(this._starting_pattern=this._input.get_regexp(t._starting_pattern,!0),this._match_pattern=this._input.get_regexp(t._match_pattern,!0),this._until_pattern=this._input.get_regexp(t._until_pattern),this._until_after=t._until_after)}t.prototype.read=function(){var e=this._input.read(this._starting_pattern);return this._starting_pattern&&!e||(e+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),e},t.prototype.read_match=function(){return this._input.match(this._match_pattern)},t.prototype.until_after=function(e){var t=this._create();return t._until_after=!0,t._until_pattern=this._input.get_regexp(e),t._update(),t},t.prototype.until=function(e){var t=this._create();return t._until_after=!1,t._until_pattern=this._input.get_regexp(e),t._update(),t},t.prototype.starting_with=function(e){var t=this._create();return t._starting_pattern=this._input.get_regexp(e,!0),t._update(),t},t.prototype.matching=function(e){var t=this._create();return t._match_pattern=this._input.get_regexp(e,!0),t._update(),t},t.prototype._create=function(){return new t(this._input,this)},t.prototype._update=function(){},e.exports.Pattern=t},function(e){function t(e,t){e="string"==typeof e?e:e.source,t="string"==typeof t?t:t.source,this.__directives_block_pattern=new RegExp(e+/ beautify( \w+[:]\w+)+ /.source+t,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(e+/\sbeautify\signore:end\s/.source+t,"g")}t.prototype.get_directives=function(e){if(!e.match(this.__directives_block_pattern))return null;var t={};this.__directive_pattern.lastIndex=0;for(var n=this.__directive_pattern.exec(e);n;)t[n[1]]=n[2],n=this.__directive_pattern.exec(e);return t},t.prototype.readIgnored=function(e){return e.readUntilAfter(this.__directives_end_ignore_pattern)},e.exports.Directives=t},function(e,t,n){var i=n(12).Pattern,r={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1,angular:!1};function s(e,t){i.call(this,e,t),this.__template_pattern=null,this._disabled=Object.assign({},r),this._excluded=Object.assign({},r),t&&(this.__template_pattern=this._input.get_regexp(t.__template_pattern),this._excluded=Object.assign(this._excluded,t._excluded),this._disabled=Object.assign(this._disabled,t._disabled));var n=new i(e);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(e){var t=this._create();return t._disabled[e]=!0,t._update(),t},s.prototype.read_options=function(e){var t=this._create();for(var n in r)t._disabled[n]=-1===e.templating.indexOf(n);return t._update(),t},s.prototype.exclude=function(e){var t=this._create();return t._excluded[e]=!0,t._update(),t},s.prototype.read=function(){var e="";e=this._match_pattern?this._input.read(this._starting_pattern):this._input.read(this._starting_pattern,this.__template_pattern);for(var t=this._read_template();t;)this._match_pattern?t+=this._input.read(this._match_pattern):t+=this._input.readUntil(this.__template_pattern),e+=t,t=this._read_template();return this._until_after&&(e+=this._input.readUntilAfter(this._until_pattern)),e},s.prototype.__set_templated_pattern=function(){var e=[];this._disabled.php||e.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||e.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.angular||e.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||e.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(e.push(this.__patterns.django._starting_pattern.source),e.push(this.__patterns.django_value._starting_pattern.source),e.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||e.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&e.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+e.join("|")+")")},s.prototype._read_template=function(){var e="",t=this._input.peek();if("<"===t){var n=this._input.peek(1);this._disabled.php||this._excluded.php||"?"!==n||(e=e||this.__patterns.php.read()),this._disabled.erb||this._excluded.erb||"%"!==n||(e=e||this.__patterns.erb.read())}else"{"===t&&(this._disabled.handlebars||this._excluded.handlebars||(e=(e=(e=e||this.__patterns.handlebars_comment.read())||this.__patterns.handlebars_unescaped.read())||this.__patterns.handlebars.read()),this._disabled.django||(this._excluded.django||this._excluded.handlebars||(e=e||this.__patterns.django_value.read()),this._excluded.django||(e=(e=e||this.__patterns.django_comment.read())||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(e=(e=(e=e||this.__patterns.smarty_comment.read())||this.__patterns.smarty_literal.read())||this.__patterns.smarty.read()));return e},e.exports.TemplatablePattern=s}],t={};var n=function n(i){var r=t[i];if(void 0!==r)return r.exports;var s=t[i]={exports:{}};return e[i](s,s.exports,n),s.exports}(0);i=n}();var r=i;void 0===(n=function(){return{js_beautify:r}}.apply(t,[]))||(e.exports=n)}()},75918:function(e,t,n){"use strict";n.d(t,{Wi:function(){return l},Z0:function(){return u},aU:function(){return o},eZ:function(){return h},wY:function(){return c}});var i=n(4348),r=n(69323),s=n(13268),a=function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function a(e){try{l(i.next(e))}catch(e){s(e)}}function o(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}l((i=i.apply(e,t||[])).next())}))};class o extends r.JT{constructor(e,t="",n="",r=!0,s){super(),this._onDidChange=this._register(new i.Q5),this.onDidChange=this._onDidChange.event,this._enabled=!0,this._id=e,this._label=t,this._cssClass=n,this._enabled=r,this._actionCallback=s}get id(){return this._id}get label(){return this._label}set label(e){this._setLabel(e)}_setLabel(e){this._label!==e&&(this._label=e,this._onDidChange.fire({label:e}))}get tooltip(){return this._tooltip||""}set tooltip(e){this._setTooltip(e)}_setTooltip(e){this._tooltip!==e&&(this._tooltip=e,this._onDidChange.fire({tooltip:e}))}get class(){return this._cssClass}set class(e){this._setClass(e)}_setClass(e){this._cssClass!==e&&(this._cssClass=e,this._onDidChange.fire({class:e}))}get enabled(){return this._enabled}set enabled(e){this._setEnabled(e)}_setEnabled(e){this._enabled!==e&&(this._enabled=e,this._onDidChange.fire({enabled:e}))}get checked(){return this._checked}set checked(e){this._setChecked(e)}_setChecked(e){this._checked!==e&&(this._checked=e,this._onDidChange.fire({checked:e}))}run(e,t){return a(this,void 0,void 0,(function*(){this._actionCallback&&(yield this._actionCallback(e))}))}}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(e,t){return a(this,void 0,void 0,(function*(){if(!e.enabled)return;let n;this._onBeforeRun.fire({action:e});try{yield this.runAction(e,t)}catch(e){n=e}this._onDidRun.fire({action:e,error:n})}))}runAction(e,t){return a(this,void 0,void 0,(function*(){yield e.run(t)}))}}class u extends o{constructor(e){super(u.ID,e,e?"separator text":"separator"),this.checked=!1,this.enabled=!1}}u.ID="vs.actions.separator";class c{constructor(e,t,n,i){this.tooltip="",this.enabled=!0,this.checked=!1,this.id=e,this.label=t,this.class=i,this._actions=n}get actions(){return this._actions}dispose(){}run(){return a(this,void 0,void 0,(function*(){}))}}class h extends o{constructor(){super(h.ID,s.N("submenu.empty","(empty)"),void 0,!1)}}h.ID="vs.actions.empty"},76068:function(e,t,n){"use strict";function i(e,t){if(!e)throw new Error(t?`Assertion failed (${t})`:"Assertion Failed")}n.d(t,{ok:function(){return i}})},52615:function(e,t,n){"use strict";n.d(t,{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(e){const t=this._icons.get(e.id);t?e.description?t.description=e.description:console.error(`Duplicate registration of codicon ${e.id}`):(this._icons.set(e.id,e),this._onDidRegister.fire(e))}get(e){return this._icons.get(e)}get all(){return this._icons.values()}get onDidRegister(){return this._onDidRegister.event}},s=r;function a(e,t){return new l(e,t)}function o(e){return e?e.replace(/\$\((.*?)\)/g,((e,t)=>` ${t} `)).trim():""}class l{constructor(e,t,n){this.id=e,this.definition=t,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(e){e.iconNameSegment="[A-Za-z0-9]+",e.iconNameExpression="[A-Za-z0-9\\-]+",e.iconModifierExpression="~[A-Za-z]+";const t=new RegExp(`^(${e.iconNameExpression})(${e.iconModifierExpression})?$`);function n(e){if(e instanceof l)return["codicon","codicon-"+e.id];const i=t.exec(e.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}e.asClassNameArray=n,e.asClassName=function(e){return n(e).join(" ")},e.asCSSSelector=function(e){return"."+n(e).join(".")}}(u||(u={})),function(e){e.add=new e("add",{fontCharacter:"\\ea60"}),e.plus=new e("plus",e.add.definition),e.gistNew=new e("gist-new",e.add.definition),e.repoCreate=new e("repo-create",e.add.definition),e.lightbulb=new e("lightbulb",{fontCharacter:"\\ea61"}),e.lightBulb=new e("light-bulb",{fontCharacter:"\\ea61"}),e.repo=new e("repo",{fontCharacter:"\\ea62"}),e.repoDelete=new e("repo-delete",{fontCharacter:"\\ea62"}),e.gistFork=new e("gist-fork",{fontCharacter:"\\ea63"}),e.repoForked=new e("repo-forked",{fontCharacter:"\\ea63"}),e.gitPullRequest=new e("git-pull-request",{fontCharacter:"\\ea64"}),e.gitPullRequestAbandoned=new e("git-pull-request-abandoned",{fontCharacter:"\\ea64"}),e.recordKeys=new e("record-keys",{fontCharacter:"\\ea65"}),e.keyboard=new e("keyboard",{fontCharacter:"\\ea65"}),e.tag=new e("tag",{fontCharacter:"\\ea66"}),e.tagAdd=new e("tag-add",{fontCharacter:"\\ea66"}),e.tagRemove=new e("tag-remove",{fontCharacter:"\\ea66"}),e.person=new e("person",{fontCharacter:"\\ea67"}),e.personFollow=new e("person-follow",{fontCharacter:"\\ea67"}),e.personOutline=new e("person-outline",{fontCharacter:"\\ea67"}),e.personFilled=new e("person-filled",{fontCharacter:"\\ea67"}),e.gitBranch=new e("git-branch",{fontCharacter:"\\ea68"}),e.gitBranchCreate=new e("git-branch-create",{fontCharacter:"\\ea68"}),e.gitBranchDelete=new e("git-branch-delete",{fontCharacter:"\\ea68"}),e.sourceControl=new e("source-control",{fontCharacter:"\\ea68"}),e.mirror=new e("mirror",{fontCharacter:"\\ea69"}),e.mirrorPublic=new e("mirror-public",{fontCharacter:"\\ea69"}),e.star=new e("star",{fontCharacter:"\\ea6a"}),e.starAdd=new e("star-add",{fontCharacter:"\\ea6a"}),e.starDelete=new e("star-delete",{fontCharacter:"\\ea6a"}),e.starEmpty=new e("star-empty",{fontCharacter:"\\ea6a"}),e.comment=new e("comment",{fontCharacter:"\\ea6b"}),e.commentAdd=new e("comment-add",{fontCharacter:"\\ea6b"}),e.alert=new e("alert",{fontCharacter:"\\ea6c"}),e.warning=new e("warning",{fontCharacter:"\\ea6c"}),e.search=new e("search",{fontCharacter:"\\ea6d"}),e.searchSave=new e("search-save",{fontCharacter:"\\ea6d"}),e.logOut=new e("log-out",{fontCharacter:"\\ea6e"}),e.signOut=new e("sign-out",{fontCharacter:"\\ea6e"}),e.logIn=new e("log-in",{fontCharacter:"\\ea6f"}),e.signIn=new e("sign-in",{fontCharacter:"\\ea6f"}),e.eye=new e("eye",{fontCharacter:"\\ea70"}),e.eyeUnwatch=new e("eye-unwatch",{fontCharacter:"\\ea70"}),e.eyeWatch=new e("eye-watch",{fontCharacter:"\\ea70"}),e.circleFilled=new e("circle-filled",{fontCharacter:"\\ea71"}),e.primitiveDot=new e("primitive-dot",{fontCharacter:"\\ea71"}),e.closeDirty=new e("close-dirty",{fontCharacter:"\\ea71"}),e.debugBreakpoint=new e("debug-breakpoint",{fontCharacter:"\\ea71"}),e.debugBreakpointDisabled=new e("debug-breakpoint-disabled",{fontCharacter:"\\ea71"}),e.debugHint=new e("debug-hint",{fontCharacter:"\\ea71"}),e.primitiveSquare=new e("primitive-square",{fontCharacter:"\\ea72"}),e.edit=new e("edit",{fontCharacter:"\\ea73"}),e.pencil=new e("pencil",{fontCharacter:"\\ea73"}),e.info=new e("info",{fontCharacter:"\\ea74"}),e.issueOpened=new e("issue-opened",{fontCharacter:"\\ea74"}),e.gistPrivate=new e("gist-private",{fontCharacter:"\\ea75"}),e.gitForkPrivate=new e("git-fork-private",{fontCharacter:"\\ea75"}),e.lock=new e("lock",{fontCharacter:"\\ea75"}),e.mirrorPrivate=new e("mirror-private",{fontCharacter:"\\ea75"}),e.close=new e("close",{fontCharacter:"\\ea76"}),e.removeClose=new e("remove-close",{fontCharacter:"\\ea76"}),e.x=new e("x",{fontCharacter:"\\ea76"}),e.repoSync=new e("repo-sync",{fontCharacter:"\\ea77"}),e.sync=new e("sync",{fontCharacter:"\\ea77"}),e.clone=new e("clone",{fontCharacter:"\\ea78"}),e.desktopDownload=new e("desktop-download",{fontCharacter:"\\ea78"}),e.beaker=new e("beaker",{fontCharacter:"\\ea79"}),e.microscope=new e("microscope",{fontCharacter:"\\ea79"}),e.vm=new e("vm",{fontCharacter:"\\ea7a"}),e.deviceDesktop=new e("device-desktop",{fontCharacter:"\\ea7a"}),e.file=new e("file",{fontCharacter:"\\ea7b"}),e.fileText=new e("file-text",{fontCharacter:"\\ea7b"}),e.more=new e("more",{fontCharacter:"\\ea7c"}),e.ellipsis=new e("ellipsis",{fontCharacter:"\\ea7c"}),e.kebabHorizontal=new e("kebab-horizontal",{fontCharacter:"\\ea7c"}),e.mailReply=new e("mail-reply",{fontCharacter:"\\ea7d"}),e.reply=new e("reply",{fontCharacter:"\\ea7d"}),e.organization=new e("organization",{fontCharacter:"\\ea7e"}),e.organizationFilled=new e("organization-filled",{fontCharacter:"\\ea7e"}),e.organizationOutline=new e("organization-outline",{fontCharacter:"\\ea7e"}),e.newFile=new e("new-file",{fontCharacter:"\\ea7f"}),e.fileAdd=new e("file-add",{fontCharacter:"\\ea7f"}),e.newFolder=new e("new-folder",{fontCharacter:"\\ea80"}),e.fileDirectoryCreate=new e("file-directory-create",{fontCharacter:"\\ea80"}),e.trash=new e("trash",{fontCharacter:"\\ea81"}),e.trashcan=new e("trashcan",{fontCharacter:"\\ea81"}),e.history=new e("history",{fontCharacter:"\\ea82"}),e.clock=new e("clock",{fontCharacter:"\\ea82"}),e.folder=new e("folder",{fontCharacter:"\\ea83"}),e.fileDirectory=new e("file-directory",{fontCharacter:"\\ea83"}),e.symbolFolder=new e("symbol-folder",{fontCharacter:"\\ea83"}),e.logoGithub=new e("logo-github",{fontCharacter:"\\ea84"}),e.markGithub=new e("mark-github",{fontCharacter:"\\ea84"}),e.github=new e("github",{fontCharacter:"\\ea84"}),e.terminal=new e("terminal",{fontCharacter:"\\ea85"}),e.console=new e("console",{fontCharacter:"\\ea85"}),e.repl=new e("repl",{fontCharacter:"\\ea85"}),e.zap=new e("zap",{fontCharacter:"\\ea86"}),e.symbolEvent=new e("symbol-event",{fontCharacter:"\\ea86"}),e.error=new e("error",{fontCharacter:"\\ea87"}),e.stop=new e("stop",{fontCharacter:"\\ea87"}),e.variable=new e("variable",{fontCharacter:"\\ea88"}),e.symbolVariable=new e("symbol-variable",{fontCharacter:"\\ea88"}),e.array=new e("array",{fontCharacter:"\\ea8a"}),e.symbolArray=new e("symbol-array",{fontCharacter:"\\ea8a"}),e.symbolModule=new e("symbol-module",{fontCharacter:"\\ea8b"}),e.symbolPackage=new e("symbol-package",{fontCharacter:"\\ea8b"}),e.symbolNamespace=new e("symbol-namespace",{fontCharacter:"\\ea8b"}),e.symbolObject=new e("symbol-object",{fontCharacter:"\\ea8b"}),e.symbolMethod=new e("symbol-method",{fontCharacter:"\\ea8c"}),e.symbolFunction=new e("symbol-function",{fontCharacter:"\\ea8c"}),e.symbolConstructor=new e("symbol-constructor",{fontCharacter:"\\ea8c"}),e.symbolBoolean=new e("symbol-boolean",{fontCharacter:"\\ea8f"}),e.symbolNull=new e("symbol-null",{fontCharacter:"\\ea8f"}),e.symbolNumeric=new e("symbol-numeric",{fontCharacter:"\\ea90"}),e.symbolNumber=new e("symbol-number",{fontCharacter:"\\ea90"}),e.symbolStructure=new e("symbol-structure",{fontCharacter:"\\ea91"}),e.symbolStruct=new e("symbol-struct",{fontCharacter:"\\ea91"}),e.symbolParameter=new e("symbol-parameter",{fontCharacter:"\\ea92"}),e.symbolTypeParameter=new e("symbol-type-parameter",{fontCharacter:"\\ea92"}),e.symbolKey=new e("symbol-key",{fontCharacter:"\\ea93"}),e.symbolText=new e("symbol-text",{fontCharacter:"\\ea93"}),e.symbolReference=new e("symbol-reference",{fontCharacter:"\\ea94"}),e.goToFile=new e("go-to-file",{fontCharacter:"\\ea94"}),e.symbolEnum=new e("symbol-enum",{fontCharacter:"\\ea95"}),e.symbolValue=new e("symbol-value",{fontCharacter:"\\ea95"}),e.symbolRuler=new e("symbol-ruler",{fontCharacter:"\\ea96"}),e.symbolUnit=new e("symbol-unit",{fontCharacter:"\\ea96"}),e.activateBreakpoints=new e("activate-breakpoints",{fontCharacter:"\\ea97"}),e.archive=new e("archive",{fontCharacter:"\\ea98"}),e.arrowBoth=new e("arrow-both",{fontCharacter:"\\ea99"}),e.arrowDown=new e("arrow-down",{fontCharacter:"\\ea9a"}),e.arrowLeft=new e("arrow-left",{fontCharacter:"\\ea9b"}),e.arrowRight=new e("arrow-right",{fontCharacter:"\\ea9c"}),e.arrowSmallDown=new e("arrow-small-down",{fontCharacter:"\\ea9d"}),e.arrowSmallLeft=new e("arrow-small-left",{fontCharacter:"\\ea9e"}),e.arrowSmallRight=new e("arrow-small-right",{fontCharacter:"\\ea9f"}),e.arrowSmallUp=new e("arrow-small-up",{fontCharacter:"\\eaa0"}),e.arrowUp=new e("arrow-up",{fontCharacter:"\\eaa1"}),e.bell=new e("bell",{fontCharacter:"\\eaa2"}),e.bold=new e("bold",{fontCharacter:"\\eaa3"}),e.book=new e("book",{fontCharacter:"\\eaa4"}),e.bookmark=new e("bookmark",{fontCharacter:"\\eaa5"}),e.debugBreakpointConditionalUnverified=new e("debug-breakpoint-conditional-unverified",{fontCharacter:"\\eaa6"}),e.debugBreakpointConditional=new e("debug-breakpoint-conditional",{fontCharacter:"\\eaa7"}),e.debugBreakpointConditionalDisabled=new e("debug-breakpoint-conditional-disabled",{fontCharacter:"\\eaa7"}),e.debugBreakpointDataUnverified=new e("debug-breakpoint-data-unverified",{fontCharacter:"\\eaa8"}),e.debugBreakpointData=new e("debug-breakpoint-data",{fontCharacter:"\\eaa9"}),e.debugBreakpointDataDisabled=new e("debug-breakpoint-data-disabled",{fontCharacter:"\\eaa9"}),e.debugBreakpointLogUnverified=new e("debug-breakpoint-log-unverified",{fontCharacter:"\\eaaa"}),e.debugBreakpointLog=new e("debug-breakpoint-log",{fontCharacter:"\\eaab"}),e.debugBreakpointLogDisabled=new e("debug-breakpoint-log-disabled",{fontCharacter:"\\eaab"}),e.briefcase=new e("briefcase",{fontCharacter:"\\eaac"}),e.broadcast=new e("broadcast",{fontCharacter:"\\eaad"}),e.browser=new e("browser",{fontCharacter:"\\eaae"}),e.bug=new e("bug",{fontCharacter:"\\eaaf"}),e.calendar=new e("calendar",{fontCharacter:"\\eab0"}),e.caseSensitive=new e("case-sensitive",{fontCharacter:"\\eab1"}),e.check=new e("check",{fontCharacter:"\\eab2"}),e.checklist=new e("checklist",{fontCharacter:"\\eab3"}),e.chevronDown=new e("chevron-down",{fontCharacter:"\\eab4"}),e.dropDownButton=new e("drop-down-button",e.chevronDown.definition),e.chevronLeft=new e("chevron-left",{fontCharacter:"\\eab5"}),e.chevronRight=new e("chevron-right",{fontCharacter:"\\eab6"}),e.chevronUp=new e("chevron-up",{fontCharacter:"\\eab7"}),e.chromeClose=new e("chrome-close",{fontCharacter:"\\eab8"}),e.chromeMaximize=new e("chrome-maximize",{fontCharacter:"\\eab9"}),e.chromeMinimize=new e("chrome-minimize",{fontCharacter:"\\eaba"}),e.chromeRestore=new e("chrome-restore",{fontCharacter:"\\eabb"}),e.circleOutline=new e("circle-outline",{fontCharacter:"\\eabc"}),e.debugBreakpointUnverified=new e("debug-breakpoint-unverified",{fontCharacter:"\\eabc"}),e.circleSlash=new e("circle-slash",{fontCharacter:"\\eabd"}),e.circuitBoard=new e("circuit-board",{fontCharacter:"\\eabe"}),e.clearAll=new e("clear-all",{fontCharacter:"\\eabf"}),e.clippy=new e("clippy",{fontCharacter:"\\eac0"}),e.closeAll=new e("close-all",{fontCharacter:"\\eac1"}),e.cloudDownload=new e("cloud-download",{fontCharacter:"\\eac2"}),e.cloudUpload=new e("cloud-upload",{fontCharacter:"\\eac3"}),e.code=new e("code",{fontCharacter:"\\eac4"}),e.collapseAll=new e("collapse-all",{fontCharacter:"\\eac5"}),e.colorMode=new e("color-mode",{fontCharacter:"\\eac6"}),e.commentDiscussion=new e("comment-discussion",{fontCharacter:"\\eac7"}),e.compareChanges=new e("compare-changes",{fontCharacter:"\\eafd"}),e.creditCard=new e("credit-card",{fontCharacter:"\\eac9"}),e.dash=new e("dash",{fontCharacter:"\\eacc"}),e.dashboard=new e("dashboard",{fontCharacter:"\\eacd"}),e.database=new e("database",{fontCharacter:"\\eace"}),e.debugContinue=new e("debug-continue",{fontCharacter:"\\eacf"}),e.debugDisconnect=new e("debug-disconnect",{fontCharacter:"\\ead0"}),e.debugPause=new e("debug-pause",{fontCharacter:"\\ead1"}),e.debugRestart=new e("debug-restart",{fontCharacter:"\\ead2"}),e.debugStart=new e("debug-start",{fontCharacter:"\\ead3"}),e.debugStepInto=new e("debug-step-into",{fontCharacter:"\\ead4"}),e.debugStepOut=new e("debug-step-out",{fontCharacter:"\\ead5"}),e.debugStepOver=new e("debug-step-over",{fontCharacter:"\\ead6"}),e.debugStop=new e("debug-stop",{fontCharacter:"\\ead7"}),e.debug=new e("debug",{fontCharacter:"\\ead8"}),e.deviceCameraVideo=new e("device-camera-video",{fontCharacter:"\\ead9"}),e.deviceCamera=new e("device-camera",{fontCharacter:"\\eada"}),e.deviceMobile=new e("device-mobile",{fontCharacter:"\\eadb"}),e.diffAdded=new e("diff-added",{fontCharacter:"\\eadc"}),e.diffIgnored=new e("diff-ignored",{fontCharacter:"\\eadd"}),e.diffModified=new e("diff-modified",{fontCharacter:"\\eade"}),e.diffRemoved=new e("diff-removed",{fontCharacter:"\\eadf"}),e.diffRenamed=new e("diff-renamed",{fontCharacter:"\\eae0"}),e.diff=new e("diff",{fontCharacter:"\\eae1"}),e.discard=new e("discard",{fontCharacter:"\\eae2"}),e.editorLayout=new e("editor-layout",{fontCharacter:"\\eae3"}),e.emptyWindow=new e("empty-window",{fontCharacter:"\\eae4"}),e.exclude=new e("exclude",{fontCharacter:"\\eae5"}),e.extensions=new e("extensions",{fontCharacter:"\\eae6"}),e.eyeClosed=new e("eye-closed",{fontCharacter:"\\eae7"}),e.fileBinary=new e("file-binary",{fontCharacter:"\\eae8"}),e.fileCode=new e("file-code",{fontCharacter:"\\eae9"}),e.fileMedia=new e("file-media",{fontCharacter:"\\eaea"}),e.filePdf=new e("file-pdf",{fontCharacter:"\\eaeb"}),e.fileSubmodule=new e("file-submodule",{fontCharacter:"\\eaec"}),e.fileSymlinkDirectory=new e("file-symlink-directory",{fontCharacter:"\\eaed"}),e.fileSymlinkFile=new e("file-symlink-file",{fontCharacter:"\\eaee"}),e.fileZip=new e("file-zip",{fontCharacter:"\\eaef"}),e.files=new e("files",{fontCharacter:"\\eaf0"}),e.filter=new e("filter",{fontCharacter:"\\eaf1"}),e.flame=new e("flame",{fontCharacter:"\\eaf2"}),e.foldDown=new e("fold-down",{fontCharacter:"\\eaf3"}),e.foldUp=new e("fold-up",{fontCharacter:"\\eaf4"}),e.fold=new e("fold",{fontCharacter:"\\eaf5"}),e.folderActive=new e("folder-active",{fontCharacter:"\\eaf6"}),e.folderOpened=new e("folder-opened",{fontCharacter:"\\eaf7"}),e.gear=new e("gear",{fontCharacter:"\\eaf8"}),e.gift=new e("gift",{fontCharacter:"\\eaf9"}),e.gistSecret=new e("gist-secret",{fontCharacter:"\\eafa"}),e.gist=new e("gist",{fontCharacter:"\\eafb"}),e.gitCommit=new e("git-commit",{fontCharacter:"\\eafc"}),e.gitCompare=new e("git-compare",{fontCharacter:"\\eafd"}),e.gitMerge=new e("git-merge",{fontCharacter:"\\eafe"}),e.githubAction=new e("github-action",{fontCharacter:"\\eaff"}),e.githubAlt=new e("github-alt",{fontCharacter:"\\eb00"}),e.globe=new e("globe",{fontCharacter:"\\eb01"}),e.grabber=new e("grabber",{fontCharacter:"\\eb02"}),e.graph=new e("graph",{fontCharacter:"\\eb03"}),e.gripper=new e("gripper",{fontCharacter:"\\eb04"}),e.heart=new e("heart",{fontCharacter:"\\eb05"}),e.home=new e("home",{fontCharacter:"\\eb06"}),e.horizontalRule=new e("horizontal-rule",{fontCharacter:"\\eb07"}),e.hubot=new e("hubot",{fontCharacter:"\\eb08"}),e.inbox=new e("inbox",{fontCharacter:"\\eb09"}),e.issueClosed=new e("issue-closed",{fontCharacter:"\\eba4"}),e.issueReopened=new e("issue-reopened",{fontCharacter:"\\eb0b"}),e.issues=new e("issues",{fontCharacter:"\\eb0c"}),e.italic=new e("italic",{fontCharacter:"\\eb0d"}),e.jersey=new e("jersey",{fontCharacter:"\\eb0e"}),e.json=new e("json",{fontCharacter:"\\eb0f"}),e.kebabVertical=new e("kebab-vertical",{fontCharacter:"\\eb10"}),e.key=new e("key",{fontCharacter:"\\eb11"}),e.law=new e("law",{fontCharacter:"\\eb12"}),e.lightbulbAutofix=new e("lightbulb-autofix",{fontCharacter:"\\eb13"}),e.linkExternal=new e("link-external",{fontCharacter:"\\eb14"}),e.link=new e("link",{fontCharacter:"\\eb15"}),e.listOrdered=new e("list-ordered",{fontCharacter:"\\eb16"}),e.listUnordered=new e("list-unordered",{fontCharacter:"\\eb17"}),e.liveShare=new e("live-share",{fontCharacter:"\\eb18"}),e.loading=new e("loading",{fontCharacter:"\\eb19"}),e.location=new e("location",{fontCharacter:"\\eb1a"}),e.mailRead=new e("mail-read",{fontCharacter:"\\eb1b"}),e.mail=new e("mail",{fontCharacter:"\\eb1c"}),e.markdown=new e("markdown",{fontCharacter:"\\eb1d"}),e.megaphone=new e("megaphone",{fontCharacter:"\\eb1e"}),e.mention=new e("mention",{fontCharacter:"\\eb1f"}),e.milestone=new e("milestone",{fontCharacter:"\\eb20"}),e.mortarBoard=new e("mortar-board",{fontCharacter:"\\eb21"}),e.move=new e("move",{fontCharacter:"\\eb22"}),e.multipleWindows=new e("multiple-windows",{fontCharacter:"\\eb23"}),e.mute=new e("mute",{fontCharacter:"\\eb24"}),e.noNewline=new e("no-newline",{fontCharacter:"\\eb25"}),e.note=new e("note",{fontCharacter:"\\eb26"}),e.octoface=new e("octoface",{fontCharacter:"\\eb27"}),e.openPreview=new e("open-preview",{fontCharacter:"\\eb28"}),e.package_=new e("package",{fontCharacter:"\\eb29"}),e.paintcan=new e("paintcan",{fontCharacter:"\\eb2a"}),e.pin=new e("pin",{fontCharacter:"\\eb2b"}),e.play=new e("play",{fontCharacter:"\\eb2c"}),e.run=new e("run",{fontCharacter:"\\eb2c"}),e.plug=new e("plug",{fontCharacter:"\\eb2d"}),e.preserveCase=new e("preserve-case",{fontCharacter:"\\eb2e"}),e.preview=new e("preview",{fontCharacter:"\\eb2f"}),e.project=new e("project",{fontCharacter:"\\eb30"}),e.pulse=new e("pulse",{fontCharacter:"\\eb31"}),e.question=new e("question",{fontCharacter:"\\eb32"}),e.quote=new e("quote",{fontCharacter:"\\eb33"}),e.radioTower=new e("radio-tower",{fontCharacter:"\\eb34"}),e.reactions=new e("reactions",{fontCharacter:"\\eb35"}),e.references=new e("references",{fontCharacter:"\\eb36"}),e.refresh=new e("refresh",{fontCharacter:"\\eb37"}),e.regex=new e("regex",{fontCharacter:"\\eb38"}),e.remoteExplorer=new e("remote-explorer",{fontCharacter:"\\eb39"}),e.remote=new e("remote",{fontCharacter:"\\eb3a"}),e.remove=new e("remove",{fontCharacter:"\\eb3b"}),e.replaceAll=new e("replace-all",{fontCharacter:"\\eb3c"}),e.replace=new e("replace",{fontCharacter:"\\eb3d"}),e.repoClone=new e("repo-clone",{fontCharacter:"\\eb3e"}),e.repoForcePush=new e("repo-force-push",{fontCharacter:"\\eb3f"}),e.repoPull=new e("repo-pull",{fontCharacter:"\\eb40"}),e.repoPush=new e("repo-push",{fontCharacter:"\\eb41"}),e.report=new e("report",{fontCharacter:"\\eb42"}),e.requestChanges=new e("request-changes",{fontCharacter:"\\eb43"}),e.rocket=new e("rocket",{fontCharacter:"\\eb44"}),e.rootFolderOpened=new e("root-folder-opened",{fontCharacter:"\\eb45"}),e.rootFolder=new e("root-folder",{fontCharacter:"\\eb46"}),e.rss=new e("rss",{fontCharacter:"\\eb47"}),e.ruby=new e("ruby",{fontCharacter:"\\eb48"}),e.saveAll=new e("save-all",{fontCharacter:"\\eb49"}),e.saveAs=new e("save-as",{fontCharacter:"\\eb4a"}),e.save=new e("save",{fontCharacter:"\\eb4b"}),e.screenFull=new e("screen-full",{fontCharacter:"\\eb4c"}),e.screenNormal=new e("screen-normal",{fontCharacter:"\\eb4d"}),e.searchStop=new e("search-stop",{fontCharacter:"\\eb4e"}),e.server=new e("server",{fontCharacter:"\\eb50"}),e.settingsGear=new e("settings-gear",{fontCharacter:"\\eb51"}),e.settings=new e("settings",{fontCharacter:"\\eb52"}),e.shield=new e("shield",{fontCharacter:"\\eb53"}),e.smiley=new e("smiley",{fontCharacter:"\\eb54"}),e.sortPrecedence=new e("sort-precedence",{fontCharacter:"\\eb55"}),e.splitHorizontal=new e("split-horizontal",{fontCharacter:"\\eb56"}),e.splitVertical=new e("split-vertical",{fontCharacter:"\\eb57"}),e.squirrel=new e("squirrel",{fontCharacter:"\\eb58"}),e.starFull=new e("star-full",{fontCharacter:"\\eb59"}),e.starHalf=new e("star-half",{fontCharacter:"\\eb5a"}),e.symbolClass=new e("symbol-class",{fontCharacter:"\\eb5b"}),e.symbolColor=new e("symbol-color",{fontCharacter:"\\eb5c"}),e.symbolConstant=new e("symbol-constant",{fontCharacter:"\\eb5d"}),e.symbolEnumMember=new e("symbol-enum-member",{fontCharacter:"\\eb5e"}),e.symbolField=new e("symbol-field",{fontCharacter:"\\eb5f"}),e.symbolFile=new e("symbol-file",{fontCharacter:"\\eb60"}),e.symbolInterface=new e("symbol-interface",{fontCharacter:"\\eb61"}),e.symbolKeyword=new e("symbol-keyword",{fontCharacter:"\\eb62"}),e.symbolMisc=new e("symbol-misc",{fontCharacter:"\\eb63"}),e.symbolOperator=new e("symbol-operator",{fontCharacter:"\\eb64"}),e.symbolProperty=new e("symbol-property",{fontCharacter:"\\eb65"}),e.wrench=new e("wrench",{fontCharacter:"\\eb65"}),e.wrenchSubaction=new e("wrench-subaction",{fontCharacter:"\\eb65"}),e.symbolSnippet=new e("symbol-snippet",{fontCharacter:"\\eb66"}),e.tasklist=new e("tasklist",{fontCharacter:"\\eb67"}),e.telescope=new e("telescope",{fontCharacter:"\\eb68"}),e.textSize=new e("text-size",{fontCharacter:"\\eb69"}),e.threeBars=new e("three-bars",{fontCharacter:"\\eb6a"}),e.thumbsdown=new e("thumbsdown",{fontCharacter:"\\eb6b"}),e.thumbsup=new e("thumbsup",{fontCharacter:"\\eb6c"}),e.tools=new e("tools",{fontCharacter:"\\eb6d"}),e.triangleDown=new e("triangle-down",{fontCharacter:"\\eb6e"}),e.triangleLeft=new e("triangle-left",{fontCharacter:"\\eb6f"}),e.triangleRight=new e("triangle-right",{fontCharacter:"\\eb70"}),e.triangleUp=new e("triangle-up",{fontCharacter:"\\eb71"}),e.twitter=new e("twitter",{fontCharacter:"\\eb72"}),e.unfold=new e("unfold",{fontCharacter:"\\eb73"}),e.unlock=new e("unlock",{fontCharacter:"\\eb74"}),e.unmute=new e("unmute",{fontCharacter:"\\eb75"}),e.unverified=new e("unverified",{fontCharacter:"\\eb76"}),e.verified=new e("verified",{fontCharacter:"\\eb77"}),e.versions=new e("versions",{fontCharacter:"\\eb78"}),e.vmActive=new e("vm-active",{fontCharacter:"\\eb79"}),e.vmOutline=new e("vm-outline",{fontCharacter:"\\eb7a"}),e.vmRunning=new e("vm-running",{fontCharacter:"\\eb7b"}),e.watch=new e("watch",{fontCharacter:"\\eb7c"}),e.whitespace=new e("whitespace",{fontCharacter:"\\eb7d"}),e.wholeWord=new e("whole-word",{fontCharacter:"\\eb7e"}),e.window=new e("window",{fontCharacter:"\\eb7f"}),e.wordWrap=new e("word-wrap",{fontCharacter:"\\eb80"}),e.zoomIn=new e("zoom-in",{fontCharacter:"\\eb81"}),e.zoomOut=new e("zoom-out",{fontCharacter:"\\eb82"}),e.listFilter=new e("list-filter",{fontCharacter:"\\eb83"}),e.listFlat=new e("list-flat",{fontCharacter:"\\eb84"}),e.listSelection=new e("list-selection",{fontCharacter:"\\eb85"}),e.selection=new e("selection",{fontCharacter:"\\eb85"}),e.listTree=new e("list-tree",{fontCharacter:"\\eb86"}),e.debugBreakpointFunctionUnverified=new e("debug-breakpoint-function-unverified",{fontCharacter:"\\eb87"}),e.debugBreakpointFunction=new e("debug-breakpoint-function",{fontCharacter:"\\eb88"}),e.debugBreakpointFunctionDisabled=new e("debug-breakpoint-function-disabled",{fontCharacter:"\\eb88"}),e.debugStackframeActive=new e("debug-stackframe-active",{fontCharacter:"\\eb89"}),e.debugStackframeDot=new e("debug-stackframe-dot",{fontCharacter:"\\eb8a"}),e.debugStackframe=new e("debug-stackframe",{fontCharacter:"\\eb8b"}),e.debugStackframeFocused=new e("debug-stackframe-focused",{fontCharacter:"\\eb8b"}),e.debugBreakpointUnsupported=new e("debug-breakpoint-unsupported",{fontCharacter:"\\eb8c"}),e.symbolString=new e("symbol-string",{fontCharacter:"\\eb8d"}),e.debugReverseContinue=new e("debug-reverse-continue",{fontCharacter:"\\eb8e"}),e.debugStepBack=new e("debug-step-back",{fontCharacter:"\\eb8f"}),e.debugRestartFrame=new e("debug-restart-frame",{fontCharacter:"\\eb90"}),e.callIncoming=new e("call-incoming",{fontCharacter:"\\eb92"}),e.callOutgoing=new e("call-outgoing",{fontCharacter:"\\eb93"}),e.menu=new e("menu",{fontCharacter:"\\eb94"}),e.expandAll=new e("expand-all",{fontCharacter:"\\eb95"}),e.feedback=new e("feedback",{fontCharacter:"\\eb96"}),e.groupByRefType=new e("group-by-ref-type",{fontCharacter:"\\eb97"}),e.ungroupByRefType=new e("ungroup-by-ref-type",{fontCharacter:"\\eb98"}),e.account=new e("account",{fontCharacter:"\\eb99"}),e.bellDot=new e("bell-dot",{fontCharacter:"\\eb9a"}),e.debugConsole=new e("debug-console",{fontCharacter:"\\eb9b"}),e.library=new e("library",{fontCharacter:"\\eb9c"}),e.output=new e("output",{fontCharacter:"\\eb9d"}),e.runAll=new e("run-all",{fontCharacter:"\\eb9e"}),e.syncIgnored=new e("sync-ignored",{fontCharacter:"\\eb9f"}),e.pinned=new e("pinned",{fontCharacter:"\\eba0"}),e.githubInverted=new e("github-inverted",{fontCharacter:"\\eba1"}),e.debugAlt=new e("debug-alt",{fontCharacter:"\\eb91"}),e.serverProcess=new e("server-process",{fontCharacter:"\\eba2"}),e.serverEnvironment=new e("server-environment",{fontCharacter:"\\eba3"}),e.pass=new e("pass",{fontCharacter:"\\eba4"}),e.stopCircle=new e("stop-circle",{fontCharacter:"\\eba5"}),e.playCircle=new e("play-circle",{fontCharacter:"\\eba6"}),e.record=new e("record",{fontCharacter:"\\eba7"}),e.debugAltSmall=new e("debug-alt-small",{fontCharacter:"\\eba8"}),e.vmConnect=new e("vm-connect",{fontCharacter:"\\eba9"}),e.cloud=new e("cloud",{fontCharacter:"\\ebaa"}),e.merge=new e("merge",{fontCharacter:"\\ebab"}),e.exportIcon=new e("export",{fontCharacter:"\\ebac"}),e.graphLeft=new e("graph-left",{fontCharacter:"\\ebad"}),e.magnet=new e("magnet",{fontCharacter:"\\ebae"}),e.notebook=new e("notebook",{fontCharacter:"\\ebaf"}),e.redo=new e("redo",{fontCharacter:"\\ebb0"}),e.checkAll=new e("check-all",{fontCharacter:"\\ebb1"}),e.pinnedDirty=new e("pinned-dirty",{fontCharacter:"\\ebb2"}),e.passFilled=new e("pass-filled",{fontCharacter:"\\ebb3"}),e.circleLargeFilled=new e("circle-large-filled",{fontCharacter:"\\ebb4"}),e.circleLargeOutline=new e("circle-large-outline",{fontCharacter:"\\ebb5"}),e.combine=new e("combine",{fontCharacter:"\\ebb6"}),e.gather=new e("gather",{fontCharacter:"\\ebb6"}),e.table=new e("table",{fontCharacter:"\\ebb7"}),e.variableGroup=new e("variable-group",{fontCharacter:"\\ebb8"}),e.typeHierarchy=new e("type-hierarchy",{fontCharacter:"\\ebb9"}),e.typeHierarchySub=new e("type-hierarchy-sub",{fontCharacter:"\\ebba"}),e.typeHierarchySuper=new e("type-hierarchy-super",{fontCharacter:"\\ebbb"}),e.gitPullRequestCreate=new e("git-pull-request-create",{fontCharacter:"\\ebbc"}),e.runAbove=new e("run-above",{fontCharacter:"\\ebbd"}),e.runBelow=new e("run-below",{fontCharacter:"\\ebbe"}),e.notebookTemplate=new e("notebook-template",{fontCharacter:"\\ebbf"}),e.debugRerun=new e("debug-rerun",{fontCharacter:"\\ebc0"}),e.workspaceTrusted=new e("workspace-trusted",{fontCharacter:"\\ebc1"}),e.workspaceUntrusted=new e("workspace-untrusted",{fontCharacter:"\\ebc2"}),e.workspaceUnspecified=new e("workspace-unspecified",{fontCharacter:"\\ebc3"}),e.terminalCmd=new e("terminal-cmd",{fontCharacter:"\\ebc4"}),e.terminalDebian=new e("terminal-debian",{fontCharacter:"\\ebc5"}),e.terminalLinux=new e("terminal-linux",{fontCharacter:"\\ebc6"}),e.terminalPowershell=new e("terminal-powershell",{fontCharacter:"\\ebc7"}),e.terminalTmux=new e("terminal-tmux",{fontCharacter:"\\ebc8"}),e.terminalUbuntu=new e("terminal-ubuntu",{fontCharacter:"\\ebc9"}),e.terminalBash=new e("terminal-bash",{fontCharacter:"\\ebca"}),e.arrowSwap=new e("arrow-swap",{fontCharacter:"\\ebcb"}),e.copy=new e("copy",{fontCharacter:"\\ebcc"}),e.personAdd=new e("person-add",{fontCharacter:"\\ebcd"}),e.filterFilled=new e("filter-filled",{fontCharacter:"\\ebce"}),e.wand=new e("wand",{fontCharacter:"\\ebcf"}),e.debugLineByLine=new e("debug-line-by-line",{fontCharacter:"\\ebd0"}),e.inspect=new e("inspect",{fontCharacter:"\\ebd1"}),e.layers=new e("layers",{fontCharacter:"\\ebd2"}),e.layersDot=new e("layers-dot",{fontCharacter:"\\ebd3"}),e.layersActive=new e("layers-active",{fontCharacter:"\\ebd4"}),e.compass=new e("compass",{fontCharacter:"\\ebd5"}),e.compassDot=new e("compass-dot",{fontCharacter:"\\ebd6"}),e.compassActive=new e("compass-active",{fontCharacter:"\\ebd7"}),e.azure=new e("azure",{fontCharacter:"\\ebd8"}),e.issueDraft=new e("issue-draft",{fontCharacter:"\\ebd9"}),e.gitPullRequestClosed=new e("git-pull-request-closed",{fontCharacter:"\\ebda"}),e.gitPullRequestDraft=new e("git-pull-request-draft",{fontCharacter:"\\ebdb"}),e.debugAll=new e("debug-all",{fontCharacter:"\\ebdc"}),e.debugCoverage=new e("debug-coverage",{fontCharacter:"\\ebdd"}),e.runErrors=new e("run-errors",{fontCharacter:"\\ebde"}),e.folderLibrary=new e("folder-library",{fontCharacter:"\\ebdf"}),e.debugContinueSmall=new e("debug-continue-small",{fontCharacter:"\\ebe0"}),e.beakerStop=new e("beaker-stop",{fontCharacter:"\\ebe1"}),e.graphLine=new e("graph-line",{fontCharacter:"\\ebe2"}),e.graphScatter=new e("graph-scatter",{fontCharacter:"\\ebe3"}),e.pieChart=new e("pie-chart",{fontCharacter:"\\ebe4"}),e.bracket=new e("bracket",e.json.definition),e.bracketDot=new e("bracket-dot",{fontCharacter:"\\ebe5"}),e.bracketError=new e("bracket-error",{fontCharacter:"\\ebe6"}),e.lockSmall=new e("lock-small",{fontCharacter:"\\ebe7"}),e.azureDevops=new e("azure-devops",{fontCharacter:"\\ebe8"}),e.verifiedFilled=new e("verified-filled",{fontCharacter:"\\ebe9"})}(l||(l={}))},79881:function(e,t,n){"use strict";n.d(t,{B8:function(){return d},Cp:function(){return s},F0:function(){return u},L6:function(){return h},VV:function(){return l},b1:function(){return c},dL:function(){return r},ri:function(){return a}});const i=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout((()=>{if(e.stack)throw new Error(e.message+"\n\n"+e.stack);throw e}),0)}}emit(e){this.listeners.forEach((t=>{t(e)}))}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}};function r(e){l(e)||i.onUnexpectedError(e)}function s(e){l(e)||i.onUnexpectedExternalError(e)}function a(e){if(e instanceof Error){let{name:t,message:n}=e;return{$isError:!0,name:t,message:n,stack:e.stacktrace||e.stack}}return e}const o="Canceled";function l(e){return e instanceof Error&&e.name===o&&e.message===o}function u(){const e=new Error(o);return e.name=e.message,e}function c(e){return e?new Error(`Illegal argument: ${e}`):new Error("Illegal argument")}function h(e){return e?new Error(`Illegal state: ${e}`):new Error("Illegal state")}class d extends Error{constructor(e){super("NotSupported"),e&&(this.message=e)}}},4348:function(e,t,n){"use strict";n.d(t,{D0:function(){return h},E7:function(){return d},K3:function(){return c},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(e){function t(e){return(t,n=null,i)=>{let r,s=!1;return r=e((e=>{if(!s)return r?r.dispose():s=!0,t.call(n,e)}),null,i),s&&r.dispose(),r}}function n(e,t){return o(((n,i=null,r)=>e((e=>n.call(i,t(e))),null,r)))}function i(e,t){return o(((n,i=null,r)=>e((e=>{t(e),n.call(i,e)}),null,r)))}function r(e,t){return o(((n,i=null,r)=>e((e=>t(e)&&n.call(i,e)),null,r)))}function a(e,t,i){let r=i;return n(e,(e=>(r=t(r,e),r)))}function o(e){let t;const n=new u({onFirstListenerAdd(){t=e(n.fire,n)},onLastListenerRemove(){t.dispose()}});return n.event}function l(e,t,n=100,i=!1,r){let s,a,o,l=0;const c=new u({leakWarningThreshold:r,onFirstListenerAdd(){s=e((e=>{l++,a=t(a,e),i&&!o&&(c.fire(a),a=void 0),clearTimeout(o),o=setTimeout((()=>{const e=a;a=void 0,o=void 0,(!i||l>1)&&c.fire(e),l=0}),n)}))},onLastListenerRemove(){s.dispose()}});return c.event}function c(e,t=((e,t)=>e===t)){let n,i=!0;return r(e,(e=>{const r=i||!t(e,n);return i=!1,n=e,r}))}e.None=()=>s.JT.None,e.once=t,e.map=n,e.forEach=i,e.filter=r,e.signal=function(e){return e},e.any=function(...e){return(t,n=null,i)=>(0,s.F8)(...e.map((e=>e((e=>t.call(n,e)),null,i))))},e.reduce=a,e.debounce=l,e.latch=c,e.split=function(t,n){return[e.filter(t,n),e.filter(t,(e=>!n(e)))]},e.buffer=function(e,t=!1,n=[]){let i=n.slice(),r=e((e=>{i?i.push(e):a.fire(e)}));const s=()=>{i&&i.forEach((e=>a.fire(e))),i=null},a=new u({onFirstListenerAdd(){r||(r=e((e=>a.fire(e))))},onFirstListenerDidAdd(){i&&(t?setTimeout(s):s())},onLastListenerRemove(){r&&r.dispose(),r=null}});return a.event};class h{constructor(e){this.event=e}map(e){return new h(n(this.event,e))}forEach(e){return new h(i(this.event,e))}filter(e){return new h(r(this.event,e))}reduce(e,t){return new h(a(this.event,e,t))}latch(){return new h(c(this.event))}debounce(e,t=100,n=!1,i){return new h(l(this.event,e,t,n,i))}on(e,t,n){return this.event(e,t,n)}once(e,n,i){return t(this.event)(e,n,i)}}e.chain=function(e){return new h(e)},e.fromNodeEventEmitter=function(e,t,n=(e=>e)){const i=(...e)=>r.fire(n(...e)),r=new u({onFirstListenerAdd:()=>e.on(t,i),onLastListenerRemove:()=>e.removeListener(t,i)});return r.event},e.fromDOMEventEmitter=function(e,t,n=(e=>e)){const i=(...e)=>r.fire(n(...e)),r=new u({onFirstListenerAdd:()=>e.addEventListener(t,i),onLastListenerRemove:()=>e.removeEventListener(t,i)});return r.event},e.toPromise=function(e){return new Promise((n=>t(e)(n)))}}(i||(i={}));class l{constructor(e){this._listenerCount=0,this._invocationCount=0,this._elapsedOverall=0,this._name=`${e}_${l._idPool++}`}start(e){this._stopWatch=new o.G(!0),this._listenerCount=e}stop(){if(this._stopWatch){const e=this._stopWatch.elapsed();this._elapsedOverall+=e,this._invocationCount+=1,console.info(`did FIRE ${this._name}: elapsed_ms: ${e.toFixed(5)}, listener: ${this._listenerCount} (elapsed_overall: ${this._elapsedOverall.toFixed(2)}, invocations: ${this._invocationCount})`),this._stopWatch=void 0}}}l._idPool=0;class u{constructor(e){var t;this._disposed=!1,this._options=e,this._leakageMon=void 0,this._perfMon=(null===(t=this._options)||void 0===t?void 0:t._profName)?new l(this._options._profName):void 0}get event(){return this._event||(this._event=(e,t,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(t?[e,t]:e);r&&this._options&&this._options.onFirstListenerDidAdd&&this._options.onFirstListenerDidAdd(this),this._options&&this._options.onListenerDidAdd&&this._options.onListenerDidAdd(this,e,t);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(e){var t,n;if(this._listeners){this._deliveryQueue||(this._deliveryQueue=new a.S);for(let t of this._listeners)this._deliveryQueue.push([t,e]);for(null===(t=this._perfMon)||void 0===t||t.start(this._deliveryQueue.size);this._deliveryQueue.size>0;){const[e,t]=this._deliveryQueue.shift();try{"function"==typeof e?e.call(void 0,t):e[0].call(e[1],t)}catch(e){(0,r.dL)(e)}}null===(n=this._perfMon)||void 0===n||n.stop()}}dispose(){var e,t,n,i,r;this._disposed||(this._disposed=!0,null===(e=this._listeners)||void 0===e||e.clear(),null===(t=this._deliveryQueue)||void 0===t||t.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 c extends u{constructor(e){super(e),this._isPaused=0,this._eventQueue=new a.S,this._mergeFn=null==e?void 0:e.merge}pause(){this._isPaused++}resume(){if(0!==this._isPaused&&0==--this._isPaused)if(this._mergeFn){const e=Array.from(this._eventQueue);this._eventQueue.clear(),super.fire(this._mergeFn(e))}else for(;!this._isPaused&&0!==this._eventQueue.size;)super.fire(this._eventQueue.shift())}fire(e){this._listeners&&(0!==this._isPaused?this._eventQueue.push(e):super.fire(e))}}class h extends c{constructor(e){var t;super(e),this._delay=null!==(t=e.delay)&&void 0!==t?t:100}fire(e){this._handle||(this.pause(),this._handle=setTimeout((()=>{this._handle=void 0,this.resume()}),this._delay)),super.fire(e)}}class d{constructor(){this.buffers=[]}wrapEvent(e){return(t,n,i)=>e((e=>{const i=this.buffers[this.buffers.length-1];i?i.push((()=>t.call(n,e))):t.call(n,e)}),void 0,i)}bufferEvents(e){const t=[];this.buffers.push(t);const n=e();return this.buffers.pop(),t.forEach((e=>e())),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(e){this.inputEvent=e,this.listening&&(this.inputEventListener.dispose(),this.inputEventListener=e(this.emitter.fire,this.emitter))}dispose(){this.inputEventListener.dispose(),this.emitter.dispose()}}},17845:function(e,t,n){"use strict";function i(e){const t=this;let n,i=!1;return function(){return i||(i=!0,n=e.apply(t,arguments)),n}}n.d(t,{I:function(){return i}})},88226:function(e,t,n){"use strict";var i;n.d(t,{$:function(){return i}}),function(e){e.is=function(e){return e&&"object"==typeof e&&"function"==typeof e[Symbol.iterator]};const t=Object.freeze([]);e.empty=function(){return t},e.single=function*(e){yield e},e.from=function(e){return e||t},e.isEmpty=function(e){return!e||!0===e[Symbol.iterator]().next().done},e.first=function(e){return e[Symbol.iterator]().next().value},e.some=function(e,t){for(const n of e)if(t(n))return!0;return!1},e.find=function(e,t){for(const n of e)if(t(n))return n},e.filter=function*(e,t){for(const n of e)t(n)&&(yield n)},e.map=function*(e,t){let n=0;for(const i of e)yield t(i,n++)},e.concat=function*(...e){for(const t of e)for(const e of t)yield e},e.concatNested=function*(e){for(const t of e)for(const e of t)yield e},e.reduce=function(e,t,n){let i=n;for(const n of e)i=t(i,n);return i},e.slice=function*(e,t,n=e.length){for(t<0&&(t+=e.length),n<0?n+=e.length:n>e.length&&(n=e.length);t<n;t++)yield e[t]},e.consume=function(t,n=Number.POSITIVE_INFINITY){const i=[];if(0===n)return[i,t];const r=t[Symbol.iterator]();for(let t=0;t<n;t++){const t=r.next();if(t.done)return[i,e.empty()];i.push(t.value)}return[i,{[Symbol.iterator](){return r}}]},e.equals=function(e,t,n=((e,t)=>e===t)){const i=e[Symbol.iterator](),r=t[Symbol.iterator]();for(;;){const e=i.next(),t=r.next();if(e.done!==t.done)return!1;if(e.done)return!0;if(!n(e.value,t.value))return!1}}}(i||(i={}))},69323:function(e,t,n){"use strict";n.d(t,{B9:function(){return d},F8:function(){return f},JT:function(){return g},Jz:function(){return v},OF:function(){return p},SL:function(){return _},Wf:function(){return h},XK:function(){return m},dk:function(){return u}});var i=n(17845),r=n(88226);let s=null;function a(e){return null==s||s.trackDisposable(e),e}function o(e){null==s||s.markAsDisposed(e)}function l(e,t){null==s||s.setParent(e,t)}function u(e){return null==s||s.markAsSingleton(e),e}class c extends Error{constructor(e){super(`Encountered errors while disposing of store. Errors: [${e.join(", ")}]`),this.errors=e}}function h(e){return"function"==typeof e.dispose&&0===e.dispose.length}function d(e){if(r.$.is(e)){let t=[];for(const n of e)if(n)try{n.dispose()}catch(e){t.push(e)}if(1===t.length)throw t[0];if(t.length>1)throw new c(t);return Array.isArray(e)?[]:e}if(e)return e.dispose(),e}function f(...e){const t=p((()=>d(e)));return function(e,t){if(s)for(const n of e)s.setParent(n,t)}(e,t),t}function p(e){const t=a({dispose:(0,i.I)((()=>{o(t),e()}))});return t}class _{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(e){if(!e)return e;if(e===this)throw new Error("Cannot register a disposable on itself!");return l(e,this),this._isDisposed?_.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(e),e}}_.DISABLE_DISPOSED_WARNING=!1;class g{constructor(){this._store=new _,a(this),l(this._store,this)}dispose(){o(this),this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}}g.None=Object.freeze({dispose(){}});class m{constructor(){this._isDisposed=!1,a(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){var t;this._isDisposed||e===this._value||(null===(t=this._value)||void 0===t||t.dispose(),e&&l(e,this),this._value=e)}clear(){this.value=void 0}dispose(){var e;this._isDisposed=!0,o(this),null===(e=this._value)||void 0===e||e.dispose(),this._value=void 0}clearAndLeak(){const e=this._value;return this._value=void 0,e&&l(e,null),e}}class v{constructor(e){this.object=e}dispose(){}}},34502:function(e,t,n){"use strict";n.d(t,{S:function(){return r}});class i{constructor(e){this.element=e,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 e=this._first;for(;e!==i.Undefined;){const t=e.next;e.prev=i.Undefined,e.next=i.Undefined,e=t}this._first=i.Undefined,this._last=i.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){const n=new i(e);if(this._first===i.Undefined)this._first=n,this._last=n;else if(t){const e=this._last;this._last=n,n.prev=e,e.next=n}else{const e=this._first;this._first=n,n.next=e,e.prev=n}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(n))}}shift(){if(this._first!==i.Undefined){const e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==i.Undefined){const e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==i.Undefined&&e.next!==i.Undefined){const t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===i.Undefined&&e.next===i.Undefined?(this._first=i.Undefined,this._last=i.Undefined):e.next===i.Undefined?(this._last=this._last.prev,this._last.next=i.Undefined):e.prev===i.Undefined&&(this._first=this._first.next,this._first.prev=i.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==i.Undefined;)yield e.element,e=e.next}}},23345:function(e,t,n){"use strict";n.d(t,{$L:function(){return T},ED:function(){return E},IJ:function(){return k},OS:function(){return L},WE:function(){return C},dz:function(){return w},gn:function(){return A},li:function(){return m},r:function(){return D},tY:function(){return S},xS:function(){return R}});var i,r=n(97671);const s="en";let a,o,l=!1,u=!1,c=!1,h=!1,d=!1,f=!1,p=!1,_=null,g=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,c="linux"===v.platform,h=c&&!!v.env.SNAP&&!!v.env.SNAP_REVISION,a=s,_=s;const e=v.env.VSCODE_NLS_CONFIG;if(e)try{const t=JSON.parse(e),n=t.availableLanguages["*"];a=t.locale,_=n||s,g=t._translationsConfigFile}catch(e){}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,c=o.indexOf("Linux")>=0,f=!0,a=navigator.language,_=a;let b=0;u?b=1:l?b=3:c&&(b=2);const E=l,w=u,k=c,S=d,T=f,A=p,C=o,R=function(){if(m.setImmediate)return m.setImmediate.bind(m);if("function"==typeof m.postMessage&&!m.importScripts){let e=[];m.addEventListener("message",(t=>{if(t.data&&t.data.vscodeSetImmediateId)for(let n=0,i=e.length;n<i;n++){const i=e[n];if(i.id===t.data.vscodeSetImmediateId)return e.splice(n,1),void i.callback()}}));let t=0;return n=>{const i=++t;e.push({id:i,callback:n}),m.postMessage({vscodeSetImmediateId:i},"*")}}if("function"==typeof(null==v?void 0:v.nextTick))return v.nextTick.bind(v);const e=Promise.resolve();return t=>e.then(t)}(),L=u||p?2:l?1:3;let x=!0,I=!1;function D(){if(!I){I=!0;const e=new Uint8Array(2);e[0]=1,e[1]=2;const t=new Uint16Array(e.buffer);x=513===t[0]}return x}},95830:function(e,t,n){"use strict";n.d(t,{G:function(){return s}});var i=n(23345);const r=i.li.performance&&"function"==typeof i.li.performance.now;class s{constructor(e){this._highResolution=r&&e,this._startTime=this._now(),this._stopTime=-1}static create(e=!0){return new s(e)}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(e,t,n){"use strict";function i(e){return!e||"string"!=typeof e||0===e.trim().length}n.d(t,{$i:function(){return G},C8:function(){return z},GF:function(){return f},HO:function(){return N},IO:function(){return p},K7:function(){return H},Kw:function(){return Y},LC:function(){return m},Mh:function(){return R},P1:function(){return L},PJ:function(){return X},Qe:function(){return j},R1:function(){return d},RP:function(){return K},S6:function(){return Q},TT:function(){return E},Ut:function(){return B},V8:function(){return v},WU:function(){return s},YK:function(){return I},YU:function(){return a},ZG:function(){return x},ZH:function(){return P},ab:function(){return V},c1:function(){return W},df:function(){return T},ec:function(){return o},fi:function(){return J},fy:function(){return l},j3:function(){return u},j_:function(){return k},m5:function(){return i},mK:function(){return S},mr:function(){return _},oH:function(){return te},oL:function(){return c},ok:function(){return C},ow:function(){return y},qq:function(){return A},qu:function(){return b},rL:function(){return D},uS:function(){return q},un:function(){return h},uq:function(){return g},vH:function(){return M},xe:function(){return Z},zY:function(){return w}});const r=/{(\d+)}/g;function s(e,...t){return 0===t.length?e:e.replace(r,(function(e,n){const i=parseInt(n,10);return isNaN(i)||i<0||i>=t.length?e:t[i]}))}function a(e){return e.replace(/[<>&]/g,(function(e){switch(e){case"<":return"<";case">":return">";case"&":return"&";default:return e}}))}function o(e){return e.replace(/[\\\{\}\*\+\?\|\^\$\.\[\]\(\)]/g,"\\$&")}function l(e,t=" "){return c(u(e,t),t)}function u(e,t){if(!e||!t)return e;const n=t.length;if(0===n||0===e.length)return e;let i=0;for(;e.indexOf(t,i)===i;)i+=n;return e.substring(i)}function c(e,t){if(!e||!t)return e;const n=t.length,i=e.length;if(0===n||0===i)return e;let r=i,s=-1;for(;s=e.lastIndexOf(t,r-1),-1!==s&&s+n===r;){if(0===s)return"";r=s}return e.substring(0,r)}function h(e){return e.replace(/[\-\\\{\}\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&").replace(/[\*]/g,".*")}function d(e){return e.replace(/\*/g,"")}function f(e,t,n={}){if(!e)throw new Error("Cannot create regex from empty string");t||(e=o(e)),n.wholeWord&&(/\B/.test(e.charAt(0))||(e="\\b"+e),/\B/.test(e.charAt(e.length-1))||(e+="\\b"));let i="";return n.global&&(i+="g"),n.matchCase||(i+="i"),n.multiline&&(i+="m"),n.unicode&&(i+="u"),new RegExp(e,i)}function p(e){if("^"===e.source||"^$"===e.source||"$"===e.source||"^\\s*$"===e.source)return!1;return!(!e.exec("")||0!==e.lastIndex)}function _(e){return(e.global?"g":"")+(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"")}function g(e){return e.split(/\r\n|\r|\n/)}function m(e){for(let t=0,n=e.length;t<n;t++){const n=e.charCodeAt(t);if(32!==n&&9!==n)return t}return-1}function v(e,t=0,n=e.length){for(let i=t;i<n;i++){const n=e.charCodeAt(i);if(32!==n&&9!==n)return e.substring(t,i)}return e.substring(t,n)}function y(e,t=e.length-1){for(let n=t;n>=0;n--){const t=e.charCodeAt(n);if(32!==t&&9!==t)return n}return-1}function b(e,t){return e<t?-1:e>t?1:0}function E(e,t,n=0,i=e.length,r=0,s=t.length){for(;n<i&&r<s;n++,r++){let i=e.charCodeAt(n),s=t.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(e,t){return k(e,t,0,e.length,0,t.length)}function k(e,t,n=0,i=e.length,r=0,s=t.length){for(;n<i&&r<s;n++,r++){let a=e.charCodeAt(n),o=t.charCodeAt(r);if(a===o)continue;if(a>=128||o>=128)return E(e.toLowerCase(),t.toLowerCase(),n,i,r,s);S(a)&&(a-=32),S(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 S(e){return e>=97&&e<=122}function T(e){return e>=65&&e<=90}function A(e,t){return e.length===t.length&&0===k(e,t)}function C(e,t){const n=t.length;return!(t.length>e.length)&&0===k(e,t,0,n)}function R(e,t){let n,i=Math.min(e.length,t.length);for(n=0;n<i;n++)if(e.charCodeAt(n)!==t.charCodeAt(n))return n;return i}function L(e,t){let n,i=Math.min(e.length,t.length);const r=e.length-1,s=t.length-1;for(n=0;n<i;n++)if(e.charCodeAt(r-n)!==t.charCodeAt(s-n))return n;return i}function x(e){return 55296<=e&&e<=56319}function I(e){return 56320<=e&&e<=57343}function D(e,t){return t-56320+(e-55296<<10)+65536}function P(e,t,n){const i=e.charCodeAt(n);if(x(i)&&n+1<t){const t=e.charCodeAt(n+1);if(I(t))return D(i,t)}return i}function O(e,t){const n=e.charCodeAt(t-1);if(I(n)&&t>1){const i=e.charCodeAt(t-2);if(x(i))return D(i,n)}return n}function M(e,t){const n=ee.getInstance(),i=t,r=e.length,s=P(e,r,t);t+=s>=65536?2:1;let a=n.getGraphemeBreakType(s);for(;t<r;){const i=P(e,r,t),s=n.getGraphemeBreakType(i);if(J(a,s))break;t+=i>=65536?2:1,a=s}return t-i}function N(e,t){const n=ee.getInstance(),i=t,r=O(e,t);t-=r>=65536?2:1;let s=n.getGraphemeBreakType(r);for(;t>0;){const i=O(e,t),r=n.getGraphemeBreakType(i);if(J(r,s))break;t-=i>=65536?2:1,s=r}return i-t}const F=/(?:[\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(e){return F.test(e)}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 K(e){return U.test(e)}const $=/^[\t\n\r\x20-\x7E]*$/;function G(e){return $.test(e)}const j=/[\u2028\u2029]/;function V(e){return j.test(e)}function Z(e){for(let t=0,n=e.length;t<n;t++)if(H(e.charCodeAt(t)))return!0;return!1}function H(e){return(e=+e)>=11904&&e<=55215||e>=63744&&e<=64255||e>=65281&&e<=65374}function z(e){return e>=127462&&e<=127487||8986===e||8987===e||9200===e||9203===e||e>=9728&&e<=10175||11088===e||11093===e||e>=127744&&e<=128591||e>=128640&&e<=128764||e>=128992&&e<=129003||e>=129280&&e<=129535||e>=129648&&e<=129750}const W=String.fromCharCode(65279);function q(e){return!!(e&&e.length>0&&65279===e.charCodeAt(0))}function Y(e,t=!1){return!!e&&(t&&(e=e.replace(/\\./g,"")),e.toLowerCase()!==e)}function X(e){return(e%=52)<26?String.fromCharCode(97+e):String.fromCharCode(65+e-26)}function Q(e){return ee.getInstance().getGraphemeBreakType(e)}function J(e,t){return 0===e?5!==t&&7!==t:(2!==e||3!==t)&&(4===e||2===e||3===e||(4===t||2===t||3===t||(8!==e||8!==t&&9!==t&&11!==t&&12!==t)&&((11!==e&&9!==e||9!==t&&10!==t)&&((12!==e&&10!==e||10!==t)&&(5!==t&&13!==t&&(7!==t&&(1!==e&&((13!==e||14!==t)&&(6!==e||6!==t)))))))))}class ee{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 ee._INSTANCE||(ee._INSTANCE=new ee),ee._INSTANCE}getGraphemeBreakType(e){if(e<32)return 10===e?3:13===e?2:4;if(e<127)return 0;const t=this._data,n=t.length/3;let i=1;for(;i<=n;)if(e<t[3*i])i*=2;else{if(!(e>t[3*i+1]))return t[3*i+2];i=2*i+1}return 0}}function te(e,t){if(0===e)return 0;const n=function(e,t){let n=O(t,e);e-=ne(n);for(;ie(n)||65039===n||8419===n;){if(0===e)return;n=O(t,e),e-=ne(n)}if(!z(n))return;if(e>=0){const n=O(t,e);8205===n&&(e-=ne(n))}return e}(e,t);if(void 0!==n)return n;return e-=ne(O(t,e))}function ne(e){return e>=65536?2:1}function ie(e){return 127995<=e&&e<=127999}ee._INSTANCE=null},72999:function(e,t,n){"use strict";function i(e){return Array.isArray(e)}function r(e){return"string"==typeof e}function s(e){return!("object"!=typeof e||null===e||Array.isArray(e)||e instanceof RegExp||e instanceof Date)}function a(e){return"number"==typeof e&&!isNaN(e)}function o(e){return!0===e||!1===e}function l(e){return void 0===e}function u(e){return!c(e)}function c(e){return l(e)||null===e}function h(e,t){if(!e)throw new Error(t?`Unexpected type, expected '${t}'`:"Unexpected type")}function d(e){if(c(e))throw new Error("Assertion Failed: argument is undefined or null");return e}function f(e){return"function"==typeof e}function p(e,t){const n=Math.min(e.length,t.length);for(let i=0;i<n;i++)_(e[i],t[i])}function _(e,t){if(r(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(f(t)){try{if(e instanceof t)return}catch(e){}if(!c(e)&&e.constructor===t)return;if(1===t.length&&!0===t.call(void 0,e))return;throw new Error("argument does not match one of these constraints: arg instanceof constraint, arg.constructor === constraint, nor constraint(arg) === true")}}function g(e){const t=[];for(const n of function(e){let t=[],n=Object.getPrototypeOf(e);for(;Object.prototype!==n;)t=t.concat(Object.getOwnPropertyNames(n)),n=Object.getPrototypeOf(n);return t}(e))"function"==typeof e[n]&&t.push(n);return t}function m(e,t){const n=e=>function(){const n=Array.prototype.slice.call(arguments,0);return t(e,n)};let i={};for(const t of e)i[t]=n(t);return i}function v(e){return null===e?void 0:e}function y(e,t="Unreachable"){throw new Error(t)}n.d(t,{$E:function(){return g},$K:function(){return u},D8:function(){return p},HD:function(){return r},IU:function(){return m},Jp:function(){return c},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 h},vE:function(){return y}})},13268:function(e,t,n){"use strict";function i(e,t,...n){return function(e,t){let n;return n=0===t.length?e:e.replace(/\{(\d+)\}/g,(function(e,n){const i=n[0];return void 0!==t[i]?t[i]:e})),n}(t,n)}n.d(t,{N:function(){return i}})},96236:function(e,t,n){"use strict";n.d(t,{BH:function(){return v},NZ:function(){return y},U8:function(){return b},co:function(){return m},eH:function(){return g},vr:function(){return _}});var i=n(75918),r=n(52615),s=n(4348),a=n(88226),o=n(69323),l=n(34502),u=n(35884),c=n(90689),h=n(16925),d=n(49055),f=function(e,t,n,i){var r,s=arguments.length,a=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var o=e.length-1;o>=0;o--)(r=e[o])&&(a=(s<3?r(a):s>3?r(t,n,a):r(t,n))||a);return s>3&&a&&Object.defineProperty(t,n,a),a},p=function(e,t){return function(n,i){t(n,i,e)}};function _(e){return void 0!==e.command}class g{constructor(e){this.id=g._idPool++,this._debugName=e}}g._idPool=0,g.CommandPalette=new g("CommandPalette"),g.EditorContext=new g("EditorContext"),g.SimpleEditorContext=new g("SimpleEditorContext"),g.EditorContextCopy=new g("EditorContextCopy"),g.EditorContextPeek=new g("EditorContextPeek"),g.MenubarEditMenu=new g("MenubarEditMenu"),g.MenubarCopy=new g("MenubarCopy"),g.MenubarGoMenu=new g("MenubarGoMenu"),g.MenubarSelectionMenu=new g("MenubarSelectionMenu"),g.InlineCompletionsActions=new g("InlineCompletionsActions");const m=(0,h.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:e=>e===g.CommandPalette}}addCommand(e){return this.addCommands(a.$.single(e))}addCommands(e){for(const t of e)this._commands.set(t.id,t);return this._onDidChangeMenu.fire(this._commandPaletteChangeEvent),(0,o.OF)((()=>{let t=!1;for(const n of e)t=this._commands.delete(n.id)||t;t&&this._onDidChangeMenu.fire(this._commandPaletteChangeEvent)}))}getCommand(e){return this._commands.get(e)}getCommands(){const e=new Map;return this._commands.forEach(((t,n)=>e.set(n,t))),e}appendMenuItem(e,t){return this.appendMenuItems(a.$.single({id:e,item:t}))}appendMenuItems(e){const t=new Set,n=new l.S;for(const{id:i,item:r}of e){let e=this._menuItems.get(i);e||(e=new l.S,this._menuItems.set(i,e)),n.push(e.push(r)),t.add(i)}return this._onDidChangeMenu.fire(t),(0,o.OF)((()=>{if(n.size>0){for(let e of n)e();this._onDidChangeMenu.fire(t),n.clear()}}))}getMenuItems(e){let t;return t=this._menuItems.has(e)?[...this._menuItems.get(e)]:[],e===g.CommandPalette&&this._appendImplicitItems(t),t}_appendImplicitItems(e){const t=new Set;for(const n of e)_(n)&&(t.add(n.command.id),n.alt&&t.add(n.alt.id));this._commands.forEach(((n,i)=>{t.has(i)||e.push({command:n})}))}};class y extends i.wY{constructor(e,t,n,i){super(`submenuitem.${e.submenu.id}`,"string"==typeof e.title?e.title:e.title.value,[],"submenu"),this.item=e,this._menuService=t,this._contextKeyService=n,this._options=i}get actions(){const e=[],t=this._menuService.createMenu(this.item.submenu,this._contextKeyService),n=t.getActions(this._options);t.dispose();for(const[,t]of n)t.length>0&&(e.push(...t),e.push(new i.Z0));return e.length&&e.pop(),e}}let b=class e{constructor(t,n,i,s,a){var o,l;if(this._commandService=a,this.id=t.id,this.label=(null==i?void 0:i.renderShortTitle)&&t.shortTitle?"string"==typeof t.shortTitle?t.shortTitle:t.shortTitle.value:"string"==typeof t.title?t.title:t.title.value,this.tooltip=null!==(l="string"==typeof t.tooltip?t.tooltip:null===(o=t.tooltip)||void 0===o?void 0:o.value)&&void 0!==l?l:"",this.enabled=!t.precondition||s.contextMatchesRules(t.precondition),this.checked=void 0,t.toggled){const e=t.toggled.condition?t.toggled:{condition:t.toggled};this.checked=s.contextMatchesRules(e.condition),this.checked&&e.tooltip&&(this.tooltip="string"==typeof e.tooltip?e.tooltip:e.tooltip.value),e.title&&(this.label="string"==typeof e.title?e.title:e.title.value)}this.item=t,this.alt=n?new e(n,void 0,i,s,a):void 0,this._options=i,d.kS.isThemeIcon(t.icon)&&(this.class=r.dT.asClassName(t.icon))}dispose(){}run(...e){var t,n;let i=[];return(null===(t=this._options)||void 0===t?void 0:t.arg)&&(i=[...i,this._options.arg]),(null===(n=this._options)||void 0===n?void 0:n.shouldForwardArgs)&&(i=[...i,...e]),this._commandService.executeCommand(this.id,...i)}};b=f([p(3,c.i6),p(4,u.H)],b)},35884:function(e,t,n){"use strict";n.d(t,{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(e,t){if(!e)throw new Error("invalid command");if("string"==typeof e){if(!t)throw new Error("invalid command");return this.registerCommand({id:e,handler:t})}if(e.description){const t=[];for(let n of e.description.args)t.push(n.constraint);const n=e.handler;e.handler=function(e,...i){return(0,o.D8)(i,t),n(e,...i)}}const{id:n}=e;let i=this._commands.get(n);i||(i=new a.S,this._commands.set(n,i));let r=i.unshift(e),l=(0,s.OF)((()=>{r();const e=this._commands.get(n);(null==e?void 0:e.isEmpty())&&this._commands.delete(n)}));return this._onDidRegisterCommand.fire(n),l}registerCommandAlias(e,t){return u.registerCommand(e,((e,...n)=>e.get(l).executeCommand(t,...n)))}getCommand(e){const t=this._commands.get(e);if(t&&!t.isEmpty())return r.$.first(t)}getCommands(){const e=new Map;for(const t of this._commands.keys()){const n=this.getCommand(t);n&&e.set(t,n)}return e}};u.registerCommand("noop",(()=>{}))},90689:function(e,t,n){"use strict";n.d(t,{Ao:function(){return u},Eq:function(){return D},Fb:function(){return c},K8:function(){return M},i6:function(){return I},uy:function(){return x}});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(e){return p.create(e)}static equals(e,t){return _.create(e,t)}static regex(e,t){return T.create(e,t)}static not(e){return y.create(e)}static and(...e){return R.create(e,null)}static or(...e){return L.create(e,null,!0)}static deserialize(e,t=!1){if(e)return this._deserializeOrExpression(e,t)}static _deserializeOrExpression(e,t){let n=e.split("||");return L.create(n.map((e=>this._deserializeAndExpression(e,t))),null,!0)}static _deserializeAndExpression(e,t){let n=e.split("&&");return R.create(n.map((e=>this._deserializeOne(e,t))),null)}static _deserializeOne(e,t){if((e=e.trim()).indexOf("!=")>=0){let n=e.split("!=");return v.create(n[0].trim(),this._deserializeValue(n[1],t))}if(e.indexOf("==")>=0){let n=e.split("==");return _.create(n[0].trim(),this._deserializeValue(n[1],t))}if(e.indexOf("=~")>=0){let n=e.split("=~");return T.create(n[0].trim(),this._deserializeRegexValue(n[1],t))}if(e.indexOf(" in ")>=0){let t=e.split(" in ");return g.create(t[0].trim(),t[1].trim())}if(/^[^<=>]+>=[^<=>]+$/.test(e)){const t=e.split(">=");return w.create(t[0].trim(),t[1].trim())}if(/^[^<=>]+>[^<=>]+$/.test(e)){const t=e.split(">");return E.create(t[0].trim(),t[1].trim())}if(/^[^<=>]+<=[^<=>]+$/.test(e)){const t=e.split("<=");return S.create(t[0].trim(),t[1].trim())}if(/^[^<=>]+<[^<=>]+$/.test(e)){const t=e.split("<");return k.create(t[0].trim(),t[1].trim())}return/^\!\s*/.test(e)?y.create(e.substr(1).trim()):p.create(e)}static _deserializeValue(e,t){if("true"===(e=e.trim()))return!0;if("false"===e)return!1;let n=/^'([^']*)'$/.exec(e);return n?n[1].trim():e}static _deserializeRegexValue(e,t){if((0,r.m5)(e)){if(t)throw new Error("missing regexp-value for =~-expression");return console.warn("missing regexp-value for =~-expression"),null}let n=e.indexOf("/"),i=e.lastIndexOf("/");if(n===i||n<0){if(t)throw new Error(`bad regexp-value '${e}', missing /-enclosure`);return console.warn(`bad regexp-value '${e}', missing /-enclosure`),null}let s=e.slice(n+1,i),a="i"===e[i+1]?"i":"";try{return new RegExp(s,a)}catch(n){if(t)throw new Error(`bad regexp-value '${e}', parse error: ${n}`);return console.warn(`bad regexp-value '${e}', parse error: ${n}`),null}}}function c(e,t){const n=e?e.substituteConstants():void 0,i=t?t.substituteConstants():void 0;return!n&&!i||!(!n||!i)&&n.equals(i)}function h(e,t){return e.cmp(t)}class d{constructor(){this.type=0}cmp(e){return this.type-e.type}equals(e){return e.type===this.type}substituteConstants(){return this}evaluate(e){return!1}serialize(){return"false"}keys(){return[]}negate(){return f.INSTANCE}}d.INSTANCE=new d;class f{constructor(){this.type=1}cmp(e){return this.type-e.type}equals(e){return e.type===this.type}substituteConstants(){return this}evaluate(e){return!0}serialize(){return"true"}keys(){return[]}negate(){return d.INSTANCE}}f.INSTANCE=new f;class p{constructor(e,t){this.key=e,this.negated=t,this.type=2}static create(e,t=null){const n=o.get(e);return"boolean"==typeof n?n?f.INSTANCE:d.INSTANCE:new p(e,t)}cmp(e){return e.type!==this.type?this.type-e.type:P(this.key,e.key)}equals(e){return e.type===this.type&&this.key===e.key}substituteConstants(){const e=o.get(this.key);return"boolean"==typeof e?e?f.INSTANCE:d.INSTANCE:this}evaluate(e){return!!e.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 _{constructor(e,t,n){this.key=e,this.value=t,this.negated=n,this.type=4}static create(e,t,n=null){if("boolean"==typeof t)return t?p.create(e,n):y.create(e,n);const i=o.get(e);if("boolean"==typeof i){return t===(i?"true":"false")?f.INSTANCE:d.INSTANCE}return new _(e,t,n)}cmp(e){return e.type!==this.type?this.type-e.type:O(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type&&(this.key===e.key&&this.value===e.value)}substituteConstants(){const e=o.get(this.key);if("boolean"==typeof e){const t=e?"true":"false";return this.value===t?f.INSTANCE:d.INSTANCE}return this}evaluate(e){return e.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 g{constructor(e,t){this.key=e,this.valueKey=t,this.type=10,this.negated=null}static create(e,t){return new g(e,t)}cmp(e){return e.type!==this.type?this.type-e.type:O(this.key,this.valueKey,e.key,e.valueKey)}equals(e){return e.type===this.type&&(this.key===e.key&&this.valueKey===e.valueKey)}substituteConstants(){return this}evaluate(e){const t=e.getValue(this.valueKey),n=e.getValue(this.key);return Array.isArray(t)?t.indexOf(n)>=0:"string"==typeof n&&"object"==typeof t&&null!==t&&l.call(t,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(e){this._actual=e,this.type=11}static create(e){return new m(e)}cmp(e){return e.type!==this.type?this.type-e.type:this._actual.cmp(e._actual)}equals(e){return e.type===this.type&&this._actual.equals(e._actual)}substituteConstants(){return this}evaluate(e){return!this._actual.evaluate(e)}serialize(){throw new Error("Method not implemented.")}keys(){return this._actual.keys()}negate(){return this._actual}}class v{constructor(e,t,n){this.key=e,this.value=t,this.negated=n,this.type=5}static create(e,t,n=null){if("boolean"==typeof t)return t?y.create(e,n):p.create(e,n);const i=o.get(e);if("boolean"==typeof i){return t===(i?"true":"false")?d.INSTANCE:f.INSTANCE}return new v(e,t,n)}cmp(e){return e.type!==this.type?this.type-e.type:O(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type&&(this.key===e.key&&this.value===e.value)}substituteConstants(){const e=o.get(this.key);if("boolean"==typeof e){const t=e?"true":"false";return this.value===t?d.INSTANCE:f.INSTANCE}return this}evaluate(e){return e.getValue(this.key)!=this.value}serialize(){return`${this.key} != '${this.value}'`}keys(){return[this.key]}negate(){return this.negated||(this.negated=_.create(this.key,this.value,this)),this.negated}}class y{constructor(e,t){this.key=e,this.negated=t,this.type=3}static create(e,t=null){const n=o.get(e);return"boolean"==typeof n?n?d.INSTANCE:f.INSTANCE:new y(e,t)}cmp(e){return e.type!==this.type?this.type-e.type:P(this.key,e.key)}equals(e){return e.type===this.type&&this.key===e.key}substituteConstants(){const e=o.get(this.key);return"boolean"==typeof e?e?d.INSTANCE:f.INSTANCE:this}evaluate(e){return!e.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(e,t){if("string"==typeof e){const t=parseFloat(e);isNaN(t)||(e=t)}return"string"==typeof e||"number"==typeof e?t(e):d.INSTANCE}class E{constructor(e,t,n){this.key=e,this.value=t,this.negated=n,this.type=12}static create(e,t,n=null){return b(t,(t=>new E(e,t,n)))}cmp(e){return e.type!==this.type?this.type-e.type:O(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type&&(this.key===e.key&&this.value===e.value)}substituteConstants(){return this}evaluate(e){return"string"!=typeof this.value&&parseFloat(e.getValue(this.key))>this.value}serialize(){return`${this.key} > ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=S.create(this.key,this.value,this)),this.negated}}class w{constructor(e,t,n){this.key=e,this.value=t,this.negated=n,this.type=13}static create(e,t,n=null){return b(t,(t=>new w(e,t,n)))}cmp(e){return e.type!==this.type?this.type-e.type:O(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type&&(this.key===e.key&&this.value===e.value)}substituteConstants(){return this}evaluate(e){return"string"!=typeof this.value&&parseFloat(e.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 k{constructor(e,t,n){this.key=e,this.value=t,this.negated=n,this.type=14}static create(e,t,n=null){return b(t,(t=>new k(e,t,n)))}cmp(e){return e.type!==this.type?this.type-e.type:O(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type&&(this.key===e.key&&this.value===e.value)}substituteConstants(){return this}evaluate(e){return"string"!=typeof this.value&&parseFloat(e.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 S{constructor(e,t,n){this.key=e,this.value=t,this.negated=n,this.type=15}static create(e,t,n=null){return b(t,(t=>new S(e,t,n)))}cmp(e){return e.type!==this.type?this.type-e.type:O(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type&&(this.key===e.key&&this.value===e.value)}substituteConstants(){return this}evaluate(e){return"string"!=typeof this.value&&parseFloat(e.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 T{constructor(e,t){this.key=e,this.regexp=t,this.type=7,this.negated=null}static create(e,t){return new T(e,t)}cmp(e){if(e.type!==this.type)return this.type-e.type;if(this.key<e.key)return-1;if(this.key>e.key)return 1;const t=this.regexp?this.regexp.source:"",n=e.regexp?e.regexp.source:"";return t<n?-1:t>n?1:0}equals(e){if(e.type===this.type){const t=this.regexp?this.regexp.source:"",n=e.regexp?e.regexp.source:"";return this.key===e.key&&t===n}return!1}substituteConstants(){return this}evaluate(e){let t=e.getValue(this.key);return!!this.regexp&&this.regexp.test(t)}serialize(){const e=this.regexp?`/${this.regexp.source}/${this.regexp.ignoreCase?"i":""}`:"/invalid/";return`${this.key} =~ ${e}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=A.create(this)),this.negated}}class A{constructor(e){this._actual=e,this.type=8}static create(e){return new A(e)}cmp(e){return e.type!==this.type?this.type-e.type:this._actual.cmp(e._actual)}equals(e){return e.type===this.type&&this._actual.equals(e._actual)}substituteConstants(){return this}evaluate(e){return!this._actual.evaluate(e)}serialize(){throw new Error("Method not implemented.")}keys(){return this._actual.keys()}negate(){return this._actual}}function C(e){let t=null;for(let n=0,i=e.length;n<i;n++){const i=e[n].substituteConstants();if(e[n]!==i&&null===t){t=[];for(let i=0;i<n;i++)t[i]=e[i]}null!==t&&(t[n]=i)}return null===t?e:t}class R{constructor(e,t){this.expr=e,this.negated=t,this.type=6}static create(e,t){return R._normalizeArr(e,t)}cmp(e){if(e.type!==this.type)return this.type-e.type;if(this.expr.length<e.expr.length)return-1;if(this.expr.length>e.expr.length)return 1;for(let t=0,n=this.expr.length;t<n;t++){const n=h(this.expr[t],e.expr[t]);if(0!==n)return n}return 0}equals(e){if(e.type===this.type){if(this.expr.length!==e.expr.length)return!1;for(let t=0,n=this.expr.length;t<n;t++)if(!this.expr[t].equals(e.expr[t]))return!1;return!0}return!1}substituteConstants(){const e=C(this.expr);return e===this.expr?this:R.create(e,this.negated)}evaluate(e){for(let t=0,n=this.expr.length;t<n;t++)if(!this.expr[t].evaluate(e))return!1;return!0}static _normalizeArr(e,t){const n=[];let i=!1;for(const t of e)if(t)if(1!==t.type){if(0===t.type)return d.INSTANCE;6!==t.type?n.push(t):n.push(...t.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(h);for(let e=1;e<n.length;e++)n[e-1].equals(n[e])&&(n.splice(e,1),e--);if(1===n.length)return n[0];for(;n.length>1;){const e=n[n.length-1];if(9!==e.type)break;n.pop();const t=n.pop(),i=0===n.length,r=L.create(e.expr.map((e=>R.create([e,t],null))),null,i);r&&(n.push(r),n.sort(h))}return 1===n.length?n[0]:new R(n,t)}}serialize(){return this.expr.map((e=>e.serialize())).join(" && ")}keys(){const e=[];for(let t of this.expr)e.push(...t.keys());return e}negate(){if(!this.negated){const e=[];for(let t of this.expr)e.push(t.negate());this.negated=L.create(e,this,!0)}return this.negated}}class L{constructor(e,t){this.expr=e,this.negated=t,this.type=9}static create(e,t,n){return L._normalizeArr(e,t,n)}cmp(e){if(e.type!==this.type)return this.type-e.type;if(this.expr.length<e.expr.length)return-1;if(this.expr.length>e.expr.length)return 1;for(let t=0,n=this.expr.length;t<n;t++){const n=h(this.expr[t],e.expr[t]);if(0!==n)return n}return 0}equals(e){if(e.type===this.type){if(this.expr.length!==e.expr.length)return!1;for(let t=0,n=this.expr.length;t<n;t++)if(!this.expr[t].equals(e.expr[t]))return!1;return!0}return!1}substituteConstants(){const e=C(this.expr);return e===this.expr?this:L.create(e,this.negated,!1)}evaluate(e){for(let t=0,n=this.expr.length;t<n;t++)if(this.expr[t].evaluate(e))return!0;return!1}static _normalizeArr(e,t,n){let i=[],r=!1;if(e){for(let t=0,n=e.length;t<n;t++){const n=e[t];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(h)}if(0!==i.length){if(1===i.length)return i[0];for(let e=1;e<i.length;e++)i[e-1].equals(i[e])&&(i.splice(e,1),e--);if(1===i.length)return i[0];if(n){for(let e=0;e<i.length;e++)for(let t=e+1;t<i.length;t++)M(i[e],i[t])&&(i.splice(t,1),t--);if(1===i.length)return i[0]}return new L(i,t)}}serialize(){return this.expr.map((e=>e.serialize())).join(" || ")}keys(){const e=[];for(let t of this.expr)e.push(...t.keys());return e}negate(){if(!this.negated){let e=[];for(let t of this.expr)e.push(t.negate());for(;e.length>1;){const t=e.shift(),n=e.shift(),i=[];for(const e of N(t))for(const t of N(n))i.push(R.create([e,t],null));const r=0===e.length;e.unshift(L.create(i,null,r))}this.negated=e[0]}return this.negated}}class x extends p{constructor(e,t,n){super(e,null),this._defaultValue=t,"object"==typeof n?x._info.push(Object.assign(Object.assign({},n),{key:e})):!0!==n&&x._info.push({key:e,description:n,type:null!=t?typeof t:void 0})}static all(){return x._info.values()}bindTo(e){return e.createKey(this.key,this._defaultValue)}getValue(e){return e.getContextKeyValue(this.key)}toNegated(){return this.negate()}isEqualTo(e){return _.create(this.key,e)}}x._info=[];const I=(0,s.yh)("contextKeyService"),D="setContext";function P(e,t){return e<t?-1:e>t?1:0}function O(e,t,n,i){return e<n?-1:e>n?1:t<i?-1:t>i?1:0}function M(e,t){if(6===t.type&&9!==e.type&&6!==e.type)for(const n of t.expr)if(e.equals(n))return!0;const n=N(e.negate()).concat(N(t));n.sort(h);for(let e=0;e<n.length;e++){const t=n[e].negate();for(let i=e+1;i<n.length;i++){const e=n[i];if(t.equals(e))return!0}}return!1}function N(e){return 9===e.type?e.expr:[e]}},16925:function(e,t,n){"use strict";var i;n.d(t,{I8:function(){return i},TG:function(){return r},jt:function(){return o},yh:function(){return a}}),function(e){e.serviceIds=new Map,e.DI_TARGET="$di$target",e.DI_DEPENDENCIES="$di$dependencies",e.getServiceDependencies=function(t){return t[e.DI_DEPENDENCIES]||[]}}(i||(i={}));const r=a("instantiationService");function s(e,t,n,r){t[i.DI_TARGET]===t?t[i.DI_DEPENDENCIES].push({id:e,index:n,optional:r}):(t[i.DI_DEPENDENCIES]=[{id:e,index:n,optional:r}],t[i.DI_TARGET]=t)}function a(e){if(i.serviceIds.has(e))return i.serviceIds.get(e);const t=function(e,n,i){if(3!==arguments.length)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");s(t,e,i,!1)};return t.toString=()=>e,i.serviceIds.set(e,t),t}function o(e){return function(t,n,i){if(3!==arguments.length)throw new Error("@optional-decorator can only be used to decorate a parameter");s(e,t,i,!0)}}},44650:function(e,t,n){"use strict";n.d(t,{B:function(){return s}});var i=n(76068),r=n(72999);const s=new class{constructor(){this.data=new Map}add(e,t){i.ok(r.HD(e)),i.ok(r.Kn(t)),i.ok(!this.data.has(e),"There is already an extension with this id"),this.data.set(e,t)}as(e){return this.data.get(e)||null}}},66213:function(e,t,n){"use strict";var i;n.d(t,{e:function(){return i}}),function(e){e.DARK="dark",e.LIGHT="light",e.HIGH_CONTRAST="hc"}(i||(i={}))},49055:function(e,t,n){"use strict";n.d(t,{EN:function(){return d},IP:function(){return p},Ic:function(){return g},XE:function(){return u},bB:function(){return m},kS:function(){return h},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 c,h;function d(e){return{id:e}}function f(e){switch(e){case l.e.DARK:return"vs-dark";case l.e.HIGH_CONTRAST:return"hc-black";default:return"vs"}}!function(e){e.isThemeColor=function(e){return e&&"object"==typeof e&&"string"==typeof e.id}}(c||(c={})),function(e){e.isThemeIcon=function(e){return e&&"object"==typeof e&&"string"==typeof e.id&&(void 0===e.color||c.isThemeColor(e.color))};const t=new RegExp(`^\\$\\((${i.dT.iconNameExpression}(?:${i.dT.iconModifierExpression})?)\\)$`);e.fromString=function(e){const n=t.exec(e);if(!n)return;let[,i]=n;return{id:i}},e.modify=function(e,t){let n=e.id;const i=n.lastIndexOf("~");return-1!==i&&(n=n.substring(0,i)),t&&(n=`${n}~${t}`),{id:n}},e.isEqual=function(e,t){var n,i;return e.id===t.id&&(null===(n=e.color)||void 0===n?void 0:n.id)===(null===(i=t.color)||void 0===i?void 0:i.id)},e.asThemeIcon=function(e,t){return{id:e.id,color:t?d(t):void 0}},e.asClassNameArray=i.dT.asClassNameArray,e.asClassName=i.dT.asClassName,e.asCSSSelector=i.dT.asCSSSelector}(h||(h={}));const p={ThemingContribution:"base.contributions.theming"};let _=new class{constructor(){this.themingParticipants=[],this.themingParticipants=[],this.onThemingParticipantAddedEmitter=new r.Q5}onColorThemeChange(e){return this.themingParticipants.push(e),this.onThemingParticipantAddedEmitter.fire(e),(0,s.OF)((()=>{const t=this.themingParticipants.indexOf(e);this.themingParticipants.splice(t,1)}))}getThemingParticipants(){return this.themingParticipants}};function g(e){return _.onColorThemeChange(e)}o.B.add(p.ThemingContribution,_);class m extends s.JT{constructor(e){super(),this.themeService=e,this.theme=e.getColorTheme(),this._register(this.themeService.onDidColorThemeChange((e=>this.onThemeChange(e))))}onThemeChange(e){this.theme=e,this.updateStyles()}updateStyles(){}}},96478:function(e,t,n){"use strict";n.d(t,{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),c=n(8654),h=n(59301),d=n(10228),f=n(16089),p=d.Z.ESC,_=d.Z.TAB;var g=(0,h.forwardRef)((function(e,t){var n=e.overlay,i=e.arrow,r=e.prefixCls,s=(0,h.useMemo)((function(){return"function"==typeof n?n():n}),[n]),a=(0,c.sQ)(t,(0,c.C4)(s));return h.createElement(h.Fragment,null,i&&h.createElement("div",{className:"".concat(r,"-arrow")}),h.cloneElement(s,{ref:(0,c.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(e,t){var n,l=e.arrow,d=void 0!==l&&l,m=e.prefixCls,v=void 0===m?"rc-dropdown":m,E=e.transitionName,w=e.animation,k=e.align,S=e.placement,T=void 0===S?"bottomLeft":S,A=e.placements,C=void 0===A?y:A,R=e.getPopupContainer,L=e.showAction,x=e.hideAction,I=e.overlayClassName,D=e.overlayStyle,P=e.visible,O=e.trigger,M=void 0===O?["hover"]:O,N=e.autoFocus,F=e.overlay,B=e.children,U=e.onVisibleChange,K=(0,a.Z)(e,b),$=h.useState(),G=(0,s.Z)($,2),j=G[0],V=G[1],Z="visible"in e?P:j,H=h.useRef(null),z=h.useRef(null),W=h.useRef(null);h.useImperativeHandle(t,(function(){return H.current}));var q=function(e){V(e),null==U||U(e)};!function(e){var t=e.visible,n=e.triggerRef,i=e.onVisibleChange,r=e.autoFocus,s=e.overlayRef,a=h.useRef(!1),o=function(){var e,r;t&&(null===(e=n.current)||void 0===e||null===(r=e.focus)||void 0===r||r.call(e),null==i||i(!1))},l=function(){var e;return!(null===(e=s.current)||void 0===e||!e.focus||(s.current.focus(),a.current=!0,0))},u=function(e){switch(e.keyCode){case p:o();break;case _:var t=!1;a.current||(t=l()),t?e.preventDefault():o()}};h.useEffect((function(){return t?(window.addEventListener("keydown",u),r&&(0,f.Z)(l,3),function(){window.removeEventListener("keydown",u),a.current=!1}):function(){a.current=!1}}),[t])}({visible:Z,triggerRef:W,onVisibleChange:q,autoFocus:N,overlayRef:z});var Y,X,Q,J=function(){return h.createElement(g,{ref:z,overlay:F,prefixCls:v,arrow:d})},ee=h.cloneElement(B,{className:u()(null===(n=B.props)||void 0===n?void 0:n.className,Z&&(Y=e.openClassName,void 0!==Y?Y:"".concat(v,"-open"))),ref:(0,c.Yr)(B)?(0,c.sQ)(W,(0,c.C4)(B)):void 0}),te=x;return te||-1===M.indexOf("contextMenu")||(te=["click"]),h.createElement(o.Z,(0,i.Z)({builtinPlacements:C},K,{prefixCls:v,ref:H,popupClassName:u()(I,(0,r.Z)({},"".concat(v,"-show-arrow"),d)),popupStyle:D,action:M,showAction:L,hideAction:te,popupPlacement:T,popupAlign:k,popupTransitionName:E,popupAnimation:w,popupVisible:Z,stretch:(X=e.minOverlayWidthMatchTrigger,Q=e.alignPoint,("minOverlayWidthMatchTrigger"in e?X:!Q)?"minWidth":""),popup:"function"==typeof F?J:J(),onPopupVisibleChange:q,onPopupClick:function(t){var n=e.onOverlayClick;V(!1),n&&n(t)},getPopupContainer:R}),ee)}var w=h.forwardRef(E)},28321:function(e,t,n){"use strict";n.d(t,{iz:function(){return Ke},ck:function(){return ye},BW:function(){return je},sN:function(){return ye},Wd:function(){return Be},ZP:function(){return Xe},Xl:function(){return R}});var i=n(54476),r=n(20068),s=n(33885),a=n(94480),o=n(42978),l=n(75931),u=n(92310),c=n.n(u),h=n(83836),d=n(18929),f=n(13697),p=n(48736),_=n(59301),g=n(4676),m=_.createContext(null);function v(e,t){return void 0===e?null:"".concat(e,"-").concat(t)}function y(e){return v(_.useContext(m),e)}var b=n(80547),E=["children","locked"],w=_.createContext(null);function k(e){var t=e.children,n=e.locked,i=(0,l.Z)(e,E),r=_.useContext(w),a=(0,b.Z)((function(){return e=r,t=i,n=(0,s.Z)({},e),Object.keys(t).forEach((function(e){var i=t[e];void 0!==i&&(n[e]=i)})),n;var e,t,n}),[r,i],(function(e,t){return!(n||e[0]===t[0]&&(0,f.Z)(e[1],t[1],!0))}));return _.createElement(w.Provider,{value:a},t)}var S=[],T=_.createContext(null);function A(){return _.useContext(T)}var C=_.createContext(S);function R(e){var t=_.useContext(C);return _.useMemo((function(){return void 0!==e?[].concat((0,a.Z)(t),[e]):t}),[t,e])}var L=_.createContext(null),x=_.createContext({}),I=n(29194);function D(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if((0,I.Z)(e)){var n=e.nodeName.toLowerCase(),i=["input","select","textarea","button"].includes(n)||e.isContentEditable||"a"===n&&!!e.getAttribute("href"),r=e.getAttribute("tabindex"),s=Number(r),a=null;return r&&!Number.isNaN(s)?a=s:i&&null===a&&(a=0),i&&e.disabled&&(a=null),null!==a&&(a>=0||t&&a<0)}return!1}function P(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=(0,a.Z)(e.querySelectorAll("*")).filter((function(e){return D(e,t)}));return D(e,t)&&n.unshift(e),n}var O=n(10228),M=n(16089),N=O.Z.LEFT,F=O.Z.RIGHT,B=O.Z.UP,U=O.Z.DOWN,K=O.Z.ENTER,$=O.Z.ESC,G=O.Z.HOME,j=O.Z.END,V=[B,U,N,F];function Z(e,t){return P(e,!0).filter((function(e){return t.has(e)}))}function H(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;if(!e)return null;var r=Z(e,t),s=r.length,a=r.findIndex((function(e){return n===e}));return i<0?-1===a?a=s-1:a-=1:i>0&&(a+=1),r[a=(a+s)%s]}var z=function(e,t){var n=new Set,i=new Map,r=new Map;return e.forEach((function(e){var s=document.querySelector("[data-menu-id='".concat(v(t,e),"']"));s&&(n.add(s),r.set(s,e),i.set(e,s))})),{elements:n,key2element:i,element2key:r}};function W(e,t,n,i,s,a,o,l,u,c){var h=_.useRef(),d=_.useRef();d.current=t;var f=function(){M.Z.cancel(h.current)};return _.useEffect((function(){return function(){f()}}),[]),function(p){var _=p.which;if([].concat(V,[K,$,G,j]).includes(_)){var g=a(),m=z(g,i),v=m,y=v.elements,b=v.key2element,E=v.element2key,w=function(e,t){for(var n=e||document.activeElement;n;){if(t.has(n))return n;n=n.parentElement}return null}(b.get(t),y),k=E.get(w),S=function(e,t,n,i){var s,a="prev",o="next",l="children",u="parent";if("inline"===e&&i===K)return{inlineTrigger:!0};var c=(0,r.Z)((0,r.Z)({},B,a),U,o),h=(0,r.Z)((0,r.Z)((0,r.Z)((0,r.Z)({},N,n?o:a),F,n?a:o),U,l),K,l),d=(0,r.Z)((0,r.Z)((0,r.Z)((0,r.Z)((0,r.Z)((0,r.Z)({},B,a),U,o),K,l),$,u),N,n?l:u),F,n?u:l);switch(null===(s={inline:c,horizontal:h,vertical:d,inlineSub:c,horizontalSub:d,verticalSub:d}["".concat(e).concat(t?"":"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}}(e,1===o(k,!0).length,n,_);if(!S&&_!==G&&_!==j)return;(V.includes(_)||[G,j].includes(_))&&p.preventDefault();var T=function(e){if(e){var t=e,n=e.querySelector("a");null!=n&&n.getAttribute("href")&&(t=n);var i=E.get(e);l(i),f(),h.current=(0,M.Z)((function(){d.current===i&&t.focus()}))}};if([G,j].includes(_)||S.sibling||!w){var A,C,R=Z(A=w&&"inline"!==e?function(e){for(var t=e;t;){if(t.getAttribute("data-menu-list"))return t;t=t.parentElement}return null}(w):s.current,y);C=_===G?R[0]:_===j?R[R.length-1]:H(A,y,w,S.offset),T(C)}else if(S.inlineTrigger)u(k);else if(S.offset>0)u(k,!0),f(),h.current=(0,M.Z)((function(){m=z(g,i);var e=w.getAttribute("aria-controls"),t=H(document.getElementById(e),m.elements);T(t)}),5);else if(S.offset<0){var L=o(k,!0),x=L[L.length-2],I=b.get(x);u(x,!1),T(I)}}null==c||c(p)}}var q="__RC_UTIL_PATH_SPLIT__",Y=function(e){return e.join(q)},X="rc-menu-more";function Q(){var e=_.useState({}),t=(0,o.Z)(e,2)[1],n=(0,_.useRef)(new Map),i=(0,_.useRef)(new Map),r=_.useState([]),s=(0,o.Z)(r,2),l=s[0],u=s[1],c=(0,_.useRef)(0),h=(0,_.useRef)(!1),d=(0,_.useCallback)((function(e,r){var s=Y(r);i.current.set(s,e),n.current.set(e,s),c.current+=1;var a,o=c.current;a=function(){o===c.current&&(h.current||t({}))},Promise.resolve().then(a)}),[]),f=(0,_.useCallback)((function(e,t){var r=Y(t);i.current.delete(r),n.current.delete(e)}),[]),p=(0,_.useCallback)((function(e){u(e)}),[]),g=(0,_.useCallback)((function(e,t){var i=n.current.get(e)||"",r=i.split(q);return t&&l.includes(r[0])&&r.unshift(X),r}),[l]),m=(0,_.useCallback)((function(e,t){return e.filter((function(e){return void 0!==e})).some((function(e){return g(e,!0).includes(t)}))}),[g]),v=(0,_.useCallback)((function(e){var t="".concat(n.current.get(e)).concat(q),r=new Set;return(0,a.Z)(i.current.keys()).forEach((function(e){e.startsWith(t)&&r.add(i.current.get(e))})),r}),[]);return _.useEffect((function(){return function(){h.current=!0}}),[]),{registerPath:d,unregisterPath:f,refreshOverflowKeys:p,isSubPathKey:m,getKeyPath:g,getKeys:function(){var e=(0,a.Z)(n.current.keys());return l.length&&e.push(X),e},getSubPathKeys:v}}function J(e){var t=_.useRef(e);t.current=e;var n=_.useCallback((function(){for(var e,n=arguments.length,i=new Array(n),r=0;r<n;r++)i[r]=arguments[r];return null===(e=t.current)||void 0===e?void 0:e.call.apply(e,[t].concat(i))}),[]);return e?n:void 0}var ee=Math.random().toFixed(5).toString().slice(2),te=0;var ne=n(67732),ie=n(83652),re=n(42403),se=n(158),ae=n(2738),oe=n(8654);function le(e,t,n,i){var r=_.useContext(w),s=r.activeKey,a=r.onActive,o=r.onInactive,l={active:s===e};return t||(l.onMouseEnter=function(t){null==n||n({key:e,domEvent:t}),a(e)},l.onMouseLeave=function(t){null==i||i({key:e,domEvent:t}),o(e)}),l}function ue(e){var t=_.useContext(w),n=t.mode,i=t.rtl,r=t.inlineIndent;if("inline"!==n)return null;return i?{paddingRight:e*r}:{paddingLeft:e*r}}function ce(e){var t,n=e.icon,i=e.props,r=e.children;return null===n||!1===n?null:("function"==typeof n?t=_.createElement(n,(0,s.Z)({},i)):"boolean"!=typeof n&&(t=n),t||r||null)}var he=["item"];function de(e){var t=e.item,n=(0,l.Z)(e,he);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."),t}}),n}var fe=["title","attribute","elementRef"],pe=["style","className","eventKey","warnKey","disabled","itemIcon","children","role","onMouseEnter","onMouseLeave","onClick","onKeyDown","onFocus"],_e=["active"],ge=function(e){(0,re.Z)(n,e);var t=(0,se.Z)(n);function n(){return(0,ne.Z)(this,n),t.apply(this,arguments)}return(0,ie.Z)(n,[{key:"render",value:function(){var e=this.props,t=e.title,n=e.attribute,r=e.elementRef,s=(0,l.Z)(e,fe),a=(0,ae.Z)(s,["eventKey","popupClassName","popupOffset","onTitleClick"]);return(0,p.ZP)(!n,"`attribute` of Menu.Item is deprecated. Please pass attribute directly."),_.createElement(h.Z.Item,(0,i.Z)({},n,{title:"string"==typeof t?t:void 0},a,{ref:r}))}}]),n}(_.Component),me=_.forwardRef((function(e,t){var n=e.style,o=e.className,u=e.eventKey,h=(e.warnKey,e.disabled),d=e.itemIcon,f=e.children,p=e.role,g=e.onMouseEnter,m=e.onMouseLeave,v=e.onClick,b=e.onKeyDown,E=e.onFocus,k=(0,l.Z)(e,pe),S=y(u),T=_.useContext(w),A=T.prefixCls,C=T.onItemClick,L=T.disabled,I=T.overflowDisabled,D=T.itemIcon,P=T.selectedKeys,M=T.onActive,N=_.useContext(x)._internalRenderMenuItem,F="".concat(A,"-item"),B=_.useRef(),U=_.useRef(),K=L||h,$=(0,oe.x1)(t,U),G=R(u);var j=function(e){return{key:u,keyPath:(0,a.Z)(G).reverse(),item:B.current,domEvent:e}},V=d||D,Z=le(u,K,g,m),H=Z.active,z=(0,l.Z)(Z,_e),W=P.includes(u),q=ue(G.length),Y={};"option"===e.role&&(Y["aria-selected"]=W);var X=_.createElement(ge,(0,i.Z)({ref:B,elementRef:$,role:null===p?"none":p||"menuitem",tabIndex:h?null:-1,"data-menu-id":I&&S?null:S},(0,ae.Z)(k,["extra"]),z,Y,{component:"li","aria-disabled":h,style:(0,s.Z)((0,s.Z)({},q),n),className:c()(F,(0,r.Z)((0,r.Z)((0,r.Z)({},"".concat(F,"-active"),H),"".concat(F,"-selected"),W),"".concat(F,"-disabled"),K),o),onClick:function(e){if(!K){var t=j(e);null==v||v(de(t)),C(t)}},onKeyDown:function(e){if(null==b||b(e),e.which===O.Z.ENTER){var t=j(e);null==v||v(de(t)),C(t)}},onFocus:function(e){M(u),null==E||E(e)}}),f,_.createElement(ce,{props:(0,s.Z)((0,s.Z)({},e),{},{isSelected:W}),icon:V}));return N&&(X=N(X,e,{selected:W})),X}));function ve(e,t){var n=e.eventKey,r=A(),s=R(n);return _.useEffect((function(){if(r)return r.registerPath(n,s),function(){r.unregisterPath(n,s)}}),[s]),r?null:_.createElement(me,(0,i.Z)({},e,{ref:t}))}var ye=_.forwardRef(ve),be=["className","children"],Ee=function(e,t){var n=e.className,r=e.children,s=(0,l.Z)(e,be),a=_.useContext(w),o=a.prefixCls,u=a.mode,h=a.rtl;return _.createElement("ul",(0,i.Z)({className:c()(o,h&&"".concat(o,"-rtl"),"".concat(o,"-sub"),"".concat(o,"-").concat("inline"===u?"inline":"vertical"),n),role:"menu"},s,{"data-menu-list":!0,ref:t}),r)},we=_.forwardRef(Ee);we.displayName="SubMenuList";var ke=we,Se=n(11592);function Te(e,t){return(0,Se.Z)(e).map((function(e,n){if(_.isValidElement(e)){var i,r,s=e.key,o=null!==(i=null===(r=e.props)||void 0===r?void 0:r.eventKey)&&void 0!==i?i:s;null==o&&(o="tmp_key-".concat([].concat((0,a.Z)(t),[n]).join("-")));var l={key:o,eventKey:o};return _.cloneElement(e,l)}return e}))}var Ae=n(65030),Ce={adjustX:1,adjustY:1},Re={topLeft:{points:["bl","tl"],overflow:Ce},topRight:{points:["br","tr"],overflow:Ce},bottomLeft:{points:["tl","bl"],overflow:Ce},bottomRight:{points:["tr","br"],overflow:Ce},leftTop:{points:["tr","tl"],overflow:Ce},leftBottom:{points:["br","bl"],overflow:Ce},rightTop:{points:["tl","tr"],overflow:Ce},rightBottom:{points:["bl","br"],overflow:Ce}},Le={topLeft:{points:["bl","tl"],overflow:Ce},topRight:{points:["br","tr"],overflow:Ce},bottomLeft:{points:["tl","bl"],overflow:Ce},bottomRight:{points:["tr","br"],overflow:Ce},rightTop:{points:["tr","tl"],overflow:Ce},rightBottom:{points:["br","bl"],overflow:Ce},leftTop:{points:["tl","tr"],overflow:Ce},leftBottom:{points:["bl","br"],overflow:Ce}};function xe(e,t,n){return t||(n?n[e]||n.other:void 0)}var Ie={horizontal:"bottomLeft",vertical:"rightTop","vertical-left":"rightTop","vertical-right":"leftTop"};function De(e){var t=e.prefixCls,n=e.visible,i=e.children,a=e.popup,l=e.popupStyle,u=e.popupClassName,h=e.popupOffset,d=e.disabled,f=e.mode,p=e.onVisibleChange,g=_.useContext(w),m=g.getPopupContainer,v=g.rtl,y=g.subMenuOpenDelay,b=g.subMenuCloseDelay,E=g.builtinPlacements,k=g.triggerSubMenuAction,S=g.forceSubMenuRender,T=g.rootClassName,A=g.motion,C=g.defaultMotions,R=_.useState(!1),L=(0,o.Z)(R,2),x=L[0],I=L[1],D=v?(0,s.Z)((0,s.Z)({},Le),E):(0,s.Z)((0,s.Z)({},Re),E),P=Ie[f],O=xe(f,A,C),N=_.useRef(O);"inline"!==f&&(N.current=O);var F=(0,s.Z)((0,s.Z)({},N.current),{},{leavedClassName:"".concat(t,"-hidden"),removeOnLeave:!1,motionAppear:!0}),B=_.useRef();return _.useEffect((function(){return B.current=(0,M.Z)((function(){I(n)})),function(){M.Z.cancel(B.current)}}),[n]),_.createElement(Ae.Z,{prefixCls:t,popupClassName:c()("".concat(t,"-popup"),(0,r.Z)({},"".concat(t,"-rtl"),v),u,T),stretch:"horizontal"===f?"minWidth":null,getPopupContainer:m,builtinPlacements:D,popupPlacement:P,popupVisible:x,popup:a,popupStyle:l,popupAlign:h&&{offset:h},action:d?[]:[k],mouseEnterDelay:y,mouseLeaveDelay:b,onPopupVisibleChange:p,forceRender:S,popupMotion:F,fresh:!0},i)}var Pe=n(77900);function Oe(e){var t=e.id,n=e.open,r=e.keyPath,a=e.children,l="inline",u=_.useContext(w),c=u.prefixCls,h=u.forceSubMenuRender,d=u.motion,f=u.defaultMotions,p=u.mode,g=_.useRef(!1);g.current=p===l;var m=_.useState(!g.current),v=(0,o.Z)(m,2),y=v[0],b=v[1],E=!!g.current&&n;_.useEffect((function(){g.current&&b(!1)}),[p]);var S=(0,s.Z)({},xe(l,d,f));r.length>1&&(S.motionAppear=!1);var T=S.onVisibleChanged;return S.onVisibleChanged=function(e){return g.current||e||b(!0),null==T?void 0:T(e)},y?null:_.createElement(k,{mode:l,locked:!g.current},_.createElement(Pe.default,(0,i.Z)({visible:E},S,{forceRender:h,removeOnLeave:!1,leavedClassName:"".concat(c,"-hidden")}),(function(e){var n=e.className,i=e.style;return _.createElement(ke,{id:t,className:n,style:i},a)})))}var Me=["style","className","title","eventKey","warnKey","disabled","internalPopupClose","children","itemIcon","expandIcon","popupClassName","popupOffset","popupStyle","onClick","onMouseEnter","onMouseLeave","onTitleClick","onTitleMouseEnter","onTitleMouseLeave"],Ne=["active"],Fe=_.forwardRef((function(e,t){var n=e.style,a=e.className,u=e.title,d=e.eventKey,f=(e.warnKey,e.disabled),p=e.internalPopupClose,g=e.children,m=e.itemIcon,v=e.expandIcon,b=e.popupClassName,E=e.popupOffset,S=e.popupStyle,T=e.onClick,A=e.onMouseEnter,C=e.onMouseLeave,I=e.onTitleClick,D=e.onTitleMouseEnter,P=e.onTitleMouseLeave,O=(0,l.Z)(e,Me),M=y(d),N=_.useContext(w),F=N.prefixCls,B=N.mode,U=N.openKeys,K=N.disabled,$=N.overflowDisabled,G=N.activeKey,j=N.selectedKeys,V=N.itemIcon,Z=N.expandIcon,H=N.onItemClick,z=N.onOpenChange,W=N.onActive,q=_.useContext(x)._internalRenderSubMenuItem,Y=_.useContext(L).isSubPathKey,X=R(),Q="".concat(F,"-submenu"),ee=K||f,te=_.useRef(),ne=_.useRef();var ie=null!=m?m:V,re=null!=v?v:Z,se=U.includes(d),ae=!$&&se,oe=Y(j,d),he=le(d,ee,D,P),fe=he.active,pe=(0,l.Z)(he,Ne),_e=_.useState(!1),ge=(0,o.Z)(_e,2),me=ge[0],ve=ge[1],ye=function(e){ee||ve(e)},be=_.useMemo((function(){return fe||"inline"!==B&&(me||Y([G],d))}),[B,fe,G,me,d,Y]),Ee=ue(X.length),we=J((function(e){null==T||T(de(e)),H(e)})),Se=M&&"".concat(M,"-popup"),Te=_.useMemo((function(){return _.createElement(ce,{icon:"horizontal"!==B?re:void 0,props:(0,s.Z)((0,s.Z)({},e),{},{isOpen:ae,isSubMenu:!0})},_.createElement("i",{className:"".concat(Q,"-arrow")}))}),[B,re,e,ae,Q]),Ae=_.createElement("div",(0,i.Z)({role:"menuitem",style:Ee,className:"".concat(Q,"-title"),tabIndex:ee?null:-1,ref:te,title:"string"==typeof u?u:null,"data-menu-id":$&&M?null:M,"aria-expanded":ae,"aria-haspopup":!0,"aria-controls":Se,"aria-disabled":ee,onClick:function(e){ee||(null==I||I({key:d,domEvent:e}),"inline"===B&&z(d,!se))},onFocus:function(){W(d)}},pe),u,Te),Ce=_.useRef(B);if("inline"!==B&&X.length>1?Ce.current="vertical":Ce.current=B,!$){var Re=Ce.current;Ae=_.createElement(De,{mode:Re,prefixCls:Q,visible:!p&&ae&&"inline"!==B,popupClassName:b,popupOffset:E,popupStyle:S,popup:_.createElement(k,{mode:"horizontal"===Re?"vertical":Re},_.createElement(ke,{id:Se,ref:ne},g)),disabled:ee,onVisibleChange:function(e){"inline"!==B&&z(d,e)}},Ae)}var Le=_.createElement(h.Z.Item,(0,i.Z)({ref:t,role:"none"},O,{component:"li",style:n,className:c()(Q,"".concat(Q,"-").concat(B),a,(0,r.Z)((0,r.Z)((0,r.Z)((0,r.Z)({},"".concat(Q,"-open"),ae),"".concat(Q,"-active"),be),"".concat(Q,"-selected"),oe),"".concat(Q,"-disabled"),ee)),onMouseEnter:function(e){ye(!0),null==A||A({key:d,domEvent:e})},onMouseLeave:function(e){ye(!1),null==C||C({key:d,domEvent:e})}}),Ae,!$&&_.createElement(Oe,{id:Se,open:ae,keyPath:X},g));return q&&(Le=q(Le,e,{selected:oe,active:be,open:ae,disabled:ee})),_.createElement(k,{onItemClick:we,mode:"horizontal"===B?"vertical":B,itemIcon:ie,expandIcon:re},Le)}));var Be=_.forwardRef((function(e,t){var n,r=e.eventKey,s=e.children,a=R(r),o=Te(s,a),l=A();return _.useEffect((function(){if(l)return l.registerPath(r,a),function(){l.unregisterPath(r,a)}}),[a]),n=l?o:_.createElement(Fe,(0,i.Z)({ref:t},e),o),_.createElement(C.Provider,{value:a},n)})),Ue=n(76190);function Ke(e){var t=e.className,n=e.style,i=_.useContext(w).prefixCls;return A()?null:_.createElement("li",{role:"separator",className:c()("".concat(i,"-item-divider"),t),style:n})}var $e=["className","title","eventKey","children"],Ge=_.forwardRef((function(e,t){var n=e.className,r=e.title,s=(e.eventKey,e.children),a=(0,l.Z)(e,$e),o=_.useContext(w).prefixCls,u="".concat(o,"-item-group");return _.createElement("li",(0,i.Z)({ref:t,role:"presentation"},a,{onClick:function(e){return e.stopPropagation()},className:c()(u,n)}),_.createElement("div",{role:"presentation",className:"".concat(u,"-title"),title:"string"==typeof r?r:void 0},r),_.createElement("ul",{role:"group",className:"".concat(u,"-list")},s))}));var je=_.forwardRef((function(e,t){var n=e.eventKey,r=Te(e.children,R(n));return A()?r:_.createElement(Ge,(0,i.Z)({ref:t},(0,ae.Z)(e,["warnKey"])),r)})),Ve=["label","children","key","type","extra"];function Ze(e,t,n){var r=t.item,s=t.group,a=t.submenu,o=t.divider;return(e||[]).map((function(e,u){if(e&&"object"===(0,Ue.Z)(e)){var c=e,h=c.label,d=c.children,f=c.key,p=c.type,g=c.extra,m=(0,l.Z)(c,Ve),v=null!=f?f:"tmp-".concat(u);return d||"group"===p?"group"===p?_.createElement(s,(0,i.Z)({key:v},m,{title:h}),Ze(d,t,n)):_.createElement(a,(0,i.Z)({key:v},m,{title:h}),Ze(d,t,n)):"divider"===p?_.createElement(o,(0,i.Z)({key:v},m)):_.createElement(r,(0,i.Z)({key:v},m,{extra:g}),h,(!!g||0===g)&&_.createElement("span",{className:"".concat(n,"-item-extra")},g))}return null})).filter((function(e){return e}))}function He(e,t,n,i,r){var a=e,o=(0,s.Z)({divider:Ke,item:ye,group:je,submenu:Be},i);return t&&(a=Ze(t,o,r)),Te(a,n)}var ze=["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"],We=[],qe=_.forwardRef((function(e,t){var n,u=e,p=u.prefixCls,v=void 0===p?"rc-menu":p,y=u.rootClassName,b=u.style,E=u.className,w=u.tabIndex,S=void 0===w?0:w,A=u.items,C=u.children,R=u.direction,I=u.id,D=u.mode,P=void 0===D?"vertical":D,O=u.inlineCollapsed,M=u.disabled,N=u.disabledOverflow,F=u.subMenuOpenDelay,B=void 0===F?.1:F,U=u.subMenuCloseDelay,K=void 0===U?.1:U,$=u.forceSubMenuRender,G=u.defaultOpenKeys,j=u.openKeys,V=u.activeKey,H=u.defaultActiveFirst,q=u.selectable,Y=void 0===q||q,ne=u.multiple,ie=void 0!==ne&&ne,re=u.defaultSelectedKeys,se=u.selectedKeys,ae=u.onSelect,oe=u.onDeselect,le=u.inlineIndent,ue=void 0===le?24:le,ce=u.motion,he=u.defaultMotions,fe=u.triggerSubMenuAction,pe=void 0===fe?"hover":fe,_e=u.builtinPlacements,ge=u.itemIcon,me=u.expandIcon,ve=u.overflowedIndicator,be=void 0===ve?"...":ve,Ee=u.overflowedIndicatorPopupClassName,we=u.getPopupContainer,ke=u.onClick,Se=u.onOpenChange,Te=u.onKeyDown,Ae=(u.openAnimation,u.openTransitionName,u._internalRenderMenuItem),Ce=u._internalRenderSubMenuItem,Re=u._internalComponents,Le=(0,l.Z)(u,ze),xe=_.useMemo((function(){return[He(C,A,We,Re,v),He(C,A,We,{},v)]}),[C,A,Re]),Ie=(0,o.Z)(xe,2),De=Ie[0],Pe=Ie[1],Oe=_.useState(!1),Me=(0,o.Z)(Oe,2),Ne=Me[0],Fe=Me[1],Ue=_.useRef(),Ke=function(e){var t=(0,d.Z)(e,{value:e}),n=(0,o.Z)(t,2),i=n[0],r=n[1];return _.useEffect((function(){te+=1;var e="".concat(ee,"-").concat(te);r("rc-menu-uuid-".concat(e))}),[]),i}(I),$e="rtl"===R;var Ge=(0,d.Z)(G,{value:j,postState:function(e){return e||We}}),je=(0,o.Z)(Ge,2),Ve=je[0],Ze=je[1],qe=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];function n(){Ze(e),null==Se||Se(e)}t?(0,g.flushSync)(n):n()},Ye=_.useState(Ve),Xe=(0,o.Z)(Ye,2),Qe=Xe[0],Je=Xe[1],et=_.useRef(!1),tt=_.useMemo((function(){return"inline"!==P&&"vertical"!==P||!O?[P,!1]:["vertical",O]}),[P,O]),nt=(0,o.Z)(tt,2),it=nt[0],rt=nt[1],st="inline"===it,at=_.useState(it),ot=(0,o.Z)(at,2),lt=ot[0],ut=ot[1],ct=_.useState(rt),ht=(0,o.Z)(ct,2),dt=ht[0],ft=ht[1];_.useEffect((function(){ut(it),ft(rt),et.current&&(st?Ze(Qe):qe(We))}),[it,rt]);var pt=_.useState(0),_t=(0,o.Z)(pt,2),gt=_t[0],mt=_t[1],vt=gt>=De.length-1||"horizontal"!==lt||N;_.useEffect((function(){st&&Je(Ve)}),[Ve]),_.useEffect((function(){return et.current=!0,function(){et.current=!1}}),[]);var yt=Q(),bt=yt.registerPath,Et=yt.unregisterPath,wt=yt.refreshOverflowKeys,kt=yt.isSubPathKey,St=yt.getKeyPath,Tt=yt.getKeys,At=yt.getSubPathKeys,Ct=_.useMemo((function(){return{registerPath:bt,unregisterPath:Et}}),[bt,Et]),Rt=_.useMemo((function(){return{isSubPathKey:kt}}),[kt]);_.useEffect((function(){wt(vt?We:De.slice(gt+1).map((function(e){return e.key})))}),[gt,vt]);var Lt=(0,d.Z)(V||H&&(null===(n=De[0])||void 0===n?void 0:n.key),{value:V}),xt=(0,o.Z)(Lt,2),It=xt[0],Dt=xt[1],Pt=J((function(e){Dt(e)})),Ot=J((function(){Dt(void 0)}));(0,_.useImperativeHandle)(t,(function(){return{list:Ue.current,focus:function(e){var t,n,i=Tt(),r=z(i,Ke),s=r.elements,a=r.key2element,o=r.element2key,l=Z(Ue.current,s),u=null!=It?It:l[0]?o.get(l[0]):null===(t=De.find((function(e){return!e.props.disabled})))||void 0===t?void 0:t.key,c=a.get(u);u&&c&&(null==c||null===(n=c.focus)||void 0===n||n.call(c,e))}}}));var Mt=(0,d.Z)(re||[],{value:se,postState:function(e){return Array.isArray(e)?e:null==e?We:[e]}}),Nt=(0,o.Z)(Mt,2),Ft=Nt[0],Bt=Nt[1],Ut=J((function(e){null==ke||ke(de(e)),function(e){if(Y){var t,n=e.key,i=Ft.includes(n);t=ie?i?Ft.filter((function(e){return e!==n})):[].concat((0,a.Z)(Ft),[n]):[n],Bt(t);var r=(0,s.Z)((0,s.Z)({},e),{},{selectedKeys:t});i?null==oe||oe(r):null==ae||ae(r)}!ie&&Ve.length&&"inline"!==lt&&qe(We)}(e)})),Kt=J((function(e,t){var n=Ve.filter((function(t){return t!==e}));if(t)n.push(e);else if("inline"!==lt){var i=At(e);n=n.filter((function(e){return!i.has(e)}))}(0,f.Z)(Ve,n,!0)||qe(n,!0)})),$t=W(lt,It,$e,Ke,Ue,Tt,St,Dt,(function(e,t){var n=null!=t?t:!Ve.includes(e);Kt(e,n)}),Te);_.useEffect((function(){Fe(!0)}),[]);var Gt=_.useMemo((function(){return{_internalRenderMenuItem:Ae,_internalRenderSubMenuItem:Ce}}),[Ae,Ce]),jt="horizontal"!==lt||N?De:De.map((function(e,t){return _.createElement(k,{key:e.key,overflowDisabled:t>gt},e)})),Vt=_.createElement(h.Z,(0,i.Z)({id:I,ref:Ue,prefixCls:"".concat(v,"-overflow"),component:"ul",itemComponent:ye,className:c()(v,"".concat(v,"-root"),"".concat(v,"-").concat(lt),E,(0,r.Z)((0,r.Z)({},"".concat(v,"-inline-collapsed"),dt),"".concat(v,"-rtl"),$e),y),dir:R,style:b,role:"menu",tabIndex:S,data:jt,renderRawItem:function(e){return e},renderRawRest:function(e){var t=e.length,n=t?De.slice(-t):null;return _.createElement(Be,{eventKey:X,title:be,disabled:vt,internalPopupClose:0===t,popupClassName:Ee},n)},maxCount:"horizontal"!==lt||N?h.Z.INVALIDATE:h.Z.RESPONSIVE,ssr:"full","data-menu-list":!0,onVisibleChange:function(e){mt(e)},onKeyDown:$t},Le));return _.createElement(x.Provider,{value:Gt},_.createElement(m.Provider,{value:Ke},_.createElement(k,{prefixCls:v,rootClassName:y,mode:lt,openKeys:Ve,rtl:$e,disabled:M,motion:Ne?ce:null,defaultMotions:Ne?he:null,activeKey:It,onActive:Pt,onInactive:Ot,selectedKeys:Ft,inlineIndent:ue,subMenuOpenDelay:B,subMenuCloseDelay:K,forceSubMenuRender:$,builtinPlacements:_e,triggerSubMenuAction:pe,getPopupContainer:we,itemIcon:ge,expandIcon:me,onItemClick:Ut,onOpenChange:Kt},_.createElement(L.Provider,{value:Rt},Vt),_.createElement("div",{style:{display:"none"},"aria-hidden":!0},_.createElement(T.Provider,{value:Ct},Pe)))))})),Ye=qe;Ye.Item=ye,Ye.SubMenu=Be,Ye.ItemGroup=je,Ye.Divider=Ke;var Xe=Ye},83836:function(e,t,n){"use strict";n.d(t,{Z:function(){return M}});var i=n(54476),r=n(33885),s=n(42978),a=n(75931),o=n(59301),l=n(92310),u=n.n(l),c=n(29301),h=n(34280),d=["prefixCls","invalidate","item","renderItem","responsive","responsiveDisabled","registerSize","itemKey","className","style","children","display","order","component"],f=void 0;function p(e,t){var n=e.prefixCls,s=e.invalidate,l=e.item,h=e.renderItem,p=e.responsive,_=e.responsiveDisabled,g=e.registerSize,m=e.itemKey,v=e.className,y=e.style,b=e.children,E=e.display,w=e.order,k=e.component,S=void 0===k?"div":k,T=(0,a.Z)(e,d),A=p&&!E;function C(e){g(m,e)}o.useEffect((function(){return function(){C(null)}}),[]);var R,L=h&&l!==f?h(l,{index:w}):b;s||(R={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 x={};A&&(x["aria-hidden"]=!0);var I=o.createElement(S,(0,i.Z)({className:u()(!s&&n,v),style:(0,r.Z)((0,r.Z)({},R),y)},x,T,{ref:t}),L);return p&&(I=o.createElement(c.Z,{onResize:function(e){C(e.offsetWidth)},disabled:_},I)),I}var _=o.forwardRef(p);_.displayName="Item";var g=_,m=n(6089),v=n(4676),y=n(16089);function b(){var e=o.useRef(null);return function(t){e.current||(e.current=[],function(e){if("undefined"==typeof MessageChannel)(0,y.Z)(e);else{var t=new MessageChannel;t.port1.onmessage=function(){return e()},t.port2.postMessage(void 0)}}((function(){(0,v.unstable_batchedUpdates)((function(){e.current.forEach((function(e){e()})),e.current=null}))}))),e.current.push(t)}}function E(e,t){var n=o.useState(t),i=(0,s.Z)(n,2),r=i[0],a=i[1];return[r,(0,m.Z)((function(t){e((function(){a(t)}))}))]}var w=o.createContext(null),k=["component"],S=["className"],T=["className"],A=function(e,t){var n=o.useContext(w);if(!n){var r=e.component,s=void 0===r?"div":r,l=(0,a.Z)(e,k);return o.createElement(s,(0,i.Z)({},l,{ref:t}))}var c=n.className,h=(0,a.Z)(n,S),d=e.className,f=(0,a.Z)(e,T);return o.createElement(w.Provider,{value:null},o.createElement(g,(0,i.Z)({ref:t,className:u()(c,d)},h,f)))},C=o.forwardRef(A);C.displayName="RawItem";var R=C,L=["prefixCls","data","renderItem","renderRawItem","itemKey","itemWidth","ssr","style","className","maxCount","renderRest","renderRawRest","prefix","suffix","component","itemComponent","onVisibleChange"],x="responsive",I="invalidate";function D(e){return"+ ".concat(e.length," ...")}function P(e,t){var n=e.prefixCls,l=void 0===n?"rc-overflow":n,d=e.data,f=void 0===d?[]:d,p=e.renderItem,_=e.renderRawItem,m=e.itemKey,v=e.itemWidth,y=void 0===v?10:v,k=e.ssr,S=e.style,T=e.className,A=e.maxCount,C=e.renderRest,R=e.renderRawRest,P=e.prefix,O=e.suffix,M=e.component,N=void 0===M?"div":M,F=e.itemComponent,B=e.onVisibleChange,U=(0,a.Z)(e,L),K="full"===k,$=b(),G=E($,null),j=(0,s.Z)(G,2),V=j[0],Z=j[1],H=V||0,z=E($,new Map),W=(0,s.Z)(z,2),q=W[0],Y=W[1],X=E($,0),Q=(0,s.Z)(X,2),J=Q[0],ee=Q[1],te=E($,0),ne=(0,s.Z)(te,2),ie=ne[0],re=ne[1],se=E($,0),ae=(0,s.Z)(se,2),oe=ae[0],le=ae[1],ue=E($,0),ce=(0,s.Z)(ue,2),he=ce[0],de=ce[1],fe=(0,o.useState)(null),pe=(0,s.Z)(fe,2),_e=pe[0],ge=pe[1],me=(0,o.useState)(null),ve=(0,s.Z)(me,2),ye=ve[0],be=ve[1],Ee=o.useMemo((function(){return null===ye&&K?Number.MAX_SAFE_INTEGER:ye||0}),[ye,V]),we=(0,o.useState)(!1),ke=(0,s.Z)(we,2),Se=ke[0],Te=ke[1],Ae="".concat(l,"-item"),Ce=Math.max(J,ie),Re=A===x,Le=f.length&&Re,xe=A===I,Ie=Le||"number"==typeof A&&f.length>A,De=(0,o.useMemo)((function(){var e=f;return Le?e=null===V&&K?f:f.slice(0,Math.min(f.length,H/y)):"number"==typeof A&&(e=f.slice(0,A)),e}),[f,y,V,A,Le]),Pe=(0,o.useMemo)((function(){return Le?f.slice(Ee+1):f.slice(De.length)}),[f,De,Le,Ee]),Oe=(0,o.useCallback)((function(e,t){var n;return"function"==typeof m?m(e):null!==(n=m&&(null==e?void 0:e[m]))&&void 0!==n?n:t}),[m]),Me=(0,o.useCallback)(p||function(e){return e},[p]);function Ne(e,t,n){(ye!==e||void 0!==t&&t!==_e)&&(be(e),n||(Te(e<f.length-1),null==B||B(e)),void 0!==t&&ge(t))}function Fe(e,t){Y((function(n){var i=new Map(n);return null===t?i.delete(e):i.set(e,t),i}))}function Be(e){return q.get(Oe(De[e],e))}(0,h.Z)((function(){if(H&&"number"==typeof Ce&&De){var e=oe+he,t=De.length,n=t-1;if(!t)return void Ne(0,null);for(var i=0;i<t;i+=1){var r=Be(i);if(K&&(r=r||0),void 0===r){Ne(i-1,void 0,!0);break}if(e+=r,0===n&&e<=H||i===n-1&&e+Be(n)<=H){Ne(n,null);break}if(e+Ce>H){Ne(i-1,e-r-he+ie);break}}O&&Be(0)+he>H&&ge(null)}}),[H,q,ie,oe,he,Oe,De]);var Ue=Se&&!!Pe.length,Ke={};null!==_e&&Le&&(Ke={position:"absolute",left:_e,top:0});var $e={prefixCls:Ae,responsive:Le,component:F,invalidate:xe},Ge=_?function(e,t){var n=Oe(e,t);return o.createElement(w.Provider,{key:n,value:(0,r.Z)((0,r.Z)({},$e),{},{order:t,item:e,itemKey:n,registerSize:Fe,display:t<=Ee})},_(e,t))}:function(e,t){var n=Oe(e,t);return o.createElement(g,(0,i.Z)({},$e,{order:t,key:n,item:e,renderItem:Me,itemKey:n,registerSize:Fe,display:t<=Ee}))},je={order:Ue?Ee:Number.MAX_SAFE_INTEGER,className:"".concat(Ae,"-rest"),registerSize:function(e,t){re(t),ee(ie)},display:Ue},Ve=C||D,Ze=R?o.createElement(w.Provider,{value:(0,r.Z)((0,r.Z)({},$e),je)},R(Pe)):o.createElement(g,(0,i.Z)({},$e,je),"function"==typeof Ve?Ve(Pe):Ve),He=o.createElement(N,(0,i.Z)({className:u()(!xe&&l,T),style:S,ref:t},U),P&&o.createElement(g,(0,i.Z)({},$e,{responsive:Re,responsiveDisabled:!Le,order:-1,className:"".concat(Ae,"-prefix"),registerSize:function(e,t){le(t)},display:!0}),P),De.map(Ge),Ie?Ze:null,O&&o.createElement(g,(0,i.Z)({},$e,{responsive:Re,responsiveDisabled:!Le,order:Ee,className:"".concat(Ae,"-suffix"),registerSize:function(e,t){de(t)},display:!0,style:Ke}),O));return Re?o.createElement(c.Z,{onResize:function(e,t){Z(t.clientWidth)},disabled:!Le},He):He}var O=o.forwardRef(P);O.displayName="Overflow",O.Item=R,O.RESPONSIVE=x,O.INVALIDATE=I;var M=O},738:function(e,t,n){"use strict";n.d(t,{Z:function(){return m}});var i=n(54476),r=n(20068),s=n(42978),a=n(75931),o=n(92310),l=n.n(o),u=n(18929),c=n(10228),h=n(26112),d=n(59301);function f(e,t){var n=e.disabled,i=e.prefixCls,r=e.character,s=e.characterRender,a=e.index,o=e.count,u=e.value,h=e.allowHalf,f=e.focused,p=e.onHover,_=e.onClick,g=a+1,m=new Set([i]);0===u&&0===a&&f?m.add("".concat(i,"-focused")):h&&u+.5>=g&&u<g?(m.add("".concat(i,"-half")),m.add("".concat(i,"-active")),f&&m.add("".concat(i,"-focused"))):(g<=u?m.add("".concat(i,"-full")):m.add("".concat(i,"-zero")),g===u&&f&&m.add("".concat(i,"-focused")));var v="function"==typeof r?r(e):r,y=d.createElement("li",{className:l()(Array.from(m)),ref:t},d.createElement("div",{onClick:n?null:function(e){_(e,a)},onKeyDown:n?null:function(e){e.keyCode===c.Z.ENTER&&_(e,a)},onMouseMove:n?null:function(e){p(e,a)},role:"radio","aria-checked":u>a?"true":"false","aria-posinset":a+1,"aria-setsize":o,tabIndex:n?-1:0},d.createElement("div",{className:"".concat(i,"-first")},v),d.createElement("div",{className:"".concat(i,"-second")},v)));return s&&(y=s(y,e)),y}var p=d.forwardRef(f);var _=["prefixCls","className","defaultValue","value","count","allowHalf","allowClear","keyboard","character","characterRender","disabled","direction","tabIndex","autoFocus","onHoverChange","onChange","onFocus","onBlur","onKeyDown","onMouseLeave"];function g(e,t){var n,o=e.prefixCls,f=void 0===o?"rc-rate":o,g=e.className,m=e.defaultValue,v=e.value,y=e.count,b=void 0===y?5:y,E=e.allowHalf,w=void 0!==E&&E,k=e.allowClear,S=void 0===k||k,T=e.keyboard,A=void 0===T||T,C=e.character,R=void 0===C?"★":C,L=e.characterRender,x=e.disabled,I=e.direction,D=void 0===I?"ltr":I,P=e.tabIndex,O=void 0===P?0:P,M=e.autoFocus,N=e.onHoverChange,F=e.onChange,B=e.onFocus,U=e.onBlur,K=e.onKeyDown,$=e.onMouseLeave,G=(0,a.Z)(e,_),j=(n=d.useRef({}),[function(e){return n.current[e]},function(e){return function(t){n.current[e]=t}}]),V=(0,s.Z)(j,2),Z=V[0],H=V[1],z=d.useRef(null),W=function(){var e;x||(null===(e=z.current)||void 0===e||e.focus())};d.useImperativeHandle(t,(function(){return{focus:W,blur:function(){var e;x||(null===(e=z.current)||void 0===e||e.blur())}}}));var q=(0,u.Z)(m||0,{value:v}),Y=(0,s.Z)(q,2),X=Y[0],Q=Y[1],J=(0,u.Z)(null),ee=(0,s.Z)(J,2),te=ee[0],ne=ee[1],ie=function(e,t){var n,i,r,s,a="rtl"===D,o=e+1;if(w){var l=Z(e),u=(i=function(e){var t,n,i=e.ownerDocument,r=i.body,s=i&&i.documentElement,a=e.getBoundingClientRect();return t=a.left,n=a.top,{left:t-=s.clientLeft||r.clientLeft||0,top:n-=s.clientTop||r.clientTop||0}}(n=l),r=n.ownerDocument,s=r.defaultView||r.parentWindow,i.left+=function(e){var t=e.pageXOffset,n="scrollLeft";if("number"!=typeof t){var i=e.document;"number"!=typeof(t=i.documentElement[n])&&(t=i.body[n])}return t}(s),i.left),c=l.clientWidth;(a&&t-u>c/2||!a&&t-u<c/2)&&(o-=.5)}return o},re=function(e){Q(e),null==F||F(e)},se=d.useState(!1),ae=(0,s.Z)(se,2),oe=ae[0],le=ae[1],ue=d.useState(null),ce=(0,s.Z)(ue,2),he=ce[0],de=ce[1],fe=function(e,t){var n=ie(t,e.pageX);n!==te&&(de(n),ne(null)),null==N||N(n)},pe=function(e){x||(de(null),ne(null),null==N||N(void 0)),e&&(null==$||$(e))},_e=function(e,t){var n=ie(t,e.pageX),i=!1;S&&(i=n===X),pe(),re(i?0:n),ne(i?n:null)};d.useEffect((function(){M&&!x&&W()}),[]);var ge=new Array(b).fill(0).map((function(e,t){return d.createElement(p,{ref:H(t),index:t,count:b,disabled:x,prefixCls:"".concat(f,"-star"),allowHalf:w,value:null===he?X:he,onClick:_e,onHover:fe,key:e||t,character:R,characterRender:L,focused:oe})})),me=l()(f,g,(0,r.Z)((0,r.Z)({},"".concat(f,"-disabled"),x),"".concat(f,"-rtl"),"rtl"===D));return d.createElement("ul",(0,i.Z)({className:me,onMouseLeave:pe,tabIndex:x?-1:O,onFocus:x?null:function(){le(!0),null==B||B()},onBlur:x?null:function(){le(!1),null==U||U()},onKeyDown:x?null:function(e){var t=e.keyCode,n="rtl"===D,i=w?.5:1;A&&(t===c.Z.RIGHT&&X<b&&!n?(re(X+i),e.preventDefault()):t===c.Z.LEFT&&X>0&&!n||t===c.Z.RIGHT&&X>0&&n?(re(X-i),e.preventDefault()):t===c.Z.LEFT&&X<b&&n&&(re(X+i),e.preventDefault())),null==K||K(e)},ref:z},(0,h.Z)(G,{aria:!0,data:!0,attr:!0})),ge)}var m=d.forwardRef(g)},29301:function(e,t,n){"use strict";n.d(t,{Z:function(){return k}});var i=n(54476),r=n(59301),s=n(11592),a=(n(48736),n(33885)),o=n(76190),l=n(76846),u=n(8654),c=r.createContext(null);var h=n(76374),d=new Map;var f=new h.Z((function(e){e.forEach((function(e){var t,n=e.target;null===(t=d.get(n))||void 0===t||t.forEach((function(e){return e(n)}))}))}));var p=n(67732),_=n(83652),g=n(42403),m=n(158),v=function(e){(0,g.Z)(n,e);var t=(0,m.Z)(n);function n(){return(0,p.Z)(this,n),t.apply(this,arguments)}return(0,_.Z)(n,[{key:"render",value:function(){return this.props.children}}]),n}(r.Component);function y(e,t){var n=e.children,i=e.disabled,s=r.useRef(null),h=r.useRef(null),p=r.useContext(c),_="function"==typeof n,g=_?n(s):n,m=r.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),y=!_&&r.isValidElement(g)&&(0,u.Yr)(g),b=y?(0,u.C4)(g):null,E=(0,u.x1)(b,s),w=function(){var e;return(0,l.ZP)(s.current)||(s.current&&"object"===(0,o.Z)(s.current)?(0,l.ZP)(null===(e=s.current)||void 0===e?void 0:e.nativeElement):null)||(0,l.ZP)(h.current)};r.useImperativeHandle(t,(function(){return w()}));var k=r.useRef(e);k.current=e;var S=r.useCallback((function(e){var t=k.current,n=t.onResize,i=t.data,r=e.getBoundingClientRect(),s=r.width,o=r.height,l=e.offsetWidth,u=e.offsetHeight,c=Math.floor(s),h=Math.floor(o);if(m.current.width!==c||m.current.height!==h||m.current.offsetWidth!==l||m.current.offsetHeight!==u){var d={width:c,height:h,offsetWidth:l,offsetHeight:u};m.current=d;var f=l===Math.round(s)?s:l,_=u===Math.round(o)?o:u,g=(0,a.Z)((0,a.Z)({},d),{},{offsetWidth:f,offsetHeight:_});null==p||p(g,e,i),n&&Promise.resolve().then((function(){n(g,e)}))}}),[]);return r.useEffect((function(){var e,t,n=w();return n&&!i&&(e=n,t=S,d.has(e)||(d.set(e,new Set),f.observe(e)),d.get(e).add(t)),function(){return function(e,t){d.has(e)&&(d.get(e).delete(t),d.get(e).size||(f.unobserve(e),d.delete(e)))}(n,S)}}),[s.current,i]),r.createElement(v,{ref:h},y?r.cloneElement(g,{ref:E}):g)}var b=r.forwardRef(y);function E(e,t){var n=e.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)({},e,{key:a,ref:0===s?t:void 0}),n)}))}var w=r.forwardRef(E);w.Collection=function(e){var t=e.children,n=e.onBatchResize,i=r.useRef(0),s=r.useRef([]),a=r.useContext(c),o=r.useCallback((function(e,t,r){i.current+=1;var o=i.current;s.current.push({size:e,element:t,data:r}),Promise.resolve().then((function(){o===i.current&&(null==n||n(s.current),s.current=[])})),null==a||a(e,t,r)}),[n,a]);return r.createElement(c.Provider,{value:o},t)};var k=w},63158:function(e,t,n){"use strict";var i=n(54476),r=n(20068),s=n(42978),a=n(75931),o=n(59301),l=n(92310),u=n.n(l),c=n(18929),h=n(10228),d=["prefixCls","className","checked","defaultChecked","disabled","loadingIcon","checkedChildren","unCheckedChildren","onClick","onChange","onKeyDown"],f=o.forwardRef((function(e,t){var n,l=e.prefixCls,f=void 0===l?"rc-switch":l,p=e.className,_=e.checked,g=e.defaultChecked,m=e.disabled,v=e.loadingIcon,y=e.checkedChildren,b=e.unCheckedChildren,E=e.onClick,w=e.onChange,k=e.onKeyDown,S=(0,a.Z)(e,d),T=(0,c.Z)(!1,{value:_,defaultValue:g}),A=(0,s.Z)(T,2),C=A[0],R=A[1];function L(e,t){var n=C;return m||(R(n=e),null==w||w(n,t)),n}var x=u()(f,p,(n={},(0,r.Z)(n,"".concat(f,"-checked"),C),(0,r.Z)(n,"".concat(f,"-disabled"),m),n));return o.createElement("button",(0,i.Z)({},S,{type:"button",role:"switch","aria-checked":C,disabled:m,className:x,ref:t,onKeyDown:function(e){e.which===h.Z.LEFT?L(!1,e):e.which===h.Z.RIGHT&&L(!0,e),null==k||k(e)},onClick:function(e){var t=L(!C,e);null==E||E(t,e)}}),v,o.createElement("span",{className:"".concat(f,"-inner")},o.createElement("span",{className:"".concat(f,"-inner-checked")},y),o.createElement("span",{className:"".concat(f,"-inner-unchecked")},b)))}));f.displayName="Switch",t.Z=f},29125:function(e,t,n){"use strict";n.d(t,{G:function(){return a},Z:function(){return v}});var i=n(92310),r=n.n(i),s=n(59301);function a(e){var t=e.children,n=e.prefixCls,i=e.id,a=e.overlayInnerStyle,o=e.bodyClassName,l=e.className,u=e.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 t?t():t))}var o=n(54476),l=n(33885),u=n(75931),c=n(65030),h={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:h,offset:[0,-4],targetOffset:f},bottom:{points:["tc","bc"],overflow:h,offset:[0,4],targetOffset:f},topLeft:{points:["bl","tl"],overflow:h,offset:[0,-4],targetOffset:f},leftTop:{points:["tr","tl"],overflow:d,offset:[-4,0],targetOffset:f},topRight:{points:["br","tr"],overflow:h,offset:[0,-4],targetOffset:f},rightTop:{points:["tl","tr"],overflow:d,offset:[4,0],targetOffset:f},bottomRight:{points:["tr","br"],overflow:h,offset:[0,4],targetOffset:f},rightBottom:{points:["bl","br"],overflow:d,offset:[4,0],targetOffset:f},bottomLeft:{points:["tl","bl"],overflow:h,offset:[0,4],targetOffset:f},leftBottom:{points:["br","bl"],overflow:d,offset:[-4,0],targetOffset:f}},_=n(80402),g=["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(e,t){var n=e.overlayClassName,i=e.trigger,h=void 0===i?["hover"]:i,d=e.mouseEnterDelay,f=void 0===d?0:d,m=e.mouseLeaveDelay,v=void 0===m?.1:m,y=e.overlayStyle,b=e.prefixCls,E=void 0===b?"rc-tooltip":b,w=e.children,k=e.onVisibleChange,S=e.afterVisibleChange,T=e.transitionName,A=e.animation,C=e.motion,R=e.placement,L=void 0===R?"right":R,x=e.align,I=void 0===x?{}:x,D=e.destroyTooltipOnHide,P=void 0!==D&&D,O=e.defaultVisible,M=e.getTooltipContainer,N=e.overlayInnerStyle,F=(e.arrowContent,e.overlay),B=e.id,U=e.showArrow,K=void 0===U||U,$=e.classNames,G=e.styles,j=(0,u.Z)(e,g),V=(0,_.Z)(B),Z=(0,s.useRef)(null);(0,s.useImperativeHandle)(t,(function(){return Z.current}));var H=(0,l.Z)({},j);"visible"in e&&(H.popupVisible=e.visible);var z,W,q;return s.createElement(c.Z,(0,o.Z)({popupClassName:r()(n,null==$?void 0:$.root),prefixCls:E,popup:function(){return s.createElement(a,{key:"content",prefixCls:E,id:V,bodyClassName:null==$?void 0:$.body,overlayInnerStyle:(0,l.Z)((0,l.Z)({},N),null==G?void 0:G.body)},F)},action:h,builtinPlacements:p,popupPlacement:L,ref:Z,popupAlign:I,getPopupContainer:M,onPopupVisibleChange:k,afterPopupVisibleChange:S,popupTransitionName:T,popupAnimation:A,popupMotion:C,defaultPopupVisible:O,autoDestroy:P,mouseLeaveDelay:v,popupStyle:(0,l.Z)((0,l.Z)({},y),null==G?void 0:G.root),mouseEnterDelay:f,arrow:K},H),(z=s.Children.only(w),W=(null==z?void 0:z.props)||{},q=(0,l.Z)((0,l.Z)({},W),{},{"aria-describedby":F?V:null}),s.cloneElement(w,q)))},v=(0,s.forwardRef)(m)},639:function(e,t,n){"use strict";n.d(t,{Z:function(){return E}});var i=n(54476),r=n(20068),s=n(33885),a=n(42978),o=n(75931),l=n(59301),u=n(92310),c=n.n(u),h=n(26112),d=n(30699),f=function(e){for(var t=e.prefixCls,n=e.level,i=e.isStart,s=e.isEnd,a="".concat(t,"-indent-unit"),o=[],u=0;u<n;u+=1)o.push(l.createElement("span",{key:u,className:c()(a,(0,r.Z)((0,r.Z)({},"".concat(a,"-start"),i[u]),"".concat(a,"-end"),s[u]))}));return l.createElement("span",{"aria-hidden":"true",className:"".concat(t,"-indent")},o)},p=l.memo(f),_=n(65065),g=n(34061),m=["eventKey","className","style","dragOver","dragOverGapTop","dragOverGapBottom","isLeaf","isStart","isEnd","expanded","selected","checked","halfChecked","loading","domRef","active","data","onMouseMove","selectable"],v="open",y="close",b=function(e){var t,n,u,f=e.eventKey,b=e.className,E=e.style,w=e.dragOver,k=e.dragOverGapTop,S=e.dragOverGapBottom,T=e.isLeaf,A=e.isStart,C=e.isEnd,R=e.expanded,L=e.selected,x=e.checked,I=e.halfChecked,D=e.loading,P=e.domRef,O=e.active,M=e.data,N=e.onMouseMove,F=e.selectable,B=(0,o.Z)(e,m),U=l.useContext(d.k),K=l.useContext(d.y),$=l.useRef(null),G=l.useState(!1),j=(0,a.Z)(G,2),V=j[0],Z=j[1],H=!!(U.disabled||e.disabled||null!==(t=K.nodeDisabled)&&void 0!==t&&t.call(K,M)),z=l.useMemo((function(){return!(!U.checkable||!1===e.checkable)&&U.checkable}),[U.checkable,e.checkable]),W=function(t){H||z&&!e.disableCheckbox&&U.onNodeCheck(t,(0,g.F)(e),!x)},q=l.useMemo((function(){return"boolean"==typeof F?F:U.selectable}),[F,U.selectable]),Y=function(t){U.onNodeClick(t,(0,g.F)(e)),q?function(t){H||U.onNodeSelect(t,(0,g.F)(e))}(t):W(t)},X=function(t){U.onNodeDoubleClick(t,(0,g.F)(e))},Q=function(t){U.onNodeMouseEnter(t,(0,g.F)(e))},J=function(t){U.onNodeMouseLeave(t,(0,g.F)(e))},ee=function(t){U.onNodeContextMenu(t,(0,g.F)(e))},te=l.useMemo((function(){return!(!U.draggable||U.draggable.nodeDraggable&&!U.draggable.nodeDraggable(M))}),[U.draggable,M]),ne=function(t){D||U.onNodeExpand(t,(0,g.F)(e))},ie=l.useMemo((function(){var e=((0,_.Z)(U.keyEntities,f)||{}).children;return Boolean((e||[]).length)}),[U.keyEntities,f]),re=l.useMemo((function(){return!1!==T&&(T||!U.loadData&&!ie||U.loadData&&e.loaded&&!ie)}),[T,U.loadData,ie,e.loaded]);l.useEffect((function(){D||"function"!=typeof U.loadData||!R||re||e.loaded||U.onNodeLoad((0,g.F)(e))}),[D,U.loadData,U.onNodeLoad,R,re,e]);var se=l.useMemo((function(){var e;return null!==(e=U.draggable)&&void 0!==e&&e.icon?l.createElement("span",{className:"".concat(U.prefixCls,"-draggable-icon")},U.draggable.icon):null}),[U.draggable]),ae=function(t){var n=e.switcherIcon||U.switcherIcon;return"function"==typeof n?n((0,s.Z)((0,s.Z)({},e),{},{isLeaf:t})):n},oe=l.useMemo((function(){if(!z)return null;var t="boolean"!=typeof z?z:null;return l.createElement("span",{className:c()("".concat(U.prefixCls,"-checkbox"),(0,r.Z)((0,r.Z)((0,r.Z)({},"".concat(U.prefixCls,"-checkbox-checked"),x),"".concat(U.prefixCls,"-checkbox-indeterminate"),!x&&I),"".concat(U.prefixCls,"-checkbox-disabled"),H||e.disableCheckbox)),onClick:W,role:"checkbox","aria-checked":I?"mixed":x,"aria-disabled":H||e.disableCheckbox,"aria-label":"Select ".concat("string"==typeof e.title?e.title:"tree node")},t)}),[z,x,I,H,e.disableCheckbox,e.title]),le=l.useMemo((function(){return re?null:R?v:y}),[re,R]),ue=l.useMemo((function(){return l.createElement("span",{className:c()("".concat(U.prefixCls,"-iconEle"),"".concat(U.prefixCls,"-icon__").concat(le||"docu"),(0,r.Z)({},"".concat(U.prefixCls,"-icon_loading"),D))})}),[U.prefixCls,le,D]),ce=l.useMemo((function(){var t=Boolean(U.draggable);return!e.disabled&&t&&U.dragOverNodeKey===f?U.dropIndicatorRender({dropPosition:U.dropPosition,dropLevelOffset:U.dropLevelOffset,indent:U.indent,prefixCls:U.prefixCls,direction:U.direction}):null}),[U.dropPosition,U.dropLevelOffset,U.indent,U.prefixCls,U.direction,U.draggable,U.dragOverNodeKey,U.dropIndicatorRender]),he=l.useMemo((function(){var t,n,i=e.title,s=void 0===i?"---":i,a="".concat(U.prefixCls,"-node-content-wrapper");if(U.showIcon){var o=e.icon||U.icon;t=o?l.createElement("span",{className:c()("".concat(U.prefixCls,"-iconEle"),"".concat(U.prefixCls,"-icon__customize"))},"function"==typeof o?o(e):o):ue}else U.loadData&&D&&(t=ue);return n="function"==typeof s?s(M):U.titleRender?U.titleRender(M):s,l.createElement("span",{ref:$,title:"string"==typeof s?s:"",className:c()(a,"".concat(a,"-").concat(le||"normal"),(0,r.Z)({},"".concat(U.prefixCls,"-node-selected"),!H&&(L||V))),onMouseEnter:Q,onMouseLeave:J,onContextMenu:ee,onClick:Y,onDoubleClick:X},t,l.createElement("span",{className:"".concat(U.prefixCls,"-title")},n),ce)}),[U.prefixCls,U.showIcon,e,U.icon,ue,U.titleRender,M,le,Q,J,ee,Y,X]),de=(0,h.Z)(B,{aria:!0,data:!0}),fe=((0,_.Z)(U.keyEntities,f)||{}).level,pe=C[C.length-1],_e=!H&&te,ge=U.draggingNodeKey===f,me=void 0!==F?{"aria-selected":!!F}:void 0;return l.createElement("div",(0,i.Z)({ref:P,role:"treeitem","aria-expanded":T?void 0:R,className:c()(b,"".concat(U.prefixCls,"-treenode"),(u={},(0,r.Z)((0,r.Z)((0,r.Z)((0,r.Z)((0,r.Z)((0,r.Z)((0,r.Z)((0,r.Z)((0,r.Z)((0,r.Z)(u,"".concat(U.prefixCls,"-treenode-disabled"),H),"".concat(U.prefixCls,"-treenode-switcher-").concat(R?"open":"close"),!T),"".concat(U.prefixCls,"-treenode-checkbox-checked"),x),"".concat(U.prefixCls,"-treenode-checkbox-indeterminate"),I),"".concat(U.prefixCls,"-treenode-selected"),L),"".concat(U.prefixCls,"-treenode-loading"),D),"".concat(U.prefixCls,"-treenode-active"),O),"".concat(U.prefixCls,"-treenode-leaf-last"),pe),"".concat(U.prefixCls,"-treenode-draggable"),te),"dragging",ge),(0,r.Z)((0,r.Z)((0,r.Z)((0,r.Z)((0,r.Z)((0,r.Z)((0,r.Z)(u,"drop-target",U.dropTargetKey===f),"drop-container",U.dropContainerKey===f),"drag-over",!H&&w),"drag-over-gap-top",!H&&k),"drag-over-gap-bottom",!H&&S),"filter-node",null===(n=U.filterTreeNode)||void 0===n?void 0:n.call(U,(0,g.F)(e))),"".concat(U.prefixCls,"-treenode-leaf"),re))),style:E,draggable:_e,onDragStart:_e?function(t){t.stopPropagation(),Z(!0),U.onNodeDragStart(t,e);try{t.dataTransfer.setData("text/plain","")}catch(e){}}:void 0,onDragEnter:te?function(t){t.preventDefault(),t.stopPropagation(),U.onNodeDragEnter(t,e)}:void 0,onDragOver:te?function(t){t.preventDefault(),t.stopPropagation(),U.onNodeDragOver(t,e)}:void 0,onDragLeave:te?function(t){t.stopPropagation(),U.onNodeDragLeave(t,e)}:void 0,onDrop:te?function(t){t.preventDefault(),t.stopPropagation(),Z(!1),U.onNodeDrop(t,e)}:void 0,onDragEnd:te?function(t){t.stopPropagation(),Z(!1),U.onNodeDragEnd(t,e)}:void 0,onMouseMove:N},me,de),l.createElement(p,{prefixCls:U.prefixCls,level:fe,isStart:A,isEnd:C}),se,function(){if(re){var e=ae(!0);return!1!==e?l.createElement("span",{className:c()("".concat(U.prefixCls,"-switcher"),"".concat(U.prefixCls,"-switcher-noop"))},e):null}var t=ae(!1);return!1!==t?l.createElement("span",{onClick:ne,className:c()("".concat(U.prefixCls,"-switcher"),"".concat(U.prefixCls,"-switcher_").concat(R?v:y))},t):null}(),oe,he)};b.isTreeNode=1;var E=b},30699:function(e,t,n){"use strict";n.d(t,{k:function(){return r},y:function(){return s}});var i=n(59301),r=i.createContext(null),s=i.createContext({})},3741:function(e,t,n){"use strict";n.d(t,{OF:function(){return C.Z},y6:function(){return y.y},ZP:function(){return W}});var i=n(54476),r=n(76190),s=n(33885),a=n(94480),o=n(67732),l=n(83652),u=n(31226),c=n(42403),h=n(158),d=n(20068),f=n(92310),p=n.n(f),_=n(10228),g=n(26112),m=n(48736),v=n(59301),y=n(30699);var b=function(e){var t=e.dropPosition,n=e.dropLevelOffset,i=e.indent,r={pointerEvents:"none",position:"absolute",right:0,backgroundColor:"red",height:2};switch(t){case-1:r.top=0,r.left=-n*i;break;case 1:r.bottom=0,r.left=-n*i;break;case 0:r.bottom=0,r.left=i}return v.createElement("div",{style:r})};function E(e){if(null==e)throw new TypeError("Cannot destructure "+e)}var w=n(42978),k=n(75931),S=n(34280),T=n(48911),A=n(77900),C=n(639);var R=function(e,t){var n=v.useState(!1),i=(0,w.Z)(n,2),r=i[0],s=i[1];(0,S.Z)((function(){if(r)return e(),function(){t()}}),[r]),(0,S.Z)((function(){return s(!0),function(){s(!1)}}),[])},L=n(34061),x=["className","style","motion","motionNodes","motionType","onMotionStart","onMotionEnd","active","treeNodeRequiredProps"];var I=v.forwardRef((function(e,t){var n=e.className,r=e.style,s=e.motion,a=e.motionNodes,o=e.motionType,l=e.onMotionStart,u=e.onMotionEnd,c=e.active,h=e.treeNodeRequiredProps,d=(0,k.Z)(e,x),f=v.useState(!0),_=(0,w.Z)(f,2),g=_[0],m=_[1],b=v.useContext(y.k).prefixCls,T=a&&"hide"!==o;(0,S.Z)((function(){a&&T!==g&&m(T)}),[a]);var I=v.useRef(!1),D=function(){a&&!I.current&&(I.current=!0,u())};R((function(){a&&l()}),D);return a?v.createElement(A.default,(0,i.Z)({ref:t,visible:g},s,{motionAppear:"show"===o,onVisibleChanged:function(e){T===e&&D()}}),(function(e,t){var n=e.className,r=e.style;return v.createElement("div",{ref:t,className:p()("".concat(b,"-treenode-motion"),n),style:r},a.map((function(e){var t=Object.assign({},(E(e.data),e.data)),n=e.title,r=e.key,s=e.isStart,a=e.isEnd;delete t.children;var o=(0,L.H8)(r,h);return v.createElement(C.Z,(0,i.Z)({},t,o,{title:n,active:c,data:e.data,key:r,isStart:s,isEnd:a}))})))})):v.createElement(C.Z,(0,i.Z)({domRef:t,className:n,style:r},d,{active:c}))}));function D(e,t,n){var i=e.findIndex((function(e){return e.key===n})),r=e[i+1],s=t.findIndex((function(e){return e.key===n}));if(r){var a=t.findIndex((function(e){return e.key===r.key}));return t.slice(s+1,a)}return t.slice(s+1)}var P=["prefixCls","data","selectable","checkable","expandedKeys","selectedKeys","checkedKeys","loadedKeys","loadingKeys","halfCheckedKeys","keyEntities","disabled","dragging","dragOverNodeKey","dropPosition","motion","height","itemHeight","virtual","scrollWidth","focusable","activeItem","focused","tabIndex","onKeyDown","onFocus","onBlur","onActiveChange","onListChangeStart","onListChangeEnd"],O={width:0,height:0,display:"flex",overflow:"hidden",opacity:0,border:0,padding:0,margin:0},M=function(){},N="RC_TREE_MOTION_".concat(Math.random()),F={key:N},B={key:N,level:0,index:0,pos:"0",node:F,nodes:[F]},U={parent:null,children:[],pos:B.pos,data:F,title:null,key:N,isStart:[],isEnd:[]};function K(e,t,n,i){return!1!==t&&n?e.slice(0,Math.ceil(n/i)+1):e}function $(e){var t=e.key,n=e.pos;return(0,L.km)(t,n)}var G=v.forwardRef((function(e,t){var n=e.prefixCls,r=e.data,s=(e.selectable,e.checkable,e.expandedKeys),a=e.selectedKeys,o=e.checkedKeys,l=e.loadedKeys,u=e.loadingKeys,c=e.halfCheckedKeys,h=e.keyEntities,d=e.disabled,f=e.dragging,p=e.dragOverNodeKey,_=e.dropPosition,g=e.motion,m=e.height,y=e.itemHeight,b=e.virtual,A=e.scrollWidth,C=e.focusable,R=e.activeItem,x=e.focused,F=e.tabIndex,B=e.onKeyDown,G=e.onFocus,j=e.onBlur,V=e.onActiveChange,Z=e.onListChangeStart,H=e.onListChangeEnd,z=(0,k.Z)(e,P),W=v.useRef(null),q=v.useRef(null);v.useImperativeHandle(t,(function(){return{scrollTo:function(e){W.current.scrollTo(e)},getIndentWidth:function(){return q.current.offsetWidth}}}));var Y=v.useState(s),X=(0,w.Z)(Y,2),Q=X[0],J=X[1],ee=v.useState(r),te=(0,w.Z)(ee,2),ne=te[0],ie=te[1],re=v.useState(r),se=(0,w.Z)(re,2),ae=se[0],oe=se[1],le=v.useState([]),ue=(0,w.Z)(le,2),ce=ue[0],he=ue[1],de=v.useState(null),fe=(0,w.Z)(de,2),pe=fe[0],_e=fe[1],ge=v.useRef(r);function me(){var e=ge.current;ie(e),oe(e),he([]),_e(null),H()}ge.current=r,(0,S.Z)((function(){J(s);var e=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=e.length,i=t.length;if(1!==Math.abs(n-i))return{add:!1,key:null};function r(e,t){var n=new Map;e.forEach((function(e){n.set(e,!0)}));var i=t.filter((function(e){return!n.has(e)}));return 1===i.length?i[0]:null}return n<i?{add:!0,key:r(e,t)}:{add:!1,key:r(t,e)}}(Q,s);if(null!==e.key)if(e.add){var t=ne.findIndex((function(t){return t.key===e.key})),n=K(D(ne,r,e.key),b,m,y),i=ne.slice();i.splice(t+1,0,U),oe(i),he(n),_e("show")}else{var a=r.findIndex((function(t){return t.key===e.key})),o=K(D(r,ne,e.key),b,m,y),l=r.slice();l.splice(a+1,0,U),oe(l),he(o),_e("hide")}else ne!==r&&(ie(r),oe(r))}),[s,r]),v.useEffect((function(){f||me()}),[f]);var ve=g?ae:r,ye={expandedKeys:s,selectedKeys:a,loadedKeys:l,loadingKeys:u,checkedKeys:o,halfCheckedKeys:c,dragOverNodeKey:p,dropPosition:_,keyEntities:h};return v.createElement(v.Fragment,null,x&&R&&v.createElement("span",{style:O,"aria-live":"assertive"},function(e){for(var t=String(e.data.key),n=e;n.parent;)n=n.parent,t="".concat(n.data.key," > ").concat(t);return t}(R)),v.createElement("div",null,v.createElement("input",{style:O,disabled:!1===C||d,tabIndex:!1!==C?F:null,onKeyDown:B,onFocus:G,onBlur:j,value:"",onChange:M,"aria-label":"for screen reader"})),v.createElement("div",{className:"".concat(n,"-treenode"),"aria-hidden":!0,style:{position:"absolute",pointerEvents:"none",visibility:"hidden",height:0,overflow:"hidden",border:0,padding:0}},v.createElement("div",{className:"".concat(n,"-indent")},v.createElement("div",{ref:q,className:"".concat(n,"-indent-unit")}))),v.createElement(T.Z,(0,i.Z)({},z,{data:ve,itemKey:$,height:m,fullHeight:!1,virtual:b,itemHeight:y,scrollWidth:A,prefixCls:"".concat(n,"-list"),ref:W,role:"tree",onVisibleChange:function(e){e.every((function(e){return $(e)!==N}))&&me()}}),(function(e){var t=e.pos,n=Object.assign({},(E(e.data),e.data)),r=e.title,s=e.key,a=e.isStart,o=e.isEnd,l=(0,L.km)(s,t);delete n.key,delete n.children;var u=(0,L.H8)(l,ye);return v.createElement(I,(0,i.Z)({},n,u,{title:r,active:!!R&&s===R.key,pos:t,data:e.data,isStart:a,isEnd:o,motion:g,motionNodes:s===N?ce:null,motionType:pe,onMotionStart:Z,onMotionEnd:me,treeNodeRequiredProps:ye,onMouseMove:function(){V(null)}}))})))}));var j=G,V=n(82661),Z=n(34643),H=n(65065),z=function(e){(0,c.Z)(n,e);var t=(0,h.Z)(n);function n(){var e;(0,o.Z)(this,n);for(var i=arguments.length,r=new Array(i),l=0;l<i;l++)r[l]=arguments[l];return e=t.call.apply(t,[this].concat(r)),(0,d.Z)((0,u.Z)(e),"destroyed",!1),(0,d.Z)((0,u.Z)(e),"delayedDragEnterLogic",void 0),(0,d.Z)((0,u.Z)(e),"loadingRetryTimes",{}),(0,d.Z)((0,u.Z)(e),"state",{keyEntities:{},indent:null,selectedKeys:[],checkedKeys:[],halfCheckedKeys:[],loadedKeys:[],loadingKeys:[],expandedKeys:[],draggingNodeKey:null,dragChildrenKeys:[],dropTargetKey:null,dropPosition:null,dropContainerKey:null,dropLevelOffset:null,dropTargetPos:null,dropAllowed:!0,dragOverNodeKey:null,treeData:[],flattenNodes:[],focused:!1,activeKey:null,listChanging:!1,prevProps:null,fieldNames:(0,L.w$)()}),(0,d.Z)((0,u.Z)(e),"dragStartMousePosition",null),(0,d.Z)((0,u.Z)(e),"dragNodeProps",null),(0,d.Z)((0,u.Z)(e),"currentMouseOverDroppableNodeKey",null),(0,d.Z)((0,u.Z)(e),"listRef",v.createRef()),(0,d.Z)((0,u.Z)(e),"onNodeDragStart",(function(t,n){var i=e.state,r=i.expandedKeys,s=i.keyEntities,a=e.props.onDragStart,o=n.eventKey;e.dragNodeProps=n,e.dragStartMousePosition={x:t.clientX,y:t.clientY};var l=(0,V._5)(r,o);e.setState({draggingNodeKey:o,dragChildrenKeys:(0,V.wA)(o,s),indent:e.listRef.current.getIndentWidth()}),e.setExpandedKeys(l),window.addEventListener("dragend",e.onWindowDragEnd),null==a||a({event:t,node:(0,L.F)(n)})})),(0,d.Z)((0,u.Z)(e),"onNodeDragEnter",(function(t,n){var i=e.state,r=i.expandedKeys,s=i.keyEntities,o=i.dragChildrenKeys,l=i.flattenNodes,u=i.indent,c=e.props,h=c.onDragEnter,d=c.onExpand,f=c.allowDrop,p=c.direction,_=n.pos,g=n.eventKey;if(e.currentMouseOverDroppableNodeKey!==g&&(e.currentMouseOverDroppableNodeKey=g),e.dragNodeProps){var m=(0,V.OM)(t,e.dragNodeProps,n,u,e.dragStartMousePosition,f,l,s,r,p),v=m.dropPosition,y=m.dropLevelOffset,b=m.dropTargetKey,E=m.dropContainerKey,w=m.dropTargetPos,k=m.dropAllowed,S=m.dragOverNodeKey;!o.includes(b)&&k?(e.delayedDragEnterLogic||(e.delayedDragEnterLogic={}),Object.keys(e.delayedDragEnterLogic).forEach((function(t){clearTimeout(e.delayedDragEnterLogic[t])})),e.dragNodeProps.eventKey!==n.eventKey&&(t.persist(),e.delayedDragEnterLogic[_]=window.setTimeout((function(){if(null!==e.state.draggingNodeKey){var i=(0,a.Z)(r),o=(0,H.Z)(s,n.eventKey);o&&(o.children||[]).length&&(i=(0,V.L0)(r,n.eventKey)),e.props.hasOwnProperty("expandedKeys")||e.setExpandedKeys(i),null==d||d(i,{node:(0,L.F)(n),expanded:!0,nativeEvent:t.nativeEvent})}}),800)),e.dragNodeProps.eventKey!==b||0!==y?(e.setState({dragOverNodeKey:S,dropPosition:v,dropLevelOffset:y,dropTargetKey:b,dropContainerKey:E,dropTargetPos:w,dropAllowed:k}),null==h||h({event:t,node:(0,L.F)(n),expandedKeys:r})):e.resetDragState()):e.resetDragState()}else e.resetDragState()})),(0,d.Z)((0,u.Z)(e),"onNodeDragOver",(function(t,n){var i=e.state,r=i.dragChildrenKeys,s=i.flattenNodes,a=i.keyEntities,o=i.expandedKeys,l=i.indent,u=e.props,c=u.onDragOver,h=u.allowDrop,d=u.direction;if(e.dragNodeProps){var f=(0,V.OM)(t,e.dragNodeProps,n,l,e.dragStartMousePosition,h,s,a,o,d),p=f.dropPosition,_=f.dropLevelOffset,g=f.dropTargetKey,m=f.dropContainerKey,v=f.dropTargetPos,y=f.dropAllowed,b=f.dragOverNodeKey;!r.includes(g)&&y&&(e.dragNodeProps.eventKey===g&&0===_?null===e.state.dropPosition&&null===e.state.dropLevelOffset&&null===e.state.dropTargetKey&&null===e.state.dropContainerKey&&null===e.state.dropTargetPos&&!1===e.state.dropAllowed&&null===e.state.dragOverNodeKey||e.resetDragState():p===e.state.dropPosition&&_===e.state.dropLevelOffset&&g===e.state.dropTargetKey&&m===e.state.dropContainerKey&&v===e.state.dropTargetPos&&y===e.state.dropAllowed&&b===e.state.dragOverNodeKey||e.setState({dropPosition:p,dropLevelOffset:_,dropTargetKey:g,dropContainerKey:m,dropTargetPos:v,dropAllowed:y,dragOverNodeKey:b}),null==c||c({event:t,node:(0,L.F)(n)}))}})),(0,d.Z)((0,u.Z)(e),"onNodeDragLeave",(function(t,n){e.currentMouseOverDroppableNodeKey!==n.eventKey||t.currentTarget.contains(t.relatedTarget)||(e.resetDragState(),e.currentMouseOverDroppableNodeKey=null);var i=e.props.onDragLeave;null==i||i({event:t,node:(0,L.F)(n)})})),(0,d.Z)((0,u.Z)(e),"onWindowDragEnd",(function(t){e.onNodeDragEnd(t,null,!0),window.removeEventListener("dragend",e.onWindowDragEnd)})),(0,d.Z)((0,u.Z)(e),"onNodeDragEnd",(function(t,n){var i=e.props.onDragEnd;e.setState({dragOverNodeKey:null}),e.cleanDragState(),null==i||i({event:t,node:(0,L.F)(n)}),e.dragNodeProps=null,window.removeEventListener("dragend",e.onWindowDragEnd)})),(0,d.Z)((0,u.Z)(e),"onNodeDrop",(function(t,n){var i,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],a=e.state,o=a.dragChildrenKeys,l=a.dropPosition,u=a.dropTargetKey,c=a.dropTargetPos,h=a.dropAllowed;if(h){var d=e.props.onDrop;if(e.setState({dragOverNodeKey:null}),e.cleanDragState(),null!==u){var f=(0,s.Z)((0,s.Z)({},(0,L.H8)(u,e.getTreeNodeRequiredProps())),{},{active:(null===(i=e.getActiveItem())||void 0===i?void 0:i.key)===u,data:(0,H.Z)(e.state.keyEntities,u).node}),p=o.includes(u);(0,m.ZP)(!p,"Can not drop to dragNode's children node. This is a bug of rc-tree. Please report an issue.");var _=(0,V.yx)(c),g={event:t,node:(0,L.F)(f),dragNode:e.dragNodeProps?(0,L.F)(e.dragNodeProps):null,dragNodesKeys:[e.dragNodeProps.eventKey].concat(o),dropToGap:0!==l,dropPosition:l+Number(_[_.length-1])};r||null==d||d(g),e.dragNodeProps=null}}})),(0,d.Z)((0,u.Z)(e),"cleanDragState",(function(){null!==e.state.draggingNodeKey&&e.setState({draggingNodeKey:null,dropPosition:null,dropContainerKey:null,dropTargetKey:null,dropLevelOffset:null,dropAllowed:!0,dragOverNodeKey:null}),e.dragStartMousePosition=null,e.currentMouseOverDroppableNodeKey=null})),(0,d.Z)((0,u.Z)(e),"triggerExpandActionExpand",(function(t,n){var i=e.state,r=i.expandedKeys,a=i.flattenNodes,o=n.expanded,l=n.key;if(!(n.isLeaf||t.shiftKey||t.metaKey||t.ctrlKey)){var u=a.filter((function(e){return e.key===l}))[0],c=(0,L.F)((0,s.Z)((0,s.Z)({},(0,L.H8)(l,e.getTreeNodeRequiredProps())),{},{data:u.data}));e.setExpandedKeys(o?(0,V._5)(r,l):(0,V.L0)(r,l)),e.onNodeExpand(t,c)}})),(0,d.Z)((0,u.Z)(e),"onNodeClick",(function(t,n){var i=e.props,r=i.onClick;"click"===i.expandAction&&e.triggerExpandActionExpand(t,n),null==r||r(t,n)})),(0,d.Z)((0,u.Z)(e),"onNodeDoubleClick",(function(t,n){var i=e.props,r=i.onDoubleClick;"doubleClick"===i.expandAction&&e.triggerExpandActionExpand(t,n),null==r||r(t,n)})),(0,d.Z)((0,u.Z)(e),"onNodeSelect",(function(t,n){var i=e.state.selectedKeys,r=e.state,s=r.keyEntities,a=r.fieldNames,o=e.props,l=o.onSelect,u=o.multiple,c=n.selected,h=n[a.key],d=!c,f=(i=d?u?(0,V.L0)(i,h):[h]:(0,V._5)(i,h)).map((function(e){var t=(0,H.Z)(s,e);return t?t.node:null})).filter(Boolean);e.setUncontrolledState({selectedKeys:i}),null==l||l(i,{event:"select",selected:d,node:n,selectedNodes:f,nativeEvent:t.nativeEvent})})),(0,d.Z)((0,u.Z)(e),"onNodeCheck",(function(t,n,i){var r,s=e.state,o=s.keyEntities,l=s.checkedKeys,u=s.halfCheckedKeys,c=e.props,h=c.checkStrictly,d=c.onCheck,f=n.key,p={event:"check",node:n,checked:i,nativeEvent:t.nativeEvent};if(h){var _=i?(0,V.L0)(l,f):(0,V._5)(l,f);r={checked:_,halfChecked:(0,V._5)(u,f)},p.checkedNodes=_.map((function(e){return(0,H.Z)(o,e)})).filter(Boolean).map((function(e){return e.node})),e.setUncontrolledState({checkedKeys:_})}else{var g=(0,Z.S)([].concat((0,a.Z)(l),[f]),!0,o),m=g.checkedKeys,v=g.halfCheckedKeys;if(!i){var y=new Set(m);y.delete(f);var b=(0,Z.S)(Array.from(y),{checked:!1,halfCheckedKeys:v},o);m=b.checkedKeys,v=b.halfCheckedKeys}r=m,p.checkedNodes=[],p.checkedNodesPositions=[],p.halfCheckedKeys=v,m.forEach((function(e){var t=(0,H.Z)(o,e);if(t){var n=t.node,i=t.pos;p.checkedNodes.push(n),p.checkedNodesPositions.push({node:n,pos:i})}})),e.setUncontrolledState({checkedKeys:m},!1,{halfCheckedKeys:v})}null==d||d(r,p)})),(0,d.Z)((0,u.Z)(e),"onNodeLoad",(function(t){var n,i=t.key,r=e.state.keyEntities,s=(0,H.Z)(r,i);if(null==s||null===(n=s.children)||void 0===n||!n.length){var a=new Promise((function(n,r){e.setState((function(s){var a=s.loadedKeys,o=void 0===a?[]:a,l=s.loadingKeys,u=void 0===l?[]:l,c=e.props,h=c.loadData,d=c.onLoad;return!h||o.includes(i)||u.includes(i)?null:(h(t).then((function(){var r=e.state.loadedKeys,s=(0,V.L0)(r,i);null==d||d(s,{event:"load",node:t}),e.setUncontrolledState({loadedKeys:s}),e.setState((function(e){return{loadingKeys:(0,V._5)(e.loadingKeys,i)}})),n()})).catch((function(t){if(e.setState((function(e){return{loadingKeys:(0,V._5)(e.loadingKeys,i)}})),e.loadingRetryTimes[i]=(e.loadingRetryTimes[i]||0)+1,e.loadingRetryTimes[i]>=10){var s=e.state.loadedKeys;(0,m.ZP)(!1,"Retry for `loadData` many times but still failed. No more retry."),e.setUncontrolledState({loadedKeys:(0,V.L0)(s,i)}),n()}r(t)})),{loadingKeys:(0,V.L0)(u,i)})}))}));return a.catch((function(){})),a}})),(0,d.Z)((0,u.Z)(e),"onNodeMouseEnter",(function(t,n){var i=e.props.onMouseEnter;null==i||i({event:t,node:n})})),(0,d.Z)((0,u.Z)(e),"onNodeMouseLeave",(function(t,n){var i=e.props.onMouseLeave;null==i||i({event:t,node:n})})),(0,d.Z)((0,u.Z)(e),"onNodeContextMenu",(function(t,n){var i=e.props.onRightClick;i&&(t.preventDefault(),i({event:t,node:n}))})),(0,d.Z)((0,u.Z)(e),"onFocus",(function(){var t=e.props.onFocus;e.setState({focused:!0});for(var n=arguments.length,i=new Array(n),r=0;r<n;r++)i[r]=arguments[r];null==t||t.apply(void 0,i)})),(0,d.Z)((0,u.Z)(e),"onBlur",(function(){var t=e.props.onBlur;e.setState({focused:!1}),e.onActiveChange(null);for(var n=arguments.length,i=new Array(n),r=0;r<n;r++)i[r]=arguments[r];null==t||t.apply(void 0,i)})),(0,d.Z)((0,u.Z)(e),"getTreeNodeRequiredProps",(function(){var t=e.state;return{expandedKeys:t.expandedKeys||[],selectedKeys:t.selectedKeys||[],loadedKeys:t.loadedKeys||[],loadingKeys:t.loadingKeys||[],checkedKeys:t.checkedKeys||[],halfCheckedKeys:t.halfCheckedKeys||[],dragOverNodeKey:t.dragOverNodeKey,dropPosition:t.dropPosition,keyEntities:t.keyEntities}})),(0,d.Z)((0,u.Z)(e),"setExpandedKeys",(function(t){var n=e.state,i=n.treeData,r=n.fieldNames,s=(0,L.oH)(i,t,r);e.setUncontrolledState({expandedKeys:t,flattenNodes:s},!0)})),(0,d.Z)((0,u.Z)(e),"onNodeExpand",(function(t,n){var i=e.state.expandedKeys,r=e.state,s=r.listChanging,a=r.fieldNames,o=e.props,l=o.onExpand,u=o.loadData,c=n.expanded,h=n[a.key];if(!s){var d=i.includes(h),f=!c;if((0,m.ZP)(c&&d||!c&&!d,"Expand state not sync with index check"),i=f?(0,V.L0)(i,h):(0,V._5)(i,h),e.setExpandedKeys(i),null==l||l(i,{node:n,expanded:f,nativeEvent:t.nativeEvent}),f&&u){var p=e.onNodeLoad(n);p&&p.then((function(){var t=(0,L.oH)(e.state.treeData,i,a);e.setUncontrolledState({flattenNodes:t})})).catch((function(){var t=e.state.expandedKeys,n=(0,V._5)(t,h);e.setExpandedKeys(n)}))}}})),(0,d.Z)((0,u.Z)(e),"onListChangeStart",(function(){e.setUncontrolledState({listChanging:!0})})),(0,d.Z)((0,u.Z)(e),"onListChangeEnd",(function(){setTimeout((function(){e.setUncontrolledState({listChanging:!1})}))})),(0,d.Z)((0,u.Z)(e),"onActiveChange",(function(t){var n=e.state.activeKey,i=e.props,r=i.onActiveChange,s=i.itemScrollOffset,a=void 0===s?0:s;n!==t&&(e.setState({activeKey:t}),null!==t&&e.scrollTo({key:t,offset:a}),null==r||r(t))})),(0,d.Z)((0,u.Z)(e),"getActiveItem",(function(){var t=e.state,n=t.activeKey,i=t.flattenNodes;return null===n?null:i.find((function(e){return e.key===n}))||null})),(0,d.Z)((0,u.Z)(e),"offsetActiveKey",(function(t){var n=e.state,i=n.flattenNodes,r=n.activeKey,s=i.findIndex((function(e){return e.key===r}));-1===s&&t<0&&(s=i.length);var a=i[s=(s+t+i.length)%i.length];if(a){var o=a.key;e.onActiveChange(o)}else e.onActiveChange(null)})),(0,d.Z)((0,u.Z)(e),"onKeyDown",(function(t){var n=e.state,i=n.activeKey,r=n.expandedKeys,a=n.checkedKeys,o=n.fieldNames,l=e.props,u=l.onKeyDown,c=l.checkable,h=l.selectable;switch(t.which){case _.Z.UP:e.offsetActiveKey(-1),t.preventDefault();break;case _.Z.DOWN:e.offsetActiveKey(1),t.preventDefault()}var d=e.getActiveItem();if(d&&d.data){var f=e.getTreeNodeRequiredProps(),p=!1===d.data.isLeaf||!!(d.data[o.children]||[]).length,g=(0,L.F)((0,s.Z)((0,s.Z)({},(0,L.H8)(i,f)),{},{data:d.data,active:!0}));switch(t.which){case _.Z.LEFT:p&&r.includes(i)?e.onNodeExpand({},g):d.parent&&e.onActiveChange(d.parent.key),t.preventDefault();break;case _.Z.RIGHT:p&&!r.includes(i)?e.onNodeExpand({},g):d.children&&d.children.length&&e.onActiveChange(d.children[0].key),t.preventDefault();break;case _.Z.ENTER:case _.Z.SPACE:!c||g.disabled||!1===g.checkable||g.disableCheckbox?c||!h||g.disabled||!1===g.selectable||e.onNodeSelect({},g):e.onNodeCheck({},g,!a.includes(i))}}null==u||u(t)})),(0,d.Z)((0,u.Z)(e),"setUncontrolledState",(function(t){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(!e.destroyed){var r=!1,a=!0,o={};Object.keys(t).forEach((function(n){e.props.hasOwnProperty(n)?a=!1:(r=!0,o[n]=t[n])})),!r||n&&!a||e.setState((0,s.Z)((0,s.Z)({},o),i))}})),(0,d.Z)((0,u.Z)(e),"scrollTo",(function(t){e.listRef.current.scrollTo(t)})),e}return(0,l.Z)(n,[{key:"componentDidMount",value:function(){this.destroyed=!1,this.onUpdated()}},{key:"componentDidUpdate",value:function(){this.onUpdated()}},{key:"onUpdated",value:function(){var e=this.props,t=e.activeKey,n=e.itemScrollOffset,i=void 0===n?0:n;void 0!==t&&t!==this.state.activeKey&&(this.setState({activeKey:t}),null!==t&&this.scrollTo({key:t,offset:i}))}},{key:"componentWillUnmount",value:function(){window.removeEventListener("dragend",this.onWindowDragEnd),this.destroyed=!0}},{key:"resetDragState",value:function(){this.setState({dragOverNodeKey:null,dropPosition:null,dropLevelOffset:null,dropTargetKey:null,dropContainerKey:null,dropTargetPos:null,dropAllowed:!1})}},{key:"render",value:function(){var e,t=this.state,n=t.focused,s=t.flattenNodes,a=t.keyEntities,o=t.draggingNodeKey,l=t.activeKey,u=t.dropLevelOffset,c=t.dropContainerKey,h=t.dropTargetKey,f=t.dropPosition,_=t.dragOverNodeKey,m=t.indent,b=this.props,E=b.prefixCls,w=b.className,k=b.style,S=b.showLine,T=b.focusable,A=b.tabIndex,C=void 0===A?0:A,R=b.selectable,L=b.showIcon,x=b.icon,I=b.switcherIcon,D=b.draggable,P=b.checkable,O=b.checkStrictly,M=b.disabled,N=b.motion,F=b.loadData,B=b.filterTreeNode,U=b.height,K=b.itemHeight,$=b.scrollWidth,G=b.virtual,V=b.titleRender,Z=b.dropIndicatorRender,H=b.onContextMenu,z=b.onScroll,W=b.direction,q=b.rootClassName,Y=b.rootStyle,X=(0,g.Z)(this.props,{aria:!0,data:!0});D&&(e="object"===(0,r.Z)(D)?D:"function"==typeof D?{nodeDraggable:D}:{});var Q={prefixCls:E,selectable:R,showIcon:L,icon:x,switcherIcon:I,draggable:e,draggingNodeKey:o,checkable:P,checkStrictly:O,disabled:M,keyEntities:a,dropLevelOffset:u,dropContainerKey:c,dropTargetKey:h,dropPosition:f,dragOverNodeKey:_,indent:m,direction:W,dropIndicatorRender:Z,loadData:F,filterTreeNode:B,titleRender:V,onNodeClick:this.onNodeClick,onNodeDoubleClick:this.onNodeDoubleClick,onNodeExpand:this.onNodeExpand,onNodeSelect:this.onNodeSelect,onNodeCheck:this.onNodeCheck,onNodeLoad:this.onNodeLoad,onNodeMouseEnter:this.onNodeMouseEnter,onNodeMouseLeave:this.onNodeMouseLeave,onNodeContextMenu:this.onNodeContextMenu,onNodeDragStart:this.onNodeDragStart,onNodeDragEnter:this.onNodeDragEnter,onNodeDragOver:this.onNodeDragOver,onNodeDragLeave:this.onNodeDragLeave,onNodeDragEnd:this.onNodeDragEnd,onNodeDrop:this.onNodeDrop};return v.createElement(y.k.Provider,{value:Q},v.createElement("div",{className:p()(E,w,q,(0,d.Z)((0,d.Z)((0,d.Z)({},"".concat(E,"-show-line"),S),"".concat(E,"-focused"),n),"".concat(E,"-active-focused"),null!==l)),style:Y},v.createElement(j,(0,i.Z)({ref:this.listRef,prefixCls:E,style:k,data:s,disabled:M,selectable:R,checkable:!!P,motion:N,dragging:null!==o,height:U,itemHeight:K,virtual:G,focusable:T,focused:n,tabIndex:C,activeItem:this.getActiveItem(),onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.onKeyDown,onActiveChange:this.onActiveChange,onListChangeStart:this.onListChangeStart,onListChangeEnd:this.onListChangeEnd,onContextMenu:H,onScroll:z,scrollWidth:$},this.getTreeNodeRequiredProps(),X))))}}],[{key:"getDerivedStateFromProps",value:function(e,t){var n,i=t.prevProps,r={prevProps:e};function a(t){return!i&&e.hasOwnProperty(t)||i&&i[t]!==e[t]}var o=t.fieldNames;if(a("fieldNames")&&(o=(0,L.w$)(e.fieldNames),r.fieldNames=o),a("treeData")?n=e.treeData:a("children")&&((0,m.ZP)(!1,"`children` of Tree is deprecated. Please use `treeData` instead."),n=(0,L.zn)(e.children)),n){r.treeData=n;var l=(0,L.I8)(n,{fieldNames:o});r.keyEntities=(0,s.Z)((0,d.Z)({},N,B),l.keyEntities)}var u,c=r.keyEntities||t.keyEntities;if(a("expandedKeys")||i&&a("autoExpandParent"))r.expandedKeys=e.autoExpandParent||!i&&e.defaultExpandParent?(0,V.r7)(e.expandedKeys,c):e.expandedKeys;else if(!i&&e.defaultExpandAll){var h=(0,s.Z)({},c);delete h[N];var f=[];Object.keys(h).forEach((function(e){var t=h[e];t.children&&t.children.length&&f.push(t.key)})),r.expandedKeys=f}else!i&&e.defaultExpandedKeys&&(r.expandedKeys=e.autoExpandParent||e.defaultExpandParent?(0,V.r7)(e.defaultExpandedKeys,c):e.defaultExpandedKeys);if(r.expandedKeys||delete r.expandedKeys,n||r.expandedKeys){var p=(0,L.oH)(n||t.treeData,r.expandedKeys||t.expandedKeys,o);r.flattenNodes=p}if((e.selectable&&(a("selectedKeys")?r.selectedKeys=(0,V.BT)(e.selectedKeys,e):!i&&e.defaultSelectedKeys&&(r.selectedKeys=(0,V.BT)(e.defaultSelectedKeys,e))),e.checkable)&&(a("checkedKeys")?u=(0,V.E6)(e.checkedKeys)||{}:!i&&e.defaultCheckedKeys?u=(0,V.E6)(e.defaultCheckedKeys)||{}:n&&(u=(0,V.E6)(e.checkedKeys)||{checkedKeys:t.checkedKeys,halfCheckedKeys:t.halfCheckedKeys}),u)){var _=u,g=_.checkedKeys,v=void 0===g?[]:g,y=_.halfCheckedKeys,b=void 0===y?[]:y;if(!e.checkStrictly){var E=(0,Z.S)(v,!0,c);v=E.checkedKeys,b=E.halfCheckedKeys}r.checkedKeys=v,r.halfCheckedKeys=b}return a("loadedKeys")&&(r.loadedKeys=e.loadedKeys),r}}]),n}(v.Component);(0,d.Z)(z,"defaultProps",{prefixCls:"rc-tree",showLine:!1,showIcon:!0,selectable:!0,multiple:!1,checkable:!1,disabled:!1,checkStrictly:!1,draggable:!1,defaultExpandParent:!0,autoExpandParent:!1,defaultExpandAll:!1,defaultExpandedKeys:[],defaultCheckedKeys:[],defaultSelectedKeys:[],dropIndicatorRender:b,allowDrop:function(){return!0},expandAction:!1}),(0,d.Z)(z,"TreeNode",C.Z);var W=z},82661:function(e,t,n){"use strict";n.d(t,{BT:function(){return f},E6:function(){return p},L0:function(){return l},OM:function(){return d},_5:function(){return o},r7:function(){return _},wA:function(){return c},yx:function(){return u}});var i=n(94480),r=n(76190),s=n(48736),a=(n(59301),n(639),n(65065));n(34061);function o(e,t){if(!e)return[];var n=e.slice(),i=n.indexOf(t);return i>=0&&n.splice(i,1),n}function l(e,t){var n=(e||[]).slice();return-1===n.indexOf(t)&&n.push(t),n}function u(e){return e.split("-")}function c(e,t){var n=[];return function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];t.forEach((function(t){var i=t.key,r=t.children;n.push(i),e(r)}))}((0,a.Z)(t,e).children),n}function h(e){if(e.parent){var t=u(e.pos);return Number(t[t.length-1])===e.parent.children.length-1}return!1}function d(e,t,n,i,r,s,o,l,c,d){var f,p=e.clientX,_=e.clientY,g=e.target.getBoundingClientRect(),m=g.top,v=g.height,y=(("rtl"===d?-1:1)*(((null==r?void 0:r.x)||0)-p)-12)/i,b=c.filter((function(e){var t;return null===(t=l[e])||void 0===t||null===(t=t.children)||void 0===t?void 0:t.length})),E=(0,a.Z)(l,n.eventKey);if(_<m+v/2){var w=o.findIndex((function(e){return e.key===E.key})),k=o[w<=0?0:w-1].key;E=(0,a.Z)(l,k)}var S=E.key,T=E,A=E.key,C=0,R=0;if(!b.includes(S))for(var L=0;L<y&&h(E);L+=1)E=E.parent,R+=1;var x,I=t.data,D=E.node,P=!0;return x=u(E.pos),0===Number(x[x.length-1])&&0===E.level&&_<m+v/2&&s({dragNode:I,dropNode:D,dropPosition:-1})&&E.key===n.eventKey?C=-1:(T.children||[]).length&&b.includes(A)?s({dragNode:I,dropNode:D,dropPosition:0})?C=0:P=!1:0===R?y>-1.5?s({dragNode:I,dropNode:D,dropPosition:1})?C=1:P=!1:s({dragNode:I,dropNode:D,dropPosition:0})?C=0:s({dragNode:I,dropNode:D,dropPosition:1})?C=1:P=!1:s({dragNode:I,dropNode:D,dropPosition:1})?C=1:P=!1,{dropPosition:C,dropLevelOffset:R,dropTargetKey:E.key,dropTargetPos:E.pos,dragOverNodeKey:A,dropContainerKey:0===C?null:(null===(f=E.parent)||void 0===f?void 0:f.key)||null,dropAllowed:P}}function f(e,t){if(e)return t.multiple?e.slice():e.length?[e[0]]:e}function p(e){if(!e)return null;var t;if(Array.isArray(e))t={checkedKeys:e,halfCheckedKeys:void 0};else{if("object"!==(0,r.Z)(e))return(0,s.ZP)(!1,"`checkedKeys` is not an array or an object"),null;t={checkedKeys:e.checked||void 0,halfCheckedKeys:e.halfChecked||void 0}}return t}function _(e,t){var n=new Set;function r(e){if(!n.has(e)){var i=(0,a.Z)(t,e);if(i){n.add(e);var s=i.parent;i.node.disabled||s&&r(s.key)}}}return(e||[]).forEach((function(e){r(e)})),(0,i.Z)(n)}},34643:function(e,t,n){"use strict";n.d(t,{S:function(){return o}});var i=n(48736),r=n(65065);function s(e,t){var n=new Set;return e.forEach((function(e){t.has(e)||n.add(e)})),n}function a(e){var t=e||{},n=t.disabled,i=t.disableCheckbox,r=t.checkable;return!(!n&&!i)||!1===r}function o(e,t,n,o){var l,u=[];l=o||a;var c,h=new Set(e.filter((function(e){var t=!!(0,r.Z)(n,e);return t||u.push(e),t}))),d=new Map,f=0;return Object.keys(n).forEach((function(e){var t=n[e],i=t.level,r=d.get(i);r||(r=new Set,d.set(i,r)),r.add(t),f=Math.max(f,i)})),(0,i.ZP)(!u.length,"Tree missing follow keys: ".concat(u.slice(0,100).map((function(e){return"'".concat(e,"'")})).join(", "))),c=!0===t?function(e,t,n,i){for(var r=new Set(e),a=new Set,o=0;o<=n;o+=1)(t.get(o)||new Set).forEach((function(e){var t=e.key,n=e.node,s=e.children,a=void 0===s?[]:s;r.has(t)&&!i(n)&&a.filter((function(e){return!i(e.node)})).forEach((function(e){r.add(e.key)}))}));for(var l=new Set,u=n;u>=0;u-=1)(t.get(u)||new Set).forEach((function(e){var t=e.parent,n=e.node;if(!i(n)&&e.parent&&!l.has(e.parent.key))if(i(e.parent.node))l.add(t.key);else{var s=!0,o=!1;(t.children||[]).filter((function(e){return!i(e.node)})).forEach((function(e){var t=e.key,n=r.has(t);s&&!n&&(s=!1),o||!n&&!a.has(t)||(o=!0)})),s&&r.add(t.key),o&&a.add(t.key),l.add(t.key)}}));return{checkedKeys:Array.from(r),halfCheckedKeys:Array.from(s(a,r))}}(h,d,f,l):function(e,t,n,i,r){for(var a=new Set(e),o=new Set(t),l=0;l<=i;l+=1)(n.get(l)||new Set).forEach((function(e){var t=e.key,n=e.node,i=e.children,s=void 0===i?[]:i;a.has(t)||o.has(t)||r(n)||s.filter((function(e){return!r(e.node)})).forEach((function(e){a.delete(e.key)}))}));o=new Set;for(var u=new Set,c=i;c>=0;c-=1)(n.get(c)||new Set).forEach((function(e){var t=e.parent,n=e.node;if(!r(n)&&e.parent&&!u.has(e.parent.key))if(r(e.parent.node))u.add(t.key);else{var i=!0,s=!1;(t.children||[]).filter((function(e){return!r(e.node)})).forEach((function(e){var t=e.key,n=a.has(t);i&&!n&&(i=!1),s||!n&&!o.has(t)||(s=!0)})),i||a.delete(t.key),s&&o.add(t.key),u.add(t.key)}}));return{checkedKeys:Array.from(a),halfCheckedKeys:Array.from(s(o,a))}}(h,t.halfCheckedKeys,d,f,l),c}},65065:function(e,t,n){"use strict";function i(e,t){return e[t]}n.d(t,{Z:function(){return i}})},34061:function(e,t,n){"use strict";n.d(t,{F:function(){return b},H8:function(){return y},I8:function(){return v},km:function(){return f},oH:function(){return g},w$:function(){return p},zn:function(){return _}});var i=n(76190),r=n(94480),s=n(33885),a=n(75931),o=n(11592),l=n(2738),u=n(48736),c=n(65065),h=["children"];function d(e,t){return"".concat(e,"-").concat(t)}function f(e,t){return null!=e?e:t}function p(e){var t=e||{},n=t.title||"title";return{title:n,_title:t._title||[n],key:t.key||"key",children:t.children||"children"}}function _(e){return function e(t){return(0,o.Z)(t).map((function(t){if(!function(e){return e&&e.type&&e.type.isTreeNode}(t))return(0,u.ZP)(!t,"Tree/TreeNode can only accept TreeNode as children."),null;var n=t.key,i=t.props,r=i.children,o=(0,a.Z)(i,h),l=(0,s.Z)({key:n},o),c=e(r);return c.length&&(l.children=c),l})).filter((function(e){return e}))}(e)}function g(e,t,n){var i=p(n),s=i._title,a=i.key,o=i.children,u=new Set(!0===t?[]:t),c=[];return function e(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return n.map((function(h,p){for(var _,g=d(i?i.pos:"0",p),m=f(h[a],g),v=0;v<s.length;v+=1){var y=s[v];if(void 0!==h[y]){_=h[y];break}}var b=Object.assign((0,l.Z)(h,[].concat((0,r.Z)(s),[a,o])),{title:_,key:m,parent:i,pos:g,children:null,data:h,isStart:[].concat((0,r.Z)(i?i.isStart:[]),[0===p]),isEnd:[].concat((0,r.Z)(i?i.isEnd:[]),[p===n.length-1])});return c.push(b),!0===t||u.has(m)?b.children=e(h[o]||[],b):b.children=[],b}))}(e),c}function m(e,t,n){var s,a=("object"===(0,i.Z)(n)?n:{externalGetKey:n})||{},o=a.childrenPropName,l=a.externalGetKey,u=p(a.fieldNames),c=u.key,h=u.children,_=o||h;l?"string"==typeof l?s=function(e){return e[l]}:"function"==typeof l&&(s=function(e){return l(e)}):s=function(e,t){return f(e[c],t)},function n(i,a,o,l){var u=i?i[_]:e,c=i?d(o.pos,a):"0",h=i?[].concat((0,r.Z)(l),[i]):[];if(i){var f=s(i,c),p={node:i,index:a,pos:c,key:f,parentPos:o.node?o.pos:null,level:o.level+1,nodes:h};t(p)}u&&u.forEach((function(e,t){n(e,t,{node:i,pos:c,level:o?o.level+1:-1},h)}))}(null)}function v(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.initWrapper,i=t.processEntity,r=t.onProcessFinished,s=t.externalGetKey,a=t.childrenPropName,o=t.fieldNames,l=arguments.length>2?arguments[2]:void 0,u=s||l,c={},h={},d={posEntities:c,keyEntities:h};return n&&(d=n(d)||d),m(e,(function(e){var t=e.node,n=e.index,r=e.pos,s=e.key,a=e.parentPos,o=e.level,l={node:t,nodes:e.nodes,index:n,key:s,pos:r,level:o},u=f(s,r);c[r]=l,h[u]=l,l.parent=c[a],l.parent&&(l.parent.children=l.parent.children||[],l.parent.children.push(l)),i&&i(l,d)}),{externalGetKey:u,childrenPropName:a,fieldNames:o}),r&&r(d),d}function y(e,t){var n=t.expandedKeys,i=t.selectedKeys,r=t.loadedKeys,s=t.loadingKeys,a=t.checkedKeys,o=t.halfCheckedKeys,l=t.dragOverNodeKey,u=t.dropPosition,h=t.keyEntities,d=(0,c.Z)(h,e);return{eventKey:e,expanded:-1!==n.indexOf(e),selected:-1!==i.indexOf(e),loaded:-1!==r.indexOf(e),loading:-1!==s.indexOf(e),checked:-1!==a.indexOf(e),halfChecked:-1!==o.indexOf(e),pos:String(d?d.pos:""),dragOver:l===e&&0===u,dragOverGapTop:l===e&&-1===u,dragOverGapBottom:l===e&&1===u}}function b(e){var t=e.data,n=e.expanded,i=e.selected,r=e.checked,a=e.loaded,o=e.loading,l=e.halfChecked,c=e.dragOver,h=e.dragOverGapTop,d=e.dragOverGapBottom,f=e.pos,p=e.active,_=e.eventKey,g=(0,s.Z)((0,s.Z)({},t),{},{expanded:n,selected:i,checked:r,loaded:a,loading:o,halfChecked:l,dragOver:c,dragOverGapTop:h,dragOverGapBottom:d,pos:f,active:p,key:_});return"props"in g||Object.defineProperty(g,"props",{get:function(){return(0,u.ZP)(!1,"Second param return from event is node data instead of TreeNode instance. Please read value directly instead of reading from `props`."),e}}),g}},49658:function(e,t){"use strict";t.Z=function(){if("undefined"==typeof navigator||"undefined"==typeof window)return!1;var e=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(e)||/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==e?void 0:e.substr(0,4))}},48911:function(e,t,n){"use strict";n.d(t,{Z:function(){return B}});var i=n(54476),r=n(76190),s=n(33885),a=n(20068),o=n(42978),l=n(75931),u=n(92310),c=n.n(u),h=n(29301),d=n(70425),f=n(34280),p=n(59301),_=n(4676),g=p.forwardRef((function(e,t){var n=e.height,r=e.offsetY,o=e.offsetX,l=e.children,u=e.prefixCls,d=e.onInnerResize,f=e.innerProps,_=e.rtl,g=e.extra,m={},v={display:"flex",flexDirection:"column"};return void 0!==r&&(m={height:n,position:"relative",overflow:"hidden"},v=(0,s.Z)((0,s.Z)({},v),{},(0,a.Z)((0,a.Z)((0,a.Z)((0,a.Z)((0,a.Z)({transform:"translateY(".concat(r,"px)")},_?"marginRight":"marginLeft",-o),"position","absolute"),"left",0),"right",0),"top",0))),p.createElement("div",{style:m},p.createElement(h.Z,{onResize:function(e){e.offsetHeight&&d&&d()}},p.createElement("div",(0,i.Z)({style:v,className:c()((0,a.Z)({},"".concat(u,"-holder-inner"),u)),ref:t},f),l,g)))}));g.displayName="Filler";var m=g;function v(e){var t=e.children,n=e.setRef,i=p.useCallback((function(e){n(e)}),[]);return p.cloneElement(t,{ref:i})}function y(e,t,n){var i=p.useState(e),r=(0,o.Z)(i,2),s=r[0],a=r[1],l=p.useState(null),u=(0,o.Z)(l,2),c=u[0],h=u[1];return p.useEffect((function(){var i=function(e,t,n){var i,r,s=e.length,a=t.length;if(0===s&&0===a)return null;s<a?(i=e,r=t):(i=t,r=e);var o={__EMPTY_ITEM__:!0};function l(e){return void 0!==e?n(e):o}for(var u=null,c=1!==Math.abs(s-a),h=0;h<r.length;h+=1){var d=l(i[h]);if(d!==l(r[h])){u=h,c=c||d!==l(r[h+1]);break}}return null===u?null:{index:u,multiple:c}}(s||[],e||[],t);void 0!==(null==i?void 0:i.index)&&(null==n||n(i.index),h(e[i.index])),a(e)}),[e]),[c]}var b=n(16089),E="object"===("undefined"==typeof navigator?"undefined":(0,r.Z)(navigator))&&/Firefox/i.test(navigator.userAgent),w=function(e,t,n,i){var r=(0,p.useRef)(!1),s=(0,p.useRef)(null);function a(){clearTimeout(s.current),r.current=!0,s.current=setTimeout((function(){r.current=!1}),50)}var o=(0,p.useRef)({top:e,bottom:t,left:n,right:i});return o.current.top=e,o.current.bottom=t,o.current.left=n,o.current.right=i,function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=e?t<0&&o.current.left||t>0&&o.current.right:t<0&&o.current.top||t>0&&o.current.bottom;return n&&i?(clearTimeout(s.current),r.current=!1):i&&!r.current||a(),!r.current&&i}};function k(e,t,n,i,r,s,a){var o=(0,p.useRef)(0),l=(0,p.useRef)(null),u=(0,p.useRef)(null),c=(0,p.useRef)(!1),h=w(t,n,i,r);var d=(0,p.useRef)(null),f=(0,p.useRef)(null);return[function(t){if(e){b.Z.cancel(f.current),f.current=(0,b.Z)((function(){d.current=null}),2);var n=t.deltaX,i=t.deltaY,r=t.shiftKey,p=n,_=i;("sx"===d.current||!d.current&&r&&i&&!n)&&(p=i,_=0,d.current="sx");var g=Math.abs(p),m=Math.abs(_);null===d.current&&(d.current=s&&g>m?"x":"y"),"y"===d.current?function(e,t){if(b.Z.cancel(l.current),!h(!1,t)){var n=e;n._virtualHandled||(n._virtualHandled=!0,o.current+=t,u.current=t,E||n.preventDefault(),l.current=(0,b.Z)((function(){var e=c.current?10:1;a(o.current*e,!1),o.current=0})))}}(t,_):function(e,t){a(t,!0),E||e.preventDefault()}(t,p)}},function(t){e&&(c.current=t.detail===u.current)}]}var S=n(67732),T=n(83652),A=function(){function e(){(0,S.Z)(this,e),(0,a.Z)(this,"maps",void 0),(0,a.Z)(this,"id",0),(0,a.Z)(this,"diffRecords",new Map),this.maps=Object.create(null)}return(0,T.Z)(e,[{key:"set",value:function(e,t){this.diffRecords.set(e,this.maps[e]),this.maps[e]=t,this.id+=1}},{key:"get",value:function(e){return this.maps[e]}},{key:"resetRecord",value:function(){this.diffRecords.clear()}},{key:"getRecord",value:function(){return this.diffRecords}}]),e}();function C(e){var t=parseFloat(e);return isNaN(t)?0:t}var R=14/15;function L(e){return Math.floor(Math.pow(e,.5))}function x(e,t){return("touches"in e?e.touches[0]:e)[t?"pageX":"pageY"]-window[t?"scrollX":"scrollY"]}var I=p.forwardRef((function(e,t){var n=e.prefixCls,i=e.rtl,r=e.scrollOffset,l=e.scrollRange,u=e.onStartMove,h=e.onStopMove,d=e.onScroll,f=e.horizontal,_=e.spinSize,g=e.containerSize,m=e.style,v=e.thumbStyle,y=e.showScrollBar,E=p.useState(!1),w=(0,o.Z)(E,2),k=w[0],S=w[1],T=p.useState(null),A=(0,o.Z)(T,2),C=A[0],R=A[1],L=p.useState(null),I=(0,o.Z)(L,2),D=I[0],P=I[1],O=!i,M=p.useRef(),N=p.useRef(),F=p.useState(y),B=(0,o.Z)(F,2),U=B[0],K=B[1],$=p.useRef(),G=function(){!0!==y&&!1!==y&&(clearTimeout($.current),K(!0),$.current=setTimeout((function(){K(!1)}),3e3))},j=l-g||0,V=g-_||0,Z=p.useMemo((function(){return 0===r||0===j?0:r/j*V}),[r,j,V]),H=p.useRef({top:Z,dragging:k,pageY:C,startTop:D});H.current={top:Z,dragging:k,pageY:C,startTop:D};var z=function(e){S(!0),R(x(e,f)),P(H.current.top),u(),e.stopPropagation(),e.preventDefault()};p.useEffect((function(){var e=function(e){e.preventDefault()},t=M.current,n=N.current;return t.addEventListener("touchstart",e,{passive:!1}),n.addEventListener("touchstart",z,{passive:!1}),function(){t.removeEventListener("touchstart",e),n.removeEventListener("touchstart",z)}}),[]);var W=p.useRef();W.current=j;var q=p.useRef();q.current=V,p.useEffect((function(){if(k){var e,t=function(t){var n=H.current,i=n.dragging,r=n.pageY,s=n.startTop;b.Z.cancel(e);var a=M.current.getBoundingClientRect(),o=g/(f?a.width:a.height);if(i){var l=(x(t,f)-r)*o,u=s;!O&&f?u-=l:u+=l;var c=W.current,h=q.current,p=h?u/h:0,_=Math.ceil(p*c);_=Math.max(_,0),_=Math.min(_,c),e=(0,b.Z)((function(){d(_,f)}))}},n=function(){S(!1),h()};return window.addEventListener("mousemove",t,{passive:!0}),window.addEventListener("touchmove",t,{passive:!0}),window.addEventListener("mouseup",n,{passive:!0}),window.addEventListener("touchend",n,{passive:!0}),function(){window.removeEventListener("mousemove",t),window.removeEventListener("touchmove",t),window.removeEventListener("mouseup",n),window.removeEventListener("touchend",n),b.Z.cancel(e)}}}),[k]),p.useEffect((function(){return G(),function(){clearTimeout($.current)}}),[r]),p.useImperativeHandle(t,(function(){return{delayHidden:G}}));var Y="".concat(n,"-scrollbar"),X={position:"absolute",visibility:U?null:"hidden"},Q={position:"absolute",borderRadius:99,background:"var(--rc-virtual-list-scrollbar-bg, rgba(0, 0, 0, 0.5))",cursor:"pointer",userSelect:"none"};return f?(Object.assign(X,{height:8,left:0,right:0,bottom:0}),Object.assign(Q,(0,a.Z)({height:"100%",width:_},O?"left":"right",Z))):(Object.assign(X,(0,a.Z)({width:8,top:0,bottom:0},O?"right":"left",0)),Object.assign(Q,{width:"100%",height:_,top:Z})),p.createElement("div",{ref:M,className:c()(Y,(0,a.Z)((0,a.Z)((0,a.Z)({},"".concat(Y,"-horizontal"),f),"".concat(Y,"-vertical"),!f),"".concat(Y,"-visible"),U)),style:(0,s.Z)((0,s.Z)({},X),m),onMouseDown:function(e){e.stopPropagation(),e.preventDefault()},onMouseMove:G},p.createElement("div",{ref:N,className:c()("".concat(Y,"-thumb"),(0,a.Z)({},"".concat(Y,"-thumb-moving"),k)),style:(0,s.Z)((0,s.Z)({},Q),v),onMouseDown:z}))}));function D(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=e/t*e;return isNaN(n)&&(n=0),n=Math.max(n,20),Math.floor(n)}var P=["prefixCls","className","height","itemHeight","fullHeight","style","data","children","itemKey","virtual","direction","scrollWidth","component","onScroll","onVirtualScroll","onVisibleChange","innerProps","extraRender","styles","showScrollBar"],O=[],M={overflowY:"auto",overflowAnchor:"none"};function N(e,t){var n=e.prefixCls,u=void 0===n?"rc-virtual-list":n,g=e.className,E=e.height,S=e.itemHeight,T=e.fullHeight,N=void 0===T||T,F=e.style,B=e.data,U=e.children,K=e.itemKey,$=e.virtual,G=e.direction,j=e.scrollWidth,V=e.component,Z=void 0===V?"div":V,H=e.onScroll,z=e.onVirtualScroll,W=e.onVisibleChange,q=e.innerProps,Y=e.extraRender,X=e.styles,Q=e.showScrollBar,J=void 0===Q?"optional":Q,ee=(0,l.Z)(e,P),te=p.useCallback((function(e){return"function"==typeof K?K(e):null==e?void 0:e[K]}),[K]),ne=function(e,t,n){var i=p.useState(0),r=(0,o.Z)(i,2),s=r[0],a=r[1],l=(0,p.useRef)(new Map),u=(0,p.useRef)(new A),c=(0,p.useRef)(0);function h(){c.current+=1}function d(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];h();var t=function(){var e=!1;l.current.forEach((function(t,n){if(t&&t.offsetParent){var i=t.offsetHeight,r=getComputedStyle(t),s=r.marginTop,a=r.marginBottom,o=i+C(s)+C(a);u.current.get(n)!==o&&(u.current.set(n,o),e=!0)}})),e&&a((function(e){return e+1}))};if(e)t();else{c.current+=1;var n=c.current;Promise.resolve().then((function(){n===c.current&&t()}))}}return(0,p.useEffect)((function(){return h}),[]),[function(i,r){var s=e(i),a=l.current.get(s);r?(l.current.set(s,r),d()):l.current.delete(s),!a!=!r&&(r?null==t||t(i):null==n||n(i))},d,u.current,s]}(te,null,null),ie=(0,o.Z)(ne,4),re=ie[0],se=ie[1],ae=ie[2],oe=ie[3],le=!(!1===$||!E||!S),ue=p.useMemo((function(){return Object.values(ae.maps).reduce((function(e,t){return e+t}),0)}),[ae.id,ae.maps]),ce=le&&B&&(Math.max(S*B.length,ue)>E||!!j),he="rtl"===G,de=c()(u,(0,a.Z)({},"".concat(u,"-rtl"),he),g),fe=B||O,pe=(0,p.useRef)(),_e=(0,p.useRef)(),ge=(0,p.useRef)(),me=(0,p.useState)(0),ve=(0,o.Z)(me,2),ye=ve[0],be=ve[1],Ee=(0,p.useState)(0),we=(0,o.Z)(Ee,2),ke=we[0],Se=we[1],Te=(0,p.useState)(!1),Ae=(0,o.Z)(Te,2),Ce=Ae[0],Re=Ae[1],Le=function(){Re(!0)},xe=function(){Re(!1)},Ie={getKey:te};function De(e){be((function(t){var n=function(e){var t=e;Number.isNaN(Xe.current)||(t=Math.min(t,Xe.current));return t=Math.max(t,0),t}("function"==typeof e?e(t):e);return pe.current.scrollTop=n,n}))}var Pe=(0,p.useRef)({start:0,end:fe.length}),Oe=(0,p.useRef)(),Me=y(fe,te),Ne=(0,o.Z)(Me,1)[0];Oe.current=Ne;var Fe=p.useMemo((function(){if(!le)return{scrollHeight:void 0,start:0,end:fe.length-1,offset:void 0};var e;if(!ce)return{scrollHeight:(null===(e=_e.current)||void 0===e?void 0:e.offsetHeight)||0,start:0,end:fe.length-1,offset:void 0};for(var t,n,i,r=0,s=fe.length,a=0;a<s;a+=1){var o=fe[a],l=te(o),u=ae.get(l),c=r+(void 0===u?S:u);c>=ye&&void 0===t&&(t=a,n=r),c>ye+E&&void 0===i&&(i=a),r=c}return void 0===t&&(t=0,n=0,i=Math.ceil(E/S)),void 0===i&&(i=fe.length-1),{scrollHeight:r,start:t,end:i=Math.min(i+1,fe.length-1),offset:n}}),[ce,le,ye,fe,oe,E]),Be=Fe.scrollHeight,Ue=Fe.start,Ke=Fe.end,$e=Fe.offset;Pe.current.start=Ue,Pe.current.end=Ke,p.useLayoutEffect((function(){var e=ae.getRecord();if(1===e.size){var t=Array.from(e.keys())[0],n=e.get(t),i=fe[Ue];if(i&&void 0===n)if(te(i)===t){var r=ae.get(t)-S;De((function(e){return e+r}))}}ae.resetRecord()}),[Be]);var Ge=p.useState({width:0,height:E}),je=(0,o.Z)(Ge,2),Ve=je[0],Ze=je[1],He=(0,p.useRef)(),ze=(0,p.useRef)(),We=p.useMemo((function(){return D(Ve.width,j)}),[Ve.width,j]),qe=p.useMemo((function(){return D(Ve.height,Be)}),[Ve.height,Be]),Ye=Be-E,Xe=(0,p.useRef)(Ye);Xe.current=Ye;var Qe=ye<=0,Je=ye>=Ye,et=ke<=0,tt=ke>=j,nt=w(Qe,Je,et,tt),it=function(){return{x:he?-ke:ke,y:ye}},rt=(0,p.useRef)(it()),st=(0,d.zX)((function(e){if(z){var t=(0,s.Z)((0,s.Z)({},it()),e);rt.current.x===t.x&&rt.current.y===t.y||(z(t),rt.current=t)}}));function at(e,t){var n=e;t?((0,_.flushSync)((function(){Se(n)})),st()):De(n)}var ot=function(e){var t=e,n=j?j-Ve.width:0;return t=Math.max(t,0),t=Math.min(t,n)},lt=(0,d.zX)((function(e,t){t?((0,_.flushSync)((function(){Se((function(t){return ot(t+(he?-e:e))}))})),st()):De((function(t){return t+e}))})),ut=k(le,Qe,Je,et,tt,!!j,lt),ct=(0,o.Z)(ut,2),ht=ct[0],dt=ct[1];!function(e,t,n){var i,r=(0,p.useRef)(!1),s=(0,p.useRef)(0),a=(0,p.useRef)(0),o=(0,p.useRef)(null),l=(0,p.useRef)(null),u=function(e){if(r.current){var t=Math.ceil(e.touches[0].pageX),i=Math.ceil(e.touches[0].pageY),o=s.current-t,u=a.current-i,c=Math.abs(o)>Math.abs(u);c?s.current=t:a.current=i;var h=n(c,c?o:u,!1,e);h&&e.preventDefault(),clearInterval(l.current),h&&(l.current=setInterval((function(){c?o*=R:u*=R;var e=Math.floor(c?o:u);(!n(c,e,!0)||Math.abs(e)<=.1)&&clearInterval(l.current)}),16))}},c=function(){r.current=!1,i()},h=function(e){i(),1!==e.touches.length||r.current||(r.current=!0,s.current=Math.ceil(e.touches[0].pageX),a.current=Math.ceil(e.touches[0].pageY),o.current=e.target,o.current.addEventListener("touchmove",u,{passive:!1}),o.current.addEventListener("touchend",c,{passive:!0}))};i=function(){o.current&&(o.current.removeEventListener("touchmove",u),o.current.removeEventListener("touchend",c))},(0,f.Z)((function(){return e&&t.current.addEventListener("touchstart",h,{passive:!0}),function(){var e;null===(e=t.current)||void 0===e||e.removeEventListener("touchstart",h),i(),clearInterval(l.current)}}),[e])}(le,pe,(function(e,t,n,i){var r=i;return!nt(e,t,n)&&((!r||!r._virtualHandled)&&(r&&(r._virtualHandled=!0),ht({preventDefault:function(){},deltaX:e?t:0,deltaY:e?0:t}),!0))})),function(e,t,n){p.useEffect((function(){var i=t.current;if(e&&i){var r,s,a=!1,o=function(){b.Z.cancel(r)},l=function e(){o(),r=(0,b.Z)((function(){n(s),e()}))},u=function(){a=!1,o()},c=function(e){if(!e.target.draggable&&0===e.button){var t=e;t._virtualHandled||(t._virtualHandled=!0,a=!0)}},h=function(e){if(a){var t=x(e,!1),n=i.getBoundingClientRect(),r=n.top,u=n.bottom;t<=r?(s=-L(r-t),l()):t>=u?(s=L(t-u),l()):o()}};return i.addEventListener("mousedown",c),i.ownerDocument.addEventListener("mouseup",u),i.ownerDocument.addEventListener("mousemove",h),i.ownerDocument.addEventListener("dragend",u),function(){i.removeEventListener("mousedown",c),i.ownerDocument.removeEventListener("mouseup",u),i.ownerDocument.removeEventListener("mousemove",h),i.ownerDocument.removeEventListener("dragend",u),o()}}}),[e])}(ce,pe,(function(e){De((function(t){return t+e}))})),(0,f.Z)((function(){function e(e){var t=Qe&&e.detail<0,n=Je&&e.detail>0;!le||t||n||e.preventDefault()}var t=pe.current;return t.addEventListener("wheel",ht,{passive:!1}),t.addEventListener("DOMMouseScroll",dt,{passive:!0}),t.addEventListener("MozMousePixelScroll",e,{passive:!1}),function(){t.removeEventListener("wheel",ht),t.removeEventListener("DOMMouseScroll",dt),t.removeEventListener("MozMousePixelScroll",e)}}),[le,Qe,Je]),(0,f.Z)((function(){if(j){var e=ot(ke);Se(e),st({x:e})}}),[Ve.width,j]);var ft=function(){var e,t;null===(e=He.current)||void 0===e||e.delayHidden(),null===(t=ze.current)||void 0===t||t.delayHidden()},pt=function(e,t,n,i,a,l,u,c){var h=p.useRef(),d=p.useState(null),_=(0,o.Z)(d,2),g=_[0],m=_[1];return(0,f.Z)((function(){if(g&&g.times<10){if(!e.current)return void m((function(e){return(0,s.Z)({},e)}));l();var r=g.targetAlign,o=g.originAlign,c=g.index,h=g.offset,d=e.current.clientHeight,f=!1,p=r,_=null;if(d){for(var v=r||o,y=0,b=0,E=0,w=Math.min(t.length-1,c),k=0;k<=w;k+=1){var S=a(t[k]);b=y;var T=n.get(S);y=E=b+(void 0===T?i:T)}for(var A="top"===v?h:d-h,C=w;C>=0;C-=1){var R=a(t[C]),L=n.get(R);if(void 0===L){f=!0;break}if((A-=L)<=0)break}switch(v){case"top":_=b-h;break;case"bottom":_=E-d+h;break;default:var x=e.current.scrollTop;b<x?p="top":E>x+d&&(p="bottom")}null!==_&&u(_),_!==g.lastTop&&(f=!0)}f&&m((0,s.Z)((0,s.Z)({},g),{},{times:g.times+1,targetAlign:p,lastTop:_}))}}),[g,e.current]),function(e){if(null!=e){if(b.Z.cancel(h.current),"number"==typeof e)u(e);else if(e&&"object"===(0,r.Z)(e)){var n,i=e.align;n="index"in e?e.index:t.findIndex((function(t){return a(t)===e.key}));var s=e.offset;m({times:0,index:n,offset:void 0===s?0:s,originAlign:i})}}else c()}}(pe,fe,ae,S,te,(function(){return se(!0)}),De,ft);p.useImperativeHandle(t,(function(){return{nativeElement:ge.current,getScrollInfo:it,scrollTo:function(e){var t;(t=e)&&"object"===(0,r.Z)(t)&&("left"in t||"top"in t)?(void 0!==e.left&&Se(ot(e.left)),pt(e.top)):pt(e)}}})),(0,f.Z)((function(){if(W){var e=fe.slice(Ue,Ke+1);W(e,fe)}}),[Ue,Ke,fe]);var _t=function(e,t,n,i){var r=p.useMemo((function(){return[new Map,[]]}),[e,n.id,i]),s=(0,o.Z)(r,2),a=s[0],l=s[1];return function(r){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r,o=a.get(r),u=a.get(s);if(void 0===o||void 0===u)for(var c=e.length,h=l.length;h<c;h+=1){var d,f=e[h],p=t(f);a.set(p,h);var _=null!==(d=n.get(p))&&void 0!==d?d:i;if(l[h]=(l[h-1]||0)+_,p===r&&(o=h),p===s&&(u=h),void 0!==o&&void 0!==u)break}return{top:l[o-1]||0,bottom:l[u]}}}(fe,te,ae,S),gt=null==Y?void 0:Y({start:Ue,end:Ke,virtual:ce,offsetX:ke,offsetY:$e,rtl:he,getSize:_t}),mt=function(e,t,n,i,r,s,a,o){var l=o.getKey;return e.slice(t,n+1).map((function(e,n){var o=a(e,t+n,{style:{width:i},offsetX:r}),u=l(e);return p.createElement(v,{key:u,setRef:function(t){return s(e,t)}},o)}))}(fe,Ue,Ke,j,ke,re,U,Ie),vt=null;E&&(vt=(0,s.Z)((0,a.Z)({},N?"height":"maxHeight",E),M),le&&(vt.overflowY="hidden",j&&(vt.overflowX="hidden"),Ce&&(vt.pointerEvents="none")));var yt={};return he&&(yt.dir="rtl"),p.createElement("div",(0,i.Z)({ref:ge,style:(0,s.Z)((0,s.Z)({},F),{},{position:"relative"}),className:de},yt,ee),p.createElement(h.Z,{onResize:function(e){Ze({width:e.offsetWidth,height:e.offsetHeight})}},p.createElement(Z,{className:"".concat(u,"-holder"),style:vt,ref:pe,onScroll:function(e){var t=e.currentTarget.scrollTop;t!==ye&&De(t),null==H||H(e),st()},onMouseEnter:ft},p.createElement(m,{prefixCls:u,height:Be,offsetX:ke,offsetY:$e,scrollWidth:j,onInnerResize:se,ref:_e,innerProps:q,rtl:he,extra:gt},mt))),ce&&Be>E&&p.createElement(I,{ref:He,prefixCls:u,scrollOffset:ye,scrollRange:Be,rtl:he,onScroll:at,onStartMove:Le,onStopMove:xe,spinSize:qe,containerSize:Ve.height,style:null==X?void 0:X.verticalScrollBar,thumbStyle:null==X?void 0:X.verticalScrollBarThumb,showScrollBar:J}),ce&&j>Ve.width&&p.createElement(I,{ref:ze,prefixCls:u,scrollOffset:ke,scrollRange:j,rtl:he,onScroll:at,onStartMove:Le,onStopMove:xe,spinSize:We,containerSize:Ve.width,horizontal:!0,style:null==X?void 0:X.horizontalScrollBar,thumbStyle:null==X?void 0:X.horizontalScrollBarThumb,showScrollBar:J}))}var F=p.forwardRef(N);F.displayName="List";var B=F},83145:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CopyToClipboard=void 0;var i=s(n(59301)),r=s(n(25769));function s(e){return e&&e.__esModule?e:{default:e}}function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function l(e,t){if(null==e)return{};var n,i,r=function(e,t){if(null==e)return{};var n,i,r={},s=Object.keys(e);for(i=0;i<s.length;i++)n=s[i],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(i=0;i<s.length;i++)n=s[i],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function h(e,t){return!t||"object"!==a(t)&&"function"!=typeof t?f(e):t}function d(e){return d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},d(e)}function f(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function p(e,t){return p=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},p(e,t)}function _(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var g=function(e){function t(){var e,n;u(this,t);for(var s=arguments.length,a=new Array(s),o=0;o<s;o++)a[o]=arguments[o];return _(f(n=h(this,(e=d(t)).call.apply(e,[this].concat(a)))),"onClick",(function(e){var t=n.props,s=t.text,a=t.onCopy,o=t.children,l=t.options,u=i.default.Children.only(o),c=(0,r.default)(s,l);a&&a(s,c),u&&u.props&&"function"==typeof u.props.onClick&&u.props.onClick(e)})),n}var n,s,a;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&p(e,t)}(t,e),n=t,s=[{key:"render",value:function(){var e=this.props,t=(e.text,e.onCopy,e.options,e.children),n=l(e,["text","onCopy","options","children"]),r=i.default.Children.only(t);return i.default.cloneElement(r,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(n,!0).forEach((function(t){_(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(n).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},n,{onClick:this.onClick}))}}],s&&c(n.prototype,s),a&&c(n,a),t}(i.default.PureComponent);t.CopyToClipboard=g,_(g,"defaultProps",{onCopy:void 0,options:void 0})},56102:function(e,t,n){"use strict";var i=n(83145).CopyToClipboard;i.CopyToClipboard=i,e.exports=i},76374:function(e,t,n){"use strict";var i=function(){if("undefined"!=typeof Map)return Map;function e(e,t){var n=-1;return e.some((function(e,i){return e[0]===t&&(n=i,!0)})),n}return function(){function t(){this.__entries__=[]}return Object.defineProperty(t.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),t.prototype.get=function(t){var n=e(this.__entries__,t),i=this.__entries__[n];return i&&i[1]},t.prototype.set=function(t,n){var i=e(this.__entries__,t);~i?this.__entries__[i][1]=n:this.__entries__.push([t,n])},t.prototype.delete=function(t){var n=this.__entries__,i=e(n,t);~i&&n.splice(i,1)},t.prototype.has=function(t){return!!~e(this.__entries__,t)},t.prototype.clear=function(){this.__entries__.splice(0)},t.prototype.forEach=function(e,t){void 0===t&&(t=null);for(var n=0,i=this.__entries__;n<i.length;n++){var r=i[n];e.call(t,r[1],r[0])}},t}()}(),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(e){return setTimeout((function(){return e(Date.now())}),1e3/60)};var o=["top","right","bottom","left","width","height","size","weight"],l="undefined"!=typeof MutationObserver,u=function(){function e(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=function(e,t){var n=!1,i=!1,r=0;function s(){n&&(n=!1,e()),i&&l()}function o(){a(s)}function l(){var e=Date.now();if(n){if(e-r<2)return;i=!0}else n=!0,i=!1,setTimeout(o,t);r=e}return l}(this.refresh.bind(this),20)}return e.prototype.addObserver=function(e){~this.observers_.indexOf(e)||this.observers_.push(e),this.connected_||this.connect_()},e.prototype.removeObserver=function(e){var t=this.observers_,n=t.indexOf(e);~n&&t.splice(n,1),!t.length&&this.connected_&&this.disconnect_()},e.prototype.refresh=function(){this.updateObservers_()&&this.refresh()},e.prototype.updateObservers_=function(){var e=this.observers_.filter((function(e){return e.gatherActive(),e.hasActive()}));return e.forEach((function(e){return e.broadcastActive()})),e.length>0},e.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)},e.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)},e.prototype.onTransitionEnd_=function(e){var t=e.propertyName,n=void 0===t?"":t;o.some((function(e){return!!~n.indexOf(e)}))&&this.refresh()},e.getInstance=function(){return this.instance_||(this.instance_=new e),this.instance_},e.instance_=null,e}(),c=function(e,t){for(var n=0,i=Object.keys(t);n<i.length;n++){var r=i[n];Object.defineProperty(e,r,{value:t[r],enumerable:!1,writable:!1,configurable:!0})}return e},h=function(e){return e&&e.ownerDocument&&e.ownerDocument.defaultView||s},d=v(0,0,0,0);function f(e){return parseFloat(e)||0}function p(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return t.reduce((function(t,n){return t+f(e["border-"+n+"-width"])}),0)}function _(e){var t=e.clientWidth,n=e.clientHeight;if(!t&&!n)return d;var i=h(e).getComputedStyle(e),r=function(e){for(var t={},n=0,i=["top","right","bottom","left"];n<i.length;n++){var r=i[n],s=e["padding-"+r];t[r]=f(s)}return t}(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)!==t&&(o-=p(i,"left","right")+s),Math.round(l+a)!==n&&(l-=p(i,"top","bottom")+a)),!function(e){return e===h(e).document.documentElement}(e)){var u=Math.round(o+s)-t,c=Math.round(l+a)-n;1!==Math.abs(u)&&(o-=u),1!==Math.abs(c)&&(l-=c)}return v(r.left,r.top,o,l)}var g="undefined"!=typeof SVGGraphicsElement?function(e){return e instanceof h(e).SVGGraphicsElement}:function(e){return e instanceof h(e).SVGElement&&"function"==typeof e.getBBox};function m(e){return r?g(e)?function(e){var t=e.getBBox();return v(0,0,t.width,t.height)}(e):_(e):d}function v(e,t,n,i){return{x:e,y:t,width:n,height:i}}var y=function(){function e(e){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=v(0,0,0,0),this.target=e}return e.prototype.isActive=function(){var e=m(this.target);return this.contentRect_=e,e.width!==this.broadcastWidth||e.height!==this.broadcastHeight},e.prototype.broadcastRect=function(){var e=this.contentRect_;return this.broadcastWidth=e.width,this.broadcastHeight=e.height,e},e}(),b=function(e,t){var n,i,r,s,a,o,l,u=(i=(n=t).x,r=n.y,s=n.width,a=n.height,o="undefined"!=typeof DOMRectReadOnly?DOMRectReadOnly:Object,l=Object.create(o.prototype),c(l,{x:i,y:r,width:s,height:a,top:r,right:i+s,bottom:a+r,left:i}),l);c(this,{target:e,contentRect:u})},E=function(){function e(e,t,n){if(this.activeObservations_=[],this.observations_=new i,"function"!=typeof e)throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=e,this.controller_=t,this.callbackCtx_=n}return e.prototype.observe=function(e){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if("undefined"!=typeof Element&&Element instanceof Object){if(!(e instanceof h(e).Element))throw new TypeError('parameter 1 is not of type "Element".');var t=this.observations_;t.has(e)||(t.set(e,new y(e)),this.controller_.addObserver(this),this.controller_.refresh())}},e.prototype.unobserve=function(e){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if("undefined"!=typeof Element&&Element instanceof Object){if(!(e instanceof h(e).Element))throw new TypeError('parameter 1 is not of type "Element".');var t=this.observations_;t.has(e)&&(t.delete(e),t.size||this.controller_.removeObserver(this))}},e.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},e.prototype.gatherActive=function(){var e=this;this.clearActive(),this.observations_.forEach((function(t){t.isActive()&&e.activeObservations_.push(t)}))},e.prototype.broadcastActive=function(){if(this.hasActive()){var e=this.callbackCtx_,t=this.activeObservations_.map((function(e){return new b(e.target,e.broadcastRect())}));this.callback_.call(e,t,e),this.clearActive()}},e.prototype.clearActive=function(){this.activeObservations_.splice(0)},e.prototype.hasActive=function(){return this.activeObservations_.length>0},e}(),w="undefined"!=typeof WeakMap?new WeakMap:new i,k=function e(t){if(!(this instanceof e))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(t,n,this);w.set(this,i)};["observe","unobserve","disconnect"].forEach((function(e){k.prototype[e]=function(){var t;return(t=w.get(this))[e].apply(t,arguments)}}));var S=void 0!==s.ResizeObserver?s.ResizeObserver:k;t.Z=S},98040:function(e){e.exports=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,n=[],i=0;i<e.rangeCount;i++)n.push(e.getRangeAt(i));switch(t.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":t.blur();break;default:t=null}return e.removeAllRanges(),function(){"Caret"===e.type&&e.removeAllRanges(),e.rangeCount||n.forEach((function(t){e.addRange(t)})),t&&t.focus()}}},82059:function(e){var t=arguments[3],n=arguments[4],i=arguments[5],r=JSON.stringify;e.exports=function(e,s){for(var a,o=Object.keys(i),l=0,u=o.length;l<u;l++){var c=o[l],h=i[c].exports;if(h===e||h&&h.default===e){a=c;break}}if(!a){a=Math.floor(Math.pow(16,8)*Math.random()).toString(16);var d={};for(l=0,u=o.length;l<u;l++){d[c=o[l]]=c}n[a]=["function(require,module,exports){"+e+"(self); }",d]}var f=Math.floor(Math.pow(16,8)*Math.random()).toString(16),p={};p[a]=a,n[f]=["function(require,module,exports){var f = require("+r(a)+");(f.default ? f.default : f)(self);}",p];var _={};!function e(t){for(var i in _[t]=!0,n[t][1]){var r=n[t][1][i];_[r]||e(r)}}(f);var g="("+t+")({"+Object.keys(_).map((function(e){return r(e)+":["+n[e][0]+","+r(n[e][1])+"]"})).join(",")+"},{},["+r(f)+"])",m=window.URL||window.webkitURL||window.mozURL||window.msURL,v=new Blob([g],{type:"text/javascript"});if(s&&s.bare)return v;var y=m.createObjectURL(v),b=new Worker(y);return b.objectURL=y,b}},93314:function(e){"use strict";e.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMwAAACaCAYAAADl9acYAAAAAXNSR0IArs4c6QAAIABJREFUeF7tXQd4U1Ubfs/NaJtO9kzLahFQEJkiUBBFUFFkCCjiAAVFERT5FREQQQXBBcpysWRP2RtkKRsEOphNodCZdDfjnv85CU2TZt2bhABNDw9PmtzvrO+c957xLQIP0pkz1yrQIEmwwcDzHhTj91klEo7jpcG5zetWUJdmRjmPvTM9GI9JgSGvadOoLE9KJJ5kPp2YXLtZdO1kT8ooz2vigCNelvPYezPEG7z0CDAn4pJqPvJA5A3vdcl/S3LEy3Iee29OeIOX5YDx3nh4VFI5YDxin6DM5YARxKb7g6gcMHd+nMoBc+d57LKGhCQ1ZURBCoVL2nKCO8sBZWW50x1TOWDuLP8FlV4OGEFs8glROWB8wmbPKikHjGf882bucsB4k5t3qKxywNwhxrpRbJkGTOx0ehlA3d9e5VEtzA3ulGe55zmg1QOfrCVo34BgQGvr5rLDRl4RRZG+5NjBESBc4FHw1LlrCAuPsCo0JjKi7J5hYqfTXADBq4byCJLf82Nf3kA3OfD9LgKdgeCzZ4CUTJ1VKQFyKQgpmeMSjiKvQC+oplspN/wOMDcBVFv0Bo+KwYJ4VE50H3Jg7j6CWzkEX74A3MrSgTfeKZpSaBCHcAVn/JunBHlFPDR5BkG9LMjPt7mZLOtbskQADea9wqOW9coqiGHlRPcHBxYcJriQQvB9P+v2cqCwWFxgoOJk6JeTNX4HmJMAHv6xP4/6VXw/+OxNx/bM/pIohdUE9VW/VxwjOHiJYO5A6xolpGSpYW3jIW4w/A8wM+h+UHSY2pvHgzV9NXymeor0wPc7Cf7XzWJ/4Nsm+Ly2LzZx+OwZ3yuVbzhNsPEMwcI3rM8wMikHiURi5gNbbQoKrc84zpjkj2eYzQC6f96DomUd305ctrp8tp5gSk/f1utzlFhUOHYthy9f8D1gdpwnWHiEYOVQ6zNM6QM/AY+CImHnF9YtfwTMCgB9P+5G0SHa9xP3bk2gT9cBU3r6Hjp95nBYNcz3gDlwkRhX843vlfS59PmFHfjFzgC/2pJ1nEEnEIpIAG+834Wia2Ox7PJ8wt0twLz7J8Gsl3zf316zCVYPsz5oe85F1yUcu0YwcQPBjlElZyjL8wsrQeyBn+XxK8DETqefgyACFCPe6kjxfDPfT6C7BpilBLMG+L6/A34h+P1VikCZ60nuTYpzN4AxqznjCqPOMZ1RSp9f2OVLYZH1lbOrNvjVlswIGEAKYOyrj1K82NL3E+huAWbEMnbFSn1+Qzd4AcE3fajPZV6X04D3lnHGM4xOawKFJwLLYiD5H2AoCkHwJQMLA42v090CzJjVBBN7UCh8rN3AgDrqCYq6lX3L6RQ1MGQRhwWvA7UrALbnFzCJjOhG+d2WjFCkUYKZPZpSDIv1PWDGrycY34NCahI0+yxN/Ivg3c4UlUN8VqWxok/XEfRrSdG0tm/rzcoHBv7KYc5AILqqLWDcOb/45RmGEFyhFL8/0Yga33y+Tl9uJhjxOEVIoG9rnrqVKSJSRFb0fb3tG1A81sC39TLRSu85HL57Eaii0Bm3oqEKqZXSJaUURUxTU0Tyuy0ZAc5SYCUbxE+6+x4w3+0kGNiWooqP3/Qz9xB0bUTRsLqI2eEFUlbvA9WBJxv5ltdMit9jFocpLwB1InQIkBEQTmLUHStOBoMBOr24K2+/AwwPHOKArS2iKCY9VzKIg34jyMgTv6f1wpwqL8JLHKgUTLHwjZIxZTKg0V2Bzg2tLzvYBYA75xe/25J1mkEnGAzYyXE40KQmMK23uLeLN8b1j0ME7epTxFTzRmnCy/jzXyCqIny+NVryDzFeKfd+xLcrDOMMO8MMfgx45iFrOZA7AstiTvvVoZ91usM3tClHcLpeZWDmAN8DZtlRgkY1KJr5+BC87hQQLAeebCwcZN6gXH6MgG2P+rfyDmD+WLoV8xZugkIRiNh2TTHghcfRoF4tFBZpkXgpGQ81rmdu9puLOLzwMPBYPR1Cgzw/v7CC/WpLxjrc/jtaT2LApRrhwC+DfA+Y9aeI0dKzbT3vTCChk3r7eaBABzzfTGgO79CtPUmM9b7U2jv9bf3kOyjSlihLcoSg93MdkZ2Th227j2Hoq8/inTeeNzZ+xFIOsTHAsw/pAeL5+cUvAdPuG1pVRnArQgEsGex7wGw7RxAgBTo19M4EEjqtD1wEkrPYm15oDu/QbfkPSM0hHsu8du0/gSnfLkFGVrbThjFLynULJ6FOZHUw2RNbyd/qUJLFHZV+ywr9aksWO4Ou0BK8KueRz/bVq++CUuD+RGbhB3R/0LeAOZEEnFIRvPGYb+vdGw+cvU7w3uOe1dv+mfeRk5svCMUfvz8AA3o9jgkbCJQVgPe7lGTz5MDvj4f+VXs/JH1ip1PmAkHy17u8z42bjl4lxjf9C809m0CCZo4FUVwKsDPOJLz0ZTp6Fdh6jtnWe1bvuCm/4q/tRwQ1/b03e2LIwGfw1RaCkADg425AOvPkYCHZd0cG43dbsk4zaDFgWHiHcG85wjBQoEhnMhAzf5r/Jihkf9/+fjXDtDXqGA108+Eqcy0DYAfwMU95NnEFzVgLovibwK8HCab19qze61s24Pf5K7A5KwB5vHM1CblMij9m/Q87rtc1jsek54CMPIBayGD0BgP0ImUw/gwYFiqjllhHGAcvAkuPcijU8cgv0KGgSGv8LNJqweu1MOh14A3ss+S78W+Dzuo3RsPoTy0YgIjQALFz0C36tBzg570EE3p4NnHFVn5TA0zaSPDzy57Vu2bIS6jF67BDHYBHgnVI0kow+6ZjLyZNm9RD+35jkZINfNO7ZIVhEn+e16NQ6157/OqWjJ1h9n1IXoydTi8AeGD+KzxqinCEsfkswfBJC2HQacXOG7v0B+e9CGXVUK+U5aoQdm5iE3eqh296R/XoDEBu0e3/hcz3FzF+Z292trI91Zgav7N2tKrDrrfFTdgTI4dAl61BipZDDXYINRCMvBrusNvBikAMHT8LTM3/pwElK4xMAuQV6uBuKK4yA5hEVfY8SvmmHCETGyjDtzqbQLHf0KMgaCnWEcaW/whGT1mAHHZP6oW09bueaFy3khdKcl0EO+y+v4xgphs2MWxbs+K46bLCDIoi6+9iVLKY4PbTp8UB5t8h/UB53qimz1aJA9lyLExz7H1vyMCnUa15L/x9EfhtkIk/nh74y9ShPz5JnUGA26qFZIdcTofWqR5xxd5Uip1O9wDoJNYRxs4LBB9PXYxUdaHrGSqAYuWUp9GmSQ0BlN4h8cTq8qVfOGgKStpBeAoJb4DEYPrPsU89b/5e/LvEYPubLCIQX06NEtWpfwa/yA4h0FEgqVCK71OCUeTARdLLfbpg9PAXsfGsBBtOA0uHmKpyV0PZsqFl5lo5QaXWgRqNw4pTHiEYGa2M+KX0yMROpxsA9BDrCGNvAsG4GcuQdMt45eJx+nXsk3iyNbOY9k161wOry8/GqZCr1t4GBA/O3T0Nm7gSDl/89IBRHiU0nRk3CgU3knEmT4pZN51rrjI5TN2oGmCOMP44BKx7B8jINemP8ZRCK2Y5LNXAMrMlS0hSpwKw9TRGME+XHf5ekybEfPCInU7/BDBArCOMw5cIPvt+JRJUGqHj7JRu2rsd0P+JGBuanELTTVpwwO3/cnjFxNcTwMz95hquxud5pd+skIEfR6NJA+F2y6o1S3Fj4xpj/X9lBmK7OsDuChMUKMf+v36AXC4Fc4QxYwew/X0gM8/k5VKvN0BvcF9gfc8CJuGWuh4twgoQnJSBzK+nDP+3eLTsBahJSNL8DdD29kaUAFsDSU4vpVJp3FTETqdzAbwl1hHGySSCCTPX41RimlcmzthBrTCsV1Obss5cJ2hWXQupTIoiHUW+1nRYZkcn5kRbTzlIOQq5hBmimfRu2RwoeU4gl5rAFiI3Odpmb/NRK0zXu+zgKzZtWZWK/VvTxWZzSP/EK5HoEivcxsFQWIBzk8caVxmWmMT+g6thNlfMg/p1xYfv9DXSMEcYEzYAu247wnBXQ9myE/fslixRpf6FUgw2N5bgDChmk6Lw33MMqkqlg8JeVKmn8hRjHI0QIdgbiJynGWhiZ9AZoPhgaEeK50Q4wmDCvwmzt+HwGe8EcH67V1N8MshWV4UBpnlNLQID3Lcn5nkKrZ6iUEex4azEqC08di0BW1XDgsTP+2NHsrH6F+/0m9Xetns1PN9b3IWHPi8XyetXIOPoEeg1WbhYKMGK9CCoiiSoWq0SnuvWzqhLVuyoz+wI411mmi3epZI9Lt2zgElIUht9INtpdDJPMUsSGf59NCFFxc8TknI6AoZ9LqbCmj+V4X33zMAEAOMHtaXoJ0KLVpUJjJuzD3v+vSh+xtnJ0ffxaMwY0dHuCtO8pg6BAcK3LI4axCTai/4hRsBM3kww5DGK6o5vYx32S52pw9QxbEi8k6o2DMeoj2q5VVhqNnB29JsI0TP5M6Dj5Gg7dwmkpVZOsyOMtyg4joDyBhRq3d+Osbru3S2ZSp0LCmf+9ZM5CUY3qBWx3LREUy5RpbkKQOl0FAimvrksPAME08Q6wmD74DGz/8H2A/+5NdClM8U2r4VFE7rZBcwjtXQIkHsOGLbSLP7XBJhvdxD0fJiinhs+pVk5n41IBM/UFryQSHggvpxRooovpsgdFwjoD8MQri3ZIso/XYzm9a2FwDfUAFPxX/AaRYSCeCR/KW7fvQuYJE0RQF3vSQh2UQn3bsOaYXEJSZrPADrJBfP5BceCVx+4LO0r1hGG3gC8//Np/LXrmJjxdUhbv1YE9vzU22eAmbOPBRmieNCNFzvP8/jhaxVSL3vn4M9zBJN/bgSZgJsyplZ0KQ24oSZgq8vmE4V4+9hrkNIS8O5uPhbNOz+CprWpWRhd7Ahj9svMYM871rT38pbM/q2XvelHoeU4bpxBgt+Jjr8MAqfi80NXZEW/H1UEuOMIY/zCRPyxZr9XABMSJMP5pbelahYlsjNMi1p6402Pp8lyhWEhIBpVp2hdV1yp6nwgPAhYvzQF/+zOEpfZCfXgz6LRIMrxKsq0B5YcKsL6UxRFvBygelBdLjhZGMCx/RfTKWMCUGZzbAClvJEmtiGH97oEGLdhzBHGjL4UDyvLOmBUmn9AaamAay7GimAXgdErzG1RlX36k9el+PlgsPFtK9YRxtwtNzBl7havTZoLywYhuJRbSCNgauvBlAg9TQYDjyVHOeOWbOVxoEoo0Mn2JttpNZvOcmhfn0KTXoTr8TlITSnCrRSt8TMvV7gj79KVPDskCo+1tb/rZkLScavzcTlTARBrZUu+MB1coHNHZ8rQXEzvH4T+8yWY9DzQrj6QptFDzzRlPUj37JbM5pZMeCfZK5CNgsPt3PlbEny3LwSlHWEIqWLzcTWGfbFaCKkgml0zeyNaaa3QdqcAs+msSa2k+4OCmmYm2nyWQ98W9idabo4eqSla3EopMn6m3mRgKkJ6KlM6dV5Plz418ES3CjZE7Ar9w2X5UGXbv3bmC1NBAiqBEOf34zFhKlzLq40PuxK0i8qFutBzRdd7FjDx1zSDCKELxA2tmZoyyztqqc9tUdDlDAm+2hUCdxxhHIwrwOAJy5EvIkSCsz78Nq4rnmhpfU/BANOytgEydwQmpSpjQro/b68we+JNArzej4jjKouz0q+luDwGAzWCxnI1Kr0qPfpEZTzXv6pVwUzf6+MVBTiX6vi+hxoKQfUF4AJswWZZGF+UCUN2IsYMaINnbcVd4jp0m/qePcNcvJlTldcaUm5vVN3qnKNM1zUcJm4LhTuOMP65qMWYGWtxJcU76jGT3nwUrz1j7ZnCCBilAbLS96RucIFJtv88ZpLD/HMZSEgFXmkrrqANp2yjEYsroYRar6f44I3zxh9qNwnH8FHWNxBLj2ix6F85SKltmGV9lBrAF6RConCuh8fotCn7MSC2Fob3ELkPddDBexYwrL2JSZqtFPQpdwfHUT7mf+zjTWFwxxHG8St6zPhtCw6cZXcSnqdhLzTF2FethZcMMK2UBki9DBgmbz18mYAJbMUk5shiYBsxORzT5ucZ8PHbcUaC4OpBGDe55AbiShqP9/40gHLOt058UZbxXMPJnQuUKK+DLi8DEs0R/PJBLIIVwjULHPXgnt2SsQbHq7JeIJSYFIi8mNgeeeT6cFRQAItFOsL4L5li0do9WLrLriK06FZ2e7QO5v3PwugcgDcBo9MbsPT2CnMxFcYwdiNFuMhlKjcs/J23AMMEoONHJhj5JA2T44tvS2TTo5cX4kKqY5X9YuYacq9CEhzlMngmr8uGQasFLUpDPcUV/DCiKwrcNBwrrvueBsyKFVTSvG32aQraRPRMdJKBWaa+vSrcqNAo1hEGsyD8Y/1R/LzmjFea1EBZAbtn9rIqywiYSB5Siecey3U6A5YeN23JmCCPORIcK8IWhV0ps1Wpj8hzjyPmsDPN5P+ZNCWInMOXPz9g/PtgohZfbpEZ3SE5TxSGXBUkIa61vPnCDLCzFEuGrOMY1q02Xunq2VS6p7dkrKOJ17N7UAPP1PG9moatCoOBJ9go0hEGe+P+vC4e3yw84JX2VAoLxMmFL9sApnUkD4kXAKPV6bHsuNQIGDb5p28nmCwixmZSJnA5jeCZh1x3NzfpKi7M/xlFGRmo0qoNqnfohPAG1mcH1dUCfDP+sqkwjuCreY2Mf478swiJGa6V3Az518EFVgHhXMu0DYUZ4G8Dhuqy0Sg0EfM+8myHf88DhjEzIUmzAaA9XA+ZcIqR60KRp+XgjiOM3Sdu4s0vtyAkSIrgQCmCg6QIYZ+BMuPf7Dfzs9vP2bPi34ICZTh2szJ6NM41HuyrV7f2G8tWmNZRPCSc5yuMJWCYGcjHawm+7Sv8DPPfdSBfS9C5oWveHhg+GFqNyfRBEhgIeWgY2kz7AZysRDh5KT4fP0y5vZ0lwBdzGoO9FwbOK4S6KMDpCkP1eaD6fCNghCSDNhe8zmTsVznrMD59XIGa7Wx194SUVUxzT2/JihuZmJJThWoNZ0HgNY/EH28MRUY+B7GOMFibcrJzkJuXB3Z1zXHc7U9ivNlh0mX2aXpm/7ekLA57E6R44zHm5slWAs0A0ybKpDDoaWLhHJafMK0wLIm1ujx0iYD56WgrQO3ryuplSN6xzajkqM83+RCr1aUrol95A5zUJIT971QO5n2bZPybXYRNntsYvx4guLJrL1qkbsD2moOQHP6wlUskRkt5PfiCm5AEC/exa9DmgNcVoVL2KQy59RsqhAQg6tPvwAU5U1F0zvH7AjCsC4mqnE6UGpitvsfSJ0IIHb8lmNzIlkCsIwxPJzDLf10NrDtJMNyBjzDvAkaH5SdkbgOGOf5oVAN4sKawnl+YOwspf+81EzPIh9VvgCbvfoDAKlVx9JAai+ZcNz4PVBBE9W+M07uPo9/laeBgknSeC22ObbVeQ06QCRzselivuQhZBNveCX+JGAoyEZEThyE3fkIYNa00yh69UPdF6y2wsJ6ZqO6LLZl5pUlW9wHFMkrh6mTokgdf7QzG5UwpxDrCcFmwAAImPPztIMHorva3RkbA1GEhGoRPDkfVMj/EVoARaabM2vliCxj9QQtJ1GDAtU3rcGPXDmjVWWDfWWJbtHp9BiCwRScU6KQICJRg4VEp4g8ex4tXvrFSpGT0JxXNsKraIEgVFaHLuQ5ZSE1wAeLsEioRFZ5PnAVlTok5hiQwCG1+mAupwr1V5r4CDGNkgkrzEij93Znqi5CB/XafAhduySDWEYaQsl3RFGiB6Tsce4NkgGlbx+WtqatqjM9ZlOAVJ0tWmPeWEvzYX3gYcOY9cuKzsLE1EVK5oagQJ7/4DDlXS67gZTVqI6dlXxwNaIXrJ06j75UZkFhoHbNyK7Zqh2E3usHAlCupDgFhtSAJEmdsxsqJqZSHevmJaHPoC6vm1nvpNdTu7t6R+L4DjAk06t7M+tKuDb+QkQTw00EFTl2XQawjDIHFOyVj6h+frSeY4uC2it1MRVXgIeUIpBLTWcjdxMJArDgpN2/JPlpF8PlzwoPDjl9v0vZ1N2k1apz+ehJyVaZzS3HimUMKIoWUWrusqtDqUTR46308/bUKekghU1QBkbq+PbPXPkNuEog8DAOS5+ABzVEzSWj9GDSf+JVbXbovAcNs+oODFYSjsp8oqCm2gcj06z9BOHJNbjTZ7RDt/oQQWa2ZXEw0ZWY1yYzYGdCYuj5L7AJNwgBlvHRgj3mjnfvtx0YlS/Zcp9dj6wU5nmpiysccdLMYm5UECr3HruHwQ3/P+KPLzcWZ6VOQfdG5xWbVzl0R9fJgEI7DjO0Eu85rQSTuH1lbV45HbmYSzl1OR+2im4g0ZEJpyETdAC26zpnv1tDdt4AptulPNJ1rplMKUY6uFh8PxL5LARDrCMMtLtvJJAYw3qqTlcOCw7JYLUoBwWHZWWvBIYJxz3jeAiZxv7R0AZJ3bIetdT1B7T4voebTPc0VMbe2G08Wur26sII+6JyD5x4JQU6+FkfOp+DA2es4fO4GsvO1qFk5BE3qVEaTupWNn9G1K0AmILT1fQ8YxhhKqfTi9ewBoPQjSiFAxAasOh2AbfGBRr0qMY4wPJ86phLuFmBm7ibo2oSioYAL+uPXgKvpBIMe9VavgctnE5C7fyuyz58Bc2oRVKMWaj7XBxVbWGuELjxMsOxIAYjUtaqMo9Z90CkHz7WwXkoNPMXZy2k4ePYGDvx3HVdSTHIjBqCVn7verJQJwBQzjKnzJyRlPcZJuJ6UxwsAHEoP/joXgA3nAiHWEYa3ps7dAgyTeTwSRdHcuecDYzdXHCN4oBrwaH3v9Fqr55GWmY2ICNe3XWtOEvyy17MVZmRsLnq2dH4bdv5qBt6Ytg3d29TDOAFvhjIFmNLDGp+c1UxCycs8xTu3jcrMJDvi5VhxOghiHWF4Z+rcvRXGGBy2EvCYABB8sZHggycpqoa6f+lgya/MXC20RUUIDXV9gGJueb/d5tkZ5r0OOejd2nldm/+5gkkLDuOzQe3QrY1r2+0yDZjiwbp4PUNJeelKSqlZSX3/ZRkWHVNArCMMbwFm/AaC8c9Qt65rPWkDCw7Lggw9YVLhcprWnCCoH5qKGmHUaC4tl8sgl0kgl7FPqWhdt6upuQiWc1AoXN96MSd849ez62/31YPeeSwHL7Z1DpixvxzA7hNJWP9lL1RmjgtcJL8ADOOBSkWDCqiGaQoYlYn+TZJh/hEF3HGE4YqpQp7/sC0PrzRPhYxPg9yQjmCkoTA/HUV5aZDq0wBZBQQ0my6kKFE028/BGODpOYHBYfPy8qDT6aDT6Y2flolpUxeDhznscAWkfxKzEFNDAbncteIk8xIzYinxSBj1VrtcvPSo4y0Zs0Z96qPVqFpBgcXjnhXEx/saMCZfZNmTQCjTmZCAEC0oUglPU3iOnDEYtCcb16nCrDaN6ZxKU1HK0xOEIOrMDSlmHnDPEYZLzhoKAW0aivLSQXRpCKRp4HTpKMxNAy1KN36XE+cRAHjKIb/pckhk7h967bXz70STao47wWHZ9bZebwJOMYDY38Zrb4vEtKwZeAKMq5IJSDKZFOuPpqFr8yqCNBjYDd3AXwwgnPu+2Qa3zccrjzleNY7G3cR7P+7G8+2jMWaAMH8r9zVg4pKynudA1jmawExnjKf8fwRkAwF+j46MuJSoyupEKdkdnyoh0/e65wjDUX1c3MdA3hUEEO+YL6fU+BwRNUQa07tAM7v5OpNM8LoXg8PqDXrotHrojUDSQafXgXmrKZ3i0uV4vKkwiT2TJ/WcqYWBBLp8PzkieK1NIV5r71iO8/2qE1i2O8542GeHfiHpvgbMRVX2RzzlpwnpKCGEOa76i5dynxCeTriaTvpP2RnqliMMhwC9MBaBBaeFNEcQTU7FvpDWeU0QrVCiCynA7jjHip9Cy3FFxxz/mVYi0//sPD2u5wWgXUOBSmkAXvtVj7R819s3R215ta0Orz/m2FVVnwkbkJyWa7xOZtfKQtJ9DZiEpKzXAfKbkI6W0JAiQrDyZjZ5adyWUM4dRxiO6qOqRVCkLRPXHCfUt2gjhLXw7jmGBYdl18Uf+Tg47K4LBCz0uZh6P1oJnL/p/qH/5dYGvNnBfv5rN7PRb9JGVAoLwoavrC1enQ3gfQ2YC1ey6kil3CV2lhE7S7MKuMIxf4UGuuMIw1FdhszjCLk6XmxTHNLrqRT5TVdAJnNfPaR04cbgsPsIJjzrmbqL2E4evgxsPy+uXubM7+Vfmbss9661X2lDMdhuABRgyc4LmLnmJGKbKfHlW8KNyu5rwLBBS0zSbKBuWGOyWCoj1rrnCMPRZNEX5SLk3ACmVih2PjmkV9WYiso1RHrec1I7i1HJ5Ct3Kjiso6rPXgeY9P6bPsKB2uSRWKSlZbjNy3FjhuOTD5kIzja9891OnEhMxVs9muHVbsL5e98DJu5ydkNOxh934enfhmPsUDl0ZRgCZUS0IwyHWzJmqPPfcATorrk9yKUzZld5DTKlKUCQNxLr98jlJhV/X6ZrmcBXmwnmDBReb2R0CxQWmiOaiG5uj+5dsOyPH23yMd2ybmNWg6nJfDv8cbRpLDzO6H0PGMaN2zYyi8Q6/Ru+Ogw6A8FfIh1hOBs5evE7KLJ3ih5cRxluSR5FWLNxXiuPFeRJ6D53G5KWC3y4gmDhG8IAw7Ssa9Vlpsrup8jaNXHh+A6bAnYcu4bPfjto/H3z1D4IZ5JcgalMAIb1NVGlHkwpmQ1QwRf3H6wPRU6Re44wHPHXcGMTQm7+LJD9rsnU+soIaO2ux1z75Yu163fdStcUuYXA6wsIVg4VBpjMLDUeaOrgAOK6OjNFcvwhVCiluzbh90PYdvQqqlcMxuovSjSkhRRbZgDDOnsxOaczpYaFlEKQp4Sxm0KQlidxyxGGI+Zqs+IRfuUDIbwXTJMWsxghIc79CAsu7C6Ndg0lAAAdVklEQVStMEws88Jsgg3DhQEmSXUdLdt55hLJuIKs/g2x7UvcdrJtWPcxq40q/h2bKfGViAM/K69MAYZ16NKlzHCDlHwBwr0FUKdr7efbQpCs8a4jjMKCfITHDQRH3d97l578qmqTUblWczGYcErLzjDT+/hej63HLA5r32YOCl135dyFeHTuahtsynVOa4qvPv8II4aVyLJOXUzFsG9NW+bXuz+EISK9lJc5wBSz69KNzEheLxlFQVnEIrvmUlN3B+NiuncdYWi1OsjjP0KQznvxIDVVh0Bem1kreCcZg8N2pwhzX4juVkN6zebwx+u8oHr/OXoCPXrZBpsSW/GAvj3wy6yvzdl+WnsKi3aYnKFPHtIBnZu79qBpWWeZBUxxJ69coYE6ae4zlOqfIyBPM59uxc++36/AuZvedYTBJNz6+OkIL3AVn1b40N8K6oawRu8Jz+CCcvImgiEdKKoLF7p7pe4B8zl8148XVO+uPQcwYNAwj+tt0iga/+4t0Z4a8MUms9HY0vE9ECnUHc7tlpR5wFhyfA+l0lqq7L4A/QlAhTmHgnA8We51Rxh5FxejcvZSjwe7uIAk/cOo0nqK18qbsYPghebUGO7Dl+n1Pzh89iwvqN71G7fhzbc/9Lh5LALCzr+PQVMkR2w0Na4u566m49J1tVElRqyDEb8CTDH3LyblPMhTw67fjwZVPXTV+44wspP2oVq6IBU3QRPiprYWwtvOE0QrhGj2PoKO0dSoR+fL9O5SDm/H8oLq/XP5Gowc7R2tic9/XIlNyU2wY5RH1gJGVvklYFjHL6k0Ty85EbhxV6KceNsRRuatS6h1fYTX5mK+IQR5TZcbDb+8kVhw2MY1KFrV8UZpwsv4ZC3BCw8LC0o7/7fF+HRCydnDWS1FOSmQh1S363aX5XtlxGTEBfbCxveAIMFCB/s1+i1gGDsGL9Cvvpgm6eVtRxgZGZmomTQYHNUKn01OKHlIcEG5AfWE+eB2WefKY0DVMCDWO0G5XNZXTMDOTu3qUzxuinDhNH0/cx6+nGYrpS+diflxLkhPgFRRGfIQ+wzq9OxA5DUei5VDgYruObw0V+vXgOn8LR3L85jibUcY6iw1KiV9CLnhpqt5Ieg5DxkOV16PRyKFyTBcFbrxDPNZJj44rKtyXT1nvsYaVqeC4k1OmfoDfpjl2ncYb9CiMOOS0edyUOVoEGM4cuvUuGkrBHdbgIVvALWs4++6arLNc78GTOx0yq6efvS2I4zs7ByEJY1HkNYUactZ4kkg9FwE9JIKMEgijH8bjN/Z36bftCQcudLaeKC6q9KEPd8dB2Tliw8OK6x0x1Q/7SWoGkrRt4XrksZN/Brzfl3skpB59S9IN13hy0KrQxZkK+ANCQ1Do7ePYO5AoIF1DFqX5Zcm8G/AfENfB8Fv3naEkZubi6CkbxCou2yc9CZARJgBwcCRVlgZV3KC0aSmAhwnQYBcYowHI5FIwIN9MjPfkt/shcUQPdq3Mxy5DLDwfQNFBod1t77ifMyxuVxCBdX7wZgJWLzUdXh3Zh7NtmSgPCQBIQgIt+8/qtmw3fj5zep4yDoGregu+TVgOk2nTNl8pbcdYeTnFyA9U2MMDhQYIIFcwoGTSGCgnHHLECTnIJVIMG2H1BjywtcCRBYc9shlgrdEBocVPbtKZVjyDwGLLyqk3mHvjsGa9ZtdV0k4FGZdBa/NM/JbUcX+wSy692z8PDoWAjwpOa3TvwEzjXajHLa0b0DxSXfvnA9cj3AJxfe7TG5bq4aKyeU5bWIqsOkswcguvu3zyuPE6IBDSL2DBr+Hrdv3uOxshVqNkZqwH7q8NCNtYKUG4CS2V2G1OozE7ClvoZOHFx3+DZjptD0F/m4RRTHpOd9OHja4c/cRdHuQGh3r+TKxScuMuXz9kmDRmM/dgKB6+wwYgv0HjrhkS6+Bb2PlbzNQpDbZILEtGdualU4VH3gaX0/92ii89HZSVpY7NQllzvOLfYG7W7d7Nqe3a/NGA1hR7WfQZhKKU0yAN62396wkhTKFyUPa1qVo6KXDvNB62YH/2x0EXzzv/cnjrA07zhPsT4SgepkeGdMnc5V++nE6Phz/PTITmEIlhSykOmQK24M/W3mmzV2Lpxp7f5z9BjCPT6P1DRwuetMRhqsBtnzOnFHEVAMeVvp24hbpmata4lHcFzH9LKZl8TJXn4Cgep98+kWcPmtSknSWVi/7BZNmrsc/G2eC1xVAqqgEeYjtVRjhpPji1wN49qE7x+uYyAi7C4E3XvA+XWFU6Vo1ABsP2MzJwvDlMnjTEYarAbZ8zrYoVUKBR+vduUF01J67YUR2OhmYs49g9suu+9uhy/OIT2DyFedpz/bVWLXtFL77/F3o8zMhCQxHQJh9nZ/RU5diYJc7p95QZgCTnKHLppTaHK3Zm3bwYhkqKIDFg72/VLsabLZFYbYhnRu6nkCuyhL7/G4AJuEWwKT9QsyUWz3WDdeSkl1268zR3ThwLgtDBzyFIo0KnDwYgRH2VfYrP/jCzKTdX3pPZ8ll60wE990Kk5yhi6OU2kSaZx5OBy2UIkDqPUcYAnloJDtwkSC7AHj6Dm4THK4wIoPDiumXI1pVJjBqBcGqYa5fEA+16IxbqaabL2cp+dJJ3MqRoGXL1si7cRKcNAiBFe2vIopqDZemn133kqsyvf38fgTMJkops4WxSUOWSFGoI9joRUcYQhl+SgUkZZK7EtBp3DpgsjhzdqHdckiXlQcMWcReTq4Bw+z5mV2/sxQcrMCVuH+NoQof7DwESf/+aTz4B1WyH8tDHl7zhDpxlwA9A4+7alXAfQcYVYb2V1C8YY8N7y6XQl1AsGoojyD3vZK6zWHm9siDmK9u13u3Mgrtb71GbZCbm+e0mbVq1cDJIyavMK99OAvrfp0IfVEOFJWj7earUKUG9mxZ45WuOzqv2Cv8vgNMcqZuCuXpWHudGb1GipvZxKuOMLwyIn5eSGSDR8AiQDtLDzZ+ALu3rTKSzPrzAMa//xK0OSlQVLHZfd8uhuDQ/p1QKDyPiFCmAaNK17KD3g/2mP/ZXxJcyeAw/xUeNT3UZPXzOe7V7tes2wx6vcFpme3btcaa5SbX2gfP56Dnk62NipiKqo7tB1at+BMPPdjE47a6kr1YVnD/rTAZ+r6U8ivscWnyVgnibnL4sT+P+l6yN/F4NMoLQLXIh2zizpRmy9PduuCP+ab3YE4h8OCjzyMzfrvDMwyjm/rVZPR8vofHHC7TgLmRpetoMFC7Ximm75TgVDJn1G96srHrw6jHnC4vQBAHqipd+zvu/2JP/Dhjsrm8zv0n4sSWHx3KYRjh0DcH44NRnt8sl2nApGTROnqD7oq9kZq1T4IjV0Q7/xc06OVE7nPg6DS2bXL+AqvW4hVEdvnEXEna2bW4uGY4pEGO99ZPPv4YZs3y3DNpmQYM42hyujaBAjbXJxvOcFhxggHGI+UD92dGeU67HDg6/SGAd36GqfHoMNTuULJaFGZexem5T4CTOL7ufCCmAf7dv0EQ11MyrWN6WmYq84C5lqEdyVF8J4hTlkQc+URZUSbMG4PowsVlSEhSO3zlBtm5+alR0UOPD+KaZ5fa0aQryM+3oi/d/ocfaYOCQudxQCeOHYUPRrxpLocZk8U0i8Wt1HSHLQ+Qy3Hj0jFjzE1Xya8Bw4IuJWfoFgJ42RWjip8TQlbVqijtbwz3dw8kfwJM23YdkaXWOOX6tMljMWzIQCuawW9/hJVrNznNt37Fr+jc8VGXI+rXgCnmjipT353w/Es80IIALDAIM56QMFBQSpmkLAUEJzmeX1qrSuBfLrnqQwJ/AkyXJ7sh+bo5ALZdLs+cPgmvDuxj9ezPFesxbETJucZexrfeeAnTv3QdQqTMAyY5TdeZEspcjdjXjfDm5Ka4REDerF1F5tos0Ev1+hNger7QGxfiLzrl3PyfpqJfb+sr4vSMTDR4qCOYy15HSVmrJs4ddx3Dp8wDRpWhvQQKYfGjvTGJCS4rK8nvPDhvt9WfADPwlUE4etx5ROpFv/6A55950mYkn+zxMv45etLpCB/esw5NGjm3Vy77gEnX+lyQIua2xFOM+hNghg8fjp17Djhl2aolc9C1i21A1x9//h3jJn3jNO+EsaPwocWFgT3isg+Y8hXGatzv51uyTz75GGvWb3E66Teu+h0dLYIlFRNfuapCs7bOgzG1a9MCW9ezKI+OU5kHTPkZxnrw72fAfP3VFPy+yK42k7mTOzf+idYt7cfB7PBkH6cmzsz/29ULhxAe5thlT5kHjOV0SUzKfp6CLwkMAnIjJjLcyo3bRZV6Kk8xxpyPIjsmqiQgYkKS5jpAzfauBFzP6Miw9Z5urdzN709bsjmzZ+K7mb84ZdWBnavR9MFGdmm+/XE+Jn7pXOy2cP536NnD8UrkX4BRaSZQSieauUnIphhl+LNWoFJpFlFKSy7yCYmLUYabRyBBpdkISp8pzkMImRitDP/c3QnvaT5/AsyyJQswYcq3Tll29O+NaBht/45HyLZs0Et9MOvbSQ7r8DfArKOUPm/BjSkxkRFWl++JKvUuSvF4CSCwO1oZ0aX4e0KSmmn2fWoBmPXRynAf2ymW9MCfALNt8zqMGD3BKWDOHt2BKKVj36+du/XD8VNnHZZRu2YNnD+xqxwwjAOJKvU1SlHiDYGgT4wywspZb8I19QUQlBhPULokJqqCecVJUKl7g8JkocS0zQiSopURUZ6uFO7m9yfA/HtoL14Z8r5TViWe2Y9qVR2HUftp7kJ84iLGjLNVqsysMKcTk2s3i67t0KXIheTsSlJK0yilJRqVFPVjoiIuW59z1Ew5q8T9EsE3McoI85km4Zq6HgjMvn4IIVRPSJVGtcMy3J30nuTzJ8AkXjiJZ3uXRD+2xzdV/BGEhzsO1JlyMxWNHnncqRDzmymfYuhg+9pS3gKMq/kqZE54pBp85sy1CjRIEmww2BfnKoKC23NEsrzk/IKc/PycRjzTzrudQoLCAi3BwH6mlH6eV5Bjjo3HEUIUitALoDBfpfDU0C+/IM+5gEAIB9ygCVGEXXeUrawpX2bcvIx2jzuPHJ167SQCA5yHZevR9w3s+9uxy9mnn+qMZQtYyFPb5Awwaek3BcUBkEg4jhQY8po2jcpyY8gtprAnuV3kTVCpPwKFOcgkIdgbrYzobJntokrTgKfUKjY4B/RvEBlRAjTT1m4Ppehk0fIxMcoI51KxO9Q3f1phaFEmHmhuNWQ2XNWknHMYpq+YePGytXhnpPkYalNGSEgwkuIOQyq11V721grjjeng0QrjqgGJKs0SSqmF/ynyfUxk+CjLfAlJWR0BYmWFKZVyHevVDPvbmk7zHUBHFv9GCPkzWhkuWOPZVVvFPPcnwFQI5lE1qrlD9jA1/bSkUy7Zl52TiwYPdkBhUZFD2u0blqBta9u6/AcwSZrzFNR8PcxR8mqDqHCm2m9O8Uma/gTUKjY4R0h0A2W4lcbfxWuaQTyhC8yAAbkQHRne2OVI3QECfwIME7pWr9sC+QUFdjkZFhqK5MR/BHH5taEfOtUa+GT0u/hk9Ds2ZfkFYG7coIo8gyabUpiDHUqItGl9ZYjV/WJikmYUBbW66A+RhgfXrEmsLJsuqXIfMlD9mZIVBoZgSXhYaTpBI+chkb8BpknLJ6BKvmGXa1WrVMbFs/sFcXT7rv3o8/Iwh7SO1GT8AjCJydmPUp4/ZMGdwmhleCghRG+11VKpp4HiI4vfNDGRETbG4JRSaaJKk8Ni9ZhBw3HtomuHHRY0Wl4kEgsYL1bt9aJcWVyyCnv1HYBz5+x78K9Zswb27NwqqF16gwGxnZ9Eerr9y01mffnv4QNQKIIElceIfKl0y+q7Y2eY+CTNOwS05NqDkKMxyvDWpTmRqNIsppRanEXIhRgHW60ElYb5I21VXAYFGd4wMtxzTwqCh8dE6G+AGfzW2zhwwPLdV8KwunXqYOtm4VpKX0+bjt//cKxs+cu8n9Gh/WOCR6TMACZRlT2PUr7E0Jtw82KUYUNLcyL+mno3ISi5hiFkV4wy/Al7HEtQZc8F5d8q2ZZx86OVYebvgrnsIaG/Aeaj/43Fhr/smxs3bBiDDWtXCubohbg49OzVzyH9kMGv46MPzXc7LsstO4BJ0hyloC3Nkxt4JzoyYnZpDiRcU8eBwOxTlFK6uGFUhVfscSoxSf02BcwrCgE5Fh0Zbl5xXHLXSwRiAXM/ayuztn88/mv8PM/qrsbMyRbNH8KeLVYSAJdcZnKd/87H26Vr3uxB7NtmrR1d5s8w7LxxUZWdQ0Etzhvk0eja4TaSq4Qko4cFs5iYI9y0Bsqw/9kFTLKmLeWp+cxCQAobKMNszkUuR8xDAn8DzLTv5mDy1B/tcq1d25bYus4+mByxedacBRg7cardxxzH4VrcYSt1/zIPmMuqzKZ6ylnatRpCpPlhNWvWtLr5unmTBmdrNbmWnCOUjIqOCv/eHjdv3LihyNUrspmzjOLnUsI3q6esaL498xALgrL7G2B+W7gcI8fYVw5/PPYxrFvO3DcIT2npGWj4cGfo9Vb3P+YCmMSfSf6LU5kHTPy17FcJ4f8o2Y6R89GR4Taepy+pNNEGShOsAYN+0VERDi2WEpM05yioWf5CKfdaw6gws3xG+LC5T+lvgNmwaQcGDravgNm9a2csX2hfpcUZh/u/+i42b9ttl2T40Ffx1eclm4wyD5jEJM131FoqvyRaGW7tuMqo7pIVSynZa8k1Cr5jw8iKVlJ+y+elb9UIyPfRpbQH3IeCsJz+BphDR46jW0+7x0qj4RczABObNm7ZhZdef89uNmaMxozS/GaFSVSp91KKWAtufBQTGTG9NHcuXtf05w3WUn4CNIiOjHAYhTQhST0agFmHjBDsi1ZGlOiYiR05N+j9DTDxiZfRqoOVzZ+Za/369MD8WfbPI85Yq9Pp0fDhTmDumEondo5hZssRtzWgy/QKw1T5L6o0WZbq+pTiiYZRETYWQolJ2R9Q8DMsGRakDFcoCbGvhwEg/pq6CyEwO7MigKaBMrwCU/l3Y+67lcXfAMNC9tVp1M4ur159uQ9mznBsLemMwWMnTMOsueaduxXp0j9m4ZluJpvCMg2YxCR1fQqY9cDYRA4MC6usDCc2r5KEJDVbKdiKUZzUMZERFZwxWaXSVCwE0i1tbFytSm6hwkkmR4Cxp9rPirnfr5WZM75KymYwGGw99Qr1XmmPnefjEtG2k6UxbgmV5TmmbAMmWd2H8jBLsgjBtWhlhN1wuglJmiWAlTbz+Rg7lwOlmZ2oUl+lFGaLS8Khb3TtCLNFprcBUro8fwMM6z/zYpmaZutc/L23X8eUCZaaTeK437l7Pxw/aWu+3Oyhxvh7h2lIyzZgktRTKGCOY0kI1kUrI+xaICUkqZl715LzB8WumKgIu1J+y2FIVKnXUgqzTT8BvoyOjHBsbCFuDF1SiwWMywLvIoEQXTLWvB49+yAhwcpsydjqYUOHYNT79g/vQrq1bPkqTPj8CxtSdo759/DfCA1lLrcdp/te0p+g0myCRWhx5jGmYVQFu5f4CSpNHCg1S/kJIYuileGDXDE6/lrWBOY5xkxHyOYYZbjZq4yr/J4+90fAvPbGWzh8xFaNf8S772D4OzYaT4JZnJubi/Ydu9gNqTF39kx0irX1qGlZuM8Bc+PGZa86k8jVVzwGwOwRQQLD4CCpxq5LkFxDxXOgCC5mAOEwO5jLdHnlUqAP72KA5FcLxqWHSDPNajiCR8tNwlx9xav2sjo6w9ymTeCobjTR3bpjQlaDvLbddjnrptAV5oPRH2PTZlsPmLVrVv1q7+bf57rJSmO2Zu36TM3LLzArmAVWqo+qD/dD96c6Y1T3CiASx/F1JNpku9t9T9rjLO8d01a+Uw0uL/fucCCoSqPvCYGN9JJS8n5B2nn7ejMCmxpUpUl7TsL9HRHdBVWbD0CYspXRNZA+Lz394IQq91SI4HLACBxUfydTVGs8FpROseUDHZafGufRCtNxOh1nyM+YKFVUMqs86fLSaW7y0U1n5j/teahlLw5eOWC8yMyyXJSiWqMhoLBRGiOUvpaXFueRalLsdPongAGMfwUZl6G4sARtcw4e/XrXNhv7qbvN43sCMGcSUyy1Asw8aRpdw+gcw9FzMcwrLktMnnLaEg4oqjV8DpSzsRSjPAYUpF9Y5gmvOs2gbXke069tm8A9l7enaYNQWXCAhKMNK4ZFdl6yxqHfO0/qdDfvPQEYdxtfns93HIj9xpBm0BVUpgYteH0ReL0W1FAEWXDl/w5+VvEhIS1JSbli98VYnLdGjbr7furWZVGYXDawYlAAgmTSMY8vXn1XXGk56k+ZBYw3ViV7TLvXVipXk1DIRHZGwyYxex47nf4LwJ6xXuK+0cR5CDERjdjzWs8IXsvdvJRTGDDt7HXt9QLtmIJbF34QUcQdJS2zgLmjXPPHwmu2UCj0+SxYr1XiCN8l91a8fT19kXwqBv9Xg975fuHZaw9reZN6YLWqlfYe2rGoRO4motxiwIvI4pS0HDDe4qSflDPrqS5aA6UyAtAR23dz3u52gyffH3vj9HYWrcE0Nyl0lCOjC255dnXtrXaWA8ZbnPSTcna/3PsyBa0LILPLkjWVvN3tyk2emp+fljTEVC5N43j0zU2Ps/KM6u06xZRXDhgx3Cqnxe6Xe12gYKFJSF6XJaudK3qJ5xdRVG3ETNvZJcI5nqPPFt6ME629IL5a4TnKNGAopfLkbIRIDAgBj2BQnUJPiUIqQRD7JNSgAIgCBIGUkkCOIIAHH0gIFwBKAkH5QEogJwRyUCKn4OWEcDJCIQeBnFLIACoFAfOgLQX7TnH7O5UCHAdQCQjhQKkEIKbvAGf8m4DAFAqEEGIcCnLbbMH4m3FDAtDbtj70dtADCmb7w/6B8gB4gBiMfxNiAGW/se8sogLRg0IPYvyvA2D6DqIn7DuFlhJoKeV1BJwWhGophZZQaEG4QhBaSClfxIEr/HbR1mZrli2unp/8X6tcHW92bhJdv/6cLRvW/AIiyweHPIMEubXDkEsI0QqfhibK4KqNXqEA86hxOF9X1B1Zl5mDlHsq3dOASU2lIQYZKuv0usrgSCUJIRUBvgLlSQVKEMGBhPOgEaB8OEDCKBBGYAyJEUKBEAI2ocuTOxw4dfoMzp0/j/j4RJw5+x/i4uJZGBKbotq0boWFf9jGwKSAjgDMwUkuBXIIkA3QbBBOw4GoeVANoVATjmYBXJaB0syWrR79SSaX33rhuef7zpr2P/u+ad3pjBfz3BXAUEq5lCzUNhj0dQmhUQBRArQWBalBCGoAtBqlqAZAuM9QLzKlvCjgzaHDceCgydslc+Eqk8nNoSiYIRn7r9PpUCEiAn/vMxvAepN1BYTgFkBuUYoUApoCEBYcWEUpuSaRSK/UqIBkQghbZX2W7jhgKKWylCx9WwOPdoTQhylIE0IRbemzzGe9La+oTHGA+aWjBIkE9Byl5JSEw6EaFaRHCCFs+3lH0h0FTHK6bjIFhoNtm8pTOQd8wgGiJsBPtSvLrAIPe6vqOw8YguGg5YDx1oCVl+OCA4SoCb1PAcO6Zt6SAe0IpQ9TigcBRANwHhSxfGaUc8A1B1g4s0RC8B8l5JQE9/mWzFF/iw/9hOjrGkCiYKDmQz9AaxKCqpSSagAtP/S7njRllIIUEELZgT+VgqZwIDeMh34JUUlAr1FaRg/9noxm8bUy1esq6+1cK5vORiS8/FrZEy7fmbzOrpUBqgGImhCoCUqulaU8zSBSWbpEh/SqVYmVz+0700rxpd7RM4z45ng3hz3BJSREoadQSDkSZKBQgPIKUAeCS8IHMiElE16aBZeAnICTWQouCYHUJMQ0Ci9vCy6JlIJKOJOAkqNMcGkrwCTMFJdYCCwtBZilBZbsO5NWwiQPoaUFlsQouGQSS8oTkzCzRHAJGIWVtLTgEryOAtpiwSUTWjJhJqi14JKnKCKEFoKgEITLlxDk63laICXIh4Hme0Nw6d3RvzOl/R8AdGoXzom1qQAAAABJRU5ErkJggg=="},4811:function(e,t,n){var i=n(22652);function r(){return"undefined"!=typeof Reflect&&Reflect.get?(e.exports=r=Reflect.get.bind(),e.exports.__esModule=!0,e.exports.default=e.exports):(e.exports=r=function(e,t,n){var r=i(e,t);if(r){var s=Object.getOwnPropertyDescriptor(r,t);return s.get?s.get.call(arguments.length<3?e:n):s.value}},e.exports.__esModule=!0,e.exports.default=e.exports),r.apply(this,arguments)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports},22652:function(e,t,n){var i=n(34577);e.exports=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=i(e)););return e},e.exports.__esModule=!0,e.exports.default=e.exports},80360:function(e,t,n){"use strict";n.d(t,{ZP:function(){return pl}});const i=Number.isFinite||function(e){return"number"==typeof e&&isFinite(e)},r=Number.isSafeInteger||function(e){return"number"==typeof e&&Math.abs(e)<=s},s=Number.MAX_SAFE_INTEGER||9007199254740991;let a=function(e){return e.NETWORK_ERROR="networkError",e.MEDIA_ERROR="mediaError",e.KEY_SYSTEM_ERROR="keySystemError",e.MUX_ERROR="muxError",e.OTHER_ERROR="otherError",e}({}),o=function(e){return e.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",e.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",e.KEY_SYSTEM_NO_SESSION="keySystemNoSession",e.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",e.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",e.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",e.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",e.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",e.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",e.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",e.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR="keySystemDestroyMediaKeysError",e.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR="keySystemDestroyCloseSessionError",e.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR="keySystemDestroyRemoveSessionError",e.MANIFEST_LOAD_ERROR="manifestLoadError",e.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",e.MANIFEST_PARSING_ERROR="manifestParsingError",e.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",e.LEVEL_EMPTY_ERROR="levelEmptyError",e.LEVEL_LOAD_ERROR="levelLoadError",e.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",e.LEVEL_PARSING_ERROR="levelParsingError",e.LEVEL_SWITCH_ERROR="levelSwitchError",e.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",e.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",e.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",e.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",e.FRAG_LOAD_ERROR="fragLoadError",e.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",e.FRAG_DECRYPT_ERROR="fragDecryptError",e.FRAG_PARSING_ERROR="fragParsingError",e.FRAG_GAP="fragGap",e.REMUX_ALLOC_ERROR="remuxAllocError",e.KEY_LOAD_ERROR="keyLoadError",e.KEY_LOAD_TIMEOUT="keyLoadTimeOut",e.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",e.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",e.BUFFER_APPEND_ERROR="bufferAppendError",e.BUFFER_APPENDING_ERROR="bufferAppendingError",e.BUFFER_STALLED_ERROR="bufferStalledError",e.BUFFER_FULL_ERROR="bufferFullError",e.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",e.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",e.ASSET_LIST_LOAD_ERROR="assetListLoadError",e.ASSET_LIST_LOAD_TIMEOUT="assetListLoadTimeout",e.ASSET_LIST_PARSING_ERROR="assetListParsingError",e.INTERSTITIAL_ASSET_ITEM_ERROR="interstitialAssetItemError",e.INTERNAL_EXCEPTION="internalException",e.INTERNAL_ABORTED="aborted",e.ATTACH_MEDIA_ERROR="attachMediaError",e.UNKNOWN="unknown",e}({}),l=function(e){return e.MEDIA_ATTACHING="hlsMediaAttaching",e.MEDIA_ATTACHED="hlsMediaAttached",e.MEDIA_DETACHING="hlsMediaDetaching",e.MEDIA_DETACHED="hlsMediaDetached",e.MEDIA_ENDED="hlsMediaEnded",e.STALL_RESOLVED="hlsStallResolved",e.BUFFER_RESET="hlsBufferReset",e.BUFFER_CODECS="hlsBufferCodecs",e.BUFFER_CREATED="hlsBufferCreated",e.BUFFER_APPENDING="hlsBufferAppending",e.BUFFER_APPENDED="hlsBufferAppended",e.BUFFER_EOS="hlsBufferEos",e.BUFFERED_TO_END="hlsBufferedToEnd",e.BUFFER_FLUSHING="hlsBufferFlushing",e.BUFFER_FLUSHED="hlsBufferFlushed",e.MANIFEST_LOADING="hlsManifestLoading",e.MANIFEST_LOADED="hlsManifestLoaded",e.MANIFEST_PARSED="hlsManifestParsed",e.LEVEL_SWITCHING="hlsLevelSwitching",e.LEVEL_SWITCHED="hlsLevelSwitched",e.LEVEL_LOADING="hlsLevelLoading",e.LEVEL_LOADED="hlsLevelLoaded",e.LEVEL_UPDATED="hlsLevelUpdated",e.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",e.LEVELS_UPDATED="hlsLevelsUpdated",e.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",e.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",e.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",e.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",e.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",e.AUDIO_TRACK_UPDATED="hlsAudioTrackUpdated",e.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",e.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",e.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",e.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",e.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",e.SUBTITLE_TRACK_UPDATED="hlsSubtitleTrackUpdated",e.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",e.CUES_PARSED="hlsCuesParsed",e.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",e.INIT_PTS_FOUND="hlsInitPtsFound",e.FRAG_LOADING="hlsFragLoading",e.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",e.FRAG_LOADED="hlsFragLoaded",e.FRAG_DECRYPTED="hlsFragDecrypted",e.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",e.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",e.FRAG_PARSING_METADATA="hlsFragParsingMetadata",e.FRAG_PARSED="hlsFragParsed",e.FRAG_BUFFERED="hlsFragBuffered",e.FRAG_CHANGED="hlsFragChanged",e.FPS_DROP="hlsFpsDrop",e.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",e.MAX_AUTO_LEVEL_UPDATED="hlsMaxAutoLevelUpdated",e.ERROR="hlsError",e.DESTROYING="hlsDestroying",e.KEY_LOADING="hlsKeyLoading",e.KEY_LOADED="hlsKeyLoaded",e.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",e.BACK_BUFFER_REACHED="hlsBackBufferReached",e.STEERING_MANIFEST_LOADED="hlsSteeringManifestLoaded",e.ASSET_LIST_LOADING="hlsAssetListLoading",e.ASSET_LIST_LOADED="hlsAssetListLoaded",e.INTERSTITIALS_UPDATED="hlsInterstitialsUpdated",e.INTERSTITIALS_BUFFERED_TO_BOUNDARY="hlsInterstitialsBufferedToBoundary",e.INTERSTITIAL_ASSET_PLAYER_CREATED="hlsInterstitialAssetPlayerCreated",e.INTERSTITIAL_STARTED="hlsInterstitialStarted",e.INTERSTITIAL_ASSET_STARTED="hlsInterstitialAssetStarted",e.INTERSTITIAL_ASSET_ENDED="hlsInterstitialAssetEnded",e.INTERSTITIAL_ASSET_ERROR="hlsInterstitialAssetError",e.INTERSTITIAL_ENDED="hlsInterstitialEnded",e.INTERSTITIALS_PRIMARY_RESUMED="hlsInterstitialsPrimaryResumed",e.PLAYOUT_LIMIT_REACHED="hlsPlayoutLimitReached",e.EVENT_CUE_ENTER="hlsEventCueEnter",e}({});var u="manifest",c="level",h="audioTrack",d="subtitleTrack",f="main",p="audio",_="subtitle";class g{constructor(e,t=0,n=0){this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=e,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=t,this.totalWeight_=n}sample(e,t){const n=Math.pow(this.alpha_,e);this.estimate_=t*(1-n)+n*this.estimate_,this.totalWeight_+=e}getTotalWeight(){return this.totalWeight_}getEstimate(){if(this.alpha_){const e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_}}class m{constructor(e,t,n,i=100){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=n,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new g(e),this.fast_=new g(t),this.defaultTTFB_=i,this.ttfb_=new g(e)}update(e,t){const{slow_:n,fast_:i,ttfb_:r}=this;n.halfLife!==e&&(this.slow_=new g(e,n.getEstimate(),n.getTotalWeight())),i.halfLife!==t&&(this.fast_=new g(t,i.getEstimate(),i.getTotalWeight())),r.halfLife!==e&&(this.ttfb_=new g(e,r.getEstimate(),r.getTotalWeight()))}sample(e,t){const n=(e=Math.max(e,this.minDelayMs_))/1e3,i=8*t/n;this.fast_.sample(n,i),this.slow_.sample(n,i)}sampleTTFB(e){const t=e/1e3,n=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(n,Math.max(e,5))}canEstimate(){return this.fast_.getTotalWeight()>=this.minWeight_}getEstimate(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}getEstimateTTFB(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_}get defaultEstimate(){return this.defaultEstimate_}destroy(){}}function v(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t);if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function y(){return y=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},y.apply(null,arguments)}function b(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function E(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?b(Object(n),!0).forEach((function(t){v(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):b(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}class w{constructor(e,t){this.trace=void 0,this.debug=void 0,this.log=void 0,this.warn=void 0,this.info=void 0,this.error=void 0;const n=`[${e}]:`;this.trace=k,this.debug=t.debug.bind(null,n),this.log=t.log.bind(null,n),this.warn=t.warn.bind(null,n),this.info=t.info.bind(null,n),this.error=t.error.bind(null,n)}}const k=function(){},S={trace:k,debug:k,log:k,warn:k,info:k,error:k};function T(){return y({},S)}function A(e,t,n){return t[e]?t[e].bind(t):function(e,t){const n=self.console[e];return n?n.bind(self.console,`${t?"["+t+"] ":""}[${e}] >`):k}(e,n)}const C=T();const R=C;function L(e=!0){if("undefined"==typeof self)return;return(e||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function x(e,t){const n=Object.keys(e),i=Object.keys(t),r=n.length,s=i.length;return!r||!s||r===s&&!n.some((e=>-1===i.indexOf(e)))}function I(e,t=!1){if("undefined"!=typeof TextDecoder){const n=new TextDecoder("utf-8").decode(e);if(t){const e=n.indexOf("\0");return-1!==e?n.substring(0,e):n}return n.replace(/\0/g,"")}const n=e.length;let i,r,s,a="",o=0;for(;o<n;){if(i=e[o++],0===i&&t)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=e[o++],a+=String.fromCharCode((31&i)<<6|63&r);break;case 14:r=e[o++],s=e[o++],a+=String.fromCharCode((15&i)<<12|(63&r)<<6|(63&s)<<0)}}return a}function D(e){let t="";for(let n=0;n<e.length;n++){let i=e[n].toString(16);i.length<2&&(i="0"+i),t+=i}return t}function P(e){return Uint8Array.from(e.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}function O(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var M,N={exports:{}};var F,B,U,K,$,G=(M||(M=1,F=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,B=/^(?=([^\/?#]*))\1([^]*)$/,U=/(?:\/|^)\.(?=\/)/g,K=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,N.exports=$={buildAbsoluteURL:function(e,t,n){if(n=n||{},e=e.trim(),!(t=t.trim())){if(!n.alwaysNormalize)return e;var i=$.parseURL(e);if(!i)throw new Error("Error trying to parse base URL.");return i.path=$.normalizePath(i.path),$.buildURLFromParts(i)}var r=$.parseURL(t);if(!r)throw new Error("Error trying to parse relative URL.");if(r.scheme)return n.alwaysNormalize?(r.path=$.normalizePath(r.path),$.buildURLFromParts(r)):t;var s=$.parseURL(e);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=$.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?$.normalizePath(r.path):r.path),$.buildURLFromParts(o)},parseURL:function(e){var t=F.exec(e);return t?{scheme:t[1]||"",netLoc:t[2]||"",path:t[3]||"",params:t[4]||"",query:t[5]||"",fragment:t[6]||""}:null},normalizePath:function(e){for(e=e.split("").reverse().join("").replace(U,"");e.length!==(e=e.replace(K,"")).length;);return e.split("").reverse().join("")},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}}),N.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",H="audiovideo";class z{constructor(e){this._byteRange=null,this._url=null,this._stats=null,this._streams=null,this.base=void 0,this.relurl=void 0,"string"==typeof e&&(e={url:e}),this.base=e,function(e,t){const n=X(e,t);n&&(n.enumerable=!0,Object.defineProperty(e,t,n))}(this,"stats")}setByteRange(e,t){const n=e.split("@",2);let i;i=1===n.length?(null==t?void 0:t.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,[H]:null}),this._streams}set elementaryStreams(e){this._streams=e}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(e){this._stats=e}get url(){return!this._url&&this.baseurl&&this.relurl&&(this._url=G.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(e){this._url=e}clearElementaryStreamInfo(){const{elementaryStreams:e}=this;e[V]=null,e[Z]=null,e[H]=null}}function W(e){return"initSegment"!==e.sn}class q extends z{constructor(e,t){super(t),this._decryptdata=null,this._programDateTime=null,this._ref=null,this._bitrate=void 0,this.rawProgramDateTime=null,this.tagList=[],this.duration=0,this.sn=0,this.levelkeys=void 0,this.type=void 0,this.loader=null,this.keyLoader=null,this.level=-1,this.cc=0,this.startPTS=void 0,this.endPTS=void 0,this.startDTS=void 0,this.endDTS=void 0,this.start=0,this.playlistOffset=0,this.deltaPTS=void 0,this.maxStartPTS=void 0,this.minEndPTS=void 0,this.data=void 0,this.bitrateTest=!1,this.title=null,this.initSegment=null,this.endList=void 0,this.gap=void 0,this.urlId=0,this.type=e}get byteLength(){if(this.hasStats){const e=this.stats.total;if(e)return e}if(this.byteRange.length){const e=this.byteRange[0],t=this.byteRange[1];if(i(e)&&i(t))return t-e}return null}get bitrate(){return this.byteLength?8*this.byteLength/this.duration:this._bitrate?this._bitrate:null}set bitrate(e){this._bitrate=e}get decryptdata(){var e;const{levelkeys:t}=this;if(!t||t.NONE)return null;if(t.identity)this._decryptdata||(this._decryptdata=t.identity.getDecryptData(this.sn));else if(null==(e=this._decryptdata)||!e.keyId){const e=Object.keys(t);if(1===e.length){const n=this._decryptdata=t[e[0]]||null;n&&(this._decryptdata=n.getDecryptData(this.sn,t))}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(null===this.programDateTime)return null;const e=i(this.duration)?this.duration:0;return this.programDateTime+1e3*e}get encrypted(){var e;if(null!=(e=this._decryptdata)&&e.encrypted)return!0;if(this.levelkeys){var t;const e=Object.keys(this.levelkeys),n=e.length;if(n>1||1===n&&null!=(t=this.levelkeys[e[0]])&&t.encrypted)return!0}return!1}get programDateTime(){return null===this._programDateTime&&this.rawProgramDateTime&&(this.programDateTime=Date.parse(this.rawProgramDateTime)),this._programDateTime}set programDateTime(e){i(e)?this._programDateTime=e: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(e){this.setStart(this.start+e)}setStart(e){this.start=e,this._ref&&(this._ref.start=e)}setDuration(e){this.duration=e,this._ref&&(this._ref.duration=e)}setKeyFormat(e){const t=this.levelkeys;if(t){var n;const i=t[e];!i||null!=(n=this._decryptdata)&&n.keyId||(this._decryptdata=i.getDecryptData(this.sn,t))}}abortRequests(){var e,t;null==(e=this.loader)||e.abort(),null==(t=this.keyLoader)||t.abort()}setElementaryStreamInfo(e,t,n,i,r,s=!1){const{elementaryStreams:a}=this,o=a[e];o?(o.startPTS=Math.min(o.startPTS,t),o.endPTS=Math.max(o.endPTS,n),o.startDTS=Math.min(o.startDTS,i),o.endDTS=Math.max(o.endDTS,r)):a[e]={startPTS:t,endPTS:n,startDTS:i,endDTS:r,partial:s}}}class Y extends z{constructor(e,t,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=e.decimalFloatingPoint("DURATION"),this.gap=e.bool("GAP"),this.independent=e.bool("INDEPENDENT"),this.relurl=e.enumeratedString("URI"),this.fragment=t,this.index=i;const s=e.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:e}=this;return!!(e.audio||e.video||e.audiovideo)}}function X(e,t){const n=Object.getPrototypeOf(e);if(n){const e=Object.getOwnPropertyDescriptor(n,t);return e||X(n,t)}}const Q=Math.pow(2,32)-1,J=[].push,ee={video:1,audio:2,id3:3,text:4};function te(e){return String.fromCharCode.apply(null,e)}function ne(e,t){const n=e[t]<<8|e[t+1];return n<0?65536+n:n}function ie(e,t){const n=se(e,t);return n<0?4294967296+n:n}function re(e,t){let n=ie(e,t);return n*=Math.pow(2,32),n+=ie(e,t+4),n}function se(e,t){return e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]}function ae(e,t){const n=[];if(!t.length)return n;const i=e.byteLength;for(let r=0;r<i;){const s=ie(e,r),a=s>1?r+s:i;if(te(e.subarray(r+4,r+8))===t[0])if(1===t.length)n.push(e.subarray(r+8,a));else{const i=ae(e.subarray(r+8,a),t.slice(1));i.length&&J.apply(n,i)}r=a}return n}function oe(e){const t=[],n=e[0];let i=8;const r=ie(e,i);i+=4;let s=0,a=0;0===n?(s=ie(e,i),a=ie(e,i+4),i+=8):(s=re(e,i),a=re(e,i+8),i+=16),i+=2;let o=e.length+a;const l=ne(e,i);i+=2;for(let n=0;n<l;n++){let n=i;const s=ie(e,n);n+=4;const a=2147483647&s;if(1===(2147483648&s)>>>31)return R.warn("SIDX has hierarchical references (not supported)"),null;const l=ie(e,n);n+=4,t.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:t}}function le(e){const t=[],n=ae(e,["moov","trak"]);for(let e=0;e<n.length;e++){const i=n[e],r=ae(i,["tkhd"])[0];if(r){let e=r[0];const n=ie(r,0===e?12:20),s=ae(i,["mdia","mdhd"])[0];if(s){e=s[0];const r=ie(s,0===e?12:20),a=ae(i,["mdia","hdlr"])[0];if(a){const e=te(a.subarray(8,12)),s={soun:V,vide:Z}[e],o=ue(ae(i,["mdia","minf","stbl","stsd"])[0]);s?(t[n]={timescale:r,type:s,stsd:o},t[s]=E({timescale:r,id:n},o)):t[n]={timescale:r,type:e,stsd:o}}}}}return ae(e,["moov","mvex","trex"]).forEach((e=>{const n=ie(e,4),i=t[n];i&&(i.default={duration:ie(e,12),flags:ie(e,20)})})),t}function ue(e){const t=e.subarray(8),n=t.subarray(86),i=te(t.subarray(4,8));let r,s=i;const a="enca"===i||"encv"===i;if(a){const e=ae(t,[i])[0];ae(e.subarray("enca"===i?28:78),["sinf"]).forEach((e=>{const t=ae(e,["schm"])[0];if(t){const n=te(t.subarray(4,8));if("cbcs"===n||"cenc"===n){const t=ae(e,["frma"])[0];t&&(s=te(t))}}}))}const o=s;switch(s){case"avc1":case"avc2":case"avc3":case"avc4":{const e=ae(n,["avcC"])[0];e&&e.length>3&&(s+="."+de(e[1])+de(e[2])+de(e[3]),r=ce("avc1"===o?"dva1":"dvav",n));break}case"mp4a":{const e=ae(t,[i])[0],n=ae(e.subarray(28),["esds"])[0];if(n&&n.length>7){let e=4;if(3!==n[e++])break;e=he(n,e),e+=2;const t=n[e++];if(128&t&&(e+=2),64&t&&(e+=n[e++]),4!==n[e++])break;e=he(n,e);const i=n[e++];if(64!==i)break;if(s+="."+de(i),e+=12,5!==n[e++])break;e=he(n,e);const r=n[e++];let a=(248&r)>>3;31===a&&(a+=1+((7&r)<<3)+((224&n[e])>>5)),s+="."+a}break}case"hvc1":case"hev1":{const e=ae(n,["hvcC"])[0];if(e&&e.length>12){const t=e[1],n=["","A","B","C"][t>>6],i=31&t,r=ie(e,2),a=(32&t)>>5?"H":"L",o=e[12],l=e.subarray(6,12);s+="."+n+i,s+="."+function(e){let t=0;for(let n=0;n<32;n++)t|=(e>>n&1)<<31-n;return t>>>0}(r).toString(16).toUpperCase(),s+="."+a+o;let u="";for(let e=l.length;e--;){const t=l[e];if(t||u){u="."+t.toString(16).toUpperCase()+u}}s+=u}r=ce("hev1"==o?"dvhe":"dvh1",n);break}case"dvh1":case"dvhe":case"dvav":case"dva1":case"dav1":s=ce(s,n)||s;break;case"vp09":{const e=ae(n,["vpcC"])[0];if(e&&e.length>6){const t=e[4],n=e[5],i=e[6]>>4&15;s+="."+fe(t)+"."+fe(n)+"."+fe(i)}break}case"av01":{const e=ae(n,["av1C"])[0];if(e&&e.length>2){const t=e[1]>>>5,i=31&e[1],a=e[2]>>>7?"H":"M",o=(64&e[2])>>6,l=(32&e[2])>>5,u=2===t&&o?l?12:10:o?10:8,c=(16&e[2])>>4,h=(8&e[2])>>3,d=(4&e[2])>>2,f=3&e[2],p=1,_=1,g=1,m=0;s+="."+t+"."+fe(i)+a+"."+fe(u)+"."+c+"."+h+d+f+"."+fe(p)+"."+fe(_)+"."+fe(g)+"."+m,r=ce("dav1",n)}break}}return{codec:s,encrypted:a,supplemental:r}}function ce(e,t){const n=ae(t,["dvvC"]),i=n.length?n[0]:ae(t,["dvcC"])[0];if(i){const t=i[2]>>1&127,n=i[2]<<5&32|i[3]>>3&31;return e+"."+fe(t)+"."+fe(n)}}function he(e,t){const n=t+5;for(;128&e[t++]&&t<n;);return t}function de(e){return("0"+e.toString(16).toUpperCase()).slice(-2)}function fe(e){return(e<10?"0":"")+e}function pe(e,t){ae(e,["moov","trak"]).forEach((e=>{const n=ae(e,["mdia","minf","stbl","stsd"])[0];if(!n)return;const i=n.subarray(8);let r=ae(i,["enca"]);const s=r.length>0;s||(r=ae(i,["encv"])),r.forEach((e=>{ae(s?e.subarray(28):e.subarray(78),["sinf"]).forEach((e=>{const n=_e(e);n&&t(n,s)}))}))}))}function _e(e){const t=ae(e,["schm"])[0];if(t){const n=te(t.subarray(4,8));if("cbcs"===n||"cenc"===n){const t=ae(e,["schi","tenc"])[0];if(t)return t}}}function ge(e,t){const n=new Uint8Array(e.length+t.length);return n.set(e),n.set(t,e.length),n}function me(e,t){const n=[],i=t.samples,r=t.timescale,s=t.id;let a=!1;return ae(i,["moof"]).map((o=>{const l=o.byteOffset-8;ae(o,["traf"]).map((o=>{const u=ae(o,["tfdt"]).map((e=>{const t=e[0];let n=ie(e,4);return 1===t&&(n*=Math.pow(2,32),n+=ie(e,8)),n/r}))[0];return void 0!==u&&(e=u),ae(o,["tfhd"]).map((u=>{const c=ie(u,4),h=16777215&ie(u,0);let d=0;const f=0!=(16&h);let p=0;const _=0!=(32&h);let g=8;c===s&&(0!=(1&h)&&(g+=8),0!=(2&h)&&(g+=4),0!=(8&h)&&(d=ie(u,g),g+=4),f&&(p=ie(u,g),g+=4),_&&(g+=4),"video"===t.type&&(a=ve(t.codec)),ae(o,["trun"]).map((s=>{const o=s[0],u=16777215&ie(s,0),c=0!=(1&u);let h=0;const f=0!=(4&u),_=0!=(256&u);let g=0;const m=0!=(512&u);let v=0;const y=0!=(1024&u),b=0!=(2048&u);let E=0;const w=ie(s,4);let k=8;c&&(h=ie(s,k),k+=4),f&&(k+=4);let S=h+l;for(let l=0;l<w;l++){if(_?(g=ie(s,k),k+=4):g=d,m?(v=ie(s,k),k+=4):v=p,y&&(k+=4),b&&(E=0===o?ie(s,k):se(s,k),k+=4),t.type===Z){let t=0;for(;t<v;){const s=ie(i,S);if(S+=4,ye(a,i[S])){be(i.subarray(S,S+s),a?2:1,e+E/r,n)}S+=s,t+=s+4}}e+=g/r}})))}))}))})),n}function ve(e){if(!e)return!1;const t=e.substring(0,4);return"hvc1"===t||"hev1"===t||"dvh1"===t||"dvhe"===t}function ye(e,t){if(e){const e=t>>1&63;return 39===e||40===e}return 6===(31&t)}function be(e,t,n,i){const r=Ee(e);let s=0;s+=t;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 e=r.length-s;let t=s;if(o<e)s+=o;else if(o>e){R.error(`Malformed SEI payload. ${o} is too small, only ${e} bytes left to parse.`);break}if(4===a){if(181===r[t++]){const e=ne(r,t);if(t+=2,49===e){const e=ie(r,t);if(t+=4,1195456820===e){const e=r[t++];if(3===e){const s=r[t++],o=64&s,l=o?2+3*(31&s):0,u=new Uint8Array(l);if(o){u[0]=s;for(let e=1;e<l;e++)u[e]=r[t++]}i.push({type:e,payloadType:a,pts:n,bytes:u})}}}}}else if(5===a&&o>16){const e=[];for(let n=0;n<16;n++){const i=r[t++].toString(16);e.push(1==i.length?"0"+i:i),3!==n&&5!==n&&7!==n&&9!==n||e.push("-")}const s=o-16,l=new Uint8Array(s);for(let e=0;e<s;e++)l[e]=r[t++];i.push({payloadType:a,pts:n,uuid:e.join(""),userData:I(l),userDataBytes:l})}}}function Ee(e){const t=e.byteLength,n=[];let i=1;for(;i<t-2;)0===e[i]&&0===e[i+1]&&3===e[i+2]?(n.push(i+2),i+=2):i++;if(0===n.length)return e;const r=t-n.length,s=new Uint8Array(r);let a=0;for(i=0;i<r;a++,i++)a===n[0]&&(a++,n.shift()),s[i]=e[a];return s}function we(e,t,n){if(16!==e.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(e,...t){const n=t.length;let i=8,r=n;for(;r--;)i+=t[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(e,4),r=0,i=8;r<n;r++)s.set(t[r],i),i+=t[r].byteLength;return s}([112,115,115,104],new Uint8Array([0,0,0,0]),e,s,r,a,n)}function ke(e){const t=e.getUint32(0),n=e.byteOffset,i=e.byteLength;if(i<t)return{offset:n,size:i};if(1886614376!==e.getUint32(4))return{offset:n,size:t};const r=e.getUint32(8)>>>24;if(0!==r&&1!==r)return{offset:n,size:t};const s=e.buffer,a=D(new Uint8Array(s,n+12,16));let o=null,l=null,u=0;if(0===r)u=28;else{const r=e.getUint32(28);if(!r||i<32+16*r)return{offset:n,size:t};o=[];for(let e=0;e<r;e++)o.push(new Uint8Array(s,n+32+16*e,16));u=32+16*r}if(!u)return{offset:n,size:t};const c=e.getUint32(u);return t-32<c?{offset:n,size:t}:(l=new Uint8Array(s,n+u+4,c),{version:r,systemId:a,kids:o,data:l,offset:n,size:t})}const Se=()=>/\(Windows.+Firefox\//i.test(navigator.userAgent),Te={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 Ae(e,t){const n=Te[t];return!!n&&!!n[e.slice(0,4)]}function Ce(e,t,n=!0){return!e.split(",").some((e=>!Re(e,t,n)))}function Re(e,t,n=!0){var i;const r=L(n);return null!=(i=null==r?void 0:r.isTypeSupported(Le(e,t)))&&i}function Le(e,t){return`${t}/mp4;codecs=${e}`}function xe(e){if(e){const t=e.substring(0,4);return Te.video[t]}return 2}function Ie(e){const t=Se();return e.split(",").reduce(((e,n)=>{const i=t&&ve(n)?9:Te.video[n];return i?(2*i+e)/(e?3:2):(Te.audio[n]+e)/(e?2:1)}),0)}const De={};const Pe=/flac|opus|mp4a\.40\.34/i;function Oe(e,t=!0){return e.replace(Pe,(e=>function(e,t=!0){if(De[e])return De[e];const n={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"],"mp4a.40.34":["mp3"]}[e];for(let r=0;r<n.length;r++){var i;if(Re(n[r],"audio",t))return De[e]=n[r],n[r];if("mp3"===n[r]&&null!=(i=L(t))&&i.isTypeSupported("audio/mpeg"))return""}return e}(e.toLowerCase(),t)))}function Me(e,t){if(e&&(e.length>4||-1!==["ac-3","ec-3","alac","fLaC","Opus"].indexOf(e))&&(Ne(e,"audio")||Ne(e,"video")))return e;if(t){const n=t.split(",");if(n.length>1){if(e)for(let t=n.length;t--;)if(n[t].substring(0,4)===e.substring(0,4))return n[t];return n[0]}}return t||e}function Ne(e,t){return Ae(e,t)&&Re(e,t)}function Fe(e){if(e.startsWith("av01.")){const t=e.split("."),n=["0","111","01","01","01","0"];for(let e=t.length;e>4&&e<10;e++)t[e]=n[e-4];return t.join(".")}return e}function Be(e){const t=L(e)||{isTypeSupported:()=>!1};return{mpeg:t.isTypeSupported("audio/mpeg"),mp3:t.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:t.isTypeSupported('audio/mp4; codecs="ac-3"')}}function Ue(e){return e.replace(/^.+codecs=["']?([^"']+).*$/,"$1")}const Ke={supported:!1,smooth:!1,powerEfficient:!1},$e={supported:!0,configurations:[],decodingInfoResults:[{supported:!0,powerEfficient:!0,smooth:!0}]};function Ge(e,t){return{supported:!1,configurations:t,decodingInfoResults:[Ke],error:e}}function je(e,t,n,r,s,a){const o=e.videoCodec,l=e.audioCodec?e.audioGroups:null,u=null==a?void 0:a.audioCodec,c=null==a?void 0:a.channels,h=c?parseInt(c):u?1/0:2;let d=null;if(null!=l&&l.length)try{d=1===l.length&&l[0]?t.groups[l[0]].channels:l.reduce(((e,n)=>{if(n){const i=t.groups[n];if(!i)throw new Error(`Audio track group ${n} not found`);Object.keys(i.channels).forEach((t=>{e[t]=(e[t]||0)+i.channels[t]}))}return e}),{2:0})}catch(e){return!0}return void 0!==o&&(o.split(",").some((e=>ve(e)))||e.width>1920&&e.height>1088||e.height>1920&&e.width>1088||e.frameRate>Math.max(r,30)||"SDR"!==e.videoRange&&e.videoRange!==n||e.bitrate>Math.max(s,8e6))||!!d&&i(h)&&Object.keys(d).some((e=>parseInt(e)>h))}function Ve(e,t,n,i={}){const r=e.videoCodec;if(!r&&!e.audioCodec||!n)return Promise.resolve($e);const s=[],a=function(e){var t;const n=null==(t=e.videoCodec)?void 0:t.split(","),i=He(e),r=e.width||640,s=e.height||480,a=e.frameRate||30,o=e.videoRange.toLowerCase();return n?n.map((e=>{const t={contentType:Le(Fe(e),"video"),width:r,height:s,bitrate:i,framerate:a};return"sdr"!==o&&(t.transferFunction=o),t})):[]}(e),o=a.length,l=function(e,t,n){var i;const r=null==(i=e.audioCodec)?void 0:i.split(","),s=He(e);if(r&&e.audioGroups)return e.audioGroups.reduce(((e,i)=>{var a;const o=i?null==(a=t.groups[i])?void 0:a.tracks:null;return o?o.reduce(((e,t)=>{if(t.groupId===i){const i=parseFloat(t.channels||"");r.forEach((t=>{const r={contentType:Le(t,"audio"),bitrate:n?Ze(t,s):s};i&&(r.channels=""+i),e.push(r)}))}return e}),e):e}),[]);return[]}(e,t,o>0),u=l.length;for(let e=o||1*u||1;e--;){const t={type:"media-source"};if(o&&(t.video=a[e%o]),u){t.audio=l[e%u];const n=t.audio.bitrate;t.video&&n&&(t.video.bitrate-=n)}s.push(t)}if(r){const e=navigator.userAgent;if(r.split(",").some((e=>ve(e)))&&Se())return Promise.resolve(Ge(new Error(`Overriding Windows Firefox HEVC MediaCapabilities result based on user-agent string: (${e})`),s))}return Promise.all(s.map((e=>{const t=function(e){let t="";const{audio:n,video:i}=e;if(i){t+=`${Ue(i.contentType)}_r${i.height}x${i.width}f${Math.ceil(i.framerate)}${i.transferFunction||"sd"}_${Math.ceil(i.bitrate/1e5)}`}if(n){t+=`${i?"_":""}${Ue(n.contentType)}_c${n.channels}`}return t}(e);return i[t]||(i[t]=n.decodingInfo(e))}))).then((e=>({supported:!e.some((e=>!e.supported)),configurations:s,decodingInfoResults:e}))).catch((e=>({supported:!1,configurations:s,decodingInfoResults:[],error:e})))}function Ze(e,t){if(t<=1)return 1;let n=128e3;return"ec-3"===e?n=768e3:"ac-3"===e&&(n=64e4),Math.min(t/2,n)}function He(e){return 1e3*Math.ceil(Math.max(.9*e.bitrate,e.averageBitrate)/1e3)||1}const ze=["NONE","TYPE-0","TYPE-1",null];const We=["SDR","PQ","HLG"];var qe="",Ye="YES",Xe="v2";function Qe(e){const{canSkipUntil:t,canSkipDateRanges:n,age:i}=e;return t&&i<t/2?n?Xe:Ye:qe}class Je{constructor(e,t,n){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=e,this.part=t,this.skip=n}addDirectives(e){const t=new self.URL(e);return void 0!==this.msn&&t.searchParams.set("_HLS_msn",this.msn.toString()),void 0!==this.part&&t.searchParams.set("_HLS_part",this.part.toString()),this.skip&&t.searchParams.set("_HLS_skip",this.skip),t.href}}class et{constructor(e){if(this._attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.url=void 0,this.frameRate=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.supplemental=void 0,this.videoCodec=void 0,this.width=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.supportedPromise=void 0,this.supportedResult=void 0,this._avgBitrate=0,this._audioGroups=void 0,this._subtitleGroups=void 0,this._urlId=0,this.url=[e.url],this._attrs=[e.attrs],this.bitrate=e.bitrate,e.details&&(this.details=e.details),this.id=e.id||0,this.name=e.name,this.width=e.width||0,this.height=e.height||0,this.frameRate=e.attrs.optionalFloat("FRAME-RATE",0),this._avgBitrate=e.attrs.decimalInteger("AVERAGE-BANDWIDTH"),this.audioCodec=e.audioCodec,this.videoCodec=e.videoCodec,this.codecSet=[e.videoCodec,e.audioCodec].filter((e=>!!e)).map((e=>e.substring(0,4))).join(","),"supplemental"in e){var t;this.supplemental=e.supplemental;const n=null==(t=e.supplemental)?void 0:t.videoCodec;n&&n!==e.videoCodec&&(this.codecSet+=`,${n.substring(0,4)}`)}this.addGroupId("audio",e.attrs.AUDIO),this.addGroupId("text",e.attrs.SUBTITLES)}get maxBitrate(){return Math.max(this.realBitrate,this.bitrate)}get averageBitrate(){return this._avgBitrate||this.realBitrate||this.bitrate}get attrs(){return this._attrs[0]}get codecs(){return this.attrs.CODECS||""}get pathwayId(){return this.attrs["PATHWAY-ID"]||"."}get videoRange(){return this.attrs["VIDEO-RANGE"]||"SDR"}get score(){return this.attrs.optionalFloat("SCORE",0)}get uri(){return this.url[0]||""}hasAudioGroup(e){return tt(this._audioGroups,e)}hasSubtitleGroup(e){return tt(this._subtitleGroups,e)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(e,t){if(t)if("audio"===e){let e=this._audioGroups;e||(e=this._audioGroups=[]),-1===e.indexOf(t)&&e.push(t)}else if("text"===e){let e=this._subtitleGroups;e||(e=this._subtitleGroups=[]),-1===e.indexOf(t)&&e.push(t)}}get urlId(){return 0}set urlId(e){}get audioGroupIds(){return this.audioGroups?[this.audioGroupId]:void 0}get textGroupIds(){return this.subtitleGroups?[this.textGroupId]:void 0}get audioGroupId(){var e;return null==(e=this.audioGroups)?void 0:e[0]}get textGroupId(){var e;return null==(e=this.subtitleGroups)?void 0:e[0]}addFallback(){}}function tt(e,t){return!(!t||!e)&&-1!==e.indexOf(t)}function nt(e,t){let n=!1,i=[];if(e&&(n="SDR"!==e,i=[e]),t){i=t.allowedVideoRanges||We.slice(0);const e="SDR"!==i.join("")&&!t.videoCodec;n=void 0!==t.preferHDR?t.preferHDR:e&&function(){if("function"==typeof matchMedia){const e=matchMedia("(dynamic-range: high)"),t=matchMedia("bad query");if(e.media!==t.media)return!0===e.matches}return!1}(),n||(i=["SDR"])}return{preferHDR:n,allowedVideoRanges:i}}const it=(e,t)=>JSON.stringify(e,(e=>{const t=new WeakSet;return(n,i)=>{if(e&&(i=e(n,i)),"object"==typeof i&&null!==i){if(t.has(i))return;t.add(i)}return i}})(t));function rt(e,t){R.log(`[abr] start candidates with "${e}" ignored because ${t}`)}function st(e){return e.reduce(((e,t)=>{let n=e.groups[t.groupId];n||(n=e.groups[t.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),n.tracks.push(t);const i=t.channels||"2";return n.channels[i]=(n.channels[i]||0)+1,n.hasDefault=n.hasDefault||t.default,n.hasAutoSelect=n.hasAutoSelect||t.autoselect,n.hasDefault&&(e.hasDefaultAudio=!0),n.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e}),{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function at(e){if(!e)return e;const{lang:t,assocLang:n,characteristics:i,channels:r,audioCodec:s}=e;return{lang:t,assocLang:n,characteristics:i,channels:r,audioCodec:s}}function ot(e,t,n){if("attrs"in e){const n=t.indexOf(e);if(-1!==n)return n}for(let i=0;i<t.length;i++){if(lt(e,t[i],n))return i}return-1}function lt(e,t,n){const{groupId:i,name:r,lang:s,assocLang:a,default:o}=e,l=e.forced;return(void 0===i||t.groupId===i)&&(void 0===r||t.name===r)&&(void 0===s||function(e,t="--"){if(e.length===t.length)return e===t;return e.startsWith(t)||t.startsWith(e)}(s,t.lang))&&(void 0===s||t.assocLang===a)&&(void 0===o||t.default===o)&&(void 0===l||t.forced===l)&&(!("characteristics"in e)||function(e,t=""){const n=e.split(","),i=t.split(",");return n.length===i.length&&!n.some((e=>-1===i.indexOf(e)))}(e.characteristics||"",t.characteristics))&&(void 0===n||n(e,t))}function ut(e,t){const{audioCodec:n,channels:i}=e;return!(void 0!==n&&(t.audioCodec||"").substring(0,4)!==n.substring(0,4)||void 0!==i&&i!==(t.channels||"2"))}function ct(e,t,n){for(let i=t;i>-1;i--)if(n(e[i]))return i;for(let i=t+1;i<e.length;i++)if(n(e[i]))return i;return-1}function ht(e,t){var n;return!!e&&e!==(null==(n=t.loadLevelObj)?void 0:n.uri)}const dt=function(e,t){let n=0,i=e.length-1,r=null,s=null;for(;n<=i;){r=(n+i)/2|0,s=e[r];const a=t(s);if(a>0)n=r+1;else{if(!(a<0))return s;i=r-1}}return null};function ft(e,t,n=0,i=0,r=.005){let s=null;if(e){s=t[1+e.sn-t[0].sn]||null;const i=e.endDTS-n;i>0&&i<15e-7&&(n+=15e-7),s&&e.level!==s.level&&s.end<=e.end&&(s=t[2+e.sn-t[0].sn]||null)}else 0===n&&0===t[0].start&&(s=t[0]);if(s&&((!e||e.level===s.level)&&0===pt(n,i,s)||function(e,t,n){if(t&&0===t.start&&t.level<e.level&&(t.endPTS||0)>0){const i=t.tagList.reduce(((e,t)=>("INF"===t[0]&&(e+=parseFloat(t[1])),e)),n);return e.start<=i}return!1}(s,e,Math.min(r,i))))return s;const a=dt(t,pt.bind(null,n,i));return!a||a===e&&s?s:a}function pt(e=0,t=0,n){if(n.start<=e&&n.start+n.duration>e)return 0;const i=Math.min(t,n.duration+(n.deltaPTS?n.deltaPTS:0));return n.start+n.duration-i<=e?1:n.start-i>e&&n.start?-1:0}function _t(e,t,n){const i=1e3*Math.min(t,n.duration+(n.deltaPTS?n.deltaPTS:0));return(n.endProgramDateTime||0)-i>e}function gt(e,t,n){if(e&&e.startCC<=t&&e.endCC>=t){let i=e.fragments;const{fragmentHint:r}=e;let s;return r&&(i=i.concat(r)),dt(i,(e=>e.cc<t?1:e.cc>t?-1:(s=e,e.end<=n?1:e.start>n?-1:0))),s||null}return null}function mt(e){switch(e.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 vt(e){return e.details.startsWith("key")}function yt(e){return vt(e)&&!!e.frag&&!e.frag.decryptdata}function bt(e,t){const n=mt(t);return e.default[(n?"timeout":"error")+"Retry"]}function Et(e,t){const n="linear"===e.backoff?1:Math.pow(2,t);return Math.min(n*e.retryDelayMs,e.maxRetryDelayMs)}function wt(e){return E(E({},e),{errorRetry:null,timeoutRetry:null})}function kt(e,t,n,i){if(!e)return!1;const r=null==i?void 0:i.code,s=t<e.maxNumRetry&&(function(e){return St(e)||!!e&&(e<400||e>499)}(r)||!!n);return e.shouldRetry?e.shouldRetry(e,t,n,i,s):s}function St(e){return 0===e&&!1===navigator.onLine}var Tt=0,At=2,Ct=3,Rt=5,Lt=0,xt=1,It=2,Dt=4;function Pt(e){const t={action:Tt,flags:Lt};return e&&(t.resolved=!0),t}var Ot="NOT_LOADED",Mt="APPENDING",Nt="PARTIAL",Ft="OK";class Bt{constructor(e){this.activePartLists=Object.create(null),this.endListFragments=Object.create(null),this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hasGaps=!1,this.hls=e,this._registerListeners()}_registerListeners(){const{hls:e}=this;e&&(e.on(l.MANIFEST_LOADING,this.onManifestLoading,this),e.on(l.BUFFER_APPENDED,this.onBufferAppended,this),e.on(l.FRAG_BUFFERED,this.onFragBuffered,this),e.on(l.FRAG_LOADED,this.onFragLoaded,this))}_unregisterListeners(){const{hls:e}=this;e&&(e.off(l.MANIFEST_LOADING,this.onManifestLoading,this),e.off(l.BUFFER_APPENDED,this.onBufferAppended,this),e.off(l.FRAG_BUFFERED,this.onFragBuffered,this),e.off(l.FRAG_LOADED,this.onFragLoaded,this))}destroy(){this._unregisterListeners(),this.hls=this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null}getAppendedFrag(e,t){const n=this.activePartLists[t];if(n)for(let t=n.length;t--;){const i=n[t];if(!i)break;if(i.start<=e&&e<=i.end&&i.loaded)return i}return this.getBufferedFrag(e,t)}getBufferedFrag(e,t){return this.getFragAtPos(e,t,!0)}getFragAtPos(e,t,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)===t&&(!n||a.buffered)){const t=a.body;if(t.start<=e&&e<=t.end)return t}}return null}detectEvictedFragments(e,t,n,i,r){this.timeRanges&&(this.timeRanges[e]=t);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[e];o&&(0!==o.time.length?o.time.some((e=>{const n=!this.isTimeBuffered(e.startPTS,e.endPTS,t);return n&&this.removeFragment(a.body),n})):this.removeFragment(a.body))}))}detectPartialFragments(e){const t=this.timeRanges;if(!t||"initSegment"===e.frag.sn)return;const n=e.frag,i=Kt(n),r=this.fragments[i];if(!r||r.buffered&&n.gap)return;const s=!n.relurl;if(Object.keys(t).forEach((i=>{const a=n.elementaryStreams[i];if(!a)return;const o=t[i],l=s||!0===a.partial;r.range[i]=this.getBufferedTimes(n,e.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),Ut(r)||this.removeParts(n.sn-1,n.type)}else this.removeFragment(r.body)}removeParts(e,t){const n=this.activePartLists[t];n&&(this.activePartLists[t]=$t(n,(t=>t.fragment.sn>=e)))}fragBuffered(e,t){const n=Kt(e);let i=this.fragments[n];!i&&t&&(i=this.fragments[n]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),i&&(i.loaded=null,i.buffered=!0)}getBufferedTimes(e,t,n,i){const r={time:[],partial:n},s=e.start,a=e.end,o=e.minEndPTS||a,l=e.maxStartPTS||s;for(let e=0;e<i.length;e++){const t=i.start(e)-this.bufferPadding,n=i.end(e)+this.bufferPadding;if(l>=t&&o<=n){r.time.push({startPTS:Math.max(s,i.start(e)),endPTS:Math.min(a,i.end(e))});break}if(s<n&&a>t){const t=Math.max(s,i.start(e)),n=Math.min(a,i.end(e));n>t&&(r.partial=!0,r.time.push({startPTS:t,endPTS:n}))}else if(a<=t)break}return r}getPartialFragment(e){let t,n,i,r=null,s=0;const{bufferPadding:a,fragments:o}=this;return Object.keys(o).forEach((l=>{const u=o[l];u&&Ut(u)&&(n=u.body.start-a,i=u.body.end+a,e>=n&&e<=i&&(t=Math.min(e-n,i-e),s<=t&&(r=u.body,s=t)))})),r}isEndListAppended(e){const t=this.endListFragments[e];return void 0!==t&&(t.buffered||Ut(t))}getState(e){const t=Kt(e),n=this.fragments[t];return n?n.buffered?Ut(n)?Nt:Ft:Mt:Ot}isTimeBuffered(e,t,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,e>=i&&t<=r)return!0;if(t<=i)return!1}return!1}onManifestLoading(){this.removeAllFragments()}onFragLoaded(e,t){if("initSegment"===t.frag.sn||t.frag.bitrateTest)return;const n=t.frag,i=t.part?null:t,r=Kt(n);this.fragments[r]={body:n,appendedPTS:null,loaded:i,buffered:!1,range:Object.create(null)}}onBufferAppended(e,t){const{frag:n,part:i,timeRanges:r,type:s}=t;if("initSegment"===n.sn)return;const a=n.type;if(i){let e=this.activePartLists[a];e||(this.activePartLists[a]=e=[]),e.push(i)}this.timeRanges=r;const o=r[s];this.detectEvictedFragments(s,o,a,i)}onFragBuffered(e,t){this.detectPartialFragments(t)}hasFragment(e){const t=Kt(e);return!!this.fragments[t]}hasFragments(e){const{fragments:t}=this,n=Object.keys(t);if(!e)return n.length>0;for(let i=n.length;i--;){const r=t[n[i]];if((null==r?void 0:r.body.type)===e)return!0}return!1}hasParts(e){var t;return!(null==(t=this.activePartLists[e])||!t.length)}removeFragmentsInRange(e,t,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<t&&o.end>e&&(a.buffered||r)&&this.removeFragment(o)}))}removeFragment(e){const t=Kt(e);e.clearElementaryStreamInfo();const n=this.activePartLists[e.type];if(n){const t=e.sn;this.activePartLists[e.type]=$t(n,(e=>e.fragment.sn!==t))}delete this.fragments[t],e.endList&&delete this.endListFragments[e.type]}removeAllFragments(){var e;this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1;const t=null==(e=this.hls)||null==(e=e.latestLevelDetails)?void 0:e.partList;t&&t.forEach((e=>e.clearElementaryStreamInfo()))}}function Ut(e){var t,n,i;return e.buffered&&!!(e.body.gap||null!=(t=e.range.video)&&t.partial||null!=(n=e.range.audio)&&n.partial||null!=(i=e.range.audiovideo)&&i.partial)}function Kt(e){return`${e.type}_${e.level}_${e.sn}`}function $t(e,t){return e.filter((e=>{const n=t(e);return n||e.clearElementaryStreamInfo(),n}))}var Gt=0,jt=1;class Vt{constructor(e,t,n){this.subtle=void 0,this.aesIV=void 0,this.aesMode=void 0,this.subtle=e,this.aesIV=t,this.aesMode=n}decrypt(e,t){switch(this.aesMode){case Gt:return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e);case jt:return this.subtle.decrypt({name:"AES-CTR",counter:this.aesIV,length:64},t,e);default:throw new Error(`[AESCrypto] invalid aes mode ${this.aesMode}`)}}}class Zt{constructor(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}uint8ArrayToUint32Array_(e){const t=new DataView(e),n=new Uint32Array(4);for(let e=0;e<4;e++)n[e]=t.getUint32(4*e);return n}initTable(){const e=this.sBox,t=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],c=o[2],h=o[3],d=new Uint32Array(256);let f=0,p=0,_=0;for(_=0;_<256;_++)d[_]=_<128?_<<1:_<<1^283;for(_=0;_<256;_++){let n=p^p<<1^p<<2^p<<3^p<<4;n=n>>>8^255&n^99,e[f]=n,t[n]=f;const o=d[f],_=d[o],g=d[_];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*g^65537*_^257*o^16843008*f,l[n]=m<<24|m>>>8,u[n]=m<<16|m>>>16,c[n]=m<<8|m>>>24,h[n]=m,f?(f=o^d[d[d[g^o]]],p^=d[d[p]]):f=p=1}}expandKey(e){const t=this.uint8ArrayToUint32Array_(e);let n=!0,i=0;for(;i<t.length&&n;)n=t[i]===this.key[i],i++;if(n)return;this.key=t;const r=this.keySize=t.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),c=this.sBox,h=this.rcon,d=this.invSubMix,f=d[0],p=d[1],_=d[2],g=d[3];let m,v;for(a=0;a<s;a++)a<r?m=l[a]=t[a]:(v=m,a%r==0?(v=v<<8|v>>>24,v=c[v>>>24]<<24|c[v>>>16&255]<<16|c[v>>>8&255]<<8|c[255&v],v^=h[a/r|0]<<24):r>6&&a%r==4&&(v=c[v>>>24]<<24|c[v>>>16&255]<<16|c[v>>>8&255]<<8|c[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[c[v>>>24]]^p[c[v>>>16&255]]^_[c[v>>>8&255]]^g[c[255&v]],u[o]=u[o]>>>0}networkToHostOrderSwap(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24}decrypt(e,t,n){const i=this.keySize+6,r=this.invKeySchedule,s=this.invSBox,a=this.invSubMix,o=a[0],l=a[1],u=a[2],c=a[3],h=this.uint8ArrayToUint32Array_(n);let d=h[0],f=h[1],p=h[2],_=h[3];const g=new Int32Array(e),m=new Int32Array(g.length);let v,y,b,E,w,k,S,T,A,C,R,L,x,I;const D=this.networkToHostOrderSwap;for(;t<g.length;){for(A=D(g[t]),C=D(g[t+1]),R=D(g[t+2]),L=D(g[t+3]),w=A^r[0],k=L^r[1],S=R^r[2],T=C^r[3],x=4,I=1;I<i;I++)v=o[w>>>24]^l[k>>16&255]^u[S>>8&255]^c[255&T]^r[x],y=o[k>>>24]^l[S>>16&255]^u[T>>8&255]^c[255&w]^r[x+1],b=o[S>>>24]^l[T>>16&255]^u[w>>8&255]^c[255&k]^r[x+2],E=o[T>>>24]^l[w>>16&255]^u[k>>8&255]^c[255&S]^r[x+3],w=v,k=y,S=b,T=E,x+=4;v=s[w>>>24]<<24^s[k>>16&255]<<16^s[S>>8&255]<<8^s[255&T]^r[x],y=s[k>>>24]<<24^s[S>>16&255]<<16^s[T>>8&255]<<8^s[255&w]^r[x+1],b=s[S>>>24]<<24^s[T>>16&255]<<16^s[w>>8&255]<<8^s[255&k]^r[x+2],E=s[T>>>24]<<24^s[w>>16&255]<<16^s[k>>8&255]<<8^s[255&S]^r[x+3],m[t]=D(v^d),m[t+1]=D(E^f),m[t+2]=D(b^p),m[t+3]=D(y^_),d=A,f=C,p=R,_=L,t+=4}return m.buffer}}class Ht{constructor(e,t,n){this.subtle=void 0,this.key=void 0,this.aesMode=void 0,this.subtle=e,this.key=t,this.aesMode=n}expandKey(){const e=function(e){switch(e){case Gt:return"AES-CBC";case jt:return"AES-CTR";default:throw new Error(`[FastAESKey] invalid aes mode ${e}`)}}(this.aesMode);return this.subtle.importKey("raw",this.key,{name:e},!1,["encrypt","decrypt"])}}class zt{constructor(e,{removePKCS7Padding:t=!0}={}){if(this.logEnabled=!0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.useSoftware=void 0,this.enableSoftwareAES=void 0,this.enableSoftwareAES=e.enableSoftwareAES,this.removePKCS7Padding=t,t)try{const e=self.crypto;e&&(this.subtle=e.subtle||e.webkitSubtle)}catch(e){}this.useSoftware=!this.subtle}destroy(){this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null}isSync(){return this.useSoftware}flush(){const{currentResult:e,remainderData:t}=this;if(!e||t)return this.reset(),null;const n=new Uint8Array(e);return this.reset(),this.removePKCS7Padding?function(e){const t=e.byteLength,n=t&&new DataView(e.buffer).getUint8(t-1);return n?e.slice(0,t-n):e}(n):n}reset(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)}decrypt(e,t,n,i){return this.useSoftware?new Promise(((r,s)=>{const a=ArrayBuffer.isView(e)?e:new Uint8Array(e);this.softwareDecrypt(a,t,n,i);const o=this.flush();o?r(o.buffer):s(new Error("[softwareDecrypt] Failed to decrypt data"))})):this.webCryptoDecrypt(new Uint8Array(e),t,n,i)}softwareDecrypt(e,t,n,i){const{currentIV:r,currentResult:s,remainderData:a}=this;if(i!==Gt||16!==t.byteLength)return R.warn("SoftwareDecrypt: can only handle AES-128-CBC"),null;this.logOnce("JS AES decrypt"),a&&(e=ge(a,e),this.remainderData=null);const o=this.getValidChunk(e);if(!o.length)return null;r&&(n=r);let l=this.softwareDecrypter;l||(l=this.softwareDecrypter=new Zt),l.expandKey(t);const u=s;return this.currentResult=l.decrypt(o.buffer,0,n),this.currentIV=o.slice(-16).buffer,u||null}webCryptoDecrypt(e,t,n,i){if(this.key!==t||!this.fastAesKey){if(!this.subtle)return Promise.resolve(this.onWebCryptoError(e,t,n,i));this.key=t,this.fastAesKey=new Ht(this.subtle,t,i)}return this.fastAesKey.expandKey().then((t=>{if(!this.subtle)return Promise.reject(new Error("web crypto not initialized"));this.logOnce("WebCrypto AES decrypt");return new Vt(this.subtle,new Uint8Array(n),i).decrypt(e.buffer,t)})).catch((r=>(R.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${r.name}: ${r.message}`),this.onWebCryptoError(e,t,n,i))))}onWebCryptoError(e,t,n,i){const r=this.enableSoftwareAES;if(r){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,n,i);const r=this.flush();if(r)return r.buffer}throw new Error("WebCrypto"+(r?" and softwareDecrypt":"")+": failed to decrypt data")}getValidChunk(e){let t=e;const n=e.length-e.length%16;return n!==e.length&&(t=e.slice(0,n),this.remainderData=e.slice(n)),t}logOnce(e){this.logEnabled&&(R.log(`[decrypter]: ${e}`),this.logEnabled=!1)}}const Wt=Math.pow(2,17);class qt{constructor(e){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=e}destroy(){this.loader&&(this.loader.destroy(),this.loader=null)}abort(){this.loader&&this.loader.abort()}load(e,t){const n=e.url;if(!n)return Promise.reject(new Qt({type:a.NETWORK_ERROR,details:o.FRAG_LOAD_ERROR,fatal:!1,frag:e,error:new Error("Fragment does not have a "+(n?"part list":"url")),networkDetails:null}));this.abort();const i=this.config,r=i.fLoader,s=i.loader;return new Promise(((l,u)=>{if(this.loader&&this.loader.destroy(),e.gap){if(e.tagList.some((e=>"GAP"===e[0])))return void u(Xt(e));e.gap=!1}const c=this.loader=r?new r(i):new s(i),h=Yt(e);e.loader=c;const d=wt(i.fragLoadPolicy.default),f={loadPolicy:d,timeout:d.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:"initSegment"===e.sn?1/0:Wt};e.stats=c.stats;const p={onSuccess:(t,n,i,r)=>{this.resetLoader(e,c);let s=t.data;i.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(s.slice(0,16)),s=s.slice(16)),l({frag:e,part:null,payload:s,networkDetails:r})},onError:(t,i,r,s)=>{this.resetLoader(e,c),u(new Qt({type:a.NETWORK_ERROR,details:o.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:E({url:n,data:void 0},t),error:new Error(`HTTP Error ${t.code} ${t.text}`),networkDetails:r,stats:s}))},onAbort:(t,n,i)=>{this.resetLoader(e,c),u(new Qt({type:a.NETWORK_ERROR,details:o.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:i,stats:t}))},onTimeout:(t,n,i)=>{this.resetLoader(e,c),u(new Qt({type:a.NETWORK_ERROR,details:o.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error(`Timeout after ${f.timeout}ms`),networkDetails:i,stats:t}))}};t&&(p.onProgress=(n,i,r,s)=>t({frag:e,part:null,payload:r,networkDetails:s})),c.load(h,f,p)}))}loadPart(e,t,n){this.abort();const i=this.config,r=i.fLoader,s=i.loader;return new Promise(((l,u)=>{if(this.loader&&this.loader.destroy(),e.gap||t.gap)return void u(Xt(e,t));const c=this.loader=r?new r(i):new s(i),h=Yt(e,t);e.loader=c;const d=wt(i.fragLoadPolicy.default),f={loadPolicy:d,timeout:d.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:Wt};t.stats=c.stats,c.load(h,f,{onSuccess:(i,r,s,a)=>{this.resetLoader(e,c),this.updateStatsFromPart(e,t);const o={frag:e,part:t,payload:i.data,networkDetails:a};n(o),l(o)},onError:(n,i,r,s)=>{this.resetLoader(e,c),u(new Qt({type:a.NETWORK_ERROR,details:o.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:E({url:h.url,data:void 0},n),error:new Error(`HTTP Error ${n.code} ${n.text}`),networkDetails:r,stats:s}))},onAbort:(n,i,r)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,c),u(new Qt({type:a.NETWORK_ERROR,details:o.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:r,stats:n}))},onTimeout:(n,i,r)=>{this.resetLoader(e,c),u(new Qt({type:a.NETWORK_ERROR,details:o.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error(`Timeout after ${f.timeout}ms`),networkDetails:r,stats:n}))}})}))}updateStatsFromPart(e,t){const n=e.stats,i=t.stats,r=i.total;if(n.loaded+=i.loaded,r){const i=Math.round(e.duration/t.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(e,t){e.loader=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()}}function Yt(e,t=null){const n=t||e,r={frag:e,part:t,responseType:"arraybuffer",url:n.url,headers:{},rangeStart:0,rangeEnd:0},s=n.byteRangeStartOffset,a=n.byteRangeEndOffset;if(i(s)&&i(a)){var o;let t=s,n=a;if("initSegment"===e.sn&&("AES-128"===(l=null==(o=e.decryptdata)?void 0:o.method)||"AES-256"===l)){const e=a-s;e%16&&(n=a+(16-e%16)),0!==s&&(r.resetIV=!0,t=s-16)}r.rangeStart=t,r.rangeEnd=n}var l;return r}function Xt(e,t){const n=new Error(`GAP ${e.gap?"tag":"attribute"} found`),i={type:a.MEDIA_ERROR,details:o.FRAG_GAP,fatal:!1,frag:e,error:n,networkDetails:null};return t&&(i.part=t),(t||e).stats.aborted=!0,new Qt(i)}class Qt extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class Jt extends w{constructor(e,t){super(e,t),this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}destroy(){this.onHandlerDestroying(),this.onHandlerDestroyed()}onHandlerDestroying(){this.clearNextTick(),this.clearInterval()}onHandlerDestroyed(){}hasInterval(){return!!this._tickInterval}hasNextTick(){return!!this._tickTimer}setInterval(e){return!this._tickInterval&&(this._tickCallCount=0,this._tickInterval=self.setInterval(this._boundTick,e),!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 en{constructor(e,t,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=e,this.sn=t,this.id=n,this.size=i,this.part=r,this.partial=s}}const tn={length:0,start:()=>0,end:()=>0};class nn{static isBuffered(e,t){if(e){const n=nn.getBuffered(e);for(let e=n.length;e--;)if(t>=n.start(e)&&t<=n.end(e))return!0}return!1}static bufferedRanges(e){if(e){const t=nn.getBuffered(e);return nn.timeRangesToArray(t)}return[]}static timeRangesToArray(e){const t=[];for(let n=0;n<e.length;n++)t.push({start:e.start(n),end:e.end(n)});return t}static bufferInfo(e,t,n){if(e){const i=nn.bufferedRanges(e);if(i.length)return nn.bufferedInfo(i,t,n)}return{len:0,start:t,end:t,bufferedIndex:-1}}static bufferedInfo(e,t,n){t=Math.max(0,t),e.length>1&&e.sort(((e,t)=>e.start-t.start||t.end-e.end));let i=-1,r=[];if(n)for(let s=0;s<e.length;s++){t>=e[s].start&&t<=e[s].end&&(i=s);const a=r.length;if(a){const t=r[a-1].end;e[s].start-t<n?e[s].end>t&&(r[a-1].end=e[s].end):r.push(e[s])}else r.push(e[s])}else r=e;let s,a=0,o=t,l=t;for(let e=0;e<r.length;e++){const u=r[e].start,c=r[e].end;if(-1===i&&t>=u&&t<=c&&(i=e),t+n>=u&&t<c)o=u,l=c,a=l-t;else if(t+n<u){s=u;break}}return{len:a,start:o||0,end:l||0,nextStart:s,buffered:e,bufferedIndex:i}}static getBuffered(e){try{return e.buffered||tn}catch(e){return R.log("failed to get media.buffered",e),tn}}}const rn=/\{\$([a-zA-Z0-9-_]+)\}/g;function sn(e){return rn.test(e)}function an(e,t){if(null!==e.variableList||e.hasVariableRefs){const n=e.variableList;return t.replace(rn,(t=>{const i=t.substring(2,t.length-1),r=null==n?void 0:n[i];return void 0===r?(e.playlistParsingError||(e.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${i}"`)),t):r}))}return t}function on(e,t,n){let i,r,s=e.variableList;if(s||(e.variableList=s={}),"QUERYPARAM"in t){i=t.QUERYPARAM;try{const e=new self.URL(n).searchParams;if(!e.has(i))throw new Error(`"${i}" does not match any query parameter in URI: "${n}"`);r=e.get(i)}catch(t){e.playlistParsingError||(e.playlistParsingError=new Error(`EXT-X-DEFINE QUERYPARAM: ${t.message}`))}}else i=t.NAME,r=t.VALUE;i in s?e.playlistParsingError||(e.playlistParsingError=new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${i}"`)):s[i]=r||""}function ln(e,t,n){const i=t.IMPORT;if(n&&i in n){let t=e.variableList;t||(e.variableList=t={}),t[i]=n[i]}else e.playlistParsingError||(e.playlistParsingError=new Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${i}"`))}const un=/^(\d+)x(\d+)$/,cn=/(.+?)=(".*?"|.*?)(?:,|$)/g;class hn{constructor(e,t){"string"==typeof e&&(e=hn.parseAttrList(e,t)),y(this,e)}get clientAttrs(){return Object.keys(this).filter((e=>"X-"===e.substring(0,2)))}decimalInteger(e){const t=parseInt(this[e],10);return t>Number.MAX_SAFE_INTEGER?1/0:t}hexadecimalInteger(e){if(this[e]){let t=(this[e]||"0x").slice(2);t=(1&t.length?"0":"")+t;const n=new Uint8Array(t.length/2);for(let e=0;e<t.length/2;e++)n[e]=parseInt(t.slice(2*e,2*e+2),16);return n}return null}hexadecimalIntegerAsNumber(e){const t=parseInt(this[e],16);return t>Number.MAX_SAFE_INTEGER?1/0:t}decimalFloatingPoint(e){return parseFloat(this[e])}optionalFloat(e,t){const n=this[e];return n?parseFloat(n):t}enumeratedString(e){return this[e]}enumeratedStringList(e,t){const n=this[e];return(n?n.split(/[ ,]+/):[]).reduce(((e,t)=>(e[t.toLowerCase()]=!0,e)),t)}bool(e){return"YES"===this[e]}decimalResolution(e){const t=un.exec(this[e]);if(null!==t)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}}static parseAttrList(e,t){let n;const i={};for(cn.lastIndex=0;null!==(n=cn.exec(e));){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(t&&(a||o))s=an(t,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":R.warn(`${e}: attribute ${r} is missing quotes`)}i[r]=s}return i}}function dn(e){return"SCTE35-OUT"===e||"SCTE35-IN"===e||"SCTE35-CMD"===e}class fn{constructor(e,t,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==t?void 0:t.tagAnchor)||null,this.tagOrder=null!=(r=null==t?void 0:t.tagOrder)?r:n,t){const n=t.attr;for(const t in n)if(Object.prototype.hasOwnProperty.call(e,t)&&e[t]!==n[t]){R.warn(`DATERANGE tag attribute: "${t}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=t;break}e=y(new hn({}),n,e)}if(this.attr=e,t?(this._startDate=t._startDate,this._cue=t._cue,this._endDate=t._endDate,this._dateAtEnd=t._dateAtEnd):this._startDate=new Date(e["START-DATE"]),"END-DATE"in this.attr){const e=(null==t?void 0:t.endDate)||new Date(this.attr["END-DATE"]);i(e.getTime())&&(this._endDate=e)}}get id(){return this.attr.ID}get class(){return this.attr.CLASS}get cue(){const e=this._cue;return void 0===e?this._cue=this.attr.enumeratedStringList(this.attr.CUE?"CUE":"X-CUE",{pre:!1,post:!1,once:!1}):e}get startTime(){const{tagAnchor:e}=this;return null===e||null===e.programDateTime?(R.warn(`Expected tagAnchor Fragment with PDT set for DateRange "${this.id}": ${e}`),NaN):e.start+(this.startDate.getTime()-e.programDateTime)/1e3}get startDate(){return this._startDate}get endDate(){const e=this._endDate||this._dateAtEnd;if(e)return e;const t=this.duration;return null!==t?this._dateAtEnd=new Date(this._startDate.getTime()+1e3*t):null}get duration(){if("DURATION"in this.attr){const e=this.attr.decimalFloatingPoint("DURATION");if(i(e))return e}else if(this._endDate)return(this._endDate.getTime()-this._startDate.getTime())/1e3;return null}get plannedDuration(){return"PLANNED-DURATION"in this.attr?this.attr.decimalFloatingPoint("PLANNED-DURATION"):null}get endOnNext(){return this.attr.bool("END-ON-NEXT")}get isInterstitial(){return"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 pn{constructor(e){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.dateRanges=void 0,this.dateRangeTagCount=0,this.live=!0,this.requestScheduled=-1,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.misses=0,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.encryptedFragments=void 0,this.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,this.appliedTimelineOffset=void 0,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=e}reloaded(e){if(!e)return this.advanced=!0,void(this.updated=!0);const t=this.lastPartSn-e.lastPartSn,n=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!n||!!t||!this.live,this.advanced=this.endSN>e.endSN||t>0||0===t&&n>0,this.updated||this.advanced?this.misses=Math.floor(.6*e.misses):this.misses=e.misses+1}hasKey(e){return this.encryptedFragments.some((t=>{let n=t.decryptdata;return n||(t.setKeyFormat(e.keyFormat),n=t.decryptdata),!!n&&e.matches(n)}))}get hasProgramDateTime(){return!!this.fragments.length&&i(this.fragments[this.fragments.length-1].programDateTime)}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||10}get drift(){const e=this.driftEndTime-this.driftStartTime;if(e>0){return 1e3*(this.driftEnd-this.driftStart)/e}return 1}get edge(){return this.partEnd||this.fragmentEnd}get partEnd(){var e;return null!=(e=this.partList)&&e.length?this.partList[this.partList.length-1].end:this.fragmentEnd}get fragmentEnd(){return this.fragments.length?this.fragments[this.fragments.length-1].end:0}get fragmentStart(){return this.fragments.length?this.fragments[0].start:0}get age(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}get lastPartIndex(){var e;return null!=(e=this.partList)&&e.length?this.partList[this.partList.length-1].index:-1}get maxPartIndex(){const e=this.partList;if(e){const t=this.lastPartIndex;if(-1!==t){for(let n=e.length;n--;)if(e[n].index>t)return e[n].index;return t}}return 0}get lastPartSn(){var e;return null!=(e=this.partList)&&e.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}get expired(){if(this.live&&this.age&&this.misses<3){const e=this.partEnd-this.fragmentStart;return this.age>Math.max(e,this.totalduration)+this.levelTargetDuration}return!1}}function _n(e,t){return e.length===t.length&&!e.some(((e,n)=>e!==t[n]))}function gn(e,t){return!e&&!t||!(!e||!t)&&_n(e,t)}function mn(e){return"AES-128"===e||"AES-256"===e||"AES-256-CTR"===e}function vn(e){switch(e){case"AES-128":case"AES-256":return Gt;case"AES-256-CTR":return jt;default:throw new Error(`invalid full segment method ${e}`)}}function yn(e){return Uint8Array.from(atob(e),(e=>e.charCodeAt(0)))}function bn(e){return Uint8Array.from(unescape(encodeURIComponent(e)),(e=>e.charCodeAt(0)))}function En(e){const t=function(e,t,n){const i=e[t];e[t]=e[n],e[n]=i};t(e,0,3),t(e,1,2),t(e,4,5),t(e,6,7)}function wn(e){const t=e.split(":");let n=null;if("data"===t[0]&&2===t.length){const e=t[1].split(";"),i=e[e.length-1].split(",");if(2===i.length){const t="base64"===i[0],r=i[1];t?(e.splice(-1,1),n=yn(r)):n=function(e){const t=bn(e).subarray(0,16),n=new Uint8Array(16);return n.set(t,16-t.length),n}(r)}}return n}const kn="undefined"!=typeof self?self:void 0;var Sn={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},Tn="org.w3.clearkey",An="com.apple.streamingkeydelivery",Cn="com.microsoft.playready",Rn="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed";function Ln(e){switch(e){case An:return Sn.FAIRPLAY;case Cn:return Sn.PLAYREADY;case Rn:return Sn.WIDEVINE;case Tn:return Sn.CLEARKEY}}function xn(e){switch(e){case Sn.FAIRPLAY:return An;case Sn.PLAYREADY:return Cn;case Sn.WIDEVINE:return Rn;case Sn.CLEARKEY:return Tn}}function In(e){const{drmSystems:t,widevineLicenseUrl:n}=e,i=t?[Sn.FAIRPLAY,Sn.WIDEVINE,Sn.PLAYREADY,Sn.CLEARKEY].filter((e=>!!t[e])):[];return!i[Sn.WIDEVINE]&&n&&i.push(Sn.WIDEVINE),i}const Dn=null!=kn&&null!=(Pn=kn.navigator)&&Pn.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null;var Pn;function On(e){const t=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2),n=String.fromCharCode.apply(null,Array.from(t)),i=n.substring(n.indexOf("<"),n.length),r=(new DOMParser).parseFromString(i,"text/xml").getElementsByTagName("KID")[0];if(r){const e=r.childNodes[0]?r.childNodes[0].nodeValue:r.getAttribute("VALUE");if(e){const t=yn(e).subarray(0,16);return En(t),t}}return null}let Mn={};class Nn{static clearKeyUriToKeyIdMap(){Mn={}}static setKeyIdForUri(e,t){Mn[e]=t}constructor(e,t,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=e,this.uri=t,this.keyFormat=n,this.keyFormatVersions=i,this.iv=r,this.encrypted=!!e&&"NONE"!==e,this.isCommonEncryption=this.encrypted&&!mn(e),null!=s&&s.startsWith("0x")&&(this.keyId=new Uint8Array(P(s)))}matches(e){return e.uri===this.uri&&e.method===this.method&&e.encrypted===this.encrypted&&e.keyFormat===this.keyFormat&&_n(e.keyFormatVersions,this.keyFormatVersions)&&gn(e.iv,this.iv)&&gn(e.keyId,this.keyId)}isSupported(){if(this.method){if(mn(this.method)||"NONE"===this.method)return!0;if("identity"===this.keyFormat)return"SAMPLE-AES"===this.method;switch(this.keyFormat){case An:case Rn:case Cn:case Tn:return-1!==["SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)}}return!1}getDecryptData(e,t){if(!this.encrypted||!this.uri)return null;if(mn(this.method)){let t=this.iv;t||("number"!=typeof e&&(R.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),e=0),t=function(e){const t=new Uint8Array(16);for(let n=12;n<16;n++)t[n]=e>>8*(15-n)&255;return t}(e));return new Nn(this.method,this.uri,"identity",this.keyFormatVersions,t)}if(this.keyId){const e=Mn[this.uri];if(e&&!_n(this.keyId,e)&&Nn.setKeyIdForUri(this.uri,this.keyId),this.pssh)return this}const n=wn(this.uri);if(n)switch(this.keyFormat){case Rn:if(this.pssh=n,!this.keyId){const e=function(e){const t=[];if(e instanceof ArrayBuffer){const n=e.byteLength;let i=0;for(;i+32<n;){const n=ke(new DataView(e,i));t.push(n),i+=n.size}}return t}(n.buffer);if(e.length){var i;const t=e[0];this.keyId=null!=(i=t.kids)&&i.length?t.kids[0]:null}}this.keyId||(this.keyId=Fn(t));break;case Cn:{const e=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=we(e,0,n),this.keyId=On(n);break}default:{let e=n.subarray(0,16);if(16!==e.length){const t=new Uint8Array(16);t.set(e,16-e.length),e=t}this.keyId=e;break}}if(!this.keyId||16!==this.keyId.byteLength){let e;e=function(e){const t=null==e?void 0:e[Rn];if(t)return t.keyId;return null}(t),e||(e=Fn(t),e||(e=Mn[this.uri])),e&&(this.keyId=e,Nn.setKeyIdForUri(this.uri,e))}return this}}function Fn(e){const t=null==e?void 0:e[Cn];if(t){const e=wn(t.uri);if(e)return On(e)}return null}const Bn=/#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,Un=/#EXT-X-MEDIA:(.*)/g,Kn=/^#EXT(?:INF|-X-TARGETDURATION):/m,$n=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[^\r\n]*)/.source,/#.*/.source].join("|"),"g"),Gn=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 jn{static findGroup(e,t){for(let n=0;n<e.length;n++){const i=e[n];if(i.id===t)return i}}static resolve(e,t){return G.buildAbsoluteURL(t,e,{alwaysNormalize:!0})}static isMediaPlaylist(e){return Kn.test(e)}static parseMasterPlaylist(e,t){const n={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:sn(e)},i=[];if(Bn.lastIndex=0,!e.startsWith("#EXTM3U"))return n.playlistParsingError=new Error("no EXTM3U delimiter"),n;let r;for(;null!=(r=Bn.exec(e));)if(r[1]){var s;const e=new hn(r[1],n),a=an(n,r[2]),o={attrs:e,bitrate:e.decimalInteger("BANDWIDTH")||e.decimalInteger("AVERAGE-BANDWIDTH"),name:e.NAME,url:jn.resolve(a,t)},l=e.decimalResolution("RESOLUTION");l&&(o.width=l.width,o.height=l.height),Wn(e.CODECS,o);const u=e["SUPPLEMENTAL-CODECS"];u&&(o.supplemental={},Wn(u,o.supplemental)),null!=(s=o.unknownCodecs)&&s.length||i.push(o),n.levels.push(o)}else if(r[3]){const e=r[3],i=r[4];switch(e){case"SESSION-DATA":{const e=new hn(i,n),t=e["DATA-ID"];t&&(null===n.sessionData&&(n.sessionData={}),n.sessionData[t]=e);break}case"SESSION-KEY":{const e=Hn(i,t,n);e.encrypted&&e.isSupported()?(null===n.sessionKeys&&(n.sessionKeys=[]),n.sessionKeys.push(e)):R.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${i}"`);break}case"DEFINE":on(n,new hn(i,n),t);break;case"CONTENT-STEERING":{const e=new hn(i,n);n.contentSteering={uri:jn.resolve(e["SERVER-URI"],t),pathwayId:e["PATHWAY-ID"]||"."};break}case"START":n.startTimeOffset=zn(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(e,t,n){let i;const r={},s=n.levels,a={AUDIO:s.map((e=>({id:e.attrs.AUDIO,audioCodec:e.audioCodec}))),SUBTITLES:s.map((e=>({id:e.attrs.SUBTITLES,textCodec:e.textCodec}))),"CLOSED-CAPTIONS":[]};let o=0;for(Un.lastIndex=0;null!==(i=Un.exec(e));){const e=new hn(i[1],n),s=e.TYPE;if(s){const n=a[s],i=r[s]||[];r[s]=i;const l=e.LANGUAGE,u=e["ASSOC-LANGUAGE"],c=e.CHANNELS,h=e.CHARACTERISTICS,d=e["INSTREAM-ID"],f={attrs:e,bitrate:0,id:o++,groupId:e["GROUP-ID"]||"",name:e.NAME||l||"",type:s,default:e.bool("DEFAULT"),autoselect:e.bool("AUTOSELECT"),forced:e.bool("FORCED"),lang:l,url:e.URI?jn.resolve(e.URI,t):""};if(u&&(f.assocLang=u),c&&(f.channels=c),h&&(f.characteristics=h),d&&(f.instreamId=d),null!=n&&n.length){const e=jn.findGroup(n,f.groupId)||n[0];qn(f,e,"audioCodec"),qn(f,e,"textCodec")}i.push(f)}}return r}static parseLevelPlaylist(e,t,n,r,s,a){var o;const l={url:t},u=new pn(t),c=u.fragments,h=[];let d,f,p,_,g=null,m=0,v=0,b=0,E=0,w=0,k=null,S=new q(r,l),T=-1,A=!1,C=null;if($n.lastIndex=0,u.m3u8=e,u.hasVariableRefs=sn(e),"#EXTM3U"!==(null==(o=$n.exec(e))?void 0:o[0]))return u.playlistParsingError=new Error("Missing format identifier #EXTM3U"),u;for(;null!==(d=$n.exec(e));){A&&(A=!1,S=new q(r,l),S.playlistOffset=b,S.setStart(b),S.sn=m,S.cc=E,w&&(S.bitrate=w),S.level=n,g&&(S.initSegment=g,g.rawProgramDateTime&&(S.rawProgramDateTime=g.rawProgramDateTime,g.rawProgramDateTime=null),C&&(S.setByteRange(C),C=null)));const e=d[1];if(e){S.duration=parseFloat(e);const t=(" "+d[2]).slice(1);S.title=t||null,S.tagList.push(t?["INF",e,t]:["INF",e])}else if(d[3]){if(i(S.duration)){S.playlistOffset=b,S.setStart(b),p&&Qn(S,p,u),S.sn=m,S.level=n,S.cc=E,c.push(S);const e=(" "+d[3]).slice(1);S.relurl=an(u,e),Yn(S,k,h),k=S,b+=S.duration,m++,v=0,A=!0}}else{if(d=d[0].match(Gn),!d){R.warn("No matches on slow regex match for level playlist!");continue}for(f=1;f<d.length&&void 0===d[f];f++);const e=(" "+d[f]).slice(1),s=(" "+d[f+1]).slice(1),o=d[f+2]?(" "+d[f+2]).slice(1):null;switch(e){case"BYTERANGE":k?S.setByteRange(s,k):S.setByteRange(s);break;case"PROGRAM-DATE-TIME":S.rawProgramDateTime=s,S.tagList.push(["PROGRAM-DATE-TIME",s]),-1===T&&(T=c.length);break;case"PLAYLIST-TYPE":u.type&&Jn(u,e,d),u.type=s.toUpperCase();break;case"MEDIA-SEQUENCE":0!==u.startSN?Jn(u,e,d):c.length>0&&ei(u,e,d),m=u.startSN=parseInt(s);break;case"SKIP":{u.skippedSegments&&Jn(u,e,d);const t=new hn(s,u),n=t.decimalInteger("SKIPPED-SEGMENTS");if(i(n)){u.skippedSegments+=n;for(let e=n;e--;)c.push(null);m+=n}const r=t.enumeratedString("RECENTLY-REMOVED-DATERANGES");r&&(u.recentlyRemovedDateranges=(u.recentlyRemovedDateranges||[]).concat(r.split("\t")));break}case"TARGETDURATION":0!==u.targetduration&&Jn(u,e,d),u.targetduration=Math.max(parseInt(s),1);break;case"VERSION":null!==u.version&&Jn(u,e,d),u.version=parseInt(s);break;case"INDEPENDENT-SEGMENTS":break;case"ENDLIST":u.live||Jn(u,e,d),u.live=!1;break;case"#":(s||o)&&S.tagList.push(o?[s,o]:[s]);break;case"DISCONTINUITY":E++,S.tagList.push(["DIS"]);break;case"GAP":S.gap=!0,S.tagList.push([e]);break;case"BITRATE":S.tagList.push([e,s]),w=1e3*parseInt(s),i(w)?S.bitrate=w:w=0;break;case"DATERANGE":{const e=new hn(s,u),t=new fn(e,u.dateRanges[e.ID],u.dateRangeTagCount);u.dateRangeTagCount++,t.isValid||u.skippedSegments?u.dateRanges[t.id]=t:R.warn(`Ignoring invalid DATERANGE tag: "${s}"`),S.tagList.push(["EXT-X-DATERANGE",s]);break}case"DEFINE":{const e=new hn(s,u);"IMPORT"in e?ln(u,e,a):on(u,e,t)}break;case"DISCONTINUITY-SEQUENCE":0!==u.startCC?Jn(u,e,d):c.length>0&&ei(u,e,d),u.startCC=E=parseInt(s);break;case"KEY":{const e=Hn(s,t,u);if(e.isSupported()){if("NONE"===e.method){p=void 0;break}p||(p={});const t=p[e.keyFormat];null!=t&&t.matches(e)||(t&&(p=y({},p)),p[e.keyFormat]=e)}else R.warn(`[Keys] Ignoring unsupported EXT-X-KEY tag: "${s}"`);break}case"START":u.startTimeOffset=zn(s);break;case"MAP":{const e=new hn(s,u);if(S.duration){const t=new q(r,l);Xn(t,e,n,p),g=t,S.initSegment=g,g.rawProgramDateTime&&!S.rawProgramDateTime&&(S.rawProgramDateTime=g.rawProgramDateTime)}else{const t=S.byteRangeEndOffset;if(t){const e=S.byteRangeStartOffset;C=`${t-e}@${e}`}else C=null;Xn(S,e,n,p),g=S,A=!0}g.cc=E;break}case"SERVER-CONTROL":_&&Jn(u,e,d),_=new hn(s),u.canBlockReload=_.bool("CAN-BLOCK-RELOAD"),u.canSkipUntil=_.optionalFloat("CAN-SKIP-UNTIL",0),u.canSkipDateRanges=u.canSkipUntil>0&&_.bool("CAN-SKIP-DATERANGES"),u.partHoldBack=_.optionalFloat("PART-HOLD-BACK",0),u.holdBack=_.optionalFloat("HOLD-BACK",0);break;case"PART-INF":{u.partTarget&&Jn(u,e,d);const t=new hn(s);u.partTarget=t.decimalFloatingPoint("PART-TARGET");break}case"PART":{let e=u.partList;e||(e=u.partList=[]);const t=v>0?e[e.length-1]:void 0,n=v++,i=new hn(s,u),r=new Y(i,S,l,n,t);e.push(r),S.duration+=r.duration;break}case"PRELOAD-HINT":{const e=new hn(s,u);u.preloadHint=e;break}case"RENDITION-REPORT":{const e=new hn(s,u);u.renditionReports=u.renditionReports||[],u.renditionReports.push(e);break}default:R.warn(`line parsed but not handled: ${d}`)}}}k&&!k.relurl?(c.pop(),b-=k.duration,u.partList&&(u.fragmentHint=k)):u.partList&&(Yn(S,k,h),S.cc=E,u.fragmentHint=S,p&&Qn(S,p,u)),u.targetduration||(u.playlistParsingError=new Error("Missing Target Duration"));const L=c.length,x=c[0],I=c[L-1];if(b+=u.skippedSegments*u.targetduration,b>0&&L&&I){u.averagetargetduration=b/L;const e=I.sn;u.endSN="initSegment"!==e?e:0,u.live||(I.endList=!0),T>0&&(!function(e,t){let n=e[t];for(let i=t;i--;){const t=e[i];if(!t)return;t.programDateTime=n.programDateTime-1e3*t.duration,n=t}}(c,T),x&&h.unshift(x))}return u.fragmentHint&&(b+=u.fragmentHint.duration),u.totalduration=b,h.length&&u.dateRangeTagCount&&x&&Vn(h,u),u.endCC=E,u}}function Vn(e,t){let n=e.length;if(!n){if(!t.hasProgramDateTime)return;{const i=t.fragments[t.fragments.length-1];e.push(i),n++}}const i=e[n-1],r=t.live?1/0:t.totalduration,s=Object.keys(t.dateRanges);for(let o=s.length;o--;){const l=t.dateRanges[s[o]],u=l.startDate.getTime();l.tagAnchor=i.ref;for(let i=n;i--;){var a;if((null==(a=e[i])?void 0:a.sn)<t.startSN)break;const n=Zn(t,u,e,i,r);if(-1!==n){l.tagAnchor=t.fragments[n].ref;break}}}}function Zn(e,t,n,i,r){const s=n[i];if(s){const o=s.programDateTime;if(t>=o||0===i){var a;if(t<=o+1e3*(((null==(a=n[i+1])?void 0:a.start)||r)-s.start)){const r=n[i].sn-e.startSN;if(r<0)return-1;const s=e.fragments;if(s.length>n.length){for(let a=(n[i+1]||s[s.length-1]).sn-e.startSN;a>r;a--){const e=s[a].programDateTime;if(t>=e&&t<e+1e3*s[a].duration)return a}}return r}}}return-1}function Hn(e,t,n){var i,r;const s=new hn(e,n),a=null!=(i=s.METHOD)?i:"",o=s.URI,l=s.hexadecimalInteger("IV"),u=s.KEYFORMATVERSIONS,c=null!=(r=s.KEYFORMAT)?r:"identity";o&&s.IV&&!l&&R.error(`Invalid IV: ${s.IV}`);const h=o?jn.resolve(o,t):"",d=(u||"1").split("/").map(Number).filter(Number.isFinite);return new Nn(a,h,c,d,l,s.KEYID)}function zn(e){const t=new hn(e).decimalFloatingPoint("TIME-OFFSET");return i(t)?t:null}function Wn(e,t){let n=(e||"").split(/[ ,]+/).filter((e=>e));["video","audio","text"].forEach((e=>{const i=n.filter((t=>Ae(t,e)));i.length&&(t[`${e}Codec`]=i.map((e=>e.split("/")[0])).join(","),n=n.filter((e=>-1===i.indexOf(e))))})),t.unknownCodecs=n}function qn(e,t,n){const i=t[n];i&&(e[n]=i)}function Yn(e,t,n){e.rawProgramDateTime?n.push(e):null!=t&&t.programDateTime&&(e.programDateTime=t.endProgramDateTime)}function Xn(e,t,n,i){e.relurl=t.URI,t.BYTERANGE&&e.setByteRange(t.BYTERANGE),e.level=n,e.sn="initSegment",i&&(e.levelkeys=i),e.initSegment=null}function Qn(e,t,n){e.levelkeys=t;const{encryptedFragments:i}=n;i.length&&i[i.length-1].levelkeys===t||!Object.keys(t).some((e=>t[e].isCommonEncryption))||i.push(e)}function Jn(e,t,n){e.playlistParsingError=new Error(`#EXT-X-${t} must not appear more than once (${n[0]})`)}function ei(e,t,n){e.playlistParsingError=new Error(`#EXT-X-${t} must appear before the first Media Segment (${n[0]})`)}function ti(e,t){const n=t.startPTS;if(i(n)){let i,r=0;t.sn>e.sn?(r=n-e.start,i=e):(r=e.start-n,i=t),i.duration!==r&&i.setDuration(r)}else if(t.sn>e.sn){e.cc===t.cc&&e.minEndPTS?t.setStart(e.start+(e.minEndPTS-e.start)):t.setStart(e.start+e.duration)}else t.setStart(Math.max(e.start-t.duration,0))}function ni(e,t,n,r,s,a,o){r-n<=0&&(o.warn("Fragment should have a positive duration",t),r=n+t.duration,a=s+t.duration);let l=n,u=r;const c=t.startPTS,h=t.endPTS;if(i(c)){const d=Math.abs(c-n);e&&d>e.totalduration?o.warn(`media timestamps and playlist times differ by ${d}s for level ${t.level} ${e.url}`):i(t.deltaPTS)?t.deltaPTS=Math.max(d,t.deltaPTS):t.deltaPTS=d,l=Math.max(n,c),n=Math.min(n,c),s=void 0!==t.startDTS?Math.min(s,t.startDTS):s,u=Math.min(r,h),r=Math.max(r,h),a=void 0!==t.endDTS?Math.max(a,t.endDTS):a}const d=n-t.start;0!==t.start&&t.setStart(n),t.setDuration(r-t.start),t.startPTS=n,t.maxStartPTS=l,t.startDTS=s,t.endPTS=r,t.minEndPTS=u,t.endDTS=a;const f=t.sn;if(!e||f<e.startSN||f>e.endSN)return 0;let p;const _=f-e.startSN,g=e.fragments;for(g[_]=t,p=_;p>0;p--)ti(g[p],g[p-1]);for(p=_;p<g.length-1;p++)ti(g[p],g[p+1]);return e.fragmentHint&&ti(g[g.length-1],e.fragmentHint),e.PTSKnown=e.alignedSliding=!0,d}function ii(e,t,n){if(e===t)return;let r=null;const s=e.fragments;for(let e=s.length-1;e>=0;e--){const t=s[e].initSegment;if(t){r=t;break}}let a;e.fragmentHint&&delete e.fragmentHint.endPTS,function(e,t,n){const i=t.skippedSegments,r=Math.max(e.startSN,t.startSN)-t.startSN,s=(e.fragmentHint?1:0)+(i?t.endSN:Math.min(e.endSN,t.endSN))-t.startSN,a=t.startSN-e.startSN,o=t.fragmentHint?t.fragments.concat(t.fragmentHint):t.fragments,l=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments;for(let u=r;u<=s;u++){const r=l[a+u];let s=o[u];if(i&&!s&&r&&(s=t.fragments[u]=r),r&&s){n(r,s,u,o);const i=r.relurl,a=s.relurl;if(i&&di(i,a))return void(t.playlistParsingError=ri(`media sequence mismatch ${s.sn}:`,e,t,r,s));if(r.cc!==s.cc)return void(t.playlistParsingError=ri(`discontinuity sequence mismatch (${r.cc}!=${s.cc})`,e,t,r,s))}}}(e,t,((e,n,s,o)=>{if((!t.startCC||t.skippedSegments)&&n.cc!==e.cc){const i=e.cc-n.cc;for(let e=s;e<o.length;e++)o[e].cc+=i;t.endCC=o[o.length-1].cc}i(e.startPTS)&&i(e.endPTS)&&(n.setStart(n.startPTS=e.startPTS),n.startDTS=e.startDTS,n.maxStartPTS=e.maxStartPTS,n.endPTS=e.endPTS,n.endDTS=e.endDTS,n.minEndPTS=e.minEndPTS,n.setDuration(e.endPTS-e.startPTS),n.duration&&(a=n),t.PTSKnown=t.alignedSliding=!0),e.hasStreams&&(n.elementaryStreams=e.elementaryStreams),n.loader=e.loader,e.hasStats&&(n.stats=e.stats),e.initSegment&&(n.initSegment=e.initSegment,r=e.initSegment)}));const o=t.fragments,l=t.fragmentHint?o.concat(t.fragmentHint):o;if(r&&l.forEach((e=>{var t;!e||e.initSegment&&e.initSegment.relurl!==(null==(t=r)?void 0:t.relurl)||(e.initSegment=r)})),t.skippedSegments){if(t.deltaUpdateFailed=o.some((e=>!e)),t.deltaUpdateFailed){n.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let e=t.skippedSegments;e--;)o.shift();t.startSN=o[0].sn}else{t.canSkipDateRanges&&(t.dateRanges=function(e,t,n){const{dateRanges:i,recentlyRemovedDateranges:r}=t,s=y({},e);r&&r.forEach((e=>{delete s[e]}));const a=Object.keys(s).length;if(!a)return i;return Object.keys(i).forEach((e=>{const t=s[e],r=new fn(i[e].attr,t);r.isValid?(s[e]=r,t||(r.tagOrder+=a)):n.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${it(i[e].attr)}"`)})),s}(e.dateRanges,t,n));const i=e.fragments.filter((e=>e.rawProgramDateTime));if(e.hasProgramDateTime&&!t.hasProgramDateTime)for(let e=1;e<l.length;e++)null===l[e].programDateTime&&Yn(l[e],l[e-1],i);Vn(i,t)}t.endCC=o[o.length-1].cc}if(!t.startCC){var u;const n=li(e,t.startSN-1);t.startCC=null!=(u=null==n?void 0:n.cc)?u:o[0].cc}!function(e,t,n){if(e&&t){let i=0;for(let r=0,s=e.length;r<=s;r++){const s=e[r],a=t[r+i];s&&a&&s.index===a.index&&s.fragment.sn===a.fragment.sn?n(s,a):i--}}}(e.partList,t.partList,((e,t)=>{t.elementaryStreams=e.elementaryStreams,t.stats=e.stats})),a?ni(t,a,a.startPTS,a.endPTS,a.startDTS,a.endDTS,n):si(e,t),o.length&&(t.totalduration=t.edge-o[0].start),t.driftStartTime=e.driftStartTime,t.driftStart=e.driftStart;const c=t.advancedDateTime;if(t.advanced&&c){const e=t.edge;t.driftStart||(t.driftStartTime=c,t.driftStart=e),t.driftEndTime=c,t.driftEnd=e}else t.driftEndTime=e.driftEndTime,t.driftEnd=e.driftEnd,t.advancedDateTime=e.advancedDateTime;-1===t.requestScheduled&&(t.requestScheduled=e.requestScheduled)}function ri(e,t,n,i,r){return new Error(`${e} ${r.url}\nPlaylist starting @${t.startSN}\n${t.m3u8}\n\nPlaylist starting @${n.startSN}\n${n.m3u8}`)}function si(e,t,n=!0){const i=t.startSN+t.skippedSegments-e.startSN,r=e.fragments,s=i>=0;let a=0;if(s&&i<r.length)a=r[i].start;else if(s&&t.startSN===e.endSN+1)a=e.fragmentEnd;else if(s&&n)a=e.fragmentStart+i*t.levelTargetDuration;else{if(t.skippedSegments||0!==t.fragmentStart)return;a=e.fragmentStart}ai(t,a)}function ai(e,t){if(t){const n=e.fragments;for(let i=e.skippedSegments;i<n.length;i++)n[i].addStart(t);e.fragmentHint&&e.fragmentHint.addStart(t)}}function oi(e,t=1/0){let n=1e3*e.targetduration;if(e.updated){const i=e.fragments,r=4;if(i.length&&n*r>t){const e=1e3*i[i.length-1].duration;e<n&&(n=e)}}else n/=2;return Math.round(n)}function li(e,t,n){if(!e)return null;let i=e.fragments[t-e.startSN];return i||(i=e.fragmentHint,i&&i.sn===t?i:t<e.startSN&&n&&n.sn===t?n:null)}function ui(e,t,n){return e?ci(e.partList,t,n):null}function ci(e,t,n){if(e)for(let i=e.length;i--;){const r=e[i];if(r.index===n&&r.fragment.sn===t)return r}return null}function hi(e){e.forEach(((e,t)=>{var n;null==(n=e.details)||n.fragments.forEach((e=>{e.level=t,e.initSegment&&(e.initSegment.level=t)}))}))}function di(e,t){return!(e===t||!t)&&fi(e)!==fi(t)}function fi(e){return e.replace(/\?[^?]*$/,"")}function pi(e,t){for(let i=0,r=e.length;i<r;i++){var n;if((null==(n=e[i])?void 0:n.cc)===t)return e[i]}return null}function _i(e,t){const n=e.start+t;e.startPTS=n,e.setStart(n),e.endPTS=n+e.duration}function gi(e,t){const n=t.fragments;for(let t=0,i=n.length;t<i;t++)_i(n[t],e);t.fragmentHint&&_i(t.fragmentHint,e),t.alignedSliding=!0}function mi(e,t){if(!function(e,t){return!!(e&&t.startCC<e.endCC&&t.endCC>e.startCC)}(t,e))return;const n=Math.min(t.endCC,e.endCC),i=pi(t.fragments,n),r=pi(e.fragments,n);if(!i||!r)return;R.log(`Aligning playlist at start of dicontinuity sequence ${n}`);gi(i.start-r.start,e)}function vi(e,t){if(!e.hasProgramDateTime||!t.hasProgramDateTime)return;const n=e.fragments,i=t.fragments;if(!n.length||!i.length)return;let r,s;const a=Math.min(t.endCC,e.endCC);t.startCC<a&&e.startCC<a&&(r=pi(i,a),s=pi(n,a)),r&&s||(r=i[Math.floor(i.length/2)],s=pi(n,r.cc)||n[Math.floor(n.length/2)]);const o=r.programDateTime,l=s.programDateTime;if(!o||!l)return;gi((l-o)/1e3-(s.start-r.start),e)}function yi(e,t,n){bi(e,t,n),e.addEventListener(t,n)}function bi(e,t,n){e.removeEventListener(t,n)}const Ei=function(e){let t="";const n=e.length;for(let i=0;i<n;i++)t+=`[${e.start(i).toFixed(3)}-${e.end(i).toFixed(3)}]`;return t},wi="STOPPED",ki="IDLE",Si="KEY_LOADING",Ti="FRAG_LOADING",Ai="FRAG_LOADING_WAITING_RETRY",Ci="WAITING_TRACK",Ri="PARSING",Li="PARSED",xi="ENDED",Ii="ERROR",Di="WAITING_INIT_PTS",Pi="WAITING_LEVEL";class Oi extends Jt{constructor(e,t,n,r,s){super(r,e.logger),this.hls=void 0,this.fragPrevious=null,this.fragCurrent=null,this.fragmentTracker=void 0,this.transmuxer=null,this._state=wi,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:e,fragCurrent:t,media:n,mediaBuffer:r,state:s}=this,a=n?n.currentTime:0,o=nn.bufferInfo(r||n,a,e.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===xi)this.resetLoadingState();else if(t){const n=e.maxFragLookUpTolerance,i=t.start-n,r=t.start+t.duration+n;if(l||r<o.start||i>o.end){const e=a>r;(a<i||e)&&(e&&t.loader&&(this.log(`Cancelling fragment load for seek (sn: ${t.sn})`),t.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 e=Math.max(o.end,a),t=this.shouldLoadParts(this.getLevelDetails(),e);t&&(this.log(`LL-Part loading ON after seeking to ${a.toFixed(2)} with buffer @${e.toFixed(2)}`),this.loadingParts=t)}}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===ki&&this.tickImmediate()},this.onMediaEnded=()=>{this.log("setting startPosition to 0 because media ended"),this.startPosition=this.lastCurrentTime=0},this.playlistType=s,this.hls=e,this.fragmentLoader=new qt(e.config),this.keyLoader=n,this.fragmentTracker=t,this.config=e.config,this.decrypter=new zt(e.config)}registerListeners(){const{hls:e}=this;e.on(l.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(l.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(l.MANIFEST_LOADING,this.onManifestLoading,this),e.on(l.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(l.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(l.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(l.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(l.MANIFEST_LOADING,this.onManifestLoading,this),e.off(l.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(l.ERROR,this.onError,this)}doTick(){this.onTickEnd()}onTickEnd(){}startLoad(e){}stopLoad(){if(this.state===wi)return;this.fragmentLoader.abort(),this.keyLoader.abort(this.playlistType);const e=this.fragCurrent;null!=e&&e.loader&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=wi}get startPositionValue(){const{nextLoadPosition:e,startPosition:t}=this;return-1===t&&e?e:t}get bufferingEnabled(){return this.buffering}pauseBuffering(){this.buffering=!1}resumeBuffering(){this.buffering=!0}get inFlightFrag(){return{frag:this.fragCurrent,state:this.state}}_streamEnded(e,t){if(t.live||!this.media)return!1;const n=e.end||0,i=this.config.timelineOffset||0;if(n<=i)return!1;const r=e.buffered;this.config.maxBufferHole&&r&&r.length>1&&(e=nn.bufferedInfo(r,e.start,0));const s=e.nextStart;if(s&&s>i&&s<t.edge)return!1;if(this.media.currentTime<e.start)return!1;const a=t.partList;if(null!=a&&a.length){const e=a[a.length-1];return nn.isBuffered(this.media,e.start+e.duration/2)}const o=t.fragments[t.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(o)}getLevelDetails(){if(this.levels&&null!==this.levelLastLoaded)return this.levelLastLoaded.details}get timelineOffset(){const e=this.config.timelineOffset;var t;return e?(null==(t=this.getLevelDetails())?void 0:t.appliedTimelineOffset)||e:0}onMediaAttached(e,t){const n=this.media=this.mediaBuffer=t.media;yi(n,"seeking",this.onMediaSeeking),yi(n,"ended",this.onMediaEnded);const i=this.config;this.levels&&i.autoStartLoad&&this.state===wi&&this.startLoad(i.startPosition)}onMediaDetaching(e,t){const n=!!t.transferMedia,i=this.media;if(null!==i){if(i.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),bi(i,"seeking",this.onMediaSeeking),bi(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(e,t){}onManifestLoaded(e,t){this.startTimeOffset=t.startTimeOffset}onHandlerDestroying(){this.stopLoad(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),super.onHandlerDestroying(),this.hls=this.onMediaSeeking=this.onMediaEnded=null}onHandlerDestroyed(){this.state=wi,this.fragmentLoader&&this.fragmentLoader.destroy(),this.keyLoader&&this.keyLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.keyLoader=this.fragmentLoader=this.fragmentTracker=null,super.onHandlerDestroyed()}loadFragment(e,t,n){this.startFragRequested=!0,this._loadFragForPlayback(e,t,n)}_loadFragForPlayback(e,t,n){this._doFragLoad(e,t,n,(e=>{const t=e.frag;if(this.fragContextChanged(t))return this.warn(`${t.type} sn: ${t.sn}${e.part?" part: "+e.part.index:""} of ${this.fragInfo(t,!1,e.part)}) was dropped during download.`),void this.fragmentTracker.removeFragment(t);t.stats.chunkCount++,this._handleFragmentLoadProgress(e)})).then((e=>{if(!e)return;const t=this.state,n=e.frag;this.fragContextChanged(n)?(t===Ti||!this.fragCurrent&&t===Ri)&&(this.fragmentTracker.removeFragment(n),this.state=ki):("payload"in e&&(this.log(`Loaded ${n.type} sn: ${n.sn} of ${this.playlistLabel()} ${n.level}`),this.hls.trigger(l.FRAG_LOADED,e)),this._handleFragmentLoadComplete(e))})).catch((t=>{this.state!==wi&&this.state!==Ii&&(this.warn(`Frag error: ${(null==t?void 0:t.message)||t}`),this.resetFragmentLoading(e))}))}clearTrackerIfNeeded(e){var t;const{fragmentTracker:n}=this;if(n.getState(e)===Mt){const t=e.type,i=this.getFwdBufferInfo(this.mediaBuffer,t),r=Math.max(e.duration,i?i.len:this.config.maxBufferLength),s=this.backtrackFragment;(1===(s?e.sn-s.sn:0)||this.reduceMaxBufferLength(r,e.duration))&&n.removeFragment(e)}else 0===(null==(t=this.mediaBuffer)?void 0:t.buffered.length)?n.removeAllFragments():n.hasParts(e.type)&&(n.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type}),n.getState(e)===Nt&&n.removeFragment(e))}checkLiveUpdate(e){if(e.updated&&!e.live){const t=e.fragments[e.fragments.length-1];this.fragmentTracker.detectPartialFragments({frag:t,part:null,stats:t.stats,id:t.type})}e.fragments[0]||(e.deltaUpdateFailed=!0)}waitForLive(e){const t=e.details;return(null==t?void 0:t.live)&&"EVENT"!==t.type&&(this.levelLastLoaded!==e||t.expired)}flushMainBuffer(e,t,n=null){if(!(e-t))return;const i={startOffset:e,endOffset:t,type:n};this.hls.trigger(l.BUFFER_FLUSHING,i)}_loadInitSegment(e,t){this._doFragLoad(e,t).then((e=>{const t=null==e?void 0:e.frag;if(!t||this.fragContextChanged(t)||!this.levels)throw new Error("init load aborted");return e})).then((e=>{const{hls:t}=this,{frag:n,payload:i}=e,r=n.decryptdata;if(i&&i.byteLength>0&&null!=r&&r.key&&r.iv&&mn(r.method)){const s=self.performance.now();return this.decrypter.decrypt(new Uint8Array(i),r.key.buffer,r.iv.buffer,vn(r.method)).catch((e=>{throw t.trigger(l.ERROR,{type:a.MEDIA_ERROR,details:o.FRAG_DECRYPT_ERROR,fatal:!1,error:e,reason:e.message,frag:n}),e})).then((i=>{const r=self.performance.now();return t.trigger(l.FRAG_DECRYPTED,{frag:n,payload:i,stats:{tstart:s,tdecrypt:r}}),e.payload=i,this.completeInitSegmentLoad(e)}))}return this.completeInitSegmentLoad(e)})).catch((t=>{this.state!==wi&&this.state!==Ii&&(this.warn(t),this.resetFragmentLoading(e))}))}completeInitSegmentLoad(e){const{levels:t}=this;if(!t)throw new Error("init load aborted, missing levels");const n=e.frag.stats;this.state!==wi&&(this.state=ki),e.frag.data=new Uint8Array(e.payload),n.parsing.start=n.buffering.start=self.performance.now(),n.parsing.end=n.buffering.end=self.performance.now(),this.tick()}unhandledEncryptionError(e,t){var n,i;const r=e.tracks;if(r&&!t.encrypted&&(null!=(n=r.audio)&&n.encrypted||null!=(i=r.video)&&i.encrypted)&&(!this.config.emeEnabled||!this.keyLoader.emeController)){const e=this.media,n=new Error(`Encrypted track with no key in ${this.fragInfo(t)} (media ${e?"attached mediaKeys: "+e.mediaKeys:"detached"})`);return this.warn(n.message),!e||e.mediaKeys?!1:(this.hls.trigger(l.ERROR,{type:a.KEY_SYSTEM_ERROR,details:o.KEY_SYSTEM_NO_KEYS,fatal:!1,error:n,frag:t}),this.resetTransmuxer(),!0)}return!1}fragContextChanged(e){const{fragCurrent:t}=this;return!e||!t||e.sn!==t.sn||e.level!==t.level}fragBufferedComplete(e,t){const n=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log(`Buffered ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.fragInfo(e,!1,t)} > buffer:${n?Ei(nn.getBuffered(n)):"(detached)"})`),W(e)){var i;if(e.type!==_){const t=e.elementaryStreams;if(!Object.keys(t).some((e=>!!t[e])))return void(this.state=ki)}const t=null==(i=this.levels)?void 0:i[e.level];null!=t&&t.fragmentError&&(this.log(`Resetting level fragment error count of ${t.fragmentError} on frag buffered`),t.fragmentError=0)}this.state=ki}_handleFragmentLoadComplete(e){const{transmuxer:t}=this;if(!t)return;const{frag:n,part:i,partsLoaded:r}=e,s=!r||0===r.length||r.some((e=>!e)),a=new en(n.level,n.sn,n.stats.chunkCount+1,0,i?i.index:-1,!s);t.flush(a)}_handleFragmentLoadProgress(e){}_doFragLoad(e,t,n=null,r){var s;this.fragCurrent=e;const a=t.details;if(!this.levels||!a)throw new Error(`frag load aborted, missing level${a?"":" detail"}s`);let o=null;if(!e.encrypted||null!=(s=e.decryptdata)&&s.key)e.encrypted||(o=this.keyLoader.loadClear(e,a.encryptedFragments,this.startFragRequested),o&&this.log("[eme] blocking frag load until media-keys acquired"));else if(this.log(`Loading key for ${e.sn} of [${a.startSN}-${a.endSN}], ${this.playlistLabel()} ${e.level}`),this.state=Si,this.fragCurrent=e,o=this.keyLoader.load(e).then((e=>{if(!this.fragContextChanged(e.frag))return this.hls.trigger(l.KEY_LOADED,e),this.state===Si&&(this.state=ki),e})),this.hls.trigger(l.KEY_LOADING,{frag:e}),null===this.fragCurrent)return this.log("context changed in KEY_LOADING"),Promise.resolve(null);const u=this.fragPrevious;if(W(e)&&(!u||e.sn!==u.sn)){const n=this.shouldLoadParts(t.details,e.end);n!==this.loadingParts&&(this.log(`LL-Part loading ${n?"ON":"OFF"} loading sn ${null==u?void 0:u.sn}->${e.sn}`),this.loadingParts=n)}if(n=Math.max(e.start,n||0),this.loadingParts&&W(e)){const i=a.partList;if(i&&r){n>a.fragmentEnd&&a.fragmentHint&&(e=a.fragmentHint);const s=this.getNextPart(i,e,n);if(s>-1){const u=i[s];let c;return e=this.fragCurrent=u.fragment,this.log(`Loading ${e.type} sn: ${e.sn} part: ${u.index} (${s}/${i.length-1}) of ${this.fragInfo(e,!1,u)}) cc: ${e.cc} [${a.startSN}-${a.endSN}], target: ${parseFloat(n.toFixed(3))}`),this.nextLoadPosition=u.start+u.duration,this.state=Ti,c=o?o.then((n=>!n||this.fragContextChanged(n.frag)?null:this.doFragPartsLoad(e,u,t,r))).catch((e=>this.handleFragLoadError(e))):this.doFragPartsLoad(e,u,t,r).catch((e=>this.handleFragLoadError(e))),this.hls.trigger(l.FRAG_LOADING,{frag:e,part:u,targetBufferTime:n}),null===this.fragCurrent?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):c}if(!e.url||this.loadedEndOfParts(i,n))return Promise.resolve(null)}}var c;if(W(e)&&this.loadingParts)this.log(`LL-Part loading OFF after next part miss @${n.toFixed(2)} Check buffer at sn: ${e.sn} loaded parts: ${null==(c=a.partList)?void 0:c.filter((e=>e.loaded)).map((e=>`[${e.start}-${e.end}]`))}`),this.loadingParts=!1;else if(!e.url)return Promise.resolve(null);this.log(`Loading ${e.type} sn: ${e.sn} of ${this.fragInfo(e,!1)}) cc: ${e.cc} ${"["+a.startSN+"-"+a.endSN+"]"}, target: ${parseFloat(n.toFixed(3))}`),i(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=Ti;const h=this.config.progressive;let d;return d=h&&o?o.then((t=>!t||this.fragContextChanged(t.frag)?null:this.fragmentLoader.load(e,r))).catch((e=>this.handleFragLoadError(e))):Promise.all([this.fragmentLoader.load(e,h?r:void 0),o]).then((([e])=>(!h&&r&&r(e),e))).catch((e=>this.handleFragLoadError(e))),this.hls.trigger(l.FRAG_LOADING,{frag:e,targetBufferTime:n}),null===this.fragCurrent?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):d}doFragPartsLoad(e,t,n,i){return new Promise(((r,s)=>{var a;const o=[],u=null==(a=n.details)?void 0:a.partList,c=t=>{this.fragmentLoader.loadPart(e,t,i).then((i=>{o[t.index]=i;const s=i.part;this.hls.trigger(l.FRAG_LOADED,i);const a=ui(n.details,e.sn,t.index+1)||ci(u,e.sn,t.index+1);if(!a)return r({frag:e,part:s,partsLoaded:o});c(a)})).catch(s)};c(t)}))}handleFragLoadError(e){if("data"in e){const t=e.data;t.frag&&t.details===o.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):t.frag&&t.type===a.KEY_SYSTEM_ERROR?(t.frag.abortRequests(),this.resetStartWhenNotLoaded(),this.resetFragmentLoading(t.frag)):this.hls.trigger(l.ERROR,t)}else this.hls.trigger(l.ERROR,{type:a.OTHER_ERROR,details:o.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){const t=this.getCurrentContext(e);if(!t||this.state!==Ri)return void(this.fragCurrent||this.state===wi||this.state===Ii||(this.state=ki));const{frag:n,part:i,level:r}=t,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,e.partial)}shouldLoadParts(e,t){if(this.config.lowLatencyMode){if(!e)return this.loadingParts;if(e.partList){var n;const r=e.partList[0];if(r.fragment.type===_)return!1;if(t>=r.end+((null==(n=e.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(e){const{levels:t,fragCurrent:n}=this,{level:i,sn:r,part:s}=e;if(null==t||!t[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=t[i],o=a.details,l=s>-1?ui(o,r,s):null,u=l?l.fragment:li(o,r,n);return u?(n&&n!==u&&(u.stats=n.stats),{frag:u,part:l,level:a}):null}bufferFragmentData(e,t,n,i,r){if(this.state!==Ri)return;const{data1:s,data2:a}=e;let o=s;if(a&&(o=ge(s,a)),!o.length)return;const u=this.initPTS[t.cc],c=u?-u.baseTime/u.timescale:void 0,h={type:e.type,frag:t,part:n,chunkMeta:i,offset:c,parent:t.type,data:o};if(this.hls.trigger(l.BUFFER_APPENDING,h),e.dropped&&e.independent&&!n){if(r)return;this.flushBufferGap(t)}}flushBufferGap(e){const t=this.media;if(!t)return;if(!nn.isBuffered(t,t.currentTime))return void this.flushMainBuffer(0,e.start);const n=t.currentTime,i=nn.bufferInfo(t,n,0),r=e.duration,s=Math.min(2*this.config.maxFragLookUpTolerance,.25*r),a=Math.max(Math.min(e.start-s,i.end-s),n+s);e.start-a>s&&this.flushMainBuffer(a,e.start)}getFwdBufferInfo(e,t){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(e,r,t,s)}getFwdBufferInfoAtPos(e,t,n,i){const r=nn.bufferInfo(e,t,i);if(0===r.len&&void 0!==r.nextStart){const s=this.fragmentTracker.getBufferedFrag(t,n);if(s&&(r.nextStart<=s.end||s.gap)){const n=Math.max(Math.min(r.nextStart,s.end)-t,i);return nn.bufferInfo(e,t,n)}}return r}getMaxBufferLength(e){const{config:t}=this;let n;return n=e?Math.max(8*t.maxBufferSize/e,t.maxBufferLength):t.maxBufferLength,Math.min(n,t.maxMaxBufferLength)}reduceMaxBufferLength(e,t){const n=this.config,i=Math.max(Math.min(e-t,n.maxBufferLength),t),r=Math.max(e-3*t,n.maxMaxBufferLength/2,i);return r>=i&&(n.maxMaxBufferLength=r,this.warn(`Reduce max buffer length to ${r}s`),!0)}getAppendedFrag(e,t=f){const n=this.fragmentTracker?this.fragmentTracker.getAppendedFrag(e,t):null;return n&&"fragment"in n?n.fragment:n}getNextFragment(e,t){const n=t.fragments,i=n.length;if(!i)return null;const{config:r}=this,s=n[0].start,a=r.lowLatencyMode&&!!t.partList;let o=null;if(t.live){const n=r.initialLiveManifestSize;if(i<n)return this.warn(`Not enough fragments to start playback (have: ${i}, need: ${n})`),null;if(!t.PTSKnown&&!this.startFragRequested&&-1===this.startPosition||e<s){var l;a&&!this.loadingParts&&(this.log("LL-Part loading ON for initial live fragment"),this.loadingParts=!0),o=this.getInitialLiveFragment(t);const n=this.hls.startPosition,i=this.hls.liveSyncPosition,r=o?(-1!==n&&n>=s?n:i)||o.start:e;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 e<=s&&(o=n[0]);if(!o){const n=this.loadingParts?t.partEnd:t.fragmentEnd;o=this.getFragmentAtPosition(e,n,t)}let u=this.filterReplacedPrimary(o,t);if(!u&&o){const e=o.sn-t.startSN;u=this.filterReplacedPrimary(n[e+1]||null,t)}return this.mapToInitFragWhenRequired(u)}isLoopLoading(e,t){const n=this.fragmentTracker.getState(e);return(n===Ft||n===Nt&&!!e.gap)&&this.nextLoadPosition>t}getNextFragmentLoopLoading(e,t,n,i,r){let s=null;if(e.gap&&(s=this.getNextFragment(this.nextLoadPosition,t),s&&!s.gap&&n.nextStart)){const e=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,n.nextStart,i,0);if(null!==e&&n.len+e.len>=r){const e=s.sn;return this.loopSn!==e&&(this.log(`buffer full after gaps in "${i}" playlist starting at sn: ${e}`),this.loopSn=e),null}}return this.loopSn=void 0,s}get primaryPrefetch(){if(Mi(this.config)){var e;if(null==(e=this.hls.interstitialsManager)||null==(e=e.playingItem)?void 0:e.event)return!0}return!1}filterReplacedPrimary(e,t){if(!e)return e;if(Mi(this.config)&&e.type!==_){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(e.start-i.start)>1||0===i.start)return null}else{if(e.end<=i.start&&!1===(null==t?void 0:t.live))return null;if(e.start>i.end&&i.nextEvent&&(i.nextEvent.appendInPlace||e.start-i.end>1))return null}}const r=null==n?void 0:n.playerQueue;if(r)for(let t=r.length;t--;){const n=r[t].interstitial;if(n.appendInPlace&&e.start>=n.startTime&&e.end<=n.resumeTime)return null}}return e}mapToInitFragWhenRequired(e){return null==e||!e.initSegment||e.initSegment.data||this.bitrateTest?e:e.initSegment}getNextPart(e,t,n){let i=-1,r=!1,s=!0;for(let a=0,o=e.length;a<o;a++){const o=e[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===t)&&(o.fragment!==t&&this.warn(`Need buffer at ${n} but next unloaded part starts at ${o.start}`),i=a),r=l}return i}loadedEndOfParts(e,t){let n;for(let i=e.length;i--;){if(n=e[i],!n.loaded)return!1;if(t>n.start)return!0}return!1}getInitialLiveFragment(e){const t=e.fragments,n=this.fragPrevious;let r=null;if(n){if(e.hasProgramDateTime&&(this.log(`Live playlist, switching playlist, load frag with same PDT: ${n.programDateTime}`),r=function(e,t,n){if(null===t||!Array.isArray(e)||!e.length||!i(t))return null;if(t<(e[0].programDateTime||0))return null;if(t>=(e[e.length-1].endProgramDateTime||0))return null;for(let i=0;i<e.length;++i){const r=e[i];if(_t(t,n,r))return r}return null}(t,n.endProgramDateTime,this.config.maxFragLookUpTolerance)),!r){const i=n.sn+1;if(i>=e.startSN&&i<=e.endSN){const s=t[i-e.startSN];n.cc===s.cc&&(r=s,this.log(`Live playlist, switching playlist, load frag with next SN: ${r.sn}`))}r||(r=gt(e,n.cc,n.end),r&&this.log(`Live playlist, switching playlist, load frag with same CC: ${r.sn}`))}}else{const t=this.hls.liveSyncPosition;null!==t&&(r=this.getFragmentAtPosition(t,this.bitrateTest?e.fragmentEnd:e.edge,e))}return r}getFragmentAtPosition(e,t,n){const{config:i}=this;let{fragPrevious:r}=this,{fragments:s,endSN:a}=n;const{fragmentHint:o}=n,{maxFragLookUpTolerance:l}=i,u=n.partList,c=!!(this.loadingParts&&null!=u&&u.length&&o);let h;if(c&&!this.bitrateTest&&u[u.length-1].fragment.sn===o.sn&&(s=s.concat(o),a=o.sn),e<t){var d;h=ft(r,s,e,e<this.lastCurrentTime||e>t-l||null!=(d=this.media)&&d.paused||!this.startFragRequested?0:l)}else h=s[s.length-1];if(h){const e=h.sn-n.startSN,t=this.fragmentTracker.getState(h);if((t===Ft||t===Nt&&h.gap)&&(r=h),r&&h.sn===r.sn&&(!c||u[0].fragment.sn>h.sn||!n.live)){if(h.level===r.level){const t=s[e+1];h=h.sn<a&&this.fragmentTracker.getState(t)!==Ft?t:null}}}return h}alignPlaylists(e,t,n){const r=e.fragments.length;if(!r)return this.warn("No fragments in live playlist"),0;const s=e.fragmentStart,a=!t,o=e.alignedSliding&&i(s);if(a||!o&&!s){!function(e,t){e&&(mi(t,e),t.alignedSliding||vi(t,e),t.alignedSliding||t.skippedSegments||si(e,t,!1))}(n,e);const i=e.fragmentStart;return this.log(`Live playlist sliding: ${i.toFixed(2)} start-sn: ${t?t.startSN:"na"}->${e.startSN} fragments: ${r}`),i}return s}waitForCdnTuneIn(e){return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,3*e.partTarget)}setStartPosition(e,t){let n=this.startPosition;n<t&&(n=-1);const r=this.timelineOffset;if(-1===n){const s=null!==this.startTimeOffset,a=s?this.startTimeOffset:e.startTimeOffset;null!==a&&i(a)?(n=t+a,a<0&&(n+=e.edge),n=Math.min(Math.max(t,n),t+e.totalduration),this.log(`Setting startPosition to ${n} for start time offset ${a} found in ${s?"multivariant":"media"} playlist`),this.startPosition=n):e.live?(n=this.hls.liveSyncPosition||t,this.log(`Setting startPosition to -1 to start at live edge ${n}`),this.startPosition=-1):(this.log("setting startPosition to 0 by default"),this.startPosition=n=0),this.lastCurrentTime=n+r}this.nextLoadPosition=n+r}getLoadPosition(){var e;const{media:t}=this;let n=0;return null!=(e=this.hls)&&e.hasEnoughToStart&&t?n=t.currentTime:this.nextLoadPosition>=0&&(n=this.nextLoadPosition),n}handleFragLoadAborted(e,t){this.transmuxer&&e.type===this.playlistType&&W(e)&&e.stats.aborted&&(this.log(`Fragment ${e.sn}${t?" part "+t.index:""} of ${this.playlistLabel()} ${e.level} was aborted`),this.resetFragmentLoading(e))}resetFragmentLoading(e){this.fragCurrent&&(this.fragContextChanged(e)||this.state===Ai)||(this.state=ki)}onFragmentOrKeyLoadError(e,t){var n;if(t.chunkMeta&&!t.frag){const e=this.getCurrentContext(t.chunkMeta);e&&(t.frag=e.frag)}const i=t.frag;if(!i||i.type!==e||!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=t.details===o.FRAG_GAP;s&&this.fragmentTracker.fragBuffered(i,!0);const a=t.errorAction;if(!a)return void(this.state=Ii);const{action:l,flags:u,retryCount:c=0,retryConfig:h}=a,d=!!h,f=d&&l===Rt,p=d&&!a.resolved&&u===xt,_=null==(n=this.hls.latestLevelDetails)?void 0:n.live;if(!f&&p&&W(i)&&!i.endList&&_&&!yt(t))this.resetFragmentErrors(e),this.treatAsGap(i),a.resolved=!0;else if((f||p)&&c<h.maxNumRetry){var g;const n=St(null==(g=t.response)?void 0:g.code),r=Et(h,c);if(this.resetStartWhenNotLoaded(),this.retryDate=self.performance.now()+r,this.state=Ai,a.resolved=!0,n)return this.log("Waiting for connection (offline)"),this.retryDate=1/0,void(t.reason="offline");this.warn(`Fragment ${i.sn} of ${e} ${i.level} errored with ${t.details}, retrying loading ${c+1}/${h.maxNumRetry} in ${r}ms`)}else if(h){if(this.resetFragmentErrors(e),!(c<h.maxNumRetry))return void this.warn(`${t.details} reached or exceeded max retry (${c})`);s||l===Ct||(a.resolved=!0)}else this.state=l===At?Pi:Ii;this.tickImmediate()}checkRetryDate(){const e=self.performance.now(),t=this.retryDate,n=t===1/0;(!t||e>=t||n&&!St(0))&&(n&&this.log("Connection restored (online)"),this.resetStartWhenNotLoaded(),this.state=ki)}reduceLengthAndFlushBuffer(e){if(this.state===Ri||this.state===Li){const t=e.frag,n=e.parent,i=this.getFwdBufferInfo(this.mediaBuffer,n),r=i&&i.len>.5;r&&this.reduceMaxBufferLength(i.len,(null==t?void 0:t.duration)||10);const s=!r;return s&&this.warn(`Buffer full error while media.currentTime (${this.getLoadPosition()}) is not buffered, flush ${n} buffer`),t&&(this.fragmentTracker.removeFragment(t),this.nextLoadPosition=t.start),this.resetLoadingState(),s}return!1}resetFragmentErrors(e){e===p&&(this.fragCurrent=null),this.hls.hasEnoughToStart||(this.startFragRequested=!1),this.state!==wi&&(this.state=ki)}afterBufferFlushed(e,t,n){if(!e)return;const i=nn.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,i,n),this.state===xi&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state!==wi&&(this.state=ki)}resetStartWhenNotLoaded(){if(!this.hls.hasEnoughToStart){this.startFragRequested=!1;const e=this.levelLastLoaded,t=e?e.details:null;null!=t&&t.live?(this.log("resetting startPosition for live start"),this.startPosition=-1,this.setStartPosition(t,t.fragmentStart),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}}resetWhenMissingContext(e){this.log(`Loading context changed while buffering sn ${e.sn} of ${this.playlistLabel()} ${-1===e.level?"<removed>":e.level}. This chunk will not be buffered.`),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(),this.resetLoadingState()}removeUnbufferedFrags(e=0){this.fragmentTracker.removeFragmentsInRange(e,1/0,this.playlistType,!1,!0)}updateLevelTiming(e,t,n,i){const r=n.details;if(!r)return void this.warn("level.details undefined");var s;if(!Object.keys(e.elementaryStreams).reduce(((t,s)=>{const a=e.elementaryStreams[s];if(a){const o=a.endPTS-a.startPTS;if(o<=0)return this.warn(`Could not parse fragment ${e.sn} ${s} duration reliably (${o})`),t||!1;const u=i?0:ni(r,e,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:e,start:a.startPTS,end:a.endPTS}),!0}return t}),!1)&&(0===n.fragmentError&&this.treatAsGap(e,n),null===(null==(s=this.transmuxer)?void 0:s.error))){const t=new Error(`Found no media in fragment ${e.sn} of ${this.playlistLabel()} ${e.level} resetting transmuxer to fallback to playlist timing`);if(this.warn(t.message),this.hls.trigger(l.ERROR,{type:a.MEDIA_ERROR,details:o.FRAG_PARSING_ERROR,fatal:!1,error:t,frag:e,reason:`Found no media in msn ${e.sn} of ${this.playlistLabel()} "${n.url}"`}),!this.hls)return;this.resetTransmuxer()}this.state=Li,this.log(`Parsed ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.fragInfo(e,!1,t)})`),this.hls.trigger(l.FRAG_PARSED,{frag:e,part:t})}playlistLabel(){return this.playlistType===f?"level":"track"}fragInfo(e,t=!0,n){var i,r;return`${this.playlistLabel()} ${e.level} (${n?"part":"frag"}:[${(null!=(i=t&&!n?e.startPTS:(n||e).start)?i:NaN).toFixed(3)}-${(null!=(r=t&&!n?e.endPTS:(n||e).end)?r:NaN).toFixed(3)}]${n&&"main"===e.type?"INDEPENDENT="+(n.independent?"YES":"NO"):""}`}treatAsGap(e,t){t&&t.fragmentError++,e.gap=!0,this.fragmentTracker.removeFragment(e),this.fragmentTracker.fragBuffered(e,!0)}resetTransmuxer(){var e;null==(e=this.transmuxer)||e.reset()}recoverWorkerError(e){"demuxerWorker"===e.event&&(this.fragmentTracker.removeAllFragments(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),this.resetStartWhenNotLoaded(),this.resetLoadingState())}set state(e){const t=this._state;t!==e&&(this._state=e,this.log(`${t}->${e}`))}get state(){return this._state}}function Mi(e){return!!e.interstitialsController&&!1!==e.enableInterstitialPlayback}class Ni{constructor(){this.chunks=[],this.dataLength=0}push(e){this.chunks.push(e),this.dataLength+=e.length}flush(){const{chunks:e,dataLength:t}=this;let n;return e.length?(n=1===e.length?e[0]:function(e,t){const n=new Uint8Array(t);let i=0;for(let t=0;t<e.length;t++){const r=e[t];n.set(r,i),i+=r.length}return n}(e,t),this.reset(),n):new Uint8Array(0)}reset(){this.chunks.length=0,this.dataLength=0}}var Fi,Bi={exports:{}};var Ui=(Fi||(Fi=1,function(e){var t=Object.prototype.hasOwnProperty,n="~";function i(){}function r(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function s(e,t,i,s,a){if("function"!=typeof i)throw new TypeError("The listener must be a function");var o=new r(i,s||e,a),l=n?n+t:t;return e._events[l]?e._events[l].fn?e._events[l]=[e._events[l],o]:e._events[l].push(o):(e._events[l]=o,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new i:delete e._events[t]}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 e,i,r=[];if(0===this._eventsCount)return r;for(i in e=this._events)t.call(e,i)&&r.push(n?i.slice(1):i);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(e)):r},o.prototype.listeners=function(e){var t=n?n+e:e,i=this._events[t];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(e){var t=n?n+e:e,i=this._events[t];return i?i.fn?1:i.length:0},o.prototype.emit=function(e,t,i,r,s,a){var o=n?n+e:e;if(!this._events[o])return!1;var l,u,c=this._events[o],h=arguments.length;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),h){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,i),!0;case 4:return c.fn.call(c.context,t,i,r),!0;case 5:return c.fn.call(c.context,t,i,r,s),!0;case 6:return c.fn.call(c.context,t,i,r,s,a),!0}for(u=1,l=new Array(h-1);u<h;u++)l[u-1]=arguments[u];c.fn.apply(c.context,l)}else{var d,f=c.length;for(u=0;u<f;u++)switch(c[u].once&&this.removeListener(e,c[u].fn,void 0,!0),h){case 1:c[u].fn.call(c[u].context);break;case 2:c[u].fn.call(c[u].context,t);break;case 3:c[u].fn.call(c[u].context,t,i);break;case 4:c[u].fn.call(c[u].context,t,i,r);break;default:if(!l)for(d=1,l=new Array(h-1);d<h;d++)l[d-1]=arguments[d];c[u].fn.apply(c[u].context,l)}}return!0},o.prototype.on=function(e,t,n){return s(this,e,t,n,!1)},o.prototype.once=function(e,t,n){return s(this,e,t,n,!0)},o.prototype.removeListener=function(e,t,i,r){var s=n?n+e:e;if(!this._events[s])return this;if(!t)return a(this,s),this;var o=this._events[s];if(o.fn)o.fn!==t||r&&!o.once||i&&o.context!==i||a(this,s);else{for(var l=0,u=[],c=o.length;l<c;l++)(o[l].fn!==t||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(e){var t;return e?(t=n?n+e:e,this._events[t]&&a(this,t)):(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,e.exports=o}(Bi)),Bi.exports),Ki=O(Ui);const $i="1.6.13",Gi={};function ji(e,t){return t+10<=e.length&&51===e[t]&&68===e[t+1]&&73===e[t+2]&&e[t+3]<255&&e[t+4]<255&&e[t+6]<128&&e[t+7]<128&&e[t+8]<128&&e[t+9]<128}function Vi(e,t){return t+10<=e.length&&73===e[t]&&68===e[t+1]&&51===e[t+2]&&e[t+3]<255&&e[t+4]<255&&e[t+6]<128&&e[t+7]<128&&e[t+8]<128&&e[t+9]<128}function Zi(e,t){let n=0;return n=(127&e[t])<<21,n|=(127&e[t+1])<<14,n|=(127&e[t+2])<<7,n|=127&e[t+3],n}function Hi(e,t){const n=t;let i=0;for(;Vi(e,t);){i+=10;i+=Zi(e,t+6),ji(e,t+10)&&(i+=10),t+=i}if(i>0)return e.subarray(n,n+i)}function zi(e,t){return 255===e[t]&&240==(246&e[t+1])}function Wi(e,t){return 1&e[t+1]?7:9}function qi(e,t){return(3&e[t+3])<<11|e[t+4]<<3|(224&e[t+5])>>>5}function Yi(e,t){return t+1<e.length&&zi(e,t)}function Xi(e,t){if(Yi(e,t)){const n=Wi(e,t);if(t+n>=e.length)return!1;const i=qi(e,t);if(i<=n)return!1;const r=t+i;return r===e.length||Yi(e,r)}return!1}function Qi(e,t,n,i,r){if(!e.samplerate){const s=function(e,t,n,i){const r=t[n+2],s=r>>2&15;if(s>12){const t=new Error(`invalid ADTS sampling index:${s}`);return void e.emit(l.ERROR,l.ERROR,{type:a.MEDIA_ERROR,details:o.FRAG_PARSING_ERROR,fatal:!0,error:t,reason:t.message})}const u=1+(r>>6&3),c=t[n+3]>>6&3|(1&r)<<2,h="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|c<<3];return R.log(`manifest codec:${i}, parsed codec:${h}, channels:${c}, rate:${d} (ADTS object type:${u} sampling index:${s})`),{config:p,samplerate:d,channelCount:c,codec:h,parsedCodec:h,manifestCodec:i}}(t,n,i,r);if(!s)return;y(e,s)}}function Ji(e){return 9216e4/e}function er(e,t,n,i,r){const s=i+r*Ji(e.samplerate),a=function(e,t){const n=Wi(e,t);if(t+n<=e.length){const i=qi(e,t)-n;if(i>0)return{headerLength:n,frameLength:i}}}(t,n);let o;if(a){const{frameLength:i,headerLength:r}=a,l=r+i,u=Math.max(0,n+l-t.length);u?(o=new Uint8Array(l-r),o.set(t.subarray(n+r,t.length),0)):o=t.subarray(n+r,n+l);const c={unit:o,pts:s};return u||e.samples.push(c),{sample:c,length:l,missing:u}}const l=t.length-n;o=new Uint8Array(l),o.set(t.subarray(n,t.length),0);return{sample:{unit:o,pts:s},length:l,missing:-1}}function tr(e,t){return Vi(e,t)&&Zi(e,t+6)+10<=e.length-t}function nr(e,t=0,n=1/0){return function(e,t,n,i){const r=function(e){return e instanceof ArrayBuffer?e:e.buffer}(e);let s=1;"BYTES_PER_ELEMENT"in i&&(s=i.BYTES_PER_ELEMENT);const a=(h=e,h&&h.buffer instanceof ArrayBuffer&&void 0!==h.byteLength&&void 0!==h.byteOffset?e.byteOffset:0),o=(a+e.byteLength)/s,l=(a+t)/s,u=Math.floor(Math.max(0,Math.min(l,o))),c=Math.floor(Math.min(u+Math.max(n,0),o));var h;return new i(r,u,c-u)}(e,t,n,Uint8Array)}function ir(e){const t={key:e.type,description:"",data:"",mimeType:null,pictureType:null};if(e.size<2)return;if(3!==e.data[0])return void console.log("Ignore frame with unrecognized character encoding");const n=e.data.subarray(1).indexOf(0);if(-1===n)return;const i=I(nr(e.data,1,n)),r=e.data[2+n],s=e.data.subarray(3+n).indexOf(0);if(-1===s)return;const a=I(nr(e.data,3+n,s));let o;return o="--\x3e"===i?I(nr(e.data,4+n+s)):function(e){return e instanceof ArrayBuffer?e:0==e.byteOffset&&e.byteLength==e.buffer.byteLength?e.buffer:new Uint8Array(e).buffer}(e.data.subarray(4+n+s)),t.mimeType=i,t.pictureType=r,t.description=a,t.data=o,t}function rr(e){return"PRIV"===e.type?function(e){if(e.size<2)return;const t=I(e.data,!0),n=new Uint8Array(e.data.subarray(t.length+1));return{key:e.type,info:t,data:n.buffer}}(e):"W"===e.type[0]?function(e){if("WXXX"===e.type){if(e.size<2)return;let t=1;const n=I(e.data.subarray(t),!0);t+=n.length+1;const i=I(e.data.subarray(t));return{key:e.type,info:n,data:i}}const t=I(e.data);return{key:e.type,info:"",data:t}}(e):"APIC"===e.type?ir(e):function(e){if(e.size<2)return;if("TXXX"===e.type){let t=1;const n=I(e.data.subarray(t),!0);t+=n.length+1;const i=I(e.data.subarray(t));return{key:e.type,info:n,data:i}}const t=I(e.data.subarray(1));return{key:e.type,info:"",data:t}}(e)}function sr(e){const t=String.fromCharCode(e[0],e[1],e[2],e[3]),n=Zi(e,4);return{type:t,size:n,data:e.subarray(10,10+n)}}function ar(e){let t=0;const n=[];for(;Vi(e,t);){const i=Zi(e,t+6);e[t+5]>>6&1&&(t+=10),t+=10;const r=t+i;for(;t+10<r;){const i=sr(e.subarray(t)),r=rr(i);r&&n.push(r),t+=i.size+10}ji(e,t)&&(t+=10)}return n}function or(e){return e&&"PRIV"===e.key&&"com.apple.streaming.transportStreamTimestamp"===e.info}function lr(e){if(8===e.data.byteLength){const t=new Uint8Array(e.data),n=1&t[3];let i=(t[4]<<23)+(t[5]<<15)+(t[6]<<7)+t[7];return i/=45,n&&(i+=47721858.84),Math.round(i)}}function ur(e){const t=ar(e);for(let e=0;e<t.length;e++){const n=t[e];if(or(n))return lr(n)}}let cr=function(e){return e.audioId3="org.id3",e.dateRange="com.apple.quicktime.HLS",e.emsg="https://aomedia.org/emsg/ID3",e.misbklv="urn:misb:KLV:bin:1910.1",e}({});function hr(e="",t=9e4){return{type:e,id:-1,pid:-1,inputTimeScale:t,sequenceNumber:-1,samples:[],dropped:0}}class dr{constructor(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.basePTS=null,this.initPTS=null,this.lastPTS=null}resetInitSegment(e,t,n,i){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}}resetTimeStamp(e){this.initPTS=e,this.resetContiguity()}resetContiguity(){this.basePTS=null,this.lastPTS=null,this.frameIndex=0}canParse(e,t){return!1}appendFrame(e,t,n){}demux(e,t){this.cachedData&&(e=ge(this.cachedData,e),this.cachedData=null);let n,r=Hi(e,0),s=r?r.length:0;const a=this._audioTrack,o=this._id3Track,l=r?ur(r):void 0,u=e.length;for((null===this.basePTS||0===this.frameIndex&&i(l))&&(this.basePTS=fr(l,t,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:cr.audioId3,duration:Number.POSITIVE_INFINITY});s<u;){if(this.canParse(e,s)){const t=this.appendFrame(a,e,s);t?(this.frameIndex++,this.lastPTS=t.sample.pts,s+=t.length,n=s):s=u}else tr(e,s)?(r=Hi(e,s),o.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:r,type:cr.audioId3,duration:Number.POSITIVE_INFINITY}),s+=r.length,n=s):s++;if(s===u&&n!==u){const t=e.slice(n);this.cachedData?this.cachedData=ge(this.cachedData,t):this.cachedData=t}}return{audioTrack:a,videoTrack:hr(),id3Track:o,textTrack:hr()}}demuxSampleAes(e,t,n){return Promise.reject(new Error(`[${this}] This demuxer does not support Sample-AES decryption`))}flush(e){const t=this.cachedData;return t&&(this.cachedData=null,this.demux(t,0)),{audioTrack:this._audioTrack,videoTrack:hr(),id3Track:this._id3Track,textTrack:hr()}}destroy(){this.cachedData=null,this._audioTrack=this._id3Track=void 0}}const fr=(e,t,n)=>{if(i(e))return 90*e;return 9e4*t+(n?9e4*n.baseTime/n.timescale:0)};let pr=null;const _r=[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],gr=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],mr=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],vr=[0,1,1,4];function yr(e,t,n,i,r){if(n+24>t.length)return;const s=br(t,n);if(s&&n+s.frameLength<=t.length){const a=i+r*(9e4*s.samplesPerFrame/s.sampleRate),o={unit:t.subarray(n,n+s.frameLength),pts:a,dts:a};return e.config=[],e.channelCount=s.channelCount,e.samplerate=s.sampleRate,e.samples.push(o),{sample:o,length:s.frameLength,missing:0}}}function br(e,t){const n=e[t+1]>>3&3,i=e[t+1]>>1&3,r=e[t+2]>>4&15,s=e[t+2]>>2&3;if(1!==n&&0!==r&&15!==r&&3!==s){const a=e[t+2]>>1&1,o=e[t+3]>>6,l=1e3*_r[14*(3===n?3-i:3===i?3:4)+r-1],u=gr[3*(3===n?0:2===n?1:2)+s],c=3===o?1:2,h=mr[n][i],d=vr[i],f=8*h*d,p=Math.floor(h*l/u+a)*d;if(null===pr){const e=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);pr=e?parseInt(e[1]):0}return!!pr&&pr<=87&&2===i&&l>=224e3&&0===o&&(e[t+3]=128|e[t+3]),{sampleRate:u,channelCount:c,frameLength:p,samplesPerFrame:f}}}function Er(e,t){return 255===e[t]&&224==(224&e[t+1])&&0!=(6&e[t+1])}function wr(e,t){return t+1<e.length&&Er(e,t)}function kr(e,t){if(t+1<e.length&&Er(e,t)){const n=4,i=br(e,t);let r=n;null!=i&&i.frameLength&&(r=i.frameLength);const s=t+r;return s===e.length||wr(e,s)}return!1}const Sr=(e,t)=>{let n=0,i=5;t+=i;const r=new Uint32Array(1),s=new Uint32Array(1),a=new Uint8Array(1);for(;i>0;){a[0]=e[t];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],t+=1,i-=o}return n};class Tr extends dr{constructor(e){super(),this.observer=void 0,this.observer=e}resetInitSegment(e,t,n,i){super.resetInitSegment(e,t,n,i),this._audioTrack={container:"audio/ac-3",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"ac3",samples:[],manifestCodec:t,duration:i,inputTimeScale:9e4,dropped:0}}canParse(e,t){return t+64<e.length}appendFrame(e,t,n){const i=Ar(e,t,n,this.basePTS,this.frameIndex);if(-1!==i){return{sample:e.samples[e.samples.length-1],length:i,missing:0}}}static probe(e){if(!e)return!1;const t=Hi(e,0);if(!t)return!1;const n=t.length;return 11===e[n]&&119===e[n+1]&&void 0!==ur(t)&&Sr(e,n)<16}}function Ar(e,t,n,i,r){if(n+8>t.length)return-1;if(11!==t[n]||119!==t[n+1])return-1;const s=t[n+4]>>6;if(s>=3)return-1;const a=[48e3,44100,32e3][s],o=63&t[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>t.length)return-1;const u=t[n+6]>>5;let c=0;2===u?c+=2:(1&u&&1!==u&&(c+=2),4&u&&(c+=2));const h=(t[n+6]<<8|t[n+7])>>12-c&1,d=[2,1,2,3,3,4,4,5][u]+h,f=t[n+5]>>3,p=7&t[n+5],_=new Uint8Array([s<<6|f<<1|p>>2,(3&p)<<6|u<<3|h<<2|o>>4,o<<4&224]),g=i+r*(1536/a*9e4),m=t.subarray(n,n+l);return e.config=_,e.channelCount=d,e.samplerate=a,e.samples.push({unit:m,pts:g}),l}const Cr=/\/emsg[-/]ID3/i;function Rr(e,t){return i(e.presentationTime)?e.presentationTime/e.timeScale:t+e.presentationTimeDelta/e.timeScale}class Lr{constructor(e,t,n){this.keyData=void 0,this.decrypter=void 0,this.keyData=n,this.decrypter=new zt(t,{removePKCS7Padding:!1})}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer,Gt)}decryptAacSample(e,t,n){const i=e[t].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(e,t+1,n)})).catch(n)}decryptAacSamples(e,t,n){for(;;t++){if(t>=e.length)return void n();if(!(e[t].unit.length<32)&&(this.decryptAacSample(e,t,n),!this.decrypter.isSync()))return}}getAvcEncryptedData(e){const t=16*Math.floor((e.length-48)/160)+16,n=new Int8Array(t);let i=0;for(let t=32;t<e.length-16;t+=160,i+=16)n.set(e.subarray(t,t+16),i);return n}getAvcDecryptedUnit(e,t){const n=new Uint8Array(t);let i=0;for(let t=32;t<e.length-16;t+=160,i+=16)e.set(n.subarray(i,i+16),t);return e}decryptAvcSample(e,t,n,i,r){const s=Ee(r.data),a=this.getAvcEncryptedData(s);this.decryptBuffer(a.buffer).then((a=>{r.data=this.getAvcDecryptedUnit(s,a),this.decrypter.isSync()||this.decryptAvcSamples(e,t,n+1,i)})).catch(i)}decryptAvcSamples(e,t,n,i){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,n=0){if(t>=e.length)return void i();const r=e[t].units;for(;!(n>=r.length);n++){const s=r[n];if(!(s.data.length<=48||1!==s.type&&5!==s.type||(this.decryptAvcSample(e,t,n,i,s),this.decrypter.isSync())))return}}}}class xr{constructor(){this.VideoSample=null}createVideoSample(e,t,n){return{key:e,frame:!1,pts:t,dts:n,units:[],length:0}}getLastNalUnit(e){var t;let n,i=this.VideoSample;if(i&&0!==i.units.length||(i=e[e.length-1]),null!=(t=i)&&t.units){const e=i.units;n=e[e.length-1]}return n}pushAccessUnit(e,t){if(e.units.length&&e.frame){if(void 0===e.pts){const n=t.samples,i=n.length;if(!i)return void t.dropped++;{const t=n[i-1];e.pts=t.pts,e.dts=t.dts}}t.samples.push(e)}}parseNALu(e,t,n){const i=t.byteLength;let r=e.naluState||0;const s=r,a=[];let o,l,u,c=0,h=-1,d=0;for(-1===r&&(h=0,d=this.getNALuType(t,0),r=0,c=1);c<i;)if(o=t[c++],r)if(1!==r)if(o)if(1===o){if(l=c-r-1,h>=0){const e={data:t.subarray(h,l),type:d};a.push(e)}else{const n=this.getLastNalUnit(e.samples);n&&(s&&c<=4-s&&n.state&&(n.data=n.data.subarray(0,n.data.byteLength-s)),l>0&&(n.data=ge(n.data,t.subarray(0,l)),n.state=0))}c<i?(u=this.getNALuType(t,c),h=c,d=u,r=0):r=-1}else r=0;else r=3;else r=o?0:2;else r=o?0:1;if(h>=0&&r>=0){const e={data:t.subarray(h,i),type:d,state:r};a.push(e)}if(0===a.length){const n=this.getLastNalUnit(e.samples);n&&(n.data=ge(n.data,t))}return e.naluState=r,a}}class Ir{constructor(e){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=e,this.bytesAvailable=e.byteLength,this.word=0,this.bitsAvailable=0}loadWord(){const e=this.data,t=this.bytesAvailable,n=e.byteLength-t,i=new Uint8Array(4),r=Math.min(4,t);if(0===r)throw new Error("no bytes available");i.set(e.subarray(n,n+r)),this.word=new DataView(i.buffer).getUint32(0),this.bitsAvailable=8*r,this.bytesAvailable-=r}skipBits(e){let t;e=Math.min(e,8*this.bytesAvailable+this.bitsAvailable),this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(t=(e-=this.bitsAvailable)>>3,e-=t<<3,this.bytesAvailable-=t,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)}readBits(e){let t=Math.min(this.bitsAvailable,e);const n=this.word>>>32-t;if(e>32&&R.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,this.bitsAvailable>0)this.word<<=t;else{if(!(this.bytesAvailable>0))throw new Error("no bits available");this.loadWord()}return t=e-t,t>0&&this.bitsAvailable?n<<t|this.readBits(t):n}skipLZ(){let e;for(e=0;e<this.bitsAvailable;++e)if(0!=(this.word&2147483648>>>e))return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()}skipUEG(){this.skipBits(1+this.skipLZ())}skipEG(){this.skipBits(1+this.skipLZ())}readUEG(){const e=this.skipLZ();return this.readBits(e+1)-1}readEG(){const e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}readBoolean(){return 1===this.readBits(1)}readUByte(){return this.readBits(8)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}}class Dr extends xr{parsePES(e,t,n,i){const r=this.parseNALu(e,n.data,i);let s,a=this.VideoSample,o=!1;n.data=null,a&&r.length&&!e.audFound&&(this.pushAccessUnit(a,e),a=this.VideoSample=this.createVideoSample(!1,n.pts,n.dts)),r.forEach((i=>{var r,l;switch(i.type){case 1:{let t=!1;s=!0;const r=i.data;if(o&&r.length>4){const e=this.readSliceType(r);2!==e&&4!==e&&7!==e&&9!==e||(t=!0)}var u;if(t)null!=(u=a)&&u.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null);a||(a=this.VideoSample=this.createVideoSample(!0,n.pts,n.dts)),a.frame=!0,a.key=t;break}case 5:s=!0,null!=(r=a)&&r.frame&&!a.key&&(this.pushAccessUnit(a,e),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,be(i.data,1,n.pts,t.samples);break;case 7:{var c,h;s=!0,o=!0;const t=i.data,n=this.readSPS(t);if(!e.sps||e.width!==n.width||e.height!==n.height||(null==(c=e.pixelRatio)?void 0:c[0])!==n.pixelRatio[0]||(null==(h=e.pixelRatio)?void 0:h[1])!==n.pixelRatio[1]){e.width=n.width,e.height=n.height,e.pixelRatio=n.pixelRatio,e.sps=[t];const i=t.subarray(1,4);let r="avc1.";for(let e=0;e<3;e++){let t=i[e].toString(16);t.length<2&&(t="0"+t),r+=t}e.codec=r}break}case 8:s=!0,e.pps=[i.data];break;case 9:s=!0,e.audFound=!0,null!=(l=a)&&l.frame&&(this.pushAccessUnit(a,e),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,e),this.VideoSample=null)}getNALuType(e,t){return 31&e[t]}readSliceType(e){const t=new Ir(e);return t.readUByte(),t.readUEG(),t.readUEG()}skipScalingList(e,t){let n,i=8,r=8;for(let s=0;s<e;s++)0!==r&&(n=t.readEG(),r=(i+n+256)%256),i=0===r?i:r}readSPS(e){const t=new Ir(e);let n,i,r,s=0,a=0,o=0,l=0;const u=t.readUByte.bind(t),c=t.readBits.bind(t),h=t.readUEG.bind(t),d=t.readBoolean.bind(t),f=t.skipBits.bind(t),p=t.skipEG.bind(t),_=t.skipUEG.bind(t),g=this.skipScalingList.bind(this);u();const m=u();if(c(5),f(3),u(),_(),100===m||110===m||122===m||244===m||44===m||83===m||86===m||118===m||128===m){const e=h();if(3===e&&f(1),_(),_(),f(1),d())for(i=3!==e?8:12,r=0;r<i;r++)d()&&g(r<6?16:64,t)}_();const v=h();if(0===v)h();else if(1===v)for(f(1),p(),p(),n=h(),r=0;r<n;r++)p();_(),f(1);const y=h(),b=h(),E=c(1);0===E&&f(1),f(1),d()&&(s=h(),a=h(),o=h(),l=h());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 Pr extends xr{constructor(...e){super(...e),this.initVPS=null}parsePES(e,t,n,i){const r=this.parseNALu(e,n.data,i);let s,a=this.VideoSample,o=!1;n.data=null,a&&r.length&&!e.audFound&&(this.pushAccessUnit(a,e),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,e),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,e),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,be(i.data,2,n.pts,t.samples);break;case 32:s=!0,e.vps||("object"!=typeof e.params&&(e.params={}),e.params=y(e.params,this.readVPS(i.data)),this.initVPS=i.data),e.vps=[i.data];break;case 33:if(s=!0,o=!0,void 0===e.vps||e.vps[0]===this.initVPS||void 0===e.sps||this.matchSPS(e.sps[0],i.data)||(this.initVPS=e.vps[0],e.sps=e.pps=void 0),!e.sps){const t=this.readSPS(i.data);e.width=t.width,e.height=t.height,e.pixelRatio=t.pixelRatio,e.codec=t.codecString,e.sps=[],"object"!=typeof e.params&&(e.params={});for(const n in t.params)e.params[n]=t.params[n]}this.pushParameterSet(e.sps,i.data,e.vps),a||(a=this.VideoSample=this.createVideoSample(!0,n.pts,n.dts)),a.key=!0;break;case 34:if(s=!0,"object"==typeof e.params){if(!e.pps){e.pps=[];const t=this.readPPS(i.data);for(const n in t)e.params[n]=t[n]}this.pushParameterSet(e.pps,i.data,e.vps)}break;case 35:s=!0,e.audFound=!0,null!=(l=a)&&l.frame&&(this.pushAccessUnit(a,e),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,e),this.VideoSample=null)}pushParameterSet(e,t,n){(n&&n[0]===this.initVPS||!n&&!e.length)&&e.push(t)}getNALuType(e,t){return(126&e[t])>>>1}ebsp2rbsp(e){const t=new Uint8Array(e.byteLength);let n=0;for(let i=0;i<e.byteLength;i++)i>=2&&3===e[i]&&0===e[i-1]&&0===e[i-2]||(t[n]=e[i],n++);return new Uint8Array(t.buffer,0,n)}pushAccessUnit(e,t){super.pushAccessUnit(e,t),this.initVPS&&(this.initVPS=null)}readVPS(e){const t=new Ir(e);t.readUByte(),t.readUByte(),t.readBits(4),t.skipBits(2),t.readBits(6);return{numTemporalLayers:t.readBits(3)+1,temporalIdNested:t.readBoolean()}}readSPS(e){const t=new Ir(this.ebsp2rbsp(e));t.readUByte(),t.readUByte(),t.readBits(4);const n=t.readBits(3);t.readBoolean();const i=t.readBits(2),r=t.readBoolean(),s=t.readBits(5),a=t.readUByte(),o=t.readUByte(),l=t.readUByte(),u=t.readUByte(),c=t.readUByte(),h=t.readUByte(),d=t.readUByte(),f=t.readUByte(),p=t.readUByte(),_=t.readUByte(),g=t.readUByte(),m=[],v=[];for(let e=0;e<n;e++)m.push(t.readBoolean()),v.push(t.readBoolean());if(n>0)for(let e=n;e<8;e++)t.readBits(2);for(let e=0;e<n;e++)m[e]&&(t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte()),v[e]&&t.readUByte();t.readUEG();const y=t.readUEG();3==y&&t.skipBits(1);const b=t.readUEG(),E=t.readUEG(),w=t.readBoolean();let k=0,S=0,T=0,A=0;w&&(k+=t.readUEG(),S+=t.readUEG(),T+=t.readUEG(),A+=t.readUEG());const C=t.readUEG(),R=t.readUEG(),L=t.readUEG();for(let e=t.readBoolean()?0:n;e<=n;e++)t.skipUEG(),t.skipUEG(),t.skipUEG();t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG();if(t.readBoolean()){if(t.readBoolean())for(let e=0;e<4;e++)for(let n=0;n<(3===e?2:6);n++){if(t.readBoolean()){const n=Math.min(64,1<<4+(e<<1));e>1&&t.readEG();for(let e=0;e<n;e++)t.readEG()}else t.readUEG()}}t.readBoolean(),t.readBoolean();t.readBoolean()&&(t.readUByte(),t.skipUEG(),t.skipUEG(),t.readBoolean());const x=t.readUEG();let I=0;for(let e=0;e<x;e++){let n=!1;if(0!==e&&(n=t.readBoolean()),n){e===x&&t.readUEG(),t.readBoolean(),t.readUEG();let n=0;for(let e=0;e<=I;e++){const e=t.readBoolean();let i=!1;e||(i=t.readBoolean()),(e||i)&&n++}I=n}else{const e=t.readUEG(),n=t.readUEG();I=e+n;for(let n=0;n<e;n++)t.readUEG(),t.readBoolean();for(let e=0;e<n;e++)t.readUEG(),t.readBoolean()}}if(t.readBoolean()){const e=t.readUEG();for(let n=0;n<e;n++){for(let e=0;e<L+4;e++)t.readBits(1);t.readBits(1)}}let D=0,P=1,O=1,M=!0,N=1,F=0;t.readBoolean(),t.readBoolean();let B=!1;if(t.readBoolean()){if(t.readBoolean()){const e=t.readUByte();e>0&&e<16?(P=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2][e-1],O=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1][e-1]):255===e&&(P=t.readBits(16),O=t.readBits(16))}t.readBoolean()&&t.readBoolean();if(t.readBoolean()){t.readBits(3),t.readBoolean();t.readBoolean()&&(t.readUByte(),t.readUByte(),t.readUByte())}t.readBoolean()&&(t.readUEG(),t.readUEG()),t.readBoolean(),t.readBoolean(),t.readBoolean(),B=t.readBoolean(),B&&(t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG());if(t.readBoolean()){N=t.readBits(32),F=t.readBits(32);t.readBoolean()&&t.readUEG();if(t.readBoolean()){const e=t.readBoolean(),i=t.readBoolean();let r=!1;(e||i)&&(r=t.readBoolean(),r&&(t.readUByte(),t.readBits(5),t.readBoolean(),t.readBits(5)),t.readBits(4),t.readBits(4),r&&t.readBits(4),t.readBits(5),t.readBits(5),t.readBits(5));for(let s=0;s<=n;s++){M=t.readBoolean();let n=!1;M||t.readBoolean()?t.readEG():n=t.readBoolean();const s=n?1:t.readUEG()+1;if(e)for(let e=0;e<s;e++)t.readUEG(),t.readUEG(),r&&(t.readUEG(),t.readUEG()),t.skipBits(1);if(i)for(let e=0;e<s;e++)t.readUEG(),t.readUEG(),r&&(t.readUEG(),t.readUEG()),t.skipBits(1)}}}t.readBoolean()&&(t.readBoolean(),t.readBoolean(),t.readBoolean(),D=t.readUEG())}let U=b,K=E;if(w){let e=1,t=1;1===y?e=t=2:2==y&&(e=2),U=b-e*S-e*k,K=E-t*A-t*T}const $=i?["A","B","C"][i]:"",G=a<<24|o<<16|l<<8|u;let j=0;for(let e=0;e<32;e++)j=(j|(G>>e&1)<<31-e)>>>0;let V=j.toString(16);1===s&&"2"===V&&(V="6");return{codecString:`hvc1.${$}${s}.${V}.${r?"H":"L"}${g}.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:[c,h,d,f,p,_],general_level_idc:g,bit_depth:C+8,bit_depth_luma_minus8:C,bit_depth_chroma_minus8:R,min_spatial_segmentation_idc:D,chroma_format_idc:y,frame_rate:{fixed:M,fps:F/N}},width:U,height:K,pixelRatio:[P,O]}}readPPS(e){const t=new Ir(this.ebsp2rbsp(e));t.readUByte(),t.readUByte(),t.skipUEG(),t.skipUEG(),t.skipBits(2),t.skipBits(3),t.skipBits(2),t.skipUEG(),t.skipUEG(),t.skipEG(),t.skipBits(2);t.readBoolean()&&t.skipUEG(),t.skipEG(),t.skipEG(),t.skipBits(4);const n=t.readBoolean(),i=t.readBoolean();let r=1;return i&&n?r=0:i?r=3:n&&(r=2),{parallelismType:r}}matchSPS(e,t){return String.fromCharCode.apply(null,e).substr(3)===String.fromCharCode.apply(null,t).substr(3)}}const Or=188;class Mr{constructor(e,t,n,i){this.logger=void 0,this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._pmtId=-1,this._videoTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.remainderData=null,this.videoParser=void 0,this.observer=e,this.config=t,this.typeSupported=n,this.logger=i,this.videoParser=null}static probe(e,t){const n=Mr.syncOffset(e);return n>0&&t.warn(`MPEG2-TS detected but first sync word found @ offset ${n}`),-1!==n}static syncOffset(e){const t=e.length;let n=Math.min(940,t-Or)+1,i=0;for(;i<n;){let r=!1,s=-1,a=0;for(let o=i;o<t;o+=Or){if(71!==e[o]||t-o!==Or&&71!==e[o+Or]){if(a)return-1;break}if(a++,-1===s&&(s=o,0!==s&&(n=Math.min(s+18612,e.length-Or)+1)),r||(r=0===Nr(e,o)),r&&a>1&&(0===s&&a>2||o+Or>n))return s}i++}return-1}static createTrack(e,t){return{container:"video"===e||"audio"===e?"video/mp2t":void 0,type:e,id:ee[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:"audio"===e?t:void 0}}resetInitSegment(e,t,n,i){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=Mr.createTrack("video"),this._videoTrack.duration=i,this._audioTrack=Mr.createTrack("audio",i),this._id3Track=Mr.createTrack("id3"),this._txtTrack=Mr.createTrack("text"),this._audioTrack.segmentCodec="aac",this.videoParser=null,this.aacOverFlow=null,this.remainderData=null,this.audioCodec=t,this.videoCodec=n}resetTimeStamp(){}resetContiguity(){const{_audioTrack:e,_videoTrack:t,_id3Track:n}=this;e&&(e.pesData=null),t&&(t.pesData=null),n&&(n.pesData=null),this.aacOverFlow=null,this.remainderData=null}demux(e,t,n=!1,i=!1){let r;n||(this.sampleAes=null);const s=this._videoTrack,a=this._audioTrack,o=this._id3Track,l=this._txtTrack;let u=s.pid,c=s.pesData,h=a.pid,d=o.pid,f=a.pesData,p=o.pesData,_=null,g=this.pmtParsed,m=this._pmtId,v=e.length;if(this.remainderData&&(v=(e=ge(this.remainderData,e)).length,this.remainderData=null),v<Or&&!i)return this.remainderData=e,{audioTrack:a,videoTrack:s,id3Track:o,textTrack:l};const y=Math.max(0,Mr.syncOffset(e));v-=(v-y)%Or,v<e.byteLength&&!i&&(this.remainderData=new Uint8Array(e.buffer,v,e.buffer.byteLength-v));let b=0;for(let t=y;t<v;t+=Or)if(71===e[t]){const i=!!(64&e[t+1]),v=Nr(e,t);let b;if((48&e[t+3])>>4>1){if(b=t+5+e[t+4],b===t+Or)continue}else b=t+4;switch(v){case u:i&&(c&&(r=$r(c,this.logger))&&(this.readyVideoParser(s.segmentCodec),null!==this.videoParser&&this.videoParser.parsePES(s,l,r,!1)),c={data:[],size:0}),c&&(c.data.push(e.subarray(b,t+Or)),c.size+=t+Or-b);break;case h:if(i){if(f&&(r=$r(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(e.subarray(b,t+Or)),f.size+=t+Or-b);break;case d:i&&(p&&(r=$r(p,this.logger))&&this.parseID3PES(o,r),p={data:[],size:0}),p&&(p.data.push(e.subarray(b,t+Or)),p.size+=t+Or-b);break;case 0:i&&(b+=e[b]+1),m=this._pmtId=Fr(e,b);break;case m:{i&&(b+=e[b]+1);const r=Br(e,b,this.typeSupported,n,this.observer,this.logger);u=r.videoPid,u>0&&(s.pid=u,s.segmentCodec=r.segmentVideoCodec),h=r.audioPid,h>0&&(a.pid=h,a.segmentCodec=r.segmentAudioCodec),d=r.id3Pid,d>0&&(o.pid=d),null===_||g||(this.logger.warn(`MPEG-TS PMT found at ${t} after unknown PID '${_}'. Backtracking to sync byte @${y} to parse all TS packets.`),_=null,t=y-188),g=this.pmtParsed=!0;break}case 17:case 8191:break;default:_=v}}else b++;b>0&&Ur(this.observer,new Error(`Found ${b} TS packet/s that do not start with 0x47`),void 0,this.logger),s.pesData=c,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:e}=this;let t;return this.remainderData=null,t=e?this.demux(e,-1,!1,!0):{videoTrack:this._videoTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(t),this.sampleAes?this.decrypt(t,this.sampleAes):t}extractRemainingSamples(e){const{audioTrack:t,videoTrack:n,id3Track:i,textTrack:r}=e,s=n.pesData,a=t.pesData,o=i.pesData;let l;if(s&&(l=$r(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=$r(a,this.logger))){switch(t.segmentCodec){case"aac":this.parseAACPES(t,l);break;case"mp3":this.parseMPEGPES(t,l);break;case"ac3":this.parseAC3PES(t,l)}t.pesData=null}else null!=a&&a.size&&this.logger.log("last AAC PES packet truncated,might overlap between fragments"),t.pesData=a;o&&(l=$r(o,this.logger))?(this.parseID3PES(i,l),i.pesData=null):i.pesData=o}demuxSampleAes(e,t,n){const i=this.demux(e,n,!0,!this.config.progressive),r=this.sampleAes=new Lr(this.observer,this.config,t);return this.decrypt(i,r)}readyVideoParser(e){null===this.videoParser&&("avc"===e?this.videoParser=new Dr:"hevc"===e&&(this.videoParser=new Pr))}decrypt(e,t){return new Promise((n=>{const{audioTrack:i,videoTrack:r}=e;i.samples&&"aac"===i.segmentCodec?t.decryptAacSamples(i.samples,0,(()=>{r.samples?t.decryptAvcSamples(r.samples,0,0,(()=>{n(e)})):n(e)})):r.samples&&t.decryptAvcSamples(r.samples,0,0,(()=>{n(e)}))}))}destroy(){this.observer&&this.observer.removeAllListeners(),this.config=this.logger=this.observer=null,this.aacOverFlow=this.videoParser=this.remainderData=this.sampleAes=null,this._videoTrack=this._audioTrack=this._id3Track=this._txtTrack=void 0}parseAACPES(e,t){let n=0;const i=this.aacOverFlow;let r,s,a,o=t.data;if(i){this.aacOverFlow=null;const t=i.missing,r=i.sample.unit.byteLength;if(-1===t)o=ge(i.sample.unit,o);else{const s=r-t;i.sample.unit.set(o.subarray(0,t),s),e.samples.push(i.sample),n=i.missing}}for(r=n,s=o.length;r<s-1&&!Yi(o,r);r++);if(r!==n){let e;const t=r<s-1;if(e=t?`AAC PES did not start with ADTS header,offset:${r}`:"No ADTS header found in AAC PES",Ur(this.observer,new Error(e),t,this.logger),!t)return}if(Qi(e,this.observer,o,r,this.audioCodec),void 0!==t.pts)a=t.pts;else{if(!i)return void this.logger.warn("[tsdemuxer]: AAC PES unknown PTS");{const t=Ji(e.samplerate);a=i.sample.pts+t}}let l,u=0;for(;r<s;){if(l=er(e,o,r,a,u),r+=l.length,l.missing){this.aacOverFlow=l;break}for(u++;r<s-1&&!Yi(o,r);r++);}}parseMPEGPES(e,t){const n=t.data,i=n.length;let r=0,s=0;const a=t.pts;if(void 0!==a)for(;s<i;)if(wr(n,s)){const t=yr(e,n,s,a,r);if(!t)break;s+=t.length,r++}else s++;else this.logger.warn("[tsdemuxer]: MPEG PES unknown PTS")}parseAC3PES(e,t){{const n=t.data,i=t.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=Ar(e,n,o,i,a++))>0;)o+=s}}parseID3PES(e,t){if(void 0===t.pts)return void this.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");const n=y({},t,{type:this._videoTrack?cr.emsg:cr.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(n)}}function Nr(e,t){return((31&e[t+1])<<8)+e[t+2]}function Fr(e,t){return(31&e[t+10])<<8|e[t+11]}function Br(e,t,n,i,r,s){const a={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},o=t+3+((15&e[t+1])<<8|e[t+2])-4;for(t+=12+((15&e[t+10])<<8|e[t+11]);t<o;){const o=Nr(e,t),l=(15&e[t+3])<<8|e[t+4];switch(e[t]){case 207:if(!i){Kr("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){Kr("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){Kr("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=t+5,r=l;for(;r>2;){if(106===e[i])!0!==n.ac3?s.log("AC-3 audio found, not supported in this browser for now"):(a.audioPid=o,a.segmentAudioCodec="ac3");const t=e[i+1]+2;i+=t,r-=t}}break;case 194:case 135:return Ur(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"))}t+=l+5}return a}function Ur(e,t,n,i){i.warn(`parsing error: ${t.message}`),e.emit(l.ERROR,l.ERROR,{type:a.MEDIA_ERROR,details:o.FRAG_PARSING_ERROR,fatal:!1,levelRetry:n,error:t,reason:t.message})}function Kr(e,t){t.log(`${e} with AES-128-CBC encryption found in unencrypted stream`)}function $r(e,t){let n,i,r,s,a,o=0;const l=e.data;if(!e||0===e.size)return null;for(;l[0].length<19&&l.length>1;)l[0]=ge(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>e.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&&(t.warn(`${Math.round((s-a)/9e4)}s delta between PTS and DTS, align them`),s=a)):a=s),r=n[8];let c=r+9;if(e.size<=c)return null;e.size-=c;const h=new Uint8Array(e.size);for(let e=0,t=l.length;e<t;e++){n=l[e];let t=n.byteLength;if(c){if(c>t){c-=t;continue}n=n.subarray(c),t-=c,c=0}h.set(n,o),o+=t}return i&&(i-=r+3),{data:h,pts:s,dts:a,len:i}}return null}class Gr{static getSilentFrame(e,t){if("mp4a.40.2"===e){if(1===t)return new Uint8Array([0,200,0,128,35,128]);if(2===t)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(3===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(4===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(5===t)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===t)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===t)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===t)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===t)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 jr=Math.pow(2,32)-1;class Vr{static init(){let e;for(e in Vr.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:[]},Vr.types)Vr.types.hasOwnProperty(e)&&(Vr.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);const t=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),n=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);Vr.HDLR_TYPES={video:t,audio:n};const i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),r=new Uint8Array([0,0,0,0,0,0,0,0]);Vr.STTS=Vr.STSC=Vr.STCO=r,Vr.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),Vr.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),Vr.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),Vr.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]);Vr.FTYP=Vr.box(Vr.types.ftyp,s,o,s,a),Vr.DINF=Vr.box(Vr.types.dinf,Vr.box(Vr.types.dref,i))}static box(e,...t){let n=8,i=t.length;const r=i;for(;i--;)n+=t[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(e,4),i=0,n=8;i<r;i++)s.set(t[i],n),n+=t[i].byteLength;return s}static hdlr(e){return Vr.box(Vr.types.hdlr,Vr.HDLR_TYPES[e])}static mdat(e){return Vr.box(Vr.types.mdat,e)}static mdhd(e,t){t*=e;const n=Math.floor(t/(jr+1)),i=Math.floor(t%(jr+1));return Vr.box(Vr.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,255&e,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(e){return Vr.box(Vr.types.mdia,Vr.mdhd(e.timescale||0,e.duration||0),Vr.hdlr(e.type),Vr.minf(e))}static mfhd(e){return Vr.box(Vr.types.mfhd,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,255&e]))}static minf(e){return"audio"===e.type?Vr.box(Vr.types.minf,Vr.box(Vr.types.smhd,Vr.SMHD),Vr.DINF,Vr.stbl(e)):Vr.box(Vr.types.minf,Vr.box(Vr.types.vmhd,Vr.VMHD),Vr.DINF,Vr.stbl(e))}static moof(e,t,n){return Vr.box(Vr.types.moof,Vr.mfhd(e),Vr.traf(n,t))}static moov(e){let t=e.length;const n=[];for(;t--;)n[t]=Vr.trak(e[t]);return Vr.box.apply(null,[Vr.types.moov,Vr.mvhd(e[0].timescale||0,e[0].duration||0)].concat(n).concat(Vr.mvex(e)))}static mvex(e){let t=e.length;const n=[];for(;t--;)n[t]=Vr.trex(e[t]);return Vr.box.apply(null,[Vr.types.mvex,...n])}static mvhd(e,t){t*=e;const n=Math.floor(t/(jr+1)),i=Math.floor(t%(jr+1)),r=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,255&e,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 Vr.box(Vr.types.mvhd,r)}static sdtp(e){const t=e.samples||[],n=new Uint8Array(4+t.length);let i,r;for(i=0;i<t.length;i++)r=t[i].flags,n[i+4]=r.dependsOn<<4|r.isDependedOn<<2|r.hasRedundancy;return Vr.box(Vr.types.sdtp,n)}static stbl(e){return Vr.box(Vr.types.stbl,Vr.stsd(e),Vr.box(Vr.types.stts,Vr.STTS),Vr.box(Vr.types.stsc,Vr.STSC),Vr.box(Vr.types.stsz,Vr.STSZ),Vr.box(Vr.types.stco,Vr.STCO))}static avc1(e){let t,n,i,r=[],s=[];for(t=0;t<e.sps.length;t++)n=e.sps[t],i=n.byteLength,r.push(i>>>8&255),r.push(255&i),r=r.concat(Array.prototype.slice.call(n));for(t=0;t<e.pps.length;t++)n=e.pps[t],i=n.byteLength,s.push(i>>>8&255),s.push(255&i),s=s.concat(Array.prototype.slice.call(n));const a=Vr.box(Vr.types.avcC,new Uint8Array([1,r[3],r[4],r[5],255,224|e.sps.length].concat(r).concat([e.pps.length]).concat(s))),o=e.width,l=e.height,u=e.pixelRatio[0],c=e.pixelRatio[1];return Vr.box(Vr.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,Vr.box(Vr.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),Vr.box(Vr.types.pasp,new Uint8Array([u>>24,u>>16&255,u>>8&255,255&u,c>>24,c>>16&255,c>>8&255,255&c])))}static esds(e){const t=e.config;return new Uint8Array([0,0,0,0,3,25,0,1,0,4,17,64,21,0,0,0,0,0,0,0,0,0,0,0,5,2,...t,6,1,2])}static audioStsd(e){const t=e.samplerate||0;return new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount||0,0,16,0,0,0,0,t>>8&255,255&t,0,0])}static mp4a(e){return Vr.box(Vr.types.mp4a,Vr.audioStsd(e),Vr.box(Vr.types.esds,Vr.esds(e)))}static mp3(e){return Vr.box(Vr.types[".mp3"],Vr.audioStsd(e))}static ac3(e){return Vr.box(Vr.types["ac-3"],Vr.audioStsd(e),Vr.box(Vr.types.dac3,e.config))}static stsd(e){const{segmentCodec:t}=e;if("audio"===e.type){if("aac"===t)return Vr.box(Vr.types.stsd,Vr.STSD,Vr.mp4a(e));if("ac3"===t&&e.config)return Vr.box(Vr.types.stsd,Vr.STSD,Vr.ac3(e));if("mp3"===t&&"mp3"===e.codec)return Vr.box(Vr.types.stsd,Vr.STSD,Vr.mp3(e))}else{if(!e.pps||!e.sps)throw new Error("video track missing pps or sps");if("avc"===t)return Vr.box(Vr.types.stsd,Vr.STSD,Vr.avc1(e));if("hevc"===t&&e.vps)return Vr.box(Vr.types.stsd,Vr.STSD,Vr.hvc1(e))}throw new Error(`unsupported ${e.type} segment codec (${t}/${e.codec})`)}static tkhd(e){const t=e.id,n=(e.duration||0)*(e.timescale||0),i=e.width||0,r=e.height||0,s=Math.floor(n/(jr+1)),a=Math.floor(n%(jr+1));return Vr.box(Vr.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,255&t,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(e,t){const n=Vr.sdtp(e),i=e.id,r=Math.floor(t/(jr+1)),s=Math.floor(t%(jr+1));return Vr.box(Vr.types.traf,Vr.box(Vr.types.tfhd,new Uint8Array([0,0,0,0,i>>24,i>>16&255,i>>8&255,255&i])),Vr.box(Vr.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])),Vr.trun(e,n.length+16+20+8+16+8+8),n)}static trak(e){return e.duration=e.duration||4294967295,Vr.box(Vr.types.trak,Vr.tkhd(e),Vr.mdia(e))}static trex(e){const t=e.id;return Vr.box(Vr.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}static trun(e,t){const n=e.samples||[],i=n.length,r=12+16*i,s=new Uint8Array(r);let a,o,l,u,c,h;for(t+=8+r,s.set(["video"===e.type?1:0,0,15,1,i>>>24&255,i>>>16&255,i>>>8&255,255&i,t>>>24&255,t>>>16&255,t>>>8&255,255&t],0),a=0;a<i;a++)o=n[a],l=o.duration,u=o.size,c=o.flags,h=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,c.isLeading<<2|c.dependsOn,c.isDependedOn<<6|c.hasRedundancy<<4|c.paddingValue<<1|c.isNonSync,61440&c.degradPrio,15&c.degradPrio,h>>>24&255,h>>>16&255,h>>>8&255,255&h],12+16*a);return Vr.box(Vr.types.trun,s)}static initSegment(e){Vr.types||Vr.init();const t=Vr.moov(e);return ge(Vr.FTYP,t)}static hvc1(e){const t=e.params,n=[e.vps,e.sps,e.pps],i=new Uint8Array([1,t.general_profile_space<<6|(t.general_tier_flag?32:0)|t.general_profile_idc,t.general_profile_compatibility_flags[0],t.general_profile_compatibility_flags[1],t.general_profile_compatibility_flags[2],t.general_profile_compatibility_flags[3],t.general_constraint_indicator_flags[0],t.general_constraint_indicator_flags[1],t.general_constraint_indicator_flags[2],t.general_constraint_indicator_flags[3],t.general_constraint_indicator_flags[4],t.general_constraint_indicator_flags[5],t.general_level_idc,240|t.min_spatial_segmentation_idc>>8,255&t.min_spatial_segmentation_idc,252|t.parallelismType,252|t.chroma_format_idc,248|t.bit_depth_luma_minus8,248|t.bit_depth_chroma_minus8,0,parseInt(t.frame_rate.fps),3|t.temporal_id_nested<<2|t.num_temporal_layers<<3|(t.frame_rate.fixed?64:0),n.length]);let r=i.length;for(let e=0;e<n.length;e+=1){r+=3;for(let t=0;t<n[e].length;t+=1)r+=2+n[e][t].length}const s=new Uint8Array(r);s.set(i,0),r=i.length;const a=n.length-1;for(let e=0;e<n.length;e+=1){s.set(new Uint8Array([32+e|(e===a?128:0),0,n[e].length]),r),r+=3;for(let t=0;t<n[e].length;t+=1)s.set(new Uint8Array([n[e][t].length>>8,255&n[e][t].length]),r),r+=2,s.set(n[e][t],r),r+=n[e][t].length}const o=Vr.box(Vr.types.hvcC,s),l=e.width,u=e.height,c=e.pixelRatio[0],h=e.pixelRatio[1];return Vr.box(Vr.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,Vr.box(Vr.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),Vr.box(Vr.types.pasp,new Uint8Array([c>>24,c>>16&255,c>>8&255,255&c,h>>24,h>>16&255,h>>8&255,255&h])))}}Vr.types=void 0,Vr.HDLR_TYPES=void 0,Vr.STTS=void 0,Vr.STSC=void 0,Vr.STCO=void 0,Vr.STSZ=void 0,Vr.VMHD=void 0,Vr.SMHD=void 0,Vr.STSD=void 0,Vr.FTYP=void 0,Vr.DINF=void 0;function Zr(e,t,n=1,i=!1){const r=e*t*n;return i?Math.round(r):r}function Hr(e,t=!1){return Zr(e,1e3,1/9e4,t)}function zr(e){const{baseTime:t,timescale:n,trackId:i}=e;return`${t/n} (${t}/${n}) trackId: ${i}`}let Wr,qr=null,Yr=null;function Xr(e,t,n,i){return{duration:t,size:n,cts:i,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:e?2:1,isNonSync:e?0:1}}}class Qr extends w{constructor(e,t,n,i){if(super("mp4-remuxer",i),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextVideoTs=null,this.nextAudioTs=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.videoTrackConfig=void 0,this.observer=e,this.config=t,this.typeSupported=n,this.ISGenerated=!1,null===qr){const e=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);qr=e?parseInt(e[1]):0}if(null===Yr){const e=navigator.userAgent.match(/Safari\/(\d+)/i);Yr=e?parseInt(e[1]):0}}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(e){const t=this._initPTS;t&&e&&e.trackId===t.trackId&&e.baseTime===t.baseTime&&e.timescale===t.timescale||this.log(`Reset initPTS: ${t?zr(t):t} > ${e?zr(e):e}`),this._initPTS=this._initDTS=e}resetNextTimestamp(){this.log("reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){this.log("ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0}getVideoStartPts(e){let t=!1;const n=e[0].pts,i=e.reduce(((e,i)=>{let r=i.pts,s=r-e;return s<-4294967296&&(t=!0,r=Jr(r,n),s=r-e),s>0?e:r}),n);return t&&this.debug("PTS rollover detected"),i}remux(e,t,n,i,r,s,a,o){let l,u,c,h,d,f,_=r,g=r;const m=e.pid>-1,v=t.pid>-1,y=t.samples.length,b=e.samples.length>0,E=a&&y>0||y>1;if((!m||b)&&(!v||E)||this.ISGenerated||a){if(this.ISGenerated){var w,k,S,T;const e=this.videoTrackConfig;(e&&(t.width!==e.width||t.height!==e.height||(null==(w=t.pixelRatio)?void 0:w[0])!==(null==(k=e.pixelRatio)?void 0:k[0])||(null==(S=t.pixelRatio)?void 0:S[1])!==(null==(T=e.pixelRatio)?void 0:T[1]))||!e&&E||null===this.nextAudioTs&&b)&&this.resetInitSegment()}this.ISGenerated||(c=this.generateIS(e,t,r,s));const n=this.isVideoContiguous;let i,a=-1;if(E&&(a=function(e){for(let t=0;t<e.length;t++)if(e[t].key)return t;return-1}(t.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 e=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(a),t.dropped+=a,g+=(t.samples[0].pts-e)/t.inputTimeScale,i=g}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(t.samples),i=(Jr(e.samples[0].pts,n)-n)/t.inputTimeScale;_+=Math.max(0,i),g+=Math.max(0,-i)}if(b){if(e.samplerate||(this.warn("regenerate InitSegment as audio detected"),c=this.generateIS(e,t,r,s)),u=this.remuxAudio(e,_,this.isAudioContiguous,s,v||E||o===p?g:void 0),E){const i=u?u.endPTS-u.startPTS:0;t.inputTimeScale||(this.warn("regenerate InitSegment as video detected"),c=this.generateIS(e,t,r,s)),l=this.remuxVideo(t,g,n,i)}}else E&&(l=this.remuxVideo(t,g,n,0));l&&(l.firstKeyFrame=a,l.independent=-1!==a,l.firstKeyFramePTS=i)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(n.samples.length&&(d=es(n,r,this._initPTS,this._initDTS)),i.samples.length&&(h=ts(i,r,this._initPTS))),{audio:u,video:l,initSegment:c,independent:f,text:h,id3:d}}computeInitPts(e,t,n,i){const r=Math.round(n*t);let s=Jr(e,r);if(s<r+t)for(this.log(`Adjusting PTS for rollover in timeline near ${(r-s)/t} ${i}`);s<r+t;)s+=8589934592;return s-r}generateIS(e,t,n,i){const r=e.samples,s=t.samples,a=this.typeSupported,o={},l=this._initPTS;let u,c,h,d=!l||i,f="audio/mp4",p=-1;if(d&&(u=c=1/0),e.config&&r.length){switch(e.timescale=e.samplerate,e.segmentCodec){case"mp3":a.mpeg?(f="audio/mpeg",e.codec=""):a.mp3&&(e.codec="mp3");break;case"ac3":e.codec="ac-3"}o.audio={id:"audio",container:f,codec:e.codec,initSegment:"mp3"===e.segmentCodec&&a.mpeg?new Uint8Array(0):Vr.initSegment([e]),metadata:{channelCount:e.channelCount}},d&&(p=e.id,h=e.inputTimeScale,l&&h===l.timescale?d=!1:u=c=this.computeInitPts(r[0].pts,h,n,"audio"))}if(t.sps&&t.pps&&s.length){if(t.timescale=t.inputTimeScale,o.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:Vr.initSegment([t]),metadata:{width:t.width,height:t.height}},d)if(p=t.id,h=t.inputTimeScale,l&&h===l.timescale)d=!1;else{const e=this.getVideoStartPts(s),t=Jr(s[0].dts,e),i=this.computeInitPts(t,h,n,"video"),r=this.computeInitPts(e,h,n,"video");c=Math.min(c,i),u=Math.min(u,r)}this.videoTrackConfig={width:t.width,height:t.height,pixelRatio:t.pixelRatio}}if(Object.keys(o).length)return this.ISGenerated=!0,d?(l&&this.warn(`Timestamps at playlist time: ${i?"":"~"}${n} ${u/h} != initPTS: ${l.baseTime/l.timescale} (${l.baseTime}/${l.timescale}) trackId: ${l.trackId}`),this.log(`Found initPTS at playlist time: ${n} offset: ${u/h} (${u}/${h}) trackId: ${p}`),this._initPTS={baseTime:u,timescale:h,trackId:p},this._initDTS={baseTime:c,timescale:h,trackId:p}):u=h=void 0,{tracks:o,initPTS:u,timescale:h,trackId:p}}remuxVideo(e,t,n,i){const r=e.inputTimeScale,s=e.samples,u=[],c=s.length,h=this._initPTS,d=h.baseTime*r/h.timescale;let f,p,_=this.nextVideoTs,g=8,m=this.videoSampleDuration,v=Number.POSITIVE_INFINITY,b=Number.NEGATIVE_INFINITY,E=!1;if(!n||null===_){const e=d+t*r,i=s[0].pts-Jr(s[0].dts,s[0].pts);qr&&null!==_&&Math.abs(e-i-(_+d))<15e3?n=!0:_=e-i-d}const w=_+d;for(let e=0;e<c;e++){const t=s[e];t.pts=Jr(t.pts,w),t.dts=Jr(t.dts,w),t.dts<s[e>0?e-1:e].dts&&(E=!0)}E&&s.sort((function(e,t){const n=e.dts-t.dts,i=e.pts-t.pts;return n||i})),f=s[0].dts,p=s[s.length-1].dts;const k=p-f,S=k?Math.round(k/(c-1)):m||e.inputTimeScale/30;if(n){const n=f-w,i=n>S,r=n<-1;if((i||r)&&(i?this.warn(`${(e.segmentCodec||"").toUpperCase()}: ${Hr(n,!0)} ms (${n}dts) hole between fragments detected at ${t.toFixed(3)}`):this.warn(`${(e.segmentCodec||"").toUpperCase()}: ${Hr(-n,!0)} ms (${n}dts) overlapping between fragments detected at ${t.toFixed(3)}`),!r||w>=s[0].pts||qr)){f=w;const e=s[0].pts-n;if(i)s[0].dts=f,s[0].pts=e;else{let t=!0;for(let i=0;i<s.length&&!(s[i].dts>e&&t);i++){const e=s[i].pts;if(s[i].dts-=n,s[i].pts-=n,i<s.length-1){const n=s[i+1].pts;t=n<=s[i].pts==n<=e}}}this.log(`Video: Initial PTS/DTS adjusted: ${Hr(e,!0)}/${Hr(f,!0)}, delta: ${Hr(n,!0)} ms`)}}f=Math.max(0,f);let T=0,A=0,C=f;for(let e=0;e<c;e++){const t=s[e],n=t.units,i=n.length;let r=0;for(let e=0;e<i;e++)r+=n[e].data.length;A+=r,T+=i,t.length=r,t.dts<C?(t.dts=C,C+=S/4|0||1):C=t.dts,v=Math.min(t.pts,v),b=Math.max(t.pts,b)}p=s[c-1].dts;const R=A+4*T+8;let L;try{L=new Uint8Array(R)}catch(e){return void this.observer.emit(l.ERROR,l.ERROR,{type:a.MUX_ERROR,details:o.REMUX_ALLOC_ERROR,fatal:!1,error:e,bytes:R,reason:`fail allocating video mdat ${R}`})}const x=new DataView(L.buffer);x.setUint32(0,R),L.set(Vr.types.mdat,4);let I=!1,D=Number.POSITIVE_INFINITY,P=Number.POSITIVE_INFINITY,O=Number.NEGATIVE_INFINITY,M=Number.NEGATIVE_INFINITY;for(let e=0;e<c;e++){const t=s[e],n=t.units;let a,o=0;for(let e=0,t=n.length;e<t;e++){const t=n[e],i=t.data,r=t.data.byteLength;x.setUint32(g,r),g+=4,L.set(i,g),g+=r,o+=4+r}if(e<c-1)m=s[e+1].dts-t.dts,a=s[e+1].pts-t.pts;else{const n=this.config,o=e>0?t.dts-s[e-1].dts:S;if(a=e>0?t.pts-s[e-1].pts:S,n.stretchShortVideoTrack&&null!==this.nextAudioTs){const e=Math.floor(n.maxBufferHole*r),s=(i?v+i*r:this.nextAudioTs+d)-t.pts;s>e?(m=s-o,m<0?m=o:I=!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(t.pts-t.dts);D=Math.min(D,m),O=Math.max(O,m),P=Math.min(P,a),M=Math.max(M,a),u.push(Xr(t.key,m,o,l))}if(u.length)if(qr){if(qr<70){const e=u[0].flags;e.dependsOn=2,e.isNonSync=0}}else if(Yr&&M-P<O-D&&S/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 e=f;for(let t=0,n=u.length;t<n;t++){const i=e+u[t].duration,r=e+u[t].cts;if(t<n-1){const e=i+u[t+1].cts;u[t].duration=e-r}else u[t].duration=t?u[t-1].duration:S;u[t].cts=0,e=i}}m=I||!m?S:m;const N=p+m;this.nextVideoTs=_=N-d,this.videoSampleDuration=m,this.isVideoContiguous=!0;const F={data1:Vr.moof(e.sequenceNumber++,f,y(e,{samples:u})),data2:L,startPTS:(v-d)/r,endPTS:(b+m-d)/r,startDTS:(f-d)/r,endDTS:_/r,type:"video",hasAudio:!1,hasVideo:!0,nb:u.length,dropped:e.dropped};return e.samples=[],e.dropped=0,F}getSamplesPerFrame(e){switch(e.segmentCodec){case"mp3":return 1152;case"ac3":return 1536;default:return 1024}}remuxAudio(e,t,n,i,r){const s=e.inputTimeScale,u=s/(e.samplerate?e.samplerate:s),c=this.getSamplesPerFrame(e),h=c*u,d=this._initPTS,f="mp3"===e.segmentCodec&&this.typeSupported.mpeg,p=[],_=void 0!==r;let g=e.samples,m=f?0:8,v=this.nextAudioTs||-1;const b=d.baseTime*s/d.timescale,E=b+t*s;if(this.isAudioContiguous=n=n||g.length&&v>0&&(i&&Math.abs(E-(v+b))<9e3||Math.abs(Jr(g[0].pts,E)-(v+b))<20*h),g.forEach((function(e){e.pts=Jr(e.pts,E)})),!n||v<0){const e=g.length;if(g=g.filter((e=>e.pts>=0)),e!==g.length&&this.warn(`Removed ${g.length-e} of ${e} samples (initPTS ${b} / ${s})`),!g.length)return;v=0===r?0:i&&!_?Math.max(0,E-b):g[0].pts-b}if("aac"===e.segmentCodec){const t=this.config.maxAudioFramesDrift;for(let n=0,i=v+b;n<g.length;n++){const r=g[n],a=r.pts,o=a-i,l=Math.abs(1e3*o/s);if(o<=-t*h&&_)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>=t*h&&l<1e4&&_){let t=Math.round(o/h);for(i=a-t*h;i<0&&t&&h;)t--,i+=h;0===n&&(this.nextAudioTs=v=i-b),this.warn(`Injecting ${t} audio frames @ ${((i-b)/s).toFixed(3)}s due to ${Math.round(1e3*o/s)} ms gap.`);for(let s=0;s<t;s++){let t=Gr.getSilentFrame(e.parsedCodec||e.manifestCodec||e.codec,e.channelCount);t||(this.log("Unable to get silent frame for given audio codec; duplicating last frame instead."),t=r.unit.subarray()),g.splice(n,0,{unit:t,pts:i}),i+=h,n++}}r.pts=i,i+=h}}let w,k=null,S=null,T=0,A=g.length;for(;A--;)T+=g[A].unit.byteLength;for(let t=0,i=g.length;t<i;t++){const i=g[t],r=i.unit;let s=i.pts;if(null!==S){p[t-1].duration=Math.round((s-S)/u)}else{if(n&&"aac"===e.segmentCodec&&(s=v+b),k=s,!(T>0))return;T+=m;try{w=new Uint8Array(T)}catch(e){return void this.observer.emit(l.ERROR,l.ERROR,{type:a.MUX_ERROR,details:o.REMUX_ALLOC_ERROR,fatal:!1,error:e,bytes:T,reason:`fail allocating audio mdat ${T}`})}if(!f){new DataView(w.buffer).setUint32(0,T),w.set(Vr.types.mdat,4)}}w.set(r,m);const h=r.byteLength;m+=h,p.push(Xr(!0,c,h,0)),S=s}const C=p.length;if(!C)return;const R=p[p.length-1];v=S-b,this.nextAudioTs=v+u*R.duration;const L=f?new Uint8Array(0):Vr.moof(e.sequenceNumber++,k/u,y({},e,{samples:p}));e.samples=[];const x=(k-b)/s,I=v/s,D={data1:L,data2:w,startPTS:x,endPTS:I,startDTS:x,endDTS:I,type:"audio",hasAudio:!0,hasVideo:!1,nb:C};return this.isAudioContiguous=!0,D}}function Jr(e,t){let n;if(null===t)return e;for(n=t<e?-8589934592:8589934592;Math.abs(e-t)>4294967296;)e+=n;return e}function es(e,t,n,i){const r=e.samples.length;if(!r)return;const s=e.inputTimeScale;for(let a=0;a<r;a++){const r=e.samples[a];r.pts=Jr(r.pts-n.baseTime*s/n.timescale,t*s)/s,r.dts=Jr(r.dts-i.baseTime*s/i.timescale,t*s)/s}const a=e.samples;return e.samples=[],{samples:a}}function ts(e,t,n){const i=e.samples.length;if(!i)return;const r=e.inputTimeScale;for(let s=0;s<i;s++){const i=e.samples[s];i.pts=Jr(i.pts-n.baseTime*r/n.timescale,t*r)/r}e.samples.sort(((e,t)=>e.pts-t.pts));const s=e.samples;return e.samples=[],{samples:s}}function ns(e,t,n=!1){return void 0!==(null==e?void 0:e.start)?(e.start+(n?e.duration:0))/e.timescale:t}function is(e,t,n){const i=e.codec;if(i&&i.length>4)return i;if(t===V){if("ec-3"===i||"ac-3"===i||"alac"===i)return i;if("fLaC"===i||"Opus"===i){return Oe(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{Wr=self.performance.now.bind(self.performance)}catch(e){Wr=Date.now}const rs=[{demux:class{constructor(e,t){this.remainderData=null,this.timeOffset=0,this.config=void 0,this.videoTrack=void 0,this.audioTrack=void 0,this.id3Track=void 0,this.txtTrack=void 0,this.config=t}resetTimeStamp(){}resetInitSegment(e,t,n,i){const r=this.videoTrack=hr("video",1),s=this.audioTrack=hr("audio",1),a=this.txtTrack=hr("text",1);if(this.id3Track=hr("id3",1),this.timeOffset=0,null==e||!e.byteLength)return;const o=le(e);if(o.video){const{id:e,timescale:t,codec:n,supplemental:i}=o.video;r.id=e,r.timescale=a.timescale=t,r.codec=n,r.supplemental=i}if(o.audio){const{id:e,timescale:t,codec:n}=o.audio;s.id=e,s.timescale=t,s.codec=n}a.id=ee.text,r.sampleDuration=0,r.duration=s.duration=i}resetContiguity(){this.remainderData=null}static probe(e){return function(e){const t=e.byteLength;for(let n=0;n<t;){const i=ie(e,n);if(i>8&&109===e[n+4]&&111===e[n+5]&&111===e[n+6]&&102===e[n+7])return!0;n=i>1?n+i:t}return!1}(e)}demux(e,t){this.timeOffset=t;let n=e;const i=this.videoTrack,r=this.txtTrack;if(this.config.progressive){this.remainderData&&(n=ge(this.remainderData,e));const t=function(e){const t={valid:null,remainder:null},n=ae(e,["moof"]);if(n.length<2)return t.remainder=e,t;const i=n[n.length-1];return t.valid=e.slice(0,i.byteOffset-8),t.remainder=e.slice(i.byteOffset-8),t}(n);this.remainderData=t.remainder,i.samples=t.valid||new Uint8Array}else i.samples=n;const s=this.extractID3Track(i,t);return r.samples=me(t,i),{videoTrack:i,audioTrack:this.audioTrack,id3Track:s,textTrack:this.txtTrack}}flush(){const e=this.timeOffset,t=this.videoTrack,n=this.txtTrack;t.samples=this.remainderData||new Uint8Array,this.remainderData=null;const i=this.extractID3Track(t,this.timeOffset);return n.samples=me(e,t),{videoTrack:t,audioTrack:hr(),id3Track:i,textTrack:hr()}}extractID3Track(e,t){const n=this.id3Track;if(e.samples.length){const i=ae(e.samples,["emsg"]);i&&i.forEach((e=>{const i=function(e){const t=e[0];let n="",i="",s=0,a=0,o=0,l=0,u=0,c=0;if(0===t){for(;"\0"!==te(e.subarray(c,c+1));)n+=te(e.subarray(c,c+1)),c+=1;for(n+=te(e.subarray(c,c+1)),c+=1;"\0"!==te(e.subarray(c,c+1));)i+=te(e.subarray(c,c+1)),c+=1;i+=te(e.subarray(c,c+1)),c+=1,s=ie(e,12),a=ie(e,16),l=ie(e,20),u=ie(e,24),c=28}else if(1===t){c+=4,s=ie(e,c),c+=4;const t=ie(e,c);c+=4;const a=ie(e,c);for(c+=4,o=2**32*t+a,r(o)||(o=Number.MAX_SAFE_INTEGER,R.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),l=ie(e,c),c+=4,u=ie(e,c),c+=4;"\0"!==te(e.subarray(c,c+1));)n+=te(e.subarray(c,c+1)),c+=1;for(n+=te(e.subarray(c,c+1)),c+=1;"\0"!==te(e.subarray(c,c+1));)i+=te(e.subarray(c,c+1)),c+=1;i+=te(e.subarray(c,c+1)),c+=1}return{schemeIdUri:n,value:i,timeScale:s,presentationTime:o,presentationTimeDelta:a,eventDuration:l,id:u,payload:e.subarray(c,e.byteLength)}}(e);if(Cr.test(i.schemeIdUri)){const e=Rr(i,t);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:e,pts:e,type:cr.emsg,duration:r})}else if(this.config.enableEmsgKLVMetadata&&i.schemeIdUri.startsWith("urn:misb:KLV:bin:1910.1")){const e=Rr(i,t);n.samples.push({data:i.payload,len:i.payload.byteLength,dts:e,pts:e,type:cr.misbklv,duration:Number.POSITIVE_INFINITY})}}))}return n}demuxSampleAes(e,t,n){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))}destroy(){this.config=null,this.remainderData=null,this.videoTrack=this.audioTrack=this.id3Track=this.txtTrack=void 0}},remux:class extends w{constructor(e,t,n,i){super("passthrough-remuxer",i),this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=null,this.initTracks=void 0,this.lastEndTime=null,this.isVideoContiguous=!1}destroy(){}resetTimeStamp(e){this.lastEndTime=null;const t=this.initPTS;t&&e&&t.baseTime===e.baseTime&&t.timescale===e.timescale||(this.initPTS=e)}resetNextTimestamp(){this.isVideoContiguous=!1,this.lastEndTime=null}resetInitSegment(e,t,n,i){this.audioCodec=t,this.videoCodec=n,this.generateInitSegment(e,i),this.emitInitSegment=!0}generateInitSegment(e,t){let{audioCodec:n,videoCodec:i}=this;if(null==e||!e.byteLength)return this.initTracks=void 0,void(this.initData=void 0);const{audio:r,video:s}=this.initData=le(e);if(t)!function(e,t){if(!e||!t)return;const n=t.keyId;n&&t.isCommonEncryption&&pe(e,((e,t)=>{const i=e.subarray(8,24);i.some((e=>0!==e))||(R.log(`[eme] Patching keyId in 'enc${t?"a":"v"}>sinf>>tenc' box: ${D(i)} -> ${D(n)}`),e.set(n,8))}))}(e,t);else{const e=r||s;null!=e&&e.encrypted&&this.warn(`Init segment with encrypted track with has no key ("${e.codec}")!`)}r&&(n=is(r,V,this)),s&&(i=is(s,Z,this));const a={};r&&s?a.audiovideo={container:"video/mp4",codec:n+","+i,supplemental:s.supplemental,encrypted:s.encrypted,initSegment:e,id:"main"}:r?a.audio={container:"audio/mp4",codec:n,encrypted:r.encrypted,initSegment:e,id:"audio"}:s?a.video={container:"video/mp4",codec:i,supplemental:s.supplemental,encrypted:s.encrypted,initSegment:e,id:"main"}:this.warn("initSegment does not contain moov or trak boxes."),this.initTracks=a}remux(e,t,n,r,s,a){var o,l;let{initPTS:u,lastEndTime:c}=this;const h={audio:void 0,video:void 0,text:r,id3:n,initSegment:void 0};i(c)||(c=this.lastEndTime=s||0);const d=t.samples;if(!d.length)return h;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."),h;this.emitInitSegment&&(f.tracks=this.initTracks,this.emitInitSegment=!1);const _=function(e,t,n){const r={},s=ae(e,["moof","traf"]);for(let e=0;e<s.length;e++){const a=s[e],o=ae(a,["tfhd"])[0],l=ie(o,4),u=t[l];if(!u)continue;r[l]||(r[l]={start:NaN,duration:0,sampleCount:0,timescale:u.timescale,type:u.type});const c=r[l],h=ae(a,["tfdt"])[0];if(h){const e=h[0];let t=ie(h,4);1===e&&(t===Q?n.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"):(t*=Q+1,t+=ie(h,8))),i(t)&&(!i(c.start)||t<c.start)&&(c.start=t)}const d=u.default,f=ie(o,0)|(null==d?void 0:d.flags);let p=(null==d?void 0:d.duration)||0;8&f&&(p=ie(o,2&f?12:8));const _=ae(a,["trun"]);let g=c.start||0,m=0,v=p;for(let e=0;e<_.length;e++){const t=_[e],n=ie(t,4),i=c.sampleCount;c.sampleCount+=n;const r=1&t[3],s=4&t[3],a=1&t[2],o=2&t[2],l=4&t[2],u=8&t[2];let h=8,d=n;for(r&&(h+=4),s&&n&&(1&t[h+1]||void 0!==c.keyFrameIndex||(c.keyFrameIndex=i),h+=4,a?(v=ie(t,h),h+=4):v=p,o&&(h+=4),u&&(h+=4),g+=v,m+=v,d--);d--;)a?(v=ie(t,h),h+=4):v=p,o&&(h+=4),l&&(1&t[h+1]||void 0===c.keyFrameIndex&&(c.keyFrameIndex=c.sampleCount-(d+1),c.keyFrameStart=g),h+=4),u&&(h+=4),g+=v,m+=v;!m&&p&&(m+=p*n)}c.duration+=m}if(!Object.keys(r).some((e=>r[e].duration))){let t=1/0,n=0;const s=ae(e,["sidx"]);for(let e=0;e<s.length;e++){const i=oe(s[e]);if(null!=i&&i.references){t=Math.min(t,i.earliestPresentationTime/i.timescale);const e=i.references.reduce(((e,t)=>e+t.info.duration||0),0);n=Math.max(n,e+i.earliestPresentationTime/i.timescale)}}n&&i(n)&&Object.keys(r).forEach((e=>{r[e].duration||(r[e].duration=n*r[e].timescale-r[e].start)}))}return r}(d,p,this),g=p.audio?_[p.audio.id]:null,m=p.video?_[p.video.id]:null,v=ns(m,1/0),y=ns(g,1/0),b=ns(m,0,!0),E=ns(g,0,!0);let w=s,k=0;const S=g&&(!m||!u&&y<v||u&&u.trackId===p.audio.id),T=S?g:m;if(T){const e=T.timescale,t=T.start-s*e,n=S?p.audio.id:p.video.id;w=T.start/e,k=S?E-y:b-v,!a&&u||!function(e,t,n,i){if(null===e)return!0;const r=Math.max(i,1),s=t-e.baseTime/e.timescale;return Math.abs(s-n)>r}(u,w,s,k)&&e===u.timescale||(u&&this.warn(`Timestamps at playlist time: ${a?"":"~"}${s} ${t/e} != initPTS: ${u.baseTime/u.timescale} (${u.baseTime}/${u.timescale}) trackId: ${u.trackId}`),this.log(`Found initPTS at playlist time: ${s} offset: ${w-s} (${t}/${e}) trackId: ${n}`),u=null,f.initPTS=t,f.timescale=e,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,C=A+k;k>0?this.lastEndTime=C:(this.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const R=!!p.audio,L=!!p.video;let x="";R&&(x+="audio"),L&&(x+="video");const I={data1:d,startPTS:A,startDTS:A,endPTS:C,endDTS:C,type:x,hasAudio:R,hasVideo:L,nb:1,dropped:0,encrypted:!!p.audio&&p.audio.encrypted||!!p.video&&p.video.encrypted};h.audio=R&&!L?I:void 0,h.video=L?I:void 0;const D=null==m?void 0:m.sampleCount;if(D){const e=m.keyFrameIndex,t=-1!==e;I.nb=D,I.dropped=0===e||this.isVideoContiguous?0:t?e:D,I.independent=t,I.firstKeyFrame=e,t&&m.keyFrameStart&&(I.firstKeyFramePTS=(m.keyFrameStart-u.baseTime)/u.timescale),this.isVideoContiguous||(h.independent=t),this.isVideoContiguous||(this.isVideoContiguous=t),I.dropped&&this.warn(`fmp4 does not start with IDR: firstIDR ${e}/${D} dropped: ${I.dropped} start: ${I.firstKeyFramePTS||"NA"}`)}return h.initSegment=f,h.id3=es(n,s,u,u),r.samples.length&&(h.text=ts(r,s,u)),h}}},{demux:Mr,remux:Qr},{demux:class extends dr{constructor(e,t){super(),this.observer=void 0,this.config=void 0,this.observer=e,this.config=t}resetInitSegment(e,t,n,i){super.resetInitSegment(e,t,n,i),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:t,duration:i,inputTimeScale:9e4,dropped:0}}static probe(e,t){if(!e)return!1;const n=Hi(e,0);let i=(null==n?void 0:n.length)||0;if(kr(e,i))return!1;for(let n=e.length;i<n;i++)if(Xi(e,i))return t.log("ADTS sync word found !"),!0;return!1}canParse(e,t){return function(e,t){return function(e,t){return t+5<e.length}(e,t)&&zi(e,t)&&qi(e,t)<=e.length-t}(e,t)}appendFrame(e,t,n){Qi(e,this.observer,t,n,e.manifestCodec);const i=er(e,t,n,this.basePTS,this.frameIndex);if(i&&0===i.missing)return i}},remux:Qr},{demux:class extends dr{resetInitSegment(e,t,n,i){super.resetInitSegment(e,t,n,i),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:t,duration:i,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;const t=Hi(e,0);let n=(null==t?void 0:t.length)||0;if(t&&11===e[n]&&119===e[n+1]&&void 0!==ur(t)&&Sr(e,n)<=16)return!1;for(let t=e.length;n<t;n++)if(kr(e,n))return R.log("MPEG Audio sync word found !"),!0;return!1}canParse(e,t){return function(e,t){return Er(e,t)&&4<=e.length-t}(e,t)}appendFrame(e,t,n){if(null!==this.basePTS)return yr(e,t,n,this.basePTS,this.frameIndex)}},remux:Qr}];rs.splice(2,0,{demux:Tr,remux:Qr});class ss{constructor(e,t,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=e,this.typeSupported=t,this.config=n,this.id=r,this.logger=s}configure(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()}push(e,t,n,i){const r=n.transmuxing;r.executeStart=Wr();let s=new Uint8Array(e);const{currentTransmuxState:u,transmuxConfig:c}=this;i&&(this.currentTransmuxState=i);const{contiguous:h,discontinuity:d,trackSwitch:f,accurateTimeOffset:p,timeOffset:_,initSegmentChange:g}=i||u,{audioCodec:m,videoCodec:v,defaultInitPts:y,duration:b,initSegmentData:E}=c,w=function(e,t){let n=null;e.byteLength>0&&null!=(null==t?void 0:t.key)&&null!==t.iv&&null!=t.method&&(n=t);return n}(s,t);if(w&&mn(w.method)){const e=this.getDecrypter(),t=vn(w.method);if(!e.isSync())return this.asyncResult=!0,this.decryptionPromise=e.webCryptoDecrypt(s,w.key.buffer,w.iv.buffer,t).then((e=>{const t=this.push(e,null,n);return this.decryptionPromise=null,t})),this.decryptionPromise;{let i=e.softwareDecrypt(s,w.key.buffer,w.iv.buffer,t);if(n.part>-1){const t=e.flush();i=t?t.buffer:t}if(!i)return r.executeEnd=Wr(),as(n);s=new Uint8Array(i)}}const k=this.needsProbing(d,f);if(k){const e=this.configureTransmuxer(s);if(e)return this.logger.warn(`[transmuxer] ${e.message}`),this.observer.emit(l.ERROR,l.ERROR,{type:a.MEDIA_ERROR,details:o.FRAG_PARSING_ERROR,fatal:!1,error:e,reason:e.message}),r.executeEnd=Wr(),as(n)}(d||f||g||k)&&this.resetInitSegment(E,m,v,b,t),(d||g||k)&&this.resetInitialTimestamp(y),h||this.resetContiguity();const S=this.transmux(s,w,_,p,n);this.asyncResult=os(S);const T=this.currentTransmuxState;return T.contiguous=!0,T.discontinuity=!1,T.trackSwitch=!1,r.executeEnd=Wr(),S}flush(e){const t=e.transmuxing;t.executeStart=Wr();const{decrypter:n,currentTransmuxState:i,decryptionPromise:r}=this;if(r)return this.asyncResult=!0,r.then((()=>this.flush(e)));const s=[],{timeOffset:a}=i;if(n){const t=n.flush();t&&s.push(this.push(t.buffer,null,e))}const{demuxer:o,remuxer:l}=this;if(!o||!l){t.executeEnd=Wr();const n=[as(e)];return this.asyncResult?Promise.resolve(n):n}const u=o.flush(a);return os(u)?(this.asyncResult=!0,u.then((t=>(this.flushRemux(s,t,e),s)))):(this.flushRemux(s,u,e),this.asyncResult?Promise.resolve(s):s)}flushRemux(e,t,n){const{audioTrack:i,videoTrack:r,id3Track:s,textTrack:a}=t,{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);e.push({remuxResult:u,chunkMeta:n}),n.transmuxing.executeEnd=Wr()}resetInitialTimestamp(e){const{demuxer:t,remuxer:n}=this;t&&n&&(t.resetTimeStamp(e),n.resetTimeStamp(e))}resetContiguity(){const{demuxer:e,remuxer:t}=this;e&&t&&(e.resetContiguity(),t.resetNextTimestamp())}resetInitSegment(e,t,n,i,r){const{demuxer:s,remuxer:a}=this;s&&a&&(s.resetInitSegment(e,t,n,i),a.resetInitSegment(e,t,n,r))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}transmux(e,t,n,i,r){let s;return s=t&&"SAMPLE-AES"===t.method?this.transmuxSampleAes(e,t,n,i,r):this.transmuxUnencrypted(e,n,i,r),s}transmuxUnencrypted(e,t,n,i){const{audioTrack:r,videoTrack:s,id3Track:a,textTrack:o}=this.demuxer.demux(e,t,!1,!this.config.progressive);return{remuxResult:this.remuxer.remux(r,s,a,o,t,n,!1,this.id),chunkMeta:i}}transmuxSampleAes(e,t,n,i,r){return this.demuxer.demuxSampleAes(e,t,n).then((e=>({remuxResult:this.remuxer.remux(e.audioTrack,e.videoTrack,e.id3Track,e.textTrack,n,i,!1,this.id),chunkMeta:r})))}configureTransmuxer(e){const{config:t,observer:n,typeSupported:i}=this;let r;for(let t=0,n=rs.length;t<n;t++){var s;if(null!=(s=rs[t].demux)&&s.probe(e,this.logger)){r=rs[t];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,t,i,this.logger)),a&&a instanceof u||(this.demuxer=new u(n,t,i,this.logger),this.probe=u.probe)}needsProbing(e,t){return!this.demuxer||!this.remuxer||e||t}getDecrypter(){let e=this.decrypter;return e||(e=this.decrypter=new zt(this.config)),e}}const as=e=>({remuxResult:{},chunkMeta:e});function os(e){return"then"in e&&e.then instanceof Function}class ls{constructor(e,t,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=e,this.videoCodec=t,this.initSegmentData=n,this.duration=i,this.defaultInitPts=r||null}}class us{constructor(e,t,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=e,this.contiguous=t,this.accurateTimeOffset=n,this.trackSwitch=i,this.timeOffset=r,this.initSegmentChange=s}}let cs=0;class hs{constructor(e,t,n,i){this.error=null,this.hls=void 0,this.id=void 0,this.instanceNo=cs++,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=e=>{const t=e.data,n=this.hls;if(n&&null!=t&&t.event&&t.instanceNo===this.instanceNo)switch(t.event){case"init":{var i;const e=null==(i=this.workerContext)?void 0:i.objectURL;e&&self.URL.revokeObjectURL(e);break}case"transmuxComplete":this.handleTransmuxComplete(t.data);break;case"flush":this.onFlush(t.data);break;case"workerLog":n.logger[t.data.logType]&&n.logger[t.data.logType](t.data.message);break;default:t.data=t.data||{},t.data.frag=this.frag,t.data.part=this.part,t.data.id=this.id,n.trigger(t.event,t.data)}},this.onWorkerError=e=>{if(!this.hls)return;const t=new Error(`${e.message} (${e.filename}:${e.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:t})};const r=e.config;this.hls=e,this.id=t,this.useWorker=!!r.enableWorker,this.onTransmuxComplete=n,this.onFlush=i;const s=(e,t)=>{(t=t||{}).frag=this.frag||void 0,e===l.ERROR&&(t.parent=this.id,t.part=this.part,this.error=t.error),this.hls.trigger(e,t)};this.observer=new Ki,this.observer.on(l.FRAG_DECRYPTED,s),this.observer.on(l.ERROR,s);const u=Be(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 "${t}"`),this.workerContext=function(e){const t=Gi[e];if(t)return t.clientCount++,t;const n=new self.URL(e,self.location.href).href,i={worker:new self.Worker(n),scriptURL:n,clientCount:1};return Gi[e]=i,i}(r.workerPath)):(n.log(`injecting Web Worker for "${t}"`),this.workerContext=function(){const e=Gi[$i];if(e)return e.clientCount++,e;const t=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(t),i={worker:new self.Worker(n),objectURL:n,clientCount:1};return Gi[$i]=i,i}());const{worker:e}=this.workerContext;e.addEventListener("message",this.onWorkerMessage),e.addEventListener("error",this.onWorkerError),e.postMessage({instanceNo:this.instanceNo,cmd:"init",typeSupported:u,id:t,config:it(r)})}catch(i){n.warn(`Error setting up "${t}" Web Worker, fallback to inline`,i),this.terminateWorker(),this.error=null,this.transmuxer=new ss(this.observer,u,r,"",t,e.logger)}return}}this.transmuxer=new ss(this.observer,u,r,"",t,e.logger)}reset(){if(this.frag=null,this.part=null,this.workerContext){const e=this.instanceNo;this.instanceNo=cs++;const t=this.hls.config,n=Be(t.preferManagedMediaSource);this.workerContext.worker.postMessage({instanceNo:this.instanceNo,cmd:"reset",resetNo:e,typeSupported:n,id:this.id,config:it(t)})}}terminateWorker(){if(this.workerContext){const{worker:e}=this.workerContext;this.workerContext=null,e.removeEventListener("message",this.onWorkerMessage),e.removeEventListener("error",this.onWorkerError),function(e){const t=Gi[e||$i];if(t&&1==t.clientCount--){const{worker:n,objectURL:i}=t;delete Gi[e||$i],i&&self.URL.revokeObjectURL(i),n.terminate()}}(this.hls.config.workerPath)}}destroy(){if(this.workerContext)this.terminateWorker(),this.onWorkerMessage=this.onWorkerError=null;else{const e=this.transmuxer;e&&(e.destroy(),this.transmuxer=null)}const e=this.observer;e&&e.removeAllListeners(),this.frag=null,this.part=null,this.observer=null,this.hls=null}push(e,t,n,i,r,s,a,o,l,u){var c,h;l.transmuxing.start=self.performance.now();const{instanceNo:d,transmuxer:p}=this,_=s?s.start:r.start,g=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),k=!y&&(1===b||0===b&&(1===E||w&&E<=0)),S=self.performance.now();(y||b||0===r.stats.parsing.start)&&(r.stats.parsing.start=S),!s||!E&&k||(s.stats.parsing.start=S);const T=!(m&&(null==(c=r.initSegment)?void 0:c.url)===(null==(h=m.initSegment)?void 0:h.url)),A=new us(v,k,o,y,_,T);if(!k||v||T){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: ${k}\n accurateTimeOffset: ${o}\n timeOffset: ${_}\n initSegmentChange: ${T}`);const e=new ls(n,i,t,a,u);this.configureTransmuxer(e)}if(this.frag=r,this.part=s,this.workerContext)this.workerContext.worker.postMessage({instanceNo:d,cmd:"demux",data:e,decryptdata:g,chunkMeta:l,state:A},e instanceof ArrayBuffer?[e]:[]);else if(p){const t=p.push(e,g,l,A);os(t)?t.then((e=>{this.handleTransmuxComplete(e)})).catch((e=>{this.transmuxerError(e,l,"transmuxer-interface push error")})):this.handleTransmuxComplete(t)}}flush(e){e.transmuxing.start=self.performance.now();const{instanceNo:t,transmuxer:n}=this;if(this.workerContext)this.workerContext.worker.postMessage({instanceNo:t,cmd:"flush",chunkMeta:e});else if(n){const t=n.flush(e);os(t)?t.then((t=>{this.handleFlushResult(t,e)})).catch((t=>{this.transmuxerError(t,e,"transmuxer-interface flush error")})):this.handleFlushResult(t,e)}}transmuxerError(e,t,n){this.hls&&(this.error=e,this.hls.trigger(l.ERROR,{type:a.MEDIA_ERROR,details:o.FRAG_PARSING_ERROR,chunkMeta:t,frag:this.frag||void 0,part:this.part||void 0,fatal:!1,error:e,err:e,reason:n}))}handleFlushResult(e,t){e.forEach((e=>{this.handleTransmuxComplete(e)})),this.onFlush(t)}configureTransmuxer(e){const{instanceNo:t,transmuxer:n}=this;this.workerContext?this.workerContext.worker.postMessage({instanceNo:t,cmd:"configure",config:e}):n&&n.configure(e)}handleTransmuxComplete(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)}}class ds extends w{constructor(e,t){super(t,e.logger),this.hls=void 0,this.canLoad=!1,this.timer=-1,this.hls=e}destroy(){this.clearTimer(),this.hls=this.log=this.warn=null}clearTimer(){-1!==this.timer&&(self.clearTimeout(this.timer),this.timer=-1)}startLoad(){this.canLoad=!0,this.loadPlaylist()}stopLoad(){this.canLoad=!1,this.clearTimer()}switchParams(e,t,n){const i=null==t?void 0:t.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,t.url).href}catch(e){this.warn(`Could not construct new URL for Rendition Report: ${e}`),a=s.URI||""}if(a===e){r=n;break}a===e.substring(0,a.length)&&(r=n)}if(-1!==r){const e=i[r],s=parseInt(e["LAST-MSN"])||t.lastPartSn;let a=parseInt(e["LAST-PART"])||t.lastPartIndex;if(this.hls.config.lowLatencyMode){const e=Math.min(t.age-t.partTarget,t.targetduration);a>=0&&e>t.partTarget&&(a+=1)}const o=n&&Qe(n);return new Je(s,a>=0?a:void 0,o)}}}loadPlaylist(e){this.clearTimer()}loadingPlaylist(e,t){this.clearTimer()}shouldLoadPlaylist(e){return this.canLoad&&!!e&&!!e.url&&(!e.details||e.details.live)}getUrlWithDirectives(e,t){if(t)try{return t.addDirectives(e)}catch(e){this.warn(`Could not construct new URL with HLS Delivery Directives: ${e}`)}return e}playlistLoaded(e,t,n){const{details:i,stats:r}=t,s=self.performance.now(),u=r.loading.first?Math.max(0,s-r.loading.first):0;i.advancedDateTime=Date.now()-u;const c=this.hls.config.timelineOffset;if(c!==i.appliedTimelineOffset){const e=Math.max(c||0,0);i.appliedTimelineOffset=e,i.fragments.forEach((t=>{t.setStart(t.playlistOffset+e)}))}if(i.live||null!=n&&n.live){const c="levelInfo"in t?t.levelInfo:t.track;if(i.reloaded(n),n&&i.fragments.length>0){ii(n,i,this);const e=i.playlistParsingError;if(e){this.warn(e);const n=this.hls;if(!n.config.ignorePlaylistParsingErrors){var h;const{networkDetails:s}=t;return void n.trigger(l.ERROR,{type:a.NETWORK_ERROR,details:o.LEVEL_PARSING_ERROR,fatal:!1,url:i.url,error:e,reason:e.message,level:t.level||void 0,parent:null==(h=i.fragments[0])?void 0:h.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=oi(i,1e3*(i.edge-f));if(i.requestScheduled+p<s?i.requestScheduled=s:i.requestScheduled+=p,this.log(`live playlist ${e} ${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 e=this.hls.config.lowLatencyMode,r=i.lastPartSn,a=i.endSN,o=i.lastPartIndex,l=r===a;-1!==o?l?(g=a+1,m=e?0:o):(g=r,m=e?o+1:i.maxPartIndex):g=a+1;const u=i.age,h=u+i.ageHeader;let d=Math.min(h-i.partTarget,1.5*i.targetduration);if(d>0){if(h>3*i.targetduration)this.log(`Playlist last advanced ${u.toFixed(2)}s ago. Omitting segment and part directives.`),g=void 0,m=void 0;else if(null!=n&&n.tuneInGoal&&h-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 e=Math.floor(d/i.targetduration);if(g+=e,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 ${e} to part ${m}`)}i.tuneInGoal=d}if(_=this.getDeliveryDirectives(i,t.deliveryDirectives,g,m),e||!l)return i.requestScheduled=s,void this.loadingPlaylist(c,_)}else(i.canBlockReload||i.canSkipUntil)&&(_=this.getDeliveryDirectives(i,t.deliveryDirectives,g,m));_&&void 0!==g&&i.canBlockReload&&(i.requestScheduled=r.loading.first+Math.max(p-2*u,p/2)),this.scheduleLoading(c,_,i)}else this.clearTimer()}scheduleLoading(e,t,n){const i=n||e.details;if(!i)return void this.loadingPlaylist(e,t);const r=self.performance.now(),s=i.requestScheduled;if(r>=s)return void this.loadingPlaylist(e,t);const a=s-r;this.log(`reload live playlist ${e.name||e.bitrate+"bps"} in ${Math.round(a)} ms`),this.clearTimer(),this.timer=self.setTimeout((()=>this.loadingPlaylist(e,t)),a)}getDeliveryDirectives(e,t,n,i){let r=Qe(e);return null!=t&&t.skip&&e.deltaUpdateFailed&&(n=t.msn,i=t.part,r=qe),new Je(n,i,r)}checkRetry(e){const t=e.details,n=mt(e),i=e.errorAction,{action:r,retryCount:s=0,retryConfig:a}=i||{},o=!!i&&!!a&&(r===Rt||!i.resolved&&r===At);if(o){var l;if(s>=a.maxNumRetry)return!1;if(n&&null!=(l=e.context)&&l.deliveryDirectives)this.warn(`Retrying playlist loading ${s+1}/${a.maxNumRetry} after "${t}" without delivery-directives`),this.loadPlaylist();else{const e=Et(a,s);this.clearTimer(),this.timer=self.setTimeout((()=>this.loadPlaylist()),e),this.warn(`Retrying playlist loading ${s+1}/${a.maxNumRetry} after "${t}" in ${e}ms`)}e.levelRetry=!0,i.resolved=!0}return o}}function fs(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!ps(e[n].attrs,t[n].attrs))return!1;return!0}function ps(e,t,n){const i=e["STABLE-RENDITION-ID"];return i&&!n?i===t["STABLE-RENDITION-ID"]:!(n||["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED","ASSOC-LANGUAGE"]).some((n=>e[n]!==t[n]))}function _s(e,t){return t.label.toLowerCase()===e.name.toLowerCase()&&(!t.language||t.language.toLowerCase()===(e.lang||"").toLowerCase())}class gs{constructor(e){this.tracks=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.tracks=e}destroy(){this.tracks=this.queues=null}append(e,t,n){if(null===this.queues||null===this.tracks)return;const i=this.queues[t];i.push(e),1!==i.length||n||this.executeNext(t)}appendBlocker(e){return new Promise((t=>{const n={label:"async-blocker",execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.append(n,e)}))}prependBlocker(e){return new Promise((t=>{if(this.queues){const n={label:"async-blocker-prepend",execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.queues[e].unshift(n)}}))}removeBlockers(){null!==this.queues&&[this.queues.video,this.queues.audio,this.queues.audiovideo].forEach((e=>{var t;const n=null==(t=e[0])?void 0:t.label;"async-blocker"!==n&&"async-blocker-prepend"!==n||(e[0].execute(),e.splice(0,1))}))}unblockAudio(e){if(null===this.queues)return;this.queues.audio[0]===e&&this.shiftAndExecuteNext("audio")}executeNext(e){if(null===this.queues||null===this.tracks)return;const t=this.queues[e];if(t.length){const i=t[0];try{i.execute()}catch(t){var n;if(i.onError(t),null===this.queues||null===this.tracks)return;const r=null==(n=this.tracks[e])?void 0:n.buffer;null!=r&&r.updating||this.shiftAndExecuteNext(e)}}}shiftAndExecuteNext(e){null!==this.queues&&(this.queues[e].shift(),this.executeNext(e))}current(e){var t;return(null==(t=this.queues)?void 0:t[e][0])||null}toString(){const{queues:e,tracks:t}=this;return null===e||null===t?"<destroyed>":`\n${this.list("video")}\n${this.list("audio")}\n${this.list("audiovideo")}}`}list(e){var t,n;return null!=(t=this.queues)&&t[e]||null!=(n=this.tracks)&&n[e]?`${e}: (${this.listSbInfo(e)}) ${this.listOps(e)}`:""}listSbInfo(e){var t;const n=null==(t=this.tracks)?void 0:t[e],i=null==n?void 0:n.buffer;return i?`SourceBuffer${i.updating?" updating":""}${n.ended?" ended":""}${n.ending?" ending":""}`:"none"}listOps(e){var t;return(null==(t=this.queues)?void 0:t[e].map((e=>e.label)).join(", "))||""}}const ms=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/,vs="HlsJsTrackRemovedError";class ys extends Error{constructor(e){super(e),this.name=vs}}function bs(e){const t=e.querySelectorAll("source");[].slice.call(t).forEach((t=>{e.removeChild(t)}))}function Es(e){return"audio"===e?1:0}class ws{constructor(e){this.hls=void 0,this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.clientRect=void 0,this.streamController=void 0,this.hls=e,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}setStreamController(e){this.streamController=e}destroy(){this.hls&&this.unregisterListener(),this.timer&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null}registerListeners(){const{hls:e}=this;e.on(l.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(l.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(l.MANIFEST_PARSED,this.onManifestParsed,this),e.on(l.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(l.BUFFER_CODECS,this.onBufferCodecs,this),e.on(l.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){const{hls:e}=this;e.off(l.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(l.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(l.MANIFEST_PARSED,this.onManifestParsed,this),e.off(l.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(l.BUFFER_CODECS,this.onBufferCodecs,this),e.off(l.MEDIA_DETACHING,this.onMediaDetaching,this)}onFpsDropLevelCapping(e,t){const n=this.hls.levels[t.droppedLevel];this.isLevelAllowed(n)&&this.restrictedLevels.push({bitrate:n.bitrate,height:n.height,width:n.width})}onMediaAttaching(e,t){this.media=t.media instanceof HTMLVideoElement?t.media:null,this.clientRect=null,this.timer&&this.hls.levels.length&&this.detectPlayerSize()}onManifestParsed(e,t){const n=this.hls;this.restrictedLevels=[],this.firstLevel=t.firstLevel,n.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onLevelsUpdated(e,t){this.timer&&i(this.autoLevelCapping)&&this.detectPlayerSize()}onBufferCodecs(e,t){this.hls.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onMediaDetaching(){this.stopCapping(),this.media=null}detectPlayerSize(){if(this.media){if(this.mediaHeight<=0||this.mediaWidth<=0)return void(this.clientRect=null);const e=this.hls.levels;if(e.length){const t=this.hls,n=this.getMaxLevel(e.length-1);n!==this.autoLevelCapping&&t.logger.log(`Setting autoLevelCapping to ${n}: ${e[n].height}p@${e[n].bitrate} for media ${this.mediaWidth}x${this.mediaHeight}`),t.autoLevelCapping=n,t.autoLevelEnabled&&t.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping}}}getMaxLevel(e){const t=this.hls.levels;if(!t.length)return-1;const n=t.filter(((t,n)=>this.isLevelAllowed(t)&&n<=e));return this.clientRect=null,ws.getMaxLevelByMediaSize(n,this.mediaWidth,this.mediaHeight)}startCapping(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())}stopCapping(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)}getDimensions(){if(this.clientRect)return this.clientRect;const e=this.media,t={width:0,height:0};if(e){const n=e.getBoundingClientRect();t.width=n.width,t.height=n.height,t.width||t.height||(t.width=n.right-n.left||e.width||0,t.height=n.bottom-n.top||e.height||0)}return this.clientRect=t,t}get mediaWidth(){return this.getDimensions().width*this.contentScaleFactor}get mediaHeight(){return this.getDimensions().height*this.contentScaleFactor}get contentScaleFactor(){let e=1;if(!this.hls.config.ignoreDevicePixelRatio)try{e=self.devicePixelRatio}catch(e){}return Math.min(e,this.hls.config.maxDevicePixelRatio)}isLevelAllowed(e){return!this.restrictedLevels.some((t=>e.bitrate===t.bitrate&&e.width===t.width&&e.height===t.height))}static getMaxLevelByMediaSize(e,t,n){if(null==e||!e.length)return-1;let i=e.length-1;const r=Math.max(t,n);for(let t=0;t<e.length;t+=1){const n=e[t];if((n.width>=r||n.height>=r)&&(s=n,!(a=e[t+1])||s.width!==a.width||s.height!==a.height)){i=t;break}}var s,a;return i}}const ks={MANIFEST:"m",AUDIO:"a",VIDEO:"v",MUXED:"av",INIT:"i",CAPTION:"c",TIMED_TEXT:"tt",KEY:"k",OTHER:"o"},Ss={HLS:"h"};class Ts{constructor(e,t){Array.isArray(e)&&(e=e.map((e=>e instanceof Ts?e:new Ts(e)))),this.value=e,this.params=t}}function As(e,t,n,i){return new Error(`failed to ${e} "${r=t,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 Cs(e,t,n){return As("serialize",e,t,n)}class Rs{constructor(e){this.description=e}}const Ls="Bare Item";function xs(e){if(!1===ArrayBuffer.isView(e))throw Cs(e,"Byte Sequence");return`:${t=e,btoa(String.fromCharCode(...t))}:`;var t}function Is(e){if(function(e){return e<-999999999999999||999999999999999<e}(e))throw Cs(e,"Integer");return e.toString()}function Ds(e,t){if(e<0)return-Ds(-e,t);const n=Math.pow(10,t);if(Math.abs(e*n%1-.5)<Number.EPSILON){const t=Math.floor(e*n);return(t%2==0?t:t+1)/n}return Math.round(e*n)/n}function Ps(e){const t=Ds(e,3);if(Math.floor(Math.abs(t)).toString().length>12)throw Cs(e,"Decimal");const n=t.toString();return n.includes(".")?n:`${n}.0`}const Os=/[\x00-\x1f\x7f]+/;function Ms(e){const t=(n=e).description||n.toString().slice(7,-1);var n;if(!1===/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(t))throw Cs(t,"Token");return t}function Ns(e){switch(typeof e){case"number":if(!i(e))throw Cs(e,Ls);return Number.isInteger(e)?Is(e):Ps(e);case"string":return function(e){if(Os.test(e))throw Cs(e,"String");return`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}(e);case"symbol":return Ms(e);case"boolean":return function(e){if("boolean"!=typeof e)throw Cs(e,"Boolean");return e?"?1":"?0"}(e);case"object":if(e instanceof Date)return function(e){return`@${Is(e.getTime()/1e3)}`}(e);if(e instanceof Uint8Array)return xs(e);if(e instanceof Rs)return Ms(e);default:throw Cs(e,Ls)}}function Fs(e){if(!1===/^[a-z*][a-z0-9\-_.*]*$/.test(e))throw Cs(e,"Key");return e}function Bs(e){return null==e?"":Object.entries(e).map((([e,t])=>!0===t?`;${Fs(e)}`:`;${Fs(e)}=${Ns(t)}`)).join("")}function Us(e){return e instanceof Ts?`${Ns(e.value)}${Bs(e.params)}`:Ns(e)}function Ks(e,t={whitespace:!0}){if("object"!=typeof e||null==e)throw Cs(e,"Dict");const n=e instanceof Map?e.entries():Object.entries(e),i=(null==t?void 0:t.whitespace)?" ":"";return Array.from(n).map((([e,t])=>{t instanceof Ts==!1&&(t=new Ts(t));let n=Fs(e);var i;return!0===t.value?n+=Bs(t.params):(n+="=",Array.isArray(t.value)?n+=`(${(i=t).value.map(Us).join(" ")})${Bs(i.params)}`:n+=Us(t)),n})).join(`,${i}`)}function $s(e,t){return Ks(e,t)}const Gs="CMCD-Object",js="CMCD-Request",Vs="CMCD-Session",Zs="CMCD-Status",Hs={br:Gs,ab:Gs,d:Gs,ot:Gs,tb:Gs,tpb:Gs,lb:Gs,tab:Gs,lab:Gs,url:Gs,pb:js,bl:js,tbl:js,dl:js,ltc:js,mtp:js,nor:js,nrr:js,rc:js,sn:js,sta:js,su:js,ttfb:js,ttfbb:js,ttlb:js,cmsdd:js,cmsds:js,smrt:js,df:js,cs:js,ts:js,cid:Vs,pr:Vs,sf:Vs,sid:Vs,st:Vs,v:Vs,msd:Vs,bs:Zs,bsd:Zs,cdn:Zs,rtp:Zs,bg:Zs,pt:Zs,ec:Zs,e:Zs},zs=js;function Ws(e,t){const n={};if(!e)return n;const i=Object.keys(e),r=t?(s=t,Object.keys(s).reduce(((e,t)=>{var n;return null===(n=s[t])||void 0===n||n.forEach((n=>e[n]=t)),e}),{})):{};var s;return i.reduce(((t,n)=>{var i;const s=Hs[n]||r[n]||zs;return(null!==(i=t[s])&&void 0!==i?i:t[s]={})[n]=e[n],t}),n)}const qs="event";const Ys=e=>Math.round(e),Xs=(e,t)=>Array.isArray(e)?e.map((e=>Xs(e,t))):e instanceof Ts&&"string"==typeof e.value?new Ts(Xs(e.value,t),e.params):(t.baseUrl&&(e=function(e,t){const n=new URL(e),i=new URL(t);if(n.origin!==i.origin)return e;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}(e,t.baseUrl)),1===t.version?encodeURIComponent(e):e),Qs=e=>100*Ys(e/100),Js={br:Ys,d:Ys,bl:Qs,dl:Qs,mtp:Qs,nor:(e,t)=>{let n=e;return t.version>=2&&(e instanceof Ts&&"string"==typeof e.value?n=new Ts([e]):"string"==typeof e&&(n=[e])),Xs(n,t)},rtp:Qs,tb:Ys},ea="request",ta="response",na=["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"],ia=["e"],ra=/^[a-zA-Z0-9-.]+-[a-zA-Z0-9-.]+$/;function sa(e){return ra.test(e)}const aa=["d","dl","nor","ot","rtp","su"];const oa=["cmsdd","cmsds","rc","smrt","ttfb","ttfbb","ttlb","url"];const la=["bl","br","bs","cid","d","dl","mtp","nor","nrr","ot","pr","rtp","sf","sid","st","su","tb","v"];function ua(e){return la.includes(e)||sa(e)}const ca={[ta]:function(e){return na.includes(e)||aa.includes(e)||oa.includes(e)||sa(e)},[qs]:function(e){return na.includes(e)||ia.includes(e)||sa(e)},[ea]:function(e){return na.includes(e)||aa.includes(e)||sa(e)}};function ha(e,t={}){const n={};if(null==e||"object"!=typeof e)return n;const r=t.version||e.v||1,s=t.reportingMode||ea,a=1===r?ua:ca[s];let o=Object.keys(e).filter(a);const l=t.filter;"function"==typeof l&&(o=o.filter(l));const u=s===ta||s===qs;u&&!o.includes("ts")&&o.push("ts"),r>1&&!o.includes("v")&&o.push("v");const c=y({},Js,t.formatters),h={version:r,reportingMode:s,baseUrl:t.baseUrl};return o.sort().forEach((t=>{let s=e[t];const a=c[t];if("function"==typeof a&&(s=a(s,h)),"v"===t){if(1===r)return;s=r}"pr"==t&&1===s||(u&&"ts"===t&&!i(s)&&(s=Date.now()),function(e){return"number"==typeof e?i(e):null!=e&&""!==e&&!1!==e}(s)&&(function(e){return["ot","sf","st","e","sta"].includes(e)}(t)&&"string"==typeof s&&(s=new Rs(s)),n[t]=s))})),n}function da(e,t,n){return y(e,function(e,t={}){const n={};if(!e)return n;const i=Ws(ha(e,t),null==t?void 0:t.customHeaderMap);return Object.entries(i).reduce(((e,[t,n])=>{const i=$s(n,{whitespace:!1});return i&&(e[t]=i),e}),n)}(t,n))}function fa(e,t={}){if(!e)return"";const n=function(e,t={}){return e?$s(ha(e,t),{whitespace:!1}):""}(e,t);return encodeURIComponent(n)}const pa=/CMCD=[^&#]+/;function _a(e,t,n){const i=function(e,t={}){return e?`CMCD=${fa(e,t)}`:""}(t,n);if(!i)return e;if(pa.test(e))return e.replace(pa,i);const r=e.includes("?")?"&":"?";return`${e}${r}${i}`}function ga(e,t,n,i){e&&Object.keys(t).forEach((r=>{const s=e.filter((e=>e.groupId===r)).map((e=>{const s=y({},e);return s.details=void 0,s.attrs=new hn(s.attrs),s.url=s.attrs.URI=ma(e.url,e.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",n),s.groupId=s.attrs["GROUP-ID"]=t[r],s.attrs["PATHWAY-ID"]=i,s}));e.push(...s)}))}function ma(e,t,n,i){const{HOST:r,PARAMS:s,[n]:a}=i;let o;t&&(o=null==a?void 0:a[t],o&&(e=o));const l=new self.URL(e);return r&&!o&&(l.host=r),s&&Object.keys(s).sort().forEach((e=>{e&&l.searchParams.set(e,s[e])})),l.href}class va extends w{constructor(e){super("eme",e.logger),this.hls=void 0,this.config=void 0,this.media=null,this.keyFormatPromise=null,this.keySystemAccessPromises={},this._requestLicenseFailureCount=0,this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},this.mediaKeys=null,this.setMediaKeysQueue=va.CDMCleanupPromise?[va.CDMCleanupPromise]:[],this.bannedKeyIds={},this.onMediaEncrypted=e=>{const{initDataType:t,initData:n}=e,i=`"${e.type}" event: init data type: "${t}"`;if(this.debug(i),null!==n){if(!this.keyFormatPromise){let e=Object.keys(this.keySystemAccessPromises);e.length||(e=In(this.config));const t=e.map(xn).filter((e=>!!e));this.keyFormatPromise=this.getKeyFormatPromise(t)}this.keyFormatPromise.then((r=>{const s=Ln(r);if("sinf"!==t||s!==Sn.FAIRPLAY)return void this.log(`Ignoring "${e.type}" event with init data type: "${t}" for selected key-system ${s}`);let a;try{const e=te(new Uint8Array(n)),t=_e(yn(JSON.parse(e).sinf));if(!t)throw new Error("'schm' box missing or not cbcs/cenc with schi > tenc");a=new Uint8Array(t.subarray(8,24))}catch(e){return void this.warn(`${i} Failed to parse sinf: ${e}`)}const o=D(a),{keyIdToKeySessionPromise:l,mediaKeySessions:u}=this;let c=l[o];for(let e=0;e<u.length;e++){const i=u[e],r=i.decryptdata;if(!r.keyId)continue;const s=D(r.keyId);if(_n(a,r.keyId)||-1!==r.uri.replace(/-/g,"").indexOf(o)){if(c=l[s],!c)continue;if(r.pssh)break;delete l[s],r.pssh=new Uint8Array(n),r.keyId=a,c=l[o]=c.then((()=>this.generateRequestWithPreferredKeySession(i,t,n,"encrypted-event-key-match"))),c.catch((e=>this.handleError(e)));break}}c||this.handleError(new Error(`Key ID ${o} not encountered in playlist. Key-system sessions ${u.length}.`))})).catch((e=>this.handleError(e)))}},this.onWaitingForKey=e=>{this.log(`"${e.type}" event`)},this.hls=e,this.config=e.config,this.registerListeners()}destroy(){this.onDestroying(),this.onMediaDetached();const e=this.config;e.requestMediaKeySystemAccessFunc=null,e.licenseXhrSetup=e.licenseResponseCallback=void 0,e.drmSystems=e.drmSystemOptions={},this.hls=this.config=this.keyIdToKeySessionPromise=null,this.onMediaEncrypted=this.onWaitingForKey=null}registerListeners(){this.hls.on(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(e){const{drmSystems:t,widevineLicenseUrl:n}=this.config,i=null==t?void 0:t[e];return i?i.licenseUrl:e===Sn.WIDEVINE&&n?n:void 0}getLicenseServerUrlOrThrow(e){const t=this.getLicenseServerUrl(e);if(void 0===t)throw new Error(`no license server URL configured for key-system "${e}"`);return t}getServerCertificateUrl(e){const{drmSystems:t}=this.config,n=null==t?void 0:t[e];if(n)return n.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${e}"]`)}attemptKeySystemAccess(e){const t=this.hls.levels,n=(e,t,n)=>!!e&&n.indexOf(e)===t,i=t.map((e=>e.audioCodec)).filter(n),r=t.map((e=>e.videoCodec)).filter(n);return i.length+r.length===0&&r.push("avc1.42e01e"),new Promise(((t,n)=>{const s=e=>{const l=e.shift();this.getMediaKeysPromise(l,i,r).then((e=>t({keySystem:l,mediaKeys:e}))).catch((t=>{e.length?s(e):n(t instanceof Ea?t:new Ea({type:a.KEY_SYSTEM_ERROR,details:o.KEY_SYSTEM_NO_ACCESS,error:t,fatal:!0},t.message))}))};s(e)}))}requestMediaKeySystemAccess(e,t){const{requestMediaKeySystemAccessFunc:n}=this.config;if("function"!=typeof n){let e=`Configured requestMediaKeySystemAccess is not a function ${n}`;return null===Dn&&"http:"===self.location.protocol&&(e=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(new Error(e))}return n(e,t)}getMediaKeysPromise(e,t,n){var i;const r=function(e,t,n,i){let r;switch(e){case Sn.FAIRPLAY:r=["cenc","sinf"];break;case Sn.WIDEVINE:case Sn.PLAYREADY:r=["cenc"];break;case Sn.CLEARKEY:r=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${e}`)}return function(e,t,n,i){return[{initDataTypes:e,persistentState:i.persistentState||"optional",distinctiveIdentifier:i.distinctiveIdentifier||"optional",sessionTypes:i.sessionTypes||[i.sessionType||"temporary"],audioCapabilities:t.map((e=>({contentType:`audio/mp4; codecs=${e}`,robustness:i.audioRobustness||"",encryptionScheme:i.audioEncryptionScheme||null}))),videoCapabilities:n.map((e=>({contentType:`video/mp4; codecs=${e}`,robustness:i.videoRobustness||"",encryptionScheme:i.videoEncryptionScheme||null})))}]}(r,t,n,i)}(e,t,n,this.config.drmSystemOptions||{});let s=this.keySystemAccessPromises[e],a=null==(i=s)?void 0:i.keySystemAccess;if(!a){this.log(`Requesting encrypted media "${e}" key-system access with config: ${it(r)}`),a=this.requestMediaKeySystemAccess(e,r);const t=s=this.keySystemAccessPromises[e]={keySystemAccess:a};return a.catch((t=>{this.log(`Failed to obtain access to key-system "${e}": ${t}`)})),a.then((n=>{this.log(`Access for key-system "${n.keySystem}" obtained`);const i=this.fetchServerCertificate(e);this.log(`Create media-keys for "${e}"`);const r=t.mediaKeys=n.createMediaKeys().then((n=>(this.log(`Media-keys created for "${e}"`),t.hasMediaKeys=!0,i.then((t=>t?this.setMediaKeysServerCertificate(n,e,t):n)))));return r.catch((t=>{this.error(`Failed to create media-keys for "${e}"}: ${t}`)})),r}))}return a.then((()=>s.mediaKeys))}createMediaKeySessionContext({decryptdata:e,keySystem:t,mediaKeys:n}){this.log(`Creating key-system session "${t}" keyId: ${D(e.keyId||[])} keyUri: ${e.uri}`);const i=n.createSession(),r={decryptdata:e,keySystem:t,mediaKeys:n,mediaKeysSession:i,keyStatus:"status-pending"};return this.mediaKeySessions.push(r),r}renewKeySession(e){const t=e.decryptdata;if(t.pssh){const n=this.createMediaKeySessionContext(e),i=ya(t),r="cenc";this.keyIdToKeySessionPromise[i]=this.generateRequestWithPreferredKeySession(n,r,t.pssh.buffer,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(e)}updateKeySession(e,t){const n=e.mediaKeysSession;return this.log(`Updating key-session "${n.sessionId}" for keyId ${D(e.decryptdata.keyId||[])}\n } (data length: ${t.byteLength})`),n.update(t)}getSelectedKeySystemFormats(){return Object.keys(this.keySystemAccessPromises).map((e=>({keySystem:e,hasMediaKeys:this.keySystemAccessPromises[e].hasMediaKeys}))).filter((({hasMediaKeys:e})=>!!e)).map((({keySystem:e})=>xn(e))).filter((e=>!!e))}getKeySystemAccess(e){return this.getKeySystemSelectionPromise(e).then((({keySystem:e,mediaKeys:t})=>this.attemptSetMediaKeys(e,t)))}selectKeySystem(e){return new Promise(((t,n)=>{this.getKeySystemSelectionPromise(e).then((({keySystem:e})=>{const i=xn(e);i?t(i):n(new Error(`Unable to find format for key-system "${e}"`))})).catch(n)}))}selectKeySystemFormat(e){const t=Object.keys(e.levelkeys||{});return this.keyFormatPromise||(this.log(`Selecting key-system from fragment (sn: ${e.sn} ${e.type}: ${e.level}) key formats ${t.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(t)),this.keyFormatPromise}getKeyFormatPromise(e){const t=In(this.config),n=e.map(Ln).filter((e=>!!e&&-1!==t.indexOf(e)));return this.selectKeySystem(n)}getKeyStatus(e){const{mediaKeySessions:t}=this;for(let n=0;n<t.length;n++){const i=ba(e,t[n]);if(i)return i}}loadKey(e){const t=e.keyInfo.decryptdata,n=ya(t),i=this.bannedKeyIds[n];if(i||"internal-error"===this.getKeyStatus(t)){const n=wa(i||"internal-error",t);return this.handleError(n,e.frag),Promise.reject(n)}const r=`(keyId: ${n} format: "${t.keyFormat}" method: ${t.method} uri: ${t.uri})`;this.log(`Starting session for key ${r}`);const s=this.keyIdToKeySessionPromise[n];if(!s){const i=this.getKeySystemForKeyPromise(t).then((({keySystem:n,mediaKeys:i})=>(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${e.frag.sn} ${e.frag.type}: ${e.frag.level} using key ${r}`),this.attemptSetMediaKeys(n,i).then((()=>(this.throwIfDestroyed(),this.createMediaKeySessionContext({keySystem:n,mediaKeys:i,decryptdata:t}))))))).then((e=>{const n=t.pssh?t.pssh.buffer:null;return this.generateRequestWithPreferredKeySession(e,"cenc",n,"playlist-key")}));return i.catch((t=>this.handleError(t,e.frag))),this.keyIdToKeySessionPromise[n]=i,i}return s.catch((n=>{if(n instanceof Ea){const i=E({},n.data);"internal-error"===this.getKeyStatus(t)&&(i.decryptdata=t);const r=new Ea(i,n.message);this.handleError(r,e.frag)}})),s}throwIfDestroyed(e="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(e,t){if(this.hls)if(e instanceof Ea){t&&(e.data.frag=t);const n=e.data.decryptdata;this.error(`${e.message}${n?` (${D(n.keyId||[])})`:""}`),this.hls.trigger(l.ERROR,e.data)}else this.error(e.message),this.hls.trigger(l.ERROR,{type:a.KEY_SYSTEM_ERROR,details:o.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0})}getKeySystemForKeyPromise(e){const t=ya(e),n=this.keyIdToKeySessionPromise[t];if(!n){const t=Ln(e.keyFormat),n=t?[t]:In(this.config);return this.attemptKeySystemAccess(n)}return n}getKeySystemSelectionPromise(e){if(e.length||(e=In(this.config)),0===e.length)throw new Ea({type:a.KEY_SYSTEM_ERROR,details:o.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${it({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(e)}attemptSetMediaKeys(e,t){if(this.mediaKeys===t)return Promise.resolve();const n=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);const i=Promise.all(n).then((()=>{if(!this.media)throw this.mediaKeys=null,new Error("Attempted to set mediaKeys without media element attached");return this.media.setMediaKeys(t)}));return this.mediaKeys=t,this.setMediaKeysQueue.push(i),i.then((()=>{this.log(`Media-keys set for "${e}"`),n.push(i),this.setMediaKeysQueue=this.setMediaKeysQueue.filter((e=>-1===n.indexOf(e)))}))}generateRequestWithPreferredKeySession(e,t,n,i){var r;const s=null==(r=this.config.drmSystems)||null==(r=r[e.keySystem])?void 0:r.generateRequest;if(s)try{const i=s.call(this.hls,t,n,e);if(!i)throw new Error("Invalid response from configured generateRequest filter");t=i.initDataType,n=i.initData?i.initData:null,e.decryptdata.pssh=n?new Uint8Array(n):null}catch(e){if(this.warn(e.message),this.hls&&this.hls.config.debug)throw e}if(null===n)return this.log(`Skipping key-session request for "${i}" (no initData)`),Promise.resolve(e);const l=ya(e.decryptdata),u=e.decryptdata.uri;this.log(`Generating key-session request for "${i}" keyId: ${l} URI: ${u} (init data type: ${t} length: ${n.byteLength})`);const c=new Ki,h=e._onmessage=t=>{const n=e.mediaKeysSession;if(!n)return void c.emit("error",new Error("invalid state"));const{messageType:i,message:r}=t;this.log(`"${i}" message event for session "${n.sessionId}" message size: ${r.byteLength}`),"license-request"===i||"license-renewal"===i?this.renewLicense(e,r).catch((e=>{c.eventNames().length?c.emit("error",e):this.handleError(e)})):"license-release"===i?e.keySystem===Sn.FAIRPLAY&&this.updateKeySession(e,bn("acknowledged")).then((()=>this.removeSession(e))).catch((e=>this.handleError(e))):this.warn(`unhandled media key message type "${i}"`)},d=(e,t)=>{let n;t.keyStatus=e,e.startsWith("usable")?c.emit("resolved"):"internal-error"===e||"output-restricted"===e||"output-downscaled"===e?n=wa(e,t.decryptdata):"expired"===e?n=new Error(`key expired (keyId: ${l})`):"released"===e?n=new Error("key released"):"status-pending"===e||this.warn(`unhandled key status change "${e}" (keyId: ${l})`),n&&(c.eventNames().length?c.emit("error",n):this.handleError(n))},f=e._onkeystatuseschange=t=>{if(!e.mediaKeysSession)return void c.emit("error",new Error("invalid state"));const n=this.getKeyStatuses(e);if(!Object.keys(n).some((e=>"status-pending"!==n[e])))return;if("expired"===n[l])return this.log(`Expired key ${it(n)} in key-session "${e.mediaKeysSession.sessionId}"`),void this.renewKeySession(e);let i=n[l];if(i)d(i,e);else{var r;const t=1e3;e.keyStatusTimeouts||(e.keyStatusTimeouts={}),(r=e.keyStatusTimeouts)[l]||(r[l]=self.setTimeout((()=>{if(!e.mediaKeysSession||!this.mediaKeys)return;const n=this.getKeyStatus(e.decryptdata);if(n&&"status-pending"!==n)return this.log(`No status for keyId ${l} in key-session "${e.mediaKeysSession.sessionId}". Using session key-status ${n} from other session.`),d(n,e);this.log(`key status for ${l} in key-session "${e.mediaKeysSession.sessionId}" timed out after ${t}ms`),i="internal-error",d(i,e)}),t)),this.log(`No status for keyId ${l} (${it(n)}).`)}};yi(e.mediaKeysSession,"message",h),yi(e.mediaKeysSession,"keystatuseschange",f);const p=new Promise(((e,t)=>{c.on("error",t),c.on("resolved",e)}));return e.mediaKeysSession.generateRequest(t,n).then((()=>{this.log(`Request generated for key-session "${e.mediaKeysSession.sessionId}" keyId: ${l} URI: ${u}`)})).catch((t=>{throw new Ea({type:a.KEY_SYSTEM_ERROR,details:o.KEY_SYSTEM_NO_SESSION,error:t,decryptdata:e.decryptdata,fatal:!1},`Error generating key-session request: ${t}`)})).then((()=>p)).catch((t=>(c.removeAllListeners(),this.removeSession(e).then((()=>{throw t}))))).then((()=>(c.removeAllListeners(),e)))}getKeyStatuses(e){const t={};return e.mediaKeysSession.keyStatuses.forEach(((n,i)=>{if("string"==typeof i&&"object"==typeof n){const e=i;i=n,n=e}const r="buffer"in i?new Uint8Array(i.buffer,i.byteOffset,i.byteLength):new Uint8Array(i);e.keySystem===Sn.PLAYREADY&&16===r.length&&En(r);const s=D(r);"internal-error"===n&&(this.bannedKeyIds[s]=n),this.log(`key status change "${n}" for keyStatuses keyId: ${s} key-session "${e.mediaKeysSession.sessionId}"`),t[s]=n})),t}fetchServerCertificate(e){const t=this.config,n=new(0,t.loader)(t),i=this.getServerCertificateUrl(e);return i?(this.log(`Fetching server certificate for "${e}"`),new Promise(((r,s)=>{const l={responseType:"arraybuffer",url:i},u=t.certLoadPolicy.default,c={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},h={onSuccess:(e,t,n,i)=>{r(e.data)},onError:(t,n,r,u)=>{s(new Ea({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},t)},`"${e}" certificate request failed (${i}). Status: ${t.code} (${t.text})`))},onTimeout:(t,n,r)=>{s(new Ea({type:a.KEY_SYSTEM_ERROR,details:o.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:r,response:{url:l.url,data:void 0}},`"${e}" certificate request timed out (${i})`))},onAbort:(e,t,n)=>{s(new Error("aborted"))}};n.load(l,c,h)}))):Promise.resolve()}setMediaKeysServerCertificate(e,t,n){return new Promise(((i,r)=>{e.setServerCertificate(n).then((r=>{this.log(`setServerCertificate ${r?"success":"not supported by CDM"} (${n.byteLength}) on "${t}"`),i(e)})).catch((e=>{r(new Ea({type:a.KEY_SYSTEM_ERROR,details:o.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:e,fatal:!0},e.message))}))}))}renewLicense(e,t){return this.requestLicense(e,new Uint8Array(t)).then((t=>this.updateKeySession(e,new Uint8Array(t)).catch((t=>{throw new Ea({type:a.KEY_SYSTEM_ERROR,details:o.KEY_SYSTEM_SESSION_UPDATE_FAILED,decryptdata:e.decryptdata,error:t,fatal:!1},t.message)}))))}unpackPlayReadyKeyMessage(e,t){const n=String.fromCharCode.apply(null,new Uint16Array(t.buffer));if(!n.includes("PlayReadyKeyMessage"))return e.setRequestHeader("Content-Type","text/xml; charset=utf-8"),t;const i=(new DOMParser).parseFromString(n,"application/xml"),r=i.querySelectorAll("HttpHeader");if(r.length>0){let t;for(let n=0,i=r.length;n<i;n++){var s,a;t=r[n];const i=null==(s=t.querySelector("name"))?void 0:s.textContent,o=null==(a=t.querySelector("value"))?void 0:a.textContent;i&&o&&e.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 bn(atob(l))}setupLicenseXHR(e,t,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,e,t,n,i)})).catch((s=>{if(!n.decryptdata)throw s;return e.open("POST",t,!0),r.call(this.hls,e,t,n,i)})).then((n=>{e.readyState||e.open("POST",t,!0);return{xhr:e,licenseChallenge:n||i}})):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:i}))}requestLicense(e,t){const n=this.config.keyLoadPolicy.default;return new Promise(((i,r)=>{const s=this.getLicenseServerUrlOrThrow(e.keySystem);this.log(`Sending license request to URL: ${s}`);const l=new XMLHttpRequest;l.responseType="arraybuffer",l.onreadystatechange=()=>{if(!this.hls||!e.mediaKeysSession)return r(new Error("invalid state"));if(4===l.readyState)if(200===l.status){this._requestLicenseFailureCount=0;let t=l.response;this.log(`License received ${t instanceof ArrayBuffer?t.byteLength:t}`);const n=this.config.licenseResponseCallback;if(n)try{t=n.call(this.hls,l,s,e)}catch(e){this.error(e)}i(t)}else{const u=n.errorRetry,c=u?u.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>c||l.status>=400&&l.status<500)r(new Ea({type:a.KEY_SYSTEM_ERROR,details:o.KEY_SYSTEM_LICENSE_REQUEST_FAILED,decryptdata:e.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=c-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${n} attempts left`),this.requestLicense(e,t).then(i,r)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=l,this.setupLicenseXHR(l,s,e,t).then((({xhr:t,licenseChallenge:n})=>{e.keySystem==Sn.PLAYREADY&&(n=this.unpackPlayReadyKeyMessage(t,n)),t.send(n)})).catch(r)}))}onDestroying(){this.unregisterListeners(),this._clear()}onMediaAttached(e,t){if(!this.config.emeEnabled)return;const n=t.media;this.media=n,yi(n,"encrypted",this.onMediaEncrypted),yi(n,"waitingforkey",this.onWaitingForKey)}onMediaDetached(){const e=this.media;e&&(bi(e,"encrypted",this.onMediaEncrypted),bi(e,"waitingforkey",this.onWaitingForKey),this.media=null,this.mediaKeys=null)}_clear(){var e;if(this._requestLicenseFailureCount=0,this.keyIdToKeySessionPromise={},this.bannedKeyIds={},!this.mediaKeys&&!this.mediaKeySessions.length)return;const t=this.media,n=this.mediaKeySessions.slice();this.mediaKeySessions=[],this.mediaKeys=null,Nn.clearKeyUriToKeyIdMap();const i=n.length;va.CDMCleanupPromise=Promise.all(n.map((e=>this.removeSession(e))).concat((null==t||null==(e=t.setMediaKeys(null))?void 0:e.catch((e=>{this.log(`Could not clear media keys: ${e}`),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: ${e}`)})})))||Promise.resolve())).catch((e=>{this.log(`Could not close sessions and clear media keys: ${e}`),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: ${e}`)})})).then((()=>{i&&this.log("finished closing key sessions and clearing media keys")}))}onManifestLoading(){this.keyFormatPromise=null,this.bannedKeyIds={}}onManifestLoaded(e,{sessionKeys:t}){if(t&&this.config.emeEnabled&&!this.keyFormatPromise){const e=t.reduce(((e,t)=>(-1===e.indexOf(t.keyFormat)&&e.push(t.keyFormat),e)),[]);this.log(`Selecting key-system from session-keys ${e.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(e)}}removeSession(e){const{mediaKeysSession:t,licenseXhr:n,decryptdata:i}=e;if(t){this.log(`Remove licenses and keys and close session "${t.sessionId}" keyId: ${D((null==i?void 0:i.keyId)||[])}`),e._onmessage&&(t.removeEventListener("message",e._onmessage),e._onmessage=void 0),e._onkeystatuseschange&&(t.removeEventListener("keystatuseschange",e._onkeystatuseschange),e._onkeystatuseschange=void 0),n&&n.readyState!==XMLHttpRequest.DONE&&n.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;const r=this.mediaKeySessions.indexOf(e);r>-1&&this.mediaKeySessions.splice(r,1);const{keyStatusTimeouts:s}=e;s&&Object.keys(s).forEach((e=>self.clearTimeout(s[e])));const{drmSystemOptions:u}=this.config,c=function(e){var t;return!(!e||"persistent-license"!==e.sessionType&&(null==(t=e.sessionTypes)||!t.some((e=>"persistent-license"===e))))}(u)?new Promise(((e,n)=>{self.setTimeout((()=>n(new Error("MediaKeySession.remove() timeout"))),8e3),t.remove().then(e).catch(n)})):Promise.resolve();return c.catch((e=>{this.log(`Could not remove session: ${e}`),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: ${e}`)})})).then((()=>t.close())).catch((e=>{this.log(`Could not close session: ${e}`),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: ${e}`)})}))}return Promise.resolve()}}function ya(e){if(!e)throw new Error("Could not read keyId of undefined decryptdata");if(null===e.keyId)throw new Error("keyId is null");return D(e.keyId)}function ba(e,t){return e.keyId&&t.mediaKeysSession.keyStatuses.has(e.keyId)?t.mediaKeysSession.keyStatuses.get(e.keyId):e.matches(t.decryptdata)?t.keyStatus:void 0}va.CDMCleanupPromise=void 0;class Ea extends Error{constructor(e,t){super(t),this.data=void 0,e.error||(e.error=new Error(t)),this.data=e,e.err=e.error}}function wa(e,t){const n="output-restricted"===e,i=n?o.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:o.KEY_SYSTEM_STATUS_INTERNAL_ERROR;return new Ea({type:a.KEY_SYSTEM_ERROR,details:i,fatal:!1,decryptdata:t},n?"HDCP level output restricted":`key status changed to "${e}"`)}function ka(e,t){let n;try{n=new Event("addtrack")}catch(e){n=document.createEvent("Event"),n.initEvent("addtrack",!1,!1)}n.track=e,t.dispatchEvent(n)}function Sa(e,t){const n=e.mode;if("disabled"===n&&(e.mode="hidden"),e.cues&&!e.cues.getCueById(t.id))try{if(e.addCue(t),!e.cues.getCueById(t.id))throw new Error(`addCue is failed for: ${t}`)}catch(n){R.debug(`[texttrack-utils]: ${n}`);try{const n=new self.TextTrackCue(t.startTime,t.endTime,t.text);n.id=t.id,e.addCue(n)}catch(e){R.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${e}`)}}"disabled"===n&&(e.mode=n)}function Ta(e,t){const n=e.mode;if("disabled"===n&&(e.mode="hidden"),e.cues)for(let n=e.cues.length;n--;)t&&e.cues[n].removeEventListener("enter",t),e.removeCue(e.cues[n]);"disabled"===n&&(e.mode=n)}function Aa(e,t,n,i){const r=e.mode;if("disabled"===r&&(e.mode="hidden"),e.cues&&e.cues.length>0){const r=function(e,t,n){const i=[],r=function(e,t){if(t<=e[0].startTime)return 0;const n=e.length-1;if(t>e[n].endTime)return-1;let i,r=0,s=n;for(;r<=s;)if(i=Math.floor((s+r)/2),t<e[i].startTime)s=i-1;else{if(!(t>e[i].startTime&&r<n))return i;r=i+1}return e[r].startTime-t<t-e[s].startTime?r:s}(e,t);if(r>-1)for(let s=r,a=e.length;s<a;s++){const r=e[s];if(r.startTime>=t&&r.endTime<=n)i.push(r);else if(r.startTime>n)return i}return i}(e.cues,t,n);for(let t=0;t<r.length;t++)i&&!i(r[t])||e.removeCue(r[t])}"disabled"===r&&(e.mode=r)}function Ca(e){const t=[];for(let n=0;n<e.length;n++){const i=e[n];"subtitles"!==i.kind&&"captions"!==i.kind||!i.label||t.push(e[n])}return t}function Ra(e){let t=5381,n=e.length;for(;n;)t=33*t^e.charCodeAt(--n);return(t>>>0).toString()}const La=.025;let xa=function(e){return e[e.Point=0]="Point",e[e.Range=1]="Range",e}({});function Ia(e,t,n){return`${e.identifier}-${n+1}-${Ra(t)}`}class Da{constructor(e,t){this.base=void 0,this._duration=null,this._timelineStart=null,this.appendInPlaceDisabled=void 0,this.appendInPlaceStarted=void 0,this.dateRange=void 0,this.hasPlayed=!1,this.cumulativeDuration=0,this.resumeOffset=NaN,this.playoutLimit=NaN,this.restrictions={skip:!1,jump:!1},this.snapOptions={out:!1,in:!1},this.assetList=[],this.assetListLoader=void 0,this.assetListResponse=null,this.resumeAnchor=void 0,this.error=void 0,this.resetOnResume=void 0,this.base=t,this.dateRange=e,this.setDateRange(e)}setDateRange(e){this.dateRange=e,this.resumeOffset=e.attr.optionalFloat("X-RESUME-OFFSET",this.resumeOffset),this.playoutLimit=e.attr.optionalFloat("X-PLAYOUT-LIMIT",this.playoutLimit),this.restrictions=e.attr.enumeratedStringList("X-RESTRICT",this.restrictions),this.snapOptions=e.attr.enumeratedStringList("X-SNAP",this.snapOptions)}reset(){var e;this.appendInPlaceStarted=!1,null==(e=this.assetListLoader)||e.destroy(),this.assetListLoader=void 0,this.supplementsPrimary||(this.assetListResponse=null,this.assetList=[],this._duration=null)}isAssetPastPlayoutLimit(e){var t;if(e>0&&e>=this.assetList.length)return!0;const n=this.playoutLimit;if(e<=0||isNaN(n))return!1;if(0===n)return!0;return((null==(t=this.assetList[e])?void 0:t.startOffset)||0)>n}findAssetIndex(e){return this.assetList.indexOf(e)}get identifier(){return this.dateRange.id}get startDate(){return this.dateRange.startDate}get startTime(){const e=this.dateRange.startTime;if(this.snapOptions.out){const t=this.dateRange.tagAnchor;if(t)return Pa(e,t)}return e}get startOffset(){return this.cue.pre?0:this.startTime}get startIsAligned(){if(0===this.startTime||this.snapOptions.out)return!0;const e=this.dateRange.tagAnchor;if(e){const t=this.dateRange.startTime;return t-Pa(t,e)<.1}return!1}get resumptionOffset(){const e=this.resumeOffset,t=i(e)?e:this.duration;return this.cumulativeDuration+t}get resumeTime(){const e=this.startOffset+this.resumptionOffset;if(this.snapOptions.in){const t=this.resumeAnchor;if(t)return Pa(e,t)}return e}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)<La))}set appendInPlace(e){this.appendInPlaceStarted?this.resetOnResume=!e:this.appendInPlaceDisabled=!e}get timelineStart(){return null!==this._timelineStart?this._timelineStart:this.startTime}set timelineStart(e){this._timelineStart=e}get duration(){const e=this.playoutLimit;let t;return t=null!==this._duration?this._duration:this.dateRange.duration?this.dateRange.duration:this.dateRange.plannedDuration||0,!isNaN(e)&&e<t&&(t=e),t}set duration(e){this._duration=e}get cue(){return this.dateRange.cue}get timelineOccupancy(){return"RANGE"===this.dateRange.attr["X-TIMELINE-OCCUPIES"]?xa.Range:xa.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`["${(e=this).identifier}" ${e.cue.pre?"<pre>":e.cue.post?"<post>":""}${e.timelineStart.toFixed(2)}-${e.resumeTime.toFixed(2)}]`;var e}}function Pa(e,t){return e-t.start<t.duration/2&&!(Math.abs(e-(t.start+t.duration))<La)?t.start:t.start+t.duration}function Oa(e,t,n){const i=new self.URL(e,n);return"data:"!==i.protocol&&i.searchParams.set("_HLS_primary_id",t),i}function Ma(e,t){for(;null!=(n=e.assetList[++t])&&n.error;)var n;return t}function Na(e){const t=e.timelineStart,n=e.duration||0;return`["${e.identifier}" ${t.toFixed(2)}-${(t+n).toFixed(2)}]`}class Fa{constructor(e,t,n,i){this.hls=void 0,this.interstitial=void 0,this.assetItem=void 0,this.tracks=null,this.hasDetails=!1,this.mediaAttached=null,this._currentTime=void 0,this._bufferedEosTime=void 0,this.checkPlayout=()=>{this.reachedPlayout(this.currentTime)&&this.hls&&this.hls.trigger(l.PLAYOUT_LIMIT_REACHED,{})};const r=this.hls=new e(t);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,((e,{media:t})=>{this.removeMediaListeners(),this.mediaAttached=t;this.interstitial.playoutLimit&&(t.addEventListener("timeupdate",this.checkPlayout),this.appendInPlace&&r.on(l.BUFFER_APPENDED,(()=>{const e=this.bufferedEnd;this.reachedPlayout(e)&&(this._bufferedEosTime=e,r.trigger(l.BUFFERED_TO_END,void 0))})))}))}get appendInPlace(){return this.interstitial.appendInPlace}loadSource(){const e=this.hls;if(e)if(e.url)e.levels.length&&!e.started&&e.startLoad(-1,!0);else{let t=this.assetItem.uri;try{t=Oa(t,e.config.primarySessionId||"").href}catch(e){}e.loadSource(t)}}bufferedInPlaceToEnd(e){var t;if(!this.appendInPlace)return!1;if(null!=(t=this.hls)&&t.bufferedToEnd)return!0;if(!e)return!1;const n=Math.min(this._bufferedEosTime||1/0,this.duration),i=this.timelineOffset,r=nn.bufferInfo(e,i,0);return this.getAssetTime(r.end)>=n-.02}reachedPlayout(e){const t=this.interstitial.playoutLimit;return this.startOffset+e>=t}get destroyed(){var e;return!(null!=(e=this.hls)&&e.userConfig)}get assetId(){return this.assetItem.identifier}get interstitialId(){return this.assetItem.parentIdentifier}get media(){var e;return(null==(e=this.hls)?void 0:e.media)||null}get bufferedEnd(){const e=this.media||this.mediaAttached;if(!e)return this._bufferedEosTime?this._bufferedEosTime:this.currentTime;const t=nn.bufferInfo(e,e.currentTime,.001);return this.getAssetTime(t.end)}get currentTime(){const e=this.media||this.mediaAttached;return e?this.getAssetTime(e.currentTime):this._currentTime||0}get duration(){const e=this.assetItem.duration;if(!e)return 0;const t=this.interstitial.playoutLimit;if(t){const n=t-this.startOffset;if(n>0&&n<e)return n}return e}get remaining(){const e=this.duration;return e?Math.max(0,e-this.currentTime):0}get startOffset(){return this.assetItem.startOffset}get timelineOffset(){var e;return(null==(e=this.hls)?void 0:e.config.timelineOffset)||0}set timelineOffset(e){const t=this.timelineOffset;if(e!==t){const n=e-t;if(Math.abs(n)>1/9e4&&this.hls){if(this.hasDetails)throw new Error("Cannot set timelineOffset after playlists are loaded");this.hls.config.timelineOffset=e}}}getAssetTime(e){const t=this.timelineOffset,n=this.duration;return Math.min(Math.max(0,e-t),n)}removeMediaListeners(){const e=this.mediaAttached;e&&(this._currentTime=e.currentTime,this.bufferSnapShot(),e.removeEventListener("timeupdate",this.checkPlayout))}bufferSnapShot(){var e;this.mediaAttached&&(null!=(e=this.hls)&&e.bufferedToEnd&&(this._bufferedEosTime=this.bufferedEnd))}destroy(){this.removeMediaListeners(),this.hls&&this.hls.destroy(),this.hls=null,this.tracks=this.mediaAttached=this.checkPlayout=null}attachMedia(e){var t;this.loadSource(),null==(t=this.hls)||t.attachMedia(e)}detachMedia(){var e;this.removeMediaListeners(),this.mediaAttached=null,null==(e=this.hls)||e.detachMedia()}resumeBuffering(){var e;null==(e=this.hls)||e.resumeBuffering()}pauseBuffering(){var e;null==(e=this.hls)||e.pauseBuffering()}transferMedia(){var e;return this.bufferSnapShot(),(null==(e=this.hls)?void 0:e.transferMedia())||null}resetDetails(){const e=this.hls;if(e&&this.hasDetails){e.stopLoad();const t=e=>delete e.details;e.levels.forEach(t),e.allAudioTracks.forEach(t),e.allSubtitleTracks.forEach(t),this.hasDetails=!1}}on(e,t,n){var i;null==(i=this.hls)||i.on(e,t)}once(e,t,n){var i;null==(i=this.hls)||i.once(e,t)}off(e,t,n){var i;null==(i=this.hls)||i.off(e,t)}toString(){var e;return`HlsAssetPlayer: ${Na(this.assetItem)} ${null==(e=this.hls)?void 0:e.sessionId} ${this.appendInPlace?"append-in-place":""}`}}class Ba extends w{constructor(e,t){super("interstitials-sched",t),this.onScheduleUpdate=void 0,this.eventMap={},this.events=null,this.items=null,this.durations={primary:0,playout:0,integrated:0},this.onScheduleUpdate=e}destroy(){this.reset(),this.onScheduleUpdate=null}reset(){this.eventMap={},this.setDurations(0,0,0),this.events&&this.events.forEach((e=>e.reset())),this.events=this.items=null}resetErrorsInRange(e,t){return this.events?this.events.reduce(((n,i)=>e<=i.startOffset&&t>i.startOffset?(delete i.error,n+1):n),0):0}get duration(){const e=this.items;return e?e[e.length-1].end:0}get length(){return this.items?this.items.length:0}getEvent(e){return e&&this.eventMap[e]||null}hasEvent(e){return e in this.eventMap}findItemIndex(e,t){if(e.event)return this.findEventIndex(e.event.identifier);let n=-1;e.nextEvent?n=this.findEventIndex(e.nextEvent.identifier)-1:e.previousEvent&&(n=this.findEventIndex(e.previousEvent.identifier)+1);const i=this.items;if(i)for(i[n]||(void 0===t&&(t=e.start),n=this.findItemIndexAtTime(t));n>=0&&null!=(r=i[n])&&r.event;){var r;n--}return n}findItemIndexAtTime(e,t){const n=this.items;if(n)for(let i=0;i<n.length;i++){let r=n[i];if(t&&"primary"!==t&&(r=r[t]),e===r.start||e>r.start&&e<r.end)return i}return-1}findJumpRestrictedIndex(e,t){const n=this.items;if(n)for(let i=e;i<=t&&n[i];i++){const e=n[i].event;if(null!=e&&e.restrictions.jump&&!e.appendInPlace)return i}return-1}findEventIndex(e){const t=this.items;if(t)for(let i=t.length;i--;){var n;if((null==(n=t[i].event)?void 0:n.identifier)===e)return i}return-1}findAssetIndex(e,t){const n=e.assetList,i=n.length;if(i>1)for(let e=0;e<i;e++){const r=n[e];if(!r.error){const n=r.timelineStart;if(t===n||t>n&&(t<n+(r.duration||0)||e===i-1))return e}}return 0}get assetIdAtEnd(){var e;const t=null==(e=this.items)||null==(e=e[this.length-1])?void 0:e.event;if(t){const e=t.assetList,n=e[e.length-1];if(n)return n.identifier}return null}parseInterstitialDateRanges(e,t){const n=e.main.details,{dateRanges:i}=n,r=this.events,s=this.parseDateRanges(i,{url:n.url},t),a=Object.keys(i),o=r?r.filter((e=>!a.includes(e.identifier))):[];s.length&&s.sort(((e,t)=>{const n=e.cue.pre,i=e.cue.post,r=t.cue.pre,s=t.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=e.startTime,i=t.startTime;if(n!==i)return n-i}return e.dateRange.tagOrder-t.dateRange.tagOrder})),this.events=s,o.forEach((e=>{this.removeEvent(e)})),this.updateSchedule(e,o)}updateSchedule(e,t=[],n=!1){const i=this.events||[];if(i.length||t.length||this.length<2){const r=this.items,s=this.parseSchedule(i,e);(n||t.length||(null==r?void 0:r.length)!==s.length||s.some(((e,t)=>Math.abs(e.playout.start-r[t].playout.start)>.005||Math.abs(e.playout.end-r[t].playout.end)>.005)))&&(this.items=s,this.onScheduleUpdate(t,r))}}parseDateRanges(e,t,n){const i=[],r=Object.keys(e);for(let s=0;s<r.length;s++){const a=r[s],o=e[a];if(o.isInterstitial){let e=this.eventMap[a];e?e.setDateRange(o):(e=new Da(o,t),this.eventMap[a]=e,!1===n&&(e.appendInPlace=n)),i.push(e)}}return i}parseSchedule(e,t){const n=[],i=t.main.details,r=i.live?1/0:i.edge;let s=0;if((e=e.filter((e=>!(e.error||e.cue.once&&e.hasPlayed)))).length){this.resolveOffsets(e,t);let i=0,o=0;if(e.forEach(((t,a)=>{const l=t.cue.pre,u=t.cue.post,c=e[a-1]||null,h=t.appendInPlace,d=u?r:t.startOffset,f=t.duration,p=t.timelineOccupancy===xa.Range?f:0,_=t.resumptionOffset,g=(null==c?void 0:c.startTime)===d,m=d+t.cumulativeDuration;let v=h?m+f:d+_;if(l||!u&&d<=0){const e=o;o+=p,t.timelineStart=m;const i=s;s+=f,n.push({event:t,start:m,end:v,playout:{start:i,end:s},integrated:{start:e,end:o}})}else{if(!(d<=r))return;{if(!g){const r=d-i;if(r>.033){const l=i,u=o;o+=r;const c=s;s+=r;const h={previousEvent:e[a-1]||null,nextEvent:t,start:l,end:l+r,playout:{start:c,end:s},integrated:{start:u,end:o}};n.push(h)}else r>0&&c&&(c.cumulativeDuration+=r,n[n.length-1].end=d)}u&&(v=m),t.timelineStart=m;const r=o;o+=p;const l=s;s+=f,n.push({event:t,start:m,end:v,playout:{start:l,end:s},integrated:{start:r,end:o}})}}const y=t.resumeTime;i=u||y>r?r:y})),i<r){var a;const e=i,t=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:e+l,playout:{start:u,end:s},integrated:{start:t,end:o}})}this.setDurations(r,s,o)}else{const e=0;n.push({previousEvent:null,nextEvent:null,start:e,end:r,playout:{start:e,end:r},integrated:{start:e,end:r}}),this.setDurations(r,r,r)}return n}setDurations(e,t,n){this.durations={primary:e,playout:t,integrated:n}}resolveOffsets(e,t){const n=t.main.details,r=n.live?1/0:n.edge;let s=0,a=-1;e.forEach(((o,l)=>{const u=o.cue.pre,c=o.cue.post,h=u?0:c?r:o.startTime;this.updateAssetDurations(o);if(a===h?o.cumulativeDuration=s:(s=0,a=h),!c&&o.snapOptions.in&&(o.resumeAnchor=ft(null,n.fragments,o.startOffset+o.resumptionOffset,0,0)||void 0),o.appendInPlace&&!o.appendInPlaceStarted){this.primaryCanResumeInPlaceAt(o,t)||(o.appendInPlace=!1)}if(!o.appendInPlace&&l+1<e.length){e[l+1].startTime-e[l].resumeTime<.033&&(e[l+1].appendInPlace=!1,e[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(e,t){const n=e.resumeTime,i=e.startTime+e.resumptionOffset;if(Math.abs(n-i)>La)return this.log(`"${e.identifier}" resumption ${n} not aligned with estimated timeline end ${i}`),!1;return!Object.keys(t).some((i=>{const r=t[i].details,s=r.edge;if(n>=s)return this.log(`"${e.identifier}" resumption ${n} past ${i} playlist end ${s}`),!1;const a=ft(null,r.fragments,n);if(!a)return this.log(`"${e.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)<La+o||Math.abs(a.end-n)<La+o)&&(this.log(`"${e.identifier}" resumption ${n} not aligned with ${i} fragment bounds (${a.start}-${a.end} sn: ${a.sn} cc: ${a.cc})`),!0)}))}updateAssetDurations(e){if(!e.assetListLoaded)return;const t=e.timelineStart;let n=0,i=!1,r=!1;for(let s=0;s<e.assetList.length;s++){const a=e.assetList[s],o=t+n;a.startOffset=n,a.timelineStart=o,i||(i=null===a.duration),r||(r=!!a.error);n+=a.error?0:a.duration||0}e.duration=i&&!r?Math.max(n,e.duration):n}removeEvent(e){e.reset(),delete this.eventMap[e.identifier]}}function Ua(e){return`[${e.event?'"'+e.event.identifier+'"':"primary"}: ${e.start.toFixed(2)}-${e.end.toFixed(2)}]`}class Ka{constructor(e){this.hls=void 0,this.hls=e}destroy(){this.hls=null}loadAssetList(e,t){const n=e.assetListUrl;let i;try{i=Oa(n,this.hls.sessionId,e.baseUrl)}catch(t){const i=this.assignAssetListError(e,o.ASSET_LIST_LOAD_ERROR,t,n);return void this.hls.trigger(l.ERROR,i)}t&&"data:"!==i.protocol&&i.searchParams.set("_HLS_start_offset",""+t);const r=this.hls.config,s=new(0,r.loader)(r),a={responseType:"json",url:i.href},u=r.interstitialAssetListLoadPolicy.default,c={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},h={onSuccess:(t,n,i,r)=>{const s=t.data,a=null==s?void 0:s.ASSETS;if(Array.isArray(a))e.assetListResponse=s,this.hls.trigger(l.ASSET_LIST_LOADED,{event:e,assetListResponse:s,networkDetails:r});else{const t=this.assignAssetListError(e,o.ASSET_LIST_PARSING_ERROR,new Error("Invalid interstitial asset list"),i.url,n,r);this.hls.trigger(l.ERROR,t)}},onError:(t,n,i,r)=>{const s=this.assignAssetListError(e,o.ASSET_LIST_LOAD_ERROR,new Error(`Error loading X-ASSET-LIST: HTTP status ${t.code} ${t.text} (${n.url})`),n.url,r,i);this.hls.trigger(l.ERROR,s)},onTimeout:(t,n,i)=>{const r=this.assignAssetListError(e,o.ASSET_LIST_LOAD_TIMEOUT,new Error(`Timeout loading X-ASSET-LIST (${n.url})`),n.url,t,i);this.hls.trigger(l.ERROR,r)}};return s.load(a,c,h),this.hls.trigger(l.ASSET_LIST_LOADING,{event:e}),s}assignAssetListError(e,t,n,i,r,s){return e.error=n,{type:a.NETWORK_ERROR,details:t,fatal:!1,interstitial:e,url:i,error:n,networkDetails:s,stats:r}}}function $a(e){null==e||e.play().catch((()=>{}))}function Ga(e,t){return`[${e}] Advancing timeline position to ${t}`}class ja{constructor(e){this.buffered=void 0;const t=(t,n,i)=>{if((n>>>=0)>i-1)throw new DOMException(`Failed to execute '${t}' on 'TimeRanges': The index provided (${n}) is greater than the maximum bound (${i})`);return e[n][t]};this.buffered={get length(){return e.length},end(n){return t("end",n,e.length)},start(n){return t("start",n,e.length)}}}}const Va={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},Za=e=>String.fromCharCode(Va[e]||e),Ha=15,za=100,Wa={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},qa={17:2,18:4,21:6,22:8,23:10,19:13,20:15},Ya={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},Xa={25:2,26:4,29:6,30:8,31:10,27:13,28:15},Qa=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class Ja{constructor(){this.time=null,this.verboseLevel=0}log(e,t){if(this.verboseLevel>=e){const n="function"==typeof t?t():t;R.log(`${this.time} [${e}] ${n}`)}}}const eo=function(e){const t=[];for(let n=0;n<e.length;n++)t.push(e[n].toString(16));return t};class to{constructor(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}reset(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}setStyles(e){const t=["foreground","underline","italics","background","flash"];for(let n=0;n<t.length;n++){const i=t[n];e.hasOwnProperty(i)&&(this[i]=e[i])}}isDefault(){return"white"===this.foreground&&!this.underline&&!this.italics&&"black"===this.background&&!this.flash}equals(e){return this.foreground===e.foreground&&this.underline===e.underline&&this.italics===e.italics&&this.background===e.background&&this.flash===e.flash}copy(e){this.foreground=e.foreground,this.underline=e.underline,this.italics=e.italics,this.background=e.background,this.flash=e.flash}toString(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash}}class no{constructor(){this.uchar=" ",this.penState=new to}reset(){this.uchar=" ",this.penState.reset()}setChar(e,t){this.uchar=e,this.penState.copy(t)}setPenState(e){this.penState.copy(e)}equals(e){return this.uchar===e.uchar&&this.penState.equals(e.penState)}copy(e){this.uchar=e.uchar,this.penState.copy(e.penState)}isEmpty(){return" "===this.uchar&&this.penState.isDefault()}}class io{constructor(e){this.chars=[],this.pos=0,this.currPenState=new to,this.cueStartTime=null,this.logger=void 0;for(let e=0;e<za;e++)this.chars.push(new no);this.logger=e}equals(e){for(let t=0;t<za;t++)if(!this.chars[t].equals(e.chars[t]))return!1;return!0}copy(e){for(let t=0;t<za;t++)this.chars[t].copy(e.chars[t])}isEmpty(){let e=!0;for(let t=0;t<za;t++)if(!this.chars[t].isEmpty()){e=!1;break}return e}setCursor(e){this.pos!==e&&(this.pos=e),this.pos<0?(this.logger.log(3,"Negative cursor position "+this.pos),this.pos=0):this.pos>za&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=za)}moveCursor(e){const t=this.pos+e;if(e>1)for(let e=this.pos+1;e<t+1;e++)this.chars[e].setPenState(this.currPenState);this.setCursor(t)}backSpace(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)}insertChar(e){e>=144&&this.backSpace();const t=Za(e);this.pos>=za?this.logger.log(0,(()=>"Cannot insert "+e.toString(16)+" ("+t+") at position "+this.pos+". Skipping it!")):(this.chars[this.pos].setChar(t,this.currPenState),this.moveCursor(1))}clearFromPos(e){let t;for(t=e;t<za;t++)this.chars[t].reset()}clear(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()}clearToEndOfRow(){this.clearFromPos(this.pos)}getTextString(){const e=[];let t=!0;for(let n=0;n<za;n++){const i=this.chars[n].uchar;" "!==i&&(t=!1),e.push(i)}return t?"":e.join("")}setPenStyles(e){this.currPenState.setStyles(e);this.chars[this.pos].setPenState(this.currPenState)}}class ro{constructor(e){this.rows=[],this.currRow=14,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(let t=0;t<Ha;t++)this.rows.push(new io(e));this.logger=e}reset(){for(let e=0;e<Ha;e++)this.rows[e].clear();this.currRow=14}equals(e){let t=!0;for(let n=0;n<Ha;n++)if(!this.rows[n].equals(e.rows[n])){t=!1;break}return t}copy(e){for(let t=0;t<Ha;t++)this.rows[t].copy(e.rows[t])}isEmpty(){let e=!0;for(let t=0;t<Ha;t++)if(!this.rows[t].isEmpty()){e=!1;break}return e}backSpace(){this.rows[this.currRow].backSpace()}clearToEndOfRow(){this.rows[this.currRow].clearToEndOfRow()}insertChar(e){this.rows[this.currRow].insertChar(e)}setPen(e){this.rows[this.currRow].setPenStyles(e)}moveCursor(e){this.rows[this.currRow].moveCursor(e)}setCursor(e){this.logger.log(2,"setCursor: "+e);this.rows[this.currRow].setCursor(e)}setPAC(e){this.logger.log(2,(()=>"pacData = "+it(e)));let t=e.row-1;if(this.nrRollUpRows&&t<this.nrRollUpRows-1&&(t=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==t){for(let e=0;e<Ha;e++)this.rows[e].clear();const e=this.currRow+1-this.nrRollUpRows,n=this.lastOutputScreen;if(n){const i=n.rows[e].cueStartTime,r=this.logger.time;if(null!==i&&null!==r&&i<r)for(let i=0;i<this.nrRollUpRows;i++)this.rows[t-this.nrRollUpRows+i+1].copy(n.rows[e+i])}}this.currRow=t;const n=this.rows[this.currRow];if(null!==e.indent){const t=e.indent,i=Math.max(t-1,0);n.setCursor(e.indent),e.color=n.chars[i].penState.foreground}const i={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(i)}setBkgData(e){this.logger.log(2,(()=>"bkgData = "+it(e))),this.backSpace(),this.setPen(e),this.insertChar(32)}setRollUpRows(e){this.nrRollUpRows=e}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 e=this.currRow+1-this.nrRollUpRows,t=this.rows.splice(e,1)[0];t.clear(),this.rows.splice(this.currRow,0,t),this.logger.log(2,"Rolling up")}getDisplayText(e){e=e||!1;const t=[];let n="",i=-1;for(let n=0;n<Ha;n++){const r=this.rows[n].getTextString();r&&(i=n+1,e?t.push("Row "+i+": '"+r+"'"):t.push(r.trim()))}return t.length>0&&(n=e?"["+t.join(" | ")+"]":t.join("\n")),n}getTextAndFormat(){return this.rows}}class so{constructor(e,t,n){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=e,this.outputFilter=t,this.mode=null,this.verbose=0,this.displayedMemory=new ro(n),this.nonDisplayedMemory=new ro(n),this.lastOutputScreen=new ro(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(e){this.outputFilter=e}setPAC(e){this.writeScreen.setPAC(e)}setBkgData(e){this.writeScreen.setBkgData(e)}setMode(e){e!==this.mode&&(this.mode=e,this.logger.log(2,(()=>"MODE="+e)),"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=e)}insertChars(e){for(let t=0;t<e.length;t++)this.writeScreen.insertChar(e[t]);const t=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(2,(()=>t+": "+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(e){this.logger.log(2,"RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e)}ccFON(){this.logger.log(2,"FON - Flash On"),this.writeScreen.setPen({flash:!0})}ccRDC(){this.logger.log(2,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")}ccTR(){this.logger.log(2,"TR"),this.setMode("MODE_TEXT")}ccRTD(){this.logger.log(2,"RTD"),this.setMode("MODE_TEXT")}ccEDM(){this.logger.log(2,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)}ccCR(){this.logger.log(2,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)}ccENM(){this.logger.log(2,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()}ccEOC(){if(this.logger.log(2,"EOC - End Of Caption"),"MODE_POP-ON"===this.mode){const e=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=e,this.writeScreen=this.nonDisplayedMemory,this.logger.log(1,(()=>"DISP: "+this.displayedMemory.getDisplayText()))}this.outputDataUpdate(!0)}ccTO(e){this.logger.log(2,"TO("+e+") - Tab Offset"),this.writeScreen.moveCursor(e)}ccMIDROW(e){const t={flash:!1};if(t.underline=e%2==1,t.italics=e>=46,t.italics)t.foreground="white";else{const n=Math.floor(e/2)-16,i=["white","green","blue","cyan","red","yellow","magenta"];t.foreground=i[n]}this.logger.log(2,"MIDROW: "+it(t)),this.writeScreen.setPen(t)}outputDataUpdate(e=!1){const t=this.logger.time;null!==t&&this.outputFilter&&(null!==this.cueStartTime||this.displayedMemory.isEmpty()?this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,t,this.lastOutputScreen),e&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:t):this.cueStartTime=t,this.lastOutputScreen.copy(this.displayedMemory))}cueSplitAtTime(e){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e))}}class ao{constructor(e,t,n){this.channels=void 0,this.currentChannel=0,this.cmdHistory={a:null,b:null},this.logger=void 0;const i=this.logger=new Ja;this.channels=[null,new so(e,t,i),new so(e+1,n,i)]}getHandler(e){return this.channels[e].getHandler()}setHandler(e,t){this.channels[e].setHandler(t)}addData(e,t){this.logger.time=e;for(let e=0;e<t.length;e+=2){const n=127&t[e],i=127&t[e+1];let r=!1,s=null;if(0===n&&0===i)continue;this.logger.log(3,(()=>"["+eo([t[e],t[e+1]])+"] -> ("+eo([n,i])+")"));const a=this.cmdHistory;if(n>=16&&n<=31){if(lo(n,i,a)){oo(null,null,a),this.logger.log(3,(()=>"Repeated command ("+eo([n,i])+") is dropped"));continue}oo(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 oo(null,null,a);if(!r&&(s=this.parseChars(n,i),s)){const e=this.currentChannel;if(e&&e>0){this.channels[e].insertChars(s)}else this.logger.log(2,"No channel found yet. TEXT-MODE?")}r||s||this.logger.log(2,(()=>"Couldn't parse cleaned data "+eo([n,i])+" orig: "+eo([t[e],t[e+1]])))}}parseCmd(e,t){if(!((20===e||28===e||21===e||29===e)&&t>=32&&t<=47)&&!((23===e||31===e)&&t>=33&&t<=35))return!1;const n=20===e||21===e||23===e?1:2,i=this.channels[n];return 20===e||21===e||28===e||29===e?32===t?i.ccRCL():33===t?i.ccBS():34===t?i.ccAOF():35===t?i.ccAON():36===t?i.ccDER():37===t?i.ccRU(2):38===t?i.ccRU(3):39===t?i.ccRU(4):40===t?i.ccFON():41===t?i.ccRDC():42===t?i.ccTR():43===t?i.ccRTD():44===t?i.ccEDM():45===t?i.ccCR():46===t?i.ccENM():47===t&&i.ccEOC():i.ccTO(t-32),this.currentChannel=n,!0}parseMidrow(e,t){let n=0;if((17===e||25===e)&&t>=32&&t<=47){if(n=17===e?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(t),this.logger.log(3,(()=>"MIDROW ("+eo([e,t])+")")),!0)}return!1}parsePAC(e,t){let n;if(!((e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127)&&!((16===e||24===e)&&t>=64&&t<=95))return!1;const i=e<=23?1:2;n=t>=64&&t<=95?1===i?Wa[e]:Ya[e]:1===i?qa[e]:Xa[e];const r=this.channels[i];return!!r&&(r.setPAC(this.interpretPAC(n,t)),this.currentChannel=i,!0)}interpretPAC(e,t){let n;const i={color:null,italics:!1,indent:null,underline:!1,row:e};return n=t>95?t-96:t-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(e,t){let n,i=null,r=null;if(e>=25?(n=2,r=e-8):(n=1,r=e),r>=17&&r<=19){let e;e=17===r?t+80:18===r?t+112:t+144,this.logger.log(2,(()=>"Special char '"+Za(e)+"' in channel "+n)),i=[e]}else e>=32&&e<=127&&(i=0===t?[e]:[e,t]);return i&&this.logger.log(3,(()=>"Char codes = "+eo(i).join(","))),i}parseBackgroundAttributes(e,t){if(!((16===e||24===e)&&t>=32&&t<=47)&&!((23===e||31===e)&&t>=45&&t<=47))return!1;let n;const i={};16===e||24===e?(n=Math.floor((t-32)/2),i.background=Qa[n],t%2==1&&(i.background=i.background+"_semi")):45===t?i.background="transparent":(i.foreground="black",47===t&&(i.underline=!0));const r=e<=23?1:2;return this.channels[r].setBkgData(i),!0}reset(){for(let e=0;e<Object.keys(this.channels).length;e++){const t=this.channels[e];t&&t.reset()}oo(null,null,this.cmdHistory)}cueSplitAtTime(e){for(let t=0;t<this.channels.length;t++){const n=this.channels[t];n&&n.cueSplitAtTime(e)}}}function oo(e,t,n){n.a=e,n.b=t}function lo(e,t,n){return n.a===e&&n.b===t}var uo=function(){if(null!=kn&&kn.VTTCue)return self.VTTCue;const e=["","lr","rl"],t=["start","middle","end","left","right"];function n(e,t){if("string"!=typeof t)return!1;if(!Array.isArray(e))return!1;const n=t.toLowerCase();return!!~e.indexOf(n)&&n}function i(e){return n(t,e)}function r(e,...t){let n=1;for(;n<arguments.length;n++){const t=arguments[n];for(const n in t)e[n]=t[n]}return e}function s(t,s,a){const o=this,l={enumerable:!0};o.hasBeenReset=!1;let u="",c=!1,h=t,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(e){u=""+e}})),Object.defineProperty(o,"pauseOnExit",r({},l,{get:function(){return c},set:function(e){c=!!e}})),Object.defineProperty(o,"startTime",r({},l,{get:function(){return h},set:function(e){if("number"!=typeof e)throw new TypeError("Start time must be set to a number.");h=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"endTime",r({},l,{get:function(){return d},set:function(e){if("number"!=typeof e)throw new TypeError("End time must be set to a number.");d=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"text",r({},l,{get:function(){return f},set:function(e){f=""+e,this.hasBeenReset=!0}})),Object.defineProperty(o,"region",r({},l,{get:function(){return p},set:function(e){p=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"vertical",r({},l,{get:function(){return _},set:function(t){const i=function(t){return n(e,t)}(t);if(!1===i)throw new SyntaxError("An invalid or illegal string was specified.");_=i,this.hasBeenReset=!0}})),Object.defineProperty(o,"snapToLines",r({},l,{get:function(){return g},set:function(e){g=!!e,this.hasBeenReset=!0}})),Object.defineProperty(o,"line",r({},l,{get:function(){return m},set:function(e){if("number"!=typeof e&&"auto"!==e)throw new SyntaxError("An invalid number or illegal string was specified.");m=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"lineAlign",r({},l,{get:function(){return v},set:function(e){const t=i(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");v=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"position",r({},l,{get:function(){return y},set:function(e){if(e<0||e>100)throw new Error("Position must be between 0 and 100.");y=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"positionAlign",r({},l,{get:function(){return b},set:function(e){const t=i(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");b=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"size",r({},l,{get:function(){return E},set:function(e){if(e<0||e>100)throw new Error("Size must be between 0 and 100.");E=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"align",r({},l,{get:function(){return w},set:function(e){const t=i(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");w=t,this.hasBeenReset=!0}})),o.displayState=void 0}return s.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},s}();class co{decode(e,t){if(!e)return"";if("string"!=typeof e)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}function ho(e){function t(e,t,n,i){return 3600*(0|e)+60*(0|t)+(0|n)+parseFloat(i||0)}const n=e.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return n?parseFloat(n[2])>59?t(n[2],n[3],0,n[4]):t(n[1],n[2],n[3],n[4]):null}class fo{constructor(){this.values=Object.create(null)}set(e,t){this.get(e)||""===t||(this.values[e]=t)}get(e,t,n){return n?this.has(e)?this.values[e]:t[n]:this.has(e)?this.values[e]:t}has(e){return e in this.values}alt(e,t,n){for(let i=0;i<n.length;++i)if(t===n[i]){this.set(e,t);break}}integer(e,t){/^-?\d+$/.test(t)&&this.set(e,parseInt(t,10))}percent(e,t){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(t)){const n=parseFloat(t);if(n>=0&&n<=100)return this.set(e,n),!0}return!1}}function po(e,t,n,i){const r=i?e.split(i):[e];for(const e in r){if("string"!=typeof r[e])continue;const i=r[e].split(n);if(2!==i.length)continue;t(i[0],i[1])}}const _o=new uo(0,0,""),go="middle"===_o.align?"middle":"center";function mo(e,t,n){const i=e;function r(){const t=ho(e);if(null===t)throw new Error("Malformed timestamp: "+i);return e=e.replace(/^[^\sa-zA-Z-]+/,""),t}function s(){e=e.replace(/^\s+/,"")}if(s(),t.startTime=r(),s(),"--\x3e"!==e.slice(0,3))throw new Error("Malformed time stamp (time stamps must be separated by '--\x3e'): "+i);e=e.slice(3),s(),t.endTime=r(),s(),function(e,t){const i=new fo;po(e,(function(e,t){let r;switch(e){case"region":for(let r=n.length-1;r>=0;r--)if(n[r].id===t){i.set(e,n[r].region);break}break;case"vertical":i.alt(e,t,["rl","lr"]);break;case"line":r=t.split(","),i.integer(e,r[0]),i.percent(e,r[0])&&i.set("snapToLines",!1),i.alt(e,r[0],["auto"]),2===r.length&&i.alt("lineAlign",r[1],["start",go,"end"]);break;case"position":r=t.split(","),i.percent(e,r[0]),2===r.length&&i.alt("positionAlign",r[1],["start",go,"end","line-left","line-right","auto"]);break;case"size":i.percent(e,t);break;case"align":i.alt(e,t,["start",go,"end","left","right"])}}),/:/,/\s/),t.region=i.get("region",null),t.vertical=i.get("vertical","");let r=i.get("line","auto");"auto"===r&&-1===_o.line&&(r=-1),t.line=r,t.lineAlign=i.get("lineAlign","start"),t.snapToLines=i.get("snapToLines",!0),t.size=i.get("size",100),t.align=i.get("align",go);let s=i.get("position","auto");"auto"===s&&50===_o.position&&(s="start"===t.align||"left"===t.align?0:"end"===t.align||"right"===t.align?100:50),t.position=s}(e,t)}function vo(e){return e.replace(/<br(?: \/)?>/gi,"\n")}class yo{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new co,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}parse(e){const t=this;function n(){let e=t.buffer,n=0;for(e=vo(e);n<e.length&&"\r"!==e[n]&&"\n"!==e[n];)++n;const i=e.slice(0,n);return"\r"===e[n]&&++n,"\n"===e[n]&&++n,t.buffer=e.slice(n),i}e&&(t.buffer+=t.decoder.decode(e,{stream:!0}));try{let e="";if("INITIAL"===t.state){if(!/\r\n|\n/.test(t.buffer))return this;e=n();const i=e.match(/^()?WEBVTT([ \t].*)?$/);if(null==i||!i[0])throw new Error("Malformed WebVTT signature.");t.state="HEADER"}let i=!1;for(;t.buffer;){if(!/\r\n|\n/.test(t.buffer))return this;switch(i?i=!1:e=n(),t.state){case"HEADER":/:/.test(e)?po(e,(function(e,t){}),/:/):e||(t.state="ID");continue;case"NOTE":e||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(e)){t.state="NOTE";break}if(!e)continue;if(t.cue=new uo(0,0,""),t.state="CUE",-1===e.indexOf("--\x3e")){t.cue.id=e;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{mo(e,t.cue,t.regionList)}catch(e){t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":{const n=-1!==e.indexOf("--\x3e");if(!e||n&&(i=!0)){t.oncue&&t.cue&&t.oncue(t.cue),t.cue=null,t.state="ID";continue}if(null===t.cue)continue;t.cue.text&&(t.cue.text+="\n"),t.cue.text+=e}continue;case"BADCUE":e||(t.state="ID")}}}catch(e){"CUETEXT"===t.state&&t.cue&&t.oncue&&t.oncue(t.cue),t.cue=null,t.state="INITIAL"===t.state?"BADWEBVTT":"BADCUE"}return this}flush(){const e=this;try{if((e.cue||"HEADER"===e.state)&&(e.buffer+="\n\n",e.parse()),"INITIAL"===e.state||"BADWEBVTT"===e.state)throw new Error("Malformed WebVTT signature.")}catch(t){e.onparsingerror&&e.onparsingerror(t)}return e.onflush&&e.onflush(),this}}const bo=/\r\n|\n\r|\n|\r/g,Eo=function(e,t,n=0){return e.slice(n,n+t.length)===t};function wo(e,t,n){return Ra(e.toString())+Ra(t.toString())+Ra(n)}function ko(e,t,n,r,s,a,o){const l=new yo,u=I(new Uint8Array(e)).trim().replace(bo,"\n").split("\n"),c=[],h=t?function(e,t=1){return Zr(e,9e4,1/t)}(t.baseTime,t.timescale):0;let d,f="00:00.000",p=0,_=0,g=!0;l.oncue=function(e){const i=n[r];let a=n.ccOffset;const o=(p-h)/9e4;if(null!=i&&i.new&&(void 0!==_?a=n.ccOffset=i.start:function(e,t,n){let i=e[t],r=e[i.prevCC];if(!r||!r.new&&i.new)return e.ccOffset=e.presentationOffset=i.start,void(i.new=!1);for(;null!=(s=r)&&s.new;){var s;e.ccOffset+=i.start-r.start,i.new=!1,i=r,r=e[i.prevCC]}e.presentationOffset=n}(n,r,o)),o){if(!t)return void(d=new Error("Missing initPTS for VTT MPEGTS"));a=o-n.presentationOffset}const l=e.endTime-e.startTime,u=Jr(9e4*(e.startTime+a-_),9e4*s)/9e4;e.startTime=Math.max(u,0),e.endTime=Math.max(u+l,0);const f=e.text.trim();e.text=decodeURIComponent(encodeURIComponent(f)),e.id||(e.id=wo(e.startTime,e.endTime,f)),e.endTime>0&&c.push(e)},l.onparsingerror=function(e){d=e},l.onflush=function(){d?o(d):a(c)},u.forEach((e=>{if(g){if(Eo(e,"X-TIMESTAMP-MAP=")){g=!1,e.slice(16).split(",").forEach((e=>{Eo(e,"LOCAL:")?f=e.slice(6):Eo(e,"MPEGTS:")&&(p=parseInt(e.slice(7)))}));try{_=function(e){let t=parseInt(e.slice(-3));const n=parseInt(e.slice(-6,-4)),r=parseInt(e.slice(-9,-7)),s=e.length>9?parseInt(e.substring(0,e.indexOf(":"))):0;if(!(i(t)&&i(n)&&i(r)&&i(s)))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${e}`);return t+=1e3*n,t+=6e4*r,t+=36e5*s,t}(f)/1e3}catch(e){d=e}return}""===e&&(g=!1)}l.parse(e+"\n")})),l.flush()}const So="stpp.ttml.im1t",To=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,Ao=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,Co={left:"start",center:"center",right:"end",start:"start",end:"end"};function Ro(e,t,n,i){const r=ae(new Uint8Array(e),["mdat"]);if(0===r.length)return void i(new Error("Could not parse IMSC1 mdat"));const s=r.map((e=>I(e))),a=function(e,t,n=1,i=!1){return Zr(e,t,1/n,i)}(t.baseTime,1,t.timescale);try{s.forEach((e=>n(function(e,t){const n=(new DOMParser).parseFromString(e,"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(((e,t)=>(e[t]=i.getAttribute(`ttp:${t}`)||r[t],e)),{}),a="preserve"!==i.getAttribute("xml:space"),o=xo(Lo(i,"styling","style")),l=xo(Lo(i,"layout","region")),u=Lo(i,"body","[begin]");return[].map.call(u,(e=>{const n=Io(e,a);if(!n||!e.hasAttribute("begin"))return null;const i=Oo(e.getAttribute("begin"),s),r=Oo(e.getAttribute("dur"),s);let u=Oo(e.getAttribute("end"),s);if(null===i)throw Po(e);if(null===u){if(null===r)throw Po(e);u=i+r}const c=new uo(i-t,u-t,n);c.id=wo(c.startTime,c.endTime,c.text);const h=function(e,t,n){const i="http://www.w3.org/ns/ttml#styling";let r=null;const s=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],a=null!=e&&e.hasAttribute("style")?e.getAttribute("style"):null;a&&n.hasOwnProperty(a)&&(r=n[a]);return s.reduce(((n,s)=>{const a=Do(t,i,s)||Do(e,i,s)||Do(r,i,s);return a&&(n[s]=a),n}),{})}(l[e.getAttribute("region")],o[e.getAttribute("style")],o),{textAlign:d}=h;if(d){const e=Co[d];e&&(c.lineAlign=e),c.align=d}return y(c,h),c})).filter((e=>null!==e))}(e,a))))}catch(e){i(e)}}function Lo(e,t,n){const i=e.getElementsByTagName(t)[0];return i?[].slice.call(i.querySelectorAll(n)):[]}function xo(e){return e.reduce(((e,t)=>{const n=t.getAttribute("xml:id");return n&&(e[n]=t),e}),{})}function Io(e,t){return[].slice.call(e.childNodes).reduce(((e,n,i)=>{var r;return"br"===n.nodeName&&i?e+"\n":null!=(r=n.childNodes)&&r.length?Io(n,t):t?e+n.textContent.trim().replace(/\s+/g," "):e+n.textContent}),"")}function Do(e,t,n){return e&&e.hasAttributeNS(t,n)?e.getAttributeNS(t,n):null}function Po(e){return new Error(`Could not parse ttml timestamp ${e}`)}function Oo(e,t){if(!e)return null;let n=ho(e);return null===n&&(To.test(e)?n=function(e,t){const n=To.exec(e),i=(0|n[4])+(0|n[5])/t.subFrameRate;return 3600*(0|n[1])+60*(0|n[2])+(0|n[3])+i/t.frameRate}(e,t):Ao.test(e)&&(n=function(e,t){const n=Ao.exec(e),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/t.frameRate;case"t":return i/t.tickRate}return i}(e,t))),n}class Mo{constructor(e,t){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=e,this.trackName=t}dispatchCue(){null!==this.startTime&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)}newCue(e,t,n){(null===this.startTime||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=n,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}}function No(e){return e.characteristics&&/transcribes-spoken-dialog/gi.test(e.characteristics)&&/describes-music-and-sound/gi.test(e.characteristics)?"captions":"subtitles"}function Fo(e,t){return!!e&&e.kind===No(t)&&_s(t,e)}const Bo=/\s/,Uo={newCue(e,t,n,i){const r=[];let s,a,o,l,u;const c=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 h;for(let e=0;e<s.chars.length;e++)Bo.test(s.chars[e].uchar)&&o?l++:(u+=s.chars[e].uchar,o=!1);s.cueStartTime=t,t===n&&(n+=1e-4),l>=16?l--:l++;const i=vo(u.trim()),f=wo(t,n,i);null!=e&&null!=(h=e.cues)&&h.getCueById(f)||(a=new c(t,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 e&&r.length&&(r.sort(((e,t)=>"auto"===e.line||"auto"===t.line?0:e.line>8&&t.line>8?t.line-e.line:e.line-t.line)),r.forEach((t=>Sa(e,t)))),r}};const Ko=/(\d+)-(\d+)\/(\d+)/;class $o{constructor(e){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=null,this.response=null,this.controller=void 0,this.context=null,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=e.fetchSetup||Go,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 e;this.abortInternal(),null!=(e=this.callbacks)&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)}load(e,t,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(e,t){const n={method:"GET",mode:"cors",credentials:"same-origin",signal:t,headers:new self.Headers(y({},e.headers))};e.rangeEnd&&n.headers.set("Range","bytes="+e.rangeStart+"-"+String(e.rangeEnd-1));return n}(e,this.controller.signal),a="arraybuffer"===e.responseType,o=a?"byteLength":"length",{maxTimeToFirstByteMs:l,maxLoadTimeMs:u}=t.loadPolicy;this.context=e,this.config=t,this.callbacks=n,this.request=this.fetchSetup(e,s),self.clearTimeout(this.requestTimeout),t.timeout=l&&i(l)?l:u,this.requestTimeout=self.setTimeout((()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(r,e,this.response))}),t.timeout);(os(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),t.timeout=u,this.requestTimeout=self.setTimeout((()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(r,e,this.response))}),u-(o-r.loading.start)),!n.ok){const{status:e,statusText:t}=n;throw new jo(t||"fetch, bad network response",e,n)}r.loading.first=o,r.total=function(e){const t=e.get("Content-Range");if(t){const e=function(e){const t=Ko.exec(e);if(t)return parseInt(t[2])-parseInt(t[1])+1}(t);if(i(e))return e}const n=e.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(t.highWaterMark)?this.loadProgressively(n,r,e,t.highWaterMark,l):a?n.arrayBuffer():"json"===e.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 c={url:l.url,data:n,code:l.status},h=null==(s=this.callbacks)?void 0:s.onProgress;h&&!i(t.highWaterMark)&&h(r,e,n,l),null==(a=this.callbacks)||a.onSuccess(c,r,e,l)})).catch((t=>{var n;if(self.clearTimeout(this.requestTimeout),r.aborted)return;const i=t&&t.code||0,s=t?t.message:null;null==(n=this.callbacks)||n.onError({code:i,text:s},e,t?t.details:null,r)}))}getCacheAge(){let e=null;if(this.response){const t=this.response.headers.get("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.response?this.response.headers.get(e):null}loadProgressively(e,t,n,i=0,r){const s=new Ni,a=e.body.getReader(),o=()=>a.read().then((a=>{if(a.done)return s.dataLength&&r(t,n,s.flush().buffer,e),Promise.resolve(new ArrayBuffer(0));const l=a.value,u=l.length;return t.loaded+=u,u<i||s.dataLength?(s.push(l),s.dataLength>=i&&r(t,n,s.flush().buffer,e)):r(t,n,l.buffer,e),o()})).catch((()=>Promise.reject()));return o()}}function Go(e,t){return new self.Request(e.url,t)}class jo extends Error{constructor(e,t,n){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=n}}const Vo=/^age:\s*[\d.]+\s*$/im;class Zo{constructor(e){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=null,this.loader=null,this.stats=void 0,this.xhrSetup=e&&e.xhrSetup||null,this.stats=new j,this.retryDelay=0}destroy(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null,this.context=null,this.xhrSetup=null}abortInternal(){const e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,4!==e.readyState&&(this.stats.aborted=!0,e.abort()))}abort(){var e;this.abortInternal(),null!=(e=this.callbacks)&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)}load(e,t,n){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=e,this.config=t,this.callbacks=n,this.loadInternal()}loadInternal(){const{config:e,context:t}=this;if(!e||!t)return;const n=this.loader=new self.XMLHttpRequest,i=this.stats;i.loading.first=0,i.loaded=0,i.aborted=!1;const r=this.xhrSetup;r?Promise.resolve().then((()=>{if(this.loader===n&&!this.stats.aborted)return r(n,t.url)})).catch((e=>{if(this.loader===n&&!this.stats.aborted)return n.open("GET",t.url,!0),r(n,t.url)})).then((()=>{this.loader!==n||this.stats.aborted||this.openAndSendXhr(n,t,e)})).catch((e=>{var r;null==(r=this.callbacks)||r.onError({code:n.status,text:e.message},t,n,i)})):this.openAndSendXhr(n,t,e)}openAndSendXhr(e,t,n){e.readyState||e.open("GET",t.url,!0);const r=t.headers,{maxTimeToFirstByteMs:s,maxLoadTimeMs:a}=n.loadPolicy;if(r)for(const t in r)e.setRequestHeader(t,r[t]);t.rangeEnd&&e.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),e.onreadystatechange=this.readystatechange.bind(this),e.onprogress=this.loadprogress.bind(this),e.responseType=t.responseType,self.clearTimeout(this.requestTimeout),n.timeout=s&&i(s)?s:a,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),n.timeout),e.send()}readystatechange(){const{context:e,loader:t,stats:n}=this;if(!e||!t)return;const i=t.readyState,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),t.onreadystatechange=null,t.onprogress=null;const i=t.status,l="text"===t.responseType?t.responseText:null;if(i>=200&&i<300){const r=null!=l?l:t.response;if(null!=r){var s,a;n.loading.end=Math.max(self.performance.now(),n.loading.first);const o="arraybuffer"===t.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,e,r,t);const u={url:t.responseURL,data:r,code:i};return void(null==(a=this.callbacks)||a.onSuccess(u,n,e,t))}}const u=r.loadPolicy.errorRetry;var o;if(kt(u,n.retry,!1,{url:e.url,data:void 0,code:i}))this.retry(u);else R.error(`${i} while loading ${e.url}`),null==(o=this.callbacks)||o.onError({code:i,text:t.statusText},e,t,n)}}loadtimeout(){if(!this.config)return;const e=this.config.loadPolicy.timeoutRetry;if(kt(e,this.stats.retry,!0))this.retry(e);else{var t;R.warn(`timeout while loading ${null==(t=this.context)?void 0:t.url}`);const e=this.callbacks;e&&(this.abortInternal(),e.onTimeout(this.stats,this.context,this.loader))}}retry(e){const{context:t,stats:n}=this;this.retryDelay=Et(e,n.retry),n.retry++,R.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${null==t?void 0:t.url}, retrying ${n.retry}/${e.maxNumRetry} in ${this.retryDelay}ms`),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)}loadprogress(e){const t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)}getCacheAge(){let e=null;if(this.loader&&Vo.test(this.loader.getAllResponseHeaders())){const t=this.loader.getResponseHeader("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.loader&&new RegExp(`^${e}:\\s*[\\d.]+\\s*$`,"im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(e):null}}const Ho=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:Zo,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:class extends w{constructor(e){super("abr",e.logger),this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=-1,this.firstSelection=-1,this._nextAutoLevel=-1,this.nextAutoLevelKey="",this.audioTracksByGroup=null,this.codecTiers=null,this.timer=-1,this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.rebufferNotice=-1,this.supportedCache={},this.bwEstimator=void 0,this._abandonRulesCheck=e=>{var t;const{fragCurrent:n,partCurrent:r,hls:s}=this,{autoLevelEnabled:a,media:o}=s;if(!n||!o)return;const u=performance.now(),c=r?r.stats:n.stats,h=r?r.duration:n.duration,d=u-c.loading.start,f=s.minAutoLevel,p=n.level,_=this._nextAutoLevel;if(c.aborted||c.loaded&&c.loaded===c.total||p<=f)return this.clearTimer(),void(this._nextAutoLevel=-1);if(!a)return;const g=_>-1&&_!==p,m=!!e||g;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,h/(2*b)*1e3))return;const E=v?v.len/b:0,w=c.loading.first?c.loading.first-c.loading.start:-1,k=c.loaded&&w>-1,S=this.getBwEstimate(),T=s.levels,A=T[p],C=Math.max(c.loaded,Math.round(h*(n.bitrate||A.averageBitrate)/8));let R=k?d-w:d;R<1&&k&&(R=Math.min(d,8*c.loaded/S));const L=k?1e3*c.loaded/R:0,x=y/1e3,I=L?(C-c.loaded)/L:8*C/S+x;if(I<=E)return;const D=L?8*L:S,P=!0===(null==(t=(null==e?void 0:e.details)||this.hls.latestLevelDetails)?void 0:t.live),O=this.hls.config.abrBandWidthUpFactor;let M,N=Number.POSITIVE_INFINITY;for(M=p-1;M>f;M--){const e=T[M].maxBitrate,t=!T[M].details||P;if(N=this.getTimeToLoadFrag(x,D,h*e,t),N<Math.min(E,h+x))break}if(N>=I)return;if(N>10*h)return;k?this.bwEstimator.sample(d-Math.min(y,w),c.loaded):this.bwEstimator.sampleTTFB(d);const F=T[M].maxBitrate;this.getBwEstimate()*O>F&&this.resetEstimator(F);const B=this.findBestLevel(F,f,M,0,E,1,1);B>-1&&(M=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: ${I.toFixed(3)} s\n Estimated load time for down switch fragment: ${N.toFixed(3)} s\n TTFB estimate: ${0|w} ms\n Current BW estimate: ${i(S)?0|S:"Unknown"} bps\n New BW estimate: ${0|this.getBwEstimate()} bps\n Switching to level ${M} @ ${0|F} bps`),s.nextLoadLevel=s.nextAutoLevel=M,this.clearTimer();const U=()=>{if(this.clearTimer(),this.fragCurrent===n&&this.hls.loadLevel===M&&M>0){const e=this.getStarvationDelay();if(this.warn(`Aborting inflight request ${M>0?"and switching down":""}\n Fragment duration: ${n.duration.toFixed(3)} s\n Time to underbuffer: ${e.toFixed(3)} s`),n.abortRequests(),this.fragCurrent=this.partCurrent=null,M>f){let t=this.findBestLevel(this.hls.levels[f].bitrate,f,M,0,e,1,1);-1===t&&(t=f),this.hls.nextLoadLevel=this.hls.nextAutoLevel=t,this.resetEstimator(this.hls.levels[t].bitrate)}}};g||I>2*N?U():this.timer=self.setInterval(U,1e3*N),s.trigger(l.FRAG_LOAD_EMERGENCY_ABORTED,{frag:n,part:r,stats:c})},this.hls=e,this.bwEstimator=this.initEstimator(),this.registerListeners()}resetEstimator(e){e&&(this.log(`setting initial bwe to ${e}`),this.hls.config.abrEwmaDefaultEstimate=e),this.firstSelection=-1,this.bwEstimator=this.initEstimator()}initEstimator(){const e=this.hls.config;return new m(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)}registerListeners(){const{hls:e}=this;e.on(l.MANIFEST_LOADING,this.onManifestLoading,this),e.on(l.FRAG_LOADING,this.onFragLoading,this),e.on(l.FRAG_LOADED,this.onFragLoaded,this),e.on(l.FRAG_BUFFERED,this.onFragBuffered,this),e.on(l.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(l.LEVEL_LOADED,this.onLevelLoaded,this),e.on(l.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(l.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(l.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e&&(e.off(l.MANIFEST_LOADING,this.onManifestLoading,this),e.off(l.FRAG_LOADING,this.onFragLoading,this),e.off(l.FRAG_LOADED,this.onFragLoaded,this),e.off(l.FRAG_BUFFERED,this.onFragBuffered,this),e.off(l.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(l.LEVEL_LOADED,this.onLevelLoaded,this),e.off(l.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(l.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(l.ERROR,this.onError,this))}destroy(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=this.supportedCache=null,this.fragCurrent=this.partCurrent=null}onManifestLoading(e,t){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.lastLevelLoadSec=0,this.supportedCache={},this.fragCurrent=this.partCurrent=null,this.onLevelsUpdated(),this.clearTimer()}onLevelsUpdated(){this.lastLoadedFragLevel>-1&&this.fragCurrent&&(this.lastLoadedFragLevel=this.fragCurrent.level),this._nextAutoLevel=-1,this.onMaxAutoLevelUpdated(),this.codecTiers=null,this.audioTracksByGroup=null}onMaxAutoLevelUpdated(){this.firstSelection=-1,this.nextAutoLevelKey=""}onFragLoading(e,t){const n=t.frag;if(!this.ignoreFragment(n)){var i;if(!n.bitrateTest)this.fragCurrent=n,this.partCurrent=null!=(i=t.part)?i:null;this.clearTimer(),this.timer=self.setInterval(this._abandonRulesCheck,100)}}onLevelSwitching(e,t){this.clearTimer()}onError(e,t){if(!t.fatal)switch(t.details){case o.BUFFER_ADD_CODEC_ERROR:case o.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case o.FRAG_LOAD_TIMEOUT:{const e=t.frag,{fragCurrent:n,partCurrent:i}=this;if(e&&n&&e.sn===n.sn&&e.level===n.level){const t=performance.now(),n=i?i.stats:e.stats,r=t-n.loading.start,s=n.loading.first?n.loading.first-n.loading.start:-1;if(n.loaded&&s>-1){const e=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(r-Math.min(e,s),n.loaded)}else this.bwEstimator.sampleTTFB(r)}break}}}getTimeToLoadFrag(e,t,n,i){return e+n/t+(i?e+this.lastLevelLoadSec:0)}onLevelLoaded(e,t){const n=this.hls.config,{loading:r}=t.stats,s=r.end-r.first;i(s)&&(this.lastLevelLoadSec=s/1e3),t.details.live?this.bwEstimator.update(n.abrEwmaSlowLive,n.abrEwmaFastLive):this.bwEstimator.update(n.abrEwmaSlowVoD,n.abrEwmaFastVoD),this.timer>-1&&this._abandonRulesCheck(t.levelInfo)}onFragLoaded(e,{frag:t,part:n}){const i=n?n.stats:t.stats;if(t.type===f&&this.bwEstimator.sampleTTFB(i.loading.first-i.loading.start),!this.ignoreFragment(t)){if(this.clearTimer(),t.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){const e=n?n.duration:t.duration,r=this.hls.levels[t.level],s=(r.loaded?r.loaded.bytes:0)+i.loaded,a=(r.loaded?r.loaded.duration:0)+e;r.loaded={bytes:s,duration:a},r.realBitrate=Math.round(8*s/a)}if(t.bitrateTest){const e={stats:i,frag:t,part:n,id:t.type};this.onFragBuffered(l.FRAG_BUFFERED,e),t.bitrateTest=!1}else this.lastLoadedFragLevel=t.level}}onFragBuffered(e,t){const{frag:n,part:i}=t,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(e){return e.type!==f||"initSegment"===e.sn}clearTimer(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)}get firstAutoLevel(){const{maxAutoLevel:e,minAutoLevel:t}=this.hls,n=this.getBwEstimate(),i=this.hls.config.maxStarvationDelay,r=this.findBestLevel(n,t,e,0,i,1,1);if(r>-1)return r;const s=this.hls.firstLevel,a=Math.min(Math.max(s,t),e);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 e=this.forcedAutoLevel,t=this.bwEstimator.canEstimate(),n=this.lastLoadedFragLevel>-1;if(!(-1===e||t&&n&&this.nextAutoLevelKey!==this.getAutoLevelKey()))return e;const i=t&&n?this.getNextABRAutoLevel():this.firstAutoLevel;if(-1!==e){const t=this.hls.levels;if(t.length>Math.max(e,i)&&t[e].loadError<=t[i].loadError)return e}return this._nextAutoLevel=i,this.nextAutoLevelKey=this.getAutoLevelKey(),i}getAutoLevelKey(){return`${this.getBwEstimate()}_${this.getStarvationDelay().toFixed(2)}`}getNextABRAutoLevel(){const{fragCurrent:e,partCurrent:t,hls:n}=this;if(n.levels.length<=1)return n.loadLevel;const{maxAutoLevel:i,config:r,minAutoLevel:s}=n,a=t?t.duration:e?e.duration:0,o=this.getBwEstimate(),l=this.getStarvationDelay();let u=r.abrBandWidthFactor,c=r.abrBandWidthUpFactor;if(l){const e=this.findBestLevel(o,s,i,l,0,u,c);if(e>=0)return this.rebufferNotice=-1,e}let h=a?Math.min(a,r.maxStarvationDelay):r.maxStarvationDelay;if(!l){const e=this.bitrateTestDelay;if(e){h=(a?Math.min(a,r.maxLoadingDelay):r.maxLoadingDelay)-e,this.info(`bitrate test took ${Math.round(1e3*e)}ms, set first fragment max fetchDuration to ${Math.round(1e3*h)} ms`),u=c=1}}const d=this.findBestLevel(o,s,i,l,h,u,c);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 e=this.hls,t=e.media;if(!t)return 1/0;const n=t&&0!==t.playbackRate?Math.abs(t.playbackRate):1,i=e.mainForwardBufferInfo;return(i?i.len:0)/n}getBwEstimate(){return this.bwEstimator.canEstimate()?this.bwEstimator.getEstimate():this.hls.config.abrEwmaDefaultEstimate}findBestLevel(e,t,n,r,s,a,o){var l;const u=r+s,c=this.lastLoadedFragLevel,h=-1===c?this.hls.firstLevel:c,{fragCurrent:d,partCurrent:f}=this,{levels:p,allAudioTracks:_,loadLevel:g,config:m}=this.hls;if(1===p.length)return 0;const v=p[h],y=!(null==(l=this.hls.latestLevelDetails)||!l.live),b=-1===g||-1===c;let E,w="SDR",k=(null==v?void 0:v.frameRate)||0;const{audioPreference:S,videoPreference:T}=m,A=this.audioTracksByGroup||(this.audioTracksByGroup=st(_));let C=-1;if(b){if(-1!==this.firstSelection)return this.firstSelection;const r=this.codecTiers||(this.codecTiers=function(e,t,n,i){return e.slice(n,i+1).reduce(((e,n,i)=>{if(!n.codecSet)return e;const r=n.audioGroups;let s=e[n.codecSet];s||(e[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((e=>{if(!e)return;const n=t.groups[e];n&&(s.hasDefaultAudio=s.hasDefaultAudio||t.hasDefaultAudio?n.hasDefault:n.hasAutoSelect||!t.hasDefaultAudio&&!t.hasAutoSelectAudio,Object.keys(n.channels).forEach((e=>{s.channels[e]=(s.channels[e]||0)+n.channels[e]})))})),e}),{})}(p,A,t,n)),s=function(e,t,n,r,s){const a=Object.keys(e),o=null==r?void 0:r.channels,l=null==r?void 0:r.audioCodec,u=null==s?void 0:s.videoCodec,c=o&&2===parseInt(o);let h=!1,d=!1,f=1/0,p=1/0,_=1/0,g=1/0,m=0,v=[];const{preferHDR:y,allowedVideoRanges:b}=nt(t,s);for(let t=a.length;t--;){const n=e[a[t]];h||(h=n.channels[2]>0),f=Math.min(f,n.minHeight),p=Math.min(p,n.minFramerate),_=Math.min(_,n.minBitrate),b.filter((e=>n.videoRanges[e]>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);_=i(_)?_:n,n=Math.max(_,n),d||(t=void 0);const k=a.length>1;return{codecSet:a.reduce(((t,i)=>{const r=e[i];if(i===t)return t;if(v=d?b.filter((e=>r.videoRanges[e]>0)):[],k){if(r.minBitrate>n)return rt(i,`min bitrate of ${r.minBitrate} > current estimate of ${n}`),t;if(!r.hasDefaultAudio)return rt(i,"no renditions with default or auto-select sound found"),t;if(l&&i.indexOf(l.substring(0,4))%5!=0)return rt(i,`audio codec preference "${l}" not found`),t;if(o&&!c){if(!r.channels[o])return rt(i,`no renditions with ${o} channel sound found (channels options: ${Object.keys(r.channels)})`),t}else if((!l||c)&&h&&0===r.channels[2])return rt(i,"no renditions with stereo sound found"),t;if(r.minHeight>E)return rt(i,`min resolution of ${r.minHeight} > maximum of ${E}`),t;if(r.minFramerate>w)return rt(i,`min framerate of ${r.minFramerate} > maximum of ${w}`),t;if(!v.some((e=>r.videoRanges[e]>0)))return rt(i,`no variants with VIDEO-RANGE of ${it(v)} found`),t;if(u&&i.indexOf(u.substring(0,4))%5!=0)return rt(i,`video codec preference "${u}" not found`),t;if(r.maxScore<m)return rt(i,`max score of ${r.maxScore} < selected max of ${m}`),t}return t&&(Ie(i)>=Ie(t)||r.fragmentError>e[t].fragmentError)?t:(g=r.minIndex,m=r.maxScore,i)}),void 0),videoRanges:v,preferHDR:y,minFramerate:p,minBitrate:_,minIndex:g}}(r,w,e,S,T),{codecSet:a,videoRanges:o,minFramerate:l,minBitrate:u,minIndex:c,preferHDR:h}=s;C=c,E=a,w=h?o[o.length-1]:o[0],k=l,e=Math.max(e,u),this.log(`picked start tier ${it(s)}`)}else E=null==v?void 0:v.codecSet,w=null==v?void 0:v.videoRange;const R=f?f.duration:d?d.duration:0,L=this.bwEstimator.getEstimateTTFB()/1e3,x=[];for(let l=n;l>=t;l--){var I;const t=p[l],d=l>h;if(!t)continue;if(m.useMediaCapabilities&&!t.supportedResult&&!t.supportedPromise){const n=navigator.mediaCapabilities;"function"==typeof(null==n?void 0:n.decodingInfo)&&je(t,A,w,k,e,S)?(t.supportedPromise=Ve(t,A,n,this.supportedCache),t.supportedPromise.then((e=>{if(!this.hls)return;t.supportedResult=e;const n=this.hls.levels,i=n.indexOf(t);e.error?this.warn(`MediaCapabilities decodingInfo error: "${e.error}" for level ${i} ${it(e)}`):e.supported?e.decodingInfoResults.some((e=>!1===e.smooth||!1===e.powerEfficient))&&this.log(`MediaCapabilities decodingInfo for level ${i} not smooth or powerEfficient: ${it(e)}`):(this.warn(`Unsupported MediaCapabilities decodingInfo result for level ${i} ${it(e)}`),i>-1&&n.length>1&&(this.log(`Removing unsupported level ${i}`),this.hls.removeLevel(i),-1===this.hls.loadLevel&&(this.hls.nextLoadLevel=0)))})).catch((e=>{this.warn(`Error handling MediaCapabilities decodingInfo: ${e}`)}))):t.supportedResult=$e}if((E&&t.codecSet!==E||w&&t.videoRange!==w||d&&k>t.frameRate||!d&&k>0&&k<t.frameRate||null!=(I=t.supportedResult)&&null!=(I=I.decodingInfoResults)&&I.some((e=>!1===e.smooth)))&&(!b||l!==C)){x.push(l);continue}const _=t.details,v=(f?null==_?void 0:_.partTarget:null==_?void 0:_.averagetargetduration)||R;let T;T=d?o*e:a*e;const D=R&&r>=2*R&&0===s?t.averageBitrate:t.maxBitrate,P=this.getTimeToLoadFrag(L,T,D*v,void 0===_);if(T>=D&&(l===c||0===t.loadError&&0===t.fragmentError)&&(P<=L||!i(P)||y&&!this.bitrateTestDelay||P<u)){const e=this.forcedAutoLevel;return l===g||-1!==e&&e===g||(x.length&&this.trace(`Skipped level(s) ${x.join(",")} of ${n} max with CODECS and VIDEO-RANGE:"${p[x[0]].codecs}" ${p[x[0]].videoRange}; not compatible with "${E}" ${w}`),this.info(`switch candidate:${h}->${l} adjustedbw(${Math.round(T)})-bitrate=${Math.round(T-D)} ttfb:${L.toFixed(1)} avgDuration:${v.toFixed(1)} maxFetchDuration:${u.toFixed(1)} fetchDuration:${P.toFixed(1)} firstSelection:${b} codecSet:${t.codecSet} videoRange:${t.videoRange} hls.loadLevel:${g}`)),b&&(this.firstSelection=l),l}}return-1}set nextAutoLevel(e){const t=this.deriveNextAutoLevel(e);this._nextAutoLevel!==t&&(this.nextAutoLevelKey="",this._nextAutoLevel=t)}deriveNextAutoLevel(e){const{maxAutoLevel:t,minAutoLevel:n}=this.hls;return Math.min(Math.max(e,n),t)}},bufferController:class extends w{constructor(e,t){var n;super("buffer-controller",e.logger),this.hls=void 0,this.fragmentTracker=void 0,this.details=null,this._objectUrl=null,this.operationQueue=null,this.bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.lastMpegAudioChunk=null,this.blockedAudioAppend=null,this.lastVideoAppendEnd=0,this.appendSource=void 0,this.transferData=void 0,this.overrides=void 0,this.appendErrors={audio:0,video:0,audiovideo:0},this.tracks={},this.sourceBuffers=[[null,null],[null,null]],this._onEndStreaming=e=>{var t;this.hls&&"open"===(null==(t=this.mediaSource)?void 0:t.readyState)&&this.hls.pauseBuffering()},this._onStartStreaming=e=>{this.hls&&this.hls.resumeBuffering()},this._onMediaSourceOpen=e=>{const{media:t,mediaSource:n}=this;e&&this.log("Media source opened"),t&&n&&(n.removeEventListener("sourceopen",this._onMediaSourceOpen),t.removeEventListener("emptied",this._onMediaEmptied),this.updateDuration(),this.hls.trigger(l.MEDIA_ATTACHED,{media:t,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:e,_objectUrl:t}=this;e!==t&&this.error(`Media element src was set while attaching MediaSource (${t} > ${e})`)},this.hls=e,this.fragmentTracker=t,this.appendSource=(n=L(e.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:e}=this;e.on(l.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(l.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(l.MANIFEST_LOADING,this.onManifestLoading,this),e.on(l.MANIFEST_PARSED,this.onManifestParsed,this),e.on(l.BUFFER_RESET,this.onBufferReset,this),e.on(l.BUFFER_APPENDING,this.onBufferAppending,this),e.on(l.BUFFER_CODECS,this.onBufferCodecs,this),e.on(l.BUFFER_EOS,this.onBufferEos,this),e.on(l.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(l.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(l.FRAG_PARSED,this.onFragParsed,this),e.on(l.FRAG_CHANGED,this.onFragChanged,this),e.on(l.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(l.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(l.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(l.MANIFEST_LOADING,this.onManifestLoading,this),e.off(l.MANIFEST_PARSED,this.onManifestParsed,this),e.off(l.BUFFER_RESET,this.onBufferReset,this),e.off(l.BUFFER_APPENDING,this.onBufferAppending,this),e.off(l.BUFFER_CODECS,this.onBufferCodecs,this),e.off(l.BUFFER_EOS,this.onBufferEos,this),e.off(l.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(l.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(l.FRAG_PARSED,this.onFragParsed,this),e.off(l.FRAG_CHANGED,this.onFragChanged,this),e.off(l.ERROR,this.onError,this)}transferMedia(){const{media:e,mediaSource:t}=this;if(!e)return null;const n={};if(this.operationQueue){const e=this.isUpdating();e||this.operationQueue.removeBlockers();const t=this.isQueued();(e||t)&&this.warn(`Transfering MediaSource with${t?" operations in queue":""}${e?" updating SourceBuffer(s)":""} ${this.operationQueue}`),this.operationQueue.destroy()}const i=this.transferData;return!this.sourceBufferCount&&i&&i.mediaSource===t?y(n,i.tracks):this.sourceBuffers.forEach((e=>{const[t]=e;t&&(n[t]=y({},this.tracks[t]),this.removeBuffer(t)),e[0]=e[1]=null})),{media:e,mediaSource:t,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(e,t){var n;let i=2;(t.audio&&!t.video||!t.altAudio)&&(i=1),this.bufferCodecEventsTotal=i,this.log(`${i} bufferCodec event(s) expected.`),null!=(n=this.transferData)&&n.mediaSource&&this.sourceBufferCount&&i&&this.bufferCreated()}onMediaAttaching(e,t){const n=this.media=t.media;this.transferData=this.overrides=void 0;const i=L(this.appendSource);if(i){const e=!!t.mediaSource;(e||t.overrides)&&(this.transferData=t,this.overrides=t.overrides);const r=this.mediaSource=t.mediaSource||new i;if(this.assignMediaSource(r),e)this._objectUrl=n.src,this.attachTransferred();else{const e=this._objectUrl=self.URL.createObjectURL(r);if(this.appendSource)try{n.removeAttribute("src");const t=self.ManagedMediaSource;n.disableRemotePlayback=n.disableRemotePlayback||t&&r instanceof t,bs(n),function(e,t){const n=self.document.createElement("source");n.type="video/mp4",n.src=t,e.appendChild(n)}(n,e),n.load()}catch(t){n.src=e}else n.src=e}n.addEventListener("emptied",this._onMediaEmptied)}}assignMediaSource(e){var t,n;this.log(`${(null==(t=this.transferData)?void 0:t.mediaSource)===e?"transferred":"created"} media source: ${null==(n=e.constructor)?void 0:n.name}`),e.addEventListener("sourceopen",this._onMediaSourceOpen),e.addEventListener("sourceended",this._onMediaSourceEnded),e.addEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(e.addEventListener("startstreaming",this._onStartStreaming),e.addEventListener("endstreaming",this._onEndStreaming))}attachTransferred(){const e=this.media,t=this.transferData;if(!t||!e)return;const n=this.tracks,i=t.tracks,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: ${it(n,((e,t)=>"initSegment"===e?void 0:t))};\ntransfer tracks: ${it(i,((e,t)=>"initSegment"===e?void 0:t))}}`),!x(i,n)){t.mediaSource=null,t.tracks=void 0;const r=e.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,t),void(e.currentTime=a))}this.transferData=void 0,r.forEach((e=>{const t=e,n=i[t];if(n){const e=n.buffer;if(e){const i=this.fragmentTracker,r=n.id;if(i.hasFragments(r)||i.hasParts(r)){const n=nn.getBuffered(e);i.detectEvictedFragments(t,n,r,null,!0)}const s=Es(t),a=[t,e];this.sourceBuffers[s]=a,e.updating&&this.operationQueue&&this.operationQueue.prependBlocker(t),this.trackSourceBuffer(t,n)}}})),a(),this.bufferCreated()}else this.log("attachTransferred: MediaSource w/o SourceBuffers"),a()}get mediaSourceOpenOrEnded(){var e;const t=null==(e=this.mediaSource)?void 0:e.readyState;return"open"===t||"ended"===t}onMediaDetaching(e,t){const n=!!t.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((([e])=>{e&&this.removeBuffer(e)})),this.resetQueue();else{if(this.mediaSourceOpenOrEnded){const e="open"===r.readyState;try{const t=r.sourceBuffers;for(let n=t.length;n--;)e&&t[n].abort(),r.removeSourceBuffer(t[n]);e&&r.endOfStream()}catch(e){this.warn(`onMediaDetaching: ${e.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&&bs(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,t)}onBufferReset(){this.sourceBuffers.forEach((([e])=>{e&&this.resetBuffer(e)})),this.initTracks()}resetBuffer(e){var t;const n=null==(t=this.tracks[e])?void 0:t.buffer;if(this.removeBuffer(e),n)try{var i;null!=(i=this.mediaSource)&&i.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(n)}catch(t){this.warn(`onBufferReset ${e}`,t)}delete this.tracks[e]}removeBuffer(e){this.removeBufferListeners(e),this.sourceBuffers[Es(e)]=[null,null];const t=this.tracks[e];t&&(t.buffer=void 0)}resetQueue(){this.operationQueue&&this.operationQueue.destroy(),this.operationQueue=new gs(this.tracks)}onBufferCodecs(e,t){var n;const i=this.tracks,r=Object.keys(t);this.log(`BUFFER_CODECS: "${r}" (current SB count ${this.sourceBufferCount})`);const s="audiovideo"in t&&(i.audio||i.video)||i.audiovideo&&("audio"in t||"video"in t),a=!s&&this.sourceBufferCount&&this.media&&r.some((e=>!i[e]));s||a?this.warn(`Unsupported transition between "${Object.keys(i)}" and "${r}" SourceBuffers`):(r.forEach((e=>{var n,r;const s=t[e],{id:a,codec:o,levelCodec:l,container:u,metadata:c,supplemental:h}=s;let d=i[e];const f=null==(n=this.transferData)||null==(n=n.tracks)?void 0:n[e],p=null!=f&&f.buffer?f:d,_=(null==p?void 0:p.pendingCodec)||(null==p?void 0:p.codec),g=null==p?void 0:p.levelCodec;d||(d=i[e]={buffer:void 0,listeners:[],codec:o,supplemental:h,container:u,levelCodec:l,metadata:c,id:a});const m=Me(_,g),v=null==m?void 0:m.replace(ms,"$1");let y=Me(o,l);const b=null==(r=y)?void 0:r.replace(ms,"$1");y&&m&&v!==b&&("audio"===e.slice(0,5)&&(y=Oe(y,this.appendSource)),this.log(`switching codec ${_} to ${y}`),y!==(d.pendingCodec||d.codec)&&(d.pendingCodec=y),d.container=u,this.appendChangeType(e,u,y))})),(this.tracksReady||this.sourceBufferCount)&&(t.tracks=this.sourceBufferTracks),this.sourceBufferCount||(this.bufferCodecEventsTotal>1&&!this.tracks.video&&!t.video&&"main"===(null==(n=t.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(((e,t)=>{const n=this.tracks[t];return e[t]={id:n.id,container:n.container,codec:n.codec,levelCodec:n.levelCodec},e}),{})}appendChangeType(e,t,n){const i=`${t};codecs=${n}`,r={label:`change-type=${i}`,execute:()=>{const r=this.tracks[e];if(r){const s=r.buffer;null!=s&&s.changeType&&(this.log(`changing ${e} sourceBuffer type to ${i}`),s.changeType(i),r.codec=n,r.container=t)}this.shiftAndExecuteNext(e)},onStart:()=>{},onComplete:()=>{},onError:t=>{this.warn(`Failed to change ${e} SourceBuffer type`,t)}};this.append(r,e,this.isPending(this.tracks[e]))}blockAudio(e){var t;const n=e.start,i=n+.05*e.duration;if(!0===(null==(t=this.fragmentTracker.getAppendedFrag(n,f))?void 0:t.gap))return;const r={label:"block-audio",execute:()=>{var e;const t=this.tracks.video;(this.lastVideoAppendEnd>i||null!=t&&t.buffer&&nn.isBuffered(t.buffer,i)||!0===(null==(e=this.fragmentTracker.getAppendedFrag(i,f))?void 0:e.gap))&&(this.blockedAudioAppend=null,this.shiftAndExecuteNext("audio"))},onStart:()=>{},onComplete:()=>{},onError:e=>{this.warn("Error executing block-audio operation",e)}};this.blockedAudioAppend={op:r,frag:e},this.append(r,"audio",!0)}unblockAudio(){const{blockedAudioAppend:e,operationQueue:t}=this;e&&t&&(this.blockedAudioAppend=null,t.unblockAudio(e.op))}onBufferAppending(e,t){const{tracks:n}=this,{data:r,type:s,parent:u,frag:c,part:h,chunkMeta:d,offset:p}=t,_=d.buffering[s],{sn:g,cc:m}=c,v=self.performance.now();_.start=v;const y=c.stats.buffering,b=h?h.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 k=n.video,S=null==k?void 0:k.buffer;if(S&&"initSegment"!==g){const e=h||c,t=this.blockedAudioAppend;if("audio"!==s||"main"===u||this.blockedAudioAppend||k.ending||k.ended){if("video"===s){const n=e.end;if(t){const e=t.frag.start;(n>e||n<this.lastVideoAppendEnd||nn.isBuffered(S,e))&&this.unblockAudio()}this.lastVideoAppendEnd=n}}else{const t=e.start+.05*e.duration,n=S.buffered,i=this.currentOp("video");n.length||i?!i&&!nn.isBuffered(S,t)&&this.lastVideoAppendEnd<t&&this.blockAudio(e):this.blockAudio(e)}}const T=(h||c).start,A={label:`append-${s}`,execute:()=>{var e;_.executeStart=self.performance.now();const t=null==(e=this.tracks[s])?void 0:e.buffer;t&&(w?this.updateTimestampOffset(t,T,.1,s,g,m):void 0!==p&&i(p)&&this.updateTimestampOffset(t,p,1e-6,s,g,m)),this.appendExecutor(r,s)},onStart:()=>{},onComplete:()=>{const e=self.performance.now();_.executeEnd=_.end=e,0===y.first&&(y.first=e),b&&0===b.first&&(b.first=e);const t={};this.sourceBuffers.forEach((([e,n])=>{e&&(t[e]=nn.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:c,part:h,chunkMeta:d,parent:c.type,timeRanges:t})},onError:e=>{var t;const n={type:a.MEDIA_ERROR,parent:c.type,details:o.BUFFER_APPEND_ERROR,sourceBufferName:s,frag:c,part:h,chunkMeta:d,error:e,err:e,fatal:!1},i=null==(t=this.media)?void 0:t.error;if(e.code===DOMException.QUOTA_EXCEEDED_ERR||"QuotaExceededError"==e.name||"quota"in e)n.details=o.BUFFER_FULL_ERROR;else if(e.code===DOMException.INVALID_STATE_ERR&&this.mediaSourceOpenOrEnded&&!i)n.errorAction=Pt(!0);else if(e.name===vs&&0===this.sourceBufferCount)n.errorAction=Pt(!0);else{const e=++this.appendErrors[s];this.warn(`Failed ${e}/${this.hls.config.appendErrorMaxRetry} times to append segment in "${s}" sourceBuffer (${i||"no media error"})`),(e>=this.hls.config.appendErrorMaxRetry||i)&&(n.fatal=!0)}this.hls.trigger(l.ERROR,n)}};this.log(`queuing "${s}" append sn: ${g}${h?" p: "+h.index:""} of ${c.type===f?"level":"track"} ${c.level} cc: ${m}`),this.append(A,s,this.isPending(this.tracks[s]))}getFlushOp(e,t,n){return this.log(`queuing "${e}" remove ${t}-${n}`),{label:"remove",execute:()=>{this.removeExecutor(e,t,n)},onStart:()=>{},onComplete:()=>{this.hls.trigger(l.BUFFER_FLUSHED,{type:e})},onError:i=>{this.warn(`Failed to remove ${t}-${n} from "${e}" SourceBuffer`,i)}}}onBufferFlushing(e,t){const{type:n,startOffset:i,endOffset:r}=t;n?this.append(this.getFlushOp(n,i,r),n):this.sourceBuffers.forEach((([e])=>{e&&this.append(this.getFlushOp(e,i,r),e)}))}onFragParsed(e,t){const{frag:n,part:i}=t,r=[],s=i?i.elementaryStreams:n.elementaryStreams;s[H]?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 e=self.performance.now();n.stats.buffering.end=e,i&&(i.stats.buffering.end=e);const t=i?i.stats:n.stats;this.hls.trigger(l.FRAG_BUFFERED,{frag:n,part:i,stats:t,id:n.type})}),r).catch((e=>{this.warn(`Fragment buffered callback ${e}`),this.stepOperationQueue(this.sourceBufferTypes)}))}onFragChanged(e,t){this.trimBuffers()}get bufferedToEnd(){return this.sourceBufferCount>0&&!this.sourceBuffers.some((([e])=>{if(e){const t=this.tracks[e];if(t)return!t.ended||t.ending}return!1}))}onBufferEos(e,t){var n;this.sourceBuffers.forEach((([e])=>{if(e){const n=this.tracks[e];t.type&&t.type!==e||(n.ending=!0,n.ended||(n.ended=!0,this.log(`${e} buffer reached EOS`)))}}));const i=!1!==(null==(n=this.overrides)?void 0:n.endOfStream);this.sourceBufferCount>0&&!this.sourceBuffers.some((([e])=>{var t;return e&&!(null!=(t=this.tracks[e])&&t.ended)}))?i?(this.log("Queueing EOS"),this.blockUntilOpen((()=>{this.tracksEnded();const{mediaSource:e}=this;e&&"open"===e.readyState?(this.log("Calling mediaSource.endOfStream()"),e.endOfStream(),this.hls.trigger(l.BUFFERED_TO_END,void 0)):e&&this.log(`Could not call mediaSource.endOfStream(). mediaSource.readyState: ${e.readyState}`)}))):(this.tracksEnded(),this.hls.trigger(l.BUFFERED_TO_END,void 0)):"video"===t.type&&this.unblockAudio()}tracksEnded(){this.sourceBuffers.forEach((([e])=>{if(null!==e){const t=this.tracks[e];t&&(t.ending=!1)}}))}onLevelUpdated(e,{details:t}){t.fragments.length&&(this.details=t,this.updateDuration())}updateDuration(){this.blockUntilOpen((()=>{const e=this.getDurationAndRange();e&&this.updateMediaSource(e)}))}onError(e,t){if(t.details===o.BUFFER_APPEND_ERROR&&t.frag){var n;const e=null==(n=t.errorAction)?void 0:n.nextAutoLevel;i(e)&&e!==t.frag.level&&this.resetAppendErrors()}}resetAppendErrors(){this.appendErrors={audio:0,video:0,audiovideo:0}}trimBuffers(){const{hls:e,details:t,media:n}=this;if(!n||null===t)return;if(!this.sourceBufferCount)return;const r=e.config,s=n.currentTime,a=t.levelTargetDuration,o=t.live&&null!==r.liveBackBufferLength?r.liveBackBufferLength:r.backBufferLength;if(i(o)&&o>=0){const e=Math.max(o,a),t=Math.floor(s/a)*a-e;this.flushBackBuffer(s,a,t)}const l=r.frontBufferFlushThreshold;if(i(l)&&l>0){const e=Math.max(r.maxBufferLength,l),t=Math.max(e,a),n=Math.floor(s/a)*a+t;this.flushFrontBuffer(s,a,n)}}flushBackBuffer(e,t,n){this.sourceBuffers.forEach((([e,t])=>{if(t){const r=nn.getBuffered(t);if(r.length>0&&n>r.start(0)){var i;this.hls.trigger(l.BACK_BUFFER_REACHED,{bufferEnd:n});const t=this.tracks[e];if(null!=(i=this.details)&&i.live)this.hls.trigger(l.LIVE_BACK_BUFFER_REACHED,{bufferEnd:n});else if(null!=t&&t.ended)return void this.log(`Cannot flush ${e} back buffer while SourceBuffer is in ended state`);this.hls.trigger(l.BUFFER_FLUSHING,{startOffset:0,endOffset:n,type:e})}}}))}flushFrontBuffer(e,t,n){this.sourceBuffers.forEach((([t,i])=>{if(i){const r=nn.getBuffered(i),s=r.length;if(s<2)return;const a=r.start(s-1),o=r.end(s-1);if(n>a||e>=a&&e<=o)return;this.hls.trigger(l.BUFFER_FLUSHING,{startOffset:a,endOffset:1/0,type:t})}}))}getDurationAndRange(){var e;const{details:t,mediaSource:n}=this;if(!t||!this.media||"open"!==(null==n?void 0:n.readyState))return null;const r=t.edge;if(t.live&&this.hls.config.liveDurationInfinity){if(t.fragments.length&&n.setLiveSeekableRange){const e=Math.max(0,t.fragmentStart);return{duration:1/0,start:e,end:Math.max(e,r)}}return{duration:1/0}}const s=null==(e=this.overrides)?void 0:e.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:e,start:t,end:n}){const r=this.mediaSource;this.media&&r&&"open"===r.readyState&&(r.duration!==e&&(i(e)&&this.log(`Updating MediaSource duration to ${e.toFixed(3)}`),r.duration=e),void 0!==t&&void 0!==n&&(this.log(`MediaSource duration is set to ${r.duration}. Setting seekable range to ${t}-${n}.`),r.setLiveSeekableRange(t,n)))}get tracksReady(){const e=this.pendingTrackCount;return e>0&&(e>=this.bufferCodecEventsTotal||this.isPending(this.tracks.audiovideo))}checkPendingTracks(){const{bufferCodecEventsTotal:e,pendingTrackCount:t,tracks:n}=this;if(this.log(`checkPendingTracks (pending: ${t} codec events expected: ${e}) ${it(n)}`),this.tracksReady){var i;const e=null==(i=this.transferData)?void 0:i.tracks;e&&Object.keys(e).length?this.attachTransferred():this.createSourceBuffers()}}bufferCreated(){if(this.sourceBufferCount){const e={};this.sourceBuffers.forEach((([t,n])=>{if(t){const i=this.tracks[t];e[t]={buffer:n,container:i.container,codec:i.codec,supplemental:i.supplemental,levelCodec:i.levelCodec,id:i.id,metadata:i.metadata}}})),this.hls.trigger(l.BUFFER_CREATED,{tracks:e}),this.log(`SourceBuffers created. Running queue: ${this.operationQueue}`),this.sourceBuffers.forEach((([e])=>{this.executeNext(e)}))}else{const e=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:e,reason:e.message})}}createSourceBuffers(){const{tracks:e,sourceBuffers:t,mediaSource:n}=this;if(!n)throw new Error("createSourceBuffers called when mediaSource was null");for(const r in e){const s=r,u=e[s];if(this.isPending(u)){const e=this.getTrackCodec(u,s),r=`${u.container};codecs=${e}`;u.codec=e,this.log(`creating sourceBuffer(${r})${this.currentOp(s)?" Queued":""} ${it(u)}`);try{const e=n.addSourceBuffer(r),i=Es(s),a=[s,e];t[i]=a,u.buffer=e}catch(e){var i;return this.error(`error while trying to add sourceBuffer: ${e.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:e,sourceBufferName:s,mimeType:r,parent:u.id})}this.trackSourceBuffer(s,u)}}this.bufferCreated()}getTrackCodec(e,t){const n=e.supplemental;let i=e.codec;n&&("video"===t||"audiovideo"===t)&&Ce(n,"video")&&(i=function(e,t){const n=[];if(e){const t=e.split(",");for(let e=0;e<t.length;e++)Ae(t[e],"video")||n.push(t[e])}return t&&n.push(t),n.join(",")}(i,n));const r=Me(i,e.levelCodec);return r?"audio"===t.slice(0,5)?Oe(r,this.appendSource):r:""}trackSourceBuffer(e,t){const n=t.buffer;if(!n)return;const i=this.getTrackCodec(t,e);this.tracks[e]={buffer:n,codec:i,container:t.container,levelCodec:t.levelCodec,supplemental:t.supplemental,metadata:t.metadata,id:t.id,listeners:[]},this.removeBufferListeners(e),this.addBufferListener(e,"updatestart",this.onSBUpdateStart),this.addBufferListener(e,"updateend",this.onSBUpdateEnd),this.addBufferListener(e,"error",this.onSBUpdateError),this.appendSource&&this.addBufferListener(e,"bufferedchange",((e,t)=>{const n=t.removedRanges;null!=n&&n.length&&this.hls.trigger(l.BUFFER_FLUSHED,{type:e})}))}get mediaSrc(){var e,t;const n=(null==(e=this.media)||null==(t=e.querySelector)?void 0:t.call(e,"source"))||this.media;return null==n?void 0:n.src}onSBUpdateStart(e){const t=this.currentOp(e);t&&t.onStart()}onSBUpdateEnd(e){var t;if("closed"===(null==(t=this.mediaSource)?void 0:t.readyState))return void this.resetBuffer(e);const n=this.currentOp(e);n&&(n.onComplete(),this.shiftAndExecuteNext(e))}onSBUpdateError(e,t){var n;const i=new Error(`${e} SourceBuffer error. MediaSource readyState: ${null==(n=this.mediaSource)?void 0:n.readyState}`);this.error(`${i}`,t),this.hls.trigger(l.ERROR,{type:a.MEDIA_ERROR,details:o.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:i,fatal:!1});const r=this.currentOp(e);r&&r.onError(i)}updateTimestampOffset(e,t,n,i,r,s){const a=t-e.timestampOffset;Math.abs(a)>=n&&(this.log(`Updating ${i} SourceBuffer timestampOffset to ${t} (sn: ${r} cc: ${s})`),e.timestampOffset=t)}removeExecutor(e,t,n){const{media:r,mediaSource:s}=this,a=this.tracks[e],o=null==a?void 0:a.buffer;if(!r||!s||!o)return this.warn(`Attempting to remove from the ${e} SourceBuffer, but it does not exist`),void this.shiftAndExecuteNext(e);const l=i(r.duration)?r.duration:1/0,u=i(s.duration)?s.duration:1/0,c=Math.max(0,t),h=Math.min(n,l,u);h>c&&(!a.ending||a.ended)?(a.ended=!1,this.log(`Removing [${c},${h}] from the ${e} SourceBuffer`),o.remove(c,h)):this.shiftAndExecuteNext(e)}appendExecutor(e,t){const n=this.tracks[t],i=null==n?void 0:n.buffer;if(!i)throw new ys(`Attempting to append to the ${t} SourceBuffer, but it does not exist`);n.ending=!1,n.ended=!1,i.appendBuffer(e)}blockUntilOpen(e){if(this.isUpdating()||this.isQueued())this.blockBuffers(e).catch((e=>{this.warn(`SourceBuffer blocked callback ${e}`),this.stepOperationQueue(this.sourceBufferTypes)}));else try{e()}catch(e){this.warn(`Callback run without blocking ${this.operationQueue} ${e}`)}}isUpdating(){return this.sourceBuffers.some((([e,t])=>e&&t.updating))}isQueued(){return this.sourceBuffers.some((([e])=>e&&!!this.currentOp(e)))}isPending(e){return!!e&&!e.buffer}blockBuffers(e,t=this.sourceBufferTypes){if(!t.length)return this.log("Blocking operation requested, but no SourceBuffers exist"),Promise.resolve().then(e);const{operationQueue:n}=this,i=t.map((e=>this.appendBlocker(e)));return t.length>1&&!!this.blockedAudioAppend&&this.unblockAudio(),Promise.all(i).then((t=>{n===this.operationQueue&&(e(),this.stepOperationQueue(this.sourceBufferTypes))}))}stepOperationQueue(e){e.forEach((e=>{var t;const n=null==(t=this.tracks[e])?void 0:t.buffer;n&&!n.updating&&this.shiftAndExecuteNext(e)}))}append(e,t,n){this.operationQueue&&this.operationQueue.append(e,t,n)}appendBlocker(e){if(this.operationQueue)return this.operationQueue.appendBlocker(e)}currentOp(e){return this.operationQueue?this.operationQueue.current(e):null}executeNext(e){e&&this.operationQueue&&this.operationQueue.executeNext(e)}shiftAndExecuteNext(e){this.operationQueue&&this.operationQueue.shiftAndExecuteNext(e)}get pendingTrackCount(){return Object.keys(this.tracks).reduce(((e,t)=>e+(this.isPending(this.tracks[t])?1:0)),0)}get sourceBufferCount(){return this.sourceBuffers.reduce(((e,[t])=>e+(t?1:0)),0)}get sourceBufferTypes(){return this.sourceBuffers.map((([e])=>e)).filter((e=>!!e))}addBufferListener(e,t,n){const i=this.tracks[e];if(!i)return;const r=i.buffer;if(!r)return;const s=n.bind(this,e);i.listeners.push({event:t,listener:s}),r.addEventListener(t,s)}removeBufferListeners(e){const t=this.tracks[e];if(!t)return;const n=t.buffer;n&&(t.listeners.forEach((e=>{n.removeEventListener(e.event,e.listener)})),t.listeners.length=0)}},capLevelController:ws,errorController:class extends w{constructor(e){super("error-controller",e.logger),this.hls=void 0,this.playlistError=0,this.hls=e,this.registerListeners()}registerListeners(){const e=this.hls;e.on(l.ERROR,this.onError,this),e.on(l.MANIFEST_LOADING,this.onManifestLoading,this),e.on(l.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){const e=this.hls;e&&(e.off(l.ERROR,this.onError,this),e.off(l.ERROR,this.onErrorOut,this),e.off(l.MANIFEST_LOADING,this.onManifestLoading,this),e.off(l.LEVEL_UPDATED,this.onLevelUpdated,this))}destroy(){this.unregisterListeners(),this.hls=null}startLoad(e){}stopLoad(){this.playlistError=0}getVariantLevelIndex(e){return(null==e?void 0:e.type)===f?e.level:this.getVariantIndex()}getVariantIndex(){var e;const t=this.hls,n=t.currentLevel;return null!=(e=t.loadLevelObj)&&e.details||-1===n?t.loadLevel:n}variantHasKey(e,t){if(e){var n;if(null!=(n=e.details)&&n.hasKey(t))return!0;const i=e.audioGroups;if(i){return this.hls.allAudioTracks.filter((e=>i.indexOf(e.groupId)>=0)).some((e=>{var n;return null==(n=e.details)?void 0:n.hasKey(t)}))}}return!1}onManifestLoading(){this.playlistError=0}onLevelUpdated(){this.playlistError=0}onError(e,t){var n;if(t.fatal)return;const i=this.hls,r=t.context;switch(t.details){case o.FRAG_LOAD_ERROR:case o.FRAG_LOAD_TIMEOUT:case o.KEY_LOAD_ERROR:case o.KEY_LOAD_TIMEOUT:return void(t.errorAction=this.getFragRetryOrSwitchAction(t));case o.FRAG_PARSING_ERROR:if(null!=(n=t.frag)&&n.gap)return void(t.errorAction=Pt());case o.FRAG_GAP:case o.FRAG_DECRYPT_ERROR:return t.errorAction=this.getFragRetryOrSwitchAction(t),void(t.errorAction.action=At);case o.LEVEL_EMPTY_ERROR:case o.LEVEL_PARSING_ERROR:{var s;const e=t.parent===f?t.level:i.loadLevel;t.details===o.LEVEL_EMPTY_ERROR&&null!=(s=t.context)&&null!=(s=s.levelDetails)&&s.live?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,e):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,e))}return;case o.LEVEL_LOAD_ERROR:case o.LEVEL_LOAD_TIMEOUT:return void("number"==typeof(null==r?void 0:r.level)&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,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 e=i.loadLevelObj;if(e&&(r.type===h&&e.hasAudioGroup(r.groupId)||r.type===d&&e.hasSubtitleGroup(r.groupId)))return t.errorAction=this.getPlaylistRetryOrSwitchAction(t,i.loadLevel),t.errorAction.action=At,void(t.errorAction.flags=xt)}return;case o.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:return void(t.errorAction={action:At,flags:It});case o.KEY_SYSTEM_SESSION_UPDATE_FAILED:case o.KEY_SYSTEM_STATUS_INTERNAL_ERROR:case o.KEY_SYSTEM_NO_SESSION:return void(t.errorAction={action:At,flags:Dt});case o.BUFFER_ADD_CODEC_ERROR:case o.REMUX_ALLOC_ERROR:case o.BUFFER_APPEND_ERROR:var l;if(!t.errorAction)t.errorAction=this.getLevelSwitchAction(t,null!=(l=t.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(t.errorAction=Pt())}t.type===a.KEY_SYSTEM_ERROR&&(t.levelRetry=!1,t.errorAction=Pt())}getPlaylistRetryOrSwitchAction(e,t){const n=bt(this.hls.config.playlistLoadPolicy,e),i=this.playlistError++;if(kt(n,i,mt(e),e.response))return{action:Rt,flags:Lt,retryConfig:n,retryCount:i};const r=this.getLevelSwitchAction(e,t);return n&&(r.retryConfig=n,r.retryCount=i),r}getFragRetryOrSwitchAction(e){const t=this.hls,n=this.getVariantLevelIndex(e.frag),i=t.levels[n],{fragLoadPolicy:r,keyLoadPolicy:s}=t.config,a=bt(vt(e)?s:r,e),l=t.levels.reduce(((e,t)=>e+t.fragmentError),0);if(i&&(e.details!==o.FRAG_GAP&&i.fragmentError++,!yt(e))){if(kt(a,l,mt(e),e.response))return{action:Rt,flags:Lt,retryConfig:a,retryCount:l}}const u=this.getLevelSwitchAction(e,n);return a&&(u.retryConfig=a,u.retryCount=l),u}getLevelSwitchAction(e,t){const n=this.hls;null==t&&(t=n.loadLevel);const i=this.hls.levels[t];if(i){var r,s;const t=e.details;i.loadError++,t===o.BUFFER_APPEND_ERROR&&i.fragmentError++;let u=-1;const{levels:c,loadLevel:g,minAutoLevel:m,maxAutoLevel:v}=n;n.autoLevelEnabled||n.config.preserveManualLevelOnError||(n.loadLevel=-1);const y=null==(r=e.frag)?void 0:r.type,b=(y===p&&t===o.FRAG_PARSING_ERROR||"audio"===e.sourceBufferName&&(t===o.BUFFER_ADD_CODEC_ERROR||t===o.BUFFER_APPEND_ERROR))&&c.some((({audioCodec:e})=>i.audioCodec!==e)),E="video"===e.sourceBufferName&&(t===o.BUFFER_ADD_CODEC_ERROR||t===o.BUFFER_APPEND_ERROR)&&c.some((({codecSet:e,audioCodec:t})=>i.codecSet!==e&&i.audioCodec===t)),{type:w,groupId:k}=null!=(s=e.context)?s:{};for(let n=c.length;n--;){const r=(n+g)%c.length;if(r!==g&&r>=m&&r<=v&&0===c[r].loadError){var a,l;const n=c[r];if(t===o.FRAG_GAP&&y===f&&e.frag){const t=c[r].details;if(t){const n=ft(e.frag,t.fragments,e.frag.start);if(null!=n&&n.gap)continue}}else{if(w===h&&n.hasAudioGroup(k)||w===d&&n.hasSubtitleGroup(k))continue;if(y===p&&null!=(a=i.audioGroups)&&a.some((e=>n.hasAudioGroup(e)))||y===_&&null!=(l=i.subtitleGroups)&&l.some((e=>n.hasSubtitleGroup(e)))||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 e.levelRetry=!0,this.playlistError=0,{action:At,flags:Lt,nextAutoLevel:u}}return{action:At,flags:xt}}onErrorOut(e,t){var n;switch(null==(n=t.errorAction)?void 0:n.action){case Tt:break;case At:this.sendAlternateToPenaltyBox(t),t.errorAction.resolved||t.details===o.FRAG_GAP?/MediaSource readyState: ended/.test(t.error.message)&&(this.warn(`MediaSource ended after "${t.sourceBufferName}" sourceBuffer append error. Attempting to recover from media error.`),this.hls.recoverMediaError()):t.fatal=!0}t.fatal&&this.hls.stopLoad()}sendAlternateToPenaltyBox(e){const t=this.hls,n=e.errorAction;if(!n)return;const{flags:i}=n,r=n.nextAutoLevel;switch(i){case Lt:this.switchLevel(e,r);break;case It:{const i=this.getVariantLevelIndex(e.frag),r=t.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){t.maxHdcpLevel=ze[ze.indexOf(s)-1],n.resolved=!0,this.warn(`Restricting playback to HDCP-LEVEL of "${t.maxHdcpLevel}" or lower`);break}}case Dt:{const t=e.decryptdata;if(t){const i=this.hls.levels,r=i.length;for(let n=r;n--;){var s,a;if(this.variantHasKey(i[n],t))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=e.frag)?void 0:a.type} fragment) ${D(t.keyId||[])}`),i[n].fragmentError++,i[n].loadError++,this.log(`Removing level ${n} with key error (${e.error})`),this.hls.removeLevel(n)}const o=e.frag;if(this.hls.levels.length<r)n.resolved=!0;else if(o&&o.type!==f){const e=o.decryptdata;e&&!t.matches(e)&&(n.resolved=!0)}}break}}n.resolved||this.switchLevel(e,r)}switchLevel(e,t){if(void 0!==t&&e.errorAction&&(this.warn(`switching to level ${t} after ${e.details}`),this.hls.nextAutoLevel=t,e.errorAction.resolved=!0,this.hls.nextLoadLevel=this.hls.nextAutoLevel,e.details===o.BUFFER_ADD_CODEC_ERROR&&e.mimeType&&"audiovideo"!==e.sourceBufferName)){const t=Ue(e.mimeType),n=this.hls.levels;for(let i=n.length;i--;)n[i][`${e.sourceBufferName}Codec`]===t&&(this.log(`Removing level ${i} for ${e.details} ("${t}" not supported)`),this.hls.removeLevel(i))}}},fpsController:class{constructor(e){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=e,this.registerListeners()}setStreamController(e){this.streamController=e}registerListeners(){this.hls.on(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(e,t){const n=this.hls.config;if(n.capLevelOnFPSDrop){const e=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=e,e&&"function"==typeof e.getVideoPlaybackQuality&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),n.fpsDroppedMonitoringPeriod)}}onMediaDetaching(){this.media=null}checkFPS(e,t,n){const i=performance.now();if(t){if(this.lastTime){const e=i-this.lastTime,r=n-this.lastDroppedFrames,s=t-this.lastDecodedFrames,a=1e3*r/e,o=this.hls;if(o.trigger(l.FPS_DROP,{currentDropped:r,currentDecoded:s,totalDroppedFrames:n}),a>0&&r>o.config.fpsDroppedMonitoringThreshold*s){let e=o.currentLevel;o.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+e),e>0&&(-1===o.autoLevelCapping||o.autoLevelCapping>=e)&&(e-=1,o.trigger(l.FPS_DROP_LEVEL_CAPPING,{level:e,droppedLevel:o.currentLevel}),o.autoLevelCapping=e,this.streamController.nextLevelSwitch())}}this.lastTime=i,this.lastDroppedFrames=n,this.lastDecodedFrames=t}}checkFPSInterval(){const e=this.media;if(e)if(this.isVideoPlaybackQualityAvailable){const t=e.getVideoPlaybackQuality();this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)}},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:Dn,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:Uo,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 Oi{constructor(e,t,n){super(e,t,n,"subtitle-stream-controller",_),this.currentTrackId=-1,this.tracksBuffered=[],this.mainDetails=null,this.registerListeners()}onHandlerDestroying(){this.unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null}registerListeners(){super.registerListeners();const{hls:e}=this;e.on(l.LEVEL_LOADED,this.onLevelLoaded,this),e.on(l.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(l.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(l.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(l.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(l.BUFFER_FLUSHING,this.onBufferFlushing,this)}unregisterListeners(){super.unregisterListeners();const{hls:e}=this;e.off(l.LEVEL_LOADED,this.onLevelLoaded,this),e.off(l.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(l.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(l.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(l.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(l.BUFFER_FLUSHING,this.onBufferFlushing,this)}startLoad(e,t){this.stopLoad(),this.state=ki,this.setInterval(500),this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}onManifestLoading(){super.onManifestLoading(),this.mainDetails=null}onMediaDetaching(e,t){this.tracksBuffered=[],super.onMediaDetaching(e,t)}onLevelLoaded(e,t){this.mainDetails=t.details}onSubtitleFragProcessed(e,t){const{frag:n,success:i}=t;if(this.fragContextChanged(n)||(W(n)&&(this.fragPrevious=n),this.state=ki),!i)return;const r=this.tracksBuffered[this.currentTrackId];if(!r)return;let s;const a=n.start;for(let e=0;e<r.length;e++)if(a>=r[e].start&&a<=r[e].end){s=r[e];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(e,t){const{startOffset:n,endOffset:i}=t;if(0===n&&i!==Number.POSITIVE_INFINITY){const e=i-1;if(e<=0)return;t.endOffsetSubtitles=Math.max(0,e),this.tracksBuffered.forEach((t=>{for(let n=0;n<t.length;)if(t[n].end<=e)t.shift();else{if(!(t[n].start<e))break;t[n].start=e,n++}})),this.fragmentTracker.removeFragmentsInRange(n,e,_)}}onError(e,t){const n=t.frag;(null==n?void 0:n.type)===_&&(t.details===o.FRAG_GAP&&this.fragmentTracker.fragBuffered(n,!0),this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==wi&&(this.state=ki))}onSubtitleTracksUpdated(e,{subtitleTracks:t}){this.levels&&fs(this.levels,t)?this.levels=t.map((e=>new et(e))):(this.tracksBuffered=[],this.levels=t.map((e=>{const t=new et(e);return this.tracksBuffered[t.id]=[],t})),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,_),this.fragPrevious=null,this.mediaBuffer=null)}onSubtitleTrackSwitch(e,t){var n;if(this.currentTrackId=t.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!==wi&&this.setInterval(500)}onSubtitleTrackLoaded(e,t){var n;const{currentTrackId:i,levels:r}=this,{details:s,id:a}=t;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 e=this.mainDetails;if(!e)return void(this.startFragRequested=!1);const t=e.fragments[0];var c;if(o.details)u=this.alignPlaylists(s,o.details,null==(c=this.levelLastLoaded)?void 0:c.details),0===u&&t&&(u=t.start,ai(s,u));else s.hasProgramDateTime&&e.hasProgramDateTime?(vi(s,e),u=s.fragmentStart):t&&(u=t.start,ai(s,u));e&&!this.startFragRequested&&this.setStartPosition(e,u)}if(o.details=s,this.levelLastLoaded=o,a===i&&(this.hls.trigger(l.SUBTITLE_TRACK_UPDATED,{details:s,id:a,groupId:t.groupId}),this.tick(),s.live&&!this.fragCurrent&&this.media&&this.state===ki)){ft(null,s.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),o.details=void 0)}}_handleFragmentLoadComplete(e){const{frag:t,payload:n}=e,i=t.decryptdata,r=this.hls;if(!this.fragContextChanged(t)&&n&&n.byteLength>0&&null!=i&&i.key&&i.iv&&mn(i.method)){const e=performance.now();this.decrypter.decrypt(new Uint8Array(n),i.key.buffer,i.iv.buffer,vn(i.method)).catch((e=>{throw r.trigger(l.ERROR,{type:a.MEDIA_ERROR,details:o.FRAG_DECRYPT_ERROR,fatal:!1,error:e,reason:e.message,frag:t}),e})).then((n=>{const i=performance.now();r.trigger(l.FRAG_DECRYPTED,{frag:t,payload:n,stats:{tstart:e,tdecrypt:i}})})).catch((e=>{this.warn(`${e.name}: ${e.message}`),this.state=ki}))}}doTick(){if(this.media){if(this.state===ki){const{currentTrackId:e,levels:t}=this,n=null==t?void 0:t[e];if(!n||!t.length||!n.details)return;if(this.waitForLive(n))return;const{config:i}=this,r=this.getLoadPosition(),s=nn.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,c=u.length,h=l.edge;let d=null;const f=this.fragPrevious;if(a<h){const e=i.maxFragLookUpTolerance,t=a>h-e?0:e;d=ft(f,u,Math.max(u[0].start,a),t),!d&&f&&f.start<u[0].start&&(d=u[0])}else d=u[c-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)===Ot&&(d=p),this.fragmentTracker.getState(d)===Ot){const e=this.mapToInitFragWhenRequired(d);e&&this.loadFragment(e,n,a)}}}else this.state=ki}loadFragment(e,t,n){W(e)?super.loadFragment(e,t,n):this._loadInitSegment(e,t)}get mediaBufferTimeRanges(){return new ja(this.tracksBuffered[this.currentTrackId]||[])}},subtitleTrackController:class extends ds{constructor(e){super(e,"subtitle-track-controller"),this.media=null,this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.queuedDefaultTrack=-1,this.useTextTrackPolling=!1,this.subtitlePollingInterval=-1,this._subtitleDisplay=!0,this.asyncPollTrackChange=()=>this.pollTrackChange(0),this.onTextTracksChanged=()=>{if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;let e=null;const t=Ca(this.media.textTracks);for(let n=0;n<t.length;n++)if("hidden"===t[n].mode)e=t[n];else if("showing"===t[n].mode){e=t[n];break}const n=this.findTrackForTextTrack(e);this.subtitleTrack!==n&&this.setSubtitleTrack(n)},this.registerListeners()}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,this.onTextTracksChanged=this.asyncPollTrackChange=null,super.destroy()}get subtitleDisplay(){return this._subtitleDisplay}set subtitleDisplay(e){this._subtitleDisplay=e,this.trackId>-1&&this.toggleTrackModes()}registerListeners(){const{hls:e}=this;e.on(l.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(l.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(l.MANIFEST_LOADING,this.onManifestLoading,this),e.on(l.MANIFEST_PARSED,this.onManifestParsed,this),e.on(l.LEVEL_LOADING,this.onLevelLoading,this),e.on(l.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(l.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(l.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(l.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(l.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(l.MANIFEST_LOADING,this.onManifestLoading,this),e.off(l.MANIFEST_PARSED,this.onManifestParsed,this),e.off(l.LEVEL_LOADING,this.onLevelLoading,this),e.off(l.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(l.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(l.ERROR,this.onError,this)}onMediaAttached(e,t){this.media=t.media,this.media&&(this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange))}pollTrackChange(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.onTextTracksChanged,e)}onMediaDetaching(e,t){const n=this.media;if(!n)return;const i=!!t.transferMedia;if(self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||n.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),this.subtitleTrack=-1,this.media=null,i)return;Ca(n.textTracks).forEach((e=>{Ta(e)}))}onManifestLoading(){this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.subtitleTracks}onSubtitleTrackLoaded(e,t){const{id:n,groupId:i,details:r}=t,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=t.details,this.log(`Subtitle track ${n} "${s.name}" lang:${s.lang} group:${i} loaded [${r.startSN}-${r.endSN}]`),n===this.trackId&&this.playlistLoaded(n,t,a)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const n=t.subtitleGroups||null,i=this.groupIds;let r=this.currentTrack;if(!n||(null==i?void 0:i.length)!==(null==n?void 0:n.length)||null!=n&&n.some((e=>-1===(null==i?void 0:i.indexOf(e))))){this.groupIds=n,this.trackId=-1,this.currentTrack=null;const e=this.tracks.filter((e=>!n||-1!==n.indexOf(e.groupId)));if(e.length)this.selectDefaultTrack&&!e.some((e=>e.default))&&(this.selectDefaultTrack=!1),e.forEach(((e,t)=>{e.id=t}));else if(!r&&!this.tracksInGroup.length)return;this.tracksInGroup=e;const t=this.hls.config.subtitlePreference;if(!r&&t){this.selectDefaultTrack=!1;const n=ot(t,e);if(n>-1)r=e[n];else{const e=ot(t,this.tracks);r=this.tracks[e]}}let i=this.findTrackId(r);-1===i&&r&&(i=this.findTrackId(null));const s={subtitleTracks:e};this.log(`Updating subtitle tracks, ${e.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(e){const t=this.tracksInGroup,n=this.selectDefaultTrack;for(let i=0;i<t.length;i++){const r=t[i];if((!n||r.default)&&(n||e)&&(!e||lt(r,e)))return i}if(e){for(let n=0;n<t.length;n++){const i=t[n];if(ps(e.attrs,i.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return n}for(let n=0;n<t.length;n++){const i=t[n];if(ps(e.attrs,i.attrs,["LANGUAGE"]))return n}}return-1}findTrackForTextTrack(e){if(e){const t=this.tracksInGroup;for(let n=0;n<t.length;n++){if(_s(t[n],e))return n}}return-1}onError(e,t){!t.fatal&&t.context&&(t.context.type!==d||t.context.id!==this.trackId||this.groupIds&&-1===this.groupIds.indexOf(t.context.groupId)||this.checkRetry(t))}get allSubtitleTracks(){return this.tracks}get subtitleTracks(){return this.tracksInGroup}get subtitleTrack(){return this.trackId}set subtitleTrack(e){this.selectDefaultTrack=!1,this.setSubtitleTrack(e)}setSubtitleOption(e){if(this.hls.config.subtitlePreference=e,e){if(-1===e.id)return this.setSubtitleTrack(-1),null;const t=this.allSubtitleTracks;if(this.selectDefaultTrack=!1,t.length){const n=this.currentTrack;if(n&<(e,n))return n;const i=ot(e,this.tracksInGroup);if(i>-1){const e=this.tracksInGroup[i];return this.setSubtitleTrack(i),e}if(n)return null;{const n=ot(e,t);if(n>-1)return t[n]}}}return null}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentTrack)&&this.scheduleLoading(this.currentTrack,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const n=e.id,i=e.groupId,r=this.getUrlWithDirectives(e.url,t),s=e.details,a=null==s?void 0:s.age;this.log(`Loading subtitle ${n} "${e.name}" lang:${e.lang} group:${i}${void 0!==(null==t?void 0:t.msn)?" at sn "+t.msn+" part "+t.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:t||null,track:e})}toggleTrackModes(){const{media:e}=this;if(!e)return;const t=Ca(e.textTracks),n=this.currentTrack;let i;if(n&&(i=t.filter((e=>_s(n,e)))[0],i||this.warn(`Unable to find subtitle TextTrack with name "${n.name}" and language "${n.lang}"`)),[].slice.call(t).forEach((e=>{"disabled"!==e.mode&&e!==i&&(e.mode="disabled")})),i){const e=this.subtitleDisplay?"showing":"hidden";i.mode!==e&&(i.mode=e)}}setSubtitleTrack(e){const t=this.tracksInGroup;if(!this.media)return void(this.queuedDefaultTrack=e);if(e<-1||e>=t.length||!i(e))return void this.warn(`Invalid subtitle track id: ${e}`);this.selectDefaultTrack=!1;const n=this.currentTrack,r=t[e]||null;if(this.trackId=e,this.currentTrack=r,this.toggleTrackModes(),!r)return void this.hls.trigger(l.SUBTITLE_TRACK_SWITCH,{id:e});const s=!!r.details&&!r.details.live;if(e===this.trackId&&r===n&&s)return;this.log(`Switching to subtitle-track ${e}`+(r?` "${r.name}" lang:${r.lang} group:${r.groupId}`:""));const{id:a,groupId:o="",name:u,type:c,url:h}=r;this.hls.trigger(l.SUBTITLE_TRACK_SWITCH,{id:a,groupId:o,name:u,type:c,url:h});const d=this.switchParams(r.url,null==n?void 0:n.details,r.details);this.loadPlaylist(d)}},timelineController:class{constructor(e){this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}},this.captionsProperties=void 0,this.hls=e,this.config=e.config,this.Cues=e.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},e.on(l.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(l.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(l.MANIFEST_LOADING,this.onManifestLoading,this),e.on(l.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(l.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(l.FRAG_LOADING,this.onFragLoading,this),e.on(l.FRAG_LOADED,this.onFragLoaded,this),e.on(l.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(l.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(l.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(l.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(l.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:e}=this;e.off(l.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(l.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(l.MANIFEST_LOADING,this.onManifestLoading,this),e.off(l.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(l.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(l.FRAG_LOADING,this.onFragLoading,this),e.off(l.FRAG_LOADED,this.onFragLoaded,this),e.off(l.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(l.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(l.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(l.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(l.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.media=null,this.cea608Parser1=this.cea608Parser2=void 0}initCea608Parsers(){const e=new Mo(this,"textTrack1"),t=new Mo(this,"textTrack2"),n=new Mo(this,"textTrack3"),i=new Mo(this,"textTrack4");this.cea608Parser1=new ao(1,e,t),this.cea608Parser2=new ao(3,n,i)}addCues(e,t,n,i,r){let s=!1;for(let e=r.length;e--;){const i=r[e],l=(a=i[0],o=i[1],u=t,c=n,Math.min(o,c)-Math.max(a,u));if(l>=0&&(i[0]=Math.min(i[0],t),i[1]=Math.max(i[1],n),s=!0,l/(n-t)>.5))return}var a,o,u,c;if(s||r.push([t,n]),this.config.renderTextTracksNatively){const r=this.captionsTracks[e];this.Cues.newCue(r,t,n,i)}else{const r=this.Cues.newCue(null,t,n,i);this.hls.trigger(l.CUES_PARSED,{type:"captions",cues:r,track:e})}}onInitPtsFound(e,{frag:t,id:n,initPTS:i,timescale:r,trackId:s}){const{unparsedVttFrags:a}=this;n===f&&(this.initPTS[t.cc]={baseTime:i,timescale:r,trackId:s}),a.length&&(this.unparsedVttFrags=[],a.forEach((e=>{this.initPTS[e.frag.cc]?this.onFragLoaded(l.FRAG_LOADED,e):this.hls.trigger(l.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e.frag,error:new Error("Subtitle discontinuity domain does not match main")})})))}getExistingTrack(e,t){const{media:n}=this;if(n)for(let i=0;i<n.textTracks.length;i++){const r=n.textTracks[i];if(Fo(r,{name:e,lang:t,characteristics:"transcribes-spoken-dialog,describes-music-and-sound"}))return r}return null}createCaptionsTrack(e){this.config.renderTextTracksNatively?this.createNativeTrack(e):this.createNonNativeTrack(e)}createNativeTrack(e){if(this.captionsTracks[e])return;const{captionsProperties:t,captionsTracks:n,media:i}=this,{label:r,languageCode:s}=t[e],a=this.getExistingTrack(r,s);if(a)n[e]=a,Ta(n[e]),ka(n[e],i);else{const t=this.createTextTrack("captions",r,s);t&&(t[e]=!0,n[e]=t)}}createNonNativeTrack(e){if(this.nonNativeCaptionsTracks[e])return;const t=this.captionsProperties[e];if(!t)return;const n={_id:e,label:t.label,kind:"captions",default:!!t.media&&!!t.media.default,closedCaptions:t.media};this.nonNativeCaptionsTracks[e]=n,this.hls.trigger(l.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[n]})}createTextTrack(e,t,n){const i=this.media;if(i)return i.addTextTrack(e,t,n)}onMediaAttaching(e,t){this.media=t.media,t.mediaSource||this._cleanTracks()}onMediaDetaching(e,t){const n=!!t.transferMedia;if(this.media=null,n)return;const{captionsTracks:i}=this;Object.keys(i).forEach((e=>{Ta(i[e]),delete i[e]})),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:e}=this;if(!e)return;const t=e.textTracks;if(t)for(let e=0;e<t.length;e++)Ta(t[e])}onSubtitleTracksUpdated(e,t){const n=t.subtitleTracks||[],i=n.some((e=>e.textCodec===So));if(this.config.enableWebVTT||i&&this.config.enableIMSC1){if(fs(this.tracks,n))return void(this.tracks=n);if(this.textTracks=[],this.tracks=n,this.config.renderTextTracksNatively){const e=this.media,t=e?Ca(e.textTracks):null;if(this.tracks.forEach(((e,n)=>{let i;if(t){let n=null;for(let i=0;i<t.length;i++)if(t[i]&&Fo(t[i],e)){n=t[i],t[i]=null;break}n&&(i=n)}if(i)Ta(i);else{const t=No(e);i=this.createTextTrack(t,e.name,e.lang),i&&(i.mode="disabled")}i&&this.textTracks.push(i)})),null!=t&&t.length){const e=t.filter((e=>null!==e)).map((e=>e.label));e.length&&this.hls.logger.warn(`Media element contains unused subtitle tracks: ${e.join(", ")}. Replace media element for each source to clear TextTracks and captions menu.`)}}else if(this.tracks.length){const e=this.tracks.map((e=>({label:e.name,kind:e.type.toLowerCase(),default:e.default,subtitleTrack:e})));this.hls.trigger(l.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:e})}}}onManifestLoaded(e,t){this.config.enableCEA708Captions&&t.captions&&t.captions.forEach((e=>{const t=/(?:CC|SERVICE)([1-4])/.exec(e.instreamId);if(!t)return;const n=`textTrack${t[1]}`,i=this.captionsProperties[n];i&&(i.label=e.name,e.lang&&(i.languageCode=e.lang),i.media=e)}))}closedCaptionsForLevel(e){const t=this.hls.levels[e.level];return null==t?void 0:t.attrs["CLOSED-CAPTIONS"]}onFragLoading(e,t){if(this.enabled&&t.frag.type===f){var n,i;const{cea608Parser1:e,cea608Parser2:r,lastSn:s}=this,{cc:a,sn:o}=t.frag,l=null!=(n=null==(i=t.part)?void 0:i.index)?n:-1;e&&r&&(o!==s+1||o===s&&l!==this.lastPartIndex+1||a!==this.lastCc)&&(e.reset(),r.reset()),this.lastCc=a,this.lastSn=o,this.lastPartIndex=l}}onFragLoaded(e,t){const{frag:n,payload:i}=t;if(n.type===_)if(i.byteLength){const e=n.decryptdata,r="stats"in t;if(null==e||!e.encrypted||r){const e=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),e&&e.textCodec===So?this._parseIMSC1(n,i):this._parseVTTs(t)}}else this.hls.trigger(l.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:n,error:new Error("Empty subtitle payload")})}_parseIMSC1(e,t){const n=this.hls;Ro(t,this.initPTS[e.cc],(t=>{this._appendCues(t,e.level),n.trigger(l.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})}),(t=>{n.logger.log(`Failed to parse IMSC1: ${t}`),n.trigger(l.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:t})}))}_parseVTTs(e){var t;const{frag:n,payload:i}=e,{initPTS:r,unparsedVttFrags:s}=this,a=r.length-1;if(!r[n.cc]&&-1===a)return void s.push(e);const o=this.hls;ko(null!=(t=n.initSegment)&&t.data?ge(n.initSegment.data,new Uint8Array(i)).buffer:i,this.initPTS[n.cc],this.vttCCs,n.cc,n.start,(e=>{this._appendCues(e,n.level),o.trigger(l.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:n})}),(t=>{const r="Missing initPTS for VTT MPEGTS"===t.message;r?s.push(e):this._fallbackToIMSC1(n,i),o.logger.log(`Failed to parse VTT cue: ${t}`),r&&a>n.cc||o.trigger(l.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:n,error:t})}))}_fallbackToIMSC1(e,t){const n=this.tracks[e.level];n.textCodec||Ro(t,this.initPTS[e.cc],(()=>{n.textCodec=So,this._parseIMSC1(e,t)}),(()=>{n.textCodec="wvtt"}))}_appendCues(e,t){const n=this.hls;if(this.config.renderTextTracksNatively){const n=this.textTracks[t];if(!n||"disabled"===n.mode)return;e.forEach((e=>Sa(n,e)))}else{const i=this.tracks[t];if(!i)return;const r=i.default?"default":"subtitles"+t;n.trigger(l.CUES_PARSED,{type:"subtitles",cues:e,track:r})}}onFragDecrypted(e,t){const{frag:n}=t;n.type===_&&this.onFragLoaded(l.FRAG_LOADED,t)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(e,t){if(!this.enabled||!this.config.enableCEA708Captions)return;const{frag:n,samples:i}=t;if(n.type!==f||"NONE"!==this.closedCaptionsForLevel(n))for(let e=0;e<i.length;e++){const t=i[e].bytes;if(t){this.cea608Parser1||this.initCea608Parsers();const n=this.extractCea608Data(t);this.cea608Parser1.addData(i[e].pts,n[0]),this.cea608Parser2.addData(i[e].pts,n[1])}}}onBufferFlushing(e,{startOffset:t,endOffset:n,endOffsetSubtitles:i,type:r}){const{media:s}=this;if(s&&!(s.currentTime<n)){if(!r||"video"===r){const{captionsTracks:e}=this;Object.keys(e).forEach((i=>Aa(e[i],t,n)))}if(this.config.renderTextTracksNatively&&0===t&&void 0!==i){const{textTracks:e}=this;Object.keys(e).forEach((n=>Aa(e[n],t,i)))}}}extractCea608Data(e){const t=[[],[]],n=31&e[0];let i=2;for(let r=0;r<n;r++){const n=e[i++],r=127&e[i++],s=127&e[i++];if(0===r&&0===s)continue;if(0!=(4&n)){const e=3&n;0!==e&&1!==e||(t[e].push(r),t[e].push(s))}}return t}},audioStreamController:class extends Oi{constructor(e,t,n){super(e,t,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:e}=this;e.on(l.LEVEL_LOADED,this.onLevelLoaded,this),e.on(l.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on(l.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(l.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(l.BUFFER_RESET,this.onBufferReset,this),e.on(l.BUFFER_CREATED,this.onBufferCreated,this),e.on(l.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(l.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(l.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(l.FRAG_LOADING,this.onFragLoading,this),e.on(l.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){const{hls:e}=this;e&&(super.unregisterListeners(),e.off(l.LEVEL_LOADED,this.onLevelLoaded,this),e.off(l.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off(l.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(l.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(l.BUFFER_RESET,this.onBufferReset,this),e.off(l.BUFFER_CREATED,this.onBufferCreated,this),e.off(l.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(l.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(l.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(l.FRAG_LOADING,this.onFragLoading,this),e.off(l.FRAG_BUFFERED,this.onFragBuffered,this))}onInitPtsFound(e,{frag:t,id:n,initPTS:i,timescale:r,trackId:s}){if(n===f){const e=t.cc,n=this.fragCurrent;if(this.initPTS[e]={baseTime:i,timescale:r,trackId:s},this.log(`InitPTS for cc: ${e} found from main: ${i/r} (${i}/${r}) trackId: ${s}`),this.mainAnchor=t,this.state===Di){const n=this.waitingData;(!n&&!this.loadingParts||n&&n.frag.cc!==e)&&this.syncWithAnchor(t,null==n?void 0:n.frag)}else!this.hls.hasEnoughToStart&&n&&n.cc!==e?(n.abortRequests(),this.syncWithAnchor(t,n)):this.state===ki&&this.tick()}}getLoadPosition(){return!this.startFragRequested&&this.nextLoadPosition>=0?this.nextLoadPosition:super.getLoadPosition()}syncWithAnchor(e,t){var n;const i=(null==(n=this.mainFragLoading)?void 0:n.frag)||null;if(t&&(null==i?void 0:i.cc)===t.cc)return;const r=(i||e).cc,s=gt(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===ki&&this.doTickIdle())}startLoad(e,t){if(!this.levels)return this.startPosition=e,void(this.state=wi);const n=this.lastCurrentTime;this.stopLoad(),this.setInterval(100),n>0&&-1===e?(this.log(`Override startPosition with lastCurrentTime @${n.toFixed(3)}`),e=n,this.state=ki):this.state=Ci,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}doTick(){switch(this.state){case ki:this.doTickIdle();break;case Ci:{const{levels:e,trackId:t}=this,n=null==e?void 0:e[t],i=null==n?void 0:n.details;if(i&&!this.waitForLive(n)){if(this.waitForCdnTuneIn(i))break;this.state=Di}break}case Ai:this.checkRetryDate();break;case Di:{const e=this.waitingData;if(e){const{frag:t,part:n,cache:i,complete:r}=e,s=this.mainAnchor;if(void 0!==this.initPTS[t.cc]){this.waitingData=null,this.state=Ti;const e={frag:t,part:n,payload:i.flush().buffer,networkDetails:null};this._handleFragmentLoadProgress(e),r&&super._handleFragmentLoadComplete(e)}else s&&s.cc!==e.frag.cc&&this.syncWithAnchor(s,e.frag)}else this.state=ki}}this.onTickEnd()}resetLoadingState(){const e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null),super.resetLoadingState()}onTickEnd(){const{media:e}=this;null!=e&&e.readyState&&(this.lastCurrentTime=e.currentTime)}doTickIdle(){var e;const{hls:t,levels:n,media:i,trackId:r}=this,s=t.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=Ci,void(this.startFragRequested=!1);const u=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&u&&(this.bufferFlushed=!1,this.afterBufferFlushed(u,V,p));const c=this.getFwdBufferInfo(u,p);if(null===c)return;if(!this.switchingTrack&&this._streamEnded(c,o))return t.trigger(l.BUFFER_EOS,{type:"audio"}),void(this.state=xi);const h=c.len,d=t.maxBufferLength,_=o.fragments,g=_[0].start,m=this.getLoadPosition(),v=this.flushing?m:c.end;if(this.switchingTrack&&i){const e=m;o.PTSKnown&&e<g&&(c.end>g||c.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),i.currentTime=g+.05)}if(h>=d&&!this.switchingTrack&&v<_[_.length-1].start)return;let y=this.getNextFragment(v,o);if(y&&this.isLoopLoading(y,v)&&(y=this.getNextFragmentLoopLoading(y,o,c,f,d)),!y)return void(this.bufferFlushed=!0);let b=(null==(e=this.mainFragLoading)?void 0:e.frag)||null;if(!this.audioOnly&&this.startFragRequested&&b&&W(y)&&!y.endList&&(!o.live||!this.loadingParts&&v<this.hls.liveSyncPosition)&&(this.fragmentTracker.getState(b)===Ft&&(this.mainFragLoading=b=null),b&&W(b))){if(y.start>b.end){const e=this.fragmentTracker.getFragAtPos(v,f);e&&e.end>b.end&&(b=e,this.mainFragLoading={frag:e,targetBufferTime:null})}if(y.start>b.end)return}this.loadFragment(y,a,v)}onMediaDetaching(e,t){this.bufferFlushed=this.flushing=!1,super.onMediaDetaching(e,t)}onAudioTracksUpdated(e,{audioTracks:t}){this.resetTransmuxer(),this.levels=t.map((e=>new et(e)))}onAudioTrackSwitching(e,t){const n=!!t.url;this.trackId=t.id;const{fragCurrent:i}=this;i&&(i.abortRequests(),this.removeUnbufferedFrags(i.start)),this.resetLoadingState(),n?(this.switchingTrack=t,this.flushAudioIfNeeded(t),this.state!==wi&&(this.setInterval(100),this.state=ki,this.tick())):(this.resetTransmuxer(),this.switchingTrack=null,this.bufferedTrack=t,this.clearInterval())}onManifestLoading(){super.onManifestLoading(),this.bufferFlushed=this.flushing=this.audioOnly=!1,this.resetItem(),this.trackId=-1}onLevelLoaded(e,t){this.mainDetails=t.details;const n=this.cachedTrackLoadedData;n&&(this.cachedTrackLoadedData=null,this.onAudioTrackLoaded(l.AUDIO_TRACK_LOADED,n))}onAudioTrackLoaded(e,t){var n;const{levels:i}=this,{details:r,id:s,groupId:a,track:o}=t;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=t,void(this.state!==wi&&(this.state=Ci));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 c=i[s];let h=0;if(r.live||null!=(n=c.details)&&n.live){if(this.checkLiveUpdate(r),r.deltaUpdateFailed)return;var d;if(c.details)h=this.alignPlaylists(r,c.details,null==(d=this.levelLastLoaded)?void 0:d.details);r.alignedSliding||(mi(r,u),r.alignedSliding||vi(r,u),h=r.fragmentStart)}c.details=r,this.levelLastLoaded=c,this.startFragRequested||this.setStartPosition(u,h),this.hls.trigger(l.AUDIO_TRACK_UPDATED,{details:r,id:s,groupId:t.groupId}),this.state!==Ci||this.waitForCdnTuneIn(r)||(this.state=ki),this.tick()}_handleFragmentLoadProgress(e){var t;const n=e.frag,{part:i,payload:r}=e,{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 c=s.defaultAudioCodec||l.audioCodec||"mp4a.40.2";let h=this.transmuxer;h||(h=this.transmuxer=new hs(this.hls,p,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const d=this.initPTS[n.cc],f=null==(t=n.initSegment)?void 0:t.data;if(void 0!==d){const e=!1,t=i?i.index:-1,s=-1!==t,a=new en(n.level,n.sn,n.stats.chunkCount,r.byteLength,t,s);h.push(r,f,c,"",n,i,u.totalduration,e,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:e}=this.waitingData=this.waitingData||{frag:n,part:i,cache:new Ni,complete:!1};e.push(new Uint8Array(r)),this.state!==wi&&(this.state=Di)}}_handleFragmentLoadComplete(e){this.waitingData?this.waitingData.complete=!0:super._handleFragmentLoadComplete(e)}onBufferReset(){this.mediaBuffer=null}onBufferCreated(e,t){this.bufferFlushed=this.flushing=!1;const n=t.tracks.audio;n&&(this.mediaBuffer=n.buffer||null)}onFragLoading(e,t){!this.audioOnly&&t.frag.type===f&&W(t.frag)&&(this.mainFragLoading=t,this.state===ki&&this.tick())}onFragBuffered(e,t){const{frag:n,part:i}=t;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 e=this.switchingTrack;e&&(this.bufferedTrack=e,this.switchingTrack=null,this.hls.trigger(l.AUDIO_TRACK_SWITCHED,E({},e)))}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(e,t){var n;if(t.fatal)this.state=Ii;else switch(t.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,t);break;case o.AUDIO_TRACK_LOAD_ERROR:case o.AUDIO_TRACK_LOAD_TIMEOUT:case o.LEVEL_PARSING_ERROR:t.levelRetry||this.state!==Ci||(null==(n=t.context)?void 0:n.type)!==h||(this.state=ki);break;case o.BUFFER_ADD_CODEC_ERROR:case o.BUFFER_APPEND_ERROR:if("audio"!==t.parent)return;this.reduceLengthAndFlushBuffer(t)||this.resetLoadingState();break;case o.BUFFER_FULL_ERROR:if("audio"!==t.parent)return;this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case o.INTERNAL_EXCEPTION:this.recoverWorkerError(t)}}onBufferFlushing(e,{type:t}){t!==Z&&(this.flushing=!0)}onBufferFlushed(e,{type:t}){if(t!==Z){this.flushing=!1,this.bufferFlushed=!0,this.state===xi&&(this.state=ki);const e=this.mediaBuffer||this.media;e&&(this.afterBufferFlushed(e,t,p),this.tick())}}_handleTransmuxComplete(e){var t;const n="audio",{hls:i}=this,{remuxResult:r,chunkMeta:s}=e,a=this.getCurrentContext(s);if(!a)return void this.resetWhenMissingContext(s);const{frag:o,part:u,level:c}=a,{details:h}=c,{audio:d,text:f,id3:p,initSegment:_}=r;if(!this.fragContextChanged(o)&&h){if(this.state=Ri,this.switchingTrack&&d&&this.completeAudioSwitch(this.switchingTrack),null!=_&&_.tracks){const e=o.initSegment||o;if(this.unhandledEncryptionError(_,o))return;this._bufferInitSegment(c,_.tracks,e,s),i.trigger(l.FRAG_PARSING_INIT_SEGMENT,{frag:e,id:n,tracks:_.tracks})}if(d){const{startPTS:e,endPTS:t,startDTS:n,endDTS:i}=d;u&&(u.elementaryStreams[V]={startPTS:e,endPTS:t,startDTS:n,endDTS:i}),o.setElementaryStreamInfo(V,e,t,n,i),this.bufferFragmentData(d,o,u,s)}if(null!=p&&null!=(t=p.samples)&&t.length){const e=y({id:n,frag:o,details:h},p);i.trigger(l.FRAG_PARSING_METADATA,e)}if(f){const e=y({id:n,frag:o,details:h},f);i.trigger(l.FRAG_PARSING_USERDATA,e)}}else this.fragmentTracker.removeFragment(o)}_bufferInitSegment(e,t,n,i){if(this.state!==Ri)return;if(t.video&&delete t.video,t.audiovideo&&delete t.audiovideo,!t.audio)return;const r=t.audio;r.id=p;const s=e.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,t);const a=r.initSegment;if(null!=a&&a.byteLength){const e={type:"audio",frag:n,part:null,chunkMeta:i,parent:n.type,data:a};this.hls.trigger(l.BUFFER_APPENDING,e)}this.tickImmediate()}loadFragment(e,t,n){const i=this.fragmentTracker.getState(e);var r;if(this.switchingTrack||i===Ot||i===Nt)if(W(e))if(null!=(r=t.details)&&r.live&&!this.initPTS[e.cc]){this.log(`Waiting for video PTS in continuity counter ${e.cc} of live stream before loading audio fragment ${e.sn} of level ${this.trackId}`),this.state=Di;const n=this.mainDetails;n&&n.fragmentStart!==t.details.fragmentStart&&vi(t.details,n)}else super.loadFragment(e,t,n);else this._loadInitSegment(e,t);else this.clearTrackerIfNeeded(e)}flushAudioIfNeeded(e){if(this.media&&this.bufferedTrack){const{name:t,lang:n,assocLang:i,characteristics:r,audioCodec:s,channels:a}=this.bufferedTrack;lt({name:t,lang:n,assocLang:i,characteristics:r,audioCodec:s,channels:a},e,ut)||(ht(e.url,this.hls)?(this.log("Switching audio track : flushing all audio"),super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"),this.bufferedTrack=null):this.bufferedTrack=e)}}completeAudioSwitch(e){const{hls:t}=this;this.flushAudioIfNeeded(e),this.bufferedTrack=e,this.switchingTrack=null,t.trigger(l.AUDIO_TRACK_SWITCHED,E({},e))}},audioTrackController:class extends ds{constructor(e){super(e,"audio-track-controller"),this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.registerListeners()}registerListeners(){const{hls:e}=this;e.on(l.MANIFEST_LOADING,this.onManifestLoading,this),e.on(l.MANIFEST_PARSED,this.onManifestParsed,this),e.on(l.LEVEL_LOADING,this.onLevelLoading,this),e.on(l.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(l.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(l.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(l.MANIFEST_LOADING,this.onManifestLoading,this),e.off(l.MANIFEST_PARSED,this.onManifestParsed,this),e.off(l.LEVEL_LOADING,this.onLevelLoading,this),e.off(l.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(l.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.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(e,t){this.tracks=t.audioTracks||[]}onAudioTrackLoaded(e,t){const{id:n,groupId:i,details:r}=t,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=t.details,this.log(`Audio track ${n} "${s.name}" lang:${s.lang} group:${i} loaded [${r.startSN}-${r.endSN}]`),n===this.trackId&&this.playlistLoaded(n,t,a)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const n=t.audioGroups||null,i=this.groupIds;let r=this.currentTrack;if(!n||(null==i?void 0:i.length)!==(null==n?void 0:n.length)||null!=n&&n.some((e=>-1===(null==i?void 0:i.indexOf(e))))){this.groupIds=n,this.trackId=-1,this.currentTrack=null;const e=this.tracks.filter((e=>!n||-1!==n.indexOf(e.groupId)));if(e.length)this.selectDefaultTrack&&!e.some((e=>e.default))&&(this.selectDefaultTrack=!1),e.forEach(((e,t)=>{e.id=t}));else if(!r&&!this.tracksInGroup.length)return;this.tracksInGroup=e;const t=this.hls.config.audioPreference;if(!r&&t){const n=ot(t,e,ut);if(n>-1)r=e[n];else{const e=ot(t,this.tracks);r=this.tracks[e]}}let i=this.findTrackId(r);-1===i&&r&&(i=this.findTrackId(null));const u={audioTracks:e};this.log(`Updating audio tracks, ${e.length} track(s) found in group(s): ${null==n?void 0:n.join(",")}`),this.hls.trigger(l.AUDIO_TRACKS_UPDATED,u);const c=this.trackId;if(-1!==i&&-1===c)this.setAudioTrack(i);else if(e.length&&-1===c){var s;const t=new Error(`No audio track selected for current audio group-ID(s): ${null==(s=this.groupIds)?void 0:s.join(",")} track count: ${e.length}`);this.warn(t.message),this.hls.trigger(l.ERROR,{type:a.MEDIA_ERROR,details:o.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:t})}}}onError(e,t){!t.fatal&&t.context&&(t.context.type!==h||t.context.id!==this.trackId||this.groupIds&&-1===this.groupIds.indexOf(t.context.groupId)||this.checkRetry(t))}get allAudioTracks(){return this.tracks}get audioTracks(){return this.tracksInGroup}get audioTrack(){return this.trackId}set audioTrack(e){this.selectDefaultTrack=!1,this.setAudioTrack(e)}setAudioOption(e){const t=this.hls;if(t.config.audioPreference=e,e){const n=this.allAudioTracks;if(this.selectDefaultTrack=!1,n.length){const i=this.currentTrack;if(i&<(e,i,ut))return i;const r=ot(e,this.tracksInGroup,ut);if(r>-1){const e=this.tracksInGroup[r];return this.setAudioTrack(r),e}if(i){let i=t.loadLevel;-1===i&&(i=t.firstAutoLevel);const r=function(e,t,n,i,r){const s=t[i],a=t.reduce(((e,t,n)=>{const i=t.uri;return(e[i]||(e[i]=[])).push(n),e}),{})[s.uri];a.length>1&&(i=Math.max.apply(Math,a));const o=s.videoRange,l=s.frameRate,u=s.codecSet.substring(0,4),c=ct(t,i,(t=>{if(t.videoRange!==o||t.frameRate!==l||t.codecSet.substring(0,4)!==u)return!1;const i=t.audioGroups,s=n.filter((e=>!i||-1!==i.indexOf(e.groupId)));return ot(e,s,r)>-1}));return c>-1?c:ct(t,i,(t=>{const i=t.audioGroups,s=n.filter((e=>!i||-1!==i.indexOf(e.groupId)));return ot(e,s,r)>-1}))}(e,t.levels,n,i,ut);if(-1===r)return null;t.nextLoadLevel=r}if(e.channels||e.audioCodec){const t=ot(e,n);if(t>-1)return n[t]}}}return null}setAudioTrack(e){const t=this.tracksInGroup;if(e<0||e>=t.length)return void this.warn(`Invalid audio track id: ${e}`);this.selectDefaultTrack=!1;const n=this.currentTrack,i=t[e],r=i.details&&!i.details.live;if(e===this.trackId&&i===n&&r)return;if(this.log(`Switching to audio-track ${e} "${i.name}" lang:${i.lang} group:${i.groupId} channels:${i.channels}`),this.trackId=e,this.currentTrack=i,this.hls.trigger(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(e){const t=this.tracksInGroup;for(let n=0;n<t.length;n++){const i=t[n];if((!this.selectDefaultTrack||i.default)&&(!e||lt(e,i,ut)))return n}if(e){const{name:n,lang:i,assocLang:r,characteristics:s,audioCodec:a,channels:o}=e;for(let e=0;e<t.length;e++){if(lt({name:n,lang:i,assocLang:r,characteristics:s,audioCodec:a,channels:o},t[e],ut))return e}for(let n=0;n<t.length;n++){const i=t[n];if(ps(e.attrs,i.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return n}for(let n=0;n<t.length;n++){const i=t[n];if(ps(e.attrs,i.attrs,["LANGUAGE"]))return n}}return-1}loadPlaylist(e){super.loadPlaylist();const t=this.currentTrack;this.shouldLoadPlaylist(t)&&ht(t.url,this.hls)&&this.scheduleLoading(t,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const n=e.id,i=e.groupId,r=this.getUrlWithDirectives(e.url,t),s=e.details,a=null==s?void 0:s.age;this.log(`Loading audio-track ${n} "${e.name}" lang:${e.lang} group:${i}${void 0!==(null==t?void 0:t.msn)?" at sn "+t.msn+" part "+t.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:t||null,track:e})}},emeController:va,cmcdController:class{constructor(e){this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.includeKeys=void 0,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=()=>{this.initialized&&(this.starved=!0),this.buffering=!0},this.onPlaying=()=>{this.initialized||(this.initialized=!0),this.buffering=!1},this.applyPlaylistData=e=>{try{this.apply(e,{ot:ks.MANIFEST,su:!this.initialized})}catch(e){this.hls.logger.warn("Could not generate manifest CMCD data.",e)}},this.applyFragmentData=e=>{try{const{frag:t,part:n}=e,i=this.hls.levels[t.level],r=this.getObjectType(t),s={d:1e3*(n||t).duration,ot:r};r!==ks.VIDEO&&r!==ks.AUDIO&&r!=ks.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(t);null!=a&&a.url&&a.url!==t.url&&(s.nor=a.url),this.apply(e,s)}catch(e){this.hls.logger.warn("Could not generate segment CMCD data.",e)}},this.hls=e;const t=this.config=e.config,{cmcd:n}=t;null!=n&&(t.pLoader=this.createPlaylistLoader(),t.fLoader=this.createFragmentLoader(),this.sid=n.sessionId||e.sessionId,this.cid=n.contentId,this.useHeaders=!0===n.useHeaders,this.includeKeys=n.includeKeys,this.registerListeners())}registerListeners(){const e=this.hls;e.on(l.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(l.MEDIA_DETACHED,this.onMediaDetached,this),e.on(l.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){const e=this.hls;e.off(l.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(l.MEDIA_DETACHED,this.onMediaDetached,this),e.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(e,t){this.media=t.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)}onMediaDetached(){this.media&&(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)}onBufferCreated(e,t){var n,i;this.audioBuffer=null==(n=t.tracks.audio)?void 0:n.buffer,this.videoBuffer=null==(i=t.tracks.video)?void 0:i.buffer}createData(){var e;return{v:1,sf:Ss.HLS,sid:this.sid,cid:this.cid,pr:null==(e=this.media)?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){y(t,this.createData());const n=t.ot===ks.INIT||t.ot===ks.VIDEO||t.ot===ks.MUXED;this.starved&&n&&(t.bs=!0,t.su=!0,this.starved=!1),null==t.su&&(t.su=this.buffering);const{includeKeys:i}=this;i&&(t=Object.keys(t).reduce(((e,n)=>(i.includes(n)&&(e[n]=t[n]),e)),{}));const r={baseUrl:e.url};this.useHeaders?(e.headers||(e.headers={}),da(e.headers,t,r)):e.url=_a(e.url,t,r)}getNextFrag(e){var t;const n=null==(t=this.hls.levels[e.level])?void 0:t.details;if(n){const t=e.sn-n.startSN;return n.fragments[t+1]}}getNextPart(e){var t;const{index:n,fragment:i}=e,r=null==(t=this.hls.levels[i.level])||null==(t=t.details)?void 0:t.partList;if(r){const{sn:e}=i;for(let t=r.length-1;t>=0;t--){const i=r[t];if(i.index===n&&i.fragment.sn===e)return r[t+1]}}}getObjectType(e){const{type:t}=e;return"subtitle"===t?ks.TIMED_TEXT:"initSegment"===e.sn?ks.INIT:"audio"===t?ks.AUDIO:"main"===t?this.hls.audioTracks.length?ks.VIDEO:ks.MUXED:void 0}getTopBandwidth(e){let t,n=0;const i=this.hls;if(e===ks.AUDIO)t=i.audioTracks;else{const e=i.maxAutoLevel,n=e>-1?e+1:i.levels.length;t=i.levels.slice(0,n)}return t.forEach((e=>{e.bitrate>n&&(n=e.bitrate)})),n>0?n:NaN}getBufferLength(e){const t=this.media,n=e===ks.AUDIO?this.audioBuffer:this.videoBuffer;if(!n||!t)return NaN;return 1e3*nn.bufferInfo(n,t.currentTime,this.config.maxBufferHole).len}createPlaylistLoader(){const{pLoader:e}=this.config,t=this.applyPlaylistData,n=e||this.config.loader;return class{constructor(e){this.loader=void 0,this.loader=new n(e)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(e,n,i){t(e),this.loader.load(e,n,i)}}}createFragmentLoader(){const{fLoader:e}=this.config,t=this.applyFragmentData,n=e||this.config.loader;return class{constructor(e){this.loader=void 0,this.loader=new n(e)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(e,n,i){t(e),this.loader.load(e,n,i)}}}},contentSteeringController:class extends w{constructor(e){super("content-steering",e.logger),this.hls=void 0,this.loader=null,this.uri=null,this.pathwayId=".",this._pathwayPriority=null,this.timeToLoad=300,this.reloadTimer=-1,this.updated=0,this.started=!1,this.enabled=!0,this.levels=null,this.audioTracks=null,this.subtitleTracks=null,this.penalizedPathways={},this.hls=e,this.registerListeners()}registerListeners(){const e=this.hls;e.on(l.MANIFEST_LOADING,this.onManifestLoading,this),e.on(l.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(l.MANIFEST_PARSED,this.onManifestParsed,this),e.on(l.ERROR,this.onError,this)}unregisterListeners(){const e=this.hls;e&&(e.off(l.MANIFEST_LOADING,this.onManifestLoading,this),e.off(l.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(l.MANIFEST_PARSED,this.onManifestParsed,this),e.off(l.ERROR,this.onError,this))}pathways(){return(this.levels||[]).reduce(((e,t)=>(-1===e.indexOf(t.pathwayId)&&e.push(t.pathwayId),e)),[])}get pathwayPriority(){return this._pathwayPriority}set pathwayPriority(e){this.updatePathwayPriority(e)}startLoad(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){const e=1e3*this.timeToLoad-(performance.now()-this.updated);if(e>0)return void this.scheduleRefresh(this.uri,e)}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(e){const t=this.levels;t&&(this.levels=t.filter((t=>t!==e)))}onManifestLoading(){this.stopLoad(),this.enabled=!0,this.timeToLoad=300,this.updated=0,this.uri=null,this.pathwayId=".",this.levels=this.audioTracks=this.subtitleTracks=null}onManifestLoaded(e,t){const{contentSteering:n}=t;null!==n&&(this.pathwayId=n.pathwayId,this.uri=n.uri,this.started&&this.startLoad())}onManifestParsed(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks}onError(e,t){const{errorAction:n}=t;if((null==n?void 0:n.action)===At&&n.flags===xt){const e=this.levels;let i=this._pathwayPriority,r=this.pathwayId;if(t.context){const{groupId:n,pathwayId:i,type:s}=t.context;n&&e?r=this.getPathwayForGroupId(n,s,r):i&&(r=i)}r in this.penalizedPathways||(this.penalizedPathways[r]=performance.now()),!i&&e&&(i=this.pathways()),i&&i.length>1&&(this.updatePathwayPriority(i),n.resolved=this.pathwayId!==r),t.details!==o.BUFFER_APPEND_ERROR||t.fatal?n.resolved||this.warn(`Could not resolve ${t.details} ("${t.error.message}") with content-steering for Pathway: ${r} levels: ${e?e.length:e} priorities: ${it(i)} penalized: ${it(this.penalizedPathways)}`):n.resolved=!0}}filterParsedLevels(e){this.levels=e;let t=this.getLevelsForPathway(this.pathwayId);if(0===t.length){const n=e[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${n}"`),t=this.getLevelsForPathway(n),this.pathwayId=n}return t.length!==e.length&&this.log(`Found ${t.length}/${e.length} levels in Pathway "${this.pathwayId}"`),t}getLevelsForPathway(e){return null===this.levels?[]:this.levels.filter((t=>e===t.pathwayId))}updatePathwayPriority(e){let t;this._pathwayPriority=e;const n=this.penalizedPathways,i=performance.now();Object.keys(n).forEach((e=>{i-n[e]>3e5&&delete n[e]}));for(let i=0;i<e.length;i++){const r=e[i];if(r in n)continue;if(r===this.pathwayId)return;const s=this.hls.nextLoadLevel,a=this.hls.levels[s];if(t=this.getLevelsForPathway(r),t.length>0){this.log(`Setting Pathway to "${r}"`),this.pathwayId=r,hi(t),this.hls.trigger(l.LEVELS_UPDATED,{levels:t});const e=this.hls.levels[s];a&&e&&this.levels&&(e.attrs["STABLE-VARIANT-ID"]!==a.attrs["STABLE-VARIANT-ID"]&&e.bitrate!==a.bitrate&&this.log(`Unstable Pathways change from bitrate ${a.bitrate} to ${e.bitrate}`),this.hls.nextLoadLevel=s);break}}}getPathwayForGroupId(e,t,n){const i=this.getLevelsForPathway(n).concat(this.levels||[]);for(let n=0;n<i.length;n++)if(t===h&&i[n].hasAudioGroup(e)||t===d&&i[n].hasSubtitleGroup(e))return i[n].pathwayId;return n}clonePathways(e){const t=this.levels;if(!t)return;const n={},i={};e.forEach((e=>{const{ID:r,"BASE-ID":s,"URI-REPLACEMENT":a}=e;if(t.some((e=>e.pathwayId===r)))return;const o=this.getLevelsForPathway(s).map((e=>{const t=new hn(e.attrs);t["PATHWAY-ID"]=r;const s=t.AUDIO&&`${t.AUDIO}_clone_${r}`,o=t.SUBTITLES&&`${t.SUBTITLES}_clone_${r}`;s&&(n[t.AUDIO]=s,t.AUDIO=s),o&&(i[t.SUBTITLES]=o,t.SUBTITLES=o);const l=ma(e.uri,t["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",a),u=new et({attrs:t,audioCodec:e.audioCodec,bitrate:e.bitrate,height:e.height,name:e.name,url:l,videoCodec:e.videoCodec,width:e.width});if(e.audioGroups)for(let t=1;t<e.audioGroups.length;t++)u.addGroupId("audio",`${e.audioGroups[t]}_clone_${r}`);if(e.subtitleGroups)for(let t=1;t<e.subtitleGroups.length;t++)u.addGroupId("text",`${e.subtitleGroups[t]}_clone_${r}`);return u}));t.push(...o),ga(this.audioTracks,n,a,r),ga(this.subtitleTracks,i,a,r)}))}loadSteeringManifest(e){const t=this.hls.config,n=t.loader;let i;this.loader&&this.loader.destroy(),this.loader=new n(t);try{i=new self.URL(e)}catch(t){return this.enabled=!1,void this.log(`Failed to parse Steering Manifest URI: ${e}`)}if("data:"!==i.protocol){const e=0|(this.hls.bandwidthEstimate||t.abrEwmaDefaultEstimate);i.searchParams.set("_HLS_pathway",this.pathwayId),i.searchParams.set("_HLS_throughput",""+e)}const r={responseType:"json",url:i.href},s=t.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:(e,t,n,r)=>{this.log(`Loaded steering manifest: "${i}"`);const s=e.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(e){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 c={steeringManifest:s,url:i.toString()};this.hls.trigger(l.STEERING_MANIFEST_LOADED,c),u&&this.updatePathwayPriority(u)},onError:(e,t,n,i)=>{if(this.log(`Error loading steering manifest: ${e.code} ${e.text} (${t.url})`),this.stopLoad(),410===e.code)return this.enabled=!1,void this.log(`Steering manifest ${t.url} no longer available`);let r=1e3*this.timeToLoad;if(429!==e.code)this.scheduleRefresh(this.uri||t.url,r);else{const e=this.loader;if("function"==typeof(null==e?void 0:e.getResponseHeader)){const t=e.getResponseHeader("Retry-After");t&&(r=1e3*parseFloat(t))}this.log(`Steering manifest ${t.url} rate limited`)}},onTimeout:(e,t,n)=>{this.log(`Timeout loading steering manifest (${t.url})`),this.scheduleRefresh(this.uri||t.url)}};this.log(`Requesting steering manifest: ${i}`),this.loader.load(r,o,u)}scheduleRefresh(e,t=1e3*this.timeToLoad){this.clearTimeout(),this.reloadTimer=self.setTimeout((()=>{var t;const n=null==(t=this.hls)?void 0:t.media;!n||n.ended?this.scheduleRefresh(e,1e3*this.timeToLoad):this.loadSteeringManifest(e)}),t)}},interstitialsController:class extends w{constructor(e,t){super("interstitials",e.logger),this.HlsPlayerClass=void 0,this.hls=void 0,this.assetListLoader=void 0,this.mediaSelection=null,this.altSelection=null,this.media=null,this.detachedData=null,this.requiredTracks=null,this.manager=null,this.playerQueue=[],this.bufferedPos=-1,this.timelinePos=-1,this.schedule=void 0,this.playingItem=null,this.bufferingItem=null,this.waitingItem=null,this.endedItem=null,this.playingAsset=null,this.endedAsset=null,this.bufferingAsset=null,this.shouldPlay=!1,this.onPlay=()=>{this.shouldPlay=!0},this.onPause=()=>{this.shouldPlay=!1},this.onSeeking=()=>{const e=this.currentTime;if(void 0===e||this.playbackDisabled||!this.schedule)return;const t=e-this.timelinePos;if(Math.abs(t)<1/7056e5)return;const n=t<=-.01;this.timelinePos=e,this.bufferedPos=e;const i=this.playingItem;if(!i)return void this.checkBuffer();if(n){this.schedule.resetErrorsInRange(e,e-t)&&this.updateSchedule(!0)}if(this.checkBuffer(),n&&e<i.start||e>=i.end){var r;const t=this.findItemIndex(i);let s=this.schedule.findItemIndexAtTime(e);if(-1===s&&(s=t+(n?-1:1),this.log(`seeked ${n?"back ":""}to position not covered by schedule ${e} (resolving from ${t} to ${s})`)),!this.isInterstitial(i)&&null!=(r=this.media)&&r.paused&&(this.shouldPlay=!1),!n&&s>t){const e=this.schedule.findJumpRestrictedIndex(t+1,s);if(e>t)return void this.setSchedulePosition(e)}return void this.setSchedulePosition(s)}const s=this.playingAsset;if(!s){if(this.playingLastItem&&this.isInterstitial(i)){const t=i.event.assetList[0];t&&(this.endedItem=this.playingItem,this.playingItem=null,this.setScheduleToAssetAtTime(e,t))}return}const a=s.timelineStart,o=s.duration||0;var l;(n&&e<a||e>=a+o)&&(null!=(l=i.event)&&l.appendInPlace&&(this.clearInterstitial(i.event,i),this.flushFrontBuffer(e)),this.setScheduleToAssetAtTime(e,s))},this.onTimeupdate=()=>{const e=this.currentTime;if(void 0===e||this.playbackDisabled)return;if(!(e>this.timelinePos))return;this.timelinePos=e,e>this.bufferedPos&&this.checkBuffer();const t=this.playingItem;if(!t||this.playingLastItem)return;if(e>=t.end){this.timelinePos=t.end;const e=this.findItemIndex(t);this.setSchedulePosition(e+1)}const n=this.playingAsset;if(!n)return;e>=n.timelineStart+(n.duration||0)&&this.setScheduleToAssetAtTime(e,n)},this.onScheduleUpdate=(e,t)=>{const n=this.schedule;if(!n)return;const i=this.playingItem,r=n.events||[],s=n.items||[],a=n.durations,o=e.map((e=>e.identifier)),u=!(!r.length&&!o.length);(u||t)&&this.log(`INTERSTITIALS_UPDATED (${r.length}): ${r}\nSchedule: ${s.map((e=>Ua(e)))} pos: ${this.timelinePos}`),o.length&&this.log(`Removed events ${o}`);let c=null,h=null;i&&(c=this.updateItem(i,this.timelinePos),this.itemsMatch(i,c)?this.playingItem=c:this.waitingItem=this.endedItem=null),this.waitingItem=this.updateItem(this.waitingItem),this.endedItem=this.updateItem(this.endedItem);const d=this.bufferingItem;if(d&&(h=this.updateItem(d,this.bufferedPos),this.itemsMatch(d,h)?this.bufferingItem=h:d.event&&(this.bufferingItem=this.playingItem,this.clearInterstitial(d.event,null))),e.forEach((e=>{e.assetList.forEach((e=>{this.clearAssetPlayer(e.identifier,null)}))})),this.playerQueue.forEach((e=>{if(e.interstitial.appendInPlace){const t=e.assetItem.timelineStart,n=e.timelineOffset-t;if(n)try{e.timelineOffset=t}catch(i){Math.abs(n)>La&&this.warn(`${i} ("${e.assetId}" ${e.timelineOffset}->${t})`)}}})),u||t){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(c,i),d&&h!==c&&this.trimInPlace(h,d),this.checkBuffer()}},this.hls=e,this.HlsPlayerClass=t,this.assetListLoader=new Ka(e),this.schedule=new Ba(this.onScheduleUpdate,e.logger),this.registerListeners()}registerListeners(){const e=this.hls;e&&(e.on(l.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(l.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(l.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(l.MANIFEST_LOADING,this.onManifestLoading,this),e.on(l.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(l.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(l.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.on(l.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(l.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.on(l.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.on(l.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.on(l.BUFFER_APPENDED,this.onBufferAppended,this),e.on(l.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(l.BUFFERED_TO_END,this.onBufferedToEnd,this),e.on(l.MEDIA_ENDED,this.onMediaEnded,this),e.on(l.ERROR,this.onError,this),e.on(l.DESTROYING,this.onDestroying,this))}unregisterListeners(){const e=this.hls;e&&(e.off(l.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(l.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(l.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(l.MANIFEST_LOADING,this.onManifestLoading,this),e.off(l.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(l.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(l.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.off(l.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(l.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.off(l.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.off(l.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.off(l.BUFFER_CODECS,this.onBufferCodecs,this),e.off(l.BUFFER_APPENDED,this.onBufferAppended,this),e.off(l.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(l.BUFFERED_TO_END,this.onBufferedToEnd,this),e.off(l.MEDIA_ENDED,this.onMediaEnded,this),e.off(l.ERROR,this.onError,this),e.off(l.DESTROYING,this.onDestroying,this))}startLoad(){this.resumeBuffering()}stopLoad(){this.pauseBuffering()}resumeBuffering(){var e;null==(e=this.getBufferingPlayer())||e.resumeBuffering()}pauseBuffering(){var e;null==(e=this.getBufferingPlayer())||e.pauseBuffering()}destroy(){this.unregisterListeners(),this.stopLoad(),this.assetListLoader&&this.assetListLoader.destroy(),this.emptyPlayerQueue(),this.clearScheduleState(),this.schedule&&this.schedule.destroy(),this.media=this.detachedData=this.mediaSelection=this.requiredTracks=this.altSelection=this.schedule=this.manager=null,this.hls=this.HlsPlayerClass=this.log=null,this.assetListLoader=null,this.onPlay=this.onPause=this.onSeeking=this.onTimeupdate=null,this.onScheduleUpdate=null}onDestroying(){const e=this.primaryMedia||this.media;e&&this.removeMediaListeners(e)}removeMediaListeners(e){bi(e,"play",this.onPlay),bi(e,"pause",this.onPause),bi(e,"seeking",this.onSeeking),bi(e,"timeupdate",this.onTimeupdate)}onMediaAttaching(e,t){const n=this.media=t.media;yi(n,"seeking",this.onSeeking),yi(n,"timeupdate",this.onTimeupdate),yi(n,"play",this.onPlay),yi(n,"pause",this.onPause)}onMediaAttached(e,t){const n=this.effectivePlayingItem,i=this.detachedData;if(this.detachedData=null,null===n)this.checkStart();else if(!i){this.clearScheduleState();const e=this.findItemIndex(n);this.setSchedulePosition(e)}}clearScheduleState(){this.log("clear schedule state"),this.playingItem=this.bufferingItem=this.waitingItem=this.endedItem=this.playingAsset=this.endedAsset=this.bufferingAsset=null}onMediaDetaching(e,t){const n=!!t.transferMedia,i=this.media;if(this.media=null,!n&&(i&&this.removeMediaListeners(i),this.detachedData)){const e=this.getBufferingPlayer();e&&(this.log(`Removing schedule state for detachedData and ${e}`),this.playingAsset=this.endedAsset=this.bufferingAsset=this.bufferingItem=this.waitingItem=this.detachedData=null,e.detachMedia()),this.shouldPlay=!1}}get interstitialsManager(){if(!this.hls)return null;if(this.manager)return this.manager;const e=this,t=()=>e.bufferingItem||e.waitingItem,n=t=>t?e.getAssetPlayer(t.identifier):t,i=(t,i,s,a,o)=>{if(t){let l=t[i].start;const u=t.event;if(u){if("playout"===i||u.timelineOccupancy!==xa.Point){const e=n(s);(null==e?void 0:e.interstitial)===u&&(l+=e.assetItem.startOffset+e[o])}}else{l+=("bufferedPos"===a?r():e[a])-t.start}return l}return 0},r=()=>{const t=e.bufferedPos;return t===Number.MAX_VALUE?s("primary"):Math.max(t,0)},s=t=>{var n,i;return null!=(n=e.primaryDetails)&&n.live?e.primaryDetails.edge:(null==(i=e.schedule)?void 0:i.durations[t])||0},a=(t,r)=>{var s,a;const o=e.effectivePlayingItem;if(null!=o&&null!=(s=o.event)&&s.restrictions.skip||!e.schedule)return;e.log(`seek to ${t} "${r}"`);const l=e.effectivePlayingItem,u=e.schedule.findItemIndexAtTime(t,r),c=null==(a=e.schedule.items)?void 0:a[u],h=e.getBufferingPlayer(),d=null==h?void 0:h.interstitial,f=null==d?void 0:d.appendInPlace,p=l&&e.itemsMatch(l,c);if(l&&(f||p)){const s=n(e.playingAsset),a=(null==s?void 0:s.media)||e.primaryMedia;if(a){const n="primary"===r?a.currentTime:i(l,r,e.playingAsset,"timelinePos","currentTime"),o=t-n,u=(f?n:a.currentTime)+o;if(u>=0&&(!s||f||u<=s.duration))return void(a.currentTime=u)}}if(c){let n=t;if("primary"!==r){const e=t-c[r].start;n=c.start+e}const i=!e.isInterstitial(c);if(e.isInterstitial(l)&&!l.event.appendInPlace||!i&&!c.event.appendInPlace){if(l){const s=e.findItemIndex(l);if(u>s){const t=e.schedule.findJumpRestrictedIndex(s+1,u);if(t>s)return void e.setSchedulePosition(t)}let a=0;if(i)e.timelinePos=n,e.checkBuffer();else{const e=c.event.assetList,n=t-(c[r]||c).start;for(let t=e.length;t--;){const i=e[t];if(i.duration&&n>=i.startOffset&&n<i.startOffset+i.duration){a=t;break}}}e.setSchedulePosition(u,a)}}else{const t=e.media||(f?null==h?void 0:h.media:null);t&&(t.currentTime=n)}}},o=()=>{const n=e.effectivePlayingItem;if(e.isInterstitial(n))return n;const i=t();return e.isInterstitial(i)?i:null},l={get bufferedEnd(){const n=t(),r=e.bufferingItem;var s;return r&&r===n&&(i(r,"playout",e.bufferingAsset,"bufferedPos","bufferedEnd")-r.playout.start||(null==(s=e.bufferingAsset)?void 0:s.startOffset))||0},get currentTime(){const t=o(),n=e.effectivePlayingItem;return n&&n===t?i(n,"playout",e.effectivePlayingAsset,"timelinePos","currentTime")-n.playout.start:0},set currentTime(t){const n=o(),i=e.effectivePlayingItem;i&&i===n&&a(t+i.playout.start,"playout")},get duration(){const e=o();return e?e.playout.end-e.playout.start:0},get assetPlayers(){var t;const n=null==(t=o())?void 0:t.event.assetList;return n?n.map((t=>e.getAssetPlayer(t.identifier))):[]},get playingIndex(){var t;const n=null==(t=o())?void 0:t.event;return n&&e.effectivePlayingAsset?n.findAssetIndex(e.effectivePlayingAsset):-1},get scheduleItem(){return o()}};return this.manager={get events(){var t;return(null==(t=e.schedule)||null==(t=t.events)?void 0:t.slice(0))||[]},get schedule(){var t;return(null==(t=e.schedule)||null==(t=t.items)?void 0:t.slice(0))||[]},get interstitialPlayer(){return o()?l:null},get playerQueue(){return e.playerQueue.slice(0)},get bufferingAsset(){return e.bufferingAsset},get bufferingItem(){return t()},get bufferingIndex(){const n=t();return e.findItemIndex(n)},get playingAsset(){return e.effectivePlayingAsset},get playingItem(){return e.effectivePlayingItem},get playingIndex(){const t=e.effectivePlayingItem;return e.findItemIndex(t)},primary:{get bufferedEnd(){return r()},get currentTime(){const t=e.timelinePos;return t>0?t:0},set currentTime(e){a(e,"primary")},get duration(){return s("primary")},get seekableStart(){var t;return(null==(t=e.primaryDetails)?void 0:t.fragmentStart)||0}},integrated:{get bufferedEnd(){return i(t(),"integrated",e.bufferingAsset,"bufferedPos","bufferedEnd")},get currentTime(){return i(e.effectivePlayingItem,"integrated",e.effectivePlayingAsset,"timelinePos","currentTime")},set currentTime(e){a(e,"integrated")},get duration(){return s("integrated")},get seekableStart(){var t;return((t,n)=>{var i;if(0!==t&&"primary"!==n&&null!=(i=e.schedule)&&i.length){var r;const i=e.schedule.findItemIndexAtTime(t),s=null==(r=e.schedule.items)?void 0:r[i];if(s)return t+(s[n].start-s.start)}return t})((null==(t=e.primaryDetails)?void 0:t.fragmentStart)||0,"integrated")}},skip:()=>{const t=e.effectivePlayingItem,n=null==t?void 0:t.event;if(n&&!n.restrictions.skip){const i=e.findItemIndex(t);if(n.appendInPlace){const e=t.playout.start+t.event.duration;a(e+.001,"playout")}else e.advanceAfterAssetEnded(n,i,1/0)}}}}get effectivePlayingItem(){return this.waitingItem||this.playingItem||this.endedItem}get effectivePlayingAsset(){return this.playingAsset||this.endedAsset}get playingLastItem(){var e;const t=this.playingItem,n=null==(e=this.schedule)?void 0:e.items;return!!(this.playbackStarted&&t&&n)&&this.findItemIndex(t)===n.length-1}get playbackStarted(){return null!==this.effectivePlayingItem}get currentTime(){var e,t;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!=(e=this.bufferingItem)&&null!=(e=e.event)&&e.appendInPlace&&(r=this.primaryMedia);const s=null==(t=r)?void 0:t.currentTime;return void 0!==s&&i(s)?s:void 0}get primaryMedia(){var e;return this.media||(null==(e=this.detachedData)?void 0:e.media)||null}isInterstitial(e){return!(null==e||!e.event)}retreiveMediaSource(e,t){const n=this.getAssetPlayer(e);n&&this.transferMediaFromPlayer(n,t)}transferMediaFromPlayer(e,t){const n=e.interstitial.appendInPlace,i=e.media;if(n&&i===this.primaryMedia){if(this.bufferingAsset=null,(!t||this.isInterstitial(t)&&!t.event.appendInPlace)&&t&&i)return void(this.detachedData={media:i});const n=e.transferMedia();this.log(`transfer MediaSource from ${e} ${it(n)}`),this.detachedData=n}else t&&i&&(this.shouldPlay||(this.shouldPlay=!i.paused))}transferMediaTo(e,t){var n,i;if(e.media===t)return;let r=null;const s=this.hls,a=e!==s,o=a&&e.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 e=this.getBufferingPlayer();e?(r=e.transferMedia(),u=`${e}`):u="detached MediaSource"}else u="detached media";if(!r)if(l)r=this.detachedData,this.log(`using detachedData: MediaSource ${it(r)}`);else if(!this.detachedData||s.media===t){const e=this.playerQueue;e.length>1&&e.forEach((e=>{if(a&&e.interstitial.appendInPlace!==o){const t=e.interstitial;this.clearInterstitial(e.interstitial,null),t.appendInPlace=!1,t.appendInPlace&&this.warn(`Could not change append strategy for queued assets ${t}`)}})),this.hls.detachMedia(),this.detachedData={media:t}}const c=r&&"mediaSource"in r&&"closed"!==(null==(i=r.mediaSource)?void 0:i.readyState),h=c&&r?r:t;this.log(`${c?"transfering MediaSource":"attaching media"} to ${a?e:"Primary"} from ${u} (media.currentTime: ${t.currentTime})`);const d=this.schedule;if(h===r&&d){const t=a&&e.assetId===d.assetIdAtEnd;h.overrides={duration:d.duration,endOfStream:!a||t,cueRemoval:!a}}e.attachMedia(h)}onInterstitialCueEnter(){this.onTimeupdate()}checkStart(){const e=this.schedule,t=null==e?void 0:e.events;if(!t||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(Ga("checkStart",n)),this.timelinePos=n,t.length&&t[0].cue.pre){const n=e.findEventIndex(t[0].identifier);this.setSchedulePosition(n)}else if(n>=0||!this.primaryLive){const t=this.timelinePos=n>0?n:0,i=e.findItemIndexAtTime(t);this.setSchedulePosition(i)}}else if(i&&!this.playingItem){const t=e.findItemIndex(i);this.setSchedulePosition(t)}}advanceAssetBuffering(e,t){const n=e.event,i=n.findAssetIndex(t),r=Ma(n,i);if(n.isAssetPastPlayoutLimit(r)){if(this.schedule){var s;const t=null==(s=this.schedule.items)?void 0:s[this.findItemIndex(e)+1];t&&this.bufferedToItem(t)}}else this.bufferedToEvent(e,r)}advanceAfterAssetEnded(e,t,n){const i=Ma(e,n);if(e.isAssetPastPlayoutLimit(i)){if(this.schedule){const n=this.schedule.items;if(n){const i=t+1;if(i>=n.length)return void this.setSchedulePosition(-1);const r=e.resumeTime;this.timelinePos<r&&(this.log(Ga("advanceAfterAssetEnded",r)),this.timelinePos=r,e.appendInPlace&&this.advanceInPlace(r),this.checkBuffer(this.bufferedPos<r)),this.setSchedulePosition(i)}}}else{if(e.appendInPlace){const t=e.assetList[i];t&&this.advanceInPlace(t.timelineStart)}this.setSchedulePosition(t,i)}}setScheduleToAssetAtTime(e,t){const n=this.schedule;if(!n)return;const i=t.parentIdentifier,r=n.getEvent(i);if(r){const t=n.findEventIndex(i),s=n.findAssetIndex(r,e);this.advanceAfterAssetEnded(r,t,s-1)}}setSchedulePosition(e,t){var n;const i=null==(n=this.schedule)?void 0:n.items;if(!i||this.playbackDisabled)return;const r=e>=0?i[e]:null;this.log(`setSchedulePosition ${e}, ${t} (${r?Ua(r):r}) pos: ${this.timelinePos}`);const s=this.waitingItem||this.playingItem,a=this.playingLastItem;if(this.isInterstitial(s)){const n=s.event,c=this.playingAsset,h=null==c?void 0:c.identifier,d=h?this.getAssetPlayer(h):null;if(d&&h&&(!this.eventItemsMatch(s,r)||void 0!==t&&h!==n.assetList[t].identifier)){var o;const t=n.findAssetIndex(c);if(this.log(`INTERSTITIAL_ASSET_ENDED ${t+1}/${n.assetList.length} ${Na(c)}`),this.endedAsset=c,this.playingAsset=null,this.hls.trigger(l.INTERSTITIAL_ASSET_ENDED,{asset:c,assetListIndex:t,event:n,schedule:i.slice(0),scheduleIndex:e,player:d}),s!==this.playingItem)return void(this.itemsMatch(s,this.playingItem)&&!this.playingAsset&&this.advanceAfterAssetEnded(n,this.findItemIndex(this.playingItem),t));this.retreiveMediaSource(h,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} ${Ua(s)}`),n.hasPlayed=!0,this.hls.trigger(l.INTERSTITIAL_ENDED,{event:n,schedule:i.slice(0),scheduleIndex:e}),n.cue.once)){var u;this.updateSchedule();const e=null==(u=this.schedule)?void 0:u.items;if(r&&e){const n=this.findItemIndex(r);this.advanceSchedule(n,e,t,s,a)}return}}this.advanceSchedule(e,i,t,s,a)}advanceSchedule(e,t,n,i,r){const s=this.schedule;if(!s)return;const a=t[e]||null,o=this.primaryMedia,u=this.playerQueue;if(u.length&&u.forEach((t=>{const n=t.interstitial,i=s.findEventIndex(n.identifier);(i<e||i>e+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 t=Ma(r,(n=s.findAssetIndex(r,this.timelinePos))-1);if(r.isAssetPastPlayoutLimit(t)||r.appendInPlace&&this.timelinePos===a.end)return void this.advanceAfterAssetEnded(r,e,n);n=t}const u=this.waitingItem;this.assetsBuffered(a,o)||this.setBufferingItem(a);let c=this.preloadAssets(r,n);if(this.eventItemsMatch(a,u||i)||(this.waitingItem=a,this.log(`INTERSTITIAL_STARTED ${Ua(a)} ${r.appendInPlace?"append in place":""}`),this.hls.trigger(l.INTERSTITIAL_STARTED,{event:r,schedule:t.slice(0),scheduleIndex:e})),!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 h=r.assetList[n];if(!h)return void this.advanceAfterAssetEnded(r,e,n||0);if(c||(c=this.getAssetPlayer(h.identifier)),null===c||c.destroyed){const e=r.assetList.length;this.warn(`asset ${n+1}/${e} player destroyed ${r}`),c=this.createAssetPlayer(r,h,n),c.loadSource()}if(!this.eventItemsMatch(a,this.bufferingItem)&&r.appendInPlace&&this.isAssetBuffered(h))return;this.startAssetPlayer(c,n,t,e,o),this.shouldPlay&&$a(c.media)}else a?(this.resumePrimary(a,e,i),this.shouldPlay&&$a(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 e;return null==(e=this.mediaSelection)?void 0:e.main.details}get primaryLive(){var e;return!(null==(e=this.primaryDetails)||!e.live)}resumePrimary(e,t,n){var i,r;if(this.playingItem=e,this.playingAsset=this.endedAsset=null,this.waitingItem=this.endedItem=null,this.bufferedToItem(e),this.log(`resuming ${Ua(e)}`),null==(i=this.detachedData)||!i.mediaSource){let n=this.timelinePos;(n<e.start||n>=e.end)&&(n=this.getPrimaryResumption(e,t),this.log(Ga("resumePrimary",n)),this.timelinePos=n),this.attachPrimary(n,e)}if(!n)return;const s=null==(r=this.schedule)?void 0:r.items;s&&(this.log(`INTERSTITIALS_PRIMARY_RESUMED ${Ua(e)}`),this.hls.trigger(l.INTERSTITIALS_PRIMARY_RESUMED,{schedule:s.slice(0),scheduleIndex:t}),this.checkBuffer())}getPrimaryResumption(e,t){const n=e.start;if(this.primaryLive){const e=this.primaryDetails;if(0===t)return this.hls.startPosition;if(e&&(n<e.fragmentStart||n>e.edge))return this.hls.liveSyncPosition||-1}return n}isAssetBuffered(e){const t=this.getAssetPlayer(e.identifier);if(null!=t&&t.hls)return t.hls.bufferedToEnd;return nn.bufferInfo(this.primaryMedia,this.timelinePos,0).end+1>=e.timelineStart+(e.duration||0)}attachPrimary(e,t,n){t?this.setBufferingItem(t):this.bufferingItem=this.playingItem,this.bufferingAsset=null;const i=this.primaryMedia;if(!i)return;const r=this.hls;r.media?this.checkBuffer():(this.transferMediaTo(r,i),n&&this.startLoadingPrimaryAt(e,n)),n||(this.log(Ga("attachPrimary",e)),this.timelinePos=e,this.startLoadingPrimaryAt(e,n))}startLoadingPrimaryAt(e,t){var n;const i=this.hls;!i.loadingEnabled||!i.media||Math.abs(((null==(n=i.mainForwardBufferInfo)?void 0:n.start)||i.media.currentTime)-e)>.5?i.startLoad(e,t):i.bufferingEnabled||i.resumeBuffering()}onManifestLoading(){var e;this.stopLoad(),null==(e=this.schedule)||e.reset(),this.emptyPlayerQueue(),this.clearScheduleState(),this.shouldPlay=!1,this.bufferedPos=this.timelinePos=-1,this.mediaSelection=this.altSelection=this.manager=this.requiredTracks=null,this.hls.off(l.BUFFER_CODECS,this.onBufferCodecs,this),this.hls.on(l.BUFFER_CODECS,this.onBufferCodecs,this)}onLevelUpdated(e,t){if(-1===t.level||!this.schedule)return;const n=this.hls.levels[t.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(e,t){const n=this.hls.audioTracks[t.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(e,t){const n=this.hls.subtitleTracks[t.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(e,t){const n=at(t);this.playerQueue.forEach((({hls:e})=>e&&(e.setAudioOption(t)||e.setAudioOption(n))))}onSubtitleTrackSwitch(e,t){const n=at(t);this.playerQueue.forEach((({hls:e})=>e&&(e.setSubtitleOption(t)||-1!==t.id&&e.setSubtitleOption(n))))}onBufferCodecs(e,t){const n=t.tracks;n&&(this.requiredTracks=n)}onBufferAppended(e,t){this.checkBuffer()}onBufferFlushed(e,t){const n=this.playingItem;if(n&&!this.itemsMatch(n,this.bufferingItem)&&!this.isInterstitial(n)){const e=this.timelinePos;this.bufferedPos=e,this.checkBuffer()}}onBufferedToEnd(e){if(!this.schedule)return;const t=this.schedule.events;if(this.bufferedPos<Number.MAX_VALUE&&t){for(let e=0;e<t.length;e++){const i=t[e];if(i.cue.post){var n;const e=this.schedule.findEventIndex(i.identifier),t=null==(n=this.schedule.items)?void 0:n[e];this.isInterstitial(t)&&this.eventItemsMatch(t,this.bufferingItem)&&this.bufferedToItem(t,0);break}}this.bufferedPos=Number.MAX_VALUE}}onMediaEnded(e){const t=this.playingItem;if(!this.playingLastItem&&t){const e=this.findItemIndex(t);this.setSchedulePosition(e+1)}else this.shouldPlay=!1}updateItem(e,t){var n;const i=null==(n=this.schedule)?void 0:n.items;if(e&&i){return i[this.findItemIndex(e,t)]||null}return null}trimInPlace(e,t){if(this.isInterstitial(e)&&e.event.appendInPlace&&t.end-e.end>.25){e.event.assetList.forEach(((t,n)=>{e.event.isAssetPastPlayoutLimit(n)&&this.clearAssetPlayer(t.identifier,null)}));const n=e.end+.25,i=nn.bufferInfo(this.primaryMedia,n,0);if(i.end>n||(i.nextStart||0)>n){this.log(`trim buffered interstitial ${Ua(e)} (was ${Ua(t)})`);const i=!0;this.attachPrimary(n,null,i),this.flushFrontBuffer(n)}}}itemsMatch(e,t){return!!t&&(e===t||e.event&&t.event&&this.eventItemsMatch(e,t)||!e.event&&!t.event&&this.findItemIndex(e)===this.findItemIndex(t))}eventItemsMatch(e,t){var n;return!!t&&(e===t||e.event.identifier===(null==(n=t.event)?void 0:n.identifier))}findItemIndex(e,t){return e&&this.schedule?this.schedule.findItemIndex(e,t):-1}updateSchedule(e=!1){var t;const n=this.mediaSelection;n&&(null==(t=this.schedule)||t.updateSchedule(n,[],e))}checkBuffer(e){var t;const n=null==(t=this.schedule)?void 0:t.items;if(!n)return;const i=nn.bufferInfo(this.primaryMedia,this.timelinePos,0);e&&(this.bufferedPos=this.timelinePos),e||(e=i.len<1),this.updateBufferedPos(i.end,n,e)}updateBufferedPos(e,t,n){const i=this.schedule,r=this.bufferingItem;if(this.bufferedPos>e||!i)return;if(1===t.length&&this.itemsMatch(t[0],r))return void(this.bufferedPos=e);const s=this.playingItem,a=this.findItemIndex(s);let o=i.findItemIndexAtTime(e);if(this.bufferedPos<e){var l;const n=this.findItemIndex(r),i=Math.min(n+1,t.length-1),s=t[i];if((-1===o&&r&&e>=r.end||null!=(l=s.event)&&l.appendInPlace&&e+.01>=s.start)&&(o=i),this.isInterstitial(r)){const e=r.event;if(i-a>1&&!1===e.appendInPlace)return;if(0===e.assetList.length&&e.assetListLoader)return}if(this.bufferedPos=e,o>n&&o>a)this.bufferedToItem(s);else{const t=this.primaryDetails;this.primaryLive&&t&&e>t.edge-t.targetduration&&s.start<t.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(t[o]))}assetsBuffered(e,t){return 0!==e.event.assetList.length&&!e.event.assetList.some((e=>{const n=this.getAssetPlayer(e.identifier);return!(null!=n&&n.bufferedInPlaceToEnd(t))}))}setBufferingItem(e){const t=this.bufferingItem,n=this.schedule;if(!this.itemsMatch(e,t)&&n){const{items:i,events:r}=n;if(!i||!r)return t;const s=this.isInterstitial(e),a=this.getBufferingPlayer();this.bufferingItem=e,this.bufferedPos=Math.max(e.start,Math.min(e.end,this.timelinePos));const o=a?a.remaining:t?t.end-this.timelinePos:0;if(this.log(`INTERSTITIALS_BUFFERED_TO_BOUNDARY ${Ua(e)}`+(t?` (${o.toFixed(2)} remaining)`:"")),!this.playbackDisabled)if(s){const t=n.findAssetIndex(e.event,this.bufferedPos);e.event.assetList.forEach(((e,n)=>{const i=this.getAssetPlayer(e.identifier);i&&(n===t&&i.loadSource(),i.resumeBuffering())}))}else this.hls.resumeBuffering(),this.playerQueue.forEach((e=>e.pauseBuffering()));this.hls.trigger(l.INTERSTITIALS_BUFFERED_TO_BOUNDARY,{events:r.slice(0),schedule:i.slice(0),bufferingIndex:this.findItemIndex(e),playingIndex:this.findItemIndex(this.playingItem)})}else this.bufferingItem!==e&&(this.bufferingItem=e);return t}bufferedToItem(e,t=0){const n=this.setBufferingItem(e);if(!this.playbackDisabled)if(this.isInterstitial(e))this.bufferedToEvent(e,t);else if(null!==n){this.bufferingAsset=null;const t=this.detachedData;if(t)if(t.mediaSource){const t=!0;this.attachPrimary(e.start,e,t)}else this.preloadPrimary(e);else this.preloadPrimary(e)}}preloadPrimary(e){const t=this.findItemIndex(e),n=this.getPrimaryResumption(e,t);this.startLoadingPrimaryAt(n)}bufferedToEvent(e,t){const n=e.event,i=0===n.assetList.length&&!n.assetListLoader,r=n.cue.once;if(i||!r){const e=this.preloadAssets(n,t);if(null!=e&&e.interstitial.appendInPlace){const t=this.primaryMedia;t&&this.bufferAssetPlayer(e,t)}}}preloadAssets(e,t){const n=e.assetUrl,i=e.assetList.length,r=0===i&&!e.assetListLoader,s=e.cue.once;if(r){const r=e.timelineStart;if(e.appendInPlace){var a;const t=this.playingItem;this.isInterstitial(t)||(null==t||null==(a=t.nextEvent)?void 0:a.identifier)!==e.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&&!e.cue.pre&&!e.cue.post){const e=o-r;e>0&&(s=Math.round(1e3*e)/1e3)}if(this.log(`Load interstitial asset ${t+1}/${n?1:i} ${e}${s?` live-start: ${o} start-offset: ${s}`:""}`),n)return this.createAsset(e,0,0,r,e.duration,n);const l=this.assetListLoader.loadAssetList(e,s);l&&(e.assetListLoader=l)}else if(!s&&i){for(let n=t;n<i;n++){const t=e.assetList[n],i=this.getAssetPlayerQueueIndex(t.identifier);-1!==i&&!this.playerQueue[i].destroyed||t.error||this.createAssetPlayer(e,t,n)}const n=e.assetList[t];if(n){const e=this.getAssetPlayer(n.identifier);return e&&e.loadSource(),e}}return null}flushFrontBuffer(e){const t=this.requiredTracks;if(!t)return;this.log(`Removing front buffer starting at ${e}`);Object.keys(t).forEach((t=>{this.hls.trigger(l.BUFFER_FLUSHING,{startOffset:e,endOffset:1/0,type:t})}))}getAssetPlayerQueueIndex(e){const t=this.playerQueue;for(let n=0;n<t.length;n++)if(e===t[n].assetId)return n;return-1}getAssetPlayer(e){const t=this.getAssetPlayerQueueIndex(e);return this.playerQueue[t]||null}getBufferingPlayer(){const{playerQueue:e,primaryMedia:t}=this;if(t)for(let n=0;n<e.length;n++)if(e[n].media===t)return e[n];return null}createAsset(e,t,n,i,r,s){const a={parentIdentifier:e.identifier,identifier:Ia(e,s,t),duration:r,startOffset:n,timelineStart:i,uri:s};return this.createAssetPlayer(e,a,t)}createAssetPlayer(e,t,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 c=i.audioTracks[i.audioTrack],h=i.subtitleTracks[i.subtitleTrack];let d=0;if(this.primaryLive||e.appendInPlace){const e=this.timelinePos-t.timelineStart;if(e>1){const n=t.duration;n&&e<n&&(d=e)}}const f=t.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:c||r.audioPreference,subtitlePreference:h||r.subtitlePreference});e.appendInPlace&&(e.appendInPlaceStarted=!0,t.timelineStart&&(p.timelineOffset=t.timelineStart));const _=p.cmcd;null!=_&&_.sessionId&&_.contentId&&(p.cmcd=y({},_,{contentId:Ra(t.uri)})),this.getAssetPlayer(f)&&this.warn(`Duplicate date range identifier ${e} and asset ${f}`);const g=new Fa(this.HlsPlayerClass,p,e,t);this.playerQueue.push(g),e.assetList[n]=t;let m=!0;const v=i=>{if(i.live){var r;const t=new Error(`Interstitials MUST be VOD assets ${e}`),i={fatal:!0,type:a.OTHER_ERROR,details:o.INTERSTITIAL_ASSET_ITEM_ERROR,error:t},s=(null==(r=this.schedule)?void 0:r.findEventIndex(e.identifier))||-1;return void this.handleAssetItemError(i,e,s,n,t.message)}const s=i.edge-i.fragmentStart,l=t.duration;(m||null===l||s>l)&&(m=!1,this.log(`Interstitial asset "${f}" duration change ${l} > ${s}`),t.duration=s,this.updateSchedule())};g.on(l.LEVEL_UPDATED,((e,{details:t})=>v(t))),g.on(l.LEVEL_PTS_UPDATED,((e,{details:t})=>v(t))),g.on(l.EVENT_CUE_ENTER,(()=>this.onInterstitialCueEnter()));const b=(e,t)=>{const n=this.getAssetPlayer(f);if(n&&t.tracks){n.off(l.BUFFER_CODECS,b),n.tracks=t.tracks;const e=this.primaryMedia;this.bufferingAsset===n.assetItem&&e&&!n.media&&this.bufferAssetPlayer(n,e)}};g.on(l.BUFFER_CODECS,b);g.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(e.identifier),s=null==(n=this.schedule.items)?void 0:n[r];this.isInterstitial(s)&&this.advanceAssetBuffering(s,t)}));const w=t=>()=>{if(!this.getAssetPlayer(f)||!this.schedule)return;this.shouldPlay=!0;const n=this.schedule.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,n,t)};return g.once(l.MEDIA_ENDED,w(n)),g.once(l.PLAYOUT_LIMIT_REACHED,w(1/0)),g.on(l.ERROR,((t,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(e):(this.onTimeupdate(),void this.checkBuffer(!0));this.handleAssetItemError(i,e,this.schedule.findEventIndex(e.identifier),n,`Asset player error ${i.error} ${e}`)})),g.on(l.DESTROYING,(()=>{if(!this.getAssetPlayer(f)||!this.schedule)return;const t=new Error(`Asset player destroyed unexpectedly ${f}`),i={fatal:!0,type:a.OTHER_ERROR,details:o.INTERSTITIAL_ASSET_ITEM_ERROR,error:t};this.handleAssetItemError(i,e,this.schedule.findEventIndex(e.identifier),n,t.message)})),this.log(`INTERSTITIAL_ASSET_PLAYER_CREATED ${Na(t)}`),this.hls.trigger(l.INTERSTITIAL_ASSET_PLAYER_CREATED,{asset:t,assetListIndex:n,event:e,player:g}),g}clearInterstitial(e,t){e.assetList.forEach((e=>{this.clearAssetPlayer(e.identifier,t)})),e.reset()}resetAssetPlayer(e){const t=this.getAssetPlayerQueueIndex(e);if(-1!==t){this.log(`reset asset player "${e}" after error`);const n=this.playerQueue[t];this.transferMediaFromPlayer(n,null),n.resetDetails()}}clearAssetPlayer(e,t){const n=this.getAssetPlayerQueueIndex(e);if(-1!==n){const e=this.playerQueue[n];this.log(`clear ${e} toSegment: ${t?Ua(t):t}`),this.transferMediaFromPlayer(e,t),this.playerQueue.splice(n,1),e.destroy()}}emptyPlayerQueue(){let e;for(;e=this.playerQueue.pop();)e.destroy();this.playerQueue=[]}startAssetPlayer(e,t,n,i,r){const{interstitial:s,assetItem:a,assetId:o}=e,u=s.assetList.length,c=this.playingAsset;this.endedAsset=null,this.playingAsset=a,c&&c.identifier===o||(c&&(this.clearAssetPlayer(c.identifier,n[i]),delete c.error),this.log(`INTERSTITIAL_ASSET_STARTED ${t+1}/${u} ${Na(a)}`),this.hls.trigger(l.INTERSTITIAL_ASSET_STARTED,{asset:a,assetListIndex:t,event:s,schedule:n.slice(0),scheduleIndex:i,player:e})),this.bufferAssetPlayer(e,r)}bufferAssetPlayer(e,t){var n,i;if(!this.schedule)return;const{interstitial:r,assetItem:s}=e,l=this.schedule.findEventIndex(r.identifier),u=null==(n=this.schedule.items)?void 0:n[l];if(!u)return;e.loadSource(),this.setBufferingItem(u),this.bufferingAsset=s;const c=this.getBufferingPlayer();if(c===e)return;const h=r.appendInPlace;if(h&&!1===(null==c?void 0:c.interstitial.appendInPlace))return;const d=(null==c?void 0:c.tracks)||(null==(i=this.detachedData)?void 0:i.tracks)||this.requiredTracks;if(h&&s!==this.playingAsset){if(!e.tracks)return void this.log(`Waiting for track info before buffering ${e}`);if(d&&!x(d,e.tracks)){const t=new Error(`Asset ${Na(s)} SourceBuffer tracks ('${Object.keys(e.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:t},i=r.findAssetIndex(s);return void this.handleAssetItemError(n,r,l,i,t.message)}}this.transferMediaTo(e,t)}handleInPlaceStall(e){const t=this.schedule,n=this.primaryMedia;if(!t||!n)return;const i=n.currentTime,r=t.findAssetIndex(e,i),s=e.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} ${e} (media.currentTime: ${i})`),o&&(l/n.playbackRate<.5||a.bufferedInPlaceToEnd(n))&&a.hls){const n=t.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,n,r)}}}}advanceInPlace(e){const t=this.primaryMedia;t&&t.currentTime<e&&(t.currentTime=e)}handleAssetItemError(e,t,n,i,r){if(e.details===o.BUFFER_STALLED_ERROR)return;const s=t.assetList[i]||null;if(this.warn(`INTERSTITIAL_ASSET_ERROR ${s?Na(s):s} ${e.error}`),!this.schedule)return;const a=(null==s?void 0:s.identifier)||"",u=this.getAssetPlayerQueueIndex(a),c=this.playerQueue[u]||null,h=this.schedule.items,d=y({},e,{fatal:!1,errorAction:Pt(!0),asset:s,assetListIndex:i,event:t,schedule:h,scheduleIndex:n,player:c});if(this.hls.trigger(l.INTERSTITIAL_ASSET_ERROR,d),!e.fatal)return;const f=this.playingAsset,p=this.bufferingAsset,_=new Error(r);if(s&&(this.clearAssetPlayer(a,null),s.error=_),t.assetList.some((e=>!e.error)))for(let e=i;e<t.assetList.length;e++)this.resetAssetPlayer(t.assetList[e].identifier);else t.error=_;this.updateSchedule(!0),t.error?this.primaryFallback(t):f&&f.identifier===a?this.advanceAfterAssetEnded(t,n,i):p&&p.identifier===a&&this.isInterstitial(this.bufferingItem)&&this.advanceAssetBuffering(this.bufferingItem,p)}primaryFallback(e){const t=e.timelineStart,n=this.effectivePlayingItem;if(n){this.log(`Fallback to primary from event "${e.identifier}" start: ${t} pos: ${this.timelinePos} playing: ${Ua(n)} error: ${e.error}`);let i=this.timelinePos;-1===i&&(i=this.hls.startPosition);const r=this.updateItem(n,i);if(this.itemsMatch(n,r)&&this.clearInterstitial(e,null),e.appendInPlace&&(this.attachPrimary(t,null),this.flushFrontBuffer(t)),!this.schedule)return;const s=this.schedule.findItemIndexAtTime(i);this.setSchedulePosition(s)}else this.checkStart()}onAssetListLoaded(e,t){var n,i;const r=t.event,s=r.identifier,a=t.assetListResponse.ASSETS;if(null==(n=this.schedule)||!n.hasEvent(s))return;const o=r.timelineStart,l=r.duration;let u=0;a.forEach(((e,t)=>{const n=parseFloat(e.DURATION);this.createAsset(r,t,u,o+u,n,e.URI),u+=n})),r.duration=u,this.log(`Loaded asset-list with duration: ${u} (was: ${l}) ${r}`);const c=this.waitingItem,h=(null==c?void 0:c.event.identifier)===s;this.updateSchedule();const d=null==(i=this.bufferingItem)?void 0:i.event;if(h){var f;const e=this.schedule.findEventIndex(s),t=null==(f=this.schedule.items)?void 0:f[e];if(t){if(!this.playingItem&&this.timelinePos>t.end){if(this.schedule.findItemIndexAtTime(this.timelinePos)!==e)return r.error=new Error(`Interstitial no longer within playback range ${this.timelinePos} ${r}`),this.updateSchedule(!0),void this.primaryFallback(r)}this.setBufferingItem(t)}this.setSchedulePosition(e)}else if((null==d?void 0:d.identifier)===s){const e=r.assetList[0];if(e){const t=this.getAssetPlayer(e.identifier);if(d.appendInPlace){const e=this.primaryMedia;t&&e&&this.bufferAssetPlayer(t,e)}else t&&t.loadSource()}}}onError(e,t){if(this.schedule)switch(t.details){case o.ASSET_LIST_PARSING_ERROR:case o.ASSET_LIST_LOAD_ERROR:case o.ASSET_LIST_LOAD_TIMEOUT:{const e=t.interstitial;e&&(this.updateSchedule(!0),this.primaryFallback(e));break}case o.BUFFER_STALLED_ERROR:{const e=this.endedItem||this.waitingItem||this.playingItem;if(this.isInterstitial(e)&&e.event.appendInPlace)return void this.handleInPlaceStall(e.event);this.log(`Primary player stall @${this.timelinePos} bufferedPos: ${this.bufferedPos}`),this.onTimeupdate(),this.checkBuffer(!0);break}}}}});function zo(e){return e&&"object"==typeof e?Array.isArray(e)?e.map(zo):Object.keys(e).reduce(((t,n)=>(t[n]=zo(e[n]),t)),{}):e}function Wo(e,t){const n=e.loader;if(n!==$o&&n!==Zo)t.log("[config]: Custom loader detected, cannot enable progressive streaming"),e.progressive=!1;else{(function(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(e){}return!1})()&&(e.loader=$o,e.progressive=!0,e.enableSoftwareAES=!0,t.log("[config]: Progressive streaming enabled, using FetchLoader"))}}class qo extends Jt{constructor(e,t){super("gap-controller",e.logger),this.hls=void 0,this.fragmentTracker=void 0,this.media=null,this.mediaSource=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.buffered={},this.lastCurrentTime=0,this.ended=0,this.waiting=0,this.onMediaPlaying=()=>{this.ended=0,this.waiting=0},this.onMediaWaiting=()=>{var e;null!=(e=this.media)&&e.seeking||(this.waiting=self.performance.now(),this.tick())},this.onMediaEnded=()=>{var e;this.hls&&(this.ended=(null==(e=this.media)?void 0:e.currentTime)||1,this.hls.trigger(l.MEDIA_ENDED,{stalled:!1}))},this.hls=e,this.fragmentTracker=t,this.registerListeners()}registerListeners(){const{hls:e}=this;e&&(e.on(l.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(l.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(l.BUFFER_APPENDED,this.onBufferAppended,this))}unregisterListeners(){const{hls:e}=this;e&&(e.off(l.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(l.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(l.BUFFER_APPENDED,this.onBufferAppended,this))}destroy(){super.destroy(),this.unregisterListeners(),this.media=this.hls=this.fragmentTracker=null,this.mediaSource=void 0}onMediaAttached(e,t){this.setInterval(100),this.mediaSource=t.mediaSource;const n=this.media=t.media;yi(n,"playing",this.onMediaPlaying),yi(n,"waiting",this.onMediaWaiting),yi(n,"ended",this.onMediaEnded)}onMediaDetaching(e,t){this.clearInterval();const{media:n}=this;n&&(bi(n,"playing",this.onMediaPlaying),bi(n,"waiting",this.onMediaWaiting),bi(n,"ended",this.onMediaEnded),this.media=null),this.mediaSource=void 0}onBufferAppended(e,t){this.buffered=t.timeRanges}get hasBuffered(){return Object.keys(this.buffered).length>0}tick(){var e;if(null==(e=this.media)||!e.readyState||!this.hasBuffered)return;const t=this.media.currentTime;this.poll(t,this.lastCurrentTime),this.lastCurrentTime=t}poll(e,t){var n,i;const 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,c=s.paused&&!a||s.ended||0===s.playbackRate;if(this.seeking=a,e!==t)return t&&(this.ended=0),this.moved=!0,a||(this.nudgeRetry=0,r.nudgeOnVideoHole&&!c&&e>t&&this.nudgeOnVideoHole(e,t)),void(0===this.waiting&&this.stallResolved(e));if(u||o)return void(o&&this.stallResolved(e));if(c)return this.nudgeRetry=0,this.stallResolved(e),void(!this.ended&&s.ended&&this.hls&&(this.ended=e||1,this.hls.trigger(l.MEDIA_ENDED,{stalled:!1})));if(!nn.getBuffered(s).length)return void(this.nudgeRetry=0);const h=nn.bufferInfo(s,e,0),d=h.nextStart||0,f=this.fragmentTracker;if(a&&f&&this.hls){const t=Yo(this.hls.inFlightFragments,e),n=h.len>2,i=!d||t||d-e>2&&!f.getPartialFragment(e);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(!(h.len>0)&&!d)return;const t=Math.max(d,h.start||0)-e,n=!(null==p||!p.live)?2*p.targetduration:2,i=Qo(e,f);if(t>0&&(t<=n||i))return void(s.paused||this._trySkipBufferHole(i))}const _=r.detectStallWithCurrentTimeMs,g=self.performance.now(),m=this.waiting;let v=this.stalled;if(null===v){if(!(m>0&&g-m<_))return void(this.stalled=g);v=this.stalled=m}const y=g-v;if(!a&&(y>=_||m)&&this.hls){var b;if("ended"===(null==(b=this.mediaSource)?void 0:b.readyState)&&(null==p||!p.live)&&Math.abs(e-((null==p?void 0:p.edge)||0))<1){if(this.ended)return;return this.ended=e||1,void this.hls.trigger(l.MEDIA_ENDED,{stalled:!0})}if(this._reportStall(h),!this.media||!this.hls)return}const E=nn.bufferInfo(s,e,r.maxBufferHole);this._tryFixBufferStall(E,y,e)}stallResolved(e){const t=this.stalled;if(t&&this.hls&&(this.stalled=null,this.stallReported)){const n=self.performance.now()-t;this.log(`playback not stuck anymore @${e}, after ${Math.round(n)}ms`),this.stallReported=!1,this.waiting=0,this.hls.trigger(l.STALL_RESOLVED,{})}}nudgeOnVideoHole(e,t){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&&e>i.end(0)){const n=nn.bufferedInfo(nn.timeRangesToArray(this.buffered.audio),e,0);if(n.len>1&&t>=n.start){const n=nn.timeRangesToArray(i),r=nn.bufferedInfo(n,t,0).bufferedIndex;if(r>-1&&r<n.length-1){const t=nn.bufferedInfo(n,e,0).bufferedIndex,i=n[r].end,s=n[r+1].start;if((-1===t||t>r)&&s-i<1&&e-i<2){const n=new Error(`nudging playhead to flush pipeline after video hole. currentTime: ${e} hole: ${i} -> ${s} buffered index: ${t}`);this.warn(n.message),this.media.currentTime+=1e-6;let r=Qo(e,this.fragmentTracker);r&&"fragment"in r?r=r.fragment:r||(r=void 0);const u=nn.bufferInfo(this.media,e,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(e,t,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=Qo(n,s);if(u||null!=l&&l.live&&n<l.fragmentStart){if(this._trySkipBufferHole(u)||!this.media)return}const c=e.buffered,h=this.adjacentTraversal(e,n);(c&&c.length>1&&e.len>o.maxBufferHole||e.nextStart&&(e.nextStart-n<o.maxBufferHole||h))&&(t>1e3*o.highBufferWatchdogPeriod||this.waiting)&&(this.warn("Trying to nudge playhead over buffer-hole"),this._tryNudgeBuffer(e))}adjacentTraversal(e,t){const n=this.fragmentTracker,i=e.nextStart;if(n&&i){const e=n.getFragAtPos(t,f),r=n.getFragAtPos(i,f);if(e&&r)return r.sn-e.sn<2}return!1}_reportStall(e){const{hls:t,media:n,stallReported:i,stalled:r}=this;if(!i&&null!==r&&n&&t){this.stallReported=!0;const i=new Error(`Playback stalling at @${n.currentTime} due to low buffer (${it(e)})`);this.warn(i.message),t.trigger(l.ERROR,{type:a.MEDIA_ERROR,details:o.BUFFER_STALLED_ERROR,fatal:!1,error:i,buffer:e.len,bufferInfo:e,stalled:{start:r}})}}_trySkipBufferHole(e){var t;const{fragmentTracker:n,media:i}=this,r=null==(t=this.hls)?void 0:t.config;if(!i||!n||!r)return 0;const s=i.currentTime,u=nn.bufferInfo(i,s,0),c=s<u.start?u.start:u.nextStart;if(c&&this.hls){const t=u.len<=r.maxBufferHole,d=u.len>0&&u.len<1&&i.readyState<3,p=c-s;if(p>0&&(t||d)){if(p>r.maxBufferHole){let t=!1;if(0===s){const e=n.getAppendedFrag(0,f);e&&c<e.end&&(t=!0)}if(!t&&e){var h;if(null==(h=this.hls.loadLevelObj)||!h.details)return 0;if(Yo(this.hls.inFlightFragments,c))return 0;let t=!1,i=e.end;for(;i<c;){const e=Qo(i,n);if(!e){t=!0;break}i+=e.duration}if(t)return 0}}const t=Math.max(c+.05,s+.1);if(this.warn(`skipping hole, adjusting currentTime from ${s} to ${t}`),this.moved=!0,i.currentTime=t,null==e||!e.gap){const n=new Error(`fragment loaded with buffer holes, seeking from ${s} to ${t}`),i={type:a.MEDIA_ERROR,details:o.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:n,reason:n.message,buffer:u.len,bufferInfo:u};e&&("fragment"in e?i.part=e:i.frag=e),this.hls.trigger(l.ERROR,i)}return t}}return 0}_tryNudgeBuffer(e){const{hls:t,media:n,nudgeRetry:i}=this,r=null==t?void 0:t.config;if(!n||!r)return 0;const s=n.currentTime;if(this.nudgeRetry++,i<r.nudgeMaxRetry){const u=s+(i+1)*r.nudgeOffset,c=new Error(`Nudging 'currentTime' from ${s} to ${u}`);this.warn(c.message),n.currentTime=u,t.trigger(l.ERROR,{type:a.MEDIA_ERROR,details:o.BUFFER_NUDGE_ON_STALL,error:c,fatal:!1,buffer:e.len,bufferInfo:e})}else{const n=new Error(`Playhead still not moving while enough data buffered @${s} after ${r.nudgeMaxRetry} nudges`);this.error(n.message),t.trigger(l.ERROR,{type:a.MEDIA_ERROR,details:o.BUFFER_STALLED_ERROR,error:n,fatal:!0,buffer:e.len,bufferInfo:e})}}}function Yo(e,t){const n=Xo(e.main);if(n&&n.start<=t)return n;const i=Xo(e.audio);return i&&i.start<=t?i:null}function Xo(e){if(!e)return null;switch(e.state){case ki:case wi:case xi:case Ii:return null}return e.frag}function Qo(e,t){return t.getAppendedFrag(e,f)||t.getPartialFragment(e)}function Jo(){if("undefined"!=typeof self)return self.VTTCue||self.TextTrackCue}function el(e,t,n,i,r){let s=new e(t,n,"");try{s.value=i,r&&(s.type=r)}catch(a){s=new e(t,n,it(r?E({type:r},i):i))}return s}const tl=(()=>{const e=Jo();try{e&&new e(0,Number.POSITIVE_INFINITY,"")}catch(e){return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();class nl{constructor(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.removeCues=!0,this.assetCue=void 0,this.onEventCueEnter=()=>{this.hls&&this.hls.trigger(l.EVENT_CUE_ENTER,{})},this.hls=e,this._registerListeners()}destroy(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=this.onEventCueEnter=null}_registerListeners(){const{hls:e}=this;e&&(e.on(l.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(l.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(l.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(l.MANIFEST_LOADING,this.onManifestLoading,this),e.on(l.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(l.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(l.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(l.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}_unregisterListeners(){const{hls:e}=this;e&&(e.off(l.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(l.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(l.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(l.MANIFEST_LOADING,this.onManifestLoading,this),e.off(l.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(l.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(l.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(l.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}onMediaAttaching(e,t){var n;this.media=t.media,!1===(null==(n=t.overrides)?void 0:n.cueRemoval)&&(this.removeCues=!1)}onMediaAttached(){var e;const t=null==(e=this.hls)?void 0:e.latestLevelDetails;t&&this.updateDateRangeCues(t)}onMediaDetaching(e,t){this.media=null;!!t.transferMedia||(this.id3Track&&(this.removeCues&&Ta(this.id3Track,this.onEventCueEnter),this.id3Track=null),this.dateRangeCuesAppended={})}onManifestLoading(){this.dateRangeCuesAppended={}}createTrack(e){const t=this.getID3Track(e.textTracks);return t.mode="hidden",t}getID3Track(e){if(this.media){for(let t=0;t<e.length;t++){const n=e[t];if("metadata"===n.kind&&"id3"===n.label)return ka(n,this.media),n}return this.media.addTextTrack("metadata","id3")}}onFragParsingMetadata(e,t){if(!this.media||!this.hls)return;const{enableEmsgMetadataCues:n,enableID3MetadataCues:i}=this.hls.config;if(!n&&!i)return;const{samples:r}=t;this.id3Track||(this.id3Track=this.createTrack(this.media));const s=Jo();if(s)for(let e=0;e<r.length;e++){const t=r[e].type;if(t===cr.emsg&&!n||!i)continue;const a=ar(r[e].data),o=r[e].pts;let l=o+r[e].duration;l>tl&&(l=tl);l-o<=0&&(l=o+.25);for(let e=0;e<a.length;e++){const n=a[e];if(!or(n)){this.updateId3CueEnds(o,t);const e=el(s,o,l,n,t);e&&this.id3Track.addCue(e)}}}}updateId3CueEnds(e,t){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===t&&r.startTime<e&&r.endTime===tl&&(r.endTime=e)}}onBufferFlushing(e,{startOffset:t,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 e;e="audio"===i?e=>e.type===cr.audioId3&&o:"video"===i?e=>e.type===cr.emsg&&a:e=>e.type===cr.audioId3&&o||e.type===cr.emsg&&a,Aa(r,t,n,e)}}onLevelUpdated(e,{details:t}){this.updateDateRangeCues(t,!0)}onLevelPtsUpdated(e,t){Math.abs(t.drift)>.01&&this.updateDateRangeCues(t.details)}updateDateRangeCues(e,t){if(!this.hls||!this.media)return;const{assetPlayerId:n,timelineOffset:r,enableDateRangeMetadataCues:s,interstitialsController:a}=this.hls.config;if(!s)return;const o=Jo();if(n&&r&&!a){const{fragmentStart:t,fragmentEnd:i}=e;let r=this.assetCue;r?(r.startTime=t,r.endTime=i):o&&(r=this.assetCue=el(o,t,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(!e.hasProgramDateTime)return;const{id3Track:l}=this,{dateRanges:u}=e,c=Object.keys(u);let h=this.dateRangeCuesAppended;var d;if(l&&t)if(null!=(d=l.cues)&&d.length){const e=Object.keys(h).filter((e=>!c.includes(e)));for(let t=e.length;t--;){var f;const n=e[t],i=null==(f=h[n])?void 0:f.cues;delete h[n],i&&Object.keys(i).forEach((e=>{const t=i[e];if(t){t.removeEventListener("enter",this.onEventCueEnter);try{l.removeCue(t)}catch(e){}}}))}}else h=this.dateRangeCuesAppended={};const p=e.fragments[e.fragments.length-1];if(0!==c.length&&i(null==p?void 0:p.programDateTime)){this.id3Track||(this.id3Track=this.createTrack(this.media));for(let e=0;e<c.length;e++){const t=c[e],n=u[t],i=n.startTime,r=h[t],s=(null==r?void 0:r.cues)||{};let l=(null==r?void 0:r.durationKnown)||!1,d=tl;const{duration:f,endDate:p}=n;if(p&&null!==f)d=i+f,l=!0;else if(n.endOnNext&&!l){const e=c.reduce(((e,t)=>{if(t!==n.id){const i=u[t];if(i.class===n.class&&i.startDate>n.startDate&&(!e||n.startDate<e.startDate))return i}return e}),null);e&&(d=e.startTime,l=!0)}const g=Object.keys(n.attr);for(let e=0;e<g.length;e++){const u=g[e];if("ID"===(_=u)||"CLASS"===_||"CUE"===_||"START-DATE"===_||"DURATION"===_||"END-DATE"===_||"END-ON-NEXT"===_)continue;const c=s[u];if(c)!l||null!=r&&r.durationKnown?Math.abs(c.startTime-i)>.01&&(c.startTime=i,c.endTime=d):c.endTime=d;else if(o){let e=n.attr[u];dn(u)&&(e=P(e));const r=el(o,i,d,{key:u,data:e},cr.dateRange);r&&(r.id=t,this.id3Track.addCue(r),s[u]=r,a&&("X-ASSET-LIST"!==u&&"X-ASSET-URL"!==u||r.addEventListener("enter",this.onEventCueEnter)))}}h[t]={cues:s,dateRange:n,durationKnown:l}}var _}}}class il{constructor(e){this.hls=void 0,this.config=void 0,this.media=null,this.currentTime=0,this.stallCount=0,this._latency=null,this._targetLatencyUpdated=!1,this.onTimeupdate=()=>{const{media:e}=this,t=this.levelDetails;if(!e||!t)return;this.currentTime=e.currentTime;const n=this.computeLatency();if(null===n)return;this._latency=n;const{lowLatencyMode:i,maxLiveSyncPlaybackRate:r}=this.config;if(!i||1===r||!t.live)return;const s=this.targetLatency;if(null===s)return;const a=n-s;if(a<Math.min(this.maxLatency,s+t.targetduration)&&a>.05&&this.forwardBufferLength>1){const t=Math.min(2,Math.max(1,r)),n=Math.round(2/(1+Math.exp(-.75*a-this.edgeStalled))*20)/20,i=Math.min(t,Math.max(1,n));this.changeMediaPlaybackRate(e,i)}else 1!==e.playbackRate&&0!==e.playbackRate&&this.changeMediaPlaybackRate(e,1)},this.hls=e,this.config=e.config,this.registerListeners()}get levelDetails(){var e;return(null==(e=this.hls)?void 0:e.latestLevelDetails)||null}get latency(){return this._latency||0}get maxLatency(){const{config:e}=this;if(void 0!==e.liveMaxLatencyDuration)return e.liveMaxLatencyDuration;const t=this.levelDetails;return t?e.liveMaxLatencyDurationCount*t.targetduration:0}get targetLatency(){const e=this.levelDetails;if(null===e||null===this.hls)return null;const{holdBack:t,partHoldBack:n,targetduration:i}=e,{liveSyncDuration:r,liveSyncDurationCount:s,lowLatencyMode:a}=this.config,o=this.hls.userConfig;let l=a&&n||t;(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(e){this.stallCount=0,this.config.liveSyncDuration=e,this._targetLatencyUpdated=!0}get liveSyncPosition(){const e=this.estimateLiveEdge(),t=this.targetLatency;if(null===e||null===t)return null;const n=this.levelDetails;if(null===n)return null;const i=n.edge,r=e-t-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 e=this.levelDetails;return null===e?1:e.drift}get edgeStalled(){const e=this.levelDetails;if(null===e)return 0;const t=3*(this.config.lowLatencyMode&&e.partTarget||e.targetduration);return Math.max(e.age-t,0)}get forwardBufferLength(){const{media:e}=this,t=this.levelDetails;if(!e||!t)return 0;const n=e.buffered.length;return(n?e.buffered.end(n-1):t.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.hls=null}registerListeners(){const{hls:e}=this;e&&(e.on(l.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(l.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(l.MANIFEST_LOADING,this.onManifestLoading,this),e.on(l.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(l.ERROR,this.onError,this))}unregisterListeners(){const{hls:e}=this;e&&(e.off(l.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(l.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(l.MANIFEST_LOADING,this.onManifestLoading,this),e.off(l.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(l.ERROR,this.onError,this))}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("timeupdate",this.onTimeupdate)}onMediaDetaching(){this.media&&(this.media.removeEventListener("timeupdate",this.onTimeupdate),this.media=null)}onManifestLoading(){this._latency=null,this.stallCount=0}onLevelUpdated(e,{details:t}){t.advanced&&this.onTimeupdate(),!t.live&&this.media&&this.media.removeEventListener("timeupdate",this.onTimeupdate)}onError(e,t){var n;t.details===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(e,t){var n,i;e.playbackRate!==t&&(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 ${e.playbackRate} to ${t}`),e.playbackRate=t)}estimateLiveEdge(){const e=this.levelDetails;return null===e?null:e.edge+e.age}computeLatency(){const e=this.estimateLiveEdge();return null===e?null:e-this.currentTime}}class rl extends ds{constructor(e,t){super(e,"level-controller"),this._levels=[],this._firstLevel=-1,this._maxAutoLevel=-1,this._startLevel=void 0,this.currentLevel=null,this.currentLevelIndex=-1,this.manualLevelIndex=-1,this.steering=void 0,this.onParsedComplete=void 0,this.steering=t,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(l.MANIFEST_LOADING,this.onManifestLoading,this),e.on(l.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(l.LEVEL_LOADED,this.onLevelLoaded,this),e.on(l.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(l.FRAG_BUFFERED,this.onFragBuffered,this),e.on(l.ERROR,this.onError,this)}_unregisterListeners(){const{hls:e}=this;e.off(l.MANIFEST_LOADING,this.onManifestLoading,this),e.off(l.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(l.LEVEL_LOADED,this.onLevelLoaded,this),e.off(l.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(l.FRAG_BUFFERED,this.onFragBuffered,this),e.off(l.ERROR,this.onError,this)}destroy(){this._unregisterListeners(),this.steering=null,this.resetLevels(),super.destroy()}stopLoad(){this._levels.forEach((e=>{e.loadError=0,e.fragmentError=0})),super.stopLoad()}resetLevels(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[],this._maxAutoLevel=-1}onManifestLoading(e,t){this.resetLevels()}onManifestLoaded(e,t){const n=this.hls.config.preferManagedMediaSource,i=[],r={},s={};let a=!1,o=!1,l=!1;t.levels.forEach((e=>{const t=e.attrs;let{audioCodec:u,videoCodec:c}=e;u&&(e.audioCodec=u=Oe(u,n)||void 0),c&&(c=e.videoCodec=function(e){const t=e.split(",");for(let e=0;e<t.length;e++){const n=t[e].split(".");n.length>2&&"avc1"===n[0]&&(t[e]=`avc1.${parseInt(n[1]).toString(16)}${("000"+parseInt(n[2]).toString(16)).slice(-4)}`)}return t.join(",")}(c));const{width:h,height:d,unknownCodecs:f}=e,p=(null==f?void 0:f.length)||0;if(a||(a=!(!h||!d)),o||(o=!!c),l||(l=!!u),p||u&&!this.isAudioSupported(u)||c&&!this.isVideoSupported(c))return void this.log(`Some or all CODECS not supported "${t.CODECS}"`);const{CODECS:_,"FRAME-RATE":g,"HDCP-LEVEL":m,"PATHWAY-ID":v,RESOLUTION:y,"VIDEO-RANGE":b}=t,E=`${`${v||"."}-`}${e.bitrate}-${y}-${g}-${_}-${b}-${m}`;if(r[E])if(r[E].uri===e.url||e.attrs["PATHWAY-ID"])r[E].addGroupId("audio",t.AUDIO),r[E].addGroupId("text",t.SUBTITLES);else{const t=s[E]+=1;e.attrs["PATHWAY-ID"]=new Array(t+1).join(".");const n=this.createLevel(e);r[E]=n,i.push(n)}else{const t=this.createLevel(e);r[E]=t,s[E]=1,i.push(t)}})),this.filterAndSortMediaOptions(i,t,a,o,l)}createLevel(e){const t=new et(e),n=e.supplemental;if(null!=n&&n.videoCodec&&!this.isVideoSupported(n.videoCodec)){const e=new Error(`SUPPLEMENTAL-CODECS not supported "${n.videoCodec}"`);this.log(e.message),t.supportedResult=Ge(e,[])}return t}isAudioSupported(e){return Ce(e,"audio",this.hls.config.preferManagedMediaSource)}isVideoSupported(e){return Ce(e,"video",this.hls.config.preferManagedMediaSource)}filterAndSortMediaOptions(e,t,n,i,r){var s;let u=[],c=[],h=e;const d=(null==(s=t.stats)?void 0:s.parsing)||{};if((n||i)&&r&&(h=h.filter((({videoCodec:e,videoRange:t,width:n,height:i})=>{return(!!e||!(!n||!i))&&(!!(r=t)&&We.indexOf(r)>-1);var r}))),0===h.length)return Promise.resolve().then((()=>{if(this.hls){let e="no level with compatible codecs found in manifest",n=e;t.levels.length&&(n=`one or more CODECS in variant not supported: ${it(t.levels.map((e=>e.attrs.CODECS)).filter(((e,t,n)=>n.indexOf(e)===t)))}`,this.warn(n),e+=` (${n})`);const i=new Error(e);this.hls.trigger(l.ERROR,{type:a.MEDIA_ERROR,details:o.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:i,reason:n})}})),void(d.end=performance.now());t.audioTracks&&(u=t.audioTracks.filter((e=>!e.audioCodec||this.isAudioSupported(e.audioCodec))),sl(u)),t.subtitles&&(c=t.subtitles,sl(c));const f=h.slice(0);h.sort(((e,t)=>{if(e.attrs["HDCP-LEVEL"]!==t.attrs["HDCP-LEVEL"])return(e.attrs["HDCP-LEVEL"]||"")>(t.attrs["HDCP-LEVEL"]||"")?1:-1;if(n&&e.height!==t.height)return e.height-t.height;if(e.frameRate!==t.frameRate)return e.frameRate-t.frameRate;if(e.videoRange!==t.videoRange)return We.indexOf(e.videoRange)-We.indexOf(t.videoRange);if(e.videoCodec!==t.videoCodec){const n=xe(e.videoCodec),i=xe(t.videoCodec);if(n!==i)return i-n}if(e.uri===t.uri&&e.codecSet!==t.codecSet){const n=Ie(e.codecSet),i=Ie(t.codecSet);if(n!==i)return i-n}return e.averageBitrate!==t.averageBitrate?e.averageBitrate-t.averageBitrate:0}));let p=f[0];if(this.steering&&(h=this.steering.filterParsedLevels(h),h.length!==f.length))for(let e=0;e<f.length;e++)if(f[e].pathwayId===h[0].pathwayId){p=f[e];break}this._levels=h;for(let e=0;e<h.length;e++)if(h[e]===p){var _;this._firstLevel=e;const t=p.bitrate,n=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${h.length} level(s) found, first bitrate: ${t}`),void 0===(null==(_=this.hls.userConfig)?void 0:_.abrEwmaDefaultEstimate)){const e=Math.min(t,this.hls.config.abrEwmaDefaultEstimateMax);e>n&&n===this.hls.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=e)}break}const g=r&&!i,m=this.hls.config,v=!(!m.audioStreamController||!m.audioTrackController),y={levels:h,audioTracks:u,subtitleTracks:c,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:r,video:i,altAudio:v&&!g&&u.some((e=>!!e.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(e){const t=this._levels;if(0===t.length)return;if(e<0||e>=t.length){const n=new Error("invalid level idx"),i=e<0;if(this.hls.trigger(l.ERROR,{type:a.OTHER_ERROR,details:o.LEVEL_SWITCH_ERROR,level:e,fatal:i,error:n,reason:n.message}),i)return;e=Math.min(e,t.length-1)}const n=this.currentLevelIndex,i=this.currentLevel,r=i?i.attrs["PATHWAY-ID"]:void 0,s=t[e],u=s.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=s,n===e&&i&&r===u)return;this.log(`Switching to level ${e} (${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 c={level:e,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,c);const h=s.details;if(!h||h.live){const e=this.switchParams(s.uri,null==i?void 0:i.details,h);this.loadPlaylist(e)}}get manualLevel(){return this.manualLevelIndex}set manualLevel(e){this.manualLevelIndex=e,void 0===this._startLevel&&(this._startLevel=e),-1!==e&&(this.level=e)}get firstLevel(){return this._firstLevel}set firstLevel(e){this._firstLevel=e}get startLevel(){if(void 0===this._startLevel){const e=this.hls.config.startLevel;return void 0!==e?e:this.hls.firstAutoLevel}return this._startLevel}set startLevel(e){this._startLevel=e}get pathways(){return this.steering?this.steering.pathways():[]}get pathwayPriority(){return this.steering?this.steering.pathwayPriority:null}set pathwayPriority(e){if(this.steering){const t=this.steering.pathways(),n=e.filter((e=>-1!==t.indexOf(e)));if(e.length<1)return void this.warn(`pathwayPriority ${e} should contain at least one pathway from list: ${t}`);this.steering.pathwayPriority=n}}onError(e,t){!t.fatal&&t.context&&t.context.type===c&&t.context.level===this.level&&this.checkRetry(t)}onFragBuffered(e,{frag:t}){if(void 0!==t&&t.type===f){const e=t.elementaryStreams;if(!Object.keys(e).some((t=>!!e[t])))return;const n=this._levels[t.level];null!=n&&n.loadError&&(this.log(`Resetting level error count of ${n.loadError} on frag buffered`),n.loadError=0)}}onLevelLoaded(e,t){var n;const{level:i,details:r}=t,s=t.levelInfo;var a;if(!s)return this.warn(`Invalid level index ${i}`),void(null!=(a=t.deliveryDirectives)&&a.skip&&(r.deltaUpdateFailed=!0));if(s===this.currentLevel||t.withoutMultiVariant){0===s.fragmentError&&(s.loadError=0);let e=s.details;e===t.details&&e.advanced&&(e=void 0),this.playlistLoaded(i,t,e)}else null!=(n=t.deliveryDirectives)&&n.skip&&(r.deltaUpdateFailed=!0)}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentLevel)&&this.scheduleLoading(this.currentLevel,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const n=this.getUrlWithDirectives(e.uri,t),i=this.currentLevelIndex,r=e.attrs["PATHWAY-ID"],s=e.details,a=null==s?void 0:s.age;this.log(`Loading level index ${i}${void 0!==(null==t?void 0:t.msn)?" at sn "+t.msn+" part "+t.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:e,pathwayId:e.attrs["PATHWAY-ID"],id:0,deliveryDirectives:t||null})}get nextLoadLevel(){return-1!==this.manualLevelIndex?this.manualLevelIndex:this.hls.nextAutoLevel}set nextLoadLevel(e){this.level=e,-1===this.manualLevelIndex&&(this.hls.nextAutoLevel=e)}removeLevel(e){var t;if(1===this._levels.length)return;const n=this._levels.filter(((t,n)=>n!==e||(this.steering&&this.steering.removeLevel(t),t===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,t.details&&t.details.fragments.forEach((e=>e.level=-1))),!1)));hi(n),this._levels=n,this.currentLevelIndex>-1&&null!=(t=this.currentLevel)&&t.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.manualLevelIndex>-1&&(this.manualLevelIndex=this.currentLevelIndex);const i=n.length-1;this._firstLevel=Math.min(this._firstLevel,i),this._startLevel&&(this._startLevel=Math.min(this._startLevel,i)),this.hls.trigger(l.LEVELS_UPDATED,{levels:n})}onLevelsUpdated(e,{levels:t}){this._levels=t}checkMaxAutoUpdated(){const{autoLevelCapping:e,maxAutoLevel:t,maxHdcpLevel:n}=this.hls;this._maxAutoLevel!==t&&(this._maxAutoLevel=t,this.hls.trigger(l.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:t,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:n}))}}function sl(e){const t={};e.forEach((e=>{const n=e.groupId||"";e.id=t[n]=t[n]||0,t[n]++}))}function al(){return self.SourceBuffer||self.WebKitSourceBuffer}function ol(){if(!L())return!1;const e=al();return!e||e.prototype&&"function"==typeof e.prototype.appendBuffer&&"function"==typeof e.prototype.remove}class ll extends Oi{constructor(e,t,n){super(e,t,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 e=this.media,t=e?e.currentTime:null;if(null===t||!i(t))return;if(this.log(`Media seeked to ${t.toFixed(3)}`),!this.getBufferedFrag(t))return;const n=this.getFwdBufferInfoAtPos(e,t,f,0);null!==n&&0!==n.len?this.tick():this.warn(`Main forward buffer length at ${t} on "seeked" event ${n?n.len:"empty"})`)},this.registerListeners()}registerListeners(){super.registerListeners();const{hls:e}=this;e.on(l.MANIFEST_PARSED,this.onManifestParsed,this),e.on(l.LEVEL_LOADING,this.onLevelLoading,this),e.on(l.LEVEL_LOADED,this.onLevelLoaded,this),e.on(l.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(l.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(l.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(l.BUFFER_CREATED,this.onBufferCreated,this),e.on(l.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(l.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(l.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){super.unregisterListeners();const{hls:e}=this;e.off(l.MANIFEST_PARSED,this.onManifestParsed,this),e.off(l.LEVEL_LOADED,this.onLevelLoaded,this),e.off(l.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(l.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(l.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(l.BUFFER_CREATED,this.onBufferCreated,this),e.off(l.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(l.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(l.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this.onMediaPlaying=this.onMediaSeeked=null,this.unregisterListeners(),super.onHandlerDestroying()}startLoad(e,t){if(this.levels){const{lastCurrentTime:n,hls:i}=this;if(this.stopLoad(),this.setInterval(100),this.level=-1,!this.startFragRequested){let e=i.startLevel;-1===e&&(i.config.testBandwidth&&this.levels.length>1?(e=0,this.bitrateTest=!0):e=i.firstAutoLevel),i.nextLoadLevel=e,this.level=i.loadLevel,this._hasEnoughToStart=!!t}n>0&&-1===e&&!t&&(this.log(`Override startPosition with lastCurrentTime @${n.toFixed(3)}`),e=n),this.state=ki,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}else this._forceStartLoad=!0,this.state=wi}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case Pi:{const{levels:e,level:t}=this,n=null==e?void 0:e[t],i=null==n?void 0:n.details;if(i&&(!i.live||this.levelLastLoaded===n&&!this.waitForLive(n))){if(this.waitForCdnTuneIn(i))break;this.state=ki;break}if(this.hls.nextLoadLevel!==this.level){this.state=ki;break}break}case Ai:this.checkRetryDate()}this.state===ki&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){var e;super.onTickEnd(),null!=(e=this.media)&&e.readyState&&!1===this.media.seeking&&(this.lastCurrentTime=this.media.currentTime),this.checkFragmentChanged()}doTickIdle(){const{hls:e,levelLastLoaded:t,levels:n,media:i}=this;if(null===t||!i&&!this.primaryPrefetch&&(this.startFragRequested||!e.config.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;const r=this.buffering?e.nextLoadLevel:e.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 e={};return 2===this.altAudio&&(e.type="video"),this.hls.trigger(l.BUFFER_EOS,e),void(this.state=xi)}if(!this.buffering)return;e.loadLevel!==r&&-1===e.manualLevel&&this.log(`Adapting to level ${r} from level ${this.level}`),this.level=e.nextLoadLevel=r;const u=s.details;if(!u||this.state===Pi||this.waitForLive(s))return this.level=r,this.state=Pi,void(this.startFragRequested=!1);const c=a.len,h=this.getMaxBufferLength(s.maxBitrate);if(c>=h)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)!==Ft){var _;const e=(null!=(_=this.backtrackFragment)?_:p).sn-u.startSN,t=u.fragments[e-1];t&&p.cc===t.cc&&(p=t,this.fragmentTracker.removeFragment(t))}else this.backtrackFragment&&a.len&&(this.backtrackFragment=null);if(p&&this.isLoopLoading(p,d)){if(!p.gap){const e=this.audioOnly&&!this.altAudio?V:Z,t=(e===Z?this.videoBuffer:this.mediaBuffer)||this.media;t&&this.afterBufferFlushed(t,e,f)}p=this.getNextFragmentLoopLoading(p,u,a,f,h)}p&&(!p.initSegment||p.initSegment.data||this.bitrateTest||(p=p.initSegment),this.loadFragment(p,s,d))}loadFragment(e,t,n){const i=this.fragmentTracker.getState(e);i===Ot||i===Nt?W(e)?this.bitrateTest?(this.log(`Fragment ${e.sn} of level ${e.level} is being downloaded to test bitrate and will not be buffered`),this._loadBitrateTestFrag(e,t)):super.loadFragment(e,t,n):this._loadInitSegment(e,t):this.clearTrackerIfNeeded(e)}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,f)}followingBufferedFrag(e){return e?this.getBufferedFrag(e.end+.5):null}immediateLevelSwitch(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)}nextLevelSwitch(){const{levels:e,media:t}=this;if(null!=t&&t.readyState){let n;const i=this.getAppendedFrag(t.currentTime);i&&i.start>1&&this.flushMainBuffer(0,i.start-1);const r=this.getLevelDetails();if(null!=r&&r.live){const e=this.getMainFwdBufferInfo();if(!e||e.len<2*r.targetduration)return}if(!t.paused&&e){const t=e[this.hls.nextLoadLevel],i=this.fragLastKbps;n=i&&this.fragCurrent?this.fragCurrent.duration*t.maxBitrate/(1e3*i)+1:0}else n=0;const s=this.getBufferedFrag(t.currentTime+n);if(s){const e=this.followingBufferedFrag(s);if(e){this.abortCurrentFrag();const t=e.maxStartPTS?e.maxStartPTS:e.start,n=e.duration,i=Math.max(s.end,t+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 e=this.fragCurrent;switch(this.fragCurrent=null,this.backtrackFragment=null,e&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.state){case Si:case Ti:case Ai:case Ri:case Li:this.state=ki}this.nextLoadPosition=this.getLoadPosition()}flushMainBuffer(e,t){super.flushMainBuffer(e,t,2===this.altAudio?"video":null)}onMediaAttached(e,t){super.onMediaAttached(e,t);const n=t.media;yi(n,"playing",this.onMediaPlaying),yi(n,"seeked",this.onMediaSeeked)}onMediaDetaching(e,t){const{media:n}=this;n&&(bi(n,"playing",this.onMediaPlaying),bi(n,"seeked",this.onMediaSeeked)),this.videoBuffer=null,this.fragPlaying=null,super.onMediaDetaching(e,t);!!t.transferMedia||(this._hasEnoughToStart=!1)}onManifestLoading(){super.onManifestLoading(),this.log("Trigger BUFFER_RESET"),this.hls.trigger(l.BUFFER_RESET,void 0),this.couldBacktrack=!1,this.fragLastKbps=0,this.fragPlaying=this.backtrackFragment=null,this.altAudio=0,this.audioOnly=!1}onManifestParsed(e,t){let n=!1,i=!1;for(let e=0;e<t.levels.length;e++){const r=t.levels[e].audioCodec;r&&(n=n||-1!==r.indexOf("mp4a.40.2"),i=i||-1!==r.indexOf("mp4a.40.5"))}this.audioCodecSwitch=n&&i&&!function(){var e;const t=al();return"function"==typeof(null==t||null==(e=t.prototype)?void 0:e.changeType)}(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=t.levels,this.startFragRequested=!1}onLevelLoading(e,t){const{levels:n}=this;if(!n||this.state!==ki)return;const i=t.levelInfo;(!i.details||i.details.live&&(this.levelLastLoaded!==i||i.details.expired)||this.waitForCdnTuneIn(i.details))&&(this.state=Pi)}onLevelLoaded(e,t){var n;const{levels:i,startFragRequested:r}=this,s=t.level,a=t.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=t.levelInfo,c=this.fragCurrent;!c||this.state!==Ti&&this.state!==Ai||c.level!==t.level&&c.loader&&this.abortCurrentFrag();let h=0;if(a.live||null!=(n=u.details)&&n.live){var d;if(this.checkLiveUpdate(a),a.deltaUpdateFailed)return;h=this.alignPlaylists(a,u.details,null==(d=this.levelLastLoaded)?void 0:d.details)}if(u.details=a,this.levelLastLoaded=u,r||this.setStartPosition(a,h),this.hls.trigger(l.LEVEL_UPDATED,{details:a,level:s}),this.state===Pi){if(this.waitForCdnTuneIn(a))return;this.state=ki}r&&a.live&&this.synchronizeToLiveEdge(a),this.tick()}synchronizeToLiveEdge(e){const{config:t,media:n}=this;if(!n)return;const i=this.hls.liveSyncPosition,r=this.getLoadPosition(),s=e.fragmentStart,a=e.edge,o=r>=s-t.maxFragLookUpTolerance&&r<=a;if(null!==i&&n.duration>i&&(r<i||!o)){const s=void 0!==t.liveMaxLatencyDuration?t.liveMaxLatencyDuration:t.liveMaxLatencyDurationCount*e.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 e=nn.bufferInfo(n,i,0);if(null==(l=e.buffered)||!l.length)return void(n.currentTime=i);if(e.start<=r)return void(n.currentTime=i);const{nextStart:t}=nn.bufferedInfo(e.buffered,r,0);t&&(n.currentTime=t)}else n.currentTime=i}}_handleFragmentLoadProgress(e){var t;const n=e.frag,{part:i,payload:r}=e,{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,c=null==(t=n.initSegment)?void 0:t.data,h=this._getAudioCodec(a),d=this.transmuxer=this.transmuxer||new hs(this.hls,f,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),p=i?i.index:-1,_=-1!==p,g=new en(n.level,n.sn,n.stats.chunkCount,r.byteLength,p,_),m=this.initPTS[n.cc];d.push(r,c,h,l,n,i,o.totalduration,u,g,m)}onAudioTrackSwitching(e,t){const n=this.hls,i=2===this.altAudio;if(ht(t.url,n))this.altAudio=1;else{if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;const e=this.fragCurrent;e&&(this.log("Switching to main audio track, cancel main fragment load"),e.abortRequests(),this.fragmentTracker.removeFragment(e)),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,t)})),void n.trigger(l.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null});n.trigger(l.AUDIO_TRACK_SWITCHED,t)}}onAudioTrackSwitched(e,t){const n=ht(t.url,this.hls);if(n){const e=this.videoBuffer;e&&this.mediaBuffer!==e&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=e)}this.altAudio=n?2:0,this.tick()}onBufferCreated(e,t){const n=t.tracks;let i,r,s=!1;for(const e in n){const t=n[e];if("main"===t.id){if(r=e,i=t,"video"===e){const t=n[e];t&&(this.videoBuffer=t.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(e,t){const{frag:n,part:i}=t,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===Li&&(this.state=ki));const e=i?i.stats:n.stats;this.fragLastKbps=Math.round(8*e.total/(e.buffering.end-e.loading.first)),W(n)&&(this.fragPrevious=n),this.fragBufferedComplete(n,i)}const s=this.media;s&&(!this._hasEnoughToStart&&nn.getBuffered(s).length&&(this._hasEnoughToStart=!0,this.seekToStartPos()),r&&this.tick())}get hasEnoughToStart(){return this._hasEnoughToStart}onError(e,t){var n;if(t.fatal)this.state=Ii;else switch(t.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,t);break;case o.LEVEL_LOAD_ERROR:case o.LEVEL_LOAD_TIMEOUT:case o.LEVEL_PARSING_ERROR:t.levelRetry||this.state!==Pi||(null==(n=t.context)?void 0:n.type)!==c||(this.state=ki);break;case o.BUFFER_ADD_CODEC_ERROR:case o.BUFFER_APPEND_ERROR:if("main"!==t.parent)return;this.reduceLengthAndFlushBuffer(t)&&this.resetLoadingState();break;case o.BUFFER_FULL_ERROR:if("main"!==t.parent)return;if(this.reduceLengthAndFlushBuffer(t)){!this.config.interstitialsController&&this.config.assetPlayerId?this._hasEnoughToStart=!0:this.flushMainBuffer(0,Number.POSITIVE_INFINITY)}break;case o.INTERNAL_EXCEPTION:this.recoverWorkerError(t)}}onFragLoadEmergencyAborted(){this.state=ki,this._hasEnoughToStart||(this.startFragRequested=!1,this.nextLoadPosition=this.lastCurrentTime),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==V||!this.altAudio){const e=(t===Z?this.videoBuffer:this.mediaBuffer)||this.media;e&&(this.afterBufferFlushed(e,t,f),this.tick())}}onLevelsUpdated(e,t){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level,-1===this.level&&this.resetWhenMissingContext(this.fragCurrent)),this.levels=t.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){const{media:e}=this;if(!e)return;const t=e.currentTime;let n=this.startPosition;if(n>=0&&t<n){if(e.seeking)return void this.log(`could not seek to ${n}, already seeking at ${t}`);const i=this.timelineOffset;i&&n&&(n+=i);const r=this.getLevelDetails(),s=nn.getBuffered(e),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),t<n&&(this.log(`seek to target start position ${n} from current time ${t} buffer start ${a}`),e.currentTime=n)}}_getAudioCodec(e){let t=this.config.defaultAudioCodec||e.audioCodec;return this.audioCodecSwap&&t&&(this.log("Swapping audio codec"),t=-1!==t.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5"),t}_loadBitrateTestFrag(e,t){e.bitrateTest=!0,this._doFragLoad(e,t).then((e=>{const{hls:n}=this,i=null==e?void 0:e.frag;if(!i||this.fragContextChanged(i))return;t.fragmentError=0,this.state=ki,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,e),i.bitrateTest=!1})).catch((t=>{this.state!==wi&&this.state!==Ii&&(this.warn(t),this.resetFragmentLoading(e))}))}_handleTransmuxComplete(e){const t=this.playlistType,{hls:n}=this,{remuxResult:r,chunkMeta:s}=e,a=this.getCurrentContext(s);if(!a)return void this.resetWhenMissingContext(s);const{frag:o,part:u,level:c}=a,{video:h,text:d,id3:f,initSegment:p}=r,{details:_}=c,g=this.altAudio?void 0:r.audio;if(this.fragContextChanged(o))this.fragmentTracker.removeFragment(o);else{if(this.state=Ri,p){const e=p.tracks;if(e){const i=o.initSegment||o;if(this.unhandledEncryptionError(p,o))return;this._bufferInitSegment(c,e,i,s),n.trigger(l.FRAG_PARSING_INIT_SEGMENT,{frag:i,id:t,tracks:e})}const r=p.initPTS,a=p.timescale,u=this.initPTS[o.cc];if(i(r)&&(!u||u.baseTime!==r||u.timescale!==a)){const e=p.trackId;this.initPTS[o.cc]={baseTime:r,timescale:a,trackId:e},n.trigger(l.INIT_PTS_FOUND,{frag:o,id:t,initPTS:r,timescale:a,trackId:e})}}if(h&&_){g&&"audiovideo"===h.type&&this.logMuxedErr(o);const e=_.fragments[o.sn-1-_.startSN],t=o.sn===_.startSN,n=!e||o.cc>e.cc;if(!1!==r.independent){const{startPTS:e,endPTS:i,startDTS:r,endDTS:a}=h;if(u)u.elementaryStreams[h.type]={startPTS:e,endPTS:i,startDTS:r,endDTS:a};else if(h.firstKeyFrame&&h.independent&&1===s.id&&!n&&(this.couldBacktrack=!0),h.dropped&&h.independent){const r=this.getMainFwdBufferInfo(),s=(r?r.end:this.getLoadPosition())+this.config.maxBufferHole,l=h.firstKeyFramePTS?h.firstKeyFramePTS:e;if(!t&&s<l-this.config.maxBufferHole&&!n)return void this.backtrack(o);n&&(o.gap=!0),o.setElementaryStreamInfo(h.type,o.start,i,o.start,a,!0)}else t&&e-(_.appliedTimelineOffset||0)>2&&(o.gap=!0);o.setElementaryStreamInfo(h.type,e,i,r,a),this.backtrackFragment&&(this.backtrackFragment=o),this.bufferFragmentData(h,o,u,s,t||n)}else{if(!t&&!n)return void this.backtrack(o);o.gap=!0}}if(g){const{startPTS:e,endPTS:t,startDTS:n,endDTS:i}=g;u&&(u.elementaryStreams[V]={startPTS:e,endPTS:t,startDTS:n,endDTS:i}),o.setElementaryStreamInfo(V,e,t,n,i),this.bufferFragmentData(g,o,u,s)}if(_&&null!=f&&f.samples.length){const e={id:t,frag:o,details:_,samples:f.samples};n.trigger(l.FRAG_PARSING_METADATA,e)}if(_&&d){const e={id:t,frag:o,details:_,samples:d.samples};n.trigger(l.FRAG_PARSING_USERDATA,e)}}}logMuxedErr(e){this.warn(`${W(e)?"Media":"Init"} segment with muxed audiovideo where only video expected: ${e.url}`)}_bufferInitSegment(e,t,n,i){if(this.state!==Ri)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&(delete t.audio,t.audiovideo&&this.logMuxedErr(n));const{audio:r,video:s,audiovideo:a}=t;if(r){const n=e.audioCodec;let i=Me(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 e=r.metadata;e&&"channelCount"in e&&1!==(e.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 t.audiovideo}if(s){s.levelCodec=e.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]=[${e.videoCodec||""}/${n}]${s.codec!==n?" parsed-corrected="+s.codec:""}${s.supplemental?" supplemental="+s.supplemental:""}`),delete t.audiovideo}a&&(this.log(`Init audiovideo buffer, container:${a.container}, codecs[level/parsed]=[${e.codecs}/${a.codec}]`),delete t.video,delete t.audio);const o=Object.keys(t);if(o.length){if(this.hls.trigger(l.BUFFER_CODECS,t),!this.hls)return;o.forEach((e=>{const r=t[e].initSegment;null!=r&&r.byteLength&&this.hls.trigger(l.BUFFER_APPENDING,{type:e,data:r,frag:n,part:null,chunkMeta:i,parent:n.type})}))}this.tickImmediate()}getMainFwdBufferInfo(){const e=this.mediaBuffer&&2===this.altAudio?this.mediaBuffer:this.media;return this.getFwdBufferInfo(e,f)}get maxBufferLength(){const{levels:e,level:t}=this,n=null==e?void 0:e[t];return n?this.getMaxBufferLength(n.maxBitrate):this.config.maxBufferLength}backtrack(e){this.couldBacktrack=!0,this.backtrackFragment=e,this.resetTransmuxer(),this.flushBufferGap(e),this.fragmentTracker.removeFragment(e),this.fragPrevious=null,this.nextLoadPosition=e.start,this.state=ki}checkFragmentChanged(){const e=this.media;let t=null;if(e&&e.readyState>1&&!1===e.seeking){const n=e.currentTime;if(nn.isBuffered(e,n)?t=this.getAppendedFrag(n):nn.isBuffered(e,n+.1)&&(t=this.getAppendedFrag(n+.1)),t){this.backtrackFragment=null;const e=this.fragPlaying,n=t.level;e&&t.sn===e.sn&&e.level===n||(this.fragPlaying=t,this.hls.trigger(l.FRAG_CHANGED,{frag:t}),e&&e.level===n||this.hls.trigger(l.LEVEL_SWITCHED,{level:n}))}}}get nextLevel(){const e=this.nextBufferedFrag;return e?e.level:-1}get currentFrag(){var e;if(this.fragPlaying)return this.fragPlaying;const t=(null==(e=this.media)?void 0:e.currentTime)||this.lastCurrentTime;return i(t)?this.getAppendedFrag(t):null}get currentProgramDateTime(){var e;const t=(null==(e=this.media)?void 0:e.currentTime)||this.lastCurrentTime;if(i(t)){const e=this.getLevelDetails(),n=this.currentFrag||(e?ft(null,e.fragments,t):null);if(n){const e=n.programDateTime;if(null!==e){const i=e+1e3*(t-n.start);return new Date(i)}}}return null}get currentLevel(){const e=this.currentFrag;return e?e.level:-1}get nextBufferedFrag(){const e=this.currentFrag;return e?this.followingBufferedFrag(e):null}get forceStartLoad(){return this._forceStartLoad}}class ul extends w{constructor(e,t){super("key-loader",t),this.config=void 0,this.keyIdToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(const n in this.keyIdToKeyInfo){const i=this.keyIdToKeyInfo[n].loader;if(i){var t;if(e&&e!==(null==(t=i.context)?void 0:t.frag.type))return;i.abort()}}}detach(){for(const e in this.keyIdToKeyInfo){const t=this.keyIdToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyIdToKeyInfo[e]}}destroy(){this.detach();for(const e in this.keyIdToKeyInfo){const t=this.keyIdToKeyInfo[e].loader;t&&t.destroy()}this.keyIdToKeyInfo={}}createKeyLoadError(e,t=o.KEY_LOAD_ERROR,n,i,r){return new Qt({type:a.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:r,error:n,networkDetails:i})}loadClear(e,t,n){if(this.emeController&&this.config.emeEnabled&&!this.emeController.getSelectedKeySystemFormats().length){if(t.length)for(let i=0,r=t.length;i<r;i++){const s=t[i];if(e.cc<=s.cc&&(!W(e)||!W(s)||e.sn<s.sn)||!n&&i==r-1)return this.emeController.selectKeySystemFormat(s).then((e=>{if(!this.emeController)return;s.setKeyFormat(e);const t=Ln(e);return t?this.emeController.getKeySystemAccess([t]):void 0}))}if(this.config.requireKeySystemAccessOnStart){const e=In(this.config);if(e.length)return this.emeController.getKeySystemAccess(e)}}return null}load(e){return!e.decryptdata&&e.encrypted&&this.emeController&&this.config.emeEnabled?this.emeController.selectKeySystemFormat(e).then((t=>this.loadInternal(e,t))):this.loadInternal(e)}loadInternal(e,t){var n,i;t&&e.setKeyFormat(t);const r=e.decryptdata;if(!r){const n=new Error(t?`Expected frag.decryptdata to be defined after setting format ${t}`:`Missing decryption data on fragment in onKeyLoading (emeEnabled with controller: ${this.emeController&&this.config.emeEnabled})`);return Promise.reject(this.createKeyLoadError(e,o.KEY_LOAD_ERROR,n))}const s=r.uri;if(!s)return Promise.reject(this.createKeyLoadError(e,o.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${s}"`)));const a=cl(r);let l=this.keyIdToKeyInfo[a];if(null!=(n=l)&&n.decryptdata.key)return r.key=l.decryptdata.key,Promise.resolve({frag:e,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((t=>{const{keyInfo:n}=t;return r.key=n.decryptdata.key,{frag:e,keyInfo:n}}))}}switch(this.log(`${this.keyIdToKeyInfo[a]?"Rel":"L"}oading${r.keyId?" keyId: "+D(r.keyId):""} URI: ${r.uri} from ${e.type} ${e.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,e):this.loadKeyEME(l,e);case"AES-128":case"AES-256":case"AES-256-CTR":return this.loadKeyHTTP(l,e);default:return Promise.reject(this.createKeyLoadError(e,o.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${r.method}"`)))}}loadKeyEME(e,t){const n={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){var i;if(!e.decryptdata.keyId&&null!=(i=t.initSegment)&&i.data){const n=function(e){const t=[];return pe(e,(e=>t.push(e.subarray(8,24)))),t}(t.initSegment.data);if(n.length){const t=n[0];t.some((e=>0!==e))&&(this.log(`Using keyId found in init segment ${D(t)}`),e.decryptdata.keyId=t,Nn.setKeyIdForUri(e.decryptdata.uri,t))}}const r=this.emeController.loadKey(n);return(e.keyLoadPromise=r.then((t=>(e.mediaKeySessionContext=t,n)))).catch((n=>{throw e.keyLoadPromise=null,"data"in n&&(n.data.frag=t),n}))}return Promise.resolve(n)}loadKeyHTTP(e,t){const n=this.config,i=new(0,n.loader)(n);return t.keyLoader=e.loader=i,e.keyLoadPromise=new Promise(((r,s)=>{const a={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},l=n.keyLoadPolicy.default,u={loadPolicy:l,timeout:l.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},c={onSuccess:(e,t,n,i)=>{const{frag:a,keyInfo:l}=n,u=cl(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(e.data),a.keyLoader=null,l.loader=null,r({frag:a,keyInfo:l})},onError:(e,n,i,r)=>{this.resetLoader(n),s(this.createKeyLoadError(t,o.KEY_LOAD_ERROR,new Error(`HTTP Error ${e.code} loading key ${e.text}`),i,E({url:a.url,data:void 0},e)))},onTimeout:(e,n,i)=>{this.resetLoader(n),s(this.createKeyLoadError(t,o.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),i))},onAbort:(e,n,i)=>{this.resetLoader(n),s(this.createKeyLoadError(t,o.INTERNAL_ABORTED,new Error("key loading aborted"),i))}};i.load(a,u,c)}))}resetLoader(e){const{frag:t,keyInfo:n,url:i}=e,r=n.loader;t.keyLoader===r&&(t.keyLoader=null,n.loader=null);const s=cl(n.decryptdata)||i;delete this.keyIdToKeyInfo[s],r&&r.destroy()}}function cl(e){if(e.keyFormat!==An){const t=e.keyId;if(t)return D(t)}return e.uri}function hl(e){const{type:t}=e;switch(t){case h:return p;case d:return _;default:return f}}function dl(e,t){let n=e.url;return void 0!==n&&0!==n.indexOf("data:")||(n=t.url),n}class fl{constructor(e){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.onManifestLoaded=this.checkAutostartLoad,this.hls=e,this.registerListeners()}startLoad(e){}stopLoad(){this.destroyInternalLoaders()}registerListeners(){const{hls:e}=this;e.on(l.MANIFEST_LOADING,this.onManifestLoading,this),e.on(l.LEVEL_LOADING,this.onLevelLoading,this),e.on(l.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(l.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.on(l.LEVELS_UPDATED,this.onLevelsUpdated,this)}unregisterListeners(){const{hls:e}=this;e.off(l.MANIFEST_LOADING,this.onManifestLoading,this),e.off(l.LEVEL_LOADING,this.onLevelLoading,this),e.off(l.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(l.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.off(l.LEVELS_UPDATED,this.onLevelsUpdated,this)}createInternalLoader(e){const t=this.hls.config,n=t.pLoader,i=t.loader,r=new(n||i)(t);return this.loaders[e.type]=r,r}getInternalLoader(e){return this.loaders[e.type]}resetInternalLoader(e){this.loaders[e]&&delete this.loaders[e]}destroyInternalLoaders(){for(const e in this.loaders){const t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}}destroy(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()}onManifestLoading(e,t){const{url:n}=t;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:u,url:n,deliveryDirectives:null,levelOrTrack:null})}onLevelLoading(e,t){const{id:n,level:i,pathwayId:r,url:s,deliveryDirectives:a,levelInfo:o}=t;this.load({id:n,level:i,pathwayId:r,responseType:"text",type:c,url:s,deliveryDirectives:a,levelOrTrack:o})}onAudioTrackLoading(e,t){const{id:n,groupId:i,url:r,deliveryDirectives:s,track:a}=t;this.load({id:n,groupId:i,level:null,responseType:"text",type:h,url:r,deliveryDirectives:s,levelOrTrack:a})}onSubtitleTrackLoading(e,t){const{id:n,groupId:i,url:r,deliveryDirectives:s,track:a}=t;this.load({id:n,groupId:i,level:null,responseType:"text",type:d,url:r,deliveryDirectives:s,levelOrTrack:a})}onLevelsUpdated(e,t){const n=this.loaders[c];if(n){const e=n.context;e&&!t.levels.some((t=>t===e.levelOrTrack))&&(n.abort(),delete this.loaders[c])}}load(e){var t;const n=this.hls.config;let r,s=this.getInternalLoader(e);if(s){const t=this.hls.logger,n=s.context;if(n&&n.levelOrTrack===e.levelOrTrack&&(n.url===e.url||n.deliveryDirectives&&!e.deliveryDirectives))return void(n.url===e.url?t.log(`[playlist-loader]: ignore ${e.url} ongoing request`):t.log(`[playlist-loader]: ignore ${e.url} in favor of ${n.url}`));t.log(`[playlist-loader]: aborting previous loader for type: ${e.type}`),s.abort()}if(r=e.type===u?n.manifestLoadPolicy.default:y({},n.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),s=this.createInternalLoader(e),i(null==(t=e.deliveryDirectives)?void 0:t.part)){let t;if(e.type===c&&null!==e.level?t=this.hls.levels[e.level].details:e.type===h&&null!==e.id?t=this.hls.audioTracks[e.id].details:e.type===d&&null!==e.id&&(t=this.hls.subtitleTracks[e.id].details),t){const e=t.partTarget,n=t.targetduration;if(e&&n){const t=1e3*Math.max(3*e,.8*n);r=y({},r,{maxTimeToFirstByteMs:Math.min(t,r.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(t,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:(e,t,n,i)=>{const r=this.getInternalLoader(n);this.resetInternalLoader(n.type);const s=e.data;t.parsing.start=performance.now(),jn.isMediaPlaylist(s)||n.type!==u?this.handleTrackOrLevelPlaylist(e,t,n,i||null,r):this.handleMasterPlaylist(e,t,n,i)},onError:(e,t,n,i)=>{this.handleNetworkError(t,n,!1,e,i)},onTimeout:(e,t,n)=>{this.handleNetworkError(t,n,!0,void 0,e)}};s.load(e,o,l)}checkAutostartLoad(){if(!this.hls)return;const{config:{autoStartLoad:e,startPosition:t},forceStartLoad:n}=this.hls;(e||n)&&(this.hls.logger.log(`${e?"auto":"force"} startLoad with configured startPosition ${t}`),this.hls.startLoad(t))}handleMasterPlaylist(e,t,n,i){const r=this.hls,s=e.data,a=dl(e,n),o=jn.parseMasterPlaylist(s,a);if(o.playlistParsingError)return t.parsing.end=performance.now(),void this.handleManifestParsingError(e,n,o.playlistParsingError,i,t);const{contentSteering:u,levels:c,sessionData:h,sessionKeys:d,startTimeOffset:f,variableList:p}=o;this.variableList=p,c.forEach((e=>{const{unknownCodecs:t}=e;if(t){const{preferManagedMediaSource:n}=this.hls.config;let{audioCodec:i,videoCodec:r}=e;for(let s=t.length;s--;){const a=t[s];Ce(a,"audio",n)?(e.audioCodec=i=i?`${i},${a}`:a,Te.audio[i.substring(0,4)]=2,t.splice(s,1)):Ce(a,"video",n)&&(e.videoCodec=r=r?`${r},${a}`:a,Te.video[r.substring(0,4)]=2,t.splice(s,1))}}}));const{AUDIO:_=[],SUBTITLES:g,"CLOSED-CAPTIONS":m}=jn.parseMasterPlaylistMedia(s,a,o);if(_.length){_.some((e=>!e.url))||!c[0].audioCodec||c[0].attrs.AUDIO||(this.hls.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),_.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:c,audioTracks:_,subtitles:g,captions:m,contentSteering:u,url:a,stats:t,networkDetails:i,sessionData:h,sessionKeys:d,startTimeOffset:f,variableList:p})}handleTrackOrLevelPlaylist(e,t,n,r,s){const a=this.hls,{id:o,level:c,type:h}=n,d=dl(e,n),f=i(c)?c:i(o)?o:0,p=hl(n),_=jn.parseLevelPlaylist(e.data,d,f,p,0,this.variableList);if(h===u){const e={attrs:new hn({}),bitrate:0,details:_,name:"",url:d};_.requestScheduled=t.loading.start+oi(_,0),a.trigger(l.MANIFEST_LOADED,{levels:[e],audioTracks:[],url:d,stats:t,networkDetails:r,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),n.levelDetails=_,this.handlePlaylistLoaded(_,e,t,n,r,s)}handleManifestParsingError(e,t,n,i,r){this.hls.trigger(l.ERROR,{type:a.NETWORK_ERROR,details:o.MANIFEST_PARSING_ERROR,fatal:t.type===u,url:e.url,err:n,error:n,reason:n.message,response:e,context:t,networkDetails:i,stats:r})}handleNetworkError(e,t,n=!1,i,r){let s=`A network ${n?"timeout":"error"+(i?" (status "+i.code+")":"")} occurred while loading ${e.type}`;e.type===c?s+=`: ${e.level} id: ${e.id}`:e.type!==h&&e.type!==d||(s+=` id: ${e.id} group-id: "${e.groupId}"`);const f=new Error(s);this.hls.logger.warn(`[playlist-loader]: ${s}`);let p=o.UNKNOWN,_=!1;const g=this.getInternalLoader(e);switch(e.type){case u:p=n?o.MANIFEST_LOAD_TIMEOUT:o.MANIFEST_LOAD_ERROR,_=!0;break;case c:p=n?o.LEVEL_LOAD_TIMEOUT:o.LEVEL_LOAD_ERROR,_=!1;break;case h:p=n?o.AUDIO_TRACK_LOAD_TIMEOUT:o.AUDIO_TRACK_LOAD_ERROR,_=!1;break;case d:p=n?o.SUBTITLE_TRACK_LOAD_TIMEOUT:o.SUBTITLE_LOAD_ERROR,_=!1}g&&this.resetInternalLoader(e.type);const m={type:a.NETWORK_ERROR,details:p,fatal:_,url:e.url,loader:g,context:e,error:f,networkDetails:t,stats:r};if(i){const n=(null==t?void 0:t.url)||e.url;m.response=E({url:n,data:void 0},i)}this.hls.trigger(l.ERROR,m)}handlePlaylistLoaded(e,t,n,i,r,s){const p=this.hls,{type:_,level:g,levelOrTrack:m,id:v,groupId:y,deliveryDirectives:b}=i,E=dl(t,i),w=hl(i);let k="number"==typeof i.level&&w===f?g:void 0;const S=e.playlistParsingError;if(S){if(this.hls.logger.warn(`${S} ${e.url}`),!p.config.ignorePlaylistParsingErrors)return void p.trigger(l.ERROR,{type:a.NETWORK_ERROR,details:o.LEVEL_PARSING_ERROR,fatal:!1,url:E,error:S,reason:S.message,response:t,context:i,level:k,parent:w,networkDetails:r,stats:n});e.playlistParsingError=null}if(e.fragments.length)switch(e.live&&s&&(s.getCacheAge&&(e.ageHeader=s.getCacheAge()||0),s.getCacheAge&&!isNaN(e.ageHeader)||(e.ageHeader=0)),_){case u:case c:if(k)if(m){if(m!==p.levels[k]){const e=p.levels.indexOf(m);e>-1&&(k=e)}}else k=0;p.trigger(l.LEVEL_LOADED,{details:e,levelInfo:m||p.levels[0],level:k||0,id:v||0,stats:n,networkDetails:r,deliveryDirectives:b,withoutMultiVariant:_===u});break;case h:p.trigger(l.AUDIO_TRACK_LOADED,{details:e,track:m,id:v||0,groupId:y||"",stats:n,networkDetails:r,deliveryDirectives:b});break;case d:p.trigger(l.SUBTITLE_TRACK_LOADED,{details:e,track:m,id:v||0,groupId:y||"",stats:n,networkDetails:r,deliveryDirectives:b})}else{const s=e.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:t,context:i,level:k,parent:w,networkDetails:r,stats:n})}}}class pl{static get version(){return $i}static isMSESupported(){return ol()}static isSupported(){return function(){if(!ol())return!1;const e=L();return"function"==typeof(null==e?void 0:e.isTypeSupported)&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some((t=>e.isTypeSupported(Le(t,"video"))))||["mp4a.40.2","fLaC"].some((t=>e.isTypeSupported(Le(t,"audio")))))}()}static getMediaSource(){return L()}static get Events(){return l}static get MetadataSchema(){return cr}static get ErrorTypes(){return a}static get ErrorDetails(){return o}static get DefaultConfig(){return pl.defaultConfig?pl.defaultConfig:Ho}static set DefaultConfig(e){pl.defaultConfig=e}constructor(e={}){this.config=void 0,this.userConfig=void 0,this.logger=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new Ki,this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioStreamController=void 0,this.subtititleStreamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.interstitialsController=void 0,this.gapController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this._url=null,this._sessionId=void 0,this.triggeringException=void 0,this.started=!1;const t=this.logger=function(e,t,n){const i=T();if("object"==typeof console&&!0===e||"object"==typeof e){const r=["debug","log","info","warn","error"];r.forEach((t=>{i[t]=A(t,e,n)}));try{i.log(`Debug logs enabled for "${t}" in hls.js version 1.6.13`)}catch(e){return T()}r.forEach((t=>{C[t]=A(t,e)}))}else y(C,i);return i}(e.debug||!1,"Hls instance",e.assetPlayerId),n=this.config=function(e,t,n){if((t.liveSyncDurationCount||t.liveMaxLatencyDurationCount)&&(t.liveSyncDuration||t.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(void 0!==t.liveMaxLatencyDurationCount&&(void 0===t.liveSyncDurationCount||t.liveMaxLatencyDurationCount<=t.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(void 0!==t.liveMaxLatencyDuration&&(void 0===t.liveSyncDuration||t.liveMaxLatencyDuration<=t.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');const i=zo(e),r=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return["manifest","level","frag"].forEach((e=>{const s=`${"level"===e?"playlist":e}LoadPolicy`,a=void 0===t[s],o=[];r.forEach((n=>{const r=`${e}Loading${n}`,l=t[r];if(void 0!==l&&a){o.push(r);const e=i[s].default;switch(t[s]={default:e},n){case"TimeOut":e.maxLoadTimeMs=l,e.maxTimeToFirstByteMs=l;break;case"MaxRetry":e.errorRetry.maxNumRetry=l,e.timeoutRetry.maxNumRetry=l;break;case"RetryDelay":e.errorRetry.retryDelayMs=l,e.timeoutRetry.retryDelayMs=l;break;case"MaxRetryTimeout":e.errorRetry.maxRetryDelayMs=l,e.timeoutRetry.maxRetryDelayMs=l}}})),o.length&&n.warn(`hls.js config: "${o.join('", "')}" setting(s) are deprecated, use "${s}": ${it(t[s])}`)})),E(E({},i),t)}(pl.DefaultConfig,e,t);this.userConfig=e,n.progressive&&Wo(n,t);const{abrController:i,bufferController:r,capLevelController:s,errorController:a,fpsController:o}=n,u=new a(this),c=this.abrController=new i(this),h=new Bt(this),d=n.interstitialsController,f=d?this.interstitialsController=new d(this,pl):null,p=this.bufferController=new r(this,h),_=this.capLevelController=new s(this),g=new o(this),m=new fl(this),v=n.contentSteeringController,b=v?new v(this):null,w=this.levelController=new rl(this,b),k=new nl(this),S=new ul(this.config,this.logger),R=this.streamController=new ll(this,h,S),L=this.gapController=new qo(this,h);_.setStreamController(R),g.setStreamController(R);const x=[m,w,R];f&&x.splice(1,0,f),b&&x.splice(1,0,b),this.networkControllers=x;const I=[c,p,L,_,g,k,h];this.audioTrackController=this.createController(n.audioTrackController,x);const D=n.audioStreamController;D&&x.push(this.audioStreamController=new D(this,h,S)),this.subtitleTrackController=this.createController(n.subtitleTrackController,x);const P=n.subtitleStreamController;P&&x.push(this.subtititleStreamController=new P(this,h,S)),this.createController(n.timelineController,I),S.emeController=this.emeController=this.createController(n.emeController,I),this.cmcdController=this.createController(n.cmcdController,I),this.latencyController=this.createController(il,I),this.coreComponents=I,x.push(u);const O=u.onErrorOut;"function"==typeof O&&this.on(l.ERROR,O,u),this.on(l.MANIFEST_LOADED,m.onManifestLoaded,m)}createController(e,t){if(e){const n=new e(this);return t&&t.push(n),n}return null}on(e,t,n=this){this._emitter.on(e,t,n)}once(e,t,n=this){this._emitter.once(e,t,n)}removeAllListeners(e){this._emitter.removeAllListeners(e)}off(e,t,n=this,i){this._emitter.off(e,t,n,i)}listeners(e){return this._emitter.listeners(e)}emit(e,t,n){return this._emitter.emit(e,t,n)}trigger(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(t){if(this.logger.error("An internal error happened while handling event "+e+'. Error message: "'+t.message+'". Here is a stacktrace:',t),!this.triggeringException){this.triggeringException=!0;const n=e===l.ERROR;this.trigger(l.ERROR,{type:a.OTHER_ERROR,details:o.INTERNAL_EXCEPTION,fatal:n,event:e,error:t}),this.triggeringException=!1}}return!1}listenerCount(e){return this._emitter.listenerCount(e)}destroy(){this.logger.log("destroy"),this.trigger(l.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this._url=null,this.networkControllers.forEach((e=>e.destroy())),this.networkControllers.length=0,this.coreComponents.forEach((e=>e.destroy())),this.coreComponents.length=0;const e=this.config;e.xhrSetup=e.fetchSetup=void 0,this.userConfig=null}attachMedia(e){if(!e||"media"in e&&!e.media){const t=new Error(`attachMedia failed: invalid argument (${e})`);return void this.trigger(l.ERROR,{type:a.OTHER_ERROR,details:o.ATTACH_MEDIA_ERROR,fatal:!0,error:t})}this.logger.log("attachMedia"),this._media&&(this.logger.warn("media must be detached before attaching"),this.detachMedia());const t="media"in e,n=t?e.media:e,i=t?e:{media:n};this._media=n,this.trigger(l.MEDIA_ATTACHING,i)}detachMedia(){this.logger.log("detachMedia"),this.trigger(l.MEDIA_DETACHING,{}),this._media=null}transferMedia(){this._media=null;const e=this.bufferController.transferMedia();return this.trigger(l.MEDIA_DETACHING,{transferMedia:e}),e}loadSource(e){this.stopLoad();const t=this.media,n=this._url,i=this._url=G.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.logger.log(`loadSource:${i}`),t&&n&&(n!==i||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(l.MANIFEST_LOADING,{url:e})}get url(){return this._url}get hasEnoughToStart(){return this.streamController.hasEnoughToStart}get startPosition(){return this.streamController.startPositionValue}startLoad(e=-1,t){this.logger.log(`startLoad(${e+(t?", <skip seek to start>":"")})`),this.started=!0,this.resumeBuffering();for(let n=0;n<this.networkControllers.length&&(this.networkControllers[n].startLoad(e,t),this.started&&this.networkControllers);n++);}stopLoad(){this.logger.log("stopLoad"),this.started=!1;for(let e=0;e<this.networkControllers.length&&(this.networkControllers[e].stopLoad(),!this.started&&this.networkControllers);e++);}get loadingEnabled(){return this.started}get bufferingEnabled(){return this.streamController.bufferingEnabled}resumeBuffering(){this.bufferingEnabled||(this.logger.log("resume buffering"),this.networkControllers.forEach((e=>{e.resumeBuffering&&e.resumeBuffering()})))}pauseBuffering(){this.bufferingEnabled&&(this.logger.log("pause buffering"),this.networkControllers.forEach((e=>{e.pauseBuffering&&e.pauseBuffering()})))}get inFlightFragments(){const e={[f]:this.streamController.inFlightFrag};return this.audioStreamController&&(e[p]=this.audioStreamController.inFlightFrag),this.subtititleStreamController&&(e[_]=this.subtititleStreamController.inFlightFrag),e}swapAudioCodec(){this.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()}recoverMediaError(){this.logger.log("recoverMediaError");const e=this._media,t=null==e?void 0:e.currentTime;this.detachMedia(),e&&(this.attachMedia(e),t&&this.startLoad(t))}removeLevel(e){this.levelController.removeLevel(e)}get sessionId(){let e=this._sessionId;return e||(e=this._sessionId=function(){try{return crypto.randomUUID()}catch(e){try{const e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.slice(t.lastIndexOf("/")+1)}catch(e){let t=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(e=>{const n=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"==e?n:3&n|8).toString(16)}))}}}()),e}get levels(){const e=this.levelController.levels;return e||[]}get latestLevelDetails(){return this.streamController.getLevelDetails()||null}get loadLevelObj(){return this.levelController.loadLevelObj}get currentLevel(){return this.streamController.currentLevel}set currentLevel(e){this.logger.log(`set currentLevel:${e}`),this.levelController.manualLevel=e,this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(e){this.logger.log(`set nextLevel:${e}`),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(e){this.logger.log(`set loadLevel:${e}`),this.levelController.manualLevel=e}get nextLoadLevel(){return this.levelController.nextLoadLevel}set nextLoadLevel(e){this.levelController.nextLoadLevel=e}get firstLevel(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)}set firstLevel(e){this.logger.log(`set firstLevel:${e}`),this.levelController.firstLevel=e}get startLevel(){const e=this.levelController.startLevel;return-1===e&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:e}set startLevel(e){this.logger.log(`set startLevel:${e}`),-1!==e&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e}get capLevelToPlayerSize(){return this.config.capLevelToPlayerSize}set capLevelToPlayerSize(e){const t=!!e;t!==this.config.capLevelToPlayerSize&&(t?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=t)}get autoLevelCapping(){return this._autoLevelCapping}get bandwidthEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimate():NaN}set bandwidthEstimate(e){this.abrController.resetEstimator(e)}get abrEwmaDefaultEstimate(){const{bwEstimator:e}=this.abrController;return e?e.defaultEstimate:NaN}get ttfbEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimateTTFB():NaN}set autoLevelCapping(e){this._autoLevelCapping!==e&&(this.logger.log(`set autoLevelCapping:${e}`),this._autoLevelCapping=e,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(e){(function(e){return ze.indexOf(e)>-1})(e)&&this._maxHdcpLevel!==e&&(this._maxHdcpLevel=e,this.levelController.checkMaxAutoUpdated())}get autoLevelEnabled(){return-1===this.levelController.manualLevel}get manualLevel(){return this.levelController.manualLevel}get minAutoLevel(){const{levels:e,config:{minAutoBitrate:t}}=this;if(!e)return 0;const n=e.length;for(let i=0;i<n;i++)if(e[i].maxBitrate>=t)return i;return 0}get maxAutoLevel(){const{levels:e,autoLevelCapping:t,maxHdcpLevel:n}=this;let i;if(i=-1===t&&null!=e&&e.length?e.length-1:t,n)for(let t=i;t--;){const i=e[t].attrs["HDCP-LEVEL"];if(i&&i<=n)return t}return i}get firstAutoLevel(){return this.abrController.firstAutoLevel}get nextAutoLevel(){return this.abrController.nextAutoLevel}set nextAutoLevel(e){this.abrController.nextAutoLevel=e}get playingDate(){return this.streamController.currentProgramDateTime}get mainForwardBufferInfo(){return this.streamController.getMainFwdBufferInfo()}get maxBufferLength(){return this.streamController.maxBufferLength}setAudioOption(e){var t;return(null==(t=this.audioTrackController)?void 0:t.setAudioOption(e))||null}setSubtitleOption(e){var t;return(null==(t=this.subtitleTrackController)?void 0:t.setSubtitleOption(e))||null}get allAudioTracks(){const e=this.audioTrackController;return e?e.allAudioTracks:[]}get audioTracks(){const e=this.audioTrackController;return e?e.audioTracks:[]}get audioTrack(){const e=this.audioTrackController;return e?e.audioTrack:-1}set audioTrack(e){const t=this.audioTrackController;t&&(t.audioTrack=e)}get allSubtitleTracks(){const e=this.subtitleTrackController;return e?e.allSubtitleTracks:[]}get subtitleTracks(){const e=this.subtitleTrackController;return e?e.subtitleTracks:[]}get subtitleTrack(){const e=this.subtitleTrackController;return e?e.subtitleTrack:-1}get media(){return this._media}set subtitleTrack(e){const t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}get subtitleDisplay(){const e=this.subtitleTrackController;return!!e&&e.subtitleDisplay}set subtitleDisplay(e){const t=this.subtitleTrackController;t&&(t.subtitleDisplay=e)}get lowLatencyMode(){return this.config.lowLatencyMode}set lowLatencyMode(e){this.config.lowLatencyMode=e}get liveSyncPosition(){return this.latencyController.liveSyncPosition}get latency(){return this.latencyController.latency}get maxLatency(){return this.latencyController.maxLatency}get targetLatency(){return this.latencyController.targetLatency}set targetLatency(e){this.latencyController.targetLatency=e}get drift(){return this.latencyController.drift}get forceStartLoad(){return this.streamController.forceStartLoad}get pathways(){return this.levelController.pathways}get pathwayPriority(){return this.levelController.pathwayPriority}set pathwayPriority(e){this.levelController.pathwayPriority=e}get bufferedToEnd(){var e;return!(null==(e=this.bufferController)||!e.bufferedToEnd)}get interstitialsManager(){var e;return(null==(e=this.interstitialsController)?void 0:e.interstitialsManager)||null}getMediaDecodingInfo(e,t=this.allAudioTracks){return Ve(e,st(t),navigator.mediaCapabilities)}}pl.defaultConfig=void 0}}]); |