(window.webpackJsonp=window.webpackJsonp||[]).push([[194,7,8],{"+NIl":function(Je,Be,H){(function(ne){ne(H("VrN/"))})(function(ne){"use strict";ne.defineMode("stex",function(G,D){"use strict";function K(S,b){S.cmdState.push(b)}function k(S){return S.cmdState.length>0?S.cmdState[S.cmdState.length-1]:null}function P(S){var b=S.cmdState.pop();b&&b.closeBracket()}function N(S){for(var b=S.cmdState,x=b.length-1;x>=0;x--){var f=b[x];if(f.name=="DEFAULT")continue;return f}return{styleIdentifier:function(){return null}}}function M(S,b,x){return function(){this.name=S,this.bracketNo=0,this.style=b,this.styles=x,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var O={};O.importmodule=M("importmodule","tag",["string","builtin"]),O.documentclass=M("documentclass","tag",["","atom"]),O.usepackage=M("usepackage","tag",["atom"]),O.begin=M("begin","tag",["atom"]),O.end=M("end","tag",["atom"]),O.label=M("label","tag",["atom"]),O.ref=M("ref","tag",["atom"]),O.eqref=M("eqref","tag",["atom"]),O.cite=M("cite","tag",["atom"]),O.bibitem=M("bibitem","tag",["atom"]),O.Bibitem=M("Bibitem","tag",["atom"]),O.RBibitem=M("RBibitem","tag",["atom"]),O.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function A(S,b){S.f=b}function T(S,b){var x;if(S.match(/^\\[a-zA-Z@]+/)){var f=S.current().slice(1);return x=O.hasOwnProperty(f)?O[f]:O.DEFAULT,x=new x,K(b,x),A(b,R),x.style}if(S.match(/^\\[$&%#{}_]/))return"tag";if(S.match(/^\\[,;!\/\\]/))return"tag";if(S.match("\\["))return A(b,function(i,c){return C(i,c,"\\]")}),"keyword";if(S.match("\\("))return A(b,function(i,c){return C(i,c,"\\)")}),"keyword";if(S.match("$$"))return A(b,function(i,c){return C(i,c,"$$")}),"keyword";if(S.match("$"))return A(b,function(i,c){return C(i,c,"$")}),"keyword";var l=S.next();if(l=="%")return S.skipToEnd(),"comment";if(l=="}"||l=="]"){if(x=k(b),x)x.closeBracket(l),A(b,R);else return"error";return"bracket"}else return l=="{"||l=="["?(x=O.DEFAULT,x=new x,K(b,x),"bracket"):/\d/.test(l)?(S.eatWhile(/[\w.%]/),"atom"):(S.eatWhile(/[\w\-_]/),x=N(b),x.name=="begin"&&(x.argument=S.current()),x.styleIdentifier())}function C(S,b,x){if(S.eatSpace())return null;if(x&&S.match(x))return A(b,T),"keyword";if(S.match(/^\\[a-zA-Z@]+/))return"tag";if(S.match(/^[a-zA-Z]+/))return"variable-2";if(S.match(/^\\[$&%#{}_]/))return"tag";if(S.match(/^\\[,;!\/]/))return"tag";if(S.match(/^[\^_&]/))return"tag";if(S.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(S.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var f=S.next();return f=="{"||f=="}"||f=="["||f=="]"||f=="("||f==")"?"bracket":f=="%"?(S.skipToEnd(),"comment"):"error"}function R(S,b){var x=S.peek(),f;return x=="{"||x=="["?(f=k(b),f.openBracket(x),S.eat(x),A(b,T),"bracket"):/[ \t\r]/.test(x)?(S.eat(x),null):(A(b,T),P(b),T(S,b))}return{startState:function(){var S=D.inMathMode?function(b,x){return C(b,x)}:T;return{cmdState:[],f:S}},copyState:function(S){return{cmdState:S.cmdState.slice(),f:S.f}},token:function(S,b){return b.f(S,b)},blankLine:function(S){S.f=T,S.cmdState.length=0},lineComment:"%"}}),ne.defineMIME("text/x-stex","stex"),ne.defineMIME("text/x-latex","stex")})},"+RXH":function(Je,Be,H){Je.exports=H.p+"static/shu.a39bf729.svg"},"+yhJ":function(Je,Be,H){Je.exports=H.p+"static/xixi.d492fb65.svg"},"0eGx":function(Je,Be,H){Je.exports=H.p+"static/zhong.c1924b73.svg"},"19Vz":function(Je,Be,H){(function(ne){ne(H("VrN/"))})(function(ne){ne.defineOption("placeholder","",function(M,O,A){var T=A&&A!=ne.Init;if(O&&!T)M.on("blur",k),M.on("change",P),M.on("swapDoc",P),ne.on(M.getInputField(),"compositionupdate",M.state.placeholderCompose=function(){K(M)}),P(M);else if(!O&&T){M.off("blur",k),M.off("change",P),M.off("swapDoc",P),ne.off(M.getInputField(),"compositionupdate",M.state.placeholderCompose),G(M);var C=M.getWrapperElement();C.className=C.className.replace(" CodeMirror-empty","")}O&&!M.hasFocus()&&k(M)});function G(M){M.state.placeholder&&(M.state.placeholder.parentNode.removeChild(M.state.placeholder),M.state.placeholder=null)}function D(M){G(M);var O=M.state.placeholder=document.createElement("pre");O.style.cssText="height: 0; overflow: visible",O.style.direction=M.getOption("direction"),O.className="CodeMirror-placeholder CodeMirror-line-like";var A=M.getOption("placeholder");typeof A=="string"&&(A=document.createTextNode(A)),O.appendChild(A),M.display.lineSpace.insertBefore(O,M.display.lineSpace.firstChild)}function K(M){setTimeout(function(){var O=!1,A=M.getInputField();A.nodeName=="TEXTAREA"?O=!A.value:M.lineCount()==1&&(O=!/[^\u200b]/.test(A.querySelector(".CodeMirror-line").textContent)),O?D(M):G(M)},20)}function k(M){N(M)&&D(M)}function P(M){var O=M.getWrapperElement(),A=N(M);O.className=O.className.replace(" CodeMirror-empty","")+(A?" CodeMirror-empty":""),A?D(M):G(M)}function N(M){return M.lineCount()===1&&M.getLine(0)===""}})},"1eCo":function(Je,Be,H){(function(ne){ne(H("VrN/"))})(function(ne){"use strict";var G={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},D={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};ne.defineMode("xml",function(K,k){var P=K.indentUnit,N={},M=k.htmlMode?G:D;for(var O in M)N[O]=M[O];for(var O in k)N[O]=k[O];var A,T;function C(o,g){function p(F){return g.tokenize=F,F(o,g)}var E=o.next();if(E=="<")return o.eat("!")?o.eat("[")?o.match("CDATA[")?p(b("atom","]]>")):null:o.match("--")?p(b("comment","-->")):o.match("DOCTYPE",!0,!0)?(o.eatWhile(/[\w\._\-]/),p(x(1))):null:o.eat("?")?(o.eatWhile(/[\w\._\-]/),g.tokenize=b("meta","?>"),"meta"):(A=o.eat("/")?"closeTag":"openTag",g.tokenize=R,"tag bracket");if(E=="&"){var L;return o.eat("#")?o.eat("x")?L=o.eatWhile(/[a-fA-F\d]/)&&o.eat(";"):L=o.eatWhile(/[\d]/)&&o.eat(";"):L=o.eatWhile(/[\w\.\-:]/)&&o.eat(";"),L?"atom":"error"}else return o.eatWhile(/[^&<]/),null}C.isInText=!0;function R(o,g){var p=o.next();if(p==">"||p=="/"&&o.eat(">"))return g.tokenize=C,A=p==">"?"endTag":"selfcloseTag","tag bracket";if(p=="=")return A="equals",null;if(p=="<"){g.tokenize=C,g.state=c,g.tagName=g.tagStart=null;var E=g.tokenize(o,g);return E?E+" tag error":"tag error"}else return/[\'\"]/.test(p)?(g.tokenize=S(p),g.stringStartCol=o.column(),g.tokenize(o,g)):(o.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function S(o){var g=function(p,E){for(;!p.eol();)if(p.next()==o){E.tokenize=R;break}return"string"};return g.isInAttribute=!0,g}function b(o,g){return function(p,E){for(;!p.eol();){if(p.match(g)){E.tokenize=C;break}p.next()}return o}}function x(o){return function(g,p){for(var E;(E=g.next())!=null;){if(E=="<")return p.tokenize=x(o+1),p.tokenize(g,p);if(E==">")if(o==1){p.tokenize=C;break}else return p.tokenize=x(o-1),p.tokenize(g,p)}return"meta"}}function f(o,g,p){this.prev=o.context,this.tagName=g,this.indent=o.indented,this.startOfLine=p,(N.doNotIndent.hasOwnProperty(g)||o.context&&o.context.noIndent)&&(this.noIndent=!0)}function l(o){o.context&&(o.context=o.context.prev)}function i(o,g){for(var p;;){if(!o.context)return;if(p=o.context.tagName,!N.contextGrabbers.hasOwnProperty(p)||!N.contextGrabbers[p].hasOwnProperty(g))return;l(o)}}function c(o,g,p){return o=="openTag"?(p.tagStart=g.column(),_):o=="closeTag"?v:c}function _(o,g,p){return o=="word"?(p.tagName=g.current(),T="tag",y):N.allowMissingTagName&&o=="endTag"?(T="tag bracket",y(o,g,p)):(T="error",_)}function v(o,g,p){if(o=="word"){var E=g.current();return p.context&&p.context.tagName!=E&&N.implicitlyClosed.hasOwnProperty(p.context.tagName)&&l(p),p.context&&p.context.tagName==E||N.matchClosing===!1?(T="tag",m):(T="tag error",u)}else return N.allowMissingTagName&&o=="endTag"?(T="tag bracket",m(o,g,p)):(T="error",u)}function m(o,g,p){return o!="endTag"?(T="error",m):(l(p),c)}function u(o,g,p){return T="error",m(o,g,p)}function y(o,g,p){if(o=="word")return T="attribute",d;if(o=="endTag"||o=="selfcloseTag"){var E=p.tagName,L=p.tagStart;return p.tagName=p.tagStart=null,o=="selfcloseTag"||N.autoSelfClosers.hasOwnProperty(E)?i(p,E):(i(p,E),p.context=new f(p,E,L==p.indented)),c}return T="error",y}function d(o,g,p){return o=="equals"?h:(N.allowMissing||(T="error"),y(o,g,p))}function h(o,g,p){return o=="string"?s:o=="word"&&N.allowUnquoted?(T="string",y):(T="error",y(o,g,p))}function s(o,g,p){return o=="string"?s:y(o,g,p)}return{startState:function(o){var g={tokenize:C,state:c,indented:o||0,tagName:null,tagStart:null,context:null};return o!=null&&(g.baseIndent=o),g},token:function(o,g){if(!g.tagName&&o.sol()&&(g.indented=o.indentation()),o.eatSpace())return null;A=null;var p=g.tokenize(o,g);return(p||A)&&p!="comment"&&(T=null,g.state=g.state(A||p,o,g),T&&(p=T=="error"?p+" error":T)),p},indent:function(o,g,p){var E=o.context;if(o.tokenize.isInAttribute)return o.tagStart==o.indented?o.stringStartCol+1:o.indented+P;if(E&&E.noIndent)return ne.Pass;if(o.tokenize!=R&&o.tokenize!=C)return p?p.match(/^(\s*)/)[0].length:0;if(o.tagName)return N.multilineTagIndentPastTag!==!1?o.tagStart+o.tagName.length+2:o.tagStart+P*(N.multilineTagIndentFactor||1);if(N.alignCDATA&&/$/,blockCommentStart:"",configuration:N.htmlMode?"html":"xml",helperType:N.htmlMode?"html":"xml",skipAttribute:function(o){o.state==h&&(o.state=y)},xmlCurrentTag:function(o){return o.tagName?{name:o.tagName,close:o.type=="closeTag"}:null},xmlCurrentContext:function(o){for(var g=[],p=o.context;p;p=p.prev)p.tagName&&g.push(p.tagName);return g.reverse()}}}),ne.defineMIME("text/xml","xml"),ne.defineMIME("application/xml","xml"),ne.mimeModes.hasOwnProperty("text/html")||ne.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"2sxD":function(Je,Be,H){Je.exports={list:"list___3_VOx",head:"head___37dUf",name:"name___1VbnU",right:"right___gDdSx",body:"body___1wO_8",top:"top___cjRoo",bottom:"bottom___O44ku",l:"l___3de2t",ListGroup:"ListGroup___22jzr",a:"a___3Rx6Z",b:"b___S9Ybp",c:"c___3CVXw",c1:"c1___3b8Zq",radio:"radio___LnwQZ",d:"d___2-cs-"}},"51dB":function(Je,Be,H){Je.exports=H.p+"static/sc.c1696770.svg"},"5MlY":function(Je,Be,H){Je.exports=H.p+"static/sm.8ccb50bf.svg"},"6+eU":function(Je,Be,H){"use strict";H.d(Be,"a",function(){return m});var ne=H("wx14"),G=H("rePB"),D=H("VTBJ"),K=H("1OyB"),k=H("vuIU"),P=H("Ji7U"),N=H("LK+K"),M=H("cDcd"),O=H.n(M),A=H("TSYQ"),T=H.n(A),C=function(y){var d,h="".concat(y.rootPrefixCls,"-item"),s=T()(h,"".concat(h,"-").concat(y.page),(d={},Object(G.a)(d,"".concat(h,"-active"),y.active),Object(G.a)(d,y.className,!!y.className),Object(G.a)(d,"".concat(h,"-disabled"),!y.page),d)),o=function(){y.onClick(y.page)},g=function(E){y.onKeyPress(E,y.onClick,y.page)};return O.a.createElement("li",{title:y.showTitle?y.page:null,className:s,onClick:o,onKeyPress:g,tabIndex:"0"},y.itemRender(y.page,"page",O.a.createElement("a",{rel:"nofollow"},y.page)))},R=C,S={ZERO:48,NINE:57,NUMPAD_ZERO:96,NUMPAD_NINE:105,BACKSPACE:8,DELETE:46,ENTER:13,ARROW_UP:38,ARROW_DOWN:40},b=function(u){Object(P.a)(d,u);var y=Object(N.a)(d);function d(){var h;Object(K.a)(this,d);for(var s=arguments.length,o=new Array(s),g=0;g=0||p.relatedTarget.className.indexOf("".concat(j,"-next"))>=0))return;h.setState({goInputText:""}),F(h.getValidValue())},h.go=function(p){var E=h.state.goInputText;if(E==="")return;(p.keyCode===S.ENTER||p.type==="click")&&(h.setState({goInputText:""}),h.props.quickGo(h.getValidValue()))},h}return Object(k.a)(d,[{key:"getValidValue",value:function(){var s=this.state,o=s.goInputText,g=s.current;return!o||isNaN(o)?g:Number(o)}},{key:"getPageSizeOptions",value:function(){var s=this.props,o=s.pageSize,g=s.pageSizeOptions;return g.some(function(p){return p.toString()===o.toString()})?g:g.concat([o.toString()]).sort(function(p,E){var L=isNaN(Number(p))?0:Number(p),F=isNaN(Number(E))?0:Number(E);return L-F})}},{key:"render",value:function(){var s=this,o=this.props,g=o.pageSize,p=o.locale,E=o.rootPrefixCls,L=o.changeSize,F=o.quickGo,j=o.goButton,V=o.selectComponentClass,B=o.buildOptionText,I=o.selectPrefixCls,$=o.disabled,ie=this.state.goInputText,ue="".concat(E,"-options"),fe=V,ve=null,pe=null,te=null;if(!L&&!F)return null;var ee=this.getPageSizeOptions();if(L&&fe){var se=ee.map(function(Q,J){return O.a.createElement(fe.Option,{key:J,value:Q.toString()},(B||s.buildOptionText)(Q))});ve=O.a.createElement(fe,{disabled:$,prefixCls:I,showSearch:!1,className:"".concat(ue,"-size-changer"),optionLabelProp:"children",dropdownMatchSelectWidth:!1,value:(g||ee[0]).toString(),onChange:this.changeSize,getPopupContainer:function(J){return J.parentNode}},se)}return F&&(j&&(te=typeof j=="boolean"?O.a.createElement("button",{type:"button",onClick:this.go,onKeyUp:this.go,disabled:$,className:"".concat(ue,"-quick-jumper-button")},p.jump_to_confirm):O.a.createElement("span",{onClick:this.go,onKeyUp:this.go},j)),pe=O.a.createElement("div",{className:"".concat(ue,"-quick-jumper")},p.jump_to,O.a.createElement("input",{disabled:$,type:"text",value:ie,onChange:this.handleChange,onKeyUp:this.go,onBlur:this.handleBlur}),p.page,te)),O.a.createElement("li",{className:"".concat(ue)},ve,pe)}}]),d}(O.a.Component);b.defaultProps={pageSizeOptions:["10","20","50","100"]};var x=b,f=H("N2Kk");function l(){}function i(u){return typeof u=="number"&&isFinite(u)&&Math.floor(u)===u}function c(u,y,d){return d}function _(u,y,d){var h=typeof u=="undefined"?y.pageSize:u;return Math.floor((d.total-1)/h)+1}var v=function(u){Object(P.a)(d,u);var y=Object(N.a)(d);function d(h){var s;Object(K.a)(this,d),s=y.call(this,h),s.getJumpPrevPage=function(){return Math.max(1,s.state.current-(s.props.showLessItems?3:5))},s.getJumpNextPage=function(){return Math.min(_(void 0,s.state,s.props),s.state.current+(s.props.showLessItems?3:5))},s.getItemIcon=function(L,F){var j=s.props.prefixCls,V=L||O.a.createElement("button",{type:"button","aria-label":F,className:"".concat(j,"-item-link")});return typeof L=="function"&&(V=O.a.createElement(L,Object(D.a)({},s.props))),V},s.savePaginationNode=function(L){s.paginationNode=L},s.isValid=function(L){return i(L)&&L!==s.state.current},s.shouldDisplayQuickJumper=function(){var L=s.props,F=L.showQuickJumper,j=L.pageSize,V=L.total;return V<=j?!1:F},s.handleKeyDown=function(L){(L.keyCode===S.ARROW_UP||L.keyCode===S.ARROW_DOWN)&&L.preventDefault()},s.handleKeyUp=function(L){var F=s.getValidValue(L),j=s.state.currentInputValue;F!==j&&s.setState({currentInputValue:F}),L.keyCode===S.ENTER?s.handleChange(F):L.keyCode===S.ARROW_UP?s.handleChange(F-1):L.keyCode===S.ARROW_DOWN&&s.handleChange(F+1)},s.changePageSize=function(L){var F=s.state.current,j=_(L,s.state,s.props);F=F>j?j:F,j===0&&(F=s.state.current),typeof L=="number"&&("pageSize"in s.props||s.setState({pageSize:L}),"current"in s.props||s.setState({current:F,currentInputValue:F})),s.props.onShowSizeChange(F,L),"onChange"in s.props&&s.props.onChange&&s.props.onChange(F,L)},s.handleChange=function(L){var F=s.props.disabled,j=L;if(s.isValid(j)&&!F){var V=_(void 0,s.state,s.props);j>V?j=V:j<1&&(j=1),"current"in s.props||s.setState({current:j,currentInputValue:j});var B=s.state.pageSize;return s.props.onChange(j,B),j}return s.state.current},s.prev=function(){s.hasPrev()&&s.handleChange(s.state.current-1)},s.next=function(){s.hasNext()&&s.handleChange(s.state.current+1)},s.jumpPrev=function(){s.handleChange(s.getJumpPrevPage())},s.jumpNext=function(){s.handleChange(s.getJumpNextPage())},s.hasPrev=function(){return s.state.current>1},s.hasNext=function(){return s.state.current<_(void 0,s.state,s.props)},s.runIfEnter=function(L,F){if(L.key==="Enter"||L.charCode===13){for(var j=arguments.length,V=new Array(j>2?j-2:0),B=2;B=g?E=g:E=Number(o),E}},{key:"getShowSizeChanger",value:function(){var s=this.props,o=s.showSizeChanger,g=s.total,p=s.totalBoundaryShowSizeChanger;return typeof o!="undefined"?o:g>p}},{key:"renderPrev",value:function(s){var o=this.props,g=o.prevIcon,p=o.itemRender,E=p(s,"prev",this.getItemIcon(g,"prev page")),L=!this.hasPrev();return Object(M.isValidElement)(E)?Object(M.cloneElement)(E,{disabled:L}):E}},{key:"renderNext",value:function(s){var o=this.props,g=o.nextIcon,p=o.itemRender,E=p(s,"next",this.getItemIcon(g,"next page")),L=!this.hasNext();return Object(M.isValidElement)(E)?Object(M.cloneElement)(E,{disabled:L}):E}},{key:"render",value:function(){var s=this,o=this.props,g=o.prefixCls,p=o.className,E=o.style,L=o.disabled,F=o.hideOnSinglePage,j=o.total,V=o.locale,B=o.showQuickJumper,I=o.showLessItems,$=o.showTitle,ie=o.showTotal,ue=o.simple,fe=o.itemRender,ve=o.showPrevNextJumpers,pe=o.jumpPrevIcon,te=o.jumpNextIcon,ee=o.selectComponentClass,se=o.selectPrefixCls,Q=o.pageSizeOptions,J=this.state,he=J.current,Ce=J.pageSize,De=J.currentInputValue;if(F===!0&&j<=Ce)return null;var we=_(void 0,this.state,this.props),Me=[],Te=null,_e=null,Pe=null,je=null,Qe=null,Ie=B&&B.goButton,Ae=I?1:2,et=he-1>0?he-1:0,qe=he+1=Ae*2&&he!==1+2&&(Me[0]=Object(M.cloneElement)(Me[0],{className:"".concat(g,"-item-after-jump-prev")}),Me.unshift(Te)),we-he>=Ae*2&&he!==we-2&&(Me[Me.length-1]=Object(M.cloneElement)(Me[Me.length-1],{className:"".concat(g,"-item-before-jump-next")}),Me.push(_e)),Et!==1&&Me.unshift(Pe),dt!==we&&Me.push(je)}var me=null;ie&&(me=O.a.createElement("li",{className:"".concat(g,"-total-text")},ie(j,[j===0?0:(he-1)*Ce+1,he*Ce>j?j:he*Ce])));var le=!this.hasPrev()||!we,de=!this.hasNext()||!we;return O.a.createElement("ul",Object(ne.a)({className:T()(g,p,Object(G.a)({},"".concat(g,"-disabled"),L)),style:E,unselectable:"unselectable",ref:this.savePaginationNode},lt),me,O.a.createElement("li",{title:$?V.prev_page:null,onClick:this.prev,tabIndex:le?null:0,onKeyPress:this.runIfEnterPrev,className:T()("".concat(g,"-prev"),Object(G.a)({},"".concat(g,"-disabled"),le)),"aria-disabled":le},this.renderPrev(et)),Me,O.a.createElement("li",{title:$?V.next_page:null,onClick:this.next,tabIndex:de?null:0,onKeyPress:this.runIfEnterNext,className:T()("".concat(g,"-next"),Object(G.a)({},"".concat(g,"-disabled"),de)),"aria-disabled":de},this.renderNext(qe)),O.a.createElement(x,{disabled:L,locale:V,rootPrefixCls:g,selectComponentClass:ee,selectPrefixCls:se,changeSize:this.getShowSizeChanger()?this.changePageSize:null,current:he,pageSize:Ce,pageSizeOptions:Q,quickGo:this.shouldDisplayQuickJumper()?this.handleChange:null,goButton:Ie}))}}],[{key:"getDerivedStateFromProps",value:function(s,o){var g={};if("current"in s&&(g.current=s.current,s.current!==o.current&&(g.currentInputValue=g.current)),"pageSize"in s&&s.pageSize!==o.pageSize){var p=o.current,E=_(s.pageSize,o,s);p=p>E?E:p,"current"in s||(g.current=p,g.currentInputValue=p),g.pageSize=s.pageSize}return g}}]),d}(O.a.Component);v.defaultProps={defaultCurrent:1,total:0,defaultPageSize:10,onChange:l,className:"",selectPrefixCls:"rc-select",prefixCls:"rc-pagination",selectComponentClass:null,hideOnSinglePage:!1,showPrevNextJumpers:!0,showQuickJumper:!1,showLessItems:!1,showTitle:!0,onShowSizeChange:l,locale:f.a,style:{},itemRender:c,totalBoundaryShowSizeChanger:50};var m=v},"6K3P":function(Je,Be,H){Je.exports=H.p+"static/jinshi.9b74f304.svg"},"7Cbv":function(Je,Be,H){"use strict";var ne=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),G=new Uint8Array(16);function D(){if(!ne)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ne(G)}var K=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function k(R){return typeof R=="string"&&K.test(R)}for(var P=k,N=[],M=0;M<256;++M)N.push((M+256).toString(16).substr(1));function O(R){var S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,b=(N[R[S+0]]+N[R[S+1]]+N[R[S+2]]+N[R[S+3]]+"-"+N[R[S+4]]+N[R[S+5]]+"-"+N[R[S+6]]+N[R[S+7]]+"-"+N[R[S+8]]+N[R[S+9]]+"-"+N[R[S+10]]+N[R[S+11]]+N[R[S+12]]+N[R[S+13]]+N[R[S+14]]+N[R[S+15]]).toLowerCase();if(!P(b))throw TypeError("Stringified UUID is invalid");return b}var A=O;function T(R,S,b){R=R||{};var x=R.random||(R.rng||D)();if(x[6]=x[6]&15|64,x[8]=x[8]&63|128,S){b=b||0;for(var f=0;f<16;++f)S[b+f]=x[f];return S}return A(x)}var C=Be.a=T},"7ahc":function(Je,Be,H){"use strict";H.d(Be,"a",function(){return _});var ne=H("k1fw"),G=H("0Owb"),D=H("+L6B"),K=H("2/Rp"),k=H("y8nQ"),P=H("Vl3Y"),N=H("tJVT"),M=H("OaEy"),O=H("2fM7"),A=H("cDcd"),T=H.n(A),C=H("VrN/"),R=H.n(C),S=H("p77/"),b=H.n(S),x=H("c5Ni"),f=H.n(x),l=O.a.Option,i={labelCol:{span:4},wrapperCol:{span:20}},c={asp:["ASP","vbscript"],actionscript:["ActionScript(3.0)/Flash/Flex","clike"],bash:["Bash/Bat","shell"],css:["CSS","css"],c:["C","clike"],cpp:["C++","clike"],csharp:["C#","clike"],coffeescript:["CoffeeScript","coffeescript"],d:["D","d"],dart:["Dart","dart"],delphi:["Delphi/Pascal","pascal"],erlang:["Erlang","erlang"],go:["Golang","go"],groovy:["Groovy","groovy"],html:["HTML","text/html"],java:["Java","clike"],json:["JSON","text/json"],javascript:["Javascript","javascript"],lua:["Lua","lua"],less:["LESS","css"],markdown:["Markdown","gfm"],"objective-c":["Objective-C","clike"],php:["PHP","php"],perl:["Perl","perl"],python:["Python","python"],r:["R","r"],rst:["reStructedText","rst"],ruby:["Ruby","ruby"],sql:["SQL","sql"],sass:["SASS/SCSS","sass"],shell:["Shell","shell"],scala:["Scala","clike"],swift:["Swift","clike"],vb:["VB/VBScript","vb"],xml:["XML","text/xml"],yaml:["YAML","yaml"]};Be.b=function(v){var m=v.callback,u=v.onCancel,y=Object(A.useState)("python"),d=Object(N.a)(y,2),h=d[0],s=d[1];function o(p){s(c[p][1])}function g(p){m(p)}return T.a.createElement(P.a,Object(G.a)({},i,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:g}),T.a.createElement(P.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},T.a.createElement(O.a,{onChange:o},Object.keys(c).map(function(p){return T.a.createElement(l,{key:p,value:p},c[p][0])}))),T.a.createElement(P.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},T.a.createElement(_,{mode:h})),T.a.createElement("div",{className:"flex-container flex-end"},T.a.createElement(K.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),T.a.createElement(K.a,{type:"ghost",onClick:u},"\u53D6\u6D88")))};function _(v){var m=v.value,u=v.onChange,y=v.mode,d=v.options,h=d===void 0?{}:d,s=Object(A.useRef)(),o=Object(A.useState)(),g=Object(N.a)(o,2),p=g[0],E=g[1];return Object(A.useEffect)(function(){if(p){function L(F){var j=F.getValue();u&&u(j)}return p.on("change",L),function(){p.off("change",L)}}},[p,u]),Object(A.useEffect)(function(){p&&p.setOption("mode",y)},[p,y]),Object(A.useEffect)(function(){p&&((m!==p.getValue()||m==="")&&setTimeout(function(){p.setValue(m||" ")},300))},[p,m]),Object(A.useEffect)(function(){if(s.current&&!p){var L=R.a.fromTextArea(s.current,Object(ne.a)({mode:y,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},h));E(L)}},[s.current,p]),T.a.createElement("div",{className:"my-codemirror-container"},T.a.createElement("textarea",{ref:s}))}},"7ixt":function(Je,Be,H){"use strict";H.d(Be,"a",function(){return D});var ne={adjustX:1,adjustY:1},G=[0,0],D={left:{points:["cr","cl"],overflow:ne,offset:[-4,0],targetOffset:G},right:{points:["cl","cr"],overflow:ne,offset:[4,0],targetOffset:G},top:{points:["bc","tc"],overflow:ne,offset:[0,-4],targetOffset:G},bottom:{points:["tc","bc"],overflow:ne,offset:[0,4],targetOffset:G},topLeft:{points:["bl","tl"],overflow:ne,offset:[0,-4],targetOffset:G},leftTop:{points:["tr","tl"],overflow:ne,offset:[-4,0],targetOffset:G},topRight:{points:["br","tr"],overflow:ne,offset:[0,-4],targetOffset:G},rightTop:{points:["tl","tr"],overflow:ne,offset:[4,0],targetOffset:G},bottomRight:{points:["tr","br"],overflow:ne,offset:[0,4],targetOffset:G},rightBottom:{points:["bl","br"],overflow:ne,offset:[4,0],targetOffset:G},bottomLeft:{points:["tl","bl"],overflow:ne,offset:[0,4],targetOffset:G},leftBottom:{points:["br","bl"],overflow:ne,offset:[-4,0],targetOffset:G}},K=D},"7qnI":function(Je,Be,H){"use strict";var ne=H("5Dmo"),G=H("3S7+"),D=H("fWQN"),K=H("mtLc"),k=H("yKVA"),P=H("879j"),N=H("5NDa"),M=H("5rEg"),O=H("cDcd"),A=H.n(O),T=H("O2Wb"),C=H.n(T),R=M.a.TextArea,S=function(b){Object(k.a)(f,b);var x=Object(P.a)(f);function f(){return Object(D.a)(this,f),x.apply(this,arguments)}return Object(K.a)(f,[{key:"render",value:function(){var i=this,c=this.props,_=c.index,v=c.onAnswerChange,m=c.addChildAnswer,u=c.exerciseIsPublish,y=c.answers,d=c.activeOptionErrorIndex,h=c.flex,s=h===void 0?"0 0 1000px":h;return A.a.createElement("div",{className:C.a.flex},A.a.createElement("div",{className:"".concat(C.a.color666," mb5 mt6"),style:{flex:"0 0 90px"}},"\u7B54\u6848(\u586B\u7A7A",_+1,"):"),A.a.createElement("div",{className:"".concat(C.a.flex," ").concat(C.a.flex1),style:{flexDirection:"column"}},y.map(function(o,g){var p="".concat(_,"-").concat(g);return A.a.createElement("div",{className:"".concat(C.a.flex," ").concat(C.a.flex1),key:g},A.a.createElement("div",{className:C.a.flex1,style:{flex:s}},A.a.createElement("div",null,A.a.createElement(R,{className:p===d?C.a.error:"",spellCheck:!1,rows:4,value:o||"",defaultValue:"\u8BF7\u8F93\u5165\u53C2\u8003\u7B54\u6848".concat(g==0?"":"(\u53EF\u9009)"),onChange:function(L){return v(_,g,L.target.value)},style:{minHeight:95}}))),!u&&A.a.createElement(A.a.Fragment,null,g!=0&&A.a.createElement(G.a,{title:"\u5220\u9664"},A.a.createElement("i",{className:"".concat(C.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){return i.props.deleteChildAnswer(_,g)},style:{float:"right"}})),g===0&&A.a.createElement(G.a,{title:"\u5220\u9664"},A.a.createElement("i",{className:"".concat(C.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){return i.props.deleteChildAnswermain(_,g)},style:{float:"right"}})),A.a.createElement(G.a,{title:"\u65B0\u589E\u53C2\u8003\u7B54\u6848"},A.a.createElement("i",{className:"".concat(C.a.addIcon," iconfont icon-roundaddfill ml6"),onClick:function(){return m(_)},style:{float:"right",visibility:g==y.length-1?"":"hidden"}}))))})))}}]),f}(O.Component);Be.a=S},"815F":function(Je,Be,H){"use strict";H.d(Be,"e",function(){return N}),H.d(Be,"c",function(){return O}),H.d(Be,"d",function(){return A}),H.d(Be,"a",function(){return C}),H.d(Be,"f",function(){return R}),H.d(Be,"b",function(){return S});var ne=H("KQm4"),G=H("VTBJ"),D=H("Ff2n"),K=H("Zm9Q"),k=H("Kwbf"),P=H("OZM5");function N(b,x){return b!=null?b:x}function M(){var b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],x=new Map;function f(l){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";(l||[]).forEach(function(c){var _=c.key,v=c.children;Object(k.a)(_!=null,"Tree node must have a certain key: [".concat(i).concat(_,"]"));var m=String(_);Object(k.a)(!x.has(m)||_===null||_===void 0,"Same 'key' exist in the Tree: ".concat(m)),x.set(m,!0),f(v,"".concat(i).concat(m," > "))})}f(b)}function O(b){function x(f){var l=Object(K.a)(f);return l.map(function(i){if(!Object(P.i)(i))return Object(k.a)(!i,"Tree/TreeNode can only accept TreeNode as children."),null;var c=i.key,_=i.props,v=_.children,m=Object(D.a)(_,["children"]),u=Object(G.a)({key:c},m),y=x(v);return y.length&&(u.children=y),u}).filter(function(i){return i})}return x(b)}function A(){var b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],x=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],f=new Set(x===!0?[]:x),l=[];function i(c){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return c.map(function(v,m){var u=Object(P.h)(_?_.pos:"0",m),y=N(v.key,u),d=Object(G.a)(Object(G.a)({},v),{},{parent:_,pos:u,children:null,data:v,isStart:[].concat(Object(ne.a)(_?_.isStart:[]),[m===0]),isEnd:[].concat(Object(ne.a)(_?_.isEnd:[]),[m===c.length-1])});return l.push(d),x===!0||f.has(y)?d.children=i(v.children||[],d):d.children=[],d})}return i(b),l}function T(b,x,f){var l;f?typeof f=="string"?l=function(_){return _[f]}:typeof f=="function"&&(l=function(_){return f(_)}):l=function(_,v){return N(_.key,v)};function i(c,_,v){var m=c?c.children:b,u=c?Object(P.h)(v.pos,_):"0";if(c){var y=l(c,u),d={node:c,index:_,pos:u,key:y,parentPos:v.node?v.pos:null,level:v.level+1};x(d)}m&&m.forEach(function(h,s){i(h,s,{node:c,pos:u,level:v?v.level+1:-1})})}i(null)}function C(b){var x=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},f=x.initWrapper,l=x.processEntity,i=x.onProcessFinished,c=arguments.length>2?arguments[2]:void 0,_={},v={},m={posEntities:_,keyEntities:v};return f&&(m=f(m)||m),T(b,function(u){var y=u.node,d=u.index,h=u.pos,s=u.key,o=u.parentPos,g=u.level,p={node:y,index:d,key:s,pos:h,level:g},E=N(s,h);_[h]=p,v[E]=p,p.parent=_[o],p.parent&&(p.parent.children=p.parent.children||[],p.parent.children.push(p)),l&&l(p,m)},c),i&&i(m),m}function R(b,x){var f=x.expandedKeys,l=x.selectedKeys,i=x.loadedKeys,c=x.loadingKeys,_=x.checkedKeys,v=x.halfCheckedKeys,m=x.dragOverNodeKey,u=x.dropPosition,y=x.keyEntities,d=y[b],h={eventKey:b,expanded:f.indexOf(b)!==-1,selected:l.indexOf(b)!==-1,loaded:i.indexOf(b)!==-1,loading:c.indexOf(b)!==-1,checked:_.indexOf(b)!==-1,halfChecked:v.indexOf(b)!==-1,pos:String(d?d.pos:""),dragOver:m===b&&u===0,dragOverGapTop:m===b&&u===-1,dragOverGapBottom:m===b&&u===1};return h}function S(b){var x=b.data,f=b.expanded,l=b.selected,i=b.checked,c=b.loaded,_=b.loading,v=b.halfChecked,m=b.dragOver,u=b.dragOverGapTop,y=b.dragOverGapBottom,d=b.pos,h=b.active,s=Object(G.a)(Object(G.a)({},x),{},{expanded:f,selected:l,checked:i,loaded:c,loading:_,halfChecked:v,dragOver:m,dragOverGapTop:u,dragOverGapBottom:y,pos:d,active:h});return"props"in s||Object.defineProperty(s,"props",{get:function(){return Object(k.a)(!1,"Second param return from event is node data instead of TreeNode instance. Please read value directly instead of reading from `props`."),b}}),s}},"8EBN":function(Je,Be,H){(function(ne){ne(H("VrN/"))})(function(ne){"use strict";ne.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded Javascript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var G=0;G-1&&K.substring(N+1,K.length);if(M)return ne.findModeByExtension(M)},ne.findModeByName=function(K){K=K.toLowerCase();for(var k=0;k=Q.length?J.slice(Q.length):J}).join(` `)}var S=[],b=["
    "],x=new T.a.Renderer,f=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function l(){S.length=0,b=["
      "]}var i={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function c(te,ee,se,Q){if(ee>=te.length||te[ee].level<=se)return ee;var J=te[ee];Q.push("
    • "+J.text+""),ee++;var he=[];return ee=c(te,ee,J.level,he),he.length>0&&(Q.push("
        "),he.forEach(function(Ce){Q.push(Ce)}),Q.push("
      ")),Q.push("
    • "),ee=c(te,ee,se,Q),ee}function _(){return c(S,0,0,b),b.push("
    "),b.join("")}var v={heading:function(ee){var se=f.exec(ee);if(se)return{type:"heading",raw:se[0],depth:se[1].length,text:se[2]}},fences:function(ee){var se=this.rules.block.fences.exec(ee);if(se){var Q=se[0],J=R(Q,se[3]||""),he=se[2]?se[2].trim():se[2];if(["latex","katex","math"].indexOf(he)>=0){var Ce=y(),De=J;J=Ce,d[Ce]={type:"block",expression:De}}return{type:"code",raw:Q,lang:he,text:J}}}},m=/(?:\${2})([^\n`]+?)(?:\${2})/gi,u=0,y=function(){return"__special_katext_id_".concat(u++,"__")},d={};function h(){return d}function s(){u=0,d={}}function o(te){return te=te.replace(m,function(ee,se){var Q=y();return d[Q]={type:"inline",expression:se},Q}),te}var g=x.listitem;x.listitem=function(te){return g(o(te))};var p=x.paragraph;x.paragraph=function(te){return p(o(te))};var E=x.tablecell;x.tablecell=function(te,ee){return E(o(te),ee)},x.code=function(te,ee,se){var Q=(ee||"").match(/\S*/)[0];return Q?["latex","katex","math"].indexOf(Q)>=0?"

    ".concat(te,"

    "):'
    ').concat(se?te:Object(C.escape)(te,!0),`
    `):'
    '+(se?te:Object(C.escape)(te,!0))+"
    "},x.heading=function(te,ee,se){var Q=this.options.headerPrefix+se.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return S.push({anchor:Q,level:ee,text:te}),"'+te+""},T.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),T.a.use({tokenizer:v,renderer:x});var L=T.a,F=H("SJMd"),j=H("ulZh"),V=H.n(j),B=H("m3rI"),I=H("Oy/b"),$=H("p5ED"),ie=H("8hTe"),ue=H.n(ie),fe=/]*>/g;function ve(te){var ee=document.createElement("div");return ee.innerHTML=te,ee.childNodes.length===0?"":ee.childNodes[0].nodeValue}var pe=Be.a=function(te){var ee=te.value,se=ee===void 0?"":ee,Q=te.edit,J=Q===void 0?!1:Q,he=te.className,Ce=te.showTextOnly,De=te.showLines,we=te.replaces,Me=te.zoomImg,Te=te.hasMask,_e=te.style,Pe=_e===void 0?{}:_e,je=te.stylesPrev,Qe=je===void 0?{}:je,Ie=String(se),Ae=Object(N.useRef)(),et=Object(N.useRef)(),qe=Object(N.useState)(""),lt=Object(P.a)(qe,2),$e=lt[0],ft=lt[1],ut=Object(N.useState)("office"),st=Object(P.a)(ut,2),Se=st[0],Et=st[1],dt=Object(N.useMemo)(function(){try{var de=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,Y=/\"\/api\/attachments\/|\"\/attachments\/download\//g,Z=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;Ie=Ie.replace(de,"("+B.a.API_SERVER+"/api/attachments/").replace(Y,'"'+B.a.API_SERVER+"/api/attachments/").replace(Z,'"'+B.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(Ee){}var q=L(Ie),ae=h();if(Ie.match(/\[TOC\]/)&&(q=q.replace("

    [TOC]

    ",_()),l()),q=q.replace(/(__special_katext_id_\d+__)/g,function(Ee,xe){var Ve=ae[xe],Le=Ve.type,We=Ve.expression;return Object(I.renderToString)(ve(We)||"",{displayMode:Le==="block",throwOnError:!1,output:"html"})}),q=q.replace(/▁/g,"\u2581\u2581\u2581"),s(),Ce){var re=document.createElement("div");return re.innerHTML=q,re.innerText}return setTimeout(function(){return me()},500),q},[Ie]),Re=Object(N.useRef)();i.WebkitLineClamp=De,De&&(Pe=Object(k.a)(Object(k.a)({},Pe),i));function He(de){var Y=de.target;if(Y.tagName.toUpperCase()==="IMG"){if(Me){var Z=Y.getAttribute("src");ft(Z),Et("image")}}else if(Y.tagName.toUpperCase()==="A"){var q=Y.getAttribute("href");if(q.indexOf("office")>-1)de.preventDefault(),ft(q),Et("office");else if(q.indexOf("application/pdf")>-1)de.preventDefault(),ft(q),Et("pdf");else if(q.indexOf("text/html")>-1)de.preventDefault(),ft(q),Et("html");else if(q.startsWith("#")){de.preventDefault();var ae=document.getElementById(q.replace("#",""));ae&&ae.scrollIntoView(!0)}}}var me=function(){var Y,Z=(Y=Re.current)===null||Y===void 0?void 0:Y.querySelectorAll("video");Z==null||Z.forEach(function(q){if(q.oncontextmenu=function(){return!1},q.src.indexOf(".m3u8")>-1&&!q.canPlayType("application/vnd.apple.mpegurl")){if(V.a.isSupported()){var ae=new V.a;ae.loadSource(q.src),ae.attachMedia(q)}}})};Object(N.useEffect)(function(){if(Re.current&&dt&&(dt.match(fe)&&window.PR.prettyPrint()),Re.current)return Re.current.addEventListener("click",He),function(){Re.current.removeEventListener("click",He),s(),l()}},[dt,Re.current,He]);var le=function(Y){if(!J)return;Y.target.nodeName==="IMG"?(Ae.current.style.display="flex",Ae.current.style.width=Y.target.clientWidth+"px",Ae.current.style.height=Y.target.clientHeight+"px",Ae.current.style.top=Y.target.offsetTop+"px",Ae.current.style.left=Y.target.offsetLeft+"px",et.current.src=Y.target.getAttribute("src")):Ae.current.style.display="none"};return M.a.createElement("div",{style:{position:"relative"}},M.a.createElement("div",{ref:Re,style:Object(k.a)({},Pe),className:"".concat(he||""," markdown-body ").concat(ue.a.mdBody),onMouseOver:le,dangerouslySetInnerHTML:{__html:dt}}),M.a.createElement("div",{ref:Ae,className:ue.a.button},M.a.createElement(G.a,null,M.a.createElement(K.a,{onClick:function(){return openCrop()}},"\u88C1\u526A"),M.a.createElement(K.a,{onClick:function(){return openEditor()}},"\u7F16\u8F91"))),M.a.createElement("img",{ref:et,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1,top:"-10000px"}}),M.a.createElement($.a,{close:!0,data:$e,type:$e!=null&&$e.length?Se:"",style:Object(k.a)({},Qe),onClose:function(){return ft("")}}))}},"9VGf":function(Je,Be,H){"use strict";H.d(Be,"a",function(){return D});var ne=H("cDcd"),G=H.n(ne);function D(K,k){var P=Object(ne.useRef)();Object(ne.useEffect)(function(){P.current=K}),Object(ne.useEffect)(function(){function N(){P.current()}if(k!==null){var M=setInterval(N,k);return function(){return clearInterval(M)}}},[k])}},"A+k2":function(Je,Be,H){Je.exports={tabs:"tabs___2hYAP",active:"active___2Xkwd"}},Bd2K:function(Je,Be,H){(function(ne){ne(H("VrN/"),H("osHv"))})(function(ne){ne.defineOption("autoCloseTags",!1,function(O,A,T){if(T!=ne.Init&&T&&O.removeKeyMap("autoCloseTags"),!A)return;var C={name:"autoCloseTags"};(typeof A!="object"||A.whenClosing!==!1)&&(C["'/'"]=function(R){return P(R)}),(typeof A!="object"||A.whenOpening!==!1)&&(C["'>'"]=function(R){return K(R)}),O.addKeyMap(C)});var G=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],D=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];function K(O){if(O.getOption("disableInput"))return ne.Pass;for(var A=O.listSelections(),T=[],C=O.getOption("autoCloseTags"),R=0;RS.ch&&(i=i.slice(0,i.length-b.end+S.ch));var m=i.toLowerCase();if(!i||b.type=="string"&&(b.end!=S.ch||!/[\"\']/.test(b.string.charAt(b.string.length-1))||b.string.length==1)||b.type=="tag"&&l.close||b.string.indexOf("/")==S.ch-b.start-1||_&&N(_,m)>-1||M(O,x.mode.xmlCurrentContext&&x.mode.xmlCurrentContext(f)||[],i,S,!0))return ne.Pass;var u=typeof C=="object"&&C.emptyTags;if(u&&N(u,i)>-1){T[R]={text:"/>",newPos:ne.Pos(S.line,S.ch+2)};continue}var y=v&&N(v,m)>-1;T[R]={indent:y,text:">"+(y?` `:"")+"",newPos:y?ne.Pos(S.line+1,0):ne.Pos(S.line,S.ch+1)}}for(var d=typeof C=="object"&&C.dontIndentOnAutoClose,R=A.length-1;R>=0;R--){var h=T[R];O.replaceRange(h.text,A[R].head,A[R].anchor,"+insert");var s=O.listSelections().slice(0);s[R]={head:h.newPos,anchor:h.newPos},O.setSelections(s),!d&&h.indent&&(O.indentLine(h.newPos.line,null,!0),O.indentLine(h.newPos.line+1,null,!0))}}function k(O,A){for(var T=O.listSelections(),C=[],R=A?"/":""&&(_+=">"),C[x]=_}if(O.replaceSelections(C),T=O.listSelections(),!b)for(var x=0;x=0&&A[f]==T;f--)++x;C=b.to;for(var f=1;f0){for(var A=0;A1&&arguments[1]!==void 0?arguments[1]:"",A=[],T=0;Tme.length)&&(le=me.length);for(var de=0,Y=new Array(le);de=me.length?{done:!0}:{done:!1,value:me[Y++]}}}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 de=me[Symbol.iterator](),de.next.bind(de)}function P(me,le){return le={exports:{}},me(le,le.exports),le.exports}var N=P(function(me){function le(){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 de(Y){me.exports.defaults=Y}me.exports={defaults:le(),getDefaults:le,changeDefaults:de}}),M=N.defaults,O=N.getDefaults,A=N.changeDefaults,T=/[&<>"']/,C=/[&<>"']/g,R=/[<>"']|&(?!#?\w+;)/,S=/[<>"']|&(?!#?\w+;)/g,b={"&":"&","<":"<",">":">",'"':""","'":"'"},x=function(le){return b[le]};function f(me,le){if(le){if(T.test(me))return me.replace(C,x)}else if(R.test(me))return me.replace(S,x);return me}var l=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function i(me){return me.replace(l,function(le,de){return de=de.toLowerCase(),de==="colon"?":":de.charAt(0)==="#"?de.charAt(1)==="x"?String.fromCharCode(parseInt(de.substring(2),16)):String.fromCharCode(+de.substring(1)):""})}var c=/(^|[^\[])\^/g;function _(me,le){me=me.source||me,le=le||"";var de={replace:function(Z,q){return q=q.source||q,q=q.replace(c,"$1"),me=me.replace(Z,q),de},getRegex:function(){return new RegExp(me,le)}};return de}var v=/[^\w:]/g,m=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function u(me,le,de){if(me){var Y;try{Y=decodeURIComponent(i(de)).replace(v,"").toLowerCase()}catch(Z){return null}if(Y.indexOf("javascript:")===0||Y.indexOf("vbscript:")===0||Y.indexOf("data:")===0)return null}le&&!m.test(de)&&(de=o(le,de));try{de=encodeURI(de).replace(/%25/g,"%")}catch(Z){return null}return de}var y={},d=/^[^:]+:\/*[^/]*$/,h=/^([^:]+:)[\s\S]*$/,s=/^([^:]+:\/*[^/]*)[\s\S]*$/;function o(me,le){y[" "+me]||(d.test(me)?y[" "+me]=me+"/":y[" "+me]=L(me,"/",!0)),me=y[" "+me];var de=me.indexOf(":")===-1;return le.substring(0,2)==="//"?de?le:me.replace(h,"$1")+le:le.charAt(0)==="/"?de?le:me.replace(s,"$1")+le:me+le}var g={exec:function(){}};function p(me){for(var le=1,de,Y;le=0&&re[xe]==="\\";)Ee=!Ee;return Ee?"|":" |"}),Y=de.split(/ \|/),Z=0;if(Y.length>le)Y.splice(le);else for(;Y.length=Y.length?Z.slice(Y.length):Z}).join(` `)}var pe=function(){function me(de){this.options=de||B}var le=me.prototype;return le.space=function(Y){var Z=this.rules.block.newline.exec(Y);if(Z)return Z[0].length>1?{type:"space",raw:Z[0]}:{raw:` `}},le.code=function(Y,Z){var q=this.rules.block.code.exec(Y);if(q){var ae=Z[Z.length-1];if(ae&&ae.type==="paragraph")return{raw:q[0],text:q[0].trimRight()};var re=q[0].replace(/^ {4}/gm,"");return{type:"code",raw:q[0],codeBlockStyle:"indented",text:this.options.pedantic?re:I(re,` `)}}},le.fences=function(Y){var Z=this.rules.block.fences.exec(Y);if(Z){var q=Z[0],ae=ve(q,Z[3]||"");return{type:"code",raw:q,lang:Z[2]?Z[2].trim():Z[2],text:ae}}},le.heading=function(Y){var Z=this.rules.block.heading.exec(Y);if(Z)return{type:"heading",raw:Z[0],depth:Z[1].length,text:Z[2]}},le.nptable=function(Y){var Z=this.rules.block.nptable.exec(Y);if(Z){var q={type:"table",header:$(Z[1].replace(/^ *| *\| *$/g,"")),align:Z[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:Z[3]?Z[3].replace(/\n$/,"").split(` `):[],raw:Z[0]};if(q.header.length===q.align.length){var ae=q.align.length,re;for(re=0;re ?/gm,"");return{type:"blockquote",raw:Z[0],text:q}}},le.list=function(Y){var Z=this.rules.block.list.exec(Y);if(Z){for(var q=Z[0],ae=Z[2],re=ae.length>1,Ee=ae[ae.length-1]===")",xe={type:"list",raw:q,ordered:re,start:re?+ae.slice(0,-1):"",loose:!1,items:[]},Ve=Z[0].match(this.rules.block.item),Le=!1,We,Ot,Ze,ht,Ut,Ke,It,Zt=Ve.length,At=0;At1||this.options.smartLists&&Ze!==ae)&&(ht=Ve.slice(At+1).join(` `),xe.raw=xe.raw.substring(0,xe.raw.length-ht.length),At=Zt-1)),Ut=Le||/\n\n(?!\s*$)/.test(We),At!==Zt-1&&(Le=We.charAt(We.length-1)===` `,Ut||(Ut=Le)),Ut&&(xe.loose=!0),Ke=/^\[[ xX]\] /.test(We),It=void 0,Ke&&(It=We[1]!==" ",We=We.replace(/^\[[ xX]\] +/,"")),xe.items.push({type:"list_item",raw:q,task:Ke,checked:It,loose:Ut,text:We});return xe}},le.html=function(Y){var Z=this.rules.block.html.exec(Y);if(Z)return{type:this.options.sanitize?"paragraph":"html",raw:Z[0],pre:!this.options.sanitizer&&(Z[1]==="pre"||Z[1]==="script"||Z[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(Z[0]):ie(Z[0]):Z[0]}},le.def=function(Y){var Z=this.rules.block.def.exec(Y);if(Z){Z[3]&&(Z[3]=Z[3].substring(1,Z[3].length-1));var q=Z[1].toLowerCase().replace(/\s+/g," ");return{tag:q,raw:Z[0],href:Z[2],title:Z[3]}}},le.table=function(Y){var Z=this.rules.block.table.exec(Y);if(Z){var q={type:"table",header:$(Z[1].replace(/^ *| *\| *$/g,"")),align:Z[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:Z[3]?Z[3].replace(/\n$/,"").split(` `):[]};if(q.header.length===q.align.length){q.raw=Z[0];var ae=q.align.length,re;for(re=0;re/i.test(ae[0])&&(Z=!1),!q&&/^<(pre|code|kbd|script)(\s|>)/i.test(ae[0])?q=!0:q&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(ae[0])&&(q=!1),{type:this.options.sanitize?"text":"html",raw:ae[0],inLink:Z,inRawBlock:q,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ae[0]):ie(ae[0]):ae[0]}},le.link=function(Y){var Z=this.rules.inline.link.exec(Y);if(Z){var q=ue(Z[2],"()");if(q>-1){var ae=Z[0].indexOf("!")===0?5:4,re=ae+Z[1].length+q;Z[2]=Z[2].substring(0,q),Z[0]=Z[0].substring(0,re).trim(),Z[3]=""}var Ee=Z[2],xe="";if(this.options.pedantic){var Ve=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Ee);Ve?(Ee=Ve[1],xe=Ve[3]):xe=""}else xe=Z[3]?Z[3].slice(1,-1):"";Ee=Ee.trim().replace(/^<([\s\S]*)>$/,"$1");var Le=fe(Z,{href:Ee&&Ee.replace(this.rules.inline._escapes,"$1"),title:xe&&xe.replace(this.rules.inline._escapes,"$1")},Z[0]);return Le}},le.reflink=function(Y,Z){var q;if((q=this.rules.inline.reflink.exec(Y))||(q=this.rules.inline.nolink.exec(Y))){var ae=(q[2]||q[1]).replace(/\s+/g," ");if(ae=Z[ae.toLowerCase()],!ae||!ae.href){var re=q[0].charAt(0);return{type:"text",raw:re,text:re}}var Ee=fe(q,ae,q[0]);return Ee}},le.strong=function(Y,Z,q){q===void 0&&(q="");var ae=this.rules.inline.strong.start.exec(Y);if(ae&&(!ae[1]||ae[1]&&(q===""||this.rules.inline.punctuation.exec(q)))){Z=Z.slice(-1*Y.length);var re=ae[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;re.lastIndex=0;for(var Ee;(ae=re.exec(Z))!=null;)if(Ee=this.rules.inline.strong.middle.exec(Z.slice(0,ae.index+3)),Ee)return{type:"strong",raw:Y.slice(0,Ee[0].length),text:Y.slice(2,Ee[0].length-2)}}},le.em=function(Y,Z,q){q===void 0&&(q="");var ae=this.rules.inline.em.start.exec(Y);if(ae&&(!ae[1]||ae[1]&&(q===""||this.rules.inline.punctuation.exec(q)))){Z=Z.slice(-1*Y.length);var re=ae[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;re.lastIndex=0;for(var Ee;(ae=re.exec(Z))!=null;)if(Ee=this.rules.inline.em.middle.exec(Z.slice(0,ae.index+2)),Ee)return{type:"em",raw:Y.slice(0,Ee[0].length),text:Y.slice(1,Ee[0].length-1)}}},le.codespan=function(Y){var Z=this.rules.inline.code.exec(Y);if(Z){var q=Z[2].replace(/\n/g," "),ae=/[^ ]/.test(q),re=q.startsWith(" ")&&q.endsWith(" ");return ae&&re&&(q=q.substring(1,q.length-1)),q=ie(q,!0),{type:"codespan",raw:Z[0],text:q}}},le.br=function(Y){var Z=this.rules.inline.br.exec(Y);if(Z)return{type:"br",raw:Z[0]}},le.del=function(Y){var Z=this.rules.inline.del.exec(Y);if(Z)return{type:"del",raw:Z[0],text:Z[1]}},le.autolink=function(Y,Z){var q=this.rules.inline.autolink.exec(Y);if(q){var ae,re;return q[2]==="@"?(ae=ie(this.options.mangle?Z(q[1]):q[1]),re="mailto:"+ae):(ae=ie(q[1]),re=ae),{type:"link",raw:q[0],text:ae,href:re,tokens:[{type:"text",raw:ae,text:ae}]}}},le.url=function(Y,Z){var q;if(q=this.rules.inline.url.exec(Y)){var ae,re;if(q[2]==="@")ae=ie(this.options.mangle?Z(q[0]):q[0]),re="mailto:"+ae;else{var Ee;do Ee=q[0],q[0]=this.rules.inline._backpedal.exec(q[0])[0];while(Ee!==q[0]);ae=ie(q[0]),q[1]==="www."?re="http://"+ae:re=ae}return{type:"link",raw:q[0],text:ae,href:re,tokens:[{type:"text",raw:ae,text:ae}]}}},le.inlineText=function(Y,Z,q){var ae=this.rules.inline.text.exec(Y);if(ae){var re;return Z?re=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ae[0]):ie(ae[0]):ae[0]:re=ie(this.options.smartypants?q(ae[0]):ae[0]),{type:"text",raw:ae[0],text:re}}},me}(),te=V.noopTest,ee=V.edit,se=V.merge,Q={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]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|\\n*|\\n*|)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:te,table:te,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};Q._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,Q._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,Q.def=ee(Q.def).replace("label",Q._label).replace("title",Q._title).getRegex(),Q.bullet=/(?:[*+-]|\d{1,9}[.)])/,Q.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,Q.item=ee(Q.item,"gm").replace(/bull/g,Q.bullet).getRegex(),Q.list=ee(Q.list).replace(/bull/g,Q.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+Q.def.source+")").getRegex(),Q._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",Q._comment=//,Q.html=ee(Q.html,"i").replace("comment",Q._comment).replace("tag",Q._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Q.paragraph=ee(Q._paragraph).replace("hr",Q.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",")|<(?:script|pre|style|!--)").replace("tag",Q._tag).getRegex(),Q.blockquote=ee(Q.blockquote).replace("paragraph",Q.paragraph).getRegex(),Q.normal=se({},Q),Q.gfm=se({},Q.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*|$)"}),Q.gfm.nptable=ee(Q.gfm.nptable).replace("hr",Q.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",")|<(?:script|pre|style|!--)").replace("tag",Q._tag).getRegex(),Q.gfm.table=ee(Q.gfm.table).replace("hr",Q.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",")|<(?:script|pre|style|!--)").replace("tag",Q._tag).getRegex(),Q.pedantic=se({},Q.normal,{html:ee(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Q._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:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,fences:te,paragraph:ee(Q.normal._paragraph).replace("hr",Q.hr).replace("heading",` *#{1,6} *[^ ]`).replace("lheading",Q.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var J={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:te,tag:"^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\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:te,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\?@\\[\\]`^{|}~",J.punctuation=ee(J.punctuation).replace(/punctuation/g,J._punctuation).getRegex(),J._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",J._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",J.em.start=ee(J.em.start).replace(/punctuation/g,J._punctuation).getRegex(),J.em.middle=ee(J.em.middle).replace(/punctuation/g,J._punctuation).replace(/overlapSkip/g,J._overlapSkip).getRegex(),J.em.endAst=ee(J.em.endAst,"g").replace(/punctuation/g,J._punctuation).getRegex(),J.em.endUnd=ee(J.em.endUnd,"g").replace(/punctuation/g,J._punctuation).getRegex(),J.strong.start=ee(J.strong.start).replace(/punctuation/g,J._punctuation).getRegex(),J.strong.middle=ee(J.strong.middle).replace(/punctuation/g,J._punctuation).replace(/blockSkip/g,J._blockSkip).getRegex(),J.strong.endAst=ee(J.strong.endAst,"g").replace(/punctuation/g,J._punctuation).getRegex(),J.strong.endUnd=ee(J.strong.endUnd,"g").replace(/punctuation/g,J._punctuation).getRegex(),J.blockSkip=ee(J._blockSkip,"g").getRegex(),J.overlapSkip=ee(J._overlapSkip,"g").getRegex(),J._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,J._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,J._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])?)+(?![-_])/,J.autolink=ee(J.autolink).replace("scheme",J._scheme).replace("email",J._email).getRegex(),J._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,J.tag=ee(J.tag).replace("comment",Q._comment).replace("attribute",J._attribute).getRegex(),J._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,J._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,J._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,J.link=ee(J.link).replace("label",J._label).replace("href",J._href).replace("title",J._title).getRegex(),J.reflink=ee(J.reflink).replace("label",J._label).getRegex(),J.reflinkSearch=ee(J.reflinkSearch,"g").replace("reflink",J.reflink).replace("nolink",J.nolink).getRegex(),J.normal=se({},J),J.pedantic=se({},J.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:ee(/^!?\[(label)\]\((.*?)\)/).replace("label",J._label).getRegex(),reflink:ee(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",J._label).getRegex()}),J.gfm=se({},J.normal,{escape:ee(J.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]*?(?:(?=[\\.5&&(Y="x"+Y.toString(16)),le+="&#"+Y+";";return le}var _e=function(){function me(de){this.tokens=[],this.tokens.links=Object.create(null),this.options=de||Ce,this.options.tokenizer=this.options.tokenizer||new pe,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var Y={block:De.normal,inline:we.normal};this.options.pedantic?(Y.block=De.pedantic,Y.inline=we.pedantic):this.options.gfm&&(Y.block=De.gfm,this.options.breaks?Y.inline=we.breaks:Y.inline=we.gfm),this.tokenizer.rules=Y}me.lex=function(Y,Z){var q=new me(Z);return q.lex(Y)};var le=me.prototype;return le.lex=function(Y){return Y=Y.replace(/\r\n|\r/g,` `).replace(/\t/g," "),this.blockTokens(Y,this.tokens,!0),this.inline(this.tokens),this.tokens},le.blockTokens=function(Y,Z,q){Z===void 0&&(Z=[]),q===void 0&&(q=!0),Y=Y.replace(/^ +$/gm,"");for(var ae,re,Ee,xe;Y;){if(ae=this.tokenizer.space(Y)){Y=Y.substring(ae.raw.length),ae.type&&Z.push(ae);continue}if(ae=this.tokenizer.code(Y,Z)){Y=Y.substring(ae.raw.length),ae.type?Z.push(ae):(xe=Z[Z.length-1],xe.raw+=` `+ae.raw,xe.text+=` `+ae.text);continue}if(ae=this.tokenizer.fences(Y)){Y=Y.substring(ae.raw.length),Z.push(ae);continue}if(ae=this.tokenizer.heading(Y)){Y=Y.substring(ae.raw.length),Z.push(ae);continue}if(ae=this.tokenizer.nptable(Y)){Y=Y.substring(ae.raw.length),Z.push(ae);continue}if(ae=this.tokenizer.hr(Y)){Y=Y.substring(ae.raw.length),Z.push(ae);continue}if(ae=this.tokenizer.blockquote(Y)){Y=Y.substring(ae.raw.length),ae.tokens=this.blockTokens(ae.text,[],q),Z.push(ae);continue}if(ae=this.tokenizer.list(Y)){for(Y=Y.substring(ae.raw.length),Ee=ae.items.length,re=0;re0)for(;(Ve=this.tokenizer.rules.inline.reflinkSearch.exec(xe))!=null;)Le.includes(Ve[0].slice(Ve[0].lastIndexOf("[")+1,-1))&&(xe=xe.slice(0,Ve.index)+"["+"a".repeat(Ve[0].length-2)+"]"+xe.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(Ve=this.tokenizer.rules.inline.blockSkip.exec(xe))!=null;)xe=xe.slice(0,Ve.index)+"["+"a".repeat(Ve[0].length-2)+"]"+xe.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;Y;){if(Ee=this.tokenizer.escape(Y)){Y=Y.substring(Ee.raw.length),Z.push(Ee);continue}if(Ee=this.tokenizer.tag(Y,q,ae)){Y=Y.substring(Ee.raw.length),q=Ee.inLink,ae=Ee.inRawBlock,Z.push(Ee);continue}if(Ee=this.tokenizer.link(Y)){Y=Y.substring(Ee.raw.length),Ee.type==="link"&&(Ee.tokens=this.inlineTokens(Ee.text,[],!0,ae)),Z.push(Ee);continue}if(Ee=this.tokenizer.reflink(Y,this.tokens.links)){Y=Y.substring(Ee.raw.length),Ee.type==="link"&&(Ee.tokens=this.inlineTokens(Ee.text,[],!0,ae)),Z.push(Ee);continue}if(Ee=this.tokenizer.strong(Y,xe,re)){Y=Y.substring(Ee.raw.length),Ee.tokens=this.inlineTokens(Ee.text,[],q,ae),Z.push(Ee);continue}if(Ee=this.tokenizer.em(Y,xe,re)){Y=Y.substring(Ee.raw.length),Ee.tokens=this.inlineTokens(Ee.text,[],q,ae),Z.push(Ee);continue}if(Ee=this.tokenizer.codespan(Y)){Y=Y.substring(Ee.raw.length),Z.push(Ee);continue}if(Ee=this.tokenizer.br(Y)){Y=Y.substring(Ee.raw.length),Z.push(Ee);continue}if(Ee=this.tokenizer.del(Y)){Y=Y.substring(Ee.raw.length),Ee.tokens=this.inlineTokens(Ee.text,[],q,ae),Z.push(Ee);continue}if(Ee=this.tokenizer.autolink(Y,Te)){Y=Y.substring(Ee.raw.length),Z.push(Ee);continue}if(!q&&(Ee=this.tokenizer.url(Y,Te))){Y=Y.substring(Ee.raw.length),Z.push(Ee);continue}if(Ee=this.tokenizer.inlineText(Y,ae,Me)){Y=Y.substring(Ee.raw.length),re=Ee.raw.slice(-1),Z.push(Ee);continue}if(Y){var We="Infinite loop on byte: "+Y.charCodeAt(0);if(this.options.silent){console.error(We);break}else throw new Error(We)}}return Z},G(me,null,[{key:"rules",get:function(){return{block:De,inline:we}}}]),me}(),Pe=N.defaults,je=V.cleanUrl,Qe=V.escape,Ie=function(){function me(de){this.options=de||Pe}var le=me.prototype;return le.code=function(Y,Z,q){var ae=(Z||"").match(/\S*/)[0];if(this.options.highlight){var re=this.options.highlight(Y,ae);re!=null&&re!==Y&&(q=!0,Y=re)}return ae?'
    '+(q?Y:Qe(Y,!0))+`
    `:"
    "+(q?Y:Qe(Y,!0))+`
    `},le.blockquote=function(Y){return`
    `+Y+`
    `},le.html=function(Y){return Y},le.heading=function(Y,Z,q,ae){return this.options.headerIds?"'+Y+" `:""+Y+" `},le.hr=function(){return this.options.xhtml?`
    `:`
    `},le.list=function(Y,Z,q){var ae=Z?"ol":"ul",re=Z&&q!==1?' start="'+q+'"':"";return"<"+ae+re+`> `+Y+" `},le.listitem=function(Y){return"
  • "+Y+`
  • `},le.checkbox=function(Y){return" "},le.paragraph=function(Y){return"

    "+Y+`

    `},le.table=function(Y,Z){return Z&&(Z=""+Z+""),` `+Y+` `+Z+`
    `},le.tablerow=function(Y){return` `+Y+` `},le.tablecell=function(Y,Z){var q=Z.header?"th":"td",ae=Z.align?"<"+q+' align="'+Z.align+'">':"<"+q+">";return ae+Y+" `},le.strong=function(Y){return""+Y+""},le.em=function(Y){return""+Y+""},le.codespan=function(Y){return""+Y+""},le.br=function(){return this.options.xhtml?"
    ":"
    "},le.del=function(Y){return""+Y+""},le.link=function(Y,Z,q){if(Y=je(this.options.sanitize,this.options.baseUrl,Y),Y===null)return q;var ae='",ae},le.image=function(Y,Z,q){if(Y=je(this.options.sanitize,this.options.baseUrl,Y),Y===null)return q;var ae=''+q+'":">",ae},le.text=function(Y){return Y},me}(),Ae=function(){function me(){}var le=me.prototype;return le.strong=function(Y){return Y},le.em=function(Y){return Y},le.codespan=function(Y){return Y},le.del=function(Y){return Y},le.html=function(Y){return Y},le.text=function(Y){return Y},le.link=function(Y,Z,q){return""+q},le.image=function(Y,Z,q){return""+q},le.br=function(){return""},me}(),et=function(){function me(){this.seen={}}var le=me.prototype;return le.slug=function(Y){var Z=Y.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(Z)){var q=Z;do this.seen[q]++,Z=q+"-"+this.seen[q];while(this.seen.hasOwnProperty(Z))}return this.seen[Z]=0,Z},me}(),qe=N.defaults,lt=V.unescape,$e=function(){function me(de){this.options=de||qe,this.options.renderer=this.options.renderer||new Ie,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Ae,this.slugger=new et}me.parse=function(Y,Z){var q=new me(Z);return q.parse(Y)};var le=me.prototype;return le.parse=function(Y,Z){Z===void 0&&(Z=!0);var q="",ae,re,Ee,xe,Ve,Le,We,Ot,Ze,ht,Ut,Ke,It,Zt,At,Yt,Kt,Pt,Rt=Y.length;for(ae=0;ae0&&At.tokens[0].type==="text"?(At.tokens[0].text=Pt+" "+At.tokens[0].text,At.tokens[0].tokens&&At.tokens[0].tokens.length>0&&At.tokens[0].tokens[0].type==="text"&&(At.tokens[0].tokens[0].text=Pt+" "+At.tokens[0].tokens[0].text)):At.tokens.unshift({type:"text",text:Pt}):Zt+=Pt),Zt+=this.parse(At.tokens,It),Ze+=this.renderer.listitem(Zt,Kt,Yt);q+=this.renderer.list(Ze,Ut,Ke);continue}case"html":{q+=this.renderer.html(ht.text);continue}case"paragraph":{q+=this.renderer.paragraph(this.parseInline(ht.tokens));continue}case"text":{for(Ze=ht.tokens?this.parseInline(ht.tokens):ht.text;ae+1An error occurred:

    "+st(Ee.message+"",!0)+"
    ";throw Ee}}Re.options=Re.setOptions=function(me){return ft(Re.defaults,me),Et(Re.defaults),Re},Re.getDefaults=Se,Re.defaults=dt,Re.use=function(me){var le=ft({},me);if(me.renderer&&function(){var Y=Re.defaults.renderer||new Ie,Z=function(re){var Ee=Y[re];Y[re]=function(){for(var xe=arguments.length,Ve=new Array(xe),Le=0;LePt.length){var bt=Object(Ae.xor)(_t,Pt);console.log(bt,"newLevel"),Tt=Tt.filter(function(tt){return!bt.includes(tt)})}Ve(Tt),Ke(Pt.length===(Le==null||((pt=Le.tag_disciplines)===null||pt===void 0)?void 0:pt.length))},Zt=function(Pt){var Rt,pt=Le==null||((Rt=Le.tag_disciplines)===null||Rt===void 0)?void 0:Rt.map(function(Mt){return Mt.id});Ve(Pt.target.checked?Object(Ae.uniq)([].concat(Object(V.a)(xe),Object(V.a)(pt))):xe==null?void 0:xe.filter(function(Mt){return!pt.includes(Mt)})),Ke(Pt.target.checked)};console.log(Le,"options");var At=function(){var Pt,Rt,pt=(Le==null?void 0:Le.tag_disciplines)||[];if(We){var Mt;pt=(Mt=pt)===null||Mt===void 0?void 0:Mt.filter(function(_t){var Tt;return _t==null||((Tt=_t.name)===null||Tt===void 0)?void 0:Tt.includes(We)})}return pt=(Pt=pt)===null||Pt===void 0?void 0:Pt.map(function(_t){return Object(A.a)(Object(A.a)({},_t),{},{label:"".concat(_t.name,"(".concat(_t==null?void 0:_t.item_count,")")),value:_t.id})}),pt=(Rt=pt)===null||Rt===void 0?void 0:Rt.filter(function(_t){return _t.item_count!==0}),pt},Yt=function(){var Pt=!1;if(!We)Pt=!0;else{var Rt;(Rt=Le.tag_disciplines)===null||Rt===void 0||Rt.forEach(function(pt){if(!Pt){var Mt;Pt=((Mt=pt.name)===null||Mt===void 0?void 0:Mt.includes(We))&&pt.item_count!==0}})}return Pt};return(Le==null?void 0:Le.item_count)===0||!Yt()?i.a.createElement(i.a.Fragment,null):i.a.createElement("div",{className:Ie.a.cInput},i.a.createElement("div",{className:Ie.a.cl},i.a.createElement(p.a,{checked:Ut,onChange:Zt},i.a.createElement("span",{className:Ie.a.box},i.a.createElement("span",{className:"font14 c-light-primary"},i.a.createElement("span",{title:Le==null?void 0:Le.name,className:Ie.a.box1}," ",Le==null?void 0:Le.name),i.a.createElement("span",null," ","(".concat(Le==null?void 0:Le.item_count,")"))),i.a.createElement("i",{className:"iconfont icon-lujing font12 ml5"})))),i.a.createElement("div",{className:Ie.a.cr},i.a.createElement(et,{options:At(),value:xe,onChange:It})))},lt=qe,$e=H("ErOA"),ft=H("ozfa"),ut=H("MJZm"),st=H("0Owb"),Se=H("tmPe"),Et=H.n(Se),dt=function(re){var Ee=re.value,xe=re.onChange,Ve=re.defaultValue,Le=re.treeData,We=Le===void 0?[]:Le,Ot=Object(je.a)(re,["value","onChange","defaultValue","treeData"]);return i.a.createElement("div",{className:Et.a.customTree},i.a.createElement(ut.a,Object(st.a)({multiple:!0,showIcon:!0,selectedKeys:Ee,defaultExpandedKeys:Ve,treeData:We,onSelect:xe},Ot)))},Re=dt,He=H("sbIO"),me=b.a.Search,le=function(re){var Ee,xe=re.formValue,Ve=re.setFatherTabs,Le=re.tabs,We=re.editData,Ot=re.dispatch,Ze=Object(c.i)().id,ht=Object(l.useState)(["mine"]),Ut=Object(R.a)(ht,2),Ke=Ut[0],It=Ut[1],Zt=Object(l.useState)(!0),At=Object(R.a)(Zt,2),Yt=At[0],Kt=At[1],Pt=Object(l.useState)(!1),Rt=Object(R.a)(Pt,2),pt=Rt[0],Mt=Rt[1],_t=Object(l.useState)(!1),Tt=Object(R.a)(_t,2),bt=Tt[0],tt=Tt[1],Fe=Object(l.useState)(""),Jt=Object(R.a)(Fe,2),Wt=Jt[0],qt=Jt[1],Vt=Object(l.useState)(!1),un=Object(R.a)(Vt,2),$t=un[0],rt=un[1],Ne=Object(l.useState)(!1),vt=Object(R.a)(Ne,2),In=vt[0],fr=vt[1],gr=Object(l.useState)({}),Tn=Object(R.a)(gr,2),Ht=Tn[0],wt=Tn[1],Sn=Object(l.useState)([]),Ge=Object(R.a)(Sn,2),sn=Ge[0],Dn=Ge[1],Kr=Object(l.useState)([]),Hr=Object(R.a)(Kr,2),Un=Hr[0],aa=Hr[1],ia=Object(l.useState)([]),yr=Object(R.a)(ia,2),kr=yr[0],oa=yr[1],qr=Object(l.useState)([]),Er=Object(R.a)(qr,2),Nn=Er[0],ea=Er[1],sa=Object(l.useState)(null),Wn=Object(R.a)(sa,2),mt=Wn[0],ye=Wn[1],Xe=Object(l.useRef)([]),Lt=Object(l.useState)(!1),xt=Object(R.a)(Lt,2),Ct=xt[0],Nt=xt[1],En=Object(l.useState)([]),bn=Object(R.a)(En,2),nn=bn[0],Ln=bn[1],Pn=Object(l.useState)([0]),er=Object(R.a)(Pn,2),Fn=er[0],Ir=er[1],Qn=Object(l.useState)([]),Cn=Object(R.a)(Qn,2),hr=Cn[0],wr=Cn[1],Ar=Object(l.useRef)([]),Na=Object(l.useState)(!1),br=Object(R.a)(Na,2),Fa=br[0],ta=br[1],Ta=Object(l.useState)([]),Vr=Object(R.a)(Ta,2),mn=Vr[0],Xr=Vr[1],Br=Object(l.useState)([]),fa=Object(R.a)(Br,2),$r=fa[0],la=fa[1],na=Object(l.useRef)([]),kt=Object(l.useState)([]),zt=Object(R.a)(kt,2),Bt=zt[0],en=zt[1],on=Object(l.useState)(!1),pn=Object(R.a)(on,2),an=pn[0],Kn=pn[1],tr=Object(l.useRef)([]),rn=Object(l.useState)(0),Gr=Object(R.a)(rn,2),dn=Gr[0],Vn=Gr[1],Hn=hr==null?void 0:hr.filter(function(it){return nn==null?void 0:nn.includes(it.id)}),Ur=$r==null?void 0:$r.filter(function(it){return mn==null?void 0:mn.includes(it.id)});Object(l.useEffect)(function(){Sa()},[]),Object(l.useEffect)(function(){return Le===1&&(Ot({type:"globalSetting/onlyShowBackTopToggle",payload:!1}),Ot({type:"globalSetting/onlyShowBackTopIconToggle",payload:!1})),function(){Ot({type:"globalSetting/onlyShowBackTopToggle",payload:!0}),Ot({type:"globalSetting/onlyShowBackTopIconToggle",payload:!0})}},[Le]),Object(l.useEffect)(function(){Ze?We&&Zn():(Ba(Ke),ha(),Kt(!1))},[We]),Object(l.useEffect)(function(){Wt&&Ji()},[Wt]);var Ji=function(){var Ye=null;Un==null||Un.forEach(function(ke){var Oe;(Oe=ke.sub_disciplines)===null||Oe===void 0||Oe.forEach(function(ot){var at;(at=ot.tag_disciplines)===null||at===void 0||at.forEach(function(ct){var jt,Qt=((jt=ct.name)===null||jt===void 0?void 0:jt.includes(Wt))&&ct.item_count!==0;Qt&&!Ye&&(Ye=ke.id)})})}),Ye&&ye(Ye)},Qi=function(Ye){function ke(Oe){var ot=Oe.children,at=Array.isArray(ot)&&ot.length>0,ct=Oe==null?void 0:Oe.group_id;return tr.current.push({name:Oe==null?void 0:Oe.name,id:ct,count:Oe==null?void 0:Oe.count}),{title:i.a.createElement("div",{title:Oe==null?void 0:Oe.name,className:I.a.name},Oe==null?void 0:Oe.name,"\uFF08".concat(Oe==null?void 0:Oe.count,"\uFF09")),value:ct,name:Oe==null?void 0:Oe.name,key:ct,count:Oe==null?void 0:Oe.count,id:ct,icon:i.a.createElement("i",{className:"iconfont icon-wenjianjia2 c-light-primary mr10",style:{lineHeight:"19px"}}),children:at?ot==null?void 0:ot.map(function(jt){return ke(jt)}):[]}}return Ye==null?void 0:Ye.map(function(Oe){return ke(Oe)})},Sa=function(){var it=Object(O.a)(f.a.mark(function Ye(){var ke,Oe;return f.a.wrap(function(at){for(;;)switch(at.prev=at.next){case 0:return at.next=2,Object($.A)({});case 2:ke=at.sent,tr.current=[{id:0,name:"\u6839\u76EE\u5F55",count:ke==null?void 0:ke.root_count}],ke!=null&&ke.data&&(Oe=[{title:i.a.createElement("div",{title:"\u6839\u76EE\u5F55",className:I.a.name},"\u6839\u76EE\u5F55","\uFF08".concat((ke==null?void 0:ke.root_count)||0,"\uFF09")),value:0,id:0,key:0,count:ke==null?void 0:ke.root_count,name:"\u6839\u76EE\u5F55",icon:i.a.createElement("i",{className:"iconfont icon-wenjianjia2 c-light-primary mr10",style:{lineHeight:"19px"}}),children:Qi(ke.data||[])}],wr(tr.current),en(Oe));case 5:case"end":return at.stop()}},Ye)}));return function(){return it.apply(this,arguments)}}(),Zn=function(){var it=Object(O.a)(f.a.mark(function Ye(){var ke,Oe,ot,at,ct,jt,Qt,vn,fn,gn,cn,Gn,wn,An,nr,Xn,Bn,rr;return f.a.wrap(function(Xt){for(;;)switch(Xt.prev=Xt.next){case 0:return gn=We==null||((ke=We.tag_disciplines)===null||ke===void 0)?void 0:ke.map(function(ln){return ln.tag_discipline_id}),cn=We==null||((Oe=We.groups)===null||Oe===void 0)?void 0:Oe.map(function(ln){return ln.id}),Gn={source:We==null||((ot=We.examination_bank)===null||ot===void 0)?void 0:ot.source,group_ids:cn,tag_discipline_ids:gn,teach_group_ids:We==null?void 0:We.teach_group_ids},Xt.next=5,Object($e.a)("/api/examination_intelligent_settings/form_paper.json",{method:"post",body:Gn});case 5:if(wn=Xt.sent,!((wn==null?void 0:wn.status)===-1)){Xt.next=8;break}return Xt.abrupt("return");case 8:An=wn==null?void 0:wn.filter(function(ln){var Mn;return!!(ln!=null&&(Mn=ln.item_banks)!==null&&Mn!==void 0&&Mn.length)}),An=An.map(function(ln){return Object(A.a)(Object(A.a)({},ln),{},{scoreTotal:0,score:0,questionTotal:0})}),An=(at=An)===null||at===void 0?void 0:at.map(function(ln,Mn){var ar,$n,_r;return Object(A.a)(Object(A.a)({},ln),{},{score:(We==null||((ar=We.score_settings)===null||ar===void 0||(($n=ar.find(function(Tr){return Tr.item_type===(ln==null?void 0:ln.item_type)}))===null||$n===void 0))?void 0:$n.score)||0,item_banks:ln==null||((_r=ln.item_banks)===null||_r===void 0)?void 0:_r.map(function(Tr){var xn;return Object(A.a)(Object(A.a)({},Tr),{},{tag_disciplines:Tr==null||((xn=Tr.tag_disciplines)===null||xn===void 0)?void 0:xn.map(function(Rn){var ir;return Object(A.a)(Object(A.a)({},Rn),{},{difficulties:Rn==null||((ir=Rn.difficulties)===null||ir===void 0)?void 0:ir.map(function(mr){var or=We==null?void 0:We.contents.find(function(Dr){return Dr.item_type===ln.item_type&&Dr.sub_discipline_id===Tr.sub_discipline_id&&Dr.tag_discipline_id===Rn.tag_discipline_id&&Dr.difficulty===mr.difficulty});return or?Object(A.a)(Object(A.a)({},mr),{},{num:or==null?void 0:or.quanlity}):Object(A.a)({},mr)})})})})})})}),nr=Ca(An),Xn=nr.panel,Bn=nr.score_num_item,An=(ct=An)===null||ct===void 0?void 0:ct.map(function(ln,Mn){var ar,$n=(Xn==null||((ar=Xn[Mn])===null||ar===void 0)?void 0:ar.reduce(function(_r,Tr){return _r+Tr},0))||0;return Object(A.a)(Object(A.a)({},ln),{},{scoreTotal:$n*(Bn[Mn]||0),questionTotal:$n})}),rr=[],We==null||((jt=We.sort_by_item_type)===null||jt===void 0)||jt.forEach(function(ln){var Mn=An.find(function(ar){var $n,_r=($n=wa.find(function(Tr){return Tr.type===(ar==null?void 0:ar.item_type)}))===null||$n===void 0?void 0:$n.name;return _r===ln});rr.push(Mn)}),rr=Object(Ae.compact)(rr),Ba(We==null||((Qt=We.examination_bank)===null||Qt===void 0)?void 0:Qt.source),ha(),It(We==null||((vn=We.examination_bank)===null||vn===void 0)?void 0:vn.source),ea(gn),Xe.current=gn,Ln(cn),Xr((We==null?void 0:We.teach_group_ids)||[]),Vn(We==null||((fn=We.groups)===null||fn===void 0)?void 0:fn.map(function(ln){return ln.count}).reduce(function(ln,Mn){return ln+Mn},0)),Ar.current=cn,Ir(cn!=null&&cn.length?cn:[0]),Dn(Object(Ae.cloneDeep)(rr)),Kt(!1);case 29:case"end":return Xt.stop()}},Ye)}));return function(){return it.apply(this,arguments)}}(),Zi=function(){var it=Object(O.a)(f.a.mark(function Ye(){var ke;return f.a.wrap(function(ot){for(;;)switch(ot.prev=ot.next){case 0:ke={source:Ke,group_ids:nn,tag_discipline_ids:Nn,teach_group_ids:mn},ua(ke),Xe.current=Nn,rt(!1);case 4:case"end":return ot.stop()}},Ye)}));return function(){return it.apply(this,arguments)}}(),Ba=function(){var it=Object(O.a)(f.a.mark(function Ye(ke){var Oe,ot,at,ct,jt,Qt;return f.a.wrap(function(fn){for(;;)switch(fn.prev=fn.next){case 0:return fn.next=2,Object($e.a)("/api/disciplines.json",{method:"get",params:{source:"question",question_source:ke}});case 2:at=fn.sent,ct=[],at==null||((Oe=at.disciplines)===null||Oe===void 0)||Oe.forEach(function(gn){var cn;gn==null||((cn=gn.sub_disciplines)===null||cn===void 0)||cn.forEach(function(Gn){ct=ct.concat((Gn==null?void 0:Gn.tag_disciplines)||[])})}),jt=null,Qt=at==null||((ot=at.disciplines)===null||ot===void 0)?void 0:ot.map(function(gn){var cn,Gn=gn==null||((cn=gn.sub_disciplines)===null||cn===void 0)?void 0:cn.reduce(function(wn,An){return wn+An.item_count},0);return!jt&&Gn!==0&&(jt=gn.id),Object(A.a)(Object(A.a)({},gn),{},{item_count:Gn})}),console.log(Qt,48767874),aa(Qt),oa(ct),ye(jt);case 11:case"end":return fn.stop()}},Ye)}));return function(ke){return it.apply(this,arguments)}}(),ha=function(){var it=Object(O.a)(f.a.mark(function Ye(){var ke;return f.a.wrap(function(ot){for(;;)switch(ot.prev=ot.next){case 0:return ot.next=2,Object($e.a)("/api/teach_groups.json",{method:"get",params:{is_random_exam:!0}});case 2:ke=ot.sent,la((ke==null?void 0:ke.groups)||[]);case 4:case"end":return ot.stop()}},Ye)}));return function(){return it.apply(this,arguments)}}(),ua=function(){var it=Object(O.a)(f.a.mark(function Ye(ke){var Oe,ot;return f.a.wrap(function(ct){for(;;)switch(ct.prev=ct.next){case 0:return Kt(!0),ct.next=3,Object($e.a)("/api/examination_intelligent_settings/form_paper.json",{method:"post",body:ke});case 3:Oe=ct.sent,ot=Oe==null?void 0:Oe.filter(function(jt){var Qt;return!!(jt!=null&&(Qt=jt.item_banks)!==null&&Qt!==void 0&&Qt.length)}),ot=ot.map(function(jt){return Object(A.a)(Object(A.a)({},jt),{},{scoreTotal:0,score:0,questionTotal:0})}),Dn(ot),Kt(!1);case 8:case"end":return ct.stop()}},Ye)}));return function(ke){return it.apply(this,arguments)}}(),wi=function(){ea(Xe.current),rt(!1),qt("")},qi=function(Ye){ea(Ye)},ti=function(){for(var Ye=kr==null?void 0:kr.filter(function(vn){return Nn==null?void 0:Nn.includes(vn.id)}),ke=Object(V.a)(Ye),Oe=0,ot=[],at=0;at1&&Ye!==0&&(ke=ma(Oe,Ye,Ye-1)),Dn(ke)},ja=function(Ye){var ke=[],Oe=Object(Ae.cloneDeep)(sn);Oe.length>1&&Ye!==Oe.length-1&&(ke=ma(Oe,Ye,Ye+1)),Dn(ke)},Aa=function(){var it=Object(O.a)(f.a.mark(function Ye(ke){var Oe,ot,at,ct;return f.a.wrap(function(Qt){for(;;)switch(Qt.prev=Qt.next){case 0:if(at=Object(V.a)(Ke),Ke.includes(ke)?at=at.filter(function(vn){return vn!==ke}):at.push(ke),!(at.length===0)){Qt.next=5;break}return j.b.warn("\u8BD5\u9898\u6765\u6E90\u4E3A\u5FC5\u9009\u9879"),Qt.abrupt("return");case 5:(Oe=at)!==null&&Oe!==void 0&&Oe.includes("mine")||(Ln([]),Ar.current=[]),(ot=at)!==null&&ot!==void 0&&ot.includes("teach_groups")||(Xr([]),na.current=[]),It(at),Ba(at),ea([]),Xe.current=[],ct={source:at,group_ids:Ar.current,tag_discipline_ids:[],teach_group_ids:na.current},ua(ct);case 13:case"end":return Qt.stop()}},Ye)}));return function(ke){return it.apply(this,arguments)}}(),Ri=function(Ye){var ke={1:"\u4E00",2:"\u4E8C",3:"\u4E09",4:"\u56DB",5:"\u4E94",6:"\u516D",7:"\u4E03"};if(!Ye)return;var Oe=Ye||{},ot=Oe.exam,at=Oe.single_questions,ct=Oe.multiple_questions,jt=Oe.judgement_questions,Qt=Oe.program_questions,vn=Oe.completion_questions,fn=Oe.subjective_questions,gn=Oe.practical_questions,cn=Oe.combination_questions,Gn=[Object(A.a)({type:"SINGLE",name:"\u5355\u9009\u9898"},at),Object(A.a)({type:"MULTIPLE",name:"\u591A\u9009\u9898"},ct),Object(A.a)({type:"COMPLETION",name:"\u586B\u7A7A\u9898"},vn),Object(A.a)({type:"JUDGMENT",name:"\u5224\u65AD\u9898"},jt),Object(A.a)({type:"SUBJECTIVE",name:"\u7B80\u7B54\u9898"},fn),Object(A.a)({type:"PROGRAM",name:"\u7F16\u7A0B\u9898"},Qt),Object(A.a)({type:"PRACTICAL",name:"\u5B9E\u8BAD\u9898"},gn),Object(A.a)({type:"COMBINATION",name:"\u7EC4\u5408\u9898"},cn)],wn=[],An=0,nr=0,Xn=Gn.filter(function(Bn){return Bn.questions_count>0}).map(function(Bn,rr){var xr;return(xr=Bn.questions)===null||xr===void 0||xr.forEach(function(Xt){wn.push(Xt.id),An=An+Xt.score,nr=nr+1}),Object(A.a)(Object(A.a)({},Bn),{number:ke[rr+1]})});return{all_questions_count:nr,all_score:An,questionList:Xn,ids:wn,exam:ot}},zr=function(Ye){var ke,Oe,ot=Object(Ae.cloneDeep)(Ht),at=Object(Ae.cloneDeep)(sn);ot.questionList=ot==null||((ke=ot.questionList)===null||ke===void 0)?void 0:ke.map(function(ct){return ct.type===Ye.type?Object(A.a)(Object(A.a)({},ct),{},{questions_score:Ye.scoreTotal}):ct}),at=(Oe=at)===null||Oe===void 0?void 0:Oe.map(function(ct){return ct.item_type===Ye.type?Object(A.a)(Object(A.a)({},ct),{},{score:Ye.score,scoreTotal:Ye.scoreTotal}):ct}),Dn(at),wt(ot),console.log(Ye,Ht,sn)},Jr=Un==null||((Ee=Un.find(function(it){return it.id===mt}))===null||Ee===void 0)?void 0:Ee.sub_disciplines,Da=ti();return In?i.a.createElement(He.a,{loading:pt,submit:Di,goBack:function(){return fr(!1)},data:Ht,onTypeScore:zr,onExchange:ni}):i.a.createElement("section",{className:I.a.wrap,style:{display:Le?"flex":"none"}},i.a.createElement("div",{id:"id_left",className:I.a.left,onMouseEnter:function(Ye){var ke=document.getElementById("id_left");ke.style.overflowY="auto"},onMouseLeave:function(Ye){var ke=document.getElementById("id_left");ke.style.overflowY="hidden"}},i.a.createElement(G.a,{loading:Yt,active:!0,paragraph:{rows:5}},sn.map(function(it,Ye){var ke;return i.a.createElement("div",{className:I.a.list,key:Ye},i.a.createElement("div",{className:I.a.name},i.a.createElement("b",null),i.a.createElement("span",null,(ke=wa.find(function(Oe){return Oe.type===(it==null?void 0:it.item_type)}))===null||ke===void 0?void 0:ke.name)),i.a.createElement("aside",null,i.a.createElement("div",null,"\u5171",i.a.createElement("span",{className:I.a.b},it.questionTotal),"\u9898",i.a.createElement("span",{className:I.a.l},"|"),"\u5171",i.a.createElement("span",{className:I.a.r},it.scoreTotal),"\u5206"),i.a.createElement("div",null,Ye>0?i.a.createElement(L.a,{getPopupContainer:function(ot){return document.getElementById("id_left")},title:"\u4E0A\u79FB"},i.a.createElement("span",{onClick:function(){return Yr(Ye)},className:"mb20",style:{transform:"rotate(270deg)"}}," ",i.a.createElement("i",{className:"icon-jiantou1"}))):i.a.createElement("span",{className:"mb20",style:{transform:"rotate(270deg)",cursor:"not-allowed"}}," ",i.a.createElement("i",{className:"icon-jiantou1"})),Ye"),i.a.createElement("span",{className:"current",onClick:function(){return _.d.push("/paperlibrary")}},"\u8BD5\u5377\u5E93>"),i.a.createElement("span",{style:{color:"#bebebe"}},"\u968F\u673A\u7EC4\u5377")),Ze===0&&i.a.createElement(h,{value:Ze,onChange:qt}),Ze===0&&i.a.createElement("section",{className:m.a.oneWrap},i.a.createElement("div",{className:m.a.title},i.a.createElement("b",null),i.a.createElement("span",null,"\u57FA\u672C\u4FE1\u606F"),i.a.createElement("div",null,"STEP1")," "),i.a.createElement(C.a,{className:m.a.formWrap,form:It,layout:"horizontal",onValuesChange:Jt},i.a.createElement(C.a.Item,{label:"\u8BD5\u5377\u540D\u79F0",name:"name",rules:[{required:!0,message:"\u8BD5\u5377\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A"},{pattern:/^(?!(\s+$))/,message:"\u8F93\u5165\u6846\u4E0D\u80FD\u5168\u4E3A\u7A7A\u683C"}]},i.a.createElement(b.a,{className:m.a.in,bordered:!1,placeholder:"\u8BF7\u8F93\u5165\u8BD5\u5377\u540D\u79F0\uFF0C\u6700\u591A60\u4E2A\u5B57",maxLength:60})),i.a.createElement("div",{style:{position:"relative"}},i.a.createElement(C.a.Item,{label:"\u7B54\u9898\u65F6\u957F:",name:"time",rules:[{required:!0,message:"\u7B54\u9898\u65F6\u957F\u4E0D\u80FD\u4E3A\u7A7A"}]},i.a.createElement(M.a,{min:1,parser:Vt,max:9999,placeholder:"\u8BF7\u8F93\u5165\u7B54\u9898\u65F6\u957F",style:{width:190}})),i.a.createElement("span",{style:{position:"absolute",top:26,left:310}},"\u5206\u949F")),i.a.createElement(C.a.Item,{label:"\u8BD5\u9898\u96BE\u5EA6",name:"difficulty",rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u96BE\u5EA6"}]},i.a.createElement(P.a.Group,{style:{display:"flex",width:286,justifyContent:"space-between"},size:"large"},i.a.createElement(P.a.Button,{className:m.a.rb,value:1},"\u7B80\u5355"),i.a.createElement(P.a.Button,{className:m.a.rb,value:2},"\u9002\u4E2D"),i.a.createElement(P.a.Button,{className:m.a.rb,value:3},"\u56F0\u96BE"))),i.a.createElement(C.a.Item,{label:"\u8003\u8BD5\u987B\u77E5",name:"exam_notes"},i.a.createElement(Y,{placeholder:"\u8003\u751F\u5FC5\u987B\u4E25\u683C\u9075\u5B88\u8003\u573A\u7EAA\u5F8B\uFF0C\u4E0D\u51C6\u5192\u540D\u9876\u66FF\uFF0C\u4E0D\u51C6\u6709\u4EFB\u4F55\u4F5C\u5F0A\u884C\u4E3A\u3002\u5982\u53D1\u73B0\u8FDD\u7EAA\uFF0C\u5E76\u7ED9\u4E88\u4E25\u5389\u5904\u5206\u3002",rows:4,maxLength:300}))),i.a.createElement("div",{className:m.a.btns},i.a.createElement(K.a,{className:"mr40",onClick:function(){return _.d.push("/paperlibrary")}},"\u8FD4\u56DE"),i.a.createElement(K.a,{type:"primary",onClick:Object(O.a)(f.a.mark(function un(){return f.a.wrap(function(rt){for(;;)switch(rt.prev=rt.next){case 0:return rt.next=2,It.validateFields();case 2:ht(1);case 3:case"end":return rt.stop()}},un)}))},"\u4E0B\u4E00\u6B65"))),i.a.createElement(de,{tabs:Ze,dispatch:Le,editData:bt,setFatherTabs:ht,formValue:Yt})))},q=Be.default=Object(_.a)(function(ae){var re=ae.paperlibrary,Ee=ae.user,xe=ae.globalSetting;return{paperlibrary:re,user:Ee,globalSetting:xe}})(Z)},"E/GV":function(Je,Be,H){Je.exports=H.p+"static/swenjianjia.1640bf70.svg"},ELLl:function(Je,Be,H){(function(ne){ne(H("VrN/"))})(function(ne){var G={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},D=ne.Pos;ne.defineOption("autoCloseBrackets",!1,function(b,x,f){f&&f!=ne.Init&&(b.removeKeyMap(k),b.state.closeBrackets=null),x&&(P(K(x,"pairs")),b.state.closeBrackets=x,b.addKeyMap(k))});function K(b,x){return x=="pairs"&&typeof b=="string"?b:typeof b=="object"&&b[x]!=null?b[x]:G[x]}var k={Backspace:O,Enter:A};function P(b){for(var x=0;x=0;i--){var _=l[i].head;b.replaceRange("",D(_.line,_.ch-1),D(_.line,_.ch+1),"+delete")}}function A(b){var x=M(b),f=x&&K(x,"explode");if(!f||b.getOption("disableInput"))return ne.Pass;for(var l=b.listSelections(),i=0;i0;return{anchor:new D(b.anchor.line,b.anchor.ch+(x?-1:1)),head:new D(b.head.line,b.head.ch+(x?1:-1))}}function C(b,x){var f=M(b);if(!f||b.getOption("disableInput"))return ne.Pass;var l=K(f,"pairs"),i=l.indexOf(x);if(i==-1)return ne.Pass;for(var c=K(f,"closeBefore"),_=K(f,"triples"),v=l.charAt(i+1)==x,m=b.listSelections(),u=i%2==0,y,d=0;d=0&&b.getRange(s,D(s.line,s.ch+3))==x+x+x?o="skipThree":o="skip";else if(v&&s.ch>1&&_.indexOf(x)>=0&&b.getRange(D(s.line,s.ch-2),s)==x+x){if(s.ch>2&&/\bstring/.test(b.getTokenTypeAt(D(s.line,s.ch-2))))return ne.Pass;o="addFour"}else if(v){var p=s.ch==0?" ":b.getRange(D(s.line,s.ch-1),s);if(!ne.isWordChar(g)&&p!=x&&!ne.isWordChar(p))o="both";else return ne.Pass}else if(u&&(g.length===0||/\s/.test(g)||c.indexOf(g)>-1))o="both";else return ne.Pass;if(!y)y=o;else if(y!=o)return ne.Pass}var E=i%2?l.charAt(i-1):x,L=i%2?x:l.charAt(i+1);b.operation(function(){if(y=="skip")b.execCommand("goCharRight");else if(y=="skipThree")for(var F=0;F<3;F++)b.execCommand("goCharRight");else if(y=="surround"){for(var j=b.getSelections(),F=0;F1&&arguments[1]!==void 0?arguments[1]:1,de=Ae.length,Y=0;Y1&&arguments[1]!==void 0?arguments[1]:!1;return Object(u.a)(I).map(function(ie,ue){if(!k.isValidElement(ie)||!ie.type)return null;var fe=ie.type.isSelectOptGroup,ve=ie.key,pe=ie.props,te=pe.children,ee=Object(N.a)(pe,["children"]);return $||!fe?y(ie):Object(m.a)(Object(m.a)({key:"__RC_SELECT_GRP__".concat(ve===null?ue:ve,"__"),label:ve},ee),{},{options:d(te)})}).filter(function(ie){return ie})}var h=H("2Qr1"),s=H("qNPg"),o=H("U8pU"),g=H("Kwbf"),p=H("WKfj");function E(I){var $=I.mode,ie=I.options,ue=I.children,fe=I.backfill,ve=I.allowClear,pe=I.placeholder,te=I.getInputElement,ee=I.showSearch,se=I.onSearch,Q=I.defaultOpen,J=I.autoFocus,he=I.labelInValue,Ce=I.value,De=I.inputValue,we=I.optionLabelProp,Me=$==="multiple"||$==="tags",Te=ee!==void 0?ee:Me||$==="combobox",_e=ie||d(ue);if(Object(g.a)($!=="tags"||_e.every(function(Ie){return!Ie.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),$==="tags"||$==="combobox"){var Pe=_e.some(function(Ie){return Ie.options?Ie.options.some(function(Ae){return typeof("value"in Ae?Ae.value:Ae.key)=="number"}):typeof("value"in Ie?Ie.value:Ie.key)=="number"});Object(g.a)(!Pe,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(g.a)($!=="combobox"||!we,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(g.a)($==="combobox"||!fe,"`backfill` only works with `combobox` mode."),Object(g.a)($==="combobox"||!te,"`getInputElement` only work with `combobox` mode."),Object(g.b)($!=="combobox"||!te||!ve||!pe,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),se&&!Te&&$!=="combobox"&&$!=="tags"&&Object(g.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(g.b)(!Q||J,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),Ce!=null){var je=Object(p.d)(Ce);Object(g.a)(!he||je.every(function(Ie){return Object(o.a)(Ie)==="object"&&("key"in Ie||"value"in Ie)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(g.a)(!Me||Array.isArray(Ce),"`value` should be array when `mode` is `multiple` or `tags`")}if(ue){var Qe=null;Object(u.a)(ue).some(function(Ie){if(!k.isValidElement(Ie)||!Ie.type)return!1;var Ae=Ie.type;if(Ae.isSelectOption)return!1;if(Ae.isSelectOptGroup){var et=Object(u.a)(Ie.props.children).every(function(qe){return!k.isValidElement(qe)||!Ie.type||qe.type.isSelectOption?!0:(Qe=qe.type,!1)});return!et}return Qe=Ae,!0}),Qe&&Object(g.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(Qe.displayName||Qe.name||Qe,"`.")),Object(g.a)(De===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var L=E,F=Object(s.a)({prefixCls:"rc-select",components:{optionList:l},convertChildrenToData:d,flattenOptions:h.d,getLabeledValue:h.e,filterOptions:h.b,isValueDisabled:h.g,findValueOption:h.c,warningProps:L,fillOptionsWithMissingValue:h.a}),j=function(I){Object(D.a)(ie,I);var $=Object(K.a)(ie);function ie(){var ue;return Object(ne.a)(this,ie),ue=$.apply(this,arguments),ue.selectRef=k.createRef(),ue.focus=function(){ue.selectRef.current.focus()},ue.blur=function(){ue.selectRef.current.blur()},ue}return Object(G.a)(ie,[{key:"render",value:function(){return k.createElement(F,Object.assign({ref:this.selectRef},this.props))}}]),ie}(k.Component);j.Option=c,j.OptGroup=v;var V=j,B=Be.c=V},M8RZ:function(Je,Be,H){"use strict";H.d(Be,"a",function(){return O});var ne=H("fWQN"),G=H("mtLc"),D=H("yKVA"),K=H("879j"),k=H("cDcd"),P=H.n(k),N=H("faye"),M=H.n(N),O=function(A){Object(D.a)(C,A);var T=Object(K.a)(C);function C(R){var S;Object(ne.a)(this,C),S=T.call(this,R);var b=window.document;return S.node=b.createElement("div"),b.body.appendChild(S.node),S}return Object(G.a)(C,[{key:"render",value:function(){var S=this.props.children;return Object(N.createPortal)(S,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),C}(P.a.Component)},NvD2:function(Je,Be,H){"use strict";H.d(Be,"a",function(){return P});var ne=H("Kwbf");function G(N,M){var O=new Set;return N.forEach(function(A){M.has(A)||O.add(A)}),O}function D(N){var M=N||{},O=M.disabled,A=M.disableCheckbox,T=M.checkable;return!!(O||A)||T===!1}function K(N,M,O,A){for(var T=new Set(N),C=new Set,R=0;R<=O;R+=1){var S=M.get(R)||new Set;S.forEach(function(l){var i=l.key,c=l.node,_=l.children,v=_===void 0?[]:_;T.has(i)&&!A(c)&&v.filter(function(m){return!A(m.node)}).forEach(function(m){T.add(m.key)})})}for(var b=new Set,x=O;x>=0;x-=1){var f=M.get(x)||new Set;f.forEach(function(l){var i=l.parent,c=l.node;if(A(c)||!l.parent||b.has(l.parent.key))return;if(A(l.parent.node)){b.add(i.key);return}var _=!0,v=!1;(i.children||[]).filter(function(m){return!A(m.node)}).forEach(function(m){var u=m.key,y=T.has(u);_&&!y&&(_=!1),!v&&(y||C.has(u))&&(v=!0)}),_&&T.add(i.key),v&&C.add(i.key),b.add(i.key)})}return{checkedKeys:Array.from(T),halfCheckedKeys:Array.from(G(C,T))}}function k(N,M,O,A,T){for(var C=new Set(N),R=new Set(M),S=0;S<=A;S+=1){var b=O.get(S)||new Set;b.forEach(function(i){var c=i.key,_=i.node,v=i.children,m=v===void 0?[]:v;!C.has(c)&&!R.has(c)&&!T(_)&&m.filter(function(u){return!T(u.node)}).forEach(function(u){C.delete(u.key)})})}R=new Set;for(var x=new Set,f=A;f>=0;f-=1){var l=O.get(f)||new Set;l.forEach(function(i){var c=i.parent,_=i.node;if(T(_)||!i.parent||x.has(i.parent.key))return;if(T(i.parent.node)){x.add(c.key);return}var v=!0,m=!1;(c.children||[]).filter(function(u){return!T(u.node)}).forEach(function(u){var y=u.key,d=C.has(y);v&&!d&&(v=!1),!m&&(d||R.has(y))&&(m=!0)}),v||C.delete(c.key),m&&R.add(c.key),x.add(c.key)})}return{checkedKeys:Array.from(C),halfCheckedKeys:Array.from(G(R,C))}}function P(N,M,O,A){var T=[],C;A?C=A:C=D;var R=new Set(N.filter(function(f){var l=!!O[f];return l||T.push(f),l})),S=new Map,b=0;Object.keys(O).forEach(function(f){var l=O[f],i=l.level,c=S.get(i);c||(c=new Set,S.set(i,c)),c.add(l),b=Math.max(b,i)}),Object(ne.a)(!T.length,"Tree missing follow keys: ".concat(T.slice(0,100).map(function(f){return"'".concat(f,"'")}).join(", ")));var x;return M===!0?x=K(R,S,b,C):x=k(R,M.halfCheckedKeys,S,b,C),x}},O2Wb:function(Je,Be,H){Je.exports={flex:"flex___2gmSR",flex1:"flex1___3Tu1g",color666:"color666___2uyGL",error:"error___yJ86W",deleteIcon:"deleteIcon___1D2tg",addIcon:"addIcon___2VIYB"}},OLES:function(Je,Be,H){"use strict";var ne=H("U8pU"),G=H("VTBJ"),D=H("Ff2n"),K=H("cDcd"),k=H("uciX"),P=H("7ixt"),N=function(R){var S=R.overlay,b=R.prefixCls,x=R.id,f=R.overlayInnerStyle;return K.createElement("div",{className:"".concat(b,"-inner"),id:x,role:"tooltip",style:f},typeof S=="function"?S():S)},M=N,O=function(R,S){var b=R.overlayClassName,x=R.trigger,f=x===void 0?["hover"]:x,l=R.mouseEnterDelay,i=l===void 0?0:l,c=R.mouseLeaveDelay,_=c===void 0?.1:c,v=R.overlayStyle,m=R.prefixCls,u=m===void 0?"rc-tooltip":m,y=R.children,d=R.onVisibleChange,h=R.afterVisibleChange,s=R.transitionName,o=R.animation,g=R.placement,p=g===void 0?"right":g,E=R.align,L=E===void 0?{}:E,F=R.destroyTooltipOnHide,j=F===void 0?!1:F,V=R.defaultVisible,B=R.getTooltipContainer,I=R.overlayInnerStyle,$=Object(D.a)(R,["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle"]),ie=Object(K.useRef)(null);Object(K.useImperativeHandle)(S,function(){return ie.current});var ue=Object(G.a)({},$);"visible"in R&&(ue.popupVisible=R.visible);var fe=function(){var se=R.arrowContent,Q=se===void 0?null:se,J=R.overlay,he=R.id;return[K.createElement("div",{className:"".concat(u,"-arrow"),key:"arrow"},Q),K.createElement(M,{key:"content",prefixCls:u,id:he,overlay:J,overlayInnerStyle:I})]},ve=!1,pe=!1;if(typeof j=="boolean")ve=j;else if(j&&Object(ne.a)(j)==="object"){var te=j.keepParent;ve=te===!0,pe=te===!1}return K.createElement(k.a,Object.assign({popupClassName:b,prefixCls:u,popup:fe,action:f,builtinPlacements:P.a,popupPlacement:p,ref:ie,popupAlign:L,getPopupContainer:B,onPopupVisibleChange:d,afterPopupVisibleChange:h,popupTransitionName:s,popupAnimation:o,defaultPopupVisible:V,destroyPopupOnHide:ve,autoDestroy:pe,mouseLeaveDelay:_,popupStyle:v,mouseEnterDelay:i},ue),y)},A=Object(K.forwardRef)(O),T=Be.a=A},OZM5:function(Je,Be,H){"use strict";H.d(Be,"b",function(){return A}),H.d(Be,"a",function(){return T}),H.d(Be,"k",function(){return C}),H.d(Be,"h",function(){return R}),H.d(Be,"i",function(){return S}),H.d(Be,"g",function(){return b}),H.d(Be,"c",function(){return x}),H.d(Be,"d",function(){return f}),H.d(Be,"j",function(){return c}),H.d(Be,"e",function(){return _}),H.d(Be,"f",function(){return v});var ne=H("KQm4"),G=H("U8pU"),D=H("Ff2n"),K=H("cDcd"),k=H.n(K),P=H("Kwbf"),N=H("WaYH"),M=.25,O=2;function A(m,u){var y=m.slice(),d=y.indexOf(u);return d>=0&&y.splice(d,1),y}function T(m,u){var y=m.slice();return y.indexOf(u)===-1&&y.push(u),y}function C(m){return m.split("-")}function R(m,u){return"".concat(m,"-").concat(u)}function S(m){return m&&m.type&&m.type.isTreeNode}function b(m,u){var y=[m],d=u[m];function h(){var s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];s.forEach(function(o){var g=o.key,p=o.children;y.push(g),h(p)})}return h(d.children),y}function x(m,u){var y=m.clientY,d=u.selectHandle.getBoundingClientRect(),h=d.top,s=d.bottom,o=d.height,g=Math.max(o*M,O);return y<=h+g?-1:y>=s-g?1:0}function f(m,u){if(!m)return;var y=u.multiple;return y?m.slice():m.length?[m[0]]:m}var l=function(u){return u};function i(m,u){if(!m)return[];var y=u||{},d=y.processProps,h=d===void 0?l:d,s=Array.isArray(m)?m:[m];return s.map(function(o){var g=o.children,p=Object(D.a)(o,["children"]),E=i(g,u);return k.a.createElement(N.a,Object.assign({},h(p)),E)})}function c(m){if(!m)return null;var u;if(Array.isArray(m))u={checkedKeys:m,halfCheckedKeys:void 0};else if(Object(G.a)(m)==="object")u={checkedKeys:m.checked||void 0,halfCheckedKeys:m.halfChecked||void 0};else return Object(P.a)(!1,"`checkedKeys` is not an array or an object"),null;return u}function _(m,u){var y=new Set;function d(h){if(y.has(h))return;var s=u[h];if(!s)return;y.add(h);var o=s.parent,g=s.node;if(g.disabled)return;o&&d(o.key)}return(m||[]).forEach(function(h){d(h)}),Object(ne.a)(y)}function v(m){var u={};return Object.keys(m).forEach(function(y){(y.startsWith("data-")||y.startsWith("aria-"))&&(u[y]=m[y])}),u}},Ot1p:function(Je,Be,H){"use strict";var ne=H("2qtc"),G=H("kLXV"),D=H("rAM+"),K=H("miYZ"),k=H("tsqr"),P=H("9og8"),N=H("tJVT"),M=H("jrin"),O=H("WmNS"),A=H.n(O),T=H("cDcd"),C=H.n(T),R=H("VrN/"),S=H.n(R),b=H("bdgK"),x=H("p77/"),f=H("Bd2K"),l=H("ELLl"),i=H("19Vz"),c=H("lZu9"),_=H("+NIl"),v=H("kSUc"),m=H("9Bee"),u=function(re){var Ee=re.value,xe=Ee===void 0?"":Ee,Ve=re.className,Le=re.showTextOnly,We=re.showLines,Ot=re.style,Ze=Ot===void 0?{}:Ot,ht=Object(T.useMemo)(function(){return""},[xe]);return C.a.createElement(C.a.Fragment,null,C.a.createElement("div",{dangerouslySetInnerHTML:{__html:ht}}))},y=H("0Owb"),d=H("dejd"),h=H("C+DQ"),s=H("1vsH"),o=H("m3rI"),g=[{title:"\u7C97\u4F53",icon:"icon-bold",actionName:"bold"},{title:"\u659C\u4F53",icon:"icon-italic",actionName:"italic"},"|",{title:"\u65E0\u5E8F\u5217\u8868",icon:"icon-unorder-list",actionName:"list-ul"},{title:"\u6709\u5E8F\u5217\u8868",icon:"icon-order-list",actionName:"list-ol"},"|",{title:"\u884C\u5185\u4EE3\u7801",icon:"icon-code",actionName:"code"},{title:"\u4EE3\u7801\u5757\uFF08\u591A\u8BED\u8A00\u98CE\u683C\uFF09",icon:"icon-file-code",actionName:"code-block"},{title:"\u94FE\u63A5",icon:"icon-link",actionName:"link"},"|",{title:"\u884C\u5185\u516C\u5F0F",icon:"icon-sum",actionName:"inline-latex"},{title:"\u591A\u884C\u516C\u5F0F",icon:"icon-formula",actionName:"latex"},"|",{title:"\u6DFB\u52A0\u56FE\u7247",icon:"icon-picture",actionName:"upload-image"},{title:"\u8868\u683C",icon:"icon-table",actionName:"add-table"},"|",{title:"\u6362\u884C",icon:"icon-minus",actionName:"line-break"},{title:"\u6E05\u7A7A",icon:"icon-eraser",actionName:"eraser"}];function p(re){var Ee=re.onActionCallback,xe=re.title,Ve=re.icon,Le=re.actionName,We=re.className,Ot=We===void 0?"":We,Ze=re.children;function ht(){Ee(Le)}return C.a.createElement("a",{title:xe,className:Ot,onClick:ht},C.a.createElement("i",{className:"md-iconfont ".concat(Ve)}),Ze)}var E=function(re){var Ee=re.watch,xe=re.showNullButton,Ve=re.onActionCallback,Le=re.fullScreen,We=re.insertTemp,Ot=re.hidetoolBar,Ze=re.uuid,ht=re.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(s.G)("_educoder_session_login"),"&_educoder_session=").concat(Object(s.G)("_educoder_session"),"&key=").concat(Ze,"&api=").concat(encodeURIComponent(o.a.PROXY_SERVER)));var Ut=[].concat(g,[{title:"".concat(Ee?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(Ee?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return C.a.createElement("ul",{className:"markdown-toolbar-container"},!Ot&&Ut.map(function(Ke,It){return C.a.createElement("li",{key:It},Ke.actionName?C.a.createElement(p,Object(y.a)({},Ke,{onActionCallback:Ve})):C.a.createElement("span",{className:"v-line"}))}),xe?C.a.createElement("li",null,C.a.createElement(p,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:Ve},C.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,We&&C.a.createElement("li",null,C.a.createElement(p,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(We),onActionCallback:Ve},C.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),C.a.createElement("li",{className:"btn-full-screen"},C.a.createElement(p,{icon:"".concat(Le?"icon-shrink":"icon-enlarge"),title:Le?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:Ve})))},L=H("M8RZ"),F=H("+L6B"),j=H("2/Rp"),V=H("y8nQ"),B=H("Vl3Y"),I=H("5NDa"),$=H("5rEg"),ie={labelCol:{span:4},wrapperCol:{span:20}},ue=function(re){var Ee=re.callback,xe=re.onCancel;function Ve(Le){Ee(Le)}return C.a.createElement(B.a,Object(y.a)({},ie,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:Ve}),C.a.createElement(B.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},C.a.createElement($.a,null)),C.a.createElement(B.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},C.a.createElement($.a,null)),C.a.createElement("div",{className:"flex-container flex-end"},C.a.createElement(j.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),C.a.createElement(j.a,{type:"ghost",onClick:xe},"\u53D6\u6D88")))},fe=H("7ahc"),ve=H("HmJG"),pe=H("BjJ7"),te=B.a.useForm,ee={width:280,marginRight:10},se={labelCol:{span:5},wrapperCol:{span:19}},Q=function(re){var Ee=re.callback,xe=re.onCancel,Ve=te(),Le=Object(N.a)(Ve,1),We=Le[0];function Ot(Ut){Ee(Ut)}function Ze(Ut,Ke){if(Ut.status===-1){k.b.error(Ut.message);return}We.setFieldsValue({src:"/api/attachments/".concat(Ut.id),type:Ke.type})}function ht(Ut){var Ke=Ut.target.files[0];he(Ke,Ze)}return C.a.createElement(B.a,Object(y.a)({form:We},se,{className:"upload-image-panel",onFinish:Ot}),C.a.createElement(B.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},C.a.createElement("div",{className:"flex-container"},C.a.createElement(B.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},C.a.createElement($.a,{style:ee})),C.a.createElement(J,{onFileChange:ht}))),C.a.createElement(B.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt"},C.a.createElement($.a,{style:{width:264}})),C.a.createElement(B.a.Item,{style:{textAlign:"right"}},C.a.createElement(j.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),C.a.createElement(j.a,{type:"ghost",onClick:xe},"\u53D6\u6D88")))};function J(re){var Ee=re.onFileChange;return C.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",C.a.createElement("input",{type:"file",onChange:Ee}))}function he(re,Ee){if(!re)throw new String("\u6CA1\u6709\u6587\u4EF6");var xe=new FormData;xe.append("editormd-image-file",re),xe.append("file_param_name","editormd-image-file"),xe.append("byxhr","true");var Ve=new window.XMLHttpRequest;Ve.withCredentials=!0,Ve.addEventListener("load",function(Le){Ee(JSON.parse(Le.target.responseText),re)},!1),Ve.addEventListener("error",function(Le){console.error(Le)},!1),Ve.open("POST","".concat(pe.a,"/api/attachments.json")),Ve.send(xe)}var Ce=H("giR+"),De=H("fyUT"),we=H("7Kak"),Me=H("9yH6"),Te=Me.a.Group,_e={margin:"0 8px"},Pe=function(re){var Ee=re.callback,xe=re.onCancel;function Ve(Le){Ee(Le)}return C.a.createElement(B.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:Ve},C.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},C.a.createElement("span",{style:_e},"\u5355\u5143\u683C\u6570\uFF1A"),C.a.createElement("span",{style:_e},"\u884C\u6570"),C.a.createElement(B.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},C.a.createElement(De.a,null)),C.a.createElement("span",{style:_e},"\u5217\u6570"),C.a.createElement(B.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},C.a.createElement(De.a,null))),C.a.createElement("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"}},C.a.createElement("span",{style:_e},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),C.a.createElement(B.a.Item,{name:"align"},C.a.createElement(Te,null,C.a.createElement(Me.a,{value:"default"},C.a.createElement("i",{className:"fa fa-align-justify"})),C.a.createElement(Me.a,{value:"left"},C.a.createElement("i",{className:"fa fa-align-left"})),C.a.createElement(Me.a,{value:"center"},C.a.createElement("i",{className:"fa fa-align-center"})),C.a.createElement(Me.a,{value:"right"},C.a.createElement("i",{className:"fa fa-align-right"}))))),C.a.createElement("div",{className:"flex-container flex-end"},C.a.createElement(j.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),C.a.createElement(j.a,{type:"ghost",onClick:xe},"\u53D6\u6D88")))},je=H("ErOA"),Qe=H("7Cbv"),Ie="link",Ae="upload-image",et="code-block",qe="add-table",lt="------------",$e={default:lt,left:":".concat(lt),center:":".concat(lt,":"),right:"".concat(lt,":")},ft=H("9VGf"),ut,st;function Se(){}var Et=0,dt=1e4,Re="\u2581",He=` **\u6A21\u677F\u6807\u9898** \u6A21\u677F\u6B63\u6587\u5185\u5BB9\uFF0C\u53EF\u8F93\u5165\u6587\u672C\u5185\u5BB9\u548C\u7C98\u8D34\u56FE\u7247\u7B49\u64CD\u4F5C`;function me(re){return/^\d+$/.test(re)?"".concat(re,"px"):re}var le=navigator.platform.toUpperCase().indexOf("MAC")>=0,de=le?"Cmd":"Ctrl",Y=["pptm","pptx","ppt","pot","pps","ppa","potx","ppsx","ppam","pptm","potm","ppsm","doc","docx","dot","dotx","docm","dotm","xls","xlsx","csv","xlt","xla","xltx","xlsm","xltm","xlam","xlsb"],Z=(ut={},Object(M.a)(ut,de+"-B","bold"),Object(M.a)(ut,de+"-I","italic"),ut),q=(st={},Object(M.a)(st,Ie,"\u6DFB\u52A0\u94FE\u63A5"),Object(M.a)(st,et,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(M.a)(st,Ae,"\u6DFB\u52A0\u6587\u4EF6"),Object(M.a)(st,qe,"\u6DFB\u52A0\u8868\u683C"),st),ae=Be.a=function(re){var Ee=re.defaultValue,xe=Ee===void 0?"":Ee,Ve=re.onChange,Le=re.width,We=Le===void 0?"100%":Le,Ot=re.height,Ze=Ot===void 0?400:Ot,ht=re.miniToolbar,Ut=ht===void 0?!1:ht,Ke=re.isFocus,It=Ke===void 0?!1:Ke,Zt=re.watch,At=re.insertTemp,Yt=re.mode,Kt=Yt===void 0?"markdown":Yt,Pt=re.id,Rt=Pt===void 0?"markdown-editor-id":Pt,pt=re.showResizeBar,Mt=pt===void 0?!1:pt,_t=re.noStorage,Tt=_t===void 0?!1:_t,bt=re.showNullButton,tt=bt===void 0?!1:bt,Fe=re.hidetoolBar,Jt=Fe===void 0?!1:Fe,Wt=re.fullScreen,qt=Wt===void 0?!1:Wt,Vt=re.onBlur,un=re.onCMBeforeChange,$t=re.onFullScreen,rt=re.className,Ne=rt===void 0?"":rt,vt=re.disablePaste,In=vt===void 0?!1:vt,fr=re.placeholder,gr=fr===void 0?"":fr,Tn=re.values,Ht=Tn===void 0?"":Tn,wt=Object(T.useState)(null),Sn=Object(N.a)(wt,2),Ge=Sn[0],sn=Sn[1],Dn=Object(T.useState)(xe),Kr=Object(N.a)(Dn,2),Hr=Kr[0],Un=Kr[1],aa=Object(T.useState)(Zt),ia=Object(N.a)(aa,2),yr=ia[0],kr=ia[1],oa=Object(T.useState)(qt),qr=Object(N.a)(oa,2),Er=qr[0],Nn=qr[1],ea=Object(T.useState)(""),sa=Object(N.a)(ea,2),Wn=sa[0],mt=sa[1],ye=Object(T.useState)(0),Xe=Object(N.a)(ye,2),Lt=Xe[0],xt=Xe[1],Ct=Object(T.useState)(Ze),Nt=Object(N.a)(Ct,2),En=Nt[0],bn=Nt[1],nn=Object(T.useState)(!1),Ln=Object(N.a)(nn,2),Pn=Ln[0],er=Ln[1],Fn=Object(T.useRef)(Object(Qe.a)()),Ir=Object(T.useRef)(!1),Qn=Object(T.useRef)(),Cn=Object(T.useRef)(),hr=Object(T.useRef)(),wr=Object(T.useRef)(),Ar=Object(T.useRef)(),Na=function(){var kt=Object(P.a)(A.a.mark(function zt(){var Bt,en;return A.a.wrap(function(pn){for(;;)switch(pn.prev=pn.next){case 0:return pn.next=2,Object(je.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:Fn.current}});case 2:en=pn.sent,en!=null&&(Bt=en.attachments)!==null&&Bt!==void 0&&Bt.length&&(console.log("cm:",Ge,Cn),en.attachments.map(function(an){an.content_type.indexOf("image")>-1?Ge.replaceSelection("![,](/api/attachments/".concat(an.id,"?type=").concat(an.content_type,")")):an.content_type.indexOf("video")>-1?Ge.replaceSelection('')):an.content_type.indexOf("pdf")>-1?Ge.replaceSelection('
    ').concat(an.name,"")):Ge.replaceSelection("[".concat(an.name,"](").concat(o.a.API_SERVER,"/api/attachments/").concat(an.id,"?type=").concat(an.content_type,")"))}));case 4:case"end":return pn.stop()}},zt)}));return function(){return kt.apply(this,arguments)}}();Object(T.useEffect)(function(){Un(Ht),Ge==null||Ge.setValue(Ht)},[Ht]),Object(T.useEffect)(function(){$t==null||$t(Er)},[Er]),Object(T.useEffect)(function(){if(Cn.current){var kt=S.a.fromTextArea(Cn.current,{mode:Kt,lineNumbers:!Ut,lineWrapping:!0,value:xe,autoCloseTags:!0,autoCloseBrackets:!0});It&&kt.focus();function zt(Bt,en){if(In){en.preventDefault();return}var on=en.clipboardData;if(on){var pn=on.types.toString(),an=on.items;if(pn==="Files"||on.types.indexOf("Files")>-1){if(en.preventDefault(),Kt=="stex")return;try{var Kn,tr=an[1];((Kn=an[0])===null||Kn===void 0?void 0:Kn.kind)==="file"&&(tr=an[0]);var rn=tr.getAsFile(),Gr=rn.name.split(".").pop();he(rn,function(dn){if(dn.id){var Vn,Hn,Ur;(rn==null||((Vn=rn.type)===null||Vn===void 0)?void 0:Vn.indexOf("image"))>-1?kt.replaceSelection("![,](/api/attachments/".concat(dn.id,"?type=").concat(dn.content_type,")")):(rn==null||((Hn=rn.type)===null||Hn===void 0)?void 0:Hn.indexOf("video"))>-1?kt.replaceSelection('')):(rn==null||((Ur=rn.type)===null||Ur===void 0)?void 0:Ur.indexOf("pdf"))>-1?kt.replaceSelection('').concat(rn.name,"")):Y.includes(Gr)?kt.replaceSelection('').concat(rn.name,"")):kt.replaceSelection("[".concat(rn.name,"](").concat(o.a.API_SERVER,"/api/attachments/").concat(dn.id,"?type=").concat(dn.content_type,")"))}else(dn==null?void 0:dn.status)===401&&(document.location.href="/user/login")})}catch(dn){k.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return kt.on("paste",zt),kt.on("dragleave",function(Bt,en){hr.current.classList.remove("mouse-hover-md")}),kt.on("dragover",function(Bt,en){hr.current.classList.add("mouse-hover-md")}),kt.on("drop",function(Bt,en){hr.current.classList.add("mouse-hover-md");var on;if(on=en.dataTransfer.files,on.length>0){en.preventDefault(),en.stopPropagation();for(var pn=function(tr){var rn=on[tr],Gr=rn.name.split(".").pop();he(rn,function(dn){if(dn.id){var Vn,Hn,Ur;(rn==null||((Vn=rn.type)===null||Vn===void 0)?void 0:Vn.indexOf("image"))>-1?kt.replaceSelection("![,](/api/attachments/".concat(dn.id,"?type=").concat(dn.content_type,")")):(rn==null||((Hn=rn.type)===null||Hn===void 0)?void 0:Hn.indexOf("video"))>-1?kt.replaceSelection('')):(rn==null||((Ur=rn.type)===null||Ur===void 0)?void 0:Ur.indexOf("pdf"))>-1?kt.replaceSelection('').concat(rn.name,"")):Y.includes(Gr)?kt.replaceSelection('').concat(rn.name,"")):kt.replaceSelection("[".concat(rn.name,"](").concat(o.a.API_SERVER,"/api/attachments/").concat(dn.id,"?type=").concat(dn.content_type,")"))}else(dn==null?void 0:dn.status)===401&&(document.location.href="/user/login")})},an=0;an0||an.target.offsetWidth>0)&&(br(),Ge.setSize("100%","100%"),Ge.refresh())}}catch(Kn){on.e(Kn)}finally{on.f()}});return Bt.observe(Cn.current.parentElement),Bt}if(Ge){var zt=kt();return function(){zt.unobserve(Cn.current.parentElement)}}},[Ge,br]),Object(T.useEffect)(function(){if(Ge){for(var kt=[],zt=function(){var an=en[Bt];on=Object(N.a)(an,2);var Kn=on[0],tr=on[1],rn=Object(M.a)({},Kn,function(){Fa(tr)});kt.push(rn),Ge.addKeyMap(rn)},Bt=0,en=Object.entries(Z);Bt0){var kt=new Date().getTime(),zt=window.sessionStorage.getItem(Rt);kt>=Lt+dt&&(!zt||zt!==Hr)&&(window.sessionStorage.setItem(Rt,Hr),er(!0))}},dt),Object(T.useEffect)(function(){kr(Zt)},[Ge,Zt]),Object(T.useEffect)(function(){Ge&&(It&&Ge.focus())},[Ge,It]),Object(T.useEffect)(function(){if(yr&&Ge){var kt=Ge.getScrollerElement();function zt(Bt){var en=Bt.target;if(Ar.current){var on=en.scrollTop/en.scrollHeight;Ar.current.scrollTop=Ar.current.scrollHeight*on}}return kt.addEventListener("scroll",zt),function(){kt.removeEventListener("scroll",zt)}}},[Ge,yr]),Object(T.useEffect)(function(){if(Ge&&un){function kt(zt,Bt){un(zt,Bt)}return Ge.on("beforeChange",kt),function(){Ge.off("beforeChange",kt)}}},[Ge,un]),Object(T.useEffect)(function(){if(Ge&&Vt){function kt(){Vt(Ge.getValue())}return Ge.on("blur",kt),function(){Ge.off("blur",kt)}}},[Ge,Vt]),Object(T.useEffect)(function(){if(Ge){function kt(zt){var Bt=zt.getValue();Un(Bt),xt(new Date().getTime()),zt.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),Ve&&Ve(Bt)}return Ge.on("change",kt),function(){Ge.off("change",kt)}}},[Ge,Ve]),Object(T.useEffect)(function(){Ge&&(xe==null?(Ge.setValue(""),Un("")):xe!==Ge.getValue()&&(Ge.setValue(xe),Un(xe),Ge.setCursor(Ge.lineCount(),0)))},[Ge,xe]);var Fa=Object(T.useCallback)(function(kt){var zt=Ge.getCursor(),Bt=Ge.getSelection(),en=Bt.split(` `);switch(kt){case"bold":return Ge.replaceSelection("**"+Bt+"**"),Bt===""&&Ge.setCursor(zt.line,zt.ch+2),Ge.focus();case"italic":return Ge.replaceSelection("*"+Bt+"*"),Bt===""&&Ge.setCursor(zt.line,zt.ch+1),Ge.focus();case"code":return Ge.replaceSelection("`"+Bt+"`"),Bt===""&&Ge.setCursor(zt.line,zt.ch+1),Ge.focus();case"inline-latex":return Ge.replaceSelection("`$$"+Bt+"$$`"),Bt===""&&Ge.setCursor(zt.line,zt.ch+3),Ge.focus();case"latex":return Ge.replaceSelection("```latex\n"+Bt+"\n```"),Ge.setCursor(zt.line+1,Bt.length+1),Ge.focus();case"line-break":return Ge.replaceSelection(`
    `),Ge.focus();case"list-ul":return Bt===""?Ge.replaceSelection("- "+Bt):Ge.replaceSelection(en.map(function(on){return on===""?"":"- ".concat(on)}).join(` `)),Ge.focus();case"list-ol":return Bt===""?Ge.replaceSelection("1. "+Bt):Ge.replaceSelection(en.map(function(on,pn){return on===""?"":"".concat(pn+1,". ").concat(on)}).join(` `)),Ge.focus();case"add-null-ch":return Bt===""&&Ge.setCursor(zt.line,zt.ch+1),Ge.replaceSelection(Re),Ge.focus();case"inster-template-1":return Bt===""&&Ge.setCursor(zt.line,zt.ch),Ge.replaceSelection(He),Ge.focus();case"eraser":return Ge.setValue(""),Ge.focus();case"trigger-watch":return kr(!yr),Ge.focus();case"trigger-full-screen":return Nn(!Er),Ge.focus();case Ie:mt(Ie);return;case et:mt(et);return;case Ae:mt(Ae);return;case qe:mt(qe);return;default:throw new Error}},[Ge,yr,Er]),ta=Object(T.useCallback)(function(kt){mt("");switch(Wn){case Ie:var zt=kt.title,Bt=kt.link;return Ge.replaceSelection("[".concat(zt,"](").concat(Bt,")")),Ge.focus();case et:var en=kt.language,on=kt.content;return Ge.replaceSelection(["```"+en,on,"```"].join(` `)),Ge.focus();case Ae:var pn=kt.src,an=kt.alt;return an?Ge.replaceSelection("![ ".concat(an," ]( ").concat(pn,' "').concat(an,'" )')):Ge.replaceSelection("![,](".concat(pn,")")),Ge.focus();case qe:for(var Kn=kt.row,tr=kt.col,rn=kt.align,Gr=` `,dn=0;dn300&&(Kn=300);var tr=Ze+Kn+"px";bn(tr)}}return kt.addEventListener("mousedown",en),document.addEventListener("mousemove",pn),document.addEventListener("mouseup",on),function(){kt.removeEventListener("mousedown",en),document.removeEventListener("mousemove",pn),document.removeEventListener("mouseup",on)}}},[Ge,wr]),Object(T.useEffect)(function(){bn(Ze)},[Ze]);var mn=me(We),Xr=me(En),Br={width:mn,height:Xr},fa=Object(T.useMemo)(function(){if(Lt){var kt=new Date(Lt),zt=kt.getHours(),Bt=kt.getMinutes(),en=kt.getSeconds();return zt=zt<10?"0"+zt:zt,Bt=Bt<10?"0"+Bt:Bt,en=en<10?"0"+en:en,"".concat(zt,":").concat(Bt,":").concat(en)}return 0},[Lt]);function $r(){window.sessionStorage.removeItem(Rt),er(!1),xt(0)}function la(){er(!1),xt(0),Ge.setValue(window.sessionStorage.getItem(Rt))}function na(kt,zt){var Bt=Ge.getValue();Bt=Bt.replace(kt,zt),Un(Bt),Ge==null||Ge.setValue(Bt)}return C.a.createElement(T.Fragment,null,C.a.createElement("div",{className:"markdown-editor-wrapper",ref:hr},C.a.createElement("div",{className:"markdown-editor-container ".concat(Ne," ").concat(yr?"on-preview":""," ").concat(Ut?"mini":""," ").concat(Er?"full-screen":""),style:Br},C.a.createElement(E,{insertTemp:At,watch:yr,fullScreen:Er,showNullButton:tt,onActionCallback:Fa,hidetoolBar:Jt,uuid:Fn.current,setOpenPhones:function(){Ir.current=!0}}),C.a.createElement("div",{className:"markdown-editor-body"},C.a.createElement("div",{className:"codemirror-container"},C.a.createElement("textarea",{ref:Cn,placeholder:gr})),yr?C.a.createElement("div",{ref:Ar,className:"preview-container"},Kt==="stex"&&C.a.createElement(u,{value:Hr}),Kt!=="stex"&&C.a.createElement(m.a,{edit:!0,value:Hr,replaces:na})):null))),Mt?C.a.createElement("a",{ref:wr,className:"editor-resize"}):null,C.a.createElement(L.a,null,q[Wn]?C.a.createElement(G.a,{centered:!0,title:q[Wn],visible:!0,onCancel:Vr,footer:null,className:"markdown-popup-form"},Ta):null))}},PGNT:function(Je,Be,H){Je.exports={wrap:"wrap___orWmH",modal:"modal___142IN",titleWrap:"titleWrap___2UWGN",required:"required___lXOtq",title:"title___2wqMf",colorGray:"colorGray___3FkLm",choiceWrap:"choiceWrap___3pbic",answer:"answer___30LSv",activeAnswer:"activeAnswer___3ayAN",deleteIcon:"deleteIcon___2HHly",addIcon:"addIcon___29vcx",editorWrap:"editorWrap___ANVP6",htmlWrap:"htmlWrap___38sLf",radio:"radio___15wok",color333:"color333___sNPjh",color999:"color999___1ofkl",fold:"fold___6rnoE",head:"head___2muph"}},PsQE:function(Je,Be,H){Je.exports={flex_box_center:"flex_box_center___2PkN_",flex_space_between:"flex_space_between___36cDA",flex_box_vertical_center:"flex_box_vertical_center___2c88u",flex_box_center_end:"flex_box_center_end___14cXO",flex_box_column:"flex_box_column___3nalt",wrap:"wrap___3xZrs",left:"left___19hOK",title:"title___3Ti2k",total:"total___3MRC5",list:"list___3pdfL",name:"name___2IcTs",b:"b___2W0Sn",r:"r___2Tpj8",l:"l___1rMKQ",tag:"tag___jj2X5",right:"right___16831",examName:"examName___2TmgX",t:"t___1CJZd",num:"num___1qX6C",topWarp:"topWarp___3WuSr",head:"head___3z9Hq",so:"so___m2B6Z",btn:"btn___20VL7",content:"content___2tTuo",titleWrap:"titleWrap___1cYdQ",single:"single___1BKtz",analysis:"analysis___1qm4Y",text:"text___1JQUf",btnsElse:"btnsElse___2IzAs",btnsWrap:"btnsWrap___3ib37",btns:"btns___2DbBT",modalColumn:"modalColumn___1zs36",modalRow:"modalRow___14b2N",sup:"sup___1CIjI",popover:"popover___Mmcvb"}},QSKd:function(Je,Be,H){Je.exports=H.p+"static/wenhao.50b63ac4.svg"},"RZ/O":function(Je,Be,H){Je.exports=H.p+"static/bi.9c9b0364.svg"},SJMd:function(Je,Be){/** * @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 H,ne,G,D=!1,K,k;window.PR_SHOULD_USE_CONTINUATION=!0;var P,N;(function(){var M=window,O=["break,continue,do,else,for,if,return,while"],A=[O,"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"],T=[A,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],C=[T,"alignas,alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,noexcept,noreturn,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],R=[T,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],S=[T,"abstract,add,alias,as,ascending,async,await,base,bool,by,byte,checked,decimal,delegate,descending,dynamic,event,finally,fixed,foreach,from,get,global,group,implicit,in,interface,internal,into,is,join,let,lock,null,object,out,override,orderby,params,partial,readonly,ref,remove,sbyte,sealed,select,set,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,value,var,virtual,where,yield"],b="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes",x=[T,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],f="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",l=[O,"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"],i=[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"],c=[O,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],_=[C,S,R,x,f,l,i,c],v=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,m="str",u="kwd",y="com",d="typ",h="lit",s="pun",o="pln",g="tag",p="dec",E="src",L="atn",F="atv",j="nocode",V="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function B(Te){for(var _e=0,Pe=!1,je=!1,Qe=0,Ie=Te.length;Qe122||(Y<65||de>90||Et.push([Math.max(65,de)|32,Math.min(Y,90)|32]),Y<97||de>122||Et.push([Math.max(97,de)&~32,Math.min(Y,122)&~32]))}}Et.sort(function(re,Ee){return re[0]-Ee[0]||Ee[1]-re[1]});for(var Z=[],q=[],He=0;Heae[0]&&(ae[1]+1>ae[0]&&Re.push("-"),Re.push(lt(ae[1])))}return Re.push("]"),Re.join("")}function ft(st){for(var Se=st.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")),Et=Se.length,dt=[],Re=0,He=0;Re=2&&de==="["?Se[Re]=$e(me):de!=="\\"&&(Se[Re]=me.replace(/[a-zA-Z]/g,function(q){var ae=q.charCodeAt(0);return"["+String.fromCharCode(ae&~32,ae|32)+"]"}))}return Se.join("")}for(var ut=[],Qe=0,Ie=Te.length;Qe=0;)Pe[ut.charAt(st)]=ft;var Se=ft[1],Et=""+Se;qe.hasOwnProperty(Et)||(et.push(Se),qe[Et]=null)}et.push(/[\0-\uffff]/),je=B(et)})();var Qe=_e.length,Ie=function(Ae){for(var et=Ae.sourceCode,qe=Ae.basePos,lt=Ae.sourceNode,$e=[qe,o],ft=0,ut=et.match(je)||[],st={},Se=0,Et=ut.length;Se=5&&Re.substring(0,5)==="lang-",me&&!(He&&typeof He[1]=="string")&&(me=!1,Re=E),me||(st[dt]=Re)}var Y=ft;if(ft+=dt.length,!me)$e.push(qe+Y,Re);else{var Z=He[1],q=dt.indexOf(Z),ae=q+Z.length;He[2]&&(ae=dt.length-He[2].length,q=ae-Z.length);var re=Re.substring(5);$(lt,qe+Y,dt.substring(0,q),Ie,$e),$(lt,qe+Y+q,Z,J(re,Z),$e),$(lt,qe+Y+ae,dt.substring(ae),Ie,$e)}}Ae.decorations=$e};return Ie}function ve(Te){var _e=[],Pe=[];Te.tripleQuotedStrings?_e.push([m,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):Te.multiLineStrings?_e.push([m,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):_e.push([m,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),Te.verbatimStrings&&Pe.push([m,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var je=Te.hashComments;je&&(Te.cStyleComments?(je>1?_e.push([y,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):_e.push([y,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Pe.push([m,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):_e.push([y,/^#[^\r\n]*/,null,"#"])),Te.cStyleComments&&(Pe.push([y,/^\/\/[^\r\n]*/,null]),Pe.push([y,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Qe=Te.regexLiterals;if(Qe){var Ie=Qe>1?"":` \r`,Ae=Ie?".":"[\\S\\s]",et="/(?=[^/*"+Ie+"])(?:[^/\\x5B\\x5C"+Ie+"]|\\x5C"+Ae+"|\\x5B(?:[^\\x5C\\x5D"+Ie+"]|\\x5C"+Ae+")*(?:\\x5D|$))+/";Pe.push(["lang-regex",RegExp("^"+V+"("+et+")")])}var qe=Te.types;qe&&Pe.push([d,qe]);var lt=(""+Te.keywords).replace(/^ | $/g,"");lt.length&&Pe.push([u,new RegExp("^(?:"+lt.replace(/[\s,]+/g,"|")+")\\b"),null]),_e.push([o,/^\s+/,null,` \r \xA0`]);var $e="^.[^\\s\\w.$@'\"`/\\\\]*";return Te.regexLiterals&&($e+="(?!s*/)"),Pe.push([h,/^@[a-z_$][a-z_$@0-9]*/i,null],[d,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[o,/^[a-z_$][a-z_$@0-9]*/i,null],[h,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[o,/^\\[\s\S]?/,null],[s,new RegExp($e),null]),fe(_e,Pe)}var pe=ve({keywords:_,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function te(Te,_e,Pe){for(var je=/(?:^|\s)nocode(?:\s|$)/,Qe=/\r\n?|\n/,Ie=Te.ownerDocument,Ae=Ie.createElement("li");Te.firstChild;)Ae.appendChild(Te.firstChild);var et=[Ae];function qe(Se){var Et=Se.nodeType;if(Et==1&&!je.test(Se.className))if(Se.nodeName==="br")lt(Se),Se.parentNode&&Se.parentNode.removeChild(Se);else for(var dt=Se.firstChild;dt;dt=dt.nextSibling)qe(dt);else if((Et==3||Et==4)&&Pe){var Re=Se.nodeValue,He=Re.match(Qe);if(He){var me=Re.substring(0,He.index);Se.nodeValue=me;var le=Re.substring(He.index+He[0].length);if(le){var de=Se.parentNode;de.insertBefore(Ie.createTextNode(le),Se.nextSibling)}lt(Se),me||Se.parentNode.removeChild(Se)}}}function lt(Se){for(;!Se.nextSibling;)if(Se=Se.parentNode,!Se)return;function Et(He,me){var le=me?He.cloneNode(!1):He,de=He.parentNode;if(de){var Y=Et(de,1),Z=He.nextSibling;Y.appendChild(le);for(var q=Z;q;q=Z)Z=q.nextSibling,Y.appendChild(q)}return le}for(var dt=Et(Se.nextSibling,0),Re;(Re=dt.parentNode)&&Re.nodeType===1;)dt=Re;et.push(dt)}for(var $e=0;$e=de&&(qe+=2),Ie>=Y&&(ft+=2)}}finally{Re&&(Re.style.display=He)}}var se={};function Q(Te,_e){for(var Pe=_e.length;--Pe>=0;){var je=_e[Pe];se.hasOwnProperty(je)?M.console&&console.warn("cannot override language handler %s",je):se[je]=Te}}function J(Te,_e){return Te&&se.hasOwnProperty(Te)||(Te=/^\s*]*(?:>|$)/],[y,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[s,/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),Q(fe([[o,/^[\s]+/,null,` \r `],[F,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[g,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[L,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[s,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]),Q(fe([],[[F,/^[\s\S]+/]]),["uq.val"]),Q(ve({keywords:C,hashComments:!0,cStyleComments:!0,types:v}),["c","cc","cpp","cxx","cyc","m"]),Q(ve({keywords:"null,true,false"}),["json"]),Q(ve({keywords:S,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:v}),["cs"]),Q(ve({keywords:R,cStyleComments:!0}),["java"]),Q(ve({keywords:c,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),Q(ve({keywords:l,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),Q(ve({keywords:f,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),Q(ve({keywords:i,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),Q(ve({keywords:x,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),Q(ve({keywords:b,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),Q(fe([],[[m,/^[\s\S]+/]]),["regex"]);function he(Te){var _e=Te.langExtension;try{var Pe=I(Te.sourceNode,Te.pre),je=Pe.sourceCode;Te.sourceCode=je,Te.spans=Pe.spans,Te.basePos=0,J(_e,je)(Te),ee(Te)}catch(Qe){M.console&&console.log(Qe&&Qe.stack||Qe)}}function Ce(Te,_e,Pe){var je=Pe||!1,Qe=_e||null,Ie=document.createElement("div");Ie.innerHTML="
    "+Te+"
    ",Ie=Ie.firstChild,je&&te(Ie,je,!0);var Ae={langExtension:Qe,numberLines:je,sourceNode:Ie,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return he(Ae),Ie.innerHTML}function De(Te,_e){var Pe=_e||document.body,je=Pe.ownerDocument||document;function Qe(le){return Pe.getElementsByTagName(le)}for(var Ie=[Qe("pre"),Qe("code"),Qe("xmp")],Ae=[],et=0;et=15&&(C=!1,O=!0);var m=i&&(A||C&&(v==null||v<12.11)),u=D||N&&M>=9;function y(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var d=function(e,t){var r=e.className,n=y(t).exec(r);if(n){var a=r.slice(n.index+n[0].length);e.className=r.slice(0,n.index)+(a?n[1]+a:"")}};function h(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function s(e,t){return h(e).appendChild(t)}function o(e,t,r,n){var a=document.createElement(e);if(r&&(a.className=r),n&&(a.style.cssText=n),typeof t=="string")a.appendChild(document.createTextNode(t));else if(t)for(var w=0;w=t)return U+(t-w);U+=W-w,U+=r-U%r,w=W+1}}var ie=function(){this.id=null,this.f=null,this.time=0,this.handler=B(this.onTimeout,this)};ie.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},ie.prototype.set=function(e,t){this.f=t;var r=+new Date+e;(!this.id||r=t)return n+Math.min(U,t-a);if(a+=w-n,a+=r-a%r,n=w+1,a>=t)return n}}var Q=[""];function J(e){for(;Q.length<=e;)Q.push(he(Q)+" ");return Q[e]}function he(e){return e[e.length-1]}function Ce(e,t){for(var r=[],n=0;n"\x80"&&(e.toUpperCase()!=e.toLowerCase()||Te.test(e))}function Pe(e,t){return t?t.source.indexOf("\\w")>-1&&_e(e)?!0:t.test(e):_e(e)}function je(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var Qe=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function Ie(e){return e.charCodeAt(0)>=768&&Qe.test(e)}function Ae(e,t,r){for(;(r<0?t>0:tr?-1:1;;){if(t==r)return t;var a=(t+r)/2,w=n<0?Math.ceil(a):Math.floor(a);if(w==t)return e(w)?t:r;e(w)?r=w:t=w+n}}function qe(e,t,r,n){if(!e)return n(t,r,"ltr",0);for(var a=!1,w=0;wt||t==r&&U.to==t)&&(n(Math.max(U.from,t),Math.min(U.to,r),U.level==1?"rtl":"ltr",w),a=!0)}a||n(t,r,"ltr")}var lt=null;function $e(e,t,r){var n;lt=null;for(var a=0;at)return a;w.to==t&&(w.from!=w.to&&r=="before"?n=a:lt=a),w.from==t&&(w.from!=w.to&&r!="before"?n=a:lt=a)}return n!=null?n:lt}var ft=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function r(X){return X<=247?e.charAt(X):1424<=X&&X<=1524?"R":1536<=X&&X<=1785?t.charAt(X-1536):1774<=X&&X<=2220?"r":8192<=X&&X<=8203?"w":X==8204?"b":"L"}var n=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,a=/[stwN]/,w=/[LRr]/,U=/[Lb1n]/,W=/[1n]/;function z(X,oe,ce){this.level=X,this.from=oe,this.to=ce}return function(X,oe){var ce=oe=="ltr"?"L":"R";if(X.length==0||oe=="ltr"&&!n.test(X))return!1;for(var be=X.length,ge=[],Ue=0;Ue-1&&(n[t]=a.slice(0,w).concat(a.slice(w+1)))}}}function Re(e,t){var r=Et(e,t);if(!r.length)return;for(var n=Array.prototype.slice.call(arguments,2),a=0;a0}function de(e){e.prototype.on=function(t,r){Se(this,t,r)},e.prototype.off=function(t,r){dt(this,t,r)}}function Y(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Z(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function q(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function ae(e){Y(e),Z(e)}function re(e){return e.target||e.srcElement}function Ee(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),i&&e.ctrlKey&&t==1&&(t=3),t}var xe=function(){if(N&&M<9)return!1;var e=o("div");return"draggable"in e||"dragDrop"in e}(),Ve;function Le(e){if(Ve==null){var t=o("span","\u200B");s(e,o("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(Ve=t.offsetWidth<=1&&t.offsetHeight>2&&!(N&&M<8))}var r=Ve?o("span","\u200B"):o("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}var We;function Ot(e){if(We!=null)return We;var t=s(e,document.createTextNode("A\u062EA")),r=p(t,0,1).getBoundingClientRect(),n=p(t,1,2).getBoundingClientRect();return h(e),!r||r.left==r.right?!1:We=n.right-r.right<3}var Ze=` b`.split(/\n/).length!=3?function(e){for(var t=0,r=[],n=e.length;t<=n;){var a=e.indexOf(` `,t);a==-1&&(a=e.length);var w=e.slice(t,e.charAt(a-1)=="\r"?a-1:a),U=w.indexOf("\r");U!=-1?(r.push(w.slice(0,U)),t+=U+1):(r.push(w),t=a+1)}return r}:function(e){return e.split(/\r\n?|\n/)},ht=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(r){}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},Ut=function(){var e=o("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),Ke=null;function It(e){if(Ke!=null)return Ke;var t=s(e,o("span","x")),r=t.getBoundingClientRect(),n=p(t,0,1).getBoundingClientRect();return Ke=Math.abs(r.left-n.left)>1}var Zt={},At={};function Yt(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Zt[e]=t}function Kt(e,t){At[e]=t}function Pt(e){if(typeof e=="string"&&At.hasOwnProperty(e))e=At[e];else if(e&&typeof e.name=="string"&&At.hasOwnProperty(e.name)){var t=At[e.name];typeof t=="string"&&(t={name:t}),e=Me(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Pt("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Pt("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function Rt(e,t){t=Pt(t);var r=Zt[t.name];if(!r)return Rt(e,"text/plain");var n=r(e,t);if(pt.hasOwnProperty(t.name)){var a=pt[t.name];for(var w in a){if(!a.hasOwnProperty(w))continue;n.hasOwnProperty(w)&&(n["_"+w]=n[w]),n[w]=a[w]}}if(n.name=t.name,t.helperType&&(n.helperType=t.helperType),t.modeProps)for(var U in t.modeProps)n[U]=t.modeProps[U];return n}var pt={};function Mt(e,t){var r=pt.hasOwnProperty(e)?pt[e]:pt[e]={};I(t,r)}function _t(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var r={};for(var n in t){var a=t[n];a instanceof Array&&(a=a.concat([])),r[n]=a}return r}function Tt(e,t){for(var r;e.innerMode&&!(r=e.innerMode(t),!r||r.mode==e);)t=r.state,e=r.mode;return r||{mode:e,state:t}}function bt(e,t,r){return e.startState?e.startState(t,r):!0}var tt=function(e,t,r){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=r};tt.prototype.eol=function(){return this.pos>=this.string.length},tt.prototype.sol=function(){return this.pos==this.lineStart},tt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},tt.prototype.next=function(){if(this.post},tt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},tt.prototype.skipToEnd=function(){this.pos=this.string.length},tt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},tt.prototype.backUp=function(e){this.pos-=e},tt.prototype.column=function(){return this.lastColumnPos0?null:(w&&t!==!1&&(this.pos+=w[0].length),w)}},tt.prototype.current=function(){return this.string.slice(this.start,this.pos)},tt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},tt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},tt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function Fe(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var r=e;!r.lines;)for(var n=0;;++n){var a=r.children[n],w=a.chunkSize();if(t=e.first&&tr?Ne(r,Fe(e,r).text.length):Sn(t,Fe(e,t.line).text.length)}function Sn(e,t){var r=e.ch;return r==null||r>t?Ne(e.line,t):r<0?Ne(e.line,0):e}function Ge(e,t){for(var r=[],n=0;nthis.maxLookAhead&&(this.maxLookAhead=e),t},Dn.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},Dn.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},Dn.fromSaved=function(e,t,r){return t instanceof sn?new Dn(e,_t(e.mode,t.state),r,t.lookAhead):new Dn(e,_t(e.mode,t),r)},Dn.prototype.save=function(e){var t=e!==!1?_t(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new sn(t,this.maxLookAhead):t};function Kr(e,t,r,n){var a=[e.state.modeGen],w={};Er(e,t.text,e.doc.mode,r,function(X,oe){return a.push(X,oe)},w,n);for(var U=r.state,W=function(X){r.baseTokens=a;var oe=e.state.overlays[X],ce=1,be=0;r.state=!0,Er(e,t.text,oe.mode,r,function(ge,Ue){for(var ze=ce;bege&&a.splice(ce,1,ge,a[ce+1],nt),ce+=2,be=Math.min(ge,nt)}if(!Ue)return;if(oe.opaque)a.splice(ze,ce-ze,ge,"overlay "+Ue),ce=ze+2;else for(;zee.options.maxHighlightLength&&_t(e.doc.mode,n.state),w=Kr(e,t,n);a&&(n.state=a),t.stateAfter=n.save(!a),t.styles=w.styles,w.classes?t.styleClasses=w.classes:t.styleClasses&&(t.styleClasses=null),r===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function Un(e,t,r){var n=e.doc,a=e.display;if(!n.mode.startState)return new Dn(n,!0,t);var w=Nn(e,t,r),U=w>n.first&&Fe(n,w-1).stateAfter,W=U?Dn.fromSaved(n,U,w):new Dn(n,bt(n.mode),w);return n.iter(w,t,function(z){aa(e,z.text,W);var X=W.line;z.stateAfter=X==t-1||X%5==0||X>=a.viewFrom&&Xt.start)return w}throw new Error("Mode "+e.name+" failed to advance stream.")}var kr=function(e,t,r){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=r};function oa(e,t,r,n){var a=e.doc,w=a.mode,U;t=wt(a,t);var W=Fe(a,t.line),z=Un(e,t.line,r),X=new tt(W.text,e.options.tabSize,z),oe;for(n&&(oe=[]);(n||X.pose.options.maxHighlightLength?(W=!1,U&&aa(e,t,n,oe.pos),oe.pos=t.length,ce=null):ce=qr(yr(r,oe,n.state,be),w),be){var ge=be[0].name;ge&&(ce="m-"+(ce?ge+" "+ce:ge))}if(!W||X!=ce){for(;zU;--W){if(W<=w.first)return w.first;var z=Fe(w,W-1),X=z.stateAfter;if(X&&(!r||W+(X instanceof sn?X.lookAhead:0)<=w.modeFrontier))return W;var oe=$(z.text,null,e.options.tabSize);(a==null||n>oe)&&(a=W-1,n=oe)}return a}function ea(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),e.highlightFrontierr;n--){var a=Fe(e,n).stateAfter;if(a&&(!(a instanceof sn)||n+a.lookAhead=t:w.to>t);(n||(n=[])).push(new Xe(U,w.from,z?null:w.to))}}return n}function En(e,t,r){var n;if(e)for(var a=0;a=t:w.to>t);if(W||w.from==t&&U.type=="bookmark"&&(!r||w.marker.insertLeft)){var z=w.from==null||(U.inclusiveLeft?w.from<=t:w.from0&&W)for(var Dt=0;Dt0)continue;var oe=[z,1],ce=vt(X.from,W.from),be=vt(X.to,W.to);(ce<0||!U.inclusiveLeft&&!ce)&&oe.push({from:X.from,to:W.from}),(be>0||!U.inclusiveRight&&!be)&&oe.push({from:W.to,to:X.to}),a.splice.apply(a,oe),z+=oe.length-3}return a}function Pn(e){var t=e.markedSpans;if(!t)return;for(var r=0;rt)&&(!n||Qn(n,w.marker)<0)&&(n=w.marker)}return n}function Na(e,t,r,n,a){var w=Fe(e,t),U=Wn&&w.markedSpans;if(U)for(var W=0;W=0&&ce<=0||oe<=0&&ce>=0)continue;if(oe<=0&&(z.marker.inclusiveRight&&a.inclusiveLeft?vt(X.to,r)>=0:vt(X.to,r)>0)||oe>=0&&(z.marker.inclusiveRight&&a.inclusiveLeft?vt(X.from,n)<=0:vt(X.from,n)<0))return!0}}function br(e){for(var t;t=hr(e);)e=t.find(-1,!0).line;return e}function Fa(e){for(var t;t=wr(e);)e=t.find(1,!0).line;return e}function ta(e){for(var t,r;t=wr(e);)e=t.find(1,!0).line,(r||(r=[])).push(e);return r}function Ta(e,t){var r=Fe(e,t),n=br(r);return r==n?t:Vt(n)}function Vr(e,t){if(t>e.lastLine())return t;var r=Fe(e,t),n;if(!mn(e,r))return t;for(;n=wr(r);)r=n.find(1,!0).line;return Vt(r)+1}function mn(e,t){var r=Wn&&t.markedSpans;if(r)for(var n=void 0,a=0;at.maxLineLength&&(t.maxLineLength=a,t.maxLine=n)})}var la=function(e,t,r){this.text=e,er(this,t),this.height=r?r(this):1};la.prototype.lineNo=function(){return Vt(this)},de(la);function na(e,t,r,n){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),Pn(e),er(e,r);var a=n?n(e):1;a!=e.height&&qt(e,a)}function kt(e){e.parent=null,Pn(e)}var zt={},Bt={};function en(e,t){if(!e||/^\s*$/.test(e))return null;var r=t.addModeClass?Bt:zt;return r[e]||(r[e]=e.replace(/\S+/g,"cm-$&"))}function on(e,t){var r=g("span",null,null,O?"padding-right: .1px":null),n={pre:g("pre",[r],"CodeMirror-line"),content:r,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var a=0;a<=(t.rest?t.rest.length:0);a++){var w=a?t.rest[a-1]:t.line,U=void 0;n.pos=0,n.addToken=an,Ot(e.display.measure)&&(U=ut(w,e.doc.direction))&&(n.addToken=tr(n.addToken,U)),n.map=[];var W=t!=e.display.externalMeasured&&Vt(w);Gr(w,n,Hr(e,w,W)),w.styleClasses&&(w.styleClasses.bgClass&&(n.bgClass=j(w.styleClasses.bgClass,n.bgClass||"")),w.styleClasses.textClass&&(n.textClass=j(w.styleClasses.textClass,n.textClass||""))),n.map.length==0&&n.map.push(0,0,n.content.appendChild(Le(e.display.measure))),a==0?(t.measure.map=n.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(n.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(O){var z=n.content.lastChild;(/\bcm-tab\b/.test(z.className)||z.querySelector&&z.querySelector(".cm-tab"))&&(n.content.className="cm-tab-wrap-hack")}return Re(e,"renderLine",e,t.line,n.pre),n.pre.className&&(n.textClass=j(n.pre.className,n.textClass||"")),n}function pn(e){var t=o("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function an(e,t,r,n,a,w,U){if(!t)return;var W=e.splitSpaces?Kn(t,e.trailingSpace):t,z=e.cm.state.specialChars,X=!1,oe;if(!z.test(t))e.col+=t.length,oe=document.createTextNode(W),e.map.push(e.pos,e.pos+t.length,oe),N&&M<9&&(X=!0),e.pos+=t.length;else{oe=document.createDocumentFragment();for(var ce=0;;){z.lastIndex=ce;var be=z.exec(t),ge=be?be.index-ce:t.length-ce;if(ge){var Ue=document.createTextNode(W.slice(ce,ce+ge));N&&M<9?oe.appendChild(o("span",[Ue])):oe.appendChild(Ue),e.map.push(e.pos,e.pos+ge,Ue),e.col+=ge,e.pos+=ge}if(!be)break;ce+=ge+1;var ze=void 0;if(be[0]==" "){var nt=e.cm.options.tabSize,gt=nt-e.col%nt;ze=oe.appendChild(o("span",J(gt),"cm-tab")),ze.setAttribute("role","presentation"),ze.setAttribute("cm-text"," "),e.col+=gt}else be[0]=="\r"||be[0]==` `?(ze=oe.appendChild(o("span",be[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),ze.setAttribute("cm-text",be[0]),e.col+=1):(ze=e.cm.options.specialCharPlaceholder(be[0]),ze.setAttribute("cm-text",be[0]),N&&M<9?oe.appendChild(o("span",[ze])):oe.appendChild(ze),e.col+=1);e.map.push(e.pos,e.pos+1,ze),e.pos++}}if(e.trailingSpace=W.charCodeAt(t.length-1)==32,r||n||a||X||w||U){var St=r||"";n&&(St+=n),a&&(St+=a);var yt=o("span",[oe],St,w);if(U)for(var Dt in U)U.hasOwnProperty(Dt)&&Dt!="style"&&Dt!="class"&&yt.setAttribute(Dt,U[Dt]);return e.content.appendChild(yt)}e.content.appendChild(oe)}function Kn(e,t){if(e.length>1&&!/ /.test(e))return e;for(var r=t,n="",a=0;aX&&ce.from<=X);be++);if(ce.to>=oe)return e(r,n,a,w,U,W,z);e(r,n.slice(0,ce.to-X),a,w,null,W,z),w=null,n=n.slice(ce.to-X),X=ce.to}}}function rn(e,t,r,n){var a=!n&&r.widgetNode;a&&e.map.push(e.pos,e.pos+t,a),!n&&e.cm.display.input.needsContentAttribute&&(a||(a=e.content.appendChild(document.createElement("span"))),a.setAttribute("cm-marker",r.id)),a&&(e.cm.display.input.setUneditable(a),e.content.appendChild(a)),e.pos+=t,e.trailingSpace=!1}function Gr(e,t,r){var n=e.markedSpans,a=e.text,w=0;if(!n){for(var U=1;Uz||tn.collapsed&&Ft.to==z&&Ft.from==z)){if(Ft.to!=null&&Ft.to!=z&&ge>Ft.to&&(ge=Ft.to,ze=""),tn.className&&(Ue+=" "+tn.className),tn.css&&(be=(be?be+";":"")+tn.css),tn.startStyle&&Ft.from==z&&(nt+=" "+tn.startStyle),tn.endStyle&&Ft.to==ge&&(Dt||(Dt=[])).push(tn.endStyle,Ft.to),tn.title&&((St||(St={})).title=tn.title),tn.attributes)for(var _n in tn.attributes)(St||(St={}))[_n]=tn.attributes[_n];tn.collapsed&&(!gt||Qn(gt.marker,tn)<0)&&(gt=Ft)}else Ft.from>z&&ge>Ft.from&&(ge=Ft.from)}if(Dt)for(var ur=0;ur=W)break;for(var Fr=Math.min(W,ge);;){if(oe){var Lr=z+oe.length;if(!gt){var Yn=Lr>Fr?oe.slice(0,Fr-z):oe;t.addToken(t,Yn,ce?ce+Ue:Ue,nt,z+Yn.length==ge?ze:"",be,St)}if(Lr>=Fr){oe=oe.slice(Fr-z),z=Fr;break}z=Lr,nt=""}oe=a.slice(w,w=r[X++]),ce=en(r[X++],t.cm.options)}}}function dn(e,t,r){this.line=t,this.rest=ta(t),this.size=this.rest?Vt(he(this.rest))-r+1:1,this.node=this.text=null,this.hidden=mn(e,t)}function Vn(e,t,r){for(var n=[],a,w=t;w2&&w.push((z.bottom+X.top)/2-r.top)}}w.push(r.bottom-r.top)}}function Ye(e,t,r){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var n=0;nr)return{map:e.measure.maps[a],cache:e.measure.caches[a],before:!0}}function ke(e,t){t=br(t);var r=Vt(t),n=e.display.externalMeasured=new dn(e.doc,t,r);n.lineN=r;var a=n.built=on(e,n);return n.text=a.pre,s(e.display.lineMeasure,a.pre),n}function Oe(e,t,r,n){return ct(e,at(e,t),r,n)}function ot(e,t){if(t>=e.display.viewFrom&&t=r.lineN&&tt)&&(w=z-W,a=w-1,t>=z&&(U="right")),a!=null){if(n=e[X+2],W==z&&r==(n.insertLeft?"left":"right")&&(U=r),r=="left"&&a==0)for(;X&&e[X-2]==e[X-3]&&e[X-1].insertLeft;)n=e[(X-=3)+2],U="left";if(r=="right"&&a==z-W)for(;X=0&&!((r=e[a]).left!=r.right);a--);return r}function fn(e,t,r,n){var a=Qt(t.map,r,n),w=a.node,U=a.start,W=a.end,z=a.collapse,X;if(w.nodeType==3){for(var oe=0;oe<4;oe++){for(;U&&Ie(t.line.text.charAt(a.coverStart+U));)--U;for(;a.coverStart+W0&&(z=n="right");var ce;e.options.lineWrapping&&(ce=w.getClientRects()).length>1?X=ce[n=="right"?ce.length-1:0]:X=w.getBoundingClientRect()}if(N&&M<9&&!U&&(!X||!X.left&&!X.right)){var be=w.parentNode.getClientRects()[0];be?X={left:be.left,right:be.left+Dr(e.display),top:be.top,bottom:be.bottom}:X=jt}for(var ge=X.top-t.rect.top,Ue=X.bottom-t.rect.top,ze=(ge+Ue)/2,nt=t.view.measure.heights,gt=0;gt=n.text.length?(z=n.text.length,X="before"):z<=0&&(z=0,X="after"),!W)return U(X=="before"?z-1:z,X=="before");function oe(Ue,ze,nt){var gt=W[ze],St=gt.level==1;return U(nt?Ue-1:Ue,St!=nt)}var ce=$e(W,z,X),be=lt,ge=oe(z,ce,X=="before");return be!=null&&(ge.other=oe(z,be,X!="before")),ge}function ln(e,t){var r=0;t=wt(e.doc,t),e.options.lineWrapping||(r=Dr(e.display)*t.ch);var n=Fe(e.doc,t.line),a=Br(n)+ja(e.display);return{left:r,right:r,top:a,bottom:a+n.height}}function Mn(e,t,r,n,a){var w=Ne(e,t,r);return w.xRel=a,n&&(w.outside=n),w}function ar(e,t,r){var n=e.doc;if(r+=e.display.viewOffset,r<0)return Mn(n.first,0,null,-1,-1);var a=un(n,r),w=n.first+n.size-1;if(a>w)return Mn(n.first+n.size-1,Fe(n,w).text.length,null,1,1);t<0&&(t=0);for(var U=Fe(n,a);;){var W=xn(e,U,a,t,r),z=Ar(U,W.ch+(W.xRel>0||W.outside>0?1:0));if(!z)return W;var X=z.find(1);if(X.line==a)return X;U=Fe(n,a=X.line)}}function $n(e,t,r,n){n-=Xn(t);var a=t.text.length,w=et(function(U){return ct(e,r,U-1).bottom<=n},a,0);return a=et(function(U){return ct(e,r,U).top>n},w,a),{begin:w,end:a}}function _r(e,t,r,n){r||(r=at(e,t));var a=Bn(e,t,ct(e,r,n),"line").top;return $n(e,t,r,a)}function Tr(e,t,r,n){return e.bottom<=r?!1:e.top>r?!0:(n?e.left:e.right)>t}function xn(e,t,r,n,a){a-=Br(t);var w=at(e,t),U=Xn(t),W=0,z=t.text.length,X=!0,oe=ut(t,e.doc.direction);if(oe){var ce=(e.options.lineWrapping?ir:Rn)(e,t,r,w,oe,n,a);X=ce.level!=1,W=X?ce.from:ce.to-1,z=X?ce.to:ce.from-1}var be=null,ge=null,Ue=et(function(Gt){var Ft=ct(e,w,Gt);return Ft.top+=U,Ft.bottom+=U,Tr(Ft,n,a,!1)?(Ft.top<=a&&Ft.left<=n&&(be=Gt,ge=Ft),!0):!1},W,z),ze,nt,gt=!1;if(ge){var St=n-ge.left=Dt.bottom?1:0}return Ue=Ae(t.text,Ue,1),Mn(r,Ue,nt,gt,n-ze)}function Rn(e,t,r,n,a,w,U){var W=et(function(ce){var be=a[ce],ge=be.level!=1;return Tr(Xt(e,Ne(r,ge?be.to:be.from,ge?"before":"after"),"line",t,n),w,U,!0)},0,a.length-1),z=a[W];if(W>0){var X=z.level!=1,oe=Xt(e,Ne(r,X?z.from:z.to,X?"after":"before"),"line",t,n);Tr(oe,w,U,!0)&&oe.top>U&&(z=a[W-1])}return z}function ir(e,t,r,n,a,w,U){var W=$n(e,t,n,U),z=W.begin,X=W.end;/\s/.test(t.text.charAt(X-1))&&X--;for(var oe=null,ce=null,be=0;be=X||ge.to<=z)continue;var Ue=ge.level!=1,ze=ct(e,n,Ue?Math.min(X,ge.to)-1:Math.max(z,ge.from)).right,nt=zent)&&(oe=ge,ce=nt)}return oe||(oe=a[a.length-1]),oe.fromX&&(oe={from:oe.from,to:X,level:oe.level}),oe}var mr;function or(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(mr==null){mr=o("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)mr.appendChild(document.createTextNode("x")),mr.appendChild(o("br"));mr.appendChild(document.createTextNode("x"))}s(e.measure,mr);var r=mr.offsetHeight/50;return r>3&&(e.cachedTextHeight=r),h(e.measure),r||1}function Dr(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=o("span","xxxxxxxxxx"),r=o("pre",[t],"CodeMirror-line-like");s(e.measure,r);var n=t.getBoundingClientRect(),a=(n.right-n.left)/10;return a>2&&(e.cachedCharWidth=a),a||10}function ri(e){for(var t=e.display,r={},n={},a=t.gutters.clientLeft,w=t.gutters.firstChild,U=0;w;w=w.nextSibling,++U){var W=e.display.gutterSpecs[U].className;r[W]=w.offsetLeft+w.clientLeft+a,n[W]=w.clientWidth}return{fixedPos:ai(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:r,gutterWidth:n,wrapperWidth:t.wrapper.clientWidth}}function ai(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function Ro(e){var t=or(e.display),r=e.options.lineWrapping,n=r&&Math.max(5,e.display.scroller.clientWidth/Dr(e.display)-3);return function(a){if(mn(e.doc,a))return 0;var w=0;if(a.widgets)for(var U=0;U0&&(X=Fe(e.doc,z.line).text).length==z.ch){var oe=$(X,X.length,e.options.tabSize)-X.length;z=Ne(z.line,Math.max(0,Math.round((w-Ri(e.display).left)/Dr(e.display))-oe))}return z}function Oa(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var r=e.display.view,n=0;nt)&&(a.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=a.viewTo)Wn&&Ta(e.doc,t)a.viewFrom?va(e):(a.viewFrom+=n,a.viewTo+=n);else if(t<=a.viewFrom&&r>=a.viewTo)va(e);else if(t<=a.viewFrom){var w=Oi(e,r,r+n,1);w?(a.view=a.view.slice(w.index),a.viewFrom=w.lineN,a.viewTo+=n):va(e)}else if(r>=a.viewTo){var U=Oi(e,t,t,-1);U?(a.view=a.view.slice(0,U.index),a.viewTo=U.lineN):va(e)}else{var W=Oi(e,t,t,-1),z=Oi(e,r,r+n,1);W&&z?(a.view=a.view.slice(0,W.index).concat(Vn(e,W.lineN,z.lineN)).concat(a.view.slice(z.index)),a.viewTo+=n):va(e)}var X=a.externalMeasured;X&&(r=a.lineN&&t=n.viewTo)return;var w=n.view[Oa(e,t)];if(w.node==null)return;var U=w.changes||(w.changes=[]);ue(U,r)==-1&&U.push(r)}function va(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Oi(e,t,r,n){var a=Oa(e,t),w,U=e.display.view;if(!Wn||r==e.doc.first+e.doc.size)return{index:a,lineN:r};for(var W=e.display.viewFrom,z=0;z0){if(a==U.length-1)return null;w=W+U[a].size-t,a++}else w=W-t;t+=w,r+=w}for(;Ta(e.doc,r)!=r;){if(a==(n<0?0:U.length-1))return null;r+=n*U[a-(n<0?1:0)].size,a+=n}return{index:a,lineN:r}}function Vs(e,t,r){var n=e.display,a=n.view;a.length==0||t>=n.viewTo||r<=n.viewFrom?(n.view=Vn(e,t,r),n.viewFrom=t):(n.viewFrom>t?n.view=Vn(e,t,n.viewFrom).concat(n.view):n.viewFromr&&(n.view=n.view.slice(0,Oa(e,r)))),n.viewTo=r}function Oo(e){for(var t=e.display.view,r=0,n=0;n=e.display.viewTo||W.to().line0?t.blinker=setInterval(function(){e.hasFocus()||Wa(e),t.cursorDiv.style.visibility=(r=!r)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function Mo(e){e.state.focused||(e.display.input.focus(),ro(e))}function ko(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Wa(e))},100)}function ro(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(Re(e,"focus",e,t),e.state.focused=!0,F(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),O&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),no(e)}function Wa(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(Re(e,"blur",e,t),e.state.focused=!1,d(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function Pi(e){for(var t=e.display,r=t.lineDiv.offsetTop,n=0;n.005||oe<-.005)&&(qt(a.line,U),Io(a.line),a.rest))for(var ce=0;cee.display.sizerWidth){var be=Math.ceil(W/Dr(e.display));be>e.display.maxLineLength&&(e.display.maxLineLength=be,e.display.maxLine=a.line,e.display.maxLineChanged=!0)}}}function Io(e){if(e.widgets)for(var t=0;t=U&&(w=un(t,Br(Fe(t,z))-e.wrapper.clientHeight),U=z)}return{from:w,to:Math.max(U,w+1)}}function $s(e,t){if(He(e,"scrollCursorIntoView"))return;var r=e.display,n=r.sizer.getBoundingClientRect(),a=null;if(t.top+n.top<0?a=!0:t.bottom+n.top>(window.innerHeight||document.documentElement.clientHeight)&&(a=!1),a!=null&&!b){var w=o("div","\u200B",null,`position: absolute; top: `+(t.top-r.viewOffset-ja(e.display))+`px; height: `+(t.bottom-t.top+zr(e)+r.barHeight)+`px; left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(w),w.scrollIntoView(a),e.display.lineSpace.removeChild(w)}}function Ys(e,t,r,n){n==null&&(n=0);var a;!e.options.lineWrapping&&t==r&&(t=t.ch?Ne(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,r=t.sticky=="before"?Ne(t.line,t.ch+1,"before"):t);for(var w=0;w<5;w++){var U=!1,W=Xt(e,t),z=!r||r==t?W:Xt(e,r);a={left:Math.min(W.left,z.left),top:Math.min(W.top,z.top)-n,right:Math.max(W.left,z.left),bottom:Math.max(W.bottom,z.bottom)+n};var X=ao(e,a),oe=e.doc.scrollTop,ce=e.doc.scrollLeft;if(X.scrollTop!=null&&(si(e,X.scrollTop),Math.abs(e.doc.scrollTop-oe)>1&&(U=!0)),X.scrollLeft!=null&&(La(e,X.scrollLeft),Math.abs(e.doc.scrollLeft-ce)>1&&(U=!0)),!U)break}return a}function Js(e,t){var r=ao(e,t);r.scrollTop!=null&&si(e,r.scrollTop),r.scrollLeft!=null&&La(e,r.scrollLeft)}function ao(e,t){var r=e.display,n=or(e.display);t.top<0&&(t.top=0);var a=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:r.scroller.scrollTop,w=Da(e),U={};t.bottom-t.top>w&&(t.bottom=t.top+w);var W=e.doc.height+Aa(r),z=t.topW-n;if(t.topa+w){var oe=Math.min(t.top,(X?W:t.bottom)-w);oe!=a&&(U.scrollTop=oe)}var ce=e.options.fixedGutter?0:r.gutters.offsetWidth,be=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:r.scroller.scrollLeft-ce,ge=Jr(e)-r.gutters.offsetWidth,Ue=t.right-t.left>ge;return Ue&&(t.right=t.left+ge),t.left<10?U.scrollLeft=0:t.leftge+be-3&&(U.scrollLeft=t.right+(Ue?0:10)-ge),U}function io(e,t){if(t==null)return;ki(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function Ka(e){ki(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function oi(e,t,r){(t!=null||r!=null)&&ki(e),t!=null&&(e.curOp.scrollLeft=t),r!=null&&(e.curOp.scrollTop=r)}function Qs(e,t){ki(e),e.curOp.scrollToPos=t}function ki(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var r=ln(e,t.from),n=ln(e,t.to);Uo(e,r,n,t.margin)}}function Uo(e,t,r,n){var a=ao(e,{left:Math.min(t.left,r.left),top:Math.min(t.top,r.top)-n,right:Math.max(t.right,r.right),bottom:Math.max(t.bottom,r.bottom)+n});oi(e,a.scrollLeft,a.scrollTop)}function si(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;D||so(e,{top:t}),No(e,t,!0),D&&so(e),di(e,100)}function No(e,t,r){if(t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),e.display.scroller.scrollTop==t&&!r)return;e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t)}function La(e,t,r,n){if(t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(r?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!n)return;e.doc.scrollLeft=t,Ko(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function li(e){var t=e.display,r=t.gutters.offsetWidth,n=Math.round(e.doc.height+Aa(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?r:0,docHeight:n,scrollHeight:n+zr(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:r}}var Pa=function(e,t,r){this.cm=r;var n=this.vert=o("div",[o("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),a=this.horiz=o("div",[o("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");n.tabIndex=a.tabIndex=-1,e(n),e(a),Se(n,"scroll",function(){n.clientHeight&&t(n.scrollTop,"vertical")}),Se(a,"scroll",function(){a.clientWidth&&t(a.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,N&&M<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Pa.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,r=e.scrollHeight>e.clientHeight+1,n=e.nativeBarWidth;if(r){this.vert.style.display="block",this.vert.style.bottom=t?n+"px":"0";var a=e.viewHeight-(t?n:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+a)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=r?n+"px":"0",this.horiz.style.left=e.barLeft+"px";var w=e.viewWidth-e.barLeft-(r?n:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+w)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(n==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:r?n:0,bottom:t?n:0}},Pa.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Pa.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Pa.prototype.zeroWidthHack=function(){var e=i&&!S?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new ie,this.disableVert=new ie},Pa.prototype.enableZeroWidthBar=function(e,t,r){e.style.pointerEvents="auto";function n(){var a=e.getBoundingClientRect(),w=r=="vert"?document.elementFromPoint(a.right-1,(a.top+a.bottom)/2):document.elementFromPoint((a.right+a.left)/2,a.bottom-1);w!=e?e.style.pointerEvents="none":t.set(1e3,n)}t.set(1e3,n)},Pa.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var ui=function(){};ui.prototype.update=function(){return{bottom:0,right:0}},ui.prototype.setScrollLeft=function(){},ui.prototype.setScrollTop=function(){},ui.prototype.clear=function(){};function Ha(e,t){t||(t=li(e));var r=e.display.barWidth,n=e.display.barHeight;Fo(e,t);for(var a=0;a<4&&r!=e.display.barWidth||n!=e.display.barHeight;a++)r!=e.display.barWidth&&e.options.lineWrapping&&Pi(e),Fo(e,li(e)),r=e.display.barWidth,n=e.display.barHeight}function Fo(e,t){var r=e.display,n=r.scrollbars.update(t);r.sizer.style.paddingRight=(r.barWidth=n.right)+"px",r.sizer.style.paddingBottom=(r.barHeight=n.bottom)+"px",r.heightForcer.style.borderBottom=n.bottom+"px solid transparent",n.right&&n.bottom?(r.scrollbarFiller.style.display="block",r.scrollbarFiller.style.height=n.bottom+"px",r.scrollbarFiller.style.width=n.right+"px"):r.scrollbarFiller.style.display="",n.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(r.gutterFiller.style.display="block",r.gutterFiller.style.height=n.bottom+"px",r.gutterFiller.style.width=t.gutterWidth+"px"):r.gutterFiller.style.display=""}var Bo={native:Pa,null:ui};function jo(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&d(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Bo[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Se(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,r){r=="horizontal"?La(e,t):si(e,t)},e),e.display.scrollbars.addClass&&F(e.display.wrapper,e.display.scrollbars.addClass)}var Zs=0;function Ma(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Zs},Ur(e.curOp)}function ka(e){var t=e.curOp;t&&Qi(t,function(r){for(var n=0;n=r.viewTo)||r.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new Ii(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&oo(e.cm,e.update)}function nl(e){var t=e.cm,r=t.display;e.updatedDisplay&&Pi(t),e.barMeasure=li(t),r.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Oe(t,r.maxLine,r.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(r.scroller.clientWidth,r.sizer.offsetLeft+e.adjustWidthTo+zr(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,r.sizer.offsetLeft+e.adjustWidthTo-Jr(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=r.input.prepareSelection())}function rl(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft=e.display.viewTo)return;var r=+new Date+e.options.workTime,n=Un(e,t.highlightFrontier),a=[];t.iter(n.line,Math.min(t.first+t.size,e.display.viewTo+500),function(w){if(n.line>=e.display.viewFrom){var U=w.styles,W=w.text.length>e.options.maxHighlightLength?_t(t.mode,n.state):null,z=Kr(e,w,n,!0);W&&(n.state=W),w.styles=z.styles;var X=w.styleClasses,oe=z.classes;oe?w.styleClasses=oe:X&&(w.styleClasses=null);for(var ce=!U||U.length!=w.styles.length||X!=oe&&(!X||!oe||X.bgClass!=oe.bgClass||X.textClass!=oe.textClass),be=0;!ce&&ber)return di(e,e.options.workDelay),!0}),t.highlightFrontier=n.line,t.modeFrontier=Math.max(t.modeFrontier,n.line),a.length&&Nr(e,function(){for(var w=0;w=r.viewFrom&&t.visible.to<=r.viewTo&&(r.updateLineNumbers==null||r.updateLineNumbers>=r.viewTo)&&r.renderedView==r.view&&Oo(e)==0)return!1;Ho(e)&&(va(e),t.dims=ri(e));var a=n.first+n.size,w=Math.max(t.visible.from-e.options.viewportMargin,n.first),U=Math.min(a,t.visible.to+e.options.viewportMargin);r.viewFromU&&r.viewTo-U<20&&(U=Math.min(a,r.viewTo)),Wn&&(w=Ta(e.doc,w),U=Vr(e.doc,U));var W=w!=r.viewFrom||U!=r.viewTo||r.lastWrapHeight!=t.wrapperHeight||r.lastWrapWidth!=t.wrapperWidth;Vs(e,w,U),r.viewOffset=Br(Fe(e.doc,r.viewFrom)),e.display.mover.style.top=r.viewOffset+"px";var z=Oo(e);if(!W&&z==0&&!t.force&&r.renderedView==r.view&&(r.updateLineNumbers==null||r.updateLineNumbers>=r.viewTo))return!1;var X=sl(e);return z>4&&(r.lineDiv.style.display="none"),ul(e,r.updateLineNumbers,t.dims),z>4&&(r.lineDiv.style.display=""),r.renderedView=r.view,ll(X),h(r.cursorDiv),h(r.selectionDiv),r.gutters.style.height=r.sizer.style.minHeight=0,W&&(r.lastWrapHeight=t.wrapperHeight,r.lastWrapWidth=t.wrapperWidth,di(e,400)),r.updateLineNumbers=null,!0}function Wo(e,t){for(var r=t.viewport,n=!0;;n=!1){if(!n||!e.options.lineWrapping||t.oldDisplayWidth==Jr(e)){if(r&&r.top!=null&&(r={top:Math.min(e.doc.height+Aa(e.display)-Da(e),r.top)}),t.visible=Mi(e.display,e.doc,r),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else n&&(t.visible=Mi(e.display,e.doc,r));if(!oo(e,t))break;Pi(e);var a=li(e);ii(e),Ha(e,a),uo(e,a),t.force=!1}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function so(e,t){var r=new Ii(e,t);if(oo(e,r)){Pi(e),Wo(e,r);var n=li(e);ii(e),Ha(e,n),uo(e,n),r.finish()}}function ul(e,t,r){var n=e.display,a=e.options.lineNumbers,w=n.lineDiv,U=w.firstChild;function W(Ue){var ze=Ue.nextSibling;return O&&i&&e.display.currentWheelTarget==Ue?Ue.style.display="none":Ue.parentNode.removeChild(Ue),ze}for(var z=n.view,X=n.viewFrom,oe=0;oe-1&&(ge=!1),Ba(e,ce,X,r)),ge&&(h(ce.lineNumber),ce.lineNumber.appendChild(document.createTextNode(rt(e.options,X)))),U=ce.node.nextSibling}X+=ce.size}for(;U;)U=W(U)}function lo(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function uo(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+zr(e)+"px"}function Ko(e){var t=e.display,r=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var n=ai(t)-t.scroller.scrollLeft+e.doc.scrollLeft,a=t.gutters.offsetWidth,w=n+"px",U=0;UU.clientWidth,z=U.scrollHeight>U.clientHeight;if(!(n&&W||a&&z))return;if(a&&i&&O){e:for(var X=t.target,oe=w.view;X!=U;X=X.parentNode)for(var ce=0;ce=0&&vt(e,n.to())<=0)return r}return-1};var hn=function(e,t){this.anchor=e,this.head=t};hn.prototype.from=function(){return Tn(this.anchor,this.head)},hn.prototype.to=function(){return gr(this.anchor,this.head)},hn.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Qr(e,t,r){var n=e&&e.options.selectionsMayTouch,a=t[r];t.sort(function(be,ge){return vt(be.from(),ge.from())}),r=ue(t,a);for(var w=1;w0:z>=0){var X=Tn(W.from(),U.from()),oe=gr(W.to(),U.to()),ce=W.empty()?U.from()==U.head:W.from()==W.head;w<=r&&--r,t.splice(--w,2,new hn(ce?oe:X,ce?X:oe))}}return new Wr(t,r)}function ga(e,t){return new Wr([new hn(e,t||e)],0)}function ya(e){return e.text?Ne(e.from.line+e.text.length-1,he(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Xo(e,t){if(vt(e,t.from)<0)return e;if(vt(e,t.to)<=0)return ya(t);var r=e.line+t.text.length-(t.to.line-t.from.line)-1,n=e.ch;return e.line==t.to.line&&(n+=ya(t).ch-t.to.ch),Ne(r,n)}function fo(e,t){for(var r=[],n=0;n1&&e.remove(W.line+1,Ue-1),e.insert(W.line+1,gt)}Zn(e,"change",e,t)}function Ea(e,t,r){function n(a,w,U){if(a.linked)for(var W=0;W1&&!e.done[e.done.length-2].ranges)return e.done.pop(),he(e.done)}function qo(e,t,r,n){var a=e.history;a.undone.length=0;var w=+new Date,U,W;if((a.lastOp==n||a.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&a.lastModTime>w-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(U=ml(a,a.lastOp==n)))W=he(U.changes),vt(t.from,t.to)==0&&vt(t.from,W.to)==0?W.to=ya(t):U.changes.push(po(e,t));else{var z=he(a.done);for((!z||!z.ranges)&&Fi(e.sel,a.done),U={changes:[po(e,t)],generation:a.generation},a.done.push(U);a.done.length>a.undoDepth;)a.done.shift(),a.done[0].ranges||a.done.shift()}a.done.push(r),a.generation=++a.maxGeneration,a.lastModTime=a.lastSelTime=w,a.lastOp=a.lastSelOp=n,a.lastOrigin=a.lastSelOrigin=t.origin,W||Re(e,"historyAdded")}function pl(e,t,r,n){var a=t.charAt(0);return a=="*"||a=="+"&&r.ranges.length==n.ranges.length&&r.somethingSelected()==n.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function vl(e,t,r,n){var a=e.history,w=n&&n.origin;r==a.lastSelOp||w&&a.lastSelOrigin==w&&(a.lastModTime==a.lastSelTime&&a.lastOrigin==w||pl(e,w,he(a.done),t))?a.done[a.done.length-1]=t:Fi(t,a.done),a.lastSelTime=+new Date,a.lastSelOrigin=w,a.lastSelOp=r,n&&n.clearRedo!==!1&&Zo(a.undone)}function Fi(e,t){var r=he(t);r&&r.ranges&&r.equals(e)||t.push(e)}function es(e,t,r,n){var a=t["spans_"+e.id],w=0;e.iter(Math.max(e.first,r),Math.min(e.first+e.size,n),function(U){U.markedSpans&&((a||(a=t["spans_"+e.id]={}))[w]=U.markedSpans),++w})}function gl(e){if(!e)return null;for(var t,r=0;r-1&&(he(W)[ce]=X[ce],delete X[ce]))}}return n}function vo(e,t,r,n){if(n){var a=e.anchor;if(r){var w=vt(t,a)<0;w!=vt(r,a)<0?(a=t,t=r):w!=vt(t,r)<0&&(t=r)}return new hn(a,t)}else return new hn(r||t,t)}function Bi(e,t,r,n,a){a==null&&(a=e.cm&&(e.cm.display.shift||e.extend)),pr(e,new Wr([vo(e.sel.primary(),t,r,a)],0),n)}function ns(e,t,r){for(var n=[],a=e.cm&&(e.cm.display.shift||e.extend),w=0;w=t.ch:W.to>t.ch))){if(a&&(Re(z,"beforeCursorEnter"),z.explicitlyCleared))if(w.markedSpans){--U;continue}else break;if(!z.atomic)continue;if(r){var ce=z.find(n<0?1:-1),be=void 0;if((n<0?oe:X)&&(ce=ls(e,ce,-n,ce&&ce.line==t.line?w:null)),ce&&ce.line==t.line&&(be=vt(ce,r))&&(n<0?be<0:be>0))return za(e,ce,t,n,a)}var ge=z.find(n<0?-1:1);return(n<0?X:oe)&&(ge=ls(e,ge,n,ge.line==t.line?w:null)),ge?za(e,ge,t,n,a):null}}return t}function Wi(e,t,r,n,a){var w=n||1,U=za(e,t,r,w,a)||!a&&za(e,t,r,w,!0)||za(e,t,r,-w,a)||!a&&za(e,t,r,-w,!0);return U||(e.cantEdit=!0,Ne(e.first,0))}function ls(e,t,r,n){return r<0&&t.ch==0?t.line>e.first?wt(e,Ne(t.line-1)):null:r>0&&t.ch==(n||Fe(e,t.line)).text.length?t.line=0;--a)cs(e,{from:n[a].from,to:n[a].to,text:a?[""]:t.text,origin:t.origin});else cs(e,t)}function cs(e,t){if(t.text.length==1&&t.text[0]==""&&vt(t.from,t.to)==0)return;var r=fo(e,t);qo(e,t,r,e.cm?e.cm.curOp.id:NaN),hi(e,t,r,bn(e,t));var n=[];Ea(e,function(a,w){!w&&ue(n,a.history)==-1&&(ps(a.history,t),n.push(a.history)),hi(a,t,null,bn(a,t))})}function Ki(e,t,r){var n=e.cm&&e.cm.state.suppressEdits;if(n&&!r)return;for(var a=e.history,w,U=e.sel,W=t=="undo"?a.done:a.undone,z=t=="undo"?a.undone:a.done,X=0;X=0;--ge){var Ue=be(ge);if(Ue)return Ue.v}}function fs(e,t){if(t==0)return;if(e.first+=t,e.sel=new Wr(Ce(e.sel.ranges,function(a){return new hn(Ne(a.anchor.line+t,a.anchor.ch),Ne(a.head.line+t,a.head.ch))}),e.sel.primIndex),e.cm){Rr(e.cm,e.first,e.first-t,t);for(var r=e.cm.display,n=r.viewFrom;ne.lastLine())return;if(t.from.linew&&(t={from:t.from,to:Ne(w,Fe(e,w).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Jt(e,t.from,t.to),r||(r=fo(e,t)),e.cm?bl(e.cm,t,n):mo(e,t,n),ji(e,r,pe),e.cantEdit&&Wi(e,Ne(e.firstLine(),0))&&(e.cantEdit=!1)}function bl(e,t,r){var n=e.doc,a=e.display,w=t.from,U=t.to,W=!1,z=w.line;e.options.lineWrapping||(z=Vt(br(Fe(n,w.line))),n.iter(z,U.line+1,function(ge){if(ge==a.maxLine)return W=!0,!0})),n.sel.contains(t.from,t.to)>-1&&me(e),mo(n,t,r,Ro(e)),e.options.lineWrapping||(n.iter(z,w.line+t.text.length,function(ge){var Ue=fa(ge);Ue>a.maxLineLength&&(a.maxLine=ge,a.maxLineLength=Ue,a.maxLineChanged=!0,W=!1)}),W&&(e.curOp.updateMaxLine=!0)),ea(n,w.line),di(e,400);var X=t.text.length-(U.line-w.line)-1;t.full?Rr(e):w.line==U.line&&t.text.length==1&&!Yo(e.doc,t)?pa(e,w.line,"text"):Rr(e,w.line,U.line+1,X);var oe=le(e,"changes"),ce=le(e,"change");if(ce||oe){var be={from:w,to:U,text:t.text,removed:t.removed,origin:t.origin};ce&&Zn(e,"change",e,be),oe&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(be)}e.display.selForContextMenu=null}function Xa(e,t,r,n,a){var w;n||(n=r),vt(n,r)<0&&(w=[n,r],r=w[0],n=w[1]),typeof t=="string"&&(t=e.splitLines(t)),Va(e,{from:r,to:n,text:t,origin:a})}function hs(e,t,r,n){r1||!(this.children[0]instanceof pi))){var W=[];this.collapse(W),this.children=[new pi(W)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t50){for(var U=a.lines.length%25+25,W=U;W10);e.parent.maybeSpill()},iterN:function(e,t,r){for(var n=0;ne.display.maxLineLength&&(e.display.maxLine=X,e.display.maxLineLength=oe,e.display.maxLineChanged=!0)}n!=null&&e&&this.collapsed&&Rr(e,n,a+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&os(e.doc)),e&&Zn(e,"markerCleared",e,this,n,a),t&&ka(e),this.parent&&this.parent.clear()},ba.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var r,n,a=0;a0||U==0&&w.clearWhenEmpty!==!1)return w;if(w.replacedWith&&(w.collapsed=!0,w.widgetNode=g("span",[w.replacedWith],"CodeMirror-widget"),n.handleMouseEvents||w.widgetNode.setAttribute("cm-ignore-events","true"),n.insertLeft&&(w.widgetNode.insertLeft=!0)),w.collapsed){if(Na(e,t.line,t,r,w)||t.line!=r.line&&Na(e,r.line,t,r,w))throw new Error("Inserting collapsed marker partially overlapping an existing one");ye()}w.addToHistory&&qo(e,{from:t,to:r,origin:"markText"},e.sel,NaN);var W=t.line,z=e.cm,X;if(e.iter(W,r.line+1,function(ce){z&&w.collapsed&&!z.options.lineWrapping&&br(ce)==z.display.maxLine&&(X=!0),w.collapsed&&W!=t.line&&qt(ce,0),Ct(ce,new Xe(w,W==t.line?t.ch:null,W==r.line?r.ch:null)),++W}),w.collapsed&&e.iter(t.line,r.line+1,function(ce){mn(e,ce)&&qt(ce,0)}),w.clearOnEnter&&Se(w,"beforeCursorEnter",function(){return w.clear()}),w.readOnly&&(mt(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),w.collapsed&&(w.id=++gs,w.atomic=!0),z){if(X&&(z.curOp.updateMaxLine=!0),w.collapsed)Rr(z,t.line,r.line+1);else if(w.className||w.startStyle||w.endStyle||w.css||w.attributes||w.title)for(var oe=t.line;oe<=r.line;oe++)pa(z,oe,"text");w.atomic&&os(z.doc),Zn(z,"markerAdded",z,w)}return w}var yi=function(e,t){this.markers=e,this.primary=t;for(var r=0;r=0;z--)Va(this,n[z]);W?as(this,W):this.cm&&Ka(this.cm)}),undo:lr(function(){Ki(this,"undo")}),redo:lr(function(){Ki(this,"redo")}),undoSelection:lr(function(){Ki(this,"undo",!0)}),redoSelection:lr(function(){Ki(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,r=0,n=0;n=e.ch)&&t.push(a.marker.parent||a.marker)}return t},findMarks:function(e,t,r){e=wt(this,e),t=wt(this,t);var n=[],a=e.line;return this.iter(e.line,t.line+1,function(w){var U=w.markedSpans;if(U)for(var W=0;W=z.to||z.from==null&&a!=e.line||z.from!=null&&a==t.line&&z.from>=t.ch)&&(!r||r(z.marker))&&n.push(z.marker.parent||z.marker)}++a}),n},getAllMarks:function(){var e=[];return this.iter(function(t){var r=t.markedSpans;if(r)for(var n=0;ne)return t=e,!0;e-=w,++r}),wt(this,Ne(r,t))},indexFromPos:function(e){e=wt(this,e);var t=e.ch;if(e.linet&&(t=e.from),e.to!=null&&e.to-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var oe=e.dataTransfer.getData("Text");if(oe){var ce;if(t.state.draggingText&&!t.state.draggingText.copy&&(ce=t.listSelections()),ji(t.doc,ga(r,r)),ce)for(var be=0;be=0;W--)Xa(e.doc,"",n[W].from,n[W].to,"+delete");Ka(e)})}function yo(e,t,r){var n=Ae(e.text,t+r,r);return n<0||n>e.text.length?null:n}function Eo(e,t,r){var n=yo(e,t.ch,r);return n==null?null:new Ne(t.line,n,r<0?"after":"before")}function bo(e,t,r,n,a){if(e){t.doc.direction=="rtl"&&(a=-a);var w=ut(r,t.doc.direction);if(w){var U=a<0?he(w):w[0],W=a<0==(U.level==1),z=W?"after":"before",X;if(U.level>0||t.doc.direction=="rtl"){var oe=at(t,r);X=a<0?r.text.length-1:0;var ce=ct(t,oe,X).top;X=et(function(be){return ct(t,oe,be).top==ce},a<0==(U.level==1)?U.from:U.to-1,X),z=="before"&&(X=yo(r,X,1))}else X=a<0?U.to:U.from;return new Ne(n,X,z)}}return new Ne(n,a<0?r.text.length:0,a<0?"before":"after")}function kl(e,t,r,n){var a=ut(t,e.doc.direction);if(!a)return Eo(t,r,n);r.ch>=t.text.length?(r.ch=t.text.length,r.sticky="before"):r.ch<=0&&(r.ch=0,r.sticky="after");var w=$e(a,r.ch,r.sticky),U=a[w];if(e.doc.direction=="ltr"&&U.level%2==0&&(n>0?U.to>r.ch:U.from=U.from&&be>=oe.begin)){var ge=ce?"before":"after";return new Ne(r.line,be,ge)}}var Ue=function(gt,St,yt){for(var Dt=function(_n,ur){return ur?new Ne(r.line,W(_n,1),"before"):new Ne(r.line,_n,"after")};gt>=0&>0==(Gt.level!=1),tn=Ft?yt.begin:W(yt.end,-1);if(Gt.from<=tn&&tn0?oe.end:W(oe.begin,-1);return nt!=null&&!(n>0&&nt==t.text.length)&&(ze=Ue(n>0?0:a.length-1,n,X(nt)),ze)?ze:null}var xi={selectAll:us,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),pe)},killLine:function(e){return Ja(e,function(t){if(t.empty()){var r=Fe(e.doc,t.head.line).text.length;return t.head.ch==r&&t.head.line0)a=new Ne(a.line,a.ch+1),e.replaceRange(w.charAt(a.ch-1)+w.charAt(a.ch-2),Ne(a.line,a.ch-2),a,"+transpose");else if(a.line>e.doc.first){var U=Fe(e.doc,a.line-1).text;U&&(a=new Ne(a.line,1),e.replaceRange(w.charAt(0)+e.doc.lineSeparator()+U.charAt(U.length-1),Ne(a.line-1,U.length-1),a,"+transpose"))}}r.push(new hn(a,a))}e.setSelections(r)})},newlineAndIndent:function(e){return Nr(e,function(){for(var t=e.listSelections(),r=t.length-1;r>=0;r--)e.replaceRange(e.doc.lineSeparator(),t[r].anchor,t[r].head,"+input");t=e.listSelections();for(var n=0;ne&&vt(t,this.pos)==0&&r==this.button};var Ti,Si;function Wl(e,t){var r=+new Date;return Si&&Si.compare(r,e,t)?(Ti=Si=null,"triple"):Ti&&Ti.compare(r,e,t)?(Si=new _o(r,e,t),Ti=null,"double"):(Ti=new _o(r,e,t),Si=null,"single")}function Ms(e){var t=this,r=t.display;if(He(t,e)||r.activeTouch&&r.input.supportsTouch())return;if(r.input.ensurePolled(),r.shift=e.shiftKey,Yr(r,e)){O||(r.scroller.draggable=!1,setTimeout(function(){return r.scroller.draggable=!0},100));return}if(To(t,e))return;var n=Ra(t,e),a=Ee(e),w=n?Wl(n,a):"single";if(window.focus(),a==1&&t.state.selectingText&&t.state.selectingText(e),n&&Kl(t,a,n,w,e))return;a==1?n?Gl(t,n,w,e):re(e)==r.scroller&&Y(e):a==2?(n&&Bi(t.doc,n),setTimeout(function(){return r.input.focus()},20)):a==3&&(u?t.display.input.onContextMenu(e):ko(t))}function Kl(e,t,r,n,a){var w="Click";return n=="double"?w="Double"+w:n=="triple"&&(w="Triple"+w),w=(t==1?"Left":t==2?"Middle":"Right")+w,_i(e,Ss(w,a),a,function(U){if(typeof U=="string"&&(U=xi[U]),!U)return!1;var W=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),W=U(e,r)!=ve}finally{e.state.suppressEdits=!1}return W})}function Hl(e,t,r){var n=e.getOption("configureMouse"),a=n?n(e,t,r):{};if(a.unit==null){var w=c?r.shiftKey&&r.metaKey:r.altKey;a.unit=w?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(a.extend==null||e.doc.extend)&&(a.extend=e.doc.extend||r.shiftKey),a.addNew==null&&(a.addNew=i?r.metaKey:r.ctrlKey),a.moveOnDrag==null&&(a.moveOnDrag=!(i?r.altKey:r.ctrlKey)),a}function Gl(e,t,r,n){N?setTimeout(B(Mo,e),0):e.curOp.focus=L();var a=Hl(e,r,n),w=e.doc.sel,U;e.options.dragDrop&&xe&&!e.isReadOnly()&&r=="single"&&(U=w.contains(t))>-1&&(vt((U=w.ranges[U]).from(),t)<0||t.xRel>0)&&(vt(U.to(),t)>0||t.xRel<0)?zl(e,n,t,a):Vl(e,n,t,a)}function zl(e,t,r,n){var a=e.display,w=!1,U=sr(e,function(X){O&&(a.scroller.draggable=!1),e.state.draggingText=!1,dt(a.wrapper.ownerDocument,"mouseup",U),dt(a.wrapper.ownerDocument,"mousemove",W),dt(a.scroller,"dragstart",z),dt(a.scroller,"drop",U),w||(Y(X),n.addNew||Bi(e.doc,r,null,null,n.extend),O&&!R||N&&M==9?setTimeout(function(){a.wrapper.ownerDocument.body.focus({preventScroll:!0}),a.input.focus()},20):a.input.focus())}),W=function(X){w=w||Math.abs(t.clientX-X.clientX)+Math.abs(t.clientY-X.clientY)>=10},z=function(){return w=!0};O&&(a.scroller.draggable=!0),e.state.draggingText=U,U.copy=!n.moveOnDrag,a.scroller.dragDrop&&a.scroller.dragDrop(),Se(a.wrapper.ownerDocument,"mouseup",U),Se(a.wrapper.ownerDocument,"mousemove",W),Se(a.scroller,"dragstart",z),Se(a.scroller,"drop",U),ko(e),setTimeout(function(){return a.input.focus()},20)}function ks(e,t,r){if(r=="char")return new hn(t,t);if(r=="word")return e.findWordAt(t);if(r=="line")return new hn(Ne(t.line,0),wt(e.doc,Ne(t.line+1,0)));var n=r(e,t);return new hn(n.from,n.to)}function Vl(e,t,r,n){var a=e.display,w=e.doc;Y(t);var U,W,z=w.sel,X=z.ranges;if(n.addNew&&!n.extend?(W=w.sel.contains(r),W>-1?U=X[W]:U=new hn(r,r)):(U=w.sel.primary(),W=w.sel.primIndex),n.unit=="rectangle")n.addNew||(U=new hn(r,r)),r=Ra(e,t,!0,!0),W=-1;else{var oe=ks(e,r,n.unit);n.extend?U=vo(U,oe.anchor,oe.head,n.extend):U=oe}n.addNew?W==-1?(W=X.length,pr(w,Qr(e,X.concat([U]),W),{scroll:!1,origin:"*mouse"})):X.length>1&&X[W].empty()&&n.unit=="char"&&!n.extend?(pr(w,Qr(e,X.slice(0,W).concat(X.slice(W+1)),0),{scroll:!1,origin:"*mouse"}),z=w.sel):go(w,W,U,te):(W=0,pr(w,new Wr([U],0),te),z=w.sel);var ce=r;function be(yt){if(vt(ce,yt)==0)return;if(ce=yt,n.unit=="rectangle"){for(var Dt=[],Gt=e.options.tabSize,Ft=$(Fe(w,r.line).text,r.ch,Gt),tn=$(Fe(w,yt.line).text,yt.ch,Gt),_n=Math.min(Ft,tn),ur=Math.max(Ft,tn),kn=Math.min(r.line,yt.line),Fr=Math.min(e.lastLine(),Math.max(r.line,yt.line));kn<=Fr;kn++){var Lr=Fe(w,kn).text,Yn=se(Lr,_n,Gt);_n==ur?Dt.push(new hn(Ne(kn,Yn),Ne(kn,Yn))):Lr.length>Yn&&Dt.push(new hn(Ne(kn,Yn),Ne(kn,se(Lr,ur,Gt))))}Dt.length||Dt.push(new hn(r,r)),pr(w,Qr(e,z.ranges.slice(0,W).concat(Dt),W),{origin:"*mouse",scroll:!1}),e.scrollIntoView(yt)}else{var Pr=U,cr=ks(e,yt,n.unit),qn=Pr.anchor,Jn;vt(cr.anchor,qn)>0?(Jn=cr.head,qn=Tn(Pr.from(),cr.anchor)):(Jn=cr.anchor,qn=gr(Pr.to(),cr.head));var jn=z.ranges.slice(0);jn[W]=Xl(e,new hn(wt(w,qn),Jn)),pr(w,Qr(e,jn,W),te)}}var ge=a.wrapper.getBoundingClientRect(),Ue=0;function ze(yt){var Dt=++Ue,Gt=Ra(e,yt,!0,n.unit=="rectangle");if(!Gt)return;if(vt(Gt,ce)!=0){e.curOp.focus=L(),be(Gt);var Ft=Mi(a,w);(Gt.line>=Ft.to||Gt.linege.bottom?20:0;tn&&setTimeout(sr(e,function(){if(Ue!=Dt)return;a.scroller.scrollTop+=tn,ze(yt)}),50)}}function nt(yt){e.state.selectingText=!1,Ue=Infinity,yt&&(Y(yt),a.input.focus()),dt(a.wrapper.ownerDocument,"mousemove",gt),dt(a.wrapper.ownerDocument,"mouseup",St),w.history.lastSelOrigin=null}var gt=sr(e,function(yt){yt.buttons===0||!Ee(yt)?nt(yt):ze(yt)}),St=sr(e,nt);e.state.selectingText=St,Se(a.wrapper.ownerDocument,"mousemove",gt),Se(a.wrapper.ownerDocument,"mouseup",St)}function Xl(e,t){var r=t.anchor,n=t.head,a=Fe(e.doc,r.line);if(vt(r,n)==0&&r.sticky==n.sticky)return t;var w=ut(a);if(!w)return t;var U=$e(w,r.ch,r.sticky),W=w[U];if(W.from!=r.ch&&W.to!=r.ch)return t;var z=U+(W.from==r.ch==(W.level!=1)?0:1);if(z==0||z==w.length)return t;var X;if(n.line!=r.line)X=(n.line-r.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var oe=$e(w,n.ch,n.sticky),ce=oe-U||(n.ch-r.ch)*(W.level==1?-1:1);oe==z-1||oe==z?X=ce<0:X=ce>0}var be=w[z+(X?-1:0)],ge=X==(be.level==1),Ue=ge?be.from:be.to,ze=ge?"after":"before";return r.ch==Ue&&r.sticky==ze?t:new hn(new Ne(r.line,Ue,ze),n)}function Is(e,t,r,n){var a,w;if(t.touches)a=t.touches[0].clientX,w=t.touches[0].clientY;else try{a=t.clientX,w=t.clientY}catch(be){return!1}if(a>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;n&&Y(t);var U=e.display,W=U.lineDiv.getBoundingClientRect();if(w>W.bottom||!le(e,r))return q(t);w-=W.top-U.viewOffset;for(var z=0;z=a){var oe=un(e.doc,w),ce=e.display.gutterSpecs[z];return Re(e,r,e,oe,ce.className,t),q(t)}}}function To(e,t){return Is(e,t,"gutterClick",!0)}function Us(e,t){if(Yr(e.display,t)||$l(e,t))return;if(He(e,t,"contextmenu"))return;u||e.display.input.onContextMenu(t)}function $l(e,t){return le(e,"gutterContextMenu")?Is(e,t,"gutterContextMenu",!1):!1}function Ns(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),wn(e)}var Qa={toString:function(){return"CodeMirror.Init"}},Fs={},Vi={};function Yl(e){var t=e.optionHandlers;function r(n,a,w,U){e.defaults[n]=a,w&&(t[n]=U?function(W,z,X){X!=Qa&&w(W,z,X)}:w)}e.defineOption=r,e.Init=Qa,r("value","",function(n,a){return n.setValue(a)},!0),r("mode",null,function(n,a){n.doc.modeOption=a,ho(n)},!0),r("indentUnit",2,ho,!0),r("indentWithTabs",!1),r("smartIndent",!0),r("tabSize",4,function(n){fi(n),wn(n),Rr(n)},!0),r("lineSeparator",null,function(n,a){if(n.doc.lineSep=a,!a)return;var w=[],U=n.doc.first;n.doc.iter(function(z){for(var X=0;;){var oe=z.text.indexOf(a,X);if(oe==-1)break;X=oe+a.length,w.push(Ne(U,oe))}U++});for(var W=w.length-1;W>=0;W--)Xa(n.doc,a,w[W],Ne(w[W].line,w[W].ch+a.length))}),r("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(n,a,w){n.state.specialChars=new RegExp(a.source+(a.test(" ")?"":"| "),"g"),w!=Qa&&n.refresh()}),r("specialCharPlaceholder",pn,function(n){return n.refresh()},!0),r("electricChars",!0),r("inputStyle",l?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),r("spellcheck",!1,function(n,a){return n.getInputField().spellcheck=a},!0),r("autocorrect",!1,function(n,a){return n.getInputField().autocorrect=a},!0),r("autocapitalize",!1,function(n,a){return n.getInputField().autocapitalize=a},!0),r("rtlMoveVisually",!_),r("wholeLineUpdateBefore",!0),r("theme","default",function(n){Ns(n),ci(n)},!0),r("keyMap","default",function(n,a,w){var U=Gi(a),W=w!=Qa&&Gi(w);W&&W.detach&&W.detach(n,U),U.attach&&U.attach(n,W||null)}),r("extraKeys",null),r("configureMouse",null),r("lineWrapping",!1,Ql,!0),r("gutters",[],function(n,a){n.display.gutterSpecs=co(a,n.options.lineNumbers),ci(n)},!0),r("fixedGutter",!0,function(n,a){n.display.gutters.style.left=a?ai(n.display)+"px":"0",n.refresh()},!0),r("coverGutterNextToScrollbar",!1,function(n){return Ha(n)},!0),r("scrollbarStyle","native",function(n){jo(n),Ha(n),n.display.scrollbars.setScrollTop(n.doc.scrollTop),n.display.scrollbars.setScrollLeft(n.doc.scrollLeft)},!0),r("lineNumbers",!1,function(n,a){n.display.gutterSpecs=co(n.options.gutters,a),ci(n)},!0),r("firstLineNumber",1,ci,!0),r("lineNumberFormatter",function(n){return n},ci,!0),r("showCursorWhenSelecting",!1,ii,!0),r("resetSelectionOnContextMenu",!0),r("lineWiseCopyCut",!0),r("pasteLinesPerSelection",!0),r("selectionsMayTouch",!1),r("readOnly",!1,function(n,a){a=="nocursor"&&(Wa(n),n.display.input.blur()),n.display.input.readOnlyChanged(a)}),r("screenReaderLabel",null,function(n,a){a=a===""?null:a,n.display.input.screenReaderLabelChanged(a)}),r("disableInput",!1,function(n,a){a||n.display.input.reset()},!0),r("dragDrop",!0,Jl),r("allowDropFileTypes",null),r("cursorBlinkRate",530),r("cursorScrollMargin",0),r("cursorHeight",1,ii,!0),r("singleCursorHeightPerLine",!0,ii,!0),r("workTime",100),r("workDelay",100),r("flattenSpans",!0,fi,!0),r("addModeClass",!1,fi,!0),r("pollInterval",100),r("undoDepth",200,function(n,a){return n.doc.history.undoDepth=a}),r("historyEventDelay",1250),r("viewportMargin",10,function(n){return n.refresh()},!0),r("maxHighlightLength",1e4,fi,!0),r("moveInputWithCursor",!0,function(n,a){a||n.display.input.resetPosition()}),r("tabindex",null,function(n,a){return n.display.input.getField().tabIndex=a||""}),r("autofocus",null),r("direction","ltr",function(n,a){return n.doc.setDirection(a)},!0),r("phrases",null)}function Jl(e,t,r){var n=r&&r!=Qa;if(!t!=!n){var a=e.display.dragFunctions,w=t?Se:dt;w(e.display.scroller,"dragstart",a.start),w(e.display.scroller,"dragenter",a.enter),w(e.display.scroller,"dragover",a.over),w(e.display.scroller,"dragleave",a.leave),w(e.display.scroller,"drop",a.drop)}}function Ql(e){e.options.lineWrapping?(F(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(d(e.display.wrapper,"CodeMirror-wrap"),$r(e)),to(e),Rr(e),wn(e),setTimeout(function(){return Ha(e)},100)}function On(e,t){var r=this;if(!(this instanceof On))return new On(e,t);this.options=t=t?I(t):{},I(Fs,t,!1);var n=t.value;typeof n=="string"?n=new Or(n,t.mode,null,t.lineSeparator,t.direction):t.mode&&(n.modeOption=t.mode),this.doc=n;var a=new On.inputStyles[t.inputStyle](this),w=this.display=new dl(e,n,a,t);w.wrapper.CodeMirror=this,Ns(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),jo(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new ie,keySeq:null,specialChars:null},t.autofocus&&!l&&w.input.focus(),N&&M<11&&setTimeout(function(){return r.display.input.reset(!0)},20),Zl(this),Rl(),Ma(this),this.curOp.forceUpdate=!0,Jo(this,n),t.autofocus&&!l||this.hasFocus()?setTimeout(function(){r.hasFocus()&&!r.state.focused&&ro(r)},20):Wa(this);for(var U in Vi)Vi.hasOwnProperty(U)&&Vi[U](this,t[U],Qa);Ho(this),t.finishInit&&t.finishInit(this);for(var W=0;W20*20}Se(t.scroller,"touchstart",function(z){if(!He(e,z)&&!w(z)&&!To(e,z)){t.input.ensurePolled(),clearTimeout(r);var X=+new Date;t.activeTouch={start:X,moved:!1,prev:X-n.end<=300?n:null},z.touches.length==1&&(t.activeTouch.left=z.touches[0].pageX,t.activeTouch.top=z.touches[0].pageY)}}),Se(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Se(t.scroller,"touchend",function(z){var X=t.activeTouch;if(X&&!Yr(t,z)&&X.left!=null&&!X.moved&&new Date-X.start<300){var oe=e.coordsChar(t.activeTouch,"page"),ce;!X.prev||U(X,X.prev)?ce=new hn(oe,oe):!X.prev.prev||U(X,X.prev.prev)?ce=e.findWordAt(oe):ce=new hn(Ne(oe.line,0),wt(e.doc,Ne(oe.line+1,0))),e.setSelection(ce.anchor,ce.head),e.focus(),Y(z)}a()}),Se(t.scroller,"touchcancel",a),Se(t.scroller,"scroll",function(){t.scroller.clientHeight&&(si(e,t.scroller.scrollTop),La(e,t.scroller.scrollLeft,!0),Re(e,"scroll",e))}),Se(t.scroller,"mousewheel",function(z){return Vo(e,z)}),Se(t.scroller,"DOMMouseScroll",function(z){return Vo(e,z)}),Se(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(z){He(e,z)||ae(z)},over:function(z){He(e,z)||(Dl(e,z),ae(z))},start:function(z){return Al(e,z)},drop:sr(e,wl),leave:function(z){He(e,z)||bs(e)}};var W=t.input.getField();Se(W,"keyup",function(z){return Ls.call(e,z)}),Se(W,"keydown",sr(e,Os)),Se(W,"keypress",sr(e,Ps)),Se(W,"focus",function(z){return ro(e,z)}),Se(W,"blur",function(z){return Wa(e,z)})}var So=[];On.defineInitHook=function(e){return So.push(e)};function Ci(e,t,r,n){var a=e.doc,w;r==null&&(r="add"),r=="smart"&&(a.mode.indent?w=Un(e,t).state:r="prev");var U=e.options.tabSize,W=Fe(a,t),z=$(W.text,null,U);W.stateAfter&&(W.stateAfter=null);var X=W.text.match(/^\s*/)[0],oe;if(!n&&!/\S/.test(W.text))oe=0,r="not";else if(r=="smart"&&(oe=a.mode.indent(w,W.text.slice(X.length),W.text),oe==ve||oe>150)){if(!n)return;r="prev"}r=="prev"?t>a.first?oe=$(Fe(a,t-1).text,null,U):oe=0:r=="add"?oe=z+e.options.indentUnit:r=="subtract"?oe=z-e.options.indentUnit:typeof r=="number"&&(oe=z+r),oe=Math.max(0,oe);var ce="",be=0;if(e.options.indentWithTabs)for(var ge=Math.floor(oe/U);ge;--ge)be+=U,ce+=" ";if(beU,z=Ze(t),X=null;if(W&&n.ranges.length>1)if(Zr&&Zr.text.join(` `)==t){if(n.ranges.length%Zr.text.length==0){X=[];for(var oe=0;oe=0;be--){var ge=n.ranges[be],Ue=ge.from(),ze=ge.to();ge.empty()&&(r&&r>0?Ue=Ne(Ue.line,Ue.ch-r):e.state.overwrite&&!W?ze=Ne(ze.line,Math.min(Fe(w,ze.line).text.length,ze.ch+he(z).length)):W&&Zr&&Zr.lineWise&&Zr.text.join(` `)==z.join(` `)&&(Ue=ze=Ne(Ue.line,0)));var nt={from:Ue,to:ze,text:X?X[be%X.length]:z,origin:a||(W?"paste":e.state.cutIncoming>U?"cut":"+input")};Va(e.doc,nt),Zn(e,"inputRead",e,nt)}t&&!W&&js(e,t),Ka(e),e.curOp.updateInput<2&&(e.curOp.updateInput=ce),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Bs(e,t){var r=e.clipboardData&&e.clipboardData.getData("Text");if(r)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&Nr(t,function(){return Co(t,r,0,null,"paste")}),!0}function js(e,t){if(!e.options.electricChars||!e.options.smartIndent)return;for(var r=e.doc.sel,n=r.ranges.length-1;n>=0;n--){var a=r.ranges[n];if(a.head.ch>100||n&&r.ranges[n-1].head.line==a.head.line)continue;var w=e.getModeAt(a.head),U=!1;if(w.electricChars){for(var W=0;W-1){U=Ci(e,a.head.line,"smart");break}}else w.electricInput&&(w.electricInput.test(Fe(e.doc,a.head.line).text.slice(0,a.head.ch))&&(U=Ci(e,a.head.line,"smart")));U&&Zn(e,"electricInput",e,a.head.line)}}function Ws(e){for(var t=[],r=[],n=0;nw&&(Ci(this,W.head.line,n,!0),w=W.head.line,U==this.doc.sel.primIndex&&Ka(this));else{var z=W.from(),X=W.to(),oe=Math.max(w,z.line);w=Math.min(this.lastLine(),X.line-(X.ch?0:1))+1;for(var ce=oe;ce0&&go(this.doc,U,new hn(z,be[U].to()),pe)}}}),getTokenAt:function(n,a){return oa(this,n,a)},getLineTokens:function(n,a){return oa(this,Ne(n),a,!0)},getTokenTypeAt:function(n){n=wt(this.doc,n);var a=Hr(this,Fe(this.doc,n.line)),w=0,U=(a.length-1)/2,W=n.ch,z;if(W==0)z=a[2];else for(;;){var X=w+U>>1;if((X?a[X*2-1]:0)>=W)U=X;else if(a[X*2+1]z&&(n=z,U=!0),W=Fe(this.doc,n)}else W=n;return Bn(this,W,{top:0,left:0},a||"page",w||U).top+(U?this.doc.height-Br(W):0)},defaultTextHeight:function(){return or(this.display)},defaultCharWidth:function(){return Dr(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(n,a,w,U,W){var z=this.display;n=Xt(this,wt(this.doc,n));var X=n.bottom,oe=n.left;if(a.style.position="absolute",a.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(a),z.sizer.appendChild(a),U=="over")X=n.top;else if(U=="above"||U=="near"){var ce=Math.max(z.wrapper.clientHeight,this.doc.height),be=Math.max(z.sizer.clientWidth,z.lineSpace.clientWidth);(U=="above"||n.bottom+a.offsetHeight>ce)&&n.top>a.offsetHeight?X=n.top-a.offsetHeight:n.bottom+a.offsetHeight<=ce&&(X=n.bottom),oe+a.offsetWidth>be&&(oe=be-a.offsetWidth)}a.style.top=X+"px",a.style.left=a.style.right="",W=="right"?(oe=z.sizer.clientWidth-a.offsetWidth,a.style.right="0px"):(W=="left"?oe=0:W=="middle"&&(oe=(z.sizer.clientWidth-a.offsetWidth)/2),a.style.left=oe+"px"),w&&Js(this,{left:oe,top:X,right:oe+a.offsetWidth,bottom:X+a.offsetHeight})},triggerOnKeyDown:Sr(Os),triggerOnKeyPress:Sr(Ps),triggerOnKeyUp:Ls,triggerOnMouseDown:Sr(Ms),execCommand:function(n){if(xi.hasOwnProperty(n))return xi[n].call(null,this)},triggerElectric:Sr(function(n){js(this,n)}),findPosH:function(n,a,w,U){var W=1;a<0&&(W=-1,a=-a);for(var z=wt(this.doc,n),X=0;X0&&oe(w.charAt(U-1));)--U;for(;W.5||this.options.lineWrapping)&&to(this),Re(this,"refresh",this)}),swapDoc:Sr(function(n){var a=this.doc;return a.cm=null,this.state.selectingText&&this.state.selectingText(),Jo(this,n),wn(this),this.display.input.reset(),oi(this,n.scrollLeft,n.scrollTop),this.curOp.forceScroll=!0,Zn(this,"swapDoc",this,a),a}),phrase:function(n){var a=this.options.phrases;return a&&Object.prototype.hasOwnProperty.call(a,n)?a[n]:n},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},de(e),e.registerHelper=function(n,a,w){r.hasOwnProperty(n)||(r[n]=e[n]={_global:[]}),r[n][a]=w},e.registerGlobalHelper=function(n,a,w,U){e.registerHelper(n,a,U),r[n]._global.push({pred:w,val:U})}}function wo(e,t,r,n,a){var w=t,U=r,W=Fe(e,t.line),z=a&&e.direction=="rtl"?-r:r;function X(){var St=t.line+z;return St=e.first+e.size?!1:(t=new Ne(St,t.ch,t.sticky),W=Fe(e,St))}function oe(St){var yt;if(n=="codepoint"){var Dt=W.text.charCodeAt(t.ch+(n>0?0:-1));isNaN(Dt)?yt=null:yt=new Ne(t.line,Math.max(0,Math.min(W.text.length,t.ch+r*(Dt>=55296&&Dt<56320?2:1))),-r)}else a?yt=kl(e.cm,W,t,r):yt=Eo(W,t,r);if(yt==null)if(!St&&X())t=bo(a,e.cm,W,t.line,z);else return!1;else t=yt;return!0}if(n=="char"||n=="codepoint")oe();else if(n=="column")oe(!0);else if(n=="word"||n=="group")for(var ce=null,be=n=="group",ge=e.cm&&e.cm.getHelper(t,"wordChars"),Ue=!0;!(r<0&&!oe(!Ue));Ue=!1){var ze=W.text.charAt(t.ch)||` `,nt=Pe(ze,ge)?"w":be&&ze==` `?"n":!be||/\s/.test(ze)?null:"p";if(be&&!Ue&&!nt&&(nt="s"),ce&&ce!=nt){r<0&&(r=1,oe(),t.sticky="after");break}if(nt&&(ce=nt),r>0&&!oe(!Ue))break}var gt=Wi(e,t,w,U,!0);return In(w,gt)&&(gt.hitSide=!0),gt}function Gs(e,t,r,n){var a=e.doc,w=t.left,U;if(n=="page"){var W=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),z=Math.max(W-.5*or(e.display),3);U=(r>0?t.bottom:t.top)+r*z}else n=="line"&&(U=r>0?t.bottom+3:t.top-3);for(var X;!(X=ar(e,w,U),!X.outside);){if(r<0?U<=0:U>=a.height){X.hitSide=!0;break}U+=r*5}return X}var yn=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new ie,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};yn.prototype.init=function(e){var t=this,r=this,n=r.cm,a=r.div=e.lineDiv;Ks(a,n.options.spellcheck,n.options.autocorrect,n.options.autocapitalize);function w(W){for(var z=W.target;z;z=z.parentNode){if(z==a)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(z.className))break}return!1}Se(a,"paste",function(W){if(!w(W)||He(n,W)||Bs(W,n))return;M<=11&&setTimeout(sr(n,function(){return t.updateFromDOM()}),20)}),Se(a,"compositionstart",function(W){t.composing={data:W.data,done:!1}}),Se(a,"compositionupdate",function(W){t.composing||(t.composing={data:W.data,done:!1})}),Se(a,"compositionend",function(W){t.composing&&(W.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Se(a,"touchstart",function(){return r.forceCompositionEnd()}),Se(a,"input",function(){t.composing||t.readFromDOMSoon()});function U(W){if(!w(W)||He(n,W))return;if(n.somethingSelected())Xi({lineWise:!1,text:n.getSelections()}),W.type=="cut"&&n.replaceSelection("",null,"cut");else if(n.options.lineWiseCopyCut){var z=Ws(n);Xi({lineWise:!0,text:z.text}),W.type=="cut"&&n.operation(function(){n.setSelections(z.ranges,0,pe),n.replaceSelection("",null,"cut")})}else return;if(W.clipboardData){W.clipboardData.clearData();var X=Zr.text.join(` `);if(W.clipboardData.setData("Text",X),W.clipboardData.getData("Text")==X){W.preventDefault();return}}var oe=Hs(),ce=oe.firstChild;n.display.lineSpace.insertBefore(oe,n.display.lineSpace.firstChild),ce.value=Zr.text.join(` `);var be=document.activeElement;V(ce),setTimeout(function(){n.display.lineSpace.removeChild(oe),be.focus(),be==a&&r.showPrimarySelection()},50)}Se(a,"copy",U),Se(a,"cut",U)},yn.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},yn.prototype.prepareSelection=function(){var e=Lo(this.cm,!1);return e.focus=document.activeElement==this.div,e},yn.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},yn.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},yn.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,r=t.doc.sel.primary(),n=r.from(),a=r.to();if(t.display.viewTo==t.display.viewFrom||n.line>=t.display.viewTo||a.line=t.display.viewFrom&&zs(t,n)||{node:W[0].measure.map[2],offset:0},X=a.linee.firstLine()&&(n=Ne(n.line-1,Fe(e.doc,n.line-1).length)),a.ch==Fe(e.doc,a.line).text.length&&a.linet.viewTo-1)return!1;var w,U,W;n.line==t.viewFrom||(w=Oa(e,n.line))==0?(U=Vt(t.view[0].line),W=t.view[0].node):(U=Vt(t.view[w].line),W=t.view[w-1].node.nextSibling);var z=Oa(e,a.line),X,oe;if(z==t.view.length-1?(X=t.viewTo-1,oe=t.lineDiv.lastChild):(X=Vt(t.view[z+1].line)-1,oe=t.view[z+1].node.previousSibling),!W)return!1;for(var ce=e.doc.splitLines(tu(e,W,oe,U,X)),be=Jt(e.doc,Ne(U,0),Ne(X,Fe(e.doc,X).text.length));ce.length>1&&be.length>1;)if(he(ce)==he(be))ce.pop(),be.pop(),X--;else if(ce[0]==be[0])ce.shift(),be.shift(),U++;else break;for(var ge=0,Ue=0,ze=ce[0],nt=be[0],gt=Math.min(ze.length,nt.length);gen.ch&&St.charCodeAt(St.length-Ue-1)==yt.charCodeAt(yt.length-Ue-1);)ge--,Ue++;ce[ce.length-1]=St.slice(0,St.length-Ue).replace(/^\u200b+/,""),ce[0]=ce[0].slice(ge).replace(/\u200b+$/,"");var Gt=Ne(U,ge),Ft=Ne(X,be.length?he(be).length-Ue:0);if(ce.length>1||ce[0]||vt(Gt,Ft))return Xa(e.doc,ce,Gt,Ft,"+input"),!0},yn.prototype.ensurePolled=function(){this.forceCompositionEnd()},yn.prototype.reset=function(){this.forceCompositionEnd()},yn.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},yn.prototype.readFromDOMSoon=function(){var e=this;if(this.readDOMTimeout!=null)return;this.readDOMTimeout=setTimeout(function(){if(e.readDOMTimeout=null,e.composing)if(e.composing.done)e.composing=null;else return;e.updateFromDOM()},80)},yn.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&Nr(this.cm,function(){return Rr(e.cm)})},yn.prototype.setUneditable=function(e){e.contentEditable="false"},yn.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||sr(this.cm,Co)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},yn.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},yn.prototype.onContextMenu=function(){},yn.prototype.resetPosition=function(){},yn.prototype.needsContentAttribute=!0;function zs(e,t){var r=ot(e,t.line);if(!r||r.hidden)return null;var n=Fe(e.doc,t.line),a=Ye(r,n,t.line),w=ut(n,e.doc.direction),U="left";if(w){var W=$e(w,t.ch);U=W%2?"right":"left"}var z=Qt(a.map,t.ch,U);return z.offset=z.collapse=="right"?z.end:z.start,z}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function Za(e,t){return t&&(e.bad=!0),e}function tu(e,t,r,n,a){var w="",U=!1,W=e.doc.lineSeparator(),z=!1;function X(ge){return function(Ue){return Ue.id==ge}}function oe(){U&&(w+=W,z&&(w+=W),U=z=!1)}function ce(ge){ge&&(oe(),w+=ge)}function be(ge){if(ge.nodeType==1){var Ue=ge.getAttribute("cm-text");if(Ue){ce(Ue);return}var ze=ge.getAttribute("cm-marker"),nt;if(ze){var gt=e.findMarks(Ne(n,0),Ne(a+1,0),X(+ze));gt.length&&(nt=gt[0].find(0))&&ce(Jt(e.doc,nt.from,nt.to).join(W));return}if(ge.getAttribute("contenteditable")=="false")return;var St=/^(pre|div|p|li|table|br)$/i.test(ge.nodeName);if(!/^br$/i.test(ge.nodeName)&&ge.textContent.length==0)return;St&&oe();for(var yt=0;yt=9&&t.hasSelection&&(t.hasSelection=null),r.poll()}),Se(a,"paste",function(U){if(He(n,U)||Bs(U,n))return;n.state.pasteIncoming=+new Date,r.fastPoll()});function w(U){if(He(n,U))return;if(n.somethingSelected())Xi({lineWise:!1,text:n.getSelections()});else if(n.options.lineWiseCopyCut){var W=Ws(n);Xi({lineWise:!0,text:W.text}),U.type=="cut"?n.setSelections(W.ranges,null,pe):(r.prevInput="",a.value=W.text.join(` `),V(a))}else return;U.type=="cut"&&(n.state.cutIncoming=+new Date)}Se(a,"cut",w),Se(a,"copy",w),Se(e.scroller,"paste",function(U){if(Yr(e,U)||He(n,U))return;if(!a.dispatchEvent){n.state.pasteIncoming=+new Date,r.focus();return}var W=new Event("paste");W.clipboardData=U.clipboardData,a.dispatchEvent(W)}),Se(e.lineSpace,"selectstart",function(U){Yr(e,U)||Y(U)}),Se(a,"compositionstart",function(){var U=n.getCursor("from");r.composing&&r.composing.range.clear(),r.composing={start:U,range:n.markText(U,n.getCursor("to"),{className:"CodeMirror-composing"})}}),Se(a,"compositionend",function(){r.composing&&(r.poll(),r.composing.range.clear(),r.composing=null)})},zn.prototype.createField=function(e){this.wrapper=Hs(),this.textarea=this.wrapper.firstChild},zn.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},zn.prototype.prepareSelection=function(){var e=this.cm,t=e.display,r=e.doc,n=Lo(e);if(e.options.moveInputWithCursor){var a=Xt(e,r.sel.primary().head,"div"),w=t.wrapper.getBoundingClientRect(),U=t.lineDiv.getBoundingClientRect();n.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,a.top+U.top-w.top)),n.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,a.left+U.left-w.left))}return n},zn.prototype.showSelection=function(e){var t=this.cm,r=t.display;s(r.cursorDiv,e.cursors),s(r.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},zn.prototype.reset=function(e){if(this.contextMenuPending||this.composing)return;var t=this.cm;if(t.somethingSelected()){this.prevInput="";var r=t.getSelection();this.textarea.value=r,t.state.focused&&V(this.textarea),N&&M>=9&&(this.hasSelection=r)}else e||(this.prevInput=this.textarea.value="",N&&M>=9&&(this.hasSelection=null))},zn.prototype.getField=function(){return this.textarea},zn.prototype.supportsTouch=function(){return!1},zn.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!l||L()!=this.textarea))try{this.textarea.focus()}catch(e){}},zn.prototype.blur=function(){this.textarea.blur()},zn.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},zn.prototype.receivedFocus=function(){this.slowPoll()},zn.prototype.slowPoll=function(){var e=this;if(this.pollingFast)return;this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},zn.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function r(){var n=t.poll();!n&&!e?(e=!0,t.polling.set(60,r)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,r)},zn.prototype.poll=function(){var e=this,t=this.cm,r=this.textarea,n=this.prevInput;if(this.contextMenuPending||!t.state.focused||ht(r)&&!n&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var a=r.value;if(a==n&&!t.somethingSelected())return!1;if(N&&M>=9&&this.hasSelection===a||i&&/[\uf700-\uf7ff]/.test(a))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var w=a.charCodeAt(0);if(w==8203&&!n&&(n="\u200B"),w==8666)return this.reset(),this.cm.execCommand("undo")}for(var U=0,W=Math.min(n.length,a.length);U1e3||a.indexOf(` `)>-1?r.value=e.prevInput="":e.prevInput=a,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},zn.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},zn.prototype.onKeyPress=function(){N&&M>=9&&(this.hasSelection=null),this.fastPoll()},zn.prototype.onContextMenu=function(e){var t=this,r=t.cm,n=r.display,a=t.textarea;t.contextMenuPending&&t.contextMenuPending();var w=Ra(r,e),U=n.scroller.scrollTop;if(!w||C)return;var W=r.options.resetSelectionOnContextMenu;W&&r.doc.sel.contains(w)==-1&&sr(r,pr)(r.doc,ga(w),pe);var z=a.style.cssText,X=t.wrapper.style.cssText,oe=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",a.style.cssText=`position: absolute; width: 30px; height: 30px; top: `+(e.clientY-oe.top-5)+"px; left: "+(e.clientX-oe.left-5)+`px; z-index: 1000; background: `+(N?"rgba(255, 255, 255, .05)":"transparent")+`; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var ce;O&&(ce=window.scrollY),n.input.focus(),O&&window.scrollTo(null,ce),n.input.reset(),r.somethingSelected()||(a.value=t.prevInput=" "),t.contextMenuPending=ge,n.selForContextMenu=r.doc.sel,clearTimeout(n.detectingSelectAll);function be(){if(a.selectionStart!=null){var ze=r.somethingSelected(),nt="\u200B"+(ze?a.value:"");a.value="\u21DA",a.value=nt,t.prevInput=ze?"":"\u200B",a.selectionStart=1,a.selectionEnd=nt.length,n.selForContextMenu=r.doc.sel}}function ge(){if(t.contextMenuPending!=ge)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=X,a.style.cssText=z,N&&M<9&&n.scrollbars.setScrollTop(n.scroller.scrollTop=U),a.selectionStart!=null){(!N||N&&M<9)&&be();var ze=0,nt=function(){n.selForContextMenu==r.doc.sel&&a.selectionStart==0&&a.selectionEnd>0&&t.prevInput=="\u200B"?sr(r,us)(r):ze++<10?n.detectingSelectAll=setTimeout(nt,500):(n.selForContextMenu=null,n.input.reset())};n.detectingSelectAll=setTimeout(nt,200)}}if(N&&M>=9&&be(),u){ae(e);var Ue=function(){dt(window,"mouseup",Ue),setTimeout(ge,20)};Se(window,"mouseup",Ue)}else setTimeout(ge,50)},zn.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},zn.prototype.setUneditable=function(){},zn.prototype.needsContentAttribute=!1;function ru(e,t){if(t=t?I(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),t.autofocus==null){var r=L();t.autofocus=r==e||e.getAttribute("autofocus")!=null&&r==document.body}function n(){e.value=W.getValue()}var a;if(e.form&&(Se(e.form,"submit",n),!t.leaveSubmitMethodAlone)){var w=e.form;a=w.submit;try{var U=w.submit=function(){n(),w.submit=a,w.submit(),w.submit=U}}catch(z){}}t.finishInit=function(z){z.save=n,z.getTextArea=function(){return e},z.toTextArea=function(){z.toTextArea=isNaN,n(),e.parentNode.removeChild(z.getWrapperElement()),e.style.display="",e.form&&(dt(e.form,"submit",n),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=a))}},e.style.display="none";var W=On(function(z){return e.parentNode.insertBefore(z,e.nextSibling)},t);return W}function au(e){e.off=dt,e.on=Se,e.wheelEventPixels=cl,e.Doc=Or,e.splitLines=Ze,e.countColumn=$,e.findColumn=se,e.isWordChar=_e,e.Pass=ve,e.signal=Re,e.Line=la,e.changeEnd=ya,e.scrollbarModel=Bo,e.Pos=Ne,e.cmpPos=vt,e.modes=Zt,e.mimeModes=At,e.resolveMode=Pt,e.getMode=Rt,e.modeExtensions=pt,e.extendMode=Mt,e.copyState=_t,e.startState=bt,e.innerMode=Tt,e.commands=xi,e.keyMap=da,e.keyName=Cs,e.isModifierKey=Ts,e.lookupKey=Ya,e.normalizeKeyMap=Ml,e.StringStream=tt,e.SharedTextMarker=yi,e.TextMarker=ba,e.LineWidget=gi,e.e_preventDefault=Y,e.e_stopPropagation=Z,e.e_stop=ae,e.addClass=F,e.contains=E,e.rmClass=d,e.keyNames=xa}Yl(On),ql(On);var iu="iter insert remove copy getEditor constructor".split(" ");for(var Yi in Or.prototype)Or.prototype.hasOwnProperty(Yi)&&ue(iu,Yi)<0&&(On.prototype[Yi]=function(e){return function(){return e.apply(this.doc,arguments)}}(Or.prototype[Yi]));return de(Or),On.inputStyles={textarea:zn,contenteditable:yn},On.defineMode=function(e){!On.defaults.mode&&e!="null"&&(On.defaults.mode=e),Yt.apply(this,arguments)},On.defineMIME=Kt,On.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),On.defineMIME("text/plain","null"),On.defineExtension=function(e,t){On.prototype[e]=t},On.defineDocExtension=function(e,t){Or.prototype[e]=t},On.fromTextArea=ru,au(On),On.version="5.58.2",On})},WaYH:function(Je,Be,H){"use strict";var ne=H("rePB"),G=H("Ff2n"),D=H("VTBJ"),K=H("1OyB"),k=H("vuIU"),P=H("JX7q"),N=H("Ji7U"),M=H("LK+K"),O=H("cDcd"),A=H("TSYQ"),T=H.n(A),C=H("sboe"),R=H("OZM5"),S=function(u){var y=u.prefixCls,d=u.level,h=u.isStart,s=u.isEnd;if(!d)return null;for(var o="".concat(y,"-indent-unit"),g=[],p=0;p1&&arguments[1]!==void 0?arguments[1]:!1,ee=pe.getAttribute("id")||pe.getAttribute("data-reactid")||pe.getAttribute("name");if(te&&L[ee])return L[ee];var se=window.getComputedStyle(pe),Q=se.getPropertyValue("box-sizing")||se.getPropertyValue("-moz-box-sizing")||se.getPropertyValue("-webkit-box-sizing"),J=parseFloat(se.getPropertyValue("padding-bottom"))+parseFloat(se.getPropertyValue("padding-top")),he=parseFloat(se.getPropertyValue("border-bottom-width"))+parseFloat(se.getPropertyValue("border-top-width")),Ce=E.map(function(we){return"".concat(we,":").concat(se.getPropertyValue(we))}).join(";"),De={sizingStyle:Ce,paddingSize:J,borderSize:he,boxSizing:Q};return te&&ee&&(L[ee]=De),De}function V(pe){var te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,ee=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,se=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;F||(F=document.createElement("textarea"),F.setAttribute("tab-index","-1"),F.setAttribute("aria-hidden","true"),document.body.appendChild(F)),pe.getAttribute("wrap")?F.setAttribute("wrap",pe.getAttribute("wrap")):F.removeAttribute("wrap");var Q=j(pe,te),J=Q.paddingSize,he=Q.borderSize,Ce=Q.boxSizing,De=Q.sizingStyle;F.setAttribute("style","".concat(De,";").concat(p)),F.value=pe.value||pe.placeholder||"";var we=Number.MIN_SAFE_INTEGER,Me=Number.MAX_SAFE_INTEGER,Te=F.scrollHeight,_e;if(Ce==="border-box"?Te+=he:Ce==="content-box"&&(Te-=J),ee!==null||se!==null){F.value=" ";var Pe=F.scrollHeight-J;ee!==null&&(we=Pe*ee,Ce==="border-box"&&(we=we+J+he),Te=Math.max(we,Te)),se!==null&&(Me=Pe*se,Ce==="border-box"&&(Me=Me+J+he),_e=Te>Me?"":"hidden",Te=Math.min(Me,Te))}return{height:Te,minHeight:we,maxHeight:Me,overflowY:_e,resize:"none"}}var B=H("Gytx"),I=H.n(B),$;(function(pe){pe[pe.NONE=0]="NONE",pe[pe.RESIZING=1]="RESIZING",pe[pe.RESIZED=2]="RESIZED"})($||($={}));var ie=function(pe){Object(K.a)(ee,pe);var te=Object(k.a)(ee);function ee(se){var Q;return Object(G.a)(this,ee),Q=te.call(this,se),Q.nextFrameActionId=void 0,Q.resizeFrameId=void 0,Q.textArea=void 0,Q.saveTextArea=function(J){Q.textArea=J},Q.handleResize=function(J){var he=Q.state.resizeStatus,Ce=Q.props,De=Ce.autoSize,we=Ce.onResize;if(he!==$.NONE)return;typeof we=="function"&&we(J),De&&Q.resizeOnNextFrame()},Q.resizeOnNextFrame=function(){cancelAnimationFrame(Q.nextFrameActionId),Q.nextFrameActionId=requestAnimationFrame(Q.resizeTextarea)},Q.resizeTextarea=function(){var J=Q.props.autoSize;if(!J||!Q.textArea)return;var he=J.minRows,Ce=J.maxRows,De=V(Q.textArea,!1,he,Ce);Q.setState({textareaStyles:De,resizeStatus:$.RESIZING},function(){cancelAnimationFrame(Q.resizeFrameId),Q.resizeFrameId=requestAnimationFrame(function(){Q.setState({resizeStatus:$.RESIZED},function(){Q.resizeFrameId=requestAnimationFrame(function(){Q.setState({resizeStatus:$.NONE}),Q.fixFirefoxAutoScroll()})})})})},Q.renderTextArea=function(){var J=Q.props,he=J.prefixCls,Ce=he===void 0?"rc-textarea":he,De=J.autoSize,we=J.onResize,Me=J.className,Te=J.disabled,_e=Q.state,Pe=_e.textareaStyles,je=_e.resizeStatus,Qe=Object(s.a)(Q.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Ie=g()(Ce,Me,Object(M.a)({},"".concat(Ce,"-disabled"),Te));"value"in Qe&&(Qe.value=Qe.value||"");var Ae=Object(N.a)(Object(N.a)(Object(N.a)({},Q.props.style),Pe),je===$.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return P.createElement(h,{onResize:Q.handleResize,disabled:!(De||we)},P.createElement("textarea",Object(ne.a)({},Qe,{className:Ie,style:Ae,ref:Q.saveTextArea})))},Q.state={textareaStyles:{},resizeStatus:$.NONE},Q}return Object(D.a)(ee,[{key:"componentDidUpdate",value:function(Q){(Q.value!==this.props.value||!I()(Q.autoSize,this.props.autoSize))&&this.resizeTextarea()}},{key:"componentWillUnmount",value:function(){cancelAnimationFrame(this.nextFrameActionId),cancelAnimationFrame(this.resizeFrameId)}},{key:"fixFirefoxAutoScroll",value:function(){try{if(document.activeElement===this.textArea){var Q=this.textArea.selectionStart,J=this.textArea.selectionEnd;this.textArea.setSelectionRange(Q,J)}}catch(he){}}},{key:"render",value:function(){return this.renderTextArea()}}]),ee}(P.Component),ue=ie,fe=function(pe){Object(K.a)(ee,pe);var te=Object(k.a)(ee);function ee(se){var Q;Object(G.a)(this,ee),Q=te.call(this,se),Q.resizableTextArea=void 0,Q.focus=function(){Q.resizableTextArea.textArea.focus()},Q.saveTextArea=function(he){Q.resizableTextArea=he},Q.handleChange=function(he){var Ce=Q.props.onChange;Q.setValue(he.target.value,function(){Q.resizableTextArea.resizeTextarea()}),Ce&&Ce(he)},Q.handleKeyDown=function(he){var Ce=Q.props,De=Ce.onPressEnter,we=Ce.onKeyDown;he.keyCode===13&&De&&De(he),we&&we(he)};var J=typeof se.value=="undefined"||se.value===null?se.defaultValue:se.value;return Q.state={value:J},Q}return Object(D.a)(ee,[{key:"setValue",value:function(Q,J){"value"in this.props||this.setState({value:Q},J)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return P.createElement(ue,Object(ne.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(Q){return"value"in Q?{value:Q.value}:null}}]),ee}(P.Component),ve=Be.default=fe},YBdh:function(Je,Be,H){Je.exports=H.p+"static/xiren.a6554bc1.svg"},ZWs3:function(Je,Be,H){"use strict";H.d(Be,"a",function(){return T});var ne=H("+L6B"),G=H("2/Rp"),D=H("0Owb"),K=H("9og8"),k=H("tJVT"),P=H("PpiC"),N=H("WmNS"),M=H.n(N),O=H("cDcd"),A=H.n(O),T=function(R){var S=R.children,b=Object(P.a)(R,["children"]),x=Object(O.useState)(!1),f=Object(k.a)(x,2),l=f[0],i=f[1];return A.a.createElement(G.a,Object(D.a)({},b,{loading:l,onClick:function(){var c=Object(K.a)(M.a.mark(function _(v){return M.a.wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.prev=0,i(!0),u.next=4,b.onClick(v);case 4:i(!1),u.next=10;break;case 7:u.prev=7,u.t0=u.catch(0),i(!1);case 10:case"end":return u.stop()}},_,null,[[0,7]])}));return function(_){return c.apply(this,arguments)}}()}),S)}},ZpRC:function(Je,Be,H){"use strict";function ne(T){return typeof T=="object"&&T!=null&&T.nodeType===1}function G(T,C){return(!C||T!=="hidden")&&T!=="visible"&&T!=="clip"}function D(T,C){if(T.clientHeightC||x>T&&f=C&&l>=R?x-T-S:f>C&&lR?f-C+b:0}var k=function(T,C){var R=window,S=C.scrollMode,b=C.block,x=C.inline,f=C.boundary,l=C.skipOverflowHiddenElements,i=typeof f=="function"?f:function(Pe){return Pe!==f};if(!ne(T))throw new TypeError("Invalid target");for(var c=document.scrollingElement||document.documentElement,_=[],v=T;ne(v)&&i(v);){if((v=v.parentElement)===c){_.push(v);break}v!=null&&v===document.body&&D(v)&&!D(document.documentElement)||v!=null&&D(v,l)&&_.push(v)}for(var m=R.visualViewport?R.visualViewport.width:innerWidth,u=R.visualViewport?R.visualViewport.height:innerHeight,y=window.scrollX||pageXOffset,d=window.scrollY||pageYOffset,h=T.getBoundingClientRect(),s=h.height,o=h.width,g=h.top,p=h.right,E=h.bottom,L=h.left,F=b==="start"||b==="nearest"?g:b==="end"?E:g+s/2,j=x==="center"?L+o/2:x==="end"?p:L,V=[],B=0;B<_.length;B++){var I=_[B],$=I.getBoundingClientRect(),ie=$.height,ue=$.width,fe=$.top,ve=$.right,pe=$.bottom,te=$.left;if(S==="if-needed"&&g>=0&&L>=0&&E<=u&&p<=m&&g>=fe&&E<=pe&&L>=te&&p<=ve)return V;var ee=getComputedStyle(I),se=parseInt(ee.borderLeftWidth,10),Q=parseInt(ee.borderTopWidth,10),J=parseInt(ee.borderRightWidth,10),he=parseInt(ee.borderBottomWidth,10),Ce=0,De=0,we="offsetWidth"in I?I.offsetWidth-I.clientWidth-se-J:0,Me="offsetHeight"in I?I.offsetHeight-I.clientHeight-Q-he:0;if(c===I)Ce=b==="start"?F:b==="end"?F-u:b==="nearest"?K(d,d+u,u,Q,he,d+F,d+F+s,s):F-u/2,De=x==="start"?j:x==="center"?j-m/2:x==="end"?j-m:K(y,y+m,m,se,J,y+j,y+j+o,o),Ce=Math.max(0,Ce+d),De=Math.max(0,De+y);else{Ce=b==="start"?F-fe-Q:b==="end"?F-pe+he+Me:b==="nearest"?K(fe,pe,ie,Q,he+Me,F,F+s,s):F-(fe+ie/2)+Me/2,De=x==="start"?j-te-se:x==="center"?j-(te+ue/2)+we/2:x==="end"?j-ve+J+we:K(te,ve,ue,se,J+we,j,j+o,o);var Te=I.scrollLeft,_e=I.scrollTop;F+=_e-(Ce=Math.max(0,Math.min(_e+Ce,I.scrollHeight-ie+Me))),j+=Te-(De=Math.max(0,Math.min(Te+De,I.scrollWidth-ue+we)))}V.push({el:I,top:Ce,left:De})}return V};function P(T){return T===Object(T)&&Object.keys(T).length!==0}function N(T,C){C===void 0&&(C="auto");var R="scrollBehavior"in document.body.style;T.forEach(function(S){var b=S.el,x=S.top,f=S.left;b.scroll&&R?b.scroll({top:x,left:f,behavior:C}):(b.scrollTop=x,b.scrollLeft=f)})}function M(T){return T===!1?{block:"end",inline:"nearest"}:P(T)?T:{block:"start",inline:"nearest"}}function O(T,C){var R=!T.ownerDocument.documentElement.contains(T);if(P(C)&&typeof C.behavior=="function")return C.behavior(R?[]:k(T,C));if(R)return;var S=M(C);return N(k(T,S),S.behavior)}var A=Be.a=O},bT9E:function(Je,Be,H){"use strict";H.d(Be,"a",function(){return G});var ne=H("VTBJ");function G(D,K){var k=Object(ne.a)({},D);return Array.isArray(K)&&K.forEach(function(P){delete k[P]}),k}},c5Ni:function(Je,Be,H){},dejd:function(Je,Be,H){},dmUQ:function(Je,Be,H){"use strict";var ne=H("Ff2n"),G=H("rePB"),D=H("1OyB"),K=H("vuIU"),k=H("Ji7U"),P=H("md7G"),N=H("foSv"),M=H("cDcd"),O=H.n(M),A=H("TSYQ"),T=H.n(A),C=H("4IlW");function R(s,o){var g=Object.keys(s);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(s);o&&(p=p.filter(function(E){return Object.getOwnPropertyDescriptor(s,E).enumerable})),g.push.apply(g,p)}return g}function S(s){for(var o=1;o1?ue-1:0),ve=1;ve1?B-1:0),$=1;$=0)return parseInt(V.slice(V.indexOf("e-")+2),10);var B=0;return V.indexOf(".")>=0&&(B=V.length-V.indexOf(".")-1),B},E.getInputDisplayValue=function(j){var V=j||E.state,B=V.focused,I=V.inputValue,$=V.value,ie;B?ie=I:ie=E.toPrecisionAsStep($),ie==null&&(ie="");var ue=E.formatWrapper(ie);return m(E.props.decimalSeparator)&&(ue=ue.toString().replace(".",E.props.decimalSeparator)),ue},E.recordCursorPosition=function(){try{E.cursorStart=E.input.selectionStart,E.cursorEnd=E.input.selectionEnd,E.currentValue=E.input.value,E.cursorBefore=E.input.value.substring(0,E.cursorStart),E.cursorAfter=E.input.value.substring(E.cursorEnd)}catch(j){}},E.restoreByAfter=function(j){if(j===void 0)return!1;var V=E.input.value,B=V.lastIndexOf(j);if(B===-1)return!1;var I=E.cursorBefore.length;return E.lastKeyCode===C.a.DELETE&&E.cursorBefore.charAt(I-1)===j[0]?(E.fixCaret(I,I),!0):B+j.length===V.length?(E.fixCaret(B,B),!0):!1},E.partRestoreByAfter=function(j){return j===void 0?!1:Array.prototype.some.call(j,function(V,B){var I=j.substring(B);return E.restoreByAfter(I)})},E.isNotCompleteNumber=function(j){return isNaN(j)||j===""||j===null||j&&j.toString().indexOf(".")===j.toString().length-1},E.stop=function(){E.autoStepTimer&&clearTimeout(E.autoStepTimer)},E.down=function(j,V,B){E.pressingUpOrDown=!0,E.step("down",j,V,B)},E.up=function(j,V,B){E.pressingUpOrDown=!0,E.step("up",j,V,B)},E.saveInput=function(j){E.input=j};var L=p.value;L===void 0&&(L=p.defaultValue),E.state={focused:p.autoFocus};var F=E.getValidValue(E.toNumber(L));return E.state=S(S({},E.state),{},{inputValue:E.toPrecisionAsStep(F),value:F}),E}return Object(K.a)(g,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(E){var L=this.props,F=L.value,j=L.onChange,V=L.max,B=L.min,I=this.state.focused;if(E){if(!u(E.value,F)||!u(E.max,V)||!u(E.min,B)){var $=I?F:this.getValidValue(F),ie;this.pressingUpOrDown?ie=$:this.inputting?ie=this.rawInput:ie=this.toPrecisionAsStep($),this.setState({value:$,inputValue:ie})}var ue="value"in this.props?F:this.state.value;"max"in this.props&&E.max!==V&&typeof ue=="number"&&ue>V&&j&&j(V),"min"in this.props&&E.min!==B&&typeof ue=="number"&&ue1&&arguments[1]!==void 0?arguments[1]:this.props.min,F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,j=parseFloat(E);return isNaN(j)?E:(jF&&(j=F),j)}},{key:"setValue",value:function(E,L){var F=this.props.precision,j=this.isNotCompleteNumber(parseFloat(E))?null:parseFloat(E),V=this.state.value,B=V===void 0?null:V,I=this.state.inputValue,$=I===void 0?null:I,ie=typeof j=="number"?j.toFixed(F):"".concat(j),ue=j!==B||ie!=="".concat($);return"value"in this.props?($=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:$},L)):this.setState({value:j,inputValue:this.toPrecisionAsStep(E)},L),ue&&this.props.onChange(j),j}},{key:"getMaxPrecision",value:function(E){var L=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,F=this.props,j=F.precision,V=F.step;if(m(j))return j;var B=this.getPrecision(L),I=this.getPrecision(V),$=this.getPrecision(E);return E?Math.max($,B+I):B+I}},{key:"getPrecisionFactor",value:function(E){var L=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,F=this.getMaxPrecision(E,L);return Math.pow(10,F)}},{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(E){return this.props.formatter?this.props.formatter(E):E}},{key:"toPrecisionAsStep",value:function(E){if(this.isNotCompleteNumber(E)||E==="")return E;var L=Math.abs(this.getMaxPrecision(E));return isNaN(L)?E.toString():Number(E).toFixed(L)}},{key:"toNumber",value:function(E){var L=this.props.precision,F=this.state.focused,j=E&&E.length>16&&F;return this.isNotCompleteNumber(E)||j?E:m(L)?Math.round(E*Math.pow(10,L))/Math.pow(10,L):Number(E)}},{key:"upStep",value:function(E,L){var F=this.props.step,j=this.getPrecisionFactor(E,L),V=Math.abs(this.getMaxPrecision(E,L)),B=((j*E+j*F*L)/j).toFixed(V);return this.toNumber(B)}},{key:"downStep",value:function(E,L){var F=this.props.step,j=this.getPrecisionFactor(E,L),V=Math.abs(this.getMaxPrecision(E,L)),B=((j*E-j*F*L)/j).toFixed(V);return this.toNumber(B)}},{key:"step",value:function(E,L){var F=this,j=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,V=arguments.length>3?arguments[3]:void 0;this.stop(),L&&(L.persist(),L.preventDefault());var B=this.props;if(B.disabled)return;var I=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(I))return;var $=this["".concat(E,"Step")](I,j),ie=$>B.max||$B.max?$=B.max:$=fe),He=(ft||ft===0)&&(isNaN(ft)||Number(ft)<=ve),me=Re||j||V,le=He||j||V,de=T()("".concat(F,"-handler"),"".concat(F,"-handler-up"),Object(G.a)({},"".concat(F,"-handler-up-disabled"),me)),Y=T()("".concat(F,"-handler"),"".concat(F,"-handler-down"),Object(G.a)({},"".concat(F,"-handler-down-disabled"),le)),Z=B?{onTouchStart:me?f:this.up,onTouchEnd:this.stop}:{onMouseDown:me?f:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},q=B?{onTouchStart:le?f:this.down,onTouchEnd:this.stop}:{onMouseDown:le?f:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return O.a.createElement("div",{className:st,style:pe,title:te,onMouseEnter:ee,onMouseLeave:se,onMouseOver:Q,onMouseOut:J,onFocus:function(){return null},onBlur:function(){return null}},O.a.createElement("div",{className:"".concat(F,"-handler-wrap")},O.a.createElement("span",Object.assign({unselectable:"on"},Z,{role:"button","aria-label":"Increase Value","aria-disabled":me,className:de}),$||O.a.createElement("span",{unselectable:"on",className:"".concat(F,"-handler-up-inner"),onClick:l})),O.a.createElement("span",Object.assign({unselectable:"on"},q,{role:"button","aria-label":"Decrease Value","aria-disabled":le,className:Y}),ie||O.a.createElement("span",{unselectable:"on",className:"".concat(F,"-handler-down-inner"),onClick:l}))),O.a.createElement("div",{className:"".concat(F,"-input-wrap")},O.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":ve,"aria-valuemax":fe,"aria-valuenow":ft,required:he,type:we,placeholder:Me,onPaste:et,onClick:Ce,onMouseUp:this.onMouseUp,className:"".concat(F,"-input"),tabIndex:De,autoComplete:I,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:Et?this.onKeyDown:f,onKeyUp:Et?this.onKeyUp:f,autoFocus:Ie,maxLength:Qe,readOnly:V,disabled:j,max:fe,min:ve,step:je,name:Ae,title:te,id:Te,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(dt),pattern:Pe,inputMode:_e,onInput:qe},Se))))}}]),g}(O.a.Component);y.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:v,min:-v,step:1,style:{},onChange:f,onKeyDown:f,onPressEnter:f,onFocus:f,onBlur:f,parser:i,required:!1,autoComplete:"off"};var d=y,h=Be.a=d},"e+RI":function(Je,Be,H){Je.exports={btn:"btn___35XHi",s1:"s1___yzdGB",s2:"s2___3kxXm",btnDisabled:"btnDisabled___lI9pA",btn2:"btn2___2KLJQ"}},"eS0+":function(Je,Be,H){"use strict";var ne=H("giR+"),G=H("fyUT"),D=H("tJVT"),K=H("PpiC"),k=H("OaEy"),P=H("2fM7"),N=H("cDcd"),M=H.n(N),O=H("2sxD"),A=H.n(O),T=H("51dB"),C=H.n(T),R=H("5MlY"),S=H.n(R),b=H("lnNo"),x=H.n(b),f=H("YBdh"),l=H.n(f),i=H("LvDl"),c=H.n(i),_=H("TSYQ"),v=H.n(_),m=P.a.Option,u=function(s){var o=parseInt(s);return Object(i.isNaN)(o)?0:o},y=function(s){var o,g,p=s.index,E=s.value,L=E===void 0?[]:E,F=s.onChange,j=s.type,V=s.disabled,B=V===void 0?!1:V,I=s.expansion,$=I===void 0?!0:I,ie=Object(K.a)(s,["index","value","onChange","type","disabled","expansion"]),ue=Object(N.useState)(!0),fe=Object(D.a)(ue,2),ve=fe[0],pe=fe[1],te=function(se,Q){var J=Object(i.cloneDeep)(L);J.difficulties[Q].num=se,console.log(J,444),F(J)};return M.a.createElement("div",{className:A.a.ListGroup,style:{borderWidth:p?1:0}},M.a.createElement("div",{className:A.a.a},p+1),M.a.createElement("div",{"data-type":"width",className:A.a.b},L==null?void 0:L.name),M.a.createElement("div",{className:A.a.c},L==null||((o=L.difficulties)===null||o===void 0)?void 0:o.map(function(ee,se){return M.a.createElement("div",{key:se,style:{display:ve?"flex":se?"none":"flex"},className:A.a.c1},M.a.createElement("span",{style:{color:"#777777",marginRight:5}},"\u96BE\u5EA6"),ee.difficulty===1&&M.a.createElement("span",{className:A.a.radio},"\u7B80\u5355"),ee.difficulty===2&&M.a.createElement("span",{className:A.a.radio},"\u9002\u4E2D"),ee.difficulty===3&&M.a.createElement("span",{className:A.a.radio},"\u56F0\u96BE"),M.a.createElement("span",{style:{color:"#777777",marginRight:5,marginLeft:50}},"\u62BD\u9898\u6570\u91CF"),p===0&&se===0?M.a.createElement("div",{id:"".concat(j,"_sum")},M.a.createElement(G.a,{disabled:B,parser:u,onChange:function(J){return te(J,se)},min:0,max:ee==null?void 0:ee.count,value:(ee==null?void 0:ee.num)||0,style:{width:66}}),M.a.createElement("span",{style:{display:"none"}},"\u8BF7\u8F93\u5165\u6570\u91CF")):M.a.createElement(G.a,{disabled:B,parser:u,onChange:function(J){return te(J,se)},min:0,max:ee==null?void 0:ee.count,value:(ee==null?void 0:ee.num)||0,style:{width:66}}),M.a.createElement("span",{style:{marginLeft:5}},"/",ee==null?void 0:ee.count))})),M.a.createElement("div",{style:{display:(L==null||((g=L.difficulties)===null||g===void 0)?void 0:g.length)===1||!$?"none":"block"},onClick:function(){return pe(!ve)},className:A.a.d},ve?"\u6536\u8D77":"\u5C55\u5F00",M.a.createElement("img",{style:{marginTop:-2,transform:ve?"rotate(0deg)":"rotate(180deg)"},src:x.a,className:"ml5"})))},d=function(s){var o,g,p=s.value,E=p===void 0?[]:p,L=s.onChange,F=s.listClassName,j=s.disabled,V=j===void 0?!1:j,B=s.expansion,I=B===void 0?!0:B,$=Object(K.a)(s,["value","onChange","listClassName","disabled","expansion"]),ie=Object(N.useState)(!0),ue=Object(D.a)(ie,2),fe=ue[0],ve=ue[1],pe=function(J){var he,Ce=J.score||0,De=[];J==null||((he=J.item_banks)===null||he===void 0)||he.forEach(function(Me){var Te;Me==null||((Te=Me.tag_disciplines)===null||Te===void 0)||Te.forEach(function(_e){var Pe;_e==null||((Pe=_e.difficulties)===null||Pe===void 0)||Pe.forEach(function(je){je.num&&De.push(je.num)})})});var we=De.reduce(function(Me,Te){return Me+Te},0);return we*Ce},te=[{type:"SINGLE",name:"\u5355\u9009\u9898"},{type:"MULTIPLE",name:"\u591A\u9009\u9898"},{type:"COMPLETION",name:"\u586B\u7A7A\u9898"},{type:"JUDGMENT",name:"\u5224\u65AD\u9898"},{type:"SUBJECTIVE",name:"\u7B80\u7B54\u9898"},{type:"PROGRAM",name:"\u7F16\u7A0B\u9898"},{type:"PRACTICAL",name:"\u5B9E\u8BAD\u9898"},{type:"COMBINATION",name:"\u7EC4\u5408\u9898"}],ee=function(J,he,Ce){var De=Object(i.cloneDeep)(E);De.item_banks[he].tag_disciplines[Ce]=J;var we=pe(De);De.scoreTotal=we,console.log(De,"newValue"),L(De)},se=function(J){var he=Object(i.cloneDeep)(E);he.score=J;var Ce=pe(he);he.scoreTotal=Ce,L(he)};return M.a.createElement("div",{className:v()(A.a.list,F)},M.a.createElement("div",{className:A.a.head},M.a.createElement("div",{className:A.a.name},M.a.createElement("b",null),M.a.createElement("span",null,(o=te.find(function(Q){return Q.type===(E==null?void 0:E.item_type)}))===null||o===void 0?void 0:o.name)),M.a.createElement("div",{className:A.a.right},I&&M.a.createElement("div",{onClick:function(){return ve(!fe)},className:"current c-light-primary mb10"},fe?"\u6536\u8D77":"\u5C55\u5F00",M.a.createElement("img",{style:{marginTop:-2,transform:fe?"rotate(0deg)":"rotate(180deg)"},src:x.a,className:"ml5"})),M.a.createElement("div",null,M.a.createElement("img",{src:C.a}),M.a.createElement("span",{className:"ml10 mr20"},"\u603B\u5206",E.scoreTotal,"\u5206"),M.a.createElement("img",{className:"mr10",src:S.a}),M.a.createElement("span",null,(E==null?void 0:E.item_type)==="COMBINATION"?"\u6BCF\u5C0F\u9898":"\u6BCF\u9898"),M.a.createElement("div",{id:"".concat(E==null?void 0:E.item_type,"_score")},M.a.createElement(G.a,{disabled:V,parser:u,min:0,onChange:se,value:E.score,style:{margin:"0 5px"}}),M.a.createElement("span",{style:{display:"none"}},"\u8BF7\u8F93\u5165\u6BCF\u9898\u5206\u6570")),M.a.createElement("span",null,"\u5206")))),M.a.createElement("div",{className:A.a.body,style:{display:fe?"block":"none"}},E==null||((g=E.item_banks)===null||g===void 0)?void 0:g.map(function(Q,J){var he;return M.a.createElement(M.a.Fragment,{key:J},M.a.createElement("div",{className:A.a.top},M.a.createElement("img",{src:l.a}),M.a.createElement("span",null,"\u65B9\u5411/\u8BFE\u7A0B"),M.a.createElement("b",null),M.a.createElement("aside",null,Q==null?void 0:Q.disciplines,"/",Q==null?void 0:Q.sub_discipline)),M.a.createElement("div",{className:A.a.bottom},M.a.createElement("div",{className:A.a.l},"\u77E5\u8BC6\u70B9"),M.a.createElement("div",{className:A.a.r},Q==null||((he=Q.tag_disciplines)===null||he===void 0)?void 0:he.map(function(Ce,De){return M.a.createElement(y,{expansion:I,disabled:V,type:E==null?void 0:E.item_type,key:"".concat(J,"-").concat(De),value:Ce,index:De,onChange:function(Me){return ee(Me,J,De)}})}))))})))};Be.a=d},exQ7:function(Je,Be,H){Je.exports=H.p+"static/te.6f9c0684.svg"},fAei:function(Je,Be,H){"use strict";H.d(Be,"a",function(){return c.a});var ne=H("rePB"),G=H("VTBJ"),D=H("KQm4"),K=H("1OyB"),k=H("vuIU"),P=H("Ji7U"),N=H("LK+K"),M=H("cDcd"),O=H("4IlW"),A=H("Kwbf"),T=H("TSYQ"),C=H.n(T),R=H("sboe"),S=H("OZM5"),b=H("815F"),x=H("ODXe"),f=H("Ff2n"),l=H("+nKL"),i=H("8XRh"),c=H("WaYH"),_=function(ve,pe){var te=ve.className,ee=ve.style,se=ve.motion,Q=ve.motionNodes,J=ve.motionType,he=ve.onMotionStart,Ce=ve.onMotionEnd,De=ve.active,we=ve.treeNodeRequiredProps,Me=Object(f.a)(ve,["className","style","motion","motionNodes","motionType","onMotionStart","onMotionEnd","active","treeNodeRequiredProps"]),Te=M.useState(!0),_e=Object(x.a)(Te,2),Pe=_e[0],je=_e[1],Qe=M.useContext(R.a),Ie=Qe.prefixCls,Ae=M.useRef(!1),et=function(){Ae.current||Ce(),Ae.current=!0};return Object(M.useEffect)(function(){Q&&J==="hide"&&Pe&&je(!1)},[Q]),Object(M.useEffect)(function(){return Q&&he(),function(){Q&&et()}},[]),Q?M.createElement(i.default,Object.assign({ref:pe,visible:Pe},se,{motionAppear:J==="show",onAppearEnd:et,onLeaveEnd:et}),function(qe,lt){var $e=qe.className,ft=qe.style;return M.createElement("div",{ref:lt,className:C()("".concat(Ie,"-treenode-motion"),$e),style:ft},Q.map(function(ut){var st=ut.data,Se=st.key,Et=Object(f.a)(st,["key"]),dt=ut.isStart,Re=ut.isEnd;delete Et.children;var He=Object(b.f)(Se,we);return M.createElement(c.a,Object.assign({},Et,He,{active:De,data:ut.data,key:Se,isStart:dt,isEnd:Re}))}))}):M.createElement(c.a,Object.assign({domRef:pe,className:te,style:ee},Me,{active:De}))};_.displayName="MotionTreeNode";var v=M.forwardRef(_),m=v;function u(){var fe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],ve=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],pe=fe.length,te=ve.length;if(Math.abs(pe-te)!==1)return{add:!1,key:null};function ee(se,Q){var J=new Map;se.forEach(function(Ce){J.set(Ce,!0)});var he=Q.filter(function(Ce){return!J.has(Ce)});return he.length===1?he[0]:null}return pe ").concat(ve);return ve}var j=function(ve,pe){var te=ve.prefixCls,ee=ve.data,se=ve.selectable,Q=ve.checkable,J=ve.expandedKeys,he=ve.selectedKeys,Ce=ve.checkedKeys,De=ve.loadedKeys,we=ve.loadingKeys,Me=ve.halfCheckedKeys,Te=ve.keyEntities,_e=ve.disabled,Pe=ve.dragging,je=ve.dragOverNodeKey,Qe=ve.dropPosition,Ie=ve.motion,Ae=ve.height,et=ve.itemHeight,qe=ve.virtual,lt=ve.focusable,$e=ve.activeItem,ft=ve.focused,ut=ve.tabIndex,st=ve.onKeyDown,Se=ve.onFocus,Et=ve.onBlur,dt=ve.onActiveChange,Re=ve.onListChangeStart,He=ve.onListChangeEnd,me=Object(f.a)(ve,["prefixCls","data","selectable","checkable","expandedKeys","selectedKeys","checkedKeys","loadedKeys","loadingKeys","halfCheckedKeys","keyEntities","disabled","dragging","dragOverNodeKey","dropPosition","motion","height","itemHeight","virtual","focusable","activeItem","focused","tabIndex","onKeyDown","onFocus","onBlur","onActiveChange","onListChangeStart","onListChangeEnd"]),le=M.useRef(null);M.useImperativeHandle(pe,function(){return{scrollTo:function(Mt){le.current.scrollTo(Mt)}}});var de=M.useState(J),Y=Object(x.a)(de,2),Z=Y[0],q=Y[1],ae=M.useState(ee),re=Object(x.a)(ae,2),Ee=re[0],xe=re[1],Ve=M.useState(ee),Le=Object(x.a)(Ve,2),We=Le[0],Ot=Le[1],Ze=M.useState([]),ht=Object(x.a)(Ze,2),Ut=ht[0],Ke=ht[1],It=M.useState(null),Zt=Object(x.a)(It,2),At=Zt[0],Yt=Zt[1];function Kt(){xe(ee),Ot(ee),Ke([]),Yt(null),He()}M.useEffect(function(){q(J);var pt=u(Z,J);if(pt.key!==null)if(pt.add){var Mt=Ee.findIndex(function(Jt){var Wt=Jt.data.key;return Wt===pt.key}),_t=E(y(Ee,ee,pt.key),qe,Ae,et),Tt=Ee.slice();Tt.splice(Mt+1,0,p),Ot(Tt),Ke(_t),Yt("show")}else{var bt=ee.findIndex(function(Jt){var Wt=Jt.data.key;return Wt===pt.key}),tt=E(y(ee,Ee,pt.key),qe,Ae,et),Fe=ee.slice();Fe.splice(bt+1,0,p),Ot(Fe),Ke(tt),Yt("hide")}else Ee!==ee&&(xe(ee),Ot(ee))},[J,ee]),M.useEffect(function(){Pe||Kt()},[Pe]);var Pt=Ie?We:ee,Rt={expandedKeys:J,selectedKeys:he,loadedKeys:De,loadingKeys:we,checkedKeys:Ce,halfCheckedKeys:Me,dragOverNodeKey:je,dropPosition:Qe,keyEntities:Te};return M.createElement(M.Fragment,null,ft&&$e&&M.createElement("span",{style:d,"aria-live":"assertive"},F($e)),M.createElement("div",{role:"tree"},M.createElement("input",{style:d,disabled:lt===!1||_e,tabIndex:lt!==!1?ut:null,onKeyDown:st,onFocus:Se,onBlur:Et,value:"",onChange:h})),M.createElement(l.a,Object.assign({},me,{data:Pt,itemKey:L,height:Ae,fullHeight:!1,virtual:qe,itemHeight:et,prefixCls:"".concat(te,"-list"),ref:le}),function(pt){var Mt=pt.pos,_t=pt.data,Tt=_t.key,bt=Object(f.a)(_t,["key"]),tt=pt.isStart,Fe=pt.isEnd,Jt=Object(b.e)(Tt,Mt);delete bt.children;var Wt=Object(b.f)(Jt,Rt);return M.createElement(m,Object.assign({},bt,Wt,{active:$e&&Tt===$e.data.key,pos:Mt,data:pt.data,isStart:tt,isEnd:Fe,motion:Ie,motionNodes:Tt===s?Ut:null,motionType:At,onMotionStart:Re,onMotionEnd:Kt,treeNodeRequiredProps:Rt,onMouseMove:function(){dt(null)}}))}))},V=M.forwardRef(j);V.displayName="NodeList";var B=V,I=H("NvD2"),$=function(fe){Object(P.a)(pe,fe);var ve=Object(N.a)(pe);function pe(){var te;return Object(K.a)(this,pe),te=ve.apply(this,arguments),te.destroyed=!1,te.state={keyEntities:{},selectedKeys:[],checkedKeys:[],halfCheckedKeys:[],loadedKeys:[],loadingKeys:[],expandedKeys:[],dragging:!1,dragNodesKeys:[],dragOverNodeKey:null,dropPosition:null,treeData:[],flattenNodes:[],focused:!1,activeKey:null,listChanging:!1,prevProps:null},te.listRef=M.createRef(),te.onNodeDragStart=function(ee,se){var Q=te.state,J=Q.expandedKeys,he=Q.keyEntities,Ce=te.props.onDragStart,De=se.props.eventKey;te.dragNode=se;var we=Object(S.b)(J,De);te.setState({dragging:!0,dragNodesKeys:Object(S.g)(De,he)}),te.setExpandedKeys(we),Ce&&Ce({event:ee,node:Object(b.b)(se.props)})},te.onNodeDragEnter=function(ee,se){var Q=te.state,J=Q.expandedKeys,he=Q.keyEntities,Ce=Q.dragNodesKeys,De=te.props.onDragEnter,we=se.props,Me=we.pos,Te=we.eventKey;if(!te.dragNode||Ce.indexOf(Te)!==-1)return;var _e=Object(S.c)(ee,se);if(te.dragNode.props.eventKey===Te&&_e===0){te.setState({dragOverNodeKey:"",dropPosition:null});return}setTimeout(function(){te.setState({dragOverNodeKey:Te,dropPosition:_e}),te.delayedDragEnterLogic||(te.delayedDragEnterLogic={}),Object.keys(te.delayedDragEnterLogic).forEach(function(Pe){clearTimeout(te.delayedDragEnterLogic[Pe])}),te.delayedDragEnterLogic[Me]=window.setTimeout(function(){if(!te.state.dragging)return;var Pe=Object(D.a)(J),je=he[Te];je&&(je.children||[]).length&&(Pe=Object(S.a)(J,Te)),"expandedKeys"in te.props||te.setExpandedKeys(Pe),De&&De({event:ee,node:Object(b.b)(se.props),expandedKeys:Pe})},400)},0)},te.onNodeDragOver=function(ee,se){var Q=te.state.dragNodesKeys,J=te.props.onDragOver,he=se.props.eventKey;if(Q.indexOf(he)!==-1)return;if(te.dragNode&&he===te.state.dragOverNodeKey){var Ce=Object(S.c)(ee,se);if(Ce===te.state.dropPosition)return;te.setState({dropPosition:Ce})}J&&J({event:ee,node:Object(b.b)(se.props)})},te.onNodeDragLeave=function(ee,se){var Q=te.props.onDragLeave;te.setState({dragOverNodeKey:""}),Q&&Q({event:ee,node:Object(b.b)(se.props)})},te.onNodeDragEnd=function(ee,se){var Q=te.props.onDragEnd;te.setState({dragOverNodeKey:""}),te.cleanDragState(),Q&&Q({event:ee,node:Object(b.b)(se.props)}),te.dragNode=null},te.onNodeDrop=function(ee,se){var Q=te.state,J=Q.dragNodesKeys,he=J===void 0?[]:J,Ce=Q.dropPosition,De=te.props.onDrop,we=se.props,Me=we.eventKey,Te=we.pos;if(te.setState({dragOverNodeKey:""}),te.cleanDragState(),he.indexOf(Me)!==-1){Object(A.a)(!1,"Can not drop to dragNode(include it's children node)");return}var _e=Object(S.k)(Te),Pe={event:ee,node:Object(b.b)(se.props),dragNode:te.dragNode?Object(b.b)(te.dragNode.props):null,dragNodesKeys:he.slice(),dropPosition:Ce+Number(_e[_e.length-1]),dropToGap:!1};Ce!==0&&(Pe.dropToGap=!0),De&&De(Pe),te.dragNode=null},te.cleanDragState=function(){var ee=te.state.dragging;ee&&te.setState({dragging:!1})},te.onNodeClick=function(ee,se){var Q=te.props.onClick;Q&&Q(ee,se)},te.onNodeDoubleClick=function(ee,se){var Q=te.props.onDoubleClick;Q&&Q(ee,se)},te.onNodeSelect=function(ee,se){var Q=te.state.selectedKeys,J=te.state.keyEntities,he=te.props,Ce=he.onSelect,De=he.multiple,we=se.selected,Me=se.key,Te=!we;Te?De?Q=Object(S.a)(Q,Me):Q=[Me]:Q=Object(S.b)(Q,Me);var _e=Q.map(function(Pe){var je=J[Pe];return je?je.node:null}).filter(function(Pe){return Pe});te.setUncontrolledState({selectedKeys:Q}),Ce&&Ce(Q,{event:"select",selected:Te,node:se,selectedNodes:_e,nativeEvent:ee.nativeEvent})},te.onNodeCheck=function(ee,se,Q){var J=te.state,he=J.keyEntities,Ce=J.checkedKeys,De=J.halfCheckedKeys,we=te.props,Me=we.checkStrictly,Te=we.onCheck,_e=se.key,Pe,je={event:"check",node:se,checked:Q,nativeEvent:ee.nativeEvent};if(Me){var Qe=Q?Object(S.a)(Ce,_e):Object(S.b)(Ce,_e),Ie=Object(S.b)(De,_e);Pe={checked:Qe,halfChecked:Ie},je.checkedNodes=Qe.map(function(ft){return he[ft]}).filter(function(ft){return ft}).map(function(ft){return ft.node}),te.setUncontrolledState({checkedKeys:Qe})}else{var Ae=Object(I.a)([].concat(Object(D.a)(Ce),[_e]),!0,he),et=Ae.checkedKeys,qe=Ae.halfCheckedKeys;if(!Q){var lt=new Set(et);lt.delete(_e);var $e=Object(I.a)(Array.from(lt),{checked:!1,halfCheckedKeys:qe},he);et=$e.checkedKeys,qe=$e.halfCheckedKeys}Pe=et,je.checkedNodes=[],je.checkedNodesPositions=[],je.halfCheckedKeys=qe,et.forEach(function(ft){var ut=he[ft];if(!ut)return;var st=ut.node,Se=ut.pos;je.checkedNodes.push(st),je.checkedNodesPositions.push({node:st,pos:Se})}),te.setUncontrolledState({checkedKeys:et},!1,{halfCheckedKeys:qe})}Te&&Te(Pe,je)},te.onNodeLoad=function(ee){return new Promise(function(se){te.setState(function(Q){var J=Q.loadedKeys,he=J===void 0?[]:J,Ce=Q.loadingKeys,De=Ce===void 0?[]:Ce,we=te.props,Me=we.loadData,Te=we.onLoad,_e=ee.key;if(!Me||he.indexOf(_e)!==-1||De.indexOf(_e)!==-1)return{};var Pe=Me(ee);return Pe.then(function(){var je=te.state,Qe=je.loadedKeys,Ie=je.loadingKeys,Ae=Object(S.a)(Qe,_e),et=Object(S.b)(Ie,_e);Te&&Te(Ae,{event:"load",node:ee}),te.setUncontrolledState({loadedKeys:Ae}),te.setState({loadingKeys:et}),se()}),{loadingKeys:Object(S.a)(De,_e)}})})},te.onNodeMouseEnter=function(ee,se){var Q=te.props.onMouseEnter;Q&&Q({event:ee,node:se})},te.onNodeMouseLeave=function(ee,se){var Q=te.props.onMouseLeave;Q&&Q({event:ee,node:se})},te.onNodeContextMenu=function(ee,se){var Q=te.props.onRightClick;Q&&(ee.preventDefault(),Q({event:ee,node:se}))},te.onFocus=function(){var ee=te.props.onFocus;te.setState({focused:!0}),ee&&ee.apply(void 0,arguments)},te.onBlur=function(){var ee=te.props.onBlur;te.setState({focused:!1}),te.onActiveChange(null),ee&&ee.apply(void 0,arguments)},te.getTreeNodeRequiredProps=function(){var ee=te.state,se=ee.expandedKeys,Q=ee.selectedKeys,J=ee.loadedKeys,he=ee.loadingKeys,Ce=ee.checkedKeys,De=ee.halfCheckedKeys,we=ee.dragOverNodeKey,Me=ee.dropPosition,Te=ee.keyEntities;return{expandedKeys:se||[],selectedKeys:Q||[],loadedKeys:J||[],loadingKeys:he||[],checkedKeys:Ce||[],halfCheckedKeys:De||[],dragOverNodeKey:we,dropPosition:Me,keyEntities:Te}},te.setExpandedKeys=function(ee){var se=te.state.treeData,Q=Object(b.d)(se,ee);te.setUncontrolledState({expandedKeys:ee,flattenNodes:Q},!0)},te.onNodeExpand=function(ee,se){var Q=te.state.expandedKeys,J=te.state.listChanging,he=te.props,Ce=he.onExpand,De=he.loadData,we=se.key,Me=se.expanded;if(J)return;var Te=Q.indexOf(we),_e=!Me;if(Object(A.a)(Me&&Te!==-1||!Me&&Te===-1,"Expand state not sync with index check"),_e?Q=Object(S.a)(Q,we):Q=Object(S.b)(Q,we),te.setExpandedKeys(Q),Ce&&Ce(Q,{node:se,expanded:_e,nativeEvent:ee.nativeEvent}),_e&&De){var Pe=te.onNodeLoad(se);Pe&&Pe.then(function(){var je=Object(b.d)(te.state.treeData,Q);te.setUncontrolledState({flattenNodes:je})})}},te.onListChangeStart=function(){te.setUncontrolledState({listChanging:!0})},te.onListChangeEnd=function(){setTimeout(function(){te.setUncontrolledState({listChanging:!1})})},te.onActiveChange=function(ee){var se=te.state.activeKey,Q=te.props.onActiveChange;if(se===ee)return;te.setState({activeKey:ee}),ee!==null&&te.scrollTo({key:ee}),Q&&Q(ee)},te.getActiveItem=function(){var ee=te.state,se=ee.activeKey,Q=ee.flattenNodes;return se===null?null:Q.find(function(J){var he=J.data.key;return he===se})||null},te.offsetActiveKey=function(ee){var se=te.state,Q=se.flattenNodes,J=se.activeKey,he=Q.findIndex(function(we){var Me=we.data.key;return Me===J});he===-1&&ee<0&&(he=Q.length),he=(he+ee+Q.length)%Q.length;var Ce=Q[he];if(Ce){var De=Ce.data.key;te.onActiveChange(De)}else te.onActiveChange(null)},te.onKeyDown=function(ee){var se=te.state,Q=se.activeKey,J=se.expandedKeys,he=se.checkedKeys,Ce=te.props,De=Ce.onKeyDown,we=Ce.checkable,Me=Ce.selectable;switch(ee.which){case O.a.UP:{te.offsetActiveKey(-1),ee.preventDefault();break}case O.a.DOWN:{te.offsetActiveKey(1),ee.preventDefault();break}}var Te=te.getActiveItem();if(Te&&Te.data){var _e=te.getTreeNodeRequiredProps(),Pe=Te.data.isLeaf===!1||!!(Te.data.children||[]).length,je=Object(b.b)(Object(G.a)(Object(G.a)({},Object(b.f)(Q,_e)),{},{data:Te.data,active:!0}));switch(ee.which){case O.a.LEFT:{Pe&&J.includes(Q)?te.onNodeExpand({},je):Te.parent&&te.onActiveChange(Te.parent.data.key),ee.preventDefault();break}case O.a.RIGHT:{Pe&&!J.includes(Q)?te.onNodeExpand({},je):Te.children&&Te.children.length&&te.onActiveChange(Te.children[0].data.key),ee.preventDefault();break}case O.a.ENTER:case O.a.SPACE:{we&&!je.disabled&&je.checkable!==!1&&!je.disableCheckbox?te.onNodeCheck({},je,!he.includes(Q)):!we&&Me&&!je.disabled&&je.selectable!==!1&&te.onNodeSelect({},je);break}}}De&&De(ee)},te.setUncontrolledState=function(ee){var se=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Q=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null;if(te.destroyed)return;var J=!1,he=!0,Ce={};Object.keys(ee).forEach(function(De){if(De in te.props){he=!1;return}J=!0,Ce[De]=ee[De]}),J&&(!se||he)&&te.setState(Object(G.a)(Object(G.a)({},Ce),Q))},te.scrollTo=function(ee){te.listRef.current.scrollTo(ee)},te}return Object(k.a)(pe,[{key:"componentWillUnmount",value:function(){this.destroyed=!0}},{key:"render",value:function(){var ee,se=this.state,Q=se.focused,J=se.flattenNodes,he=se.keyEntities,Ce=se.dragging,De=se.activeKey,we=this.props,Me=we.prefixCls,Te=we.className,_e=we.style,Pe=we.showLine,je=we.focusable,Qe=we.tabIndex,Ie=Qe===void 0?0:Qe,Ae=we.selectable,et=we.showIcon,qe=we.icon,lt=we.switcherIcon,$e=we.draggable,ft=we.checkable,ut=we.checkStrictly,st=we.disabled,Se=we.motion,Et=we.loadData,dt=we.filterTreeNode,Re=we.height,He=we.itemHeight,me=we.virtual,le=we.titleRender,de=we.onContextMenu,Y=Object(S.f)(this.props);return M.createElement(R.a.Provider,{value:{prefixCls:Me,selectable:Ae,showIcon:et,icon:qe,switcherIcon:lt,draggable:$e,checkable:ft,checkStrictly:ut,disabled:st,keyEntities:he,loadData:Et,filterTreeNode:dt,titleRender:le,onNodeClick:this.onNodeClick,onNodeDoubleClick:this.onNodeDoubleClick,onNodeExpand:this.onNodeExpand,onNodeSelect:this.onNodeSelect,onNodeCheck:this.onNodeCheck,onNodeLoad:this.onNodeLoad,onNodeMouseEnter:this.onNodeMouseEnter,onNodeMouseLeave:this.onNodeMouseLeave,onNodeContextMenu:this.onNodeContextMenu,onNodeDragStart:this.onNodeDragStart,onNodeDragEnter:this.onNodeDragEnter,onNodeDragOver:this.onNodeDragOver,onNodeDragLeave:this.onNodeDragLeave,onNodeDragEnd:this.onNodeDragEnd,onNodeDrop:this.onNodeDrop}},M.createElement("div",{className:C()(Me,Te,(ee={},Object(ne.a)(ee,"".concat(Me,"-show-line"),Pe),Object(ne.a)(ee,"".concat(Me,"-focused"),Q),Object(ne.a)(ee,"".concat(Me,"-active-focused"),De!==null),ee))},M.createElement(B,Object.assign({ref:this.listRef,prefixCls:Me,style:_e,data:J,disabled:st,selectable:Ae,checkable:!!ft,motion:Se,dragging:Ce,height:Re,itemHeight:He,virtual:me,focusable:je,focused:Q,tabIndex:Ie,activeItem:this.getActiveItem(),onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.onKeyDown,onActiveChange:this.onActiveChange,onListChangeStart:this.onListChangeStart,onListChangeEnd:this.onListChangeEnd,onContextMenu:de},this.getTreeNodeRequiredProps(),Y))))}}],[{key:"getDerivedStateFromProps",value:function(ee,se){var Q=se.prevProps,J={prevProps:ee};function he(qe){return!Q&&qe in ee||Q&&Q[qe]!==ee[qe]}var Ce;if(he("treeData")?Ce=ee.treeData:he("children")&&(Object(A.a)(!1,"`children` of Tree is deprecated. Please use `treeData` instead."),Ce=Object(b.c)(ee.children)),Ce){J.treeData=Ce;var De=Object(b.a)(Ce);J.keyEntities=Object(G.a)(Object(ne.a)({},s,g),De.keyEntities)}var we=J.keyEntities||se.keyEntities;if(he("expandedKeys")||Q&&he("autoExpandParent"))J.expandedKeys=ee.autoExpandParent||!Q&&ee.defaultExpandParent?Object(S.e)(ee.expandedKeys,we):ee.expandedKeys;else if(!Q&&ee.defaultExpandAll){var Me=Object(G.a)({},we);delete Me[s],J.expandedKeys=Object.keys(Me).map(function(qe){return Me[qe].key})}else!Q&&ee.defaultExpandedKeys&&(J.expandedKeys=ee.autoExpandParent||ee.defaultExpandParent?Object(S.e)(ee.defaultExpandedKeys,we):ee.defaultExpandedKeys);if(J.expandedKeys||delete J.expandedKeys,Ce||J.expandedKeys){var Te=Object(b.d)(Ce||se.treeData,J.expandedKeys||se.expandedKeys);J.flattenNodes=Te}if(ee.selectable&&(he("selectedKeys")?J.selectedKeys=Object(S.d)(ee.selectedKeys,ee):!Q&&ee.defaultSelectedKeys&&(J.selectedKeys=Object(S.d)(ee.defaultSelectedKeys,ee))),ee.checkable){var _e;if(he("checkedKeys")?_e=Object(S.j)(ee.checkedKeys)||{}:!Q&&ee.defaultCheckedKeys?_e=Object(S.j)(ee.defaultCheckedKeys)||{}:Ce&&(_e=Object(S.j)(ee.checkedKeys)||{checkedKeys:se.checkedKeys,halfCheckedKeys:se.halfCheckedKeys}),_e){var Pe=_e,je=Pe.checkedKeys,Qe=je===void 0?[]:je,Ie=Pe.halfCheckedKeys,Ae=Ie===void 0?[]:Ie;if(!ee.checkStrictly){var et=Object(I.a)(Qe,!0,we);Qe=et.checkedKeys,Ae=et.halfCheckedKeys}J.checkedKeys=Qe,J.halfCheckedKeys=Ae}}return he("loadedKeys")&&(J.loadedKeys=ee.loadedKeys),J}}]),pe}(M.Component);$.defaultProps={prefixCls:"rc-tree",showLine:!1,showIcon:!0,selectable:!0,multiple:!1,checkable:!1,disabled:!1,checkStrictly:!1,draggable:!1,defaultExpandParent:!0,autoExpandParent:!1,defaultExpandAll:!1,defaultExpandedKeys:[],defaultCheckedKeys:[],defaultSelectedKeys:[]},$.TreeNode=c.a;var ie=$,ue=Be.b=ie},k4n4:function(Je,Be,H){"use strict";var ne=H("tJVT"),G=H("cDcd"),D=H.n(G),K=H("e+RI"),k=H.n(K),P=H("FTkQ"),N=H.n(P),M=H("E/GV"),O=H.n(M),A=function(C){var R=C.type,S=R===void 0?1:R,b=C.value,x=b===void 0?[]:b,f=C.onChange,l=C.disabled,i=l===void 0?!1:l,c=C.icon,_=Object(G.useState)(),v=Object(ne.a)(_,2),m=v[0],u=v[1],y=function(h){f(h)};return S===1?D.a.createElement("div",null,x==null?void 0:x.map(function(d,h){return D.a.createElement("div",{key:h,className:i?"".concat(k.a.btn," ").concat(k.a.btnDisabled):k.a.btn},D.a.createElement("span",{className:k.a.s1},d.name),D.a.createElement("img",{src:N.a,className:k.a.s2,onClick:function(){return y(d.id)}}))})):D.a.createElement("div",null,x==null?void 0:x.map(function(d,h){return D.a.createElement("div",{key:h,className:k.a.btn2},D.a.createElement("span",{className:k.a.s1},D.a.createElement("img",{src:c||O.a}),d.name),D.a.createElement("img",{src:N.a,className:k.a.s2,onClick:function(){return y(d.id)}}))}))};Be.a=A},kSUc:function(Je,Be,H){},kqOp:function(Je,Be,H){"use strict";H.d(Be,"a",function(){return A});var ne=H("0Owb"),G=H("fWQN"),D=H("mtLc"),K=H("yKVA"),k=H("879j"),P=H("cDcd"),N=H.n(P),M=H("Ot1p"),O="\u2581",A=function(T){Object(K.a)(R,T);var C=Object(k.a)(R);function R(){var S;Object(G.a)(this,R);for(var b=arguments.length,x=new Array(b),f=0;f` "'(~:]+/,b=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,x=/^\s*\[[^\]]+?\]:.*$/,f=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,l=" ";function i(B,I,$){return I.f=I.inline=$,$(B,I)}function c(B,I,$){return I.f=I.block=$,$(B,I)}function _(B){return!B||!/\S/.test(B.string)}function v(B){if(B.linkTitle=!1,B.linkHref=!1,B.linkText=!1,B.em=!1,B.strong=!1,B.strikethrough=!1,B.quote=0,B.indentedCode=!1,B.f==u){var I=k;if(!I){var $=ne.innerMode(K,B.htmlState);I=$.mode.name=="xml"&&$.state.tagStart===null&&!$.state.context&&$.state.tokenize.isInText}I&&(B.f=s,B.block=m,B.htmlState=null)}return B.trailingSpace=0,B.trailingSpaceNewLine=!1,B.prevLine=B.thisLine,B.thisLine={stream:null},null}function m(B,I){var $=B.column()===I.indentation,ie=_(I.prevLine.stream),ue=I.indentedCode,fe=I.prevLine.hr,ve=I.list!==!1,pe=(I.listStack[I.listStack.length-1]||0)+3;I.indentedCode=!1;var te=I.indentation;if(I.indentationDiff===null&&(I.indentationDiff=I.indentation,ve)){for(I.list=null;te=4&&(ue||I.prevLine.fencedCodeEnd||I.prevLine.header||ie))return B.skipToEnd(),I.indentedCode=!0,N.code;if(B.eatSpace())return null;if($&&I.indentation<=pe&&(Q=B.match(C))&&Q[1].length<=6)return I.quote=0,I.header=Q[1].length,I.thisLine.header=!0,D.highlightFormatting&&(I.formatting="header"),I.f=I.inline,d(I);if(I.indentation<=pe&&B.eat(">"))return I.quote=$?1:I.quote+1,D.highlightFormatting&&(I.formatting="quote"),B.eatSpace(),d(I);if(!se&&!I.setext&&$&&I.indentation<=pe&&(Q=B.match(A))){var J=Q[1]?"ol":"ul";return I.indentation=te+B.current().length,I.list=!0,I.quote=0,I.listStack.push(I.indentation),I.em=!1,I.strong=!1,I.code=!1,I.strikethrough=!1,D.taskLists&&B.match(T,!1)&&(I.taskList=!0),I.f=I.inline,D.highlightFormatting&&(I.formatting=["list","list-"+J]),d(I)}else{if($&&I.indentation<=pe&&(Q=B.match(b,!0)))return I.quote=0,I.fencedEndRE=new RegExp(Q[1]+"+ *$"),I.localMode=D.fencedCodeBlockHighlighting&&P(Q[2]||D.fencedCodeBlockDefaultMode),I.localMode&&(I.localState=ne.startState(I.localMode)),I.f=I.block=y,D.highlightFormatting&&(I.formatting="code-block"),I.code=-1,d(I);if(I.setext||(!ee||!ve)&&!I.quote&&I.list===!1&&!I.code&&!se&&!x.test(B.string)&&(Q=B.lookAhead(1))&&(Q=Q.match(R)))return I.setext?(I.header=I.setext,I.setext=0,B.skipToEnd(),D.highlightFormatting&&(I.formatting="header")):(I.header=Q[0].charAt(0)=="="?1:2,I.setext=I.header),I.thisLine.header=!0,I.f=I.inline,d(I);if(se)return B.skipToEnd(),I.hr=!0,I.thisLine.hr=!0,N.hr;if(B.peek()==="[")return i(B,I,L)}return i(B,I,I.inline)}function u(B,I){var $=K.token(B,I.htmlState);if(!k){var ie=ne.innerMode(K,I.htmlState);(ie.mode.name=="xml"&&ie.state.tagStart===null&&!ie.state.context&&ie.state.tokenize.isInText||I.md_inside&&B.current().indexOf(">")>-1)&&(I.f=s,I.block=m,I.htmlState=null)}return $}function y(B,I){var $=I.listStack[I.listStack.length-1]||0,ie=I.indentation<$,ue=$+3;if(I.fencedEndRE&&I.indentation<=ue&&(ie||B.match(I.fencedEndRE))){D.highlightFormatting&&(I.formatting="code-block");var fe;return ie||(fe=d(I)),I.localMode=I.localState=null,I.block=m,I.f=s,I.fencedEndRE=null,I.code=0,I.thisLine.fencedCodeEnd=!0,ie?c(B,I,I.block):fe}else return I.localMode?I.localMode.token(B,I.localState):(B.skipToEnd(),N.code)}function d(B){var I=[];if(B.formatting){I.push(N.formatting),typeof B.formatting=="string"&&(B.formatting=[B.formatting]);for(var $=0;$=B.quote?I.push(N.formatting+"-"+B.formatting[$]+"-"+B.quote):I.push("error"))}if(B.taskOpen)return I.push("meta"),I.length?I.join(" "):null;if(B.taskClosed)return I.push("property"),I.length?I.join(" "):null;if(B.linkHref?I.push(N.linkHref,"url"):(B.strong&&I.push(N.strong),B.em&&I.push(N.em),B.strikethrough&&I.push(N.strikethrough),B.emoji&&I.push(N.emoji),B.linkText&&I.push(N.linkText),B.code&&I.push(N.code),B.image&&I.push(N.image),B.imageAltText&&I.push(N.imageAltText,"link"),B.imageMarker&&I.push(N.imageMarker)),B.header&&I.push(N.header,N.header+"-"+B.header),B.quote&&(I.push(N.quote),!D.maxBlockquoteDepth||D.maxBlockquoteDepth>=B.quote?I.push(N.quote+"-"+B.quote):I.push(N.quote+"-"+D.maxBlockquoteDepth)),B.list!==!1){var ie=(B.listStack.length-1)%3;ie?ie===1?I.push(N.list2):I.push(N.list3):I.push(N.list1)}return B.trailingSpaceNewLine?I.push("trailing-space-new-line"):B.trailingSpace&&I.push("trailing-space-"+(B.trailingSpace%2?"a":"b")),I.length?I.join(" "):null}function h(B,I){return B.match(S,!0)?d(I):void 0}function s(B,I){var $=I.text(B,I);if(typeof $!="undefined")return $;if(I.list)return I.list=null,d(I);if(I.taskList){var ie=B.match(T,!0)[1]===" ";return ie?I.taskOpen=!0:I.taskClosed=!0,D.highlightFormatting&&(I.formatting="task"),I.taskList=!1,d(I)}if(I.taskOpen=!1,I.taskClosed=!1,I.header&&B.match(/^#+$/,!0))return D.highlightFormatting&&(I.formatting="header"),d(I);var ue=B.next();if(I.linkTitle){I.linkTitle=!1;var fe=ue;ue==="("&&(fe=")"),fe=(fe+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var ve="^\\s*(?:[^"+fe+"\\\\]+|\\\\\\\\|\\\\.)"+fe;if(B.match(new RegExp(ve),!0))return N.linkHref}if(ue==="`"){var pe=I.formatting;D.highlightFormatting&&(I.formatting="code"),B.eatWhile("`");var te=B.current().length;if(I.code==0&&(!I.quote||te==1))return I.code=te,d(I);if(te==I.code){var ee=d(I);return I.code=0,ee}else return I.formatting=pe,d(I)}else if(I.code)return d(I);if(ue==="\\"&&(B.next(),D.highlightFormatting)){var se=d(I),Q=N.formatting+"-escape";return se?se+" "+Q:Q}if(ue==="!"&&B.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return I.imageMarker=!0,I.image=!0,D.highlightFormatting&&(I.formatting="image"),d(I);if(ue==="["&&I.imageMarker&&B.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return I.imageMarker=!1,I.imageAltText=!0,D.highlightFormatting&&(I.formatting="image"),d(I);if(ue==="]"&&I.imageAltText){D.highlightFormatting&&(I.formatting="image");var se=d(I);return I.imageAltText=!1,I.image=!1,I.inline=I.f=g,se}if(ue==="["&&!I.image)return I.linkText&&B.match(/^.*?\]/)||(I.linkText=!0,D.highlightFormatting&&(I.formatting="link")),d(I);if(ue==="]"&&I.linkText){D.highlightFormatting&&(I.formatting="link");var se=d(I);return I.linkText=!1,I.inline=I.f=B.match(/\(.*?\)| ?\[.*?\]/,!1)?g:s,se}if(ue==="<"&&B.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){I.f=I.inline=o,D.highlightFormatting&&(I.formatting="link");var se=d(I);return se?se+=" ":se="",se+N.linkInline}if(ue==="<"&&B.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){I.f=I.inline=o,D.highlightFormatting&&(I.formatting="link");var se=d(I);return se?se+=" ":se="",se+N.linkEmail}if(D.xml&&ue==="<"&&B.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var J=B.string.indexOf(">",B.pos);if(J!=-1){var he=B.string.substring(B.start,J);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(he)&&(I.md_inside=!0)}return B.backUp(1),I.htmlState=ne.startState(K),c(B,I,u)}if(D.xml&&ue==="<"&&B.match(/^\/\w*?>/))return I.md_inside=!1,"tag";if(ue==="*"||ue==="_"){for(var Ce=1,De=B.pos==1?" ":B.string.charAt(B.pos-2);Ce<3&&B.eat(ue);)Ce++;var we=B.peek()||" ",Me=!/\s/.test(we)&&(!f.test(we)||/\s/.test(De)||f.test(De)),Te=!/\s/.test(De)&&(!f.test(De)||/\s/.test(we)||f.test(we)),_e=null,Pe=null;if(Ce%2&&(!I.em&&Me&&(ue==="*"||!Te||f.test(De))?_e=!0:I.em==ue&&Te&&(ue==="*"||!Me||f.test(we))&&(_e=!1)),Ce>1&&(!I.strong&&Me&&(ue==="*"||!Te||f.test(De))?Pe=!0:I.strong==ue&&Te&&(ue==="*"||!Me||f.test(we))&&(Pe=!1)),Pe!=null||_e!=null){D.highlightFormatting&&(I.formatting=_e==null?"strong":Pe==null?"em":"strong em"),_e===!0&&(I.em=ue),Pe===!0&&(I.strong=ue);var ee=d(I);return _e===!1&&(I.em=!1),Pe===!1&&(I.strong=!1),ee}}else if(ue===" "&&(B.eat("*")||B.eat("_"))){if(B.peek()===" ")return d(I);B.backUp(1)}if(D.strikethrough){if(ue==="~"&&B.eatWhile(ue)){if(I.strikethrough){D.highlightFormatting&&(I.formatting="strikethrough");var ee=d(I);return I.strikethrough=!1,ee}else if(B.match(/^[^\s]/,!1))return I.strikethrough=!0,D.highlightFormatting&&(I.formatting="strikethrough"),d(I)}else if(ue===" "&&B.match(/^~~/,!0)){if(B.peek()===" ")return d(I);B.backUp(2)}}if(D.emoji&&ue===":"&&B.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){I.emoji=!0,D.highlightFormatting&&(I.formatting="emoji");var je=d(I);return I.emoji=!1,je}return ue===" "&&(B.match(/^ +$/,!1)?I.trailingSpace++:I.trailingSpace&&(I.trailingSpaceNewLine=!0)),d(I)}function o(B,I){var $=B.next();if($===">"){I.f=I.inline=s,D.highlightFormatting&&(I.formatting="link");var ie=d(I);return ie?ie+=" ":ie="",ie+N.linkInline}return B.match(/^[^>]+/,!0),N.linkInline}function g(B,I){if(B.eatSpace())return null;var $=B.next();return $==="("||$==="["?(I.f=I.inline=E($==="("?")":"]"),D.highlightFormatting&&(I.formatting="link-string"),I.linkHref=!0,d(I)):"error"}var p={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function E(B){return function(I,$){var ie=I.next();if(ie===B){$.f=$.inline=s,D.highlightFormatting&&($.formatting="link-string");var ue=d($);return $.linkHref=!1,ue}return I.match(p[B]),$.linkHref=!0,d($)}}function L(B,I){return B.match(/^([^\]\\]|\\.)*\]:/,!1)?(I.f=F,B.next(),D.highlightFormatting&&(I.formatting="link"),I.linkText=!0,d(I)):i(B,I,s)}function F(B,I){if(B.match(/^\]:/,!0)){I.f=I.inline=j,D.highlightFormatting&&(I.formatting="link");var $=d(I);return I.linkText=!1,$}return B.match(/^([^\]\\]|\\.)+/,!0),N.linkText}function j(B,I){return B.eatSpace()?null:(B.match(/^[^\s]+/,!0),B.peek()===void 0?I.linkTitle=!0:B.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),I.f=I.inline=s,N.linkHref+" url")}var V={startState:function(){return{f:m,prevLine:{stream:null},thisLine:{stream:null},block:m,htmlState:null,indentation:0,inline:s,text:h,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(B){return{f:B.f,prevLine:B.prevLine,thisLine:B.thisLine,block:B.block,htmlState:B.htmlState&&ne.copyState(K,B.htmlState),indentation:B.indentation,localMode:B.localMode,localState:B.localMode?ne.copyState(B.localMode,B.localState):null,inline:B.inline,text:B.text,formatting:!1,linkText:B.linkText,linkTitle:B.linkTitle,linkHref:B.linkHref,code:B.code,em:B.em,strong:B.strong,strikethrough:B.strikethrough,emoji:B.emoji,header:B.header,setext:B.setext,hr:B.hr,taskList:B.taskList,list:B.list,listStack:B.listStack.slice(0),quote:B.quote,indentedCode:B.indentedCode,trailingSpace:B.trailingSpace,trailingSpaceNewLine:B.trailingSpaceNewLine,md_inside:B.md_inside,fencedEndRE:B.fencedEndRE}},token:function(B,I){if(I.formatting=!1,B!=I.thisLine.stream){if(I.header=0,I.hr=!1,B.match(/^\s*$/,!0))return v(I),null;if(I.prevLine=I.thisLine,I.thisLine={stream:B},I.taskList=!1,I.trailingSpace=0,I.trailingSpaceNewLine=!1,!I.localState&&(I.f=I.block,I.f!=u)){var $=B.match(/^\s*/,!0)[0].replace(/\t/g,l).length;if(I.indentation=$,I.indentationDiff=null,$>0)return null}}return I.f(B,I)},innerMode:function(B){return B.block==u?{state:B.htmlState,mode:K}:B.localState?{state:B.localState,mode:B.localMode}:{state:B,mode:V}},indent:function(B,I,$){return B.block==u&&K.indent?K.indent(B.htmlState,I,$):B.localState&&B.localMode.indent?B.localMode.indent(B.localState,I,$):ne.Pass},blankLine:v,getType:d,blockCommentStart:"",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return V},"xml"),ne.defineMIME("text/markdown","markdown"),ne.defineMIME("text/x-markdown","markdown")})},lnNo:function(Je,Be,H){Je.exports=H.p+"static/up.69f3b3fd.svg"},m3fD:function(Je,Be,H){Je.exports={flex_box_center:"flex_box_center___1w3aZ",flex_space_between:"flex_space_between___26eB1",flex_box_vertical_center:"flex_box_vertical_center___LffUi",flex_box_center_end:"flex_box_center_end___2AiD3",flex_box_column:"flex_box_column___hZDm1",wrap:"wrap___3Du1e",btns:"btns___35pkF",crumbs:"crumbs___3CPsi",oneWrap:"oneWrap___3F99r",title:"title___2n1na",formWrap:"formWrap___3CHwR",rb:"rb___19sZ1"}},osHv:function(Je,Be,H){(function(ne){ne(H("VrN/"))})(function(ne){"use strict";var G=ne.Pos;function D(f,l){return f.line-l.line||f.ch-l.ch}var K="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",k=K+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",P=new RegExp("<(/?)(["+K+"]["+k+"]*)","g");function N(f,l,i,c){this.line=l,this.ch=i,this.cm=f,this.text=f.getLine(l),this.min=c?Math.max(c.from,f.firstLine()):f.firstLine(),this.max=c?Math.min(c.to-1,f.lastLine()):f.lastLine()}function M(f,l){var i=f.cm.getTokenTypeAt(G(f.line,l));return i&&/\btag\b/.test(i)}function O(f){return f.line>=f.max?void 0:(f.ch=0,f.text=f.cm.getLine(++f.line),!0)}function A(f){return f.line<=f.min?void 0:(f.text=f.cm.getLine(--f.line),f.ch=f.text.length,!0)}function T(f){for(;;){var l=f.text.indexOf(">",f.ch);if(l==-1){if(O(f))continue;return}if(!M(f,l+1)){f.ch=l+1;continue}var i=f.text.lastIndexOf("/",l),c=i>-1&&!/\S/.test(f.text.slice(i+1,l));return f.ch=l+1,c?"selfClose":"regular"}}function C(f){for(;;){var l=f.ch?f.text.lastIndexOf("<",f.ch-1):-1;if(l==-1){if(A(f))continue;return}if(!M(f,l+1)){f.ch=l;continue}P.lastIndex=l,f.ch=l;var i=P.exec(f.text);if(i&&i.index==l)return i}}function R(f){for(;;){P.lastIndex=f.ch;var l=P.exec(f.text);if(!l){if(O(f))continue;return}if(!M(f,l.index+1)){f.ch=l.index+1;continue}return f.ch=l.index+l[0].length,l}}function S(f){for(;;){var l=f.ch?f.text.lastIndexOf(">",f.ch-1):-1;if(l==-1){if(A(f))continue;return}if(!M(f,l+1)){f.ch=l;continue}var i=f.text.lastIndexOf("/",l),c=i>-1&&!/\S/.test(f.text.slice(i+1,l));return f.ch=l+1,c?"selfClose":"regular"}}function b(f,l){for(var i=[];;){var c=R(f),_,v=f.line,m=f.ch-(c?c[0].length:0);if(!c||!(_=T(f)))return;if(_=="selfClose")continue;if(c[1]){for(var u=i.length-1;u>=0;--u)if(i[u]==c[2]){i.length=u;break}if(u<0&&(!l||l==c[2]))return{tag:c[2],from:G(v,m),to:G(f.line,f.ch)}}else i.push(c[2])}}function x(f,l){for(var i=[];;){var c=S(f);if(!c)return;if(c=="selfClose"){C(f);continue}var _=f.line,v=f.ch,m=C(f);if(!m)return;if(m[1])i.push(m[2]);else{for(var u=i.length-1;u>=0;--u)if(i[u]==m[2]){i.length=u;break}if(u<0&&(!l||l==m[2]))return{tag:m[2],from:G(f.line,f.ch),to:G(_,v)}}}}ne.registerHelper("fold","xml",function(f,l){for(var i=new N(f,l.line,0);;){var c=R(i);if(!c||i.line!=l.line)return;var _=T(i);if(!_)return;if(!c[1]&&_!="selfClose"){var v=G(i.line,i.ch),m=b(i,c[2]);return m&&D(m.from,v)>0?{from:v,to:m.from}:null}}}),ne.findMatchingTag=function(f,l,i){var c=new N(f,l.line,l.ch,i);if(c.text.indexOf(">")==-1&&c.text.indexOf("<")==-1)return;var _=T(c),v=_&&G(c.line,c.ch),m=_&&C(c);if(!_||!m||D(c,l)>0)return;var u={from:G(c.line,c.ch),to:v,tag:m[2]};return _=="selfClose"?{open:u,close:null,at:"open"}:m[1]?{open:x(c,m[2]),close:u,at:"close"}:(c=new N(f,v.line,v.ch,i),{open:u,close:b(c,m[2]),at:"open"})},ne.findEnclosingTag=function(f,l,i,c){for(var _=new N(f,l.line,l.ch,i);;){var v=x(_,c);if(!v)break;var m=new N(f,l.line,l.ch,i),u=b(m,v.tag);if(u)return{open:v,close:u}}},ne.scanForClosingTag=function(f,l,i,c){var _=new N(f,l.line,l.ch,c?{from:0,to:c}:null);return b(_,i)}})},"p77/":function(Je,Be,H){},rUJ1:function(Je,Be){const H=/[&<>"']/,ne=/[&<>"']/g,G=/[<>"']|&(?!#?\w+;)/,D=/[<>"']|&(?!#?\w+;)/g,K={"&":"&","<":"<",">":">",'"':""","'":"'"},k=y=>K[y];function P(y,d){if(d){if(H.test(y))return y.replace(ne,k)}else if(G.test(y))return y.replace(D,k);return y}const N=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function M(y){return y.replace(N,(d,h)=>(h=h.toLowerCase(),h==="colon"?":":h.charAt(0)==="#"?h.charAt(1)==="x"?String.fromCharCode(parseInt(h.substring(2),16)):String.fromCharCode(+h.substring(1)):""))}const O=/(^|[^\[])\^/g;function A(y,d){y=y.source||y,d=d||"";const h={replace:(s,o)=>(o=o.source||o,o=o.replace(O,"$1"),y=y.replace(s,o),h),getRegex:()=>new RegExp(y,d)};return h}const T=/[^\w:]/g,C=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function R(y,d,h){if(y){let s;try{s=decodeURIComponent(M(h)).replace(T,"").toLowerCase()}catch(o){return null}if(s.indexOf("javascript:")===0||s.indexOf("vbscript:")===0||s.indexOf("data:")===0)return null}d&&!C.test(h)&&(h=l(d,h));try{h=encodeURI(h).replace(/%25/g,"%")}catch(s){return null}return h}const S={},b=/^[^:]+:\/*[^/]*$/,x=/^([^:]+:)[\s\S]*$/,f=/^([^:]+:\/*[^/]*)[\s\S]*$/;function l(y,d){S[" "+y]||(b.test(y)?S[" "+y]=y+"/":S[" "+y]=v(y,"/",!0)),y=S[" "+y];const h=y.indexOf(":")===-1;return d.substring(0,2)==="//"?h?d:y.replace(x,"$1")+d:d.charAt(0)==="/"?h?d:y.replace(f,"$1")+d:y+d}const i={exec:function(){}};function c(y){let d=1,h,s;for(;d{let L=!1,F=p;for(;--F>=0&&E[F]==="\\";)L=!L;return L?"|":" |"}),s=h.split(/ \|/);let o=0;if(s.length>d)s.splice(d);else for(;s.length20?(S.b.warn("\u586B\u7A7A\u9898\u6807\u51C6\u7B54\u6848\u4E0D\u80FD\u4E3A\u7A7A/\u4E0D\u80FD\u8D85\u8FC720\u4E2A\uFF01"),!1):{name:ht,analysis:Zt,standard_answers:Ht,is_ordered:Fe}):(S.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),!1)},rt=function(){Ut(""),At(""),Rt([]),Jt(!1)},Ne=function(Ht,wt,Sn){var Ge=Pt.slice();if(wt&&Ge.splice(Ht,wt),Sn)for(var sn=0;sn1&&u.a.createElement("span",null,u.a.createElement(ue.a,{checked:Fe,onChange:function(Ht){return Jt(Ht.target.checked)},className:"".concat(J.a.color333," font14")},"\u591A\u4E2A\u586B\u7A7A\u7684\u7B54\u6848\u6709\u987A\u5E8F\u8981\u6C42"),u.a.createElement("span",{className:"".concat(J.a.color999," font12")},"\uFF08\u9009\u4E2D\uFF0C\u6BCF\u4E2A\u586B\u7A7A\u7684\u7B54\u6848\u987A\u5E8F\u5FC5\u987B\u4E0E\u53C2\u8003\u7B54\u6848\u4E00\u81F4\uFF09"))),u.a.createElement("p",{className:J.a.titleWrap},u.a.createElement("span",{className:J.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),u.a.createElement(pe.a,{id:"single-question-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:Zt,onChange:function(Ht){return At(Ht)}}))},De=Object(p.a)(function(Z){var q=Z.loading,ae=Z.globalSetting;return{globalSetting:ae,loading:q.effects}},null,null,{forwardRef:!0})(Object(m.forwardRef)(Ce)),we=H("7Kak"),Me=H("9yH6"),Te=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],_e=function(q,ae){var re=q.globalSetting,Ee=q.loading,xe=q.editData,Ve=q.dispatch,Le=q.onRef,We=Le===void 0?function(){}:Le,Ot=q.isEdit,Ze=Object(ve.a)(q,["globalSetting","loading","editData","dispatch","onRef","isEdit"]),ht=Object(m.useState)(),Ut=Object(c.a)(ht,2),Ke=Ut[0],It=Ut[1],Zt=Object(m.useState)(""),At=Object(c.a)(Zt,2),Yt=At[0],Kt=At[1],Pt=Object(m.useState)(""),Rt=Object(c.a)(Pt,2),pt=Rt[0],Mt=Rt[1];Object(m.useEffect)(function(){if(!xe||!Ot)return;Kt(xe==null?void 0:xe.name),Mt(xe==null?void 0:xe.analysis);var bt=xe==null?void 0:xe.choices.find(function(tt){return tt.is_answer});It(bt.choice_text==="\u6B63\u786E"?"0":"1")},[xe]),Object(m.useImperativeHandle)(ae,function(){return{onSave:_t,Clear:Tt}});var _t=function(){if(!Yt)return S.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),!1;if(!Ke)return S.b.info("\u8BF7\u5148\u70B9\u51FB\u9009\u62E9\u672C\u9009\u62E9\u9898\u7684\u6B63\u786E\u9009\u9879"),!1;var tt=[{choice_text:"\u6B63\u786E",is_answer:Ke==="0"?1:0},{choice_text:"\u9519\u8BEF",is_answer:Ke==="1"?1:0}];return{name:Yt,choices:tt,analysis:pt}},Tt=function(){Kt(""),Mt(""),It("")};return u.a.createElement("section",{className:J.a.wrap},u.a.createElement("p",{className:J.a.titleWrap},u.a.createElement("span",{className:J.a.required},"*"),u.a.createElement("span",{className:J.a.title},"\u9898\u5E72\uFF1A")),u.a.createElement(pe.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:Yt,onChange:function(tt){return Kt(tt)}}),u.a.createElement("p",{className:J.a.titleWrap},u.a.createElement("span",{className:J.a.required},"*"),u.a.createElement("span",{className:J.a.title},"\u7B54\u6848\u9009\u9879\uFF1A",u.a.createElement("span",{className:J.a.colorGray},"\u70B9\u51FB\u9009\u9879\u53EF\u8BBE\u7F6E\u6B63\u786E\u7B54\u6848"))),u.a.createElement(Me.a.Group,{buttonStyle:"solid",value:Ke,onChange:function(tt){return It(tt.target.value)}},u.a.createElement(Me.a.Button,{value:"0",className:"".concat(J.a.radio," mr40")},"\u6B63\u786E"),u.a.createElement(Me.a.Button,{value:"1",className:J.a.radio},"\u9519\u8BEF")),u.a.createElement("p",{className:J.a.titleWrap},u.a.createElement("span",{className:J.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),u.a.createElement(pe.a,{id:"single-question-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:pt,onChange:function(tt){return Mt(tt)}}))},Pe=Object(p.a)(function(Z){var q=Z.loading,ae=Z.globalSetting;return{globalSetting:ae,loading:q.effects}},null,null,{forwardRef:!0})(Object(m.forwardRef)(_e)),je=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],Qe=function(q,ae){var re=q.editData,Ee=q.globalSetting,xe=q.loading,Ve=q.dispatch,Le=q.onRef,We=Le===void 0?function(){}:Le,Ot=q.isEdit,Ze=Object(ve.a)(q,["editData","globalSetting","loading","dispatch","onRef","isEdit"]),ht=Object(m.useState)([]),Ut=Object(c.a)(ht,2),Ke=Ut[0],It=Ut[1],Zt=Object(m.useState)(),At=Object(c.a)(Zt,2),Yt=At[0],Kt=At[1],Pt=Object(m.useState)([]),Rt=Object(c.a)(Pt,2),pt=Rt[0],Mt=Rt[1],_t=Object(m.useState)(""),Tt=Object(c.a)(_t,2),bt=Tt[0],tt=Tt[1],Fe=Object(m.useState)(""),Jt=Object(c.a)(Fe,2),Wt=Jt[0],qt=Jt[1];Object(m.useEffect)(function(){It(["","","",""])},[]),Object(m.useEffect)(function(){if(!re||!Ot)return;tt(re==null?void 0:re.name),qt(re==null?void 0:re.analysis),It(re==null?void 0:re.choices.map(function(rt){return rt.choice_text}));var $t=[];re==null||re.choices.map(function(rt,Ne){rt.is_answer&&$t.push(Ne)}),Mt($t)},[re]),Object(m.useImperativeHandle)(ae,function(){return{onSave:Vt,Clear:un}});var Vt=function(){if(!bt)return S.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),!1;var rt=Ke.findIndex(function(vt){return!vt});if(rt>-1)return S.b.info("\u8BF7\u5148\u8F93\u5165 ".concat(je[rt]," \u9009\u9879\u7684\u5185\u5BB9")),!1;if(!pt.length)return S.b.info("\u8BF7\u8BBE\u7F6E\u672C\u9898\u7684\u6B63\u786E\u7B54\u6848\uFF0C\u70B9\u51FB\u9009\u9879A/B...\u5373\u53EF\u5B8C\u6210\u8BBE\u7F6E"),!1;if(pt.length<2)return S.b.info("\u591A\u9009\u9898\u6700\u5C0F\u6B63\u786E\u9009\u9879\u4E3A2\u4E2A"),!1;var Ne=Ke.map(function(vt,In){return{choice_text:vt,is_answer:pt.includes(In)?1:0}});return{name:bt,choices:Ne,analysis:Wt}},un=function(){It(["","","",""]),tt(""),qt(""),Mt("")};return u.a.createElement("section",{className:J.a.wrap},u.a.createElement("p",{className:J.a.titleWrap},u.a.createElement("span",{className:J.a.required},"*"),u.a.createElement("span",{className:J.a.title},"\u9898\u5E72\uFF1A")),u.a.createElement(pe.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:bt,onChange:function(rt){return tt(rt)}}),u.a.createElement("p",{className:J.a.titleWrap},u.a.createElement("span",{className:J.a.required},"*"),u.a.createElement("span",{className:J.a.title},"\u7B54\u6848\u9009\u9879\uFF1A",u.a.createElement("span",{className:J.a.colorGray},"\u70B9\u51FB\u9009\u9879\u53EF\u8BBE\u7F6E\u6B63\u786E\u7B54\u6848"))),Ke.map(function($t,rt){return u.a.createElement("div",{className:J.a.choiceWrap,key:rt},u.a.createElement(K.a,{title:"\u70B9\u51FB\u8BBE\u7F6E\u4E3A\u6807\u51C6\u7B54\u6848",placement:"left"},u.a.createElement("div",{className:"".concat(J.a.answer," ").concat(pt.includes(rt)?J.a.activeAnswer:""),onClick:function(){pt.includes(rt)?Mt(pt.filter(function(vt){return vt!==rt})):Mt([].concat(Object(fe.a)(pt),[rt]))}},je[rt])),u.a.createElement("div",{className:J.a.editorWrap},Yt===rt?u.a.createElement(pe.a,{id:"single-question-option-".concat(rt),watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9009\u9879",defaultValue:$t,onChange:function(vt){Ke[rt]=vt,It(Ke)}}):u.a.createElement("div",{className:J.a.htmlWrap,onClick:function(){return Kt(rt)}},u.a.createElement(o.a,{value:$t}))),rt>1&&u.a.createElement(K.a,{title:"\u5220\u9664"},u.a.createElement("i",{className:"".concat(J.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){It(Ke.filter(function(vt,In){return In!==rt})),pt.includes(rt)?Mt(pt.filter(function(vt){return vt!==rt})):Mt([].concat(Object(fe.a)(pt),[rt]))}})),rt<7&&rt===Ke.length-1&&u.a.createElement(K.a,{title:"\u65B0\u589E\u53C2\u8003\u7B54\u6848"},u.a.createElement("i",{className:"".concat(J.a.addIcon," iconfont icon-roundaddfill ml6"),onClick:function(){return It([].concat(Object(fe.a)(Ke),[""]))}})))}),u.a.createElement("p",{className:J.a.titleWrap},u.a.createElement("span",{className:J.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),u.a.createElement(pe.a,{id:"single-question-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:Wt,onChange:function(rt){return qt(rt)}}))},Ie=Object(p.a)(function(Z){var q=Z.loading,ae=Z.globalSetting;return{globalSetting:ae,loading:q.effects}},null,null,{forwardRef:!0})(Object(m.forwardRef)(Qe)),Ae=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],et=function(q,ae){var re=q.editData,Ee=q.globalSetting,xe=q.loading,Ve=q.dispatch,Le=q.onRef,We=Le===void 0?function(){}:Le,Ot=q.isEdit,Ze=Object(ve.a)(q,["editData","globalSetting","loading","dispatch","onRef","isEdit"]),ht=Object(m.useState)([]),Ut=Object(c.a)(ht,2),Ke=Ut[0],It=Ut[1],Zt=Object(m.useState)(),At=Object(c.a)(Zt,2),Yt=At[0],Kt=At[1],Pt=Object(m.useState)(),Rt=Object(c.a)(Pt,2),pt=Rt[0],Mt=Rt[1],_t=Object(m.useState)(""),Tt=Object(c.a)(_t,2),bt=Tt[0],tt=Tt[1],Fe=Object(m.useState)(""),Jt=Object(c.a)(Fe,2),Wt=Jt[0],qt=Jt[1];Object(m.useEffect)(function(){It(["","","",""])},[]),Object(m.useEffect)(function(){if(!re||!Ot)return;tt(re==null?void 0:re.name),qt(re==null?void 0:re.analysis),It(re==null?void 0:re.choices.map(function($t){return $t.choice_text})),Mt(re==null?void 0:re.choices.findIndex(function($t){return $t.is_answer}))},[re]),Object(m.useImperativeHandle)(ae,function(){return{onSave:Vt,Clear:un}});var Vt=function(){if(!bt)return S.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),!1;var rt=Ke.findIndex(function(vt){return!vt});if(rt>-1)return S.b.info("\u8BF7\u5148\u8F93\u5165 ".concat(Ae[rt]," \u9009\u9879\u7684\u5185\u5BB9")),!1;if(console.log("activeAnswer: ",pt),!(typeof pt=="number"))return S.b.info("\u8BF7\u8BBE\u7F6E\u672C\u9898\u7684\u6B63\u786E\u7B54\u6848\uFF0C\u70B9\u51FB\u9009\u9879A/B...\u5373\u53EF\u5B8C\u6210\u8BBE\u7F6E"),!1;var Ne=Ke.map(function(vt,In){return{choice_text:vt,is_answer:pt===In?1:0}});return{name:bt,choices:Ne,analysis:Wt}},un=function(){It(["","","",""]),tt(""),qt(""),Mt("")};return u.a.createElement("section",{className:J.a.wrap},u.a.createElement("p",{className:J.a.titleWrap},u.a.createElement("span",{className:J.a.required},"*"),u.a.createElement("span",{className:J.a.title},"\u9898\u5E72\uFF1A")),u.a.createElement(pe.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:bt,onChange:function(rt){return tt(rt)}}),u.a.createElement("p",{className:J.a.titleWrap},u.a.createElement("span",{className:J.a.required},"*"),u.a.createElement("span",{className:J.a.title},"\u7B54\u6848\u9009\u9879\uFF1A",u.a.createElement("span",{className:J.a.colorGray},"\u70B9\u51FB\u9009\u9879\u53EF\u8BBE\u7F6E\u6B63\u786E\u7B54\u6848"))),Ke.map(function($t,rt){return u.a.createElement("div",{className:J.a.choiceWrap,key:rt},u.a.createElement(K.a,{title:"\u70B9\u51FB\u8BBE\u7F6E\u4E3A\u6807\u51C6\u7B54\u6848",placement:"left"},u.a.createElement("div",{className:"".concat(J.a.answer," ").concat(pt===rt?J.a.activeAnswer:""),onClick:function(){return Mt(rt)}},Ae[rt])),u.a.createElement("div",{className:J.a.editorWrap},Yt===rt?u.a.createElement(pe.a,{id:"single-question-option-".concat(rt),watch:!0,height:155,isFocus:!0,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9009\u9879",defaultValue:$t,onChange:function(vt){Ke[rt]=vt,It(Ke)}}):u.a.createElement("div",{className:J.a.htmlWrap,onClick:function(){return Kt(rt)}},u.a.createElement(o.a,{value:$t}))),rt>1&&u.a.createElement(K.a,{title:"\u5220\u9664"},u.a.createElement("i",{className:"".concat(J.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){It(Ke.filter(function(vt,In){return In!==rt})),rt===pt&&Mt(null)}})),rt<7&&rt===Ke.length-1&&u.a.createElement(K.a,{title:"\u65B0\u589E\u53C2\u8003\u7B54\u6848"},u.a.createElement("i",{className:"".concat(J.a.addIcon," iconfont icon-roundaddfill ml6"),onClick:function(){return It([].concat(Object(fe.a)(Ke),[""]))}})))}),u.a.createElement("p",{className:J.a.titleWrap},u.a.createElement("span",{className:J.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),u.a.createElement(pe.a,{id:"single-question-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:Wt,onChange:function(rt){return qt(rt)}}))},qe=Object(p.a)(function(Z){var q=Z.loading,ae=Z.globalSetting;return{globalSetting:ae,loading:q.effects}},null,null,{forwardRef:!0})(Object(m.forwardRef)(et)),lt=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],$e=function(q,ae){var re=q.editData,Ee=q.globalSetting,xe=q.loading,Ve=q.dispatch,Le=q.onRef,We=Le===void 0?function(){}:Le,Ot=q.isEdit,Ze=Object(ve.a)(q,["editData","globalSetting","loading","dispatch","onRef","isEdit"]),ht=Object(m.useState)(""),Ut=Object(c.a)(ht,2),Ke=Ut[0],It=Ut[1],Zt=Object(m.useState)(""),At=Object(c.a)(Zt,2),Yt=At[0],Kt=At[1],Pt=Object(m.useState)(""),Rt=Object(c.a)(Pt,2),pt=Rt[0],Mt=Rt[1];Object(m.useEffect)(function(){var bt;if(!re||!Ot)return;It(re==null?void 0:re.name),Kt(re==null?void 0:re.analysis),Mt(re==null||((bt=re.answer_texts)===null||bt===void 0)?void 0:bt[0])},[re]),Object(m.useImperativeHandle)(ae,function(){return{onSave:_t,Clear:Tt}});var _t=function(){return Ke?pt?{name:Ke,answer_texts:[pt],analysis:Yt}:(S.b.info("\u8BF7\u60A8\u8F93\u5165\u53C2\u8003\u7B54\u6848"),!1):(S.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),!1)},Tt=function(){It(""),Kt(""),Mt("")};return u.a.createElement("section",{className:J.a.wrap},u.a.createElement("p",{className:J.a.titleWrap},u.a.createElement("span",{className:J.a.required},"*"),u.a.createElement("span",{className:J.a.title},"\u9898\u5E72\uFF1A")),u.a.createElement(pe.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:Ke,onChange:function(tt){return It(tt)}}),u.a.createElement("p",{className:J.a.titleWrap},u.a.createElement("span",{className:J.a.title},"\u53C2\u8003\u7B54\u6848\uFF1A")),u.a.createElement(pe.a,{id:"single-question-reference-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u53C2\u8003\u7B54\u6848",defaultValue:pt,onChange:function(tt){return Mt(tt)}}),u.a.createElement("p",{className:J.a.titleWrap},u.a.createElement("span",{className:J.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),u.a.createElement(pe.a,{id:"single-question-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:Yt,onChange:function(tt){return Kt(tt)}}))},ft=Object(p.a)(function(Z){var q=Z.loading,ae=Z.globalSetting;return{globalSetting:ae,loading:q.effects}},null,null,{forwardRef:!0})(Object(m.forwardRef)($e)),ut=H("k1fw"),st=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],Se=function(q,ae){var re=q.globalSetting,Ee=q.loading,xe=q.dispatch,Ve=q.editData,Le=q.onRef,We=Le===void 0?function(){}:Le,Ot=q.isEdit,Ze=Object(ve.a)(q,["globalSetting","loading","dispatch","editData","onRef","isEdit"]),ht=Object(m.useState)(""),Ut=Object(c.a)(ht,2),Ke=Ut[0],It=Ut[1],Zt=Object(m.useState)([]),At=Object(c.a)(Zt,2),Yt=At[0],Kt=At[1];console.log(Yt),Object(m.useEffect)(function(){var _t;if(!Ve||!Ot)return;It(Ve==null?void 0:Ve.name);var Tt=Ve==null||((_t=Ve.sub_item_banks)===null||_t===void 0)?void 0:_t.map(function(bt){var tt,Fe,Jt;return Object(ut.a)(Object(ut.a)({},bt),{},{id:bt.id,open:!1,qusList:bt==null||((tt=bt.choices)===null||tt===void 0)?void 0:tt.map(function(Wt){return Wt.choice_text}),activeQusEditor:null,qusAnswer:(Fe=[bt==null||((Jt=bt.choices)===null||Jt===void 0)?void 0:Jt.findIndex(function(Wt){return Wt.is_answer})])===null||Fe===void 0?void 0:Fe.filter(function(Wt){return Wt!==-1})})});Kt(Tt)},[Ve]),Object(m.useImperativeHandle)(ae,function(){return{onSave:Pt,Clear:Rt}});var Pt=function(){if(!Ke)return S.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),!1;if(Yt.length===0)return S.b.info("\u8BF7\u60A8\u6DFB\u52A0\u5C0F\u9898"),!1;for(var Tt=0;Tt-1)return S.b.info("\u8BF7\u5148\u8F93\u5165\u7B2C".concat(Tt+1,"\u5C0F\u9898").concat(st[Fe],"\u9009\u9879\u7684\u5185\u5BB9")),!1;if(!(tt!=null&&tt.qusAnswer.length))return S.b.info("\u8BF7\u8BBE\u7F6E\u7B2C".concat(Tt+1,"\u5C0F\u9898\u7684\u6B63\u786E\u7B54\u6848\uFF0C\u70B9\u51FB\u9009\u9879A/B...\u5373\u53EF\u5B8C\u6210\u8BBE\u7F6E")),!1}var Jt=Yt.map(function(Wt){return{id:Wt.id>1?Wt.id:null,name:Wt.name,item_type:Wt.item_type,analysis:Wt.analysis,choices:Wt.qusList.map(function(qt,Vt){return{choice_text:qt,is_answer:Wt.qusAnswer[0]===Vt?1:0}})}});return{name:Ke,sub_item_banks:Jt}},Rt=function(){It(""),Kt([])},pt=function(){var Tt={id:Math.random(),item_type:"SINGLE",open:!1,name:"",qusList:["","","",""],activeQusEditor:null,qusAnswer:[],analysis:""};Kt(Yt.concat(Tt))},Mt=function(Tt,bt,tt){var Fe=Object(B.cloneDeep)(Yt);if(Tt==="open"&&(Fe[bt].open=!Fe[bt].open),Tt==="delete"&&Fe.splice(bt,1),Tt==="value"&&(Fe[bt].name=tt),Tt==="answer"&&(Fe[bt].qusAnswer=[tt]),Tt==="edit"&&(Fe[bt].activeQusEditor=tt),Tt==="details"&&(Fe[bt].qusList[Fe[bt].activeQusEditor]=tt),Tt==="addQus"&&(Fe[bt].qusList=Fe[bt].qusList.concat("")),Tt==="deleteQus"){var Jt;Fe[bt].qusList=Fe[bt].qusList.filter(function(Wt,qt){return qt!==tt}),Fe[bt].qusAnswer=(Jt=Fe[bt].qusAnswer)===null||Jt===void 0?void 0:Jt.filter(function(Wt){return Wt!==tt})}Tt==="analysis"&&(Fe[bt].analysis=tt),Kt(Fe)};return u.a.createElement("section",{className:J.a.wrap},u.a.createElement("p",{className:J.a.titleWrap},u.a.createElement("span",{className:J.a.required},"*"),u.a.createElement("span",{className:J.a.title},"\u9898\u5E72\uFF1A")),u.a.createElement(pe.a,{id:"combination-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:Ke,onChange:function(Tt){return It(Tt)}}),Yt==null?void 0:Yt.map(function(_t,Tt){var bt;return u.a.createElement("div",{className:J.a.fold,key:_t.id},u.a.createElement("div",{onClick:function(){return Mt("open",Tt)},className:J.a.head},u.a.createElement("i",{className:"iconfont icon-sanjiaoxing",style:{transform:_t.open?"initial":"rotate(270deg) translate(2px, 4px)"}}),u.a.createElement("span",null,"\u7B2C",Tt+1,"\u5C0F\u9898\uFF08\u5355\u9009\u9898\uFF09"),u.a.createElement("b",{style:{visibility:"hidden"},onClick:function(Fe){Fe.stopPropagation(),Mt("delete",Tt)},className:"iconfont icon-shanchu8"})),u.a.createElement("div",{className:"mb10",style:{display:_t.open?"block":"none"}},u.a.createElement(pe.a,{watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:_t==null?void 0:_t.name,onChange:function(Fe){return Mt("value",Tt,Fe)}}),u.a.createElement("p",{className:J.a.titleWrap},u.a.createElement("span",{className:J.a.required},"*"),u.a.createElement("span",{className:J.a.title},"\u7B54\u6848\u9009\u9879\uFF1A",u.a.createElement("span",{className:J.a.colorGray},"\u70B9\u51FB\u9009\u9879\u53EF\u8BBE\u7F6E\u6B63\u786E\u7B54\u6848"))),_t==null||((bt=_t.qusList)===null||bt===void 0)?void 0:bt.map(function(tt,Fe){var Jt,Wt;return u.a.createElement("div",{className:J.a.choiceWrap,key:Fe},u.a.createElement(K.a,{title:"\u70B9\u51FB\u8BBE\u7F6E\u4E3A\u6807\u51C6\u7B54\u6848",placement:"left"},u.a.createElement("div",{className:"".concat(J.a.answer," ").concat(_t!=null&&(Jt=_t.qusAnswer)!==null&&Jt!==void 0&&Jt.includes(Fe)?J.a.activeAnswer:""),onClick:function(){return Mt("answer",Tt,Fe)}},st[Fe])),u.a.createElement("div",{className:J.a.editorWrap},(_t==null?void 0:_t.activeQusEditor)===Fe?u.a.createElement(pe.a,{id:"single-question-option-".concat(Fe),watch:!0,height:155,isFocus:!0,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9009\u9879",defaultValue:tt,onChange:function(Vt){return Mt("details",Tt,Vt)}}):u.a.createElement("div",{className:J.a.htmlWrap,onClick:function(){return Mt("edit",Tt,Fe)}},u.a.createElement(o.a,{value:tt}))),Fe>1&&u.a.createElement(K.a,{title:"\u5220\u9664"},u.a.createElement("i",{className:"".concat(J.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){return Mt("deleteQus",Tt,Fe)}})),Fe<7&&Fe===(_t==null||((Wt=_t.qusList)===null||Wt===void 0)?void 0:Wt.length)-1&&u.a.createElement(K.a,{title:"\u65B0\u589E\u53C2\u8003\u7B54\u6848"},u.a.createElement("i",{className:"".concat(J.a.addIcon," iconfont icon-roundaddfill ml6"),onClick:function(){return Mt("addQus",Tt)}})))}),u.a.createElement("p",{className:"mb10 mt10"},u.a.createElement("span",{className:J.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),u.a.createElement(pe.a,{id:"single-question-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:_t.analysis,onChange:function(Fe){return Mt("analysis",Tt,Fe)}})))}))},Et=Object(p.a)(function(Z){var q=Z.loading,ae=Z.globalSetting;return{globalSetting:ae,loading:q.effects}},null,null,{forwardRef:!0})(Object(m.forwardRef)(Se)),dt=H("14J3"),Re=H("BMrR"),He=H("ZWs3"),me=function(q){var ae=q.visible,re=q.onCancel,Ee=q.onRandomExchange,xe=q.selectFromProblemSet;return u.a.createElement(i.a,{title:"\u8BF7\u9009\u62E9\u66FF\u6362\u65B9\u5F0F",visible:ae,onCancel:re,centered:!0,maskClosable:!0,footer:null},u.a.createElement(Re.a,{justify:"center"},u.a.createElement(He.a,{onClick:Ee},"\u968F\u673A\u66F4\u6362"),u.a.createElement(A.a,{style:{marginLeft:24},onClick:xe},"\u4ECE\u9898\u5E93\u4E2D\u9009\u62E9")))},le=me,de=function(q){var ae,re,Ee,xe,Ve,Le,We,Ot,Ze=q.data,ht=q.submit,Ut=q.goBack,Ke=q.loading,It=q.onTypeScore,Zt=q.editPreview,At=Zt===void 0?!1:Zt,Yt=q.onSkipExamination,Kt=q.selectValue,Pt=q.onExchange,Rt=Object(m.useRef)(),pt=Object(m.useRef)(Object(B.debounce)(function(){return Tn()},100,{leading:!0,trailing:!0})),Mt=Object(m.useState)(null),_t=Object(c.a)(Mt,2),Tt=_t[0],bt=_t[1],tt=Object(m.useState)(!1),Fe=Object(c.a)(tt,2),Jt=Fe[0],Wt=Fe[1],qt=Object(m.useState)(!1),Vt=Object(c.a)(qt,2),un=Vt[0],$t=Vt[1],rt=Object(m.useRef)(),Ne=Object(g.i)();Object(m.useEffect)(function(){return window.addEventListener("scroll",pt==null?void 0:pt.current),function(){window.removeEventListener("scroll",pt==null?void 0:pt.current)}},[]),Object(m.useEffect)(function(){Wt(!0)},[]),Object(m.useEffect)(function(){var mt,ye,Xe,Lt,xt=(mt=document.getElementById("examName"))===null||mt===void 0||((ye=mt.getElementsByClassName("ant-pagination-options-quick-jumper"))===null||ye===void 0||((Xe=ye[0])===null||Xe===void 0||((Lt=Xe.childNodes)===null||Lt===void 0)))?void 0:Lt[2];xt&&(xt.nodeValue="\u4EFD")},[Ze]);var vt=function(ye){var Xe=parseInt(ye);return isNaN(Xe)?"":Xe};function In(){var mt=0,ye=0,Xe=0;return document.body&&(ye=document.body.scrollTop),document.documentElement&&(Xe=document.documentElement.scrollTop),mt=ye-Xe>0?ye:Xe,mt}function fr(){var mt=0,ye=0,Xe=0;return document.body&&(ye=document.body.scrollHeight),document.documentElement&&(Xe=document.documentElement.scrollHeight),mt=ye-Xe>0?ye:Xe,mt}function gr(){var mt=0;return document.compatMode=="CSS1Compat"?mt=document.documentElement.clientHeight:mt=document.body.clientHeight,mt}var Tn=function(){var ye=document.getElementById("preview_btns"),Xe=document.getElementById("preview_btns_else");In()+gr()>=fr()-68?(ye.style.visibility="hidden",Xe.style.visibility="visible"):(ye.style.visibility="visible",Xe.style.visibility="hidden")},Ht=["\u5BB9\u6613","\u7B80\u5355","\u9002\u4E2D","\u56F0\u96BE"],wt=function(ye){var Xe,Lt=[];return u.a.createElement(u.a.Fragment,null,u.a.createElement("aside",{className:d.a.single},ye==null||((Xe=ye.choices)===null||Xe===void 0)?void 0:Xe.map(function(xt,Ct){return xt.is_answer&&Lt.push(Kr[Ct]),u.a.createElement("ul",{key:Ct},u.a.createElement("li",null,Kr[Ct],"\u3001"),u.a.createElement("li",null,u.a.createElement(o.a,{value:xt.choice_text})))})),u.a.createElement("div",{className:d.a.analysis},u.a.createElement("div",null,"\u6B63\u786E\u7B54\u6848\uFF1A",Lt.join(""),u.a.createElement("span",{className:"ml30"},"\u96BE\u5EA6\uFF1A",Ht[ye.difficulty])),u.a.createElement("aside",null,u.a.createElement("span",{className:d.a.text},"\u89E3\u6790:"),u.a.createElement(o.a,{value:ye.analysis?ye.analysis:"\u6682\u65E0\u89E3\u6790"})),u.a.createElement("ul",null,u.a.createElement("li",null,u.a.createElement("span",{style:{color:"#007AFF",marginRight:10}},"\u65B9\u5411&\u8BFE\u7A0B:"),"".concat(ye==null?void 0:ye.discipline_name,"/").concat(ye==null?void 0:ye.sub_discipline_name)),u.a.createElement("li",null,u.a.createElement("span",{style:{color:"#5AB891",marginRight:10}},"\u77E5\u8BC6\u70B9:"),ye==null?void 0:ye.tag_discipline_name))))},Sn=function(ye){var Xe,Lt=ye==null||((Xe=ye.standard_answer)===null||Xe===void 0)?void 0:Xe.map(function(xt){var Ct;return"\u7B54\u6848\uFF08\u586B\u7A7A".concat(xt.position,"\uFF09\uFF1A").concat(xt==null||((Ct=xt.answer_text)===null||Ct===void 0)?void 0:Ct.join("\u3001"))});return u.a.createElement(u.a.Fragment,null,u.a.createElement("div",{className:d.a.analysis},u.a.createElement("div",null,"\u6B63\u786E\u7B54\u6848\uFF1A",Lt),u.a.createElement("aside",null,u.a.createElement("span",{className:d.a.text},"\u89E3\u6790:"),u.a.createElement(o.a,{value:ye.analysis?ye.analysis:"\u6682\u65E0\u89E3\u6790"})),u.a.createElement("ul",null,u.a.createElement("li",null,u.a.createElement("span",{style:{color:"#007AFF",marginRight:10}},"\u65B9\u5411&\u8BFE\u7A0B:"),"".concat(ye==null?void 0:ye.discipline_name,"/").concat(ye==null?void 0:ye.sub_discipline_name)),u.a.createElement("li",null,u.a.createElement("span",{style:{color:"#5AB891",marginRight:10}},"\u77E5\u8BC6\u70B9:"),ye==null?void 0:ye.tag_discipline_name))))},Ge=function(ye){var Xe;return u.a.createElement("div",{className:d.a.analysis},u.a.createElement("div",null,"\u6B63\u786E\u7B54\u6848\uFF1A",ye==null||((Xe=ye.answer_texts)===null||Xe===void 0)?void 0:Xe[0]),u.a.createElement("aside",null,u.a.createElement("span",{className:d.a.text},"\u89E3\u6790:"),u.a.createElement(o.a,{value:ye.analysis?ye.analysis:"\u6682\u65E0\u89E3\u6790"})),u.a.createElement("ul",null,u.a.createElement("li",null,u.a.createElement("span",{style:{color:"#007AFF",marginRight:10}},"\u65B9\u5411&\u8BFE\u7A0B:"),"".concat(ye==null?void 0:ye.discipline_name,"/").concat(ye==null?void 0:ye.sub_discipline_name)),u.a.createElement("li",null,u.a.createElement("span",{style:{color:"#5AB891",marginRight:10}},"\u77E5\u8BC6\u70B9:"),ye==null?void 0:ye.tag_discipline_name)))},sn=function(ye){var Xe;return u.a.createElement("div",{className:d.a.analysis},u.a.createElement("aside",null,u.a.createElement("span",{className:d.a.text},"\u9884\u671F\u8F93\u51FA:"),u.a.createElement(o.a,{value:ye==null||((Xe=ye.program_attr)===null||Xe===void 0)?void 0:Xe.description})),u.a.createElement("ul",null,u.a.createElement("li",null,u.a.createElement("span",{style:{color:"#007AFF",marginRight:10}},"\u65B9\u5411&\u8BFE\u7A0B:"),"".concat(ye==null?void 0:ye.discipline_name,"/").concat(ye==null?void 0:ye.sub_discipline_name)),u.a.createElement("li",null,u.a.createElement("span",{style:{color:"#5AB891",marginRight:10}},"\u77E5\u8BC6\u70B9:"),ye==null?void 0:ye.tag_discipline_name)))},Dn=function(ye,Xe){var Lt;return u.a.createElement("div",null,ye==null||((Lt=ye.sub_item_banks)===null||Lt===void 0)?void 0:Lt.map(function(xt,Ct){var Nt,En=[];return u.a.createElement(u.a.Fragment,null,u.a.createElement("div",{style:{marginLeft:25,fontSize:"16px",color:"#333"}},Xe+1+"."+(Ct+1),"\uFF08\u5355\u9009\u9898\uFF09",xt.name),u.a.createElement("aside",{className:d.a.single},xt==null||((Nt=xt.choices)===null||Nt===void 0)?void 0:Nt.map(function(bn,nn){return bn.is_answer&&En.push(Kr[nn]),u.a.createElement("ul",{key:nn},u.a.createElement("li",null,Kr[nn],"\u3001"),u.a.createElement("li",null,u.a.createElement(o.a,{value:bn.choice_text})))})),u.a.createElement("div",{className:d.a.analysis},u.a.createElement("div",null,"\u6B63\u786E\u7B54\u6848\uFF1A",En.join(""),u.a.createElement("span",{className:"ml30"},"\u96BE\u5EA6\uFF1A",Ht[xt.difficulty])),u.a.createElement("aside",null,u.a.createElement("span",{className:d.a.text},"\u89E3\u6790:"),u.a.createElement(o.a,{value:xt.analysis?xt.analysis:"\u6682\u65E0\u89E3\u6790"})),u.a.createElement("ul",null,u.a.createElement("li",null,u.a.createElement("span",{style:{color:"#007AFF",marginRight:10}},"\u65B9\u5411&\u8BFE\u7A0B:"),"".concat(ye==null?void 0:ye.discipline_name,"/").concat(ye==null?void 0:ye.sub_discipline_name)),u.a.createElement("li",null,u.a.createElement("span",{style:{color:"#5AB891",marginRight:10}},"\u77E5\u8BC6\u70B9:"),ye==null?void 0:ye.tag_discipline_name))))}))},Kr=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],Hr=function(ye){var Xe,Lt=[];ye==null||((Xe=ye.questions)===null||Xe===void 0)||Xe.map(function(Ct){var Nt;return Ct==null||((Nt=Ct.sub_item_banks)===null||Nt===void 0)?void 0:Nt.map(function(En){Lt.push(En)})});var xt=0;ye.type==="COMBINATION"?xt=ye.questions_score/Lt.length:xt=ye.questions_score/ye.questions_count,i.a.confirm({icon:null,className:"custom-modal-divider",centered:!0,title:"\u5206\u6570\u8BBE\u7F6E",content:u.a.createElement("div",{className:d.a.modalColumn},u.a.createElement("div",{className:d.a.modalRow,style:{justifyContent:"flex-start"}},u.a.createElement("sup",{className:d.a.sup},"*"),u.a.createElement("span",null,ye==null?void 0:ye.name,(ye==null?void 0:ye.type)==="COMBINATION"&&"\u4E2D\u7684\u6BCF\u5C0F\u9898","\uFF1A"),u.a.createElement(f.a,{min:1,parser:vt,defaultValue:xt,onChange:function(Nt){xt=Nt}}),u.a.createElement("span",{className:"ml5"},"\u5206/\u9898"))),okText:"\u786E\u8BA4",cancelText:"\u53D6\u6D88",onOk:function(){var Ct=Object(b.a)(v.a.mark(function En(){var bn,nn;return v.a.wrap(function(Pn){for(;;)switch(Pn.prev=Pn.next){case 0:if(xt){Pn.next=3;break}return S.b.warn("\u5206\u6570\u4E0D\u80FD\u4E3A\u7A7A\u6216\u4E3A0"),Pn.abrupt("return",Promise.reject());case 3:ye.type==="COMBINATION"?(bn={type:ye==null?void 0:ye.type,score:xt,scoreTotal:xt*(Lt==null?void 0:Lt.length)},It(bn)):(nn={type:ye==null?void 0:ye.type,score:xt,scoreTotal:xt*ye.questions_count},It(nn));case 4:case"end":return Pn.stop()}},En)}));function Nt(){return Ct.apply(this,arguments)}return Nt}()})},Un=function(){var ye="";i.a.confirm({icon:null,className:"custom-modal-divider",centered:!0,title:"\u4FDD\u5B58\u8BD5\u5377",content:u.a.createElement("div",{className:d.a.modalColumn},u.a.createElement("div",{style:{color:"#676A6C",display:"flex"},className:"font14 mt20"},u.a.createElement("img",{style:{marginRight:5},src:$.a}),"\u4FDD\u5B58\u540E\u5355\u72EC\u751F\u6210\u4E00\u4EFD\u4EBA\u5DE5\u7EC4\u5377\u7C7B\u578B\u7684\u56FA\u5B9A\u8BD5\u5377\u3002"),u.a.createElement("div",{className:d.a.modalRow,style:{marginTop:20}},u.a.createElement("sup",{className:d.a.sup},"*"),u.a.createElement("span",{style:{flexShrink:0}},"\u8BD5\u5377\u540D\u79F0\uFF1A"),u.a.createElement(C.a,{placeholder:"\u8BF7\u8F93\u5165\u8BD5\u5377\u540D\u79F0",min:0,maxLength:60,defaultValue:ye,onChange:function(Lt){ye=Lt.target.value}}))),okText:"\u786E\u8BA4",cancelText:"\u53D6\u6D88",onOk:function(){var Xe=Object(b.a)(v.a.mark(function xt(){var Ct,Nt,En,bn,nn;return v.a.wrap(function(Pn){for(;;)switch(Pn.prev=Pn.next){case 0:if(ye){Pn.next=3;break}return S.b.warn("\u8BD5\u5377\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A"),Pn.abrupt("return",Promise.reject());case 3:return Nt=[],En=[],bn=[],Ze==null||((Ct=Ze.questionList)===null||Ct===void 0)||Ct.forEach(function(er){var Fn;(Fn=er.questions)===null||Fn===void 0||Fn.forEach(function(Ir){Nt.push(Ir.id),En.push(er.questions_score/er.questions_count),er.type==="COMBINATION"&&bn.push({id:Ir.id,sub_item_bank_ids:Ir.sub_item_banks.map(function(Qn){return Qn.id})})})}),console.log("-----",bn),nn={item_bank_ids:Nt,item_bank_scores:En,name:ye,combination_item_banks:bn},Pn.next=11,ht(nn);case 11:case"end":return Pn.stop()}},xt)}));function Lt(){return Xe.apply(this,arguments)}return Lt}()})},aa=function(ye,Xe,Lt,xt){var Ct,Nt="".concat(location.pathname).concat(location.search),En=(Ct=xt.questions)===null||Ct===void 0?void 0:Ct.map(function(nn){return nn.id});if(Nt.includes("exercise"))rt.current={id:ye,ids:En,type:Xe,index:Lt},$t(!0);else var bn=i.a.confirm({icon:null,className:"custom-modal-divider",centered:!0,title:"\u6E29\u99A8\u63D0\u793A",content:"\u786E\u8BA4\u8981\u66F4\u6362\u8BE5\u8BD5\u9898\u5417\uFF1F",cancelButtonProps:{disabled:!1},maskClosable:!0,keyboard:!1,okText:"\u786E\u8BA4",cancelText:"\u53D6\u6D88",onOk:function(){var nn=Object(b.a)(v.a.mark(function Pn(){return v.a.wrap(function(Fn){for(;;)switch(Fn.prev=Fn.next){case 0:return bn.update({cancelButtonProps:{disabled:!0}}),Fn.next=3,Pt({single_question_id:ye,seleted_item_bank_ids:En},{type:Xe,index:Lt});case 3:bn.update({cancelButtonProps:{disabled:!1}}),S.b.success("\u5DF2\u91CD\u65B0\u968F\u673A\u751F\u6210\u8BD5\u9898");case 5:case"end":return Fn.stop()}},Pn)}));function Ln(){return nn.apply(this,arguments)}return Ln}()})},ia=function(ye){var Xe,Lt=(Xe=ye.questions)===null||Xe===void 0?void 0:Xe.map(function(Nt){return Nt.id}),xt=ye.name,Ct=i.a.confirm({icon:null,className:"custom-modal-divider",centered:!0,title:"\u6E29\u99A8\u63D0\u793A",content:"\u786E\u8BA4\u66F4\u6362".concat(xt,"\u4E2D\u7684\u6240\u6709\u8BD5\u9898\u5417\uFF1F"),cancelButtonProps:{disabled:!1},maskClosable:!1,keyboard:!1,okText:"\u786E\u8BA4",cancelText:"\u53D6\u6D88",onOk:function(){var Nt=Object(b.a)(v.a.mark(function bn(){return v.a.wrap(function(Ln){for(;;)switch(Ln.prev=Ln.next){case 0:return Ct.update({cancelButtonProps:{disabled:!0}}),Ln.next=3,Pt({seleted_item_bank_ids:Lt},{type:ye.type});case 3:Ct.update({cancelButtonProps:{disabled:!1}}),S.b.success("\u5DF2\u91CD\u65B0\u968F\u673A\u751F\u6210".concat(xt,"\u8BD5\u9898"));case 5:case"end":return Ln.stop()}},bn)}));function En(){return Nt.apply(this,arguments)}return En}()})},yr=function(){var ye=i.a.confirm({icon:null,className:"custom-modal-divider",centered:!0,title:"\u6E29\u99A8\u63D0\u793A",content:"\u786E\u8BA4\u66F4\u6362\u9884\u89C8\u4E2D\u7684\u6240\u6709\u8BD5\u9898\u5417\uFF1F",cancelButtonProps:{disabled:!1},maskClosable:!1,keyboard:!1,okText:"\u786E\u8BA4",cancelText:"\u53D6\u6D88",onOk:function(){var Xe=Object(b.a)(v.a.mark(function xt(){return v.a.wrap(function(Nt){for(;;)switch(Nt.prev=Nt.next){case 0:return ye.update({cancelButtonProps:{disabled:!0}}),Nt.next=3,Pt();case 3:ye.update({cancelButtonProps:{disabled:!1}}),S.b.success("\u5DF2\u91CD\u65B0\u968F\u673A\u751F\u6210\u6574\u5F20\u8BD5\u9898");case 5:case"end":return Nt.stop()}},xt)}));function Lt(){return Xe.apply(this,arguments)}return Lt}()})},kr=function(ye){console.log(ye,"key"),Yt(ye-1)},oa=function(){return u.a.createElement(u.a.Fragment,null,u.a.createElement(M.a,{color:"#55575D",overlayClassName:d.a.popover,visible:Jt,getPopupContainer:function(Xe){return Xe==null?void 0:Xe.parentNode},content:"\u5982\u60A8\u5BF9\u6B64\u4EFD\u8BD5\u9898\u6EE1\u610F\uFF0C\u53EF\u5C06\u6B64\u4EFD\u8BD5\u9898\u4FDD\u5B58\u4E3A\u56FA\u5B9A\u8BD5\u5377"},u.a.createElement(A.a,{onMouseEnter:function(){return Wt(!0)},onMouseLeave:function(){return Wt(!1)},onClick:function(){Un()}},"\u4FDD\u5B58")),u.a.createElement(A.a,{onClick:function(){document.body.scrollIntoView(),Ut()}},"\u8FD4\u56DE"),u.a.createElement(A.a,{loading:Ke,onClick:function(){return ht()},type:"primary"},"\u63D0\u4EA4"))},qr=function(){var ye;return u.a.createElement(u.a.Fragment,null,u.a.createElement(A.a,{onClick:Ut},"\u8FD4\u56DE"),Kt>0&&u.a.createElement(A.a,{onClick:function(){return kr(Kt)},type:"primary"},"\u4E0A\u4E00\u4EFD"),Kt<(Ze==null||((ye=Ze.exam)===null||ye===void 0)?void 0:ye.total_num)-1&&u.a.createElement(A.a,{onClick:function(){return kr(Kt+2)}},"\u4E0B\u4E00\u4EFD"))},Er=function(ye,Xe){if(Xe==="SINGLE")return u.a.createElement(u.a.Fragment,null,u.a.createElement(qe,{ref:Rt,editData:ye,isEdit:!0}),u.a.createElement(P.a,null));if(Xe==="MULTIPLE")return u.a.createElement(u.a.Fragment,null,u.a.createElement(Ie,{ref:Rt,editData:ye,isEdit:!0}),u.a.createElement(P.a,null));if(Xe==="JUDGMENT")return u.a.createElement(u.a.Fragment,null,u.a.createElement(Pe,{ref:Rt,editData:ye,isEdit:!0}),u.a.createElement(P.a,null));if(Xe==="COMPLETION")return u.a.createElement(u.a.Fragment,null,u.a.createElement(De,{ref:Rt,editData:ye,isEdit:!0}),u.a.createElement(P.a,null));if(Xe==="SUBJECTIVE")return u.a.createElement(u.a.Fragment,null,u.a.createElement(ft,{ref:Rt,editData:ye,isEdit:!0}),u.a.createElement(P.a,null));if(Xe==="COMBINATION")return u.a.createElement(u.a.Fragment,null,u.a.createElement(Et,{ref:Rt,editData:ye,isEdit:!0}),u.a.createElement(P.a,null));if(Xe==="PROGRAM"){var Lt;p.d.push("/problems/".concat(ye==null||((Lt=ye.program_attr)===null||Lt===void 0)?void 0:Lt.identifier,"/edit?type=exercises&express_id=").concat(Ne.categoryId,"&question_id=").concat(ye==null?void 0:ye.id,"&score=").concat(ye==null?void 0:ye.score,"&callback_url=").concat(location.pathname,"&select=").concat(Kt,"&exercise=true"))}},Nn=function(){var mt=Object(b.a)(v.a.mark(function ye(Xe,Lt){var xt,Ct,Nt,En,bn,nn,Ln,Pn,er,Fn;return v.a.wrap(function(Qn){for(;;)switch(Qn.prev=Qn.next){case 0:return Qn.next=2,(xt=Rt.current)===null||xt===void 0?void 0:xt.onSave();case 2:if(Ct=Qn.sent,Ct){Qn.next=5;break}return Qn.abrupt("return");case 5:return Nt={question_score:Lt.score,analysis:Ct.analysis},(Xe==="SINGLE"||Xe==="MULTIPLE"||Xe==="JUDGMENT")&&(bn=[],nn=[],Nt.question_type=Xe==="JUDGMENT"?2:1,Nt.question_title=Ct==null?void 0:Ct.name,Ct==null||((En=Ct.choices)===null||En===void 0)||En.forEach(function(Cn,hr){bn.push(Cn.choice_text),Cn!=null&&Cn.is_answer&&nn.push(hr+1)}),Nt.question_choices=bn,Nt.standard_answers=nn),Xe==="COMPLETION"&&(Nt.is_ordered=Ct.is_ordered,Nt.question_title=Ct==null?void 0:Ct.name,Nt.question_type=3,Pn=[],Ct==null||((Ln=Ct.standard_answers)===null||Ln===void 0)||Ln.forEach(function(Cn,hr){Pn.push({choice_id:Cn.position,answer_text:Cn.answer_text})}),Nt.standard_answers=Pn),Xe==="SUBJECTIVE"&&(Nt.question_title=Ct==null?void 0:Ct.name,Nt.question_type=3,Nt.standard_answers=Ct==null?void 0:Ct.answer_texts),Xe==="COMBINATION"&&(Nt.question_title=Ct==null?void 0:Ct.name,Nt.question_type=7,Nt.sub_questions=Ct==null||((er=Ct.sub_item_banks)===null||er===void 0)?void 0:er.map(function(Cn,hr){return{id:Cn.id,question_title:Cn.name,question_type:1,question_choices:Cn.choices.map(function(wr){return wr.choice_text}),standard_answers:[Cn.choices.findIndex(function(wr){return wr.is_answer})+1],analysis:Cn.analysis}}),delete Nt.analysis),Qn.next=12,Object(E.a)("/api/exercise_questions/".concat(Lt.id,".json"),{method:"put",body:Nt});case 12:Fn=Qn.sent,(Fn==null?void 0:Fn.status)===0&&(S.b.success("\u7F16\u8F91\u6210\u529F"),kr(Kt+1)),bt(null);case 15:case"end":return Qn.stop()}},ye)}));return function(Xe,Lt){return mt.apply(this,arguments)}}(),ea=function(){for(var ye=[],Xe=0;Xe<(Ze==null||((Lt=Ze.exam)===null||Lt===void 0)?void 0:Lt.total_num);Xe++){var Lt;ye.push({})}return ye},sa=Ze==null||((ae=Ze.questionList)===null||ae===void 0)?void 0:ae.reduce(function(mt,ye){return mt+ye.questions_score},0),Wn=At&&(Ze==null||((re=Ze.exam)===null||re===void 0)?void 0:re.exercise_status)!==1;return u.a.createElement("section",{className:d.a.wrap},u.a.createElement("div",{id:"id_left_preview",className:d.a.left,onMouseEnter:function(ye){var Xe=document.getElementById("id_left_preview");Xe.style.overflowY="auto"},onMouseLeave:function(ye){var Xe=document.getElementById("id_left_preview");Xe.style.overflowY="hidden"}},u.a.createElement("div",{className:d.a.title},u.a.createElement("div",null,u.a.createElement("b",null),u.a.createElement("span",null,"\u7B54\u9898\u5361"))),u.a.createElement("div",{className:d.a.total},u.a.createElement("div",null,u.a.createElement("img",{src:F.a}),u.a.createElement("span",null,"\u9898\u6570(\u9053)"),u.a.createElement("aside",null,Ze==null?void 0:Ze.all_questions_count)),u.a.createElement("div",{className:"mr30 ml30"},u.a.createElement("img",{src:V.a}),u.a.createElement("span",null,"\u603B\u5206(\u5206)"),u.a.createElement("aside",null,sa)),u.a.createElement("div",null,u.a.createElement("img",{src:s.a}),u.a.createElement("span",null,"\u65F6\u957F(\u5206)"),u.a.createElement("aside",null,Ze==null||((Ee=Ze.exam)===null||Ee===void 0)?void 0:Ee.time))),Ze==null||((xe=Ze.questionList)===null||xe===void 0)?void 0:xe.map(function(mt,ye){var Xe;return u.a.createElement("div",{className:d.a.list,key:ye},u.a.createElement("div",{className:d.a.name},u.a.createElement("b",null),u.a.createElement("span",null,mt.name)),u.a.createElement("aside",null,u.a.createElement("div",null,"\u5171",u.a.createElement("span",{className:d.a.b},mt.questions_count),"\u9898 ",u.a.createElement("span",{className:d.a.l},"|"),"\u5171",u.a.createElement("span",{className:d.a.r},mt.questions_score),"\u5206"),u.a.createElement("div",{className:d.a.answerSheet},mt==null||((Xe=mt.questions)===null||Xe===void 0)?void 0:Xe.map(function(Lt,xt){return u.a.createElement("div",{onClick:function(){var Nt="Anchor_".concat(Lt.id),En=document.getElementById(Nt);En&&setTimeout(function(){return En.scrollIntoView({block:"center",behavior:"smooth"})})},key:Lt.id,className:d.a.tag},xt+1)}))))})),u.a.createElement("div",{className:d.a.right},u.a.createElement("div",{className:d.a.examName,id:"examName"},u.a.createElement("div",{className:d.a.name},u.a.createElement(K.a,{title:Ze==null||((Ve=Ze.exam)===null||Ve===void 0)?void 0:Ve.name,getPopupContainer:function(ye){return ye.parentNode}},u.a.createElement("span",{className:d.a.t},Ze==null||((Le=Ze.exam)===null||Le===void 0)?void 0:Le.name))),At?u.a.createElement(G.a,{showTotal:function(ye){return u.a.createElement("span",{style:{color:"#656F87",fontSize:14}},"\u5171\u8BA1",u.a.createElement("span",{className:"c-light-primary"},ye),"\u4EFD\u8BD5\u5377")},total:Ze==null||((We=Ze.exam)===null||We===void 0)?void 0:We.total_num,pageSize:1,current:Kt+1,showSizeChanger:!1,onChange:kr,showQuickJumper:!0,hideOnSinglePage:!1}):u.a.createElement(A.a,{onClick:yr,type:"primary"},"\u968F\u673A\u66F4\u6362")),u.a.createElement("div",{className:d.a.topWarp},Ze==null||((Ot=Ze.questionList)===null||Ot===void 0)?void 0:Ot.map(function(mt,ye){var Xe,Lt;return u.a.createElement(u.a.Fragment,{key:ye},u.a.createElement("div",{className:d.a.head,style:ye===0?{border:0,marginTop:-16}:{}},u.a.createElement("div",{className:d.a.name},u.a.createElement("b",null),u.a.createElement("span",null,mt.name)),u.a.createElement("div",{className:d.a.so},"\u5171",u.a.createElement("span",{className:d.a.b},mt.questions_count," "),"\u9898 ",mt.type==="COMBINATION"&&"\uFF08\u5305\u542B".concat(mt==null||((Xe=mt.questions)===null||Xe===void 0)?void 0:Xe.map(function(xt){var Ct;return xt==null||((Ct=xt.sub_item_banks)===null||Ct===void 0)?void 0:Ct.length}).reduce(function(xt,Ct){return xt+Ct}),"\u5C0F\u9898\uFF09"),u.a.createElement("span",{className:d.a.l},"|"),"\u5171",u.a.createElement("span",{className:d.a.r},mt.questions_score),"\u5206"),!At&&u.a.createElement("div",{className:d.a.btn},u.a.createElement(A.a,{onClick:function(){Hr(mt)},type:"primary",ghost:!0,className:"mr20"},"\u8BBE\u7F6E\u5F97\u5206"),u.a.createElement(A.a,{onClick:function(){return ia(mt)},type:"primary",ghost:!0},"\u968F\u673A\u66F4\u6362"))),mt==null||((Lt=mt.questions)===null||Lt===void 0)?void 0:Lt.map(function(xt,Ct){return Tt===xt.id?u.a.createElement("div",{id:"Anchor_".concat(xt.id),className:d.a.content,style:{padding:0,marginTop:10},key:xt.id},u.a.createElement("div",{style:{float:"right",marginTop:-6}},u.a.createElement(A.a,{onClick:function(){return bt(null)},className:"mr20",type:"primary",ghost:!0},"\u53D6\u6D88"),u.a.createElement(A.a,{onClick:function(){return Nn(mt==null?void 0:mt.type,xt)},type:"primary"},"\u4FDD\u5B58")),Er(xt,mt.type)):u.a.createElement("div",{id:"Anchor_".concat(xt.id),className:d.a.content,key:xt.id},u.a.createElement("div",{className:d.a.titleWrap},u.a.createElement(o.a,{style:{paddingRight:10},className:d.a.titleHtml,value:Ct+1+"\u3001"+"".concat((xt==null?void 0:xt.item_type)==="combination"?"\uFF08\u9898\u5E72\uFF09":"")+xt.name}),At&&u.a.createElement(A.a,{disabled:Wn,onClick:function(){if(Tt){S.b.warn("\u5148\u4FDD\u5B58\u6216\u53D6\u6D88\u5F53\u524D\u6B63\u5728\u7F16\u8F91\u7684\u8BD5\u9898");return}bt(xt.id)},type:"primary",className:"mr20",style:{marginLeft:"auto"},ghost:!0},"\u7F16\u8F91"),u.a.createElement(A.a,{disabled:Wn,onClick:function(){return aa(xt.id,mt.type,Ct,mt)},type:"primary",ghost:!0},"\u6362\u4E00\u9898")),(mt.type==="SINGLE"||mt.type==="JUDGMENT"||mt.type==="MULTIPLE")&&wt(xt),mt.type==="COMPLETION"&&Sn(xt),mt.type==="SUBJECTIVE"&&Ge(xt),mt.type==="PROGRAM"&&sn(xt),mt.type==="COMBINATION"&&Dn(xt,Ct),u.a.createElement("div",null))}))})),u.a.createElement("div",{className:d.a.btnsElse,id:"preview_btns_else"},At?qr():oa()),u.a.createElement("div",{className:d.a.btnsWrap,id:"preview_btns"},u.a.createElement("div",{className:d.a.btns},At?qr():oa()))),u.a.createElement(le,{visible:un,onRandomExchange:Object(b.a)(v.a.mark(function mt(){var ye;return v.a.wrap(function(Lt){for(;;)switch(Lt.prev=Lt.next){case 0:return ye=rt.current,Lt.next=3,Pt({single_question_id:ye.id,seleted_item_bank_ids:ye.ids},{type:ye.type,index:ye.index});case 3:$t(!1);case 4:case"end":return Lt.stop()}},mt)})),selectFromProblemSet:function(){var ye=rt.current,Xe="".concat(location.pathname).concat(location.search);Xe.includes("exercise")&&p.d.push("/paperlibrary/exchangequestion?type=exercise&qid=".concat(ye.id,"&qtype=").concat(ye.type,"&exerciseid=").concat(Ne.categoryId,"&from=").concat(Xe))},onCancel:function(){$t(!1)}}))},Y=Be.a=de},sboe:function(Je,Be,H){"use strict";H.d(Be,"a",function(){return D});var ne=H("cDcd"),G=H.n(ne),D=ne.createContext(null)},tmPe:function(Je,Be,H){Je.exports={flex_box_center:"flex_box_center___ivyUy",flex_space_between:"flex_space_between___1h8Qq",flex_box_vertical_center:"flex_box_vertical_center___3eC95",flex_box_center_end:"flex_box_center_end___nrhvX",flex_box_column:"flex_box_column___2po4_",customTree:"customTree___1LpRW",name:"name___17ZTs"}},ulZh:function(Je,Be,H){typeof window!="undefined"&&function(G,D){Je.exports=D()}(this,function(){return function(ne){var G={};function D(K){if(G[K])return G[K].exports;var k=G[K]={i:K,l:!1,exports:{}};return ne[K].call(k.exports,k,k.exports,D),k.l=!0,k.exports}return D.m=ne,D.c=G,D.d=function(K,k,P){D.o(K,k)||Object.defineProperty(K,k,{enumerable:!0,get:P})},D.r=function(K){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(K,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(K,"__esModule",{value:!0})},D.t=function(K,k){if(k&1&&(K=D(K)),k&8)return K;if(k&4&&typeof K=="object"&&K&&K.__esModule)return K;var P=Object.create(null);if(D.r(P),Object.defineProperty(P,"default",{enumerable:!0,value:K}),k&2&&typeof K!="string")for(var N in K)D.d(P,N,function(M){return K[M]}.bind(null,N));return P},D.n=function(K){var k=K&&K.__esModule?function(){return K.default}:function(){return K};return D.d(k,"a",k),k},D.o=function(K,k){return Object.prototype.hasOwnProperty.call(K,k)},D.p="/dist/",D(D.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(ne,G,D){"use strict";var K=Object.prototype.hasOwnProperty,k="~";function P(){}Object.create&&(P.prototype=Object.create(null),new P().__proto__||(k=!1));function N(T,C,R){this.fn=T,this.context=C,this.once=R||!1}function M(T,C,R,S,b){if(typeof R!="function")throw new TypeError("The listener must be a function");var x=new N(R,S||T,b),f=k?k+C:C;return T._events[f]?T._events[f].fn?T._events[f]=[T._events[f],x]:T._events[f].push(x):(T._events[f]=x,T._eventsCount++),T}function O(T,C){--T._eventsCount===0?T._events=new P:delete T._events[C]}function A(){this._events=new P,this._eventsCount=0}A.prototype.eventNames=function(){var C=[],R,S;if(this._eventsCount===0)return C;for(S in R=this._events)K.call(R,S)&&C.push(k?S.slice(1):S);return Object.getOwnPropertySymbols?C.concat(Object.getOwnPropertySymbols(R)):C},A.prototype.listeners=function(C){var R=k?k+C:C,S=this._events[R];if(!S)return[];if(S.fn)return[S.fn];for(var b=0,x=S.length,f=new Array(x);b0},!1)}function T(C,R){for(var S={main:[R]},b={main:[]},x={main:{}};A(S);)for(var f=Object.keys(S),l=0;l=2*u/d||E<=F)return;var j=Number.POSITIVE_INFINITY,V;for(V=f.level-1;V>s;V--){var B=h[V].maxBitrate;if(j=u*B/(8*.8*p),j=E)return;var I=this.bwEstimator.getEstimate();A.logger.warn("Fragment "+f.sn+(l?" part "+l.index:"")+" of level "+f.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+V+` Current BW estimate: `+(Object(K.isFiniteNumber)(I)?(I/1024).toFixed(3):"Unknown")+` Kb/s Estimated load time for current fragment: `+E.toFixed(3)+` s Estimated load time for the next fragment: `+j.toFixed(3)+` s Time to underbuffer: `+F.toFixed(3)+" s"),i.nextLoadLevel=V,this.bwEstimator.sample(y,m.loaded),this.clearTimer(),f.loader&&(this.fragCurrent=this.partCurrent=null,f.loader.abort()),i.trigger(P.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:f,part:l,stats:m})},b.onFragLoaded=function(f,l){var i=l.frag,c=l.part;if(i.type===O.PlaylistLevelType.MAIN&&Object(K.isFiniteNumber)(i.sn)){var _=c?c.stats:i.stats,v=c?c.duration:i.duration;if(this.clearTimer(),this.lastLoadedFragLevel=i.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var m=this.hls.levels[i.level],u=(m.loaded?m.loaded.bytes:0)+_.loaded,y=(m.loaded?m.loaded.duration:0)+v;m.loaded={bytes:u,duration:y},m.realBitrate=Math.round(8*u/y)}if(i.bitrateTest){var d={stats:_,frag:i,part:c,id:i.type};this.onFragBuffered(P.Events.FRAG_BUFFERED,d),i.bitrateTest=!1}}},b.onFragBuffered=function(f,l){var i=l.frag,c=l.part,_=c?c.stats:i.stats;if(_.aborted)return;if(i.type!==O.PlaylistLevelType.MAIN||i.sn==="initSegment")return;var v=_.parsing.end-_.loading.start;this.bwEstimator.sample(v,_.loaded),_.bwEstimate=this.bwEstimator.getEstimate(),i.bitrateTest?this.bitrateTestDelay=v/1e3:this.bitrateTestDelay=0},b.onError=function(f,l){switch(l.details){case M.ErrorDetails.FRAG_LOAD_ERROR:case M.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},b.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},b.getNextABRAutoLevel=function(){var f=this.fragCurrent,l=this.partCurrent,i=this.hls,c=i.maxAutoLevel,_=i.config,v=i.minAutoLevel,m=i.media,u=l?l.duration:f?f.duration:0,y=m?m.currentTime:0,d=m&&m.playbackRate!==0?Math.abs(m.playbackRate):1,h=this.bwEstimator?this.bwEstimator.getEstimate():_.abrEwmaDefaultEstimate,s=(N.BufferHelper.bufferInfo(m,y,_.maxBufferHole).end-y)/d,o=this.findBestLevel(h,v,c,s,_.abrBandWidthFactor,_.abrBandWidthUpFactor);if(o>=0)return o;A.logger.trace((s?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var g=u?Math.min(u,_.maxStarvationDelay):_.maxStarvationDelay,p=_.abrBandWidthFactor,E=_.abrBandWidthUpFactor;if(!s){var L=this.bitrateTestDelay;if(L){var F=u?Math.min(u,_.maxLoadingDelay):_.maxLoadingDelay;g=F-L,A.logger.trace("bitrate test took "+Math.round(1e3*L)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*g)+" ms"),p=E=1}}return o=this.findBestLevel(h,v,c,s+g,p,E),Math.max(o,0)},b.findBestLevel=function(f,l,i,c,_,v){for(var m,u=this.fragCurrent,y=this.partCurrent,d=this.lastLoadedFragLevel,h=this.hls.levels,s=h[d],o=!!(s!=null&&(m=s.details)!==null&&m!==void 0&&m.live),g=s==null?void 0:s.codecSet,p=y?y.duration:u?u.duration:0,E=i;E>=l;E--){var L=h[E];if(!L||g&&L.codecSet!==g)continue;var F=L.details,j=(y?F==null?void 0:F.partTarget:F==null?void 0:F.averagetargetduration)||p,V=void 0;E<=d?V=_*f:V=v*f;var B=h[E].maxBitrate,I=B*j/V;if(A.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+E+"/"+Math.round(V)+"/"+B+"/"+j+"/"+c+"/"+I),V>B&&(!I||o&&!this.bitrateTestDelay||I0&&s===-1?(this.log("Override startPosition with lastCurrentTime @"+o.toFixed(3)),this.state=k.State.IDLE):(this.loadedmetadata=!1,this.state=k.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=s,this.tick()},d.doTick=function(){switch(this.state){case k.State.IDLE:this.doTickIdle();break;case k.State.WAITING_TRACK:{var s,o=this.levels,g=this.trackId,p=o==null||((s=o[g])===null||s===void 0)?void 0:s.details;if(p){if(this.waitForCdnTuneIn(p))break;this.state=k.State.WAITING_INIT_PTS}break}case k.State.FRAG_LOADING_WAITING_RETRY:{var E,L=performance.now(),F=this.retryDate;(!F||L>=F||(E=this.media)!==null&&E!==void 0&&E.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=k.State.IDLE);break}case k.State.WAITING_INIT_PTS:{var j=this.waitingData;if(j){var V=j.frag,B=j.part,I=j.cache,$=j.complete;if(this.initPTS[V.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=k.State.FRAG_LOADING;var ie=I.flush(),ue={frag:V,part:B,payload:ie,networkDetails:null};this._handleFragmentLoadProgress(ue),$&&u.prototype._handleFragmentLoadComplete.call(this,ue)}else if(this.videoTrackCC!==this.waitingVideoCC)l.logger.log("Waiting fragment cc ("+V.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var fe=this.getLoadPosition(),ve=N.BufferHelper.bufferInfo(this.mediaBuffer,fe,this.config.maxBufferHole),pe=Object(b.fragmentWithinToleranceTest)(ve.end,this.config.maxFragLookUpTolerance,V);pe<0&&(l.logger.log("Waiting fragment cc ("+V.cc+") @ "+V.start+" cancelled because another fragment at "+ve.end+" is needed"),this.clearWaitingFragment())}}else this.state=k.State.IDLE}}this.onTickEnd()},d.clearWaitingFragment=function(){var s=this.waitingData;s&&(this.fragmentTracker.removeFragment(s.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=k.State.IDLE)},d.onTickEnd=function(){var s=this.media;if(!s||!s.readyState)return;var o=this.mediaBuffer?this.mediaBuffer:s,g=o.buffered;!this.loadedmetadata&&g.length&&(this.loadedmetadata=!0),this.lastCurrentTime=s.currentTime},d.doTickIdle=function(){var s,o,g=this.hls,p=this.levels,E=this.media,L=this.trackId,F=g.config;if(!p||!p[L])return;if(!E&&(this.startFragRequested||!F.startFragPrefetch))return;var j=p[L],V=j.details;if(!V||V.live&&this.levelLastLoaded!==L||this.waitForCdnTuneIn(V)){this.state=k.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,T.ElementaryStreamTypes.AUDIO,A.PlaylistLevelType.AUDIO));var B=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,A.PlaylistLevelType.AUDIO);if(B===null)return;var I=B.len,$=this.getMaxBufferLength(),ie=this.audioSwitch;if(I>=$&&!ie)return;if(!ie&&this._streamEnded(B,V)){g.trigger(P.Events.BUFFER_EOS,{type:"audio"}),this.state=k.State.ENDED;return}var ue=V.fragments,fe=ue[0].start,ve=B.end;if(ie){var pe=this.getLoadPosition();ve=pe,V.PTSKnown&&pefe||B.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),E.currentTime=fe+.05))}var te=this.getNextFragment(ve,V);if(!te){this.bufferFlushed=!0;return}((s=te.decryptdata)===null||s===void 0?void 0:s.keyFormat)==="identity"&&!((o=te.decryptdata)!==null&&o!==void 0&&o.key)?this.loadKey(te,V):this.loadFragment(te,V,ve)},d.getMaxBufferLength=function(){var s=u.prototype.getMaxBufferLength.call(this),o=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,A.PlaylistLevelType.MAIN);return o===null?s:Math.max(s,o.len)},d.onMediaDetaching=function(){this.videoBuffer=null,u.prototype.onMediaDetaching.call(this)},d.onAudioTracksUpdated=function(s,o){var g=o.audioTracks;this.resetTransmuxer(),this.levels=g.map(function(p){return new O.Level(p)})},d.onAudioTrackSwitching=function(s,o){var g=!!o.url;this.trackId=o.id;var p=this.fragCurrent;p!=null&&p.loader&&p.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),g?this.setInterval(v):this.resetTransmuxer(),g?(this.audioSwitch=!0,this.state=k.State.IDLE):this.state=k.State.STOPPED,this.tick()},d.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},d.onLevelLoaded=function(s,o){this.mainDetails=o.details},d.onAudioTrackLoaded=function(s,o){var g,p=this.levels,E=o.details,L=o.id;if(!p){this.warn("Audio tracks were reset while loading level "+L);return}this.log("Track "+L+" loaded ["+E.startSN+","+E.endSN+"],duration:"+E.totalduration);var F=p[L],j=0;if(E.live||(g=F.details)!==null&&g!==void 0&&g.live){var V=this.mainDetails;if(E.fragments[0]||(E.deltaUpdateFailed=!0),E.deltaUpdateFailed||!V)return;!F.details&&E.hasProgramDateTime&&V.hasProgramDateTime?(Object(x.alignMediaPlaylistByPDT)(E,V),j=E.fragments[0].start):j=this.alignPlaylists(E,F.details)}F.details=E,this.levelLastLoaded=L,!this.startFragRequested&&(this.mainDetails||!E.live)&&this.setStartPosition(F.details,j),this.state===k.State.WAITING_TRACK&&!this.waitForCdnTuneIn(E)&&(this.state=k.State.IDLE),this.tick()},d._handleFragmentLoadProgress=function(s){var o,g=s.frag,p=s.part,E=s.payload,L=this.config,F=this.trackId,j=this.levels;if(!j){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+g.sn+" of level "+g.level+" will not be buffered");return}var V=j[F];console.assert(V,"Audio track is defined on fragment load progress");var B=V.details;console.assert(B,"Audio track details are defined on fragment load progress");var I=L.defaultAudioCodec||V.audioCodec||"mp4a.40.2",$=this.transmuxer;$||($=this.transmuxer=new R.default(this.hls,A.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var ie=this.initPTS[g.cc],ue=(o=g.initSegment)===null||o===void 0?void 0:o.data;if(ie!==void 0){var fe=!1,ve=p?p.index:-1,pe=ve!==-1,te=new S.ChunkMetadata(g.level,g.sn,g.stats.chunkCount,E.byteLength,ve,pe);$.push(E,ue,I,"",g,p,B.totalduration,fe,te,ie)}else{l.logger.log("Unknown video PTS for cc "+g.cc+", waiting for video PTS before demuxing audio frag "+g.sn+" of ["+B.startSN+" ,"+B.endSN+"],track "+F);var ee=this.waitingData=this.waitingData||{frag:g,part:p,cache:new C.default,complete:!1},se=ee.cache;se.push(new Uint8Array(E)),this.waitingVideoCC=this.videoTrackCC,this.state=k.State.WAITING_INIT_PTS}},d._handleFragmentLoadComplete=function(s){if(this.waitingData){this.waitingData.complete=!0;return}u.prototype._handleFragmentLoadComplete.call(this,s)},d.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},d.onBufferCreated=function(s,o){var g=o.tracks.audio;g&&(this.mediaBuffer=g.buffer),o.tracks.video&&(this.videoBuffer=o.tracks.video.buffer)},d.onFragBuffered=function(s,o){var g=o.frag,p=o.part;if(g.type!==A.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(g)){this.warn("Fragment "+g.sn+(p?" p: "+p.index:"")+" of level "+g.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}g.sn!=="initSegment"&&(this.fragPrevious=g,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(P.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(g,p)},d.onError=function(s,o){switch(o.details){case f.ErrorDetails.FRAG_LOAD_ERROR:case f.ErrorDetails.FRAG_LOAD_TIMEOUT:case f.ErrorDetails.KEY_LOAD_ERROR:case f.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(A.PlaylistLevelType.AUDIO,o);break;case f.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case f.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==k.State.ERROR&&this.state!==k.State.STOPPED&&(this.state=o.fatal?k.State.ERROR:k.State.IDLE,this.warn(o.details+" while loading frag, switching to "+this.state+" state"));break;case f.ErrorDetails.BUFFER_FULL_ERROR:if(o.parent==="audio"&&(this.state===k.State.PARSING||this.state===k.State.PARSED)){var g=!0,p=this.getFwdBufferInfo(this.mediaBuffer,A.PlaylistLevelType.AUDIO);p&&p.len>.5&&(g=!this.reduceMaxBufferLength(p.len)),g&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,u.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},d.onBufferFlushed=function(s,o){var g=o.type;g===T.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},d._handleTransmuxComplete=function(s){var o,g="audio",p=this.hls,E=s.remuxResult,L=s.chunkMeta,F=this.getCurrentContext(L);if(!F){this.warn("The loading context changed while buffering fragment "+L.sn+" of level "+L.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(L.level);return}var j=F.frag,V=F.part,B=E.audio,I=E.text,$=E.id3,ie=E.initSegment;if(this.fragContextChanged(j))return;if(this.state=k.State.PARSING,this.audioSwitch&&B&&this.completeAudioSwitch(),ie!=null&&ie.tracks&&(this._bufferInitSegment(ie.tracks,j,L),p.trigger(P.Events.FRAG_PARSING_INIT_SEGMENT,{frag:j,id:g,tracks:ie.tracks})),B){var ue=B.startPTS,fe=B.endPTS,ve=B.startDTS,pe=B.endDTS;V&&(V.elementaryStreams[T.ElementaryStreamTypes.AUDIO]={startPTS:ue,endPTS:fe,startDTS:ve,endDTS:pe}),j.setElementaryStreamInfo(T.ElementaryStreamTypes.AUDIO,ue,fe,ve,pe),this.bufferFragmentData(B,j,V,L)}if($!=null&&(o=$.samples)!==null&&o!==void 0&&o.length){var te=i({frag:j,id:g},$);p.trigger(P.Events.FRAG_PARSING_METADATA,te)}if(I){var ee=i({frag:j,id:g},I);p.trigger(P.Events.FRAG_PARSING_USERDATA,ee)}},d._bufferInitSegment=function(s,o,g){if(this.state!==k.State.PARSING)return;s.video&&delete s.video;var p=s.audio;if(!p)return;p.levelCodec=p.codec,p.id="audio",this.log("Init audio buffer, container:"+p.container+", codecs[parsed]=["+p.codec+"]"),this.hls.trigger(P.Events.BUFFER_CODECS,s);var E=p.initSegment;if(E!=null&&E.byteLength){var L={type:"audio",frag:o,part:null,chunkMeta:g,parent:o.type,data:E};this.hls.trigger(P.Events.BUFFER_APPENDING,L)}this.tick()},d.loadFragment=function(s,o,g){var p=this.fragmentTracker.getState(s);this.fragCurrent=s,(this.audioSwitch||p===M.FragmentState.NOT_LOADED||p===M.FragmentState.PARTIAL)&&(s.sn==="initSegment"?this._loadInitSegment(s):o.live&&!Object(K.isFiniteNumber)(this.initPTS[s.cc])?(this.log("Waiting for video PTS in continuity counter "+s.cc+" of live stream before loading audio fragment "+s.sn+" of level "+this.trackId),this.state=k.State.WAITING_INIT_PTS):(this.startFragRequested=!0,u.prototype.loadFragment.call(this,s,o,g)))},d.completeAudioSwitch=function(){var s=this.hls,o=this.media,g=this.trackId;o&&(this.log("Switching audio track : flushing all audio"),u.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,s.trigger(P.Events.AUDIO_TRACK_SWITCHED,{id:g})},y}(k.default);G.default=m},"./src/controller/audio-track-controller.ts":function(ne,G,D){"use strict";D.r(G);var K=D("./src/events.ts"),k=D("./src/errors.ts"),P=D("./src/controller/base-playlist-controller.ts"),N=D("./src/types/loader.ts");function M(R,S){for(var b=0;b=l.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var i=l[this.trackId];this.log("Now switching to audio-track index "+f);var c=l[f],_=c.id,v=c.groupId,m=v===void 0?"":v,u=c.name,y=c.type,d=c.url;if(this.trackId=f,this.trackName=u,this.selectDefaultTrack=!1,this.hls.trigger(K.Events.AUDIO_TRACK_SWITCHING,{id:_,groupId:m,name:u,type:y,url:d}),c.details&&!c.details.live)return;var h=this.switchParams(c.url,i==null?void 0:i.details);this.loadPlaylist(h)},b.selectInitialTrack=function(){var f=this.tracksInGroup;console.assert(f.length,"Initial audio track should be selected when tracks are known");var l=this.trackName,i=this.findTrackId(l)||this.findTrackId();i!==-1?this.setAudioTrack(i):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(K.Events.ERROR,{type:k.ErrorTypes.MEDIA_ERROR,details:k.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},b.findTrackId=function(f){for(var l=this.tracksInGroup,i=0;iS.partTarget&&(c+=1)}if(Object(K.isFiniteNumber)(i))return new k.HlsUrlParameters(i,Object(K.isFiniteNumber)(c)?c:void 0,k.HlsSkip.No)}}},T.loadPlaylist=function(R){},T.shouldLoadTrack=function(R){return this.canLoad&&R&&!!R.url&&(!R.details||R.details.live)},T.playlistLoaded=function(R,S,b){var x=this,f=S.details,l=S.stats,i=l.loading.end?Math.max(0,self.performance.now()-l.loading.end):0;if(f.advancedDateTime=Date.now()-i,f.live||b!=null&&b.live){if(f.reloaded(b),b&&this.log("live playlist "+R+" "+(f.advanced?"REFRESHED "+f.lastPartSn+"-"+f.lastPartIndex:"MISSED")),b&&f.fragments.length>0&&Object(P.mergeDetails)(b,f),!this.canLoad||!f.live)return;var c,_=void 0,v=void 0;if(f.canBlockReload&&f.endSN&&f.advanced){var m=this.hls.config.lowLatencyMode,u=f.lastPartSn,y=f.endSN,d=f.lastPartIndex,h=d!==-1,s=u===y,o=m?0:d;h?(_=s?y+1:u,v=s?o:d+1):_=y+1;var g=f.age,p=g+f.ageHeader,E=Math.min(p-f.partTarget,f.targetduration*1.5);if(E>0){if(b&&E>b.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+b.tuneInGoal+" to: "+E+" with playlist age: "+f.age),E=0;else{var L=Math.floor(E/f.targetduration);if(_+=L,v!==void 0){var F=Math.round(E%f.targetduration/f.partTarget);v+=F}this.log("CDN Tune-in age: "+f.ageHeader+"s last advanced "+g.toFixed(2)+"s goal: "+E+" skip sn "+L+" to part "+v)}f.tuneInGoal=E}if(c=this.getDeliveryDirectives(f,S.deliveryDirectives,_,v),m||!s){this.loadPlaylist(c);return}}else c=this.getDeliveryDirectives(f,S.deliveryDirectives,_,v);var j=Object(P.computeReloadInterval)(f,l);_!==void 0&&f.canBlockReload&&(j-=f.partTarget||1),this.log("reload live playlist "+R+" in "+Math.round(j)+" ms"),this.timer=self.setTimeout(function(){return x.loadPlaylist(c)},j)}else this.clearTimer()},T.getDeliveryDirectives=function(R,S,b,x){var f=Object(k.getSkipValue)(R,b);return S!=null&&S.skip&&R.deltaUpdateFailed&&(b=S.msn,x=S.part,f=k.HlsSkip.No),new k.HlsUrlParameters(b,x,f)},T.retryLoadingOrFail=function(R){var S=this,b=this.hls.config,x=this.retryCount-1&&(f=R.context)!==null&&f!==void 0&&f.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+R.details+'"'),this.loadPlaylist();else{var l=Math.min(Math.pow(2,this.retryCount)*b.levelLoadingRetryDelay,b.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return S.loadPlaylist()},l),this.warn("retry playlist loading #"+this.retryCount+" in "+l+' ms after "'+R.details+'"')}}else this.warn('cannot recover from error "'+R.details+'"'),this.clearTimer(),R.fatal=!0;return x},A}()},"./src/controller/base-stream-controller.ts":function(ne,G,D){"use strict";D.r(G),D.d(G,"State",function(){return y}),D.d(G,"default",function(){return d});var K=D("./src/polyfills/number.ts"),k=D("./src/task-loop.ts"),P=D("./src/controller/fragment-tracker.ts"),N=D("./src/utils/buffer-helper.ts"),M=D("./src/utils/logger.ts"),O=D("./src/events.ts"),A=D("./src/errors.ts"),T=D("./src/types/transmuxer.ts"),C=D("./src/utils/mp4-tools.ts"),R=D("./src/utils/discontinuities.ts"),S=D("./src/controller/fragment-finders.ts"),b=D("./src/controller/level-helper.ts"),x=D("./src/loader/fragment-loader.ts"),f=D("./src/crypt/decrypter.ts"),l=D("./src/utils/time-ranges.ts"),i=D("./src/types/loader.ts");function c(h,s){for(var o=0;oie;(V<$||ue)&&(ue&&E.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),E.loader.abort()),this.resetLoadingState())}L&&(this.lastCurrentTime=V),!this.loadedmetadata&&!B.len&&(this.nextLoadPosition=this.startPosition=V),this.tickImmediate()},o.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},o.onKeyLoaded=function(p,E){if(this.state!==y.KEY_LOADING||E.frag!==this.fragCurrent||!this.levels)return;this.state=y.IDLE;var L=this.levels[E.frag.level].details;L&&this.loadFragment(E.frag,L,E.frag.start)},o.onHandlerDestroying=function(){this.stopLoad(),h.prototype.onHandlerDestroying.call(this)},o.onHandlerDestroyed=function(){this.state=y.STOPPED,this.hls.off(O.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,h.prototype.onHandlerDestroyed.call(this)},o.loadKey=function(p,E){this.log("Loading key for "+p.sn+" of ["+E.startSN+"-"+E.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+p.level),this.state=y.KEY_LOADING,this.fragCurrent=p,this.hls.trigger(O.Events.KEY_LOADING,{frag:p})},o.loadFragment=function(p,E,L){this._loadFragForPlayback(p,E,L)},o._loadFragForPlayback=function(p,E,L){var F=this,j=function(B){if(F.fragContextChanged(p)){F.warn("Fragment "+p.sn+(B.part?" p: "+B.part.index:"")+" of level "+p.level+" was dropped during download."),F.fragmentTracker.removeFragment(p);return}p.stats.chunkCount++,F._handleFragmentLoadProgress(B)};this._doFragLoad(p,E,L,j).then(function(V){if(!V)return;F.fragLoadError=0;var B=F.state;if(F.fragContextChanged(p)){(B===y.FRAG_LOADING||B===y.BACKTRACKING||!F.fragCurrent&&B===y.PARSING)&&(F.fragmentTracker.removeFragment(p),F.state=y.IDLE);return}if("payload"in V&&(F.log("Loaded fragment "+p.sn+" of level "+p.level),F.hls.trigger(O.Events.FRAG_LOADED,V),F.state===y.BACKTRACKING)){F.fragmentTracker.backtrack(p,V),F.resetFragmentLoading(p);return}F._handleFragmentLoadComplete(V)}).catch(function(V){F.warn(V),F.resetFragmentLoading(p)})},o.flushMainBuffer=function(p,E,L){if(L===void 0&&(L=null),!(p-E))return;var F={startOffset:p,endOffset:E,type:L};this.fragLoadError=0,this.hls.trigger(O.Events.BUFFER_FLUSHING,F)},o._loadInitSegment=function(p){var E=this;this._doFragLoad(p).then(function(L){if(!L||E.fragContextChanged(p)||!E.levels)throw new Error("init load aborted");return L}).then(function(L){var F=E.hls,j=L.payload,V=p.decryptdata;if(j&&j.byteLength>0&&V&&V.key&&V.iv&&V.method==="AES-128"){var B=self.performance.now();return E.decrypter.webCryptoDecrypt(new Uint8Array(j),V.key.buffer,V.iv.buffer).then(function(I){var $=self.performance.now();return F.trigger(O.Events.FRAG_DECRYPTED,{frag:p,payload:I,stats:{tstart:B,tdecrypt:$}}),L.payload=I,L})}return L}).then(function(L){var F=E.fragCurrent,j=E.hls,V=E.levels;if(!V)throw new Error("init load aborted, missing levels");var B=V[p.level].details;console.assert(B,"Level details are defined when init segment is loaded");var I=p.stats;E.state=y.IDLE,E.fragLoadError=0,p.data=new Uint8Array(L.payload),I.parsing.start=I.buffering.start=self.performance.now(),I.parsing.end=I.buffering.end=self.performance.now(),L.frag===F&&j.trigger(O.Events.FRAG_BUFFERED,{stats:I,frag:F,part:null,id:p.type}),E.tick()}).catch(function(L){E.warn(L),E.resetFragmentLoading(p)})},o.fragContextChanged=function(p){var E=this.fragCurrent;return!p||!E||p.level!==E.level||p.sn!==E.sn||p.urlId!==E.urlId},o.fragBufferedComplete=function(p,E){var L=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+p.type+" sn: "+p.sn+(E?" part: "+E.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+p.level+" "+l.default.toString(N.BufferHelper.getBuffered(L))),this.state=y.IDLE,this.tick()},o._handleFragmentLoadComplete=function(p){var E=this.transmuxer;if(!E)return;var L=p.frag,F=p.part,j=p.partsLoaded,V=!j||j.length===0||j.some(function(I){return!I}),B=new T.ChunkMetadata(L.level,L.sn,L.stats.chunkCount+1,0,F?F.index:-1,!V);E.flush(B)},o._handleFragmentLoadProgress=function(p){},o._doFragLoad=function(p,E,L,F){var j=this;if(L===void 0&&(L=null),!this.levels)throw new Error("frag load aborted, missing levels");if(L=Math.max(p.start,L||0),this.config.lowLatencyMode&&E){var V=E.partList;if(V&&F){L>p.end&&E.fragmentHint&&(p=E.fragmentHint);var B=this.getNextPart(V,p,L);if(B>-1){var I=V[B];return this.log("Loading part sn: "+p.sn+" p: "+I.index+" cc: "+p.cc+" of playlist ["+E.startSN+"-"+E.endSN+"] parts [0-"+B+"-"+(V.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+p.level+", target: "+parseFloat(L.toFixed(3))),this.nextLoadPosition=I.start+I.duration,this.state=y.FRAG_LOADING,this.hls.trigger(O.Events.FRAG_LOADING,{frag:p,part:V[B],targetBufferTime:L}),this.doFragPartsLoad(p,V,B,F).catch(function($){return j.handleFragLoadError($)})}else if(!p.url||this.loadedEndOfParts(V,L))return Promise.resolve(null)}}return this.log("Loading fragment "+p.sn+" cc: "+p.cc+" "+(E?"of ["+E.startSN+"-"+E.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+p.level+", target: "+parseFloat(L.toFixed(3))),Object(K.isFiniteNumber)(p.sn)&&!this.bitrateTest&&(this.nextLoadPosition=p.start+p.duration),this.state=y.FRAG_LOADING,this.hls.trigger(O.Events.FRAG_LOADING,{frag:p,targetBufferTime:L}),this.fragmentLoader.load(p,F).catch(function($){return j.handleFragLoadError($)})},o.doFragPartsLoad=function(p,E,L,F){var j=this;return new Promise(function(V,B){var I=[],$=function ie(ue){var fe=E[ue];j.fragmentLoader.loadPart(p,fe,F).then(function(ve){I[fe.index]=ve;var pe=ve.part;j.hls.trigger(O.Events.FRAG_LOADED,ve);var te=E[ue+1];if(te&&te.fragment===p)ie(ue+1);else return V({frag:p,part:pe,partsLoaded:I})}).catch(B)};$(L)})},o.handleFragLoadError=function(p){var E=p.data;return E&&E.details===A.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(E.frag,E.part):this.hls.trigger(O.Events.ERROR,E),null},o._handleTransmuxerFlush=function(p){var E=this.getCurrentContext(p);if(!E||this.state!==y.PARSING){this.fragCurrent||(this.state=y.IDLE);return}var L=E.frag,F=E.part,j=E.level,V=self.performance.now();L.stats.parsing.end=V,F&&(F.stats.parsing.end=V),this.updateLevelTiming(L,F,j,p.partial)},o.getCurrentContext=function(p){var E=this.levels,L=p.level,F=p.sn,j=p.part;if(!E||!E[L])return this.warn("Levels object was unset while buffering fragment "+F+" of level "+L+". The current chunk will not be buffered."),null;var V=E[L],B=j>-1?Object(b.getPartWith)(V,F,j):null,I=B?B.fragment:Object(b.getFragmentWithSN)(V,F,this.fragCurrent);return I?{frag:I,part:B,level:V}:null},o.bufferFragmentData=function(p,E,L,F){if(!p||this.state!==y.PARSING)return;var j=p.data1,V=p.data2,B=j;if(j&&V&&(B=Object(C.appendUint8Array)(j,V)),!B||!B.length)return;var I={type:p.type,frag:E,part:L,chunkMeta:F,parent:E.type,data:B};this.hls.trigger(O.Events.BUFFER_APPENDING,I),p.dropped&&p.independent&&!L&&this.flushBufferGap(E)},o.flushBufferGap=function(p){var E=this.media;if(!E)return;if(!N.BufferHelper.isBuffered(E,E.currentTime)){this.flushMainBuffer(0,p.start);return}var L=E.currentTime,F=N.BufferHelper.bufferInfo(E,L,0),j=p.duration,V=Math.min(this.config.maxFragLookUpTolerance*2,j*.25),B=Math.max(Math.min(p.start-V,F.end-V),L+V);p.start-B>V&&this.flushMainBuffer(B,p.start)},o.getFwdBufferInfo=function(p,E){var L=this.config,F=this.getLoadPosition();if(!Object(K.isFiniteNumber)(F))return null;var j=N.BufferHelper.bufferInfo(p,F,L.maxBufferHole);if(j.len===0&&j.nextStart!==void 0){var V=this.fragmentTracker.getBufferedFrag(F,E);if(V&&j.nextStart=L?(E.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+E.maxMaxBufferLength+"s"),!0):!1},o.getNextFragment=function(p,E){var L,F,j=E.fragments,V=j.length;if(!V)return null;var B=this.config,I=j[0].start,$;if(E.live){var ie=B.initialLiveManifestSize;if(V-1&&L<$.start)break;var ie=$.loaded;!ie&&(j||$.independent||V)&&$.fragment===E&&(F=B),j=ie}return F},o.loadedEndOfParts=function(p,E){var L=p[p.length-1];return L&&E>L.start&&L.loaded},o.getInitialLiveFragment=function(p,E){var L=this.fragPrevious,F=null;if(L){if(p.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+L.programDateTime),F=Object(S.findFragmentByPDT)(E,L.endProgramDateTime,this.config.maxFragLookUpTolerance)),!F){var j=L.sn+1;if(j>=p.startSN&&j<=p.endSN){var V=E[j-p.startSN];L.cc===V.cc&&(F=V,this.log("Live playlist, switching playlist, load frag with next SN: "+F.sn))}F||(F=Object(S.findFragWithCC)(E,L.cc),F&&this.log("Live playlist, switching playlist, load frag with same CC: "+F.sn))}}else{var B=this.hls.liveSyncPosition;B!==null&&(F=this.getFragmentAtPosition(B,this.bitrateTest?p.fragmentEnd:p.edge,p))}return F},o.getFragmentAtPosition=function(p,E,L){var F=this.config,j=this.fragPrevious,V=L.fragments,B=L.endSN,I=L.fragmentHint,$=F.maxFragLookUpTolerance,ie=!!(F.lowLatencyMode&&L.partList&&I);ie&&I&&!this.bitrateTest&&(V=V.concat(I),B=I.sn);var ue;if(pE-$?0:$;ue=Object(S.findFragmentByPTS)(j,V,p,fe)}else ue=V[V.length-1];if(ue){var ve=ue.sn-L.startSN,pe=j&&ue.level===j.level,te=V[ve+1],ee=this.fragmentTracker.getState(ue);if(ee===P.FragmentState.BACKTRACKED){ue=null;for(var se=ve;V[se]&&this.fragmentTracker.getState(V[se])===P.FragmentState.BACKTRACKED;)j?ue=V[se--]:ue=V[--se];ue||(ue=te)}else j&&ue.sn===j.sn&&!ie&&(pe&&(ue.sn=V-E.maxFragLookUpTolerance&&j<=B;if(F!==null&&L.duration>F&&(j"+p.startSN+" prev-sn: "+(j?j.sn:"na")+" fragments: "+B),ue}return I},o.waitForCdnTuneIn=function(p){var E=3;return p.live&&p.canBlockReload&&p.tuneInGoal>Math.max(p.partHoldBack,p.partTarget*E)},o.setStartPosition=function(p,E){var L=this.startPosition;if(L"+p))}}]),s}(k.default)},"./src/controller/buffer-controller.ts":function(ne,G,D){"use strict";D.r(G),D.d(G,"default",function(){return S});var K=D("./src/polyfills/number.ts"),k=D("./src/events.ts"),P=D("./src/utils/logger.ts"),N=D("./src/errors.ts"),M=D("./src/utils/buffer-helper.ts"),O=D("./src/utils/mediasource-helper.ts"),A=D("./src/loader/fragment.ts"),T=D("./src/controller/buffer-operation-queue.ts"),C=Object(O.getMediaSource)(),R=/([ha]vc.)(?:\.[^.,]+)+/,S=function(){function b(f){var l=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 i=l.hls,c=l.media,_=l.mediaSource;P.logger.log("[buffer-controller]: Media source opened"),c&&(l.updateMediaElementDuration(),i.trigger(k.Events.MEDIA_ATTACHED,{media:c})),_&&_.removeEventListener("sourceopen",l._onMediaSourceOpen),l.checkPendingTracks()},this._onMediaSourceClose=function(){P.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){P.logger.log("[buffer-controller]: Media source ended")},this.hls=f,this._initSourceBuffer(),this.registerListeners()}var x=b.prototype;return x.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},x.destroy=function(){this.unregisterListeners(),this.details=null},x.registerListeners=function(){var l=this.hls;l.on(k.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),l.on(k.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.on(k.Events.MANIFEST_PARSED,this.onManifestParsed,this),l.on(k.Events.BUFFER_RESET,this.onBufferReset,this),l.on(k.Events.BUFFER_APPENDING,this.onBufferAppending,this),l.on(k.Events.BUFFER_CODECS,this.onBufferCodecs,this),l.on(k.Events.BUFFER_EOS,this.onBufferEos,this),l.on(k.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),l.on(k.Events.LEVEL_UPDATED,this.onLevelUpdated,this),l.on(k.Events.FRAG_PARSED,this.onFragParsed,this),l.on(k.Events.FRAG_CHANGED,this.onFragChanged,this)},x.unregisterListeners=function(){var l=this.hls;l.off(k.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),l.off(k.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.off(k.Events.MANIFEST_PARSED,this.onManifestParsed,this),l.off(k.Events.BUFFER_RESET,this.onBufferReset,this),l.off(k.Events.BUFFER_APPENDING,this.onBufferAppending,this),l.off(k.Events.BUFFER_CODECS,this.onBufferCodecs,this),l.off(k.Events.BUFFER_EOS,this.onBufferEos,this),l.off(k.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),l.off(k.Events.LEVEL_UPDATED,this.onLevelUpdated,this),l.off(k.Events.FRAG_PARSED,this.onFragParsed,this),l.off(k.Events.FRAG_CHANGED,this.onFragChanged,this)},x._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new T.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},x.onManifestParsed=function(l,i){var c=2;(i.audio&&!i.video||!i.altAudio)&&(c=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=c,this.details=null,P.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},x.onMediaAttaching=function(l,i){var c=this.media=i.media;if(c&&C){var _=this.mediaSource=new C;_.addEventListener("sourceopen",this._onMediaSourceOpen),_.addEventListener("sourceended",this._onMediaSourceEnded),_.addEventListener("sourceclose",this._onMediaSourceClose),c.src=self.URL.createObjectURL(_),this._objectUrl=c.src}},x.onMediaDetaching=function(){var l=this.media,i=this.mediaSource,c=this._objectUrl;if(i){if(P.logger.log("[buffer-controller]: media source detaching"),i.readyState==="open")try{i.endOfStream()}catch(_){P.logger.warn("[buffer-controller]: onMediaDetaching: "+_.message+" while calling endOfStream")}this.onBufferReset(),i.removeEventListener("sourceopen",this._onMediaSourceOpen),i.removeEventListener("sourceended",this._onMediaSourceEnded),i.removeEventListener("sourceclose",this._onMediaSourceClose),l&&(c&&self.URL.revokeObjectURL(c),l.src===c?(l.removeAttribute("src"),l.load()):P.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(k.Events.MEDIA_DETACHED,void 0)},x.onBufferReset=function(){var l=this;this.getSourceBufferTypes().forEach(function(i){var c=l.sourceBuffer[i];try{c&&(l.removeBufferListeners(i),l.mediaSource&&l.mediaSource.removeSourceBuffer(c),l.sourceBuffer[i]=void 0)}catch(_){P.logger.warn("[buffer-controller]: Failed to reset the "+i+" buffer",_)}}),this._initSourceBuffer()},x.onBufferCodecs=function(l,i){var c=this,_=this.getSourceBufferTypes().length;if(Object.keys(i).forEach(function(v){if(_){var m=c.tracks[v];if(m&&typeof m.buffer.changeType=="function"){var u=i[v],y=u.codec,d=u.levelCodec,h=u.container,s=(m.levelCodec||m.codec).replace(R,"$1"),o=(d||y).replace(R,"$1");if(s!==o){var g=h+";codecs="+(d||y);c.appendChangeType(v,g)}}}else c.pendingTracks[v]=i[v]}),_)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},x.appendChangeType=function(l,i){var c=this,_=this.operationQueue,v={execute:function(){var u=c.sourceBuffer[l];u&&(P.logger.log("[buffer-controller]: changing "+l+" sourceBuffer type to "+i),u.changeType(i)),_.shiftAndExecuteNext(l)},onStart:function(){},onComplete:function(){},onError:function(u){P.logger.warn("[buffer-controller]: Failed to change "+l+" SourceBuffer type",u)}};_.append(v,l)},x.onBufferAppending=function(l,i){var c=this,_=this.hls,v=this.operationQueue,m=this.tracks,u=i.data,y=i.type,d=i.frag,h=i.part,s=i.chunkMeta,o=s.buffering[y],g=self.performance.now();o.start=g;var p=d.stats.buffering,E=h?h.stats.buffering:null;p.start===0&&(p.start=g),E&&E.start===0&&(E.start=g);var L=m.audio,F=y==="audio"&&s.id===1&&(L==null?void 0:L.container)==="audio/mpeg",j={execute:function(){if(o.executeStart=self.performance.now(),F){var B=c.sourceBuffer[y];if(B){var I=d.start-B.timestampOffset;Math.abs(I)>=.1&&(P.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+d.start+" (delta: "+I+") sn: "+d.sn+")"),B.timestampOffset=d.start)}}c.appendExecutor(u,y)},onStart:function(){},onComplete:function(){var B=self.performance.now();o.executeEnd=o.end=B,p.first===0&&(p.first=B),E&&E.first===0&&(E.first=B);var I=c.sourceBuffer,$={};for(var ie in I)$[ie]=M.BufferHelper.getBuffered(I[ie]);c.appendError=0,c.hls.trigger(k.Events.BUFFER_APPENDED,{type:y,frag:d,part:h,chunkMeta:s,parent:d.type,timeRanges:$})},onError:function(B){P.logger.error("[buffer-controller]: Error encountered while trying to append to the "+y+" SourceBuffer",B);var I={type:N.ErrorTypes.MEDIA_ERROR,parent:d.type,details:N.ErrorDetails.BUFFER_APPEND_ERROR,err:B,fatal:!1};B.code===DOMException.QUOTA_EXCEEDED_ERR?I.details=N.ErrorDetails.BUFFER_FULL_ERROR:(c.appendError++,I.details=N.ErrorDetails.BUFFER_APPEND_ERROR,c.appendError>_.config.appendErrorMaxRetry&&(P.logger.error("[buffer-controller]: Failed "+_.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),I.fatal=!0)),_.trigger(k.Events.ERROR,I)}};v.append(j,y)},x.onBufferFlushing=function(l,i){var c=this,_=this.operationQueue,v=function(u){return{execute:c.removeExecutor.bind(c,u,i.startOffset,i.endOffset),onStart:function(){},onComplete:function(){c.hls.trigger(k.Events.BUFFER_FLUSHED,{type:u})},onError:function(d){P.logger.warn("[buffer-controller]: Failed to remove from "+u+" SourceBuffer",d)}}};i.type?_.append(v(i.type),i.type):this.getSourceBufferTypes().forEach(function(m){_.append(v(m),m)})},x.onFragParsed=function(l,i){var c=this,_=i.frag,v=i.part,m=[],u=v?v.elementaryStreams:_.elementaryStreams;u[A.ElementaryStreamTypes.AUDIOVIDEO]?m.push("audiovideo"):(u[A.ElementaryStreamTypes.AUDIO]&&m.push("audio"),u[A.ElementaryStreamTypes.VIDEO]&&m.push("video"));var y=function(){var h=self.performance.now();_.stats.buffering.end=h,v&&(v.stats.buffering.end=h);var s=v?v.stats:_.stats;c.hls.trigger(k.Events.FRAG_BUFFERED,{frag:_,part:v,stats:s,id:_.type})};m.length===0&&P.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+_.type+" level: "+_.level+" sn: "+_.sn),this.blockBuffers(y,m)},x.onFragChanged=function(l,i){this.flushBackBuffer()},x.onBufferEos=function(l,i){var c=this,_=this.getSourceBufferTypes().reduce(function(v,m){var u=c.sourceBuffer[m];return(!i.type||i.type===m)&&(u&&!u.ended&&(u.ended=!0,P.logger.log("[buffer-controller]: "+m+" sourceBuffer now EOS"))),v&&!!(!u||u.ended)},!0);_&&this.blockBuffers(function(){var v=c.mediaSource;if(!v||v.readyState!=="open")return;v.endOfStream()})},x.onLevelUpdated=function(l,i){var c=i.details;if(!c.fragments.length)return;this.details=c,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},x.flushBackBuffer=function(){var l=this.hls,i=this.details,c=this.media,_=this.sourceBuffer;if(!c||i===null)return;var v=this.getSourceBufferTypes();if(!v.length)return;var m=i.live&&l.config.liveBackBufferLength!==null?l.config.liveBackBufferLength:l.config.backBufferLength;if(!Object(K.isFiniteNumber)(m)||m<0)return;var u=c.currentTime,y=i.levelTargetDuration,d=Math.max(m,y),h=Math.floor(u/y)*y-d;v.forEach(function(s){var o=_[s];if(o){var g=M.BufferHelper.getBuffered(o);g.length>0&&h>g.start(0)&&(l.trigger(k.Events.BACK_BUFFER_REACHED,{bufferEnd:h}),i.live&&l.trigger(k.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:h}),l.trigger(k.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:h,type:s}))}})},x.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var l=this.details,i=this.hls,c=this.media,_=this.mediaSource,v=l.fragments[0].start+l.totalduration,m=c.duration,u=Object(K.isFiniteNumber)(_.duration)?_.duration:0;l.live&&i.config.liveDurationInfinity?(P.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),_.duration=Infinity,this.updateSeekableRange(l)):(v>u&&v>m||!Object(K.isFiniteNumber)(m))&&(P.logger.log("[buffer-controller]: Updating Media Source duration to "+v.toFixed(3)),_.duration=v)},x.updateSeekableRange=function(l){var i=this.mediaSource,c=l.fragments,_=c.length;if(_&&l.live&&i!==null&&i!==void 0&&i.setLiveSeekableRange){var v=Math.max(0,c[0].start),m=Math.max(v,v+l.totalduration);i.setLiveSeekableRange(v,m)}},x.checkPendingTracks=function(){var l=this.bufferCodecEventsExpected,i=this.operationQueue,c=this.pendingTracks,_=Object.keys(c).length;if(_&&!l||_===2){this.createSourceBuffers(c),this.pendingTracks={};var v=this.getSourceBufferTypes();if(v.length===0){this.hls.trigger(k.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}v.forEach(function(m){i.executeNext(m)})}},x.createSourceBuffers=function(l){var i=this.sourceBuffer,c=this.mediaSource;if(!c)throw Error("createSourceBuffers called when mediaSource was null");var _=0;for(var v in l)if(!i[v]){var m=l[v];if(!m)throw Error("source buffer exists for track "+v+", however track does not");var u=m.levelCodec||m.codec,y=m.container+";codecs="+u;P.logger.log("[buffer-controller]: creating sourceBuffer("+y+")");try{var d=i[v]=c.addSourceBuffer(y),h=v;this.addBufferListener(h,"updatestart",this._onSBUpdateStart),this.addBufferListener(h,"updateend",this._onSBUpdateEnd),this.addBufferListener(h,"error",this._onSBUpdateError),this.tracks[v]={buffer:d,codec:u,container:m.container,levelCodec:m.levelCodec,id:m.id},_++}catch(s){P.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+s.message),this.hls.trigger(k.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:s,mimeType:y})}}_&&this.hls.trigger(k.Events.BUFFER_CREATED,{tracks:this.tracks})},x._onSBUpdateStart=function(l){var i=this.operationQueue,c=i.current(l);c.onStart()},x._onSBUpdateEnd=function(l){var i=this.operationQueue,c=i.current(l);c.onComplete(),i.shiftAndExecuteNext(l)},x._onSBUpdateError=function(l,i){P.logger.error("[buffer-controller]: "+l+" SourceBuffer error",i),this.hls.trigger(k.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var c=this.operationQueue.current(l);c&&c.onError(i)},x.removeExecutor=function(l,i,c){var _=this.media,v=this.mediaSource,m=this.operationQueue,u=this.sourceBuffer,y=u[l];if(!_||!v||!y){P.logger.warn("[buffer-controller]: Attempting to remove from the "+l+" SourceBuffer, but it does not exist"),m.shiftAndExecuteNext(l);return}var d=Object(K.isFiniteNumber)(_.duration)?_.duration:Infinity,h=Object(K.isFiniteNumber)(v.duration)?v.duration:Infinity,s=Math.max(0,i),o=Math.min(c,d,h);o>s?(P.logger.log("[buffer-controller]: Removing ["+s+","+o+"] from the "+l+" SourceBuffer"),console.assert(!y.updating,l+" sourceBuffer must not be updating"),y.remove(s,o)):m.shiftAndExecuteNext(l)},x.appendExecutor=function(l,i){var c=this.operationQueue,_=this.sourceBuffer,v=_[i];if(!v){P.logger.warn("[buffer-controller]: Attempting to append to the "+i+" SourceBuffer, but it does not exist"),c.shiftAndExecuteNext(i);return}v.ended=!1,console.assert(!v.updating,i+" sourceBuffer must not be updating"),v.appendBuffer(l)},x.blockBuffers=function(l,i){var c=this;if(i===void 0&&(i=this.getSourceBufferTypes()),!i.length){P.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(l);return}var _=this.operationQueue,v=i.map(function(m){return _.appendBlocker(m)});Promise.all(v).then(function(){l(),i.forEach(function(m){var u=c.sourceBuffer[m];(!u||!u.updating)&&_.shiftAndExecuteNext(m)})})},x.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},x.addBufferListener=function(l,i,c){var _=this.sourceBuffer[l];if(!_)return;var v=c.bind(this,l);this.listeners[l].push({event:i,listener:v}),_.addEventListener(i,v)},x.removeBufferListeners=function(l){var i=this.sourceBuffer[l];if(!i)return;this.listeners[l].forEach(function(c){i.removeEventListener(c.event,c.listener)})},b}()},"./src/controller/buffer-operation-queue.ts":function(ne,G,D){"use strict";D.r(G),D.d(G,"default",function(){return k});var K=D("./src/utils/logger.ts"),k=function(){function P(M){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=M}var N=P.prototype;return N.append=function(O,A){var T=this.queues[A];T.push(O),T.length===1&&this.buffers[A]&&this.executeNext(A)},N.insertAbort=function(O,A){var T=this.queues[A];T.unshift(O),this.executeNext(A)},N.appendBlocker=function(O){var A,T=new Promise(function(R){A=R}),C={execute:A,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(C,O),T},N.executeNext=function(O){var A=this.buffers,T=this.queues,C=A[O],R=T[O];if(R.length){var S=R[0];try{S.execute()}catch(b){K.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),S.onError(b),(!C||!C.updating)&&(R.shift(),this.executeNext(O))}}},N.shiftAndExecuteNext=function(O){this.queues[O].shift(),this.executeNext(O)},N.current=function(O){return this.queues[O][0]},P}()},"./src/controller/cap-level-controller.ts":function(ne,G,D){"use strict";D.r(G);var K=D("./src/events.ts");function k(M,O){for(var A=0;A0&&this.mediaWidth>0){var T=this.hls.levels;if(T.length){var C=this.hls;C.autoLevelCapping=this.getMaxLevel(T.length-1),C.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=C.autoLevelCapping}}},O.getMaxLevel=function(T){var C=this,R=this.hls.levels;if(!R.length)return-1;var S=R.filter(function(b,x){return M.isLevelAllowed(x,C.restrictedLevels)&&x<=T});return this.clientRect=null,M.getMaxLevelByMediaSize(S,this.mediaWidth,this.mediaHeight)},O.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()},O.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},O.getDimensions=function(){if(this.clientRect)return this.clientRect;var T=this.media,C={width:0,height:0};if(T){var R=T.getBoundingClientRect();C.width=R.width,C.height=R.height,!C.width&&!C.height&&(C.width=R.right-R.left||T.width||0,C.height=R.bottom-R.top||T.height||0)}return this.clientRect=C,C},M.isLevelAllowed=function(T,C){return C===void 0&&(C=[]),C.indexOf(T)===-1},M.getMaxLevelByMediaSize=function(T,C,R){if(!T||!T.length)return-1;for(var S=function(i,c){return c?i.width!==c.width||i.height!==c.height:!0},b=T.length-1,x=0;x=C||f.height>=R)&&S(f,T[x+1])){b=x;break}}return b},P(M,[{key:"mediaWidth",get:function(){return this.getDimensions().width*M.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*M.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var T=1;try{T=self.devicePixelRatio}catch(C){}return T}}]),M}();G.default=N},"./src/controller/cmcd-controller.ts":function(ne,G,D){"use strict";D.r(G),D.d(G,"default",function(){return S});var K=D("./src/events.ts"),k=D("./src/types/cmcd.ts"),P=D("./src/utils/buffer-helper.ts"),N=D("./src/utils/logger.ts");function M(b,x){for(var f=0;f=b.length?{done:!0}:{done:!1,value:b[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.`)}function T(b,x){if(!b)return;if(typeof b=="string")return C(b,x);var f=Object.prototype.toString.call(b).slice(8,-1);if(f==="Object"&&b.constructor&&(f=b.constructor.name),f==="Map"||f==="Set")return Array.from(b);if(f==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(f))return C(b,x)}function C(b,x){(x==null||x>b.length)&&(x=b.length);for(var f=0,l=new Array(x);fi&&(i=m.bitrate)}return i>0?i:NaN},x.getBufferLength=function(l){var i=this.hls.media,c=l===k.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!c||!i)return NaN;var _=P.BufferHelper.bufferInfo(c,i.currentTime,this.config.maxBufferHole);return _.len*1e3},x.createPlaylistLoader=function(){var l=this.config.pLoader,i=this.applyPlaylistData,c=l||this.config.loader;return function(){function _(m){this.loader=void 0,this.loader=new c(m)}var v=_.prototype;return v.destroy=function(){this.loader.destroy()},v.abort=function(){this.loader.abort()},v.load=function(u,y,d){i(u),this.loader.load(u,y,d)},O(_,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),_}()},x.createFragmentLoader=function(){var l=this.config.fLoader,i=this.applyFragmentData,c=l||this.config.loader;return function(){function _(m){this.loader=void 0,this.loader=new c(m)}var v=_.prototype;return v.destroy=function(){this.loader.destroy()},v.abort=function(){this.loader.abort()},v.load=function(u,y,d){i(u),this.loader.load(u,y,d)},O(_,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),_}()},b.uuid=function(){var l=URL.createObjectURL(new Blob),i=l.toString();return URL.revokeObjectURL(l),i.substr(i.lastIndexOf("/")+1)},b.serialize=function(l){for(var i=[],c=function(F){return!Number.isNaN(F)&&F!=null&&F!==""&&F!==!1},_=function(F){return Math.round(F)},v=function(F){return _(F/100)*100},m=function(F){return encodeURIComponent(F)},u={br:_,d:_,bl:v,dl:v,mtp:v,nor:m,rtp:v,tb:_},y=Object.keys(l||{}).sort(),d=A(y),h;!(h=d()).done;){var s=h.value,o=l[s];if(!c(o))continue;if(s==="v"&&o===1)continue;if(s=="pr"&&o===1)continue;var g=u[s];g&&(o=g(o));var p=typeof o,E=void 0;s==="ot"||s==="sf"||s==="st"?E=s+"="+o:p==="boolean"?E=s:p==="number"?E=s+"="+o:E=s+"="+JSON.stringify(o),i.push(E)}return i.join(",")},b.toHeaders=function(l){for(var i=Object.keys(l),c={},_=["Object","Request","Session","Status"],v=[{},{},{},{}],m={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},u=0,y=i;uA){this.hls.trigger(K.Events.ERROR,{type:k.ErrorTypes.KEY_SYSTEM_ERROR,details:k.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var m=A-this._requestLicenseFailureCount+1;P.logger.warn("Retrying license request, "+m+" attempts left"),this._requestLicense(i,c)}break}},b._generateLicenseRequestChallenge=function(f,l){switch(f.mediaKeySystemDomain){case N.KeySystems.WIDEVINE:return l}throw new Error("unsupported key-system: "+f.mediaKeySystemDomain)},b._requestLicense=function(f,l){P.logger.log("Requesting content license for key-system");var i=this._mediaKeysList[0];if(!i){P.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(K.Events.ERROR,{type:k.ErrorTypes.KEY_SYSTEM_ERROR,details:k.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var c=this.getLicenseServerUrl(i.mediaKeySystemDomain),_=this._createLicenseXhr(c,f,l);P.logger.log("Sending license request to URL: "+c);var v=this._generateLicenseRequestChallenge(i,f);_.send(v)}catch(m){P.logger.error("Failure requesting DRM license: "+m),this.hls.trigger(K.Events.ERROR,{type:k.ErrorTypes.KEY_SYSTEM_ERROR,details:k.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},b.onMediaAttached=function(f,l){if(!this._emeEnabled)return;var i=l.media;this._media=i,i.addEventListener("encrypted",this._onMediaEncrypted)},b.onMediaDetached=function(){var f=this._media,l=this._mediaKeysList;if(!f)return;f.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(l.map(function(i){if(i.mediaKeysSession)return i.mediaKeysSession.close().catch(function(){})})).then(function(){return f.setMediaKeys(null)}).catch(function(){})},b.onManifestParsed=function(f,l){if(!this._emeEnabled)return;var i=l.levels.map(function(_){return _.audioCodec}).filter(function(_){return!!_}),c=l.levels.map(function(_){return _.videoCodec}).filter(function(_){return!!_});this._attemptKeySystemAccess(N.KeySystems.WIDEVINE,i,c)},O(S,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),S}();G.default=R},"./src/controller/fps-controller.ts":function(ne,G,D){"use strict";D.r(G);var K=D("./src/events.ts"),k=D("./src/utils/logger.ts"),P=function(){function N(O){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=O,this.registerListeners()}var M=N.prototype;return M.setStreamController=function(A){this.streamController=A},M.registerListeners=function(){this.hls.on(K.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},M.unregisterListeners=function(){this.hls.off(K.Events.MEDIA_ATTACHING,this.onMediaAttaching)},M.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},M.onMediaAttaching=function(A,T){var C=this.hls.config;if(C.capLevelOnFPSDrop){var R=T.media instanceof self.HTMLVideoElement?T.media:null;this.media=R,R&&typeof R.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),C.fpsDroppedMonitoringPeriod)}},M.checkFPS=function(A,T,C){var R=performance.now();if(T){if(this.lastTime){var S=R-this.lastTime,b=C-this.lastDroppedFrames,x=T-this.lastDecodedFrames,f=1e3*b/S,l=this.hls;if(l.trigger(K.Events.FPS_DROP,{currentDropped:b,currentDecoded:x,totalDroppedFrames:C}),f>0&&b>l.config.fpsDroppedMonitoringThreshold*x){var i=l.currentLevel;k.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+i),i>0&&(l.autoLevelCapping===-1||l.autoLevelCapping>=i)&&(i=i-1,l.trigger(K.Events.FPS_DROP_LEVEL_CAPPING,{level:i,droppedLevel:l.currentLevel}),l.autoLevelCapping=i,this.streamController.nextLevelSwitch())}}this.lastTime=R,this.lastDroppedFrames=C,this.lastDecodedFrames=T}},M.checkFPSInterval=function(){var A=this.media;if(A)if(this.isVideoPlaybackQualityAvailable){var T=A.getVideoPlaybackQuality();this.checkFPS(A,T.totalVideoFrames,T.droppedVideoFrames)}else this.checkFPS(A,A.webkitDecodedFrameCount,A.webkitDroppedFrameCount)},N}();G.default=P},"./src/controller/fragment-finders.ts":function(ne,G,D){"use strict";D.r(G),D.d(G,"findFragmentByPDT",function(){return P}),D.d(G,"findFragmentByPTS",function(){return N}),D.d(G,"fragmentWithinToleranceTest",function(){return M}),D.d(G,"pdtWithinToleranceTest",function(){return O}),D.d(G,"findFragWithCC",function(){return A});var K=D("./src/polyfills/number.ts"),k=D("./src/utils/binary-search.ts");function P(T,C,R){if(C===null||!Array.isArray(T)||!T.length||!Object(K.isFiniteNumber)(C))return null;var S=T[0].programDateTime;if(C<(S||0))return null;var b=T[T.length-1].endProgramDateTime;if(C>=(b||0))return null;R=R||0;for(var x=0;xT&&R.start?-1:0}function O(T,C,R){var S=Math.min(C,R.duration+(R.deltaPTS?R.deltaPTS:0))*1e3,b=R.endProgramDateTime||0;return b-S>T}function A(T,C){return k.default.search(T,function(R){return R.ccC?-1:0})}},"./src/controller/fragment-tracker.ts":function(ne,G,D){"use strict";D.r(G),D.d(G,"FragmentState",function(){return P}),D.d(G,"FragmentTracker",function(){return N});var K=D("./src/events.ts"),k=D("./src/types/loader.ts"),P;(function(A){A.NOT_LOADED="NOT_LOADED",A.BACKTRACKED="BACKTRACKED",A.APPENDING="APPENDING",A.PARTIAL="PARTIAL",A.OK="OK"})(P||(P={}));var N=function(){function A(C){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=C,this._registerListeners()}var T=A.prototype;return T._registerListeners=function(){var R=this.hls;R.on(K.Events.BUFFER_APPENDED,this.onBufferAppended,this),R.on(K.Events.FRAG_BUFFERED,this.onFragBuffered,this),R.on(K.Events.FRAG_LOADED,this.onFragLoaded,this)},T._unregisterListeners=function(){var R=this.hls;R.off(K.Events.BUFFER_APPENDED,this.onBufferAppended,this),R.off(K.Events.FRAG_BUFFERED,this.onFragBuffered,this),R.off(K.Events.FRAG_LOADED,this.onFragLoaded,this)},T.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},T.getAppendedFrag=function(R,S){if(S===k.PlaylistLevelType.MAIN){var b=this.activeFragment,x=this.activeParts;if(!b)return null;if(x)for(var f=x.length;f--;){var l=x[f],i=l?l.end:b.appendedPTS;if(l.start<=R&&i!==void 0&&R<=i)return f>9&&(this.activeParts=x.slice(f-9)),l}else if(b.start<=R&&b.appendedPTS!==void 0&&R<=b.appendedPTS)return b}return this.getBufferedFrag(R,S)},T.getBufferedFrag=function(R,S){for(var b=this.fragments,x=Object.keys(b),f=x.length;f--;){var l=b[x[f]];if((l==null?void 0:l.body.type)===S&&l.buffered){var i=l.body;if(i.start<=R&&R<=i.end)return i}}return null},T.detectEvictedFragments=function(R,S,b){var x=this;Object.keys(this.fragments).forEach(function(f){var l=x.fragments[f];if(!l)return;if(!l.buffered){l.body.type===b&&x.removeFragment(l.body);return}var i=l.range[R];if(!i)return;i.time.some(function(c){var _=!x.isTimeBuffered(c.startPTS,c.endPTS,S);return _&&x.removeFragment(l.body),_})})},T.detectPartialFragments=function(R){var S=this,b=this.timeRanges,x=R.frag,f=R.part;if(!b||x.sn==="initSegment")return;var l=O(x),i=this.fragments[l];if(!i)return;Object.keys(b).forEach(function(c){var _=x.elementaryStreams[c];if(!_)return;var v=b[c],m=f!==null||_.partial===!0;i.range[c]=S.getBufferedTimes(x,f,m,v)}),i.backtrack=i.loaded=null,Object.keys(i.range).length?i.buffered=!0:this.removeFragment(i.body)},T.fragBuffered=function(R){var S=O(R),b=this.fragments[S];b&&(b.backtrack=b.loaded=null,b.buffered=!0)},T.getBufferedTimes=function(R,S,b,x){for(var f={time:[],partial:b},l=S?S.start:R.start,i=S?S.end:R.end,c=R.minEndPTS||i,_=R.maxStartPTS||l,v=0;v=m&&c<=u){f.time.push({startPTS:Math.max(l,x.start(v)),endPTS:Math.min(i,x.end(v))});break}else if(lm)f.partial=!0,f.time.push({startPTS:Math.max(l,x.start(v)),endPTS:Math.min(i,x.end(v))});else if(i<=m)break}return f},T.getPartialFragment=function(R){var S=null,b,x,f,l=0,i=this.bufferPadding,c=this.fragments;return Object.keys(c).forEach(function(_){var v=c[_];if(!v)return;M(v)&&(x=v.body.start-i,f=v.body.end+i,R>=x&&R<=f&&(b=Math.min(R-x,f-R),l<=b&&(S=v.body,l=b)))}),S},T.getState=function(R){var S=O(R),b=this.fragments[S];return b?b.buffered?M(b)?P.PARTIAL:P.OK:b.backtrack?P.BACKTRACKED:P.APPENDING:P.NOT_LOADED},T.backtrack=function(R,S){var b=O(R),x=this.fragments[b];if(!x||x.backtrack)return null;var f=x.backtrack=S||x.loaded;return x.loaded=null,f},T.getBacktrackData=function(R){var S=O(R),b=this.fragments[S];if(b){var x,f=b.backtrack;if(f!=null&&(x=f.payload)!==null&&x!==void 0&&x.byteLength)return f;this.removeFragment(R)}return null},T.isTimeBuffered=function(R,S,b){for(var x,f,l=0;l=x&&S<=f)return!0;if(S<=x)return!1}return!1},T.onFragLoaded=function(R,S){var b=S.frag,x=S.part;if(b.sn==="initSegment"||b.bitrateTest||x)return;var f=O(b);this.fragments[f]={body:b,loaded:S,backtrack:null,buffered:!1,range:Object.create(null)}},T.onBufferAppended=function(R,S){var b=this,x=S.frag,f=S.part,l=S.timeRanges;if(x.type===k.PlaylistLevelType.MAIN)if(this.activeFragment=x,f){var i=this.activeParts;i||(this.activeParts=i=[]),i.push(f)}else this.activeParts=null;this.timeRanges=l,Object.keys(l).forEach(function(c){var _=l[c];if(b.detectEvictedFragments(c,_),!f)for(var v=0;v<_.length;v++)x.appendedPTS=Math.max(_.end(v),x.appendedPTS||0)})},T.onFragBuffered=function(R,S){this.detectPartialFragments(S)},T.hasFragment=function(R){var S=O(R);return!!this.fragments[S]},T.removeFragmentsInRange=function(R,S,b){var x=this;Object.keys(this.fragments).forEach(function(f){var l=x.fragments[f];if(!l)return;if(l.buffered){var i=l.body;i.type===b&&i.startR&&x.removeFragment(i)}})},T.removeFragment=function(R){var S=O(R);R.stats.loaded=0,R.clearElementaryStreamInfo(),delete this.fragments[S]},T.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},A}();function M(A){var T,C;return A.buffered&&(((T=A.range.video)===null||T===void 0?void 0:T.partial)||((C=A.range.audio)===null||C===void 0?void 0:C.partial))}function O(A){return A.type+"_"+A.level+"_"+A.urlId+"_"+A.sn}},"./src/controller/gap-controller.ts":function(ne,G,D){"use strict";D.r(G),D.d(G,"STALL_MINIMUM_DURATION_MS",function(){return M}),D.d(G,"MAX_START_GAP_JUMP",function(){return O}),D.d(G,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return A}),D.d(G,"SKIP_BUFFER_RANGE_START",function(){return T}),D.d(G,"default",function(){return C});var K=D("./src/utils/buffer-helper.ts"),k=D("./src/errors.ts"),P=D("./src/events.ts"),N=D("./src/utils/logger.ts"),M=250,O=2,A=.1,T=.05,C=function(){function R(b,x,f,l){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=b,this.media=x,this.fragmentTracker=f,this.hls=l}var S=R.prototype;return S.destroy=function(){this.hls=this.fragmentTracker=this.media=null},S.poll=function(x){var f=this.config,l=this.media,i=this.stalled,c=l.currentTime,_=l.seeking,v=this.seeking&&!_,m=!this.seeking&&_;if(this.seeking=_,c!==x){if(this.moved=!0,i!==null){if(this.stallReported){var u=self.performance.now()-i;N.logger.warn("playback not stuck anymore @"+c+", after "+Math.round(u)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((m||v)&&(this.stalled=null),l.paused||l.ended||l.playbackRate===0||!K.BufferHelper.getBuffered(l).length)return;var y=K.BufferHelper.bufferInfo(l,c,0),d=y.len>0,h=y.nextStart||0;if(!d&&!h)return;if(_){var s=y.len>O,o=!h||h-c>O&&!this.fragmentTracker.getPartialFragment(c);if(s||o)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var g,p=Math.max(h,y.start||0)-c,E=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,L=E==null||((g=E.details)===null||g===void 0)?void 0:g.live,F=L?E.details.targetduration*2:O;if(p>0&&p<=F){this._trySkipBufferHole(null);return}}var j=self.performance.now();if(i===null){this.stalled=j;return}var V=j-i;!_&&V>=M&&this._reportStall(y.len);var B=K.BufferHelper.bufferInfo(l,c,f.maxBufferHole);this._tryFixBufferStall(B,V)},S._tryFixBufferStall=function(x,f){var l=this.config,i=this.fragmentTracker,c=this.media,_=c.currentTime,v=i.getPartialFragment(_);if(v){var m=this._trySkipBufferHole(v);if(m)return}x.len>l.maxBufferHole&&f>l.highBufferWatchdogPeriod*1e3&&(N.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},S._reportStall=function(x){var f=this.hls,l=this.media,i=this.stallReported;i||(this.stallReported=!0,N.logger.warn("Playback stalling at @"+l.currentTime+" due to low buffer (buffer="+x+")"),f.trigger(P.Events.ERROR,{type:k.ErrorTypes.MEDIA_ERROR,details:k.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:x}))},S._trySkipBufferHole=function(x){for(var f=this.config,l=this.hls,i=this.media,c=i.currentTime,_=0,v=K.BufferHelper.getBuffered(i),m=0;m=_&&c.05&&this.forwardBufferLength>1){var m=Math.min(2,Math.max(1,l)),u=Math.round(2/(1+Math.exp(-.75*c-this.edgeStalled))*20)/20;R.playbackRate=Math.min(m,Math.max(1,u))}else R.playbackRate!==1&&R.playbackRate!==0&&(R.playbackRate=1)},T.estimateLiveEdge=function(){var R=this.levelDetails;return R===null?null:R.edge+R.age},T.computeLatency=function(){var R=this.estimateLiveEdge();return R===null?null:R-this.currentTime},M(A,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var R=this.config,S=this.levelDetails;return R.liveMaxLatencyDuration!==void 0?R.liveMaxLatencyDuration:S?R.liveMaxLatencyDurationCount*S.targetduration:0}},{key:"targetLatency",get:function(){var R=this.levelDetails;if(R===null)return null;var S=R.holdBack,b=R.partHoldBack,x=R.targetduration,f=this.config,l=f.liveSyncDuration,i=f.liveSyncDurationCount,c=f.lowLatencyMode,_=this.hls.userConfig,v=c&&b||S;(_.liveSyncDuration||_.liveSyncDurationCount||v===0)&&(v=l!==void 0?l:i*x);var m=x,u=1;return v+Math.min(this.stallCount*u,m)}},{key:"liveSyncPosition",get:function(){var R=this.estimateLiveEdge(),S=this.targetLatency,b=this.levelDetails;if(R===null||S===null||b===null)return null;var x=b.edge,f=R-S-this.edgeStalled,l=x-b.totalduration,i=x-(this.config.lowLatencyMode&&b.partTarget||b.targetduration);return Math.min(Math.max(l,f),i)}},{key:"drift",get:function(){var R=this.levelDetails;return R===null?1:R.drift}},{key:"edgeStalled",get:function(){var R=this.levelDetails;if(R===null)return 0;var S=(this.config.lowLatencyMode&&R.partTarget||R.targetduration)*3;return Math.max(R.age-S,0)}},{key:"forwardBufferLength",get:function(){var R=this.media,S=this.levelDetails;if(!R||!S)return 0;var b=R.buffered.length;return b?R.buffered.end(b-1):S.edge-this.currentTime}}]),A}()},"./src/controller/level-controller.ts":function(ne,G,D){"use strict";D.r(G),D.d(G,"default",function(){return f});var K=D("./src/types/level.ts"),k=D("./src/events.ts"),P=D("./src/errors.ts"),N=D("./src/utils/codecs.ts"),M=D("./src/controller/level-helper.ts"),O=D("./src/controller/base-playlist-controller.ts"),A=D("./src/types/loader.ts");function T(){return T=Object.assign||function(l){for(var i=1;i0){h=u[0].bitrate,u.sort(function(V,B){return V.bitrate-B.bitrate}),this._levels=u;for(var L=0;Lthis.hls.config.fragLoadingMaxRetry&&(s=m.frag.level)):s=m.frag.level}break;case P.ErrorDetails.LEVEL_LOAD_ERROR:case P.ErrorDetails.LEVEL_LOAD_TIMEOUT:u&&(u.deliveryDirectives&&(h=!1),s=u.level),d=!0;break;case P.ErrorDetails.REMUX_ALLOC_ERROR:s=m.level,d=!0;break}s!==void 0&&this.recoverLevel(m,s,d,h)},c.recoverLevel=function(v,m,u,y){var d=v.details,h=this._levels[m];if(h.loadError++,u){var s=this.retryLoadingOrFail(v);if(s)v.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(y){var o=h.url.length;if(o>1&&h.loadError1){var y=(m.urlId+1)%u;this.warn("Switching to redundant URL-id "+y),this._levels.forEach(function(d){d.urlId=y}),this.level=v}},c.onFragLoaded=function(v,m){var u=m.frag;if(u!==void 0&&u.type===A.PlaylistLevelType.MAIN){var y=this._levels[u.level];y!==void 0&&(y.fragmentError=0,y.loadError=0)}},c.onLevelLoaded=function(v,m){var u,y=m.level,d=m.details,h=this._levels[y];if(!h){var s;this.warn("Invalid level index "+y),(s=m.deliveryDirectives)!==null&&s!==void 0&&s.skip&&(d.deltaUpdateFailed=!0);return}y===this.currentLevelIndex?(h.fragmentError===0&&(h.loadError=0,this.retryCount=0),this.playlistLoaded(y,m,h.details)):(u=m.deliveryDirectives)!==null&&u!==void 0&&u.skip&&(d.deltaUpdateFailed=!0)},c.onAudioTrackSwitched=function(v,m){var u=this.hls.levels[this.currentLevelIndex];if(!u)return;if(u.audioGroupIds){for(var y=-1,d=this.hls.audioTracks[m.id].groupId,h=0;h0){var y=u.urlId,d=u.url[y];if(v)try{d=v.addDirectives(d)}catch(h){this.warn("Could not construct new URL with HLS Delivery Directives: "+h)}this.log("Attempt loading level index "+m+(v?" at sn "+v.msn+" part "+v.part:"")+" with URL-id "+y+" "+d),this.clearTimer(),this.hls.trigger(k.Events.LEVEL_LOADING,{url:d,level:m,id:y,deliveryDirectives:v||null})}},c.removeLevel=function(v,m){var u=function(h,s){return s!==m},y=this._levels.filter(function(d,h){return h!==v?!0:d.url.length>1&&m!==void 0?(d.url=d.url.filter(u),d.audioGroupIds&&(d.audioGroupIds=d.audioGroupIds.filter(u)),d.textGroupIds&&(d.textGroupIds=d.textGroupIds.filter(u)),d.urlId=0,!0):!1}).map(function(d,h){var s=d.details;return s!=null&&s.fragments&&s.fragments.forEach(function(o){o.level=h}),d});this._levels=y,this.hls.trigger(k.Events.LEVELS_UPDATED,{levels:y})},R(i,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(v){var m,u=this._levels;if(u.length===0)return;if(this.currentLevelIndex===v&&(m=u[v])!==null&&m!==void 0&&m.details)return;if(v<0||v>=u.length){var y=v<0;if(this.hls.trigger(k.Events.ERROR,{type:P.ErrorTypes.OTHER_ERROR,details:P.ErrorDetails.LEVEL_SWITCH_ERROR,level:v,fatal:y,reason:"invalid level idx"}),y)return;v=Math.min(v,u.length-1)}this.clearTimer();var d=this.currentLevelIndex,h=u[d],s=u[v];this.log("switching to level "+v+" from "+d),this.currentLevelIndex=v;var o=T({},s,{level:v,maxBitrate:s.maxBitrate,uri:s.uri,urlId:s.urlId});delete o._urlId,this.hls.trigger(k.Events.LEVEL_SWITCHING,o);var g=s.details;if(!g||g.live){var p=this.switchParams(s.uri,h==null?void 0:h.details);this.loadPlaylist(p)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(v){this.manualLevelIndex=v,this._startLevel===void 0&&(this._startLevel=v),v!==-1&&(this.level=v)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(v){this._firstLevel=v}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var v=this.hls.config.startLevel;return v!==void 0?v:this._firstLevel}else return this._startLevel},set:function(v){this._startLevel=v}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(v){this.level=v,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=v)}}]),i}(O.default)},"./src/controller/level-helper.ts":function(ne,G,D){"use strict";D.r(G),D.d(G,"addGroupId",function(){return P}),D.d(G,"assignTrackIdsByGroup",function(){return N}),D.d(G,"updatePTS",function(){return M}),D.d(G,"updateFragPTSDTS",function(){return A}),D.d(G,"mergeDetails",function(){return T}),D.d(G,"mapPartIntersection",function(){return C}),D.d(G,"mapFragmentIntersection",function(){return R}),D.d(G,"adjustSliding",function(){return S}),D.d(G,"addSliding",function(){return b}),D.d(G,"computeReloadInterval",function(){return x}),D.d(G,"getFragmentWithSN",function(){return f}),D.d(G,"getPartWith",function(){return l});var K=D("./src/polyfills/number.ts"),k=D("./src/utils/logger.ts");function P(i,c,_){switch(c){case"audio":i.audioGroupIds||(i.audioGroupIds=[]),i.audioGroupIds.push(_);break;case"text":i.textGroupIds||(i.textGroupIds=[]),i.textGroupIds.push(_);break}}function N(i){var c={};i.forEach(function(_){var v=_.groupId||"";_.id=c[v]=c[v]||0,c[v]++})}function M(i,c,_){var v=i[c],m=i[_];O(v,m)}function O(i,c){var _=c.startPTS;if(Object(K.isFiniteNumber)(_)){var v=0,m;c.sn>i.sn?(v=_-i.start,m=i):(v=i.start-_,m=c),m.duration!==v&&(m.duration=v)}else if(c.sn>i.sn){var u=i.cc===c.cc;u&&i.minEndPTS?c.start=i.start+(i.minEndPTS-i.start):c.start=i.start+i.duration}else c.start=Math.max(i.start-c.duration,0)}function A(i,c,_,v,m,u){var y=v-_;y<=0&&(k.logger.warn("Fragment should have a positive duration",c),v=_+c.duration,u=m+c.duration);var d=_,h=v,s=c.startPTS,o=c.endPTS;if(Object(K.isFiniteNumber)(s)){var g=Math.abs(s-_);Object(K.isFiniteNumber)(c.deltaPTS)?c.deltaPTS=Math.max(g,c.deltaPTS):c.deltaPTS=g,d=Math.max(_,s),_=Math.min(_,s),m=Math.min(m,c.startDTS),h=Math.min(v,o),v=Math.max(v,o),u=Math.max(u,c.endDTS)}c.duration=v-_;var p=_-c.start;c.appendedPTS=v,c.start=c.startPTS=_,c.maxStartPTS=d,c.startDTS=m,c.endPTS=v,c.minEndPTS=h,c.endDTS=u;var E=c.sn;if(!i||Ei.endSN)return 0;var L,F=E-i.startSN,j=i.fragments;for(j[F]=c,L=F;L>0;L--)O(j[L],j[L-1]);for(L=F;L=0;m--){var u=v[m].initSegment;if(u){_=u;break}}i.fragmentHint&&delete i.fragmentHint.endPTS;var y=0,d;if(R(i,c,function(L,F){L.relurl&&(y=L.cc-F.cc),Object(K.isFiniteNumber)(L.startPTS)&&Object(K.isFiniteNumber)(L.endPTS)&&(F.start=F.startPTS=L.startPTS,F.startDTS=L.startDTS,F.appendedPTS=L.appendedPTS,F.maxStartPTS=L.maxStartPTS,F.endPTS=L.endPTS,F.endDTS=L.endDTS,F.minEndPTS=L.minEndPTS,F.duration=L.endPTS-L.startPTS,F.duration&&(d=F),c.PTSKnown=c.alignedSliding=!0),F.elementaryStreams=L.elementaryStreams,F.loader=L.loader,F.stats=L.stats,F.urlId=L.urlId,L.initSegment&&(F.initSegment=L.initSegment,_=L.initSegment)}),_){var h=c.fragmentHint?c.fragments.concat(c.fragmentHint):c.fragments;h.forEach(function(L){var F;(!L.initSegment||L.initSegment.relurl===((F=_)===null||F===void 0?void 0:F.relurl))&&(L.initSegment=_)})}if(c.skippedSegments&&(c.deltaUpdateFailed=c.fragments.some(function(L){return!L}),c.deltaUpdateFailed)){k.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var s=c.skippedSegments;s--;)c.fragments.shift();c.startSN=c.fragments[0].sn,c.startCC=c.fragments[0].cc}var o=c.fragments;if(y){k.logger.warn("discontinuity sliding from playlist, take drift into account");for(var g=0;g=v.length)return;b(c,v[_].start)}function b(i,c){if(c){for(var _=i.fragments,v=i.skippedSegments;v<_.length;v++)_[v].start+=c;i.fragmentHint&&(i.fragmentHint.start+=c)}}function x(i,c){var _=1e3*i.levelTargetDuration,v=_/2,m=i.age,u=m>0&&m<_*3,y=c.loading.end-c.loading.start,d,h=i.availabilityDelay;if(i.updated===!1)if(u){var s=333*i.misses;d=Math.max(Math.min(v,y*2),s),i.availabilityDelay=(i.availabilityDelay||0)+d}else d=v;else u?(h=Math.min(h||_/2,m),i.availabilityDelay=h,d=h+_-m):d=_-y;return Math.round(d)}function f(i,c,_){if(!i||!i.details)return null;var v=i.details,m=v.fragments[c-v.startSN];return m||(m=v.fragmentHint,m&&m.sn===c?m:c0&&h===-1&&(this.log("Override startPosition with lastCurrentTime @"+s.toFixed(3)),h=s),this.state=k.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=h,this.tick()}else this._forceStartLoad=!0,this.state=k.State.STOPPED},y.stopLoad=function(){this._forceStartLoad=!1,m.prototype.stopLoad.call(this)},y.doTick=function(){switch(this.state){case k.State.IDLE:this.doTickIdle();break;case k.State.WAITING_LEVEL:{var h,s=this.levels,o=this.level,g=s==null||((h=s[o])===null||h===void 0)?void 0:h.details;if(g&&(!g.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(g))break;this.state=k.State.IDLE;break}break}case k.State.FRAG_LOADING_WAITING_RETRY:{var p,E=self.performance.now(),L=this.retryDate;(!L||E>=L||(p=this.media)!==null&&p!==void 0&&p.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=k.State.IDLE)}break;default:break}this.onTickEnd()},y.onTickEnd=function(){m.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},y.doTickIdle=function(){var h,s,o=this.hls,g=this.levelLastLoaded,p=this.levels,E=this.media,L=o.config,F=o.nextLoadLevel;if(g===null||!E&&(this.startFragRequested||!L.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!p||!p[F])return;var j=p[F];this.level=o.nextLoadLevel=F;var V=j.details;if(!V||this.state===k.State.WAITING_LEVEL||V.live&&this.levelLastLoaded!==F){this.state=k.State.WAITING_LEVEL;return}var B=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:E,A.PlaylistLevelType.MAIN);if(B===null)return;var I=B.len,$=this.getMaxBufferLength(j.maxBitrate);if(I>=$)return;if(this._streamEnded(B,V)){var ie={};this.altAudio&&(ie.type="video"),this.hls.trigger(N.Events.BUFFER_EOS,ie),this.state=k.State.ENDED;return}var ue=B.end,fe=this.getNextFragment(ue,V);if(this.couldBacktrack&&!this.fragPrevious&&fe&&fe.sn!=="initSegment"){var ve=fe.sn-V.startSN;ve>1&&(fe=V.fragments[ve-1],this.fragmentTracker.removeFragment(fe))}if(fe&&this.fragmentTracker.getState(fe)===O.FragmentState.OK&&this.nextLoadPosition>ue){var pe=this.audioOnly&&!this.altAudio?T.ElementaryStreamTypes.AUDIO:T.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(E,pe,A.PlaylistLevelType.MAIN),fe=this.getNextFragment(this.nextLoadPosition,V)}if(!fe)return;fe.initSegment&&!fe.initSegment.data&&!this.bitrateTest&&(fe=fe.initSegment),((h=fe.decryptdata)===null||h===void 0?void 0:h.keyFormat)==="identity"&&!((s=fe.decryptdata)!==null&&s!==void 0&&s.key)?this.loadKey(fe,V):this.loadFragment(fe,V,ue)},y.loadFragment=function(h,s,o){var g,p=this.fragmentTracker.getState(h);if(this.fragCurrent=h,p===O.FragmentState.BACKTRACKED){var E=this.fragmentTracker.getBacktrackData(h);if(E){this._handleFragmentLoadProgress(E),this._handleFragmentLoadComplete(E);return}else p=O.FragmentState.NOT_LOADED}p===O.FragmentState.NOT_LOADED||p===O.FragmentState.PARTIAL?h.sn==="initSegment"?this._loadInitSegment(h):this.bitrateTest?(h.bitrateTest=!0,this.log("Fragment "+h.sn+" of level "+h.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(h)):(this.startFragRequested=!0,m.prototype.loadFragment.call(this,h,s,o)):p===O.FragmentState.APPENDING?this.reduceMaxBufferLength(h.duration)&&this.fragmentTracker.removeFragment(h):((g=this.media)===null||g===void 0?void 0:g.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},y.getAppendedFrag=function(h){var s=this.fragmentTracker.getAppendedFrag(h,A.PlaylistLevelType.MAIN);return s&&"fragment"in s?s.fragment:s},y.getBufferedFrag=function(h){return this.fragmentTracker.getBufferedFrag(h,A.PlaylistLevelType.MAIN)},y.followingBufferedFrag=function(h){return h?this.getBufferedFrag(h.end+.5):null},y.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},y.nextLevelSwitch=function(){var h=this.levels,s=this.media;if(s!=null&&s.readyState){var o,g=this.getAppendedFrag(s.currentTime);if(g&&g.start>1&&this.flushMainBuffer(0,g.start-1),!s.paused&&h){var p=this.hls.nextLoadLevel,E=h[p],L=this.fragLastKbps;L&&this.fragCurrent?o=this.fragCurrent.duration*E.maxBitrate/(1e3*L)+1:o=0}else o=0;var F=this.getBufferedFrag(s.currentTime+o);if(F){var j=this.followingBufferedFrag(F);if(j){this.abortCurrentFrag();var V=j.maxStartPTS?j.maxStartPTS:j.start,B=j.duration,I=Math.max(F.end,V+Math.min(Math.max(B-this.config.maxFragLookUpTolerance,B*.5),B*.75));this.flushMainBuffer(I,Number.POSITIVE_INFINITY)}}}},y.abortCurrentFrag=function(){var h=this.fragCurrent;this.fragCurrent=null,h!=null&&h.loader&&h.loader.abort(),this.state===k.State.KEY_LOADING&&(this.state=k.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},y.flushMainBuffer=function(h,s){m.prototype.flushMainBuffer.call(this,h,s,this.altAudio?"video":null)},y.onMediaAttached=function(h,s){m.prototype.onMediaAttached.call(this,h,s);var o=s.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),o.addEventListener("playing",this.onvplaying),o.addEventListener("seeked",this.onvseeked),this.gapController=new S.default(this.config,o,this.fragmentTracker,this.hls)},y.onMediaDetaching=function(){var h=this.media;h&&(h.removeEventListener("playing",this.onvplaying),h.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),m.prototype.onMediaDetaching.call(this)},y.onMediaPlaying=function(){this.tick()},y.onMediaSeeked=function(){var h=this.media,s=h?h.currentTime:null;Object(K.isFiniteNumber)(s)&&this.log("Media seeked to "+s.toFixed(3)),this.tick()},y.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(N.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},y.onManifestParsed=function(h,s){var o=!1,g=!1,p;s.levels.forEach(function(E){p=E.audioCodec,p&&(p.indexOf("mp4a.40.2")!==-1&&(o=!0),p.indexOf("mp4a.40.5")!==-1&&(g=!0))}),this.audioCodecSwitch=o&&g&&!Object(P.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=s.levels,this.startFragRequested=!1},y.onLevelLoading=function(h,s){var o=this.levels;if(!o||this.state!==k.State.IDLE)return;var g=o[s.level];(!g.details||g.details.live&&this.levelLastLoaded!==s.level||this.waitForCdnTuneIn(g.details))&&(this.state=k.State.WAITING_LEVEL)},y.onLevelLoaded=function(h,s){var o,g=this.levels,p=s.level,E=s.details,L=E.totalduration;if(!g){this.warn("Levels were reset while loading level "+p);return}this.log("Level "+p+" loaded ["+E.startSN+","+E.endSN+"], cc ["+E.startCC+", "+E.endCC+"] duration:"+L);var F=this.fragCurrent;F&&(this.state===k.State.FRAG_LOADING||this.state===k.State.FRAG_LOADING_WAITING_RETRY)&&(F.level!==s.level&&F.loader&&(this.state=k.State.IDLE,F.loader.abort()));var j=g[p],V=0;if(E.live||(o=j.details)!==null&&o!==void 0&&o.live){if(E.fragments[0]||(E.deltaUpdateFailed=!0),E.deltaUpdateFailed)return;V=this.alignPlaylists(E,j.details)}if(j.details=E,this.levelLastLoaded=p,this.hls.trigger(N.Events.LEVEL_UPDATED,{details:E,level:p}),this.state===k.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(E))return;this.state=k.State.IDLE}this.startFragRequested?E.live&&this.synchronizeToLiveEdge(E):this.setStartPosition(E,V),this.tick()},y._handleFragmentLoadProgress=function(h){var s,o=h.frag,g=h.part,p=h.payload,E=this.levels;if(!E){this.warn("Levels were reset while fragment load was in progress. Fragment "+o.sn+" of level "+o.level+" will not be buffered");return}var L=E[o.level],F=L.details;if(!F){this.warn("Dropping fragment "+o.sn+" of level "+o.level+" after level details were reset");return}var j=L.videoCodec,V=F.PTSKnown||!F.live,B=(s=o.initSegment)===null||s===void 0?void 0:s.data,I=this._getAudioCodec(L),$=this.transmuxer=this.transmuxer||new C.default(this.hls,A.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),ie=g?g.index:-1,ue=ie!==-1,fe=new R.ChunkMetadata(o.level,o.sn,o.stats.chunkCount,p.byteLength,ie,ue),ve=this.initPTS[o.cc];$.push(p,B,I,j,o,g,F.totalduration,V,fe,ve)},y.onAudioTrackSwitching=function(h,s){var o=this.altAudio,g=!!s.url,p=s.id;if(!g){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var E=this.fragCurrent;E!=null&&E.loader&&(this.log("Switching to main audio track, cancel main fragment load"),E.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var L=this.hls;o&&L.trigger(N.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),L.trigger(N.Events.AUDIO_TRACK_SWITCHED,{id:p})}},y.onAudioTrackSwitched=function(h,s){var o=s.id,g=!!this.hls.audioTracks[o].url;if(g){var p=this.videoBuffer;p&&this.mediaBuffer!==p&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=p)}this.altAudio=g,this.tick()},y.onBufferCreated=function(h,s){var o=s.tracks,g,p,E=!1;for(var L in o){var F=o[L];if(F.id==="main"){if(p=L,g=F,L==="video"){var j=o[L];j&&(this.videoBuffer=j.buffer)}}else E=!0}E&&g?(this.log("Alternate track found, use "+p+".buffered to schedule main fragment loading"),this.mediaBuffer=g.buffer):this.mediaBuffer=this.media},y.onFragBuffered=function(h,s){var o=s.frag,g=s.part;if(o&&o.type!==A.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(o)){this.warn("Fragment "+o.sn+(g?" p: "+g.index:"")+" of level "+o.level+" finished buffering, but was aborted. state: "+this.state),this.state===k.State.PARSED&&(this.state=k.State.IDLE);return}var p=g?g.stats:o.stats;this.fragLastKbps=Math.round(8*p.total/(p.buffering.end-p.loading.first)),o.sn!=="initSegment"&&(this.fragPrevious=o),this.fragBufferedComplete(o,g)},y.onError=function(h,s){switch(s.details){case b.ErrorDetails.FRAG_LOAD_ERROR:case b.ErrorDetails.FRAG_LOAD_TIMEOUT:case b.ErrorDetails.KEY_LOAD_ERROR:case b.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(A.PlaylistLevelType.MAIN,s);break;case b.ErrorDetails.LEVEL_LOAD_ERROR:case b.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==k.State.ERROR&&(s.fatal?(this.warn(""+s.details),this.state=k.State.ERROR):!s.levelRetry&&this.state===k.State.WAITING_LEVEL&&(this.state=k.State.IDLE));break;case b.ErrorDetails.BUFFER_FULL_ERROR:if(s.parent==="main"&&(this.state===k.State.PARSING||this.state===k.State.PARSED)){var o=!0,g=this.getFwdBufferInfo(this.media,A.PlaylistLevelType.MAIN);g&&g.len>.5&&(o=!this.reduceMaxBufferLength(g.len)),o&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},y.checkBuffer=function(){var h=this.media,s=this.gapController;if(!h||!s||!h.readyState)return;var o=M.BufferHelper.getBuffered(h);!this.loadedmetadata&&o.length?(this.loadedmetadata=!0,this.seekToStartPos()):s.poll(this.lastCurrentTime),this.lastCurrentTime=h.currentTime},y.onFragLoadEmergencyAborted=function(){this.state=k.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},y.onBufferFlushed=function(h,s){var o=s.type;if(o!==T.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var g=(o===T.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(g,o,A.PlaylistLevelType.MAIN)}},y.onLevelsUpdated=function(h,s){this.levels=s.levels},y.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},y.seekToStartPos=function(){var h=this.media,s=h.currentTime,o=this.startPosition;if(o>=0&&s0&&(E1&&h.seeking===!1){var o=h.currentTime;if(M.BufferHelper.isBuffered(h,o)?s=this.getAppendedFrag(o):M.BufferHelper.isBuffered(h,o+.1)&&(s=this.getAppendedFrag(o+.1)),s){var g=this.fragPlaying,p=s.level;(!g||s.sn!==g.sn||g.level!==p||s.urlId!==g.urlId)&&(this.hls.trigger(N.Events.FRAG_CHANGED,{frag:s}),(!g||g.level!==p)&&this.hls.trigger(N.Events.LEVEL_SWITCHED,{level:p}),this.fragPlaying=s)}}},l(u,[{key:"nextLevel",get:function(){var h=this.nextBufferedFrag;return h?h.level:-1}},{key:"currentLevel",get:function(){var h=this.media;if(h){var s=this.getAppendedFrag(h.currentTime);if(s)return s.level}return-1}},{key:"nextBufferedFrag",get:function(){var h=this.media;if(h){var s=this.getAppendedFrag(h.currentTime);return this.followingBufferedFrag(s)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),u}(k.default)},"./src/controller/subtitle-stream-controller.ts":function(ne,G,D){"use strict";D.r(G),D.d(G,"SubtitleStreamController",function(){return i});var K=D("./src/events.ts"),k=D("./src/utils/logger.ts"),P=D("./src/utils/buffer-helper.ts"),N=D("./src/controller/fragment-finders.ts"),M=D("./src/utils/discontinuities.ts"),O=D("./src/controller/level-helper.ts"),A=D("./src/controller/fragment-tracker.ts"),T=D("./src/controller/base-stream-controller.ts"),C=D("./src/types/loader.ts"),R=D("./src/types/level.ts");function S(c,_){for(var v=0;v<_.length;v++){var m=_[v];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(c,m.key,m)}}function b(c,_,v){return _&&S(c.prototype,_),v&&S(c,v),c}function x(c,_){c.prototype=Object.create(_.prototype),c.prototype.constructor=c,f(c,_)}function f(c,_){return f=Object.setPrototypeOf||function(m,u){return m.__proto__=u,m},f(c,_)}var l=500,i=function(c){x(_,c);function _(m,u){var y;return y=c.call(this,m,u,"[subtitle-stream-controller]")||this,y.levels=[],y.currentTrackId=-1,y.tracksBuffered=[],y.mainDetails=null,y._registerListeners(),y}var v=_.prototype;return v.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},v._registerListeners=function(){var u=this.hls;u.on(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),u.on(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.on(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.on(K.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.on(K.Events.ERROR,this.onError,this),u.on(K.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),u.on(K.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),u.on(K.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),u.on(K.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),u.on(K.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},v._unregisterListeners=function(){var u=this.hls;u.off(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),u.off(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.off(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.off(K.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.off(K.Events.ERROR,this.onError,this),u.off(K.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),u.off(K.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),u.off(K.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),u.off(K.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),u.off(K.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},v.startLoad=function(){this.stopLoad(),this.state=T.State.IDLE,this.setInterval(l),this.tick()},v.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},v.onLevelLoaded=function(u,y){this.mainDetails=y.details},v.onSubtitleFragProcessed=function(u,y){var d=y.frag,h=y.success;if(this.fragPrevious=d,this.state=T.State.IDLE,!h)return;var s=this.tracksBuffered[this.currentTrackId];if(!s)return;for(var o,g=d.start,p=0;p=s[p].start&&g<=s[p].end){o=s[p];break}var E=d.start+d.duration;o?o.end=E:(o={start:g,end:E},s.push(o)),this.fragmentTracker.fragBuffered(d)},v.onBufferFlushing=function(u,y){var d=y.startOffset,h=y.endOffset;if(d===0&&h!==Number.POSITIVE_INFINITY){var s=this.currentTrackId,o=this.levels;if(!o.length||!o[s]||!o[s].details)return;var g=o[s].details,p=g.targetduration,E=h-p;if(E<=0)return;y.endOffsetSubtitles=Math.max(0,E),this.tracksBuffered.forEach(function(L){for(var F=0;F=g.length||s!==o||!p)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,h.live||(d=p.details)!==null&&d!==void 0&&d.live){var E=this.mainDetails;if(h.deltaUpdateFailed||!E)return;var L=E.fragments[0];if(!p.details)h.hasProgramDateTime&&E.hasProgramDateTime?Object(M.alignMediaPlaylistByPDT)(h,E):L&&Object(O.addSliding)(h,L.start);else{var F=this.alignPlaylists(h,p.details);F===0&&L&&Object(O.addSliding)(h,L.start)}}if(p.details=h,this.levelLastLoaded=s,this.tick(),h.live&&!this.fragCurrent&&this.media&&this.state===T.State.IDLE){var j=Object(N.findFragmentByPTS)(null,h.fragments,this.media.currentTime,0);j||(this.warn("Subtitle playlist not aligned with playback"),p.details=void 0)}},v._handleFragmentLoadComplete=function(u){var y=u.frag,d=u.payload,h=y.decryptdata,s=this.hls;if(this.fragContextChanged(y))return;if(d&&d.byteLength>0&&h&&h.key&&h.iv&&h.method==="AES-128"){var o=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(d),h.key.buffer,h.iv.buffer).then(function(g){var p=performance.now();s.trigger(K.Events.FRAG_DECRYPTED,{frag:y,payload:g,stats:{tstart:o,tdecrypt:p}})})}},v.doTick=function(){if(!this.media){this.state=T.State.IDLE;return}if(this.state===T.State.IDLE){var u,y=this.currentTrackId,d=this.levels;if(!d.length||!d[y]||!d[y].details)return;var h=d[y].details,s=h.targetduration,o=this.config,g=this.media,p=P.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,g.currentTime-s,o.maxBufferHole),E=p.end,L=p.len,F=this.getMaxBufferLength()+s;if(L>F)return;console.assert(h,"Subtitle track details are defined on idle subtitle stream controller tick");var j=h.fragments,V=j.length,B=h.edge,I,$=this.fragPrevious;if(E-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)},x.pollTrackChange=function(l){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,l)},x.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 l=R(this.media.textTracks);l.forEach(function(i){Object(k.clearCurrentCues)(i)}),this.subtitleTrack=-1,this.media=null},x.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},x.onManifestParsed=function(l,i){this.tracks=i.subtitleTracks},x.onSubtitleTrackLoaded=function(l,i){var c=i.id,_=i.details,v=this.trackId,m=this.tracksInGroup[v];if(!m){this.warn("Invalid subtitle track id "+c);return}var u=m.details;m.details=i.details,this.log("subtitle track "+c+" loaded ["+_.startSN+"-"+_.endSN+"]"),c===this.trackId&&(this.retryCount=0,this.playlistLoaded(c,i,u))},x.onLevelLoading=function(l,i){this.switchLevel(i.level)},x.onLevelSwitching=function(l,i){this.switchLevel(i.level)},x.switchLevel=function(l){var i=this.hls.levels[l];if(!(i!=null&&i.textGroupIds))return;var c=i.textGroupIds[i.urlId];if(this.groupId!==c){var _=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,v=this.tracks.filter(function(y){return!c||y.groupId===c});this.tracksInGroup=v;var m=this.findTrackId(_==null?void 0:_.name)||this.findTrackId();this.groupId=c;var u={subtitleTracks:v};this.log("Updating subtitle tracks, "+v.length+' track(s) found in "'+c+'" group-id'),this.hls.trigger(K.Events.SUBTITLE_TRACKS_UPDATED,u),m!==-1&&this.setSubtitleTrack(m,_)}},x.findTrackId=function(l){for(var i=this.tracksInGroup,c=0;c=_.length)return;this.clearTimer();var v=_[l];if(this.log("Switching to subtitle track "+l),this.trackId=l,v){var m=v.id,u=v.groupId,y=u===void 0?"":u,d=v.name,h=v.type,s=v.url;this.hls.trigger(K.Events.SUBTITLE_TRACK_SWITCH,{id:m,groupId:y,name:d,type:h,url:s});var o=this.switchParams(v.url,i==null?void 0:i.details);this.loadPlaylist(o)}else this.hls.trigger(K.Events.SUBTITLE_TRACK_SWITCH,{id:l})},x.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var l=-1,i=R(this.media.textTracks),c=0;c=0&&(h[0]=Math.min(h[0],_),h[1]=Math.max(h[1],v),y=!0,s/(v-_)>.5))return}if(y||u.push([_,v]),this.config.renderTextTracksNatively){var o=this.captionsTracks[c];this.Cues.newCue(o,_,v,m)}else{var g=this.Cues.newCue(null,_,v,m);this.hls.trigger(k.Events.CUES_PARSED,{type:"captions",cues:g,track:c})}},l.onInitPtsFound=function(c,_){var v=this,m=_.frag,u=_.id,y=_.initPTS,d=_.timescale,h=this.unparsedVttFrags;u==="main"&&(this.initPTS[m.cc]=y,this.timescale[m.cc]=d),h.length&&(this.unparsedVttFrags=[],h.forEach(function(s){v.onFragLoaded(k.Events.FRAG_LOADED,s)}))},l.getExistingTrack=function(c){var _=this.media;if(_)for(var v=0;v<_.textTracks.length;v++){var m=_.textTracks[v];if(m[c])return m}return null},l.createCaptionsTrack=function(c){this.config.renderTextTracksNatively?this.createNativeTrack(c):this.createNonNativeTrack(c)},l.createNativeTrack=function(c){if(this.captionsTracks[c])return;var _=this.captionsProperties,v=this.captionsTracks,m=this.media,u=_[c],y=u.label,d=u.languageCode,h=this.getExistingTrack(c);if(h)v[c]=h,Object(O.clearCurrentCues)(v[c]),Object(O.sendAddTrackEvent)(v[c],m);else{var s=this.createTextTrack("captions",y,d);s&&(s[c]=!0,v[c]=s)}},l.createNonNativeTrack=function(c){if(this.nonNativeCaptionsTracks[c])return;var _=this.captionsProperties[c];if(!_)return;var v=_.label,m={_id:c,label:v,kind:"captions",default:_.media?!!_.media.default:!1,closedCaptions:_.media};this.nonNativeCaptionsTracks[c]=m,this.hls.trigger(k.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[m]})},l.createTextTrack=function(c,_,v){var m=this.media;return m?m.addTextTrack(c,_,v):void 0},l.onMediaAttaching=function(c,_){this.media=_.media,this._cleanTracks()},l.onMediaDetaching=function(){var c=this.captionsTracks;Object.keys(c).forEach(function(_){Object(O.clearCurrentCues)(c[_]),delete c[_]}),this.nonNativeCaptionsTracks={}},l.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=x(),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())},l._cleanTracks=function(){var c=this.media;if(!c)return;var _=c.textTracks;if(_)for(var v=0;v<_.length;v++)Object(O.clearCurrentCues)(_[v])},l.onSubtitleTracksUpdated=function(c,_){var v=this;this.textTracks=[];var m=_.subtitleTracks||[],u=m.some(function(s){return s.textCodec===A.IMSC1_CODEC});if(this.config.enableWebVTT||u&&this.config.enableIMSC1){var y=this.tracks&&m&&this.tracks.length===m.length;if(this.tracks=m||[],this.config.renderTextTracksNatively){var d=this.media?this.media.textTracks:[];this.tracks.forEach(function(s,o){var g;if(o>>8^d&255^99,A[m]=d,T[d]=m;var h=v[m],s=v[h],o=v[s],g=v[d]*257^d*16843008;R[m]=g<<24|g>>>8,S[m]=g<<16|g>>>16,b[m]=g<<8|g>>>24,x[m]=g,g=o*16843009^s*65537^h*257^m*16843008,l[d]=g<<24|g>>>8,i[d]=g<<16|g>>>16,c[d]=g<<8|g>>>24,_[d]=g,m?(m=h^v[v[v[o^h]]],u^=v[v[u]]):m=u=1}},M.expandKey=function(A){for(var T=this.uint8ArrayToUint32Array_(A),C=!0,R=0;R>>6)+1;var g=(c[_+2]&60)>>>2;if(g>o.length-1){i.trigger(P.Events.ERROR,{type:k.ErrorTypes.MEDIA_ERROR,details:k.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+g});return}return y=(c[_+2]&1)<<2,y|=(c[_+3]&192)>>>6,K.logger.log("manifest codec:"+v+", ADTS type:"+m+", samplingIndex:"+g),/firefox/i.test(h)?g>=6?(m=5,d=new Array(4),u=g-3):(m=2,d=new Array(2),u=g):h.indexOf("android")!==-1?(m=2,d=new Array(2),u=g):(m=5,d=new Array(4),v&&(v.indexOf("mp4a.40.29")!==-1||v.indexOf("mp4a.40.5")!==-1)||!v&&g>=6?u=g-3:((v&&v.indexOf("mp4a.40.2")!==-1&&(g>=6&&y===1||/vivaldi/i.test(h))||!v&&y===1)&&(m=2,d=new Array(2)),u=g)),d[0]=m<<3,d[0]|=(g&14)>>1,d[1]|=(g&1)<<7,d[1]|=y<<3,m===5&&(d[1]|=(u&14)>>1,d[2]=(u&1)<<7,d[2]|=2<<2,d[3]=0),{config:d,samplerate:o[g],channelCount:y,codec:"mp4a.40."+m,manifestCodec:s}}function M(i,c){return i[c]===255&&(i[c+1]&246)===240}function O(i,c){return i[c+1]&1?7:9}function A(i,c){return(i[c+3]&3)<<11|i[c+4]<<3|(i[c+5]&224)>>>5}function T(i,c){return c+5=i.length)return!1;var v=A(i,c);if(v<=_)return!1;var m=c+v;return m===i.length||C(i,m)}return!1}function b(i,c,_,v,m){if(!i.samplerate){var u=N(c,_,v,m);if(!u)return;i.config=u.config,i.samplerate=u.samplerate,i.channelCount=u.channelCount,i.codec=u.codec,i.manifestCodec=u.manifestCodec,K.logger.log("parsed codec:"+i.codec+", rate:"+u.samplerate+", channels:"+u.channelCount)}}function x(i){return 1024*9e4/i}function f(i,c,_,v,m){var u=O(i,c),y=A(i,c);if(y-=u,y>0){var d=_+v*m;return{headerLength:u,frameLength:y,stamp:d}}}function l(i,c,_,v,m){var u=x(i.samplerate),y=f(c,_,v,m,u);if(y){var d=y.frameLength,h=y.headerLength,s=y.stamp,o=h+d,g=Math.max(0,_+o-c.length),p;g?(p=new Uint8Array(o-h),p.set(c.subarray(_+h,c.length),0)):p=c.subarray(_+h,_+o);var E={unit:p,pts:s};return g||i.samples.push(E),{sample:E,length:o,missing:g}}}},"./src/demux/base-audio-demuxer.ts":function(ne,G,D){"use strict";D.r(G),D.d(G,"initPTSFn",function(){return A});var K=D("./src/polyfills/number.ts"),k=D("./src/demux/id3.ts"),P=D("./src/demux/dummy-demuxed-track.ts"),N=D("./src/utils/mp4-tools.ts"),M=D("./src/utils/typed-array.ts"),O=function(){function T(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var C=T.prototype;return C.resetInitSegment=function(S,b,x){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},C.resetTimeStamp=function(){},C.resetContiguity=function(){},C.canParse=function(S,b){return!1},C.appendFrame=function(S,b,x){},C.demux=function(S,b){this.cachedData&&(S=Object(N.appendUint8Array)(this.cachedData,S),this.cachedData=null);var x=k.getID3Data(S,0),f=x?x.length:0,l,i,c=this._audioTrack,_=this._id3Track,v=x?k.getTimeStamp(x):void 0,m=S.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=A(v,b)),x&&x.length>0&&_.samples.push({pts:this.initPTS,dts:this.initPTS,data:x}),i=this.initPTS;fO?(this.word<<=O,this.bitsAvailable-=O):(O-=this.bitsAvailable,A=O>>3,O-=A>>3,this.bytesAvailable-=A,this.loadWord(),this.word<<=O,this.bitsAvailable-=O)},N.readBits=function(O){var A=Math.min(this.bitsAvailable,O),T=this.word>>>32-A;return O>32&&K.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=A,this.bitsAvailable>0?this.word<<=A:this.bytesAvailable>0&&this.loadWord(),A=O-A,A>0&&this.bitsAvailable?T<>>O)!==0)return this.word<<=O,this.bitsAvailable-=O,O;return this.loadWord(),O+this.skipLZ()},N.skipUEG=function(){this.skipBits(1+this.skipLZ())},N.skipEG=function(){this.skipBits(1+this.skipLZ())},N.readUEG=function(){var O=this.skipLZ();return this.readBits(O+1)-1},N.readEG=function(){var O=this.readUEG();return 1&O?1+O>>>1:-1*(O>>>1)},N.readBoolean=function(){return this.readBits(1)===1},N.readUByte=function(){return this.readBits(8)},N.readUShort=function(){return this.readBits(16)},N.readUInt=function(){return this.readBits(32)},N.skipScalingList=function(O){for(var A=8,T=8,C,R=0;R0?m.subarray(y,y+d):void 0},N=function(m,u){var y=0;return y=(m[u]&127)<<21,y|=(m[u+1]&127)<<14,y|=(m[u+2]&127)<<7,y|=m[u+3]&127,y},M=function(m,u){return K(m,u)&&N(m,u+6)+10<=m.length-u},O=function(m){for(var u=C(m),y=0;y>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:E+=String.fromCharCode(o);break;case 12:case 13:g=m[L++],E+=String.fromCharCode((o&31)<<6|g&63);break;case 14:g=m[L++],p=m[L++],E+=String.fromCharCode((o&15)<<12|(g&63)<<6|(p&63)<<0);break;default:}}return E},i={decodeTextFrame:b},c;function _(){return!c&&typeof self.TextDecoder!="undefined"&&(c=new self.TextDecoder("utf-8")),c}},"./src/demux/mp3demuxer.ts":function(ne,G,D){"use strict";D.r(G);var K=D("./src/demux/base-audio-demuxer.ts"),k=D("./src/demux/id3.ts"),P=D("./src/utils/logger.ts"),N=D("./src/demux/mpegaudio.ts");function M(T,C){T.prototype=Object.create(C.prototype),T.prototype.constructor=T,O(T,C)}function O(T,C){return O=Object.setPrototypeOf||function(S,b){return S.__proto__=b,S},O(T,C)}var A=function(T){M(C,T);function C(){return T.apply(this,arguments)||this}var R=C.prototype;return R.resetInitSegment=function(b,x,f){T.prototype.resetInitSegment.call(this,b,x,f),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:b,duration:f,inputTimeScale:9e4,dropped:0}},C.probe=function(b){if(!b)return!1;for(var x=k.getID3Data(b,0)||[],f=x.length,l=b.length;f0},M.demux=function(A){var T=A,C=Object(k.dummyTrack)();if(this.config.progressive){this.remainderData&&(T=Object(K.appendUint8Array)(this.remainderData,A));var R=Object(K.segmentValidRange)(T);this.remainderData=R.remainder,C.samples=R.valid||new Uint8Array}else C.samples=T;return{audioTrack:Object(k.dummyTrack)(),avcTrack:C,id3Track:Object(k.dummyTrack)(),textTrack:Object(k.dummyTrack)()}},M.flush=function(){var A=Object(k.dummyTrack)();return A.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(k.dummyTrack)(),avcTrack:A,id3Track:Object(k.dummyTrack)(),textTrack:Object(k.dummyTrack)()}},M.demuxSampleAes=function(A,T,C){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},M.destroy=function(){},N}();P.minProbeByteLength=1024,G.default=P},"./src/demux/mpegaudio.ts":function(ne,G,D){"use strict";D.r(G),D.d(G,"appendFrame",function(){return O}),D.d(G,"parseHeader",function(){return A}),D.d(G,"isHeaderPattern",function(){return T}),D.d(G,"isHeader",function(){return C}),D.d(G,"canParse",function(){return R}),D.d(G,"probe",function(){return S});var K=null,k=[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],P=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],N=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],M=[0,1,1,4];function O(b,x,f,l,i){if(f+24>x.length)return;var c=A(x,f);if(c&&f+c.frameLength<=x.length){var _=c.samplesPerFrame*9e4/c.sampleRate,v=l+i*_,m={unit:x.subarray(f,f+c.frameLength),pts:v,dts:v};return b.config=[],b.channelCount=c.channelCount,b.samplerate=c.sampleRate,b.samples.push(m),{sample:m,length:c.frameLength,missing:0}}}function A(b,x){var f=b[x+1]>>3&3,l=b[x+1]>>1&3,i=b[x+2]>>4&15,c=b[x+2]>>2&3;if(f!==1&&i!==0&&i!==15&&c!==3){var _=b[x+2]>>1&1,v=b[x+3]>>6,m=f===3?3-l:l===3?3:4,u=k[m*14+i-1]*1e3,y=f===3?0:f===2?1:2,d=P[y*3+c],h=v===3?1:2,s=N[f][l],o=M[l],g=s*8*o,p=Math.floor(s*u/d+_)*o;if(K===null){var E=navigator.userAgent||"",L=E.match(/Chrome\/(\d+)/i);K=L?parseInt(L[1]):0}var F=!!K&&K<=87;return F&&l===2&&u>=224e3&&v===0&&(b[x+3]=b[x+3]|128),{sampleRate:d,channelCount:h,frameLength:p,samplesPerFrame:g}}}function T(b,x){return b[x]===255&&(b[x+1]&224)===224&&(b[x+1]&6)!==0}function C(b,x){return x+1=A.length){C();return}if(A[T].unit.length<32)continue;var R=this.decrypter.isSync();if(this.decryptAacSample(A,T,C,R),!R)return}},M.getAvcEncryptedData=function(A){for(var T=Math.floor((A.length-48)/160)*16+16,C=new Int8Array(T),R=0,S=32;S<=A.length-16;S+=160,R+=16)C.set(A.subarray(S,S+16),R);return C},M.getAvcDecryptedUnit=function(A,T){for(var C=new Uint8Array(T),R=0,S=32;S<=A.length-16;S+=160,R+=16)A.set(C.subarray(R,R+16),S);return A},M.decryptAvcSample=function(A,T,C,R,S,b){var x=Object(k.discardEPB)(S.data),f=this.getAvcEncryptedData(x),l=this;this.decryptBuffer(f.buffer,function(i){S.data=l.getAvcDecryptedUnit(x,i),b||l.decryptAvcSamples(A,T,C+1,R)})},M.decryptAvcSamples=function(A,T,C,R){if(A instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;T++,C=0){if(T>=A.length){R();return}for(var S=A[T].units;!(C>=S.length);C++){var b=S[C];if(b.data.length<=48||b.type!==1&&b.type!==5)continue;var x=this.decrypter.isSync();if(this.decryptAvcSample(A,T,C,R,b,x),!x)return}}},N}();G.default=P},"./src/demux/transmuxer-interface.ts":function(ne,G,D){"use strict";D.r(G),D.d(G,"default",function(){return S});var K=D("./node_modules/webworkify-webpack/index.js"),k=D.n(K),P=D("./src/events.ts"),N=D("./src/demux/transmuxer.ts"),M=D("./src/utils/logger.ts"),O=D("./src/errors.ts"),A=D("./src/utils/mediasource-helper.ts"),T=D("./node_modules/eventemitter3/index.js"),C=D.n(T),R=Object(A.getMediaSource)()||{isTypeSupported:function(){return!1}},S=function(){function b(f,l,i,c){var _=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=f,this.id=l,this.onTransmuxComplete=i,this.onFlush=c;var v=f.config,m=function(s,o){o=o||{},o.frag=_.frag,o.id=_.id,f.trigger(s,o)};this.observer=new T.EventEmitter,this.observer.on(P.Events.FRAG_DECRYPTED,m),this.observer.on(P.Events.ERROR,m);var u={mp4:R.isTypeSupported("video/mp4"),mpeg:R.isTypeSupported("audio/mpeg"),mp3:R.isTypeSupported('audio/mp4; codecs="mp3"')},y=navigator.vendor;if(v.enableWorker&&typeof Worker!="undefined"){M.logger.log("demuxing in webworker");var d;try{d=this.worker=K("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),d.addEventListener("message",this.onwmsg),d.onerror=function(h){f.trigger(P.Events.ERROR,{type:O.ErrorTypes.OTHER_ERROR,details:O.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(h.message+" ("+h.filename+":"+h.lineno+")")})},d.postMessage({cmd:"init",typeSupported:u,vendor:y,id:l,config:JSON.stringify(v)})}catch(h){M.logger.warn("Error in worker:",h),M.logger.error("Error while initializing DemuxerWorker, fallback to inline"),d&&self.URL.revokeObjectURL(d.objectURL),this.transmuxer=new N.default(this.observer,u,v,y,l),this.worker=null}}else this.transmuxer=new N.default(this.observer,u,v,y,l)}var x=b.prototype;return x.destroy=function(){var l=this.worker;if(l)l.removeEventListener("message",this.onwmsg),l.terminate(),this.worker=null;else{var i=this.transmuxer;i&&(i.destroy(),this.transmuxer=null)}var c=this.observer;c&&c.removeAllListeners(),this.observer=null},x.push=function(l,i,c,_,v,m,u,y,d,h){var s=this;d.transmuxing.start=self.performance.now();var o=this.transmuxer,g=this.worker,p=m?m.start:v.start,E=v.decryptdata,L=this.frag,F=!(L&&v.cc===L.cc),j=!(L&&d.level===L.level),V=L?d.sn-L.sn:-1,B=this.part?d.part-this.part.index:1,I=!j&&(V===1||V===0&&B===1),$=self.performance.now();(j||V||v.stats.parsing.start===0)&&(v.stats.parsing.start=$),m&&(B||!I)&&(m.stats.parsing.start=$);var ie=new N.TransmuxState(F,I,y,j,p);if(!I||F){M.logger.log("[transmuxer-interface, "+v.type+"]: Starting new transmux session for sn: "+d.sn+" p: "+d.part+" level: "+d.level+" id: "+d.id+` discontinuity: `+F+` trackSwitch: `+j+` contiguous: `+I+` accurateTimeOffset: `+y+` timeOffset: `+p);var ue=new N.TransmuxConfig(c,_,i,u,h);this.configureTransmuxer(ue)}if(this.frag=v,this.part=m,g)g.postMessage({cmd:"demux",data:l,decryptdata:E,chunkMeta:d,state:ie},l instanceof ArrayBuffer?[l]:[]);else if(o){var fe=o.push(l,E,d,ie);Object(N.isPromise)(fe)?fe.then(function(ve){s.handleTransmuxComplete(ve)}):this.handleTransmuxComplete(fe)}},x.flush=function(l){var i=this;l.transmuxing.start=self.performance.now();var c=this.transmuxer,_=this.worker;if(_)_.postMessage({cmd:"flush",chunkMeta:l});else if(c){var v=c.flush(l);Object(N.isPromise)(v)?v.then(function(m){i.handleFlushResult(m,l)}):this.handleFlushResult(v,l)}},x.handleFlushResult=function(l,i){var c=this;l.forEach(function(_){c.handleTransmuxComplete(_)}),this.onFlush(i)},x.onWorkerMessage=function(l){var i=l.data,c=this.hls;switch(i.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(i.data);break}case"flush":{this.onFlush(i.data);break}default:{i.data=i.data||{},i.data.frag=this.frag,i.data.id=this.id,c.trigger(i.event,i.data);break}}},x.configureTransmuxer=function(l){var i=this.worker,c=this.transmuxer;i?i.postMessage({cmd:"configure",config:l}):c&&c.configure(l)},x.handleTransmuxComplete=function(l){l.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(l)},b}()},"./src/demux/transmuxer-worker.ts":function(ne,G,D){"use strict";D.r(G),D.d(G,"default",function(){return O});var K=D("./src/demux/transmuxer.ts"),k=D("./src/events.ts"),P=D("./src/utils/logger.ts"),N=D("./node_modules/eventemitter3/index.js"),M=D.n(N);function O(S){var b=new N.EventEmitter,x=function(l,i){S.postMessage({event:l,data:i})};b.on(k.Events.FRAG_DECRYPTED,x),b.on(k.Events.ERROR,x),S.addEventListener("message",function(f){var l=f.data;switch(l.cmd){case"init":{var i=JSON.parse(l.config);S.transmuxer=new K.default(b,l.typeSupported,i,l.vendor,l.id),Object(P.enableLogs)(i.debug),x("init",null);break}case"configure":{S.transmuxer.configure(l.config);break}case"demux":{var c=S.transmuxer.push(l.data,l.decryptdata,l.chunkMeta,l.state);Object(K.isPromise)(c)?c.then(function(m){A(S,m)}):A(S,c);break}case"flush":{var _=l.chunkMeta,v=S.transmuxer.flush(_);Object(K.isPromise)(v)?v.then(function(m){C(S,m,_)}):C(S,v,_);break}default:break}})}function A(S,b){if(R(b.remuxResult))return;var x=[],f=b.remuxResult,l=f.audio,i=f.video;l&&T(x,l),i&&T(x,i),S.postMessage({event:"transmuxComplete",data:b},x)}function T(S,b){b.data1&&S.push(b.data1.buffer),b.data2&&S.push(b.data2.buffer)}function C(S,b,x){b.forEach(function(f){A(S,f)}),S.postMessage({event:"flush",data:x})}function R(S){return!S.audio&&!S.video&&!S.text&&!S.id3&&!S.initSegment}},"./src/demux/transmuxer.ts":function(ne,G,D){"use strict";D.r(G),D.d(G,"default",function(){return i}),D.d(G,"isPromise",function(){return v}),D.d(G,"TransmuxConfig",function(){return m}),D.d(G,"TransmuxState",function(){return u});var K=D("./src/events.ts"),k=D("./src/errors.ts"),P=D("./src/crypt/decrypter.ts"),N=D("./src/demux/aacdemuxer.ts"),M=D("./src/demux/mp4demuxer.ts"),O=D("./src/demux/tsdemuxer.ts"),A=D("./src/demux/mp3demuxer.ts"),T=D("./src/remux/mp4-remuxer.ts"),C=D("./src/remux/passthrough-remuxer.ts"),R=D("./src/demux/chunk-cache.ts"),S=D("./src/utils/mp4-tools.ts"),b=D("./src/utils/logger.ts"),x;try{x=self.performance.now.bind(self.performance)}catch(y){b.logger.debug("Unable to use Performance API on this environment"),x=self.Date.now}var f=[{demux:O.default,remux:T.default},{demux:M.default,remux:C.default},{demux:N.default,remux:T.default},{demux:A.default,remux:T.default}],l=1024;f.forEach(function(y){var d=y.demux;l=Math.max(l,d.minProbeByteLength)});var i=function(){function y(h,s,o,g,p){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 R.default,this.observer=h,this.typeSupported=s,this.config=o,this.vendor=g,this.id=p}var d=y.prototype;return d.configure=function(s){this.transmuxConfig=s,this.decrypter&&this.decrypter.reset()},d.push=function(s,o,g,p){var E=this,L=g.transmuxing;L.executeStart=x();var F=new Uint8Array(s),j=this.cache,V=this.config,B=this.currentTransmuxState,I=this.transmuxConfig;p&&(this.currentTransmuxState=p);var $=c(F,o);if($&&$.method==="AES-128"){var ie=this.getDecrypter();if(V.enableSoftwareAES){var ue=ie.softwareDecrypt(F,$.key.buffer,$.iv.buffer);if(!ue)return L.executeEnd=x(),_(g);F=new Uint8Array(ue)}else return this.decryptionPromise=ie.webCryptoDecrypt(F,$.key.buffer,$.iv.buffer).then(function(_e){var Pe=E.push(_e,null,g);return E.decryptionPromise=null,Pe}),this.decryptionPromise}var fe=p||B,ve=fe.contiguous,pe=fe.discontinuity,te=fe.trackSwitch,ee=fe.accurateTimeOffset,se=fe.timeOffset,Q=I.audioCodec,J=I.videoCodec,he=I.defaultInitPts,Ce=I.duration,De=I.initSegmentData;if((pe||te)&&this.resetInitSegment(De,Q,J,Ce),pe&&this.resetInitialTimestamp(he),ve||this.resetContiguity(),this.needsProbing(F,pe,te)){if(j.dataLength){var we=j.flush();F=Object(S.appendUint8Array)(we,F)}this.configureTransmuxer(F,I)}var Me=this.transmux(F,$,se,ee,g),Te=this.currentTransmuxState;return Te.contiguous=!0,Te.discontinuity=!1,Te.trackSwitch=!1,L.executeEnd=x(),Me},d.flush=function(s){var o=this,g=s.transmuxing;g.executeStart=x();var p=this.decrypter,E=this.cache,L=this.currentTransmuxState,F=this.decryptionPromise;if(F)return F.then(function(){return o.flush(s)});var j=[],V=L.timeOffset;if(p){var B=p.flush();B&&j.push(this.push(B,null,s))}var I=E.dataLength;E.reset();var $=this.demuxer,ie=this.remuxer;if(!$||!ie)return I>=l&&this.observer.emit(K.Events.ERROR,K.Events.ERROR,{type:k.ErrorTypes.MEDIA_ERROR,details:k.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),g.executeEnd=x(),[_(s)];var ue=$.flush(V);return v(ue)?ue.then(function(fe){return o.flushRemux(j,fe,s),j}):(this.flushRemux(j,ue,s),j)},d.flushRemux=function(s,o,g){var p=o.audioTrack,E=o.avcTrack,L=o.id3Track,F=o.textTrack,j=this.currentTransmuxState,V=j.accurateTimeOffset,B=j.timeOffset;b.logger.log("[transmuxer.ts]: Flushed fragment "+g.sn+(g.part>-1?" p: "+g.part:"")+" of level "+g.level);var I=this.remuxer.remux(p,E,L,F,B,V,!0,this.id);s.push({remuxResult:I,chunkMeta:g}),g.transmuxing.executeEnd=x()},d.resetInitialTimestamp=function(s){var o=this.demuxer,g=this.remuxer;if(!o||!g)return;o.resetTimeStamp(s),g.resetTimeStamp(s)},d.resetContiguity=function(){var s=this.demuxer,o=this.remuxer;if(!s||!o)return;s.resetContiguity(),o.resetNextTimestamp()},d.resetInitSegment=function(s,o,g,p){var E=this.demuxer,L=this.remuxer;if(!E||!L)return;E.resetInitSegment(o,g,p),L.resetInitSegment(s,o,g)},d.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},d.transmux=function(s,o,g,p,E){var L;return o&&o.method==="SAMPLE-AES"?L=this.transmuxSampleAes(s,o,g,p,E):L=this.transmuxUnencrypted(s,g,p,E),L},d.transmuxUnencrypted=function(s,o,g,p){var E=this.demuxer.demux(s,o,!1,!this.config.progressive),L=E.audioTrack,F=E.avcTrack,j=E.id3Track,V=E.textTrack,B=this.remuxer.remux(L,F,j,V,o,g,!1,this.id);return{remuxResult:B,chunkMeta:p}},d.transmuxSampleAes=function(s,o,g,p,E){var L=this;return this.demuxer.demuxSampleAes(s,o,g).then(function(F){var j=L.remuxer.remux(F.audioTrack,F.avcTrack,F.id3Track,F.textTrack,g,p,!1,L.id);return{remuxResult:j,chunkMeta:E}})},d.configureTransmuxer=function(s,o){for(var g=this.config,p=this.observer,E=this.typeSupported,L=this.vendor,F=o.audioCodec,j=o.defaultInitPts,V=o.duration,B=o.initSegmentData,I=o.videoCodec,$,ie=0,ue=f.length;ie0&&d!=null&&d.key!=null&&d.iv!==null&&d.method!=null&&(h=d),h}var _=function(d){return{remuxResult:{},chunkMeta:d}};function v(y){return"then"in y&&y.then instanceof Function}var m=function(d,h,s,o,g){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=d,this.videoCodec=h,this.initSegmentData=s,this.duration=o,this.defaultInitPts=g},u=function(d,h,s,o,g){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=d,this.contiguous=h,this.accurateTimeOffset=s,this.trackSwitch=o,this.timeOffset=g}},"./src/demux/tsdemuxer.ts":function(ne,G,D){"use strict";D.r(G),D.d(G,"discardEPB",function(){return _});var K=D("./src/demux/adts.ts"),k=D("./src/demux/mpegaudio.ts"),P=D("./src/demux/exp-golomb.ts"),N=D("./src/demux/id3.ts"),M=D("./src/demux/sample-aes.ts"),O=D("./src/events.ts"),A=D("./src/utils/mp4-tools.ts"),T=D("./src/utils/logger.ts"),C=D("./src/errors.ts"),R={video:1,audio:2,id3:3,text:4},S=function(){function v(u,y,d){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=u,this.config=y,this.typeSupported=d}v.probe=function(y){var d=v.syncOffset(y);return d<0?!1:(d&&T.logger.warn("MPEG2-TS detected but first sync word found @ offset "+d+", junk ahead ?"),!0)},v.syncOffset=function(y){for(var d=Math.min(1e3,y.length-3*188),h=0;h>4,Q=void 0;if(se>1){if(Q=pe+5+y[pe+4],Q===pe+188)continue}else Q=pe+4;switch(ee){case L:te&&(F&&(o=l(F))&&this.parseAVCPES(o,!1),F={data:[],size:0}),F&&(F.data.push(y.subarray(Q,pe+188)),F.size+=pe+188-Q);break;case j:te&&(B&&(o=l(B))&&(p.isAAC?this.parseAACPES(o):this.parseMPEGPES(o)),B={data:[],size:0}),B&&(B.data.push(y.subarray(Q,pe+188)),B.size+=pe+188-Q);break;case V:te&&(I&&(o=l(I))&&this.parseID3PES(o),I={data:[],size:0}),I&&(I.data.push(y.subarray(Q,pe+188)),I.size+=pe+188-Q);break;case 0:te&&(Q+=y[Q]+1),ue=this._pmtId=x(y,Q);break;case ue:{te&&(Q+=y[Q]+1);var J=f(y,Q,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,h);L=J.avc,L>0&&(g.pid=L),j=J.audio,j>0&&(p.pid=j,p.isAAC=J.isAAC),V=J.id3,V>0&&(E.pid=V),$&&!ie&&(T.logger.log("reparse from beginning"),$=!1,pe=ve-188),ie=this.pmtParsed=!0;break}case 17:case 8191:break;default:$=!0;break}}else this.observer.emit(O.Events.ERROR,O.Events.ERROR,{type:C.ErrorTypes.MEDIA_ERROR,details:C.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});g.pesData=F,p.pesData=B,E.pesData=I;var he={audioTrack:p,avcTrack:g,id3Track:E,textTrack:this._txtTrack};return s&&this.extractRemainingSamples(he),he},m.flush=function(){var y=this.remainderData;this.remainderData=null;var d;return y?d=this.demux(y,-1,!1,!0):d={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(d),this.sampleAes?this.decrypt(d,this.sampleAes):d},m.extractRemainingSamples=function(y){var d=y.audioTrack,h=y.avcTrack,s=y.id3Track,o=h.pesData,g=d.pesData,p=s.pesData,E;o&&(E=l(o))?(this.parseAVCPES(E,!0),h.pesData=null):h.pesData=o,g&&(E=l(g))?(d.isAAC?this.parseAACPES(E):this.parseMPEGPES(E),d.pesData=null):(g!=null&&g.size&&T.logger.log("last AAC PES packet truncated,might overlap between fragments"),d.pesData=g),p&&(E=l(p))?(this.parseID3PES(E),s.pesData=null):s.pesData=p},m.demuxSampleAes=function(y,d,h){var s=this.demux(y,h,!0,!this.config.progressive),o=this.sampleAes=new M.default(this.observer,this.config,d);return this.decrypt(s,o)},m.decrypt=function(y,d){return new Promise(function(h){var s=y.audioTrack,o=y.avcTrack;s.samples&&s.isAAC?d.decryptAacSamples(s.samples,0,function(){o.samples?d.decryptAvcSamples(o.samples,0,0,function(){h(y)}):h(y)}):o.samples&&d.decryptAvcSamples(o.samples,0,0,function(){h(y)})})},m.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},m.parseAVCPES=function(y,d){var h=this,s=this._avcTrack,o=this.parseAVCNALu(y.data),g=!1,p=this.avcSample,E,L=!1;y.data=null,p&&o.length&&!s.audFound&&(i(p,s),p=this.avcSample=b(!1,y.pts,y.dts,"")),o.forEach(function(F){switch(F.type){case 1:{E=!0,p||(p=h.avcSample=b(!0,y.pts,y.dts,"")),g&&(p.debug+="NDR "),p.frame=!0;var j=F.data;if(L&&j.length>4){var V=new P.default(j).readSliceType();(V===2||V===4||V===7||V===9)&&(p.key=!0)}break}case 5:E=!0,p||(p=h.avcSample=b(!0,y.pts,y.dts,"")),g&&(p.debug+="IDR "),p.key=!0,p.frame=!0;break;case 6:{E=!0,g&&p&&(p.debug+="SEI ");var B=new P.default(_(F.data));B.readUByte();for(var I=0,$=0,ie=!1,ue=0;!ie&&B.bytesAvailable>1;){I=0;do ue=B.readUByte(),I+=ue;while(ue===255);$=0;do ue=B.readUByte(),$+=ue;while(ue===255);if(I===4&&B.bytesAvailable!==0){ie=!0;var fe=B.readUByte();if(fe===181){var ve=B.readUShort();if(ve===49){var pe=B.readUInt();if(pe===1195456820){var te=B.readUByte();if(te===3){for(var ee=B.readUByte(),se=B.readUByte(),Q=31&ee,J=[ee,se],he=0;he16){for(var Ce=[],De=0;De<16;De++)Ce.push(B.readUByte().toString(16)),(De===3||De===5||De===7||De===9)&&Ce.push("-");for(var we=$-16,Me=new Uint8Array(we),Te=0;Te=0){var B={data:y.subarray(j,p-s-1),type:V};g.push(B)}else{var I=this.getLastNalUnit();if(I&&(o&&p<=4-o&&(I.state&&(I.data=I.data.subarray(0,I.data.byteLength-o))),L=p-s-1,L>0)){var $=new Uint8Array(I.data.byteLength+L);$.set(I.data,0),$.set(y.subarray(0,L),I.data.byteLength),I.data=$,I.state=0}}p=0&&s>=0){var ie={data:y.subarray(j,d),type:V,state:s};g.push(ie)}if(g.length===0){var ue=this.getLastNalUnit();if(ue){var fe=new Uint8Array(ue.data.byteLength+y.byteLength);fe.set(ue.data,0),fe.set(y,ue.data.byteLength),ue.data=fe}}return h.naluState=s,g},m.parseAACPES=function(y){var d=0,h=this._audioTrack,s=this.aacOverFlow,o=y.data;if(s){this.aacOverFlow=null;var g=s.sample.unit.byteLength,p=Math.min(s.missing,g),E=g-p;s.sample.unit.set(o.subarray(0,p),E),h.samples.push(s.sample),d=s.missing}var L,F;for(L=d,F=o.length;L1;){var g=new Uint8Array(o[0].length+o[1].length);g.set(o[0]),g.set(o[1],o[0].length),o[0]=g,o.splice(1,1)}u=o[0];var p=(u[0]<<16)+(u[1]<<8)+u[2];if(p===1){if(y=(u[4]<<8)+u[5],y&&y>v.size-6)return null;var E=u[7];E&192&&(h=(u[9]&14)*536870912+(u[10]&255)*4194304+(u[11]&254)*16384+(u[12]&255)*128+(u[13]&254)/2,E&64?(s=(u[14]&14)*536870912+(u[15]&255)*4194304+(u[16]&254)*16384+(u[17]&255)*128+(u[18]&254)/2,h-s>60*9e4&&(T.logger.warn(Math.round((h-s)/9e4)+"s delta between PTS and DTS, align them"),h=s)):s=h),d=u[8];var L=d+9;if(v.size<=L)return null;v.size-=L;for(var F=new Uint8Array(v.size),j=0,V=o.length;jB){L-=B;continue}else u=u.subarray(L),B-=L,L=0;F.set(u,m),m+=B}return y&&(y-=d+3),{data:F,pts:h,dts:s,len:y}}return null}function i(v,m){if(v.units.length&&v.frame){if(v.pts===void 0){var u=m.samples,y=u.length;if(y){var d=u[y-1];v.pts=d.pts,v.dts=d.dts}else{m.dropped++;return}}m.samples.push(v)}v.debug.length&&T.logger.log(v.pts+"/"+v.dts+":"+v.debug)}function c(v,m){var u=v.length;if(u>0){if(m.pts>=v[u-1].pts)v.push(m);else for(var y=u-1;y>=0;y--)if(m.ptsh)return o;return 0}},{key:"maxAutoLevel",get:function(){var d=this.levels,h=this.autoLevelCapping,s;return h===-1&&d&&d.length?s=d.length-1:s=h,s}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(d){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,d)}},{key:"audioTracks",get:function(){var d=this.audioTrackController;return d?d.audioTracks:[]}},{key:"audioTrack",get:function(){var d=this.audioTrackController;return d?d.audioTrack:-1},set:function(d){var h=this.audioTrackController;h&&(h.audioTrack=d)}},{key:"subtitleTracks",get:function(){var d=this.subtitleTrackController;return d?d.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var d=this.subtitleTrackController;return d?d.subtitleTrack:-1},set:function(d){var h=this.subtitleTrackController;h&&(h.subtitleTrack=d)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var d=this.subtitleTrackController;return d?d.subtitleDisplay:!1},set:function(d){var h=this.subtitleTrackController;h&&(h.subtitleDisplay=d)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(d){this.config.lowLatencyMode=d}},{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 l.Events}},{key:"ErrorTypes",get:function(){return i.ErrorTypes}},{key:"ErrorDetails",get:function(){return i.ErrorDetails}},{key:"DefaultConfig",get:function(){return m.defaultConfig?m.defaultConfig:b.hlsDefaultConfig},set:function(d){m.defaultConfig=d}}]),m}();v.defaultConfig=void 0},"./src/is-supported.ts":function(ne,G,D){"use strict";D.r(G),D.d(G,"isSupported",function(){return P}),D.d(G,"changeTypeSupported",function(){return N});var K=D("./src/utils/mediasource-helper.ts");function k(){return self.SourceBuffer||self.WebKitSourceBuffer}function P(){var M=Object(K.getMediaSource)();if(!M)return!1;var O=k(),A=M&&typeof M.isTypeSupported=="function"&&M.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),T=!O||O.prototype&&typeof O.prototype.appendBuffer=="function"&&typeof O.prototype.remove=="function";return!!A&&!!T}function N(){var M,O=k();return typeof(O==null||((M=O.prototype)===null||M===void 0)?void 0:M.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(ne,G,D){"use strict";D.r(G),D.d(G,"default",function(){return S}),D.d(G,"LoadError",function(){return x});var K=D("./src/polyfills/number.ts"),k=D("./src/errors.ts");function P(f,l){f.prototype=Object.create(l.prototype),f.prototype.constructor=f,T(f,l)}function N(f){var l=typeof Map=="function"?new Map:void 0;return N=function(c){if(c===null||!A(c))return c;if(typeof c!="function")throw new TypeError("Super expression must either be null or a function");if(typeof l!="undefined"){if(l.has(c))return l.get(c);l.set(c,_)}function _(){return M(c,arguments,C(this).constructor)}return _.prototype=Object.create(c.prototype,{constructor:{value:_,enumerable:!1,writable:!0,configurable:!0}}),T(_,c)},N(f)}function M(f,l,i){return O()?M=Reflect.construct:M=function(_,v,m){var u=[null];u.push.apply(u,v);var y=Function.bind.apply(_,u),d=new y;return m&&T(d,m.prototype),d},M.apply(null,arguments)}function O(){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(f){return!1}}function A(f){return Function.toString.call(f).indexOf("[native code]")!==-1}function T(f,l){return T=Object.setPrototypeOf||function(c,_){return c.__proto__=_,c},T(f,l)}function C(f){return C=Object.setPrototypeOf?Object.getPrototypeOf:function(i){return i.__proto__||Object.getPrototypeOf(i)},C(f)}var R=Math.pow(2,17),S=function(){function f(i){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=i}var l=f.prototype;return l.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},l.abort=function(){this.loader&&this.loader.abort()},l.load=function(c,_){var v=this,m=c.url;if(!m)return Promise.reject(new x({type:k.ErrorTypes.NETWORK_ERROR,details:k.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:c,networkDetails:null},"Fragment does not have a "+(m?"part list":"url")));this.abort();var u=this.config,y=u.fLoader,d=u.loader;return new Promise(function(h,s){v.loader&&v.loader.destroy();var o=v.loader=c.loader=y?new y(u):new d(u),g=b(c),p={timeout:u.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:u.fragLoadingMaxRetryTimeout,highWaterMark:R};c.stats=o.stats,o.load(g,p,{onSuccess:function(L,F,j,V){v.resetLoader(c,o),h({frag:c,part:null,payload:L.data,networkDetails:V})},onError:function(L,F,j){v.resetLoader(c,o),s(new x({type:k.ErrorTypes.NETWORK_ERROR,details:k.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:c,response:L,networkDetails:j}))},onAbort:function(L,F,j){v.resetLoader(c,o),s(new x({type:k.ErrorTypes.NETWORK_ERROR,details:k.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:c,networkDetails:j}))},onTimeout:function(L,F,j){v.resetLoader(c,o),s(new x({type:k.ErrorTypes.NETWORK_ERROR,details:k.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:c,networkDetails:j}))},onProgress:function(L,F,j,V){_&&_({frag:c,part:null,payload:j,networkDetails:V})}})})},l.loadPart=function(c,_,v){var m=this;this.abort();var u=this.config,y=u.fLoader,d=u.loader;return new Promise(function(h,s){m.loader&&m.loader.destroy();var o=m.loader=c.loader=y?new y(u):new d(u),g=b(c,_),p={timeout:u.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:u.fragLoadingMaxRetryTimeout,highWaterMark:R};_.stats=o.stats,o.load(g,p,{onSuccess:function(L,F,j,V){m.resetLoader(c,o),m.updateStatsFromPart(c,_);var B={frag:c,part:_,payload:L.data,networkDetails:V};v(B),h(B)},onError:function(L,F,j){m.resetLoader(c,o),s(new x({type:k.ErrorTypes.NETWORK_ERROR,details:k.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:c,part:_,response:L,networkDetails:j}))},onAbort:function(L,F,j){c.stats.aborted=_.stats.aborted,m.resetLoader(c,o),s(new x({type:k.ErrorTypes.NETWORK_ERROR,details:k.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:c,part:_,networkDetails:j}))},onTimeout:function(L,F,j){m.resetLoader(c,o),s(new x({type:k.ErrorTypes.NETWORK_ERROR,details:k.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:c,part:_,networkDetails:j}))}})})},l.updateStatsFromPart=function(c,_){var v=c.stats,m=_.stats,u=m.total;if(v.loaded+=m.loaded,u){var y=Math.round(c.duration/_.duration),d=Math.min(Math.round(v.loaded/u),y),h=y-d,s=h*Math.round(v.loaded/d);v.total=v.loaded+s}else v.total=Math.max(v.loaded,v.total);var o=v.loading,g=m.loading;o.start?o.first+=g.first-g.start:(o.start=g.start,o.first=g.first),o.end=g.end},l.resetLoader=function(c,_){c.loader=null,this.loader===_&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),_.destroy()},f}();function b(f,l){l===void 0&&(l=null);var i=l||f,c={frag:f,part:l,responseType:"arraybuffer",url:i.url,headers:{},rangeStart:0,rangeEnd:0},_=i.byteRangeStartOffset,v=i.byteRangeEndOffset;return Object(K.isFiniteNumber)(_)&&Object(K.isFiniteNumber)(v)&&(c.rangeStart=_,c.rangeEnd=v),c}var x=function(f){P(l,f);function l(i){for(var c,_=arguments.length,v=new Array(_>1?_-1:0),m=1;m<_;m++)v[m-1]=arguments[m];return c=f.call.apply(f,[this].concat(v))||this,c.data=void 0,c.data=i,c}return l}(N(Error))},"./src/loader/fragment.ts":function(ne,G,D){"use strict";D.r(G),D.d(G,"ElementaryStreamTypes",function(){return S}),D.d(G,"BaseSegment",function(){return b}),D.d(G,"Fragment",function(){return x}),D.d(G,"Part",function(){return f});var K=D("./src/polyfills/number.ts"),k=D("./node_modules/url-toolkit/src/url-toolkit.js"),P=D.n(k),N=D("./src/utils/logger.ts"),M=D("./src/loader/level-key.ts"),O=D("./src/loader/load-stats.ts");function A(l,i){l.prototype=Object.create(i.prototype),l.prototype.constructor=l,T(l,i)}function T(l,i){return T=Object.setPrototypeOf||function(_,v){return _.__proto__=v,_},T(l,i)}function C(l,i){for(var c=0;c>8*(15-u)&255;return m},c.setDecryptDataFromLevelKey=function(v,m){var u=v;return(v==null?void 0:v.method)==="AES-128"&&v.uri&&!v.iv&&(u=M.LevelKey.fromURI(v.uri),u.method=v.method,u.iv=this.createInitializationVector(m),u.keyFormat="identity"),u},c.setElementaryStreamInfo=function(v,m,u,y,d,h){h===void 0&&(h=!1);var s=this.elementaryStreams,o=s[v];if(!o){s[v]={startPTS:m,endPTS:u,startDTS:y,endDTS:d,partial:h};return}o.startPTS=Math.min(o.startPTS,m),o.endPTS=Math.max(o.endPTS,u),o.startDTS=Math.min(o.startDTS,y),o.endDTS=Math.max(o.endDTS,d)},c.clearElementaryStreamInfo=function(){var v=this.elementaryStreams;v[S.AUDIO]=null,v[S.VIDEO]=null,v[S.AUDIOVIDEO]=null},R(i,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var v=this.sn;typeof v!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&N.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),v=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,v)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(K.isFiniteNumber)(this.programDateTime))return null;var v=Object(K.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+v*1e3}},{key:"encrypted",get:function(){var v;return!!((v=this.decryptdata)!==null&&v!==void 0&&v.keyFormat&&this.decryptdata.uri)}}]),i}(b),f=function(l){A(i,l);function i(c,_,v,m,u){var y;y=l.call(this,v)||this,y.fragOffset=0,y.duration=0,y.gap=!1,y.independent=!1,y.relurl=void 0,y.fragment=void 0,y.index=void 0,y.stats=new O.LoadStats,y.duration=c.decimalFloatingPoint("DURATION"),y.gap=c.bool("GAP"),y.independent=c.bool("INDEPENDENT"),y.relurl=c.enumeratedString("URI"),y.fragment=_,y.index=m;var d=c.enumeratedString("BYTERANGE");return d&&y.setByteRange(d,u),u&&(y.fragOffset=u.fragOffset+u.duration),y}return R(i,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var _=this.elementaryStreams;return!!(_.audio||_.video||_.audiovideo)}}]),i}(b)},"./src/loader/key-loader.ts":function(ne,G,D){"use strict";D.r(G),D.d(G,"default",function(){return N});var K=D("./src/events.ts"),k=D("./src/errors.ts"),P=D("./src/utils/logger.ts"),N=function(){function M(A){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=A,this._registerListeners()}var O=M.prototype;return O._registerListeners=function(){this.hls.on(K.Events.KEY_LOADING,this.onKeyLoading,this)},O._unregisterListeners=function(){this.hls.off(K.Events.KEY_LOADING,this.onKeyLoading)},O.destroy=function(){this._unregisterListeners();for(var T in this.loaders){var C=this.loaders[T];C&&C.destroy()}this.loaders={}},O.onKeyLoading=function(T,C){var R=C.frag,S=R.type,b=this.loaders[S];if(!R.decryptdata){P.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var x=R.decryptdata.uri;if(x!==this.decrypturl||this.decryptkey===null){var f=this.hls.config;if(b&&(P.logger.warn("abort previous key loader for type:"+S),b.abort()),!x){P.logger.warn("key uri is falsy");return}var l=f.loader,i=R.loader=this.loaders[S]=new l(f);this.decrypturl=x,this.decryptkey=null;var c={url:x,frag:R,responseType:"arraybuffer"},_={timeout:f.fragLoadingTimeOut,maxRetry:0,retryDelay:f.fragLoadingRetryDelay,maxRetryDelay:f.fragLoadingMaxRetryTimeout,highWaterMark:0},v={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};i.load(c,_,v)}else this.decryptkey&&(R.decryptdata.key=this.decryptkey,this.hls.trigger(K.Events.KEY_LOADED,{frag:R}))},O.loadsuccess=function(T,C,R){var S=R.frag;if(!S.decryptdata){P.logger.error("after key load, decryptdata unset");return}this.decryptkey=S.decryptdata.key=new Uint8Array(T.data),S.loader=null,delete this.loaders[S.type],this.hls.trigger(K.Events.KEY_LOADED,{frag:S})},O.loaderror=function(T,C){var R=C.frag,S=R.loader;S&&S.abort(),delete this.loaders[R.type],this.hls.trigger(K.Events.ERROR,{type:k.ErrorTypes.NETWORK_ERROR,details:k.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:R,response:T})},O.loadtimeout=function(T,C){var R=C.frag,S=R.loader;S&&S.abort(),delete this.loaders[R.type],this.hls.trigger(K.Events.ERROR,{type:k.ErrorTypes.NETWORK_ERROR,details:k.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:R})},M}()},"./src/loader/level-details.ts":function(ne,G,D){"use strict";D.r(G),D.d(G,"LevelDetails",function(){return M});var K=D("./src/polyfills/number.ts");function k(O,A){for(var T=0;TC.endSN||R>0||R===0&&S>0,this.updated||this.advanced?this.misses=Math.floor(C.misses*.6):this.misses=C.misses+1,this.availabilityDelay=C.availabilityDelay},P(O,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(K.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||N}},{key:"drift",get:function(){var C=this.driftEndTime-this.driftStartTime;if(C>0){var R=this.driftEnd-this.driftStart;return R*1e3/C}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var C;return(C=this.partList)!==null&&C!==void 0&&C.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var C;return(C=this.fragments)!==null&&C!==void 0&&C.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 C;return(C=this.partList)!==null&&C!==void 0&&C.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var C;return(C=this.partList)!==null&&C!==void 0&&C.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),O}()},"./src/loader/level-key.ts":function(ne,G,D){"use strict";D.r(G),D.d(G,"LevelKey",function(){return M});var K=D("./node_modules/url-toolkit/src/url-toolkit.js"),k=D.n(K);function P(O,A){for(var T=0;T2){var s=h.shift()+".";return s+=parseInt(h.shift()).toString(16),s+=("000"+parseInt(h.shift()).toString(16)).substr(-4),s}return d},u.resolve=function(d,h){return k.buildAbsoluteURL(h,d,{alwaysNormalize:!0})},u.parseMasterPlaylist=function(d,h){var s=[],o={},g=!1;R.lastIndex=0;for(var p;(p=R.exec(d))!=null;)if(p[1]){var E=new A.AttrList(p[1]),L={attrs:E,bitrate:E.decimalInteger("AVERAGE-BANDWIDTH")||E.decimalInteger("BANDWIDTH"),name:E.NAME,url:u.resolve(p[2],h)},F=E.decimalResolution("RESOLUTION");F&&(L.width=F.width,L.height=F.height),c((E.CODECS||"").split(/[ ,]+/).filter(function(V){return V}),L),L.videoCodec&&L.videoCodec.indexOf("avc1")!==-1&&(L.videoCodec=u.convertAVC1ToAVCOTI(L.videoCodec)),s.push(L)}else if(p[3]){var j=new A.AttrList(p[3]);j["DATA-ID"]&&(g=!0,o[j["DATA-ID"]]=j)}return{levels:s,sessionData:g?o:null}},u.parseMasterPlaylistMedia=function(d,h,s,o){o===void 0&&(o=[]);var g,p=[],E=0;for(S.lastIndex=0;(g=S.exec(d))!==null;){var L=new A.AttrList(g[1]);if(L.TYPE===s){var F={attrs:L,bitrate:0,id:E++,groupId:L["GROUP-ID"],instreamId:L["INSTREAM-ID"],name:L.NAME||L.LANGUAGE||"",type:s,default:L.bool("DEFAULT"),autoselect:L.bool("AUTOSELECT"),forced:L.bool("FORCED"),lang:L.LANGUAGE,url:L.URI?u.resolve(L.URI,h):""};if(o.length){var j=u.findGroup(o,F.groupId)||o[0];_(F,j,"audioCodec"),_(F,j,"textCodec")}p.push(F)}}return p},u.parseLevelPlaylist=function(d,h,s,o,g){var p=new M.LevelDetails(h),E=p.fragments,L=null,F=0,j=0,V=0,B=0,I=null,$=new N.Fragment(o,h),ie,ue,fe,ve=-1,pe=!1;for(b.lastIndex=0,p.m3u8=d;(ie=b.exec(d))!==null;){pe&&(pe=!1,$=new N.Fragment(o,h),$.start=V,$.sn=F,$.cc=B,$.level=s,L&&($.initSegment=L,$.rawProgramDateTime=L.rawProgramDateTime));var te=ie[1];if(te){$.duration=parseFloat(te);var ee=(" "+ie[2]).slice(1);$.title=ee||null,$.tagList.push(ee?["INF",te,ee]:["INF",te])}else if(ie[3])Object(K.isFiniteNumber)($.duration)&&($.start=V,fe&&($.levelkey=fe),$.sn=F,$.level=s,$.cc=B,$.urlId=g,E.push($),$.relurl=(" "+ie[3]).slice(1),m($,I),I=$,V+=$.duration,F++,j=0,pe=!0);else if(ie[4]){var se=(" "+ie[4]).slice(1);I?$.setByteRange(se,I):$.setByteRange(se)}else if(ie[5])$.rawProgramDateTime=(" "+ie[5]).slice(1),$.tagList.push(["PROGRAM-DATE-TIME",$.rawProgramDateTime]),ve===-1&&(ve=E.length);else{if(ie=ie[0].match(x),!ie){T.logger.warn("No matches on slow regex match for level playlist!");continue}for(ue=1;ue-1){T.logger.warn("Keyformat "+et+" is not supported from the manifest");continue}else if(et!=="identity")continue;Pe&&(fe=O.LevelKey.fromURL(h,je),je&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(Pe)>=0&&(fe.method=Pe,fe.keyFormat=et,Ae&&(fe.keyID=Ae),Ie&&(fe.keyFormatVersions=Ie),fe.iv=Qe));break}case"START":{var lt=new A.AttrList(J),$e=lt.decimalFloatingPoint("TIME-OFFSET");Object(K.isFiniteNumber)($e)&&(p.startTimeOffset=$e);break}case"MAP":{var ft=new A.AttrList(J);$.relurl=ft.URI,ft.BYTERANGE&&$.setByteRange(ft.BYTERANGE),$.level=s,$.sn="initSegment",fe&&($.levelkey=fe),$.initSegment=null,L=$,pe=!0;break}case"SERVER-CONTROL":{var ut=new A.AttrList(J);p.canBlockReload=ut.bool("CAN-BLOCK-RELOAD"),p.canSkipUntil=ut.optionalFloat("CAN-SKIP-UNTIL",0),p.canSkipDateRanges=p.canSkipUntil>0&&ut.bool("CAN-SKIP-DATERANGES"),p.partHoldBack=ut.optionalFloat("PART-HOLD-BACK",0),p.holdBack=ut.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var st=new A.AttrList(J);p.partTarget=st.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Se=p.partList;Se||(Se=p.partList=[]);var Et=j>0?Se[Se.length-1]:void 0,dt=j++,Re=new N.Part(new A.AttrList(J),$,h,dt,Et);Se.push(Re),$.duration+=Re.duration;break}case"PRELOAD-HINT":{var He=new A.AttrList(J);p.preloadHint=He;break}case"RENDITION-REPORT":{var me=new A.AttrList(J);p.renditionReports=p.renditionReports||[],p.renditionReports.push(me);break}default:T.logger.warn("line parsed but not handled: "+ie);break}}}I&&!I.relurl?(E.pop(),V-=I.duration,p.partList&&(p.fragmentHint=I)):p.partList&&(m($,I),$.cc=B,p.fragmentHint=$);var le=E.length,de=E[0],Y=E[le-1];if(V+=p.skippedSegments*p.targetduration,V>0&&le&&Y){p.averagetargetduration=V/le;var Z=Y.sn;p.endSN=Z!=="initSegment"?Z:0,de&&(p.startCC=de.cc,de.initSegment||p.fragments.every(function(q){return q.relurl&&l(q.relurl)})&&(T.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),$=new N.Fragment(o,h),$.relurl=Y.relurl,$.level=s,$.sn="initSegment",de.initSegment=$,p.needSidxRanges=!0))}else p.endSN=0,p.startCC=0;return p.fragmentHint&&(V+=p.fragmentHint.duration),p.totalduration=V,p.endCC=B,ve>0&&v(E,ve),p},u}();function c(u,y){["video","audio","text"].forEach(function(d){var h=u.filter(function(o){return Object(C.isCodecType)(o,d)});if(h.length){var s=h.filter(function(o){return o.lastIndexOf("avc1",0)===0||o.lastIndexOf("mp4a",0)===0});y[d+"Codec"]=s.length>0?s[0]:h[0],u=u.filter(function(o){return h.indexOf(o)===-1})}}),y.unknownCodecs=u}function _(u,y,d){var h=y[d];h&&(u[d]=h)}function v(u,y){for(var d=u[y],h=y;h--;){var s=u[h];if(!s)return;s.programDateTime=d.programDateTime-s.duration*1e3,d=s}}function m(u,y){u.rawProgramDateTime?u.programDateTime=Date.parse(u.rawProgramDateTime):y!=null&&y.programDateTime&&(u.programDateTime=y.endProgramDateTime),Object(K.isFiniteNumber)(u.programDateTime)||(u.programDateTime=null,u.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(ne,G,D){"use strict";D.r(G);var K=D("./src/polyfills/number.ts"),k=D("./src/events.ts"),P=D("./src/errors.ts"),N=D("./src/utils/logger.ts"),M=D("./src/utils/mp4-tools.ts"),O=D("./src/loader/m3u8-parser.ts"),A=D("./src/types/loader.ts"),T=D("./src/utils/attr-list.ts");function C(b){var x=b.type;switch(x){case A.PlaylistContextType.AUDIO_TRACK:return A.PlaylistLevelType.AUDIO;case A.PlaylistContextType.SUBTITLE_TRACK:return A.PlaylistLevelType.SUBTITLE;default:return A.PlaylistLevelType.MAIN}}function R(b,x){var f=b.url;return(f===void 0||f.indexOf("data:")===0)&&(f=x.url),f}var S=function(){function b(f){this.hls=void 0,this.loaders=Object.create(null),this.hls=f,this.registerListeners()}var x=b.prototype;return x.registerListeners=function(){var l=this.hls;l.on(k.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.on(k.Events.LEVEL_LOADING,this.onLevelLoading,this),l.on(k.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),l.on(k.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},x.unregisterListeners=function(){var l=this.hls;l.off(k.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.off(k.Events.LEVEL_LOADING,this.onLevelLoading,this),l.off(k.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),l.off(k.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},x.createInternalLoader=function(l){var i=this.hls.config,c=i.pLoader,_=i.loader,v=c||_,m=new v(i);return l.loader=m,this.loaders[l.type]=m,m},x.getInternalLoader=function(l){return this.loaders[l.type]},x.resetInternalLoader=function(l){this.loaders[l]&&delete this.loaders[l]},x.destroyInternalLoaders=function(){for(var l in this.loaders){var i=this.loaders[l];i&&i.destroy(),this.resetInternalLoader(l)}},x.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},x.onManifestLoading=function(l,i){var c=i.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:A.PlaylistContextType.MANIFEST,url:c,deliveryDirectives:null})},x.onLevelLoading=function(l,i){var c=i.id,_=i.level,v=i.url,m=i.deliveryDirectives;this.load({id:c,groupId:null,level:_,responseType:"text",type:A.PlaylistContextType.LEVEL,url:v,deliveryDirectives:m})},x.onAudioTrackLoading=function(l,i){var c=i.id,_=i.groupId,v=i.url,m=i.deliveryDirectives;this.load({id:c,groupId:_,level:null,responseType:"text",type:A.PlaylistContextType.AUDIO_TRACK,url:v,deliveryDirectives:m})},x.onSubtitleTrackLoading=function(l,i){var c=i.id,_=i.groupId,v=i.url,m=i.deliveryDirectives;this.load({id:c,groupId:_,level:null,responseType:"text",type:A.PlaylistContextType.SUBTITLE_TRACK,url:v,deliveryDirectives:m})},x.load=function(l){var i,c=this.hls.config,_=this.getInternalLoader(l);if(_){var v=_.context;if(v&&v.url===l.url){N.logger.trace("[playlist-loader]: playlist request ongoing");return}N.logger.log("[playlist-loader]: aborting previous loader for type: "+l.type),_.abort()}var m,u,y,d;switch(l.type){case A.PlaylistContextType.MANIFEST:m=c.manifestLoadingMaxRetry,u=c.manifestLoadingTimeOut,y=c.manifestLoadingRetryDelay,d=c.manifestLoadingMaxRetryTimeout;break;case A.PlaylistContextType.LEVEL:case A.PlaylistContextType.AUDIO_TRACK:case A.PlaylistContextType.SUBTITLE_TRACK:m=0,u=c.levelLoadingTimeOut;break;default:m=c.levelLoadingMaxRetry,u=c.levelLoadingTimeOut,y=c.levelLoadingRetryDelay,d=c.levelLoadingMaxRetryTimeout;break}if(_=this.createInternalLoader(l),(i=l.deliveryDirectives)!==null&&i!==void 0&&i.part){var h;if(l.type===A.PlaylistContextType.LEVEL&&l.level!==null?h=this.hls.levels[l.level].details:l.type===A.PlaylistContextType.AUDIO_TRACK&&l.id!==null?h=this.hls.audioTracks[l.id].details:l.type===A.PlaylistContextType.SUBTITLE_TRACK&&l.id!==null&&(h=this.hls.subtitleTracks[l.id].details),h){var s=h.partTarget,o=h.targetduration;s&&o&&(u=Math.min(Math.max(s*3,o*.8)*1e3,u))}}var g={timeout:u,maxRetry:m,retryDelay:y,maxRetryDelay:d,highWaterMark:0},p={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};_.load(l,g,p)},x.loadsuccess=function(l,i,c,_){if(_===void 0&&(_=null),c.isSidxRequest){this.handleSidxRequest(l,c),this.handlePlaylistLoaded(l,i,c,_);return}this.resetInternalLoader(c.type);var v=l.data;if(v.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(l,c,"no EXTM3U delimiter",_);return}i.parsing.start=performance.now(),v.indexOf("#EXTINF:")>0||v.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(l,i,c,_):this.handleMasterPlaylist(l,i,c,_)},x.loaderror=function(l,i,c){c===void 0&&(c=null),this.handleNetworkError(i,c,!1,l)},x.loadtimeout=function(l,i,c){c===void 0&&(c=null),this.handleNetworkError(i,c,!0)},x.handleMasterPlaylist=function(l,i,c,_){var v=this.hls,m=l.data,u=R(l,c),y=O.default.parseMasterPlaylist(m,u),d=y.levels,h=y.sessionData;if(!d.length){this.handleManifestParsingError(l,c,"no level found in manifest",_);return}var s=d.map(function(F){return{id:F.attrs.AUDIO,audioCodec:F.audioCodec}}),o=d.map(function(F){return{id:F.attrs.SUBTITLES,textCodec:F.textCodec}}),g=O.default.parseMasterPlaylistMedia(m,u,"AUDIO",s),p=O.default.parseMasterPlaylistMedia(m,u,"SUBTITLES",o),E=O.default.parseMasterPlaylistMedia(m,u,"CLOSED-CAPTIONS");if(g.length){var L=g.some(function(F){return!F.url});!L&&d[0].audioCodec&&!d[0].attrs.AUDIO&&(N.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),g.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new T.AttrList({}),bitrate:0,url:""}))}v.trigger(k.Events.MANIFEST_LOADED,{levels:d,audioTracks:g,subtitles:p,captions:E,url:u,stats:i,networkDetails:_,sessionData:h})},x.handleTrackOrLevelPlaylist=function(l,i,c,_){var v=this.hls,m=c.id,u=c.level,y=c.type,d=R(l,c),h=Object(K.isFiniteNumber)(m)?m:0,s=Object(K.isFiniteNumber)(u)?u:h,o=C(c),g=O.default.parseLevelPlaylist(l.data,d,s,o,h);if(!g.fragments.length){v.trigger(k.Events.ERROR,{type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:d,reason:"no fragments found in level",level:typeof c.level=="number"?c.level:void 0});return}if(y===A.PlaylistContextType.MANIFEST){var p={attrs:new T.AttrList({}),bitrate:0,details:g,name:"",url:d};v.trigger(k.Events.MANIFEST_LOADED,{levels:[p],audioTracks:[],url:d,stats:i,networkDetails:_,sessionData:null})}if(i.parsing.end=performance.now(),g.needSidxRanges){var E,L=(E=g.fragments[0].initSegment)===null||E===void 0?void 0:E.url;this.load({url:L,isSidxRequest:!0,type:y,level:u,levelDetails:g,id:m,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}c.levelDetails=g,this.handlePlaylistLoaded(l,i,c,_)},x.handleSidxRequest=function(l,i){var c=Object(M.parseSegmentIndex)(new Uint8Array(l.data));if(!c)return;var _=c.references,v=i.levelDetails;_.forEach(function(m,u){var y=m.info,d=v.fragments[u];d.byteRange.length===0&&d.setByteRange(String(1+y.end-y.start)+"@"+String(y.start)),d.initSegment&&d.initSegment.setByteRange(String(c.moovEndOffset)+"@0")})},x.handleManifestParsingError=function(l,i,c,_){this.hls.trigger(k.Events.ERROR,{type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:i.type===A.PlaylistContextType.MANIFEST,url:l.url,reason:c,response:l,context:i,networkDetails:_})},x.handleNetworkError=function(l,i,c,_){c===void 0&&(c=!1),N.logger.warn("[playlist-loader]: A network "+(c?"timeout":"error")+" occurred while loading "+l.type+" level: "+l.level+" id: "+l.id+' group-id: "'+l.groupId+'"');var v=P.ErrorDetails.UNKNOWN,m=!1,u=this.getInternalLoader(l);switch(l.type){case A.PlaylistContextType.MANIFEST:v=c?P.ErrorDetails.MANIFEST_LOAD_TIMEOUT:P.ErrorDetails.MANIFEST_LOAD_ERROR,m=!0;break;case A.PlaylistContextType.LEVEL:v=c?P.ErrorDetails.LEVEL_LOAD_TIMEOUT:P.ErrorDetails.LEVEL_LOAD_ERROR,m=!1;break;case A.PlaylistContextType.AUDIO_TRACK:v=c?P.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:P.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,m=!1;break;case A.PlaylistContextType.SUBTITLE_TRACK:v=c?P.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:P.ErrorDetails.SUBTITLE_LOAD_ERROR,m=!1;break}u&&this.resetInternalLoader(l.type);var y={type:P.ErrorTypes.NETWORK_ERROR,details:v,fatal:m,url:l.url,loader:u,context:l,networkDetails:i};_&&(y.response=_),this.hls.trigger(k.Events.ERROR,y)},x.handlePlaylistLoaded=function(l,i,c,_){var v=c.type,m=c.level,u=c.id,y=c.groupId,d=c.loader,h=c.levelDetails,s=c.deliveryDirectives;if(!(h!=null&&h.targetduration)){this.handleManifestParsingError(l,c,"invalid target duration",_);return}if(!d)return;h.live&&(d.getCacheAge&&(h.ageHeader=d.getCacheAge()||0),(!d.getCacheAge||isNaN(h.ageHeader))&&(h.ageHeader=0));switch(v){case A.PlaylistContextType.MANIFEST:case A.PlaylistContextType.LEVEL:this.hls.trigger(k.Events.LEVEL_LOADED,{details:h,level:m||0,id:u||0,stats:i,networkDetails:_,deliveryDirectives:s});break;case A.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(k.Events.AUDIO_TRACK_LOADED,{details:h,id:u||0,groupId:y||"",stats:i,networkDetails:_,deliveryDirectives:s});break;case A.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(k.Events.SUBTITLE_TRACK_LOADED,{details:h,id:u||0,groupId:y||"",stats:i,networkDetails:_,deliveryDirectives:s});break}},b}();G.default=S},"./src/polyfills/number.ts":function(ne,G,D){"use strict";D.r(G),D.d(G,"isFiniteNumber",function(){return K}),D.d(G,"MAX_SAFE_INTEGER",function(){return k});var K=Number.isFinite||function(P){return typeof P=="number"&&isFinite(P)},k=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(ne,G,D){"use strict";D.r(G);var K=function(){function k(){}return k.getSilentFrame=function(N,M){switch(N){case"mp4a.40.2":if(M===1)return new Uint8Array([0,200,0,128,35,128]);if(M===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(M===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(M===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(M===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(M===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(M===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(M===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(M===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},k}();G.default=K},"./src/remux/mp4-generator.ts":function(ne,G,D){"use strict";D.r(G);var K=Math.pow(2,32)-1,k=function(){function P(){}return P.init=function(){P.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 M;for(M in P.types)P.types.hasOwnProperty(M)&&(P.types[M]=[M.charCodeAt(0),M.charCodeAt(1),M.charCodeAt(2),M.charCodeAt(3)]);var O=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]),A=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]);P.HDLR_TYPES={video:O,audio:A};var T=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),C=new Uint8Array([0,0,0,0,0,0,0,0]);P.STTS=P.STSC=P.STCO=C,P.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),P.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),P.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),P.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var R=new Uint8Array([105,115,111,109]),S=new Uint8Array([97,118,99,49]),b=new Uint8Array([0,0,0,1]);P.FTYP=P.box(P.types.ftyp,R,b,R,S),P.DINF=P.box(P.types.dinf,P.box(P.types.dref,T))},P.box=function(M){for(var O=8,A=arguments.length,T=new Array(A>1?A-1:0),C=1;C>24&255,b[1]=O>>16&255,b[2]=O>>8&255,b[3]=O&255,b.set(M,4),R=0,O=8;R>24&255,M>>16&255,M>>8&255,M&255,A>>24,A>>16&255,A>>8&255,A&255,T>>24,T>>16&255,T>>8&255,T&255,85,196,0,0]))},P.mdia=function(M){return P.box(P.types.mdia,P.mdhd(M.timescale,M.duration),P.hdlr(M.type),P.minf(M))},P.mfhd=function(M){return P.box(P.types.mfhd,new Uint8Array([0,0,0,0,M>>24,M>>16&255,M>>8&255,M&255]))},P.minf=function(M){return M.type==="audio"?P.box(P.types.minf,P.box(P.types.smhd,P.SMHD),P.DINF,P.stbl(M)):P.box(P.types.minf,P.box(P.types.vmhd,P.VMHD),P.DINF,P.stbl(M))},P.moof=function(M,O,A){return P.box(P.types.moof,P.mfhd(M),P.traf(A,O))},P.moov=function(M){for(var O=M.length,A=[];O--;)A[O]=P.trak(M[O]);return P.box.apply(null,[P.types.moov,P.mvhd(M[0].timescale,M[0].duration)].concat(A).concat(P.mvex(M)))},P.mvex=function(M){for(var O=M.length,A=[];O--;)A[O]=P.trex(M[O]);return P.box.apply(null,[P.types.mvex].concat(A))},P.mvhd=function(M,O){O*=M;var A=Math.floor(O/(K+1)),T=Math.floor(O%(K+1)),C=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,M>>24&255,M>>16&255,M>>8&255,M&255,A>>24,A>>16&255,A>>8&255,A&255,T>>24,T>>16&255,T>>8&255,T&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 P.box(P.types.mvhd,C)},P.sdtp=function(M){var O=M.samples||[],A=new Uint8Array(4+O.length),T,C;for(T=0;T>>8&255),O.push(R&255),O=O.concat(Array.prototype.slice.call(C));for(T=0;T>>8&255),A.push(R&255),A=A.concat(Array.prototype.slice.call(C));var S=P.box(P.types.avcC,new Uint8Array([1,O[3],O[4],O[5],252|3,224|M.sps.length].concat(O).concat([M.pps.length]).concat(A))),b=M.width,x=M.height,f=M.pixelRatio[0],l=M.pixelRatio[1];return P.box(P.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,b>>8&255,b&255,x>>8&255,x&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]),S,P.box(P.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),P.box(P.types.pasp,new Uint8Array([f>>24,f>>16&255,f>>8&255,f&255,l>>24,l>>16&255,l>>8&255,l&255])))},P.esds=function(M){var O=M.config.length;return new Uint8Array([0,0,0,0,3,23+O,0,1,0,4,15+O,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([O]).concat(M.config).concat([6,1,2]))},P.mp4a=function(M){var O=M.samplerate;return P.box(P.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,M.channelCount,0,16,0,0,0,0,O>>8&255,O&255,0,0]),P.box(P.types.esds,P.esds(M)))},P.mp3=function(M){var O=M.samplerate;return P.box(P.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,M.channelCount,0,16,0,0,0,0,O>>8&255,O&255,0,0]))},P.stsd=function(M){return M.type==="audio"?!M.isAAC&&M.codec==="mp3"?P.box(P.types.stsd,P.STSD,P.mp3(M)):P.box(P.types.stsd,P.STSD,P.mp4a(M)):P.box(P.types.stsd,P.STSD,P.avc1(M))},P.tkhd=function(M){var O=M.id,A=M.duration*M.timescale,T=M.width,C=M.height,R=Math.floor(A/(K+1)),S=Math.floor(A%(K+1));return P.box(P.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,O>>24&255,O>>16&255,O>>8&255,O&255,0,0,0,0,R>>24,R>>16&255,R>>8&255,R&255,S>>24,S>>16&255,S>>8&255,S&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,T>>8&255,T&255,0,0,C>>8&255,C&255,0,0]))},P.traf=function(M,O){var A=P.sdtp(M),T=M.id,C=Math.floor(O/(K+1)),R=Math.floor(O%(K+1));return P.box(P.types.traf,P.box(P.types.tfhd,new Uint8Array([0,0,0,0,T>>24,T>>16&255,T>>8&255,T&255])),P.box(P.types.tfdt,new Uint8Array([1,0,0,0,C>>24,C>>16&255,C>>8&255,C&255,R>>24,R>>16&255,R>>8&255,R&255])),P.trun(M,A.length+16+20+8+16+8+8),A)},P.trak=function(M){return M.duration=M.duration||4294967295,P.box(P.types.trak,P.tkhd(M),P.mdia(M))},P.trex=function(M){var O=M.id;return P.box(P.types.trex,new Uint8Array([0,0,0,0,O>>24,O>>16&255,O>>8&255,O&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},P.trun=function(M,O){var A=M.samples||[],T=A.length,C=12+16*T,R=new Uint8Array(C),S,b,x,f,l,i;for(O+=8+C,R.set([0,0,15,1,T>>>24&255,T>>>16&255,T>>>8&255,T&255,O>>>24&255,O>>>16&255,O>>>8&255,O&255],0),S=0;S>>24&255,x>>>16&255,x>>>8&255,x&255,f>>>24&255,f>>>16&255,f>>>8&255,f&255,l.isLeading<<2|l.dependsOn,l.isDependedOn<<6|l.hasRedundancy<<4|l.paddingValue<<1|l.isNonSync,l.degradPrio&240<<8,l.degradPrio&15,i>>>24&255,i>>>16&255,i>>>8&255,i&255],12+16*S);return P.box(P.types.trun,R)},P.initSegment=function(M){P.types||P.init();var O=P.moov(M),A=new Uint8Array(P.FTYP.byteLength+O.byteLength);return A.set(P.FTYP),A.set(O,P.FTYP.byteLength),A},P}();k.types=void 0,k.HDLR_TYPES=void 0,k.STTS=void 0,k.STSC=void 0,k.STCO=void 0,k.STSZ=void 0,k.VMHD=void 0,k.SMHD=void 0,k.STSD=void 0,k.FTYP=void 0,k.DINF=void 0,G.default=k},"./src/remux/mp4-remuxer.ts":function(ne,G,D){"use strict";D.r(G),D.d(G,"default",function(){return i}),D.d(G,"normalizePts",function(){return c});var K=D("./src/polyfills/number.ts"),k=D("./src/remux/aac-helper.ts"),P=D("./src/remux/mp4-generator.ts"),N=D("./src/events.ts"),M=D("./src/errors.ts"),O=D("./src/utils/logger.ts"),A=D("./src/types/loader.ts"),T=D("./src/utils/timescale-conversion.ts");function C(){return C=Object.assign||function(u){for(var y=1;y0?g:p.pts},h[0].pts);return s&&O.logger.debug("PTS rollover detected"),o},y.remux=function(h,s,o,g,p,E,L,F){var j,V,B,I,$,ie,ue=p,fe=p,ve=h.pid>-1,pe=s.pid>-1,te=s.samples.length,ee=h.samples.length>0,se=te>1,Q=(!ve||ee)&&(!pe||se)||this.ISGenerated||L;if(Q){this.ISGenerated||(B=this.generateIS(h,s,p));var J=this.isVideoContiguous,he=-1;if(se&&(he=_(s.samples),!J&&this.config.forceKeyFrameOnDiscontinuity))if(ie=!0,he>0){O.logger.warn("[mp4-remuxer]: Dropped "+he+" out of "+te+" video samples due to a missing keyframe");var Ce=this.getVideoStartPts(s.samples);s.samples=s.samples.slice(he),s.dropped+=he,fe+=(s.samples[0].pts-Ce)/(s.timescale||9e4)}else he===-1&&(O.logger.warn("[mp4-remuxer]: No keyframe found out of "+te+" video samples"),ie=!1);if(this.ISGenerated){if(ee&&se){var De=this.getVideoStartPts(s.samples),we=c(h.samples[0].pts,De)-De,Me=we/s.inputTimeScale;ue+=Math.max(0,Me),fe+=Math.max(0,-Me)}if(ee){if(h.samplerate||(O.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),B=this.generateIS(h,s,p)),V=this.remuxAudio(h,ue,this.isAudioContiguous,E,pe||se||F===A.PlaylistLevelType.AUDIO?fe:void 0),se){var Te=V?V.endPTS-V.startPTS:0;s.inputTimeScale||(O.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),B=this.generateIS(h,s,p)),j=this.remuxVideo(s,fe,J,Te)}}else se&&(j=this.remuxVideo(s,fe,J,0));j&&(j.firstKeyFrame=he,j.independent=he!==-1)}}return this.ISGenerated&&(o.samples.length&&($=this.remuxID3(o,p)),g.samples.length&&(I=this.remuxText(g,p))),{audio:V,video:j,initSegment:B,independent:ie,text:I,id3:$}},y.generateIS=function(h,s,o){var g=h.samples,p=s.samples,E=this.typeSupported,L={},F=!Object(K.isFiniteNumber)(this._initPTS),j="audio/mp4",V,B,I;if(F&&(V=B=Infinity),h.config&&g.length&&(h.timescale=h.samplerate,h.isAAC||(E.mpeg?(j="audio/mpeg",h.codec=""):E.mp3&&(h.codec="mp3")),L.audio={id:"audio",container:j,codec:h.codec,initSegment:!h.isAAC&&E.mpeg?new Uint8Array(0):P.default.initSegment([h]),metadata:{channelCount:h.channelCount}},F&&(I=h.inputTimeScale,V=B=g[0].pts-Math.round(I*o))),s.sps&&s.pps&&p.length&&(s.timescale=s.inputTimeScale,L.video={id:"main",container:"video/mp4",codec:s.codec,initSegment:P.default.initSegment([s]),metadata:{width:s.width,height:s.height}},F)){I=s.inputTimeScale;var $=this.getVideoStartPts(p),ie=Math.round(I*o);B=Math.min(B,c(p[0].dts,$)-ie),V=Math.min(V,$-ie)}if(Object.keys(L).length)return this.ISGenerated=!0,F&&(this._initPTS=V,this._initDTS=B),{tracks:L,initPTS:V,timescale:I}},y.remuxVideo=function(h,s,o,g){var p=h.inputTimeScale,E=h.samples,L=[],F=E.length,j=this._initPTS,V=this.nextAvcDts,B=8,I,$,ie,ue=Number.POSITIVE_INFINITY,fe=Number.NEGATIVE_INFINITY,ve=0,pe=!1;if(!o||V===null){var te=s*p,ee=E[0].pts-c(E[0].dts,E[0].pts);V=te-ee}for(var se=0;seQ.pts){var J=9e4*.2;ve=Math.max(Math.min(ve,Q.pts-Q.dts),-1*J)}Q.dts0?se-1:se].dts&&(pe=!0)}pe&&E.sort(function(Ot,Ze){var ht=Ot.dts-Ze.dts,Ut=Ot.pts-Ze.pts;return ht||Ut}),$=E[0].dts,ie=E[E.length-1].dts;var he=Math.round((ie-$)/(F-1));if(ve<0){if(vehe,_e=Me<-1;if(Te||_e){Te?O.logger.warn("AVC: "+Object(T.toMsFromMpegTsClock)(Me,!0)+" ms ("+Me+"dts) hole between fragments detected, filling it"):O.logger.warn("AVC: "+Object(T.toMsFromMpegTsClock)(-Me,!0)+" ms ("+Me+"dts) overlapping between fragments detected"),$=V;var Pe=E[0].pts-Me;E[0].dts=$,E[0].pts=Pe,O.logger.log("Video: First PTS/DTS adjusted: "+Object(T.toMsFromMpegTsClock)(Pe,!0)+"/"+Object(T.toMsFromMpegTsClock)($,!0)+", delta: "+Object(T.toMsFromMpegTsClock)(Me,!0)+" ms")}}l&&($=Math.max(0,$));for(var je=0,Qe=0,Ie=0;Ie0?Se-1:Se].dts;if(Z.stretchShortVideoTrack&&this.nextAudioPts!==null){var ae=Math.floor(Z.maxBufferHole*p),re=(g?ue+g*p:this.nextAudioPts)-Et.pts;re>ae?(I=re-q,I<0&&(I=q),O.logger.log("[mp4-remuxer]: It is approximately "+re/90+" ms to the next segment; using duration "+I/90+" ms for the last video frame.")):I=q}else I=q}var Ee=Math.round(Et.pts-Et.dts);L.push(new v(Et.key,I,Re,Ee))}if(L.length&&x&&x<70){var xe=L[0].flags;xe.dependsOn=2,xe.isNonSync=0}console.assert(I!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=V=ie+I,this.isVideoContiguous=!0;var Ve=P.default.moof(h.sequenceNumber++,$,C({},h,{samples:L})),Le="video",We={data1:Ve,data2:ut,startPTS:ue/p,endPTS:(fe+I)/p,startDTS:$/p,endDTS:V/p,type:Le,hasAudio:!1,hasVideo:!0,nb:L.length,dropped:h.dropped};return h.samples=[],h.dropped=0,console.assert(ut.length,"MDAT length must not be zero"),We},y.remuxAudio=function(h,s,o,g,p){var E=h.inputTimeScale,L=h.samplerate?h.samplerate:E,F=E/L,j=h.isAAC?S:b,V=j*F,B=this._initPTS,I=!h.isAAC&&this.typeSupported.mpeg,$=[],ie=h.samples,ue=I?0:8,fe=this.nextAudioPts||-1,ve=s*E;if(this.isAudioContiguous=o=o||ie.length&&fe>0&&(g&&Math.abs(ve-fe)<9e3||Math.abs(c(ie[0].pts-B,ve)-fe)<20*V),ie.forEach(function(de){de.pts=c(de.pts-B,ve)}),!o||fe<0){if(ie=ie.filter(function(de){return de.pts>=0}),!ie.length)return;p===0?fe=0:g?fe=Math.max(0,ve):fe=ie[0].pts}if(h.isAAC)for(var pe=p!==void 0,te=this.config.maxAudioFramesDrift,ee=0,se=fe;ee=te*V&&Ce0){Qe+=ue;try{je=new Uint8Array(Qe)}catch(de){this.observer.emit(N.Events.ERROR,N.Events.ERROR,{type:M.ErrorTypes.MUX_ERROR,details:M.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Qe,reason:"fail allocating audio mdat "+Qe});return}if(!I){var ut=new DataView(je.buffer);ut.setUint32(0,Qe),je.set(P.default.types.mdat,4)}}else return;je.set(lt,ue);var st=lt.byteLength;ue+=st,$.push(new v(!0,j,st,0)),Pe=$e}var Se=$.length;if(!Se)return;var Et=$[$.length-1];this.nextAudioPts=fe=Pe+F*Et.duration;var dt=I?new Uint8Array(0):P.default.moof(h.sequenceNumber++,_e/F,C({},h,{samples:$}));h.samples=[];var Re=_e/E,He=fe/E,me="audio",le={data1:dt,data2:je,startPTS:Re,endPTS:He,startDTS:Re,endDTS:He,type:me,hasAudio:!0,hasVideo:!1,nb:Se};return this.isAudioContiguous=!0,console.assert(je.length,"MDAT length must not be zero"),le},y.remuxEmptyAudio=function(h,s,o,g){var p=h.inputTimeScale,E=h.samplerate?h.samplerate:p,L=p/E,F=this.nextAudioPts,j=(F!==null?F:g.startDTS*p)+this._initDTS,V=g.endDTS*p+this._initDTS,B=L*S,I=Math.ceil((V-j)/B),$=k.default.getSilentFrame(h.manifestCodec||h.codec,h.channelCount);if(O.logger.warn("[mp4-remuxer]: remux empty Audio"),!$){O.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var ie=[],ue=0;ue4294967296;)u+=d;return u}function _(u){for(var y=0;y0?this.lastEndDTS=h:(N.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var s=!!u.audio,o=!!u.video,g="";s&&(g+="audio"),o&&(g+="video");var p={data1:v,startPTS:d,startDTS:d,endPTS:h,endDTS:h,type:g,hasAudio:s,hasVideo:o,nb:1,dropped:0};return _.audio=p.type==="audio"?p:void 0,_.video=p.type!=="audio"?p:void 0,_.text=f,_.id3=x,_.initSegment=m,_},T}(),O=function(C,R,S){return Object(k.getStartDTS)(C,R)-S};function A(T,C){var R=T==null?void 0:T.codec;return R&&R.length>4?R:R==="hvc1"?"hvc1.1.c.L120.90":R==="av01"?"av01.0.04M.08":R==="avc1"||C===P.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}G.default=M},"./src/task-loop.ts":function(ne,G,D){"use strict";D.r(G),D.d(G,"default",function(){return K});var K=function(){function k(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var P=k.prototype;return P.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},P.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},P.onHandlerDestroyed=function(){},P.hasInterval=function(){return!!this._tickInterval},P.hasNextTick=function(){return!!this._tickTimer},P.setInterval=function(M){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,M),!0)},P.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},P.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},P.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},P.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},P.doTick=function(){},k}()},"./src/types/cmcd.ts":function(ne,G,D){"use strict";D.r(G),D.d(G,"CMCDVersion",function(){return K}),D.d(G,"CMCDObjectType",function(){return k}),D.d(G,"CMCDStreamingFormat",function(){return P}),D.d(G,"CMCDStreamType",function(){return N});var K=1,k;(function(M){M.MANIFEST="m",M.AUDIO="a",M.VIDEO="v",M.MUXED="av",M.INIT="i",M.CAPTION="c",M.TIMED_TEXT="tt",M.KEY="k",M.OTHER="o"})(k||(k={}));var P;(function(M){M.DASH="d",M.HLS="h",M.SMOOTH="s",M.OTHER="o"})(P||(P={}));var N;(function(M){M.VOD="v",M.LIVE="l"})(N||(N={}))},"./src/types/level.ts":function(ne,G,D){"use strict";D.r(G),D.d(G,"HlsSkip",function(){return P}),D.d(G,"getSkipValue",function(){return N}),D.d(G,"HlsUrlParameters",function(){return M}),D.d(G,"Level",function(){return O});function K(A,T){for(var C=0;CNumber.MAX_SAFE_INTEGER?Infinity:T},M.hexadecimalInteger=function(A){if(this[A]){var T=(this[A]||"0x").slice(2);T=(T.length&1?"0":"")+T;for(var C=new Uint8Array(T.length/2),R=0;RNumber.MAX_SAFE_INTEGER?Infinity:T},M.decimalFloatingPoint=function(A){return parseFloat(this[A])},M.optionalFloat=function(A,T){var C=this[A];return C?parseFloat(C):T},M.enumeratedString=function(A){return this[A]},M.bool=function(A){return this[A]==="YES"},M.decimalResolution=function(A){var T=K.exec(this[A]);return T===null?void 0:{width:parseInt(T[1],10),height:parseInt(T[2],10)}},N.parseAttrList=function(A){var T,C={},R='"';for(k.lastIndex=0;(T=k.exec(A))!==null;){var S=T[2];S.indexOf(R)===0&&S.lastIndexOf(R)===S.length-1&&(S=S.slice(1,-1)),C[T[1]]=S}return C},N}()},"./src/utils/binary-search.ts":function(ne,G,D){"use strict";D.r(G);var K={search:function(P,N){for(var M=0,O=P.length-1,A=null,T=null;M<=O;){A=(M+O)/2|0,T=P[A];var C=N(T);if(C>0)M=A+1;else if(C<0)O=A-1;else return T}return null}};G.default=K},"./src/utils/buffer-helper.ts":function(ne,G,D){"use strict";D.r(G),D.d(G,"BufferHelper",function(){return P});var K=D("./src/utils/logger.ts"),k={length:0,start:function(){return 0},end:function(){return 0}},P=function(){function N(){}return N.isBuffered=function(O,A){try{if(O){for(var T=N.getBuffered(O),C=0;C=T.start(C)&&A<=T.end(C))return!0}}catch(R){}return!1},N.bufferInfo=function(O,A,T){try{if(O){var C=N.getBuffered(O),R=[],S;for(S=0;Sb&&(C[S-1].end=O[R].end):C.push(O[R])}else C.push(O[R])}else C=O;for(var x=0,f,l=A,i=A,c=0;c=_&&A=o&&K.logger.log(this.time+" ["+o+"] "+g)},d}(),x=function(h){for(var s=[],o=0;oM&&(this.logger.log(S.DEBUG,"Too large cursor position "+this.pos),this.pos=M)},h.moveCursor=function(o){var g=this.pos+o;if(o>1)for(var p=this.pos+1;p=144&&this.backSpace();var g=P(o);if(this.pos>=M){this.logger.log(S.ERROR,"Cannot insert "+o.toString(16)+" ("+g+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(g,this.currPenState),this.moveCursor(1)},h.clearFromPos=function(o){var g;for(g=o;g0&&(o?p="["+g.join(" | ")+"]":p=g.join(` `)),p},h.getTextAndFormat=function(){return this.rows},d}(),_=function(){function d(s,o,g){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=s,this.outputFilter=o,this.mode=null,this.verbose=0,this.displayedMemory=new c(g),this.nonDisplayedMemory=new c(g),this.lastOutputScreen=new c(g),this.currRollUpRow=this.displayedMemory.rows[N-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=g}var h=d.prototype;return h.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[N-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},h.getHandler=function(){return this.outputFilter},h.setHandler=function(o){this.outputFilter=o},h.setPAC=function(o){this.writeScreen.setPAC(o)},h.setBkgData=function(o){this.writeScreen.setBkgData(o)},h.setMode=function(o){if(o===this.mode)return;this.mode=o,this.logger.log(S.INFO,"MODE="+o),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=o},h.insertChars=function(o){for(var g=0;g=46,g.italics)g.foreground="white";else{var p=Math.floor(o/2)-16,E=["white","green","blue","cyan","red","yellow","magenta"];g.foreground=E[p]}this.logger.log(S.INFO,"MIDROW: "+JSON.stringify(g)),this.writeScreen.setPen(g)},h.outputDataUpdate=function(o){o===void 0&&(o=!1);var g=this.logger.time;if(g===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=g:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,g,this.lastOutputScreen),o&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:g),this.lastOutputScreen.copy(this.displayedMemory))},h.cueSplitAtTime=function(o){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,o,this.displayedMemory),this.cueStartTime=o))},d}(),v=function(){function d(s,o,g){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var p=new b;this.channels=[null,new _(s,o,p),new _(s+1,g,p)],this.cmdHistory=y(),this.logger=p}var h=d.prototype;return h.getHandler=function(o){return this.channels[o].getHandler()},h.setHandler=function(o,g){this.channels[o].setHandler(g)},h.addData=function(o,g){var p,E,L,F=!1;this.logger.time=o;for(var j=0;j ("+x([E,L])+")"),p=this.parseCmd(E,L),p||(p=this.parseMidrow(E,L)),p||(p=this.parsePAC(E,L)),p||(p=this.parseBackgroundAttributes(E,L)),!p&&(F=this.parseChars(E,L),F)){var V=this.currentChannel;if(V&&V>0){var B=this.channels[V];B.insertChars(F)}else this.logger.log(S.WARNING,"No channel found yet. TEXT-MODE?")}!p&&!F&&this.logger.log(S.WARNING,"Couldn't parse cleaned data "+x([E,L])+" orig: "+x([g[j],g[j+1]]))}},h.parseCmd=function(o,g){var p=this.cmdHistory,E=(o===20||o===28||o===21||o===29)&&g>=32&&g<=47,L=(o===23||o===31)&&g>=33&&g<=35;if(!(E||L))return!1;if(u(o,g,p))return m(null,null,p),this.logger.log(S.DEBUG,"Repeated command ("+x([o,g])+") is dropped"),!0;var F=o===20||o===21||o===23?1:2,j=this.channels[F];return o===20||o===21||o===28||o===29?g===32?j.ccRCL():g===33?j.ccBS():g===34?j.ccAOF():g===35?j.ccAON():g===36?j.ccDER():g===37?j.ccRU(2):g===38?j.ccRU(3):g===39?j.ccRU(4):g===40?j.ccFON():g===41?j.ccRDC():g===42?j.ccTR():g===43?j.ccRTD():g===44?j.ccEDM():g===45?j.ccCR():g===46?j.ccENM():g===47&&j.ccEOC():j.ccTO(g-32),m(o,g,p),this.currentChannel=F,!0},h.parseMidrow=function(o,g){var p=0;if((o===17||o===25)&&g>=32&&g<=47){if(o===17?p=1:p=2,p!==this.currentChannel)return this.logger.log(S.ERROR,"Mismatch channel in midrow parsing"),!1;var E=this.channels[p];return E?(E.ccMIDROW(g),this.logger.log(S.DEBUG,"MIDROW ("+x([o,g])+")"),!0):!1}return!1},h.parsePAC=function(o,g){var p,E=this.cmdHistory,L=(o>=17&&o<=23||o>=25&&o<=31)&&g>=64&&g<=127,F=(o===16||o===24)&&g>=64&&g<=95;if(!(L||F))return!1;if(u(o,g,E))return m(null,null,E),!0;var j=o<=23?1:2;g>=64&&g<=95?p=j===1?O[o]:T[o]:p=j===1?A[o]:C[o];var V=this.channels[j];return V?(V.setPAC(this.interpretPAC(p,g)),m(o,g,E),this.currentChannel=j,!0):!1},h.interpretPAC=function(o,g){var p,E={color:null,italics:!1,indent:null,underline:!1,row:o};return g>95?p=g-96:p=g-64,E.underline=(p&1)===1,p<=13?E.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(p/2)]:p<=15?(E.italics=!0,E.color="white"):E.indent=Math.floor((p-16)/2)*4,E},h.parseChars=function(o,g){var p,E=null,L=null;if(o>=25?(p=2,L=o-8):(p=1,L=o),L>=17&&L<=19){var F;L===17?F=g+80:L===18?F=g+112:F=g+144,this.logger.log(S.INFO,"Special char '"+P(F)+"' in channel "+p),E=[F]}else o>=32&&o<=127&&(E=g===0?[o]:[o,g]);if(E){var j=x(E);this.logger.log(S.DEBUG,"Char codes = "+j.join(",")),m(o,g,this.cmdHistory)}return E},h.parseBackgroundAttributes=function(o,g){var p=(o===16||o===24)&&g>=32&&g<=47,E=(o===23||o===31)&&g>=45&&g<=47;if(!(p||E))return!1;var L,F={};o===16||o===24?(L=Math.floor((g-32)/2),F.background=R[L],g%2===1&&(F.background=F.background+"_semi")):g===45?F.background="transparent":(F.foreground="black",g===47&&(F.underline=!0));var j=o<=23?1:2,V=this.channels[j];return V.setBkgData(F),m(o,g,this.cmdHistory),!0},h.reset=function(){for(var o=0;o=16?l--:l++;var m=Object(K.fixLineBreaks)(i.trim()),u=Object(k.generateCueId)(T,C,m);(!A||!A.cues||!A.cues.getCueById(u))&&(x=new c(T,C,m),x.id=u,x.line=_+1,x.align="left",x.position=10+Math.min(80,Math.floor(l*8/32)*10),S.push(x))}return A&&S.length&&(S.sort(function(y,d){return y.line==="auto"||d.line==="auto"?0:y.line>8&&d.line>8?d.line-y.line:y.line-d.line}),S.forEach(function(y){return Object(P.addCueToTrack)(A,y)})),S}};G.default=M},"./src/utils/discontinuities.ts":function(ne,G,D){"use strict";D.r(G),D.d(G,"findFirstFragWithCC",function(){return N}),D.d(G,"shouldAlignOnDiscontinuities",function(){return M}),D.d(G,"findDiscontinuousReferenceFrag",function(){return O}),D.d(G,"adjustSlidingStart",function(){return T}),D.d(G,"alignStream",function(){return C}),D.d(G,"alignPDT",function(){return S}),D.d(G,"alignFragmentByPDTDelta",function(){return b}),D.d(G,"alignMediaPlaylistByPDT",function(){return x});var K=D("./src/polyfills/number.ts"),k=D("./src/utils/logger.ts"),P=D("./src/controller/level-helper.ts");function N(f,l){for(var i=null,c=0,_=f.length;c<_;c++){var v=f[c];if(v&&v.cc===l){i=v;break}}return i}function M(f,l,i){return!!(l.details&&(i.endCC>i.startCC||f&&f.cc=this.minWeight_},N.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},N.destroy=function(){},P}();G.default=k},"./src/utils/ewma.ts":function(ne,G,D){"use strict";D.r(G);var K=function(){function k(N,M,O){M===void 0&&(M=0),O===void 0&&(O=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=N,this.alpha_=N?Math.exp(Math.log(.5)/N):0,this.estimate_=M,this.totalWeight_=O}var P=k.prototype;return P.sample=function(M,O){var A=Math.pow(this.alpha_,M);this.estimate_=O*(1-A)+A*this.estimate_,this.totalWeight_+=M},P.getTotalWeight=function(){return this.totalWeight_},P.getEstimate=function(){if(this.alpha_){var M=1-Math.pow(this.alpha_,this.totalWeight_);if(M)return this.estimate_/M}return this.estimate_},k}();G.default=K},"./src/utils/fetch-loader.ts":function(ne,G,D){"use strict";D.r(G),D.d(G,"fetchSupported",function(){return b});var K=D("./src/polyfills/number.ts"),k=D("./src/loader/load-stats.ts"),P=D("./src/demux/chunk-cache.ts");function N(c,_){c.prototype=Object.create(_.prototype),c.prototype.constructor=c,C(c,_)}function M(c){var _=typeof Map=="function"?new Map:void 0;return M=function(m){if(m===null||!T(m))return m;if(typeof m!="function")throw new TypeError("Super expression must either be null or a function");if(typeof _!="undefined"){if(_.has(m))return _.get(m);_.set(m,u)}function u(){return O(m,arguments,R(this).constructor)}return u.prototype=Object.create(m.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),C(u,m)},M(c)}function O(c,_,v){return A()?O=Reflect.construct:O=function(u,y,d){var h=[null];h.push.apply(h,y);var s=Function.bind.apply(u,h),o=new s;return d&&C(o,d.prototype),o},O.apply(null,arguments)}function A(){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(c){return!1}}function T(c){return Function.toString.call(c).indexOf("[native code]")!==-1}function C(c,_){return C=Object.setPrototypeOf||function(m,u){return m.__proto__=u,m},C(c,_)}function R(c){return R=Object.setPrototypeOf?Object.getPrototypeOf:function(v){return v.__proto__||Object.getPrototypeOf(v)},R(c)}function S(){return S=Object.assign||function(c){for(var _=1;_=d&&h(u,y,s.flush(),m)):h(u,y,L,m),p()}).catch(function(){return Promise.reject()})};return g()},c}();function f(c,_){var v={method:"GET",mode:"cors",credentials:"same-origin",signal:_,headers:new self.Headers(S({},c.headers))};return c.rangeEnd&&v.headers.set("Range","bytes="+c.rangeStart+"-"+String(c.rangeEnd-1)),v}function l(c,_){return new self.Request(c.url,_)}var i=function(c){N(_,c);function _(v,m,u){var y;return y=c.call(this,v)||this,y.code=void 0,y.details=void 0,y.code=m,y.details=u,y}return _}(M(Error));G.default=x},"./src/utils/imsc1-ttml-parser.ts":function(ne,G,D){"use strict";D.r(G),D.d(G,"IMSC1_CODEC",function(){return T}),D.d(G,"parseIMSC1",function(){return b});var K=D("./src/utils/mp4-tools.ts"),k=D("./src/utils/vttparser.ts"),P=D("./src/utils/vttcue.ts"),N=D("./src/demux/id3.ts"),M=D("./src/utils/timescale-conversion.ts"),O=D("./src/utils/webvtt-parser.ts");function A(){return A=Object.assign||function(d){for(var h=1;h"):K}function M(T){for(var C=arguments.length,R=new Array(C>1?C-1:0),S=1;S>24,_[v+1]=m>>16&255,_[v+2]=m>>8&255,_[v+3]=m&255}function C(_,v){var m=[];if(!v.length)return m;var u,y,d;"data"in _?(u=_.data,y=_.start,d=_.end):(u=_,y=0,d=u.byteLength);for(var h=y;h1?h+s:d;if(o===v[0])if(v.length===1)m.push({data:u,start:h+8,end:g});else{var p=C({data:u,start:h+8,end:g},v.slice(1));p.length&&N.apply(m,p)}h=g}return m}function R(_){var v=C(_,["moov"]),m=v[0],u=m?m.end:null,y=C(_,["sidx"]);if(!y||!y[0])return null;var d=[],h=y[0],s=h.data[0],o=s===0?8:16,g=A(h,o);o+=4;var p=0,E=0;s===0?o+=8:o+=16,o+=2;var L=h.end+E,F=O(h,o);o+=2;for(var j=0;j>>31;if($===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var ie=A(h,V);V+=4,d.push({referenceSize:I,subsegmentDuration:ie,info:{duration:ie/g,start:L,end:L+I-1}}),L+=I,V+=4,o=V}return{earliestPresentationTime:p,timescale:g,version:s,referencesCount:F,references:d,moovEndOffset:u}}function S(_){for(var v=[],m=C(_,["moov","trak"]),u=0;uM)&&(this.startTime=M),this.endTime=O,this.screen=A,this.timelineController.createCaptionsTrack(this.trackName)},P.reset=function(){this.cueRanges=[]},k}()},"./src/utils/texttrack-utils.ts":function(ne,G,D){"use strict";D.r(G),D.d(G,"sendAddTrackEvent",function(){return k}),D.d(G,"addCueToTrack",function(){return P}),D.d(G,"clearCurrentCues",function(){return N}),D.d(G,"removeCuesInRange",function(){return M}),D.d(G,"getCuesInRange",function(){return A});var K=D("./src/utils/logger.ts");function k(T,C){var R;try{R=new Event("addtrack")}catch(S){R=document.createEvent("Event"),R.initEvent("addtrack",!1,!1)}R.track=T,C.dispatchEvent(R)}function P(T,C){var R=T.mode;if(R==="disabled"&&(T.mode="hidden"),T.cues&&!T.cues.getCueById(C.id))try{if(T.addCue(C),!T.cues.getCueById(C.id))throw new Error("addCue is failed for: "+C)}catch(b){K.logger.debug("[texttrack-utils]: "+b);var S=new self.TextTrackCue(C.startTime,C.endTime,C.text);S.id=C.id,T.addCue(S)}R==="disabled"&&(T.mode=R)}function N(T){var C=T.mode;if(C==="disabled"&&(T.mode="hidden"),T.cues)for(var R=T.cues.length;R--;)T.removeCue(T.cues[R]);C==="disabled"&&(T.mode=C)}function M(T,C,R){var S=T.mode;if(S==="disabled"&&(T.mode="hidden"),T.cues&&T.cues.length>0)for(var b=A(T.cues,C,R),x=0;xT[R].endTime)return-1;for(var S=0,b=R;S<=b;){var x=Math.floor((b+S)/2);if(CT[x].startTime&&S-1)for(var x=b,f=T.length;x=C&&l.endTime<=R)S.push(l);else if(l.startTime>R)return S}return S}},"./src/utils/time-ranges.ts":function(ne,G,D){"use strict";D.r(G);var K={toString:function(P){for(var N="",M=P.length,O=0;O1?C-1:0),S=1;S100)throw new Error("Position must be between 0 and 100.");d=p,this.hasBeenReset=!0}})),Object.defineProperty(S,"positionAlign",O({},b,{get:function(){return h},set:function(p){var E=M(p);if(!E)throw new SyntaxError("An invalid or illegal string was specified.");h=E,this.hasBeenReset=!0}})),Object.defineProperty(S,"size",O({},b,{get:function(){return s},set:function(p){if(p<0||p>100)throw new Error("Size must be between 0 and 100.");s=p,this.hasBeenReset=!0}})),Object.defineProperty(S,"align",O({},b,{get:function(){return o},set:function(p){var E=M(p);if(!E)throw new SyntaxError("An invalid or illegal string was specified.");o=E,this.hasBeenReset=!0}})),S.displayState=void 0}return A.prototype.getCueAsHTML=function(){var T=self.WebVTT;return T.convertCueToDOMTree(self,this.text)},A}()},"./src/utils/vttparser.ts":function(ne,G,D){"use strict";D.r(G),D.d(G,"parseTimeStamp",function(){return P}),D.d(G,"fixLineBreaks",function(){return C}),D.d(G,"VTTParser",function(){return R});var K=D("./src/utils/vttcue.ts"),k=function(){function S(){}var b=S.prototype;return b.decode=function(f,l){if(!f)return"";if(typeof f!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(f))},S}();function P(S){function b(f,l,i,c){return(f|0)*3600+(l|0)*60+(i|0)+parseFloat(c||0)}var x=S.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return x?parseFloat(x[2])>59?b(x[2],x[3],0,x[4]):b(x[1],x[2],x[3],x[4]):null}var N=function(){function S(){this.values=Object.create(null)}var b=S.prototype;return b.set=function(f,l){!this.get(f)&&l!==""&&(this.values[f]=l)},b.get=function(f,l,i){return i?this.has(f)?this.values[f]:l[i]:this.has(f)?this.values[f]:l},b.has=function(f){return f in this.values},b.alt=function(f,l,i){for(var c=0;c=0&&i<=100)return this.set(f,i),!0}return!1},S}();function M(S,b,x,f){var l=f?S.split(f):[S];for(var i in l){if(typeof l[i]!="string")continue;var c=l[i].split(x);if(c.length!==2)continue;var _=c[0],v=c[1];b(_,v)}}var O=new K.default(0,0,""),A=O.align==="middle"?"middle":"center";function T(S,b,x){var f=S;function l(){var _=P(S);if(_===null)throw new Error("Malformed timestamp: "+f);return S=S.replace(/^[^\sa-zA-Z-]+/,""),_}function i(_,v){var m=new N;M(_,function(d,h){var s;switch(d){case"region":for(var o=x.length-1;o>=0;o--)if(x[o].id===h){m.set(d,x[o].region);break}break;case"vertical":m.alt(d,h,["rl","lr"]);break;case"line":s=h.split(","),m.integer(d,s[0]),m.percent(d,s[0])&&m.set("snapToLines",!1),m.alt(d,s[0],["auto"]),s.length===2&&m.alt("lineAlign",s[1],["start",A,"end"]);break;case"position":s=h.split(","),m.percent(d,s[0]),s.length===2&&m.alt("positionAlign",s[1],["start",A,"end","line-left","line-right","auto"]);break;case"size":m.percent(d,h);break;case"align":m.alt(d,h,["start",A,"end","left","right"]);break}},/:/,/\s/),v.region=m.get("region",null),v.vertical=m.get("vertical","");var u=m.get("line","auto");u==="auto"&&O.line===-1&&(u=-1),v.line=u,v.lineAlign=m.get("lineAlign","start"),v.snapToLines=m.get("snapToLines",!0),v.size=m.get("size",100),v.align=m.get("align",A);var y=m.get("position","auto");y==="auto"&&O.position===50&&(y=v.align==="start"||v.align==="left"?0:v.align==="end"||v.align==="right"?100:50),v.position=y}function c(){S=S.replace(/^\s+/,"")}if(c(),b.startTime=l(),c(),S.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+f);S=S.substr(3),c(),b.endTime=l(),c(),i(S,b)}function C(S){return S.replace(//gi,` `)}var R=function(){function S(){this.state="INITIAL",this.buffer="",this.decoder=new k,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var b=S.prototype;return b.parse=function(f){var l=this;f&&(l.buffer+=l.decoder.decode(f,{stream:!0}));function i(){var y=l.buffer,d=0;for(y=C(y);d")===-1){l.cue.id=_;continue}case"CUE":if(!l.cue){l.state="BADCUE";continue}try{T(_,l.cue,l.regionList)}catch(y){l.cue=null,l.state="BADCUE";continue}l.state="CUETEXT";continue;case"CUETEXT":{var u=_.indexOf("-->")!==-1;if(!_||u&&(m=!0)){l.oncue&&l.cue&&l.oncue(l.cue),l.cue=null,l.state="ID";continue}if(l.cue===null)continue;l.cue.text&&(l.cue.text+=` `),l.cue.text+=_}continue;case"BADCUE":_||(l.state="ID")}}}catch(y){l.state==="CUETEXT"&&l.cue&&l.oncue&&l.oncue(l.cue),l.cue=null,l.state=l.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},b.flush=function(){var f=this;try{if((f.cue||f.state==="HEADER")&&(f.buffer+=` `,f.parse()),f.state==="INITIAL"||f.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(l){f.onparsingerror&&f.onparsingerror(l)}return f.onflush&&f.onflush(),this},S}()},"./src/utils/webvtt-parser.ts":function(ne,G,D){"use strict";D.r(G),D.d(G,"generateCueId",function(){return R}),D.d(G,"parseWebVTT",function(){return b});var K=D("./src/polyfills/number.ts"),k=D("./src/utils/vttparser.ts"),P=D("./src/demux/id3.ts"),N=D("./src/utils/timescale-conversion.ts"),M=D("./src/remux/mp4-remuxer.ts"),O=/\r\n|\n\r|\n|\r/g,A=function(f,l,i){return i===void 0&&(i=0),f.substr(i,l.length)===l},T=function(f){var l=parseInt(f.substr(-3)),i=parseInt(f.substr(-6,2)),c=parseInt(f.substr(-9,2)),_=f.length>9?parseInt(f.substr(0,f.indexOf(":"))):0;if(!Object(K.isFiniteNumber)(l)||!Object(K.isFiniteNumber)(i)||!Object(K.isFiniteNumber)(c)||!Object(K.isFiniteNumber)(_))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+f);return l+=1e3*i,l+=60*1e3*c,l+=60*60*1e3*_,l},C=function(f){for(var l=5381,i=f.length;i;)l=l*33^f.charCodeAt(--i);return(l>>>0).toString()};function R(x,f,l){return C(x.toString())+C(f.toString())+C(l)}var S=function(f,l,i){var c=f[l],_=f[c.prevCC];if(!_||!_.new&&c.new){f.ccOffset=f.presentationOffset=c.start,c.new=!1;return}for(;(v=_)!==null&&v!==void 0&&v.new;){var v;f.ccOffset+=c.start-_.start,c.new=!1,c=_,_=f[c.prevCC]}f.presentationOffset=i};function b(x,f,l,i,c,_,v,m){var u=new k.VTTParser,y=Object(P.utf8ArrayToStr)(new Uint8Array(x)).trim().replace(O,` `).split(` `),d=[],h=Object(N.toMpegTsClockFromTimescale)(f,l),s="00:00.000",o=0,g=0,p,E=!0,L=!1;u.oncue=function(F){var j=i[c],V=i.ccOffset,B=(o-h)/9e4;if(j!=null&&j.new&&(g!==void 0?V=i.ccOffset=j.start:S(i,c,B)),B&&(V=B-i.presentationOffset),L){var I=F.endTime-F.startTime,$=Object(M.normalizePts)((F.startTime+V-g)*9e4,_*9e4)/9e4;F.startTime=$,F.endTime=$+I}var ie=F.text.trim();F.text=decodeURIComponent(encodeURIComponent(ie)),F.id||(F.id=R(F.startTime,F.endTime,ie)),F.endTime>0&&d.push(F)},u.onparsingerror=function(F){p=F},u.onflush=function(){if(p){m(p);return}v(d)},y.forEach(function(F){if(E)if(A(F,"X-TIMESTAMP-MAP=")){E=!1,L=!0,F.substr(16).split(",").forEach(function(j){A(j,"LOCAL:")?s=j.substr(6):A(j,"MPEGTS:")&&(o=parseInt(j.substr(7)))});try{g=T(s)/1e3}catch(j){L=!1,p=j}return}else F===""&&(E=!1);u.parse(F+` `)}),u.flush()}},"./src/utils/xhr-loader.ts":function(ne,G,D){"use strict";D.r(G);var K=D("./src/utils/logger.ts"),k=D("./src/loader/load-stats.ts"),P=/^age:\s*[\d.]+\s*$/m,N=function(){function M(A){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=A?A.xhrSetup:null,this.stats=new k.LoadStats,this.retryDelay=0}var O=M.prototype;return O.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},O.abortInternal=function(){var T=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),T&&(T.onreadystatechange=null,T.onprogress=null,T.readyState!==4&&(this.stats.aborted=!0,T.abort()))},O.abort=function(){var T;this.abortInternal(),(T=this.callbacks)!==null&&T!==void 0&&T.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},O.load=function(T,C,R){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=T,this.config=C,this.callbacks=R,this.retryDelay=C.retryDelay,this.loadInternal()},O.loadInternal=function(){var T=this.config,C=this.context;if(!T)return;var R=this.loader=new self.XMLHttpRequest,S=this.stats;S.loading.first=0,S.loaded=0;var b=this.xhrSetup;try{if(b)try{b(R,C.url)}catch(l){R.open("GET",C.url,!0),b(R,C.url)}R.readyState||R.open("GET",C.url,!0);var x=this.context.headers;if(x)for(var f in x)R.setRequestHeader(f,x[f])}catch(l){this.callbacks.onError({code:R.status,text:l.message},C,R);return}C.rangeEnd&&R.setRequestHeader("Range","bytes="+C.rangeStart+"-"+(C.rangeEnd-1)),R.onreadystatechange=this.readystatechange.bind(this),R.onprogress=this.loadprogress.bind(this),R.responseType=C.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),T.timeout),R.send()},O.readystatechange=function(){var T=this.context,C=this.loader,R=this.stats;if(!T||!C)return;var S=C.readyState,b=this.config;if(R.aborted)return;if(S>=2)if(self.clearTimeout(this.requestTimeout),R.loading.first===0&&(R.loading.first=Math.max(self.performance.now(),R.loading.start)),S===4){C.onreadystatechange=null,C.onprogress=null;var x=C.status;if(x>=200&&x<300){R.loading.end=Math.max(self.performance.now(),R.loading.first);var f,l;if(T.responseType==="arraybuffer"?(f=C.response,l=f.byteLength):(f=C.responseText,l=f.length),R.loaded=R.total=l,!this.callbacks)return;var i=this.callbacks.onProgress;if(i&&i(R,T,f,C),!this.callbacks)return;var c={url:C.responseURL,data:f};this.callbacks.onSuccess(c,R,T,C)}else R.retry>=b.maxRetry||x>=400&&x<499?(K.logger.error(x+" while loading "+T.url),this.callbacks.onError({code:x,text:C.statusText},T,C)):(K.logger.warn(x+" while loading "+T.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,b.maxRetryDelay),R.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),b.timeout)},O.loadtimeout=function(){K.logger.warn("timeout while loading "+this.context.url);var T=this.callbacks;T&&(this.abortInternal(),T.onTimeout(this.stats,this.context,this.loader))},O.loadprogress=function(T){var C=this.stats;C.loaded=T.loaded,T.lengthComputable&&(C.total=T.total)},O.getCacheAge=function(){var T=null;if(this.loader&&P.test(this.loader.getAllResponseHeaders())){var C=this.loader.getResponseHeader("age");T=C?parseFloat(C):null}return T},M}();G.default=N}}).default})}}]);