(window.webpackJsonp=window.webpackJsonp||[]).push([[194,7,8],{"+NIl":function(rt,Xe,X){(function(oe){oe(X("VrN/"))})(function(oe){"use strict";oe.defineMode("stex",function($,D){"use strict";function Y(w,S){w.cmdState.push(S)}function U(w){return w.cmdState.length>0?w.cmdState[w.cmdState.length-1]:null}function N(w){var S=w.cmdState.pop();S&&S.closeBracket()}function K(w){for(var S=w.cmdState,x=S.length-1;x>=0;x--){var h=S[x];if(h.name=="DEFAULT")continue;return h}return{styleIdentifier:function(){return null}}}function I(w,S,x){return function(){this.name=w,this.bracketNo=0,this.style=S,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=I("importmodule","tag",["string","builtin"]),O.documentclass=I("documentclass","tag",["","atom"]),O.usepackage=I("usepackage","tag",["atom"]),O.begin=I("begin","tag",["atom"]),O.end=I("end","tag",["atom"]),O.label=I("label","tag",["atom"]),O.ref=I("ref","tag",["atom"]),O.eqref=I("eqref","tag",["atom"]),O.cite=I("cite","tag",["atom"]),O.bibitem=I("bibitem","tag",["atom"]),O.Bibitem=I("Bibitem","tag",["atom"]),O.RBibitem=I("RBibitem","tag",["atom"]),O.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function L(w,S){w.f=S}function T(w,S){var x;if(w.match(/^\\[a-zA-Z@]+/)){var h=w.current().slice(1);return x=O.hasOwnProperty(h)?O[h]:O.DEFAULT,x=new x,Y(S,x),L(S,P),x.style}if(w.match(/^\\[$&%#{}_]/))return"tag";if(w.match(/^\\[,;!\/\\]/))return"tag";if(w.match("\\["))return L(S,function(i,c){return A(i,c,"\\]")}),"keyword";if(w.match("\\("))return L(S,function(i,c){return A(i,c,"\\)")}),"keyword";if(w.match("$$"))return L(S,function(i,c){return A(i,c,"$$")}),"keyword";if(w.match("$"))return L(S,function(i,c){return A(i,c,"$")}),"keyword";var l=w.next();if(l=="%")return w.skipToEnd(),"comment";if(l=="}"||l=="]"){if(x=U(S),x)x.closeBracket(l),L(S,P);else return"error";return"bracket"}else return l=="{"||l=="["?(x=O.DEFAULT,x=new x,Y(S,x),"bracket"):/\d/.test(l)?(w.eatWhile(/[\w.%]/),"atom"):(w.eatWhile(/[\w\-_]/),x=K(S),x.name=="begin"&&(x.argument=w.current()),x.styleIdentifier())}function A(w,S,x){if(w.eatSpace())return null;if(x&&w.match(x))return L(S,T),"keyword";if(w.match(/^\\[a-zA-Z@]+/))return"tag";if(w.match(/^[a-zA-Z]+/))return"variable-2";if(w.match(/^\\[$&%#{}_]/))return"tag";if(w.match(/^\\[,;!\/]/))return"tag";if(w.match(/^[\^_&]/))return"tag";if(w.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(w.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var h=w.next();return h=="{"||h=="}"||h=="["||h=="]"||h=="("||h==")"?"bracket":h=="%"?(w.skipToEnd(),"comment"):"error"}function P(w,S){var x=w.peek(),h;return x=="{"||x=="["?(h=U(S),h.openBracket(x),w.eat(x),L(S,T),"bracket"):/[ \t\r]/.test(x)?(w.eat(x),null):(L(S,T),N(S),T(w,S))}return{startState:function(){var w=D.inMathMode?function(S,x){return A(S,x)}:T;return{cmdState:[],f:w}},copyState:function(w){return{cmdState:w.cmdState.slice(),f:w.f}},token:function(w,S){return S.f(w,S)},blankLine:function(w){w.f=T,w.cmdState.length=0},lineComment:"%"}}),oe.defineMIME("text/x-stex","stex"),oe.defineMIME("text/x-latex","stex")})},"+RXH":function(rt,Xe,X){rt.exports=X.p+"static/shu.a39bf729.svg"},"+yhJ":function(rt,Xe,X){rt.exports=X.p+"static/xixi.d492fb65.svg"},"0eGx":function(rt,Xe,X){rt.exports=X.p+"static/zhong.c1924b73.svg"},"19Vz":function(rt,Xe,X){(function(oe){oe(X("VrN/"))})(function(oe){oe.defineOption("placeholder","",function(I,O,L){var T=L&&L!=oe.Init;if(O&&!T)I.on("blur",U),I.on("change",N),I.on("swapDoc",N),oe.on(I.getInputField(),"compositionupdate",I.state.placeholderCompose=function(){Y(I)}),N(I);else if(!O&&T){I.off("blur",U),I.off("change",N),I.off("swapDoc",N),oe.off(I.getInputField(),"compositionupdate",I.state.placeholderCompose),$(I);var A=I.getWrapperElement();A.className=A.className.replace(" CodeMirror-empty","")}O&&!I.hasFocus()&&U(I)});function $(I){I.state.placeholder&&(I.state.placeholder.parentNode.removeChild(I.state.placeholder),I.state.placeholder=null)}function D(I){$(I);var O=I.state.placeholder=document.createElement("pre");O.style.cssText="height: 0; overflow: visible",O.style.direction=I.getOption("direction"),O.className="CodeMirror-placeholder CodeMirror-line-like";var L=I.getOption("placeholder");typeof L=="string"&&(L=document.createTextNode(L)),O.appendChild(L),I.display.lineSpace.insertBefore(O,I.display.lineSpace.firstChild)}function Y(I){setTimeout(function(){var O=!1,L=I.getInputField();L.nodeName=="TEXTAREA"?O=!L.value:I.lineCount()==1&&(O=!/[^\u200b]/.test(L.querySelector(".CodeMirror-line").textContent)),O?D(I):$(I)},20)}function U(I){K(I)&&D(I)}function N(I){var O=I.getWrapperElement(),L=K(I);O.className=O.className.replace(" CodeMirror-empty","")+(L?" CodeMirror-empty":""),L?D(I):$(I)}function K(I){return I.lineCount()===1&&I.getLine(0)===""}})},"1eCo":function(rt,Xe,X){(function(oe){oe(X("VrN/"))})(function(oe){"use strict";var $={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};oe.defineMode("xml",function(Y,U){var N=Y.indentUnit,K={},I=U.htmlMode?$:D;for(var O in I)K[O]=I[O];for(var O in U)K[O]=U[O];var L,T;function A(o,b){function g(H){return b.tokenize=H,H(o,b)}var _=o.next();if(_=="<")return o.eat("!")?o.eat("[")?o.match("CDATA[")?g(S("atom","]]>")):null:o.match("--")?g(S("comment","-->")):o.match("DOCTYPE",!0,!0)?(o.eatWhile(/[\w\._\-]/),g(x(1))):null:o.eat("?")?(o.eatWhile(/[\w\._\-]/),b.tokenize=S("meta","?>"),"meta"):(L=o.eat("/")?"closeTag":"openTag",b.tokenize=P,"tag bracket");if(_=="&"){var k;return o.eat("#")?o.eat("x")?k=o.eatWhile(/[a-fA-F\d]/)&&o.eat(";"):k=o.eatWhile(/[\d]/)&&o.eat(";"):k=o.eatWhile(/[\w\.\-:]/)&&o.eat(";"),k?"atom":"error"}else return o.eatWhile(/[^&<]/),null}A.isInText=!0;function P(o,b){var g=o.next();if(g==">"||g=="/"&&o.eat(">"))return b.tokenize=A,L=g==">"?"endTag":"selfcloseTag","tag bracket";if(g=="=")return L="equals",null;if(g=="<"){b.tokenize=A,b.state=c,b.tagName=b.tagStart=null;var _=b.tokenize(o,b);return _?_+" tag error":"tag error"}else return/[\'\"]/.test(g)?(b.tokenize=w(g),b.stringStartCol=o.column(),b.tokenize(o,b)):(o.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function w(o){var b=function(g,_){for(;!g.eol();)if(g.next()==o){_.tokenize=P;break}return"string"};return b.isInAttribute=!0,b}function S(o,b){return function(g,_){for(;!g.eol();){if(g.match(b)){_.tokenize=A;break}g.next()}return o}}function x(o){return function(b,g){for(var _;(_=b.next())!=null;){if(_=="<")return g.tokenize=x(o+1),g.tokenize(b,g);if(_==">")if(o==1){g.tokenize=A;break}else return g.tokenize=x(o-1),g.tokenize(b,g)}return"meta"}}function h(o,b,g){this.prev=o.context,this.tagName=b,this.indent=o.indented,this.startOfLine=g,(K.doNotIndent.hasOwnProperty(b)||o.context&&o.context.noIndent)&&(this.noIndent=!0)}function l(o){o.context&&(o.context=o.context.prev)}function i(o,b){for(var g;;){if(!o.context)return;if(g=o.context.tagName,!K.contextGrabbers.hasOwnProperty(g)||!K.contextGrabbers[g].hasOwnProperty(b))return;l(o)}}function c(o,b,g){return o=="openTag"?(g.tagStart=b.column(),C):o=="closeTag"?v:c}function C(o,b,g){return o=="word"?(g.tagName=b.current(),T="tag",E):K.allowMissingTagName&&o=="endTag"?(T="tag bracket",E(o,b,g)):(T="error",C)}function v(o,b,g){if(o=="word"){var _=b.current();return g.context&&g.context.tagName!=_&&K.implicitlyClosed.hasOwnProperty(g.context.tagName)&&l(g),g.context&&g.context.tagName==_||K.matchClosing===!1?(T="tag",m):(T="tag error",u)}else return K.allowMissingTagName&&o=="endTag"?(T="tag bracket",m(o,b,g)):(T="error",u)}function m(o,b,g){return o!="endTag"?(T="error",m):(l(g),c)}function u(o,b,g){return T="error",m(o,b,g)}function E(o,b,g){if(o=="word")return T="attribute",d;if(o=="endTag"||o=="selfcloseTag"){var _=g.tagName,k=g.tagStart;return g.tagName=g.tagStart=null,o=="selfcloseTag"||K.autoSelfClosers.hasOwnProperty(_)?i(g,_):(i(g,_),g.context=new h(g,_,k==g.indented)),c}return T="error",E}function d(o,b,g){return o=="equals"?f:(K.allowMissing||(T="error"),E(o,b,g))}function f(o,b,g){return o=="string"?s:o=="word"&&K.allowUnquoted?(T="string",E):(T="error",E(o,b,g))}function s(o,b,g){return o=="string"?s:E(o,b,g)}return{startState:function(o){var b={tokenize:A,state:c,indented:o||0,tagName:null,tagStart:null,context:null};return o!=null&&(b.baseIndent=o),b},token:function(o,b){if(!b.tagName&&o.sol()&&(b.indented=o.indentation()),o.eatSpace())return null;L=null;var g=b.tokenize(o,b);return(g||L)&&g!="comment"&&(T=null,b.state=b.state(L||g,o,b),T&&(g=T=="error"?g+" error":T)),g},indent:function(o,b,g){var _=o.context;if(o.tokenize.isInAttribute)return o.tagStart==o.indented?o.stringStartCol+1:o.indented+N;if(_&&_.noIndent)return oe.Pass;if(o.tokenize!=P&&o.tokenize!=A)return g?g.match(/^(\s*)/)[0].length:0;if(o.tagName)return K.multilineTagIndentPastTag!==!1?o.tagStart+o.tagName.length+2:o.tagStart+N*(K.multilineTagIndentFactor||1);if(K.alignCDATA&&/$/,blockCommentStart:"",configuration:K.htmlMode?"html":"xml",helperType:K.htmlMode?"html":"xml",skipAttribute:function(o){o.state==f&&(o.state=E)},xmlCurrentTag:function(o){return o.tagName?{name:o.tagName,close:o.type=="closeTag"}:null},xmlCurrentContext:function(o){for(var b=[],g=o.context;g;g=g.prev)g.tagName&&b.push(g.tagName);return b.reverse()}}}),oe.defineMIME("text/xml","xml"),oe.defineMIME("application/xml","xml"),oe.mimeModes.hasOwnProperty("text/html")||oe.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"2sxD":function(rt,Xe,X){rt.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(rt,Xe,X){rt.exports=X.p+"static/sc.c1696770.svg"},"5MlY":function(rt,Xe,X){rt.exports=X.p+"static/sm.8ccb50bf.svg"},"6+eU":function(rt,Xe,X){"use strict";X.d(Xe,"a",function(){return m});var oe=X("wx14"),$=X("rePB"),D=X("VTBJ"),Y=X("1OyB"),U=X("vuIU"),N=X("Ji7U"),K=X("LK+K"),I=X("q1tI"),O=X.n(I),L=X("TSYQ"),T=X.n(L),A=function(E){var d,f="".concat(E.rootPrefixCls,"-item"),s=T()(f,"".concat(f,"-").concat(E.page),(d={},Object($.a)(d,"".concat(f,"-active"),E.active),Object($.a)(d,E.className,!!E.className),Object($.a)(d,"".concat(f,"-disabled"),!E.page),d)),o=function(){E.onClick(E.page)},b=function(_){E.onKeyPress(_,E.onClick,E.page)};return O.a.createElement("li",{title:E.showTitle?E.page:null,className:s,onClick:o,onKeyPress:b,tabIndex:"0"},E.itemRender(E.page,"page",O.a.createElement("a",{rel:"nofollow"},E.page)))},P=A,w={ZERO:48,NINE:57,NUMPAD_ZERO:96,NUMPAD_NINE:105,BACKSPACE:8,DELETE:46,ENTER:13,ARROW_UP:38,ARROW_DOWN:40},S=function(u){Object(N.a)(d,u);var E=Object(K.a)(d);function d(){var f;Object(Y.a)(this,d);for(var s=arguments.length,o=new Array(s),b=0;b=0||g.relatedTarget.className.indexOf("".concat(z,"-next"))>=0))return;f.setState({goInputText:""}),H(f.getValidValue())},f.go=function(g){var _=f.state.goInputText;if(_==="")return;(g.keyCode===w.ENTER||g.type==="click")&&(f.setState({goInputText:""}),f.props.quickGo(f.getValidValue()))},f}return Object(U.a)(d,[{key:"getValidValue",value:function(){var s=this.state,o=s.goInputText,b=s.current;return!o||isNaN(o)?b:Number(o)}},{key:"getPageSizeOptions",value:function(){var s=this.props,o=s.pageSize,b=s.pageSizeOptions;return b.some(function(g){return g.toString()===o.toString()})?b:b.concat([o.toString()]).sort(function(g,_){var k=isNaN(Number(g))?0:Number(g),H=isNaN(Number(_))?0:Number(_);return k-H})}},{key:"render",value:function(){var s=this,o=this.props,b=o.pageSize,g=o.locale,_=o.rootPrefixCls,k=o.changeSize,H=o.quickGo,z=o.goButton,Z=o.selectComponentClass,G=o.buildOptionText,B=o.selectPrefixCls,te=o.disabled,de=this.state.goInputText,pe="".concat(_,"-options"),ye=Z,Ce=null,_e=null,le=null;if(!k&&!H)return null;var se=this.getPageSizeOptions();if(k&&ye){var ve=se.map(function(ie,q){return O.a.createElement(ye.Option,{key:q,value:ie.toString()},(G||s.buildOptionText)(ie))});Ce=O.a.createElement(ye,{disabled:te,prefixCls:B,showSearch:!1,className:"".concat(pe,"-size-changer"),optionLabelProp:"children",dropdownMatchSelectWidth:!1,value:(b||se[0]).toString(),onChange:this.changeSize,getPopupContainer:function(q){return q.parentNode}},ve)}return H&&(z&&(le=typeof z=="boolean"?O.a.createElement("button",{type:"button",onClick:this.go,onKeyUp:this.go,disabled:te,className:"".concat(pe,"-quick-jumper-button")},g.jump_to_confirm):O.a.createElement("span",{onClick:this.go,onKeyUp:this.go},z)),_e=O.a.createElement("div",{className:"".concat(pe,"-quick-jumper")},g.jump_to,O.a.createElement("input",{disabled:te,type:"text",value:de,onChange:this.handleChange,onKeyUp:this.go,onBlur:this.handleBlur}),g.page,le)),O.a.createElement("li",{className:"".concat(pe)},Ce,_e)}}]),d}(O.a.Component);S.defaultProps={pageSizeOptions:["10","20","50","100"]};var x=S,h=X("N2Kk");function l(){}function i(u){return typeof u=="number"&&isFinite(u)&&Math.floor(u)===u}function c(u,E,d){return d}function C(u,E,d){var f=typeof u=="undefined"?E.pageSize:u;return Math.floor((d.total-1)/f)+1}var v=function(u){Object(N.a)(d,u);var E=Object(K.a)(d);function d(f){var s;Object(Y.a)(this,d),s=E.call(this,f),s.getJumpPrevPage=function(){return Math.max(1,s.state.current-(s.props.showLessItems?3:5))},s.getJumpNextPage=function(){return Math.min(C(void 0,s.state,s.props),s.state.current+(s.props.showLessItems?3:5))},s.getItemIcon=function(k,H){var z=s.props.prefixCls,Z=k||O.a.createElement("button",{type:"button","aria-label":H,className:"".concat(z,"-item-link")});return typeof k=="function"&&(Z=O.a.createElement(k,Object(D.a)({},s.props))),Z},s.savePaginationNode=function(k){s.paginationNode=k},s.isValid=function(k){return i(k)&&k!==s.state.current},s.shouldDisplayQuickJumper=function(){var k=s.props,H=k.showQuickJumper,z=k.pageSize,Z=k.total;return Z<=z?!1:H},s.handleKeyDown=function(k){(k.keyCode===w.ARROW_UP||k.keyCode===w.ARROW_DOWN)&&k.preventDefault()},s.handleKeyUp=function(k){var H=s.getValidValue(k),z=s.state.currentInputValue;H!==z&&s.setState({currentInputValue:H}),k.keyCode===w.ENTER?s.handleChange(H):k.keyCode===w.ARROW_UP?s.handleChange(H-1):k.keyCode===w.ARROW_DOWN&&s.handleChange(H+1)},s.changePageSize=function(k){var H=s.state.current,z=C(k,s.state,s.props);H=H>z?z:H,z===0&&(H=s.state.current),typeof k=="number"&&("pageSize"in s.props||s.setState({pageSize:k}),"current"in s.props||s.setState({current:H,currentInputValue:H})),s.props.onShowSizeChange(H,k),"onChange"in s.props&&s.props.onChange&&s.props.onChange(H,k)},s.handleChange=function(k){var H=s.props.disabled,z=k;if(s.isValid(z)&&!H){var Z=C(void 0,s.state,s.props);z>Z?z=Z:z<1&&(z=1),"current"in s.props||s.setState({current:z,currentInputValue:z});var G=s.state.pageSize;return s.props.onChange(z,G),z}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.current2?z-2:0),G=2;G=b?_=b:_=Number(o),_}},{key:"getShowSizeChanger",value:function(){var s=this.props,o=s.showSizeChanger,b=s.total,g=s.totalBoundaryShowSizeChanger;return typeof o!="undefined"?o:b>g}},{key:"renderPrev",value:function(s){var o=this.props,b=o.prevIcon,g=o.itemRender,_=g(s,"prev",this.getItemIcon(b,"prev page")),k=!this.hasPrev();return Object(I.isValidElement)(_)?Object(I.cloneElement)(_,{disabled:k}):_}},{key:"renderNext",value:function(s){var o=this.props,b=o.nextIcon,g=o.itemRender,_=g(s,"next",this.getItemIcon(b,"next page")),k=!this.hasNext();return Object(I.isValidElement)(_)?Object(I.cloneElement)(_,{disabled:k}):_}},{key:"render",value:function(){var s=this,o=this.props,b=o.prefixCls,g=o.className,_=o.style,k=o.disabled,H=o.hideOnSinglePage,z=o.total,Z=o.locale,G=o.showQuickJumper,B=o.showLessItems,te=o.showTitle,de=o.showTotal,pe=o.simple,ye=o.itemRender,Ce=o.showPrevNextJumpers,_e=o.jumpPrevIcon,le=o.jumpNextIcon,se=o.selectComponentClass,ve=o.selectPrefixCls,ie=o.pageSizeOptions,q=this.state,xe=q.current,Ie=q.pageSize,Ne=q.currentInputValue;if(H===!0&&z<=Ie)return null;var De=C(void 0,this.state,this.props),Be=[],Ae=null,Pe=null,We=null,ze=null,qe=null,Ge=G&&G.goButton,ke=B?1:2,ct=xe-1>0?xe-1:0,ut=xe+1=ke*2&&xe!==1+2&&(Be[0]=Object(I.cloneElement)(Be[0],{className:"".concat(b,"-item-after-jump-prev")}),Be.unshift(Ae)),De-xe>=ke*2&&xe!==De-2&&(Be[Be.length-1]=Object(I.cloneElement)(Be[Be.length-1],{className:"".concat(b,"-item-before-jump-next")}),Be.push(Pe)),Pt!==1&&Be.unshift(We),St!==De&&Be.push(ze)}var Ee=null;de&&(Ee=O.a.createElement("li",{className:"".concat(b,"-total-text")},de(z,[z===0?0:(xe-1)*Ie+1,xe*Ie>z?z:xe*Ie])));var fe=!this.hasPrev()||!De,be=!this.hasNext()||!De;return O.a.createElement("ul",Object(oe.a)({className:T()(b,g,Object($.a)({},"".concat(b,"-disabled"),k)),style:_,unselectable:"unselectable",ref:this.savePaginationNode},vt),Ee,O.a.createElement("li",{title:te?Z.prev_page:null,onClick:this.prev,tabIndex:fe?null:0,onKeyPress:this.runIfEnterPrev,className:T()("".concat(b,"-prev"),Object($.a)({},"".concat(b,"-disabled"),fe)),"aria-disabled":fe},this.renderPrev(ct)),Be,O.a.createElement("li",{title:te?Z.next_page:null,onClick:this.next,tabIndex:be?null:0,onKeyPress:this.runIfEnterNext,className:T()("".concat(b,"-next"),Object($.a)({},"".concat(b,"-disabled"),be)),"aria-disabled":be},this.renderNext(ut)),O.a.createElement(x,{disabled:k,locale:Z,rootPrefixCls:b,selectComponentClass:se,selectPrefixCls:ve,changeSize:this.getShowSizeChanger()?this.changePageSize:null,current:xe,pageSize:Ie,pageSizeOptions:ie,quickGo:this.shouldDisplayQuickJumper()?this.handleChange:null,goButton:Ge}))}}],[{key:"getDerivedStateFromProps",value:function(s,o){var b={};if("current"in s&&(b.current=s.current,s.current!==o.current&&(b.currentInputValue=b.current)),"pageSize"in s&&s.pageSize!==o.pageSize){var g=o.current,_=C(s.pageSize,o,s);g=g>_?_:g,"current"in s||(b.current=g,b.currentInputValue=g),b.pageSize=s.pageSize}return b}}]),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:h.a,style:{},itemRender:c,totalBoundaryShowSizeChanger:50};var m=v},"6K3P":function(rt,Xe,X){rt.exports=X.p+"static/jinshi.9b74f304.svg"},"7Cbv":function(rt,Xe,X){"use strict";var oe=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),$=new Uint8Array(16);function D(){if(!oe)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return oe($)}var Y=/^(?:[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 U(P){return typeof P=="string"&&Y.test(P)}for(var N=U,K=[],I=0;I<256;++I)K.push((I+256).toString(16).substr(1));function O(P){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,S=(K[P[w+0]]+K[P[w+1]]+K[P[w+2]]+K[P[w+3]]+"-"+K[P[w+4]]+K[P[w+5]]+"-"+K[P[w+6]]+K[P[w+7]]+"-"+K[P[w+8]]+K[P[w+9]]+"-"+K[P[w+10]]+K[P[w+11]]+K[P[w+12]]+K[P[w+13]]+K[P[w+14]]+K[P[w+15]]).toLowerCase();if(!N(S))throw TypeError("Stringified UUID is invalid");return S}var L=O;function T(P,w,S){P=P||{};var x=P.random||(P.rng||D)();if(x[6]=x[6]&15|64,x[8]=x[8]&63|128,w){S=S||0;for(var h=0;h<16;++h)w[S+h]=x[h];return w}return L(x)}var A=Xe.a=T},"7ahc":function(rt,Xe,X){"use strict";X.d(Xe,"a",function(){return C});var oe=X("k1fw"),$=X("0Owb"),D=X("+L6B"),Y=X("2/Rp"),U=X("y8nQ"),N=X("Vl3Y"),K=X("tJVT"),I=X("OaEy"),O=X("2fM7"),L=X("q1tI"),T=X.n(L),A=X("VrN/"),P=X.n(A),w=X("p77/"),S=X.n(w),x=X("c5Ni"),h=X.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"]};Xe.b=function(v){var m=v.callback,u=v.onCancel,E=Object(L.useState)("python"),d=Object(K.a)(E,2),f=d[0],s=d[1];function o(g){s(c[g][1])}function b(g){m(g)}return T.a.createElement(N.a,Object($.a)({},i,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:b}),T.a.createElement(N.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},T.a.createElement(O.a,{onChange:o},Object.keys(c).map(function(g){return T.a.createElement(l,{key:g,value:g},c[g][0])}))),T.a.createElement(N.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},T.a.createElement(C,{mode:f})),T.a.createElement("div",{className:"flex-container flex-end"},T.a.createElement(Y.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),T.a.createElement(Y.a,{type:"ghost",onClick:u},"\u53D6\u6D88")))};function C(v){var m=v.value,u=v.onChange,E=v.mode,d=v.options,f=d===void 0?{}:d,s=Object(L.useRef)(),o=Object(L.useState)(),b=Object(K.a)(o,2),g=b[0],_=b[1];return Object(L.useEffect)(function(){if(g){function k(H){var z=H.getValue();u&&u(z)}return g.on("change",k),function(){g.off("change",k)}}},[g,u]),Object(L.useEffect)(function(){g&&g.setOption("mode",E)},[g,E]),Object(L.useEffect)(function(){g&&((m!==g.getValue()||m==="")&&setTimeout(function(){g.setValue(m||" ")},300))},[g,m]),Object(L.useEffect)(function(){if(s.current&&!g){var k=P.a.fromTextArea(s.current,Object(oe.a)({mode:E,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},f));_(k)}},[s.current,g]),T.a.createElement("div",{className:"my-codemirror-container"},T.a.createElement("textarea",{ref:s}))}},"7ixt":function(rt,Xe,X){"use strict";X.d(Xe,"a",function(){return D});var oe={adjustX:1,adjustY:1},$=[0,0],D={left:{points:["cr","cl"],overflow:oe,offset:[-4,0],targetOffset:$},right:{points:["cl","cr"],overflow:oe,offset:[4,0],targetOffset:$},top:{points:["bc","tc"],overflow:oe,offset:[0,-4],targetOffset:$},bottom:{points:["tc","bc"],overflow:oe,offset:[0,4],targetOffset:$},topLeft:{points:["bl","tl"],overflow:oe,offset:[0,-4],targetOffset:$},leftTop:{points:["tr","tl"],overflow:oe,offset:[-4,0],targetOffset:$},topRight:{points:["br","tr"],overflow:oe,offset:[0,-4],targetOffset:$},rightTop:{points:["tl","tr"],overflow:oe,offset:[4,0],targetOffset:$},bottomRight:{points:["tr","br"],overflow:oe,offset:[0,4],targetOffset:$},rightBottom:{points:["bl","br"],overflow:oe,offset:[4,0],targetOffset:$},bottomLeft:{points:["tl","bl"],overflow:oe,offset:[0,4],targetOffset:$},leftBottom:{points:["br","bl"],overflow:oe,offset:[-4,0],targetOffset:$}},Y=D},"7qnI":function(rt,Xe,X){"use strict";var oe=X("5Dmo"),$=X("3S7+"),D=X("fWQN"),Y=X("mtLc"),U=X("yKVA"),N=X("879j"),K=X("5NDa"),I=X("5rEg"),O=X("q1tI"),L=X.n(O),T=X("O2Wb"),A=X.n(T),P=I.a.TextArea,w=function(S){Object(U.a)(h,S);var x=Object(N.a)(h);function h(){return Object(D.a)(this,h),x.apply(this,arguments)}return Object(Y.a)(h,[{key:"render",value:function(){var i=this,c=this.props,C=c.index,v=c.onAnswerChange,m=c.addChildAnswer,u=c.exerciseIsPublish,E=c.answers,d=c.activeOptionErrorIndex,f=c.flex,s=f===void 0?"0 0 1000px":f;return L.a.createElement("div",{className:A.a.flex},L.a.createElement("div",{className:"".concat(A.a.color666," mb5 mt6"),style:{flex:"0 0 90px"}},"\u7B54\u6848(\u586B\u7A7A",C+1,"):"),L.a.createElement("div",{className:"".concat(A.a.flex," ").concat(A.a.flex1),style:{flexDirection:"column"}},E.map(function(o,b){var g="".concat(C,"-").concat(b);return L.a.createElement("div",{className:"".concat(A.a.flex," ").concat(A.a.flex1),key:b},L.a.createElement("div",{className:A.a.flex1,style:{flex:s}},L.a.createElement("div",null,L.a.createElement(P,{className:g===d?A.a.error:"",spellCheck:!1,rows:4,value:o||"",defaultValue:"\u8BF7\u8F93\u5165\u53C2\u8003\u7B54\u6848".concat(b==0?"":"(\u53EF\u9009)"),onChange:function(k){return v(C,b,k.target.value)},style:{minHeight:95}}))),!u&&L.a.createElement(L.a.Fragment,null,b!=0&&L.a.createElement($.a,{title:"\u5220\u9664"},L.a.createElement("i",{className:"".concat(A.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){return i.props.deleteChildAnswer(C,b)},style:{float:"right"}})),b===0&&L.a.createElement($.a,{title:"\u5220\u9664"},L.a.createElement("i",{className:"".concat(A.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){return i.props.deleteChildAnswermain(C,b)},style:{float:"right"}})),L.a.createElement($.a,{title:"\u65B0\u589E\u53C2\u8003\u7B54\u6848"},L.a.createElement("i",{className:"".concat(A.a.addIcon," iconfont icon-roundaddfill ml6"),onClick:function(){return m(C)},style:{float:"right",visibility:b==E.length-1?"":"hidden"}}))))})))}}]),h}(O.Component);Xe.a=w},"815F":function(rt,Xe,X){"use strict";X.d(Xe,"e",function(){return K}),X.d(Xe,"c",function(){return O}),X.d(Xe,"d",function(){return L}),X.d(Xe,"a",function(){return A}),X.d(Xe,"f",function(){return P}),X.d(Xe,"b",function(){return w});var oe=X("KQm4"),$=X("VTBJ"),D=X("Ff2n"),Y=X("Zm9Q"),U=X("Kwbf"),N=X("OZM5");function K(S,x){return S!=null?S:x}function I(){var S=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],x=new Map;function h(l){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";(l||[]).forEach(function(c){var C=c.key,v=c.children;Object(U.a)(C!=null,"Tree node must have a certain key: [".concat(i).concat(C,"]"));var m=String(C);Object(U.a)(!x.has(m)||C===null||C===void 0,"Same 'key' exist in the Tree: ".concat(m)),x.set(m,!0),h(v,"".concat(i).concat(m," > "))})}h(S)}function O(S){function x(h){var l=Object(Y.a)(h);return l.map(function(i){if(!Object(N.i)(i))return Object(U.a)(!i,"Tree/TreeNode can only accept TreeNode as children."),null;var c=i.key,C=i.props,v=C.children,m=Object(D.a)(C,["children"]),u=Object($.a)({key:c},m),E=x(v);return E.length&&(u.children=E),u}).filter(function(i){return i})}return x(S)}function L(){var S=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],x=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],h=new Set(x===!0?[]:x),l=[];function i(c){var C=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return c.map(function(v,m){var u=Object(N.h)(C?C.pos:"0",m),E=K(v.key,u),d=Object($.a)(Object($.a)({},v),{},{parent:C,pos:u,children:null,data:v,isStart:[].concat(Object(oe.a)(C?C.isStart:[]),[m===0]),isEnd:[].concat(Object(oe.a)(C?C.isEnd:[]),[m===c.length-1])});return l.push(d),x===!0||h.has(E)?d.children=i(v.children||[],d):d.children=[],d})}return i(S),l}function T(S,x,h){var l;h?typeof h=="string"?l=function(C){return C[h]}:typeof h=="function"&&(l=function(C){return h(C)}):l=function(C,v){return K(C.key,v)};function i(c,C,v){var m=c?c.children:S,u=c?Object(N.h)(v.pos,C):"0";if(c){var E=l(c,u),d={node:c,index:C,pos:u,key:E,parentPos:v.node?v.pos:null,level:v.level+1};x(d)}m&&m.forEach(function(f,s){i(f,s,{node:c,pos:u,level:v?v.level+1:-1})})}i(null)}function A(S){var x=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},h=x.initWrapper,l=x.processEntity,i=x.onProcessFinished,c=arguments.length>2?arguments[2]:void 0,C={},v={},m={posEntities:C,keyEntities:v};return h&&(m=h(m)||m),T(S,function(u){var E=u.node,d=u.index,f=u.pos,s=u.key,o=u.parentPos,b=u.level,g={node:E,index:d,key:s,pos:f,level:b},_=K(s,f);C[f]=g,v[_]=g,g.parent=C[o],g.parent&&(g.parent.children=g.parent.children||[],g.parent.children.push(g)),l&&l(g,m)},c),i&&i(m),m}function P(S,x){var h=x.expandedKeys,l=x.selectedKeys,i=x.loadedKeys,c=x.loadingKeys,C=x.checkedKeys,v=x.halfCheckedKeys,m=x.dragOverNodeKey,u=x.dropPosition,E=x.keyEntities,d=E[S],f={eventKey:S,expanded:h.indexOf(S)!==-1,selected:l.indexOf(S)!==-1,loaded:i.indexOf(S)!==-1,loading:c.indexOf(S)!==-1,checked:C.indexOf(S)!==-1,halfChecked:v.indexOf(S)!==-1,pos:String(d?d.pos:""),dragOver:m===S&&u===0,dragOverGapTop:m===S&&u===-1,dragOverGapBottom:m===S&&u===1};return f}function w(S){var x=S.data,h=S.expanded,l=S.selected,i=S.checked,c=S.loaded,C=S.loading,v=S.halfChecked,m=S.dragOver,u=S.dragOverGapTop,E=S.dragOverGapBottom,d=S.pos,f=S.active,s=Object($.a)(Object($.a)({},x),{},{expanded:h,selected:l,checked:i,loaded:c,loading:C,halfChecked:v,dragOver:m,dragOverGapTop:u,dragOverGapBottom:E,pos:d,active:f});return"props"in s||Object.defineProperty(s,"props",{get:function(){return Object(U.a)(!1,"Second param return from event is node data instead of TreeNode instance. Please read value directly instead of reading from `props`."),S}}),s}},"8EBN":function(rt,Xe,X){(function(oe){oe(X("VrN/"))})(function(oe){"use strict";oe.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 $=0;$-1&&Y.substring(K+1,Y.length);if(I)return oe.findModeByExtension(I)},oe.findModeByName=function(Y){Y=Y.toLowerCase();for(var U=0;U=M.length?Q.slice(M.length):Q}).join(` `)}var h=[],l=["
    "],i=new w.a.Renderer,c=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function C(){h.length=0,l=["
      "]}var v={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function m(F,p,y,M){if(p>=F.length||F[p].level<=y)return p;var Q=F[p];M.push("
    • "+Q.text+""),p++;var W=[];return p=m(F,p,Q.level,W),W.length>0&&(M.push("
        "),W.forEach(function(me){M.push(me)}),M.push("
      ")),M.push("
    • "),p=m(F,p,y,M),p}function u(){return m(h,0,0,l),l.push("
    "),l.join("")}var E={heading:function(p){var y=c.exec(p);if(y)return{type:"heading",raw:y[0],depth:y[1].length,text:y[2]}},fences:function(p){var y=this.rules.block.fences.exec(p);if(y){var M=y[0],Q=x(M,y[3]||""),W=y[2]?y[2].trim():y[2];if(["latex","katex","math"].indexOf(W)>=0){var me=s(),Ye=Q;Q=me,o[me]={type:"block",expression:Ye}}return{type:"code",raw:M,lang:W,text:Q}}}},d=/(?:\${2})([^\n`]+?)(?:\${2})/gi,f=0,s=function(){return"__special_katext_id_".concat(f++,"__")},o={};function b(){return o}function g(){f=0,o={}}function _(F){return F=F.replace(d,function(p,y){var M=s();return o[M]={type:"inline",expression:y},M}),F}var k=i.listitem;i.listitem=function(F){return k(_(F))};var H=i.paragraph;i.paragraph=function(F){return H(_(F))};var z=i.tablecell;i.tablecell=function(F,p){return z(_(F),p)},i.code=function(F,p,y){var M=(p||"").match(/\S*/)[0];return M?["latex","katex","math"].indexOf(M)>=0?"

    ".concat(F,"

    "):'
    ').concat(y?F:Object(S.escape)(F,!0),`
    `):'
    '+(y?F:Object(S.escape)(F,!0))+"
    "},i.heading=function(F,p,y){var M=this.options.headerPrefix+y.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return h.push({anchor:M,level:p,text:F}),"'+F+""},w.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),w.a.use({tokenizer:E,renderer:i});var Z=w.a,G=X("SJMd"),B=X("ulZh"),te=X.n(B),de=X("m3rI"),pe=X("Oy/b"),ye=X("p5ED"),Ce=X("ErOA");/*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */var _e=function(F,p){return(_e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(y,M){y.__proto__=M}||function(y,M){for(var Q in M)Object.prototype.hasOwnProperty.call(M,Q)&&(y[Q]=M[Q])})(F,p)};function le(F,p){function y(){this.constructor=F}_e(F,p),F.prototype=p===null?Object.create(p):(y.prototype=p.prototype,new y)}function se(F,p,y,M){return new(y||(y=Promise))(function(Q,W){function me(jt){try{dt(M.next(jt))}catch(Qe){W(Qe)}}function Ye(jt){try{dt(M.throw(jt))}catch(Qe){W(Qe)}}function dt(jt){var Qe;jt.done?Q(jt.value):(Qe=jt.value,Qe instanceof y?Qe:new y(function(Vt){Vt(Qe)})).then(me,Ye)}dt((M=M.apply(F,p||[])).next())})}function ve(F,p){var y,M,Q,W,me={label:0,sent:function(){if(1&Q[0])throw Q[1];return Q[1]},trys:[],ops:[]};return W={next:Ye(0),throw:Ye(1),return:Ye(2)},typeof Symbol=="function"&&(W[Symbol.iterator]=function(){return this}),W;function Ye(dt){return function(jt){return function(Qe){if(y)throw new TypeError("Generator is already executing.");for(;me;)try{if(y=1,M&&(Q=2&Qe[0]?M.return:Qe[0]?M.throw||((Q=M.return)&&Q.call(M),0):M.next)&&!(Q=Q.call(M,Qe[1])).done)return Q;switch(M=0,Q&&(Qe=[2&Qe[0],Q.value]),Qe[0]){case 0:case 1:Q=Qe;break;case 4:return me.label++,{value:Qe[1],done:!1};case 5:me.label++,M=Qe[1],Qe=[0];continue;case 7:Qe=me.ops.pop(),me.trys.pop();continue;default:if(!(Q=me.trys,(Q=Q.length>0&&Q[Q.length-1])||Qe[0]!==6&&Qe[0]!==2)){me=0;continue}if(Qe[0]===3&&(!Q||Qe[1]>Q[0]&&Qe[1]',"select"),this.addActionButton(M,'',"delete"),this.uiStyleSettings.clearButtonVisible&&this.addActionButton(M,'',"clear"),this.uiStyleSettings.undoButtonVisible&&this.addActionButton(M,'',"undo"),this.uiStyleSettings.redoButtonVisible&&this.addActionButton(M,'',"redo"),this.uiStyleSettings.zoomButtonVisible&&this.addActionButton(M,'',"zoom"),this.uiStyleSettings.zoomButtonVisible&&this.uiStyleSettings.zoomOutButtonVisible&&this.addActionButton(M,'',"zoom-out"),this.uiStyleSettings.notesButtonVisible&&this.addActionButton(M,'',"notes"),this.markerButtonBlock=document.createElement("div"),this.markerButtonBlock.className=this.toolbarBlockStyleClass.name,this.markerButtonBlock.style.flexGrow="2",this.markerButtonBlock.style.textAlign="center",this.uiContainer.appendChild(this.markerButtonBlock),this.markerButtonOverflowBlock=document.createElement("div"),this.markerButtonOverflowBlock.className=this.toolbarOverflowBlockStyleClass.name+" "+(this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName?this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName:this.toolbarOverflowBlockStyleColorsClass.name),this.markerButtonOverflowBlock.style.display="none",this.uiContainer.appendChild(this.markerButtonOverflowBlock),this.markerItems&&(this.markerItems.forEach(function(W){var me=document.createElement("div");me.className=""+y.toolbarButtonStyleClass.name,me.setAttribute("data-type-name",W.typeName),me.innerHTML=W.icon,me.addEventListener("click",function(){y.markerToolbarButtonClicked(me,W)}),y.buttons.push(me),y.markerButtons.push(me)}),this.overflowButton=document.createElement("div"),this.overflowButton.className=this.toolbarButtonStyleClass.name+" "+(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name),this.overflowButton.innerHTML='',this.overflowButton.addEventListener("click",this.overflowButtonClicked),this.markerButtonBlock.appendChild(this.overflowButton));var Q=document.createElement("div");Q.className=this.toolbarBlockStyleClass.name,Q.style.whiteSpace="nowrap",Q.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(Q),this.addActionButton(Q,'',"render"),this.addActionButton(Q,'',"close"),this.markerjsContainer.appendChild(this.uiContainer),this.setSelectMode(),this.setCurrentMarker(),this.adjustLayout()},F.prototype.addButtonClickListener=function(p){this.buttonClickListeners.push(p)},F.prototype.removeButtonClickListener=function(p){this.buttonClickListeners.indexOf(p)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(p),1)},F.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},F.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var p=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var y=0;y0&&this.buttonClickListeners.forEach(function(M){return M("marker",y)}),this.markerButtonOverflowBlock.style.display="none"},F.prototype.actionToolbarButtonClicked=function(p,y){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(M){return M("action",y)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},F.prototype.setActiveButton=function(p){this.resetButtonStyles(),p.className=p.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),p.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},F.prototype.setActiveMarkerButton=function(p){var y=this.markerButtons.find(function(M){return M.getAttribute("data-type-name")===p});y&&this.setActiveButton(y)},F.prototype.setCurrentMarker=function(p){var y=this;this.currentMarker=p,this.buttons.filter(function(M){return/delete|notes/.test(M.getAttribute("data-action"))}).forEach(function(M){y.currentMarker===void 0?(M.style.fillOpacity="0.4",M.style.pointerEvents="none"):(M.style.fillOpacity="1",M.style.pointerEvents="all")})},F}(),We=function(){function F(p,y,M,Q){this.panels=[],this.panelButtons=[],this.markerjsContainer=p,this.displayMode=y,this.uiStyleSettings=M,this.styles=Q,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return F.prototype.addStyles=function(){var p;this.toolboxStyleClass=this.styles.addClass(new Ae("toolbox",` width: 100%; flex-shrink: 0; display: flex; flex-direction: column; font-family: sans-serif; `+(this.displayMode==="popup"?"height:"+2.5*this.uiStyleSettings.toolbarHeight+"px;":"")+` box-sizing: content-box; `+(this.displayMode==="popup"?"background-color: "+this.uiStyleSettings.canvasBackgroundColor+";":"")+` `+(this.displayMode==="inline"?"border-bottom-left-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+` `+(this.displayMode==="inline"?"border-bottom-right-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+` overflow: hidden; `)),this.toolboxStyleColorsClass=this.styles.addClass(new Ae("toolbox_colors",` color: `+this.uiStyleSettings.toolboxColor+`; `));var y=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new Ae("toolbox-button-row",` display: flex; cursor: default; box-sizing: content-box; `)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new Ae("toolbox-button-row_colors",` background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`; `)),this.toolboxPanelRowStyleClass=this.styles.addClass(new Ae("toolbox-panel-row",` display: flex; `+(this.displayMode==="inline"?"position: absolute;":"")+` `+(this.displayMode==="inline"?"bottom: "+this.uiStyleSettings.toolbarHeight+"px;":"")+` cursor: default; height: `+1.5*this.uiStyleSettings.toolbarHeight+`px; `+(this.displayMode==="inline"?"width: 100%;":"")+` box-sizing: content-box; `)),this.toolboxPanelRowStyleColorsClass=this.styles.addClass(new Ae("toolbox-panel-row_colors",` background-color: `+((p=this.uiStyleSettings.toolboxBackgroundColor)!==null&&p!==void 0?p:this.uiStyleSettings.toolbarBackgroundHoverColor)+`; `)),this.toolboxButtonStyleClass=this.styles.addClass(new Ae("toolbox_button",` display: inline-block; width: `+(this.uiStyleSettings.toolbarHeight-2*y)+`px; height: `+(this.uiStyleSettings.toolbarHeight-2*y)+`px; padding: `+y+`px; box-sizing: content-box; `)),this.toolboxButtonStyleColorsClass=this.styles.addClass(new Ae("toolbox-button_colors",` fill: `+this.uiStyleSettings.toolbarColor+`; `)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new Ae("toolbox-active-button_colors",` background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`; fill: `+this.uiStyleSettings.toolbarColor+`; `)),this.styles.addRule(new Be("."+this.toolboxButtonStyleColorsClass.name+":hover",` background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+` `)),this.styles.addRule(new Be("."+this.toolboxButtonStyleClass.name+" svg",` height: `+this.uiStyleSettings.toolbarHeight/2+`px; `))},F.prototype.show=function(p){var y;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=p,this.uiContainer.className=this.toolboxStyleClass.name+" "+((y=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&y!==void 0?y:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},F.prototype.setPanelButtons=function(p){var y,M,Q=this;this.panels=p,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((y=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&y!==void 0?y:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+((M=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&M!==void 0?M:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(W){var me;W.uiStyleSettings=Q.uiStyleSettings;var Ye=document.createElement("div");Ye.className=Q.toolboxButtonStyleClass.name+" "+((me=Q.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&me!==void 0?me:Q.toolboxButtonStyleColorsClass.name),Ye.innerHTML=W.icon,Ye.title=W.title,Ye.addEventListener("click",function(){Q.panelButtonClick(W)}),Q.panelButtons.push(Ye),Q.buttonRow.appendChild(Ye)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},F.prototype.panelButtonClick=function(p){var y=this,M=-1;if(p!==this.activePanel){M=this.panels.indexOf(p),this.panelRow.innerHTML="";var Q=p.getUi();Q.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(Q),this.panelRow.style.display="flex",this.panelRow.style.visibility="visible",this.panelRow.className=this.panelRow.className.replace(this.styles.fadeOutAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeInAnimationClassName,this.activePanel=p}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){y.displayMode==="inline"?y.panelRow.style.display="none":y.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(W,me){var Ye,dt;W.className=y.toolboxButtonStyleClass.name+" "+(me===M?""+((Ye=y.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&Ye!==void 0?Ye:y.toolboxActiveButtonStyleColorsClass.name):""+((dt=y.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&dt!==void 0?dt:y.toolboxButtonStyleColorsClass.name))})},F}(),ze=function(F,p){this.title=F,this.icon=p},qe=function(F){function p(y,M,Q,W){var me=F.call(this,y,W||'')||this;return me.colors=[],me.addTransparent=!1,me.colorBoxes=[],me.colors=M,me.currentColor=Q,me.setCurrentColor=me.setCurrentColor.bind(me),me.getColorBox=me.getColorBox.bind(me),me}return le(p,F),p.prototype.getUi=function(){var y=this,M=document.createElement("div");return M.style.overflow="hidden",M.style.whiteSpace="nowrap",this.colors.forEach(function(Q){var W=y.getColorBox(Q);M.appendChild(W),y.colorBoxes.push(W)}),M},p.prototype.getColorBox=function(y){var M=this,Q=this.uiStyleSettings.toolbarHeight/4,W=this.uiStyleSettings.toolbarHeight-Q,me=document.createElement("div");me.style.display="inline-block",me.style.boxSizing="content-box",me.style.width=W-2+"px",me.style.height=W-2+"px",me.style.padding="1px",me.style.marginRight="2px",me.style.marginBottom="2px",me.style.borderWidth="2px",me.style.borderStyle="solid",me.style.borderRadius=(W+2)/2+"px",me.style.borderColor=y===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",me.addEventListener("click",function(){M.setCurrentColor(y,me)});var Ye=document.createElement("div");return Ye.style.display="inline-block",Ye.style.width=W-2+"px",Ye.style.height=W-2+"px",Ye.style.backgroundColor=y,Ye.style.borderRadius=W/2+"px",y==="transparent"&&(Ye.style.fill=this.uiStyleSettings.toolboxAccentColor,Ye.innerHTML=` `),me.appendChild(Ye),me},p.prototype.setCurrentColor=function(y,M){var Q=this;this.currentColor=y,this.colorBoxes.forEach(function(W){W.style.borderColor=W===M?Q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(y)},p}(ze),Ge=function(){function F(p,y,M){this._state="new",this._isSelected=!1,this._container=p,this._overlayContainer=y,this.globalSettings=M,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(F.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),F.prototype.ownsTarget=function(p){return!1},Object.defineProperty(F.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),F.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},F.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},F.prototype.pointerDown=function(p,y){},F.prototype.dblClick=function(p,y){},F.prototype.manipulate=function(p){},F.prototype.pointerUp=function(p){this.stateChanged()},F.prototype.dispose=function(){},F.prototype.addMarkerVisualToContainer=function(p){this.container.childNodes.length>0?this.container.insertBefore(p,this.container.childNodes[0]):this.container.appendChild(p)},F.prototype.getState=function(){return{typeName:F.typeName,state:this.state,notes:this.notes}},F.prototype.restoreState=function(p){this._state=p.state,this.notes=p.notes},F.prototype.scale=function(p,y){},F.prototype.colorChanged=function(p){this.onColorChanged&&this.onColorChanged(p),this.stateChanged()},F.prototype.fillColorChanged=function(p){this.onFillColorChanged&&this.onFillColorChanged(p),this.stateChanged()},F.prototype.stateChanged=function(){if(this.onStateChanged&&this.state!=="creating"&&this.state!=="new"){var p=this.getState();this.manipulationStartState!==void 0&&(this.manipulationStartState.state="select"),p.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(p)&&this.onStateChanged(this)}},F.typeName="MarkerBase",F}(),ke=function(){function F(){this.findGripByVisual=this.findGripByVisual.bind(this)}return F.prototype.findGripByVisual=function(p){return this.topLeft.ownsTarget(p)?this.topLeft:this.topCenter.ownsTarget(p)?this.topCenter:this.topRight.ownsTarget(p)?this.topRight:this.centerLeft.ownsTarget(p)?this.centerLeft:this.centerRight.ownsTarget(p)?this.centerRight:this.bottomLeft.ownsTarget(p)?this.bottomLeft:this.bottomCenter.ownsTarget(p)?this.bottomCenter:this.bottomRight.ownsTarget(p)?this.bottomRight:void 0},F}(),ct=function(){function F(){this.GRIP_SIZE=10,this.visual=q.createGroup(),this.visual.appendChild(q.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(q.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return F.prototype.ownsTarget=function(p){return p===this.visual||p===this.visual.childNodes[0]||p===this.visual.childNodes[1]},F}(),ut=function(){function F(){}return F.toITransformMatrix=function(p){return{a:p.a,b:p.b,c:p.c,d:p.d,e:p.e,f:p.f}},F.toSVGMatrix=function(p,y){return p.a=y.a,p.b=y.b,p.c=y.c,p.d=y.d,p.e=y.e,p.f=y.f,p},F}(),vt=function(F){function p(y,M,Q){var W=F.call(this,y,M,Q)||this;return W.left=0,W.top=0,W.width=0,W.height=0,W.defaultSize={x:50,y:20},W.offsetX=0,W.offsetY=0,W.rotationAngle=0,W.CB_DISTANCE=10,W._suppressMarkerCreateEvent=!1,W.container.transform.baseVal.appendItem(q.createTransform()),W.setupControlBox(),W}return le(p,F),Object.defineProperty(p.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"visual",{get:function(){return this._visual},set:function(y){this._visual=y;var M=q.createTransform();this._visual.transform.baseVal.appendItem(M)},enumerable:!1,configurable:!0}),p.prototype.ownsTarget=function(y){return!!F.prototype.ownsTarget.call(this,y)||!!(this.controlGrips.findGripByVisual(y)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(y))},p.prototype.pointerDown=function(y,M){F.prototype.pointerDown.call(this,y,M),this.state==="new"&&(this.left=y.x,this.top=y.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var Q=this.unrotatePoint(y);if(this.manipulationStartX=Q.x,this.manipulationStartY=Q.y,this.offsetX=Q.x-this.left,this.offsetY=Q.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(M),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(M)){this.activeGrip=this.rotatorGrip;var W=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=W.x-this.width/2,this.top=W.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var me=this.container.transform.baseVal.getItem(0);me.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(me,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},p.prototype.pointerUp=function(y){var M=this.state;F.prototype.pointerUp.call(this,y),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(y),this._state="select",M==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},p.prototype.moveVisual=function(y){this.visual.style.transform="translate("+y.x+"px, "+y.y+"px)"},p.prototype.manipulate=function(y){var M=this.unrotatePoint(y);this.state==="creating"?this.resize(y):this.state==="move"?(this.left=this.manipulationStartLeft+(M.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(M.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(M):this.state==="rotate"&&this.rotate(y)},p.prototype.resize=function(y){var M=this.manipulationStartLeft,Q=this.manipulationStartWidth,W=this.manipulationStartTop,me=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:M=this.manipulationStartLeft+y.x-this.manipulationStartX,Q=this.manipulationStartWidth+this.manipulationStartLeft-M;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:Q=this.manipulationStartWidth+y.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:W=this.manipulationStartTop+y.y-this.manipulationStartY,me=this.manipulationStartHeight+this.manipulationStartTop-W;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:me=this.manipulationStartHeight+y.y-this.manipulationStartY}Q>=0?(this.left=M,this.width=Q):(this.left=M+Q,this.width=-Q),me>=0?(this.top=W,this.height=me):(this.top=W+me,this.height=-me),this.setSize()},p.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},p.prototype.rotate=function(y){if(Math.abs(y.x-this.centerX)>.1){var M=Math.sign(y.x-this.centerX);this.rotationAngle=180*Math.atan((y.y-this.centerY)/(y.x-this.centerX))/Math.PI+90*M,this.applyRotation()}},p.prototype.applyRotation=function(){var y=this.container.transform.baseVal.getItem(0);y.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(y,0)},p.prototype.rotatePoint=function(y){if(this.rotationAngle===0)return y;var M=this.container.getCTM(),Q=q.createPoint(y.x,y.y);return{x:(Q=Q.matrixTransform(M)).x,y:Q.y}},p.prototype.unrotatePoint=function(y){if(this.rotationAngle===0)return y;var M=this.container.getCTM();M=M.inverse();var Q=q.createPoint(y.x,y.y);return{x:(Q=Q.matrixTransform(M)).x,y:Q.y}},p.prototype.select=function(){F.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},p.prototype.deselect=function(){F.prototype.deselect.call(this),this.controlBox.style.display="none"},p.prototype.setupControlBox=function(){this.controlBox=q.createGroup();var y=q.createTransform();y.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(y),this.container.appendChild(this.controlBox),this.controlRect=q.createRect(this.width+this.CB_DISTANCE,this.height+this.CB_DISTANCE,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"],["fill","transparent"],["pointer-events","none"]]),this.controlBox.appendChild(this.controlRect),this.globalSettings.disableRotation!==!0&&(this.rotatorGripLine=q.createLine((this.width+2*this.CB_DISTANCE)/2,this.top-this.CB_DISTANCE,(this.width+2*this.CB_DISTANCE)/2,this.top-3*this.CB_DISTANCE,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.appendChild(this.rotatorGripLine)),this.controlGrips=new ke,this.addControlGrips(),this.controlBox.style.display="none"},p.prototype.adjustControlBox=function(){var y=this.controlBox.transform.baseVal.getItem(0);y.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(y,0),this.controlRect.setAttribute("width",(this.width+this.CB_DISTANCE).toString()),this.controlRect.setAttribute("height",(this.height+this.CB_DISTANCE).toString()),this.rotatorGripLine!==void 0&&(this.rotatorGripLine.setAttribute("x1",((this.width+this.CB_DISTANCE)/2).toString()),this.rotatorGripLine.setAttribute("y1",(-this.CB_DISTANCE/2).toString()),this.rotatorGripLine.setAttribute("x2",((this.width+this.CB_DISTANCE)/2).toString()),this.rotatorGripLine.setAttribute("y2",(3*-this.CB_DISTANCE).toString())),this.positionGrips()},p.prototype.addControlGrips=function(){this.controlGrips.topLeft=this.createGrip(),this.controlGrips.topCenter=this.createGrip(),this.controlGrips.topRight=this.createGrip(),this.controlGrips.centerLeft=this.createGrip(),this.controlGrips.centerRight=this.createGrip(),this.controlGrips.bottomLeft=this.createGrip(),this.controlGrips.bottomCenter=this.createGrip(),this.controlGrips.bottomRight=this.createGrip(),this.globalSettings.disableRotation!==!0&&(this.rotatorGrip=this.createGrip()),this.positionGrips()},p.prototype.createGrip=function(){var y=new ct;return y.visual.transform.baseVal.appendItem(q.createTransform()),this.controlBox.appendChild(y.visual),y},p.prototype.positionGrips=function(){var y=this.controlGrips.topLeft.GRIP_SIZE,M=-y/2,Q=M,W=(this.width+this.CB_DISTANCE)/2-y/2,me=(this.height+this.CB_DISTANCE)/2-y/2,Ye=this.height+this.CB_DISTANCE-y/2,dt=this.width+this.CB_DISTANCE-y/2;this.positionGrip(this.controlGrips.topLeft.visual,M,Q),this.positionGrip(this.controlGrips.topCenter.visual,W,Q),this.positionGrip(this.controlGrips.topRight.visual,dt,Q),this.positionGrip(this.controlGrips.centerLeft.visual,M,me),this.positionGrip(this.controlGrips.centerRight.visual,dt,me),this.positionGrip(this.controlGrips.bottomLeft.visual,M,Ye),this.positionGrip(this.controlGrips.bottomCenter.visual,W,Ye),this.positionGrip(this.controlGrips.bottomRight.visual,dt,Ye),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,W,Q-3*this.CB_DISTANCE)},p.prototype.positionGrip=function(y,M,Q){var W=y.transform.baseVal.getItem(0);W.setTranslate(M,Q),y.transform.baseVal.replaceItem(W,0)},p.prototype.hideControlBox=function(){this.controlBox.style.display="none"},p.prototype.showControlBox=function(){this.controlBox.style.display=""},p.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:ut.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:ut.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},F.prototype.getState.call(this))},p.prototype.restoreState=function(y){F.prototype.restoreState.call(this,y);var M=y;this.left=M.left,this.top=M.top,this.width=M.width,this.height=M.height,this.rotationAngle=M.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(ut.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,M.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(ut.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,M.containerTransformMatrix))},p.prototype.scale=function(y,M){F.prototype.scale.call(this,y,M);var Q=this.rotatePoint({x:this.left,y:this.top}),W=this.unrotatePoint({x:Q.x*y,y:Q.y*M});this.left=W.x,this.top=W.y,this.width=this.width*y,this.height=this.height*M,this.adjustControlBox()},p}(Ge),lt=function(F){function p(y,M,Q){var W=F.call(this,y,M,Q)||this;return W.fillColor="transparent",W.strokeColor="transparent",W.strokeWidth=0,W.strokeDasharray="",W.opacity=1,W.setStrokeColor=W.setStrokeColor.bind(W),W.setFillColor=W.setFillColor.bind(W),W.setStrokeWidth=W.setStrokeWidth.bind(W),W.setStrokeDasharray=W.setStrokeDasharray.bind(W),W.createVisual=W.createVisual.bind(W),W}return le(p,F),p.prototype.ownsTarget=function(y){return!(!F.prototype.ownsTarget.call(this,y)&&y!==this.visual)},p.prototype.createVisual=function(){this.visual=q.createRect(1,1,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},p.prototype.pointerDown=function(y,M){F.prototype.pointerDown.call(this,y,M),this.state==="new"&&(this.createVisual(),this.moveVisual(y),this._state="creating")},p.prototype.manipulate=function(y){F.prototype.manipulate.call(this,y)},p.prototype.resize=function(y){F.prototype.resize.call(this,y),this.setSize()},p.prototype.setSize=function(){F.prototype.setSize.call(this),q.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},p.prototype.pointerUp=function(y){F.prototype.pointerUp.call(this,y),this.setSize()},p.prototype.setStrokeColor=function(y){this.strokeColor=y,this.visual&&q.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(y),this.stateChanged()},p.prototype.setFillColor=function(y){this.fillColor=y,this.visual&&q.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},p.prototype.setStrokeWidth=function(y){this.strokeWidth=y,this.visual&&q.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},p.prototype.setStrokeDasharray=function(y){this.strokeDasharray=y,this.visual&&q.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},p.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},F.prototype.getState.call(this))},p.prototype.restoreState=function(y){var M=y;this.fillColor=M.fillColor,this.strokeColor=M.strokeColor,this.strokeWidth=M.strokeWidth,this.strokeDasharray=M.strokeDasharray,this.opacity=M.opacity,this.createVisual(),F.prototype.restoreState.call(this,y),this.setSize()},p.prototype.scale=function(y,M){F.prototype.scale.call(this,y,M),this.setSize()},p.title="Rectangle marker",p}(vt),Tt=function(F){function p(y,M,Q,W){var me=F.call(this,y,W||'')||this;return me.widths=[],me.widthBoxes=[],me.widths=M,me.currentWidth=Q,me.setCurrentWidth=me.setCurrentWidth.bind(me),me}return le(p,F),p.prototype.getUi=function(){var y=this,M=document.createElement("div");return M.style.display="flex",M.style.overflow="hidden",M.style.flexGrow="2",this.widths.forEach(function(Q){var W=document.createElement("div");W.style.display="flex",W.style.flexGrow="2",W.style.alignItems="center",W.style.justifyContent="space-between",W.style.padding="5px",W.style.borderWidth="2px",W.style.borderStyle="solid",W.style.borderColor=Q===y.currentWidth?y.uiStyleSettings.toolboxAccentColor:"transparent",W.addEventListener("click",function(){y.setCurrentWidth(Q,W)}),M.appendChild(W);var me=document.createElement("div");me.innerText=Q.toString(),me.style.marginRight="5px",W.appendChild(me);var Ye=document.createElement("div");Ye.style.minHeight="20px",Ye.style.flexGrow="2",Ye.style.display="flex",Ye.style.alignItems="center";var dt=document.createElement("hr");dt.style.minWidth="20px",dt.style.border="0px",dt.style.borderTop=Q+"px solid "+y.uiStyleSettings.toolboxColor,dt.style.flexGrow="2",Ye.appendChild(dt),W.appendChild(Ye),y.widthBoxes.push(W)}),M},p.prototype.setCurrentWidth=function(y,M){var Q=this;this.currentWidth=y,this.widthBoxes.forEach(function(W){W.style.borderColor=W===M?Q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},p}(ze),gt=function(F){function p(y,M,Q,W){var me=F.call(this,y,W||'')||this;return me.styles=[],me.styleBoxes=[],me.styles=M,me.currentStyle=Q,me.setCurrentStyle=me.setCurrentStyle.bind(me),me}return le(p,F),p.prototype.getUi=function(){var y=this,M=document.createElement("div");return M.style.display="flex",M.style.overflow="hidden",M.style.flexGrow="2",this.styles.forEach(function(Q){var W=document.createElement("div");W.style.display="flex",W.style.alignItems="center",W.style.justifyContent="space-between",W.style.padding="5px",W.style.borderWidth="2px",W.style.borderStyle="solid",W.style.overflow="hidden",W.style.maxWidth=100/y.styles.length-5+"%",W.style.borderColor=Q===y.currentStyle?y.uiStyleSettings.toolboxAccentColor:"transparent",W.addEventListener("click",function(){y.setCurrentStyle(Q,W)}),M.appendChild(W);var me=document.createElement("div");me.style.minHeight="20px",me.style.flexGrow="2",me.style.overflow="hidden";var Ye=` `;me.innerHTML=Ye,W.appendChild(me),y.styleBoxes.push(W)}),M},p.prototype.setCurrentStyle=function(y,M){var Q=this;this.currentStyle=y,this.styleBoxes.forEach(function(W){W.style.borderColor=W===M?Q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},p}(ze),yt=function(F){function p(y,M,Q){var W=F.call(this,y,M,Q)||this;return W.strokeColor=Q.defaultColor,W.strokeWidth=Q.defaultStrokeWidth,W.strokeDasharray=Q.defaultStrokeDasharray,W.strokePanel=new qe("Line color",Q.defaultColorSet,Q.defaultColor),W.strokePanel.onColorChanged=W.setStrokeColor,W.strokeWidthPanel=new Tt("Line width",Q.defaultStrokeWidths,Q.defaultStrokeWidth),W.strokeWidthPanel.onWidthChanged=W.setStrokeWidth,W.strokeStylePanel=new gt("Line style",Q.defaultStrokeDasharrays,Q.defaultStrokeDasharray),W.strokeStylePanel.onStyleChanged=W.setStrokeDasharray,W}return le(p,F),Object.defineProperty(p.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),p.prototype.getState=function(){var y=F.prototype.getState.call(this);return y.typeName=p.typeName,y},p.typeName="FrameMarker",p.title="Frame marker",p.icon='',p}(lt),Oe=function(){this.defaultColorSet=["#EF4444","#10B981","#2563EB","#FFFF00","#7C3AED","#F472B6","#000000","#FFFFFF"],this.defaultColor=this.defaultColorSet[0],this.defaultFillColor=this.defaultColorSet[0],this.defaultStrokeColor=this.defaultColorSet[7],this.defaultHighlightColor=this.defaultColorSet[3],this.defaultStrokeWidth=3,this.defaultStrokeDasharray="",this.defaultHighlightOpacity=.5,this.defaultFontFamily="Helvetica, Arial, sans-serif",this.defaultStrokeWidths=[1,2,3,5,10],this.defaultStrokeDasharrays=["","3","12 3","9 6 3 6"],this.defaultOpacitySteps=[.1,.25,.5,.75,1],this.displayMode="inline",this.defaultFontFamilies=['Times, "Times New Roman", serif',"Helvetica, Arial, sans-serif",'Courier, "Courier New", monospace',"cursive","fantasy"],this.popupMargin=30,this.newFreehandMarkerOnPointerUp=!1,this.defaultColorsFollowCurrentColors=!1,this.freehandPixelRatio=1,this.disableRotation=!1},Pt=function(F){function p(y,M,Q){var W=F.call(this,y,M,Q)||this;return W.x1=0,W.y1=0,W.x2=0,W.y2=0,W.defaultLength=50,W.manipulationStartX=0,W.manipulationStartY=0,W.manipulationStartX1=0,W.manipulationStartY1=0,W.manipulationStartX2=0,W.manipulationStartY2=0,W.setupControlBox(),W}return le(p,F),p.prototype.ownsTarget=function(y){return!!F.prototype.ownsTarget.call(this,y)||!(!this.grip1.ownsTarget(y)&&!this.grip2.ownsTarget(y))},p.prototype.pointerDown=function(y,M){F.prototype.pointerDown.call(this,y,M),this.manipulationStartX=y.x,this.manipulationStartY=y.y,this.state==="new"&&(this.x1=y.x,this.y1=y.y,this.x2=y.x,this.y2=y.y),this.manipulationStartX1=this.x1,this.manipulationStartY1=this.y1,this.manipulationStartX2=this.x2,this.manipulationStartY2=this.y2,this.state!=="new"&&(this.select(),this.grip1.ownsTarget(M)?this.activeGrip=this.grip1:this.grip2.ownsTarget(M)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},p.prototype.pointerUp=function(y){var M=this.state;F.prototype.pointerUp.call(this,y),this.state==="creating"&&Math.abs(this.x1-this.x2)<10&&Math.abs(this.y1-this.y2)<10?(this.x2=this.x1+this.defaultLength,this.adjustVisual(),this.adjustControlBox()):this.manipulate(y),this._state="select",M==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},p.prototype.adjustVisual=function(){},p.prototype.manipulate=function(y){this.state==="creating"?this.resize(y):this.state==="move"?(this.x1=this.manipulationStartX1+y.x-this.manipulationStartX,this.y1=this.manipulationStartY1+y.y-this.manipulationStartY,this.x2=this.manipulationStartX2+y.x-this.manipulationStartX,this.y2=this.manipulationStartY2+y.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(y)},p.prototype.resize=function(y){switch(this.activeGrip){case this.grip1:this.x1=y.x,this.y1=y.y;break;case this.grip2:case void 0:this.x2=y.x,this.y2=y.y}this.adjustVisual(),this.adjustControlBox()},p.prototype.select=function(){F.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},p.prototype.deselect=function(){F.prototype.deselect.call(this),this.controlBox.style.display="none"},p.prototype.setupControlBox=function(){this.controlBox=q.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},p.prototype.adjustControlBox=function(){this.positionGrips()},p.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},p.prototype.createGrip=function(){var y=new ct;return y.visual.transform.baseVal.appendItem(q.createTransform()),this.controlBox.appendChild(y.visual),y},p.prototype.positionGrips=function(){var y=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-y/2,this.y1-y/2),this.positionGrip(this.grip2.visual,this.x2-y/2,this.y2-y/2)},p.prototype.positionGrip=function(y,M,Q){var W=y.transform.baseVal.getItem(0);W.setTranslate(M,Q),y.transform.baseVal.replaceItem(W,0)},p.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},F.prototype.getState.call(this))},p.prototype.restoreState=function(y){F.prototype.restoreState.call(this,y);var M=y;this.x1=M.x1,this.y1=M.y1,this.x2=M.x2,this.y2=M.y2},p.prototype.scale=function(y,M){F.prototype.scale.call(this,y,M),this.x1=this.x1*y,this.y1=this.y1*M,this.x2=this.x2*y,this.y2=this.y2*M,this.adjustVisual(),this.adjustControlBox()},p}(Ge),St=function(F){function p(y,M,Q){var W=F.call(this,y,M,Q)||this;return W.strokeColor="transparent",W.strokeWidth=0,W.strokeDasharray="",W.setStrokeColor=W.setStrokeColor.bind(W),W.setStrokeWidth=W.setStrokeWidth.bind(W),W.setStrokeDasharray=W.setStrokeDasharray.bind(W),W.strokeColor=Q.defaultColor,W.strokeWidth=Q.defaultStrokeWidth,W.strokeDasharray=Q.defaultStrokeDasharray,W.strokePanel=new qe("Line color",Q.defaultColorSet,Q.defaultColor),W.strokePanel.onColorChanged=W.setStrokeColor,W.strokeWidthPanel=new Tt("Line width",Q.defaultStrokeWidths,Q.defaultStrokeWidth),W.strokeWidthPanel.onWidthChanged=W.setStrokeWidth,W.strokeStylePanel=new gt("Line style",Q.defaultStrokeDasharrays,Q.defaultStrokeDasharray),W.strokeStylePanel.onStyleChanged=W.setStrokeDasharray,W}return le(p,F),p.prototype.ownsTarget=function(y){return!(!F.prototype.ownsTarget.call(this,y)&&y!==this.visual&&y!==this.selectorLine&&y!==this.visibleLine)},p.prototype.createVisual=function(){this.visual=q.createGroup(),this.selectorLine=q.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=q.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.visual.appendChild(this.selectorLine),this.visual.appendChild(this.visibleLine),this.addMarkerVisualToContainer(this.visual)},p.prototype.pointerDown=function(y,M){F.prototype.pointerDown.call(this,y,M),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},p.prototype.adjustVisual=function(){this.selectorLine&&this.visibleLine&&(this.selectorLine.setAttribute("x1",this.x1.toString()),this.selectorLine.setAttribute("y1",this.y1.toString()),this.selectorLine.setAttribute("x2",this.x2.toString()),this.selectorLine.setAttribute("y2",this.y2.toString()),this.visibleLine.setAttribute("x1",this.x1.toString()),this.visibleLine.setAttribute("y1",this.y1.toString()),this.visibleLine.setAttribute("x2",this.x2.toString()),this.visibleLine.setAttribute("y2",this.y2.toString()),q.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),q.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),q.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},p.prototype.setStrokeColor=function(y){this.strokeColor=y,this.adjustVisual(),this.colorChanged(y)},p.prototype.setStrokeWidth=function(y){this.strokeWidth=y,this.adjustVisual()},p.prototype.setStrokeDasharray=function(y){this.strokeDasharray=y,this.adjustVisual(),this.stateChanged()},Object.defineProperty(p.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),p.prototype.getState=function(){var y=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},F.prototype.getState.call(this));return y.typeName=p.typeName,y},p.prototype.restoreState=function(y){F.prototype.restoreState.call(this,y);var M=y;this.strokeColor=M.strokeColor,this.strokeWidth=M.strokeWidth,this.strokeDasharray=M.strokeDasharray,this.createVisual(),this.adjustVisual()},p.typeName="LineMarker",p.title="Line marker",p.icon='',p}(Pt),Ue=function(F){function p(y,M,Q,W){var me=F.call(this,y,W||'')||this;return me.fonts=[],me.fontBoxes=[],me.fonts=M,me.currentFont=Q,me.setCurrentFont=me.setCurrentFont.bind(me),me}return le(p,F),p.prototype.getUi=function(){var y=this,M=document.createElement("div");return M.style.overflow="hidden",M.style.flexGrow="2",this.fonts.forEach(function(Q){var W=document.createElement("div");W.style.display="inline-block",W.style.alignItems="center",W.style.justifyContent="space-between",W.style.padding="5px",W.style.borderWidth="2px",W.style.borderStyle="solid",W.style.overflow="hidden",W.style.maxWidth=100/y.fonts.length-5+"%",W.style.borderColor=Q===y.currentFont?y.uiStyleSettings.toolboxAccentColor:"transparent",W.addEventListener("click",function(){y.setCurrentFont(Q,W)}),M.appendChild(W);var me=document.createElement("div");me.style.display="flex",me.style.minHeight="20px",me.style.flexGrow="2",me.style.fontFamily=Q,me.style.overflow="hidden";var Ye=document.createElement("div");Ye.style.whiteSpace="nowrap",Ye.style.overflow="hidden",Ye.style.textOverflow="ellipsis",Ye.innerHTML="The quick brown fox jumps over the lazy dog",me.appendChild(Ye),W.appendChild(me),y.fontBoxes.push(W)}),M},p.prototype.setCurrentFont=function(y,M){var Q=this;this.currentFont=y,this.fontBoxes.forEach(function(W){W.style.borderColor=W===M?Q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},p}(ze),Ze=function(F){function p(y,M,Q){var W=F.call(this,y,M,Q)||this;return W.color="transparent",W.padding=5,W.DEFAULT_TEXT="your text here",W.text=W.DEFAULT_TEXT,W.isMoved=!1,W.color=Q.defaultColor,W.fontFamily=Q.defaultFontFamily,W.defaultSize={x:100,y:30},W.setColor=W.setColor.bind(W),W.setFont=W.setFont.bind(W),W.renderText=W.renderText.bind(W),W.sizeText=W.sizeText.bind(W),W.textEditDivClicked=W.textEditDivClicked.bind(W),W.showTextEditor=W.showTextEditor.bind(W),W.setSize=W.setSize.bind(W),W.positionTextEditor=W.positionTextEditor.bind(W),W.colorPanel=new qe("Color",Q.defaultColorSet,Q.defaultColor),W.colorPanel.onColorChanged=W.setColor,W.fontFamilyPanel=new Ue("Font",Q.defaultFontFamilies,Q.defaultFontFamily),W.fontFamilyPanel.onFontChanged=W.setFont,W}return le(p,F),p.prototype.ownsTarget=function(y){if(F.prototype.ownsTarget.call(this,y)||y===this.visual||y===this.textElement||y===this.bgRectangle)return!0;var M=!1;return this.textElement.childNodes.forEach(function(Q){Q===y&&(M=!0)}),M},p.prototype.createVisual=function(){this.visual=q.createGroup(),this.bgRectangle=q.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=q.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(q.createTransform()),this.textElement.transform.baseVal.appendItem(q.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},p.prototype.pointerDown=function(y,M){F.prototype.pointerDown.call(this,y,M),this.isMoved=!1,this.pointerDownPoint=y,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(y),this._state="creating")},p.prototype.renderText=function(){var y=this;if(this.textElement){for(;this.textElement.lastChild;)this.textElement.removeChild(this.textElement.lastChild);this.text.split(/\r\n|[\n\v\f\r\x85\u2028\u2029]/).forEach(function(M){y.textElement.appendChild(q.createTSpan(M.trim()===""?" ":M.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},p.prototype.getTextScale=function(){var y=this.textElement.getBBox(),M=1;if(y.width>0&&y.height>0){var Q=(1*this.width-this.width*this.padding*2/100)/y.width,W=(1*this.height-this.height*this.padding*2/100)/y.height;M=Math.min(Q,W)}return M},p.prototype.getTextPosition=function(y){var M=this.textElement.getBBox(),Q=0,W=0;return M.width>0&&M.height>0&&(Q=(this.width-M.width*y)/2,W=this.height/2-M.height*y/2),{x:Q,y:W}},p.prototype.sizeText=function(){var y=this.textElement.getBBox(),M=this.getTextScale(),Q=this.getTextPosition(M);Q.y-=y.y*M,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+Q.x+"px, "+Q.y+"px) scale("+M+", "+M+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(Q.x,Q.y),this.textElement.transform.baseVal.getItem(1).setScale(M,M))},p.prototype.manipulate=function(y){F.prototype.manipulate.call(this,y),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(y.x-this.pointerDownPoint.x)>5||Math.abs(y.y-this.pointerDownPoint.y)>5)},p.prototype.resize=function(y){F.prototype.resize.call(this,y),this.isMoved=!0,this.setSize(),this.sizeText()},p.prototype.setSize=function(){F.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(q.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),q.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},p.prototype.pointerUp=function(y){var M=this.state;M==="creating"&&(this._suppressMarkerCreateEvent=!0),F.prototype.pointerUp.call(this,y),this.setSize(),(M==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},p.prototype.showTextEditor=function(){var y=this;this._state="edit",this.overlayContainer.innerHTML="",this.textEditDiv=document.createElement("div"),this.textEditDiv.style.flexGrow="2",this.textEditDiv.style.alignItems="center",this.textEditDiv.style.justifyContent="center",this.textEditDiv.style.pointerEvents="auto",this.textEditDiv.style.overflow="hidden",this.textEditor=document.createElement("div"),this.textEditor.style.position="absolute",this.textEditor.style.fontFamily=this.fontFamily,this.textEditor.style.lineHeight="1em",this.textEditor.innerText=this.text,this.textEditor.contentEditable="true",this.textEditor.style.color=this.color,this.textEditor.style.whiteSpace="pre",this.positionTextEditor(),this.textEditor.addEventListener("pointerup",function(M){M.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var M=Number.parseFloat(y.textEditor.style.fontSize);y.textEditor.clientWidth>=Number.parseInt(y.textEditor.style.maxWidth)&&M>.9;)M-=.1,y.textEditor.style.fontSize=Math.max(M,.9)+"em"}),this.textEditor.addEventListener("keyup",function(M){M.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(M){if(M.clipboardData){var Q=M.clipboardData.getData("text"),W=window.getSelection();if(!W.rangeCount)return!1;W.deleteFromDocument(),W.getRangeAt(0).insertNode(document.createTextNode(Q)),M.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){y.textEditDivClicked(y.textEditor.innerText)}),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},p.prototype.positionTextEditor=function(){if(this.state==="edit")if(this.textEditor===void 0)this.showTextEditor();else{this.textElement.style.display="";var y=this.getTextScale(),M=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),Q=this.textElement.getBBox(),W={x:Q.width*y,y:Q.height*y};M.x-=W.x/2,M.y-=W.y/2,this.textEditor.style.top=M.y+"px",this.textEditor.style.left=M.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-M.x+"px",this.textEditor.style.fontSize=Math.max(16*y,12)+"px",this.textElement.style.display="none"}},p.prototype.textEditDivClicked=function(y){this.text=y.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},p.prototype.select=function(){F.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},p.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),F.prototype.deselect.call(this)},p.prototype.dblClick=function(y,M){F.prototype.dblClick.call(this,y,M),this.showTextEditor()},p.prototype.setColor=function(y){this.textElement&&q.setAttributes(this.textElement,[["fill",y]]),this.color=y,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(y)},p.prototype.setFont=function(y){this.textElement&&q.setAttributes(this.textElement,[["font-family",y]]),this.fontFamily=y,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},p.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},p.prototype.showVisual=function(){this.state==="edit"&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(p.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),p.prototype.getState=function(){var y=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},F.prototype.getState.call(this));return y.typeName=p.typeName,y},p.prototype.restoreState=function(y){var M=y;this.color=M.color,this.fontFamily=M.fontFamily,this.padding=M.padding,this.text=M.text,this.createVisual(),F.prototype.restoreState.call(this,y),this.setSize()},p.prototype.scale=function(y,M){F.prototype.scale.call(this,y,M),this.setSize(),this.sizeText(),this.positionTextEditor()},p.typeName="TextMarker",p.title="Text marker",p.icon='',p}(vt),Ee=function(F){function p(y,M,Q){var W=F.call(this,y,M,Q)||this;return W.color="transparent",W.lineWidth=3,W.drawing=!1,W.pixelRatio=1,W.color=Q.defaultColor,W.lineWidth=Q.defaultStrokeWidth,W.pixelRatio=Q.freehandPixelRatio,W.setColor=W.setColor.bind(W),W.addCanvas=W.addCanvas.bind(W),W.finishCreation=W.finishCreation.bind(W),W.setLineWidth=W.setLineWidth.bind(W),W.colorPanel=new qe("Color",Q.defaultColorSet,Q.defaultColor),W.colorPanel.onColorChanged=W.setColor,W.lineWidthPanel=new Tt("Line width",Q.defaultStrokeWidths,Q.defaultStrokeWidth),W.lineWidthPanel.onWidthChanged=W.setLineWidth,W}return le(p,F),p.prototype.ownsTarget=function(y){return!(!F.prototype.ownsTarget.call(this,y)&&y!==this.visual&&y!==this.drawingImage)},p.prototype.createVisual=function(){this.visual=q.createGroup(),this.drawingImage=q.createImage(),this.visual.appendChild(this.drawingImage);var y=q.createTransform();this.visual.transform.baseVal.appendItem(y),this.addMarkerVisualToContainer(this.visual)},p.prototype.pointerDown=function(y,M){this.state==="new"&&(this.addCanvas(),this.createVisual(),this._state="creating"),this.state==="creating"?(this.canvasContext.strokeStyle=this.color,this.canvasContext.lineWidth=this.lineWidth,this.canvasContext.beginPath(),this.canvasContext.moveTo(y.x,y.y),this.drawing=!0):F.prototype.pointerDown.call(this,y,M)},p.prototype.manipulate=function(y){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(y.x,y.y),this.canvasContext.stroke()):F.prototype.manipulate.call(this,y)},p.prototype.resize=function(y){F.prototype.resize.call(this,y),q.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),q.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},p.prototype.pointerUp=function(y){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):F.prototype.pointerUp.call(this,y)},p.prototype.addCanvas=function(){this.overlayContainer.innerHTML="",this.canvasElement=document.createElement("canvas"),this.canvasElement.width=this.overlayContainer.clientWidth*this.pixelRatio,this.canvasElement.height=this.overlayContainer.clientHeight*this.pixelRatio,this.canvasContext=this.canvasElement.getContext("2d"),this.canvasContext.scale(this.pixelRatio,this.pixelRatio),this.overlayContainer.appendChild(this.canvasElement)},p.prototype.select=function(){this.state==="creating"&&this.finishCreation(),F.prototype.select.call(this)},p.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),F.prototype.deselect.call(this)},p.prototype.finishCreation=function(){for(var y=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),M=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],Q=M[0],W=M[1],me=M[2],Ye=M[3],dt=!1,jt=0;jt0&&(dt=!0,jtYe&&(Ye=jt),Qe>me&&(me=Qe));if(dt){this.left=Q/this.pixelRatio,this.top=W/this.pixelRatio,this.width=(me-Q)/this.pixelRatio,this.height=(Ye-W)/this.pixelRatio;var Vt=document.createElement("canvas");Vt.width=me-Q,Vt.height=Ye-W,Vt.getContext("2d").putImageData(this.canvasContext.getImageData(Q,W,me-Q,Ye-W),0,0),this.drawingImgUrl=Vt.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},p.prototype.setDrawingImage=function(){q.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),q.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},p.prototype.setColor=function(y){this.color=y,this.colorChanged(y)},p.prototype.setLineWidth=function(y){this.lineWidth=y},Object.defineProperty(p.prototype,"toolboxPanels",{get:function(){return this.state==="new"||this.state==="creating"?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),p.prototype.getState=function(){var y=Object.assign({drawingImgUrl:this.drawingImgUrl},F.prototype.getState.call(this));return y.typeName=p.typeName,y},p.prototype.restoreState=function(y){this.createVisual(),F.prototype.restoreState.call(this,y),this.drawingImgUrl=y.drawingImgUrl,this.setDrawingImage()},p.prototype.scale=function(y,M){F.prototype.scale.call(this,y,M),this.setDrawingImage()},p.typeName="FreehandMarker",p.title="Freehand marker",p.icon='',p}(vt),fe=function(F){function p(y,M,Q){var W=F.call(this,y,Q||'')||this;return W.typeBoxes=[],W.currentType=M,W.setCurrentType=W.setCurrentType.bind(W),W}return le(p,F),p.prototype.getUi=function(){var y=this,M=document.createElement("div");M.style.display="flex",M.style.overflow="hidden",M.style.flexGrow="2";for(var Q=function(Ye){var dt="both";switch(Ye){case 0:dt="both";break;case 1:dt="start";break;case 2:dt="end";break;case 3:dt="none"}var jt=document.createElement("div");if(jt.style.display="flex",jt.style.flexGrow="2",jt.style.alignItems="center",jt.style.justifyContent="space-between",jt.style.padding="5px",jt.style.borderWidth="2px",jt.style.borderStyle="solid",jt.style.borderColor=dt===W.currentType?W.uiStyleSettings.toolboxAccentColor:"transparent",jt.addEventListener("click",function(){y.setCurrentType(dt,jt)}),M.appendChild(jt),dt==="both"||dt==="start"){var Qe=document.createElement("div");Qe.style.display="flex",Qe.style.alignItems="center",Qe.style.minHeight="20px",Qe.innerHTML=` `,Qe.style.marginLeft="5px",jt.appendChild(Qe)}var Vt=document.createElement("div");Vt.style.display="flex",Vt.style.alignItems="center",Vt.style.minHeight="20px",Vt.style.flexGrow="2";var hn=document.createElement("hr");if(hn.style.minWidth="20px",hn.style.border="0px",hn.style.borderTop="3px solid "+(W.uiStyleSettings!==void 0?W.uiStyleSettings.toolboxColor:"#eeeeee"),hn.style.flexGrow="2",Vt.appendChild(hn),jt.appendChild(Vt),dt==="both"||dt==="end"){var Rn=document.createElement("div");Rn.style.display="flex",Rn.style.alignItems="center",Rn.style.minHeight="20px",Rn.innerHTML=` `,Rn.style.marginRight="5px",jt.appendChild(Rn)}W.typeBoxes.push(jt)},W=this,me=0;me<4;me++)Q(me);return M},p.prototype.setCurrentType=function(y,M){var Q=this;this.currentType=y,this.typeBoxes.forEach(function(W){W.style.borderColor=W===M?Q.uiStyleSettings!==void 0?Q.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},p}(ze),be=function(F){function p(y,M,Q){var W=F.call(this,y,M,Q)||this;return W.arrowType="end",W.arrowBaseHeight=10,W.arrowBaseWidth=10,W.getArrowPoints=W.getArrowPoints.bind(W),W.setArrowType=W.setArrowType.bind(W),W.arrowTypePanel=new fe("Arrow type","end"),W.arrowTypePanel.onArrowTypeChanged=W.setArrowType,W}return le(p,F),p.prototype.ownsTarget=function(y){return!(!F.prototype.ownsTarget.call(this,y)&&y!==this.arrow1&&y!==this.arrow2)},p.prototype.getArrowPoints=function(y,M){var Q=this.arrowBaseWidth+2*this.strokeWidth,W=this.arrowBaseHeight+2*this.strokeWidth;return y-Q/2+","+(M+W/2)+" "+y+","+(M-W/2)+" "+(y+Q/2)+","+(M+W/2)},p.prototype.createTips=function(){this.arrow1=q.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(q.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=q.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(q.createTransform()),this.visual.appendChild(this.arrow2)},p.prototype.pointerDown=function(y,M){F.prototype.pointerDown.call(this,y,M),this.state==="creating"&&this.createTips()},p.prototype.adjustVisual=function(){if(F.prototype.adjustVisual.call(this),this.arrow1&&this.arrow2&&(this.arrow1.style.display=this.arrowType==="both"||this.arrowType==="start"?"":"none",this.arrow2.style.display=this.arrowType==="both"||this.arrowType==="end"?"":"none",q.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),q.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]),Math.abs(this.x1-this.x2)>.1)){var y=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),M=this.arrow1.transform.baseVal.getItem(0);M.setRotate(y,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(M,0);var Q=this.arrow2.transform.baseVal.getItem(0);Q.setRotate(y+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(Q,0)}},p.prototype.setArrowType=function(y){this.arrowType=y,this.adjustVisual(),this.stateChanged()},Object.defineProperty(p.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),p.prototype.getState=function(){var y=Object.assign({arrowType:this.arrowType},F.prototype.getState.call(this));return y.typeName=p.typeName,y},p.prototype.restoreState=function(y){F.prototype.restoreState.call(this,y);var M=y;this.arrowType=M.arrowType,this.createTips(),this.adjustVisual()},p.typeName="ArrowMarker",p.title="Arrow marker",p.icon='',p}(St),ne=function(F){function p(y,M,Q){var W=F.call(this,y,M,Q)||this;return W.fillColor=Q.defaultFillColor,W.strokeWidth=0,W.fillPanel=new qe("Color",Q.defaultColorSet,Q.defaultFillColor),W.fillPanel.onColorChanged=W.setFillColor,W}return le(p,F),Object.defineProperty(p.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),p.prototype.getState=function(){var y=F.prototype.getState.call(this);return y.typeName=p.typeName,y},p.typeName="CoverMarker",p.title="Cover marker",p.icon='',p}(lt),re=function(F){function p(y,M,Q,W){var me=F.call(this,y,W||'')||this;return me.opacities=[],me.opacityBoxes=[],me.opacities=M,me.currentOpacity=Q,me.setCurrentOpacity=me.setCurrentOpacity.bind(me),me}return le(p,F),p.prototype.getUi=function(){var y=this,M=document.createElement("div");return M.style.display="flex",M.style.overflow="hidden",M.style.flexGrow="2",M.style.justifyContent="space-between",this.opacities.forEach(function(Q){var W=document.createElement("div");W.style.display="flex",W.style.alignItems="center",W.style.justifyContent="center",W.style.padding="5px",W.style.borderWidth="2px",W.style.borderStyle="solid",W.style.borderColor=Q===y.currentOpacity?y.uiStyleSettings.toolboxAccentColor:"transparent",W.addEventListener("click",function(){y.setCurrentOpacity(Q,W)}),M.appendChild(W);var me=document.createElement("div");me.innerText=100*Q+"%",W.appendChild(me),y.opacityBoxes.push(W)}),M},p.prototype.setCurrentOpacity=function(y,M){var Q=this;this.currentOpacity=y,this.opacityBoxes.forEach(function(W){W.style.borderColor=W===M?Q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},p}(ze),ae=function(F){function p(y,M,Q){var W=F.call(this,y,M,Q)||this;return W.setOpacity=W.setOpacity.bind(W),W.fillColor=Q.defaultHighlightColor,W.strokeWidth=0,W.opacity=Q.defaultHighlightOpacity,W.fillPanel=new qe("Color",Q.defaultColorSet,W.fillColor),W.fillPanel.onColorChanged=W.setFillColor,W.opacityPanel=new re("Opacity",Q.defaultOpacitySteps,W.opacity),W.opacityPanel.onOpacityChanged=W.setOpacity,W}return le(p,F),p.prototype.setOpacity=function(y){this.opacity=y,this.visual&&q.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(p.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),p.prototype.getState=function(){var y=F.prototype.getState.call(this);return y.typeName=p.typeName,y},p.typeName="HighlightMarker",p.title="Highlight marker",p.icon='',p}(ne),ce='',ue=function(F){function p(y,M,Q){var W=F.call(this,y,M,Q)||this;return W.bgColor="transparent",W.tipPosition={x:0,y:0},W.tipBase1Position={x:0,y:0},W.tipBase2Position={x:0,y:0},W.tipMoving=!1,W.color=Q.defaultStrokeColor,W.bgColor=Q.defaultFillColor,W.fontFamily=Q.defaultFontFamily,W.defaultSize={x:100,y:30},W.setBgColor=W.setBgColor.bind(W),W.getTipPoints=W.getTipPoints.bind(W),W.positionTip=W.positionTip.bind(W),W.setTipPoints=W.setTipPoints.bind(W),W.colorPanel=new qe("Text color",Q.defaultColorSet,W.color,''),W.colorPanel.onColorChanged=W.setColor,W.bgColorPanel=new qe("Fill color",Q.defaultColorSet,W.bgColor,ce),W.bgColorPanel.onColorChanged=W.setBgColor,W.fontFamilyPanel=new Ue("Font",Q.defaultFontFamilies,Q.defaultFontFamily),W.fontFamilyPanel.onFontChanged=W.setFont,W.tipGrip=new ct,W.tipGrip.visual.transform.baseVal.appendItem(q.createTransform()),W.controlBox.appendChild(W.tipGrip.visual),W}return le(p,F),p.prototype.ownsTarget=function(y){return F.prototype.ownsTarget.call(this,y)||this.tipGrip.ownsTarget(y)||this.tip===y},p.prototype.createTip=function(){q.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=q.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},p.prototype.pointerDown=function(y,M){this.state==="new"&&F.prototype.pointerDown.call(this,y,M),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(M)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):F.prototype.pointerDown.call(this,y,M)},p.prototype.pointerUp=function(y){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,F.prototype.pointerUp.call(this,y);else{var M=this.state==="creating";F.prototype.pointerUp.call(this,y),this.setTipPoints(M),this.positionTip()}},p.prototype.manipulate=function(y){if(this.tipMoving){var M=this.unrotatePoint(y);this.tipPosition={x:M.x-this.manipulationStartLeft,y:M.y-this.manipulationStartTop},this.positionTip()}else F.prototype.manipulate.call(this,y)},p.prototype.setBgColor=function(y){this.bgRectangle&&this.tip&&(q.setAttributes(this.bgRectangle,[["fill",y]]),q.setAttributes(this.tip,[["fill",y]])),this.bgColor=y,this.fillColorChanged(y)},p.prototype.getTipPoints=function(){return this.setTipPoints(this.state==="creating"),this.tipBase1Position.x+","+this.tipBase1Position.y+" "+this.tipBase2Position.x+","+this.tipBase2Position.y+" "+this.tipPosition.x+","+this.tipPosition.y},p.prototype.setTipPoints=function(y){y===void 0&&(y=!1);var M=Math.min(this.height/2,15),Q=this.height/5;y&&(this.tipPosition={x:M+Q/2,y:this.height+20});var W=Math.atan(this.height/2/(this.width/2));this.tipPosition.x=this.width/2&&this.tipPosition.y=this.width/2&&this.tipPosition.y>=this.height/2?W.1)){var y=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),M=this.tip1.transform.baseVal.getItem(0);M.setRotate(y,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(M,0);var Q=this.tip2.transform.baseVal.getItem(0);Q.setRotate(y+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(Q,0)}},Object.defineProperty(p.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),p.prototype.getState=function(){var y=F.prototype.getState.call(this);return y.typeName=p.typeName,y},p.prototype.restoreState=function(y){F.prototype.restoreState.call(this,y),this.createTips(),this.adjustVisual()},p.typeName="MeasurementMarker",p.title="Measurement marker",p.icon='',p}(St),tt=function(F){function p(y,M,Q){var W=F.call(this,y,M,Q)||this;return W.strokePanel.colors=Q.defaultColorSet,W.fillColor="transparent",W}return le(p,F),Object.defineProperty(p.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),p.prototype.getState=function(){var y=F.prototype.getState.call(this);return y.typeName=p.typeName,y},p.typeName="EllipseFrameMarker",p.title="Ellipse frame marker",p.icon='',p}(we),Fe=function(){function F(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(F.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),F.prototype.addUndoStep=function(p){this.undoStack.length!==0&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(p)||(this.undoStack.push(p),JSON.stringify(this.lastRedoStep)!==JSON.stringify(p)&&this.redoStack.splice(0,this.redoStack.length))},F.prototype.replaceLastUndoStep=function(p){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=p)},F.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},F.prototype.undo=function(){if(this.undoStack.length>1){var p=this.undoStack.pop();return p!==void 0&&this.redoStack.push(p),this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0}},F.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},F}(),$e=function(F){function p(y,M,Q){var W=F.call(this,y,M,Q)||this;return W.strokeColor="transparent",W.strokeWidth=0,W.strokeDasharray="",W.curveX=0,W.curveY=0,W.manipulationStartCurveX=0,W.manipulationStartCurveY=0,W.setStrokeColor=W.setStrokeColor.bind(W),W.setStrokeWidth=W.setStrokeWidth.bind(W),W.setStrokeDasharray=W.setStrokeDasharray.bind(W),W.positionGrips=W.positionGrips.bind(W),W.addControlGrips=W.addControlGrips.bind(W),W.adjustVisual=W.adjustVisual.bind(W),W.setupControlBox=W.setupControlBox.bind(W),W.resize=W.resize.bind(W),W.strokeColor=Q.defaultColor,W.strokeWidth=Q.defaultStrokeWidth,W.strokeDasharray=Q.defaultStrokeDasharray,W.strokePanel=new qe("Line color",Q.defaultColorSet,Q.defaultColor),W.strokePanel.onColorChanged=W.setStrokeColor,W.strokeWidthPanel=new Tt("Line width",Q.defaultStrokeWidths,Q.defaultStrokeWidth),W.strokeWidthPanel.onWidthChanged=W.setStrokeWidth,W.strokeStylePanel=new gt("Line style",Q.defaultStrokeDasharrays,Q.defaultStrokeDasharray),W.strokeStylePanel.onStyleChanged=W.setStrokeDasharray,W}return le(p,F),p.prototype.ownsTarget=function(y){return!(!F.prototype.ownsTarget.call(this,y)&&y!==this.visual&&y!==this.selectorCurve&&y!==this.visibleCurve&&!this.curveGrip.ownsTarget(y))},p.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},p.prototype.createVisual=function(){this.visual=q.createGroup(),this.selectorCurve=q.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=q.createPath(this.getPathD(),[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["fill","transparent"]]),this.visual.appendChild(this.selectorCurve),this.visual.appendChild(this.visibleCurve),this.addMarkerVisualToContainer(this.visual)},p.prototype.pointerDown=function(y,M){F.prototype.pointerDown.call(this,y,M),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=y.x,this.curveY=y.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(M)&&(this.activeGrip=this.curveGrip,this._state="resize")},p.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),q.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),q.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),q.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},p.prototype.setupControlBox=function(){F.prototype.setupControlBox.call(this),this.curveControlLine1=q.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=q.createLine(this.x2,this.y2,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.insertBefore(this.curveControlLine1,this.controlBox.firstChild),this.controlBox.insertBefore(this.curveControlLine2,this.controlBox.firstChild)},p.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,F.prototype.addControlGrips.call(this)},p.prototype.positionGrips=function(){F.prototype.positionGrips.call(this);var y=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-y/2,this.curveY-y/2),this.curveControlLine1&&this.curveControlLine2&&(this.curveControlLine1.setAttribute("x1",this.x1.toString()),this.curveControlLine1.setAttribute("y1",this.y1.toString()),this.curveControlLine1.setAttribute("x2",this.curveX.toString()),this.curveControlLine1.setAttribute("y2",this.curveY.toString()),this.curveControlLine2.setAttribute("x1",this.x2.toString()),this.curveControlLine2.setAttribute("y1",this.y2.toString()),this.curveControlLine2.setAttribute("x2",this.curveX.toString()),this.curveControlLine2.setAttribute("y2",this.curveY.toString()))},p.prototype.manipulate=function(y){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+y.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+y.y-this.manipulationStartY),F.prototype.manipulate.call(this,y)},p.prototype.resize=function(y){this.activeGrip===this.curveGrip&&(this.curveX=y.x,this.curveY=y.y),F.prototype.resize.call(this,y),this.state==="creating"&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},p.prototype.setStrokeColor=function(y){this.strokeColor=y,this.adjustVisual(),this.colorChanged(y)},p.prototype.setStrokeWidth=function(y){this.strokeWidth=y,this.adjustVisual()},p.prototype.setStrokeDasharray=function(y){this.strokeDasharray=y,this.adjustVisual()},p.prototype.scale=function(y,M){this.curveX=this.curveX*y,this.curveY=this.curveY*M,F.prototype.scale.call(this,y,M)},Object.defineProperty(p.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),p.prototype.getState=function(){var y=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},F.prototype.getState.call(this));return y.typeName=p.typeName,y},p.prototype.restoreState=function(y){F.prototype.restoreState.call(this,y);var M=y;this.strokeColor=M.strokeColor,this.strokeWidth=M.strokeWidth,this.strokeDasharray=M.strokeDasharray,this.curveX=M.curveX,this.curveY=M.curveY,this.createVisual(),this.adjustVisual()},p.typeName="CurveMarker",p.title="Curve marker",p.icon='',p}(Pt),Dt=function(){function F(p,y){y===void 0&&(y=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=p,this.cancelable=y}return Object.defineProperty(F.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),F.prototype.preventDefault=function(){this._defaultPrevented=!0},F}(),ot=function(F){function p(y,M,Q){var W=F.call(this,y,!1)||this;return W.dataUrl=M,W.state=Q,W}return le(p,F),p}(Dt),ft=function(F){function p(y,M,Q){Q===void 0&&(Q=!1);var W=F.call(this,y,Q)||this;return W.marker=M,W}return le(p,F),p}(Dt),zt=function(){function F(){this.render=[],this.beforeclose=[],this.close=[],this.show=[],this.restorestate=[],this.statechange=[],this.markerselect=[],this.markerdeselect=[],this.markercreating=[],this.markercreate=[],this.markerbeforedelete=[],this.markerdelete=[],this.markerchange=[],this.focus=[],this.blur=[]}return F.prototype.addEventListener=function(p,y){this[p].push(y)},F.prototype.removeEventListener=function(p,y){var M=this[p].indexOf(y);M>-1&&this[p].splice(M,1)},F}(),Je=function(){function F(p){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new Oe,this._isOpen=!1,this.undoRedoManager=new Fe,this.renderAtNaturalSize=!1,this.renderImageType="image/png",this.renderMarkersOnly=!1,this.zoomSteps=[1,1.5,2,4],this._zoomLevel=1,this._isResizing=!1,this.prevPanPoint={x:0,y:0},this.eventListeners=new zt,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=F.instanceCounter++,this.styles=new De(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=p,this.targetRoot=document.body,this.width=p.clientWidth,this.height=p.clientHeight,this.styles.removeStyleSheet(),this.open=this.open.bind(this),this.setTopLeft=this.setTopLeft.bind(this),this.toolbarButtonClicked=this.toolbarButtonClicked.bind(this),this.createNewMarker=this.createNewMarker.bind(this),this.addNewMarker=this.addNewMarker.bind(this),this.markerCreated=this.markerCreated.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onDblClick=this.onDblClick.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.onPointerOut=this.onPointerOut.bind(this),this.onKeyUp=this.onKeyUp.bind(this),this.overrideOverflow=this.overrideOverflow.bind(this),this.restoreOverflow=this.restoreOverflow.bind(this),this.close=this.close.bind(this),this.closeUI=this.closeUI.bind(this),this.addCloseEventListener=this.addCloseEventListener.bind(this),this.removeCloseEventListener=this.removeCloseEventListener.bind(this),this.addRenderEventListener=this.addRenderEventListener.bind(this),this.removeRenderEventListener=this.removeRenderEventListener.bind(this),this.clientToLocalCoordinates=this.clientToLocalCoordinates.bind(this),this.onWindowResize=this.onWindowResize.bind(this),this.deleteSelectedMarker=this.deleteSelectedMarker.bind(this),this.setWindowHeight=this.setWindowHeight.bind(this),this.removeMarker=this.removeMarker.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this),this.onPopupTargetResize=this.onPopupTargetResize.bind(this),this.showNotesEditor=this.showNotesEditor.bind(this),this.hideNotesEditor=this.hideNotesEditor.bind(this),this.stepZoom=this.stepZoom.bind(this),this.focus=this.focus.bind(this),this.blur=this.blur.bind(this),this.markerStateChanged=this.markerStateChanged.bind(this),this.switchToSelectMode=this.switchToSelectMode.bind(this),this.addDefs=this.addDefs.bind(this),this.addDefsToImage=this.addDefsToImage.bind(this)}return Object.defineProperty(F.prototype,"ALL_MARKER_TYPES",{get:function(){return[yt,Ee,be,Ze,tt,we,ae,ue,Le,ne,St,$e]},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[yt,Ee,be,Ze,we,ae,ue]},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"BASIC_MARKER_TYPES",{get:function(){return[yt,Ee,be,Ze,ae]},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(p){var y=this;this._availableMarkerTypes.splice(0),p.forEach(function(M){if(typeof M=="string"){var Q=y.ALL_MARKER_TYPES.find(function(W){return W.typeName===M});Q!==void 0&&y._availableMarkerTypes.push(Q)}else y._availableMarkerTypes.push(M)})},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"zoomLevel",{get:function(){return this._zoomLevel},set:function(p){this._zoomLevel=p,this.editorCanvas&&this.contentDiv&&(this.editorCanvas.style.transform="scale("+this._zoomLevel+")",this.contentDiv.scrollTo({left:(this.editorCanvas.clientWidth*this._zoomLevel-this.contentDiv.clientWidth)/2,top:(this.editorCanvas.clientHeight*this._zoomLevel-this.contentDiv.clientHeight)/2}))},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),F.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),this.settings.displayMode==="popup"&&this.onPopupTargetResize(),xe.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},F.prototype.show=function(){var p=this;this.styles.styleSheetRoot===void 0&&Ne.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=Ne.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(y){return y(new Dt(p))})},F.prototype.render=function(){return se(this,void 0,void 0,function(){var p;return ve(this,function(y){switch(y.label){case 0:return this.setCurrentMarker(),(p=new Ie).naturalSize=this.renderAtNaturalSize,p.imageType=this.renderImageType,p.imageQuality=this.renderImageQuality,p.markersOnly=this.renderMarkersOnly,p.width=this.renderWidth,p.height=this.renderHeight,[4,p.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return y.sent(),[4,p.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,y.sent()]}})})},F.prototype.close=function(p){var y=this;if(p===void 0&&(p=!1),this.isOpen){var M=!1;p||this.eventListeners.beforeclose.forEach(function(Q){var W=new Dt(y,!0);Q(W),W.defaultPrevented&&(M=!0)}),M||(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.settings.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),this.eventListeners.close.forEach(function(Q){return Q(new Dt(y))}),this.detachEvents(),this._isOpen=!1)}},F.prototype.addMarkersToToolbar=function(){for(var p,y=[],M=0;Mthis.editorCanvas.clientHeight?this.editorCanvas.clientHeight*p:this.editorCanvas.clientWidth,M=y',p.title="Powered by marker.js",p.style.display="grid",p.style.alignItems="center",p.style.justifyItems="center",p.style.padding="3px",p.style.width="20px",p.style.height="20px",this.logoUI.appendChild(p),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},F.prototype.positionLogo=function(){this.logoUI&&(this.uiStyleSettings.logoPosition!=="right"?this.logoUI.style.left=this.markerImageHolder.offsetLeft+10+"px":this.logoUI.style.left=this.markerImageHolder.offsetLeft+this.markerImageHolder.offsetWidth-this.logoUI.clientWidth-10+"px",this.logoUI.style.top=this.markerImageHolder.offsetTop+this.markerImageHolder.offsetHeight-this.logoUI.clientHeight-10+"px")},F.prototype.overrideOverflow=function(){this.scrollXState=window.scrollX,this.scrollYState=window.scrollY,this.bodyOverflowState=document.body.style.overflow,window.scroll({top:0,left:0}),document.body.style.overflow="hidden"},F.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},F.prototype.showUI=function(){switch(this.settings.displayMode==="popup"&&this.overrideOverflow(),this.coverDiv=document.createElement("div"),this.coverDiv.style.visibility=this._silentRenderMode?"hidden":"visible",this.coverDiv.className=this.styles.classNamePrefixBase+" "+this.styles.classNamePrefix,this.coverDiv.style.fontSize="16px",this.coverDiv.style.userSelect="none",this.settings.displayMode){case"inline":this.coverDiv.style.position="absolute";var p=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=p+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px",this.coverDiv.style.width=this.target.offsetWidth.toString()+"px",this.coverDiv.style.zIndex=this.uiStyleSettings.zIndex!==void 0?this.uiStyleSettings.zIndex:"5";break;case"popup":this.coverDiv.style.position="absolute",this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=window.innerHeight+"px",this.coverDiv.style.backgroundColor="rgba(0, 0, 0, 0.75)",this.coverDiv.style.zIndex=this.uiStyleSettings.zIndex!==void 0?this.uiStyleSettings.zIndex:"1000",this.coverDiv.style.display="flex"}this.targetRoot.appendChild(this.coverDiv),this.uiDiv=document.createElement("div"),this.uiDiv.style.display="flex",this.uiDiv.style.flexDirection="column",this.uiDiv.style.flexGrow="2",this.uiDiv.style.margin=this.settings.displayMode==="popup"?this.settings.popupMargin+"px":"0px",this.uiDiv.style.border="0px",this.coverDiv.appendChild(this.uiDiv),this.toolbar=new Pe(this.uiDiv,this.settings.displayMode,this._availableMarkerTypes,this.uiStyleSettings,this.styles),this.toolbar.addButtonClickListener(this.toolbarButtonClicked),this.toolbar.show(this._silentRenderMode||this.uiStyleSettings.hideToolbar?"hidden":"visible"),this.contentDiv=document.createElement("div"),this.contentDiv.style.display="flex",this.contentDiv.style.flexDirection="row",this.contentDiv.style.flexGrow="2",this.contentDiv.style.flexShrink="1",this.settings.displayMode==="popup"&&(this.contentDiv.style.backgroundColor=this.uiStyleSettings.canvasBackgroundColor,this.contentDiv.style.maxHeight=this.windowHeight-2*this.settings.popupMargin-3.5*this.uiStyleSettings.toolbarHeight+"px",this.contentDiv.style.maxWidth="calc(100vw - "+2*this.settings.popupMargin+"px)"),this.contentDiv.style.overflow="auto",this.uiDiv.appendChild(this.contentDiv),this.editorCanvas=document.createElement("div"),this.editorCanvas.style.flexGrow="2",this.editorCanvas.style.flexShrink="1",this.editorCanvas.style.position="relative",this.editorCanvas.style.overflow="hidden",this.editorCanvas.style.display="flex",this.settings.displayMode==="popup"&&(this.editorCanvas.style.alignItems="center",this.editorCanvas.style.justifyContent="center"),this.editorCanvas.style.pointerEvents="none",this.editorCanvas.style.transformOrigin="left top",this.editorCanvas.style.transform="scale("+this.zoomLevel+")",this.contentDiv.appendChild(this.editorCanvas),this.editingTarget=this.target instanceof HTMLImageElement?document.createElement("img"):document.createElement("canvas"),this.target.getClientRects().item(0).y-1&&this.markers.splice(this.markers.indexOf(p),1),p.dispose()},F.prototype.switchToSelectMode=function(){this.mode="select",this.hideNotesEditor(),this._currentMarker!==void 0&&(this._currentMarker.state!=="new"?this._currentMarker.select():(this.removeMarker(this._currentMarker),this.setCurrentMarker(),this.markerImage.style.cursor="default"),this.addUndoStep())},F.prototype.toolbarButtonClicked=function(p,y){if(p==="marker"&&y!==void 0)this.createNewMarker(y);else if(p==="action")switch(y){case"select":this.switchToSelectMode(),this.switchToSelectMode();break;case"delete":this.deleteSelectedMarker();break;case"clear":this.clear();break;case"undo":this.undo();break;case"redo":this.redo();break;case"zoom":this.stepZoom();break;case"zoom-out":this.zoomLevel=1;break;case"notes":this.notesArea===void 0?(this.switchToSelectMode(),this.zoomLevel=1,this.showNotesEditor()):this.switchToSelectMode();break;case"close":this.close();break;case"render":this.switchToSelectMode(),this.startRenderAndClose()}},F.prototype.deleteSelectedMarker=function(){var p=this;if(this._currentMarker!==void 0){var y=!1;if(this.eventListeners.markerbeforedelete.forEach(function(Q){var W=new ft(p,p._currentMarker,!0);Q(W),W.defaultPrevented&&(y=!0)}),!y){var M=this._currentMarker;this._currentMarker.dispose(),this.markerImage.removeChild(this._currentMarker.container),this.markers.splice(this.markers.indexOf(this._currentMarker),1),this.setCurrentMarker(),this.addUndoStep(),this.eventListeners.markerdelete.forEach(function(Q){return Q(new ft(p,M))})}}},F.prototype.clear=function(){var p=this,y=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(me){var Ye=new ft(p,void 0,!0);me(Ye),Ye.defaultPrevented&&(y=!0)}),!y)){this.setCurrentMarker();for(var M=function(me){var Ye=Q.markers[me];Q.setCurrentMarker(Q.markers[me]),Q._currentMarker.dispose(),Q.markerImage.removeChild(Q._currentMarker.container),Q.markers.splice(Q.markers.indexOf(Q._currentMarker),1),Q.eventListeners.markerdelete.forEach(function(dt){return dt(new ft(p,Ye))})},Q=this,W=this.markers.length-1;W>=0;W--)M(W);this.addUndoStep()}},Object.defineProperty(F.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),F.prototype.showNotesEditor=function(){var p;this._currentMarker!==void 0&&(this.overlayContainer.innerHTML="",this.notesArea=document.createElement("textarea"),this.notesArea.className=this.uiStyleSettings.notesAreaStyleClassName,this.notesArea.style.pointerEvents="auto",this.notesArea.style.alignSelf="stretch",this.notesArea.style.width="100%",this.notesArea.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.notesArea.value=(p=this._currentMarker.notes)!==null&&p!==void 0?p:"",this.overlayContainer.appendChild(this.notesArea))},F.prototype.hideNotesEditor=function(){this.isNotesAreaOpen&&(this._currentMarker!==void 0&&(this._currentMarker.notes=this.notesArea.value.trim()!==""?this.notesArea.value:void 0),this.overlayContainer.removeChild(this.notesArea),this.notesArea=void 0)},F.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},F.prototype.addUndoStep=function(){var p=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var y=this.getState(),M=this.undoRedoManager.getLastUndoStep();if(!M||M.width===y.width&&M.height===y.height){var Q=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(y),Q1&&this.panTo({x:p.clientX,y:p.clientY}))},F.prototype.onPointerUp=function(p){this.touchPoints>0&&this.touchPoints--,this.touchPoints===0&&this.isDragging&&this._currentMarker!==void 0&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(p.clientX,p.clientY)),this.isDragging=!1,this.addUndoStep()},F.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},F.prototype.onKeyUp=function(p){this._currentMarker===void 0||this.notesArea!==void 0||p.key!=="Delete"&&p.key!=="Backspace"||this.deleteSelectedMarker()},F.prototype.clientToLocalCoordinates=function(p,y){var M=this.markerImage.getBoundingClientRect();return{x:(p-M.left)/this.zoomLevel,y:(y-M.top)/this.zoomLevel}},F.prototype.onWindowResize=function(){this.positionUI()},F.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var p=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=p+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px";break;case"popup":this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=this.windowHeight+"px",this.contentDiv.style.maxHeight=this.windowHeight-2*this.settings.popupMargin-3.5*this.styles.settings.toolbarHeight+"px"}this.positionMarkerImage(),this.positionLogo()},F.prototype.addLicenseKey=function(p){xe.addKey(p)},F.prototype.addEventListener=function(p,y){this.eventListeners.addEventListener(p,y)},F.prototype.removeEventListener=function(p,y){this.eventListeners.removeEventListener(p,y)},F.prototype.renderState=function(p){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(p),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(F.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),F.prototype.focus=function(){var p=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,this._previousCurrentMarker!==void 0&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach(function(y){return y(new Dt(p))}))},F.prototype.blur=function(){var p=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(y){return y(new Dt(p))}))},F.instanceCounter=0,F}();/* ********************************** cropro version 1.2.0 @license SEE LICENSE IN LICENSE copyright Alan Mendelevich see README and LICENSE for details ********************************** *//*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */var Kt=function(F,p){return(Kt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(y,M){y.__proto__=M}||function(y,M){for(var Q in M)Object.prototype.hasOwnProperty.call(M,Q)&&(y[Q]=M[Q])})(F,p)};function sn(F,p){if(typeof p!="function"&&p!==null)throw new TypeError("Class extends value "+String(p)+" is not a constructor or null");function y(){this.constructor=F}Kt(F,p),F.prototype=p===null?Object.create(p):(y.prototype=p.prototype,new y)}function Bt(F,p,y,M){return new(y||(y=Promise))(function(Q,W){function me(jt){try{dt(M.next(jt))}catch(Qe){W(Qe)}}function Ye(jt){try{dt(M.throw(jt))}catch(Qe){W(Qe)}}function dt(jt){var Qe;jt.done?Q(jt.value):(Qe=jt.value,Qe instanceof y?Qe:new y(function(Vt){Vt(Qe)})).then(me,Ye)}dt((M=M.apply(F,p||[])).next())})}function an(F,p){var y,M,Q,W,me={label:0,sent:function(){if(1&Q[0])throw Q[1];return Q[1]},trys:[],ops:[]};return W={next:Ye(0),throw:Ye(1),return:Ye(2)},typeof Symbol=="function"&&(W[Symbol.iterator]=function(){return this}),W;function Ye(dt){return function(jt){return function(Qe){if(y)throw new TypeError("Generator is already executing.");for(;me;)try{if(y=1,M&&(Q=2&Qe[0]?M.return:Qe[0]?M.throw||((Q=M.return)&&Q.call(M),0):M.next)&&!(Q=Q.call(M,Qe[1])).done)return Q;switch(M=0,Q&&(Qe=[2&Qe[0],Q.value]),Qe[0]){case 0:case 1:Q=Qe;break;case 4:return me.label++,{value:Qe[1],done:!1};case 5:me.label++,M=Qe[1],Qe=[0];continue;case 7:Qe=me.ops.pop(),me.trys.pop();continue;default:if(!(Q=me.trys,(Q=Q.length>0&&Q[Q.length-1])||Qe[0]!==6&&Qe[0]!==2)){me=0;continue}if(Qe[0]===3&&(!Q||Qe[1]>Q[0]&&Qe[1]0&&y>0){var M=new ln(p,y),Q=M.ratio>=1?20:M.getHorizontalLength(20),W=M.ratio<1?20:M.getVerticalLength(20),me=document.createElementNS("http://www.w3.org/2000/svg","svg");me.setAttribute("xmlns","http://www.w3.org/2000/svg"),me.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(me);var Ye=it.createDefs();me.appendChild(Ye);var dt=it.createElement("clipPath",[["id","text-bg-clip"]]);Ye.appendChild(dt);var jt=it.createPath(it.getHollowRectanglePath((24-Q)/2,(24-W)/2,Q,W,(24-Q)/2+2,(24-W)/2+2,Q-4,W-4));me.appendChild(jt);var Qe=it.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);Qe.appendChild(it.createTSpan(p+":"+y)),me.appendChild(Qe);var Vt=Qe.getBBox();it.setAttributes(Qe,[["x",((24-Vt.width)/2).toString()],["y",((24-Vt.height)/2-Vt.y).toString()]]);var hn=it.createPath(it.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(Vt.width))/2,(24-Math.ceil(Vt.height))/2,Math.ceil(Vt.width),Math.ceil(Vt.height)));return dt.appendChild(hn),it.setAttributes(jt,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(me),me.outerHTML}return''},F}(),cn=function(F){function p(y,M,Q){var W=F.call(this,y,M)||this;return W.isDropdownOpen=!1,W.onClick=W.dropdownButtonClicked,W.dropdownButtons=Q,W}return sn(p,F),p.prototype.setupDropdown=function(){var y=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(M){M.className=y.className,M.colorsClassName=y.colorsClassName,y.dropdownBlock.appendChild(M.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},p.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},p.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},p.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},p.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},p.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},p}(at),qt=function(){function F(p,y){this.GRIP_SIZE=10,this.color=p,this.fillColor=y,this.visual=it.createGroup(),this.visual.appendChild(it.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(it.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return F.prototype.ownsTarget=function(p){return p===this.visual||p===this.visual.childNodes[0]||p===this.visual.childNodes[1]},F.prototype.setCenter=function(p,y){this.visual.childNodes.forEach(function(M){return it.setAttributes(M,[["cx",p.toString()],["cy",y.toString()]])})},F}(),En=function(){function F(p,y,M,Q){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=p,this.canvasHeight=y,this.margin=M,this.container=Q,this.attachEvents=this.attachEvents.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.resize=this.resize.bind(this),this.adjustCropRect=this.adjustCropRect.bind(this),this.scaleCanvas=this.scaleCanvas.bind(this),this.getRescaledRect=this.getRescaledRect.bind(this)}return Object.defineProperty(F.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(p){this._aspectRatio=p,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(p){this._isGridVisible=p,this.gridContainer&&it.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(p){this._zoomFactor=p,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),F.prototype.open=function(){var p=this;this.cropShadeElement=it.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=it.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var y=0;ythis.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-y.height/2),it.setAttributes(this.cropRectElement,[["x",y.x.toString()],["y",y.y.toString()],["width",y.width.toString()],["height",y.height.toString()]]);var M=y.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(W,me){var Ye=y.y+M*(me+1);it.setAttributes(W,[["x1",""+y.x],["y1",""+Ye],["x2",""+(y.x+y.width)],["y2",""+Ye]])});var Q=y.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(W,me){var Ye=y.x+Q*(me+1);it.setAttributes(W,[["x1",""+Ye],["y1",""+y.y],["x2",""+Ye],["y2",""+(y.y+y.height)]])}),it.setAttributes(this.cropShadeElement,[["d",it.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,y.x,y.y,y.width,y.height)]]),this.topLeftGrip.setCenter(y.x,y.y),this.topRightGrip.setCenter(y.x+y.width,y.y),this.bottomLeftGrip.setCenter(y.x,y.y+y.height),this.bottomRightGrip.setCenter(y.x+y.width,y.y+y.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},F.prototype.attachEvents=function(){this.container.style.touchAction="none",this.container.addEventListener("pointerdown",this.onPointerDown),this.container.addEventListener("pointermove",this.onPointerMove),this.container.addEventListener("pointerup",this.onPointerUp)},F.prototype.clientToLocalCoordinates=function(p,y){var M=this.container.getBoundingClientRect();return{x:p-M.left+this.margin,y:y-M.top+this.margin}},F.prototype.onPointerDown=function(p){this.container.setPointerCapture(p.pointerId),this.previousPoint=this.clientToLocalCoordinates(p.clientX,p.clientY),this.cropRectElement===p.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(p.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(p.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(p.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(p.target)&&(this.activeGrip=this.bottomRightGrip)},F.prototype.onPointerMove=function(p){if(this.isMoving)this.move(this.clientToLocalCoordinates(p.clientX,p.clientY));else if(this.activeGrip){var y=this.clientToLocalCoordinates(p.clientX,p.clientY);this.resize(y)}p.preventDefault()},F.prototype.onPointerUp=function(p){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(p.pointerId)},F.prototype.move=function(p){var y=p.x-this.previousPoint.x,M=p.y-this.previousPoint.y;this.zoomFactor!==1&&(y=-y/this.zoomFactor,M=-M/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+y),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+M),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=p},F.prototype.resize=function(p){var y=Object.assign({},this.cropRect),M=p.x-this.previousPoint.x,Q=p.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:y.x+Mthis.canvasWidth*this.zoomFactor&&(M=this.canvasWidth*this.zoomFactor-y.width),y.width+=M}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(y.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(M),y.height=this.aspectRatio.getVerticalLength(y.width)):(y.y+=Q,y.height=this.cropRect.y+this.cropRect.height-y.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?y.height=this.aspectRatio.getVerticalLength(y.width):y.height+=Q}y.width<10&&(y.x=this.cropRect.x,y.width=10),y.height<10&&(y.y=this.cropRect.y,y.height=10),this.previousPoint=p,y.x>=this.margin&&y.y>=this.margin&&y.x-this.margin+y.width<=this.canvasWidth&&y.y-this.margin+y.height<=this.canvasHeight&&(this.cropRect=y,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},F.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var p=this.cropRect.x+this.cropRect.width/2,y=this.cropRect.y+this.cropRect.height/2,M=this.aspectRatio.getHorizontalLength(this.cropRect.height),Q=this.aspectRatio.getVerticalLength(this.cropRect.width);M/this.canvasWidththis.canvasWidth&&(this.cropRect.height/=this.cropRect.width/this.canvasWidth,this.cropRect.width=this.canvasWidth),this.cropRect.height>this.canvasHeight&&(this.cropRect.width/=this.cropRect.height/this.canvasHeight,this.cropRect.height=this.canvasHeight),this.cropRect.x=p-this.cropRect.width/2,this.cropRect.y=y-this.cropRect.height/2,this.cropRect.x+this.cropRect.width>this.margin+this.canvasWidth&&(this.cropRect.x=this.margin+this.canvasWidth-this.cropRect.width),this.cropRect.y+this.cropRect.height>this.margin+this.canvasHeight&&(this.cropRect.y=this.margin+this.canvasHeight-this.cropRect.height),this.cropRect.x=Math.max(this.cropRect.x,this.margin),this.cropRect.y=Math.max(this.cropRect.y,this.margin)}},F.prototype.getRescaledRect=function(p,y,M,Q,W,me){var Ye=M/p,dt=Q/y;return{x:(W.x-me)*Ye+me,y:(W.y-me)*dt+me,width:W.width*Ye,height:W.height*dt}},F.prototype.scaleCanvas=function(p,y){var M=this.getRescaledRect(this.canvasWidth,this.canvasHeight,p,y,this.cropRect,this.margin);this.canvasWidth=p,this.canvasHeight=y,this.onCropChange&&this.onCropChange(M),this.setCropRectangle(M)},F}(),on=function(){function F(p){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=p,this.uiContainer=document.createElement("div"),this.getUI=this.getUI.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.setAngleLabel=this.setAngleLabel.bind(this),this.positionScaleShape=this.positionScaleShape.bind(this)}return Object.defineProperty(F.prototype,"angle",{get:function(){return this._angle},set:function(p){this._angle=p,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),F.prototype.getUI=function(){return this.controlContainer=document.createElement("div"),this.controlContainer.title=this.title,this.controlContainer.className=this.className+" "+this.colorsClassName,this.controlContainer.appendChild(this.getVisual()),this.controlContainer.addEventListener("pointerdown",this.onPointerDown),this.controlContainer.addEventListener("pointermove",this.onPointerMove),this.controlContainer.addEventListener("pointerup",this.onPointerUp),this.uiContainer.appendChild(this.controlContainer),this.uiContainer.style.display="inline-block",this.uiContainer.style.touchAction="none",this.setAngleLabel(),this.positionScaleShape(),this.uiContainer},F.prototype.onPointerDown=function(p){this.controlContainer.setPointerCapture(p.pointerId),this.isDragging=!0,this.previousPoint={x:p.clientX,y:p.clientY}},F.prototype.onPointerMove=function(p){this.isDragging&&(this.onAngleChange&&this.onAngleChange((p.clientX-this.previousPoint.x)/5),this.previousPoint.x=p.clientX)},F.prototype.onPointerUp=function(p){this.isDragging&&this.onAngleChange&&this.onAngleChange((p.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(p.pointerId)},F.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var p=this.angleLabelText.getBBox();it.setAttributes(this.angleLabelElement,[["x",((this.width-p.width)/2).toString()],["y",(this.height/2).toString()]])}},F.prototype.positionScaleShape=function(){if(this.scaleShape){var p=this.scaleShape.transform.baseVal.getItem(0);p.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(p,0)}},F.prototype.getVisual=function(){var p=document.createElementNS("http://www.w3.org/2000/svg","svg");p.setAttribute("xmlns","http://www.w3.org/2000/svg"),p.setAttribute("width",this.width+"px"),p.setAttribute("height",this.height+"px"),p.setAttribute("viewBox","0 0 "+this.width+" "+this.height),p.style.flexShrink="0",document.body.appendChild(p);for(var y="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,M=1;M<=this.width/5+10;M++){var Q=M%5==0?this.height/3:this.height/6;y+="h4v"+-Q+"h1v"+Q}y+="v1H0Z",this.scaleShape=it.createPath(y);var W=it.createTransform();this.scaleShape.transform.baseVal.appendItem(W),p.appendChild(this.scaleShape),this.angleLabelElement=it.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=it.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var me=it.createTSpan("");return me.innerHTML="°",this.angleLabelElement.appendChild(me),p.appendChild(this.angleLabelElement),document.body.removeChild(p),p},F}(),ht=function(){function F(){this.naturalSize=!1,this.imageType="image/png"}return F.prototype.rasterize=function(p,y,M,Q,W,me,Ye){var dt=this;return new Promise(function(jt){var Qe=document.createElement("canvas");Qe.width=p.width.baseVal.value-2*Q,Qe.height=p.height.baseVal.value-2*Q;var Vt=1,hn=1;dt.naturalSize===!0?(Vt=y.naturalWidth/(p.width.baseVal.value-2*Q)/me,hn=y.naturalHeight/(p.height.baseVal.value-2*Q)/Ye,Qe.width=y.naturalWidth/me,Qe.height=y.naturalHeight/Ye):dt.width!==void 0&&dt.height!==void 0&&(Vt=dt.width/M.width,hn=dt.height/M.height,Qe.width*=Vt,Qe.height*=hn);var Rn=Qe.getContext("2d");Rn.translate(Qe.width/2,Qe.height/2),Rn.rotate(W*Math.PI/180),Rn.scale(me,Ye),Rn.translate(-Qe.width/2,-Qe.height/2),Rn.drawImage(y,0,0,Qe.width,Qe.height);var pr=document.createElement("canvas");pr.width=M.width*Vt,pr.height=M.height*hn,pr.getContext("2d").putImageData(Rn.getImageData((M.x-Q)*Vt,(M.y-Q)*hn,M.width*Vt,M.height*hn),0,0),jt(pr.toDataURL(dt.imageType,dt.imageQuality))})},F}(),Ke=function(){function F(p){this._zoomToCropEnabled=!0,this.zoomFactor=1,this.flippedHorizontally=!1,this.flippedVertically=!1,this._isGridVisible=!0,this._gridLines=2,this._rotationAngle=0,this.scaleFactor=1,this.renderEventListeners=[],this.closeEventListeners=[],this._isOpen=!1,this.CANVAS_MARGIN=20,this.renderAtNaturalSize=!1,this.renderImageType="image/png",this.displayMode="inline",this.popupMargin=30,this.toolbarHeight=40,this.aspectRatios=[{horizontal:0,vertical:0},{horizontal:4,vertical:3},{horizontal:3,vertical:2},{horizontal:16,vertical:9},{horizontal:1,vertical:1},{horizontal:3,vertical:4},{horizontal:2,vertical:3},{horizontal:9,vertical:16}],this._instanceNo=F.instanceCounter++,this.styles=new Ft(this.instanceNo),this.target=p,this.targetRoot=document.body,this.open=this.open.bind(this),this.setTopLeft=this.setTopLeft.bind(this),this.overrideOverflow=this.overrideOverflow.bind(this),this.restoreOverflow=this.restoreOverflow.bind(this),this.close=this.close.bind(this),this.closeUI=this.closeUI.bind(this),this.addCloseEventListener=this.addCloseEventListener.bind(this),this.removeCloseEventListener=this.removeCloseEventListener.bind(this),this.addRenderEventListener=this.addRenderEventListener.bind(this),this.removeRenderEventListener=this.removeRenderEventListener.bind(this),this.clientToLocalCoordinates=this.clientToLocalCoordinates.bind(this),this.onWindowResize=this.onWindowResize.bind(this),this.setWindowHeight=this.setWindowHeight.bind(this),this.rotateBy=this.rotateBy.bind(this),this.applyRotation=this.applyRotation.bind(this),this.cropRectChanged=this.cropRectChanged.bind(this),this.zoomToCrop=this.zoomToCrop.bind(this),this.unzoomFromCrop=this.unzoomFromCrop.bind(this),this.rotateLeftButtonClicked=this.rotateLeftButtonClicked.bind(this),this.rotateRightButtonClicked=this.rotateRightButtonClicked.bind(this),this.flipHorizontallyButtonClicked=this.flipHorizontallyButtonClicked.bind(this),this.flipVerticallyButtonClicked=this.flipVerticallyButtonClicked.bind(this),this.applyFlip=this.applyFlip.bind(this),this.startRenderAndClose=this.startRenderAndClose.bind(this),this.render=this.render.bind(this),this.onPopupResize=this.onPopupResize.bind(this),this.applyAspectRatio=this.applyAspectRatio.bind(this)}return Object.defineProperty(F.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(p){this._zoomToCropEnabled=p,p?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(p){this._isGridVisible=p,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"gridLines",{get:function(){return this._gridLines},set:function(p){this._gridLines=p,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(p){this._rotationAngle=p,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"aspectRatio",{get:function(){var p;return(p=this._aspectRatio)!==null&&p!==void 0?p:this.aspectRatios[0]},set:function(p){this._aspectRatio=p},enumerable:!1,configurable:!0}),F.prototype.open=function(){this.imageWidth=Math.round(this.target.clientWidth),this.imageHeight=Math.round(this.target.clientHeight),this.setupResizeObserver(),this.initCropCanvas(),this.setEditingTarget(),this.setTopLeft(),this.initCropLayer(),this.attachEvents(),this.applyAspectRatio(),this.displayMode==="popup"&&this.onPopupResize(),this._isOpen=!0},F.prototype.show=function(){this.showUI(),this.open()},F.prototype.close=function(p){p===void 0&&(p=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),p||this.closeEventListeners.forEach(function(y){return y()}),this._isOpen=!1)},F.prototype.addRenderEventListener=function(p){this.renderEventListeners.push(p)},F.prototype.removeRenderEventListener=function(p){this.renderEventListeners.indexOf(p)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(p),1)},F.prototype.addCloseEventListener=function(p){this.closeEventListeners.push(p)},F.prototype.removeCloseEventListener=function(p){this.closeEventListeners.indexOf(p)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(p),1)},F.prototype.setupResizeObserver=function(){var p=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){p.resize(p.target.clientWidth,p.target.clientHeight)}),this.targetObserver.observe(this.target)):this.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(this.onPopupResize),this.targetObserver.observe(this.contentDiv)),window.addEventListener("resize",this.setWindowHeight))},F.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var p=1*this.target.clientWidth/this.target.clientHeight,y=this.contentDiv.clientWidth/p>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*p:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,M=y+2*this.CANVAS_MARGINp+this.CANVAS_MARGIN?this.target.offsetTop-(p+this.CANVAS_MARGIN):0;this.coverDiv.style.top=y+"px",this.coverDiv.style.left=(this.target.offsetLeft>this.CANVAS_MARGIN?this.target.offsetLeft-this.CANVAS_MARGIN:0)+"px",this.coverDiv.style.width=this.target.offsetWidth+this.CANVAS_MARGIN+"px",this.coverDiv.style.zIndex=this.styles.settings.zIndex!==void 0?this.styles.settings.zIndex:"5";break;case"popup":this.coverDiv.style.position="absolute",this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=window.innerHeight+"px",this.coverDiv.style.backgroundColor="rgba(0, 0, 0, 0.75)",this.coverDiv.style.zIndex=this.styles.settings.zIndex!==void 0?this.styles.settings.zIndex:"1000",this.coverDiv.style.display="flex"}this.targetRoot.appendChild(this.coverDiv),this.uiDiv=document.createElement("div"),this.uiDiv.style.display="flex",this.uiDiv.style.flexDirection="column",this.uiDiv.style.flexGrow="2",this.uiDiv.style.margin=this.displayMode==="popup"?this.popupMargin+"px":"0px",this.uiDiv.style.border="0px",this.coverDiv.appendChild(this.uiDiv),this.addToolbars(),this.uiDiv.appendChild(this.topToolbar.getUI()),this.contentDiv=document.createElement("div"),this.contentDiv.style.display="flex",this.contentDiv.style.alignItems="center",this.contentDiv.style.flexDirection="row",this.contentDiv.style.flexGrow="2",this.contentDiv.style.flexShrink="1",this.contentDiv.style.overflow="hidden",this.contentDiv.style.backgroundColor=this.styles.settings.canvasBackgroundColor,this.displayMode==="popup"&&(this.contentDiv.style.maxHeight="calc(100vh - "+(2*this.popupMargin+2*this.toolbarHeight)+"px)",this.contentDiv.style.maxWidth="calc(100vw - "+2*this.popupMargin+"px)"),this.uiDiv.appendChild(this.contentDiv),this.editorCanvas=document.createElement("div"),this.editorCanvas.style.flexGrow="2",this.editorCanvas.style.flexShrink="1",this.editorCanvas.style.position="relative",this.editorCanvas.style.overflow="hidden",this.editorCanvas.style.display="flex",this.displayMode==="popup"&&(this.editorCanvas.style.alignItems="center",this.editorCanvas.style.justifyContent="center"),this.editorCanvas.style.pointerEvents="none",this.contentDiv.appendChild(this.editorCanvas),this.uiDiv.appendChild(this.bottomToolbar.getUI()),this.straightener.angle=this.rotationAngle},F.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},F.prototype.addTopToolbar=function(){var p=this;this.topToolbar=new Mt,this.topToolbar.display=this.styles.settings.hideTopToolbar?"none":"",this.topToolbar.className=this.toolbarStyleClass.name,this.topToolbar.colorsClassName=this.styles.settings.toolbarStyleColorsClassName?this.styles.settings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name,this.topToolbar.fadeInClassName=this.styles.fadeInAnimationClassName,this.topToolbar.blockClassName=this.toolbarBlockStyleClass.name,this.topToolbar.buttonClassName=this.toolbarButtonStyleClass.name,this.topToolbar.buttonColorsClassName=this.styles.settings.toolbarButtonStyleColorsClassName?this.styles.settings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,this.topToolbar.buttonActiveColorsClassName=this.styles.settings.toolbarActiveButtonStyleColorsClassName?this.styles.settings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name;var y=new Lt;y.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(y);var M=[];this.aspectRatios.forEach(function(hn){var Rn=new at(Yt.getIcon(hn.horizontal,hn.vertical),hn.horizontal===0&&hn.vertical===0?"FREE":hn.horizontal+":"+hn.vertical);Rn.onClick=function(){return p.ratioButtonClicked(hn)},M.push(Rn)}),this.aspectRatioButton=new cn(Yt.getIcon(0,0),"Aspect ratio",M),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,y.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var Q=new at('',"Toggle grid");Q.isActive=this.isGridVisible,Q.onClick=function(){p.isGridVisible=!p.isGridVisible,Q.isActive=p.isGridVisible},y.addButton(Q);var W=new at('',"Zoom to selection");if(W.isActive=this.zoomToCropEnabled,W.onClick=function(){p.zoomToCropEnabled=!p.zoomToCropEnabled,W.isActive=p.zoomToCropEnabled},y.addButton(W),!Qt.isLicensed){var me=new Ve;this.topToolbar.addElementBlock(me);var Ye=document.createElement("div");Ye.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var dt=document.createElement("a");dt.style.color="currentColor",dt.href="https://markerjs.com/products/cropro",dt.target="_blank",dt.innerHTML='',Ye.appendChild(dt),me.addElement(Ye)}var jt=new Lt;jt.minWidth=3*this.toolbarHeight+"px",jt.contentAlign="end",this.topToolbar.addButtonBlock(jt);var Qe=new at('',"OK");Qe.onClick=this.startRenderAndClose,jt.addButton(Qe),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(Qe.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var Vt=new at('',"Close");Vt.onClick=this.close,jt.addButton(Vt),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(Vt.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},F.prototype.addBottomToolbar=function(){var p=this;this.bottomToolbar=new Mt,this.bottomToolbar.display=this.styles.settings.hideBottomToolbar?"none":"",this.bottomToolbar.className=this.toolbarStyleClass.name,this.bottomToolbar.colorsClassName=this.styles.settings.toolbarStyleColorsClassName?this.styles.settings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name,this.bottomToolbar.fadeInClassName=this.styles.fadeInAnimationClassName,this.bottomToolbar.blockClassName=this.toolbarBlockStyleClass.name,this.bottomToolbar.buttonClassName=this.toolbarButtonStyleClass.name,this.bottomToolbar.buttonColorsClassName=this.styles.settings.toolbarButtonStyleColorsClassName?this.styles.settings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,this.bottomToolbar.buttonActiveColorsClassName=this.styles.settings.toolbarActiveButtonStyleColorsClassName?this.styles.settings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name;var y=new Lt;y.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(y);var M=new at('',"Rotate left");M.onClick=this.rotateLeftButtonClicked,y.addButton(M);var Q=new at('',"Rotate right");Q.onClick=this.rotateRightButtonClicked,y.addButton(Q);var W=new Ve;W.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(W),this.straightener=new on("Straighten"),this.straightener.className=this.toolbarStraightenerStyleClass.name,this.straightener.colorsClassName=this.styles.settings.toolbarStraightenerColorsClassName?this.styles.settings.toolbarStraightenerColorsClassName:this.toolbarStraightenerStyleColorsClass.name,this.straightener.onAngleChange=function(jt){p.rotateBy(jt),p.straightener.angle=p.rotationAngle},W.addElement(this.straightener.getUI());var me=new Lt;me.minWidth=2*this.toolbarHeight+"px",me.contentAlign="end",this.bottomToolbar.addButtonBlock(me);var Ye=new at('',"Flip horizontal");Ye.onClick=this.flipHorizontallyButtonClicked,me.addButton(Ye);var dt=new at('',"Flip vertical");dt.onClick=this.flipVerticallyButtonClicked,me.addButton(dt)},F.prototype.ratioButtonClicked=function(p){this.aspectRatio=p,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},F.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=Yt.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},F.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new ln(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},F.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},F.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},F.prototype.restoreState=function(p){if(p){var y=this.cropLayer.getRescaledRect(p.width,p.height,this.imageWidth,this.imageHeight,p.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(y),this.cropRectChanged(y),this.flippedHorizontally=p.flippedHorizontally,this.flippedVertically=p.flippedVertically,this.applyFlip(),this.rotationAngle=p.rotationAngle,this.applyRotation()}},F.prototype.clientToLocalCoordinates=function(p,y){var M=this.cropImage.getBoundingClientRect();return{x:p-M.left,y:y-M.top}},F.prototype.onWindowResize=function(){this.positionUI()},F.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var p=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=p+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px";break;case"popup":this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=this.windowHeight+"px",this.contentDiv.style.maxHeight="calc(100vh - "+(2*this.popupMargin+2*this.toolbarHeight)+"px)"}this.positionCropImage()},F.prototype.rotateLeftButtonClicked=function(){var p=this.rotationAngle-90;this.rotationAngle%90!=0&&(p+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(p)},F.prototype.rotateRightButtonClicked=function(){var p=this.rotationAngle+90;this.rotationAngle%90!=0&&(p-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(p)},F.prototype.rotateTo=function(p){p=(p=p>180?p-360:p)<=-180?p+360:p,this.rotationAngle=p,this.applyRotation()},F.prototype.rotateBy=function(p){this.rotateTo((this.rotationAngle+p)%360)},F.prototype.applyRotation=function(){var p=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var y=this.editingTargetRotationContainer.transform.baseVal.getItem(0);y.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(y,0);var M=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/M.width,this.imageHeight/M.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=p},F.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},F.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},F.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},F.prototype.startRenderAndClose=function(){return Bt(this,void 0,void 0,function(){var p,y;return an(this,function(M){switch(M.label){case 0:return[4,this.render()];case 1:return p=M.sent(),y=this.getState(),this.renderEventListeners.forEach(function(Q){return Q(p,y)}),this.close(!0),[2]}})})},F.prototype.render=function(){return Bt(this,void 0,void 0,function(){var p;return an(this,function(y){switch(y.label){case 0:return(p=new ht).naturalSize=this.renderAtNaturalSize,p.imageType=this.renderImageType,p.imageQuality=this.renderImageQuality,p.width=this.renderWidth,p.height=this.renderHeight,this.unzoomFromCrop(),it.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,p.rasterize(this.cropImage,this.target,{x:this.cropRect.x,y:this.cropRect.y,width:this.cropRect.width,height:this.cropRect.height},this.CANVAS_MARGIN,this.rotationAngle,this.scaleFactor*(this.flippedHorizontally?-1:1),this.scaleFactor*(this.flippedVertically?-1:1))];case 1:return y.sent(),[4,p.rasterize(this.cropImage,this.target,{x:this.cropRect.x,y:this.cropRect.y,width:this.cropRect.width,height:this.cropRect.height},this.CANVAS_MARGIN,this.rotationAngle,this.scaleFactor*(this.flippedHorizontally?-1:1),this.scaleFactor*(this.flippedVertically?-1:1))];case 2:return[2,y.sent()]}})})},F.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new kt("toolbar",` width: `+(this.displayMode==="inline"?"100%":"calc(100vw - "+2*this.popupMargin+"px)")+`; flex-shrink: 0; display: flex; flex-direction: row; justify-content: space-between; height: `+this.toolbarHeight+`px; box-sizing: content-box; overflow: hidden; line-height: 0px; `)),this.toolbarStyleColorsClass=this.styles.addClass(new kt("toolbar_colors",` background-color: `+this.styles.settings.toolbarBackgroundColor+`; `)),this.toolbarBlockStyleClass=this.styles.addClass(new kt("toolbar-block",` display: flex; align-items: center; box-sizing: content-box; `));var p=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new kt("toolbar_button",` display: inline-block; width: `+(this.toolbarHeight-2*p)+`px; height: `+(this.toolbarHeight-2*p)+`px; padding: `+p+`px; cursor: default; user-select: none; box-sizing: content-box; `)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new kt("toolbar_button_colors",` color: `+this.styles.settings.toolbarColor+`; fill: currentColor; `)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new kt("toolbar_active_button",` color: `+this.styles.settings.toolbarColor+`; fill: currentColor; background-color: `+this.styles.settings.toolbarBackgroundActiveColor+` `)),this.styles.addRule(new xt("."+this.toolbarButtonStyleClass.name+" svg",` height: `+this.toolbarHeight/2+`px; `)),this.styles.addRule(new xt("."+this.toolbarButtonStyleColorsClass.name+":hover",` background-color: `+this.styles.settings.toolbarBackgroundHoverColor+` `)),this.toolbarDropdownStyleClass=this.styles.addClass(new kt("toolbar_dropdown",` position: absolute; max-width: `+4*this.toolbarHeight+`px; z-index: 20; white-space: normal; box-sizing: content-box; box-shadow: 3px 3px rgba(33, 33, 33, 0.1); margin: `+(this.displayMode==="inline"?"0":this.popupMargin)+`px; line-height: 0px; `)),this.toolbarDropdownStyleColorsClass=this.styles.addClass(new kt("toolbar_dropdown_colors",` background-color: `+this.styles.settings.toolbarBackgroundColor+`; `)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new kt("toolbar_straightener_block",` display: flex; overflow: hidden; justify-content: center; -webkit-mask-image: linear-gradient(90deg, rgba(0,0,0,0) 0%, rgba(0,0,0,1) 30%, rgba(0,0,0,1) 70%, rgba(0,0,0,0) 100%); `)),this.toolbarStraightenerStyleClass=this.styles.addClass(new kt("toolbar_straightener",` display: flex; overflow: hidden; justify-content: center; height: `+(this.toolbarHeight-2*p)+`px; padding: `+p+`px; cursor: default; user-select: none; box-sizing: content-box; `)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new kt("toolbar_straightener_colors",` color: `+this.styles.settings.toolbarColor+`; fill: currentColor; `))},F.instanceCounter=0,F}(),wt=X("8hTe"),Hn=X.n(wt),fr=/]*>/g;function Ar(F){var p=document.createElement("div");return p.innerHTML=F,p.childNodes.length===0?"":p.childNodes[0].nodeValue}var Fn=Xe.a=function(F){var p=F.value,y=p===void 0?"":p,M=F.edit,Q=M===void 0?!1:M,W=F.className,me=F.showTextOnly,Ye=F.showLines,dt=F.replaces,jt=F.zoomImg,Qe=F.hasMask,Vt=F.style,hn=Vt===void 0?{}:Vt,Rn=F.stylesPrev,pr=Rn===void 0?{}:Rn,qn=String(y),xn=Object(L.useRef)(),Rr=Object(L.useRef)(),qr=Object(L.useState)(""),Vn=Object(K.a)(qr,2),_t=Vn[0],Te=Vn[1],nt=Object(L.useState)("office"),Ht=Object(K.a)(nt,2),Ot=Ht[0],Nt=Ht[1],Xt=function(){var mn=new Ke(Rr.current);mn.displayMode="popup",mn.addRenderEventListener(function(){var Ln=Object(N.a)(O.a.mark(function en(Un){var _n;return O.a.wrap(function(ar){for(;;)switch(ar.prev=ar.next){case 0:return xn.current.style.display="none",ar.next=3,Object(Ce.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:Un}});case 3:_n=ar.sent,_n!=null&&_n.id&&dt(Rr.current.getAttribute("src").replace(de.a.API_SERVER,""),"/api/attachments/".concat(_n==null?void 0:_n.id,"?type=").concat(_n.content_type));case 5:case"end":return ar.stop()}},en)}));return function(en){return Ln.apply(this,arguments)}}()),mn.show()},Dn=function(){var mn=new Je(Rr.current);mn.settings.displayMode="popup",mn.addEventListener("render",function(){var Ln=Object(N.a)(O.a.mark(function en(Un){var _n;return O.a.wrap(function(ar){for(;;)switch(ar.prev=ar.next){case 0:if(xn.current.style.display="none",!Rr.current){ar.next=6;break}return ar.next=4,Object(Ce.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:Un.dataUrl}});case 4:_n=ar.sent,_n!=null&&_n.id&&dt(Rr.current.getAttribute("src").replace(de.a.API_SERVER,""),"/api/attachments/".concat(_n==null?void 0:_n.id,"?type=").concat(_n.content_type));case 6:case"end":return ar.stop()}},en)}));return function(en){return Ln.apply(this,arguments)}}()),mn.show(),window.markerArea=mn},Sn=Object(L.useMemo)(function(){xn.current&&(xn.current.style.zIndex=-1);try{var yn=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,mn=/\"\/api\/attachments\/|\"\/attachments\/download\//g,Ln=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;qn=qn.replace(yn,"("+de.a.API_SERVER+"/api/attachments/").replace(mn,'"'+de.a.API_SERVER+"/api/attachments/").replace(Ln,'"'+de.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(mr){}var en=Z(qn),Un=b();if(qn.match(/\[TOC\]/)&&(en=en.replace("

    [TOC]

    ",u()),C()),en=en.replace(/(__special_katext_id_\d+__)/g,function(mr,ar){var gr=Un[ar],fi=gr.type,Jr=gr.expression;return Object(pe.renderToString)(Ar(Jr)||"",{displayMode:fi==="block",throwOnError:!1,output:"html"})}),en=en.replace(/▁/g,"\u2581\u2581\u2581"),g(),me){var _n=document.createElement("div");return _n.innerHTML=en,_n.innerText}return setTimeout(function(){return Kn()},500),en},[qn]),un=Object(L.useRef)();v.WebkitLineClamp=Ye,Ye&&(hn=Object(U.a)(Object(U.a)({},hn),v));function jn(yn){var mn=yn.target;if(mn.tagName.toUpperCase()==="IMG"){if(jt){var Ln=mn.getAttribute("src");Te(Ln),Nt("image")}}else if(mn.tagName.toUpperCase()==="A"){var en=mn.getAttribute("href");if(en.indexOf("office")>-1)yn.preventDefault(),Te(en),Nt("office");else if(en.indexOf("application/pdf")>-1)yn.preventDefault(),Te(en),Nt("pdf");else if(en.indexOf("text/html")>-1)yn.preventDefault(),Te(en),Nt("html");else if(en.startsWith("#")){yn.preventDefault();var Un=document.getElementById(en.replace("#",""));Un&&Un.scrollIntoView(!0)}}}var Kn=function(){var mn,Ln=(mn=un.current)===null||mn===void 0?void 0:mn.querySelectorAll("video");Ln==null||Ln.forEach(function(en){if(en.oncontextmenu=function(){return!1},en.src.indexOf(".m3u8")>-1&&!en.canPlayType("application/vnd.apple.mpegurl")){if(te.a.isSupported()){var Un=new te.a;Un.loadSource(en.src),Un.attachMedia(en)}}})};Object(L.useEffect)(function(){if(un.current&&Sn&&(Sn.match(fr)&&window.PR.prettyPrint()),un.current)return un.current.addEventListener("click",jn),function(){un.current.removeEventListener("click",jn),g(),C()}},[Sn,un.current,jn]);var ir=function(mn){if(!Q)return;mn.target.nodeName==="IMG"?(xn.current.style.zIndex=1,xn.current.style.display="flex",xn.current.style.width=mn.target.clientWidth+"px",xn.current.style.height=mn.target.clientHeight+"px",xn.current.style.top=mn.target.offsetTop+"px",xn.current.style.left=mn.target.offsetLeft+"px",Rr.current.src=mn.target.getAttribute("src")):xn.current.style.display="none"};return T.a.createElement("div",{style:{position:"relative"}},T.a.createElement("div",{ref:un,style:Object(U.a)({},hn),className:"".concat(W||""," markdown-body ").concat(Hn.a.mdBody),onMouseOver:ir,dangerouslySetInnerHTML:{__html:Sn}}),T.a.createElement("div",{ref:xn,className:Hn.a.button},T.a.createElement($.a,null,T.a.createElement(Y.a,{onClick:function(){return Xt()}},"\u88C1\u526A"),T.a.createElement(Y.a,{onClick:function(){return Dn()}},"\u7F16\u8F91"))),T.a.createElement("img",{ref:Rr,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),T.a.createElement(ye.a,{close:!0,data:_t,type:_t!=null&&_t.length?Ot:"",style:Object(U.a)({},pr),onClose:function(){return Te("")}}))}},"9VGf":function(rt,Xe,X){"use strict";X.d(Xe,"a",function(){return D});var oe=X("q1tI"),$=X.n(oe);function D(Y,U){var N=Object(oe.useRef)();Object(oe.useEffect)(function(){N.current=Y}),Object(oe.useEffect)(function(){function K(){N.current()}if(U!==null){var I=setInterval(K,U);return function(){return clearInterval(I)}}},[U])}},"A+k2":function(rt,Xe,X){rt.exports={tabs:"tabs___2hYAP",active:"active___2Xkwd"}},Bd2K:function(rt,Xe,X){(function(oe){oe(X("VrN/"),X("osHv"))})(function(oe){oe.defineOption("autoCloseTags",!1,function(O,L,T){if(T!=oe.Init&&T&&O.removeKeyMap("autoCloseTags"),!L)return;var A={name:"autoCloseTags"};(typeof L!="object"||L.whenClosing!==!1)&&(A["'/'"]=function(P){return N(P)}),(typeof L!="object"||L.whenOpening!==!1)&&(A["'>'"]=function(P){return Y(P)}),O.addKeyMap(A)});var $=["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 Y(O){if(O.getOption("disableInput"))return oe.Pass;for(var L=O.listSelections(),T=[],A=O.getOption("autoCloseTags"),P=0;Pw.ch&&(i=i.slice(0,i.length-S.end+w.ch));var m=i.toLowerCase();if(!i||S.type=="string"&&(S.end!=w.ch||!/[\"\']/.test(S.string.charAt(S.string.length-1))||S.string.length==1)||S.type=="tag"&&l.close||S.string.indexOf("/")==w.ch-S.start-1||C&&K(C,m)>-1||I(O,x.mode.xmlCurrentContext&&x.mode.xmlCurrentContext(h)||[],i,w,!0))return oe.Pass;var u=typeof A=="object"&&A.emptyTags;if(u&&K(u,i)>-1){T[P]={text:"/>",newPos:oe.Pos(w.line,w.ch+2)};continue}var E=v&&K(v,m)>-1;T[P]={indent:E,text:">"+(E?` `:"")+"",newPos:E?oe.Pos(w.line+1,0):oe.Pos(w.line,w.ch+1)}}for(var d=typeof A=="object"&&A.dontIndentOnAutoClose,P=L.length-1;P>=0;P--){var f=T[P];O.replaceRange(f.text,L[P].head,L[P].anchor,"+insert");var s=O.listSelections().slice(0);s[P]={head:f.newPos,anchor:f.newPos},O.setSelections(s),!d&&f.indent&&(O.indentLine(f.newPos.line,null,!0),O.indentLine(f.newPos.line+1,null,!0))}}function U(O,L){for(var T=O.listSelections(),A=[],P=L?"/":""&&(C+=">"),A[x]=C}if(O.replaceSelections(A),T=O.listSelections(),!S)for(var x=0;x=0&&L[h]==T;h--)++x;A=S.to;for(var h=1;h0){for(var L=0;L1&&arguments[1]!==void 0?arguments[1]:"",L=[],T=0;TEe.length)&&(fe=Ee.length);for(var be=0,ne=new Array(fe);be=Ee.length?{done:!0}:{done:!1,value:Ee[ne++]}}}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 be=Ee[Symbol.iterator](),be.next.bind(be)}function N(Ee,fe){return fe={exports:{}},Ee(fe,fe.exports),fe.exports}var K=N(function(Ee){function fe(){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 be(ne){Ee.exports.defaults=ne}Ee.exports={defaults:fe(),getDefaults:fe,changeDefaults:be}}),I=K.defaults,O=K.getDefaults,L=K.changeDefaults,T=/[&<>"']/,A=/[&<>"']/g,P=/[<>"']|&(?!#?\w+;)/,w=/[<>"']|&(?!#?\w+;)/g,S={"&":"&","<":"<",">":">",'"':""","'":"'"},x=function(fe){return S[fe]};function h(Ee,fe){if(fe){if(T.test(Ee))return Ee.replace(A,x)}else if(P.test(Ee))return Ee.replace(w,x);return Ee}var l=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function i(Ee){return Ee.replace(l,function(fe,be){return be=be.toLowerCase(),be==="colon"?":":be.charAt(0)==="#"?be.charAt(1)==="x"?String.fromCharCode(parseInt(be.substring(2),16)):String.fromCharCode(+be.substring(1)):""})}var c=/(^|[^\[])\^/g;function C(Ee,fe){Ee=Ee.source||Ee,fe=fe||"";var be={replace:function(re,ae){return ae=ae.source||ae,ae=ae.replace(c,"$1"),Ee=Ee.replace(re,ae),be},getRegex:function(){return new RegExp(Ee,fe)}};return be}var v=/[^\w:]/g,m=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function u(Ee,fe,be){if(Ee){var ne;try{ne=decodeURIComponent(i(be)).replace(v,"").toLowerCase()}catch(re){return null}if(ne.indexOf("javascript:")===0||ne.indexOf("vbscript:")===0||ne.indexOf("data:")===0)return null}fe&&!m.test(be)&&(be=o(fe,be));try{be=encodeURI(be).replace(/%25/g,"%")}catch(re){return null}return be}var E={},d=/^[^:]+:\/*[^/]*$/,f=/^([^:]+:)[\s\S]*$/,s=/^([^:]+:\/*[^/]*)[\s\S]*$/;function o(Ee,fe){E[" "+Ee]||(d.test(Ee)?E[" "+Ee]=Ee+"/":E[" "+Ee]=k(Ee,"/",!0)),Ee=E[" "+Ee];var be=Ee.indexOf(":")===-1;return fe.substring(0,2)==="//"?be?fe:Ee.replace(f,"$1")+fe:fe.charAt(0)==="/"?be?fe:Ee.replace(s,"$1")+fe:Ee+fe}var b={exec:function(){}};function g(Ee){for(var fe=1,be,ne;fe=0&&ue[Le]==="\\";)we=!we;return we?"|":" |"}),ne=be.split(/ \|/),re=0;if(ne.length>fe)ne.splice(fe);else for(;ne.length=ne.length?re.slice(ne.length):re}).join(` `)}var _e=function(){function Ee(be){this.options=be||G}var fe=Ee.prototype;return fe.space=function(ne){var re=this.rules.block.newline.exec(ne);if(re)return re[0].length>1?{type:"space",raw:re[0]}:{raw:` `}},fe.code=function(ne,re){var ae=this.rules.block.code.exec(ne);if(ae){var ce=re[re.length-1];if(ce&&ce.type==="paragraph")return{raw:ae[0],text:ae[0].trimRight()};var ue=ae[0].replace(/^ {4}/gm,"");return{type:"code",raw:ae[0],codeBlockStyle:"indented",text:this.options.pedantic?ue:B(ue,` `)}}},fe.fences=function(ne){var re=this.rules.block.fences.exec(ne);if(re){var ae=re[0],ce=Ce(ae,re[3]||"");return{type:"code",raw:ae,lang:re[2]?re[2].trim():re[2],text:ce}}},fe.heading=function(ne){var re=this.rules.block.heading.exec(ne);if(re)return{type:"heading",raw:re[0],depth:re[1].length,text:re[2]}},fe.nptable=function(ne){var re=this.rules.block.nptable.exec(ne);if(re){var ae={type:"table",header:te(re[1].replace(/^ *| *\| *$/g,"")),align:re[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:re[3]?re[3].replace(/\n$/,"").split(` `):[],raw:re[0]};if(ae.header.length===ae.align.length){var ce=ae.align.length,ue;for(ue=0;ue ?/gm,"");return{type:"blockquote",raw:re[0],text:ae}}},fe.list=function(ne){var re=this.rules.block.list.exec(ne);if(re){for(var ae=re[0],ce=re[2],ue=ce.length>1,we=ce[ce.length-1]===")",Le={type:"list",raw:ae,ordered:ue,start:ue?+ce.slice(0,-1):"",loose:!1,items:[]},tt=re[0].match(this.rules.block.item),Fe=!1,$e,Dt,ot,ft,zt,Je,Kt,sn=tt.length,Bt=0;Bt1||this.options.smartLists&&ot!==ce)&&(ft=tt.slice(Bt+1).join(` `),Le.raw=Le.raw.substring(0,Le.raw.length-ft.length),Bt=sn-1)),zt=Fe||/\n\n(?!\s*$)/.test($e),Bt!==sn-1&&(Fe=$e.charAt($e.length-1)===` `,zt||(zt=Fe)),zt&&(Le.loose=!0),Je=/^\[[ xX]\] /.test($e),Kt=void 0,Je&&(Kt=$e[1]!==" ",$e=$e.replace(/^\[[ xX]\] +/,"")),Le.items.push({type:"list_item",raw:ae,task:Je,checked:Kt,loose:zt,text:$e});return Le}},fe.html=function(ne){var re=this.rules.block.html.exec(ne);if(re)return{type:this.options.sanitize?"paragraph":"html",raw:re[0],pre:!this.options.sanitizer&&(re[1]==="pre"||re[1]==="script"||re[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(re[0]):de(re[0]):re[0]}},fe.def=function(ne){var re=this.rules.block.def.exec(ne);if(re){re[3]&&(re[3]=re[3].substring(1,re[3].length-1));var ae=re[1].toLowerCase().replace(/\s+/g," ");return{tag:ae,raw:re[0],href:re[2],title:re[3]}}},fe.table=function(ne){var re=this.rules.block.table.exec(ne);if(re){var ae={type:"table",header:te(re[1].replace(/^ *| *\| *$/g,"")),align:re[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:re[3]?re[3].replace(/\n$/,"").split(` `):[]};if(ae.header.length===ae.align.length){ae.raw=re[0];var ce=ae.align.length,ue;for(ue=0;ue/i.test(ce[0])&&(re=!1),!ae&&/^<(pre|code|kbd|script)(\s|>)/i.test(ce[0])?ae=!0:ae&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(ce[0])&&(ae=!1),{type:this.options.sanitize?"text":"html",raw:ce[0],inLink:re,inRawBlock:ae,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ce[0]):de(ce[0]):ce[0]}},fe.link=function(ne){var re=this.rules.inline.link.exec(ne);if(re){var ae=pe(re[2],"()");if(ae>-1){var ce=re[0].indexOf("!")===0?5:4,ue=ce+re[1].length+ae;re[2]=re[2].substring(0,ae),re[0]=re[0].substring(0,ue).trim(),re[3]=""}var we=re[2],Le="";if(this.options.pedantic){var tt=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(we);tt?(we=tt[1],Le=tt[3]):Le=""}else Le=re[3]?re[3].slice(1,-1):"";we=we.trim().replace(/^<([\s\S]*)>$/,"$1");var Fe=ye(re,{href:we&&we.replace(this.rules.inline._escapes,"$1"),title:Le&&Le.replace(this.rules.inline._escapes,"$1")},re[0]);return Fe}},fe.reflink=function(ne,re){var ae;if((ae=this.rules.inline.reflink.exec(ne))||(ae=this.rules.inline.nolink.exec(ne))){var ce=(ae[2]||ae[1]).replace(/\s+/g," ");if(ce=re[ce.toLowerCase()],!ce||!ce.href){var ue=ae[0].charAt(0);return{type:"text",raw:ue,text:ue}}var we=ye(ae,ce,ae[0]);return we}},fe.strong=function(ne,re,ae){ae===void 0&&(ae="");var ce=this.rules.inline.strong.start.exec(ne);if(ce&&(!ce[1]||ce[1]&&(ae===""||this.rules.inline.punctuation.exec(ae)))){re=re.slice(-1*ne.length);var ue=ce[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;ue.lastIndex=0;for(var we;(ce=ue.exec(re))!=null;)if(we=this.rules.inline.strong.middle.exec(re.slice(0,ce.index+3)),we)return{type:"strong",raw:ne.slice(0,we[0].length),text:ne.slice(2,we[0].length-2)}}},fe.em=function(ne,re,ae){ae===void 0&&(ae="");var ce=this.rules.inline.em.start.exec(ne);if(ce&&(!ce[1]||ce[1]&&(ae===""||this.rules.inline.punctuation.exec(ae)))){re=re.slice(-1*ne.length);var ue=ce[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;ue.lastIndex=0;for(var we;(ce=ue.exec(re))!=null;)if(we=this.rules.inline.em.middle.exec(re.slice(0,ce.index+2)),we)return{type:"em",raw:ne.slice(0,we[0].length),text:ne.slice(1,we[0].length-1)}}},fe.codespan=function(ne){var re=this.rules.inline.code.exec(ne);if(re){var ae=re[2].replace(/\n/g," "),ce=/[^ ]/.test(ae),ue=ae.startsWith(" ")&&ae.endsWith(" ");return ce&&ue&&(ae=ae.substring(1,ae.length-1)),ae=de(ae,!0),{type:"codespan",raw:re[0],text:ae}}},fe.br=function(ne){var re=this.rules.inline.br.exec(ne);if(re)return{type:"br",raw:re[0]}},fe.del=function(ne){var re=this.rules.inline.del.exec(ne);if(re)return{type:"del",raw:re[0],text:re[1]}},fe.autolink=function(ne,re){var ae=this.rules.inline.autolink.exec(ne);if(ae){var ce,ue;return ae[2]==="@"?(ce=de(this.options.mangle?re(ae[1]):ae[1]),ue="mailto:"+ce):(ce=de(ae[1]),ue=ce),{type:"link",raw:ae[0],text:ce,href:ue,tokens:[{type:"text",raw:ce,text:ce}]}}},fe.url=function(ne,re){var ae;if(ae=this.rules.inline.url.exec(ne)){var ce,ue;if(ae[2]==="@")ce=de(this.options.mangle?re(ae[0]):ae[0]),ue="mailto:"+ce;else{var we;do we=ae[0],ae[0]=this.rules.inline._backpedal.exec(ae[0])[0];while(we!==ae[0]);ce=de(ae[0]),ae[1]==="www."?ue="http://"+ce:ue=ce}return{type:"link",raw:ae[0],text:ce,href:ue,tokens:[{type:"text",raw:ce,text:ce}]}}},fe.inlineText=function(ne,re,ae){var ce=this.rules.inline.text.exec(ne);if(ce){var ue;return re?ue=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ce[0]):de(ce[0]):ce[0]:ue=de(this.options.smartypants?ae(ce[0]):ce[0]),{type:"text",raw:ce[0],text:ue}}},Ee}(),le=Z.noopTest,se=Z.edit,ve=Z.merge,ie={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:le,table:le,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};ie._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,ie._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,ie.def=se(ie.def).replace("label",ie._label).replace("title",ie._title).getRegex(),ie.bullet=/(?:[*+-]|\d{1,9}[.)])/,ie.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,ie.item=se(ie.item,"gm").replace(/bull/g,ie.bullet).getRegex(),ie.list=se(ie.list).replace(/bull/g,ie.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+ie.def.source+")").getRegex(),ie._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",ie._comment=//,ie.html=se(ie.html,"i").replace("comment",ie._comment).replace("tag",ie._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ie.paragraph=se(ie._paragraph).replace("hr",ie.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",ie._tag).getRegex(),ie.blockquote=se(ie.blockquote).replace("paragraph",ie.paragraph).getRegex(),ie.normal=ve({},ie),ie.gfm=ve({},ie.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*|$)"}),ie.gfm.nptable=se(ie.gfm.nptable).replace("hr",ie.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",ie._tag).getRegex(),ie.gfm.table=se(ie.gfm.table).replace("hr",ie.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",ie._tag).getRegex(),ie.pedantic=ve({},ie.normal,{html:se(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ie._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:le,paragraph:se(ie.normal._paragraph).replace("hr",ie.hr).replace("heading",` *#{1,6} *[^ ]`).replace("lheading",ie.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var q={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:le,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:le,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\?@\\[\\]`^{|}~",q.punctuation=se(q.punctuation).replace(/punctuation/g,q._punctuation).getRegex(),q._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",q._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",q.em.start=se(q.em.start).replace(/punctuation/g,q._punctuation).getRegex(),q.em.middle=se(q.em.middle).replace(/punctuation/g,q._punctuation).replace(/overlapSkip/g,q._overlapSkip).getRegex(),q.em.endAst=se(q.em.endAst,"g").replace(/punctuation/g,q._punctuation).getRegex(),q.em.endUnd=se(q.em.endUnd,"g").replace(/punctuation/g,q._punctuation).getRegex(),q.strong.start=se(q.strong.start).replace(/punctuation/g,q._punctuation).getRegex(),q.strong.middle=se(q.strong.middle).replace(/punctuation/g,q._punctuation).replace(/blockSkip/g,q._blockSkip).getRegex(),q.strong.endAst=se(q.strong.endAst,"g").replace(/punctuation/g,q._punctuation).getRegex(),q.strong.endUnd=se(q.strong.endUnd,"g").replace(/punctuation/g,q._punctuation).getRegex(),q.blockSkip=se(q._blockSkip,"g").getRegex(),q.overlapSkip=se(q._overlapSkip,"g").getRegex(),q._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,q._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,q._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])?)+(?![-_])/,q.autolink=se(q.autolink).replace("scheme",q._scheme).replace("email",q._email).getRegex(),q._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,q.tag=se(q.tag).replace("comment",ie._comment).replace("attribute",q._attribute).getRegex(),q._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,q._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,q._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,q.link=se(q.link).replace("label",q._label).replace("href",q._href).replace("title",q._title).getRegex(),q.reflink=se(q.reflink).replace("label",q._label).getRegex(),q.reflinkSearch=se(q.reflinkSearch,"g").replace("reflink",q.reflink).replace("nolink",q.nolink).getRegex(),q.normal=ve({},q),q.pedantic=ve({},q.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:se(/^!?\[(label)\]\((.*?)\)/).replace("label",q._label).getRegex(),reflink:se(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",q._label).getRegex()}),q.gfm=ve({},q.normal,{escape:se(q.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&&(ne="x"+ne.toString(16)),fe+="&#"+ne+";";return fe}var Pe=function(){function Ee(be){this.tokens=[],this.tokens.links=Object.create(null),this.options=be||Ie,this.options.tokenizer=this.options.tokenizer||new _e,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var ne={block:Ne.normal,inline:De.normal};this.options.pedantic?(ne.block=Ne.pedantic,ne.inline=De.pedantic):this.options.gfm&&(ne.block=Ne.gfm,this.options.breaks?ne.inline=De.breaks:ne.inline=De.gfm),this.tokenizer.rules=ne}Ee.lex=function(ne,re){var ae=new Ee(re);return ae.lex(ne)};var fe=Ee.prototype;return fe.lex=function(ne){return ne=ne.replace(/\r\n|\r/g,` `).replace(/\t/g," "),this.blockTokens(ne,this.tokens,!0),this.inline(this.tokens),this.tokens},fe.blockTokens=function(ne,re,ae){re===void 0&&(re=[]),ae===void 0&&(ae=!0),ne=ne.replace(/^ +$/gm,"");for(var ce,ue,we,Le;ne;){if(ce=this.tokenizer.space(ne)){ne=ne.substring(ce.raw.length),ce.type&&re.push(ce);continue}if(ce=this.tokenizer.code(ne,re)){ne=ne.substring(ce.raw.length),ce.type?re.push(ce):(Le=re[re.length-1],Le.raw+=` `+ce.raw,Le.text+=` `+ce.text);continue}if(ce=this.tokenizer.fences(ne)){ne=ne.substring(ce.raw.length),re.push(ce);continue}if(ce=this.tokenizer.heading(ne)){ne=ne.substring(ce.raw.length),re.push(ce);continue}if(ce=this.tokenizer.nptable(ne)){ne=ne.substring(ce.raw.length),re.push(ce);continue}if(ce=this.tokenizer.hr(ne)){ne=ne.substring(ce.raw.length),re.push(ce);continue}if(ce=this.tokenizer.blockquote(ne)){ne=ne.substring(ce.raw.length),ce.tokens=this.blockTokens(ce.text,[],ae),re.push(ce);continue}if(ce=this.tokenizer.list(ne)){for(ne=ne.substring(ce.raw.length),we=ce.items.length,ue=0;ue0)for(;(tt=this.tokenizer.rules.inline.reflinkSearch.exec(Le))!=null;)Fe.includes(tt[0].slice(tt[0].lastIndexOf("[")+1,-1))&&(Le=Le.slice(0,tt.index)+"["+"a".repeat(tt[0].length-2)+"]"+Le.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(tt=this.tokenizer.rules.inline.blockSkip.exec(Le))!=null;)Le=Le.slice(0,tt.index)+"["+"a".repeat(tt[0].length-2)+"]"+Le.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;ne;){if(we=this.tokenizer.escape(ne)){ne=ne.substring(we.raw.length),re.push(we);continue}if(we=this.tokenizer.tag(ne,ae,ce)){ne=ne.substring(we.raw.length),ae=we.inLink,ce=we.inRawBlock,re.push(we);continue}if(we=this.tokenizer.link(ne)){ne=ne.substring(we.raw.length),we.type==="link"&&(we.tokens=this.inlineTokens(we.text,[],!0,ce)),re.push(we);continue}if(we=this.tokenizer.reflink(ne,this.tokens.links)){ne=ne.substring(we.raw.length),we.type==="link"&&(we.tokens=this.inlineTokens(we.text,[],!0,ce)),re.push(we);continue}if(we=this.tokenizer.strong(ne,Le,ue)){ne=ne.substring(we.raw.length),we.tokens=this.inlineTokens(we.text,[],ae,ce),re.push(we);continue}if(we=this.tokenizer.em(ne,Le,ue)){ne=ne.substring(we.raw.length),we.tokens=this.inlineTokens(we.text,[],ae,ce),re.push(we);continue}if(we=this.tokenizer.codespan(ne)){ne=ne.substring(we.raw.length),re.push(we);continue}if(we=this.tokenizer.br(ne)){ne=ne.substring(we.raw.length),re.push(we);continue}if(we=this.tokenizer.del(ne)){ne=ne.substring(we.raw.length),we.tokens=this.inlineTokens(we.text,[],ae,ce),re.push(we);continue}if(we=this.tokenizer.autolink(ne,Ae)){ne=ne.substring(we.raw.length),re.push(we);continue}if(!ae&&(we=this.tokenizer.url(ne,Ae))){ne=ne.substring(we.raw.length),re.push(we);continue}if(we=this.tokenizer.inlineText(ne,ce,Be)){ne=ne.substring(we.raw.length),ue=we.raw.slice(-1),re.push(we);continue}if(ne){var $e="Infinite loop on byte: "+ne.charCodeAt(0);if(this.options.silent){console.error($e);break}else throw new Error($e)}}return re},$(Ee,null,[{key:"rules",get:function(){return{block:Ne,inline:De}}}]),Ee}(),We=K.defaults,ze=Z.cleanUrl,qe=Z.escape,Ge=function(){function Ee(be){this.options=be||We}var fe=Ee.prototype;return fe.code=function(ne,re,ae){var ce=(re||"").match(/\S*/)[0];if(this.options.highlight){var ue=this.options.highlight(ne,ce);ue!=null&&ue!==ne&&(ae=!0,ne=ue)}return ce?'
    '+(ae?ne:qe(ne,!0))+`
    `:"
    "+(ae?ne:qe(ne,!0))+`
    `},fe.blockquote=function(ne){return`
    `+ne+`
    `},fe.html=function(ne){return ne},fe.heading=function(ne,re,ae,ce){return this.options.headerIds?"'+ne+" `:""+ne+" `},fe.hr=function(){return this.options.xhtml?`
    `:`
    `},fe.list=function(ne,re,ae){var ce=re?"ol":"ul",ue=re&&ae!==1?' start="'+ae+'"':"";return"<"+ce+ue+`> `+ne+" `},fe.listitem=function(ne){return"
  • "+ne+`
  • `},fe.checkbox=function(ne){return" "},fe.paragraph=function(ne){return"

    "+ne+`

    `},fe.table=function(ne,re){return re&&(re=""+re+""),` `+ne+` `+re+`
    `},fe.tablerow=function(ne){return` `+ne+` `},fe.tablecell=function(ne,re){var ae=re.header?"th":"td",ce=re.align?"<"+ae+' align="'+re.align+'">':"<"+ae+">";return ce+ne+" `},fe.strong=function(ne){return""+ne+""},fe.em=function(ne){return""+ne+""},fe.codespan=function(ne){return""+ne+""},fe.br=function(){return this.options.xhtml?"
    ":"
    "},fe.del=function(ne){return""+ne+""},fe.link=function(ne,re,ae){if(ne=ze(this.options.sanitize,this.options.baseUrl,ne),ne===null)return ae;var ce='",ce},fe.image=function(ne,re,ae){if(ne=ze(this.options.sanitize,this.options.baseUrl,ne),ne===null)return ae;var ce=''+ae+'":">",ce},fe.text=function(ne){return ne},Ee}(),ke=function(){function Ee(){}var fe=Ee.prototype;return fe.strong=function(ne){return ne},fe.em=function(ne){return ne},fe.codespan=function(ne){return ne},fe.del=function(ne){return ne},fe.html=function(ne){return ne},fe.text=function(ne){return ne},fe.link=function(ne,re,ae){return""+ae},fe.image=function(ne,re,ae){return""+ae},fe.br=function(){return""},Ee}(),ct=function(){function Ee(){this.seen={}}var fe=Ee.prototype;return fe.slug=function(ne){var re=ne.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(re)){var ae=re;do this.seen[ae]++,re=ae+"-"+this.seen[ae];while(this.seen.hasOwnProperty(re))}return this.seen[re]=0,re},Ee}(),ut=K.defaults,vt=Z.unescape,lt=function(){function Ee(be){this.options=be||ut,this.options.renderer=this.options.renderer||new Ge,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new ke,this.slugger=new ct}Ee.parse=function(ne,re){var ae=new Ee(re);return ae.parse(ne)};var fe=Ee.prototype;return fe.parse=function(ne,re){re===void 0&&(re=!0);var ae="",ce,ue,we,Le,tt,Fe,$e,Dt,ot,ft,zt,Je,Kt,sn,Bt,an,Qt,it,Ft=ne.length;for(ce=0;ce0&&Bt.tokens[0].type==="text"?(Bt.tokens[0].text=it+" "+Bt.tokens[0].text,Bt.tokens[0].tokens&&Bt.tokens[0].tokens.length>0&&Bt.tokens[0].tokens[0].type==="text"&&(Bt.tokens[0].tokens[0].text=it+" "+Bt.tokens[0].tokens[0].text)):Bt.tokens.unshift({type:"text",text:it}):sn+=it),sn+=this.parse(Bt.tokens,Kt),ot+=this.renderer.listitem(sn,Qt,an);ae+=this.renderer.list(ot,zt,Je);continue}case"html":{ae+=this.renderer.html(ft.text);continue}case"paragraph":{ae+=this.renderer.paragraph(this.parseInline(ft.tokens));continue}case"text":{for(ot=ft.tokens?this.parseInline(ft.tokens):ft.text;ce+1An error occurred:

    "+yt(we.message+"",!0)+"
    ";throw we}}Ue.options=Ue.setOptions=function(Ee){return Tt(Ue.defaults,Ee),Pt(Ue.defaults),Ue},Ue.getDefaults=Oe,Ue.defaults=St,Ue.use=function(Ee){var fe=Tt({},Ee);if(Ee.renderer&&function(){var ne=Ue.defaults.renderer||new Ge,re=function(ue){var we=ne[ue];ne[ue]=function(){for(var Le=arguments.length,tt=new Array(Le),Fe=0;Feit.length){var Lt=Object(ke.xor)(Mt,it);console.log(Lt,"newLevel"),It=It.filter(function(at){return!Lt.includes(at)})}tt(It),Je(it.length===(Fe==null||((xt=Fe.tag_disciplines)===null||xt===void 0)?void 0:xt.length))},sn=function(it){var Ft,xt=Fe==null||((Ft=Fe.tag_disciplines)===null||Ft===void 0)?void 0:Ft.map(function(kt){return kt.id});tt(it.target.checked?Object(ke.uniq)([].concat(Object(Z.a)(Le),Object(Z.a)(xt))):Le==null?void 0:Le.filter(function(kt){return!xt.includes(kt)})),Je(it.target.checked)};console.log(Fe,"options");var Bt=function(){var it,Ft,xt=(Fe==null?void 0:Fe.tag_disciplines)||[];if($e){var kt;xt=(kt=xt)===null||kt===void 0?void 0:kt.filter(function(Mt){var It;return Mt==null||((It=Mt.name)===null||It===void 0)?void 0:It.includes($e)})}return xt=(it=xt)===null||it===void 0?void 0:it.map(function(Mt){return Object(L.a)(Object(L.a)({},Mt),{},{label:"".concat(Mt.name,"(".concat(Mt==null?void 0:Mt.item_count,")")),value:Mt.id})}),xt=(Ft=xt)===null||Ft===void 0?void 0:Ft.filter(function(Mt){return Mt.item_count!==0}),xt},an=function(){var it=!1;if(!$e)it=!0;else{var Ft;(Ft=Fe.tag_disciplines)===null||Ft===void 0||Ft.forEach(function(xt){if(!it){var kt;it=((kt=xt.name)===null||kt===void 0?void 0:kt.includes($e))&&xt.item_count!==0}})}return it};return(Fe==null?void 0:Fe.item_count)===0||!an()?i.a.createElement(i.a.Fragment,null):i.a.createElement("div",{className:Ge.a.cInput},i.a.createElement("div",{className:Ge.a.cl},i.a.createElement(g.a,{checked:zt,onChange:sn},i.a.createElement("span",{className:Ge.a.box},i.a.createElement("span",{className:"font14 c-light-primary"},i.a.createElement("span",{title:Fe==null?void 0:Fe.name,className:Ge.a.box1}," ",Fe==null?void 0:Fe.name),i.a.createElement("span",null," ","(".concat(Fe==null?void 0:Fe.item_count,")"))),i.a.createElement("i",{className:"iconfont icon-lujing font12 ml5"})))),i.a.createElement("div",{className:Ge.a.cr},i.a.createElement(ct,{options:Bt(),value:Le,onChange:Kt})))},vt=ut,lt=X("ErOA"),Tt=X("ozfa"),gt=X("MJZm"),yt=X("0Owb"),Oe=X("tmPe"),Pt=X.n(Oe),St=function(ue){var we=ue.value,Le=ue.onChange,tt=ue.defaultValue,Fe=ue.treeData,$e=Fe===void 0?[]:Fe,Dt=Object(ze.a)(ue,["value","onChange","defaultValue","treeData"]);return i.a.createElement("div",{className:Pt.a.customTree},i.a.createElement(gt.a,Object(yt.a)({multiple:!0,showIcon:!0,selectedKeys:we,defaultExpandedKeys:tt,treeData:$e,onSelect:Le},Dt)))},Ue=St,Ze=X("sbIO"),Ee=S.a.Search,fe=function(ue){var we,Le=ue.formValue,tt=ue.setFatherTabs,Fe=ue.tabs,$e=ue.editData,Dt=ue.dispatch,ot=Object(c.i)().id,ft=Object(l.useState)(["mine"]),zt=Object(P.a)(ft,2),Je=zt[0],Kt=zt[1],sn=Object(l.useState)(!0),Bt=Object(P.a)(sn,2),an=Bt[0],Qt=Bt[1],it=Object(l.useState)(!1),Ft=Object(P.a)(it,2),xt=Ft[0],kt=Ft[1],Mt=Object(l.useState)(!1),It=Object(P.a)(Mt,2),Lt=It[0],at=It[1],Ve=Object(l.useState)(""),ln=Object(P.a)(Ve,2),Yt=ln[0],cn=ln[1],qt=Object(l.useState)(!1),En=Object(P.a)(qt,2),on=En[0],ht=En[1],Ke=Object(l.useState)(!1),wt=Object(P.a)(Ke,2),Hn=wt[0],fr=wt[1],Ar=Object(l.useState)({}),Fn=Object(P.a)(Ar,2),F=Fn[0],p=Fn[1],y=Object(l.useState)([]),M=Object(P.a)(y,2),Q=M[0],W=M[1],me=Object(l.useState)([]),Ye=Object(P.a)(me,2),dt=Ye[0],jt=Ye[1],Qe=Object(l.useState)([]),Vt=Object(P.a)(Qe,2),hn=Vt[0],Rn=Vt[1],pr=Object(l.useState)([]),qn=Object(P.a)(pr,2),xn=qn[0],Rr=qn[1],qr=Object(l.useState)(null),Vn=Object(P.a)(qr,2),_t=Vn[0],Te=Vn[1],nt=Object(l.useRef)([]),Ht=Object(l.useState)(!1),Ot=Object(P.a)(Ht,2),Nt=Ot[0],Xt=Ot[1],Dn=Object(l.useState)([]),Sn=Object(P.a)(Dn,2),un=Sn[0],jn=Sn[1],Kn=Object(l.useState)([0]),ir=Object(P.a)(Kn,2),yn=ir[0],mn=ir[1],Ln=Object(l.useState)([]),en=Object(P.a)(Ln,2),Un=en[0],_n=en[1],mr=Object(l.useRef)([]),ar=Object(l.useState)(!1),gr=Object(P.a)(ar,2),fi=gr[0],Jr=gr[1],Ti=Object(l.useState)([]),ei=Object(P.a)(Ti,2),On=ei[0],ti=ei[1],Xr=Object(l.useState)([]),pi=Object(P.a)(Xr,2),ni=pi[0],ui=pi[1],si=Object(l.useRef)([]),Gt=Object(l.useState)([]),nn=Object(P.a)(Gt,2),Jt=nn[0],fn=nn[1],bn=Object(l.useState)(!1),kn=Object(P.a)(bn,2),vn=kn[0],er=kn[1],vr=Object(l.useRef)([]),gn=Object(l.useState)(0),Qr=Object(P.a)(gn,2),Tn=Qr[0],or=Qr[1],tr=Un==null?void 0:Un.filter(function(bt){return un==null?void 0:un.includes(bt.id)}),Gr=ni==null?void 0:ni.filter(function(bt){return On==null?void 0:On.includes(bt.id)});Object(l.useEffect)(function(){wi()},[]),Object(l.useEffect)(function(){return Fe===1&&(Dt({type:"globalSetting/onlyShowBackTopToggle",payload:!1}),Dt({type:"globalSetting/onlyShowBackTopIconToggle",payload:!1})),function(){Dt({type:"globalSetting/onlyShowBackTopToggle",payload:!0}),Dt({type:"globalSetting/onlyShowBackTopIconToggle",payload:!0})}},[Fe]),Object(l.useEffect)(function(){ot?$e&&cr():(Fi(Je),mi(),Qt(!1))},[$e]),Object(l.useEffect)(function(){Yt&&Ja()},[Yt]);var Ja=function(){var st=null;dt==null||dt.forEach(function(je){var Me;(Me=je.sub_disciplines)===null||Me===void 0||Me.forEach(function(Et){var mt;(mt=Et.tag_disciplines)===null||mt===void 0||mt.forEach(function(Ct){var Zt,dn=((Zt=Ct.name)===null||Zt===void 0?void 0:Zt.includes(Yt))&&Ct.item_count!==0;dn&&!st&&(st=je.id)})})}),st&&Te(st)},Qa=function(st){function je(Me){var Et=Me.children,mt=Array.isArray(Et)&&Et.length>0,Ct=Me==null?void 0:Me.group_id;return vr.current.push({name:Me==null?void 0:Me.name,id:Ct,count:Me==null?void 0:Me.count}),{title:i.a.createElement("div",{title:Me==null?void 0:Me.name,className:B.a.name},Me==null?void 0:Me.name,"\uFF08".concat(Me==null?void 0:Me.count,"\uFF09")),value:Ct,name:Me==null?void 0:Me.name,key:Ct,count:Me==null?void 0:Me.count,id:Ct,icon:i.a.createElement("i",{className:"iconfont icon-wenjianjia2 c-light-primary mr10",style:{lineHeight:"19px"}}),children:mt?Et==null?void 0:Et.map(function(Zt){return je(Zt)}):[]}}return st==null?void 0:st.map(function(Me){return je(Me)})},wi=function(){var bt=Object(O.a)(h.a.mark(function st(){var je,Me;return h.a.wrap(function(mt){for(;;)switch(mt.prev=mt.next){case 0:return mt.next=2,Object(te.A)({});case 2:je=mt.sent,vr.current=[{id:0,name:"\u6839\u76EE\u5F55",count:je==null?void 0:je.root_count}],je!=null&&je.data&&(Me=[{title:i.a.createElement("div",{title:"\u6839\u76EE\u5F55",className:B.a.name},"\u6839\u76EE\u5F55","\uFF08".concat((je==null?void 0:je.root_count)||0,"\uFF09")),value:0,id:0,key:0,count:je==null?void 0:je.root_count,name:"\u6839\u76EE\u5F55",icon:i.a.createElement("i",{className:"iconfont icon-wenjianjia2 c-light-primary mr10",style:{lineHeight:"19px"}}),children:Qa(je.data||[])}],_n(vr.current),fn(Me));case 5:case"end":return mt.stop()}},st)}));return function(){return bt.apply(this,arguments)}}(),cr=function(){var bt=Object(O.a)(h.a.mark(function st(){var je,Me,Et,mt,Ct,Zt,dn,Mn,An,In,wn,nr,Gn,zn,yr,sr,Qn,br;return h.a.wrap(function(rn){for(;;)switch(rn.prev=rn.next){case 0:return In=$e==null||((je=$e.tag_disciplines)===null||je===void 0)?void 0:je.map(function(Cn){return Cn.tag_discipline_id}),wn=$e==null||((Me=$e.groups)===null||Me===void 0)?void 0:Me.map(function(Cn){return Cn.id}),nr={source:$e==null||((Et=$e.examination_bank)===null||Et===void 0)?void 0:Et.source,group_ids:wn,tag_discipline_ids:In,teach_group_ids:$e==null?void 0:$e.teach_group_ids},rn.next=5,Object(lt.a)("/api/examination_intelligent_settings/form_paper.json",{method:"post",body:nr});case 5:if(Gn=rn.sent,!((Gn==null?void 0:Gn.status)===-1)){rn.next=8;break}return rn.abrupt("return");case 8:zn=Gn==null?void 0:Gn.filter(function(Cn){var $n;return!!(Cn!=null&&($n=Cn.item_banks)!==null&&$n!==void 0&&$n.length)}),zn=zn.map(function(Cn){return Object(L.a)(Object(L.a)({},Cn),{},{scoreTotal:0,score:0,questionTotal:0})}),zn=(mt=zn)===null||mt===void 0?void 0:mt.map(function(Cn,$n){var Er,lr,Mr;return Object(L.a)(Object(L.a)({},Cn),{},{score:($e==null||((Er=$e.score_settings)===null||Er===void 0||((lr=Er.find(function(Ir){return Ir.item_type===(Cn==null?void 0:Cn.item_type)}))===null||lr===void 0))?void 0:lr.score)||0,item_banks:Cn==null||((Mr=Cn.item_banks)===null||Mr===void 0)?void 0:Mr.map(function(Ir){var Bn;return Object(L.a)(Object(L.a)({},Ir),{},{tag_disciplines:Ir==null||((Bn=Ir.tag_disciplines)===null||Bn===void 0)?void 0:Bn.map(function(Xn){var xr;return Object(L.a)(Object(L.a)({},Xn),{},{difficulties:Xn==null||((xr=Xn.difficulties)===null||xr===void 0)?void 0:xr.map(function(Pr){var _r=$e==null?void 0:$e.contents.find(function(Br){return Br.item_type===Cn.item_type&&Br.sub_discipline_id===Ir.sub_discipline_id&&Br.tag_discipline_id===Xn.tag_discipline_id&&Br.difficulty===Pr.difficulty});return _r?Object(L.a)(Object(L.a)({},Pr),{},{num:_r==null?void 0:_r.quanlity}):Object(L.a)({},Pr)})})})})})})}),yr=Ai(zn),sr=yr.panel,Qn=yr.score_num_item,zn=(Ct=zn)===null||Ct===void 0?void 0:Ct.map(function(Cn,$n){var Er,lr=(sr==null||((Er=sr[$n])===null||Er===void 0)?void 0:Er.reduce(function(Mr,Ir){return Mr+Ir},0))||0;return Object(L.a)(Object(L.a)({},Cn),{},{scoreTotal:lr*(Qn[$n]||0),questionTotal:lr})}),br=[],$e==null||((Zt=$e.sort_by_item_type)===null||Zt===void 0)||Zt.forEach(function(Cn){var $n=zn.find(function(Er){var lr,Mr=(lr=Ri.find(function(Ir){return Ir.type===(Er==null?void 0:Er.item_type)}))===null||lr===void 0?void 0:lr.name;return Mr===Cn});br.push($n)}),br=Object(ke.compact)(br),Fi($e==null||((dn=$e.examination_bank)===null||dn===void 0)?void 0:dn.source),mi(),Kt($e==null||((Mn=$e.examination_bank)===null||Mn===void 0)?void 0:Mn.source),Rr(In),nt.current=In,jn(wn),ti(($e==null?void 0:$e.teach_group_ids)||[]),or($e==null||((An=$e.groups)===null||An===void 0)?void 0:An.map(function(Cn){return Cn.count}).reduce(function(Cn,$n){return Cn+$n},0)),mr.current=wn,mn(wn!=null&&wn.length?wn:[0]),W(Object(ke.cloneDeep)(br)),Qt(!1);case 29:case"end":return rn.stop()}},st)}));return function(){return bt.apply(this,arguments)}}(),Za=function(){var bt=Object(O.a)(h.a.mark(function st(){var je;return h.a.wrap(function(Et){for(;;)switch(Et.prev=Et.next){case 0:je={source:Je,group_ids:un,tag_discipline_ids:xn,teach_group_ids:On},di(je),nt.current=xn,ht(!1);case 4:case"end":return Et.stop()}},st)}));return function(){return bt.apply(this,arguments)}}(),Fi=function(){var bt=Object(O.a)(h.a.mark(function st(je){var Me,Et,mt,Ct,Zt,dn;return h.a.wrap(function(An){for(;;)switch(An.prev=An.next){case 0:return An.next=2,Object(lt.a)("/api/disciplines.json",{method:"get",params:{source:"question",question_source:je}});case 2:mt=An.sent,Ct=[],mt==null||((Me=mt.disciplines)===null||Me===void 0)||Me.forEach(function(In){var wn;In==null||((wn=In.sub_disciplines)===null||wn===void 0)||wn.forEach(function(nr){Ct=Ct.concat((nr==null?void 0:nr.tag_disciplines)||[])})}),Zt=null,dn=mt==null||((Et=mt.disciplines)===null||Et===void 0)?void 0:Et.map(function(In){var wn,nr=In==null||((wn=In.sub_disciplines)===null||wn===void 0)?void 0:wn.reduce(function(Gn,zn){return Gn+zn.item_count},0);return!Zt&&nr!==0&&(Zt=In.id),Object(L.a)(Object(L.a)({},In),{},{item_count:nr})}),console.log(dn,48767874),jt(dn),Rn(Ct),Te(Zt);case 11:case"end":return An.stop()}},st)}));return function(je){return bt.apply(this,arguments)}}(),mi=function(){var bt=Object(O.a)(h.a.mark(function st(){var je;return h.a.wrap(function(Et){for(;;)switch(Et.prev=Et.next){case 0:return Et.next=2,Object(lt.a)("/api/teach_groups.json",{method:"get",params:{is_random_exam:!0}});case 2:je=Et.sent,ui((je==null?void 0:je.groups)||[]);case 4:case"end":return Et.stop()}},st)}));return function(){return bt.apply(this,arguments)}}(),di=function(){var bt=Object(O.a)(h.a.mark(function st(je){var Me,Et;return h.a.wrap(function(Ct){for(;;)switch(Ct.prev=Ct.next){case 0:return Qt(!0),Ct.next=3,Object(lt.a)("/api/examination_intelligent_settings/form_paper.json",{method:"post",body:je});case 3:Me=Ct.sent,Et=Me==null?void 0:Me.filter(function(Zt){var dn;return!!(Zt!=null&&(dn=Zt.item_banks)!==null&&dn!==void 0&&dn.length)}),Et=Et.map(function(Zt){return Object(L.a)(Object(L.a)({},Zt),{},{scoreTotal:0,score:0,questionTotal:0})}),W(Et),Qt(!1);case 8:case"end":return Ct.stop()}},st)}));return function(je){return bt.apply(this,arguments)}}(),wa=function(){Rr(nt.current),ht(!1),cn("")},qa=function(st){Rr(st)},ta=function(){for(var st=hn==null?void 0:hn.filter(function(Mn){return xn==null?void 0:xn.includes(Mn.id)}),je=Object(Z.a)(st),Me=0,Et=[],mt=0;mt1&&st!==0&&(je=gi(Me,st,st-1)),W(je)},ji=function(st){var je=[],Me=Object(ke.cloneDeep)(Q);Me.length>1&&st!==Me.length-1&&(je=gi(Me,st,st+1)),W(je)},Li=function(){var bt=Object(O.a)(h.a.mark(function st(je){var Me,Et,mt,Ct;return h.a.wrap(function(dn){for(;;)switch(dn.prev=dn.next){case 0:if(mt=Object(Z.a)(Je),Je.includes(je)?mt=mt.filter(function(Mn){return Mn!==je}):mt.push(je),!(mt.length===0)){dn.next=5;break}return z.b.warn("\u8BD5\u9898\u6765\u6E90\u4E3A\u5FC5\u9009\u9879"),dn.abrupt("return");case 5:(Me=mt)!==null&&Me!==void 0&&Me.includes("mine")||(jn([]),mr.current=[]),(Et=mt)!==null&&Et!==void 0&&Et.includes("teach_groups")||(ti([]),si.current=[]),Kt(mt),Fi(mt),Rr([]),nt.current=[],Ct={source:mt,group_ids:mr.current,tag_discipline_ids:[],teach_group_ids:si.current},di(Ct);case 13:case"end":return dn.stop()}},st)}));return function(je){return bt.apply(this,arguments)}}(),La=function(st){var je={1:"\u4E00",2:"\u4E8C",3:"\u4E09",4:"\u56DB",5:"\u4E94",6:"\u516D",7:"\u4E03"};if(!st)return;var Me=st||{},Et=Me.exam,mt=Me.single_questions,Ct=Me.multiple_questions,Zt=Me.judgement_questions,dn=Me.program_questions,Mn=Me.completion_questions,An=Me.subjective_questions,In=Me.practical_questions,wn=Me.combination_questions,nr=[Object(L.a)({type:"SINGLE",name:"\u5355\u9009\u9898"},mt),Object(L.a)({type:"MULTIPLE",name:"\u591A\u9009\u9898"},Ct),Object(L.a)({type:"COMPLETION",name:"\u586B\u7A7A\u9898"},Mn),Object(L.a)({type:"JUDGMENT",name:"\u5224\u65AD\u9898"},Zt),Object(L.a)({type:"SUBJECTIVE",name:"\u7B80\u7B54\u9898"},An),Object(L.a)({type:"PROGRAM",name:"\u7F16\u7A0B\u9898"},dn),Object(L.a)({type:"PRACTICAL",name:"\u5B9E\u8BAD\u9898"},In),Object(L.a)({type:"COMBINATION",name:"\u7EC4\u5408\u9898"},wn)],Gn=[],zn=0,yr=0,sr=nr.filter(function(Qn){return Qn.questions_count>0}).map(function(Qn,br){var kr;return(kr=Qn.questions)===null||kr===void 0||kr.forEach(function(rn){Gn.push(rn.id),zn=zn+rn.score,yr=yr+1}),Object(L.a)(Object(L.a)({},Qn),{number:je[br+1]})});return{all_questions_count:yr,all_score:zn,questionList:sr,ids:Gn,exam:Et}},Zr=function(st){var je,Me,Et=Object(ke.cloneDeep)(F),mt=Object(ke.cloneDeep)(Q);Et.questionList=Et==null||((je=Et.questionList)===null||je===void 0)?void 0:je.map(function(Ct){return Ct.type===st.type?Object(L.a)(Object(L.a)({},Ct),{},{questions_score:st.scoreTotal}):Ct}),mt=(Me=mt)===null||Me===void 0?void 0:Me.map(function(Ct){return Ct.item_type===st.type?Object(L.a)(Object(L.a)({},Ct),{},{score:st.score,scoreTotal:st.scoreTotal}):Ct}),W(mt),p(Et),console.log(st,F,Q)},ii=dt==null||((we=dt.find(function(bt){return bt.id===_t}))===null||we===void 0)?void 0:we.sub_disciplines,Pi=ta();return Hn?i.a.createElement(Ze.a,{loading:xt,submit:Ra,goBack:function(){return fr(!1)},data:F,onTypeScore:Zr,onExchange:na}):i.a.createElement("section",{className:B.a.wrap,style:{display:Fe?"flex":"none"}},i.a.createElement("div",{id:"id_left",className:B.a.left,onMouseEnter:function(st){var je=document.getElementById("id_left");je.style.overflowY="auto"},onMouseLeave:function(st){var je=document.getElementById("id_left");je.style.overflowY="hidden"}},i.a.createElement($.a,{loading:an,active:!0,paragraph:{rows:5}},Q.map(function(bt,st){var je;return i.a.createElement("div",{className:B.a.list,key:st},i.a.createElement("div",{className:B.a.name},i.a.createElement("b",null),i.a.createElement("span",null,(je=Ri.find(function(Me){return Me.type===(bt==null?void 0:bt.item_type)}))===null||je===void 0?void 0:je.name)),i.a.createElement("aside",null,i.a.createElement("div",null,"\u5171",i.a.createElement("span",{className:B.a.b},bt.questionTotal),"\u9898",i.a.createElement("span",{className:B.a.l},"|"),"\u5171",i.a.createElement("span",{className:B.a.r},bt.scoreTotal),"\u5206"),i.a.createElement("div",null,st>0?i.a.createElement(k.a,{getPopupContainer:function(Et){return document.getElementById("id_left")},title:"\u4E0A\u79FB"},i.a.createElement("span",{onClick:function(){return ri(st)},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"})),st"),i.a.createElement("span",{className:"current",onClick:function(){return C.d.push("/paperlibrary")}},"\u8BD5\u5377\u5E93>"),i.a.createElement("span",{style:{color:"#bebebe"}},"\u968F\u673A\u7EC4\u5377")),ot===0&&i.a.createElement(f,{value:ot,onChange:cn}),ot===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(A.a,{className:m.a.formWrap,form:Kt,layout:"horizontal",onValuesChange:ln},i.a.createElement(A.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(S.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(A.a.Item,{label:"\u7B54\u9898\u65F6\u957F:",name:"time",rules:[{required:!0,message:"\u7B54\u9898\u65F6\u957F\u4E0D\u80FD\u4E3A\u7A7A"}]},i.a.createElement(I.a,{min:1,parser:qt,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(A.a.Item,{label:"\u8BD5\u9898\u96BE\u5EA6",name:"difficulty",rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u96BE\u5EA6"}]},i.a.createElement(N.a.Group,{style:{display:"flex",width:286,justifyContent:"space-between"},size:"large"},i.a.createElement(N.a.Button,{className:m.a.rb,value:1},"\u7B80\u5355"),i.a.createElement(N.a.Button,{className:m.a.rb,value:2},"\u9002\u4E2D"),i.a.createElement(N.a.Button,{className:m.a.rb,value:3},"\u56F0\u96BE"))),i.a.createElement(A.a.Item,{label:"\u8003\u8BD5\u987B\u77E5",name:"exam_notes"},i.a.createElement(ne,{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(Y.a,{className:"mr40",onClick:function(){return C.d.push("/paperlibrary")}},"\u8FD4\u56DE"),i.a.createElement(Y.a,{type:"primary",onClick:Object(O.a)(h.a.mark(function En(){return h.a.wrap(function(ht){for(;;)switch(ht.prev=ht.next){case 0:return ht.next=2,Kt.validateFields();case 2:ft(1);case 3:case"end":return ht.stop()}},En)}))},"\u4E0B\u4E00\u6B65"))),i.a.createElement(be,{tabs:ot,dispatch:Fe,editData:Lt,setFatherTabs:ft,formValue:an})))},ae=Xe.default=Object(C.a)(function(ce){var ue=ce.paperlibrary,we=ce.user,Le=ce.globalSetting;return{paperlibrary:ue,user:we,globalSetting:Le}})(re)},"E/GV":function(rt,Xe,X){rt.exports=X.p+"static/swenjianjia.1640bf70.svg"},ELLl:function(rt,Xe,X){(function(oe){oe(X("VrN/"))})(function(oe){var $={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},D=oe.Pos;oe.defineOption("autoCloseBrackets",!1,function(S,x,h){h&&h!=oe.Init&&(S.removeKeyMap(U),S.state.closeBrackets=null),x&&(N(Y(x,"pairs")),S.state.closeBrackets=x,S.addKeyMap(U))});function Y(S,x){return x=="pairs"&&typeof S=="string"?S:typeof S=="object"&&S[x]!=null?S[x]:$[x]}var U={Backspace:O,Enter:L};function N(S){for(var x=0;x=0;i--){var C=l[i].head;S.replaceRange("",D(C.line,C.ch-1),D(C.line,C.ch+1),"+delete")}}function L(S){var x=I(S),h=x&&Y(x,"explode");if(!h||S.getOption("disableInput"))return oe.Pass;for(var l=S.listSelections(),i=0;i0;return{anchor:new D(S.anchor.line,S.anchor.ch+(x?-1:1)),head:new D(S.head.line,S.head.ch+(x?1:-1))}}function A(S,x){var h=I(S);if(!h||S.getOption("disableInput"))return oe.Pass;var l=Y(h,"pairs"),i=l.indexOf(x);if(i==-1)return oe.Pass;for(var c=Y(h,"closeBefore"),C=Y(h,"triples"),v=l.charAt(i+1)==x,m=S.listSelections(),u=i%2==0,E,d=0;d=0&&S.getRange(s,D(s.line,s.ch+3))==x+x+x?o="skipThree":o="skip";else if(v&&s.ch>1&&C.indexOf(x)>=0&&S.getRange(D(s.line,s.ch-2),s)==x+x){if(s.ch>2&&/\bstring/.test(S.getTokenTypeAt(D(s.line,s.ch-2))))return oe.Pass;o="addFour"}else if(v){var g=s.ch==0?" ":S.getRange(D(s.line,s.ch-1),s);if(!oe.isWordChar(b)&&g!=x&&!oe.isWordChar(g))o="both";else return oe.Pass}else if(u&&(b.length===0||/\s/.test(b)||c.indexOf(b)>-1))o="both";else return oe.Pass;if(!E)E=o;else if(E!=o)return oe.Pass}var _=i%2?l.charAt(i-1):x,k=i%2?x:l.charAt(i+1);S.operation(function(){if(E=="skip")S.execCommand("goCharRight");else if(E=="skipThree")for(var H=0;H<3;H++)S.execCommand("goCharRight");else if(E=="surround"){for(var z=S.getSelections(),H=0;H1&&arguments[1]!==void 0?arguments[1]:1,be=ke.length,ne=0;ne1&&arguments[1]!==void 0?arguments[1]:!1;return Object(u.a)(B).map(function(de,pe){if(!U.isValidElement(de)||!de.type)return null;var ye=de.type.isSelectOptGroup,Ce=de.key,_e=de.props,le=_e.children,se=Object(K.a)(_e,["children"]);return te||!ye?E(de):Object(m.a)(Object(m.a)({key:"__RC_SELECT_GRP__".concat(Ce===null?pe:Ce,"__"),label:Ce},se),{},{options:d(le)})}).filter(function(de){return de})}var f=X("2Qr1"),s=X("qNPg"),o=X("U8pU"),b=X("Kwbf"),g=X("WKfj");function _(B){var te=B.mode,de=B.options,pe=B.children,ye=B.backfill,Ce=B.allowClear,_e=B.placeholder,le=B.getInputElement,se=B.showSearch,ve=B.onSearch,ie=B.defaultOpen,q=B.autoFocus,xe=B.labelInValue,Ie=B.value,Ne=B.inputValue,De=B.optionLabelProp,Be=te==="multiple"||te==="tags",Ae=se!==void 0?se:Be||te==="combobox",Pe=de||d(pe);if(Object(b.a)(te!=="tags"||Pe.every(function(Ge){return!Ge.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),te==="tags"||te==="combobox"){var We=Pe.some(function(Ge){return Ge.options?Ge.options.some(function(ke){return typeof("value"in ke?ke.value:ke.key)=="number"}):typeof("value"in Ge?Ge.value:Ge.key)=="number"});Object(b.a)(!We,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(b.a)(te!=="combobox"||!De,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(b.a)(te==="combobox"||!ye,"`backfill` only works with `combobox` mode."),Object(b.a)(te==="combobox"||!le,"`getInputElement` only work with `combobox` mode."),Object(b.b)(te!=="combobox"||!le||!Ce||!_e,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),ve&&!Ae&&te!=="combobox"&&te!=="tags"&&Object(b.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(b.b)(!ie||q,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),Ie!=null){var ze=Object(g.d)(Ie);Object(b.a)(!xe||ze.every(function(Ge){return Object(o.a)(Ge)==="object"&&("key"in Ge||"value"in Ge)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(b.a)(!Be||Array.isArray(Ie),"`value` should be array when `mode` is `multiple` or `tags`")}if(pe){var qe=null;Object(u.a)(pe).some(function(Ge){if(!U.isValidElement(Ge)||!Ge.type)return!1;var ke=Ge.type;if(ke.isSelectOption)return!1;if(ke.isSelectOptGroup){var ct=Object(u.a)(Ge.props.children).every(function(ut){return!U.isValidElement(ut)||!Ge.type||ut.type.isSelectOption?!0:(qe=ut.type,!1)});return!ct}return qe=ke,!0}),qe&&Object(b.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(qe.displayName||qe.name||qe,"`.")),Object(b.a)(Ne===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var k=_,H=Object(s.a)({prefixCls:"rc-select",components:{optionList:l},convertChildrenToData:d,flattenOptions:f.d,getLabeledValue:f.e,filterOptions:f.b,isValueDisabled:f.g,findValueOption:f.c,warningProps:k,fillOptionsWithMissingValue:f.a}),z=function(B){Object(D.a)(de,B);var te=Object(Y.a)(de);function de(){var pe;return Object(oe.a)(this,de),pe=te.apply(this,arguments),pe.selectRef=U.createRef(),pe.focus=function(){pe.selectRef.current.focus()},pe.blur=function(){pe.selectRef.current.blur()},pe}return Object($.a)(de,[{key:"render",value:function(){return U.createElement(H,Object.assign({ref:this.selectRef},this.props))}}]),de}(U.Component);z.Option=c,z.OptGroup=v;var Z=z,G=Xe.c=Z},M8RZ:function(rt,Xe,X){"use strict";X.d(Xe,"a",function(){return O});var oe=X("fWQN"),$=X("mtLc"),D=X("yKVA"),Y=X("879j"),U=X("q1tI"),N=X.n(U),K=X("i8i4"),I=X.n(K),O=function(L){Object(D.a)(A,L);var T=Object(Y.a)(A);function A(P){var w;Object(oe.a)(this,A),w=T.call(this,P);var S=window.document;return w.node=S.createElement("div"),S.body.appendChild(w.node),w}return Object($.a)(A,[{key:"render",value:function(){var w=this.props.children;return Object(K.createPortal)(w,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),A}(N.a.Component)},NvD2:function(rt,Xe,X){"use strict";X.d(Xe,"a",function(){return N});var oe=X("Kwbf");function $(K,I){var O=new Set;return K.forEach(function(L){I.has(L)||O.add(L)}),O}function D(K){var I=K||{},O=I.disabled,L=I.disableCheckbox,T=I.checkable;return!!(O||L)||T===!1}function Y(K,I,O,L){for(var T=new Set(K),A=new Set,P=0;P<=O;P+=1){var w=I.get(P)||new Set;w.forEach(function(l){var i=l.key,c=l.node,C=l.children,v=C===void 0?[]:C;T.has(i)&&!L(c)&&v.filter(function(m){return!L(m.node)}).forEach(function(m){T.add(m.key)})})}for(var S=new Set,x=O;x>=0;x-=1){var h=I.get(x)||new Set;h.forEach(function(l){var i=l.parent,c=l.node;if(L(c)||!l.parent||S.has(l.parent.key))return;if(L(l.parent.node)){S.add(i.key);return}var C=!0,v=!1;(i.children||[]).filter(function(m){return!L(m.node)}).forEach(function(m){var u=m.key,E=T.has(u);C&&!E&&(C=!1),!v&&(E||A.has(u))&&(v=!0)}),C&&T.add(i.key),v&&A.add(i.key),S.add(i.key)})}return{checkedKeys:Array.from(T),halfCheckedKeys:Array.from($(A,T))}}function U(K,I,O,L,T){for(var A=new Set(K),P=new Set(I),w=0;w<=L;w+=1){var S=O.get(w)||new Set;S.forEach(function(i){var c=i.key,C=i.node,v=i.children,m=v===void 0?[]:v;!A.has(c)&&!P.has(c)&&!T(C)&&m.filter(function(u){return!T(u.node)}).forEach(function(u){A.delete(u.key)})})}P=new Set;for(var x=new Set,h=L;h>=0;h-=1){var l=O.get(h)||new Set;l.forEach(function(i){var c=i.parent,C=i.node;if(T(C)||!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 E=u.key,d=A.has(E);v&&!d&&(v=!1),!m&&(d||P.has(E))&&(m=!0)}),v||A.delete(c.key),m&&P.add(c.key),x.add(c.key)})}return{checkedKeys:Array.from(A),halfCheckedKeys:Array.from($(P,A))}}function N(K,I,O,L){var T=[],A;L?A=L:A=D;var P=new Set(K.filter(function(h){var l=!!O[h];return l||T.push(h),l})),w=new Map,S=0;Object.keys(O).forEach(function(h){var l=O[h],i=l.level,c=w.get(i);c||(c=new Set,w.set(i,c)),c.add(l),S=Math.max(S,i)}),Object(oe.a)(!T.length,"Tree missing follow keys: ".concat(T.slice(0,100).map(function(h){return"'".concat(h,"'")}).join(", ")));var x;return I===!0?x=Y(P,w,S,A):x=U(P,I.halfCheckedKeys,w,S,A),x}},O2Wb:function(rt,Xe,X){rt.exports={flex:"flex___2gmSR",flex1:"flex1___3Tu1g",color666:"color666___2uyGL",error:"error___yJ86W",deleteIcon:"deleteIcon___1D2tg",addIcon:"addIcon___2VIYB"}},OLES:function(rt,Xe,X){"use strict";var oe=X("U8pU"),$=X("VTBJ"),D=X("Ff2n"),Y=X("q1tI"),U=X("uciX"),N=X("7ixt"),K=function(P){var w=P.overlay,S=P.prefixCls,x=P.id,h=P.overlayInnerStyle;return Y.createElement("div",{className:"".concat(S,"-inner"),id:x,role:"tooltip",style:h},typeof w=="function"?w():w)},I=K,O=function(P,w){var S=P.overlayClassName,x=P.trigger,h=x===void 0?["hover"]:x,l=P.mouseEnterDelay,i=l===void 0?0:l,c=P.mouseLeaveDelay,C=c===void 0?.1:c,v=P.overlayStyle,m=P.prefixCls,u=m===void 0?"rc-tooltip":m,E=P.children,d=P.onVisibleChange,f=P.afterVisibleChange,s=P.transitionName,o=P.animation,b=P.placement,g=b===void 0?"right":b,_=P.align,k=_===void 0?{}:_,H=P.destroyTooltipOnHide,z=H===void 0?!1:H,Z=P.defaultVisible,G=P.getTooltipContainer,B=P.overlayInnerStyle,te=Object(D.a)(P,["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle"]),de=Object(Y.useRef)(null);Object(Y.useImperativeHandle)(w,function(){return de.current});var pe=Object($.a)({},te);"visible"in P&&(pe.popupVisible=P.visible);var ye=function(){var ve=P.arrowContent,ie=ve===void 0?null:ve,q=P.overlay,xe=P.id;return[Y.createElement("div",{className:"".concat(u,"-arrow"),key:"arrow"},ie),Y.createElement(I,{key:"content",prefixCls:u,id:xe,overlay:q,overlayInnerStyle:B})]},Ce=!1,_e=!1;if(typeof z=="boolean")Ce=z;else if(z&&Object(oe.a)(z)==="object"){var le=z.keepParent;Ce=le===!0,_e=le===!1}return Y.createElement(U.a,Object.assign({popupClassName:S,prefixCls:u,popup:ye,action:h,builtinPlacements:N.a,popupPlacement:g,ref:de,popupAlign:k,getPopupContainer:G,onPopupVisibleChange:d,afterPopupVisibleChange:f,popupTransitionName:s,popupAnimation:o,defaultPopupVisible:Z,destroyPopupOnHide:Ce,autoDestroy:_e,mouseLeaveDelay:C,popupStyle:v,mouseEnterDelay:i},pe),E)},L=Object(Y.forwardRef)(O),T=Xe.a=L},OZM5:function(rt,Xe,X){"use strict";X.d(Xe,"b",function(){return L}),X.d(Xe,"a",function(){return T}),X.d(Xe,"k",function(){return A}),X.d(Xe,"h",function(){return P}),X.d(Xe,"i",function(){return w}),X.d(Xe,"g",function(){return S}),X.d(Xe,"c",function(){return x}),X.d(Xe,"d",function(){return h}),X.d(Xe,"j",function(){return c}),X.d(Xe,"e",function(){return C}),X.d(Xe,"f",function(){return v});var oe=X("KQm4"),$=X("U8pU"),D=X("Ff2n"),Y=X("q1tI"),U=X.n(Y),N=X("Kwbf"),K=X("WaYH"),I=.25,O=2;function L(m,u){var E=m.slice(),d=E.indexOf(u);return d>=0&&E.splice(d,1),E}function T(m,u){var E=m.slice();return E.indexOf(u)===-1&&E.push(u),E}function A(m){return m.split("-")}function P(m,u){return"".concat(m,"-").concat(u)}function w(m){return m&&m.type&&m.type.isTreeNode}function S(m,u){var E=[m],d=u[m];function f(){var s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];s.forEach(function(o){var b=o.key,g=o.children;E.push(b),f(g)})}return f(d.children),E}function x(m,u){var E=m.clientY,d=u.selectHandle.getBoundingClientRect(),f=d.top,s=d.bottom,o=d.height,b=Math.max(o*I,O);return E<=f+b?-1:E>=s-b?1:0}function h(m,u){if(!m)return;var E=u.multiple;return E?m.slice():m.length?[m[0]]:m}var l=function(u){return u};function i(m,u){if(!m)return[];var E=u||{},d=E.processProps,f=d===void 0?l:d,s=Array.isArray(m)?m:[m];return s.map(function(o){var b=o.children,g=Object(D.a)(o,["children"]),_=i(b,u);return U.a.createElement(K.a,Object.assign({},f(g)),_)})}function c(m){if(!m)return null;var u;if(Array.isArray(m))u={checkedKeys:m,halfCheckedKeys:void 0};else if(Object($.a)(m)==="object")u={checkedKeys:m.checked||void 0,halfCheckedKeys:m.halfChecked||void 0};else return Object(N.a)(!1,"`checkedKeys` is not an array or an object"),null;return u}function C(m,u){var E=new Set;function d(f){if(E.has(f))return;var s=u[f];if(!s)return;E.add(f);var o=s.parent,b=s.node;if(b.disabled)return;o&&d(o.key)}return(m||[]).forEach(function(f){d(f)}),Object(oe.a)(E)}function v(m){var u={};return Object.keys(m).forEach(function(E){(E.startsWith("data-")||E.startsWith("aria-"))&&(u[E]=m[E])}),u}},Ot1p:function(rt,Xe,X){"use strict";var oe=X("2qtc"),$=X("kLXV"),D=X("rAM+"),Y=X("miYZ"),U=X("tsqr"),N=X("9og8"),K=X("tJVT"),I=X("jrin"),O=X("WmNS"),L=X.n(O),T=X("q1tI"),A=X.n(T),P=X("VrN/"),w=X.n(P),S=X("bdgK"),x=X("p77/"),h=X("Bd2K"),l=X("ELLl"),i=X("19Vz"),c=X("lZu9"),C=X("+NIl"),v=X("kSUc"),m=X("9Bee"),u=function(ue){var we=ue.value,Le=we===void 0?"":we,tt=ue.className,Fe=ue.showTextOnly,$e=ue.showLines,Dt=ue.style,ot=Dt===void 0?{}:Dt,ft=Object(T.useMemo)(function(){return""},[Le]);return A.a.createElement(A.a.Fragment,null,A.a.createElement("div",{dangerouslySetInnerHTML:{__html:ft}}))},E=X("0Owb"),d=X("dejd"),f=X("C+DQ"),s=X("1vsH"),o=X("m3rI"),b=[{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 g(ue){var we=ue.onActionCallback,Le=ue.title,tt=ue.icon,Fe=ue.actionName,$e=ue.className,Dt=$e===void 0?"":$e,ot=ue.children;function ft(){we(Fe)}return A.a.createElement("a",{title:Le,className:Dt,onClick:ft},A.a.createElement("i",{className:"md-iconfont ".concat(tt)}),ot)}var _=function(ue){var we=ue.watch,Le=ue.showNullButton,tt=ue.onActionCallback,Fe=ue.fullScreen,$e=ue.insertTemp,Dt=ue.hidetoolBar,ot=ue.uuid,ft=ue.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(s.F)("_educoder_session_login"),"&_educoder_session=").concat(Object(s.F)("_educoder_session"),"&key=").concat(ot,"&api=").concat(encodeURIComponent(o.a.PROXY_SERVER)));var zt=[].concat(b,[{title:"".concat(we?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(we?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return A.a.createElement("ul",{className:"markdown-toolbar-container"},!Dt&&zt.map(function(Je,Kt){return A.a.createElement("li",{key:Kt},Je.actionName?A.a.createElement(g,Object(E.a)({},Je,{onActionCallback:tt})):A.a.createElement("span",{className:"v-line"}))}),Le?A.a.createElement("li",null,A.a.createElement(g,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:tt},A.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,$e&&A.a.createElement("li",null,A.a.createElement(g,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat($e),onActionCallback:tt},A.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),A.a.createElement("li",{className:"btn-full-screen"},A.a.createElement(g,{icon:"".concat(Fe?"icon-shrink":"icon-enlarge"),title:Fe?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:tt})))},k=X("M8RZ"),H=X("+L6B"),z=X("2/Rp"),Z=X("y8nQ"),G=X("Vl3Y"),B=X("5NDa"),te=X("5rEg"),de={labelCol:{span:4},wrapperCol:{span:20}},pe=function(ue){var we=ue.callback,Le=ue.onCancel;function tt(Fe){we(Fe)}return A.a.createElement(G.a,Object(E.a)({},de,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:tt}),A.a.createElement(G.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},A.a.createElement(te.a,null)),A.a.createElement(G.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},A.a.createElement(te.a,null)),A.a.createElement("div",{className:"flex-container flex-end"},A.a.createElement(z.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),A.a.createElement(z.a,{type:"ghost",onClick:Le},"\u53D6\u6D88")))},ye=X("7ahc"),Ce=X("HmJG"),_e=X("BjJ7"),le=G.a.useForm,se={width:280,marginRight:10},ve={labelCol:{span:5},wrapperCol:{span:19}},ie=function(ue){var we=ue.callback,Le=ue.onCancel,tt=le(),Fe=Object(K.a)(tt,1),$e=Fe[0];function Dt(zt){we(zt)}function ot(zt,Je){if(zt.status===-1){U.b.error(zt.message);return}$e.setFieldsValue({src:"/api/attachments/".concat(zt.id),type:Je.type})}function ft(zt){var Je=zt.target.files[0];xe(Je,ot)}return A.a.createElement(G.a,Object(E.a)({form:$e},ve,{className:"upload-image-panel",onFinish:Dt}),A.a.createElement(G.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},A.a.createElement("div",{className:"flex-container"},A.a.createElement(G.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},A.a.createElement(te.a,{style:se})),A.a.createElement(q,{onFileChange:ft}))),A.a.createElement(G.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt"},A.a.createElement(te.a,{style:{width:264}})),A.a.createElement(G.a.Item,{style:{textAlign:"right"}},A.a.createElement(z.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),A.a.createElement(z.a,{type:"ghost",onClick:Le},"\u53D6\u6D88")))};function q(ue){var we=ue.onFileChange;return A.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",A.a.createElement("input",{type:"file",onChange:we}))}function xe(ue,we){if(!ue)throw new String("\u6CA1\u6709\u6587\u4EF6");var Le=new FormData;Le.append("editormd-image-file",ue),Le.append("file_param_name","editormd-image-file"),Le.append("byxhr","true");var tt=new window.XMLHttpRequest;tt.withCredentials=!0,tt.addEventListener("load",function(Fe){we(JSON.parse(Fe.target.responseText),ue)},!1),tt.addEventListener("error",function(Fe){console.error(Fe)},!1),tt.open("POST","".concat(_e.a,"/api/attachments.json")),tt.send(Le)}var Ie=X("giR+"),Ne=X("fyUT"),De=X("7Kak"),Be=X("9yH6"),Ae=Be.a.Group,Pe={margin:"0 8px"},We=function(ue){var we=ue.callback,Le=ue.onCancel;function tt(Fe){we(Fe)}return A.a.createElement(G.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:tt},A.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},A.a.createElement("span",{style:Pe},"\u5355\u5143\u683C\u6570\uFF1A"),A.a.createElement("span",{style:Pe},"\u884C\u6570"),A.a.createElement(G.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},A.a.createElement(Ne.a,null)),A.a.createElement("span",{style:Pe},"\u5217\u6570"),A.a.createElement(G.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},A.a.createElement(Ne.a,null))),A.a.createElement("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"}},A.a.createElement("span",{style:Pe},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),A.a.createElement(G.a.Item,{name:"align"},A.a.createElement(Ae,null,A.a.createElement(Be.a,{value:"default"},A.a.createElement("i",{className:"fa fa-align-justify"})),A.a.createElement(Be.a,{value:"left"},A.a.createElement("i",{className:"fa fa-align-left"})),A.a.createElement(Be.a,{value:"center"},A.a.createElement("i",{className:"fa fa-align-center"})),A.a.createElement(Be.a,{value:"right"},A.a.createElement("i",{className:"fa fa-align-right"}))))),A.a.createElement("div",{className:"flex-container flex-end"},A.a.createElement(z.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),A.a.createElement(z.a,{type:"ghost",onClick:Le},"\u53D6\u6D88")))},ze=X("ErOA"),qe=X("7Cbv"),Ge="link",ke="upload-image",ct="code-block",ut="add-table",vt="------------",lt={default:vt,left:":".concat(vt),center:":".concat(vt,":"),right:"".concat(vt,":")},Tt=X("9VGf"),gt,yt;function Oe(){}var Pt=0,St=1e4,Ue="\u2581",Ze=` **\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 Ee(ue){return/^\d+$/.test(ue)?"".concat(ue,"px"):ue}var fe=navigator.platform.toUpperCase().indexOf("MAC")>=0,be=fe?"Cmd":"Ctrl",ne=["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"],re=(gt={},Object(I.a)(gt,be+"-B","bold"),Object(I.a)(gt,be+"-I","italic"),gt),ae=(yt={},Object(I.a)(yt,Ge,"\u6DFB\u52A0\u94FE\u63A5"),Object(I.a)(yt,ct,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(I.a)(yt,ke,"\u6DFB\u52A0\u6587\u4EF6"),Object(I.a)(yt,ut,"\u6DFB\u52A0\u8868\u683C"),yt),ce=Xe.a=function(ue){var we=ue.defaultValue,Le=we===void 0?"":we,tt=ue.onChange,Fe=ue.width,$e=Fe===void 0?"100%":Fe,Dt=ue.height,ot=Dt===void 0?400:Dt,ft=ue.miniToolbar,zt=ft===void 0?!1:ft,Je=ue.isFocus,Kt=Je===void 0?!1:Je,sn=ue.watch,Bt=ue.insertTemp,an=ue.mode,Qt=an===void 0?"markdown":an,it=ue.id,Ft=it===void 0?"markdown-editor-id":it,xt=ue.showResizeBar,kt=xt===void 0?!1:xt,Mt=ue.noStorage,It=Mt===void 0?!1:Mt,Lt=ue.showNullButton,at=Lt===void 0?!1:Lt,Ve=ue.hidetoolBar,ln=Ve===void 0?!1:Ve,Yt=ue.fullScreen,cn=Yt===void 0?!1:Yt,qt=ue.onBlur,En=ue.onCMBeforeChange,on=ue.onFullScreen,ht=ue.className,Ke=ht===void 0?"":ht,wt=ue.disablePaste,Hn=wt===void 0?!1:wt,fr=ue.placeholder,Ar=fr===void 0?"":fr,Fn=ue.values,F=Fn===void 0?"":Fn,p=Object(T.useState)(null),y=Object(K.a)(p,2),M=y[0],Q=y[1],W=Object(T.useState)(Le),me=Object(K.a)(W,2),Ye=me[0],dt=me[1],jt=Object(T.useState)(sn),Qe=Object(K.a)(jt,2),Vt=Qe[0],hn=Qe[1],Rn=Object(T.useState)(cn),pr=Object(K.a)(Rn,2),qn=pr[0],xn=pr[1],Rr=Object(T.useState)(""),qr=Object(K.a)(Rr,2),Vn=qr[0],_t=qr[1],Te=Object(T.useState)(0),nt=Object(K.a)(Te,2),Ht=nt[0],Ot=nt[1],Nt=Object(T.useState)(ot),Xt=Object(K.a)(Nt,2),Dn=Xt[0],Sn=Xt[1],un=Object(T.useState)(!1),jn=Object(K.a)(un,2),Kn=jn[0],ir=jn[1],yn=Object(T.useRef)(Object(qe.a)()),mn=Object(T.useRef)(!1),Ln=Object(T.useRef)(),en=Object(T.useRef)(),Un=Object(T.useRef)(),_n=Object(T.useRef)(),mr=Object(T.useRef)(),ar=function(){var Gt=Object(N.a)(L.a.mark(function nn(){var Jt,fn;return L.a.wrap(function(kn){for(;;)switch(kn.prev=kn.next){case 0:return kn.next=2,Object(ze.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:yn.current}});case 2:fn=kn.sent,fn!=null&&(Jt=fn.attachments)!==null&&Jt!==void 0&&Jt.length&&(console.log("cm:",M,en),fn.attachments.map(function(vn){vn.content_type.indexOf("image")>-1?M.replaceSelection("![,](/api/attachments/".concat(vn.id,"?type=").concat(vn.content_type,")")):vn.content_type.indexOf("video")>-1?M.replaceSelection('')):vn.content_type.indexOf("pdf")>-1?M.replaceSelection('
    ').concat(vn.name,"")):M.replaceSelection("[".concat(vn.name,"](").concat(o.a.API_SERVER,"/api/attachments/").concat(vn.id,"?type=").concat(vn.content_type,")"))}));case 4:case"end":return kn.stop()}},nn)}));return function(){return Gt.apply(this,arguments)}}();Object(T.useEffect)(function(){dt(F),M==null||M.setValue(F)},[F]),Object(T.useEffect)(function(){on==null||on(qn)},[qn]),Object(T.useEffect)(function(){if(en.current){var Gt=w.a.fromTextArea(en.current,{mode:Qt,lineNumbers:!zt,lineWrapping:!0,value:Le,autoCloseTags:!0,autoCloseBrackets:!0});Kt&&Gt.focus();function nn(Jt,fn){if(Hn){fn.preventDefault();return}var bn=fn.clipboardData;if(bn){var kn=bn.types.toString(),vn=bn.items;if(kn==="Files"||bn.types.indexOf("Files")>-1){if(fn.preventDefault(),Qt=="stex")return;try{var er,vr=vn[1];((er=vn[0])===null||er===void 0?void 0:er.kind)==="file"&&(vr=vn[0]);var gn=vr.getAsFile(),Qr=gn.name.split(".").pop();xe(gn,function(Tn){if(Tn.id){var or,tr,Gr;(gn==null||((or=gn.type)===null||or===void 0)?void 0:or.indexOf("image"))>-1?Gt.replaceSelection("![,](/api/attachments/".concat(Tn.id,"?type=").concat(Tn.content_type,")")):(gn==null||((tr=gn.type)===null||tr===void 0)?void 0:tr.indexOf("video"))>-1?Gt.replaceSelection('')):(gn==null||((Gr=gn.type)===null||Gr===void 0)?void 0:Gr.indexOf("pdf"))>-1?Gt.replaceSelection('').concat(gn.name,"")):ne.includes(Qr)?Gt.replaceSelection('').concat(gn.name,"")):Gt.replaceSelection("[".concat(gn.name,"](").concat(o.a.API_SERVER,"/api/attachments/").concat(Tn.id,"?type=").concat(Tn.content_type,")"))}else(Tn==null?void 0:Tn.status)===401&&(document.location.href="/user/login")})}catch(Tn){U.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return Gt.on("paste",nn),Gt.on("dragleave",function(Jt,fn){Un.current.classList.remove("mouse-hover-md")}),Gt.on("dragover",function(Jt,fn){Un.current.classList.add("mouse-hover-md")}),Gt.on("drop",function(Jt,fn){Un.current.classList.add("mouse-hover-md");var bn;if(bn=fn.dataTransfer.files,bn.length>0){fn.preventDefault(),fn.stopPropagation();for(var kn=function(vr){var gn=bn[vr],Qr=gn.name.split(".").pop();xe(gn,function(Tn){if(Tn.id){var or,tr,Gr;(gn==null||((or=gn.type)===null||or===void 0)?void 0:or.indexOf("image"))>-1?Gt.replaceSelection("![,](/api/attachments/".concat(Tn.id,"?type=").concat(Tn.content_type,")")):(gn==null||((tr=gn.type)===null||tr===void 0)?void 0:tr.indexOf("video"))>-1?Gt.replaceSelection('')):(gn==null||((Gr=gn.type)===null||Gr===void 0)?void 0:Gr.indexOf("pdf"))>-1?Gt.replaceSelection('').concat(gn.name,"")):ne.includes(Qr)?Gt.replaceSelection('').concat(gn.name,"")):Gt.replaceSelection("[".concat(gn.name,"](").concat(o.a.API_SERVER,"/api/attachments/").concat(Tn.id,"?type=").concat(Tn.content_type,")"))}else(Tn==null?void 0:Tn.status)===401&&(document.location.href="/user/login")})},vn=0;vn0||vn.target.offsetWidth>0)&&(gr(),M.setSize("100%","100%"),M.refresh())}}catch(er){bn.e(er)}finally{bn.f()}});return Jt.observe(en.current.parentElement),Jt}if(M){var nn=Gt();return function(){nn.unobserve(en.current.parentElement)}}},[M,gr]),Object(T.useEffect)(function(){if(M){for(var Gt=[],nn=function(){var vn=fn[Jt];bn=Object(K.a)(vn,2);var er=bn[0],vr=bn[1],gn=Object(I.a)({},er,function(){fi(vr)});Gt.push(gn),M.addKeyMap(gn)},Jt=0,fn=Object.entries(re);Jt0){var Gt=new Date().getTime(),nn=window.sessionStorage.getItem(Ft);Gt>=Ht+St&&(!nn||nn!==Ye)&&(window.sessionStorage.setItem(Ft,Ye),ir(!0))}},St),Object(T.useEffect)(function(){hn(sn)},[M,sn]),Object(T.useEffect)(function(){M&&(Kt&&M.focus())},[M,Kt]),Object(T.useEffect)(function(){if(Vt&&M){var Gt=M.getScrollerElement();function nn(Jt){var fn=Jt.target;if(mr.current){var bn=fn.scrollTop/fn.scrollHeight;mr.current.scrollTop=mr.current.scrollHeight*bn}}return Gt.addEventListener("scroll",nn),function(){Gt.removeEventListener("scroll",nn)}}},[M,Vt]),Object(T.useEffect)(function(){if(M&&En){function Gt(nn,Jt){En(nn,Jt)}return M.on("beforeChange",Gt),function(){M.off("beforeChange",Gt)}}},[M,En]),Object(T.useEffect)(function(){if(M&&qt){function Gt(){qt(M.getValue())}return M.on("blur",Gt),function(){M.off("blur",Gt)}}},[M,qt]),Object(T.useEffect)(function(){if(M){function Gt(nn){var Jt=nn.getValue();dt(Jt),Ot(new Date().getTime()),nn.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),tt&&tt(Jt)}return M.on("change",Gt),function(){M.off("change",Gt)}}},[M,tt]),Object(T.useEffect)(function(){M&&(Le==null?(M.setValue(""),dt("")):Le!==M.getValue()&&(M.setValue(Le),dt(Le),M.setCursor(M.lineCount(),0)))},[M,Le]);var fi=Object(T.useCallback)(function(Gt){var nn=M.getCursor(),Jt=M.getSelection(),fn=Jt.split(` `);switch(Gt){case"bold":return M.replaceSelection("**"+Jt+"**"),Jt===""&&M.setCursor(nn.line,nn.ch+2),M.focus();case"italic":return M.replaceSelection("*"+Jt+"*"),Jt===""&&M.setCursor(nn.line,nn.ch+1),M.focus();case"code":return M.replaceSelection("`"+Jt+"`"),Jt===""&&M.setCursor(nn.line,nn.ch+1),M.focus();case"inline-latex":return M.replaceSelection("`$$"+Jt+"$$`"),Jt===""&&M.setCursor(nn.line,nn.ch+3),M.focus();case"latex":return M.replaceSelection("```latex\n"+Jt+"\n```"),M.setCursor(nn.line+1,Jt.length+1),M.focus();case"line-break":return M.replaceSelection(`
    `),M.focus();case"list-ul":return Jt===""?M.replaceSelection("- "+Jt):M.replaceSelection(fn.map(function(bn){return bn===""?"":"- ".concat(bn)}).join(` `)),M.focus();case"list-ol":return Jt===""?M.replaceSelection("1. "+Jt):M.replaceSelection(fn.map(function(bn,kn){return bn===""?"":"".concat(kn+1,". ").concat(bn)}).join(` `)),M.focus();case"add-null-ch":return Jt===""&&M.setCursor(nn.line,nn.ch+1),M.replaceSelection(Ue),M.focus();case"inster-template-1":return Jt===""&&M.setCursor(nn.line,nn.ch),M.replaceSelection(Ze),M.focus();case"eraser":return M.setValue(""),M.focus();case"trigger-watch":return hn(!Vt),M.focus();case"trigger-full-screen":return xn(!qn),M.focus();case Ge:_t(Ge);return;case ct:_t(ct);return;case ke:_t(ke);return;case ut:_t(ut);return;default:throw new Error}},[M,Vt,qn]),Jr=Object(T.useCallback)(function(Gt){_t("");switch(Vn){case Ge:var nn=Gt.title,Jt=Gt.link;return M.replaceSelection("[".concat(nn,"](").concat(Jt,")")),M.focus();case ct:var fn=Gt.language,bn=Gt.content;return M.replaceSelection(["```"+fn,bn,"```"].join(` `)),M.focus();case ke:var kn=Gt.src,vn=Gt.alt;return vn?M.replaceSelection("![ ".concat(vn," ]( ").concat(kn,' "').concat(vn,'" )')):M.replaceSelection("![,](".concat(kn,")")),M.focus();case ut:for(var er=Gt.row,vr=Gt.col,gn=Gt.align,Qr=` `,Tn=0;Tn300&&(er=300);var vr=ot+er+"px";Sn(vr)}}return Gt.addEventListener("mousedown",fn),document.addEventListener("mousemove",kn),document.addEventListener("mouseup",bn),function(){Gt.removeEventListener("mousedown",fn),document.removeEventListener("mousemove",kn),document.removeEventListener("mouseup",bn)}}},[M,_n]),Object(T.useEffect)(function(){Sn(ot)},[ot]);var On=Ee($e),ti=Ee(Dn),Xr={width:On,height:ti},pi=Object(T.useMemo)(function(){if(Ht){var Gt=new Date(Ht),nn=Gt.getHours(),Jt=Gt.getMinutes(),fn=Gt.getSeconds();return nn=nn<10?"0"+nn:nn,Jt=Jt<10?"0"+Jt:Jt,fn=fn<10?"0"+fn:fn,"".concat(nn,":").concat(Jt,":").concat(fn)}return 0},[Ht]);function ni(){window.sessionStorage.removeItem(Ft),ir(!1),Ot(0)}function ui(){ir(!1),Ot(0),M.setValue(window.sessionStorage.getItem(Ft))}function si(Gt,nn){var Jt=M.getValue();Jt=Jt.replace(Gt,nn),dt(Jt),M==null||M.setValue(Jt)}return A.a.createElement(T.Fragment,null,A.a.createElement("div",{className:"markdown-editor-wrapper",ref:Un},A.a.createElement("div",{className:"markdown-editor-container ".concat(Ke," ").concat(Vt?"on-preview":""," ").concat(zt?"mini":""," ").concat(qn?"full-screen":""),style:Xr},A.a.createElement(_,{insertTemp:Bt,watch:Vt,fullScreen:qn,showNullButton:at,onActionCallback:fi,hidetoolBar:ln,uuid:yn.current,setOpenPhones:function(){mn.current=!0}}),A.a.createElement("div",{className:"markdown-editor-body"},A.a.createElement("div",{className:"codemirror-container"},A.a.createElement("textarea",{ref:en,placeholder:Ar})),Vt?A.a.createElement("div",{ref:mr,className:"preview-container"},Qt==="stex"&&A.a.createElement(u,{value:Ye}),Qt!=="stex"&&A.a.createElement(m.a,{edit:!0,value:Ye,replaces:si})):null))),kt?A.a.createElement("a",{ref:_n,className:"editor-resize"}):null,A.a.createElement(k.a,null,ae[Vn]?A.a.createElement($.a,{centered:!0,title:ae[Vn],visible:!0,onCancel:ei,footer:null,className:"markdown-popup-form"},Ti):null))}},PGNT:function(rt,Xe,X){rt.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(rt,Xe,X){rt.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(rt,Xe,X){rt.exports=X.p+"static/wenhao.50b63ac4.svg"},"RZ/O":function(rt,Xe,X){rt.exports=X.p+"static/bi.9c9b0364.svg"},SJMd:function(rt,Xe){/** * @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 X,oe,$,D=!1,Y,U;window.PR_SHOULD_USE_CONTINUATION=!0;var N,K;(function(){var I=window,O=["break,continue,do,else,for,if,return,while"],L=[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=[L,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],A=[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"],P=[T,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],w=[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"],S="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"],h="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=[A,w,P,x,h,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",E="com",d="typ",f="lit",s="pun",o="pln",b="tag",g="dec",_="src",k="atn",H="atv",z="nocode",Z="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function G(Ae){for(var Pe=0,We=!1,ze=!1,qe=0,Ge=Ae.length;qe122||(ne<65||be>90||Pt.push([Math.max(65,be)|32,Math.min(ne,90)|32]),ne<97||be>122||Pt.push([Math.max(97,be)&~32,Math.min(ne,122)&~32]))}}Pt.sort(function(ue,we){return ue[0]-we[0]||we[1]-ue[1]});for(var re=[],ae=[],Ze=0;Zece[0]&&(ce[1]+1>ce[0]&&Ue.push("-"),Ue.push(vt(ce[1])))}return Ue.push("]"),Ue.join("")}function Tt(yt){for(var Oe=yt.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")),Pt=Oe.length,St=[],Ue=0,Ze=0;Ue=2&&be==="["?Oe[Ue]=lt(Ee):be!=="\\"&&(Oe[Ue]=Ee.replace(/[a-zA-Z]/g,function(ae){var ce=ae.charCodeAt(0);return"["+String.fromCharCode(ce&~32,ce|32)+"]"}))}return Oe.join("")}for(var gt=[],qe=0,Ge=Ae.length;qe=0;)We[gt.charAt(yt)]=Tt;var Oe=Tt[1],Pt=""+Oe;ut.hasOwnProperty(Pt)||(ct.push(Oe),ut[Pt]=null)}ct.push(/[\0-\uffff]/),ze=G(ct)})();var qe=Pe.length,Ge=function(ke){for(var ct=ke.sourceCode,ut=ke.basePos,vt=ke.sourceNode,lt=[ut,o],Tt=0,gt=ct.match(ze)||[],yt={},Oe=0,Pt=gt.length;Oe=5&&Ue.substring(0,5)==="lang-",Ee&&!(Ze&&typeof Ze[1]=="string")&&(Ee=!1,Ue=_),Ee||(yt[St]=Ue)}var ne=Tt;if(Tt+=St.length,!Ee)lt.push(ut+ne,Ue);else{var re=Ze[1],ae=St.indexOf(re),ce=ae+re.length;Ze[2]&&(ce=St.length-Ze[2].length,ae=ce-re.length);var ue=Ue.substring(5);te(vt,ut+ne,St.substring(0,ae),Ge,lt),te(vt,ut+ne+ae,re,q(ue,re),lt),te(vt,ut+ne+ce,St.substring(ce),Ge,lt)}}ke.decorations=lt};return Ge}function Ce(Ae){var Pe=[],We=[];Ae.tripleQuotedStrings?Pe.push([m,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):Ae.multiLineStrings?Pe.push([m,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):Pe.push([m,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),Ae.verbatimStrings&&We.push([m,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var ze=Ae.hashComments;ze&&(Ae.cStyleComments?(ze>1?Pe.push([E,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):Pe.push([E,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),We.push([m,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):Pe.push([E,/^#[^\r\n]*/,null,"#"])),Ae.cStyleComments&&(We.push([E,/^\/\/[^\r\n]*/,null]),We.push([E,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var qe=Ae.regexLiterals;if(qe){var Ge=qe>1?"":` \r`,ke=Ge?".":"[\\S\\s]",ct="/(?=[^/*"+Ge+"])(?:[^/\\x5B\\x5C"+Ge+"]|\\x5C"+ke+"|\\x5B(?:[^\\x5C\\x5D"+Ge+"]|\\x5C"+ke+")*(?:\\x5D|$))+/";We.push(["lang-regex",RegExp("^"+Z+"("+ct+")")])}var ut=Ae.types;ut&&We.push([d,ut]);var vt=(""+Ae.keywords).replace(/^ | $/g,"");vt.length&&We.push([u,new RegExp("^(?:"+vt.replace(/[\s,]+/g,"|")+")\\b"),null]),Pe.push([o,/^\s+/,null,` \r \xA0`]);var lt="^.[^\\s\\w.$@'\"`/\\\\]*";return Ae.regexLiterals&&(lt+="(?!s*/)"),We.push([f,/^@[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],[f,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(lt),null]),ye(Pe,We)}var _e=Ce({keywords:C,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function le(Ae,Pe,We){for(var ze=/(?:^|\s)nocode(?:\s|$)/,qe=/\r\n?|\n/,Ge=Ae.ownerDocument,ke=Ge.createElement("li");Ae.firstChild;)ke.appendChild(Ae.firstChild);var ct=[ke];function ut(Oe){var Pt=Oe.nodeType;if(Pt==1&&!ze.test(Oe.className))if(Oe.nodeName==="br")vt(Oe),Oe.parentNode&&Oe.parentNode.removeChild(Oe);else for(var St=Oe.firstChild;St;St=St.nextSibling)ut(St);else if((Pt==3||Pt==4)&&We){var Ue=Oe.nodeValue,Ze=Ue.match(qe);if(Ze){var Ee=Ue.substring(0,Ze.index);Oe.nodeValue=Ee;var fe=Ue.substring(Ze.index+Ze[0].length);if(fe){var be=Oe.parentNode;be.insertBefore(Ge.createTextNode(fe),Oe.nextSibling)}vt(Oe),Ee||Oe.parentNode.removeChild(Oe)}}}function vt(Oe){for(;!Oe.nextSibling;)if(Oe=Oe.parentNode,!Oe)return;function Pt(Ze,Ee){var fe=Ee?Ze.cloneNode(!1):Ze,be=Ze.parentNode;if(be){var ne=Pt(be,1),re=Ze.nextSibling;ne.appendChild(fe);for(var ae=re;ae;ae=re)re=ae.nextSibling,ne.appendChild(ae)}return fe}for(var St=Pt(Oe.nextSibling,0),Ue;(Ue=St.parentNode)&&Ue.nodeType===1;)St=Ue;ct.push(St)}for(var lt=0;lt=be&&(ut+=2),Ge>=ne&&(Tt+=2)}}finally{Ue&&(Ue.style.display=Ze)}}var ve={};function ie(Ae,Pe){for(var We=Pe.length;--We>=0;){var ze=Pe[We];ve.hasOwnProperty(ze)?I.console&&console.warn("cannot override language handler %s",ze):ve[ze]=Ae}}function q(Ae,Pe){return Ae&&ve.hasOwnProperty(Ae)||(Ae=/^\s*]*(?:>|$)/],[E,/^<\!--[\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"]),ie(ye([[o,/^[\s]+/,null,` \r `],[H,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[b,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[k,/^(?!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"]),ie(ye([],[[H,/^[\s\S]+/]]),["uq.val"]),ie(Ce({keywords:A,hashComments:!0,cStyleComments:!0,types:v}),["c","cc","cpp","cxx","cyc","m"]),ie(Ce({keywords:"null,true,false"}),["json"]),ie(Ce({keywords:w,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:v}),["cs"]),ie(Ce({keywords:P,cStyleComments:!0}),["java"]),ie(Ce({keywords:c,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),ie(Ce({keywords:l,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),ie(Ce({keywords:h,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),ie(Ce({keywords:i,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),ie(Ce({keywords:x,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),ie(Ce({keywords:S,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),ie(ye([],[[m,/^[\s\S]+/]]),["regex"]);function xe(Ae){var Pe=Ae.langExtension;try{var We=B(Ae.sourceNode,Ae.pre),ze=We.sourceCode;Ae.sourceCode=ze,Ae.spans=We.spans,Ae.basePos=0,q(Pe,ze)(Ae),se(Ae)}catch(qe){I.console&&console.log(qe&&qe.stack||qe)}}function Ie(Ae,Pe,We){var ze=We||!1,qe=Pe||null,Ge=document.createElement("div");Ge.innerHTML="
    "+Ae+"
    ",Ge=Ge.firstChild,ze&&le(Ge,ze,!0);var ke={langExtension:qe,numberLines:ze,sourceNode:Ge,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return xe(ke),Ge.innerHTML}function Ne(Ae,Pe){var We=Pe||document.body,ze=We.ownerDocument||document;function qe(fe){return We.getElementsByTagName(fe)}for(var Ge=[qe("pre"),qe("code"),qe("xmp")],ke=[],ct=0;ct=15&&(A=!1,O=!0);var m=i&&(L||A&&(v==null||v<12.11)),u=D||K&&I>=9;function E(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var d=function(e,t){var r=e.className,n=E(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 f(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function s(e,t){return f(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 R=0;R=t)return j+(t-R);j+=V-R,j+=r-j%r,R=V+1}}var de=function(){this.id=null,this.f=null,this.time=0,this.handler=G(this.onTimeout,this)};de.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},de.prototype.set=function(e,t){this.f=t;var r=+new Date+e;(!this.id||r=t)return n+Math.min(j,t-a);if(a+=R-n,a+=r-a%r,n=R+1,a>=t)return n}}var ie=[""];function q(e){for(;ie.length<=e;)ie.push(xe(ie)+" ");return ie[e]}function xe(e){return e[e.length-1]}function Ie(e,t){for(var r=[],n=0;n"\x80"&&(e.toUpperCase()!=e.toLowerCase()||Ae.test(e))}function We(e,t){return t?t.source.indexOf("\\w")>-1&&Pe(e)?!0:t.test(e):Pe(e)}function ze(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 Ge(e){return e.charCodeAt(0)>=768&&qe.test(e)}function ke(e,t,r){for(;(r<0?t>0:tr?-1:1;;){if(t==r)return t;var a=(t+r)/2,R=n<0?Math.ceil(a):Math.floor(a);if(R==t)return e(R)?t:r;e(R)?r=R:t=R+n}}function ut(e,t,r,n){if(!e)return n(t,r,"ltr",0);for(var a=!1,R=0;Rt||t==r&&j.to==t)&&(n(Math.max(j.from,t),Math.min(j.to,r),j.level==1?"rtl":"ltr",R),a=!0)}a||n(t,r,"ltr")}var vt=null;function lt(e,t,r){var n;vt=null;for(var a=0;at)return a;R.to==t&&(R.from!=R.to&&r=="before"?n=a:vt=a),R.from==t&&(R.from!=R.to&&r!="before"?n=a:vt=a)}return n!=null?n:vt}var Tt=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function r(ee){return ee<=247?e.charAt(ee):1424<=ee&&ee<=1524?"R":1536<=ee&&ee<=1785?t.charAt(ee-1536):1774<=ee&&ee<=2220?"r":8192<=ee&&ee<=8203?"w":ee==8204?"b":"L"}var n=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,a=/[stwN]/,R=/[LRr]/,j=/[Lb1n]/,V=/[1n]/;function J(ee,he,ge){this.level=ee,this.from=he,this.to=ge}return function(ee,he){var ge=he=="ltr"?"L":"R";if(ee.length==0||he=="ltr"&&!n.test(ee))return!1;for(var Re=ee.length,Se=[],He=0;He-1&&(n[t]=a.slice(0,R).concat(a.slice(R+1)))}}}function Ue(e,t){var r=Pt(e,t);if(!r.length)return;for(var n=Array.prototype.slice.call(arguments,2),a=0;a0}function be(e){e.prototype.on=function(t,r){Oe(this,t,r)},e.prototype.off=function(t,r){St(this,t,r)}}function ne(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function re(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function ae(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function ce(e){ne(e),re(e)}function ue(e){return e.target||e.srcElement}function we(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 Le=function(){if(K&&I<9)return!1;var e=o("div");return"draggable"in e||"dragDrop"in e}(),tt;function Fe(e){if(tt==null){var t=o("span","\u200B");s(e,o("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(tt=t.offsetWidth<=1&&t.offsetHeight>2&&!(K&&I<8))}var r=tt?o("span","\u200B"):o("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}var $e;function Dt(e){if($e!=null)return $e;var t=s(e,document.createTextNode("A\u062EA")),r=g(t,0,1).getBoundingClientRect(),n=g(t,1,2).getBoundingClientRect();return f(e),!r||r.left==r.right?!1:$e=n.right-r.right<3}var ot=` 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 R=e.slice(t,e.charAt(a-1)=="\r"?a-1:a),j=R.indexOf("\r");j!=-1?(r.push(R.slice(0,j)),t+=j+1):(r.push(R),t=a+1)}return r}:function(e){return e.split(/\r\n?|\n/)},ft=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},zt=function(){var e=o("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),Je=null;function Kt(e){if(Je!=null)return Je;var t=s(e,o("span","x")),r=t.getBoundingClientRect(),n=g(t,0,1).getBoundingClientRect();return Je=Math.abs(r.left-n.left)>1}var sn={},Bt={};function an(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),sn[e]=t}function Qt(e,t){Bt[e]=t}function it(e){if(typeof e=="string"&&Bt.hasOwnProperty(e))e=Bt[e];else if(e&&typeof e.name=="string"&&Bt.hasOwnProperty(e.name)){var t=Bt[e.name];typeof t=="string"&&(t={name:t}),e=Be(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return it("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return it("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function Ft(e,t){t=it(t);var r=sn[t.name];if(!r)return Ft(e,"text/plain");var n=r(e,t);if(xt.hasOwnProperty(t.name)){var a=xt[t.name];for(var R in a){if(!a.hasOwnProperty(R))continue;n.hasOwnProperty(R)&&(n["_"+R]=n[R]),n[R]=a[R]}}if(n.name=t.name,t.helperType&&(n.helperType=t.helperType),t.modeProps)for(var j in t.modeProps)n[j]=t.modeProps[j];return n}var xt={};function kt(e,t){var r=xt.hasOwnProperty(e)?xt[e]:xt[e]={};B(t,r)}function Mt(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 It(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 Lt(e,t,r){return e.startState?e.startState(t,r):!0}var at=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};at.prototype.eol=function(){return this.pos>=this.string.length},at.prototype.sol=function(){return this.pos==this.lineStart},at.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},at.prototype.next=function(){if(this.post},at.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},at.prototype.skipToEnd=function(){this.pos=this.string.length},at.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},at.prototype.backUp=function(e){this.pos-=e},at.prototype.column=function(){return this.lastColumnPos0?null:(R&&t!==!1&&(this.pos+=R[0].length),R)}},at.prototype.current=function(){return this.string.slice(this.start,this.pos)},at.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},at.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},at.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function Ve(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],R=a.chunkSize();if(t=e.first&&tr?Ke(r,Ve(e,r).text.length):y(t,Ve(e,t.line).text.length)}function y(e,t){var r=e.ch;return r==null||r>t?Ke(e.line,t):r<0?Ke(e.line,0):e}function M(e,t){for(var r=[],n=0;nthis.maxLookAhead&&(this.maxLookAhead=e),t},W.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}},W.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},W.fromSaved=function(e,t,r){return t instanceof Q?new W(e,Mt(e.mode,t.state),r,t.lookAhead):new W(e,Mt(e.mode,t),r)},W.prototype.save=function(e){var t=e!==!1?Mt(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Q(t,this.maxLookAhead):t};function me(e,t,r,n){var a=[e.state.modeGen],R={};qn(e,t.text,e.doc.mode,r,function(ee,he){return a.push(ee,he)},R,n);for(var j=r.state,V=function(ee){r.baseTokens=a;var he=e.state.overlays[ee],ge=1,Re=0;r.state=!0,qn(e,t.text,he.mode,r,function(Se,He){for(var et=ge;ReSe&&a.splice(ge,1,Se,a[ge+1],pt),ge+=2,Re=Math.min(Se,pt)}if(!He)return;if(he.opaque)a.splice(et,ge-et,Se,"overlay "+He),ge=et+2;else for(;ete.options.maxHighlightLength&&Mt(e.doc.mode,n.state),R=me(e,t,n);a&&(n.state=a),t.stateAfter=n.save(!a),t.styles=R.styles,R.classes?t.styleClasses=R.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 dt(e,t,r){var n=e.doc,a=e.display;if(!n.mode.startState)return new W(n,!0,t);var R=xn(e,t,r),j=R>n.first&&Ve(n,R-1).stateAfter,V=j?W.fromSaved(n,j,R):new W(n,Lt(n.mode),R);return n.iter(R,t,function(J){jt(e,J.text,V);var ee=V.line;J.stateAfter=ee==t-1||ee%5==0||ee>=a.viewFrom&&eet.start)return R}throw new Error("Mode "+e.name+" failed to advance stream.")}var hn=function(e,t,r){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=r};function Rn(e,t,r,n){var a=e.doc,R=a.mode,j;t=p(a,t);var V=Ve(a,t.line),J=dt(e,t.line,r),ee=new at(V.text,e.options.tabSize,J),he;for(n&&(he=[]);(n||ee.pose.options.maxHighlightLength?(V=!1,j&&jt(e,t,n,he.pos),he.pos=t.length,ge=null):ge=pr(Vt(r,he,n.state,Re),R),Re){var Se=Re[0].name;Se&&(ge="m-"+(ge?Se+" "+ge:Se))}if(!V||ee!=ge){for(;Jj;--V){if(V<=R.first)return R.first;var J=Ve(R,V-1),ee=J.stateAfter;if(ee&&(!r||V+(ee instanceof Q?ee.lookAhead:0)<=R.modeFrontier))return V;var he=te(J.text,null,e.options.tabSize);(a==null||n>he)&&(a=V-1,n=he)}return a}function Rr(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),e.highlightFrontierr;n--){var a=Ve(e,n).stateAfter;if(a&&(!(a instanceof Q)||n+a.lookAhead=t:R.to>t);(n||(n=[])).push(new nt(j,R.from,J?null:R.to))}}return n}function Dn(e,t,r){var n;if(e)for(var a=0;a=t:R.to>t);if(V||R.from==t&&j.type=="bookmark"&&(!r||R.marker.insertLeft)){var J=R.from==null||(j.inclusiveLeft?R.from<=t:R.from0&&V)for(var Wt=0;Wt0)continue;var he=[J,1],ge=wt(ee.from,V.from),Re=wt(ee.to,V.to);(ge<0||!j.inclusiveLeft&&!ge)&&he.push({from:ee.from,to:V.from}),(Re>0||!j.inclusiveRight&&!Re)&&he.push({from:V.to,to:ee.to}),a.splice.apply(a,he),J+=he.length-3}return a}function Kn(e){var t=e.markedSpans;if(!t)return;for(var r=0;rt)&&(!n||Ln(n,R.marker)<0)&&(n=R.marker)}return n}function ar(e,t,r,n,a){var R=Ve(e,t),j=Vn&&R.markedSpans;if(j)for(var V=0;V=0&&ge<=0||he<=0&&ge>=0)continue;if(he<=0&&(J.marker.inclusiveRight&&a.inclusiveLeft?wt(ee.to,r)>=0:wt(ee.to,r)>0)||he>=0&&(J.marker.inclusiveRight&&a.inclusiveLeft?wt(ee.from,n)<=0:wt(ee.from,n)<0))return!0}}function gr(e){for(var t;t=Un(e);)e=t.find(-1,!0).line;return e}function fi(e){for(var t;t=_n(e);)e=t.find(1,!0).line;return e}function Jr(e){for(var t,r;t=_n(e);)e=t.find(1,!0).line,(r||(r=[])).push(e);return r}function Ti(e,t){var r=Ve(e,t),n=gr(r);return r==n?t:qt(n)}function ei(e,t){if(t>e.lastLine())return t;var r=Ve(e,t),n;if(!On(e,r))return t;for(;n=_n(r);)r=n.find(1,!0).line;return qt(r)+1}function On(e,t){var r=Vn&&t.markedSpans;if(r)for(var n=void 0,a=0;at.maxLineLength&&(t.maxLineLength=a,t.maxLine=n)})}var ui=function(e,t,r){this.text=e,ir(this,t),this.height=r?r(this):1};ui.prototype.lineNo=function(){return qt(this)},be(ui);function si(e,t,r,n){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),Kn(e),ir(e,r);var a=n?n(e):1;a!=e.height&&cn(e,a)}function Gt(e){e.parent=null,Kn(e)}var nn={},Jt={};function fn(e,t){if(!e||/^\s*$/.test(e))return null;var r=t.addModeClass?Jt:nn;return r[e]||(r[e]=e.replace(/\S+/g,"cm-$&"))}function bn(e,t){var r=b("span",null,null,O?"padding-right: .1px":null),n={pre:b("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 R=a?t.rest[a-1]:t.line,j=void 0;n.pos=0,n.addToken=vn,Dt(e.display.measure)&&(j=gt(R,e.doc.direction))&&(n.addToken=vr(n.addToken,j)),n.map=[];var V=t!=e.display.externalMeasured&&qt(R);Qr(R,n,Ye(e,R,V)),R.styleClasses&&(R.styleClasses.bgClass&&(n.bgClass=z(R.styleClasses.bgClass,n.bgClass||"")),R.styleClasses.textClass&&(n.textClass=z(R.styleClasses.textClass,n.textClass||""))),n.map.length==0&&n.map.push(0,0,n.content.appendChild(Fe(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 J=n.content.lastChild;(/\bcm-tab\b/.test(J.className)||J.querySelector&&J.querySelector(".cm-tab"))&&(n.content.className="cm-tab-wrap-hack")}return Ue(e,"renderLine",e,t.line,n.pre),n.pre.className&&(n.textClass=z(n.pre.className,n.textClass||"")),n}function kn(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 vn(e,t,r,n,a,R,j){if(!t)return;var V=e.splitSpaces?er(t,e.trailingSpace):t,J=e.cm.state.specialChars,ee=!1,he;if(!J.test(t))e.col+=t.length,he=document.createTextNode(V),e.map.push(e.pos,e.pos+t.length,he),K&&I<9&&(ee=!0),e.pos+=t.length;else{he=document.createDocumentFragment();for(var ge=0;;){J.lastIndex=ge;var Re=J.exec(t),Se=Re?Re.index-ge:t.length-ge;if(Se){var He=document.createTextNode(V.slice(ge,ge+Se));K&&I<9?he.appendChild(o("span",[He])):he.appendChild(He),e.map.push(e.pos,e.pos+Se,He),e.col+=Se,e.pos+=Se}if(!Re)break;ge+=Se+1;var et=void 0;if(Re[0]==" "){var pt=e.cm.options.tabSize,At=pt-e.col%pt;et=he.appendChild(o("span",q(At),"cm-tab")),et.setAttribute("role","presentation"),et.setAttribute("cm-text"," "),e.col+=At}else Re[0]=="\r"||Re[0]==` `?(et=he.appendChild(o("span",Re[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),et.setAttribute("cm-text",Re[0]),e.col+=1):(et=e.cm.options.specialCharPlaceholder(Re[0]),et.setAttribute("cm-text",Re[0]),K&&I<9?he.appendChild(o("span",[et])):he.appendChild(et),e.col+=1);e.map.push(e.pos,e.pos+1,et),e.pos++}}if(e.trailingSpace=V.charCodeAt(t.length-1)==32,r||n||a||ee||R||j){var Ut=r||"";n&&(Ut+=n),a&&(Ut+=a);var Rt=o("span",[he],Ut,R);if(j)for(var Wt in j)j.hasOwnProperty(Wt)&&Wt!="style"&&Wt!="class"&&Rt.setAttribute(Wt,j[Wt]);return e.content.appendChild(Rt)}e.content.appendChild(he)}function er(e,t){if(e.length>1&&!/ /.test(e))return e;for(var r=t,n="",a=0;aee&&ge.from<=ee);Re++);if(ge.to>=he)return e(r,n,a,R,j,V,J);e(r,n.slice(0,ge.to-ee),a,R,null,V,J),R=null,n=n.slice(ge.to-ee),ee=ge.to}}}function gn(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 Qr(e,t,r){var n=e.markedSpans,a=e.text,R=0;if(!n){for(var j=1;jJ||pn.collapsed&&$t.to==J&&$t.from==J)){if($t.to!=null&&$t.to!=J&&Se>$t.to&&(Se=$t.to,et=""),pn.className&&(He+=" "+pn.className),pn.css&&(Re=(Re?Re+";":"")+pn.css),pn.startStyle&&$t.from==J&&(pt+=" "+pn.startStyle),pn.endStyle&&$t.to==Se&&(Wt||(Wt=[])).push(pn.endStyle,$t.to),pn.title&&((Ut||(Ut={})).title=pn.title),pn.attributes)for(var Wn in pn.attributes)(Ut||(Ut={}))[Wn]=pn.attributes[Wn];pn.collapsed&&(!At||Ln(At.marker,pn)<0)&&(At=$t)}else $t.from>J&&Se>$t.from&&(Se=$t.from)}if(Wt)for(var Tr=0;Tr=V)break;for(var Vr=Math.min(V,Se);;){if(he){var Wr=J+he.length;if(!At){var ur=Wr>Vr?he.slice(0,Vr-J):he;t.addToken(t,ur,ge?ge+He:He,pt,J+ur.length==Se?et:"",Re,Ut)}if(Wr>=Vr){he=he.slice(Vr-J),J=Vr;break}J=Wr,pt=""}he=a.slice(R,R=r[ee++]),ge=fn(r[ee++],t.cm.options)}}}function Tn(e,t,r){this.line=t,this.rest=Jr(t),this.size=this.rest?qt(xe(this.rest))-r+1:1,this.node=this.text=null,this.hidden=On(e,t)}function or(e,t,r){for(var n=[],a,R=t;R2&&R.push((J.bottom+ee.top)/2-r.top)}}R.push(r.bottom-r.top)}}function st(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 je(e,t){t=gr(t);var r=qt(t),n=e.display.externalMeasured=new Tn(e.doc,t,r);n.lineN=r;var a=n.built=bn(e,n);return n.text=a.pre,s(e.display.lineMeasure,a.pre),n}function Me(e,t,r,n){return Ct(e,mt(e,t),r,n)}function Et(e,t){if(t>=e.display.viewFrom&&t=r.lineN&&tt)&&(R=J-V,a=R-1,t>=J&&(j="right")),a!=null){if(n=e[ee+2],V==J&&r==(n.insertLeft?"left":"right")&&(j=r),r=="left"&&a==0)for(;ee&&e[ee-2]==e[ee-3]&&e[ee-1].insertLeft;)n=e[(ee-=3)+2],j="left";if(r=="right"&&a==J-V)for(;ee=0&&!((r=e[a]).left!=r.right);a--);return r}function An(e,t,r,n){var a=dn(t.map,r,n),R=a.node,j=a.start,V=a.end,J=a.collapse,ee;if(R.nodeType==3){for(var he=0;he<4;he++){for(;j&&Ge(t.line.text.charAt(a.coverStart+j));)--j;for(;a.coverStart+V0&&(J=n="right");var ge;e.options.lineWrapping&&(ge=R.getClientRects()).length>1?ee=ge[n=="right"?ge.length-1:0]:ee=R.getBoundingClientRect()}if(K&&I<9&&!j&&(!ee||!ee.left&&!ee.right)){var Re=R.parentNode.getClientRects()[0];Re?ee={left:Re.left,right:Re.left+Br(e.display),top:Re.top,bottom:Re.bottom}:ee=Zt}for(var Se=ee.top-t.rect.top,He=ee.bottom-t.rect.top,et=(Se+He)/2,pt=t.view.measure.heights,At=0;At=n.text.length?(J=n.text.length,ee="before"):J<=0&&(J=0,ee="after"),!V)return j(ee=="before"?J-1:J,ee=="before");function he(He,et,pt){var At=V[et],Ut=At.level==1;return j(pt?He-1:He,Ut!=pt)}var ge=lt(V,J,ee),Re=vt,Se=he(J,ge,ee=="before");return Re!=null&&(Se.other=he(J,Re,ee!="before")),Se}function Cn(e,t){var r=0;t=p(e.doc,t),e.options.lineWrapping||(r=Br(e.display)*t.ch);var n=Ve(e.doc,t.line),a=Xr(n)+ji(e.display);return{left:r,right:r,top:a,bottom:a+n.height}}function $n(e,t,r,n,a){var R=Ke(e,t,r);return R.xRel=a,n&&(R.outside=n),R}function Er(e,t,r){var n=e.doc;if(r+=e.display.viewOffset,r<0)return $n(n.first,0,null,-1,-1);var a=En(n,r),R=n.first+n.size-1;if(a>R)return $n(n.first+n.size-1,Ve(n,R).text.length,null,1,1);t<0&&(t=0);for(var j=Ve(n,a);;){var V=Bn(e,j,a,t,r),J=mr(j,V.ch+(V.xRel>0||V.outside>0?1:0));if(!J)return V;var ee=J.find(1);if(ee.line==a)return ee;j=Ve(n,a=ee.line)}}function lr(e,t,r,n){n-=sr(t);var a=t.text.length,R=ct(function(j){return Ct(e,r,j-1).bottom<=n},a,0);return a=ct(function(j){return Ct(e,r,j).top>n},R,a),{begin:R,end:a}}function Mr(e,t,r,n){r||(r=mt(e,t));var a=Qn(e,t,Ct(e,r,n),"line").top;return lr(e,t,r,a)}function Ir(e,t,r,n){return e.bottom<=r?!1:e.top>r?!0:(n?e.left:e.right)>t}function Bn(e,t,r,n,a){a-=Xr(t);var R=mt(e,t),j=sr(t),V=0,J=t.text.length,ee=!0,he=gt(t,e.doc.direction);if(he){var ge=(e.options.lineWrapping?xr:Xn)(e,t,r,R,he,n,a);ee=ge.level!=1,V=ee?ge.from:ge.to-1,J=ee?ge.to:ge.from-1}var Re=null,Se=null,He=ct(function(tn){var $t=Ct(e,R,tn);return $t.top+=j,$t.bottom+=j,Ir($t,n,a,!1)?($t.top<=a&&$t.left<=n&&(Re=tn,Se=$t),!0):!1},V,J),et,pt,At=!1;if(Se){var Ut=n-Se.left=Wt.bottom?1:0}return He=ke(t.text,He,1),$n(r,He,pt,At,n-et)}function Xn(e,t,r,n,a,R,j){var V=ct(function(ge){var Re=a[ge],Se=Re.level!=1;return Ir(rn(e,Ke(r,Se?Re.to:Re.from,Se?"before":"after"),"line",t,n),R,j,!0)},0,a.length-1),J=a[V];if(V>0){var ee=J.level!=1,he=rn(e,Ke(r,ee?J.from:J.to,ee?"after":"before"),"line",t,n);Ir(he,R,j,!0)&&he.top>j&&(J=a[V-1])}return J}function xr(e,t,r,n,a,R,j){var V=lr(e,t,n,j),J=V.begin,ee=V.end;/\s/.test(t.text.charAt(ee-1))&&ee--;for(var he=null,ge=null,Re=0;Re=ee||Se.to<=J)continue;var He=Se.level!=1,et=Ct(e,n,He?Math.min(ee,Se.to)-1:Math.max(J,Se.from)).right,pt=etpt)&&(he=Se,ge=pt)}return he||(he=a[a.length-1]),he.fromee&&(he={from:he.from,to:ee,level:he.level}),he}var Pr;function _r(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(Pr==null){Pr=o("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Pr.appendChild(document.createTextNode("x")),Pr.appendChild(o("br"));Pr.appendChild(document.createTextNode("x"))}s(e.measure,Pr);var r=Pr.offsetHeight/50;return r>3&&(e.cachedTextHeight=r),f(e.measure),r||1}function Br(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 ra(e){for(var t=e.display,r={},n={},a=t.gutters.clientLeft,R=t.gutters.firstChild,j=0;R;R=R.nextSibling,++j){var V=e.display.gutterSpecs[j].className;r[V]=R.offsetLeft+R.clientLeft+a,n[V]=R.clientWidth}return{fixedPos:ia(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:r,gutterWidth:n,wrapperWidth:t.wrapper.clientWidth}}function ia(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function Lo(e){var t=_r(e.display),r=e.options.lineWrapping,n=r&&Math.max(5,e.display.scroller.clientWidth/Br(e.display)-3);return function(a){if(On(e.doc,a))return 0;var R=0;if(a.widgets)for(var j=0;j0&&(ee=Ve(e.doc,J.line).text).length==J.ch){var he=te(ee,ee.length,e.options.tabSize)-ee.length;J=Ke(J.line,Math.max(0,Math.round((R-La(e.display).left)/Br(e.display))-he))}return J}function Oi(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)Vn&&Ti(e.doc,t)a.viewFrom?yi(e):(a.viewFrom+=n,a.viewTo+=n);else if(t<=a.viewFrom&&r>=a.viewTo)yi(e);else if(t<=a.viewFrom){var R=Pa(e,r,r+n,1);R?(a.view=a.view.slice(R.index),a.viewFrom=R.lineN,a.viewTo+=n):yi(e)}else if(r>=a.viewTo){var j=Pa(e,t,t,-1);j?(a.view=a.view.slice(0,j.index),a.viewTo=j.lineN):yi(e)}else{var V=Pa(e,t,t,-1),J=Pa(e,r,r+n,1);V&&J?(a.view=a.view.slice(0,V.index).concat(or(e,V.lineN,J.lineN)).concat(a.view.slice(J.index)),a.viewTo+=n):yi(e)}var ee=a.externalMeasured;ee&&(r=a.lineN&&t=n.viewTo)return;var R=n.view[Oi(e,t)];if(R.node==null)return;var j=R.changes||(R.changes=[]);pe(j,r)==-1&&j.push(r)}function yi(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Pa(e,t,r,n){var a=Oi(e,t),R,j=e.display.view;if(!Vn||r==e.doc.first+e.doc.size)return{index:a,lineN:r};for(var V=e.display.viewFrom,J=0;J0){if(a==j.length-1)return null;R=V+j[a].size-t,a++}else R=V-t;t+=R,r+=R}for(;Ti(e.doc,r)!=r;){if(a==(n<0?0:j.length-1))return null;r+=n*j[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=or(e,t,r),n.viewFrom=t):(n.viewFrom>t?n.view=or(e,t,n.viewFrom).concat(n.view):n.viewFromr&&(n.view=n.view.slice(0,Oi(e,r)))),n.viewTo=r}function Po(e){for(var t=e.display.view,r=0,n=0;n=e.display.viewTo||V.to().line0?t.blinker=setInterval(function(){e.hasFocus()||Wi(e),t.cursorDiv.style.visibility=(r=!r)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function ko(e){e.state.focused||(e.display.input.focus(),ro(e))}function Mo(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Wi(e))},100)}function ro(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(Ue(e,"focus",e,t),e.state.focused=!0,H(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 Wi(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(Ue(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 Oa(e){for(var t=e.display,r=t.lineDiv.offsetTop,n=0;n.005||he<-.005)&&(cn(a.line,j),Io(a.line),a.rest))for(var ge=0;gee.display.sizerWidth){var Re=Math.ceil(V/Br(e.display));Re>e.display.maxLineLength&&(e.display.maxLineLength=Re,e.display.maxLine=a.line,e.display.maxLineChanged=!0)}}}function Io(e){if(e.widgets)for(var t=0;t=j&&(R=En(t,Xr(Ve(t,J))-e.wrapper.clientHeight),j=J)}return{from:R,to:Math.max(j,R+1)}}function Ys(e,t){if(Ze(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&&!S){var R=o("div","\u200B",null,`position: absolute; top: `+(t.top-r.viewOffset-ji(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(R),R.scrollIntoView(a),e.display.lineSpace.removeChild(R)}}function $s(e,t,r,n){n==null&&(n=0);var a;!e.options.lineWrapping&&t==r&&(t=t.ch?Ke(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,r=t.sticky=="before"?Ke(t.line,t.ch+1,"before"):t);for(var R=0;R<5;R++){var j=!1,V=rn(e,t),J=!r||r==t?V:rn(e,r);a={left:Math.min(V.left,J.left),top:Math.min(V.top,J.top)-n,right:Math.max(V.left,J.left),bottom:Math.max(V.bottom,J.bottom)+n};var ee=io(e,a),he=e.doc.scrollTop,ge=e.doc.scrollLeft;if(ee.scrollTop!=null&&(sa(e,ee.scrollTop),Math.abs(e.doc.scrollTop-he)>1&&(j=!0)),ee.scrollLeft!=null&&(ki(e,ee.scrollLeft),Math.abs(e.doc.scrollLeft-ge)>1&&(j=!0)),!j)break}return a}function Js(e,t){var r=io(e,t);r.scrollTop!=null&&sa(e,r.scrollTop),r.scrollLeft!=null&&ki(e,r.scrollLeft)}function io(e,t){var r=e.display,n=_r(e.display);t.top<0&&(t.top=0);var a=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:r.scroller.scrollTop,R=Pi(e),j={};t.bottom-t.top>R&&(t.bottom=t.top+R);var V=e.doc.height+Li(r),J=t.topV-n;if(t.topa+R){var he=Math.min(t.top,(ee?V:t.bottom)-R);he!=a&&(j.scrollTop=he)}var ge=e.options.fixedGutter?0:r.gutters.offsetWidth,Re=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:r.scroller.scrollLeft-ge,Se=ii(e)-r.gutters.offsetWidth,He=t.right-t.left>Se;return He&&(t.right=t.left+Se),t.left<10?j.scrollLeft=0:t.leftSe+Re-3&&(j.scrollLeft=t.right+(He?0:10)-Se),j}function ao(e,t){if(t==null)return;Ma(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function Hi(e){Ma(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function oa(e,t,r){(t!=null||r!=null)&&Ma(e),t!=null&&(e.curOp.scrollLeft=t),r!=null&&(e.curOp.scrollTop=r)}function Qs(e,t){Ma(e),e.curOp.scrollToPos=t}function Ma(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var r=Cn(e,t.from),n=Cn(e,t.to);No(e,r,n,t.margin)}}function No(e,t,r,n){var a=io(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});oa(e,a.scrollLeft,a.scrollTop)}function sa(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;D||so(e,{top:t}),Uo(e,t,!0),D&&so(e),da(e,100)}function Uo(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 ki(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,Ho(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function la(e){var t=e.display,r=t.gutters.offsetWidth,n=Math.round(e.doc.height+Li(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 Mi=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),Oe(n,"scroll",function(){n.clientHeight&&t(n.scrollTop,"vertical")}),Oe(a,"scroll",function(){a.clientWidth&&t(a.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,K&&I<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Mi.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 R=e.viewWidth-e.barLeft-(r?n:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+R)+"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}},Mi.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Mi.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Mi.prototype.zeroWidthHack=function(){var e=i&&!w?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new de,this.disableVert=new de},Mi.prototype.enableZeroWidthBar=function(e,t,r){e.style.pointerEvents="auto";function n(){var a=e.getBoundingClientRect(),R=r=="vert"?document.elementFromPoint(a.right-1,(a.top+a.bottom)/2):document.elementFromPoint((a.right+a.left)/2,a.bottom-1);R!=e?e.style.pointerEvents="none":t.set(1e3,n)}t.set(1e3,n)},Mi.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var ua=function(){};ua.prototype.update=function(){return{bottom:0,right:0}},ua.prototype.setScrollLeft=function(){},ua.prototype.setScrollTop=function(){},ua.prototype.clear=function(){};function Ki(e,t){t||(t=la(e));var r=e.display.barWidth,n=e.display.barHeight;Bo(e,t);for(var a=0;a<4&&r!=e.display.barWidth||n!=e.display.barHeight;a++)r!=e.display.barWidth&&e.options.lineWrapping&&Oa(e),Bo(e,la(e)),r=e.display.barWidth,n=e.display.barHeight}function Bo(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 Fo={native:Mi,null:ua};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 Fo[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Oe(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"?ki(e,t):sa(e,t)},e),e.display.scrollbars.addClass&&H(e.display.wrapper,e.display.scrollbars.addClass)}var Zs=0;function Ii(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},Gr(e.curOp)}function Ni(e){var t=e.curOp;t&&Qa(t,function(r){for(var n=0;n=r.viewTo)||r.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new Ia(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&&Oa(t),e.barMeasure=la(t),r.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Me(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-ii(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=dt(e,t.highlightFrontier),a=[];t.iter(n.line,Math.min(t.first+t.size,e.display.viewTo+500),function(R){if(n.line>=e.display.viewFrom){var j=R.styles,V=R.text.length>e.options.maxHighlightLength?Mt(t.mode,n.state):null,J=me(e,R,n,!0);V&&(n.state=V),R.styles=J.styles;var ee=R.styleClasses,he=J.classes;he?R.styleClasses=he:ee&&(R.styleClasses=null);for(var ge=!j||j.length!=R.styles.length||ee!=he&&(!ee||!he||ee.bgClass!=he.bgClass||ee.textClass!=he.textClass),Re=0;!ge&&Rer)return da(e,e.options.workDelay),!0}),t.highlightFrontier=n.line,t.modeFrontier=Math.max(t.modeFrontier,n.line),a.length&&zr(e,function(){for(var R=0;R=r.viewFrom&&t.visible.to<=r.viewTo&&(r.updateLineNumbers==null||r.updateLineNumbers>=r.viewTo)&&r.renderedView==r.view&&Po(e)==0)return!1;Ko(e)&&(yi(e),t.dims=ra(e));var a=n.first+n.size,R=Math.max(t.visible.from-e.options.viewportMargin,n.first),j=Math.min(a,t.visible.to+e.options.viewportMargin);r.viewFromj&&r.viewTo-j<20&&(j=Math.min(a,r.viewTo)),Vn&&(R=Ti(e.doc,R),j=ei(e.doc,j));var V=R!=r.viewFrom||j!=r.viewTo||r.lastWrapHeight!=t.wrapperHeight||r.lastWrapWidth!=t.wrapperWidth;Vs(e,R,j),r.viewOffset=Xr(Ve(e.doc,r.viewFrom)),e.display.mover.style.top=r.viewOffset+"px";var J=Po(e);if(!V&&J==0&&!t.force&&r.renderedView==r.view&&(r.updateLineNumbers==null||r.updateLineNumbers>=r.viewTo))return!1;var ee=sl(e);return J>4&&(r.lineDiv.style.display="none"),ul(e,r.updateLineNumbers,t.dims),J>4&&(r.lineDiv.style.display=""),r.renderedView=r.view,ll(ee),f(r.cursorDiv),f(r.selectionDiv),r.gutters.style.height=r.sizer.style.minHeight=0,V&&(r.lastWrapHeight=t.wrapperHeight,r.lastWrapWidth=t.wrapperWidth,da(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==ii(e)){if(r&&r.top!=null&&(r={top:Math.min(e.doc.height+Li(e.display)-Pi(e),r.top)}),t.visible=ka(e.display,e.doc,r),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else n&&(t.visible=ka(e.display,e.doc,r));if(!oo(e,t))break;Oa(e);var a=la(e);aa(e),Ki(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 Ia(e,t);if(oo(e,r)){Oa(e),Wo(e,r);var n=la(e);aa(e),Ki(e,n),uo(e,n),r.finish()}}function ul(e,t,r){var n=e.display,a=e.options.lineNumbers,R=n.lineDiv,j=R.firstChild;function V(He){var et=He.nextSibling;return O&&i&&e.display.currentWheelTarget==He?He.style.display="none":He.parentNode.removeChild(He),et}for(var J=n.view,ee=n.viewFrom,he=0;he-1&&(Se=!1),Fi(e,ge,ee,r)),Se&&(f(ge.lineNumber),ge.lineNumber.appendChild(document.createTextNode(ht(e.options,ee)))),j=ge.node.nextSibling}ee+=ge.size}for(;j;)j=V(j)}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 Ho(e){var t=e.display,r=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var n=ia(t)-t.scroller.scrollLeft+e.doc.scrollLeft,a=t.gutters.offsetWidth,R=n+"px",j=0;jj.clientWidth,J=j.scrollHeight>j.clientHeight;if(!(n&&V||a&&J))return;if(a&&i&&O){e:for(var ee=t.target,he=R.view;ee!=j;ee=ee.parentNode)for(var ge=0;ge=0&&wt(e,n.to())<=0)return r}return-1};var Pn=function(e,t){this.anchor=e,this.head=t};Pn.prototype.from=function(){return Fn(this.anchor,this.head)},Pn.prototype.to=function(){return Ar(this.anchor,this.head)},Pn.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function ai(e,t,r){var n=e&&e.options.selectionsMayTouch,a=t[r];t.sort(function(Re,Se){return wt(Re.from(),Se.from())}),r=pe(t,a);for(var R=1;R0:J>=0){var ee=Fn(V.from(),j.from()),he=Ar(V.to(),j.to()),ge=V.empty()?j.from()==j.head:V.from()==V.head;R<=r&&--r,t.splice(--R,2,new Pn(ge?he:ee,ge?ee:he))}}return new $r(t,r)}function bi(e,t){return new $r([new Pn(e,t||e)],0)}function Ei(e){return e.text?Ke(e.from.line+e.text.length-1,xe(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Xo(e,t){if(wt(e,t.from)<0)return e;if(wt(e,t.to)<=0)return Ei(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+=Ei(t).ch-t.to.ch),Ke(r,n)}function ho(e,t){for(var r=[],n=0;n1&&e.remove(V.line+1,He-1),e.insert(V.line+1,At)}cr(e,"change",e,t)}function xi(e,t,r){function n(a,R,j){if(a.linked)for(var V=0;V1&&!e.done[e.done.length-2].ranges)return e.done.pop(),xe(e.done)}function qo(e,t,r,n){var a=e.history;a.undone.length=0;var R=+new Date,j,V;if((a.lastOp==n||a.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&a.lastModTime>R-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(j=pl(a,a.lastOp==n)))V=xe(j.changes),wt(t.from,t.to)==0&&wt(t.from,V.to)==0?V.to=Ei(t):j.changes.push(mo(e,t));else{var J=xe(a.done);for((!J||!J.ranges)&&Ba(e.sel,a.done),j={changes:[mo(e,t)],generation:a.generation},a.done.push(j);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=R,a.lastOp=a.lastSelOp=n,a.lastOrigin=a.lastSelOrigin=t.origin,V||Ue(e,"historyAdded")}function ml(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 gl(e,t,r,n){var a=e.history,R=n&&n.origin;r==a.lastSelOp||R&&a.lastSelOrigin==R&&(a.lastModTime==a.lastSelTime&&a.lastOrigin==R||ml(e,R,xe(a.done),t))?a.done[a.done.length-1]=t:Ba(t,a.done),a.lastSelTime=+new Date,a.lastSelOrigin=R,a.lastSelOp=r,n&&n.clearRedo!==!1&&Zo(a.undone)}function Ba(e,t){var r=xe(t);r&&r.ranges&&r.equals(e)||t.push(e)}function es(e,t,r,n){var a=t["spans_"+e.id],R=0;e.iter(Math.max(e.first,r),Math.min(e.first+e.size,n),function(j){j.markedSpans&&((a||(a=t["spans_"+e.id]={}))[R]=j.markedSpans),++R})}function vl(e){if(!e)return null;for(var t,r=0;r-1&&(xe(V)[ge]=ee[ge],delete ee[ge]))}}return n}function go(e,t,r,n){if(n){var a=e.anchor;if(r){var R=wt(t,a)<0;R!=wt(r,a)<0?(a=t,t=r):R!=wt(t,r)<0&&(t=r)}return new Pn(a,t)}else return new Pn(r||t,t)}function Fa(e,t,r,n,a){a==null&&(a=e.cm&&(e.cm.display.shift||e.extend)),Dr(e,new $r([go(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),R=0;R=t.ch:V.to>t.ch))){if(a&&(Ue(J,"beforeCursorEnter"),J.explicitlyCleared))if(R.markedSpans){--j;continue}else break;if(!J.atomic)continue;if(r){var ge=J.find(n<0?1:-1),Re=void 0;if((n<0?he:ee)&&(ge=ls(e,ge,-n,ge&&ge.line==t.line?R:null)),ge&&ge.line==t.line&&(Re=wt(ge,r))&&(n<0?Re<0:Re>0))return zi(e,ge,t,n,a)}var Se=J.find(n<0?-1:1);return(n<0?ee:he)&&(Se=ls(e,Se,n,Se.line==t.line?R:null)),Se?zi(e,Se,t,n,a):null}}return t}function Wa(e,t,r,n,a){var R=n||1,j=zi(e,t,r,R,a)||!a&&zi(e,t,r,R,!0)||zi(e,t,r,-R,a)||!a&&zi(e,t,r,-R,!0);return j||(e.cantEdit=!0,Ke(e.first,0))}function ls(e,t,r,n){return r<0&&t.ch==0?t.line>e.first?p(e,Ke(t.line-1)):null:r>0&&t.ch==(n||Ve(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]==""&&wt(t.from,t.to)==0)return;var r=ho(e,t);qo(e,t,r,e.cm?e.cm.curOp.id:NaN),fa(e,t,r,Sn(e,t));var n=[];xi(e,function(a,R){!R&&pe(n,a.history)==-1&&(ms(a.history,t),n.push(a.history)),fa(a,t,null,Sn(a,t))})}function Ha(e,t,r){var n=e.cm&&e.cm.state.suppressEdits;if(n&&!r)return;for(var a=e.history,R,j=e.sel,V=t=="undo"?a.done:a.undone,J=t=="undo"?a.undone:a.done,ee=0;ee=0;--Se){var He=Re(Se);if(He)return He.v}}function hs(e,t){if(t==0)return;if(e.first+=t,e.sel=new $r(Ie(e.sel.ranges,function(a){return new Pn(Ke(a.anchor.line+t,a.anchor.ch),Ke(a.head.line+t,a.head.ch))}),e.sel.primIndex),e.cm){Fr(e.cm,e.first,e.first-t,t);for(var r=e.cm.display,n=r.viewFrom;ne.lastLine())return;if(t.from.lineR&&(t={from:t.from,to:Ke(R,Ve(e,R).text.length),text:[t.text[0]],origin:t.origin}),t.removed=ln(e,t.from,t.to),r||(r=ho(e,t)),e.cm?El(e.cm,t,n):po(e,t,n),ja(e,r,_e),e.cantEdit&&Wa(e,Ke(e.firstLine(),0))&&(e.cantEdit=!1)}function El(e,t,r){var n=e.doc,a=e.display,R=t.from,j=t.to,V=!1,J=R.line;e.options.lineWrapping||(J=qt(gr(Ve(n,R.line))),n.iter(J,j.line+1,function(Se){if(Se==a.maxLine)return V=!0,!0})),n.sel.contains(t.from,t.to)>-1&&Ee(e),po(n,t,r,Lo(e)),e.options.lineWrapping||(n.iter(J,R.line+t.text.length,function(Se){var He=pi(Se);He>a.maxLineLength&&(a.maxLine=Se,a.maxLineLength=He,a.maxLineChanged=!0,V=!1)}),V&&(e.curOp.updateMaxLine=!0)),Rr(n,R.line),da(e,400);var ee=t.text.length-(j.line-R.line)-1;t.full?Fr(e):R.line==j.line&&t.text.length==1&&!$o(e.doc,t)?vi(e,R.line,"text"):Fr(e,R.line,j.line+1,ee);var he=fe(e,"changes"),ge=fe(e,"change");if(ge||he){var Re={from:R,to:j,text:t.text,removed:t.removed,origin:t.origin};ge&&cr(e,"change",e,Re),he&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(Re)}e.display.selForContextMenu=null}function Xi(e,t,r,n,a){var R;n||(n=r),wt(n,r)<0&&(R=[n,r],r=R[0],n=R[1]),typeof t=="string"&&(t=e.splitLines(t)),Vi(e,{from:r,to:n,text:t,origin:a})}function fs(e,t,r,n){r1||!(this.children[0]instanceof ma))){var V=[];this.collapse(V),this.children=[new ma(V)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t50){for(var j=a.lines.length%25+25,V=j;V10);e.parent.maybeSpill()},iterN:function(e,t,r){for(var n=0;ne.display.maxLineLength&&(e.display.maxLine=ee,e.display.maxLineLength=he,e.display.maxLineChanged=!0)}n!=null&&e&&this.collapsed&&Fr(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&&cr(e,"markerCleared",e,this,n,a),t&&Ni(e),this.parent&&this.parent.clear()},_i.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var r,n,a=0;a0||j==0&&R.clearWhenEmpty!==!1)return R;if(R.replacedWith&&(R.collapsed=!0,R.widgetNode=b("span",[R.replacedWith],"CodeMirror-widget"),n.handleMouseEvents||R.widgetNode.setAttribute("cm-ignore-events","true"),n.insertLeft&&(R.widgetNode.insertLeft=!0)),R.collapsed){if(ar(e,t.line,t,r,R)||t.line!=r.line&&ar(e,r.line,t,r,R))throw new Error("Inserting collapsed marker partially overlapping an existing one");Te()}R.addToHistory&&qo(e,{from:t,to:r,origin:"markText"},e.sel,NaN);var V=t.line,J=e.cm,ee;if(e.iter(V,r.line+1,function(ge){J&&R.collapsed&&!J.options.lineWrapping&&gr(ge)==J.display.maxLine&&(ee=!0),R.collapsed&&V!=t.line&&cn(ge,0),Nt(ge,new nt(R,V==t.line?t.ch:null,V==r.line?r.ch:null)),++V}),R.collapsed&&e.iter(t.line,r.line+1,function(ge){On(e,ge)&&cn(ge,0)}),R.clearOnEnter&&Oe(R,"beforeCursorEnter",function(){return R.clear()}),R.readOnly&&(_t(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),R.collapsed&&(R.id=++vs,R.atomic=!0),J){if(ee&&(J.curOp.updateMaxLine=!0),R.collapsed)Fr(J,t.line,r.line+1);else if(R.className||R.startStyle||R.endStyle||R.css||R.attributes||R.title)for(var he=t.line;he<=r.line;he++)vi(J,he,"text");R.atomic&&os(J.doc),cr(J,"markerAdded",J,R)}return R}var ya=function(e,t){this.markers=e,this.primary=t;for(var r=0;r=0;J--)Vi(this,n[J]);V?is(this,V):this.cm&&Hi(this.cm)}),undo:Sr(function(){Ha(this,"undo")}),redo:Sr(function(){Ha(this,"redo")}),undoSelection:Sr(function(){Ha(this,"undo",!0)}),redoSelection:Sr(function(){Ha(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=p(this,e),t=p(this,t);var n=[],a=e.line;return this.iter(e.line,t.line+1,function(R){var j=R.markedSpans;if(j)for(var V=0;V=J.to||J.from==null&&a!=e.line||J.from!=null&&a==t.line&&J.from>=t.ch)&&(!r||r(J.marker))&&n.push(J.marker.parent||J.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-=R,++r}),p(this,Ke(r,t))},indexFromPos:function(e){e=p(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 he=e.dataTransfer.getData("Text");if(he){var ge;if(t.state.draggingText&&!t.state.draggingText.copy&&(ge=t.listSelections()),ja(t.doc,bi(r,r)),ge)for(var Re=0;Re=0;V--)Xi(e.doc,"",n[V].from,n[V].to,"+delete");Hi(e)})}function yo(e,t,r){var n=ke(e.text,t+r,r);return n<0||n>e.text.length?null:n}function bo(e,t,r){var n=yo(e,t.ch,r);return n==null?null:new Ke(t.line,n,r<0?"after":"before")}function Eo(e,t,r,n,a){if(e){t.doc.direction=="rtl"&&(a=-a);var R=gt(r,t.doc.direction);if(R){var j=a<0?xe(R):R[0],V=a<0==(j.level==1),J=V?"after":"before",ee;if(j.level>0||t.doc.direction=="rtl"){var he=mt(t,r);ee=a<0?r.text.length-1:0;var ge=Ct(t,he,ee).top;ee=ct(function(Re){return Ct(t,he,Re).top==ge},a<0==(j.level==1)?j.from:j.to-1,ee),J=="before"&&(ee=yo(r,ee,1))}else ee=a<0?j.to:j.from;return new Ke(n,ee,J)}}return new Ke(n,a<0?r.text.length:0,a<0?"before":"after")}function Ml(e,t,r,n){var a=gt(t,e.doc.direction);if(!a)return bo(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 R=lt(a,r.ch,r.sticky),j=a[R];if(e.doc.direction=="ltr"&&j.level%2==0&&(n>0?j.to>r.ch:j.from=j.from&&Re>=he.begin)){var Se=ge?"before":"after";return new Ke(r.line,Re,Se)}}var He=function(At,Ut,Rt){for(var Wt=function(Wn,Tr){return Tr?new Ke(r.line,V(Wn,1),"before"):new Ke(r.line,Wn,"after")};At>=0&&At0==(tn.level!=1),pn=$t?Rt.begin:V(Rt.end,-1);if(tn.from<=pn&&pn0?he.end:V(he.begin,-1);return pt!=null&&!(n>0&&pt==t.text.length)&&(et=He(n>0?0:a.length-1,n,ee(pt)),et)?et:null}var xa={selectAll:us,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),_e)},killLine:function(e){return Ji(e,function(t){if(t.empty()){var r=Ve(e.doc,t.head.line).text.length;return t.head.ch==r&&t.head.line0)a=new Ke(a.line,a.ch+1),e.replaceRange(R.charAt(a.ch-1)+R.charAt(a.ch-2),Ke(a.line,a.ch-2),a,"+transpose");else if(a.line>e.doc.first){var j=Ve(e.doc,a.line-1).text;j&&(a=new Ke(a.line,1),e.replaceRange(R.charAt(0)+e.doc.lineSeparator()+j.charAt(j.length-1),Ke(a.line-1,j.length-1),a,"+transpose"))}}r.push(new Pn(a,a))}e.setSelections(r)})},newlineAndIndent:function(e){return zr(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&&wt(t,this.pos)==0&&r==this.button};var Ca,Sa;function Wl(e,t){var r=+new Date;return Sa&&Sa.compare(r,e,t)?(Ca=Sa=null,"triple"):Ca&&Ca.compare(r,e,t)?(Sa=new _o(r,e,t),Ca=null,"double"):(Ca=new _o(r,e,t),Sa=null,"single")}function ks(e){var t=this,r=t.display;if(Ze(t,e)||r.activeTouch&&r.input.supportsTouch())return;if(r.input.ensurePolled(),r.shift=e.shiftKey,ri(r,e)){O||(r.scroller.draggable=!1,setTimeout(function(){return r.scroller.draggable=!0},100));return}if(Co(t,e))return;var n=Di(t,e),a=we(e),R=n?Wl(n,a):"single";if(window.focus(),a==1&&t.state.selectingText&&t.state.selectingText(e),n&&Hl(t,a,n,R,e))return;a==1?n?Gl(t,n,R,e):ue(e)==r.scroller&&ne(e):a==2?(n&&Fa(t.doc,n),setTimeout(function(){return r.input.focus()},20)):a==3&&(u?t.display.input.onContextMenu(e):Mo(t))}function Hl(e,t,r,n,a){var R="Click";return n=="double"?R="Double"+R:n=="triple"&&(R="Triple"+R),R=(t==1?"Left":t==2?"Middle":"Right")+R,_a(e,Ss(R,a),a,function(j){if(typeof j=="string"&&(j=xa[j]),!j)return!1;var V=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),V=j(e,r)!=Ce}finally{e.state.suppressEdits=!1}return V})}function Kl(e,t,r){var n=e.getOption("configureMouse"),a=n?n(e,t,r):{};if(a.unit==null){var R=c?r.shiftKey&&r.metaKey:r.altKey;a.unit=R?"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){K?setTimeout(G(ko,e),0):e.curOp.focus=k();var a=Kl(e,r,n),R=e.doc.sel,j;e.options.dragDrop&&Le&&!e.isReadOnly()&&r=="single"&&(j=R.contains(t))>-1&&(wt((j=R.ranges[j]).from(),t)<0||t.xRel>0)&&(wt(j.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,R=!1,j=Cr(e,function(ee){O&&(a.scroller.draggable=!1),e.state.draggingText=!1,St(a.wrapper.ownerDocument,"mouseup",j),St(a.wrapper.ownerDocument,"mousemove",V),St(a.scroller,"dragstart",J),St(a.scroller,"drop",j),R||(ne(ee),n.addNew||Fa(e.doc,r,null,null,n.extend),O&&!P||K&&I==9?setTimeout(function(){a.wrapper.ownerDocument.body.focus({preventScroll:!0}),a.input.focus()},20):a.input.focus())}),V=function(ee){R=R||Math.abs(t.clientX-ee.clientX)+Math.abs(t.clientY-ee.clientY)>=10},J=function(){return R=!0};O&&(a.scroller.draggable=!0),e.state.draggingText=j,j.copy=!n.moveOnDrag,a.scroller.dragDrop&&a.scroller.dragDrop(),Oe(a.wrapper.ownerDocument,"mouseup",j),Oe(a.wrapper.ownerDocument,"mousemove",V),Oe(a.scroller,"dragstart",J),Oe(a.scroller,"drop",j),Mo(e),setTimeout(function(){return a.input.focus()},20)}function Ms(e,t,r){if(r=="char")return new Pn(t,t);if(r=="word")return e.findWordAt(t);if(r=="line")return new Pn(Ke(t.line,0),p(e.doc,Ke(t.line+1,0)));var n=r(e,t);return new Pn(n.from,n.to)}function Vl(e,t,r,n){var a=e.display,R=e.doc;ne(t);var j,V,J=R.sel,ee=J.ranges;if(n.addNew&&!n.extend?(V=R.sel.contains(r),V>-1?j=ee[V]:j=new Pn(r,r)):(j=R.sel.primary(),V=R.sel.primIndex),n.unit=="rectangle")n.addNew||(j=new Pn(r,r)),r=Di(e,t,!0,!0),V=-1;else{var he=Ms(e,r,n.unit);n.extend?j=go(j,he.anchor,he.head,n.extend):j=he}n.addNew?V==-1?(V=ee.length,Dr(R,ai(e,ee.concat([j]),V),{scroll:!1,origin:"*mouse"})):ee.length>1&&ee[V].empty()&&n.unit=="char"&&!n.extend?(Dr(R,ai(e,ee.slice(0,V).concat(ee.slice(V+1)),0),{scroll:!1,origin:"*mouse"}),J=R.sel):vo(R,V,j,le):(V=0,Dr(R,new $r([j],0),le),J=R.sel);var ge=r;function Re(Rt){if(wt(ge,Rt)==0)return;if(ge=Rt,n.unit=="rectangle"){for(var Wt=[],tn=e.options.tabSize,$t=te(Ve(R,r.line).text,r.ch,tn),pn=te(Ve(R,Rt.line).text,Rt.ch,tn),Wn=Math.min($t,pn),Tr=Math.max($t,pn),Jn=Math.min(r.line,Rt.line),Vr=Math.min(e.lastLine(),Math.max(r.line,Rt.line));Jn<=Vr;Jn++){var Wr=Ve(R,Jn).text,ur=ve(Wr,Wn,tn);Wn==Tr?Wt.push(new Pn(Ke(Jn,ur),Ke(Jn,ur))):Wr.length>ur&&Wt.push(new Pn(Ke(Jn,ur),Ke(Jn,ve(Wr,Tr,tn))))}Wt.length||Wt.push(new Pn(r,r)),Dr(R,ai(e,J.ranges.slice(0,V).concat(Wt),V),{origin:"*mouse",scroll:!1}),e.scrollIntoView(Rt)}else{var Hr=j,Lr=Ms(e,Rt,n.unit),hr=Hr.anchor,dr;wt(Lr.anchor,hr)>0?(dr=Lr.head,hr=Fn(Hr.from(),Lr.anchor)):(dr=Lr.anchor,hr=Ar(Hr.to(),Lr.head));var Zn=J.ranges.slice(0);Zn[V]=Xl(e,new Pn(p(R,hr),dr)),Dr(R,ai(e,Zn,V),le)}}var Se=a.wrapper.getBoundingClientRect(),He=0;function et(Rt){var Wt=++He,tn=Di(e,Rt,!0,n.unit=="rectangle");if(!tn)return;if(wt(tn,ge)!=0){e.curOp.focus=k(),Re(tn);var $t=ka(a,R);(tn.line>=$t.to||tn.line<$t.from)&&setTimeout(Cr(e,function(){He==Wt&&et(Rt)}),150)}else{var pn=Rt.clientYSe.bottom?20:0;pn&&setTimeout(Cr(e,function(){if(He!=Wt)return;a.scroller.scrollTop+=pn,et(Rt)}),50)}}function pt(Rt){e.state.selectingText=!1,He=Infinity,Rt&&(ne(Rt),a.input.focus()),St(a.wrapper.ownerDocument,"mousemove",At),St(a.wrapper.ownerDocument,"mouseup",Ut),R.history.lastSelOrigin=null}var At=Cr(e,function(Rt){Rt.buttons===0||!we(Rt)?pt(Rt):et(Rt)}),Ut=Cr(e,pt);e.state.selectingText=Ut,Oe(a.wrapper.ownerDocument,"mousemove",At),Oe(a.wrapper.ownerDocument,"mouseup",Ut)}function Xl(e,t){var r=t.anchor,n=t.head,a=Ve(e.doc,r.line);if(wt(r,n)==0&&r.sticky==n.sticky)return t;var R=gt(a);if(!R)return t;var j=lt(R,r.ch,r.sticky),V=R[j];if(V.from!=r.ch&&V.to!=r.ch)return t;var J=j+(V.from==r.ch==(V.level!=1)?0:1);if(J==0||J==R.length)return t;var ee;if(n.line!=r.line)ee=(n.line-r.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var he=lt(R,n.ch,n.sticky),ge=he-j||(n.ch-r.ch)*(V.level==1?-1:1);he==J-1||he==J?ee=ge<0:ee=ge>0}var Re=R[J+(ee?-1:0)],Se=ee==(Re.level==1),He=Se?Re.from:Re.to,et=Se?"after":"before";return r.ch==He&&r.sticky==et?t:new Pn(new Ke(r.line,He,et),n)}function Is(e,t,r,n){var a,R;if(t.touches)a=t.touches[0].clientX,R=t.touches[0].clientY;else try{a=t.clientX,R=t.clientY}catch(Re){return!1}if(a>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;n&&ne(t);var j=e.display,V=j.lineDiv.getBoundingClientRect();if(R>V.bottom||!fe(e,r))return ae(t);R-=V.top-j.viewOffset;for(var J=0;J=a){var he=En(e.doc,R),ge=e.display.gutterSpecs[J];return Ue(e,r,e,he,ge.className,t),ae(t)}}}function Co(e,t){return Is(e,t,"gutterClick",!0)}function Ns(e,t){if(ri(e.display,t)||Yl(e,t))return;if(Ze(e,t,"contextmenu"))return;u||e.display.input.onContextMenu(t)}function Yl(e,t){return fe(e,"gutterContextMenu")?Is(e,t,"gutterContextMenu",!1):!1}function Us(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),Gn(e)}var Qi={toString:function(){return"CodeMirror.Init"}},Bs={},Va={};function $l(e){var t=e.optionHandlers;function r(n,a,R,j){e.defaults[n]=a,R&&(t[n]=j?function(V,J,ee){ee!=Qi&&R(V,J,ee)}:R)}e.defineOption=r,e.Init=Qi,r("value","",function(n,a){return n.setValue(a)},!0),r("mode",null,function(n,a){n.doc.modeOption=a,fo(n)},!0),r("indentUnit",2,fo,!0),r("indentWithTabs",!1),r("smartIndent",!0),r("tabSize",4,function(n){ha(n),Gn(n),Fr(n)},!0),r("lineSeparator",null,function(n,a){if(n.doc.lineSep=a,!a)return;var R=[],j=n.doc.first;n.doc.iter(function(J){for(var ee=0;;){var he=J.text.indexOf(a,ee);if(he==-1)break;ee=he+a.length,R.push(Ke(j,he))}j++});for(var V=R.length-1;V>=0;V--)Xi(n.doc,a,R[V],Ke(R[V].line,R[V].ch+a.length))}),r("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(n,a,R){n.state.specialChars=new RegExp(a.source+(a.test(" ")?"":"| "),"g"),R!=Qi&&n.refresh()}),r("specialCharPlaceholder",kn,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",!C),r("wholeLineUpdateBefore",!0),r("theme","default",function(n){Us(n),ca(n)},!0),r("keyMap","default",function(n,a,R){var j=Ga(a),V=R!=Qi&&Ga(R);V&&V.detach&&V.detach(n,j),j.attach&&j.attach(n,V||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),ca(n)},!0),r("fixedGutter",!0,function(n,a){n.display.gutters.style.left=a?ia(n.display)+"px":"0",n.refresh()},!0),r("coverGutterNextToScrollbar",!1,function(n){return Ki(n)},!0),r("scrollbarStyle","native",function(n){jo(n),Ki(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),ca(n)},!0),r("firstLineNumber",1,ca,!0),r("lineNumberFormatter",function(n){return n},ca,!0),r("showCursorWhenSelecting",!1,aa,!0),r("resetSelectionOnContextMenu",!0),r("lineWiseCopyCut",!0),r("pasteLinesPerSelection",!0),r("selectionsMayTouch",!1),r("readOnly",!1,function(n,a){a=="nocursor"&&(Wi(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,aa,!0),r("singleCursorHeightPerLine",!0,aa,!0),r("workTime",100),r("workDelay",100),r("flattenSpans",!0,ha,!0),r("addModeClass",!1,ha,!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,ha,!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!=Qi;if(!t!=!n){var a=e.display.dragFunctions,R=t?Oe:St;R(e.display.scroller,"dragstart",a.start),R(e.display.scroller,"dragenter",a.enter),R(e.display.scroller,"dragover",a.over),R(e.display.scroller,"dragleave",a.leave),R(e.display.scroller,"drop",a.drop)}}function Ql(e){e.options.lineWrapping?(H(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(d(e.display.wrapper,"CodeMirror-wrap"),ni(e)),to(e),Fr(e),Gn(e),setTimeout(function(){return Ki(e)},100)}function Yn(e,t){var r=this;if(!(this instanceof Yn))return new Yn(e,t);this.options=t=t?B(t):{},B(Bs,t,!1);var n=t.value;typeof n=="string"?n=new jr(n,t.mode,null,t.lineSeparator,t.direction):t.mode&&(n.modeOption=t.mode),this.doc=n;var a=new Yn.inputStyles[t.inputStyle](this),R=this.display=new dl(e,n,a,t);R.wrapper.CodeMirror=this,Us(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 de,keySeq:null,specialChars:null},t.autofocus&&!l&&R.input.focus(),K&&I<11&&setTimeout(function(){return r.display.input.reset(!0)},20),Zl(this),Ll(),Ii(this),this.curOp.forceUpdate=!0,Jo(this,n),t.autofocus&&!l||this.hasFocus()?setTimeout(function(){r.hasFocus()&&!r.state.focused&&ro(r)},20):Wi(this);for(var j in Va)Va.hasOwnProperty(j)&&Va[j](this,t[j],Qi);Ko(this),t.finishInit&&t.finishInit(this);for(var V=0;V20*20}Oe(t.scroller,"touchstart",function(J){if(!Ze(e,J)&&!R(J)&&!Co(e,J)){t.input.ensurePolled(),clearTimeout(r);var ee=+new Date;t.activeTouch={start:ee,moved:!1,prev:ee-n.end<=300?n:null},J.touches.length==1&&(t.activeTouch.left=J.touches[0].pageX,t.activeTouch.top=J.touches[0].pageY)}}),Oe(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Oe(t.scroller,"touchend",function(J){var ee=t.activeTouch;if(ee&&!ri(t,J)&&ee.left!=null&&!ee.moved&&new Date-ee.start<300){var he=e.coordsChar(t.activeTouch,"page"),ge;!ee.prev||j(ee,ee.prev)?ge=new Pn(he,he):!ee.prev.prev||j(ee,ee.prev.prev)?ge=e.findWordAt(he):ge=new Pn(Ke(he.line,0),p(e.doc,Ke(he.line+1,0))),e.setSelection(ge.anchor,ge.head),e.focus(),ne(J)}a()}),Oe(t.scroller,"touchcancel",a),Oe(t.scroller,"scroll",function(){t.scroller.clientHeight&&(sa(e,t.scroller.scrollTop),ki(e,t.scroller.scrollLeft,!0),Ue(e,"scroll",e))}),Oe(t.scroller,"mousewheel",function(J){return Vo(e,J)}),Oe(t.scroller,"DOMMouseScroll",function(J){return Vo(e,J)}),Oe(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(J){Ze(e,J)||ce(J)},over:function(J){Ze(e,J)||(Rl(e,J),ce(J))},start:function(J){return Al(e,J)},drop:Cr(e,wl),leave:function(J){Ze(e,J)||Es(e)}};var V=t.input.getField();Oe(V,"keyup",function(J){return Ds.call(e,J)}),Oe(V,"keydown",Cr(e,Ps)),Oe(V,"keypress",Cr(e,Os)),Oe(V,"focus",function(J){return ro(e,J)}),Oe(V,"blur",function(J){return Wi(e,J)})}var So=[];Yn.defineInitHook=function(e){return So.push(e)};function Ta(e,t,r,n){var a=e.doc,R;r==null&&(r="add"),r=="smart"&&(a.mode.indent?R=dt(e,t).state:r="prev");var j=e.options.tabSize,V=Ve(a,t),J=te(V.text,null,j);V.stateAfter&&(V.stateAfter=null);var ee=V.text.match(/^\s*/)[0],he;if(!n&&!/\S/.test(V.text))he=0,r="not";else if(r=="smart"&&(he=a.mode.indent(R,V.text.slice(ee.length),V.text),he==Ce||he>150)){if(!n)return;r="prev"}r=="prev"?t>a.first?he=te(Ve(a,t-1).text,null,j):he=0:r=="add"?he=J+e.options.indentUnit:r=="subtract"?he=J-e.options.indentUnit:typeof r=="number"&&(he=J+r),he=Math.max(0,he);var ge="",Re=0;if(e.options.indentWithTabs)for(var Se=Math.floor(he/j);Se;--Se)Re+=j,ge+=" ";if(Rej,J=ot(t),ee=null;if(V&&n.ranges.length>1)if(oi&&oi.text.join(` `)==t){if(n.ranges.length%oi.text.length==0){ee=[];for(var he=0;he=0;Re--){var Se=n.ranges[Re],He=Se.from(),et=Se.to();Se.empty()&&(r&&r>0?He=Ke(He.line,He.ch-r):e.state.overwrite&&!V?et=Ke(et.line,Math.min(Ve(R,et.line).text.length,et.ch+xe(J).length)):V&&oi&&oi.lineWise&&oi.text.join(` `)==J.join(` `)&&(He=et=Ke(He.line,0)));var pt={from:He,to:et,text:ee?ee[Re%ee.length]:J,origin:a||(V?"paste":e.state.cutIncoming>j?"cut":"+input")};Vi(e.doc,pt),cr(e,"inputRead",e,pt)}t&&!V&&js(e,t),Hi(e),e.curOp.updateInput<2&&(e.curOp.updateInput=ge),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Fs(e,t){var r=e.clipboardData&&e.clipboardData.getData("Text");if(r)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&zr(t,function(){return To(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 R=e.getModeAt(a.head),j=!1;if(R.electricChars){for(var V=0;V-1){j=Ta(e,a.head.line,"smart");break}}else R.electricInput&&(R.electricInput.test(Ve(e.doc,a.head.line).text.slice(0,a.head.ch))&&(j=Ta(e,a.head.line,"smart")));j&&cr(e,"electricInput",e,a.head.line)}}function Ws(e){for(var t=[],r=[],n=0;nR&&(Ta(this,V.head.line,n,!0),R=V.head.line,j==this.doc.sel.primIndex&&Hi(this));else{var J=V.from(),ee=V.to(),he=Math.max(R,J.line);R=Math.min(this.lastLine(),ee.line-(ee.ch?0:1))+1;for(var ge=he;ge0&&vo(this.doc,j,new Pn(J,Re[j].to()),_e)}}}),getTokenAt:function(n,a){return Rn(this,n,a)},getLineTokens:function(n,a){return Rn(this,Ke(n),a,!0)},getTokenTypeAt:function(n){n=p(this.doc,n);var a=Ye(this,Ve(this.doc,n.line)),R=0,j=(a.length-1)/2,V=n.ch,J;if(V==0)J=a[2];else for(;;){var ee=R+j>>1;if((ee?a[ee*2-1]:0)>=V)j=ee;else if(a[ee*2+1]J&&(n=J,j=!0),V=Ve(this.doc,n)}else V=n;return Qn(this,V,{top:0,left:0},a||"page",R||j).top+(j?this.doc.height-Xr(V):0)},defaultTextHeight:function(){return _r(this.display)},defaultCharWidth:function(){return Br(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(n,a,R,j,V){var J=this.display;n=rn(this,p(this.doc,n));var ee=n.bottom,he=n.left;if(a.style.position="absolute",a.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(a),J.sizer.appendChild(a),j=="over")ee=n.top;else if(j=="above"||j=="near"){var ge=Math.max(J.wrapper.clientHeight,this.doc.height),Re=Math.max(J.sizer.clientWidth,J.lineSpace.clientWidth);(j=="above"||n.bottom+a.offsetHeight>ge)&&n.top>a.offsetHeight?ee=n.top-a.offsetHeight:n.bottom+a.offsetHeight<=ge&&(ee=n.bottom),he+a.offsetWidth>Re&&(he=Re-a.offsetWidth)}a.style.top=ee+"px",a.style.left=a.style.right="",V=="right"?(he=J.sizer.clientWidth-a.offsetWidth,a.style.right="0px"):(V=="left"?he=0:V=="middle"&&(he=(J.sizer.clientWidth-a.offsetWidth)/2),a.style.left=he+"px"),R&&Js(this,{left:he,top:ee,right:he+a.offsetWidth,bottom:ee+a.offsetHeight})},triggerOnKeyDown:Nr(Ps),triggerOnKeyPress:Nr(Os),triggerOnKeyUp:Ds,triggerOnMouseDown:Nr(ks),execCommand:function(n){if(xa.hasOwnProperty(n))return xa[n].call(null,this)},triggerElectric:Nr(function(n){js(this,n)}),findPosH:function(n,a,R,j){var V=1;a<0&&(V=-1,a=-a);for(var J=p(this.doc,n),ee=0;ee0&&he(R.charAt(j-1));)--j;for(;V.5||this.options.lineWrapping)&&to(this),Ue(this,"refresh",this)}),swapDoc:Nr(function(n){var a=this.doc;return a.cm=null,this.state.selectingText&&this.state.selectingText(),Jo(this,n),Gn(this),this.display.input.reset(),oa(this,n.scrollLeft,n.scrollTop),this.curOp.forceScroll=!0,cr(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}},be(e),e.registerHelper=function(n,a,R){r.hasOwnProperty(n)||(r[n]=e[n]={_global:[]}),r[n][a]=R},e.registerGlobalHelper=function(n,a,R,j){e.registerHelper(n,a,j),r[n]._global.push({pred:R,val:j})}}function wo(e,t,r,n,a){var R=t,j=r,V=Ve(e,t.line),J=a&&e.direction=="rtl"?-r:r;function ee(){var Ut=t.line+J;return Ut=e.first+e.size?!1:(t=new Ke(Ut,t.ch,t.sticky),V=Ve(e,Ut))}function he(Ut){var Rt;if(n=="codepoint"){var Wt=V.text.charCodeAt(t.ch+(n>0?0:-1));isNaN(Wt)?Rt=null:Rt=new Ke(t.line,Math.max(0,Math.min(V.text.length,t.ch+r*(Wt>=55296&&Wt<56320?2:1))),-r)}else a?Rt=Ml(e.cm,V,t,r):Rt=bo(V,t,r);if(Rt==null)if(!Ut&&ee())t=Eo(a,e.cm,V,t.line,J);else return!1;else t=Rt;return!0}if(n=="char"||n=="codepoint")he();else if(n=="column")he(!0);else if(n=="word"||n=="group")for(var ge=null,Re=n=="group",Se=e.cm&&e.cm.getHelper(t,"wordChars"),He=!0;!(r<0&&!he(!He));He=!1){var et=V.text.charAt(t.ch)||` `,pt=We(et,Se)?"w":Re&&et==` `?"n":!Re||/\s/.test(et)?null:"p";if(Re&&!He&&!pt&&(pt="s"),ge&&ge!=pt){r<0&&(r=1,he(),t.sticky="after");break}if(pt&&(ge=pt),r>0&&!he(!He))break}var At=Wa(e,t,R,j,!0);return Hn(R,At)&&(At.hitSide=!0),At}function Gs(e,t,r,n){var a=e.doc,R=t.left,j;if(n=="page"){var V=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),J=Math.max(V-.5*_r(e.display),3);j=(r>0?t.bottom:t.top)+r*J}else n=="line"&&(j=r>0?t.bottom+3:t.top-3);for(var ee;!(ee=Er(e,R,j),!ee.outside);){if(r<0?j<=0:j>=a.height){ee.hitSide=!0;break}j+=r*5}return ee}var Nn=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new de,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};Nn.prototype.init=function(e){var t=this,r=this,n=r.cm,a=r.div=e.lineDiv;Hs(a,n.options.spellcheck,n.options.autocorrect,n.options.autocapitalize);function R(V){for(var J=V.target;J;J=J.parentNode){if(J==a)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(J.className))break}return!1}Oe(a,"paste",function(V){if(!R(V)||Ze(n,V)||Fs(V,n))return;I<=11&&setTimeout(Cr(n,function(){return t.updateFromDOM()}),20)}),Oe(a,"compositionstart",function(V){t.composing={data:V.data,done:!1}}),Oe(a,"compositionupdate",function(V){t.composing||(t.composing={data:V.data,done:!1})}),Oe(a,"compositionend",function(V){t.composing&&(V.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Oe(a,"touchstart",function(){return r.forceCompositionEnd()}),Oe(a,"input",function(){t.composing||t.readFromDOMSoon()});function j(V){if(!R(V)||Ze(n,V))return;if(n.somethingSelected())Xa({lineWise:!1,text:n.getSelections()}),V.type=="cut"&&n.replaceSelection("",null,"cut");else if(n.options.lineWiseCopyCut){var J=Ws(n);Xa({lineWise:!0,text:J.text}),V.type=="cut"&&n.operation(function(){n.setSelections(J.ranges,0,_e),n.replaceSelection("",null,"cut")})}else return;if(V.clipboardData){V.clipboardData.clearData();var ee=oi.text.join(` `);if(V.clipboardData.setData("Text",ee),V.clipboardData.getData("Text")==ee){V.preventDefault();return}}var he=Ks(),ge=he.firstChild;n.display.lineSpace.insertBefore(he,n.display.lineSpace.firstChild),ge.value=oi.text.join(` `);var Re=document.activeElement;Z(ge),setTimeout(function(){n.display.lineSpace.removeChild(he),Re.focus(),Re==a&&r.showPrimarySelection()},50)}Oe(a,"copy",j),Oe(a,"cut",j)},Nn.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Nn.prototype.prepareSelection=function(){var e=Do(this.cm,!1);return e.focus=document.activeElement==this.div,e},Nn.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},Nn.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Nn.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:V[0].measure.map[2],offset:0},ee=a.linee.firstLine()&&(n=Ke(n.line-1,Ve(e.doc,n.line-1).length)),a.ch==Ve(e.doc,a.line).text.length&&a.linet.viewTo-1)return!1;var R,j,V;n.line==t.viewFrom||(R=Oi(e,n.line))==0?(j=qt(t.view[0].line),V=t.view[0].node):(j=qt(t.view[R].line),V=t.view[R-1].node.nextSibling);var J=Oi(e,a.line),ee,he;if(J==t.view.length-1?(ee=t.viewTo-1,he=t.lineDiv.lastChild):(ee=qt(t.view[J+1].line)-1,he=t.view[J+1].node.previousSibling),!V)return!1;for(var ge=e.doc.splitLines(tu(e,V,he,j,ee)),Re=ln(e.doc,Ke(j,0),Ke(ee,Ve(e.doc,ee).text.length));ge.length>1&&Re.length>1;)if(xe(ge)==xe(Re))ge.pop(),Re.pop(),ee--;else if(ge[0]==Re[0])ge.shift(),Re.shift(),j++;else break;for(var Se=0,He=0,et=ge[0],pt=Re[0],At=Math.min(et.length,pt.length);Sen.ch&&Ut.charCodeAt(Ut.length-He-1)==Rt.charCodeAt(Rt.length-He-1);)Se--,He++;ge[ge.length-1]=Ut.slice(0,Ut.length-He).replace(/^\u200b+/,""),ge[0]=ge[0].slice(Se).replace(/\u200b+$/,"");var tn=Ke(j,Se),$t=Ke(ee,Re.length?xe(Re).length-He:0);if(ge.length>1||ge[0]||wt(tn,$t))return Xi(e.doc,ge,tn,$t,"+input"),!0},Nn.prototype.ensurePolled=function(){this.forceCompositionEnd()},Nn.prototype.reset=function(){this.forceCompositionEnd()},Nn.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},Nn.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)},Nn.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&zr(this.cm,function(){return Fr(e.cm)})},Nn.prototype.setUneditable=function(e){e.contentEditable="false"},Nn.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||Cr(this.cm,To)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},Nn.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},Nn.prototype.onContextMenu=function(){},Nn.prototype.resetPosition=function(){},Nn.prototype.needsContentAttribute=!0;function zs(e,t){var r=Et(e,t.line);if(!r||r.hidden)return null;var n=Ve(e.doc,t.line),a=st(r,n,t.line),R=gt(n,e.doc.direction),j="left";if(R){var V=lt(R,t.ch);j=V%2?"right":"left"}var J=dn(a.map,t.ch,j);return J.offset=J.collapse=="right"?J.end:J.start,J}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function Zi(e,t){return t&&(e.bad=!0),e}function tu(e,t,r,n,a){var R="",j=!1,V=e.doc.lineSeparator(),J=!1;function ee(Se){return function(He){return He.id==Se}}function he(){j&&(R+=V,J&&(R+=V),j=J=!1)}function ge(Se){Se&&(he(),R+=Se)}function Re(Se){if(Se.nodeType==1){var He=Se.getAttribute("cm-text");if(He){ge(He);return}var et=Se.getAttribute("cm-marker"),pt;if(et){var At=e.findMarks(Ke(n,0),Ke(a+1,0),ee(+et));At.length&&(pt=At[0].find(0))&&ge(ln(e.doc,pt.from,pt.to).join(V));return}if(Se.getAttribute("contenteditable")=="false")return;var Ut=/^(pre|div|p|li|table|br)$/i.test(Se.nodeName);if(!/^br$/i.test(Se.nodeName)&&Se.textContent.length==0)return;Ut&&he();for(var Rt=0;Rt=9&&t.hasSelection&&(t.hasSelection=null),r.poll()}),Oe(a,"paste",function(j){if(Ze(n,j)||Fs(j,n))return;n.state.pasteIncoming=+new Date,r.fastPoll()});function R(j){if(Ze(n,j))return;if(n.somethingSelected())Xa({lineWise:!1,text:n.getSelections()});else if(n.options.lineWiseCopyCut){var V=Ws(n);Xa({lineWise:!0,text:V.text}),j.type=="cut"?n.setSelections(V.ranges,null,_e):(r.prevInput="",a.value=V.text.join(` `),Z(a))}else return;j.type=="cut"&&(n.state.cutIncoming=+new Date)}Oe(a,"cut",R),Oe(a,"copy",R),Oe(e.scroller,"paste",function(j){if(ri(e,j)||Ze(n,j))return;if(!a.dispatchEvent){n.state.pasteIncoming=+new Date,r.focus();return}var V=new Event("paste");V.clipboardData=j.clipboardData,a.dispatchEvent(V)}),Oe(e.lineSpace,"selectstart",function(j){ri(e,j)||ne(j)}),Oe(a,"compositionstart",function(){var j=n.getCursor("from");r.composing&&r.composing.range.clear(),r.composing={start:j,range:n.markText(j,n.getCursor("to"),{className:"CodeMirror-composing"})}}),Oe(a,"compositionend",function(){r.composing&&(r.poll(),r.composing.range.clear(),r.composing=null)})},rr.prototype.createField=function(e){this.wrapper=Ks(),this.textarea=this.wrapper.firstChild},rr.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},rr.prototype.prepareSelection=function(){var e=this.cm,t=e.display,r=e.doc,n=Do(e);if(e.options.moveInputWithCursor){var a=rn(e,r.sel.primary().head,"div"),R=t.wrapper.getBoundingClientRect(),j=t.lineDiv.getBoundingClientRect();n.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,a.top+j.top-R.top)),n.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,a.left+j.left-R.left))}return n},rr.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")},rr.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&&Z(this.textarea),K&&I>=9&&(this.hasSelection=r)}else e||(this.prevInput=this.textarea.value="",K&&I>=9&&(this.hasSelection=null))},rr.prototype.getField=function(){return this.textarea},rr.prototype.supportsTouch=function(){return!1},rr.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!l||k()!=this.textarea))try{this.textarea.focus()}catch(e){}},rr.prototype.blur=function(){this.textarea.blur()},rr.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},rr.prototype.receivedFocus=function(){this.slowPoll()},rr.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()})},rr.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)},rr.prototype.poll=function(){var e=this,t=this.cm,r=this.textarea,n=this.prevInput;if(this.contextMenuPending||!t.state.focused||ft(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(K&&I>=9&&this.hasSelection===a||i&&/[\uf700-\uf7ff]/.test(a))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var R=a.charCodeAt(0);if(R==8203&&!n&&(n="\u200B"),R==8666)return this.reset(),this.cm.execCommand("undo")}for(var j=0,V=Math.min(n.length,a.length);j1e3||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},rr.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},rr.prototype.onKeyPress=function(){K&&I>=9&&(this.hasSelection=null),this.fastPoll()},rr.prototype.onContextMenu=function(e){var t=this,r=t.cm,n=r.display,a=t.textarea;t.contextMenuPending&&t.contextMenuPending();var R=Di(r,e),j=n.scroller.scrollTop;if(!R||A)return;var V=r.options.resetSelectionOnContextMenu;V&&r.doc.sel.contains(R)==-1&&Cr(r,Dr)(r.doc,bi(R),_e);var J=a.style.cssText,ee=t.wrapper.style.cssText,he=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",a.style.cssText=`position: absolute; width: 30px; height: 30px; top: `+(e.clientY-he.top-5)+"px; left: "+(e.clientX-he.left-5)+`px; z-index: 1000; background: `+(K?"rgba(255, 255, 255, .05)":"transparent")+`; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var ge;O&&(ge=window.scrollY),n.input.focus(),O&&window.scrollTo(null,ge),n.input.reset(),r.somethingSelected()||(a.value=t.prevInput=" "),t.contextMenuPending=Se,n.selForContextMenu=r.doc.sel,clearTimeout(n.detectingSelectAll);function Re(){if(a.selectionStart!=null){var et=r.somethingSelected(),pt="\u200B"+(et?a.value:"");a.value="\u21DA",a.value=pt,t.prevInput=et?"":"\u200B",a.selectionStart=1,a.selectionEnd=pt.length,n.selForContextMenu=r.doc.sel}}function Se(){if(t.contextMenuPending!=Se)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=ee,a.style.cssText=J,K&&I<9&&n.scrollbars.setScrollTop(n.scroller.scrollTop=j),a.selectionStart!=null){(!K||K&&I<9)&&Re();var et=0,pt=function(){n.selForContextMenu==r.doc.sel&&a.selectionStart==0&&a.selectionEnd>0&&t.prevInput=="\u200B"?Cr(r,us)(r):et++<10?n.detectingSelectAll=setTimeout(pt,500):(n.selForContextMenu=null,n.input.reset())};n.detectingSelectAll=setTimeout(pt,200)}}if(K&&I>=9&&Re(),u){ce(e);var He=function(){St(window,"mouseup",He),setTimeout(Se,20)};Oe(window,"mouseup",He)}else setTimeout(Se,50)},rr.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},rr.prototype.setUneditable=function(){},rr.prototype.needsContentAttribute=!1;function ru(e,t){if(t=t?B(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=k();t.autofocus=r==e||e.getAttribute("autofocus")!=null&&r==document.body}function n(){e.value=V.getValue()}var a;if(e.form&&(Oe(e.form,"submit",n),!t.leaveSubmitMethodAlone)){var R=e.form;a=R.submit;try{var j=R.submit=function(){n(),R.submit=a,R.submit(),R.submit=j}}catch(J){}}t.finishInit=function(J){J.save=n,J.getTextArea=function(){return e},J.toTextArea=function(){J.toTextArea=isNaN,n(),e.parentNode.removeChild(J.getWrapperElement()),e.style.display="",e.form&&(St(e.form,"submit",n),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=a))}},e.style.display="none";var V=Yn(function(J){return e.parentNode.insertBefore(J,e.nextSibling)},t);return V}function iu(e){e.off=St,e.on=Oe,e.wheelEventPixels=cl,e.Doc=jr,e.splitLines=ot,e.countColumn=te,e.findColumn=ve,e.isWordChar=Pe,e.Pass=Ce,e.signal=Ue,e.Line=ui,e.changeEnd=Ei,e.scrollbarModel=Fo,e.Pos=Ke,e.cmpPos=wt,e.modes=sn,e.mimeModes=Bt,e.resolveMode=it,e.getMode=Ft,e.modeExtensions=xt,e.extendMode=kt,e.copyState=Mt,e.startState=Lt,e.innerMode=It,e.commands=xa,e.keyMap=ci,e.keyName=Ts,e.isModifierKey=Cs,e.lookupKey=$i,e.normalizeKeyMap=kl,e.StringStream=at,e.SharedTextMarker=ya,e.TextMarker=_i,e.LineWidget=va,e.e_preventDefault=ne,e.e_stopPropagation=re,e.e_stop=ce,e.addClass=H,e.contains=_,e.rmClass=d,e.keyNames=Ci}$l(Yn),ql(Yn);var au="iter insert remove copy getEditor constructor".split(" ");for(var $a in jr.prototype)jr.prototype.hasOwnProperty($a)&&pe(au,$a)<0&&(Yn.prototype[$a]=function(e){return function(){return e.apply(this.doc,arguments)}}(jr.prototype[$a]));return be(jr),Yn.inputStyles={textarea:rr,contenteditable:Nn},Yn.defineMode=function(e){!Yn.defaults.mode&&e!="null"&&(Yn.defaults.mode=e),an.apply(this,arguments)},Yn.defineMIME=Qt,Yn.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Yn.defineMIME("text/plain","null"),Yn.defineExtension=function(e,t){Yn.prototype[e]=t},Yn.defineDocExtension=function(e,t){jr.prototype[e]=t},Yn.fromTextArea=ru,iu(Yn),Yn.version="5.58.2",Yn})},WaYH:function(rt,Xe,X){"use strict";var oe=X("rePB"),$=X("Ff2n"),D=X("VTBJ"),Y=X("1OyB"),U=X("vuIU"),N=X("JX7q"),K=X("Ji7U"),I=X("LK+K"),O=X("q1tI"),L=X("TSYQ"),T=X.n(L),A=X("sboe"),P=X("OZM5"),w=function(u){var E=u.prefixCls,d=u.level,f=u.isStart,s=u.isEnd;if(!d)return null;for(var o="".concat(E,"-indent-unit"),b=[],g=0;g1&&arguments[1]!==void 0?arguments[1]:!1,se=_e.getAttribute("id")||_e.getAttribute("data-reactid")||_e.getAttribute("name");if(le&&k[se])return k[se];var ve=window.getComputedStyle(_e),ie=ve.getPropertyValue("box-sizing")||ve.getPropertyValue("-moz-box-sizing")||ve.getPropertyValue("-webkit-box-sizing"),q=parseFloat(ve.getPropertyValue("padding-bottom"))+parseFloat(ve.getPropertyValue("padding-top")),xe=parseFloat(ve.getPropertyValue("border-bottom-width"))+parseFloat(ve.getPropertyValue("border-top-width")),Ie=_.map(function(De){return"".concat(De,":").concat(ve.getPropertyValue(De))}).join(";"),Ne={sizingStyle:Ie,paddingSize:q,borderSize:xe,boxSizing:ie};return le&&se&&(k[se]=Ne),Ne}function Z(_e){var le=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,se=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,ve=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;H||(H=document.createElement("textarea"),H.setAttribute("tab-index","-1"),H.setAttribute("aria-hidden","true"),document.body.appendChild(H)),_e.getAttribute("wrap")?H.setAttribute("wrap",_e.getAttribute("wrap")):H.removeAttribute("wrap");var ie=z(_e,le),q=ie.paddingSize,xe=ie.borderSize,Ie=ie.boxSizing,Ne=ie.sizingStyle;H.setAttribute("style","".concat(Ne,";").concat(g)),H.value=_e.value||_e.placeholder||"";var De=Number.MIN_SAFE_INTEGER,Be=Number.MAX_SAFE_INTEGER,Ae=H.scrollHeight,Pe;if(Ie==="border-box"?Ae+=xe:Ie==="content-box"&&(Ae-=q),se!==null||ve!==null){H.value=" ";var We=H.scrollHeight-q;se!==null&&(De=We*se,Ie==="border-box"&&(De=De+q+xe),Ae=Math.max(De,Ae)),ve!==null&&(Be=We*ve,Ie==="border-box"&&(Be=Be+q+xe),Pe=Ae>Be?"":"hidden",Ae=Math.min(Be,Ae))}return{height:Ae,minHeight:De,maxHeight:Be,overflowY:Pe,resize:"none"}}var G=X("Gytx"),B=X.n(G),te;(function(_e){_e[_e.NONE=0]="NONE",_e[_e.RESIZING=1]="RESIZING",_e[_e.RESIZED=2]="RESIZED"})(te||(te={}));var de=function(_e){Object(Y.a)(se,_e);var le=Object(U.a)(se);function se(ve){var ie;return Object($.a)(this,se),ie=le.call(this,ve),ie.nextFrameActionId=void 0,ie.resizeFrameId=void 0,ie.textArea=void 0,ie.saveTextArea=function(q){ie.textArea=q},ie.handleResize=function(q){var xe=ie.state.resizeStatus,Ie=ie.props,Ne=Ie.autoSize,De=Ie.onResize;if(xe!==te.NONE)return;typeof De=="function"&&De(q),Ne&&ie.resizeOnNextFrame()},ie.resizeOnNextFrame=function(){cancelAnimationFrame(ie.nextFrameActionId),ie.nextFrameActionId=requestAnimationFrame(ie.resizeTextarea)},ie.resizeTextarea=function(){var q=ie.props.autoSize;if(!q||!ie.textArea)return;var xe=q.minRows,Ie=q.maxRows,Ne=Z(ie.textArea,!1,xe,Ie);ie.setState({textareaStyles:Ne,resizeStatus:te.RESIZING},function(){cancelAnimationFrame(ie.resizeFrameId),ie.resizeFrameId=requestAnimationFrame(function(){ie.setState({resizeStatus:te.RESIZED},function(){ie.resizeFrameId=requestAnimationFrame(function(){ie.setState({resizeStatus:te.NONE}),ie.fixFirefoxAutoScroll()})})})})},ie.renderTextArea=function(){var q=ie.props,xe=q.prefixCls,Ie=xe===void 0?"rc-textarea":xe,Ne=q.autoSize,De=q.onResize,Be=q.className,Ae=q.disabled,Pe=ie.state,We=Pe.textareaStyles,ze=Pe.resizeStatus,qe=Object(s.a)(ie.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Ge=b()(Ie,Be,Object(I.a)({},"".concat(Ie,"-disabled"),Ae));"value"in qe&&(qe.value=qe.value||"");var ke=Object(K.a)(Object(K.a)(Object(K.a)({},ie.props.style),We),ze===te.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return N.createElement(f,{onResize:ie.handleResize,disabled:!(Ne||De)},N.createElement("textarea",Object(oe.a)({},qe,{className:Ge,style:ke,ref:ie.saveTextArea})))},ie.state={textareaStyles:{},resizeStatus:te.NONE},ie}return Object(D.a)(se,[{key:"componentDidUpdate",value:function(ie){(ie.value!==this.props.value||!B()(ie.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 ie=this.textArea.selectionStart,q=this.textArea.selectionEnd;this.textArea.setSelectionRange(ie,q)}}catch(xe){}}},{key:"render",value:function(){return this.renderTextArea()}}]),se}(N.Component),pe=de,ye=function(_e){Object(Y.a)(se,_e);var le=Object(U.a)(se);function se(ve){var ie;Object($.a)(this,se),ie=le.call(this,ve),ie.resizableTextArea=void 0,ie.focus=function(){ie.resizableTextArea.textArea.focus()},ie.saveTextArea=function(xe){ie.resizableTextArea=xe},ie.handleChange=function(xe){var Ie=ie.props.onChange;ie.setValue(xe.target.value,function(){ie.resizableTextArea.resizeTextarea()}),Ie&&Ie(xe)},ie.handleKeyDown=function(xe){var Ie=ie.props,Ne=Ie.onPressEnter,De=Ie.onKeyDown;xe.keyCode===13&&Ne&&Ne(xe),De&&De(xe)};var q=typeof ve.value=="undefined"||ve.value===null?ve.defaultValue:ve.value;return ie.state={value:q},ie}return Object(D.a)(se,[{key:"setValue",value:function(ie,q){"value"in this.props||this.setState({value:ie},q)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return N.createElement(pe,Object(oe.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(ie){return"value"in ie?{value:ie.value}:null}}]),se}(N.Component),Ce=Xe.default=ye},YBdh:function(rt,Xe,X){rt.exports=X.p+"static/xiren.a6554bc1.svg"},ZWs3:function(rt,Xe,X){"use strict";X.d(Xe,"a",function(){return T});var oe=X("+L6B"),$=X("2/Rp"),D=X("0Owb"),Y=X("9og8"),U=X("tJVT"),N=X("PpiC"),K=X("WmNS"),I=X.n(K),O=X("q1tI"),L=X.n(O),T=function(P){var w=P.children,S=Object(N.a)(P,["children"]),x=Object(O.useState)(!1),h=Object(U.a)(x,2),l=h[0],i=h[1];return L.a.createElement($.a,Object(D.a)({},S,{loading:l,onClick:function(){var c=Object(Y.a)(I.a.mark(function C(v){return I.a.wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.prev=0,i(!0),u.next=4,S.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()}},C,null,[[0,7]])}));return function(C){return c.apply(this,arguments)}}()}),w)}},ZpRC:function(rt,Xe,X){"use strict";function oe(T){return typeof T=="object"&&T!=null&&T.nodeType===1}function $(T,A){return(!A||T!=="hidden")&&T!=="visible"&&T!=="clip"}function D(T,A){if(T.clientHeightA||x>T&&h=A&&l>=P?x-T-w:h>A&&lP?h-A+S:0}var U=function(T,A){var P=window,w=A.scrollMode,S=A.block,x=A.inline,h=A.boundary,l=A.skipOverflowHiddenElements,i=typeof h=="function"?h:function(We){return We!==h};if(!oe(T))throw new TypeError("Invalid target");for(var c=document.scrollingElement||document.documentElement,C=[],v=T;oe(v)&&i(v);){if((v=v.parentElement)===c){C.push(v);break}v!=null&&v===document.body&&D(v)&&!D(document.documentElement)||v!=null&&D(v,l)&&C.push(v)}for(var m=P.visualViewport?P.visualViewport.width:innerWidth,u=P.visualViewport?P.visualViewport.height:innerHeight,E=window.scrollX||pageXOffset,d=window.scrollY||pageYOffset,f=T.getBoundingClientRect(),s=f.height,o=f.width,b=f.top,g=f.right,_=f.bottom,k=f.left,H=S==="start"||S==="nearest"?b:S==="end"?_:b+s/2,z=x==="center"?k+o/2:x==="end"?g:k,Z=[],G=0;G=0&&k>=0&&_<=u&&g<=m&&b>=ye&&_<=_e&&k>=le&&g<=Ce)return Z;var se=getComputedStyle(B),ve=parseInt(se.borderLeftWidth,10),ie=parseInt(se.borderTopWidth,10),q=parseInt(se.borderRightWidth,10),xe=parseInt(se.borderBottomWidth,10),Ie=0,Ne=0,De="offsetWidth"in B?B.offsetWidth-B.clientWidth-ve-q:0,Be="offsetHeight"in B?B.offsetHeight-B.clientHeight-ie-xe:0;if(c===B)Ie=S==="start"?H:S==="end"?H-u:S==="nearest"?Y(d,d+u,u,ie,xe,d+H,d+H+s,s):H-u/2,Ne=x==="start"?z:x==="center"?z-m/2:x==="end"?z-m:Y(E,E+m,m,ve,q,E+z,E+z+o,o),Ie=Math.max(0,Ie+d),Ne=Math.max(0,Ne+E);else{Ie=S==="start"?H-ye-ie:S==="end"?H-_e+xe+Be:S==="nearest"?Y(ye,_e,de,ie,xe+Be,H,H+s,s):H-(ye+de/2)+Be/2,Ne=x==="start"?z-le-ve:x==="center"?z-(le+pe/2)+De/2:x==="end"?z-Ce+q+De:Y(le,Ce,pe,ve,q+De,z,z+o,o);var Ae=B.scrollLeft,Pe=B.scrollTop;H+=Pe-(Ie=Math.max(0,Math.min(Pe+Ie,B.scrollHeight-de+Be))),z+=Ae-(Ne=Math.max(0,Math.min(Ae+Ne,B.scrollWidth-pe+De)))}Z.push({el:B,top:Ie,left:Ne})}return Z};function N(T){return T===Object(T)&&Object.keys(T).length!==0}function K(T,A){A===void 0&&(A="auto");var P="scrollBehavior"in document.body.style;T.forEach(function(w){var S=w.el,x=w.top,h=w.left;S.scroll&&P?S.scroll({top:x,left:h,behavior:A}):(S.scrollTop=x,S.scrollLeft=h)})}function I(T){return T===!1?{block:"end",inline:"nearest"}:N(T)?T:{block:"start",inline:"nearest"}}function O(T,A){var P=!T.ownerDocument.documentElement.contains(T);if(N(A)&&typeof A.behavior=="function")return A.behavior(P?[]:U(T,A));if(P)return;var w=I(A);return K(U(T,w),w.behavior)}var L=Xe.a=O},bT9E:function(rt,Xe,X){"use strict";X.d(Xe,"a",function(){return $});var oe=X("VTBJ");function $(D,Y){var U=Object(oe.a)({},D);return Array.isArray(Y)&&Y.forEach(function(N){delete U[N]}),U}},c5Ni:function(rt,Xe,X){},dejd:function(rt,Xe,X){},dmUQ:function(rt,Xe,X){"use strict";var oe=X("Ff2n"),$=X("rePB"),D=X("1OyB"),Y=X("vuIU"),U=X("Ji7U"),N=X("md7G"),K=X("foSv"),I=X("q1tI"),O=X.n(I),L=X("TSYQ"),T=X.n(L),A=X("4IlW");function P(s,o){var b=Object.keys(s);if(Object.getOwnPropertySymbols){var g=Object.getOwnPropertySymbols(s);o&&(g=g.filter(function(_){return Object.getOwnPropertyDescriptor(s,_).enumerable})),b.push.apply(b,g)}return b}function w(s){for(var o=1;o1?pe-1:0),Ce=1;Ce1?G-1:0),te=1;te=0)return parseInt(Z.slice(Z.indexOf("e-")+2),10);var G=0;return Z.indexOf(".")>=0&&(G=Z.length-Z.indexOf(".")-1),G},_.getInputDisplayValue=function(z){var Z=z||_.state,G=Z.focused,B=Z.inputValue,te=Z.value,de;G?de=B:de=_.toPrecisionAsStep(te),de==null&&(de="");var pe=_.formatWrapper(de);return m(_.props.decimalSeparator)&&(pe=pe.toString().replace(".",_.props.decimalSeparator)),pe},_.recordCursorPosition=function(){try{_.cursorStart=_.input.selectionStart,_.cursorEnd=_.input.selectionEnd,_.currentValue=_.input.value,_.cursorBefore=_.input.value.substring(0,_.cursorStart),_.cursorAfter=_.input.value.substring(_.cursorEnd)}catch(z){}},_.restoreByAfter=function(z){if(z===void 0)return!1;var Z=_.input.value,G=Z.lastIndexOf(z);if(G===-1)return!1;var B=_.cursorBefore.length;return _.lastKeyCode===A.a.DELETE&&_.cursorBefore.charAt(B-1)===z[0]?(_.fixCaret(B,B),!0):G+z.length===Z.length?(_.fixCaret(G,G),!0):!1},_.partRestoreByAfter=function(z){return z===void 0?!1:Array.prototype.some.call(z,function(Z,G){var B=z.substring(G);return _.restoreByAfter(B)})},_.isNotCompleteNumber=function(z){return isNaN(z)||z===""||z===null||z&&z.toString().indexOf(".")===z.toString().length-1},_.stop=function(){_.autoStepTimer&&clearTimeout(_.autoStepTimer)},_.down=function(z,Z,G){_.pressingUpOrDown=!0,_.step("down",z,Z,G)},_.up=function(z,Z,G){_.pressingUpOrDown=!0,_.step("up",z,Z,G)},_.saveInput=function(z){_.input=z};var k=g.value;k===void 0&&(k=g.defaultValue),_.state={focused:g.autoFocus};var H=_.getValidValue(_.toNumber(k));return _.state=w(w({},_.state),{},{inputValue:_.toPrecisionAsStep(H),value:H}),_}return Object(Y.a)(b,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(_){var k=this.props,H=k.value,z=k.onChange,Z=k.max,G=k.min,B=this.state.focused;if(_){if(!u(_.value,H)||!u(_.max,Z)||!u(_.min,G)){var te=B?H:this.getValidValue(H),de;this.pressingUpOrDown?de=te:this.inputting?de=this.rawInput:de=this.toPrecisionAsStep(te),this.setState({value:te,inputValue:de})}var pe="value"in this.props?H:this.state.value;"max"in this.props&&_.max!==Z&&typeof pe=="number"&&pe>Z&&z&&z(Z),"min"in this.props&&_.min!==G&&typeof pe=="number"&&pe1&&arguments[1]!==void 0?arguments[1]:this.props.min,H=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,z=parseFloat(_);return isNaN(z)?_:(zH&&(z=H),z)}},{key:"setValue",value:function(_,k){var H=this.props.precision,z=this.isNotCompleteNumber(parseFloat(_))?null:parseFloat(_),Z=this.state.value,G=Z===void 0?null:Z,B=this.state.inputValue,te=B===void 0?null:B,de=typeof z=="number"?z.toFixed(H):"".concat(z),pe=z!==G||de!=="".concat(te);return"value"in this.props?(te=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:te},k)):this.setState({value:z,inputValue:this.toPrecisionAsStep(_)},k),pe&&this.props.onChange(z),z}},{key:"getMaxPrecision",value:function(_){var k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,H=this.props,z=H.precision,Z=H.step;if(m(z))return z;var G=this.getPrecision(k),B=this.getPrecision(Z),te=this.getPrecision(_);return _?Math.max(te,G+B):G+B}},{key:"getPrecisionFactor",value:function(_){var k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,H=this.getMaxPrecision(_,k);return Math.pow(10,H)}},{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(_){return this.props.formatter?this.props.formatter(_):_}},{key:"toPrecisionAsStep",value:function(_){if(this.isNotCompleteNumber(_)||_==="")return _;var k=Math.abs(this.getMaxPrecision(_));return isNaN(k)?_.toString():Number(_).toFixed(k)}},{key:"toNumber",value:function(_){var k=this.props.precision,H=this.state.focused,z=_&&_.length>16&&H;return this.isNotCompleteNumber(_)||z?_:m(k)?Math.round(_*Math.pow(10,k))/Math.pow(10,k):Number(_)}},{key:"upStep",value:function(_,k){var H=this.props.step,z=this.getPrecisionFactor(_,k),Z=Math.abs(this.getMaxPrecision(_,k)),G=((z*_+z*H*k)/z).toFixed(Z);return this.toNumber(G)}},{key:"downStep",value:function(_,k){var H=this.props.step,z=this.getPrecisionFactor(_,k),Z=Math.abs(this.getMaxPrecision(_,k)),G=((z*_-z*H*k)/z).toFixed(Z);return this.toNumber(G)}},{key:"step",value:function(_,k){var H=this,z=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,Z=arguments.length>3?arguments[3]:void 0;this.stop(),k&&(k.persist(),k.preventDefault());var G=this.props;if(G.disabled)return;var B=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(B))return;var te=this["".concat(_,"Step")](B,z),de=te>G.max||teG.max?te=G.max:te=ye),Ze=(Tt||Tt===0)&&(isNaN(Tt)||Number(Tt)<=Ce),Ee=Ue||z||Z,fe=Ze||z||Z,be=T()("".concat(H,"-handler"),"".concat(H,"-handler-up"),Object($.a)({},"".concat(H,"-handler-up-disabled"),Ee)),ne=T()("".concat(H,"-handler"),"".concat(H,"-handler-down"),Object($.a)({},"".concat(H,"-handler-down-disabled"),fe)),re=G?{onTouchStart:Ee?h:this.up,onTouchEnd:this.stop}:{onMouseDown:Ee?h:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},ae=G?{onTouchStart:fe?h:this.down,onTouchEnd:this.stop}:{onMouseDown:fe?h:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return O.a.createElement("div",{className:yt,style:_e,title:le,onMouseEnter:se,onMouseLeave:ve,onMouseOver:ie,onMouseOut:q,onFocus:function(){return null},onBlur:function(){return null}},O.a.createElement("div",{className:"".concat(H,"-handler-wrap")},O.a.createElement("span",Object.assign({unselectable:"on"},re,{role:"button","aria-label":"Increase Value","aria-disabled":Ee,className:be}),te||O.a.createElement("span",{unselectable:"on",className:"".concat(H,"-handler-up-inner"),onClick:l})),O.a.createElement("span",Object.assign({unselectable:"on"},ae,{role:"button","aria-label":"Decrease Value","aria-disabled":fe,className:ne}),de||O.a.createElement("span",{unselectable:"on",className:"".concat(H,"-handler-down-inner"),onClick:l}))),O.a.createElement("div",{className:"".concat(H,"-input-wrap")},O.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":Ce,"aria-valuemax":ye,"aria-valuenow":Tt,required:xe,type:De,placeholder:Be,onPaste:ct,onClick:Ie,onMouseUp:this.onMouseUp,className:"".concat(H,"-input"),tabIndex:Ne,autoComplete:B,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:Pt?this.onKeyDown:h,onKeyUp:Pt?this.onKeyUp:h,autoFocus:Ge,maxLength:qe,readOnly:Z,disabled:z,max:ye,min:Ce,step:ze,name:ke,title:le,id:Ae,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(St),pattern:We,inputMode:Pe,onInput:ut},Oe))))}}]),b}(O.a.Component);E.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:v,min:-v,step:1,style:{},onChange:h,onKeyDown:h,onPressEnter:h,onFocus:h,onBlur:h,parser:i,required:!1,autoComplete:"off"};var d=E,f=Xe.a=d},"e+RI":function(rt,Xe,X){rt.exports={btn:"btn___35XHi",s1:"s1___yzdGB",s2:"s2___3kxXm",btnDisabled:"btnDisabled___lI9pA",btn2:"btn2___2KLJQ"}},"eS0+":function(rt,Xe,X){"use strict";var oe=X("giR+"),$=X("fyUT"),D=X("tJVT"),Y=X("PpiC"),U=X("OaEy"),N=X("2fM7"),K=X("q1tI"),I=X.n(K),O=X("2sxD"),L=X.n(O),T=X("51dB"),A=X.n(T),P=X("5MlY"),w=X.n(P),S=X("lnNo"),x=X.n(S),h=X("YBdh"),l=X.n(h),i=X("LvDl"),c=X.n(i),C=X("TSYQ"),v=X.n(C),m=N.a.Option,u=function(s){var o=parseInt(s);return Object(i.isNaN)(o)?0:o},E=function(s){var o,b,g=s.index,_=s.value,k=_===void 0?[]:_,H=s.onChange,z=s.type,Z=s.disabled,G=Z===void 0?!1:Z,B=s.expansion,te=B===void 0?!0:B,de=Object(Y.a)(s,["index","value","onChange","type","disabled","expansion"]),pe=Object(K.useState)(!0),ye=Object(D.a)(pe,2),Ce=ye[0],_e=ye[1],le=function(ve,ie){var q=Object(i.cloneDeep)(k);q.difficulties[ie].num=ve,console.log(q,444),H(q)};return I.a.createElement("div",{className:L.a.ListGroup,style:{borderWidth:g?1:0}},I.a.createElement("div",{className:L.a.a},g+1),I.a.createElement("div",{"data-type":"width",className:L.a.b},k==null?void 0:k.name),I.a.createElement("div",{className:L.a.c},k==null||((o=k.difficulties)===null||o===void 0)?void 0:o.map(function(se,ve){return I.a.createElement("div",{key:ve,style:{display:Ce?"flex":ve?"none":"flex"},className:L.a.c1},I.a.createElement("span",{style:{color:"#777777",marginRight:5}},"\u96BE\u5EA6"),se.difficulty===1&&I.a.createElement("span",{className:L.a.radio},"\u7B80\u5355"),se.difficulty===2&&I.a.createElement("span",{className:L.a.radio},"\u9002\u4E2D"),se.difficulty===3&&I.a.createElement("span",{className:L.a.radio},"\u56F0\u96BE"),I.a.createElement("span",{style:{color:"#777777",marginRight:5,marginLeft:50}},"\u62BD\u9898\u6570\u91CF"),g===0&&ve===0?I.a.createElement("div",{id:"".concat(z,"_sum")},I.a.createElement($.a,{disabled:G,parser:u,onChange:function(q){return le(q,ve)},min:0,max:se==null?void 0:se.count,value:(se==null?void 0:se.num)||0,style:{width:66}}),I.a.createElement("span",{style:{display:"none"}},"\u8BF7\u8F93\u5165\u6570\u91CF")):I.a.createElement($.a,{disabled:G,parser:u,onChange:function(q){return le(q,ve)},min:0,max:se==null?void 0:se.count,value:(se==null?void 0:se.num)||0,style:{width:66}}),I.a.createElement("span",{style:{marginLeft:5}},"/",se==null?void 0:se.count))})),I.a.createElement("div",{style:{display:(k==null||((b=k.difficulties)===null||b===void 0)?void 0:b.length)===1||!te?"none":"block"},onClick:function(){return _e(!Ce)},className:L.a.d},Ce?"\u6536\u8D77":"\u5C55\u5F00",I.a.createElement("img",{style:{marginTop:-2,transform:Ce?"rotate(0deg)":"rotate(180deg)"},src:x.a,className:"ml5"})))},d=function(s){var o,b,g=s.value,_=g===void 0?[]:g,k=s.onChange,H=s.listClassName,z=s.disabled,Z=z===void 0?!1:z,G=s.expansion,B=G===void 0?!0:G,te=Object(Y.a)(s,["value","onChange","listClassName","disabled","expansion"]),de=Object(K.useState)(!0),pe=Object(D.a)(de,2),ye=pe[0],Ce=pe[1],_e=function(q){var xe,Ie=q.score||0,Ne=[];q==null||((xe=q.item_banks)===null||xe===void 0)||xe.forEach(function(Be){var Ae;Be==null||((Ae=Be.tag_disciplines)===null||Ae===void 0)||Ae.forEach(function(Pe){var We;Pe==null||((We=Pe.difficulties)===null||We===void 0)||We.forEach(function(ze){ze.num&&Ne.push(ze.num)})})});var De=Ne.reduce(function(Be,Ae){return Be+Ae},0);return De*Ie},le=[{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"}],se=function(q,xe,Ie){var Ne=Object(i.cloneDeep)(_);Ne.item_banks[xe].tag_disciplines[Ie]=q;var De=_e(Ne);Ne.scoreTotal=De,console.log(Ne,"newValue"),k(Ne)},ve=function(q){var xe=Object(i.cloneDeep)(_);xe.score=q;var Ie=_e(xe);xe.scoreTotal=Ie,k(xe)};return I.a.createElement("div",{className:v()(L.a.list,H)},I.a.createElement("div",{className:L.a.head},I.a.createElement("div",{className:L.a.name},I.a.createElement("b",null),I.a.createElement("span",null,(o=le.find(function(ie){return ie.type===(_==null?void 0:_.item_type)}))===null||o===void 0?void 0:o.name)),I.a.createElement("div",{className:L.a.right},B&&I.a.createElement("div",{onClick:function(){return Ce(!ye)},className:"current c-light-primary mb10"},ye?"\u6536\u8D77":"\u5C55\u5F00",I.a.createElement("img",{style:{marginTop:-2,transform:ye?"rotate(0deg)":"rotate(180deg)"},src:x.a,className:"ml5"})),I.a.createElement("div",null,I.a.createElement("img",{src:A.a}),I.a.createElement("span",{className:"ml10 mr20"},"\u603B\u5206",_.scoreTotal,"\u5206"),I.a.createElement("img",{className:"mr10",src:w.a}),I.a.createElement("span",null,(_==null?void 0:_.item_type)==="COMBINATION"?"\u6BCF\u5C0F\u9898":"\u6BCF\u9898"),I.a.createElement("div",{id:"".concat(_==null?void 0:_.item_type,"_score")},I.a.createElement($.a,{disabled:Z,parser:u,min:0,onChange:ve,value:_.score,style:{margin:"0 5px"}}),I.a.createElement("span",{style:{display:"none"}},"\u8BF7\u8F93\u5165\u6BCF\u9898\u5206\u6570")),I.a.createElement("span",null,"\u5206")))),I.a.createElement("div",{className:L.a.body,style:{display:ye?"block":"none"}},_==null||((b=_.item_banks)===null||b===void 0)?void 0:b.map(function(ie,q){var xe;return I.a.createElement(I.a.Fragment,{key:q},I.a.createElement("div",{className:L.a.top},I.a.createElement("img",{src:l.a}),I.a.createElement("span",null,"\u65B9\u5411/\u8BFE\u7A0B"),I.a.createElement("b",null),I.a.createElement("aside",null,ie==null?void 0:ie.disciplines,"/",ie==null?void 0:ie.sub_discipline)),I.a.createElement("div",{className:L.a.bottom},I.a.createElement("div",{className:L.a.l},"\u77E5\u8BC6\u70B9"),I.a.createElement("div",{className:L.a.r},ie==null||((xe=ie.tag_disciplines)===null||xe===void 0)?void 0:xe.map(function(Ie,Ne){return I.a.createElement(E,{expansion:B,disabled:Z,type:_==null?void 0:_.item_type,key:"".concat(q,"-").concat(Ne),value:Ie,index:Ne,onChange:function(Be){return se(Be,q,Ne)}})}))))})))};Xe.a=d},exQ7:function(rt,Xe,X){rt.exports=X.p+"static/te.6f9c0684.svg"},fAei:function(rt,Xe,X){"use strict";X.d(Xe,"a",function(){return c.a});var oe=X("rePB"),$=X("VTBJ"),D=X("KQm4"),Y=X("1OyB"),U=X("vuIU"),N=X("Ji7U"),K=X("LK+K"),I=X("q1tI"),O=X("4IlW"),L=X("Kwbf"),T=X("TSYQ"),A=X.n(T),P=X("sboe"),w=X("OZM5"),S=X("815F"),x=X("ODXe"),h=X("Ff2n"),l=X("+nKL"),i=X("8XRh"),c=X("WaYH"),C=function(Ce,_e){var le=Ce.className,se=Ce.style,ve=Ce.motion,ie=Ce.motionNodes,q=Ce.motionType,xe=Ce.onMotionStart,Ie=Ce.onMotionEnd,Ne=Ce.active,De=Ce.treeNodeRequiredProps,Be=Object(h.a)(Ce,["className","style","motion","motionNodes","motionType","onMotionStart","onMotionEnd","active","treeNodeRequiredProps"]),Ae=I.useState(!0),Pe=Object(x.a)(Ae,2),We=Pe[0],ze=Pe[1],qe=I.useContext(P.a),Ge=qe.prefixCls,ke=I.useRef(!1),ct=function(){ke.current||Ie(),ke.current=!0};return Object(I.useEffect)(function(){ie&&q==="hide"&&We&&ze(!1)},[ie]),Object(I.useEffect)(function(){return ie&&xe(),function(){ie&&ct()}},[]),ie?I.createElement(i.default,Object.assign({ref:_e,visible:We},ve,{motionAppear:q==="show",onAppearEnd:ct,onLeaveEnd:ct}),function(ut,vt){var lt=ut.className,Tt=ut.style;return I.createElement("div",{ref:vt,className:A()("".concat(Ge,"-treenode-motion"),lt),style:Tt},ie.map(function(gt){var yt=gt.data,Oe=yt.key,Pt=Object(h.a)(yt,["key"]),St=gt.isStart,Ue=gt.isEnd;delete Pt.children;var Ze=Object(S.f)(Oe,De);return I.createElement(c.a,Object.assign({},Pt,Ze,{active:Ne,data:gt.data,key:Oe,isStart:St,isEnd:Ue}))}))}):I.createElement(c.a,Object.assign({domRef:_e,className:le,style:se},Be,{active:Ne}))};C.displayName="MotionTreeNode";var v=I.forwardRef(C),m=v;function u(){var ye=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],Ce=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],_e=ye.length,le=Ce.length;if(Math.abs(_e-le)!==1)return{add:!1,key:null};function se(ve,ie){var q=new Map;ve.forEach(function(Ie){q.set(Ie,!0)});var xe=ie.filter(function(Ie){return!q.has(Ie)});return xe.length===1?xe[0]:null}return _e ").concat(Ce);return Ce}var z=function(Ce,_e){var le=Ce.prefixCls,se=Ce.data,ve=Ce.selectable,ie=Ce.checkable,q=Ce.expandedKeys,xe=Ce.selectedKeys,Ie=Ce.checkedKeys,Ne=Ce.loadedKeys,De=Ce.loadingKeys,Be=Ce.halfCheckedKeys,Ae=Ce.keyEntities,Pe=Ce.disabled,We=Ce.dragging,ze=Ce.dragOverNodeKey,qe=Ce.dropPosition,Ge=Ce.motion,ke=Ce.height,ct=Ce.itemHeight,ut=Ce.virtual,vt=Ce.focusable,lt=Ce.activeItem,Tt=Ce.focused,gt=Ce.tabIndex,yt=Ce.onKeyDown,Oe=Ce.onFocus,Pt=Ce.onBlur,St=Ce.onActiveChange,Ue=Ce.onListChangeStart,Ze=Ce.onListChangeEnd,Ee=Object(h.a)(Ce,["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"]),fe=I.useRef(null);I.useImperativeHandle(_e,function(){return{scrollTo:function(kt){fe.current.scrollTo(kt)}}});var be=I.useState(q),ne=Object(x.a)(be,2),re=ne[0],ae=ne[1],ce=I.useState(se),ue=Object(x.a)(ce,2),we=ue[0],Le=ue[1],tt=I.useState(se),Fe=Object(x.a)(tt,2),$e=Fe[0],Dt=Fe[1],ot=I.useState([]),ft=Object(x.a)(ot,2),zt=ft[0],Je=ft[1],Kt=I.useState(null),sn=Object(x.a)(Kt,2),Bt=sn[0],an=sn[1];function Qt(){Le(se),Dt(se),Je([]),an(null),Ze()}I.useEffect(function(){ae(q);var xt=u(re,q);if(xt.key!==null)if(xt.add){var kt=we.findIndex(function(ln){var Yt=ln.data.key;return Yt===xt.key}),Mt=_(E(we,se,xt.key),ut,ke,ct),It=we.slice();It.splice(kt+1,0,g),Dt(It),Je(Mt),an("show")}else{var Lt=se.findIndex(function(ln){var Yt=ln.data.key;return Yt===xt.key}),at=_(E(se,we,xt.key),ut,ke,ct),Ve=se.slice();Ve.splice(Lt+1,0,g),Dt(Ve),Je(at),an("hide")}else we!==se&&(Le(se),Dt(se))},[q,se]),I.useEffect(function(){We||Qt()},[We]);var it=Ge?$e:se,Ft={expandedKeys:q,selectedKeys:xe,loadedKeys:Ne,loadingKeys:De,checkedKeys:Ie,halfCheckedKeys:Be,dragOverNodeKey:ze,dropPosition:qe,keyEntities:Ae};return I.createElement(I.Fragment,null,Tt&<&&I.createElement("span",{style:d,"aria-live":"assertive"},H(lt)),I.createElement("div",{role:"tree"},I.createElement("input",{style:d,disabled:vt===!1||Pe,tabIndex:vt!==!1?gt:null,onKeyDown:yt,onFocus:Oe,onBlur:Pt,value:"",onChange:f})),I.createElement(l.a,Object.assign({},Ee,{data:it,itemKey:k,height:ke,fullHeight:!1,virtual:ut,itemHeight:ct,prefixCls:"".concat(le,"-list"),ref:fe}),function(xt){var kt=xt.pos,Mt=xt.data,It=Mt.key,Lt=Object(h.a)(Mt,["key"]),at=xt.isStart,Ve=xt.isEnd,ln=Object(S.e)(It,kt);delete Lt.children;var Yt=Object(S.f)(ln,Ft);return I.createElement(m,Object.assign({},Lt,Yt,{active:lt&&It===lt.data.key,pos:kt,data:xt.data,isStart:at,isEnd:Ve,motion:Ge,motionNodes:It===s?zt:null,motionType:Bt,onMotionStart:Ue,onMotionEnd:Qt,treeNodeRequiredProps:Ft,onMouseMove:function(){St(null)}}))}))},Z=I.forwardRef(z);Z.displayName="NodeList";var G=Z,B=X("NvD2"),te=function(ye){Object(N.a)(_e,ye);var Ce=Object(K.a)(_e);function _e(){var le;return Object(Y.a)(this,_e),le=Ce.apply(this,arguments),le.destroyed=!1,le.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},le.listRef=I.createRef(),le.onNodeDragStart=function(se,ve){var ie=le.state,q=ie.expandedKeys,xe=ie.keyEntities,Ie=le.props.onDragStart,Ne=ve.props.eventKey;le.dragNode=ve;var De=Object(w.b)(q,Ne);le.setState({dragging:!0,dragNodesKeys:Object(w.g)(Ne,xe)}),le.setExpandedKeys(De),Ie&&Ie({event:se,node:Object(S.b)(ve.props)})},le.onNodeDragEnter=function(se,ve){var ie=le.state,q=ie.expandedKeys,xe=ie.keyEntities,Ie=ie.dragNodesKeys,Ne=le.props.onDragEnter,De=ve.props,Be=De.pos,Ae=De.eventKey;if(!le.dragNode||Ie.indexOf(Ae)!==-1)return;var Pe=Object(w.c)(se,ve);if(le.dragNode.props.eventKey===Ae&&Pe===0){le.setState({dragOverNodeKey:"",dropPosition:null});return}setTimeout(function(){le.setState({dragOverNodeKey:Ae,dropPosition:Pe}),le.delayedDragEnterLogic||(le.delayedDragEnterLogic={}),Object.keys(le.delayedDragEnterLogic).forEach(function(We){clearTimeout(le.delayedDragEnterLogic[We])}),le.delayedDragEnterLogic[Be]=window.setTimeout(function(){if(!le.state.dragging)return;var We=Object(D.a)(q),ze=xe[Ae];ze&&(ze.children||[]).length&&(We=Object(w.a)(q,Ae)),"expandedKeys"in le.props||le.setExpandedKeys(We),Ne&&Ne({event:se,node:Object(S.b)(ve.props),expandedKeys:We})},400)},0)},le.onNodeDragOver=function(se,ve){var ie=le.state.dragNodesKeys,q=le.props.onDragOver,xe=ve.props.eventKey;if(ie.indexOf(xe)!==-1)return;if(le.dragNode&&xe===le.state.dragOverNodeKey){var Ie=Object(w.c)(se,ve);if(Ie===le.state.dropPosition)return;le.setState({dropPosition:Ie})}q&&q({event:se,node:Object(S.b)(ve.props)})},le.onNodeDragLeave=function(se,ve){var ie=le.props.onDragLeave;le.setState({dragOverNodeKey:""}),ie&&ie({event:se,node:Object(S.b)(ve.props)})},le.onNodeDragEnd=function(se,ve){var ie=le.props.onDragEnd;le.setState({dragOverNodeKey:""}),le.cleanDragState(),ie&&ie({event:se,node:Object(S.b)(ve.props)}),le.dragNode=null},le.onNodeDrop=function(se,ve){var ie=le.state,q=ie.dragNodesKeys,xe=q===void 0?[]:q,Ie=ie.dropPosition,Ne=le.props.onDrop,De=ve.props,Be=De.eventKey,Ae=De.pos;if(le.setState({dragOverNodeKey:""}),le.cleanDragState(),xe.indexOf(Be)!==-1){Object(L.a)(!1,"Can not drop to dragNode(include it's children node)");return}var Pe=Object(w.k)(Ae),We={event:se,node:Object(S.b)(ve.props),dragNode:le.dragNode?Object(S.b)(le.dragNode.props):null,dragNodesKeys:xe.slice(),dropPosition:Ie+Number(Pe[Pe.length-1]),dropToGap:!1};Ie!==0&&(We.dropToGap=!0),Ne&&Ne(We),le.dragNode=null},le.cleanDragState=function(){var se=le.state.dragging;se&&le.setState({dragging:!1})},le.onNodeClick=function(se,ve){var ie=le.props.onClick;ie&&ie(se,ve)},le.onNodeDoubleClick=function(se,ve){var ie=le.props.onDoubleClick;ie&&ie(se,ve)},le.onNodeSelect=function(se,ve){var ie=le.state.selectedKeys,q=le.state.keyEntities,xe=le.props,Ie=xe.onSelect,Ne=xe.multiple,De=ve.selected,Be=ve.key,Ae=!De;Ae?Ne?ie=Object(w.a)(ie,Be):ie=[Be]:ie=Object(w.b)(ie,Be);var Pe=ie.map(function(We){var ze=q[We];return ze?ze.node:null}).filter(function(We){return We});le.setUncontrolledState({selectedKeys:ie}),Ie&&Ie(ie,{event:"select",selected:Ae,node:ve,selectedNodes:Pe,nativeEvent:se.nativeEvent})},le.onNodeCheck=function(se,ve,ie){var q=le.state,xe=q.keyEntities,Ie=q.checkedKeys,Ne=q.halfCheckedKeys,De=le.props,Be=De.checkStrictly,Ae=De.onCheck,Pe=ve.key,We,ze={event:"check",node:ve,checked:ie,nativeEvent:se.nativeEvent};if(Be){var qe=ie?Object(w.a)(Ie,Pe):Object(w.b)(Ie,Pe),Ge=Object(w.b)(Ne,Pe);We={checked:qe,halfChecked:Ge},ze.checkedNodes=qe.map(function(Tt){return xe[Tt]}).filter(function(Tt){return Tt}).map(function(Tt){return Tt.node}),le.setUncontrolledState({checkedKeys:qe})}else{var ke=Object(B.a)([].concat(Object(D.a)(Ie),[Pe]),!0,xe),ct=ke.checkedKeys,ut=ke.halfCheckedKeys;if(!ie){var vt=new Set(ct);vt.delete(Pe);var lt=Object(B.a)(Array.from(vt),{checked:!1,halfCheckedKeys:ut},xe);ct=lt.checkedKeys,ut=lt.halfCheckedKeys}We=ct,ze.checkedNodes=[],ze.checkedNodesPositions=[],ze.halfCheckedKeys=ut,ct.forEach(function(Tt){var gt=xe[Tt];if(!gt)return;var yt=gt.node,Oe=gt.pos;ze.checkedNodes.push(yt),ze.checkedNodesPositions.push({node:yt,pos:Oe})}),le.setUncontrolledState({checkedKeys:ct},!1,{halfCheckedKeys:ut})}Ae&&Ae(We,ze)},le.onNodeLoad=function(se){return new Promise(function(ve){le.setState(function(ie){var q=ie.loadedKeys,xe=q===void 0?[]:q,Ie=ie.loadingKeys,Ne=Ie===void 0?[]:Ie,De=le.props,Be=De.loadData,Ae=De.onLoad,Pe=se.key;if(!Be||xe.indexOf(Pe)!==-1||Ne.indexOf(Pe)!==-1)return{};var We=Be(se);return We.then(function(){var ze=le.state,qe=ze.loadedKeys,Ge=ze.loadingKeys,ke=Object(w.a)(qe,Pe),ct=Object(w.b)(Ge,Pe);Ae&&Ae(ke,{event:"load",node:se}),le.setUncontrolledState({loadedKeys:ke}),le.setState({loadingKeys:ct}),ve()}),{loadingKeys:Object(w.a)(Ne,Pe)}})})},le.onNodeMouseEnter=function(se,ve){var ie=le.props.onMouseEnter;ie&&ie({event:se,node:ve})},le.onNodeMouseLeave=function(se,ve){var ie=le.props.onMouseLeave;ie&&ie({event:se,node:ve})},le.onNodeContextMenu=function(se,ve){var ie=le.props.onRightClick;ie&&(se.preventDefault(),ie({event:se,node:ve}))},le.onFocus=function(){var se=le.props.onFocus;le.setState({focused:!0}),se&&se.apply(void 0,arguments)},le.onBlur=function(){var se=le.props.onBlur;le.setState({focused:!1}),le.onActiveChange(null),se&&se.apply(void 0,arguments)},le.getTreeNodeRequiredProps=function(){var se=le.state,ve=se.expandedKeys,ie=se.selectedKeys,q=se.loadedKeys,xe=se.loadingKeys,Ie=se.checkedKeys,Ne=se.halfCheckedKeys,De=se.dragOverNodeKey,Be=se.dropPosition,Ae=se.keyEntities;return{expandedKeys:ve||[],selectedKeys:ie||[],loadedKeys:q||[],loadingKeys:xe||[],checkedKeys:Ie||[],halfCheckedKeys:Ne||[],dragOverNodeKey:De,dropPosition:Be,keyEntities:Ae}},le.setExpandedKeys=function(se){var ve=le.state.treeData,ie=Object(S.d)(ve,se);le.setUncontrolledState({expandedKeys:se,flattenNodes:ie},!0)},le.onNodeExpand=function(se,ve){var ie=le.state.expandedKeys,q=le.state.listChanging,xe=le.props,Ie=xe.onExpand,Ne=xe.loadData,De=ve.key,Be=ve.expanded;if(q)return;var Ae=ie.indexOf(De),Pe=!Be;if(Object(L.a)(Be&&Ae!==-1||!Be&&Ae===-1,"Expand state not sync with index check"),Pe?ie=Object(w.a)(ie,De):ie=Object(w.b)(ie,De),le.setExpandedKeys(ie),Ie&&Ie(ie,{node:ve,expanded:Pe,nativeEvent:se.nativeEvent}),Pe&&Ne){var We=le.onNodeLoad(ve);We&&We.then(function(){var ze=Object(S.d)(le.state.treeData,ie);le.setUncontrolledState({flattenNodes:ze})})}},le.onListChangeStart=function(){le.setUncontrolledState({listChanging:!0})},le.onListChangeEnd=function(){setTimeout(function(){le.setUncontrolledState({listChanging:!1})})},le.onActiveChange=function(se){var ve=le.state.activeKey,ie=le.props.onActiveChange;if(ve===se)return;le.setState({activeKey:se}),se!==null&&le.scrollTo({key:se}),ie&&ie(se)},le.getActiveItem=function(){var se=le.state,ve=se.activeKey,ie=se.flattenNodes;return ve===null?null:ie.find(function(q){var xe=q.data.key;return xe===ve})||null},le.offsetActiveKey=function(se){var ve=le.state,ie=ve.flattenNodes,q=ve.activeKey,xe=ie.findIndex(function(De){var Be=De.data.key;return Be===q});xe===-1&&se<0&&(xe=ie.length),xe=(xe+se+ie.length)%ie.length;var Ie=ie[xe];if(Ie){var Ne=Ie.data.key;le.onActiveChange(Ne)}else le.onActiveChange(null)},le.onKeyDown=function(se){var ve=le.state,ie=ve.activeKey,q=ve.expandedKeys,xe=ve.checkedKeys,Ie=le.props,Ne=Ie.onKeyDown,De=Ie.checkable,Be=Ie.selectable;switch(se.which){case O.a.UP:{le.offsetActiveKey(-1),se.preventDefault();break}case O.a.DOWN:{le.offsetActiveKey(1),se.preventDefault();break}}var Ae=le.getActiveItem();if(Ae&&Ae.data){var Pe=le.getTreeNodeRequiredProps(),We=Ae.data.isLeaf===!1||!!(Ae.data.children||[]).length,ze=Object(S.b)(Object($.a)(Object($.a)({},Object(S.f)(ie,Pe)),{},{data:Ae.data,active:!0}));switch(se.which){case O.a.LEFT:{We&&q.includes(ie)?le.onNodeExpand({},ze):Ae.parent&&le.onActiveChange(Ae.parent.data.key),se.preventDefault();break}case O.a.RIGHT:{We&&!q.includes(ie)?le.onNodeExpand({},ze):Ae.children&&Ae.children.length&&le.onActiveChange(Ae.children[0].data.key),se.preventDefault();break}case O.a.ENTER:case O.a.SPACE:{De&&!ze.disabled&&ze.checkable!==!1&&!ze.disableCheckbox?le.onNodeCheck({},ze,!xe.includes(ie)):!De&&Be&&!ze.disabled&&ze.selectable!==!1&&le.onNodeSelect({},ze);break}}}Ne&&Ne(se)},le.setUncontrolledState=function(se){var ve=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,ie=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null;if(le.destroyed)return;var q=!1,xe=!0,Ie={};Object.keys(se).forEach(function(Ne){if(Ne in le.props){xe=!1;return}q=!0,Ie[Ne]=se[Ne]}),q&&(!ve||xe)&&le.setState(Object($.a)(Object($.a)({},Ie),ie))},le.scrollTo=function(se){le.listRef.current.scrollTo(se)},le}return Object(U.a)(_e,[{key:"componentWillUnmount",value:function(){this.destroyed=!0}},{key:"render",value:function(){var se,ve=this.state,ie=ve.focused,q=ve.flattenNodes,xe=ve.keyEntities,Ie=ve.dragging,Ne=ve.activeKey,De=this.props,Be=De.prefixCls,Ae=De.className,Pe=De.style,We=De.showLine,ze=De.focusable,qe=De.tabIndex,Ge=qe===void 0?0:qe,ke=De.selectable,ct=De.showIcon,ut=De.icon,vt=De.switcherIcon,lt=De.draggable,Tt=De.checkable,gt=De.checkStrictly,yt=De.disabled,Oe=De.motion,Pt=De.loadData,St=De.filterTreeNode,Ue=De.height,Ze=De.itemHeight,Ee=De.virtual,fe=De.titleRender,be=De.onContextMenu,ne=Object(w.f)(this.props);return I.createElement(P.a.Provider,{value:{prefixCls:Be,selectable:ke,showIcon:ct,icon:ut,switcherIcon:vt,draggable:lt,checkable:Tt,checkStrictly:gt,disabled:yt,keyEntities:xe,loadData:Pt,filterTreeNode:St,titleRender:fe,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}},I.createElement("div",{className:A()(Be,Ae,(se={},Object(oe.a)(se,"".concat(Be,"-show-line"),We),Object(oe.a)(se,"".concat(Be,"-focused"),ie),Object(oe.a)(se,"".concat(Be,"-active-focused"),Ne!==null),se))},I.createElement(G,Object.assign({ref:this.listRef,prefixCls:Be,style:Pe,data:q,disabled:yt,selectable:ke,checkable:!!Tt,motion:Oe,dragging:Ie,height:Ue,itemHeight:Ze,virtual:Ee,focusable:ze,focused:ie,tabIndex:Ge,activeItem:this.getActiveItem(),onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.onKeyDown,onActiveChange:this.onActiveChange,onListChangeStart:this.onListChangeStart,onListChangeEnd:this.onListChangeEnd,onContextMenu:be},this.getTreeNodeRequiredProps(),ne))))}}],[{key:"getDerivedStateFromProps",value:function(se,ve){var ie=ve.prevProps,q={prevProps:se};function xe(ut){return!ie&&ut in se||ie&&ie[ut]!==se[ut]}var Ie;if(xe("treeData")?Ie=se.treeData:xe("children")&&(Object(L.a)(!1,"`children` of Tree is deprecated. Please use `treeData` instead."),Ie=Object(S.c)(se.children)),Ie){q.treeData=Ie;var Ne=Object(S.a)(Ie);q.keyEntities=Object($.a)(Object(oe.a)({},s,b),Ne.keyEntities)}var De=q.keyEntities||ve.keyEntities;if(xe("expandedKeys")||ie&&xe("autoExpandParent"))q.expandedKeys=se.autoExpandParent||!ie&&se.defaultExpandParent?Object(w.e)(se.expandedKeys,De):se.expandedKeys;else if(!ie&&se.defaultExpandAll){var Be=Object($.a)({},De);delete Be[s],q.expandedKeys=Object.keys(Be).map(function(ut){return Be[ut].key})}else!ie&&se.defaultExpandedKeys&&(q.expandedKeys=se.autoExpandParent||se.defaultExpandParent?Object(w.e)(se.defaultExpandedKeys,De):se.defaultExpandedKeys);if(q.expandedKeys||delete q.expandedKeys,Ie||q.expandedKeys){var Ae=Object(S.d)(Ie||ve.treeData,q.expandedKeys||ve.expandedKeys);q.flattenNodes=Ae}if(se.selectable&&(xe("selectedKeys")?q.selectedKeys=Object(w.d)(se.selectedKeys,se):!ie&&se.defaultSelectedKeys&&(q.selectedKeys=Object(w.d)(se.defaultSelectedKeys,se))),se.checkable){var Pe;if(xe("checkedKeys")?Pe=Object(w.j)(se.checkedKeys)||{}:!ie&&se.defaultCheckedKeys?Pe=Object(w.j)(se.defaultCheckedKeys)||{}:Ie&&(Pe=Object(w.j)(se.checkedKeys)||{checkedKeys:ve.checkedKeys,halfCheckedKeys:ve.halfCheckedKeys}),Pe){var We=Pe,ze=We.checkedKeys,qe=ze===void 0?[]:ze,Ge=We.halfCheckedKeys,ke=Ge===void 0?[]:Ge;if(!se.checkStrictly){var ct=Object(B.a)(qe,!0,De);qe=ct.checkedKeys,ke=ct.halfCheckedKeys}q.checkedKeys=qe,q.halfCheckedKeys=ke}}return xe("loadedKeys")&&(q.loadedKeys=se.loadedKeys),q}}]),_e}(I.Component);te.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:[]},te.TreeNode=c.a;var de=te,pe=Xe.b=de},k4n4:function(rt,Xe,X){"use strict";var oe=X("tJVT"),$=X("q1tI"),D=X.n($),Y=X("e+RI"),U=X.n(Y),N=X("FTkQ"),K=X.n(N),I=X("E/GV"),O=X.n(I),L=function(A){var P=A.type,w=P===void 0?1:P,S=A.value,x=S===void 0?[]:S,h=A.onChange,l=A.disabled,i=l===void 0?!1:l,c=A.icon,C=Object($.useState)(),v=Object(oe.a)(C,2),m=v[0],u=v[1],E=function(f){h(f)};return w===1?D.a.createElement("div",null,x==null?void 0:x.map(function(d,f){return D.a.createElement("div",{key:f,className:i?"".concat(U.a.btn," ").concat(U.a.btnDisabled):U.a.btn},D.a.createElement("span",{className:U.a.s1},d.name),D.a.createElement("img",{src:K.a,className:U.a.s2,onClick:function(){return E(d.id)}}))})):D.a.createElement("div",null,x==null?void 0:x.map(function(d,f){return D.a.createElement("div",{key:f,className:U.a.btn2},D.a.createElement("span",{className:U.a.s1},D.a.createElement("img",{src:c||O.a}),d.name),D.a.createElement("img",{src:K.a,className:U.a.s2,onClick:function(){return E(d.id)}}))}))};Xe.a=L},kSUc:function(rt,Xe,X){},kqOp:function(rt,Xe,X){"use strict";X.d(Xe,"a",function(){return L});var oe=X("0Owb"),$=X("fWQN"),D=X("mtLc"),Y=X("yKVA"),U=X("879j"),N=X("q1tI"),K=X.n(N),I=X("Ot1p"),O="\u2581",L=function(T){Object(Y.a)(P,T);var A=Object(U.a)(P);function P(){var w;Object($.a)(this,P);for(var S=arguments.length,x=new Array(S),h=0;h` "'(~:]+/,S=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,x=/^\s*\[[^\]]+?\]:.*$/,h=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\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(G,B,te){return B.f=B.inline=te,te(G,B)}function c(G,B,te){return B.f=B.block=te,te(G,B)}function C(G){return!G||!/\S/.test(G.string)}function v(G){if(G.linkTitle=!1,G.linkHref=!1,G.linkText=!1,G.em=!1,G.strong=!1,G.strikethrough=!1,G.quote=0,G.indentedCode=!1,G.f==u){var B=U;if(!B){var te=oe.innerMode(Y,G.htmlState);B=te.mode.name=="xml"&&te.state.tagStart===null&&!te.state.context&&te.state.tokenize.isInText}B&&(G.f=s,G.block=m,G.htmlState=null)}return G.trailingSpace=0,G.trailingSpaceNewLine=!1,G.prevLine=G.thisLine,G.thisLine={stream:null},null}function m(G,B){var te=G.column()===B.indentation,de=C(B.prevLine.stream),pe=B.indentedCode,ye=B.prevLine.hr,Ce=B.list!==!1,_e=(B.listStack[B.listStack.length-1]||0)+3;B.indentedCode=!1;var le=B.indentation;if(B.indentationDiff===null&&(B.indentationDiff=B.indentation,Ce)){for(B.list=null;le=4&&(pe||B.prevLine.fencedCodeEnd||B.prevLine.header||de))return G.skipToEnd(),B.indentedCode=!0,K.code;if(G.eatSpace())return null;if(te&&B.indentation<=_e&&(ie=G.match(A))&&ie[1].length<=6)return B.quote=0,B.header=ie[1].length,B.thisLine.header=!0,D.highlightFormatting&&(B.formatting="header"),B.f=B.inline,d(B);if(B.indentation<=_e&&G.eat(">"))return B.quote=te?1:B.quote+1,D.highlightFormatting&&(B.formatting="quote"),G.eatSpace(),d(B);if(!ve&&!B.setext&&te&&B.indentation<=_e&&(ie=G.match(L))){var q=ie[1]?"ol":"ul";return B.indentation=le+G.current().length,B.list=!0,B.quote=0,B.listStack.push(B.indentation),B.em=!1,B.strong=!1,B.code=!1,B.strikethrough=!1,D.taskLists&&G.match(T,!1)&&(B.taskList=!0),B.f=B.inline,D.highlightFormatting&&(B.formatting=["list","list-"+q]),d(B)}else{if(te&&B.indentation<=_e&&(ie=G.match(S,!0)))return B.quote=0,B.fencedEndRE=new RegExp(ie[1]+"+ *$"),B.localMode=D.fencedCodeBlockHighlighting&&N(ie[2]||D.fencedCodeBlockDefaultMode),B.localMode&&(B.localState=oe.startState(B.localMode)),B.f=B.block=E,D.highlightFormatting&&(B.formatting="code-block"),B.code=-1,d(B);if(B.setext||(!se||!Ce)&&!B.quote&&B.list===!1&&!B.code&&!ve&&!x.test(G.string)&&(ie=G.lookAhead(1))&&(ie=ie.match(P)))return B.setext?(B.header=B.setext,B.setext=0,G.skipToEnd(),D.highlightFormatting&&(B.formatting="header")):(B.header=ie[0].charAt(0)=="="?1:2,B.setext=B.header),B.thisLine.header=!0,B.f=B.inline,d(B);if(ve)return G.skipToEnd(),B.hr=!0,B.thisLine.hr=!0,K.hr;if(G.peek()==="[")return i(G,B,k)}return i(G,B,B.inline)}function u(G,B){var te=Y.token(G,B.htmlState);if(!U){var de=oe.innerMode(Y,B.htmlState);(de.mode.name=="xml"&&de.state.tagStart===null&&!de.state.context&&de.state.tokenize.isInText||B.md_inside&&G.current().indexOf(">")>-1)&&(B.f=s,B.block=m,B.htmlState=null)}return te}function E(G,B){var te=B.listStack[B.listStack.length-1]||0,de=B.indentation=G.quote?B.push(K.formatting+"-"+G.formatting[te]+"-"+G.quote):B.push("error"))}if(G.taskOpen)return B.push("meta"),B.length?B.join(" "):null;if(G.taskClosed)return B.push("property"),B.length?B.join(" "):null;if(G.linkHref?B.push(K.linkHref,"url"):(G.strong&&B.push(K.strong),G.em&&B.push(K.em),G.strikethrough&&B.push(K.strikethrough),G.emoji&&B.push(K.emoji),G.linkText&&B.push(K.linkText),G.code&&B.push(K.code),G.image&&B.push(K.image),G.imageAltText&&B.push(K.imageAltText,"link"),G.imageMarker&&B.push(K.imageMarker)),G.header&&B.push(K.header,K.header+"-"+G.header),G.quote&&(B.push(K.quote),!D.maxBlockquoteDepth||D.maxBlockquoteDepth>=G.quote?B.push(K.quote+"-"+G.quote):B.push(K.quote+"-"+D.maxBlockquoteDepth)),G.list!==!1){var de=(G.listStack.length-1)%3;de?de===1?B.push(K.list2):B.push(K.list3):B.push(K.list1)}return G.trailingSpaceNewLine?B.push("trailing-space-new-line"):G.trailingSpace&&B.push("trailing-space-"+(G.trailingSpace%2?"a":"b")),B.length?B.join(" "):null}function f(G,B){return G.match(w,!0)?d(B):void 0}function s(G,B){var te=B.text(G,B);if(typeof te!="undefined")return te;if(B.list)return B.list=null,d(B);if(B.taskList){var de=G.match(T,!0)[1]===" ";return de?B.taskOpen=!0:B.taskClosed=!0,D.highlightFormatting&&(B.formatting="task"),B.taskList=!1,d(B)}if(B.taskOpen=!1,B.taskClosed=!1,B.header&&G.match(/^#+$/,!0))return D.highlightFormatting&&(B.formatting="header"),d(B);var pe=G.next();if(B.linkTitle){B.linkTitle=!1;var ye=pe;pe==="("&&(ye=")"),ye=(ye+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var Ce="^\\s*(?:[^"+ye+"\\\\]+|\\\\\\\\|\\\\.)"+ye;if(G.match(new RegExp(Ce),!0))return K.linkHref}if(pe==="`"){var _e=B.formatting;D.highlightFormatting&&(B.formatting="code"),G.eatWhile("`");var le=G.current().length;if(B.code==0&&(!B.quote||le==1))return B.code=le,d(B);if(le==B.code){var se=d(B);return B.code=0,se}else return B.formatting=_e,d(B)}else if(B.code)return d(B);if(pe==="\\"&&(G.next(),D.highlightFormatting)){var ve=d(B),ie=K.formatting+"-escape";return ve?ve+" "+ie:ie}if(pe==="!"&&G.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return B.imageMarker=!0,B.image=!0,D.highlightFormatting&&(B.formatting="image"),d(B);if(pe==="["&&B.imageMarker&&G.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return B.imageMarker=!1,B.imageAltText=!0,D.highlightFormatting&&(B.formatting="image"),d(B);if(pe==="]"&&B.imageAltText){D.highlightFormatting&&(B.formatting="image");var ve=d(B);return B.imageAltText=!1,B.image=!1,B.inline=B.f=b,ve}if(pe==="["&&!B.image)return B.linkText&&G.match(/^.*?\]/)||(B.linkText=!0,D.highlightFormatting&&(B.formatting="link")),d(B);if(pe==="]"&&B.linkText){D.highlightFormatting&&(B.formatting="link");var ve=d(B);return B.linkText=!1,B.inline=B.f=G.match(/\(.*?\)| ?\[.*?\]/,!1)?b:s,ve}if(pe==="<"&&G.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){B.f=B.inline=o,D.highlightFormatting&&(B.formatting="link");var ve=d(B);return ve?ve+=" ":ve="",ve+K.linkInline}if(pe==="<"&&G.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){B.f=B.inline=o,D.highlightFormatting&&(B.formatting="link");var ve=d(B);return ve?ve+=" ":ve="",ve+K.linkEmail}if(D.xml&&pe==="<"&&G.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var q=G.string.indexOf(">",G.pos);if(q!=-1){var xe=G.string.substring(G.start,q);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(xe)&&(B.md_inside=!0)}return G.backUp(1),B.htmlState=oe.startState(Y),c(G,B,u)}if(D.xml&&pe==="<"&&G.match(/^\/\w*?>/))return B.md_inside=!1,"tag";if(pe==="*"||pe==="_"){for(var Ie=1,Ne=G.pos==1?" ":G.string.charAt(G.pos-2);Ie<3&&G.eat(pe);)Ie++;var De=G.peek()||" ",Be=!/\s/.test(De)&&(!h.test(De)||/\s/.test(Ne)||h.test(Ne)),Ae=!/\s/.test(Ne)&&(!h.test(Ne)||/\s/.test(De)||h.test(De)),Pe=null,We=null;if(Ie%2&&(!B.em&&Be&&(pe==="*"||!Ae||h.test(Ne))?Pe=!0:B.em==pe&&Ae&&(pe==="*"||!Be||h.test(De))&&(Pe=!1)),Ie>1&&(!B.strong&&Be&&(pe==="*"||!Ae||h.test(Ne))?We=!0:B.strong==pe&&Ae&&(pe==="*"||!Be||h.test(De))&&(We=!1)),We!=null||Pe!=null){D.highlightFormatting&&(B.formatting=Pe==null?"strong":We==null?"em":"strong em"),Pe===!0&&(B.em=pe),We===!0&&(B.strong=pe);var se=d(B);return Pe===!1&&(B.em=!1),We===!1&&(B.strong=!1),se}}else if(pe===" "&&(G.eat("*")||G.eat("_"))){if(G.peek()===" ")return d(B);G.backUp(1)}if(D.strikethrough){if(pe==="~"&&G.eatWhile(pe)){if(B.strikethrough){D.highlightFormatting&&(B.formatting="strikethrough");var se=d(B);return B.strikethrough=!1,se}else if(G.match(/^[^\s]/,!1))return B.strikethrough=!0,D.highlightFormatting&&(B.formatting="strikethrough"),d(B)}else if(pe===" "&&G.match(/^~~/,!0)){if(G.peek()===" ")return d(B);G.backUp(2)}}if(D.emoji&&pe===":"&&G.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){B.emoji=!0,D.highlightFormatting&&(B.formatting="emoji");var ze=d(B);return B.emoji=!1,ze}return pe===" "&&(G.match(/^ +$/,!1)?B.trailingSpace++:B.trailingSpace&&(B.trailingSpaceNewLine=!0)),d(B)}function o(G,B){var te=G.next();if(te===">"){B.f=B.inline=s,D.highlightFormatting&&(B.formatting="link");var de=d(B);return de?de+=" ":de="",de+K.linkInline}return G.match(/^[^>]+/,!0),K.linkInline}function b(G,B){if(G.eatSpace())return null;var te=G.next();return te==="("||te==="["?(B.f=B.inline=_(te==="("?")":"]"),D.highlightFormatting&&(B.formatting="link-string"),B.linkHref=!0,d(B)):"error"}var g={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function _(G){return function(B,te){var de=B.next();if(de===G){te.f=te.inline=s,D.highlightFormatting&&(te.formatting="link-string");var pe=d(te);return te.linkHref=!1,pe}return B.match(g[G]),te.linkHref=!0,d(te)}}function k(G,B){return G.match(/^([^\]\\]|\\.)*\]:/,!1)?(B.f=H,G.next(),D.highlightFormatting&&(B.formatting="link"),B.linkText=!0,d(B)):i(G,B,s)}function H(G,B){if(G.match(/^\]:/,!0)){B.f=B.inline=z,D.highlightFormatting&&(B.formatting="link");var te=d(B);return B.linkText=!1,te}return G.match(/^([^\]\\]|\\.)+/,!0),K.linkText}function z(G,B){return G.eatSpace()?null:(G.match(/^[^\s]+/,!0),G.peek()===void 0?B.linkTitle=!0:G.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),B.f=B.inline=s,K.linkHref+" url")}var Z={startState:function(){return{f:m,prevLine:{stream:null},thisLine:{stream:null},block:m,htmlState:null,indentation:0,inline:s,text:f,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(G){return{f:G.f,prevLine:G.prevLine,thisLine:G.thisLine,block:G.block,htmlState:G.htmlState&&oe.copyState(Y,G.htmlState),indentation:G.indentation,localMode:G.localMode,localState:G.localMode?oe.copyState(G.localMode,G.localState):null,inline:G.inline,text:G.text,formatting:!1,linkText:G.linkText,linkTitle:G.linkTitle,linkHref:G.linkHref,code:G.code,em:G.em,strong:G.strong,strikethrough:G.strikethrough,emoji:G.emoji,header:G.header,setext:G.setext,hr:G.hr,taskList:G.taskList,list:G.list,listStack:G.listStack.slice(0),quote:G.quote,indentedCode:G.indentedCode,trailingSpace:G.trailingSpace,trailingSpaceNewLine:G.trailingSpaceNewLine,md_inside:G.md_inside,fencedEndRE:G.fencedEndRE}},token:function(G,B){if(B.formatting=!1,G!=B.thisLine.stream){if(B.header=0,B.hr=!1,G.match(/^\s*$/,!0))return v(B),null;if(B.prevLine=B.thisLine,B.thisLine={stream:G},B.taskList=!1,B.trailingSpace=0,B.trailingSpaceNewLine=!1,!B.localState&&(B.f=B.block,B.f!=u)){var te=G.match(/^\s*/,!0)[0].replace(/\t/g,l).length;if(B.indentation=te,B.indentationDiff=null,te>0)return null}}return B.f(G,B)},innerMode:function(G){return G.block==u?{state:G.htmlState,mode:Y}:G.localState?{state:G.localState,mode:G.localMode}:{state:G,mode:Z}},indent:function(G,B,te){return G.block==u&&Y.indent?Y.indent(G.htmlState,B,te):G.localState&&G.localMode.indent?G.localMode.indent(G.localState,B,te):oe.Pass},blankLine:v,getType:d,blockCommentStart:"",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return Z},"xml"),oe.defineMIME("text/markdown","markdown"),oe.defineMIME("text/x-markdown","markdown")})},lnNo:function(rt,Xe,X){rt.exports=X.p+"static/up.69f3b3fd.svg"},m3fD:function(rt,Xe,X){rt.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(rt,Xe,X){(function(oe){oe(X("VrN/"))})(function(oe){"use strict";var $=oe.Pos;function D(h,l){return h.line-l.line||h.ch-l.ch}var Y="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",U=Y+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",N=new RegExp("<(/?)(["+Y+"]["+U+"]*)","g");function K(h,l,i,c){this.line=l,this.ch=i,this.cm=h,this.text=h.getLine(l),this.min=c?Math.max(c.from,h.firstLine()):h.firstLine(),this.max=c?Math.min(c.to-1,h.lastLine()):h.lastLine()}function I(h,l){var i=h.cm.getTokenTypeAt($(h.line,l));return i&&/\btag\b/.test(i)}function O(h){return h.line>=h.max?void 0:(h.ch=0,h.text=h.cm.getLine(++h.line),!0)}function L(h){return h.line<=h.min?void 0:(h.text=h.cm.getLine(--h.line),h.ch=h.text.length,!0)}function T(h){for(;;){var l=h.text.indexOf(">",h.ch);if(l==-1){if(O(h))continue;return}if(!I(h,l+1)){h.ch=l+1;continue}var i=h.text.lastIndexOf("/",l),c=i>-1&&!/\S/.test(h.text.slice(i+1,l));return h.ch=l+1,c?"selfClose":"regular"}}function A(h){for(;;){var l=h.ch?h.text.lastIndexOf("<",h.ch-1):-1;if(l==-1){if(L(h))continue;return}if(!I(h,l+1)){h.ch=l;continue}N.lastIndex=l,h.ch=l;var i=N.exec(h.text);if(i&&i.index==l)return i}}function P(h){for(;;){N.lastIndex=h.ch;var l=N.exec(h.text);if(!l){if(O(h))continue;return}if(!I(h,l.index+1)){h.ch=l.index+1;continue}return h.ch=l.index+l[0].length,l}}function w(h){for(;;){var l=h.ch?h.text.lastIndexOf(">",h.ch-1):-1;if(l==-1){if(L(h))continue;return}if(!I(h,l+1)){h.ch=l;continue}var i=h.text.lastIndexOf("/",l),c=i>-1&&!/\S/.test(h.text.slice(i+1,l));return h.ch=l+1,c?"selfClose":"regular"}}function S(h,l){for(var i=[];;){var c=P(h),C,v=h.line,m=h.ch-(c?c[0].length:0);if(!c||!(C=T(h)))return;if(C=="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:$(v,m),to:$(h.line,h.ch)}}else i.push(c[2])}}function x(h,l){for(var i=[];;){var c=w(h);if(!c)return;if(c=="selfClose"){A(h);continue}var C=h.line,v=h.ch,m=A(h);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:$(h.line,h.ch),to:$(C,v)}}}}oe.registerHelper("fold","xml",function(h,l){for(var i=new K(h,l.line,0);;){var c=P(i);if(!c||i.line!=l.line)return;var C=T(i);if(!C)return;if(!c[1]&&C!="selfClose"){var v=$(i.line,i.ch),m=S(i,c[2]);return m&&D(m.from,v)>0?{from:v,to:m.from}:null}}}),oe.findMatchingTag=function(h,l,i){var c=new K(h,l.line,l.ch,i);if(c.text.indexOf(">")==-1&&c.text.indexOf("<")==-1)return;var C=T(c),v=C&&$(c.line,c.ch),m=C&&A(c);if(!C||!m||D(c,l)>0)return;var u={from:$(c.line,c.ch),to:v,tag:m[2]};return C=="selfClose"?{open:u,close:null,at:"open"}:m[1]?{open:x(c,m[2]),close:u,at:"close"}:(c=new K(h,v.line,v.ch,i),{open:u,close:S(c,m[2]),at:"open"})},oe.findEnclosingTag=function(h,l,i,c){for(var C=new K(h,l.line,l.ch,i);;){var v=x(C,c);if(!v)break;var m=new K(h,l.line,l.ch,i),u=S(m,v.tag);if(u)return{open:v,close:u}}},oe.scanForClosingTag=function(h,l,i,c){var C=new K(h,l.line,l.ch,c?{from:0,to:c}:null);return S(C,i)}})},p5ED:function(rt,Xe,X){"use strict";var oe=X("+L6B"),$=X("2/Rp"),D=X("5Dmo"),Y=X("3S7+"),U=X("k1fw"),N=X("tJVT"),K=X("q1tI"),I=X.n(K),O=X("vHTk"),L=X.n(O),T=X("yEEn"),A=X("ZW9T"),P=X("1vsH");Xe.a=function(w){var S=w.name,x=w.data,h=w.theme,l=w.type,i=w.filename,c=w.monacoEditor,C=w.className,v=w.style,m=w.close,u=w.onClose,E=w.hasMask,d=Object(K.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),f=Object(N.a)(d,2),s=f[0],o=f[1],b=Object(K.useState)(""),g=Object(N.a)(b,2),_=g[0],k=g[1],H,z=1024*1024,Z=10*z,G=Object(K.useRef)();l==="office"&&(H=Object(P.T)(x).filesize,H>Z&&(l="other")),i&&(c.filename=i),Object(K.useEffect)(function(){var de,pe,ye=(de=document.cookie)===null||de===void 0||((pe=de.replace(/\s/g,""))===null||pe===void 0)?void 0:pe.split(";");ye==null||ye.map(function(Ce){var _e=Ce.split("=");_e[0]==="_educoder_session"&&k(_e[1])})},[]);var B=function(){if(x.startsWith("http")||x.startsWith("/")){te();return}Object(P.z)(i||"educoder",x,i)},te=function(){Object(P.x)(i||S,x)};return console.log("data:",x,"fileanme:",i," name:",S),I.a.createElement("div",{style:Object(U.a)({},v||{}),className:"".concat(E&&L.a.bgBlack," ").concat(l?L.a.wrp:"hide")},m&&I.a.createElement("div",{className:L.a.close,ref:G},I.a.createElement(Y.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return G.current}},I.a.createElement("span",{onClick:te},I.a.createElement("i",{className:"icon-quxiaozhiding"}))),I.a.createElement(Y.a,{title:"\u5173\u95ED",getPopupContainer:function(){return G.current}},I.a.createElement("span",{className:"",onClick:u},I.a.createElement("i",{className:"icon-guanbi1"})))),I.a.createElement("div",{className:"".concat(L.a[C]," ").concat(C," ").concat(L.a.monaco," ").concat(l==="txt"?"show":"hide")},l==="txt"&&I.a.createElement(A.b,c)),l==="audio"&&I.a.createElement("audio",{src:"".concat(x!=null&&x.startsWith("/")||(x==null?void 0:x.indexOf("https://"))>-1?x:"data:audio/mp3;base64,").concat(x),autoPlay:!0}),l==="video"&&I.a.createElement(I.a.Fragment,null,x!=null&&x.startsWith("/")?I.a.createElement("video",{controls:!0,src:"".concat(x),autoPlay:!0}):I.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(x),autoPlay:!0})),l==="html"&&I.a.createElement("iframe",{src:x+"&disposition=inline"}),l==="pdf"&&I.a.createElement("embed",{className:L.a.embed,src:x}),l==="image"&&I.a.createElement(I.a.Fragment,null,I.a.createElement("img",{src:"".concat(x!=null&&x.startsWith("/")||(x==null?void 0:x.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(x)})),l==="other"&&I.a.createElement("div",null,I.a.createElement($.a,{type:"primary",size:"large",onClick:B},I.a.createElement(T.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),(l==="download"||l==="office")&&I.a.createElement($.a,{type:"primary",size:"large",onClick:B},I.a.createElement(T.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(rt,Xe,X){},rUJ1:function(rt,Xe){const X=/[&<>"']/,oe=/[&<>"']/g,$=/[<>"']|&(?!#?\w+;)/,D=/[<>"']|&(?!#?\w+;)/g,Y={"&":"&","<":"<",">":">",'"':""","'":"'"},U=E=>Y[E];function N(E,d){if(d){if(X.test(E))return E.replace(oe,U)}else if($.test(E))return E.replace(D,U);return E}const K=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function I(E){return E.replace(K,(d,f)=>(f=f.toLowerCase(),f==="colon"?":":f.charAt(0)==="#"?f.charAt(1)==="x"?String.fromCharCode(parseInt(f.substring(2),16)):String.fromCharCode(+f.substring(1)):""))}const O=/(^|[^\[])\^/g;function L(E,d){E=E.source||E,d=d||"";const f={replace:(s,o)=>(o=o.source||o,o=o.replace(O,"$1"),E=E.replace(s,o),f),getRegex:()=>new RegExp(E,d)};return f}const T=/[^\w:]/g,A=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function P(E,d,f){if(E){let s;try{s=decodeURIComponent(I(f)).replace(T,"").toLowerCase()}catch(o){return null}if(s.indexOf("javascript:")===0||s.indexOf("vbscript:")===0||s.indexOf("data:")===0)return null}d&&!A.test(f)&&(f=l(d,f));try{f=encodeURI(f).replace(/%25/g,"%")}catch(s){return null}return f}const w={},S=/^[^:]+:\/*[^/]*$/,x=/^([^:]+:)[\s\S]*$/,h=/^([^:]+:\/*[^/]*)[\s\S]*$/;function l(E,d){w[" "+E]||(S.test(E)?w[" "+E]=E+"/":w[" "+E]=v(E,"/",!0)),E=w[" "+E];const f=E.indexOf(":")===-1;return d.substring(0,2)==="//"?f?d:E.replace(x,"$1")+d:d.charAt(0)==="/"?f?d:E.replace(h,"$1")+d:E+d}const i={exec:function(){}};function c(E){let d=1,f,s;for(;d{let k=!1,H=g;for(;--H>=0&&_[H]==="\\";)k=!k;return k?"|":" |"}),s=f.split(/ \|/);let o=0;if(s.length>d)s.splice(d);else for(;s.length20?(w.b.warn("\u586B\u7A7A\u9898\u6807\u51C6\u7B54\u6848\u4E0D\u80FD\u4E3A\u7A7A/\u4E0D\u80FD\u8D85\u8FC720\u4E2A\uFF01"),!1):{name:ft,analysis:sn,standard_answers:F,is_ordered:Ve}):(w.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),!1)},ht=function(){zt(""),Bt(""),Ft([]),ln(!1)},Ke=function(F,p,y){var M=it.slice();if(p&&M.splice(F,p),y)for(var Q=0;Q1&&u.a.createElement("span",null,u.a.createElement(pe.a,{checked:Ve,onChange:function(F){return ln(F.target.checked)},className:"".concat(q.a.color333," font14")},"\u591A\u4E2A\u586B\u7A7A\u7684\u7B54\u6848\u6709\u987A\u5E8F\u8981\u6C42"),u.a.createElement("span",{className:"".concat(q.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:q.a.titleWrap},u.a.createElement("span",{className:q.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),u.a.createElement(_e.a,{id:"single-question-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:sn,onChange:function(F){return Bt(F)}}))},Ne=Object(g.a)(function(re){var ae=re.loading,ce=re.globalSetting;return{globalSetting:ce,loading:ae.effects}},null,null,{forwardRef:!0})(Object(m.forwardRef)(Ie)),De=X("7Kak"),Be=X("9yH6"),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"],Pe=function(ae,ce){var ue=ae.globalSetting,we=ae.loading,Le=ae.editData,tt=ae.dispatch,Fe=ae.onRef,$e=Fe===void 0?function(){}:Fe,Dt=ae.isEdit,ot=Object(Ce.a)(ae,["globalSetting","loading","editData","dispatch","onRef","isEdit"]),ft=Object(m.useState)(),zt=Object(c.a)(ft,2),Je=zt[0],Kt=zt[1],sn=Object(m.useState)(""),Bt=Object(c.a)(sn,2),an=Bt[0],Qt=Bt[1],it=Object(m.useState)(""),Ft=Object(c.a)(it,2),xt=Ft[0],kt=Ft[1];Object(m.useEffect)(function(){if(!Le||!Dt)return;Qt(Le==null?void 0:Le.name),kt(Le==null?void 0:Le.analysis);var Lt=Le==null?void 0:Le.choices.find(function(at){return at.is_answer});Kt(Lt.choice_text==="\u6B63\u786E"?"0":"1")},[Le]),Object(m.useImperativeHandle)(ce,function(){return{onSave:Mt,Clear:It}});var Mt=function(){if(!an)return w.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),!1;if(!Je)return w.b.info("\u8BF7\u5148\u70B9\u51FB\u9009\u62E9\u672C\u9009\u62E9\u9898\u7684\u6B63\u786E\u9009\u9879"),!1;var at=[{choice_text:"\u6B63\u786E",is_answer:Je==="0"?1:0},{choice_text:"\u9519\u8BEF",is_answer:Je==="1"?1:0}];return{name:an,choices:at,analysis:xt}},It=function(){Qt(""),kt(""),Kt("")};return u.a.createElement("section",{className:q.a.wrap},u.a.createElement("p",{className:q.a.titleWrap},u.a.createElement("span",{className:q.a.required},"*"),u.a.createElement("span",{className:q.a.title},"\u9898\u5E72\uFF1A")),u.a.createElement(_e.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:an,onChange:function(at){return Qt(at)}}),u.a.createElement("p",{className:q.a.titleWrap},u.a.createElement("span",{className:q.a.required},"*"),u.a.createElement("span",{className:q.a.title},"\u7B54\u6848\u9009\u9879\uFF1A",u.a.createElement("span",{className:q.a.colorGray},"\u70B9\u51FB\u9009\u9879\u53EF\u8BBE\u7F6E\u6B63\u786E\u7B54\u6848"))),u.a.createElement(Be.a.Group,{buttonStyle:"solid",value:Je,onChange:function(at){return Kt(at.target.value)}},u.a.createElement(Be.a.Button,{value:"0",className:"".concat(q.a.radio," mr40")},"\u6B63\u786E"),u.a.createElement(Be.a.Button,{value:"1",className:q.a.radio},"\u9519\u8BEF")),u.a.createElement("p",{className:q.a.titleWrap},u.a.createElement("span",{className:q.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),u.a.createElement(_e.a,{id:"single-question-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:xt,onChange:function(at){return kt(at)}}))},We=Object(g.a)(function(re){var ae=re.loading,ce=re.globalSetting;return{globalSetting:ce,loading:ae.effects}},null,null,{forwardRef:!0})(Object(m.forwardRef)(Pe)),ze=["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(ae,ce){var ue=ae.editData,we=ae.globalSetting,Le=ae.loading,tt=ae.dispatch,Fe=ae.onRef,$e=Fe===void 0?function(){}:Fe,Dt=ae.isEdit,ot=Object(Ce.a)(ae,["editData","globalSetting","loading","dispatch","onRef","isEdit"]),ft=Object(m.useState)([]),zt=Object(c.a)(ft,2),Je=zt[0],Kt=zt[1],sn=Object(m.useState)(),Bt=Object(c.a)(sn,2),an=Bt[0],Qt=Bt[1],it=Object(m.useState)([]),Ft=Object(c.a)(it,2),xt=Ft[0],kt=Ft[1],Mt=Object(m.useState)(""),It=Object(c.a)(Mt,2),Lt=It[0],at=It[1],Ve=Object(m.useState)(""),ln=Object(c.a)(Ve,2),Yt=ln[0],cn=ln[1];Object(m.useEffect)(function(){Kt(["","","",""])},[]),Object(m.useEffect)(function(){if(!ue||!Dt)return;at(ue==null?void 0:ue.name),cn(ue==null?void 0:ue.analysis),Kt(ue==null?void 0:ue.choices.map(function(ht){return ht.choice_text}));var on=[];ue==null||ue.choices.map(function(ht,Ke){ht.is_answer&&on.push(Ke)}),kt(on)},[ue]),Object(m.useImperativeHandle)(ce,function(){return{onSave:qt,Clear:En}});var qt=function(){if(!Lt)return w.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),!1;var ht=Je.findIndex(function(wt){return!wt});if(ht>-1)return w.b.info("\u8BF7\u5148\u8F93\u5165 ".concat(ze[ht]," \u9009\u9879\u7684\u5185\u5BB9")),!1;if(!xt.length)return w.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(xt.length<2)return w.b.info("\u591A\u9009\u9898\u6700\u5C0F\u6B63\u786E\u9009\u9879\u4E3A2\u4E2A"),!1;var Ke=Je.map(function(wt,Hn){return{choice_text:wt,is_answer:xt.includes(Hn)?1:0}});return{name:Lt,choices:Ke,analysis:Yt}},En=function(){Kt(["","","",""]),at(""),cn(""),kt("")};return u.a.createElement("section",{className:q.a.wrap},u.a.createElement("p",{className:q.a.titleWrap},u.a.createElement("span",{className:q.a.required},"*"),u.a.createElement("span",{className:q.a.title},"\u9898\u5E72\uFF1A")),u.a.createElement(_e.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:Lt,onChange:function(ht){return at(ht)}}),u.a.createElement("p",{className:q.a.titleWrap},u.a.createElement("span",{className:q.a.required},"*"),u.a.createElement("span",{className:q.a.title},"\u7B54\u6848\u9009\u9879\uFF1A",u.a.createElement("span",{className:q.a.colorGray},"\u70B9\u51FB\u9009\u9879\u53EF\u8BBE\u7F6E\u6B63\u786E\u7B54\u6848"))),Je.map(function(on,ht){return u.a.createElement("div",{className:q.a.choiceWrap,key:ht},u.a.createElement(Y.a,{title:"\u70B9\u51FB\u8BBE\u7F6E\u4E3A\u6807\u51C6\u7B54\u6848",placement:"left"},u.a.createElement("div",{className:"".concat(q.a.answer," ").concat(xt.includes(ht)?q.a.activeAnswer:""),onClick:function(){xt.includes(ht)?kt(xt.filter(function(wt){return wt!==ht})):kt([].concat(Object(ye.a)(xt),[ht]))}},ze[ht])),u.a.createElement("div",{className:q.a.editorWrap},an===ht?u.a.createElement(_e.a,{id:"single-question-option-".concat(ht),watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9009\u9879",defaultValue:on,onChange:function(wt){Je[ht]=wt,Kt(Je)}}):u.a.createElement("div",{className:q.a.htmlWrap,onClick:function(){return Qt(ht)}},u.a.createElement(o.a,{value:on}))),ht>1&&u.a.createElement(Y.a,{title:"\u5220\u9664"},u.a.createElement("i",{className:"".concat(q.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){Kt(Je.filter(function(wt,Hn){return Hn!==ht})),xt.includes(ht)?kt(xt.filter(function(wt){return wt!==ht})):kt([].concat(Object(ye.a)(xt),[ht]))}})),ht<7&&ht===Je.length-1&&u.a.createElement(Y.a,{title:"\u65B0\u589E\u53C2\u8003\u7B54\u6848"},u.a.createElement("i",{className:"".concat(q.a.addIcon," iconfont icon-roundaddfill ml6"),onClick:function(){return Kt([].concat(Object(ye.a)(Je),[""]))}})))}),u.a.createElement("p",{className:q.a.titleWrap},u.a.createElement("span",{className:q.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),u.a.createElement(_e.a,{id:"single-question-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:Yt,onChange:function(ht){return cn(ht)}}))},Ge=Object(g.a)(function(re){var ae=re.loading,ce=re.globalSetting;return{globalSetting:ce,loading:ae.effects}},null,null,{forwardRef:!0})(Object(m.forwardRef)(qe)),ke=["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"],ct=function(ae,ce){var ue=ae.editData,we=ae.globalSetting,Le=ae.loading,tt=ae.dispatch,Fe=ae.onRef,$e=Fe===void 0?function(){}:Fe,Dt=ae.isEdit,ot=Object(Ce.a)(ae,["editData","globalSetting","loading","dispatch","onRef","isEdit"]),ft=Object(m.useState)([]),zt=Object(c.a)(ft,2),Je=zt[0],Kt=zt[1],sn=Object(m.useState)(),Bt=Object(c.a)(sn,2),an=Bt[0],Qt=Bt[1],it=Object(m.useState)(),Ft=Object(c.a)(it,2),xt=Ft[0],kt=Ft[1],Mt=Object(m.useState)(""),It=Object(c.a)(Mt,2),Lt=It[0],at=It[1],Ve=Object(m.useState)(""),ln=Object(c.a)(Ve,2),Yt=ln[0],cn=ln[1];Object(m.useEffect)(function(){Kt(["","","",""])},[]),Object(m.useEffect)(function(){if(!ue||!Dt)return;at(ue==null?void 0:ue.name),cn(ue==null?void 0:ue.analysis),Kt(ue==null?void 0:ue.choices.map(function(on){return on.choice_text})),kt(ue==null?void 0:ue.choices.findIndex(function(on){return on.is_answer}))},[ue]),Object(m.useImperativeHandle)(ce,function(){return{onSave:qt,Clear:En}});var qt=function(){if(!Lt)return w.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),!1;var ht=Je.findIndex(function(wt){return!wt});if(ht>-1)return w.b.info("\u8BF7\u5148\u8F93\u5165 ".concat(ke[ht]," \u9009\u9879\u7684\u5185\u5BB9")),!1;if(console.log("activeAnswer: ",xt),!(typeof xt=="number"))return w.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 Ke=Je.map(function(wt,Hn){return{choice_text:wt,is_answer:xt===Hn?1:0}});return{name:Lt,choices:Ke,analysis:Yt}},En=function(){Kt(["","","",""]),at(""),cn(""),kt("")};return u.a.createElement("section",{className:q.a.wrap},u.a.createElement("p",{className:q.a.titleWrap},u.a.createElement("span",{className:q.a.required},"*"),u.a.createElement("span",{className:q.a.title},"\u9898\u5E72\uFF1A")),u.a.createElement(_e.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:Lt,onChange:function(ht){return at(ht)}}),u.a.createElement("p",{className:q.a.titleWrap},u.a.createElement("span",{className:q.a.required},"*"),u.a.createElement("span",{className:q.a.title},"\u7B54\u6848\u9009\u9879\uFF1A",u.a.createElement("span",{className:q.a.colorGray},"\u70B9\u51FB\u9009\u9879\u53EF\u8BBE\u7F6E\u6B63\u786E\u7B54\u6848"))),Je.map(function(on,ht){return u.a.createElement("div",{className:q.a.choiceWrap,key:ht},u.a.createElement(Y.a,{title:"\u70B9\u51FB\u8BBE\u7F6E\u4E3A\u6807\u51C6\u7B54\u6848",placement:"left"},u.a.createElement("div",{className:"".concat(q.a.answer," ").concat(xt===ht?q.a.activeAnswer:""),onClick:function(){return kt(ht)}},ke[ht])),u.a.createElement("div",{className:q.a.editorWrap},an===ht?u.a.createElement(_e.a,{id:"single-question-option-".concat(ht),watch:!0,height:155,isFocus:!0,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9009\u9879",defaultValue:on,onChange:function(wt){Je[ht]=wt,Kt(Je)}}):u.a.createElement("div",{className:q.a.htmlWrap,onClick:function(){return Qt(ht)}},u.a.createElement(o.a,{value:on}))),ht>1&&u.a.createElement(Y.a,{title:"\u5220\u9664"},u.a.createElement("i",{className:"".concat(q.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){Kt(Je.filter(function(wt,Hn){return Hn!==ht})),ht===xt&&kt(null)}})),ht<7&&ht===Je.length-1&&u.a.createElement(Y.a,{title:"\u65B0\u589E\u53C2\u8003\u7B54\u6848"},u.a.createElement("i",{className:"".concat(q.a.addIcon," iconfont icon-roundaddfill ml6"),onClick:function(){return Kt([].concat(Object(ye.a)(Je),[""]))}})))}),u.a.createElement("p",{className:q.a.titleWrap},u.a.createElement("span",{className:q.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),u.a.createElement(_e.a,{id:"single-question-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:Yt,onChange:function(ht){return cn(ht)}}))},ut=Object(g.a)(function(re){var ae=re.loading,ce=re.globalSetting;return{globalSetting:ce,loading:ae.effects}},null,null,{forwardRef:!0})(Object(m.forwardRef)(ct)),vt=["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"],lt=function(ae,ce){var ue=ae.editData,we=ae.globalSetting,Le=ae.loading,tt=ae.dispatch,Fe=ae.onRef,$e=Fe===void 0?function(){}:Fe,Dt=ae.isEdit,ot=Object(Ce.a)(ae,["editData","globalSetting","loading","dispatch","onRef","isEdit"]),ft=Object(m.useState)(""),zt=Object(c.a)(ft,2),Je=zt[0],Kt=zt[1],sn=Object(m.useState)(""),Bt=Object(c.a)(sn,2),an=Bt[0],Qt=Bt[1],it=Object(m.useState)(""),Ft=Object(c.a)(it,2),xt=Ft[0],kt=Ft[1];Object(m.useEffect)(function(){var Lt;if(!ue||!Dt)return;Kt(ue==null?void 0:ue.name),Qt(ue==null?void 0:ue.analysis),kt(ue==null||((Lt=ue.answer_texts)===null||Lt===void 0)?void 0:Lt[0])},[ue]),Object(m.useImperativeHandle)(ce,function(){return{onSave:Mt,Clear:It}});var Mt=function(){return Je?xt?{name:Je,answer_texts:[xt],analysis:an}:(w.b.info("\u8BF7\u60A8\u8F93\u5165\u53C2\u8003\u7B54\u6848"),!1):(w.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),!1)},It=function(){Kt(""),Qt(""),kt("")};return u.a.createElement("section",{className:q.a.wrap},u.a.createElement("p",{className:q.a.titleWrap},u.a.createElement("span",{className:q.a.required},"*"),u.a.createElement("span",{className:q.a.title},"\u9898\u5E72\uFF1A")),u.a.createElement(_e.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:Je,onChange:function(at){return Kt(at)}}),u.a.createElement("p",{className:q.a.titleWrap},u.a.createElement("span",{className:q.a.title},"\u53C2\u8003\u7B54\u6848\uFF1A")),u.a.createElement(_e.a,{id:"single-question-reference-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u53C2\u8003\u7B54\u6848",defaultValue:xt,onChange:function(at){return kt(at)}}),u.a.createElement("p",{className:q.a.titleWrap},u.a.createElement("span",{className:q.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),u.a.createElement(_e.a,{id:"single-question-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:an,onChange:function(at){return Qt(at)}}))},Tt=Object(g.a)(function(re){var ae=re.loading,ce=re.globalSetting;return{globalSetting:ce,loading:ae.effects}},null,null,{forwardRef:!0})(Object(m.forwardRef)(lt)),gt=X("k1fw"),yt=["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"],Oe=function(ae,ce){var ue=ae.globalSetting,we=ae.loading,Le=ae.dispatch,tt=ae.editData,Fe=ae.onRef,$e=Fe===void 0?function(){}:Fe,Dt=ae.isEdit,ot=Object(Ce.a)(ae,["globalSetting","loading","dispatch","editData","onRef","isEdit"]),ft=Object(m.useState)(""),zt=Object(c.a)(ft,2),Je=zt[0],Kt=zt[1],sn=Object(m.useState)([]),Bt=Object(c.a)(sn,2),an=Bt[0],Qt=Bt[1];console.log(an),Object(m.useEffect)(function(){var Mt;if(!tt||!Dt)return;Kt(tt==null?void 0:tt.name);var It=tt==null||((Mt=tt.sub_item_banks)===null||Mt===void 0)?void 0:Mt.map(function(Lt){var at,Ve,ln;return Object(gt.a)(Object(gt.a)({},Lt),{},{id:Lt.id,open:!1,qusList:Lt==null||((at=Lt.choices)===null||at===void 0)?void 0:at.map(function(Yt){return Yt.choice_text}),activeQusEditor:null,qusAnswer:(Ve=[Lt==null||((ln=Lt.choices)===null||ln===void 0)?void 0:ln.findIndex(function(Yt){return Yt.is_answer})])===null||Ve===void 0?void 0:Ve.filter(function(Yt){return Yt!==-1})})});Qt(It)},[tt]),Object(m.useImperativeHandle)(ce,function(){return{onSave:it,Clear:Ft}});var it=function(){if(!Je)return w.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),!1;if(an.length===0)return w.b.info("\u8BF7\u60A8\u6DFB\u52A0\u5C0F\u9898"),!1;for(var It=0;It-1)return w.b.info("\u8BF7\u5148\u8F93\u5165\u7B2C".concat(It+1,"\u5C0F\u9898").concat(yt[Ve],"\u9009\u9879\u7684\u5185\u5BB9")),!1;if(!(at!=null&&at.qusAnswer.length))return w.b.info("\u8BF7\u8BBE\u7F6E\u7B2C".concat(It+1,"\u5C0F\u9898\u7684\u6B63\u786E\u7B54\u6848\uFF0C\u70B9\u51FB\u9009\u9879A/B...\u5373\u53EF\u5B8C\u6210\u8BBE\u7F6E")),!1}var ln=an.map(function(Yt){return{id:Yt.id>1?Yt.id:null,name:Yt.name,item_type:Yt.item_type,analysis:Yt.analysis,choices:Yt.qusList.map(function(cn,qt){return{choice_text:cn,is_answer:Yt.qusAnswer[0]===qt?1:0}})}});return{name:Je,sub_item_banks:ln}},Ft=function(){Kt(""),Qt([])},xt=function(){var It={id:Math.random(),item_type:"SINGLE",open:!1,name:"",qusList:["","","",""],activeQusEditor:null,qusAnswer:[],analysis:""};Qt(an.concat(It))},kt=function(It,Lt,at){var Ve=Object(G.cloneDeep)(an);if(It==="open"&&(Ve[Lt].open=!Ve[Lt].open),It==="delete"&&Ve.splice(Lt,1),It==="value"&&(Ve[Lt].name=at),It==="answer"&&(Ve[Lt].qusAnswer=[at]),It==="edit"&&(Ve[Lt].activeQusEditor=at),It==="details"&&(Ve[Lt].qusList[Ve[Lt].activeQusEditor]=at),It==="addQus"&&(Ve[Lt].qusList=Ve[Lt].qusList.concat("")),It==="deleteQus"){var ln;Ve[Lt].qusList=Ve[Lt].qusList.filter(function(Yt,cn){return cn!==at}),Ve[Lt].qusAnswer=(ln=Ve[Lt].qusAnswer)===null||ln===void 0?void 0:ln.filter(function(Yt){return Yt!==at})}It==="analysis"&&(Ve[Lt].analysis=at),Qt(Ve)};return u.a.createElement("section",{className:q.a.wrap},u.a.createElement("p",{className:q.a.titleWrap},u.a.createElement("span",{className:q.a.required},"*"),u.a.createElement("span",{className:q.a.title},"\u9898\u5E72\uFF1A")),u.a.createElement(_e.a,{id:"combination-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:Je,onChange:function(It){return Kt(It)}}),an==null?void 0:an.map(function(Mt,It){var Lt;return u.a.createElement("div",{className:q.a.fold,key:Mt.id},u.a.createElement("div",{onClick:function(){return kt("open",It)},className:q.a.head},u.a.createElement("i",{className:"iconfont icon-sanjiaoxing",style:{transform:Mt.open?"initial":"rotate(270deg) translate(2px, 4px)"}}),u.a.createElement("span",null,"\u7B2C",It+1,"\u5C0F\u9898\uFF08\u5355\u9009\u9898\uFF09"),u.a.createElement("b",{style:{visibility:"hidden"},onClick:function(Ve){Ve.stopPropagation(),kt("delete",It)},className:"iconfont icon-shanchu8"})),u.a.createElement("div",{className:"mb10",style:{display:Mt.open?"block":"none"}},u.a.createElement(_e.a,{watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:Mt==null?void 0:Mt.name,onChange:function(Ve){return kt("value",It,Ve)}}),u.a.createElement("p",{className:q.a.titleWrap},u.a.createElement("span",{className:q.a.required},"*"),u.a.createElement("span",{className:q.a.title},"\u7B54\u6848\u9009\u9879\uFF1A",u.a.createElement("span",{className:q.a.colorGray},"\u70B9\u51FB\u9009\u9879\u53EF\u8BBE\u7F6E\u6B63\u786E\u7B54\u6848"))),Mt==null||((Lt=Mt.qusList)===null||Lt===void 0)?void 0:Lt.map(function(at,Ve){var ln,Yt;return u.a.createElement("div",{className:q.a.choiceWrap,key:Ve},u.a.createElement(Y.a,{title:"\u70B9\u51FB\u8BBE\u7F6E\u4E3A\u6807\u51C6\u7B54\u6848",placement:"left"},u.a.createElement("div",{className:"".concat(q.a.answer," ").concat(Mt!=null&&(ln=Mt.qusAnswer)!==null&&ln!==void 0&&ln.includes(Ve)?q.a.activeAnswer:""),onClick:function(){return kt("answer",It,Ve)}},yt[Ve])),u.a.createElement("div",{className:q.a.editorWrap},(Mt==null?void 0:Mt.activeQusEditor)===Ve?u.a.createElement(_e.a,{id:"single-question-option-".concat(Ve),watch:!0,height:155,isFocus:!0,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9009\u9879",defaultValue:at,onChange:function(qt){return kt("details",It,qt)}}):u.a.createElement("div",{className:q.a.htmlWrap,onClick:function(){return kt("edit",It,Ve)}},u.a.createElement(o.a,{value:at}))),Ve>1&&u.a.createElement(Y.a,{title:"\u5220\u9664"},u.a.createElement("i",{className:"".concat(q.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){return kt("deleteQus",It,Ve)}})),Ve<7&&Ve===(Mt==null||((Yt=Mt.qusList)===null||Yt===void 0)?void 0:Yt.length)-1&&u.a.createElement(Y.a,{title:"\u65B0\u589E\u53C2\u8003\u7B54\u6848"},u.a.createElement("i",{className:"".concat(q.a.addIcon," iconfont icon-roundaddfill ml6"),onClick:function(){return kt("addQus",It)}})))}),u.a.createElement("p",{className:"mb10 mt10"},u.a.createElement("span",{className:q.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),u.a.createElement(_e.a,{id:"single-question-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:Mt.analysis,onChange:function(Ve){return kt("analysis",It,Ve)}})))}))},Pt=Object(g.a)(function(re){var ae=re.loading,ce=re.globalSetting;return{globalSetting:ce,loading:ae.effects}},null,null,{forwardRef:!0})(Object(m.forwardRef)(Oe)),St=X("14J3"),Ue=X("BMrR"),Ze=X("ZWs3"),Ee=function(ae){var ce=ae.visible,ue=ae.onCancel,we=ae.onRandomExchange,Le=ae.selectFromProblemSet;return u.a.createElement(i.a,{title:"\u8BF7\u9009\u62E9\u66FF\u6362\u65B9\u5F0F",visible:ce,onCancel:ue,centered:!0,maskClosable:!0,footer:null},u.a.createElement(Ue.a,{justify:"center"},u.a.createElement(Ze.a,{onClick:we},"\u968F\u673A\u66F4\u6362"),u.a.createElement(L.a,{style:{marginLeft:24},onClick:Le},"\u4ECE\u9898\u5E93\u4E2D\u9009\u62E9")))},fe=Ee,be=function(ae){var ce,ue,we,Le,tt,Fe,$e,Dt,ot=ae.data,ft=ae.submit,zt=ae.goBack,Je=ae.loading,Kt=ae.onTypeScore,sn=ae.editPreview,Bt=sn===void 0?!1:sn,an=ae.onSkipExamination,Qt=ae.selectValue,it=ae.onExchange,Ft=Object(m.useRef)(),xt=Object(m.useRef)(Object(G.debounce)(function(){return Fn()},100,{leading:!0,trailing:!0})),kt=Object(m.useState)(null),Mt=Object(c.a)(kt,2),It=Mt[0],Lt=Mt[1],at=Object(m.useState)(!1),Ve=Object(c.a)(at,2),ln=Ve[0],Yt=Ve[1],cn=Object(m.useState)(!1),qt=Object(c.a)(cn,2),En=qt[0],on=qt[1],ht=Object(m.useRef)(),Ke=Object(b.i)();Object(m.useEffect)(function(){return window.addEventListener("scroll",xt==null?void 0:xt.current),function(){window.removeEventListener("scroll",xt==null?void 0:xt.current)}},[]),Object(m.useEffect)(function(){Yt(!0)},[]),Object(m.useEffect)(function(){var _t,Te,nt,Ht,Ot=(_t=document.getElementById("examName"))===null||_t===void 0||((Te=_t.getElementsByClassName("ant-pagination-options-quick-jumper"))===null||Te===void 0||((nt=Te[0])===null||nt===void 0||((Ht=nt.childNodes)===null||Ht===void 0)))?void 0:Ht[2];Ot&&(Ot.nodeValue="\u4EFD")},[ot]);var wt=function(Te){var nt=parseInt(Te);return isNaN(nt)?"":nt};function Hn(){var _t=0,Te=0,nt=0;return document.body&&(Te=document.body.scrollTop),document.documentElement&&(nt=document.documentElement.scrollTop),_t=Te-nt>0?Te:nt,_t}function fr(){var _t=0,Te=0,nt=0;return document.body&&(Te=document.body.scrollHeight),document.documentElement&&(nt=document.documentElement.scrollHeight),_t=Te-nt>0?Te:nt,_t}function Ar(){var _t=0;return document.compatMode=="CSS1Compat"?_t=document.documentElement.clientHeight:_t=document.body.clientHeight,_t}var Fn=function(){var Te=document.getElementById("preview_btns"),nt=document.getElementById("preview_btns_else");Hn()+Ar()>=fr()-68?(Te.style.visibility="hidden",nt.style.visibility="visible"):(Te.style.visibility="visible",nt.style.visibility="hidden")},F=["\u5BB9\u6613","\u7B80\u5355","\u9002\u4E2D","\u56F0\u96BE"],p=function(Te){var nt,Ht=[];return u.a.createElement(u.a.Fragment,null,u.a.createElement("aside",{className:d.a.single},Te==null||((nt=Te.choices)===null||nt===void 0)?void 0:nt.map(function(Ot,Nt){return Ot.is_answer&&Ht.push(me[Nt]),u.a.createElement("ul",{key:Nt},u.a.createElement("li",null,me[Nt],"\u3001"),u.a.createElement("li",null,u.a.createElement(o.a,{value:Ot.choice_text})))})),u.a.createElement("div",{className:d.a.analysis},u.a.createElement("div",null,"\u6B63\u786E\u7B54\u6848\uFF1A",Ht.join(""),u.a.createElement("span",{className:"ml30"},"\u96BE\u5EA6\uFF1A",F[Te.difficulty])),u.a.createElement("aside",null,u.a.createElement("span",{className:d.a.text},"\u89E3\u6790:"),u.a.createElement(o.a,{value:Te.analysis?Te.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(Te==null?void 0:Te.discipline_name,"/").concat(Te==null?void 0:Te.sub_discipline_name)),u.a.createElement("li",null,u.a.createElement("span",{style:{color:"#5AB891",marginRight:10}},"\u77E5\u8BC6\u70B9:"),Te==null?void 0:Te.tag_discipline_name))))},y=function(Te){var nt,Ht=Te==null||((nt=Te.standard_answer)===null||nt===void 0)?void 0:nt.map(function(Ot){var Nt;return"\u7B54\u6848\uFF08\u586B\u7A7A".concat(Ot.position,"\uFF09\uFF1A").concat(Ot==null||((Nt=Ot.answer_text)===null||Nt===void 0)?void 0:Nt.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",Ht),u.a.createElement("aside",null,u.a.createElement("span",{className:d.a.text},"\u89E3\u6790:"),u.a.createElement(o.a,{value:Te.analysis?Te.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(Te==null?void 0:Te.discipline_name,"/").concat(Te==null?void 0:Te.sub_discipline_name)),u.a.createElement("li",null,u.a.createElement("span",{style:{color:"#5AB891",marginRight:10}},"\u77E5\u8BC6\u70B9:"),Te==null?void 0:Te.tag_discipline_name))))},M=function(Te){var nt;return u.a.createElement("div",{className:d.a.analysis},u.a.createElement("div",null,"\u6B63\u786E\u7B54\u6848\uFF1A",Te==null||((nt=Te.answer_texts)===null||nt===void 0)?void 0:nt[0]),u.a.createElement("aside",null,u.a.createElement("span",{className:d.a.text},"\u89E3\u6790:"),u.a.createElement(o.a,{value:Te.analysis?Te.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(Te==null?void 0:Te.discipline_name,"/").concat(Te==null?void 0:Te.sub_discipline_name)),u.a.createElement("li",null,u.a.createElement("span",{style:{color:"#5AB891",marginRight:10}},"\u77E5\u8BC6\u70B9:"),Te==null?void 0:Te.tag_discipline_name)))},Q=function(Te){var nt;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:Te==null||((nt=Te.program_attr)===null||nt===void 0)?void 0:nt.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(Te==null?void 0:Te.discipline_name,"/").concat(Te==null?void 0:Te.sub_discipline_name)),u.a.createElement("li",null,u.a.createElement("span",{style:{color:"#5AB891",marginRight:10}},"\u77E5\u8BC6\u70B9:"),Te==null?void 0:Te.tag_discipline_name)))},W=function(Te,nt){var Ht;return u.a.createElement("div",null,Te==null||((Ht=Te.sub_item_banks)===null||Ht===void 0)?void 0:Ht.map(function(Ot,Nt){var Xt,Dn=[];return u.a.createElement(u.a.Fragment,null,u.a.createElement("div",{style:{marginLeft:25,fontSize:"16px",color:"#333"}},nt+1+"."+(Nt+1),"\uFF08\u5355\u9009\u9898\uFF09",Ot.name),u.a.createElement("aside",{className:d.a.single},Ot==null||((Xt=Ot.choices)===null||Xt===void 0)?void 0:Xt.map(function(Sn,un){return Sn.is_answer&&Dn.push(me[un]),u.a.createElement("ul",{key:un},u.a.createElement("li",null,me[un],"\u3001"),u.a.createElement("li",null,u.a.createElement(o.a,{value:Sn.choice_text})))})),u.a.createElement("div",{className:d.a.analysis},u.a.createElement("div",null,"\u6B63\u786E\u7B54\u6848\uFF1A",Dn.join(""),u.a.createElement("span",{className:"ml30"},"\u96BE\u5EA6\uFF1A",F[Ot.difficulty])),u.a.createElement("aside",null,u.a.createElement("span",{className:d.a.text},"\u89E3\u6790:"),u.a.createElement(o.a,{value:Ot.analysis?Ot.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(Te==null?void 0:Te.discipline_name,"/").concat(Te==null?void 0:Te.sub_discipline_name)),u.a.createElement("li",null,u.a.createElement("span",{style:{color:"#5AB891",marginRight:10}},"\u77E5\u8BC6\u70B9:"),Te==null?void 0:Te.tag_discipline_name))))}))},me=["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"],Ye=function(Te){var nt,Ht=[];Te==null||((nt=Te.questions)===null||nt===void 0)||nt.map(function(Nt){var Xt;return Nt==null||((Xt=Nt.sub_item_banks)===null||Xt===void 0)?void 0:Xt.map(function(Dn){Ht.push(Dn)})});var Ot=0;Te.type==="COMBINATION"?Ot=Te.questions_score/Ht.length:Ot=Te.questions_score/Te.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,Te==null?void 0:Te.name,(Te==null?void 0:Te.type)==="COMBINATION"&&"\u4E2D\u7684\u6BCF\u5C0F\u9898","\uFF1A"),u.a.createElement(h.a,{min:1,parser:wt,defaultValue:Ot,onChange:function(Xt){Ot=Xt}}),u.a.createElement("span",{className:"ml5"},"\u5206/\u9898"))),okText:"\u786E\u8BA4",cancelText:"\u53D6\u6D88",onOk:function(){var Nt=Object(S.a)(v.a.mark(function Dn(){var Sn,un;return v.a.wrap(function(Kn){for(;;)switch(Kn.prev=Kn.next){case 0:if(Ot){Kn.next=3;break}return w.b.warn("\u5206\u6570\u4E0D\u80FD\u4E3A\u7A7A\u6216\u4E3A0"),Kn.abrupt("return",Promise.reject());case 3:Te.type==="COMBINATION"?(Sn={type:Te==null?void 0:Te.type,score:Ot,scoreTotal:Ot*(Ht==null?void 0:Ht.length)},Kt(Sn)):(un={type:Te==null?void 0:Te.type,score:Ot,scoreTotal:Ot*Te.questions_count},Kt(un));case 4:case"end":return Kn.stop()}},Dn)}));function Xt(){return Nt.apply(this,arguments)}return Xt}()})},dt=function(){var Te="";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:te.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(A.a,{placeholder:"\u8BF7\u8F93\u5165\u8BD5\u5377\u540D\u79F0",min:0,maxLength:60,defaultValue:Te,onChange:function(Ht){Te=Ht.target.value}}))),okText:"\u786E\u8BA4",cancelText:"\u53D6\u6D88",onOk:function(){var nt=Object(S.a)(v.a.mark(function Ot(){var Nt,Xt,Dn,Sn,un;return v.a.wrap(function(Kn){for(;;)switch(Kn.prev=Kn.next){case 0:if(Te){Kn.next=3;break}return w.b.warn("\u8BD5\u5377\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A"),Kn.abrupt("return",Promise.reject());case 3:return Xt=[],Dn=[],Sn=[],ot==null||((Nt=ot.questionList)===null||Nt===void 0)||Nt.forEach(function(ir){var yn;(yn=ir.questions)===null||yn===void 0||yn.forEach(function(mn){Xt.push(mn.id),Dn.push(ir.questions_score/ir.questions_count),ir.type==="COMBINATION"&&Sn.push({id:mn.id,sub_item_bank_ids:mn.sub_item_banks.map(function(Ln){return Ln.id})})})}),console.log("-----",Sn),un={item_bank_ids:Xt,item_bank_scores:Dn,name:Te,combination_item_banks:Sn},Kn.next=11,ft(un);case 11:case"end":return Kn.stop()}},Ot)}));function Ht(){return nt.apply(this,arguments)}return Ht}()})},jt=function(Te,nt,Ht,Ot){var Nt,Xt="".concat(location.pathname).concat(location.search),Dn=(Nt=Ot.questions)===null||Nt===void 0?void 0:Nt.map(function(un){return un.id});if(Xt.includes("exercise"))ht.current={id:Te,ids:Dn,type:nt,index:Ht},on(!0);else var Sn=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 un=Object(S.a)(v.a.mark(function Kn(){return v.a.wrap(function(yn){for(;;)switch(yn.prev=yn.next){case 0:return Sn.update({cancelButtonProps:{disabled:!0}}),yn.next=3,it({single_question_id:Te,seleted_item_bank_ids:Dn},{type:nt,index:Ht});case 3:Sn.update({cancelButtonProps:{disabled:!1}}),w.b.success("\u5DF2\u91CD\u65B0\u968F\u673A\u751F\u6210\u8BD5\u9898");case 5:case"end":return yn.stop()}},Kn)}));function jn(){return un.apply(this,arguments)}return jn}()})},Qe=function(Te){var nt,Ht=(nt=Te.questions)===null||nt===void 0?void 0:nt.map(function(Xt){return Xt.id}),Ot=Te.name,Nt=i.a.confirm({icon:null,className:"custom-modal-divider",centered:!0,title:"\u6E29\u99A8\u63D0\u793A",content:"\u786E\u8BA4\u66F4\u6362".concat(Ot,"\u4E2D\u7684\u6240\u6709\u8BD5\u9898\u5417\uFF1F"),cancelButtonProps:{disabled:!1},maskClosable:!1,keyboard:!1,okText:"\u786E\u8BA4",cancelText:"\u53D6\u6D88",onOk:function(){var Xt=Object(S.a)(v.a.mark(function Sn(){return v.a.wrap(function(jn){for(;;)switch(jn.prev=jn.next){case 0:return Nt.update({cancelButtonProps:{disabled:!0}}),jn.next=3,it({seleted_item_bank_ids:Ht},{type:Te.type});case 3:Nt.update({cancelButtonProps:{disabled:!1}}),w.b.success("\u5DF2\u91CD\u65B0\u968F\u673A\u751F\u6210".concat(Ot,"\u8BD5\u9898"));case 5:case"end":return jn.stop()}},Sn)}));function Dn(){return Xt.apply(this,arguments)}return Dn}()})},Vt=function(){var Te=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 nt=Object(S.a)(v.a.mark(function Ot(){return v.a.wrap(function(Xt){for(;;)switch(Xt.prev=Xt.next){case 0:return Te.update({cancelButtonProps:{disabled:!0}}),Xt.next=3,it();case 3:Te.update({cancelButtonProps:{disabled:!1}}),w.b.success("\u5DF2\u91CD\u65B0\u968F\u673A\u751F\u6210\u6574\u5F20\u8BD5\u9898");case 5:case"end":return Xt.stop()}},Ot)}));function Ht(){return nt.apply(this,arguments)}return Ht}()})},hn=function(Te){console.log(Te,"key"),an(Te-1)},Rn=function(){return u.a.createElement(u.a.Fragment,null,u.a.createElement(I.a,{color:"#55575D",overlayClassName:d.a.popover,visible:ln,getPopupContainer:function(nt){return nt==null?void 0:nt.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(L.a,{onMouseEnter:function(){return Yt(!0)},onMouseLeave:function(){return Yt(!1)},onClick:function(){dt()}},"\u4FDD\u5B58")),u.a.createElement(L.a,{onClick:function(){document.body.scrollIntoView(),zt()}},"\u8FD4\u56DE"),u.a.createElement(L.a,{loading:Je,onClick:function(){return ft()},type:"primary"},"\u63D0\u4EA4"))},pr=function(){var Te;return u.a.createElement(u.a.Fragment,null,u.a.createElement(L.a,{onClick:zt},"\u8FD4\u56DE"),Qt>0&&u.a.createElement(L.a,{onClick:function(){return hn(Qt)},type:"primary"},"\u4E0A\u4E00\u4EFD"),Qt<(ot==null||((Te=ot.exam)===null||Te===void 0)?void 0:Te.total_num)-1&&u.a.createElement(L.a,{onClick:function(){return hn(Qt+2)}},"\u4E0B\u4E00\u4EFD"))},qn=function(Te,nt){if(nt==="SINGLE")return u.a.createElement(u.a.Fragment,null,u.a.createElement(ut,{ref:Ft,editData:Te,isEdit:!0}),u.a.createElement(N.a,null));if(nt==="MULTIPLE")return u.a.createElement(u.a.Fragment,null,u.a.createElement(Ge,{ref:Ft,editData:Te,isEdit:!0}),u.a.createElement(N.a,null));if(nt==="JUDGMENT")return u.a.createElement(u.a.Fragment,null,u.a.createElement(We,{ref:Ft,editData:Te,isEdit:!0}),u.a.createElement(N.a,null));if(nt==="COMPLETION")return u.a.createElement(u.a.Fragment,null,u.a.createElement(Ne,{ref:Ft,editData:Te,isEdit:!0}),u.a.createElement(N.a,null));if(nt==="SUBJECTIVE")return u.a.createElement(u.a.Fragment,null,u.a.createElement(Tt,{ref:Ft,editData:Te,isEdit:!0}),u.a.createElement(N.a,null));if(nt==="COMBINATION")return u.a.createElement(u.a.Fragment,null,u.a.createElement(Pt,{ref:Ft,editData:Te,isEdit:!0}),u.a.createElement(N.a,null));if(nt==="PROGRAM"){var Ht;g.d.push("/problems/".concat(Te==null||((Ht=Te.program_attr)===null||Ht===void 0)?void 0:Ht.identifier,"/edit?type=exercises&express_id=").concat(Ke.categoryId,"&question_id=").concat(Te==null?void 0:Te.id,"&score=").concat(Te==null?void 0:Te.score,"&callback_url=").concat(location.pathname,"&select=").concat(Qt,"&exercise=true"))}},xn=function(){var _t=Object(S.a)(v.a.mark(function Te(nt,Ht){var Ot,Nt,Xt,Dn,Sn,un,jn,Kn,ir,yn;return v.a.wrap(function(Ln){for(;;)switch(Ln.prev=Ln.next){case 0:return Ln.next=2,(Ot=Ft.current)===null||Ot===void 0?void 0:Ot.onSave();case 2:if(Nt=Ln.sent,Nt){Ln.next=5;break}return Ln.abrupt("return");case 5:return Xt={question_score:Ht.score,analysis:Nt.analysis},(nt==="SINGLE"||nt==="MULTIPLE"||nt==="JUDGMENT")&&(Sn=[],un=[],Xt.question_type=nt==="JUDGMENT"?2:1,Xt.question_title=Nt==null?void 0:Nt.name,Nt==null||((Dn=Nt.choices)===null||Dn===void 0)||Dn.forEach(function(en,Un){Sn.push(en.choice_text),en!=null&&en.is_answer&&un.push(Un+1)}),Xt.question_choices=Sn,Xt.standard_answers=un),nt==="COMPLETION"&&(Xt.is_ordered=Nt.is_ordered,Xt.question_title=Nt==null?void 0:Nt.name,Xt.question_type=3,Kn=[],Nt==null||((jn=Nt.standard_answers)===null||jn===void 0)||jn.forEach(function(en,Un){Kn.push({choice_id:en.position,answer_text:en.answer_text})}),Xt.standard_answers=Kn),nt==="SUBJECTIVE"&&(Xt.question_title=Nt==null?void 0:Nt.name,Xt.question_type=3,Xt.standard_answers=Nt==null?void 0:Nt.answer_texts),nt==="COMBINATION"&&(Xt.question_title=Nt==null?void 0:Nt.name,Xt.question_type=7,Xt.sub_questions=Nt==null||((ir=Nt.sub_item_banks)===null||ir===void 0)?void 0:ir.map(function(en,Un){return{id:en.id,question_title:en.name,question_type:1,question_choices:en.choices.map(function(_n){return _n.choice_text}),standard_answers:[en.choices.findIndex(function(_n){return _n.is_answer})+1],analysis:en.analysis}}),delete Xt.analysis),Ln.next=12,Object(_.a)("/api/exercise_questions/".concat(Ht.id,".json"),{method:"put",body:Xt});case 12:yn=Ln.sent,(yn==null?void 0:yn.status)===0&&(w.b.success("\u7F16\u8F91\u6210\u529F"),hn(Qt+1)),Lt(null);case 15:case"end":return Ln.stop()}},Te)}));return function(nt,Ht){return _t.apply(this,arguments)}}(),Rr=function(){for(var Te=[],nt=0;nt<(ot==null||((Ht=ot.exam)===null||Ht===void 0)?void 0:Ht.total_num);nt++){var Ht;Te.push({})}return Te},qr=ot==null||((ce=ot.questionList)===null||ce===void 0)?void 0:ce.reduce(function(_t,Te){return _t+Te.questions_score},0),Vn=Bt&&(ot==null||((ue=ot.exam)===null||ue===void 0)?void 0:ue.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(Te){var nt=document.getElementById("id_left_preview");nt.style.overflowY="auto"},onMouseLeave:function(Te){var nt=document.getElementById("id_left_preview");nt.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:H.a}),u.a.createElement("span",null,"\u9898\u6570(\u9053)"),u.a.createElement("aside",null,ot==null?void 0:ot.all_questions_count)),u.a.createElement("div",{className:"mr30 ml30"},u.a.createElement("img",{src:Z.a}),u.a.createElement("span",null,"\u603B\u5206(\u5206)"),u.a.createElement("aside",null,qr)),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,ot==null||((we=ot.exam)===null||we===void 0)?void 0:we.time))),ot==null||((Le=ot.questionList)===null||Le===void 0)?void 0:Le.map(function(_t,Te){var nt;return u.a.createElement("div",{className:d.a.list,key:Te},u.a.createElement("div",{className:d.a.name},u.a.createElement("b",null),u.a.createElement("span",null,_t.name)),u.a.createElement("aside",null,u.a.createElement("div",null,"\u5171",u.a.createElement("span",{className:d.a.b},_t.questions_count),"\u9898 ",u.a.createElement("span",{className:d.a.l},"|"),"\u5171",u.a.createElement("span",{className:d.a.r},_t.questions_score),"\u5206"),u.a.createElement("div",{className:d.a.answerSheet},_t==null||((nt=_t.questions)===null||nt===void 0)?void 0:nt.map(function(Ht,Ot){return u.a.createElement("div",{onClick:function(){var Xt="Anchor_".concat(Ht.id),Dn=document.getElementById(Xt);Dn&&setTimeout(function(){return Dn.scrollIntoView({block:"center",behavior:"smooth"})})},key:Ht.id,className:d.a.tag},Ot+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(Y.a,{title:ot==null||((tt=ot.exam)===null||tt===void 0)?void 0:tt.name,getPopupContainer:function(Te){return Te.parentNode}},u.a.createElement("span",{className:d.a.t},ot==null||((Fe=ot.exam)===null||Fe===void 0)?void 0:Fe.name))),Bt?u.a.createElement($.a,{showTotal:function(Te){return u.a.createElement("span",{style:{color:"#656F87",fontSize:14}},"\u5171\u8BA1",u.a.createElement("span",{className:"c-light-primary"},Te),"\u4EFD\u8BD5\u5377")},total:ot==null||(($e=ot.exam)===null||$e===void 0)?void 0:$e.total_num,pageSize:1,current:Qt+1,showSizeChanger:!1,onChange:hn,showQuickJumper:!0,hideOnSinglePage:!1}):u.a.createElement(L.a,{onClick:Vt,type:"primary"},"\u968F\u673A\u66F4\u6362")),u.a.createElement("div",{className:d.a.topWarp},ot==null||((Dt=ot.questionList)===null||Dt===void 0)?void 0:Dt.map(function(_t,Te){var nt,Ht;return u.a.createElement(u.a.Fragment,{key:Te},u.a.createElement("div",{className:d.a.head,style:Te===0?{border:0,marginTop:-16}:{}},u.a.createElement("div",{className:d.a.name},u.a.createElement("b",null),u.a.createElement("span",null,_t.name)),u.a.createElement("div",{className:d.a.so},"\u5171",u.a.createElement("span",{className:d.a.b},_t.questions_count," "),"\u9898 ",_t.type==="COMBINATION"&&"\uFF08\u5305\u542B".concat(_t==null||((nt=_t.questions)===null||nt===void 0)?void 0:nt.map(function(Ot){var Nt;return Ot==null||((Nt=Ot.sub_item_banks)===null||Nt===void 0)?void 0:Nt.length}).reduce(function(Ot,Nt){return Ot+Nt}),"\u5C0F\u9898\uFF09"),u.a.createElement("span",{className:d.a.l},"|"),"\u5171",u.a.createElement("span",{className:d.a.r},_t.questions_score),"\u5206"),!Bt&&u.a.createElement("div",{className:d.a.btn},u.a.createElement(L.a,{onClick:function(){Ye(_t)},type:"primary",ghost:!0,className:"mr20"},"\u8BBE\u7F6E\u5F97\u5206"),u.a.createElement(L.a,{onClick:function(){return Qe(_t)},type:"primary",ghost:!0},"\u968F\u673A\u66F4\u6362"))),_t==null||((Ht=_t.questions)===null||Ht===void 0)?void 0:Ht.map(function(Ot,Nt){return It===Ot.id?u.a.createElement("div",{id:"Anchor_".concat(Ot.id),className:d.a.content,style:{padding:0,marginTop:10},key:Ot.id},u.a.createElement("div",{style:{float:"right",marginTop:-6}},u.a.createElement(L.a,{onClick:function(){return Lt(null)},className:"mr20",type:"primary",ghost:!0},"\u53D6\u6D88"),u.a.createElement(L.a,{onClick:function(){return xn(_t==null?void 0:_t.type,Ot)},type:"primary"},"\u4FDD\u5B58")),qn(Ot,_t.type)):u.a.createElement("div",{id:"Anchor_".concat(Ot.id),className:d.a.content,key:Ot.id},u.a.createElement("div",{className:d.a.titleWrap},u.a.createElement(o.a,{style:{paddingRight:10},className:d.a.titleHtml,value:Nt+1+"\u3001"+"".concat((Ot==null?void 0:Ot.item_type)==="combination"?"\uFF08\u9898\u5E72\uFF09":"")+Ot.name}),Bt&&u.a.createElement(L.a,{disabled:Vn,onClick:function(){if(It){w.b.warn("\u5148\u4FDD\u5B58\u6216\u53D6\u6D88\u5F53\u524D\u6B63\u5728\u7F16\u8F91\u7684\u8BD5\u9898");return}Lt(Ot.id)},type:"primary",className:"mr20",style:{marginLeft:"auto"},ghost:!0},"\u7F16\u8F91"),u.a.createElement(L.a,{disabled:Vn,onClick:function(){return jt(Ot.id,_t.type,Nt,_t)},type:"primary",ghost:!0},"\u6362\u4E00\u9898")),(_t.type==="SINGLE"||_t.type==="JUDGMENT"||_t.type==="MULTIPLE")&&p(Ot),_t.type==="COMPLETION"&&y(Ot),_t.type==="SUBJECTIVE"&&M(Ot),_t.type==="PROGRAM"&&Q(Ot),_t.type==="COMBINATION"&&W(Ot,Nt),u.a.createElement("div",null))}))})),u.a.createElement("div",{className:d.a.btnsElse,id:"preview_btns_else"},Bt?pr():Rn()),u.a.createElement("div",{className:d.a.btnsWrap,id:"preview_btns"},u.a.createElement("div",{className:d.a.btns},Bt?pr():Rn()))),u.a.createElement(fe,{visible:En,onRandomExchange:Object(S.a)(v.a.mark(function _t(){var Te;return v.a.wrap(function(Ht){for(;;)switch(Ht.prev=Ht.next){case 0:return Te=ht.current,Ht.next=3,it({single_question_id:Te.id,seleted_item_bank_ids:Te.ids},{type:Te.type,index:Te.index});case 3:on(!1);case 4:case"end":return Ht.stop()}},_t)})),selectFromProblemSet:function(){var Te=ht.current,nt="".concat(location.pathname).concat(location.search);nt.includes("exercise")&&g.d.push("/paperlibrary/exchangequestion?type=exercise&qid=".concat(Te.id,"&qtype=").concat(Te.type,"&exerciseid=").concat(Ke.categoryId,"&from=").concat(nt))},onCancel:function(){on(!1)}}))},ne=Xe.a=be},sboe:function(rt,Xe,X){"use strict";X.d(Xe,"a",function(){return D});var oe=X("q1tI"),$=X.n(oe),D=oe.createContext(null)},tmPe:function(rt,Xe,X){rt.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(rt,Xe,X){typeof window!="undefined"&&function($,D){rt.exports=D()}(this,function(){return function(oe){var $={};function D(Y){if($[Y])return $[Y].exports;var U=$[Y]={i:Y,l:!1,exports:{}};return oe[Y].call(U.exports,U,U.exports,D),U.l=!0,U.exports}return D.m=oe,D.c=$,D.d=function(Y,U,N){D.o(Y,U)||Object.defineProperty(Y,U,{enumerable:!0,get:N})},D.r=function(Y){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(Y,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(Y,"__esModule",{value:!0})},D.t=function(Y,U){if(U&1&&(Y=D(Y)),U&8)return Y;if(U&4&&typeof Y=="object"&&Y&&Y.__esModule)return Y;var N=Object.create(null);if(D.r(N),Object.defineProperty(N,"default",{enumerable:!0,value:Y}),U&2&&typeof Y!="string")for(var K in Y)D.d(N,K,function(I){return Y[I]}.bind(null,K));return N},D.n=function(Y){var U=Y&&Y.__esModule?function(){return Y.default}:function(){return Y};return D.d(U,"a",U),U},D.o=function(Y,U){return Object.prototype.hasOwnProperty.call(Y,U)},D.p="/dist/",D(D.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(oe,$,D){"use strict";var Y=Object.prototype.hasOwnProperty,U="~";function N(){}Object.create&&(N.prototype=Object.create(null),new N().__proto__||(U=!1));function K(T,A,P){this.fn=T,this.context=A,this.once=P||!1}function I(T,A,P,w,S){if(typeof P!="function")throw new TypeError("The listener must be a function");var x=new K(P,w||T,S),h=U?U+A:A;return T._events[h]?T._events[h].fn?T._events[h]=[T._events[h],x]:T._events[h].push(x):(T._events[h]=x,T._eventsCount++),T}function O(T,A){--T._eventsCount===0?T._events=new N:delete T._events[A]}function L(){this._events=new N,this._eventsCount=0}L.prototype.eventNames=function(){var A=[],P,w;if(this._eventsCount===0)return A;for(w in P=this._events)Y.call(P,w)&&A.push(U?w.slice(1):w);return Object.getOwnPropertySymbols?A.concat(Object.getOwnPropertySymbols(P)):A},L.prototype.listeners=function(A){var P=U?U+A:A,w=this._events[P];if(!w)return[];if(w.fn)return[w.fn];for(var S=0,x=w.length,h=new Array(x);S0},!1)}function T(A,P){for(var w={main:[P]},S={main:[]},x={main:{}};L(w);)for(var h=Object.keys(w),l=0;l=2*u/d||_<=H)return;var z=Number.POSITIVE_INFINITY,Z;for(Z=h.level-1;Z>s;Z--){var G=f[Z].maxBitrate;if(z=u*G/(8*.8*g),z=_)return;var B=this.bwEstimator.getEstimate();L.logger.warn("Fragment "+h.sn+(l?" part "+l.index:"")+" of level "+h.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+Z+` Current BW estimate: `+(Object(Y.isFiniteNumber)(B)?(B/1024).toFixed(3):"Unknown")+` Kb/s Estimated load time for current fragment: `+_.toFixed(3)+` s Estimated load time for the next fragment: `+z.toFixed(3)+` s Time to underbuffer: `+H.toFixed(3)+" s"),i.nextLoadLevel=Z,this.bwEstimator.sample(E,m.loaded),this.clearTimer(),h.loader&&(this.fragCurrent=this.partCurrent=null,h.loader.abort()),i.trigger(N.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:h,part:l,stats:m})},S.onFragLoaded=function(h,l){var i=l.frag,c=l.part;if(i.type===O.PlaylistLevelType.MAIN&&Object(Y.isFiniteNumber)(i.sn)){var C=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)+C.loaded,E=(m.loaded?m.loaded.duration:0)+v;m.loaded={bytes:u,duration:E},m.realBitrate=Math.round(8*u/E)}if(i.bitrateTest){var d={stats:C,frag:i,part:c,id:i.type};this.onFragBuffered(N.Events.FRAG_BUFFERED,d),i.bitrateTest=!1}}},S.onFragBuffered=function(h,l){var i=l.frag,c=l.part,C=c?c.stats:i.stats;if(C.aborted)return;if(i.type!==O.PlaylistLevelType.MAIN||i.sn==="initSegment")return;var v=C.parsing.end-C.loading.start;this.bwEstimator.sample(v,C.loaded),C.bwEstimate=this.bwEstimator.getEstimate(),i.bitrateTest?this.bitrateTestDelay=v/1e3:this.bitrateTestDelay=0},S.onError=function(h,l){switch(l.details){case I.ErrorDetails.FRAG_LOAD_ERROR:case I.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},S.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},S.getNextABRAutoLevel=function(){var h=this.fragCurrent,l=this.partCurrent,i=this.hls,c=i.maxAutoLevel,C=i.config,v=i.minAutoLevel,m=i.media,u=l?l.duration:h?h.duration:0,E=m?m.currentTime:0,d=m&&m.playbackRate!==0?Math.abs(m.playbackRate):1,f=this.bwEstimator?this.bwEstimator.getEstimate():C.abrEwmaDefaultEstimate,s=(K.BufferHelper.bufferInfo(m,E,C.maxBufferHole).end-E)/d,o=this.findBestLevel(f,v,c,s,C.abrBandWidthFactor,C.abrBandWidthUpFactor);if(o>=0)return o;L.logger.trace((s?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var b=u?Math.min(u,C.maxStarvationDelay):C.maxStarvationDelay,g=C.abrBandWidthFactor,_=C.abrBandWidthUpFactor;if(!s){var k=this.bitrateTestDelay;if(k){var H=u?Math.min(u,C.maxLoadingDelay):C.maxLoadingDelay;b=H-k,L.logger.trace("bitrate test took "+Math.round(1e3*k)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*b)+" ms"),g=_=1}}return o=this.findBestLevel(f,v,c,s+b,g,_),Math.max(o,0)},S.findBestLevel=function(h,l,i,c,C,v){for(var m,u=this.fragCurrent,E=this.partCurrent,d=this.lastLoadedFragLevel,f=this.hls.levels,s=f[d],o=!!(s!=null&&(m=s.details)!==null&&m!==void 0&&m.live),b=s==null?void 0:s.codecSet,g=E?E.duration:u?u.duration:0,_=i;_>=l;_--){var k=f[_];if(!k||b&&k.codecSet!==b)continue;var H=k.details,z=(E?H==null?void 0:H.partTarget:H==null?void 0:H.averagetargetduration)||g,Z=void 0;_<=d?Z=C*h:Z=v*h;var G=f[_].maxBitrate,B=G*z/Z;if(L.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+_+"/"+Math.round(Z)+"/"+G+"/"+z+"/"+c+"/"+B),Z>G&&(!B||o&&!this.bitrateTestDelay||B0&&s===-1?(this.log("Override startPosition with lastCurrentTime @"+o.toFixed(3)),this.state=U.State.IDLE):(this.loadedmetadata=!1,this.state=U.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=s,this.tick()},d.doTick=function(){switch(this.state){case U.State.IDLE:this.doTickIdle();break;case U.State.WAITING_TRACK:{var s,o=this.levels,b=this.trackId,g=o==null||((s=o[b])===null||s===void 0)?void 0:s.details;if(g){if(this.waitForCdnTuneIn(g))break;this.state=U.State.WAITING_INIT_PTS}break}case U.State.FRAG_LOADING_WAITING_RETRY:{var _,k=performance.now(),H=this.retryDate;(!H||k>=H||(_=this.media)!==null&&_!==void 0&&_.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=U.State.IDLE);break}case U.State.WAITING_INIT_PTS:{var z=this.waitingData;if(z){var Z=z.frag,G=z.part,B=z.cache,te=z.complete;if(this.initPTS[Z.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=U.State.FRAG_LOADING;var de=B.flush(),pe={frag:Z,part:G,payload:de,networkDetails:null};this._handleFragmentLoadProgress(pe),te&&u.prototype._handleFragmentLoadComplete.call(this,pe)}else if(this.videoTrackCC!==this.waitingVideoCC)l.logger.log("Waiting fragment cc ("+Z.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var ye=this.getLoadPosition(),Ce=K.BufferHelper.bufferInfo(this.mediaBuffer,ye,this.config.maxBufferHole),_e=Object(S.fragmentWithinToleranceTest)(Ce.end,this.config.maxFragLookUpTolerance,Z);_e<0&&(l.logger.log("Waiting fragment cc ("+Z.cc+") @ "+Z.start+" cancelled because another fragment at "+Ce.end+" is needed"),this.clearWaitingFragment())}}else this.state=U.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=U.State.IDLE)},d.onTickEnd=function(){var s=this.media;if(!s||!s.readyState)return;var o=this.mediaBuffer?this.mediaBuffer:s,b=o.buffered;!this.loadedmetadata&&b.length&&(this.loadedmetadata=!0),this.lastCurrentTime=s.currentTime},d.doTickIdle=function(){var s,o,b=this.hls,g=this.levels,_=this.media,k=this.trackId,H=b.config;if(!g||!g[k])return;if(!_&&(this.startFragRequested||!H.startFragPrefetch))return;var z=g[k],Z=z.details;if(!Z||Z.live&&this.levelLastLoaded!==k||this.waitForCdnTuneIn(Z)){this.state=U.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,T.ElementaryStreamTypes.AUDIO,L.PlaylistLevelType.AUDIO));var G=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,L.PlaylistLevelType.AUDIO);if(G===null)return;var B=G.len,te=this.getMaxBufferLength(),de=this.audioSwitch;if(B>=te&&!de)return;if(!de&&this._streamEnded(G,Z)){b.trigger(N.Events.BUFFER_EOS,{type:"audio"}),this.state=U.State.ENDED;return}var pe=Z.fragments,ye=pe[0].start,Ce=G.end;if(de){var _e=this.getLoadPosition();Ce=_e,Z.PTSKnown&&_eye||G.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),_.currentTime=ye+.05))}var le=this.getNextFragment(Ce,Z);if(!le){this.bufferFlushed=!0;return}((s=le.decryptdata)===null||s===void 0?void 0:s.keyFormat)==="identity"&&!((o=le.decryptdata)!==null&&o!==void 0&&o.key)?this.loadKey(le,Z):this.loadFragment(le,Z,Ce)},d.getMaxBufferLength=function(){var s=u.prototype.getMaxBufferLength.call(this),o=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,L.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 b=o.audioTracks;this.resetTransmuxer(),this.levels=b.map(function(g){return new O.Level(g)})},d.onAudioTrackSwitching=function(s,o){var b=!!o.url;this.trackId=o.id;var g=this.fragCurrent;g!=null&&g.loader&&g.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),b?this.setInterval(v):this.resetTransmuxer(),b?(this.audioSwitch=!0,this.state=U.State.IDLE):this.state=U.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 b,g=this.levels,_=o.details,k=o.id;if(!g){this.warn("Audio tracks were reset while loading level "+k);return}this.log("Track "+k+" loaded ["+_.startSN+","+_.endSN+"],duration:"+_.totalduration);var H=g[k],z=0;if(_.live||(b=H.details)!==null&&b!==void 0&&b.live){var Z=this.mainDetails;if(_.fragments[0]||(_.deltaUpdateFailed=!0),_.deltaUpdateFailed||!Z)return;!H.details&&_.hasProgramDateTime&&Z.hasProgramDateTime?(Object(x.alignMediaPlaylistByPDT)(_,Z),z=_.fragments[0].start):z=this.alignPlaylists(_,H.details)}H.details=_,this.levelLastLoaded=k,!this.startFragRequested&&(this.mainDetails||!_.live)&&this.setStartPosition(H.details,z),this.state===U.State.WAITING_TRACK&&!this.waitForCdnTuneIn(_)&&(this.state=U.State.IDLE),this.tick()},d._handleFragmentLoadProgress=function(s){var o,b=s.frag,g=s.part,_=s.payload,k=this.config,H=this.trackId,z=this.levels;if(!z){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+b.sn+" of level "+b.level+" will not be buffered");return}var Z=z[H];console.assert(Z,"Audio track is defined on fragment load progress");var G=Z.details;console.assert(G,"Audio track details are defined on fragment load progress");var B=k.defaultAudioCodec||Z.audioCodec||"mp4a.40.2",te=this.transmuxer;te||(te=this.transmuxer=new P.default(this.hls,L.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var de=this.initPTS[b.cc],pe=(o=b.initSegment)===null||o===void 0?void 0:o.data;if(de!==void 0){var ye=!1,Ce=g?g.index:-1,_e=Ce!==-1,le=new w.ChunkMetadata(b.level,b.sn,b.stats.chunkCount,_.byteLength,Ce,_e);te.push(_,pe,B,"",b,g,G.totalduration,ye,le,de)}else{l.logger.log("Unknown video PTS for cc "+b.cc+", waiting for video PTS before demuxing audio frag "+b.sn+" of ["+G.startSN+" ,"+G.endSN+"],track "+H);var se=this.waitingData=this.waitingData||{frag:b,part:g,cache:new A.default,complete:!1},ve=se.cache;ve.push(new Uint8Array(_)),this.waitingVideoCC=this.videoTrackCC,this.state=U.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 b=o.tracks.audio;b&&(this.mediaBuffer=b.buffer),o.tracks.video&&(this.videoBuffer=o.tracks.video.buffer)},d.onFragBuffered=function(s,o){var b=o.frag,g=o.part;if(b.type!==L.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(b)){this.warn("Fragment "+b.sn+(g?" p: "+g.index:"")+" of level "+b.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}b.sn!=="initSegment"&&(this.fragPrevious=b,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(N.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(b,g)},d.onError=function(s,o){switch(o.details){case h.ErrorDetails.FRAG_LOAD_ERROR:case h.ErrorDetails.FRAG_LOAD_TIMEOUT:case h.ErrorDetails.KEY_LOAD_ERROR:case h.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(L.PlaylistLevelType.AUDIO,o);break;case h.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case h.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==U.State.ERROR&&this.state!==U.State.STOPPED&&(this.state=o.fatal?U.State.ERROR:U.State.IDLE,this.warn(o.details+" while loading frag, switching to "+this.state+" state"));break;case h.ErrorDetails.BUFFER_FULL_ERROR:if(o.parent==="audio"&&(this.state===U.State.PARSING||this.state===U.State.PARSED)){var b=!0,g=this.getFwdBufferInfo(this.mediaBuffer,L.PlaylistLevelType.AUDIO);g&&g.len>.5&&(b=!this.reduceMaxBufferLength(g.len)),b&&(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 b=o.type;b===T.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},d._handleTransmuxComplete=function(s){var o,b="audio",g=this.hls,_=s.remuxResult,k=s.chunkMeta,H=this.getCurrentContext(k);if(!H){this.warn("The loading context changed while buffering fragment "+k.sn+" of level "+k.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(k.level);return}var z=H.frag,Z=H.part,G=_.audio,B=_.text,te=_.id3,de=_.initSegment;if(this.fragContextChanged(z))return;if(this.state=U.State.PARSING,this.audioSwitch&&G&&this.completeAudioSwitch(),de!=null&&de.tracks&&(this._bufferInitSegment(de.tracks,z,k),g.trigger(N.Events.FRAG_PARSING_INIT_SEGMENT,{frag:z,id:b,tracks:de.tracks})),G){var pe=G.startPTS,ye=G.endPTS,Ce=G.startDTS,_e=G.endDTS;Z&&(Z.elementaryStreams[T.ElementaryStreamTypes.AUDIO]={startPTS:pe,endPTS:ye,startDTS:Ce,endDTS:_e}),z.setElementaryStreamInfo(T.ElementaryStreamTypes.AUDIO,pe,ye,Ce,_e),this.bufferFragmentData(G,z,Z,k)}if(te!=null&&(o=te.samples)!==null&&o!==void 0&&o.length){var le=i({frag:z,id:b},te);g.trigger(N.Events.FRAG_PARSING_METADATA,le)}if(B){var se=i({frag:z,id:b},B);g.trigger(N.Events.FRAG_PARSING_USERDATA,se)}},d._bufferInitSegment=function(s,o,b){if(this.state!==U.State.PARSING)return;s.video&&delete s.video;var g=s.audio;if(!g)return;g.levelCodec=g.codec,g.id="audio",this.log("Init audio buffer, container:"+g.container+", codecs[parsed]=["+g.codec+"]"),this.hls.trigger(N.Events.BUFFER_CODECS,s);var _=g.initSegment;if(_!=null&&_.byteLength){var k={type:"audio",frag:o,part:null,chunkMeta:b,parent:o.type,data:_};this.hls.trigger(N.Events.BUFFER_APPENDING,k)}this.tick()},d.loadFragment=function(s,o,b){var g=this.fragmentTracker.getState(s);this.fragCurrent=s,(this.audioSwitch||g===I.FragmentState.NOT_LOADED||g===I.FragmentState.PARTIAL)&&(s.sn==="initSegment"?this._loadInitSegment(s):o.live&&!Object(Y.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=U.State.WAITING_INIT_PTS):(this.startFragRequested=!0,u.prototype.loadFragment.call(this,s,o,b)))},d.completeAudioSwitch=function(){var s=this.hls,o=this.media,b=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(N.Events.AUDIO_TRACK_SWITCHED,{id:b})},E}(U.default);$.default=m},"./src/controller/audio-track-controller.ts":function(oe,$,D){"use strict";D.r($);var Y=D("./src/events.ts"),U=D("./src/errors.ts"),N=D("./src/controller/base-playlist-controller.ts"),K=D("./src/types/loader.ts");function I(P,w){for(var S=0;S=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 "+h);var c=l[h],C=c.id,v=c.groupId,m=v===void 0?"":v,u=c.name,E=c.type,d=c.url;if(this.trackId=h,this.trackName=u,this.selectDefaultTrack=!1,this.hls.trigger(Y.Events.AUDIO_TRACK_SWITCHING,{id:C,groupId:m,name:u,type:E,url:d}),c.details&&!c.details.live)return;var f=this.switchParams(c.url,i==null?void 0:i.details);this.loadPlaylist(f)},S.selectInitialTrack=function(){var h=this.tracksInGroup;console.assert(h.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(Y.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},S.findTrackId=function(h){for(var l=this.tracksInGroup,i=0;iw.partTarget&&(c+=1)}if(Object(Y.isFiniteNumber)(i))return new U.HlsUrlParameters(i,Object(Y.isFiniteNumber)(c)?c:void 0,U.HlsSkip.No)}}},T.loadPlaylist=function(P){},T.shouldLoadTrack=function(P){return this.canLoad&&P&&!!P.url&&(!P.details||P.details.live)},T.playlistLoaded=function(P,w,S){var x=this,h=w.details,l=w.stats,i=l.loading.end?Math.max(0,self.performance.now()-l.loading.end):0;if(h.advancedDateTime=Date.now()-i,h.live||S!=null&&S.live){if(h.reloaded(S),S&&this.log("live playlist "+P+" "+(h.advanced?"REFRESHED "+h.lastPartSn+"-"+h.lastPartIndex:"MISSED")),S&&h.fragments.length>0&&Object(N.mergeDetails)(S,h),!this.canLoad||!h.live)return;var c,C=void 0,v=void 0;if(h.canBlockReload&&h.endSN&&h.advanced){var m=this.hls.config.lowLatencyMode,u=h.lastPartSn,E=h.endSN,d=h.lastPartIndex,f=d!==-1,s=u===E,o=m?0:d;f?(C=s?E+1:u,v=s?o:d+1):C=E+1;var b=h.age,g=b+h.ageHeader,_=Math.min(g-h.partTarget,h.targetduration*1.5);if(_>0){if(S&&_>S.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+S.tuneInGoal+" to: "+_+" with playlist age: "+h.age),_=0;else{var k=Math.floor(_/h.targetduration);if(C+=k,v!==void 0){var H=Math.round(_%h.targetduration/h.partTarget);v+=H}this.log("CDN Tune-in age: "+h.ageHeader+"s last advanced "+b.toFixed(2)+"s goal: "+_+" skip sn "+k+" to part "+v)}h.tuneInGoal=_}if(c=this.getDeliveryDirectives(h,w.deliveryDirectives,C,v),m||!s){this.loadPlaylist(c);return}}else c=this.getDeliveryDirectives(h,w.deliveryDirectives,C,v);var z=Object(N.computeReloadInterval)(h,l);C!==void 0&&h.canBlockReload&&(z-=h.partTarget||1),this.log("reload live playlist "+P+" in "+Math.round(z)+" ms"),this.timer=self.setTimeout(function(){return x.loadPlaylist(c)},z)}else this.clearTimer()},T.getDeliveryDirectives=function(P,w,S,x){var h=Object(U.getSkipValue)(P,S);return w!=null&&w.skip&&P.deltaUpdateFailed&&(S=w.msn,x=w.part,h=U.HlsSkip.No),new U.HlsUrlParameters(S,x,h)},T.retryLoadingOrFail=function(P){var w=this,S=this.hls.config,x=this.retryCount-1&&(h=P.context)!==null&&h!==void 0&&h.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+P.details+'"'),this.loadPlaylist();else{var l=Math.min(Math.pow(2,this.retryCount)*S.levelLoadingRetryDelay,S.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return w.loadPlaylist()},l),this.warn("retry playlist loading #"+this.retryCount+" in "+l+' ms after "'+P.details+'"')}}else this.warn('cannot recover from error "'+P.details+'"'),this.clearTimer(),P.fatal=!0;return x},L}()},"./src/controller/base-stream-controller.ts":function(oe,$,D){"use strict";D.r($),D.d($,"State",function(){return E}),D.d($,"default",function(){return d});var Y=D("./src/polyfills/number.ts"),U=D("./src/task-loop.ts"),N=D("./src/controller/fragment-tracker.ts"),K=D("./src/utils/buffer-helper.ts"),I=D("./src/utils/logger.ts"),O=D("./src/events.ts"),L=D("./src/errors.ts"),T=D("./src/types/transmuxer.ts"),A=D("./src/utils/mp4-tools.ts"),P=D("./src/utils/discontinuities.ts"),w=D("./src/controller/fragment-finders.ts"),S=D("./src/controller/level-helper.ts"),x=D("./src/loader/fragment-loader.ts"),h=D("./src/crypt/decrypter.ts"),l=D("./src/utils/time-ranges.ts"),i=D("./src/types/loader.ts");function c(f,s){for(var o=0;ode;(Z0&&Z&&Z.key&&Z.iv&&Z.method==="AES-128"){var G=self.performance.now();return _.decrypter.webCryptoDecrypt(new Uint8Array(z),Z.key.buffer,Z.iv.buffer).then(function(B){var te=self.performance.now();return H.trigger(O.Events.FRAG_DECRYPTED,{frag:g,payload:B,stats:{tstart:G,tdecrypt:te}}),k.payload=B,k})}return k}).then(function(k){var H=_.fragCurrent,z=_.hls,Z=_.levels;if(!Z)throw new Error("init load aborted, missing levels");var G=Z[g.level].details;console.assert(G,"Level details are defined when init segment is loaded");var B=g.stats;_.state=E.IDLE,_.fragLoadError=0,g.data=new Uint8Array(k.payload),B.parsing.start=B.buffering.start=self.performance.now(),B.parsing.end=B.buffering.end=self.performance.now(),k.frag===H&&z.trigger(O.Events.FRAG_BUFFERED,{stats:B,frag:H,part:null,id:g.type}),_.tick()}).catch(function(k){_.warn(k),_.resetFragmentLoading(g)})},o.fragContextChanged=function(g){var _=this.fragCurrent;return!g||!_||g.level!==_.level||g.sn!==_.sn||g.urlId!==_.urlId},o.fragBufferedComplete=function(g,_){var k=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+g.type+" sn: "+g.sn+(_?" part: "+_.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+g.level+" "+l.default.toString(K.BufferHelper.getBuffered(k))),this.state=E.IDLE,this.tick()},o._handleFragmentLoadComplete=function(g){var _=this.transmuxer;if(!_)return;var k=g.frag,H=g.part,z=g.partsLoaded,Z=!z||z.length===0||z.some(function(B){return!B}),G=new T.ChunkMetadata(k.level,k.sn,k.stats.chunkCount+1,0,H?H.index:-1,!Z);_.flush(G)},o._handleFragmentLoadProgress=function(g){},o._doFragLoad=function(g,_,k,H){var z=this;if(k===void 0&&(k=null),!this.levels)throw new Error("frag load aborted, missing levels");if(k=Math.max(g.start,k||0),this.config.lowLatencyMode&&_){var Z=_.partList;if(Z&&H){k>g.end&&_.fragmentHint&&(g=_.fragmentHint);var G=this.getNextPart(Z,g,k);if(G>-1){var B=Z[G];return this.log("Loading part sn: "+g.sn+" p: "+B.index+" cc: "+g.cc+" of playlist ["+_.startSN+"-"+_.endSN+"] parts [0-"+G+"-"+(Z.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+g.level+", target: "+parseFloat(k.toFixed(3))),this.nextLoadPosition=B.start+B.duration,this.state=E.FRAG_LOADING,this.hls.trigger(O.Events.FRAG_LOADING,{frag:g,part:Z[G],targetBufferTime:k}),this.doFragPartsLoad(g,Z,G,H).catch(function(te){return z.handleFragLoadError(te)})}else if(!g.url||this.loadedEndOfParts(Z,k))return Promise.resolve(null)}}return this.log("Loading fragment "+g.sn+" cc: "+g.cc+" "+(_?"of ["+_.startSN+"-"+_.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+g.level+", target: "+parseFloat(k.toFixed(3))),Object(Y.isFiniteNumber)(g.sn)&&!this.bitrateTest&&(this.nextLoadPosition=g.start+g.duration),this.state=E.FRAG_LOADING,this.hls.trigger(O.Events.FRAG_LOADING,{frag:g,targetBufferTime:k}),this.fragmentLoader.load(g,H).catch(function(te){return z.handleFragLoadError(te)})},o.doFragPartsLoad=function(g,_,k,H){var z=this;return new Promise(function(Z,G){var B=[],te=function de(pe){var ye=_[pe];z.fragmentLoader.loadPart(g,ye,H).then(function(Ce){B[ye.index]=Ce;var _e=Ce.part;z.hls.trigger(O.Events.FRAG_LOADED,Ce);var le=_[pe+1];if(le&&le.fragment===g)de(pe+1);else return Z({frag:g,part:_e,partsLoaded:B})}).catch(G)};te(k)})},o.handleFragLoadError=function(g){var _=g.data;return _&&_.details===L.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(_.frag,_.part):this.hls.trigger(O.Events.ERROR,_),null},o._handleTransmuxerFlush=function(g){var _=this.getCurrentContext(g);if(!_||this.state!==E.PARSING){this.fragCurrent||(this.state=E.IDLE);return}var k=_.frag,H=_.part,z=_.level,Z=self.performance.now();k.stats.parsing.end=Z,H&&(H.stats.parsing.end=Z),this.updateLevelTiming(k,H,z,g.partial)},o.getCurrentContext=function(g){var _=this.levels,k=g.level,H=g.sn,z=g.part;if(!_||!_[k])return this.warn("Levels object was unset while buffering fragment "+H+" of level "+k+". The current chunk will not be buffered."),null;var Z=_[k],G=z>-1?Object(S.getPartWith)(Z,H,z):null,B=G?G.fragment:Object(S.getFragmentWithSN)(Z,H,this.fragCurrent);return B?{frag:B,part:G,level:Z}:null},o.bufferFragmentData=function(g,_,k,H){if(!g||this.state!==E.PARSING)return;var z=g.data1,Z=g.data2,G=z;if(z&&Z&&(G=Object(A.appendUint8Array)(z,Z)),!G||!G.length)return;var B={type:g.type,frag:_,part:k,chunkMeta:H,parent:_.type,data:G};this.hls.trigger(O.Events.BUFFER_APPENDING,B),g.dropped&&g.independent&&!k&&this.flushBufferGap(_)},o.flushBufferGap=function(g){var _=this.media;if(!_)return;if(!K.BufferHelper.isBuffered(_,_.currentTime)){this.flushMainBuffer(0,g.start);return}var k=_.currentTime,H=K.BufferHelper.bufferInfo(_,k,0),z=g.duration,Z=Math.min(this.config.maxFragLookUpTolerance*2,z*.25),G=Math.max(Math.min(g.start-Z,H.end-Z),k+Z);g.start-G>Z&&this.flushMainBuffer(G,g.start)},o.getFwdBufferInfo=function(g,_){var k=this.config,H=this.getLoadPosition();if(!Object(Y.isFiniteNumber)(H))return null;var z=K.BufferHelper.bufferInfo(g,H,k.maxBufferHole);if(z.len===0&&z.nextStart!==void 0){var Z=this.fragmentTracker.getBufferedFrag(H,_);if(Z&&z.nextStart=k?(_.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+_.maxMaxBufferLength+"s"),!0):!1},o.getNextFragment=function(g,_){var k,H,z=_.fragments,Z=z.length;if(!Z)return null;var G=this.config,B=z[0].start,te;if(_.live){var de=G.initialLiveManifestSize;if(Z-1&&kk.start&&k.loaded},o.getInitialLiveFragment=function(g,_){var k=this.fragPrevious,H=null;if(k){if(g.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+k.programDateTime),H=Object(w.findFragmentByPDT)(_,k.endProgramDateTime,this.config.maxFragLookUpTolerance)),!H){var z=k.sn+1;if(z>=g.startSN&&z<=g.endSN){var Z=_[z-g.startSN];k.cc===Z.cc&&(H=Z,this.log("Live playlist, switching playlist, load frag with next SN: "+H.sn))}H||(H=Object(w.findFragWithCC)(_,k.cc),H&&this.log("Live playlist, switching playlist, load frag with same CC: "+H.sn))}}else{var G=this.hls.liveSyncPosition;G!==null&&(H=this.getFragmentAtPosition(G,this.bitrateTest?g.fragmentEnd:g.edge,g))}return H},o.getFragmentAtPosition=function(g,_,k){var H=this.config,z=this.fragPrevious,Z=k.fragments,G=k.endSN,B=k.fragmentHint,te=H.maxFragLookUpTolerance,de=!!(H.lowLatencyMode&&k.partList&&B);de&&B&&!this.bitrateTest&&(Z=Z.concat(B),G=B.sn);var pe;if(g<_){var ye=g>_-te?0:te;pe=Object(w.findFragmentByPTS)(z,Z,g,ye)}else pe=Z[Z.length-1];if(pe){var Ce=pe.sn-k.startSN,_e=z&&pe.level===z.level,le=Z[Ce+1],se=this.fragmentTracker.getState(pe);if(se===N.FragmentState.BACKTRACKED){pe=null;for(var ve=Ce;Z[ve]&&this.fragmentTracker.getState(Z[ve])===N.FragmentState.BACKTRACKED;)z?pe=Z[ve--]:pe=Z[--ve];pe||(pe=le)}else z&&pe.sn===z.sn&&!de&&(_e&&(pe.sn=Z-_.maxFragLookUpTolerance&&z<=G;if(H!==null&&k.duration>H&&(z"+g.startSN+" prev-sn: "+(z?z.sn:"na")+" fragments: "+G),pe}return B},o.waitForCdnTuneIn=function(g){var _=3;return g.live&&g.canBlockReload&&g.tuneInGoal>Math.max(g.partHoldBack,g.partTarget*_)},o.setStartPosition=function(g,_){var k=this.startPosition;if(k<_&&(k=-1),k===-1||this.lastCurrentTime===-1){var H=g.startTimeOffset;Object(Y.isFiniteNumber)(H)?(k=_+H,H<0&&(k+=g.totalduration),k=Math.min(Math.max(_,k),_+g.totalduration),this.log("Start time offset "+H+" found in playlist, adjust startPosition to "+k),this.startPosition=k):g.live?k=this.hls.liveSyncPosition||_:this.startPosition=k=0,this.lastCurrentTime=k}this.nextLoadPosition=k},o.getLoadPosition=function(){var g=this.media,_=0;return this.loadedmetadata&&g?_=g.currentTime:this.nextLoadPosition&&(_=this.nextLoadPosition),_},o.handleFragLoadAborted=function(g,_){this.transmuxer&&g.sn!=="initSegment"&&g.stats.aborted&&(this.warn("Fragment "+g.sn+(_?" part"+_.index:"")+" of level "+g.level+" was aborted"),this.resetFragmentLoading(g))},o.resetFragmentLoading=function(g){(!this.fragCurrent||!this.fragContextChanged(g))&&(this.state=E.IDLE)},o.onFragmentOrKeyLoadError=function(g,_){if(_.fatal)return;var k=_.frag;if(!k||k.type!==g)return;var H=this.fragCurrent;console.assert(H&&k.sn===H.sn&&k.level===H.level&&k.urlId===H.urlId,"Frag load error must match current frag to retry");var z=this.config;if(this.fragLoadError+1<=z.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(k.level))return;var Z=Math.min(Math.pow(2,this.fragLoadError)*z.fragLoadingRetryDelay,z.fragLoadingMaxRetryTimeout);this.warn("Fragment "+k.sn+" of "+g+" "+k.level+" failed to load, retrying in "+Z+"ms"),this.retryDate=self.performance.now()+Z,this.fragLoadError++,this.state=E.FRAG_LOADING_WAITING_RETRY}else _.levelRetry?(g===i.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=E.IDLE):(I.logger.error(_.details+" reaches max retry, redispatch as fatal ..."),_.fatal=!0,this.hls.stopLoad(),this.state=E.ERROR)},o.afterBufferFlushed=function(g,_,k){if(!g)return;var H=K.BufferHelper.getBuffered(g);this.fragmentTracker.detectEvictedFragments(_,H,k),this.state===E.ENDED&&this.resetLoadingState()},o.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=E.IDLE},o.resetLiveStartWhenNotLoaded=function(g){if(!this.loadedmetadata){this.startFragRequested=!1;var _=this.levels?this.levels[g].details:null;if(_!=null&&_.live)return this.startPosition=-1,this.setStartPosition(_,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},o.updateLevelTiming=function(g,_,k,H){var z=this,Z=k.details;console.assert(!!Z,"level.details must be defined");var G=Object.keys(g.elementaryStreams).reduce(function(B,te){var de=g.elementaryStreams[te];if(de){var pe=de.endPTS-de.startPTS;if(pe<=0)return z.warn("Could not parse fragment "+g.sn+" "+te+" duration reliably ("+pe+") resetting transmuxer to fallback to playlist timing"),z.resetTransmuxer(),B||!1;var ye=H?0:Object(S.updateFragPTSDTS)(Z,g,de.startPTS,de.endPTS,de.startDTS,de.endDTS);return z.hls.trigger(O.Events.LEVEL_PTS_UPDATED,{details:Z,level:k,drift:ye,type:te,frag:g,start:de.startPTS,end:de.endPTS}),!0}return B},!1);G?(this.state=E.PARSED,this.hls.trigger(O.Events.FRAG_PARSED,{frag:g,part:_})):this.resetLoadingState()},o.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},C(s,[{key:"state",get:function(){return this._state},set:function(g){var _=this._state;_!==g&&(this._state=g,this.log(_+"->"+g))}}]),s}(U.default)},"./src/controller/buffer-controller.ts":function(oe,$,D){"use strict";D.r($),D.d($,"default",function(){return w});var Y=D("./src/polyfills/number.ts"),U=D("./src/events.ts"),N=D("./src/utils/logger.ts"),K=D("./src/errors.ts"),I=D("./src/utils/buffer-helper.ts"),O=D("./src/utils/mediasource-helper.ts"),L=D("./src/loader/fragment.ts"),T=D("./src/controller/buffer-operation-queue.ts"),A=Object(O.getMediaSource)(),P=/([ha]vc.)(?:\.[^.,]+)+/,w=function(){function S(h){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,C=l.mediaSource;N.logger.log("[buffer-controller]: Media source opened"),c&&(l.updateMediaElementDuration(),i.trigger(U.Events.MEDIA_ATTACHED,{media:c})),C&&C.removeEventListener("sourceopen",l._onMediaSourceOpen),l.checkPendingTracks()},this._onMediaSourceClose=function(){N.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){N.logger.log("[buffer-controller]: Media source ended")},this.hls=h,this._initSourceBuffer(),this.registerListeners()}var x=S.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(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),l.on(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.on(U.Events.MANIFEST_PARSED,this.onManifestParsed,this),l.on(U.Events.BUFFER_RESET,this.onBufferReset,this),l.on(U.Events.BUFFER_APPENDING,this.onBufferAppending,this),l.on(U.Events.BUFFER_CODECS,this.onBufferCodecs,this),l.on(U.Events.BUFFER_EOS,this.onBufferEos,this),l.on(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),l.on(U.Events.LEVEL_UPDATED,this.onLevelUpdated,this),l.on(U.Events.FRAG_PARSED,this.onFragParsed,this),l.on(U.Events.FRAG_CHANGED,this.onFragChanged,this)},x.unregisterListeners=function(){var l=this.hls;l.off(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),l.off(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.off(U.Events.MANIFEST_PARSED,this.onManifestParsed,this),l.off(U.Events.BUFFER_RESET,this.onBufferReset,this),l.off(U.Events.BUFFER_APPENDING,this.onBufferAppending,this),l.off(U.Events.BUFFER_CODECS,this.onBufferCodecs,this),l.off(U.Events.BUFFER_EOS,this.onBufferEos,this),l.off(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),l.off(U.Events.LEVEL_UPDATED,this.onLevelUpdated,this),l.off(U.Events.FRAG_PARSED,this.onFragParsed,this),l.off(U.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,N.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},x.onMediaAttaching=function(l,i){var c=this.media=i.media;if(c&&A){var C=this.mediaSource=new A;C.addEventListener("sourceopen",this._onMediaSourceOpen),C.addEventListener("sourceended",this._onMediaSourceEnded),C.addEventListener("sourceclose",this._onMediaSourceClose),c.src=self.URL.createObjectURL(C),this._objectUrl=c.src}},x.onMediaDetaching=function(){var l=this.media,i=this.mediaSource,c=this._objectUrl;if(i){if(N.logger.log("[buffer-controller]: media source detaching"),i.readyState==="open")try{i.endOfStream()}catch(C){N.logger.warn("[buffer-controller]: onMediaDetaching: "+C.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()):N.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(U.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(C){N.logger.warn("[buffer-controller]: Failed to reset the "+i+" buffer",C)}}),this._initSourceBuffer()},x.onBufferCodecs=function(l,i){var c=this,C=this.getSourceBufferTypes().length;if(Object.keys(i).forEach(function(v){if(C){var m=c.tracks[v];if(m&&typeof m.buffer.changeType=="function"){var u=i[v],E=u.codec,d=u.levelCodec,f=u.container,s=(m.levelCodec||m.codec).replace(P,"$1"),o=(d||E).replace(P,"$1");if(s!==o){var b=f+";codecs="+(d||E);c.appendChangeType(v,b)}}}else c.pendingTracks[v]=i[v]}),C)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,C=this.operationQueue,v={execute:function(){var u=c.sourceBuffer[l];u&&(N.logger.log("[buffer-controller]: changing "+l+" sourceBuffer type to "+i),u.changeType(i)),C.shiftAndExecuteNext(l)},onStart:function(){},onComplete:function(){},onError:function(u){N.logger.warn("[buffer-controller]: Failed to change "+l+" SourceBuffer type",u)}};C.append(v,l)},x.onBufferAppending=function(l,i){var c=this,C=this.hls,v=this.operationQueue,m=this.tracks,u=i.data,E=i.type,d=i.frag,f=i.part,s=i.chunkMeta,o=s.buffering[E],b=self.performance.now();o.start=b;var g=d.stats.buffering,_=f?f.stats.buffering:null;g.start===0&&(g.start=b),_&&_.start===0&&(_.start=b);var k=m.audio,H=E==="audio"&&s.id===1&&(k==null?void 0:k.container)==="audio/mpeg",z={execute:function(){if(o.executeStart=self.performance.now(),H){var G=c.sourceBuffer[E];if(G){var B=d.start-G.timestampOffset;Math.abs(B)>=.1&&(N.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+d.start+" (delta: "+B+") sn: "+d.sn+")"),G.timestampOffset=d.start)}}c.appendExecutor(u,E)},onStart:function(){},onComplete:function(){var G=self.performance.now();o.executeEnd=o.end=G,g.first===0&&(g.first=G),_&&_.first===0&&(_.first=G);var B=c.sourceBuffer,te={};for(var de in B)te[de]=I.BufferHelper.getBuffered(B[de]);c.appendError=0,c.hls.trigger(U.Events.BUFFER_APPENDED,{type:E,frag:d,part:f,chunkMeta:s,parent:d.type,timeRanges:te})},onError:function(G){N.logger.error("[buffer-controller]: Error encountered while trying to append to the "+E+" SourceBuffer",G);var B={type:K.ErrorTypes.MEDIA_ERROR,parent:d.type,details:K.ErrorDetails.BUFFER_APPEND_ERROR,err:G,fatal:!1};G.code===DOMException.QUOTA_EXCEEDED_ERR?B.details=K.ErrorDetails.BUFFER_FULL_ERROR:(c.appendError++,B.details=K.ErrorDetails.BUFFER_APPEND_ERROR,c.appendError>C.config.appendErrorMaxRetry&&(N.logger.error("[buffer-controller]: Failed "+C.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),B.fatal=!0)),C.trigger(U.Events.ERROR,B)}};v.append(z,E)},x.onBufferFlushing=function(l,i){var c=this,C=this.operationQueue,v=function(u){return{execute:c.removeExecutor.bind(c,u,i.startOffset,i.endOffset),onStart:function(){},onComplete:function(){c.hls.trigger(U.Events.BUFFER_FLUSHED,{type:u})},onError:function(d){N.logger.warn("[buffer-controller]: Failed to remove from "+u+" SourceBuffer",d)}}};i.type?C.append(v(i.type),i.type):this.getSourceBufferTypes().forEach(function(m){C.append(v(m),m)})},x.onFragParsed=function(l,i){var c=this,C=i.frag,v=i.part,m=[],u=v?v.elementaryStreams:C.elementaryStreams;u[L.ElementaryStreamTypes.AUDIOVIDEO]?m.push("audiovideo"):(u[L.ElementaryStreamTypes.AUDIO]&&m.push("audio"),u[L.ElementaryStreamTypes.VIDEO]&&m.push("video"));var E=function(){var f=self.performance.now();C.stats.buffering.end=f,v&&(v.stats.buffering.end=f);var s=v?v.stats:C.stats;c.hls.trigger(U.Events.FRAG_BUFFERED,{frag:C,part:v,stats:s,id:C.type})};m.length===0&&N.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+C.type+" level: "+C.level+" sn: "+C.sn),this.blockBuffers(E,m)},x.onFragChanged=function(l,i){this.flushBackBuffer()},x.onBufferEos=function(l,i){var c=this,C=this.getSourceBufferTypes().reduce(function(v,m){var u=c.sourceBuffer[m];return(!i.type||i.type===m)&&(u&&!u.ended&&(u.ended=!0,N.logger.log("[buffer-controller]: "+m+" sourceBuffer now EOS"))),v&&!!(!u||u.ended)},!0);C&&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,C=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(Y.isFiniteNumber)(m)||m<0)return;var u=c.currentTime,E=i.levelTargetDuration,d=Math.max(m,E),f=Math.floor(u/E)*E-d;v.forEach(function(s){var o=C[s];if(o){var b=I.BufferHelper.getBuffered(o);b.length>0&&f>b.start(0)&&(l.trigger(U.Events.BACK_BUFFER_REACHED,{bufferEnd:f}),i.live&&l.trigger(U.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:f}),l.trigger(U.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:f,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,C=this.mediaSource,v=l.fragments[0].start+l.totalduration,m=c.duration,u=Object(Y.isFiniteNumber)(C.duration)?C.duration:0;l.live&&i.config.liveDurationInfinity?(N.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),C.duration=Infinity,this.updateSeekableRange(l)):(v>u&&v>m||!Object(Y.isFiniteNumber)(m))&&(N.logger.log("[buffer-controller]: Updating Media Source duration to "+v.toFixed(3)),C.duration=v)},x.updateSeekableRange=function(l){var i=this.mediaSource,c=l.fragments,C=c.length;if(C&&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,C=Object.keys(c).length;if(C&&!l||C===2){this.createSourceBuffers(c),this.pendingTracks={};var v=this.getSourceBufferTypes();if(v.length===0){this.hls.trigger(U.Events.ERROR,{type:K.ErrorTypes.MEDIA_ERROR,details:K.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 C=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,E=m.container+";codecs="+u;N.logger.log("[buffer-controller]: creating sourceBuffer("+E+")");try{var d=i[v]=c.addSourceBuffer(E),f=v;this.addBufferListener(f,"updatestart",this._onSBUpdateStart),this.addBufferListener(f,"updateend",this._onSBUpdateEnd),this.addBufferListener(f,"error",this._onSBUpdateError),this.tracks[v]={buffer:d,codec:u,container:m.container,levelCodec:m.levelCodec,id:m.id},C++}catch(s){N.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+s.message),this.hls.trigger(U.Events.ERROR,{type:K.ErrorTypes.MEDIA_ERROR,details:K.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:s,mimeType:E})}}C&&this.hls.trigger(U.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){N.logger.error("[buffer-controller]: "+l+" SourceBuffer error",i),this.hls.trigger(U.Events.ERROR,{type:K.ErrorTypes.MEDIA_ERROR,details:K.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var c=this.operationQueue.current(l);c&&c.onError(i)},x.removeExecutor=function(l,i,c){var C=this.media,v=this.mediaSource,m=this.operationQueue,u=this.sourceBuffer,E=u[l];if(!C||!v||!E){N.logger.warn("[buffer-controller]: Attempting to remove from the "+l+" SourceBuffer, but it does not exist"),m.shiftAndExecuteNext(l);return}var d=Object(Y.isFiniteNumber)(C.duration)?C.duration:Infinity,f=Object(Y.isFiniteNumber)(v.duration)?v.duration:Infinity,s=Math.max(0,i),o=Math.min(c,d,f);o>s?(N.logger.log("[buffer-controller]: Removing ["+s+","+o+"] from the "+l+" SourceBuffer"),console.assert(!E.updating,l+" sourceBuffer must not be updating"),E.remove(s,o)):m.shiftAndExecuteNext(l)},x.appendExecutor=function(l,i){var c=this.operationQueue,C=this.sourceBuffer,v=C[i];if(!v){N.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){N.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(l);return}var C=this.operationQueue,v=i.map(function(m){return C.appendBlocker(m)});Promise.all(v).then(function(){l(),i.forEach(function(m){var u=c.sourceBuffer[m];(!u||!u.updating)&&C.shiftAndExecuteNext(m)})})},x.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},x.addBufferListener=function(l,i,c){var C=this.sourceBuffer[l];if(!C)return;var v=c.bind(this,l);this.listeners[l].push({event:i,listener:v}),C.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)})},S}()},"./src/controller/buffer-operation-queue.ts":function(oe,$,D){"use strict";D.r($),D.d($,"default",function(){return U});var Y=D("./src/utils/logger.ts"),U=function(){function N(I){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=I}var K=N.prototype;return K.append=function(O,L){var T=this.queues[L];T.push(O),T.length===1&&this.buffers[L]&&this.executeNext(L)},K.insertAbort=function(O,L){var T=this.queues[L];T.unshift(O),this.executeNext(L)},K.appendBlocker=function(O){var L,T=new Promise(function(P){L=P}),A={execute:L,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(A,O),T},K.executeNext=function(O){var L=this.buffers,T=this.queues,A=L[O],P=T[O];if(P.length){var w=P[0];try{w.execute()}catch(S){Y.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),w.onError(S),(!A||!A.updating)&&(P.shift(),this.executeNext(O))}}},K.shiftAndExecuteNext=function(O){this.queues[O].shift(),this.executeNext(O)},K.current=function(O){return this.queues[O][0]},N}()},"./src/controller/cap-level-controller.ts":function(oe,$,D){"use strict";D.r($);var Y=D("./src/events.ts");function U(I,O){for(var L=0;L0&&this.mediaWidth>0){var T=this.hls.levels;if(T.length){var A=this.hls;A.autoLevelCapping=this.getMaxLevel(T.length-1),A.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=A.autoLevelCapping}}},O.getMaxLevel=function(T){var A=this,P=this.hls.levels;if(!P.length)return-1;var w=P.filter(function(S,x){return I.isLevelAllowed(x,A.restrictedLevels)&&x<=T});return this.clientRect=null,I.getMaxLevelByMediaSize(w,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,A={width:0,height:0};if(T){var P=T.getBoundingClientRect();A.width=P.width,A.height=P.height,!A.width&&!A.height&&(A.width=P.right-P.left||T.width||0,A.height=P.bottom-P.top||T.height||0)}return this.clientRect=A,A},I.isLevelAllowed=function(T,A){return A===void 0&&(A=[]),A.indexOf(T)===-1},I.getMaxLevelByMediaSize=function(T,A,P){if(!T||!T.length)return-1;for(var w=function(i,c){return c?i.width!==c.width||i.height!==c.height:!0},S=T.length-1,x=0;x=A||h.height>=P)&&w(h,T[x+1])){S=x;break}}return S},N(I,[{key:"mediaWidth",get:function(){return this.getDimensions().width*I.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*I.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var T=1;try{T=self.devicePixelRatio}catch(A){}return T}}]),I}();$.default=K},"./src/controller/cmcd-controller.ts":function(oe,$,D){"use strict";D.r($),D.d($,"default",function(){return w});var Y=D("./src/events.ts"),U=D("./src/types/cmcd.ts"),N=D("./src/utils/buffer-helper.ts"),K=D("./src/utils/logger.ts");function I(S,x){for(var h=0;h=S.length?{done:!0}:{done:!1,value:S[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(S,x){if(!S)return;if(typeof S=="string")return A(S,x);var h=Object.prototype.toString.call(S).slice(8,-1);if(h==="Object"&&S.constructor&&(h=S.constructor.name),h==="Map"||h==="Set")return Array.from(S);if(h==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(h))return A(S,x)}function A(S,x){(x==null||x>S.length)&&(x=S.length);for(var h=0,l=new Array(x);hi&&(i=m.bitrate)}return i>0?i:NaN},x.getBufferLength=function(l){var i=this.hls.media,c=l===U.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!c||!i)return NaN;var C=N.BufferHelper.bufferInfo(c,i.currentTime,this.config.maxBufferHole);return C.len*1e3},x.createPlaylistLoader=function(){var l=this.config.pLoader,i=this.applyPlaylistData,c=l||this.config.loader;return function(){function C(m){this.loader=void 0,this.loader=new c(m)}var v=C.prototype;return v.destroy=function(){this.loader.destroy()},v.abort=function(){this.loader.abort()},v.load=function(u,E,d){i(u),this.loader.load(u,E,d)},O(C,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),C}()},x.createFragmentLoader=function(){var l=this.config.fLoader,i=this.applyFragmentData,c=l||this.config.loader;return function(){function C(m){this.loader=void 0,this.loader=new c(m)}var v=C.prototype;return v.destroy=function(){this.loader.destroy()},v.abort=function(){this.loader.abort()},v.load=function(u,E,d){i(u),this.loader.load(u,E,d)},O(C,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),C}()},S.uuid=function(){var l=URL.createObjectURL(new Blob),i=l.toString();return URL.revokeObjectURL(l),i.substr(i.lastIndexOf("/")+1)},S.serialize=function(l){for(var i=[],c=function(H){return!Number.isNaN(H)&&H!=null&&H!==""&&H!==!1},C=function(H){return Math.round(H)},v=function(H){return C(H/100)*100},m=function(H){return encodeURIComponent(H)},u={br:C,d:C,bl:v,dl:v,mtp:v,nor:m,rtp:v,tb:C},E=Object.keys(l||{}).sort(),d=L(E),f;!(f=d()).done;){var s=f.value,o=l[s];if(!c(o))continue;if(s==="v"&&o===1)continue;if(s=="pr"&&o===1)continue;var b=u[s];b&&(o=b(o));var g=typeof o,_=void 0;s==="ot"||s==="sf"||s==="st"?_=s+"="+o:g==="boolean"?_=s:g==="number"?_=s+"="+o:_=s+"="+JSON.stringify(o),i.push(_)}return i.join(",")},S.toHeaders=function(l){for(var i=Object.keys(l),c={},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,E=i;uL){this.hls.trigger(Y.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var m=L-this._requestLicenseFailureCount+1;N.logger.warn("Retrying license request, "+m+" attempts left"),this._requestLicense(i,c)}break}},S._generateLicenseRequestChallenge=function(h,l){switch(h.mediaKeySystemDomain){case K.KeySystems.WIDEVINE:return l}throw new Error("unsupported key-system: "+h.mediaKeySystemDomain)},S._requestLicense=function(h,l){N.logger.log("Requesting content license for key-system");var i=this._mediaKeysList[0];if(!i){N.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(Y.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var c=this.getLicenseServerUrl(i.mediaKeySystemDomain),C=this._createLicenseXhr(c,h,l);N.logger.log("Sending license request to URL: "+c);var v=this._generateLicenseRequestChallenge(i,h);C.send(v)}catch(m){N.logger.error("Failure requesting DRM license: "+m),this.hls.trigger(Y.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},S.onMediaAttached=function(h,l){if(!this._emeEnabled)return;var i=l.media;this._media=i,i.addEventListener("encrypted",this._onMediaEncrypted)},S.onMediaDetached=function(){var h=this._media,l=this._mediaKeysList;if(!h)return;h.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 h.setMediaKeys(null)}).catch(function(){})},S.onManifestParsed=function(h,l){if(!this._emeEnabled)return;var i=l.levels.map(function(C){return C.audioCodec}).filter(function(C){return!!C}),c=l.levels.map(function(C){return C.videoCodec}).filter(function(C){return!!C});this._attemptKeySystemAccess(K.KeySystems.WIDEVINE,i,c)},O(w,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),w}();$.default=P},"./src/controller/fps-controller.ts":function(oe,$,D){"use strict";D.r($);var Y=D("./src/events.ts"),U=D("./src/utils/logger.ts"),N=function(){function K(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 I=K.prototype;return I.setStreamController=function(L){this.streamController=L},I.registerListeners=function(){this.hls.on(Y.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},I.unregisterListeners=function(){this.hls.off(Y.Events.MEDIA_ATTACHING,this.onMediaAttaching)},I.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},I.onMediaAttaching=function(L,T){var A=this.hls.config;if(A.capLevelOnFPSDrop){var P=T.media instanceof self.HTMLVideoElement?T.media:null;this.media=P,P&&typeof P.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),A.fpsDroppedMonitoringPeriod)}},I.checkFPS=function(L,T,A){var P=performance.now();if(T){if(this.lastTime){var w=P-this.lastTime,S=A-this.lastDroppedFrames,x=T-this.lastDecodedFrames,h=1e3*S/w,l=this.hls;if(l.trigger(Y.Events.FPS_DROP,{currentDropped:S,currentDecoded:x,totalDroppedFrames:A}),h>0&&S>l.config.fpsDroppedMonitoringThreshold*x){var i=l.currentLevel;U.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(Y.Events.FPS_DROP_LEVEL_CAPPING,{level:i,droppedLevel:l.currentLevel}),l.autoLevelCapping=i,this.streamController.nextLevelSwitch())}}this.lastTime=P,this.lastDroppedFrames=A,this.lastDecodedFrames=T}},I.checkFPSInterval=function(){var L=this.media;if(L)if(this.isVideoPlaybackQualityAvailable){var T=L.getVideoPlaybackQuality();this.checkFPS(L,T.totalVideoFrames,T.droppedVideoFrames)}else this.checkFPS(L,L.webkitDecodedFrameCount,L.webkitDroppedFrameCount)},K}();$.default=N},"./src/controller/fragment-finders.ts":function(oe,$,D){"use strict";D.r($),D.d($,"findFragmentByPDT",function(){return N}),D.d($,"findFragmentByPTS",function(){return K}),D.d($,"fragmentWithinToleranceTest",function(){return I}),D.d($,"pdtWithinToleranceTest",function(){return O}),D.d($,"findFragWithCC",function(){return L});var Y=D("./src/polyfills/number.ts"),U=D("./src/utils/binary-search.ts");function N(T,A,P){if(A===null||!Array.isArray(T)||!T.length||!Object(Y.isFiniteNumber)(A))return null;var w=T[0].programDateTime;if(A<(w||0))return null;var S=T[T.length-1].endProgramDateTime;if(A>=(S||0))return null;P=P||0;for(var x=0;xT&&P.start?-1:0}function O(T,A,P){var w=Math.min(A,P.duration+(P.deltaPTS?P.deltaPTS:0))*1e3,S=P.endProgramDateTime||0;return S-w>T}function L(T,A){return U.default.search(T,function(P){return P.ccA?-1:0})}},"./src/controller/fragment-tracker.ts":function(oe,$,D){"use strict";D.r($),D.d($,"FragmentState",function(){return N}),D.d($,"FragmentTracker",function(){return K});var Y=D("./src/events.ts"),U=D("./src/types/loader.ts"),N;(function(L){L.NOT_LOADED="NOT_LOADED",L.BACKTRACKED="BACKTRACKED",L.APPENDING="APPENDING",L.PARTIAL="PARTIAL",L.OK="OK"})(N||(N={}));var K=function(){function L(A){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=A,this._registerListeners()}var T=L.prototype;return T._registerListeners=function(){var P=this.hls;P.on(Y.Events.BUFFER_APPENDED,this.onBufferAppended,this),P.on(Y.Events.FRAG_BUFFERED,this.onFragBuffered,this),P.on(Y.Events.FRAG_LOADED,this.onFragLoaded,this)},T._unregisterListeners=function(){var P=this.hls;P.off(Y.Events.BUFFER_APPENDED,this.onBufferAppended,this),P.off(Y.Events.FRAG_BUFFERED,this.onFragBuffered,this),P.off(Y.Events.FRAG_LOADED,this.onFragLoaded,this)},T.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},T.getAppendedFrag=function(P,w){if(w===U.PlaylistLevelType.MAIN){var S=this.activeFragment,x=this.activeParts;if(!S)return null;if(x)for(var h=x.length;h--;){var l=x[h],i=l?l.end:S.appendedPTS;if(l.start<=P&&i!==void 0&&P<=i)return h>9&&(this.activeParts=x.slice(h-9)),l}else if(S.start<=P&&S.appendedPTS!==void 0&&P<=S.appendedPTS)return S}return this.getBufferedFrag(P,w)},T.getBufferedFrag=function(P,w){for(var S=this.fragments,x=Object.keys(S),h=x.length;h--;){var l=S[x[h]];if((l==null?void 0:l.body.type)===w&&l.buffered){var i=l.body;if(i.start<=P&&P<=i.end)return i}}return null},T.detectEvictedFragments=function(P,w,S){var x=this;Object.keys(this.fragments).forEach(function(h){var l=x.fragments[h];if(!l)return;if(!l.buffered){l.body.type===S&&x.removeFragment(l.body);return}var i=l.range[P];if(!i)return;i.time.some(function(c){var C=!x.isTimeBuffered(c.startPTS,c.endPTS,w);return C&&x.removeFragment(l.body),C})})},T.detectPartialFragments=function(P){var w=this,S=this.timeRanges,x=P.frag,h=P.part;if(!S||x.sn==="initSegment")return;var l=O(x),i=this.fragments[l];if(!i)return;Object.keys(S).forEach(function(c){var C=x.elementaryStreams[c];if(!C)return;var v=S[c],m=h!==null||C.partial===!0;i.range[c]=w.getBufferedTimes(x,h,m,v)}),i.backtrack=i.loaded=null,Object.keys(i.range).length?i.buffered=!0:this.removeFragment(i.body)},T.fragBuffered=function(P){var w=O(P),S=this.fragments[w];S&&(S.backtrack=S.loaded=null,S.buffered=!0)},T.getBufferedTimes=function(P,w,S,x){for(var h={time:[],partial:S},l=w?w.start:P.start,i=w?w.end:P.end,c=P.minEndPTS||i,C=P.maxStartPTS||l,v=0;v=m&&c<=u){h.time.push({startPTS:Math.max(l,x.start(v)),endPTS:Math.min(i,x.end(v))});break}else if(lm)h.partial=!0,h.time.push({startPTS:Math.max(l,x.start(v)),endPTS:Math.min(i,x.end(v))});else if(i<=m)break}return h},T.getPartialFragment=function(P){var w=null,S,x,h,l=0,i=this.bufferPadding,c=this.fragments;return Object.keys(c).forEach(function(C){var v=c[C];if(!v)return;I(v)&&(x=v.body.start-i,h=v.body.end+i,P>=x&&P<=h&&(S=Math.min(P-x,h-P),l<=S&&(w=v.body,l=S)))}),w},T.getState=function(P){var w=O(P),S=this.fragments[w];return S?S.buffered?I(S)?N.PARTIAL:N.OK:S.backtrack?N.BACKTRACKED:N.APPENDING:N.NOT_LOADED},T.backtrack=function(P,w){var S=O(P),x=this.fragments[S];if(!x||x.backtrack)return null;var h=x.backtrack=w||x.loaded;return x.loaded=null,h},T.getBacktrackData=function(P){var w=O(P),S=this.fragments[w];if(S){var x,h=S.backtrack;if(h!=null&&(x=h.payload)!==null&&x!==void 0&&x.byteLength)return h;this.removeFragment(P)}return null},T.isTimeBuffered=function(P,w,S){for(var x,h,l=0;l=x&&w<=h)return!0;if(w<=x)return!1}return!1},T.onFragLoaded=function(P,w){var S=w.frag,x=w.part;if(S.sn==="initSegment"||S.bitrateTest||x)return;var h=O(S);this.fragments[h]={body:S,loaded:w,backtrack:null,buffered:!1,range:Object.create(null)}},T.onBufferAppended=function(P,w){var S=this,x=w.frag,h=w.part,l=w.timeRanges;if(x.type===U.PlaylistLevelType.MAIN)if(this.activeFragment=x,h){var i=this.activeParts;i||(this.activeParts=i=[]),i.push(h)}else this.activeParts=null;this.timeRanges=l,Object.keys(l).forEach(function(c){var C=l[c];if(S.detectEvictedFragments(c,C),!h)for(var v=0;vP&&x.removeFragment(i)}})},T.removeFragment=function(P){var w=O(P);P.stats.loaded=0,P.clearElementaryStreamInfo(),delete this.fragments[w]},T.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},L}();function I(L){var T,A;return L.buffered&&(((T=L.range.video)===null||T===void 0?void 0:T.partial)||((A=L.range.audio)===null||A===void 0?void 0:A.partial))}function O(L){return L.type+"_"+L.level+"_"+L.urlId+"_"+L.sn}},"./src/controller/gap-controller.ts":function(oe,$,D){"use strict";D.r($),D.d($,"STALL_MINIMUM_DURATION_MS",function(){return I}),D.d($,"MAX_START_GAP_JUMP",function(){return O}),D.d($,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return L}),D.d($,"SKIP_BUFFER_RANGE_START",function(){return T}),D.d($,"default",function(){return A});var Y=D("./src/utils/buffer-helper.ts"),U=D("./src/errors.ts"),N=D("./src/events.ts"),K=D("./src/utils/logger.ts"),I=250,O=2,L=.1,T=.05,A=function(){function P(S,x,h,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=S,this.media=x,this.fragmentTracker=h,this.hls=l}var w=P.prototype;return w.destroy=function(){this.hls=this.fragmentTracker=this.media=null},w.poll=function(x){var h=this.config,l=this.media,i=this.stalled,c=l.currentTime,C=l.seeking,v=this.seeking&&!C,m=!this.seeking&&C;if(this.seeking=C,c!==x){if(this.moved=!0,i!==null){if(this.stallReported){var u=self.performance.now()-i;K.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||!Y.BufferHelper.getBuffered(l).length)return;var E=Y.BufferHelper.bufferInfo(l,c,0),d=E.len>0,f=E.nextStart||0;if(!d&&!f)return;if(C){var s=E.len>O,o=!f||f-c>O&&!this.fragmentTracker.getPartialFragment(c);if(s||o)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var b,g=Math.max(f,E.start||0)-c,_=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,k=_==null||((b=_.details)===null||b===void 0)?void 0:b.live,H=k?_.details.targetduration*2:O;if(g>0&&g<=H){this._trySkipBufferHole(null);return}}var z=self.performance.now();if(i===null){this.stalled=z;return}var Z=z-i;!C&&Z>=I&&this._reportStall(E.len);var G=Y.BufferHelper.bufferInfo(l,c,h.maxBufferHole);this._tryFixBufferStall(G,Z)},w._tryFixBufferStall=function(x,h){var l=this.config,i=this.fragmentTracker,c=this.media,C=c.currentTime,v=i.getPartialFragment(C);if(v){var m=this._trySkipBufferHole(v);if(m)return}x.len>l.maxBufferHole&&h>l.highBufferWatchdogPeriod*1e3&&(K.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},w._reportStall=function(x){var h=this.hls,l=this.media,i=this.stallReported;i||(this.stallReported=!0,K.logger.warn("Playback stalling at @"+l.currentTime+" due to low buffer (buffer="+x+")"),h.trigger(N.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:x}))},w._trySkipBufferHole=function(x){for(var h=this.config,l=this.hls,i=this.media,c=i.currentTime,C=0,v=Y.BufferHelper.getBuffered(i),m=0;m=C&&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;P.playbackRate=Math.min(m,Math.max(1,u))}else P.playbackRate!==1&&P.playbackRate!==0&&(P.playbackRate=1)},T.estimateLiveEdge=function(){var P=this.levelDetails;return P===null?null:P.edge+P.age},T.computeLatency=function(){var P=this.estimateLiveEdge();return P===null?null:P-this.currentTime},I(L,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var P=this.config,w=this.levelDetails;return P.liveMaxLatencyDuration!==void 0?P.liveMaxLatencyDuration:w?P.liveMaxLatencyDurationCount*w.targetduration:0}},{key:"targetLatency",get:function(){var P=this.levelDetails;if(P===null)return null;var w=P.holdBack,S=P.partHoldBack,x=P.targetduration,h=this.config,l=h.liveSyncDuration,i=h.liveSyncDurationCount,c=h.lowLatencyMode,C=this.hls.userConfig,v=c&&S||w;(C.liveSyncDuration||C.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 P=this.estimateLiveEdge(),w=this.targetLatency,S=this.levelDetails;if(P===null||w===null||S===null)return null;var x=S.edge,h=P-w-this.edgeStalled,l=x-S.totalduration,i=x-(this.config.lowLatencyMode&&S.partTarget||S.targetduration);return Math.min(Math.max(l,h),i)}},{key:"drift",get:function(){var P=this.levelDetails;return P===null?1:P.drift}},{key:"edgeStalled",get:function(){var P=this.levelDetails;if(P===null)return 0;var w=(this.config.lowLatencyMode&&P.partTarget||P.targetduration)*3;return Math.max(P.age-w,0)}},{key:"forwardBufferLength",get:function(){var P=this.media,w=this.levelDetails;if(!P||!w)return 0;var S=P.buffered.length;return S?P.buffered.end(S-1):w.edge-this.currentTime}}]),L}()},"./src/controller/level-controller.ts":function(oe,$,D){"use strict";D.r($),D.d($,"default",function(){return h});var Y=D("./src/types/level.ts"),U=D("./src/events.ts"),N=D("./src/errors.ts"),K=D("./src/utils/codecs.ts"),I=D("./src/controller/level-helper.ts"),O=D("./src/controller/base-playlist-controller.ts"),L=D("./src/types/loader.ts");function T(){return T=Object.assign||function(l){for(var i=1;i0){f=u[0].bitrate,u.sort(function(Z,G){return Z.bitrate-G.bitrate}),this._levels=u;for(var k=0;kthis.hls.config.fragLoadingMaxRetry&&(s=m.frag.level)):s=m.frag.level}break;case N.ErrorDetails.LEVEL_LOAD_ERROR:case N.ErrorDetails.LEVEL_LOAD_TIMEOUT:u&&(u.deliveryDirectives&&(f=!1),s=u.level),d=!0;break;case N.ErrorDetails.REMUX_ALLOC_ERROR:s=m.level,d=!0;break}s!==void 0&&this.recoverLevel(m,s,d,f)},c.recoverLevel=function(v,m,u,E){var d=v.details,f=this._levels[m];if(f.loadError++,u){var s=this.retryLoadingOrFail(v);if(s)v.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(E){var o=f.url.length;if(o>1&&f.loadError1){var E=(m.urlId+1)%u;this.warn("Switching to redundant URL-id "+E),this._levels.forEach(function(d){d.urlId=E}),this.level=v}},c.onFragLoaded=function(v,m){var u=m.frag;if(u!==void 0&&u.type===L.PlaylistLevelType.MAIN){var E=this._levels[u.level];E!==void 0&&(E.fragmentError=0,E.loadError=0)}},c.onLevelLoaded=function(v,m){var u,E=m.level,d=m.details,f=this._levels[E];if(!f){var s;this.warn("Invalid level index "+E),(s=m.deliveryDirectives)!==null&&s!==void 0&&s.skip&&(d.deltaUpdateFailed=!0);return}E===this.currentLevelIndex?(f.fragmentError===0&&(f.loadError=0,this.retryCount=0),this.playlistLoaded(E,m,f.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 E=-1,d=this.hls.audioTracks[m.id].groupId,f=0;f0){var E=u.urlId,d=u.url[E];if(v)try{d=v.addDirectives(d)}catch(f){this.warn("Could not construct new URL with HLS Delivery Directives: "+f)}this.log("Attempt loading level index "+m+(v?" at sn "+v.msn+" part "+v.part:"")+" with URL-id "+E+" "+d),this.clearTimer(),this.hls.trigger(U.Events.LEVEL_LOADING,{url:d,level:m,id:E,deliveryDirectives:v||null})}},c.removeLevel=function(v,m){var u=function(f,s){return s!==m},E=this._levels.filter(function(d,f){return f!==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,f){var s=d.details;return s!=null&&s.fragments&&s.fragments.forEach(function(o){o.level=f}),d});this._levels=E,this.hls.trigger(U.Events.LEVELS_UPDATED,{levels:E})},P(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 E=v<0;if(this.hls.trigger(U.Events.ERROR,{type:N.ErrorTypes.OTHER_ERROR,details:N.ErrorDetails.LEVEL_SWITCH_ERROR,level:v,fatal:E,reason:"invalid level idx"}),E)return;v=Math.min(v,u.length-1)}this.clearTimer();var d=this.currentLevelIndex,f=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(U.Events.LEVEL_SWITCHING,o);var b=s.details;if(!b||b.live){var g=this.switchParams(s.uri,f==null?void 0:f.details);this.loadPlaylist(g)}}},{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(oe,$,D){"use strict";D.r($),D.d($,"addGroupId",function(){return N}),D.d($,"assignTrackIdsByGroup",function(){return K}),D.d($,"updatePTS",function(){return I}),D.d($,"updateFragPTSDTS",function(){return L}),D.d($,"mergeDetails",function(){return T}),D.d($,"mapPartIntersection",function(){return A}),D.d($,"mapFragmentIntersection",function(){return P}),D.d($,"adjustSliding",function(){return w}),D.d($,"addSliding",function(){return S}),D.d($,"computeReloadInterval",function(){return x}),D.d($,"getFragmentWithSN",function(){return h}),D.d($,"getPartWith",function(){return l});var Y=D("./src/polyfills/number.ts"),U=D("./src/utils/logger.ts");function N(i,c,C){switch(c){case"audio":i.audioGroupIds||(i.audioGroupIds=[]),i.audioGroupIds.push(C);break;case"text":i.textGroupIds||(i.textGroupIds=[]),i.textGroupIds.push(C);break}}function K(i){var c={};i.forEach(function(C){var v=C.groupId||"";C.id=c[v]=c[v]||0,c[v]++})}function I(i,c,C){var v=i[c],m=i[C];O(v,m)}function O(i,c){var C=c.startPTS;if(Object(Y.isFiniteNumber)(C)){var v=0,m;c.sn>i.sn?(v=C-i.start,m=i):(v=i.start-C,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 L(i,c,C,v,m,u){var E=v-C;E<=0&&(U.logger.warn("Fragment should have a positive duration",c),v=C+c.duration,u=m+c.duration);var d=C,f=v,s=c.startPTS,o=c.endPTS;if(Object(Y.isFiniteNumber)(s)){var b=Math.abs(s-C);Object(Y.isFiniteNumber)(c.deltaPTS)?c.deltaPTS=Math.max(b,c.deltaPTS):c.deltaPTS=b,d=Math.max(C,s),C=Math.min(C,s),m=Math.min(m,c.startDTS),f=Math.min(v,o),v=Math.max(v,o),u=Math.max(u,c.endDTS)}c.duration=v-C;var g=C-c.start;c.appendedPTS=v,c.start=c.startPTS=C,c.maxStartPTS=d,c.startDTS=m,c.endPTS=v,c.minEndPTS=f,c.endDTS=u;var _=c.sn;if(!i||_i.endSN)return 0;var k,H=_-i.startSN,z=i.fragments;for(z[H]=c,k=H;k>0;k--)O(z[k],z[k-1]);for(k=H;k=0;m--){var u=v[m].initSegment;if(u){C=u;break}}i.fragmentHint&&delete i.fragmentHint.endPTS;var E=0,d;if(P(i,c,function(k,H){k.relurl&&(E=k.cc-H.cc),Object(Y.isFiniteNumber)(k.startPTS)&&Object(Y.isFiniteNumber)(k.endPTS)&&(H.start=H.startPTS=k.startPTS,H.startDTS=k.startDTS,H.appendedPTS=k.appendedPTS,H.maxStartPTS=k.maxStartPTS,H.endPTS=k.endPTS,H.endDTS=k.endDTS,H.minEndPTS=k.minEndPTS,H.duration=k.endPTS-k.startPTS,H.duration&&(d=H),c.PTSKnown=c.alignedSliding=!0),H.elementaryStreams=k.elementaryStreams,H.loader=k.loader,H.stats=k.stats,H.urlId=k.urlId,k.initSegment&&(H.initSegment=k.initSegment,C=k.initSegment)}),C){var f=c.fragmentHint?c.fragments.concat(c.fragmentHint):c.fragments;f.forEach(function(k){var H;(!k.initSegment||k.initSegment.relurl===((H=C)===null||H===void 0?void 0:H.relurl))&&(k.initSegment=C)})}if(c.skippedSegments&&(c.deltaUpdateFailed=c.fragments.some(function(k){return!k}),c.deltaUpdateFailed)){U.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(E){U.logger.warn("discontinuity sliding from playlist, take drift into account");for(var b=0;b=v.length)return;S(c,v[C].start)}function S(i,c){if(c){for(var C=i.fragments,v=i.skippedSegments;v0&&m0&&f===-1&&(this.log("Override startPosition with lastCurrentTime @"+s.toFixed(3)),f=s),this.state=U.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=f,this.tick()}else this._forceStartLoad=!0,this.state=U.State.STOPPED},E.stopLoad=function(){this._forceStartLoad=!1,m.prototype.stopLoad.call(this)},E.doTick=function(){switch(this.state){case U.State.IDLE:this.doTickIdle();break;case U.State.WAITING_LEVEL:{var f,s=this.levels,o=this.level,b=s==null||((f=s[o])===null||f===void 0)?void 0:f.details;if(b&&(!b.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(b))break;this.state=U.State.IDLE;break}break}case U.State.FRAG_LOADING_WAITING_RETRY:{var g,_=self.performance.now(),k=this.retryDate;(!k||_>=k||(g=this.media)!==null&&g!==void 0&&g.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=U.State.IDLE)}break;default:break}this.onTickEnd()},E.onTickEnd=function(){m.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},E.doTickIdle=function(){var f,s,o=this.hls,b=this.levelLastLoaded,g=this.levels,_=this.media,k=o.config,H=o.nextLoadLevel;if(b===null||!_&&(this.startFragRequested||!k.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!g||!g[H])return;var z=g[H];this.level=o.nextLoadLevel=H;var Z=z.details;if(!Z||this.state===U.State.WAITING_LEVEL||Z.live&&this.levelLastLoaded!==H){this.state=U.State.WAITING_LEVEL;return}var G=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:_,L.PlaylistLevelType.MAIN);if(G===null)return;var B=G.len,te=this.getMaxBufferLength(z.maxBitrate);if(B>=te)return;if(this._streamEnded(G,Z)){var de={};this.altAudio&&(de.type="video"),this.hls.trigger(K.Events.BUFFER_EOS,de),this.state=U.State.ENDED;return}var pe=G.end,ye=this.getNextFragment(pe,Z);if(this.couldBacktrack&&!this.fragPrevious&&ye&&ye.sn!=="initSegment"){var Ce=ye.sn-Z.startSN;Ce>1&&(ye=Z.fragments[Ce-1],this.fragmentTracker.removeFragment(ye))}if(ye&&this.fragmentTracker.getState(ye)===O.FragmentState.OK&&this.nextLoadPosition>pe){var _e=this.audioOnly&&!this.altAudio?T.ElementaryStreamTypes.AUDIO:T.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(_,_e,L.PlaylistLevelType.MAIN),ye=this.getNextFragment(this.nextLoadPosition,Z)}if(!ye)return;ye.initSegment&&!ye.initSegment.data&&!this.bitrateTest&&(ye=ye.initSegment),((f=ye.decryptdata)===null||f===void 0?void 0:f.keyFormat)==="identity"&&!((s=ye.decryptdata)!==null&&s!==void 0&&s.key)?this.loadKey(ye,Z):this.loadFragment(ye,Z,pe)},E.loadFragment=function(f,s,o){var b,g=this.fragmentTracker.getState(f);if(this.fragCurrent=f,g===O.FragmentState.BACKTRACKED){var _=this.fragmentTracker.getBacktrackData(f);if(_){this._handleFragmentLoadProgress(_),this._handleFragmentLoadComplete(_);return}else g=O.FragmentState.NOT_LOADED}g===O.FragmentState.NOT_LOADED||g===O.FragmentState.PARTIAL?f.sn==="initSegment"?this._loadInitSegment(f):this.bitrateTest?(f.bitrateTest=!0,this.log("Fragment "+f.sn+" of level "+f.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(f)):(this.startFragRequested=!0,m.prototype.loadFragment.call(this,f,s,o)):g===O.FragmentState.APPENDING?this.reduceMaxBufferLength(f.duration)&&this.fragmentTracker.removeFragment(f):((b=this.media)===null||b===void 0?void 0:b.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},E.getAppendedFrag=function(f){var s=this.fragmentTracker.getAppendedFrag(f,L.PlaylistLevelType.MAIN);return s&&"fragment"in s?s.fragment:s},E.getBufferedFrag=function(f){return this.fragmentTracker.getBufferedFrag(f,L.PlaylistLevelType.MAIN)},E.followingBufferedFrag=function(f){return f?this.getBufferedFrag(f.end+.5):null},E.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},E.nextLevelSwitch=function(){var f=this.levels,s=this.media;if(s!=null&&s.readyState){var o,b=this.getAppendedFrag(s.currentTime);if(b&&b.start>1&&this.flushMainBuffer(0,b.start-1),!s.paused&&f){var g=this.hls.nextLoadLevel,_=f[g],k=this.fragLastKbps;k&&this.fragCurrent?o=this.fragCurrent.duration*_.maxBitrate/(1e3*k)+1:o=0}else o=0;var H=this.getBufferedFrag(s.currentTime+o);if(H){var z=this.followingBufferedFrag(H);if(z){this.abortCurrentFrag();var Z=z.maxStartPTS?z.maxStartPTS:z.start,G=z.duration,B=Math.max(H.end,Z+Math.min(Math.max(G-this.config.maxFragLookUpTolerance,G*.5),G*.75));this.flushMainBuffer(B,Number.POSITIVE_INFINITY)}}}},E.abortCurrentFrag=function(){var f=this.fragCurrent;this.fragCurrent=null,f!=null&&f.loader&&f.loader.abort(),this.state===U.State.KEY_LOADING&&(this.state=U.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},E.flushMainBuffer=function(f,s){m.prototype.flushMainBuffer.call(this,f,s,this.altAudio?"video":null)},E.onMediaAttached=function(f,s){m.prototype.onMediaAttached.call(this,f,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 w.default(this.config,o,this.fragmentTracker,this.hls)},E.onMediaDetaching=function(){var f=this.media;f&&(f.removeEventListener("playing",this.onvplaying),f.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)},E.onMediaPlaying=function(){this.tick()},E.onMediaSeeked=function(){var f=this.media,s=f?f.currentTime:null;Object(Y.isFiniteNumber)(s)&&this.log("Media seeked to "+s.toFixed(3)),this.tick()},E.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(K.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},E.onManifestParsed=function(f,s){var o=!1,b=!1,g;s.levels.forEach(function(_){g=_.audioCodec,g&&(g.indexOf("mp4a.40.2")!==-1&&(o=!0),g.indexOf("mp4a.40.5")!==-1&&(b=!0))}),this.audioCodecSwitch=o&&b&&!Object(N.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},E.onLevelLoading=function(f,s){var o=this.levels;if(!o||this.state!==U.State.IDLE)return;var b=o[s.level];(!b.details||b.details.live&&this.levelLastLoaded!==s.level||this.waitForCdnTuneIn(b.details))&&(this.state=U.State.WAITING_LEVEL)},E.onLevelLoaded=function(f,s){var o,b=this.levels,g=s.level,_=s.details,k=_.totalduration;if(!b){this.warn("Levels were reset while loading level "+g);return}this.log("Level "+g+" loaded ["+_.startSN+","+_.endSN+"], cc ["+_.startCC+", "+_.endCC+"] duration:"+k);var H=this.fragCurrent;H&&(this.state===U.State.FRAG_LOADING||this.state===U.State.FRAG_LOADING_WAITING_RETRY)&&(H.level!==s.level&&H.loader&&(this.state=U.State.IDLE,H.loader.abort()));var z=b[g],Z=0;if(_.live||(o=z.details)!==null&&o!==void 0&&o.live){if(_.fragments[0]||(_.deltaUpdateFailed=!0),_.deltaUpdateFailed)return;Z=this.alignPlaylists(_,z.details)}if(z.details=_,this.levelLastLoaded=g,this.hls.trigger(K.Events.LEVEL_UPDATED,{details:_,level:g}),this.state===U.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(_))return;this.state=U.State.IDLE}this.startFragRequested?_.live&&this.synchronizeToLiveEdge(_):this.setStartPosition(_,Z),this.tick()},E._handleFragmentLoadProgress=function(f){var s,o=f.frag,b=f.part,g=f.payload,_=this.levels;if(!_){this.warn("Levels were reset while fragment load was in progress. Fragment "+o.sn+" of level "+o.level+" will not be buffered");return}var k=_[o.level],H=k.details;if(!H){this.warn("Dropping fragment "+o.sn+" of level "+o.level+" after level details were reset");return}var z=k.videoCodec,Z=H.PTSKnown||!H.live,G=(s=o.initSegment)===null||s===void 0?void 0:s.data,B=this._getAudioCodec(k),te=this.transmuxer=this.transmuxer||new A.default(this.hls,L.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),de=b?b.index:-1,pe=de!==-1,ye=new P.ChunkMetadata(o.level,o.sn,o.stats.chunkCount,g.byteLength,de,pe),Ce=this.initPTS[o.cc];te.push(g,G,B,z,o,b,H.totalduration,Z,ye,Ce)},E.onAudioTrackSwitching=function(f,s){var o=this.altAudio,b=!!s.url,g=s.id;if(!b){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var _=this.fragCurrent;_!=null&&_.loader&&(this.log("Switching to main audio track, cancel main fragment load"),_.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var k=this.hls;o&&k.trigger(K.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),k.trigger(K.Events.AUDIO_TRACK_SWITCHED,{id:g})}},E.onAudioTrackSwitched=function(f,s){var o=s.id,b=!!this.hls.audioTracks[o].url;if(b){var g=this.videoBuffer;g&&this.mediaBuffer!==g&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=g)}this.altAudio=b,this.tick()},E.onBufferCreated=function(f,s){var o=s.tracks,b,g,_=!1;for(var k in o){var H=o[k];if(H.id==="main"){if(g=k,b=H,k==="video"){var z=o[k];z&&(this.videoBuffer=z.buffer)}}else _=!0}_&&b?(this.log("Alternate track found, use "+g+".buffered to schedule main fragment loading"),this.mediaBuffer=b.buffer):this.mediaBuffer=this.media},E.onFragBuffered=function(f,s){var o=s.frag,b=s.part;if(o&&o.type!==L.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(o)){this.warn("Fragment "+o.sn+(b?" p: "+b.index:"")+" of level "+o.level+" finished buffering, but was aborted. state: "+this.state),this.state===U.State.PARSED&&(this.state=U.State.IDLE);return}var g=b?b.stats:o.stats;this.fragLastKbps=Math.round(8*g.total/(g.buffering.end-g.loading.first)),o.sn!=="initSegment"&&(this.fragPrevious=o),this.fragBufferedComplete(o,b)},E.onError=function(f,s){switch(s.details){case S.ErrorDetails.FRAG_LOAD_ERROR:case S.ErrorDetails.FRAG_LOAD_TIMEOUT:case S.ErrorDetails.KEY_LOAD_ERROR:case S.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(L.PlaylistLevelType.MAIN,s);break;case S.ErrorDetails.LEVEL_LOAD_ERROR:case S.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==U.State.ERROR&&(s.fatal?(this.warn(""+s.details),this.state=U.State.ERROR):!s.levelRetry&&this.state===U.State.WAITING_LEVEL&&(this.state=U.State.IDLE));break;case S.ErrorDetails.BUFFER_FULL_ERROR:if(s.parent==="main"&&(this.state===U.State.PARSING||this.state===U.State.PARSED)){var o=!0,b=this.getFwdBufferInfo(this.media,L.PlaylistLevelType.MAIN);b&&b.len>.5&&(o=!this.reduceMaxBufferLength(b.len)),o&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},E.checkBuffer=function(){var f=this.media,s=this.gapController;if(!f||!s||!f.readyState)return;var o=I.BufferHelper.getBuffered(f);!this.loadedmetadata&&o.length?(this.loadedmetadata=!0,this.seekToStartPos()):s.poll(this.lastCurrentTime),this.lastCurrentTime=f.currentTime},E.onFragLoadEmergencyAborted=function(){this.state=U.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},E.onBufferFlushed=function(f,s){var o=s.type;if(o!==T.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var b=(o===T.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(b,o,L.PlaylistLevelType.MAIN)}},E.onLevelsUpdated=function(f,s){this.levels=s.levels},E.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},E.seekToStartPos=function(){var f=this.media,s=f.currentTime,o=this.startPosition;if(o>=0&&s0&&(_1&&f.seeking===!1){var o=f.currentTime;if(I.BufferHelper.isBuffered(f,o)?s=this.getAppendedFrag(o):I.BufferHelper.isBuffered(f,o+.1)&&(s=this.getAppendedFrag(o+.1)),s){var b=this.fragPlaying,g=s.level;(!b||s.sn!==b.sn||b.level!==g||s.urlId!==b.urlId)&&(this.hls.trigger(K.Events.FRAG_CHANGED,{frag:s}),(!b||b.level!==g)&&this.hls.trigger(K.Events.LEVEL_SWITCHED,{level:g}),this.fragPlaying=s)}}},l(u,[{key:"nextLevel",get:function(){var f=this.nextBufferedFrag;return f?f.level:-1}},{key:"currentLevel",get:function(){var f=this.media;if(f){var s=this.getAppendedFrag(f.currentTime);if(s)return s.level}return-1}},{key:"nextBufferedFrag",get:function(){var f=this.media;if(f){var s=this.getAppendedFrag(f.currentTime);return this.followingBufferedFrag(s)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),u}(U.default)},"./src/controller/subtitle-stream-controller.ts":function(oe,$,D){"use strict";D.r($),D.d($,"SubtitleStreamController",function(){return i});var Y=D("./src/events.ts"),U=D("./src/utils/logger.ts"),N=D("./src/utils/buffer-helper.ts"),K=D("./src/controller/fragment-finders.ts"),I=D("./src/utils/discontinuities.ts"),O=D("./src/controller/level-helper.ts"),L=D("./src/controller/fragment-tracker.ts"),T=D("./src/controller/base-stream-controller.ts"),A=D("./src/types/loader.ts"),P=D("./src/types/level.ts");function w(c,C){for(var v=0;v=s[g].start&&b<=s[g].end){o=s[g];break}var _=d.start+d.duration;o?o.end=_:(o={start:b,end:_},s.push(o)),this.fragmentTracker.fragBuffered(d)},v.onBufferFlushing=function(u,E){var d=E.startOffset,f=E.endOffset;if(d===0&&f!==Number.POSITIVE_INFINITY){var s=this.currentTrackId,o=this.levels;if(!o.length||!o[s]||!o[s].details)return;var b=o[s].details,g=b.targetduration,_=f-g;if(_<=0)return;E.endOffsetSubtitles=Math.max(0,_),this.tracksBuffered.forEach(function(k){for(var H=0;H=b.length||s!==o||!g)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,f.live||(d=g.details)!==null&&d!==void 0&&d.live){var _=this.mainDetails;if(f.deltaUpdateFailed||!_)return;var k=_.fragments[0];if(!g.details)f.hasProgramDateTime&&_.hasProgramDateTime?Object(I.alignMediaPlaylistByPDT)(f,_):k&&Object(O.addSliding)(f,k.start);else{var H=this.alignPlaylists(f,g.details);H===0&&k&&Object(O.addSliding)(f,k.start)}}if(g.details=f,this.levelLastLoaded=s,this.tick(),f.live&&!this.fragCurrent&&this.media&&this.state===T.State.IDLE){var z=Object(K.findFragmentByPTS)(null,f.fragments,this.media.currentTime,0);z||(this.warn("Subtitle playlist not aligned with playback"),g.details=void 0)}},v._handleFragmentLoadComplete=function(u){var E=u.frag,d=u.payload,f=E.decryptdata,s=this.hls;if(this.fragContextChanged(E))return;if(d&&d.byteLength>0&&f&&f.key&&f.iv&&f.method==="AES-128"){var o=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(d),f.key.buffer,f.iv.buffer).then(function(b){var g=performance.now();s.trigger(Y.Events.FRAG_DECRYPTED,{frag:E,payload:b,stats:{tstart:o,tdecrypt:g}})})}},v.doTick=function(){if(!this.media){this.state=T.State.IDLE;return}if(this.state===T.State.IDLE){var u,E=this.currentTrackId,d=this.levels;if(!d.length||!d[E]||!d[E].details)return;var f=d[E].details,s=f.targetduration,o=this.config,b=this.media,g=N.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,b.currentTime-s,o.maxBufferHole),_=g.end,k=g.len,H=this.getMaxBufferLength()+s;if(k>H)return;console.assert(f,"Subtitle track details are defined on idle subtitle stream controller tick");var z=f.fragments,Z=z.length,G=f.edge,B,te=this.fragPrevious;if(_-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=P(this.media.textTracks);l.forEach(function(i){Object(U.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,C=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 ["+C.startSN+"-"+C.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 C=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,v=this.tracks.filter(function(E){return!c||E.groupId===c});this.tracksInGroup=v;var m=this.findTrackId(C==null?void 0:C.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(Y.Events.SUBTITLE_TRACKS_UPDATED,u),m!==-1&&this.setSubtitleTrack(m,C)}},x.findTrackId=function(l){for(var i=this.tracksInGroup,c=0;c=C.length)return;this.clearTimer();var v=C[l];if(this.log("Switching to subtitle track "+l),this.trackId=l,v){var m=v.id,u=v.groupId,E=u===void 0?"":u,d=v.name,f=v.type,s=v.url;this.hls.trigger(Y.Events.SUBTITLE_TRACK_SWITCH,{id:m,groupId:E,name:d,type:f,url:s});var o=this.switchParams(v.url,i==null?void 0:i.details);this.loadPlaylist(o)}else this.hls.trigger(Y.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=P(this.media.textTracks),c=0;c=0&&(f[0]=Math.min(f[0],C),f[1]=Math.max(f[1],v),E=!0,s/(v-C)>.5))return}if(E||u.push([C,v]),this.config.renderTextTracksNatively){var o=this.captionsTracks[c];this.Cues.newCue(o,C,v,m)}else{var b=this.Cues.newCue(null,C,v,m);this.hls.trigger(U.Events.CUES_PARSED,{type:"captions",cues:b,track:c})}},l.onInitPtsFound=function(c,C){var v=this,m=C.frag,u=C.id,E=C.initPTS,d=C.timescale,f=this.unparsedVttFrags;u==="main"&&(this.initPTS[m.cc]=E,this.timescale[m.cc]=d),f.length&&(this.unparsedVttFrags=[],f.forEach(function(s){v.onFragLoaded(U.Events.FRAG_LOADED,s)}))},l.getExistingTrack=function(c){var C=this.media;if(C)for(var v=0;v>>8^d&255^99,L[m]=d,T[d]=m;var f=v[m],s=v[f],o=v[s],b=v[d]*257^d*16843008;P[m]=b<<24|b>>>8,w[m]=b<<16|b>>>16,S[m]=b<<8|b>>>24,x[m]=b,b=o*16843009^s*65537^f*257^m*16843008,l[d]=b<<24|b>>>8,i[d]=b<<16|b>>>16,c[d]=b<<8|b>>>24,C[d]=b,m?(m=f^v[v[v[o^f]]],u^=v[v[u]]):m=u=1}},I.expandKey=function(L){for(var T=this.uint8ArrayToUint32Array_(L),A=!0,P=0;P>>6)+1;var b=(c[C+2]&60)>>>2;if(b>o.length-1){i.trigger(N.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+b});return}return E=(c[C+2]&1)<<2,E|=(c[C+3]&192)>>>6,Y.logger.log("manifest codec:"+v+", ADTS type:"+m+", samplingIndex:"+b),/firefox/i.test(f)?b>=6?(m=5,d=new Array(4),u=b-3):(m=2,d=new Array(2),u=b):f.indexOf("android")!==-1?(m=2,d=new Array(2),u=b):(m=5,d=new Array(4),v&&(v.indexOf("mp4a.40.29")!==-1||v.indexOf("mp4a.40.5")!==-1)||!v&&b>=6?u=b-3:((v&&v.indexOf("mp4a.40.2")!==-1&&(b>=6&&E===1||/vivaldi/i.test(f))||!v&&E===1)&&(m=2,d=new Array(2)),u=b)),d[0]=m<<3,d[0]|=(b&14)>>1,d[1]|=(b&1)<<7,d[1]|=E<<3,m===5&&(d[1]|=(u&14)>>1,d[2]=(u&1)<<7,d[2]|=2<<2,d[3]=0),{config:d,samplerate:o[b],channelCount:E,codec:"mp4a.40."+m,manifestCodec:s}}function I(i,c){return i[c]===255&&(i[c+1]&246)===240}function O(i,c){return i[c+1]&1?7:9}function L(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=L(i,c);if(v<=C)return!1;var m=c+v;return m===i.length||A(i,m)}return!1}function S(i,c,C,v,m){if(!i.samplerate){var u=K(c,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,Y.logger.log("parsed codec:"+i.codec+", rate:"+u.samplerate+", channels:"+u.channelCount)}}function x(i){return 1024*9e4/i}function h(i,c,C,v,m){var u=O(i,c),E=L(i,c);if(E-=u,E>0){var d=C+v*m;return{headerLength:u,frameLength:E,stamp:d}}}function l(i,c,C,v,m){var u=x(i.samplerate),E=h(c,C,v,m,u);if(E){var d=E.frameLength,f=E.headerLength,s=E.stamp,o=f+d,b=Math.max(0,C+o-c.length),g;b?(g=new Uint8Array(o-f),g.set(c.subarray(C+f,c.length),0)):g=c.subarray(C+f,C+o);var _={unit:g,pts:s};return b||i.samples.push(_),{sample:_,length:o,missing:b}}}},"./src/demux/base-audio-demuxer.ts":function(oe,$,D){"use strict";D.r($),D.d($,"initPTSFn",function(){return L});var Y=D("./src/polyfills/number.ts"),U=D("./src/demux/id3.ts"),N=D("./src/demux/dummy-demuxed-track.ts"),K=D("./src/utils/mp4-tools.ts"),I=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 A=T.prototype;return A.resetInitSegment=function(w,S,x){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},A.resetTimeStamp=function(){},A.resetContiguity=function(){},A.canParse=function(w,S){return!1},A.appendFrame=function(w,S,x){},A.demux=function(w,S){this.cachedData&&(w=Object(K.appendUint8Array)(this.cachedData,w),this.cachedData=null);var x=U.getID3Data(w,0),h=x?x.length:0,l,i,c=this._audioTrack,C=this._id3Track,v=x?U.getTimeStamp(x):void 0,m=w.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=L(v,S)),x&&x.length>0&&C.samples.push({pts:this.initPTS,dts:this.initPTS,data:x}),i=this.initPTS;hO?(this.word<<=O,this.bitsAvailable-=O):(O-=this.bitsAvailable,L=O>>3,O-=L>>3,this.bytesAvailable-=L,this.loadWord(),this.word<<=O,this.bitsAvailable-=O)},K.readBits=function(O){var L=Math.min(this.bitsAvailable,O),T=this.word>>>32-L;return O>32&&Y.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=L,this.bitsAvailable>0?this.word<<=L:this.bytesAvailable>0&&this.loadWord(),L=O-L,L>0&&this.bitsAvailable?T<>>O)!==0)return this.word<<=O,this.bitsAvailable-=O,O;return this.loadWord(),O+this.skipLZ()},K.skipUEG=function(){this.skipBits(1+this.skipLZ())},K.skipEG=function(){this.skipBits(1+this.skipLZ())},K.readUEG=function(){var O=this.skipLZ();return this.readBits(O+1)-1},K.readEG=function(){var O=this.readUEG();return 1&O?1+O>>>1:-1*(O>>>1)},K.readBoolean=function(){return this.readBits(1)===1},K.readUByte=function(){return this.readBits(8)},K.readUShort=function(){return this.readBits(16)},K.readUInt=function(){return this.readBits(32)},K.skipScalingList=function(O){for(var L=8,T=8,A,P=0;P0?m.subarray(E,E+d):void 0},K=function(m,u){var E=0;return E=(m[u]&127)<<21,E|=(m[u+1]&127)<<14,E|=(m[u+2]&127)<<7,E|=m[u+3]&127,E},I=function(m,u){return Y(m,u)&&K(m,u+6)+10<=m.length-u},O=function(m){for(var u=A(m),E=0;E>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:_+=String.fromCharCode(o);break;case 12:case 13:b=m[k++],_+=String.fromCharCode((o&31)<<6|b&63);break;case 14:b=m[k++],g=m[k++],_+=String.fromCharCode((o&15)<<12|(b&63)<<6|(g&63)<<0);break;default:}}return _},i={decodeTextFrame:S},c;function C(){return!c&&typeof self.TextDecoder!="undefined"&&(c=new self.TextDecoder("utf-8")),c}},"./src/demux/mp3demuxer.ts":function(oe,$,D){"use strict";D.r($);var Y=D("./src/demux/base-audio-demuxer.ts"),U=D("./src/demux/id3.ts"),N=D("./src/utils/logger.ts"),K=D("./src/demux/mpegaudio.ts");function I(T,A){T.prototype=Object.create(A.prototype),T.prototype.constructor=T,O(T,A)}function O(T,A){return O=Object.setPrototypeOf||function(w,S){return w.__proto__=S,w},O(T,A)}var L=function(T){I(A,T);function A(){return T.apply(this,arguments)||this}var P=A.prototype;return P.resetInitSegment=function(S,x,h){T.prototype.resetInitSegment.call(this,S,x,h),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:S,duration:h,inputTimeScale:9e4,dropped:0}},A.probe=function(S){if(!S)return!1;for(var x=U.getID3Data(S,0)||[],h=x.length,l=S.length;h0},I.demux=function(L){var T=L,A=Object(U.dummyTrack)();if(this.config.progressive){this.remainderData&&(T=Object(Y.appendUint8Array)(this.remainderData,L));var P=Object(Y.segmentValidRange)(T);this.remainderData=P.remainder,A.samples=P.valid||new Uint8Array}else A.samples=T;return{audioTrack:Object(U.dummyTrack)(),avcTrack:A,id3Track:Object(U.dummyTrack)(),textTrack:Object(U.dummyTrack)()}},I.flush=function(){var L=Object(U.dummyTrack)();return L.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(U.dummyTrack)(),avcTrack:L,id3Track:Object(U.dummyTrack)(),textTrack:Object(U.dummyTrack)()}},I.demuxSampleAes=function(L,T,A){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},I.destroy=function(){},K}();N.minProbeByteLength=1024,$.default=N},"./src/demux/mpegaudio.ts":function(oe,$,D){"use strict";D.r($),D.d($,"appendFrame",function(){return O}),D.d($,"parseHeader",function(){return L}),D.d($,"isHeaderPattern",function(){return T}),D.d($,"isHeader",function(){return A}),D.d($,"canParse",function(){return P}),D.d($,"probe",function(){return w});var Y=null,U=[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],N=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],K=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],I=[0,1,1,4];function O(S,x,h,l,i){if(h+24>x.length)return;var c=L(x,h);if(c&&h+c.frameLength<=x.length){var C=c.samplesPerFrame*9e4/c.sampleRate,v=l+i*C,m={unit:x.subarray(h,h+c.frameLength),pts:v,dts:v};return S.config=[],S.channelCount=c.channelCount,S.samplerate=c.sampleRate,S.samples.push(m),{sample:m,length:c.frameLength,missing:0}}}function L(S,x){var h=S[x+1]>>3&3,l=S[x+1]>>1&3,i=S[x+2]>>4&15,c=S[x+2]>>2&3;if(h!==1&&i!==0&&i!==15&&c!==3){var C=S[x+2]>>1&1,v=S[x+3]>>6,m=h===3?3-l:l===3?3:4,u=U[m*14+i-1]*1e3,E=h===3?0:h===2?1:2,d=N[E*3+c],f=v===3?1:2,s=K[h][l],o=I[l],b=s*8*o,g=Math.floor(s*u/d+C)*o;if(Y===null){var _=navigator.userAgent||"",k=_.match(/Chrome\/(\d+)/i);Y=k?parseInt(k[1]):0}var H=!!Y&&Y<=87;return H&&l===2&&u>=224e3&&v===0&&(S[x+3]=S[x+3]|128),{sampleRate:d,channelCount:f,frameLength:g,samplesPerFrame:b}}}function T(S,x){return S[x]===255&&(S[x+1]&224)===224&&(S[x+1]&6)!==0}function A(S,x){return x+1=L.length){A();return}if(L[T].unit.length<32)continue;var P=this.decrypter.isSync();if(this.decryptAacSample(L,T,A,P),!P)return}},I.getAvcEncryptedData=function(L){for(var T=Math.floor((L.length-48)/160)*16+16,A=new Int8Array(T),P=0,w=32;w<=L.length-16;w+=160,P+=16)A.set(L.subarray(w,w+16),P);return A},I.getAvcDecryptedUnit=function(L,T){for(var A=new Uint8Array(T),P=0,w=32;w<=L.length-16;w+=160,P+=16)L.set(A.subarray(P,P+16),w);return L},I.decryptAvcSample=function(L,T,A,P,w,S){var x=Object(U.discardEPB)(w.data),h=this.getAvcEncryptedData(x),l=this;this.decryptBuffer(h.buffer,function(i){w.data=l.getAvcDecryptedUnit(x,i),S||l.decryptAvcSamples(L,T,A+1,P)})},I.decryptAvcSamples=function(L,T,A,P){if(L instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;T++,A=0){if(T>=L.length){P();return}for(var w=L[T].units;!(A>=w.length);A++){var S=w[A];if(S.data.length<=48||S.type!==1&&S.type!==5)continue;var x=this.decrypter.isSync();if(this.decryptAvcSample(L,T,A,P,S,x),!x)return}}},K}();$.default=N},"./src/demux/transmuxer-interface.ts":function(oe,$,D){"use strict";D.r($),D.d($,"default",function(){return w});var Y=D("./node_modules/webworkify-webpack/index.js"),U=D.n(Y),N=D("./src/events.ts"),K=D("./src/demux/transmuxer.ts"),I=D("./src/utils/logger.ts"),O=D("./src/errors.ts"),L=D("./src/utils/mediasource-helper.ts"),T=D("./node_modules/eventemitter3/index.js"),A=D.n(T),P=Object(L.getMediaSource)()||{isTypeSupported:function(){return!1}},w=function(){function S(h,l,i,c){var C=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=h,this.id=l,this.onTransmuxComplete=i,this.onFlush=c;var v=h.config,m=function(s,o){o=o||{},o.frag=C.frag,o.id=C.id,h.trigger(s,o)};this.observer=new T.EventEmitter,this.observer.on(N.Events.FRAG_DECRYPTED,m),this.observer.on(N.Events.ERROR,m);var u={mp4:P.isTypeSupported("video/mp4"),mpeg:P.isTypeSupported("audio/mpeg"),mp3:P.isTypeSupported('audio/mp4; codecs="mp3"')},E=navigator.vendor;if(v.enableWorker&&typeof Worker!="undefined"){I.logger.log("demuxing in webworker");var d;try{d=this.worker=Y("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),d.addEventListener("message",this.onwmsg),d.onerror=function(f){h.trigger(N.Events.ERROR,{type:O.ErrorTypes.OTHER_ERROR,details:O.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(f.message+" ("+f.filename+":"+f.lineno+")")})},d.postMessage({cmd:"init",typeSupported:u,vendor:E,id:l,config:JSON.stringify(v)})}catch(f){I.logger.warn("Error in worker:",f),I.logger.error("Error while initializing DemuxerWorker, fallback to inline"),d&&self.URL.revokeObjectURL(d.objectURL),this.transmuxer=new K.default(this.observer,u,v,E,l),this.worker=null}}else this.transmuxer=new K.default(this.observer,u,v,E,l)}var x=S.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,C,v,m,u,E,d,f){var s=this;d.transmuxing.start=self.performance.now();var o=this.transmuxer,b=this.worker,g=m?m.start:v.start,_=v.decryptdata,k=this.frag,H=!(k&&v.cc===k.cc),z=!(k&&d.level===k.level),Z=k?d.sn-k.sn:-1,G=this.part?d.part-this.part.index:1,B=!z&&(Z===1||Z===0&&G===1),te=self.performance.now();(z||Z||v.stats.parsing.start===0)&&(v.stats.parsing.start=te),m&&(G||!B)&&(m.stats.parsing.start=te);var de=new K.TransmuxState(H,B,E,z,g);if(!B||H){I.logger.log("[transmuxer-interface, "+v.type+"]: Starting new transmux session for sn: "+d.sn+" p: "+d.part+" level: "+d.level+" id: "+d.id+` discontinuity: `+H+` trackSwitch: `+z+` contiguous: `+B+` accurateTimeOffset: `+E+` timeOffset: `+g);var pe=new K.TransmuxConfig(c,C,i,u,f);this.configureTransmuxer(pe)}if(this.frag=v,this.part=m,b)b.postMessage({cmd:"demux",data:l,decryptdata:_,chunkMeta:d,state:de},l instanceof ArrayBuffer?[l]:[]);else if(o){var ye=o.push(l,_,d,de);Object(K.isPromise)(ye)?ye.then(function(Ce){s.handleTransmuxComplete(Ce)}):this.handleTransmuxComplete(ye)}},x.flush=function(l){var i=this;l.transmuxing.start=self.performance.now();var c=this.transmuxer,C=this.worker;if(C)C.postMessage({cmd:"flush",chunkMeta:l});else if(c){var v=c.flush(l);Object(K.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){c.handleTransmuxComplete(C)}),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)},S}()},"./src/demux/transmuxer-worker.ts":function(oe,$,D){"use strict";D.r($),D.d($,"default",function(){return O});var Y=D("./src/demux/transmuxer.ts"),U=D("./src/events.ts"),N=D("./src/utils/logger.ts"),K=D("./node_modules/eventemitter3/index.js"),I=D.n(K);function O(w){var S=new K.EventEmitter,x=function(l,i){w.postMessage({event:l,data:i})};S.on(U.Events.FRAG_DECRYPTED,x),S.on(U.Events.ERROR,x),w.addEventListener("message",function(h){var l=h.data;switch(l.cmd){case"init":{var i=JSON.parse(l.config);w.transmuxer=new Y.default(S,l.typeSupported,i,l.vendor,l.id),Object(N.enableLogs)(i.debug),x("init",null);break}case"configure":{w.transmuxer.configure(l.config);break}case"demux":{var c=w.transmuxer.push(l.data,l.decryptdata,l.chunkMeta,l.state);Object(Y.isPromise)(c)?c.then(function(m){L(w,m)}):L(w,c);break}case"flush":{var C=l.chunkMeta,v=w.transmuxer.flush(C);Object(Y.isPromise)(v)?v.then(function(m){A(w,m,C)}):A(w,v,C);break}default:break}})}function L(w,S){if(P(S.remuxResult))return;var x=[],h=S.remuxResult,l=h.audio,i=h.video;l&&T(x,l),i&&T(x,i),w.postMessage({event:"transmuxComplete",data:S},x)}function T(w,S){S.data1&&w.push(S.data1.buffer),S.data2&&w.push(S.data2.buffer)}function A(w,S,x){S.forEach(function(h){L(w,h)}),w.postMessage({event:"flush",data:x})}function P(w){return!w.audio&&!w.video&&!w.text&&!w.id3&&!w.initSegment}},"./src/demux/transmuxer.ts":function(oe,$,D){"use strict";D.r($),D.d($,"default",function(){return i}),D.d($,"isPromise",function(){return v}),D.d($,"TransmuxConfig",function(){return m}),D.d($,"TransmuxState",function(){return u});var Y=D("./src/events.ts"),U=D("./src/errors.ts"),N=D("./src/crypt/decrypter.ts"),K=D("./src/demux/aacdemuxer.ts"),I=D("./src/demux/mp4demuxer.ts"),O=D("./src/demux/tsdemuxer.ts"),L=D("./src/demux/mp3demuxer.ts"),T=D("./src/remux/mp4-remuxer.ts"),A=D("./src/remux/passthrough-remuxer.ts"),P=D("./src/demux/chunk-cache.ts"),w=D("./src/utils/mp4-tools.ts"),S=D("./src/utils/logger.ts"),x;try{x=self.performance.now.bind(self.performance)}catch(E){S.logger.debug("Unable to use Performance API on this environment"),x=self.Date.now}var h=[{demux:O.default,remux:T.default},{demux:I.default,remux:A.default},{demux:K.default,remux:T.default},{demux:L.default,remux:T.default}],l=1024;h.forEach(function(E){var d=E.demux;l=Math.max(l,d.minProbeByteLength)});var i=function(){function E(f,s,o,b,g){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 P.default,this.observer=f,this.typeSupported=s,this.config=o,this.vendor=b,this.id=g}var d=E.prototype;return d.configure=function(s){this.transmuxConfig=s,this.decrypter&&this.decrypter.reset()},d.push=function(s,o,b,g){var _=this,k=b.transmuxing;k.executeStart=x();var H=new Uint8Array(s),z=this.cache,Z=this.config,G=this.currentTransmuxState,B=this.transmuxConfig;g&&(this.currentTransmuxState=g);var te=c(H,o);if(te&&te.method==="AES-128"){var de=this.getDecrypter();if(Z.enableSoftwareAES){var pe=de.softwareDecrypt(H,te.key.buffer,te.iv.buffer);if(!pe)return k.executeEnd=x(),C(b);H=new Uint8Array(pe)}else return this.decryptionPromise=de.webCryptoDecrypt(H,te.key.buffer,te.iv.buffer).then(function(Pe){var We=_.push(Pe,null,b);return _.decryptionPromise=null,We}),this.decryptionPromise}var ye=g||G,Ce=ye.contiguous,_e=ye.discontinuity,le=ye.trackSwitch,se=ye.accurateTimeOffset,ve=ye.timeOffset,ie=B.audioCodec,q=B.videoCodec,xe=B.defaultInitPts,Ie=B.duration,Ne=B.initSegmentData;if((_e||le)&&this.resetInitSegment(Ne,ie,q,Ie),_e&&this.resetInitialTimestamp(xe),Ce||this.resetContiguity(),this.needsProbing(H,_e,le)){if(z.dataLength){var De=z.flush();H=Object(w.appendUint8Array)(De,H)}this.configureTransmuxer(H,B)}var Be=this.transmux(H,te,ve,se,b),Ae=this.currentTransmuxState;return Ae.contiguous=!0,Ae.discontinuity=!1,Ae.trackSwitch=!1,k.executeEnd=x(),Be},d.flush=function(s){var o=this,b=s.transmuxing;b.executeStart=x();var g=this.decrypter,_=this.cache,k=this.currentTransmuxState,H=this.decryptionPromise;if(H)return H.then(function(){return o.flush(s)});var z=[],Z=k.timeOffset;if(g){var G=g.flush();G&&z.push(this.push(G,null,s))}var B=_.dataLength;_.reset();var te=this.demuxer,de=this.remuxer;if(!te||!de)return B>=l&&this.observer.emit(Y.Events.ERROR,Y.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),b.executeEnd=x(),[C(s)];var pe=te.flush(Z);return v(pe)?pe.then(function(ye){return o.flushRemux(z,ye,s),z}):(this.flushRemux(z,pe,s),z)},d.flushRemux=function(s,o,b){var g=o.audioTrack,_=o.avcTrack,k=o.id3Track,H=o.textTrack,z=this.currentTransmuxState,Z=z.accurateTimeOffset,G=z.timeOffset;S.logger.log("[transmuxer.ts]: Flushed fragment "+b.sn+(b.part>-1?" p: "+b.part:"")+" of level "+b.level);var B=this.remuxer.remux(g,_,k,H,G,Z,!0,this.id);s.push({remuxResult:B,chunkMeta:b}),b.transmuxing.executeEnd=x()},d.resetInitialTimestamp=function(s){var o=this.demuxer,b=this.remuxer;if(!o||!b)return;o.resetTimeStamp(s),b.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,b,g){var _=this.demuxer,k=this.remuxer;if(!_||!k)return;_.resetInitSegment(o,b,g),k.resetInitSegment(s,o,b)},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,b,g,_){var k;return o&&o.method==="SAMPLE-AES"?k=this.transmuxSampleAes(s,o,b,g,_):k=this.transmuxUnencrypted(s,b,g,_),k},d.transmuxUnencrypted=function(s,o,b,g){var _=this.demuxer.demux(s,o,!1,!this.config.progressive),k=_.audioTrack,H=_.avcTrack,z=_.id3Track,Z=_.textTrack,G=this.remuxer.remux(k,H,z,Z,o,b,!1,this.id);return{remuxResult:G,chunkMeta:g}},d.transmuxSampleAes=function(s,o,b,g,_){var k=this;return this.demuxer.demuxSampleAes(s,o,b).then(function(H){var z=k.remuxer.remux(H.audioTrack,H.avcTrack,H.id3Track,H.textTrack,b,g,!1,k.id);return{remuxResult:z,chunkMeta:_}})},d.configureTransmuxer=function(s,o){for(var b=this.config,g=this.observer,_=this.typeSupported,k=this.vendor,H=o.audioCodec,z=o.defaultInitPts,Z=o.duration,G=o.initSegmentData,B=o.videoCodec,te,de=0,pe=h.length;de0&&d!=null&&d.key!=null&&d.iv!==null&&d.method!=null&&(f=d),f}var C=function(d){return{remuxResult:{},chunkMeta:d}};function v(E){return"then"in E&&E.then instanceof Function}var m=function(d,f,s,o,b){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=f,this.initSegmentData=s,this.duration=o,this.defaultInitPts=b},u=function(d,f,s,o,b){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=f,this.accurateTimeOffset=s,this.trackSwitch=o,this.timeOffset=b}},"./src/demux/tsdemuxer.ts":function(oe,$,D){"use strict";D.r($),D.d($,"discardEPB",function(){return C});var Y=D("./src/demux/adts.ts"),U=D("./src/demux/mpegaudio.ts"),N=D("./src/demux/exp-golomb.ts"),K=D("./src/demux/id3.ts"),I=D("./src/demux/sample-aes.ts"),O=D("./src/events.ts"),L=D("./src/utils/mp4-tools.ts"),T=D("./src/utils/logger.ts"),A=D("./src/errors.ts"),P={video:1,audio:2,id3:3,text:4},w=function(){function v(u,E,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=E,this.typeSupported=d}v.probe=function(E){var d=v.syncOffset(E);return d<0?!1:(d&&T.logger.warn("MPEG2-TS detected but first sync word found @ offset "+d+", junk ahead ?"),!0)},v.syncOffset=function(E){for(var d=Math.min(1e3,E.length-3*188),f=0;f>4,ie=void 0;if(ve>1){if(ie=_e+5+E[_e+4],ie===_e+188)continue}else ie=_e+4;switch(se){case k:le&&(H&&(o=l(H))&&this.parseAVCPES(o,!1),H={data:[],size:0}),H&&(H.data.push(E.subarray(ie,_e+188)),H.size+=_e+188-ie);break;case z:le&&(G&&(o=l(G))&&(g.isAAC?this.parseAACPES(o):this.parseMPEGPES(o)),G={data:[],size:0}),G&&(G.data.push(E.subarray(ie,_e+188)),G.size+=_e+188-ie);break;case Z:le&&(B&&(o=l(B))&&this.parseID3PES(o),B={data:[],size:0}),B&&(B.data.push(E.subarray(ie,_e+188)),B.size+=_e+188-ie);break;case 0:le&&(ie+=E[ie]+1),pe=this._pmtId=x(E,ie);break;case pe:{le&&(ie+=E[ie]+1);var q=h(E,ie,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,f);k=q.avc,k>0&&(b.pid=k),z=q.audio,z>0&&(g.pid=z,g.isAAC=q.isAAC),Z=q.id3,Z>0&&(_.pid=Z),te&&!de&&(T.logger.log("reparse from beginning"),te=!1,_e=Ce-188),de=this.pmtParsed=!0;break}case 17:case 8191:break;default:te=!0;break}}else this.observer.emit(O.Events.ERROR,O.Events.ERROR,{type:A.ErrorTypes.MEDIA_ERROR,details:A.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});b.pesData=H,g.pesData=G,_.pesData=B;var xe={audioTrack:g,avcTrack:b,id3Track:_,textTrack:this._txtTrack};return s&&this.extractRemainingSamples(xe),xe},m.flush=function(){var E=this.remainderData;this.remainderData=null;var d;return E?d=this.demux(E,-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(E){var d=E.audioTrack,f=E.avcTrack,s=E.id3Track,o=f.pesData,b=d.pesData,g=s.pesData,_;o&&(_=l(o))?(this.parseAVCPES(_,!0),f.pesData=null):f.pesData=o,b&&(_=l(b))?(d.isAAC?this.parseAACPES(_):this.parseMPEGPES(_),d.pesData=null):(b!=null&&b.size&&T.logger.log("last AAC PES packet truncated,might overlap between fragments"),d.pesData=b),g&&(_=l(g))?(this.parseID3PES(_),s.pesData=null):s.pesData=g},m.demuxSampleAes=function(E,d,f){var s=this.demux(E,f,!0,!this.config.progressive),o=this.sampleAes=new I.default(this.observer,this.config,d);return this.decrypt(s,o)},m.decrypt=function(E,d){return new Promise(function(f){var s=E.audioTrack,o=E.avcTrack;s.samples&&s.isAAC?d.decryptAacSamples(s.samples,0,function(){o.samples?d.decryptAvcSamples(o.samples,0,0,function(){f(E)}):f(E)}):o.samples&&d.decryptAvcSamples(o.samples,0,0,function(){f(E)})})},m.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},m.parseAVCPES=function(E,d){var f=this,s=this._avcTrack,o=this.parseAVCNALu(E.data),b=!1,g=this.avcSample,_,k=!1;E.data=null,g&&o.length&&!s.audFound&&(i(g,s),g=this.avcSample=S(!1,E.pts,E.dts,"")),o.forEach(function(H){switch(H.type){case 1:{_=!0,g||(g=f.avcSample=S(!0,E.pts,E.dts,"")),b&&(g.debug+="NDR "),g.frame=!0;var z=H.data;if(k&&z.length>4){var Z=new N.default(z).readSliceType();(Z===2||Z===4||Z===7||Z===9)&&(g.key=!0)}break}case 5:_=!0,g||(g=f.avcSample=S(!0,E.pts,E.dts,"")),b&&(g.debug+="IDR "),g.key=!0,g.frame=!0;break;case 6:{_=!0,b&&g&&(g.debug+="SEI ");var G=new N.default(C(H.data));G.readUByte();for(var B=0,te=0,de=!1,pe=0;!de&&G.bytesAvailable>1;){B=0;do pe=G.readUByte(),B+=pe;while(pe===255);te=0;do pe=G.readUByte(),te+=pe;while(pe===255);if(B===4&&G.bytesAvailable!==0){de=!0;var ye=G.readUByte();if(ye===181){var Ce=G.readUShort();if(Ce===49){var _e=G.readUInt();if(_e===1195456820){var le=G.readUByte();if(le===3){for(var se=G.readUByte(),ve=G.readUByte(),ie=31&se,q=[se,ve],xe=0;xe16){for(var Ie=[],Ne=0;Ne<16;Ne++)Ie.push(G.readUByte().toString(16)),(Ne===3||Ne===5||Ne===7||Ne===9)&&Ie.push("-");for(var De=te-16,Be=new Uint8Array(De),Ae=0;Ae=0){var G={data:E.subarray(z,g-s-1),type:Z};b.push(G)}else{var B=this.getLastNalUnit();if(B&&(o&&g<=4-o&&(B.state&&(B.data=B.data.subarray(0,B.data.byteLength-o))),k=g-s-1,k>0)){var te=new Uint8Array(B.data.byteLength+k);te.set(B.data,0),te.set(E.subarray(0,k),B.data.byteLength),B.data=te,B.state=0}}g=0&&s>=0){var de={data:E.subarray(z,d),type:Z,state:s};b.push(de)}if(b.length===0){var pe=this.getLastNalUnit();if(pe){var ye=new Uint8Array(pe.data.byteLength+E.byteLength);ye.set(pe.data,0),ye.set(E,pe.data.byteLength),pe.data=ye}}return f.naluState=s,b},m.parseAACPES=function(E){var d=0,f=this._audioTrack,s=this.aacOverFlow,o=E.data;if(s){this.aacOverFlow=null;var b=s.sample.unit.byteLength,g=Math.min(s.missing,b),_=b-g;s.sample.unit.set(o.subarray(0,g),_),f.samples.push(s.sample),d=s.missing}var k,H;for(k=d,H=o.length;k1;){var b=new Uint8Array(o[0].length+o[1].length);b.set(o[0]),b.set(o[1],o[0].length),o[0]=b,o.splice(1,1)}u=o[0];var g=(u[0]<<16)+(u[1]<<8)+u[2];if(g===1){if(E=(u[4]<<8)+u[5],E&&E>v.size-6)return null;var _=u[7];_&192&&(f=(u[9]&14)*536870912+(u[10]&255)*4194304+(u[11]&254)*16384+(u[12]&255)*128+(u[13]&254)/2,_&64?(s=(u[14]&14)*536870912+(u[15]&255)*4194304+(u[16]&254)*16384+(u[17]&255)*128+(u[18]&254)/2,f-s>60*9e4&&(T.logger.warn(Math.round((f-s)/9e4)+"s delta between PTS and DTS, align them"),f=s)):s=f),d=u[8];var k=d+9;if(v.size<=k)return null;v.size-=k;for(var H=new Uint8Array(v.size),z=0,Z=o.length;zG){k-=G;continue}else u=u.subarray(k),G-=k,k=0;H.set(u,m),m+=G}return E&&(E-=d+3),{data:H,pts:f,dts:s,len:E}}return null}function i(v,m){if(v.units.length&&v.frame){if(v.pts===void 0){var u=m.samples,E=u.length;if(E){var d=u[E-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 E=u-1;E>=0;E--)if(m.ptsf)return o;return 0}},{key:"maxAutoLevel",get:function(){var d=this.levels,f=this.autoLevelCapping,s;return f===-1&&d&&d.length?s=d.length-1:s=f,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 f=this.audioTrackController;f&&(f.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 f=this.subtitleTrackController;f&&(f.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 f=this.subtitleTrackController;f&&(f.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:S.hlsDefaultConfig},set:function(d){m.defaultConfig=d}}]),m}();v.defaultConfig=void 0},"./src/is-supported.ts":function(oe,$,D){"use strict";D.r($),D.d($,"isSupported",function(){return N}),D.d($,"changeTypeSupported",function(){return K});var Y=D("./src/utils/mediasource-helper.ts");function U(){return self.SourceBuffer||self.WebKitSourceBuffer}function N(){var I=Object(Y.getMediaSource)();if(!I)return!1;var O=U(),L=I&&typeof I.isTypeSupported=="function"&&I.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),T=!O||O.prototype&&typeof O.prototype.appendBuffer=="function"&&typeof O.prototype.remove=="function";return!!L&&!!T}function K(){var I,O=U();return typeof(O==null||((I=O.prototype)===null||I===void 0)?void 0:I.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(oe,$,D){"use strict";D.r($),D.d($,"default",function(){return w}),D.d($,"LoadError",function(){return x});var Y=D("./src/polyfills/number.ts"),U=D("./src/errors.ts");function N(h,l){h.prototype=Object.create(l.prototype),h.prototype.constructor=h,T(h,l)}function K(h){var l=typeof Map=="function"?new Map:void 0;return K=function(c){if(c===null||!L(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,C)}function C(){return I(c,arguments,A(this).constructor)}return C.prototype=Object.create(c.prototype,{constructor:{value:C,enumerable:!1,writable:!0,configurable:!0}}),T(C,c)},K(h)}function I(h,l,i){return O()?I=Reflect.construct:I=function(C,v,m){var u=[null];u.push.apply(u,v);var E=Function.bind.apply(C,u),d=new E;return m&&T(d,m.prototype),d},I.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(h){return!1}}function L(h){return Function.toString.call(h).indexOf("[native code]")!==-1}function T(h,l){return T=Object.setPrototypeOf||function(c,C){return c.__proto__=C,c},T(h,l)}function A(h){return A=Object.setPrototypeOf?Object.getPrototypeOf:function(i){return i.__proto__||Object.getPrototypeOf(i)},A(h)}var P=Math.pow(2,17),w=function(){function h(i){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=i}var l=h.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,C){var v=this,m=c.url;if(!m)return Promise.reject(new x({type:U.ErrorTypes.NETWORK_ERROR,details:U.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,E=u.fLoader,d=u.loader;return new Promise(function(f,s){v.loader&&v.loader.destroy();var o=v.loader=c.loader=E?new E(u):new d(u),b=S(c),g={timeout:u.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:u.fragLoadingMaxRetryTimeout,highWaterMark:P};c.stats=o.stats,o.load(b,g,{onSuccess:function(k,H,z,Z){v.resetLoader(c,o),f({frag:c,part:null,payload:k.data,networkDetails:Z})},onError:function(k,H,z){v.resetLoader(c,o),s(new x({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:c,response:k,networkDetails:z}))},onAbort:function(k,H,z){v.resetLoader(c,o),s(new x({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:c,networkDetails:z}))},onTimeout:function(k,H,z){v.resetLoader(c,o),s(new x({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:c,networkDetails:z}))},onProgress:function(k,H,z,Z){C&&C({frag:c,part:null,payload:z,networkDetails:Z})}})})},l.loadPart=function(c,C,v){var m=this;this.abort();var u=this.config,E=u.fLoader,d=u.loader;return new Promise(function(f,s){m.loader&&m.loader.destroy();var o=m.loader=c.loader=E?new E(u):new d(u),b=S(c,C),g={timeout:u.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:u.fragLoadingMaxRetryTimeout,highWaterMark:P};C.stats=o.stats,o.load(b,g,{onSuccess:function(k,H,z,Z){m.resetLoader(c,o),m.updateStatsFromPart(c,C);var G={frag:c,part:C,payload:k.data,networkDetails:Z};v(G),f(G)},onError:function(k,H,z){m.resetLoader(c,o),s(new x({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:c,part:C,response:k,networkDetails:z}))},onAbort:function(k,H,z){c.stats.aborted=C.stats.aborted,m.resetLoader(c,o),s(new x({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:c,part:C,networkDetails:z}))},onTimeout:function(k,H,z){m.resetLoader(c,o),s(new x({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:c,part:C,networkDetails:z}))}})})},l.updateStatsFromPart=function(c,C){var v=c.stats,m=C.stats,u=m.total;if(v.loaded+=m.loaded,u){var E=Math.round(c.duration/C.duration),d=Math.min(Math.round(v.loaded/u),E),f=E-d,s=f*Math.round(v.loaded/d);v.total=v.loaded+s}else v.total=Math.max(v.loaded,v.total);var o=v.loading,b=m.loading;o.start?o.first+=b.first-b.start:(o.start=b.start,o.first=b.first),o.end=b.end},l.resetLoader=function(c,C){c.loader=null,this.loader===C&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),C.destroy()},h}();function S(h,l){l===void 0&&(l=null);var i=l||h,c={frag:h,part:l,responseType:"arraybuffer",url:i.url,headers:{},rangeStart:0,rangeEnd:0},C=i.byteRangeStartOffset,v=i.byteRangeEndOffset;return Object(Y.isFiniteNumber)(C)&&Object(Y.isFiniteNumber)(v)&&(c.rangeStart=C,c.rangeEnd=v),c}var x=function(h){N(l,h);function l(i){for(var c,C=arguments.length,v=new Array(C>1?C-1:0),m=1;m>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=I.LevelKey.fromURI(v.uri),u.method=v.method,u.iv=this.createInitializationVector(m),u.keyFormat="identity"),u},c.setElementaryStreamInfo=function(v,m,u,E,d,f){f===void 0&&(f=!1);var s=this.elementaryStreams,o=s[v];if(!o){s[v]={startPTS:m,endPTS:u,startDTS:E,endDTS:d,partial:f};return}o.startPTS=Math.min(o.startPTS,m),o.endPTS=Math.max(o.endPTS,u),o.startDTS=Math.min(o.startDTS,E),o.endDTS=Math.max(o.endDTS,d)},c.clearElementaryStreamInfo=function(){var v=this.elementaryStreams;v[w.AUDIO]=null,v[w.VIDEO]=null,v[w.AUDIOVIDEO]=null},P(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&&K.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(Y.isFiniteNumber)(this.programDateTime))return null;var v=Object(Y.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}(S),h=function(l){L(i,l);function i(c,C,v,m,u){var E;E=l.call(this,v)||this,E.fragOffset=0,E.duration=0,E.gap=!1,E.independent=!1,E.relurl=void 0,E.fragment=void 0,E.index=void 0,E.stats=new O.LoadStats,E.duration=c.decimalFloatingPoint("DURATION"),E.gap=c.bool("GAP"),E.independent=c.bool("INDEPENDENT"),E.relurl=c.enumeratedString("URI"),E.fragment=C,E.index=m;var d=c.enumeratedString("BYTERANGE");return d&&E.setByteRange(d,u),u&&(E.fragOffset=u.fragOffset+u.duration),E}return P(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 C=this.elementaryStreams;return!!(C.audio||C.video||C.audiovideo)}}]),i}(S)},"./src/loader/key-loader.ts":function(oe,$,D){"use strict";D.r($),D.d($,"default",function(){return K});var Y=D("./src/events.ts"),U=D("./src/errors.ts"),N=D("./src/utils/logger.ts"),K=function(){function I(L){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=L,this._registerListeners()}var O=I.prototype;return O._registerListeners=function(){this.hls.on(Y.Events.KEY_LOADING,this.onKeyLoading,this)},O._unregisterListeners=function(){this.hls.off(Y.Events.KEY_LOADING,this.onKeyLoading)},O.destroy=function(){this._unregisterListeners();for(var T in this.loaders){var A=this.loaders[T];A&&A.destroy()}this.loaders={}},O.onKeyLoading=function(T,A){var P=A.frag,w=P.type,S=this.loaders[w];if(!P.decryptdata){N.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var x=P.decryptdata.uri;if(x!==this.decrypturl||this.decryptkey===null){var h=this.hls.config;if(S&&(N.logger.warn("abort previous key loader for type:"+w),S.abort()),!x){N.logger.warn("key uri is falsy");return}var l=h.loader,i=P.loader=this.loaders[w]=new l(h);this.decrypturl=x,this.decryptkey=null;var c={url:x,frag:P,responseType:"arraybuffer"},C={timeout:h.fragLoadingTimeOut,maxRetry:0,retryDelay:h.fragLoadingRetryDelay,maxRetryDelay:h.fragLoadingMaxRetryTimeout,highWaterMark:0},v={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};i.load(c,C,v)}else this.decryptkey&&(P.decryptdata.key=this.decryptkey,this.hls.trigger(Y.Events.KEY_LOADED,{frag:P}))},O.loadsuccess=function(T,A,P){var w=P.frag;if(!w.decryptdata){N.logger.error("after key load, decryptdata unset");return}this.decryptkey=w.decryptdata.key=new Uint8Array(T.data),w.loader=null,delete this.loaders[w.type],this.hls.trigger(Y.Events.KEY_LOADED,{frag:w})},O.loaderror=function(T,A){var P=A.frag,w=P.loader;w&&w.abort(),delete this.loaders[P.type],this.hls.trigger(Y.Events.ERROR,{type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:P,response:T})},O.loadtimeout=function(T,A){var P=A.frag,w=P.loader;w&&w.abort(),delete this.loaders[P.type],this.hls.trigger(Y.Events.ERROR,{type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:P})},I}()},"./src/loader/level-details.ts":function(oe,$,D){"use strict";D.r($),D.d($,"LevelDetails",function(){return I});var Y=D("./src/polyfills/number.ts");function U(O,L){for(var T=0;TA.endSN||P>0||P===0&&w>0,this.updated||this.advanced?this.misses=Math.floor(A.misses*.6):this.misses=A.misses+1,this.availabilityDelay=A.availabilityDelay},N(O,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(Y.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||K}},{key:"drift",get:function(){var A=this.driftEndTime-this.driftStartTime;if(A>0){var P=this.driftEnd-this.driftStart;return P*1e3/A}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var A;return(A=this.partList)!==null&&A!==void 0&&A.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var A;return(A=this.fragments)!==null&&A!==void 0&&A.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 A;return(A=this.partList)!==null&&A!==void 0&&A.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var A;return(A=this.partList)!==null&&A!==void 0&&A.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),O}()},"./src/loader/level-key.ts":function(oe,$,D){"use strict";D.r($),D.d($,"LevelKey",function(){return I});var Y=D("./node_modules/url-toolkit/src/url-toolkit.js"),U=D.n(Y);function N(O,L){for(var T=0;T2){var s=f.shift()+".";return s+=parseInt(f.shift()).toString(16),s+=("000"+parseInt(f.shift()).toString(16)).substr(-4),s}return d},u.resolve=function(d,f){return U.buildAbsoluteURL(f,d,{alwaysNormalize:!0})},u.parseMasterPlaylist=function(d,f){var s=[],o={},b=!1;P.lastIndex=0;for(var g;(g=P.exec(d))!=null;)if(g[1]){var _=new L.AttrList(g[1]),k={attrs:_,bitrate:_.decimalInteger("AVERAGE-BANDWIDTH")||_.decimalInteger("BANDWIDTH"),name:_.NAME,url:u.resolve(g[2],f)},H=_.decimalResolution("RESOLUTION");H&&(k.width=H.width,k.height=H.height),c((_.CODECS||"").split(/[ ,]+/).filter(function(Z){return Z}),k),k.videoCodec&&k.videoCodec.indexOf("avc1")!==-1&&(k.videoCodec=u.convertAVC1ToAVCOTI(k.videoCodec)),s.push(k)}else if(g[3]){var z=new L.AttrList(g[3]);z["DATA-ID"]&&(b=!0,o[z["DATA-ID"]]=z)}return{levels:s,sessionData:b?o:null}},u.parseMasterPlaylistMedia=function(d,f,s,o){o===void 0&&(o=[]);var b,g=[],_=0;for(w.lastIndex=0;(b=w.exec(d))!==null;){var k=new L.AttrList(b[1]);if(k.TYPE===s){var H={attrs:k,bitrate:0,id:_++,groupId:k["GROUP-ID"],instreamId:k["INSTREAM-ID"],name:k.NAME||k.LANGUAGE||"",type:s,default:k.bool("DEFAULT"),autoselect:k.bool("AUTOSELECT"),forced:k.bool("FORCED"),lang:k.LANGUAGE,url:k.URI?u.resolve(k.URI,f):""};if(o.length){var z=u.findGroup(o,H.groupId)||o[0];C(H,z,"audioCodec"),C(H,z,"textCodec")}g.push(H)}}return g},u.parseLevelPlaylist=function(d,f,s,o,b){var g=new I.LevelDetails(f),_=g.fragments,k=null,H=0,z=0,Z=0,G=0,B=null,te=new K.Fragment(o,f),de,pe,ye,Ce=-1,_e=!1;for(S.lastIndex=0,g.m3u8=d;(de=S.exec(d))!==null;){_e&&(_e=!1,te=new K.Fragment(o,f),te.start=Z,te.sn=H,te.cc=G,te.level=s,k&&(te.initSegment=k,te.rawProgramDateTime=k.rawProgramDateTime));var le=de[1];if(le){te.duration=parseFloat(le);var se=(" "+de[2]).slice(1);te.title=se||null,te.tagList.push(se?["INF",le,se]:["INF",le])}else if(de[3])Object(Y.isFiniteNumber)(te.duration)&&(te.start=Z,ye&&(te.levelkey=ye),te.sn=H,te.level=s,te.cc=G,te.urlId=b,_.push(te),te.relurl=(" "+de[3]).slice(1),m(te,B),B=te,Z+=te.duration,H++,z=0,_e=!0);else if(de[4]){var ve=(" "+de[4]).slice(1);B?te.setByteRange(ve,B):te.setByteRange(ve)}else if(de[5])te.rawProgramDateTime=(" "+de[5]).slice(1),te.tagList.push(["PROGRAM-DATE-TIME",te.rawProgramDateTime]),Ce===-1&&(Ce=_.length);else{if(de=de[0].match(x),!de){T.logger.warn("No matches on slow regex match for level playlist!");continue}for(pe=1;pe-1){T.logger.warn("Keyformat "+ct+" is not supported from the manifest");continue}else if(ct!=="identity")continue;We&&(ye=O.LevelKey.fromURL(f,ze),ze&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(We)>=0&&(ye.method=We,ye.keyFormat=ct,ke&&(ye.keyID=ke),Ge&&(ye.keyFormatVersions=Ge),ye.iv=qe));break}case"START":{var vt=new L.AttrList(q),lt=vt.decimalFloatingPoint("TIME-OFFSET");Object(Y.isFiniteNumber)(lt)&&(g.startTimeOffset=lt);break}case"MAP":{var Tt=new L.AttrList(q);te.relurl=Tt.URI,Tt.BYTERANGE&&te.setByteRange(Tt.BYTERANGE),te.level=s,te.sn="initSegment",ye&&(te.levelkey=ye),te.initSegment=null,k=te,_e=!0;break}case"SERVER-CONTROL":{var gt=new L.AttrList(q);g.canBlockReload=gt.bool("CAN-BLOCK-RELOAD"),g.canSkipUntil=gt.optionalFloat("CAN-SKIP-UNTIL",0),g.canSkipDateRanges=g.canSkipUntil>0&>.bool("CAN-SKIP-DATERANGES"),g.partHoldBack=gt.optionalFloat("PART-HOLD-BACK",0),g.holdBack=gt.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var yt=new L.AttrList(q);g.partTarget=yt.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Oe=g.partList;Oe||(Oe=g.partList=[]);var Pt=z>0?Oe[Oe.length-1]:void 0,St=z++,Ue=new K.Part(new L.AttrList(q),te,f,St,Pt);Oe.push(Ue),te.duration+=Ue.duration;break}case"PRELOAD-HINT":{var Ze=new L.AttrList(q);g.preloadHint=Ze;break}case"RENDITION-REPORT":{var Ee=new L.AttrList(q);g.renditionReports=g.renditionReports||[],g.renditionReports.push(Ee);break}default:T.logger.warn("line parsed but not handled: "+de);break}}}B&&!B.relurl?(_.pop(),Z-=B.duration,g.partList&&(g.fragmentHint=B)):g.partList&&(m(te,B),te.cc=G,g.fragmentHint=te);var fe=_.length,be=_[0],ne=_[fe-1];if(Z+=g.skippedSegments*g.targetduration,Z>0&&fe&&ne){g.averagetargetduration=Z/fe;var re=ne.sn;g.endSN=re!=="initSegment"?re:0,be&&(g.startCC=be.cc,be.initSegment||g.fragments.every(function(ae){return ae.relurl&&l(ae.relurl)})&&(T.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),te=new K.Fragment(o,f),te.relurl=ne.relurl,te.level=s,te.sn="initSegment",be.initSegment=te,g.needSidxRanges=!0))}else g.endSN=0,g.startCC=0;return g.fragmentHint&&(Z+=g.fragmentHint.duration),g.totalduration=Z,g.endCC=G,Ce>0&&v(_,Ce),g},u}();function c(u,E){["video","audio","text"].forEach(function(d){var f=u.filter(function(o){return Object(A.isCodecType)(o,d)});if(f.length){var s=f.filter(function(o){return o.lastIndexOf("avc1",0)===0||o.lastIndexOf("mp4a",0)===0});E[d+"Codec"]=s.length>0?s[0]:f[0],u=u.filter(function(o){return f.indexOf(o)===-1})}}),E.unknownCodecs=u}function C(u,E,d){var f=E[d];f&&(u[d]=f)}function v(u,E){for(var d=u[E],f=E;f--;){var s=u[f];if(!s)return;s.programDateTime=d.programDateTime-s.duration*1e3,d=s}}function m(u,E){u.rawProgramDateTime?u.programDateTime=Date.parse(u.rawProgramDateTime):E!=null&&E.programDateTime&&(u.programDateTime=E.endProgramDateTime),Object(Y.isFiniteNumber)(u.programDateTime)||(u.programDateTime=null,u.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(oe,$,D){"use strict";D.r($);var Y=D("./src/polyfills/number.ts"),U=D("./src/events.ts"),N=D("./src/errors.ts"),K=D("./src/utils/logger.ts"),I=D("./src/utils/mp4-tools.ts"),O=D("./src/loader/m3u8-parser.ts"),L=D("./src/types/loader.ts"),T=D("./src/utils/attr-list.ts");function A(S){var x=S.type;switch(x){case L.PlaylistContextType.AUDIO_TRACK:return L.PlaylistLevelType.AUDIO;case L.PlaylistContextType.SUBTITLE_TRACK:return L.PlaylistLevelType.SUBTITLE;default:return L.PlaylistLevelType.MAIN}}function P(S,x){var h=S.url;return(h===void 0||h.indexOf("data:")===0)&&(h=x.url),h}var w=function(){function S(h){this.hls=void 0,this.loaders=Object.create(null),this.hls=h,this.registerListeners()}var x=S.prototype;return x.registerListeners=function(){var l=this.hls;l.on(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.on(U.Events.LEVEL_LOADING,this.onLevelLoading,this),l.on(U.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),l.on(U.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},x.unregisterListeners=function(){var l=this.hls;l.off(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.off(U.Events.LEVEL_LOADING,this.onLevelLoading,this),l.off(U.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),l.off(U.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},x.createInternalLoader=function(l){var i=this.hls.config,c=i.pLoader,C=i.loader,v=c||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:L.PlaylistContextType.MANIFEST,url:c,deliveryDirectives:null})},x.onLevelLoading=function(l,i){var c=i.id,C=i.level,v=i.url,m=i.deliveryDirectives;this.load({id:c,groupId:null,level:C,responseType:"text",type:L.PlaylistContextType.LEVEL,url:v,deliveryDirectives:m})},x.onAudioTrackLoading=function(l,i){var c=i.id,C=i.groupId,v=i.url,m=i.deliveryDirectives;this.load({id:c,groupId:C,level:null,responseType:"text",type:L.PlaylistContextType.AUDIO_TRACK,url:v,deliveryDirectives:m})},x.onSubtitleTrackLoading=function(l,i){var c=i.id,C=i.groupId,v=i.url,m=i.deliveryDirectives;this.load({id:c,groupId:C,level:null,responseType:"text",type:L.PlaylistContextType.SUBTITLE_TRACK,url:v,deliveryDirectives:m})},x.load=function(l){var i,c=this.hls.config,C=this.getInternalLoader(l);if(C){var v=C.context;if(v&&v.url===l.url){K.logger.trace("[playlist-loader]: playlist request ongoing");return}K.logger.log("[playlist-loader]: aborting previous loader for type: "+l.type),C.abort()}var m,u,E,d;switch(l.type){case L.PlaylistContextType.MANIFEST:m=c.manifestLoadingMaxRetry,u=c.manifestLoadingTimeOut,E=c.manifestLoadingRetryDelay,d=c.manifestLoadingMaxRetryTimeout;break;case L.PlaylistContextType.LEVEL:case L.PlaylistContextType.AUDIO_TRACK:case L.PlaylistContextType.SUBTITLE_TRACK:m=0,u=c.levelLoadingTimeOut;break;default:m=c.levelLoadingMaxRetry,u=c.levelLoadingTimeOut,E=c.levelLoadingRetryDelay,d=c.levelLoadingMaxRetryTimeout;break}if(C=this.createInternalLoader(l),(i=l.deliveryDirectives)!==null&&i!==void 0&&i.part){var f;if(l.type===L.PlaylistContextType.LEVEL&&l.level!==null?f=this.hls.levels[l.level].details:l.type===L.PlaylistContextType.AUDIO_TRACK&&l.id!==null?f=this.hls.audioTracks[l.id].details:l.type===L.PlaylistContextType.SUBTITLE_TRACK&&l.id!==null&&(f=this.hls.subtitleTracks[l.id].details),f){var s=f.partTarget,o=f.targetduration;s&&o&&(u=Math.min(Math.max(s*3,o*.8)*1e3,u))}}var b={timeout:u,maxRetry:m,retryDelay:E,maxRetryDelay:d,highWaterMark:0},g={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};C.load(l,b,g)},x.loadsuccess=function(l,i,c,C){if(C===void 0&&(C=null),c.isSidxRequest){this.handleSidxRequest(l,c),this.handlePlaylistLoaded(l,i,c,C);return}this.resetInternalLoader(c.type);var v=l.data;if(v.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(l,c,"no EXTM3U delimiter",C);return}i.parsing.start=performance.now(),v.indexOf("#EXTINF:")>0||v.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(l,i,c,C):this.handleMasterPlaylist(l,i,c,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,C){var v=this.hls,m=l.data,u=P(l,c),E=O.default.parseMasterPlaylist(m,u),d=E.levels,f=E.sessionData;if(!d.length){this.handleManifestParsingError(l,c,"no level found in manifest",C);return}var s=d.map(function(H){return{id:H.attrs.AUDIO,audioCodec:H.audioCodec}}),o=d.map(function(H){return{id:H.attrs.SUBTITLES,textCodec:H.textCodec}}),b=O.default.parseMasterPlaylistMedia(m,u,"AUDIO",s),g=O.default.parseMasterPlaylistMedia(m,u,"SUBTITLES",o),_=O.default.parseMasterPlaylistMedia(m,u,"CLOSED-CAPTIONS");if(b.length){var k=b.some(function(H){return!H.url});!k&&d[0].audioCodec&&!d[0].attrs.AUDIO&&(K.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),b.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new T.AttrList({}),bitrate:0,url:""}))}v.trigger(U.Events.MANIFEST_LOADED,{levels:d,audioTracks:b,subtitles:g,captions:_,url:u,stats:i,networkDetails:C,sessionData:f})},x.handleTrackOrLevelPlaylist=function(l,i,c,C){var v=this.hls,m=c.id,u=c.level,E=c.type,d=P(l,c),f=Object(Y.isFiniteNumber)(m)?m:0,s=Object(Y.isFiniteNumber)(u)?u:f,o=A(c),b=O.default.parseLevelPlaylist(l.data,d,s,o,f);if(!b.fragments.length){v.trigger(U.Events.ERROR,{type:N.ErrorTypes.NETWORK_ERROR,details:N.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(E===L.PlaylistContextType.MANIFEST){var g={attrs:new T.AttrList({}),bitrate:0,details:b,name:"",url:d};v.trigger(U.Events.MANIFEST_LOADED,{levels:[g],audioTracks:[],url:d,stats:i,networkDetails:C,sessionData:null})}if(i.parsing.end=performance.now(),b.needSidxRanges){var _,k=(_=b.fragments[0].initSegment)===null||_===void 0?void 0:_.url;this.load({url:k,isSidxRequest:!0,type:E,level:u,levelDetails:b,id:m,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}c.levelDetails=b,this.handlePlaylistLoaded(l,i,c,C)},x.handleSidxRequest=function(l,i){var c=Object(I.parseSegmentIndex)(new Uint8Array(l.data));if(!c)return;var C=c.references,v=i.levelDetails;C.forEach(function(m,u){var E=m.info,d=v.fragments[u];d.byteRange.length===0&&d.setByteRange(String(1+E.end-E.start)+"@"+String(E.start)),d.initSegment&&d.initSegment.setByteRange(String(c.moovEndOffset)+"@0")})},x.handleManifestParsingError=function(l,i,c,C){this.hls.trigger(U.Events.ERROR,{type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:i.type===L.PlaylistContextType.MANIFEST,url:l.url,reason:c,response:l,context:i,networkDetails:C})},x.handleNetworkError=function(l,i,c,C){c===void 0&&(c=!1),K.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=N.ErrorDetails.UNKNOWN,m=!1,u=this.getInternalLoader(l);switch(l.type){case L.PlaylistContextType.MANIFEST:v=c?N.ErrorDetails.MANIFEST_LOAD_TIMEOUT:N.ErrorDetails.MANIFEST_LOAD_ERROR,m=!0;break;case L.PlaylistContextType.LEVEL:v=c?N.ErrorDetails.LEVEL_LOAD_TIMEOUT:N.ErrorDetails.LEVEL_LOAD_ERROR,m=!1;break;case L.PlaylistContextType.AUDIO_TRACK:v=c?N.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:N.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,m=!1;break;case L.PlaylistContextType.SUBTITLE_TRACK:v=c?N.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:N.ErrorDetails.SUBTITLE_LOAD_ERROR,m=!1;break}u&&this.resetInternalLoader(l.type);var E={type:N.ErrorTypes.NETWORK_ERROR,details:v,fatal:m,url:l.url,loader:u,context:l,networkDetails:i};C&&(E.response=C),this.hls.trigger(U.Events.ERROR,E)},x.handlePlaylistLoaded=function(l,i,c,C){var v=c.type,m=c.level,u=c.id,E=c.groupId,d=c.loader,f=c.levelDetails,s=c.deliveryDirectives;if(!(f!=null&&f.targetduration)){this.handleManifestParsingError(l,c,"invalid target duration",C);return}if(!d)return;f.live&&(d.getCacheAge&&(f.ageHeader=d.getCacheAge()||0),(!d.getCacheAge||isNaN(f.ageHeader))&&(f.ageHeader=0));switch(v){case L.PlaylistContextType.MANIFEST:case L.PlaylistContextType.LEVEL:this.hls.trigger(U.Events.LEVEL_LOADED,{details:f,level:m||0,id:u||0,stats:i,networkDetails:C,deliveryDirectives:s});break;case L.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(U.Events.AUDIO_TRACK_LOADED,{details:f,id:u||0,groupId:E||"",stats:i,networkDetails:C,deliveryDirectives:s});break;case L.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(U.Events.SUBTITLE_TRACK_LOADED,{details:f,id:u||0,groupId:E||"",stats:i,networkDetails:C,deliveryDirectives:s});break}},S}();$.default=w},"./src/polyfills/number.ts":function(oe,$,D){"use strict";D.r($),D.d($,"isFiniteNumber",function(){return Y}),D.d($,"MAX_SAFE_INTEGER",function(){return U});var Y=Number.isFinite||function(N){return typeof N=="number"&&isFinite(N)},U=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(oe,$,D){"use strict";D.r($);var Y=function(){function U(){}return U.getSilentFrame=function(K,I){switch(K){case"mp4a.40.2":if(I===1)return new Uint8Array([0,200,0,128,35,128]);if(I===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(I===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(I===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(I===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(I===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(I===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(I===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(I===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},U}();$.default=Y},"./src/remux/mp4-generator.ts":function(oe,$,D){"use strict";D.r($);var Y=Math.pow(2,32)-1,U=function(){function N(){}return N.init=function(){N.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 I;for(I in N.types)N.types.hasOwnProperty(I)&&(N.types[I]=[I.charCodeAt(0),I.charCodeAt(1),I.charCodeAt(2),I.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]),L=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);N.HDLR_TYPES={video:O,audio:L};var T=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),A=new Uint8Array([0,0,0,0,0,0,0,0]);N.STTS=N.STSC=N.STCO=A,N.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),N.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),N.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),N.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var P=new Uint8Array([105,115,111,109]),w=new Uint8Array([97,118,99,49]),S=new Uint8Array([0,0,0,1]);N.FTYP=N.box(N.types.ftyp,P,S,P,w),N.DINF=N.box(N.types.dinf,N.box(N.types.dref,T))},N.box=function(I){for(var O=8,L=arguments.length,T=new Array(L>1?L-1:0),A=1;A>24&255,S[1]=O>>16&255,S[2]=O>>8&255,S[3]=O&255,S.set(I,4),P=0,O=8;P>24&255,I>>16&255,I>>8&255,I&255,L>>24,L>>16&255,L>>8&255,L&255,T>>24,T>>16&255,T>>8&255,T&255,85,196,0,0]))},N.mdia=function(I){return N.box(N.types.mdia,N.mdhd(I.timescale,I.duration),N.hdlr(I.type),N.minf(I))},N.mfhd=function(I){return N.box(N.types.mfhd,new Uint8Array([0,0,0,0,I>>24,I>>16&255,I>>8&255,I&255]))},N.minf=function(I){return I.type==="audio"?N.box(N.types.minf,N.box(N.types.smhd,N.SMHD),N.DINF,N.stbl(I)):N.box(N.types.minf,N.box(N.types.vmhd,N.VMHD),N.DINF,N.stbl(I))},N.moof=function(I,O,L){return N.box(N.types.moof,N.mfhd(I),N.traf(L,O))},N.moov=function(I){for(var O=I.length,L=[];O--;)L[O]=N.trak(I[O]);return N.box.apply(null,[N.types.moov,N.mvhd(I[0].timescale,I[0].duration)].concat(L).concat(N.mvex(I)))},N.mvex=function(I){for(var O=I.length,L=[];O--;)L[O]=N.trex(I[O]);return N.box.apply(null,[N.types.mvex].concat(L))},N.mvhd=function(I,O){O*=I;var L=Math.floor(O/(Y+1)),T=Math.floor(O%(Y+1)),A=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,I>>24&255,I>>16&255,I>>8&255,I&255,L>>24,L>>16&255,L>>8&255,L&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 N.box(N.types.mvhd,A)},N.sdtp=function(I){var O=I.samples||[],L=new Uint8Array(4+O.length),T,A;for(T=0;T>>8&255),O.push(P&255),O=O.concat(Array.prototype.slice.call(A));for(T=0;T>>8&255),L.push(P&255),L=L.concat(Array.prototype.slice.call(A));var w=N.box(N.types.avcC,new Uint8Array([1,O[3],O[4],O[5],252|3,224|I.sps.length].concat(O).concat([I.pps.length]).concat(L))),S=I.width,x=I.height,h=I.pixelRatio[0],l=I.pixelRatio[1];return N.box(N.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,S>>8&255,S&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]),w,N.box(N.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),N.box(N.types.pasp,new Uint8Array([h>>24,h>>16&255,h>>8&255,h&255,l>>24,l>>16&255,l>>8&255,l&255])))},N.esds=function(I){var O=I.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(I.config).concat([6,1,2]))},N.mp4a=function(I){var O=I.samplerate;return N.box(N.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,I.channelCount,0,16,0,0,0,0,O>>8&255,O&255,0,0]),N.box(N.types.esds,N.esds(I)))},N.mp3=function(I){var O=I.samplerate;return N.box(N.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,I.channelCount,0,16,0,0,0,0,O>>8&255,O&255,0,0]))},N.stsd=function(I){return I.type==="audio"?!I.isAAC&&I.codec==="mp3"?N.box(N.types.stsd,N.STSD,N.mp3(I)):N.box(N.types.stsd,N.STSD,N.mp4a(I)):N.box(N.types.stsd,N.STSD,N.avc1(I))},N.tkhd=function(I){var O=I.id,L=I.duration*I.timescale,T=I.width,A=I.height,P=Math.floor(L/(Y+1)),w=Math.floor(L%(Y+1));return N.box(N.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,P>>24,P>>16&255,P>>8&255,P&255,w>>24,w>>16&255,w>>8&255,w&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,A>>8&255,A&255,0,0]))},N.traf=function(I,O){var L=N.sdtp(I),T=I.id,A=Math.floor(O/(Y+1)),P=Math.floor(O%(Y+1));return N.box(N.types.traf,N.box(N.types.tfhd,new Uint8Array([0,0,0,0,T>>24,T>>16&255,T>>8&255,T&255])),N.box(N.types.tfdt,new Uint8Array([1,0,0,0,A>>24,A>>16&255,A>>8&255,A&255,P>>24,P>>16&255,P>>8&255,P&255])),N.trun(I,L.length+16+20+8+16+8+8),L)},N.trak=function(I){return I.duration=I.duration||4294967295,N.box(N.types.trak,N.tkhd(I),N.mdia(I))},N.trex=function(I){var O=I.id;return N.box(N.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]))},N.trun=function(I,O){var L=I.samples||[],T=L.length,A=12+16*T,P=new Uint8Array(A),w,S,x,h,l,i;for(O+=8+A,P.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),w=0;w>>24&255,x>>>16&255,x>>>8&255,x&255,h>>>24&255,h>>>16&255,h>>>8&255,h&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*w);return N.box(N.types.trun,P)},N.initSegment=function(I){N.types||N.init();var O=N.moov(I),L=new Uint8Array(N.FTYP.byteLength+O.byteLength);return L.set(N.FTYP),L.set(O,N.FTYP.byteLength),L},N}();U.types=void 0,U.HDLR_TYPES=void 0,U.STTS=void 0,U.STSC=void 0,U.STCO=void 0,U.STSZ=void 0,U.VMHD=void 0,U.SMHD=void 0,U.STSD=void 0,U.FTYP=void 0,U.DINF=void 0,$.default=U},"./src/remux/mp4-remuxer.ts":function(oe,$,D){"use strict";D.r($),D.d($,"default",function(){return i}),D.d($,"normalizePts",function(){return c});var Y=D("./src/polyfills/number.ts"),U=D("./src/remux/aac-helper.ts"),N=D("./src/remux/mp4-generator.ts"),K=D("./src/events.ts"),I=D("./src/errors.ts"),O=D("./src/utils/logger.ts"),L=D("./src/types/loader.ts"),T=D("./src/utils/timescale-conversion.ts");function A(){return A=Object.assign||function(u){for(var E=1;E0?b:g.pts},f[0].pts);return s&&O.logger.debug("PTS rollover detected"),o},E.remux=function(f,s,o,b,g,_,k,H){var z,Z,G,B,te,de,pe=g,ye=g,Ce=f.pid>-1,_e=s.pid>-1,le=s.samples.length,se=f.samples.length>0,ve=le>1,ie=(!Ce||se)&&(!_e||ve)||this.ISGenerated||k;if(ie){this.ISGenerated||(G=this.generateIS(f,s,g));var q=this.isVideoContiguous,xe=-1;if(ve&&(xe=C(s.samples),!q&&this.config.forceKeyFrameOnDiscontinuity))if(de=!0,xe>0){O.logger.warn("[mp4-remuxer]: Dropped "+xe+" out of "+le+" video samples due to a missing keyframe");var Ie=this.getVideoStartPts(s.samples);s.samples=s.samples.slice(xe),s.dropped+=xe,ye+=(s.samples[0].pts-Ie)/(s.timescale||9e4)}else xe===-1&&(O.logger.warn("[mp4-remuxer]: No keyframe found out of "+le+" video samples"),de=!1);if(this.ISGenerated){if(se&&ve){var Ne=this.getVideoStartPts(s.samples),De=c(f.samples[0].pts,Ne)-Ne,Be=De/s.inputTimeScale;pe+=Math.max(0,Be),ye+=Math.max(0,-Be)}if(se){if(f.samplerate||(O.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),G=this.generateIS(f,s,g)),Z=this.remuxAudio(f,pe,this.isAudioContiguous,_,_e||ve||H===L.PlaylistLevelType.AUDIO?ye:void 0),ve){var Ae=Z?Z.endPTS-Z.startPTS:0;s.inputTimeScale||(O.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),G=this.generateIS(f,s,g)),z=this.remuxVideo(s,ye,q,Ae)}}else ve&&(z=this.remuxVideo(s,ye,q,0));z&&(z.firstKeyFrame=xe,z.independent=xe!==-1)}}return this.ISGenerated&&(o.samples.length&&(te=this.remuxID3(o,g)),b.samples.length&&(B=this.remuxText(b,g))),{audio:Z,video:z,initSegment:G,independent:de,text:B,id3:te}},E.generateIS=function(f,s,o){var b=f.samples,g=s.samples,_=this.typeSupported,k={},H=!Object(Y.isFiniteNumber)(this._initPTS),z="audio/mp4",Z,G,B;if(H&&(Z=G=Infinity),f.config&&b.length&&(f.timescale=f.samplerate,f.isAAC||(_.mpeg?(z="audio/mpeg",f.codec=""):_.mp3&&(f.codec="mp3")),k.audio={id:"audio",container:z,codec:f.codec,initSegment:!f.isAAC&&_.mpeg?new Uint8Array(0):N.default.initSegment([f]),metadata:{channelCount:f.channelCount}},H&&(B=f.inputTimeScale,Z=G=b[0].pts-Math.round(B*o))),s.sps&&s.pps&&g.length&&(s.timescale=s.inputTimeScale,k.video={id:"main",container:"video/mp4",codec:s.codec,initSegment:N.default.initSegment([s]),metadata:{width:s.width,height:s.height}},H)){B=s.inputTimeScale;var te=this.getVideoStartPts(g),de=Math.round(B*o);G=Math.min(G,c(g[0].dts,te)-de),Z=Math.min(Z,te-de)}if(Object.keys(k).length)return this.ISGenerated=!0,H&&(this._initPTS=Z,this._initDTS=G),{tracks:k,initPTS:Z,timescale:B}},E.remuxVideo=function(f,s,o,b){var g=f.inputTimeScale,_=f.samples,k=[],H=_.length,z=this._initPTS,Z=this.nextAvcDts,G=8,B,te,de,pe=Number.POSITIVE_INFINITY,ye=Number.NEGATIVE_INFINITY,Ce=0,_e=!1;if(!o||Z===null){var le=s*g,se=_[0].pts-c(_[0].dts,_[0].pts);Z=le-se}for(var ve=0;veie.pts){var q=9e4*.2;Ce=Math.max(Math.min(Ce,ie.pts-ie.dts),-1*q)}ie.dts<_[ve>0?ve-1:ve].dts&&(_e=!0)}_e&&_.sort(function(Dt,ot){var ft=Dt.dts-ot.dts,zt=Dt.pts-ot.pts;return ft||zt}),te=_[0].dts,de=_[_.length-1].dts;var xe=Math.round((de-te)/(H-1));if(Ce<0){if(Cexe,Pe=Be<-1;if(Ae||Pe){Ae?O.logger.warn("AVC: "+Object(T.toMsFromMpegTsClock)(Be,!0)+" ms ("+Be+"dts) hole between fragments detected, filling it"):O.logger.warn("AVC: "+Object(T.toMsFromMpegTsClock)(-Be,!0)+" ms ("+Be+"dts) overlapping between fragments detected"),te=Z;var We=_[0].pts-Be;_[0].dts=te,_[0].pts=We,O.logger.log("Video: First PTS/DTS adjusted: "+Object(T.toMsFromMpegTsClock)(We,!0)+"/"+Object(T.toMsFromMpegTsClock)(te,!0)+", delta: "+Object(T.toMsFromMpegTsClock)(Be,!0)+" ms")}}l&&(te=Math.max(0,te));for(var ze=0,qe=0,Ge=0;Ge0?Oe-1:Oe].dts;if(re.stretchShortVideoTrack&&this.nextAudioPts!==null){var ce=Math.floor(re.maxBufferHole*g),ue=(b?pe+b*g:this.nextAudioPts)-Pt.pts;ue>ce?(B=ue-ae,B<0&&(B=ae),O.logger.log("[mp4-remuxer]: It is approximately "+ue/90+" ms to the next segment; using duration "+B/90+" ms for the last video frame.")):B=ae}else B=ae}var we=Math.round(Pt.pts-Pt.dts);k.push(new v(Pt.key,B,Ue,we))}if(k.length&&x&&x<70){var Le=k[0].flags;Le.dependsOn=2,Le.isNonSync=0}console.assert(B!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=Z=de+B,this.isVideoContiguous=!0;var tt=N.default.moof(f.sequenceNumber++,te,A({},f,{samples:k})),Fe="video",$e={data1:tt,data2:gt,startPTS:pe/g,endPTS:(ye+B)/g,startDTS:te/g,endDTS:Z/g,type:Fe,hasAudio:!1,hasVideo:!0,nb:k.length,dropped:f.dropped};return f.samples=[],f.dropped=0,console.assert(gt.length,"MDAT length must not be zero"),$e},E.remuxAudio=function(f,s,o,b,g){var _=f.inputTimeScale,k=f.samplerate?f.samplerate:_,H=_/k,z=f.isAAC?w:S,Z=z*H,G=this._initPTS,B=!f.isAAC&&this.typeSupported.mpeg,te=[],de=f.samples,pe=B?0:8,ye=this.nextAudioPts||-1,Ce=s*_;if(this.isAudioContiguous=o=o||de.length&&ye>0&&(b&&Math.abs(Ce-ye)<9e3||Math.abs(c(de[0].pts-G,Ce)-ye)<20*Z),de.forEach(function(be){be.pts=c(be.pts-G,Ce)}),!o||ye<0){if(de=de.filter(function(be){return be.pts>=0}),!de.length)return;g===0?ye=0:b?ye=Math.max(0,Ce):ye=de[0].pts}if(f.isAAC)for(var _e=g!==void 0,le=this.config.maxAudioFramesDrift,se=0,ve=ye;se=le*Z&&Ie0){qe+=pe;try{ze=new Uint8Array(qe)}catch(be){this.observer.emit(K.Events.ERROR,K.Events.ERROR,{type:I.ErrorTypes.MUX_ERROR,details:I.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:qe,reason:"fail allocating audio mdat "+qe});return}if(!B){var gt=new DataView(ze.buffer);gt.setUint32(0,qe),ze.set(N.default.types.mdat,4)}}else return;ze.set(vt,pe);var yt=vt.byteLength;pe+=yt,te.push(new v(!0,z,yt,0)),We=lt}var Oe=te.length;if(!Oe)return;var Pt=te[te.length-1];this.nextAudioPts=ye=We+H*Pt.duration;var St=B?new Uint8Array(0):N.default.moof(f.sequenceNumber++,Pe/H,A({},f,{samples:te}));f.samples=[];var Ue=Pe/_,Ze=ye/_,Ee="audio",fe={data1:St,data2:ze,startPTS:Ue,endPTS:Ze,startDTS:Ue,endDTS:Ze,type:Ee,hasAudio:!0,hasVideo:!1,nb:Oe};return this.isAudioContiguous=!0,console.assert(ze.length,"MDAT length must not be zero"),fe},E.remuxEmptyAudio=function(f,s,o,b){var g=f.inputTimeScale,_=f.samplerate?f.samplerate:g,k=g/_,H=this.nextAudioPts,z=(H!==null?H:b.startDTS*g)+this._initDTS,Z=b.endDTS*g+this._initDTS,G=k*w,B=Math.ceil((Z-z)/G),te=U.default.getSilentFrame(f.manifestCodec||f.codec,f.channelCount);if(O.logger.warn("[mp4-remuxer]: remux empty Audio"),!te){O.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var de=[],pe=0;pe4294967296;)u+=d;return u}function C(u){for(var E=0;E0?this.lastEndDTS=f:(K.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var s=!!u.audio,o=!!u.video,b="";s&&(b+="audio"),o&&(b+="video");var g={data1:v,startPTS:d,startDTS:d,endPTS:f,endDTS:f,type:b,hasAudio:s,hasVideo:o,nb:1,dropped:0};return C.audio=g.type==="audio"?g:void 0,C.video=g.type!=="audio"?g:void 0,C.text=h,C.id3=x,C.initSegment=m,C},T}(),O=function(A,P,w){return Object(U.getStartDTS)(A,P)-w};function L(T,A){var P=T==null?void 0:T.codec;return P&&P.length>4?P:P==="hvc1"?"hvc1.1.c.L120.90":P==="av01"?"av01.0.04M.08":P==="avc1"||A===N.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}$.default=I},"./src/task-loop.ts":function(oe,$,D){"use strict";D.r($),D.d($,"default",function(){return Y});var Y=function(){function U(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var N=U.prototype;return N.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},N.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},N.onHandlerDestroyed=function(){},N.hasInterval=function(){return!!this._tickInterval},N.hasNextTick=function(){return!!this._tickTimer},N.setInterval=function(I){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,I),!0)},N.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},N.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},N.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},N.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},N.doTick=function(){},U}()},"./src/types/cmcd.ts":function(oe,$,D){"use strict";D.r($),D.d($,"CMCDVersion",function(){return Y}),D.d($,"CMCDObjectType",function(){return U}),D.d($,"CMCDStreamingFormat",function(){return N}),D.d($,"CMCDStreamType",function(){return K});var Y=1,U;(function(I){I.MANIFEST="m",I.AUDIO="a",I.VIDEO="v",I.MUXED="av",I.INIT="i",I.CAPTION="c",I.TIMED_TEXT="tt",I.KEY="k",I.OTHER="o"})(U||(U={}));var N;(function(I){I.DASH="d",I.HLS="h",I.SMOOTH="s",I.OTHER="o"})(N||(N={}));var K;(function(I){I.VOD="v",I.LIVE="l"})(K||(K={}))},"./src/types/level.ts":function(oe,$,D){"use strict";D.r($),D.d($,"HlsSkip",function(){return N}),D.d($,"getSkipValue",function(){return K}),D.d($,"HlsUrlParameters",function(){return I}),D.d($,"Level",function(){return O});function Y(L,T){for(var A=0;ANumber.MAX_SAFE_INTEGER?Infinity:T},I.hexadecimalInteger=function(L){if(this[L]){var T=(this[L]||"0x").slice(2);T=(T.length&1?"0":"")+T;for(var A=new Uint8Array(T.length/2),P=0;PNumber.MAX_SAFE_INTEGER?Infinity:T},I.decimalFloatingPoint=function(L){return parseFloat(this[L])},I.optionalFloat=function(L,T){var A=this[L];return A?parseFloat(A):T},I.enumeratedString=function(L){return this[L]},I.bool=function(L){return this[L]==="YES"},I.decimalResolution=function(L){var T=Y.exec(this[L]);return T===null?void 0:{width:parseInt(T[1],10),height:parseInt(T[2],10)}},K.parseAttrList=function(L){var T,A={},P='"';for(U.lastIndex=0;(T=U.exec(L))!==null;){var w=T[2];w.indexOf(P)===0&&w.lastIndexOf(P)===w.length-1&&(w=w.slice(1,-1)),A[T[1]]=w}return A},K}()},"./src/utils/binary-search.ts":function(oe,$,D){"use strict";D.r($);var Y={search:function(N,K){for(var I=0,O=N.length-1,L=null,T=null;I<=O;){L=(I+O)/2|0,T=N[L];var A=K(T);if(A>0)I=L+1;else if(A<0)O=L-1;else return T}return null}};$.default=Y},"./src/utils/buffer-helper.ts":function(oe,$,D){"use strict";D.r($),D.d($,"BufferHelper",function(){return N});var Y=D("./src/utils/logger.ts"),U={length:0,start:function(){return 0},end:function(){return 0}},N=function(){function K(){}return K.isBuffered=function(O,L){try{if(O){for(var T=K.getBuffered(O),A=0;A=T.start(A)&&L<=T.end(A))return!0}}catch(P){}return!1},K.bufferInfo=function(O,L,T){try{if(O){var A=K.getBuffered(O),P=[],w;for(w=0;wS&&(A[w-1].end=O[P].end):A.push(O[P])}else A.push(O[P])}else A=O;for(var x=0,h,l=L,i=L,c=0;c=C&&L=o&&Y.logger.log(this.time+" ["+o+"] "+b)},d}(),x=function(f){for(var s=[],o=0;oI&&(this.logger.log(w.DEBUG,"Too large cursor position "+this.pos),this.pos=I)},f.moveCursor=function(o){var b=this.pos+o;if(o>1)for(var g=this.pos+1;g=144&&this.backSpace();var b=N(o);if(this.pos>=I){this.logger.log(w.ERROR,"Cannot insert "+o.toString(16)+" ("+b+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(b,this.currPenState),this.moveCursor(1)},f.clearFromPos=function(o){var b;for(b=o;b0&&(o?g="["+b.join(" | ")+"]":g=b.join(` `)),g},f.getTextAndFormat=function(){return this.rows},d}(),C=function(){function d(s,o,b){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(b),this.nonDisplayedMemory=new c(b),this.lastOutputScreen=new c(b),this.currRollUpRow=this.displayedMemory.rows[K-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=b}var f=d.prototype;return f.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[K-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},f.getHandler=function(){return this.outputFilter},f.setHandler=function(o){this.outputFilter=o},f.setPAC=function(o){this.writeScreen.setPAC(o)},f.setBkgData=function(o){this.writeScreen.setBkgData(o)},f.setMode=function(o){if(o===this.mode)return;this.mode=o,this.logger.log(w.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},f.insertChars=function(o){for(var b=0;b=46,b.italics)b.foreground="white";else{var g=Math.floor(o/2)-16,_=["white","green","blue","cyan","red","yellow","magenta"];b.foreground=_[g]}this.logger.log(w.INFO,"MIDROW: "+JSON.stringify(b)),this.writeScreen.setPen(b)},f.outputDataUpdate=function(o){o===void 0&&(o=!1);var b=this.logger.time;if(b===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=b:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,b,this.lastOutputScreen),o&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:b),this.lastOutputScreen.copy(this.displayedMemory))},f.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,b){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var g=new S;this.channels=[null,new C(s,o,g),new C(s+1,b,g)],this.cmdHistory=E(),this.logger=g}var f=d.prototype;return f.getHandler=function(o){return this.channels[o].getHandler()},f.setHandler=function(o,b){this.channels[o].setHandler(b)},f.addData=function(o,b){var g,_,k,H=!1;this.logger.time=o;for(var z=0;z ("+x([_,k])+")"),g=this.parseCmd(_,k),g||(g=this.parseMidrow(_,k)),g||(g=this.parsePAC(_,k)),g||(g=this.parseBackgroundAttributes(_,k)),!g&&(H=this.parseChars(_,k),H)){var Z=this.currentChannel;if(Z&&Z>0){var G=this.channels[Z];G.insertChars(H)}else this.logger.log(w.WARNING,"No channel found yet. TEXT-MODE?")}!g&&!H&&this.logger.log(w.WARNING,"Couldn't parse cleaned data "+x([_,k])+" orig: "+x([b[z],b[z+1]]))}},f.parseCmd=function(o,b){var g=this.cmdHistory,_=(o===20||o===28||o===21||o===29)&&b>=32&&b<=47,k=(o===23||o===31)&&b>=33&&b<=35;if(!(_||k))return!1;if(u(o,b,g))return m(null,null,g),this.logger.log(w.DEBUG,"Repeated command ("+x([o,b])+") is dropped"),!0;var H=o===20||o===21||o===23?1:2,z=this.channels[H];return o===20||o===21||o===28||o===29?b===32?z.ccRCL():b===33?z.ccBS():b===34?z.ccAOF():b===35?z.ccAON():b===36?z.ccDER():b===37?z.ccRU(2):b===38?z.ccRU(3):b===39?z.ccRU(4):b===40?z.ccFON():b===41?z.ccRDC():b===42?z.ccTR():b===43?z.ccRTD():b===44?z.ccEDM():b===45?z.ccCR():b===46?z.ccENM():b===47&&z.ccEOC():z.ccTO(b-32),m(o,b,g),this.currentChannel=H,!0},f.parseMidrow=function(o,b){var g=0;if((o===17||o===25)&&b>=32&&b<=47){if(o===17?g=1:g=2,g!==this.currentChannel)return this.logger.log(w.ERROR,"Mismatch channel in midrow parsing"),!1;var _=this.channels[g];return _?(_.ccMIDROW(b),this.logger.log(w.DEBUG,"MIDROW ("+x([o,b])+")"),!0):!1}return!1},f.parsePAC=function(o,b){var g,_=this.cmdHistory,k=(o>=17&&o<=23||o>=25&&o<=31)&&b>=64&&b<=127,H=(o===16||o===24)&&b>=64&&b<=95;if(!(k||H))return!1;if(u(o,b,_))return m(null,null,_),!0;var z=o<=23?1:2;b>=64&&b<=95?g=z===1?O[o]:T[o]:g=z===1?L[o]:A[o];var Z=this.channels[z];return Z?(Z.setPAC(this.interpretPAC(g,b)),m(o,b,_),this.currentChannel=z,!0):!1},f.interpretPAC=function(o,b){var g,_={color:null,italics:!1,indent:null,underline:!1,row:o};return b>95?g=b-96:g=b-64,_.underline=(g&1)===1,g<=13?_.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(g/2)]:g<=15?(_.italics=!0,_.color="white"):_.indent=Math.floor((g-16)/2)*4,_},f.parseChars=function(o,b){var g,_=null,k=null;if(o>=25?(g=2,k=o-8):(g=1,k=o),k>=17&&k<=19){var H;k===17?H=b+80:k===18?H=b+112:H=b+144,this.logger.log(w.INFO,"Special char '"+N(H)+"' in channel "+g),_=[H]}else o>=32&&o<=127&&(_=b===0?[o]:[o,b]);if(_){var z=x(_);this.logger.log(w.DEBUG,"Char codes = "+z.join(",")),m(o,b,this.cmdHistory)}return _},f.parseBackgroundAttributes=function(o,b){var g=(o===16||o===24)&&b>=32&&b<=47,_=(o===23||o===31)&&b>=45&&b<=47;if(!(g||_))return!1;var k,H={};o===16||o===24?(k=Math.floor((b-32)/2),H.background=P[k],b%2===1&&(H.background=H.background+"_semi")):b===45?H.background="transparent":(H.foreground="black",b===47&&(H.underline=!0));var z=o<=23?1:2,Z=this.channels[z];return Z.setBkgData(H),m(o,b,this.cmdHistory),!0},f.reset=function(){for(var o=0;o=16?l--:l++;var m=Object(Y.fixLineBreaks)(i.trim()),u=Object(U.generateCueId)(T,A,m);(!L||!L.cues||!L.cues.getCueById(u))&&(x=new c(T,A,m),x.id=u,x.line=C+1,x.align="left",x.position=10+Math.min(80,Math.floor(l*8/32)*10),w.push(x))}return L&&w.length&&(w.sort(function(E,d){return E.line==="auto"||d.line==="auto"?0:E.line>8&&d.line>8?d.line-E.line:E.line-d.line}),w.forEach(function(E){return Object(N.addCueToTrack)(L,E)})),w}};$.default=I},"./src/utils/discontinuities.ts":function(oe,$,D){"use strict";D.r($),D.d($,"findFirstFragWithCC",function(){return K}),D.d($,"shouldAlignOnDiscontinuities",function(){return I}),D.d($,"findDiscontinuousReferenceFrag",function(){return O}),D.d($,"adjustSlidingStart",function(){return T}),D.d($,"alignStream",function(){return A}),D.d($,"alignPDT",function(){return w}),D.d($,"alignFragmentByPDTDelta",function(){return S}),D.d($,"alignMediaPlaylistByPDT",function(){return x});var Y=D("./src/polyfills/number.ts"),U=D("./src/utils/logger.ts"),N=D("./src/controller/level-helper.ts");function K(h,l){for(var i=null,c=0,C=h.length;ci.startCC||h&&h.cc=this.minWeight_},K.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},K.destroy=function(){},N}();$.default=U},"./src/utils/ewma.ts":function(oe,$,D){"use strict";D.r($);var Y=function(){function U(K,I,O){I===void 0&&(I=0),O===void 0&&(O=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=K,this.alpha_=K?Math.exp(Math.log(.5)/K):0,this.estimate_=I,this.totalWeight_=O}var N=U.prototype;return N.sample=function(I,O){var L=Math.pow(this.alpha_,I);this.estimate_=O*(1-L)+L*this.estimate_,this.totalWeight_+=I},N.getTotalWeight=function(){return this.totalWeight_},N.getEstimate=function(){if(this.alpha_){var I=1-Math.pow(this.alpha_,this.totalWeight_);if(I)return this.estimate_/I}return this.estimate_},U}();$.default=Y},"./src/utils/fetch-loader.ts":function(oe,$,D){"use strict";D.r($),D.d($,"fetchSupported",function(){return S});var Y=D("./src/polyfills/number.ts"),U=D("./src/loader/load-stats.ts"),N=D("./src/demux/chunk-cache.ts");function K(c,C){c.prototype=Object.create(C.prototype),c.prototype.constructor=c,A(c,C)}function I(c){var C=typeof Map=="function"?new Map:void 0;return I=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 C!="undefined"){if(C.has(m))return C.get(m);C.set(m,u)}function u(){return O(m,arguments,P(this).constructor)}return u.prototype=Object.create(m.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),A(u,m)},I(c)}function O(c,C,v){return L()?O=Reflect.construct:O=function(u,E,d){var f=[null];f.push.apply(f,E);var s=Function.bind.apply(u,f),o=new s;return d&&A(o,d.prototype),o},O.apply(null,arguments)}function L(){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 A(c,C){return A=Object.setPrototypeOf||function(m,u){return m.__proto__=u,m},A(c,C)}function P(c){return P=Object.setPrototypeOf?Object.getPrototypeOf:function(v){return v.__proto__||Object.getPrototypeOf(v)},P(c)}function w(){return w=Object.assign||function(c){for(var C=1;C=d&&f(u,E,s.flush(),m)):f(u,E,k,m),g()}).catch(function(){return Promise.reject()})};return b()},c}();function h(c,C){var v={method:"GET",mode:"cors",credentials:"same-origin",signal:C,headers:new self.Headers(w({},c.headers))};return c.rangeEnd&&v.headers.set("Range","bytes="+c.rangeStart+"-"+String(c.rangeEnd-1)),v}function l(c,C){return new self.Request(c.url,C)}var i=function(c){K(C,c);function C(v,m,u){var E;return E=c.call(this,v)||this,E.code=void 0,E.details=void 0,E.code=m,E.details=u,E}return C}(I(Error));$.default=x},"./src/utils/imsc1-ttml-parser.ts":function(oe,$,D){"use strict";D.r($),D.d($,"IMSC1_CODEC",function(){return T}),D.d($,"parseIMSC1",function(){return S});var Y=D("./src/utils/mp4-tools.ts"),U=D("./src/utils/vttparser.ts"),N=D("./src/utils/vttcue.ts"),K=D("./src/demux/id3.ts"),I=D("./src/utils/timescale-conversion.ts"),O=D("./src/utils/webvtt-parser.ts");function L(){return L=Object.assign||function(d){for(var f=1;f"):Y}function I(T){for(var A=arguments.length,P=new Array(A>1?A-1:0),w=1;w>24,C[v+1]=m>>16&255,C[v+2]=m>>8&255,C[v+3]=m&255}function A(C,v){var m=[];if(!v.length)return m;var u,E,d;"data"in C?(u=C.data,E=C.start,d=C.end):(u=C,E=0,d=u.byteLength);for(var f=E;f1?f+s:d;if(o===v[0])if(v.length===1)m.push({data:u,start:f+8,end:b});else{var g=A({data:u,start:f+8,end:b},v.slice(1));g.length&&K.apply(m,g)}f=b}return m}function P(C){var v=A(C,["moov"]),m=v[0],u=m?m.end:null,E=A(C,["sidx"]);if(!E||!E[0])return null;var d=[],f=E[0],s=f.data[0],o=s===0?8:16,b=L(f,o);o+=4;var g=0,_=0;s===0?o+=8:o+=16,o+=2;var k=f.end+_,H=O(f,o);o+=2;for(var z=0;z>>31;if(te===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var de=L(f,Z);Z+=4,d.push({referenceSize:B,subsegmentDuration:de,info:{duration:de/b,start:k,end:k+B-1}}),k+=B,Z+=4,o=Z}return{earliestPresentationTime:g,timescale:b,version:s,referencesCount:H,references:d,moovEndOffset:u}}function w(C){for(var v=[],m=A(C,["moov","trak"]),u=0;uI)&&(this.startTime=I),this.endTime=O,this.screen=L,this.timelineController.createCaptionsTrack(this.trackName)},N.reset=function(){this.cueRanges=[]},U}()},"./src/utils/texttrack-utils.ts":function(oe,$,D){"use strict";D.r($),D.d($,"sendAddTrackEvent",function(){return U}),D.d($,"addCueToTrack",function(){return N}),D.d($,"clearCurrentCues",function(){return K}),D.d($,"removeCuesInRange",function(){return I}),D.d($,"getCuesInRange",function(){return L});var Y=D("./src/utils/logger.ts");function U(T,A){var P;try{P=new Event("addtrack")}catch(w){P=document.createEvent("Event"),P.initEvent("addtrack",!1,!1)}P.track=T,A.dispatchEvent(P)}function N(T,A){var P=T.mode;if(P==="disabled"&&(T.mode="hidden"),T.cues&&!T.cues.getCueById(A.id))try{if(T.addCue(A),!T.cues.getCueById(A.id))throw new Error("addCue is failed for: "+A)}catch(S){Y.logger.debug("[texttrack-utils]: "+S);var w=new self.TextTrackCue(A.startTime,A.endTime,A.text);w.id=A.id,T.addCue(w)}P==="disabled"&&(T.mode=P)}function K(T){var A=T.mode;if(A==="disabled"&&(T.mode="hidden"),T.cues)for(var P=T.cues.length;P--;)T.removeCue(T.cues[P]);A==="disabled"&&(T.mode=A)}function I(T,A,P){var w=T.mode;if(w==="disabled"&&(T.mode="hidden"),T.cues&&T.cues.length>0)for(var S=L(T.cues,A,P),x=0;xT[P].endTime)return-1;for(var w=0,S=P;w<=S;){var x=Math.floor((S+w)/2);if(AT[x].startTime&&w-1)for(var x=S,h=T.length;x=A&&l.endTime<=P)w.push(l);else if(l.startTime>P)return w}return w}},"./src/utils/time-ranges.ts":function(oe,$,D){"use strict";D.r($);var Y={toString:function(N){for(var K="",I=N.length,O=0;O1?A-1:0),w=1;w100)throw new Error("Position must be between 0 and 100.");d=g,this.hasBeenReset=!0}})),Object.defineProperty(w,"positionAlign",O({},S,{get:function(){return f},set:function(g){var _=I(g);if(!_)throw new SyntaxError("An invalid or illegal string was specified.");f=_,this.hasBeenReset=!0}})),Object.defineProperty(w,"size",O({},S,{get:function(){return s},set:function(g){if(g<0||g>100)throw new Error("Size must be between 0 and 100.");s=g,this.hasBeenReset=!0}})),Object.defineProperty(w,"align",O({},S,{get:function(){return o},set:function(g){var _=I(g);if(!_)throw new SyntaxError("An invalid or illegal string was specified.");o=_,this.hasBeenReset=!0}})),w.displayState=void 0}return L.prototype.getCueAsHTML=function(){var T=self.WebVTT;return T.convertCueToDOMTree(self,this.text)},L}()},"./src/utils/vttparser.ts":function(oe,$,D){"use strict";D.r($),D.d($,"parseTimeStamp",function(){return N}),D.d($,"fixLineBreaks",function(){return A}),D.d($,"VTTParser",function(){return P});var Y=D("./src/utils/vttcue.ts"),U=function(){function w(){}var S=w.prototype;return S.decode=function(h,l){if(!h)return"";if(typeof h!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(h))},w}();function N(w){function S(h,l,i,c){return(h|0)*3600+(l|0)*60+(i|0)+parseFloat(c||0)}var x=w.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return x?parseFloat(x[2])>59?S(x[2],x[3],0,x[4]):S(x[1],x[2],x[3],x[4]):null}var K=function(){function w(){this.values=Object.create(null)}var S=w.prototype;return S.set=function(h,l){!this.get(h)&&l!==""&&(this.values[h]=l)},S.get=function(h,l,i){return i?this.has(h)?this.values[h]:l[i]:this.has(h)?this.values[h]:l},S.has=function(h){return h in this.values},S.alt=function(h,l,i){for(var c=0;c=0&&i<=100)return this.set(h,i),!0}return!1},w}();function I(w,S,x,h){var l=h?w.split(h):[w];for(var i in l){if(typeof l[i]!="string")continue;var c=l[i].split(x);if(c.length!==2)continue;var C=c[0],v=c[1];S(C,v)}}var O=new Y.default(0,0,""),L=O.align==="middle"?"middle":"center";function T(w,S,x){var h=w;function l(){var C=N(w);if(C===null)throw new Error("Malformed timestamp: "+h);return w=w.replace(/^[^\sa-zA-Z-]+/,""),C}function i(C,v){var m=new K;I(C,function(d,f){var s;switch(d){case"region":for(var o=x.length-1;o>=0;o--)if(x[o].id===f){m.set(d,x[o].region);break}break;case"vertical":m.alt(d,f,["rl","lr"]);break;case"line":s=f.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",L,"end"]);break;case"position":s=f.split(","),m.percent(d,s[0]),s.length===2&&m.alt("positionAlign",s[1],["start",L,"end","line-left","line-right","auto"]);break;case"size":m.percent(d,f);break;case"align":m.alt(d,f,["start",L,"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",L);var E=m.get("position","auto");E==="auto"&&O.position===50&&(E=v.align==="start"||v.align==="left"?0:v.align==="end"||v.align==="right"?100:50),v.position=E}function c(){w=w.replace(/^\s+/,"")}if(c(),S.startTime=l(),c(),w.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+h);w=w.substr(3),c(),S.endTime=l(),c(),i(w,S)}function A(w){return w.replace(//gi,` `)}var P=function(){function w(){this.state="INITIAL",this.buffer="",this.decoder=new U,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var S=w.prototype;return S.parse=function(h){var l=this;h&&(l.buffer+=l.decoder.decode(h,{stream:!0}));function i(){var E=l.buffer,d=0;for(E=A(E);d")===-1){l.cue.id=C;continue}case"CUE":if(!l.cue){l.state="BADCUE";continue}try{T(C,l.cue,l.regionList)}catch(E){l.cue=null,l.state="BADCUE";continue}l.state="CUETEXT";continue;case"CUETEXT":{var u=C.indexOf("-->")!==-1;if(!C||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+=C}continue;case"BADCUE":C||(l.state="ID")}}}catch(E){l.state==="CUETEXT"&&l.cue&&l.oncue&&l.oncue(l.cue),l.cue=null,l.state=l.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},S.flush=function(){var h=this;try{if((h.cue||h.state==="HEADER")&&(h.buffer+=` `,h.parse()),h.state==="INITIAL"||h.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(l){h.onparsingerror&&h.onparsingerror(l)}return h.onflush&&h.onflush(),this},w}()},"./src/utils/webvtt-parser.ts":function(oe,$,D){"use strict";D.r($),D.d($,"generateCueId",function(){return P}),D.d($,"parseWebVTT",function(){return S});var Y=D("./src/polyfills/number.ts"),U=D("./src/utils/vttparser.ts"),N=D("./src/demux/id3.ts"),K=D("./src/utils/timescale-conversion.ts"),I=D("./src/remux/mp4-remuxer.ts"),O=/\r\n|\n\r|\n|\r/g,L=function(h,l,i){return i===void 0&&(i=0),h.substr(i,l.length)===l},T=function(h){var l=parseInt(h.substr(-3)),i=parseInt(h.substr(-6,2)),c=parseInt(h.substr(-9,2)),C=h.length>9?parseInt(h.substr(0,h.indexOf(":"))):0;if(!Object(Y.isFiniteNumber)(l)||!Object(Y.isFiniteNumber)(i)||!Object(Y.isFiniteNumber)(c)||!Object(Y.isFiniteNumber)(C))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+h);return l+=1e3*i,l+=60*1e3*c,l+=60*60*1e3*C,l},A=function(h){for(var l=5381,i=h.length;i;)l=l*33^h.charCodeAt(--i);return(l>>>0).toString()};function P(x,h,l){return A(x.toString())+A(h.toString())+A(l)}var w=function(h,l,i){var c=h[l],C=h[c.prevCC];if(!C||!C.new&&c.new){h.ccOffset=h.presentationOffset=c.start,c.new=!1;return}for(;(v=C)!==null&&v!==void 0&&v.new;){var v;h.ccOffset+=c.start-C.start,c.new=!1,c=C,C=h[c.prevCC]}h.presentationOffset=i};function S(x,h,l,i,c,C,v,m){var u=new U.VTTParser,E=Object(N.utf8ArrayToStr)(new Uint8Array(x)).trim().replace(O,` `).split(` `),d=[],f=Object(K.toMpegTsClockFromTimescale)(h,l),s="00:00.000",o=0,b=0,g,_=!0,k=!1;u.oncue=function(H){var z=i[c],Z=i.ccOffset,G=(o-f)/9e4;if(z!=null&&z.new&&(b!==void 0?Z=i.ccOffset=z.start:w(i,c,G)),G&&(Z=G-i.presentationOffset),k){var B=H.endTime-H.startTime,te=Object(I.normalizePts)((H.startTime+Z-b)*9e4,C*9e4)/9e4;H.startTime=te,H.endTime=te+B}var de=H.text.trim();H.text=decodeURIComponent(encodeURIComponent(de)),H.id||(H.id=P(H.startTime,H.endTime,de)),H.endTime>0&&d.push(H)},u.onparsingerror=function(H){g=H},u.onflush=function(){if(g){m(g);return}v(d)},E.forEach(function(H){if(_)if(L(H,"X-TIMESTAMP-MAP=")){_=!1,k=!0,H.substr(16).split(",").forEach(function(z){L(z,"LOCAL:")?s=z.substr(6):L(z,"MPEGTS:")&&(o=parseInt(z.substr(7)))});try{b=T(s)/1e3}catch(z){k=!1,g=z}return}else H===""&&(_=!1);u.parse(H+` `)}),u.flush()}},"./src/utils/xhr-loader.ts":function(oe,$,D){"use strict";D.r($);var Y=D("./src/utils/logger.ts"),U=D("./src/loader/load-stats.ts"),N=/^age:\s*[\d.]+\s*$/m,K=function(){function I(L){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=L?L.xhrSetup:null,this.stats=new U.LoadStats,this.retryDelay=0}var O=I.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,A,P){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=A,this.callbacks=P,this.retryDelay=A.retryDelay,this.loadInternal()},O.loadInternal=function(){var T=this.config,A=this.context;if(!T)return;var P=this.loader=new self.XMLHttpRequest,w=this.stats;w.loading.first=0,w.loaded=0;var S=this.xhrSetup;try{if(S)try{S(P,A.url)}catch(l){P.open("GET",A.url,!0),S(P,A.url)}P.readyState||P.open("GET",A.url,!0);var x=this.context.headers;if(x)for(var h in x)P.setRequestHeader(h,x[h])}catch(l){this.callbacks.onError({code:P.status,text:l.message},A,P);return}A.rangeEnd&&P.setRequestHeader("Range","bytes="+A.rangeStart+"-"+(A.rangeEnd-1)),P.onreadystatechange=this.readystatechange.bind(this),P.onprogress=this.loadprogress.bind(this),P.responseType=A.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),T.timeout),P.send()},O.readystatechange=function(){var T=this.context,A=this.loader,P=this.stats;if(!T||!A)return;var w=A.readyState,S=this.config;if(P.aborted)return;if(w>=2)if(self.clearTimeout(this.requestTimeout),P.loading.first===0&&(P.loading.first=Math.max(self.performance.now(),P.loading.start)),w===4){A.onreadystatechange=null,A.onprogress=null;var x=A.status;if(x>=200&&x<300){P.loading.end=Math.max(self.performance.now(),P.loading.first);var h,l;if(T.responseType==="arraybuffer"?(h=A.response,l=h.byteLength):(h=A.responseText,l=h.length),P.loaded=P.total=l,!this.callbacks)return;var i=this.callbacks.onProgress;if(i&&i(P,T,h,A),!this.callbacks)return;var c={url:A.responseURL,data:h};this.callbacks.onSuccess(c,P,T,A)}else P.retry>=S.maxRetry||x>=400&&x<499?(Y.logger.error(x+" while loading "+T.url),this.callbacks.onError({code:x,text:A.statusText},T,A)):(Y.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,S.maxRetryDelay),P.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),S.timeout)},O.loadtimeout=function(){Y.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 A=this.stats;A.loaded=T.loaded,T.lengthComputable&&(A.total=T.total)},O.getCacheAge=function(){var T=null;if(this.loader&&N.test(this.loader.getAllResponseHeaders())){var A=this.loader.getResponseHeader("age");T=A?parseFloat(A):null}return T},I}();$.default=K}}).default})},vHTk:function(rt,Xe,X){rt.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}}}]);