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.
91 lines
540 KiB
91 lines
540 KiB
(window.webpackJsonp=window.webpackJsonp||[]).push([[99,5,7,8],{"+92d":function(Me,he,B){Me.exports=B.p+"static/b1.8d46544a.svg"},"+ua5":function(Me,he,B){},"55Ip":function(Me,he,B){"use strict";B.d(he,"a",function(){return o});var Y=B("Ty5D"),M=B("dI71"),S=B("cDcd"),I=B.n(S),D=B("YS25"),E=B("17x9"),L=B.n(E),R=B("wx14"),_=B("zLVn"),C=B("9R94"),y=function(r){Object(M.a)(e,r);function e(){for(var c,h=arguments.length,u=new Array(h),b=0;b<h;b++)u[b]=arguments[b];return c=r.call.apply(r,[this].concat(u))||this,c.history=Object(D.a)(c.props),c}var n=e.prototype;return n.render=function(){return I.a.createElement(Y.c,{history:this.history,children:this.props.children})},e}(I.a.Component),T=function(r){Object(M.a)(e,r);function e(){for(var c,h=arguments.length,u=new Array(h),b=0;b<h;b++)u[b]=arguments[b];return c=r.call.apply(r,[this].concat(u))||this,c.history=Object(D.b)(c.props),c}var n=e.prototype;return n.render=function(){return I.a.createElement(Y.c,{history:this.history,children:this.props.children})},e}(I.a.Component),O=function(e,n){return typeof e=="function"?e(n):e},x=function(e,n){return typeof e=="string"?Object(D.c)(e,null,null,n):e},v=function(e){return e},g=I.a.forwardRef;typeof g=="undefined"&&(g=v);function d(r){return!!(r.metaKey||r.altKey||r.ctrlKey||r.shiftKey)}var t=g(function(r,e){var n=r.innerRef,c=r.navigate,h=r.onClick,u=Object(_.a)(r,["innerRef","navigate","onClick"]),b=u.target,A=Object(R.a)({},u,{onClick:function(w){try{h&&h(w)}catch(U){throw w.preventDefault(),U}!w.defaultPrevented&&w.button===0&&(!b||b==="_self")&&!d(w)&&(w.preventDefault(),c())}});return v!==g?A.ref=e||n:A.ref=n,I.a.createElement("a",A)}),o=g(function(r,e){var n=r.component,c=n===void 0?t:n,h=r.replace,u=r.to,b=r.innerRef,A=Object(_.a)(r,["component","replace","to","innerRef"]);return I.a.createElement(Y.e.Consumer,null,function(P){P||Object(C.a)(!1);var w=P.history,U=x(O(u,P.location),P.location),N=U?w.createHref(U):"",F=Object(R.a)({},A,{href:N,navigate:function(){var $=O(u,P.location),X=h?w.replace:w.push;X($)}});return v!==g?F.ref=e||b:F.innerRef=b,I.a.createElement(c,F)})});if(!1)var i,p;var f=function(e){return e},s=I.a.forwardRef;typeof s=="undefined"&&(s=f);function m(){for(var r=arguments.length,e=new Array(r),n=0;n<r;n++)e[n]=arguments[n];return e.filter(function(c){return c}).join(" ")}var l=s(function(r,e){var n=r["aria-current"],c=n===void 0?"page":n,h=r.activeClassName,u=h===void 0?"active":h,b=r.activeStyle,A=r.className,P=r.exact,w=r.isActive,U=r.location,N=r.sensitive,F=r.strict,K=r.style,$=r.to,X=r.innerRef,oe=Object(_.a)(r,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return I.a.createElement(Y.e.Consumer,null,function(pe){pe||Object(C.a)(!1);var ee=U||pe.location,de=x(O($,ee),ee),le=de.pathname,re=le&&le.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),te=re?Object(Y.f)(ee.pathname,{path:re,exact:P,sensitive:N,strict:F}):null,Te=!!(w?w(te,ee):te),Ie=Te?m(A,u):A,Ae=Te?Object(R.a)({},K,{},b):K,De=Object(R.a)({"aria-current":Te&&c||null,className:Ie,style:Ae,to:de},oe);return f!==s?De.ref=e||X:De.innerRef=X,I.a.createElement(o,De)})});if(!1)var a},"6+eU":function(Me,he,B){"use strict";B.d(he,"a",function(){return s});var Y=B("wx14"),M=B("rePB"),S=B("VTBJ"),I=B("1OyB"),D=B("vuIU"),E=B("Ji7U"),L=B("LK+K"),R=B("cDcd"),_=B.n(R),C=B("TSYQ"),y=B.n(C),T=function(l){var a,r="".concat(l.rootPrefixCls,"-item"),e=y()(r,"".concat(r,"-").concat(l.page),(a={},Object(M.a)(a,"".concat(r,"-active"),l.active),Object(M.a)(a,l.className,!!l.className),Object(M.a)(a,"".concat(r,"-disabled"),!l.page),a)),n=function(){l.onClick(l.page)},c=function(u){l.onKeyPress(u,l.onClick,l.page)};return _.a.createElement("li",{title:l.showTitle?l.page:null,className:e,onClick:n,onKeyPress:c,tabIndex:"0"},l.itemRender(l.page,"page",_.a.createElement("a",{rel:"nofollow"},l.page)))},O=T,x={ZERO:48,NINE:57,NUMPAD_ZERO:96,NUMPAD_NINE:105,BACKSPACE:8,DELETE:46,ENTER:13,ARROW_UP:38,ARROW_DOWN:40},v=function(m){Object(E.a)(a,m);var l=Object(L.a)(a);function a(){var r;Object(I.a)(this,a);for(var e=arguments.length,n=new Array(e),c=0;c<e;c++)n[c]=arguments[c];return r=l.call.apply(l,[this].concat(n)),r.state={goInputText:""},r.buildOptionText=function(h){return"".concat(h," ").concat(r.props.locale.items_per_page)},r.changeSize=function(h){r.props.changeSize(Number(h))},r.handleChange=function(h){r.setState({goInputText:h.target.value})},r.handleBlur=function(h){var u=r.props,b=u.goButton,A=u.quickGo,P=u.rootPrefixCls,w=r.state.goInputText;if(b||w==="")return;if(h.relatedTarget&&(h.relatedTarget.className.indexOf("".concat(P,"-prev"))>=0||h.relatedTarget.className.indexOf("".concat(P,"-next"))>=0))return;r.setState({goInputText:""}),A(r.getValidValue())},r.go=function(h){var u=r.state.goInputText;if(u==="")return;(h.keyCode===x.ENTER||h.type==="click")&&(r.setState({goInputText:""}),r.props.quickGo(r.getValidValue()))},r}return Object(D.a)(a,[{key:"getValidValue",value:function(){var e=this.state,n=e.goInputText,c=e.current;return!n||isNaN(n)?c:Number(n)}},{key:"getPageSizeOptions",value:function(){var e=this.props,n=e.pageSize,c=e.pageSizeOptions;return c.some(function(h){return h.toString()===n.toString()})?c:c.concat([n.toString()]).sort(function(h,u){var b=isNaN(Number(h))?0:Number(h),A=isNaN(Number(u))?0:Number(u);return b-A})}},{key:"render",value:function(){var e=this,n=this.props,c=n.pageSize,h=n.locale,u=n.rootPrefixCls,b=n.changeSize,A=n.quickGo,P=n.goButton,w=n.selectComponentClass,U=n.buildOptionText,N=n.selectPrefixCls,F=n.disabled,K=this.state.goInputText,$="".concat(u,"-options"),X=w,oe=null,pe=null,ee=null;if(!b&&!A)return null;var de=this.getPageSizeOptions();if(b&&X){var le=de.map(function(re,te){return _.a.createElement(X.Option,{key:te,value:re.toString()},(U||e.buildOptionText)(re))});oe=_.a.createElement(X,{disabled:F,prefixCls:N,showSearch:!1,className:"".concat($,"-size-changer"),optionLabelProp:"children",dropdownMatchSelectWidth:!1,value:(c||de[0]).toString(),onChange:this.changeSize,getPopupContainer:function(te){return te.parentNode}},le)}return A&&(P&&(ee=typeof P=="boolean"?_.a.createElement("button",{type:"button",onClick:this.go,onKeyUp:this.go,disabled:F,className:"".concat($,"-quick-jumper-button")},h.jump_to_confirm):_.a.createElement("span",{onClick:this.go,onKeyUp:this.go},P)),pe=_.a.createElement("div",{className:"".concat($,"-quick-jumper")},h.jump_to,_.a.createElement("input",{disabled:F,type:"text",value:K,onChange:this.handleChange,onKeyUp:this.go,onBlur:this.handleBlur}),h.page,ee)),_.a.createElement("li",{className:"".concat($)},oe,pe)}}]),a}(_.a.Component);v.defaultProps={pageSizeOptions:["10","20","50","100"]};var g=v,d=B("N2Kk");function t(){}function o(m){return typeof m=="number"&&isFinite(m)&&Math.floor(m)===m}function i(m,l,a){return a}function p(m,l,a){var r=typeof m=="undefined"?l.pageSize:m;return Math.floor((a.total-1)/r)+1}var f=function(m){Object(E.a)(a,m);var l=Object(L.a)(a);function a(r){var e;Object(I.a)(this,a),e=l.call(this,r),e.getJumpPrevPage=function(){return Math.max(1,e.state.current-(e.props.showLessItems?3:5))},e.getJumpNextPage=function(){return Math.min(p(void 0,e.state,e.props),e.state.current+(e.props.showLessItems?3:5))},e.getItemIcon=function(b,A){var P=e.props.prefixCls,w=b||_.a.createElement("button",{type:"button","aria-label":A,className:"".concat(P,"-item-link")});return typeof b=="function"&&(w=_.a.createElement(b,Object(S.a)({},e.props))),w},e.savePaginationNode=function(b){e.paginationNode=b},e.isValid=function(b){return o(b)&&b!==e.state.current},e.shouldDisplayQuickJumper=function(){var b=e.props,A=b.showQuickJumper,P=b.pageSize,w=b.total;return w<=P?!1:A},e.handleKeyDown=function(b){(b.keyCode===x.ARROW_UP||b.keyCode===x.ARROW_DOWN)&&b.preventDefault()},e.handleKeyUp=function(b){var A=e.getValidValue(b),P=e.state.currentInputValue;A!==P&&e.setState({currentInputValue:A}),b.keyCode===x.ENTER?e.handleChange(A):b.keyCode===x.ARROW_UP?e.handleChange(A-1):b.keyCode===x.ARROW_DOWN&&e.handleChange(A+1)},e.changePageSize=function(b){var A=e.state.current,P=p(b,e.state,e.props);A=A>P?P:A,P===0&&(A=e.state.current),typeof b=="number"&&("pageSize"in e.props||e.setState({pageSize:b}),"current"in e.props||e.setState({current:A,currentInputValue:A})),e.props.onShowSizeChange(A,b),"onChange"in e.props&&e.props.onChange&&e.props.onChange(A,b)},e.handleChange=function(b){var A=e.props.disabled,P=b;if(e.isValid(P)&&!A){var w=p(void 0,e.state,e.props);P>w?P=w:P<1&&(P=1),"current"in e.props||e.setState({current:P,currentInputValue:P});var U=e.state.pageSize;return e.props.onChange(P,U),P}return e.state.current},e.prev=function(){e.hasPrev()&&e.handleChange(e.state.current-1)},e.next=function(){e.hasNext()&&e.handleChange(e.state.current+1)},e.jumpPrev=function(){e.handleChange(e.getJumpPrevPage())},e.jumpNext=function(){e.handleChange(e.getJumpNextPage())},e.hasPrev=function(){return e.state.current>1},e.hasNext=function(){return e.state.current<p(void 0,e.state,e.props)},e.runIfEnter=function(b,A){if(b.key==="Enter"||b.charCode===13){for(var P=arguments.length,w=new Array(P>2?P-2:0),U=2;U<P;U++)w[U-2]=arguments[U];A.apply(void 0,w)}},e.runIfEnterPrev=function(b){e.runIfEnter(b,e.prev)},e.runIfEnterNext=function(b){e.runIfEnter(b,e.next)},e.runIfEnterJumpPrev=function(b){e.runIfEnter(b,e.jumpPrev)},e.runIfEnterJumpNext=function(b){e.runIfEnter(b,e.jumpNext)},e.handleGoTO=function(b){(b.keyCode===x.ENTER||b.type==="click")&&e.handleChange(e.state.currentInputValue)};var n=r.onChange!==t,c="current"in r;c&&!n&&console.warn("Warning: You provided a `current` prop to a Pagination component without an `onChange` handler. This will render a read-only component.");var h=r.defaultCurrent;"current"in r&&(h=r.current);var u=r.defaultPageSize;return"pageSize"in r&&(u=r.pageSize),h=Math.min(h,p(u,void 0,r)),e.state={current:h,currentInputValue:h,pageSize:u},e}return Object(D.a)(a,[{key:"componentDidUpdate",value:function(e,n){var c=this.props.prefixCls;if(n.current!==this.state.current&&this.paginationNode){var h=this.paginationNode.querySelector(".".concat(c,"-item-").concat(n.current));h&&document.activeElement===h&&h.blur()}}},{key:"getValidValue",value:function(e){var n=e.target.value,c=p(void 0,this.state,this.props),h=this.state.currentInputValue,u;return n===""?u=n:isNaN(Number(n))?u=h:n>=c?u=c:u=Number(n),u}},{key:"getShowSizeChanger",value:function(){var e=this.props,n=e.showSizeChanger,c=e.total,h=e.totalBoundaryShowSizeChanger;return typeof n!="undefined"?n:c>h}},{key:"renderPrev",value:function(e){var n=this.props,c=n.prevIcon,h=n.itemRender,u=h(e,"prev",this.getItemIcon(c,"prev page")),b=!this.hasPrev();return Object(R.isValidElement)(u)?Object(R.cloneElement)(u,{disabled:b}):u}},{key:"renderNext",value:function(e){var n=this.props,c=n.nextIcon,h=n.itemRender,u=h(e,"next",this.getItemIcon(c,"next page")),b=!this.hasNext();return Object(R.isValidElement)(u)?Object(R.cloneElement)(u,{disabled:b}):u}},{key:"render",value:function(){var e=this,n=this.props,c=n.prefixCls,h=n.className,u=n.style,b=n.disabled,A=n.hideOnSinglePage,P=n.total,w=n.locale,U=n.showQuickJumper,N=n.showLessItems,F=n.showTitle,K=n.showTotal,$=n.simple,X=n.itemRender,oe=n.showPrevNextJumpers,pe=n.jumpPrevIcon,ee=n.jumpNextIcon,de=n.selectComponentClass,le=n.selectPrefixCls,re=n.pageSizeOptions,te=this.state,Te=te.current,Ie=te.pageSize,Ae=te.currentInputValue;if(A===!0&&P<=Ie)return null;var De=p(void 0,this.state,this.props),fe=[],ye=null,xe=null,be=null,ie=null,Se=null,ge=U&&U.goButton,me=N?1:2,Ce=Te-1>0?Te-1:0,Le=Te+1<De?Te+1:De,_e=Object.keys(this.props).reduce(function(k,j){return(j.substr(0,5)==="data-"||j.substr(0,5)==="aria-"||j==="role")&&(k[j]=e.props[j]),k},{});if($)return ge&&(typeof ge=="boolean"?Se=_.a.createElement("button",{type:"button",onClick:this.handleGoTO,onKeyUp:this.handleGoTO},w.jump_to_confirm):Se=_.a.createElement("span",{onClick:this.handleGoTO,onKeyUp:this.handleGoTO},ge),Se=_.a.createElement("li",{title:F?"".concat(w.jump_to).concat(Te,"/").concat(De):null,className:"".concat(c,"-simple-pager")},Se)),_.a.createElement("ul",Object(Y.a)({className:y()(c,"".concat(c,"-simple"),Object(M.a)({},"".concat(c,"-disabled"),b),h),style:u,ref:this.savePaginationNode},_e),_.a.createElement("li",{title:F?w.prev_page:null,onClick:this.prev,tabIndex:this.hasPrev()?0:null,onKeyPress:this.runIfEnterPrev,className:y()("".concat(c,"-prev"),Object(M.a)({},"".concat(c,"-disabled"),!this.hasPrev())),"aria-disabled":!this.hasPrev()},this.renderPrev(Ce)),_.a.createElement("li",{title:F?"".concat(Te,"/").concat(De):null,className:"".concat(c,"-simple-pager")},_.a.createElement("input",{type:"text",value:Ae,disabled:b,onKeyDown:this.handleKeyDown,onKeyUp:this.handleKeyUp,onChange:this.handleKeyUp,size:"3"}),_.a.createElement("span",{className:"".concat(c,"-slash")},"/"),De),_.a.createElement("li",{title:F?w.next_page:null,onClick:this.next,tabIndex:this.hasPrev()?0:null,onKeyPress:this.runIfEnterNext,className:y()("".concat(c,"-next"),Object(M.a)({},"".concat(c,"-disabled"),!this.hasNext())),"aria-disabled":!this.hasNext()},this.renderNext(Le)),Se);if(De<=3+me*2){var Re={locale:w,rootPrefixCls:c,onClick:this.handleChange,onKeyPress:this.runIfEnter,showTitle:F,itemRender:X};De||fe.push(_.a.createElement(O,Object(Y.a)({},Re,{key:"noPager",page:De,className:"".concat(c,"-disabled")})));for(var Pe=1;Pe<=De;Pe+=1){var we=Te===Pe;fe.push(_.a.createElement(O,Object(Y.a)({},Re,{key:Pe,page:Pe,active:we})))}}else{var J=N?w.prev_3:w.prev_5,q=N?w.next_3:w.next_5;oe&&(ye=_.a.createElement("li",{title:F?J:null,key:"prev",onClick:this.jumpPrev,tabIndex:"0",onKeyPress:this.runIfEnterJumpPrev,className:y()("".concat(c,"-jump-prev"),Object(M.a)({},"".concat(c,"-jump-prev-custom-icon"),!!pe))},X(this.getJumpPrevPage(),"jump-prev",this.getItemIcon(pe,"prev page"))),xe=_.a.createElement("li",{title:F?q:null,key:"next",tabIndex:"0",onClick:this.jumpNext,onKeyPress:this.runIfEnterJumpNext,className:y()("".concat(c,"-jump-next"),Object(M.a)({},"".concat(c,"-jump-next-custom-icon"),!!ee))},X(this.getJumpNextPage(),"jump-next",this.getItemIcon(ee,"next page")))),ie=_.a.createElement(O,{locale:w,last:!0,rootPrefixCls:c,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:De,page:De,active:!1,showTitle:F,itemRender:X}),be=_.a.createElement(O,{locale:w,rootPrefixCls:c,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:1,page:1,active:!1,showTitle:F,itemRender:X});var se=Math.max(1,Te-me),ce=Math.min(Te+me,De);Te-1<=me&&(ce=1+me*2),De-Te<=me&&(se=De-me*2);for(var Z=se;Z<=ce;Z+=1){var ue=Te===Z;fe.push(_.a.createElement(O,{locale:w,rootPrefixCls:c,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:Z,page:Z,active:ue,showTitle:F,itemRender:X}))}Te-1>=me*2&&Te!==1+2&&(fe[0]=Object(R.cloneElement)(fe[0],{className:"".concat(c,"-item-after-jump-prev")}),fe.unshift(ye)),De-Te>=me*2&&Te!==De-2&&(fe[fe.length-1]=Object(R.cloneElement)(fe[fe.length-1],{className:"".concat(c,"-item-before-jump-next")}),fe.push(xe)),se!==1&&fe.unshift(be),ce!==De&&fe.push(ie)}var V=null;K&&(V=_.a.createElement("li",{className:"".concat(c,"-total-text")},K(P,[P===0?0:(Te-1)*Ie+1,Te*Ie>P?P:Te*Ie])));var G=!this.hasPrev()||!De,H=!this.hasNext()||!De;return _.a.createElement("ul",Object(Y.a)({className:y()(c,h,Object(M.a)({},"".concat(c,"-disabled"),b)),style:u,unselectable:"unselectable",ref:this.savePaginationNode},_e),V,_.a.createElement("li",{title:F?w.prev_page:null,onClick:this.prev,tabIndex:G?null:0,onKeyPress:this.runIfEnterPrev,className:y()("".concat(c,"-prev"),Object(M.a)({},"".concat(c,"-disabled"),G)),"aria-disabled":G},this.renderPrev(Ce)),fe,_.a.createElement("li",{title:F?w.next_page:null,onClick:this.next,tabIndex:H?null:0,onKeyPress:this.runIfEnterNext,className:y()("".concat(c,"-next"),Object(M.a)({},"".concat(c,"-disabled"),H)),"aria-disabled":H},this.renderNext(Le)),_.a.createElement(g,{disabled:b,locale:w,rootPrefixCls:c,selectComponentClass:de,selectPrefixCls:le,changeSize:this.getShowSizeChanger()?this.changePageSize:null,current:Te,pageSize:Ie,pageSizeOptions:re,quickGo:this.shouldDisplayQuickJumper()?this.handleChange:null,goButton:ge}))}}],[{key:"getDerivedStateFromProps",value:function(e,n){var c={};if("current"in e&&(c.current=e.current,e.current!==n.current&&(c.currentInputValue=c.current)),"pageSize"in e&&e.pageSize!==n.pageSize){var h=n.current,u=p(e.pageSize,n,e);h=h>u?u:h,"current"in e||(c.current=h,c.currentInputValue=h),c.pageSize=e.pageSize}return c}}]),a}(_.a.Component);f.defaultProps={defaultCurrent:1,total:0,defaultPageSize:10,onChange:t,className:"",selectPrefixCls:"rc-select",prefixCls:"rc-pagination",selectComponentClass:null,hideOnSinglePage:!1,showPrevNextJumpers:!0,showQuickJumper:!1,showLessItems:!1,showTitle:!0,onShowSizeChange:t,locale:d.a,style:{},itemRender:i,totalBoundaryShowSizeChanger:50};var s=f},"6RRn":function(Me,he,B){"use strict";var Y=B("wCXF"),M=B("n6Qo");B.d(he,"b",function(){return M.a});var S=B("IBYe"),I=B("6eGT"),D=B("hW8S");B.d(he,"a",function(){return D.a}),he.c=Y.b},"6eGT":function(Me,he,B){"use strict";function Y(M){return null}he.a=Y},"815F":function(Me,he,B){"use strict";B.d(he,"e",function(){return L}),B.d(he,"c",function(){return _}),B.d(he,"d",function(){return C}),B.d(he,"a",function(){return T}),B.d(he,"f",function(){return O}),B.d(he,"b",function(){return x});var Y=B("KQm4"),M=B("VTBJ"),S=B("Ff2n"),I=B("Zm9Q"),D=B("Kwbf"),E=B("OZM5");function L(v,g){return v!=null?v:g}function R(){var v=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],g=new Map;function d(t){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";(t||[]).forEach(function(i){var p=i.key,f=i.children;Object(D.a)(p!=null,"Tree node must have a certain key: [".concat(o).concat(p,"]"));var s=String(p);Object(D.a)(!g.has(s)||p===null||p===void 0,"Same 'key' exist in the Tree: ".concat(s)),g.set(s,!0),d(f,"".concat(o).concat(s," > "))})}d(v)}function _(v){function g(d){var t=Object(I.a)(d);return t.map(function(o){if(!Object(E.i)(o))return Object(D.a)(!o,"Tree/TreeNode can only accept TreeNode as children."),null;var i=o.key,p=o.props,f=p.children,s=Object(S.a)(p,["children"]),m=Object(M.a)({key:i},s),l=g(f);return l.length&&(m.children=l),m}).filter(function(o){return o})}return g(v)}function C(){var v=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],d=new Set(g===!0?[]:g),t=[];function o(i){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return i.map(function(f,s){var m=Object(E.h)(p?p.pos:"0",s),l=L(f.key,m),a=Object(M.a)(Object(M.a)({},f),{},{parent:p,pos:m,children:null,data:f,isStart:[].concat(Object(Y.a)(p?p.isStart:[]),[s===0]),isEnd:[].concat(Object(Y.a)(p?p.isEnd:[]),[s===i.length-1])});return t.push(a),g===!0||d.has(l)?a.children=o(f.children||[],a):a.children=[],a})}return o(v),t}function y(v,g,d){var t;d?typeof d=="string"?t=function(p){return p[d]}:typeof d=="function"&&(t=function(p){return d(p)}):t=function(p,f){return L(p.key,f)};function o(i,p,f){var s=i?i.children:v,m=i?Object(E.h)(f.pos,p):"0";if(i){var l=t(i,m),a={node:i,index:p,pos:m,key:l,parentPos:f.node?f.pos:null,level:f.level+1};g(a)}s&&s.forEach(function(r,e){o(r,e,{node:i,pos:m,level:f?f.level+1:-1})})}o(null)}function T(v){var g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},d=g.initWrapper,t=g.processEntity,o=g.onProcessFinished,i=arguments.length>2?arguments[2]:void 0,p={},f={},s={posEntities:p,keyEntities:f};return d&&(s=d(s)||s),y(v,function(m){var l=m.node,a=m.index,r=m.pos,e=m.key,n=m.parentPos,c=m.level,h={node:l,index:a,key:e,pos:r,level:c},u=L(e,r);p[r]=h,f[u]=h,h.parent=p[n],h.parent&&(h.parent.children=h.parent.children||[],h.parent.children.push(h)),t&&t(h,s)},i),o&&o(s),s}function O(v,g){var d=g.expandedKeys,t=g.selectedKeys,o=g.loadedKeys,i=g.loadingKeys,p=g.checkedKeys,f=g.halfCheckedKeys,s=g.dragOverNodeKey,m=g.dropPosition,l=g.keyEntities,a=l[v],r={eventKey:v,expanded:d.indexOf(v)!==-1,selected:t.indexOf(v)!==-1,loaded:o.indexOf(v)!==-1,loading:i.indexOf(v)!==-1,checked:p.indexOf(v)!==-1,halfChecked:f.indexOf(v)!==-1,pos:String(a?a.pos:""),dragOver:s===v&&m===0,dragOverGapTop:s===v&&m===-1,dragOverGapBottom:s===v&&m===1};return r}function x(v){var g=v.data,d=v.expanded,t=v.selected,o=v.checked,i=v.loaded,p=v.loading,f=v.halfChecked,s=v.dragOver,m=v.dragOverGapTop,l=v.dragOverGapBottom,a=v.pos,r=v.active,e=Object(M.a)(Object(M.a)({},g),{},{expanded:d,selected:t,checked:o,loaded:i,loading:p,halfChecked:f,dragOver:s,dragOverGapTop:m,dragOverGapBottom:l,pos:a,active:r});return"props"in e||Object.defineProperty(e,"props",{get:function(){return Object(D.a)(!1,"Second param return from event is node data instead of TreeNode instance. Please read value directly instead of reading from `props`."),v}}),e}},"8hTe":function(Me,he,B){Me.exports={button:"button___1wy9m"}},"9Bee":function(Me,he,B){"use strict";var Y=B("DYRE"),M=B("zeV3"),S=B("+L6B"),I=B("2/Rp"),D=B("k1fw"),E=B("tJVT"),L=B("cDcd"),R=B.n(L),_=B("vg9a"),C=B("DlQD"),y=B.n(C),T=B("rUJ1");function O(ee,de){var le=ee.match(/^(\s+)(?:```)/);if(le===null)return de;var re=le[1];return de.split(`
|
|
`).map(function(te){var Te=te.match(/^\s+/);if(Te===null)return te;var Ie=Object(E.a)(Te,1),Ae=Ie[0];return Ae.length>=re.length?te.slice(re.length):te}).join(`
|
|
`)}var x=[],v=["<ul>"],g=new y.a.Renderer,d=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function t(){x.length=0,v=["<ul>"]}var o={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function i(ee,de,le,re){if(de>=ee.length||ee[de].level<=le)return de;var te=ee[de];re.push("<li><a href='#"+te.anchor+"'>"+te.text+"</a>"),de++;var Te=[];return de=i(ee,de,te.level,Te),Te.length>0&&(re.push("<ul>"),Te.forEach(function(Ie){re.push(Ie)}),re.push("</ul>")),re.push("</li>"),de=i(ee,de,le,re),de}function p(){return i(x,0,0,v),v.push("</ul>"),v.join("")}var f={heading:function(de){var le=d.exec(de);if(le)return{type:"heading",raw:le[0],depth:le[1].length,text:le[2]}},fences:function(de){var le=this.rules.block.fences.exec(de);if(le){var re=le[0],te=O(re,le[3]||""),Te=le[2]?le[2].trim():le[2];if(["latex","katex","math"].indexOf(Te)>=0){var Ie=l(),Ae=te;te=Ie,a[Ie]={type:"block",expression:Ae}}return{type:"code",raw:re,lang:Te,text:te}}}},s=/(?:\${2})([^\n`]+?)(?:\${2})/gi,m=0,l=function(){return"__special_katext_id_".concat(m++,"__")},a={};function r(){return a}function e(){m=0,a={}}function n(ee){return ee=ee.replace(s,function(de,le){var re=l();return a[re]={type:"inline",expression:le},re}),ee}var c=g.listitem;g.listitem=function(ee){return c(n(ee))};var h=g.paragraph;g.paragraph=function(ee){return h(n(ee))};var u=g.tablecell;g.tablecell=function(ee,de){return u(n(ee),de)},g.code=function(ee,de,le){var re=(de||"").match(/\S*/)[0];return re?["latex","katex","math"].indexOf(re)>=0?"<p class='editormd-tex'>".concat(ee,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(de,'">').concat(le?ee:Object(T.escape)(ee,!0),`</code></pre>
|
|
`):'<pre class="prettyprint linenums"><code>'+(le?ee:Object(T.escape)(ee,!0))+"</code></pre>"},g.heading=function(ee,de,le){var re=this.options.headerPrefix+le.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return x.push({anchor:re,level:de,text:ee}),"<h"+de+' id="'+re+'">'+ee+"</h"+de+">"},y.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),y.a.use({tokenizer:f,renderer:g});var b=y.a,A=B("SJMd"),P=B("ulZh"),w=B.n(P),U=B("m3rI"),N=B("Oy/b"),F=B("p5ED"),K=B("8hTe"),$=B.n(K),X=/<pre[^>]*>/g;function oe(ee){var de=document.createElement("div");return de.innerHTML=ee,de.childNodes.length===0?"":de.childNodes[0].nodeValue}var pe=he.a=function(ee){var de=ee.value,le=de===void 0?"":de,re=ee.edit,te=re===void 0?!1:re,Te=ee.className,Ie=ee.showTextOnly,Ae=ee.showLines,De=ee.replaces,fe=ee.zoomImg,ye=ee.hasMask,xe=ee.style,be=xe===void 0?{}:xe,ie=ee.stylesPrev,Se=ie===void 0?{}:ie,ge=String(le),me=Object(L.useRef)(),Ce=Object(L.useRef)(),Le=Object(L.useState)(""),_e=Object(E.a)(Le,2),Re=_e[0],Pe=_e[1],we=Object(L.useState)("office"),J=Object(E.a)(we,2),q=J[0],se=J[1],ce=Object(L.useMemo)(function(){try{var H=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,k=/\"\/api\/attachments\/|\"\/attachments\/download\//g,j=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;ge=ge.replace(H,"("+U.a.API_SERVER+"/api/attachments/").replace(k,'"'+U.a.API_SERVER+"/api/attachments/").replace(j,'"'+U.a.API_SERVER+"/files/uploads/").replaceAll("http://video.educoder","https://video.educoder").replaceAll("http://www.educoder.net/api","https://data.educoder.net/api").replaceAll("https://www.educoder.net/api","https://data.educoder.net/api").replace(/\r\n/g,`
|
|
`)}catch(ne){}var W=b(ge),z=r();if(ge.match(/\[TOC\]/)&&(W=W.replace("<p>[TOC]</p>",p()),t()),W=W.replace(/(__special_katext_id_\d+__)/g,function(ne,ae){var ve=z[ae],Oe=ve.type,Ee=ve.expression;return Object(N.renderToString)(oe(Ee)||"",{displayMode:Oe==="block",throwOnError:!1,output:"html"})}),W=W.replace(/▁/g,"\u2581\u2581\u2581"),e(),Ie){var Q=document.createElement("div");return Q.innerHTML=W,Q.innerText}return setTimeout(function(){return V()},500),W},[ge]),Z=Object(L.useRef)();o.WebkitLineClamp=Ae,Ae&&(be=Object(D.a)(Object(D.a)({},be),o));function ue(H){var k=H.target;if(k.tagName.toUpperCase()==="IMG"){if(fe){var j=k.getAttribute("src");Pe(j),se("image")}}else if(k.tagName.toUpperCase()==="A"){var W=k.getAttribute("href");if(W.indexOf("office")>-1)H.preventDefault(),Pe(W),se("office");else if(W.indexOf("application/pdf")>-1)H.preventDefault(),Pe(W),se("pdf");else if(W.indexOf("text/html")>-1)H.preventDefault(),Pe(W),se("html");else if(W.startsWith("#")){H.preventDefault();var z=document.getElementById(W.replace("#",""));z&&z.scrollIntoView(!0)}}}var V=function(){var k,j=(k=Z.current)===null||k===void 0?void 0:k.querySelectorAll("video");j==null||j.forEach(function(W){if(W.oncontextmenu=function(){return!1},W.src.indexOf(".m3u8")>-1&&!W.canPlayType("application/vnd.apple.mpegurl")){if(w.a.isSupported()){var z=new w.a;z.loadSource(W.src),z.attachMedia(W)}}})};Object(L.useEffect)(function(){if(Z.current&&ce&&(ce.match(X)&&window.PR.prettyPrint()),Z.current)return Z.current.addEventListener("click",ue),function(){Z.current.removeEventListener("click",ue),e(),t()}},[ce,Z.current,ue]);var G=function(k){if(!te)return;k.target.nodeName==="IMG"?(me.current.style.display="flex",me.current.style.width=k.target.clientWidth+"px",me.current.style.height=k.target.clientHeight+"px",me.current.style.top=k.target.offsetTop+"px",me.current.style.left=k.target.offsetLeft+"px",Ce.current.src=k.target.getAttribute("src")):me.current.style.display="none"};return R.a.createElement("div",{style:{position:"relative"}},R.a.createElement("div",{ref:Z,style:Object(D.a)({},be),className:"".concat(Te||""," markdown-body ").concat($.a.mdBody),onMouseOver:G,dangerouslySetInnerHTML:{__html:ce}}),R.a.createElement("div",{ref:me,className:$.a.button},R.a.createElement(M.a,null,R.a.createElement(I.a,{onClick:function(){return openCrop()}},"\u88C1\u526A"),R.a.createElement(I.a,{onClick:function(){return openEditor()}},"\u7F16\u8F91"))),R.a.createElement("img",{ref:Ce,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1,top:"-10000px"}}),R.a.createElement(F.a,{close:!0,data:Re,type:Re!=null&&Re.length?q:"",style:Object(D.a)({},Se),onClose:function(){return Pe("")}}))}},BU3w:function(Me,he,B){"use strict";B.d(he,"a",function(){return E});var Y=B("MNnm"),M="rc-util-key";function S(L){if(L.attachTo)return L.attachTo;var R=document.querySelector("head");return R||document.body}function I(L){var R,_=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(Y.a)())return null;var C=document.createElement("style");if((R=_.csp)===null||R===void 0?void 0:R.nonce){var y;C.nonce=(y=_.csp)===null||y===void 0?void 0:y.nonce}C.innerHTML=L;var T=S(_),O=T.firstChild;return _.prepend&&T.prepend?T.prepend(C):_.prepend&&O?T.insertBefore(C,O):T.appendChild(C),C}var D=new Map;function E(L,R){var _=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},C=S(_);if(!D.has(C)){var y=I("",_),T=y.parentNode;D.set(C,T),T.removeChild(y)}var O=Array.from(D.get(C).children).find(function(t){return t.tagName==="STYLE"&&t[M]===R});if(O){var x,v;if(((x=_.csp)===null||x===void 0?void 0:x.nonce)&&O.nonce!==((v=_.csp)===null||v===void 0?void 0:v.nonce)){var g;O.nonce=(g=_.csp)===null||g===void 0?void 0:g.nonce}return O.innerHTML!==L&&(O.innerHTML=L),O}var d=I(L,_);return d[M]=R,d}},DlQD:function(Me,he,B){(function(Y,M){Me.exports=M()})(this,function(){"use strict";function Y(V,G){for(var H=0;H<G.length;H++){var k=G[H];k.enumerable=k.enumerable||!1,k.configurable=!0,"value"in k&&(k.writable=!0),Object.defineProperty(V,k.key,k)}}function M(V,G,H){return G&&Y(V.prototype,G),H&&Y(V,H),V}function S(V,G){if(!V)return;if(typeof V=="string")return I(V,G);var H=Object.prototype.toString.call(V).slice(8,-1);if(H==="Object"&&V.constructor&&(H=V.constructor.name),H==="Map"||H==="Set")return Array.from(V);if(H==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(H))return I(V,G)}function I(V,G){(G==null||G>V.length)&&(G=V.length);for(var H=0,k=new Array(G);H<G;H++)k[H]=V[H];return k}function D(V,G){var H;if(typeof Symbol=="undefined"||V[Symbol.iterator]==null){if(Array.isArray(V)||(H=S(V))||G&&V&&typeof V.length=="number"){H&&(V=H);var k=0;return function(){return k>=V.length?{done:!0}:{done:!1,value:V[k++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}return H=V[Symbol.iterator](),H.next.bind(H)}function E(V,G){return G={exports:{}},V(G,G.exports),G.exports}var L=E(function(V){function G(){return{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}function H(k){V.exports.defaults=k}V.exports={defaults:G(),getDefaults:G,changeDefaults:H}}),R=L.defaults,_=L.getDefaults,C=L.changeDefaults,y=/[&<>"']/,T=/[&<>"']/g,O=/[<>"']|&(?!#?\w+;)/,x=/[<>"']|&(?!#?\w+;)/g,v={"&":"&","<":"<",">":">",'"':""","'":"'"},g=function(G){return v[G]};function d(V,G){if(G){if(y.test(V))return V.replace(T,g)}else if(O.test(V))return V.replace(x,g);return V}var t=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function o(V){return V.replace(t,function(G,H){return H=H.toLowerCase(),H==="colon"?":":H.charAt(0)==="#"?H.charAt(1)==="x"?String.fromCharCode(parseInt(H.substring(2),16)):String.fromCharCode(+H.substring(1)):""})}var i=/(^|[^\[])\^/g;function p(V,G){V=V.source||V,G=G||"";var H={replace:function(j,W){return W=W.source||W,W=W.replace(i,"$1"),V=V.replace(j,W),H},getRegex:function(){return new RegExp(V,G)}};return H}var f=/[^\w:]/g,s=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function m(V,G,H){if(V){var k;try{k=decodeURIComponent(o(H)).replace(f,"").toLowerCase()}catch(j){return null}if(k.indexOf("javascript:")===0||k.indexOf("vbscript:")===0||k.indexOf("data:")===0)return null}G&&!s.test(H)&&(H=n(G,H));try{H=encodeURI(H).replace(/%25/g,"%")}catch(j){return null}return H}var l={},a=/^[^:]+:\/*[^/]*$/,r=/^([^:]+:)[\s\S]*$/,e=/^([^:]+:\/*[^/]*)[\s\S]*$/;function n(V,G){l[" "+V]||(a.test(V)?l[" "+V]=V+"/":l[" "+V]=b(V,"/",!0)),V=l[" "+V];var H=V.indexOf(":")===-1;return G.substring(0,2)==="//"?H?G:V.replace(r,"$1")+G:G.charAt(0)==="/"?H?G:V.replace(e,"$1")+G:V+G}var c={exec:function(){}};function h(V){for(var G=1,H,k;G<arguments.length;G++){H=arguments[G];for(k in H)Object.prototype.hasOwnProperty.call(H,k)&&(V[k]=H[k])}return V}function u(V,G){var H=V.replace(/\|/g,function(W,z,Q){for(var ne=!1,ae=z;--ae>=0&&Q[ae]==="\\";)ne=!ne;return ne?"|":" |"}),k=H.split(/ \|/),j=0;if(k.length>G)k.splice(G);else for(;k.length<G;)k.push("");for(;j<k.length;j++)k[j]=k[j].trim().replace(/\\\|/g,"|");return k}function b(V,G,H){var k=V.length;if(k===0)return"";for(var j=0;j<k;){var W=V.charAt(k-j-1);if(W===G&&!H)j++;else if(W!==G&&H)j++;else break}return V.substr(0,k-j)}function A(V,G){if(V.indexOf(G[1])===-1)return-1;for(var H=V.length,k=0,j=0;j<H;j++)if(V[j]==="\\")j++;else if(V[j]===G[0])k++;else if(V[j]===G[1]&&(k--,k<0))return j;return-1}function P(V){V&&V.sanitize&&!V.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}var w={escape:d,unescape:o,edit:p,cleanUrl:m,resolveUrl:n,noopTest:c,merge:h,splitCells:u,rtrim:b,findClosingBracket:A,checkSanitizeDeprecation:P},U=L.defaults,N=w.rtrim,F=w.splitCells,K=w.escape,$=w.findClosingBracket;function X(V,G,H){var k=G.href,j=G.title?K(G.title):null,W=V[1].replace(/\\([\[\]])/g,"$1");return V[0].charAt(0)!=="!"?{type:"link",raw:H,href:k,title:j,text:W}:{type:"image",raw:H,href:k,title:j,text:K(W)}}function oe(V,G){var H=V.match(/^(\s+)(?:```)/);if(H===null)return G;var k=H[1];return G.split(`
|
|
`).map(function(j){var W=j.match(/^\s+/);if(W===null)return j;var z=W[0];return z.length>=k.length?j.slice(k.length):j}).join(`
|
|
`)}var pe=function(){function V(H){this.options=H||U}var G=V.prototype;return G.space=function(k){var j=this.rules.block.newline.exec(k);if(j)return j[0].length>1?{type:"space",raw:j[0]}:{raw:`
|
|
`}},G.code=function(k,j){var W=this.rules.block.code.exec(k);if(W){var z=j[j.length-1];if(z&&z.type==="paragraph")return{raw:W[0],text:W[0].trimRight()};var Q=W[0].replace(/^ {4}/gm,"");return{type:"code",raw:W[0],codeBlockStyle:"indented",text:this.options.pedantic?Q:N(Q,`
|
|
`)}}},G.fences=function(k){var j=this.rules.block.fences.exec(k);if(j){var W=j[0],z=oe(W,j[3]||"");return{type:"code",raw:W,lang:j[2]?j[2].trim():j[2],text:z}}},G.heading=function(k){var j=this.rules.block.heading.exec(k);if(j)return{type:"heading",raw:j[0],depth:j[1].length,text:j[2]}},G.nptable=function(k){var j=this.rules.block.nptable.exec(k);if(j){var W={type:"table",header:F(j[1].replace(/^ *| *\| *$/g,"")),align:j[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:j[3]?j[3].replace(/\n$/,"").split(`
|
|
`):[],raw:j[0]};if(W.header.length===W.align.length){var z=W.align.length,Q;for(Q=0;Q<z;Q++)/^ *-+: *$/.test(W.align[Q])?W.align[Q]="right":/^ *:-+: *$/.test(W.align[Q])?W.align[Q]="center":/^ *:-+ *$/.test(W.align[Q])?W.align[Q]="left":W.align[Q]=null;for(z=W.cells.length,Q=0;Q<z;Q++)W.cells[Q]=F(W.cells[Q],W.header.length);return W}}},G.hr=function(k){var j=this.rules.block.hr.exec(k);if(j)return{type:"hr",raw:j[0]}},G.blockquote=function(k){var j=this.rules.block.blockquote.exec(k);if(j){var W=j[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:j[0],text:W}}},G.list=function(k){var j=this.rules.block.list.exec(k);if(j){for(var W=j[0],z=j[2],Q=z.length>1,ne=z[z.length-1]===")",ae={type:"list",raw:W,ordered:Q,start:Q?+z.slice(0,-1):"",loose:!1,items:[]},ve=j[0].match(this.rules.block.item),Oe=!1,Ee,Be,Ue,ke,He,Ke,je,$e=ve.length,Ne=0;Ne<$e;Ne++)Ee=ve[Ne],W=Ee,Be=Ee.length,Ee=Ee.replace(/^ *([*+-]|\d+[.)]) */,""),~Ee.indexOf(`
|
|
`)&&(Be-=Ee.length,Ee=this.options.pedantic?Ee.replace(/^ {1,4}/gm,""):Ee.replace(new RegExp("^ {1,"+Be+"}","gm"),"")),Ne!==$e-1&&(Ue=this.rules.block.bullet.exec(ve[Ne+1])[0],(Q?Ue.length===1||!ne&&Ue[Ue.length-1]===")":Ue.length>1||this.options.smartLists&&Ue!==z)&&(ke=ve.slice(Ne+1).join(`
|
|
`),ae.raw=ae.raw.substring(0,ae.raw.length-ke.length),Ne=$e-1)),He=Oe||/\n\n(?!\s*$)/.test(Ee),Ne!==$e-1&&(Oe=Ee.charAt(Ee.length-1)===`
|
|
`,He||(He=Oe)),He&&(ae.loose=!0),Ke=/^\[[ xX]\] /.test(Ee),je=void 0,Ke&&(je=Ee[1]!==" ",Ee=Ee.replace(/^\[[ xX]\] +/,"")),ae.items.push({type:"list_item",raw:W,task:Ke,checked:je,loose:He,text:Ee});return ae}},G.html=function(k){var j=this.rules.block.html.exec(k);if(j)return{type:this.options.sanitize?"paragraph":"html",raw:j[0],pre:!this.options.sanitizer&&(j[1]==="pre"||j[1]==="script"||j[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(j[0]):K(j[0]):j[0]}},G.def=function(k){var j=this.rules.block.def.exec(k);if(j){j[3]&&(j[3]=j[3].substring(1,j[3].length-1));var W=j[1].toLowerCase().replace(/\s+/g," ");return{tag:W,raw:j[0],href:j[2],title:j[3]}}},G.table=function(k){var j=this.rules.block.table.exec(k);if(j){var W={type:"table",header:F(j[1].replace(/^ *| *\| *$/g,"")),align:j[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:j[3]?j[3].replace(/\n$/,"").split(`
|
|
`):[]};if(W.header.length===W.align.length){W.raw=j[0];var z=W.align.length,Q;for(Q=0;Q<z;Q++)/^ *-+: *$/.test(W.align[Q])?W.align[Q]="right":/^ *:-+: *$/.test(W.align[Q])?W.align[Q]="center":/^ *:-+ *$/.test(W.align[Q])?W.align[Q]="left":W.align[Q]=null;for(z=W.cells.length,Q=0;Q<z;Q++)W.cells[Q]=F(W.cells[Q].replace(/^ *\| *| *\| *$/g,""),W.header.length);return W}}},G.lheading=function(k){var j=this.rules.block.lheading.exec(k);if(j)return{type:"heading",raw:j[0],depth:j[2].charAt(0)==="="?1:2,text:j[1]}},G.paragraph=function(k){var j=this.rules.block.paragraph.exec(k);if(j)return{type:"paragraph",raw:j[0],text:j[1].charAt(j[1].length-1)===`
|
|
`?j[1].slice(0,-1):j[1]}},G.text=function(k,j){var W=this.rules.block.text.exec(k);if(W){var z=j[j.length-1];return z&&z.type==="text"?{raw:W[0],text:W[0]}:{type:"text",raw:W[0],text:W[0]}}},G.escape=function(k){var j=this.rules.inline.escape.exec(k);if(j)return{type:"escape",raw:j[0],text:K(j[1])}},G.tag=function(k,j,W){var z=this.rules.inline.tag.exec(k);if(z)return!j&&/^<a /i.test(z[0])?j=!0:j&&/^<\/a>/i.test(z[0])&&(j=!1),!W&&/^<(pre|code|kbd|script)(\s|>)/i.test(z[0])?W=!0:W&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(z[0])&&(W=!1),{type:this.options.sanitize?"text":"html",raw:z[0],inLink:j,inRawBlock:W,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(z[0]):K(z[0]):z[0]}},G.link=function(k){var j=this.rules.inline.link.exec(k);if(j){var W=$(j[2],"()");if(W>-1){var z=j[0].indexOf("!")===0?5:4,Q=z+j[1].length+W;j[2]=j[2].substring(0,W),j[0]=j[0].substring(0,Q).trim(),j[3]=""}var ne=j[2],ae="";if(this.options.pedantic){var ve=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(ne);ve?(ne=ve[1],ae=ve[3]):ae=""}else ae=j[3]?j[3].slice(1,-1):"";ne=ne.trim().replace(/^<([\s\S]*)>$/,"$1");var Oe=X(j,{href:ne&&ne.replace(this.rules.inline._escapes,"$1"),title:ae&&ae.replace(this.rules.inline._escapes,"$1")},j[0]);return Oe}},G.reflink=function(k,j){var W;if((W=this.rules.inline.reflink.exec(k))||(W=this.rules.inline.nolink.exec(k))){var z=(W[2]||W[1]).replace(/\s+/g," ");if(z=j[z.toLowerCase()],!z||!z.href){var Q=W[0].charAt(0);return{type:"text",raw:Q,text:Q}}var ne=X(W,z,W[0]);return ne}},G.strong=function(k,j,W){W===void 0&&(W="");var z=this.rules.inline.strong.start.exec(k);if(z&&(!z[1]||z[1]&&(W===""||this.rules.inline.punctuation.exec(W)))){j=j.slice(-1*k.length);var Q=z[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;Q.lastIndex=0;for(var ne;(z=Q.exec(j))!=null;)if(ne=this.rules.inline.strong.middle.exec(j.slice(0,z.index+3)),ne)return{type:"strong",raw:k.slice(0,ne[0].length),text:k.slice(2,ne[0].length-2)}}},G.em=function(k,j,W){W===void 0&&(W="");var z=this.rules.inline.em.start.exec(k);if(z&&(!z[1]||z[1]&&(W===""||this.rules.inline.punctuation.exec(W)))){j=j.slice(-1*k.length);var Q=z[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;Q.lastIndex=0;for(var ne;(z=Q.exec(j))!=null;)if(ne=this.rules.inline.em.middle.exec(j.slice(0,z.index+2)),ne)return{type:"em",raw:k.slice(0,ne[0].length),text:k.slice(1,ne[0].length-1)}}},G.codespan=function(k){var j=this.rules.inline.code.exec(k);if(j){var W=j[2].replace(/\n/g," "),z=/[^ ]/.test(W),Q=W.startsWith(" ")&&W.endsWith(" ");return z&&Q&&(W=W.substring(1,W.length-1)),W=K(W,!0),{type:"codespan",raw:j[0],text:W}}},G.br=function(k){var j=this.rules.inline.br.exec(k);if(j)return{type:"br",raw:j[0]}},G.del=function(k){var j=this.rules.inline.del.exec(k);if(j)return{type:"del",raw:j[0],text:j[1]}},G.autolink=function(k,j){var W=this.rules.inline.autolink.exec(k);if(W){var z,Q;return W[2]==="@"?(z=K(this.options.mangle?j(W[1]):W[1]),Q="mailto:"+z):(z=K(W[1]),Q=z),{type:"link",raw:W[0],text:z,href:Q,tokens:[{type:"text",raw:z,text:z}]}}},G.url=function(k,j){var W;if(W=this.rules.inline.url.exec(k)){var z,Q;if(W[2]==="@")z=K(this.options.mangle?j(W[0]):W[0]),Q="mailto:"+z;else{var ne;do ne=W[0],W[0]=this.rules.inline._backpedal.exec(W[0])[0];while(ne!==W[0]);z=K(W[0]),W[1]==="www."?Q="http://"+z:Q=z}return{type:"link",raw:W[0],text:z,href:Q,tokens:[{type:"text",raw:z,text:z}]}}},G.inlineText=function(k,j,W){var z=this.rules.inline.text.exec(k);if(z){var Q;return j?Q=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(z[0]):K(z[0]):z[0]:Q=K(this.options.smartypants?W(z[0]):z[0]),{type:"text",raw:z[0],text:Q}}},V}(),ee=w.noopTest,de=w.edit,le=w.merge,re={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6}) +([^\n]*?)(?: +#+)? *(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|<![A-Z][\\s\\S]*?>\\n*|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>\\n*|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:ee,table:ee,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};re._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,re._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,re.def=de(re.def).replace("label",re._label).replace("title",re._title).getRegex(),re.bullet=/(?:[*+-]|\d{1,9}[.)])/,re.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,re.item=de(re.item,"gm").replace(/bull/g,re.bullet).getRegex(),re.list=de(re.list).replace(/bull/g,re.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+re.def.source+")").getRegex(),re._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",re._comment=/<!--(?!-?>)[\s\S]*?-->/,re.html=de(re.html,"i").replace("comment",re._comment).replace("tag",re._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),re.paragraph=de(re._paragraph).replace("hr",re.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",re._tag).getRegex(),re.blockquote=de(re.blockquote).replace("paragraph",re.paragraph).getRegex(),re.normal=le({},re),re.gfm=le({},re.normal,{nptable:"^ *([^|\\n ].*\\|.*)\\n *([-:]+ *\\|[-| :]*)(?:\\n((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)",table:"^ *\\|(.+)\\n *\\|?( *[-:]+[-| :]*)(?:\\n *((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),re.gfm.nptable=de(re.gfm.nptable).replace("hr",re.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",re._tag).getRegex(),re.gfm.table=de(re.gfm.table).replace("hr",re.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",re._tag).getRegex(),re.pedantic=le({},re.normal,{html:de(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",re._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,fences:ee,paragraph:de(re.normal._paragraph).replace("hr",re.hr).replace("heading",` *#{1,6} *[^
|
|
]`).replace("lheading",re.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var te={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:ee,tag:"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,nolink:/^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",strong:{start:/^(?:(\*\*(?=[*punctuation]))|\*\*)(?![\s])|__/,middle:/^\*\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*\*$|^__(?![\s])((?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?)__$/,endAst:/[^punctuation\s]\*\*(?!\*)|[punctuation]\*\*(?!\*)(?:(?=[punctuation\s]|$))/,endUnd:/[^\s]__(?!_)(?:(?=[punctuation\s])|$)/},em:{start:/^(?:(\*(?=[punctuation]))|\*)(?![*\s])|_/,middle:/^\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*$|^_(?![_\s])(?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?_$/,endAst:/[^punctuation\s]\*(?!\*)|[punctuation]\*(?!\*)(?:(?=[punctuation\s]|$))/,endUnd:/[^\s]_(?!_)(?:(?=[punctuation\s])|$)/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:ee,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};te._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",te.punctuation=de(te.punctuation).replace(/punctuation/g,te._punctuation).getRegex(),te._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",te._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",te.em.start=de(te.em.start).replace(/punctuation/g,te._punctuation).getRegex(),te.em.middle=de(te.em.middle).replace(/punctuation/g,te._punctuation).replace(/overlapSkip/g,te._overlapSkip).getRegex(),te.em.endAst=de(te.em.endAst,"g").replace(/punctuation/g,te._punctuation).getRegex(),te.em.endUnd=de(te.em.endUnd,"g").replace(/punctuation/g,te._punctuation).getRegex(),te.strong.start=de(te.strong.start).replace(/punctuation/g,te._punctuation).getRegex(),te.strong.middle=de(te.strong.middle).replace(/punctuation/g,te._punctuation).replace(/blockSkip/g,te._blockSkip).getRegex(),te.strong.endAst=de(te.strong.endAst,"g").replace(/punctuation/g,te._punctuation).getRegex(),te.strong.endUnd=de(te.strong.endUnd,"g").replace(/punctuation/g,te._punctuation).getRegex(),te.blockSkip=de(te._blockSkip,"g").getRegex(),te.overlapSkip=de(te._overlapSkip,"g").getRegex(),te._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,te._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,te._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,te.autolink=de(te.autolink).replace("scheme",te._scheme).replace("email",te._email).getRegex(),te._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,te.tag=de(te.tag).replace("comment",re._comment).replace("attribute",te._attribute).getRegex(),te._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,te._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,te._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,te.link=de(te.link).replace("label",te._label).replace("href",te._href).replace("title",te._title).getRegex(),te.reflink=de(te.reflink).replace("label",te._label).getRegex(),te.reflinkSearch=de(te.reflinkSearch,"g").replace("reflink",te.reflink).replace("nolink",te.nolink).getRegex(),te.normal=le({},te),te.pedantic=le({},te.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:de(/^!?\[(label)\]\((.*?)\)/).replace("label",te._label).getRegex(),reflink:de(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",te._label).getRegex()}),te.gfm=le({},te.normal,{escape:de(te.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^~+(?=\S)([\s\S]*?\S)~+/,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*~]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))|(?= {2,}\n|[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))/}),te.gfm.url=de(te.gfm.url,"i").replace("email",te.gfm._extended_email).getRegex(),te.breaks=le({},te.gfm,{br:de(te.br).replace("{2,}","*").getRegex(),text:de(te.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var Te={block:re,inline:te},Ie=L.defaults,Ae=Te.block,De=Te.inline;function fe(V){return V.replace(/---/g,"\u2014").replace(/--/g,"\u2013").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1\u2018").replace(/'/g,"\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1\u201C").replace(/"/g,"\u201D").replace(/\.{3}/g,"\u2026")}function ye(V){var G="",H,k,j=V.length;for(H=0;H<j;H++)k=V.charCodeAt(H),Math.random()>.5&&(k="x"+k.toString(16)),G+="&#"+k+";";return G}var xe=function(){function V(H){this.tokens=[],this.tokens.links=Object.create(null),this.options=H||Ie,this.options.tokenizer=this.options.tokenizer||new pe,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var k={block:Ae.normal,inline:De.normal};this.options.pedantic?(k.block=Ae.pedantic,k.inline=De.pedantic):this.options.gfm&&(k.block=Ae.gfm,this.options.breaks?k.inline=De.breaks:k.inline=De.gfm),this.tokenizer.rules=k}V.lex=function(k,j){var W=new V(j);return W.lex(k)};var G=V.prototype;return G.lex=function(k){return k=k.replace(/\r\n|\r/g,`
|
|
`).replace(/\t/g," "),this.blockTokens(k,this.tokens,!0),this.inline(this.tokens),this.tokens},G.blockTokens=function(k,j,W){j===void 0&&(j=[]),W===void 0&&(W=!0),k=k.replace(/^ +$/gm,"");for(var z,Q,ne,ae;k;){if(z=this.tokenizer.space(k)){k=k.substring(z.raw.length),z.type&&j.push(z);continue}if(z=this.tokenizer.code(k,j)){k=k.substring(z.raw.length),z.type?j.push(z):(ae=j[j.length-1],ae.raw+=`
|
|
`+z.raw,ae.text+=`
|
|
`+z.text);continue}if(z=this.tokenizer.fences(k)){k=k.substring(z.raw.length),j.push(z);continue}if(z=this.tokenizer.heading(k)){k=k.substring(z.raw.length),j.push(z);continue}if(z=this.tokenizer.nptable(k)){k=k.substring(z.raw.length),j.push(z);continue}if(z=this.tokenizer.hr(k)){k=k.substring(z.raw.length),j.push(z);continue}if(z=this.tokenizer.blockquote(k)){k=k.substring(z.raw.length),z.tokens=this.blockTokens(z.text,[],W),j.push(z);continue}if(z=this.tokenizer.list(k)){for(k=k.substring(z.raw.length),ne=z.items.length,Q=0;Q<ne;Q++)z.items[Q].tokens=this.blockTokens(z.items[Q].text,[],!1);j.push(z);continue}if(z=this.tokenizer.html(k)){k=k.substring(z.raw.length),j.push(z);continue}if(W&&(z=this.tokenizer.def(k))){k=k.substring(z.raw.length),this.tokens.links[z.tag]||(this.tokens.links[z.tag]={href:z.href,title:z.title});continue}if(z=this.tokenizer.table(k)){k=k.substring(z.raw.length),j.push(z);continue}if(z=this.tokenizer.lheading(k)){k=k.substring(z.raw.length),j.push(z);continue}if(W&&(z=this.tokenizer.paragraph(k))){k=k.substring(z.raw.length),j.push(z);continue}if(z=this.tokenizer.text(k,j)){k=k.substring(z.raw.length),z.type?j.push(z):(ae=j[j.length-1],ae.raw+=`
|
|
`+z.raw,ae.text+=`
|
|
`+z.text);continue}if(k){var ve="Infinite loop on byte: "+k.charCodeAt(0);if(this.options.silent){console.error(ve);break}else throw new Error(ve)}}return j},G.inline=function(k){var j,W,z,Q,ne,ae,ve=k.length;for(j=0;j<ve;j++){ae=k[j];switch(ae.type){case"paragraph":case"text":case"heading":{ae.tokens=[],this.inlineTokens(ae.text,ae.tokens);break}case"table":{for(ae.tokens={header:[],cells:[]},Q=ae.header.length,W=0;W<Q;W++)ae.tokens.header[W]=[],this.inlineTokens(ae.header[W],ae.tokens.header[W]);for(Q=ae.cells.length,W=0;W<Q;W++)for(ne=ae.cells[W],ae.tokens.cells[W]=[],z=0;z<ne.length;z++)ae.tokens.cells[W][z]=[],this.inlineTokens(ne[z],ae.tokens.cells[W][z]);break}case"blockquote":{this.inline(ae.tokens);break}case"list":{for(Q=ae.items.length,W=0;W<Q;W++)this.inline(ae.items[W].tokens);break}}}return k},G.inlineTokens=function(k,j,W,z,Q){j===void 0&&(j=[]),W===void 0&&(W=!1),z===void 0&&(z=!1),Q===void 0&&(Q="");var ne,ae=k,ve;if(this.tokens.links){var Oe=Object.keys(this.tokens.links);if(Oe.length>0)for(;(ve=this.tokenizer.rules.inline.reflinkSearch.exec(ae))!=null;)Oe.includes(ve[0].slice(ve[0].lastIndexOf("[")+1,-1))&&(ae=ae.slice(0,ve.index)+"["+"a".repeat(ve[0].length-2)+"]"+ae.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(ve=this.tokenizer.rules.inline.blockSkip.exec(ae))!=null;)ae=ae.slice(0,ve.index)+"["+"a".repeat(ve[0].length-2)+"]"+ae.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;k;){if(ne=this.tokenizer.escape(k)){k=k.substring(ne.raw.length),j.push(ne);continue}if(ne=this.tokenizer.tag(k,W,z)){k=k.substring(ne.raw.length),W=ne.inLink,z=ne.inRawBlock,j.push(ne);continue}if(ne=this.tokenizer.link(k)){k=k.substring(ne.raw.length),ne.type==="link"&&(ne.tokens=this.inlineTokens(ne.text,[],!0,z)),j.push(ne);continue}if(ne=this.tokenizer.reflink(k,this.tokens.links)){k=k.substring(ne.raw.length),ne.type==="link"&&(ne.tokens=this.inlineTokens(ne.text,[],!0,z)),j.push(ne);continue}if(ne=this.tokenizer.strong(k,ae,Q)){k=k.substring(ne.raw.length),ne.tokens=this.inlineTokens(ne.text,[],W,z),j.push(ne);continue}if(ne=this.tokenizer.em(k,ae,Q)){k=k.substring(ne.raw.length),ne.tokens=this.inlineTokens(ne.text,[],W,z),j.push(ne);continue}if(ne=this.tokenizer.codespan(k)){k=k.substring(ne.raw.length),j.push(ne);continue}if(ne=this.tokenizer.br(k)){k=k.substring(ne.raw.length),j.push(ne);continue}if(ne=this.tokenizer.del(k)){k=k.substring(ne.raw.length),ne.tokens=this.inlineTokens(ne.text,[],W,z),j.push(ne);continue}if(ne=this.tokenizer.autolink(k,ye)){k=k.substring(ne.raw.length),j.push(ne);continue}if(!W&&(ne=this.tokenizer.url(k,ye))){k=k.substring(ne.raw.length),j.push(ne);continue}if(ne=this.tokenizer.inlineText(k,z,fe)){k=k.substring(ne.raw.length),Q=ne.raw.slice(-1),j.push(ne);continue}if(k){var Ee="Infinite loop on byte: "+k.charCodeAt(0);if(this.options.silent){console.error(Ee);break}else throw new Error(Ee)}}return j},M(V,null,[{key:"rules",get:function(){return{block:Ae,inline:De}}}]),V}(),be=L.defaults,ie=w.cleanUrl,Se=w.escape,ge=function(){function V(H){this.options=H||be}var G=V.prototype;return G.code=function(k,j,W){var z=(j||"").match(/\S*/)[0];if(this.options.highlight){var Q=this.options.highlight(k,z);Q!=null&&Q!==k&&(W=!0,k=Q)}return z?'<pre><code class="'+this.options.langPrefix+Se(z,!0)+'">'+(W?k:Se(k,!0))+`</code></pre>
|
|
`:"<pre><code>"+(W?k:Se(k,!0))+`</code></pre>
|
|
`},G.blockquote=function(k){return`<blockquote>
|
|
`+k+`</blockquote>
|
|
`},G.html=function(k){return k},G.heading=function(k,j,W,z){return this.options.headerIds?"<h"+j+' id="'+this.options.headerPrefix+z.slug(W)+'">'+k+"</h"+j+`>
|
|
`:"<h"+j+">"+k+"</h"+j+`>
|
|
`},G.hr=function(){return this.options.xhtml?`<hr/>
|
|
`:`<hr>
|
|
`},G.list=function(k,j,W){var z=j?"ol":"ul",Q=j&&W!==1?' start="'+W+'"':"";return"<"+z+Q+`>
|
|
`+k+"</"+z+`>
|
|
`},G.listitem=function(k){return"<li>"+k+`</li>
|
|
`},G.checkbox=function(k){return"<input "+(k?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},G.paragraph=function(k){return"<p>"+k+`</p>
|
|
`},G.table=function(k,j){return j&&(j="<tbody>"+j+"</tbody>"),`<table>
|
|
<thead>
|
|
`+k+`</thead>
|
|
`+j+`</table>
|
|
`},G.tablerow=function(k){return`<tr>
|
|
`+k+`</tr>
|
|
`},G.tablecell=function(k,j){var W=j.header?"th":"td",z=j.align?"<"+W+' align="'+j.align+'">':"<"+W+">";return z+k+"</"+W+`>
|
|
`},G.strong=function(k){return"<strong>"+k+"</strong>"},G.em=function(k){return"<em>"+k+"</em>"},G.codespan=function(k){return"<code>"+k+"</code>"},G.br=function(){return this.options.xhtml?"<br/>":"<br>"},G.del=function(k){return"<del>"+k+"</del>"},G.link=function(k,j,W){if(k=ie(this.options.sanitize,this.options.baseUrl,k),k===null)return W;var z='<a href="'+Se(k)+'"';return j&&(z+=' title="'+j+'"'),z+=">"+W+"</a>",z},G.image=function(k,j,W){if(k=ie(this.options.sanitize,this.options.baseUrl,k),k===null)return W;var z='<img src="'+k+'" alt="'+W+'"';return j&&(z+=' title="'+j+'"'),z+=this.options.xhtml?"/>":">",z},G.text=function(k){return k},V}(),me=function(){function V(){}var G=V.prototype;return G.strong=function(k){return k},G.em=function(k){return k},G.codespan=function(k){return k},G.del=function(k){return k},G.html=function(k){return k},G.text=function(k){return k},G.link=function(k,j,W){return""+W},G.image=function(k,j,W){return""+W},G.br=function(){return""},V}(),Ce=function(){function V(){this.seen={}}var G=V.prototype;return G.slug=function(k){var j=k.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(j)){var W=j;do this.seen[W]++,j=W+"-"+this.seen[W];while(this.seen.hasOwnProperty(j))}return this.seen[j]=0,j},V}(),Le=L.defaults,_e=w.unescape,Re=function(){function V(H){this.options=H||Le,this.options.renderer=this.options.renderer||new ge,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new me,this.slugger=new Ce}V.parse=function(k,j){var W=new V(j);return W.parse(k)};var G=V.prototype;return G.parse=function(k,j){j===void 0&&(j=!0);var W="",z,Q,ne,ae,ve,Oe,Ee,Be,Ue,ke,He,Ke,je,$e,Ne,Ve,ze,Fe,Xe=k.length;for(z=0;z<Xe;z++){ke=k[z];switch(ke.type){case"space":continue;case"hr":{W+=this.renderer.hr();continue}case"heading":{W+=this.renderer.heading(this.parseInline(ke.tokens),ke.depth,_e(this.parseInline(ke.tokens,this.textRenderer)),this.slugger);continue}case"code":{W+=this.renderer.code(ke.text,ke.lang,ke.escaped);continue}case"table":{for(Be="",Ee="",ae=ke.header.length,Q=0;Q<ae;Q++)Ee+=this.renderer.tablecell(this.parseInline(ke.tokens.header[Q]),{header:!0,align:ke.align[Q]});for(Be+=this.renderer.tablerow(Ee),Ue="",ae=ke.cells.length,Q=0;Q<ae;Q++){for(Oe=ke.tokens.cells[Q],Ee="",ve=Oe.length,ne=0;ne<ve;ne++)Ee+=this.renderer.tablecell(this.parseInline(Oe[ne]),{header:!1,align:ke.align[ne]});Ue+=this.renderer.tablerow(Ee)}W+=this.renderer.table(Be,Ue);continue}case"blockquote":{Ue=this.parse(ke.tokens),W+=this.renderer.blockquote(Ue);continue}case"list":{for(He=ke.ordered,Ke=ke.start,je=ke.loose,ae=ke.items.length,Ue="",Q=0;Q<ae;Q++)Ne=ke.items[Q],Ve=Ne.checked,ze=Ne.task,$e="",Ne.task&&(Fe=this.renderer.checkbox(Ve),je?Ne.tokens.length>0&&Ne.tokens[0].type==="text"?(Ne.tokens[0].text=Fe+" "+Ne.tokens[0].text,Ne.tokens[0].tokens&&Ne.tokens[0].tokens.length>0&&Ne.tokens[0].tokens[0].type==="text"&&(Ne.tokens[0].tokens[0].text=Fe+" "+Ne.tokens[0].tokens[0].text)):Ne.tokens.unshift({type:"text",text:Fe}):$e+=Fe),$e+=this.parse(Ne.tokens,je),Ue+=this.renderer.listitem($e,ze,Ve);W+=this.renderer.list(Ue,He,Ke);continue}case"html":{W+=this.renderer.html(ke.text);continue}case"paragraph":{W+=this.renderer.paragraph(this.parseInline(ke.tokens));continue}case"text":{for(Ue=ke.tokens?this.parseInline(ke.tokens):ke.text;z+1<Xe&&k[z+1].type==="text";)ke=k[++z],Ue+=`
|
|
`+(ke.tokens?this.parseInline(ke.tokens):ke.text);W+=j?this.renderer.paragraph(Ue):Ue;continue}default:{var Qe='Token with "'+ke.type+'" type was not found.';if(this.options.silent){console.error(Qe);return}else throw new Error(Qe)}}}return W},G.parseInline=function(k,j){j=j||this.renderer;var W="",z,Q,ne=k.length;for(z=0;z<ne;z++){Q=k[z];switch(Q.type){case"escape":{W+=j.text(Q.text);break}case"html":{W+=j.html(Q.text);break}case"link":{W+=j.link(Q.href,Q.title,this.parseInline(Q.tokens,j));break}case"image":{W+=j.image(Q.href,Q.title,Q.text);break}case"strong":{W+=j.strong(this.parseInline(Q.tokens,j));break}case"em":{W+=j.em(this.parseInline(Q.tokens,j));break}case"codespan":{W+=j.codespan(Q.text);break}case"br":{W+=j.br();break}case"del":{W+=j.del(this.parseInline(Q.tokens,j));break}case"text":{W+=j.text(Q.text);break}default:{var ae='Token with "'+Q.type+'" type was not found.';if(this.options.silent){console.error(ae);return}else throw new Error(ae)}}}return W},V}(),Pe=w.merge,we=w.checkSanitizeDeprecation,J=w.escape,q=L.getDefaults,se=L.changeDefaults,ce=L.defaults;function Z(V,G,H){if(typeof V=="undefined"||V===null)throw new Error("marked(): input parameter is undefined or null");if(typeof V!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(V)+", string expected");if(typeof G=="function"&&(H=G,G=null),G=Pe({},Z.defaults,G||{}),we(G),H){var k=G.highlight,j;try{j=xe.lex(V,G)}catch(ne){return H(ne)}var W=function(ae){var ve;if(!ae)try{ve=Re.parse(j,G)}catch(Oe){ae=Oe}return G.highlight=k,ae?H(ae):H(null,ve)};if(!k||k.length<3)return W();if(delete G.highlight,!j.length)return W();var z=0;Z.walkTokens(j,function(ne){ne.type==="code"&&(z++,setTimeout(function(){k(ne.text,ne.lang,function(ae,ve){if(ae)return W(ae);ve!=null&&ve!==ne.text&&(ne.text=ve,ne.escaped=!0),z--,z===0&&W()})},0))}),z===0&&W();return}try{var Q=xe.lex(V,G);return G.walkTokens&&Z.walkTokens(Q,G.walkTokens),Re.parse(Q,G)}catch(ne){if(ne.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,G.silent)return"<p>An error occurred:</p><pre>"+J(ne.message+"",!0)+"</pre>";throw ne}}Z.options=Z.setOptions=function(V){return Pe(Z.defaults,V),se(Z.defaults),Z},Z.getDefaults=q,Z.defaults=ce,Z.use=function(V){var G=Pe({},V);if(V.renderer&&function(){var k=Z.defaults.renderer||new ge,j=function(Q){var ne=k[Q];k[Q]=function(){for(var ae=arguments.length,ve=new Array(ae),Oe=0;Oe<ae;Oe++)ve[Oe]=arguments[Oe];var Ee=V.renderer[Q].apply(k,ve);return Ee===!1&&(Ee=ne.apply(k,ve)),Ee}};for(var W in V.renderer)j(W);G.renderer=k}(),V.tokenizer&&function(){var k=Z.defaults.tokenizer||new pe,j=function(Q){var ne=k[Q];k[Q]=function(){for(var ae=arguments.length,ve=new Array(ae),Oe=0;Oe<ae;Oe++)ve[Oe]=arguments[Oe];var Ee=V.tokenizer[Q].apply(k,ve);return Ee===!1&&(Ee=ne.apply(k,ve)),Ee}};for(var W in V.tokenizer)j(W);G.tokenizer=k}(),V.walkTokens){var H=Z.defaults.walkTokens;G.walkTokens=function(k){V.walkTokens(k),H&&H(k)}}Z.setOptions(G)},Z.walkTokens=function(V,G){for(var H=D(V),k;!(k=H()).done;){var j=k.value;G(j);switch(j.type){case"table":{for(var W=D(j.tokens.header),z;!(z=W()).done;){var Q=z.value;Z.walkTokens(Q,G)}for(var ne=D(j.tokens.cells),ae;!(ae=ne()).done;)for(var ve=ae.value,Oe=D(ve),Ee;!(Ee=Oe()).done;){var Be=Ee.value;Z.walkTokens(Be,G)}break}case"list":{Z.walkTokens(j.items,G);break}default:j.tokens&&Z.walkTokens(j.tokens,G)}}},Z.Parser=Re,Z.parser=Re.parse,Z.Renderer=ge,Z.TextRenderer=me,Z.Lexer=xe,Z.lexer=xe.lex,Z.Tokenizer=pe,Z.Slugger=Ce,Z.parse=Z;var ue=Z;return ue})},F0VM:function(Me,he,B){Me.exports={flex_box_center:"flex_box_center___2fDN3",flex_space_between:"flex_space_between___BHBBv",flex_box_vertical_center:"flex_box_vertical_center___tpxsE",flex_box_center_end:"flex_box_center_end___rP7bQ",flex_box_column:"flex_box_column___1_rF-",md:"md___3SObb",title:"title___HfZ1b"}},IBYe:function(Me,he,B){"use strict";function Y(M){return null}he.a=Y},J66h:function(Me,he,B){(function(Y){var M,S;(function(I,D){Me.exports=D(I)})(typeof self!="undefined"?self:typeof window!="undefined"?window:typeof Y!="undefined"?Y:this,function(I){"use strict";I=I||{};var D=I.Base64,E="2.6.4",L="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",R=function(u){for(var b={},A=0,P=u.length;A<P;A++)b[u.charAt(A)]=A;return b}(L),_=String.fromCharCode,C=function(u){if(u.length<2){var b=u.charCodeAt(0);return b<128?u:b<2048?_(192|b>>>6)+_(128|b&63):_(224|b>>>12&15)+_(128|b>>>6&63)+_(128|b&63)}else{var b=65536+(u.charCodeAt(0)-55296)*1024+(u.charCodeAt(1)-56320);return _(240|b>>>18&7)+_(128|b>>>12&63)+_(128|b>>>6&63)+_(128|b&63)}},y=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,T=function(u){return u.replace(y,C)},O=function(u){var b=[0,2,1][u.length%3],A=u.charCodeAt(0)<<16|(u.length>1?u.charCodeAt(1):0)<<8|(u.length>2?u.charCodeAt(2):0),P=[L.charAt(A>>>18),L.charAt(A>>>12&63),b>=2?"=":L.charAt(A>>>6&63),b>=1?"=":L.charAt(A&63)];return P.join("")},x=I.btoa&&typeof I.btoa=="function"?function(u){return I.btoa(u)}:function(u){if(u.match(/[^\x00-\xFF]/))throw new RangeError("The string contains invalid characters.");return u.replace(/[\s\S]{1,3}/g,O)},v=function(u){return x(T(String(u)))},g=function(u){return u.replace(/[+\/]/g,function(b){return b=="+"?"-":"_"}).replace(/=/g,"")},d=function(u,b){return b?g(v(u)):v(u)},t=function(u){return d(u,!0)},o;I.Uint8Array&&(o=function(u,b){for(var A="",P=0,w=u.length;P<w;P+=3){var U=u[P],N=u[P+1],F=u[P+2],K=U<<16|N<<8|F;A+=L.charAt(K>>>18)+L.charAt(K>>>12&63)+(typeof N!="undefined"?L.charAt(K>>>6&63):"=")+(typeof F!="undefined"?L.charAt(K&63):"=")}return b?g(A):A});var i=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,p=function(u){switch(u.length){case 4:var b=(7&u.charCodeAt(0))<<18|(63&u.charCodeAt(1))<<12|(63&u.charCodeAt(2))<<6|63&u.charCodeAt(3),A=b-65536;return _((A>>>10)+55296)+_((A&1023)+56320);case 3:return _((15&u.charCodeAt(0))<<12|(63&u.charCodeAt(1))<<6|63&u.charCodeAt(2));default:return _((31&u.charCodeAt(0))<<6|63&u.charCodeAt(1))}},f=function(u){return u.replace(i,p)},s=function(u){var b=u.length,A=b%4,P=(b>0?R[u.charAt(0)]<<18:0)|(b>1?R[u.charAt(1)]<<12:0)|(b>2?R[u.charAt(2)]<<6:0)|(b>3?R[u.charAt(3)]:0),w=[_(P>>>16),_(P>>>8&255),_(P&255)];return w.length-=[0,0,2,1][A],w.join("")},m=I.atob&&typeof I.atob=="function"?function(u){return I.atob(u)}:function(u){return u.replace(/\S{1,4}/g,s)},l=function(u){return m(String(u).replace(/[^A-Za-z0-9\+\/]/g,""))},a=function(u){return f(m(u))},r=function(u){return String(u).replace(/[-_]/g,function(b){return b=="-"?"+":"/"}).replace(/[^A-Za-z0-9\+\/]/g,"")},e=function(u){return a(r(u))},n;I.Uint8Array&&(n=function(u){return Uint8Array.from(l(r(u)),function(b){return b.charCodeAt(0)})});var c=function(){var u=I.Base64;return I.Base64=D,u};if(I.Base64={VERSION:E,atob:l,btoa:x,fromBase64:e,toBase64:d,utob:T,encode:d,encodeURI:t,btou:f,decode:e,noConflict:c,fromUint8Array:o,toUint8Array:n},typeof Object.defineProperty=="function"){var h=function(u){return{value:u,enumerable:!1,writable:!0,configurable:!0}};I.Base64.extendString=function(){Object.defineProperty(String.prototype,"fromBase64",h(function(){return e(this)})),Object.defineProperty(String.prototype,"toBase64",h(function(u){return d(this,u)})),Object.defineProperty(String.prototype,"toBase64URI",h(function(){return d(this,!0)}))}}return I.Meteor&&(Base64=I.Base64),Me.exports?Me.exports.Base64=I.Base64:!(M=[],S=function(){return I.Base64}.apply(he,M),S!==void 0&&(Me.exports=S)),{Base64:I.Base64}})}).call(this,B("IyRk"))},LdHM:function(Me,he,B){"use strict";B.d(he,"b",function(){return i}),B.d(he,"a",function(){return f});var Y=B("1OyB"),M=B("vuIU"),S=B("Ji7U"),I=B("LK+K"),D=B("cDcd"),E=B("rePB"),L=B("Ff2n"),R=B("ODXe"),_=B("4IlW"),C=B("bX4T"),y=B("YrtM"),T=B("TSYQ"),O=B.n(T),x=B("+nKL"),v=B("8OUc"),g=function(F,K){var $=F.prefixCls,X=F.id,oe=F.flattenOptions,pe=F.childrenAsData,ee=F.values,de=F.searchValue,le=F.multiple,re=F.defaultActiveFirstOption,te=F.height,Te=F.itemHeight,Ie=F.notFoundContent,Ae=F.open,De=F.menuItemSelectedIcon,fe=F.virtual,ye=F.onSelect,xe=F.onToggleOpen,be=F.onActiveValue,ie=F.onScroll,Se=F.onMouseEnter,ge="".concat($,"-item"),me=Object(y.a)(function(){return oe},[Ae,oe],function(ue,V){return V[0]&&ue[1]!==V[1]}),Ce=D.useRef(null),Le=function(V){V.preventDefault()},_e=function(V){Ce.current&&Ce.current.scrollTo({index:V})},Re=function(V){for(var G=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,H=me.length,k=0;k<H;k+=1){var j=(V+k*G+H)%H,W=me[j],z=W.group,Q=W.data;if(!z&&!Q.disabled)return j}return-1},Pe=D.useState(function(){return Re(0)}),we=Object(R.a)(Pe,2),J=we[0],q=we[1],se=function(V){q(V);var G=me[V];if(!G){be(null,-1);return}be(G.data.value,V)};D.useEffect(function(){se(re!==!1?Re(0):-1)},[me.length,de]),D.useEffect(function(){var ue=setTimeout(function(){if(!le&&Ae&&ee.size===1){var V=Array.from(ee)[0],G=me.findIndex(function(H){var k=H.data;return k.value===V});se(G),_e(G)}});return function(){return clearTimeout(ue)}},[Ae]);var ce=function(V){V!==void 0&&ye(V,{selected:!ee.has(V)}),le||xe(!1)};if(D.useImperativeHandle(K,function(){return{onKeyDown:function(V){var G=V.which;switch(G){case _.a.UP:case _.a.DOWN:{var H=0;if(G===_.a.UP?H=-1:G===_.a.DOWN&&(H=1),H!==0){var k=Re(J+H,H);_e(k),se(k)}break}case _.a.ENTER:{var j=me[J];j&&!j.data.disabled?ce(j.data.value):ce(void 0),Ae&&V.preventDefault();break}case _.a.ESC:xe(!1)}},onKeyUp:function(){},scrollTo:function(V){_e(V)}}}),me.length===0)return D.createElement("div",{role:"listbox",id:"".concat(X,"_list"),className:"".concat(ge,"-empty"),onMouseDown:Le},Ie);function Z(ue){var V=me[ue];if(!V)return null;var G=V.data||{},H=G.value,k=G.label,j=G.children,W=Object(C.a)(G,!0),z=pe?j:k;return V?D.createElement("div",Object.assign({"aria-label":typeof z=="string"?z:null},W,{key:ue,role:"option",id:"".concat(X,"_list_").concat(ue),"aria-selected":ee.has(H)}),H):null}return D.createElement(D.Fragment,null,D.createElement("div",{role:"listbox",id:"".concat(X,"_list"),style:{height:0,width:0,overflow:"hidden"}},Z(J-1),Z(J),Z(J+1)),D.createElement(x.a,{itemKey:"key",ref:Ce,data:me,height:te,itemHeight:Te,fullHeight:!1,onMouseDown:Le,onScroll:ie,virtual:fe,onMouseEnter:Se},function(ue,V){var G,H=ue.group,k=ue.groupOption,j=ue.data,W=j.label,z=j.key;if(H)return D.createElement("div",{className:O()(ge,"".concat(ge,"-group"))},W!==void 0?W:z);var Q=j.disabled,ne=j.value,ae=j.title,ve=j.children,Oe=j.style,Ee=j.className,Be=Object(L.a)(j,["disabled","value","title","children","style","className"]),Ue=ee.has(ne),ke="".concat(ge,"-option"),He=O()(ge,ke,Ee,(G={},Object(E.a)(G,"".concat(ke,"-grouped"),k),Object(E.a)(G,"".concat(ke,"-active"),J===V&&!Q),Object(E.a)(G,"".concat(ke,"-disabled"),Q),Object(E.a)(G,"".concat(ke,"-selected"),Ue),G)),Ke=pe?ve:W,je=!De||typeof De=="function"||Ue;return D.createElement("div",Object.assign({},Be,{"aria-selected":Ue,className:He,title:ae,onMouseMove:function(){if(J===V||Q)return;se(V)},onClick:function(){Q||ce(ne)},style:Oe}),D.createElement("div",{className:"".concat(ke,"-content")},Ke||ne),D.isValidElement(De)||Ue,je&&D.createElement(v.a,{className:"".concat(ge,"-option-state"),customizeIcon:De,customizeIconProps:{isSelected:Ue}},Ue?"\u2713":null))}))},d=D.forwardRef(g);d.displayName="OptionList";var t=d,o=function(){return null};o.isSelectOption=!0;var i=o,p=function(){return null};p.isSelectOptGroup=!0;var f=p,s=B("VTBJ"),m=B("Zm9Q");function l(N){var F=N.key,K=N.props,$=K.children,X=K.value,oe=Object(L.a)(K,["children","value"]);return Object(s.a)({key:F,value:X!==void 0?X:F,children:$},oe)}function a(N){var F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(m.a)(N).map(function(K,$){if(!D.isValidElement(K)||!K.type)return null;var X=K.type.isSelectOptGroup,oe=K.key,pe=K.props,ee=pe.children,de=Object(L.a)(pe,["children"]);return F||!X?l(K):Object(s.a)(Object(s.a)({key:"__RC_SELECT_GRP__".concat(oe===null?$:oe,"__"),label:oe},de),{},{options:a(ee)})}).filter(function(K){return K})}var r=B("2Qr1"),e=B("qNPg"),n=B("U8pU"),c=B("Kwbf"),h=B("WKfj");function u(N){var F=N.mode,K=N.options,$=N.children,X=N.backfill,oe=N.allowClear,pe=N.placeholder,ee=N.getInputElement,de=N.showSearch,le=N.onSearch,re=N.defaultOpen,te=N.autoFocus,Te=N.labelInValue,Ie=N.value,Ae=N.inputValue,De=N.optionLabelProp,fe=F==="multiple"||F==="tags",ye=de!==void 0?de:fe||F==="combobox",xe=K||a($);if(Object(c.a)(F!=="tags"||xe.every(function(ge){return!ge.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),F==="tags"||F==="combobox"){var be=xe.some(function(ge){return ge.options?ge.options.some(function(me){return typeof("value"in me?me.value:me.key)=="number"}):typeof("value"in ge?ge.value:ge.key)=="number"});Object(c.a)(!be,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(c.a)(F!=="combobox"||!De,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(c.a)(F==="combobox"||!X,"`backfill` only works with `combobox` mode."),Object(c.a)(F==="combobox"||!ee,"`getInputElement` only work with `combobox` mode."),Object(c.b)(F!=="combobox"||!ee||!oe||!pe,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),le&&!ye&&F!=="combobox"&&F!=="tags"&&Object(c.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(c.b)(!re||te,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),Ie!=null){var ie=Object(h.d)(Ie);Object(c.a)(!Te||ie.every(function(ge){return Object(n.a)(ge)==="object"&&("key"in ge||"value"in ge)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(c.a)(!fe||Array.isArray(Ie),"`value` should be array when `mode` is `multiple` or `tags`")}if($){var Se=null;Object(m.a)($).some(function(ge){if(!D.isValidElement(ge)||!ge.type)return!1;var me=ge.type;if(me.isSelectOption)return!1;if(me.isSelectOptGroup){var Ce=Object(m.a)(ge.props.children).every(function(Le){return!D.isValidElement(Le)||!ge.type||Le.type.isSelectOption?!0:(Se=Le.type,!1)});return!Ce}return Se=me,!0}),Se&&Object(c.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(Se.displayName||Se.name||Se,"`.")),Object(c.a)(Ae===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var b=u,A=Object(e.a)({prefixCls:"rc-select",components:{optionList:t},convertChildrenToData:a,flattenOptions:r.d,getLabeledValue:r.e,filterOptions:r.b,isValueDisabled:r.g,findValueOption:r.c,warningProps:b,fillOptionsWithMissingValue:r.a}),P=function(N){Object(S.a)(K,N);var F=Object(I.a)(K);function K(){var $;return Object(Y.a)(this,K),$=F.apply(this,arguments),$.selectRef=D.createRef(),$.focus=function(){$.selectRef.current.focus()},$.blur=function(){$.selectRef.current.blur()},$}return Object(M.a)(K,[{key:"render",value:function(){return D.createElement(A,Object.assign({ref:this.selectRef},this.props))}}]),K}(D.Component);P.Option=i,P.OptGroup=f;var w=P,U=he.c=w},NvD2:function(Me,he,B){"use strict";B.d(he,"a",function(){return E});var Y=B("Kwbf");function M(L,R){var _=new Set;return L.forEach(function(C){R.has(C)||_.add(C)}),_}function S(L){var R=L||{},_=R.disabled,C=R.disableCheckbox,y=R.checkable;return!!(_||C)||y===!1}function I(L,R,_,C){for(var y=new Set(L),T=new Set,O=0;O<=_;O+=1){var x=R.get(O)||new Set;x.forEach(function(t){var o=t.key,i=t.node,p=t.children,f=p===void 0?[]:p;y.has(o)&&!C(i)&&f.filter(function(s){return!C(s.node)}).forEach(function(s){y.add(s.key)})})}for(var v=new Set,g=_;g>=0;g-=1){var d=R.get(g)||new Set;d.forEach(function(t){var o=t.parent,i=t.node;if(C(i)||!t.parent||v.has(t.parent.key))return;if(C(t.parent.node)){v.add(o.key);return}var p=!0,f=!1;(o.children||[]).filter(function(s){return!C(s.node)}).forEach(function(s){var m=s.key,l=y.has(m);p&&!l&&(p=!1),!f&&(l||T.has(m))&&(f=!0)}),p&&y.add(o.key),f&&T.add(o.key),v.add(o.key)})}return{checkedKeys:Array.from(y),halfCheckedKeys:Array.from(M(T,y))}}function D(L,R,_,C,y){for(var T=new Set(L),O=new Set(R),x=0;x<=C;x+=1){var v=_.get(x)||new Set;v.forEach(function(o){var i=o.key,p=o.node,f=o.children,s=f===void 0?[]:f;!T.has(i)&&!O.has(i)&&!y(p)&&s.filter(function(m){return!y(m.node)}).forEach(function(m){T.delete(m.key)})})}O=new Set;for(var g=new Set,d=C;d>=0;d-=1){var t=_.get(d)||new Set;t.forEach(function(o){var i=o.parent,p=o.node;if(y(p)||!o.parent||g.has(o.parent.key))return;if(y(o.parent.node)){g.add(i.key);return}var f=!0,s=!1;(i.children||[]).filter(function(m){return!y(m.node)}).forEach(function(m){var l=m.key,a=T.has(l);f&&!a&&(f=!1),!s&&(a||O.has(l))&&(s=!0)}),f||T.delete(i.key),s&&O.add(i.key),g.add(i.key)})}return{checkedKeys:Array.from(T),halfCheckedKeys:Array.from(M(O,T))}}function E(L,R,_,C){var y=[],T;C?T=C:T=S;var O=new Set(L.filter(function(d){var t=!!_[d];return t||y.push(d),t})),x=new Map,v=0;Object.keys(_).forEach(function(d){var t=_[d],o=t.level,i=x.get(o);i||(i=new Set,x.set(o,i)),i.add(t),v=Math.max(v,o)}),Object(Y.a)(!y.length,"Tree missing follow keys: ".concat(y.slice(0,100).map(function(d){return"'".concat(d,"'")}).join(", ")));var g;return R===!0?g=I(O,x,v,T):g=D(O,R.halfCheckedKeys,x,v,T),g}},OZM5:function(Me,he,B){"use strict";B.d(he,"b",function(){return C}),B.d(he,"a",function(){return y}),B.d(he,"k",function(){return T}),B.d(he,"h",function(){return O}),B.d(he,"i",function(){return x}),B.d(he,"g",function(){return v}),B.d(he,"c",function(){return g}),B.d(he,"d",function(){return d}),B.d(he,"j",function(){return i}),B.d(he,"e",function(){return p}),B.d(he,"f",function(){return f});var Y=B("KQm4"),M=B("U8pU"),S=B("Ff2n"),I=B("cDcd"),D=B.n(I),E=B("Kwbf"),L=B("WaYH"),R=.25,_=2;function C(s,m){var l=s.slice(),a=l.indexOf(m);return a>=0&&l.splice(a,1),l}function y(s,m){var l=s.slice();return l.indexOf(m)===-1&&l.push(m),l}function T(s){return s.split("-")}function O(s,m){return"".concat(s,"-").concat(m)}function x(s){return s&&s.type&&s.type.isTreeNode}function v(s,m){var l=[s],a=m[s];function r(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];e.forEach(function(n){var c=n.key,h=n.children;l.push(c),r(h)})}return r(a.children),l}function g(s,m){var l=s.clientY,a=m.selectHandle.getBoundingClientRect(),r=a.top,e=a.bottom,n=a.height,c=Math.max(n*R,_);return l<=r+c?-1:l>=e-c?1:0}function d(s,m){if(!s)return;var l=m.multiple;return l?s.slice():s.length?[s[0]]:s}var t=function(m){return m};function o(s,m){if(!s)return[];var l=m||{},a=l.processProps,r=a===void 0?t:a,e=Array.isArray(s)?s:[s];return e.map(function(n){var c=n.children,h=Object(S.a)(n,["children"]),u=o(c,m);return D.a.createElement(L.a,Object.assign({},r(h)),u)})}function i(s){if(!s)return null;var m;if(Array.isArray(s))m={checkedKeys:s,halfCheckedKeys:void 0};else if(Object(M.a)(s)==="object")m={checkedKeys:s.checked||void 0,halfCheckedKeys:s.halfChecked||void 0};else return Object(E.a)(!1,"`checkedKeys` is not an array or an object"),null;return m}function p(s,m){var l=new Set;function a(r){if(l.has(r))return;var e=m[r];if(!e)return;l.add(r);var n=e.parent,c=e.node;if(c.disabled)return;n&&a(n.key)}return(s||[]).forEach(function(r){a(r)}),Object(Y.a)(l)}function f(s){var m={};return Object.keys(s).forEach(function(l){(l.startsWith("data-")||l.startsWith("aria-"))&&(m[l]=s[l])}),m}},"SA+Z":function(Me,he,B){var Y=B("wTVA"),M=B("EbDI"),S=B("ZhPi"),I=B("wkBT");function D(E){return Y(E)||M(E)||S(E)||I()}Me.exports=D,Me.exports.__esModule=!0,Me.exports.default=Me.exports},SJMd:function(Me,he){/**
|
|
* @license
|
|
* Copyright (C) 2006 Google Inc.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/var B,Y,M,S=!1,I,D;window.PR_SHOULD_USE_CONTINUATION=!0;var E,L;(function(){var R=window,_=["break,continue,do,else,for,if,return,while"],C=[_,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,restrict,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],y=[C,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],T=[y,"alignas,alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,noexcept,noreturn,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],O=[y,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],x=[y,"abstract,add,alias,as,ascending,async,await,base,bool,by,byte,checked,decimal,delegate,descending,dynamic,event,finally,fixed,foreach,from,get,global,group,implicit,in,interface,internal,into,is,join,let,lock,null,object,out,override,orderby,params,partial,readonly,ref,remove,sbyte,sealed,select,set,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,value,var,virtual,where,yield"],v="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes",g=[y,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],d="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",t=[_,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],o=[_,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],i=[_,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],p=[T,x,O,g,d,t,o,i],f=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,s="str",m="kwd",l="com",a="typ",r="lit",e="pun",n="pln",c="tag",h="dec",u="src",b="atn",A="atv",P="nocode",w="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function U(ye){for(var xe=0,be=!1,ie=!1,Se=0,ge=ye.length;Se<ge;++Se){var me=ye[Se];if(me.ignoreCase)ie=!0;else if(/[a-z]/i.test(me.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){be=!0,ie=!1;break}}var Ce={b:8,t:9,n:10,v:11,f:12,r:13};function Le(J){var q=J.charCodeAt(0);if(q!==92)return q;var se=J.charAt(1);return q=Ce[se],q||("0"<=se&&se<="7"?parseInt(J.substring(1),8):se==="u"||se==="x"?parseInt(J.substring(2),16):J.charCodeAt(1))}function _e(J){if(J<32)return(J<16?"\\x0":"\\x")+J.toString(16);var q=String.fromCharCode(J);return q==="\\"||q==="-"||q==="]"||q==="^"?"\\"+q:q}function Re(J){var q=J.substring(1,J.length-1).match(new RegExp("\\\\u[0-9A-Fa-f]{4}|\\\\x[0-9A-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\s\\S]|-|[^-\\\\]","g")),se=[],ce=q[0]==="^",Z=["["];ce&&Z.push("^");for(var ue=ce?1:0,V=q.length;ue<V;++ue){var G=q[ue];if(/\\[bdsw]/i.test(G))Z.push(G);else{var H=Le(G),k;ue+2<V&&q[ue+1]==="-"?(k=Le(q[ue+2]),ue+=2):k=H,se.push([H,k]),k<65||H>122||(k<65||H>90||se.push([Math.max(65,H)|32,Math.min(k,90)|32]),k<97||H>122||se.push([Math.max(97,H)&~32,Math.min(k,122)&~32]))}}se.sort(function(Q,ne){return Q[0]-ne[0]||ne[1]-Q[1]});for(var j=[],W=[],ue=0;ue<se.length;++ue){var z=se[ue];z[0]<=W[1]+1?W[1]=Math.max(W[1],z[1]):j.push(W=z)}for(var ue=0;ue<j.length;++ue){var z=j[ue];Z.push(_e(z[0])),z[1]>z[0]&&(z[1]+1>z[0]&&Z.push("-"),Z.push(_e(z[1])))}return Z.push("]"),Z.join("")}function Pe(J){for(var q=J.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g")),se=q.length,ce=[],Z=0,ue=0;Z<se;++Z){var V=q[Z];if(V==="(")++ue;else if(V.charAt(0)==="\\"){var G=+V.substring(1);G&&(G<=ue?ce[G]=-1:q[Z]=_e(G))}}for(var Z=1;Z<ce.length;++Z)ce[Z]===-1&&(ce[Z]=++xe);for(var Z=0,ue=0;Z<se;++Z){var V=q[Z];if(V==="(")++ue,ce[ue]||(q[Z]="(?:");else if(V.charAt(0)==="\\"){var G=+V.substring(1);G&&G<=ue&&(q[Z]="\\"+ce[G])}}for(var Z=0;Z<se;++Z)q[Z]==="^"&&q[Z+1]!=="^"&&(q[Z]="");if(J.ignoreCase&&be)for(var Z=0;Z<se;++Z){var V=q[Z],H=V.charAt(0);V.length>=2&&H==="["?q[Z]=Re(V):H!=="\\"&&(q[Z]=V.replace(/[a-zA-Z]/g,function(W){var z=W.charCodeAt(0);return"["+String.fromCharCode(z&~32,z|32)+"]"}))}return q.join("")}for(var we=[],Se=0,ge=ye.length;Se<ge;++Se){var me=ye[Se];if(me.global||me.multiline)throw new Error(""+me);we.push("(?:"+Pe(me)+")")}return new RegExp(we.join("|"),ie?"gi":"g")}function N(ye,xe){var be=/(?:^|\s)nocode(?:\s|$)/,ie=[],Se=0,ge=[],me=0;function Ce(Le){var _e=Le.nodeType;if(_e==1){if(be.test(Le.className))return;for(var Re=Le.firstChild;Re;Re=Re.nextSibling)Ce(Re);var Pe=Le.nodeName.toLowerCase();(Pe==="br"||Pe==="li")&&(ie[me]=`
|
|
`,ge[me<<1]=Se++,ge[me++<<1|1]=Le)}else if(_e==3||_e==4){var we=Le.nodeValue;we.length&&(xe?we=we.replace(/\r\n?/g,`
|
|
`):we=we.replace(/[ \t\r\n]+/g," "),ie[me]=we,ge[me<<1]=Se,Se+=we.length,ge[me++<<1|1]=Le)}}return Ce(ye),{sourceCode:ie.join("").replace(/\n$/,""),spans:ge}}function F(ye,xe,be,ie,Se){if(!be)return;var ge={sourceNode:ye,pre:1,langExtension:null,numberLines:null,sourceCode:be,spans:null,basePos:xe,decorations:null};ie(ge),Se.push.apply(Se,ge.decorations)}var K=/\S/;function $(ye){for(var xe=void 0,be=ye.firstChild;be;be=be.nextSibling){var ie=be.nodeType;xe=ie===1?xe?ye:be:ie===3&&K.test(be.nodeValue)?ye:xe}return xe===ye?void 0:xe}function X(ye,xe){var be={},ie;(function(){for(var me=ye.concat(xe),Ce=[],Le={},_e=0,Re=me.length;_e<Re;++_e){var Pe=me[_e],we=Pe[3];if(we)for(var J=we.length;--J>=0;)be[we.charAt(J)]=Pe;var q=Pe[1],se=""+q;Le.hasOwnProperty(se)||(Ce.push(q),Le[se]=null)}Ce.push(/[\0-\uffff]/),ie=U(Ce)})();var Se=xe.length,ge=function(me){for(var Ce=me.sourceCode,Le=me.basePos,_e=me.sourceNode,Re=[Le,n],Pe=0,we=Ce.match(ie)||[],J={},q=0,se=we.length;q<se;++q){var ce=we[q],Z=J[ce],ue=void 0,V;if(typeof Z=="string")V=!1;else{var G=be[ce.charAt(0)];if(G)ue=ce.match(G[1]),Z=G[0];else{for(var H=0;H<Se;++H)if(G=xe[H],ue=ce.match(G[1]),ue){Z=G[0];break}ue||(Z=n)}V=Z.length>=5&&Z.substring(0,5)==="lang-",V&&!(ue&&typeof ue[1]=="string")&&(V=!1,Z=u),V||(J[ce]=Z)}var k=Pe;if(Pe+=ce.length,!V)Re.push(Le+k,Z);else{var j=ue[1],W=ce.indexOf(j),z=W+j.length;ue[2]&&(z=ce.length-ue[2].length,W=z-j.length);var Q=Z.substring(5);F(_e,Le+k,ce.substring(0,W),ge,Re),F(_e,Le+k+W,j,te(Q,j),Re),F(_e,Le+k+z,ce.substring(z),ge,Re)}}me.decorations=Re};return ge}function oe(ye){var xe=[],be=[];ye.tripleQuotedStrings?xe.push([s,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):ye.multiLineStrings?xe.push([s,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):xe.push([s,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),ye.verbatimStrings&&be.push([s,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var ie=ye.hashComments;ie&&(ye.cStyleComments?(ie>1?xe.push([l,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):xe.push([l,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),be.push([s,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):xe.push([l,/^#[^\r\n]*/,null,"#"])),ye.cStyleComments&&(be.push([l,/^\/\/[^\r\n]*/,null]),be.push([l,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Se=ye.regexLiterals;if(Se){var ge=Se>1?"":`
|
|
\r`,me=ge?".":"[\\S\\s]",Ce="/(?=[^/*"+ge+"])(?:[^/\\x5B\\x5C"+ge+"]|\\x5C"+me+"|\\x5B(?:[^\\x5C\\x5D"+ge+"]|\\x5C"+me+")*(?:\\x5D|$))+/";be.push(["lang-regex",RegExp("^"+w+"("+Ce+")")])}var Le=ye.types;Le&&be.push([a,Le]);var _e=(""+ye.keywords).replace(/^ | $/g,"");_e.length&&be.push([m,new RegExp("^(?:"+_e.replace(/[\s,]+/g,"|")+")\\b"),null]),xe.push([n,/^\s+/,null,` \r
|
|
\xA0`]);var Re="^.[^\\s\\w.$@'\"`/\\\\]*";return ye.regexLiterals&&(Re+="(?!s*/)"),be.push([r,/^@[a-z_$][a-z_$@0-9]*/i,null],[a,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[n,/^[a-z_$][a-z_$@0-9]*/i,null],[r,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[n,/^\\[\s\S]?/,null],[e,new RegExp(Re),null]),X(xe,be)}var pe=oe({keywords:p,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function ee(ye,xe,be){for(var ie=/(?:^|\s)nocode(?:\s|$)/,Se=/\r\n?|\n/,ge=ye.ownerDocument,me=ge.createElement("li");ye.firstChild;)me.appendChild(ye.firstChild);var Ce=[me];function Le(q){var se=q.nodeType;if(se==1&&!ie.test(q.className))if(q.nodeName==="br")_e(q),q.parentNode&&q.parentNode.removeChild(q);else for(var ce=q.firstChild;ce;ce=ce.nextSibling)Le(ce);else if((se==3||se==4)&&be){var Z=q.nodeValue,ue=Z.match(Se);if(ue){var V=Z.substring(0,ue.index);q.nodeValue=V;var G=Z.substring(ue.index+ue[0].length);if(G){var H=q.parentNode;H.insertBefore(ge.createTextNode(G),q.nextSibling)}_e(q),V||q.parentNode.removeChild(q)}}}function _e(q){for(;!q.nextSibling;)if(q=q.parentNode,!q)return;function se(ue,V){var G=V?ue.cloneNode(!1):ue,H=ue.parentNode;if(H){var k=se(H,1),j=ue.nextSibling;k.appendChild(G);for(var W=j;W;W=j)j=W.nextSibling,k.appendChild(W)}return G}for(var ce=se(q.nextSibling,0),Z;(Z=ce.parentNode)&&Z.nodeType===1;)ce=Z;Ce.push(ce)}for(var Re=0;Re<Ce.length;++Re)Le(Ce[Re]);xe===(xe|0)&&Ce[0].setAttribute("value",xe);var Pe=ge.createElement("ol");Pe.className="linenums";for(var we=Math.max(0,xe-1|0)||0,Re=0,J=Ce.length;Re<J;++Re)me=Ce[Re],me.className="L"+(Re+we)%10,me.firstChild||me.appendChild(ge.createTextNode("\xA0")),Pe.appendChild(me);ye.appendChild(Pe)}function de(ye){var xe=/\bMSIE\s(\d+)/.exec(navigator.userAgent);xe=xe&&+xe[1]<=8;var be=/\n/g,ie=ye.sourceCode,Se=ie.length,ge=0,me=ye.spans,Ce=me.length,Le=0,_e=ye.decorations,Re=_e.length,Pe=0;_e[Re]=Se;var we,J;for(J=we=0;J<Re;)_e[J]!==_e[J+2]?(_e[we++]=_e[J++],_e[we++]=_e[J++]):J+=2;for(Re=we,J=we=0;J<Re;){for(var q=_e[J],se=_e[J+1],ce=J+2;ce+2<=Re&&_e[ce+1]===se;)ce+=2;_e[we++]=q,_e[we++]=se,J=ce}Re=_e.length=we;var Z=ye.sourceNode,ue="";Z&&(ue=Z.style.display,Z.style.display="none");try{for(var V=null;Le<Ce;){var G=me[Le],H=me[Le+2]||Se,k=_e[Pe+2]||Se,ce=Math.min(H,k),j=me[Le+1],W;if(j.nodeType!==1&&(W=ie.substring(ge,ce))){xe&&(W=W.replace(be,"\r")),j.nodeValue=W;var z=j.ownerDocument,Q=z.createElement("span");Q.className=_e[Pe+1];var ne=j.parentNode;ne.replaceChild(Q,j),Q.appendChild(j),ge<H&&(me[Le+1]=j=z.createTextNode(ie.substring(ce,H)),ne.insertBefore(j,Q.nextSibling))}ge=ce,ge>=H&&(Le+=2),ge>=k&&(Pe+=2)}}finally{Z&&(Z.style.display=ue)}}var le={};function re(ye,xe){for(var be=xe.length;--be>=0;){var ie=xe[be];le.hasOwnProperty(ie)?R.console&&console.warn("cannot override language handler %s",ie):le[ie]=ye}}function te(ye,xe){return ye&&le.hasOwnProperty(ye)||(ye=/^\s*</.test(xe)?"default-markup":"default-code"),le[ye]}re(pe,["default-code"]),re(X([],[[n,/^[^<?]+/],[h,/^<!\w[^>]*(?:>|$)/],[l,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[e,/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),re(X([[n,/^[\s]+/,null,` \r
|
|
`],[A,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[c,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[b,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[e,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]),re(X([],[[A,/^[\s\S]+/]]),["uq.val"]),re(oe({keywords:T,hashComments:!0,cStyleComments:!0,types:f}),["c","cc","cpp","cxx","cyc","m"]),re(oe({keywords:"null,true,false"}),["json"]),re(oe({keywords:x,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:f}),["cs"]),re(oe({keywords:O,cStyleComments:!0}),["java"]),re(oe({keywords:i,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),re(oe({keywords:t,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),re(oe({keywords:d,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),re(oe({keywords:o,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),re(oe({keywords:g,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),re(oe({keywords:v,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),re(X([],[[s,/^[\s\S]+/]]),["regex"]);function Te(ye){var xe=ye.langExtension;try{var be=N(ye.sourceNode,ye.pre),ie=be.sourceCode;ye.sourceCode=ie,ye.spans=be.spans,ye.basePos=0,te(xe,ie)(ye),de(ye)}catch(Se){R.console&&console.log(Se&&Se.stack||Se)}}function Ie(ye,xe,be){var ie=be||!1,Se=xe||null,ge=document.createElement("div");ge.innerHTML="<pre>"+ye+"</pre>",ge=ge.firstChild,ie&&ee(ge,ie,!0);var me={langExtension:Se,numberLines:ie,sourceNode:ge,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return Te(me),ge.innerHTML}function Ae(ye,xe){var be=xe||document.body,ie=be.ownerDocument||document;function Se(G){return be.getElementsByTagName(G)}for(var ge=[Se("pre"),Se("code"),Se("xmp")],me=[],Ce=0;Ce<ge.length;++Ce)for(var Le=0,_e=ge[Ce].length;Le<_e;++Le)me.push(ge[Ce][Le]);ge=null;var Re=Date;Re.now||(Re={now:function(){return+new Date}});var Pe=0,we=/\blang(?:uage)?-([\w.]+)(?!\S)/,J=/\bprettyprint\b/,q=/\bprettyprinted\b/,se=/pre|xmp/i,ce=/^code$/i,Z=/^(?:pre|code|xmp)$/i,ue={};function V(){for(var G=R.PR_SHOULD_USE_CONTINUATION?Re.now()+250:Infinity;Pe<me.length&&Re.now()<G;Pe++){for(var H=me[Pe],k=ue,j=H;j=j.previousSibling;){var W=j.nodeType,z=(W===7||W===8)&&j.nodeValue;if(z?!/^\??prettify\b/.test(z):W!==3||/\S/.test(j.nodeValue))break;if(z){k={},z.replace(/\b(\w+)=([\w:.%+-]+)/g,function($e,Ne,Ve){k[Ne]=Ve});break}}var Q=H.className;if((k!==ue||J.test(Q))&&!q.test(Q)){for(var ne=!1,ae=H.parentNode;ae;ae=ae.parentNode){var ve=ae.tagName;if(Z.test(ve)&&ae.className&&J.test(ae.className)){ne=!0;break}}if(!ne){H.className+=" prettyprinted";var Oe=k.lang;if(!Oe){Oe=Q.match(we);var Ee;!Oe&&(Ee=$(H))&&ce.test(Ee.tagName)&&(Oe=Ee.className.match(we)),Oe&&(Oe=Oe[1])}var Be;if(se.test(H.tagName))Be=1;else{var Ue=H.currentStyle,ke=ie.defaultView,He=Ue?Ue.whiteSpace:ke&&ke.getComputedStyle?ke.getComputedStyle(H,null).getPropertyValue("white-space"):0;Be=He&&He.substring(0,3)==="pre"}var Ke=k.linenums;(Ke=Ke==="true"||+Ke)||(Ke=Q.match(/\blinenums\b(?::(\d+))?/),Ke=Ke?Ke[1]&&Ke[1].length?+Ke[1]:!0:!1),Ke&&ee(H,Ke,Be);var je={langExtension:Oe,sourceNode:H,numberLines:Ke,pre:Be,sourceCode:null,basePos:null,spans:null,decorations:null};Te(je)}}}Pe<me.length?R.setTimeout(V,250):typeof ye=="function"&&ye()}V()}var De=R.PR={createSimpleLexer:X,registerLangHandler:re,sourceDecorator:oe,PR_ATTRIB_NAME:b,PR_ATTRIB_VALUE:A,PR_COMMENT:l,PR_DECLARATION:h,PR_KEYWORD:m,PR_LITERAL:r,PR_NOCODE:P,PR_PLAIN:n,PR_PUNCTUATION:e,PR_SOURCE:u,PR_STRING:s,PR_TAG:c,PR_TYPE:a,prettyPrintOne:S?R.prettyPrintOne=Ie:E=Ie,prettyPrint:L=S?R.prettyPrint=Ae:L=Ae},fe=R.define;typeof fe=="function"&&fe.amd&&fe("google-code-prettify",[],function(){return De})})()},WaYH:function(Me,he,B){"use strict";var Y=B("rePB"),M=B("Ff2n"),S=B("VTBJ"),I=B("1OyB"),D=B("vuIU"),E=B("JX7q"),L=B("Ji7U"),R=B("LK+K"),_=B("cDcd"),C=B("TSYQ"),y=B.n(C),T=B("sboe"),O=B("OZM5"),x=function(m){var l=m.prefixCls,a=m.level,r=m.isStart,e=m.isEnd;if(!a)return null;for(var n="".concat(l,"-indent-unit"),c=[],h=0;h<a;h+=1){var u;c.push(_.createElement("span",{key:h,className:y()(n,(u={},Object(Y.a)(u,"".concat(n,"-start"),r[h+1]),Object(Y.a)(u,"".concat(n,"-end"),e[h+1]),Object(Y.a)(u,"".concat(n,"-end-first-level"),!h&&e[0]),u))}))}return _.createElement("span",{"aria-hidden":"true",className:"".concat(l,"-indent")},c)},v=x,g=B("815F"),d="open",t="close",o="---",i=function(s){Object(L.a)(l,s);var m=Object(R.a)(l);function l(){var a;return Object(I.a)(this,l),a=m.apply(this,arguments),a.state={dragNodeHighlight:!1},a.onSelectorClick=function(r){var e=a.props.context.onNodeClick;e(r,Object(g.b)(a.props)),a.isSelectable()?a.onSelect(r):a.onCheck(r)},a.onSelectorDoubleClick=function(r){var e=a.props.context.onNodeDoubleClick;e(r,Object(g.b)(a.props))},a.onSelect=function(r){if(a.isDisabled())return;var e=a.props.context.onNodeSelect;r.preventDefault(),e(r,Object(g.b)(a.props))},a.onCheck=function(r){if(a.isDisabled())return;var e=a.props,n=e.disableCheckbox,c=e.checked,h=a.props.context.onNodeCheck;if(!a.isCheckable()||n)return;r.preventDefault();var u=!c;h(r,Object(g.b)(a.props),u)},a.onMouseEnter=function(r){var e=a.props.context.onNodeMouseEnter;e(r,Object(g.b)(a.props))},a.onMouseLeave=function(r){var e=a.props.context.onNodeMouseLeave;e(r,Object(g.b)(a.props))},a.onContextMenu=function(r){var e=a.props.context.onNodeContextMenu;e(r,Object(g.b)(a.props))},a.onDragStart=function(r){var e=a.props.context.onNodeDragStart;r.stopPropagation(),a.setState({dragNodeHighlight:!0}),e(r,Object(E.a)(a));try{r.dataTransfer.setData("text/plain","")}catch(n){}},a.onDragEnter=function(r){var e=a.props.context.onNodeDragEnter;r.preventDefault(),r.stopPropagation(),e(r,Object(E.a)(a))},a.onDragOver=function(r){var e=a.props.context.onNodeDragOver;r.preventDefault(),r.stopPropagation(),e(r,Object(E.a)(a))},a.onDragLeave=function(r){var e=a.props.context.onNodeDragLeave;r.stopPropagation(),e(r,Object(E.a)(a))},a.onDragEnd=function(r){var e=a.props.context.onNodeDragEnd;r.stopPropagation(),a.setState({dragNodeHighlight:!1}),e(r,Object(E.a)(a))},a.onDrop=function(r){var e=a.props.context.onNodeDrop;r.preventDefault(),r.stopPropagation(),a.setState({dragNodeHighlight:!1}),e(r,Object(E.a)(a))},a.onExpand=function(r){var e=a.props.context.onNodeExpand;e(r,Object(g.b)(a.props))},a.setSelectHandle=function(r){a.selectHandle=r},a.getNodeState=function(){var r=a.props.expanded;return a.isLeaf()?null:r?d:t},a.hasChildren=function(){var r=a.props.eventKey,e=a.props.context.keyEntities,n=e[r]||{},c=n.children;return!!(c||[]).length},a.isLeaf=function(){var r=a.props,e=r.isLeaf,n=r.loaded,c=a.props.context.loadData,h=a.hasChildren();return e===!1?!1:e||!c&&!h||c&&n&&!h},a.isDisabled=function(){var r=a.props.disabled,e=a.props.context.disabled;return!!(e||r)},a.isCheckable=function(){var r=a.props.checkable,e=a.props.context.checkable;return!e||r===!1?!1:e},a.syncLoadData=function(r){var e=r.expanded,n=r.loading,c=r.loaded,h=a.props.context,u=h.loadData,b=h.onNodeLoad;if(n)return;u&&e&&!a.isLeaf()&&(!a.hasChildren()&&!c&&b(Object(g.b)(a.props)))},a.renderSwitcher=function(){var r=a.props,e=r.expanded,n=r.switcherIcon,c=a.props.context,h=c.prefixCls,u=c.switcherIcon,b=n||u;if(a.isLeaf())return _.createElement("span",{className:y()("".concat(h,"-switcher"),"".concat(h,"-switcher-noop"))},typeof b=="function"?b(Object(S.a)(Object(S.a)({},a.props),{},{isLeaf:!0})):b);var A=y()("".concat(h,"-switcher"),"".concat(h,"-switcher_").concat(e?d:t));return _.createElement("span",{onClick:a.onExpand,className:A},typeof b=="function"?b(Object(S.a)(Object(S.a)({},a.props),{},{isLeaf:!1})):b)},a.renderCheckbox=function(){var r=a.props,e=r.checked,n=r.halfChecked,c=r.disableCheckbox,h=a.props.context.prefixCls,u=a.isDisabled(),b=a.isCheckable();if(!b)return null;var A=typeof b!="boolean"?b:null;return _.createElement("span",{className:y()("".concat(h,"-checkbox"),e&&"".concat(h,"-checkbox-checked"),!e&&n&&"".concat(h,"-checkbox-indeterminate"),(u||c)&&"".concat(h,"-checkbox-disabled")),onClick:a.onCheck},A)},a.renderIcon=function(){var r=a.props.loading,e=a.props.context.prefixCls;return _.createElement("span",{className:y()("".concat(e,"-iconEle"),"".concat(e,"-icon__").concat(a.getNodeState()||"docu"),r&&"".concat(e,"-icon_loading"))})},a.renderSelector=function(){var r=a.state.dragNodeHighlight,e=a.props,n=e.title,c=e.selected,h=e.icon,u=e.loading,b=e.data,A=a.props.context,P=A.prefixCls,w=A.showIcon,U=A.icon,N=A.draggable,F=A.loadData,K=A.titleRender,$=a.isDisabled(),X="".concat(P,"-node-content-wrapper"),oe;if(w){var pe=h||U;oe=pe?_.createElement("span",{className:y()("".concat(P,"-iconEle"),"".concat(P,"-icon__customize"))},typeof pe=="function"?pe(a.props):pe):a.renderIcon()}else F&&u&&(oe=a.renderIcon());var ee;typeof n=="function"?ee=n(b):K?ee=K(b):ee=n;var de=_.createElement("span",{className:"".concat(P,"-title")},ee);return _.createElement("span",{ref:a.setSelectHandle,title:typeof n=="string"?n:"",className:y()("".concat(X),"".concat(X,"-").concat(a.getNodeState()||"normal"),!$&&(c||r)&&"".concat(P,"-node-selected"),!$&&N&&"draggable"),draggable:!$&&N||void 0,"aria-grabbed":!$&&N||void 0,onMouseEnter:a.onMouseEnter,onMouseLeave:a.onMouseLeave,onContextMenu:a.onContextMenu,onClick:a.onSelectorClick,onDoubleClick:a.onSelectorDoubleClick,onDragStart:N?a.onDragStart:void 0},oe,de)},a}return Object(D.a)(l,[{key:"componentDidMount",value:function(){this.syncLoadData(this.props)}},{key:"componentDidUpdate",value:function(){this.syncLoadData(this.props)}},{key:"isSelectable",value:function(){var r=this.props.selectable,e=this.props.context.selectable;return typeof r=="boolean"?r:e}},{key:"render",value:function(){var r,e=this.props,n=e.eventKey,c=e.className,h=e.style,u=e.dragOver,b=e.dragOverGapTop,A=e.dragOverGapBottom,P=e.isLeaf,w=e.isStart,U=e.isEnd,N=e.expanded,F=e.selected,K=e.checked,$=e.halfChecked,X=e.loading,oe=e.domRef,pe=e.active,ee=e.onMouseMove,de=Object(M.a)(e,["eventKey","className","style","dragOver","dragOverGapTop","dragOverGapBottom","isLeaf","isStart","isEnd","expanded","selected","checked","halfChecked","loading","domRef","active","onMouseMove"]),le=this.props.context,re=le.prefixCls,te=le.filterTreeNode,Te=le.draggable,Ie=le.keyEntities,Ae=this.isDisabled(),De=Object(O.f)(de),fe=Ie[n]||{},ye=fe.level,xe=U[U.length-1];return _.createElement("div",Object.assign({ref:oe,className:y()(c,"".concat(re,"-treenode"),(r={},Object(Y.a)(r,"".concat(re,"-treenode-disabled"),Ae),Object(Y.a)(r,"".concat(re,"-treenode-switcher-").concat(N?"open":"close"),!P),Object(Y.a)(r,"".concat(re,"-treenode-checkbox-checked"),K),Object(Y.a)(r,"".concat(re,"-treenode-checkbox-indeterminate"),$),Object(Y.a)(r,"".concat(re,"-treenode-selected"),F),Object(Y.a)(r,"".concat(re,"-treenode-loading"),X),Object(Y.a)(r,"".concat(re,"-treenode-active"),pe),Object(Y.a)(r,"".concat(re,"-treenode-leaf-last"),xe),Object(Y.a)(r,"drag-over",!Ae&&u),Object(Y.a)(r,"drag-over-gap-top",!Ae&&b),Object(Y.a)(r,"drag-over-gap-bottom",!Ae&&A),Object(Y.a)(r,"filter-node",te&&te(Object(g.b)(this.props))),r)),style:h,onDragEnter:Te?this.onDragEnter:void 0,onDragOver:Te?this.onDragOver:void 0,onDragLeave:Te?this.onDragLeave:void 0,onDrop:Te?this.onDrop:void 0,onDragEnd:Te?this.onDragEnd:void 0,onMouseMove:ee},De),_.createElement(v,{prefixCls:re,level:ye,isStart:w,isEnd:U}),this.renderSwitcher(),this.renderCheckbox(),this.renderSelector())}}]),l}(_.Component),p=function(m){return _.createElement(T.a.Consumer,null,function(l){return _.createElement(i,Object.assign({},m,{context:l}))})};p.displayName="TreeNode",p.defaultProps={title:o},p.isTreeNode=1;var f=he.a=p},ZW9T:function(Me,he,B){"use strict";B.d(he,"a",function(){return f});var Y=B("k1fw"),M=B("miYZ"),S=B("tsqr"),I=B("rAM+"),D=B("tJVT"),E=B("PpiC"),L=B("cDcd"),R=B.n(L),_=B("bdgK");function C(s,m,l,a,r){var e=m.getWordUntilPosition(l),n={startLineNumber:l.lineNumber,endLineNumber:l.lineNumber,startColumn:e.startColumn,endColumn:e.endColumn},c=a.map(function(h){return{label:h,kind:s.languages.CompletionItemKind.Keyword,insertText:h,insertTextRules:s.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:n}});return r.map(function(h){c.push(Object(Y.a)(Object(Y.a)({},h),{},{range:n}))}),c}var y=function(s){var m={label:"ifelse",kind:s.languages.CompletionItemKind.Method,insertText:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
|
|
`),insertTextRules:s.languages.CompletionItemInsertTextRule.InsertAsSnippet},l=["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","inline","restrict","_Bool","_Complex","_Imaginary","_Alignas","_Alignof","_Atomic","_Static_assert","_Noreturn","_Thread_local","_Generic"];s.languages.registerCompletionItemProvider("cpp",{provideCompletionItems:function(n,c){var h=C(s,n,c,l,[m]);return{suggestions:h}}});var a=["False","None","True","and","as","assert","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","nonlocal","not","or","pass","raise","return","try","while","with","yield"];s.languages.registerCompletionItemProvider("python",{provideCompletionItems:function(n,c){var h=[{label:"print",kind:s.languages.CompletionItemKind.Snippet,insertText:["print($0)"].join(`
|
|
`),insertTextRules:s.languages.CompletionItemInsertTextRule.InsertAsSnippet}],u=C(s,n,c,a,h);return{suggestions:u}}});var r=["abstract","assert","boolean","break","byte","case","catch","char","class","const","continue","default","do","double","else","enum","extends","final","finally","float","for","goto","if","implements","import","instance of","int","interface","long","native","new","package","private","protected","public","return","strictfp","short","static","super","switch","synchronized","this","throw","throws","transient","try","void","volatile","while"];s.languages.registerCompletionItemProvider("java",{provideCompletionItems:function(n,c){var h=[m,{label:"main",kind:s.languages.CompletionItemKind.Snippet,insertText:["public static void main(String[] args) {"," $0","}"].join(`
|
|
`),insertTextRules:s.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"System.out.print",kind:s.languages.CompletionItemKind.Snippet,insertText:["System.out.print($0)"].join(`
|
|
`),insertTextRules:s.languages.CompletionItemInsertTextRule.InsertAsSnippet}],u=C(s,n,c,r,h);return{suggestions:u}}})},T="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",O=B("LvDl"),x=B("+ua5");function v(s){return/^\d+$/.test(s)?"".concat(s,"px"):s}function g(){}var d=!1,t={"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"};function o(){var s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],m=s;if(Array.isArray(s)){for(var l=0;l<s.length;l++){var a=t[s[l]];if(a)return a}return m[0]}return t[m]||m}var i=null,p=he.b=function(s){var m=s.width,l=m===void 0?"100%":m,a=s.height,r=a===void 0?"100%":a,e=s.value,n=s.language,c=n===void 0?"javascript":n,h=s.style,u=h===void 0?{}:h,b=s.options,A=b===void 0?{}:b,P=s.overrideServices,w=P===void 0?{}:P,U=s.theme,N=U===void 0?"vs-dark":U,F=s.onEditBlur,K=s.onSave,$=s.autoHeight,X=$===void 0?!1:$,oe=s.forbidCopy,pe=oe===void 0?!1:oe,ee=s.onChange,de=ee===void 0?g:ee,le=s.editorDidMount,re=le===void 0?g:le,te=s.onFocus,Te=te===void 0?g:te,Ie=s.filename,Ae=Ie===void 0?"educoder.txt":Ie,De=s.errorLine,fe=s.errorContent,ye=fe===void 0?"":fe,xe=Object(E.a)(s,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename","errorLine","errorContent"]),be=Object(L.useRef)(),ie=Object(L.useRef)({}),Se=Object(L.useRef)(),ge=Object(L.useRef)(!1),me=Object(L.useRef)(),Ce=Object(L.useState)(!1),Le=Object(D.a)(Ce,2),_e=Le[0],Re=Le[1];function Pe(){var ae;return be.current&&(ae=new _.default(function(ve){var Oe=Object(I.a)(ve),Ee;try{for(Oe.s();!(Ee=Oe.n()).done;){var Be=Ee.value;(Be.target.offsetHeight>0||Be.target.offsetWidth>0)&&ie.current.instance.layout()}}catch(Ue){Oe.e(Ue)}finally{Oe.f()}}),ae.observe(be.current)),ae}function we(){S.b.warn(decodeURIComponent(T))}var J=function(){var ve=ie.current.instance;if(e!=null&&ve&&_e){var Oe=ve.getModel();Oe&&e!==Oe.getValue()&&(d=!0,Oe.setValue(e),ve.layout(),d=!1)}};Object(L.useEffect)(function(){Se.current&&clearTimeout(Se.current),Se.current=setTimeout(function(){J()},500)},[e,_e,ie.current]),Object(L.useEffect)(function(){if(De&&ie.current&&ie.current.instance){var ae=ie.current.instance;ae.changeViewZones(function(Oe){var Ee=document.createElement("div");Ee.style.padding="10px 20px",Ee.style.width="calc(100% - 20px)",Ee.className="my-error-line-wrp",Ee.innerHTML=ye,Oe.addZone({afterLineNumber:De||11,heightInLines:3,domNode:Ee})});var ve={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}};ae.addOverlayWidget(ve),ae.revealPositionInCenter({lineNumber:20,column:1})}},[De,ie.current,_e]);function q(){var ae=ie.current.instance;if(ae){var ve=ae.getSelection(),Oe=ie.current.pastePos||{},Ee=new i.Range(Oe.startLineNumber||ve.endLineNumber,Oe.startColumn||ve.endColumn,Oe.endLineNumber||ve.endLineNumber,Oe.endColumn||ve.endColumn);setTimeout(function(){ae.executeEdits("",[{range:Ee,text:""}])},300)}}function se(ae){(window.navigator.platform.match("Mac")?ae.metaKey:ae.ctrlKey)&&ae.keyCode==83&&(ae.preventDefault(),K())}var ce=function(){if(X&&ie.current.instance){var ve=ie.current.instance.getContentHeight();Q(ve<r?r:ve)}else Q(r)};function Z(ae){var ve=document.createEvent("MouseEvents");ve.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),ae.dispatchEvent(ve)}function ue(ae,ve){var Oe=window.URL||window.webkitURL||window,Ee=new Blob([ve]),Be=document.createElementNS("http://www.w3.org/1999/xhtml","a");Be.href=Oe.createObjectURL(Ee),Be.download=ae,Z(Be)}Object(L.useEffect)(function(){ce()},[ce]),Object(L.useEffect)(function(){be.current&&!_e&&B.e(27).then(B.t.bind(null,"M/lh",7)).then(function(ae){try{i=ae,ie.current.instance=i.editor.create(be.current,{value:e,language:o(c),theme:N,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0},w);var ve=ie.current.instance;if(re(ve,i),setTimeout(function(){ce(),ie.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){ue(Ae||"educoder.txt",ve.getValue())}})},500),ie.current.subscription=ve.onDidChangeModelContent(function(Ee){ge.current?clearTimeout(me.current):(ce(),de(ve.getValue(),Ee)),me.current=setTimeout(function(){ge.current=!1},500)}),window.Monaco||y(i),pe&&(ve.addCommand(i.KeyMod.CtrlCmd|i.KeyMod.Shift|i.KeyCode.KEY_V,function(){return we(),null}),ve.addCommand(i.KeyMod.CtrlCmd|i.KeyCode.KEY_C,function(){return we(),null})),window.Monaco=i,F&&ve.onDidBlurEditorWidget(function(){F(ve.getValue())}),Te&&ve.onDidFocusEditorText(function(){Te(ve.getValue())}),pe){ve.addCommand(i.KeyMod.CtrlCmd|i.KeyCode.KEY_V,function(){return we(),null}),ve.onDidPaste(function(Ee){ie.current.pastePos=Ee});try{window.addEventListener("paste",q)}catch(Ee){}}var Oe=Pe();return Re(!0),function(){var Ee=ie.current.instance;Ee.dispose();var Be=Ee.getModel();Be&&Be.dispose(),ie.current.subscription&&ie.current.subscription.dispose(),pe&&window.removeEventListener("paste",q),Oe.unobserve(be.current)}}catch(Ee){}})},[]),Object(L.useEffect)(function(){var ae=ie.current.instance;if(ae&&_e)return document.addEventListener("keydown",se,!1),function(){document.removeEventListener("keydown",se)}},[K,_e]),Object(L.useEffect)(function(){var ae=ie.current.instance;if(ae&&_e){var ve=o(c);i.editor.setModelLanguage(ae.getModel(),ve),console.log("language:",c,ae.getModel(),ve)}},[c,_e]),Object(L.useEffect)(function(){var ae=ie.current.instance;ae&&_e&&i.editor.setTheme(N)},[N,_e]),Object(L.useEffect)(function(){var ae=ie.current.instance;ae&&_e&&(ae.updateOptions(Object(Y.a)({},A)),setTimeout(function(){ae.getModel().updateOptions(Object(Y.a)({},A))},200))},[JSON.stringify(A),_e]),Object(L.useEffect)(function(){var ae=ie.current.instance;ae&&_e&&ae.layout()},[l,r,_e]);var V=Object(L.useState)(v(l)),G=Object(D.a)(V,2),H=G[0],k=G[1],j=Object(L.useState)(v(r)),W=Object(D.a)(j,2),z=W[0],Q=W[1],ne=Object(Y.a)(Object(Y.a)({},u),{},{width:H,height:z});return R.a.createElement("div",{className:"my-monaco-editor",ref:be,style:ne})};function f(s){var m=s.width,l=m===void 0?"100%":m,a=s.height,r=a===void 0?"100%":a,e=s.original,n=s.modified,c=s.language,h=s.options,u=h===void 0?{}:h,b=Object(L.useRef)(),A=Object(L.useState)(null),P=Object(D.a)(A,2),w=P[0],U=P[1];function N(X){var oe;return b.current&&(oe=new _.default(function(pe){var ee=Object(I.a)(pe),de;try{for(ee.s();!(de=ee.n()).done;){var le=de.value;(le.target.offsetHeight>0||le.target.offsetWidth>0)&&X.layout()}}catch(re){ee.e(re)}finally{ee.f()}}),oe.observe(b.current)),oe}Object(L.useEffect)(function(){b.current&&B.e(27).then(B.t.bind(null,"M/lh",7)).then(function(X){i=X;var oe=i.editor.createDiffEditor(b.current,Object(Y.a)(Object(Y.a)({enableSplitViewResizing:!1,scrollBeyondLastLine:!1,roundedSelection:!1,renderIndicators:!1,useShadows:!1,horizontal:"hidden",lineNumbers:"off",ignoreTrimWhitespace:!1,followsCaret:!0,ignoreCharChanges:!0,minimap:{enabled:!1},readOnly:!0},u),{},{wordWrap:!0}));U(oe);var pe=N(oe);return function(){oe.dispose();var ee=oe.getModel();ee&&ee.dispose(),pe.unobserve(b.current)}})},[]),Object(L.useEffect)(function(){w&&w.setModel({original:i.editor.createModel(e,c),modified:i.editor.createModel(n,c)})},[e,n,c,w]);var F=v(l),K=v(r),$={width:F,height:K};return R.a.createElement("div",{className:"my-diff-editor",ref:b,style:$})}},bTeP:function(Me,he,B){Me.exports={flex_box_center:"flex_box_center___14Ki3",flex_space_between:"flex_space_between___3TSad",flex_box_vertical_center:"flex_box_vertical_center___3pQXk",flex_box_center_end:"flex_box_center_end___29_cn",flex_box_column:"flex_box_column___16am0",title:"title___2mVJs",workListTabWrap:"workListTabWrap___1JlOB",workListTabButton:"workListTabButton___3umfp",tables:"tables___hLy6a",checkboxgroup:"checkboxgroup___2xMgu"}},biw7:function(Me,he,B){"use strict";var Y=B("cDcd"),M=B.n(Y),S=Y.createContext(null);he.a=S},deN7:function(Me,he,B){"use strict";var Y=B("/zsF"),M=B("PArb"),S=B("14J3"),I=B("BMrR"),D=B("jCWc"),E=B("kPKH"),L=B("+L6B"),R=B("2/Rp"),_=B("miYZ"),C=B("tsqr"),y=B("9og8"),T=B("giR+"),O=B("fyUT"),x=B("2qtc"),v=B("kLXV"),g=B("7Kak"),d=B("9yH6"),t=B("tJVT"),o=B("k1fw"),i=B("OaEy"),p=B("2fM7"),f=B("WmNS"),s=B.n(f),m=B("cDcd"),l=B.n(m),a=B("ZW9T"),r=B("F0VM"),e=B.n(r),n=B("xKgJ"),c=B("J66h"),h=B.n(c),u=B("ErOA"),b=B("Ty5D"),A=B("9Bee"),P=B("XYT7"),w=B("RCxd"),U=B("/MfK"),N=p.a.Option,F={selectOnLineNumbers:!0,readOnly:!0,minimap:{enabled:!1},scrollBeyondLastLine:!1,enableSplitViewResizing:!1,roundedSelection:!1,renderIndicators:!1,useShadows:!1},K;(function(X){X[X.SET_PATH=0]="SET_PATH",X[X.GET_PASSED_CONTENT=1]="GET_PASSED_CONTENT"})(K||(K={}));function $(X,oe){switch(oe.type){case K.SET_PATH:return Object(o.a)(Object(o.a)({},X),{},{selectedPath:oe.payload});case K.GET_PASSED_CONTENT:return Object(o.a)(Object(o.a)({},X),{},{passedContent:oe.payload});default:throw new Error}}he.a=function(X){var oe=X.language,pe=X.dispatch,ee=X.shixunWorkReport,de=X.v,le=X.languages,re=X.onPathChange,te=X.autoHeight,Te=X.diff_code_count,Ie=X.data,Ae=Object(m.useState)(le==null?void 0:le[0]),De=Object(t.a)(Ae,2),fe=De[0],ye=De[1],xe=ee!="shixunWorkReport"&&Object(b.i)();return Object(m.useEffect)(function(){ye(le==null?void 0:le[0])},[]),Object(m.useEffect)(function(){var be;ye(le==null||((be=le.filter(function(ie){return ie.language===(fe==null?void 0:fe.language)}))===null||be===void 0)?void 0:be[0])},[le]),l.a.createElement(l.a.Fragment,null,l.a.createElement("h2",null," ",l.a.createElement("span",null,l.a.createElement("span",null,"\u6700\u540E\u901A\u5173\u7684\u4EE3\u7801"),(le==null?void 0:le.length)>1&&l.a.createElement(d.a.Group,{defaultValue:oe,style:{marginLeft:10},onChange:function(ie){var Se;ye(le==null||((Se=le.filter(function(ge){return ge.language===ie.target.value}))===null||Se===void 0)?void 0:Se[0])}},le==null?void 0:le.map(function(be){return l.a.createElement(d.a,{value:be==null?void 0:be.language},be==null?void 0:be.language)}))),Object(n.c)()&&ee!="shixunWorkReport"&&l.a.createElement("span",null,l.a.createElement("span",null,"\u5F97\u5206 ",fe==null?void 0:fe.score,"/",fe==null?void 0:fe.total_score),l.a.createElement(R.a,{style:{margin:"0px 10px"},onClick:function(){var ie=fe==null?void 0:fe.score;v.a.confirm({title:"\u8C03\u5206",content:l.a.createElement("div",null,l.a.createElement("p",null,"\u5F97\u5206\uFF1A",fe==null?void 0:fe.score,"/",fe==null?void 0:fe.total_score),l.a.createElement("p",null,"\u8C03\u5206\uFF1A",l.a.createElement(O.a,{min:0,max:fe==null?void 0:fe.total_score,defaultValue:fe==null?void 0:fe.score,onChange:function(ge){ie=ge}}))),okText:"\u786E\u8BA4",onOk:function(){var Se=Object(y.a)(s.a.mark(function me(){var Ce;return s.a.wrap(function(_e){for(;;)switch(_e.prev=_e.next){case 0:return _e.next=2,Object(u.a)("/api/courses/".concat(xe==null?void 0:xe.coursesId,"/homework_commons/update_hack_score"),{method:"put",body:{course_id:xe==null?void 0:xe.coursesId,hack_user_code_id:fe==null?void 0:fe.hack_user_id,score:ie}});case 2:Ce=_e.sent,Ce.status===0&&(C.b.success("\u8C03\u5206\u6210\u529F"),pe({type:"shixunHomeworks/setActionTabs",payload:{}}),pe({type:"shixunHomeworks/getShixunWorkReports",payload:Object(o.a)({},xe)}));case 4:case"end":return _e.stop()}},me)}));function ge(){return Se.apply(this,arguments)}return ge}(),cancelText:"\u53D6\u6D88"})},type:"primary"},"\u8C03\u5206"),Object(n.c)()&&ee!="shixunWorkReport"&&l.a.createElement(R.a,{onClick:function(){pe({type:"shixunHomeworks/setActionTabs",payload:{key:"\u66F4\u6539\u70B9\u8BC4",selectArrs:{myshixun_identifier:ee.user_id,type:"1",language:fe==null?void 0:fe.language,v:de,data:Object(o.a)({},ee)}}})}},"\u70B9\u8BC4\u4EE3\u7801"))),l.a.createElement(a.b,{height:300,language:fe==null?void 0:fe.language,value:c.Base64.decode(fe==null?void 0:fe.code),autoHeight:te,theme:"default",options:F}),((fe==null?void 0:fe.comment)||(fe==null?void 0:fe.hidden_comment))&&l.a.createElement("div",null,l.a.createElement(I.a,{align:"middle",style:{borderTop:"1px solid #eee"}},l.a.createElement(E.a,{flex:1},l.a.createElement("h1",{className:e.a.title},"\u70B9\u8BC4\u5185\u5BB9")),l.a.createElement(E.a,{className:"pr30"},Object(n.c)()&&l.a.createElement(R.a,{onClick:Object(y.a)(s.a.mark(function be(){return s.a.wrap(function(Se){for(;;)switch(Se.prev=Se.next){case 0:v.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u63D0\u793A",icon:l.a.createElement(w.a,null),content:"\u662F\u5426\u786E\u8BA4\u5220\u9664\uFF1F",onOk:function(){return Object(y.a)(s.a.mark(function me(){var Ce;return s.a.wrap(function(_e){for(;;)switch(_e.prev=_e.next){case 0:return _e.next=2,Object(P.m)({comment_id:fe==null?void 0:fe.comment_id,homeworkId:xe.homeworkId,type:"hack"});case 2:Ce=_e.sent,Ce.status===0&&(C.b.success("\u5220\u9664\u6210\u529F"),pe({type:"shixunHomeworks/getShixunWorkReports",payload:Object(o.a)({},xe)}));case 4:case"end":return _e.stop()}},me)}))()}});case 1:case"end":return Se.stop()}},be)}))},l.a.createElement(U.a,null),"\u5220\u9664"))),l.a.createElement(M.a,{style:{margin:0}}),(fe==null?void 0:fe.comment)&&l.a.createElement("aside",{className:"pl30 pr30 mt20"},l.a.createElement("span",{className:"c-light-black font12"},"# \u5B66\u751F\u548C\u8BFE\u5802\u8001\u5E08\u53EF\u89C1"),l.a.createElement("br",null),l.a.createElement(A.a,{value:fe==null?void 0:fe.comment})),(fe==null?void 0:fe.hidden_comment)&&l.a.createElement("aside",{className:"pl30 pr30 mt20"},l.a.createElement("span",{className:"c-light-black font12"},"# \u4EC5\u8BFE\u5802\u8001\u5E08\u53EF\u89C1"),l.a.createElement("br",null),l.a.createElement(A.a,{value:fe==null?void 0:fe.hidden_comment}))))}},dmUQ:function(Me,he,B){"use strict";var Y=B("Ff2n"),M=B("rePB"),S=B("1OyB"),I=B("vuIU"),D=B("Ji7U"),E=B("md7G"),L=B("foSv"),R=B("cDcd"),_=B.n(R),C=B("TSYQ"),y=B.n(C),T=B("4IlW");function O(e,n){var c=Object.keys(e);if(Object.getOwnPropertySymbols){var h=Object.getOwnPropertySymbols(e);n&&(h=h.filter(function(u){return Object.getOwnPropertyDescriptor(e,u).enumerable})),c.push.apply(c,h)}return c}function x(e){for(var n=1;n<arguments.length;n++){var c=arguments[n]!=null?arguments[n]:{};n%2?O(Object(c),!0).forEach(function(h){Object(M.a)(e,h,c[h])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(c)):O(Object(c)).forEach(function(h){Object.defineProperty(e,h,Object.getOwnPropertyDescriptor(c,h))})}return e}function v(e){var n=g();return function(){var h=Object(L.a)(e),u;if(n){var b=Object(L.a)(this).constructor;u=Reflect.construct(h,arguments,b)}else u=h.apply(this,arguments);return Object(E.a)(this,u)}}function g(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}function d(){}function t(e){e.preventDefault()}var o=function(n){return n.replace(/[^\w.-]+/g,"")},i=200,p=600,f=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,s=function(n){return n!=null},m=function(n,c){return c===n||typeof c=="number"&&typeof n=="number"&&isNaN(c)&&isNaN(n)},l=function(e){Object(D.a)(c,e);var n=v(c);function c(h){var u;Object(S.a)(this,c),u=n.call(this,h),u.onKeyDown=function(P){var w=u.props,U=w.onKeyDown,N=w.onPressEnter;if(P.keyCode===T.a.UP){var F=u.getRatio(P);u.up(P,F,null),u.stop()}else if(P.keyCode===T.a.DOWN){var K=u.getRatio(P);u.down(P,K,null),u.stop()}else P.keyCode===T.a.ENTER&&N&&N(P);if(u.recordCursorPosition(),u.lastKeyCode=P.keyCode,U){for(var $=arguments.length,X=new Array($>1?$-1:0),oe=1;oe<$;oe++)X[oe-1]=arguments[oe];U.apply(void 0,[P].concat(X))}},u.onKeyUp=function(P){var w=u.props.onKeyUp;if(u.stop(),u.recordCursorPosition(),w){for(var U=arguments.length,N=new Array(U>1?U-1:0),F=1;F<U;F++)N[F-1]=arguments[F];w.apply(void 0,[P].concat(N))}},u.onChange=function(P){var w=u.props.onChange;u.state.focused&&(u.inputting=!0),u.rawInput=u.props.parser(u.getValueFromEvent(P)),u.setState({inputValue:u.rawInput}),w(u.toNumber(u.rawInput))},u.onMouseUp=function(){var P=u.props.onMouseUp;u.recordCursorPosition(),P&&P.apply(void 0,arguments)},u.onFocus=function(){var P;u.setState({focused:!0}),(P=u.props).onFocus.apply(P,arguments)},u.onBlur=function(){var P=u.props.onBlur;u.inputting=!1,u.setState({focused:!1});var w=u.getCurrentValidValue(u.state.inputValue),U=u.setValue(w,d);if(P){var N=u.input.value,F=u.getInputDisplayValue({focus:!1,value:U});u.input.value=F&&Number(F),P.apply(void 0,arguments),u.input.value=N}},u.getRatio=function(P){var w=1;return P.metaKey||P.ctrlKey?w=.1:P.shiftKey&&(w=10),w},u.getFullNum=function(P){return isNaN(P)?P:/e/i.test(String(P))?Number(P).toFixed(18).replace(/\.?0+$/,""):P},u.getPrecision=function(P){if(s(u.props.precision))return u.props.precision;var w=String(P);if(w.indexOf("e-")>=0)return parseInt(w.slice(w.indexOf("e-")+2),10);var U=0;return w.indexOf(".")>=0&&(U=w.length-w.indexOf(".")-1),U},u.getInputDisplayValue=function(P){var w=P||u.state,U=w.focused,N=w.inputValue,F=w.value,K;U?K=N:K=u.toPrecisionAsStep(F),K==null&&(K="");var $=u.formatWrapper(K);return s(u.props.decimalSeparator)&&($=$.toString().replace(".",u.props.decimalSeparator)),$},u.recordCursorPosition=function(){try{u.cursorStart=u.input.selectionStart,u.cursorEnd=u.input.selectionEnd,u.currentValue=u.input.value,u.cursorBefore=u.input.value.substring(0,u.cursorStart),u.cursorAfter=u.input.value.substring(u.cursorEnd)}catch(P){}},u.restoreByAfter=function(P){if(P===void 0)return!1;var w=u.input.value,U=w.lastIndexOf(P);if(U===-1)return!1;var N=u.cursorBefore.length;return u.lastKeyCode===T.a.DELETE&&u.cursorBefore.charAt(N-1)===P[0]?(u.fixCaret(N,N),!0):U+P.length===w.length?(u.fixCaret(U,U),!0):!1},u.partRestoreByAfter=function(P){return P===void 0?!1:Array.prototype.some.call(P,function(w,U){var N=P.substring(U);return u.restoreByAfter(N)})},u.isNotCompleteNumber=function(P){return isNaN(P)||P===""||P===null||P&&P.toString().indexOf(".")===P.toString().length-1},u.stop=function(){u.autoStepTimer&&clearTimeout(u.autoStepTimer)},u.down=function(P,w,U){u.pressingUpOrDown=!0,u.step("down",P,w,U)},u.up=function(P,w,U){u.pressingUpOrDown=!0,u.step("up",P,w,U)},u.saveInput=function(P){u.input=P};var b=h.value;b===void 0&&(b=h.defaultValue),u.state={focused:h.autoFocus};var A=u.getValidValue(u.toNumber(b));return u.state=x(x({},u.state),{},{inputValue:u.toPrecisionAsStep(A),value:A}),u}return Object(I.a)(c,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(u){var b=this.props,A=b.value,P=b.onChange,w=b.max,U=b.min,N=this.state.focused;if(u){if(!m(u.value,A)||!m(u.max,w)||!m(u.min,U)){var F=N?A:this.getValidValue(A),K;this.pressingUpOrDown?K=F:this.inputting?K=this.rawInput:K=this.toPrecisionAsStep(F),this.setState({value:F,inputValue:K})}var $="value"in this.props?A:this.state.value;"max"in this.props&&u.max!==w&&typeof $=="number"&&$>w&&P&&P(w),"min"in this.props&&u.min!==U&&typeof $=="number"&&$<U&&P&&P(U)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var X=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===T.a.BACKSPACE?X=this.cursorStart-1:this.lastKeyCode===T.a.DELETE&&(X=this.cursorStart):X=this.input.value.length,this.fixCaret(X,X)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case T.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case T.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(oe){}if(this.lastKeyCode=null,!this.pressingUpOrDown)return;this.props.focusOnUpDown&&this.state.focused&&(document.activeElement!==this.input&&this.focus())}},{key:"componentWillUnmount",value:function(){this.stop()}},{key:"getCurrentValidValue",value:function(u){var b=u;return b===""?b="":this.isNotCompleteNumber(parseFloat(b))?b=this.state.value:b=this.getValidValue(b),this.toNumber(b)}},{key:"getValueFromEvent",value:function(u){var b=u.target.value.trim().replace(/。/g,".");return s(this.props.decimalSeparator)&&(b=b.replace(this.props.decimalSeparator,".")),b}},{key:"getValidValue",value:function(u){var b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,A=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,P=parseFloat(u);return isNaN(P)?u:(P<b&&(P=b),P>A&&(P=A),P)}},{key:"setValue",value:function(u,b){var A=this.props.precision,P=this.isNotCompleteNumber(parseFloat(u))?null:parseFloat(u),w=this.state.value,U=w===void 0?null:w,N=this.state.inputValue,F=N===void 0?null:N,K=typeof P=="number"?P.toFixed(A):"".concat(P),$=P!==U||K!=="".concat(F);return"value"in this.props?(F=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:F},b)):this.setState({value:P,inputValue:this.toPrecisionAsStep(u)},b),$&&this.props.onChange(P),P}},{key:"getMaxPrecision",value:function(u){var b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,A=this.props,P=A.precision,w=A.step;if(s(P))return P;var U=this.getPrecision(b),N=this.getPrecision(w),F=this.getPrecision(u);return u?Math.max(F,U+N):U+N}},{key:"getPrecisionFactor",value:function(u){var b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,A=this.getMaxPrecision(u,b);return Math.pow(10,A)}},{key:"focus",value:function(){this.input.focus(),this.recordCursorPosition()}},{key:"blur",value:function(){this.input.blur()}},{key:"select",value:function(){this.input.select()}},{key:"formatWrapper",value:function(u){return this.props.formatter?this.props.formatter(u):u}},{key:"toPrecisionAsStep",value:function(u){if(this.isNotCompleteNumber(u)||u==="")return u;var b=Math.abs(this.getMaxPrecision(u));return isNaN(b)?u.toString():Number(u).toFixed(b)}},{key:"toNumber",value:function(u){var b=this.props.precision,A=this.state.focused,P=u&&u.length>16&&A;return this.isNotCompleteNumber(u)||P?u:s(b)?Math.round(u*Math.pow(10,b))/Math.pow(10,b):Number(u)}},{key:"upStep",value:function(u,b){var A=this.props.step,P=this.getPrecisionFactor(u,b),w=Math.abs(this.getMaxPrecision(u,b)),U=((P*u+P*A*b)/P).toFixed(w);return this.toNumber(U)}},{key:"downStep",value:function(u,b){var A=this.props.step,P=this.getPrecisionFactor(u,b),w=Math.abs(this.getMaxPrecision(u,b)),U=((P*u-P*A*b)/P).toFixed(w);return this.toNumber(U)}},{key:"step",value:function(u,b){var A=this,P=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,w=arguments.length>3?arguments[3]:void 0;this.stop(),b&&(b.persist(),b.preventDefault());var U=this.props;if(U.disabled)return;var N=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(N))return;var F=this["".concat(u,"Step")](N,P),K=F>U.max||F<U.min;if(F>U.max?F=U.max:F<U.min&&(F=U.min),this.setValue(F,null),this.setState({focused:!0},function(){A.pressingUpOrDown=!1}),K)return;this.autoStepTimer=setTimeout(function(){A[u](b,P,!0)},w?i:p)}},{key:"fixCaret",value:function(u,b){if(u===void 0||b===void 0||!this.input||!this.input.value)return;try{var A=this.input.selectionStart,P=this.input.selectionEnd;(u!==A||b!==P)&&this.input.setSelectionRange(u,b)}catch(w){}}},{key:"render",value:function(){var u,b=this.props,A=b.prefixCls,P=b.disabled,w=b.readOnly,U=b.useTouch,N=b.autoComplete,F=b.upHandler,K=b.downHandler,$=b.className,X=b.max,oe=b.min,pe=b.style,ee=b.title,de=b.onMouseEnter,le=b.onMouseLeave,re=b.onMouseOver,te=b.onMouseOut,Te=b.required,Ie=b.onClick,Ae=b.tabIndex,De=b.type,fe=b.placeholder,ye=b.id,xe=b.inputMode,be=b.pattern,ie=b.step,Se=b.maxLength,ge=b.autoFocus,me=b.name,Ce=b.onPaste,Le=b.onInput,_e=Object(Y.a)(b,["prefixCls","disabled","readOnly","useTouch","autoComplete","upHandler","downHandler","className","max","min","style","title","onMouseEnter","onMouseLeave","onMouseOver","onMouseOut","required","onClick","tabIndex","type","placeholder","id","inputMode","pattern","step","maxLength","autoFocus","name","onPaste","onInput"]),Re=this.state,Pe=Re.value,we=Re.focused,J=y()(A,(u={},Object(M.a)(u,$,!!$),Object(M.a)(u,"".concat(A,"-disabled"),P),Object(M.a)(u,"".concat(A,"-focused"),we),u)),q={};Object.keys(_e).forEach(function(z){(z.substr(0,5)==="data-"||z.substr(0,5)==="aria-"||z==="role")&&(q[z]=_e[z])});var se=!w&&!P,ce=this.getInputDisplayValue(null),Z=(Pe||Pe===0)&&(isNaN(Pe)||Number(Pe)>=X),ue=(Pe||Pe===0)&&(isNaN(Pe)||Number(Pe)<=oe),V=Z||P||w,G=ue||P||w,H=y()("".concat(A,"-handler"),"".concat(A,"-handler-up"),Object(M.a)({},"".concat(A,"-handler-up-disabled"),V)),k=y()("".concat(A,"-handler"),"".concat(A,"-handler-down"),Object(M.a)({},"".concat(A,"-handler-down-disabled"),G)),j=U?{onTouchStart:V?d:this.up,onTouchEnd:this.stop}:{onMouseDown:V?d:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},W=U?{onTouchStart:G?d:this.down,onTouchEnd:this.stop}:{onMouseDown:G?d:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return _.a.createElement("div",{className:J,style:pe,title:ee,onMouseEnter:de,onMouseLeave:le,onMouseOver:re,onMouseOut:te,onFocus:function(){return null},onBlur:function(){return null}},_.a.createElement("div",{className:"".concat(A,"-handler-wrap")},_.a.createElement("span",Object.assign({unselectable:"on"},j,{role:"button","aria-label":"Increase Value","aria-disabled":V,className:H}),F||_.a.createElement("span",{unselectable:"on",className:"".concat(A,"-handler-up-inner"),onClick:t})),_.a.createElement("span",Object.assign({unselectable:"on"},W,{role:"button","aria-label":"Decrease Value","aria-disabled":G,className:k}),K||_.a.createElement("span",{unselectable:"on",className:"".concat(A,"-handler-down-inner"),onClick:t}))),_.a.createElement("div",{className:"".concat(A,"-input-wrap")},_.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":oe,"aria-valuemax":X,"aria-valuenow":Pe,required:Te,type:De,placeholder:fe,onPaste:Ce,onClick:Ie,onMouseUp:this.onMouseUp,className:"".concat(A,"-input"),tabIndex:Ae,autoComplete:N,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:se?this.onKeyDown:d,onKeyUp:se?this.onKeyUp:d,autoFocus:ge,maxLength:Se,readOnly:w,disabled:P,max:X,min:oe,step:ie,name:me,title:ee,id:ye,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(ce),pattern:be,inputMode:xe,onInput:Le},q))))}}]),c}(_.a.Component);l.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:f,min:-f,step:1,style:{},onChange:d,onKeyDown:d,onPressEnter:d,onFocus:d,onBlur:d,parser:o,required:!1,autoComplete:"off"};var a=l,r=he.a=a},fyJ8:function(Me,he,B){"use strict";var Y=B("rePB"),M=B("VTBJ"),S=B("Ff2n"),I=B("U8pU"),D=B("cDcd"),E=B.n(D),L=B("TSYQ"),R=B.n(L),_=B("c+Xe"),C=B("sR1s");function y(g){return g&&Object(I.a)(g)==="object"&&!Array.isArray(g)&&!D.isValidElement(g)}function T(g){return typeof g=="string"?!0:Object(_.c)(g)}function O(g,d){var t,o=g.prefixCls,i=g.className,p=g.record,f=g.index,s=g.dataIndex,m=g.render,l=g.children,a=g.component,r=a===void 0?"td":a,e=g.colSpan,n=g.rowSpan,c=g.fixLeft,h=g.fixRight,u=g.firstFixLeft,b=g.lastFixLeft,A=g.firstFixRight,P=g.lastFixRight,w=g.appendNode,U=g.additionalProps,N=U===void 0?{}:U,F=g.ellipsis,K=g.align,$=g.rowType,X=g.isSticky,oe="".concat(o,"-cell"),pe,ee;if(l)ee=l;else{var de=Object(C.b)(p,s);if(ee=de,m){var le=m(de,p,f);y(le)?(ee=le.children,pe=le.props):ee=le}}Object(I.a)(ee)==="object"&&!Array.isArray(ee)&&!D.isValidElement(ee)&&(ee=null),F&&(b||A)&&(ee=D.createElement("span",{className:"".concat(oe,"-content")},ee));var re=pe||{},te=re.colSpan,Te=re.rowSpan,Ie=re.style,Ae=re.className,De=Object(S.a)(re,["colSpan","rowSpan","style","className"]),fe=te!==void 0?te:e,ye=Te!==void 0?Te:n;if(fe===0||ye===0)return null;var xe={},be=typeof c=="number",ie=typeof h=="number";be&&(xe.position="sticky",xe.left=c),ie&&(xe.position="sticky",xe.right=h);var Se={};K&&(Se.textAlign=K);var ge,me=F===!0?{showTitle:!0}:F;me&&(me.showTitle||$==="header")&&(typeof ee=="string"||typeof ee=="number"?ge=ee.toString():D.isValidElement(ee)&&typeof ee.props.children=="string"&&(ge=ee.props.children));var Ce=Object(M.a)(Object(M.a)(Object(M.a)({title:ge},De),N),{},{colSpan:fe&&fe!==1?fe:null,rowSpan:ye&&ye!==1?ye:null,className:R()(oe,i,(t={},Object(Y.a)(t,"".concat(oe,"-fix-left"),be),Object(Y.a)(t,"".concat(oe,"-fix-left-first"),u),Object(Y.a)(t,"".concat(oe,"-fix-left-last"),b),Object(Y.a)(t,"".concat(oe,"-fix-right"),ie),Object(Y.a)(t,"".concat(oe,"-fix-right-first"),A),Object(Y.a)(t,"".concat(oe,"-fix-right-last"),P),Object(Y.a)(t,"".concat(oe,"-ellipsis"),F),Object(Y.a)(t,"".concat(oe,"-with-append"),w),Object(Y.a)(t,"".concat(oe,"-fix-sticky"),(be||ie)&&X),t),N.className,Ae),style:Object(M.a)(Object(M.a)(Object(M.a)(Object(M.a)({},N.style),Se),xe),Ie),ref:T(r)?d:null});return D.createElement(r,Object.assign({},Ce),w,ee)}var x=D.forwardRef(O);x.displayName="Cell";var v=D.memo(x,function(g,d){return d.shouldCellUpdate?!d.shouldCellUpdate(d.record,g.record):!1});he.a=v},hW8S:function(Me,he,B){"use strict";B.d(he,"a",function(){return I}),B.d(he,"c",function(){return D}),B.d(he,"b",function(){return E});var Y=B("VTBJ"),M=B("Ff2n"),S=B("Kwbf"),I="RC_TABLE_INTERNAL_COL_DEFINE";function D(L){var R=L.expandable,_=Object(M.a)(L,["expandable"]);return"expandable"in L?Object(Y.a)(Object(Y.a)({},_),R):_}function E(L){return Object.keys(L).reduce(function(R,_){return(_.substr(0,5)==="data-"||_.substr(0,5)==="aria-")&&(R[_]=L[_]),R},{})}},mauG:function(Me,he,B){"use strict";B.r(he);var Y=B("DjyN"),M=B("NUBc"),S=B("g9YV"),I=B("wCAj"),D=B("2qtc"),E=B("kLXV"),L=B("miYZ"),R=B("tsqr"),_=B("7Kak"),C=B("9yH6"),y=B("sRBo"),T=B("kaz8"),O=B("oBTY"),x=B("/zsF"),v=B("PArb"),g=B("+L6B"),d=B("2/Rp"),t=B("9og8"),o=B("k1fw"),i=B("tJVT"),p=B("WmNS"),f=B.n(p),s=B("cDcd"),m=B.n(s),l=B("Ty5D"),a=B("55Ip"),r=B("9kvl"),e=B("xKgJ"),n=B("bTeP"),c=B.n(n),h=B("ErOA"),u=B("jhfD"),b=B("m3rI"),A=B("deN7"),P=B("J66h"),w=B.n(P),U=B("mgmH"),N=B("sZk2"),F=B.n(N),K=B("+92d"),$=B.n(K),X=B("wwSX"),oe=B.n(X),pe=B("zlzj"),ee=B.n(pe),de=[$.a,oe.a,ee.a],le=function(te){var Te,Ie,Ae,De,fe,ye=te.user,xe=Object(s.useState)(Object(o.a)(Object(o.a)({},Object(l.i)()),{},{page:1,per_page:10,rank_type:2,course_group:Object(e.s)()?[ye.userInfo.course.course_group_id]:[]})),be=Object(i.a)(xe,2),ie=be[0],Se=be[1],ge=Object(s.useState)([]),me=Object(i.a)(ge,2),Ce=me[0],Le=me[1],_e=Object(s.useState)([]),Re=Object(i.a)(_e,2),Pe=Re[0],we=Re[1],J=Object(s.useState)([]),q=Object(i.a)(J,2),se=q[0],ce=q[1];Object(s.useEffect)(function(){var V;ye!=null&&(V=ye.userInfo)!==null&&V!==void 0&&V.course&&(Object(e.s)()&&(ie.course_group=Object(e.s)()?[ye.userInfo.course.course_group_id]:[],Se(Object(o.a)({},ie))),Z(1))},[ye==null?void 0:ye.userInfo]);function Z(V){return ue.apply(this,arguments)}function ue(){return ue=Object(t.a)(f.a.mark(function V(G){var H,k,j;return f.a.wrap(function(z){for(;;)switch(z.prev=z.next){case 0:return z.next=2,Object(h.a)("/api/courses/question_rank_list.json",{method:"get",params:Object(o.a)(Object(o.a)({},ie),{},{id:ie.coursesId,identifier:ie.homeworkId})});case 2:H=z.sent,Le(H),Object(e.s)()?(G===1&&we([H==null||((k=H.course_group)===null||k===void 0||((j=k[0])===null||j===void 0))?void 0:j.id]),H!=null&&H.my_rank?ce([H==null?void 0:H.my_rank].concat(Object(O.a)(H==null?void 0:H.rank_list))):ce(Object(O.a)(H==null?void 0:H.rank_list))):ce(Object(O.a)(H==null?void 0:H.rank_list));case 5:case"end":return z.stop()}},V)})),ue.apply(this,arguments)}return m.a.createElement("div",{style:{width:1200,margin:"0px auto"}},m.a.createElement("aside",{className:[c.a.title,"mt20"].join(" ")},m.a.createElement(a.a,{to:"/classrooms/".concat(ie.coursesId,"/program_homework/").concat(ie.categoryId,"/detail")},m.a.createElement(u.a,{className:"font16 c-black"})),m.a.createElement("strong",{className:"font20 ml5"},"\u6392\u884C\u699C ",m.a.createElement("span",{style:{fontSize:14,color:"#B1BACD"}},"\u6392\u884C\u89C4\u5219\uFF1A\u5728\u8FD0\u884C\u65F6\u95F4\u76F8\u540C\u65F6\uFF0C\u5C06\u6839\u636E\u8FD0\u884C\u5185\u5B58\u3001\u63D0\u4EA4\u65F6\u95F4\u4F9D\u6B21\u8FDB\u884C\u6392\u5E8F")),m.a.createElement("span",{style:{color:"#0152d9",textAlign:"end",flex:1,cursor:"pointer"}},m.a.createElement(d.a,{style:{marginRight:10},onClick:Object(t.a)(f.a.mark(function V(){var G;return f.a.wrap(function(k){for(;;)switch(k.prev=k.next){case 0:return k.next=2,Object(h.a)("/api/problems/".concat(ie.homeworkId,"/start.json"),{method:"get"});case 2:G=k.sent,G&&(window.open("/myproblems/".concat(G==null?void 0:G.identifier,"?type=1")),localStorage.setItem("program_homework",[ie.coursesId,ie.categoryId]));case 4:case"end":return k.stop()}},V)}))},"\u67E5\u770B\u9898\u76EE"),Object(e.c)()&&m.a.createElement(d.a,{onClick:function(){Object(U.u)(Object(o.a)(Object(o.a)({},ie),{},{id:ie.coursesId,identifier:ie.homeworkId}))}},"\u5BFC\u51FA"))),m.a.createElement("div",{style:{background:"#fff",marginTop:10,padding:40}},m.a.createElement("div",null,m.a.createElement("p",{style:{color:"#165DFF",fontSize:18,fontWeight:400}},m.a.createElement("img",{width:20,src:F.a,style:{marginRight:5}})," \u9898\u76EE\u6392\u884C\u699C")),m.a.createElement(v.a,null),m.a.createElement("div",{style:{display:"inline-flex"}},m.a.createElement("label",null,"\u5206\u73ED\u60C5\u51B5\uFF1A"),Object(e.c)()&&m.a.createElement("div",{style:{flex:1}},m.a.createElement(T.a.Group,{className:c.a.checkboxgroup,value:Pe,onChange:function(G){if(ie.type===1)we([]),ie.course_group=[],ie.page=1,Se(Object(o.a)({},ie)),Z();else if(ie.type===2){var H;we(["\u5168\u90E8"].concat()),ie.course_group=Ce==null||((H=Ce.course_group)===null||H===void 0)?void 0:H.map(function(k){return k.id}),ie.page=1,Se(Object(o.a)({},ie)),Z()}else we(Object(O.a)(G.filter(function(k){return k!="\u5168\u90E8"}))),ie.course_group=G.filter(function(k){return k!="\u5168\u90E8"}),ie.page=1,Se(Object(o.a)({},ie)),Z()}},m.a.createElement(T.a,{value:"\u5168\u90E8",onChange:function(G){G.target.checked?ie.type=2:ie.type=1}},"\u5168\u90E8\u5206\u73ED"),Ce==null||((Te=Ce.course_group)===null||Te===void 0)?void 0:Te.map(function(V,G){return m.a.createElement(T.a,{onChange:function(k){ie.type=3},value:V.id},V==null?void 0:V.name)}))),Object(e.s)()&&m.a.createElement(C.a.Group,{style:{flex:1,display:"flex",alignItems:"center"},onChange:function(G){G.target.value==="\u5168\u90E8"?(ie.course_group=[],ie.page=1,Se(Object(o.a)({},ie)),Z()):(ie.course_group=[G.target.value],ie.page=1,Se(Object(o.a)({},ie)),Z())},defaultValue:ye.userInfo.course.course_group_id},m.a.createElement(C.a,{value:"\u5168\u90E8"},"\u5168\u90E8\u5206\u73ED"),Ce==null||((Ie=Ce.course_group)===null||Ie===void 0)?void 0:Ie.map(function(V,G){return m.a.createElement(C.a,{value:V.id},V.name)}))),(Ce==null||((Ae=Ce.all_language)===null||Ae===void 0)?void 0:Ae.length)>1&&m.a.createElement("div",{style:{marginTop:10}},m.a.createElement("label",null,"\u7F16\u8BD1\u8BED\u8A00\uFF1A"),m.a.createElement(C.a.Group,{className:c.a.checkboxgroup,style:{width:"90%"},onChange:function(G){ie.language=encodeURIComponent(G.target.value),ie.page=1,Se(Object(o.a)({},ie)),Z()},defaultValue:Ce==null||((De=Ce.all_language)===null||De===void 0)?void 0:De[0]},Ce==null||((fe=Ce.all_language)===null||fe===void 0)?void 0:fe.map(function(V,G){return m.a.createElement(C.a,{value:V},V)}))),m.a.createElement(I.a,{style:{marginTop:10},pagination:!1,dataSource:se,rowClassName:function(G,H){return H===0&&Object(e.s)()&&c.a.tables},columns:[{title:"\u6392\u884C",dataIndex:"rank",render:function(G,H,k){return G<4?m.a.createElement("img",{src:de[G-1]}):G}},{title:"\u7528\u6237",dataIndex:"user_name",key:"user_name",render:function(G,H,k){return m.a.createElement("div",null,m.a.createElement("img",{style:{width:30,height:30,borderRadius:"50%",marginRight:10},src:b.a.IMG_SERVER+"/images/"+(H==null?void 0:H.image_url)}),G)}},{title:"\u5B66\u53F7",dataIndex:"student_id",key:"student_id",render:function(G){return G||"- -"}},{title:"\u5206\u73ED",dataIndex:"course_group",key:"course_group"},{title:"\u63D0\u4EA4\u65F6\u95F4",dataIndex:"submit_time",key:"submit_time"},{title:"\u8FD0\u7528\u65F6\u95F4\uFF08ms\uFF09",dataIndex:"run_time",key:"run_time"},{title:"\u5185\u5B58\uFF08kb\uFF09",dataIndex:"memory",key:"memory"},{title:"\u7F16\u8BD1\u8BED\u8A00",dataIndex:"language",key:"language"},(Ce==null?void 0:Ce.open_code)&&{title:"\u64CD\u4F5C",dataIndex:"passed_rate",key:"passed_rate",render:function(G,H){return m.a.createElement("div",{style:{cursor:"pointer",color:"rgb(22, 93, 255)"},onClick:Object(t.a)(f.a.mark(function k(){var j;return f.a.wrap(function(z){for(;;)switch(z.prev=z.next){case 0:if(!((H==null?void 0:H.code)==="-")){z.next=3;break}return R.b.info("\u6682\u65E0\u4EE3\u7801"),z.abrupt("return");case 3:return z.next=5,Object(h.a)("/api/courses/view_code.json",{method:"get",params:Object(o.a)(Object(o.a)({},ie),{},{id:ie.coursesId,homework_common_id:ie.homeworkId,hack_user_code_id:H==null?void 0:H.hack_user_code_id})});case 5:j=z.sent,E.a.warning({icon:null,title:"\u67E5\u770B\u4EE3\u7801",content:m.a.createElement(A.a,{languages:[{language:H.language,code:j.code}],v:H,shixunWorkReport:"shixunWorkReport",dispatch:"dispatch",autoHeight:!1,language:H.language,game_id:H.id,data:P.Base64.decode(j.code),diff_code_count:H.diff_code_count})});case 7:case"end":return z.stop()}},k)}))},"\u67E5\u770B\u4EE3\u7801")}}].filter(function(V){return!!V})}),m.a.createElement("div",{style:{width:"100%",textAlign:"center",marginTop:10}},m.a.createElement(M.a,{current:ie.page,pageSize:ie.per_page,total:Ce==null?void 0:Ce.count,hideOnSinglePage:!0,onChange:function(G,H){ie.page=G,ie.per_page=H,Se(Object(o.a)({},ie)),Z()}}))))};he.default=Object(r.a)(function(re){var te=re.user;return{user:te}})(le)},mgmH:function(Me,he,B){"use strict";B.d(he,"d",function(){return O}),B.d(he,"b",function(){return x}),B.d(he,"e",function(){return v}),B.d(he,"c",function(){return g}),B.d(he,"n",function(){return d}),B.d(he,"g",function(){return t}),B.d(he,"h",function(){return o}),B.d(he,"j",function(){return p}),B.d(he,"a",function(){return f}),B.d(he,"l",function(){return s}),B.d(he,"f",function(){return m}),B.d(he,"k",function(){return l}),B.d(he,"m",function(){return a}),B.d(he,"i",function(){return r}),B.d(he,"o",function(){return e}),B.d(he,"t",function(){return n}),B.d(he,"s",function(){return c}),B.d(he,"p",function(){return h}),B.d(he,"q",function(){return u}),B.d(he,"r",function(){return b}),B.d(he,"v",function(){return A}),B.d(he,"u",function(){return P});var Y=B("miYZ"),M=B("tsqr"),S=B("k1fw"),I=B("9og8"),D=B("WmNS"),E=B.n(D),L=B("oUNq"),R=B("9kvl"),_=B("1vsH"),C=B("m3rI"),y=function(){Object(R.c)()._store.dispatch({type:"globalSetting/setGlobalLoading",payload:{show:!0,text:"\u6B63\u5728\u751F\u6210\u6587\u4EF6\uFF0C\u8BF7\u7A0D\u540E..."}})},T=function(){Object(R.c)()._store.dispatch({type:"globalSetting/setGlobalLoading",payload:{show:!1,text:""}})},O=function(){var w=Object(I.a)(E.a.mark(function U(N){var F;return E.a.wrap(function($){for(;;)switch($.prev=$.next){case 0:return y(),$.next=3,Object(L.t)(Object(S.a)({},N));case 3:if(F=$.sent,!(F.status===0)){$.next=7;break}return $.next=7,Object(_.w)("",Object(_.ab)({url:C.a.API_SERVER+"/api/courses/".concat(N.coursesId,"/export_couser_info.json"),query:N}));case 7:T();case 8:case"end":return $.stop()}},U)}));return function(N){return w.apply(this,arguments)}}(),x=function(){var w=Object(I.a)(E.a.mark(function U(N){var F;return E.a.wrap(function($){for(;;)switch($.prev=$.next){case 0:return $.next=2,Object(L.r)(Object(S.a)({},N));case 2:if(F=$.sent,!(F.status===0)){$.next=8;break}M.b.info("\u5BFC\u51FA\u4EFB\u52A1\u751F\u6210\u6210\u529F"),R.d.push("/classrooms/".concat(N.coursesId,"/exportlist/course_member_act_score")),$.next=13;break;case 8:if(!(F.status===-2)){$.next=12;break}return $.abrupt("return",F);case 12:F.status===-3&&(Object(R.c)()._store.dispatch({type:"classroomList/setActionTabs",payload:{key:"\u5BFC\u51FA\u63D0\u9192"}}),R.d.push("/classrooms/".concat(N.coursesId,"/exportlist/course_member_act_score")));case 13:case"end":return $.stop()}},U)}));return function(N){return w.apply(this,arguments)}}(),v=function(){var w=Object(I.a)(E.a.mark(function U(N){var F;return E.a.wrap(function($){for(;;)switch($.prev=$.next){case 0:return $.next=2,Object(L.u)(Object(S.a)({},N));case 2:if(F=$.sent,!(F.status===0)){$.next=8;break}M.b.info("\u5BFC\u51FA\u4EFB\u52A1\u751F\u6210\u6210\u529F"),R.d.push("/classrooms/".concat(N.coursesId,"/exportlist/course_total_score")),$.next=13;break;case 8:if(!(F.status===-2)){$.next=12;break}return $.abrupt("return",F);case 12:F.status===-3&&(Object(R.c)()._store.dispatch({type:"classroomList/setActionTabs",payload:{key:"\u5BFC\u51FA\u63D0\u9192"}}),R.d.push("/classrooms/".concat(N.coursesId,"/exportlist/course_total_score")));case 13:case"end":return $.stop()}},U)}));return function(N){return w.apply(this,arguments)}}(),g=function(){var w=Object(I.a)(E.a.mark(function U(N){var F;return E.a.wrap(function($){for(;;)switch($.prev=$.next){case 0:return $.next=2,Object(L.s)(Object(S.a)({},N));case 2:if(F=$.sent,!(F.status===0)){$.next=8;break}M.b.info("\u5BFC\u51FA\u4EFB\u52A1\u751F\u6210\u6210\u529F"),R.d.push("/classrooms/".concat(N.coursesId,"/exportlist/course_total_exercise_and_other")),$.next=13;break;case 8:if(!(F.status===-2)){$.next=12;break}return $.abrupt("return",F);case 12:F.status===-3&&(Object(R.c)()._store.dispatch({type:"classroomList/setActionTabs",payload:{key:"\u5BFC\u51FA\u63D0\u9192"}}),R.d.push("/classrooms/".concat(N.coursesId,"/exportlist/course_total_exercise_and_other")));case 13:case"end":return $.stop()}},U)}));return function(N){return w.apply(this,arguments)}}(),d=function(){var w=Object(I.a)(E.a.mark(function U(N){var F;return E.a.wrap(function($){for(;;)switch($.prev=$.next){case 0:return $.next=2,Object(L.z)(Object(S.a)({},N));case 2:if(F=$.sent,!(F.status===0)){$.next=8;break}M.b.info("\u5BFC\u51FA\u4EFB\u52A1\u751F\u6210\u6210\u529F"),R.d.push("/classrooms/".concat(N.coursesId,"/exportlist/course_total_exercise_and_other")),$.next=13;break;case 8:if(!(F.status===-2)){$.next=12;break}return $.abrupt("return",F);case 12:F.status===-3&&(Object(R.c)()._store.dispatch({type:"classroomList/setActionTabs",payload:{key:"\u5BFC\u51FA\u63D0\u9192"}}),R.d.push("/classrooms/".concat(N.coursesId,"/exportlist/course_total_exercise_and_other")));case 13:case"end":return $.stop()}},U)}));return function(N){return w.apply(this,arguments)}}(),t=function(){var w=Object(I.a)(E.a.mark(function U(N){var F;return E.a.wrap(function($){for(;;)switch($.prev=$.next){case 0:return $.next=2,Object(L.v)(Object(S.a)({},N));case 2:if(F=$.sent,!(F.status===0)){$.next=8;break}M.b.info("\u5BFC\u51FA\u4EFB\u52A1\u751F\u6210\u6210\u529F"),R.d.push("/classrooms/".concat(N.coursesId,"/exportlist/course_total_homework")),$.next=13;break;case 8:if(!(F.status===-2)){$.next=12;break}return $.abrupt("return",F);case 12:F.status===-3&&(Object(R.c)()._store.dispatch({type:"classroomList/setActionTabs",payload:{key:"\u5BFC\u51FA\u63D0\u9192"}}),R.d.push("/classrooms/".concat(N.coursesId,"/exportlist/course_total_homework")));case 13:case"end":return $.stop()}},U)}));return function(N){return w.apply(this,arguments)}}(),o=function(){var w=Object(I.a)(E.a.mark(function U(N,F){var K;return E.a.wrap(function(X){for(;;)switch(X.prev=X.next){case 0:return X.next=2,Object(L.x)(Object(S.a)({},N));case 2:K=X.sent,K.status===0?(M.b.info("\u5BFC\u51FA\u4EFB\u52A1\u751F\u6210\u6210\u529F"),R.d.push("/classrooms/".concat(N.coursesId,"/exportlist/").concat(F))):K.status===-3&&(Object(R.c)()._store.dispatch({type:"classroomList/setActionTabs",payload:{key:"\u5BFC\u51FA\u63D0\u9192"}}),R.d.push("/classrooms/".concat(N.coursesId,"/exportlist/").concat(F)));case 4:case"end":return X.stop()}},U)}));return function(N,F){return w.apply(this,arguments)}}(),i=function(){var w=Object(I.a)(E.a.mark(function U(N){var F;return E.a.wrap(function($){for(;;)switch($.prev=$.next){case 0:return y(),$.next=3,Object(L.w)(Object(S.a)({},N));case 3:if(F=$.sent,!(F.status===0)){$.next=7;break}return $.next=7,Object(_.w)("",Object(_.ab)({url:C.a.API_SERVER+"/api/homework_commons/".concat(N.categoryId,"/works_list.zip"),query:N}));case 7:T();case 8:case"end":return $.stop()}},U)}));return function(N){return w.apply(this,arguments)}}(),p=function(){var w=Object(I.a)(E.a.mark(function U(N){var F;return E.a.wrap(function($){for(;;)switch($.prev=$.next){case 0:return y(),$.next=3,Object(L.A)(Object(S.a)({},N));case 3:if(F=$.sent,!(F.status===0)){$.next=7;break}return $.next=7,Object(_.w)("",Object(_.ab)({url:C.a.API_SERVER+"/api/polls/".concat(N.categoryId,"/commit_result.xlsx"),query:N}));case 7:T();case 8:case"end":return $.stop()}},U)}));return function(N){return w.apply(this,arguments)}}(),f=function(){var w=Object(I.a)(E.a.mark(function U(N){return E.a.wrap(function(K){for(;;)switch(K.prev=K.next){case 0:return K.next=2,Object(_.v)("",Object(_.ab)({url:C.a.API_SERVER+"/api/courses/".concat(N.coursesId,"/attendances/export_xlsx_data.xlsx"),query:N}));case 2:case"end":return K.stop()}},U)}));return function(N){return w.apply(this,arguments)}}(),s=function(){var w=Object(I.a)(E.a.mark(function U(N){return E.a.wrap(function(K){for(;;)switch(K.prev=K.next){case 0:return K.next=2,Object(_.v)("",Object(_.ab)({url:C.a.API_SERVER+"/api/courses/".concat(N.coursesId,"/video_study_statics.xlsx"),query:N}));case 2:case"end":return K.stop()}},U)}));return function(N){return w.apply(this,arguments)}}(),m=function(){var w=Object(I.a)(E.a.mark(function U(N){return E.a.wrap(function(K){for(;;)switch(K.prev=K.next){case 0:return K.next=2,Object(_.v)("",Object(_.ab)({url:C.a.API_SERVER+"/api/courses/".concat(N.coursesId,"/export_course_students_info.xlsx"),query:N}));case 2:case"end":return K.stop()}},U)}));return function(N){return w.apply(this,arguments)}}(),l=function(){var w=Object(I.a)(E.a.mark(function U(N){return E.a.wrap(function(K){for(;;)switch(K.prev=K.next){case 0:return K.next=2,Object(_.v)("",Object(_.ab)({url:C.a.API_SERVER+"/api/item_banks/export.xlsx",query:N}));case 2:case"end":return K.stop()}},U)}));return function(N){return w.apply(this,arguments)}}(),a=function(){var w=Object(I.a)(E.a.mark(function U(N){return E.a.wrap(function(K){for(;;)switch(K.prev=K.next){case 0:return K.next=2,Object(_.v)("",Object(_.ab)({url:C.a.API_SERVER+"/api/competitions/region_reports.xlsx",query:N}));case 2:case"end":return K.stop()}},U)}));return function(N){return w.apply(this,arguments)}}(),r=function(){var w=Object(I.a)(E.a.mark(function U(N){var F;return E.a.wrap(function($){for(;;)switch($.prev=$.next){case 0:return $.next=2,Object(L.y)(Object(S.a)({},N));case 2:F=$.sent,F.status===0?(M.b.info("\u5BFC\u51FA\u4EFB\u52A1\u751F\u6210\u6210\u529F"),R.d.push("/classrooms/".concat(N.coursesId,"/exportlist/exercise_score"))):F.status===-3&&(Object(R.c)()._store.dispatch({type:"classroomList/setActionTabs",payload:{key:"\u5BFC\u51FA\u63D0\u9192"}}),R.d.push("/classrooms/".concat(N.coursesId,"/exportlist/exercise_score")));case 4:case"end":return $.stop()}},U)}));return function(N){return w.apply(this,arguments)}}(),e=function(){var w=Object(I.a)(E.a.mark(function U(N){return E.a.wrap(function(K){for(;;)switch(K.prev=K.next){case 0:return console.log("----------","\u8C03\u7528\u4E0B\u8F7D"),K.next=3,Object(_.v)("",Object(_.ab)({url:C.a.API_SERVER+"/api/export_records/".concat(N.id,".xlsx"),query:N}));case 3:case"end":return K.stop()}},U)}));return function(N){return w.apply(this,arguments)}}(),n=function(){var w=Object(I.a)(E.a.mark(function U(N){return E.a.wrap(function(K){for(;;)switch(K.prev=K.next){case 0:return K.next=2,Object(_.v)("",Object(_.ab)({url:C.a.API_SERVER+"/api/ec_major_schools/0/ec_years.xlsx",query:N}));case 2:case"end":return K.stop()}},U)}));return function(N){return w.apply(this,arguments)}}(),c=function(){var w=Object(I.a)(E.a.mark(function U(N){return E.a.wrap(function(K){for(;;)switch(K.prev=K.next){case 0:return K.next=2,Object(_.v)("",Object(_.ab)({url:C.a.API_SERVER+"/api/ec_years/".concat(N==null?void 0:N.ec_year_id,"/ec_training_objectives.xlsx"),query:N}));case 2:case"end":return K.stop()}},U)}));return function(N){return w.apply(this,arguments)}}(),h=function(){var w=Object(I.a)(E.a.mark(function U(N){return E.a.wrap(function(K){for(;;)switch(K.prev=K.next){case 0:return K.next=2,Object(_.v)(N==null?void 0:N.name,Object(_.ab)({url:C.a.API_SERVER+"/api/attachments/get_ecs_attachment.docx",query:N}));case 2:case"end":return K.stop()}},U)}));return function(N){return w.apply(this,arguments)}}(),u=function(){var w=Object(I.a)(E.a.mark(function U(N){return E.a.wrap(function(K){for(;;)switch(K.prev=K.next){case 0:return K.next=2,Object(_.v)("",Object(_.ab)({url:C.a.API_SERVER+"/api/ec_years/".concat(N==null?void 0:N.ec_year_id,"/ec_courses.xlsx"),query:N}));case 2:case"end":return K.stop()}},U)}));return function(N){return w.apply(this,arguments)}}(),b=function(){var w=Object(I.a)(E.a.mark(function U(N){return E.a.wrap(function(K){for(;;)switch(K.prev=K.next){case 0:return K.next=2,Object(_.v)("",Object(_.ab)({url:C.a.API_SERVER+"/api/ec_years/".concat(N==null?void 0:N.ec_year_id,"/ec_graduation_requirements.xlsx"),query:N}));case 2:case"end":return K.stop()}},U)}));return function(N){return w.apply(this,arguments)}}(),A=function(){var w=Object(I.a)(E.a.mark(function U(N){return E.a.wrap(function(K){for(;;)switch(K.prev=K.next){case 0:return K.next=2,Object(_.v)("",Object(_.ab)({url:C.a.API_SERVER+"/api/courses/rank_list.xlsx",query:N}));case 2:case"end":return K.stop()}},U)}));return function(N){return w.apply(this,arguments)}}(),P=function(){var w=Object(I.a)(E.a.mark(function U(N){return E.a.wrap(function(K){for(;;)switch(K.prev=K.next){case 0:return K.next=2,Object(_.v)("",Object(_.ab)({url:C.a.API_SERVER+"/api/courses/question_rank_list.xlsx",query:N}));case 2:case"end":return K.stop()}},U)}));return function(N){return w.apply(this,arguments)}}()},n6Qo:function(Me,he,B){"use strict";B.d(he,"a",function(){return R});var Y=B("cDcd"),M=B("biw7"),S=B("fyJ8");function I(_){var C=_.className,y=_.index,T=_.children,O=_.colSpan,x=_.rowSpan,v=Y.useContext(M.a),g=v.prefixCls,d=v.fixedInfoList,t=d[y];return Y.createElement(S.a,Object.assign({className:C,index:y,component:"td",prefixCls:g,record:null,dataIndex:null,render:function(){return{children:T,props:{colSpan:O,rowSpan:x}}}},t))}function D(_){return Y.createElement("tr",Object.assign({},_))}function E(_){var C=_.children,y=Y.useContext(M.a),T=y.prefixCls;return Y.createElement("tfoot",{className:"".concat(T,"-summary")},C)}var L=he.b=E,R={Cell:I,Row:D}},p5ED:function(Me,he,B){"use strict";var Y=B("+L6B"),M=B("2/Rp"),S=B("5Dmo"),I=B("3S7+"),D=B("k1fw"),E=B("tJVT"),L=B("cDcd"),R=B.n(L),_=B("vHTk"),C=B.n(_),y=B("yEEn"),T=B("ZW9T"),O=B("1vsH");he.a=function(x){var v=x.name,g=x.data,d=x.theme,t=x.type,o=x.filename,i=x.monacoEditor,p=x.className,f=x.style,s=x.close,m=x.onClose,l=x.hasMask,a=Object(L.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),r=Object(E.a)(a,2),e=r[0],n=r[1],c=Object(L.useState)(""),h=Object(E.a)(c,2),u=h[0],b=h[1],A,P=1024*1024,w=10*P,U=Object(L.useRef)();t==="office"&&(A=Object(O.V)(g).filesize,A>w&&(t="other")),o&&(i.filename=o),Object(L.useEffect)(function(){var K,$,X=(K=document.cookie)===null||K===void 0||(($=K.replace(/\s/g,""))===null||$===void 0)?void 0:$.split(";");X==null||X.map(function(oe){var pe=oe.split("=");pe[0]==="_educoder_session"&&b(pe[1])})},[]);var N=function(){if(g.startsWith("http")||g.startsWith("/")){F();return}Object(O.z)(o||"educoder",g,o)},F=function(){Object(O.x)(o||v,g)};return console.log("data:",g,"fileanme:",o," name:",v),R.a.createElement("div",{style:Object(D.a)({},f||{}),className:"".concat(l&&C.a.bgBlack," ").concat(t?C.a.wrp:"hide")},s&&R.a.createElement("div",{className:C.a.close,ref:U},R.a.createElement(I.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return U.current}},R.a.createElement("span",{onClick:F},R.a.createElement("i",{className:"icon-quxiaozhiding"}))),R.a.createElement(I.a,{title:"\u5173\u95ED",getPopupContainer:function(){return U.current}},R.a.createElement("span",{className:"",onClick:m},R.a.createElement("i",{className:"icon-guanbi1"})))),R.a.createElement("div",{className:"".concat(C.a[p]," ").concat(p," ").concat(C.a.monaco," ").concat(t==="txt"?"show":"hide")},t==="txt"&&R.a.createElement(T.b,i)),t==="audio"&&R.a.createElement("audio",{src:"".concat(g!=null&&g.startsWith("/")||(g==null?void 0:g.indexOf("https://"))>-1?g:"data:audio/mp3;base64,").concat(g),autoPlay:!0}),t==="video"&&R.a.createElement(R.a.Fragment,null,g!=null&&g.startsWith("/")?R.a.createElement("video",{controls:!0,src:"".concat(g),autoPlay:!0}):R.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(g),autoPlay:!0})),t==="html"&&R.a.createElement("iframe",{src:g+"&disposition=inline"}),t==="pdf"&&R.a.createElement("embed",{className:C.a.embed,src:g}),t==="image"&&R.a.createElement(R.a.Fragment,null,R.a.createElement("img",{src:"".concat(g!=null&&g.startsWith("/")||(g==null?void 0:g.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(g)})),t==="other"&&R.a.createElement("div",null,R.a.createElement(M.a,{type:"primary",size:"large",onClick:N},R.a.createElement(y.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),(t==="download"||t==="office")&&R.a.createElement(M.a,{type:"primary",size:"large",onClick:N},R.a.createElement(y.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"rAM+":function(Me,he,B){"use strict";B.d(he,"a",function(){return M});var Y=B("Qw5x");function M(S,I){var D;if(typeof Symbol=="undefined"||S[Symbol.iterator]==null){if(Array.isArray(S)||(D=Object(Y.a)(S))||I&&S&&typeof S.length=="number"){D&&(S=D);var E=0,L=function(){};return{s:L,n:function(){return E>=S.length?{done:!0}:{done:!1,value:S[E++]}},e:function(T){throw T},f:L}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var R=!0,_=!1,C;return{s:function(){D=S[Symbol.iterator]()},n:function(){var T=D.next();return R=T.done,T},e:function(T){_=!0,C=T},f:function(){try{!R&&D.return!=null&&D.return()}finally{if(_)throw C}}}}},rUJ1:function(Me,he){const B=/[&<>"']/,Y=/[&<>"']/g,M=/[<>"']|&(?!#?\w+;)/,S=/[<>"']|&(?!#?\w+;)/g,I={"&":"&","<":"<",">":">",'"':""","'":"'"},D=l=>I[l];function E(l,a){if(a){if(B.test(l))return l.replace(Y,D)}else if(M.test(l))return l.replace(S,D);return l}const L=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function R(l){return l.replace(L,(a,r)=>(r=r.toLowerCase(),r==="colon"?":":r.charAt(0)==="#"?r.charAt(1)==="x"?String.fromCharCode(parseInt(r.substring(2),16)):String.fromCharCode(+r.substring(1)):""))}const _=/(^|[^\[])\^/g;function C(l,a){l=l.source||l,a=a||"";const r={replace:(e,n)=>(n=n.source||n,n=n.replace(_,"$1"),l=l.replace(e,n),r),getRegex:()=>new RegExp(l,a)};return r}const y=/[^\w:]/g,T=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function O(l,a,r){if(l){let e;try{e=decodeURIComponent(R(r)).replace(y,"").toLowerCase()}catch(n){return null}if(e.indexOf("javascript:")===0||e.indexOf("vbscript:")===0||e.indexOf("data:")===0)return null}a&&!T.test(r)&&(r=t(a,r));try{r=encodeURI(r).replace(/%25/g,"%")}catch(e){return null}return r}const x={},v=/^[^:]+:\/*[^/]*$/,g=/^([^:]+:)[\s\S]*$/,d=/^([^:]+:\/*[^/]*)[\s\S]*$/;function t(l,a){x[" "+l]||(v.test(l)?x[" "+l]=l+"/":x[" "+l]=f(l,"/",!0)),l=x[" "+l];const r=l.indexOf(":")===-1;return a.substring(0,2)==="//"?r?a:l.replace(g,"$1")+a:a.charAt(0)==="/"?r?a:l.replace(d,"$1")+a:l+a}const o={exec:function(){}};function i(l){let a=1,r,e;for(;a<arguments.length;a++){r=arguments[a];for(e in r)Object.prototype.hasOwnProperty.call(r,e)&&(l[e]=r[e])}return l}function p(l,a){const r=l.replace(/\|/g,(c,h,u)=>{let b=!1,A=h;for(;--A>=0&&u[A]==="\\";)b=!b;return b?"|":" |"}),e=r.split(/ \|/);let n=0;if(e.length>a)e.splice(a);else for(;e.length<a;)e.push("");for(;n<e.length;n++)e[n]=e[n].trim().replace(/\\\|/g,"|");return e}function f(l,a,r){const e=l.length;if(e===0)return"";let n=0;for(;n<e;){const c=l.charAt(e-n-1);if(c===a&&!r)n++;else if(c!==a&&r)n++;else break}return l.substr(0,e-n)}function s(l,a){if(l.indexOf(a[1])===-1)return-1;const r=l.length;let e=0,n=0;for(;n<r;n++)if(l[n]==="\\")n++;else if(l[n]===a[0])e++;else if(l[n]===a[1]&&(e--,e<0))return n;return-1}function m(l){l&&l.sanitize&&!l.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}Me.exports={escape:E,unescape:R,edit:C,cleanUrl:O,resolveUrl:t,noopTest:o,merge:i,splitCells:p,rtrim:f,findClosingBracket:s,checkSanitizeDeprecation:m}},sR1s:function(Me,he,B){"use strict";B.d(he,"b",function(){return I}),B.d(he,"a",function(){return D}),B.d(he,"c",function(){return E}),B.d(he,"d",function(){return L});var Y=B("U8pU"),M="RC_TABLE_KEY";function S(R){return R==null?[]:Array.isArray(R)?R:[R]}function I(R,_){if(!_&&typeof _!="number")return R;for(var C=S(_),y=R,T=0;T<C.length;T+=1){if(!y)return null;var O=C[T];y=y[O]}return y}function D(R){var _=[],C={};return R.forEach(function(y){for(var T=y||{},O=T.key,x=T.dataIndex,v=O||S(x).join("-")||M;C[v];)v="".concat(v,"_next");C[v]=!0,_.push(v)}),_}function E(){var R={};function _(O,x){x&&Object.keys(x).forEach(function(v){var g=x[v];g&&Object(Y.a)(g)==="object"?(O[v]=O[v]||{},_(O[v],g)):O[v]=g})}for(var C=arguments.length,y=new Array(C),T=0;T<C;T++)y[T]=arguments[T];return y.forEach(function(O){_(R,O)}),R}function L(R){return R!=null}},sZk2:function(Me,he,B){Me.exports=B.p+"static/paix.41effcff.svg"},sboe:function(Me,he,B){"use strict";B.d(he,"a",function(){return S});var Y=B("cDcd"),M=B.n(Y),S=Y.createContext(null)},t23M:function(Me,he,B){"use strict";var Y=B("VTBJ"),M=B("1OyB"),S=B("vuIU"),I=B("Ji7U"),D=B("LK+K"),E=B("cDcd"),L=B.n(E),R=B("m+aA"),_=B("Zm9Q"),C=B("Kwbf"),y=B("c+Xe"),T=B("bdgK"),O="rc-observer-key",x=function(v){Object(I.a)(d,v);var g=Object(D.a)(d);function d(){var t;return Object(M.a)(this,d),t=g.apply(this,arguments),t.resizeObserver=null,t.childNode=null,t.currentElement=null,t.state={width:0,height:0,offsetHeight:0,offsetWidth:0},t.onResize=function(o){var i=t.props.onResize,p=o[0].target,f=p.getBoundingClientRect(),s=f.width,m=f.height,l=p.offsetWidth,a=p.offsetHeight,r=Math.floor(s),e=Math.floor(m);if(t.state.width!==r||t.state.height!==e||t.state.offsetWidth!==l||t.state.offsetHeight!==a){var n={width:r,height:e,offsetWidth:l,offsetHeight:a};t.setState(n),i&&Promise.resolve().then(function(){i(Object(Y.a)(Object(Y.a)({},n),{},{offsetWidth:l,offsetHeight:a}))})}},t.setChildNode=function(o){t.childNode=o},t}return Object(S.a)(d,[{key:"componentDidMount",value:function(){this.onComponentUpdated()}},{key:"componentDidUpdate",value:function(){this.onComponentUpdated()}},{key:"componentWillUnmount",value:function(){this.destroyObserver()}},{key:"onComponentUpdated",value:function(){var o=this.props.disabled;if(o){this.destroyObserver();return}var i=Object(R.a)(this.childNode||this),p=i!==this.currentElement;p&&(this.destroyObserver(),this.currentElement=i),!this.resizeObserver&&i&&(this.resizeObserver=new T.default(this.onResize),this.resizeObserver.observe(i))}},{key:"destroyObserver",value:function(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null)}},{key:"render",value:function(){var o=this.props.children,i=Object(_.a)(o);if(i.length>1)Object(C.a)(!1,"Find more than one child node with `children` in ResizeObserver. Will only observe first one.");else if(i.length===0)return Object(C.a)(!1,"`children` of ResizeObserver is empty. Nothing is in observe."),null;var p=i[0];if(E.isValidElement(p)&&Object(y.c)(p)){var f=p.ref;i[0]=E.cloneElement(p,{ref:Object(y.a)(f,this.setChildNode)})}return i.length===1?i[0]:i.map(function(s,m){return!E.isValidElement(s)||"key"in s&&s.key!==null?s:E.cloneElement(s,{key:"".concat(O,"-").concat(m)})})}}]),d}(E.Component);x.displayName="ResizeObserver",he.a=x},ulZh:function(Me,he,B){typeof window!="undefined"&&function(M,S){Me.exports=S()}(this,function(){return function(Y){var M={};function S(I){if(M[I])return M[I].exports;var D=M[I]={i:I,l:!1,exports:{}};return Y[I].call(D.exports,D,D.exports,S),D.l=!0,D.exports}return S.m=Y,S.c=M,S.d=function(I,D,E){S.o(I,D)||Object.defineProperty(I,D,{enumerable:!0,get:E})},S.r=function(I){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(I,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(I,"__esModule",{value:!0})},S.t=function(I,D){if(D&1&&(I=S(I)),D&8)return I;if(D&4&&typeof I=="object"&&I&&I.__esModule)return I;var E=Object.create(null);if(S.r(E),Object.defineProperty(E,"default",{enumerable:!0,value:I}),D&2&&typeof I!="string")for(var L in I)S.d(E,L,function(R){return I[R]}.bind(null,L));return E},S.n=function(I){var D=I&&I.__esModule?function(){return I.default}:function(){return I};return S.d(D,"a",D),D},S.o=function(I,D){return Object.prototype.hasOwnProperty.call(I,D)},S.p="/dist/",S(S.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(Y,M,S){"use strict";var I=Object.prototype.hasOwnProperty,D="~";function E(){}Object.create&&(E.prototype=Object.create(null),new E().__proto__||(D=!1));function L(y,T,O){this.fn=y,this.context=T,this.once=O||!1}function R(y,T,O,x,v){if(typeof O!="function")throw new TypeError("The listener must be a function");var g=new L(O,x||y,v),d=D?D+T:T;return y._events[d]?y._events[d].fn?y._events[d]=[y._events[d],g]:y._events[d].push(g):(y._events[d]=g,y._eventsCount++),y}function _(y,T){--y._eventsCount===0?y._events=new E:delete y._events[T]}function C(){this._events=new E,this._eventsCount=0}C.prototype.eventNames=function(){var T=[],O,x;if(this._eventsCount===0)return T;for(x in O=this._events)I.call(O,x)&&T.push(D?x.slice(1):x);return Object.getOwnPropertySymbols?T.concat(Object.getOwnPropertySymbols(O)):T},C.prototype.listeners=function(T){var O=D?D+T:T,x=this._events[O];if(!x)return[];if(x.fn)return[x.fn];for(var v=0,g=x.length,d=new Array(g);v<g;v++)d[v]=x[v].fn;return d},C.prototype.listenerCount=function(T){var O=D?D+T:T,x=this._events[O];return x?x.fn?1:x.length:0},C.prototype.emit=function(T,O,x,v,g,d){var t=D?D+T:T;if(!this._events[t])return!1;var o=this._events[t],i=arguments.length,p,f;if(o.fn){o.once&&this.removeListener(T,o.fn,void 0,!0);switch(i){case 1:return o.fn.call(o.context),!0;case 2:return o.fn.call(o.context,O),!0;case 3:return o.fn.call(o.context,O,x),!0;case 4:return o.fn.call(o.context,O,x,v),!0;case 5:return o.fn.call(o.context,O,x,v,g),!0;case 6:return o.fn.call(o.context,O,x,v,g,d),!0}for(f=1,p=new Array(i-1);f<i;f++)p[f-1]=arguments[f];o.fn.apply(o.context,p)}else{var s=o.length,m;for(f=0;f<s;f++){o[f].once&&this.removeListener(T,o[f].fn,void 0,!0);switch(i){case 1:o[f].fn.call(o[f].context);break;case 2:o[f].fn.call(o[f].context,O);break;case 3:o[f].fn.call(o[f].context,O,x);break;case 4:o[f].fn.call(o[f].context,O,x,v);break;default:if(!p)for(m=1,p=new Array(i-1);m<i;m++)p[m-1]=arguments[m];o[f].fn.apply(o[f].context,p)}}}return!0},C.prototype.on=function(T,O,x){return R(this,T,O,x,!1)},C.prototype.once=function(T,O,x){return R(this,T,O,x,!0)},C.prototype.removeListener=function(T,O,x,v){var g=D?D+T:T;if(!this._events[g])return this;if(!O)return _(this,g),this;var d=this._events[g];if(d.fn)d.fn===O&&(!v||d.once)&&(!x||d.context===x)&&_(this,g);else{for(var t=0,o=[],i=d.length;t<i;t++)(d[t].fn!==O||v&&!d[t].once||x&&d[t].context!==x)&&o.push(d[t]);o.length?this._events[g]=o.length===1?o[0]:o:_(this,g)}return this},C.prototype.removeAllListeners=function(T){var O;return T?(O=D?D+T:T,this._events[O]&&_(this,O)):(this._events=new E,this._eventsCount=0),this},C.prototype.off=C.prototype.removeListener,C.prototype.addListener=C.prototype.on,C.prefixed=D,C.EventEmitter=C,Y.exports=C},"./node_modules/url-toolkit/src/url-toolkit.js":function(Y,M,S){(function(I){var D=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,E=/^([^\/?#]*)([^]*)$/,L=/(?:\/|^)\.(?=\/)/g,R=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,_={buildAbsoluteURL:function(C,y,T){if(T=T||{},C=C.trim(),y=y.trim(),!y){if(!T.alwaysNormalize)return C;var O=_.parseURL(C);if(!O)throw new Error("Error trying to parse base URL.");return O.path=_.normalizePath(O.path),_.buildURLFromParts(O)}var x=_.parseURL(y);if(!x)throw new Error("Error trying to parse relative URL.");if(x.scheme)return T.alwaysNormalize?(x.path=_.normalizePath(x.path),_.buildURLFromParts(x)):y;var v=_.parseURL(C);if(!v)throw new Error("Error trying to parse base URL.");if(!v.netLoc&&v.path&&v.path[0]!=="/"){var g=E.exec(v.path);v.netLoc=g[1],v.path=g[2]}v.netLoc&&!v.path&&(v.path="/");var d={scheme:v.scheme,netLoc:x.netLoc,path:null,params:x.params,query:x.query,fragment:x.fragment};if(!x.netLoc&&(d.netLoc=v.netLoc,x.path[0]!=="/"))if(!x.path)d.path=v.path,x.params||(d.params=v.params,x.query||(d.query=v.query));else{var t=v.path,o=t.substring(0,t.lastIndexOf("/")+1)+x.path;d.path=_.normalizePath(o)}return d.path===null&&(d.path=T.alwaysNormalize?_.normalizePath(x.path):x.path),_.buildURLFromParts(d)},parseURL:function(C){var y=D.exec(C);return y?{scheme:y[1]||"",netLoc:y[2]||"",path:y[3]||"",params:y[4]||"",query:y[5]||"",fragment:y[6]||""}:null},normalizePath:function(C){for(C=C.split("").reverse().join("").replace(L,"");C.length!==(C=C.replace(R,"")).length;);return C.split("").reverse().join("")},buildURLFromParts:function(C){return C.scheme+C.netLoc+C.path+C.params+C.query+C.fragment}};Y.exports=_})(this)},"./node_modules/webworkify-webpack/index.js":function(Y,M,S){function I(T){var O={};function x(g){if(O[g])return O[g].exports;var d=O[g]={i:g,l:!1,exports:{}};return T[g].call(d.exports,d,d.exports,x),d.l=!0,d.exports}x.m=T,x.c=O,x.i=function(g){return g},x.d=function(g,d,t){x.o(g,d)||Object.defineProperty(g,d,{configurable:!1,enumerable:!0,get:t})},x.r=function(g){Object.defineProperty(g,"__esModule",{value:!0})},x.n=function(g){var d=g&&g.__esModule?function(){return g.default}:function(){return g};return x.d(d,"a",d),d},x.o=function(g,d){return Object.prototype.hasOwnProperty.call(g,d)},x.p="/",x.oe=function(g){throw console.error(g),g};var v=x(x.s=ENTRY_MODULE);return v.default||v}var D="[\\.|\\-|\\+|\\w|/|@]+",E="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+D+").*?\\)";function L(T){return(T+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function R(T){return!isNaN(1*T)}function _(T,O,x){var v={};v[x]=[];var g=O.toString(),d=g.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!d)return v;for(var t=d[1],o=new RegExp("(\\\\n|\\W)"+L(t)+E,"g"),i;i=o.exec(g);){if(i[3]==="dll-reference")continue;v[x].push(i[3])}for(o=new RegExp("\\("+L(t)+'\\("(dll-reference\\s('+D+'))"\\)\\)'+E,"g");i=o.exec(g);)T[i[2]]||(v[x].push(i[1]),T[i[2]]=S(i[1]).m),v[i[2]]=v[i[2]]||[],v[i[2]].push(i[4]);for(var p=Object.keys(v),f=0;f<p.length;f++)for(var s=0;s<v[p[f]].length;s++)R(v[p[f]][s])&&(v[p[f]][s]=1*v[p[f]][s]);return v}function C(T){var O=Object.keys(T);return O.reduce(function(x,v){return x||T[v].length>0},!1)}function y(T,O){for(var x={main:[O]},v={main:[]},g={main:{}};C(x);)for(var d=Object.keys(x),t=0;t<d.length;t++){var o=d[t],i=x[o],p=i.pop();if(g[o]=g[o]||{},g[o][p]||!T[o][p])continue;g[o][p]=!0,v[o]=v[o]||[],v[o].push(p);for(var f=_(T,T[o][p],o),s=Object.keys(f),m=0;m<s.length;m++)x[s[m]]=x[s[m]]||[],x[s[m]]=x[s[m]].concat(f[s[m]])}return v}Y.exports=function(T,O){O=O||{};var x={main:S.m},v=O.all?{main:Object.keys(x.main)}:y(x,T),g="";Object.keys(v).filter(function(p){return p!=="main"}).forEach(function(p){for(var f=0;v[p][f];)f++;v[p].push(f),x[p][f]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",g=g+"var "+p+" = ("+I.toString().replace("ENTRY_MODULE",JSON.stringify(f))+")({"+v[p].map(function(s){return""+JSON.stringify(s)+": "+x[p][s].toString()}).join(",")+`});
|
|
`}),g=g+"new (("+I.toString().replace("ENTRY_MODULE",JSON.stringify(T))+")({"+v.main.map(function(p){return""+JSON.stringify(p)+": "+x.main[p].toString()}).join(",")+"}))(self);";var d=new window.Blob([g],{type:"text/javascript"});if(O.bare)return d;var t=window.URL||window.webkitURL||window.mozURL||window.msURL,o=t.createObjectURL(d),i=new window.Worker(o);return i.objectURL=o,i}},"./src/config.ts":function(Y,M,S){"use strict";S.r(M),S.d(M,"hlsDefaultConfig",function(){return m}),S.d(M,"mergeConfig",function(){return a}),S.d(M,"enableStreamingMode",function(){return r});var I=S("./src/controller/abr-controller.ts"),D=S("./src/controller/audio-stream-controller.ts"),E=S("./src/controller/audio-track-controller.ts"),L=S("./src/controller/subtitle-stream-controller.ts"),R=S("./src/controller/subtitle-track-controller.ts"),_=S("./src/controller/buffer-controller.ts"),C=S("./src/controller/timeline-controller.ts"),y=S("./src/controller/cap-level-controller.ts"),T=S("./src/controller/fps-controller.ts"),O=S("./src/controller/eme-controller.ts"),x=S("./src/controller/cmcd-controller.ts"),v=S("./src/utils/xhr-loader.ts"),g=S("./src/utils/fetch-loader.ts"),d=S("./src/utils/cues.ts"),t=S("./src/utils/mediakeys-helper.ts"),o=S("./src/utils/logger.ts");function i(){return i=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var c=arguments[n];for(var h in c)Object.prototype.hasOwnProperty.call(c,h)&&(e[h]=c[h])}return e},i.apply(this,arguments)}function p(e,n){var c=Object.keys(e);if(Object.getOwnPropertySymbols){var h=Object.getOwnPropertySymbols(e);n&&(h=h.filter(function(u){return Object.getOwnPropertyDescriptor(e,u).enumerable})),c.push.apply(c,h)}return c}function f(e){for(var n=1;n<arguments.length;n++){var c=arguments[n]!=null?arguments[n]:{};n%2?p(Object(c),!0).forEach(function(h){s(e,h,c[h])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(c)):p(Object(c)).forEach(function(h){Object.defineProperty(e,h,Object.getOwnPropertyDescriptor(c,h))})}return e}function s(e,n,c){return n in e?Object.defineProperty(e,n,{value:c,enumerable:!0,configurable:!0,writable:!0}):e[n]=c,e}var m=f(f({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:Infinity,maxBufferSize:60*1e3*1e3,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:Infinity,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:v.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:I.default,bufferController:_.default,capLevelController:y.default,fpsController:T.default,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystemOptions:{},requestMediaKeySystemAccessFunc:t.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},l()),{},{subtitleStreamController:L.SubtitleStreamController,subtitleTrackController:R.default,timelineController:C.TimelineController,audioStreamController:D.default,audioTrackController:E.default,emeController:O.default,cmcdController:x.default});function l(){return{cueHandler:d.default,enableCEA708Captions:!0,enableWebVTT:!0,enableIMSC1:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function a(e,n){if((n.liveSyncDurationCount||n.liveMaxLatencyDurationCount)&&(n.liveSyncDuration||n.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(n.liveMaxLatencyDurationCount!==void 0&&(n.liveSyncDurationCount===void 0||n.liveMaxLatencyDurationCount<=n.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(n.liveMaxLatencyDuration!==void 0&&(n.liveSyncDuration===void 0||n.liveMaxLatencyDuration<=n.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return i({},e,n)}function r(e){var n=e.loader;if(n!==g.default&&n!==v.default)o.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),e.progressive=!1;else{var c=Object(g.fetchSupported)();c&&(e.loader=g.default,e.progressive=!0,e.enableSoftwareAES=!0,o.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(Y,M,S){"use strict";S.r(M);var I=S("./src/polyfills/number.ts"),D=S("./src/utils/ewma-bandwidth-estimator.ts"),E=S("./src/events.ts"),L=S("./src/utils/buffer-helper.ts"),R=S("./src/errors.ts"),_=S("./src/types/loader.ts"),C=S("./src/utils/logger.ts");function y(x,v){for(var g=0;g<v.length;g++){var d=v[g];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(x,d.key,d)}}function T(x,v,g){return v&&y(x.prototype,v),g&&y(x,g),x}var O=function(){function x(g){this.hls=void 0,this.lastLoadedFragLevel=0,this._nextAutoLevel=-1,this.timer=void 0,this.onCheck=this._abandonRulesCheck.bind(this),this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this.hls=g;var d=g.config;this.bwEstimator=new D.default(d.abrEwmaSlowVoD,d.abrEwmaFastVoD,d.abrEwmaDefaultEstimate),this.registerListeners()}var v=x.prototype;return v.registerListeners=function(){var d=this.hls;d.on(E.Events.FRAG_LOADING,this.onFragLoading,this),d.on(E.Events.FRAG_LOADED,this.onFragLoaded,this),d.on(E.Events.FRAG_BUFFERED,this.onFragBuffered,this),d.on(E.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.on(E.Events.ERROR,this.onError,this)},v.unregisterListeners=function(){var d=this.hls;d.off(E.Events.FRAG_LOADING,this.onFragLoading,this),d.off(E.Events.FRAG_LOADED,this.onFragLoaded,this),d.off(E.Events.FRAG_BUFFERED,this.onFragBuffered,this),d.off(E.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.off(E.Events.ERROR,this.onError,this)},v.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},v.onFragLoading=function(d,t){var o=t.frag;if(o.type===_.PlaylistLevelType.MAIN&&!this.timer){var i;this.fragCurrent=o,this.partCurrent=(i=t.part)!=null?i:null,this.timer=self.setInterval(this.onCheck,100)}},v.onLevelLoaded=function(d,t){var o=this.hls.config;t.details.live?this.bwEstimator.update(o.abrEwmaSlowLive,o.abrEwmaFastLive):this.bwEstimator.update(o.abrEwmaSlowVoD,o.abrEwmaFastVoD)},v._abandonRulesCheck=function(){var d=this.fragCurrent,t=this.partCurrent,o=this.hls,i=o.autoLevelEnabled,p=o.config,f=o.media;if(!d||!f)return;var s=t?t.stats:d.stats,m=t?t.duration:d.duration;if(s.aborted){C.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!i||f.paused||!f.playbackRate||!f.readyState)return;var l=performance.now()-s.loading.start,a=Math.abs(f.playbackRate);if(l<=500*m/a)return;var r=o.levels,e=o.minAutoLevel,n=r[d.level],c=s.total||Math.max(s.loaded,Math.round(m*n.maxBitrate/8)),h=Math.max(1,s.bwEstimate?s.bwEstimate/8:s.loaded*1e3/l),u=(c-s.loaded)/h,b=f.currentTime,A=(L.BufferHelper.bufferInfo(f,b,p.maxBufferHole).end-b)/a;if(A>=2*m/a||u<=A)return;var P=Number.POSITIVE_INFINITY,w;for(w=d.level-1;w>e;w--){var U=r[w].maxBitrate;if(P=m*U/(8*.8*h),P<A)break}if(P>=u)return;var N=this.bwEstimator.getEstimate();C.logger.warn("Fragment "+d.sn+(t?" part "+t.index:"")+" of level "+d.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+w+`
|
|
Current BW estimate: `+(Object(I.isFiniteNumber)(N)?(N/1024).toFixed(3):"Unknown")+` Kb/s
|
|
Estimated load time for current fragment: `+u.toFixed(3)+` s
|
|
Estimated load time for the next fragment: `+P.toFixed(3)+` s
|
|
Time to underbuffer: `+A.toFixed(3)+" s"),o.nextLoadLevel=w,this.bwEstimator.sample(l,s.loaded),this.clearTimer(),d.loader&&(this.fragCurrent=this.partCurrent=null,d.loader.abort()),o.trigger(E.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:d,part:t,stats:s})},v.onFragLoaded=function(d,t){var o=t.frag,i=t.part;if(o.type===_.PlaylistLevelType.MAIN&&Object(I.isFiniteNumber)(o.sn)){var p=i?i.stats:o.stats,f=i?i.duration:o.duration;if(this.clearTimer(),this.lastLoadedFragLevel=o.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var s=this.hls.levels[o.level],m=(s.loaded?s.loaded.bytes:0)+p.loaded,l=(s.loaded?s.loaded.duration:0)+f;s.loaded={bytes:m,duration:l},s.realBitrate=Math.round(8*m/l)}if(o.bitrateTest){var a={stats:p,frag:o,part:i,id:o.type};this.onFragBuffered(E.Events.FRAG_BUFFERED,a),o.bitrateTest=!1}}},v.onFragBuffered=function(d,t){var o=t.frag,i=t.part,p=i?i.stats:o.stats;if(p.aborted)return;if(o.type!==_.PlaylistLevelType.MAIN||o.sn==="initSegment")return;var f=p.parsing.end-p.loading.start;this.bwEstimator.sample(f,p.loaded),p.bwEstimate=this.bwEstimator.getEstimate(),o.bitrateTest?this.bitrateTestDelay=f/1e3:this.bitrateTestDelay=0},v.onError=function(d,t){switch(t.details){case R.ErrorDetails.FRAG_LOAD_ERROR:case R.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},v.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},v.getNextABRAutoLevel=function(){var d=this.fragCurrent,t=this.partCurrent,o=this.hls,i=o.maxAutoLevel,p=o.config,f=o.minAutoLevel,s=o.media,m=t?t.duration:d?d.duration:0,l=s?s.currentTime:0,a=s&&s.playbackRate!==0?Math.abs(s.playbackRate):1,r=this.bwEstimator?this.bwEstimator.getEstimate():p.abrEwmaDefaultEstimate,e=(L.BufferHelper.bufferInfo(s,l,p.maxBufferHole).end-l)/a,n=this.findBestLevel(r,f,i,e,p.abrBandWidthFactor,p.abrBandWidthUpFactor);if(n>=0)return n;C.logger.trace((e?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var c=m?Math.min(m,p.maxStarvationDelay):p.maxStarvationDelay,h=p.abrBandWidthFactor,u=p.abrBandWidthUpFactor;if(!e){var b=this.bitrateTestDelay;if(b){var A=m?Math.min(m,p.maxLoadingDelay):p.maxLoadingDelay;c=A-b,C.logger.trace("bitrate test took "+Math.round(1e3*b)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*c)+" ms"),h=u=1}}return n=this.findBestLevel(r,f,i,e+c,h,u),Math.max(n,0)},v.findBestLevel=function(d,t,o,i,p,f){for(var s,m=this.fragCurrent,l=this.partCurrent,a=this.lastLoadedFragLevel,r=this.hls.levels,e=r[a],n=!!(e!=null&&(s=e.details)!==null&&s!==void 0&&s.live),c=e==null?void 0:e.codecSet,h=l?l.duration:m?m.duration:0,u=o;u>=t;u--){var b=r[u];if(!b||c&&b.codecSet!==c)continue;var A=b.details,P=(l?A==null?void 0:A.partTarget:A==null?void 0:A.averagetargetduration)||h,w=void 0;u<=a?w=p*d:w=f*d;var U=r[u].maxBitrate,N=U*P/w;if(C.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+u+"/"+Math.round(w)+"/"+U+"/"+P+"/"+i+"/"+N),w>U&&(!N||n&&!this.bitrateTestDelay||N<i))return u}return-1},T(x,[{key:"nextAutoLevel",get:function(){var d=this._nextAutoLevel,t=this.bwEstimator;if(d!==-1&&(!t||!t.canEstimate()))return d;var o=this.getNextABRAutoLevel();return d!==-1&&(o=Math.min(d,o)),o},set:function(d){this._nextAutoLevel=d}}]),x}();M.default=O},"./src/controller/audio-stream-controller.ts":function(Y,M,S){"use strict";S.r(M);var I=S("./src/polyfills/number.ts"),D=S("./src/controller/base-stream-controller.ts"),E=S("./src/events.ts"),L=S("./src/utils/buffer-helper.ts"),R=S("./src/controller/fragment-tracker.ts"),_=S("./src/types/level.ts"),C=S("./src/types/loader.ts"),y=S("./src/loader/fragment.ts"),T=S("./src/demux/chunk-cache.ts"),O=S("./src/demux/transmuxer-interface.ts"),x=S("./src/types/transmuxer.ts"),v=S("./src/controller/fragment-finders.ts"),g=S("./src/utils/discontinuities.ts"),d=S("./src/errors.ts"),t=S("./src/utils/logger.ts");function o(){return o=Object.assign||function(m){for(var l=1;l<arguments.length;l++){var a=arguments[l];for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(m[r]=a[r])}return m},o.apply(this,arguments)}function i(m,l){m.prototype=Object.create(l.prototype),m.prototype.constructor=m,p(m,l)}function p(m,l){return p=Object.setPrototypeOf||function(r,e){return r.__proto__=e,r},p(m,l)}var f=100,s=function(m){i(l,m);function l(r,e){var n;return n=m.call(this,r,e,"[audio-stream-controller]")||this,n.videoBuffer=null,n.videoTrackCC=-1,n.waitingVideoCC=-1,n.audioSwitch=!1,n.trackId=-1,n.waitingData=null,n.mainDetails=null,n.bufferFlushed=!1,n._registerListeners(),n}var a=l.prototype;return a.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},a._registerListeners=function(){var e=this.hls;e.on(E.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(E.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.Events.LEVEL_LOADED,this.onLevelLoaded,this),e.on(E.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on(E.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(E.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(E.Events.ERROR,this.onError,this),e.on(E.Events.BUFFER_RESET,this.onBufferReset,this),e.on(E.Events.BUFFER_CREATED,this.onBufferCreated,this),e.on(E.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(E.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(E.Events.FRAG_BUFFERED,this.onFragBuffered,this)},a._unregisterListeners=function(){var e=this.hls;e.off(E.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(E.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.Events.LEVEL_LOADED,this.onLevelLoaded,this),e.off(E.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off(E.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(E.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(E.Events.ERROR,this.onError,this),e.off(E.Events.BUFFER_RESET,this.onBufferReset,this),e.off(E.Events.BUFFER_CREATED,this.onBufferCreated,this),e.off(E.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(E.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(E.Events.FRAG_BUFFERED,this.onFragBuffered,this)},a.onInitPtsFound=function(e,n){var c=n.frag,h=n.id,u=n.initPTS;if(h==="main"){var b=c.cc;this.initPTS[c.cc]=u,this.log("InitPTS for cc: "+b+" found from main: "+u),this.videoTrackCC=b,this.state===D.State.WAITING_INIT_PTS&&this.tick()}},a.startLoad=function(e){if(!this.levels){this.startPosition=e,this.state=D.State.STOPPED;return}var n=this.lastCurrentTime;this.stopLoad(),this.setInterval(f),this.fragLoadError=0,n>0&&e===-1?(this.log("Override startPosition with lastCurrentTime @"+n.toFixed(3)),this.state=D.State.IDLE):(this.loadedmetadata=!1,this.state=D.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()},a.doTick=function(){switch(this.state){case D.State.IDLE:this.doTickIdle();break;case D.State.WAITING_TRACK:{var e,n=this.levels,c=this.trackId,h=n==null||((e=n[c])===null||e===void 0)?void 0:e.details;if(h){if(this.waitForCdnTuneIn(h))break;this.state=D.State.WAITING_INIT_PTS}break}case D.State.FRAG_LOADING_WAITING_RETRY:{var u,b=performance.now(),A=this.retryDate;(!A||b>=A||(u=this.media)!==null&&u!==void 0&&u.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=D.State.IDLE);break}case D.State.WAITING_INIT_PTS:{var P=this.waitingData;if(P){var w=P.frag,U=P.part,N=P.cache,F=P.complete;if(this.initPTS[w.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=D.State.FRAG_LOADING;var K=N.flush(),$={frag:w,part:U,payload:K,networkDetails:null};this._handleFragmentLoadProgress($),F&&m.prototype._handleFragmentLoadComplete.call(this,$)}else if(this.videoTrackCC!==this.waitingVideoCC)t.logger.log("Waiting fragment cc ("+w.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var X=this.getLoadPosition(),oe=L.BufferHelper.bufferInfo(this.mediaBuffer,X,this.config.maxBufferHole),pe=Object(v.fragmentWithinToleranceTest)(oe.end,this.config.maxFragLookUpTolerance,w);pe<0&&(t.logger.log("Waiting fragment cc ("+w.cc+") @ "+w.start+" cancelled because another fragment at "+oe.end+" is needed"),this.clearWaitingFragment())}}else this.state=D.State.IDLE}}this.onTickEnd()},a.clearWaitingFragment=function(){var e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=D.State.IDLE)},a.onTickEnd=function(){var e=this.media;if(!e||!e.readyState)return;var n=this.mediaBuffer?this.mediaBuffer:e,c=n.buffered;!this.loadedmetadata&&c.length&&(this.loadedmetadata=!0),this.lastCurrentTime=e.currentTime},a.doTickIdle=function(){var e,n,c=this.hls,h=this.levels,u=this.media,b=this.trackId,A=c.config;if(!h||!h[b])return;if(!u&&(this.startFragRequested||!A.startFragPrefetch))return;var P=h[b],w=P.details;if(!w||w.live&&this.levelLastLoaded!==b||this.waitForCdnTuneIn(w)){this.state=D.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,y.ElementaryStreamTypes.AUDIO,C.PlaylistLevelType.AUDIO));var U=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,C.PlaylistLevelType.AUDIO);if(U===null)return;var N=U.len,F=this.getMaxBufferLength(),K=this.audioSwitch;if(N>=F&&!K)return;if(!K&&this._streamEnded(U,w)){c.trigger(E.Events.BUFFER_EOS,{type:"audio"}),this.state=D.State.ENDED;return}var $=w.fragments,X=$[0].start,oe=U.end;if(K){var pe=this.getLoadPosition();oe=pe,w.PTSKnown&&pe<X&&((U.end>X||U.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),u.currentTime=X+.05))}var ee=this.getNextFragment(oe,w);if(!ee){this.bufferFlushed=!0;return}((e=ee.decryptdata)===null||e===void 0?void 0:e.keyFormat)==="identity"&&!((n=ee.decryptdata)!==null&&n!==void 0&&n.key)?this.loadKey(ee,w):this.loadFragment(ee,w,oe)},a.getMaxBufferLength=function(){var e=m.prototype.getMaxBufferLength.call(this),n=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,C.PlaylistLevelType.MAIN);return n===null?e:Math.max(e,n.len)},a.onMediaDetaching=function(){this.videoBuffer=null,m.prototype.onMediaDetaching.call(this)},a.onAudioTracksUpdated=function(e,n){var c=n.audioTracks;this.resetTransmuxer(),this.levels=c.map(function(h){return new _.Level(h)})},a.onAudioTrackSwitching=function(e,n){var c=!!n.url;this.trackId=n.id;var h=this.fragCurrent;h!=null&&h.loader&&h.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),c?this.setInterval(f):this.resetTransmuxer(),c?(this.audioSwitch=!0,this.state=D.State.IDLE):this.state=D.State.STOPPED,this.tick()},a.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},a.onLevelLoaded=function(e,n){this.mainDetails=n.details},a.onAudioTrackLoaded=function(e,n){var c,h=this.levels,u=n.details,b=n.id;if(!h){this.warn("Audio tracks were reset while loading level "+b);return}this.log("Track "+b+" loaded ["+u.startSN+","+u.endSN+"],duration:"+u.totalduration);var A=h[b],P=0;if(u.live||(c=A.details)!==null&&c!==void 0&&c.live){var w=this.mainDetails;if(u.fragments[0]||(u.deltaUpdateFailed=!0),u.deltaUpdateFailed||!w)return;!A.details&&u.hasProgramDateTime&&w.hasProgramDateTime?(Object(g.alignMediaPlaylistByPDT)(u,w),P=u.fragments[0].start):P=this.alignPlaylists(u,A.details)}A.details=u,this.levelLastLoaded=b,!this.startFragRequested&&(this.mainDetails||!u.live)&&this.setStartPosition(A.details,P),this.state===D.State.WAITING_TRACK&&!this.waitForCdnTuneIn(u)&&(this.state=D.State.IDLE),this.tick()},a._handleFragmentLoadProgress=function(e){var n,c=e.frag,h=e.part,u=e.payload,b=this.config,A=this.trackId,P=this.levels;if(!P){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+c.sn+" of level "+c.level+" will not be buffered");return}var w=P[A];console.assert(w,"Audio track is defined on fragment load progress");var U=w.details;console.assert(U,"Audio track details are defined on fragment load progress");var N=b.defaultAudioCodec||w.audioCodec||"mp4a.40.2",F=this.transmuxer;F||(F=this.transmuxer=new O.default(this.hls,C.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var K=this.initPTS[c.cc],$=(n=c.initSegment)===null||n===void 0?void 0:n.data;if(K!==void 0){var X=!1,oe=h?h.index:-1,pe=oe!==-1,ee=new x.ChunkMetadata(c.level,c.sn,c.stats.chunkCount,u.byteLength,oe,pe);F.push(u,$,N,"",c,h,U.totalduration,X,ee,K)}else{t.logger.log("Unknown video PTS for cc "+c.cc+", waiting for video PTS before demuxing audio frag "+c.sn+" of ["+U.startSN+" ,"+U.endSN+"],track "+A);var de=this.waitingData=this.waitingData||{frag:c,part:h,cache:new T.default,complete:!1},le=de.cache;le.push(new Uint8Array(u)),this.waitingVideoCC=this.videoTrackCC,this.state=D.State.WAITING_INIT_PTS}},a._handleFragmentLoadComplete=function(e){if(this.waitingData){this.waitingData.complete=!0;return}m.prototype._handleFragmentLoadComplete.call(this,e)},a.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},a.onBufferCreated=function(e,n){var c=n.tracks.audio;c&&(this.mediaBuffer=c.buffer),n.tracks.video&&(this.videoBuffer=n.tracks.video.buffer)},a.onFragBuffered=function(e,n){var c=n.frag,h=n.part;if(c.type!==C.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(c)){this.warn("Fragment "+c.sn+(h?" p: "+h.index:"")+" of level "+c.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}c.sn!=="initSegment"&&(this.fragPrevious=c,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(E.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(c,h)},a.onError=function(e,n){switch(n.details){case d.ErrorDetails.FRAG_LOAD_ERROR:case d.ErrorDetails.FRAG_LOAD_TIMEOUT:case d.ErrorDetails.KEY_LOAD_ERROR:case d.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(C.PlaylistLevelType.AUDIO,n);break;case d.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case d.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==D.State.ERROR&&this.state!==D.State.STOPPED&&(this.state=n.fatal?D.State.ERROR:D.State.IDLE,this.warn(n.details+" while loading frag, switching to "+this.state+" state"));break;case d.ErrorDetails.BUFFER_FULL_ERROR:if(n.parent==="audio"&&(this.state===D.State.PARSING||this.state===D.State.PARSED)){var c=!0,h=this.getFwdBufferInfo(this.mediaBuffer,C.PlaylistLevelType.AUDIO);h&&h.len>.5&&(c=!this.reduceMaxBufferLength(h.len)),c&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,m.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},a.onBufferFlushed=function(e,n){var c=n.type;c===y.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},a._handleTransmuxComplete=function(e){var n,c="audio",h=this.hls,u=e.remuxResult,b=e.chunkMeta,A=this.getCurrentContext(b);if(!A){this.warn("The loading context changed while buffering fragment "+b.sn+" of level "+b.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(b.level);return}var P=A.frag,w=A.part,U=u.audio,N=u.text,F=u.id3,K=u.initSegment;if(this.fragContextChanged(P))return;if(this.state=D.State.PARSING,this.audioSwitch&&U&&this.completeAudioSwitch(),K!=null&&K.tracks&&(this._bufferInitSegment(K.tracks,P,b),h.trigger(E.Events.FRAG_PARSING_INIT_SEGMENT,{frag:P,id:c,tracks:K.tracks})),U){var $=U.startPTS,X=U.endPTS,oe=U.startDTS,pe=U.endDTS;w&&(w.elementaryStreams[y.ElementaryStreamTypes.AUDIO]={startPTS:$,endPTS:X,startDTS:oe,endDTS:pe}),P.setElementaryStreamInfo(y.ElementaryStreamTypes.AUDIO,$,X,oe,pe),this.bufferFragmentData(U,P,w,b)}if(F!=null&&(n=F.samples)!==null&&n!==void 0&&n.length){var ee=o({frag:P,id:c},F);h.trigger(E.Events.FRAG_PARSING_METADATA,ee)}if(N){var de=o({frag:P,id:c},N);h.trigger(E.Events.FRAG_PARSING_USERDATA,de)}},a._bufferInitSegment=function(e,n,c){if(this.state!==D.State.PARSING)return;e.video&&delete e.video;var h=e.audio;if(!h)return;h.levelCodec=h.codec,h.id="audio",this.log("Init audio buffer, container:"+h.container+", codecs[parsed]=["+h.codec+"]"),this.hls.trigger(E.Events.BUFFER_CODECS,e);var u=h.initSegment;if(u!=null&&u.byteLength){var b={type:"audio",frag:n,part:null,chunkMeta:c,parent:n.type,data:u};this.hls.trigger(E.Events.BUFFER_APPENDING,b)}this.tick()},a.loadFragment=function(e,n,c){var h=this.fragmentTracker.getState(e);this.fragCurrent=e,(this.audioSwitch||h===R.FragmentState.NOT_LOADED||h===R.FragmentState.PARTIAL)&&(e.sn==="initSegment"?this._loadInitSegment(e):n.live&&!Object(I.isFiniteNumber)(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=D.State.WAITING_INIT_PTS):(this.startFragRequested=!0,m.prototype.loadFragment.call(this,e,n,c)))},a.completeAudioSwitch=function(){var e=this.hls,n=this.media,c=this.trackId;n&&(this.log("Switching audio track : flushing all audio"),m.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,e.trigger(E.Events.AUDIO_TRACK_SWITCHED,{id:c})},l}(D.default);M.default=s},"./src/controller/audio-track-controller.ts":function(Y,M,S){"use strict";S.r(M);var I=S("./src/events.ts"),D=S("./src/errors.ts"),E=S("./src/controller/base-playlist-controller.ts"),L=S("./src/types/loader.ts");function R(O,x){for(var v=0;v<x.length;v++){var g=x[v];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(O,g.key,g)}}function _(O,x,v){return x&&R(O.prototype,x),v&&R(O,v),O}function C(O,x){O.prototype=Object.create(x.prototype),O.prototype.constructor=O,y(O,x)}function y(O,x){return y=Object.setPrototypeOf||function(g,d){return g.__proto__=d,g},y(O,x)}var T=function(O){C(x,O);function x(g){var d;return d=O.call(this,g,"[audio-track-controller]")||this,d.tracks=[],d.groupId=null,d.tracksInGroup=[],d.trackId=-1,d.trackName="",d.selectDefaultTrack=!0,d.registerListeners(),d}var v=x.prototype;return v.registerListeners=function(){var d=this.hls;d.on(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.on(I.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.on(I.Events.LEVEL_LOADING,this.onLevelLoading,this),d.on(I.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),d.on(I.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.on(I.Events.ERROR,this.onError,this)},v.unregisterListeners=function(){var d=this.hls;d.off(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.off(I.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.off(I.Events.LEVEL_LOADING,this.onLevelLoading,this),d.off(I.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),d.off(I.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.off(I.Events.ERROR,this.onError,this)},v.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,O.prototype.destroy.call(this)},v.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},v.onManifestParsed=function(d,t){this.tracks=t.audioTracks||[]},v.onAudioTrackLoaded=function(d,t){var o=t.id,i=t.details,p=this.tracksInGroup[o];if(!p){this.warn("Invalid audio track id "+o);return}var f=p.details;p.details=t.details,this.log("audioTrack "+o+" loaded ["+i.startSN+"-"+i.endSN+"]"),o===this.trackId&&(this.retryCount=0,this.playlistLoaded(o,t,f))},v.onLevelLoading=function(d,t){this.switchLevel(t.level)},v.onLevelSwitching=function(d,t){this.switchLevel(t.level)},v.switchLevel=function(d){var t=this.hls.levels[d];if(!(t!=null&&t.audioGroupIds))return;var o=t.audioGroupIds[t.urlId];if(this.groupId!==o){this.groupId=o;var i=this.tracks.filter(function(f){return!o||f.groupId===o});this.selectDefaultTrack&&!i.some(function(f){return f.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=i;var p={audioTracks:i};this.log("Updating audio tracks, "+i.length+' track(s) found in "'+o+'" group-id'),this.hls.trigger(I.Events.AUDIO_TRACKS_UPDATED,p),this.selectInitialTrack()}},v.onError=function(d,t){if(O.prototype.onError.call(this,d,t),t.fatal||!t.context)return;t.context.type===L.PlaylistContextType.AUDIO_TRACK&&t.context.id===this.trackId&&t.context.groupId===this.groupId&&this.retryLoadingOrFail(t)},v.setAudioTrack=function(d){var t=this.tracksInGroup;if(d<0||d>=t.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var o=t[this.trackId];this.log("Now switching to audio-track index "+d);var i=t[d],p=i.id,f=i.groupId,s=f===void 0?"":f,m=i.name,l=i.type,a=i.url;if(this.trackId=d,this.trackName=m,this.selectDefaultTrack=!1,this.hls.trigger(I.Events.AUDIO_TRACK_SWITCHING,{id:p,groupId:s,name:m,type:l,url:a}),i.details&&!i.details.live)return;var r=this.switchParams(i.url,o==null?void 0:o.details);this.loadPlaylist(r)},v.selectInitialTrack=function(){var d=this.tracksInGroup;console.assert(d.length,"Initial audio track should be selected when tracks are known");var t=this.trackName,o=this.findTrackId(t)||this.findTrackId();o!==-1?this.setAudioTrack(o):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(I.Events.ERROR,{type:D.ErrorTypes.MEDIA_ERROR,details:D.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},v.findTrackId=function(d){for(var t=this.tracksInGroup,o=0;o<t.length;o++){var i=t[o];if((!this.selectDefaultTrack||i.default)&&(!d||d===i.name))return i.id}return-1},v.loadPlaylist=function(d){var t=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(t)){var o=t.id,i=t.groupId,p=t.url;if(d)try{p=d.addDirectives(p)}catch(f){this.warn("Could not construct new URL with HLS Delivery Directives: "+f)}this.log("loading audio-track playlist for id: "+o),this.clearTimer(),this.hls.trigger(I.Events.AUDIO_TRACK_LOADING,{url:p,id:o,groupId:i,deliveryDirectives:d||null})}},_(x,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(d){this.selectDefaultTrack=!1,this.setAudioTrack(d)}}]),x}(E.default);M.default=T},"./src/controller/base-playlist-controller.ts":function(Y,M,S){"use strict";S.r(M),S.d(M,"default",function(){return _});var I=S("./src/polyfills/number.ts"),D=S("./src/types/level.ts"),E=S("./src/controller/level-helper.ts"),L=S("./src/utils/logger.ts"),R=S("./src/errors.ts"),_=function(){function C(T,O){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=L.logger.log.bind(L.logger,O+":"),this.warn=L.logger.warn.bind(L.logger,O+":"),this.hls=T}var y=C.prototype;return y.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},y.onError=function(O,x){x.fatal&&x.type===R.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},y.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},y.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},y.stopLoad=function(){this.canLoad=!1,this.clearTimer()},y.switchParams=function(O,x){var v=x==null?void 0:x.renditionReports;if(v)for(var g=0;g<v.length;g++){var d=v[g],t=""+d.URI;if(t===O.substr(-t.length)){var o=parseInt(d["LAST-MSN"]),i=parseInt(d["LAST-PART"]);if(x&&this.hls.config.lowLatencyMode){var p=Math.min(x.age-x.partTarget,x.targetduration);i!==void 0&&p>x.partTarget&&(i+=1)}if(Object(I.isFiniteNumber)(o))return new D.HlsUrlParameters(o,Object(I.isFiniteNumber)(i)?i:void 0,D.HlsSkip.No)}}},y.loadPlaylist=function(O){},y.shouldLoadTrack=function(O){return this.canLoad&&O&&!!O.url&&(!O.details||O.details.live)},y.playlistLoaded=function(O,x,v){var g=this,d=x.details,t=x.stats,o=t.loading.end?Math.max(0,self.performance.now()-t.loading.end):0;if(d.advancedDateTime=Date.now()-o,d.live||v!=null&&v.live){if(d.reloaded(v),v&&this.log("live playlist "+O+" "+(d.advanced?"REFRESHED "+d.lastPartSn+"-"+d.lastPartIndex:"MISSED")),v&&d.fragments.length>0&&Object(E.mergeDetails)(v,d),!this.canLoad||!d.live)return;var i,p=void 0,f=void 0;if(d.canBlockReload&&d.endSN&&d.advanced){var s=this.hls.config.lowLatencyMode,m=d.lastPartSn,l=d.endSN,a=d.lastPartIndex,r=a!==-1,e=m===l,n=s?0:a;r?(p=e?l+1:m,f=e?n:a+1):p=l+1;var c=d.age,h=c+d.ageHeader,u=Math.min(h-d.partTarget,d.targetduration*1.5);if(u>0){if(v&&u>v.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+v.tuneInGoal+" to: "+u+" with playlist age: "+d.age),u=0;else{var b=Math.floor(u/d.targetduration);if(p+=b,f!==void 0){var A=Math.round(u%d.targetduration/d.partTarget);f+=A}this.log("CDN Tune-in age: "+d.ageHeader+"s last advanced "+c.toFixed(2)+"s goal: "+u+" skip sn "+b+" to part "+f)}d.tuneInGoal=u}if(i=this.getDeliveryDirectives(d,x.deliveryDirectives,p,f),s||!e){this.loadPlaylist(i);return}}else i=this.getDeliveryDirectives(d,x.deliveryDirectives,p,f);var P=Object(E.computeReloadInterval)(d,t);p!==void 0&&d.canBlockReload&&(P-=d.partTarget||1),this.log("reload live playlist "+O+" in "+Math.round(P)+" ms"),this.timer=self.setTimeout(function(){return g.loadPlaylist(i)},P)}else this.clearTimer()},y.getDeliveryDirectives=function(O,x,v,g){var d=Object(D.getSkipValue)(O,v);return x!=null&&x.skip&&O.deltaUpdateFailed&&(v=x.msn,g=x.part,d=D.HlsSkip.No),new D.HlsUrlParameters(v,g,d)},y.retryLoadingOrFail=function(O){var x=this,v=this.hls.config,g=this.retryCount<v.levelLoadingMaxRetry;if(g){var d;if(this.retryCount++,O.details.indexOf("LoadTimeOut")>-1&&(d=O.context)!==null&&d!==void 0&&d.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+O.details+'"'),this.loadPlaylist();else{var t=Math.min(Math.pow(2,this.retryCount)*v.levelLoadingRetryDelay,v.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return x.loadPlaylist()},t),this.warn("retry playlist loading #"+this.retryCount+" in "+t+' ms after "'+O.details+'"')}}else this.warn('cannot recover from error "'+O.details+'"'),this.clearTimer(),O.fatal=!0;return g},C}()},"./src/controller/base-stream-controller.ts":function(Y,M,S){"use strict";S.r(M),S.d(M,"State",function(){return l}),S.d(M,"default",function(){return a});var I=S("./src/polyfills/number.ts"),D=S("./src/task-loop.ts"),E=S("./src/controller/fragment-tracker.ts"),L=S("./src/utils/buffer-helper.ts"),R=S("./src/utils/logger.ts"),_=S("./src/events.ts"),C=S("./src/errors.ts"),y=S("./src/types/transmuxer.ts"),T=S("./src/utils/mp4-tools.ts"),O=S("./src/utils/discontinuities.ts"),x=S("./src/controller/fragment-finders.ts"),v=S("./src/controller/level-helper.ts"),g=S("./src/loader/fragment-loader.ts"),d=S("./src/crypt/decrypter.ts"),t=S("./src/utils/time-ranges.ts"),o=S("./src/types/loader.ts");function i(r,e){for(var n=0;n<e.length;n++){var c=e[n];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(r,c.key,c)}}function p(r,e,n){return e&&i(r.prototype,e),n&&i(r,n),r}function f(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function s(r,e){r.prototype=Object.create(e.prototype),r.prototype.constructor=r,m(r,e)}function m(r,e){return m=Object.setPrototypeOf||function(c,h){return c.__proto__=h,c},m(r,e)}var l={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",BACKTRACKING:"BACKTRACKING",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"},a=function(r){s(e,r);function e(c,h,u){var b;return b=r.call(this)||this,b.hls=void 0,b.fragPrevious=null,b.fragCurrent=null,b.fragmentTracker=void 0,b.transmuxer=null,b._state=l.STOPPED,b.media=void 0,b.mediaBuffer=void 0,b.config=void 0,b.bitrateTest=!1,b.lastCurrentTime=0,b.nextLoadPosition=0,b.startPosition=0,b.loadedmetadata=!1,b.fragLoadError=0,b.retryDate=0,b.levels=null,b.fragmentLoader=void 0,b.levelLastLoaded=null,b.startFragRequested=!1,b.decrypter=void 0,b.initPTS=[],b.onvseeking=null,b.onvended=null,b.logPrefix="",b.log=void 0,b.warn=void 0,b.logPrefix=u,b.log=R.logger.log.bind(R.logger,u+":"),b.warn=R.logger.warn.bind(R.logger,u+":"),b.hls=c,b.fragmentLoader=new g.default(c.config),b.fragmentTracker=h,b.config=c.config,b.decrypter=new d.default(c,c.config),c.on(_.Events.KEY_LOADED,b.onKeyLoaded,f(b)),b}var n=e.prototype;return n.doTick=function(){this.onTickEnd()},n.onTickEnd=function(){},n.startLoad=function(h){},n.stopLoad=function(){this.fragmentLoader.abort();var h=this.fragCurrent;h&&this.fragmentTracker.removeFragment(h),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=l.STOPPED},n._streamEnded=function(h,u){var b=this.fragCurrent,A=this.fragmentTracker;if(!u.live&&b&&b.sn===u.endSN&&!h.nextStart){var P=A.getState(b);return P===E.FragmentState.PARTIAL||P===E.FragmentState.OK}return!1},n.onMediaAttached=function(h,u){var b=this.media=this.mediaBuffer=u.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),b.addEventListener("seeking",this.onvseeking),b.addEventListener("ended",this.onvended);var A=this.config;this.levels&&A.autoStartLoad&&this.state===l.STOPPED&&this.startLoad(A.startPosition)},n.onMediaDetaching=function(){var h=this.media;h!=null&&h.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),h&&(h.removeEventListener("seeking",this.onvseeking),h.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},n.onMediaSeeking=function(){var h=this.config,u=this.fragCurrent,b=this.media,A=this.mediaBuffer,P=this.state,w=b?b.currentTime:0,U=L.BufferHelper.bufferInfo(A||b,w,h.maxBufferHole);if(this.log("media seeking to "+(Object(I.isFiniteNumber)(w)?w.toFixed(3):w)+", state: "+P),P===l.ENDED)this.resetLoadingState();else if(u&&!U.len){var N=h.maxFragLookUpTolerance,F=u.start-N,K=u.start+u.duration+N,$=w>K;(w<F||$)&&($&&u.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),u.loader.abort()),this.resetLoadingState())}b&&(this.lastCurrentTime=w),!this.loadedmetadata&&!U.len&&(this.nextLoadPosition=this.startPosition=w),this.tickImmediate()},n.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},n.onKeyLoaded=function(h,u){if(this.state!==l.KEY_LOADING||u.frag!==this.fragCurrent||!this.levels)return;this.state=l.IDLE;var b=this.levels[u.frag.level].details;b&&this.loadFragment(u.frag,b,u.frag.start)},n.onHandlerDestroying=function(){this.stopLoad(),r.prototype.onHandlerDestroying.call(this)},n.onHandlerDestroyed=function(){this.state=l.STOPPED,this.hls.off(_.Events.KEY_LOADED,this.onKeyLoaded,this),this.fragmentLoader&&this.fragmentLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.fragmentLoader=this.fragmentTracker=null,r.prototype.onHandlerDestroyed.call(this)},n.loadKey=function(h,u){this.log("Loading key for "+h.sn+" of ["+u.startSN+"-"+u.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+h.level),this.state=l.KEY_LOADING,this.fragCurrent=h,this.hls.trigger(_.Events.KEY_LOADING,{frag:h})},n.loadFragment=function(h,u,b){this._loadFragForPlayback(h,u,b)},n._loadFragForPlayback=function(h,u,b){var A=this,P=function(U){if(A.fragContextChanged(h)){A.warn("Fragment "+h.sn+(U.part?" p: "+U.part.index:"")+" of level "+h.level+" was dropped during download."),A.fragmentTracker.removeFragment(h);return}h.stats.chunkCount++,A._handleFragmentLoadProgress(U)};this._doFragLoad(h,u,b,P).then(function(w){if(!w)return;A.fragLoadError=0;var U=A.state;if(A.fragContextChanged(h)){(U===l.FRAG_LOADING||U===l.BACKTRACKING||!A.fragCurrent&&U===l.PARSING)&&(A.fragmentTracker.removeFragment(h),A.state=l.IDLE);return}if("payload"in w&&(A.log("Loaded fragment "+h.sn+" of level "+h.level),A.hls.trigger(_.Events.FRAG_LOADED,w),A.state===l.BACKTRACKING)){A.fragmentTracker.backtrack(h,w),A.resetFragmentLoading(h);return}A._handleFragmentLoadComplete(w)}).catch(function(w){A.warn(w),A.resetFragmentLoading(h)})},n.flushMainBuffer=function(h,u,b){if(b===void 0&&(b=null),!(h-u))return;var A={startOffset:h,endOffset:u,type:b};this.fragLoadError=0,this.hls.trigger(_.Events.BUFFER_FLUSHING,A)},n._loadInitSegment=function(h){var u=this;this._doFragLoad(h).then(function(b){if(!b||u.fragContextChanged(h)||!u.levels)throw new Error("init load aborted");return b}).then(function(b){var A=u.hls,P=b.payload,w=h.decryptdata;if(P&&P.byteLength>0&&w&&w.key&&w.iv&&w.method==="AES-128"){var U=self.performance.now();return u.decrypter.webCryptoDecrypt(new Uint8Array(P),w.key.buffer,w.iv.buffer).then(function(N){var F=self.performance.now();return A.trigger(_.Events.FRAG_DECRYPTED,{frag:h,payload:N,stats:{tstart:U,tdecrypt:F}}),b.payload=N,b})}return b}).then(function(b){var A=u.fragCurrent,P=u.hls,w=u.levels;if(!w)throw new Error("init load aborted, missing levels");var U=w[h.level].details;console.assert(U,"Level details are defined when init segment is loaded");var N=h.stats;u.state=l.IDLE,u.fragLoadError=0,h.data=new Uint8Array(b.payload),N.parsing.start=N.buffering.start=self.performance.now(),N.parsing.end=N.buffering.end=self.performance.now(),b.frag===A&&P.trigger(_.Events.FRAG_BUFFERED,{stats:N,frag:A,part:null,id:h.type}),u.tick()}).catch(function(b){u.warn(b),u.resetFragmentLoading(h)})},n.fragContextChanged=function(h){var u=this.fragCurrent;return!h||!u||h.level!==u.level||h.sn!==u.sn||h.urlId!==u.urlId},n.fragBufferedComplete=function(h,u){var b=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+h.type+" sn: "+h.sn+(u?" part: "+u.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+h.level+" "+t.default.toString(L.BufferHelper.getBuffered(b))),this.state=l.IDLE,this.tick()},n._handleFragmentLoadComplete=function(h){var u=this.transmuxer;if(!u)return;var b=h.frag,A=h.part,P=h.partsLoaded,w=!P||P.length===0||P.some(function(N){return!N}),U=new y.ChunkMetadata(b.level,b.sn,b.stats.chunkCount+1,0,A?A.index:-1,!w);u.flush(U)},n._handleFragmentLoadProgress=function(h){},n._doFragLoad=function(h,u,b,A){var P=this;if(b===void 0&&(b=null),!this.levels)throw new Error("frag load aborted, missing levels");if(b=Math.max(h.start,b||0),this.config.lowLatencyMode&&u){var w=u.partList;if(w&&A){b>h.end&&u.fragmentHint&&(h=u.fragmentHint);var U=this.getNextPart(w,h,b);if(U>-1){var N=w[U];return this.log("Loading part sn: "+h.sn+" p: "+N.index+" cc: "+h.cc+" of playlist ["+u.startSN+"-"+u.endSN+"] parts [0-"+U+"-"+(w.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+h.level+", target: "+parseFloat(b.toFixed(3))),this.nextLoadPosition=N.start+N.duration,this.state=l.FRAG_LOADING,this.hls.trigger(_.Events.FRAG_LOADING,{frag:h,part:w[U],targetBufferTime:b}),this.doFragPartsLoad(h,w,U,A).catch(function(F){return P.handleFragLoadError(F)})}else if(!h.url||this.loadedEndOfParts(w,b))return Promise.resolve(null)}}return this.log("Loading fragment "+h.sn+" cc: "+h.cc+" "+(u?"of ["+u.startSN+"-"+u.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+h.level+", target: "+parseFloat(b.toFixed(3))),Object(I.isFiniteNumber)(h.sn)&&!this.bitrateTest&&(this.nextLoadPosition=h.start+h.duration),this.state=l.FRAG_LOADING,this.hls.trigger(_.Events.FRAG_LOADING,{frag:h,targetBufferTime:b}),this.fragmentLoader.load(h,A).catch(function(F){return P.handleFragLoadError(F)})},n.doFragPartsLoad=function(h,u,b,A){var P=this;return new Promise(function(w,U){var N=[],F=function K($){var X=u[$];P.fragmentLoader.loadPart(h,X,A).then(function(oe){N[X.index]=oe;var pe=oe.part;P.hls.trigger(_.Events.FRAG_LOADED,oe);var ee=u[$+1];if(ee&&ee.fragment===h)K($+1);else return w({frag:h,part:pe,partsLoaded:N})}).catch(U)};F(b)})},n.handleFragLoadError=function(h){var u=h.data;return u&&u.details===C.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(u.frag,u.part):this.hls.trigger(_.Events.ERROR,u),null},n._handleTransmuxerFlush=function(h){var u=this.getCurrentContext(h);if(!u||this.state!==l.PARSING){this.fragCurrent||(this.state=l.IDLE);return}var b=u.frag,A=u.part,P=u.level,w=self.performance.now();b.stats.parsing.end=w,A&&(A.stats.parsing.end=w),this.updateLevelTiming(b,A,P,h.partial)},n.getCurrentContext=function(h){var u=this.levels,b=h.level,A=h.sn,P=h.part;if(!u||!u[b])return this.warn("Levels object was unset while buffering fragment "+A+" of level "+b+". The current chunk will not be buffered."),null;var w=u[b],U=P>-1?Object(v.getPartWith)(w,A,P):null,N=U?U.fragment:Object(v.getFragmentWithSN)(w,A,this.fragCurrent);return N?{frag:N,part:U,level:w}:null},n.bufferFragmentData=function(h,u,b,A){if(!h||this.state!==l.PARSING)return;var P=h.data1,w=h.data2,U=P;if(P&&w&&(U=Object(T.appendUint8Array)(P,w)),!U||!U.length)return;var N={type:h.type,frag:u,part:b,chunkMeta:A,parent:u.type,data:U};this.hls.trigger(_.Events.BUFFER_APPENDING,N),h.dropped&&h.independent&&!b&&this.flushBufferGap(u)},n.flushBufferGap=function(h){var u=this.media;if(!u)return;if(!L.BufferHelper.isBuffered(u,u.currentTime)){this.flushMainBuffer(0,h.start);return}var b=u.currentTime,A=L.BufferHelper.bufferInfo(u,b,0),P=h.duration,w=Math.min(this.config.maxFragLookUpTolerance*2,P*.25),U=Math.max(Math.min(h.start-w,A.end-w),b+w);h.start-U>w&&this.flushMainBuffer(U,h.start)},n.getFwdBufferInfo=function(h,u){var b=this.config,A=this.getLoadPosition();if(!Object(I.isFiniteNumber)(A))return null;var P=L.BufferHelper.bufferInfo(h,A,b.maxBufferHole);if(P.len===0&&P.nextStart!==void 0){var w=this.fragmentTracker.getBufferedFrag(A,u);if(w&&P.nextStart<w.end)return L.BufferHelper.bufferInfo(h,A,Math.max(P.nextStart,b.maxBufferHole))}return P},n.getMaxBufferLength=function(h){var u=this.config,b;return h?b=Math.max(8*u.maxBufferSize/h,u.maxBufferLength):b=u.maxBufferLength,Math.min(b,u.maxMaxBufferLength)},n.reduceMaxBufferLength=function(h){var u=this.config,b=h||u.maxBufferLength;return u.maxMaxBufferLength>=b?(u.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+u.maxMaxBufferLength+"s"),!0):!1},n.getNextFragment=function(h,u){var b,A,P=u.fragments,w=P.length;if(!w)return null;var U=this.config,N=P[0].start,F;if(u.live){var K=U.initialLiveManifestSize;if(w<K)return this.warn("Not enough fragments to start playback (have: "+w+", need: "+K+")"),null;!u.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(F=this.getInitialLiveFragment(u,P),this.startPosition=F?this.hls.liveSyncPosition||F.start:h)}else h<=N&&(F=P[0]);if(!F){var $=U.lowLatencyMode?u.partEnd:u.fragmentEnd;F=this.getFragmentAtPosition(h,$,u)}return(b=F)!==null&&b!==void 0&&b.initSegment&&!((A=F)!==null&&A!==void 0&&A.initSegment.data)&&!this.bitrateTest&&(F=F.initSegment),F},n.getNextPart=function(h,u,b){for(var A=-1,P=!1,w=!0,U=0,N=h.length;U<N;U++){var F=h[U];if(w=w&&!F.independent,A>-1&&b<F.start)break;var K=F.loaded;!K&&(P||F.independent||w)&&F.fragment===u&&(A=U),P=K}return A},n.loadedEndOfParts=function(h,u){var b=h[h.length-1];return b&&u>b.start&&b.loaded},n.getInitialLiveFragment=function(h,u){var b=this.fragPrevious,A=null;if(b){if(h.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+b.programDateTime),A=Object(x.findFragmentByPDT)(u,b.endProgramDateTime,this.config.maxFragLookUpTolerance)),!A){var P=b.sn+1;if(P>=h.startSN&&P<=h.endSN){var w=u[P-h.startSN];b.cc===w.cc&&(A=w,this.log("Live playlist, switching playlist, load frag with next SN: "+A.sn))}A||(A=Object(x.findFragWithCC)(u,b.cc),A&&this.log("Live playlist, switching playlist, load frag with same CC: "+A.sn))}}else{var U=this.hls.liveSyncPosition;U!==null&&(A=this.getFragmentAtPosition(U,this.bitrateTest?h.fragmentEnd:h.edge,h))}return A},n.getFragmentAtPosition=function(h,u,b){var A=this.config,P=this.fragPrevious,w=b.fragments,U=b.endSN,N=b.fragmentHint,F=A.maxFragLookUpTolerance,K=!!(A.lowLatencyMode&&b.partList&&N);K&&N&&!this.bitrateTest&&(w=w.concat(N),U=N.sn);var $;if(h<u){var X=h>u-F?0:F;$=Object(x.findFragmentByPTS)(P,w,h,X)}else $=w[w.length-1];if($){var oe=$.sn-b.startSN,pe=P&&$.level===P.level,ee=w[oe+1],de=this.fragmentTracker.getState($);if(de===E.FragmentState.BACKTRACKED){$=null;for(var le=oe;w[le]&&this.fragmentTracker.getState(w[le])===E.FragmentState.BACKTRACKED;)P?$=w[le--]:$=w[--le];$||($=ee)}else P&&$.sn===P.sn&&!K&&(pe&&($.sn<U&&this.fragmentTracker.getState(ee)!==E.FragmentState.OK?(this.log("SN "+$.sn+" just loaded, load next one: "+ee.sn),$=ee):$=null))}return $},n.synchronizeToLiveEdge=function(h){var u=this.config,b=this.media;if(!b)return;var A=this.hls.liveSyncPosition,P=b.currentTime,w=h.fragments[0].start,U=h.edge,N=P>=w-u.maxFragLookUpTolerance&&P<=U;if(A!==null&&b.duration>A&&(P<A||!N)){var F=u.liveMaxLatencyDuration!==void 0?u.liveMaxLatencyDuration:u.liveMaxLatencyDurationCount*h.targetduration;(!N&&b.readyState<4||P<U-F)&&(this.loadedmetadata||(this.nextLoadPosition=A),b.readyState&&(this.warn("Playback: "+P.toFixed(3)+" is located too far from the end of live sliding playlist: "+U+", reset currentTime to : "+A.toFixed(3)),b.currentTime=A))}},n.alignPlaylists=function(h,u){var b=this.levels,A=this.levelLastLoaded,P=this.fragPrevious,w=A!==null?b[A]:null,U=h.fragments.length;if(!U)return this.warn("No fragments in live playlist"),0;var N=h.fragments[0].start,F=!u,K=h.alignedSliding&&Object(I.isFiniteNumber)(N);if(F||!K&&!N){Object(O.alignStream)(P,w,h);var $=h.fragments[0].start;return this.log("Live playlist sliding: "+$.toFixed(2)+" start-sn: "+(u?u.startSN:"na")+"->"+h.startSN+" prev-sn: "+(P?P.sn:"na")+" fragments: "+U),$}return N},n.waitForCdnTuneIn=function(h){var u=3;return h.live&&h.canBlockReload&&h.tuneInGoal>Math.max(h.partHoldBack,h.partTarget*u)},n.setStartPosition=function(h,u){var b=this.startPosition;if(b<u&&(b=-1),b===-1||this.lastCurrentTime===-1){var A=h.startTimeOffset;Object(I.isFiniteNumber)(A)?(b=u+A,A<0&&(b+=h.totalduration),b=Math.min(Math.max(u,b),u+h.totalduration),this.log("Start time offset "+A+" found in playlist, adjust startPosition to "+b),this.startPosition=b):h.live?b=this.hls.liveSyncPosition||u:this.startPosition=b=0,this.lastCurrentTime=b}this.nextLoadPosition=b},n.getLoadPosition=function(){var h=this.media,u=0;return this.loadedmetadata&&h?u=h.currentTime:this.nextLoadPosition&&(u=this.nextLoadPosition),u},n.handleFragLoadAborted=function(h,u){this.transmuxer&&h.sn!=="initSegment"&&h.stats.aborted&&(this.warn("Fragment "+h.sn+(u?" part"+u.index:"")+" of level "+h.level+" was aborted"),this.resetFragmentLoading(h))},n.resetFragmentLoading=function(h){(!this.fragCurrent||!this.fragContextChanged(h))&&(this.state=l.IDLE)},n.onFragmentOrKeyLoadError=function(h,u){if(u.fatal)return;var b=u.frag;if(!b||b.type!==h)return;var A=this.fragCurrent;console.assert(A&&b.sn===A.sn&&b.level===A.level&&b.urlId===A.urlId,"Frag load error must match current frag to retry");var P=this.config;if(this.fragLoadError+1<=P.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(b.level))return;var w=Math.min(Math.pow(2,this.fragLoadError)*P.fragLoadingRetryDelay,P.fragLoadingMaxRetryTimeout);this.warn("Fragment "+b.sn+" of "+h+" "+b.level+" failed to load, retrying in "+w+"ms"),this.retryDate=self.performance.now()+w,this.fragLoadError++,this.state=l.FRAG_LOADING_WAITING_RETRY}else u.levelRetry?(h===o.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=l.IDLE):(R.logger.error(u.details+" reaches max retry, redispatch as fatal ..."),u.fatal=!0,this.hls.stopLoad(),this.state=l.ERROR)},n.afterBufferFlushed=function(h,u,b){if(!h)return;var A=L.BufferHelper.getBuffered(h);this.fragmentTracker.detectEvictedFragments(u,A,b),this.state===l.ENDED&&this.resetLoadingState()},n.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=l.IDLE},n.resetLiveStartWhenNotLoaded=function(h){if(!this.loadedmetadata){this.startFragRequested=!1;var u=this.levels?this.levels[h].details:null;if(u!=null&&u.live)return this.startPosition=-1,this.setStartPosition(u,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},n.updateLevelTiming=function(h,u,b,A){var P=this,w=b.details;console.assert(!!w,"level.details must be defined");var U=Object.keys(h.elementaryStreams).reduce(function(N,F){var K=h.elementaryStreams[F];if(K){var $=K.endPTS-K.startPTS;if($<=0)return P.warn("Could not parse fragment "+h.sn+" "+F+" duration reliably ("+$+") resetting transmuxer to fallback to playlist timing"),P.resetTransmuxer(),N||!1;var X=A?0:Object(v.updateFragPTSDTS)(w,h,K.startPTS,K.endPTS,K.startDTS,K.endDTS);return P.hls.trigger(_.Events.LEVEL_PTS_UPDATED,{details:w,level:b,drift:X,type:F,frag:h,start:K.startPTS,end:K.endPTS}),!0}return N},!1);U?(this.state=l.PARSED,this.hls.trigger(_.Events.FRAG_PARSED,{frag:h,part:u})):this.resetLoadingState()},n.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},p(e,[{key:"state",get:function(){return this._state},set:function(h){var u=this._state;u!==h&&(this._state=h,this.log(u+"->"+h))}}]),e}(D.default)},"./src/controller/buffer-controller.ts":function(Y,M,S){"use strict";S.r(M),S.d(M,"default",function(){return x});var I=S("./src/polyfills/number.ts"),D=S("./src/events.ts"),E=S("./src/utils/logger.ts"),L=S("./src/errors.ts"),R=S("./src/utils/buffer-helper.ts"),_=S("./src/utils/mediasource-helper.ts"),C=S("./src/loader/fragment.ts"),y=S("./src/controller/buffer-operation-queue.ts"),T=Object(_.getMediaSource)(),O=/([ha]vc.)(?:\.[^.,]+)+/,x=function(){function v(d){var t=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var o=t.hls,i=t.media,p=t.mediaSource;E.logger.log("[buffer-controller]: Media source opened"),i&&(t.updateMediaElementDuration(),o.trigger(D.Events.MEDIA_ATTACHED,{media:i})),p&&p.removeEventListener("sourceopen",t._onMediaSourceOpen),t.checkPendingTracks()},this._onMediaSourceClose=function(){E.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){E.logger.log("[buffer-controller]: Media source ended")},this.hls=d,this._initSourceBuffer(),this.registerListeners()}var g=v.prototype;return g.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},g.destroy=function(){this.unregisterListeners(),this.details=null},g.registerListeners=function(){var t=this.hls;t.on(D.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),t.on(D.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(D.Events.MANIFEST_PARSED,this.onManifestParsed,this),t.on(D.Events.BUFFER_RESET,this.onBufferReset,this),t.on(D.Events.BUFFER_APPENDING,this.onBufferAppending,this),t.on(D.Events.BUFFER_CODECS,this.onBufferCodecs,this),t.on(D.Events.BUFFER_EOS,this.onBufferEos,this),t.on(D.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),t.on(D.Events.LEVEL_UPDATED,this.onLevelUpdated,this),t.on(D.Events.FRAG_PARSED,this.onFragParsed,this),t.on(D.Events.FRAG_CHANGED,this.onFragChanged,this)},g.unregisterListeners=function(){var t=this.hls;t.off(D.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),t.off(D.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(D.Events.MANIFEST_PARSED,this.onManifestParsed,this),t.off(D.Events.BUFFER_RESET,this.onBufferReset,this),t.off(D.Events.BUFFER_APPENDING,this.onBufferAppending,this),t.off(D.Events.BUFFER_CODECS,this.onBufferCodecs,this),t.off(D.Events.BUFFER_EOS,this.onBufferEos,this),t.off(D.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),t.off(D.Events.LEVEL_UPDATED,this.onLevelUpdated,this),t.off(D.Events.FRAG_PARSED,this.onFragParsed,this),t.off(D.Events.FRAG_CHANGED,this.onFragChanged,this)},g._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new y.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},g.onManifestParsed=function(t,o){var i=2;(o.audio&&!o.video||!o.altAudio)&&(i=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=i,this.details=null,E.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},g.onMediaAttaching=function(t,o){var i=this.media=o.media;if(i&&T){var p=this.mediaSource=new T;p.addEventListener("sourceopen",this._onMediaSourceOpen),p.addEventListener("sourceended",this._onMediaSourceEnded),p.addEventListener("sourceclose",this._onMediaSourceClose),i.src=self.URL.createObjectURL(p),this._objectUrl=i.src}},g.onMediaDetaching=function(){var t=this.media,o=this.mediaSource,i=this._objectUrl;if(o){if(E.logger.log("[buffer-controller]: media source detaching"),o.readyState==="open")try{o.endOfStream()}catch(p){E.logger.warn("[buffer-controller]: onMediaDetaching: "+p.message+" while calling endOfStream")}this.onBufferReset(),o.removeEventListener("sourceopen",this._onMediaSourceOpen),o.removeEventListener("sourceended",this._onMediaSourceEnded),o.removeEventListener("sourceclose",this._onMediaSourceClose),t&&(i&&self.URL.revokeObjectURL(i),t.src===i?(t.removeAttribute("src"),t.load()):E.logger.warn("[buffer-controller]: media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(D.Events.MEDIA_DETACHED,void 0)},g.onBufferReset=function(){var t=this;this.getSourceBufferTypes().forEach(function(o){var i=t.sourceBuffer[o];try{i&&(t.removeBufferListeners(o),t.mediaSource&&t.mediaSource.removeSourceBuffer(i),t.sourceBuffer[o]=void 0)}catch(p){E.logger.warn("[buffer-controller]: Failed to reset the "+o+" buffer",p)}}),this._initSourceBuffer()},g.onBufferCodecs=function(t,o){var i=this,p=this.getSourceBufferTypes().length;if(Object.keys(o).forEach(function(f){if(p){var s=i.tracks[f];if(s&&typeof s.buffer.changeType=="function"){var m=o[f],l=m.codec,a=m.levelCodec,r=m.container,e=(s.levelCodec||s.codec).replace(O,"$1"),n=(a||l).replace(O,"$1");if(e!==n){var c=r+";codecs="+(a||l);i.appendChangeType(f,c)}}}else i.pendingTracks[f]=o[f]}),p)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},g.appendChangeType=function(t,o){var i=this,p=this.operationQueue,f={execute:function(){var m=i.sourceBuffer[t];m&&(E.logger.log("[buffer-controller]: changing "+t+" sourceBuffer type to "+o),m.changeType(o)),p.shiftAndExecuteNext(t)},onStart:function(){},onComplete:function(){},onError:function(m){E.logger.warn("[buffer-controller]: Failed to change "+t+" SourceBuffer type",m)}};p.append(f,t)},g.onBufferAppending=function(t,o){var i=this,p=this.hls,f=this.operationQueue,s=this.tracks,m=o.data,l=o.type,a=o.frag,r=o.part,e=o.chunkMeta,n=e.buffering[l],c=self.performance.now();n.start=c;var h=a.stats.buffering,u=r?r.stats.buffering:null;h.start===0&&(h.start=c),u&&u.start===0&&(u.start=c);var b=s.audio,A=l==="audio"&&e.id===1&&(b==null?void 0:b.container)==="audio/mpeg",P={execute:function(){if(n.executeStart=self.performance.now(),A){var U=i.sourceBuffer[l];if(U){var N=a.start-U.timestampOffset;Math.abs(N)>=.1&&(E.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+a.start+" (delta: "+N+") sn: "+a.sn+")"),U.timestampOffset=a.start)}}i.appendExecutor(m,l)},onStart:function(){},onComplete:function(){var U=self.performance.now();n.executeEnd=n.end=U,h.first===0&&(h.first=U),u&&u.first===0&&(u.first=U);var N=i.sourceBuffer,F={};for(var K in N)F[K]=R.BufferHelper.getBuffered(N[K]);i.appendError=0,i.hls.trigger(D.Events.BUFFER_APPENDED,{type:l,frag:a,part:r,chunkMeta:e,parent:a.type,timeRanges:F})},onError:function(U){E.logger.error("[buffer-controller]: Error encountered while trying to append to the "+l+" SourceBuffer",U);var N={type:L.ErrorTypes.MEDIA_ERROR,parent:a.type,details:L.ErrorDetails.BUFFER_APPEND_ERROR,err:U,fatal:!1};U.code===DOMException.QUOTA_EXCEEDED_ERR?N.details=L.ErrorDetails.BUFFER_FULL_ERROR:(i.appendError++,N.details=L.ErrorDetails.BUFFER_APPEND_ERROR,i.appendError>p.config.appendErrorMaxRetry&&(E.logger.error("[buffer-controller]: Failed "+p.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),N.fatal=!0)),p.trigger(D.Events.ERROR,N)}};f.append(P,l)},g.onBufferFlushing=function(t,o){var i=this,p=this.operationQueue,f=function(m){return{execute:i.removeExecutor.bind(i,m,o.startOffset,o.endOffset),onStart:function(){},onComplete:function(){i.hls.trigger(D.Events.BUFFER_FLUSHED,{type:m})},onError:function(a){E.logger.warn("[buffer-controller]: Failed to remove from "+m+" SourceBuffer",a)}}};o.type?p.append(f(o.type),o.type):this.getSourceBufferTypes().forEach(function(s){p.append(f(s),s)})},g.onFragParsed=function(t,o){var i=this,p=o.frag,f=o.part,s=[],m=f?f.elementaryStreams:p.elementaryStreams;m[C.ElementaryStreamTypes.AUDIOVIDEO]?s.push("audiovideo"):(m[C.ElementaryStreamTypes.AUDIO]&&s.push("audio"),m[C.ElementaryStreamTypes.VIDEO]&&s.push("video"));var l=function(){var r=self.performance.now();p.stats.buffering.end=r,f&&(f.stats.buffering.end=r);var e=f?f.stats:p.stats;i.hls.trigger(D.Events.FRAG_BUFFERED,{frag:p,part:f,stats:e,id:p.type})};s.length===0&&E.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+p.type+" level: "+p.level+" sn: "+p.sn),this.blockBuffers(l,s)},g.onFragChanged=function(t,o){this.flushBackBuffer()},g.onBufferEos=function(t,o){var i=this,p=this.getSourceBufferTypes().reduce(function(f,s){var m=i.sourceBuffer[s];return(!o.type||o.type===s)&&(m&&!m.ended&&(m.ended=!0,E.logger.log("[buffer-controller]: "+s+" sourceBuffer now EOS"))),f&&!!(!m||m.ended)},!0);p&&this.blockBuffers(function(){var f=i.mediaSource;if(!f||f.readyState!=="open")return;f.endOfStream()})},g.onLevelUpdated=function(t,o){var i=o.details;if(!i.fragments.length)return;this.details=i,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},g.flushBackBuffer=function(){var t=this.hls,o=this.details,i=this.media,p=this.sourceBuffer;if(!i||o===null)return;var f=this.getSourceBufferTypes();if(!f.length)return;var s=o.live&&t.config.liveBackBufferLength!==null?t.config.liveBackBufferLength:t.config.backBufferLength;if(!Object(I.isFiniteNumber)(s)||s<0)return;var m=i.currentTime,l=o.levelTargetDuration,a=Math.max(s,l),r=Math.floor(m/l)*l-a;f.forEach(function(e){var n=p[e];if(n){var c=R.BufferHelper.getBuffered(n);c.length>0&&r>c.start(0)&&(t.trigger(D.Events.BACK_BUFFER_REACHED,{bufferEnd:r}),o.live&&t.trigger(D.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:r}),t.trigger(D.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:r,type:e}))}})},g.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var t=this.details,o=this.hls,i=this.media,p=this.mediaSource,f=t.fragments[0].start+t.totalduration,s=i.duration,m=Object(I.isFiniteNumber)(p.duration)?p.duration:0;t.live&&o.config.liveDurationInfinity?(E.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),p.duration=Infinity,this.updateSeekableRange(t)):(f>m&&f>s||!Object(I.isFiniteNumber)(s))&&(E.logger.log("[buffer-controller]: Updating Media Source duration to "+f.toFixed(3)),p.duration=f)},g.updateSeekableRange=function(t){var o=this.mediaSource,i=t.fragments,p=i.length;if(p&&t.live&&o!==null&&o!==void 0&&o.setLiveSeekableRange){var f=Math.max(0,i[0].start),s=Math.max(f,f+t.totalduration);o.setLiveSeekableRange(f,s)}},g.checkPendingTracks=function(){var t=this.bufferCodecEventsExpected,o=this.operationQueue,i=this.pendingTracks,p=Object.keys(i).length;if(p&&!t||p===2){this.createSourceBuffers(i),this.pendingTracks={};var f=this.getSourceBufferTypes();if(f.length===0){this.hls.trigger(D.Events.ERROR,{type:L.ErrorTypes.MEDIA_ERROR,details:L.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}f.forEach(function(s){o.executeNext(s)})}},g.createSourceBuffers=function(t){var o=this.sourceBuffer,i=this.mediaSource;if(!i)throw Error("createSourceBuffers called when mediaSource was null");var p=0;for(var f in t)if(!o[f]){var s=t[f];if(!s)throw Error("source buffer exists for track "+f+", however track does not");var m=s.levelCodec||s.codec,l=s.container+";codecs="+m;E.logger.log("[buffer-controller]: creating sourceBuffer("+l+")");try{var a=o[f]=i.addSourceBuffer(l),r=f;this.addBufferListener(r,"updatestart",this._onSBUpdateStart),this.addBufferListener(r,"updateend",this._onSBUpdateEnd),this.addBufferListener(r,"error",this._onSBUpdateError),this.tracks[f]={buffer:a,codec:m,container:s.container,levelCodec:s.levelCodec,id:s.id},p++}catch(e){E.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+e.message),this.hls.trigger(D.Events.ERROR,{type:L.ErrorTypes.MEDIA_ERROR,details:L.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:e,mimeType:l})}}p&&this.hls.trigger(D.Events.BUFFER_CREATED,{tracks:this.tracks})},g._onSBUpdateStart=function(t){var o=this.operationQueue,i=o.current(t);i.onStart()},g._onSBUpdateEnd=function(t){var o=this.operationQueue,i=o.current(t);i.onComplete(),o.shiftAndExecuteNext(t)},g._onSBUpdateError=function(t,o){E.logger.error("[buffer-controller]: "+t+" SourceBuffer error",o),this.hls.trigger(D.Events.ERROR,{type:L.ErrorTypes.MEDIA_ERROR,details:L.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var i=this.operationQueue.current(t);i&&i.onError(o)},g.removeExecutor=function(t,o,i){var p=this.media,f=this.mediaSource,s=this.operationQueue,m=this.sourceBuffer,l=m[t];if(!p||!f||!l){E.logger.warn("[buffer-controller]: Attempting to remove from the "+t+" SourceBuffer, but it does not exist"),s.shiftAndExecuteNext(t);return}var a=Object(I.isFiniteNumber)(p.duration)?p.duration:Infinity,r=Object(I.isFiniteNumber)(f.duration)?f.duration:Infinity,e=Math.max(0,o),n=Math.min(i,a,r);n>e?(E.logger.log("[buffer-controller]: Removing ["+e+","+n+"] from the "+t+" SourceBuffer"),console.assert(!l.updating,t+" sourceBuffer must not be updating"),l.remove(e,n)):s.shiftAndExecuteNext(t)},g.appendExecutor=function(t,o){var i=this.operationQueue,p=this.sourceBuffer,f=p[o];if(!f){E.logger.warn("[buffer-controller]: Attempting to append to the "+o+" SourceBuffer, but it does not exist"),i.shiftAndExecuteNext(o);return}f.ended=!1,console.assert(!f.updating,o+" sourceBuffer must not be updating"),f.appendBuffer(t)},g.blockBuffers=function(t,o){var i=this;if(o===void 0&&(o=this.getSourceBufferTypes()),!o.length){E.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(t);return}var p=this.operationQueue,f=o.map(function(s){return p.appendBlocker(s)});Promise.all(f).then(function(){t(),o.forEach(function(s){var m=i.sourceBuffer[s];(!m||!m.updating)&&p.shiftAndExecuteNext(s)})})},g.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},g.addBufferListener=function(t,o,i){var p=this.sourceBuffer[t];if(!p)return;var f=i.bind(this,t);this.listeners[t].push({event:o,listener:f}),p.addEventListener(o,f)},g.removeBufferListeners=function(t){var o=this.sourceBuffer[t];if(!o)return;this.listeners[t].forEach(function(i){o.removeEventListener(i.event,i.listener)})},v}()},"./src/controller/buffer-operation-queue.ts":function(Y,M,S){"use strict";S.r(M),S.d(M,"default",function(){return D});var I=S("./src/utils/logger.ts"),D=function(){function E(R){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=R}var L=E.prototype;return L.append=function(_,C){var y=this.queues[C];y.push(_),y.length===1&&this.buffers[C]&&this.executeNext(C)},L.insertAbort=function(_,C){var y=this.queues[C];y.unshift(_),this.executeNext(C)},L.appendBlocker=function(_){var C,y=new Promise(function(O){C=O}),T={execute:C,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(T,_),y},L.executeNext=function(_){var C=this.buffers,y=this.queues,T=C[_],O=y[_];if(O.length){var x=O[0];try{x.execute()}catch(v){I.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),x.onError(v),(!T||!T.updating)&&(O.shift(),this.executeNext(_))}}},L.shiftAndExecuteNext=function(_){this.queues[_].shift(),this.executeNext(_)},L.current=function(_){return this.queues[_][0]},E}()},"./src/controller/cap-level-controller.ts":function(Y,M,S){"use strict";S.r(M);var I=S("./src/events.ts");function D(R,_){for(var C=0;C<_.length;C++){var y=_[C];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(R,y.key,y)}}function E(R,_,C){return _&&D(R.prototype,_),C&&D(R,C),R}var L=function(){function R(C){this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.hls=void 0,this.streamController=void 0,this.clientRect=void 0,this.hls=C,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var _=R.prototype;return _.setStreamController=function(y){this.streamController=y},_.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},_.registerListeners=function(){var y=this.hls;y.on(I.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),y.on(I.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),y.on(I.Events.MANIFEST_PARSED,this.onManifestParsed,this),y.on(I.Events.BUFFER_CODECS,this.onBufferCodecs,this),y.on(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},_.unregisterListener=function(){var y=this.hls;y.off(I.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),y.off(I.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),y.off(I.Events.MANIFEST_PARSED,this.onManifestParsed,this),y.off(I.Events.BUFFER_CODECS,this.onBufferCodecs,this),y.off(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},_.onFpsDropLevelCapping=function(y,T){R.isLevelAllowed(T.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(T.droppedLevel)},_.onMediaAttaching=function(y,T){this.media=T.media instanceof HTMLVideoElement?T.media:null},_.onManifestParsed=function(y,T){var O=this.hls;this.restrictedLevels=[],this.firstLevel=T.firstLevel,O.config.capLevelToPlayerSize&&T.video&&this.startCapping()},_.onBufferCodecs=function(y,T){var O=this.hls;O.config.capLevelToPlayerSize&&T.video&&this.startCapping()},_.onMediaDetaching=function(){this.stopCapping()},_.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var y=this.hls.levels;if(y.length){var T=this.hls;T.autoLevelCapping=this.getMaxLevel(y.length-1),T.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=T.autoLevelCapping}}},_.getMaxLevel=function(y){var T=this,O=this.hls.levels;if(!O.length)return-1;var x=O.filter(function(v,g){return R.isLevelAllowed(g,T.restrictedLevels)&&g<=y});return this.clientRect=null,R.getMaxLevelByMediaSize(x,this.mediaWidth,this.mediaHeight)},_.startCapping=function(){if(this.timer)return;this.autoLevelCapping=Number.POSITIVE_INFINITY,this.hls.firstLevel=this.getMaxLevel(this.firstLevel),self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize()},_.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},_.getDimensions=function(){if(this.clientRect)return this.clientRect;var y=this.media,T={width:0,height:0};if(y){var O=y.getBoundingClientRect();T.width=O.width,T.height=O.height,!T.width&&!T.height&&(T.width=O.right-O.left||y.width||0,T.height=O.bottom-O.top||y.height||0)}return this.clientRect=T,T},R.isLevelAllowed=function(y,T){return T===void 0&&(T=[]),T.indexOf(y)===-1},R.getMaxLevelByMediaSize=function(y,T,O){if(!y||!y.length)return-1;for(var x=function(o,i){return i?o.width!==i.width||o.height!==i.height:!0},v=y.length-1,g=0;g<y.length;g+=1){var d=y[g];if((d.width>=T||d.height>=O)&&x(d,y[g+1])){v=g;break}}return v},E(R,[{key:"mediaWidth",get:function(){return this.getDimensions().width*R.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*R.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var y=1;try{y=self.devicePixelRatio}catch(T){}return y}}]),R}();M.default=L},"./src/controller/cmcd-controller.ts":function(Y,M,S){"use strict";S.r(M),S.d(M,"default",function(){return x});var I=S("./src/events.ts"),D=S("./src/types/cmcd.ts"),E=S("./src/utils/buffer-helper.ts"),L=S("./src/utils/logger.ts");function R(v,g){for(var d=0;d<g.length;d++){var t=g[d];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(v,t.key,t)}}function _(v,g,d){return g&&R(v.prototype,g),d&&R(v,d),v}function C(v,g){var d=typeof Symbol!="undefined"&&v[Symbol.iterator]||v["@@iterator"];if(d)return(d=d.call(v)).next.bind(d);if(Array.isArray(v)||(d=y(v))||g&&v&&typeof v.length=="number"){d&&(v=d);var t=0;return function(){return t>=v.length?{done:!0}:{done:!1,value:v[t++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function y(v,g){if(!v)return;if(typeof v=="string")return T(v,g);var d=Object.prototype.toString.call(v).slice(8,-1);if(d==="Object"&&v.constructor&&(d=v.constructor.name),d==="Map"||d==="Set")return Array.from(v);if(d==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(d))return T(v,g)}function T(v,g){(g==null||g>v.length)&&(g=v.length);for(var d=0,t=new Array(g);d<g;d++)t[d]=v[d];return t}function O(){return O=Object.assign||function(v){for(var g=1;g<arguments.length;g++){var d=arguments[g];for(var t in d)Object.prototype.hasOwnProperty.call(d,t)&&(v[t]=d[t])}return v},O.apply(this,arguments)}var x=function(){function v(d){var t=this;this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){t.initialized&&(t.starved=!0),t.buffering=!0},this.onPlaying=function(){t.initialized||(t.initialized=!0),t.buffering=!1},this.applyPlaylistData=function(p){try{t.apply(p,{ot:D.CMCDObjectType.MANIFEST,su:!t.initialized})}catch(f){L.logger.warn("Could not generate manifest CMCD data.",f)}},this.applyFragmentData=function(p){try{var f=p.frag,s=t.hls.levels[f.level],m=t.getObjectType(f),l={d:f.duration*1e3,ot:m};(m===D.CMCDObjectType.VIDEO||m===D.CMCDObjectType.AUDIO||m==D.CMCDObjectType.MUXED)&&(l.br=s.bitrate/1e3,l.tb=t.getTopBandwidth(m),l.bl=t.getBufferLength(m)),t.apply(p,l)}catch(a){L.logger.warn("Could not generate segment CMCD data.",a)}},this.hls=d;var o=this.config=d.config,i=o.cmcd;i!=null&&(o.pLoader=this.createPlaylistLoader(),o.fLoader=this.createFragmentLoader(),this.sid=i.sessionId||v.uuid(),this.cid=i.contentId,this.useHeaders=i.useHeaders===!0,this.registerListeners())}var g=v.prototype;return g.registerListeners=function(){var t=this.hls;t.on(I.Events.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(I.Events.MEDIA_DETACHED,this.onMediaDetached,this),t.on(I.Events.BUFFER_CREATED,this.onBufferCreated,this)},g.unregisterListeners=function(){var t=this.hls;t.off(I.Events.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(I.Events.MEDIA_DETACHED,this.onMediaDetached,this),t.off(I.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},g.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},g.onMediaAttached=function(t,o){this.media=o.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},g.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},g.onBufferCreated=function(t,o){var i,p;this.audioBuffer=(i=o.tracks.audio)===null||i===void 0?void 0:i.buffer,this.videoBuffer=(p=o.tracks.video)===null||p===void 0?void 0:p.buffer},g.createData=function(){var t;return{v:D.CMCDVersion,sf:D.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(t=this.media)===null||t===void 0?void 0:t.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},g.apply=function(t,o){o===void 0&&(o={}),O(o,this.createData());var i=o.ot===D.CMCDObjectType.INIT||o.ot===D.CMCDObjectType.VIDEO||o.ot===D.CMCDObjectType.MUXED;if(this.starved&&i&&(o.bs=!0,o.su=!0,this.starved=!1),o.su==null&&(o.su=this.buffering),this.useHeaders){var p=v.toHeaders(o);if(!Object.keys(p).length)return;t.headers||(t.headers={}),O(t.headers,p)}else{var f=v.toQuery(o);if(!f)return;t.url=v.appendQueryToUri(t.url,f)}},g.getObjectType=function(t){var o=t.type;return o==="subtitle"?D.CMCDObjectType.TIMED_TEXT:t.sn==="initSegment"?D.CMCDObjectType.INIT:o==="audio"?D.CMCDObjectType.AUDIO:o==="main"?this.hls.audioTracks.length?D.CMCDObjectType.VIDEO:D.CMCDObjectType.MUXED:void 0},g.getTopBandwidth=function(t){for(var o=0,i=t===D.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,p=C(i),f;!(f=p()).done;){var s=f.value;s.bitrate>o&&(o=s.bitrate)}return o>0?o:NaN},g.getBufferLength=function(t){var o=this.hls.media,i=t===D.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!i||!o)return NaN;var p=E.BufferHelper.bufferInfo(i,o.currentTime,this.config.maxBufferHole);return p.len*1e3},g.createPlaylistLoader=function(){var t=this.config.pLoader,o=this.applyPlaylistData,i=t||this.config.loader;return function(){function p(s){this.loader=void 0,this.loader=new i(s)}var f=p.prototype;return f.destroy=function(){this.loader.destroy()},f.abort=function(){this.loader.abort()},f.load=function(m,l,a){o(m),this.loader.load(m,l,a)},_(p,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),p}()},g.createFragmentLoader=function(){var t=this.config.fLoader,o=this.applyFragmentData,i=t||this.config.loader;return function(){function p(s){this.loader=void 0,this.loader=new i(s)}var f=p.prototype;return f.destroy=function(){this.loader.destroy()},f.abort=function(){this.loader.abort()},f.load=function(m,l,a){o(m),this.loader.load(m,l,a)},_(p,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),p}()},v.uuid=function(){var t=URL.createObjectURL(new Blob),o=t.toString();return URL.revokeObjectURL(t),o.substr(o.lastIndexOf("/")+1)},v.serialize=function(t){for(var o=[],i=function(A){return!Number.isNaN(A)&&A!=null&&A!==""&&A!==!1},p=function(A){return Math.round(A)},f=function(A){return p(A/100)*100},s=function(A){return encodeURIComponent(A)},m={br:p,d:p,bl:f,dl:f,mtp:f,nor:s,rtp:f,tb:p},l=Object.keys(t||{}).sort(),a=C(l),r;!(r=a()).done;){var e=r.value,n=t[e];if(!i(n))continue;if(e==="v"&&n===1)continue;if(e=="pr"&&n===1)continue;var c=m[e];c&&(n=c(n));var h=typeof n,u=void 0;e==="ot"||e==="sf"||e==="st"?u=e+"="+n:h==="boolean"?u=e:h==="number"?u=e+"="+n:u=e+"="+JSON.stringify(n),o.push(u)}return o.join(",")},v.toHeaders=function(t){for(var o=Object.keys(t),i={},p=["Object","Request","Session","Status"],f=[{},{},{},{}],s={br:0,d:0,ot:0,tb:0,bl:1,dl:1,mtp:1,nor:1,nrr:1,su:1,cid:2,pr:2,sf:2,sid:2,st:2,v:2,bs:3,rtp:3},m=0,l=o;m<l.length;m++){var a=l[m],r=s[a]!=null?s[a]:1;f[r][a]=t[a]}for(var e=0;e<f.length;e++){var n=v.serialize(f[e]);n&&(i["CMCD-"+p[e]]=n)}return i},v.toQuery=function(t){return"CMCD="+encodeURIComponent(v.serialize(t))},v.appendQueryToUri=function(t,o){if(!o)return t;var i=t.includes("?")?"&":"?";return""+t+i+o},v}()},"./src/controller/eme-controller.ts":function(Y,M,S){"use strict";S.r(M);var I=S("./src/events.ts"),D=S("./src/errors.ts"),E=S("./src/utils/logger.ts"),L=S("./src/utils/mediakeys-helper.ts");function R(x,v){for(var g=0;g<v.length;g++){var d=v[g];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(x,d.key,d)}}function _(x,v,g){return v&&R(x.prototype,v),g&&R(x,g),x}var C=3,y=function(v,g,d){var t={audioCapabilities:[],videoCapabilities:[]};return v.forEach(function(o){t.audioCapabilities.push({contentType:'audio/mp4; codecs="'+o+'"',robustness:d.audioRobustness||""})}),g.forEach(function(o){t.videoCapabilities.push({contentType:'video/mp4; codecs="'+o+'"',robustness:d.videoRobustness||""})}),[t]},T=function(v,g,d,t){switch(v){case L.KeySystems.WIDEVINE:return y(g,d,t);default:throw new Error("Unknown key-system: "+v)}},O=function(){function x(g){this.hls=void 0,this._widevineLicenseUrl=void 0,this._licenseXhrSetup=void 0,this._licenseResponseCallback=void 0,this._emeEnabled=void 0,this._requestMediaKeySystemAccess=void 0,this._drmSystemOptions=void 0,this._config=void 0,this._mediaKeysList=[],this._media=null,this._hasSetMediaKeys=!1,this._requestLicenseFailureCount=0,this.mediaKeysPromise=null,this._onMediaEncrypted=this.onMediaEncrypted.bind(this),this.hls=g,this._config=g.config,this._widevineLicenseUrl=this._config.widevineLicenseUrl,this._licenseXhrSetup=this._config.licenseXhrSetup,this._licenseResponseCallback=this._config.licenseResponseCallback,this._emeEnabled=this._config.emeEnabled,this._requestMediaKeySystemAccess=this._config.requestMediaKeySystemAccessFunc,this._drmSystemOptions=this._config.drmSystemOptions,this._registerListeners()}var v=x.prototype;return v.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},v._registerListeners=function(){this.hls.on(I.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(I.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(I.Events.MANIFEST_PARSED,this.onManifestParsed,this)},v._unregisterListeners=function(){this.hls.off(I.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(I.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(I.Events.MANIFEST_PARSED,this.onManifestParsed,this)},v.getLicenseServerUrl=function(d){switch(d){case L.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+d+'"')},v._attemptKeySystemAccess=function(d,t,o){var i=this,p=T(d,t,o,this._drmSystemOptions);E.logger.log("Requesting encrypted media key-system access");var f=this.requestMediaKeySystemAccess(d,p);this.mediaKeysPromise=f.then(function(s){return i._onMediaKeySystemAccessObtained(d,s)}),f.catch(function(s){E.logger.error('Failed to obtain key-system "'+d+'" access:',s)})},v._onMediaKeySystemAccessObtained=function(d,t){var o=this;E.logger.log('Access for key-system "'+d+'" obtained');var i={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:t,mediaKeySystemDomain:d};this._mediaKeysList.push(i);var p=Promise.resolve().then(function(){return t.createMediaKeys()}).then(function(f){return i.mediaKeys=f,E.logger.log('Media-keys created for key-system "'+d+'"'),o._onMediaKeysCreated(),f});return p.catch(function(f){E.logger.error("Failed to create media-keys:",f)}),p},v._onMediaKeysCreated=function(){var d=this;this._mediaKeysList.forEach(function(t){t.mediaKeysSession||(t.mediaKeysSession=t.mediaKeys.createSession(),d._onNewMediaKeySession(t.mediaKeysSession))})},v._onNewMediaKeySession=function(d){var t=this;E.logger.log("New key-system session "+d.sessionId),d.addEventListener("message",function(o){t._onKeySessionMessage(d,o.message)},!1)},v._onKeySessionMessage=function(d,t){E.logger.log("Got EME message event, creating license request"),this._requestLicense(t,function(o){E.logger.log("Received license data (length: "+(o&&o.byteLength)+"), updating key-session"),d.update(o)})},v.onMediaEncrypted=function(d){var t=this;if(E.logger.log('Media is encrypted using "'+d.initDataType+'" init data type'),!this.mediaKeysPromise){E.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(I.Events.ERROR,{type:D.ErrorTypes.KEY_SYSTEM_ERROR,details:D.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var o=function(p){if(!t._media)return;t._attemptSetMediaKeys(p),t._generateRequestWithPreferredKeySession(d.initDataType,d.initData)};this.mediaKeysPromise.then(o).catch(o)},v._attemptSetMediaKeys=function(d){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var t=this._mediaKeysList[0];if(!t||!t.mediaKeys){E.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(I.Events.ERROR,{type:D.ErrorTypes.KEY_SYSTEM_ERROR,details:D.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}E.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(t.mediaKeys),this._hasSetMediaKeys=!0}},v._generateRequestWithPreferredKeySession=function(d,t){var o=this,i=this._mediaKeysList[0];if(!i){E.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(I.Events.ERROR,{type:D.ErrorTypes.KEY_SYSTEM_ERROR,details:D.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(i.mediaKeysSessionInitialized){E.logger.warn("Key-Session already initialized but requested again");return}var p=i.mediaKeysSession;if(!p){E.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(I.Events.ERROR,{type:D.ErrorTypes.KEY_SYSTEM_ERROR,details:D.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!t){E.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(I.Events.ERROR,{type:D.ErrorTypes.KEY_SYSTEM_ERROR,details:D.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}E.logger.log('Generating key-session request for "'+d+'" init data type'),i.mediaKeysSessionInitialized=!0,p.generateRequest(d,t).then(function(){E.logger.debug("Key-session generation succeeded")}).catch(function(f){E.logger.error("Error generating key-session request:",f),o.hls.trigger(I.Events.ERROR,{type:D.ErrorTypes.KEY_SYSTEM_ERROR,details:D.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},v._createLicenseXhr=function(d,t,o){var i=new XMLHttpRequest;i.responseType="arraybuffer",i.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,i,d,t,o);var p=this._licenseXhrSetup;if(p)try{p.call(this.hls,i,d),p=void 0}catch(f){E.logger.error(f)}try{i.readyState||i.open("POST",d,!0),p&&p.call(this.hls,i,d)}catch(f){throw new Error("issue setting up KeySystem license XHR "+f)}return i},v._onLicenseRequestReadyStageChange=function(d,t,o,i){switch(d.readyState){case 4:if(d.status===200){this._requestLicenseFailureCount=0,E.logger.log("License request succeeded");var p=d.response,f=this._licenseResponseCallback;if(f)try{p=f.call(this.hls,d,t)}catch(m){E.logger.error(m)}i(p)}else{if(E.logger.error("License Request XHR failed ("+t+"). Status: "+d.status+" ("+d.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>C){this.hls.trigger(I.Events.ERROR,{type:D.ErrorTypes.KEY_SYSTEM_ERROR,details:D.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var s=C-this._requestLicenseFailureCount+1;E.logger.warn("Retrying license request, "+s+" attempts left"),this._requestLicense(o,i)}break}},v._generateLicenseRequestChallenge=function(d,t){switch(d.mediaKeySystemDomain){case L.KeySystems.WIDEVINE:return t}throw new Error("unsupported key-system: "+d.mediaKeySystemDomain)},v._requestLicense=function(d,t){E.logger.log("Requesting content license for key-system");var o=this._mediaKeysList[0];if(!o){E.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(I.Events.ERROR,{type:D.ErrorTypes.KEY_SYSTEM_ERROR,details:D.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var i=this.getLicenseServerUrl(o.mediaKeySystemDomain),p=this._createLicenseXhr(i,d,t);E.logger.log("Sending license request to URL: "+i);var f=this._generateLicenseRequestChallenge(o,d);p.send(f)}catch(s){E.logger.error("Failure requesting DRM license: "+s),this.hls.trigger(I.Events.ERROR,{type:D.ErrorTypes.KEY_SYSTEM_ERROR,details:D.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},v.onMediaAttached=function(d,t){if(!this._emeEnabled)return;var o=t.media;this._media=o,o.addEventListener("encrypted",this._onMediaEncrypted)},v.onMediaDetached=function(){var d=this._media,t=this._mediaKeysList;if(!d)return;d.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(t.map(function(o){if(o.mediaKeysSession)return o.mediaKeysSession.close().catch(function(){})})).then(function(){return d.setMediaKeys(null)}).catch(function(){})},v.onManifestParsed=function(d,t){if(!this._emeEnabled)return;var o=t.levels.map(function(p){return p.audioCodec}).filter(function(p){return!!p}),i=t.levels.map(function(p){return p.videoCodec}).filter(function(p){return!!p});this._attemptKeySystemAccess(L.KeySystems.WIDEVINE,o,i)},_(x,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),x}();M.default=O},"./src/controller/fps-controller.ts":function(Y,M,S){"use strict";S.r(M);var I=S("./src/events.ts"),D=S("./src/utils/logger.ts"),E=function(){function L(_){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=_,this.registerListeners()}var R=L.prototype;return R.setStreamController=function(C){this.streamController=C},R.registerListeners=function(){this.hls.on(I.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},R.unregisterListeners=function(){this.hls.off(I.Events.MEDIA_ATTACHING,this.onMediaAttaching)},R.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},R.onMediaAttaching=function(C,y){var T=this.hls.config;if(T.capLevelOnFPSDrop){var O=y.media instanceof self.HTMLVideoElement?y.media:null;this.media=O,O&&typeof O.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),T.fpsDroppedMonitoringPeriod)}},R.checkFPS=function(C,y,T){var O=performance.now();if(y){if(this.lastTime){var x=O-this.lastTime,v=T-this.lastDroppedFrames,g=y-this.lastDecodedFrames,d=1e3*v/x,t=this.hls;if(t.trigger(I.Events.FPS_DROP,{currentDropped:v,currentDecoded:g,totalDroppedFrames:T}),d>0&&v>t.config.fpsDroppedMonitoringThreshold*g){var o=t.currentLevel;D.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+o),o>0&&(t.autoLevelCapping===-1||t.autoLevelCapping>=o)&&(o=o-1,t.trigger(I.Events.FPS_DROP_LEVEL_CAPPING,{level:o,droppedLevel:t.currentLevel}),t.autoLevelCapping=o,this.streamController.nextLevelSwitch())}}this.lastTime=O,this.lastDroppedFrames=T,this.lastDecodedFrames=y}},R.checkFPSInterval=function(){var C=this.media;if(C)if(this.isVideoPlaybackQualityAvailable){var y=C.getVideoPlaybackQuality();this.checkFPS(C,y.totalVideoFrames,y.droppedVideoFrames)}else this.checkFPS(C,C.webkitDecodedFrameCount,C.webkitDroppedFrameCount)},L}();M.default=E},"./src/controller/fragment-finders.ts":function(Y,M,S){"use strict";S.r(M),S.d(M,"findFragmentByPDT",function(){return E}),S.d(M,"findFragmentByPTS",function(){return L}),S.d(M,"fragmentWithinToleranceTest",function(){return R}),S.d(M,"pdtWithinToleranceTest",function(){return _}),S.d(M,"findFragWithCC",function(){return C});var I=S("./src/polyfills/number.ts"),D=S("./src/utils/binary-search.ts");function E(y,T,O){if(T===null||!Array.isArray(y)||!y.length||!Object(I.isFiniteNumber)(T))return null;var x=y[0].programDateTime;if(T<(x||0))return null;var v=y[y.length-1].endProgramDateTime;if(T>=(v||0))return null;O=O||0;for(var g=0;g<y.length;++g){var d=y[g];if(_(T,O,d))return d}return null}function L(y,T,O,x){O===void 0&&(O=0),x===void 0&&(x=0);var v=null;if(y?v=T[y.sn-T[0].sn+1]||null:O===0&&T[0].start===0&&(v=T[0]),v&&R(O,x,v)===0)return v;var g=D.default.search(T,R.bind(null,O,x));return g||v}function R(y,T,O){y===void 0&&(y=0),T===void 0&&(T=0);var x=Math.min(T,O.duration+(O.deltaPTS?O.deltaPTS:0));return O.start+O.duration-x<=y?1:O.start-x>y&&O.start?-1:0}function _(y,T,O){var x=Math.min(T,O.duration+(O.deltaPTS?O.deltaPTS:0))*1e3,v=O.endProgramDateTime||0;return v-x>y}function C(y,T){return D.default.search(y,function(O){return O.cc<T?1:O.cc>T?-1:0})}},"./src/controller/fragment-tracker.ts":function(Y,M,S){"use strict";S.r(M),S.d(M,"FragmentState",function(){return E}),S.d(M,"FragmentTracker",function(){return L});var I=S("./src/events.ts"),D=S("./src/types/loader.ts"),E;(function(C){C.NOT_LOADED="NOT_LOADED",C.BACKTRACKED="BACKTRACKED",C.APPENDING="APPENDING",C.PARTIAL="PARTIAL",C.OK="OK"})(E||(E={}));var L=function(){function C(T){this.activeFragment=null,this.activeParts=null,this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hls=T,this._registerListeners()}var y=C.prototype;return y._registerListeners=function(){var O=this.hls;O.on(I.Events.BUFFER_APPENDED,this.onBufferAppended,this),O.on(I.Events.FRAG_BUFFERED,this.onFragBuffered,this),O.on(I.Events.FRAG_LOADED,this.onFragLoaded,this)},y._unregisterListeners=function(){var O=this.hls;O.off(I.Events.BUFFER_APPENDED,this.onBufferAppended,this),O.off(I.Events.FRAG_BUFFERED,this.onFragBuffered,this),O.off(I.Events.FRAG_LOADED,this.onFragLoaded,this)},y.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},y.getAppendedFrag=function(O,x){if(x===D.PlaylistLevelType.MAIN){var v=this.activeFragment,g=this.activeParts;if(!v)return null;if(g)for(var d=g.length;d--;){var t=g[d],o=t?t.end:v.appendedPTS;if(t.start<=O&&o!==void 0&&O<=o)return d>9&&(this.activeParts=g.slice(d-9)),t}else if(v.start<=O&&v.appendedPTS!==void 0&&O<=v.appendedPTS)return v}return this.getBufferedFrag(O,x)},y.getBufferedFrag=function(O,x){for(var v=this.fragments,g=Object.keys(v),d=g.length;d--;){var t=v[g[d]];if((t==null?void 0:t.body.type)===x&&t.buffered){var o=t.body;if(o.start<=O&&O<=o.end)return o}}return null},y.detectEvictedFragments=function(O,x,v){var g=this;Object.keys(this.fragments).forEach(function(d){var t=g.fragments[d];if(!t)return;if(!t.buffered){t.body.type===v&&g.removeFragment(t.body);return}var o=t.range[O];if(!o)return;o.time.some(function(i){var p=!g.isTimeBuffered(i.startPTS,i.endPTS,x);return p&&g.removeFragment(t.body),p})})},y.detectPartialFragments=function(O){var x=this,v=this.timeRanges,g=O.frag,d=O.part;if(!v||g.sn==="initSegment")return;var t=_(g),o=this.fragments[t];if(!o)return;Object.keys(v).forEach(function(i){var p=g.elementaryStreams[i];if(!p)return;var f=v[i],s=d!==null||p.partial===!0;o.range[i]=x.getBufferedTimes(g,d,s,f)}),o.backtrack=o.loaded=null,Object.keys(o.range).length?o.buffered=!0:this.removeFragment(o.body)},y.fragBuffered=function(O){var x=_(O),v=this.fragments[x];v&&(v.backtrack=v.loaded=null,v.buffered=!0)},y.getBufferedTimes=function(O,x,v,g){for(var d={time:[],partial:v},t=x?x.start:O.start,o=x?x.end:O.end,i=O.minEndPTS||o,p=O.maxStartPTS||t,f=0;f<g.length;f++){var s=g.start(f)-this.bufferPadding,m=g.end(f)+this.bufferPadding;if(p>=s&&i<=m){d.time.push({startPTS:Math.max(t,g.start(f)),endPTS:Math.min(o,g.end(f))});break}else if(t<m&&o>s)d.partial=!0,d.time.push({startPTS:Math.max(t,g.start(f)),endPTS:Math.min(o,g.end(f))});else if(o<=s)break}return d},y.getPartialFragment=function(O){var x=null,v,g,d,t=0,o=this.bufferPadding,i=this.fragments;return Object.keys(i).forEach(function(p){var f=i[p];if(!f)return;R(f)&&(g=f.body.start-o,d=f.body.end+o,O>=g&&O<=d&&(v=Math.min(O-g,d-O),t<=v&&(x=f.body,t=v)))}),x},y.getState=function(O){var x=_(O),v=this.fragments[x];return v?v.buffered?R(v)?E.PARTIAL:E.OK:v.backtrack?E.BACKTRACKED:E.APPENDING:E.NOT_LOADED},y.backtrack=function(O,x){var v=_(O),g=this.fragments[v];if(!g||g.backtrack)return null;var d=g.backtrack=x||g.loaded;return g.loaded=null,d},y.getBacktrackData=function(O){var x=_(O),v=this.fragments[x];if(v){var g,d=v.backtrack;if(d!=null&&(g=d.payload)!==null&&g!==void 0&&g.byteLength)return d;this.removeFragment(O)}return null},y.isTimeBuffered=function(O,x,v){for(var g,d,t=0;t<v.length;t++){if(g=v.start(t)-this.bufferPadding,d=v.end(t)+this.bufferPadding,O>=g&&x<=d)return!0;if(x<=g)return!1}return!1},y.onFragLoaded=function(O,x){var v=x.frag,g=x.part;if(v.sn==="initSegment"||v.bitrateTest||g)return;var d=_(v);this.fragments[d]={body:v,loaded:x,backtrack:null,buffered:!1,range:Object.create(null)}},y.onBufferAppended=function(O,x){var v=this,g=x.frag,d=x.part,t=x.timeRanges;if(g.type===D.PlaylistLevelType.MAIN)if(this.activeFragment=g,d){var o=this.activeParts;o||(this.activeParts=o=[]),o.push(d)}else this.activeParts=null;this.timeRanges=t,Object.keys(t).forEach(function(i){var p=t[i];if(v.detectEvictedFragments(i,p),!d)for(var f=0;f<p.length;f++)g.appendedPTS=Math.max(p.end(f),g.appendedPTS||0)})},y.onFragBuffered=function(O,x){this.detectPartialFragments(x)},y.hasFragment=function(O){var x=_(O);return!!this.fragments[x]},y.removeFragmentsInRange=function(O,x,v){var g=this;Object.keys(this.fragments).forEach(function(d){var t=g.fragments[d];if(!t)return;if(t.buffered){var o=t.body;o.type===v&&o.start<x&&o.end>O&&g.removeFragment(o)}})},y.removeFragment=function(O){var x=_(O);O.stats.loaded=0,O.clearElementaryStreamInfo(),delete this.fragments[x]},y.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},C}();function R(C){var y,T;return C.buffered&&(((y=C.range.video)===null||y===void 0?void 0:y.partial)||((T=C.range.audio)===null||T===void 0?void 0:T.partial))}function _(C){return C.type+"_"+C.level+"_"+C.urlId+"_"+C.sn}},"./src/controller/gap-controller.ts":function(Y,M,S){"use strict";S.r(M),S.d(M,"STALL_MINIMUM_DURATION_MS",function(){return R}),S.d(M,"MAX_START_GAP_JUMP",function(){return _}),S.d(M,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return C}),S.d(M,"SKIP_BUFFER_RANGE_START",function(){return y}),S.d(M,"default",function(){return T});var I=S("./src/utils/buffer-helper.ts"),D=S("./src/errors.ts"),E=S("./src/events.ts"),L=S("./src/utils/logger.ts"),R=250,_=2,C=.1,y=.05,T=function(){function O(v,g,d,t){this.config=void 0,this.media=void 0,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=v,this.media=g,this.fragmentTracker=d,this.hls=t}var x=O.prototype;return x.destroy=function(){this.hls=this.fragmentTracker=this.media=null},x.poll=function(g){var d=this.config,t=this.media,o=this.stalled,i=t.currentTime,p=t.seeking,f=this.seeking&&!p,s=!this.seeking&&p;if(this.seeking=p,i!==g){if(this.moved=!0,o!==null){if(this.stallReported){var m=self.performance.now()-o;L.logger.warn("playback not stuck anymore @"+i+", after "+Math.round(m)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((s||f)&&(this.stalled=null),t.paused||t.ended||t.playbackRate===0||!I.BufferHelper.getBuffered(t).length)return;var l=I.BufferHelper.bufferInfo(t,i,0),a=l.len>0,r=l.nextStart||0;if(!a&&!r)return;if(p){var e=l.len>_,n=!r||r-i>_&&!this.fragmentTracker.getPartialFragment(i);if(e||n)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var c,h=Math.max(r,l.start||0)-i,u=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,b=u==null||((c=u.details)===null||c===void 0)?void 0:c.live,A=b?u.details.targetduration*2:_;if(h>0&&h<=A){this._trySkipBufferHole(null);return}}var P=self.performance.now();if(o===null){this.stalled=P;return}var w=P-o;!p&&w>=R&&this._reportStall(l.len);var U=I.BufferHelper.bufferInfo(t,i,d.maxBufferHole);this._tryFixBufferStall(U,w)},x._tryFixBufferStall=function(g,d){var t=this.config,o=this.fragmentTracker,i=this.media,p=i.currentTime,f=o.getPartialFragment(p);if(f){var s=this._trySkipBufferHole(f);if(s)return}g.len>t.maxBufferHole&&d>t.highBufferWatchdogPeriod*1e3&&(L.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},x._reportStall=function(g){var d=this.hls,t=this.media,o=this.stallReported;o||(this.stallReported=!0,L.logger.warn("Playback stalling at @"+t.currentTime+" due to low buffer (buffer="+g+")"),d.trigger(E.Events.ERROR,{type:D.ErrorTypes.MEDIA_ERROR,details:D.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:g}))},x._trySkipBufferHole=function(g){for(var d=this.config,t=this.hls,o=this.media,i=o.currentTime,p=0,f=I.BufferHelper.getBuffered(o),s=0;s<f.length;s++){var m=f.start(s);if(i+d.maxBufferHole>=p&&i<m){var l=Math.max(m+y,o.currentTime+C);return L.logger.warn("skipping hole, adjusting currentTime from "+i+" to "+l),this.moved=!0,this.stalled=null,o.currentTime=l,g&&t.trigger(E.Events.ERROR,{type:D.ErrorTypes.MEDIA_ERROR,details:D.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+i+" to "+l,frag:g}),l}p=f.end(s)}return 0},x._tryNudgeBuffer=function(){var g=this.config,d=this.hls,t=this.media,o=t.currentTime,i=(this.nudgeRetry||0)+1;if(this.nudgeRetry=i,i<g.nudgeMaxRetry){var p=o+i*g.nudgeOffset;L.logger.warn("Nudging 'currentTime' from "+o+" to "+p),t.currentTime=p,d.trigger(E.Events.ERROR,{type:D.ErrorTypes.MEDIA_ERROR,details:D.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else L.logger.error("Playhead still not moving while enough data buffered @"+o+" after "+g.nudgeMaxRetry+" nudges"),d.trigger(E.Events.ERROR,{type:D.ErrorTypes.MEDIA_ERROR,details:D.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},O}()},"./src/controller/id3-track-controller.ts":function(Y,M,S){"use strict";S.r(M);var I=S("./src/events.ts"),D=S("./src/utils/texttrack-utils.ts"),E=S("./src/demux/id3.ts"),L=.25,R=function(){function _(y){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=y,this._registerListeners()}var C=_.prototype;return C.destroy=function(){this._unregisterListeners()},C._registerListeners=function(){var T=this.hls;T.on(I.Events.MEDIA_ATTACHED,this.onMediaAttached,this),T.on(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),T.on(I.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),T.on(I.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},C._unregisterListeners=function(){var T=this.hls;T.off(I.Events.MEDIA_ATTACHED,this.onMediaAttached,this),T.off(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),T.off(I.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),T.off(I.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},C.onMediaAttached=function(T,O){this.media=O.media},C.onMediaDetaching=function(){if(!this.id3Track)return;Object(D.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},C.getID3Track=function(T){if(!this.media)return;for(var O=0;O<T.length;O++){var x=T[O];if(x.kind==="metadata"&&x.label==="id3")return Object(D.sendAddTrackEvent)(x,this.media),x}return this.media.addTextTrack("metadata","id3")},C.onFragParsingMetadata=function(T,O){if(!this.media)return;var x=O.frag,v=O.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var g=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,d=0;d<v.length;d++){var t=E.getID3Frames(v[d].data);if(t){var o=v[d].pts,i=d<v.length-1?v[d+1].pts:x.end,p=i-o;p<=0&&(i=o+L);for(var f=0;f<t.length;f++){var s=t[f];if(!E.isTimeStampFrame(s)){var m=new g(o,i,"");m.value=s,this.id3Track.addCue(m)}}}}},C.onBufferFlushing=function(T,O){var x=O.startOffset,v=O.endOffset,g=O.type;if(!g||g==="audio"){var d=this.id3Track;d&&Object(D.removeCuesInRange)(d,x,v)}},_}();M.default=R},"./src/controller/latency-controller.ts":function(Y,M,S){"use strict";S.r(M),S.d(M,"default",function(){return _});var I=S("./src/errors.ts"),D=S("./src/events.ts"),E=S("./src/utils/logger.ts");function L(C,y){for(var T=0;T<y.length;T++){var O=y[T];O.enumerable=O.enumerable||!1,O.configurable=!0,"value"in O&&(O.writable=!0),Object.defineProperty(C,O.key,O)}}function R(C,y,T){return y&&L(C.prototype,y),T&&L(C,T),C}var _=function(){function C(T){var O=this;this.hls=void 0,this.config=void 0,this.media=null,this.levelDetails=null,this.currentTime=0,this.stallCount=0,this._latency=null,this.timeupdateHandler=function(){return O.timeupdate()},this.hls=T,this.config=T.config,this.registerListeners()}var y=C.prototype;return y.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},y.registerListeners=function(){this.hls.on(D.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(D.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(D.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(D.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(D.Events.ERROR,this.onError,this)},y.unregisterListeners=function(){this.hls.off(D.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(D.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(D.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(D.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(D.Events.ERROR,this.onError)},y.onMediaAttached=function(O,x){this.media=x.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},y.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},y.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},y.onLevelUpdated=function(O,x){var v=x.details;this.levelDetails=v,v.advanced&&this.timeupdate(),!v.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},y.onError=function(O,x){if(x.details!==I.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,E.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},y.timeupdate=function(){var O=this.media,x=this.levelDetails;if(!O||!x)return;this.currentTime=O.currentTime;var v=this.computeLatency();if(v===null)return;this._latency=v;var g=this.config,d=g.lowLatencyMode,t=g.maxLiveSyncPlaybackRate;if(!d||t===1)return;var o=this.targetLatency;if(o===null)return;var i=v-o,p=Math.min(this.maxLatency,o+x.targetduration),f=i<p;if(x.live&&f&&i>.05&&this.forwardBufferLength>1){var s=Math.min(2,Math.max(1,t)),m=Math.round(2/(1+Math.exp(-.75*i-this.edgeStalled))*20)/20;O.playbackRate=Math.min(s,Math.max(1,m))}else O.playbackRate!==1&&O.playbackRate!==0&&(O.playbackRate=1)},y.estimateLiveEdge=function(){var O=this.levelDetails;return O===null?null:O.edge+O.age},y.computeLatency=function(){var O=this.estimateLiveEdge();return O===null?null:O-this.currentTime},R(C,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var O=this.config,x=this.levelDetails;return O.liveMaxLatencyDuration!==void 0?O.liveMaxLatencyDuration:x?O.liveMaxLatencyDurationCount*x.targetduration:0}},{key:"targetLatency",get:function(){var O=this.levelDetails;if(O===null)return null;var x=O.holdBack,v=O.partHoldBack,g=O.targetduration,d=this.config,t=d.liveSyncDuration,o=d.liveSyncDurationCount,i=d.lowLatencyMode,p=this.hls.userConfig,f=i&&v||x;(p.liveSyncDuration||p.liveSyncDurationCount||f===0)&&(f=t!==void 0?t:o*g);var s=g,m=1;return f+Math.min(this.stallCount*m,s)}},{key:"liveSyncPosition",get:function(){var O=this.estimateLiveEdge(),x=this.targetLatency,v=this.levelDetails;if(O===null||x===null||v===null)return null;var g=v.edge,d=O-x-this.edgeStalled,t=g-v.totalduration,o=g-(this.config.lowLatencyMode&&v.partTarget||v.targetduration);return Math.min(Math.max(t,d),o)}},{key:"drift",get:function(){var O=this.levelDetails;return O===null?1:O.drift}},{key:"edgeStalled",get:function(){var O=this.levelDetails;if(O===null)return 0;var x=(this.config.lowLatencyMode&&O.partTarget||O.targetduration)*3;return Math.max(O.age-x,0)}},{key:"forwardBufferLength",get:function(){var O=this.media,x=this.levelDetails;if(!O||!x)return 0;var v=O.buffered.length;return v?O.buffered.end(v-1):x.edge-this.currentTime}}]),C}()},"./src/controller/level-controller.ts":function(Y,M,S){"use strict";S.r(M),S.d(M,"default",function(){return d});var I=S("./src/types/level.ts"),D=S("./src/events.ts"),E=S("./src/errors.ts"),L=S("./src/utils/codecs.ts"),R=S("./src/controller/level-helper.ts"),_=S("./src/controller/base-playlist-controller.ts"),C=S("./src/types/loader.ts");function y(){return y=Object.assign||function(t){for(var o=1;o<arguments.length;o++){var i=arguments[o];for(var p in i)Object.prototype.hasOwnProperty.call(i,p)&&(t[p]=i[p])}return t},y.apply(this,arguments)}function T(t,o){for(var i=0;i<o.length;i++){var p=o[i];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(t,p.key,p)}}function O(t,o,i){return o&&T(t.prototype,o),i&&T(t,i),t}function x(t,o){t.prototype=Object.create(o.prototype),t.prototype.constructor=t,v(t,o)}function v(t,o){return v=Object.setPrototypeOf||function(p,f){return p.__proto__=f,p},v(t,o)}var g=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),d=function(t){x(o,t);function o(p){var f;return f=t.call(this,p,"[level-controller]")||this,f._levels=[],f._firstLevel=-1,f._startLevel=void 0,f.currentLevelIndex=-1,f.manualLevelIndex=-1,f.onParsedComplete=void 0,f._registerListeners(),f}var i=o.prototype;return i._registerListeners=function(){var f=this.hls;f.on(D.Events.MANIFEST_LOADED,this.onManifestLoaded,this),f.on(D.Events.LEVEL_LOADED,this.onLevelLoaded,this),f.on(D.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),f.on(D.Events.FRAG_LOADED,this.onFragLoaded,this),f.on(D.Events.ERROR,this.onError,this)},i._unregisterListeners=function(){var f=this.hls;f.off(D.Events.MANIFEST_LOADED,this.onManifestLoaded,this),f.off(D.Events.LEVEL_LOADED,this.onLevelLoaded,this),f.off(D.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),f.off(D.Events.FRAG_LOADED,this.onFragLoaded,this),f.off(D.Events.ERROR,this.onError,this)},i.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,t.prototype.destroy.call(this)},i.startLoad=function(){var f=this._levels;f.forEach(function(s){s.loadError=0}),t.prototype.startLoad.call(this)},i.onManifestLoaded=function(f,s){var m=[],l=[],a=[],r,e={},n,c=!1,h=!1,u=!1;if(s.levels.forEach(function(w){var U=w.attrs;c=c||!!(w.width&&w.height),h=h||!!w.videoCodec,u=u||!!w.audioCodec,g&&w.audioCodec&&w.audioCodec.indexOf("mp4a.40.34")!==-1&&(w.audioCodec=void 0);var N=w.bitrate+"-"+w.attrs.RESOLUTION+"-"+w.attrs.CODECS;n=e[N],n?n.url.push(w.url):(n=new I.Level(w),e[N]=n,m.push(n)),U&&(U.AUDIO&&Object(R.addGroupId)(n,"audio",U.AUDIO),U.SUBTITLES&&Object(R.addGroupId)(n,"text",U.SUBTITLES))}),(c||h)&&u&&(m=m.filter(function(w){var U=w.videoCodec,N=w.width,F=w.height;return!!U||!!(N&&F)})),m=m.filter(function(w){var U=w.audioCodec,N=w.videoCodec;return(!U||Object(L.isCodecSupportedInMp4)(U,"audio"))&&(!N||Object(L.isCodecSupportedInMp4)(N,"video"))}),s.audioTracks&&(l=s.audioTracks.filter(function(w){return!w.audioCodec||Object(L.isCodecSupportedInMp4)(w.audioCodec,"audio")}),Object(R.assignTrackIdsByGroup)(l)),s.subtitles&&(a=s.subtitles,Object(R.assignTrackIdsByGroup)(a)),m.length>0){r=m[0].bitrate,m.sort(function(w,U){return w.bitrate-U.bitrate}),this._levels=m;for(var b=0;b<m.length;b++)if(m[b].bitrate===r){this._firstLevel=b,this.log("manifest loaded, "+m.length+" level(s) found, first bitrate: "+r);break}var A=u&&!h,P={levels:m,audioTracks:l,subtitleTracks:a,firstLevel:this._firstLevel,stats:s.stats,audio:u,video:h,altAudio:!A&&l.some(function(w){return!!w.url})};this.hls.trigger(D.Events.MANIFEST_PARSED,P),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(D.Events.ERROR,{type:E.ErrorTypes.MEDIA_ERROR,details:E.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:s.url,reason:"no level with compatible codecs found in manifest"})},i.onError=function(f,s){if(t.prototype.onError.call(this,f,s),s.fatal)return;var m=s.context,l=this._levels[this.currentLevelIndex];if(m&&(m.type===C.PlaylistContextType.AUDIO_TRACK&&l.audioGroupIds&&m.groupId===l.audioGroupIds[l.urlId]||m.type===C.PlaylistContextType.SUBTITLE_TRACK&&l.textGroupIds&&m.groupId===l.textGroupIds[l.urlId])){this.redundantFailover(this.currentLevelIndex);return}var a=!1,r=!0,e;switch(s.details){case E.ErrorDetails.FRAG_LOAD_ERROR:case E.ErrorDetails.FRAG_LOAD_TIMEOUT:case E.ErrorDetails.KEY_LOAD_ERROR:case E.ErrorDetails.KEY_LOAD_TIMEOUT:if(s.frag){var n=this._levels[s.frag.level];n?(n.fragmentError++,n.fragmentError>this.hls.config.fragLoadingMaxRetry&&(e=s.frag.level)):e=s.frag.level}break;case E.ErrorDetails.LEVEL_LOAD_ERROR:case E.ErrorDetails.LEVEL_LOAD_TIMEOUT:m&&(m.deliveryDirectives&&(r=!1),e=m.level),a=!0;break;case E.ErrorDetails.REMUX_ALLOC_ERROR:e=s.level,a=!0;break}e!==void 0&&this.recoverLevel(s,e,a,r)},i.recoverLevel=function(f,s,m,l){var a=f.details,r=this._levels[s];if(r.loadError++,m){var e=this.retryLoadingOrFail(f);if(e)f.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(l){var n=r.url.length;if(n>1&&r.loadError<n)f.levelRetry=!0,this.redundantFailover(s);else if(this.manualLevelIndex===-1){var c=s===0?this._levels.length-1:s-1;this.currentLevelIndex!==c&&this._levels[c].loadError===0&&(this.warn(a+": switch to "+c),f.levelRetry=!0,this.hls.nextAutoLevel=c)}}},i.redundantFailover=function(f){var s=this._levels[f],m=s.url.length;if(m>1){var l=(s.urlId+1)%m;this.warn("Switching to redundant URL-id "+l),this._levels.forEach(function(a){a.urlId=l}),this.level=f}},i.onFragLoaded=function(f,s){var m=s.frag;if(m!==void 0&&m.type===C.PlaylistLevelType.MAIN){var l=this._levels[m.level];l!==void 0&&(l.fragmentError=0,l.loadError=0)}},i.onLevelLoaded=function(f,s){var m,l=s.level,a=s.details,r=this._levels[l];if(!r){var e;this.warn("Invalid level index "+l),(e=s.deliveryDirectives)!==null&&e!==void 0&&e.skip&&(a.deltaUpdateFailed=!0);return}l===this.currentLevelIndex?(r.fragmentError===0&&(r.loadError=0,this.retryCount=0),this.playlistLoaded(l,s,r.details)):(m=s.deliveryDirectives)!==null&&m!==void 0&&m.skip&&(a.deltaUpdateFailed=!0)},i.onAudioTrackSwitched=function(f,s){var m=this.hls.levels[this.currentLevelIndex];if(!m)return;if(m.audioGroupIds){for(var l=-1,a=this.hls.audioTracks[s.id].groupId,r=0;r<m.audioGroupIds.length;r++)if(m.audioGroupIds[r]===a){l=r;break}l!==m.urlId&&(m.urlId=l,this.startLoad())}},i.loadPlaylist=function(f){var s=this.currentLevelIndex,m=this._levels[s];if(this.canLoad&&m&&m.url.length>0){var l=m.urlId,a=m.url[l];if(f)try{a=f.addDirectives(a)}catch(r){this.warn("Could not construct new URL with HLS Delivery Directives: "+r)}this.log("Attempt loading level index "+s+(f?" at sn "+f.msn+" part "+f.part:"")+" with URL-id "+l+" "+a),this.clearTimer(),this.hls.trigger(D.Events.LEVEL_LOADING,{url:a,level:s,id:l,deliveryDirectives:f||null})}},i.removeLevel=function(f,s){var m=function(r,e){return e!==s},l=this._levels.filter(function(a,r){return r!==f?!0:a.url.length>1&&s!==void 0?(a.url=a.url.filter(m),a.audioGroupIds&&(a.audioGroupIds=a.audioGroupIds.filter(m)),a.textGroupIds&&(a.textGroupIds=a.textGroupIds.filter(m)),a.urlId=0,!0):!1}).map(function(a,r){var e=a.details;return e!=null&&e.fragments&&e.fragments.forEach(function(n){n.level=r}),a});this._levels=l,this.hls.trigger(D.Events.LEVELS_UPDATED,{levels:l})},O(o,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(f){var s,m=this._levels;if(m.length===0)return;if(this.currentLevelIndex===f&&(s=m[f])!==null&&s!==void 0&&s.details)return;if(f<0||f>=m.length){var l=f<0;if(this.hls.trigger(D.Events.ERROR,{type:E.ErrorTypes.OTHER_ERROR,details:E.ErrorDetails.LEVEL_SWITCH_ERROR,level:f,fatal:l,reason:"invalid level idx"}),l)return;f=Math.min(f,m.length-1)}this.clearTimer();var a=this.currentLevelIndex,r=m[a],e=m[f];this.log("switching to level "+f+" from "+a),this.currentLevelIndex=f;var n=y({},e,{level:f,maxBitrate:e.maxBitrate,uri:e.uri,urlId:e.urlId});delete n._urlId,this.hls.trigger(D.Events.LEVEL_SWITCHING,n);var c=e.details;if(!c||c.live){var h=this.switchParams(e.uri,r==null?void 0:r.details);this.loadPlaylist(h)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(f){this.manualLevelIndex=f,this._startLevel===void 0&&(this._startLevel=f),f!==-1&&(this.level=f)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(f){this._firstLevel=f}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var f=this.hls.config.startLevel;return f!==void 0?f:this._firstLevel}else return this._startLevel},set:function(f){this._startLevel=f}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(f){this.level=f,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=f)}}]),o}(_.default)},"./src/controller/level-helper.ts":function(Y,M,S){"use strict";S.r(M),S.d(M,"addGroupId",function(){return E}),S.d(M,"assignTrackIdsByGroup",function(){return L}),S.d(M,"updatePTS",function(){return R}),S.d(M,"updateFragPTSDTS",function(){return C}),S.d(M,"mergeDetails",function(){return y}),S.d(M,"mapPartIntersection",function(){return T}),S.d(M,"mapFragmentIntersection",function(){return O}),S.d(M,"adjustSliding",function(){return x}),S.d(M,"addSliding",function(){return v}),S.d(M,"computeReloadInterval",function(){return g}),S.d(M,"getFragmentWithSN",function(){return d}),S.d(M,"getPartWith",function(){return t});var I=S("./src/polyfills/number.ts"),D=S("./src/utils/logger.ts");function E(o,i,p){switch(i){case"audio":o.audioGroupIds||(o.audioGroupIds=[]),o.audioGroupIds.push(p);break;case"text":o.textGroupIds||(o.textGroupIds=[]),o.textGroupIds.push(p);break}}function L(o){var i={};o.forEach(function(p){var f=p.groupId||"";p.id=i[f]=i[f]||0,i[f]++})}function R(o,i,p){var f=o[i],s=o[p];_(f,s)}function _(o,i){var p=i.startPTS;if(Object(I.isFiniteNumber)(p)){var f=0,s;i.sn>o.sn?(f=p-o.start,s=o):(f=o.start-p,s=i),s.duration!==f&&(s.duration=f)}else if(i.sn>o.sn){var m=o.cc===i.cc;m&&o.minEndPTS?i.start=o.start+(o.minEndPTS-o.start):i.start=o.start+o.duration}else i.start=Math.max(o.start-i.duration,0)}function C(o,i,p,f,s,m){var l=f-p;l<=0&&(D.logger.warn("Fragment should have a positive duration",i),f=p+i.duration,m=s+i.duration);var a=p,r=f,e=i.startPTS,n=i.endPTS;if(Object(I.isFiniteNumber)(e)){var c=Math.abs(e-p);Object(I.isFiniteNumber)(i.deltaPTS)?i.deltaPTS=Math.max(c,i.deltaPTS):i.deltaPTS=c,a=Math.max(p,e),p=Math.min(p,e),s=Math.min(s,i.startDTS),r=Math.min(f,n),f=Math.max(f,n),m=Math.max(m,i.endDTS)}i.duration=f-p;var h=p-i.start;i.appendedPTS=f,i.start=i.startPTS=p,i.maxStartPTS=a,i.startDTS=s,i.endPTS=f,i.minEndPTS=r,i.endDTS=m;var u=i.sn;if(!o||u<o.startSN||u>o.endSN)return 0;var b,A=u-o.startSN,P=o.fragments;for(P[A]=i,b=A;b>0;b--)_(P[b],P[b-1]);for(b=A;b<P.length-1;b++)_(P[b],P[b+1]);return o.fragmentHint&&_(P[P.length-1],o.fragmentHint),o.PTSKnown=o.alignedSliding=!0,h}function y(o,i){for(var p=null,f=o.fragments,s=f.length-1;s>=0;s--){var m=f[s].initSegment;if(m){p=m;break}}o.fragmentHint&&delete o.fragmentHint.endPTS;var l=0,a;if(O(o,i,function(b,A){b.relurl&&(l=b.cc-A.cc),Object(I.isFiniteNumber)(b.startPTS)&&Object(I.isFiniteNumber)(b.endPTS)&&(A.start=A.startPTS=b.startPTS,A.startDTS=b.startDTS,A.appendedPTS=b.appendedPTS,A.maxStartPTS=b.maxStartPTS,A.endPTS=b.endPTS,A.endDTS=b.endDTS,A.minEndPTS=b.minEndPTS,A.duration=b.endPTS-b.startPTS,A.duration&&(a=A),i.PTSKnown=i.alignedSliding=!0),A.elementaryStreams=b.elementaryStreams,A.loader=b.loader,A.stats=b.stats,A.urlId=b.urlId,b.initSegment&&(A.initSegment=b.initSegment,p=b.initSegment)}),p){var r=i.fragmentHint?i.fragments.concat(i.fragmentHint):i.fragments;r.forEach(function(b){var A;(!b.initSegment||b.initSegment.relurl===((A=p)===null||A===void 0?void 0:A.relurl))&&(b.initSegment=p)})}if(i.skippedSegments&&(i.deltaUpdateFailed=i.fragments.some(function(b){return!b}),i.deltaUpdateFailed)){D.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var e=i.skippedSegments;e--;)i.fragments.shift();i.startSN=i.fragments[0].sn,i.startCC=i.fragments[0].cc}var n=i.fragments;if(l){D.logger.warn("discontinuity sliding from playlist, take drift into account");for(var c=0;c<n.length;c++)n[c].cc+=l}i.skippedSegments&&(i.startCC=i.fragments[0].cc),T(o.partList,i.partList,function(b,A){A.elementaryStreams=b.elementaryStreams,A.stats=b.stats}),a?C(i,a,a.startPTS,a.endPTS,a.startDTS,a.endDTS):x(o,i),n.length&&(i.totalduration=i.edge-n[0].start),i.driftStartTime=o.driftStartTime,i.driftStart=o.driftStart;var h=i.advancedDateTime;if(i.advanced&&h){var u=i.edge;i.driftStart||(i.driftStartTime=h,i.driftStart=u),i.driftEndTime=h,i.driftEnd=u}else i.driftEndTime=o.driftEndTime,i.driftEnd=o.driftEnd,i.advancedDateTime=o.advancedDateTime}function T(o,i,p){if(o&&i)for(var f=0,s=0,m=o.length;s<=m;s++){var l=o[s],a=i[s+f];l&&a&&l.index===a.index&&l.fragment.sn===a.fragment.sn?p(l,a):f--}}function O(o,i,p){for(var f=i.skippedSegments,s=Math.max(o.startSN,i.startSN)-i.startSN,m=(o.fragmentHint?1:0)+(f?i.endSN:Math.min(o.endSN,i.endSN))-i.startSN,l=i.startSN-o.startSN,a=i.fragmentHint?i.fragments.concat(i.fragmentHint):i.fragments,r=o.fragmentHint?o.fragments.concat(o.fragmentHint):o.fragments,e=s;e<=m;e++){var n=r[l+e],c=a[e];f&&!c&&e<f&&(c=i.fragments[e]=n),n&&c&&p(n,c)}}function x(o,i){var p=i.startSN+i.skippedSegments-o.startSN,f=o.fragments;if(p<0||p>=f.length)return;v(i,f[p].start)}function v(o,i){if(i){for(var p=o.fragments,f=o.skippedSegments;f<p.length;f++)p[f].start+=i;o.fragmentHint&&(o.fragmentHint.start+=i)}}function g(o,i){var p=1e3*o.levelTargetDuration,f=p/2,s=o.age,m=s>0&&s<p*3,l=i.loading.end-i.loading.start,a,r=o.availabilityDelay;if(o.updated===!1)if(m){var e=333*o.misses;a=Math.max(Math.min(f,l*2),e),o.availabilityDelay=(o.availabilityDelay||0)+a}else a=f;else m?(r=Math.min(r||p/2,s),o.availabilityDelay=r,a=r+p-s):a=p-l;return Math.round(a)}function d(o,i,p){if(!o||!o.details)return null;var f=o.details,s=f.fragments[i-f.startSN];return s||(s=f.fragmentHint,s&&s.sn===i?s:i<f.startSN&&p&&p.sn===i?p:null)}function t(o,i,p){if(!o||!o.details)return null;var f=o.details.partList;if(f)for(var s=f.length;s--;){var m=f[s];if(m.index===p&&m.fragment.sn===i)return m}return null}},"./src/controller/stream-controller.ts":function(Y,M,S){"use strict";S.r(M),S.d(M,"default",function(){return f});var I=S("./src/polyfills/number.ts"),D=S("./src/controller/base-stream-controller.ts"),E=S("./src/is-supported.ts"),L=S("./src/events.ts"),R=S("./src/utils/buffer-helper.ts"),_=S("./src/controller/fragment-tracker.ts"),C=S("./src/types/loader.ts"),y=S("./src/loader/fragment.ts"),T=S("./src/demux/transmuxer-interface.ts"),O=S("./src/types/transmuxer.ts"),x=S("./src/controller/gap-controller.ts"),v=S("./src/errors.ts"),g=S("./src/utils/logger.ts");function d(s,m){for(var l=0;l<m.length;l++){var a=m[l];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(s,a.key,a)}}function t(s,m,l){return m&&d(s.prototype,m),l&&d(s,l),s}function o(s,m){s.prototype=Object.create(m.prototype),s.prototype.constructor=s,i(s,m)}function i(s,m){return i=Object.setPrototypeOf||function(a,r){return a.__proto__=r,a},i(s,m)}var p=100,f=function(s){o(m,s);function m(a,r){var e;return e=s.call(this,a,r,"[stream-controller]")||this,e.audioCodecSwap=!1,e.gapController=null,e.level=-1,e._forceStartLoad=!1,e.altAudio=!1,e.audioOnly=!1,e.fragPlaying=null,e.onvplaying=null,e.onvseeked=null,e.fragLastKbps=0,e.stalled=!1,e.couldBacktrack=!1,e.audioCodecSwitch=!1,e.videoBuffer=null,e._registerListeners(),e}var l=m.prototype;return l._registerListeners=function(){var r=this.hls;r.on(L.Events.MEDIA_ATTACHED,this.onMediaAttached,this),r.on(L.Events.MEDIA_DETACHING,this.onMediaDetaching,this),r.on(L.Events.MANIFEST_LOADING,this.onManifestLoading,this),r.on(L.Events.MANIFEST_PARSED,this.onManifestParsed,this),r.on(L.Events.LEVEL_LOADING,this.onLevelLoading,this),r.on(L.Events.LEVEL_LOADED,this.onLevelLoaded,this),r.on(L.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),r.on(L.Events.ERROR,this.onError,this),r.on(L.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),r.on(L.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),r.on(L.Events.BUFFER_CREATED,this.onBufferCreated,this),r.on(L.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),r.on(L.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),r.on(L.Events.FRAG_BUFFERED,this.onFragBuffered,this)},l._unregisterListeners=function(){var r=this.hls;r.off(L.Events.MEDIA_ATTACHED,this.onMediaAttached,this),r.off(L.Events.MEDIA_DETACHING,this.onMediaDetaching,this),r.off(L.Events.MANIFEST_LOADING,this.onManifestLoading,this),r.off(L.Events.MANIFEST_PARSED,this.onManifestParsed,this),r.off(L.Events.LEVEL_LOADED,this.onLevelLoaded,this),r.off(L.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),r.off(L.Events.ERROR,this.onError,this),r.off(L.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),r.off(L.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),r.off(L.Events.BUFFER_CREATED,this.onBufferCreated,this),r.off(L.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),r.off(L.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),r.off(L.Events.FRAG_BUFFERED,this.onFragBuffered,this)},l.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},l.startLoad=function(r){if(this.levels){var e=this.lastCurrentTime,n=this.hls;if(this.stopLoad(),this.setInterval(p),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var c=n.startLevel;c===-1&&(n.config.testBandwidth?(c=0,this.bitrateTest=!0):c=n.nextAutoLevel),this.level=n.nextLoadLevel=c,this.loadedmetadata=!1}e>0&&r===-1&&(this.log("Override startPosition with lastCurrentTime @"+e.toFixed(3)),r=e),this.state=D.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=r,this.tick()}else this._forceStartLoad=!0,this.state=D.State.STOPPED},l.stopLoad=function(){this._forceStartLoad=!1,s.prototype.stopLoad.call(this)},l.doTick=function(){switch(this.state){case D.State.IDLE:this.doTickIdle();break;case D.State.WAITING_LEVEL:{var r,e=this.levels,n=this.level,c=e==null||((r=e[n])===null||r===void 0)?void 0:r.details;if(c&&(!c.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(c))break;this.state=D.State.IDLE;break}break}case D.State.FRAG_LOADING_WAITING_RETRY:{var h,u=self.performance.now(),b=this.retryDate;(!b||u>=b||(h=this.media)!==null&&h!==void 0&&h.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=D.State.IDLE)}break;default:break}this.onTickEnd()},l.onTickEnd=function(){s.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},l.doTickIdle=function(){var r,e,n=this.hls,c=this.levelLastLoaded,h=this.levels,u=this.media,b=n.config,A=n.nextLoadLevel;if(c===null||!u&&(this.startFragRequested||!b.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!h||!h[A])return;var P=h[A];this.level=n.nextLoadLevel=A;var w=P.details;if(!w||this.state===D.State.WAITING_LEVEL||w.live&&this.levelLastLoaded!==A){this.state=D.State.WAITING_LEVEL;return}var U=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:u,C.PlaylistLevelType.MAIN);if(U===null)return;var N=U.len,F=this.getMaxBufferLength(P.maxBitrate);if(N>=F)return;if(this._streamEnded(U,w)){var K={};this.altAudio&&(K.type="video"),this.hls.trigger(L.Events.BUFFER_EOS,K),this.state=D.State.ENDED;return}var $=U.end,X=this.getNextFragment($,w);if(this.couldBacktrack&&!this.fragPrevious&&X&&X.sn!=="initSegment"){var oe=X.sn-w.startSN;oe>1&&(X=w.fragments[oe-1],this.fragmentTracker.removeFragment(X))}if(X&&this.fragmentTracker.getState(X)===_.FragmentState.OK&&this.nextLoadPosition>$){var pe=this.audioOnly&&!this.altAudio?y.ElementaryStreamTypes.AUDIO:y.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(u,pe,C.PlaylistLevelType.MAIN),X=this.getNextFragment(this.nextLoadPosition,w)}if(!X)return;X.initSegment&&!X.initSegment.data&&!this.bitrateTest&&(X=X.initSegment),((r=X.decryptdata)===null||r===void 0?void 0:r.keyFormat)==="identity"&&!((e=X.decryptdata)!==null&&e!==void 0&&e.key)?this.loadKey(X,w):this.loadFragment(X,w,$)},l.loadFragment=function(r,e,n){var c,h=this.fragmentTracker.getState(r);if(this.fragCurrent=r,h===_.FragmentState.BACKTRACKED){var u=this.fragmentTracker.getBacktrackData(r);if(u){this._handleFragmentLoadProgress(u),this._handleFragmentLoadComplete(u);return}else h=_.FragmentState.NOT_LOADED}h===_.FragmentState.NOT_LOADED||h===_.FragmentState.PARTIAL?r.sn==="initSegment"?this._loadInitSegment(r):this.bitrateTest?(r.bitrateTest=!0,this.log("Fragment "+r.sn+" of level "+r.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(r)):(this.startFragRequested=!0,s.prototype.loadFragment.call(this,r,e,n)):h===_.FragmentState.APPENDING?this.reduceMaxBufferLength(r.duration)&&this.fragmentTracker.removeFragment(r):((c=this.media)===null||c===void 0?void 0:c.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},l.getAppendedFrag=function(r){var e=this.fragmentTracker.getAppendedFrag(r,C.PlaylistLevelType.MAIN);return e&&"fragment"in e?e.fragment:e},l.getBufferedFrag=function(r){return this.fragmentTracker.getBufferedFrag(r,C.PlaylistLevelType.MAIN)},l.followingBufferedFrag=function(r){return r?this.getBufferedFrag(r.end+.5):null},l.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},l.nextLevelSwitch=function(){var r=this.levels,e=this.media;if(e!=null&&e.readyState){var n,c=this.getAppendedFrag(e.currentTime);if(c&&c.start>1&&this.flushMainBuffer(0,c.start-1),!e.paused&&r){var h=this.hls.nextLoadLevel,u=r[h],b=this.fragLastKbps;b&&this.fragCurrent?n=this.fragCurrent.duration*u.maxBitrate/(1e3*b)+1:n=0}else n=0;var A=this.getBufferedFrag(e.currentTime+n);if(A){var P=this.followingBufferedFrag(A);if(P){this.abortCurrentFrag();var w=P.maxStartPTS?P.maxStartPTS:P.start,U=P.duration,N=Math.max(A.end,w+Math.min(Math.max(U-this.config.maxFragLookUpTolerance,U*.5),U*.75));this.flushMainBuffer(N,Number.POSITIVE_INFINITY)}}}},l.abortCurrentFrag=function(){var r=this.fragCurrent;this.fragCurrent=null,r!=null&&r.loader&&r.loader.abort(),this.state===D.State.KEY_LOADING&&(this.state=D.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},l.flushMainBuffer=function(r,e){s.prototype.flushMainBuffer.call(this,r,e,this.altAudio?"video":null)},l.onMediaAttached=function(r,e){s.prototype.onMediaAttached.call(this,r,e);var n=e.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),n.addEventListener("playing",this.onvplaying),n.addEventListener("seeked",this.onvseeked),this.gapController=new x.default(this.config,n,this.fragmentTracker,this.hls)},l.onMediaDetaching=function(){var r=this.media;r&&(r.removeEventListener("playing",this.onvplaying),r.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),s.prototype.onMediaDetaching.call(this)},l.onMediaPlaying=function(){this.tick()},l.onMediaSeeked=function(){var r=this.media,e=r?r.currentTime:null;Object(I.isFiniteNumber)(e)&&this.log("Media seeked to "+e.toFixed(3)),this.tick()},l.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(L.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},l.onManifestParsed=function(r,e){var n=!1,c=!1,h;e.levels.forEach(function(u){h=u.audioCodec,h&&(h.indexOf("mp4a.40.2")!==-1&&(n=!0),h.indexOf("mp4a.40.5")!==-1&&(c=!0))}),this.audioCodecSwitch=n&&c&&!Object(E.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=e.levels,this.startFragRequested=!1},l.onLevelLoading=function(r,e){var n=this.levels;if(!n||this.state!==D.State.IDLE)return;var c=n[e.level];(!c.details||c.details.live&&this.levelLastLoaded!==e.level||this.waitForCdnTuneIn(c.details))&&(this.state=D.State.WAITING_LEVEL)},l.onLevelLoaded=function(r,e){var n,c=this.levels,h=e.level,u=e.details,b=u.totalduration;if(!c){this.warn("Levels were reset while loading level "+h);return}this.log("Level "+h+" loaded ["+u.startSN+","+u.endSN+"], cc ["+u.startCC+", "+u.endCC+"] duration:"+b);var A=this.fragCurrent;A&&(this.state===D.State.FRAG_LOADING||this.state===D.State.FRAG_LOADING_WAITING_RETRY)&&(A.level!==e.level&&A.loader&&(this.state=D.State.IDLE,A.loader.abort()));var P=c[h],w=0;if(u.live||(n=P.details)!==null&&n!==void 0&&n.live){if(u.fragments[0]||(u.deltaUpdateFailed=!0),u.deltaUpdateFailed)return;w=this.alignPlaylists(u,P.details)}if(P.details=u,this.levelLastLoaded=h,this.hls.trigger(L.Events.LEVEL_UPDATED,{details:u,level:h}),this.state===D.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(u))return;this.state=D.State.IDLE}this.startFragRequested?u.live&&this.synchronizeToLiveEdge(u):this.setStartPosition(u,w),this.tick()},l._handleFragmentLoadProgress=function(r){var e,n=r.frag,c=r.part,h=r.payload,u=this.levels;if(!u){this.warn("Levels were reset while fragment load was in progress. Fragment "+n.sn+" of level "+n.level+" will not be buffered");return}var b=u[n.level],A=b.details;if(!A){this.warn("Dropping fragment "+n.sn+" of level "+n.level+" after level details were reset");return}var P=b.videoCodec,w=A.PTSKnown||!A.live,U=(e=n.initSegment)===null||e===void 0?void 0:e.data,N=this._getAudioCodec(b),F=this.transmuxer=this.transmuxer||new T.default(this.hls,C.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),K=c?c.index:-1,$=K!==-1,X=new O.ChunkMetadata(n.level,n.sn,n.stats.chunkCount,h.byteLength,K,$),oe=this.initPTS[n.cc];F.push(h,U,N,P,n,c,A.totalduration,w,X,oe)},l.onAudioTrackSwitching=function(r,e){var n=this.altAudio,c=!!e.url,h=e.id;if(!c){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var u=this.fragCurrent;u!=null&&u.loader&&(this.log("Switching to main audio track, cancel main fragment load"),u.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var b=this.hls;n&&b.trigger(L.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),b.trigger(L.Events.AUDIO_TRACK_SWITCHED,{id:h})}},l.onAudioTrackSwitched=function(r,e){var n=e.id,c=!!this.hls.audioTracks[n].url;if(c){var h=this.videoBuffer;h&&this.mediaBuffer!==h&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=h)}this.altAudio=c,this.tick()},l.onBufferCreated=function(r,e){var n=e.tracks,c,h,u=!1;for(var b in n){var A=n[b];if(A.id==="main"){if(h=b,c=A,b==="video"){var P=n[b];P&&(this.videoBuffer=P.buffer)}}else u=!0}u&&c?(this.log("Alternate track found, use "+h+".buffered to schedule main fragment loading"),this.mediaBuffer=c.buffer):this.mediaBuffer=this.media},l.onFragBuffered=function(r,e){var n=e.frag,c=e.part;if(n&&n.type!==C.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(n)){this.warn("Fragment "+n.sn+(c?" p: "+c.index:"")+" of level "+n.level+" finished buffering, but was aborted. state: "+this.state),this.state===D.State.PARSED&&(this.state=D.State.IDLE);return}var h=c?c.stats:n.stats;this.fragLastKbps=Math.round(8*h.total/(h.buffering.end-h.loading.first)),n.sn!=="initSegment"&&(this.fragPrevious=n),this.fragBufferedComplete(n,c)},l.onError=function(r,e){switch(e.details){case v.ErrorDetails.FRAG_LOAD_ERROR:case v.ErrorDetails.FRAG_LOAD_TIMEOUT:case v.ErrorDetails.KEY_LOAD_ERROR:case v.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(C.PlaylistLevelType.MAIN,e);break;case v.ErrorDetails.LEVEL_LOAD_ERROR:case v.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==D.State.ERROR&&(e.fatal?(this.warn(""+e.details),this.state=D.State.ERROR):!e.levelRetry&&this.state===D.State.WAITING_LEVEL&&(this.state=D.State.IDLE));break;case v.ErrorDetails.BUFFER_FULL_ERROR:if(e.parent==="main"&&(this.state===D.State.PARSING||this.state===D.State.PARSED)){var n=!0,c=this.getFwdBufferInfo(this.media,C.PlaylistLevelType.MAIN);c&&c.len>.5&&(n=!this.reduceMaxBufferLength(c.len)),n&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},l.checkBuffer=function(){var r=this.media,e=this.gapController;if(!r||!e||!r.readyState)return;var n=R.BufferHelper.getBuffered(r);!this.loadedmetadata&&n.length?(this.loadedmetadata=!0,this.seekToStartPos()):e.poll(this.lastCurrentTime),this.lastCurrentTime=r.currentTime},l.onFragLoadEmergencyAborted=function(){this.state=D.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},l.onBufferFlushed=function(r,e){var n=e.type;if(n!==y.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var c=(n===y.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(c,n,C.PlaylistLevelType.MAIN)}},l.onLevelsUpdated=function(r,e){this.levels=e.levels},l.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},l.seekToStartPos=function(){var r=this.media,e=r.currentTime,n=this.startPosition;if(n>=0&&e<n){if(r.seeking){g.logger.log("could not seek to "+n+", already seeking at "+e);return}var c=R.BufferHelper.getBuffered(r),h=c.length?c.start(0):0,u=h-n;u>0&&(u<this.config.maxBufferHole||u<this.config.maxFragLookUpTolerance)&&(g.logger.log("adjusting start position by "+u+" to match buffer start"),n+=u,this.startPosition=n),this.log("seek to target start position "+n+" from current time "+e),r.currentTime=n}},l._getAudioCodec=function(r){var e=this.config.defaultAudioCodec||r.audioCodec;return this.audioCodecSwap&&e&&(this.log("Swapping audio codec"),e.indexOf("mp4a.40.5")!==-1?e="mp4a.40.2":e="mp4a.40.5"),e},l._loadBitrateTestFrag=function(r){var e=this;this._doFragLoad(r).then(function(n){var c=e.hls;if(!n||c.nextLoadLevel||e.fragContextChanged(r))return;e.fragLoadError=0,e.state=D.State.IDLE,e.startFragRequested=!1,e.bitrateTest=!1;var h=r.stats;h.parsing.start=h.parsing.end=h.buffering.start=h.buffering.end=self.performance.now(),c.trigger(L.Events.FRAG_LOADED,n)})},l._handleTransmuxComplete=function(r){var e,n="main",c=this.hls,h=r.remuxResult,u=r.chunkMeta,b=this.getCurrentContext(u);if(!b){this.warn("The loading context changed while buffering fragment "+u.sn+" of level "+u.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(u.level);return}var A=b.frag,P=b.part,w=b.level,U=h.video,N=h.text,F=h.id3,K=h.initSegment,$=this.altAudio?void 0:h.audio;if(this.fragContextChanged(A))return;if(this.state=D.State.PARSING,K){K.tracks&&(this._bufferInitSegment(w,K.tracks,A,u),c.trigger(L.Events.FRAG_PARSING_INIT_SEGMENT,{frag:A,id:n,tracks:K.tracks}));var X=K.initPTS,oe=K.timescale;Object(I.isFiniteNumber)(X)&&(this.initPTS[A.cc]=X,c.trigger(L.Events.INIT_PTS_FOUND,{frag:A,id:n,initPTS:X,timescale:oe}))}if(U&&h.independent!==!1){if(w.details){var pe=U.startPTS,ee=U.endPTS,de=U.startDTS,le=U.endDTS;if(P)P.elementaryStreams[U.type]={startPTS:pe,endPTS:ee,startDTS:de,endDTS:le};else if(U.firstKeyFrame&&U.independent&&(this.couldBacktrack=!0),U.dropped&&U.independent){var re=this.getLoadPosition()+this.config.maxBufferHole;if(re<pe){this.backtrack(A);return}A.setElementaryStreamInfo(U.type,A.start,ee,A.start,le,!0)}A.setElementaryStreamInfo(U.type,pe,ee,de,le),this.bufferFragmentData(U,A,P,u)}}else if(h.independent===!1){this.backtrack(A);return}if($){var te=$.startPTS,Te=$.endPTS,Ie=$.startDTS,Ae=$.endDTS;P&&(P.elementaryStreams[y.ElementaryStreamTypes.AUDIO]={startPTS:te,endPTS:Te,startDTS:Ie,endDTS:Ae}),A.setElementaryStreamInfo(y.ElementaryStreamTypes.AUDIO,te,Te,Ie,Ae),this.bufferFragmentData($,A,P,u)}if(F!=null&&(e=F.samples)!==null&&e!==void 0&&e.length){var De={frag:A,id:n,samples:F.samples};c.trigger(L.Events.FRAG_PARSING_METADATA,De)}if(N){var fe={frag:A,id:n,samples:N.samples};c.trigger(L.Events.FRAG_PARSING_USERDATA,fe)}},l._bufferInitSegment=function(r,e,n,c){var h=this;if(this.state!==D.State.PARSING)return;this.audioOnly=!!e.audio&&!e.video,this.altAudio&&!this.audioOnly&&delete e.audio;var u=e.audio,b=e.video,A=e.audiovideo;if(u){var P=r.audioCodec,w=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(P&&(P.indexOf("mp4a.40.5")!==-1?P="mp4a.40.2":P="mp4a.40.5"),u.metadata.channelCount!==1&&w.indexOf("firefox")===-1&&(P="mp4a.40.5")),w.indexOf("android")!==-1&&u.container!=="audio/mpeg"&&(P="mp4a.40.2",this.log("Android: force audio codec to "+P)),r.audioCodec&&r.audioCodec!==P&&this.log('Swapping manifest audio codec "'+r.audioCodec+'" for "'+P+'"'),u.levelCodec=P,u.id="main",this.log("Init audio buffer, container:"+u.container+", codecs[selected/level/parsed]=["+(P||"")+"/"+(r.audioCodec||"")+"/"+u.codec+"]")}b&&(b.levelCodec=r.videoCodec,b.id="main",this.log("Init video buffer, container:"+b.container+", codecs[level/parsed]=["+(r.videoCodec||"")+"/"+b.codec+"]")),A&&this.log("Init audiovideo buffer, container:"+A.container+", codecs[level/parsed]=["+(r.attrs.CODECS||"")+"/"+A.codec+"]"),this.hls.trigger(L.Events.BUFFER_CODECS,e),Object.keys(e).forEach(function(U){var N=e[U],F=N.initSegment;F!=null&&F.byteLength&&h.hls.trigger(L.Events.BUFFER_APPENDING,{type:U,data:F,frag:n,part:null,chunkMeta:c,parent:n.type})}),this.tick()},l.backtrack=function(r){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(r);var e=this.fragmentTracker.backtrack(r);this.fragPrevious=null,this.nextLoadPosition=r.start,e?this.resetFragmentLoading(r):this.state=D.State.BACKTRACKING},l.checkFragmentChanged=function(){var r=this.media,e=null;if(r&&r.readyState>1&&r.seeking===!1){var n=r.currentTime;if(R.BufferHelper.isBuffered(r,n)?e=this.getAppendedFrag(n):R.BufferHelper.isBuffered(r,n+.1)&&(e=this.getAppendedFrag(n+.1)),e){var c=this.fragPlaying,h=e.level;(!c||e.sn!==c.sn||c.level!==h||e.urlId!==c.urlId)&&(this.hls.trigger(L.Events.FRAG_CHANGED,{frag:e}),(!c||c.level!==h)&&this.hls.trigger(L.Events.LEVEL_SWITCHED,{level:h}),this.fragPlaying=e)}}},t(m,[{key:"nextLevel",get:function(){var r=this.nextBufferedFrag;return r?r.level:-1}},{key:"currentLevel",get:function(){var r=this.media;if(r){var e=this.getAppendedFrag(r.currentTime);if(e)return e.level}return-1}},{key:"nextBufferedFrag",get:function(){var r=this.media;if(r){var e=this.getAppendedFrag(r.currentTime);return this.followingBufferedFrag(e)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),m}(D.default)},"./src/controller/subtitle-stream-controller.ts":function(Y,M,S){"use strict";S.r(M),S.d(M,"SubtitleStreamController",function(){return o});var I=S("./src/events.ts"),D=S("./src/utils/logger.ts"),E=S("./src/utils/buffer-helper.ts"),L=S("./src/controller/fragment-finders.ts"),R=S("./src/utils/discontinuities.ts"),_=S("./src/controller/level-helper.ts"),C=S("./src/controller/fragment-tracker.ts"),y=S("./src/controller/base-stream-controller.ts"),T=S("./src/types/loader.ts"),O=S("./src/types/level.ts");function x(i,p){for(var f=0;f<p.length;f++){var s=p[f];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(i,s.key,s)}}function v(i,p,f){return p&&x(i.prototype,p),f&&x(i,f),i}function g(i,p){i.prototype=Object.create(p.prototype),i.prototype.constructor=i,d(i,p)}function d(i,p){return d=Object.setPrototypeOf||function(s,m){return s.__proto__=m,s},d(i,p)}var t=500,o=function(i){g(p,i);function p(s,m){var l;return l=i.call(this,s,m,"[subtitle-stream-controller]")||this,l.levels=[],l.currentTrackId=-1,l.tracksBuffered=[],l.mainDetails=null,l._registerListeners(),l}var f=p.prototype;return f.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},f._registerListeners=function(){var m=this.hls;m.on(I.Events.MEDIA_ATTACHED,this.onMediaAttached,this),m.on(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),m.on(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),m.on(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),m.on(I.Events.ERROR,this.onError,this),m.on(I.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),m.on(I.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),m.on(I.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),m.on(I.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),m.on(I.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},f._unregisterListeners=function(){var m=this.hls;m.off(I.Events.MEDIA_ATTACHED,this.onMediaAttached,this),m.off(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),m.off(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),m.off(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),m.off(I.Events.ERROR,this.onError,this),m.off(I.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),m.off(I.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),m.off(I.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),m.off(I.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),m.off(I.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},f.startLoad=function(){this.stopLoad(),this.state=y.State.IDLE,this.setInterval(t),this.tick()},f.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},f.onLevelLoaded=function(m,l){this.mainDetails=l.details},f.onSubtitleFragProcessed=function(m,l){var a=l.frag,r=l.success;if(this.fragPrevious=a,this.state=y.State.IDLE,!r)return;var e=this.tracksBuffered[this.currentTrackId];if(!e)return;for(var n,c=a.start,h=0;h<e.length;h++)if(c>=e[h].start&&c<=e[h].end){n=e[h];break}var u=a.start+a.duration;n?n.end=u:(n={start:c,end:u},e.push(n)),this.fragmentTracker.fragBuffered(a)},f.onBufferFlushing=function(m,l){var a=l.startOffset,r=l.endOffset;if(a===0&&r!==Number.POSITIVE_INFINITY){var e=this.currentTrackId,n=this.levels;if(!n.length||!n[e]||!n[e].details)return;var c=n[e].details,h=c.targetduration,u=r-h;if(u<=0)return;l.endOffsetSubtitles=Math.max(0,u),this.tracksBuffered.forEach(function(b){for(var A=0;A<b.length;){if(b[A].end<=u){b.shift();continue}else if(b[A].start<u)b[A].start=u;else break;A++}}),this.fragmentTracker.removeFragmentsInRange(a,u,T.PlaylistLevelType.SUBTITLE)}},f.onError=function(m,l){var a,r=l.frag;if(!r||r.type!==T.PlaylistLevelType.SUBTITLE)return;(a=this.fragCurrent)!==null&&a!==void 0&&a.loader&&this.fragCurrent.loader.abort(),this.state=y.State.IDLE},f.onSubtitleTracksUpdated=function(m,l){var a=this,r=l.subtitleTracks;this.tracksBuffered=[],this.levels=r.map(function(e){return new O.Level(e)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(e){a.tracksBuffered[e.id]=[]}),this.mediaBuffer=null},f.onSubtitleTrackSwitch=function(m,l){if(this.currentTrackId=l.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var a=this.levels[this.currentTrackId];a!=null&&a.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,a&&this.setInterval(t)},f.onSubtitleTrackLoaded=function(m,l){var a,r=l.details,e=l.id,n=this.currentTrackId,c=this.levels;if(!c.length)return;var h=c[n];if(e>=c.length||e!==n||!h)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,r.live||(a=h.details)!==null&&a!==void 0&&a.live){var u=this.mainDetails;if(r.deltaUpdateFailed||!u)return;var b=u.fragments[0];if(!h.details)r.hasProgramDateTime&&u.hasProgramDateTime?Object(R.alignMediaPlaylistByPDT)(r,u):b&&Object(_.addSliding)(r,b.start);else{var A=this.alignPlaylists(r,h.details);A===0&&b&&Object(_.addSliding)(r,b.start)}}if(h.details=r,this.levelLastLoaded=e,this.tick(),r.live&&!this.fragCurrent&&this.media&&this.state===y.State.IDLE){var P=Object(L.findFragmentByPTS)(null,r.fragments,this.media.currentTime,0);P||(this.warn("Subtitle playlist not aligned with playback"),h.details=void 0)}},f._handleFragmentLoadComplete=function(m){var l=m.frag,a=m.payload,r=l.decryptdata,e=this.hls;if(this.fragContextChanged(l))return;if(a&&a.byteLength>0&&r&&r.key&&r.iv&&r.method==="AES-128"){var n=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(a),r.key.buffer,r.iv.buffer).then(function(c){var h=performance.now();e.trigger(I.Events.FRAG_DECRYPTED,{frag:l,payload:c,stats:{tstart:n,tdecrypt:h}})})}},f.doTick=function(){if(!this.media){this.state=y.State.IDLE;return}if(this.state===y.State.IDLE){var m,l=this.currentTrackId,a=this.levels;if(!a.length||!a[l]||!a[l].details)return;var r=a[l].details,e=r.targetduration,n=this.config,c=this.media,h=E.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,c.currentTime-e,n.maxBufferHole),u=h.end,b=h.len,A=this.getMaxBufferLength()+e;if(b>A)return;console.assert(r,"Subtitle track details are defined on idle subtitle stream controller tick");var P=r.fragments,w=P.length,U=r.edge,N,F=this.fragPrevious;if(u<U){var K=n.maxFragLookUpTolerance;F&&r.hasProgramDateTime&&(N=Object(L.findFragmentByPDT)(P,F.endProgramDateTime,K)),N||(N=Object(L.findFragmentByPTS)(F,P,u,K),!N&&F&&F.start<P[0].start&&(N=P[0]))}else N=P[w-1];(m=N)!==null&&m!==void 0&&m.encrypted?(D.logger.log("Loading key for "+N.sn),this.state=y.State.KEY_LOADING,this.hls.trigger(I.Events.KEY_LOADING,{frag:N})):N&&this.fragmentTracker.getState(N)===C.FragmentState.NOT_LOADED&&this.loadFragment(N,r,u)}},f.loadFragment=function(m,l,a){this.fragCurrent=m,i.prototype.loadFragment.call(this,m,l,a)},v(p,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),p}(y.default)},"./src/controller/subtitle-track-controller.ts":function(Y,M,S){"use strict";S.r(M);var I=S("./src/events.ts"),D=S("./src/utils/texttrack-utils.ts"),E=S("./src/controller/base-playlist-controller.ts"),L=S("./src/types/loader.ts");function R(x,v){for(var g=0;g<v.length;g++){var d=v[g];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(x,d.key,d)}}function _(x,v,g){return v&&R(x.prototype,v),g&&R(x,g),x}function C(x,v){x.prototype=Object.create(v.prototype),x.prototype.constructor=x,y(x,v)}function y(x,v){return y=Object.setPrototypeOf||function(d,t){return d.__proto__=t,d},y(x,v)}var T=function(x){C(v,x);function v(d){var t;return t=x.call(this,d,"[subtitle-track-controller]")||this,t.media=null,t.tracks=[],t.groupId=null,t.tracksInGroup=[],t.trackId=-1,t.selectDefaultTrack=!0,t.queuedDefaultTrack=-1,t.trackChangeListener=function(){return t.onTextTracksChanged()},t.asyncPollTrackChange=function(){return t.pollTrackChange(0)},t.useTextTrackPolling=!1,t.subtitlePollingInterval=-1,t.subtitleDisplay=!0,t.registerListeners(),t}var g=v.prototype;return g.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,x.prototype.destroy.call(this)},g.registerListeners=function(){var t=this.hls;t.on(I.Events.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.on(I.Events.MANIFEST_PARSED,this.onManifestParsed,this),t.on(I.Events.LEVEL_LOADING,this.onLevelLoading,this),t.on(I.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),t.on(I.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.on(I.Events.ERROR,this.onError,this)},g.unregisterListeners=function(){var t=this.hls;t.off(I.Events.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.off(I.Events.MANIFEST_PARSED,this.onManifestParsed,this),t.off(I.Events.LEVEL_LOADING,this.onLevelLoading,this),t.off(I.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),t.off(I.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.off(I.Events.ERROR,this.onError,this)},g.onMediaAttached=function(t,o){if(this.media=o.media,!this.media)return;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)},g.pollTrackChange=function(t){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,t)},g.onMediaDetaching=function(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId);var t=O(this.media.textTracks);t.forEach(function(o){Object(D.clearCurrentCues)(o)}),this.subtitleTrack=-1,this.media=null},g.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},g.onManifestParsed=function(t,o){this.tracks=o.subtitleTracks},g.onSubtitleTrackLoaded=function(t,o){var i=o.id,p=o.details,f=this.trackId,s=this.tracksInGroup[f];if(!s){this.warn("Invalid subtitle track id "+i);return}var m=s.details;s.details=o.details,this.log("subtitle track "+i+" loaded ["+p.startSN+"-"+p.endSN+"]"),i===this.trackId&&(this.retryCount=0,this.playlistLoaded(i,o,m))},g.onLevelLoading=function(t,o){this.switchLevel(o.level)},g.onLevelSwitching=function(t,o){this.switchLevel(o.level)},g.switchLevel=function(t){var o=this.hls.levels[t];if(!(o!=null&&o.textGroupIds))return;var i=o.textGroupIds[o.urlId];if(this.groupId!==i){var p=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,f=this.tracks.filter(function(l){return!i||l.groupId===i});this.tracksInGroup=f;var s=this.findTrackId(p==null?void 0:p.name)||this.findTrackId();this.groupId=i;var m={subtitleTracks:f};this.log("Updating subtitle tracks, "+f.length+' track(s) found in "'+i+'" group-id'),this.hls.trigger(I.Events.SUBTITLE_TRACKS_UPDATED,m),s!==-1&&this.setSubtitleTrack(s,p)}},g.findTrackId=function(t){for(var o=this.tracksInGroup,i=0;i<o.length;i++){var p=o[i];if((!this.selectDefaultTrack||p.default)&&(!t||t===p.name))return p.id}return-1},g.onError=function(t,o){if(x.prototype.onError.call(this,t,o),o.fatal||!o.context)return;o.context.type===L.PlaylistContextType.SUBTITLE_TRACK&&o.context.id===this.trackId&&o.context.groupId===this.groupId&&this.retryLoadingOrFail(o)},g.loadPlaylist=function(t){var o=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(o)){var i=o.id,p=o.groupId,f=o.url;if(t)try{f=t.addDirectives(f)}catch(s){this.warn("Could not construct new URL with HLS Delivery Directives: "+s)}this.log("Loading subtitle playlist for id "+i),this.hls.trigger(I.Events.SUBTITLE_TRACK_LOADING,{url:f,id:i,groupId:p,deliveryDirectives:t||null})}},g.toggleTrackModes=function(t){var o=this,i=this.media,p=this.subtitleDisplay,f=this.trackId;if(!i)return;var s=O(i.textTracks),m=s.filter(function(r){return r.groupId===o.groupId});if(t===-1)[].slice.call(s).forEach(function(r){r.mode="disabled"});else{var l=m[f];l&&(l.mode="disabled")}var a=m[t];a&&(a.mode=p?"showing":"hidden")},g.setSubtitleTrack=function(t,o){var i,p=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=t;return}if(this.trackId!==t&&this.toggleTrackModes(t),this.trackId===t&&(t===-1||(i=p[t])!==null&&i!==void 0&&i.details)||t<-1||t>=p.length)return;this.clearTimer();var f=p[t];if(this.log("Switching to subtitle track "+t),this.trackId=t,f){var s=f.id,m=f.groupId,l=m===void 0?"":m,a=f.name,r=f.type,e=f.url;this.hls.trigger(I.Events.SUBTITLE_TRACK_SWITCH,{id:s,groupId:l,name:a,type:r,url:e});var n=this.switchParams(f.url,o==null?void 0:o.details);this.loadPlaylist(n)}else this.hls.trigger(I.Events.SUBTITLE_TRACK_SWITCH,{id:t})},g.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var t=-1,o=O(this.media.textTracks),i=0;i<o.length;i++)if(o[i].mode==="hidden")t=i;else if(o[i].mode==="showing"){t=i;break}this.subtitleTrack!==t&&(this.subtitleTrack=t)},_(v,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(t){this.selectDefaultTrack=!1;var o=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(t,o)}}]),v}(E.default);function O(x){for(var v=[],g=0;g<x.length;g++){var d=x[g];d.kind==="subtitles"&&d.label&&v.push(x[g])}return v}M.default=T},"./src/controller/timeline-controller.ts":function(Y,M,S){"use strict";S.r(M),S.d(M,"TimelineController",function(){return O});var I=S("./src/polyfills/number.ts"),D=S("./src/events.ts"),E=S("./src/utils/cea-608-parser.ts"),L=S("./src/utils/output-filter.ts"),R=S("./src/utils/webvtt-parser.ts"),_=S("./src/utils/texttrack-utils.ts"),C=S("./src/utils/imsc1-ttml-parser.ts"),y=S("./src/types/loader.ts"),T=S("./src/utils/logger.ts"),O=function(){function d(o){if(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.timescale=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=g(),this.captionsProperties=void 0,this.hls=o,this.config=o.config,this.Cues=o.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}},this.config.enableCEA708Captions){var i=new L.default(this,"textTrack1"),p=new L.default(this,"textTrack2"),f=new L.default(this,"textTrack3"),s=new L.default(this,"textTrack4");this.cea608Parser1=new E.default(1,i,p),this.cea608Parser2=new E.default(3,f,s)}o.on(D.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.on(D.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(D.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(D.Events.MANIFEST_LOADED,this.onManifestLoaded,this),o.on(D.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),o.on(D.Events.FRAG_LOADING,this.onFragLoading,this),o.on(D.Events.FRAG_LOADED,this.onFragLoaded,this),o.on(D.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),o.on(D.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),o.on(D.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),o.on(D.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),o.on(D.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var t=d.prototype;return t.destroy=function(){var i=this.hls;i.off(D.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),i.off(D.Events.MEDIA_DETACHING,this.onMediaDetaching,this),i.off(D.Events.MANIFEST_LOADING,this.onManifestLoading,this),i.off(D.Events.MANIFEST_LOADED,this.onManifestLoaded,this),i.off(D.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),i.off(D.Events.FRAG_LOADING,this.onFragLoading,this),i.off(D.Events.FRAG_LOADED,this.onFragLoaded,this),i.off(D.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),i.off(D.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),i.off(D.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),i.off(D.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),i.off(D.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},t.addCues=function(i,p,f,s,m){for(var l=!1,a=m.length;a--;){var r=m[a],e=v(r[0],r[1],p,f);if(e>=0&&(r[0]=Math.min(r[0],p),r[1]=Math.max(r[1],f),l=!0,e/(f-p)>.5))return}if(l||m.push([p,f]),this.config.renderTextTracksNatively){var n=this.captionsTracks[i];this.Cues.newCue(n,p,f,s)}else{var c=this.Cues.newCue(null,p,f,s);this.hls.trigger(D.Events.CUES_PARSED,{type:"captions",cues:c,track:i})}},t.onInitPtsFound=function(i,p){var f=this,s=p.frag,m=p.id,l=p.initPTS,a=p.timescale,r=this.unparsedVttFrags;m==="main"&&(this.initPTS[s.cc]=l,this.timescale[s.cc]=a),r.length&&(this.unparsedVttFrags=[],r.forEach(function(e){f.onFragLoaded(D.Events.FRAG_LOADED,e)}))},t.getExistingTrack=function(i){var p=this.media;if(p)for(var f=0;f<p.textTracks.length;f++){var s=p.textTracks[f];if(s[i])return s}return null},t.createCaptionsTrack=function(i){this.config.renderTextTracksNatively?this.createNativeTrack(i):this.createNonNativeTrack(i)},t.createNativeTrack=function(i){if(this.captionsTracks[i])return;var p=this.captionsProperties,f=this.captionsTracks,s=this.media,m=p[i],l=m.label,a=m.languageCode,r=this.getExistingTrack(i);if(r)f[i]=r,Object(_.clearCurrentCues)(f[i]),Object(_.sendAddTrackEvent)(f[i],s);else{var e=this.createTextTrack("captions",l,a);e&&(e[i]=!0,f[i]=e)}},t.createNonNativeTrack=function(i){if(this.nonNativeCaptionsTracks[i])return;var p=this.captionsProperties[i];if(!p)return;var f=p.label,s={_id:i,label:f,kind:"captions",default:p.media?!!p.media.default:!1,closedCaptions:p.media};this.nonNativeCaptionsTracks[i]=s,this.hls.trigger(D.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[s]})},t.createTextTrack=function(i,p,f){var s=this.media;return s?s.addTextTrack(i,p,f):void 0},t.onMediaAttaching=function(i,p){this.media=p.media,this._cleanTracks()},t.onMediaDetaching=function(){var i=this.captionsTracks;Object.keys(i).forEach(function(p){Object(_.clearCurrentCues)(i[p]),delete i[p]}),this.nonNativeCaptionsTracks={}},t.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=g(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=[],this.timescale=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},t._cleanTracks=function(){var i=this.media;if(!i)return;var p=i.textTracks;if(p)for(var f=0;f<p.length;f++)Object(_.clearCurrentCues)(p[f])},t.onSubtitleTracksUpdated=function(i,p){var f=this;this.textTracks=[];var s=p.subtitleTracks||[],m=s.some(function(e){return e.textCodec===C.IMSC1_CODEC});if(this.config.enableWebVTT||m&&this.config.enableIMSC1){var l=this.tracks&&s&&this.tracks.length===s.length;if(this.tracks=s||[],this.config.renderTextTracksNatively){var a=this.media?this.media.textTracks:[];this.tracks.forEach(function(e,n){var c;if(n<a.length){for(var h=null,u=0;u<a.length;u++)if(x(a[u],e)){h=a[u];break}h&&(c=h)}c?Object(_.clearCurrentCues)(c):(c=f.createTextTrack("subtitles",e.name,e.lang),c&&(c.mode="disabled")),c&&(c.groupId=e.groupId,f.textTracks.push(c))})}else if(!l&&this.tracks&&this.tracks.length){var r=this.tracks.map(function(e){return{label:e.name,kind:e.type.toLowerCase(),default:e.default,subtitleTrack:e}});this.hls.trigger(D.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:r})}}},t.onManifestLoaded=function(i,p){var f=this;this.config.enableCEA708Captions&&p.captions&&p.captions.forEach(function(s){var m=/(?:CC|SERVICE)([1-4])/.exec(s.instreamId);if(!m)return;var l="textTrack"+m[1],a=f.captionsProperties[l];if(!a)return;a.label=s.name,s.lang&&(a.languageCode=s.lang),a.media=s})},t.onFragLoading=function(i,p){var f=this.cea608Parser1,s=this.cea608Parser2,m=this.lastSn,l=this.lastPartIndex;if(!this.enabled||!(f&&s))return;if(p.frag.type===y.PlaylistLevelType.MAIN){var a,r,e=p.frag.sn,n=(a=p==null||((r=p.part)===null||r===void 0)?void 0:r.index)!=null?a:-1;e===m+1||e===m&&n===l+1||(f.reset(),s.reset()),this.lastSn=e,this.lastPartIndex=n}},t.onFragLoaded=function(i,p){var f=p.frag,s=p.payload,m=this.initPTS,l=this.unparsedVttFrags;if(f.type===y.PlaylistLevelType.SUBTITLE)if(s.byteLength){if(!Object(I.isFiniteNumber)(m[f.cc])){l.push(p),m.length&&this.hls.trigger(D.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:f,error:new Error("Missing initial subtitle PTS")});return}var a=f.decryptdata;if(a==null||a.key==null||a.method!=="AES-128"){var r=this.tracks[f.level],e=this.vttCCs;e[f.cc]||(e[f.cc]={start:f.start,prevCC:this.prevCC,new:!0},this.prevCC=f.cc),r&&r.textCodec===C.IMSC1_CODEC?this._parseIMSC1(f,s):this._parseVTTs(f,s,e)}}else this.hls.trigger(D.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:f,error:new Error("Empty subtitle payload")})},t._parseIMSC1=function(i,p){var f=this,s=this.hls;Object(C.parseIMSC1)(p,this.initPTS[i.cc],this.timescale[i.cc],function(m){f._appendCues(m,i.level),s.trigger(D.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:i})},function(m){T.logger.log("Failed to parse IMSC1: "+m),s.trigger(D.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:m})})},t._parseVTTs=function(i,p,f){var s=this,m=this.hls;Object(R.parseWebVTT)(p,this.initPTS[i.cc],this.timescale[i.cc],f,i.cc,i.start,function(l){s._appendCues(l,i.level),m.trigger(D.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:i})},function(l){s._fallbackToIMSC1(i,p),T.logger.log("Failed to parse VTT cue: "+l),m.trigger(D.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:l})})},t._fallbackToIMSC1=function(i,p){var f=this,s=this.tracks[i.level];s.textCodec||Object(C.parseIMSC1)(p,this.initPTS[i.cc],this.timescale[i.cc],function(){s.textCodec=C.IMSC1_CODEC,f._parseIMSC1(i,p)},function(){s.textCodec="wvtt"})},t._appendCues=function(i,p){var f=this.hls;if(this.config.renderTextTracksNatively){var s=this.textTracks[p];if(s.mode==="disabled")return;i.forEach(function(a){return Object(_.addCueToTrack)(s,a)})}else{var m=this.tracks[p],l=m.default?"default":"subtitles"+p;f.trigger(D.Events.CUES_PARSED,{type:"subtitles",cues:i,track:l})}},t.onFragDecrypted=function(i,p){var f=p.frag;if(f.type===y.PlaylistLevelType.SUBTITLE){if(!Object(I.isFiniteNumber)(this.initPTS[f.cc])){this.unparsedVttFrags.push(p);return}this.onFragLoaded(D.Events.FRAG_LOADED,p)}},t.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},t.onFragParsingUserdata=function(i,p){var f=this.cea608Parser1,s=this.cea608Parser2;if(!this.enabled||!(f&&s))return;for(var m=0;m<p.samples.length;m++){var l=p.samples[m].bytes;if(l){var a=this.extractCea608Data(l);f.addData(p.samples[m].pts,a[0]),s.addData(p.samples[m].pts,a[1])}}},t.onBufferFlushing=function(i,p){var f=p.startOffset,s=p.endOffset,m=p.endOffsetSubtitles,l=p.type,a=this.media;if(!a||a.currentTime<s)return;if(!l||l==="video"){var r=this.captionsTracks;Object.keys(r).forEach(function(n){return Object(_.removeCuesInRange)(r[n],f,s)})}if(this.config.renderTextTracksNatively&&(f===0&&m!==void 0)){var e=this.textTracks;Object.keys(e).forEach(function(n){return Object(_.removeCuesInRange)(e[n],f,m)})}},t.extractCea608Data=function(i){for(var p=i[0]&31,f=2,s=[[],[]],m=0;m<p;m++){var l=i[f++],a=127&i[f++],r=127&i[f++],e=(4&l)!==0,n=3&l;if(a===0&&r===0)continue;e&&((n===0||n===1)&&(s[n].push(a),s[n].push(r)))}return s},d}();function x(d,t){return d&&d.label===t.name&&!(d.textTrack1||d.textTrack2)}function v(d,t,o,i){return Math.min(t,i)-Math.max(d,o)}function g(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(Y,M,S){"use strict";S.r(M),S.d(M,"default",function(){return I});var I=function(){function D(L,R){this.subtle=void 0,this.aesIV=void 0,this.subtle=L,this.aesIV=R}var E=D.prototype;return E.decrypt=function(R,_){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},_,R)},D}()},"./src/crypt/aes-decryptor.ts":function(Y,M,S){"use strict";S.r(M),S.d(M,"removePadding",function(){return D}),S.d(M,"default",function(){return E});var I=S("./src/utils/typed-array.ts");function D(L){var R=L.byteLength,_=R&&new DataView(L.buffer).getUint8(R-1);return _?Object(I.sliceUint8)(L,0,R-_):L}var E=function(){function L(){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()}var R=L.prototype;return R.uint8ArrayToUint32Array_=function(C){for(var y=new DataView(C),T=new Uint32Array(4),O=0;O<4;O++)T[O]=y.getUint32(O*4);return T},R.initTable=function(){var C=this.sBox,y=this.invSBox,T=this.subMix,O=T[0],x=T[1],v=T[2],g=T[3],d=this.invSubMix,t=d[0],o=d[1],i=d[2],p=d[3],f=new Uint32Array(256),s=0,m=0,l=0;for(l=0;l<256;l++)l<128?f[l]=l<<1:f[l]=l<<1^283;for(l=0;l<256;l++){var a=m^m<<1^m<<2^m<<3^m<<4;a=a>>>8^a&255^99,C[s]=a,y[a]=s;var r=f[s],e=f[r],n=f[e],c=f[a]*257^a*16843008;O[s]=c<<24|c>>>8,x[s]=c<<16|c>>>16,v[s]=c<<8|c>>>24,g[s]=c,c=n*16843009^e*65537^r*257^s*16843008,t[a]=c<<24|c>>>8,o[a]=c<<16|c>>>16,i[a]=c<<8|c>>>24,p[a]=c,s?(s=r^f[f[f[n^r]]],m^=f[f[m]]):s=m=1}},R.expandKey=function(C){for(var y=this.uint8ArrayToUint32Array_(C),T=!0,O=0;O<y.length&&T;)T=y[O]===this.key[O],O++;if(T)return;this.key=y;var x=this.keySize=y.length;if(x!==4&&x!==6&&x!==8)throw new Error("Invalid aes key size="+x);var v=this.ksRows=(x+6+1)*4,g,d,t=this.keySchedule=new Uint32Array(v),o=this.invKeySchedule=new Uint32Array(v),i=this.sBox,p=this.rcon,f=this.invSubMix,s=f[0],m=f[1],l=f[2],a=f[3],r,e;for(g=0;g<v;g++){if(g<x){r=t[g]=y[g];continue}e=r,g%x===0?(e=e<<8|e>>>24,e=i[e>>>24]<<24|i[e>>>16&255]<<16|i[e>>>8&255]<<8|i[e&255],e^=p[g/x|0]<<24):x>6&&g%x===4&&(e=i[e>>>24]<<24|i[e>>>16&255]<<16|i[e>>>8&255]<<8|i[e&255]),t[g]=r=(t[g-x]^e)>>>0}for(d=0;d<v;d++)g=v-d,d&3?e=t[g]:e=t[g-4],d<4||g<=4?o[d]=e:o[d]=s[i[e>>>24]]^m[i[e>>>16&255]]^l[i[e>>>8&255]]^a[i[e&255]],o[d]=o[d]>>>0},R.networkToHostOrderSwap=function(C){return C<<24|(C&65280)<<8|(C&16711680)>>8|C>>>24},R.decrypt=function(C,y,T){for(var O=this.keySize+6,x=this.invKeySchedule,v=this.invSBox,g=this.invSubMix,d=g[0],t=g[1],o=g[2],i=g[3],p=this.uint8ArrayToUint32Array_(T),f=p[0],s=p[1],m=p[2],l=p[3],a=new Int32Array(C),r=new Int32Array(a.length),e,n,c,h,u,b,A,P,w,U,N,F,K,$,X=this.networkToHostOrderSwap;y<a.length;){for(w=X(a[y]),U=X(a[y+1]),N=X(a[y+2]),F=X(a[y+3]),u=w^x[0],b=F^x[1],A=N^x[2],P=U^x[3],K=4,$=1;$<O;$++)e=d[u>>>24]^t[b>>16&255]^o[A>>8&255]^i[P&255]^x[K],n=d[b>>>24]^t[A>>16&255]^o[P>>8&255]^i[u&255]^x[K+1],c=d[A>>>24]^t[P>>16&255]^o[u>>8&255]^i[b&255]^x[K+2],h=d[P>>>24]^t[u>>16&255]^o[b>>8&255]^i[A&255]^x[K+3],u=e,b=n,A=c,P=h,K=K+4;e=v[u>>>24]<<24^v[b>>16&255]<<16^v[A>>8&255]<<8^v[P&255]^x[K],n=v[b>>>24]<<24^v[A>>16&255]<<16^v[P>>8&255]<<8^v[u&255]^x[K+1],c=v[A>>>24]<<24^v[P>>16&255]<<16^v[u>>8&255]<<8^v[b&255]^x[K+2],h=v[P>>>24]<<24^v[u>>16&255]<<16^v[b>>8&255]<<8^v[A&255]^x[K+3],r[y]=X(e^f),r[y+1]=X(h^s),r[y+2]=X(c^m),r[y+3]=X(n^l),f=w,s=U,m=N,l=F,y=y+4}return r.buffer},L}()},"./src/crypt/decrypter.ts":function(Y,M,S){"use strict";S.r(M),S.d(M,"default",function(){return y});var I=S("./src/crypt/aes-crypto.ts"),D=S("./src/crypt/fast-aes-key.ts"),E=S("./src/crypt/aes-decryptor.ts"),L=S("./src/utils/logger.ts"),R=S("./src/utils/mp4-tools.ts"),_=S("./src/utils/typed-array.ts"),C=16,y=function(){function T(x,v,g){var d=g===void 0?{}:g,t=d.removePKCS7Padding,o=t===void 0?!0:t;if(this.logEnabled=!0,this.observer=void 0,this.config=void 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.observer=x,this.config=v,this.removePKCS7Padding=o,o)try{var i=self.crypto;i&&(this.subtle=i.subtle||i.webkitSubtle)}catch(p){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var O=T.prototype;return O.destroy=function(){this.observer=null},O.isSync=function(){return this.config.enableSoftwareAES},O.flush=function(){var v=this.currentResult;if(!v){this.reset();return}var g=new Uint8Array(v);return this.reset(),this.removePKCS7Padding?Object(E.removePadding)(g):g},O.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},O.decrypt=function(v,g,d,t){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(v),g,d);var o=this.flush();o&&t(o.buffer)}else this.webCryptoDecrypt(new Uint8Array(v),g,d).then(t)},O.softwareDecrypt=function(v,g,d){var t=this.currentIV,o=this.currentResult,i=this.remainderData;this.logOnce("JS AES decrypt"),i&&(v=Object(R.appendUint8Array)(i,v),this.remainderData=null);var p=this.getValidChunk(v);if(!p.length)return null;t&&(d=t);var f=this.softwareDecrypter;f||(f=this.softwareDecrypter=new E.default),f.expandKey(g);var s=o;return this.currentResult=f.decrypt(p.buffer,0,d),this.currentIV=Object(_.sliceUint8)(p,-16).buffer,s||null},O.webCryptoDecrypt=function(v,g,d){var t=this,o=this.subtle;return(this.key!==g||!this.fastAesKey)&&(this.key=g,this.fastAesKey=new D.default(o,g)),this.fastAesKey.expandKey().then(function(i){if(!o)return Promise.reject(new Error("web crypto not initialized"));var p=new I.default(o,d);return p.decrypt(v.buffer,i)}).catch(function(i){return t.onWebCryptoError(i,v,g,d)})},O.onWebCryptoError=function(v,g,d,t){return L.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",v),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(g,d,t)},O.getValidChunk=function(v){var g=v,d=v.length-v.length%C;return d!==v.length&&(g=Object(_.sliceUint8)(v,0,d),this.remainderData=Object(_.sliceUint8)(v,d)),g},O.logOnce=function(v){if(!this.logEnabled)return;L.logger.log("[decrypter.ts]: "+v),this.logEnabled=!1},T}()},"./src/crypt/fast-aes-key.ts":function(Y,M,S){"use strict";S.r(M),S.d(M,"default",function(){return I});var I=function(){function D(L,R){this.subtle=void 0,this.key=void 0,this.subtle=L,this.key=R}var E=D.prototype;return E.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},D}()},"./src/demux/aacdemuxer.ts":function(Y,M,S){"use strict";S.r(M);var I=S("./src/demux/base-audio-demuxer.ts"),D=S("./src/demux/adts.ts"),E=S("./src/utils/logger.ts"),L=S("./src/demux/id3.ts");function R(y,T){y.prototype=Object.create(T.prototype),y.prototype.constructor=y,_(y,T)}function _(y,T){return _=Object.setPrototypeOf||function(x,v){return x.__proto__=v,x},_(y,T)}var C=function(y){R(T,y);function T(x,v){var g;return g=y.call(this)||this,g.observer=void 0,g.config=void 0,g.observer=x,g.config=v,g}var O=T.prototype;return O.resetInitSegment=function(v,g,d){y.prototype.resetInitSegment.call(this,v,g,d),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:v,duration:d,inputTimeScale:9e4,dropped:0}},T.probe=function(v){if(!v)return!1;for(var g=L.getID3Data(v,0)||[],d=g.length,t=v.length;d<t;d++)if(D.probe(v,d))return E.logger.log("ADTS sync word found !"),!0;return!1},O.canParse=function(v,g){return D.canParse(v,g)},O.appendFrame=function(v,g,d){D.initTrackConfig(v,this.observer,g,d,v.manifestCodec);var t=D.appendFrame(v,g,d,this.initPTS,this.frameIndex);if(t&&t.missing===0)return t},T}(I.default);C.minProbeByteLength=9,M.default=C},"./src/demux/adts.ts":function(Y,M,S){"use strict";S.r(M),S.d(M,"getAudioConfig",function(){return L}),S.d(M,"isHeaderPattern",function(){return R}),S.d(M,"getHeaderLength",function(){return _}),S.d(M,"getFullFrameLength",function(){return C}),S.d(M,"canGetFrameLength",function(){return y}),S.d(M,"isHeader",function(){return T}),S.d(M,"canParse",function(){return O}),S.d(M,"probe",function(){return x}),S.d(M,"initTrackConfig",function(){return v}),S.d(M,"getFrameDuration",function(){return g}),S.d(M,"parseFrameHeader",function(){return d}),S.d(M,"appendFrame",function(){return t});var I=S("./src/utils/logger.ts"),D=S("./src/errors.ts"),E=S("./src/events.ts");function L(o,i,p,f){var s,m,l,a,r=navigator.userAgent.toLowerCase(),e=f,n=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];s=((i[p+2]&192)>>>6)+1;var c=(i[p+2]&60)>>>2;if(c>n.length-1){o.trigger(E.Events.ERROR,{type:D.ErrorTypes.MEDIA_ERROR,details:D.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+c});return}return l=(i[p+2]&1)<<2,l|=(i[p+3]&192)>>>6,I.logger.log("manifest codec:"+f+", ADTS type:"+s+", samplingIndex:"+c),/firefox/i.test(r)?c>=6?(s=5,a=new Array(4),m=c-3):(s=2,a=new Array(2),m=c):r.indexOf("android")!==-1?(s=2,a=new Array(2),m=c):(s=5,a=new Array(4),f&&(f.indexOf("mp4a.40.29")!==-1||f.indexOf("mp4a.40.5")!==-1)||!f&&c>=6?m=c-3:((f&&f.indexOf("mp4a.40.2")!==-1&&(c>=6&&l===1||/vivaldi/i.test(r))||!f&&l===1)&&(s=2,a=new Array(2)),m=c)),a[0]=s<<3,a[0]|=(c&14)>>1,a[1]|=(c&1)<<7,a[1]|=l<<3,s===5&&(a[1]|=(m&14)>>1,a[2]=(m&1)<<7,a[2]|=2<<2,a[3]=0),{config:a,samplerate:n[c],channelCount:l,codec:"mp4a.40."+s,manifestCodec:e}}function R(o,i){return o[i]===255&&(o[i+1]&246)===240}function _(o,i){return o[i+1]&1?7:9}function C(o,i){return(o[i+3]&3)<<11|o[i+4]<<3|(o[i+5]&224)>>>5}function y(o,i){return i+5<o.length}function T(o,i){return i+1<o.length&&R(o,i)}function O(o,i){return y(o,i)&&R(o,i)&&C(o,i)<=o.length-i}function x(o,i){if(T(o,i)){var p=_(o,i);if(i+p>=o.length)return!1;var f=C(o,i);if(f<=p)return!1;var s=i+f;return s===o.length||T(o,s)}return!1}function v(o,i,p,f,s){if(!o.samplerate){var m=L(i,p,f,s);if(!m)return;o.config=m.config,o.samplerate=m.samplerate,o.channelCount=m.channelCount,o.codec=m.codec,o.manifestCodec=m.manifestCodec,I.logger.log("parsed codec:"+o.codec+", rate:"+m.samplerate+", channels:"+m.channelCount)}}function g(o){return 1024*9e4/o}function d(o,i,p,f,s){var m=_(o,i),l=C(o,i);if(l-=m,l>0){var a=p+f*s;return{headerLength:m,frameLength:l,stamp:a}}}function t(o,i,p,f,s){var m=g(o.samplerate),l=d(i,p,f,s,m);if(l){var a=l.frameLength,r=l.headerLength,e=l.stamp,n=r+a,c=Math.max(0,p+n-i.length),h;c?(h=new Uint8Array(n-r),h.set(i.subarray(p+r,i.length),0)):h=i.subarray(p+r,p+n);var u={unit:h,pts:e};return c||o.samples.push(u),{sample:u,length:n,missing:c}}}},"./src/demux/base-audio-demuxer.ts":function(Y,M,S){"use strict";S.r(M),S.d(M,"initPTSFn",function(){return C});var I=S("./src/polyfills/number.ts"),D=S("./src/demux/id3.ts"),E=S("./src/demux/dummy-demuxed-track.ts"),L=S("./src/utils/mp4-tools.ts"),R=S("./src/utils/typed-array.ts"),_=function(){function y(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var T=y.prototype;return T.resetInitSegment=function(x,v,g){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},T.resetTimeStamp=function(){},T.resetContiguity=function(){},T.canParse=function(x,v){return!1},T.appendFrame=function(x,v,g){},T.demux=function(x,v){this.cachedData&&(x=Object(L.appendUint8Array)(this.cachedData,x),this.cachedData=null);var g=D.getID3Data(x,0),d=g?g.length:0,t,o,i=this._audioTrack,p=this._id3Track,f=g?D.getTimeStamp(g):void 0,s=x.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=C(f,v)),g&&g.length>0&&p.samples.push({pts:this.initPTS,dts:this.initPTS,data:g}),o=this.initPTS;d<s;){if(this.canParse(x,d)){var m=this.appendFrame(i,x,d);m?(this.frameIndex++,o=m.sample.pts,d+=m.length,t=d):d=s}else D.canParse(x,d)?(g=D.getID3Data(x,d),p.samples.push({pts:o,dts:o,data:g}),d+=g.length,t=d):d++;if(d===s&&t!==s){var l=Object(R.sliceUint8)(x,t);this.cachedData?this.cachedData=Object(L.appendUint8Array)(this.cachedData,l):this.cachedData=l}}return{audioTrack:i,avcTrack:Object(E.dummyTrack)(),id3Track:p,textTrack:Object(E.dummyTrack)()}},T.demuxSampleAes=function(x,v,g){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},T.flush=function(x){var v=this.cachedData;return v&&(this.cachedData=null,this.demux(v,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(E.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(E.dummyTrack)()}},T.destroy=function(){},y}(),C=function(T,O){return Object(I.isFiniteNumber)(T)?T*90:O*9e4};M.default=_},"./src/demux/chunk-cache.ts":function(Y,M,S){"use strict";S.r(M),S.d(M,"default",function(){return I});var I=function(){function E(){this.chunks=[],this.dataLength=0}var L=E.prototype;return L.push=function(_){this.chunks.push(_),this.dataLength+=_.length},L.flush=function(){var _=this.chunks,C=this.dataLength,y;if(_.length)_.length===1?y=_[0]:y=D(_,C);else return new Uint8Array(0);return this.reset(),y},L.reset=function(){this.chunks.length=0,this.dataLength=0},E}();function D(E,L){for(var R=new Uint8Array(L),_=0,C=0;C<E.length;C++){var y=E[C];R.set(y,_),_+=y.length}return R}},"./src/demux/dummy-demuxed-track.ts":function(Y,M,S){"use strict";S.r(M),S.d(M,"dummyTrack",function(){return I});function I(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(Y,M,S){"use strict";S.r(M);var I=S("./src/utils/logger.ts"),D=function(){function E(R){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=R,this.bytesAvailable=R.byteLength,this.word=0,this.bitsAvailable=0}var L=E.prototype;return L.loadWord=function(){var _=this.data,C=this.bytesAvailable,y=_.byteLength-C,T=new Uint8Array(4),O=Math.min(4,C);if(O===0)throw new Error("no bytes available");T.set(_.subarray(y,y+O)),this.word=new DataView(T.buffer).getUint32(0),this.bitsAvailable=O*8,this.bytesAvailable-=O},L.skipBits=function(_){var C;this.bitsAvailable>_?(this.word<<=_,this.bitsAvailable-=_):(_-=this.bitsAvailable,C=_>>3,_-=C>>3,this.bytesAvailable-=C,this.loadWord(),this.word<<=_,this.bitsAvailable-=_)},L.readBits=function(_){var C=Math.min(this.bitsAvailable,_),y=this.word>>>32-C;return _>32&&I.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=C,this.bitsAvailable>0?this.word<<=C:this.bytesAvailable>0&&this.loadWord(),C=_-C,C>0&&this.bitsAvailable?y<<C|this.readBits(C):y},L.skipLZ=function(){var _;for(_=0;_<this.bitsAvailable;++_)if((this.word&2147483648>>>_)!==0)return this.word<<=_,this.bitsAvailable-=_,_;return this.loadWord(),_+this.skipLZ()},L.skipUEG=function(){this.skipBits(1+this.skipLZ())},L.skipEG=function(){this.skipBits(1+this.skipLZ())},L.readUEG=function(){var _=this.skipLZ();return this.readBits(_+1)-1},L.readEG=function(){var _=this.readUEG();return 1&_?1+_>>>1:-1*(_>>>1)},L.readBoolean=function(){return this.readBits(1)===1},L.readUByte=function(){return this.readBits(8)},L.readUShort=function(){return this.readBits(16)},L.readUInt=function(){return this.readBits(32)},L.skipScalingList=function(_){for(var C=8,y=8,T,O=0;O<_;O++)y!==0&&(T=this.readEG(),y=(C+T+256)%256),C=y===0?C:y},L.readSPS=function(){var _=0,C=0,y=0,T=0,O,x,v,g=this.readUByte.bind(this),d=this.readBits.bind(this),t=this.readUEG.bind(this),o=this.readBoolean.bind(this),i=this.skipBits.bind(this),p=this.skipEG.bind(this),f=this.skipUEG.bind(this),s=this.skipScalingList.bind(this);g();var m=g();if(d(5),i(3),g(),f(),m===100||m===110||m===122||m===244||m===44||m===83||m===86||m===118||m===128){var l=t();if(l===3&&i(1),f(),f(),i(1),o())for(x=l!==3?8:12,v=0;v<x;v++)o()&&(v<6?s(16):s(64))}f();var a=t();if(a===0)t();else if(a===1)for(i(1),p(),p(),O=t(),v=0;v<O;v++)p();f(),i(1);var r=t(),e=t(),n=d(1);n===0&&i(1),i(1),o()&&(_=t(),C=t(),y=t(),T=t());var c=[1,1];if(o()&&o()){var h=g();switch(h){case 1:c=[1,1];break;case 2:c=[12,11];break;case 3:c=[10,11];break;case 4:c=[16,11];break;case 5:c=[40,33];break;case 6:c=[24,11];break;case 7:c=[20,11];break;case 8:c=[32,11];break;case 9:c=[80,33];break;case 10:c=[18,11];break;case 11:c=[15,11];break;case 12:c=[64,33];break;case 13:c=[160,99];break;case 14:c=[4,3];break;case 15:c=[3,2];break;case 16:c=[2,1];break;case 255:{c=[g()<<8|g(),g()<<8|g()];break}}}return{width:Math.ceil((r+1)*16-_*2-C*2),height:(2-n)*(e+1)*16-(n?2:4)*(y+T),pixelRatio:c}},L.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},E}();M.default=D},"./src/demux/id3.ts":function(Y,M,S){"use strict";S.r(M),S.d(M,"isHeader",function(){return I}),S.d(M,"isFooter",function(){return D}),S.d(M,"getID3Data",function(){return E}),S.d(M,"canParse",function(){return R}),S.d(M,"getTimeStamp",function(){return _}),S.d(M,"isTimeStampFrame",function(){return C}),S.d(M,"getID3Frames",function(){return T}),S.d(M,"decodeFrame",function(){return O}),S.d(M,"utf8ArrayToStr",function(){return t}),S.d(M,"testables",function(){return o});var I=function(s,m){return m+10<=s.length&&(s[m]===73&&s[m+1]===68&&s[m+2]===51&&(s[m+3]<255&&s[m+4]<255&&(s[m+6]<128&&s[m+7]<128&&s[m+8]<128&&s[m+9]<128)))},D=function(s,m){return m+10<=s.length&&(s[m]===51&&s[m+1]===68&&s[m+2]===73&&(s[m+3]<255&&s[m+4]<255&&(s[m+6]<128&&s[m+7]<128&&s[m+8]<128&&s[m+9]<128)))},E=function(s,m){for(var l=m,a=0;I(s,m);){a+=10;var r=L(s,m+6);a+=r,D(s,m+10)&&(a+=10),m+=a}return a>0?s.subarray(l,l+a):void 0},L=function(s,m){var l=0;return l=(s[m]&127)<<21,l|=(s[m+1]&127)<<14,l|=(s[m+2]&127)<<7,l|=s[m+3]&127,l},R=function(s,m){return I(s,m)&&L(s,m+6)+10<=s.length-m},_=function(s){for(var m=T(s),l=0;l<m.length;l++){var a=m[l];if(C(a))return d(a)}return},C=function(s){return s&&s.key==="PRIV"&&s.info==="com.apple.streaming.transportStreamTimestamp"},y=function(s){var m=String.fromCharCode(s[0],s[1],s[2],s[3]),l=L(s,4),a=10;return{type:m,size:l,data:s.subarray(a,a+l)}},T=function(s){for(var m=0,l=[];I(s,m);){var a=L(s,m+6);m+=10;for(var r=m+a;m+8<r;){var e=y(s.subarray(m)),n=O(e);n&&l.push(n),m+=e.size+10}D(s,m)&&(m+=10)}return l},O=function(s){return s.type==="PRIV"?x(s):s.type[0]==="W"?g(s):v(s)},x=function(s){if(s.size<2)return;var m=t(s.data,!0),l=new Uint8Array(s.data.subarray(m.length+1));return{key:s.type,info:m,data:l.buffer}},v=function(s){if(s.size<2)return;if(s.type==="TXXX"){var m=1,l=t(s.data.subarray(m),!0);m+=l.length+1;var a=t(s.data.subarray(m));return{key:s.type,info:l,data:a}}var r=t(s.data.subarray(1));return{key:s.type,data:r}},g=function(s){if(s.type==="WXXX"){if(s.size<2)return;var m=1,l=t(s.data.subarray(m),!0);m+=l.length+1;var a=t(s.data.subarray(m));return{key:s.type,info:l,data:a}}var r=t(s.data);return{key:s.type,data:r}},d=function(s){if(s.data.byteLength===8){var m=new Uint8Array(s.data),l=m[3]&1,a=(m[4]<<23)+(m[5]<<15)+(m[6]<<7)+m[7];return a/=45,l&&(a+=4772185884e-2),Math.round(a)}return},t=function(s,m){m===void 0&&(m=!1);var l=p();if(l){var a=l.decode(s);if(m){var r=a.indexOf("\0");return r!==-1?a.substring(0,r):a}return a.replace(/\0/g,"")}for(var e=s.length,n,c,h,u="",b=0;b<e;){if(n=s[b++],n===0&&m)return u;if(n===0||n===3)continue;switch(n>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:u+=String.fromCharCode(n);break;case 12:case 13:c=s[b++],u+=String.fromCharCode((n&31)<<6|c&63);break;case 14:c=s[b++],h=s[b++],u+=String.fromCharCode((n&15)<<12|(c&63)<<6|(h&63)<<0);break;default:}}return u},o={decodeTextFrame:v},i;function p(){return!i&&typeof self.TextDecoder!="undefined"&&(i=new self.TextDecoder("utf-8")),i}},"./src/demux/mp3demuxer.ts":function(Y,M,S){"use strict";S.r(M);var I=S("./src/demux/base-audio-demuxer.ts"),D=S("./src/demux/id3.ts"),E=S("./src/utils/logger.ts"),L=S("./src/demux/mpegaudio.ts");function R(y,T){y.prototype=Object.create(T.prototype),y.prototype.constructor=y,_(y,T)}function _(y,T){return _=Object.setPrototypeOf||function(x,v){return x.__proto__=v,x},_(y,T)}var C=function(y){R(T,y);function T(){return y.apply(this,arguments)||this}var O=T.prototype;return O.resetInitSegment=function(v,g,d){y.prototype.resetInitSegment.call(this,v,g,d),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:v,duration:d,inputTimeScale:9e4,dropped:0}},T.probe=function(v){if(!v)return!1;for(var g=D.getID3Data(v,0)||[],d=g.length,t=v.length;d<t;d++)if(L.probe(v,d))return E.logger.log("MPEG Audio sync word found !"),!0;return!1},O.canParse=function(v,g){return L.canParse(v,g)},O.appendFrame=function(v,g,d){return this.initPTS===null?void 0:L.appendFrame(v,g,d,this.initPTS,this.frameIndex)},T}(I.default);C.minProbeByteLength=4,M.default=C},"./src/demux/mp4demuxer.ts":function(Y,M,S){"use strict";S.r(M);var I=S("./src/utils/mp4-tools.ts"),D=S("./src/demux/dummy-demuxed-track.ts"),E=function(){function L(_,C){this.remainderData=null,this.config=void 0,this.config=C}var R=L.prototype;return R.resetTimeStamp=function(){},R.resetInitSegment=function(){},R.resetContiguity=function(){},L.probe=function(C){return Object(I.findBox)({data:C,start:0,end:Math.min(C.length,16384)},["moof"]).length>0},R.demux=function(C){var y=C,T=Object(D.dummyTrack)();if(this.config.progressive){this.remainderData&&(y=Object(I.appendUint8Array)(this.remainderData,C));var O=Object(I.segmentValidRange)(y);this.remainderData=O.remainder,T.samples=O.valid||new Uint8Array}else T.samples=y;return{audioTrack:Object(D.dummyTrack)(),avcTrack:T,id3Track:Object(D.dummyTrack)(),textTrack:Object(D.dummyTrack)()}},R.flush=function(){var C=Object(D.dummyTrack)();return C.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(D.dummyTrack)(),avcTrack:C,id3Track:Object(D.dummyTrack)(),textTrack:Object(D.dummyTrack)()}},R.demuxSampleAes=function(C,y,T){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},R.destroy=function(){},L}();E.minProbeByteLength=1024,M.default=E},"./src/demux/mpegaudio.ts":function(Y,M,S){"use strict";S.r(M),S.d(M,"appendFrame",function(){return _}),S.d(M,"parseHeader",function(){return C}),S.d(M,"isHeaderPattern",function(){return y}),S.d(M,"isHeader",function(){return T}),S.d(M,"canParse",function(){return O}),S.d(M,"probe",function(){return x});var I=null,D=[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],E=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],L=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],R=[0,1,1,4];function _(v,g,d,t,o){if(d+24>g.length)return;var i=C(g,d);if(i&&d+i.frameLength<=g.length){var p=i.samplesPerFrame*9e4/i.sampleRate,f=t+o*p,s={unit:g.subarray(d,d+i.frameLength),pts:f,dts:f};return v.config=[],v.channelCount=i.channelCount,v.samplerate=i.sampleRate,v.samples.push(s),{sample:s,length:i.frameLength,missing:0}}}function C(v,g){var d=v[g+1]>>3&3,t=v[g+1]>>1&3,o=v[g+2]>>4&15,i=v[g+2]>>2&3;if(d!==1&&o!==0&&o!==15&&i!==3){var p=v[g+2]>>1&1,f=v[g+3]>>6,s=d===3?3-t:t===3?3:4,m=D[s*14+o-1]*1e3,l=d===3?0:d===2?1:2,a=E[l*3+i],r=f===3?1:2,e=L[d][t],n=R[t],c=e*8*n,h=Math.floor(e*m/a+p)*n;if(I===null){var u=navigator.userAgent||"",b=u.match(/Chrome\/(\d+)/i);I=b?parseInt(b[1]):0}var A=!!I&&I<=87;return A&&t===2&&m>=224e3&&f===0&&(v[g+3]=v[g+3]|128),{sampleRate:a,channelCount:r,frameLength:h,samplesPerFrame:c}}}function y(v,g){return v[g]===255&&(v[g+1]&224)===224&&(v[g+1]&6)!==0}function T(v,g){return g+1<v.length&&y(v,g)}function O(v,g){var d=4;return y(v,g)&&d<=v.length-g}function x(v,g){if(g+1<v.length&&y(v,g)){var d=4,t=C(v,g),o=d;t!=null&&t.frameLength&&(o=t.frameLength);var i=g+o;return i===v.length||T(v,i)}return!1}},"./src/demux/sample-aes.ts":function(Y,M,S){"use strict";S.r(M);var I=S("./src/crypt/decrypter.ts"),D=S("./src/demux/tsdemuxer.ts"),E=function(){function L(_,C,y){this.keyData=void 0,this.decrypter=void 0,this.keyData=y,this.decrypter=new I.default(_,C,{removePKCS7Padding:!1})}var R=L.prototype;return R.decryptBuffer=function(C,y){this.decrypter.decrypt(C,this.keyData.key.buffer,this.keyData.iv.buffer,y)},R.decryptAacSample=function(C,y,T,O){var x=C[y].unit,v=x.subarray(16,x.length-x.length%16),g=v.buffer.slice(v.byteOffset,v.byteOffset+v.length),d=this;this.decryptBuffer(g,function(t){var o=new Uint8Array(t);x.set(o,16),O||d.decryptAacSamples(C,y+1,T)})},R.decryptAacSamples=function(C,y,T){for(;;y++){if(y>=C.length){T();return}if(C[y].unit.length<32)continue;var O=this.decrypter.isSync();if(this.decryptAacSample(C,y,T,O),!O)return}},R.getAvcEncryptedData=function(C){for(var y=Math.floor((C.length-48)/160)*16+16,T=new Int8Array(y),O=0,x=32;x<=C.length-16;x+=160,O+=16)T.set(C.subarray(x,x+16),O);return T},R.getAvcDecryptedUnit=function(C,y){for(var T=new Uint8Array(y),O=0,x=32;x<=C.length-16;x+=160,O+=16)C.set(T.subarray(O,O+16),x);return C},R.decryptAvcSample=function(C,y,T,O,x,v){var g=Object(D.discardEPB)(x.data),d=this.getAvcEncryptedData(g),t=this;this.decryptBuffer(d.buffer,function(o){x.data=t.getAvcDecryptedUnit(g,o),v||t.decryptAvcSamples(C,y,T+1,O)})},R.decryptAvcSamples=function(C,y,T,O){if(C instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;y++,T=0){if(y>=C.length){O();return}for(var x=C[y].units;!(T>=x.length);T++){var v=x[T];if(v.data.length<=48||v.type!==1&&v.type!==5)continue;var g=this.decrypter.isSync();if(this.decryptAvcSample(C,y,T,O,v,g),!g)return}}},L}();M.default=E},"./src/demux/transmuxer-interface.ts":function(Y,M,S){"use strict";S.r(M),S.d(M,"default",function(){return x});var I=S("./node_modules/webworkify-webpack/index.js"),D=S.n(I),E=S("./src/events.ts"),L=S("./src/demux/transmuxer.ts"),R=S("./src/utils/logger.ts"),_=S("./src/errors.ts"),C=S("./src/utils/mediasource-helper.ts"),y=S("./node_modules/eventemitter3/index.js"),T=S.n(y),O=Object(C.getMediaSource)()||{isTypeSupported:function(){return!1}},x=function(){function v(d,t,o,i){var p=this;this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.hls=d,this.id=t,this.onTransmuxComplete=o,this.onFlush=i;var f=d.config,s=function(e,n){n=n||{},n.frag=p.frag,n.id=p.id,d.trigger(e,n)};this.observer=new y.EventEmitter,this.observer.on(E.Events.FRAG_DECRYPTED,s),this.observer.on(E.Events.ERROR,s);var m={mp4:O.isTypeSupported("video/mp4"),mpeg:O.isTypeSupported("audio/mpeg"),mp3:O.isTypeSupported('audio/mp4; codecs="mp3"')},l=navigator.vendor;if(f.enableWorker&&typeof Worker!="undefined"){R.logger.log("demuxing in webworker");var a;try{a=this.worker=I("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),a.addEventListener("message",this.onwmsg),a.onerror=function(r){d.trigger(E.Events.ERROR,{type:_.ErrorTypes.OTHER_ERROR,details:_.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(r.message+" ("+r.filename+":"+r.lineno+")")})},a.postMessage({cmd:"init",typeSupported:m,vendor:l,id:t,config:JSON.stringify(f)})}catch(r){R.logger.warn("Error in worker:",r),R.logger.error("Error while initializing DemuxerWorker, fallback to inline"),a&&self.URL.revokeObjectURL(a.objectURL),this.transmuxer=new L.default(this.observer,m,f,l,t),this.worker=null}}else this.transmuxer=new L.default(this.observer,m,f,l,t)}var g=v.prototype;return g.destroy=function(){var t=this.worker;if(t)t.removeEventListener("message",this.onwmsg),t.terminate(),this.worker=null;else{var o=this.transmuxer;o&&(o.destroy(),this.transmuxer=null)}var i=this.observer;i&&i.removeAllListeners(),this.observer=null},g.push=function(t,o,i,p,f,s,m,l,a,r){var e=this;a.transmuxing.start=self.performance.now();var n=this.transmuxer,c=this.worker,h=s?s.start:f.start,u=f.decryptdata,b=this.frag,A=!(b&&f.cc===b.cc),P=!(b&&a.level===b.level),w=b?a.sn-b.sn:-1,U=this.part?a.part-this.part.index:1,N=!P&&(w===1||w===0&&U===1),F=self.performance.now();(P||w||f.stats.parsing.start===0)&&(f.stats.parsing.start=F),s&&(U||!N)&&(s.stats.parsing.start=F);var K=new L.TransmuxState(A,N,l,P,h);if(!N||A){R.logger.log("[transmuxer-interface, "+f.type+"]: Starting new transmux session for sn: "+a.sn+" p: "+a.part+" level: "+a.level+" id: "+a.id+`
|
|
discontinuity: `+A+`
|
|
trackSwitch: `+P+`
|
|
contiguous: `+N+`
|
|
accurateTimeOffset: `+l+`
|
|
timeOffset: `+h);var $=new L.TransmuxConfig(i,p,o,m,r);this.configureTransmuxer($)}if(this.frag=f,this.part=s,c)c.postMessage({cmd:"demux",data:t,decryptdata:u,chunkMeta:a,state:K},t instanceof ArrayBuffer?[t]:[]);else if(n){var X=n.push(t,u,a,K);Object(L.isPromise)(X)?X.then(function(oe){e.handleTransmuxComplete(oe)}):this.handleTransmuxComplete(X)}},g.flush=function(t){var o=this;t.transmuxing.start=self.performance.now();var i=this.transmuxer,p=this.worker;if(p)p.postMessage({cmd:"flush",chunkMeta:t});else if(i){var f=i.flush(t);Object(L.isPromise)(f)?f.then(function(s){o.handleFlushResult(s,t)}):this.handleFlushResult(f,t)}},g.handleFlushResult=function(t,o){var i=this;t.forEach(function(p){i.handleTransmuxComplete(p)}),this.onFlush(o)},g.onWorkerMessage=function(t){var o=t.data,i=this.hls;switch(o.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(o.data);break}case"flush":{this.onFlush(o.data);break}default:{o.data=o.data||{},o.data.frag=this.frag,o.data.id=this.id,i.trigger(o.event,o.data);break}}},g.configureTransmuxer=function(t){var o=this.worker,i=this.transmuxer;o?o.postMessage({cmd:"configure",config:t}):i&&i.configure(t)},g.handleTransmuxComplete=function(t){t.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(t)},v}()},"./src/demux/transmuxer-worker.ts":function(Y,M,S){"use strict";S.r(M),S.d(M,"default",function(){return _});var I=S("./src/demux/transmuxer.ts"),D=S("./src/events.ts"),E=S("./src/utils/logger.ts"),L=S("./node_modules/eventemitter3/index.js"),R=S.n(L);function _(x){var v=new L.EventEmitter,g=function(t,o){x.postMessage({event:t,data:o})};v.on(D.Events.FRAG_DECRYPTED,g),v.on(D.Events.ERROR,g),x.addEventListener("message",function(d){var t=d.data;switch(t.cmd){case"init":{var o=JSON.parse(t.config);x.transmuxer=new I.default(v,t.typeSupported,o,t.vendor,t.id),Object(E.enableLogs)(o.debug),g("init",null);break}case"configure":{x.transmuxer.configure(t.config);break}case"demux":{var i=x.transmuxer.push(t.data,t.decryptdata,t.chunkMeta,t.state);Object(I.isPromise)(i)?i.then(function(s){C(x,s)}):C(x,i);break}case"flush":{var p=t.chunkMeta,f=x.transmuxer.flush(p);Object(I.isPromise)(f)?f.then(function(s){T(x,s,p)}):T(x,f,p);break}default:break}})}function C(x,v){if(O(v.remuxResult))return;var g=[],d=v.remuxResult,t=d.audio,o=d.video;t&&y(g,t),o&&y(g,o),x.postMessage({event:"transmuxComplete",data:v},g)}function y(x,v){v.data1&&x.push(v.data1.buffer),v.data2&&x.push(v.data2.buffer)}function T(x,v,g){v.forEach(function(d){C(x,d)}),x.postMessage({event:"flush",data:g})}function O(x){return!x.audio&&!x.video&&!x.text&&!x.id3&&!x.initSegment}},"./src/demux/transmuxer.ts":function(Y,M,S){"use strict";S.r(M),S.d(M,"default",function(){return o}),S.d(M,"isPromise",function(){return f}),S.d(M,"TransmuxConfig",function(){return s}),S.d(M,"TransmuxState",function(){return m});var I=S("./src/events.ts"),D=S("./src/errors.ts"),E=S("./src/crypt/decrypter.ts"),L=S("./src/demux/aacdemuxer.ts"),R=S("./src/demux/mp4demuxer.ts"),_=S("./src/demux/tsdemuxer.ts"),C=S("./src/demux/mp3demuxer.ts"),y=S("./src/remux/mp4-remuxer.ts"),T=S("./src/remux/passthrough-remuxer.ts"),O=S("./src/demux/chunk-cache.ts"),x=S("./src/utils/mp4-tools.ts"),v=S("./src/utils/logger.ts"),g;try{g=self.performance.now.bind(self.performance)}catch(l){v.logger.debug("Unable to use Performance API on this environment"),g=self.Date.now}var d=[{demux:_.default,remux:y.default},{demux:R.default,remux:T.default},{demux:L.default,remux:y.default},{demux:C.default,remux:y.default}],t=1024;d.forEach(function(l){var a=l.demux;t=Math.max(t,a.minProbeByteLength)});var o=function(){function l(r,e,n,c,h){this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=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.cache=new O.default,this.observer=r,this.typeSupported=e,this.config=n,this.vendor=c,this.id=h}var a=l.prototype;return a.configure=function(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()},a.push=function(e,n,c,h){var u=this,b=c.transmuxing;b.executeStart=g();var A=new Uint8Array(e),P=this.cache,w=this.config,U=this.currentTransmuxState,N=this.transmuxConfig;h&&(this.currentTransmuxState=h);var F=i(A,n);if(F&&F.method==="AES-128"){var K=this.getDecrypter();if(w.enableSoftwareAES){var $=K.softwareDecrypt(A,F.key.buffer,F.iv.buffer);if(!$)return b.executeEnd=g(),p(c);A=new Uint8Array($)}else return this.decryptionPromise=K.webCryptoDecrypt(A,F.key.buffer,F.iv.buffer).then(function(xe){var be=u.push(xe,null,c);return u.decryptionPromise=null,be}),this.decryptionPromise}var X=h||U,oe=X.contiguous,pe=X.discontinuity,ee=X.trackSwitch,de=X.accurateTimeOffset,le=X.timeOffset,re=N.audioCodec,te=N.videoCodec,Te=N.defaultInitPts,Ie=N.duration,Ae=N.initSegmentData;if((pe||ee)&&this.resetInitSegment(Ae,re,te,Ie),pe&&this.resetInitialTimestamp(Te),oe||this.resetContiguity(),this.needsProbing(A,pe,ee)){if(P.dataLength){var De=P.flush();A=Object(x.appendUint8Array)(De,A)}this.configureTransmuxer(A,N)}var fe=this.transmux(A,F,le,de,c),ye=this.currentTransmuxState;return ye.contiguous=!0,ye.discontinuity=!1,ye.trackSwitch=!1,b.executeEnd=g(),fe},a.flush=function(e){var n=this,c=e.transmuxing;c.executeStart=g();var h=this.decrypter,u=this.cache,b=this.currentTransmuxState,A=this.decryptionPromise;if(A)return A.then(function(){return n.flush(e)});var P=[],w=b.timeOffset;if(h){var U=h.flush();U&&P.push(this.push(U,null,e))}var N=u.dataLength;u.reset();var F=this.demuxer,K=this.remuxer;if(!F||!K)return N>=t&&this.observer.emit(I.Events.ERROR,I.Events.ERROR,{type:D.ErrorTypes.MEDIA_ERROR,details:D.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),c.executeEnd=g(),[p(e)];var $=F.flush(w);return f($)?$.then(function(X){return n.flushRemux(P,X,e),P}):(this.flushRemux(P,$,e),P)},a.flushRemux=function(e,n,c){var h=n.audioTrack,u=n.avcTrack,b=n.id3Track,A=n.textTrack,P=this.currentTransmuxState,w=P.accurateTimeOffset,U=P.timeOffset;v.logger.log("[transmuxer.ts]: Flushed fragment "+c.sn+(c.part>-1?" p: "+c.part:"")+" of level "+c.level);var N=this.remuxer.remux(h,u,b,A,U,w,!0,this.id);e.push({remuxResult:N,chunkMeta:c}),c.transmuxing.executeEnd=g()},a.resetInitialTimestamp=function(e){var n=this.demuxer,c=this.remuxer;if(!n||!c)return;n.resetTimeStamp(e),c.resetTimeStamp(e)},a.resetContiguity=function(){var e=this.demuxer,n=this.remuxer;if(!e||!n)return;e.resetContiguity(),n.resetNextTimestamp()},a.resetInitSegment=function(e,n,c,h){var u=this.demuxer,b=this.remuxer;if(!u||!b)return;u.resetInitSegment(n,c,h),b.resetInitSegment(e,n,c)},a.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},a.transmux=function(e,n,c,h,u){var b;return n&&n.method==="SAMPLE-AES"?b=this.transmuxSampleAes(e,n,c,h,u):b=this.transmuxUnencrypted(e,c,h,u),b},a.transmuxUnencrypted=function(e,n,c,h){var u=this.demuxer.demux(e,n,!1,!this.config.progressive),b=u.audioTrack,A=u.avcTrack,P=u.id3Track,w=u.textTrack,U=this.remuxer.remux(b,A,P,w,n,c,!1,this.id);return{remuxResult:U,chunkMeta:h}},a.transmuxSampleAes=function(e,n,c,h,u){var b=this;return this.demuxer.demuxSampleAes(e,n,c).then(function(A){var P=b.remuxer.remux(A.audioTrack,A.avcTrack,A.id3Track,A.textTrack,c,h,!1,b.id);return{remuxResult:P,chunkMeta:u}})},a.configureTransmuxer=function(e,n){for(var c=this.config,h=this.observer,u=this.typeSupported,b=this.vendor,A=n.audioCodec,P=n.defaultInitPts,w=n.duration,U=n.initSegmentData,N=n.videoCodec,F,K=0,$=d.length;K<$;K++)if(d[K].demux.probe(e)){F=d[K];break}F||(v.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),F={demux:R.default,remux:T.default});var X=this.demuxer,oe=this.remuxer,pe=F.remux,ee=F.demux;(!oe||!(oe instanceof pe))&&(this.remuxer=new pe(h,c,u,b)),(!X||!(X instanceof ee))&&(this.demuxer=new ee(h,c,u),this.probe=ee.probe),this.resetInitSegment(U,A,N,w),this.resetInitialTimestamp(P)},a.needsProbing=function(e,n,c){return!this.demuxer||!this.remuxer||n||c},a.getDecrypter=function(){var e=this.decrypter;return e||(e=this.decrypter=new E.default(this.observer,this.config)),e},l}();function i(l,a){var r=null;return l.byteLength>0&&a!=null&&a.key!=null&&a.iv!==null&&a.method!=null&&(r=a),r}var p=function(a){return{remuxResult:{},chunkMeta:a}};function f(l){return"then"in l&&l.then instanceof Function}var s=function(a,r,e,n,c){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=a,this.videoCodec=r,this.initSegmentData=e,this.duration=n,this.defaultInitPts=c},m=function(a,r,e,n,c){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=a,this.contiguous=r,this.accurateTimeOffset=e,this.trackSwitch=n,this.timeOffset=c}},"./src/demux/tsdemuxer.ts":function(Y,M,S){"use strict";S.r(M),S.d(M,"discardEPB",function(){return p});var I=S("./src/demux/adts.ts"),D=S("./src/demux/mpegaudio.ts"),E=S("./src/demux/exp-golomb.ts"),L=S("./src/demux/id3.ts"),R=S("./src/demux/sample-aes.ts"),_=S("./src/events.ts"),C=S("./src/utils/mp4-tools.ts"),y=S("./src/utils/logger.ts"),T=S("./src/errors.ts"),O={video:1,audio:2,id3:3,text:4},x=function(){function f(m,l,a){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._duration=0,this.aacLastPTS=null,this._initPTS=null,this._initDTS=null,this._pmtId=-1,this._avcTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.observer=m,this.config=l,this.typeSupported=a}f.probe=function(l){var a=f.syncOffset(l);return a<0?!1:(a&&y.logger.warn("MPEG2-TS detected but first sync word found @ offset "+a+", junk ahead ?"),!0)},f.syncOffset=function(l){for(var a=Math.min(1e3,l.length-3*188),r=0;r<a;){if(l[r]===71&&l[r+188]===71&&l[r+2*188]===71)return r;r++}return-1},f.createTrack=function(l,a){return{container:l==="video"||l==="audio"?"video/mp2t":void 0,type:l,id:O[l],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:l==="audio"?a:void 0}};var s=f.prototype;return s.resetInitSegment=function(l,a,r){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=f.createTrack("video",r),this._audioTrack=f.createTrack("audio",r),this._id3Track=f.createTrack("id3",r),this._txtTrack=f.createTrack("text",r),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=l,this.videoCodec=a,this._duration=r},s.resetTimeStamp=function(){},s.resetContiguity=function(){var l=this._audioTrack,a=this._avcTrack,r=this._id3Track;l&&(l.pesData=null),a&&(a.pesData=null),r&&(r.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},s.demux=function(l,a,r,e){r===void 0&&(r=!1),e===void 0&&(e=!1),r||(this.sampleAes=null);var n,c=this._avcTrack,h=this._audioTrack,u=this._id3Track,b=c.pid,A=c.pesData,P=h.pid,w=u.pid,U=h.pesData,N=u.pesData,F=!1,K=this.pmtParsed,$=this._pmtId,X=l.length;if(this.remainderData&&(l=Object(C.appendUint8Array)(this.remainderData,l),X=l.length,this.remainderData=null),X<188&&!e)return this.remainderData=l,{audioTrack:h,avcTrack:c,id3Track:u,textTrack:this._txtTrack};var oe=Math.max(0,f.syncOffset(l));X-=(X+oe)%188,X<l.byteLength&&!e&&(this.remainderData=new Uint8Array(l.buffer,X,l.buffer.byteLength-X));for(var pe=oe;pe<X;pe+=188)if(l[pe]===71){var ee=!!(l[pe+1]&64),de=((l[pe+1]&31)<<8)+l[pe+2],le=(l[pe+3]&48)>>4,re=void 0;if(le>1){if(re=pe+5+l[pe+4],re===pe+188)continue}else re=pe+4;switch(de){case b:ee&&(A&&(n=t(A))&&this.parseAVCPES(n,!1),A={data:[],size:0}),A&&(A.data.push(l.subarray(re,pe+188)),A.size+=pe+188-re);break;case P:ee&&(U&&(n=t(U))&&(h.isAAC?this.parseAACPES(n):this.parseMPEGPES(n)),U={data:[],size:0}),U&&(U.data.push(l.subarray(re,pe+188)),U.size+=pe+188-re);break;case w:ee&&(N&&(n=t(N))&&this.parseID3PES(n),N={data:[],size:0}),N&&(N.data.push(l.subarray(re,pe+188)),N.size+=pe+188-re);break;case 0:ee&&(re+=l[re]+1),$=this._pmtId=g(l,re);break;case $:{ee&&(re+=l[re]+1);var te=d(l,re,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,r);b=te.avc,b>0&&(c.pid=b),P=te.audio,P>0&&(h.pid=P,h.isAAC=te.isAAC),w=te.id3,w>0&&(u.pid=w),F&&!K&&(y.logger.log("reparse from beginning"),F=!1,pe=oe-188),K=this.pmtParsed=!0;break}case 17:case 8191:break;default:F=!0;break}}else this.observer.emit(_.Events.ERROR,_.Events.ERROR,{type:T.ErrorTypes.MEDIA_ERROR,details:T.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});c.pesData=A,h.pesData=U,u.pesData=N;var Te={audioTrack:h,avcTrack:c,id3Track:u,textTrack:this._txtTrack};return e&&this.extractRemainingSamples(Te),Te},s.flush=function(){var l=this.remainderData;this.remainderData=null;var a;return l?a=this.demux(l,-1,!1,!0):a={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(a),this.sampleAes?this.decrypt(a,this.sampleAes):a},s.extractRemainingSamples=function(l){var a=l.audioTrack,r=l.avcTrack,e=l.id3Track,n=r.pesData,c=a.pesData,h=e.pesData,u;n&&(u=t(n))?(this.parseAVCPES(u,!0),r.pesData=null):r.pesData=n,c&&(u=t(c))?(a.isAAC?this.parseAACPES(u):this.parseMPEGPES(u),a.pesData=null):(c!=null&&c.size&&y.logger.log("last AAC PES packet truncated,might overlap between fragments"),a.pesData=c),h&&(u=t(h))?(this.parseID3PES(u),e.pesData=null):e.pesData=h},s.demuxSampleAes=function(l,a,r){var e=this.demux(l,r,!0,!this.config.progressive),n=this.sampleAes=new R.default(this.observer,this.config,a);return this.decrypt(e,n)},s.decrypt=function(l,a){return new Promise(function(r){var e=l.audioTrack,n=l.avcTrack;e.samples&&e.isAAC?a.decryptAacSamples(e.samples,0,function(){n.samples?a.decryptAvcSamples(n.samples,0,0,function(){r(l)}):r(l)}):n.samples&&a.decryptAvcSamples(n.samples,0,0,function(){r(l)})})},s.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},s.parseAVCPES=function(l,a){var r=this,e=this._avcTrack,n=this.parseAVCNALu(l.data),c=!1,h=this.avcSample,u,b=!1;l.data=null,h&&n.length&&!e.audFound&&(o(h,e),h=this.avcSample=v(!1,l.pts,l.dts,"")),n.forEach(function(A){switch(A.type){case 1:{u=!0,h||(h=r.avcSample=v(!0,l.pts,l.dts,"")),c&&(h.debug+="NDR "),h.frame=!0;var P=A.data;if(b&&P.length>4){var w=new E.default(P).readSliceType();(w===2||w===4||w===7||w===9)&&(h.key=!0)}break}case 5:u=!0,h||(h=r.avcSample=v(!0,l.pts,l.dts,"")),c&&(h.debug+="IDR "),h.key=!0,h.frame=!0;break;case 6:{u=!0,c&&h&&(h.debug+="SEI ");var U=new E.default(p(A.data));U.readUByte();for(var N=0,F=0,K=!1,$=0;!K&&U.bytesAvailable>1;){N=0;do $=U.readUByte(),N+=$;while($===255);F=0;do $=U.readUByte(),F+=$;while($===255);if(N===4&&U.bytesAvailable!==0){K=!0;var X=U.readUByte();if(X===181){var oe=U.readUShort();if(oe===49){var pe=U.readUInt();if(pe===1195456820){var ee=U.readUByte();if(ee===3){for(var de=U.readUByte(),le=U.readUByte(),re=31&de,te=[de,le],Te=0;Te<re;Te++)te.push(U.readUByte()),te.push(U.readUByte()),te.push(U.readUByte());i(r._txtTrack.samples,{type:3,pts:l.pts,bytes:te})}}}}}else if(N===5&&U.bytesAvailable!==0){if(K=!0,F>16){for(var Ie=[],Ae=0;Ae<16;Ae++)Ie.push(U.readUByte().toString(16)),(Ae===3||Ae===5||Ae===7||Ae===9)&&Ie.push("-");for(var De=F-16,fe=new Uint8Array(De),ye=0;ye<De;ye++)fe[ye]=U.readUByte();i(r._txtTrack.samples,{pts:l.pts,payloadType:N,uuid:Ie.join(""),userData:Object(L.utf8ArrayToStr)(fe),userDataBytes:fe})}}else if(F<U.bytesAvailable)for(var xe=0;xe<F;xe++)U.readUByte()}break}case 7:if(u=!0,b=!0,c&&h&&(h.debug+="SPS "),!e.sps){var be=new E.default(A.data),ie=be.readSPS();e.width=ie.width,e.height=ie.height,e.pixelRatio=ie.pixelRatio,e.sps=[A.data],e.duration=r._duration;for(var Se=A.data.subarray(1,4),ge="avc1.",me=0;me<3;me++){var Ce=Se[me].toString(16);Ce.length<2&&(Ce="0"+Ce),ge+=Ce}e.codec=ge}break;case 8:u=!0,c&&h&&(h.debug+="PPS "),e.pps||(e.pps=[A.data]);break;case 9:u=!1,e.audFound=!0,h&&o(h,e),h=r.avcSample=v(!1,l.pts,l.dts,c?"AUD ":"");break;case 12:u=!1;break;default:u=!1,h&&(h.debug+="unknown NAL "+A.type+" ");break}if(h&&u){var Le=h.units;Le.push(A)}}),a&&h&&(o(h,e),this.avcSample=null)},s.getLastNalUnit=function(){var l,a=this.avcSample,r;if(!a||a.units.length===0){var e=this._avcTrack.samples;a=e[e.length-1]}if((l=a)!==null&&l!==void 0&&l.units){var n=a.units;r=n[n.length-1]}return r},s.parseAVCNALu=function(l){var a=l.byteLength,r=this._avcTrack,e=r.naluState||0,n=e,c=[],h=0,u,b,A,P=-1,w=0;for(e===-1&&(P=0,w=l[0]&31,e=0,h=1);h<a;){if(u=l[h++],!e){e=u?0:1;continue}if(e===1){e=u?0:2;continue}if(!u)e=3;else if(u===1){if(P>=0){var U={data:l.subarray(P,h-e-1),type:w};c.push(U)}else{var N=this.getLastNalUnit();if(N&&(n&&h<=4-n&&(N.state&&(N.data=N.data.subarray(0,N.data.byteLength-n))),b=h-e-1,b>0)){var F=new Uint8Array(N.data.byteLength+b);F.set(N.data,0),F.set(l.subarray(0,b),N.data.byteLength),N.data=F,N.state=0}}h<a?(A=l[h]&31,P=h,w=A,e=0):e=-1}else e=0}if(P>=0&&e>=0){var K={data:l.subarray(P,a),type:w,state:e};c.push(K)}if(c.length===0){var $=this.getLastNalUnit();if($){var X=new Uint8Array($.data.byteLength+l.byteLength);X.set($.data,0),X.set(l,$.data.byteLength),$.data=X}}return r.naluState=e,c},s.parseAACPES=function(l){var a=0,r=this._audioTrack,e=this.aacOverFlow,n=l.data;if(e){this.aacOverFlow=null;var c=e.sample.unit.byteLength,h=Math.min(e.missing,c),u=c-h;e.sample.unit.set(n.subarray(0,h),u),r.samples.push(e.sample),a=e.missing}var b,A;for(b=a,A=n.length;b<A-1&&!I.isHeader(n,b);b++);if(b!==a){var P,w;if(b<A-1?(P="AAC PES did not start with ADTS header,offset:"+b,w=!1):(P="no ADTS header found in AAC PES",w=!0),y.logger.warn("parsing error:"+P),this.observer.emit(_.Events.ERROR,_.Events.ERROR,{type:T.ErrorTypes.MEDIA_ERROR,details:T.ErrorDetails.FRAG_PARSING_ERROR,fatal:w,reason:P}),w)return}I.initTrackConfig(r,this.observer,n,b,this.audioCodec);var U;if(l.pts!==void 0)U=l.pts;else if(e){var N=I.getFrameDuration(r.samplerate);U=e.sample.pts+N}else{y.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var F=0;b<A;)if(I.isHeader(n,b)){if(b+5<A){var K=I.appendFrame(r,n,b,U,F);if(K)if(K.missing)this.aacOverFlow=K;else{b+=K.length,F++;continue}}break}else b++},s.parseMPEGPES=function(l){var a=l.data,r=a.length,e=0,n=0,c=l.pts;if(c===void 0){y.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;n<r;)if(D.isHeader(a,n)){var h=D.appendFrame(this._audioTrack,a,n,c,e);if(h)n+=h.length,e++;else break}else n++},s.parseID3PES=function(l){if(l.pts===void 0){y.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(l)},f}();x.minProbeByteLength=188;function v(f,s,m,l){return{key:f,frame:!1,pts:s,dts:m,units:[],debug:l,length:0}}function g(f,s){return(f[s+10]&31)<<8|f[s+11]}function d(f,s,m,l){var a={audio:-1,avc:-1,id3:-1,isAAC:!0},r=(f[s+1]&15)<<8|f[s+2],e=s+3+r-4,n=(f[s+10]&15)<<8|f[s+11];for(s+=12+n;s<e;){var c=(f[s+1]&31)<<8|f[s+2];switch(f[s]){case 207:if(!l){y.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:a.audio===-1&&(a.audio=c);break;case 21:a.id3===-1&&(a.id3=c);break;case 219:if(!l){y.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:a.avc===-1&&(a.avc=c);break;case 3:case 4:m?a.audio===-1&&(a.audio=c,a.isAAC=!1):y.logger.log("MPEG audio found, not supported in this browser");break;case 36:y.logger.warn("Unsupported HEVC stream type found");break;default:break}s+=((f[s+3]&15)<<8|f[s+4])+5}return a}function t(f){var s=0,m,l,a,r,e,n=f.data;if(!f||f.size===0)return null;for(;n[0].length<19&&n.length>1;){var c=new Uint8Array(n[0].length+n[1].length);c.set(n[0]),c.set(n[1],n[0].length),n[0]=c,n.splice(1,1)}m=n[0];var h=(m[0]<<16)+(m[1]<<8)+m[2];if(h===1){if(l=(m[4]<<8)+m[5],l&&l>f.size-6)return null;var u=m[7];u&192&&(r=(m[9]&14)*536870912+(m[10]&255)*4194304+(m[11]&254)*16384+(m[12]&255)*128+(m[13]&254)/2,u&64?(e=(m[14]&14)*536870912+(m[15]&255)*4194304+(m[16]&254)*16384+(m[17]&255)*128+(m[18]&254)/2,r-e>60*9e4&&(y.logger.warn(Math.round((r-e)/9e4)+"s delta between PTS and DTS, align them"),r=e)):e=r),a=m[8];var b=a+9;if(f.size<=b)return null;f.size-=b;for(var A=new Uint8Array(f.size),P=0,w=n.length;P<w;P++){m=n[P];var U=m.byteLength;if(b)if(b>U){b-=U;continue}else m=m.subarray(b),U-=b,b=0;A.set(m,s),s+=U}return l&&(l-=a+3),{data:A,pts:r,dts:e,len:l}}return null}function o(f,s){if(f.units.length&&f.frame){if(f.pts===void 0){var m=s.samples,l=m.length;if(l){var a=m[l-1];f.pts=a.pts,f.dts=a.dts}else{s.dropped++;return}}s.samples.push(f)}f.debug.length&&y.logger.log(f.pts+"/"+f.dts+":"+f.debug)}function i(f,s){var m=f.length;if(m>0){if(s.pts>=f[m-1].pts)f.push(s);else for(var l=m-1;l>=0;l--)if(s.pts<f[l].pts){f.splice(l,0,s);break}}else f.push(s)}function p(f){for(var s=f.byteLength,m=[],l=1;l<s-2;)f[l]===0&&f[l+1]===0&&f[l+2]===3?(m.push(l+2),l+=2):l++;if(m.length===0)return f;var a=s-m.length,r=new Uint8Array(a),e=0;for(l=0;l<a;e++,l++)e===m[0]&&(e++,m.shift()),r[l]=f[e];return r}M.default=x},"./src/errors.ts":function(Y,M,S){"use strict";S.r(M),S.d(M,"ErrorTypes",function(){return I}),S.d(M,"ErrorDetails",function(){return D});var I;(function(E){E.NETWORK_ERROR="networkError",E.MEDIA_ERROR="mediaError",E.KEY_SYSTEM_ERROR="keySystemError",E.MUX_ERROR="muxError",E.OTHER_ERROR="otherError"})(I||(I={}));var D;(function(E){E.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",E.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",E.KEY_SYSTEM_NO_SESSION="keySystemNoSession",E.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",E.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",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_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.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.INTERNAL_EXCEPTION="internalException",E.INTERNAL_ABORTED="aborted",E.UNKNOWN="unknown"})(D||(D={}))},"./src/events.ts":function(Y,M,S){"use strict";S.r(M),S.d(M,"Events",function(){return I});var I;(function(D){D.MEDIA_ATTACHING="hlsMediaAttaching",D.MEDIA_ATTACHED="hlsMediaAttached",D.MEDIA_DETACHING="hlsMediaDetaching",D.MEDIA_DETACHED="hlsMediaDetached",D.BUFFER_RESET="hlsBufferReset",D.BUFFER_CODECS="hlsBufferCodecs",D.BUFFER_CREATED="hlsBufferCreated",D.BUFFER_APPENDING="hlsBufferAppending",D.BUFFER_APPENDED="hlsBufferAppended",D.BUFFER_EOS="hlsBufferEos",D.BUFFER_FLUSHING="hlsBufferFlushing",D.BUFFER_FLUSHED="hlsBufferFlushed",D.MANIFEST_LOADING="hlsManifestLoading",D.MANIFEST_LOADED="hlsManifestLoaded",D.MANIFEST_PARSED="hlsManifestParsed",D.LEVEL_SWITCHING="hlsLevelSwitching",D.LEVEL_SWITCHED="hlsLevelSwitched",D.LEVEL_LOADING="hlsLevelLoading",D.LEVEL_LOADED="hlsLevelLoaded",D.LEVEL_UPDATED="hlsLevelUpdated",D.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",D.LEVELS_UPDATED="hlsLevelsUpdated",D.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",D.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",D.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",D.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",D.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",D.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",D.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",D.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",D.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",D.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",D.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",D.CUES_PARSED="hlsCuesParsed",D.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",D.INIT_PTS_FOUND="hlsInitPtsFound",D.FRAG_LOADING="hlsFragLoading",D.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",D.FRAG_LOADED="hlsFragLoaded",D.FRAG_DECRYPTED="hlsFragDecrypted",D.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",D.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",D.FRAG_PARSING_METADATA="hlsFragParsingMetadata",D.FRAG_PARSED="hlsFragParsed",D.FRAG_BUFFERED="hlsFragBuffered",D.FRAG_CHANGED="hlsFragChanged",D.FPS_DROP="hlsFpsDrop",D.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",D.ERROR="hlsError",D.DESTROYING="hlsDestroying",D.KEY_LOADING="hlsKeyLoading",D.KEY_LOADED="hlsKeyLoaded",D.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",D.BACK_BUFFER_REACHED="hlsBackBufferReached"})(I||(I={}))},"./src/hls.ts":function(Y,M,S){"use strict";S.r(M),S.d(M,"default",function(){return f});var I=S("./node_modules/url-toolkit/src/url-toolkit.js"),D=S.n(I),E=S("./src/loader/playlist-loader.ts"),L=S("./src/loader/key-loader.ts"),R=S("./src/controller/id3-track-controller.ts"),_=S("./src/controller/latency-controller.ts"),C=S("./src/controller/level-controller.ts"),y=S("./src/controller/fragment-tracker.ts"),T=S("./src/controller/stream-controller.ts"),O=S("./src/is-supported.ts"),x=S("./src/utils/logger.ts"),v=S("./src/config.ts"),g=S("./node_modules/eventemitter3/index.js"),d=S.n(g),t=S("./src/events.ts"),o=S("./src/errors.ts");function i(s,m){for(var l=0;l<m.length;l++){var a=m[l];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(s,a.key,a)}}function p(s,m,l){return m&&i(s.prototype,m),l&&i(s,l),s}var f=function(){s.isSupported=function(){return Object(O.isSupported)()};function s(l){l===void 0&&(l={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new g.EventEmitter,this._autoLevelCapping=void 0,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.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null;var a=this.config=Object(v.mergeConfig)(s.DefaultConfig,l);this.userConfig=l,Object(x.enableLogs)(a.debug),this._autoLevelCapping=-1,a.progressive&&Object(v.enableStreamingMode)(a);var r=a.abrController,e=a.bufferController,n=a.capLevelController,c=a.fpsController,h=this.abrController=new r(this),u=this.bufferController=new e(this),b=this.capLevelController=new n(this),A=new c(this),P=new E.default(this),w=new L.default(this),U=new R.default(this),N=this.levelController=new C.default(this),F=new y.FragmentTracker(this),K=this.streamController=new T.default(this,F);b.setStreamController(K),A.setStreamController(K);var $=[N,K];this.networkControllers=$;var X=[P,w,h,u,b,A,U,F];this.audioTrackController=this.createController(a.audioTrackController,null,$),this.createController(a.audioStreamController,F,$),this.subtitleTrackController=this.createController(a.subtitleTrackController,null,$),this.createController(a.subtitleStreamController,F,$),this.createController(a.timelineController,null,X),this.emeController=this.createController(a.emeController,null,X),this.cmcdController=this.createController(a.cmcdController,null,X),this.latencyController=this.createController(_.default,null,X),this.coreComponents=X}var m=s.prototype;return m.createController=function(a,r,e){if(a){var n=r?new a(this,r):new a(this);return e&&e.push(n),n}return null},m.on=function(a,r,e){e===void 0&&(e=this),this._emitter.on(a,r,e)},m.once=function(a,r,e){e===void 0&&(e=this),this._emitter.once(a,r,e)},m.removeAllListeners=function(a){this._emitter.removeAllListeners(a)},m.off=function(a,r,e,n){e===void 0&&(e=this),this._emitter.off(a,r,e,n)},m.listeners=function(a){return this._emitter.listeners(a)},m.emit=function(a,r,e){return this._emitter.emit(a,r,e)},m.trigger=function(a,r){if(this.config.debug)return this.emit(a,a,r);try{return this.emit(a,a,r)}catch(e){x.logger.error("An internal error happened while handling event "+a+'. Error message: "'+e.message+'". Here is a stacktrace:',e),this.trigger(t.Events.ERROR,{type:o.ErrorTypes.OTHER_ERROR,details:o.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:a,error:e})}return!1},m.listenerCount=function(a){return this._emitter.listenerCount(a)},m.destroy=function(){x.logger.log("destroy"),this.trigger(t.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(a){return a.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(a){return a.destroy()}),this.coreComponents.length=0},m.attachMedia=function(a){x.logger.log("attachMedia"),this._media=a,this.trigger(t.Events.MEDIA_ATTACHING,{media:a})},m.detachMedia=function(){x.logger.log("detachMedia"),this.trigger(t.Events.MEDIA_DETACHING,void 0),this._media=null},m.loadSource=function(a){this.stopLoad();var r=this.media,e=this.url,n=this.url=I.buildAbsoluteURL(self.location.href,a,{alwaysNormalize:!0});x.logger.log("loadSource:"+n),r&&e&&e!==n&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(r)),this.trigger(t.Events.MANIFEST_LOADING,{url:a})},m.startLoad=function(a){a===void 0&&(a=-1),x.logger.log("startLoad("+a+")"),this.networkControllers.forEach(function(r){r.startLoad(a)})},m.stopLoad=function(){x.logger.log("stopLoad"),this.networkControllers.forEach(function(a){a.stopLoad()})},m.swapAudioCodec=function(){x.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},m.recoverMediaError=function(){x.logger.log("recoverMediaError");var a=this._media;this.detachMedia(),a&&this.attachMedia(a)},m.removeLevel=function(a,r){r===void 0&&(r=0),this.levelController.removeLevel(a,r)},p(s,[{key:"levels",get:function(){var a=this.levelController.levels;return a||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(a){x.logger.log("set currentLevel:"+a),this.loadLevel=a,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(a){x.logger.log("set nextLevel:"+a),this.levelController.manualLevel=a,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(a){x.logger.log("set loadLevel:"+a),this.levelController.manualLevel=a}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(a){this.levelController.nextLoadLevel=a}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(a){x.logger.log("set firstLevel:"+a),this.levelController.firstLevel=a}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(a){x.logger.log("set startLevel:"+a),a!==-1&&(a=Math.max(a,this.minAutoLevel)),this.levelController.startLevel=a}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(a){var r=!!a;r!==this.config.capLevelToPlayerSize&&(r?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=r)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(a){this._autoLevelCapping!==a&&(x.logger.log("set autoLevelCapping:"+a),this._autoLevelCapping=a)}},{key:"bandwidthEstimate",get:function(){var a=this.abrController.bwEstimator;return a?a.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var a=this.levels,r=this.config.minAutoBitrate;if(!a)return 0;for(var e=a.length,n=0;n<e;n++)if(a[n].maxBitrate>r)return n;return 0}},{key:"maxAutoLevel",get:function(){var a=this.levels,r=this.autoLevelCapping,e;return r===-1&&a&&a.length?e=a.length-1:e=r,e}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(a){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,a)}},{key:"audioTracks",get:function(){var a=this.audioTrackController;return a?a.audioTracks:[]}},{key:"audioTrack",get:function(){var a=this.audioTrackController;return a?a.audioTrack:-1},set:function(a){var r=this.audioTrackController;r&&(r.audioTrack=a)}},{key:"subtitleTracks",get:function(){var a=this.subtitleTrackController;return a?a.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var a=this.subtitleTrackController;return a?a.subtitleTrack:-1},set:function(a){var r=this.subtitleTrackController;r&&(r.subtitleTrack=a)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var a=this.subtitleTrackController;return a?a.subtitleDisplay:!1},set:function(a){var r=this.subtitleTrackController;r&&(r.subtitleDisplay=a)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(a){this.config.lowLatencyMode=a}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}],[{key:"version",get:function(){return"1.1.2"}},{key:"Events",get:function(){return t.Events}},{key:"ErrorTypes",get:function(){return o.ErrorTypes}},{key:"ErrorDetails",get:function(){return o.ErrorDetails}},{key:"DefaultConfig",get:function(){return s.defaultConfig?s.defaultConfig:v.hlsDefaultConfig},set:function(a){s.defaultConfig=a}}]),s}();f.defaultConfig=void 0},"./src/is-supported.ts":function(Y,M,S){"use strict";S.r(M),S.d(M,"isSupported",function(){return E}),S.d(M,"changeTypeSupported",function(){return L});var I=S("./src/utils/mediasource-helper.ts");function D(){return self.SourceBuffer||self.WebKitSourceBuffer}function E(){var R=Object(I.getMediaSource)();if(!R)return!1;var _=D(),C=R&&typeof R.isTypeSupported=="function"&&R.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),y=!_||_.prototype&&typeof _.prototype.appendBuffer=="function"&&typeof _.prototype.remove=="function";return!!C&&!!y}function L(){var R,_=D();return typeof(_==null||((R=_.prototype)===null||R===void 0)?void 0:R.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(Y,M,S){"use strict";S.r(M),S.d(M,"default",function(){return x}),S.d(M,"LoadError",function(){return g});var I=S("./src/polyfills/number.ts"),D=S("./src/errors.ts");function E(d,t){d.prototype=Object.create(t.prototype),d.prototype.constructor=d,y(d,t)}function L(d){var t=typeof Map=="function"?new Map:void 0;return L=function(i){if(i===null||!C(i))return i;if(typeof i!="function")throw new TypeError("Super expression must either be null or a function");if(typeof t!="undefined"){if(t.has(i))return t.get(i);t.set(i,p)}function p(){return R(i,arguments,T(this).constructor)}return p.prototype=Object.create(i.prototype,{constructor:{value:p,enumerable:!1,writable:!0,configurable:!0}}),y(p,i)},L(d)}function R(d,t,o){return _()?R=Reflect.construct:R=function(p,f,s){var m=[null];m.push.apply(m,f);var l=Function.bind.apply(p,m),a=new l;return s&&y(a,s.prototype),a},R.apply(null,arguments)}function _(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(d){return!1}}function C(d){return Function.toString.call(d).indexOf("[native code]")!==-1}function y(d,t){return y=Object.setPrototypeOf||function(i,p){return i.__proto__=p,i},y(d,t)}function T(d){return T=Object.setPrototypeOf?Object.getPrototypeOf:function(o){return o.__proto__||Object.getPrototypeOf(o)},T(d)}var O=Math.pow(2,17),x=function(){function d(o){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=o}var t=d.prototype;return t.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},t.abort=function(){this.loader&&this.loader.abort()},t.load=function(i,p){var f=this,s=i.url;if(!s)return Promise.reject(new g({type:D.ErrorTypes.NETWORK_ERROR,details:D.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:i,networkDetails:null},"Fragment does not have a "+(s?"part list":"url")));this.abort();var m=this.config,l=m.fLoader,a=m.loader;return new Promise(function(r,e){f.loader&&f.loader.destroy();var n=f.loader=i.loader=l?new l(m):new a(m),c=v(i),h={timeout:m.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:m.fragLoadingMaxRetryTimeout,highWaterMark:O};i.stats=n.stats,n.load(c,h,{onSuccess:function(b,A,P,w){f.resetLoader(i,n),r({frag:i,part:null,payload:b.data,networkDetails:w})},onError:function(b,A,P){f.resetLoader(i,n),e(new g({type:D.ErrorTypes.NETWORK_ERROR,details:D.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:i,response:b,networkDetails:P}))},onAbort:function(b,A,P){f.resetLoader(i,n),e(new g({type:D.ErrorTypes.NETWORK_ERROR,details:D.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:i,networkDetails:P}))},onTimeout:function(b,A,P){f.resetLoader(i,n),e(new g({type:D.ErrorTypes.NETWORK_ERROR,details:D.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:i,networkDetails:P}))},onProgress:function(b,A,P,w){p&&p({frag:i,part:null,payload:P,networkDetails:w})}})})},t.loadPart=function(i,p,f){var s=this;this.abort();var m=this.config,l=m.fLoader,a=m.loader;return new Promise(function(r,e){s.loader&&s.loader.destroy();var n=s.loader=i.loader=l?new l(m):new a(m),c=v(i,p),h={timeout:m.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:m.fragLoadingMaxRetryTimeout,highWaterMark:O};p.stats=n.stats,n.load(c,h,{onSuccess:function(b,A,P,w){s.resetLoader(i,n),s.updateStatsFromPart(i,p);var U={frag:i,part:p,payload:b.data,networkDetails:w};f(U),r(U)},onError:function(b,A,P){s.resetLoader(i,n),e(new g({type:D.ErrorTypes.NETWORK_ERROR,details:D.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:i,part:p,response:b,networkDetails:P}))},onAbort:function(b,A,P){i.stats.aborted=p.stats.aborted,s.resetLoader(i,n),e(new g({type:D.ErrorTypes.NETWORK_ERROR,details:D.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:i,part:p,networkDetails:P}))},onTimeout:function(b,A,P){s.resetLoader(i,n),e(new g({type:D.ErrorTypes.NETWORK_ERROR,details:D.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:i,part:p,networkDetails:P}))}})})},t.updateStatsFromPart=function(i,p){var f=i.stats,s=p.stats,m=s.total;if(f.loaded+=s.loaded,m){var l=Math.round(i.duration/p.duration),a=Math.min(Math.round(f.loaded/m),l),r=l-a,e=r*Math.round(f.loaded/a);f.total=f.loaded+e}else f.total=Math.max(f.loaded,f.total);var n=f.loading,c=s.loading;n.start?n.first+=c.first-c.start:(n.start=c.start,n.first=c.first),n.end=c.end},t.resetLoader=function(i,p){i.loader=null,this.loader===p&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),p.destroy()},d}();function v(d,t){t===void 0&&(t=null);var o=t||d,i={frag:d,part:t,responseType:"arraybuffer",url:o.url,headers:{},rangeStart:0,rangeEnd:0},p=o.byteRangeStartOffset,f=o.byteRangeEndOffset;return Object(I.isFiniteNumber)(p)&&Object(I.isFiniteNumber)(f)&&(i.rangeStart=p,i.rangeEnd=f),i}var g=function(d){E(t,d);function t(o){for(var i,p=arguments.length,f=new Array(p>1?p-1:0),s=1;s<p;s++)f[s-1]=arguments[s];return i=d.call.apply(d,[this].concat(f))||this,i.data=void 0,i.data=o,i}return t}(L(Error))},"./src/loader/fragment.ts":function(Y,M,S){"use strict";S.r(M),S.d(M,"ElementaryStreamTypes",function(){return x}),S.d(M,"BaseSegment",function(){return v}),S.d(M,"Fragment",function(){return g}),S.d(M,"Part",function(){return d});var I=S("./src/polyfills/number.ts"),D=S("./node_modules/url-toolkit/src/url-toolkit.js"),E=S.n(D),L=S("./src/utils/logger.ts"),R=S("./src/loader/level-key.ts"),_=S("./src/loader/load-stats.ts");function C(t,o){t.prototype=Object.create(o.prototype),t.prototype.constructor=t,y(t,o)}function y(t,o){return y=Object.setPrototypeOf||function(p,f){return p.__proto__=f,p},y(t,o)}function T(t,o){for(var i=0;i<o.length;i++){var p=o[i];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(t,p.key,p)}}function O(t,o,i){return o&&T(t.prototype,o),i&&T(t,i),t}var x;(function(t){t.AUDIO="audio",t.VIDEO="video",t.AUDIOVIDEO="audiovideo"})(x||(x={}));var v=function(){function t(i){var p;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(p={},p[x.AUDIO]=null,p[x.VIDEO]=null,p[x.AUDIOVIDEO]=null,p),this.baseurl=i}var o=t.prototype;return o.setByteRange=function(p,f){var s=p.split("@",2),m=[];s.length===1?m[0]=f?f.byteRangeEndOffset:0:m[0]=parseInt(s[1]),m[1]=parseInt(s[0])+m[0],this._byteRange=m},O(t,[{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Object(D.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(p){this._url=p}}]),t}(),g=function(t){C(o,t);function o(p,f){var s;return s=t.call(this,f)||this,s._decryptdata=null,s.rawProgramDateTime=null,s.programDateTime=null,s.tagList=[],s.duration=0,s.sn=0,s.levelkey=void 0,s.type=void 0,s.loader=null,s.level=-1,s.cc=0,s.startPTS=void 0,s.endPTS=void 0,s.appendedPTS=void 0,s.startDTS=void 0,s.endDTS=void 0,s.start=0,s.deltaPTS=void 0,s.maxStartPTS=void 0,s.minEndPTS=void 0,s.stats=new _.LoadStats,s.urlId=0,s.data=void 0,s.bitrateTest=!1,s.title=null,s.initSegment=null,s.type=p,s}var i=o.prototype;return i.createInitializationVector=function(f){for(var s=new Uint8Array(16),m=12;m<16;m++)s[m]=f>>8*(15-m)&255;return s},i.setDecryptDataFromLevelKey=function(f,s){var m=f;return(f==null?void 0:f.method)==="AES-128"&&f.uri&&!f.iv&&(m=R.LevelKey.fromURI(f.uri),m.method=f.method,m.iv=this.createInitializationVector(s),m.keyFormat="identity"),m},i.setElementaryStreamInfo=function(f,s,m,l,a,r){r===void 0&&(r=!1);var e=this.elementaryStreams,n=e[f];if(!n){e[f]={startPTS:s,endPTS:m,startDTS:l,endDTS:a,partial:r};return}n.startPTS=Math.min(n.startPTS,s),n.endPTS=Math.max(n.endPTS,m),n.startDTS=Math.min(n.startDTS,l),n.endDTS=Math.max(n.endDTS,a)},i.clearElementaryStreamInfo=function(){var f=this.elementaryStreams;f[x.AUDIO]=null,f[x.VIDEO]=null,f[x.AUDIOVIDEO]=null},O(o,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var f=this.sn;typeof f!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&L.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),f=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,f)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(I.isFiniteNumber)(this.programDateTime))return null;var f=Object(I.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+f*1e3}},{key:"encrypted",get:function(){var f;return!!((f=this.decryptdata)!==null&&f!==void 0&&f.keyFormat&&this.decryptdata.uri)}}]),o}(v),d=function(t){C(o,t);function o(i,p,f,s,m){var l;l=t.call(this,f)||this,l.fragOffset=0,l.duration=0,l.gap=!1,l.independent=!1,l.relurl=void 0,l.fragment=void 0,l.index=void 0,l.stats=new _.LoadStats,l.duration=i.decimalFloatingPoint("DURATION"),l.gap=i.bool("GAP"),l.independent=i.bool("INDEPENDENT"),l.relurl=i.enumeratedString("URI"),l.fragment=p,l.index=s;var a=i.enumeratedString("BYTERANGE");return a&&l.setByteRange(a,m),m&&(l.fragOffset=m.fragOffset+m.duration),l}return O(o,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var p=this.elementaryStreams;return!!(p.audio||p.video||p.audiovideo)}}]),o}(v)},"./src/loader/key-loader.ts":function(Y,M,S){"use strict";S.r(M),S.d(M,"default",function(){return L});var I=S("./src/events.ts"),D=S("./src/errors.ts"),E=S("./src/utils/logger.ts"),L=function(){function R(C){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=C,this._registerListeners()}var _=R.prototype;return _._registerListeners=function(){this.hls.on(I.Events.KEY_LOADING,this.onKeyLoading,this)},_._unregisterListeners=function(){this.hls.off(I.Events.KEY_LOADING,this.onKeyLoading)},_.destroy=function(){this._unregisterListeners();for(var y in this.loaders){var T=this.loaders[y];T&&T.destroy()}this.loaders={}},_.onKeyLoading=function(y,T){var O=T.frag,x=O.type,v=this.loaders[x];if(!O.decryptdata){E.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var g=O.decryptdata.uri;if(g!==this.decrypturl||this.decryptkey===null){var d=this.hls.config;if(v&&(E.logger.warn("abort previous key loader for type:"+x),v.abort()),!g){E.logger.warn("key uri is falsy");return}var t=d.loader,o=O.loader=this.loaders[x]=new t(d);this.decrypturl=g,this.decryptkey=null;var i={url:g,frag:O,responseType:"arraybuffer"},p={timeout:d.fragLoadingTimeOut,maxRetry:0,retryDelay:d.fragLoadingRetryDelay,maxRetryDelay:d.fragLoadingMaxRetryTimeout,highWaterMark:0},f={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};o.load(i,p,f)}else this.decryptkey&&(O.decryptdata.key=this.decryptkey,this.hls.trigger(I.Events.KEY_LOADED,{frag:O}))},_.loadsuccess=function(y,T,O){var x=O.frag;if(!x.decryptdata){E.logger.error("after key load, decryptdata unset");return}this.decryptkey=x.decryptdata.key=new Uint8Array(y.data),x.loader=null,delete this.loaders[x.type],this.hls.trigger(I.Events.KEY_LOADED,{frag:x})},_.loaderror=function(y,T){var O=T.frag,x=O.loader;x&&x.abort(),delete this.loaders[O.type],this.hls.trigger(I.Events.ERROR,{type:D.ErrorTypes.NETWORK_ERROR,details:D.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:O,response:y})},_.loadtimeout=function(y,T){var O=T.frag,x=O.loader;x&&x.abort(),delete this.loaders[O.type],this.hls.trigger(I.Events.ERROR,{type:D.ErrorTypes.NETWORK_ERROR,details:D.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:O})},R}()},"./src/loader/level-details.ts":function(Y,M,S){"use strict";S.r(M),S.d(M,"LevelDetails",function(){return R});var I=S("./src/polyfills/number.ts");function D(_,C){for(var y=0;y<C.length;y++){var T=C[y];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(_,T.key,T)}}function E(_,C,y){return C&&D(_.prototype,C),y&&D(_,y),_}var L=10,R=function(){function _(y){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.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.needSidxRanges=!1,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.fragments=[],this.url=y}var C=_.prototype;return C.reloaded=function(T){if(!T){this.advanced=!0,this.updated=!0;return}var O=this.lastPartSn-T.lastPartSn,x=this.lastPartIndex-T.lastPartIndex;this.updated=this.endSN!==T.endSN||!!x||!!O,this.advanced=this.endSN>T.endSN||O>0||O===0&&x>0,this.updated||this.advanced?this.misses=Math.floor(T.misses*.6):this.misses=T.misses+1,this.availabilityDelay=T.availabilityDelay},E(_,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(I.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||L}},{key:"drift",get:function(){var T=this.driftEndTime-this.driftStartTime;if(T>0){var O=this.driftEnd-this.driftStart;return O*1e3/T}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var T;return(T=this.partList)!==null&&T!==void 0&&T.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var T;return(T=this.fragments)!==null&&T!==void 0&&T.length?this.fragments[this.fragments.length-1].end:0}},{key:"age",get:function(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}},{key:"lastPartIndex",get:function(){var T;return(T=this.partList)!==null&&T!==void 0&&T.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var T;return(T=this.partList)!==null&&T!==void 0&&T.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),_}()},"./src/loader/level-key.ts":function(Y,M,S){"use strict";S.r(M),S.d(M,"LevelKey",function(){return R});var I=S("./node_modules/url-toolkit/src/url-toolkit.js"),D=S.n(I);function E(_,C){for(var y=0;y<C.length;y++){var T=C[y];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(_,T.key,T)}}function L(_,C,y){return C&&E(_.prototype,C),y&&E(_,y),_}var R=function(){_.fromURL=function(y,T){return new _(y,T)},_.fromURI=function(y){return new _(y)};function _(C,y){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,y?this._uri=Object(I.buildAbsoluteURL)(C,y,{alwaysNormalize:!0}):this._uri=C}return L(_,[{key:"uri",get:function(){return this._uri}}]),_}()},"./src/loader/load-stats.ts":function(Y,M,S){"use strict";S.r(M),S.d(M,"LoadStats",function(){return I});var I=function(){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}}},"./src/loader/m3u8-parser.ts":function(Y,M,S){"use strict";S.r(M),S.d(M,"default",function(){return o});var I=S("./src/polyfills/number.ts"),D=S("./node_modules/url-toolkit/src/url-toolkit.js"),E=S.n(D),L=S("./src/loader/fragment.ts"),R=S("./src/loader/level-details.ts"),_=S("./src/loader/level-key.ts"),C=S("./src/utils/attr-list.ts"),y=S("./src/utils/logger.ts"),T=S("./src/utils/codecs.ts"),O=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,x=/#EXT-X-MEDIA:(.*)/g,v=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),g=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(PLAYLIST-TYPE):(.+)/.source,/#EXT-X-(MEDIA-SEQUENCE): *(\d+)/.source,/#EXT-X-(SKIP):(.+)/.source,/#EXT-X-(TARGETDURATION): *(\d+)/.source,/#EXT-X-(KEY):(.+)/.source,/#EXT-X-(START):(.+)/.source,/#EXT-X-(ENDLIST)/.source,/#EXT-X-(DISCONTINUITY-SEQ)UENCE: *(\d+)/.source,/#EXT-X-(DIS)CONTINUITY/.source,/#EXT-X-(VERSION):(\d+)/.source,/#EXT-X-(MAP):(.+)/.source,/#EXT-X-(SERVER-CONTROL):(.+)/.source,/#EXT-X-(PART-INF):(.+)/.source,/#EXT-X-(GAP)/.source,/#EXT-X-(BITRATE):\s*(\d+)/.source,/#EXT-X-(PART):(.+)/.source,/#EXT-X-(PRELOAD-HINT):(.+)/.source,/#EXT-X-(RENDITION-REPORT):(.+)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),d=/\.(mp4|m4s|m4v|m4a)$/i;function t(m){var l,a;return d.test((l=(a=D.parseURL(m))===null||a===void 0?void 0:a.path)!=null?l:"")}var o=function(){function m(){}return m.findGroup=function(a,r){for(var e=0;e<a.length;e++){var n=a[e];if(n.id===r)return n}},m.convertAVC1ToAVCOTI=function(a){var r=a.split(".");if(r.length>2){var e=r.shift()+".";return e+=parseInt(r.shift()).toString(16),e+=("000"+parseInt(r.shift()).toString(16)).substr(-4),e}return a},m.resolve=function(a,r){return D.buildAbsoluteURL(r,a,{alwaysNormalize:!0})},m.parseMasterPlaylist=function(a,r){var e=[],n={},c=!1;O.lastIndex=0;for(var h;(h=O.exec(a))!=null;)if(h[1]){var u=new C.AttrList(h[1]),b={attrs:u,bitrate:u.decimalInteger("AVERAGE-BANDWIDTH")||u.decimalInteger("BANDWIDTH"),name:u.NAME,url:m.resolve(h[2],r)},A=u.decimalResolution("RESOLUTION");A&&(b.width=A.width,b.height=A.height),i((u.CODECS||"").split(/[ ,]+/).filter(function(w){return w}),b),b.videoCodec&&b.videoCodec.indexOf("avc1")!==-1&&(b.videoCodec=m.convertAVC1ToAVCOTI(b.videoCodec)),e.push(b)}else if(h[3]){var P=new C.AttrList(h[3]);P["DATA-ID"]&&(c=!0,n[P["DATA-ID"]]=P)}return{levels:e,sessionData:c?n:null}},m.parseMasterPlaylistMedia=function(a,r,e,n){n===void 0&&(n=[]);var c,h=[],u=0;for(x.lastIndex=0;(c=x.exec(a))!==null;){var b=new C.AttrList(c[1]);if(b.TYPE===e){var A={attrs:b,bitrate:0,id:u++,groupId:b["GROUP-ID"],instreamId:b["INSTREAM-ID"],name:b.NAME||b.LANGUAGE||"",type:e,default:b.bool("DEFAULT"),autoselect:b.bool("AUTOSELECT"),forced:b.bool("FORCED"),lang:b.LANGUAGE,url:b.URI?m.resolve(b.URI,r):""};if(n.length){var P=m.findGroup(n,A.groupId)||n[0];p(A,P,"audioCodec"),p(A,P,"textCodec")}h.push(A)}}return h},m.parseLevelPlaylist=function(a,r,e,n,c){var h=new R.LevelDetails(r),u=h.fragments,b=null,A=0,P=0,w=0,U=0,N=null,F=new L.Fragment(n,r),K,$,X,oe=-1,pe=!1;for(v.lastIndex=0,h.m3u8=a;(K=v.exec(a))!==null;){pe&&(pe=!1,F=new L.Fragment(n,r),F.start=w,F.sn=A,F.cc=U,F.level=e,b&&(F.initSegment=b,F.rawProgramDateTime=b.rawProgramDateTime));var ee=K[1];if(ee){F.duration=parseFloat(ee);var de=(" "+K[2]).slice(1);F.title=de||null,F.tagList.push(de?["INF",ee,de]:["INF",ee])}else if(K[3])Object(I.isFiniteNumber)(F.duration)&&(F.start=w,X&&(F.levelkey=X),F.sn=A,F.level=e,F.cc=U,F.urlId=c,u.push(F),F.relurl=(" "+K[3]).slice(1),s(F,N),N=F,w+=F.duration,A++,P=0,pe=!0);else if(K[4]){var le=(" "+K[4]).slice(1);N?F.setByteRange(le,N):F.setByteRange(le)}else if(K[5])F.rawProgramDateTime=(" "+K[5]).slice(1),F.tagList.push(["PROGRAM-DATE-TIME",F.rawProgramDateTime]),oe===-1&&(oe=u.length);else{if(K=K[0].match(g),!K){y.logger.warn("No matches on slow regex match for level playlist!");continue}for($=1;$<K.length&&!(typeof K[$]!="undefined");$++);var re=(" "+K[$]).slice(1),te=(" "+K[$+1]).slice(1),Te=K[$+2]?(" "+K[$+2]).slice(1):"";switch(re){case"PLAYLIST-TYPE":h.type=te.toUpperCase();break;case"MEDIA-SEQUENCE":A=h.startSN=parseInt(te);break;case"SKIP":{var Ie=new C.AttrList(te),Ae=Ie.decimalInteger("SKIPPED-SEGMENTS");if(Object(I.isFiniteNumber)(Ae)){h.skippedSegments=Ae;for(var De=Ae;De--;)u.unshift(null);A+=Ae}var fe=Ie.enumeratedString("RECENTLY-REMOVED-DATERANGES");fe&&(h.recentlyRemovedDateranges=fe.split(" "));break}case"TARGETDURATION":h.targetduration=parseFloat(te);break;case"VERSION":h.version=parseInt(te);break;case"EXTM3U":break;case"ENDLIST":h.live=!1;break;case"#":(te||Te)&&F.tagList.push(Te?[te,Te]:[te]);break;case"DIS":U++;case"GAP":F.tagList.push([re]);break;case"BITRATE":F.tagList.push([re,te]);break;case"DISCONTINUITY-SEQ":U=parseInt(te);break;case"KEY":{var ye,xe=new C.AttrList(te),be=xe.enumeratedString("METHOD"),ie=xe.URI,Se=xe.hexadecimalInteger("IV"),ge=xe.enumeratedString("KEYFORMATVERSIONS"),me=xe.enumeratedString("KEYID"),Ce=(ye=xe.enumeratedString("KEYFORMAT"))!=null?ye:"identity",Le=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(Le.indexOf(Ce)>-1){y.logger.warn("Keyformat "+Ce+" is not supported from the manifest");continue}else if(Ce!=="identity")continue;be&&(X=_.LevelKey.fromURL(r,ie),ie&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(be)>=0&&(X.method=be,X.keyFormat=Ce,me&&(X.keyID=me),ge&&(X.keyFormatVersions=ge),X.iv=Se));break}case"START":{var _e=new C.AttrList(te),Re=_e.decimalFloatingPoint("TIME-OFFSET");Object(I.isFiniteNumber)(Re)&&(h.startTimeOffset=Re);break}case"MAP":{var Pe=new C.AttrList(te);F.relurl=Pe.URI,Pe.BYTERANGE&&F.setByteRange(Pe.BYTERANGE),F.level=e,F.sn="initSegment",X&&(F.levelkey=X),F.initSegment=null,b=F,pe=!0;break}case"SERVER-CONTROL":{var we=new C.AttrList(te);h.canBlockReload=we.bool("CAN-BLOCK-RELOAD"),h.canSkipUntil=we.optionalFloat("CAN-SKIP-UNTIL",0),h.canSkipDateRanges=h.canSkipUntil>0&&we.bool("CAN-SKIP-DATERANGES"),h.partHoldBack=we.optionalFloat("PART-HOLD-BACK",0),h.holdBack=we.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var J=new C.AttrList(te);h.partTarget=J.decimalFloatingPoint("PART-TARGET");break}case"PART":{var q=h.partList;q||(q=h.partList=[]);var se=P>0?q[q.length-1]:void 0,ce=P++,Z=new L.Part(new C.AttrList(te),F,r,ce,se);q.push(Z),F.duration+=Z.duration;break}case"PRELOAD-HINT":{var ue=new C.AttrList(te);h.preloadHint=ue;break}case"RENDITION-REPORT":{var V=new C.AttrList(te);h.renditionReports=h.renditionReports||[],h.renditionReports.push(V);break}default:y.logger.warn("line parsed but not handled: "+K);break}}}N&&!N.relurl?(u.pop(),w-=N.duration,h.partList&&(h.fragmentHint=N)):h.partList&&(s(F,N),F.cc=U,h.fragmentHint=F);var G=u.length,H=u[0],k=u[G-1];if(w+=h.skippedSegments*h.targetduration,w>0&&G&&k){h.averagetargetduration=w/G;var j=k.sn;h.endSN=j!=="initSegment"?j:0,H&&(h.startCC=H.cc,H.initSegment||h.fragments.every(function(W){return W.relurl&&t(W.relurl)})&&(y.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),F=new L.Fragment(n,r),F.relurl=k.relurl,F.level=e,F.sn="initSegment",H.initSegment=F,h.needSidxRanges=!0))}else h.endSN=0,h.startCC=0;return h.fragmentHint&&(w+=h.fragmentHint.duration),h.totalduration=w,h.endCC=U,oe>0&&f(u,oe),h},m}();function i(m,l){["video","audio","text"].forEach(function(a){var r=m.filter(function(n){return Object(T.isCodecType)(n,a)});if(r.length){var e=r.filter(function(n){return n.lastIndexOf("avc1",0)===0||n.lastIndexOf("mp4a",0)===0});l[a+"Codec"]=e.length>0?e[0]:r[0],m=m.filter(function(n){return r.indexOf(n)===-1})}}),l.unknownCodecs=m}function p(m,l,a){var r=l[a];r&&(m[a]=r)}function f(m,l){for(var a=m[l],r=l;r--;){var e=m[r];if(!e)return;e.programDateTime=a.programDateTime-e.duration*1e3,a=e}}function s(m,l){m.rawProgramDateTime?m.programDateTime=Date.parse(m.rawProgramDateTime):l!=null&&l.programDateTime&&(m.programDateTime=l.endProgramDateTime),Object(I.isFiniteNumber)(m.programDateTime)||(m.programDateTime=null,m.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(Y,M,S){"use strict";S.r(M);var I=S("./src/polyfills/number.ts"),D=S("./src/events.ts"),E=S("./src/errors.ts"),L=S("./src/utils/logger.ts"),R=S("./src/utils/mp4-tools.ts"),_=S("./src/loader/m3u8-parser.ts"),C=S("./src/types/loader.ts"),y=S("./src/utils/attr-list.ts");function T(v){var g=v.type;switch(g){case C.PlaylistContextType.AUDIO_TRACK:return C.PlaylistLevelType.AUDIO;case C.PlaylistContextType.SUBTITLE_TRACK:return C.PlaylistLevelType.SUBTITLE;default:return C.PlaylistLevelType.MAIN}}function O(v,g){var d=v.url;return(d===void 0||d.indexOf("data:")===0)&&(d=g.url),d}var x=function(){function v(d){this.hls=void 0,this.loaders=Object.create(null),this.hls=d,this.registerListeners()}var g=v.prototype;return g.registerListeners=function(){var t=this.hls;t.on(D.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.on(D.Events.LEVEL_LOADING,this.onLevelLoading,this),t.on(D.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),t.on(D.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},g.unregisterListeners=function(){var t=this.hls;t.off(D.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.off(D.Events.LEVEL_LOADING,this.onLevelLoading,this),t.off(D.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),t.off(D.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},g.createInternalLoader=function(t){var o=this.hls.config,i=o.pLoader,p=o.loader,f=i||p,s=new f(o);return t.loader=s,this.loaders[t.type]=s,s},g.getInternalLoader=function(t){return this.loaders[t.type]},g.resetInternalLoader=function(t){this.loaders[t]&&delete this.loaders[t]},g.destroyInternalLoaders=function(){for(var t in this.loaders){var o=this.loaders[t];o&&o.destroy(),this.resetInternalLoader(t)}},g.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},g.onManifestLoading=function(t,o){var i=o.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:C.PlaylistContextType.MANIFEST,url:i,deliveryDirectives:null})},g.onLevelLoading=function(t,o){var i=o.id,p=o.level,f=o.url,s=o.deliveryDirectives;this.load({id:i,groupId:null,level:p,responseType:"text",type:C.PlaylistContextType.LEVEL,url:f,deliveryDirectives:s})},g.onAudioTrackLoading=function(t,o){var i=o.id,p=o.groupId,f=o.url,s=o.deliveryDirectives;this.load({id:i,groupId:p,level:null,responseType:"text",type:C.PlaylistContextType.AUDIO_TRACK,url:f,deliveryDirectives:s})},g.onSubtitleTrackLoading=function(t,o){var i=o.id,p=o.groupId,f=o.url,s=o.deliveryDirectives;this.load({id:i,groupId:p,level:null,responseType:"text",type:C.PlaylistContextType.SUBTITLE_TRACK,url:f,deliveryDirectives:s})},g.load=function(t){var o,i=this.hls.config,p=this.getInternalLoader(t);if(p){var f=p.context;if(f&&f.url===t.url){L.logger.trace("[playlist-loader]: playlist request ongoing");return}L.logger.log("[playlist-loader]: aborting previous loader for type: "+t.type),p.abort()}var s,m,l,a;switch(t.type){case C.PlaylistContextType.MANIFEST:s=i.manifestLoadingMaxRetry,m=i.manifestLoadingTimeOut,l=i.manifestLoadingRetryDelay,a=i.manifestLoadingMaxRetryTimeout;break;case C.PlaylistContextType.LEVEL:case C.PlaylistContextType.AUDIO_TRACK:case C.PlaylistContextType.SUBTITLE_TRACK:s=0,m=i.levelLoadingTimeOut;break;default:s=i.levelLoadingMaxRetry,m=i.levelLoadingTimeOut,l=i.levelLoadingRetryDelay,a=i.levelLoadingMaxRetryTimeout;break}if(p=this.createInternalLoader(t),(o=t.deliveryDirectives)!==null&&o!==void 0&&o.part){var r;if(t.type===C.PlaylistContextType.LEVEL&&t.level!==null?r=this.hls.levels[t.level].details:t.type===C.PlaylistContextType.AUDIO_TRACK&&t.id!==null?r=this.hls.audioTracks[t.id].details:t.type===C.PlaylistContextType.SUBTITLE_TRACK&&t.id!==null&&(r=this.hls.subtitleTracks[t.id].details),r){var e=r.partTarget,n=r.targetduration;e&&n&&(m=Math.min(Math.max(e*3,n*.8)*1e3,m))}}var c={timeout:m,maxRetry:s,retryDelay:l,maxRetryDelay:a,highWaterMark:0},h={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};p.load(t,c,h)},g.loadsuccess=function(t,o,i,p){if(p===void 0&&(p=null),i.isSidxRequest){this.handleSidxRequest(t,i),this.handlePlaylistLoaded(t,o,i,p);return}this.resetInternalLoader(i.type);var f=t.data;if(f.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(t,i,"no EXTM3U delimiter",p);return}o.parsing.start=performance.now(),f.indexOf("#EXTINF:")>0||f.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(t,o,i,p):this.handleMasterPlaylist(t,o,i,p)},g.loaderror=function(t,o,i){i===void 0&&(i=null),this.handleNetworkError(o,i,!1,t)},g.loadtimeout=function(t,o,i){i===void 0&&(i=null),this.handleNetworkError(o,i,!0)},g.handleMasterPlaylist=function(t,o,i,p){var f=this.hls,s=t.data,m=O(t,i),l=_.default.parseMasterPlaylist(s,m),a=l.levels,r=l.sessionData;if(!a.length){this.handleManifestParsingError(t,i,"no level found in manifest",p);return}var e=a.map(function(A){return{id:A.attrs.AUDIO,audioCodec:A.audioCodec}}),n=a.map(function(A){return{id:A.attrs.SUBTITLES,textCodec:A.textCodec}}),c=_.default.parseMasterPlaylistMedia(s,m,"AUDIO",e),h=_.default.parseMasterPlaylistMedia(s,m,"SUBTITLES",n),u=_.default.parseMasterPlaylistMedia(s,m,"CLOSED-CAPTIONS");if(c.length){var b=c.some(function(A){return!A.url});!b&&a[0].audioCodec&&!a[0].attrs.AUDIO&&(L.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),c.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new y.AttrList({}),bitrate:0,url:""}))}f.trigger(D.Events.MANIFEST_LOADED,{levels:a,audioTracks:c,subtitles:h,captions:u,url:m,stats:o,networkDetails:p,sessionData:r})},g.handleTrackOrLevelPlaylist=function(t,o,i,p){var f=this.hls,s=i.id,m=i.level,l=i.type,a=O(t,i),r=Object(I.isFiniteNumber)(s)?s:0,e=Object(I.isFiniteNumber)(m)?m:r,n=T(i),c=_.default.parseLevelPlaylist(t.data,a,e,n,r);if(!c.fragments.length){f.trigger(D.Events.ERROR,{type:E.ErrorTypes.NETWORK_ERROR,details:E.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:a,reason:"no fragments found in level",level:typeof i.level=="number"?i.level:void 0});return}if(l===C.PlaylistContextType.MANIFEST){var h={attrs:new y.AttrList({}),bitrate:0,details:c,name:"",url:a};f.trigger(D.Events.MANIFEST_LOADED,{levels:[h],audioTracks:[],url:a,stats:o,networkDetails:p,sessionData:null})}if(o.parsing.end=performance.now(),c.needSidxRanges){var u,b=(u=c.fragments[0].initSegment)===null||u===void 0?void 0:u.url;this.load({url:b,isSidxRequest:!0,type:l,level:m,levelDetails:c,id:s,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}i.levelDetails=c,this.handlePlaylistLoaded(t,o,i,p)},g.handleSidxRequest=function(t,o){var i=Object(R.parseSegmentIndex)(new Uint8Array(t.data));if(!i)return;var p=i.references,f=o.levelDetails;p.forEach(function(s,m){var l=s.info,a=f.fragments[m];a.byteRange.length===0&&a.setByteRange(String(1+l.end-l.start)+"@"+String(l.start)),a.initSegment&&a.initSegment.setByteRange(String(i.moovEndOffset)+"@0")})},g.handleManifestParsingError=function(t,o,i,p){this.hls.trigger(D.Events.ERROR,{type:E.ErrorTypes.NETWORK_ERROR,details:E.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:o.type===C.PlaylistContextType.MANIFEST,url:t.url,reason:i,response:t,context:o,networkDetails:p})},g.handleNetworkError=function(t,o,i,p){i===void 0&&(i=!1),L.logger.warn("[playlist-loader]: A network "+(i?"timeout":"error")+" occurred while loading "+t.type+" level: "+t.level+" id: "+t.id+' group-id: "'+t.groupId+'"');var f=E.ErrorDetails.UNKNOWN,s=!1,m=this.getInternalLoader(t);switch(t.type){case C.PlaylistContextType.MANIFEST:f=i?E.ErrorDetails.MANIFEST_LOAD_TIMEOUT:E.ErrorDetails.MANIFEST_LOAD_ERROR,s=!0;break;case C.PlaylistContextType.LEVEL:f=i?E.ErrorDetails.LEVEL_LOAD_TIMEOUT:E.ErrorDetails.LEVEL_LOAD_ERROR,s=!1;break;case C.PlaylistContextType.AUDIO_TRACK:f=i?E.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:E.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,s=!1;break;case C.PlaylistContextType.SUBTITLE_TRACK:f=i?E.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:E.ErrorDetails.SUBTITLE_LOAD_ERROR,s=!1;break}m&&this.resetInternalLoader(t.type);var l={type:E.ErrorTypes.NETWORK_ERROR,details:f,fatal:s,url:t.url,loader:m,context:t,networkDetails:o};p&&(l.response=p),this.hls.trigger(D.Events.ERROR,l)},g.handlePlaylistLoaded=function(t,o,i,p){var f=i.type,s=i.level,m=i.id,l=i.groupId,a=i.loader,r=i.levelDetails,e=i.deliveryDirectives;if(!(r!=null&&r.targetduration)){this.handleManifestParsingError(t,i,"invalid target duration",p);return}if(!a)return;r.live&&(a.getCacheAge&&(r.ageHeader=a.getCacheAge()||0),(!a.getCacheAge||isNaN(r.ageHeader))&&(r.ageHeader=0));switch(f){case C.PlaylistContextType.MANIFEST:case C.PlaylistContextType.LEVEL:this.hls.trigger(D.Events.LEVEL_LOADED,{details:r,level:s||0,id:m||0,stats:o,networkDetails:p,deliveryDirectives:e});break;case C.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(D.Events.AUDIO_TRACK_LOADED,{details:r,id:m||0,groupId:l||"",stats:o,networkDetails:p,deliveryDirectives:e});break;case C.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(D.Events.SUBTITLE_TRACK_LOADED,{details:r,id:m||0,groupId:l||"",stats:o,networkDetails:p,deliveryDirectives:e});break}},v}();M.default=x},"./src/polyfills/number.ts":function(Y,M,S){"use strict";S.r(M),S.d(M,"isFiniteNumber",function(){return I}),S.d(M,"MAX_SAFE_INTEGER",function(){return D});var I=Number.isFinite||function(E){return typeof E=="number"&&isFinite(E)},D=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(Y,M,S){"use strict";S.r(M);var I=function(){function D(){}return D.getSilentFrame=function(L,R){switch(L){case"mp4a.40.2":if(R===1)return new Uint8Array([0,200,0,128,35,128]);if(R===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(R===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(R===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(R===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(R===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(R===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(R===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(R===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}return},D}();M.default=I},"./src/remux/mp4-generator.ts":function(Y,M,S){"use strict";S.r(M);var I=Math.pow(2,32)-1,D=function(){function E(){}return E.init=function(){E.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var R;for(R in E.types)E.types.hasOwnProperty(R)&&(E.types[R]=[R.charCodeAt(0),R.charCodeAt(1),R.charCodeAt(2),R.charCodeAt(3)]);var _=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]),C=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]);E.HDLR_TYPES={video:_,audio:C};var y=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),T=new Uint8Array([0,0,0,0,0,0,0,0]);E.STTS=E.STSC=E.STCO=T,E.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),E.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),E.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),E.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var O=new Uint8Array([105,115,111,109]),x=new Uint8Array([97,118,99,49]),v=new Uint8Array([0,0,0,1]);E.FTYP=E.box(E.types.ftyp,O,v,O,x),E.DINF=E.box(E.types.dinf,E.box(E.types.dref,y))},E.box=function(R){for(var _=8,C=arguments.length,y=new Array(C>1?C-1:0),T=1;T<C;T++)y[T-1]=arguments[T];for(var O=y.length,x=O;O--;)_+=y[O].byteLength;var v=new Uint8Array(_);for(v[0]=_>>24&255,v[1]=_>>16&255,v[2]=_>>8&255,v[3]=_&255,v.set(R,4),O=0,_=8;O<x;O++)v.set(y[O],_),_+=y[O].byteLength;return v},E.hdlr=function(R){return E.box(E.types.hdlr,E.HDLR_TYPES[R])},E.mdat=function(R){return E.box(E.types.mdat,R)},E.mdhd=function(R,_){_*=R;var C=Math.floor(_/(I+1)),y=Math.floor(_%(I+1));return E.box(E.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,R>>24&255,R>>16&255,R>>8&255,R&255,C>>24,C>>16&255,C>>8&255,C&255,y>>24,y>>16&255,y>>8&255,y&255,85,196,0,0]))},E.mdia=function(R){return E.box(E.types.mdia,E.mdhd(R.timescale,R.duration),E.hdlr(R.type),E.minf(R))},E.mfhd=function(R){return E.box(E.types.mfhd,new Uint8Array([0,0,0,0,R>>24,R>>16&255,R>>8&255,R&255]))},E.minf=function(R){return R.type==="audio"?E.box(E.types.minf,E.box(E.types.smhd,E.SMHD),E.DINF,E.stbl(R)):E.box(E.types.minf,E.box(E.types.vmhd,E.VMHD),E.DINF,E.stbl(R))},E.moof=function(R,_,C){return E.box(E.types.moof,E.mfhd(R),E.traf(C,_))},E.moov=function(R){for(var _=R.length,C=[];_--;)C[_]=E.trak(R[_]);return E.box.apply(null,[E.types.moov,E.mvhd(R[0].timescale,R[0].duration)].concat(C).concat(E.mvex(R)))},E.mvex=function(R){for(var _=R.length,C=[];_--;)C[_]=E.trex(R[_]);return E.box.apply(null,[E.types.mvex].concat(C))},E.mvhd=function(R,_){_*=R;var C=Math.floor(_/(I+1)),y=Math.floor(_%(I+1)),T=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,R>>24&255,R>>16&255,R>>8&255,R&255,C>>24,C>>16&255,C>>8&255,C&255,y>>24,y>>16&255,y>>8&255,y&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return E.box(E.types.mvhd,T)},E.sdtp=function(R){var _=R.samples||[],C=new Uint8Array(4+_.length),y,T;for(y=0;y<_.length;y++)T=_[y].flags,C[y+4]=T.dependsOn<<4|T.isDependedOn<<2|T.hasRedundancy;return E.box(E.types.sdtp,C)},E.stbl=function(R){return E.box(E.types.stbl,E.stsd(R),E.box(E.types.stts,E.STTS),E.box(E.types.stsc,E.STSC),E.box(E.types.stsz,E.STSZ),E.box(E.types.stco,E.STCO))},E.avc1=function(R){var _=[],C=[],y,T,O;for(y=0;y<R.sps.length;y++)T=R.sps[y],O=T.byteLength,_.push(O>>>8&255),_.push(O&255),_=_.concat(Array.prototype.slice.call(T));for(y=0;y<R.pps.length;y++)T=R.pps[y],O=T.byteLength,C.push(O>>>8&255),C.push(O&255),C=C.concat(Array.prototype.slice.call(T));var x=E.box(E.types.avcC,new Uint8Array([1,_[3],_[4],_[5],252|3,224|R.sps.length].concat(_).concat([R.pps.length]).concat(C))),v=R.width,g=R.height,d=R.pixelRatio[0],t=R.pixelRatio[1];return E.box(E.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,v>>8&255,v&255,g>>8&255,g&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),x,E.box(E.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),E.box(E.types.pasp,new Uint8Array([d>>24,d>>16&255,d>>8&255,d&255,t>>24,t>>16&255,t>>8&255,t&255])))},E.esds=function(R){var _=R.config.length;return new Uint8Array([0,0,0,0,3,23+_,0,1,0,4,15+_,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([_]).concat(R.config).concat([6,1,2]))},E.mp4a=function(R){var _=R.samplerate;return E.box(E.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,R.channelCount,0,16,0,0,0,0,_>>8&255,_&255,0,0]),E.box(E.types.esds,E.esds(R)))},E.mp3=function(R){var _=R.samplerate;return E.box(E.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,R.channelCount,0,16,0,0,0,0,_>>8&255,_&255,0,0]))},E.stsd=function(R){return R.type==="audio"?!R.isAAC&&R.codec==="mp3"?E.box(E.types.stsd,E.STSD,E.mp3(R)):E.box(E.types.stsd,E.STSD,E.mp4a(R)):E.box(E.types.stsd,E.STSD,E.avc1(R))},E.tkhd=function(R){var _=R.id,C=R.duration*R.timescale,y=R.width,T=R.height,O=Math.floor(C/(I+1)),x=Math.floor(C%(I+1));return E.box(E.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,_>>24&255,_>>16&255,_>>8&255,_&255,0,0,0,0,O>>24,O>>16&255,O>>8&255,O&255,x>>24,x>>16&255,x>>8&255,x&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,y>>8&255,y&255,0,0,T>>8&255,T&255,0,0]))},E.traf=function(R,_){var C=E.sdtp(R),y=R.id,T=Math.floor(_/(I+1)),O=Math.floor(_%(I+1));return E.box(E.types.traf,E.box(E.types.tfhd,new Uint8Array([0,0,0,0,y>>24,y>>16&255,y>>8&255,y&255])),E.box(E.types.tfdt,new Uint8Array([1,0,0,0,T>>24,T>>16&255,T>>8&255,T&255,O>>24,O>>16&255,O>>8&255,O&255])),E.trun(R,C.length+16+20+8+16+8+8),C)},E.trak=function(R){return R.duration=R.duration||4294967295,E.box(E.types.trak,E.tkhd(R),E.mdia(R))},E.trex=function(R){var _=R.id;return E.box(E.types.trex,new Uint8Array([0,0,0,0,_>>24,_>>16&255,_>>8&255,_&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},E.trun=function(R,_){var C=R.samples||[],y=C.length,T=12+16*y,O=new Uint8Array(T),x,v,g,d,t,o;for(_+=8+T,O.set([0,0,15,1,y>>>24&255,y>>>16&255,y>>>8&255,y&255,_>>>24&255,_>>>16&255,_>>>8&255,_&255],0),x=0;x<y;x++)v=C[x],g=v.duration,d=v.size,t=v.flags,o=v.cts,O.set([g>>>24&255,g>>>16&255,g>>>8&255,g&255,d>>>24&255,d>>>16&255,d>>>8&255,d&255,t.isLeading<<2|t.dependsOn,t.isDependedOn<<6|t.hasRedundancy<<4|t.paddingValue<<1|t.isNonSync,t.degradPrio&240<<8,t.degradPrio&15,o>>>24&255,o>>>16&255,o>>>8&255,o&255],12+16*x);return E.box(E.types.trun,O)},E.initSegment=function(R){E.types||E.init();var _=E.moov(R),C=new Uint8Array(E.FTYP.byteLength+_.byteLength);return C.set(E.FTYP),C.set(_,E.FTYP.byteLength),C},E}();D.types=void 0,D.HDLR_TYPES=void 0,D.STTS=void 0,D.STSC=void 0,D.STCO=void 0,D.STSZ=void 0,D.VMHD=void 0,D.SMHD=void 0,D.STSD=void 0,D.FTYP=void 0,D.DINF=void 0,M.default=D},"./src/remux/mp4-remuxer.ts":function(Y,M,S){"use strict";S.r(M),S.d(M,"default",function(){return o}),S.d(M,"normalizePts",function(){return i});var I=S("./src/polyfills/number.ts"),D=S("./src/remux/aac-helper.ts"),E=S("./src/remux/mp4-generator.ts"),L=S("./src/events.ts"),R=S("./src/errors.ts"),_=S("./src/utils/logger.ts"),C=S("./src/types/loader.ts"),y=S("./src/utils/timescale-conversion.ts");function T(){return T=Object.assign||function(m){for(var l=1;l<arguments.length;l++){var a=arguments[l];for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(m[r]=a[r])}return m},T.apply(this,arguments)}var O=10*1e3,x=1024,v=1152,g=null,d=null,t=!1,o=function(){function m(a,r,e,n){if(n===void 0&&(n=""),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=void 0,this._initDTS=void 0,this.nextAvcDts=null,this.nextAudioPts=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=a,this.config=r,this.typeSupported=e,this.ISGenerated=!1,g===null){var c=navigator.userAgent||"",h=c.match(/Chrome\/(\d+)/i);g=h?parseInt(h[1]):0}if(d===null){var u=navigator.userAgent.match(/Safari\/(\d+)/i);d=u?parseInt(u[1]):0}t=!!g&&g<75||!!d&&d<600}var l=m.prototype;return l.destroy=function(){},l.resetTimeStamp=function(r){_.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=r},l.resetNextTimestamp=function(){_.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},l.resetInitSegment=function(){_.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},l.getVideoStartPts=function(r){var e=!1,n=r.reduce(function(c,h){var u=h.pts-c;return u<-4294967296?(e=!0,i(c,h.pts)):u>0?c:h.pts},r[0].pts);return e&&_.logger.debug("PTS rollover detected"),n},l.remux=function(r,e,n,c,h,u,b,A){var P,w,U,N,F,K,$=h,X=h,oe=r.pid>-1,pe=e.pid>-1,ee=e.samples.length,de=r.samples.length>0,le=ee>1,re=(!oe||de)&&(!pe||le)||this.ISGenerated||b;if(re){this.ISGenerated||(U=this.generateIS(r,e,h));var te=this.isVideoContiguous,Te=-1;if(le&&(Te=p(e.samples),!te&&this.config.forceKeyFrameOnDiscontinuity))if(K=!0,Te>0){_.logger.warn("[mp4-remuxer]: Dropped "+Te+" out of "+ee+" video samples due to a missing keyframe");var Ie=this.getVideoStartPts(e.samples);e.samples=e.samples.slice(Te),e.dropped+=Te,X+=(e.samples[0].pts-Ie)/(e.timescale||9e4)}else Te===-1&&(_.logger.warn("[mp4-remuxer]: No keyframe found out of "+ee+" video samples"),K=!1);if(this.ISGenerated){if(de&&le){var Ae=this.getVideoStartPts(e.samples),De=i(r.samples[0].pts,Ae)-Ae,fe=De/e.inputTimeScale;$+=Math.max(0,fe),X+=Math.max(0,-fe)}if(de){if(r.samplerate||(_.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),U=this.generateIS(r,e,h)),w=this.remuxAudio(r,$,this.isAudioContiguous,u,pe||le||A===C.PlaylistLevelType.AUDIO?X:void 0),le){var ye=w?w.endPTS-w.startPTS:0;e.inputTimeScale||(_.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),U=this.generateIS(r,e,h)),P=this.remuxVideo(e,X,te,ye)}}else le&&(P=this.remuxVideo(e,X,te,0));P&&(P.firstKeyFrame=Te,P.independent=Te!==-1)}}return this.ISGenerated&&(n.samples.length&&(F=this.remuxID3(n,h)),c.samples.length&&(N=this.remuxText(c,h))),{audio:w,video:P,initSegment:U,independent:K,text:N,id3:F}},l.generateIS=function(r,e,n){var c=r.samples,h=e.samples,u=this.typeSupported,b={},A=!Object(I.isFiniteNumber)(this._initPTS),P="audio/mp4",w,U,N;if(A&&(w=U=Infinity),r.config&&c.length&&(r.timescale=r.samplerate,r.isAAC||(u.mpeg?(P="audio/mpeg",r.codec=""):u.mp3&&(r.codec="mp3")),b.audio={id:"audio",container:P,codec:r.codec,initSegment:!r.isAAC&&u.mpeg?new Uint8Array(0):E.default.initSegment([r]),metadata:{channelCount:r.channelCount}},A&&(N=r.inputTimeScale,w=U=c[0].pts-Math.round(N*n))),e.sps&&e.pps&&h.length&&(e.timescale=e.inputTimeScale,b.video={id:"main",container:"video/mp4",codec:e.codec,initSegment:E.default.initSegment([e]),metadata:{width:e.width,height:e.height}},A)){N=e.inputTimeScale;var F=this.getVideoStartPts(h),K=Math.round(N*n);U=Math.min(U,i(h[0].dts,F)-K),w=Math.min(w,F-K)}if(Object.keys(b).length)return this.ISGenerated=!0,A&&(this._initPTS=w,this._initDTS=U),{tracks:b,initPTS:w,timescale:N}},l.remuxVideo=function(r,e,n,c){var h=r.inputTimeScale,u=r.samples,b=[],A=u.length,P=this._initPTS,w=this.nextAvcDts,U=8,N,F,K,$=Number.POSITIVE_INFINITY,X=Number.NEGATIVE_INFINITY,oe=0,pe=!1;if(!n||w===null){var ee=e*h,de=u[0].pts-i(u[0].dts,u[0].pts);w=ee-de}for(var le=0;le<A;le++){var re=u[le];if(re.pts=i(re.pts-P,w),re.dts=i(re.dts-P,w),re.dts>re.pts){var te=9e4*.2;oe=Math.max(Math.min(oe,re.pts-re.dts),-1*te)}re.dts<u[le>0?le-1:le].dts&&(pe=!0)}pe&&u.sort(function(Be,Ue){var ke=Be.dts-Ue.dts,He=Be.pts-Ue.pts;return ke||He}),F=u[0].dts,K=u[u.length-1].dts;var Te=Math.round((K-F)/(A-1));if(oe<0){if(oe<Te*-2){_.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(y.toMsFromMpegTsClock)(-Te,!0)+" ms");for(var Ie=oe,Ae=0;Ae<A;Ae++)u[Ae].dts=Ie=Math.max(Ie,u[Ae].pts-Te),u[Ae].pts=Math.max(Ie,u[Ae].pts)}else{_.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(y.toMsFromMpegTsClock)(oe,!0)+" ms to overcome this issue");for(var De=0;De<A;De++)u[De].dts=u[De].dts+oe}F=u[0].dts}if(n){var fe=F-w,ye=fe>Te,xe=fe<-1;if(ye||xe){ye?_.logger.warn("AVC: "+Object(y.toMsFromMpegTsClock)(fe,!0)+" ms ("+fe+"dts) hole between fragments detected, filling it"):_.logger.warn("AVC: "+Object(y.toMsFromMpegTsClock)(-fe,!0)+" ms ("+fe+"dts) overlapping between fragments detected"),F=w;var be=u[0].pts-fe;u[0].dts=F,u[0].pts=be,_.logger.log("Video: First PTS/DTS adjusted: "+Object(y.toMsFromMpegTsClock)(be,!0)+"/"+Object(y.toMsFromMpegTsClock)(F,!0)+", delta: "+Object(y.toMsFromMpegTsClock)(fe,!0)+" ms")}}t&&(F=Math.max(0,F));for(var ie=0,Se=0,ge=0;ge<A;ge++){for(var me=u[ge],Ce=me.units,Le=Ce.length,_e=0,Re=0;Re<Le;Re++)_e+=Ce[Re].data.length;Se+=_e,ie+=Le,me.length=_e,me.dts=Math.max(me.dts,F),me.pts=Math.max(me.pts,me.dts,0),$=Math.min(me.pts,$),X=Math.max(me.pts,X)}K=u[A-1].dts;var Pe=Se+4*ie+8,we;try{we=new Uint8Array(Pe)}catch(Be){this.observer.emit(L.Events.ERROR,L.Events.ERROR,{type:R.ErrorTypes.MUX_ERROR,details:R.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Pe,reason:"fail allocating video mdat "+Pe});return}var J=new DataView(we.buffer);J.setUint32(0,Pe),we.set(E.default.types.mdat,4);for(var q=0;q<A;q++){for(var se=u[q],ce=se.units,Z=0,ue=0,V=ce.length;ue<V;ue++){var G=ce[ue],H=G.data,k=G.data.byteLength;J.setUint32(U,k),U+=4,we.set(H,U),U+=k,Z+=4+k}if(q<A-1)N=u[q+1].dts-se.dts;else{var j=this.config,W=se.dts-u[q>0?q-1:q].dts;if(j.stretchShortVideoTrack&&this.nextAudioPts!==null){var z=Math.floor(j.maxBufferHole*h),Q=(c?$+c*h:this.nextAudioPts)-se.pts;Q>z?(N=Q-W,N<0&&(N=W),_.logger.log("[mp4-remuxer]: It is approximately "+Q/90+" ms to the next segment; using duration "+N/90+" ms for the last video frame.")):N=W}else N=W}var ne=Math.round(se.pts-se.dts);b.push(new f(se.key,N,Z,ne))}if(b.length&&g&&g<70){var ae=b[0].flags;ae.dependsOn=2,ae.isNonSync=0}console.assert(N!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=w=K+N,this.isVideoContiguous=!0;var ve=E.default.moof(r.sequenceNumber++,F,T({},r,{samples:b})),Oe="video",Ee={data1:ve,data2:we,startPTS:$/h,endPTS:(X+N)/h,startDTS:F/h,endDTS:w/h,type:Oe,hasAudio:!1,hasVideo:!0,nb:b.length,dropped:r.dropped};return r.samples=[],r.dropped=0,console.assert(we.length,"MDAT length must not be zero"),Ee},l.remuxAudio=function(r,e,n,c,h){var u=r.inputTimeScale,b=r.samplerate?r.samplerate:u,A=u/b,P=r.isAAC?x:v,w=P*A,U=this._initPTS,N=!r.isAAC&&this.typeSupported.mpeg,F=[],K=r.samples,$=N?0:8,X=this.nextAudioPts||-1,oe=e*u;if(this.isAudioContiguous=n=n||K.length&&X>0&&(c&&Math.abs(oe-X)<9e3||Math.abs(i(K[0].pts-U,oe)-X)<20*w),K.forEach(function(H){H.pts=i(H.pts-U,oe)}),!n||X<0){if(K=K.filter(function(H){return H.pts>=0}),!K.length)return;h===0?X=0:c?X=Math.max(0,oe):X=K[0].pts}if(r.isAAC)for(var pe=h!==void 0,ee=this.config.maxAudioFramesDrift,de=0,le=X;de<K.length;de++){var re=K[de],te=re.pts,Te=te-le,Ie=Math.abs(1e3*Te/u);if(Te<=-ee*w&&pe)de===0&&(_.logger.warn("Audio frame @ "+(te/u).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*Te/u)+" ms."),this.nextAudioPts=X=le=te);else if(Te>=ee*w&&Ie<O&&pe){var Ae=Math.round(Te/w);le=te-Ae*w,le<0&&(Ae--,le+=w),de===0&&(this.nextAudioPts=X=le),_.logger.warn("[mp4-remuxer]: Injecting "+Ae+" audio frame @ "+(le/u).toFixed(3)+"s due to "+Math.round(1e3*Te/u)+" ms gap.");for(var De=0;De<Ae;De++){var fe=Math.max(le,0),ye=D.default.getSilentFrame(r.manifestCodec||r.codec,r.channelCount);ye||(_.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),ye=re.unit.subarray()),K.splice(de,0,{unit:ye,pts:fe}),le+=w,de++}}re.pts=le,le+=w}for(var xe=null,be=null,ie,Se=0,ge=K.length;ge--;)Se+=K[ge].unit.byteLength;for(var me=0,Ce=K.length;me<Ce;me++){var Le=K[me],_e=Le.unit,Re=Le.pts;if(be!==null){var Pe=F[me-1];Pe.duration=Math.round((Re-be)/A)}else if(n&&r.isAAC&&(Re=X),xe=Re,Se>0){Se+=$;try{ie=new Uint8Array(Se)}catch(H){this.observer.emit(L.Events.ERROR,L.Events.ERROR,{type:R.ErrorTypes.MUX_ERROR,details:R.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Se,reason:"fail allocating audio mdat "+Se});return}if(!N){var we=new DataView(ie.buffer);we.setUint32(0,Se),ie.set(E.default.types.mdat,4)}}else return;ie.set(_e,$);var J=_e.byteLength;$+=J,F.push(new f(!0,P,J,0)),be=Re}var q=F.length;if(!q)return;var se=F[F.length-1];this.nextAudioPts=X=be+A*se.duration;var ce=N?new Uint8Array(0):E.default.moof(r.sequenceNumber++,xe/A,T({},r,{samples:F}));r.samples=[];var Z=xe/u,ue=X/u,V="audio",G={data1:ce,data2:ie,startPTS:Z,endPTS:ue,startDTS:Z,endDTS:ue,type:V,hasAudio:!0,hasVideo:!1,nb:q};return this.isAudioContiguous=!0,console.assert(ie.length,"MDAT length must not be zero"),G},l.remuxEmptyAudio=function(r,e,n,c){var h=r.inputTimeScale,u=r.samplerate?r.samplerate:h,b=h/u,A=this.nextAudioPts,P=(A!==null?A:c.startDTS*h)+this._initDTS,w=c.endDTS*h+this._initDTS,U=b*x,N=Math.ceil((w-P)/U),F=D.default.getSilentFrame(r.manifestCodec||r.codec,r.channelCount);if(_.logger.warn("[mp4-remuxer]: remux empty Audio"),!F){_.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var K=[],$=0;$<N;$++){var X=P+$*U;K.push({unit:F,pts:X,dts:X})}return r.samples=K,this.remuxAudio(r,e,n,!1)},l.remuxID3=function(r,e){var n=r.samples.length;if(!n)return;for(var c=r.inputTimeScale,h=this._initPTS,u=this._initDTS,b=0;b<n;b++){var A=r.samples[b];A.pts=i(A.pts-h,e*c)/c,A.dts=i(A.dts-u,e*c)/c}var P=r.samples;return r.samples=[],{samples:P}},l.remuxText=function(r,e){var n=r.samples.length;if(!n)return;for(var c=r.inputTimeScale,h=this._initPTS,u=0;u<n;u++){var b=r.samples[u];b.pts=i(b.pts-h,e*c)/c}r.samples.sort(function(P,w){return P.pts-w.pts});var A=r.samples;return r.samples=[],{samples:A}},m}();function i(m,l){var a;if(l===null)return m;for(l<m?a=-8589934592:a=8589934592;Math.abs(m-l)>4294967296;)m+=a;return m}function p(m){for(var l=0;l<m.length;l++)if(m[l].key)return l;return-1}var f=function(l,a,r,e){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=a,this.size=r,this.cts=e,this.flags=new s(l)},s=function(l){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=l?2:1,this.isNonSync=l?0:1}},"./src/remux/passthrough-remuxer.ts":function(Y,M,S){"use strict";S.r(M);var I=S("./src/polyfills/number.ts"),D=S("./src/utils/mp4-tools.ts"),E=S("./src/loader/fragment.ts"),L=S("./src/utils/logger.ts"),R=function(){function y(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=void 0,this.initTracks=void 0,this.lastEndDTS=null}var T=y.prototype;return T.destroy=function(){},T.resetTimeStamp=function(x){this.initPTS=x,this.lastEndDTS=null},T.resetNextTimestamp=function(){this.lastEndDTS=null},T.resetInitSegment=function(x,v,g){this.audioCodec=v,this.videoCodec=g,this.generateInitSegment(x),this.emitInitSegment=!0},T.generateInitSegment=function(x){var v=this.audioCodec,g=this.videoCodec;if(!x||!x.byteLength){this.initTracks=void 0,this.initData=void 0;return}var d=this.initData=Object(D.parseInitSegment)(x);v||(v=C(d.audio,E.ElementaryStreamTypes.AUDIO)),g||(g=C(d.video,E.ElementaryStreamTypes.VIDEO));var t={};d.audio&&d.video?t.audiovideo={container:"video/mp4",codec:v+","+g,initSegment:x,id:"main"}:d.audio?t.audio={container:"audio/mp4",codec:v,initSegment:x,id:"audio"}:d.video?t.video={container:"video/mp4",codec:g,initSegment:x,id:"main"}:L.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=t},T.remux=function(x,v,g,d,t){var o=this.initPTS,i=this.lastEndDTS,p={audio:void 0,video:void 0,text:d,id3:g,initSegment:void 0};Object(I.isFiniteNumber)(i)||(i=this.lastEndDTS=t||0);var f=v.samples;if(!f||!f.length)return p;var s={initPTS:void 0,timescale:1},m=this.initData;if((!m||!m.length)&&(this.generateInitSegment(f),m=this.initData),!m||!m.length)return L.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),p;this.emitInitSegment&&(s.tracks=this.initTracks,this.emitInitSegment=!1),Object(I.isFiniteNumber)(o)||(this.initPTS=s.initPTS=o=_(m,f,i));var l=Object(D.getDuration)(f,m),a=i,r=l+a;Object(D.offsetStartDTS)(m,f,o),l>0?this.lastEndDTS=r:(L.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var e=!!m.audio,n=!!m.video,c="";e&&(c+="audio"),n&&(c+="video");var h={data1:f,startPTS:a,startDTS:a,endPTS:r,endDTS:r,type:c,hasAudio:e,hasVideo:n,nb:1,dropped:0};return p.audio=h.type==="audio"?h:void 0,p.video=h.type!=="audio"?h:void 0,p.text=d,p.id3=g,p.initSegment=s,p},y}(),_=function(T,O,x){return Object(D.getStartDTS)(T,O)-x};function C(y,T){var O=y==null?void 0:y.codec;return O&&O.length>4?O:O==="hvc1"?"hvc1.1.c.L120.90":O==="av01"?"av01.0.04M.08":O==="avc1"||T===E.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}M.default=R},"./src/task-loop.ts":function(Y,M,S){"use strict";S.r(M),S.d(M,"default",function(){return I});var I=function(){function D(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var E=D.prototype;return E.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},E.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},E.onHandlerDestroyed=function(){},E.hasInterval=function(){return!!this._tickInterval},E.hasNextTick=function(){return!!this._tickTimer},E.setInterval=function(R){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,R),!0)},E.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},E.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},E.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},E.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},E.doTick=function(){},D}()},"./src/types/cmcd.ts":function(Y,M,S){"use strict";S.r(M),S.d(M,"CMCDVersion",function(){return I}),S.d(M,"CMCDObjectType",function(){return D}),S.d(M,"CMCDStreamingFormat",function(){return E}),S.d(M,"CMCDStreamType",function(){return L});var I=1,D;(function(R){R.MANIFEST="m",R.AUDIO="a",R.VIDEO="v",R.MUXED="av",R.INIT="i",R.CAPTION="c",R.TIMED_TEXT="tt",R.KEY="k",R.OTHER="o"})(D||(D={}));var E;(function(R){R.DASH="d",R.HLS="h",R.SMOOTH="s",R.OTHER="o"})(E||(E={}));var L;(function(R){R.VOD="v",R.LIVE="l"})(L||(L={}))},"./src/types/level.ts":function(Y,M,S){"use strict";S.r(M),S.d(M,"HlsSkip",function(){return E}),S.d(M,"getSkipValue",function(){return L}),S.d(M,"HlsUrlParameters",function(){return R}),S.d(M,"Level",function(){return _});function I(C,y){for(var T=0;T<y.length;T++){var O=y[T];O.enumerable=O.enumerable||!1,O.configurable=!0,"value"in O&&(O.writable=!0),Object.defineProperty(C,O.key,O)}}function D(C,y,T){return y&&I(C.prototype,y),T&&I(C,T),C}var E;(function(C){C.No="",C.Yes="YES",C.v2="v2"})(E||(E={}));function L(C,y){var T=C.canSkipUntil,O=C.canSkipDateRanges,x=C.endSN,v=y!==void 0?y-x:0;return T&&v<T?O?E.v2:E.Yes:E.No}var R=function(){function C(T,O,x){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=T,this.part=O,this.skip=x}var y=C.prototype;return y.addDirectives=function(O){var x=new self.URL(O);return this.msn!==void 0&&x.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&x.searchParams.set("_HLS_part",this.part.toString()),this.skip&&x.searchParams.set("_HLS_skip",this.skip),x.toString()},C}(),_=function(){function C(y){this.attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.videoCodec=void 0,this.width=void 0,this.unknownCodecs=void 0,this.audioGroupIds=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.textGroupIds=void 0,this.url=void 0,this._urlId=0,this.url=[y.url],this.attrs=y.attrs,this.bitrate=y.bitrate,y.details&&(this.details=y.details),this.id=y.id||0,this.name=y.name,this.width=y.width||0,this.height=y.height||0,this.audioCodec=y.audioCodec,this.videoCodec=y.videoCodec,this.unknownCodecs=y.unknownCodecs,this.codecSet=[y.videoCodec,y.audioCodec].filter(function(T){return T}).join(",").replace(/\.[^.,]+/g,"")}return D(C,[{key:"maxBitrate",get:function(){return Math.max(this.realBitrate,this.bitrate)}},{key:"uri",get:function(){return this.url[this._urlId]||""}},{key:"urlId",get:function(){return this._urlId},set:function(T){var O=T%this.url.length;this._urlId!==O&&(this.details=void 0,this._urlId=O)}}]),C}()},"./src/types/loader.ts":function(Y,M,S){"use strict";S.r(M),S.d(M,"PlaylistContextType",function(){return I}),S.d(M,"PlaylistLevelType",function(){return D});var I;(function(E){E.MANIFEST="manifest",E.LEVEL="level",E.AUDIO_TRACK="audioTrack",E.SUBTITLE_TRACK="subtitleTrack"})(I||(I={}));var D;(function(E){E.MAIN="main",E.AUDIO="audio",E.SUBTITLE="subtitle"})(D||(D={}))},"./src/types/transmuxer.ts":function(Y,M,S){"use strict";S.r(M),S.d(M,"ChunkMetadata",function(){return I});var I=function(L,R,_,C,y,T){C===void 0&&(C=0),y===void 0&&(y=-1),T===void 0&&(T=!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=D(),this.buffering={audio:D(),video:D(),audiovideo:D()},this.level=L,this.sn=R,this.id=_,this.size=C,this.part=y,this.partial=T};function D(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(Y,M,S){"use strict";S.r(M),S.d(M,"AttrList",function(){return E});var I=/^(\d+)x(\d+)$/,D=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,E=function(){function L(_){typeof _=="string"&&(_=L.parseAttrList(_));for(var C in _)_.hasOwnProperty(C)&&(this[C]=_[C])}var R=L.prototype;return R.decimalInteger=function(C){var y=parseInt(this[C],10);return y>Number.MAX_SAFE_INTEGER?Infinity:y},R.hexadecimalInteger=function(C){if(this[C]){var y=(this[C]||"0x").slice(2);y=(y.length&1?"0":"")+y;for(var T=new Uint8Array(y.length/2),O=0;O<y.length/2;O++)T[O]=parseInt(y.slice(O*2,O*2+2),16);return T}else return null},R.hexadecimalIntegerAsNumber=function(C){var y=parseInt(this[C],16);return y>Number.MAX_SAFE_INTEGER?Infinity:y},R.decimalFloatingPoint=function(C){return parseFloat(this[C])},R.optionalFloat=function(C,y){var T=this[C];return T?parseFloat(T):y},R.enumeratedString=function(C){return this[C]},R.bool=function(C){return this[C]==="YES"},R.decimalResolution=function(C){var y=I.exec(this[C]);return y===null?void 0:{width:parseInt(y[1],10),height:parseInt(y[2],10)}},L.parseAttrList=function(C){var y,T={},O='"';for(D.lastIndex=0;(y=D.exec(C))!==null;){var x=y[2];x.indexOf(O)===0&&x.lastIndexOf(O)===x.length-1&&(x=x.slice(1,-1)),T[y[1]]=x}return T},L}()},"./src/utils/binary-search.ts":function(Y,M,S){"use strict";S.r(M);var I={search:function(E,L){for(var R=0,_=E.length-1,C=null,y=null;R<=_;){C=(R+_)/2|0,y=E[C];var T=L(y);if(T>0)R=C+1;else if(T<0)_=C-1;else return y}return null}};M.default=I},"./src/utils/buffer-helper.ts":function(Y,M,S){"use strict";S.r(M),S.d(M,"BufferHelper",function(){return E});var I=S("./src/utils/logger.ts"),D={length:0,start:function(){return 0},end:function(){return 0}},E=function(){function L(){}return L.isBuffered=function(_,C){try{if(_){for(var y=L.getBuffered(_),T=0;T<y.length;T++)if(C>=y.start(T)&&C<=y.end(T))return!0}}catch(O){}return!1},L.bufferInfo=function(_,C,y){try{if(_){var T=L.getBuffered(_),O=[],x;for(x=0;x<T.length;x++)O.push({start:T.start(x),end:T.end(x)});return this.bufferedInfo(O,C,y)}}catch(v){}return{len:0,start:C,end:C,nextStart:void 0}},L.bufferedInfo=function(_,C,y){C=Math.max(0,C),_.sort(function(s,m){var l=s.start-m.start;return l||m.end-s.end});var T=[];if(y)for(var O=0;O<_.length;O++){var x=T.length;if(x){var v=T[x-1].end;_[O].start-v<y?_[O].end>v&&(T[x-1].end=_[O].end):T.push(_[O])}else T.push(_[O])}else T=_;for(var g=0,d,t=C,o=C,i=0;i<T.length;i++){var p=T[i].start,f=T[i].end;if(C+y>=p&&C<f)t=p,o=f,g=o-C;else if(C+y<p){d=p;break}}return{len:g,start:t||0,end:o||0,nextStart:d}},L.getBuffered=function(_){try{return _.buffered}catch(C){return I.logger.log("failed to get media.buffered",C),D}},L}()},"./src/utils/cea-608-parser.ts":function(Y,M,S){"use strict";S.r(M),S.d(M,"Row",function(){return o}),S.d(M,"CaptionScreen",function(){return i});var I=S("./src/utils/logger.ts"),D={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},E=function(r){var e=r;return D.hasOwnProperty(r)&&(e=D[r]),String.fromCharCode(e)},L=15,R=100,_={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},C={17:2,18:4,21:6,22:8,23:10,19:13,20:15},y={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},T={25:2,26:4,29:6,30:8,31:10,27:13,28:15},O=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],x;(function(a){a[a.ERROR=0]="ERROR",a[a.TEXT=1]="TEXT",a[a.WARNING=2]="WARNING",a[a.INFO=2]="INFO",a[a.DEBUG=3]="DEBUG",a[a.DATA=3]="DATA"})(x||(x={}));var v=function(){function a(){this.time=null,this.verboseLevel=x.ERROR}var r=a.prototype;return r.log=function(n,c){this.verboseLevel>=n&&I.logger.log(this.time+" ["+n+"] "+c)},a}(),g=function(r){for(var e=[],n=0;n<r.length;n++)e.push(r[n].toString(16));return e},d=function(){function a(e,n,c,h,u){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=e||"white",this.underline=n||!1,this.italics=c||!1,this.background=h||"black",this.flash=u||!1}var r=a.prototype;return r.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},r.setStyles=function(n){for(var c=["foreground","underline","italics","background","flash"],h=0;h<c.length;h++){var u=c[h];n.hasOwnProperty(u)&&(this[u]=n[u])}},r.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},r.equals=function(n){return this.foreground===n.foreground&&this.underline===n.underline&&this.italics===n.italics&&this.background===n.background&&this.flash===n.flash},r.copy=function(n){this.foreground=n.foreground,this.underline=n.underline,this.italics=n.italics,this.background=n.background,this.flash=n.flash},r.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},a}(),t=function(){function a(e,n,c,h,u,b){this.uchar=void 0,this.penState=void 0,this.uchar=e||" ",this.penState=new d(n,c,h,u,b)}var r=a.prototype;return r.reset=function(){this.uchar=" ",this.penState.reset()},r.setChar=function(n,c){this.uchar=n,this.penState.copy(c)},r.setPenState=function(n){this.penState.copy(n)},r.equals=function(n){return this.uchar===n.uchar&&this.penState.equals(n.penState)},r.copy=function(n){this.uchar=n.uchar,this.penState.copy(n.penState)},r.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},a}(),o=function(){function a(e){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var n=0;n<R;n++)this.chars.push(new t);this.logger=e,this.pos=0,this.currPenState=new d}var r=a.prototype;return r.equals=function(n){for(var c=!0,h=0;h<R;h++)if(!this.chars[h].equals(n.chars[h])){c=!1;break}return c},r.copy=function(n){for(var c=0;c<R;c++)this.chars[c].copy(n.chars[c])},r.isEmpty=function(){for(var n=!0,c=0;c<R;c++)if(!this.chars[c].isEmpty()){n=!1;break}return n},r.setCursor=function(n){this.pos!==n&&(this.pos=n),this.pos<0?(this.logger.log(x.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>R&&(this.logger.log(x.DEBUG,"Too large cursor position "+this.pos),this.pos=R)},r.moveCursor=function(n){var c=this.pos+n;if(n>1)for(var h=this.pos+1;h<c+1;h++)this.chars[h].setPenState(this.currPenState);this.setCursor(c)},r.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},r.insertChar=function(n){n>=144&&this.backSpace();var c=E(n);if(this.pos>=R){this.logger.log(x.ERROR,"Cannot insert "+n.toString(16)+" ("+c+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(c,this.currPenState),this.moveCursor(1)},r.clearFromPos=function(n){var c;for(c=n;c<R;c++)this.chars[c].reset()},r.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},r.clearToEndOfRow=function(){this.clearFromPos(this.pos)},r.getTextString=function(){for(var n=[],c=!0,h=0;h<R;h++){var u=this.chars[h].uchar;u!==" "&&(c=!1),n.push(u)}return c?"":n.join("")},r.setPenStyles=function(n){this.currPenState.setStyles(n);var c=this.chars[this.pos];c.setPenState(this.currPenState)},a}(),i=function(){function a(e){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var n=0;n<L;n++)this.rows.push(new o(e));this.logger=e,this.currRow=L-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var r=a.prototype;return r.reset=function(){for(var n=0;n<L;n++)this.rows[n].clear();this.currRow=L-1},r.equals=function(n){for(var c=!0,h=0;h<L;h++)if(!this.rows[h].equals(n.rows[h])){c=!1;break}return c},r.copy=function(n){for(var c=0;c<L;c++)this.rows[c].copy(n.rows[c])},r.isEmpty=function(){for(var n=!0,c=0;c<L;c++)if(!this.rows[c].isEmpty()){n=!1;break}return n},r.backSpace=function(){var n=this.rows[this.currRow];n.backSpace()},r.clearToEndOfRow=function(){var n=this.rows[this.currRow];n.clearToEndOfRow()},r.insertChar=function(n){var c=this.rows[this.currRow];c.insertChar(n)},r.setPen=function(n){var c=this.rows[this.currRow];c.setPenStyles(n)},r.moveCursor=function(n){var c=this.rows[this.currRow];c.moveCursor(n)},r.setCursor=function(n){this.logger.log(x.INFO,"setCursor: "+n);var c=this.rows[this.currRow];c.setCursor(n)},r.setPAC=function(n){this.logger.log(x.INFO,"pacData = "+JSON.stringify(n));var c=n.row-1;if(this.nrRollUpRows&&c<this.nrRollUpRows-1&&(c=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==c){for(var h=0;h<L;h++)this.rows[h].clear();var u=this.currRow+1-this.nrRollUpRows,b=this.lastOutputScreen;if(b){var A=b.rows[u].cueStartTime,P=this.logger.time;if(A&&P!==null&&A<P)for(var w=0;w<this.nrRollUpRows;w++)this.rows[c-this.nrRollUpRows+w+1].copy(b.rows[u+w])}}this.currRow=c;var U=this.rows[this.currRow];if(n.indent!==null){var N=n.indent,F=Math.max(N-1,0);U.setCursor(n.indent),n.color=U.chars[F].penState.foreground}var K={foreground:n.color,underline:n.underline,italics:n.italics,background:"black",flash:!1};this.setPen(K)},r.setBkgData=function(n){this.logger.log(x.INFO,"bkgData = "+JSON.stringify(n)),this.backSpace(),this.setPen(n),this.insertChar(32)},r.setRollUpRows=function(n){this.nrRollUpRows=n},r.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(x.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(x.TEXT,this.getDisplayText());var n=this.currRow+1-this.nrRollUpRows,c=this.rows.splice(n,1)[0];c.clear(),this.rows.splice(this.currRow,0,c),this.logger.log(x.INFO,"Rolling up")},r.getDisplayText=function(n){n=n||!1;for(var c=[],h="",u=-1,b=0;b<L;b++){var A=this.rows[b].getTextString();A&&(u=b+1,n?c.push("Row "+u+": '"+A+"'"):c.push(A.trim()))}return c.length>0&&(n?h="["+c.join(" | ")+"]":h=c.join(`
|
|
`)),h},r.getTextAndFormat=function(){return this.rows},a}(),p=function(){function a(e,n,c){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=n,this.mode=null,this.verbose=0,this.displayedMemory=new i(c),this.nonDisplayedMemory=new i(c),this.lastOutputScreen=new i(c),this.currRollUpRow=this.displayedMemory.rows[L-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=c}var r=a.prototype;return r.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[L-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},r.getHandler=function(){return this.outputFilter},r.setHandler=function(n){this.outputFilter=n},r.setPAC=function(n){this.writeScreen.setPAC(n)},r.setBkgData=function(n){this.writeScreen.setBkgData(n)},r.setMode=function(n){if(n===this.mode)return;this.mode=n,this.logger.log(x.INFO,"MODE="+n),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=n},r.insertChars=function(n){for(var c=0;c<n.length;c++)this.writeScreen.insertChar(n[c]);var h=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(x.INFO,h+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(x.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},r.ccRCL=function(){this.logger.log(x.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},r.ccBS=function(){if(this.logger.log(x.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},r.ccAOF=function(){},r.ccAON=function(){},r.ccDER=function(){this.logger.log(x.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},r.ccRU=function(n){this.logger.log(x.INFO,"RU("+n+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(n)},r.ccFON=function(){this.logger.log(x.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},r.ccRDC=function(){this.logger.log(x.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},r.ccTR=function(){this.logger.log(x.INFO,"TR"),this.setMode("MODE_TEXT")},r.ccRTD=function(){this.logger.log(x.INFO,"RTD"),this.setMode("MODE_TEXT")},r.ccEDM=function(){this.logger.log(x.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},r.ccCR=function(){this.logger.log(x.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},r.ccENM=function(){this.logger.log(x.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},r.ccEOC=function(){if(this.logger.log(x.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var n=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=n,this.writeScreen=this.nonDisplayedMemory,this.logger.log(x.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},r.ccTO=function(n){this.logger.log(x.INFO,"TO("+n+") - Tab Offset"),this.writeScreen.moveCursor(n)},r.ccMIDROW=function(n){var c={flash:!1};if(c.underline=n%2===1,c.italics=n>=46,c.italics)c.foreground="white";else{var h=Math.floor(n/2)-16,u=["white","green","blue","cyan","red","yellow","magenta"];c.foreground=u[h]}this.logger.log(x.INFO,"MIDROW: "+JSON.stringify(c)),this.writeScreen.setPen(c)},r.outputDataUpdate=function(n){n===void 0&&(n=!1);var c=this.logger.time;if(c===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=c:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,c,this.lastOutputScreen),n&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:c),this.lastOutputScreen.copy(this.displayedMemory))},r.cueSplitAtTime=function(n){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,n,this.displayedMemory),this.cueStartTime=n))},a}(),f=function(){function a(e,n,c){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var h=new v;this.channels=[null,new p(e,n,h),new p(e+1,c,h)],this.cmdHistory=l(),this.logger=h}var r=a.prototype;return r.getHandler=function(n){return this.channels[n].getHandler()},r.setHandler=function(n,c){this.channels[n].setHandler(c)},r.addData=function(n,c){var h,u,b,A=!1;this.logger.time=n;for(var P=0;P<c.length;P+=2){if(u=c[P]&127,b=c[P+1]&127,u===0&&b===0)continue;if(this.logger.log(x.DATA,"["+g([c[P],c[P+1]])+"] -> ("+g([u,b])+")"),h=this.parseCmd(u,b),h||(h=this.parseMidrow(u,b)),h||(h=this.parsePAC(u,b)),h||(h=this.parseBackgroundAttributes(u,b)),!h&&(A=this.parseChars(u,b),A)){var w=this.currentChannel;if(w&&w>0){var U=this.channels[w];U.insertChars(A)}else this.logger.log(x.WARNING,"No channel found yet. TEXT-MODE?")}!h&&!A&&this.logger.log(x.WARNING,"Couldn't parse cleaned data "+g([u,b])+" orig: "+g([c[P],c[P+1]]))}},r.parseCmd=function(n,c){var h=this.cmdHistory,u=(n===20||n===28||n===21||n===29)&&c>=32&&c<=47,b=(n===23||n===31)&&c>=33&&c<=35;if(!(u||b))return!1;if(m(n,c,h))return s(null,null,h),this.logger.log(x.DEBUG,"Repeated command ("+g([n,c])+") is dropped"),!0;var A=n===20||n===21||n===23?1:2,P=this.channels[A];return n===20||n===21||n===28||n===29?c===32?P.ccRCL():c===33?P.ccBS():c===34?P.ccAOF():c===35?P.ccAON():c===36?P.ccDER():c===37?P.ccRU(2):c===38?P.ccRU(3):c===39?P.ccRU(4):c===40?P.ccFON():c===41?P.ccRDC():c===42?P.ccTR():c===43?P.ccRTD():c===44?P.ccEDM():c===45?P.ccCR():c===46?P.ccENM():c===47&&P.ccEOC():P.ccTO(c-32),s(n,c,h),this.currentChannel=A,!0},r.parseMidrow=function(n,c){var h=0;if((n===17||n===25)&&c>=32&&c<=47){if(n===17?h=1:h=2,h!==this.currentChannel)return this.logger.log(x.ERROR,"Mismatch channel in midrow parsing"),!1;var u=this.channels[h];return u?(u.ccMIDROW(c),this.logger.log(x.DEBUG,"MIDROW ("+g([n,c])+")"),!0):!1}return!1},r.parsePAC=function(n,c){var h,u=this.cmdHistory,b=(n>=17&&n<=23||n>=25&&n<=31)&&c>=64&&c<=127,A=(n===16||n===24)&&c>=64&&c<=95;if(!(b||A))return!1;if(m(n,c,u))return s(null,null,u),!0;var P=n<=23?1:2;c>=64&&c<=95?h=P===1?_[n]:y[n]:h=P===1?C[n]:T[n];var w=this.channels[P];return w?(w.setPAC(this.interpretPAC(h,c)),s(n,c,u),this.currentChannel=P,!0):!1},r.interpretPAC=function(n,c){var h,u={color:null,italics:!1,indent:null,underline:!1,row:n};return c>95?h=c-96:h=c-64,u.underline=(h&1)===1,h<=13?u.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(h/2)]:h<=15?(u.italics=!0,u.color="white"):u.indent=Math.floor((h-16)/2)*4,u},r.parseChars=function(n,c){var h,u=null,b=null;if(n>=25?(h=2,b=n-8):(h=1,b=n),b>=17&&b<=19){var A;b===17?A=c+80:b===18?A=c+112:A=c+144,this.logger.log(x.INFO,"Special char '"+E(A)+"' in channel "+h),u=[A]}else n>=32&&n<=127&&(u=c===0?[n]:[n,c]);if(u){var P=g(u);this.logger.log(x.DEBUG,"Char codes = "+P.join(",")),s(n,c,this.cmdHistory)}return u},r.parseBackgroundAttributes=function(n,c){var h=(n===16||n===24)&&c>=32&&c<=47,u=(n===23||n===31)&&c>=45&&c<=47;if(!(h||u))return!1;var b,A={};n===16||n===24?(b=Math.floor((c-32)/2),A.background=O[b],c%2===1&&(A.background=A.background+"_semi")):c===45?A.background="transparent":(A.foreground="black",c===47&&(A.underline=!0));var P=n<=23?1:2,w=this.channels[P];return w.setBkgData(A),s(n,c,this.cmdHistory),!0},r.reset=function(){for(var n=0;n<Object.keys(this.channels).length;n++){var c=this.channels[n];c&&c.reset()}this.cmdHistory=l()},r.cueSplitAtTime=function(n){for(var c=0;c<this.channels.length;c++){var h=this.channels[c];h&&h.cueSplitAtTime(n)}},a}();function s(a,r,e){e.a=a,e.b=r}function m(a,r,e){return e.a===a&&e.b===r}function l(){return{a:null,b:null}}M.default=f},"./src/utils/codecs.ts":function(Y,M,S){"use strict";S.r(M),S.d(M,"isCodecType",function(){return D}),S.d(M,"isCodecSupportedInMp4",function(){return E});var I={audio:{a3ds:!0,"ac-3":!0,"ac-4":!0,alac:!0,alaw:!0,dra1:!0,"dts+":!0,"dts-":!0,dtsc:!0,dtse:!0,dtsh:!0,"ec-3":!0,enca:!0,g719:!0,g726:!0,m4ae:!0,mha1:!0,mha2:!0,mhm1:!0,mhm2:!0,mlpa:!0,mp4a:!0,"raw ":!0,Opus:!0,samr:!0,sawb:!0,sawp:!0,sevc:!0,sqcp:!0,ssmv:!0,twos:!0,ulaw:!0},video:{avc1:!0,avc2:!0,avc3:!0,avc4:!0,avcp:!0,av01:!0,drac:!0,dvav:!0,dvhe:!0,encv:!0,hev1:!0,hvc1:!0,mjp2:!0,mp4v:!0,mvc1:!0,mvc2:!0,mvc3:!0,mvc4:!0,resv:!0,rv60:!0,s263:!0,svc1:!0,svc2:!0,"vc-1":!0,vp08:!0,vp09:!0},text:{stpp:!0,wvtt:!0}};function D(L,R){var _=I[R];return!!_&&_[L.slice(0,4)]===!0}function E(L,R){return MediaSource.isTypeSupported((R||"video")+'/mp4;codecs="'+L+'"')}},"./src/utils/cues.ts":function(Y,M,S){"use strict";S.r(M);var I=S("./src/utils/vttparser.ts"),D=S("./src/utils/webvtt-parser.ts"),E=S("./src/utils/texttrack-utils.ts"),L=/\s/,R={newCue:function(C,y,T,O){for(var x=[],v,g,d,t,o,i=self.VTTCue||self.TextTrackCue,p=0;p<O.rows.length;p++)if(v=O.rows[p],d=!0,t=0,o="",!v.isEmpty()){for(var f=0;f<v.chars.length;f++)L.test(v.chars[f].uchar)&&d?t++:(o+=v.chars[f].uchar,d=!1);v.cueStartTime=y,y===T&&(T+=1e-4),t>=16?t--:t++;var s=Object(I.fixLineBreaks)(o.trim()),m=Object(D.generateCueId)(y,T,s);(!C||!C.cues||!C.cues.getCueById(m))&&(g=new i(y,T,s),g.id=m,g.line=p+1,g.align="left",g.position=10+Math.min(80,Math.floor(t*8/32)*10),x.push(g))}return C&&x.length&&(x.sort(function(l,a){return l.line==="auto"||a.line==="auto"?0:l.line>8&&a.line>8?a.line-l.line:l.line-a.line}),x.forEach(function(l){return Object(E.addCueToTrack)(C,l)})),x}};M.default=R},"./src/utils/discontinuities.ts":function(Y,M,S){"use strict";S.r(M),S.d(M,"findFirstFragWithCC",function(){return L}),S.d(M,"shouldAlignOnDiscontinuities",function(){return R}),S.d(M,"findDiscontinuousReferenceFrag",function(){return _}),S.d(M,"adjustSlidingStart",function(){return y}),S.d(M,"alignStream",function(){return T}),S.d(M,"alignPDT",function(){return x}),S.d(M,"alignFragmentByPDTDelta",function(){return v}),S.d(M,"alignMediaPlaylistByPDT",function(){return g});var I=S("./src/polyfills/number.ts"),D=S("./src/utils/logger.ts"),E=S("./src/controller/level-helper.ts");function L(d,t){for(var o=null,i=0,p=d.length;i<p;i++){var f=d[i];if(f&&f.cc===t){o=f;break}}return o}function R(d,t,o){return!!(t.details&&(o.endCC>o.startCC||d&&d.cc<o.startCC))}function _(d,t){var o=d.fragments,i=t.fragments;if(!i.length||!o.length){D.logger.log("No fragments to align");return}var p=L(o,i[0].cc);if(!p||p&&!p.startPTS){D.logger.log("No frag in previous level to align on");return}return p}function C(d,t){if(d){var o=d.start+t;d.start=d.startPTS=o,d.endPTS=o+d.duration}}function y(d,t){for(var o=t.fragments,i=0,p=o.length;i<p;i++)C(o[i],d);t.fragmentHint&&C(t.fragmentHint,d),t.alignedSliding=!0}function T(d,t,o){if(!t)return;O(d,o,t),!o.alignedSliding&&t.details&&x(o,t.details),!o.alignedSliding&&t.details&&!o.skippedSegments&&Object(E.adjustSliding)(t.details,o)}function O(d,t,o){if(R(d,o,t)){var i=_(o.details,t);i&&Object(I.isFiniteNumber)(i.start)&&(D.logger.log("Adjusting PTS using last level due to CC increase within current level "+t.url),y(i.start,t))}}function x(d,t){if(!t.fragments.length||!d.hasProgramDateTime||!t.hasProgramDateTime)return;var o=t.fragments[0].programDateTime,i=d.fragments[0].programDateTime,p=(i-o)/1e3+t.fragments[0].start;p&&Object(I.isFiniteNumber)(p)&&(D.logger.log("Adjusting PTS using programDateTime delta "+(i-o)+"ms, sliding:"+p.toFixed(3)+" "+d.url+" "),y(p,d))}function v(d,t){var o=d.programDateTime;if(!o)return;var i=(o-t)/1e3;d.start=d.startPTS=i,d.endPTS=i+d.duration}function g(d,t){if(!t.fragments.length||!d.hasProgramDateTime||!t.hasProgramDateTime)return;var o=t.fragments[0].programDateTime,i=t.fragments[0].start,p=o-i*1e3;d.fragments.forEach(function(f){v(f,p)}),d.fragmentHint&&v(d.fragmentHint,p),d.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(Y,M,S){"use strict";S.r(M);var I=S("./src/utils/ewma.ts"),D=function(){function E(R,_,C){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=C,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new I.default(R),this.fast_=new I.default(_)}var L=E.prototype;return L.update=function(_,C){var y=this.slow_,T=this.fast_;this.slow_.halfLife!==_&&(this.slow_=new I.default(_,y.getEstimate(),y.getTotalWeight())),this.fast_.halfLife!==C&&(this.fast_=new I.default(C,T.getEstimate(),T.getTotalWeight()))},L.sample=function(_,C){_=Math.max(_,this.minDelayMs_);var y=8*C,T=_/1e3,O=y/T;this.fast_.sample(T,O),this.slow_.sample(T,O)},L.canEstimate=function(){var _=this.fast_;return _&&_.getTotalWeight()>=this.minWeight_},L.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},L.destroy=function(){},E}();M.default=D},"./src/utils/ewma.ts":function(Y,M,S){"use strict";S.r(M);var I=function(){function D(L,R,_){R===void 0&&(R=0),_===void 0&&(_=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=L,this.alpha_=L?Math.exp(Math.log(.5)/L):0,this.estimate_=R,this.totalWeight_=_}var E=D.prototype;return E.sample=function(R,_){var C=Math.pow(this.alpha_,R);this.estimate_=_*(1-C)+C*this.estimate_,this.totalWeight_+=R},E.getTotalWeight=function(){return this.totalWeight_},E.getEstimate=function(){if(this.alpha_){var R=1-Math.pow(this.alpha_,this.totalWeight_);if(R)return this.estimate_/R}return this.estimate_},D}();M.default=I},"./src/utils/fetch-loader.ts":function(Y,M,S){"use strict";S.r(M),S.d(M,"fetchSupported",function(){return v});var I=S("./src/polyfills/number.ts"),D=S("./src/loader/load-stats.ts"),E=S("./src/demux/chunk-cache.ts");function L(i,p){i.prototype=Object.create(p.prototype),i.prototype.constructor=i,T(i,p)}function R(i){var p=typeof Map=="function"?new Map:void 0;return R=function(s){if(s===null||!y(s))return s;if(typeof s!="function")throw new TypeError("Super expression must either be null or a function");if(typeof p!="undefined"){if(p.has(s))return p.get(s);p.set(s,m)}function m(){return _(s,arguments,O(this).constructor)}return m.prototype=Object.create(s.prototype,{constructor:{value:m,enumerable:!1,writable:!0,configurable:!0}}),T(m,s)},R(i)}function _(i,p,f){return C()?_=Reflect.construct:_=function(m,l,a){var r=[null];r.push.apply(r,l);var e=Function.bind.apply(m,r),n=new e;return a&&T(n,a.prototype),n},_.apply(null,arguments)}function C(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(i){return!1}}function y(i){return Function.toString.call(i).indexOf("[native code]")!==-1}function T(i,p){return T=Object.setPrototypeOf||function(s,m){return s.__proto__=m,s},T(i,p)}function O(i){return O=Object.setPrototypeOf?Object.getPrototypeOf:function(f){return f.__proto__||Object.getPrototypeOf(f)},O(i)}function x(){return x=Object.assign||function(i){for(var p=1;p<arguments.length;p++){var f=arguments[p];for(var s in f)Object.prototype.hasOwnProperty.call(f,s)&&(i[s]=f[s])}return i},x.apply(this,arguments)}function v(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(i){}return!1}var g=function(){function i(f){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=void 0,this.response=void 0,this.controller=void 0,this.context=void 0,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=f.fetchSetup||t,this.controller=new self.AbortController,this.stats=new D.LoadStats}var p=i.prototype;return p.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},p.abortInternal=function(){var s=this.response;(!s||!s.ok)&&(this.stats.aborted=!0,this.controller.abort())},p.abort=function(){var s;this.abortInternal(),(s=this.callbacks)!==null&&s!==void 0&&s.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},p.load=function(s,m,l){var a=this,r=this.stats;if(r.loading.start)throw new Error("Loader can only be used once.");r.loading.start=self.performance.now();var e=d(s,this.controller.signal),n=l.onProgress,c=s.responseType==="arraybuffer",h=c?"byteLength":"length";this.context=s,this.config=m,this.callbacks=l,this.request=this.fetchSetup(s,e),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){a.abortInternal(),l.onTimeout(r,s,a.response)},m.timeout),self.fetch(this.request).then(function(u){if(a.response=a.loader=u,!u.ok){var b=u.status,A=u.statusText;throw new o(A||"fetch, bad network response",b,u)}return r.loading.first=Math.max(self.performance.now(),r.loading.start),r.total=parseInt(u.headers.get("Content-Length")||"0"),n&&Object(I.isFiniteNumber)(m.highWaterMark)?a.loadProgressively(u,r,s,m.highWaterMark,n):c?u.arrayBuffer():u.text()}).then(function(u){var b=a.response;self.clearTimeout(a.requestTimeout),r.loading.end=Math.max(self.performance.now(),r.loading.first),r.loaded=r.total=u[h];var A={url:b.url,data:u};n&&!Object(I.isFiniteNumber)(m.highWaterMark)&&n(r,s,u,b),l.onSuccess(A,r,s,b)}).catch(function(u){if(self.clearTimeout(a.requestTimeout),r.aborted)return;var b=u.code||0;l.onError({code:b,text:u.message},s,u.details)})},p.getCacheAge=function(){var s=null;if(this.response){var m=this.response.headers.get("age");s=m?parseFloat(m):null}return s},p.loadProgressively=function(s,m,l,a,r){a===void 0&&(a=0);var e=new E.default,n=s.body.getReader(),c=function h(){return n.read().then(function(u){if(u.done)return e.dataLength&&r(m,l,e.flush(),s),Promise.resolve(new ArrayBuffer(0));var b=u.value,A=b.length;return m.loaded+=A,A<a||e.dataLength?(e.push(b),e.dataLength>=a&&r(m,l,e.flush(),s)):r(m,l,b,s),h()}).catch(function(){return Promise.reject()})};return c()},i}();function d(i,p){var f={method:"GET",mode:"cors",credentials:"same-origin",signal:p,headers:new self.Headers(x({},i.headers))};return i.rangeEnd&&f.headers.set("Range","bytes="+i.rangeStart+"-"+String(i.rangeEnd-1)),f}function t(i,p){return new self.Request(i.url,p)}var o=function(i){L(p,i);function p(f,s,m){var l;return l=i.call(this,f)||this,l.code=void 0,l.details=void 0,l.code=s,l.details=m,l}return p}(R(Error));M.default=g},"./src/utils/imsc1-ttml-parser.ts":function(Y,M,S){"use strict";S.r(M),S.d(M,"IMSC1_CODEC",function(){return y}),S.d(M,"parseIMSC1",function(){return v});var I=S("./src/utils/mp4-tools.ts"),D=S("./src/utils/vttparser.ts"),E=S("./src/utils/vttcue.ts"),L=S("./src/demux/id3.ts"),R=S("./src/utils/timescale-conversion.ts"),_=S("./src/utils/webvtt-parser.ts");function C(){return C=Object.assign||function(a){for(var r=1;r<arguments.length;r++){var e=arguments[r];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(a[n]=e[n])}return a},C.apply(this,arguments)}var y="stpp.ttml.im1t",T=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,O=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,x={left:"start",center:"center",right:"end",start:"start",end:"end"};function v(a,r,e,n,c){var h=Object(I.findBox)(new Uint8Array(a),["mdat"]);if(h.length===0){c(new Error("Could not parse IMSC1 mdat"));return}var u=h[0],b=Object(L.utf8ArrayToStr)(new Uint8Array(a,u.start,u.end-u.start)),A=Object(R.toTimescaleFromScale)(r,1,e);try{n(g(b,A))}catch(P){c(P)}}function g(a,r){var e=new DOMParser,n=e.parseFromString(a,"text/xml"),c=n.getElementsByTagName("tt")[0];if(!c)throw new Error("Invalid ttml");var h={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},u=Object.keys(h).reduce(function(U,N){return U[N]=c.getAttribute("ttp:"+N)||h[N],U},{}),b=c.getAttribute("xml:space")!=="preserve",A=t(d(c,"styling","style")),P=t(d(c,"layout","region")),w=d(c,"body","[begin]");return[].map.call(w,function(U){var N=o(U,b);if(!N||!U.hasAttribute("begin"))return null;var F=s(U.getAttribute("begin"),u),K=s(U.getAttribute("dur"),u),$=s(U.getAttribute("end"),u);if(F===null)throw f(U);if($===null){if(K===null)throw f(U);$=F+K}var X=new E.default(F-r,$-r,N);X.id=Object(_.generateCueId)(X.startTime,X.endTime,X.text);var oe=P[U.getAttribute("region")],pe=A[U.getAttribute("style")];X.position=10,X.size=80;var ee=i(oe,pe),de=ee.textAlign;if(de){var le=x[de];le&&(X.lineAlign=le),X.align=de}return C(X,ee),X}).filter(function(U){return U!==null})}function d(a,r,e){var n=a.getElementsByTagName(r)[0];return n?[].slice.call(n.querySelectorAll(e)):[]}function t(a){return a.reduce(function(r,e){var n=e.getAttribute("xml:id");return n&&(r[n]=e),r},{})}function o(a,r){return[].slice.call(a.childNodes).reduce(function(e,n,c){var h;return n.nodeName==="br"&&c?e+`
|
|
`:(h=n.childNodes)!==null&&h!==void 0&&h.length?o(n,r):r?e+n.textContent.trim().replace(/\s+/g," "):e+n.textContent},"")}function i(a,r){var e="http://www.w3.org/ns/ttml#styling",n=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return n.reduce(function(c,h){var u=p(r,e,h)||p(a,e,h);return u&&(c[h]=u),c},{})}function p(a,r,e){return a.hasAttributeNS(r,e)?a.getAttributeNS(r,e):null}function f(a){return new Error("Could not parse ttml timestamp "+a)}function s(a,r){if(!a)return null;var e=Object(D.parseTimeStamp)(a);return e===null&&(T.test(a)?e=m(a,r):O.test(a)&&(e=l(a,r))),e}function m(a,r){var e=T.exec(a),n=(e[4]|0)+(e[5]|0)/r.subFrameRate;return(e[1]|0)*3600+(e[2]|0)*60+(e[3]|0)+n/r.frameRate}function l(a,r){var e=O.exec(a),n=Number(e[1]),c=e[2];switch(c){case"h":return n*3600;case"m":return n*60;case"ms":return n*1e3;case"f":return n/r.frameRate;case"t":return n/r.tickRate}return n}},"./src/utils/logger.ts":function(Y,M,S){"use strict";S.r(M),S.d(M,"enableLogs",function(){return _}),S.d(M,"logger",function(){return C});var I=function(){},D={trace:I,debug:I,log:I,warn:I,info:I,error:I},E=D;function L(y){var T=self.console[y];return T?T.bind(self.console,"["+y+"] >"):I}function R(y){for(var T=arguments.length,O=new Array(T>1?T-1:0),x=1;x<T;x++)O[x-1]=arguments[x];O.forEach(function(v){E[v]=y[v]?y[v].bind(y):L(v)})}function _(y){if(self.console&&y===!0||typeof y=="object"){R(y,"debug","log","info","warn","error");try{E.log()}catch(T){E=D}}else E=D}var C=E},"./src/utils/mediakeys-helper.ts":function(Y,M,S){"use strict";S.r(M),S.d(M,"KeySystems",function(){return I}),S.d(M,"requestMediaKeySystemAccess",function(){return D});var I;(function(E){E.WIDEVINE="com.widevine.alpha",E.PLAYREADY="com.microsoft.playready"})(I||(I={}));var D=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(Y,M,S){"use strict";S.r(M),S.d(M,"getMediaSource",function(){return I});function I(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(Y,M,S){"use strict";S.r(M),S.d(M,"bin2str",function(){return R}),S.d(M,"readUint16",function(){return _}),S.d(M,"readUint32",function(){return C}),S.d(M,"writeUint32",function(){return y}),S.d(M,"findBox",function(){return T}),S.d(M,"parseSegmentIndex",function(){return O}),S.d(M,"parseInitSegment",function(){return x}),S.d(M,"getStartDTS",function(){return v}),S.d(M,"getDuration",function(){return g}),S.d(M,"computeRawDurationFromSamples",function(){return d}),S.d(M,"offsetStartDTS",function(){return t}),S.d(M,"segmentValidRange",function(){return o}),S.d(M,"appendUint8Array",function(){return i});var I=S("./src/utils/typed-array.ts"),D=S("./src/loader/fragment.ts"),E=Math.pow(2,32)-1,L=[].push;function R(p){return String.fromCharCode.apply(null,p)}function _(p,f){"data"in p&&(f+=p.start,p=p.data);var s=p[f]<<8|p[f+1];return s<0?65536+s:s}function C(p,f){"data"in p&&(f+=p.start,p=p.data);var s=p[f]<<24|p[f+1]<<16|p[f+2]<<8|p[f+3];return s<0?4294967296+s:s}function y(p,f,s){"data"in p&&(f+=p.start,p=p.data),p[f]=s>>24,p[f+1]=s>>16&255,p[f+2]=s>>8&255,p[f+3]=s&255}function T(p,f){var s=[];if(!f.length)return s;var m,l,a;"data"in p?(m=p.data,l=p.start,a=p.end):(m=p,l=0,a=m.byteLength);for(var r=l;r<a;){var e=C(m,r),n=R(m.subarray(r+4,r+8)),c=e>1?r+e:a;if(n===f[0])if(f.length===1)s.push({data:m,start:r+8,end:c});else{var h=T({data:m,start:r+8,end:c},f.slice(1));h.length&&L.apply(s,h)}r=c}return s}function O(p){var f=T(p,["moov"]),s=f[0],m=s?s.end:null,l=T(p,["sidx"]);if(!l||!l[0])return null;var a=[],r=l[0],e=r.data[0],n=e===0?8:16,c=C(r,n);n+=4;var h=0,u=0;e===0?n+=8:n+=16,n+=2;var b=r.end+u,A=_(r,n);n+=2;for(var P=0;P<A;P++){var w=n,U=C(r,w);w+=4;var N=U&2147483647,F=(U&2147483648)>>>31;if(F===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var K=C(r,w);w+=4,a.push({referenceSize:N,subsegmentDuration:K,info:{duration:K/c,start:b,end:b+N-1}}),b+=N,w+=4,n=w}return{earliestPresentationTime:h,timescale:c,version:e,referencesCount:A,references:a,moovEndOffset:m}}function x(p){for(var f=[],s=T(p,["moov","trak"]),m=0;m<s.length;m++){var l=s[m],a=T(l,["tkhd"])[0];if(a){var r=a.data[a.start],e=r===0?12:20,n=C(a,e),c=T(l,["mdia","mdhd"])[0];if(c){r=c.data[c.start],e=r===0?12:20;var h=C(c,e),u=T(l,["mdia","hdlr"])[0];if(u){var b=R(u.data.subarray(u.start+8,u.start+12)),A={soun:D.ElementaryStreamTypes.AUDIO,vide:D.ElementaryStreamTypes.VIDEO}[b];if(A){var P=T(l,["mdia","minf","stbl","stsd"])[0],w=void 0;P&&(w=R(P.data.subarray(P.start+12,P.start+16))),f[n]={timescale:h,type:A},f[A]={timescale:h,id:n,codec:w}}}}}}var U=T(p,["moov","mvex","trex"]);return U.forEach(function(N){var F=C(N,4),K=f[F];K&&(K.default={duration:C(N,12),flags:C(N,20)})}),f}function v(p,f){return T(f,["moof","traf"]).reduce(function(s,m){var l=T(m,["tfdt"])[0],a=l.data[l.start],r=T(m,["tfhd"]).reduce(function(e,n){var c=C(n,4),h=p[c];if(h){var u=C(l,4);a===1&&(u*=Math.pow(2,32),u+=C(l,8));var b=h.timescale||9e4,A=u/b;if(isFinite(A)&&(e===null||A<e))return A}return e},null);return r!==null&&isFinite(r)&&(s===null||r<s)?r:s},null)||0}function g(p,f){for(var s=0,m=0,l=0,a=T(p,["moof","traf"]),r=0;r<a.length;r++){var e=a[r],n=T(e,["tfhd"])[0],c=C(n,4),h=f[c];if(!h)continue;var u=h.default,b=C(n,0)|(u==null?void 0:u.flags),A=u==null?void 0:u.duration;b&8&&(b&2?A=C(n,12):A=C(n,8));for(var P=h.timescale||9e4,w=T(e,["trun"]),U=0;U<w.length;U++){if(A){var N=C(w[U],4);s=A*N}else s=d(w[U]);h.type===D.ElementaryStreamTypes.VIDEO?m+=s/P:h.type===D.ElementaryStreamTypes.AUDIO&&(l+=s/P)}}if(m===0&&l===0){var F=O(p);if(F!=null&&F.references)return F.references.reduce(function(K,$){return K+$.info.duration||0},0)}return m||l}function d(p){var f=C(p,0),s=8;f&1&&(s+=4),f&4&&(s+=4);for(var m=0,l=C(p,4),a=0;a<l;a++){if(f&256){var r=C(p,s);m+=r,s+=4}f&512&&(s+=4),f&1024&&(s+=4),f&2048&&(s+=4)}return m}function t(p,f,s){T(f,["moof","traf"]).forEach(function(m){T(m,["tfhd"]).forEach(function(l){var a=C(l,4),r=p[a];if(!r)return;var e=r.timescale||9e4;T(m,["tfdt"]).forEach(function(n){var c=n.data[n.start],h=C(n,4);if(c===0)y(n,4,h-s*e);else{h*=Math.pow(2,32),h+=C(n,8),h-=s*e,h=Math.max(h,0);var u=Math.floor(h/(E+1)),b=Math.floor(h%(E+1));y(n,4,u),y(n,8,b)}})})})}function o(p){var f={valid:null,remainder:null},s=T(p,["moof"]);if(s){if(s.length<2)return f.remainder=p,f}else return f;var m=s[s.length-1];return f.valid=Object(I.sliceUint8)(p,0,m.start-8),f.remainder=Object(I.sliceUint8)(p,m.start-8),f}function i(p,f){var s=new Uint8Array(p.length+f.length);return s.set(p),s.set(f,p.length),s}},"./src/utils/output-filter.ts":function(Y,M,S){"use strict";S.r(M),S.d(M,"default",function(){return I});var I=function(){function D(L,R){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=L,this.trackName=R}var E=D.prototype;return E.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},E.newCue=function(R,_,C){(this.startTime===null||this.startTime>R)&&(this.startTime=R),this.endTime=_,this.screen=C,this.timelineController.createCaptionsTrack(this.trackName)},E.reset=function(){this.cueRanges=[]},D}()},"./src/utils/texttrack-utils.ts":function(Y,M,S){"use strict";S.r(M),S.d(M,"sendAddTrackEvent",function(){return D}),S.d(M,"addCueToTrack",function(){return E}),S.d(M,"clearCurrentCues",function(){return L}),S.d(M,"removeCuesInRange",function(){return R}),S.d(M,"getCuesInRange",function(){return C});var I=S("./src/utils/logger.ts");function D(y,T){var O;try{O=new Event("addtrack")}catch(x){O=document.createEvent("Event"),O.initEvent("addtrack",!1,!1)}O.track=y,T.dispatchEvent(O)}function E(y,T){var O=y.mode;if(O==="disabled"&&(y.mode="hidden"),y.cues&&!y.cues.getCueById(T.id))try{if(y.addCue(T),!y.cues.getCueById(T.id))throw new Error("addCue is failed for: "+T)}catch(v){I.logger.debug("[texttrack-utils]: "+v);var x=new self.TextTrackCue(T.startTime,T.endTime,T.text);x.id=T.id,y.addCue(x)}O==="disabled"&&(y.mode=O)}function L(y){var T=y.mode;if(T==="disabled"&&(y.mode="hidden"),y.cues)for(var O=y.cues.length;O--;)y.removeCue(y.cues[O]);T==="disabled"&&(y.mode=T)}function R(y,T,O){var x=y.mode;if(x==="disabled"&&(y.mode="hidden"),y.cues&&y.cues.length>0)for(var v=C(y.cues,T,O),g=0;g<v.length;g++)y.removeCue(v[g]);x==="disabled"&&(y.mode=x)}function _(y,T){if(T<y[0].startTime)return 0;var O=y.length-1;if(T>y[O].endTime)return-1;for(var x=0,v=O;x<=v;){var g=Math.floor((v+x)/2);if(T<y[g].startTime)v=g-1;else if(T>y[g].startTime&&x<O)x=g+1;else return g}return y[x].startTime-T<T-y[v].startTime?x:v}function C(y,T,O){var x=[],v=_(y,T);if(v>-1)for(var g=v,d=y.length;g<d;g++){var t=y[g];if(t.startTime>=T&&t.endTime<=O)x.push(t);else if(t.startTime>O)return x}return x}},"./src/utils/time-ranges.ts":function(Y,M,S){"use strict";S.r(M);var I={toString:function(E){for(var L="",R=E.length,_=0;_<R;_++)L+="["+E.start(_).toFixed(3)+","+E.end(_).toFixed(3)+"]";return L}};M.default=I},"./src/utils/timescale-conversion.ts":function(Y,M,S){"use strict";S.r(M),S.d(M,"toTimescaleFromBase",function(){return D}),S.d(M,"toTimescaleFromScale",function(){return E}),S.d(M,"toMsFromMpegTsClock",function(){return L}),S.d(M,"toMpegTsClockFromTimescale",function(){return R});var I=9e4;function D(_,C,y,T){y===void 0&&(y=1),T===void 0&&(T=!1);var O=_*C*y;return T?Math.round(O):O}function E(_,C,y,T){return y===void 0&&(y=1),T===void 0&&(T=!1),D(_,C,1/y,T)}function L(_,C){return C===void 0&&(C=!1),D(_,1e3,1/I,C)}function R(_,C){return C===void 0&&(C=1),D(_,I,1/C)}},"./src/utils/typed-array.ts":function(Y,M,S){"use strict";S.r(M),S.d(M,"sliceUint8",function(){return I});function I(D,E,L){return Uint8Array.prototype.slice?D.slice(E,L):new Uint8Array(Array.prototype.slice.call(D,E,L))}},"./src/utils/vttcue.ts":function(Y,M,S){"use strict";S.r(M),M.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var I=["","lr","rl"],D=["start","middle","end","left","right"];function E(y,T){if(typeof T!="string")return!1;if(!Array.isArray(y))return!1;var O=T.toLowerCase();return~y.indexOf(O)?O:!1}function L(y){return E(I,y)}function R(y){return E(D,y)}function _(y){for(var T=arguments.length,O=new Array(T>1?T-1:0),x=1;x<T;x++)O[x-1]=arguments[x];for(var v=1;v<arguments.length;v++){var g=arguments[v];for(var d in g)y[d]=g[d]}return y}function C(y,T,O){var x=this,v={enumerable:!0};x.hasBeenReset=!1;var g="",d=!1,t=y,o=T,i=O,p=null,f="",s=!0,m="auto",l="start",a=50,r="middle",e=50,n="middle";Object.defineProperty(x,"id",_({},v,{get:function(){return g},set:function(h){g=""+h}})),Object.defineProperty(x,"pauseOnExit",_({},v,{get:function(){return d},set:function(h){d=!!h}})),Object.defineProperty(x,"startTime",_({},v,{get:function(){return t},set:function(h){if(typeof h!="number")throw new TypeError("Start time must be set to a number.");t=h,this.hasBeenReset=!0}})),Object.defineProperty(x,"endTime",_({},v,{get:function(){return o},set:function(h){if(typeof h!="number")throw new TypeError("End time must be set to a number.");o=h,this.hasBeenReset=!0}})),Object.defineProperty(x,"text",_({},v,{get:function(){return i},set:function(h){i=""+h,this.hasBeenReset=!0}})),Object.defineProperty(x,"region",_({},v,{get:function(){return p},set:function(h){p=h,this.hasBeenReset=!0}})),Object.defineProperty(x,"vertical",_({},v,{get:function(){return f},set:function(h){var u=L(h);if(u===!1)throw new SyntaxError("An invalid or illegal string was specified.");f=u,this.hasBeenReset=!0}})),Object.defineProperty(x,"snapToLines",_({},v,{get:function(){return s},set:function(h){s=!!h,this.hasBeenReset=!0}})),Object.defineProperty(x,"line",_({},v,{get:function(){return m},set:function(h){if(typeof h!="number"&&h!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");m=h,this.hasBeenReset=!0}})),Object.defineProperty(x,"lineAlign",_({},v,{get:function(){return l},set:function(h){var u=R(h);if(!u)throw new SyntaxError("An invalid or illegal string was specified.");l=u,this.hasBeenReset=!0}})),Object.defineProperty(x,"position",_({},v,{get:function(){return a},set:function(h){if(h<0||h>100)throw new Error("Position must be between 0 and 100.");a=h,this.hasBeenReset=!0}})),Object.defineProperty(x,"positionAlign",_({},v,{get:function(){return r},set:function(h){var u=R(h);if(!u)throw new SyntaxError("An invalid or illegal string was specified.");r=u,this.hasBeenReset=!0}})),Object.defineProperty(x,"size",_({},v,{get:function(){return e},set:function(h){if(h<0||h>100)throw new Error("Size must be between 0 and 100.");e=h,this.hasBeenReset=!0}})),Object.defineProperty(x,"align",_({},v,{get:function(){return n},set:function(h){var u=R(h);if(!u)throw new SyntaxError("An invalid or illegal string was specified.");n=u,this.hasBeenReset=!0}})),x.displayState=void 0}return C.prototype.getCueAsHTML=function(){var y=self.WebVTT;return y.convertCueToDOMTree(self,this.text)},C}()},"./src/utils/vttparser.ts":function(Y,M,S){"use strict";S.r(M),S.d(M,"parseTimeStamp",function(){return E}),S.d(M,"fixLineBreaks",function(){return T}),S.d(M,"VTTParser",function(){return O});var I=S("./src/utils/vttcue.ts"),D=function(){function x(){}var v=x.prototype;return v.decode=function(d,t){if(!d)return"";if(typeof d!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(d))},x}();function E(x){function v(d,t,o,i){return(d|0)*3600+(t|0)*60+(o|0)+parseFloat(i||0)}var g=x.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return g?parseFloat(g[2])>59?v(g[2],g[3],0,g[4]):v(g[1],g[2],g[3],g[4]):null}var L=function(){function x(){this.values=Object.create(null)}var v=x.prototype;return v.set=function(d,t){!this.get(d)&&t!==""&&(this.values[d]=t)},v.get=function(d,t,o){return o?this.has(d)?this.values[d]:t[o]:this.has(d)?this.values[d]:t},v.has=function(d){return d in this.values},v.alt=function(d,t,o){for(var i=0;i<o.length;++i)if(t===o[i]){this.set(d,t);break}},v.integer=function(d,t){/^-?\d+$/.test(t)&&this.set(d,parseInt(t,10))},v.percent=function(d,t){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(t)){var o=parseFloat(t);if(o>=0&&o<=100)return this.set(d,o),!0}return!1},x}();function R(x,v,g,d){var t=d?x.split(d):[x];for(var o in t){if(typeof t[o]!="string")continue;var i=t[o].split(g);if(i.length!==2)continue;var p=i[0],f=i[1];v(p,f)}}var _=new I.default(0,0,""),C=_.align==="middle"?"middle":"center";function y(x,v,g){var d=x;function t(){var p=E(x);if(p===null)throw new Error("Malformed timestamp: "+d);return x=x.replace(/^[^\sa-zA-Z-]+/,""),p}function o(p,f){var s=new L;R(p,function(a,r){var e;switch(a){case"region":for(var n=g.length-1;n>=0;n--)if(g[n].id===r){s.set(a,g[n].region);break}break;case"vertical":s.alt(a,r,["rl","lr"]);break;case"line":e=r.split(","),s.integer(a,e[0]),s.percent(a,e[0])&&s.set("snapToLines",!1),s.alt(a,e[0],["auto"]),e.length===2&&s.alt("lineAlign",e[1],["start",C,"end"]);break;case"position":e=r.split(","),s.percent(a,e[0]),e.length===2&&s.alt("positionAlign",e[1],["start",C,"end","line-left","line-right","auto"]);break;case"size":s.percent(a,r);break;case"align":s.alt(a,r,["start",C,"end","left","right"]);break}},/:/,/\s/),f.region=s.get("region",null),f.vertical=s.get("vertical","");var m=s.get("line","auto");m==="auto"&&_.line===-1&&(m=-1),f.line=m,f.lineAlign=s.get("lineAlign","start"),f.snapToLines=s.get("snapToLines",!0),f.size=s.get("size",100),f.align=s.get("align",C);var l=s.get("position","auto");l==="auto"&&_.position===50&&(l=f.align==="start"||f.align==="left"?0:f.align==="end"||f.align==="right"?100:50),f.position=l}function i(){x=x.replace(/^\s+/,"")}if(i(),v.startTime=t(),i(),x.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+d);x=x.substr(3),i(),v.endTime=t(),i(),o(x,v)}function T(x){return x.replace(/<br(?: \/)?>/gi,`
|
|
`)}var O=function(){function x(){this.state="INITIAL",this.buffer="",this.decoder=new D,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var v=x.prototype;return v.parse=function(d){var t=this;d&&(t.buffer+=t.decoder.decode(d,{stream:!0}));function o(){var l=t.buffer,a=0;for(l=T(l);a<l.length&&l[a]!=="\r"&&l[a]!==`
|
|
`;)++a;var r=l.substr(0,a);return l[a]==="\r"&&++a,l[a]===`
|
|
`&&++a,t.buffer=l.substr(a),r}function i(l){R(l,function(a,r){},/:/)}try{var p="";if(t.state==="INITIAL"){if(!/\r\n|\n/.test(t.buffer))return this;p=o();var f=p.match(/^()?WEBVTT([ \t].*)?$/);if(!f||!f[0])throw new Error("Malformed WebVTT signature.");t.state="HEADER"}for(var s=!1;t.buffer;){if(!/\r\n|\n/.test(t.buffer))return this;s?s=!1:p=o();switch(t.state){case"HEADER":/:/.test(p)?i(p):p||(t.state="ID");continue;case"NOTE":p||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(p)){t.state="NOTE";break}if(!p)continue;if(t.cue=new I.default(0,0,""),t.state="CUE",p.indexOf("-->")===-1){t.cue.id=p;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{y(p,t.cue,t.regionList)}catch(l){t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":{var m=p.indexOf("-->")!==-1;if(!p||m&&(s=!0)){t.oncue&&t.cue&&t.oncue(t.cue),t.cue=null,t.state="ID";continue}if(t.cue===null)continue;t.cue.text&&(t.cue.text+=`
|
|
`),t.cue.text+=p}continue;case"BADCUE":p||(t.state="ID")}}}catch(l){t.state==="CUETEXT"&&t.cue&&t.oncue&&t.oncue(t.cue),t.cue=null,t.state=t.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},v.flush=function(){var d=this;try{if((d.cue||d.state==="HEADER")&&(d.buffer+=`
|
|
|
|
`,d.parse()),d.state==="INITIAL"||d.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(t){d.onparsingerror&&d.onparsingerror(t)}return d.onflush&&d.onflush(),this},x}()},"./src/utils/webvtt-parser.ts":function(Y,M,S){"use strict";S.r(M),S.d(M,"generateCueId",function(){return O}),S.d(M,"parseWebVTT",function(){return v});var I=S("./src/polyfills/number.ts"),D=S("./src/utils/vttparser.ts"),E=S("./src/demux/id3.ts"),L=S("./src/utils/timescale-conversion.ts"),R=S("./src/remux/mp4-remuxer.ts"),_=/\r\n|\n\r|\n|\r/g,C=function(d,t,o){return o===void 0&&(o=0),d.substr(o,t.length)===t},y=function(d){var t=parseInt(d.substr(-3)),o=parseInt(d.substr(-6,2)),i=parseInt(d.substr(-9,2)),p=d.length>9?parseInt(d.substr(0,d.indexOf(":"))):0;if(!Object(I.isFiniteNumber)(t)||!Object(I.isFiniteNumber)(o)||!Object(I.isFiniteNumber)(i)||!Object(I.isFiniteNumber)(p))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+d);return t+=1e3*o,t+=60*1e3*i,t+=60*60*1e3*p,t},T=function(d){for(var t=5381,o=d.length;o;)t=t*33^d.charCodeAt(--o);return(t>>>0).toString()};function O(g,d,t){return T(g.toString())+T(d.toString())+T(t)}var x=function(d,t,o){var i=d[t],p=d[i.prevCC];if(!p||!p.new&&i.new){d.ccOffset=d.presentationOffset=i.start,i.new=!1;return}for(;(f=p)!==null&&f!==void 0&&f.new;){var f;d.ccOffset+=i.start-p.start,i.new=!1,i=p,p=d[i.prevCC]}d.presentationOffset=o};function v(g,d,t,o,i,p,f,s){var m=new D.VTTParser,l=Object(E.utf8ArrayToStr)(new Uint8Array(g)).trim().replace(_,`
|
|
`).split(`
|
|
`),a=[],r=Object(L.toMpegTsClockFromTimescale)(d,t),e="00:00.000",n=0,c=0,h,u=!0,b=!1;m.oncue=function(A){var P=o[i],w=o.ccOffset,U=(n-r)/9e4;if(P!=null&&P.new&&(c!==void 0?w=o.ccOffset=P.start:x(o,i,U)),U&&(w=U-o.presentationOffset),b){var N=A.endTime-A.startTime,F=Object(R.normalizePts)((A.startTime+w-c)*9e4,p*9e4)/9e4;A.startTime=F,A.endTime=F+N}var K=A.text.trim();A.text=decodeURIComponent(encodeURIComponent(K)),A.id||(A.id=O(A.startTime,A.endTime,K)),A.endTime>0&&a.push(A)},m.onparsingerror=function(A){h=A},m.onflush=function(){if(h){s(h);return}f(a)},l.forEach(function(A){if(u)if(C(A,"X-TIMESTAMP-MAP=")){u=!1,b=!0,A.substr(16).split(",").forEach(function(P){C(P,"LOCAL:")?e=P.substr(6):C(P,"MPEGTS:")&&(n=parseInt(P.substr(7)))});try{c=y(e)/1e3}catch(P){b=!1,h=P}return}else A===""&&(u=!1);m.parse(A+`
|
|
`)}),m.flush()}},"./src/utils/xhr-loader.ts":function(Y,M,S){"use strict";S.r(M);var I=S("./src/utils/logger.ts"),D=S("./src/loader/load-stats.ts"),E=/^age:\s*[\d.]+\s*$/m,L=function(){function R(C){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=void 0,this.loader=null,this.stats=void 0,this.xhrSetup=C?C.xhrSetup:null,this.stats=new D.LoadStats,this.retryDelay=0}var _=R.prototype;return _.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},_.abortInternal=function(){var y=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),y&&(y.onreadystatechange=null,y.onprogress=null,y.readyState!==4&&(this.stats.aborted=!0,y.abort()))},_.abort=function(){var y;this.abortInternal(),(y=this.callbacks)!==null&&y!==void 0&&y.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},_.load=function(y,T,O){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=y,this.config=T,this.callbacks=O,this.retryDelay=T.retryDelay,this.loadInternal()},_.loadInternal=function(){var y=this.config,T=this.context;if(!y)return;var O=this.loader=new self.XMLHttpRequest,x=this.stats;x.loading.first=0,x.loaded=0;var v=this.xhrSetup;try{if(v)try{v(O,T.url)}catch(t){O.open("GET",T.url,!0),v(O,T.url)}O.readyState||O.open("GET",T.url,!0);var g=this.context.headers;if(g)for(var d in g)O.setRequestHeader(d,g[d])}catch(t){this.callbacks.onError({code:O.status,text:t.message},T,O);return}T.rangeEnd&&O.setRequestHeader("Range","bytes="+T.rangeStart+"-"+(T.rangeEnd-1)),O.onreadystatechange=this.readystatechange.bind(this),O.onprogress=this.loadprogress.bind(this),O.responseType=T.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),y.timeout),O.send()},_.readystatechange=function(){var y=this.context,T=this.loader,O=this.stats;if(!y||!T)return;var x=T.readyState,v=this.config;if(O.aborted)return;if(x>=2)if(self.clearTimeout(this.requestTimeout),O.loading.first===0&&(O.loading.first=Math.max(self.performance.now(),O.loading.start)),x===4){T.onreadystatechange=null,T.onprogress=null;var g=T.status;if(g>=200&&g<300){O.loading.end=Math.max(self.performance.now(),O.loading.first);var d,t;if(y.responseType==="arraybuffer"?(d=T.response,t=d.byteLength):(d=T.responseText,t=d.length),O.loaded=O.total=t,!this.callbacks)return;var o=this.callbacks.onProgress;if(o&&o(O,y,d,T),!this.callbacks)return;var i={url:T.responseURL,data:d};this.callbacks.onSuccess(i,O,y,T)}else O.retry>=v.maxRetry||g>=400&&g<499?(I.logger.error(g+" while loading "+y.url),this.callbacks.onError({code:g,text:T.statusText},y,T)):(I.logger.warn(g+" while loading "+y.url+", retrying in "+this.retryDelay+"..."),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,v.maxRetryDelay),O.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),v.timeout)},_.loadtimeout=function(){I.logger.warn("timeout while loading "+this.context.url);var y=this.callbacks;y&&(this.abortInternal(),y.onTimeout(this.stats,this.context,this.loader))},_.loadprogress=function(y){var T=this.stats;T.loaded=y.loaded,y.lengthComputable&&(T.total=y.total)},_.getCacheAge=function(){var y=null;if(this.loader&&E.test(this.loader.getAllResponseHeaders())){var T=this.loader.getResponseHeader("age");y=T?parseFloat(T):null}return y},R}();M.default=L}}).default})},vHTk:function(Me,he,B){Me.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}},wCXF:function(Me,he,B){"use strict";B.d(he,"a",function(){return _e});var Y=B("rePB"),M=B("VTBJ"),S=B("KQm4"),I=B("U8pU"),D=B("ODXe"),E=B("cDcd"),L=B("TSYQ"),R=B.n(L),_=B("Gytx"),C=B.n(_),y=B("Kwbf"),T=B("t23M"),O=B("qx4F"),x=B("6eGT"),v=B("IBYe"),g=B("Ff2n"),d=B("c+Xe"),t=B("fyJ8"),o=B("biw7");function i(J,q,se,ce,Z){var ue=se[J]||{},V=se[q]||{},G,H;ue.fixed==="left"?G=ce.left[J]:V.fixed==="right"&&(H=ce.right[q]);var k=!1,j=!1,W=!1,z=!1,Q=se[q+1],ne=se[J-1];if(Z==="rtl"){if(G!==void 0){var ae=ne&&ne.fixed==="left";z=!ae}else if(H!==void 0){var ve=Q&&Q.fixed==="right";W=!ve}}else if(G!==void 0){var Oe=Q&&Q.fixed==="left";k=!Oe}else if(H!==void 0){var Ee=ne&&ne.fixed==="right";j=!Ee}return{fixLeft:G,fixRight:H,lastFixLeft:k,firstFixRight:j,lastFixRight:W,firstFixLeft:z,isSticky:ce.isSticky}}var p=B("sR1s");function f(J){var q=J.cells,se=J.stickyOffsets,ce=J.flattenColumns,Z=J.rowComponent,ue=J.cellComponent,V=J.onHeaderRow,G=J.index,H=E.useContext(o.a),k=H.prefixCls,j=H.direction,W;V&&(W=V(q.map(function(Q){return Q.column}),G));var z=Object(p.a)(q.map(function(Q){return Q.column}));return E.createElement(Z,Object.assign({},W),q.map(function(Q,ne){var ae=Q.column,ve=i(Q.colStart,Q.colEnd,ce,se,j),Oe;return ae&&ae.onHeaderCell&&(Oe=Q.column.onHeaderCell(ae)),E.createElement(t.a,Object.assign({},Q,{ellipsis:ae.ellipsis,align:ae.align,component:ue,prefixCls:k,key:z[ne]},ve,{additionalProps:Oe,rowType:"header"}))}))}f.displayName="HeaderRow";var s=f;function m(J){var q=[];function se(V,G){var H=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;q[H]=q[H]||[];var k=G,j=V.filter(Boolean).map(function(W){var z={key:W.key,className:W.className||"",children:W.title,column:W,colStart:k},Q=1,ne=W.children;return ne&&ne.length>0&&(Q=se(ne,k,H+1).reduce(function(ae,ve){return ae+ve},0),z.hasSubColumns=!0),"colSpan"in W&&(Q=W.colSpan),"rowSpan"in W&&(z.rowSpan=W.rowSpan),z.colSpan=Q,z.colEnd=z.colStart+Q-1,q[H].push(z),k+=Q,Q});return j}se(J,0);for(var ce=q.length,Z=function(G){q[G].forEach(function(H){!("rowSpan"in H)&&!H.hasSubColumns&&(H.rowSpan=ce-G)})},ue=0;ue<ce;ue+=1)Z(ue);return q}function l(J){var q=J.stickyOffsets,se=J.columns,ce=J.flattenColumns,Z=J.onHeaderRow,ue=E.useContext(o.a),V=ue.prefixCls,G=ue.getComponent,H=E.useMemo(function(){return m(se)},[se]),k=G(["header","wrapper"],"thead"),j=G(["header","row"],"tr"),W=G(["header","cell"],"th");return E.createElement(k,{className:"".concat(V,"-thead")},H.map(function(z,Q){var ne=E.createElement(s,{key:Q,flattenColumns:ce,cells:z,stickyOffsets:q,rowComponent:j,cellComponent:W,onHeaderRow:Z,index:Q});return ne}))}var a=l,r=B("hW8S");function e(J){for(var q=J.colWidths,se=J.columns,ce=J.columCount,Z=[],ue=ce||se.length,V=!1,G=ue-1;G>=0;G-=1){var H=q[G],k=se&&se[G],j=k&&k[r.a];(H||j||V)&&(Z.unshift(E.createElement("col",Object.assign({key:G,style:{width:H,minWidth:H}},j))),V=!0)}return E.createElement("colgroup",null,Z)}var n=e;function c(J,q){return Object(E.useMemo)(function(){for(var se=[],ce=0;ce<q;ce+=1){var Z=J[ce];if(Z!==void 0)se[ce]=Z;else return null}return se},[J.join("_"),q])}var h=E.forwardRef(function(J,q){var se=J.noData,ce=J.columns,Z=J.flattenColumns,ue=J.colWidths,V=J.columCount,G=J.stickyOffsets,H=J.direction,k=J.fixHeader,j=J.offsetHeader,W=J.stickyClassName,z=J.onScroll,Q=Object(g.a)(J,["noData","columns","flattenColumns","colWidths","columCount","stickyOffsets","direction","fixHeader","offsetHeader","stickyClassName","onScroll"]),ne=E.useContext(o.a),ae=ne.prefixCls,ve=ne.scrollbarSize,Oe=ne.isSticky,Ee=Oe&&!k?0:ve,Be=E.useRef(null),Ue=E.useCallback(function(Ve){Object(d.b)(q,Ve),Object(d.b)(Be,Ve)},[]);E.useEffect(function(){var Ve;function ze(Fe){var Xe=Fe.currentTarget,Qe=Fe.deltaX;Qe&&(z({currentTarget:Xe,scrollLeft:Xe.scrollLeft+Qe}),Fe.preventDefault())}return(Ve=Be.current)===null||Ve===void 0||Ve.addEventListener("wheel",ze),function(){var Fe;(Fe=Be.current)===null||Fe===void 0||Fe.removeEventListener("wheel",ze)}},[]);var ke=Z[Z.length-1],He={fixed:ke?ke.fixed:null,onHeaderCell:function(){return{className:"".concat(ae,"-cell-scrollbar")}}},Ke=Object(E.useMemo)(function(){return Ee?[].concat(Object(S.a)(ce),[He]):ce},[Ee,ce]),je=Object(E.useMemo)(function(){return Ee?[].concat(Object(S.a)(Z),[He]):Z},[Ee,Z]),$e=Object(E.useMemo)(function(){var Ve=G.right,ze=G.left;return Object(M.a)(Object(M.a)({},G),{},{left:H==="rtl"?[].concat(Object(S.a)(ze.map(function(Fe){return Fe+Ee})),[0]):ze,right:H==="rtl"?Ve:[].concat(Object(S.a)(Ve.map(function(Fe){return Fe+Ee})),[0]),isSticky:Oe})},[Ee,G,Oe]),Ne=c(ue,V);return E.createElement("div",{style:Object(M.a)({overflow:"hidden"},Oe?{top:j}:{}),ref:Ue,className:R()("".concat(ae,"-header"),Object(Y.a)({},W,!!W))},E.createElement("table",{style:{tableLayout:"fixed",visibility:se||Ne?null:"hidden"}},E.createElement(n,{colWidths:Ne?[].concat(Object(S.a)(Ne),[Ee]):[],columCount:V+1,columns:je}),E.createElement(a,Object.assign({},Q,{stickyOffsets:$e,columns:Ke,flattenColumns:je}))))});h.displayName="FixedHeader";var u=h,b=E.createContext(null),A=b;function P(J){var q=J.prefixCls,se=J.children,ce=J.component,Z=J.cellComponent,ue=J.fixHeader,V=J.fixColumn,G=J.horizonScroll,H=J.className,k=J.expanded,j=J.componentWidth,W=J.colSpan,z=E.useContext(o.a),Q=z.scrollbarSize;return E.useMemo(function(){var ne=se;return V&&(ne=E.createElement("div",{style:{width:j-(ue?Q:0),position:"sticky",left:0,overflow:"hidden"},className:"".concat(q,"-expanded-row-fixed")},ne)),E.createElement(ce,{className:H,style:{display:k?null:"none"}},E.createElement(t.a,{component:Z,prefixCls:q,colSpan:W},ne))},[se,ce,ue,G,H,k,j,W,Q])}var w=P;function U(J){var q=J.className,se=J.style,ce=J.record,Z=J.index,ue=J.rowKey,V=J.getRowKey,G=J.rowExpandable,H=J.expandedKeys,k=J.onRow,j=J.indent,W=j===void 0?0:j,z=J.rowComponent,Q=J.cellComponent,ne=J.childrenColumnName,ae=E.useContext(o.a),ve=ae.prefixCls,Oe=ae.fixedInfoList,Ee=E.useContext(A),Be=Ee.fixHeader,Ue=Ee.fixColumn,ke=Ee.horizonScroll,He=Ee.componentWidth,Ke=Ee.flattenColumns,je=Ee.expandableType,$e=Ee.expandRowByClick,Ne=Ee.onTriggerExpand,Ve=Ee.rowClassName,ze=Ee.expandedRowClassName,Fe=Ee.indentSize,Xe=Ee.expandIcon,Qe=Ee.expandedRowRender,tt=Ee.expandIconColumnIndex,Ye=E.useState(!1),_t=Object(D.a)(Ye,2),Ct=_t[0],Ot=_t[1],st=H&&H.has(J.recordKey);E.useEffect(function(){st&&Ot(!0)},[st]);var ut=je==="row"&&(!G||G(ce)),ht=je==="nest",mt=ne&&ce&&ce[ne],Dt=ut||ht,at;k&&(at=k(ce,Z));var yt=function(rt){if($e&&Dt&&Ne(ce,rt),at&&at.onClick){for(var it,et=arguments.length,dt=new Array(et>1?et-1:0),ct=1;ct<et;ct++)dt[ct-1]=arguments[ct];(it=at).onClick.apply(it,[rt].concat(dt))}},pt;typeof Ve=="string"?pt=Ve:typeof Ve=="function"&&(pt=Ve(ce,Z,W));var Bt=Object(p.a)(Ke),Rt=E.createElement(z,Object.assign({},at,{"data-row-key":ue,className:R()(q,"".concat(ve,"-row"),"".concat(ve,"-row-level-").concat(W),pt,at&&at.className),style:Object(M.a)(Object(M.a)({},se),at?at.style:null),onClick:yt}),Ke.map(function(qe,rt){var it=qe.render,et=qe.dataIndex,dt=qe.className,ct=Bt[rt],Lt=Oe[rt],bt;rt===(tt||0)&&ht&&(bt=E.createElement(E.Fragment,null,E.createElement("span",{style:{paddingLeft:"".concat(Fe*W,"px")},className:"".concat(ve,"-row-indent indent-level-").concat(W)}),Xe({prefixCls:ve,expanded:st,expandable:mt,record:ce,onExpand:Ne})));var wt;return qe.onCell&&(wt=qe.onCell(ce,Z)),E.createElement(t.a,Object.assign({className:dt,ellipsis:qe.ellipsis,align:qe.align,component:Q,prefixCls:ve,key:ct,record:ce,index:Z,dataIndex:et,render:it,shouldCellUpdate:qe.shouldCellUpdate},Lt,{appendNode:bt,additionalProps:wt}))})),gt;if(ut&&(Ct||st)){var Et=Qe(ce,Z,W+1,st),At=ze&&ze(ce,Z,W);gt=E.createElement(w,{expanded:st,className:R()("".concat(ve,"-expanded-row"),"".concat(ve,"-expanded-row-level-").concat(W+1),At),prefixCls:ve,fixHeader:Be,fixColumn:Ue,horizonScroll:ke,component:z,componentWidth:He,cellComponent:Q,colSpan:Ke.length},Et)}var Pt;return mt&&st&&(Pt=(ce[ne]||[]).map(function(qe,rt){var it=V(qe,rt);return E.createElement(U,Object.assign({},J,{key:it,rowKey:it,record:qe,recordKey:it,index:rt,indent:W+1}))})),E.createElement(E.Fragment,null,Rt,gt,Pt)}U.displayName="BodyRow";var N=U,F=E.createContext(null),K=F;function $(J){var q=J.columnKey,se=J.onColumnResize,ce=E.useRef();return E.useEffect(function(){ce.current&&se(q,ce.current.offsetWidth)},[]),E.createElement(T.a,{onResize:function(ue){var V=ue.offsetWidth;se(q,V)}},E.createElement("td",{ref:ce,style:{padding:0,border:0,height:0}},E.createElement("div",{style:{height:0,overflow:"hidden"}},"\xA0")))}function X(J){var q=J.data,se=J.getRowKey,ce=J.measureColumnWidth,Z=J.expandedKeys,ue=J.onRow,V=J.rowExpandable,G=J.emptyNode,H=J.childrenColumnName,k=E.useContext(K),j=k.onColumnResize,W=E.useContext(o.a),z=W.prefixCls,Q=W.getComponent,ne=E.useContext(A),ae=ne.fixHeader,ve=ne.horizonScroll,Oe=ne.flattenColumns,Ee=ne.componentWidth;return E.useMemo(function(){var Be=Q(["body","wrapper"],"tbody"),Ue=Q(["body","row"],"tr"),ke=Q(["body","cell"],"td"),He;q.length?He=q.map(function(je,$e){var Ne=se(je,$e);return E.createElement(N,{key:Ne,rowKey:Ne,record:je,recordKey:Ne,index:$e,rowComponent:Ue,cellComponent:ke,expandedKeys:Z,onRow:ue,getRowKey:se,rowExpandable:V,childrenColumnName:H})}):He=E.createElement(w,{expanded:!0,className:"".concat(z,"-placeholder"),prefixCls:z,fixHeader:ae,fixColumn:ve,horizonScroll:ve,component:Ue,componentWidth:Ee,cellComponent:ke,colSpan:Oe.length},G);var Ke=Object(p.a)(Oe);return E.createElement(Be,{className:"".concat(z,"-tbody")},ce&&E.createElement("tr",{"aria-hidden":"true",className:"".concat(z,"-measure-row"),style:{height:0}},Ke.map(function(je){return E.createElement($,{key:je,columnKey:je,onColumnResize:j})})),He)},[q,z,ue,ce,Z,se,Q,Ee,G,Oe])}var oe=E.memo(X);oe.displayName="Body";var pe=oe,ee=B("wRmb"),de=B("xEkU"),le=B.n(de);function re(J){var q=Object(E.useRef)(J),se=Object(E.useState)({}),ce=Object(D.a)(se,2),Z=ce[1],ue=Object(E.useRef)(null),V=Object(E.useRef)([]);function G(H){ue.current===null&&(V.current=[],ue.current=le()(function(){V.current.forEach(function(k){q.current=k(q.current)}),ue.current=null,Z({})})),V.current.push(H)}return Object(E.useEffect)(function(){return function(){le.a.cancel(ue.current)}},[]),[q.current,G]}function te(J){var q=Object(E.useRef)(J),se=Object(E.useRef)(null);function ce(){window.clearTimeout(se.current)}function Z(V){q.current=V,ce(),se.current=window.setTimeout(function(){q.current=null,se.current=null},100)}function ue(){return q.current}return Object(E.useEffect)(function(){return ce},[]),[Z,ue]}function Te(J,q,se){var ce=Object(E.useMemo)(function(){for(var Z=[],ue=[],V=0,G=0,H=0;H<q;H+=1)if(se==="rtl"){ue[H]=G,G+=J[H]||0;var k=q-H-1;Z[k]=V,V+=J[k]||0}else{Z[H]=V,V+=J[H]||0;var j=q-H-1;ue[j]=G,G+=J[j]||0}return{left:Z,right:ue}},[J,q,se]);return ce}var Ie=Te;function Ae(J){var q=J.className,se=J.children;return E.createElement("div",{className:q},se)}var De=Ae,fe=B("n6Qo");function ye(J){var q,se=J.prefixCls,ce=J.record,Z=J.onExpand,ue=J.expanded,V=J.expandable,G="".concat(se,"-row-expand-icon");if(!V)return E.createElement("span",{className:R()(G,"".concat(se,"-row-spaced"))});var H=function(j){Z(ce,j),j.stopPropagation()};return E.createElement("span",{className:R()(G,(q={},Object(Y.a)(q,"".concat(se,"-row-expanded"),ue),Object(Y.a)(q,"".concat(se,"-row-collapsed"),!ue),q)),onClick:H})}function xe(J,q,se){var ce=[];function Z(ue){(ue||[]).forEach(function(V,G){ce.push(q(V,G)),Z(V[se])})}return Z(J),ce}var be=B("zT1h"),ie=B("y0+3"),Se=function(q,se){var ce,Z,ue=q.scrollBodyRef,V=q.onScroll,G=q.offsetScroll,H=E.useContext(o.a),k=H.prefixCls,j=((ce=ue.current)===null||ce===void 0?void 0:ce.scrollWidth)||0,W=((Z=ue.current)===null||Z===void 0?void 0:Z.clientWidth)||0,z=j&&W*(W/j),Q=E.useRef(),ne=re({scrollLeft:0,isHiddenScrollBar:!1}),ae=Object(D.a)(ne,2),ve=ae[0],Oe=ae[1],Ee=E.useRef({delta:0,x:0}),Be=E.useState(!1),Ue=Object(D.a)(Be,2),ke=Ue[0],He=Ue[1],Ke=function(){He(!1)},je=function(Fe){Fe.persist(),Ee.current.delta=Fe.pageX-ve.scrollLeft,Ee.current.x=0,He(!0),Fe.preventDefault()},$e=function(Fe){var Xe,Qe=Fe||((Xe=window)===null||Xe===void 0?void 0:Xe.event),tt=Qe.buttons;if(!ke||tt===0){ke&&He(!1);return}var Ye=Ee.current.x+Fe.pageX-Ee.current.x-Ee.current.delta;Ye<=0&&(Ye=0),Ye+z>=W&&(Ye=W-z),V({scrollLeft:Ye/W*(j+2)}),Ee.current.x=Fe.pageX},Ne=function(){var Fe=Object(ie.b)(ue.current).top,Xe=Fe+ue.current.offsetHeight,Qe=document.documentElement.scrollTop+window.innerHeight;Xe-Object(O.a)()<=Qe||Fe>=Qe-G?Oe(function(tt){return Object(M.a)(Object(M.a)({},tt),{},{isHiddenScrollBar:!0})}):Oe(function(tt){return Object(M.a)(Object(M.a)({},tt),{},{isHiddenScrollBar:!1})})},Ve=function(Fe){Oe(function(Xe){return Object(M.a)(Object(M.a)({},Xe),{},{scrollLeft:Fe/j*W||0})})};return E.useImperativeHandle(se,function(){return{setScrollLeft:Ve}}),E.useEffect(function(){var ze=Object(be.a)(document.body,"mouseup",Ke,!1),Fe=Object(be.a)(document.body,"mousemove",$e,!1);return Ne(),function(){ze.remove(),Fe.remove()}},[z,ke]),E.useEffect(function(){var ze=Object(be.a)(window,"scroll",Ne,!1),Fe=Object(be.a)(window,"resize",Ne,!1);return function(){ze.remove(),Fe.remove()}},[]),E.useEffect(function(){ve.isHiddenScrollBar||Oe(function(ze){var Fe,Xe;return Object(M.a)(Object(M.a)({},ze),{},{scrollLeft:ue.current.scrollLeft/((Fe=ue.current)===null||Fe===void 0?void 0:Fe.scrollWidth)*((Xe=ue.current)===null||Xe===void 0?void 0:Xe.clientWidth)})})},[ve.isHiddenScrollBar]),j<=W||!z||ve.isHiddenScrollBar?null:E.createElement("div",{style:{height:Object(O.a)(),width:W,bottom:G},className:"".concat(k,"-sticky-scroll")},E.createElement("div",{onMouseDown:je,ref:Q,className:R()("".concat(k,"-sticky-scroll-bar"),Object(Y.a)({},"".concat(k,"-sticky-scroll-bar-active"),ke)),style:{width:"".concat(z,"px"),transform:"translate3d(".concat(ve.scrollLeft,"px, 0, 0)")}}))},ge=E.forwardRef(Se);function me(J,q){return E.useMemo(function(){var se=!!J;return{isSticky:se,stickyClassName:se?"".concat(q,"-sticky-header"):"",offsetHeader:Object(I.a)(J)==="object"&&J.offsetHeader||0,offsetScroll:Object(I.a)(J)==="object"&&J.offsetScroll||0}},[J,q])}var Ce=[],Le={},_e="rc-table-internal-hook",Re=E.memo(function(J){var q=J.children;return q},function(J,q){return C()(J.props,q.props)?J.pingLeft!==q.pingLeft||J.pingRight!==q.pingRight:!1});function Pe(J){var q,se=J.prefixCls,ce=J.className,Z=J.rowClassName,ue=J.style,V=J.data,G=J.rowKey,H=J.scroll,k=J.tableLayout,j=J.direction,W=J.title,z=J.footer,Q=J.summary,ne=J.id,ae=J.showHeader,ve=J.components,Oe=J.emptyText,Ee=J.onRow,Be=J.onHeaderRow,Ue=J.internalHooks,ke=J.transformColumns,He=J.internalRefs,Ke=J.sticky,je=V||Ce,$e=!!je.length,Ne=E.useState(0),Ve=Object(D.a)(Ne,2),ze=Ve[0],Fe=Ve[1];E.useEffect(function(){Fe(Object(O.a)())});var Xe=E.useMemo(function(){return Object(p.c)(ve,{})},[ve]),Qe=E.useCallback(function(We,Ge){return Object(p.b)(Xe,We)||Ge},[Xe]),tt=E.useMemo(function(){return typeof G=="function"?G:function(We){var Ge=We&&We[G];return Ge}},[G]),Ye=Object(r.c)(J),_t=Ye.expandIcon,Ct=Ye.expandedRowKeys,Ot=Ye.defaultExpandedRowKeys,st=Ye.defaultExpandAllRows,ut=Ye.expandedRowRender,ht=Ye.onExpand,mt=Ye.onExpandedRowsChange,Dt=Ye.expandRowByClick,at=Ye.rowExpandable,yt=Ye.expandIconColumnIndex,pt=Ye.expandedRowClassName,Bt=Ye.childrenColumnName,Rt=Ye.indentSize,gt=_t||ye,Et=Bt||"children",At=E.useMemo(function(){return ut?"row":J.expandable&&Ue===_e&&J.expandable.__PARENT_RENDER_ICON__||je.some(function(We){return We&&Object(I.a)(We)==="object"&&We[Et]})?"nest":!1},[!!ut,je]),Pt=E.useState(function(){return Ot||(st?xe(je,tt,Et):[])}),qe=Object(D.a)(Pt,2),rt=qe[0],it=qe[1],et=E.useMemo(function(){return new Set(Ct||rt||[])},[Ct,rt]),dt=E.useCallback(function(We){var Ge=tt(We,je.indexOf(We)),Ze,nt=et.has(Ge);nt?(et.delete(Ge),Ze=Object(S.a)(et)):Ze=[].concat(Object(S.a)(et),[Ge]),it(Ze),ht&&ht(!nt,We),mt&&mt(Ze)},[tt,et,je,ht,mt]),ct=E.useState(0),Lt=Object(D.a)(ct,2),bt=Lt[0],wt=Lt[1],pr=Object(ee.b)(Object(M.a)(Object(M.a)(Object(M.a)({},J),Ye),{},{expandable:!!ut,expandedKeys:et,getRowKey:tt,onTriggerExpand:dt,expandIcon:gt,expandIconColumnIndex:yt,direction:j}),Ue===_e?ke:null),Jt=Object(D.a)(pr,2),Ft=Jt[0],Je=Jt[1],It=E.useMemo(function(){return{columns:Ft,flattenColumns:Je}},[Ft,Je]),jt=E.useRef(),Qt=E.useRef(),ft=E.useRef(),gr=E.useState(!1),Zt=Object(D.a)(gr,2),qt=Zt[0],vr=Zt[1],yr=E.useState(!1),er=Object(D.a)(yr,2),tr=er[0],Er=er[1],br=re(new Map),rr=Object(D.a)(br,2),xr=rr[0],Tr=rr[1],Sr=Object(p.a)(Je),nr=Sr.map(function(We){return xr.get(We)}),ar=E.useMemo(function(){return nr},[nr.join("_")]),Mt=Ie(ar,Je.length,j),ot=H&&Object(p.d)(H.y),lt=H&&Object(p.d)(H.x),xt=lt&&Je.some(function(We){var Ge=We.fixed;return Ge}),ir=E.useRef(),kt=me(Ke,se),Tt=kt.isSticky,_r=kt.offsetHeader,Cr=kt.offsetScroll,Or=kt.stickyClassName,Kt,Ut,Wt;ot&&(Ut={overflowY:"scroll",maxHeight:H.y}),lt&&(Kt={overflowX:"auto"},ot||(Ut={overflowY:"hidden"}),Wt={width:H.x===!0?"auto":H.x,minWidth:"100%"});var or=E.useCallback(function(We,Ge){Tr(function(Ze){var nt=new Map(Ze);return nt.set(We,Ge),nt})},[]),Dr=te(null),sr=Object(D.a)(Dr,2),Rr=sr[0],lr=sr[1];function Ht(We,Ge){if(!Ge)return;typeof Ge=="function"?Ge(We):Ge.scrollLeft!==We&&(Ge.scrollLeft=We)}var vt=function(Ge){var Ze=Ge.currentTarget,nt=Ge.scrollLeft,St=typeof nt=="number"?nt:Ze.scrollLeft,mr=Ze||Le;if(!lr()||lr()===mr){var Yt;Rr(mr),Ht(St,Qt.current),Ht(St,ft.current),Ht(St,(Yt=ir.current)===null||Yt===void 0?void 0:Yt.setScrollLeft)}if(Ze){var kr=Ze.scrollWidth,Ur=Ze.clientWidth;vr(St>0),Er(St<kr-Ur)}},Gt=function(){ft.current&&vt({currentTarget:ft.current})},Ar=function(Ge){var Ze=Ge.width;Gt(),wt(jt.current?jt.current.offsetWidth:Ze)};E.useEffect(function(){return Gt},[]),E.useEffect(function(){lt&&Gt()},[lt]),E.useEffect(function(){Ue===_e&&He&&(He.body.current=ft.current)});var ur=Qe(["table"],"table"),Nt=E.useMemo(function(){return k||(xt?H.x==="max-content"?"auto":"fixed":ot||Je.some(function(We){var Ge=We.ellipsis;return Ge})?"fixed":"auto")},[ot,xt,Je,k]),zt,Vt={colWidths:ar,columCount:Je.length,stickyOffsets:Mt,onHeaderRow:Be,fixHeader:ot},Pr=E.useMemo(function(){return $e?null:typeof Oe=="function"?Oe():Oe},[$e,Oe]),dr=E.createElement(pe,{data:je,measureColumnWidth:ot||lt||Tt,expandedKeys:et,rowExpandable:at,getRowKey:tt,onRow:Ee,emptyNode:Pr,childrenColumnName:Et}),cr=E.createElement(n,{colWidths:Je.map(function(We){var Ge=We.width;return Ge}),columns:Je}),fr=Q&&E.createElement(fe.b,null,Q(je)),hr=Qe(["body"]);if(ot||Tt){var $t;typeof hr=="function"?($t=hr(je,{scrollbarSize:ze,ref:ft,onScroll:vt}),Vt.colWidths=Je.map(function(We,Ge){var Ze=We.width,nt=Ge===Ft.length-1?Ze-ze:Ze;return typeof nt=="number"&&!Number.isNaN(nt)?nt:(Object(y.a)(!1,"When use `components.body` with render props. Each column should have a fixed value."),0)})):$t=E.createElement("div",{style:Object(M.a)(Object(M.a)({},Kt),Ut),onScroll:vt,ref:ft,className:R()("".concat(se,"-body"))},E.createElement(ur,{style:Object(M.a)(Object(M.a)({},Wt),{},{tableLayout:Nt})},cr,dr,fr),Tt&&E.createElement(ge,{ref:ir,offsetScroll:Cr,scrollBodyRef:ft,onScroll:vt})),zt=E.createElement(E.Fragment,null,ae!==!1&&E.createElement(u,Object.assign({noData:!je.length},Vt,It,{direction:j,offsetHeader:_r,stickyClassName:Or,ref:Qt,onScroll:vt})),$t)}else zt=E.createElement("div",{style:Object(M.a)(Object(M.a)({},Kt),Ut),className:R()("".concat(se,"-content")),onScroll:vt,ref:ft},E.createElement(ur,{style:Object(M.a)(Object(M.a)({},Wt),{},{tableLayout:Nt})},cr,ae!==!1&&E.createElement(a,Object.assign({},Vt,It)),dr,fr));var Lr=Object(r.b)(J),Xt=E.createElement("div",Object.assign({className:R()(se,ce,(q={},Object(Y.a)(q,"".concat(se,"-rtl"),j==="rtl"),Object(Y.a)(q,"".concat(se,"-ping-left"),qt),Object(Y.a)(q,"".concat(se,"-ping-right"),tr),Object(Y.a)(q,"".concat(se,"-layout-fixed"),k==="fixed"),Object(Y.a)(q,"".concat(se,"-fixed-header"),ot),Object(Y.a)(q,"".concat(se,"-fixed-column"),xt),Object(Y.a)(q,"".concat(se,"-scroll-horizontal"),lt),Object(Y.a)(q,"".concat(se,"-has-fix-left"),Je[0]&&Je[0].fixed),Object(Y.a)(q,"".concat(se,"-has-fix-right"),Je[Je.length-1]&&Je[Je.length-1].fixed==="right"),q)),style:ue,id:ne,ref:jt},Lr),E.createElement(Re,{pingLeft:qt,pingRight:tr,props:Object(M.a)(Object(M.a)({},J),{},{stickyOffsets:Mt,mergedExpandedKeys:et})},W&&E.createElement(De,{className:"".concat(se,"-title")},W(je)),E.createElement("div",{className:"".concat(se,"-container")},zt),z&&E.createElement(De,{className:"".concat(se,"-footer")},z(je))));lt&&(Xt=E.createElement(T.a,{onResize:Ar},Xt));var wr=E.useMemo(function(){return{prefixCls:se,getComponent:Qe,scrollbarSize:ze,direction:j,fixedInfoList:Je.map(function(We,Ge){return i(Ge,Ge,Je,Mt,j)}),isSticky:Tt}},[se,Qe,ze,j,Je,Mt,j,Tt]),Ir=E.useMemo(function(){return Object(M.a)(Object(M.a)({},It),{},{tableLayout:Nt,rowClassName:Z,expandedRowClassName:pt,componentWidth:bt,fixHeader:ot,fixColumn:xt,horizonScroll:lt,expandIcon:gt,expandableType:At,expandRowByClick:Dt,expandedRowRender:ut,onTriggerExpand:dt,expandIconColumnIndex:yt,indentSize:Rt})},[It,Nt,Z,pt,bt,ot,xt,lt,gt,At,Dt,ut,dt,yt,Rt]),Mr=E.useMemo(function(){return{onColumnResize:or}},[or]);return E.createElement(o.a.Provider,{value:wr},E.createElement(A.Provider,{value:Ir},E.createElement(K.Provider,{value:Mr},Xt)))}Pe.Column=v.a,Pe.ColumnGroup=x.a,Pe.Summary=fe.a,Pe.defaultProps={rowKey:"key",prefixCls:"rc-table",emptyText:function(){return"No Data"}};var we=he.b=Pe},wRmb:function(Me,he,B){"use strict";B.d(he,"a",function(){return C});var Y=B("rePB"),M=B("KQm4"),S=B("VTBJ"),I=B("Ff2n"),D=B("cDcd"),E=B.n(D),L=B("Kwbf"),R=B("Zm9Q"),_=B("hW8S");function C(v){return Object(R.a)(v).filter(function(g){return D.isValidElement(g)}).map(function(g){var d=g.key,t=g.props,o=t.children,i=Object(I.a)(t,["children"]),p=Object(S.a)({key:d},i);return o&&(p.children=C(o)),p})}function y(v){return v.reduce(function(g,d){var t=d.fixed,o=t===!0?"left":t,i=d.children;return i&&i.length>0?[].concat(Object(M.a)(g),Object(M.a)(y(i).map(function(p){return Object(S.a)({fixed:o},p)}))):[].concat(Object(M.a)(g),[Object(S.a)(Object(S.a)({},d),{},{fixed:o})])},[])}function T(v){for(var g=!0,d=0;d<v.length;d+=1){var t=v[d];if(g&&t.fixed!=="left")g=!1;else if(!g&&t.fixed==="left"){Object(L.a)(!1,"Index ".concat(d-1," of `columns` missing `fixed='left'` prop."));break}}for(var o=!0,i=v.length-1;i>=0;i-=1){var p=v[i];if(o&&p.fixed!=="right")o=!1;else if(!o&&p.fixed==="right"){Object(L.a)(!1,"Index ".concat(i+1," of `columns` missing `fixed='right'` prop."));break}}}function O(v){return v.map(function(g){var d=g.fixed,t=Object(I.a)(g,["fixed"]),o=d;return d==="left"?o="right":d==="right"&&(o="left"),Object(S.a)({fixed:o},t)})}function x(v,g){var d=v.prefixCls,t=v.columns,o=v.children,i=v.expandable,p=v.expandedKeys,f=v.getRowKey,s=v.onTriggerExpand,m=v.expandIcon,l=v.rowExpandable,a=v.expandIconColumnIndex,r=v.direction,e=v.expandRowByClick,n=D.useMemo(function(){return t||C(o)},[t,o]),c=D.useMemo(function(){if(i){var b,A=a||0,P=n[A],w=(b={},Object(Y.a)(b,_.a,{className:"".concat(d,"-expand-icon-col")}),Object(Y.a)(b,"title",""),Object(Y.a)(b,"fixed",P?P.fixed:null),Object(Y.a)(b,"className","".concat(d,"-row-expand-icon-cell")),Object(Y.a)(b,"render",function(F,K,$){var X=f(K,$),oe=p.has(X),pe=l?l(K):!0,ee=m({prefixCls:d,expanded:oe,expandable:pe,record:K,onExpand:s});return e?D.createElement("span",{onClick:function(le){return le.stopPropagation()}},ee):ee}),b),U=n.slice();return A>=0&&U.splice(A,0,w),U}return n},[i,n,f,p,m,r]),h=D.useMemo(function(){var b=c;return g&&(b=g(b)),b.length||(b=[{render:function(){return null}}]),b},[g,c,r]),u=D.useMemo(function(){return r==="rtl"?O(y(h)):y(h)},[h,r]);return[h,u]}he.b=x},wwSX:function(Me,he,B){Me.exports=B.p+"static/b2.2c844a2a.svg"},"y0+3":function(Me,he,B){"use strict";B.d(he,"a",function(){return y}),B.d(he,"b",function(){return O});var Y=/margin|padding|width|height|max|min|offset/,M={left:!0,top:!0},S={cssFloat:1,styleFloat:1,float:1};function I(x){return x.nodeType===1?x.ownerDocument.defaultView.getComputedStyle(x,null):{}}function D(x,v,g){if(v=v.toLowerCase(),g==="auto"){if(v==="height")return x.offsetHeight;if(v==="width")return x.offsetWidth}return v in M||(M[v]=Y.test(v)),M[v]?parseFloat(g)||0:g}function E(x,v){var g=arguments.length,d=I(x);return v=S[v]?"cssFloat"in x.style?"cssFloat":"styleFloat":v,g===1?d:D(x,v,d[v]||x.style[v])}function L(x,v,g){var d=arguments.length;if(v=S[v]?"cssFloat"in x.style?"cssFloat":"styleFloat":v,d===3)return typeof g=="number"&&Y.test(v)&&(g="".concat(g,"px")),x.style[v]=g,g;for(var t in v)v.hasOwnProperty(t)&&L(x,t,v[t]);return I(x)}function R(x){return x===document.body?document.documentElement.clientWidth:x.offsetWidth}function _(x){return x===document.body?window.innerHeight||document.documentElement.clientHeight:x.offsetHeight}function C(){var x=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth),v=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight);return{width:x,height:v}}function y(){var x=document.documentElement.clientWidth,v=window.innerHeight||document.documentElement.clientHeight;return{width:x,height:v}}function T(){return{scrollLeft:Math.max(document.documentElement.scrollLeft,document.body.scrollLeft),scrollTop:Math.max(document.documentElement.scrollTop,document.body.scrollTop)}}function O(x){var v=x.getBoundingClientRect(),g=document.documentElement;return{left:v.left+(window.pageXOffset||g.scrollLeft)-(g.clientLeft||document.body.clientLeft||0),top:v.top+(window.pageYOffset||g.scrollTop)-(g.clientTop||document.body.clientTop||0)}}},zlzj:function(Me,he,B){Me.exports=B.p+"static/b3.30079151.svg"}}]);
|