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

361 lines
1.0 MiB

(window.webpackJsonp=window.webpackJsonp||[]).push([[219,7,8,9],{"+NIl":function(qe,Ke,V){(function(fe){fe(V("VrN/"))})(function(fe){"use strict";fe.defineMode("stex",function($,P){"use strict";function Y(T,C){T.cmdState.push(C)}function U(T){return T.cmdState.length>0?T.cmdState[T.cmdState.length-1]:null}function O(T){var C=T.cmdState.pop();C&&C.closeBracket()}function H(T){for(var C=T.cmdState,S=C.length-1;S>=0;S--){var f=C[S];if(f.name=="DEFAULT")continue;return f}return{styleIdentifier:function(){return null}}}function N(T,C,S){return function(){this.name=T,this.bracketNo=0,this.style=C,this.styles=S,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var k={};k.importmodule=N("importmodule","tag",["string","builtin"]),k.documentclass=N("documentclass","tag",["","atom"]),k.usepackage=N("usepackage","tag",["atom"]),k.begin=N("begin","tag",["atom"]),k.end=N("end","tag",["atom"]),k.label=N("label","tag",["atom"]),k.ref=N("ref","tag",["atom"]),k.eqref=N("eqref","tag",["atom"]),k.cite=N("cite","tag",["atom"]),k.bibitem=N("bibitem","tag",["atom"]),k.Bibitem=N("Bibitem","tag",["atom"]),k.RBibitem=N("RBibitem","tag",["atom"]),k.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function L(T,C){T.f=C}function _(T,C){var S;if(T.match(/^\\[a-zA-Z@]+/)){var f=T.current().slice(1);return S=k.hasOwnProperty(f)?k[f]:k.DEFAULT,S=new S,Y(C,S),L(C,D),S.style}if(T.match(/^\\[$&%#{}_]/))return"tag";if(T.match(/^\\[,;!\/\\]/))return"tag";if(T.match("\\["))return L(C,function(i,c){return w(i,c,"\\]")}),"keyword";if(T.match("\\("))return L(C,function(i,c){return w(i,c,"\\)")}),"keyword";if(T.match("$$"))return L(C,function(i,c){return w(i,c,"$$")}),"keyword";if(T.match("$"))return L(C,function(i,c){return w(i,c,"$")}),"keyword";var l=T.next();if(l=="%")return T.skipToEnd(),"comment";if(l=="}"||l=="]"){if(S=U(C),S)S.closeBracket(l),L(C,D);else return"error";return"bracket"}else return l=="{"||l=="["?(S=k.DEFAULT,S=new S,Y(C,S),"bracket"):/\d/.test(l)?(T.eatWhile(/[\w.%]/),"atom"):(T.eatWhile(/[\w\-_]/),S=H(C),S.name=="begin"&&(S.argument=T.current()),S.styleIdentifier())}function w(T,C,S){if(T.eatSpace())return null;if(S&&T.match(S))return L(C,_),"keyword";if(T.match(/^\\[a-zA-Z@]+/))return"tag";if(T.match(/^[a-zA-Z]+/))return"variable-2";if(T.match(/^\\[$&%#{}_]/))return"tag";if(T.match(/^\\[,;!\/]/))return"tag";if(T.match(/^[\^_&]/))return"tag";if(T.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(T.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var f=T.next();return f=="{"||f=="}"||f=="["||f=="]"||f=="("||f==")"?"bracket":f=="%"?(T.skipToEnd(),"comment"):"error"}function D(T,C){var S=T.peek(),f;return S=="{"||S=="["?(f=U(C),f.openBracket(S),T.eat(S),L(C,_),"bracket"):/[ \t\r]/.test(S)?(T.eat(S),null):(L(C,_),O(C),_(T,C))}return{startState:function(){var T=P.inMathMode?function(C,S){return w(C,S)}:_;return{cmdState:[],f:T}},copyState:function(T){return{cmdState:T.cmdState.slice(),f:T.f}},token:function(T,C){return C.f(T,C)},blankLine:function(T){T.f=_,T.cmdState.length=0},lineComment:"%"}}),fe.defineMIME("text/x-stex","stex"),fe.defineMIME("text/x-latex","stex")})},"+RXH":function(qe,Ke,V){qe.exports=V.p+"static/shu.a39bf729.svg"},"+yhJ":function(qe,Ke,V){qe.exports=V.p+"static/xixi.d492fb65.svg"},"0eGx":function(qe,Ke,V){qe.exports=V.p+"static/zhong.c1924b73.svg"},"19Vz":function(qe,Ke,V){(function(fe){fe(V("VrN/"))})(function(fe){fe.defineOption("placeholder","",function(N,k,L){var _=L&&L!=fe.Init;if(k&&!_)N.on("blur",U),N.on("change",O),N.on("swapDoc",O),fe.on(N.getInputField(),"compositionupdate",N.state.placeholderCompose=function(){Y(N)}),O(N);else if(!k&&_){N.off("blur",U),N.off("change",O),N.off("swapDoc",O),fe.off(N.getInputField(),"compositionupdate",N.state.placeholderCompose),$(N);var w=N.getWrapperElement();w.className=w.className.replace(" CodeMirror-empty","")}k&&!N.hasFocus()&&U(N)});function $(N){N.state.placeholder&&(N.state.placeholder.parentNode.removeChild(N.state.placeholder),N.state.placeholder=null)}function P(N){$(N);var k=N.state.placeholder=document.createElement("pre");k.style.cssText="height: 0; overflow: visible",k.style.direction=N.getOption("direction"),k.className="CodeMirror-placeholder CodeMirror-line-like";var L=N.getOption("placeholder");typeof L=="string"&&(L=document.createTextNode(L)),k.appendChild(L),N.display.lineSpace.insertBefore(k,N.display.lineSpace.firstChild)}function Y(N){setTimeout(function(){var k=!1,L=N.getInputField();L.nodeName=="TEXTAREA"?k=!L.value:N.lineCount()==1&&(k=!/[^\u200b]/.test(L.querySelector(".CodeMirror-line").textContent)),k?P(N):$(N)},20)}function U(N){H(N)&&P(N)}function O(N){var k=N.getWrapperElement(),L=H(N);k.className=k.className.replace(" CodeMirror-empty","")+(L?" CodeMirror-empty":""),L?P(N):$(N)}function H(N){return N.lineCount()===1&&N.getLine(0)===""}})},"1eCo":function(qe,Ke,V){(function(fe){fe(V("VrN/"))})(function(fe){"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},P={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};fe.defineMode("xml",function(Y,U){var O=Y.indentUnit,H={},N=U.htmlMode?$:P;for(var k in N)H[k]=N[k];for(var k in U)H[k]=U[k];var L,_;function w(a,g){function m(K){return g.tokenize=K,K(a,g)}var b=a.next();if(b=="<")return a.eat("!")?a.eat("[")?a.match("CDATA[")?m(C("atom","]]>")):null:a.match("--")?m(C("comment","-->")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),m(S(1))):null:a.eat("?")?(a.eatWhile(/[\w\._\-]/),g.tokenize=C("meta","?>"),"meta"):(L=a.eat("/")?"closeTag":"openTag",g.tokenize=D,"tag bracket");if(b=="&"){var M;return a.eat("#")?a.eat("x")?M=a.eatWhile(/[a-fA-F\d]/)&&a.eat(";"):M=a.eatWhile(/[\d]/)&&a.eat(";"):M=a.eatWhile(/[\w\.\-:]/)&&a.eat(";"),M?"atom":"error"}else return a.eatWhile(/[^&<]/),null}w.isInText=!0;function D(a,g){var m=a.next();if(m==">"||m=="/"&&a.eat(">"))return g.tokenize=w,L=m==">"?"endTag":"selfcloseTag","tag bracket";if(m=="=")return L="equals",null;if(m=="<"){g.tokenize=w,g.state=c,g.tagName=g.tagStart=null;var b=g.tokenize(a,g);return b?b+" tag error":"tag error"}else return/[\'\"]/.test(m)?(g.tokenize=T(m),g.stringStartCol=a.column(),g.tokenize(a,g)):(a.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function T(a){var g=function(m,b){for(;!m.eol();)if(m.next()==a){b.tokenize=D;break}return"string"};return g.isInAttribute=!0,g}function C(a,g){return function(m,b){for(;!m.eol();){if(m.match(g)){b.tokenize=w;break}m.next()}return a}}function S(a){return function(g,m){for(var b;(b=g.next())!=null;){if(b=="<")return m.tokenize=S(a+1),m.tokenize(g,m);if(b==">")if(a==1){m.tokenize=w;break}else return m.tokenize=S(a-1),m.tokenize(g,m)}return"meta"}}function f(a,g,m){this.prev=a.context,this.tagName=g,this.indent=a.indented,this.startOfLine=m,(H.doNotIndent.hasOwnProperty(g)||a.context&&a.context.noIndent)&&(this.noIndent=!0)}function l(a){a.context&&(a.context=a.context.prev)}function i(a,g){for(var m;;){if(!a.context)return;if(m=a.context.tagName,!H.contextGrabbers.hasOwnProperty(m)||!H.contextGrabbers[m].hasOwnProperty(g))return;l(a)}}function c(a,g,m){return a=="openTag"?(m.tagStart=g.column(),E):a=="closeTag"?v:c}function E(a,g,m){return a=="word"?(m.tagName=g.current(),_="tag",y):H.allowMissingTagName&&a=="endTag"?(_="tag bracket",y(a,g,m)):(_="error",E)}function v(a,g,m){if(a=="word"){var b=g.current();return m.context&&m.context.tagName!=b&&H.implicitlyClosed.hasOwnProperty(m.context.tagName)&&l(m),m.context&&m.context.tagName==b||H.matchClosing===!1?(_="tag",p):(_="tag error",u)}else return H.allowMissingTagName&&a=="endTag"?(_="tag bracket",p(a,g,m)):(_="error",u)}function p(a,g,m){return a!="endTag"?(_="error",p):(l(m),c)}function u(a,g,m){return _="error",p(a,g,m)}function y(a,g,m){if(a=="word")return _="attribute",d;if(a=="endTag"||a=="selfcloseTag"){var b=m.tagName,M=m.tagStart;return m.tagName=m.tagStart=null,a=="selfcloseTag"||H.autoSelfClosers.hasOwnProperty(b)?i(m,b):(i(m,b),m.context=new f(m,b,M==m.indented)),c}return _="error",y}function d(a,g,m){return a=="equals"?h:(H.allowMissing||(_="error"),y(a,g,m))}function h(a,g,m){return a=="string"?s:a=="word"&&H.allowUnquoted?(_="string",y):(_="error",y(a,g,m))}function s(a,g,m){return a=="string"?s:y(a,g,m)}return{startState:function(a){var g={tokenize:w,state:c,indented:a||0,tagName:null,tagStart:null,context:null};return a!=null&&(g.baseIndent=a),g},token:function(a,g){if(!g.tagName&&a.sol()&&(g.indented=a.indentation()),a.eatSpace())return null;L=null;var m=g.tokenize(a,g);return(m||L)&&m!="comment"&&(_=null,g.state=g.state(L||m,a,g),_&&(m=_=="error"?m+" error":_)),m},indent:function(a,g,m){var b=a.context;if(a.tokenize.isInAttribute)return a.tagStart==a.indented?a.stringStartCol+1:a.indented+O;if(b&&b.noIndent)return fe.Pass;if(a.tokenize!=D&&a.tokenize!=w)return m?m.match(/^(\s*)/)[0].length:0;if(a.tagName)return H.multilineTagIndentPastTag!==!1?a.tagStart+a.tagName.length+2:a.tagStart+O*(H.multilineTagIndentFactor||1);if(H.alignCDATA&&/<!\[CDATA\[/.test(g))return 0;var M=g&&/^<(\/)?([\w_:\.-]*)/.exec(g);if(M&&M[1])for(;b;)if(b.tagName==M[2]){b=b.prev;break}else if(H.implicitlyClosed.hasOwnProperty(b.tagName))b=b.prev;else break;else if(M)for(;b;){var K=H.contextGrabbers[b.tagName];if(K&&K.hasOwnProperty(M[2]))b=b.prev;else break}for(;b&&b.prev&&!b.startOfLine;)b=b.prev;return b?b.indent+O:a.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:H.htmlMode?"html":"xml",helperType:H.htmlMode?"html":"xml",skipAttribute:function(a){a.state==h&&(a.state=y)},xmlCurrentTag:function(a){return a.tagName?{name:a.tagName,close:a.type=="closeTag"}:null},xmlCurrentContext:function(a){for(var g=[],m=a.context;m;m=m.prev)m.tagName&&g.push(m.tagName);return g.reverse()}}}),fe.defineMIME("text/xml","xml"),fe.defineMIME("application/xml","xml"),fe.mimeModes.hasOwnProperty("text/html")||fe.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"2sxD":function(qe,Ke,V){qe.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(qe,Ke,V){qe.exports=V.p+"static/sc.c1696770.svg"},"5MlY":function(qe,Ke,V){qe.exports=V.p+"static/sm.8ccb50bf.svg"},"6+eU":function(qe,Ke,V){"use strict";V.d(Ke,"a",function(){return p});var fe=V("wx14"),$=V("rePB"),P=V("VTBJ"),Y=V("1OyB"),U=V("vuIU"),O=V("Ji7U"),H=V("LK+K"),N=V("q1tI"),k=V.n(N),L=V("TSYQ"),_=V.n(L),w=function(y){var d,h="".concat(y.rootPrefixCls,"-item"),s=_()(h,"".concat(h,"-").concat(y.page),(d={},Object($.a)(d,"".concat(h,"-active"),y.active),Object($.a)(d,y.className,!!y.className),Object($.a)(d,"".concat(h,"-disabled"),!y.page),d)),a=function(){y.onClick(y.page)},g=function(b){y.onKeyPress(b,y.onClick,y.page)};return k.a.createElement("li",{title:y.showTitle?y.page:null,className:s,onClick:a,onKeyPress:g,tabIndex:"0"},y.itemRender(y.page,"page",k.a.createElement("a",{rel:"nofollow"},y.page)))},D=w,T={ZERO:48,NINE:57,NUMPAD_ZERO:96,NUMPAD_NINE:105,BACKSPACE:8,DELETE:46,ENTER:13,ARROW_UP:38,ARROW_DOWN:40},C=function(u){Object(O.a)(d,u);var y=Object(H.a)(d);function d(){var h;Object(Y.a)(this,d);for(var s=arguments.length,a=new Array(s),g=0;g<s;g++)a[g]=arguments[g];return h=y.call.apply(y,[this].concat(a)),h.state={goInputText:""},h.buildOptionText=function(m){return"".concat(m," ").concat(h.props.locale.items_per_page)},h.changeSize=function(m){h.props.changeSize(Number(m))},h.handleChange=function(m){h.setState({goInputText:m.target.value})},h.handleBlur=function(m){var b=h.props,M=b.goButton,K=b.quickGo,z=b.rootPrefixCls,ee=h.state.goInputText;if(M||ee==="")return;if(m.relatedTarget&&(m.relatedTarget.className.indexOf("".concat(z,"-prev"))>=0||m.relatedTarget.className.indexOf("".concat(z,"-next"))>=0))return;h.setState({goInputText:""}),K(h.getValidValue())},h.go=function(m){var b=h.state.goInputText;if(b==="")return;(m.keyCode===T.ENTER||m.type==="click")&&(h.setState({goInputText:""}),h.props.quickGo(h.getValidValue()))},h}return Object(U.a)(d,[{key:"getValidValue",value:function(){var s=this.state,a=s.goInputText,g=s.current;return!a||isNaN(a)?g:Number(a)}},{key:"getPageSizeOptions",value:function(){var s=this.props,a=s.pageSize,g=s.pageSizeOptions;return g.some(function(m){return m.toString()===a.toString()})?g:g.concat([a.toString()]).sort(function(m,b){var M=isNaN(Number(m))?0:Number(m),K=isNaN(Number(b))?0:Number(b);return M-K})}},{key:"render",value:function(){var s=this,a=this.props,g=a.pageSize,m=a.locale,b=a.rootPrefixCls,M=a.changeSize,K=a.quickGo,z=a.goButton,ee=a.selectComponentClass,G=a.buildOptionText,F=a.selectPrefixCls,ie=a.disabled,ge=this.state.goInputText,ye="".concat(b,"-options"),xe=ee,Te=null,Se=null,me=null;if(!M&&!K)return null;var pe=this.getPageSizeOptions();if(M&&xe){var Ee=pe.map(function(le,I){return k.a.createElement(xe.Option,{key:I,value:le.toString()},(G||s.buildOptionText)(le))});Te=k.a.createElement(xe,{disabled:ie,prefixCls:F,showSearch:!1,className:"".concat(ye,"-size-changer"),optionLabelProp:"children",dropdownMatchSelectWidth:!1,value:(g||pe[0]).toString(),onChange:this.changeSize,getPopupContainer:function(I){return I.parentNode}},Ee)}return K&&(z&&(me=typeof z=="boolean"?k.a.createElement("button",{type:"button",onClick:this.go,onKeyUp:this.go,disabled:ie,className:"".concat(ye,"-quick-jumper-button")},m.jump_to_confirm):k.a.createElement("span",{onClick:this.go,onKeyUp:this.go},z)),Se=k.a.createElement("div",{className:"".concat(ye,"-quick-jumper")},m.jump_to,k.a.createElement("input",{disabled:ie,type:"text",value:ge,onChange:this.handleChange,onKeyUp:this.go,onBlur:this.handleBlur}),m.page,me)),k.a.createElement("li",{className:"".concat(ye)},Te,Se)}}]),d}(k.a.Component);C.defaultProps={pageSizeOptions:["10","20","50","100"]};var S=C,f=V("N2Kk");function l(){}function i(u){return typeof u=="number"&&isFinite(u)&&Math.floor(u)===u}function c(u,y,d){return d}function E(u,y,d){var h=typeof u=="undefined"?y.pageSize:u;return Math.floor((d.total-1)/h)+1}var v=function(u){Object(O.a)(d,u);var y=Object(H.a)(d);function d(h){var s;Object(Y.a)(this,d),s=y.call(this,h),s.getJumpPrevPage=function(){return Math.max(1,s.state.current-(s.props.showLessItems?3:5))},s.getJumpNextPage=function(){return Math.min(E(void 0,s.state,s.props),s.state.current+(s.props.showLessItems?3:5))},s.getItemIcon=function(M,K){var z=s.props.prefixCls,ee=M||k.a.createElement("button",{type:"button","aria-label":K,className:"".concat(z,"-item-link")});return typeof M=="function"&&(ee=k.a.createElement(M,Object(P.a)({},s.props))),ee},s.savePaginationNode=function(M){s.paginationNode=M},s.isValid=function(M){return i(M)&&M!==s.state.current},s.shouldDisplayQuickJumper=function(){var M=s.props,K=M.showQuickJumper,z=M.pageSize,ee=M.total;return ee<=z?!1:K},s.handleKeyDown=function(M){(M.keyCode===T.ARROW_UP||M.keyCode===T.ARROW_DOWN)&&M.preventDefault()},s.handleKeyUp=function(M){var K=s.getValidValue(M),z=s.state.currentInputValue;K!==z&&s.setState({currentInputValue:K}),M.keyCode===T.ENTER?s.handleChange(K):M.keyCode===T.ARROW_UP?s.handleChange(K-1):M.keyCode===T.ARROW_DOWN&&s.handleChange(K+1)},s.changePageSize=function(M){var K=s.state.current,z=E(M,s.state,s.props);K=K>z?z:K,z===0&&(K=s.state.current),typeof M=="number"&&("pageSize"in s.props||s.setState({pageSize:M}),"current"in s.props||s.setState({current:K,currentInputValue:K})),s.props.onShowSizeChange(K,M),"onChange"in s.props&&s.props.onChange&&s.props.onChange(K,M)},s.handleChange=function(M){var K=s.props.disabled,z=M;if(s.isValid(z)&&!K){var ee=E(void 0,s.state,s.props);z>ee?z=ee: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.current<E(void 0,s.state,s.props)},s.runIfEnter=function(M,K){if(M.key==="Enter"||M.charCode===13){for(var z=arguments.length,ee=new Array(z>2?z-2:0),G=2;G<z;G++)ee[G-2]=arguments[G];K.apply(void 0,ee)}},s.runIfEnterPrev=function(M){s.runIfEnter(M,s.prev)},s.runIfEnterNext=function(M){s.runIfEnter(M,s.next)},s.runIfEnterJumpPrev=function(M){s.runIfEnter(M,s.jumpPrev)},s.runIfEnterJumpNext=function(M){s.runIfEnter(M,s.jumpNext)},s.handleGoTO=function(M){(M.keyCode===T.ENTER||M.type==="click")&&s.handleChange(s.state.currentInputValue)};var a=h.onChange!==l,g="current"in h;g&&!a&&console.warn("Warning: You provided a `current` prop to a Pagination component without an `onChange` handler. This will render a read-only component.");var m=h.defaultCurrent;"current"in h&&(m=h.current);var b=h.defaultPageSize;return"pageSize"in h&&(b=h.pageSize),m=Math.min(m,E(b,void 0,h)),s.state={current:m,currentInputValue:m,pageSize:b},s}return Object(U.a)(d,[{key:"componentDidUpdate",value:function(s,a){var g=this.props.prefixCls;if(a.current!==this.state.current&&this.paginationNode){var m=this.paginationNode.querySelector(".".concat(g,"-item-").concat(a.current));m&&document.activeElement===m&&m.blur()}}},{key:"getValidValue",value:function(s){var a=s.target.value,g=E(void 0,this.state,this.props),m=this.state.currentInputValue,b;return a===""?b=a:isNaN(Number(a))?b=m:a>=g?b=g:b=Number(a),b}},{key:"getShowSizeChanger",value:function(){var s=this.props,a=s.showSizeChanger,g=s.total,m=s.totalBoundaryShowSizeChanger;return typeof a!="undefined"?a:g>m}},{key:"renderPrev",value:function(s){var a=this.props,g=a.prevIcon,m=a.itemRender,b=m(s,"prev",this.getItemIcon(g,"prev page")),M=!this.hasPrev();return Object(N.isValidElement)(b)?Object(N.cloneElement)(b,{disabled:M}):b}},{key:"renderNext",value:function(s){var a=this.props,g=a.nextIcon,m=a.itemRender,b=m(s,"next",this.getItemIcon(g,"next page")),M=!this.hasNext();return Object(N.isValidElement)(b)?Object(N.cloneElement)(b,{disabled:M}):b}},{key:"render",value:function(){var s=this,a=this.props,g=a.prefixCls,m=a.className,b=a.style,M=a.disabled,K=a.hideOnSinglePage,z=a.total,ee=a.locale,G=a.showQuickJumper,F=a.showLessItems,ie=a.showTitle,ge=a.showTotal,ye=a.simple,xe=a.itemRender,Te=a.showPrevNextJumpers,Se=a.jumpPrevIcon,me=a.jumpNextIcon,pe=a.selectComponentClass,Ee=a.selectPrefixCls,le=a.pageSizeOptions,I=this.state,x=I.current,R=I.pageSize,W=I.currentInputValue;if(K===!0&&z<=R)return null;var J=E(void 0,this.state,this.props),B=[],de=null,_e=null,Re=null,Oe=null,ke=null,Ie=G&&G.goButton,De=F?1:2,Ve=x-1>0?x-1:0,Qe=x+1<J?x+1:J,at=Object.keys(this.props).reduce(function(te,ne){return(ne.substr(0,5)==="data-"||ne.substr(0,5)==="aria-"||ne==="role")&&(te[ne]=s.props[ne]),te},{});if(ye)return Ie&&(typeof Ie=="boolean"?ke=k.a.createElement("button",{type:"button",onClick:this.handleGoTO,onKeyUp:this.handleGoTO},ee.jump_to_confirm):ke=k.a.createElement("span",{onClick:this.handleGoTO,onKeyUp:this.handleGoTO},Ie),ke=k.a.createElement("li",{title:ie?"".concat(ee.jump_to).concat(x,"/").concat(J):null,className:"".concat(g,"-simple-pager")},ke)),k.a.createElement("ul",Object(fe.a)({className:_()(g,"".concat(g,"-simple"),Object($.a)({},"".concat(g,"-disabled"),M),m),style:b,ref:this.savePaginationNode},at),k.a.createElement("li",{title:ie?ee.prev_page:null,onClick:this.prev,tabIndex:this.hasPrev()?0:null,onKeyPress:this.runIfEnterPrev,className:_()("".concat(g,"-prev"),Object($.a)({},"".concat(g,"-disabled"),!this.hasPrev())),"aria-disabled":!this.hasPrev()},this.renderPrev(Ve)),k.a.createElement("li",{title:ie?"".concat(x,"/").concat(J):null,className:"".concat(g,"-simple-pager")},k.a.createElement("input",{type:"text",value:W,disabled:M,onKeyDown:this.handleKeyDown,onKeyUp:this.handleKeyUp,onChange:this.handleKeyUp,size:"3"}),k.a.createElement("span",{className:"".concat(g,"-slash")},"/"),J),k.a.createElement("li",{title:ie?ee.next_page:null,onClick:this.next,tabIndex:this.hasPrev()?0:null,onKeyPress:this.runIfEnterNext,className:_()("".concat(g,"-next"),Object($.a)({},"".concat(g,"-disabled"),!this.hasNext())),"aria-disabled":!this.hasNext()},this.renderNext(Qe)),ke);if(J<=3+De*2){var Ze={locale:ee,rootPrefixCls:g,onClick:this.handleChange,onKeyPress:this.runIfEnter,showTitle:ie,itemRender:xe};J||B.push(k.a.createElement(D,Object(fe.a)({},Ze,{key:"noPager",page:J,className:"".concat(g,"-disabled")})));for(var yt=1;yt<=J;yt+=1){var rt=x===yt;B.push(k.a.createElement(D,Object(fe.a)({},Ze,{key:yt,page:yt,active:rt})))}}else{var dt=F?ee.prev_3:ee.prev_5,Me=F?ee.next_3:ee.next_5;Te&&(de=k.a.createElement("li",{title:ie?dt:null,key:"prev",onClick:this.jumpPrev,tabIndex:"0",onKeyPress:this.runIfEnterJumpPrev,className:_()("".concat(g,"-jump-prev"),Object($.a)({},"".concat(g,"-jump-prev-custom-icon"),!!Se))},xe(this.getJumpPrevPage(),"jump-prev",this.getItemIcon(Se,"prev page"))),_e=k.a.createElement("li",{title:ie?Me:null,key:"next",tabIndex:"0",onClick:this.jumpNext,onKeyPress:this.runIfEnterJumpNext,className:_()("".concat(g,"-jump-next"),Object($.a)({},"".concat(g,"-jump-next-custom-icon"),!!me))},xe(this.getJumpNextPage(),"jump-next",this.getItemIcon(me,"next page")))),Oe=k.a.createElement(D,{locale:ee,last:!0,rootPrefixCls:g,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:J,page:J,active:!1,showTitle:ie,itemRender:xe}),Re=k.a.createElement(D,{locale:ee,rootPrefixCls:g,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:1,page:1,active:!1,showTitle:ie,itemRender:xe});var xt=Math.max(1,x-De),mt=Math.min(x+De,J);x-1<=De&&(mt=1+De*2),J-x<=De&&(xt=J-De*2);for(var se=xt;se<=mt;se+=1){var Z=x===se;B.push(k.a.createElement(D,{locale:ee,rootPrefixCls:g,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:se,page:se,active:Z,showTitle:ie,itemRender:xe}))}x-1>=De*2&&x!==1+2&&(B[0]=Object(N.cloneElement)(B[0],{className:"".concat(g,"-item-after-jump-prev")}),B.unshift(de)),J-x>=De*2&&x!==J-2&&(B[B.length-1]=Object(N.cloneElement)(B[B.length-1],{className:"".concat(g,"-item-before-jump-next")}),B.push(_e)),xt!==1&&B.unshift(Re),mt!==J&&B.push(Oe)}var q=null;ge&&(q=k.a.createElement("li",{className:"".concat(g,"-total-text")},ge(z,[z===0?0:(x-1)*R+1,x*R>z?z:x*R])));var ae=!this.hasPrev()||!J,ue=!this.hasNext()||!J;return k.a.createElement("ul",Object(fe.a)({className:_()(g,m,Object($.a)({},"".concat(g,"-disabled"),M)),style:b,unselectable:"unselectable",ref:this.savePaginationNode},at),q,k.a.createElement("li",{title:ie?ee.prev_page:null,onClick:this.prev,tabIndex:ae?null:0,onKeyPress:this.runIfEnterPrev,className:_()("".concat(g,"-prev"),Object($.a)({},"".concat(g,"-disabled"),ae)),"aria-disabled":ae},this.renderPrev(Ve)),B,k.a.createElement("li",{title:ie?ee.next_page:null,onClick:this.next,tabIndex:ue?null:0,onKeyPress:this.runIfEnterNext,className:_()("".concat(g,"-next"),Object($.a)({},"".concat(g,"-disabled"),ue)),"aria-disabled":ue},this.renderNext(Qe)),k.a.createElement(S,{disabled:M,locale:ee,rootPrefixCls:g,selectComponentClass:pe,selectPrefixCls:Ee,changeSize:this.getShowSizeChanger()?this.changePageSize:null,current:x,pageSize:R,pageSizeOptions:le,quickGo:this.shouldDisplayQuickJumper()?this.handleChange:null,goButton:Ie}))}}],[{key:"getDerivedStateFromProps",value:function(s,a){var g={};if("current"in s&&(g.current=s.current,s.current!==a.current&&(g.currentInputValue=g.current)),"pageSize"in s&&s.pageSize!==a.pageSize){var m=a.current,b=E(s.pageSize,a,s);m=m>b?b:m,"current"in s||(g.current=m,g.currentInputValue=m),g.pageSize=s.pageSize}return g}}]),d}(k.a.Component);v.defaultProps={defaultCurrent:1,total:0,defaultPageSize:10,onChange:l,className:"",selectPrefixCls:"rc-select",prefixCls:"rc-pagination",selectComponentClass:null,hideOnSinglePage:!1,showPrevNextJumpers:!0,showQuickJumper:!1,showLessItems:!1,showTitle:!0,onShowSizeChange:l,locale:f.a,style:{},itemRender:c,totalBoundaryShowSizeChanger:50};var p=v},"6K3P":function(qe,Ke,V){qe.exports=V.p+"static/jinshi.9b74f304.svg"},"7Cbv":function(qe,Ke,V){"use strict";var fe=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),$=new Uint8Array(16);function P(){if(!fe)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return fe($)}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(D){return typeof D=="string"&&Y.test(D)}for(var O=U,H=[],N=0;N<256;++N)H.push((N+256).toString(16).substr(1));function k(D){var T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,C=(H[D[T+0]]+H[D[T+1]]+H[D[T+2]]+H[D[T+3]]+"-"+H[D[T+4]]+H[D[T+5]]+"-"+H[D[T+6]]+H[D[T+7]]+"-"+H[D[T+8]]+H[D[T+9]]+"-"+H[D[T+10]]+H[D[T+11]]+H[D[T+12]]+H[D[T+13]]+H[D[T+14]]+H[D[T+15]]).toLowerCase();if(!O(C))throw TypeError("Stringified UUID is invalid");return C}var L=k;function _(D,T,C){D=D||{};var S=D.random||(D.rng||P)();if(S[6]=S[6]&15|64,S[8]=S[8]&63|128,T){C=C||0;for(var f=0;f<16;++f)T[C+f]=S[f];return T}return L(S)}var w=Ke.a=_},"7ahc":function(qe,Ke,V){"use strict";V.d(Ke,"a",function(){return E});var fe=V("k1fw"),$=V("0Owb"),P=V("+L6B"),Y=V("2/Rp"),U=V("y8nQ"),O=V("Vl3Y"),H=V("tJVT"),N=V("OaEy"),k=V("2fM7"),L=V("q1tI"),_=V.n(L),w=V("VrN/"),D=V.n(w),T=V("p77/"),C=V.n(T),S=V("c5Ni"),f=V.n(S),l=k.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"]};Ke.b=function(v){var p=v.callback,u=v.onCancel,y=Object(L.useState)("python"),d=Object(H.a)(y,2),h=d[0],s=d[1];function a(m){s(c[m][1])}function g(m){p(m)}return _.a.createElement(O.a,Object($.a)({},i,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:g}),_.a.createElement(O.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},_.a.createElement(k.a,{onChange:a},Object.keys(c).map(function(m){return _.a.createElement(l,{key:m,value:m},c[m][0])}))),_.a.createElement(O.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},_.a.createElement(E,{mode:h})),_.a.createElement("div",{className:"flex-container flex-end"},_.a.createElement(Y.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),_.a.createElement(Y.a,{type:"ghost",onClick:u},"\u53D6\u6D88")))};function E(v){var p=v.value,u=v.onChange,y=v.mode,d=v.options,h=d===void 0?{}:d,s=Object(L.useRef)(),a=Object(L.useState)(),g=Object(H.a)(a,2),m=g[0],b=g[1];return Object(L.useEffect)(function(){if(m){function M(K){var z=K.getValue();u&&u(z)}return m.on("change",M),function(){m.off("change",M)}}},[m,u]),Object(L.useEffect)(function(){m&&m.setOption("mode",y)},[m,y]),Object(L.useEffect)(function(){m&&((p!==m.getValue()||p==="")&&setTimeout(function(){m.setValue(p||" ")},300))},[m,p]),Object(L.useEffect)(function(){if(s.current&&!m){var M=D.a.fromTextArea(s.current,Object(fe.a)({mode:y,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},h));b(M)}},[s.current,m]),_.a.createElement("div",{className:"my-codemirror-container"},_.a.createElement("textarea",{ref:s}))}},"7ixt":function(qe,Ke,V){"use strict";V.d(Ke,"a",function(){return P});var fe={adjustX:1,adjustY:1},$=[0,0],P={left:{points:["cr","cl"],overflow:fe,offset:[-4,0],targetOffset:$},right:{points:["cl","cr"],overflow:fe,offset:[4,0],targetOffset:$},top:{points:["bc","tc"],overflow:fe,offset:[0,-4],targetOffset:$},bottom:{points:["tc","bc"],overflow:fe,offset:[0,4],targetOffset:$},topLeft:{points:["bl","tl"],overflow:fe,offset:[0,-4],targetOffset:$},leftTop:{points:["tr","tl"],overflow:fe,offset:[-4,0],targetOffset:$},topRight:{points:["br","tr"],overflow:fe,offset:[0,-4],targetOffset:$},rightTop:{points:["tl","tr"],overflow:fe,offset:[4,0],targetOffset:$},bottomRight:{points:["tr","br"],overflow:fe,offset:[0,4],targetOffset:$},rightBottom:{points:["bl","br"],overflow:fe,offset:[4,0],targetOffset:$},bottomLeft:{points:["tl","bl"],overflow:fe,offset:[0,4],targetOffset:$},leftBottom:{points:["br","bl"],overflow:fe,offset:[-4,0],targetOffset:$}},Y=P},"7qnI":function(qe,Ke,V){"use strict";var fe=V("5Dmo"),$=V("3S7+"),P=V("fWQN"),Y=V("mtLc"),U=V("yKVA"),O=V("879j"),H=V("5NDa"),N=V("5rEg"),k=V("q1tI"),L=V.n(k),_=V("O2Wb"),w=V.n(_),D=N.a.TextArea,T=function(C){Object(U.a)(f,C);var S=Object(O.a)(f);function f(){return Object(P.a)(this,f),S.apply(this,arguments)}return Object(Y.a)(f,[{key:"render",value:function(){var i=this,c=this.props,E=c.index,v=c.onAnswerChange,p=c.addChildAnswer,u=c.exerciseIsPublish,y=c.answers,d=c.activeOptionErrorIndex,h=c.flex,s=h===void 0?"0 0 1000px":h;return L.a.createElement("div",{className:w.a.flex},L.a.createElement("div",{className:"".concat(w.a.color666," mb5 mt6"),style:{flex:"0 0 90px"}},"\u7B54\u6848(\u586B\u7A7A",E+1,"):"),L.a.createElement("div",{className:"".concat(w.a.flex," ").concat(w.a.flex1),style:{flexDirection:"column"}},y.map(function(a,g){var m="".concat(E,"-").concat(g);return L.a.createElement("div",{className:"".concat(w.a.flex," ").concat(w.a.flex1),key:g},L.a.createElement("div",{className:w.a.flex1,style:{flex:s}},L.a.createElement("div",null,L.a.createElement(D,{className:m===d?w.a.error:"",spellCheck:!1,rows:4,value:a||"",defaultValue:"\u8BF7\u8F93\u5165\u53C2\u8003\u7B54\u6848".concat(g==0?"":"(\u53EF\u9009)"),onChange:function(M){return v(E,g,M.target.value)},style:{minHeight:95}}))),!u&&L.a.createElement(L.a.Fragment,null,g!=0&&L.a.createElement($.a,{title:"\u5220\u9664"},L.a.createElement("i",{className:"".concat(w.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){return i.props.deleteChildAnswer(E,g)},style:{float:"right"}})),g===0&&L.a.createElement($.a,{title:"\u5220\u9664"},L.a.createElement("i",{className:"".concat(w.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){return i.props.deleteChildAnswermain(E,g)},style:{float:"right"}})),L.a.createElement($.a,{title:"\u65B0\u589E\u53C2\u8003\u7B54\u6848"},L.a.createElement("i",{className:"".concat(w.a.addIcon," iconfont icon-roundaddfill ml6"),onClick:function(){return p(E)},style:{float:"right",visibility:g==y.length-1?"":"hidden"}}))))})))}}]),f}(k.Component);Ke.a=T},"815F":function(qe,Ke,V){"use strict";V.d(Ke,"e",function(){return H}),V.d(Ke,"c",function(){return k}),V.d(Ke,"d",function(){return L}),V.d(Ke,"a",function(){return w}),V.d(Ke,"f",function(){return D}),V.d(Ke,"b",function(){return T});var fe=V("KQm4"),$=V("VTBJ"),P=V("Ff2n"),Y=V("Zm9Q"),U=V("Kwbf"),O=V("OZM5");function H(C,S){return C!=null?C:S}function N(){var C=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],S=new Map;function f(l){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";(l||[]).forEach(function(c){var E=c.key,v=c.children;Object(U.a)(E!=null,"Tree node must have a certain key: [".concat(i).concat(E,"]"));var p=String(E);Object(U.a)(!S.has(p)||E===null||E===void 0,"Same 'key' exist in the Tree: ".concat(p)),S.set(p,!0),f(v,"".concat(i).concat(p," > "))})}f(C)}function k(C){function S(f){var l=Object(Y.a)(f);return l.map(function(i){if(!Object(O.i)(i))return Object(U.a)(!i,"Tree/TreeNode can only accept TreeNode as children."),null;var c=i.key,E=i.props,v=E.children,p=Object(P.a)(E,["children"]),u=Object($.a)({key:c},p),y=S(v);return y.length&&(u.children=y),u}).filter(function(i){return i})}return S(C)}function L(){var C=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],f=new Set(S===!0?[]:S),l=[];function i(c){var E=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return c.map(function(v,p){var u=Object(O.h)(E?E.pos:"0",p),y=H(v.key,u),d=Object($.a)(Object($.a)({},v),{},{parent:E,pos:u,children:null,data:v,isStart:[].concat(Object(fe.a)(E?E.isStart:[]),[p===0]),isEnd:[].concat(Object(fe.a)(E?E.isEnd:[]),[p===c.length-1])});return l.push(d),S===!0||f.has(y)?d.children=i(v.children||[],d):d.children=[],d})}return i(C),l}function _(C,S,f){var l;f?typeof f=="string"?l=function(E){return E[f]}:typeof f=="function"&&(l=function(E){return f(E)}):l=function(E,v){return H(E.key,v)};function i(c,E,v){var p=c?c.children:C,u=c?Object(O.h)(v.pos,E):"0";if(c){var y=l(c,u),d={node:c,index:E,pos:u,key:y,parentPos:v.node?v.pos:null,level:v.level+1};S(d)}p&&p.forEach(function(h,s){i(h,s,{node:c,pos:u,level:v?v.level+1:-1})})}i(null)}function w(C){var S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},f=S.initWrapper,l=S.processEntity,i=S.onProcessFinished,c=arguments.length>2?arguments[2]:void 0,E={},v={},p={posEntities:E,keyEntities:v};return f&&(p=f(p)||p),_(C,function(u){var y=u.node,d=u.index,h=u.pos,s=u.key,a=u.parentPos,g=u.level,m={node:y,index:d,key:s,pos:h,level:g},b=H(s,h);E[h]=m,v[b]=m,m.parent=E[a],m.parent&&(m.parent.children=m.parent.children||[],m.parent.children.push(m)),l&&l(m,p)},c),i&&i(p),p}function D(C,S){var f=S.expandedKeys,l=S.selectedKeys,i=S.loadedKeys,c=S.loadingKeys,E=S.checkedKeys,v=S.halfCheckedKeys,p=S.dragOverNodeKey,u=S.dropPosition,y=S.keyEntities,d=y[C],h={eventKey:C,expanded:f.indexOf(C)!==-1,selected:l.indexOf(C)!==-1,loaded:i.indexOf(C)!==-1,loading:c.indexOf(C)!==-1,checked:E.indexOf(C)!==-1,halfChecked:v.indexOf(C)!==-1,pos:String(d?d.pos:""),dragOver:p===C&&u===0,dragOverGapTop:p===C&&u===-1,dragOverGapBottom:p===C&&u===1};return h}function T(C){var S=C.data,f=C.expanded,l=C.selected,i=C.checked,c=C.loaded,E=C.loading,v=C.halfChecked,p=C.dragOver,u=C.dragOverGapTop,y=C.dragOverGapBottom,d=C.pos,h=C.active,s=Object($.a)(Object($.a)({},S),{},{expanded:f,selected:l,checked:i,loaded:c,loading:E,halfChecked:v,dragOver:p,dragOverGapTop:u,dragOverGapBottom:y,pos:d,active:h});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`."),C}}),s}},"8EBN":function(qe,Ke,V){(function(fe){fe(V("VrN/"))})(function(fe){"use strict";fe.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;$<fe.modeInfo.length;$++){var P=fe.modeInfo[$];P.mimes&&(P.mime=P.mimes[0])}fe.findModeByMIME=function(Y){Y=Y.toLowerCase();for(var U=0;U<fe.modeInfo.length;U++){var O=fe.modeInfo[U];if(O.mime==Y)return O;if(O.mimes){for(var H=0;H<O.mimes.length;H++)if(O.mimes[H]==Y)return O}}if(/\+xml$/.test(Y))return fe.findModeByMIME("application/xml");if(/\+json$/.test(Y))return fe.findModeByMIME("application/json")},fe.findModeByExtension=function(Y){Y=Y.toLowerCase();for(var U=0;U<fe.modeInfo.length;U++){var O=fe.modeInfo[U];if(O.ext){for(var H=0;H<O.ext.length;H++)if(O.ext[H]==Y)return O}}},fe.findModeByFileName=function(Y){for(var U=0;U<fe.modeInfo.length;U++){var O=fe.modeInfo[U];if(O.file&&O.file.test(Y))return O}var H=Y.lastIndexOf("."),N=H>-1&&Y.substring(H+1,Y.length);if(N)return fe.findModeByExtension(N)},fe.findModeByName=function(Y){Y=Y.toLowerCase();for(var U=0;U<fe.modeInfo.length;U++){var O=fe.modeInfo[U];if(O.name.toLowerCase()==Y)return O;if(O.alias){for(var H=0;H<O.alias.length;H++)if(O.alias[H].toLowerCase()==Y)return O}}}})},"8hTe":function(qe,Ke,V){qe.exports={button:"button___1wy9m"}},"9Bee":function(qe,Ke,V){"use strict";var fe=V("DYRE"),$=V("zeV3"),P=V("+L6B"),Y=V("2/Rp"),U=V("k1fw"),O=V("9og8"),H=V("tJVT"),N=V("WmNS"),k=V.n(N),L=V("q1tI"),_=V.n(L),w=V("vg9a"),D=V("DlQD"),T=V.n(D),C=V("rUJ1");function S(se,Z){var q=se.match(/^(\s+)(?:```)/);if(q===null)return Z;var ae=q[1];return Z.split(`
`).map(function(ue){var te=ue.match(/^\s+/);if(te===null)return ue;var ne=Object(H.a)(te,1),oe=ne[0];return oe.length>=ae.length?ue.slice(ae.length):ue}).join(`
`)}var f=[],l=["<ul>"],i=new T.a.Renderer,c=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function E(){f.length=0,l=["<ul>"]}var v={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function p(se,Z,q,ae){if(Z>=se.length||se[Z].level<=q)return Z;var ue=se[Z];ae.push("<li><a href='#"+ue.anchor+"'>"+ue.text+"</a>"),Z++;var te=[];return Z=p(se,Z,ue.level,te),te.length>0&&(ae.push("<ul>"),te.forEach(function(ne){ae.push(ne)}),ae.push("</ul>")),ae.push("</li>"),Z=p(se,Z,q,ae),Z}function u(){return p(f,0,0,l),l.push("</ul>"),l.join("")}var y={heading:function(Z){var q=c.exec(Z);if(q)return{type:"heading",raw:q[0],depth:q[1].length,text:q[2]}},fences:function(Z){var q=this.rules.block.fences.exec(Z);if(q){var ae=q[0],ue=S(ae,q[3]||""),te=q[2]?q[2].trim():q[2];if(["latex","katex","math"].indexOf(te)>=0){var ne=s(),oe=ue;ue=ne,a[ne]={type:"block",expression:oe}}return{type:"code",raw:ae,lang:te,text:ue}}}},d=/(?:\${2})([^\n`]+?)(?:\${2})/gi,h=0,s=function(){return"__special_katext_id_".concat(h++,"__")},a={};function g(){return a}function m(){h=0,a={}}function b(se){return se=se.replace(d,function(Z,q){var ae=s();return a[ae]={type:"inline",expression:q},ae}),se}var M=i.listitem;i.listitem=function(se){return M(b(se))};var K=i.paragraph;i.paragraph=function(se){return K(b(se))};var z=i.tablecell;i.tablecell=function(se,Z){return z(b(se),Z)},i.code=function(se,Z,q){var ae=(Z||"").match(/\S*/)[0];return ae?["latex","katex","math"].indexOf(ae)>=0?"<p class='editormd-tex'>".concat(se,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(Z,'">').concat(q?se:Object(C.escape)(se,!0),`</code></pre>
`):'<pre class="prettyprint linenums"><code>'+(q?se:Object(C.escape)(se,!0))+"</code></pre>"},i.heading=function(se,Z,q){var ae=this.options.headerPrefix+q.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return f.push({anchor:ae,level:Z,text:se}),"<h"+Z+' id="'+ae+'">'+se+"</h"+Z+">"},T.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),T.a.use({tokenizer:y,renderer:i});var ee=T.a,G=V("SJMd"),F=V("ulZh"),ie=V.n(F),ge=V("m3rI"),ye=V("Oy/b"),xe=V("p5ED"),Te=V("ErOA"),Se=V("STEk");/* **********************************
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 me=function(se,Z){return(me=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(q,ae){q.__proto__=ae}||function(q,ae){for(var ue in ae)Object.prototype.hasOwnProperty.call(ae,ue)&&(q[ue]=ae[ue])})(se,Z)};function pe(se,Z){if(typeof Z!="function"&&Z!==null)throw new TypeError("Class extends value "+String(Z)+" is not a constructor or null");function q(){this.constructor=se}me(se,Z),se.prototype=Z===null?Object.create(Z):(q.prototype=Z.prototype,new q)}function Ee(se,Z,q,ae){return new(q||(q=Promise))(function(ue,te){function ne(ce){try{he(ae.next(ce))}catch(Ce){te(Ce)}}function oe(ce){try{he(ae.throw(ce))}catch(Ce){te(Ce)}}function he(ce){var Ce;ce.done?ue(ce.value):(Ce=ce.value,Ce instanceof q?Ce:new q(function(Ae){Ae(Ce)})).then(ne,oe)}he((ae=ae.apply(se,Z||[])).next())})}function le(se,Z){var q,ae,ue,te,ne={label:0,sent:function(){if(1&ue[0])throw ue[1];return ue[1]},trys:[],ops:[]};return te={next:oe(0),throw:oe(1),return:oe(2)},typeof Symbol=="function"&&(te[Symbol.iterator]=function(){return this}),te;function oe(he){return function(ce){return function(Ce){if(q)throw new TypeError("Generator is already executing.");for(;ne;)try{if(q=1,ae&&(ue=2&Ce[0]?ae.return:Ce[0]?ae.throw||((ue=ae.return)&&ue.call(ae),0):ae.next)&&!(ue=ue.call(ae,Ce[1])).done)return ue;switch(ae=0,ue&&(Ce=[2&Ce[0],ue.value]),Ce[0]){case 0:case 1:ue=Ce;break;case 4:return ne.label++,{value:Ce[1],done:!1};case 5:ne.label++,ae=Ce[1],Ce=[0];continue;case 7:Ce=ne.ops.pop(),ne.trys.pop();continue;default:if(!(ue=ne.trys,(ue=ue.length>0&&ue[ue.length-1])||Ce[0]!==6&&Ce[0]!==2)){ne=0;continue}if(Ce[0]===3&&(!ue||Ce[1]>ue[0]&&Ce[1]<ue[3])){ne.label=Ce[1];break}if(Ce[0]===6&&ne.label<ue[1]){ne.label=ue[1],ue=Ce;break}if(ue&&ne.label<ue[2]){ne.label=ue[2],ne.ops.push(Ce);break}ue[2]&&ne.ops.pop(),ne.trys.pop();continue}Ce=Z.call(se,ne)}catch(Ae){Ce=[6,Ae],ae=0}finally{q=ue=0}if(5&Ce[0])throw Ce[1];return{value:Ce[0]?Ce[1]:void 0,done:!0}}([he,ce])}}}var I=function(){function se(){}return se.addKey=function(Z){se.key=Z},Object.defineProperty(se,"isLicensed",{get:function(){return!!se.key&&new RegExp(/^CRPR-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(se.key)},enumerable:!1,configurable:!0}),se}(),x=function(){function se(){}return se.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},se.setAttributes=function(Z,q){for(var ae=0,ue=q;ae<ue.length;ae++){var te=ue[ae],ne=te[0],oe=te[1];Z.setAttribute(ne,oe)}},se.createRect=function(Z,q,ae){var ue=document.createElementNS("http://www.w3.org/2000/svg","rect");return ue.setAttribute("width",Z.toString()),ue.setAttribute("height",q.toString()),ae&&se.setAttributes(ue,ae),ue},se.createLine=function(Z,q,ae,ue,te){var ne=document.createElementNS("http://www.w3.org/2000/svg","line");return ne.setAttribute("x1",Z.toString()),ne.setAttribute("y1",q.toString()),ne.setAttribute("x2",ae.toString()),ne.setAttribute("y2",ue.toString()),te&&se.setAttributes(ne,te),ne},se.createPolygon=function(Z,q){var ae=document.createElementNS("http://www.w3.org/2000/svg","polygon");return ae.setAttribute("points",Z),q&&se.setAttributes(ae,q),ae},se.createCircle=function(Z,q){var ae=document.createElementNS("http://www.w3.org/2000/svg","circle");return ae.setAttribute("cx",(Z/2).toString()),ae.setAttribute("cy",(Z/2).toString()),ae.setAttribute("r",Z.toString()),q&&se.setAttributes(ae,q),ae},se.createEllipse=function(Z,q,ae){var ue=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return ue.setAttribute("cx",(Z/2).toString()),ue.setAttribute("cy",(q/2).toString()),ue.setAttribute("rx",(Z/2).toString()),ue.setAttribute("ry",(q/2).toString()),ae&&se.setAttributes(ue,ae),ue},se.createGroup=function(Z){var q=document.createElementNS("http://www.w3.org/2000/svg","g");return Z&&se.setAttributes(q,Z),q},se.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},se.createMarker=function(Z,q,ae,ue,te,ne,oe){var he=document.createElementNS("http://www.w3.org/2000/svg","marker");return se.setAttributes(he,[["id",Z],["orient",q],["markerWidth",ae.toString()],["markerHeight",ue.toString()],["refX",te.toString()],["refY",ne.toString()]]),he.appendChild(oe),he},se.createText=function(Z){var q=document.createElementNS("http://www.w3.org/2000/svg","text");return q.setAttribute("x","0"),q.setAttribute("y","0"),Z&&se.setAttributes(q,Z),q},se.createTSpan=function(Z,q){var ae=document.createElementNS("http://www.w3.org/2000/svg","tspan");return ae.textContent=Z,q&&se.setAttributes(ae,q),ae},se.createImage=function(Z){var q=document.createElementNS("http://www.w3.org/2000/svg","image");return Z&&se.setAttributes(q,Z),q},se.createPoint=function(Z,q){var ae=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return ae.x=Z,ae.y=q,ae},se.createPath=function(Z,q){var ae=document.createElementNS("http://www.w3.org/2000/svg","path");return ae.setAttribute("d",Z),q&&se.setAttributes(ae,q),ae},se.createElement=function(Z,q){var ae=document.createElementNS("http://www.w3.org/2000/svg",Z);return q&&se.setAttributes(ae,q),ae},se.getHollowRectanglePath=function(Z,q,ae,ue,te,ne,oe,he){return"M"+Z+","+q+"V"+(q+ue)+"H"+(Z+ae)+"V"+q+"H"+te+"V"+ne+"H"+(te+oe)+"V"+(ne+he)+"H"+te+"V"+q+"Z"},se}(),R=function(){function se(Z){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+Z+"_"}return Object.defineProperty(se.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"defaultSettings",{get:function(){return{canvasBackgroundColor:"#333333",toolbarBackgroundColor:"#111111",toolbarBackgroundHoverColor:"#333333",toolbarBackgroundActiveColor:"#282828",toolbarColor:"#eeeeee",cropShadeColor:"#ffffff",cropFrameColor:"#ffffff",gripColor:"#333333",gripFillColor:"#cccccc",toolbarHeight:40}},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_out"},enumerable:!1,configurable:!0}),se.prototype.addClass=function(Z){return this.styleSheet===void 0&&this.addStyleSheet(),Z.name=""+this.classNamePrefix+Z.localName,this.classes.push(Z),this.styleSheet.sheet.insertRule("."+Z.name+" {"+Z.style+"}",this.styleSheet.sheet.cssRules.length),Z},se.prototype.addRule=function(Z){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(Z),this.styleSheet.sheet.insertRule(Z.selector+" {"+Z.style+"}",this.styleSheet.sheet.cssRules.length)},se.prototype.addStyleSheet=function(){var Z;this.styleSheet=document.createElement("style"),((Z=this.styleSheetRoot)!==null&&Z!==void 0?Z:document.head).appendChild(this.styleSheet),this.addRule(new W("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new W("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
from {
opacity: 0;
}
to {
opacity: 1;
}
`)),this.addRule(new W("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
from {
opacity: 1;
}
to {
opacity: 0;
}
`)),this.addClass(new J("_fade_in",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
`)),this.addClass(new J("_fade_out",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
`))},se.prototype.removeStyleSheet=function(){var Z;this.styleSheet&&(((Z=this.styleSheetRoot)!==null&&Z!==void 0?Z:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},se}(),W=function(se,Z){this.selector=se,this.style=Z},J=function(se,Z){this.localName=se,this.style=Z},B=function(){function se(){this.blocks=[],this.display=""}return se.prototype.addButtonBlock=function(Z){Z.className=this.blockClassName,Z.buttonClassName=this.buttonClassName,Z.buttonColorsClassName=this.buttonColorsClassName,Z.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(Z)},se.prototype.addElementBlock=function(Z){Z.className===void 0&&(Z.className=this.blockClassName),this.blocks.push(Z)},se.prototype.getUI=function(){var Z=document.createElement("div");return Z.className=this.className+" "+this.colorsClassName+" "+this.fadeInClassName,Z.style.display=this.display,this.blocks.forEach(function(q){return Z.appendChild(q.getUI())}),Z},se}(),de=function(){function se(){}return se.prototype.getUI=function(){var Z=document.createElement("div");if(Z.className=this.className,this.minWidth!==void 0&&(Z.style.minWidth=this.minWidth),this.contentAlign!==void 0)switch(this.contentAlign){case"start":Z.style.justifyContent="flex-start";break;case"center":Z.style.justifyContent="center";break;case"end":Z.style.justifyContent="flex-end"}return Z.style.whiteSpace="nowrap",Z},se}(),_e=function(se){function Z(){var q=se!==null&&se.apply(this,arguments)||this;return q.buttons=[],q}return pe(Z,se),Z.prototype.addButton=function(q){q.className=this.buttonClassName,q.colorsClassName=this.buttonColorsClassName,q.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(q)},Z.prototype.getUI=function(){var q=se.prototype.getUI.call(this);return this.buttons.forEach(function(ae){return q.appendChild(ae.getUI())}),q},Z}(de),Re=function(){function se(Z,q){this._isActive=!1,this._isHidden=!1,this._icon=Z,this.title=q,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(se.prototype,"icon",{get:function(){return this._icon},set:function(Z){this._icon=Z,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"isActive",{get:function(){return this._isActive},set:function(Z){this._isActive=Z,this.adjustClassName()},enumerable:!1,configurable:!0}),se.prototype.getUI=function(){var Z=this;return this.buttonContainer=document.createElement("div"),this.buttonContainer.title=this.title,this.buttonContainer.className=this.className+" "+this.colorsClassName,this.adjustClassName(),this.buttonContainer.innerHTML=this._icon,this.onClick&&this.buttonContainer.addEventListener("click",function(){return Z.onClick()}),this.uiContainer.appendChild(this.buttonContainer),this.uiContainer.style.display=this._isHidden?"none":"inline-block",this.uiContainer},se.prototype.adjustClassName=function(){this.activeColorsClassName&&(this._isActive&&this.buttonContainer.className.indexOf(this.activeColorsClassName)<0?this.buttonContainer.className+=" "+this.activeColorsClassName:this._isActive||(this.buttonContainer.className=this.buttonContainer.className.replace(this.activeColorsClassName,"")))},se.prototype.hide=function(){this._isHidden=!0},se}(),Oe=function(se){function Z(){var q=se!==null&&se.apply(this,arguments)||this;return q.elements=[],q}return pe(Z,se),Z.prototype.addElement=function(q){this.elements.push(q)},Z.prototype.getUI=function(){var q=se.prototype.getUI.call(this);return this.elements.forEach(function(ae){return q.appendChild(ae)}),q},Z}(de),ke=function(){function se(Z,q){this.horizontal=Z,this.vertical=q}return Object.defineProperty(se.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),se.prototype.getVerticalLength=function(Z){return Z/this.ratio},se.prototype.getHorizontalLength=function(Z){return Z*this.ratio},se}(),Ie=function(){function se(){}return se.getIcon=function(Z,q){if(Z>0&&q>0){var ae=new ke(Z,q),ue=ae.ratio>=1?20:ae.getHorizontalLength(20),te=ae.ratio<1?20:ae.getVerticalLength(20),ne=document.createElementNS("http://www.w3.org/2000/svg","svg");ne.setAttribute("xmlns","http://www.w3.org/2000/svg"),ne.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(ne);var oe=x.createDefs();ne.appendChild(oe);var he=x.createElement("clipPath",[["id","text-bg-clip"]]);oe.appendChild(he);var ce=x.createPath(x.getHollowRectanglePath((24-ue)/2,(24-te)/2,ue,te,(24-ue)/2+2,(24-te)/2+2,ue-4,te-4));ne.appendChild(ce);var Ce=x.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);Ce.appendChild(x.createTSpan(Z+":"+q)),ne.appendChild(Ce);var Ae=Ce.getBBox();x.setAttributes(Ce,[["x",((24-Ae.width)/2).toString()],["y",((24-Ae.height)/2-Ae.y).toString()]]);var Ge=x.createPath(x.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(Ae.width))/2,(24-Math.ceil(Ae.height))/2,Math.ceil(Ae.width),Math.ceil(Ae.height)));return he.appendChild(Ge),x.setAttributes(ce,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(ne),ne.outerHTML}return'<svg viewBox="0 0 24 24"><path d="M19 12h-2v3h-3v2h5v-5M7 9h3V7H5v5h2V9m14-6H3a2 2 0 00-2 2v14a2 2 0 002 2h18a2 2 0 002-2V5a2 2 0 00-2-2m0 16H3V5h18v14z"/></svg>'},se}(),De=function(se){function Z(q,ae,ue){var te=se.call(this,q,ae)||this;return te.isDropdownOpen=!1,te.onClick=te.dropdownButtonClicked,te.dropdownButtons=ue,te}return pe(Z,se),Z.prototype.setupDropdown=function(){var q=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(ae){ae.className=q.className,ae.colorsClassName=q.colorsClassName,q.dropdownBlock.appendChild(ae.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},Z.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},Z.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},Z.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},Z.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},Z.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},Z}(Re),Ve=function(){function se(Z,q){this.GRIP_SIZE=10,this.color=Z,this.fillColor=q,this.visual=x.createGroup(),this.visual.appendChild(x.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(x.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return se.prototype.ownsTarget=function(Z){return Z===this.visual||Z===this.visual.childNodes[0]||Z===this.visual.childNodes[1]},se.prototype.setCenter=function(Z,q){this.visual.childNodes.forEach(function(ae){return x.setAttributes(ae,[["cx",Z.toString()],["cy",q.toString()]])})},se}(),Qe=function(){function se(Z,q,ae,ue){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=Z,this.canvasHeight=q,this.margin=ae,this.container=ue,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(se.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(Z){this._aspectRatio=Z,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(Z){this._isGridVisible=Z,this.gridContainer&&x.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(Z){this._zoomFactor=Z,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),se.prototype.open=function(){var Z=this;this.cropShadeElement=x.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=x.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var q=0;q<this.numberOfGridLines;q++)this.horizontalGridLines.push(x.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push(x.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]]));this.horizontalGridLines.forEach(function(ae){return Z.gridContainer.appendChild(ae)}),this.verticalGridLines.forEach(function(ae){return Z.gridContainer.appendChild(ae)}),this.cropRectElement=x.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new Ve(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new Ve(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new Ve(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new Ve(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomRightGrip.visual),this.attachEvents()},se.prototype.setCropRectangle=function(Z){this.cropRect=Z;var q=Object.assign({},this.cropRect);this.zoomFactor!==1&&(q.width=this.cropRect.width*this.zoomFactor,q.height=this.cropRect.height*this.zoomFactor,q.x=this.cropRect.height/this.cropRect.width<this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasWidth/2-q.width/2,q.y=this.cropRect.height/this.cropRect.width>this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-q.height/2),x.setAttributes(this.cropRectElement,[["x",q.x.toString()],["y",q.y.toString()],["width",q.width.toString()],["height",q.height.toString()]]);var ae=q.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(te,ne){var oe=q.y+ae*(ne+1);x.setAttributes(te,[["x1",""+q.x],["y1",""+oe],["x2",""+(q.x+q.width)],["y2",""+oe]])});var ue=q.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(te,ne){var oe=q.x+ue*(ne+1);x.setAttributes(te,[["x1",""+oe],["y1",""+q.y],["x2",""+oe],["y2",""+(q.y+q.height)]])}),x.setAttributes(this.cropShadeElement,[["d",x.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,q.x,q.y,q.width,q.height)]]),this.topLeftGrip.setCenter(q.x,q.y),this.topRightGrip.setCenter(q.x+q.width,q.y),this.bottomLeftGrip.setCenter(q.x,q.y+q.height),this.bottomRightGrip.setCenter(q.x+q.width,q.y+q.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},se.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)},se.prototype.clientToLocalCoordinates=function(Z,q){var ae=this.container.getBoundingClientRect();return{x:Z-ae.left+this.margin,y:q-ae.top+this.margin}},se.prototype.onPointerDown=function(Z){this.container.setPointerCapture(Z.pointerId),this.previousPoint=this.clientToLocalCoordinates(Z.clientX,Z.clientY),this.cropRectElement===Z.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(Z.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(Z.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(Z.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(Z.target)&&(this.activeGrip=this.bottomRightGrip)},se.prototype.onPointerMove=function(Z){if(this.isMoving)this.move(this.clientToLocalCoordinates(Z.clientX,Z.clientY));else if(this.activeGrip){var q=this.clientToLocalCoordinates(Z.clientX,Z.clientY);this.resize(q)}Z.preventDefault()},se.prototype.onPointerUp=function(Z){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(Z.pointerId)},se.prototype.move=function(Z){var q=Z.x-this.previousPoint.x,ae=Z.y-this.previousPoint.y;this.zoomFactor!==1&&(q=-q/this.zoomFactor,ae=-ae/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+q),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+ae),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=Z},se.prototype.resize=function(Z){var q=Object.assign({},this.cropRect),ae=Z.x-this.previousPoint.x,ue=Z.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:q.x+ae<this.margin&&(ae=this.margin-q.x),q.x+=ae,q.width=this.cropRect.x+this.cropRect.width-q.x;break;case this.bottomRightGrip:case this.topRightGrip:q.width+ae>this.canvasWidth*this.zoomFactor&&(ae=this.canvasWidth*this.zoomFactor-q.width),q.width+=ae}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(q.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(ae),q.height=this.aspectRatio.getVerticalLength(q.width)):(q.y+=ue,q.height=this.cropRect.y+this.cropRect.height-q.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?q.height=this.aspectRatio.getVerticalLength(q.width):q.height+=ue}q.width<10&&(q.x=this.cropRect.x,q.width=10),q.height<10&&(q.y=this.cropRect.y,q.height=10),this.previousPoint=Z,q.x>=this.margin&&q.y>=this.margin&&q.x-this.margin+q.width<=this.canvasWidth&&q.y-this.margin+q.height<=this.canvasHeight&&(this.cropRect=q,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},se.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var Z=this.cropRect.x+this.cropRect.width/2,q=this.cropRect.y+this.cropRect.height/2,ae=this.aspectRatio.getHorizontalLength(this.cropRect.height),ue=this.aspectRatio.getVerticalLength(this.cropRect.width);ae/this.canvasWidth<ue/this.canvasHeight?this.cropRect.width=ae:this.cropRect.height=ue,this.cropRect.width>this.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=Z-this.cropRect.width/2,this.cropRect.y=q-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)}},se.prototype.getRescaledRect=function(Z,q,ae,ue,te,ne){var oe=ae/Z,he=ue/q;return{x:(te.x-ne)*oe+ne,y:(te.y-ne)*he+ne,width:te.width*oe,height:te.height*he}},se.prototype.scaleCanvas=function(Z,q){var ae=this.getRescaledRect(this.canvasWidth,this.canvasHeight,Z,q,this.cropRect,this.margin);this.canvasWidth=Z,this.canvasHeight=q,this.onCropChange&&this.onCropChange(ae),this.setCropRectangle(ae)},se}(),at=function(){function se(Z){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=Z,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(se.prototype,"angle",{get:function(){return this._angle},set:function(Z){this._angle=Z,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),se.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},se.prototype.onPointerDown=function(Z){this.controlContainer.setPointerCapture(Z.pointerId),this.isDragging=!0,this.previousPoint={x:Z.clientX,y:Z.clientY}},se.prototype.onPointerMove=function(Z){this.isDragging&&(this.onAngleChange&&this.onAngleChange((Z.clientX-this.previousPoint.x)/5),this.previousPoint.x=Z.clientX)},se.prototype.onPointerUp=function(Z){this.isDragging&&this.onAngleChange&&this.onAngleChange((Z.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(Z.pointerId)},se.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var Z=this.angleLabelText.getBBox();x.setAttributes(this.angleLabelElement,[["x",((this.width-Z.width)/2).toString()],["y",(this.height/2).toString()]])}},se.prototype.positionScaleShape=function(){if(this.scaleShape){var Z=this.scaleShape.transform.baseVal.getItem(0);Z.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(Z,0)}},se.prototype.getVisual=function(){var Z=document.createElementNS("http://www.w3.org/2000/svg","svg");Z.setAttribute("xmlns","http://www.w3.org/2000/svg"),Z.setAttribute("width",this.width+"px"),Z.setAttribute("height",this.height+"px"),Z.setAttribute("viewBox","0 0 "+this.width+" "+this.height),Z.style.flexShrink="0",document.body.appendChild(Z);for(var q="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,ae=1;ae<=this.width/5+10;ae++){var ue=ae%5==0?this.height/3:this.height/6;q+="h4v"+-ue+"h1v"+ue}q+="v1H0Z",this.scaleShape=x.createPath(q);var te=x.createTransform();this.scaleShape.transform.baseVal.appendItem(te),Z.appendChild(this.scaleShape),this.angleLabelElement=x.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=x.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var ne=x.createTSpan("");return ne.innerHTML="&deg;",this.angleLabelElement.appendChild(ne),Z.appendChild(this.angleLabelElement),document.body.removeChild(Z),Z},se}(),Ze=function(){function se(){this.naturalSize=!1,this.imageType="image/png"}return se.prototype.rasterize=function(Z,q,ae,ue,te,ne,oe){var he=this;return new Promise(function(ce){var Ce=document.createElement("canvas");Ce.width=Z.width.baseVal.value-2*ue,Ce.height=Z.height.baseVal.value-2*ue;var Ae=1,Ge=1;he.naturalSize===!0?(Ae=q.naturalWidth/(Z.width.baseVal.value-2*ue)/ne,Ge=q.naturalHeight/(Z.height.baseVal.value-2*ue)/oe,Ce.width=q.naturalWidth/ne,Ce.height=q.naturalHeight/oe):he.width!==void 0&&he.height!==void 0&&(Ae=he.width/ae.width,Ge=he.height/ae.height,Ce.width*=Ae,Ce.height*=Ge);var Ue=Ce.getContext("2d");Ue.translate(Ce.width/2,Ce.height/2),Ue.rotate(te*Math.PI/180),Ue.scale(ne,oe),Ue.translate(-Ce.width/2,-Ce.height/2),Ue.drawImage(q,0,0,Ce.width,Ce.height);var He=document.createElement("canvas");He.width=ae.width*Ae,He.height=ae.height*Ge,He.getContext("2d").putImageData(Ue.getImageData((ae.x-ue)*Ae,(ae.y-ue)*Ge,ae.width*Ae,ae.height*Ge),0,0),ce(He.toDataURL(he.imageType,he.imageQuality))})},se}(),yt=function(){function se(Z){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=se.instanceCounter++,this.styles=new R(this.instanceNo),this.target=Z,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(se.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(Z){this._zoomToCropEnabled=Z,Z?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(Z){this._isGridVisible=Z,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"gridLines",{get:function(){return this._gridLines},set:function(Z){this._gridLines=Z,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(Z){this._rotationAngle=Z,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"aspectRatio",{get:function(){var Z;return(Z=this._aspectRatio)!==null&&Z!==void 0?Z:this.aspectRatios[0]},set:function(Z){this._aspectRatio=Z},enumerable:!1,configurable:!0}),se.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},se.prototype.show=function(){this.showUI(),this.open()},se.prototype.close=function(Z){Z===void 0&&(Z=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),Z||this.closeEventListeners.forEach(function(q){return q()}),this._isOpen=!1)},se.prototype.addRenderEventListener=function(Z){this.renderEventListeners.push(Z)},se.prototype.removeRenderEventListener=function(Z){this.renderEventListeners.indexOf(Z)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(Z),1)},se.prototype.addCloseEventListener=function(Z){this.closeEventListeners.push(Z)},se.prototype.removeCloseEventListener=function(Z){this.closeEventListeners.indexOf(Z)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(Z),1)},se.prototype.setupResizeObserver=function(){var Z=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){Z.resize(Z.target.clientWidth,Z.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))},se.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var Z=1*this.target.clientWidth/this.target.clientHeight,q=this.contentDiv.clientWidth/Z>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*Z:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,ae=q+2*this.CANVAS_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/Z;this.resize(q,ae)}},se.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},se.prototype.setEditingTargetSize=function(){this.editorCanvas.style.width=this.imageWidth+2*this.CANVAS_MARGIN+"px",this.editorCanvas.style.height=this.imageHeight+2*this.CANVAS_MARGIN+"px",x.setAttributes(this.editingTarget,[["width",""+this.imageWidth],["height",""+this.imageHeight]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px"},se.prototype.resize=function(Z,q){this.imageWidth=Math.round(Z),this.imageHeight=Math.round(q),this.setEditingTargetSize(),this.cropImage.setAttribute("width",this.paddedImageWidth.toString()),this.cropImage.setAttribute("height",this.paddedImageHeight.toString()),this.cropImage.setAttribute("viewBox","0 0 "+this.paddedImageWidth.toString()+" "+this.paddedImageHeight.toString()),this.cropImageHolder.style.width=this.paddedImageWidth+"px",this.cropImageHolder.style.height=this.paddedImageHeight+"px",this.displayMode!=="popup"?this.coverDiv.style.width=this.paddedImageWidth+"px":(this.setTopLeft(),this.positionCropImage()),this.cropLayer.scaleCanvas(this.imageWidth,this.imageHeight),this.applyRotation()},se.prototype.setEditingTarget=function(){var Z=document.createElement("canvas");Z.width=this.target.naturalWidth,Z.height=this.target.naturalHeight,Z.getContext("2d").drawImage(this.target,0,0,this.target.naturalWidth,this.target.naturalHeight);var q=Z.toDataURL();x.setAttributes(this.editingTarget,[["href",q]]),this.setEditingTargetSize()},se.prototype.setTopLeft=function(){var Z=this.target.getBoundingClientRect(),q=this.editorCanvas.getBoundingClientRect();this.left=Z.left-q.left-this.CANVAS_MARGIN,this.top=Z.top-q.top-this.CANVAS_MARGIN},se.prototype.initCropCanvas=function(){this.cropImageHolder=document.createElement("div"),this.cropImageHolder.style.setProperty("touch-action","none"),this.cropImageHolder.style.setProperty("-ms-touch-action","none"),this.cropImage=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.cropImage.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.cropImage.setAttribute("width",this.paddedImageWidth.toString()),this.cropImage.setAttribute("height",this.paddedImageHeight.toString()),this.cropImage.setAttribute("viewBox","0 0 "+this.paddedImageWidth.toString()+" "+this.paddedImageHeight.toString()),this.cropImage.style.pointerEvents="auto",this.cropImageHolder.style.width=this.paddedImageWidth+"px",this.cropImageHolder.style.height=this.paddedImageHeight+"px",this.cropImageHolder.style.transformOrigin="top left",this.positionCropImage(),this.defs=x.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=x.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=x.createGroup(),this.editingTargetRotationScaleContainer=x.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var Z=x.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(Z);var q=x.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(q),this.editingTargetContainer=x.createGroup(),this.editingTargetContainer.style.transform="translate("+this.CANVAS_MARGIN+"px, "+this.CANVAS_MARGIN+"px)",this.editingTargetContainer.appendChild(this.editingTargetRotationContainer),this.cropImage.appendChild(this.editingTargetContainer),this.cropImageHolder.appendChild(this.cropImage),this.editorCanvas.appendChild(this.cropImageHolder)},se.prototype.positionCropImage=function(){this.cropImageHolder.style.top=this.top+"px",this.cropImageHolder.style.left=this.left+"px"},se.prototype.initCropLayer=function(){this.cropRect={x:this.CANVAS_MARGIN,y:this.CANVAS_MARGIN,width:this.imageWidth,height:this.imageHeight},this.cropLayerContainer=x.createGroup(),this.cropImage.appendChild(this.cropLayerContainer),this.cropLayer=new Qe(this.imageWidth,this.imageHeight,this.CANVAS_MARGIN,this.cropLayerContainer),this.cropLayer.onCropChange=this.cropRectChanged,this.cropLayer.numberOfGridLines=this.gridLines,this.cropLayer.isGridVisible=this.isGridVisible,this.cropLayer.cropShadeColor=this.styles.settings.cropShadeColor,this.cropLayer.cropFrameColor=this.styles.settings.cropFrameColor,this.cropLayer.gripColor=this.styles.settings.gripColor,this.cropLayer.gripFillColor=this.styles.settings.gripFillColor,this.cropLayer.open(),this.cropLayer.setCropRectangle(this.cropRect),this.zoomToCropEnabled&&this.zoomToCrop()},se.prototype.zoomToCrop=function(){if(this.cropRect){var Z=this.cropRect.x-this.CANVAS_MARGIN+this.cropRect.width/2,q=this.cropRect.y-this.CANVAS_MARGIN+this.cropRect.height/2;this.zoomFactor=Math.min(this.imageWidth/this.cropRect.width,this.imageHeight/this.cropRect.height),this.editingTargetContainer&&this.cropLayer&&(this.editingTargetContainer.style.transformOrigin=Z+"px "+q+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-Z+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-q+this.CANVAS_MARGIN)+"px) scale("+this.zoomFactor+")",this.cropLayer.zoomFactor=this.zoomFactor)}},se.prototype.unzoomFromCrop=function(){this.zoomFactor=1,this.editingTargetContainer&&this.cropLayer&&(this.editingTargetContainer.style.transformOrigin="center",this.editingTargetContainer.style.transform="translate("+this.CANVAS_MARGIN+"px, "+this.CANVAS_MARGIN+"px) scale(1)",this.cropLayer.zoomFactor=this.zoomFactor)},se.prototype.cropRectChanged=function(Z){this.cropRect=Z,this.zoomToCropEnabled?this.zoomToCrop():this.cropLayer.zoomFactor=1},se.prototype.attachEvents=function(){window.addEventListener("resize",this.onWindowResize)},se.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"},se.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},se.prototype.showUI=function(){switch(this.addStyles(),this.displayMode==="popup"&&this.overrideOverflow(),this.coverDiv=document.createElement("div"),this.coverDiv.className=this.styles.classNamePrefixBase+" "+this.styles.classNamePrefix,this.coverDiv.style.fontSize="16px",this.displayMode){case"inline":this.coverDiv.style.position="absolute";var Z=this.styles.settings.hideTopToolbar?0:this.toolbarHeight,q=this.target.offsetTop>Z+this.CANVAS_MARGIN?this.target.offsetTop-(Z+this.CANVAS_MARGIN):0;this.coverDiv.style.top=q+"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},se.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},se.prototype.addTopToolbar=function(){var Z=this;this.topToolbar=new B,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 q=new _e;q.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(q);var ae=[];this.aspectRatios.forEach(function(Ge){var Ue=new Re(Ie.getIcon(Ge.horizontal,Ge.vertical),Ge.horizontal===0&&Ge.vertical===0?"FREE":Ge.horizontal+":"+Ge.vertical);Ue.onClick=function(){return Z.ratioButtonClicked(Ge)},ae.push(Ue)}),this.aspectRatioButton=new De(Ie.getIcon(0,0),"Aspect ratio",ae),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,q.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var ue=new Re('<svg viewBox="0 0 24 24"><path d="M10 4v4h4V4h-4m6 0v4h4V4h-4m0 6v4h4v-4h-4m0 6v4h4v-4h-4m-2 4v-4h-4v4h4m-6 0v-4H4v4h4m0-6v-4H4v4h4m0-6V4H4v4h4m2 6h4v-4h-4v4M4 2h16a2 2 0 012 2v16a2 2 0 01-2 2H4c-1.08 0-2-.9-2-2V4a2 2 0 012-2z"/></svg>',"Toggle grid");ue.isActive=this.isGridVisible,ue.onClick=function(){Z.isGridVisible=!Z.isGridVisible,ue.isActive=Z.isGridVisible},q.addButton(ue);var te=new Re('<svg viewBox="0 0 24 24"><path d="M15.5 14l5 5-1.5 1.5-5-5v-.79l-.27-.28A6.471 6.471 0 019.5 16 6.5 6.5 0 013 9.5 6.5 6.5 0 019.5 3 6.5 6.5 0 0116 9.5c0 1.61-.59 3.09-1.57 4.23l.28.27h.79m-6 0C12 14 14 12 14 9.5S12 5 9.5 5 5 7 5 9.5 7 14 9.5 14m2.5-4h-2v2H9v-2H7V9h2V7h1v2h2v1z"/></svg>',"Zoom to selection");if(te.isActive=this.zoomToCropEnabled,te.onClick=function(){Z.zoomToCropEnabled=!Z.zoomToCropEnabled,te.isActive=Z.zoomToCropEnabled},q.addButton(te),!I.isLicensed){var ne=new Oe;this.topToolbar.addElementBlock(ne);var oe=document.createElement("div");oe.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var he=document.createElement("a");he.style.color="currentColor",he.href="https://markerjs.com/products/cropro",he.target="_blank",he.innerHTML='<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2"><path d="M16.326 14.895c0 1.126-.558 1.688-1.673 1.688H9.931c-1.116 0-1.674-.562-1.674-1.688V3.733c0-1.126.558-1.688 1.674-1.688h4.722c1.115 0 1.673.562 1.673 1.688v2.899h-1.957V3.793h-4.124v11.042h4.124v-3.242h1.957v3.302z" fill="currentColor"/><path d="M15.94 7.364a.783.783 0 00-1.065-.304l-11.01 6.126a.783.783 0 00-.303 1.065l4.498 8.085a.783.783 0 001.065.304l11.01-6.126a.783.783 0 00.303-1.065L15.94 7.364zM5.311 14.173l3.737 6.718 9.641-5.364-3.737-6.718-9.641 5.364z" fill="#eef762"/></svg>',oe.appendChild(he),ne.addElement(oe)}var ce=new _e;ce.minWidth=3*this.toolbarHeight+"px",ce.contentAlign="end",this.topToolbar.addButtonBlock(ce);var Ce=new Re('<svg viewBox="0 0 24 24"><path d="M9 20.42l-6.21-6.21 2.83-2.83L9 14.77l9.88-9.89 2.83 2.83L9 20.42z"/></svg>',"OK");Ce.onClick=this.startRenderAndClose,ce.addButton(Ce),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(Ce.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var Ae=new Re('<svg viewBox="0 0 24 24"><path d="M20 6.91L17.09 4 12 9.09 6.91 4 4 6.91 9.09 12 4 17.09 6.91 20 12 14.91 17.09 20 20 17.09 14.91 12 20 6.91z"/></svg>',"Close");Ae.onClick=this.close,ce.addButton(Ae),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(Ae.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},se.prototype.addBottomToolbar=function(){var Z=this;this.bottomToolbar=new B,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 q=new _e;q.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(q);var ae=new Re('<svg viewBox="0 0 24 24"><path d="M13 4.07V1L8.45 5.55 13 10V6.09c2.84.48 5 2.94 5 5.91s-2.16 5.43-5 5.91v2.02c3.95-.49 7-3.85 7-7.93s-3.05-7.44-7-7.93M7.1 18.32c1.16.9 2.51 1.44 3.9 1.61V17.9c-.87-.15-1.71-.49-2.46-1.03L7.1 18.32M6.09 13H4.07c.17 1.39.72 2.73 1.62 3.89l1.41-1.42c-.52-.75-.87-1.59-1.01-2.47m1.02-4.47L5.7 7.11C4.8 8.27 4.24 9.61 4.07 11h2.02c.14-.87.49-1.72 1.02-2.47z"/></svg>',"Rotate left");ae.onClick=this.rotateLeftButtonClicked,q.addButton(ae);var ue=new Re('<svg viewBox="0 0 24 24"><path d="M16.89 15.5l1.42 1.39c.9-1.16 1.45-2.5 1.62-3.89h-2.02c-.14.87-.48 1.72-1.02 2.5M13 17.9v2.02c1.39-.17 2.74-.71 3.9-1.61l-1.44-1.44c-.75.54-1.59.89-2.46 1.03m6.93-6.9a7.906 7.906 0 00-1.62-3.89l-1.42 1.42c.54.75.88 1.6 1.02 2.47m-2.36-5.45L11 1v3.07C7.06 4.56 4 7.92 4 12s3.05 7.44 7 7.93v-2.02c-2.84-.48-5-2.94-5-5.91s2.16-5.43 5-5.91V10l4.55-4.45z"/></svg>',"Rotate right");ue.onClick=this.rotateRightButtonClicked,q.addButton(ue);var te=new Oe;te.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(te),this.straightener=new at("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(ce){Z.rotateBy(ce),Z.straightener.angle=Z.rotationAngle},te.addElement(this.straightener.getUI());var ne=new _e;ne.minWidth=2*this.toolbarHeight+"px",ne.contentAlign="end",this.bottomToolbar.addButtonBlock(ne);var oe=new Re('<svg viewBox="0 0 24 24"><path d="M15 21h2v-2h-2m4-10h2V7h-2M3 5v14c0 1.1.9 2 2 2h4v-2H5V5h4V3H5c-1.1 0-2 .9-2 2m16-2v2h2c0-1.1-.9-2-2-2m-8 20h2V1h-2m8 16h2v-2h-2M15 5h2V3h-2m4 10h2v-2h-2m0 10c1.1 0 2-.9 2-2h-2z"/></svg>',"Flip horizontal");oe.onClick=this.flipHorizontallyButtonClicked,ne.addButton(oe);var he=new Re('<svg viewBox="0 0 24 24"><path d="M3 15v2h2v-2m10 4v2h2v-2m2-16H5c-1.1 0-2 .9-2 2v4h2V5h14v4h2V5c0-1.1-.9-2-2-2m2 16h-2v2c1.1 0 2-.9 2-2M1 11v2h22v-2M7 19v2h2v-2m10-4v2h2v-2m-10 4v2h2v-2M3 19c0 1.1.9 2 2 2v-2z"/></svg>',"Flip vertical");he.onClick=this.flipVerticallyButtonClicked,ne.addButton(he)},se.prototype.ratioButtonClicked=function(Z){this.aspectRatio=Z,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},se.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=Ie.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},se.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new ke(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},se.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},se.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},se.prototype.restoreState=function(Z){if(Z){var q=this.cropLayer.getRescaledRect(Z.width,Z.height,this.imageWidth,this.imageHeight,Z.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(q),this.cropRectChanged(q),this.flippedHorizontally=Z.flippedHorizontally,this.flippedVertically=Z.flippedVertically,this.applyFlip(),this.rotationAngle=Z.rotationAngle,this.applyRotation()}},se.prototype.clientToLocalCoordinates=function(Z,q){var ae=this.cropImage.getBoundingClientRect();return{x:Z-ae.left,y:q-ae.top}},se.prototype.onWindowResize=function(){this.positionUI()},se.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var Z=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=Z+"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()},se.prototype.rotateLeftButtonClicked=function(){var Z=this.rotationAngle-90;this.rotationAngle%90!=0&&(Z+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(Z)},se.prototype.rotateRightButtonClicked=function(){var Z=this.rotationAngle+90;this.rotationAngle%90!=0&&(Z-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(Z)},se.prototype.rotateTo=function(Z){Z=(Z=Z>180?Z-360:Z)<=-180?Z+360:Z,this.rotationAngle=Z,this.applyRotation()},se.prototype.rotateBy=function(Z){this.rotateTo((this.rotationAngle+Z)%360)},se.prototype.applyRotation=function(){var Z=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var q=this.editingTargetRotationContainer.transform.baseVal.getItem(0);q.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(q,0);var ae=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/ae.width,this.imageHeight/ae.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=Z},se.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},se.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},se.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},se.prototype.startRenderAndClose=function(){return Ee(this,void 0,void 0,function(){var Z,q;return le(this,function(ae){switch(ae.label){case 0:return[4,this.render()];case 1:return Z=ae.sent(),q=this.getState(),this.renderEventListeners.forEach(function(ue){return ue(Z,q)}),this.close(!0),[2]}})})},se.prototype.render=function(){return Ee(this,void 0,void 0,function(){var Z;return le(this,function(q){switch(q.label){case 0:return(Z=new Ze).naturalSize=this.renderAtNaturalSize,Z.imageType=this.renderImageType,Z.imageQuality=this.renderImageQuality,Z.width=this.renderWidth,Z.height=this.renderHeight,this.unzoomFromCrop(),x.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,Z.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 q.sent(),[4,Z.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,q.sent()]}})})},se.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new J("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 J("toolbar_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarBlockStyleClass=this.styles.addClass(new J("toolbar-block",`
display: flex;
align-items: center;
box-sizing: content-box;
`));var Z=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new J("toolbar_button",`
display: inline-block;
width: `+(this.toolbarHeight-2*Z)+`px;
height: `+(this.toolbarHeight-2*Z)+`px;
padding: `+Z+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new J("toolbar_button_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new J("toolbar_active_button",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
`)),this.styles.addRule(new W("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.toolbarHeight/2+`px;
`)),this.styles.addRule(new W("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new J("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 J("toolbar_dropdown_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new J("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 J("toolbar_straightener",`
display: flex;
overflow: hidden;
justify-content: center;
height: `+(this.toolbarHeight-2*Z)+`px;
padding: `+Z+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new J("toolbar_straightener_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`))},se.instanceCounter=0,se}(),rt=V("8hTe"),dt=V.n(rt),Me=/<pre[^>]*>/g;function xt(se){var Z=document.createElement("div");return Z.innerHTML=se,Z.childNodes.length===0?"":Z.childNodes[0].nodeValue}var mt=Ke.a=function(se){var Z=se.value,q=Z===void 0?"":Z,ae=se.edit,ue=ae===void 0?!1:ae,te=se.className,ne=se.showTextOnly,oe=se.showLines,he=se.replaces,ce=se.zoomImg,Ce=se.hasMask,Ae=se.style,Ge=Ae===void 0?{}:Ae,Ue=se.stylesPrev,He=Ue===void 0?{}:Ue,Tt=String(q),Xe=Object(L.useRef)(),st=Object(L.useRef)(),jt=Object(L.useState)(""),ze=Object(H.a)(jt,2),It=ze[0],Zt=ze[1],At=Object(L.useState)("office"),qt=Object(H.a)(At,2),Gt=qt[0],Dt=qt[1],Ot=function(){var Rt=new yt(st.current);Rt.displayMode="popup",Rt.addRenderEventListener(function(){var Nt=Object(O.a)(k.a.mark(function Lt(Ft){var Vt;return k.a.wrap(function(Je){for(;;)switch(Je.prev=Je.next){case 0:return Xe.current.style.display="none",Je.next=3,Object(Te.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:Ft}});case 3:Vt=Je.sent,Vt!=null&&Vt.id&&he(st.current.getAttribute("src").replace(ge.a.API_SERVER,""),"/api/attachments/".concat(Vt==null?void 0:Vt.id,"?type=").concat(Vt.content_type));case 5:case"end":return Je.stop()}},Lt)}));return function(Lt){return Nt.apply(this,arguments)}}()),Rt.show()},ht=function(){var Rt=new Se.a(st.current);Rt.settings.displayMode="popup",Rt.addEventListener("render",function(){var Nt=Object(O.a)(k.a.mark(function Lt(Ft){var Vt;return k.a.wrap(function(Je){for(;;)switch(Je.prev=Je.next){case 0:if(Xe.current.style.display="none",!st.current){Je.next=6;break}return Je.next=4,Object(Te.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:Ft.dataUrl}});case 4:Vt=Je.sent,Vt!=null&&Vt.id&&he(st.current.getAttribute("src").replace(ge.a.API_SERVER,""),"/api/attachments/".concat(Vt==null?void 0:Vt.id,"?type=").concat(Vt.content_type));case 6:case"end":return Je.stop()}},Lt)}));return function(Lt){return Nt.apply(this,arguments)}}()),Rt.show(),window.markerArea=Rt},kt=Object(L.useMemo)(function(){Xe.current&&(Xe.current.style.zIndex=-1);try{var Be=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,Rt=/\"\/api\/attachments\/|\"\/attachments\/download\//g,Nt=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;Tt=Tt.replace(Be,"("+ge.a.API_SERVER+"/api/attachments/").replace(Rt,'"'+ge.a.API_SERVER+"/api/attachments/").replace(Nt,'"'+ge.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(Jt){}var Lt=ee(Tt),Ft=g();if(Tt.match(/\[TOC\]/)&&(Lt=Lt.replace("<p>[TOC]</p>",u()),E()),Lt=Lt.replace(/(__special_katext_id_\d+__)/g,function(Jt,Je){var je=Ft[Je],ft=je.type,Rn=je.expression;return Object(ye.renderToString)(xt(Rn)||"",{displayMode:ft==="block",throwOnError:!1,output:"html"})}),Lt=Lt.replace(/▁/g,"\u2581\u2581\u2581"),m(),ne){var Vt=document.createElement("div");return Vt.innerHTML=Lt,Vt.innerText}return setTimeout(function(){return Et()},500),Lt},[Tt]),bt=Object(L.useRef)();v.WebkitLineClamp=oe,oe&&(Ge=Object(U.a)(Object(U.a)({},Ge),v));function _t(Be){var Rt=Be.target;if(Rt.tagName.toUpperCase()==="IMG"){if(ce){var Nt=Rt.getAttribute("src");Zt(Nt),Dt("image")}}else if(Rt.tagName.toUpperCase()==="A"){var Lt=Rt.getAttribute("href");if(Lt.indexOf("office")>-1)Be.preventDefault(),Zt(Lt),Dt("office");else if(Lt.indexOf("application/pdf")>-1)Be.preventDefault(),Zt(Lt),Dt("pdf");else if(Lt.indexOf("text/html")>-1)Be.preventDefault(),Zt(Lt),Dt("html");else if(Lt.startsWith("#")){Be.preventDefault();var Ft=document.getElementById(Lt.replace("#",""));Ft&&Ft.scrollIntoView(!0)}}}var Et=function(){var Rt,Nt=(Rt=bt.current)===null||Rt===void 0?void 0:Rt.querySelectorAll("video");Nt==null||Nt.forEach(function(Lt){if(Lt.oncontextmenu=function(){return!1},Lt.src.indexOf(".m3u8")>-1&&!Lt.canPlayType("application/vnd.apple.mpegurl")){if(ie.a.isSupported()){var Ft=new ie.a;Ft.loadSource(Lt.src),Ft.attachMedia(Lt)}}})};Object(L.useEffect)(function(){if(bt.current&&kt&&(kt.match(Me)&&window.PR.prettyPrint()),bt.current)return bt.current.addEventListener("click",_t),function(){bt.current.removeEventListener("click",_t),m(),E()}},[kt,bt.current,_t]);var nt=function(Rt){if(!ue)return;Rt.target.nodeName==="IMG"?(Xe.current.style.zIndex=1,Xe.current.style.display="flex",Xe.current.style.width=Rt.target.clientWidth+"px",Xe.current.style.height=Rt.target.clientHeight+"px",Xe.current.style.top=Rt.target.offsetTop+"px",Xe.current.style.left=Rt.target.offsetLeft+"px",st.current.src=Rt.target.getAttribute("src")):Xe.current.style.display="none"};return _.a.createElement("div",{style:{position:"relative"}},_.a.createElement("div",{ref:bt,style:Object(U.a)({},Ge),className:"".concat(te||""," markdown-body ").concat(dt.a.mdBody),onMouseOver:nt,dangerouslySetInnerHTML:{__html:kt}}),_.a.createElement("div",{ref:Xe,className:dt.a.button},_.a.createElement($.a,null,_.a.createElement(Y.a,{onClick:function(){return Ot()}},"\u88C1\u526A"),_.a.createElement(Y.a,{onClick:function(){return ht()}},"\u7F16\u8F91"))),_.a.createElement("img",{ref:st,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),_.a.createElement(xe.a,{close:!0,data:It,type:It!=null&&It.length?Gt:"",style:Object(U.a)({},He),onClose:function(){return Zt("")}}))}},"9VGf":function(qe,Ke,V){"use strict";V.d(Ke,"a",function(){return P});var fe=V("q1tI"),$=V.n(fe);function P(Y,U){var O=Object(fe.useRef)();Object(fe.useEffect)(function(){O.current=Y}),Object(fe.useEffect)(function(){function H(){O.current()}if(U!==null){var N=setInterval(H,U);return function(){return clearInterval(N)}}},[U])}},"A+k2":function(qe,Ke,V){qe.exports={tabs:"tabs___2hYAP",active:"active___2Xkwd"}},Bd2K:function(qe,Ke,V){(function(fe){fe(V("VrN/"),V("osHv"))})(function(fe){fe.defineOption("autoCloseTags",!1,function(k,L,_){if(_!=fe.Init&&_&&k.removeKeyMap("autoCloseTags"),!L)return;var w={name:"autoCloseTags"};(typeof L!="object"||L.whenClosing!==!1)&&(w["'/'"]=function(D){return O(D)}),(typeof L!="object"||L.whenOpening!==!1)&&(w["'>'"]=function(D){return Y(D)}),k.addKeyMap(w)});var $=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],P=["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(k){if(k.getOption("disableInput"))return fe.Pass;for(var L=k.listSelections(),_=[],w=k.getOption("autoCloseTags"),D=0;D<L.length;D++){if(!L[D].empty())return fe.Pass;var T=L[D].head,C=k.getTokenAt(T),S=fe.innerMode(k.getMode(),C.state),f=S.state,l=S.mode.xmlCurrentTag&&S.mode.xmlCurrentTag(f),i=l&&l.name;if(!i)return fe.Pass;var c=S.mode.configuration=="html",E=typeof w=="object"&&w.dontCloseTags||c&&$,v=typeof w=="object"&&w.indentTags||c&&P;C.end>T.ch&&(i=i.slice(0,i.length-C.end+T.ch));var p=i.toLowerCase();if(!i||C.type=="string"&&(C.end!=T.ch||!/[\"\']/.test(C.string.charAt(C.string.length-1))||C.string.length==1)||C.type=="tag"&&l.close||C.string.indexOf("/")==T.ch-C.start-1||E&&H(E,p)>-1||N(k,S.mode.xmlCurrentContext&&S.mode.xmlCurrentContext(f)||[],i,T,!0))return fe.Pass;var u=typeof w=="object"&&w.emptyTags;if(u&&H(u,i)>-1){_[D]={text:"/>",newPos:fe.Pos(T.line,T.ch+2)};continue}var y=v&&H(v,p)>-1;_[D]={indent:y,text:">"+(y?`
`:"")+"</"+i+">",newPos:y?fe.Pos(T.line+1,0):fe.Pos(T.line,T.ch+1)}}for(var d=typeof w=="object"&&w.dontIndentOnAutoClose,D=L.length-1;D>=0;D--){var h=_[D];k.replaceRange(h.text,L[D].head,L[D].anchor,"+insert");var s=k.listSelections().slice(0);s[D]={head:h.newPos,anchor:h.newPos},k.setSelections(s),!d&&h.indent&&(k.indentLine(h.newPos.line,null,!0),k.indentLine(h.newPos.line+1,null,!0))}}function U(k,L){for(var _=k.listSelections(),w=[],D=L?"/":"</",T=k.getOption("autoCloseTags"),C=typeof T=="object"&&T.dontIndentOnSlash,S=0;S<_.length;S++){if(!_[S].empty())return fe.Pass;var f=_[S].head,l=k.getTokenAt(f),i=fe.innerMode(k.getMode(),l.state),c=i.state;if(L&&(l.type=="string"||l.string.charAt(0)!="<"||l.start!=f.ch-1))return fe.Pass;var E,v=i.mode.name!="xml"&&k.getMode().name=="htmlmixed";if(v&&i.mode.name=="javascript")E=D+"script";else if(v&&i.mode.name=="css")E=D+"style";else{var p=i.mode.xmlCurrentContext&&i.mode.xmlCurrentContext(c);if(!p||p.length&&N(k,p,p[p.length-1],f))return fe.Pass;E=D+p[p.length-1]}k.getLine(f.line).charAt(l.end)!=">"&&(E+=">"),w[S]=E}if(k.replaceSelections(w),_=k.listSelections(),!C)for(var S=0;S<_.length;S++)(S==_.length-1||_[S].head.line<_[S+1].head.line)&&k.indentLine(_[S].head.line)}function O(k){return k.getOption("disableInput")?fe.Pass:U(k,!0)}fe.commands.closeTag=function(k){return U(k)};function H(k,L){if(k.indexOf)return k.indexOf(L);for(var _=0,w=k.length;_<w;++_)if(k[_]==L)return _;return-1}function N(k,L,_,w,D){if(!fe.scanForClosingTag)return!1;var T=Math.min(k.lastLine()+1,w.line+500),C=fe.scanForClosingTag(k,w,null,T);if(!C||C.tag!=_)return!1;for(var S=D?1:0,f=L.length-1;f>=0&&L[f]==_;f--)++S;w=C.to;for(var f=1;f<S;f++){var l=fe.scanForClosingTag(k,w,null,T);if(!l||l.tag!=_)return!1;w=l.to}return!0}})},BjJ7:function(qe,Ke,V){"use strict";V.d(Ke,"d",function(){return $}),V.d(Ke,"c",function(){return P}),V.d(Ke,"e",function(){return Y}),V.d(Ke,"b",function(){return U}),V.d(Ke,"a",function(){return H});var fe=V("m3rI");function $(N){var k=!0;if(N.length>0){for(var L=0;L<N.length;L++)if(N[L].compile_success==0||!N[L].compile_success){k=!1;break}}else k=!1;return k}function P(N){for(var k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",L=[],_=0;_<N.length;_++){var w=N[_],D=k?"".concat(k,"/").concat(w.name):"".concat(w.name);L.push({title:w.name,isLeaf:!(w.type==="tree"),key:D})}return L}function Y(N,k,L){for(var _=0;_<N.length;_++){var w=N[_];if(w.key===k){w.children=L;break}w.children&&Y(w.children,k,L)}return N}function U(N,k,L){var _;return function(){var w=this,D=arguments,T=function(){_=null,L||N.apply(w,D)},C=L&&!_;clearTimeout(_),_=setTimeout(T,k),C&&N.apply(w,D)}}var O=!0,H=fe.a.API_SERVER},"C+DQ":function(qe,Ke,V){},DlQD:function(qe,Ke,V){(function(fe,$){qe.exports=$()})(this,function(){"use strict";function fe(q,ae){for(var ue=0;ue<ae.length;ue++){var te=ae[ue];te.enumerable=te.enumerable||!1,te.configurable=!0,"value"in te&&(te.writable=!0),Object.defineProperty(q,te.key,te)}}function $(q,ae,ue){return ae&&fe(q.prototype,ae),ue&&fe(q,ue),q}function P(q,ae){if(!q)return;if(typeof q=="string")return Y(q,ae);var ue=Object.prototype.toString.call(q).slice(8,-1);if(ue==="Object"&&q.constructor&&(ue=q.constructor.name),ue==="Map"||ue==="Set")return Array.from(q);if(ue==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(ue))return Y(q,ae)}function Y(q,ae){(ae==null||ae>q.length)&&(ae=q.length);for(var ue=0,te=new Array(ae);ue<ae;ue++)te[ue]=q[ue];return te}function U(q,ae){var ue;if(typeof Symbol=="undefined"||q[Symbol.iterator]==null){if(Array.isArray(q)||(ue=P(q))||ae&&q&&typeof q.length=="number"){ue&&(q=ue);var te=0;return function(){return te>=q.length?{done:!0}:{done:!1,value:q[te++]}}}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 ue=q[Symbol.iterator](),ue.next.bind(ue)}function O(q,ae){return ae={exports:{}},q(ae,ae.exports),ae.exports}var H=O(function(q){function ae(){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 ue(te){q.exports.defaults=te}q.exports={defaults:ae(),getDefaults:ae,changeDefaults:ue}}),N=H.defaults,k=H.getDefaults,L=H.changeDefaults,_=/[&<>"']/,w=/[&<>"']/g,D=/[<>"']|&(?!#?\w+;)/,T=/[<>"']|&(?!#?\w+;)/g,C={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},S=function(ae){return C[ae]};function f(q,ae){if(ae){if(_.test(q))return q.replace(w,S)}else if(D.test(q))return q.replace(T,S);return q}var l=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function i(q){return q.replace(l,function(ae,ue){return ue=ue.toLowerCase(),ue==="colon"?":":ue.charAt(0)==="#"?ue.charAt(1)==="x"?String.fromCharCode(parseInt(ue.substring(2),16)):String.fromCharCode(+ue.substring(1)):""})}var c=/(^|[^\[])\^/g;function E(q,ae){q=q.source||q,ae=ae||"";var ue={replace:function(ne,oe){return oe=oe.source||oe,oe=oe.replace(c,"$1"),q=q.replace(ne,oe),ue},getRegex:function(){return new RegExp(q,ae)}};return ue}var v=/[^\w:]/g,p=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function u(q,ae,ue){if(q){var te;try{te=decodeURIComponent(i(ue)).replace(v,"").toLowerCase()}catch(ne){return null}if(te.indexOf("javascript:")===0||te.indexOf("vbscript:")===0||te.indexOf("data:")===0)return null}ae&&!p.test(ue)&&(ue=a(ae,ue));try{ue=encodeURI(ue).replace(/%25/g,"%")}catch(ne){return null}return ue}var y={},d=/^[^:]+:\/*[^/]*$/,h=/^([^:]+:)[\s\S]*$/,s=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(q,ae){y[" "+q]||(d.test(q)?y[" "+q]=q+"/":y[" "+q]=M(q,"/",!0)),q=y[" "+q];var ue=q.indexOf(":")===-1;return ae.substring(0,2)==="//"?ue?ae:q.replace(h,"$1")+ae:ae.charAt(0)==="/"?ue?ae:q.replace(s,"$1")+ae:q+ae}var g={exec:function(){}};function m(q){for(var ae=1,ue,te;ae<arguments.length;ae++){ue=arguments[ae];for(te in ue)Object.prototype.hasOwnProperty.call(ue,te)&&(q[te]=ue[te])}return q}function b(q,ae){var ue=q.replace(/\|/g,function(oe,he,ce){for(var Ce=!1,Ae=he;--Ae>=0&&ce[Ae]==="\\";)Ce=!Ce;return Ce?"|":" |"}),te=ue.split(/ \|/),ne=0;if(te.length>ae)te.splice(ae);else for(;te.length<ae;)te.push("");for(;ne<te.length;ne++)te[ne]=te[ne].trim().replace(/\\\|/g,"|");return te}function M(q,ae,ue){var te=q.length;if(te===0)return"";for(var ne=0;ne<te;){var oe=q.charAt(te-ne-1);if(oe===ae&&!ue)ne++;else if(oe!==ae&&ue)ne++;else break}return q.substr(0,te-ne)}function K(q,ae){if(q.indexOf(ae[1])===-1)return-1;for(var ue=q.length,te=0,ne=0;ne<ue;ne++)if(q[ne]==="\\")ne++;else if(q[ne]===ae[0])te++;else if(q[ne]===ae[1]&&(te--,te<0))return ne;return-1}function z(q){q&&q.sanitize&&!q.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}var ee={escape:f,unescape:i,edit:E,cleanUrl:u,resolveUrl:a,noopTest:g,merge:m,splitCells:b,rtrim:M,findClosingBracket:K,checkSanitizeDeprecation:z},G=H.defaults,F=ee.rtrim,ie=ee.splitCells,ge=ee.escape,ye=ee.findClosingBracket;function xe(q,ae,ue){var te=ae.href,ne=ae.title?ge(ae.title):null,oe=q[1].replace(/\\([\[\]])/g,"$1");return q[0].charAt(0)!=="!"?{type:"link",raw:ue,href:te,title:ne,text:oe}:{type:"image",raw:ue,href:te,title:ne,text:ge(oe)}}function Te(q,ae){var ue=q.match(/^(\s+)(?:```)/);if(ue===null)return ae;var te=ue[1];return ae.split(`
`).map(function(ne){var oe=ne.match(/^\s+/);if(oe===null)return ne;var he=oe[0];return he.length>=te.length?ne.slice(te.length):ne}).join(`
`)}var Se=function(){function q(ue){this.options=ue||G}var ae=q.prototype;return ae.space=function(te){var ne=this.rules.block.newline.exec(te);if(ne)return ne[0].length>1?{type:"space",raw:ne[0]}:{raw:`
`}},ae.code=function(te,ne){var oe=this.rules.block.code.exec(te);if(oe){var he=ne[ne.length-1];if(he&&he.type==="paragraph")return{raw:oe[0],text:oe[0].trimRight()};var ce=oe[0].replace(/^ {4}/gm,"");return{type:"code",raw:oe[0],codeBlockStyle:"indented",text:this.options.pedantic?ce:F(ce,`
`)}}},ae.fences=function(te){var ne=this.rules.block.fences.exec(te);if(ne){var oe=ne[0],he=Te(oe,ne[3]||"");return{type:"code",raw:oe,lang:ne[2]?ne[2].trim():ne[2],text:he}}},ae.heading=function(te){var ne=this.rules.block.heading.exec(te);if(ne)return{type:"heading",raw:ne[0],depth:ne[1].length,text:ne[2]}},ae.nptable=function(te){var ne=this.rules.block.nptable.exec(te);if(ne){var oe={type:"table",header:ie(ne[1].replace(/^ *| *\| *$/g,"")),align:ne[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ne[3]?ne[3].replace(/\n$/,"").split(`
`):[],raw:ne[0]};if(oe.header.length===oe.align.length){var he=oe.align.length,ce;for(ce=0;ce<he;ce++)/^ *-+: *$/.test(oe.align[ce])?oe.align[ce]="right":/^ *:-+: *$/.test(oe.align[ce])?oe.align[ce]="center":/^ *:-+ *$/.test(oe.align[ce])?oe.align[ce]="left":oe.align[ce]=null;for(he=oe.cells.length,ce=0;ce<he;ce++)oe.cells[ce]=ie(oe.cells[ce],oe.header.length);return oe}}},ae.hr=function(te){var ne=this.rules.block.hr.exec(te);if(ne)return{type:"hr",raw:ne[0]}},ae.blockquote=function(te){var ne=this.rules.block.blockquote.exec(te);if(ne){var oe=ne[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:ne[0],text:oe}}},ae.list=function(te){var ne=this.rules.block.list.exec(te);if(ne){for(var oe=ne[0],he=ne[2],ce=he.length>1,Ce=he[he.length-1]===")",Ae={type:"list",raw:oe,ordered:ce,start:ce?+he.slice(0,-1):"",loose:!1,items:[]},Ge=ne[0].match(this.rules.block.item),Ue=!1,He,Tt,Xe,st,jt,ze,It,Zt=Ge.length,At=0;At<Zt;At++)He=Ge[At],oe=He,Tt=He.length,He=He.replace(/^ *([*+-]|\d+[.)]) */,""),~He.indexOf(`
`)&&(Tt-=He.length,He=this.options.pedantic?He.replace(/^ {1,4}/gm,""):He.replace(new RegExp("^ {1,"+Tt+"}","gm"),"")),At!==Zt-1&&(Xe=this.rules.block.bullet.exec(Ge[At+1])[0],(ce?Xe.length===1||!Ce&&Xe[Xe.length-1]===")":Xe.length>1||this.options.smartLists&&Xe!==he)&&(st=Ge.slice(At+1).join(`
`),Ae.raw=Ae.raw.substring(0,Ae.raw.length-st.length),At=Zt-1)),jt=Ue||/\n\n(?!\s*$)/.test(He),At!==Zt-1&&(Ue=He.charAt(He.length-1)===`
`,jt||(jt=Ue)),jt&&(Ae.loose=!0),ze=/^\[[ xX]\] /.test(He),It=void 0,ze&&(It=He[1]!==" ",He=He.replace(/^\[[ xX]\] +/,"")),Ae.items.push({type:"list_item",raw:oe,task:ze,checked:It,loose:jt,text:He});return Ae}},ae.html=function(te){var ne=this.rules.block.html.exec(te);if(ne)return{type:this.options.sanitize?"paragraph":"html",raw:ne[0],pre:!this.options.sanitizer&&(ne[1]==="pre"||ne[1]==="script"||ne[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ne[0]):ge(ne[0]):ne[0]}},ae.def=function(te){var ne=this.rules.block.def.exec(te);if(ne){ne[3]&&(ne[3]=ne[3].substring(1,ne[3].length-1));var oe=ne[1].toLowerCase().replace(/\s+/g," ");return{tag:oe,raw:ne[0],href:ne[2],title:ne[3]}}},ae.table=function(te){var ne=this.rules.block.table.exec(te);if(ne){var oe={type:"table",header:ie(ne[1].replace(/^ *| *\| *$/g,"")),align:ne[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ne[3]?ne[3].replace(/\n$/,"").split(`
`):[]};if(oe.header.length===oe.align.length){oe.raw=ne[0];var he=oe.align.length,ce;for(ce=0;ce<he;ce++)/^ *-+: *$/.test(oe.align[ce])?oe.align[ce]="right":/^ *:-+: *$/.test(oe.align[ce])?oe.align[ce]="center":/^ *:-+ *$/.test(oe.align[ce])?oe.align[ce]="left":oe.align[ce]=null;for(he=oe.cells.length,ce=0;ce<he;ce++)oe.cells[ce]=ie(oe.cells[ce].replace(/^ *\| *| *\| *$/g,""),oe.header.length);return oe}}},ae.lheading=function(te){var ne=this.rules.block.lheading.exec(te);if(ne)return{type:"heading",raw:ne[0],depth:ne[2].charAt(0)==="="?1:2,text:ne[1]}},ae.paragraph=function(te){var ne=this.rules.block.paragraph.exec(te);if(ne)return{type:"paragraph",raw:ne[0],text:ne[1].charAt(ne[1].length-1)===`
`?ne[1].slice(0,-1):ne[1]}},ae.text=function(te,ne){var oe=this.rules.block.text.exec(te);if(oe){var he=ne[ne.length-1];return he&&he.type==="text"?{raw:oe[0],text:oe[0]}:{type:"text",raw:oe[0],text:oe[0]}}},ae.escape=function(te){var ne=this.rules.inline.escape.exec(te);if(ne)return{type:"escape",raw:ne[0],text:ge(ne[1])}},ae.tag=function(te,ne,oe){var he=this.rules.inline.tag.exec(te);if(he)return!ne&&/^<a /i.test(he[0])?ne=!0:ne&&/^<\/a>/i.test(he[0])&&(ne=!1),!oe&&/^<(pre|code|kbd|script)(\s|>)/i.test(he[0])?oe=!0:oe&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(he[0])&&(oe=!1),{type:this.options.sanitize?"text":"html",raw:he[0],inLink:ne,inRawBlock:oe,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(he[0]):ge(he[0]):he[0]}},ae.link=function(te){var ne=this.rules.inline.link.exec(te);if(ne){var oe=ye(ne[2],"()");if(oe>-1){var he=ne[0].indexOf("!")===0?5:4,ce=he+ne[1].length+oe;ne[2]=ne[2].substring(0,oe),ne[0]=ne[0].substring(0,ce).trim(),ne[3]=""}var Ce=ne[2],Ae="";if(this.options.pedantic){var Ge=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Ce);Ge?(Ce=Ge[1],Ae=Ge[3]):Ae=""}else Ae=ne[3]?ne[3].slice(1,-1):"";Ce=Ce.trim().replace(/^<([\s\S]*)>$/,"$1");var Ue=xe(ne,{href:Ce&&Ce.replace(this.rules.inline._escapes,"$1"),title:Ae&&Ae.replace(this.rules.inline._escapes,"$1")},ne[0]);return Ue}},ae.reflink=function(te,ne){var oe;if((oe=this.rules.inline.reflink.exec(te))||(oe=this.rules.inline.nolink.exec(te))){var he=(oe[2]||oe[1]).replace(/\s+/g," ");if(he=ne[he.toLowerCase()],!he||!he.href){var ce=oe[0].charAt(0);return{type:"text",raw:ce,text:ce}}var Ce=xe(oe,he,oe[0]);return Ce}},ae.strong=function(te,ne,oe){oe===void 0&&(oe="");var he=this.rules.inline.strong.start.exec(te);if(he&&(!he[1]||he[1]&&(oe===""||this.rules.inline.punctuation.exec(oe)))){ne=ne.slice(-1*te.length);var ce=he[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;ce.lastIndex=0;for(var Ce;(he=ce.exec(ne))!=null;)if(Ce=this.rules.inline.strong.middle.exec(ne.slice(0,he.index+3)),Ce)return{type:"strong",raw:te.slice(0,Ce[0].length),text:te.slice(2,Ce[0].length-2)}}},ae.em=function(te,ne,oe){oe===void 0&&(oe="");var he=this.rules.inline.em.start.exec(te);if(he&&(!he[1]||he[1]&&(oe===""||this.rules.inline.punctuation.exec(oe)))){ne=ne.slice(-1*te.length);var ce=he[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;ce.lastIndex=0;for(var Ce;(he=ce.exec(ne))!=null;)if(Ce=this.rules.inline.em.middle.exec(ne.slice(0,he.index+2)),Ce)return{type:"em",raw:te.slice(0,Ce[0].length),text:te.slice(1,Ce[0].length-1)}}},ae.codespan=function(te){var ne=this.rules.inline.code.exec(te);if(ne){var oe=ne[2].replace(/\n/g," "),he=/[^ ]/.test(oe),ce=oe.startsWith(" ")&&oe.endsWith(" ");return he&&ce&&(oe=oe.substring(1,oe.length-1)),oe=ge(oe,!0),{type:"codespan",raw:ne[0],text:oe}}},ae.br=function(te){var ne=this.rules.inline.br.exec(te);if(ne)return{type:"br",raw:ne[0]}},ae.del=function(te){var ne=this.rules.inline.del.exec(te);if(ne)return{type:"del",raw:ne[0],text:ne[1]}},ae.autolink=function(te,ne){var oe=this.rules.inline.autolink.exec(te);if(oe){var he,ce;return oe[2]==="@"?(he=ge(this.options.mangle?ne(oe[1]):oe[1]),ce="mailto:"+he):(he=ge(oe[1]),ce=he),{type:"link",raw:oe[0],text:he,href:ce,tokens:[{type:"text",raw:he,text:he}]}}},ae.url=function(te,ne){var oe;if(oe=this.rules.inline.url.exec(te)){var he,ce;if(oe[2]==="@")he=ge(this.options.mangle?ne(oe[0]):oe[0]),ce="mailto:"+he;else{var Ce;do Ce=oe[0],oe[0]=this.rules.inline._backpedal.exec(oe[0])[0];while(Ce!==oe[0]);he=ge(oe[0]),oe[1]==="www."?ce="http://"+he:ce=he}return{type:"link",raw:oe[0],text:he,href:ce,tokens:[{type:"text",raw:he,text:he}]}}},ae.inlineText=function(te,ne,oe){var he=this.rules.inline.text.exec(te);if(he){var ce;return ne?ce=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(he[0]):ge(he[0]):he[0]:ce=ge(this.options.smartypants?oe(he[0]):he[0]),{type:"text",raw:he[0],text:ce}}},q}(),me=ee.noopTest,pe=ee.edit,Ee=ee.merge,le={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6}) +([^\n]*?)(?: +#+)? *(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|<![A-Z][\\s\\S]*?>\\n*|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>\\n*|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:me,table:me,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};le._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,le._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,le.def=pe(le.def).replace("label",le._label).replace("title",le._title).getRegex(),le.bullet=/(?:[*+-]|\d{1,9}[.)])/,le.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,le.item=pe(le.item,"gm").replace(/bull/g,le.bullet).getRegex(),le.list=pe(le.list).replace(/bull/g,le.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+le.def.source+")").getRegex(),le._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",le._comment=/<!--(?!-?>)[\s\S]*?-->/,le.html=pe(le.html,"i").replace("comment",le._comment).replace("tag",le._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),le.paragraph=pe(le._paragraph).replace("hr",le.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",le._tag).getRegex(),le.blockquote=pe(le.blockquote).replace("paragraph",le.paragraph).getRegex(),le.normal=Ee({},le),le.gfm=Ee({},le.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*|$)"}),le.gfm.nptable=pe(le.gfm.nptable).replace("hr",le.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",le._tag).getRegex(),le.gfm.table=pe(le.gfm.table).replace("hr",le.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",le._tag).getRegex(),le.pedantic=Ee({},le.normal,{html:pe(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",le._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,fences:me,paragraph:pe(le.normal._paragraph).replace("hr",le.hr).replace("heading",` *#{1,6} *[^
]`).replace("lheading",le.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var I={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:me,tag:"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,nolink:/^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",strong:{start:/^(?:(\*\*(?=[*punctuation]))|\*\*)(?![\s])|__/,middle:/^\*\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*\*$|^__(?![\s])((?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?)__$/,endAst:/[^punctuation\s]\*\*(?!\*)|[punctuation]\*\*(?!\*)(?:(?=[punctuation\s]|$))/,endUnd:/[^\s]__(?!_)(?:(?=[punctuation\s])|$)/},em:{start:/^(?:(\*(?=[punctuation]))|\*)(?![*\s])|_/,middle:/^\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*$|^_(?![_\s])(?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?_$/,endAst:/[^punctuation\s]\*(?!\*)|[punctuation]\*(?!\*)(?:(?=[punctuation\s]|$))/,endUnd:/[^\s]_(?!_)(?:(?=[punctuation\s])|$)/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:me,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};I._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",I.punctuation=pe(I.punctuation).replace(/punctuation/g,I._punctuation).getRegex(),I._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",I._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",I.em.start=pe(I.em.start).replace(/punctuation/g,I._punctuation).getRegex(),I.em.middle=pe(I.em.middle).replace(/punctuation/g,I._punctuation).replace(/overlapSkip/g,I._overlapSkip).getRegex(),I.em.endAst=pe(I.em.endAst,"g").replace(/punctuation/g,I._punctuation).getRegex(),I.em.endUnd=pe(I.em.endUnd,"g").replace(/punctuation/g,I._punctuation).getRegex(),I.strong.start=pe(I.strong.start).replace(/punctuation/g,I._punctuation).getRegex(),I.strong.middle=pe(I.strong.middle).replace(/punctuation/g,I._punctuation).replace(/blockSkip/g,I._blockSkip).getRegex(),I.strong.endAst=pe(I.strong.endAst,"g").replace(/punctuation/g,I._punctuation).getRegex(),I.strong.endUnd=pe(I.strong.endUnd,"g").replace(/punctuation/g,I._punctuation).getRegex(),I.blockSkip=pe(I._blockSkip,"g").getRegex(),I.overlapSkip=pe(I._overlapSkip,"g").getRegex(),I._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,I._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,I._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])?)+(?![-_])/,I.autolink=pe(I.autolink).replace("scheme",I._scheme).replace("email",I._email).getRegex(),I._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,I.tag=pe(I.tag).replace("comment",le._comment).replace("attribute",I._attribute).getRegex(),I._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,I._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,I._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,I.link=pe(I.link).replace("label",I._label).replace("href",I._href).replace("title",I._title).getRegex(),I.reflink=pe(I.reflink).replace("label",I._label).getRegex(),I.reflinkSearch=pe(I.reflinkSearch,"g").replace("reflink",I.reflink).replace("nolink",I.nolink).getRegex(),I.normal=Ee({},I),I.pedantic=Ee({},I.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:pe(/^!?\[(label)\]\((.*?)\)/).replace("label",I._label).getRegex(),reflink:pe(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",I._label).getRegex()}),I.gfm=Ee({},I.normal,{escape:pe(I.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^~+(?=\S)([\s\S]*?\S)~+/,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*~]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))|(?= {2,}\n|[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))/}),I.gfm.url=pe(I.gfm.url,"i").replace("email",I.gfm._extended_email).getRegex(),I.breaks=Ee({},I.gfm,{br:pe(I.br).replace("{2,}","*").getRegex(),text:pe(I.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var x={block:le,inline:I},R=H.defaults,W=x.block,J=x.inline;function B(q){return q.replace(/---/g,"\u2014").replace(/--/g,"\u2013").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1\u2018").replace(/'/g,"\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1\u201C").replace(/"/g,"\u201D").replace(/\.{3}/g,"\u2026")}function de(q){var ae="",ue,te,ne=q.length;for(ue=0;ue<ne;ue++)te=q.charCodeAt(ue),Math.random()>.5&&(te="x"+te.toString(16)),ae+="&#"+te+";";return ae}var _e=function(){function q(ue){this.tokens=[],this.tokens.links=Object.create(null),this.options=ue||R,this.options.tokenizer=this.options.tokenizer||new Se,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var te={block:W.normal,inline:J.normal};this.options.pedantic?(te.block=W.pedantic,te.inline=J.pedantic):this.options.gfm&&(te.block=W.gfm,this.options.breaks?te.inline=J.breaks:te.inline=J.gfm),this.tokenizer.rules=te}q.lex=function(te,ne){var oe=new q(ne);return oe.lex(te)};var ae=q.prototype;return ae.lex=function(te){return te=te.replace(/\r\n|\r/g,`
`).replace(/\t/g," "),this.blockTokens(te,this.tokens,!0),this.inline(this.tokens),this.tokens},ae.blockTokens=function(te,ne,oe){ne===void 0&&(ne=[]),oe===void 0&&(oe=!0),te=te.replace(/^ +$/gm,"");for(var he,ce,Ce,Ae;te;){if(he=this.tokenizer.space(te)){te=te.substring(he.raw.length),he.type&&ne.push(he);continue}if(he=this.tokenizer.code(te,ne)){te=te.substring(he.raw.length),he.type?ne.push(he):(Ae=ne[ne.length-1],Ae.raw+=`
`+he.raw,Ae.text+=`
`+he.text);continue}if(he=this.tokenizer.fences(te)){te=te.substring(he.raw.length),ne.push(he);continue}if(he=this.tokenizer.heading(te)){te=te.substring(he.raw.length),ne.push(he);continue}if(he=this.tokenizer.nptable(te)){te=te.substring(he.raw.length),ne.push(he);continue}if(he=this.tokenizer.hr(te)){te=te.substring(he.raw.length),ne.push(he);continue}if(he=this.tokenizer.blockquote(te)){te=te.substring(he.raw.length),he.tokens=this.blockTokens(he.text,[],oe),ne.push(he);continue}if(he=this.tokenizer.list(te)){for(te=te.substring(he.raw.length),Ce=he.items.length,ce=0;ce<Ce;ce++)he.items[ce].tokens=this.blockTokens(he.items[ce].text,[],!1);ne.push(he);continue}if(he=this.tokenizer.html(te)){te=te.substring(he.raw.length),ne.push(he);continue}if(oe&&(he=this.tokenizer.def(te))){te=te.substring(he.raw.length),this.tokens.links[he.tag]||(this.tokens.links[he.tag]={href:he.href,title:he.title});continue}if(he=this.tokenizer.table(te)){te=te.substring(he.raw.length),ne.push(he);continue}if(he=this.tokenizer.lheading(te)){te=te.substring(he.raw.length),ne.push(he);continue}if(oe&&(he=this.tokenizer.paragraph(te))){te=te.substring(he.raw.length),ne.push(he);continue}if(he=this.tokenizer.text(te,ne)){te=te.substring(he.raw.length),he.type?ne.push(he):(Ae=ne[ne.length-1],Ae.raw+=`
`+he.raw,Ae.text+=`
`+he.text);continue}if(te){var Ge="Infinite loop on byte: "+te.charCodeAt(0);if(this.options.silent){console.error(Ge);break}else throw new Error(Ge)}}return ne},ae.inline=function(te){var ne,oe,he,ce,Ce,Ae,Ge=te.length;for(ne=0;ne<Ge;ne++){Ae=te[ne];switch(Ae.type){case"paragraph":case"text":case"heading":{Ae.tokens=[],this.inlineTokens(Ae.text,Ae.tokens);break}case"table":{for(Ae.tokens={header:[],cells:[]},ce=Ae.header.length,oe=0;oe<ce;oe++)Ae.tokens.header[oe]=[],this.inlineTokens(Ae.header[oe],Ae.tokens.header[oe]);for(ce=Ae.cells.length,oe=0;oe<ce;oe++)for(Ce=Ae.cells[oe],Ae.tokens.cells[oe]=[],he=0;he<Ce.length;he++)Ae.tokens.cells[oe][he]=[],this.inlineTokens(Ce[he],Ae.tokens.cells[oe][he]);break}case"blockquote":{this.inline(Ae.tokens);break}case"list":{for(ce=Ae.items.length,oe=0;oe<ce;oe++)this.inline(Ae.items[oe].tokens);break}}}return te},ae.inlineTokens=function(te,ne,oe,he,ce){ne===void 0&&(ne=[]),oe===void 0&&(oe=!1),he===void 0&&(he=!1),ce===void 0&&(ce="");var Ce,Ae=te,Ge;if(this.tokens.links){var Ue=Object.keys(this.tokens.links);if(Ue.length>0)for(;(Ge=this.tokenizer.rules.inline.reflinkSearch.exec(Ae))!=null;)Ue.includes(Ge[0].slice(Ge[0].lastIndexOf("[")+1,-1))&&(Ae=Ae.slice(0,Ge.index)+"["+"a".repeat(Ge[0].length-2)+"]"+Ae.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(Ge=this.tokenizer.rules.inline.blockSkip.exec(Ae))!=null;)Ae=Ae.slice(0,Ge.index)+"["+"a".repeat(Ge[0].length-2)+"]"+Ae.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;te;){if(Ce=this.tokenizer.escape(te)){te=te.substring(Ce.raw.length),ne.push(Ce);continue}if(Ce=this.tokenizer.tag(te,oe,he)){te=te.substring(Ce.raw.length),oe=Ce.inLink,he=Ce.inRawBlock,ne.push(Ce);continue}if(Ce=this.tokenizer.link(te)){te=te.substring(Ce.raw.length),Ce.type==="link"&&(Ce.tokens=this.inlineTokens(Ce.text,[],!0,he)),ne.push(Ce);continue}if(Ce=this.tokenizer.reflink(te,this.tokens.links)){te=te.substring(Ce.raw.length),Ce.type==="link"&&(Ce.tokens=this.inlineTokens(Ce.text,[],!0,he)),ne.push(Ce);continue}if(Ce=this.tokenizer.strong(te,Ae,ce)){te=te.substring(Ce.raw.length),Ce.tokens=this.inlineTokens(Ce.text,[],oe,he),ne.push(Ce);continue}if(Ce=this.tokenizer.em(te,Ae,ce)){te=te.substring(Ce.raw.length),Ce.tokens=this.inlineTokens(Ce.text,[],oe,he),ne.push(Ce);continue}if(Ce=this.tokenizer.codespan(te)){te=te.substring(Ce.raw.length),ne.push(Ce);continue}if(Ce=this.tokenizer.br(te)){te=te.substring(Ce.raw.length),ne.push(Ce);continue}if(Ce=this.tokenizer.del(te)){te=te.substring(Ce.raw.length),Ce.tokens=this.inlineTokens(Ce.text,[],oe,he),ne.push(Ce);continue}if(Ce=this.tokenizer.autolink(te,de)){te=te.substring(Ce.raw.length),ne.push(Ce);continue}if(!oe&&(Ce=this.tokenizer.url(te,de))){te=te.substring(Ce.raw.length),ne.push(Ce);continue}if(Ce=this.tokenizer.inlineText(te,he,B)){te=te.substring(Ce.raw.length),ce=Ce.raw.slice(-1),ne.push(Ce);continue}if(te){var He="Infinite loop on byte: "+te.charCodeAt(0);if(this.options.silent){console.error(He);break}else throw new Error(He)}}return ne},$(q,null,[{key:"rules",get:function(){return{block:W,inline:J}}}]),q}(),Re=H.defaults,Oe=ee.cleanUrl,ke=ee.escape,Ie=function(){function q(ue){this.options=ue||Re}var ae=q.prototype;return ae.code=function(te,ne,oe){var he=(ne||"").match(/\S*/)[0];if(this.options.highlight){var ce=this.options.highlight(te,he);ce!=null&&ce!==te&&(oe=!0,te=ce)}return he?'<pre><code class="'+this.options.langPrefix+ke(he,!0)+'">'+(oe?te:ke(te,!0))+`</code></pre>
`:"<pre><code>"+(oe?te:ke(te,!0))+`</code></pre>
`},ae.blockquote=function(te){return`<blockquote>
`+te+`</blockquote>
`},ae.html=function(te){return te},ae.heading=function(te,ne,oe,he){return this.options.headerIds?"<h"+ne+' id="'+this.options.headerPrefix+he.slug(oe)+'">'+te+"</h"+ne+`>
`:"<h"+ne+">"+te+"</h"+ne+`>
`},ae.hr=function(){return this.options.xhtml?`<hr/>
`:`<hr>
`},ae.list=function(te,ne,oe){var he=ne?"ol":"ul",ce=ne&&oe!==1?' start="'+oe+'"':"";return"<"+he+ce+`>
`+te+"</"+he+`>
`},ae.listitem=function(te){return"<li>"+te+`</li>
`},ae.checkbox=function(te){return"<input "+(te?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},ae.paragraph=function(te){return"<p>"+te+`</p>
`},ae.table=function(te,ne){return ne&&(ne="<tbody>"+ne+"</tbody>"),`<table>
<thead>
`+te+`</thead>
`+ne+`</table>
`},ae.tablerow=function(te){return`<tr>
`+te+`</tr>
`},ae.tablecell=function(te,ne){var oe=ne.header?"th":"td",he=ne.align?"<"+oe+' align="'+ne.align+'">':"<"+oe+">";return he+te+"</"+oe+`>
`},ae.strong=function(te){return"<strong>"+te+"</strong>"},ae.em=function(te){return"<em>"+te+"</em>"},ae.codespan=function(te){return"<code>"+te+"</code>"},ae.br=function(){return this.options.xhtml?"<br/>":"<br>"},ae.del=function(te){return"<del>"+te+"</del>"},ae.link=function(te,ne,oe){if(te=Oe(this.options.sanitize,this.options.baseUrl,te),te===null)return oe;var he='<a href="'+ke(te)+'"';return ne&&(he+=' title="'+ne+'"'),he+=">"+oe+"</a>",he},ae.image=function(te,ne,oe){if(te=Oe(this.options.sanitize,this.options.baseUrl,te),te===null)return oe;var he='<img src="'+te+'" alt="'+oe+'"';return ne&&(he+=' title="'+ne+'"'),he+=this.options.xhtml?"/>":">",he},ae.text=function(te){return te},q}(),De=function(){function q(){}var ae=q.prototype;return ae.strong=function(te){return te},ae.em=function(te){return te},ae.codespan=function(te){return te},ae.del=function(te){return te},ae.html=function(te){return te},ae.text=function(te){return te},ae.link=function(te,ne,oe){return""+oe},ae.image=function(te,ne,oe){return""+oe},ae.br=function(){return""},q}(),Ve=function(){function q(){this.seen={}}var ae=q.prototype;return ae.slug=function(te){var ne=te.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(ne)){var oe=ne;do this.seen[oe]++,ne=oe+"-"+this.seen[oe];while(this.seen.hasOwnProperty(ne))}return this.seen[ne]=0,ne},q}(),Qe=H.defaults,at=ee.unescape,Ze=function(){function q(ue){this.options=ue||Qe,this.options.renderer=this.options.renderer||new Ie,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new De,this.slugger=new Ve}q.parse=function(te,ne){var oe=new q(ne);return oe.parse(te)};var ae=q.prototype;return ae.parse=function(te,ne){ne===void 0&&(ne=!0);var oe="",he,ce,Ce,Ae,Ge,Ue,He,Tt,Xe,st,jt,ze,It,Zt,At,qt,Gt,Dt,Ot=te.length;for(he=0;he<Ot;he++){st=te[he];switch(st.type){case"space":continue;case"hr":{oe+=this.renderer.hr();continue}case"heading":{oe+=this.renderer.heading(this.parseInline(st.tokens),st.depth,at(this.parseInline(st.tokens,this.textRenderer)),this.slugger);continue}case"code":{oe+=this.renderer.code(st.text,st.lang,st.escaped);continue}case"table":{for(Tt="",He="",Ae=st.header.length,ce=0;ce<Ae;ce++)He+=this.renderer.tablecell(this.parseInline(st.tokens.header[ce]),{header:!0,align:st.align[ce]});for(Tt+=this.renderer.tablerow(He),Xe="",Ae=st.cells.length,ce=0;ce<Ae;ce++){for(Ue=st.tokens.cells[ce],He="",Ge=Ue.length,Ce=0;Ce<Ge;Ce++)He+=this.renderer.tablecell(this.parseInline(Ue[Ce]),{header:!1,align:st.align[Ce]});Xe+=this.renderer.tablerow(He)}oe+=this.renderer.table(Tt,Xe);continue}case"blockquote":{Xe=this.parse(st.tokens),oe+=this.renderer.blockquote(Xe);continue}case"list":{for(jt=st.ordered,ze=st.start,It=st.loose,Ae=st.items.length,Xe="",ce=0;ce<Ae;ce++)At=st.items[ce],qt=At.checked,Gt=At.task,Zt="",At.task&&(Dt=this.renderer.checkbox(qt),It?At.tokens.length>0&&At.tokens[0].type==="text"?(At.tokens[0].text=Dt+" "+At.tokens[0].text,At.tokens[0].tokens&&At.tokens[0].tokens.length>0&&At.tokens[0].tokens[0].type==="text"&&(At.tokens[0].tokens[0].text=Dt+" "+At.tokens[0].tokens[0].text)):At.tokens.unshift({type:"text",text:Dt}):Zt+=Dt),Zt+=this.parse(At.tokens,It),Xe+=this.renderer.listitem(Zt,Gt,qt);oe+=this.renderer.list(Xe,jt,ze);continue}case"html":{oe+=this.renderer.html(st.text);continue}case"paragraph":{oe+=this.renderer.paragraph(this.parseInline(st.tokens));continue}case"text":{for(Xe=st.tokens?this.parseInline(st.tokens):st.text;he+1<Ot&&te[he+1].type==="text";)st=te[++he],Xe+=`
`+(st.tokens?this.parseInline(st.tokens):st.text);oe+=ne?this.renderer.paragraph(Xe):Xe;continue}default:{var ht='Token with "'+st.type+'" type was not found.';if(this.options.silent){console.error(ht);return}else throw new Error(ht)}}}return oe},ae.parseInline=function(te,ne){ne=ne||this.renderer;var oe="",he,ce,Ce=te.length;for(he=0;he<Ce;he++){ce=te[he];switch(ce.type){case"escape":{oe+=ne.text(ce.text);break}case"html":{oe+=ne.html(ce.text);break}case"link":{oe+=ne.link(ce.href,ce.title,this.parseInline(ce.tokens,ne));break}case"image":{oe+=ne.image(ce.href,ce.title,ce.text);break}case"strong":{oe+=ne.strong(this.parseInline(ce.tokens,ne));break}case"em":{oe+=ne.em(this.parseInline(ce.tokens,ne));break}case"codespan":{oe+=ne.codespan(ce.text);break}case"br":{oe+=ne.br();break}case"del":{oe+=ne.del(this.parseInline(ce.tokens,ne));break}case"text":{oe+=ne.text(ce.text);break}default:{var Ae='Token with "'+ce.type+'" type was not found.';if(this.options.silent){console.error(Ae);return}else throw new Error(Ae)}}}return oe},q}(),yt=ee.merge,rt=ee.checkSanitizeDeprecation,dt=ee.escape,Me=H.getDefaults,xt=H.changeDefaults,mt=H.defaults;function se(q,ae,ue){if(typeof q=="undefined"||q===null)throw new Error("marked(): input parameter is undefined or null");if(typeof q!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(q)+", string expected");if(typeof ae=="function"&&(ue=ae,ae=null),ae=yt({},se.defaults,ae||{}),rt(ae),ue){var te=ae.highlight,ne;try{ne=_e.lex(q,ae)}catch(Ce){return ue(Ce)}var oe=function(Ae){var Ge;if(!Ae)try{Ge=Ze.parse(ne,ae)}catch(Ue){Ae=Ue}return ae.highlight=te,Ae?ue(Ae):ue(null,Ge)};if(!te||te.length<3)return oe();if(delete ae.highlight,!ne.length)return oe();var he=0;se.walkTokens(ne,function(Ce){Ce.type==="code"&&(he++,setTimeout(function(){te(Ce.text,Ce.lang,function(Ae,Ge){if(Ae)return oe(Ae);Ge!=null&&Ge!==Ce.text&&(Ce.text=Ge,Ce.escaped=!0),he--,he===0&&oe()})},0))}),he===0&&oe();return}try{var ce=_e.lex(q,ae);return ae.walkTokens&&se.walkTokens(ce,ae.walkTokens),Ze.parse(ce,ae)}catch(Ce){if(Ce.message+=`
Please report this to https://github.com/markedjs/marked.`,ae.silent)return"<p>An error occurred:</p><pre>"+dt(Ce.message+"",!0)+"</pre>";throw Ce}}se.options=se.setOptions=function(q){return yt(se.defaults,q),xt(se.defaults),se},se.getDefaults=Me,se.defaults=mt,se.use=function(q){var ae=yt({},q);if(q.renderer&&function(){var te=se.defaults.renderer||new Ie,ne=function(ce){var Ce=te[ce];te[ce]=function(){for(var Ae=arguments.length,Ge=new Array(Ae),Ue=0;Ue<Ae;Ue++)Ge[Ue]=arguments[Ue];var He=q.renderer[ce].apply(te,Ge);return He===!1&&(He=Ce.apply(te,Ge)),He}};for(var oe in q.renderer)ne(oe);ae.renderer=te}(),q.tokenizer&&function(){var te=se.defaults.tokenizer||new Se,ne=function(ce){var Ce=te[ce];te[ce]=function(){for(var Ae=arguments.length,Ge=new Array(Ae),Ue=0;Ue<Ae;Ue++)Ge[Ue]=arguments[Ue];var He=q.tokenizer[ce].apply(te,Ge);return He===!1&&(He=Ce.apply(te,Ge)),He}};for(var oe in q.tokenizer)ne(oe);ae.tokenizer=te}(),q.walkTokens){var ue=se.defaults.walkTokens;ae.walkTokens=function(te){q.walkTokens(te),ue&&ue(te)}}se.setOptions(ae)},se.walkTokens=function(q,ae){for(var ue=U(q),te;!(te=ue()).done;){var ne=te.value;ae(ne);switch(ne.type){case"table":{for(var oe=U(ne.tokens.header),he;!(he=oe()).done;){var ce=he.value;se.walkTokens(ce,ae)}for(var Ce=U(ne.tokens.cells),Ae;!(Ae=Ce()).done;)for(var Ge=Ae.value,Ue=U(Ge),He;!(He=Ue()).done;){var Tt=He.value;se.walkTokens(Tt,ae)}break}case"list":{se.walkTokens(ne.items,ae);break}default:ne.tokens&&se.walkTokens(ne.tokens,ae)}}},se.Parser=Ze,se.parser=Ze.parse,se.Renderer=Ie,se.TextRenderer=De,se.Lexer=_e,se.lexer=_e.lex,se.Tokenizer=Se,se.Slugger=Ve,se.parse=se;var Z=se;return Z})},"Dvv+":function(qe,Ke,V){"use strict";V.r(Ke);var fe=V("cWXX"),$=V("/ezw"),P=V("+L6B"),Y=V("2/Rp"),U=V("7Kak"),O=V("9yH6"),H=V("giR+"),N=V("fyUT"),k=V("9og8"),L=V("k1fw"),_=V("y8nQ"),w=V("Vl3Y"),D=V("tJVT"),T=V("5NDa"),C=V("5rEg"),S=V("WmNS"),f=V.n(S),l=V("q1tI"),i=V.n(l),c=V("Ty5D"),E=V("9kvl"),v=V("m3fD"),p=V.n(v),u=V("A+k2"),y=V.n(u),d=function(ce){var Ce=ce.value,Ae=Ce===void 0?[]:Ce,Ge=ce.onChange,Ue=ce.className,He=Ue===void 0?"":Ue;return i.a.createElement("div",{className:"".concat(y.a.tabs," ").concat(He," ")},i.a.createElement("div",{onClick:function(){return Ge(0)},className:Ae===0?y.a.active:""},i.a.createElement("div",null,"1"),i.a.createElement("div",null,"\u5F55\u5165\u4FE1\u606F")," "),i.a.createElement("div",{onClick:function(){return Ge(1)},className:Ae===1?y.a.active:""},i.a.createElement("div",null,"2"),i.a.createElement("div",null,"\u914D\u7F6E\u7EC4\u5377")))},h=d,s=V("2qtc"),a=V("kLXV"),g=V("sRBo"),m=V("kaz8"),b=V("5Dmo"),M=V("3S7+"),K=V("miYZ"),z=V("tsqr"),ee=V("oBTY"),G=V("IlMy"),F=V.n(G),ie=V("WCUW"),ge=V("QSKd"),ye=V.n(ge),xe=V("Hfvn"),Te=V.n(xe),Se=V("HPRh"),me=V.n(Se),pe=V("+RXH"),Ee=V.n(pe),le=V("+yhJ"),I=V.n(le),x=V("RZ/O"),R=V.n(x),W=V("exQ7"),J=V.n(W),B=V("HG2Q"),de=V.n(B),_e=V("k4n4"),Re=V("eS0+"),Oe=V("PpiC"),ke=V("K5AI"),Ie=V.n(ke),De=V("LvDl"),Ve=m.a.Group,Qe=function(ce){var Ce=ce.value,Ae=Ce===void 0?[]:Ce,Ge=ce.onChange,Ue=ce.options,He=ce.search,Tt=Object(Oe.a)(ce,["value","onChange","options","search"]),Xe=i.a.useState(!1),st=Object(D.a)(Xe,2),jt=st[0],ze=st[1];Object(l.useEffect)(function(){var Gt,Dt=Ue==null||((Gt=Ue.tag_disciplines)===null||Gt===void 0)?void 0:Gt.map(function(ht){return ht.id}),Ot=Ae==null?void 0:Ae.filter(function(ht){return Dt.includes(ht)});ze(Ot.length===(Dt==null?void 0:Dt.length))},[Ae]);var It=function(Dt){var Ot,ht,kt=Ue==null||((Ot=Ue.tag_disciplines)===null||Ot===void 0)?void 0:Ot.map(function(nt){return nt.id}),bt=Ae==null?void 0:Ae.filter(function(nt){return kt.includes(nt)}),_t=Object(De.uniq)([].concat(Object(ee.a)(Ae),Object(ee.a)(Dt)));if(bt.length>Dt.length){var Et=Object(De.xor)(bt,Dt);console.log(Et,"newLevel"),_t=_t.filter(function(nt){return!Et.includes(nt)})}Ge(_t),ze(Dt.length===(Ue==null||((ht=Ue.tag_disciplines)===null||ht===void 0)?void 0:ht.length))},Zt=function(Dt){var Ot,ht=Ue==null||((Ot=Ue.tag_disciplines)===null||Ot===void 0)?void 0:Ot.map(function(kt){return kt.id});Ge(Dt.target.checked?Object(De.uniq)([].concat(Object(ee.a)(Ae),Object(ee.a)(ht))):Ae==null?void 0:Ae.filter(function(kt){return!ht.includes(kt)})),ze(Dt.target.checked)};console.log(Ue,"options");var At=function(){var Dt,Ot,ht=(Ue==null?void 0:Ue.tag_disciplines)||[];if(He){var kt;ht=(kt=ht)===null||kt===void 0?void 0:kt.filter(function(bt){var _t;return bt==null||((_t=bt.name)===null||_t===void 0)?void 0:_t.includes(He)})}return ht=(Dt=ht)===null||Dt===void 0?void 0:Dt.map(function(bt){return Object(L.a)(Object(L.a)({},bt),{},{label:"".concat(bt.name,"(".concat(bt==null?void 0:bt.item_count,")")),value:bt.id})}),ht=(Ot=ht)===null||Ot===void 0?void 0:Ot.filter(function(bt){return bt.item_count!==0}),ht},qt=function(){var Dt=!1;if(!He)Dt=!0;else{var Ot;(Ot=Ue.tag_disciplines)===null||Ot===void 0||Ot.forEach(function(ht){if(!Dt){var kt;Dt=((kt=ht.name)===null||kt===void 0?void 0:kt.includes(He))&&ht.item_count!==0}})}return Dt};return(Ue==null?void 0:Ue.item_count)===0||!qt()?i.a.createElement(i.a.Fragment,null):i.a.createElement("div",{className:Ie.a.cInput},i.a.createElement("div",{className:Ie.a.cl},i.a.createElement(m.a,{checked:jt,onChange:Zt},i.a.createElement("span",{className:Ie.a.box},i.a.createElement("span",{className:"font14 c-light-primary"},i.a.createElement("span",{title:Ue==null?void 0:Ue.name,className:Ie.a.box1}," ",Ue==null?void 0:Ue.name),i.a.createElement("span",null," ","(".concat(Ue==null?void 0:Ue.item_count,")"))),i.a.createElement("i",{className:"iconfont icon-lujing font12 ml5"})))),i.a.createElement("div",{className:Ie.a.cr},i.a.createElement(Ve,{options:At(),value:Ae,onChange:It})))},at=Qe,Ze=V("ErOA"),yt=V("ozfa"),rt=V("MJZm"),dt=V("0Owb"),Me=V("tmPe"),xt=V.n(Me),mt=function(ce){var Ce=ce.value,Ae=ce.onChange,Ge=ce.defaultValue,Ue=ce.treeData,He=Ue===void 0?[]:Ue,Tt=Object(Oe.a)(ce,["value","onChange","defaultValue","treeData"]);return i.a.createElement("div",{className:xt.a.customTree},i.a.createElement(rt.a,Object(dt.a)({multiple:!0,showIcon:!0,selectedKeys:Ce,defaultExpandedKeys:Ge,treeData:He,onSelect:Ae},Tt)))},se=mt,Z=V("sbIO"),q=C.a.Search,ae=function(ce){var Ce,Ae=ce.formValue,Ge=ce.setFatherTabs,Ue=ce.tabs,He=ce.editData,Tt=ce.dispatch,Xe=Object(c.i)().id,st=Object(l.useState)(["mine"]),jt=Object(D.a)(st,2),ze=jt[0],It=jt[1],Zt=Object(l.useState)(!0),At=Object(D.a)(Zt,2),qt=At[0],Gt=At[1],Dt=Object(l.useState)(!1),Ot=Object(D.a)(Dt,2),ht=Ot[0],kt=Ot[1],bt=Object(l.useState)(!1),_t=Object(D.a)(bt,2),Et=_t[0],nt=_t[1],Be=Object(l.useState)(""),Rt=Object(D.a)(Be,2),Nt=Rt[0],Lt=Rt[1],Ft=Object(l.useState)(!1),Vt=Object(D.a)(Ft,2),Jt=Vt[0],Je=Vt[1],je=Object(l.useState)(!1),ft=Object(D.a)(je,2),Rn=ft[0],hr=ft[1],vr=Object(l.useState)({}),Cn=Object(D.a)(vr,2),Xt=Cn[0],Pt=Cn[1],Sn=Object(l.useState)([]),$e=Object(D.a)(Sn,2),ln=$e[0],Ln=$e[1],Hr=Object(l.useState)([]),Kr=Object(D.a)(Hr,2),Nn=Kr[0],ii=Kr[1],ai=Object(l.useState)([]),yr=Object(D.a)(ai,2),Mr=yr[0],oi=yr[1],qr=Object(l.useState)([]),br=Object(D.a)(qr,2),Un=br[0],ei=br[1],si=Object(l.useState)(null),Wn=Object(D.a)(si,2),pt=Wn[0],Le=Wn[1],et=Object(l.useRef)([]),Ut=Object(l.useState)(!1),Ct=Object(D.a)(Ut,2),wt=Ct[0],Wt=Ct[1],bn=Object(l.useState)([]),En=Object(D.a)(bn,2),rn=En[0],On=En[1],kn=Object(l.useState)([0]),er=Object(D.a)(kn,2),Bn=er[0],Ir=er[1],Qn=Object(l.useState)([]),Tn=Object(D.a)(Qn,2),fr=Tn[0],wr=Tn[1],Ar=Object(l.useRef)([]),Ui=Object(l.useState)(!1),Er=Object(D.a)(Ui,2),Bi=Er[0],ti=Er[1],Ci=Object(l.useState)([]),Vr=Object(D.a)(Ci,2),pn=Vr[0],Xr=Vr[1],Fr=Object(l.useState)([]),hi=Object(D.a)(Fr,2),$r=hi[0],li=hi[1],ni=Object(l.useRef)([]),Bt=Object(l.useState)([]),Yt=Object(D.a)(Bt,2),Kt=Yt[0],tn=Yt[1],sn=Object(l.useState)(!1),mn=Object(D.a)(sn,2),on=mn[0],Hn=mn[1],tr=Object(l.useRef)([]),an=Object(l.useState)(0),Gr=Object(D.a)(an,2),dn=Gr[0],Vn=Gr[1],Kn=fr==null?void 0:fr.filter(function(lt){return rn==null?void 0:rn.includes(lt.id)}),Nr=$r==null?void 0:$r.filter(function(lt){return pn==null?void 0:pn.includes(lt.id)});Object(l.useEffect)(function(){Si()},[]),Object(l.useEffect)(function(){return Ue===1&&(Tt({type:"globalSetting/onlyShowBackTopToggle",payload:!1}),Tt({type:"globalSetting/onlyShowBackTopIconToggle",payload:!1})),function(){Tt({type:"globalSetting/onlyShowBackTopToggle",payload:!0}),Tt({type:"globalSetting/onlyShowBackTopIconToggle",payload:!0})}},[Ue]),Object(l.useEffect)(function(){Xe?He&&Zn():(Fi(ze),fi(),Gt(!1))},[He]),Object(l.useEffect)(function(){Nt&&Ja()},[Nt]);var Ja=function(){var tt=null;Nn==null||Nn.forEach(function(Fe){var Ne;(Ne=Fe.sub_disciplines)===null||Ne===void 0||Ne.forEach(function(ut){var ot;(ot=ut.tag_disciplines)===null||ot===void 0||ot.forEach(function(ct){var zt,en=((zt=ct.name)===null||zt===void 0?void 0:zt.includes(Nt))&&ct.item_count!==0;en&&!tt&&(tt=Fe.id)})})}),tt&&Le(tt)},Qa=function(tt){function Fe(Ne){var ut=Ne.children,ot=Array.isArray(ut)&&ut.length>0,ct=Ne==null?void 0:Ne.group_id;return tr.current.push({name:Ne==null?void 0:Ne.name,id:ct,count:Ne==null?void 0:Ne.count}),{title:i.a.createElement("div",{title:Ne==null?void 0:Ne.name,className:F.a.name},Ne==null?void 0:Ne.name,"\uFF08".concat(Ne==null?void 0:Ne.count,"\uFF09")),value:ct,name:Ne==null?void 0:Ne.name,key:ct,count:Ne==null?void 0:Ne.count,id:ct,icon:i.a.createElement("i",{className:"iconfont icon-wenjianjia2 c-light-primary mr10",style:{lineHeight:"19px"}}),children:ot?ut==null?void 0:ut.map(function(zt){return Fe(zt)}):[]}}return tt==null?void 0:tt.map(function(Ne){return Fe(Ne)})},Si=function(){var lt=Object(k.a)(f.a.mark(function tt(){var Fe,Ne;return f.a.wrap(function(ot){for(;;)switch(ot.prev=ot.next){case 0:return ot.next=2,Object(ie.A)({});case 2:Fe=ot.sent,tr.current=[{id:0,name:"\u6839\u76EE\u5F55",count:Fe==null?void 0:Fe.root_count}],Fe!=null&&Fe.data&&(Ne=[{title:i.a.createElement("div",{title:"\u6839\u76EE\u5F55",className:F.a.name},"\u6839\u76EE\u5F55","\uFF08".concat((Fe==null?void 0:Fe.root_count)||0,"\uFF09")),value:0,id:0,key:0,count:Fe==null?void 0:Fe.root_count,name:"\u6839\u76EE\u5F55",icon:i.a.createElement("i",{className:"iconfont icon-wenjianjia2 c-light-primary mr10",style:{lineHeight:"19px"}}),children:Qa(Fe.data||[])}],wr(tr.current),tn(Ne));case 5:case"end":return ot.stop()}},tt)}));return function(){return lt.apply(this,arguments)}}(),Zn=function(){var lt=Object(k.a)(f.a.mark(function tt(){var Fe,Ne,ut,ot,ct,zt,en,gn,hn,vn,cn,Gn,wn,An,nr,Xn,Fn,rr;return f.a.wrap(function(Qt){for(;;)switch(Qt.prev=Qt.next){case 0:return vn=He==null||((Fe=He.tag_disciplines)===null||Fe===void 0)?void 0:Fe.map(function(un){return un.tag_discipline_id}),cn=He==null||((Ne=He.groups)===null||Ne===void 0)?void 0:Ne.map(function(un){return un.id}),Gn={source:He==null||((ut=He.examination_bank)===null||ut===void 0)?void 0:ut.source,group_ids:cn,tag_discipline_ids:vn,teach_group_ids:He==null?void 0:He.teach_group_ids},Qt.next=5,Object(Ze.a)("/api/examination_intelligent_settings/form_paper.json",{method:"post",body:Gn});case 5:if(wn=Qt.sent,!((wn==null?void 0:wn.status)===-1)){Qt.next=8;break}return Qt.abrupt("return");case 8:An=wn==null?void 0:wn.filter(function(un){var Mn;return!!(un!=null&&(Mn=un.item_banks)!==null&&Mn!==void 0&&Mn.length)}),An=An.map(function(un){return Object(L.a)(Object(L.a)({},un),{},{scoreTotal:0,score:0,questionTotal:0})}),An=(ot=An)===null||ot===void 0?void 0:ot.map(function(un,Mn){var ir,$n,_r;return Object(L.a)(Object(L.a)({},un),{},{score:(He==null||((ir=He.score_settings)===null||ir===void 0||(($n=ir.find(function(Cr){return Cr.item_type===(un==null?void 0:un.item_type)}))===null||$n===void 0))?void 0:$n.score)||0,item_banks:un==null||((_r=un.item_banks)===null||_r===void 0)?void 0:_r.map(function(Cr){var xn;return Object(L.a)(Object(L.a)({},Cr),{},{tag_disciplines:Cr==null||((xn=Cr.tag_disciplines)===null||xn===void 0)?void 0:xn.map(function(Pn){var ar;return Object(L.a)(Object(L.a)({},Pn),{},{difficulties:Pn==null||((ar=Pn.difficulties)===null||ar===void 0)?void 0:ar.map(function(pr){var or=He==null?void 0:He.contents.find(function(Rr){return Rr.item_type===un.item_type&&Rr.sub_discipline_id===Cr.sub_discipline_id&&Rr.tag_discipline_id===Pn.tag_discipline_id&&Rr.difficulty===pr.difficulty});return or?Object(L.a)(Object(L.a)({},pr),{},{num:or==null?void 0:or.quanlity}):Object(L.a)({},pr)})})})})})})}),nr=Ti(An),Xn=nr.panel,Fn=nr.score_num_item,An=(ct=An)===null||ct===void 0?void 0:ct.map(function(un,Mn){var ir,$n=(Xn==null||((ir=Xn[Mn])===null||ir===void 0)?void 0:ir.reduce(function(_r,Cr){return _r+Cr},0))||0;return Object(L.a)(Object(L.a)({},un),{},{scoreTotal:$n*(Fn[Mn]||0),questionTotal:$n})}),rr=[],He==null||((zt=He.sort_by_item_type)===null||zt===void 0)||zt.forEach(function(un){var Mn=An.find(function(ir){var $n,_r=($n=wi.find(function(Cr){return Cr.type===(ir==null?void 0:ir.item_type)}))===null||$n===void 0?void 0:$n.name;return _r===un});rr.push(Mn)}),rr=Object(De.compact)(rr),Fi(He==null||((en=He.examination_bank)===null||en===void 0)?void 0:en.source),fi(),It(He==null||((gn=He.examination_bank)===null||gn===void 0)?void 0:gn.source),ei(vn),et.current=vn,On(cn),Xr((He==null?void 0:He.teach_group_ids)||[]),Vn(He==null||((hn=He.groups)===null||hn===void 0)?void 0:hn.map(function(un){return un.count}).reduce(function(un,Mn){return un+Mn},0)),Ar.current=cn,Ir(cn!=null&&cn.length?cn:[0]),Ln(Object(De.cloneDeep)(rr)),Gt(!1);case 29:case"end":return Qt.stop()}},tt)}));return function(){return lt.apply(this,arguments)}}(),Za=function(){var lt=Object(k.a)(f.a.mark(function tt(){var Fe;return f.a.wrap(function(ut){for(;;)switch(ut.prev=ut.next){case 0:Fe={source:ze,group_ids:rn,tag_discipline_ids:Un,teach_group_ids:pn},ui(Fe),et.current=Un,Je(!1);case 4:case"end":return ut.stop()}},tt)}));return function(){return lt.apply(this,arguments)}}(),Fi=function(){var lt=Object(k.a)(f.a.mark(function tt(Fe){var Ne,ut,ot,ct,zt,en;return f.a.wrap(function(hn){for(;;)switch(hn.prev=hn.next){case 0:return hn.next=2,Object(Ze.a)("/api/disciplines.json",{method:"get",params:{source:"question",question_source:Fe}});case 2:ot=hn.sent,ct=[],ot==null||((Ne=ot.disciplines)===null||Ne===void 0)||Ne.forEach(function(vn){var cn;vn==null||((cn=vn.sub_disciplines)===null||cn===void 0)||cn.forEach(function(Gn){ct=ct.concat((Gn==null?void 0:Gn.tag_disciplines)||[])})}),zt=null,en=ot==null||((ut=ot.disciplines)===null||ut===void 0)?void 0:ut.map(function(vn){var cn,Gn=vn==null||((cn=vn.sub_disciplines)===null||cn===void 0)?void 0:cn.reduce(function(wn,An){return wn+An.item_count},0);return!zt&&Gn!==0&&(zt=vn.id),Object(L.a)(Object(L.a)({},vn),{},{item_count:Gn})}),console.log(en,48767874),ii(en),oi(ct),Le(zt);case 11:case"end":return hn.stop()}},tt)}));return function(Fe){return lt.apply(this,arguments)}}(),fi=function(){var lt=Object(k.a)(f.a.mark(function tt(){var Fe;return f.a.wrap(function(ut){for(;;)switch(ut.prev=ut.next){case 0:return ut.next=2,Object(Ze.a)("/api/teach_groups.json",{method:"get",params:{is_random_exam:!0}});case 2:Fe=ut.sent,li((Fe==null?void 0:Fe.groups)||[]);case 4:case"end":return ut.stop()}},tt)}));return function(){return lt.apply(this,arguments)}}(),ui=function(){var lt=Object(k.a)(f.a.mark(function tt(Fe){var Ne,ut;return f.a.wrap(function(ct){for(;;)switch(ct.prev=ct.next){case 0:return Gt(!0),ct.next=3,Object(Ze.a)("/api/examination_intelligent_settings/form_paper.json",{method:"post",body:Fe});case 3:Ne=ct.sent,ut=Ne==null?void 0:Ne.filter(function(zt){var en;return!!(zt!=null&&(en=zt.item_banks)!==null&&en!==void 0&&en.length)}),ut=ut.map(function(zt){return Object(L.a)(Object(L.a)({},zt),{},{scoreTotal:0,score:0,questionTotal:0})}),Ln(ut),Gt(!1);case 8:case"end":return ct.stop()}},tt)}));return function(Fe){return lt.apply(this,arguments)}}(),wa=function(){ei(et.current),Je(!1),Lt("")},qa=function(tt){ei(tt)},ta=function(){for(var tt=Mr==null?void 0:Mr.filter(function(gn){return Un==null?void 0:Un.includes(gn.id)}),Fe=Object(ee.a)(tt),Ne=0,ut=[],ot=0;ot<Fe.length;ot++){for(var ct="",zt=0;zt<ut.length;zt++)if(ut[zt][0].parent_name==Fe[ot].parent_name){Ne=1,ct=zt;break}if(Ne==1)ut[ct].push(Fe[ot]),Ne=0;else if(Ne==0){var en=new Array;en.push(Fe[ot]),ut.push(en)}}return ut},Aa=function(tt,Fe){var Ne,ut,ot=Object(De.cloneDeep)(ln);ot[Fe]=tt;var ct=Ti([ot[Fe]]),zt=ct==null||((Ne=ct.panel)===null||Ne===void 0||((ut=Ne[0])===null||ut===void 0))?void 0:ut.reduce(function(gn,hn){return gn+hn},0);ot[Fe].questionTotal=zt,Ln(ot);var en=document.getElementsByClassName("customError");en==null||en.forEach(function(gn){var hn;gn==null||((hn=gn.classList)===null||hn===void 0)||hn.remove("customError")})},Ti=function(tt){var Fe={contents:[],panel:[],score_num_item:[],score_total:[],error_tips:[]};return tt==null||tt.forEach(function(Ne,ut){var ot,ct,zt;Fe.panel.push([]),Fe.score_num_item.push(Ne==null?void 0:Ne.score),Fe.score_total.push(Ne==null?void 0:Ne.scoreTotal),(ot=Fe.error_tips)===null||ot===void 0||ot.push({name:(ct=wi.find(function(en){return en.type===(Ne==null?void 0:Ne.item_type)}))===null||ct===void 0?void 0:ct.name,score:(Ne==null?void 0:Ne.score)||0,scoreTotal:Ne==null?void 0:Ne.scoreTotal,item_type:Ne==null?void 0:Ne.item_type}),Ne==null||((zt=Ne.item_banks)===null||zt===void 0)||zt.forEach(function(en){var gn;en==null||((gn=en.tag_disciplines)===null||gn===void 0)||gn.forEach(function(hn){var vn;hn==null||((vn=hn.difficulties)===null||vn===void 0)||vn.forEach(function(cn){cn.num&&(Fe.panel[ut].push(cn.num),Fe.contents.push({difficulty:cn.difficulty,item_type:Ne.item_type,items_count:cn.num,sub_discipline_id:en.sub_discipline_id,tag_discipline_id:hn.tag_discipline_id}))})})})}),Fe},Ra=function(){var lt=Object(k.a)(f.a.mark(function tt(Fe){var Ne,ut,ot,ct,zt,en,gn,hn,vn,cn,Gn,wn,An,nr,Xn,Fn,rr;return f.a.wrap(function(Qt){for(;;)switch(Qt.prev=Qt.next){case 0:if(!(!rn.length&&!Un.length&&!pn.length)){Qt.next=3;break}return z.b.warn("\u5FC5\u987B\u9009\u62E9\u8003\u5BDF\u8303\u56F4\u6216\u8BD5\u9898\u6587\u4EF6\u5939\u6216\u6559\u7814\u56E2\u961F\u7684\u5176\u4E2D\u4E00\u9879"),Qt.abrupt("return");case 3:Ne=[],ut=[],ot=Ti(ln),ct=0;case 7:if(!(ct<ot.error_tips.length)){Qt.next=23;break}if(gn=ot==null||((zt=ot.panel)===null||zt===void 0||((en=zt[ct])===null||en===void 0))?void 0:en.reduce(function(un,Mn){return un+Mn},0),!(ot.error_tips[ct].score===0&&gn!==0)){Qt.next=14;break}return vn=document.getElementById("".concat((hn=ot.error_tips[ct])===null||hn===void 0?void 0:hn.item_type,"_score")),vn.classList.add("customError"),vn.scrollIntoView({block:"start",behavior:"smooth"}),Qt.abrupt("return");case 14:if(!(ot.error_tips[ct].score!==0&&gn===0)){Qt.next=19;break}return Gn=document.getElementById("".concat((cn=ot.error_tips[ct])===null||cn===void 0?void 0:cn.item_type,"_sum")),Gn.classList.add("customError"),Gn.scrollIntoView({block:"start",behavior:"smooth"}),Qt.abrupt("return");case 19:ot.error_tips[ct].score!==0&&gn!==0&&(Ne==null||Ne.push({item_type:(wn=ot.error_tips[ct])===null||wn===void 0?void 0:wn.item_type,score:((An=ot.error_tips[ct])===null||An===void 0?void 0:An.score)||0}),ut.push(ot.error_tips[ct].name));case 20:ct++,Qt.next=7;break;case 23:if(!(Ne.length===0)){Qt.next=26;break}return z.b.warn("\u4E0D\u5141\u8BB8\u6BCF\u4E2A\u9898\u578B\u7684\u603B\u5206\u548C\u62BD\u9898\u6570\u91CF\u90FD\u4E3A0"),Qt.abrupt("return");case 26:if(kt(!0),nr=Object(L.a)({contents:ot.contents,group_ids:rn,teach_group_ids:pn,score_settings:Ne,source:ze,sub_discipline_id:0,sort_by_item_type:ut,tag_discipline_ids:Un},Ae),!Fe){Qt.next=36;break}return Xn=Object(L.a)(Object(L.a)({},nr),Fe),Qt.next=32,Object(Ze.a)("/api/examination_banks/save_question_list.json",{method:"post",body:Xn});case 32:return Fn=Qt.sent,Fn.status===0&&z.b.success("\u4FDD\u5B58\u6210\u529F"),kt(!1),Qt.abrupt("return");case 36:if(rr={},!He){Qt.next=43;break}return Qt.next=40,Object(Ze.a)("/api/examination_banks/".concat(He==null?void 0:He.id,"/update_random_exam.json"),{method:"post",body:nr});case 40:rr=Qt.sent,Qt.next=46;break;case 43:return Qt.next=45,Object(Ze.a)("/api/examination_banks/create_random_exam.json",{method:"post",body:nr});case 45:rr=Qt.sent;case 46:rr.status===0&&(z.b.success("\u64CD\u4F5C\u6210\u529F"),E.d.push("/paperlibrary?defaultActiveKey=0")),kt(!1);case 48:case"end":return Qt.stop()}},tt)}));return function(Fe){return lt.apply(this,arguments)}}(),na=function(){var lt=Object(k.a)(f.a.mark(function tt(Fe,Ne){var ut,ot,ct,zt,en,gn,hn,vn,cn,Gn,wn,An,nr,Xn,Fn,rr,xr,Qt,un,Mn,ir,$n,_r;return f.a.wrap(function(xn){for(;;)switch(xn.prev=xn.next){case 0:if(!(!rn.length&&!Un.length&&!pn.length)){xn.next=3;break}return z.b.warn("\u5FC5\u987B\u9009\u62E9\u8003\u5BDF\u8303\u56F4\u6216\u8BD5\u9898\u6587\u4EF6\u5939\u6216\u6559\u7814\u56E2\u961F\u7684\u5176\u4E2D\u4E00\u9879"),xn.abrupt("return");case 3:ut=[],ot=[],ct=Ti(ln),zt=0;case 7:if(!(zt<ct.error_tips.length)){xn.next=23;break}if(hn=ct==null||((en=ct.panel)===null||en===void 0||((gn=en[zt])===null||gn===void 0))?void 0:gn.reduce(function(Pn,ar){return Pn+ar},0),!(ct.error_tips[zt].score===0&&hn!==0)){xn.next=14;break}return cn=document.getElementById("".concat((vn=ct.error_tips[zt])===null||vn===void 0?void 0:vn.item_type,"_score")),cn.classList.add("customError"),cn.scrollIntoView({block:"start",behavior:"smooth"}),xn.abrupt("return");case 14:if(!(ct.error_tips[zt].score!==0&&hn===0)){xn.next=19;break}return wn=document.getElementById("".concat((Gn=ct.error_tips[zt])===null||Gn===void 0?void 0:Gn.item_type,"_sum")),wn.classList.add("customError"),wn.scrollIntoView({block:"start",behavior:"smooth"}),xn.abrupt("return");case 19:ct.error_tips[zt].score!==0&&hn!==0&&(ut==null||ut.push({item_type:(An=ct.error_tips[zt])===null||An===void 0?void 0:An.item_type,score:((nr=ct.error_tips[zt])===null||nr===void 0?void 0:nr.score)||0}),ot.push(ct.error_tips[zt].name));case 20:zt++,xn.next=7;break;case 23:if(!(ut.length===0)){xn.next=26;break}return z.b.warn("\u4E0D\u5141\u8BB8\u6BCF\u4E2A\u9898\u578B\u7684\u603B\u5206\u548C\u62BD\u9898\u6570\u91CF\u90FD\u4E3A0"),xn.abrupt("return");case 26:if(nt(!0),Xn=Object(L.a)({contents:ct.contents,group_ids:rn,teach_group_ids:pn,score_settings:ut,sort_by_item_type:ot,tag_discipline_ids:Un,source:ze,sub_discipline_id:0},Ae),!(Fe!==void 0&&!(Fe!=null&&Fe.single_question_id))){xn.next=36;break}return Xn.seleted_item_bank_ids=Fe==null?void 0:Fe.seleted_item_bank_ids,xn.next=32,Object(Ze.a)("/api/examination_banks/toggle_random_questions.json",{method:"post",body:Xn});case 32:return Fn=xn.sent,Fn!=null&&Fn.questions&&(xr=Object(De.cloneDeep)(Xt),xr.questionList=xr==null||((rr=xr.questionList)===null||rr===void 0)?void 0:rr.map(function(Pn){if(Pn.type===Ne.type){var ar;return Object(L.a)(Object(L.a)({},Pn),{},{questions:(Fn==null||((ar=Fn.questions)===null||ar===void 0)?void 0:ar.questions)||[]})}return Pn}),Pt(xr)),nt(!1),xn.abrupt("return");case 36:if(!(Fe!=null&&Fe!==void 0&&Fe.single_question_id)){xn.next=45;break}return Xn.seleted_item_bank_ids=Fe==null?void 0:Fe.seleted_item_bank_ids,Xn.single_question_id=Fe==null?void 0:Fe.single_question_id,xn.next=41,Object(Ze.a)("/api/examination_banks/toggle_random_questions.json",{method:"post",body:Xn});case 41:return Qt=xn.sent,Qt&&(Mn=Object(De.cloneDeep)(Xt),Mn.questionList=Mn==null||((un=Mn.questionList)===null||un===void 0)?void 0:un.map(function(Pn){if(Pn.type===Ne.type){var ar,pr,or=Object(De.cloneDeep)(Pn==null?void 0:Pn.questions);return or.splice(Ne.index,1,Qt==null||((ar=Qt.questions)===null||ar===void 0||((pr=ar.questions)===null||pr===void 0))?void 0:pr[0]),console.log(Pn==null?void 0:Pn.questions,or,Ne.index,"new_questions"),Object(L.a)(Object(L.a)({},Pn),{},{questions:or})}return Pn}),Pt(Mn)),nt(!1),xn.abrupt("return");case 45:return xn.next=47,Object(Ze.a)("/api/examination_banks/preview_random_questions.json",{method:"post",body:Xn});case 47:ir=xn.sent,ir.exam&&($n=La(ir),_r=[],ot==null||ot.forEach(function(Pn){var ar,pr=$n==null||((ar=$n.questionList)===null||ar===void 0)?void 0:ar.find(function(or){var Rr,ra=(Rr=wi.find(function(ia){return ia.type===(or==null?void 0:or.type)}))===null||Rr===void 0?void 0:Rr.name;return ra===Pn});_r.push(pr)}),_r=Object(De.compact)(_r),$n.questionList=_r,Pt(Object(L.a)({},$n)),console.log(JSON.stringify($n)),hr(!0),document.body.scrollIntoView()),nt(!1);case 50:case"end":return xn.stop()}},tt)}));return function(Fe,Ne){return lt.apply(this,arguments)}}(),wi=[{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"}],eo=function(){var tt=Ti(ln),Fe=tt.panel,Ne=tt.score_total;return Ne=Ne.reduce(function(ut,ot){return ut+ot},0),Fe=Object(De.flatten)(Fe).reduce(function(ut,ot){return ut+ot},0),i.a.createElement("div",{className:F.a.total},i.a.createElement("div",null,i.a.createElement("img",{src:I.a}),i.a.createElement("span",null,"\u9898\u6570(\u9053)"),i.a.createElement("aside",null,Fe)),i.a.createElement("aside",null),i.a.createElement("div",null,i.a.createElement("img",{src:R.a}),i.a.createElement("span",null,"\u603B\u5206(\u5206)"),i.a.createElement("aside",null,Ne)))},pi=function(tt,Fe,Ne){return tt[Fe]=tt.splice(Ne,1,tt[Fe])[0],tt},Yr=function(tt){var Fe=[],Ne=Object(De.cloneDeep)(ln);Ne.length>1&&tt!==0&&(Fe=pi(Ne,tt,tt-1)),Ln(Fe)},ji=function(tt){var Fe=[],Ne=Object(De.cloneDeep)(ln);Ne.length>1&&tt!==Ne.length-1&&(Fe=pi(Ne,tt,tt+1)),Ln(Fe)},Ai=function(){var lt=Object(k.a)(f.a.mark(function tt(Fe){var Ne,ut,ot,ct;return f.a.wrap(function(en){for(;;)switch(en.prev=en.next){case 0:if(ot=Object(ee.a)(ze),ze.includes(Fe)?ot=ot.filter(function(gn){return gn!==Fe}):ot.push(Fe),!(ot.length===0)){en.next=5;break}return z.b.warn("\u8BD5\u9898\u6765\u6E90\u4E3A\u5FC5\u9009\u9879"),en.abrupt("return");case 5:(Ne=ot)!==null&&Ne!==void 0&&Ne.includes("mine")||(On([]),Ar.current=[]),(ut=ot)!==null&&ut!==void 0&&ut.includes("teach_groups")||(Xr([]),ni.current=[]),It(ot),Fi(ot),ei([]),et.current=[],ct={source:ot,group_ids:Ar.current,tag_discipline_ids:[],teach_group_ids:ni.current},ui(ct);case 13:case"end":return en.stop()}},tt)}));return function(Fe){return lt.apply(this,arguments)}}(),La=function(tt){var Fe={1:"\u4E00",2:"\u4E8C",3:"\u4E09",4:"\u56DB",5:"\u4E94",6:"\u516D",7:"\u4E03"};if(!tt)return;var Ne=tt||{},ut=Ne.exam,ot=Ne.single_questions,ct=Ne.multiple_questions,zt=Ne.judgement_questions,en=Ne.program_questions,gn=Ne.completion_questions,hn=Ne.subjective_questions,vn=Ne.practical_questions,cn=Ne.combination_questions,Gn=[Object(L.a)({type:"SINGLE",name:"\u5355\u9009\u9898"},ot),Object(L.a)({type:"MULTIPLE",name:"\u591A\u9009\u9898"},ct),Object(L.a)({type:"COMPLETION",name:"\u586B\u7A7A\u9898"},gn),Object(L.a)({type:"JUDGMENT",name:"\u5224\u65AD\u9898"},zt),Object(L.a)({type:"SUBJECTIVE",name:"\u7B80\u7B54\u9898"},hn),Object(L.a)({type:"PROGRAM",name:"\u7F16\u7A0B\u9898"},en),Object(L.a)({type:"PRACTICAL",name:"\u5B9E\u8BAD\u9898"},vn),Object(L.a)({type:"COMBINATION",name:"\u7EC4\u5408\u9898"},cn)],wn=[],An=0,nr=0,Xn=Gn.filter(function(Fn){return Fn.questions_count>0}).map(function(Fn,rr){var xr;return(xr=Fn.questions)===null||xr===void 0||xr.forEach(function(Qt){wn.push(Qt.id),An=An+Qt.score,nr=nr+1}),Object(L.a)(Object(L.a)({},Fn),{number:Fe[rr+1]})});return{all_questions_count:nr,all_score:An,questionList:Xn,ids:wn,exam:ut}},zr=function(tt){var Fe,Ne,ut=Object(De.cloneDeep)(Xt),ot=Object(De.cloneDeep)(ln);ut.questionList=ut==null||((Fe=ut.questionList)===null||Fe===void 0)?void 0:Fe.map(function(ct){return ct.type===tt.type?Object(L.a)(Object(L.a)({},ct),{},{questions_score:tt.scoreTotal}):ct}),ot=(Ne=ot)===null||Ne===void 0?void 0:Ne.map(function(ct){return ct.item_type===tt.type?Object(L.a)(Object(L.a)({},ct),{},{score:tt.score,scoreTotal:tt.scoreTotal}):ct}),Ln(ot),Pt(ut),console.log(tt,Xt,ln)},Jr=Nn==null||((Ce=Nn.find(function(lt){return lt.id===pt}))===null||Ce===void 0)?void 0:Ce.sub_disciplines,Ri=ta();return Rn?i.a.createElement(Z.a,{loading:ht,submit:Ra,goBack:function(){return hr(!1)},data:Xt,onTypeScore:zr,onExchange:na}):i.a.createElement("section",{className:F.a.wrap,style:{display:Ue?"flex":"none"}},i.a.createElement("div",{id:"id_left",className:F.a.left,onMouseEnter:function(tt){var Fe=document.getElementById("id_left");Fe.style.overflowY="auto"},onMouseLeave:function(tt){var Fe=document.getElementById("id_left");Fe.style.overflowY="hidden"}},i.a.createElement($.a,{loading:qt,active:!0,paragraph:{rows:5}},ln.map(function(lt,tt){var Fe;return i.a.createElement("div",{className:F.a.list,key:tt},i.a.createElement("div",{className:F.a.name},i.a.createElement("b",null),i.a.createElement("span",null,(Fe=wi.find(function(Ne){return Ne.type===(lt==null?void 0:lt.item_type)}))===null||Fe===void 0?void 0:Fe.name)),i.a.createElement("aside",null,i.a.createElement("div",null,"\u5171",i.a.createElement("span",{className:F.a.b},lt.questionTotal),"\u9898",i.a.createElement("span",{className:F.a.l},"|"),"\u5171",i.a.createElement("span",{className:F.a.r},lt.scoreTotal),"\u5206"),i.a.createElement("div",null,tt>0?i.a.createElement(M.a,{getPopupContainer:function(ut){return document.getElementById("id_left")},title:"\u4E0A\u79FB"},i.a.createElement("span",{onClick:function(){return Yr(tt)},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"})),tt<ln.length-1?i.a.createElement(M.a,{getPopupContainer:function(ut){return document.getElementById("id_left")},title:"\u4E0B\u79FB"},i.a.createElement("span",{onClick:function(){return ji(tt)},style:{transform:"rotate(90deg)"}}," ",i.a.createElement("i",{className:"icon-jiantou1"}))):i.a.createElement("span",{style:{transform:"rotate(90deg)",cursor:"not-allowed"}}," ",i.a.createElement("i",{className:"icon-jiantou1"})))))})),eo()),i.a.createElement("div",{className:F.a.right},i.a.createElement(h,{className:F.a.tabs,value:1,onChange:function(){return Ge(0)}}),i.a.createElement("section",{className:F.a.topWarp},i.a.createElement("div",{className:F.a.title},i.a.createElement("b",null),i.a.createElement("span",null,"\u62BD\u9898\u7EC4\u5377"),i.a.createElement("div",null,"STEP2")," "),i.a.createElement("div",{className:F.a.source},i.a.createElement("b",null,"*"),i.a.createElement("span",null,"\u8BD5\u9898\u6765\u6E90"),i.a.createElement("aside",null,i.a.createElement("div",{onClick:function(){return Ai("mine")}}," ",i.a.createElement(m.a,{checked:ze==null?void 0:ze.includes("mine")}),i.a.createElement("span",{style:{color:ze!=null&&ze.includes("mine")?"#007DFE":"#666666"}},"\u4EC5\u6211\u521B\u5EFA\u7684")),i.a.createElement("div",{className:"mb20",onClick:function(){return Ai("teach_groups")}}," ",i.a.createElement(m.a,{checked:ze==null?void 0:ze.includes("teach_groups")}),i.a.createElement("span",{style:{color:ze!=null&&ze.includes("teach_groups")?"#007DFE":"#666666"}},"\u6559\u7814\u5171\u4EAB")),i.a.createElement("div",{onClick:function(){return Ai("public")}},i.a.createElement(m.a,{checked:ze==null?void 0:ze.includes("public")}),i.a.createElement("span",{style:{color:ze!=null&&ze.includes("public")?"#007DFE":"#666666"}},"\u516C\u5171\u9898\u5E93"))),i.a.createElement("aside",null,(ze==null?void 0:ze.includes("mine"))&&i.a.createElement("div",{style:{marginBottom:14},className:F.a.folder,onClick:function(){Hn(!0),Wt(!0),Ar.current=rn,Vn((Kn==null?void 0:Kn.map(function(tt){return tt.count}).reduce(function(tt,Fe){return tt+Fe},0))||0)}},i.a.createElement("img",{src:Te.a}),i.a.createElement("span",null,"\u9009\u62E9\u8BD5\u9898\u6587\u4EF6\u5939"),i.a.createElement(M.a,{title:"\u9009\u4E2D\u9879\u4EC5\u5305\u62EC\u8BE5\u6587\u4EF6\u5939\u4E0B\u7684\u8BD5\u9898\uFF0C\u4E0D\u5305\u62EC\u5B50\u6587\u4EF6\u5939\uFF0C\u4E14\u7CFB\u7EDF\u53D6\u60A8\u9009\u4E2D\u7684\u6587\u4EF6\u5939\u548C\u8003\u67E5\u8303\u56F4\u4E2D\u7684\u8BD5\u9898\u7684\u5E76\u96C6\u4F5C\u4E3A\u968F\u673A\u5BF9\u8C61\u3002"},i.a.createElement("img",{src:ye.a}))),(ze==null?void 0:ze.includes("teach_groups"))&&i.a.createElement("div",{className:F.a.folder,onClick:function(){ti(!0),ni.current=pn}},i.a.createElement("img",{src:J.a}),i.a.createElement("span",null,"\u9009\u62E9\u6559\u7814\u56E2\u961F")))),(ze==null?void 0:ze.includes("mine"))&&i.a.createElement("div",{className:F.a.choice},i.a.createElement("div",{className:F.a.name},i.a.createElement("b",null),i.a.createElement("span",null,"\u5DF2\u9009\u6587\u4EF6\u5939")),i.a.createElement(_e.a,{type:2,value:Kn,onChange:function(tt){var Fe=rn.filter(function(ut){return ut!==tt}),Ne={source:ze,group_ids:Fe,tag_discipline_ids:Un,teach_group_ids:pn};ui(Ne),On(Fe),Ar.current=Fe}})),(ze==null?void 0:ze.includes("teach_groups"))&&i.a.createElement("div",{className:F.a.choice},i.a.createElement("div",{className:F.a.name},i.a.createElement("b",null),i.a.createElement("span",null,"\u5DF2\u9009\u6559\u7814\u56E2\u961F")),i.a.createElement(_e.a,{icon:de.a,type:2,value:Nr,onChange:function(tt){var Fe=pn.filter(function(ut){return ut!==tt}),Ne={source:ze,group_ids:rn,tag_discipline_ids:Un,teach_group_ids:Fe};ui(Ne),Xr(Fe),ni.current=Fe}})),i.a.createElement("div",{className:F.a.range},i.a.createElement("div",{className:F.a.name},i.a.createElement("b",null),i.a.createElement("span",null,"\u8003\u5BDF\u8303\u56F4")),i.a.createElement("div",{onClick:function(){if(pt===null){z.b.warn("\u8003\u5BDF\u8303\u56F4\u6CA1\u6709\u77E5\u8BC6\u70B9\u53EF\u4EE5\u9009\u62E9");return}et.current=Un,Je(!0)},className:F.a.btn},i.a.createElement("img",{src:me.a})," \u9009\u62E9\u8303\u56F4"),i.a.createElement("div",{className:F.a.name},i.a.createElement("b",{className:F.a.num}),i.a.createElement("span",null,"\u5DF2\u9009\u77E5\u8BC6\u70B9")),i.a.createElement("div",{className:F.a.knWarp},Ri==null?void 0:Ri.map(function(lt,tt){return i.a.createElement(i.a.Fragment,{key:tt},i.a.createElement("div",{className:F.a.kn},i.a.createElement("span",null,tt+1)," ",i.a.createElement("span",null,lt==null?void 0:lt[0].parent_name)),i.a.createElement(_e.a,{type:1,value:lt==null?void 0:lt.filter(function(Fe){return!!Fe.item_count}),onChange:function(Ne){var ut=Un.filter(function(ct){return ct!==Ne}),ot={source:ze,group_ids:rn,tag_discipline_ids:ut,teach_group_ids:pn};ui(ot),ei(ut),et.current=ut}}))})))),console.log("-----",ln),i.a.createElement($.a,{loading:qt,active:!0,paragraph:{rows:5}},ln.map(function(lt,tt){return i.a.createElement(Re.a,{key:tt,value:lt,onChange:function(Ne){return Aa(Ne,tt)}})}),i.a.createElement("div",{className:F.a.btns},i.a.createElement(Y.a,{onClick:function(){Ge(0),document.body.scrollIntoView()}},"\u4E0A\u4E00\u6B65"),i.a.createElement(Y.a,{loading:ht,onClick:function(){return Ra()}},"\u63D0\u4EA4"),i.a.createElement(Y.a,{loading:Et,onClick:function(){return na()},type:"primary"},"\u9884\u89C8")))),i.a.createElement(a.a,{centered:!0,closable:!1,destroyOnClose:!0,className:F.a.modal,visible:Jt,title:null,width:"1200px",onOk:Za,onCancel:wa},i.a.createElement("div",{className:F.a.modalBody},i.a.createElement("div",{className:F.a.left},i.a.createElement("div",{className:F.a.title},i.a.createElement("img",{src:Ee.a}),i.a.createElement("span",null,"\u8BD5\u9898\u8303\u56F4")),i.a.createElement("div",{className:F.a.l},Nn==null?void 0:Nn.map(function(lt){var tt=null,Fe=!1;if(!Nt)Fe=!0;else{var Ne;(Ne=lt.sub_disciplines)===null||Ne===void 0||Ne.forEach(function(ut){var ot;(ot=ut.tag_disciplines)===null||ot===void 0||ot.forEach(function(ct){if(!Fe){var zt;Fe=((zt=ct.name)===null||zt===void 0?void 0:zt.includes(Nt))&&ct.item_count!==0}})})}return i.a.createElement(i.a.Fragment,{key:lt.id},!!lt.item_count&&Fe&&i.a.createElement("div",{onClick:function(){return Le(lt.id)},className:"".concat(F.a.name," ").concat(lt.id===pt?F.a.active:"")},i.a.createElement("b",null),i.a.createElement("span",null,lt.name)))}))),i.a.createElement("div",{className:F.a.right},i.a.createElement("div",{className:F.a.inputWarp},i.a.createElement(q,{onChange:function(tt){return Lt(tt.target.value)},placeholder:"\u8BF7\u8F93\u5165\u77E5\u8BC6\u70B9",value:Nt})),i.a.createElement("div",{className:F.a.l},Jr==null?void 0:Jr.map(function(lt,tt){var Fe,Ne=Object(L.a)(Object(L.a)({},lt),{},{tag_disciplines:lt==null||((Fe=lt.tag_disciplines)===null||Fe===void 0)?void 0:Fe.filter(function(ut){return ut.item_count!==0})});return i.a.createElement(at,{search:Nt,onChange:qa,key:lt.id,value:Un,options:Ne})}))))),i.a.createElement(a.a,{centered:!0,title:"\u9009\u62E9\u6587\u4EF6\u5939",visible:wt,width:718,destroyOnClose:!0,onCancel:function(){On(Ar.current),Wt(!1),Vn(0)},footer:i.a.createElement("div",{style:{display:"flex",alignItems:"center"}},i.a.createElement("span",{style:{flex:"1",textAlign:"left"}},"\u5DF2\u9009",rn.length||0,"\u4E2A\u6587\u4EF6\u5939\uFF0C\u5171\uFF08",dn||0,"\uFF09\u9053\u9898"),i.a.createElement(Y.a,{onClick:function(){On(Ar.current),Vn(0),Wt(!1)}},"\u53D6\u6D88"),i.a.createElement(Y.a,{type:"primary",onClick:function(){var tt={source:ze,group_ids:rn,tag_discipline_ids:Un,teach_group_ids:pn};ui(tt),Ar.current=rn,Wt(!1)}},"\u786E\u8BA4"))},i.a.createElement("aside",{className:F.a.exportModal},on&&i.a.createElement(se,{treeData:Kt,defaultValue:Bn,value:rn,onChange:function(tt,Fe){var Ne;Vn((Ne=Fe.selectedNodes)===null||Ne===void 0?void 0:Ne.map(function(ut){return ut.count}).reduce(function(ut,ot){return ut+ot},0)),On(tt)}}))),i.a.createElement(a.a,{centered:!0,title:"\u9009\u62E9\u6559\u7814\u56E2\u961F",visible:Bi,width:718,destroyOnClose:!0,onCancel:function(){Xr(ni.current),ti(!1)},onOk:function(){var tt={source:ze,group_ids:rn,tag_discipline_ids:Un,teach_group_ids:pn};ui(tt),ni.current=pn,ti(!1)}},i.a.createElement("aside",{className:F.a.teachModal},i.a.createElement("div",{className:F.a.head},i.a.createElement("div",{className:F.a.li}),i.a.createElement("div",{className:F.a.li},"\u56E2\u961F\u540D\u79F0"),i.a.createElement("div",{className:F.a.li},"\u5171\u4EAB\u9898\u76EE\u6570\u91CF")),i.a.createElement("div",{className:F.a.wraps},$r==null?void 0:$r.map(function(lt){return i.a.createElement("div",{key:lt.id,className:F.a.body},i.a.createElement("div",{className:F.a.li},i.a.createElement(m.a,{onChange:function(){var Fe=lt.id,Ne=Object(ee.a)(pn);pn.includes(Fe)?Ne=Ne.filter(function(ut){return ut!==Fe}):Ne.push(Fe),Xr(Ne)},checked:pn==null?void 0:pn.includes(lt.id)})),i.a.createElement("div",{title:lt.name,className:F.a.li},lt.name),i.a.createElement("div",{className:F.a.li},lt.item_bank_count))})))))},ue=ae,te=C.a.TextArea,ne=function(ce){var Ce=ce.paperlibrary,Ae=ce.user,Ge=ce.globalSetting,Ue=ce.dispatch,He=Object(l.useState)(0),Tt=Object(D.a)(He,2),Xe=Tt[0],st=Tt[1],jt=w.a.useForm(),ze=Object(D.a)(jt,1),It=ze[0],Zt=Object(l.useState)({}),At=Object(D.a)(Zt,2),qt=At[0],Gt=At[1],Dt=Object(l.useState)(!0),Ot=Object(D.a)(Dt,2),ht=Ot[0],kt=Ot[1],bt=Object(l.useState)(null),_t=Object(D.a)(bt,2),Et=_t[0],nt=_t[1],Be=Object(c.i)().id;console.log(Be,"editId"),Object(l.useEffect)(function(){return Ue({type:"globalSetting/footerToggle",payload:!1}),function(){Ue({type:"globalSetting/footerToggle",payload:!0})}},[]),Object(l.useEffect)(function(){return document.body.setAttribute("data-custom","initial"),function(){document.body.removeAttribute("data-custom")}},[]);var Rt=function(Jt){Gt(Object(L.a)({},It.getFieldsValue()))};Object(l.useEffect)(function(){if(Be){Nt();return}kt(!1)},[Be]);var Nt=function(){var Vt=Object(k.a)(f.a.mark(function Jt(){var Je,je,ft,Rn,hr,vr;return f.a.wrap(function(Xt){for(;;)switch(Xt.prev=Xt.next){case 0:return Xt.next=2,Object(Ze.a)("/api/examination_banks/".concat(Be,"/edit_random_exam.json"),{method:"get",params:{}});case 2:Je=Xt.sent,Je!=null&&Je.examination_bank&&(vr={difficulty:Je==null||((je=Je.examination_bank)===null||je===void 0)?void 0:je.difficulty,exam_notes:Je==null||((ft=Je.examination_bank)===null||ft===void 0)?void 0:ft.exam_notes,name:Je==null||((Rn=Je.examination_bank)===null||Rn===void 0)?void 0:Rn.name,time:Je==null||((hr=Je.examination_bank)===null||hr===void 0)?void 0:hr.time},kt(!1),Gt(Object(L.a)({},vr)),It.setFieldsValue(Object(L.a)({},vr)),nt(Object(L.a)(Object(L.a)({},Je),{},{id:Be})));case 4:case"end":return Xt.stop()}},Jt)}));return function(){return Vt.apply(this,arguments)}}(),Lt=function(){var Vt=Object(k.a)(f.a.mark(function Jt(Je){return f.a.wrap(function(ft){for(;;)switch(ft.prev=ft.next){case 0:if(!(Je===0)){ft.next=3;break}return st(Je),ft.abrupt("return");case 3:return ft.next=5,It.validateFields();case 5:st(Je);case 6:case"end":return ft.stop()}},Jt)}));return function(Je){return Vt.apply(this,arguments)}}(),Ft=function(Jt){var Je=parseInt(Jt);return Object(De.isNaN)(Je)?"":Je};return i.a.createElement("section",{className:p.a.wrap},i.a.createElement($.a,{loading:ht,active:!0,paragraph:{rows:5}},i.a.createElement("div",{className:p.a.crumbs},i.a.createElement("b",null),i.a.createElement("span",{className:"current",onClick:function(){return E.d.push("/")}},"\u9996\u9875>"),i.a.createElement("span",{className:"current",onClick:function(){return E.d.push("/paperlibrary")}},"\u8BD5\u5377\u5E93>"),i.a.createElement("span",{style:{color:"#bebebe"}},"\u968F\u673A\u7EC4\u5377")),Xe===0&&i.a.createElement(h,{value:Xe,onChange:Lt}),Xe===0&&i.a.createElement("section",{className:p.a.oneWrap},i.a.createElement("div",{className:p.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(w.a,{className:p.a.formWrap,form:It,layout:"horizontal",onValuesChange:Rt},i.a.createElement(w.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(C.a,{className:p.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(w.a.Item,{label:"\u7B54\u9898\u65F6\u957F:",name:"time",rules:[{required:!0,message:"\u7B54\u9898\u65F6\u957F\u4E0D\u80FD\u4E3A\u7A7A"}]},i.a.createElement(N.a,{min:1,parser:Ft,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(w.a.Item,{label:"\u8BD5\u9898\u96BE\u5EA6",name:"difficulty",rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u96BE\u5EA6"}]},i.a.createElement(O.a.Group,{style:{display:"flex",width:286,justifyContent:"space-between"},size:"large"},i.a.createElement(O.a.Button,{className:p.a.rb,value:1},"\u7B80\u5355"),i.a.createElement(O.a.Button,{className:p.a.rb,value:2},"\u9002\u4E2D"),i.a.createElement(O.a.Button,{className:p.a.rb,value:3},"\u56F0\u96BE"))),i.a.createElement(w.a.Item,{label:"\u8003\u8BD5\u987B\u77E5",name:"exam_notes"},i.a.createElement(te,{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:p.a.btns},i.a.createElement(Y.a,{className:"mr40",onClick:function(){return E.d.push("/paperlibrary")}},"\u8FD4\u56DE"),i.a.createElement(Y.a,{type:"primary",onClick:Object(k.a)(f.a.mark(function Vt(){return f.a.wrap(function(Je){for(;;)switch(Je.prev=Je.next){case 0:return Je.next=2,It.validateFields();case 2:st(1);case 3:case"end":return Je.stop()}},Vt)}))},"\u4E0B\u4E00\u6B65"))),i.a.createElement(ue,{tabs:Xe,dispatch:Ue,editData:Et,setFatherTabs:st,formValue:qt})))},oe=Ke.default=Object(E.a)(function(he){var ce=he.paperlibrary,Ce=he.user,Ae=he.globalSetting;return{paperlibrary:ce,user:Ce,globalSetting:Ae}})(ne)},"E/GV":function(qe,Ke,V){qe.exports=V.p+"static/swenjianjia.1640bf70.svg"},ELLl:function(qe,Ke,V){(function(fe){fe(V("VrN/"))})(function(fe){var $={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},P=fe.Pos;fe.defineOption("autoCloseBrackets",!1,function(C,S,f){f&&f!=fe.Init&&(C.removeKeyMap(U),C.state.closeBrackets=null),S&&(O(Y(S,"pairs")),C.state.closeBrackets=S,C.addKeyMap(U))});function Y(C,S){return S=="pairs"&&typeof C=="string"?C:typeof C=="object"&&C[S]!=null?C[S]:$[S]}var U={Backspace:k,Enter:L};function O(C){for(var S=0;S<C.length;S++){var f=C.charAt(S),l="'"+f+"'";U[l]||(U[l]=H(f))}}O($.pairs+"`");function H(C){return function(S){return w(S,C)}}function N(C){var S=C.state.closeBrackets;if(!S||S.override)return S;var f=C.getModeAt(C.getCursor());return f.closeBrackets||S}function k(C){var S=N(C);if(!S||C.getOption("disableInput"))return fe.Pass;for(var f=Y(S,"pairs"),l=C.listSelections(),i=0;i<l.length;i++){if(!l[i].empty())return fe.Pass;var c=D(C,l[i].head);if(!c||f.indexOf(c)%2!=0)return fe.Pass}for(var i=l.length-1;i>=0;i--){var E=l[i].head;C.replaceRange("",P(E.line,E.ch-1),P(E.line,E.ch+1),"+delete")}}function L(C){var S=N(C),f=S&&Y(S,"explode");if(!f||C.getOption("disableInput"))return fe.Pass;for(var l=C.listSelections(),i=0;i<l.length;i++){if(!l[i].empty())return fe.Pass;var c=D(C,l[i].head);if(!c||f.indexOf(c)%2!=0)return fe.Pass}C.operation(function(){var E=C.lineSeparator()||`
`;C.replaceSelection(E+E,null),C.execCommand("goCharLeft"),l=C.listSelections();for(var v=0;v<l.length;v++){var p=l[v].head.line;C.indentLine(p,null,!0),C.indentLine(p+1,null,!0)}})}function _(C){var S=fe.cmpPos(C.anchor,C.head)>0;return{anchor:new P(C.anchor.line,C.anchor.ch+(S?-1:1)),head:new P(C.head.line,C.head.ch+(S?1:-1))}}function w(C,S){var f=N(C);if(!f||C.getOption("disableInput"))return fe.Pass;var l=Y(f,"pairs"),i=l.indexOf(S);if(i==-1)return fe.Pass;for(var c=Y(f,"closeBefore"),E=Y(f,"triples"),v=l.charAt(i+1)==S,p=C.listSelections(),u=i%2==0,y,d=0;d<p.length;d++){var h=p[d],s=h.head,a,g=C.getRange(s,P(s.line,s.ch+1));if(u&&!h.empty())a="surround";else if((v||!u)&&g==S)v&&T(C,s)?a="both":E.indexOf(S)>=0&&C.getRange(s,P(s.line,s.ch+3))==S+S+S?a="skipThree":a="skip";else if(v&&s.ch>1&&E.indexOf(S)>=0&&C.getRange(P(s.line,s.ch-2),s)==S+S){if(s.ch>2&&/\bstring/.test(C.getTokenTypeAt(P(s.line,s.ch-2))))return fe.Pass;a="addFour"}else if(v){var m=s.ch==0?" ":C.getRange(P(s.line,s.ch-1),s);if(!fe.isWordChar(g)&&m!=S&&!fe.isWordChar(m))a="both";else return fe.Pass}else if(u&&(g.length===0||/\s/.test(g)||c.indexOf(g)>-1))a="both";else return fe.Pass;if(!y)y=a;else if(y!=a)return fe.Pass}var b=i%2?l.charAt(i-1):S,M=i%2?S:l.charAt(i+1);C.operation(function(){if(y=="skip")C.execCommand("goCharRight");else if(y=="skipThree")for(var K=0;K<3;K++)C.execCommand("goCharRight");else if(y=="surround"){for(var z=C.getSelections(),K=0;K<z.length;K++)z[K]=b+z[K]+M;C.replaceSelections(z,"around"),z=C.listSelections().slice();for(var K=0;K<z.length;K++)z[K]=_(z[K]);C.setSelections(z)}else y=="both"?(C.replaceSelection(b+M,null),C.triggerElectric(b+M),C.execCommand("goCharLeft")):y=="addFour"&&(C.replaceSelection(b+b+b+b,"before"),C.execCommand("goCharRight"))})}function D(C,S){var f=C.getRange(P(S.line,S.ch-1),P(S.line,S.ch+1));return f.length==2?f:null}function T(C,S){var f=C.getTokenAt(P(S.line,S.ch+1));return/\bstring/.test(f.type)&&f.start==S.ch&&(S.ch==0||!/\bstring/.test(C.getTokenTypeAt(S)))}})},FTkQ:function(qe,Ke){qe.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAABjUlEQVQ4T61VsUoDQRB9s+eVYifkUlqIWCW3sbBMqYUR0cbfUPETxPgZ2giigpZaCnKXpBK1sMydpIx25+7ISu5ILhsjclvuzLx5M292lmA57PtuF2gIYIMBSYBn3BiICAg1cF0GrqjVSvLhlL+IqtVNEDUZWLAlS+8IeAPzvtduXw77ZYAMiEjKI2LeY2AskQ2cAGaiEy8MDwnQxicL7Ep5bDL+xmqijahZDsODDHBQ5sVfmVn6xmDeMuWTESAGnqf1bBpz09MSsESx729r4DwfIIA6hPjUSt2AaP7Hztwj5nXHdd0vpR7yMQzsUOT7pwzsjgEKsVIKgiCu1Za1UvfGLhynXgqCp6hSkSxEYCn9jLq+/wJgcawk5l4KYECN3YBlCVLWo4GvhmGfgVlrj4ZAjX0KmBmZD8Owj4IAMQAsvGSrKKR1zet0QpsosZQrmvnRKsqksZlxnFWVJAkT3Y6MDbAmgDlFdGcdm8IH22Qp9OmltAtdDoPlWez6SpkWtmCHFTNCvQMN/scX8A1e4fnIOEHt8AAAAABJRU5ErkJggg=="},Gytx:function(qe,Ke){qe.exports=function(fe,$,P,Y){var U=P?P.call(Y,fe,$):void 0;if(U!==void 0)return!!U;if(fe===$)return!0;if(typeof fe!="object"||!fe||typeof $!="object"||!$)return!1;var O=Object.keys(fe),H=Object.keys($);if(O.length!==H.length)return!1;for(var N=Object.prototype.hasOwnProperty.bind($),k=0;k<O.length;k++){var L=O[k];if(!N(L))return!1;var _=fe[L],w=$[L];if(U=P?P.call(Y,_,w,L):void 0,U===!1||U===void 0&&_!==w)return!1}return!0}},HG2Q:function(qe,Ke,V){qe.exports=V.p+"static/sren.1cbce50b.svg"},HPRh:function(qe,Ke,V){qe.exports=V.p+"static/median.766cb706.svg"},Hfvn:function(qe,Ke,V){qe.exports=V.p+"static/wenjian.ea3b4170.svg"},HmJG:function(qe,Ke,V){},IlMy:function(qe,Ke,V){qe.exports={flex_box_center:"flex_box_center___1Rd7-",flex_space_between:"flex_space_between___1qdJI",flex_box_vertical_center:"flex_box_vertical_center___3PScB",flex_box_center_end:"flex_box_center_end___gmzWk",flex_box_column:"flex_box_column___qhFY7",wrap:"wrap___2CDxR",left:"left___21M_k",list:"list___ahv58",name:"name___3cBep",b:"b___1CRFh",r:"r___2F_9I",l:"l___3XCXI",total:"total___2VTdV",topWarp:"topWarp___y9feY",right:"right___U2Z5M",tabs:"tabs___3eZK5",title:"title___3iKxF",source:"source___3rkh5",folder:"folder___AxGOK",choice:"choice___1AdWh",range:"range___23nFr",btn:"btn___1QiCj",knWarp:"knWarp___3eQQ5",kn:"kn___1OLj0",btns:"btns___26z5C",modalBody:"modalBody___1b2lK",active:"active___kELz6",inputWarp:"inputWarp___1leis",modal:"modal___1Ehn0",exportModal:"exportModal___1Vsj-",teachModal:"teachModal___CwfeZ",head:"head___2_Y6a",wraps:"wraps___3-f7m",body:"body___2Jb5Z"}},K5AI:function(qe,Ke,V){qe.exports={cInput:"cInput___2BJRi",cl:"cl___AbKoK",box:"box___3gRA9",box1:"box1___S3u_s",cr:"cr___16yEi"}},LdHM:function(qe,Ke,V){"use strict";V.d(Ke,"b",function(){return c}),V.d(Ke,"a",function(){return v});var fe=V("1OyB"),$=V("vuIU"),P=V("Ji7U"),Y=V("LK+K"),U=V("q1tI"),O=V("rePB"),H=V("Ff2n"),N=V("ODXe"),k=V("4IlW"),L=V("bX4T"),_=V("YrtM"),w=V("TSYQ"),D=V.n(w),T=V("+nKL"),C=V("8OUc"),S=function(ie,ge){var ye=ie.prefixCls,xe=ie.id,Te=ie.flattenOptions,Se=ie.childrenAsData,me=ie.values,pe=ie.searchValue,Ee=ie.multiple,le=ie.defaultActiveFirstOption,I=ie.height,x=ie.itemHeight,R=ie.notFoundContent,W=ie.open,J=ie.menuItemSelectedIcon,B=ie.virtual,de=ie.onSelect,_e=ie.onToggleOpen,Re=ie.onActiveValue,Oe=ie.onScroll,ke=ie.onMouseEnter,Ie="".concat(ye,"-item"),De=Object(_.a)(function(){return Te},[W,Te],function(Z,q){return q[0]&&Z[1]!==q[1]}),Ve=U.useRef(null),Qe=function(q){q.preventDefault()},at=function(q){Ve.current&&Ve.current.scrollTo({index:q})},Ze=function(q){for(var ae=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,ue=De.length,te=0;te<ue;te+=1){var ne=(q+te*ae+ue)%ue,oe=De[ne],he=oe.group,ce=oe.data;if(!he&&!ce.disabled)return ne}return-1},yt=U.useState(function(){return Ze(0)}),rt=Object(N.a)(yt,2),dt=rt[0],Me=rt[1],xt=function(q){Me(q);var ae=De[q];if(!ae){Re(null,-1);return}Re(ae.data.value,q)};U.useEffect(function(){xt(le!==!1?Ze(0):-1)},[De.length,pe]),U.useEffect(function(){var Z=setTimeout(function(){if(!Ee&&W&&me.size===1){var q=Array.from(me)[0],ae=De.findIndex(function(ue){var te=ue.data;return te.value===q});xt(ae),at(ae)}});return function(){return clearTimeout(Z)}},[W]);var mt=function(q){q!==void 0&&de(q,{selected:!me.has(q)}),Ee||_e(!1)};if(U.useImperativeHandle(ge,function(){return{onKeyDown:function(q){var ae=q.which;switch(ae){case k.a.UP:case k.a.DOWN:{var ue=0;if(ae===k.a.UP?ue=-1:ae===k.a.DOWN&&(ue=1),ue!==0){var te=Ze(dt+ue,ue);at(te),xt(te)}break}case k.a.ENTER:{var ne=De[dt];ne&&!ne.data.disabled?mt(ne.data.value):mt(void 0),W&&q.preventDefault();break}case k.a.ESC:_e(!1)}},onKeyUp:function(){},scrollTo:function(q){at(q)}}}),De.length===0)return U.createElement("div",{role:"listbox",id:"".concat(xe,"_list"),className:"".concat(Ie,"-empty"),onMouseDown:Qe},R);function se(Z){var q=De[Z];if(!q)return null;var ae=q.data||{},ue=ae.value,te=ae.label,ne=ae.children,oe=Object(L.a)(ae,!0),he=Se?ne:te;return q?U.createElement("div",Object.assign({"aria-label":typeof he=="string"?he:null},oe,{key:Z,role:"option",id:"".concat(xe,"_list_").concat(Z),"aria-selected":me.has(ue)}),ue):null}return U.createElement(U.Fragment,null,U.createElement("div",{role:"listbox",id:"".concat(xe,"_list"),style:{height:0,width:0,overflow:"hidden"}},se(dt-1),se(dt),se(dt+1)),U.createElement(T.a,{itemKey:"key",ref:Ve,data:De,height:I,itemHeight:x,fullHeight:!1,onMouseDown:Qe,onScroll:Oe,virtual:B,onMouseEnter:ke},function(Z,q){var ae,ue=Z.group,te=Z.groupOption,ne=Z.data,oe=ne.label,he=ne.key;if(ue)return U.createElement("div",{className:D()(Ie,"".concat(Ie,"-group"))},oe!==void 0?oe:he);var ce=ne.disabled,Ce=ne.value,Ae=ne.title,Ge=ne.children,Ue=ne.style,He=ne.className,Tt=Object(H.a)(ne,["disabled","value","title","children","style","className"]),Xe=me.has(Ce),st="".concat(Ie,"-option"),jt=D()(Ie,st,He,(ae={},Object(O.a)(ae,"".concat(st,"-grouped"),te),Object(O.a)(ae,"".concat(st,"-active"),dt===q&&!ce),Object(O.a)(ae,"".concat(st,"-disabled"),ce),Object(O.a)(ae,"".concat(st,"-selected"),Xe),ae)),ze=Se?Ge:oe,It=!J||typeof J=="function"||Xe;return U.createElement("div",Object.assign({},Tt,{"aria-selected":Xe,className:jt,title:Ae,onMouseMove:function(){if(dt===q||ce)return;xt(q)},onClick:function(){ce||mt(Ce)},style:Ue}),U.createElement("div",{className:"".concat(st,"-content")},ze||Ce),U.isValidElement(J)||Xe,It&&U.createElement(C.a,{className:"".concat(Ie,"-option-state"),customizeIcon:J,customizeIconProps:{isSelected:Xe}},Xe?"\u2713":null))}))},f=U.forwardRef(S);f.displayName="OptionList";var l=f,i=function(){return null};i.isSelectOption=!0;var c=i,E=function(){return null};E.isSelectOptGroup=!0;var v=E,p=V("VTBJ"),u=V("Zm9Q");function y(F){var ie=F.key,ge=F.props,ye=ge.children,xe=ge.value,Te=Object(H.a)(ge,["children","value"]);return Object(p.a)({key:ie,value:xe!==void 0?xe:ie,children:ye},Te)}function d(F){var ie=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(u.a)(F).map(function(ge,ye){if(!U.isValidElement(ge)||!ge.type)return null;var xe=ge.type.isSelectOptGroup,Te=ge.key,Se=ge.props,me=Se.children,pe=Object(H.a)(Se,["children"]);return ie||!xe?y(ge):Object(p.a)(Object(p.a)({key:"__RC_SELECT_GRP__".concat(Te===null?ye:Te,"__"),label:Te},pe),{},{options:d(me)})}).filter(function(ge){return ge})}var h=V("2Qr1"),s=V("qNPg"),a=V("U8pU"),g=V("Kwbf"),m=V("WKfj");function b(F){var ie=F.mode,ge=F.options,ye=F.children,xe=F.backfill,Te=F.allowClear,Se=F.placeholder,me=F.getInputElement,pe=F.showSearch,Ee=F.onSearch,le=F.defaultOpen,I=F.autoFocus,x=F.labelInValue,R=F.value,W=F.inputValue,J=F.optionLabelProp,B=ie==="multiple"||ie==="tags",de=pe!==void 0?pe:B||ie==="combobox",_e=ge||d(ye);if(Object(g.a)(ie!=="tags"||_e.every(function(Ie){return!Ie.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),ie==="tags"||ie==="combobox"){var Re=_e.some(function(Ie){return Ie.options?Ie.options.some(function(De){return typeof("value"in De?De.value:De.key)=="number"}):typeof("value"in Ie?Ie.value:Ie.key)=="number"});Object(g.a)(!Re,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(g.a)(ie!=="combobox"||!J,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(g.a)(ie==="combobox"||!xe,"`backfill` only works with `combobox` mode."),Object(g.a)(ie==="combobox"||!me,"`getInputElement` only work with `combobox` mode."),Object(g.b)(ie!=="combobox"||!me||!Te||!Se,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),Ee&&!de&&ie!=="combobox"&&ie!=="tags"&&Object(g.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(g.b)(!le||I,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),R!=null){var Oe=Object(m.d)(R);Object(g.a)(!x||Oe.every(function(Ie){return Object(a.a)(Ie)==="object"&&("key"in Ie||"value"in Ie)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(g.a)(!B||Array.isArray(R),"`value` should be array when `mode` is `multiple` or `tags`")}if(ye){var ke=null;Object(u.a)(ye).some(function(Ie){if(!U.isValidElement(Ie)||!Ie.type)return!1;var De=Ie.type;if(De.isSelectOption)return!1;if(De.isSelectOptGroup){var Ve=Object(u.a)(Ie.props.children).every(function(Qe){return!U.isValidElement(Qe)||!Ie.type||Qe.type.isSelectOption?!0:(ke=Qe.type,!1)});return!Ve}return ke=De,!0}),ke&&Object(g.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(ke.displayName||ke.name||ke,"`.")),Object(g.a)(W===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var M=b,K=Object(s.a)({prefixCls:"rc-select",components:{optionList:l},convertChildrenToData:d,flattenOptions:h.d,getLabeledValue:h.e,filterOptions:h.b,isValueDisabled:h.g,findValueOption:h.c,warningProps:M,fillOptionsWithMissingValue:h.a}),z=function(F){Object(P.a)(ge,F);var ie=Object(Y.a)(ge);function ge(){var ye;return Object(fe.a)(this,ge),ye=ie.apply(this,arguments),ye.selectRef=U.createRef(),ye.focus=function(){ye.selectRef.current.focus()},ye.blur=function(){ye.selectRef.current.blur()},ye}return Object($.a)(ge,[{key:"render",value:function(){return U.createElement(K,Object.assign({ref:this.selectRef},this.props))}}]),ge}(U.Component);z.Option=c,z.OptGroup=v;var ee=z,G=Ke.c=ee},M8RZ:function(qe,Ke,V){"use strict";V.d(Ke,"a",function(){return k});var fe=V("fWQN"),$=V("mtLc"),P=V("yKVA"),Y=V("879j"),U=V("q1tI"),O=V.n(U),H=V("i8i4"),N=V.n(H),k=function(L){Object(P.a)(w,L);var _=Object(Y.a)(w);function w(D){var T;Object(fe.a)(this,w),T=_.call(this,D);var C=window.document;return T.node=C.createElement("div"),C.body.appendChild(T.node),T}return Object($.a)(w,[{key:"render",value:function(){var T=this.props.children;return Object(H.createPortal)(T,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),w}(O.a.Component)},NvD2:function(qe,Ke,V){"use strict";V.d(Ke,"a",function(){return O});var fe=V("Kwbf");function $(H,N){var k=new Set;return H.forEach(function(L){N.has(L)||k.add(L)}),k}function P(H){var N=H||{},k=N.disabled,L=N.disableCheckbox,_=N.checkable;return!!(k||L)||_===!1}function Y(H,N,k,L){for(var _=new Set(H),w=new Set,D=0;D<=k;D+=1){var T=N.get(D)||new Set;T.forEach(function(l){var i=l.key,c=l.node,E=l.children,v=E===void 0?[]:E;_.has(i)&&!L(c)&&v.filter(function(p){return!L(p.node)}).forEach(function(p){_.add(p.key)})})}for(var C=new Set,S=k;S>=0;S-=1){var f=N.get(S)||new Set;f.forEach(function(l){var i=l.parent,c=l.node;if(L(c)||!l.parent||C.has(l.parent.key))return;if(L(l.parent.node)){C.add(i.key);return}var E=!0,v=!1;(i.children||[]).filter(function(p){return!L(p.node)}).forEach(function(p){var u=p.key,y=_.has(u);E&&!y&&(E=!1),!v&&(y||w.has(u))&&(v=!0)}),E&&_.add(i.key),v&&w.add(i.key),C.add(i.key)})}return{checkedKeys:Array.from(_),halfCheckedKeys:Array.from($(w,_))}}function U(H,N,k,L,_){for(var w=new Set(H),D=new Set(N),T=0;T<=L;T+=1){var C=k.get(T)||new Set;C.forEach(function(i){var c=i.key,E=i.node,v=i.children,p=v===void 0?[]:v;!w.has(c)&&!D.has(c)&&!_(E)&&p.filter(function(u){return!_(u.node)}).forEach(function(u){w.delete(u.key)})})}D=new Set;for(var S=new Set,f=L;f>=0;f-=1){var l=k.get(f)||new Set;l.forEach(function(i){var c=i.parent,E=i.node;if(_(E)||!i.parent||S.has(i.parent.key))return;if(_(i.parent.node)){S.add(c.key);return}var v=!0,p=!1;(c.children||[]).filter(function(u){return!_(u.node)}).forEach(function(u){var y=u.key,d=w.has(y);v&&!d&&(v=!1),!p&&(d||D.has(y))&&(p=!0)}),v||w.delete(c.key),p&&D.add(c.key),S.add(c.key)})}return{checkedKeys:Array.from(w),halfCheckedKeys:Array.from($(D,w))}}function O(H,N,k,L){var _=[],w;L?w=L:w=P;var D=new Set(H.filter(function(f){var l=!!k[f];return l||_.push(f),l})),T=new Map,C=0;Object.keys(k).forEach(function(f){var l=k[f],i=l.level,c=T.get(i);c||(c=new Set,T.set(i,c)),c.add(l),C=Math.max(C,i)}),Object(fe.a)(!_.length,"Tree missing follow keys: ".concat(_.slice(0,100).map(function(f){return"'".concat(f,"'")}).join(", ")));var S;return N===!0?S=Y(D,T,C,w):S=U(D,N.halfCheckedKeys,T,C,w),S}},O2Wb:function(qe,Ke,V){qe.exports={flex:"flex___2gmSR",flex1:"flex1___3Tu1g",color666:"color666___2uyGL",error:"error___yJ86W",deleteIcon:"deleteIcon___1D2tg",addIcon:"addIcon___2VIYB"}},OLES:function(qe,Ke,V){"use strict";var fe=V("U8pU"),$=V("VTBJ"),P=V("Ff2n"),Y=V("q1tI"),U=V("uciX"),O=V("7ixt"),H=function(D){var T=D.overlay,C=D.prefixCls,S=D.id,f=D.overlayInnerStyle;return Y.createElement("div",{className:"".concat(C,"-inner"),id:S,role:"tooltip",style:f},typeof T=="function"?T():T)},N=H,k=function(D,T){var C=D.overlayClassName,S=D.trigger,f=S===void 0?["hover"]:S,l=D.mouseEnterDelay,i=l===void 0?0:l,c=D.mouseLeaveDelay,E=c===void 0?.1:c,v=D.overlayStyle,p=D.prefixCls,u=p===void 0?"rc-tooltip":p,y=D.children,d=D.onVisibleChange,h=D.afterVisibleChange,s=D.transitionName,a=D.animation,g=D.placement,m=g===void 0?"right":g,b=D.align,M=b===void 0?{}:b,K=D.destroyTooltipOnHide,z=K===void 0?!1:K,ee=D.defaultVisible,G=D.getTooltipContainer,F=D.overlayInnerStyle,ie=Object(P.a)(D,["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle"]),ge=Object(Y.useRef)(null);Object(Y.useImperativeHandle)(T,function(){return ge.current});var ye=Object($.a)({},ie);"visible"in D&&(ye.popupVisible=D.visible);var xe=function(){var Ee=D.arrowContent,le=Ee===void 0?null:Ee,I=D.overlay,x=D.id;return[Y.createElement("div",{className:"".concat(u,"-arrow"),key:"arrow"},le),Y.createElement(N,{key:"content",prefixCls:u,id:x,overlay:I,overlayInnerStyle:F})]},Te=!1,Se=!1;if(typeof z=="boolean")Te=z;else if(z&&Object(fe.a)(z)==="object"){var me=z.keepParent;Te=me===!0,Se=me===!1}return Y.createElement(U.a,Object.assign({popupClassName:C,prefixCls:u,popup:xe,action:f,builtinPlacements:O.a,popupPlacement:m,ref:ge,popupAlign:M,getPopupContainer:G,onPopupVisibleChange:d,afterPopupVisibleChange:h,popupTransitionName:s,popupAnimation:a,defaultPopupVisible:ee,destroyPopupOnHide:Te,autoDestroy:Se,mouseLeaveDelay:E,popupStyle:v,mouseEnterDelay:i},ye),y)},L=Object(Y.forwardRef)(k),_=Ke.a=L},OZM5:function(qe,Ke,V){"use strict";V.d(Ke,"b",function(){return L}),V.d(Ke,"a",function(){return _}),V.d(Ke,"k",function(){return w}),V.d(Ke,"h",function(){return D}),V.d(Ke,"i",function(){return T}),V.d(Ke,"g",function(){return C}),V.d(Ke,"c",function(){return S}),V.d(Ke,"d",function(){return f}),V.d(Ke,"j",function(){return c}),V.d(Ke,"e",function(){return E}),V.d(Ke,"f",function(){return v});var fe=V("KQm4"),$=V("U8pU"),P=V("Ff2n"),Y=V("q1tI"),U=V.n(Y),O=V("Kwbf"),H=V("WaYH"),N=.25,k=2;function L(p,u){var y=p.slice(),d=y.indexOf(u);return d>=0&&y.splice(d,1),y}function _(p,u){var y=p.slice();return y.indexOf(u)===-1&&y.push(u),y}function w(p){return p.split("-")}function D(p,u){return"".concat(p,"-").concat(u)}function T(p){return p&&p.type&&p.type.isTreeNode}function C(p,u){var y=[p],d=u[p];function h(){var s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];s.forEach(function(a){var g=a.key,m=a.children;y.push(g),h(m)})}return h(d.children),y}function S(p,u){var y=p.clientY,d=u.selectHandle.getBoundingClientRect(),h=d.top,s=d.bottom,a=d.height,g=Math.max(a*N,k);return y<=h+g?-1:y>=s-g?1:0}function f(p,u){if(!p)return;var y=u.multiple;return y?p.slice():p.length?[p[0]]:p}var l=function(u){return u};function i(p,u){if(!p)return[];var y=u||{},d=y.processProps,h=d===void 0?l:d,s=Array.isArray(p)?p:[p];return s.map(function(a){var g=a.children,m=Object(P.a)(a,["children"]),b=i(g,u);return U.a.createElement(H.a,Object.assign({},h(m)),b)})}function c(p){if(!p)return null;var u;if(Array.isArray(p))u={checkedKeys:p,halfCheckedKeys:void 0};else if(Object($.a)(p)==="object")u={checkedKeys:p.checked||void 0,halfCheckedKeys:p.halfChecked||void 0};else return Object(O.a)(!1,"`checkedKeys` is not an array or an object"),null;return u}function E(p,u){var y=new Set;function d(h){if(y.has(h))return;var s=u[h];if(!s)return;y.add(h);var a=s.parent,g=s.node;if(g.disabled)return;a&&d(a.key)}return(p||[]).forEach(function(h){d(h)}),Object(fe.a)(y)}function v(p){var u={};return Object.keys(p).forEach(function(y){(y.startsWith("data-")||y.startsWith("aria-"))&&(u[y]=p[y])}),u}},Ot1p:function(qe,Ke,V){"use strict";var fe=V("2qtc"),$=V("kLXV"),P=V("rAM+"),Y=V("miYZ"),U=V("tsqr"),O=V("9og8"),H=V("tJVT"),N=V("jrin"),k=V("WmNS"),L=V.n(k),_=V("q1tI"),w=V.n(_),D=V("VrN/"),T=V.n(D),C=V("bdgK"),S=V("p77/"),f=V("Bd2K"),l=V("ELLl"),i=V("19Vz"),c=V("lZu9"),E=V("+NIl"),v=V("kSUc"),p=V("9Bee"),u=function(ce){var Ce=ce.value,Ae=Ce===void 0?"":Ce,Ge=ce.className,Ue=ce.showTextOnly,He=ce.showLines,Tt=ce.style,Xe=Tt===void 0?{}:Tt,st=Object(_.useMemo)(function(){return""},[Ae]);return w.a.createElement(w.a.Fragment,null,w.a.createElement("div",{dangerouslySetInnerHTML:{__html:st}}))},y=V("0Owb"),d=V("dejd"),h=V("C+DQ"),s=V("1vsH"),a=V("m3rI"),g=[{title:"\u7C97\u4F53",icon:"icon-bold",actionName:"bold"},{title:"\u659C\u4F53",icon:"icon-italic",actionName:"italic"},"|",{title:"\u65E0\u5E8F\u5217\u8868",icon:"icon-unorder-list",actionName:"list-ul"},{title:"\u6709\u5E8F\u5217\u8868",icon:"icon-order-list",actionName:"list-ol"},"|",{title:"\u884C\u5185\u4EE3\u7801",icon:"icon-code",actionName:"code"},{title:"\u4EE3\u7801\u5757\uFF08\u591A\u8BED\u8A00\u98CE\u683C\uFF09",icon:"icon-file-code",actionName:"code-block"},{title:"\u94FE\u63A5",icon:"icon-link",actionName:"link"},"|",{title:"\u884C\u5185\u516C\u5F0F",icon:"icon-sum",actionName:"inline-latex"},{title:"\u591A\u884C\u516C\u5F0F",icon:"icon-formula",actionName:"latex"},"|",{title:"\u6DFB\u52A0\u56FE\u7247",icon:"icon-picture",actionName:"upload-image"},{title:"\u8868\u683C",icon:"icon-table",actionName:"add-table"},"|",{title:"\u6362\u884C",icon:"icon-minus",actionName:"line-break"},{title:"\u6E05\u7A7A",icon:"icon-eraser",actionName:"eraser"}];function m(ce){var Ce=ce.onActionCallback,Ae=ce.title,Ge=ce.icon,Ue=ce.actionName,He=ce.className,Tt=He===void 0?"":He,Xe=ce.children;function st(){Ce(Ue)}return w.a.createElement("a",{title:Ae,className:Tt,onClick:st},w.a.createElement("i",{className:"md-iconfont ".concat(Ge)}),Xe)}var b=function(ce){var Ce=ce.watch,Ae=ce.showNullButton,Ge=ce.onActionCallback,Ue=ce.fullScreen,He=ce.insertTemp,Tt=ce.hidetoolBar,Xe=ce.uuid,st=ce.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(Xe,"&api=").concat(encodeURIComponent(a.a.PROXY_SERVER)));var jt=[].concat(g,[{title:"".concat(Ce?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(Ce?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return w.a.createElement("ul",{className:"markdown-toolbar-container"},!Tt&&jt.map(function(ze,It){return w.a.createElement("li",{key:It},ze.actionName?w.a.createElement(m,Object(y.a)({},ze,{onActionCallback:Ge})):w.a.createElement("span",{className:"v-line"}))}),Ae?w.a.createElement("li",null,w.a.createElement(m,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:Ge},w.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,He&&w.a.createElement("li",null,w.a.createElement(m,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(He),onActionCallback:Ge},w.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),w.a.createElement("li",{className:"btn-full-screen"},w.a.createElement(m,{icon:"".concat(Ue?"icon-shrink":"icon-enlarge"),title:Ue?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:Ge})))},M=V("M8RZ"),K=V("+L6B"),z=V("2/Rp"),ee=V("y8nQ"),G=V("Vl3Y"),F=V("5NDa"),ie=V("5rEg"),ge={labelCol:{span:4},wrapperCol:{span:20}},ye=function(ce){var Ce=ce.callback,Ae=ce.onCancel;function Ge(Ue){Ce(Ue)}return w.a.createElement(G.a,Object(y.a)({},ge,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:Ge}),w.a.createElement(G.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},w.a.createElement(ie.a,null)),w.a.createElement(G.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},w.a.createElement(ie.a,null)),w.a.createElement("div",{className:"flex-container flex-end"},w.a.createElement(z.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),w.a.createElement(z.a,{type:"ghost",onClick:Ae},"\u53D6\u6D88")))},xe=V("7ahc"),Te=V("HmJG"),Se=V("BjJ7"),me=G.a.useForm,pe={width:280,marginRight:10},Ee={labelCol:{span:5},wrapperCol:{span:19}},le=function(ce){var Ce=ce.callback,Ae=ce.onCancel,Ge=me(),Ue=Object(H.a)(Ge,1),He=Ue[0];function Tt(jt){Ce(jt)}function Xe(jt,ze){if(jt.status===-1){U.b.error(jt.message);return}He.setFieldsValue({src:"/api/attachments/".concat(jt.id),type:ze.type})}function st(jt){var ze=jt.target.files[0];x(ze,Xe)}return w.a.createElement(G.a,Object(y.a)({form:He},Ee,{className:"upload-image-panel",onFinish:Tt}),w.a.createElement(G.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},w.a.createElement("div",{className:"flex-container"},w.a.createElement(G.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},w.a.createElement(ie.a,{style:pe})),w.a.createElement(I,{onFileChange:st}))),w.a.createElement(G.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt"},w.a.createElement(ie.a,{style:{width:264}})),w.a.createElement(G.a.Item,{style:{textAlign:"right"}},w.a.createElement(z.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),w.a.createElement(z.a,{type:"ghost",onClick:Ae},"\u53D6\u6D88")))};function I(ce){var Ce=ce.onFileChange;return w.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",w.a.createElement("input",{type:"file",onChange:Ce}))}function x(ce,Ce){if(!ce)throw new String("\u6CA1\u6709\u6587\u4EF6");var Ae=new FormData;Ae.append("editormd-image-file",ce),Ae.append("file_param_name","editormd-image-file"),Ae.append("byxhr","true");var Ge=new window.XMLHttpRequest;Ge.withCredentials=!0,Ge.addEventListener("load",function(Ue){Ce(JSON.parse(Ue.target.responseText),ce)},!1),Ge.addEventListener("error",function(Ue){console.error(Ue)},!1),Ge.open("POST","".concat(Se.a,"/api/attachments.json")),Ge.send(Ae)}var R=V("giR+"),W=V("fyUT"),J=V("7Kak"),B=V("9yH6"),de=B.a.Group,_e={margin:"0 8px"},Re=function(ce){var Ce=ce.callback,Ae=ce.onCancel;function Ge(Ue){Ce(Ue)}return w.a.createElement(G.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:Ge},w.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},w.a.createElement("span",{style:_e},"\u5355\u5143\u683C\u6570\uFF1A"),w.a.createElement("span",{style:_e},"\u884C\u6570"),w.a.createElement(G.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},w.a.createElement(W.a,null)),w.a.createElement("span",{style:_e},"\u5217\u6570"),w.a.createElement(G.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},w.a.createElement(W.a,null))),w.a.createElement("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"}},w.a.createElement("span",{style:_e},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),w.a.createElement(G.a.Item,{name:"align"},w.a.createElement(de,null,w.a.createElement(B.a,{value:"default"},w.a.createElement("i",{className:"fa fa-align-justify"})),w.a.createElement(B.a,{value:"left"},w.a.createElement("i",{className:"fa fa-align-left"})),w.a.createElement(B.a,{value:"center"},w.a.createElement("i",{className:"fa fa-align-center"})),w.a.createElement(B.a,{value:"right"},w.a.createElement("i",{className:"fa fa-align-right"}))))),w.a.createElement("div",{className:"flex-container flex-end"},w.a.createElement(z.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),w.a.createElement(z.a,{type:"ghost",onClick:Ae},"\u53D6\u6D88")))},Oe=V("ErOA"),ke=V("7Cbv"),Ie="link",De="upload-image",Ve="code-block",Qe="add-table",at="------------",Ze={default:at,left:":".concat(at),center:":".concat(at,":"),right:"".concat(at,":")},yt=V("9VGf"),rt,dt;function Me(){}var xt=0,mt=1e4,se="\u2581",Z=`
**\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 q(ce){return/^\d+$/.test(ce)?"".concat(ce,"px"):ce}var ae=navigator.platform.toUpperCase().indexOf("MAC")>=0,ue=ae?"Cmd":"Ctrl",te=["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"],ne=(rt={},Object(N.a)(rt,ue+"-B","bold"),Object(N.a)(rt,ue+"-I","italic"),rt),oe=(dt={},Object(N.a)(dt,Ie,"\u6DFB\u52A0\u94FE\u63A5"),Object(N.a)(dt,Ve,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(N.a)(dt,De,"\u6DFB\u52A0\u6587\u4EF6"),Object(N.a)(dt,Qe,"\u6DFB\u52A0\u8868\u683C"),dt),he=Ke.a=function(ce){var Ce=ce.defaultValue,Ae=Ce===void 0?"":Ce,Ge=ce.onChange,Ue=ce.width,He=Ue===void 0?"100%":Ue,Tt=ce.height,Xe=Tt===void 0?400:Tt,st=ce.miniToolbar,jt=st===void 0?!1:st,ze=ce.isFocus,It=ze===void 0?!1:ze,Zt=ce.watch,At=ce.insertTemp,qt=ce.mode,Gt=qt===void 0?"markdown":qt,Dt=ce.id,Ot=Dt===void 0?"markdown-editor-id":Dt,ht=ce.showResizeBar,kt=ht===void 0?!1:ht,bt=ce.noStorage,_t=bt===void 0?!1:bt,Et=ce.showNullButton,nt=Et===void 0?!1:Et,Be=ce.hidetoolBar,Rt=Be===void 0?!1:Be,Nt=ce.fullScreen,Lt=Nt===void 0?!1:Nt,Ft=ce.onBlur,Vt=ce.onCMBeforeChange,Jt=ce.onFullScreen,Je=ce.className,je=Je===void 0?"":Je,ft=ce.disablePaste,Rn=ft===void 0?!1:ft,hr=ce.placeholder,vr=hr===void 0?"":hr,Cn=ce.values,Xt=Cn===void 0?"":Cn,Pt=Object(_.useState)(null),Sn=Object(H.a)(Pt,2),$e=Sn[0],ln=Sn[1],Ln=Object(_.useState)(Ae),Hr=Object(H.a)(Ln,2),Kr=Hr[0],Nn=Hr[1],ii=Object(_.useState)(Zt),ai=Object(H.a)(ii,2),yr=ai[0],Mr=ai[1],oi=Object(_.useState)(Lt),qr=Object(H.a)(oi,2),br=qr[0],Un=qr[1],ei=Object(_.useState)(""),si=Object(H.a)(ei,2),Wn=si[0],pt=si[1],Le=Object(_.useState)(0),et=Object(H.a)(Le,2),Ut=et[0],Ct=et[1],wt=Object(_.useState)(Xe),Wt=Object(H.a)(wt,2),bn=Wt[0],En=Wt[1],rn=Object(_.useState)(!1),On=Object(H.a)(rn,2),kn=On[0],er=On[1],Bn=Object(_.useRef)(Object(ke.a)()),Ir=Object(_.useRef)(!1),Qn=Object(_.useRef)(),Tn=Object(_.useRef)(),fr=Object(_.useRef)(),wr=Object(_.useRef)(),Ar=Object(_.useRef)(),Ui=function(){var Bt=Object(O.a)(L.a.mark(function Yt(){var Kt,tn;return L.a.wrap(function(mn){for(;;)switch(mn.prev=mn.next){case 0:return mn.next=2,Object(Oe.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:Bn.current}});case 2:tn=mn.sent,tn!=null&&(Kt=tn.attachments)!==null&&Kt!==void 0&&Kt.length&&(console.log("cm:",$e,Tn),tn.attachments.map(function(on){on.content_type.indexOf("image")>-1?$e.replaceSelection("![,](/api/attachments/".concat(on.id,"?type=").concat(on.content_type,")")):on.content_type.indexOf("video")>-1?$e.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):on.content_type.indexOf("pdf")>-1?$e.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(on.id,"?type=").concat(on.content_type,'&disposition=inline" target="_blank">').concat(on.name,"</a>")):$e.replaceSelection("[".concat(on.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(on.id,"?type=").concat(on.content_type,")"))}));case 4:case"end":return mn.stop()}},Yt)}));return function(){return Bt.apply(this,arguments)}}();Object(_.useEffect)(function(){Nn(Xt),$e==null||$e.setValue(Xt)},[Xt]),Object(_.useEffect)(function(){Jt==null||Jt(br)},[br]),Object(_.useEffect)(function(){if(Tn.current){var Bt=T.a.fromTextArea(Tn.current,{mode:Gt,lineNumbers:!jt,lineWrapping:!0,value:Ae,autoCloseTags:!0,autoCloseBrackets:!0});It&&Bt.focus();function Yt(Kt,tn){if(Rn){tn.preventDefault();return}var sn=tn.clipboardData;if(sn){var mn=sn.types.toString(),on=sn.items;if(mn==="Files"||sn.types.indexOf("Files")>-1){if(tn.preventDefault(),Gt=="stex")return;try{var Hn,tr=on[1];((Hn=on[0])===null||Hn===void 0?void 0:Hn.kind)==="file"&&(tr=on[0]);var an=tr.getAsFile(),Gr=an.name.split(".").pop();x(an,function(dn){if(dn.id){var Vn,Kn,Nr;(an==null||((Vn=an.type)===null||Vn===void 0)?void 0:Vn.indexOf("image"))>-1?Bt.replaceSelection("![,](/api/attachments/".concat(dn.id,"?type=").concat(dn.content_type,")")):(an==null||((Kn=an.type)===null||Kn===void 0)?void 0:Kn.indexOf("video"))>-1?Bt.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(dn.id,'"></video>')):(an==null||((Nr=an.type)===null||Nr===void 0)?void 0:Nr.indexOf("pdf"))>-1?Bt.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(dn.id,"?type=").concat(an.type,'&disposition=inline" target="_blank">').concat(an.name,"</a>")):te.includes(Gr)?Bt.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(dn.id,'?type=office&disposition=inline" target="_blank">').concat(an.name,"</a>")):Bt.replaceSelection("[".concat(an.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(dn.id,"?type=").concat(dn.content_type,")"))}else(dn==null?void 0:dn.status)===401&&(document.location.href="/user/login")})}catch(dn){U.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return Bt.on("paste",Yt),Bt.on("dragleave",function(Kt,tn){fr.current.classList.remove("mouse-hover-md")}),Bt.on("dragover",function(Kt,tn){fr.current.classList.add("mouse-hover-md")}),Bt.on("drop",function(Kt,tn){fr.current.classList.add("mouse-hover-md");var sn;if(sn=tn.dataTransfer.files,sn.length>0){tn.preventDefault(),tn.stopPropagation();for(var mn=function(tr){var an=sn[tr],Gr=an.name.split(".").pop();x(an,function(dn){if(dn.id){var Vn,Kn,Nr;(an==null||((Vn=an.type)===null||Vn===void 0)?void 0:Vn.indexOf("image"))>-1?Bt.replaceSelection("![,](/api/attachments/".concat(dn.id,"?type=").concat(dn.content_type,")")):(an==null||((Kn=an.type)===null||Kn===void 0)?void 0:Kn.indexOf("video"))>-1?Bt.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(dn.id,'"></video>')):(an==null||((Nr=an.type)===null||Nr===void 0)?void 0:Nr.indexOf("pdf"))>-1?Bt.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(dn.id,"?type=").concat(an.type,'&disposition=inline" target="_blank">').concat(an.name,"</a>")):te.includes(Gr)?Bt.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(dn.id,'?type=office&disposition=inline" target="_blank">').concat(an.name,"</a>")):Bt.replaceSelection("[".concat(an.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(dn.id,"?type=").concat(dn.content_type,")"))}else(dn==null?void 0:dn.status)===401&&(document.location.href="/user/login")})},on=0;on<sn.length;on++)mn(on)}}),ln(Bt),function(){Bt.off("paste",Yt)}}},[]);var Er=Object(_.useCallback)(function(){if(fr.current)try{}catch(Bt){console.log(Bt,"---- to set md editor body height")}},[bn,fr,br]);Object(_.useEffect)(function(){function Bt(){var Kt=new C.default(function(tn){var sn=Object(P.a)(tn),mn;try{for(sn.s();!(mn=sn.n()).done;){var on=mn.value;(on.target.offsetHeight>0||on.target.offsetWidth>0)&&(Er(),$e.setSize("100%","100%"),$e.refresh())}}catch(Hn){sn.e(Hn)}finally{sn.f()}});return Kt.observe(Tn.current.parentElement),Kt}if($e){var Yt=Bt();return function(){Yt.unobserve(Tn.current.parentElement)}}},[$e,Er]),Object(_.useEffect)(function(){if($e){for(var Bt=[],Yt=function(){var on=tn[Kt];sn=Object(H.a)(on,2);var Hn=sn[0],tr=sn[1],an=Object(N.a)({},Hn,function(){Bi(tr)});Bt.push(an),$e.addKeyMap(an)},Kt=0,tn=Object.entries(ne);Kt<tn.length;Kt++){var sn;Yt()}return Qn.current=setInterval(function(){Ir.current&&Ui()},4e3),function(){clearInterval(Qn.current);var mn=Object(P.a)(Bt),on;try{for(mn.s();!(on=mn.n()).done;){var Hn=on.value;$e.removeKeyMap(Hn)}}catch(tr){mn.e(tr)}finally{mn.f()}}}},[$e]),Object(_.useEffect)(function(){Lt!==br&&Un(Lt)},[Lt]),Object(yt.a)(function(){if(!_t&&Ut>0){var Bt=new Date().getTime(),Yt=window.sessionStorage.getItem(Ot);Bt>=Ut+mt&&(!Yt||Yt!==Kr)&&(window.sessionStorage.setItem(Ot,Kr),er(!0))}},mt),Object(_.useEffect)(function(){Mr(Zt)},[$e,Zt]),Object(_.useEffect)(function(){$e&&(It&&$e.focus())},[$e,It]),Object(_.useEffect)(function(){if(yr&&$e){var Bt=$e.getScrollerElement();function Yt(Kt){var tn=Kt.target;if(Ar.current){var sn=tn.scrollTop/tn.scrollHeight;Ar.current.scrollTop=Ar.current.scrollHeight*sn}}return Bt.addEventListener("scroll",Yt),function(){Bt.removeEventListener("scroll",Yt)}}},[$e,yr]),Object(_.useEffect)(function(){if($e&&Vt){function Bt(Yt,Kt){Vt(Yt,Kt)}return $e.on("beforeChange",Bt),function(){$e.off("beforeChange",Bt)}}},[$e,Vt]),Object(_.useEffect)(function(){if($e&&Ft){function Bt(){Ft($e.getValue())}return $e.on("blur",Bt),function(){$e.off("blur",Bt)}}},[$e,Ft]),Object(_.useEffect)(function(){if($e){function Bt(Yt){var Kt=Yt.getValue();Nn(Kt),Ct(new Date().getTime()),Yt.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),Ge&&Ge(Kt)}return $e.on("change",Bt),function(){$e.off("change",Bt)}}},[$e,Ge]),Object(_.useEffect)(function(){$e&&(Ae==null?($e.setValue(""),Nn("")):Ae!==$e.getValue()&&($e.setValue(Ae),Nn(Ae),$e.setCursor($e.lineCount(),0)))},[$e,Ae]);var Bi=Object(_.useCallback)(function(Bt){var Yt=$e.getCursor(),Kt=$e.getSelection(),tn=Kt.split(`
`);switch(Bt){case"bold":return $e.replaceSelection("**"+Kt+"**"),Kt===""&&$e.setCursor(Yt.line,Yt.ch+2),$e.focus();case"italic":return $e.replaceSelection("*"+Kt+"*"),Kt===""&&$e.setCursor(Yt.line,Yt.ch+1),$e.focus();case"code":return $e.replaceSelection("`"+Kt+"`"),Kt===""&&$e.setCursor(Yt.line,Yt.ch+1),$e.focus();case"inline-latex":return $e.replaceSelection("`$$"+Kt+"$$`"),Kt===""&&$e.setCursor(Yt.line,Yt.ch+3),$e.focus();case"latex":return $e.replaceSelection("```latex\n"+Kt+"\n```"),$e.setCursor(Yt.line+1,Kt.length+1),$e.focus();case"line-break":return $e.replaceSelection(`<br/>
`),$e.focus();case"list-ul":return Kt===""?$e.replaceSelection("- "+Kt):$e.replaceSelection(tn.map(function(sn){return sn===""?"":"- ".concat(sn)}).join(`
`)),$e.focus();case"list-ol":return Kt===""?$e.replaceSelection("1. "+Kt):$e.replaceSelection(tn.map(function(sn,mn){return sn===""?"":"".concat(mn+1,". ").concat(sn)}).join(`
`)),$e.focus();case"add-null-ch":return Kt===""&&$e.setCursor(Yt.line,Yt.ch+1),$e.replaceSelection(se),$e.focus();case"inster-template-1":return Kt===""&&$e.setCursor(Yt.line,Yt.ch),$e.replaceSelection(Z),$e.focus();case"eraser":return $e.setValue(""),$e.focus();case"trigger-watch":return Mr(!yr),$e.focus();case"trigger-full-screen":return Un(!br),$e.focus();case Ie:pt(Ie);return;case Ve:pt(Ve);return;case De:pt(De);return;case Qe:pt(Qe);return;default:throw new Error}},[$e,yr,br]),ti=Object(_.useCallback)(function(Bt){pt("");switch(Wn){case Ie:var Yt=Bt.title,Kt=Bt.link;return $e.replaceSelection("[".concat(Yt,"](").concat(Kt,")")),$e.focus();case Ve:var tn=Bt.language,sn=Bt.content;return $e.replaceSelection(["```"+tn,sn,"```"].join(`
`)),$e.focus();case De:var mn=Bt.src,on=Bt.alt;return on?$e.replaceSelection("![ ".concat(on," ]( ").concat(mn,' "').concat(on,'" )')):$e.replaceSelection("![,](".concat(mn,")")),$e.focus();case Qe:for(var Hn=Bt.row,tr=Bt.col,an=Bt.align,Gr=`
`,dn=0;dn<Hn;dn++){for(var Vn=[],Kn=[],Nr=0;Nr<tr;Nr++)dn===1&&Kn.push(Ze[an]),Vn.push(" ");dn===1&&(Gr+="| ".concat(Kn.join(" | "),` |
`)),Gr+="| ".concat(Vn.join(tr===1?"":" | "),` |
`)}return $e.replaceSelection(Gr+`
`),$e.focus();default:throw new Error}},[$e,Wn]),Ci=Object(_.useMemo)(function(){switch(Wn){case Ie:return w.a.createElement(ye,{callback:ti,onCancel:Vr});case Ve:return w.a.createElement(xe.b,{callback:ti,onCancel:Vr});case De:return w.a.createElement(le,{callback:ti,onCancel:Vr});case Qe:return w.a.createElement(Re,{callback:ti,onCancel:Vr});default:return null}},[Wn]);function Vr(){pt("")}Object(_.useEffect)(function(){if(wr.current){var Bt=wr.current,Yt=!1,Kt=0;function tn(on){Yt=!0,Kt=on.pageY}function sn(){Yt=!1}function mn(on){if(Yt){var Hn=on.pageY-Kt;Hn<0&&(Hn=0),Hn>300&&(Hn=300);var tr=Xe+Hn+"px";En(tr)}}return Bt.addEventListener("mousedown",tn),document.addEventListener("mousemove",mn),document.addEventListener("mouseup",sn),function(){Bt.removeEventListener("mousedown",tn),document.removeEventListener("mousemove",mn),document.removeEventListener("mouseup",sn)}}},[$e,wr]),Object(_.useEffect)(function(){En(Xe)},[Xe]);var pn=q(He),Xr=q(bn),Fr={width:pn,height:Xr},hi=Object(_.useMemo)(function(){if(Ut){var Bt=new Date(Ut),Yt=Bt.getHours(),Kt=Bt.getMinutes(),tn=Bt.getSeconds();return Yt=Yt<10?"0"+Yt:Yt,Kt=Kt<10?"0"+Kt:Kt,tn=tn<10?"0"+tn:tn,"".concat(Yt,":").concat(Kt,":").concat(tn)}return 0},[Ut]);function $r(){window.sessionStorage.removeItem(Ot),er(!1),Ct(0)}function li(){er(!1),Ct(0),$e.setValue(window.sessionStorage.getItem(Ot))}function ni(Bt,Yt){var Kt=$e.getValue();Kt=Kt.replace(Bt,Yt),Nn(Kt),$e==null||$e.setValue(Kt)}return w.a.createElement(_.Fragment,null,w.a.createElement("div",{className:"markdown-editor-wrapper",ref:fr},w.a.createElement("div",{className:"markdown-editor-container ".concat(je," ").concat(yr?"on-preview":""," ").concat(jt?"mini":""," ").concat(br?"full-screen":""),style:Fr},w.a.createElement(b,{insertTemp:At,watch:yr,fullScreen:br,showNullButton:nt,onActionCallback:Bi,hidetoolBar:Rt,uuid:Bn.current,setOpenPhones:function(){Ir.current=!0}}),w.a.createElement("div",{className:"markdown-editor-body"},w.a.createElement("div",{className:"codemirror-container"},w.a.createElement("textarea",{ref:Tn,placeholder:vr})),yr?w.a.createElement("div",{ref:Ar,className:"preview-container"},Gt==="stex"&&w.a.createElement(u,{value:Kr}),Gt!=="stex"&&w.a.createElement(p.a,{edit:!0,value:Kr,replaces:ni})):null))),kt?w.a.createElement("a",{ref:wr,className:"editor-resize"}):null,w.a.createElement(M.a,null,oe[Wn]?w.a.createElement($.a,{centered:!0,title:oe[Wn],visible:!0,onCancel:Vr,footer:null,className:"markdown-popup-form"},Ci):null))}},PGNT:function(qe,Ke,V){qe.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(qe,Ke,V){qe.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(qe,Ke,V){qe.exports=V.p+"static/wenhao.50b63ac4.svg"},"RZ/O":function(qe,Ke,V){qe.exports=V.p+"static/bi.9c9b0364.svg"},SJMd:function(qe,Ke){/**
* @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 V,fe,$,P=!1,Y,U;window.PR_SHOULD_USE_CONTINUATION=!0;var O,H;(function(){var N=window,k=["break,continue,do,else,for,if,return,while"],L=[k,"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"],_=[L,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],w=[_,"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"],D=[_,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],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"],C="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",S=[_,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],f="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",l=[k,"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=[k,"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=[k,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],E=[w,T,D,S,f,l,i,c],v=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,p="str",u="kwd",y="com",d="typ",h="lit",s="pun",a="pln",g="tag",m="dec",b="src",M="atn",K="atv",z="nocode",ee="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function G(de){for(var _e=0,Re=!1,Oe=!1,ke=0,Ie=de.length;ke<Ie;++ke){var De=de[ke];if(De.ignoreCase)Oe=!0;else if(/[a-z]/i.test(De.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Re=!0,Oe=!1;break}}var Ve={b:8,t:9,n:10,v:11,f:12,r:13};function Qe(dt){var Me=dt.charCodeAt(0);if(Me!==92)return Me;var xt=dt.charAt(1);return Me=Ve[xt],Me||("0"<=xt&&xt<="7"?parseInt(dt.substring(1),8):xt==="u"||xt==="x"?parseInt(dt.substring(2),16):dt.charCodeAt(1))}function at(dt){if(dt<32)return(dt<16?"\\x0":"\\x")+dt.toString(16);var Me=String.fromCharCode(dt);return Me==="\\"||Me==="-"||Me==="]"||Me==="^"?"\\"+Me:Me}function Ze(dt){var Me=dt.substring(1,dt.length-1).match(new RegExp("\\\\u[0-9A-Fa-f]{4}|\\\\x[0-9A-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\s\\S]|-|[^-\\\\]","g")),xt=[],mt=Me[0]==="^",se=["["];mt&&se.push("^");for(var Z=mt?1:0,q=Me.length;Z<q;++Z){var ae=Me[Z];if(/\\[bdsw]/i.test(ae))se.push(ae);else{var ue=Qe(ae),te;Z+2<q&&Me[Z+1]==="-"?(te=Qe(Me[Z+2]),Z+=2):te=ue,xt.push([ue,te]),te<65||ue>122||(te<65||ue>90||xt.push([Math.max(65,ue)|32,Math.min(te,90)|32]),te<97||ue>122||xt.push([Math.max(97,ue)&~32,Math.min(te,122)&~32]))}}xt.sort(function(ce,Ce){return ce[0]-Ce[0]||Ce[1]-ce[1]});for(var ne=[],oe=[],Z=0;Z<xt.length;++Z){var he=xt[Z];he[0]<=oe[1]+1?oe[1]=Math.max(oe[1],he[1]):ne.push(oe=he)}for(var Z=0;Z<ne.length;++Z){var he=ne[Z];se.push(at(he[0])),he[1]>he[0]&&(he[1]+1>he[0]&&se.push("-"),se.push(at(he[1])))}return se.push("]"),se.join("")}function yt(dt){for(var Me=dt.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")),xt=Me.length,mt=[],se=0,Z=0;se<xt;++se){var q=Me[se];if(q==="(")++Z;else if(q.charAt(0)==="\\"){var ae=+q.substring(1);ae&&(ae<=Z?mt[ae]=-1:Me[se]=at(ae))}}for(var se=1;se<mt.length;++se)mt[se]===-1&&(mt[se]=++_e);for(var se=0,Z=0;se<xt;++se){var q=Me[se];if(q==="(")++Z,mt[Z]||(Me[se]="(?:");else if(q.charAt(0)==="\\"){var ae=+q.substring(1);ae&&ae<=Z&&(Me[se]="\\"+mt[ae])}}for(var se=0;se<xt;++se)Me[se]==="^"&&Me[se+1]!=="^"&&(Me[se]="");if(dt.ignoreCase&&Re)for(var se=0;se<xt;++se){var q=Me[se],ue=q.charAt(0);q.length>=2&&ue==="["?Me[se]=Ze(q):ue!=="\\"&&(Me[se]=q.replace(/[a-zA-Z]/g,function(oe){var he=oe.charCodeAt(0);return"["+String.fromCharCode(he&~32,he|32)+"]"}))}return Me.join("")}for(var rt=[],ke=0,Ie=de.length;ke<Ie;++ke){var De=de[ke];if(De.global||De.multiline)throw new Error(""+De);rt.push("(?:"+yt(De)+")")}return new RegExp(rt.join("|"),Oe?"gi":"g")}function F(de,_e){var Re=/(?:^|\s)nocode(?:\s|$)/,Oe=[],ke=0,Ie=[],De=0;function Ve(Qe){var at=Qe.nodeType;if(at==1){if(Re.test(Qe.className))return;for(var Ze=Qe.firstChild;Ze;Ze=Ze.nextSibling)Ve(Ze);var yt=Qe.nodeName.toLowerCase();(yt==="br"||yt==="li")&&(Oe[De]=`
`,Ie[De<<1]=ke++,Ie[De++<<1|1]=Qe)}else if(at==3||at==4){var rt=Qe.nodeValue;rt.length&&(_e?rt=rt.replace(/\r\n?/g,`
`):rt=rt.replace(/[ \t\r\n]+/g," "),Oe[De]=rt,Ie[De<<1]=ke,ke+=rt.length,Ie[De++<<1|1]=Qe)}}return Ve(de),{sourceCode:Oe.join("").replace(/\n$/,""),spans:Ie}}function ie(de,_e,Re,Oe,ke){if(!Re)return;var Ie={sourceNode:de,pre:1,langExtension:null,numberLines:null,sourceCode:Re,spans:null,basePos:_e,decorations:null};Oe(Ie),ke.push.apply(ke,Ie.decorations)}var ge=/\S/;function ye(de){for(var _e=void 0,Re=de.firstChild;Re;Re=Re.nextSibling){var Oe=Re.nodeType;_e=Oe===1?_e?de:Re:Oe===3&&ge.test(Re.nodeValue)?de:_e}return _e===de?void 0:_e}function xe(de,_e){var Re={},Oe;(function(){for(var De=de.concat(_e),Ve=[],Qe={},at=0,Ze=De.length;at<Ze;++at){var yt=De[at],rt=yt[3];if(rt)for(var dt=rt.length;--dt>=0;)Re[rt.charAt(dt)]=yt;var Me=yt[1],xt=""+Me;Qe.hasOwnProperty(xt)||(Ve.push(Me),Qe[xt]=null)}Ve.push(/[\0-\uffff]/),Oe=G(Ve)})();var ke=_e.length,Ie=function(De){for(var Ve=De.sourceCode,Qe=De.basePos,at=De.sourceNode,Ze=[Qe,a],yt=0,rt=Ve.match(Oe)||[],dt={},Me=0,xt=rt.length;Me<xt;++Me){var mt=rt[Me],se=dt[mt],Z=void 0,q;if(typeof se=="string")q=!1;else{var ae=Re[mt.charAt(0)];if(ae)Z=mt.match(ae[1]),se=ae[0];else{for(var ue=0;ue<ke;++ue)if(ae=_e[ue],Z=mt.match(ae[1]),Z){se=ae[0];break}Z||(se=a)}q=se.length>=5&&se.substring(0,5)==="lang-",q&&!(Z&&typeof Z[1]=="string")&&(q=!1,se=b),q||(dt[mt]=se)}var te=yt;if(yt+=mt.length,!q)Ze.push(Qe+te,se);else{var ne=Z[1],oe=mt.indexOf(ne),he=oe+ne.length;Z[2]&&(he=mt.length-Z[2].length,oe=he-ne.length);var ce=se.substring(5);ie(at,Qe+te,mt.substring(0,oe),Ie,Ze),ie(at,Qe+te+oe,ne,I(ce,ne),Ze),ie(at,Qe+te+he,mt.substring(he),Ie,Ze)}}De.decorations=Ze};return Ie}function Te(de){var _e=[],Re=[];de.tripleQuotedStrings?_e.push([p,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):de.multiLineStrings?_e.push([p,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):_e.push([p,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),de.verbatimStrings&&Re.push([p,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Oe=de.hashComments;Oe&&(de.cStyleComments?(Oe>1?_e.push([y,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):_e.push([y,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Re.push([p,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):_e.push([y,/^#[^\r\n]*/,null,"#"])),de.cStyleComments&&(Re.push([y,/^\/\/[^\r\n]*/,null]),Re.push([y,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var ke=de.regexLiterals;if(ke){var Ie=ke>1?"":`
\r`,De=Ie?".":"[\\S\\s]",Ve="/(?=[^/*"+Ie+"])(?:[^/\\x5B\\x5C"+Ie+"]|\\x5C"+De+"|\\x5B(?:[^\\x5C\\x5D"+Ie+"]|\\x5C"+De+")*(?:\\x5D|$))+/";Re.push(["lang-regex",RegExp("^"+ee+"("+Ve+")")])}var Qe=de.types;Qe&&Re.push([d,Qe]);var at=(""+de.keywords).replace(/^ | $/g,"");at.length&&Re.push([u,new RegExp("^(?:"+at.replace(/[\s,]+/g,"|")+")\\b"),null]),_e.push([a,/^\s+/,null,` \r
\xA0`]);var Ze="^.[^\\s\\w.$@'\"`/\\\\]*";return de.regexLiterals&&(Ze+="(?!s*/)"),Re.push([h,/^@[a-z_$][a-z_$@0-9]*/i,null],[d,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[a,/^[a-z_$][a-z_$@0-9]*/i,null],[h,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[a,/^\\[\s\S]?/,null],[s,new RegExp(Ze),null]),xe(_e,Re)}var Se=Te({keywords:E,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function me(de,_e,Re){for(var Oe=/(?:^|\s)nocode(?:\s|$)/,ke=/\r\n?|\n/,Ie=de.ownerDocument,De=Ie.createElement("li");de.firstChild;)De.appendChild(de.firstChild);var Ve=[De];function Qe(Me){var xt=Me.nodeType;if(xt==1&&!Oe.test(Me.className))if(Me.nodeName==="br")at(Me),Me.parentNode&&Me.parentNode.removeChild(Me);else for(var mt=Me.firstChild;mt;mt=mt.nextSibling)Qe(mt);else if((xt==3||xt==4)&&Re){var se=Me.nodeValue,Z=se.match(ke);if(Z){var q=se.substring(0,Z.index);Me.nodeValue=q;var ae=se.substring(Z.index+Z[0].length);if(ae){var ue=Me.parentNode;ue.insertBefore(Ie.createTextNode(ae),Me.nextSibling)}at(Me),q||Me.parentNode.removeChild(Me)}}}function at(Me){for(;!Me.nextSibling;)if(Me=Me.parentNode,!Me)return;function xt(Z,q){var ae=q?Z.cloneNode(!1):Z,ue=Z.parentNode;if(ue){var te=xt(ue,1),ne=Z.nextSibling;te.appendChild(ae);for(var oe=ne;oe;oe=ne)ne=oe.nextSibling,te.appendChild(oe)}return ae}for(var mt=xt(Me.nextSibling,0),se;(se=mt.parentNode)&&se.nodeType===1;)mt=se;Ve.push(mt)}for(var Ze=0;Ze<Ve.length;++Ze)Qe(Ve[Ze]);_e===(_e|0)&&Ve[0].setAttribute("value",_e);var yt=Ie.createElement("ol");yt.className="linenums";for(var rt=Math.max(0,_e-1|0)||0,Ze=0,dt=Ve.length;Ze<dt;++Ze)De=Ve[Ze],De.className="L"+(Ze+rt)%10,De.firstChild||De.appendChild(Ie.createTextNode("\xA0")),yt.appendChild(De);de.appendChild(yt)}function pe(de){var _e=/\bMSIE\s(\d+)/.exec(navigator.userAgent);_e=_e&&+_e[1]<=8;var Re=/\n/g,Oe=de.sourceCode,ke=Oe.length,Ie=0,De=de.spans,Ve=De.length,Qe=0,at=de.decorations,Ze=at.length,yt=0;at[Ze]=ke;var rt,dt;for(dt=rt=0;dt<Ze;)at[dt]!==at[dt+2]?(at[rt++]=at[dt++],at[rt++]=at[dt++]):dt+=2;for(Ze=rt,dt=rt=0;dt<Ze;){for(var Me=at[dt],xt=at[dt+1],mt=dt+2;mt+2<=Ze&&at[mt+1]===xt;)mt+=2;at[rt++]=Me,at[rt++]=xt,dt=mt}Ze=at.length=rt;var se=de.sourceNode,Z="";se&&(Z=se.style.display,se.style.display="none");try{for(var q=null;Qe<Ve;){var ae=De[Qe],ue=De[Qe+2]||ke,te=at[yt+2]||ke,mt=Math.min(ue,te),ne=De[Qe+1],oe;if(ne.nodeType!==1&&(oe=Oe.substring(Ie,mt))){_e&&(oe=oe.replace(Re,"\r")),ne.nodeValue=oe;var he=ne.ownerDocument,ce=he.createElement("span");ce.className=at[yt+1];var Ce=ne.parentNode;Ce.replaceChild(ce,ne),ce.appendChild(ne),Ie<ue&&(De[Qe+1]=ne=he.createTextNode(Oe.substring(mt,ue)),Ce.insertBefore(ne,ce.nextSibling))}Ie=mt,Ie>=ue&&(Qe+=2),Ie>=te&&(yt+=2)}}finally{se&&(se.style.display=Z)}}var Ee={};function le(de,_e){for(var Re=_e.length;--Re>=0;){var Oe=_e[Re];Ee.hasOwnProperty(Oe)?N.console&&console.warn("cannot override language handler %s",Oe):Ee[Oe]=de}}function I(de,_e){return de&&Ee.hasOwnProperty(de)||(de=/^\s*</.test(_e)?"default-markup":"default-code"),Ee[de]}le(Se,["default-code"]),le(xe([],[[a,/^[^<?]+/],[m,/^<!\w[^>]*(?:>|$)/],[y,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[s,/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),le(xe([[a,/^[\s]+/,null,` \r
`],[K,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[g,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[M,/^(?!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"]),le(xe([],[[K,/^[\s\S]+/]]),["uq.val"]),le(Te({keywords:w,hashComments:!0,cStyleComments:!0,types:v}),["c","cc","cpp","cxx","cyc","m"]),le(Te({keywords:"null,true,false"}),["json"]),le(Te({keywords:T,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:v}),["cs"]),le(Te({keywords:D,cStyleComments:!0}),["java"]),le(Te({keywords:c,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),le(Te({keywords:l,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),le(Te({keywords:f,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),le(Te({keywords:i,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),le(Te({keywords:S,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),le(Te({keywords:C,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),le(xe([],[[p,/^[\s\S]+/]]),["regex"]);function x(de){var _e=de.langExtension;try{var Re=F(de.sourceNode,de.pre),Oe=Re.sourceCode;de.sourceCode=Oe,de.spans=Re.spans,de.basePos=0,I(_e,Oe)(de),pe(de)}catch(ke){N.console&&console.log(ke&&ke.stack||ke)}}function R(de,_e,Re){var Oe=Re||!1,ke=_e||null,Ie=document.createElement("div");Ie.innerHTML="<pre>"+de+"</pre>",Ie=Ie.firstChild,Oe&&me(Ie,Oe,!0);var De={langExtension:ke,numberLines:Oe,sourceNode:Ie,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return x(De),Ie.innerHTML}function W(de,_e){var Re=_e||document.body,Oe=Re.ownerDocument||document;function ke(ae){return Re.getElementsByTagName(ae)}for(var Ie=[ke("pre"),ke("code"),ke("xmp")],De=[],Ve=0;Ve<Ie.length;++Ve)for(var Qe=0,at=Ie[Ve].length;Qe<at;++Qe)De.push(Ie[Ve][Qe]);Ie=null;var Ze=Date;Ze.now||(Ze={now:function(){return+new Date}});var yt=0,rt=/\blang(?:uage)?-([\w.]+)(?!\S)/,dt=/\bprettyprint\b/,Me=/\bprettyprinted\b/,xt=/pre|xmp/i,mt=/^code$/i,se=/^(?:pre|code|xmp)$/i,Z={};function q(){for(var ae=N.PR_SHOULD_USE_CONTINUATION?Ze.now()+250:Infinity;yt<De.length&&Ze.now()<ae;yt++){for(var ue=De[yt],te=Z,ne=ue;ne=ne.previousSibling;){var oe=ne.nodeType,he=(oe===7||oe===8)&&ne.nodeValue;if(he?!/^\??prettify\b/.test(he):oe!==3||/\S/.test(ne.nodeValue))break;if(he){te={},he.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Zt,At,qt){te[At]=qt});break}}var ce=ue.className;if((te!==Z||dt.test(ce))&&!Me.test(ce)){for(var Ce=!1,Ae=ue.parentNode;Ae;Ae=Ae.parentNode){var Ge=Ae.tagName;if(se.test(Ge)&&Ae.className&&dt.test(Ae.className)){Ce=!0;break}}if(!Ce){ue.className+=" prettyprinted";var Ue=te.lang;if(!Ue){Ue=ce.match(rt);var He;!Ue&&(He=ye(ue))&&mt.test(He.tagName)&&(Ue=He.className.match(rt)),Ue&&(Ue=Ue[1])}var Tt;if(xt.test(ue.tagName))Tt=1;else{var Xe=ue.currentStyle,st=Oe.defaultView,jt=Xe?Xe.whiteSpace:st&&st.getComputedStyle?st.getComputedStyle(ue,null).getPropertyValue("white-space"):0;Tt=jt&&jt.substring(0,3)==="pre"}var ze=te.linenums;(ze=ze==="true"||+ze)||(ze=ce.match(/\blinenums\b(?::(\d+))?/),ze=ze?ze[1]&&ze[1].length?+ze[1]:!0:!1),ze&&me(ue,ze,Tt);var It={langExtension:Ue,sourceNode:ue,numberLines:ze,pre:Tt,sourceCode:null,basePos:null,spans:null,decorations:null};x(It)}}}yt<De.length?N.setTimeout(q,250):typeof de=="function"&&de()}q()}var J=N.PR={createSimpleLexer:xe,registerLangHandler:le,sourceDecorator:Te,PR_ATTRIB_NAME:M,PR_ATTRIB_VALUE:K,PR_COMMENT:y,PR_DECLARATION:m,PR_KEYWORD:u,PR_LITERAL:h,PR_NOCODE:z,PR_PLAIN:a,PR_PUNCTUATION:s,PR_SOURCE:b,PR_STRING:p,PR_TAG:g,PR_TYPE:d,prettyPrintOne:P?N.prettyPrintOne=R:O=R,prettyPrint:H=P?N.prettyPrint=W:H=W},B=N.define;typeof B=="function"&&B.amd&&B("google-code-prettify",[],function(){return J})})()},STEk:function(qe,Ke,V){"use strict";V.d(Ke,"a",function(){return le});/*! *****************************************************************************
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 fe=function(I,x){return(fe=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(R,W){R.__proto__=W}||function(R,W){for(var J in W)Object.prototype.hasOwnProperty.call(W,J)&&(R[J]=W[J])})(I,x)};function $(I,x){function R(){this.constructor=I}fe(I,x),I.prototype=x===null?Object.create(x):(R.prototype=x.prototype,new R)}function P(I,x,R,W){return new(R||(R=Promise))(function(J,B){function de(Oe){try{Re(W.next(Oe))}catch(ke){B(ke)}}function _e(Oe){try{Re(W.throw(Oe))}catch(ke){B(ke)}}function Re(Oe){var ke;Oe.done?J(Oe.value):(ke=Oe.value,ke instanceof R?ke:new R(function(Ie){Ie(ke)})).then(de,_e)}Re((W=W.apply(I,x||[])).next())})}function Y(I,x){var R,W,J,B,de={label:0,sent:function(){if(1&J[0])throw J[1];return J[1]},trys:[],ops:[]};return B={next:_e(0),throw:_e(1),return:_e(2)},typeof Symbol=="function"&&(B[Symbol.iterator]=function(){return this}),B;function _e(Re){return function(Oe){return function(ke){if(R)throw new TypeError("Generator is already executing.");for(;de;)try{if(R=1,W&&(J=2&ke[0]?W.return:ke[0]?W.throw||((J=W.return)&&J.call(W),0):W.next)&&!(J=J.call(W,ke[1])).done)return J;switch(W=0,J&&(ke=[2&ke[0],J.value]),ke[0]){case 0:case 1:J=ke;break;case 4:return de.label++,{value:ke[1],done:!1};case 5:de.label++,W=ke[1],ke=[0];continue;case 7:ke=de.ops.pop(),de.trys.pop();continue;default:if(!(J=de.trys,(J=J.length>0&&J[J.length-1])||ke[0]!==6&&ke[0]!==2)){de=0;continue}if(ke[0]===3&&(!J||ke[1]>J[0]&&ke[1]<J[3])){de.label=ke[1];break}if(ke[0]===6&&de.label<J[1]){de.label=J[1],J=ke;break}if(J&&de.label<J[2]){de.label=J[2],de.ops.push(ke);break}J[2]&&de.ops.pop(),de.trys.pop();continue}ke=x.call(I,de)}catch(Ie){ke=[6,Ie],W=0}finally{R=J=0}if(5&ke[0])throw ke[1];return{value:ke[0]?ke[1]:void 0,done:!0}}([Re,Oe])}}}function U(){for(var I=0,x=0,R=arguments.length;x<R;x++)I+=arguments[x].length;var W=Array(I),J=0;for(x=0;x<R;x++)for(var B=arguments[x],de=0,_e=B.length;de<_e;de++,J++)W[J]=B[de];return W}var O=function(){function I(){}return I.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},I.setAttributes=function(x,R){for(var W=0,J=R;W<J.length;W++){var B=J[W],de=B[0],_e=B[1];x.setAttribute(de,_e)}},I.createRect=function(x,R,W){var J=document.createElementNS("http://www.w3.org/2000/svg","rect");return J.setAttribute("width",x.toString()),J.setAttribute("height",R.toString()),W&&I.setAttributes(J,W),J},I.createLine=function(x,R,W,J,B){var de=document.createElementNS("http://www.w3.org/2000/svg","line");return de.setAttribute("x1",x.toString()),de.setAttribute("y1",R.toString()),de.setAttribute("x2",W.toString()),de.setAttribute("y2",J.toString()),B&&I.setAttributes(de,B),de},I.createPolygon=function(x,R){var W=document.createElementNS("http://www.w3.org/2000/svg","polygon");return W.setAttribute("points",x),R&&I.setAttributes(W,R),W},I.createCircle=function(x,R){var W=document.createElementNS("http://www.w3.org/2000/svg","circle");return W.setAttribute("cx",(x/2).toString()),W.setAttribute("cy",(x/2).toString()),W.setAttribute("r",x.toString()),R&&I.setAttributes(W,R),W},I.createEllipse=function(x,R,W){var J=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return J.setAttribute("cx",(x/2).toString()),J.setAttribute("cy",(R/2).toString()),J.setAttribute("rx",(x/2).toString()),J.setAttribute("ry",(R/2).toString()),W&&I.setAttributes(J,W),J},I.createGroup=function(x){var R=document.createElementNS("http://www.w3.org/2000/svg","g");return x&&I.setAttributes(R,x),R},I.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},I.createMarker=function(x,R,W,J,B,de,_e){var Re=document.createElementNS("http://www.w3.org/2000/svg","marker");return I.setAttributes(Re,[["id",x],["orient",R],["markerWidth",W.toString()],["markerHeight",J.toString()],["refX",B.toString()],["refY",de.toString()]]),Re.appendChild(_e),Re},I.createText=function(x){var R=document.createElementNS("http://www.w3.org/2000/svg","text");return R.setAttribute("x","0"),R.setAttribute("y","0"),x&&I.setAttributes(R,x),R},I.createTSpan=function(x,R){var W=document.createElementNS("http://www.w3.org/2000/svg","tspan");return W.textContent=x,R&&I.setAttributes(W,R),W},I.createImage=function(x){var R=document.createElementNS("http://www.w3.org/2000/svg","image");return x&&I.setAttributes(R,x),R},I.createPoint=function(x,R){var W=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return W.x=x,W.y=R,W},I.createPath=function(x,R){var W=document.createElementNS("http://www.w3.org/2000/svg","path");return W.setAttribute("d",x),R&&I.setAttributes(W,R),W},I}(),H=function(){function I(){}return I.addKey=function(x){I.key=x},Object.defineProperty(I,"isLicensed",{get:function(){return!!I.key&&new RegExp(/^MJS2-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(I.key)},enumerable:!1,configurable:!0}),I}(),N=function(){function I(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return I.prototype.rasterize=function(x,R,W){var J=this;return new Promise(function(B){var de=W!==void 0?W:document.createElement("canvas");x===null&&(J.markersOnly=!0,J.naturalSize=!1);var _e=document.createElementNS("http://www.w3.org/2000/svg","svg");_e.setAttribute("xmlns","http://www.w3.org/2000/svg"),_e.setAttribute("width",R.width.baseVal.valueAsString),_e.setAttribute("height",R.height.baseVal.valueAsString),_e.setAttribute("viewBox","0 0 "+R.viewBox.baseVal.width.toString()+" "+R.viewBox.baseVal.height.toString()),_e.innerHTML=R.innerHTML,J.naturalSize===!0?(_e.width.baseVal.value=x.naturalWidth,_e.height.baseVal.value=x.naturalHeight):J.width!==void 0&&J.height!==void 0&&(_e.width.baseVal.value=J.width,_e.height.baseVal.value=J.height),de.width=_e.width.baseVal.value,de.height=_e.height.baseVal.value;var Re=_e.outerHTML,Oe=de.getContext("2d");J.markersOnly!==!0&&Oe.drawImage(x,0,0,de.width,de.height);var ke=window.URL,Ie=new Image(de.width,de.height);Ie.setAttribute("crossOrigin","anonymous");var De=new Blob([Re],{type:"image/svg+xml"}),Ve=ke.createObjectURL(De);Ie.onload=function(){Oe.drawImage(Ie,0,0),ke.revokeObjectURL(Ve);var Qe=de.toDataURL(J.imageType,J.imageQuality);B(Qe)},Ie.src=Ve})},I}(),k=function(){},L=function(){function I(x){this._classNamePrefixBase="__markerjs2_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+x+"_"}return Object.defineProperty(I.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"defaultSettings",{get:function(){return{canvasBackgroundColor:"#ffffff",toolbarBackgroundColor:"#111111",toolbarBackgroundHoverColor:"#333333",toolbarColor:"#eeeeee",toolbarHeight:40,toolboxColor:"#eeeeee",toolboxAccentColor:"#3080c3",undoButtonVisible:!0,redoButtonVisible:!1,zoomButtonVisible:!1,zoomOutButtonVisible:!1,clearButtonVisible:!1,resultButtonBlockVisible:!0,logoPosition:"left"}},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"fade_out"},enumerable:!1,configurable:!0}),I.prototype.addClass=function(x){return this.styleSheet===void 0&&this.addStyleSheet(),x.name=""+this.classNamePrefix+x.localName,this.classes.push(x),this.styleSheet.sheet.insertRule("."+x.name+" {"+x.style+"}",this.styleSheet.sheet.cssRules.length),x},I.prototype.addRule=function(x){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(x),this.styleSheet.sheet.insertRule(x.selector+" {"+x.style+"}",this.styleSheet.sheet.cssRules.length)},I.prototype.addStyleSheet=function(){var x;this.styleSheet=document.createElement("style"),((x=this.styleSheetRoot)!==null&&x!==void 0?x:document.head).appendChild(this.styleSheet),this.addRule(new _("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new _("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
from {
opacity: 0;
}
to {
opacity: 1;
}
`)),this.addRule(new _("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
from {
opacity: 1;
}
to {
opacity: 0;
}
`)),this.addClass(new w("fade_in",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
`)),this.addClass(new w("fade_out",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
`))},I.prototype.removeStyleSheet=function(){var x;this.styleSheet&&(((x=this.styleSheetRoot)!==null&&x!==void 0?x:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},I}(),_=function(I,x){this.selector=I,this.style=x},w=function(I,x){this.localName=I,this.style=x},D=function(){function I(x,R,W,J,B){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=x,this.displayMode=R,this.markerItems=W,this.uiStyleSettings=J,this.styles=B,this.addStyles(),this.adjustLayout=this.adjustLayout.bind(this),this.overflowButtonClicked=this.overflowButtonClicked.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this)}return I.prototype.show=function(x){var R=this;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=x,this.uiContainer.className=this.toolbarStyleClass.name+" "+this.styles.fadeInAnimationClassName+" "+(this.uiStyleSettings.toolbarStyleColorsClassName?this.uiStyleSettings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name);var W=document.createElement("div");W.className=this.toolbarBlockStyleClass.name,W.style.whiteSpace="nowrap",this.uiContainer.appendChild(W),this.addActionButton(W,'<svg viewBox="0 0 24 24"><path d="M10.07 14.27a.997.997 0 011.33.48l2.3 4.99 1.8-.85-2.31-4.98c-.24-.5-.02-1.1.48-1.33l.28-.08 2.3-.45L8 5.12V15.9l1.82-1.47.25-.16m3.57 7.7a.99.99 0 01-1.33-.47l-2.18-4.74-2.51 2.02c-.17.14-.38.22-.62.22a1 1 0 01-1-1V3a1 1 0 011-1c.24 0 .47.09.64.23l.01-.01 11.49 9.64a1.001 1.001 0 01-.44 1.75l-3.16.62 2.2 4.73c.26.5.02 1.09-.48 1.32l-3.62 1.69z"/></svg>',"select"),this.addActionButton(W,'<svg viewBox="0 0 24 24"><path d="M9 3v1H4v2h1v13a2 2 0 002 2h10a2 2 0 002-2V6h1V4h-5V3H9M7 6h10v13H7V6m2 2v9h2V8H9m4 0v9h2V8h-2z"/></svg>',"delete"),this.uiStyleSettings.clearButtonVisible&&this.addActionButton(W,'<svg viewBox="0 0 24 24"><path d="M19.36 2.72l1.42 1.42-5.72 5.71c1.07 1.54 1.22 3.39.32 4.59L9.06 8.12c1.2-.9 3.05-.75 4.59.32l5.71-5.72M5.93 17.57c-2.01-2.01-3.24-4.41-3.58-6.65l4.88-2.09 7.44 7.44-2.09 4.88c-2.24-.34-4.64-1.57-6.65-3.58z"/></svg>',"clear"),this.uiStyleSettings.undoButtonVisible&&this.addActionButton(W,'<svg viewBox="0 0 24 24"><path d="M12.5 8c-2.65 0-5.05 1-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8z"/></svg>',"undo"),this.uiStyleSettings.redoButtonVisible&&this.addActionButton(W,'<svg viewBox="0 0 24 24"><path d="M18.4 10.6C16.55 9 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22L3.9 16a8.002 8.002 0 017.6-5.5c1.95 0 3.73.72 5.12 1.88L13 16h9V7l-3.6 3.6z"/></svg>',"redo"),this.uiStyleSettings.zoomButtonVisible&&this.addActionButton(W,'<svg viewBox="0 0 24 24"><path d="M15.5 14l5 5-1.5 1.5-5-5v-.79l-.27-.28A6.471 6.471 0 019.5 16 6.5 6.5 0 013 9.5 6.5 6.5 0 019.5 3 6.5 6.5 0 0116 9.5c0 1.61-.59 3.09-1.57 4.23l.28.27h.79m-6 0C12 14 14 12 14 9.5S12 5 9.5 5 5 7 5 9.5 7 14 9.5 14m2.5-4h-2v2H9v-2H7V9h2V7h1v2h2v1z"/></svg>',"zoom"),this.uiStyleSettings.zoomButtonVisible&&this.uiStyleSettings.zoomOutButtonVisible&&this.addActionButton(W,'<svg viewBox="0 0 24 24"><path d="M15.5 14h-.79l-.28-.27A6.471 6.471 0 0016 9.5 6.5 6.5 0 009.5 3 6.5 6.5 0 003 9.5 6.5 6.5 0 009.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 5 1.5-1.5-5-5m-6 0C7 14 5 12 5 9.5S7 5 9.5 5 14 7 14 9.5 12 14 9.5 14M7 9h5v1H7V9z"/></svg>',"zoom-out"),this.uiStyleSettings.notesButtonVisible&&this.addActionButton(W,'<svg viewBox="0 0 24 24"><path d="M18.13 12l1.26-1.26c.44-.44 1-.68 1.61-.74V9l-6-6H5c-1.11 0-2 .89-2 2v14a2 2 0 002 2h6v-1.87l.13-.13H5V5h7v7h6.13M14 4.5l5.5 5.5H14V4.5m5.13 9.33l2.04 2.04L15.04 22H13v-2.04l6.13-6.13m3.72.36l-.98.98-2.04-2.04.98-.98c.19-.2.52-.2.72 0l1.32 1.32c.2.2.2.53 0 .72z"/></svg>',"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(B){var de=document.createElement("div");de.className=""+R.toolbarButtonStyleClass.name,de.setAttribute("data-type-name",B.typeName),de.innerHTML=B.icon,de.addEventListener("click",function(){R.markerToolbarButtonClicked(de,B)}),R.buttons.push(de),R.markerButtons.push(de)}),this.overflowButton=document.createElement("div"),this.overflowButton.className=this.toolbarButtonStyleClass.name+" "+(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name),this.overflowButton.innerHTML='<svg viewBox="0 0 24 24"><path d="M12 16a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2m0-6a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2m0-6a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2z"/></svg>',this.overflowButton.addEventListener("click",this.overflowButtonClicked),this.markerButtonBlock.appendChild(this.overflowButton));var J=document.createElement("div");J.className=this.toolbarBlockStyleClass.name,J.style.whiteSpace="nowrap",J.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(J),this.addActionButton(J,'<svg viewBox="0 0 24 24"><path d="M9 20.42l-6.21-6.21 2.83-2.83L9 14.77l9.88-9.89 2.83 2.83L9 20.42z"/></svg>',"render"),this.addActionButton(J,'<svg viewBox="0 0 24 24"><path d="M20 6.91L17.09 4 12 9.09 6.91 4 4 6.91 9.09 12 4 17.09 6.91 20 12 14.91 17.09 20 20 17.09 14.91 12 20 6.91z"/></svg>',"close"),this.markerjsContainer.appendChild(this.uiContainer),this.setSelectMode(),this.setCurrentMarker(),this.adjustLayout()},I.prototype.addButtonClickListener=function(x){this.buttonClickListeners.push(x)},I.prototype.removeButtonClickListener=function(x){this.buttonClickListeners.indexOf(x)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(x),1)},I.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},I.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var x=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var R=0;R<this.markerButtons.length;R++)R<x||R===x&&this.markerButtons.length-1===x?this.markerButtonBlock.appendChild(this.markerButtons[R]):(R===x&&this.markerButtonBlock.appendChild(this.overflowButton),this.markerButtonOverflowBlock.appendChild(this.markerButtons[R]))}},I.prototype.overflowButtonClicked=function(){this.markerButtonOverflowBlock.style.display!=="none"?(this.markerButtonOverflowBlock.className=this.markerButtonOverflowBlock.className.replace(this.styles.fadeInAnimationClassName,""),this.markerButtonOverflowBlock.style.display="none"):(this.markerButtonOverflowBlock.className+=" "+this.styles.fadeInAnimationClassName,this.markerButtonOverflowBlock.style.top=this.uiContainer.offsetTop+this.overflowButton.offsetHeight+"px",this.markerButtonOverflowBlock.style.right=this.uiContainer.offsetWidth-this.overflowButton.offsetLeft-this.overflowButton.offsetWidth+2*this.uiContainer.offsetLeft+"px",this.markerButtonOverflowBlock.style.display="inline-block")},I.prototype.resetButtonStyles=function(){var x=this;this.buttons.forEach(function(R){R.className=R.className.replace(x.uiStyleSettings.toolbarButtonStyleColorsClassName?x.uiStyleSettings.toolbarButtonStyleColorsClassName:x.toolbarButtonStyleColorsClass.name,"").trim(),R.className=R.className.replace(x.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?x.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:x.toolbarActiveButtonStyleColorsClass.name,"").trim(),R.className+=" "+(x.uiStyleSettings.toolbarButtonStyleColorsClassName?x.uiStyleSettings.toolbarButtonStyleColorsClassName:x.toolbarButtonStyleColorsClass.name)})},I.prototype.addActionButton=function(x,R,W){var J=this,B=document.createElement("div");switch(B.className=""+this.toolbarButtonStyleClass.name,B.innerHTML=R,B.setAttribute("data-action",W),B.addEventListener("click",function(){J.actionToolbarButtonClicked(B,W)}),W){case"select":B.style.fill=this.uiStyleSettings.selectButtonColor;break;case"delete":case"clear":B.style.fill=this.uiStyleSettings.deleteButtonColor;break;case"undo":case"redo":B.style.fill=this.uiStyleSettings.selectButtonColor;break;case"render":B.style.fill=this.uiStyleSettings.okButtonColor;break;case"close":B.style.fill=this.uiStyleSettings.closeButtonColor}x.appendChild(B),this.buttons.push(B)},I.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new w("toolbar",`
width: 100%;
flex-shrink: 0;
display: flex;
flex-direction: row;
justify-content: space-between;
height: `+this.uiStyleSettings.toolbarHeight+`px;
box-sizing: content-box;
`+(this.displayMode==="inline"?"border-top-left-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
`+(this.displayMode==="inline"?"border-top-right-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
overflow: hidden;
`)),this.toolbarStyleColorsClass=this.styles.addClass(new w("toolbar_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
box-shadow: 0px 3px rgba(33, 33, 33, 0.1);
`)),this.toolbarBlockStyleClass=this.styles.addClass(new w("toolbar-block",`
display: inline-block;
box-sizing: content-box;
`)),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new w("toolbar-overflow-block",`
position: absolute;
top: `+this.uiStyleSettings.toolbarHeight+`px;
max-width: `+2*this.uiStyleSettings.toolbarHeight+`px;
z-index: 10;
box-sizing: content-box;
`)),this.toolbarOverflowBlockStyleColorsClass=this.styles.addClass(new w("toolbar-overflow-block_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`));var x=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new w("toolbar_button",`
display: inline-block;
width: `+(this.uiStyleSettings.toolbarHeight-2*x)+`px;
height: `+(this.uiStyleSettings.toolbarHeight-2*x)+`px;
padding: `+x+`px;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new w("toolbar_button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new w("toolbar_active_button",`
fill: `+this.uiStyleSettings.toolbarColor+`;
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`)),this.styles.addRule(new _("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`)),this.styles.addRule(new _("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`))},I.prototype.markerToolbarButtonClicked=function(x,R){this.setActiveButton(x),this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(W){return W("marker",R)}),this.markerButtonOverflowBlock.style.display="none"},I.prototype.actionToolbarButtonClicked=function(x,R){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(W){return W("action",R)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},I.prototype.setActiveButton=function(x){this.resetButtonStyles(),x.className=x.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),x.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},I.prototype.setActiveMarkerButton=function(x){var R=this.markerButtons.find(function(W){return W.getAttribute("data-type-name")===x});R&&this.setActiveButton(R)},I.prototype.setCurrentMarker=function(x){var R=this;this.currentMarker=x,this.buttons.filter(function(W){return/delete|notes/.test(W.getAttribute("data-action"))}).forEach(function(W){R.currentMarker===void 0?(W.style.fillOpacity="0.4",W.style.pointerEvents="none"):(W.style.fillOpacity="1",W.style.pointerEvents="all")})},I}(),T=function(){function I(x,R,W,J){this.panels=[],this.panelButtons=[],this.markerjsContainer=x,this.displayMode=R,this.uiStyleSettings=W,this.styles=J,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return I.prototype.addStyles=function(){var x;this.toolboxStyleClass=this.styles.addClass(new w("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 w("toolbox_colors",`
color: `+this.uiStyleSettings.toolboxColor+`;
`));var R=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new w("toolbox-button-row",`
display: flex;
cursor: default;
box-sizing: content-box;
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new w("toolbox-button-row_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new w("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 w("toolbox-panel-row_colors",`
background-color: `+((x=this.uiStyleSettings.toolboxBackgroundColor)!==null&&x!==void 0?x:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
`)),this.toolboxButtonStyleClass=this.styles.addClass(new w("toolbox_button",`
display: inline-block;
width: `+(this.uiStyleSettings.toolbarHeight-2*R)+`px;
height: `+(this.uiStyleSettings.toolbarHeight-2*R)+`px;
padding: `+R+`px;
box-sizing: content-box;
`)),this.toolboxButtonStyleColorsClass=this.styles.addClass(new w("toolbox-button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new w("toolbox-active-button_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`;
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.styles.addRule(new _("."+this.toolboxButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`)),this.styles.addRule(new _("."+this.toolboxButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`))},I.prototype.show=function(x){var R;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=x,this.uiContainer.className=this.toolboxStyleClass.name+" "+((R=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&R!==void 0?R:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},I.prototype.setPanelButtons=function(x){var R,W,J=this;this.panels=x,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((R=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&R!==void 0?R:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+((W=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&W!==void 0?W:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(B){var de;B.uiStyleSettings=J.uiStyleSettings;var _e=document.createElement("div");_e.className=J.toolboxButtonStyleClass.name+" "+((de=J.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&de!==void 0?de:J.toolboxButtonStyleColorsClass.name),_e.innerHTML=B.icon,_e.title=B.title,_e.addEventListener("click",function(){J.panelButtonClick(B)}),J.panelButtons.push(_e),J.buttonRow.appendChild(_e)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},I.prototype.panelButtonClick=function(x){var R=this,W=-1;if(x!==this.activePanel){W=this.panels.indexOf(x),this.panelRow.innerHTML="";var J=x.getUi();J.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(J),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=x}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){R.displayMode==="inline"?R.panelRow.style.display="none":R.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(B,de){var _e,Re;B.className=R.toolboxButtonStyleClass.name+" "+(de===W?""+((_e=R.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&_e!==void 0?_e:R.toolboxActiveButtonStyleColorsClass.name):""+((Re=R.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&Re!==void 0?Re:R.toolboxButtonStyleColorsClass.name))})},I}(),C=function(I,x){this.title=I,this.icon=x},S=function(I){function x(R,W,J,B){var de=I.call(this,R,B||'<svg viewBox="0 0 24 24"><path d="M17.5 12a1.5 1.5 0 01-1.5-1.5A1.5 1.5 0 0117.5 9a1.5 1.5 0 011.5 1.5 1.5 1.5 0 01-1.5 1.5m-3-4A1.5 1.5 0 0113 6.5 1.5 1.5 0 0114.5 5 1.5 1.5 0 0116 6.5 1.5 1.5 0 0114.5 8m-5 0A1.5 1.5 0 018 6.5 1.5 1.5 0 019.5 5 1.5 1.5 0 0111 6.5 1.5 1.5 0 019.5 8m-3 4A1.5 1.5 0 015 10.5 1.5 1.5 0 016.5 9 1.5 1.5 0 018 10.5 1.5 1.5 0 016.5 12M12 3a9 9 0 00-9 9 9 9 0 009 9 1.5 1.5 0 001.5-1.5c0-.39-.15-.74-.39-1-.23-.27-.38-.62-.38-1a1.5 1.5 0 011.5-1.5H16a5 5 0 005-5c0-4.42-4.03-8-9-8z"/></svg>')||this;return de.colors=[],de.addTransparent=!1,de.colorBoxes=[],de.colors=W,de.currentColor=J,de.setCurrentColor=de.setCurrentColor.bind(de),de.getColorBox=de.getColorBox.bind(de),de}return $(x,I),x.prototype.getUi=function(){var R=this,W=document.createElement("div");return W.style.overflow="hidden",W.style.whiteSpace="nowrap",this.colors.forEach(function(J){var B=R.getColorBox(J);W.appendChild(B),R.colorBoxes.push(B)}),W},x.prototype.getColorBox=function(R){var W=this,J=this.uiStyleSettings.toolbarHeight/4,B=this.uiStyleSettings.toolbarHeight-J,de=document.createElement("div");de.style.display="inline-block",de.style.boxSizing="content-box",de.style.width=B-2+"px",de.style.height=B-2+"px",de.style.padding="1px",de.style.marginRight="2px",de.style.marginBottom="2px",de.style.borderWidth="2px",de.style.borderStyle="solid",de.style.borderRadius=(B+2)/2+"px",de.style.borderColor=R===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",de.addEventListener("click",function(){W.setCurrentColor(R,de)});var _e=document.createElement("div");return _e.style.display="inline-block",_e.style.width=B-2+"px",_e.style.height=B-2+"px",_e.style.backgroundColor=R,_e.style.borderRadius=B/2+"px",R==="transparent"&&(_e.style.fill=this.uiStyleSettings.toolboxAccentColor,_e.innerHTML=`<svg viewBox="0 0 24 24">
<path d="M2,5.27L3.28,4L20,20.72L18.73,22L15.65,18.92C14.5,19.3 13.28,19.5 12,19.5C7,19.5 2.73,16.39 1,12C1.69,10.24 2.79,8.69 4.19,7.46L2,5.27M12,9A3,3 0 0,1 15,12C15,12.35 14.94,12.69 14.83,13L11,9.17C11.31,9.06 11.65,9 12,9M12,4.5C17,4.5 21.27,7.61 23,12C22.18,14.08 20.79,15.88 19,17.19L17.58,15.76C18.94,14.82 20.06,13.54 20.82,12C19.17,8.64 15.76,6.5 12,6.5C10.91,6.5 9.84,6.68 8.84,7L7.3,5.47C8.74,4.85 10.33,4.5 12,4.5M3.18,12C4.83,15.36 8.24,17.5 12,17.5C12.69,17.5 13.37,17.43 14,17.29L11.72,15C10.29,14.85 9.15,13.71 9,12.28L5.6,8.87C4.61,9.72 3.78,10.78 3.18,12Z" />
</svg>`),de.appendChild(_e),de},x.prototype.setCurrentColor=function(R,W){var J=this;this.currentColor=R,this.colorBoxes.forEach(function(B){B.style.borderColor=B===W?J.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(R)},x}(C),f=function(){function I(x,R,W){this._state="new",this._isSelected=!1,this._container=x,this._overlayContainer=R,this.globalSettings=W,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(I.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),I.prototype.ownsTarget=function(x){return!1},Object.defineProperty(I.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),I.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},I.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},I.prototype.pointerDown=function(x,R){},I.prototype.dblClick=function(x,R){},I.prototype.manipulate=function(x){},I.prototype.pointerUp=function(x){this.stateChanged()},I.prototype.dispose=function(){},I.prototype.addMarkerVisualToContainer=function(x){this.container.childNodes.length>0?this.container.insertBefore(x,this.container.childNodes[0]):this.container.appendChild(x)},I.prototype.getState=function(){return{typeName:I.typeName,state:this.state,notes:this.notes}},I.prototype.restoreState=function(x){this._state=x.state,this.notes=x.notes},I.prototype.scale=function(x,R){},I.prototype.colorChanged=function(x){this.onColorChanged&&this.onColorChanged(x),this.stateChanged()},I.prototype.fillColorChanged=function(x){this.onFillColorChanged&&this.onFillColorChanged(x),this.stateChanged()},I.prototype.stateChanged=function(){if(this.onStateChanged&&this.state!=="creating"&&this.state!=="new"){var x=this.getState();this.manipulationStartState!==void 0&&(this.manipulationStartState.state="select"),x.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(x)&&this.onStateChanged(this)}},I.typeName="MarkerBase",I}(),l=function(){function I(){this.findGripByVisual=this.findGripByVisual.bind(this)}return I.prototype.findGripByVisual=function(x){return this.topLeft.ownsTarget(x)?this.topLeft:this.topCenter.ownsTarget(x)?this.topCenter:this.topRight.ownsTarget(x)?this.topRight:this.centerLeft.ownsTarget(x)?this.centerLeft:this.centerRight.ownsTarget(x)?this.centerRight:this.bottomLeft.ownsTarget(x)?this.bottomLeft:this.bottomCenter.ownsTarget(x)?this.bottomCenter:this.bottomRight.ownsTarget(x)?this.bottomRight:void 0},I}(),i=function(){function I(){this.GRIP_SIZE=10,this.visual=O.createGroup(),this.visual.appendChild(O.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(O.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return I.prototype.ownsTarget=function(x){return x===this.visual||x===this.visual.childNodes[0]||x===this.visual.childNodes[1]},I}(),c=function(){function I(){}return I.toITransformMatrix=function(x){return{a:x.a,b:x.b,c:x.c,d:x.d,e:x.e,f:x.f}},I.toSVGMatrix=function(x,R){return x.a=R.a,x.b=R.b,x.c=R.c,x.d=R.d,x.e=R.e,x.f=R.f,x},I}(),E=function(I){function x(R,W,J){var B=I.call(this,R,W,J)||this;return B.left=0,B.top=0,B.width=0,B.height=0,B.defaultSize={x:50,y:20},B.offsetX=0,B.offsetY=0,B.rotationAngle=0,B.CB_DISTANCE=10,B._suppressMarkerCreateEvent=!1,B.container.transform.baseVal.appendItem(O.createTransform()),B.setupControlBox(),B}return $(x,I),Object.defineProperty(x.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"visual",{get:function(){return this._visual},set:function(R){this._visual=R;var W=O.createTransform();this._visual.transform.baseVal.appendItem(W)},enumerable:!1,configurable:!0}),x.prototype.ownsTarget=function(R){return!!I.prototype.ownsTarget.call(this,R)||!!(this.controlGrips.findGripByVisual(R)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(R))},x.prototype.pointerDown=function(R,W){I.prototype.pointerDown.call(this,R,W),this.state==="new"&&(this.left=R.x,this.top=R.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var J=this.unrotatePoint(R);if(this.manipulationStartX=J.x,this.manipulationStartY=J.y,this.offsetX=J.x-this.left,this.offsetY=J.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(W),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(W)){this.activeGrip=this.rotatorGrip;var B=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=B.x-this.width/2,this.top=B.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var de=this.container.transform.baseVal.getItem(0);de.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(de,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},x.prototype.pointerUp=function(R){var W=this.state;I.prototype.pointerUp.call(this,R),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(R),this._state="select",W==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},x.prototype.moveVisual=function(R){this.visual.style.transform="translate("+R.x+"px, "+R.y+"px)"},x.prototype.manipulate=function(R){var W=this.unrotatePoint(R);this.state==="creating"?this.resize(R):this.state==="move"?(this.left=this.manipulationStartLeft+(W.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(W.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(W):this.state==="rotate"&&this.rotate(R)},x.prototype.resize=function(R){var W=this.manipulationStartLeft,J=this.manipulationStartWidth,B=this.manipulationStartTop,de=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:W=this.manipulationStartLeft+R.x-this.manipulationStartX,J=this.manipulationStartWidth+this.manipulationStartLeft-W;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:J=this.manipulationStartWidth+R.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:B=this.manipulationStartTop+R.y-this.manipulationStartY,de=this.manipulationStartHeight+this.manipulationStartTop-B;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:de=this.manipulationStartHeight+R.y-this.manipulationStartY}J>=0?(this.left=W,this.width=J):(this.left=W+J,this.width=-J),de>=0?(this.top=B,this.height=de):(this.top=B+de,this.height=-de),this.setSize()},x.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},x.prototype.rotate=function(R){if(Math.abs(R.x-this.centerX)>.1){var W=Math.sign(R.x-this.centerX);this.rotationAngle=180*Math.atan((R.y-this.centerY)/(R.x-this.centerX))/Math.PI+90*W,this.applyRotation()}},x.prototype.applyRotation=function(){var R=this.container.transform.baseVal.getItem(0);R.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(R,0)},x.prototype.rotatePoint=function(R){if(this.rotationAngle===0)return R;var W=this.container.getCTM(),J=O.createPoint(R.x,R.y);return{x:(J=J.matrixTransform(W)).x,y:J.y}},x.prototype.unrotatePoint=function(R){if(this.rotationAngle===0)return R;var W=this.container.getCTM();W=W.inverse();var J=O.createPoint(R.x,R.y);return{x:(J=J.matrixTransform(W)).x,y:J.y}},x.prototype.select=function(){I.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},x.prototype.deselect=function(){I.prototype.deselect.call(this),this.controlBox.style.display="none"},x.prototype.setupControlBox=function(){this.controlBox=O.createGroup();var R=O.createTransform();R.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(R),this.container.appendChild(this.controlBox),this.controlRect=O.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=O.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 l,this.addControlGrips(),this.controlBox.style.display="none"},x.prototype.adjustControlBox=function(){var R=this.controlBox.transform.baseVal.getItem(0);R.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(R,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()},x.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()},x.prototype.createGrip=function(){var R=new i;return R.visual.transform.baseVal.appendItem(O.createTransform()),this.controlBox.appendChild(R.visual),R},x.prototype.positionGrips=function(){var R=this.controlGrips.topLeft.GRIP_SIZE,W=-R/2,J=W,B=(this.width+this.CB_DISTANCE)/2-R/2,de=(this.height+this.CB_DISTANCE)/2-R/2,_e=this.height+this.CB_DISTANCE-R/2,Re=this.width+this.CB_DISTANCE-R/2;this.positionGrip(this.controlGrips.topLeft.visual,W,J),this.positionGrip(this.controlGrips.topCenter.visual,B,J),this.positionGrip(this.controlGrips.topRight.visual,Re,J),this.positionGrip(this.controlGrips.centerLeft.visual,W,de),this.positionGrip(this.controlGrips.centerRight.visual,Re,de),this.positionGrip(this.controlGrips.bottomLeft.visual,W,_e),this.positionGrip(this.controlGrips.bottomCenter.visual,B,_e),this.positionGrip(this.controlGrips.bottomRight.visual,Re,_e),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,B,J-3*this.CB_DISTANCE)},x.prototype.positionGrip=function(R,W,J){var B=R.transform.baseVal.getItem(0);B.setTranslate(W,J),R.transform.baseVal.replaceItem(B,0)},x.prototype.hideControlBox=function(){this.controlBox.style.display="none"},x.prototype.showControlBox=function(){this.controlBox.style.display=""},x.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:c.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:c.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},I.prototype.getState.call(this))},x.prototype.restoreState=function(R){I.prototype.restoreState.call(this,R);var W=R;this.left=W.left,this.top=W.top,this.width=W.width,this.height=W.height,this.rotationAngle=W.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(c.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,W.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(c.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,W.containerTransformMatrix))},x.prototype.scale=function(R,W){I.prototype.scale.call(this,R,W);var J=this.rotatePoint({x:this.left,y:this.top}),B=this.unrotatePoint({x:J.x*R,y:J.y*W});this.left=B.x,this.top=B.y,this.width=this.width*R,this.height=this.height*W,this.adjustControlBox()},x}(f),v=function(I){function x(R,W,J){var B=I.call(this,R,W,J)||this;return B.fillColor="transparent",B.strokeColor="transparent",B.strokeWidth=0,B.strokeDasharray="",B.opacity=1,B.setStrokeColor=B.setStrokeColor.bind(B),B.setFillColor=B.setFillColor.bind(B),B.setStrokeWidth=B.setStrokeWidth.bind(B),B.setStrokeDasharray=B.setStrokeDasharray.bind(B),B.createVisual=B.createVisual.bind(B),B}return $(x,I),x.prototype.ownsTarget=function(R){return!(!I.prototype.ownsTarget.call(this,R)&&R!==this.visual)},x.prototype.createVisual=function(){this.visual=O.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)},x.prototype.pointerDown=function(R,W){I.prototype.pointerDown.call(this,R,W),this.state==="new"&&(this.createVisual(),this.moveVisual(R),this._state="creating")},x.prototype.manipulate=function(R){I.prototype.manipulate.call(this,R)},x.prototype.resize=function(R){I.prototype.resize.call(this,R),this.setSize()},x.prototype.setSize=function(){I.prototype.setSize.call(this),O.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},x.prototype.pointerUp=function(R){I.prototype.pointerUp.call(this,R),this.setSize()},x.prototype.setStrokeColor=function(R){this.strokeColor=R,this.visual&&O.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(R),this.stateChanged()},x.prototype.setFillColor=function(R){this.fillColor=R,this.visual&&O.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},x.prototype.setStrokeWidth=function(R){this.strokeWidth=R,this.visual&&O.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},x.prototype.setStrokeDasharray=function(R){this.strokeDasharray=R,this.visual&&O.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},x.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},I.prototype.getState.call(this))},x.prototype.restoreState=function(R){var W=R;this.fillColor=W.fillColor,this.strokeColor=W.strokeColor,this.strokeWidth=W.strokeWidth,this.strokeDasharray=W.strokeDasharray,this.opacity=W.opacity,this.createVisual(),I.prototype.restoreState.call(this,R),this.setSize()},x.prototype.scale=function(R,W){I.prototype.scale.call(this,R,W),this.setSize()},x.title="Rectangle marker",x}(E),p=function(I){function x(R,W,J,B){var de=I.call(this,R,B||'<svg viewBox="0 0 24 24"><path d="M3 17h18v-2H3v2m0 3h18v-1H3v1m0-7h18v-3H3v3m0-9v4h18V4H3z"/></svg>')||this;return de.widths=[],de.widthBoxes=[],de.widths=W,de.currentWidth=J,de.setCurrentWidth=de.setCurrentWidth.bind(de),de}return $(x,I),x.prototype.getUi=function(){var R=this,W=document.createElement("div");return W.style.display="flex",W.style.overflow="hidden",W.style.flexGrow="2",this.widths.forEach(function(J){var B=document.createElement("div");B.style.display="flex",B.style.flexGrow="2",B.style.alignItems="center",B.style.justifyContent="space-between",B.style.padding="5px",B.style.borderWidth="2px",B.style.borderStyle="solid",B.style.borderColor=J===R.currentWidth?R.uiStyleSettings.toolboxAccentColor:"transparent",B.addEventListener("click",function(){R.setCurrentWidth(J,B)}),W.appendChild(B);var de=document.createElement("div");de.innerText=J.toString(),de.style.marginRight="5px",B.appendChild(de);var _e=document.createElement("div");_e.style.minHeight="20px",_e.style.flexGrow="2",_e.style.display="flex",_e.style.alignItems="center";var Re=document.createElement("hr");Re.style.minWidth="20px",Re.style.border="0px",Re.style.borderTop=J+"px solid "+R.uiStyleSettings.toolboxColor,Re.style.flexGrow="2",_e.appendChild(Re),B.appendChild(_e),R.widthBoxes.push(B)}),W},x.prototype.setCurrentWidth=function(R,W){var J=this;this.currentWidth=R,this.widthBoxes.forEach(function(B){B.style.borderColor=B===W?J.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},x}(C),u=function(I){function x(R,W,J,B){var de=I.call(this,R,B||'<svg viewBox="0 0 24 24"><path d="M3 16h5v-2H3v2m6.5 0h5v-2h-5v2m6.5 0h5v-2h-5v2M3 20h2v-2H3v2m4 0h2v-2H7v2m4 0h2v-2h-2v2m4 0h2v-2h-2v2m4 0h2v-2h-2v2M3 12h8v-2H3v2m10 0h8v-2h-8v2M3 4v4h18V4H3z"/></svg>')||this;return de.styles=[],de.styleBoxes=[],de.styles=W,de.currentStyle=J,de.setCurrentStyle=de.setCurrentStyle.bind(de),de}return $(x,I),x.prototype.getUi=function(){var R=this,W=document.createElement("div");return W.style.display="flex",W.style.overflow="hidden",W.style.flexGrow="2",this.styles.forEach(function(J){var B=document.createElement("div");B.style.display="flex",B.style.alignItems="center",B.style.justifyContent="space-between",B.style.padding="5px",B.style.borderWidth="2px",B.style.borderStyle="solid",B.style.overflow="hidden",B.style.maxWidth=100/R.styles.length-5+"%",B.style.borderColor=J===R.currentStyle?R.uiStyleSettings.toolboxAccentColor:"transparent",B.addEventListener("click",function(){R.setCurrentStyle(J,B)}),W.appendChild(B);var de=document.createElement("div");de.style.minHeight="20px",de.style.flexGrow="2",de.style.overflow="hidden";var _e=`<svg width="100" height="20">
<line x1="0" y1="10" x2="100" y2="10" stroke="`+R.uiStyleSettings.toolboxColor+'" stroke-width="3" '+(J!==""?'stroke-dasharray="'+J+'"':"")+` />
</svg>`;de.innerHTML=_e,B.appendChild(de),R.styleBoxes.push(B)}),W},x.prototype.setCurrentStyle=function(R,W){var J=this;this.currentStyle=R,this.styleBoxes.forEach(function(B){B.style.borderColor=B===W?J.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},x}(C),y=function(I){function x(R,W,J){var B=I.call(this,R,W,J)||this;return B.strokeColor=J.defaultColor,B.strokeWidth=J.defaultStrokeWidth,B.strokeDasharray=J.defaultStrokeDasharray,B.strokePanel=new S("Line color",J.defaultColorSet,J.defaultColor),B.strokePanel.onColorChanged=B.setStrokeColor,B.strokeWidthPanel=new p("Line width",J.defaultStrokeWidths,J.defaultStrokeWidth),B.strokeWidthPanel.onWidthChanged=B.setStrokeWidth,B.strokeStylePanel=new u("Line style",J.defaultStrokeDasharrays,J.defaultStrokeDasharray),B.strokeStylePanel.onStyleChanged=B.setStrokeDasharray,B}return $(x,I),Object.defineProperty(x.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),x.prototype.getState=function(){var R=I.prototype.getState.call(this);return R.typeName=x.typeName,R},x.typeName="FrameMarker",x.title="Frame marker",x.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>',x}(v),d=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},h=function(I){function x(R,W,J){var B=I.call(this,R,W,J)||this;return B.x1=0,B.y1=0,B.x2=0,B.y2=0,B.defaultLength=50,B.manipulationStartX=0,B.manipulationStartY=0,B.manipulationStartX1=0,B.manipulationStartY1=0,B.manipulationStartX2=0,B.manipulationStartY2=0,B.setupControlBox(),B}return $(x,I),x.prototype.ownsTarget=function(R){return!!I.prototype.ownsTarget.call(this,R)||!(!this.grip1.ownsTarget(R)&&!this.grip2.ownsTarget(R))},x.prototype.pointerDown=function(R,W){I.prototype.pointerDown.call(this,R,W),this.manipulationStartX=R.x,this.manipulationStartY=R.y,this.state==="new"&&(this.x1=R.x,this.y1=R.y,this.x2=R.x,this.y2=R.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(W)?this.activeGrip=this.grip1:this.grip2.ownsTarget(W)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},x.prototype.pointerUp=function(R){var W=this.state;I.prototype.pointerUp.call(this,R),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(R),this._state="select",W==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},x.prototype.adjustVisual=function(){},x.prototype.manipulate=function(R){this.state==="creating"?this.resize(R):this.state==="move"?(this.x1=this.manipulationStartX1+R.x-this.manipulationStartX,this.y1=this.manipulationStartY1+R.y-this.manipulationStartY,this.x2=this.manipulationStartX2+R.x-this.manipulationStartX,this.y2=this.manipulationStartY2+R.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(R)},x.prototype.resize=function(R){switch(this.activeGrip){case this.grip1:this.x1=R.x,this.y1=R.y;break;case this.grip2:case void 0:this.x2=R.x,this.y2=R.y}this.adjustVisual(),this.adjustControlBox()},x.prototype.select=function(){I.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},x.prototype.deselect=function(){I.prototype.deselect.call(this),this.controlBox.style.display="none"},x.prototype.setupControlBox=function(){this.controlBox=O.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},x.prototype.adjustControlBox=function(){this.positionGrips()},x.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},x.prototype.createGrip=function(){var R=new i;return R.visual.transform.baseVal.appendItem(O.createTransform()),this.controlBox.appendChild(R.visual),R},x.prototype.positionGrips=function(){var R=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-R/2,this.y1-R/2),this.positionGrip(this.grip2.visual,this.x2-R/2,this.y2-R/2)},x.prototype.positionGrip=function(R,W,J){var B=R.transform.baseVal.getItem(0);B.setTranslate(W,J),R.transform.baseVal.replaceItem(B,0)},x.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},I.prototype.getState.call(this))},x.prototype.restoreState=function(R){I.prototype.restoreState.call(this,R);var W=R;this.x1=W.x1,this.y1=W.y1,this.x2=W.x2,this.y2=W.y2},x.prototype.scale=function(R,W){I.prototype.scale.call(this,R,W),this.x1=this.x1*R,this.y1=this.y1*W,this.x2=this.x2*R,this.y2=this.y2*W,this.adjustVisual(),this.adjustControlBox()},x}(f),s=function(I){function x(R,W,J){var B=I.call(this,R,W,J)||this;return B.strokeColor="transparent",B.strokeWidth=0,B.strokeDasharray="",B.setStrokeColor=B.setStrokeColor.bind(B),B.setStrokeWidth=B.setStrokeWidth.bind(B),B.setStrokeDasharray=B.setStrokeDasharray.bind(B),B.strokeColor=J.defaultColor,B.strokeWidth=J.defaultStrokeWidth,B.strokeDasharray=J.defaultStrokeDasharray,B.strokePanel=new S("Line color",J.defaultColorSet,J.defaultColor),B.strokePanel.onColorChanged=B.setStrokeColor,B.strokeWidthPanel=new p("Line width",J.defaultStrokeWidths,J.defaultStrokeWidth),B.strokeWidthPanel.onWidthChanged=B.setStrokeWidth,B.strokeStylePanel=new u("Line style",J.defaultStrokeDasharrays,J.defaultStrokeDasharray),B.strokeStylePanel.onStyleChanged=B.setStrokeDasharray,B}return $(x,I),x.prototype.ownsTarget=function(R){return!(!I.prototype.ownsTarget.call(this,R)&&R!==this.visual&&R!==this.selectorLine&&R!==this.visibleLine)},x.prototype.createVisual=function(){this.visual=O.createGroup(),this.selectorLine=O.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=O.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)},x.prototype.pointerDown=function(R,W){I.prototype.pointerDown.call(this,R,W),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},x.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()),O.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),O.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),O.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},x.prototype.setStrokeColor=function(R){this.strokeColor=R,this.adjustVisual(),this.colorChanged(R)},x.prototype.setStrokeWidth=function(R){this.strokeWidth=R,this.adjustVisual()},x.prototype.setStrokeDasharray=function(R){this.strokeDasharray=R,this.adjustVisual(),this.stateChanged()},Object.defineProperty(x.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),x.prototype.getState=function(){var R=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},I.prototype.getState.call(this));return R.typeName=x.typeName,R},x.prototype.restoreState=function(R){I.prototype.restoreState.call(this,R);var W=R;this.strokeColor=W.strokeColor,this.strokeWidth=W.strokeWidth,this.strokeDasharray=W.strokeDasharray,this.createVisual(),this.adjustVisual()},x.typeName="LineMarker",x.title="Line marker",x.icon='<svg viewBox="0 0 24 24"><path d="M19 13H5v-2h14v2z"/></svg>',x}(h),a=function(I){function x(R,W,J,B){var de=I.call(this,R,B||'<svg viewBox="0 0 24 24"><path d="M17 8h3v12h1v1h-4v-1h1v-3h-4l-1.5 3H14v1h-4v-1h1l6-12m1 1l-3.5 7H18V9M5 3h5c1.11 0 2 .89 2 2v11H9v-5H6v5H3V5c0-1.11.89-2 2-2m1 2v4h3V5H6z"/></svg>')||this;return de.fonts=[],de.fontBoxes=[],de.fonts=W,de.currentFont=J,de.setCurrentFont=de.setCurrentFont.bind(de),de}return $(x,I),x.prototype.getUi=function(){var R=this,W=document.createElement("div");return W.style.overflow="hidden",W.style.flexGrow="2",this.fonts.forEach(function(J){var B=document.createElement("div");B.style.display="inline-block",B.style.alignItems="center",B.style.justifyContent="space-between",B.style.padding="5px",B.style.borderWidth="2px",B.style.borderStyle="solid",B.style.overflow="hidden",B.style.maxWidth=100/R.fonts.length-5+"%",B.style.borderColor=J===R.currentFont?R.uiStyleSettings.toolboxAccentColor:"transparent",B.addEventListener("click",function(){R.setCurrentFont(J,B)}),W.appendChild(B);var de=document.createElement("div");de.style.display="flex",de.style.minHeight="20px",de.style.flexGrow="2",de.style.fontFamily=J,de.style.overflow="hidden";var _e=document.createElement("div");_e.style.whiteSpace="nowrap",_e.style.overflow="hidden",_e.style.textOverflow="ellipsis",_e.innerHTML="The quick brown fox jumps over the lazy dog",de.appendChild(_e),B.appendChild(de),R.fontBoxes.push(B)}),W},x.prototype.setCurrentFont=function(R,W){var J=this;this.currentFont=R,this.fontBoxes.forEach(function(B){B.style.borderColor=B===W?J.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},x}(C),g=function(I){function x(R,W,J){var B=I.call(this,R,W,J)||this;return B.color="transparent",B.padding=5,B.DEFAULT_TEXT="your text here",B.text=B.DEFAULT_TEXT,B.isMoved=!1,B.color=J.defaultColor,B.fontFamily=J.defaultFontFamily,B.defaultSize={x:100,y:30},B.setColor=B.setColor.bind(B),B.setFont=B.setFont.bind(B),B.renderText=B.renderText.bind(B),B.sizeText=B.sizeText.bind(B),B.textEditDivClicked=B.textEditDivClicked.bind(B),B.showTextEditor=B.showTextEditor.bind(B),B.setSize=B.setSize.bind(B),B.positionTextEditor=B.positionTextEditor.bind(B),B.colorPanel=new S("Color",J.defaultColorSet,J.defaultColor),B.colorPanel.onColorChanged=B.setColor,B.fontFamilyPanel=new a("Font",J.defaultFontFamilies,J.defaultFontFamily),B.fontFamilyPanel.onFontChanged=B.setFont,B}return $(x,I),x.prototype.ownsTarget=function(R){if(I.prototype.ownsTarget.call(this,R)||R===this.visual||R===this.textElement||R===this.bgRectangle)return!0;var W=!1;return this.textElement.childNodes.forEach(function(J){J===R&&(W=!0)}),W},x.prototype.createVisual=function(){this.visual=O.createGroup(),this.bgRectangle=O.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=O.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(O.createTransform()),this.textElement.transform.baseVal.appendItem(O.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},x.prototype.pointerDown=function(R,W){I.prototype.pointerDown.call(this,R,W),this.isMoved=!1,this.pointerDownPoint=R,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(R),this._state="creating")},x.prototype.renderText=function(){var R=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(W){R.textElement.appendChild(O.createTSpan(W.trim()===""?" ":W.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},x.prototype.getTextScale=function(){var R=this.textElement.getBBox(),W=1;if(R.width>0&&R.height>0){var J=(1*this.width-this.width*this.padding*2/100)/R.width,B=(1*this.height-this.height*this.padding*2/100)/R.height;W=Math.min(J,B)}return W},x.prototype.getTextPosition=function(R){var W=this.textElement.getBBox(),J=0,B=0;return W.width>0&&W.height>0&&(J=(this.width-W.width*R)/2,B=this.height/2-W.height*R/2),{x:J,y:B}},x.prototype.sizeText=function(){var R=this.textElement.getBBox(),W=this.getTextScale(),J=this.getTextPosition(W);J.y-=R.y*W,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+J.x+"px, "+J.y+"px) scale("+W+", "+W+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(J.x,J.y),this.textElement.transform.baseVal.getItem(1).setScale(W,W))},x.prototype.manipulate=function(R){I.prototype.manipulate.call(this,R),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(R.x-this.pointerDownPoint.x)>5||Math.abs(R.y-this.pointerDownPoint.y)>5)},x.prototype.resize=function(R){I.prototype.resize.call(this,R),this.isMoved=!0,this.setSize(),this.sizeText()},x.prototype.setSize=function(){I.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(O.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),O.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},x.prototype.pointerUp=function(R){var W=this.state;W==="creating"&&(this._suppressMarkerCreateEvent=!0),I.prototype.pointerUp.call(this,R),this.setSize(),(W==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},x.prototype.showTextEditor=function(){var R=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(W){W.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var W=Number.parseFloat(R.textEditor.style.fontSize);R.textEditor.clientWidth>=Number.parseInt(R.textEditor.style.maxWidth)&&W>.9;)W-=.1,R.textEditor.style.fontSize=Math.max(W,.9)+"em"}),this.textEditor.addEventListener("keyup",function(W){W.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(W){if(W.clipboardData){var J=W.clipboardData.getData("text"),B=window.getSelection();if(!B.rangeCount)return!1;B.deleteFromDocument(),B.getRangeAt(0).insertNode(document.createTextNode(J)),W.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){R.textEditDivClicked(R.textEditor.innerText)}),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},x.prototype.positionTextEditor=function(){if(this.state==="edit")if(this.textEditor===void 0)this.showTextEditor();else{this.textElement.style.display="";var R=this.getTextScale(),W=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),J=this.textElement.getBBox(),B={x:J.width*R,y:J.height*R};W.x-=B.x/2,W.y-=B.y/2,this.textEditor.style.top=W.y+"px",this.textEditor.style.left=W.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-W.x+"px",this.textEditor.style.fontSize=Math.max(16*R,12)+"px",this.textElement.style.display="none"}},x.prototype.textEditDivClicked=function(R){this.text=R.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},x.prototype.select=function(){I.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},x.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),I.prototype.deselect.call(this)},x.prototype.dblClick=function(R,W){I.prototype.dblClick.call(this,R,W),this.showTextEditor()},x.prototype.setColor=function(R){this.textElement&&O.setAttributes(this.textElement,[["fill",R]]),this.color=R,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(R)},x.prototype.setFont=function(R){this.textElement&&O.setAttributes(this.textElement,[["font-family",R]]),this.fontFamily=R,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},x.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},x.prototype.showVisual=function(){this.state==="edit"&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(x.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),x.prototype.getState=function(){var R=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},I.prototype.getState.call(this));return R.typeName=x.typeName,R},x.prototype.restoreState=function(R){var W=R;this.color=W.color,this.fontFamily=W.fontFamily,this.padding=W.padding,this.text=W.text,this.createVisual(),I.prototype.restoreState.call(this,R),this.setSize()},x.prototype.scale=function(R,W){I.prototype.scale.call(this,R,W),this.setSize(),this.sizeText(),this.positionTextEditor()},x.typeName="TextMarker",x.title="Text marker",x.icon='<svg viewBox="0 0 24 24"><path d="M9.6 14L12 7.7l2.4 6.3M11 5L5.5 19h2.2l1.1-3H15l1.1 3h2.2L13 5h-2z"/></svg>',x}(E),m=function(I){function x(R,W,J){var B=I.call(this,R,W,J)||this;return B.color="transparent",B.lineWidth=3,B.drawing=!1,B.pixelRatio=1,B.color=J.defaultColor,B.lineWidth=J.defaultStrokeWidth,B.pixelRatio=J.freehandPixelRatio,B.setColor=B.setColor.bind(B),B.addCanvas=B.addCanvas.bind(B),B.finishCreation=B.finishCreation.bind(B),B.setLineWidth=B.setLineWidth.bind(B),B.colorPanel=new S("Color",J.defaultColorSet,J.defaultColor),B.colorPanel.onColorChanged=B.setColor,B.lineWidthPanel=new p("Line width",J.defaultStrokeWidths,J.defaultStrokeWidth),B.lineWidthPanel.onWidthChanged=B.setLineWidth,B}return $(x,I),x.prototype.ownsTarget=function(R){return!(!I.prototype.ownsTarget.call(this,R)&&R!==this.visual&&R!==this.drawingImage)},x.prototype.createVisual=function(){this.visual=O.createGroup(),this.drawingImage=O.createImage(),this.visual.appendChild(this.drawingImage);var R=O.createTransform();this.visual.transform.baseVal.appendItem(R),this.addMarkerVisualToContainer(this.visual)},x.prototype.pointerDown=function(R,W){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(R.x,R.y),this.drawing=!0):I.prototype.pointerDown.call(this,R,W)},x.prototype.manipulate=function(R){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(R.x,R.y),this.canvasContext.stroke()):I.prototype.manipulate.call(this,R)},x.prototype.resize=function(R){I.prototype.resize.call(this,R),O.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),O.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},x.prototype.pointerUp=function(R){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):I.prototype.pointerUp.call(this,R)},x.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)},x.prototype.select=function(){this.state==="creating"&&this.finishCreation(),I.prototype.select.call(this)},x.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),I.prototype.deselect.call(this)},x.prototype.finishCreation=function(){for(var R=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),W=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],J=W[0],B=W[1],de=W[2],_e=W[3],Re=!1,Oe=0;Oe<this.canvasElement.height;Oe++)for(var ke=0;ke<this.canvasElement.width;ke++)R.data[Oe*this.canvasElement.width*4+4*ke+3]>0&&(Re=!0,Oe<B&&(B=Oe),ke<J&&(J=ke),Oe>_e&&(_e=Oe),ke>de&&(de=ke));if(Re){this.left=J/this.pixelRatio,this.top=B/this.pixelRatio,this.width=(de-J)/this.pixelRatio,this.height=(_e-B)/this.pixelRatio;var Ie=document.createElement("canvas");Ie.width=de-J,Ie.height=_e-B,Ie.getContext("2d").putImageData(this.canvasContext.getImageData(J,B,de-J,_e-B),0,0),this.drawingImgUrl=Ie.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},x.prototype.setDrawingImage=function(){O.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),O.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},x.prototype.setColor=function(R){this.color=R,this.colorChanged(R)},x.prototype.setLineWidth=function(R){this.lineWidth=R},Object.defineProperty(x.prototype,"toolboxPanels",{get:function(){return this.state==="new"||this.state==="creating"?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),x.prototype.getState=function(){var R=Object.assign({drawingImgUrl:this.drawingImgUrl},I.prototype.getState.call(this));return R.typeName=x.typeName,R},x.prototype.restoreState=function(R){this.createVisual(),I.prototype.restoreState.call(this,R),this.drawingImgUrl=R.drawingImgUrl,this.setDrawingImage()},x.prototype.scale=function(R,W){I.prototype.scale.call(this,R,W),this.setDrawingImage()},x.typeName="FreehandMarker",x.title="Freehand marker",x.icon='<svg viewBox="0 0 24 24"><path d="M9.75 20.85c1.78-.7 1.39-2.63.49-3.85-.89-1.25-2.12-2.11-3.36-2.94A9.817 9.817 0 014.54 12c-.28-.33-.85-.94-.27-1.06.59-.12 1.61.46 2.13.68.91.38 1.81.82 2.65 1.34l1.01-1.7C8.5 10.23 6.5 9.32 4.64 9.05c-1.06-.16-2.18.06-2.54 1.21-.32.99.19 1.99.77 2.77 1.37 1.83 3.5 2.71 5.09 4.29.34.33.75.72.95 1.18.21.44.16.47-.31.47-1.24 0-2.79-.97-3.8-1.61l-1.01 1.7c1.53.94 4.09 2.41 5.96 1.79m11.09-15.6c.22-.22.22-.58 0-.79l-1.3-1.3a.562.562 0 00-.78 0l-1.02 1.02 2.08 2.08M11 10.92V13h2.08l6.15-6.15-2.08-2.08L11 10.92z"/></svg>',x}(E),b=function(I){function x(R,W,J){var B=I.call(this,R,J||'<svg viewBox="0 0 24 24"><path d="M8 14v4l-6-6 6-6v4h8V6l6 6-6 6v-4H8z"/></svg>')||this;return B.typeBoxes=[],B.currentType=W,B.setCurrentType=B.setCurrentType.bind(B),B}return $(x,I),x.prototype.getUi=function(){var R=this,W=document.createElement("div");W.style.display="flex",W.style.overflow="hidden",W.style.flexGrow="2";for(var J=function(_e){var Re="both";switch(_e){case 0:Re="both";break;case 1:Re="start";break;case 2:Re="end";break;case 3:Re="none"}var Oe=document.createElement("div");if(Oe.style.display="flex",Oe.style.flexGrow="2",Oe.style.alignItems="center",Oe.style.justifyContent="space-between",Oe.style.padding="5px",Oe.style.borderWidth="2px",Oe.style.borderStyle="solid",Oe.style.borderColor=Re===B.currentType?B.uiStyleSettings.toolboxAccentColor:"transparent",Oe.addEventListener("click",function(){R.setCurrentType(Re,Oe)}),W.appendChild(Oe),Re==="both"||Re==="start"){var ke=document.createElement("div");ke.style.display="flex",ke.style.alignItems="center",ke.style.minHeight="20px",ke.innerHTML=`<svg viewBox="0 0 10 10" width="10" height="10" xmlns="http://www.w3.org/2000/svg">
<polygon points="0,5 10,0 10,10" fill="`+(B.uiStyleSettings!==void 0?B.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
</svg>`,ke.style.marginLeft="5px",Oe.appendChild(ke)}var Ie=document.createElement("div");Ie.style.display="flex",Ie.style.alignItems="center",Ie.style.minHeight="20px",Ie.style.flexGrow="2";var De=document.createElement("hr");if(De.style.minWidth="20px",De.style.border="0px",De.style.borderTop="3px solid "+(B.uiStyleSettings!==void 0?B.uiStyleSettings.toolboxColor:"#eeeeee"),De.style.flexGrow="2",Ie.appendChild(De),Oe.appendChild(Ie),Re==="both"||Re==="end"){var Ve=document.createElement("div");Ve.style.display="flex",Ve.style.alignItems="center",Ve.style.minHeight="20px",Ve.innerHTML=`<svg viewBox="0 0 10 10" width="10" height="10" xmlns="http://www.w3.org/2000/svg">
<polygon points="0,0 10,5 0,10" fill="`+(B.uiStyleSettings!==void 0?B.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
</svg>`,Ve.style.marginRight="5px",Oe.appendChild(Ve)}B.typeBoxes.push(Oe)},B=this,de=0;de<4;de++)J(de);return W},x.prototype.setCurrentType=function(R,W){var J=this;this.currentType=R,this.typeBoxes.forEach(function(B){B.style.borderColor=B===W?J.uiStyleSettings!==void 0?J.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},x}(C),M=function(I){function x(R,W,J){var B=I.call(this,R,W,J)||this;return B.arrowType="end",B.arrowBaseHeight=10,B.arrowBaseWidth=10,B.getArrowPoints=B.getArrowPoints.bind(B),B.setArrowType=B.setArrowType.bind(B),B.arrowTypePanel=new b("Arrow type","end"),B.arrowTypePanel.onArrowTypeChanged=B.setArrowType,B}return $(x,I),x.prototype.ownsTarget=function(R){return!(!I.prototype.ownsTarget.call(this,R)&&R!==this.arrow1&&R!==this.arrow2)},x.prototype.getArrowPoints=function(R,W){var J=this.arrowBaseWidth+2*this.strokeWidth,B=this.arrowBaseHeight+2*this.strokeWidth;return R-J/2+","+(W+B/2)+" "+R+","+(W-B/2)+" "+(R+J/2)+","+(W+B/2)},x.prototype.createTips=function(){this.arrow1=O.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(O.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=O.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(O.createTransform()),this.visual.appendChild(this.arrow2)},x.prototype.pointerDown=function(R,W){I.prototype.pointerDown.call(this,R,W),this.state==="creating"&&this.createTips()},x.prototype.adjustVisual=function(){if(I.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",O.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),O.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]),Math.abs(this.x1-this.x2)>.1)){var R=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),W=this.arrow1.transform.baseVal.getItem(0);W.setRotate(R,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(W,0);var J=this.arrow2.transform.baseVal.getItem(0);J.setRotate(R+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(J,0)}},x.prototype.setArrowType=function(R){this.arrowType=R,this.adjustVisual(),this.stateChanged()},Object.defineProperty(x.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),x.prototype.getState=function(){var R=Object.assign({arrowType:this.arrowType},I.prototype.getState.call(this));return R.typeName=x.typeName,R},x.prototype.restoreState=function(R){I.prototype.restoreState.call(this,R);var W=R;this.arrowType=W.arrowType,this.createTips(),this.adjustVisual()},x.typeName="ArrowMarker",x.title="Arrow marker",x.icon='<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 7 15.59V9H5v10h10v-2H8.41L19 6.41z"/></svg>',x}(s),K=function(I){function x(R,W,J){var B=I.call(this,R,W,J)||this;return B.fillColor=J.defaultFillColor,B.strokeWidth=0,B.fillPanel=new S("Color",J.defaultColorSet,J.defaultFillColor),B.fillPanel.onColorChanged=B.setFillColor,B}return $(x,I),Object.defineProperty(x.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),x.prototype.getState=function(){var R=I.prototype.getState.call(this);return R.typeName=x.typeName,R},x.typeName="CoverMarker",x.title="Cover marker",x.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>',x}(v),z=function(I){function x(R,W,J,B){var de=I.call(this,R,B||'<svg viewBox="0 0 24 24"><path d="M17.66 8L12 2.35 6.34 8A8.02 8.02 0 004 13.64c0 2 .78 4.11 2.34 5.67a7.99 7.99 0 0011.32 0c1.56-1.56 2.34-3.67 2.34-5.67S19.22 9.56 17.66 8M6 14c0-2 .62-3.27 1.76-4.4L12 5.27l4.24 4.38C17.38 10.77 18 12 18 14H6z"/></svg>')||this;return de.opacities=[],de.opacityBoxes=[],de.opacities=W,de.currentOpacity=J,de.setCurrentOpacity=de.setCurrentOpacity.bind(de),de}return $(x,I),x.prototype.getUi=function(){var R=this,W=document.createElement("div");return W.style.display="flex",W.style.overflow="hidden",W.style.flexGrow="2",W.style.justifyContent="space-between",this.opacities.forEach(function(J){var B=document.createElement("div");B.style.display="flex",B.style.alignItems="center",B.style.justifyContent="center",B.style.padding="5px",B.style.borderWidth="2px",B.style.borderStyle="solid",B.style.borderColor=J===R.currentOpacity?R.uiStyleSettings.toolboxAccentColor:"transparent",B.addEventListener("click",function(){R.setCurrentOpacity(J,B)}),W.appendChild(B);var de=document.createElement("div");de.innerText=100*J+"%",B.appendChild(de),R.opacityBoxes.push(B)}),W},x.prototype.setCurrentOpacity=function(R,W){var J=this;this.currentOpacity=R,this.opacityBoxes.forEach(function(B){B.style.borderColor=B===W?J.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},x}(C),ee=function(I){function x(R,W,J){var B=I.call(this,R,W,J)||this;return B.setOpacity=B.setOpacity.bind(B),B.fillColor=J.defaultHighlightColor,B.strokeWidth=0,B.opacity=J.defaultHighlightOpacity,B.fillPanel=new S("Color",J.defaultColorSet,B.fillColor),B.fillPanel.onColorChanged=B.setFillColor,B.opacityPanel=new z("Opacity",J.defaultOpacitySteps,B.opacity),B.opacityPanel.onOpacityChanged=B.setOpacity,B}return $(x,I),x.prototype.setOpacity=function(R){this.opacity=R,this.visual&&O.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(x.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),x.prototype.getState=function(){var R=I.prototype.getState.call(this);return R.typeName=x.typeName,R},x.typeName="HighlightMarker",x.title="Highlight marker",x.icon='<svg viewBox="0 0 24 24"><path d="M18.5 1.15c-.53 0-1.04.19-1.43.58l-5.81 5.82 5.65 5.65 5.82-5.81c.77-.78.77-2.04 0-2.83l-2.84-2.83c-.39-.39-.89-.58-1.39-.58M10.3 8.5l-5.96 5.96c-.78.78-.78 2.04.02 2.85C3.14 18.54 1.9 19.77.67 21h5.66l.86-.86c.78.76 2.03.75 2.81-.02l5.95-5.96"/></svg>',x}(K),G='<svg viewBox="0 0 24 24"><path d="M19 11.5s-2 2.17-2 3.5a2 2 0 002 2 2 2 0 002-2c0-1.33-2-3.5-2-3.5M5.21 10L10 5.21 14.79 10m1.77-1.06L7.62 0 6.21 1.41l2.38 2.38-5.15 5.15c-.59.56-.59 1.53 0 2.12l5.5 5.5c.29.29.68.44 1.06.44s.77-.15 1.06-.44l5.5-5.5c.59-.59.59-1.56 0-2.12z"/></svg>',F=function(I){function x(R,W,J){var B=I.call(this,R,W,J)||this;return B.bgColor="transparent",B.tipPosition={x:0,y:0},B.tipBase1Position={x:0,y:0},B.tipBase2Position={x:0,y:0},B.tipMoving=!1,B.color=J.defaultStrokeColor,B.bgColor=J.defaultFillColor,B.fontFamily=J.defaultFontFamily,B.defaultSize={x:100,y:30},B.setBgColor=B.setBgColor.bind(B),B.getTipPoints=B.getTipPoints.bind(B),B.positionTip=B.positionTip.bind(B),B.setTipPoints=B.setTipPoints.bind(B),B.colorPanel=new S("Text color",J.defaultColorSet,B.color,'<svg viewBox="0 0 24 24"><path d="M9.62 12L12 5.67 14.37 12M11 3L5.5 17h2.25l1.12-3h6.25l1.13 3h2.25L13 3h-2z"/></svg>'),B.colorPanel.onColorChanged=B.setColor,B.bgColorPanel=new S("Fill color",J.defaultColorSet,B.bgColor,G),B.bgColorPanel.onColorChanged=B.setBgColor,B.fontFamilyPanel=new a("Font",J.defaultFontFamilies,J.defaultFontFamily),B.fontFamilyPanel.onFontChanged=B.setFont,B.tipGrip=new i,B.tipGrip.visual.transform.baseVal.appendItem(O.createTransform()),B.controlBox.appendChild(B.tipGrip.visual),B}return $(x,I),x.prototype.ownsTarget=function(R){return I.prototype.ownsTarget.call(this,R)||this.tipGrip.ownsTarget(R)||this.tip===R},x.prototype.createTip=function(){O.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=O.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},x.prototype.pointerDown=function(R,W){this.state==="new"&&I.prototype.pointerDown.call(this,R,W),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(W)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):I.prototype.pointerDown.call(this,R,W)},x.prototype.pointerUp=function(R){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,I.prototype.pointerUp.call(this,R);else{var W=this.state==="creating";I.prototype.pointerUp.call(this,R),this.setTipPoints(W),this.positionTip()}},x.prototype.manipulate=function(R){if(this.tipMoving){var W=this.unrotatePoint(R);this.tipPosition={x:W.x-this.manipulationStartLeft,y:W.y-this.manipulationStartTop},this.positionTip()}else I.prototype.manipulate.call(this,R)},x.prototype.setBgColor=function(R){this.bgRectangle&&this.tip&&(O.setAttributes(this.bgRectangle,[["fill",R]]),O.setAttributes(this.tip,[["fill",R]])),this.bgColor=R,this.fillColorChanged(R)},x.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},x.prototype.setTipPoints=function(R){R===void 0&&(R=!1);var W=Math.min(this.height/2,15),J=this.height/5;R&&(this.tipPosition={x:W+J/2,y:this.height+20});var B=Math.atan(this.height/2/(this.width/2));this.tipPosition.x<this.width/2&&this.tipPosition.y<this.height/2?B<Math.atan((this.height/2-this.tipPosition.y)/(this.width/2-this.tipPosition.x))?(J=this.width/5,W=Math.min(this.width/2,15),this.tipBase1Position={x:W,y:0},this.tipBase2Position={x:W+J,y:0}):(this.tipBase1Position={x:0,y:W},this.tipBase2Position={x:0,y:W+J}):this.tipPosition.x>=this.width/2&&this.tipPosition.y<this.height/2?B<Math.atan((this.height/2-this.tipPosition.y)/(this.tipPosition.x-this.width/2))?(J=this.width/5,W=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-W-J,y:0},this.tipBase2Position={x:this.width-W,y:0}):(this.tipBase1Position={x:this.width,y:W},this.tipBase2Position={x:this.width,y:W+J}):this.tipPosition.x>=this.width/2&&this.tipPosition.y>=this.height/2?B<Math.atan((this.tipPosition.y-this.height/2)/(this.tipPosition.x-this.width/2))?(J=this.width/5,W=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-W-J,y:this.height},this.tipBase2Position={x:this.width-W,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-W-J},this.tipBase2Position={x:this.width,y:this.height-W}):B<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?(J=this.width/5,W=Math.min(this.width/2,15),this.tipBase1Position={x:W,y:this.height},this.tipBase2Position={x:W+J,y:this.height}):(this.tipBase1Position={x:0,y:this.height-W},this.tipBase2Position={x:0,y:this.height-W-J})},x.prototype.resize=function(R){I.prototype.resize.call(this,R),this.positionTip()},x.prototype.positionTip=function(){O.setAttributes(this.tip,[["points",this.getTipPoints()]]);var R=this.tipGrip.visual.transform.baseVal.getItem(0);R.setTranslate(this.tipPosition.x,this.tipPosition.y),this.tipGrip.visual.transform.baseVal.replaceItem(R,0)},Object.defineProperty(x.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.bgColorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),x.prototype.select=function(){this.positionTip(),I.prototype.select.call(this)},x.prototype.getState=function(){var R=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},I.prototype.getState.call(this));return R.typeName=x.typeName,R},x.prototype.restoreState=function(R){var W=R;this.bgColor=W.bgColor,this.tipPosition=W.tipPosition,I.prototype.restoreState.call(this,R),this.createTip(),this.setTipPoints()},x.prototype.scale=function(R,W){I.prototype.scale.call(this,R,W),this.tipPosition={x:this.tipPosition.x*R,y:this.tipPosition.y*W},this.positionTip()},x.typeName="CalloutMarker",x.title="Callout marker",x.icon='<svg viewBox="0 0 24 24"><path d="M4 2h16a2 2 0 012 2v12a2 2 0 01-2 2h-4l-4 4-4-4H4a2 2 0 01-2-2V4a2 2 0 012-2m0 2v12h4.83L12 19.17 15.17 16H20V4H4m2 3h12v2H6V7m0 4h10v2H6v-2z"/></svg>',x}(g),ie=function(I){function x(R,W,J){var B=I.call(this,R,W,J)||this;return B.fillColor="transparent",B.strokeColor="transparent",B.strokeWidth=0,B.strokeDasharray="",B.opacity=1,B.strokeColor=J.defaultColor,B.strokeWidth=J.defaultStrokeWidth,B.strokeDasharray=J.defaultStrokeDasharray,B.fillColor=J.defaultFillColor,B.setStrokeColor=B.setStrokeColor.bind(B),B.setFillColor=B.setFillColor.bind(B),B.setStrokeWidth=B.setStrokeWidth.bind(B),B.setStrokeDasharray=B.setStrokeDasharray.bind(B),B.setOpacity=B.setOpacity.bind(B),B.createVisual=B.createVisual.bind(B),B.strokePanel=new S("Line color",U(J.defaultColorSet,["transparent"]),J.defaultColor),B.strokePanel.onColorChanged=B.setStrokeColor,B.fillPanel=new S("Fill color",U(J.defaultColorSet,["transparent"]),B.fillColor,G),B.fillPanel.onColorChanged=B.setFillColor,B.strokeWidthPanel=new p("Line width",J.defaultStrokeWidths,J.defaultStrokeWidth),B.strokeWidthPanel.onWidthChanged=B.setStrokeWidth,B.strokeStylePanel=new u("Line style",J.defaultStrokeDasharrays,J.defaultStrokeDasharray),B.strokeStylePanel.onStyleChanged=B.setStrokeDasharray,B.opacityPanel=new z("Opacity",J.defaultOpacitySteps,B.opacity),B.opacityPanel.onOpacityChanged=B.setOpacity,B}return $(x,I),x.prototype.ownsTarget=function(R){return!(!I.prototype.ownsTarget.call(this,R)&&R!==this.visual)},x.prototype.createVisual=function(){this.visual=O.createEllipse(this.width/2,this.height/2,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},x.prototype.pointerDown=function(R,W){I.prototype.pointerDown.call(this,R,W),this.state==="new"&&(this.createVisual(),this.moveVisual(R),this._state="creating")},x.prototype.manipulate=function(R){I.prototype.manipulate.call(this,R)},x.prototype.resize=function(R){I.prototype.resize.call(this,R),this.setSize()},x.prototype.setSize=function(){I.prototype.setSize.call(this),O.setAttributes(this.visual,[["cx",(this.width/2).toString()],["cy",(this.height/2).toString()],["rx",(this.width/2).toString()],["ry",(this.height/2).toString()]])},x.prototype.pointerUp=function(R){I.prototype.pointerUp.call(this,R),this.setSize()},x.prototype.setStrokeColor=function(R){this.strokeColor=R,this.visual&&O.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(R),this.stateChanged()},x.prototype.setFillColor=function(R){this.fillColor=R,this.visual&&O.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(R),this.stateChanged()},x.prototype.setStrokeWidth=function(R){this.strokeWidth=R,this.visual&&O.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},x.prototype.setStrokeDasharray=function(R){this.strokeDasharray=R,this.visual&&O.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},x.prototype.setOpacity=function(R){this.opacity=R,this.visual&&O.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(x.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),x.prototype.getState=function(){var R=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},I.prototype.getState.call(this));return R.typeName=x.typeName,R},x.prototype.restoreState=function(R){var W=R;this.fillColor=W.fillColor,this.strokeColor=W.strokeColor,this.strokeWidth=W.strokeWidth,this.strokeDasharray=W.strokeDasharray,this.opacity=W.opacity,this.createVisual(),I.prototype.restoreState.call(this,R),this.setSize()},x.prototype.scale=function(R,W){I.prototype.scale.call(this,R,W),this.setSize()},x.typeName="EllipseMarker",x.title="Ellipse marker",x.icon='<svg viewBox="0 0 24 24"><path d="M12 4C6.5 4 2 7.58 2 12s4.5 8 10 8 10-3.58 10-8-4.5-8-10-8z"/></svg>',x}(E),ge=function(I){function x(R,W,J){return I.call(this,R,W,J)||this}return $(x,I),Object.defineProperty(x.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),x.prototype.ownsTarget=function(R){return!(!I.prototype.ownsTarget.call(this,R)&&R!==this.tip1&&R!==this.tip2)},x.prototype.createTips=function(){this.tip1=O.createLine(this.x1-this.tipLength/2,this.y1,this.x1+this.tipLength/2,this.y1,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.tip1.transform.baseVal.appendItem(O.createTransform()),this.visual.appendChild(this.tip1),this.tip2=O.createLine(this.x2-this.tipLength/2,this.y2,this.x2+this.tipLength/2,this.y2,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.tip2.transform.baseVal.appendItem(O.createTransform()),this.visual.appendChild(this.tip2)},x.prototype.pointerDown=function(R,W){I.prototype.pointerDown.call(this,R,W),this.state==="creating"&&this.createTips()},x.prototype.adjustVisual=function(){if(I.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(O.setAttributes(this.tip1,[["x1",(this.x1-this.tipLength/2).toString()],["y1",this.y1.toString()],["x2",(this.x1+this.tipLength/2).toString()],["y2",this.y1.toString()],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),O.setAttributes(this.tip2,[["x1",(this.x2-this.tipLength/2).toString()],["y1",this.y2.toString()],["x2",(this.x2+this.tipLength/2).toString()],["y2",this.y2.toString()],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),Math.abs(this.x1-this.x2)>.1)){var R=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),W=this.tip1.transform.baseVal.getItem(0);W.setRotate(R,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(W,0);var J=this.tip2.transform.baseVal.getItem(0);J.setRotate(R+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(J,0)}},Object.defineProperty(x.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),x.prototype.getState=function(){var R=I.prototype.getState.call(this);return R.typeName=x.typeName,R},x.prototype.restoreState=function(R){I.prototype.restoreState.call(this,R),this.createTips(),this.adjustVisual()},x.typeName="MeasurementMarker",x.title="Measurement marker",x.icon='<svg viewBox="0 0 24 24"><path d="M1.39 18.36l1.77-1.76L4.58 18l1.06-1.05-1.42-1.41 1.42-1.42 2.47 2.48 1.06-1.06-2.47-2.48 1.41-1.41 1.42 1.41L10.59 12l-1.42-1.41 1.42-1.42 2.47 2.48 1.06-1.06-2.47-2.48 1.41-1.41 1.41 1.41 1.07-1.06-1.42-1.41 1.42-1.42L18 6.7l1.07-1.06-2.47-2.48 1.76-1.77 4.25 4.25L5.64 22.61l-4.25-4.25z"/></svg>',x}(s),ye=function(I){function x(R,W,J){var B=I.call(this,R,W,J)||this;return B.strokePanel.colors=J.defaultColorSet,B.fillColor="transparent",B}return $(x,I),Object.defineProperty(x.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),x.prototype.getState=function(){var R=I.prototype.getState.call(this);return R.typeName=x.typeName,R},x.typeName="EllipseFrameMarker",x.title="Ellipse frame marker",x.icon='<svg viewBox="0 0 24 24"><path d="M12 6c4.41 0 8 2.69 8 6s-3.59 6-8 6-8-2.69-8-6 3.59-6 8-6m0-2C6.5 4 2 7.58 2 12s4.5 8 10 8 10-3.58 10-8-4.5-8-10-8z"/></svg>',x}(ie),xe=function(){function I(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(I.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),I.prototype.addUndoStep=function(x){this.undoStack.length!==0&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(x)||(this.undoStack.push(x),JSON.stringify(this.lastRedoStep)!==JSON.stringify(x)&&this.redoStack.splice(0,this.redoStack.length))},I.prototype.replaceLastUndoStep=function(x){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=x)},I.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},I.prototype.undo=function(){if(this.undoStack.length>1){var x=this.undoStack.pop();return x!==void 0&&this.redoStack.push(x),this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0}},I.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},I}(),Te=function(I){function x(R,W,J){var B=I.call(this,R,W,J)||this;return B.strokeColor="transparent",B.strokeWidth=0,B.strokeDasharray="",B.curveX=0,B.curveY=0,B.manipulationStartCurveX=0,B.manipulationStartCurveY=0,B.setStrokeColor=B.setStrokeColor.bind(B),B.setStrokeWidth=B.setStrokeWidth.bind(B),B.setStrokeDasharray=B.setStrokeDasharray.bind(B),B.positionGrips=B.positionGrips.bind(B),B.addControlGrips=B.addControlGrips.bind(B),B.adjustVisual=B.adjustVisual.bind(B),B.setupControlBox=B.setupControlBox.bind(B),B.resize=B.resize.bind(B),B.strokeColor=J.defaultColor,B.strokeWidth=J.defaultStrokeWidth,B.strokeDasharray=J.defaultStrokeDasharray,B.strokePanel=new S("Line color",J.defaultColorSet,J.defaultColor),B.strokePanel.onColorChanged=B.setStrokeColor,B.strokeWidthPanel=new p("Line width",J.defaultStrokeWidths,J.defaultStrokeWidth),B.strokeWidthPanel.onWidthChanged=B.setStrokeWidth,B.strokeStylePanel=new u("Line style",J.defaultStrokeDasharrays,J.defaultStrokeDasharray),B.strokeStylePanel.onStyleChanged=B.setStrokeDasharray,B}return $(x,I),x.prototype.ownsTarget=function(R){return!(!I.prototype.ownsTarget.call(this,R)&&R!==this.visual&&R!==this.selectorCurve&&R!==this.visibleCurve&&!this.curveGrip.ownsTarget(R))},x.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},x.prototype.createVisual=function(){this.visual=O.createGroup(),this.selectorCurve=O.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=O.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)},x.prototype.pointerDown=function(R,W){I.prototype.pointerDown.call(this,R,W),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=R.x,this.curveY=R.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(W)&&(this.activeGrip=this.curveGrip,this._state="resize")},x.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),O.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),O.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),O.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},x.prototype.setupControlBox=function(){I.prototype.setupControlBox.call(this),this.curveControlLine1=O.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=O.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)},x.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,I.prototype.addControlGrips.call(this)},x.prototype.positionGrips=function(){I.prototype.positionGrips.call(this);var R=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-R/2,this.curveY-R/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()))},x.prototype.manipulate=function(R){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+R.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+R.y-this.manipulationStartY),I.prototype.manipulate.call(this,R)},x.prototype.resize=function(R){this.activeGrip===this.curveGrip&&(this.curveX=R.x,this.curveY=R.y),I.prototype.resize.call(this,R),this.state==="creating"&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},x.prototype.setStrokeColor=function(R){this.strokeColor=R,this.adjustVisual(),this.colorChanged(R)},x.prototype.setStrokeWidth=function(R){this.strokeWidth=R,this.adjustVisual()},x.prototype.setStrokeDasharray=function(R){this.strokeDasharray=R,this.adjustVisual()},x.prototype.scale=function(R,W){this.curveX=this.curveX*R,this.curveY=this.curveY*W,I.prototype.scale.call(this,R,W)},Object.defineProperty(x.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),x.prototype.getState=function(){var R=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},I.prototype.getState.call(this));return R.typeName=x.typeName,R},x.prototype.restoreState=function(R){I.prototype.restoreState.call(this,R);var W=R;this.strokeColor=W.strokeColor,this.strokeWidth=W.strokeWidth,this.strokeDasharray=W.strokeDasharray,this.curveX=W.curveX,this.curveY=W.curveY,this.createVisual(),this.adjustVisual()},x.typeName="CurveMarker",x.title="Curve marker",x.icon='<svg viewBox="0 0 24 24"><path d="M18.5 2A1.5 1.5 0 0120 3.5 1.5 1.5 0 0118.5 5c-.23 0-.45-.05-.65-.15l-3.69 3.7.34.45c2.19-1.26 4.76-2 7.5-2l1 .03v2.01L22 9c-2.58 0-5 .75-7 2.04A3.96 3.96 0 0111.04 15C9.75 17 9 19.42 9 22l.04 1H7.03L7 22c0-2.74.74-5.31 2-7.5l-.45-.34-3.7 3.69c.1.2.15.42.15.65A1.5 1.5 0 013.5 20 1.5 1.5 0 012 18.5 1.5 1.5 0 013.5 17c.23 0 .45.05.65.15l3.69-3.7C7.31 12.78 7 11.92 7 11a4 4 0 014-4c.92 0 1.78.31 2.45.84l3.7-3.69c-.1-.2-.15-.42-.15-.65A1.5 1.5 0 0118.5 2M11 9a2 2 0 00-2 2 2 2 0 002 2 2 2 0 002-2 2 2 0 00-2-2z"/></svg>',x}(h),Se=function(){function I(x,R){R===void 0&&(R=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=x,this.cancelable=R}return Object.defineProperty(I.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),I.prototype.preventDefault=function(){this._defaultPrevented=!0},I}(),me=function(I){function x(R,W,J){var B=I.call(this,R,!1)||this;return B.dataUrl=W,B.state=J,B}return $(x,I),x}(Se),pe=function(I){function x(R,W,J){J===void 0&&(J=!1);var B=I.call(this,R,J)||this;return B.marker=W,B}return $(x,I),x}(Se),Ee=function(){function I(){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 I.prototype.addEventListener=function(x,R){this[x].push(R)},I.prototype.removeEventListener=function(x,R){var W=this[x].indexOf(R);W>-1&&this[x].splice(W,1)},I}(),le=function(){function I(x){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new d,this._isOpen=!1,this.undoRedoManager=new xe,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 Ee,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=I.instanceCounter++,this.styles=new L(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=x,this.targetRoot=document.body,this.width=x.clientWidth,this.height=x.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(I.prototype,"ALL_MARKER_TYPES",{get:function(){return[y,m,M,g,ye,ie,ee,F,ge,K,s,Te]},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[y,m,M,g,ie,ee,F]},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"BASIC_MARKER_TYPES",{get:function(){return[y,m,M,g,ee]},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(x){var R=this;this._availableMarkerTypes.splice(0),x.forEach(function(W){if(typeof W=="string"){var J=R.ALL_MARKER_TYPES.find(function(B){return B.typeName===W});J!==void 0&&R._availableMarkerTypes.push(J)}else R._availableMarkerTypes.push(W)})},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"zoomLevel",{get:function(){return this._zoomLevel},set:function(x){this._zoomLevel=x,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(I.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),I.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),this.settings.displayMode==="popup"&&this.onPopupTargetResize(),H.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},I.prototype.show=function(){var x=this;this.styles.styleSheetRoot===void 0&&k.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=k.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(R){return R(new Se(x))})},I.prototype.render=function(){return P(this,void 0,void 0,function(){var x;return Y(this,function(R){switch(R.label){case 0:return this.setCurrentMarker(),(x=new N).naturalSize=this.renderAtNaturalSize,x.imageType=this.renderImageType,x.imageQuality=this.renderImageQuality,x.markersOnly=this.renderMarkersOnly,x.width=this.renderWidth,x.height=this.renderHeight,[4,x.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return R.sent(),[4,x.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,R.sent()]}})})},I.prototype.close=function(x){var R=this;if(x===void 0&&(x=!1),this.isOpen){var W=!1;x||this.eventListeners.beforeclose.forEach(function(J){var B=new Se(R,!0);J(B),B.defaultPrevented&&(W=!0)}),W||(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(J){return J(new Se(R))}),this.detachEvents(),this._isOpen=!1)}},I.prototype.addMarkersToToolbar=function(){for(var x,R=[],W=0;W<arguments.length;W++)R[W]=arguments[W];(x=this._availableMarkerTypes).push.apply(x,R)},I.prototype.addRenderEventListener=function(x){this.addEventListener("render",function(R){x(R.dataUrl,R.state)})},I.prototype.removeRenderEventListener=function(x){},I.prototype.addCloseEventListener=function(x){this.addEventListener("close",function(){x()})},I.prototype.removeCloseEventListener=function(x){},I.prototype.setupResizeObserver=function(){var x=this;this.settings.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){x.resize(x.target.clientWidth,x.target.clientHeight)}),this.targetObserver.observe(this.target)):this.settings.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){return x.onPopupTargetResize()}),this.targetObserver.observe(this.editorCanvas)),window.addEventListener("resize",this.setWindowHeight))},I.prototype.onPopupTargetResize=function(){var x=1*this.target.clientWidth/this.target.clientHeight,R=this.editorCanvas.clientWidth/x>this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*x:this.editorCanvas.clientWidth,W=R<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/x;this.resize(R,W)},I.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},I.prototype.resize=function(x,R){this._isResizing=!0;var W=x/this.imageWidth,J=R/this.imageHeight;this.imageWidth=Math.round(x),this.imageHeight=Math.round(R),this.target instanceof HTMLImageElement&&this.editingTarget instanceof HTMLImageElement&&(this.editingTarget.src=this.target.src),this.editingTarget.width=this.imageWidth,this.editingTarget.height=this.imageHeight,this.editingTarget.style.width=this.imageWidth+"px",this.editingTarget.style.height=this.imageHeight+"px",this.markerImage.setAttribute("width",this.imageWidth.toString()),this.markerImage.setAttribute("height",this.imageHeight.toString()),this.markerImage.setAttribute("viewBox","0 0 "+this.imageWidth.toString()+" "+this.imageHeight.toString()),this.markerImageHolder.style.width=this.imageWidth+"px",this.markerImageHolder.style.height=this.imageHeight+"px",this.overlayContainer.style.width=this.imageWidth+"px",this.overlayContainer.style.height=this.imageHeight+"px",this.settings.displayMode!=="popup"?this.coverDiv.style.width=this.imageWidth.toString()+"px":(this.setTopLeft(),this.positionMarkerImage()),this.toolbar!==void 0&&this.toolbar.adjustLayout(),this.positionLogo(),this.scaleMarkers(W,J),this._isResizing=!1},I.prototype.scaleMarkers=function(x,R){var W,J=this;this._currentMarker&&this._currentMarker instanceof g?this._currentMarker.scale(x,R):(W=this._currentMarker,this.setCurrentMarker()),this.markers.forEach(function(B){B!==J._currentMarker&&B.scale(x,R)}),W!==void 0&&this.setCurrentMarker(W)},I.prototype.setEditingTarget=function(){this.imageWidth=Math.round(this.target.clientWidth),this.imageHeight=Math.round(this.target.clientHeight),this.target instanceof HTMLImageElement&&this.editingTarget instanceof HTMLImageElement&&(this.editingTarget.src=this.target.src),this.editingTarget.width=this.imageWidth,this.editingTarget.height=this.imageHeight,this.editingTarget.style.width=this.imageWidth+"px",this.editingTarget.style.height=this.imageHeight+"px"},I.prototype.setTopLeft=function(){var x=this.editingTarget.getBoundingClientRect(),R=this.editorCanvas.getBoundingClientRect();this.left=x.left-R.left,this.top=x.top-R.top},I.prototype.initMarkerCanvas=function(){this.markerImageHolder=document.createElement("div"),this.markerImageHolder.style.setProperty("touch-action","pinch-zoom"),this.markerImage=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.markerImage.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.markerImage.setAttribute("width",this.imageWidth.toString()),this.markerImage.setAttribute("height",this.imageHeight.toString()),this.markerImage.setAttribute("viewBox","0 0 "+this.imageWidth.toString()+" "+this.imageHeight.toString()),this.markerImage.style.pointerEvents="auto",this.markerImageHolder.style.position="absolute",this.markerImageHolder.style.width=this.imageWidth+"px",this.markerImageHolder.style.height=this.imageHeight+"px",this.markerImageHolder.style.transformOrigin="top left",this.positionMarkerImage(),this.markerImageHolder.appendChild(this.markerImage),this.editorCanvas.appendChild(this.markerImageHolder)},I.prototype.addDefs=function(){for(var x,R=[],W=0;W<arguments.length;W++)R[W]=arguments[W];this.defs=O.createDefs(),this.addDefsToImage(),(x=this.defs).append.apply(x,R)},I.prototype.addDefsToImage=function(){this.defs&&this.markerImage.insertBefore(this.defs,this.markerImage.firstChild)},I.prototype.initOverlay=function(){this.overlayContainer=document.createElement("div"),this.overlayContainer.style.position="absolute",this.overlayContainer.style.left="0px",this.overlayContainer.style.top="0px",this.overlayContainer.style.width=this.imageWidth+"px",this.overlayContainer.style.height=this.imageHeight+"px",this.overlayContainer.style.display="flex",this.markerImageHolder.appendChild(this.overlayContainer)},I.prototype.positionMarkerImage=function(){this.markerImageHolder.style.top=this.top/this.zoomLevel+"px",this.markerImageHolder.style.left=this.left/this.zoomLevel+"px"},I.prototype.attachEvents=function(){this.markerImage.addEventListener("pointerdown",this.onPointerDown),this.markerImage.addEventListener("dblclick",this.onDblClick),this.attachWindowEvents()},I.prototype.attachWindowEvents=function(){window.addEventListener("pointermove",this.onPointerMove),window.addEventListener("pointerup",this.onPointerUp),window.addEventListener("pointercancel",this.onPointerOut),window.addEventListener("pointerout",this.onPointerOut),window.addEventListener("pointerleave",this.onPointerUp),window.addEventListener("resize",this.onWindowResize),window.addEventListener("keyup",this.onKeyUp)},I.prototype.detachEvents=function(){this.markerImage.removeEventListener("pointerdown",this.onPointerDown),this.markerImage.removeEventListener("dblclick",this.onDblClick),this.detachWindowEvents()},I.prototype.detachWindowEvents=function(){window.removeEventListener("pointermove",this.onPointerMove),window.removeEventListener("pointerup",this.onPointerUp),window.removeEventListener("pointercancel",this.onPointerOut),window.removeEventListener("pointerout",this.onPointerOut),window.removeEventListener("pointerleave",this.onPointerUp),window.removeEventListener("resize",this.onWindowResize),window.removeEventListener("keyup",this.onKeyUp)},I.prototype.addLogo=function(){this.logoUI=document.createElement("div"),this.logoUI.style.display="inline-block",this.logoUI.style.margin="0px",this.logoUI.style.padding="0px",this.logoUI.style.fill="#333333";var x=document.createElement("a");x.href="https://markerjs.com/",x.target="_blank",x.innerHTML='<svg viewBox="0 0 112 96" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414"><path fill="#e5f20d" fill-opacity=".647" d="M0 40.386h111.96V95.62H0z"/><path d="M93.61 61.452c0 .987-.328 1.831-.987 2.53-.657.7-1.52 1.048-2.591 1.048-1.481 0-2.222-.74-2.222-2.22 0-16.617-.533-29.347-1.604-38.192-1.068-8.842-2.92-13.265-5.552-13.265-4.443 0-10.94 15.509-19.497 46.52v.124c0 .987-.328 1.831-.987 2.53-.657.7-1.52 1.048-2.592 1.048-1.48 0-2.22-.74-2.22-2.22 0-3.29.165-8.392.493-15.302.33-7.732.494-13.82.494-18.262 0-6.17-.186-10.55-.556-13.142-.37-2.591-1.172-3.887-2.406-3.887-2.796 0-6.333 5.12-10.612 15.363C38.494 34.367 34.01 46.44 29.32 60.34l-1.11 3.209a5.714 5.714 0 01-1.42 2.097c-.617.578-1.295.864-2.036.864-.987 0-1.644-.081-1.974-.247-.328-.162-.533-.656-.617-1.48-.41-4.03-.74-9.418-.987-16.165-.163-1.728-.329-4.566-.494-8.515-.822-13.901-1.562-23.3-2.221-28.196-.657-4.893-.987-7.628-.987-8.205 0-.657.33-1.44.987-2.345.659-.903 1.276-1.357 1.85-1.357 1.319 0 2.387.947 3.21 2.838.411.906.863 4.526 1.357 10.859.493 6.335.905 14.19 1.233 23.568l.617 18.88c4.527-13.983 9.216-26.673 14.068-38.068C45.65 6.686 50.093.988 54.123.988c2.715 0 4.566 1.974 5.553 5.923.987 3.949 1.481 9.667 1.481 17.152 0 3.949-.081 9.625-.247 17.029l-.123 5.676c3.373-11.762 6.725-21.634 10.057-29.615 3.331-7.979 6.685-11.97 10.056-11.97 8.475 0 12.71 18.757 12.71 56.269z" fill-rule="nonzero"/></svg>',x.title="Powered by marker.js",x.style.display="grid",x.style.alignItems="center",x.style.justifyItems="center",x.style.padding="3px",x.style.width="20px",x.style.height="20px",this.logoUI.appendChild(x),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},I.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")},I.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"},I.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},I.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 x=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=x+"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 D(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<this.styles.settings.toolbarHeight&&(this.editingTarget.style.marginTop=this.target.offsetTop-this.styles.settings.toolbarHeight+"px"),this.editorCanvas.appendChild(this.editingTarget),this.toolbox=new T(this.uiDiv,this.settings.displayMode,this.uiStyleSettings,this.styles),this.toolbox.show(this._silentRenderMode||this.uiStyleSettings.hideToolbox?"hidden":"visible")},I.prototype.closeUI=function(){this.settings.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},I.prototype.removeMarker=function(x){this.markerImage.removeChild(x.container),this.markers.indexOf(x)>-1&&this.markers.splice(this.markers.indexOf(x),1),x.dispose()},I.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())},I.prototype.toolbarButtonClicked=function(x,R){if(x==="marker"&&R!==void 0)this.createNewMarker(R);else if(x==="action")switch(R){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()}},I.prototype.deleteSelectedMarker=function(){var x=this;if(this._currentMarker!==void 0){var R=!1;if(this.eventListeners.markerbeforedelete.forEach(function(J){var B=new pe(x,x._currentMarker,!0);J(B),B.defaultPrevented&&(R=!0)}),!R){var W=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(J){return J(new pe(x,W))})}}},I.prototype.clear=function(){var x=this,R=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(de){var _e=new pe(x,void 0,!0);de(_e),_e.defaultPrevented&&(R=!0)}),!R)){this.setCurrentMarker();for(var W=function(de){var _e=J.markers[de];J.setCurrentMarker(J.markers[de]),J._currentMarker.dispose(),J.markerImage.removeChild(J._currentMarker.container),J.markers.splice(J.markers.indexOf(J._currentMarker),1),J.eventListeners.markerdelete.forEach(function(Re){return Re(new pe(x,_e))})},J=this,B=this.markers.length-1;B>=0;B--)W(B);this.addUndoStep()}},Object.defineProperty(I.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),I.prototype.showNotesEditor=function(){var x;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=(x=this._currentMarker.notes)!==null&&x!==void 0?x:"",this.overlayContainer.appendChild(this.notesArea))},I.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)},I.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},I.prototype.addUndoStep=function(){var x=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var R=this.getState(),W=this.undoRedoManager.getLastUndoStep();if(!W||W.width===R.width&&W.height===R.height){var J=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(R),J<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach(function(B){return B(new Se(x))})}else this.undoRedoManager.replaceLastUndoStep(R),this.eventListeners.statechange.forEach(function(B){return B(new Se(x))})}},I.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},I.prototype.undoStep=function(){var x=this,R=this.undoRedoManager.undo();R!==void 0&&(this.restoreState(R),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(W){return W(new Se(x))}))},I.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},I.prototype.redoStep=function(){var x=this,R=this.undoRedoManager.redo();R!==void 0&&(this.restoreState(R),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(W){return W(new Se(x))}))},I.prototype.stepZoom=function(){var x=this.zoomSteps.indexOf(this.zoomLevel);this.zoomLevel=x<this.zoomSteps.length-1?this.zoomSteps[x+1]:this.zoomSteps[0]},I.prototype.panTo=function(x){this.contentDiv.scrollBy({left:this.prevPanPoint.x-x.x,top:this.prevPanPoint.y-x.y}),this.prevPanPoint=x},I.prototype.startRenderAndClose=function(){return P(this,void 0,void 0,function(){var x,R,W=this;return Y(this,function(J){switch(J.label){case 0:return[4,this.render()];case 1:return x=J.sent(),R=this.getState(),this.eventListeners.render.forEach(function(B){return B(new me(W,x,R))}),this.close(!0),[2]}})})},I.prototype.getState=function(x){x===!0&&this.setCurrentMarker();var R={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach(function(W){return R.markers.push(W.getState())}),R},I.prototype.restoreState=function(x){var R=this;for(this.markers.splice(0);this.markerImage.lastChild;)this.markerImage.removeChild(this.markerImage.lastChild);x.markers.forEach(function(W){var J=R._availableMarkerTypes.find(function(de){return de.typeName===W.typeName});if(J!==void 0){var B=R.addNewMarker(J);B.restoreState(W),R.markers.push(B)}}),x.width&&x.height&&(x.width!==this.imageWidth||x.height!==this.imageHeight)&&this.scaleMarkers(this.imageWidth/x.width,this.imageHeight/x.height),this.eventListeners.restorestate.forEach(function(W){return W(new Se(R))})},I.prototype.addNewMarker=function(x){var R=O.createGroup();return this.markerImage.appendChild(R),new x(R,this.overlayContainer,this.settings)},I.prototype.createNewMarker=function(x){var R,W=this;(R=typeof x=="string"?this._availableMarkerTypes.find(function(J){return J.typeName===x}):x)&&(this.setCurrentMarker(),this.addUndoStep(),this._currentMarker=this.addNewMarker(R),this._currentMarker.onMarkerCreated=this.markerCreated,this._currentMarker.onColorChanged=this.colorChanged,this._currentMarker.onFillColorChanged=this.fillColorChanged,this._currentMarker.onStateChanged=this.markerStateChanged,this.markerImage.style.cursor="crosshair",this.toolbar.setActiveMarkerButton(R.typeName),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this.eventListeners.markercreating.forEach(function(J){return J(new pe(W,W._currentMarker))}))},I.prototype.markerCreated=function(x){var R=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(x),this.setCurrentMarker(x),x instanceof m&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(m):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach(function(W){return W(new pe(R,R._currentMarker))})},I.prototype.colorChanged=function(x){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultColor=x,this.settings.defaultStrokeColor=x)},I.prototype.fillColorChanged=function(x){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultFillColor=x)},I.prototype.markerStateChanged=function(x){var R=this;this.eventListeners.markerchange.forEach(function(W){return W(new pe(R,x))})},I.prototype.setCurrentMarker=function(x){var R=this;this._currentMarker!==x&&this._currentMarker!==void 0&&(this._currentMarker.deselect(),this.toolbar.setCurrentMarker(),this.toolbox.setPanelButtons([]),this._isResizing||this.eventListeners.markerdeselect.forEach(function(W){return W(new pe(R,R._currentMarker))})),this._currentMarker=x,this._currentMarker===void 0||this._currentMarker.isSelected||(this._currentMarker.state!=="new"&&this._currentMarker.select(),this.toolbar.setCurrentMarker(this._currentMarker),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this._isResizing||this.eventListeners.markerselect.forEach(function(W){return W(new pe(R,R._currentMarker))}))},I.prototype.onPointerDown=function(x){if(this._isFocused||this.focus(),this.touchPoints++,this.touchPoints===1||x.pointerType!=="touch")if(this._currentMarker===void 0||this._currentMarker.state!=="new"&&this._currentMarker.state!=="creating"){if(this.mode==="select"){var R=this.markers.find(function(W){return W.ownsTarget(x.target)});R!==void 0?(this.setCurrentMarker(R),this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(x.clientX,x.clientY),x.target)):(this.setCurrentMarker(),this.isDragging=!0,this.prevPanPoint={x:x.clientX,y:x.clientY})}}else this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(x.clientX,x.clientY))},I.prototype.onDblClick=function(x){if(this._isFocused||this.focus(),this.mode==="select"){var R=this.markers.find(function(W){return W.ownsTarget(x.target)});R!==void 0&&R!==this._currentMarker&&this.setCurrentMarker(R),this._currentMarker!==void 0?this._currentMarker.dblClick(this.clientToLocalCoordinates(x.clientX,x.clientY),x.target):this.setCurrentMarker()}},I.prototype.onPointerMove=function(x){this.touchPoints!==1&&x.pointerType==="touch"||(this._currentMarker!==void 0||this.isDragging)&&(this._currentMarker!==void 0&&this._currentMarker.state==="edit"||x.preventDefault(),this._currentMarker!==void 0?this._currentMarker.manipulate(this.clientToLocalCoordinates(x.clientX,x.clientY)):this.zoomLevel>1&&this.panTo({x:x.clientX,y:x.clientY}))},I.prototype.onPointerUp=function(x){this.touchPoints>0&&this.touchPoints--,this.touchPoints===0&&this.isDragging&&this._currentMarker!==void 0&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(x.clientX,x.clientY)),this.isDragging=!1,this.addUndoStep()},I.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},I.prototype.onKeyUp=function(x){this._currentMarker===void 0||this.notesArea!==void 0||x.key!=="Delete"&&x.key!=="Backspace"||this.deleteSelectedMarker()},I.prototype.clientToLocalCoordinates=function(x,R){var W=this.markerImage.getBoundingClientRect();return{x:(x-W.left)/this.zoomLevel,y:(R-W.top)/this.zoomLevel}},I.prototype.onWindowResize=function(){this.positionUI()},I.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var x=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=x+"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()},I.prototype.addLicenseKey=function(x){H.addKey(x)},I.prototype.addEventListener=function(x,R){this.eventListeners.addEventListener(x,R)},I.prototype.removeEventListener=function(x,R){this.eventListeners.removeEventListener(x,R)},I.prototype.renderState=function(x){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(x),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(I.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),I.prototype.focus=function(){var x=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,this._previousCurrentMarker!==void 0&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach(function(R){return R(new Se(x))}))},I.prototype.blur=function(){var x=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(R){return R(new Se(x))}))},I.instanceCounter=0,I}()},"VrN/":function(qe,Ke,V){(function(fe,$){qe.exports=$()})(this,function(){"use strict";var fe=navigator.userAgent,$=navigator.platform,P=/gecko\/\d/i.test(fe),Y=/MSIE \d/.test(fe),U=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(fe),O=/Edge\/(\d+)/.exec(fe),H=Y||U||O,N=H&&(Y?document.documentMode||6:+(O||U)[1]),k=!O&&/WebKit\//.test(fe),L=k&&/Qt\/\d+\.\d+/.test(fe),_=!O&&/Chrome\//.test(fe),w=/Opera\//.test(fe),D=/Apple Computer/.test(navigator.vendor),T=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(fe),C=/PhantomJS/.test(fe),S=!O&&/AppleWebKit/.test(fe)&&/Mobile\/\w+/.test(fe),f=/Android/.test(fe),l=S||f||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(fe),i=S||/Mac/.test($),c=/\bCrOS\b/.test(fe),E=/win/i.test($),v=w&&fe.match(/Version\/(\d*\.\d*)/);v&&(v=Number(v[1])),v&&v>=15&&(w=!1,k=!0);var p=i&&(L||w&&(v==null||v<12.11)),u=P||H&&N>=9;function y(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var d=function(e,t){var r=e.className,n=y(t).exec(r);if(n){var o=r.slice(n.index+n[0].length);e.className=r.slice(0,n.index)+(o?n[1]+o:"")}};function h(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function s(e,t){return h(e).appendChild(t)}function a(e,t,r,n){var o=document.createElement(e);if(r&&(o.className=r),n&&(o.style.cssText=n),typeof t=="string")o.appendChild(document.createTextNode(t));else if(t)for(var A=0;A<t.length;++A)o.appendChild(t[A]);return o}function g(e,t,r,n){var o=a(e,t,r,n);return o.setAttribute("role","presentation"),o}var m;document.createRange?m=function(e,t,r,n){var o=document.createRange();return o.setEnd(n||e,r),o.setStart(e,t),o}:m=function(e,t,r){var n=document.body.createTextRange();try{n.moveToElementText(e.parentNode)}catch(o){return n}return n.collapse(!0),n.moveEnd("character",r),n.moveStart("character",t),n};function b(e,t){if(t.nodeType==3&&(t=t.parentNode),e.contains)return e.contains(t);do if(t.nodeType==11&&(t=t.host),t==e)return!0;while(t=t.parentNode)}function M(){var e;try{e=document.activeElement}catch(t){e=document.body||null}for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;return e}function K(e,t){var r=e.className;y(t).test(r)||(e.className+=(r?" ":"")+t)}function z(e,t){for(var r=e.split(" "),n=0;n<r.length;n++)r[n]&&!y(r[n]).test(t)&&(t+=" "+r[n]);return t}var ee=function(e){e.select()};S?ee=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:H&&(ee=function(e){try{e.select()}catch(t){}});function G(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function F(e,t,r){t||(t={});for(var n in e)e.hasOwnProperty(n)&&(r!==!1||!t.hasOwnProperty(n))&&(t[n]=e[n]);return t}function ie(e,t,r,n,o){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var A=n||0,j=o||0;;){var X=e.indexOf(" ",A);if(X<0||X>=t)return j+(t-A);j+=X-A,j+=r-j%r,A=X+1}}var ge=function(){this.id=null,this.f=null,this.time=0,this.handler=G(this.onTimeout,this)};ge.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},ge.prototype.set=function(e,t){this.f=t;var r=+new Date+e;(!this.id||r<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=r)};function ye(e,t){for(var r=0;r<e.length;++r)if(e[r]==t)return r;return-1}var xe=50,Te={toString:function(){return"CodeMirror.Pass"}},Se={scroll:!1},me={origin:"*mouse"},pe={origin:"+move"};function Ee(e,t,r){for(var n=0,o=0;;){var A=e.indexOf(" ",n);A==-1&&(A=e.length);var j=A-n;if(A==e.length||o+j>=t)return n+Math.min(j,t-o);if(o+=A-n,o+=r-o%r,n=A+1,o>=t)return n}}var le=[""];function I(e){for(;le.length<=e;)le.push(x(le)+" ");return le[e]}function x(e){return e[e.length-1]}function R(e,t){for(var r=[],n=0;n<e.length;n++)r[n]=t(e[n],n);return r}function W(e,t,r){for(var n=0,o=r(t);n<e.length&&r(e[n])<=o;)n++;e.splice(n,0,t)}function J(){}function B(e,t){var r;return Object.create?r=Object.create(e):(J.prototype=e,r=new J),t&&F(t,r),r}var de=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function _e(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||de.test(e))}function Re(e,t){return t?t.source.indexOf("\\w")>-1&&_e(e)?!0:t.test(e):_e(e)}function Oe(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var ke=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function Ie(e){return e.charCodeAt(0)>=768&&ke.test(e)}function De(e,t,r){for(;(r<0?t>0:t<e.length)&&Ie(e.charAt(t));)t+=r;return t}function Ve(e,t,r){for(var n=t>r?-1:1;;){if(t==r)return t;var o=(t+r)/2,A=n<0?Math.ceil(o):Math.floor(o);if(A==t)return e(A)?t:r;e(A)?r=A:t=A+n}}function Qe(e,t,r,n){if(!e)return n(t,r,"ltr",0);for(var o=!1,A=0;A<e.length;++A){var j=e[A];(j.from<r&&j.to>t||t==r&&j.to==t)&&(n(Math.max(j.from,t),Math.min(j.to,r),j.level==1?"rtl":"ltr",A),o=!0)}o||n(t,r,"ltr")}var at=null;function Ze(e,t,r){var n;at=null;for(var o=0;o<e.length;++o){var A=e[o];if(A.from<t&&A.to>t)return o;A.to==t&&(A.from!=A.to&&r=="before"?n=o:at=o),A.from==t&&(A.from!=A.to&&r!="before"?n=o:at=o)}return n!=null?n:at}var yt=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function r(re){return re<=247?e.charAt(re):1424<=re&&re<=1524?"R":1536<=re&&re<=1785?t.charAt(re-1536):1774<=re&&re<=2220?"r":8192<=re&&re<=8203?"w":re==8204?"b":"L"}var n=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,o=/[stwN]/,A=/[LRr]/,j=/[Lb1n]/,X=/[1n]/;function Q(re,ve,be){this.level=re,this.from=ve,this.to=be}return function(re,ve){var be=ve=="ltr"?"L":"R";if(re.length==0||ve=="ltr"&&!n.test(re))return!1;for(var Pe=re.length,we=[],We=0;We<Pe;++We)we.push(r(re.charCodeAt(We)));for(var Ye=0,it=be;Ye<Pe;++Ye){var gt=we[Ye];gt=="m"?we[Ye]=it:it=gt}for(var St=0,vt=be;St<Pe;++St){var Mt=we[St];Mt=="1"&&vt=="r"?we[St]="n":A.test(Mt)&&(vt=Mt,Mt=="r"&&(we[St]="R"))}for(var $t=1,Ht=we[0];$t<Pe-1;++$t){var nn=we[$t];nn=="+"&&Ht=="1"&&we[$t+1]=="1"?we[$t]="1":nn==","&&Ht==we[$t+1]&&(Ht=="1"||Ht=="n")&&(we[$t]=Ht),Ht=nn}for(var _n=0;_n<Pe;++_n){var ur=we[_n];if(ur==",")we[_n]="N";else if(ur=="%"){var In=void 0;for(In=_n+1;In<Pe&&we[In]=="%";++In);for(var Br=_n&&we[_n-1]=="!"||In<Pe&&we[In]=="1"?"1":"N",Dr=_n;Dr<In;++Dr)we[Dr]=Br;_n=In-1}}for(var Yn=0,Or=be;Yn<Pe;++Yn){var cr=we[Yn];Or=="L"&&cr=="1"?we[Yn]="L":A.test(cr)&&(Or=cr)}for(var qn=0;qn<Pe;++qn)if(o.test(we[qn])){var Jn=void 0;for(Jn=qn+1;Jn<Pe&&o.test(we[Jn]);++Jn);for(var jn=(qn?we[qn-1]:be)=="L",kr=(Jn<Pe?we[Jn]:be)=="L",qi=jn==kr?jn?"L":"R":be,_i=qn;_i<Jn;++_i)we[_i]=qi;qn=Jn-1}for(var gr=[],ri,dr=0;dr<Pe;)if(j.test(we[dr])){var Ao=dr;for(++dr;dr<Pe&&j.test(we[dr]);++dr);gr.push(new Q(0,Ao,dr))}else{var ci=dr,Ii=gr.length,Ni=ve=="rtl"?1:0;for(++dr;dr<Pe&&we[dr]!="L";++dr);for(var Tr=ci;Tr<dr;)if(X.test(we[Tr])){ci<Tr&&(gr.splice(Ii,0,new Q(1,ci,Tr)),Ii+=Ni);var ea=Tr;for(++Tr;Tr<dr&&X.test(we[Tr]);++Tr);gr.splice(Ii,0,new Q(2,ea,Tr)),Ii+=Ni,ci=Tr}else++Tr;ci<dr&&gr.splice(Ii,0,new Q(1,ci,dr))}return ve=="ltr"&&(gr[0].level==1&&(ri=re.match(/^\s+/))&&(gr[0].from=ri[0].length,gr.unshift(new Q(0,0,ri[0].length))),x(gr).level==1&&(ri=re.match(/\s+$/))&&(x(gr).to-=ri[0].length,gr.push(new Q(0,Pe-ri[0].length,Pe)))),ve=="rtl"?gr.reverse():gr}}();function rt(e,t){var r=e.order;return r==null&&(r=e.order=yt(e.text,t)),r}var dt=[],Me=function(e,t,r){if(e.addEventListener)e.addEventListener(t,r,!1);else if(e.attachEvent)e.attachEvent("on"+t,r);else{var n=e._handlers||(e._handlers={});n[t]=(n[t]||dt).concat(r)}};function xt(e,t){return e._handlers&&e._handlers[t]||dt}function mt(e,t,r){if(e.removeEventListener)e.removeEventListener(t,r,!1);else if(e.detachEvent)e.detachEvent("on"+t,r);else{var n=e._handlers,o=n&&n[t];if(o){var A=ye(o,r);A>-1&&(n[t]=o.slice(0,A).concat(o.slice(A+1)))}}}function se(e,t){var r=xt(e,t);if(!r.length)return;for(var n=Array.prototype.slice.call(arguments,2),o=0;o<r.length;++o)r[o].apply(null,n)}function Z(e,t,r){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),se(e,r||t.type,e,t),oe(t)||t.codemirrorIgnore}function q(e){var t=e._handlers&&e._handlers.cursorActivity;if(!t)return;for(var r=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),n=0;n<t.length;++n)ye(r,t[n])==-1&&r.push(t[n])}function ae(e,t){return xt(e,t).length>0}function ue(e){e.prototype.on=function(t,r){Me(this,t,r)},e.prototype.off=function(t,r){mt(this,t,r)}}function te(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function ne(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function oe(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function he(e){te(e),ne(e)}function ce(e){return e.target||e.srcElement}function Ce(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 Ae=function(){if(H&&N<9)return!1;var e=a("div");return"draggable"in e||"dragDrop"in e}(),Ge;function Ue(e){if(Ge==null){var t=a("span","\u200B");s(e,a("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(Ge=t.offsetWidth<=1&&t.offsetHeight>2&&!(H&&N<8))}var r=Ge?a("span","\u200B"):a("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}var He;function Tt(e){if(He!=null)return He;var t=s(e,document.createTextNode("A\u062EA")),r=m(t,0,1).getBoundingClientRect(),n=m(t,1,2).getBoundingClientRect();return h(e),!r||r.left==r.right?!1:He=n.right-r.right<3}var Xe=`
b`.split(/\n/).length!=3?function(e){for(var t=0,r=[],n=e.length;t<=n;){var o=e.indexOf(`
`,t);o==-1&&(o=e.length);var A=e.slice(t,e.charAt(o-1)=="\r"?o-1:o),j=A.indexOf("\r");j!=-1?(r.push(A.slice(0,j)),t+=j+1):(r.push(A),t=o+1)}return r}:function(e){return e.split(/\r\n?|\n/)},st=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},jt=function(){var e=a("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),ze=null;function It(e){if(ze!=null)return ze;var t=s(e,a("span","x")),r=t.getBoundingClientRect(),n=m(t,0,1).getBoundingClientRect();return ze=Math.abs(r.left-n.left)>1}var Zt={},At={};function qt(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Zt[e]=t}function Gt(e,t){At[e]=t}function Dt(e){if(typeof e=="string"&&At.hasOwnProperty(e))e=At[e];else if(e&&typeof e.name=="string"&&At.hasOwnProperty(e.name)){var t=At[e.name];typeof t=="string"&&(t={name:t}),e=B(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Dt("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Dt("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function Ot(e,t){t=Dt(t);var r=Zt[t.name];if(!r)return Ot(e,"text/plain");var n=r(e,t);if(ht.hasOwnProperty(t.name)){var o=ht[t.name];for(var A in o){if(!o.hasOwnProperty(A))continue;n.hasOwnProperty(A)&&(n["_"+A]=n[A]),n[A]=o[A]}}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 ht={};function kt(e,t){var r=ht.hasOwnProperty(e)?ht[e]:ht[e]={};F(t,r)}function bt(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var r={};for(var n in t){var o=t[n];o instanceof Array&&(o=o.concat([])),r[n]=o}return r}function _t(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 Et(e,t,r){return e.startState?e.startState(t,r):!0}var nt=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};nt.prototype.eol=function(){return this.pos>=this.string.length},nt.prototype.sol=function(){return this.pos==this.lineStart},nt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},nt.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},nt.prototype.eat=function(e){var t=this.string.charAt(this.pos),r;if(typeof e=="string"?r=t==e:r=t&&(e.test?e.test(t):e(t)),r)return++this.pos,t},nt.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},nt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},nt.prototype.skipToEnd=function(){this.pos=this.string.length},nt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},nt.prototype.backUp=function(e){this.pos-=e},nt.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=ie(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?ie(this.string,this.lineStart,this.tabSize):0)},nt.prototype.indentation=function(){return ie(this.string,null,this.tabSize)-(this.lineStart?ie(this.string,this.lineStart,this.tabSize):0)},nt.prototype.match=function(e,t,r){if(typeof e=="string"){var n=function(j){return r?j.toLowerCase():j},o=this.string.substr(this.pos,e.length);if(n(o)==n(e))return t!==!1&&(this.pos+=e.length),!0}else{var A=this.string.slice(this.pos).match(e);return A&&A.index>0?null:(A&&t!==!1&&(this.pos+=A[0].length),A)}},nt.prototype.current=function(){return this.string.slice(this.start,this.pos)},nt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},nt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},nt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function Be(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 o=r.children[n],A=o.chunkSize();if(t<A){r=o;break}t-=A}return r.lines[t]}function Rt(e,t,r){var n=[],o=t.line;return e.iter(t.line,r.line+1,function(A){var j=A.text;o==r.line&&(j=j.slice(0,r.ch)),o==t.line&&(j=j.slice(t.ch)),n.push(j),++o}),n}function Nt(e,t,r){var n=[];return e.iter(t,r,function(o){n.push(o.text)}),n}function Lt(e,t){var r=t-e.height;if(r)for(var n=e;n;n=n.parent)n.height+=r}function Ft(e){if(e.parent==null)return null;for(var t=e.parent,r=ye(t.lines,e),n=t.parent;n;t=n,n=n.parent)for(var o=0;!(n.children[o]==t);++o)r+=n.children[o].chunkSize();return r+t.first}function Vt(e,t){var r=e.first;e:do{for(var n=0;n<e.children.length;++n){var o=e.children[n],A=o.height;if(t<A){e=o;continue e}t-=A,r+=o.chunkSize()}return r}while(!e.lines);for(var j=0;j<e.lines.length;++j){var X=e.lines[j],Q=X.height;if(t<Q)break;t-=Q}return r+j}function Jt(e,t){return t>=e.first&&t<e.first+e.size}function Je(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function je(e,t,r){if(r===void 0&&(r=null),!(this instanceof je))return new je(e,t,r);this.line=e,this.ch=t,this.sticky=r}function ft(e,t){return e.line-t.line||e.ch-t.ch}function Rn(e,t){return e.sticky==t.sticky&&ft(e,t)==0}function hr(e){return je(e.line,e.ch)}function vr(e,t){return ft(e,t)<0?t:e}function Cn(e,t){return ft(e,t)<0?e:t}function Xt(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function Pt(e,t){if(t.line<e.first)return je(e.first,0);var r=e.first+e.size-1;return t.line>r?je(r,Be(e,r).text.length):Sn(t,Be(e,t.line).text.length)}function Sn(e,t){var r=e.ch;return r==null||r>t?je(e.line,t):r<0?je(e.line,0):e}function $e(e,t){for(var r=[],n=0;n<t.length;n++)r[n]=Pt(e,t[n]);return r}var ln=function(e,t){this.state=e,this.lookAhead=t},Ln=function(e,t,r,n){this.state=t,this.doc=e,this.line=r,this.maxLookAhead=n||0,this.baseTokens=null,this.baseTokenPos=1};Ln.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},Ln.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}},Ln.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},Ln.fromSaved=function(e,t,r){return t instanceof ln?new Ln(e,bt(e.mode,t.state),r,t.lookAhead):new Ln(e,bt(e.mode,t),r)},Ln.prototype.save=function(e){var t=e!==!1?bt(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new ln(t,this.maxLookAhead):t};function Hr(e,t,r,n){var o=[e.state.modeGen],A={};br(e,t.text,e.doc.mode,r,function(re,ve){return o.push(re,ve)},A,n);for(var j=r.state,X=function(re){r.baseTokens=o;var ve=e.state.overlays[re],be=1,Pe=0;r.state=!0,br(e,t.text,ve.mode,r,function(we,We){for(var Ye=be;Pe<we;){var it=o[be];it>we&&o.splice(be,1,we,o[be+1],it),be+=2,Pe=Math.min(we,it)}if(!We)return;if(ve.opaque)o.splice(Ye,be-Ye,we,"overlay "+We),be=Ye+2;else for(;Ye<be;Ye+=2){var gt=o[Ye+1];o[Ye+1]=(gt?gt+" ":"")+"overlay "+We}},A),r.state=j,r.baseTokens=null,r.baseTokenPos=1},Q=0;Q<e.state.overlays.length;++Q)X(Q);return{styles:o,classes:A.bgClass||A.textClass?A:null}}function Kr(e,t,r){if(!t.styles||t.styles[0]!=e.state.modeGen){var n=Nn(e,Ft(t)),o=t.text.length>e.options.maxHighlightLength&&bt(e.doc.mode,n.state),A=Hr(e,t,n);o&&(n.state=o),t.stateAfter=n.save(!o),t.styles=A.styles,A.classes?t.styleClasses=A.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 Nn(e,t,r){var n=e.doc,o=e.display;if(!n.mode.startState)return new Ln(n,!0,t);var A=Un(e,t,r),j=A>n.first&&Be(n,A-1).stateAfter,X=j?Ln.fromSaved(n,j,A):new Ln(n,Et(n.mode),A);return n.iter(A,t,function(Q){ii(e,Q.text,X);var re=X.line;Q.stateAfter=re==t-1||re%5==0||re>=o.viewFrom&&re<o.viewTo?X.save():null,X.nextLine()}),r&&(n.modeFrontier=X.line),X}function ii(e,t,r,n){var o=e.doc.mode,A=new nt(t,e.options.tabSize,r);for(A.start=A.pos=n||0,t==""&&ai(o,r.state);!A.eol();)yr(o,A,r.state),A.start=A.pos}function ai(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var r=_t(e,t);if(r.mode.blankLine)return r.mode.blankLine(r.state)}function yr(e,t,r,n){for(var o=0;o<10;o++){n&&(n[0]=_t(e,r).mode);var A=e.token(t,r);if(t.pos>t.start)return A}throw new Error("Mode "+e.name+" failed to advance stream.")}var Mr=function(e,t,r){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=r};function oi(e,t,r,n){var o=e.doc,A=o.mode,j;t=Pt(o,t);var X=Be(o,t.line),Q=Nn(e,t.line,r),re=new nt(X.text,e.options.tabSize,Q),ve;for(n&&(ve=[]);(n||re.pos<t.ch)&&!re.eol();)re.start=re.pos,j=yr(A,re,Q.state),n&&ve.push(new Mr(re,j,bt(o.mode,Q.state)));return n?ve:new Mr(re,j,Q.state)}function qr(e,t){if(e)for(;;){var r=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!r)break;e=e.slice(0,r.index)+e.slice(r.index+r[0].length);var n=r[1]?"bgClass":"textClass";t[n]==null?t[n]=r[2]:new RegExp("(?:^|\\s)"+r[2]+"(?:$|\\s)").test(t[n])||(t[n]+=" "+r[2])}return e}function br(e,t,r,n,o,A,j){var X=r.flattenSpans;X==null&&(X=e.options.flattenSpans);var Q=0,re=null,ve=new nt(t,e.options.tabSize,n),be,Pe=e.options.addModeClass&&[null];for(t==""&&qr(ai(r,n.state),A);!ve.eol();){if(ve.pos>e.options.maxHighlightLength?(X=!1,j&&ii(e,t,n,ve.pos),ve.pos=t.length,be=null):be=qr(yr(r,ve,n.state,Pe),A),Pe){var we=Pe[0].name;we&&(be="m-"+(be?we+" "+be:we))}if(!X||re!=be){for(;Q<ve.start;)Q=Math.min(ve.start,Q+5e3),o(Q,re);re=be}ve.start=ve.pos}for(;Q<ve.pos;){var We=Math.min(ve.pos,Q+5e3);o(We,re),Q=We}}function Un(e,t,r){for(var n,o,A=e.doc,j=r?-1:t-(e.doc.mode.innerMode?1e3:100),X=t;X>j;--X){if(X<=A.first)return A.first;var Q=Be(A,X-1),re=Q.stateAfter;if(re&&(!r||X+(re instanceof ln?re.lookAhead:0)<=A.modeFrontier))return X;var ve=ie(Q.text,null,e.options.tabSize);(o==null||n>ve)&&(o=X-1,n=ve)}return o}function ei(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),e.highlightFrontier<t-10)return;for(var r=e.first,n=t-1;n>r;n--){var o=Be(e,n).stateAfter;if(o&&(!(o instanceof ln)||n+o.lookAhead<t)){r=n+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,r)}var si=!1,Wn=!1;function pt(){si=!0}function Le(){Wn=!0}function et(e,t,r){this.marker=e,this.from=t,this.to=r}function Ut(e,t){if(e)for(var r=0;r<e.length;++r){var n=e[r];if(n.marker==t)return n}}function Ct(e,t){for(var r,n=0;n<e.length;++n)e[n]!=t&&(r||(r=[])).push(e[n]);return r}function wt(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function Wt(e,t,r){var n;if(e)for(var o=0;o<e.length;++o){var A=e[o],j=A.marker,X=A.from==null||(j.inclusiveLeft?A.from<=t:A.from<t);if(X||A.from==t&&j.type=="bookmark"&&(!r||!A.marker.insertLeft)){var Q=A.to==null||(j.inclusiveRight?A.to>=t:A.to>t);(n||(n=[])).push(new et(j,A.from,Q?null:A.to))}}return n}function bn(e,t,r){var n;if(e)for(var o=0;o<e.length;++o){var A=e[o],j=A.marker,X=A.to==null||(j.inclusiveRight?A.to>=t:A.to>t);if(X||A.from==t&&j.type=="bookmark"&&(!r||A.marker.insertLeft)){var Q=A.from==null||(j.inclusiveLeft?A.from<=t:A.from<t);(n||(n=[])).push(new et(j,Q?null:A.from-t,A.to==null?null:A.to-t))}}return n}function En(e,t){if(t.full)return null;var r=Jt(e,t.from.line)&&Be(e,t.from.line).markedSpans,n=Jt(e,t.to.line)&&Be(e,t.to.line).markedSpans;if(!r&&!n)return null;var o=t.from.ch,A=t.to.ch,j=ft(t.from,t.to)==0,X=Wt(r,o,j),Q=bn(n,A,j),re=t.text.length==1,ve=x(t.text).length+(re?o:0);if(X)for(var be=0;be<X.length;++be){var Pe=X[be];if(Pe.to==null){var we=Ut(Q,Pe.marker);we?re&&(Pe.to=we.to==null?null:we.to+ve):Pe.to=o}}if(Q)for(var We=0;We<Q.length;++We){var Ye=Q[We];if(Ye.to!=null&&(Ye.to+=ve),Ye.from==null){var it=Ut(X,Ye.marker);it||(Ye.from=ve,re&&(X||(X=[])).push(Ye))}else Ye.from+=ve,re&&(X||(X=[])).push(Ye)}X&&(X=rn(X)),Q&&Q!=X&&(Q=rn(Q));var gt=[X];if(!re){var St=t.text.length-2,vt;if(St>0&&X)for(var Mt=0;Mt<X.length;++Mt)X[Mt].to==null&&(vt||(vt=[])).push(new et(X[Mt].marker,null,null));for(var $t=0;$t<St;++$t)gt.push(vt);gt.push(Q)}return gt}function rn(e){for(var t=0;t<e.length;++t){var r=e[t];r.from!=null&&r.from==r.to&&r.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function On(e,t,r){var n=null;if(e.iter(t.line,r.line+1,function(we){if(we.markedSpans)for(var We=0;We<we.markedSpans.length;++We){var Ye=we.markedSpans[We].marker;Ye.readOnly&&(!n||ye(n,Ye)==-1)&&(n||(n=[])).push(Ye)}}),!n)return null;for(var o=[{from:t,to:r}],A=0;A<n.length;++A)for(var j=n[A],X=j.find(0),Q=0;Q<o.length;++Q){var re=o[Q];if(ft(re.to,X.from)<0||ft(re.from,X.to)>0)continue;var ve=[Q,1],be=ft(re.from,X.from),Pe=ft(re.to,X.to);(be<0||!j.inclusiveLeft&&!be)&&ve.push({from:re.from,to:X.from}),(Pe>0||!j.inclusiveRight&&!Pe)&&ve.push({from:X.to,to:re.to}),o.splice.apply(o,ve),Q+=ve.length-3}return o}function kn(e){var t=e.markedSpans;if(!t)return;for(var r=0;r<t.length;++r)t[r].marker.detachLine(e);e.markedSpans=null}function er(e,t){if(!t)return;for(var r=0;r<t.length;++r)t[r].marker.attachLine(e);e.markedSpans=t}function Bn(e){return e.inclusiveLeft?-1:0}function Ir(e){return e.inclusiveRight?1:0}function Qn(e,t){var r=e.lines.length-t.lines.length;if(r!=0)return r;var n=e.find(),o=t.find(),A=ft(n.from,o.from)||Bn(e)-Bn(t);if(A)return-A;var j=ft(n.to,o.to)||Ir(e)-Ir(t);return j||t.id-e.id}function Tn(e,t){var r=Wn&&e.markedSpans,n;if(r)for(var o=void 0,A=0;A<r.length;++A)o=r[A],o.marker.collapsed&&(t?o.from:o.to)==null&&(!n||Qn(n,o.marker)<0)&&(n=o.marker);return n}function fr(e){return Tn(e,!0)}function wr(e){return Tn(e,!1)}function Ar(e,t){var r=Wn&&e.markedSpans,n;if(r)for(var o=0;o<r.length;++o){var A=r[o];A.marker.collapsed&&(A.from==null||A.from<t)&&(A.to==null||A.to>t)&&(!n||Qn(n,A.marker)<0)&&(n=A.marker)}return n}function Ui(e,t,r,n,o){var A=Be(e,t),j=Wn&&A.markedSpans;if(j)for(var X=0;X<j.length;++X){var Q=j[X];if(!Q.marker.collapsed)continue;var re=Q.marker.find(0),ve=ft(re.from,r)||Bn(Q.marker)-Bn(o),be=ft(re.to,n)||Ir(Q.marker)-Ir(o);if(ve>=0&&be<=0||ve<=0&&be>=0)continue;if(ve<=0&&(Q.marker.inclusiveRight&&o.inclusiveLeft?ft(re.to,r)>=0:ft(re.to,r)>0)||ve>=0&&(Q.marker.inclusiveRight&&o.inclusiveLeft?ft(re.from,n)<=0:ft(re.from,n)<0))return!0}}function Er(e){for(var t;t=fr(e);)e=t.find(-1,!0).line;return e}function Bi(e){for(var t;t=wr(e);)e=t.find(1,!0).line;return e}function ti(e){for(var t,r;t=wr(e);)e=t.find(1,!0).line,(r||(r=[])).push(e);return r}function Ci(e,t){var r=Be(e,t),n=Er(r);return r==n?t:Ft(n)}function Vr(e,t){if(t>e.lastLine())return t;var r=Be(e,t),n;if(!pn(e,r))return t;for(;n=wr(r);)r=n.find(1,!0).line;return Ft(r)+1}function pn(e,t){var r=Wn&&t.markedSpans;if(r)for(var n=void 0,o=0;o<r.length;++o){if(n=r[o],!n.marker.collapsed)continue;if(n.from==null)return!0;if(n.marker.widgetNode)continue;if(n.from==0&&n.marker.inclusiveLeft&&Xr(e,t,n))return!0}}function Xr(e,t,r){if(r.to==null){var n=r.marker.find(1,!0);return Xr(e,n.line,Ut(n.line.markedSpans,r.marker))}if(r.marker.inclusiveRight&&r.to==t.text.length)return!0;for(var o=void 0,A=0;A<t.markedSpans.length;++A)if(o=t.markedSpans[A],o.marker.collapsed&&!o.marker.widgetNode&&o.from==r.to&&(o.to==null||o.to!=r.from)&&(o.marker.inclusiveLeft||r.marker.inclusiveRight)&&Xr(e,t,o))return!0}function Fr(e){e=Er(e);for(var t=0,r=e.parent,n=0;n<r.lines.length;++n){var o=r.lines[n];if(o==e)break;t+=o.height}for(var A=r.parent;A;r=A,A=r.parent)for(var j=0;j<A.children.length;++j){var X=A.children[j];if(X==r)break;t+=X.height}return t}function hi(e){if(e.height==0)return 0;for(var t=e.text.length,r,n=e;r=fr(n);){var o=r.find(0,!0);n=o.from.line,t+=o.from.ch-o.to.ch}for(n=e;r=wr(n);){var A=r.find(0,!0);t-=n.text.length-A.from.ch,n=A.to.line,t+=n.text.length-A.to.ch}return t}function $r(e){var t=e.display,r=e.doc;t.maxLine=Be(r,r.first),t.maxLineLength=hi(t.maxLine),t.maxLineChanged=!0,r.iter(function(n){var o=hi(n);o>t.maxLineLength&&(t.maxLineLength=o,t.maxLine=n)})}var li=function(e,t,r){this.text=e,er(this,t),this.height=r?r(this):1};li.prototype.lineNo=function(){return Ft(this)},ue(li);function ni(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),er(e,r);var o=n?n(e):1;o!=e.height&&Lt(e,o)}function Bt(e){e.parent=null,kn(e)}var Yt={},Kt={};function tn(e,t){if(!e||/^\s*$/.test(e))return null;var r=t.addModeClass?Kt:Yt;return r[e]||(r[e]=e.replace(/\S+/g,"cm-$&"))}function sn(e,t){var r=g("span",null,null,k?"padding-right: .1px":null),n={pre:g("pre",[r],"CodeMirror-line"),content:r,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var o=0;o<=(t.rest?t.rest.length:0);o++){var A=o?t.rest[o-1]:t.line,j=void 0;n.pos=0,n.addToken=on,Tt(e.display.measure)&&(j=rt(A,e.doc.direction))&&(n.addToken=tr(n.addToken,j)),n.map=[];var X=t!=e.display.externalMeasured&&Ft(A);Gr(A,n,Kr(e,A,X)),A.styleClasses&&(A.styleClasses.bgClass&&(n.bgClass=z(A.styleClasses.bgClass,n.bgClass||"")),A.styleClasses.textClass&&(n.textClass=z(A.styleClasses.textClass,n.textClass||""))),n.map.length==0&&n.map.push(0,0,n.content.appendChild(Ue(e.display.measure))),o==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(k){var Q=n.content.lastChild;(/\bcm-tab\b/.test(Q.className)||Q.querySelector&&Q.querySelector(".cm-tab"))&&(n.content.className="cm-tab-wrap-hack")}return se(e,"renderLine",e,t.line,n.pre),n.pre.className&&(n.textClass=z(n.pre.className,n.textClass||"")),n}function mn(e){var t=a("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function on(e,t,r,n,o,A,j){if(!t)return;var X=e.splitSpaces?Hn(t,e.trailingSpace):t,Q=e.cm.state.specialChars,re=!1,ve;if(!Q.test(t))e.col+=t.length,ve=document.createTextNode(X),e.map.push(e.pos,e.pos+t.length,ve),H&&N<9&&(re=!0),e.pos+=t.length;else{ve=document.createDocumentFragment();for(var be=0;;){Q.lastIndex=be;var Pe=Q.exec(t),we=Pe?Pe.index-be:t.length-be;if(we){var We=document.createTextNode(X.slice(be,be+we));H&&N<9?ve.appendChild(a("span",[We])):ve.appendChild(We),e.map.push(e.pos,e.pos+we,We),e.col+=we,e.pos+=we}if(!Pe)break;be+=we+1;var Ye=void 0;if(Pe[0]==" "){var it=e.cm.options.tabSize,gt=it-e.col%it;Ye=ve.appendChild(a("span",I(gt),"cm-tab")),Ye.setAttribute("role","presentation"),Ye.setAttribute("cm-text"," "),e.col+=gt}else Pe[0]=="\r"||Pe[0]==`
`?(Ye=ve.appendChild(a("span",Pe[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Ye.setAttribute("cm-text",Pe[0]),e.col+=1):(Ye=e.cm.options.specialCharPlaceholder(Pe[0]),Ye.setAttribute("cm-text",Pe[0]),H&&N<9?ve.appendChild(a("span",[Ye])):ve.appendChild(Ye),e.col+=1);e.map.push(e.pos,e.pos+1,Ye),e.pos++}}if(e.trailingSpace=X.charCodeAt(t.length-1)==32,r||n||o||re||A||j){var St=r||"";n&&(St+=n),o&&(St+=o);var vt=a("span",[ve],St,A);if(j)for(var Mt in j)j.hasOwnProperty(Mt)&&Mt!="style"&&Mt!="class"&&vt.setAttribute(Mt,j[Mt]);return e.content.appendChild(vt)}e.content.appendChild(ve)}function Hn(e,t){if(e.length>1&&!/ /.test(e))return e;for(var r=t,n="",o=0;o<e.length;o++){var A=e.charAt(o);A==" "&&r&&(o==e.length-1||e.charCodeAt(o+1)==32)&&(A="\xA0"),n+=A,r=A==" "}return n}function tr(e,t){return function(r,n,o,A,j,X,Q){o=o?o+" cm-force-border":"cm-force-border";for(var re=r.pos,ve=re+n.length;;){for(var be=void 0,Pe=0;Pe<t.length&&!(be=t[Pe],be.to>re&&be.from<=re);Pe++);if(be.to>=ve)return e(r,n,o,A,j,X,Q);e(r,n.slice(0,be.to-re),o,A,null,X,Q),A=null,n=n.slice(be.to-re),re=be.to}}}function an(e,t,r,n){var o=!n&&r.widgetNode;o&&e.map.push(e.pos,e.pos+t,o),!n&&e.cm.display.input.needsContentAttribute&&(o||(o=e.content.appendChild(document.createElement("span"))),o.setAttribute("cm-marker",r.id)),o&&(e.cm.display.input.setUneditable(o),e.content.appendChild(o)),e.pos+=t,e.trailingSpace=!1}function Gr(e,t,r){var n=e.markedSpans,o=e.text,A=0;if(!n){for(var j=1;j<r.length;j+=2)t.addToken(t,o.slice(A,A=r[j]),tn(r[j+1],t.cm.options));return}for(var X=o.length,Q=0,re=1,ve="",be,Pe,we=0,We,Ye,it,gt,St;;){if(we==Q){We=Ye=it=Pe="",St=null,gt=null,we=Infinity;for(var vt=[],Mt=void 0,$t=0;$t<n.length;++$t){var Ht=n[$t],nn=Ht.marker;if(nn.type=="bookmark"&&Ht.from==Q&&nn.widgetNode)vt.push(nn);else if(Ht.from<=Q&&(Ht.to==null||Ht.to>Q||nn.collapsed&&Ht.to==Q&&Ht.from==Q)){if(Ht.to!=null&&Ht.to!=Q&&we>Ht.to&&(we=Ht.to,Ye=""),nn.className&&(We+=" "+nn.className),nn.css&&(Pe=(Pe?Pe+";":"")+nn.css),nn.startStyle&&Ht.from==Q&&(it+=" "+nn.startStyle),nn.endStyle&&Ht.to==we&&(Mt||(Mt=[])).push(nn.endStyle,Ht.to),nn.title&&((St||(St={})).title=nn.title),nn.attributes)for(var _n in nn.attributes)(St||(St={}))[_n]=nn.attributes[_n];nn.collapsed&&(!gt||Qn(gt.marker,nn)<0)&&(gt=Ht)}else Ht.from>Q&&we>Ht.from&&(we=Ht.from)}if(Mt)for(var ur=0;ur<Mt.length;ur+=2)Mt[ur+1]==we&&(Ye+=" "+Mt[ur]);if(!gt||gt.from==Q)for(var In=0;In<vt.length;++In)an(t,0,vt[In]);if(gt&&(gt.from||0)==Q){if(an(t,(gt.to==null?X+1:gt.to)-Q,gt.marker,gt.from==null),gt.to==null)return;gt.to==Q&&(gt=!1)}}if(Q>=X)break;for(var Br=Math.min(X,we);;){if(ve){var Dr=Q+ve.length;if(!gt){var Yn=Dr>Br?ve.slice(0,Br-Q):ve;t.addToken(t,Yn,be?be+We:We,it,Q+Yn.length==we?Ye:"",Pe,St)}if(Dr>=Br){ve=ve.slice(Br-Q),Q=Br;break}Q=Dr,it=""}ve=o.slice(A,A=r[re++]),be=tn(r[re++],t.cm.options)}}}function dn(e,t,r){this.line=t,this.rest=ti(t),this.size=this.rest?Ft(x(this.rest))-r+1:1,this.node=this.text=null,this.hidden=pn(e,t)}function Vn(e,t,r){for(var n=[],o,A=t;A<r;A=o){var j=new dn(e.doc,Be(e.doc,A),A);o=A+j.size,n.push(j)}return n}var Kn=null;function Nr(e){Kn?Kn.ops.push(e):e.ownsGroup=Kn={ops:[e],delayedCallbacks:[]}}function Ja(e){var t=e.delayedCallbacks,r=0;do{for(;r<t.length;r++)t[r].call(null);for(var n=0;n<e.ops.length;n++){var o=e.ops[n];if(o.cursorActivityHandlers)for(;o.cursorActivityCalled<o.cursorActivityHandlers.length;)o.cursorActivityHandlers[o.cursorActivityCalled++].call(null,o.cm)}}while(r<t.length)}function Qa(e,t){var r=e.ownsGroup;if(!r)return;try{Ja(r)}finally{Kn=null,t(r)}}var Si=null;function Zn(e,t){var r=xt(e,t);if(!r.length)return;var n=Array.prototype.slice.call(arguments,2),o;Kn?o=Kn.delayedCallbacks:Si?o=Si:(o=Si=[],setTimeout(Za,0));for(var A=function(X){o.push(function(){return r[X].apply(null,n)})},j=0;j<r.length;++j)A(j)}function Za(){var e=Si;Si=null;for(var t=0;t<e.length;++t)e[t]()}function Fi(e,t,r,n){for(var o=0;o<t.changes.length;o++){var A=t.changes[o];A=="text"?qa(e,t):A=="gutter"?Aa(e,t,r,n):A=="class"?ta(e,t):A=="widget"&&Ti(e,t,n)}t.changes=null}function fi(e){return e.node==e.text&&(e.node=a("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),H&&N<8&&(e.node.style.zIndex=2)),e.node}function ui(e,t){var r=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(r&&(r+=" CodeMirror-linebackground"),t.background)r?t.background.className=r:(t.background.parentNode.removeChild(t.background),t.background=null);else if(r){var n=fi(t);t.background=n.insertBefore(a("div",null,r),n.firstChild),e.display.input.setUneditable(t.background)}}function wa(e,t){var r=e.display.externalMeasured;return r&&r.line==t.line?(e.display.externalMeasured=null,t.measure=r.measure,r.built):sn(e,t)}function qa(e,t){var r=t.text.className,n=wa(e,t);t.text==t.node&&(t.node=n.pre),t.text.parentNode.replaceChild(n.pre,t.text),t.text=n.pre,n.bgClass!=t.bgClass||n.textClass!=t.textClass?(t.bgClass=n.bgClass,t.textClass=n.textClass,ta(e,t)):r&&(t.text.className=r)}function ta(e,t){ui(e,t),t.line.wrapClass?fi(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var r=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=r||""}function Aa(e,t,r,n){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var o=fi(t);t.gutterBackground=a("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px; width: "+n.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),o.insertBefore(t.gutterBackground,t.text)}var A=t.line.gutterMarkers;if(e.options.lineNumbers||A){var j=fi(t),X=t.gutter=a("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px");if(e.display.input.setUneditable(X),j.insertBefore(X,t.text),t.line.gutterClass&&(X.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!A||!A["CodeMirror-linenumbers"])&&(t.lineNumber=X.appendChild(a("div",Je(e.options,r),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+n.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),A)for(var Q=0;Q<e.display.gutterSpecs.length;++Q){var re=e.display.gutterSpecs[Q].className,ve=A.hasOwnProperty(re)&&A[re];ve&&X.appendChild(a("div",[ve],"CodeMirror-gutter-elt","left: "+n.gutterLeft[re]+"px; width: "+n.gutterWidth[re]+"px"))}}}function Ti(e,t,r){t.alignable&&(t.alignable=null);for(var n=y("CodeMirror-linewidget"),o=t.node.firstChild,A=void 0;o;o=A)A=o.nextSibling,n.test(o.className)&&t.node.removeChild(o);na(e,t,r)}function Ra(e,t,r,n){var o=wa(e,t);return t.text=t.node=o.pre,o.bgClass&&(t.bgClass=o.bgClass),o.textClass&&(t.textClass=o.textClass),ta(e,t),Aa(e,t,r,n),na(e,t,n),t.node}function na(e,t,r){if(wi(e,t.line,t,r,!0),t.rest)for(var n=0;n<t.rest.length;n++)wi(e,t.rest[n],t,r,!1)}function wi(e,t,r,n,o){if(!t.widgets)return;for(var A=fi(r),j=0,X=t.widgets;j<X.length;++j){var Q=X[j],re=a("div",[Q.node],"CodeMirror-linewidget"+(Q.className?" "+Q.className:""));Q.handleMouseEvents||re.setAttribute("cm-ignore-events","true"),eo(Q,re,r,n),e.display.input.setUneditable(re),o&&Q.above?A.insertBefore(re,r.gutter||r.text):A.appendChild(re),Zn(Q,"redraw")}}function eo(e,t,r,n){if(e.noHScroll){(r.alignable||(r.alignable=[])).push(t);var o=n.wrapperWidth;t.style.left=n.fixedPos+"px",e.coverGutter||(o-=n.gutterTotalWidth,t.style.paddingLeft=n.gutterTotalWidth+"px"),t.style.width=o+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-n.gutterTotalWidth+"px"))}function pi(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!b(document.body,e.node)){var r="position: relative;";e.coverGutter&&(r+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(r+="width: "+t.display.wrapper.clientWidth+"px;"),s(t.display.measure,a("div",[e.node],null,r))}return e.height=e.node.parentNode.offsetHeight}function Yr(e,t){for(var r=ce(t);r!=e.wrapper;r=r.parentNode)if(!r||r.nodeType==1&&r.getAttribute("cm-ignore-events")=="true"||r.parentNode==e.sizer&&r!=e.mover)return!0}function ji(e){return e.lineSpace.offsetTop}function Ai(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function La(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=s(e.measure,a("pre","x","CodeMirror-line-like")),r=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,n={left:parseInt(r.paddingLeft),right:parseInt(r.paddingRight)};return!isNaN(n.left)&&!isNaN(n.right)&&(e.cachedPaddingH=n),n}function zr(e){return xe-e.display.nativeBarWidth}function Jr(e){return e.display.scroller.clientWidth-zr(e)-e.display.barWidth}function Ri(e){return e.display.scroller.clientHeight-zr(e)-e.display.barHeight}function lt(e,t,r){var n=e.options.lineWrapping,o=n&&Jr(e);if(!t.measure.heights||n&&t.measure.width!=o){var A=t.measure.heights=[];if(n){t.measure.width=o;for(var j=t.text.firstChild.getClientRects(),X=0;X<j.length-1;X++){var Q=j[X],re=j[X+1];Math.abs(Q.bottom-re.bottom)>2&&A.push((Q.bottom+re.top)/2-r.top)}}A.push(r.bottom-r.top)}}function tt(e,t,r){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var n=0;n<e.rest.length;n++)if(e.rest[n]==t)return{map:e.measure.maps[n],cache:e.measure.caches[n]};for(var o=0;o<e.rest.length;o++)if(Ft(e.rest[o])>r)return{map:e.measure.maps[o],cache:e.measure.caches[o],before:!0}}function Fe(e,t){t=Er(t);var r=Ft(t),n=e.display.externalMeasured=new dn(e.doc,t,r);n.lineN=r;var o=n.built=sn(e,n);return n.text=o.pre,s(e.display.lineMeasure,o.pre),n}function Ne(e,t,r,n){return ct(e,ot(e,t),r,n)}function ut(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[Pi(e,t)];var r=e.display.externalMeasured;if(r&&t>=r.lineN&&t<r.lineN+r.size)return r}function ot(e,t){var r=Ft(t),n=ut(e,r);n&&!n.text?n=null:n&&n.changes&&(Fi(e,n,r,ra(e)),e.curOp.forceUpdate=!0),n||(n=Fe(e,t));var o=tt(n,t,r);return{line:t,view:n,rect:null,map:o.map,cache:o.cache,before:o.before,hasHeights:!1}}function ct(e,t,r,n,o){t.before&&(r=-1);var A=r+(n||""),j;return t.cache.hasOwnProperty(A)?j=t.cache[A]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(lt(e,t.view,t.rect),t.hasHeights=!0),j=hn(e,t,r,n),j.bogus||(t.cache[A]=j)),{left:j.left,right:j.right,top:o?j.rtop:j.top,bottom:o?j.rbottom:j.bottom}}var zt={left:0,right:0,top:0,bottom:0};function en(e,t,r){for(var n,o,A,j,X,Q,re=0;re<e.length;re+=3)if(X=e[re],Q=e[re+1],t<X?(o=0,A=1,j="left"):t<Q?(o=t-X,A=o+1):(re==e.length-3||t==Q&&e[re+3]>t)&&(A=Q-X,o=A-1,t>=Q&&(j="right")),o!=null){if(n=e[re+2],X==Q&&r==(n.insertLeft?"left":"right")&&(j=r),r=="left"&&o==0)for(;re&&e[re-2]==e[re-3]&&e[re-1].insertLeft;)n=e[(re-=3)+2],j="left";if(r=="right"&&o==Q-X)for(;re<e.length-3&&e[re+3]==e[re+4]&&!e[re+5].insertLeft;)n=e[(re+=3)+2],j="right";break}return{node:n,start:o,end:A,collapse:j,coverStart:X,coverEnd:Q}}function gn(e,t){var r=zt;if(t=="left")for(var n=0;n<e.length&&!((r=e[n]).left!=r.right);n++);else for(var o=e.length-1;o>=0&&!((r=e[o]).left!=r.right);o--);return r}function hn(e,t,r,n){var o=en(t.map,r,n),A=o.node,j=o.start,X=o.end,Q=o.collapse,re;if(A.nodeType==3){for(var ve=0;ve<4;ve++){for(;j&&Ie(t.line.text.charAt(o.coverStart+j));)--j;for(;o.coverStart+X<o.coverEnd&&Ie(t.line.text.charAt(o.coverStart+X));)++X;if(H&&N<9&&j==0&&X==o.coverEnd-o.coverStart?re=A.parentNode.getBoundingClientRect():re=gn(m(A,j,X).getClientRects(),n),re.left||re.right||j==0)break;X=j,j=j-1,Q="right"}H&&N<11&&(re=vn(e.display.measure,re))}else{j>0&&(Q=n="right");var be;e.options.lineWrapping&&(be=A.getClientRects()).length>1?re=be[n=="right"?be.length-1:0]:re=A.getBoundingClientRect()}if(H&&N<9&&!j&&(!re||!re.left&&!re.right)){var Pe=A.parentNode.getClientRects()[0];Pe?re={left:Pe.left,right:Pe.left+Rr(e.display),top:Pe.top,bottom:Pe.bottom}:re=zt}for(var we=re.top-t.rect.top,We=re.bottom-t.rect.top,Ye=(we+We)/2,it=t.view.measure.heights,gt=0;gt<it.length-1&&!(Ye<it[gt]);gt++);var St=gt?it[gt-1]:0,vt=it[gt],Mt={left:(Q=="right"?re.right:re.left)-t.rect.left,right:(Q=="left"?re.left:re.right)-t.rect.left,top:St,bottom:vt};return!re.left&&!re.right&&(Mt.bogus=!0),e.options.singleCursorHeightPerLine||(Mt.rtop=we,Mt.rbottom=We),Mt}function vn(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!It(e))return t;var r=screen.logicalXDPI/screen.deviceXDPI,n=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*r,right:t.right*r,top:t.top*n,bottom:t.bottom*n}}function cn(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function Gn(e){e.display.externalMeasure=null,h(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)cn(e.display.view[t])}function wn(e){Gn(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function An(){return _&&f?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function nr(){return _&&f?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function Xn(e){var t=0;if(e.widgets)for(var r=0;r<e.widgets.length;++r)e.widgets[r].above&&(t+=pi(e.widgets[r]));return t}function Fn(e,t,r,n,o){if(!o){var A=Xn(t);r.top+=A,r.bottom+=A}if(n=="line")return r;n||(n="local");var j=Fr(t);if(n=="local"?j+=ji(e.display):j-=e.display.viewOffset,n=="page"||n=="window"){var X=e.display.lineSpace.getBoundingClientRect();j+=X.top+(n=="window"?0:nr());var Q=X.left+(n=="window"?0:An());r.left+=Q,r.right+=Q}return r.top+=j,r.bottom+=j,r}function rr(e,t,r){if(r=="div")return t;var n=t.left,o=t.top;if(r=="page")n-=An(),o-=nr();else if(r=="local"||!r){var A=e.display.sizer.getBoundingClientRect();n+=A.left,o+=A.top}var j=e.display.lineSpace.getBoundingClientRect();return{left:n-j.left,top:o-j.top}}function xr(e,t,r,n,o){return n||(n=Be(e.doc,t.line)),Fn(e,n,Ne(e,n,t.ch,o),r)}function Qt(e,t,r,n,o,A){n=n||Be(e.doc,t.line),o||(o=ot(e,n));function j(We,Ye){var it=ct(e,o,We,Ye?"right":"left",A);return Ye?it.left=it.right:it.right=it.left,Fn(e,n,it,r)}var X=rt(n,e.doc.direction),Q=t.ch,re=t.sticky;if(Q>=n.text.length?(Q=n.text.length,re="before"):Q<=0&&(Q=0,re="after"),!X)return j(re=="before"?Q-1:Q,re=="before");function ve(We,Ye,it){var gt=X[Ye],St=gt.level==1;return j(it?We-1:We,St!=it)}var be=Ze(X,Q,re),Pe=at,we=ve(Q,be,re=="before");return Pe!=null&&(we.other=ve(Q,Pe,re!="before")),we}function un(e,t){var r=0;t=Pt(e.doc,t),e.options.lineWrapping||(r=Rr(e.display)*t.ch);var n=Be(e.doc,t.line),o=Fr(n)+ji(e.display);return{left:r,right:r,top:o,bottom:o+n.height}}function Mn(e,t,r,n,o){var A=je(e,t,r);return A.xRel=o,n&&(A.outside=n),A}function ir(e,t,r){var n=e.doc;if(r+=e.display.viewOffset,r<0)return Mn(n.first,0,null,-1,-1);var o=Vt(n,r),A=n.first+n.size-1;if(o>A)return Mn(n.first+n.size-1,Be(n,A).text.length,null,1,1);t<0&&(t=0);for(var j=Be(n,o);;){var X=xn(e,j,o,t,r),Q=Ar(j,X.ch+(X.xRel>0||X.outside>0?1:0));if(!Q)return X;var re=Q.find(1);if(re.line==o)return re;j=Be(n,o=re.line)}}function $n(e,t,r,n){n-=Xn(t);var o=t.text.length,A=Ve(function(j){return ct(e,r,j-1).bottom<=n},o,0);return o=Ve(function(j){return ct(e,r,j).top>n},A,o),{begin:A,end:o}}function _r(e,t,r,n){r||(r=ot(e,t));var o=Fn(e,t,ct(e,r,n),"line").top;return $n(e,t,r,o)}function Cr(e,t,r,n){return e.bottom<=r?!1:e.top>r?!0:(n?e.left:e.right)>t}function xn(e,t,r,n,o){o-=Fr(t);var A=ot(e,t),j=Xn(t),X=0,Q=t.text.length,re=!0,ve=rt(t,e.doc.direction);if(ve){var be=(e.options.lineWrapping?ar:Pn)(e,t,r,A,ve,n,o);re=be.level!=1,X=re?be.from:be.to-1,Q=re?be.to:be.from-1}var Pe=null,we=null,We=Ve(function($t){var Ht=ct(e,A,$t);return Ht.top+=j,Ht.bottom+=j,Cr(Ht,n,o,!1)?(Ht.top<=o&&Ht.left<=n&&(Pe=$t,we=Ht),!0):!1},X,Q),Ye,it,gt=!1;if(we){var St=n-we.left<we.right-n,vt=St==re;We=Pe+(vt?0:1),it=vt?"after":"before",Ye=St?we.left:we.right}else{!re&&(We==Q||We==X)&&We++,it=We==0?"after":We==t.text.length?"before":ct(e,A,We-(re?1:0)).bottom+j<=o==re?"after":"before";var Mt=Qt(e,je(r,We,it),"line",t,A);Ye=Mt.left,gt=o<Mt.top?-1:o>=Mt.bottom?1:0}return We=De(t.text,We,1),Mn(r,We,it,gt,n-Ye)}function Pn(e,t,r,n,o,A,j){var X=Ve(function(be){var Pe=o[be],we=Pe.level!=1;return Cr(Qt(e,je(r,we?Pe.to:Pe.from,we?"before":"after"),"line",t,n),A,j,!0)},0,o.length-1),Q=o[X];if(X>0){var re=Q.level!=1,ve=Qt(e,je(r,re?Q.from:Q.to,re?"after":"before"),"line",t,n);Cr(ve,A,j,!0)&&ve.top>j&&(Q=o[X-1])}return Q}function ar(e,t,r,n,o,A,j){var X=$n(e,t,n,j),Q=X.begin,re=X.end;/\s/.test(t.text.charAt(re-1))&&re--;for(var ve=null,be=null,Pe=0;Pe<o.length;Pe++){var we=o[Pe];if(we.from>=re||we.to<=Q)continue;var We=we.level!=1,Ye=ct(e,n,We?Math.min(re,we.to)-1:Math.max(Q,we.from)).right,it=Ye<A?A-Ye+1e9:Ye-A;(!ve||be>it)&&(ve=we,be=it)}return ve||(ve=o[o.length-1]),ve.from<Q&&(ve={from:Q,to:ve.to,level:ve.level}),ve.to>re&&(ve={from:ve.from,to:re,level:ve.level}),ve}var pr;function or(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(pr==null){pr=a("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)pr.appendChild(document.createTextNode("x")),pr.appendChild(a("br"));pr.appendChild(document.createTextNode("x"))}s(e.measure,pr);var r=pr.offsetHeight/50;return r>3&&(e.cachedTextHeight=r),h(e.measure),r||1}function Rr(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=a("span","xxxxxxxxxx"),r=a("pre",[t],"CodeMirror-line-like");s(e.measure,r);var n=t.getBoundingClientRect(),o=(n.right-n.left)/10;return o>2&&(e.cachedCharWidth=o),o||10}function ra(e){for(var t=e.display,r={},n={},o=t.gutters.clientLeft,A=t.gutters.firstChild,j=0;A;A=A.nextSibling,++j){var X=e.display.gutterSpecs[j].className;r[X]=A.offsetLeft+A.clientLeft+o,n[X]=A.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=or(e.display),r=e.options.lineWrapping,n=r&&Math.max(5,e.display.scroller.clientWidth/Rr(e.display)-3);return function(o){if(pn(e.doc,o))return 0;var A=0;if(o.widgets)for(var j=0;j<o.widgets.length;j++)o.widgets[j].height&&(A+=o.widgets[j].height);return r?A+(Math.ceil(o.text.length/n)||1)*t:A+t}}function to(e){var t=e.doc,r=Lo(e);t.iter(function(n){var o=r(n);o!=n.height&&Lt(n,o)})}function Li(e,t,r,n){var o=e.display;if(!r&&ce(t).getAttribute("cm-not-content")=="true")return null;var A,j,X=o.lineSpace.getBoundingClientRect();try{A=t.clientX-X.left,j=t.clientY-X.top}catch(be){return null}var Q=ir(e,A,j),re;if(n&&Q.xRel>0&&(re=Be(e.doc,Q.line).text).length==Q.ch){var ve=ie(re,re.length,e.options.tabSize)-re.length;Q=je(Q.line,Math.max(0,Math.round((A-La(e.display).left)/Rr(e.display))-ve))}return Q}function Pi(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;n<r.length;n++)if(t-=r[n].size,t<0)return n}function Lr(e,t,r,n){t==null&&(t=e.doc.first),r==null&&(r=e.doc.first+e.doc.size),n||(n=0);var o=e.display;if(n&&r<o.viewTo&&(o.updateLineNumbers==null||o.updateLineNumbers>t)&&(o.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=o.viewTo)Wn&&Ci(e.doc,t)<o.viewTo&&gi(e);else if(r<=o.viewFrom)Wn&&Vr(e.doc,r+n)>o.viewFrom?gi(e):(o.viewFrom+=n,o.viewTo+=n);else if(t<=o.viewFrom&&r>=o.viewTo)gi(e);else if(t<=o.viewFrom){var A=Pa(e,r,r+n,1);A?(o.view=o.view.slice(A.index),o.viewFrom=A.lineN,o.viewTo+=n):gi(e)}else if(r>=o.viewTo){var j=Pa(e,t,t,-1);j?(o.view=o.view.slice(0,j.index),o.viewTo=j.lineN):gi(e)}else{var X=Pa(e,t,t,-1),Q=Pa(e,r,r+n,1);X&&Q?(o.view=o.view.slice(0,X.index).concat(Vn(e,X.lineN,Q.lineN)).concat(o.view.slice(Q.index)),o.viewTo+=n):gi(e)}var re=o.externalMeasured;re&&(r<re.lineN?re.lineN+=n:t<re.lineN+re.size&&(o.externalMeasured=null))}function mi(e,t,r){e.curOp.viewChanged=!0;var n=e.display,o=e.display.externalMeasured;if(o&&t>=o.lineN&&t<o.lineN+o.size&&(n.externalMeasured=null),t<n.viewFrom||t>=n.viewTo)return;var A=n.view[Pi(e,t)];if(A.node==null)return;var j=A.changes||(A.changes=[]);ye(j,r)==-1&&j.push(r)}function gi(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Pa(e,t,r,n){var o=Pi(e,t),A,j=e.display.view;if(!Wn||r==e.doc.first+e.doc.size)return{index:o,lineN:r};for(var X=e.display.viewFrom,Q=0;Q<o;Q++)X+=j[Q].size;if(X!=t){if(n>0){if(o==j.length-1)return null;A=X+j[o].size-t,o++}else A=X-t;t+=A,r+=A}for(;Ci(e.doc,r)!=r;){if(o==(n<0?0:j.length-1))return null;r+=n*j[o-(n<0?1:0)].size,o+=n}return{index:o,lineN:r}}function Vs(e,t,r){var n=e.display,o=n.view;o.length==0||t>=n.viewTo||r<=n.viewFrom?(n.view=Vn(e,t,r),n.viewFrom=t):(n.viewFrom>t?n.view=Vn(e,t,n.viewFrom).concat(n.view):n.viewFrom<t&&(n.view=n.view.slice(Pi(e,t))),n.viewFrom=t,n.viewTo<r?n.view=n.view.concat(Vn(e,n.viewTo,r)):n.viewTo>r&&(n.view=n.view.slice(0,Pi(e,r)))),n.viewTo=r}function Po(e){for(var t=e.display.view,r=0,n=0;n<t.length;n++){var o=t[n];!o.hidden&&(!o.node||o.changes)&&++r}return r}function aa(e){e.display.input.showSelection(e.display.input.prepareSelection())}function Do(e,t){t===void 0&&(t=!0);for(var r=e.doc,n={},o=n.cursors=document.createDocumentFragment(),A=n.selection=document.createDocumentFragment(),j=0;j<r.sel.ranges.length;j++){if(!t&&j==r.sel.primIndex)continue;var X=r.sel.ranges[j];if(X.from().line>=e.display.viewTo||X.to().line<e.display.viewFrom)continue;var Q=X.empty();(Q||e.options.showCursorWhenSelecting)&&Oo(e,X.head,o),Q||Xs(e,X,A)}return n}function Oo(e,t,r){var n=Qt(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),o=r.appendChild(a("div","\xA0","CodeMirror-cursor"));if(o.style.left=n.left+"px",o.style.top=n.top+"px",o.style.height=Math.max(0,n.bottom-n.top)*e.options.cursorHeight+"px",n.other){var A=r.appendChild(a("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));A.style.display="",A.style.left=n.other.left+"px",A.style.top=n.other.top+"px",A.style.height=(n.other.bottom-n.other.top)*.85+"px"}}function Da(e,t){return e.top-t.top||e.left-t.left}function Xs(e,t,r){var n=e.display,o=e.doc,A=document.createDocumentFragment(),j=La(e.display),X=j.left,Q=Math.max(n.sizerWidth,Jr(e)-n.sizer.offsetLeft)-j.right,re=o.direction=="ltr";function ve(vt,Mt,$t,Ht){Mt<0&&(Mt=0),Mt=Math.round(Mt),Ht=Math.round(Ht),A.appendChild(a("div",null,"CodeMirror-selected","position: absolute; left: "+vt+`px;
top: `+Mt+"px; width: "+($t==null?Q-vt:$t)+`px;
height: `+(Ht-Mt)+"px"))}function be(vt,Mt,$t){var Ht=Be(o,vt),nn=Ht.text.length,_n,ur;function In(Yn,Or){return xr(e,je(vt,Yn),"div",Ht,Or)}function Br(Yn,Or,cr){var qn=_r(e,Ht,null,Yn),Jn=Or=="ltr"==(cr=="after")?"left":"right",jn=cr=="after"?qn.begin:qn.end-(/\s/.test(Ht.text.charAt(qn.end-1))?2:1);return In(jn,Jn)[Jn]}var Dr=rt(Ht,o.direction);return Qe(Dr,Mt||0,$t==null?nn:$t,function(Yn,Or,cr,qn){var Jn=cr=="ltr",jn=In(Yn,Jn?"left":"right"),kr=In(Or-1,Jn?"right":"left"),qi=Mt==null&&Yn==0,_i=$t==null&&Or==nn,gr=qn==0,ri=!Dr||qn==Dr.length-1;if(kr.top-jn.top<=3){var dr=(re?qi:_i)&&gr,Ao=(re?_i:qi)&&ri,ci=dr?X:(Jn?jn:kr).left,Ii=Ao?Q:(Jn?kr:jn).right;ve(ci,jn.top,Ii-ci,jn.bottom)}else{var Ni,Tr,ea,Ro;Jn?(Ni=re&&qi&&gr?X:jn.left,Tr=re?Q:Br(Yn,cr,"before"),ea=re?X:Br(Or,cr,"after"),Ro=re&&_i&&ri?Q:kr.right):(Ni=re?Br(Yn,cr,"before"):X,Tr=!re&&qi&&gr?Q:jn.right,ea=!re&&_i&&ri?X:kr.left,Ro=re?Br(Or,cr,"after"):Q),ve(Ni,jn.top,Tr-Ni,jn.bottom),jn.bottom<kr.top&&ve(X,jn.bottom,null,kr.top),ve(ea,kr.top,Ro-ea,kr.bottom)}(!_n||Da(jn,_n)<0)&&(_n=jn),Da(kr,_n)<0&&(_n=kr),(!ur||Da(jn,ur)<0)&&(ur=jn),Da(kr,ur)<0&&(ur=kr)}),{start:_n,end:ur}}var Pe=t.from(),we=t.to();if(Pe.line==we.line)be(Pe.line,Pe.ch,we.ch);else{var We=Be(o,Pe.line),Ye=Be(o,we.line),it=Er(We)==Er(Ye),gt=be(Pe.line,Pe.ch,it?We.text.length+1:null).end,St=be(we.line,it?0:null,we.ch).start;it&&(gt.top<St.top-2?(ve(gt.right,gt.top,null,gt.bottom),ve(X,St.top,St.left,St.bottom)):ve(gt.right,gt.top,St.left-gt.right,gt.bottom)),gt.bottom<St.top&&ve(X,gt.bottom,null,St.top)}r.appendChild(A)}function no(e){if(!e.state.focused)return;var t=e.display;clearInterval(t.blinker);var r=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?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||(se(e,"focus",e,t),e.state.focused=!0,K(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),k&&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&&(se(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<t.view.length;n++){var o=t.view[n],A=e.options.lineWrapping,j=void 0,X=0;if(o.hidden)continue;if(H&&N<8){var Q=o.node.offsetTop+o.node.offsetHeight;j=Q-r,r=Q}else{var re=o.node.getBoundingClientRect();j=re.bottom-re.top,!A&&o.text.firstChild&&(X=o.text.firstChild.getBoundingClientRect().right-re.left-1)}var ve=o.line.height-j;if((ve>.005||ve<-.005)&&(Lt(o.line,j),Io(o.line),o.rest))for(var be=0;be<o.rest.length;be++)Io(o.rest[be]);if(X>e.display.sizerWidth){var Pe=Math.ceil(X/Rr(e.display));Pe>e.display.maxLineLength&&(e.display.maxLineLength=Pe,e.display.maxLine=o.line,e.display.maxLineChanged=!0)}}}function Io(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var r=e.widgets[t],n=r.node.parentNode;n&&(r.height=n.offsetHeight)}}function ka(e,t,r){var n=r&&r.top!=null?Math.max(0,r.top):e.scroller.scrollTop;n=Math.floor(n-ji(e));var o=r&&r.bottom!=null?r.bottom:n+e.wrapper.clientHeight,A=Vt(t,n),j=Vt(t,o);if(r&&r.ensure){var X=r.ensure.from.line,Q=r.ensure.to.line;X<A?(A=X,j=Vt(t,Fr(Be(t,X))+e.wrapper.clientHeight)):Math.min(Q,t.lastLine())>=j&&(A=Vt(t,Fr(Be(t,Q))-e.wrapper.clientHeight),j=Q)}return{from:A,to:Math.max(j,A+1)}}function $s(e,t){if(Z(e,"scrollCursorIntoView"))return;var r=e.display,n=r.sizer.getBoundingClientRect(),o=null;if(t.top+n.top<0?o=!0:t.bottom+n.top>(window.innerHeight||document.documentElement.clientHeight)&&(o=!1),o!=null&&!C){var A=a("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(A),A.scrollIntoView(o),e.display.lineSpace.removeChild(A)}}function Ys(e,t,r,n){n==null&&(n=0);var o;!e.options.lineWrapping&&t==r&&(t=t.ch?je(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,r=t.sticky=="before"?je(t.line,t.ch+1,"before"):t);for(var A=0;A<5;A++){var j=!1,X=Qt(e,t),Q=!r||r==t?X:Qt(e,r);o={left:Math.min(X.left,Q.left),top:Math.min(X.top,Q.top)-n,right:Math.max(X.left,Q.left),bottom:Math.max(X.bottom,Q.bottom)+n};var re=io(e,o),ve=e.doc.scrollTop,be=e.doc.scrollLeft;if(re.scrollTop!=null&&(sa(e,re.scrollTop),Math.abs(e.doc.scrollTop-ve)>1&&(j=!0)),re.scrollLeft!=null&&(Di(e,re.scrollLeft),Math.abs(e.doc.scrollLeft-be)>1&&(j=!0)),!j)break}return o}function Js(e,t){var r=io(e,t);r.scrollTop!=null&&sa(e,r.scrollTop),r.scrollLeft!=null&&Di(e,r.scrollLeft)}function io(e,t){var r=e.display,n=or(e.display);t.top<0&&(t.top=0);var o=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:r.scroller.scrollTop,A=Ri(e),j={};t.bottom-t.top>A&&(t.bottom=t.top+A);var X=e.doc.height+Ai(r),Q=t.top<n,re=t.bottom>X-n;if(t.top<o)j.scrollTop=Q?0:t.top;else if(t.bottom>o+A){var ve=Math.min(t.top,(re?X:t.bottom)-A);ve!=o&&(j.scrollTop=ve)}var be=e.options.fixedGutter?0:r.gutters.offsetWidth,Pe=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:r.scroller.scrollLeft-be,we=Jr(e)-r.gutters.offsetWidth,We=t.right-t.left>we;return We&&(t.right=t.left+we),t.left<10?j.scrollLeft=0:t.left<Pe?j.scrollLeft=Math.max(0,t.left+be-(We?0:10)):t.right>we+Pe-3&&(j.scrollLeft=t.right+(We?0:10)-we),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=un(e,t.from),n=un(e,t.to);No(e,r,n,t.margin)}}function No(e,t,r,n){var o=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,o.scrollLeft,o.scrollTop)}function sa(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;P||so(e,{top:t}),Uo(e,t,!0),P&&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 Di(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+Ai(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 Oi=function(e,t,r){this.cm=r;var n=this.vert=a("div",[a("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),o=this.horiz=a("div",[a("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");n.tabIndex=o.tabIndex=-1,e(n),e(o),Me(n,"scroll",function(){n.clientHeight&&t(n.scrollTop,"vertical")}),Me(o,"scroll",function(){o.clientWidth&&t(o.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,H&&N<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Oi.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 o=e.viewHeight-(t?n:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+o)+"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 A=e.viewWidth-e.barLeft-(r?n:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+A)+"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}},Oi.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Oi.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Oi.prototype.zeroWidthHack=function(){var e=i&&!T?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new ge,this.disableVert=new ge},Oi.prototype.enableZeroWidthBar=function(e,t,r){e.style.pointerEvents="auto";function n(){var o=e.getBoundingClientRect(),A=r=="vert"?document.elementFromPoint(o.right-1,(o.top+o.bottom)/2):document.elementFromPoint((o.right+o.left)/2,o.bottom-1);A!=e?e.style.pointerEvents="none":t.set(1e3,n)}t.set(1e3,n)},Oi.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 o=0;o<4&&r!=e.display.barWidth||n!=e.display.barHeight;o++)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:Oi,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),Me(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"?Di(e,t):sa(e,t)},e),e.display.scrollbars.addClass&&K(e.display.wrapper,e.display.scrollbars.addClass)}var Zs=0;function ki(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},Nr(e.curOp)}function Mi(e){var t=e.curOp;t&&Qa(t,function(r){for(var n=0;n<r.ops.length;n++)r.ops[n].cm.curOp=null;qs(r)})}function qs(e){for(var t=e.ops,r=0;r<t.length;r++)el(t[r]);for(var n=0;n<t.length;n++)tl(t[n]);for(var o=0;o<t.length;o++)nl(t[o]);for(var A=0;A<t.length;A++)rl(t[A]);for(var j=0;j<t.length;j++)il(t[j])}function el(e){var t=e.cm,r=t.display;ol(t),e.updateMaxLine&&$r(t),e.mustUpdate=e.viewChanged||e.forceUpdate||e.scrollTop!=null||e.scrollToPos&&(e.scrollToPos.from.line<r.viewFrom||e.scrollToPos.to.line>=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=Ne(t,r.maxLine,r.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(r.scroller.clientWidth,r.sizer.offsetLeft+e.adjustWidthTo+zr(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,r.sizer.offsetLeft+e.adjustWidthTo-Jr(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=r.input.prepareSelection())}function rl(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&Di(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var r=e.focus&&e.focus==M();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,r),(e.updatedDisplay||e.startHeight!=t.doc.height)&&Ki(t,e.barMeasure),e.updatedDisplay&&uo(t,e.barMeasure),e.selectionChanged&&no(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),r&&ko(e.cm)}function il(e){var t=e.cm,r=t.display,n=t.doc;if(e.updatedDisplay&&Wo(t,e.update),r.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(r.wheelStartX=r.wheelStartY=null),e.scrollTop!=null&&Uo(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&Di(t,e.scrollLeft,!0,!0),e.scrollToPos){var o=Ys(t,Pt(n,e.scrollToPos.from),Pt(n,e.scrollToPos.to),e.scrollToPos.margin);$s(t,o)}var A=e.maybeHiddenMarkers,j=e.maybeUnhiddenMarkers;if(A)for(var X=0;X<A.length;++X)A[X].lines.length||se(A[X],"hide");if(j)for(var Q=0;Q<j.length;++Q)j[Q].lines.length&&se(j[Q],"unhide");r.wrapper.offsetHeight&&(n.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&se(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Ur(e,t){if(e.curOp)return t();ki(e);try{return t()}finally{Mi(e)}}function sr(e,t){return function(){if(e.curOp)return t.apply(e,arguments);ki(e);try{return t.apply(e,arguments)}finally{Mi(e)}}}function Sr(e){return function(){if(this.curOp)return e.apply(this,arguments);ki(this);try{return e.apply(this,arguments)}finally{Mi(this)}}}function lr(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);ki(t);try{return e.apply(this,arguments)}finally{Mi(t)}}}function da(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,G(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var r=+new Date+e.options.workTime,n=Nn(e,t.highlightFrontier),o=[];t.iter(n.line,Math.min(t.first+t.size,e.display.viewTo+500),function(A){if(n.line>=e.display.viewFrom){var j=A.styles,X=A.text.length>e.options.maxHighlightLength?bt(t.mode,n.state):null,Q=Hr(e,A,n,!0);X&&(n.state=X),A.styles=Q.styles;var re=A.styleClasses,ve=Q.classes;ve?A.styleClasses=ve:re&&(A.styleClasses=null);for(var be=!j||j.length!=A.styles.length||re!=ve&&(!re||!ve||re.bgClass!=ve.bgClass||re.textClass!=ve.textClass),Pe=0;!be&&Pe<j.length;++Pe)be=j[Pe]!=A.styles[Pe];be&&o.push(n.line),A.stateAfter=n.save(),n.nextLine()}else A.text.length<=e.options.maxHighlightLength&&ii(e,A.text,n),A.stateAfter=n.line%5==0?n.save():null,n.nextLine();if(+new Date>r)return da(e,e.options.workDelay),!0}),t.highlightFrontier=n.line,t.modeFrontier=Math.max(t.modeFrontier,n.line),o.length&&Ur(e,function(){for(var A=0;A<o.length;A++)mi(e,o[A],"text")})}var Ia=function(e,t,r){var n=e.display;this.viewport=t,this.visible=ka(n,e.doc,t),this.editorIsHidden=!n.wrapper.offsetWidth,this.wrapperHeight=n.wrapper.clientHeight,this.wrapperWidth=n.wrapper.clientWidth,this.oldDisplayWidth=Jr(e),this.force=r,this.dims=ra(e),this.events=[]};Ia.prototype.signal=function(e,t){ae(e,t)&&this.events.push(arguments)},Ia.prototype.finish=function(){for(var e=0;e<this.events.length;e++)se.apply(null,this.events[e])};function ol(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=zr(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=zr(e)+"px",t.scrollbarsClipped=!0)}function sl(e){if(e.hasFocus())return null;var t=M();if(!t||!b(e.display.lineDiv,t))return null;var r={activeElt:t};if(window.getSelection){var n=window.getSelection();n.anchorNode&&n.extend&&b(e.display.lineDiv,n.anchorNode)&&(r.anchorNode=n.anchorNode,r.anchorOffset=n.anchorOffset,r.focusNode=n.focusNode,r.focusOffset=n.focusOffset)}return r}function ll(e){if(!e||!e.activeElt||e.activeElt==M())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&b(document.body,e.anchorNode)&&b(document.body,e.focusNode)){var t=window.getSelection(),r=document.createRange();r.setEnd(e.anchorNode,e.anchorOffset),r.collapse(!1),t.removeAllRanges(),t.addRange(r),t.extend(e.focusNode,e.focusOffset)}}function oo(e,t){var r=e.display,n=e.doc;if(t.editorIsHidden)return gi(e),!1;if(!t.force&&t.visible.from>=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)&&(gi(e),t.dims=ra(e));var o=n.first+n.size,A=Math.max(t.visible.from-e.options.viewportMargin,n.first),j=Math.min(o,t.visible.to+e.options.viewportMargin);r.viewFrom<A&&A-r.viewFrom<20&&(A=Math.max(n.first,r.viewFrom)),r.viewTo>j&&r.viewTo-j<20&&(j=Math.min(o,r.viewTo)),Wn&&(A=Ci(e.doc,A),j=Vr(e.doc,j));var X=A!=r.viewFrom||j!=r.viewTo||r.lastWrapHeight!=t.wrapperHeight||r.lastWrapWidth!=t.wrapperWidth;Vs(e,A,j),r.viewOffset=Fr(Be(e.doc,r.viewFrom)),e.display.mover.style.top=r.viewOffset+"px";var Q=Po(e);if(!X&&Q==0&&!t.force&&r.renderedView==r.view&&(r.updateLineNumbers==null||r.updateLineNumbers>=r.viewTo))return!1;var re=sl(e);return Q>4&&(r.lineDiv.style.display="none"),ul(e,r.updateLineNumbers,t.dims),Q>4&&(r.lineDiv.style.display=""),r.renderedView=r.view,ll(re),h(r.cursorDiv),h(r.selectionDiv),r.gutters.style.height=r.sizer.style.minHeight=0,X&&(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==Jr(e)){if(r&&r.top!=null&&(r={top:Math.min(e.doc.height+Ai(e.display)-Ri(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 o=la(e);aa(e),Ki(e,o),uo(e,o),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,o=e.options.lineNumbers,A=n.lineDiv,j=A.firstChild;function X(We){var Ye=We.nextSibling;return k&&i&&e.display.currentWheelTarget==We?We.style.display="none":We.parentNode.removeChild(We),Ye}for(var Q=n.view,re=n.viewFrom,ve=0;ve<Q.length;ve++){var be=Q[ve];if(!be.hidden)if(!be.node||be.node.parentNode!=A){var Pe=Ra(e,be,re,r);A.insertBefore(Pe,j)}else{for(;j!=be.node;)j=X(j);var we=o&&t!=null&&t<=re&&be.lineNumber;be.changes&&(ye(be.changes,"gutter")>-1&&(we=!1),Fi(e,be,re,r)),we&&(h(be.lineNumber),be.lineNumber.appendChild(document.createTextNode(Je(e.options,re)))),j=be.node.nextSibling}re+=be.size}for(;j;)j=X(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,o=t.gutters.offsetWidth,A=n+"px",j=0;j<r.length;j++)if(!r[j].hidden){e.options.fixedGutter&&(r[j].gutter&&(r[j].gutter.style.left=A),r[j].gutterBackground&&(r[j].gutterBackground.style.left=A));var X=r[j].alignable;if(X)for(var Q=0;Q<X.length;Q++)X[Q].style.left=A}e.options.fixedGutter&&(t.gutters.style.left=n+o+"px")}function Ko(e){if(!e.options.lineNumbers)return!1;var t=e.doc,r=Je(e.options,t.first+t.size-1),n=e.display;if(r.length!=n.lineNumChars){var o=n.measure.appendChild(a("div",[a("div",r)],"CodeMirror-linenumber CodeMirror-gutter-elt")),A=o.firstChild.offsetWidth,j=o.offsetWidth-A;return n.lineGutter.style.width="",n.lineNumInnerWidth=Math.max(A,n.lineGutter.offsetWidth-j)+1,n.lineNumWidth=n.lineNumInnerWidth+j,n.lineNumChars=n.lineNumInnerWidth?r.length:-1,n.lineGutter.style.width=n.lineNumWidth+"px",lo(e.display),!0}return!1}function co(e,t){for(var r=[],n=!1,o=0;o<e.length;o++){var A=e[o],j=null;if(typeof A!="string"&&(j=A.style,A=A.className),A=="CodeMirror-linenumbers")if(t)n=!0;else continue;r.push({className:A,style:j})}return t&&!n&&r.push({className:"CodeMirror-linenumbers",style:null}),r}function Go(e){var t=e.gutters,r=e.gutterSpecs;h(t),e.lineGutter=null;for(var n=0;n<r.length;++n){var o=r[n],A=o.className,j=o.style,X=t.appendChild(a("div",null,"CodeMirror-gutter "+A));j&&(X.style.cssText=j),A=="CodeMirror-linenumbers"&&(e.lineGutter=X,X.style.width=(e.lineNumWidth||1)+"px")}t.style.display=r.length?"":"none",lo(e)}function ca(e){Go(e.display),Lr(e),Ho(e)}function dl(e,t,r,n){var o=this;this.input=r,o.scrollbarFiller=a("div",null,"CodeMirror-scrollbar-filler"),o.scrollbarFiller.setAttribute("cm-not-content","true"),o.gutterFiller=a("div",null,"CodeMirror-gutter-filler"),o.gutterFiller.setAttribute("cm-not-content","true"),o.lineDiv=g("div",null,"CodeMirror-code"),o.selectionDiv=a("div",null,null,"position: relative; z-index: 1"),o.cursorDiv=a("div",null,"CodeMirror-cursors"),o.measure=a("div",null,"CodeMirror-measure"),o.lineMeasure=a("div",null,"CodeMirror-measure"),o.lineSpace=g("div",[o.measure,o.lineMeasure,o.selectionDiv,o.cursorDiv,o.lineDiv],null,"position: relative; outline: none");var A=g("div",[o.lineSpace],"CodeMirror-lines");o.mover=a("div",[A],null,"position: relative"),o.sizer=a("div",[o.mover],"CodeMirror-sizer"),o.sizerWidth=null,o.heightForcer=a("div",null,null,"position: absolute; height: "+xe+"px; width: 1px;"),o.gutters=a("div",null,"CodeMirror-gutters"),o.lineGutter=null,o.scroller=a("div",[o.sizer,o.heightForcer,o.gutters],"CodeMirror-scroll"),o.scroller.setAttribute("tabIndex","-1"),o.wrapper=a("div",[o.scrollbarFiller,o.gutterFiller,o.scroller],"CodeMirror"),H&&N<8&&(o.gutters.style.zIndex=-1,o.scroller.style.paddingRight=0),!k&&!(P&&l)&&(o.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(o.wrapper):e(o.wrapper)),o.viewFrom=o.viewTo=t.first,o.reportedViewFrom=o.reportedViewTo=t.first,o.view=[],o.renderedView=null,o.externalMeasured=null,o.viewOffset=0,o.lastWrapHeight=o.lastWrapWidth=0,o.updateLineNumbers=null,o.nativeBarWidth=o.barHeight=o.barWidth=0,o.scrollbarsClipped=!1,o.lineNumWidth=o.lineNumInnerWidth=o.lineNumChars=null,o.alignWidgets=!1,o.cachedCharWidth=o.cachedTextHeight=o.cachedPaddingH=null,o.maxLine=null,o.maxLineLength=0,o.maxLineChanged=!1,o.wheelDX=o.wheelDY=o.wheelStartX=o.wheelStartY=null,o.shift=!1,o.selForContextMenu=null,o.activeTouch=null,o.gutterSpecs=co(n.gutters,n.lineNumbers),Go(o),r.init(o)}var Na=0,jr=null;H?jr=-.53:P?jr=15:_?jr=-.7:D&&(jr=-1/3);function zo(e){var t=e.wheelDeltaX,r=e.wheelDeltaY;return t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),r==null&&e.detail&&e.axis==e.VERTICAL_AXIS?r=e.detail:r==null&&(r=e.wheelDelta),{x:t,y:r}}function cl(e){var t=zo(e);return t.x*=jr,t.y*=jr,t}function Vo(e,t){var r=zo(t),n=r.x,o=r.y,A=e.display,j=A.scroller,X=j.scrollWidth>j.clientWidth,Q=j.scrollHeight>j.clientHeight;if(!(n&&X||o&&Q))return;if(o&&i&&k){e:for(var re=t.target,ve=A.view;re!=j;re=re.parentNode)for(var be=0;be<ve.length;be++)if(ve[be].node==re){e.display.currentWheelTarget=re;break e}}if(n&&!P&&!w&&jr!=null){o&&Q&&sa(e,Math.max(0,j.scrollTop+o*jr)),Di(e,Math.max(0,j.scrollLeft+n*jr)),(!o||o&&Q)&&te(t),A.wheelStartX=null;return}if(o&&jr!=null){var Pe=o*jr,we=e.doc.scrollTop,We=we+A.wrapper.clientHeight;Pe<0?we=Math.max(0,we+Pe-50):We=Math.min(e.doc.height,We+Pe+50),so(e,{top:we,bottom:We})}Na<20&&(A.wheelStartX==null?(A.wheelStartX=j.scrollLeft,A.wheelStartY=j.scrollTop,A.wheelDX=n,A.wheelDY=o,setTimeout(function(){if(A.wheelStartX==null)return;var Ye=j.scrollLeft-A.wheelStartX,it=j.scrollTop-A.wheelStartY,gt=it&&A.wheelDY&&it/A.wheelDY||Ye&&A.wheelDX&&Ye/A.wheelDX;if(A.wheelStartX=A.wheelStartY=null,!gt)return;jr=(jr*Na+gt)/(Na+1),++Na},200)):(A.wheelDX+=n,A.wheelDY+=o))}var Wr=function(e,t){this.ranges=e,this.primIndex=t};Wr.prototype.primary=function(){return this.ranges[this.primIndex]},Wr.prototype.equals=function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var r=this.ranges[t],n=e.ranges[t];if(!Rn(r.anchor,n.anchor)||!Rn(r.head,n.head))return!1}return!0},Wr.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new fn(hr(this.ranges[t].anchor),hr(this.ranges[t].head));return new Wr(e,this.primIndex)},Wr.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},Wr.prototype.contains=function(e,t){t||(t=e);for(var r=0;r<this.ranges.length;r++){var n=this.ranges[r];if(ft(t,n.from())>=0&&ft(e,n.to())<=0)return r}return-1};var fn=function(e,t){this.anchor=e,this.head=t};fn.prototype.from=function(){return Cn(this.anchor,this.head)},fn.prototype.to=function(){return vr(this.anchor,this.head)},fn.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Qr(e,t,r){var n=e&&e.options.selectionsMayTouch,o=t[r];t.sort(function(Pe,we){return ft(Pe.from(),we.from())}),r=ye(t,o);for(var A=1;A<t.length;A++){var j=t[A],X=t[A-1],Q=ft(X.to(),j.from());if(n&&!j.empty()?Q>0:Q>=0){var re=Cn(X.from(),j.from()),ve=vr(X.to(),j.to()),be=X.empty()?j.from()==j.head:X.from()==X.head;A<=r&&--r,t.splice(--A,2,new fn(be?ve:re,be?re:ve))}}return new Wr(t,r)}function vi(e,t){return new Wr([new fn(e,t||e)],0)}function yi(e){return e.text?je(e.from.line+e.text.length-1,x(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Xo(e,t){if(ft(e,t.from)<0)return e;if(ft(e,t.to)<=0)return yi(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+=yi(t).ch-t.to.ch),je(r,n)}function ho(e,t){for(var r=[],n=0;n<e.sel.ranges.length;n++){var o=e.sel.ranges[n];r.push(new fn(Xo(o.anchor,t),Xo(o.head,t)))}return Qr(e.cm,r,e.sel.primIndex)}function $o(e,t,r){return e.line==t.line?je(r.line,e.ch-t.ch+r.ch):je(r.line+(e.line-t.line),e.ch)}function hl(e,t,r){for(var n=[],o=je(e.first,0),A=o,j=0;j<t.length;j++){var X=t[j],Q=$o(X.from,o,A),re=$o(yi(X),o,A);if(o=X.to,A=re,r=="around"){var ve=e.sel.ranges[j],be=ft(ve.head,ve.anchor)<0;n[j]=new fn(be?re:Q,be?Q:re)}else n[j]=new fn(Q,Q)}return new Wr(n,e.sel.primIndex)}function fo(e){e.doc.mode=Ot(e.options,e.doc.modeOption),ha(e)}function ha(e){e.doc.iter(function(t){t.stateAfter&&(t.stateAfter=null),t.styles&&(t.styles=null)}),e.doc.modeFrontier=e.doc.highlightFrontier=e.doc.first,da(e,100),e.state.modeGen++,e.curOp&&Lr(e)}function Yo(e,t){return t.from.ch==0&&t.to.ch==0&&x(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function po(e,t,r,n){function o(St){return r?r[St]:null}function A(St,vt,Mt){ni(St,vt,Mt,n),Zn(St,"change",St,t)}function j(St,vt){for(var Mt=[],$t=St;$t<vt;++$t)Mt.push(new li(re[$t],o($t),n));return Mt}var X=t.from,Q=t.to,re=t.text,ve=Be(e,X.line),be=Be(e,Q.line),Pe=x(re),we=o(re.length-1),We=Q.line-X.line;if(t.full)e.insert(0,j(0,re.length)),e.remove(re.length,e.size-re.length);else if(Yo(e,t)){var Ye=j(0,re.length-1);A(be,be.text,we),We&&e.remove(X.line,We),Ye.length&&e.insert(X.line,Ye)}else if(ve==be)if(re.length==1)A(ve,ve.text.slice(0,X.ch)+Pe+ve.text.slice(Q.ch),we);else{var it=j(1,re.length-1);it.push(new li(Pe+ve.text.slice(Q.ch),we,n)),A(ve,ve.text.slice(0,X.ch)+re[0],o(0)),e.insert(X.line+1,it)}else if(re.length==1)A(ve,ve.text.slice(0,X.ch)+re[0]+be.text.slice(Q.ch),o(0)),e.remove(X.line+1,We);else{A(ve,ve.text.slice(0,X.ch)+re[0],o(0)),A(be,Pe+be.text.slice(Q.ch),we);var gt=j(1,re.length-1);We>1&&e.remove(X.line+1,We-1),e.insert(X.line+1,gt)}Zn(e,"change",e,t)}function bi(e,t,r){function n(o,A,j){if(o.linked)for(var X=0;X<o.linked.length;++X){var Q=o.linked[X];if(Q.doc==A)continue;var re=j&&Q.sharedHist;if(r&&!re)continue;t(Q.doc,re),n(Q.doc,o,re)}}n(e,null,!0)}function Jo(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,to(e),fo(e),Qo(e),e.options.lineWrapping||$r(e),e.options.mode=t.modeOption,Lr(e)}function Qo(e){(e.doc.direction=="rtl"?K:d)(e.display.lineDiv,"CodeMirror-rtl")}function fl(e){Ur(e,function(){Qo(e),Lr(e)})}function Ua(e){this.done=[],this.undone=[],this.undoDepth=Infinity,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function mo(e,t){var r={from:hr(t.from),to:yi(t),text:Rt(e,t.from,t.to)};return es(e,r,t.from.line,t.to.line+1),bi(e,function(n){return es(n,r,t.from.line,t.to.line+1)},!0),r}function Zo(e){for(;e.length;){var t=x(e);if(t.ranges)e.pop();else break}}function pl(e,t){if(t)return Zo(e.done),x(e.done);if(e.done.length&&!x(e.done).ranges)return x(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),x(e.done)}function qo(e,t,r,n){var o=e.history;o.undone.length=0;var A=+new Date,j,X;if((o.lastOp==n||o.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&o.lastModTime>A-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(j=pl(o,o.lastOp==n)))X=x(j.changes),ft(t.from,t.to)==0&&ft(t.from,X.to)==0?X.to=yi(t):j.changes.push(mo(e,t));else{var Q=x(o.done);for((!Q||!Q.ranges)&&Ba(e.sel,o.done),j={changes:[mo(e,t)],generation:o.generation},o.done.push(j);o.done.length>o.undoDepth;)o.done.shift(),o.done[0].ranges||o.done.shift()}o.done.push(r),o.generation=++o.maxGeneration,o.lastModTime=o.lastSelTime=A,o.lastOp=o.lastSelOp=n,o.lastOrigin=o.lastSelOrigin=t.origin,X||se(e,"historyAdded")}function ml(e,t,r,n){var o=t.charAt(0);return o=="*"||o=="+"&&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 o=e.history,A=n&&n.origin;r==o.lastSelOp||A&&o.lastSelOrigin==A&&(o.lastModTime==o.lastSelTime&&o.lastOrigin==A||ml(e,A,x(o.done),t))?o.done[o.done.length-1]=t:Ba(t,o.done),o.lastSelTime=+new Date,o.lastSelOrigin=A,o.lastSelOp=r,n&&n.clearRedo!==!1&&Zo(o.undone)}function Ba(e,t){var r=x(t);r&&r.ranges&&r.equals(e)||t.push(e)}function es(e,t,r,n){var o=t["spans_"+e.id],A=0;e.iter(Math.max(e.first,r),Math.min(e.first+e.size,n),function(j){j.markedSpans&&((o||(o=t["spans_"+e.id]={}))[A]=j.markedSpans),++A})}function vl(e){if(!e)return null;for(var t,r=0;r<e.length;++r)e[r].marker.explicitlyCleared?t||(t=e.slice(0,r)):t&&t.push(e[r]);return t?t.length?t:null:e}function yl(e,t){var r=t["spans_"+e.id];if(!r)return null;for(var n=[],o=0;o<t.text.length;++o)n.push(vl(r[o]));return n}function ts(e,t){var r=yl(e,t),n=En(e,t);if(!r)return n;if(!n)return r;for(var o=0;o<r.length;++o){var A=r[o],j=n[o];if(A&&j){e:for(var X=0;X<j.length;++X){for(var Q=j[X],re=0;re<A.length;++re)if(A[re].marker==Q.marker)continue e;A.push(Q)}}else j&&(r[o]=j)}return r}function Gi(e,t,r){for(var n=[],o=0;o<e.length;++o){var A=e[o];if(A.ranges){n.push(r?Wr.prototype.deepCopy.call(A):A);continue}var j=A.changes,X=[];n.push({changes:X});for(var Q=0;Q<j.length;++Q){var re=j[Q],ve=void 0;if(X.push({from:re.from,to:re.to,text:re.text}),t)for(var be in re)(ve=be.match(/^spans_(\d+)$/))&&(ye(t,Number(ve[1]))>-1&&(x(X)[be]=re[be],delete re[be]))}}return n}function go(e,t,r,n){if(n){var o=e.anchor;if(r){var A=ft(t,o)<0;A!=ft(r,o)<0?(o=t,t=r):A!=ft(t,r)<0&&(t=r)}return new fn(o,t)}else return new fn(r||t,t)}function Fa(e,t,r,n,o){o==null&&(o=e.cm&&(e.cm.display.shift||e.extend)),mr(e,new Wr([go(e.sel.primary(),t,r,o)],0),n)}function ns(e,t,r){for(var n=[],o=e.cm&&(e.cm.display.shift||e.extend),A=0;A<e.sel.ranges.length;A++)n[A]=go(e.sel.ranges[A],t[A],null,o);var j=Qr(e.cm,n,e.sel.primIndex);mr(e,j,r)}function vo(e,t,r,n){var o=e.sel.ranges.slice(0);o[t]=r,mr(e,Qr(e.cm,o,e.sel.primIndex),n)}function rs(e,t,r,n){mr(e,vi(t,r),n)}function bl(e,t,r){var n={ranges:t.ranges,update:function(o){this.ranges=[];for(var A=0;A<o.length;A++)this.ranges[A]=new fn(Pt(e,o[A].anchor),Pt(e,o[A].head))},origin:r&&r.origin};return se(e,"beforeSelectionChange",e,n),e.cm&&se(e.cm,"beforeSelectionChange",e.cm,n),n.ranges!=t.ranges?Qr(e.cm,n.ranges,n.ranges.length-1):t}function is(e,t,r){var n=e.history.done,o=x(n);o&&o.ranges?(n[n.length-1]=t,ja(e,t,r)):mr(e,t,r)}function mr(e,t,r){ja(e,t,r),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,r)}function ja(e,t,r){(ae(e,"beforeSelectionChange")||e.cm&&ae(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,r));var n=r&&r.bias||(ft(t.primary().head,e.sel.primary().head)<0?-1:1);as(e,ss(e,t,n,!0)),!(r&&r.scroll===!1)&&e.cm&&Hi(e.cm)}function as(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,q(e.cm)),Zn(e,"cursorActivity",e)}function os(e){as(e,ss(e,e.sel,null,!1))}function ss(e,t,r,n){for(var o,A=0;A<t.ranges.length;A++){var j=t.ranges[A],X=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[A],Q=Wa(e,j.anchor,X&&X.anchor,r,n),re=Wa(e,j.head,X&&X.head,r,n);(o||Q!=j.anchor||re!=j.head)&&(o||(o=t.ranges.slice(0,A)),o[A]=new fn(Q,re))}return o?Qr(e.cm,o,t.primIndex):t}function zi(e,t,r,n,o){var A=Be(e,t.line);if(A.markedSpans)for(var j=0;j<A.markedSpans.length;++j){var X=A.markedSpans[j],Q=X.marker,re="selectLeft"in Q?!Q.selectLeft:Q.inclusiveLeft,ve="selectRight"in Q?!Q.selectRight:Q.inclusiveRight;if((X.from==null||(re?X.from<=t.ch:X.from<t.ch))&&(X.to==null||(ve?X.to>=t.ch:X.to>t.ch))){if(o&&(se(Q,"beforeCursorEnter"),Q.explicitlyCleared))if(A.markedSpans){--j;continue}else break;if(!Q.atomic)continue;if(r){var be=Q.find(n<0?1:-1),Pe=void 0;if((n<0?ve:re)&&(be=ls(e,be,-n,be&&be.line==t.line?A:null)),be&&be.line==t.line&&(Pe=ft(be,r))&&(n<0?Pe<0:Pe>0))return zi(e,be,t,n,o)}var we=Q.find(n<0?-1:1);return(n<0?re:ve)&&(we=ls(e,we,n,we.line==t.line?A:null)),we?zi(e,we,t,n,o):null}}return t}function Wa(e,t,r,n,o){var A=n||1,j=zi(e,t,r,A,o)||!o&&zi(e,t,r,A,!0)||zi(e,t,r,-A,o)||!o&&zi(e,t,r,-A,!0);return j||(e.cantEdit=!0,je(e.first,0))}function ls(e,t,r,n){return r<0&&t.ch==0?t.line>e.first?Pt(e,je(t.line-1)):null:r>0&&t.ch==(n||Be(e,t.line)).text.length?t.line<e.first+e.size-1?je(t.line+1,0):null:new je(t.line,t.ch+r)}function us(e){e.setSelection(je(e.firstLine(),0),je(e.lastLine()),Se)}function ds(e,t,r){var n={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return n.canceled=!0}};return r&&(n.update=function(o,A,j,X){o&&(n.from=Pt(e,o)),A&&(n.to=Pt(e,A)),j&&(n.text=j),X!==void 0&&(n.origin=X)}),se(e,"beforeChange",e,n),e.cm&&se(e.cm,"beforeChange",e.cm,n),n.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:n.from,to:n.to,text:n.text,origin:n.origin}}function Vi(e,t,r){if(e.cm){if(!e.cm.curOp)return sr(e.cm,Vi)(e,t,r);if(e.cm.state.suppressEdits)return}if((ae(e,"beforeChange")||e.cm&&ae(e.cm,"beforeChange"))&&(t=ds(e,t,!0),!t))return;var n=si&&!r&&On(e,t.from,t.to);if(n)for(var o=n.length-1;o>=0;--o)cs(e,{from:n[o].from,to:n[o].to,text:o?[""]:t.text,origin:t.origin});else cs(e,t)}function cs(e,t){if(t.text.length==1&&t.text[0]==""&&ft(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,En(e,t));var n=[];bi(e,function(o,A){!A&&ye(n,o.history)==-1&&(ms(o.history,t),n.push(o.history)),fa(o,t,null,En(o,t))})}function Ha(e,t,r){var n=e.cm&&e.cm.state.suppressEdits;if(n&&!r)return;for(var o=e.history,A,j=e.sel,X=t=="undo"?o.done:o.undone,Q=t=="undo"?o.undone:o.done,re=0;re<X.length&&!(A=X[re],r?A.ranges&&!A.equals(e.sel):!A.ranges);re++);if(re==X.length)return;for(o.lastOrigin=o.lastSelOrigin=null;;)if(A=X.pop(),A.ranges){if(Ba(A,Q),r&&!A.equals(e.sel)){mr(e,A,{clearRedo:!1});return}j=A}else if(n){X.push(A);return}else break;var ve=[];Ba(j,Q),Q.push({changes:ve,generation:o.generation}),o.generation=A.generation||++o.maxGeneration;for(var be=ae(e,"beforeChange")||e.cm&&ae(e.cm,"beforeChange"),Pe=function(Ye){var it=A.changes[Ye];if(it.origin=t,be&&!ds(e,it,!1))return X.length=0,{};ve.push(mo(e,it));var gt=Ye?ho(e,it):x(X);fa(e,it,gt,ts(e,it)),!Ye&&e.cm&&e.cm.scrollIntoView({from:it.from,to:yi(it)});var St=[];bi(e,function(vt,Mt){!Mt&&ye(St,vt.history)==-1&&(ms(vt.history,it),St.push(vt.history)),fa(vt,it,null,ts(vt,it))})},we=A.changes.length-1;we>=0;--we){var We=Pe(we);if(We)return We.v}}function hs(e,t){if(t==0)return;if(e.first+=t,e.sel=new Wr(R(e.sel.ranges,function(o){return new fn(je(o.anchor.line+t,o.anchor.ch),je(o.head.line+t,o.head.ch))}),e.sel.primIndex),e.cm){Lr(e.cm,e.first,e.first-t,t);for(var r=e.cm.display,n=r.viewFrom;n<r.viewTo;n++)mi(e.cm,n,"gutter")}}function fa(e,t,r,n){if(e.cm&&!e.cm.curOp)return sr(e.cm,fa)(e,t,r,n);if(t.to.line<e.first){hs(e,t.text.length-1-(t.to.line-t.from.line));return}if(t.from.line>e.lastLine())return;if(t.from.line<e.first){var o=t.text.length-1-(e.first-t.from.line);hs(e,o),t={from:je(e.first,0),to:je(t.to.line+o,t.to.ch),text:[x(t.text)],origin:t.origin}}var A=e.lastLine();t.to.line>A&&(t={from:t.from,to:je(A,Be(e,A).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Rt(e,t.from,t.to),r||(r=ho(e,t)),e.cm?El(e.cm,t,n):po(e,t,n),ja(e,r,Se),e.cantEdit&&Wa(e,je(e.firstLine(),0))&&(e.cantEdit=!1)}function El(e,t,r){var n=e.doc,o=e.display,A=t.from,j=t.to,X=!1,Q=A.line;e.options.lineWrapping||(Q=Ft(Er(Be(n,A.line))),n.iter(Q,j.line+1,function(we){if(we==o.maxLine)return X=!0,!0})),n.sel.contains(t.from,t.to)>-1&&q(e),po(n,t,r,Lo(e)),e.options.lineWrapping||(n.iter(Q,A.line+t.text.length,function(we){var We=hi(we);We>o.maxLineLength&&(o.maxLine=we,o.maxLineLength=We,o.maxLineChanged=!0,X=!1)}),X&&(e.curOp.updateMaxLine=!0)),ei(n,A.line),da(e,400);var re=t.text.length-(j.line-A.line)-1;t.full?Lr(e):A.line==j.line&&t.text.length==1&&!Yo(e.doc,t)?mi(e,A.line,"text"):Lr(e,A.line,j.line+1,re);var ve=ae(e,"changes"),be=ae(e,"change");if(be||ve){var Pe={from:A,to:j,text:t.text,removed:t.removed,origin:t.origin};be&&Zn(e,"change",e,Pe),ve&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(Pe)}e.display.selForContextMenu=null}function Xi(e,t,r,n,o){var A;n||(n=r),ft(n,r)<0&&(A=[n,r],r=A[0],n=A[1]),typeof t=="string"&&(t=e.splitLines(t)),Vi(e,{from:r,to:n,text:t,origin:o})}function fs(e,t,r,n){r<e.line?e.line+=n:t<e.line&&(e.line=t,e.ch=0)}function ps(e,t,r,n){for(var o=0;o<e.length;++o){var A=e[o],j=!0;if(A.ranges){A.copied||(A=e[o]=A.deepCopy(),A.copied=!0);for(var X=0;X<A.ranges.length;X++)fs(A.ranges[X].anchor,t,r,n),fs(A.ranges[X].head,t,r,n);continue}for(var Q=0;Q<A.changes.length;++Q){var re=A.changes[Q];if(r<re.from.line)re.from=je(re.from.line+n,re.from.ch),re.to=je(re.to.line+n,re.to.ch);else if(t<=re.to.line){j=!1;break}}j||(e.splice(0,o+1),o=0)}}function ms(e,t){var r=t.from.line,n=t.to.line,o=t.text.length-(n-r)-1;ps(e.done,r,n,o),ps(e.undone,r,n,o)}function pa(e,t,r,n){var o=t,A=t;return typeof t=="number"?A=Be(e,Xt(e,t)):o=Ft(t),o==null?null:(n(A,o)&&e.cm&&mi(e.cm,o,r),A)}function ma(e){this.lines=e,this.parent=null;for(var t=0,r=0;r<e.length;++r)e[r].parent=this,t+=e[r].height;this.height=t}ma.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var r=e,n=e+t;r<n;++r){var o=this.lines[r];this.height-=o.height,Bt(o),Zn(o,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,r){this.height+=r,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var n=0;n<t.length;++n)t[n].parent=this},iterN:function(e,t,r){for(var n=e+t;e<n;++e)if(r(this.lines[e]))return!0}};function ga(e){this.children=e;for(var t=0,r=0,n=0;n<e.length;++n){var o=e[n];t+=o.chunkSize(),r+=o.height,o.parent=this}this.size=t,this.height=r,this.parent=null}ga.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var r=0;r<this.children.length;++r){var n=this.children[r],o=n.chunkSize();if(e<o){var A=Math.min(t,o-e),j=n.height;if(n.removeInner(e,A),this.height-=j-n.height,o==A&&(this.children.splice(r--,1),n.parent=null),(t-=A)==0)break;e=0}else e-=o}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof ma))){var X=[];this.collapse(X),this.children=[new ma(X)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,r){this.size+=t.length,this.height+=r;for(var n=0;n<this.children.length;++n){var o=this.children[n],A=o.chunkSize();if(e<=A){if(o.insertInner(e,t,r),o.lines&&o.lines.length>50){for(var j=o.lines.length%25+25,X=j;X<o.lines.length;){var Q=new ma(o.lines.slice(X,X+=25));o.height-=Q.height,this.children.splice(++n,0,Q),Q.parent=this}o.lines=o.lines.slice(0,j),this.maybeSpill()}break}e-=A}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),r=new ga(t);if(e.parent){e.size-=r.size,e.height-=r.height;var o=ye(e.parent.children,e);e.parent.children.splice(o+1,0,r)}else{var n=new ga(e.children);n.parent=e,e.children=[n,r],e=n}r.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iterN:function(e,t,r){for(var n=0;n<this.children.length;++n){var o=this.children[n],A=o.chunkSize();if(e<A){var j=Math.min(t,A-e);if(o.iterN(e,j,r))return!0;if((t-=j)==0)break;e=0}else e-=A}}};var va=function(e,t,r){if(r)for(var n in r)r.hasOwnProperty(n)&&(this[n]=r[n]);this.doc=e,this.node=t};va.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,r=this.line,n=Ft(r);if(n==null||!t)return;for(var o=0;o<t.length;++o)t[o]==this&&t.splice(o--,1);t.length||(r.widgets=null);var A=pi(this);Lt(r,Math.max(0,r.height-A)),e&&(Ur(e,function(){gs(e,r,-A),mi(e,n,"widget")}),Zn(e,"lineWidgetCleared",e,this,n))},va.prototype.changed=function(){var e=this,t=this.height,r=this.doc.cm,n=this.line;this.height=null;var o=pi(this)-t;if(!o)return;pn(this.doc,n)||Lt(n,n.height+o),r&&Ur(r,function(){r.curOp.forceUpdate=!0,gs(r,n,o),Zn(r,"lineWidgetChanged",r,e,Ft(n))})},ue(va);function gs(e,t,r){Fr(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&ao(e,r)}function xl(e,t,r,n){var o=new va(e,r,n),A=e.cm;return A&&o.noHScroll&&(A.display.alignWidgets=!0),pa(e,t,"widget",function(j){var X=j.widgets||(j.widgets=[]);if(o.insertAt==null?X.push(o):X.splice(Math.min(X.length-1,Math.max(0,o.insertAt)),0,o),o.line=j,A&&!pn(e,j)){var Q=Fr(j)<e.scrollTop;Lt(j,j.height+pi(o)),Q&&ao(A,o.height),A.curOp.forceUpdate=!0}return!0}),A&&Zn(A,"lineWidgetAdded",A,o,typeof t=="number"?t:Ft(t)),o}var vs=0,Ei=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++vs};Ei.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&ki(e),ae(this,"clear")){var r=this.find();r&&Zn(this,"clear",r.from,r.to)}for(var n=null,o=null,A=0;A<this.lines.length;++A){var j=this.lines[A],X=Ut(j.markedSpans,this);e&&!this.collapsed?mi(e,Ft(j),"text"):e&&(X.to!=null&&(o=Ft(j)),X.from!=null&&(n=Ft(j))),j.markedSpans=Ct(j.markedSpans,X),X.from==null&&this.collapsed&&!pn(this.doc,j)&&e&&Lt(j,or(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var Q=0;Q<this.lines.length;++Q){var re=Er(this.lines[Q]),ve=hi(re);ve>e.display.maxLineLength&&(e.display.maxLine=re,e.display.maxLineLength=ve,e.display.maxLineChanged=!0)}n!=null&&e&&this.collapsed&&Lr(e,n,o+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&os(e.doc)),e&&Zn(e,"markerCleared",e,this,n,o),t&&Mi(e),this.parent&&this.parent.clear()},Ei.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var r,n,o=0;o<this.lines.length;++o){var A=this.lines[o],j=Ut(A.markedSpans,this);if(j.from!=null&&(r=je(t?A:Ft(A),j.from),e==-1))return r;if(j.to!=null&&(n=je(t?A:Ft(A),j.to),e==1))return n}return r&&{from:r,to:n}},Ei.prototype.changed=function(){var e=this,t=this.find(-1,!0),r=this,n=this.doc.cm;if(!t||!n)return;Ur(n,function(){var o=t.line,A=Ft(t.line),j=ut(n,A);if(j&&(cn(j),n.curOp.selectionChanged=n.curOp.forceUpdate=!0),n.curOp.updateMaxLine=!0,!pn(r.doc,o)&&r.height!=null){var X=r.height;r.height=null;var Q=pi(r)-X;Q&&Lt(o,o.height+Q)}Zn(n,"markerChanged",n,e)})},Ei.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||ye(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Ei.prototype.detachLine=function(e){if(this.lines.splice(ye(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},ue(Ei);function $i(e,t,r,n,o){if(n&&n.shared)return _l(e,t,r,n,o);if(e.cm&&!e.cm.curOp)return sr(e.cm,$i)(e,t,r,n,o);var A=new Ei(e,o),j=ft(t,r);if(n&&F(n,A,!1),j>0||j==0&&A.clearWhenEmpty!==!1)return A;if(A.replacedWith&&(A.collapsed=!0,A.widgetNode=g("span",[A.replacedWith],"CodeMirror-widget"),n.handleMouseEvents||A.widgetNode.setAttribute("cm-ignore-events","true"),n.insertLeft&&(A.widgetNode.insertLeft=!0)),A.collapsed){if(Ui(e,t.line,t,r,A)||t.line!=r.line&&Ui(e,r.line,t,r,A))throw new Error("Inserting collapsed marker partially overlapping an existing one");Le()}A.addToHistory&&qo(e,{from:t,to:r,origin:"markText"},e.sel,NaN);var X=t.line,Q=e.cm,re;if(e.iter(X,r.line+1,function(be){Q&&A.collapsed&&!Q.options.lineWrapping&&Er(be)==Q.display.maxLine&&(re=!0),A.collapsed&&X!=t.line&&Lt(be,0),wt(be,new et(A,X==t.line?t.ch:null,X==r.line?r.ch:null)),++X}),A.collapsed&&e.iter(t.line,r.line+1,function(be){pn(e,be)&&Lt(be,0)}),A.clearOnEnter&&Me(A,"beforeCursorEnter",function(){return A.clear()}),A.readOnly&&(pt(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),A.collapsed&&(A.id=++vs,A.atomic=!0),Q){if(re&&(Q.curOp.updateMaxLine=!0),A.collapsed)Lr(Q,t.line,r.line+1);else if(A.className||A.startStyle||A.endStyle||A.css||A.attributes||A.title)for(var ve=t.line;ve<=r.line;ve++)mi(Q,ve,"text");A.atomic&&os(Q.doc),Zn(Q,"markerAdded",Q,A)}return A}var ya=function(e,t){this.markers=e,this.primary=t;for(var r=0;r<e.length;++r)e[r].parent=this};ya.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();Zn(this,"clear")},ya.prototype.find=function(e,t){return this.primary.find(e,t)},ue(ya);function _l(e,t,r,n,o){n=F(n),n.shared=!1;var A=[$i(e,t,r,n,o)],j=A[0],X=n.widgetNode;return bi(e,function(Q){X&&(n.widgetNode=X.cloneNode(!0)),A.push($i(Q,Pt(Q,t),Pt(Q,r),n,o));for(var re=0;re<Q.linked.length;++re)if(Q.linked[re].isParent)return;j=x(A)}),new ya(A,j)}function ys(e){return e.findMarks(je(e.first,0),e.clipPos(je(e.lastLine())),function(t){return t.parent})}function Cl(e,t){for(var r=0;r<t.length;r++){var n=t[r],o=n.find(),A=e.clipPos(o.from),j=e.clipPos(o.to);if(ft(A,j)){var X=$i(e,A,j,n.primary,n.primary.type);n.markers.push(X),X.parent=n}}}function Sl(e){for(var t=function(n){var o=e[n],A=[o.primary.doc];bi(o.primary.doc,function(Q){return A.push(Q)});for(var j=0;j<o.markers.length;j++){var X=o.markers[j];ye(A,X.doc)==-1&&(X.parent=null,o.markers.splice(j--,1))}},r=0;r<e.length;r++)t(r)}var Tl=0,Pr=function(e,t,r,n,o){if(!(this instanceof Pr))return new Pr(e,t,r,n,o);r==null&&(r=0),ga.call(this,[new ma([new li("",null)])]),this.first=r,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=r;var A=je(r,0);this.sel=vi(A),this.history=new Ua(null),this.id=++Tl,this.modeOption=t,this.lineSep=n,this.direction=o=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),po(this,{from:A,to:A,text:e}),mr(this,vi(A),Se)};Pr.prototype=B(ga.prototype,{constructor:Pr,iter:function(e,t,r){r?this.iterN(e-this.first,t-e,r):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var r=0,n=0;n<t.length;++n)r+=t[n].height;this.insertInner(e-this.first,t,r)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=Nt(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:lr(function(e){var t=je(this.first,0),r=this.first+this.size-1;Vi(this,{from:t,to:je(r,Be(this,r).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&oa(this.cm,0,0),mr(this,vi(t),Se)}),replaceRange:function(e,t,r,n){t=Pt(this,t),r=r?Pt(this,r):t,Xi(this,e,t,r,n)},getRange:function(e,t,r){var n=Rt(this,Pt(this,e),Pt(this,t));return r===!1?n:n.join(r||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(Jt(this,e))return Be(this,e)},getLineNumber:function(e){return Ft(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=Be(this,e)),Er(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return Pt(this,e)},getCursor:function(e){var t=this.sel.primary(),r;return e==null||e=="head"?r=t.head:e=="anchor"?r=t.anchor:e=="end"||e=="to"||e===!1?r=t.to():r=t.from(),r},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:lr(function(e,t,r){rs(this,Pt(this,typeof e=="number"?je(e,t||0):e),null,r)}),setSelection:lr(function(e,t,r){rs(this,Pt(this,e),Pt(this,t||e),r)}),extendSelection:lr(function(e,t,r){Fa(this,Pt(this,e),t&&Pt(this,t),r)}),extendSelections:lr(function(e,t){ns(this,$e(this,e),t)}),extendSelectionsBy:lr(function(e,t){var r=R(this.sel.ranges,e);ns(this,$e(this,r),t)}),setSelections:lr(function(e,t,r){if(!e.length)return;for(var n=[],o=0;o<e.length;o++)n[o]=new fn(Pt(this,e[o].anchor),Pt(this,e[o].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),mr(this,Qr(this.cm,n,t),r)}),addSelection:lr(function(e,t,r){var n=this.sel.ranges.slice(0);n.push(new fn(Pt(this,e),Pt(this,t||e))),mr(this,Qr(this.cm,n,n.length-1),r)}),getSelection:function(e){for(var t=this.sel.ranges,r,n=0;n<t.length;n++){var o=Rt(this,t[n].from(),t[n].to());r=r?r.concat(o):o}return e===!1?r:r.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],r=this.sel.ranges,n=0;n<r.length;n++){var o=Rt(this,r[n].from(),r[n].to());e!==!1&&(o=o.join(e||this.lineSeparator())),t[n]=o}return t},replaceSelection:function(e,t,r){for(var n=[],o=0;o<this.sel.ranges.length;o++)n[o]=e;this.replaceSelections(n,t,r||"+input")},replaceSelections:lr(function(e,t,r){for(var n=[],o=this.sel,A=0;A<o.ranges.length;A++){var j=o.ranges[A];n[A]={from:j.from(),to:j.to(),text:this.splitLines(e[A]),origin:r}}for(var X=t&&t!="end"&&hl(this,n,t),Q=n.length-1;Q>=0;Q--)Vi(this,n[Q]);X?is(this,X):this.cm&&Hi(this.cm)}),undo:lr(function(){Ha(this,"undo")}),redo:lr(function(){Ha(this,"redo")}),undoSelection:lr(function(){Ha(this,"undo",!0)}),redoSelection:lr(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.done.length;n++)e.done[n].ranges||++t;for(var o=0;o<e.undone.length;o++)e.undone[o].ranges||++r;return{undo:t,redo:r}},clearHistory:function(){var e=this;this.history=new Ua(this.history.maxGeneration),bi(this,function(t){return t.history=e.history},!0)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:Gi(this.history.done),undone:Gi(this.history.undone)}},setHistory:function(e){var t=this.history=new Ua(this.history.maxGeneration);t.done=Gi(e.done.slice(0),null,!0),t.undone=Gi(e.undone.slice(0),null,!0)},setGutterMarker:lr(function(e,t,r){return pa(this,e,"gutter",function(n){var o=n.gutterMarkers||(n.gutterMarkers={});return o[t]=r,!r&&Oe(o)&&(n.gutterMarkers=null),!0})}),clearGutter:lr(function(e){var t=this;this.iter(function(r){r.gutterMarkers&&r.gutterMarkers[e]&&pa(t,r,"gutter",function(){return r.gutterMarkers[e]=null,Oe(r.gutterMarkers)&&(r.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!Jt(this,e))return null;if(t=e,e=Be(this,e),!e)return null}else if(t=Ft(e),t==null)return null;return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},addLineClass:lr(function(e,t,r){return pa(this,e,t=="gutter"?"gutter":"class",function(n){var o=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!n[o])n[o]=r;else{if(y(r).test(n[o]))return!1;n[o]+=" "+r}return!0})}),removeLineClass:lr(function(e,t,r){return pa(this,e,t=="gutter"?"gutter":"class",function(n){var o=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",A=n[o];if(A)if(r==null)n[o]=null;else{var j=A.match(y(r));if(!j)return!1;var X=j.index+j[0].length;n[o]=A.slice(0,j.index)+(!j.index||X==A.length?"":" ")+A.slice(X)||null}else return!1;return!0})}),addLineWidget:lr(function(e,t,r){return xl(this,e,t,r)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,r){return $i(this,Pt(this,e),Pt(this,t),r,r&&r.type||"range")},setBookmark:function(e,t){var r={replacedWith:t&&(t.nodeType==null?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return e=Pt(this,e),$i(this,e,e,r,"bookmark")},findMarksAt:function(e){e=Pt(this,e);var t=[],r=Be(this,e.line).markedSpans;if(r)for(var n=0;n<r.length;++n){var o=r[n];(o.from==null||o.from<=e.ch)&&(o.to==null||o.to>=e.ch)&&t.push(o.marker.parent||o.marker)}return t},findMarks:function(e,t,r){e=Pt(this,e),t=Pt(this,t);var n=[],o=e.line;return this.iter(e.line,t.line+1,function(A){var j=A.markedSpans;if(j)for(var X=0;X<j.length;X++){var Q=j[X];!(Q.to!=null&&o==e.line&&e.ch>=Q.to||Q.from==null&&o!=e.line||Q.from!=null&&o==t.line&&Q.from>=t.ch)&&(!r||r(Q.marker))&&n.push(Q.marker.parent||Q.marker)}++o}),n},getAllMarks:function(){var e=[];return this.iter(function(t){var r=t.markedSpans;if(r)for(var n=0;n<r.length;++n)r[n].from!=null&&e.push(r[n].marker)}),e},posFromIndex:function(e){var t,r=this.first,n=this.lineSeparator().length;return this.iter(function(o){var A=o.text.length+n;if(A>e)return t=e,!0;e-=A,++r}),Pt(this,je(r,t))},indexFromPos:function(e){e=Pt(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var r=this.lineSeparator().length;return this.iter(this.first,e.line,function(n){t+=n.text.length+r}),t},copy:function(e){var t=new Pr(Nt(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,r=this.first+this.size;e.from!=null&&e.from>t&&(t=e.from),e.to!=null&&e.to<r&&(r=e.to);var n=new Pr(Nt(this,t,r),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(n.history=this.history),(this.linked||(this.linked=[])).push({doc:n,sharedHist:e.sharedHist}),n.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],Cl(n,ys(this)),n},unlinkDoc:function(e){if(e instanceof Dn&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){var r=this.linked[t];if(r.doc!=e)continue;this.linked.splice(t,1),e.unlinkDoc(this),Sl(ys(this));break}if(e.history==this.history){var n=[e.id];bi(e,function(o){return n.push(o.id)},!0),e.history=new Ua(null),e.history.done=Gi(this.history.done,n),e.history.undone=Gi(this.history.undone,n)}},iterLinkedDocs:function(e){bi(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):Xe(e)},lineSeparator:function(){return this.lineSep||`
`},setDirection:lr(function(e){if(e!="rtl"&&(e="ltr"),e==this.direction)return;this.direction=e,this.iter(function(t){return t.order=null}),this.cm&&fl(this.cm)})}),Pr.prototype.eachLine=Pr.prototype.iter;var bs=0;function wl(e){var t=this;if(Es(t),Z(t,e)||Yr(t.display,e))return;te(e),H&&(bs=+new Date);var r=Li(t,e,!0),n=e.dataTransfer.files;if(!r||t.isReadOnly())return;if(n&&n.length&&window.FileReader&&window.File)for(var o=n.length,A=Array(o),j=0,X=function(){++j==o&&sr(t,function(){r=Pt(t.doc,r);var we={from:r,to:r,text:t.doc.splitLines(A.filter(function(We){return We!=null}).join(t.doc.lineSeparator())),origin:"paste"};Vi(t.doc,we),is(t.doc,vi(Pt(t.doc,r),Pt(t.doc,yi(we))))})()},Q=function(we,We){if(t.options.allowDropFileTypes&&ye(t.options.allowDropFileTypes,we.type)==-1){X();return}var Ye=new FileReader;Ye.onerror=function(){return X()},Ye.onload=function(){var it=Ye.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(it)){X();return}A[We]=it,X()},Ye.readAsText(we)},re=0;re<n.length;re++)Q(n[re],re);else{if(t.state.draggingText&&t.doc.sel.contains(r)>-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var ve=e.dataTransfer.getData("Text");if(ve){var be;if(t.state.draggingText&&!t.state.draggingText.copy&&(be=t.listSelections()),ja(t.doc,vi(r,r)),be)for(var Pe=0;Pe<be.length;++Pe)Xi(t.doc,"",be[Pe].anchor,be[Pe].head,"drag");t.replaceSelection(ve,"around","paste"),t.display.input.focus()}}catch(we){}}}function Al(e,t){if(H&&(!e.state.draggingText||+new Date-bs<100)){he(t);return}if(Z(e,t)||Yr(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!D){var r=a("img",null,null,"position: fixed; left: 0; top: 0;");r.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",w&&(r.width=r.height=1,e.display.wrapper.appendChild(r),r._top=r.offsetTop),t.dataTransfer.setDragImage(r,0,0),w&&r.parentNode.removeChild(r)}}function Rl(e,t){var r=Li(e,t);if(!r)return;var n=document.createDocumentFragment();Oo(e,r,n),e.display.dragCursor||(e.display.dragCursor=a("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),s(e.display.dragCursor,n)}function Es(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function xs(e){if(!document.getElementsByClassName)return;for(var t=document.getElementsByClassName("CodeMirror"),r=[],n=0;n<t.length;n++){var o=t[n].CodeMirror;o&&r.push(o)}r.length&&r[0].operation(function(){for(var A=0;A<r.length;A++)e(r[A])})}var _s=!1;function Ll(){if(_s)return;Pl(),_s=!0}function Pl(){var e;Me(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,xs(Dl)},100))}),Me(window,"blur",function(){return xs(Wi)})}function Dl(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var xi={3:"Pause",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",224:"Mod",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},ba=0;ba<10;ba++)xi[ba+48]=xi[ba+96]=String(ba);for(var Ka=65;Ka<=90;Ka++)xi[Ka]=String.fromCharCode(Ka);for(var Ea=1;Ea<=12;Ea++)xi[Ea+111]=xi[Ea+63235]="F"+Ea;var di={};di.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},di.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},di.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},di.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},di.default=i?di.macDefault:di.pcDefault;function Ol(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var r,n,o,A,j=0;j<t.length-1;j++){var X=t[j];if(/^(cmd|meta|m)$/i.test(X))A=!0;else if(/^a(lt)?$/i.test(X))r=!0;else if(/^(c|ctrl|control)$/i.test(X))n=!0;else if(/^s(hift)?$/i.test(X))o=!0;else throw new Error("Unrecognized modifier name: "+X)}return r&&(e="Alt-"+e),n&&(e="Ctrl-"+e),A&&(e="Cmd-"+e),o&&(e="Shift-"+e),e}function kl(e){var t={};for(var r in e)if(e.hasOwnProperty(r)){var n=e[r];if(/^(name|fallthrough|(de|at)tach)$/.test(r))continue;if(n=="..."){delete e[r];continue}for(var o=R(r.split(" "),Ol),A=0;A<o.length;A++){var j=void 0,X=void 0;A==o.length-1?(X=o.join(" "),j=n):(X=o.slice(0,A+1).join(" "),j="...");var Q=t[X];if(!Q)t[X]=j;else if(Q!=j)throw new Error("Inconsistent bindings for "+X)}delete e[r]}for(var re in t)e[re]=t[re];return e}function Yi(e,t,r,n){t=Ga(t);var o=t.call?t.call(e,n):t[e];if(o===!1)return"nothing";if(o==="...")return"multi";if(o!=null&&r(o))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return Yi(e,t.fallthrough,r,n);for(var A=0;A<t.fallthrough.length;A++){var j=Yi(e,t.fallthrough[A],r,n);if(j)return j}}}function Cs(e){var t=typeof e=="string"?e:xi[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function Ss(e,t,r){var n=e;return t.altKey&&n!="Alt"&&(e="Alt-"+e),(p?t.metaKey:t.ctrlKey)&&n!="Ctrl"&&(e="Ctrl-"+e),(p?t.ctrlKey:t.metaKey)&&n!="Mod"&&(e="Cmd-"+e),!r&&t.shiftKey&&n!="Shift"&&(e="Shift-"+e),e}function Ts(e,t){if(w&&e.keyCode==34&&e.char)return!1;var r=xi[e.keyCode];return r==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(r=e.code),Ss(r,e,t))}function Ga(e){return typeof e=="string"?di[e]:e}function Ji(e,t){for(var r=e.doc.sel.ranges,n=[],o=0;o<r.length;o++){for(var A=t(r[o]);n.length&&ft(A.from,x(n).to)<=0;){var j=n.pop();if(ft(j.from,A.from)<0){A.from=j.from;break}}n.push(A)}Ur(e,function(){for(var X=n.length-1;X>=0;X--)Xi(e.doc,"",n[X].from,n[X].to,"+delete");Hi(e)})}function yo(e,t,r){var n=De(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 je(t.line,n,r<0?"after":"before")}function Eo(e,t,r,n,o){if(e){t.doc.direction=="rtl"&&(o=-o);var A=rt(r,t.doc.direction);if(A){var j=o<0?x(A):A[0],X=o<0==(j.level==1),Q=X?"after":"before",re;if(j.level>0||t.doc.direction=="rtl"){var ve=ot(t,r);re=o<0?r.text.length-1:0;var be=ct(t,ve,re).top;re=Ve(function(Pe){return ct(t,ve,Pe).top==be},o<0==(j.level==1)?j.from:j.to-1,re),Q=="before"&&(re=yo(r,re,1))}else re=o<0?j.to:j.from;return new je(n,re,Q)}}return new je(n,o<0?r.text.length:0,o<0?"before":"after")}function Ml(e,t,r,n){var o=rt(t,e.doc.direction);if(!o)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 A=Ze(o,r.ch,r.sticky),j=o[A];if(e.doc.direction=="ltr"&&j.level%2==0&&(n>0?j.to>r.ch:j.from<r.ch))return bo(t,r,n);var X=function(gt,St){return yo(t,gt instanceof je?gt.ch:gt,St)},Q,re=function(gt){return e.options.lineWrapping?(Q=Q||ot(e,t),_r(e,t,Q,gt)):{begin:0,end:t.text.length}},ve=re(r.sticky=="before"?X(r,-1):r.ch);if(e.doc.direction=="rtl"||j.level==1){var be=j.level==1==n<0,Pe=X(r,be?1:-1);if(Pe!=null&&(be?Pe<=j.to&&Pe<=ve.end:Pe>=j.from&&Pe>=ve.begin)){var we=be?"before":"after";return new je(r.line,Pe,we)}}var We=function(gt,St,vt){for(var Mt=function(_n,ur){return ur?new je(r.line,X(_n,1),"before"):new je(r.line,_n,"after")};gt>=0&&gt<o.length;gt+=St){var $t=o[gt],Ht=St>0==($t.level!=1),nn=Ht?vt.begin:X(vt.end,-1);if($t.from<=nn&&nn<$t.to)return Mt(nn,Ht);if(nn=Ht?$t.from:X($t.to,-1),vt.begin<=nn&&nn<vt.end)return Mt(nn,Ht)}},Ye=We(A+n,n,ve);if(Ye)return Ye;var it=n>0?ve.end:X(ve.begin,-1);return it!=null&&!(n>0&&it==t.text.length)&&(Ye=We(n>0?0:o.length-1,n,re(it)),Ye)?Ye:null}var xa={selectAll:us,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),Se)},killLine:function(e){return Ji(e,function(t){if(t.empty()){var r=Be(e.doc,t.head.line).text.length;return t.head.ch==r&&t.head.line<e.lastLine()?{from:t.head,to:je(t.head.line+1,0)}:{from:t.head,to:je(t.head.line,r)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return Ji(e,function(t){return{from:je(t.from().line,0),to:Pt(e.doc,je(t.to().line+1,0))}})},delLineLeft:function(e){return Ji(e,function(t){return{from:je(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return Ji(e,function(t){var r=e.charCoords(t.head,"div").top+5,n=e.coordsChar({left:0,top:r},"div");return{from:n,to:t.from()}})},delWrappedLineRight:function(e){return Ji(e,function(t){var r=e.charCoords(t.head,"div").top+5,n=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:r},"div");return{from:t.from(),to:n}})},undo:function(e){return e.undo()},redo:function(e){return e.redo()},undoSelection:function(e){return e.undoSelection()},redoSelection:function(e){return e.redoSelection()},goDocStart:function(e){return e.extendSelection(je(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(je(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return ws(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return As(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return Il(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var r=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:r},"div")},pe)},goLineLeft:function(e){return e.extendSelectionsBy(function(t){var r=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:r},"div")},pe)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var r=e.cursorCoords(t.head,"div").top+5,n=e.coordsChar({left:0,top:r},"div");return n.ch<e.getLine(n.line).search(/\S/)?As(e,t.head):n},pe)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"codepoint")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection(" ")},insertSoftTab:function(e){for(var t=[],r=e.listSelections(),n=e.options.tabSize,o=0;o<r.length;o++){var A=r[o].from(),j=ie(e.getLine(A.line),A.ch,n);t.push(I(n-j%n))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return Ur(e,function(){for(var t=e.listSelections(),r=[],n=0;n<t.length;n++){if(!t[n].empty())continue;var o=t[n].head,A=Be(e.doc,o.line).text;if(A){if(o.ch==A.length&&(o=new je(o.line,o.ch-1)),o.ch>0)o=new je(o.line,o.ch+1),e.replaceRange(A.charAt(o.ch-1)+A.charAt(o.ch-2),je(o.line,o.ch-2),o,"+transpose");else if(o.line>e.doc.first){var j=Be(e.doc,o.line-1).text;j&&(o=new je(o.line,1),e.replaceRange(A.charAt(0)+e.doc.lineSeparator()+j.charAt(j.length-1),je(o.line-1,j.length-1),o,"+transpose"))}}r.push(new fn(o,o))}e.setSelections(r)})},newlineAndIndent:function(e){return Ur(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;n<t.length;n++)e.indentLine(t[n].from().line,null,!0);Hi(e)})},openLine:function(e){return e.replaceSelection(`
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function ws(e,t){var r=Be(e.doc,t),n=Er(r);return n!=r&&(t=Ft(n)),Eo(!0,e,n,t,1)}function Il(e,t){var r=Be(e.doc,t),n=Bi(r);return n!=r&&(t=Ft(n)),Eo(!0,e,r,t,-1)}function As(e,t){var r=ws(e,t.line),n=Be(e.doc,r.line),o=rt(n,e.doc.direction);if(!o||o[0].level==0){var A=Math.max(r.ch,n.text.search(/\S/)),j=t.line==r.line&&t.ch<=A&&t.ch;return je(r.line,j?0:A,r.sticky)}return r}function za(e,t,r){if(typeof t=="string"&&(t=xa[t],!t))return!1;e.display.input.ensurePolled();var n=e.display.shift,o=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),r&&(e.display.shift=!1),o=t(e)!=Te}finally{e.display.shift=n,e.state.suppressEdits=!1}return o}function Nl(e,t,r){for(var n=0;n<e.state.keyMaps.length;n++){var o=Yi(t,e.state.keyMaps[n],r,e);if(o)return o}return e.options.extraKeys&&Yi(t,e.options.extraKeys,r,e)||Yi(t,e.options.keyMap,r,e)}var Ul=new ge;function _a(e,t,r,n){var o=e.state.keySeq;if(o){if(Cs(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Ul.set(50,function(){e.state.keySeq==o&&(e.state.keySeq=null,e.display.input.reset())}),Rs(e,o+" "+t,r,n))return!0}return Rs(e,t,r,n)}function Rs(e,t,r,n){var o=Nl(e,t,n);return o=="multi"&&(e.state.keySeq=t),o=="handled"&&Zn(e,"keyHandled",e,t,r),(o=="handled"||o=="multi")&&(te(r),no(e)),!!o}function Ls(e,t){var r=Ts(t,!0);return r?t.shiftKey&&!e.state.keySeq?_a(e,"Shift-"+r,t,function(n){return za(e,n,!0)})||_a(e,r,t,function(n){if(typeof n=="string"?/^go[A-Z]/.test(n):n.motion)return za(e,n)}):_a(e,r,t,function(n){return za(e,n)}):!1}function Bl(e,t,r){return _a(e,"'"+r+"'",t,function(n){return za(e,n,!0)})}var xo=null;function Ps(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=M(),Z(t,e))return;H&&N<11&&e.keyCode==27&&(e.returnValue=!1);var r=e.keyCode;t.display.shift=r==16||e.shiftKey;var n=Ls(t,e);w&&(xo=n?r:null,!n&&r==88&&!jt&&(i?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),P&&!i&&!n&&r==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),r==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Fl(t)}function Fl(e){var t=e.display.lineDiv;K(t,"CodeMirror-crosshair");function r(n){(n.keyCode==18||!n.altKey)&&(d(t,"CodeMirror-crosshair"),mt(document,"keyup",r),mt(document,"mouseover",r))}Me(document,"keyup",r),Me(document,"mouseover",r)}function Ds(e){e.keyCode==16&&(this.doc.sel.shift=!1),Z(this,e)}function Os(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(Yr(t.display,e)||Z(t,e)||e.ctrlKey&&!e.altKey||i&&e.metaKey)return;var r=e.keyCode,n=e.charCode;if(w&&r==xo){xo=null,te(e);return}if(w&&(!e.which||e.which<10)&&Ls(t,e))return;var o=String.fromCharCode(n==null?r:n);if(o=="\b")return;if(Bl(t,e,o))return;t.display.input.onKeyPress(e)}var jl=400,_o=function(e,t,r){this.time=e,this.pos=t,this.button=r};_o.prototype.compare=function(e,t,r){return this.time+jl>e&&ft(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(Z(t,e)||r.activeTouch&&r.input.supportsTouch())return;if(r.input.ensurePolled(),r.shift=e.shiftKey,Yr(r,e)){k||(r.scroller.draggable=!1,setTimeout(function(){return r.scroller.draggable=!0},100));return}if(Co(t,e))return;var n=Li(t,e),o=Ce(e),A=n?Wl(n,o):"single";if(window.focus(),o==1&&t.state.selectingText&&t.state.selectingText(e),n&&Hl(t,o,n,A,e))return;o==1?n?Gl(t,n,A,e):ce(e)==r.scroller&&te(e):o==2?(n&&Fa(t.doc,n),setTimeout(function(){return r.input.focus()},20)):o==3&&(u?t.display.input.onContextMenu(e):Mo(t))}function Hl(e,t,r,n,o){var A="Click";return n=="double"?A="Double"+A:n=="triple"&&(A="Triple"+A),A=(t==1?"Left":t==2?"Middle":"Right")+A,_a(e,Ss(A,o),o,function(j){if(typeof j=="string"&&(j=xa[j]),!j)return!1;var X=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),X=j(e,r)!=Te}finally{e.state.suppressEdits=!1}return X})}function Kl(e,t,r){var n=e.getOption("configureMouse"),o=n?n(e,t,r):{};if(o.unit==null){var A=c?r.shiftKey&&r.metaKey:r.altKey;o.unit=A?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(o.extend==null||e.doc.extend)&&(o.extend=e.doc.extend||r.shiftKey),o.addNew==null&&(o.addNew=i?r.metaKey:r.ctrlKey),o.moveOnDrag==null&&(o.moveOnDrag=!(i?r.altKey:r.ctrlKey)),o}function Gl(e,t,r,n){H?setTimeout(G(ko,e),0):e.curOp.focus=M();var o=Kl(e,r,n),A=e.doc.sel,j;e.options.dragDrop&&Ae&&!e.isReadOnly()&&r=="single"&&(j=A.contains(t))>-1&&(ft((j=A.ranges[j]).from(),t)<0||t.xRel>0)&&(ft(j.to(),t)>0||t.xRel<0)?zl(e,n,t,o):Vl(e,n,t,o)}function zl(e,t,r,n){var o=e.display,A=!1,j=sr(e,function(re){k&&(o.scroller.draggable=!1),e.state.draggingText=!1,mt(o.wrapper.ownerDocument,"mouseup",j),mt(o.wrapper.ownerDocument,"mousemove",X),mt(o.scroller,"dragstart",Q),mt(o.scroller,"drop",j),A||(te(re),n.addNew||Fa(e.doc,r,null,null,n.extend),k&&!D||H&&N==9?setTimeout(function(){o.wrapper.ownerDocument.body.focus({preventScroll:!0}),o.input.focus()},20):o.input.focus())}),X=function(re){A=A||Math.abs(t.clientX-re.clientX)+Math.abs(t.clientY-re.clientY)>=10},Q=function(){return A=!0};k&&(o.scroller.draggable=!0),e.state.draggingText=j,j.copy=!n.moveOnDrag,o.scroller.dragDrop&&o.scroller.dragDrop(),Me(o.wrapper.ownerDocument,"mouseup",j),Me(o.wrapper.ownerDocument,"mousemove",X),Me(o.scroller,"dragstart",Q),Me(o.scroller,"drop",j),Mo(e),setTimeout(function(){return o.input.focus()},20)}function Ms(e,t,r){if(r=="char")return new fn(t,t);if(r=="word")return e.findWordAt(t);if(r=="line")return new fn(je(t.line,0),Pt(e.doc,je(t.line+1,0)));var n=r(e,t);return new fn(n.from,n.to)}function Vl(e,t,r,n){var o=e.display,A=e.doc;te(t);var j,X,Q=A.sel,re=Q.ranges;if(n.addNew&&!n.extend?(X=A.sel.contains(r),X>-1?j=re[X]:j=new fn(r,r)):(j=A.sel.primary(),X=A.sel.primIndex),n.unit=="rectangle")n.addNew||(j=new fn(r,r)),r=Li(e,t,!0,!0),X=-1;else{var ve=Ms(e,r,n.unit);n.extend?j=go(j,ve.anchor,ve.head,n.extend):j=ve}n.addNew?X==-1?(X=re.length,mr(A,Qr(e,re.concat([j]),X),{scroll:!1,origin:"*mouse"})):re.length>1&&re[X].empty()&&n.unit=="char"&&!n.extend?(mr(A,Qr(e,re.slice(0,X).concat(re.slice(X+1)),0),{scroll:!1,origin:"*mouse"}),Q=A.sel):vo(A,X,j,me):(X=0,mr(A,new Wr([j],0),me),Q=A.sel);var be=r;function Pe(vt){if(ft(be,vt)==0)return;if(be=vt,n.unit=="rectangle"){for(var Mt=[],$t=e.options.tabSize,Ht=ie(Be(A,r.line).text,r.ch,$t),nn=ie(Be(A,vt.line).text,vt.ch,$t),_n=Math.min(Ht,nn),ur=Math.max(Ht,nn),In=Math.min(r.line,vt.line),Br=Math.min(e.lastLine(),Math.max(r.line,vt.line));In<=Br;In++){var Dr=Be(A,In).text,Yn=Ee(Dr,_n,$t);_n==ur?Mt.push(new fn(je(In,Yn),je(In,Yn))):Dr.length>Yn&&Mt.push(new fn(je(In,Yn),je(In,Ee(Dr,ur,$t))))}Mt.length||Mt.push(new fn(r,r)),mr(A,Qr(e,Q.ranges.slice(0,X).concat(Mt),X),{origin:"*mouse",scroll:!1}),e.scrollIntoView(vt)}else{var Or=j,cr=Ms(e,vt,n.unit),qn=Or.anchor,Jn;ft(cr.anchor,qn)>0?(Jn=cr.head,qn=Cn(Or.from(),cr.anchor)):(Jn=cr.anchor,qn=vr(Or.to(),cr.head));var jn=Q.ranges.slice(0);jn[X]=Xl(e,new fn(Pt(A,qn),Jn)),mr(A,Qr(e,jn,X),me)}}var we=o.wrapper.getBoundingClientRect(),We=0;function Ye(vt){var Mt=++We,$t=Li(e,vt,!0,n.unit=="rectangle");if(!$t)return;if(ft($t,be)!=0){e.curOp.focus=M(),Pe($t);var Ht=ka(o,A);($t.line>=Ht.to||$t.line<Ht.from)&&setTimeout(sr(e,function(){We==Mt&&Ye(vt)}),150)}else{var nn=vt.clientY<we.top?-20:vt.clientY>we.bottom?20:0;nn&&setTimeout(sr(e,function(){if(We!=Mt)return;o.scroller.scrollTop+=nn,Ye(vt)}),50)}}function it(vt){e.state.selectingText=!1,We=Infinity,vt&&(te(vt),o.input.focus()),mt(o.wrapper.ownerDocument,"mousemove",gt),mt(o.wrapper.ownerDocument,"mouseup",St),A.history.lastSelOrigin=null}var gt=sr(e,function(vt){vt.buttons===0||!Ce(vt)?it(vt):Ye(vt)}),St=sr(e,it);e.state.selectingText=St,Me(o.wrapper.ownerDocument,"mousemove",gt),Me(o.wrapper.ownerDocument,"mouseup",St)}function Xl(e,t){var r=t.anchor,n=t.head,o=Be(e.doc,r.line);if(ft(r,n)==0&&r.sticky==n.sticky)return t;var A=rt(o);if(!A)return t;var j=Ze(A,r.ch,r.sticky),X=A[j];if(X.from!=r.ch&&X.to!=r.ch)return t;var Q=j+(X.from==r.ch==(X.level!=1)?0:1);if(Q==0||Q==A.length)return t;var re;if(n.line!=r.line)re=(n.line-r.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var ve=Ze(A,n.ch,n.sticky),be=ve-j||(n.ch-r.ch)*(X.level==1?-1:1);ve==Q-1||ve==Q?re=be<0:re=be>0}var Pe=A[Q+(re?-1:0)],we=re==(Pe.level==1),We=we?Pe.from:Pe.to,Ye=we?"after":"before";return r.ch==We&&r.sticky==Ye?t:new fn(new je(r.line,We,Ye),n)}function Is(e,t,r,n){var o,A;if(t.touches)o=t.touches[0].clientX,A=t.touches[0].clientY;else try{o=t.clientX,A=t.clientY}catch(Pe){return!1}if(o>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;n&&te(t);var j=e.display,X=j.lineDiv.getBoundingClientRect();if(A>X.bottom||!ae(e,r))return oe(t);A-=X.top-j.viewOffset;for(var Q=0;Q<e.display.gutterSpecs.length;++Q){var re=j.gutters.childNodes[Q];if(re&&re.getBoundingClientRect().right>=o){var ve=Vt(e.doc,A),be=e.display.gutterSpecs[Q];return se(e,r,e,ve,be.className,t),oe(t)}}}function Co(e,t){return Is(e,t,"gutterClick",!0)}function Ns(e,t){if(Yr(e.display,t)||$l(e,t))return;if(Z(e,t,"contextmenu"))return;u||e.display.input.onContextMenu(t)}function $l(e,t){return ae(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-"),wn(e)}var Qi={toString:function(){return"CodeMirror.Init"}},Bs={},Va={};function Yl(e){var t=e.optionHandlers;function r(n,o,A,j){e.defaults[n]=o,A&&(t[n]=j?function(X,Q,re){re!=Qi&&A(X,Q,re)}:A)}e.defineOption=r,e.Init=Qi,r("value","",function(n,o){return n.setValue(o)},!0),r("mode",null,function(n,o){n.doc.modeOption=o,fo(n)},!0),r("indentUnit",2,fo,!0),r("indentWithTabs",!1),r("smartIndent",!0),r("tabSize",4,function(n){ha(n),wn(n),Lr(n)},!0),r("lineSeparator",null,function(n,o){if(n.doc.lineSep=o,!o)return;var A=[],j=n.doc.first;n.doc.iter(function(Q){for(var re=0;;){var ve=Q.text.indexOf(o,re);if(ve==-1)break;re=ve+o.length,A.push(je(j,ve))}j++});for(var X=A.length-1;X>=0;X--)Xi(n.doc,o,A[X],je(A[X].line,A[X].ch+o.length))}),r("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(n,o,A){n.state.specialChars=new RegExp(o.source+(o.test(" ")?"":"| "),"g"),A!=Qi&&n.refresh()}),r("specialCharPlaceholder",mn,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,o){return n.getInputField().spellcheck=o},!0),r("autocorrect",!1,function(n,o){return n.getInputField().autocorrect=o},!0),r("autocapitalize",!1,function(n,o){return n.getInputField().autocapitalize=o},!0),r("rtlMoveVisually",!E),r("wholeLineUpdateBefore",!0),r("theme","default",function(n){Us(n),ca(n)},!0),r("keyMap","default",function(n,o,A){var j=Ga(o),X=A!=Qi&&Ga(A);X&&X.detach&&X.detach(n,j),j.attach&&j.attach(n,X||null)}),r("extraKeys",null),r("configureMouse",null),r("lineWrapping",!1,Ql,!0),r("gutters",[],function(n,o){n.display.gutterSpecs=co(o,n.options.lineNumbers),ca(n)},!0),r("fixedGutter",!0,function(n,o){n.display.gutters.style.left=o?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,o){n.display.gutterSpecs=co(n.options.gutters,o),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,o){o=="nocursor"&&(Wi(n),n.display.input.blur()),n.display.input.readOnlyChanged(o)}),r("screenReaderLabel",null,function(n,o){o=o===""?null:o,n.display.input.screenReaderLabelChanged(o)}),r("disableInput",!1,function(n,o){o||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,o){return n.doc.history.undoDepth=o}),r("historyEventDelay",1250),r("viewportMargin",10,function(n){return n.refresh()},!0),r("maxHighlightLength",1e4,ha,!0),r("moveInputWithCursor",!0,function(n,o){o||n.display.input.resetPosition()}),r("tabindex",null,function(n,o){return n.display.input.getField().tabIndex=o||""}),r("autofocus",null),r("direction","ltr",function(n,o){return n.doc.setDirection(o)},!0),r("phrases",null)}function Jl(e,t,r){var n=r&&r!=Qi;if(!t!=!n){var o=e.display.dragFunctions,A=t?Me:mt;A(e.display.scroller,"dragstart",o.start),A(e.display.scroller,"dragenter",o.enter),A(e.display.scroller,"dragover",o.over),A(e.display.scroller,"dragleave",o.leave),A(e.display.scroller,"drop",o.drop)}}function Ql(e){e.options.lineWrapping?(K(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(d(e.display.wrapper,"CodeMirror-wrap"),$r(e)),to(e),Lr(e),wn(e),setTimeout(function(){return Ki(e)},100)}function Dn(e,t){var r=this;if(!(this instanceof Dn))return new Dn(e,t);this.options=t=t?F(t):{},F(Bs,t,!1);var n=t.value;typeof n=="string"?n=new Pr(n,t.mode,null,t.lineSeparator,t.direction):t.mode&&(n.modeOption=t.mode),this.doc=n;var o=new Dn.inputStyles[t.inputStyle](this),A=this.display=new dl(e,n,o,t);A.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 ge,keySeq:null,specialChars:null},t.autofocus&&!l&&A.input.focus(),H&&N<11&&setTimeout(function(){return r.display.input.reset(!0)},20),Zl(this),Ll(),ki(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 X=0;X<So.length;++X)So[X](this);Mi(this),k&&t.lineWrapping&&getComputedStyle(A.lineDiv).textRendering=="optimizelegibility"&&(A.lineDiv.style.textRendering="auto")}Dn.defaults=Bs,Dn.optionHandlers=Va;function Zl(e){var t=e.display;Me(t.scroller,"mousedown",sr(e,ks)),H&&N<11?Me(t.scroller,"dblclick",sr(e,function(Q){if(Z(e,Q))return;var re=Li(e,Q);if(!re||Co(e,Q)||Yr(e.display,Q))return;te(Q);var ve=e.findWordAt(re);Fa(e.doc,ve.anchor,ve.head)})):Me(t.scroller,"dblclick",function(Q){return Z(e,Q)||te(Q)}),Me(t.scroller,"contextmenu",function(Q){return Ns(e,Q)}),Me(t.input.getField(),"contextmenu",function(Q){t.scroller.contains(Q.target)||Ns(e,Q)});var r,n={end:0};function o(){t.activeTouch&&(r=setTimeout(function(){return t.activeTouch=null},1e3),n=t.activeTouch,n.end=+new Date)}function A(Q){if(Q.touches.length!=1)return!1;var re=Q.touches[0];return re.radiusX<=1&&re.radiusY<=1}function j(Q,re){if(re.left==null)return!0;var ve=re.left-Q.left,be=re.top-Q.top;return ve*ve+be*be>20*20}Me(t.scroller,"touchstart",function(Q){if(!Z(e,Q)&&!A(Q)&&!Co(e,Q)){t.input.ensurePolled(),clearTimeout(r);var re=+new Date;t.activeTouch={start:re,moved:!1,prev:re-n.end<=300?n:null},Q.touches.length==1&&(t.activeTouch.left=Q.touches[0].pageX,t.activeTouch.top=Q.touches[0].pageY)}}),Me(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Me(t.scroller,"touchend",function(Q){var re=t.activeTouch;if(re&&!Yr(t,Q)&&re.left!=null&&!re.moved&&new Date-re.start<300){var ve=e.coordsChar(t.activeTouch,"page"),be;!re.prev||j(re,re.prev)?be=new fn(ve,ve):!re.prev.prev||j(re,re.prev.prev)?be=e.findWordAt(ve):be=new fn(je(ve.line,0),Pt(e.doc,je(ve.line+1,0))),e.setSelection(be.anchor,be.head),e.focus(),te(Q)}o()}),Me(t.scroller,"touchcancel",o),Me(t.scroller,"scroll",function(){t.scroller.clientHeight&&(sa(e,t.scroller.scrollTop),Di(e,t.scroller.scrollLeft,!0),se(e,"scroll",e))}),Me(t.scroller,"mousewheel",function(Q){return Vo(e,Q)}),Me(t.scroller,"DOMMouseScroll",function(Q){return Vo(e,Q)}),Me(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(Q){Z(e,Q)||he(Q)},over:function(Q){Z(e,Q)||(Rl(e,Q),he(Q))},start:function(Q){return Al(e,Q)},drop:sr(e,wl),leave:function(Q){Z(e,Q)||Es(e)}};var X=t.input.getField();Me(X,"keyup",function(Q){return Ds.call(e,Q)}),Me(X,"keydown",sr(e,Ps)),Me(X,"keypress",sr(e,Os)),Me(X,"focus",function(Q){return ro(e,Q)}),Me(X,"blur",function(Q){return Wi(e,Q)})}var So=[];Dn.defineInitHook=function(e){return So.push(e)};function Ta(e,t,r,n){var o=e.doc,A;r==null&&(r="add"),r=="smart"&&(o.mode.indent?A=Nn(e,t).state:r="prev");var j=e.options.tabSize,X=Be(o,t),Q=ie(X.text,null,j);X.stateAfter&&(X.stateAfter=null);var re=X.text.match(/^\s*/)[0],ve;if(!n&&!/\S/.test(X.text))ve=0,r="not";else if(r=="smart"&&(ve=o.mode.indent(A,X.text.slice(re.length),X.text),ve==Te||ve>150)){if(!n)return;r="prev"}r=="prev"?t>o.first?ve=ie(Be(o,t-1).text,null,j):ve=0:r=="add"?ve=Q+e.options.indentUnit:r=="subtract"?ve=Q-e.options.indentUnit:typeof r=="number"&&(ve=Q+r),ve=Math.max(0,ve);var be="",Pe=0;if(e.options.indentWithTabs)for(var we=Math.floor(ve/j);we;--we)Pe+=j,be+=" ";if(Pe<ve&&(be+=I(ve-Pe)),be!=re)return Xi(o,be,je(t,0),je(t,re.length),"+input"),X.stateAfter=null,!0;for(var We=0;We<o.sel.ranges.length;We++){var Ye=o.sel.ranges[We];if(Ye.head.line==t&&Ye.head.ch<re.length){var it=je(t,re.length);vo(o,We,new fn(it,it));break}}}var Zr=null;function Xa(e){Zr=e}function To(e,t,r,n,o){var A=e.doc;e.display.shift=!1,n||(n=A.sel);var j=+new Date-200,X=o=="paste"||e.state.pasteIncoming>j,Q=Xe(t),re=null;if(X&&n.ranges.length>1)if(Zr&&Zr.text.join(`
`)==t){if(n.ranges.length%Zr.text.length==0){re=[];for(var ve=0;ve<Zr.text.length;ve++)re.push(A.splitLines(Zr.text[ve]))}}else Q.length==n.ranges.length&&e.options.pasteLinesPerSelection&&(re=R(Q,function(gt){return[gt]}));for(var be=e.curOp.updateInput,Pe=n.ranges.length-1;Pe>=0;Pe--){var we=n.ranges[Pe],We=we.from(),Ye=we.to();we.empty()&&(r&&r>0?We=je(We.line,We.ch-r):e.state.overwrite&&!X?Ye=je(Ye.line,Math.min(Be(A,Ye.line).text.length,Ye.ch+x(Q).length)):X&&Zr&&Zr.lineWise&&Zr.text.join(`
`)==Q.join(`
`)&&(We=Ye=je(We.line,0)));var it={from:We,to:Ye,text:re?re[Pe%re.length]:Q,origin:o||(X?"paste":e.state.cutIncoming>j?"cut":"+input")};Vi(e.doc,it),Zn(e,"inputRead",e,it)}t&&!X&&js(e,t),Hi(e),e.curOp.updateInput<2&&(e.curOp.updateInput=be),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&&Ur(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 o=r.ranges[n];if(o.head.ch>100||n&&r.ranges[n-1].head.line==o.head.line)continue;var A=e.getModeAt(o.head),j=!1;if(A.electricChars){for(var X=0;X<A.electricChars.length;X++)if(t.indexOf(A.electricChars.charAt(X))>-1){j=Ta(e,o.head.line,"smart");break}}else A.electricInput&&(A.electricInput.test(Be(e.doc,o.head.line).text.slice(0,o.head.ch))&&(j=Ta(e,o.head.line,"smart")));j&&Zn(e,"electricInput",e,o.head.line)}}function Ws(e){for(var t=[],r=[],n=0;n<e.doc.sel.ranges.length;n++){var o=e.doc.sel.ranges[n].head.line,A={anchor:je(o,0),head:je(o+1,0)};r.push(A),t.push(e.getRange(A.anchor,A.head))}return{text:t,ranges:r}}function Hs(e,t,r,n){e.setAttribute("autocorrect",r?"":"off"),e.setAttribute("autocapitalize",n?"":"off"),e.setAttribute("spellcheck",!!t)}function Ks(){var e=a("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=a("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return k?e.style.width="1000px":e.setAttribute("wrap","off"),S&&(e.style.border="1px solid black"),Hs(e),t}function ql(e){var t=e.optionHandlers,r=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(n,o){var A=this.options,j=A[n];if(A[n]==o&&n!="mode")return;A[n]=o,t.hasOwnProperty(n)&&sr(this,t[n])(this,o,j),se(this,"optionChange",this,n)},getOption:function(n){return this.options[n]},getDoc:function(){return this.doc},addKeyMap:function(n,o){this.state.keyMaps[o?"push":"unshift"](Ga(n))},removeKeyMap:function(n){for(var o=this.state.keyMaps,A=0;A<o.length;++A)if(o[A]==n||o[A].name==n)return o.splice(A,1),!0},addOverlay:Sr(function(n,o){var A=n.token?n:e.getMode(this.options,n);if(A.startState)throw new Error("Overlays may not be stateful.");W(this.state.overlays,{mode:A,modeSpec:n,opaque:o&&o.opaque,priority:o&&o.priority||0},function(j){return j.priority}),this.state.modeGen++,Lr(this)}),removeOverlay:Sr(function(n){for(var o=this.state.overlays,A=0;A<o.length;++A){var j=o[A].modeSpec;if(j==n||typeof n=="string"&&j.name==n){o.splice(A,1),this.state.modeGen++,Lr(this);return}}}),indentLine:Sr(function(n,o,A){typeof o!="string"&&typeof o!="number"&&(o==null?o=this.options.smartIndent?"smart":"prev":o=o?"add":"subtract"),Jt(this.doc,n)&&Ta(this,n,o,A)}),indentSelection:Sr(function(n){for(var o=this.doc.sel.ranges,A=-1,j=0;j<o.length;j++){var X=o[j];if(X.empty())X.head.line>A&&(Ta(this,X.head.line,n,!0),A=X.head.line,j==this.doc.sel.primIndex&&Hi(this));else{var Q=X.from(),re=X.to(),ve=Math.max(A,Q.line);A=Math.min(this.lastLine(),re.line-(re.ch?0:1))+1;for(var be=ve;be<A;++be)Ta(this,be,n);var Pe=this.doc.sel.ranges;Q.ch==0&&o.length==Pe.length&&Pe[j].from().ch>0&&vo(this.doc,j,new fn(Q,Pe[j].to()),Se)}}}),getTokenAt:function(n,o){return oi(this,n,o)},getLineTokens:function(n,o){return oi(this,je(n),o,!0)},getTokenTypeAt:function(n){n=Pt(this.doc,n);var o=Kr(this,Be(this.doc,n.line)),A=0,j=(o.length-1)/2,X=n.ch,Q;if(X==0)Q=o[2];else for(;;){var re=A+j>>1;if((re?o[re*2-1]:0)>=X)j=re;else if(o[re*2+1]<X)A=re+1;else{Q=o[re*2+2];break}}var ve=Q?Q.indexOf("overlay "):-1;return ve<0?Q:ve==0?null:Q.slice(0,ve-1)},getModeAt:function(n){var o=this.doc.mode;return o.innerMode?e.innerMode(o,this.getTokenAt(n).state).mode:o},getHelper:function(n,o){return this.getHelpers(n,o)[0]},getHelpers:function(n,o){var A=[];if(!r.hasOwnProperty(o))return A;var j=r[o],X=this.getModeAt(n);if(typeof X[o]=="string")j[X[o]]&&A.push(j[X[o]]);else if(X[o])for(var Q=0;Q<X[o].length;Q++){var re=j[X[o][Q]];re&&A.push(re)}else X.helperType&&j[X.helperType]?A.push(j[X.helperType]):j[X.name]&&A.push(j[X.name]);for(var ve=0;ve<j._global.length;ve++){var be=j._global[ve];be.pred(X,this)&&ye(A,be.val)==-1&&A.push(be.val)}return A},getStateAfter:function(n,o){var A=this.doc;return n=Xt(A,n==null?A.first+A.size-1:n),Nn(this,n+1,o).state},cursorCoords:function(n,o){var A,j=this.doc.sel.primary();return n==null?A=j.head:typeof n=="object"?A=Pt(this.doc,n):A=n?j.from():j.to(),Qt(this,A,o||"page")},charCoords:function(n,o){return xr(this,Pt(this.doc,n),o||"page")},coordsChar:function(n,o){return n=rr(this,n,o||"page"),ir(this,n.left,n.top)},lineAtHeight:function(n,o){return n=rr(this,{top:n,left:0},o||"page").top,Vt(this.doc,n+this.display.viewOffset)},heightAtLine:function(n,o,A){var j=!1,X;if(typeof n=="number"){var Q=this.doc.first+this.doc.size-1;n<this.doc.first?n=this.doc.first:n>Q&&(n=Q,j=!0),X=Be(this.doc,n)}else X=n;return Fn(this,X,{top:0,left:0},o||"page",A||j).top+(j?this.doc.height-Fr(X):0)},defaultTextHeight:function(){return or(this.display)},defaultCharWidth:function(){return Rr(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(n,o,A,j,X){var Q=this.display;n=Qt(this,Pt(this.doc,n));var re=n.bottom,ve=n.left;if(o.style.position="absolute",o.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(o),Q.sizer.appendChild(o),j=="over")re=n.top;else if(j=="above"||j=="near"){var be=Math.max(Q.wrapper.clientHeight,this.doc.height),Pe=Math.max(Q.sizer.clientWidth,Q.lineSpace.clientWidth);(j=="above"||n.bottom+o.offsetHeight>be)&&n.top>o.offsetHeight?re=n.top-o.offsetHeight:n.bottom+o.offsetHeight<=be&&(re=n.bottom),ve+o.offsetWidth>Pe&&(ve=Pe-o.offsetWidth)}o.style.top=re+"px",o.style.left=o.style.right="",X=="right"?(ve=Q.sizer.clientWidth-o.offsetWidth,o.style.right="0px"):(X=="left"?ve=0:X=="middle"&&(ve=(Q.sizer.clientWidth-o.offsetWidth)/2),o.style.left=ve+"px"),A&&Js(this,{left:ve,top:re,right:ve+o.offsetWidth,bottom:re+o.offsetHeight})},triggerOnKeyDown:Sr(Ps),triggerOnKeyPress:Sr(Os),triggerOnKeyUp:Ds,triggerOnMouseDown:Sr(ks),execCommand:function(n){if(xa.hasOwnProperty(n))return xa[n].call(null,this)},triggerElectric:Sr(function(n){js(this,n)}),findPosH:function(n,o,A,j){var X=1;o<0&&(X=-1,o=-o);for(var Q=Pt(this.doc,n),re=0;re<o&&!(Q=wo(this.doc,Q,X,A,j),Q.hitSide);++re);return Q},moveH:Sr(function(n,o){var A=this;this.extendSelectionsBy(function(j){return A.display.shift||A.doc.extend||j.empty()?wo(A.doc,j.head,n,o,A.options.rtlMoveVisually):n<0?j.from():j.to()},pe)}),deleteH:Sr(function(n,o){var A=this.doc.sel,j=this.doc;A.somethingSelected()?j.replaceSelection("",null,"+delete"):Ji(this,function(X){var Q=wo(j,X.head,n,o,!1);return n<0?{from:Q,to:X.head}:{from:X.head,to:Q}})}),findPosV:function(n,o,A,j){var X=1,Q=j;o<0&&(X=-1,o=-o);for(var re=Pt(this.doc,n),ve=0;ve<o;++ve){var be=Qt(this,re,"div");if(Q==null?Q=be.left:be.left=Q,re=Gs(this,be,X,A),re.hitSide)break}return re},moveV:Sr(function(n,o){var A=this,j=this.doc,X=[],Q=!this.display.shift&&!j.extend&&j.sel.somethingSelected();if(j.extendSelectionsBy(function(ve){if(Q)return n<0?ve.from():ve.to();var be=Qt(A,ve.head,"div");ve.goalColumn!=null&&(be.left=ve.goalColumn),X.push(be.left);var Pe=Gs(A,be,n,o);return o=="page"&&ve==j.sel.primary()&&ao(A,xr(A,Pe,"div").top-be.top),Pe},pe),X.length)for(var re=0;re<j.sel.ranges.length;re++)j.sel.ranges[re].goalColumn=X[re]}),findWordAt:function(n){var o=this.doc,A=Be(o,n.line).text,j=n.ch,X=n.ch;if(A){var Q=this.getHelper(n,"wordChars");(n.sticky=="before"||X==A.length)&&j?--j:++X;for(var re=A.charAt(j),ve=Re(re,Q)?function(be){return Re(be,Q)}:/\s/.test(re)?function(be){return/\s/.test(be)}:function(be){return!/\s/.test(be)&&!Re(be)};j>0&&ve(A.charAt(j-1));)--j;for(;X<A.length&&ve(A.charAt(X));)++X}return new fn(je(n.line,j),je(n.line,X))},toggleOverwrite:function(n){if(n!=null&&n==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?K(this.display.cursorDiv,"CodeMirror-overwrite"):d(this.display.cursorDiv,"CodeMirror-overwrite"),se(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==M()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:Sr(function(n,o){oa(this,n,o)}),getScrollInfo:function(){var n=this.display.scroller;return{left:n.scrollLeft,top:n.scrollTop,height:n.scrollHeight-zr(this)-this.display.barHeight,width:n.scrollWidth-zr(this)-this.display.barWidth,clientHeight:Ri(this),clientWidth:Jr(this)}},scrollIntoView:Sr(function(n,o){n==null?(n={from:this.doc.sel.primary().head,to:null},o==null&&(o=this.options.cursorScrollMargin)):typeof n=="number"?n={from:je(n,0),to:null}:n.from==null&&(n={from:n,to:null}),n.to||(n.to=n.from),n.margin=o||0,n.from.line!=null?Qs(this,n):No(this,n.from,n.to,n.margin)}),setSize:Sr(function(n,o){var A=this,j=function(Q){return typeof Q=="number"||/^\d+$/.test(String(Q))?Q+"px":Q};n!=null&&(this.display.wrapper.style.width=j(n)),o!=null&&(this.display.wrapper.style.height=j(o)),this.options.lineWrapping&&Gn(this);var X=this.display.viewFrom;this.doc.iter(X,this.display.viewTo,function(Q){if(Q.widgets){for(var re=0;re<Q.widgets.length;re++)if(Q.widgets[re].noHScroll){mi(A,X,"widget");break}}++X}),this.curOp.forceUpdate=!0,se(this,"refresh",this)}),operation:function(n){return Ur(this,n)},startOperation:function(){return ki(this)},endOperation:function(){return Mi(this)},refresh:Sr(function(){var n=this.display.cachedTextHeight;Lr(this),this.curOp.forceUpdate=!0,wn(this),oa(this,this.doc.scrollLeft,this.doc.scrollTop),lo(this.display),(n==null||Math.abs(n-or(this.display))>.5||this.options.lineWrapping)&&to(this),se(this,"refresh",this)}),swapDoc:Sr(function(n){var o=this.doc;return o.cm=null,this.state.selectingText&&this.state.selectingText(),Jo(this,n),wn(this),this.display.input.reset(),oa(this,n.scrollLeft,n.scrollTop),this.curOp.forceScroll=!0,Zn(this,"swapDoc",this,o),o}),phrase:function(n){var o=this.options.phrases;return o&&Object.prototype.hasOwnProperty.call(o,n)?o[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}},ue(e),e.registerHelper=function(n,o,A){r.hasOwnProperty(n)||(r[n]=e[n]={_global:[]}),r[n][o]=A},e.registerGlobalHelper=function(n,o,A,j){e.registerHelper(n,o,j),r[n]._global.push({pred:A,val:j})}}function wo(e,t,r,n,o){var A=t,j=r,X=Be(e,t.line),Q=o&&e.direction=="rtl"?-r:r;function re(){var St=t.line+Q;return St<e.first||St>=e.first+e.size?!1:(t=new je(St,t.ch,t.sticky),X=Be(e,St))}function ve(St){var vt;if(n=="codepoint"){var Mt=X.text.charCodeAt(t.ch+(n>0?0:-1));isNaN(Mt)?vt=null:vt=new je(t.line,Math.max(0,Math.min(X.text.length,t.ch+r*(Mt>=55296&&Mt<56320?2:1))),-r)}else o?vt=Ml(e.cm,X,t,r):vt=bo(X,t,r);if(vt==null)if(!St&&re())t=Eo(o,e.cm,X,t.line,Q);else return!1;else t=vt;return!0}if(n=="char"||n=="codepoint")ve();else if(n=="column")ve(!0);else if(n=="word"||n=="group")for(var be=null,Pe=n=="group",we=e.cm&&e.cm.getHelper(t,"wordChars"),We=!0;!(r<0&&!ve(!We));We=!1){var Ye=X.text.charAt(t.ch)||`
`,it=Re(Ye,we)?"w":Pe&&Ye==`
`?"n":!Pe||/\s/.test(Ye)?null:"p";if(Pe&&!We&&!it&&(it="s"),be&&be!=it){r<0&&(r=1,ve(),t.sticky="after");break}if(it&&(be=it),r>0&&!ve(!We))break}var gt=Wa(e,t,A,j,!0);return Rn(A,gt)&&(gt.hitSide=!0),gt}function Gs(e,t,r,n){var o=e.doc,A=t.left,j;if(n=="page"){var X=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),Q=Math.max(X-.5*or(e.display),3);j=(r>0?t.bottom:t.top)+r*Q}else n=="line"&&(j=r>0?t.bottom+3:t.top-3);for(var re;!(re=ir(e,A,j),!re.outside);){if(r<0?j<=0:j>=o.height){re.hitSide=!0;break}j+=r*5}return re}var yn=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new ge,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};yn.prototype.init=function(e){var t=this,r=this,n=r.cm,o=r.div=e.lineDiv;Hs(o,n.options.spellcheck,n.options.autocorrect,n.options.autocapitalize);function A(X){for(var Q=X.target;Q;Q=Q.parentNode){if(Q==o)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(Q.className))break}return!1}Me(o,"paste",function(X){if(!A(X)||Z(n,X)||Fs(X,n))return;N<=11&&setTimeout(sr(n,function(){return t.updateFromDOM()}),20)}),Me(o,"compositionstart",function(X){t.composing={data:X.data,done:!1}}),Me(o,"compositionupdate",function(X){t.composing||(t.composing={data:X.data,done:!1})}),Me(o,"compositionend",function(X){t.composing&&(X.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Me(o,"touchstart",function(){return r.forceCompositionEnd()}),Me(o,"input",function(){t.composing||t.readFromDOMSoon()});function j(X){if(!A(X)||Z(n,X))return;if(n.somethingSelected())Xa({lineWise:!1,text:n.getSelections()}),X.type=="cut"&&n.replaceSelection("",null,"cut");else if(n.options.lineWiseCopyCut){var Q=Ws(n);Xa({lineWise:!0,text:Q.text}),X.type=="cut"&&n.operation(function(){n.setSelections(Q.ranges,0,Se),n.replaceSelection("",null,"cut")})}else return;if(X.clipboardData){X.clipboardData.clearData();var re=Zr.text.join(`
`);if(X.clipboardData.setData("Text",re),X.clipboardData.getData("Text")==re){X.preventDefault();return}}var ve=Ks(),be=ve.firstChild;n.display.lineSpace.insertBefore(ve,n.display.lineSpace.firstChild),be.value=Zr.text.join(`
`);var Pe=document.activeElement;ee(be),setTimeout(function(){n.display.lineSpace.removeChild(ve),Pe.focus(),Pe==o&&r.showPrimarySelection()},50)}Me(o,"copy",j),Me(o,"cut",j)},yn.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},yn.prototype.prepareSelection=function(){var e=Do(this.cm,!1);return e.focus=document.activeElement==this.div,e},yn.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},yn.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},yn.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,r=t.doc.sel.primary(),n=r.from(),o=r.to();if(t.display.viewTo==t.display.viewFrom||n.line>=t.display.viewTo||o.line<t.display.viewFrom){e.removeAllRanges();return}var A=$a(t,e.anchorNode,e.anchorOffset),j=$a(t,e.focusNode,e.focusOffset);if(A&&!A.bad&&j&&!j.bad&&ft(Cn(A,j),n)==0&&ft(vr(A,j),o)==0)return;var X=t.display.view,Q=n.line>=t.display.viewFrom&&zs(t,n)||{node:X[0].measure.map[2],offset:0},re=o.line<t.display.viewTo&&zs(t,o);if(!re){var ve=X[X.length-1].measure,be=ve.maps?ve.maps[ve.maps.length-1]:ve.map;re={node:be[be.length-1],offset:be[be.length-2]-be[be.length-3]}}if(!Q||!re){e.removeAllRanges();return}var Pe=e.rangeCount&&e.getRangeAt(0),we;try{we=m(Q.node,Q.offset,re.offset,re.node)}catch(We){}we&&(!P&&t.state.focused?(e.collapse(Q.node,Q.offset),we.collapsed||(e.removeAllRanges(),e.addRange(we))):(e.removeAllRanges(),e.addRange(we)),Pe&&e.anchorNode==null?e.addRange(Pe):P&&this.startGracePeriod()),this.rememberSelection()},yn.prototype.startGracePeriod=function(){var e=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){e.gracePeriod=!1,e.selectionChanged()&&e.cm.operation(function(){return e.cm.curOp.selectionChanged=!0})},20)},yn.prototype.showMultipleSelections=function(e){s(this.cm.display.cursorDiv,e.cursors),s(this.cm.display.selectionDiv,e.selection)},yn.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},yn.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return b(this.div,t)},yn.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},yn.prototype.blur=function(){this.div.blur()},yn.prototype.getField=function(){return this.div},yn.prototype.supportsTouch=function(){return!0},yn.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():Ur(this.cm,function(){return e.cm.curOp.selectionChanged=!0});function t(){e.cm.state.focused&&(e.pollSelection(),e.polling.set(e.cm.options.pollInterval,t))}this.polling.set(this.cm.options.pollInterval,t)},yn.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},yn.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(f&&_&&this.cm.display.gutterSpecs.length&&eu(e.anchorNode)){this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus();return}if(this.composing)return;this.rememberSelection();var r=$a(t,e.anchorNode,e.anchorOffset),n=$a(t,e.focusNode,e.focusOffset);r&&n&&Ur(t,function(){mr(t.doc,vi(r,n),Se),(r.bad||n.bad)&&(t.curOp.selectionChanged=!0)})},yn.prototype.pollContent=function(){this.readDOMTimeout!=null&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,t=e.display,r=e.doc.sel.primary(),n=r.from(),o=r.to();if(n.ch==0&&n.line>e.firstLine()&&(n=je(n.line-1,Be(e.doc,n.line-1).length)),o.ch==Be(e.doc,o.line).text.length&&o.line<e.lastLine()&&(o=je(o.line+1,0)),n.line<t.viewFrom||o.line>t.viewTo-1)return!1;var A,j,X;n.line==t.viewFrom||(A=Pi(e,n.line))==0?(j=Ft(t.view[0].line),X=t.view[0].node):(j=Ft(t.view[A].line),X=t.view[A-1].node.nextSibling);var Q=Pi(e,o.line),re,ve;if(Q==t.view.length-1?(re=t.viewTo-1,ve=t.lineDiv.lastChild):(re=Ft(t.view[Q+1].line)-1,ve=t.view[Q+1].node.previousSibling),!X)return!1;for(var be=e.doc.splitLines(tu(e,X,ve,j,re)),Pe=Rt(e.doc,je(j,0),je(re,Be(e.doc,re).text.length));be.length>1&&Pe.length>1;)if(x(be)==x(Pe))be.pop(),Pe.pop(),re--;else if(be[0]==Pe[0])be.shift(),Pe.shift(),j++;else break;for(var we=0,We=0,Ye=be[0],it=Pe[0],gt=Math.min(Ye.length,it.length);we<gt&&Ye.charCodeAt(we)==it.charCodeAt(we);)++we;for(var St=x(be),vt=x(Pe),Mt=Math.min(St.length-(be.length==1?we:0),vt.length-(Pe.length==1?we:0));We<Mt&&St.charCodeAt(St.length-We-1)==vt.charCodeAt(vt.length-We-1);)++We;if(be.length==1&&Pe.length==1&&j==n.line)for(;we&&we>n.ch&&St.charCodeAt(St.length-We-1)==vt.charCodeAt(vt.length-We-1);)we--,We++;be[be.length-1]=St.slice(0,St.length-We).replace(/^\u200b+/,""),be[0]=be[0].slice(we).replace(/\u200b+$/,"");var $t=je(j,we),Ht=je(re,Pe.length?x(Pe).length-We:0);if(be.length>1||be[0]||ft($t,Ht))return Xi(e.doc,be,$t,Ht,"+input"),!0},yn.prototype.ensurePolled=function(){this.forceCompositionEnd()},yn.prototype.reset=function(){this.forceCompositionEnd()},yn.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},yn.prototype.readFromDOMSoon=function(){var e=this;if(this.readDOMTimeout!=null)return;this.readDOMTimeout=setTimeout(function(){if(e.readDOMTimeout=null,e.composing)if(e.composing.done)e.composing=null;else return;e.updateFromDOM()},80)},yn.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&Ur(this.cm,function(){return Lr(e.cm)})},yn.prototype.setUneditable=function(e){e.contentEditable="false"},yn.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||sr(this.cm,To)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},yn.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},yn.prototype.onContextMenu=function(){},yn.prototype.resetPosition=function(){},yn.prototype.needsContentAttribute=!0;function zs(e,t){var r=ut(e,t.line);if(!r||r.hidden)return null;var n=Be(e.doc,t.line),o=tt(r,n,t.line),A=rt(n,e.doc.direction),j="left";if(A){var X=Ze(A,t.ch);j=X%2?"right":"left"}var Q=en(o.map,t.ch,j);return Q.offset=Q.collapse=="right"?Q.end:Q.start,Q}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,o){var A="",j=!1,X=e.doc.lineSeparator(),Q=!1;function re(we){return function(We){return We.id==we}}function ve(){j&&(A+=X,Q&&(A+=X),j=Q=!1)}function be(we){we&&(ve(),A+=we)}function Pe(we){if(we.nodeType==1){var We=we.getAttribute("cm-text");if(We){be(We);return}var Ye=we.getAttribute("cm-marker"),it;if(Ye){var gt=e.findMarks(je(n,0),je(o+1,0),re(+Ye));gt.length&&(it=gt[0].find(0))&&be(Rt(e.doc,it.from,it.to).join(X));return}if(we.getAttribute("contenteditable")=="false")return;var St=/^(pre|div|p|li|table|br)$/i.test(we.nodeName);if(!/^br$/i.test(we.nodeName)&&we.textContent.length==0)return;St&&ve();for(var vt=0;vt<we.childNodes.length;vt++)Pe(we.childNodes[vt]);/^(pre|p)$/i.test(we.nodeName)&&(Q=!0),St&&(j=!0)}else we.nodeType==3&&be(we.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(Pe(t),t==r);)t=t.nextSibling,Q=!1;return A}function $a(e,t,r){var n;if(t==e.display.lineDiv){if(n=e.display.lineDiv.childNodes[r],!n)return Zi(e.clipPos(je(e.display.viewTo-1)),!0);t=null,r=0}else for(n=t;;n=n.parentNode){if(!n||n==e.display.lineDiv)return null;if(n.parentNode&&n.parentNode==e.display.lineDiv)break}for(var o=0;o<e.display.view.length;o++){var A=e.display.view[o];if(A.node==n)return nu(A,t,r)}}function nu(e,t,r){var n=e.text.firstChild,o=!1;if(!t||!b(n,t))return Zi(je(Ft(e.line),0),!0);if(t==n&&(o=!0,t=n.childNodes[r],r=0,!t)){var A=e.rest?x(e.rest):e.line;return Zi(je(Ft(A),A.text.length),o)}var j=t.nodeType==3?t:null,X=t;for(!j&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(j=t.firstChild,r&&(r=j.nodeValue.length));X.parentNode!=n;)X=X.parentNode;var Q=e.measure,re=Q.maps;function ve(it,gt,St){for(var vt=-1;vt<(re?re.length:0);vt++)for(var Mt=vt<0?Q.map:re[vt],$t=0;$t<Mt.length;$t+=3){var Ht=Mt[$t+2];if(Ht==it||Ht==gt){var nn=Ft(vt<0?e.line:e.rest[vt]),_n=Mt[$t]+St;return(St<0||Ht!=it)&&(_n=Mt[$t+(St?1:0)]),je(nn,_n)}}}var be=ve(j,X,r);if(be)return Zi(be,o);for(var Pe=X.nextSibling,we=j?j.nodeValue.length-r:0;Pe;Pe=Pe.nextSibling){if(be=ve(Pe,Pe.firstChild,0),be)return Zi(je(be.line,be.ch-we),o);we+=Pe.textContent.length}for(var We=X.previousSibling,Ye=r;We;We=We.previousSibling){if(be=ve(We,We.firstChild,-1),be)return Zi(je(be.line,be.ch+Ye),o);Ye+=We.textContent.length}}var zn=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new ge,this.hasSelection=!1,this.composing=null};zn.prototype.init=function(e){var t=this,r=this,n=this.cm;this.createField(e);var o=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),S&&(o.style.width="0px"),Me(o,"input",function(){H&&N>=9&&t.hasSelection&&(t.hasSelection=null),r.poll()}),Me(o,"paste",function(j){if(Z(n,j)||Fs(j,n))return;n.state.pasteIncoming=+new Date,r.fastPoll()});function A(j){if(Z(n,j))return;if(n.somethingSelected())Xa({lineWise:!1,text:n.getSelections()});else if(n.options.lineWiseCopyCut){var X=Ws(n);Xa({lineWise:!0,text:X.text}),j.type=="cut"?n.setSelections(X.ranges,null,Se):(r.prevInput="",o.value=X.text.join(`
`),ee(o))}else return;j.type=="cut"&&(n.state.cutIncoming=+new Date)}Me(o,"cut",A),Me(o,"copy",A),Me(e.scroller,"paste",function(j){if(Yr(e,j)||Z(n,j))return;if(!o.dispatchEvent){n.state.pasteIncoming=+new Date,r.focus();return}var X=new Event("paste");X.clipboardData=j.clipboardData,o.dispatchEvent(X)}),Me(e.lineSpace,"selectstart",function(j){Yr(e,j)||te(j)}),Me(o,"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"})}}),Me(o,"compositionend",function(){r.composing&&(r.poll(),r.composing.range.clear(),r.composing=null)})},zn.prototype.createField=function(e){this.wrapper=Ks(),this.textarea=this.wrapper.firstChild},zn.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},zn.prototype.prepareSelection=function(){var e=this.cm,t=e.display,r=e.doc,n=Do(e);if(e.options.moveInputWithCursor){var o=Qt(e,r.sel.primary().head,"div"),A=t.wrapper.getBoundingClientRect(),j=t.lineDiv.getBoundingClientRect();n.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,o.top+j.top-A.top)),n.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,o.left+j.left-A.left))}return n},zn.prototype.showSelection=function(e){var t=this.cm,r=t.display;s(r.cursorDiv,e.cursors),s(r.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},zn.prototype.reset=function(e){if(this.contextMenuPending||this.composing)return;var t=this.cm;if(t.somethingSelected()){this.prevInput="";var r=t.getSelection();this.textarea.value=r,t.state.focused&&ee(this.textarea),H&&N>=9&&(this.hasSelection=r)}else e||(this.prevInput=this.textarea.value="",H&&N>=9&&(this.hasSelection=null))},zn.prototype.getField=function(){return this.textarea},zn.prototype.supportsTouch=function(){return!1},zn.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!l||M()!=this.textarea))try{this.textarea.focus()}catch(e){}},zn.prototype.blur=function(){this.textarea.blur()},zn.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},zn.prototype.receivedFocus=function(){this.slowPoll()},zn.prototype.slowPoll=function(){var e=this;if(this.pollingFast)return;this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},zn.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function r(){var n=t.poll();!n&&!e?(e=!0,t.polling.set(60,r)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,r)},zn.prototype.poll=function(){var e=this,t=this.cm,r=this.textarea,n=this.prevInput;if(this.contextMenuPending||!t.state.focused||st(r)&&!n&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var o=r.value;if(o==n&&!t.somethingSelected())return!1;if(H&&N>=9&&this.hasSelection===o||i&&/[\uf700-\uf7ff]/.test(o))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var A=o.charCodeAt(0);if(A==8203&&!n&&(n="\u200B"),A==8666)return this.reset(),this.cm.execCommand("undo")}for(var j=0,X=Math.min(n.length,o.length);j<X&&n.charCodeAt(j)==o.charCodeAt(j);)++j;return Ur(t,function(){To(t,o.slice(j),n.length-j,null,e.composing?"*compose":null),o.length>1e3||o.indexOf(`
`)>-1?r.value=e.prevInput="":e.prevInput=o,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},zn.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},zn.prototype.onKeyPress=function(){H&&N>=9&&(this.hasSelection=null),this.fastPoll()},zn.prototype.onContextMenu=function(e){var t=this,r=t.cm,n=r.display,o=t.textarea;t.contextMenuPending&&t.contextMenuPending();var A=Li(r,e),j=n.scroller.scrollTop;if(!A||w)return;var X=r.options.resetSelectionOnContextMenu;X&&r.doc.sel.contains(A)==-1&&sr(r,mr)(r.doc,vi(A),Se);var Q=o.style.cssText,re=t.wrapper.style.cssText,ve=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",o.style.cssText=`position: absolute; width: 30px; height: 30px;
top: `+(e.clientY-ve.top-5)+"px; left: "+(e.clientX-ve.left-5)+`px;
z-index: 1000; background: `+(H?"rgba(255, 255, 255, .05)":"transparent")+`;
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var be;k&&(be=window.scrollY),n.input.focus(),k&&window.scrollTo(null,be),n.input.reset(),r.somethingSelected()||(o.value=t.prevInput=" "),t.contextMenuPending=we,n.selForContextMenu=r.doc.sel,clearTimeout(n.detectingSelectAll);function Pe(){if(o.selectionStart!=null){var Ye=r.somethingSelected(),it="\u200B"+(Ye?o.value:"");o.value="\u21DA",o.value=it,t.prevInput=Ye?"":"\u200B",o.selectionStart=1,o.selectionEnd=it.length,n.selForContextMenu=r.doc.sel}}function we(){if(t.contextMenuPending!=we)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=re,o.style.cssText=Q,H&&N<9&&n.scrollbars.setScrollTop(n.scroller.scrollTop=j),o.selectionStart!=null){(!H||H&&N<9)&&Pe();var Ye=0,it=function(){n.selForContextMenu==r.doc.sel&&o.selectionStart==0&&o.selectionEnd>0&&t.prevInput=="\u200B"?sr(r,us)(r):Ye++<10?n.detectingSelectAll=setTimeout(it,500):(n.selForContextMenu=null,n.input.reset())};n.detectingSelectAll=setTimeout(it,200)}}if(H&&N>=9&&Pe(),u){he(e);var We=function(){mt(window,"mouseup",We),setTimeout(we,20)};Me(window,"mouseup",We)}else setTimeout(we,50)},zn.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},zn.prototype.setUneditable=function(){},zn.prototype.needsContentAttribute=!1;function ru(e,t){if(t=t?F(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=M();t.autofocus=r==e||e.getAttribute("autofocus")!=null&&r==document.body}function n(){e.value=X.getValue()}var o;if(e.form&&(Me(e.form,"submit",n),!t.leaveSubmitMethodAlone)){var A=e.form;o=A.submit;try{var j=A.submit=function(){n(),A.submit=o,A.submit(),A.submit=j}}catch(Q){}}t.finishInit=function(Q){Q.save=n,Q.getTextArea=function(){return e},Q.toTextArea=function(){Q.toTextArea=isNaN,n(),e.parentNode.removeChild(Q.getWrapperElement()),e.style.display="",e.form&&(mt(e.form,"submit",n),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=o))}},e.style.display="none";var X=Dn(function(Q){return e.parentNode.insertBefore(Q,e.nextSibling)},t);return X}function iu(e){e.off=mt,e.on=Me,e.wheelEventPixels=cl,e.Doc=Pr,e.splitLines=Xe,e.countColumn=ie,e.findColumn=Ee,e.isWordChar=_e,e.Pass=Te,e.signal=se,e.Line=li,e.changeEnd=yi,e.scrollbarModel=Fo,e.Pos=je,e.cmpPos=ft,e.modes=Zt,e.mimeModes=At,e.resolveMode=Dt,e.getMode=Ot,e.modeExtensions=ht,e.extendMode=kt,e.copyState=bt,e.startState=Et,e.innerMode=_t,e.commands=xa,e.keyMap=di,e.keyName=Ts,e.isModifierKey=Cs,e.lookupKey=Yi,e.normalizeKeyMap=kl,e.StringStream=nt,e.SharedTextMarker=ya,e.TextMarker=Ei,e.LineWidget=va,e.e_preventDefault=te,e.e_stopPropagation=ne,e.e_stop=he,e.addClass=K,e.contains=b,e.rmClass=d,e.keyNames=xi}Yl(Dn),ql(Dn);var au="iter insert remove copy getEditor constructor".split(" ");for(var Ya in Pr.prototype)Pr.prototype.hasOwnProperty(Ya)&&ye(au,Ya)<0&&(Dn.prototype[Ya]=function(e){return function(){return e.apply(this.doc,arguments)}}(Pr.prototype[Ya]));return ue(Pr),Dn.inputStyles={textarea:zn,contenteditable:yn},Dn.defineMode=function(e){!Dn.defaults.mode&&e!="null"&&(Dn.defaults.mode=e),qt.apply(this,arguments)},Dn.defineMIME=Gt,Dn.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Dn.defineMIME("text/plain","null"),Dn.defineExtension=function(e,t){Dn.prototype[e]=t},Dn.defineDocExtension=function(e,t){Pr.prototype[e]=t},Dn.fromTextArea=ru,iu(Dn),Dn.version="5.58.2",Dn})},WaYH:function(qe,Ke,V){"use strict";var fe=V("rePB"),$=V("Ff2n"),P=V("VTBJ"),Y=V("1OyB"),U=V("vuIU"),O=V("JX7q"),H=V("Ji7U"),N=V("LK+K"),k=V("q1tI"),L=V("TSYQ"),_=V.n(L),w=V("sboe"),D=V("OZM5"),T=function(u){var y=u.prefixCls,d=u.level,h=u.isStart,s=u.isEnd;if(!d)return null;for(var a="".concat(y,"-indent-unit"),g=[],m=0;m<d;m+=1){var b;g.push(k.createElement("span",{key:m,className:_()(a,(b={},Object(fe.a)(b,"".concat(a,"-start"),h[m+1]),Object(fe.a)(b,"".concat(a,"-end"),s[m+1]),Object(fe.a)(b,"".concat(a,"-end-first-level"),!m&&s[0]),b))}))}return k.createElement("span",{"aria-hidden":"true",className:"".concat(y,"-indent")},g)},C=T,S=V("815F"),f="open",l="close",i="---",c=function(p){Object(H.a)(y,p);var u=Object(N.a)(y);function y(){var d;return Object(Y.a)(this,y),d=u.apply(this,arguments),d.state={dragNodeHighlight:!1},d.onSelectorClick=function(h){var s=d.props.context.onNodeClick;s(h,Object(S.b)(d.props)),d.isSelectable()?d.onSelect(h):d.onCheck(h)},d.onSelectorDoubleClick=function(h){var s=d.props.context.onNodeDoubleClick;s(h,Object(S.b)(d.props))},d.onSelect=function(h){if(d.isDisabled())return;var s=d.props.context.onNodeSelect;h.preventDefault(),s(h,Object(S.b)(d.props))},d.onCheck=function(h){if(d.isDisabled())return;var s=d.props,a=s.disableCheckbox,g=s.checked,m=d.props.context.onNodeCheck;if(!d.isCheckable()||a)return;h.preventDefault();var b=!g;m(h,Object(S.b)(d.props),b)},d.onMouseEnter=function(h){var s=d.props.context.onNodeMouseEnter;s(h,Object(S.b)(d.props))},d.onMouseLeave=function(h){var s=d.props.context.onNodeMouseLeave;s(h,Object(S.b)(d.props))},d.onContextMenu=function(h){var s=d.props.context.onNodeContextMenu;s(h,Object(S.b)(d.props))},d.onDragStart=function(h){var s=d.props.context.onNodeDragStart;h.stopPropagation(),d.setState({dragNodeHighlight:!0}),s(h,Object(O.a)(d));try{h.dataTransfer.setData("text/plain","")}catch(a){}},d.onDragEnter=function(h){var s=d.props.context.onNodeDragEnter;h.preventDefault(),h.stopPropagation(),s(h,Object(O.a)(d))},d.onDragOver=function(h){var s=d.props.context.onNodeDragOver;h.preventDefault(),h.stopPropagation(),s(h,Object(O.a)(d))},d.onDragLeave=function(h){var s=d.props.context.onNodeDragLeave;h.stopPropagation(),s(h,Object(O.a)(d))},d.onDragEnd=function(h){var s=d.props.context.onNodeDragEnd;h.stopPropagation(),d.setState({dragNodeHighlight:!1}),s(h,Object(O.a)(d))},d.onDrop=function(h){var s=d.props.context.onNodeDrop;h.preventDefault(),h.stopPropagation(),d.setState({dragNodeHighlight:!1}),s(h,Object(O.a)(d))},d.onExpand=function(h){var s=d.props.context.onNodeExpand;s(h,Object(S.b)(d.props))},d.setSelectHandle=function(h){d.selectHandle=h},d.getNodeState=function(){var h=d.props.expanded;return d.isLeaf()?null:h?f:l},d.hasChildren=function(){var h=d.props.eventKey,s=d.props.context.keyEntities,a=s[h]||{},g=a.children;return!!(g||[]).length},d.isLeaf=function(){var h=d.props,s=h.isLeaf,a=h.loaded,g=d.props.context.loadData,m=d.hasChildren();return s===!1?!1:s||!g&&!m||g&&a&&!m},d.isDisabled=function(){var h=d.props.disabled,s=d.props.context.disabled;return!!(s||h)},d.isCheckable=function(){var h=d.props.checkable,s=d.props.context.checkable;return!s||h===!1?!1:s},d.syncLoadData=function(h){var s=h.expanded,a=h.loading,g=h.loaded,m=d.props.context,b=m.loadData,M=m.onNodeLoad;if(a)return;b&&s&&!d.isLeaf()&&(!d.hasChildren()&&!g&&M(Object(S.b)(d.props)))},d.renderSwitcher=function(){var h=d.props,s=h.expanded,a=h.switcherIcon,g=d.props.context,m=g.prefixCls,b=g.switcherIcon,M=a||b;if(d.isLeaf())return k.createElement("span",{className:_()("".concat(m,"-switcher"),"".concat(m,"-switcher-noop"))},typeof M=="function"?M(Object(P.a)(Object(P.a)({},d.props),{},{isLeaf:!0})):M);var K=_()("".concat(m,"-switcher"),"".concat(m,"-switcher_").concat(s?f:l));return k.createElement("span",{onClick:d.onExpand,className:K},typeof M=="function"?M(Object(P.a)(Object(P.a)({},d.props),{},{isLeaf:!1})):M)},d.renderCheckbox=function(){var h=d.props,s=h.checked,a=h.halfChecked,g=h.disableCheckbox,m=d.props.context.prefixCls,b=d.isDisabled(),M=d.isCheckable();if(!M)return null;var K=typeof M!="boolean"?M:null;return k.createElement("span",{className:_()("".concat(m,"-checkbox"),s&&"".concat(m,"-checkbox-checked"),!s&&a&&"".concat(m,"-checkbox-indeterminate"),(b||g)&&"".concat(m,"-checkbox-disabled")),onClick:d.onCheck},K)},d.renderIcon=function(){var h=d.props.loading,s=d.props.context.prefixCls;return k.createElement("span",{className:_()("".concat(s,"-iconEle"),"".concat(s,"-icon__").concat(d.getNodeState()||"docu"),h&&"".concat(s,"-icon_loading"))})},d.renderSelector=function(){var h=d.state.dragNodeHighlight,s=d.props,a=s.title,g=s.selected,m=s.icon,b=s.loading,M=s.data,K=d.props.context,z=K.prefixCls,ee=K.showIcon,G=K.icon,F=K.draggable,ie=K.loadData,ge=K.titleRender,ye=d.isDisabled(),xe="".concat(z,"-node-content-wrapper"),Te;if(ee){var Se=m||G;Te=Se?k.createElement("span",{className:_()("".concat(z,"-iconEle"),"".concat(z,"-icon__customize"))},typeof Se=="function"?Se(d.props):Se):d.renderIcon()}else ie&&b&&(Te=d.renderIcon());var me;typeof a=="function"?me=a(M):ge?me=ge(M):me=a;var pe=k.createElement("span",{className:"".concat(z,"-title")},me);return k.createElement("span",{ref:d.setSelectHandle,title:typeof a=="string"?a:"",className:_()("".concat(xe),"".concat(xe,"-").concat(d.getNodeState()||"normal"),!ye&&(g||h)&&"".concat(z,"-node-selected"),!ye&&F&&"draggable"),draggable:!ye&&F||void 0,"aria-grabbed":!ye&&F||void 0,onMouseEnter:d.onMouseEnter,onMouseLeave:d.onMouseLeave,onContextMenu:d.onContextMenu,onClick:d.onSelectorClick,onDoubleClick:d.onSelectorDoubleClick,onDragStart:F?d.onDragStart:void 0},Te,pe)},d}return Object(U.a)(y,[{key:"componentDidMount",value:function(){this.syncLoadData(this.props)}},{key:"componentDidUpdate",value:function(){this.syncLoadData(this.props)}},{key:"isSelectable",value:function(){var h=this.props.selectable,s=this.props.context.selectable;return typeof h=="boolean"?h:s}},{key:"render",value:function(){var h,s=this.props,a=s.eventKey,g=s.className,m=s.style,b=s.dragOver,M=s.dragOverGapTop,K=s.dragOverGapBottom,z=s.isLeaf,ee=s.isStart,G=s.isEnd,F=s.expanded,ie=s.selected,ge=s.checked,ye=s.halfChecked,xe=s.loading,Te=s.domRef,Se=s.active,me=s.onMouseMove,pe=Object($.a)(s,["eventKey","className","style","dragOver","dragOverGapTop","dragOverGapBottom","isLeaf","isStart","isEnd","expanded","selected","checked","halfChecked","loading","domRef","active","onMouseMove"]),Ee=this.props.context,le=Ee.prefixCls,I=Ee.filterTreeNode,x=Ee.draggable,R=Ee.keyEntities,W=this.isDisabled(),J=Object(D.f)(pe),B=R[a]||{},de=B.level,_e=G[G.length-1];return k.createElement("div",Object.assign({ref:Te,className:_()(g,"".concat(le,"-treenode"),(h={},Object(fe.a)(h,"".concat(le,"-treenode-disabled"),W),Object(fe.a)(h,"".concat(le,"-treenode-switcher-").concat(F?"open":"close"),!z),Object(fe.a)(h,"".concat(le,"-treenode-checkbox-checked"),ge),Object(fe.a)(h,"".concat(le,"-treenode-checkbox-indeterminate"),ye),Object(fe.a)(h,"".concat(le,"-treenode-selected"),ie),Object(fe.a)(h,"".concat(le,"-treenode-loading"),xe),Object(fe.a)(h,"".concat(le,"-treenode-active"),Se),Object(fe.a)(h,"".concat(le,"-treenode-leaf-last"),_e),Object(fe.a)(h,"drag-over",!W&&b),Object(fe.a)(h,"drag-over-gap-top",!W&&M),Object(fe.a)(h,"drag-over-gap-bottom",!W&&K),Object(fe.a)(h,"filter-node",I&&I(Object(S.b)(this.props))),h)),style:m,onDragEnter:x?this.onDragEnter:void 0,onDragOver:x?this.onDragOver:void 0,onDragLeave:x?this.onDragLeave:void 0,onDrop:x?this.onDrop:void 0,onDragEnd:x?this.onDragEnd:void 0,onMouseMove:me},J),k.createElement(C,{prefixCls:le,level:de,isStart:ee,isEnd:G}),this.renderSwitcher(),this.renderCheckbox(),this.renderSelector())}}]),y}(k.Component),E=function(u){return k.createElement(w.a.Consumer,null,function(y){return k.createElement(c,Object.assign({},u,{context:y}))})};E.displayName="TreeNode",E.defaultProps={title:i},E.isTreeNode=1;var v=Ke.a=E},Y1PL:function(qe,Ke,V){"use strict";V.r(Ke),V.d(Ke,"ResizableTextArea",function(){return ye});var fe=V("wx14"),$=V("1OyB"),P=V("vuIU"),Y=V("Ji7U"),U=V("LK+K"),O=V("q1tI"),H=V("VTBJ"),N=V("rePB"),k=V("Zm9Q"),L=V("Kwbf"),_=V("c+Xe"),w=V("m+aA"),D=V("bdgK"),T=new Map;function C(Se){Se.forEach(function(me){var pe,Ee=me.target;(pe=T.get(Ee))===null||pe===void 0||pe.forEach(function(le){return le(Ee)})})}var S=new D.default(C),f=null,l=null;function i(Se,me){T.has(Se)||(T.set(Se,new Set),S.observe(Se)),T.get(Se).add(me)}function c(Se,me){T.has(Se)&&(T.get(Se).delete(me),T.get(Se).size||(S.unobserve(Se),T.delete(Se)))}var E=function(Se){Object(Y.a)(pe,Se);var me=Object(U.a)(pe);function pe(){return Object($.a)(this,pe),me.apply(this,arguments)}return Object(P.a)(pe,[{key:"render",value:function(){return this.props.children}}]),pe}(O.Component),v=O.createContext(null);function p(Se){var me=Se.children,pe=Se.onBatchResize,Ee=O.useRef(0),le=O.useRef([]),I=O.useContext(v),x=O.useCallback(function(R,W,J){Ee.current+=1;var B=Ee.current;le.current.push({size:R,element:W,data:J}),Promise.resolve().then(function(){B===Ee.current&&(pe==null||pe(le.current),le.current=[])}),I==null||I(R,W,J)},[pe,I]);return O.createElement(v.Provider,{value:x},me)}function u(Se){var me=Se.children,pe=Se.disabled,Ee=O.useRef(null),le=O.useRef(null),I=O.useContext(v),x=O.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),R=O.isValidElement(me)&&Object(_.c)(me),W=R?me.ref:null,J=O.useMemo(function(){return Object(_.a)(W,Ee)},[W,Ee]),B=O.useRef(Se);B.current=Se;var de=O.useCallback(function(_e){var Re=B.current,Oe=Re.onResize,ke=Re.data,Ie=_e.getBoundingClientRect(),De=Ie.width,Ve=Ie.height,Qe=_e.offsetWidth,at=_e.offsetHeight,Ze=Math.floor(De),yt=Math.floor(Ve);if(x.current.width!==Ze||x.current.height!==yt||x.current.offsetWidth!==Qe||x.current.offsetHeight!==at){var rt={width:Ze,height:yt,offsetWidth:Qe,offsetHeight:at};x.current=rt;var dt=Qe===Math.round(De)?De:Qe,Me=at===Math.round(Ve)?Ve:at,xt=Object(H.a)(Object(H.a)({},rt),{},{offsetWidth:dt,offsetHeight:Me});I==null||I(xt,_e,ke),Oe&&Promise.resolve().then(function(){Oe(xt,_e)})}},[]);return O.useEffect(function(){var _e=Object(w.a)(Ee.current)||Object(w.a)(le.current);return _e&&!pe&&i(_e,de),function(){return c(_e,de)}},[Ee.current,pe]),O.createElement(E,{ref:le},R?O.cloneElement(me,{ref:J}):me)}var y="rc-observer-key";function d(Se){var me=Se.children,pe=Object(k.a)(me);return pe.map(function(Ee,le){var I=(Ee==null?void 0:Ee.key)||"".concat(y,"-").concat(le);return O.createElement(u,Object(fe.a)({},Se,{key:I}),Ee)})}d.Collection=p;var h=d,s=V("bT9E"),a=V("TSYQ"),g=V.n(a),m=`
min-height:0 !important;
max-height:none !important;
height:0 !important;
visibility:hidden !important;
overflow:hidden !important;
position:absolute !important;
z-index:-1000 !important;
top:0 !important;
right:0 !important
`,b=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","font-variant","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing","word-break"],M={},K;function z(Se){var me=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,pe=Se.getAttribute("id")||Se.getAttribute("data-reactid")||Se.getAttribute("name");if(me&&M[pe])return M[pe];var Ee=window.getComputedStyle(Se),le=Ee.getPropertyValue("box-sizing")||Ee.getPropertyValue("-moz-box-sizing")||Ee.getPropertyValue("-webkit-box-sizing"),I=parseFloat(Ee.getPropertyValue("padding-bottom"))+parseFloat(Ee.getPropertyValue("padding-top")),x=parseFloat(Ee.getPropertyValue("border-bottom-width"))+parseFloat(Ee.getPropertyValue("border-top-width")),R=b.map(function(J){return"".concat(J,":").concat(Ee.getPropertyValue(J))}).join(";"),W={sizingStyle:R,paddingSize:I,borderSize:x,boxSizing:le};return me&&pe&&(M[pe]=W),W}function ee(Se){var me=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,pe=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,Ee=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;K||(K=document.createElement("textarea"),K.setAttribute("tab-index","-1"),K.setAttribute("aria-hidden","true"),document.body.appendChild(K)),Se.getAttribute("wrap")?K.setAttribute("wrap",Se.getAttribute("wrap")):K.removeAttribute("wrap");var le=z(Se,me),I=le.paddingSize,x=le.borderSize,R=le.boxSizing,W=le.sizingStyle;K.setAttribute("style","".concat(W,";").concat(m)),K.value=Se.value||Se.placeholder||"";var J=Number.MIN_SAFE_INTEGER,B=Number.MAX_SAFE_INTEGER,de=K.scrollHeight,_e;if(R==="border-box"?de+=x:R==="content-box"&&(de-=I),pe!==null||Ee!==null){K.value=" ";var Re=K.scrollHeight-I;pe!==null&&(J=Re*pe,R==="border-box"&&(J=J+I+x),de=Math.max(J,de)),Ee!==null&&(B=Re*Ee,R==="border-box"&&(B=B+I+x),_e=de>B?"":"hidden",de=Math.min(B,de))}return{height:de,minHeight:J,maxHeight:B,overflowY:_e,resize:"none"}}var G=V("Gytx"),F=V.n(G),ie;(function(Se){Se[Se.NONE=0]="NONE",Se[Se.RESIZING=1]="RESIZING",Se[Se.RESIZED=2]="RESIZED"})(ie||(ie={}));var ge=function(Se){Object(Y.a)(pe,Se);var me=Object(U.a)(pe);function pe(Ee){var le;return Object($.a)(this,pe),le=me.call(this,Ee),le.nextFrameActionId=void 0,le.resizeFrameId=void 0,le.textArea=void 0,le.saveTextArea=function(I){le.textArea=I},le.handleResize=function(I){var x=le.state.resizeStatus,R=le.props,W=R.autoSize,J=R.onResize;if(x!==ie.NONE)return;typeof J=="function"&&J(I),W&&le.resizeOnNextFrame()},le.resizeOnNextFrame=function(){cancelAnimationFrame(le.nextFrameActionId),le.nextFrameActionId=requestAnimationFrame(le.resizeTextarea)},le.resizeTextarea=function(){var I=le.props.autoSize;if(!I||!le.textArea)return;var x=I.minRows,R=I.maxRows,W=ee(le.textArea,!1,x,R);le.setState({textareaStyles:W,resizeStatus:ie.RESIZING},function(){cancelAnimationFrame(le.resizeFrameId),le.resizeFrameId=requestAnimationFrame(function(){le.setState({resizeStatus:ie.RESIZED},function(){le.resizeFrameId=requestAnimationFrame(function(){le.setState({resizeStatus:ie.NONE}),le.fixFirefoxAutoScroll()})})})})},le.renderTextArea=function(){var I=le.props,x=I.prefixCls,R=x===void 0?"rc-textarea":x,W=I.autoSize,J=I.onResize,B=I.className,de=I.disabled,_e=le.state,Re=_e.textareaStyles,Oe=_e.resizeStatus,ke=Object(s.a)(le.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Ie=g()(R,B,Object(N.a)({},"".concat(R,"-disabled"),de));"value"in ke&&(ke.value=ke.value||"");var De=Object(H.a)(Object(H.a)(Object(H.a)({},le.props.style),Re),Oe===ie.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return O.createElement(h,{onResize:le.handleResize,disabled:!(W||J)},O.createElement("textarea",Object(fe.a)({},ke,{className:Ie,style:De,ref:le.saveTextArea})))},le.state={textareaStyles:{},resizeStatus:ie.NONE},le}return Object(P.a)(pe,[{key:"componentDidUpdate",value:function(le){(le.value!==this.props.value||!F()(le.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 le=this.textArea.selectionStart,I=this.textArea.selectionEnd;this.textArea.setSelectionRange(le,I)}}catch(x){}}},{key:"render",value:function(){return this.renderTextArea()}}]),pe}(O.Component),ye=ge,xe=function(Se){Object(Y.a)(pe,Se);var me=Object(U.a)(pe);function pe(Ee){var le;Object($.a)(this,pe),le=me.call(this,Ee),le.resizableTextArea=void 0,le.focus=function(){le.resizableTextArea.textArea.focus()},le.saveTextArea=function(x){le.resizableTextArea=x},le.handleChange=function(x){var R=le.props.onChange;le.setValue(x.target.value,function(){le.resizableTextArea.resizeTextarea()}),R&&R(x)},le.handleKeyDown=function(x){var R=le.props,W=R.onPressEnter,J=R.onKeyDown;x.keyCode===13&&W&&W(x),J&&J(x)};var I=typeof Ee.value=="undefined"||Ee.value===null?Ee.defaultValue:Ee.value;return le.state={value:I},le}return Object(P.a)(pe,[{key:"setValue",value:function(le,I){"value"in this.props||this.setState({value:le},I)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return O.createElement(ye,Object(fe.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(le){return"value"in le?{value:le.value}:null}}]),pe}(O.Component),Te=Ke.default=xe},YBdh:function(qe,Ke,V){qe.exports=V.p+"static/xiren.a6554bc1.svg"},ZWs3:function(qe,Ke,V){"use strict";V.d(Ke,"a",function(){return _});var fe=V("+L6B"),$=V("2/Rp"),P=V("0Owb"),Y=V("9og8"),U=V("tJVT"),O=V("PpiC"),H=V("WmNS"),N=V.n(H),k=V("q1tI"),L=V.n(k),_=function(D){var T=D.children,C=Object(O.a)(D,["children"]),S=Object(k.useState)(!1),f=Object(U.a)(S,2),l=f[0],i=f[1];return L.a.createElement($.a,Object(P.a)({},C,{loading:l,onClick:function(){var c=Object(Y.a)(N.a.mark(function E(v){return N.a.wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.prev=0,i(!0),u.next=4,C.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()}},E,null,[[0,7]])}));return function(E){return c.apply(this,arguments)}}()}),T)}},bT9E:function(qe,Ke,V){"use strict";V.d(Ke,"a",function(){return $});var fe=V("VTBJ");function $(P,Y){var U=Object(fe.a)({},P);return Array.isArray(Y)&&Y.forEach(function(O){delete U[O]}),U}},c5Ni:function(qe,Ke,V){},dejd:function(qe,Ke,V){},dmUQ:function(qe,Ke,V){"use strict";var fe=V("Ff2n"),$=V("rePB"),P=V("1OyB"),Y=V("vuIU"),U=V("Ji7U"),O=V("md7G"),H=V("foSv"),N=V("q1tI"),k=V.n(N),L=V("TSYQ"),_=V.n(L),w=V("4IlW");function D(s,a){var g=Object.keys(s);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(s);a&&(m=m.filter(function(b){return Object.getOwnPropertyDescriptor(s,b).enumerable})),g.push.apply(g,m)}return g}function T(s){for(var a=1;a<arguments.length;a++){var g=arguments[a]!=null?arguments[a]:{};a%2?D(Object(g),!0).forEach(function(m){Object($.a)(s,m,g[m])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(g)):D(Object(g)).forEach(function(m){Object.defineProperty(s,m,Object.getOwnPropertyDescriptor(g,m))})}return s}function C(s){var a=S();return function(){var m=Object(H.a)(s),b;if(a){var M=Object(H.a)(this).constructor;b=Reflect.construct(m,arguments,M)}else b=m.apply(this,arguments);return Object(O.a)(this,b)}}function S(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(s){return!1}}function f(){}function l(s){s.preventDefault()}var i=function(a){return a.replace(/[^\w.-]+/g,"")},c=200,E=600,v=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,p=function(a){return a!=null},u=function(a,g){return g===a||typeof g=="number"&&typeof a=="number"&&isNaN(g)&&isNaN(a)},y=function(s){Object(U.a)(g,s);var a=C(g);function g(m){var b;Object(P.a)(this,g),b=a.call(this,m),b.onKeyDown=function(z){var ee=b.props,G=ee.onKeyDown,F=ee.onPressEnter;if(z.keyCode===w.a.UP){var ie=b.getRatio(z);b.up(z,ie,null),b.stop()}else if(z.keyCode===w.a.DOWN){var ge=b.getRatio(z);b.down(z,ge,null),b.stop()}else z.keyCode===w.a.ENTER&&F&&F(z);if(b.recordCursorPosition(),b.lastKeyCode=z.keyCode,G){for(var ye=arguments.length,xe=new Array(ye>1?ye-1:0),Te=1;Te<ye;Te++)xe[Te-1]=arguments[Te];G.apply(void 0,[z].concat(xe))}},b.onKeyUp=function(z){var ee=b.props.onKeyUp;if(b.stop(),b.recordCursorPosition(),ee){for(var G=arguments.length,F=new Array(G>1?G-1:0),ie=1;ie<G;ie++)F[ie-1]=arguments[ie];ee.apply(void 0,[z].concat(F))}},b.onChange=function(z){var ee=b.props.onChange;b.state.focused&&(b.inputting=!0),b.rawInput=b.props.parser(b.getValueFromEvent(z)),b.setState({inputValue:b.rawInput}),ee(b.toNumber(b.rawInput))},b.onMouseUp=function(){var z=b.props.onMouseUp;b.recordCursorPosition(),z&&z.apply(void 0,arguments)},b.onFocus=function(){var z;b.setState({focused:!0}),(z=b.props).onFocus.apply(z,arguments)},b.onBlur=function(){var z=b.props.onBlur;b.inputting=!1,b.setState({focused:!1});var ee=b.getCurrentValidValue(b.state.inputValue),G=b.setValue(ee,f);if(z){var F=b.input.value,ie=b.getInputDisplayValue({focus:!1,value:G});b.input.value=ie&&Number(ie),z.apply(void 0,arguments),b.input.value=F}},b.getRatio=function(z){var ee=1;return z.metaKey||z.ctrlKey?ee=.1:z.shiftKey&&(ee=10),ee},b.getFullNum=function(z){return isNaN(z)?z:/e/i.test(String(z))?Number(z).toFixed(18).replace(/\.?0+$/,""):z},b.getPrecision=function(z){if(p(b.props.precision))return b.props.precision;var ee=String(z);if(ee.indexOf("e-")>=0)return parseInt(ee.slice(ee.indexOf("e-")+2),10);var G=0;return ee.indexOf(".")>=0&&(G=ee.length-ee.indexOf(".")-1),G},b.getInputDisplayValue=function(z){var ee=z||b.state,G=ee.focused,F=ee.inputValue,ie=ee.value,ge;G?ge=F:ge=b.toPrecisionAsStep(ie),ge==null&&(ge="");var ye=b.formatWrapper(ge);return p(b.props.decimalSeparator)&&(ye=ye.toString().replace(".",b.props.decimalSeparator)),ye},b.recordCursorPosition=function(){try{b.cursorStart=b.input.selectionStart,b.cursorEnd=b.input.selectionEnd,b.currentValue=b.input.value,b.cursorBefore=b.input.value.substring(0,b.cursorStart),b.cursorAfter=b.input.value.substring(b.cursorEnd)}catch(z){}},b.restoreByAfter=function(z){if(z===void 0)return!1;var ee=b.input.value,G=ee.lastIndexOf(z);if(G===-1)return!1;var F=b.cursorBefore.length;return b.lastKeyCode===w.a.DELETE&&b.cursorBefore.charAt(F-1)===z[0]?(b.fixCaret(F,F),!0):G+z.length===ee.length?(b.fixCaret(G,G),!0):!1},b.partRestoreByAfter=function(z){return z===void 0?!1:Array.prototype.some.call(z,function(ee,G){var F=z.substring(G);return b.restoreByAfter(F)})},b.isNotCompleteNumber=function(z){return isNaN(z)||z===""||z===null||z&&z.toString().indexOf(".")===z.toString().length-1},b.stop=function(){b.autoStepTimer&&clearTimeout(b.autoStepTimer)},b.down=function(z,ee,G){b.pressingUpOrDown=!0,b.step("down",z,ee,G)},b.up=function(z,ee,G){b.pressingUpOrDown=!0,b.step("up",z,ee,G)},b.saveInput=function(z){b.input=z};var M=m.value;M===void 0&&(M=m.defaultValue),b.state={focused:m.autoFocus};var K=b.getValidValue(b.toNumber(M));return b.state=T(T({},b.state),{},{inputValue:b.toPrecisionAsStep(K),value:K}),b}return Object(Y.a)(g,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(b){var M=this.props,K=M.value,z=M.onChange,ee=M.max,G=M.min,F=this.state.focused;if(b){if(!u(b.value,K)||!u(b.max,ee)||!u(b.min,G)){var ie=F?K:this.getValidValue(K),ge;this.pressingUpOrDown?ge=ie:this.inputting?ge=this.rawInput:ge=this.toPrecisionAsStep(ie),this.setState({value:ie,inputValue:ge})}var ye="value"in this.props?K:this.state.value;"max"in this.props&&b.max!==ee&&typeof ye=="number"&&ye>ee&&z&&z(ee),"min"in this.props&&b.min!==G&&typeof ye=="number"&&ye<G&&z&&z(G)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var xe=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===w.a.BACKSPACE?xe=this.cursorStart-1:this.lastKeyCode===w.a.DELETE&&(xe=this.cursorStart):xe=this.input.value.length,this.fixCaret(xe,xe)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case w.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case w.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(Te){}if(this.lastKeyCode=null,!this.pressingUpOrDown)return;this.props.focusOnUpDown&&this.state.focused&&(document.activeElement!==this.input&&this.focus())}},{key:"componentWillUnmount",value:function(){this.stop()}},{key:"getCurrentValidValue",value:function(b){var M=b;return M===""?M="":this.isNotCompleteNumber(parseFloat(M))?M=this.state.value:M=this.getValidValue(M),this.toNumber(M)}},{key:"getValueFromEvent",value:function(b){var M=b.target.value.trim().replace(/。/g,".");return p(this.props.decimalSeparator)&&(M=M.replace(this.props.decimalSeparator,".")),M}},{key:"getValidValue",value:function(b){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,K=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,z=parseFloat(b);return isNaN(z)?b:(z<M&&(z=M),z>K&&(z=K),z)}},{key:"setValue",value:function(b,M){var K=this.props.precision,z=this.isNotCompleteNumber(parseFloat(b))?null:parseFloat(b),ee=this.state.value,G=ee===void 0?null:ee,F=this.state.inputValue,ie=F===void 0?null:F,ge=typeof z=="number"?z.toFixed(K):"".concat(z),ye=z!==G||ge!=="".concat(ie);return"value"in this.props?(ie=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:ie},M)):this.setState({value:z,inputValue:this.toPrecisionAsStep(b)},M),ye&&this.props.onChange(z),z}},{key:"getMaxPrecision",value:function(b){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,K=this.props,z=K.precision,ee=K.step;if(p(z))return z;var G=this.getPrecision(M),F=this.getPrecision(ee),ie=this.getPrecision(b);return b?Math.max(ie,G+F):G+F}},{key:"getPrecisionFactor",value:function(b){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,K=this.getMaxPrecision(b,M);return Math.pow(10,K)}},{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(b){return this.props.formatter?this.props.formatter(b):b}},{key:"toPrecisionAsStep",value:function(b){if(this.isNotCompleteNumber(b)||b==="")return b;var M=Math.abs(this.getMaxPrecision(b));return isNaN(M)?b.toString():Number(b).toFixed(M)}},{key:"toNumber",value:function(b){var M=this.props.precision,K=this.state.focused,z=b&&b.length>16&&K;return this.isNotCompleteNumber(b)||z?b:p(M)?Math.round(b*Math.pow(10,M))/Math.pow(10,M):Number(b)}},{key:"upStep",value:function(b,M){var K=this.props.step,z=this.getPrecisionFactor(b,M),ee=Math.abs(this.getMaxPrecision(b,M)),G=((z*b+z*K*M)/z).toFixed(ee);return this.toNumber(G)}},{key:"downStep",value:function(b,M){var K=this.props.step,z=this.getPrecisionFactor(b,M),ee=Math.abs(this.getMaxPrecision(b,M)),G=((z*b-z*K*M)/z).toFixed(ee);return this.toNumber(G)}},{key:"step",value:function(b,M){var K=this,z=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,ee=arguments.length>3?arguments[3]:void 0;this.stop(),M&&(M.persist(),M.preventDefault());var G=this.props;if(G.disabled)return;var F=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(F))return;var ie=this["".concat(b,"Step")](F,z),ge=ie>G.max||ie<G.min;if(ie>G.max?ie=G.max:ie<G.min&&(ie=G.min),this.setValue(ie,null),this.setState({focused:!0},function(){K.pressingUpOrDown=!1}),ge)return;this.autoStepTimer=setTimeout(function(){K[b](M,z,!0)},ee?c:E)}},{key:"fixCaret",value:function(b,M){if(b===void 0||M===void 0||!this.input||!this.input.value)return;try{var K=this.input.selectionStart,z=this.input.selectionEnd;(b!==K||M!==z)&&this.input.setSelectionRange(b,M)}catch(ee){}}},{key:"render",value:function(){var b,M=this.props,K=M.prefixCls,z=M.disabled,ee=M.readOnly,G=M.useTouch,F=M.autoComplete,ie=M.upHandler,ge=M.downHandler,ye=M.className,xe=M.max,Te=M.min,Se=M.style,me=M.title,pe=M.onMouseEnter,Ee=M.onMouseLeave,le=M.onMouseOver,I=M.onMouseOut,x=M.required,R=M.onClick,W=M.tabIndex,J=M.type,B=M.placeholder,de=M.id,_e=M.inputMode,Re=M.pattern,Oe=M.step,ke=M.maxLength,Ie=M.autoFocus,De=M.name,Ve=M.onPaste,Qe=M.onInput,at=Object(fe.a)(M,["prefixCls","disabled","readOnly","useTouch","autoComplete","upHandler","downHandler","className","max","min","style","title","onMouseEnter","onMouseLeave","onMouseOver","onMouseOut","required","onClick","tabIndex","type","placeholder","id","inputMode","pattern","step","maxLength","autoFocus","name","onPaste","onInput"]),Ze=this.state,yt=Ze.value,rt=Ze.focused,dt=_()(K,(b={},Object($.a)(b,ye,!!ye),Object($.a)(b,"".concat(K,"-disabled"),z),Object($.a)(b,"".concat(K,"-focused"),rt),b)),Me={};Object.keys(at).forEach(function(he){(he.substr(0,5)==="data-"||he.substr(0,5)==="aria-"||he==="role")&&(Me[he]=at[he])});var xt=!ee&&!z,mt=this.getInputDisplayValue(null),se=(yt||yt===0)&&(isNaN(yt)||Number(yt)>=xe),Z=(yt||yt===0)&&(isNaN(yt)||Number(yt)<=Te),q=se||z||ee,ae=Z||z||ee,ue=_()("".concat(K,"-handler"),"".concat(K,"-handler-up"),Object($.a)({},"".concat(K,"-handler-up-disabled"),q)),te=_()("".concat(K,"-handler"),"".concat(K,"-handler-down"),Object($.a)({},"".concat(K,"-handler-down-disabled"),ae)),ne=G?{onTouchStart:q?f:this.up,onTouchEnd:this.stop}:{onMouseDown:q?f:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},oe=G?{onTouchStart:ae?f:this.down,onTouchEnd:this.stop}:{onMouseDown:ae?f:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return k.a.createElement("div",{className:dt,style:Se,title:me,onMouseEnter:pe,onMouseLeave:Ee,onMouseOver:le,onMouseOut:I,onFocus:function(){return null},onBlur:function(){return null}},k.a.createElement("div",{className:"".concat(K,"-handler-wrap")},k.a.createElement("span",Object.assign({unselectable:"on"},ne,{role:"button","aria-label":"Increase Value","aria-disabled":q,className:ue}),ie||k.a.createElement("span",{unselectable:"on",className:"".concat(K,"-handler-up-inner"),onClick:l})),k.a.createElement("span",Object.assign({unselectable:"on"},oe,{role:"button","aria-label":"Decrease Value","aria-disabled":ae,className:te}),ge||k.a.createElement("span",{unselectable:"on",className:"".concat(K,"-handler-down-inner"),onClick:l}))),k.a.createElement("div",{className:"".concat(K,"-input-wrap")},k.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":Te,"aria-valuemax":xe,"aria-valuenow":yt,required:x,type:J,placeholder:B,onPaste:Ve,onClick:R,onMouseUp:this.onMouseUp,className:"".concat(K,"-input"),tabIndex:W,autoComplete:F,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:xt?this.onKeyDown:f,onKeyUp:xt?this.onKeyUp:f,autoFocus:Ie,maxLength:ke,readOnly:ee,disabled:z,max:xe,min:Te,step:Oe,name:De,title:me,id:de,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(mt),pattern:Re,inputMode:_e,onInput:Qe},Me))))}}]),g}(k.a.Component);y.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:v,min:-v,step:1,style:{},onChange:f,onKeyDown:f,onPressEnter:f,onFocus:f,onBlur:f,parser:i,required:!1,autoComplete:"off"};var d=y,h=Ke.a=d},"e+RI":function(qe,Ke,V){qe.exports={btn:"btn___35XHi",s1:"s1___yzdGB",s2:"s2___3kxXm",btnDisabled:"btnDisabled___lI9pA",btn2:"btn2___2KLJQ"}},"eS0+":function(qe,Ke,V){"use strict";var fe=V("giR+"),$=V("fyUT"),P=V("tJVT"),Y=V("PpiC"),U=V("OaEy"),O=V("2fM7"),H=V("q1tI"),N=V.n(H),k=V("2sxD"),L=V.n(k),_=V("51dB"),w=V.n(_),D=V("5MlY"),T=V.n(D),C=V("lnNo"),S=V.n(C),f=V("YBdh"),l=V.n(f),i=V("LvDl"),c=V.n(i),E=V("TSYQ"),v=V.n(E),p=O.a.Option,u=function(s){var a=parseInt(s);return Object(i.isNaN)(a)?0:a},y=function(s){var a,g,m=s.index,b=s.value,M=b===void 0?[]:b,K=s.onChange,z=s.type,ee=s.disabled,G=ee===void 0?!1:ee,F=s.expansion,ie=F===void 0?!0:F,ge=Object(Y.a)(s,["index","value","onChange","type","disabled","expansion"]),ye=Object(H.useState)(!0),xe=Object(P.a)(ye,2),Te=xe[0],Se=xe[1],me=function(Ee,le){var I=Object(i.cloneDeep)(M);I.difficulties[le].num=Ee,console.log(I,444),K(I)};return N.a.createElement("div",{className:L.a.ListGroup,style:{borderWidth:m?1:0}},N.a.createElement("div",{className:L.a.a},m+1),N.a.createElement("div",{"data-type":"width",className:L.a.b},M==null?void 0:M.name),N.a.createElement("div",{className:L.a.c},M==null||((a=M.difficulties)===null||a===void 0)?void 0:a.map(function(pe,Ee){return N.a.createElement("div",{key:Ee,style:{display:Te?"flex":Ee?"none":"flex"},className:L.a.c1},N.a.createElement("span",{style:{color:"#777777",marginRight:5}},"\u96BE\u5EA6"),pe.difficulty===1&&N.a.createElement("span",{className:L.a.radio},"\u7B80\u5355"),pe.difficulty===2&&N.a.createElement("span",{className:L.a.radio},"\u9002\u4E2D"),pe.difficulty===3&&N.a.createElement("span",{className:L.a.radio},"\u56F0\u96BE"),N.a.createElement("span",{style:{color:"#777777",marginRight:5,marginLeft:50}},"\u62BD\u9898\u6570\u91CF"),m===0&&Ee===0?N.a.createElement("div",{id:"".concat(z,"_sum")},N.a.createElement($.a,{disabled:G,parser:u,onChange:function(I){return me(I,Ee)},min:0,max:pe==null?void 0:pe.count,value:(pe==null?void 0:pe.num)||0,style:{width:66}}),N.a.createElement("span",{style:{display:"none"}},"\u8BF7\u8F93\u5165\u6570\u91CF")):N.a.createElement($.a,{disabled:G,parser:u,onChange:function(I){return me(I,Ee)},min:0,max:pe==null?void 0:pe.count,value:(pe==null?void 0:pe.num)||0,style:{width:66}}),N.a.createElement("span",{style:{marginLeft:5}},"/",pe==null?void 0:pe.count))})),N.a.createElement("div",{style:{display:(M==null||((g=M.difficulties)===null||g===void 0)?void 0:g.length)===1||!ie?"none":"block"},onClick:function(){return Se(!Te)},className:L.a.d},Te?"\u6536\u8D77":"\u5C55\u5F00",N.a.createElement("img",{style:{marginTop:-2,transform:Te?"rotate(0deg)":"rotate(180deg)"},src:S.a,className:"ml5"})))},d=function(s){var a,g,m=s.value,b=m===void 0?[]:m,M=s.onChange,K=s.listClassName,z=s.disabled,ee=z===void 0?!1:z,G=s.expansion,F=G===void 0?!0:G,ie=Object(Y.a)(s,["value","onChange","listClassName","disabled","expansion"]),ge=Object(H.useState)(!0),ye=Object(P.a)(ge,2),xe=ye[0],Te=ye[1],Se=function(I){var x,R=I.score||0,W=[];I==null||((x=I.item_banks)===null||x===void 0)||x.forEach(function(B){var de;B==null||((de=B.tag_disciplines)===null||de===void 0)||de.forEach(function(_e){var Re;_e==null||((Re=_e.difficulties)===null||Re===void 0)||Re.forEach(function(Oe){Oe.num&&W.push(Oe.num)})})});var J=W.reduce(function(B,de){return B+de},0);return J*R},me=[{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"}],pe=function(I,x,R){var W=Object(i.cloneDeep)(b);W.item_banks[x].tag_disciplines[R]=I;var J=Se(W);W.scoreTotal=J,console.log(W,"newValue"),M(W)},Ee=function(I){var x=Object(i.cloneDeep)(b);x.score=I;var R=Se(x);x.scoreTotal=R,M(x)};return N.a.createElement("div",{className:v()(L.a.list,K)},N.a.createElement("div",{className:L.a.head},N.a.createElement("div",{className:L.a.name},N.a.createElement("b",null),N.a.createElement("span",null,(a=me.find(function(le){return le.type===(b==null?void 0:b.item_type)}))===null||a===void 0?void 0:a.name)),N.a.createElement("div",{className:L.a.right},F&&N.a.createElement("div",{onClick:function(){return Te(!xe)},className:"current c-light-primary mb10"},xe?"\u6536\u8D77":"\u5C55\u5F00",N.a.createElement("img",{style:{marginTop:-2,transform:xe?"rotate(0deg)":"rotate(180deg)"},src:S.a,className:"ml5"})),N.a.createElement("div",null,N.a.createElement("img",{src:w.a}),N.a.createElement("span",{className:"ml10 mr20"},"\u603B\u5206",b.scoreTotal,"\u5206"),N.a.createElement("img",{className:"mr10",src:T.a}),N.a.createElement("span",null,(b==null?void 0:b.item_type)==="COMBINATION"?"\u6BCF\u5C0F\u9898":"\u6BCF\u9898"),N.a.createElement("div",{id:"".concat(b==null?void 0:b.item_type,"_score")},N.a.createElement($.a,{disabled:ee,parser:u,min:0,onChange:Ee,value:b.score,style:{margin:"0 5px"}}),N.a.createElement("span",{style:{display:"none"}},"\u8BF7\u8F93\u5165\u6BCF\u9898\u5206\u6570")),N.a.createElement("span",null,"\u5206")))),N.a.createElement("div",{className:L.a.body,style:{display:xe?"block":"none"}},b==null||((g=b.item_banks)===null||g===void 0)?void 0:g.map(function(le,I){var x;return N.a.createElement(N.a.Fragment,{key:I},N.a.createElement("div",{className:L.a.top},N.a.createElement("img",{src:l.a}),N.a.createElement("span",null,"\u65B9\u5411/\u8BFE\u7A0B"),N.a.createElement("b",null),N.a.createElement("aside",null,le==null?void 0:le.disciplines,"/",le==null?void 0:le.sub_discipline)),N.a.createElement("div",{className:L.a.bottom},N.a.createElement("div",{className:L.a.l},"\u77E5\u8BC6\u70B9"),N.a.createElement("div",{className:L.a.r},le==null||((x=le.tag_disciplines)===null||x===void 0)?void 0:x.map(function(R,W){return N.a.createElement(y,{expansion:F,disabled:ee,type:b==null?void 0:b.item_type,key:"".concat(I,"-").concat(W),value:R,index:W,onChange:function(B){return pe(B,I,W)}})}))))})))};Ke.a=d},exQ7:function(qe,Ke,V){qe.exports=V.p+"static/te.6f9c0684.svg"},fAei:function(qe,Ke,V){"use strict";V.d(Ke,"a",function(){return c.a});var fe=V("rePB"),$=V("VTBJ"),P=V("KQm4"),Y=V("1OyB"),U=V("vuIU"),O=V("Ji7U"),H=V("LK+K"),N=V("q1tI"),k=V("4IlW"),L=V("Kwbf"),_=V("TSYQ"),w=V.n(_),D=V("sboe"),T=V("OZM5"),C=V("815F"),S=V("ODXe"),f=V("Ff2n"),l=V("+nKL"),i=V("8XRh"),c=V("WaYH"),E=function(Te,Se){var me=Te.className,pe=Te.style,Ee=Te.motion,le=Te.motionNodes,I=Te.motionType,x=Te.onMotionStart,R=Te.onMotionEnd,W=Te.active,J=Te.treeNodeRequiredProps,B=Object(f.a)(Te,["className","style","motion","motionNodes","motionType","onMotionStart","onMotionEnd","active","treeNodeRequiredProps"]),de=N.useState(!0),_e=Object(S.a)(de,2),Re=_e[0],Oe=_e[1],ke=N.useContext(D.a),Ie=ke.prefixCls,De=N.useRef(!1),Ve=function(){De.current||R(),De.current=!0};return Object(N.useEffect)(function(){le&&I==="hide"&&Re&&Oe(!1)},[le]),Object(N.useEffect)(function(){return le&&x(),function(){le&&Ve()}},[]),le?N.createElement(i.default,Object.assign({ref:Se,visible:Re},Ee,{motionAppear:I==="show",onAppearEnd:Ve,onLeaveEnd:Ve}),function(Qe,at){var Ze=Qe.className,yt=Qe.style;return N.createElement("div",{ref:at,className:w()("".concat(Ie,"-treenode-motion"),Ze),style:yt},le.map(function(rt){var dt=rt.data,Me=dt.key,xt=Object(f.a)(dt,["key"]),mt=rt.isStart,se=rt.isEnd;delete xt.children;var Z=Object(C.f)(Me,J);return N.createElement(c.a,Object.assign({},xt,Z,{active:W,data:rt.data,key:Me,isStart:mt,isEnd:se}))}))}):N.createElement(c.a,Object.assign({domRef:Se,className:me,style:pe},B,{active:W}))};E.displayName="MotionTreeNode";var v=N.forwardRef(E),p=v;function u(){var xe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],Te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],Se=xe.length,me=Te.length;if(Math.abs(Se-me)!==1)return{add:!1,key:null};function pe(Ee,le){var I=new Map;Ee.forEach(function(R){I.set(R,!0)});var x=le.filter(function(R){return!I.has(R)});return x.length===1?x[0]:null}return Se<me?{add:!0,key:pe(xe,Te)}:{add:!1,key:pe(Te,xe)}}function y(xe,Te,Se){var me=xe.findIndex(function(I){var x=I.data;return x.key===Se}),pe=xe[me+1],Ee=Te.findIndex(function(I){var x=I.data;return x.key===Se});if(pe){var le=Te.findIndex(function(I){var x=I.data;return x.key===pe.data.key});return Te.slice(Ee+1,le)}return Te.slice(Ee+1)}var d={width:0,height:0,display:"flex",overflow:"hidden",opacity:0,border:0,padding:0,margin:0},h=function(){},s="RC_TREE_MOTION_".concat(Math.random()),a={key:s},g={key:s,level:0,index:0,pos:"0",node:a},m={parent:null,children:[],pos:g.pos,data:a,isStart:[],isEnd:[]};function b(xe,Te,Se,me){return Te===!1||!Se?xe:xe.slice(0,Math.ceil(Se/me)+1)}function M(xe){var Te=xe.data.key,Se=xe.pos;return Object(C.e)(Te,Se)}function K(xe){for(var Te=String(xe.data.key),Se=xe;Se.parent;)Se=Se.parent,Te="".concat(Se.data.key," > ").concat(Te);return Te}var z=function(Te,Se){var me=Te.prefixCls,pe=Te.data,Ee=Te.selectable,le=Te.checkable,I=Te.expandedKeys,x=Te.selectedKeys,R=Te.checkedKeys,W=Te.loadedKeys,J=Te.loadingKeys,B=Te.halfCheckedKeys,de=Te.keyEntities,_e=Te.disabled,Re=Te.dragging,Oe=Te.dragOverNodeKey,ke=Te.dropPosition,Ie=Te.motion,De=Te.height,Ve=Te.itemHeight,Qe=Te.virtual,at=Te.focusable,Ze=Te.activeItem,yt=Te.focused,rt=Te.tabIndex,dt=Te.onKeyDown,Me=Te.onFocus,xt=Te.onBlur,mt=Te.onActiveChange,se=Te.onListChangeStart,Z=Te.onListChangeEnd,q=Object(f.a)(Te,["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"]),ae=N.useRef(null);N.useImperativeHandle(Se,function(){return{scrollTo:function(kt){ae.current.scrollTo(kt)}}});var ue=N.useState(I),te=Object(S.a)(ue,2),ne=te[0],oe=te[1],he=N.useState(pe),ce=Object(S.a)(he,2),Ce=ce[0],Ae=ce[1],Ge=N.useState(pe),Ue=Object(S.a)(Ge,2),He=Ue[0],Tt=Ue[1],Xe=N.useState([]),st=Object(S.a)(Xe,2),jt=st[0],ze=st[1],It=N.useState(null),Zt=Object(S.a)(It,2),At=Zt[0],qt=Zt[1];function Gt(){Ae(pe),Tt(pe),ze([]),qt(null),Z()}N.useEffect(function(){oe(I);var ht=u(ne,I);if(ht.key!==null)if(ht.add){var kt=Ce.findIndex(function(Rt){var Nt=Rt.data.key;return Nt===ht.key}),bt=b(y(Ce,pe,ht.key),Qe,De,Ve),_t=Ce.slice();_t.splice(kt+1,0,m),Tt(_t),ze(bt),qt("show")}else{var Et=pe.findIndex(function(Rt){var Nt=Rt.data.key;return Nt===ht.key}),nt=b(y(pe,Ce,ht.key),Qe,De,Ve),Be=pe.slice();Be.splice(Et+1,0,m),Tt(Be),ze(nt),qt("hide")}else Ce!==pe&&(Ae(pe),Tt(pe))},[I,pe]),N.useEffect(function(){Re||Gt()},[Re]);var Dt=Ie?He:pe,Ot={expandedKeys:I,selectedKeys:x,loadedKeys:W,loadingKeys:J,checkedKeys:R,halfCheckedKeys:B,dragOverNodeKey:Oe,dropPosition:ke,keyEntities:de};return N.createElement(N.Fragment,null,yt&&Ze&&N.createElement("span",{style:d,"aria-live":"assertive"},K(Ze)),N.createElement("div",{role:"tree"},N.createElement("input",{style:d,disabled:at===!1||_e,tabIndex:at!==!1?rt:null,onKeyDown:dt,onFocus:Me,onBlur:xt,value:"",onChange:h})),N.createElement(l.a,Object.assign({},q,{data:Dt,itemKey:M,height:De,fullHeight:!1,virtual:Qe,itemHeight:Ve,prefixCls:"".concat(me,"-list"),ref:ae}),function(ht){var kt=ht.pos,bt=ht.data,_t=bt.key,Et=Object(f.a)(bt,["key"]),nt=ht.isStart,Be=ht.isEnd,Rt=Object(C.e)(_t,kt);delete Et.children;var Nt=Object(C.f)(Rt,Ot);return N.createElement(p,Object.assign({},Et,Nt,{active:Ze&&_t===Ze.data.key,pos:kt,data:ht.data,isStart:nt,isEnd:Be,motion:Ie,motionNodes:_t===s?jt:null,motionType:At,onMotionStart:se,onMotionEnd:Gt,treeNodeRequiredProps:Ot,onMouseMove:function(){mt(null)}}))}))},ee=N.forwardRef(z);ee.displayName="NodeList";var G=ee,F=V("NvD2"),ie=function(xe){Object(O.a)(Se,xe);var Te=Object(H.a)(Se);function Se(){var me;return Object(Y.a)(this,Se),me=Te.apply(this,arguments),me.destroyed=!1,me.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},me.listRef=N.createRef(),me.onNodeDragStart=function(pe,Ee){var le=me.state,I=le.expandedKeys,x=le.keyEntities,R=me.props.onDragStart,W=Ee.props.eventKey;me.dragNode=Ee;var J=Object(T.b)(I,W);me.setState({dragging:!0,dragNodesKeys:Object(T.g)(W,x)}),me.setExpandedKeys(J),R&&R({event:pe,node:Object(C.b)(Ee.props)})},me.onNodeDragEnter=function(pe,Ee){var le=me.state,I=le.expandedKeys,x=le.keyEntities,R=le.dragNodesKeys,W=me.props.onDragEnter,J=Ee.props,B=J.pos,de=J.eventKey;if(!me.dragNode||R.indexOf(de)!==-1)return;var _e=Object(T.c)(pe,Ee);if(me.dragNode.props.eventKey===de&&_e===0){me.setState({dragOverNodeKey:"",dropPosition:null});return}setTimeout(function(){me.setState({dragOverNodeKey:de,dropPosition:_e}),me.delayedDragEnterLogic||(me.delayedDragEnterLogic={}),Object.keys(me.delayedDragEnterLogic).forEach(function(Re){clearTimeout(me.delayedDragEnterLogic[Re])}),me.delayedDragEnterLogic[B]=window.setTimeout(function(){if(!me.state.dragging)return;var Re=Object(P.a)(I),Oe=x[de];Oe&&(Oe.children||[]).length&&(Re=Object(T.a)(I,de)),"expandedKeys"in me.props||me.setExpandedKeys(Re),W&&W({event:pe,node:Object(C.b)(Ee.props),expandedKeys:Re})},400)},0)},me.onNodeDragOver=function(pe,Ee){var le=me.state.dragNodesKeys,I=me.props.onDragOver,x=Ee.props.eventKey;if(le.indexOf(x)!==-1)return;if(me.dragNode&&x===me.state.dragOverNodeKey){var R=Object(T.c)(pe,Ee);if(R===me.state.dropPosition)return;me.setState({dropPosition:R})}I&&I({event:pe,node:Object(C.b)(Ee.props)})},me.onNodeDragLeave=function(pe,Ee){var le=me.props.onDragLeave;me.setState({dragOverNodeKey:""}),le&&le({event:pe,node:Object(C.b)(Ee.props)})},me.onNodeDragEnd=function(pe,Ee){var le=me.props.onDragEnd;me.setState({dragOverNodeKey:""}),me.cleanDragState(),le&&le({event:pe,node:Object(C.b)(Ee.props)}),me.dragNode=null},me.onNodeDrop=function(pe,Ee){var le=me.state,I=le.dragNodesKeys,x=I===void 0?[]:I,R=le.dropPosition,W=me.props.onDrop,J=Ee.props,B=J.eventKey,de=J.pos;if(me.setState({dragOverNodeKey:""}),me.cleanDragState(),x.indexOf(B)!==-1){Object(L.a)(!1,"Can not drop to dragNode(include it's children node)");return}var _e=Object(T.k)(de),Re={event:pe,node:Object(C.b)(Ee.props),dragNode:me.dragNode?Object(C.b)(me.dragNode.props):null,dragNodesKeys:x.slice(),dropPosition:R+Number(_e[_e.length-1]),dropToGap:!1};R!==0&&(Re.dropToGap=!0),W&&W(Re),me.dragNode=null},me.cleanDragState=function(){var pe=me.state.dragging;pe&&me.setState({dragging:!1})},me.onNodeClick=function(pe,Ee){var le=me.props.onClick;le&&le(pe,Ee)},me.onNodeDoubleClick=function(pe,Ee){var le=me.props.onDoubleClick;le&&le(pe,Ee)},me.onNodeSelect=function(pe,Ee){var le=me.state.selectedKeys,I=me.state.keyEntities,x=me.props,R=x.onSelect,W=x.multiple,J=Ee.selected,B=Ee.key,de=!J;de?W?le=Object(T.a)(le,B):le=[B]:le=Object(T.b)(le,B);var _e=le.map(function(Re){var Oe=I[Re];return Oe?Oe.node:null}).filter(function(Re){return Re});me.setUncontrolledState({selectedKeys:le}),R&&R(le,{event:"select",selected:de,node:Ee,selectedNodes:_e,nativeEvent:pe.nativeEvent})},me.onNodeCheck=function(pe,Ee,le){var I=me.state,x=I.keyEntities,R=I.checkedKeys,W=I.halfCheckedKeys,J=me.props,B=J.checkStrictly,de=J.onCheck,_e=Ee.key,Re,Oe={event:"check",node:Ee,checked:le,nativeEvent:pe.nativeEvent};if(B){var ke=le?Object(T.a)(R,_e):Object(T.b)(R,_e),Ie=Object(T.b)(W,_e);Re={checked:ke,halfChecked:Ie},Oe.checkedNodes=ke.map(function(yt){return x[yt]}).filter(function(yt){return yt}).map(function(yt){return yt.node}),me.setUncontrolledState({checkedKeys:ke})}else{var De=Object(F.a)([].concat(Object(P.a)(R),[_e]),!0,x),Ve=De.checkedKeys,Qe=De.halfCheckedKeys;if(!le){var at=new Set(Ve);at.delete(_e);var Ze=Object(F.a)(Array.from(at),{checked:!1,halfCheckedKeys:Qe},x);Ve=Ze.checkedKeys,Qe=Ze.halfCheckedKeys}Re=Ve,Oe.checkedNodes=[],Oe.checkedNodesPositions=[],Oe.halfCheckedKeys=Qe,Ve.forEach(function(yt){var rt=x[yt];if(!rt)return;var dt=rt.node,Me=rt.pos;Oe.checkedNodes.push(dt),Oe.checkedNodesPositions.push({node:dt,pos:Me})}),me.setUncontrolledState({checkedKeys:Ve},!1,{halfCheckedKeys:Qe})}de&&de(Re,Oe)},me.onNodeLoad=function(pe){return new Promise(function(Ee){me.setState(function(le){var I=le.loadedKeys,x=I===void 0?[]:I,R=le.loadingKeys,W=R===void 0?[]:R,J=me.props,B=J.loadData,de=J.onLoad,_e=pe.key;if(!B||x.indexOf(_e)!==-1||W.indexOf(_e)!==-1)return{};var Re=B(pe);return Re.then(function(){var Oe=me.state,ke=Oe.loadedKeys,Ie=Oe.loadingKeys,De=Object(T.a)(ke,_e),Ve=Object(T.b)(Ie,_e);de&&de(De,{event:"load",node:pe}),me.setUncontrolledState({loadedKeys:De}),me.setState({loadingKeys:Ve}),Ee()}),{loadingKeys:Object(T.a)(W,_e)}})})},me.onNodeMouseEnter=function(pe,Ee){var le=me.props.onMouseEnter;le&&le({event:pe,node:Ee})},me.onNodeMouseLeave=function(pe,Ee){var le=me.props.onMouseLeave;le&&le({event:pe,node:Ee})},me.onNodeContextMenu=function(pe,Ee){var le=me.props.onRightClick;le&&(pe.preventDefault(),le({event:pe,node:Ee}))},me.onFocus=function(){var pe=me.props.onFocus;me.setState({focused:!0}),pe&&pe.apply(void 0,arguments)},me.onBlur=function(){var pe=me.props.onBlur;me.setState({focused:!1}),me.onActiveChange(null),pe&&pe.apply(void 0,arguments)},me.getTreeNodeRequiredProps=function(){var pe=me.state,Ee=pe.expandedKeys,le=pe.selectedKeys,I=pe.loadedKeys,x=pe.loadingKeys,R=pe.checkedKeys,W=pe.halfCheckedKeys,J=pe.dragOverNodeKey,B=pe.dropPosition,de=pe.keyEntities;return{expandedKeys:Ee||[],selectedKeys:le||[],loadedKeys:I||[],loadingKeys:x||[],checkedKeys:R||[],halfCheckedKeys:W||[],dragOverNodeKey:J,dropPosition:B,keyEntities:de}},me.setExpandedKeys=function(pe){var Ee=me.state.treeData,le=Object(C.d)(Ee,pe);me.setUncontrolledState({expandedKeys:pe,flattenNodes:le},!0)},me.onNodeExpand=function(pe,Ee){var le=me.state.expandedKeys,I=me.state.listChanging,x=me.props,R=x.onExpand,W=x.loadData,J=Ee.key,B=Ee.expanded;if(I)return;var de=le.indexOf(J),_e=!B;if(Object(L.a)(B&&de!==-1||!B&&de===-1,"Expand state not sync with index check"),_e?le=Object(T.a)(le,J):le=Object(T.b)(le,J),me.setExpandedKeys(le),R&&R(le,{node:Ee,expanded:_e,nativeEvent:pe.nativeEvent}),_e&&W){var Re=me.onNodeLoad(Ee);Re&&Re.then(function(){var Oe=Object(C.d)(me.state.treeData,le);me.setUncontrolledState({flattenNodes:Oe})})}},me.onListChangeStart=function(){me.setUncontrolledState({listChanging:!0})},me.onListChangeEnd=function(){setTimeout(function(){me.setUncontrolledState({listChanging:!1})})},me.onActiveChange=function(pe){var Ee=me.state.activeKey,le=me.props.onActiveChange;if(Ee===pe)return;me.setState({activeKey:pe}),pe!==null&&me.scrollTo({key:pe}),le&&le(pe)},me.getActiveItem=function(){var pe=me.state,Ee=pe.activeKey,le=pe.flattenNodes;return Ee===null?null:le.find(function(I){var x=I.data.key;return x===Ee})||null},me.offsetActiveKey=function(pe){var Ee=me.state,le=Ee.flattenNodes,I=Ee.activeKey,x=le.findIndex(function(J){var B=J.data.key;return B===I});x===-1&&pe<0&&(x=le.length),x=(x+pe+le.length)%le.length;var R=le[x];if(R){var W=R.data.key;me.onActiveChange(W)}else me.onActiveChange(null)},me.onKeyDown=function(pe){var Ee=me.state,le=Ee.activeKey,I=Ee.expandedKeys,x=Ee.checkedKeys,R=me.props,W=R.onKeyDown,J=R.checkable,B=R.selectable;switch(pe.which){case k.a.UP:{me.offsetActiveKey(-1),pe.preventDefault();break}case k.a.DOWN:{me.offsetActiveKey(1),pe.preventDefault();break}}var de=me.getActiveItem();if(de&&de.data){var _e=me.getTreeNodeRequiredProps(),Re=de.data.isLeaf===!1||!!(de.data.children||[]).length,Oe=Object(C.b)(Object($.a)(Object($.a)({},Object(C.f)(le,_e)),{},{data:de.data,active:!0}));switch(pe.which){case k.a.LEFT:{Re&&I.includes(le)?me.onNodeExpand({},Oe):de.parent&&me.onActiveChange(de.parent.data.key),pe.preventDefault();break}case k.a.RIGHT:{Re&&!I.includes(le)?me.onNodeExpand({},Oe):de.children&&de.children.length&&me.onActiveChange(de.children[0].data.key),pe.preventDefault();break}case k.a.ENTER:case k.a.SPACE:{J&&!Oe.disabled&&Oe.checkable!==!1&&!Oe.disableCheckbox?me.onNodeCheck({},Oe,!x.includes(le)):!J&&B&&!Oe.disabled&&Oe.selectable!==!1&&me.onNodeSelect({},Oe);break}}}W&&W(pe)},me.setUncontrolledState=function(pe){var Ee=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,le=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null;if(me.destroyed)return;var I=!1,x=!0,R={};Object.keys(pe).forEach(function(W){if(W in me.props){x=!1;return}I=!0,R[W]=pe[W]}),I&&(!Ee||x)&&me.setState(Object($.a)(Object($.a)({},R),le))},me.scrollTo=function(pe){me.listRef.current.scrollTo(pe)},me}return Object(U.a)(Se,[{key:"componentWillUnmount",value:function(){this.destroyed=!0}},{key:"render",value:function(){var pe,Ee=this.state,le=Ee.focused,I=Ee.flattenNodes,x=Ee.keyEntities,R=Ee.dragging,W=Ee.activeKey,J=this.props,B=J.prefixCls,de=J.className,_e=J.style,Re=J.showLine,Oe=J.focusable,ke=J.tabIndex,Ie=ke===void 0?0:ke,De=J.selectable,Ve=J.showIcon,Qe=J.icon,at=J.switcherIcon,Ze=J.draggable,yt=J.checkable,rt=J.checkStrictly,dt=J.disabled,Me=J.motion,xt=J.loadData,mt=J.filterTreeNode,se=J.height,Z=J.itemHeight,q=J.virtual,ae=J.titleRender,ue=J.onContextMenu,te=Object(T.f)(this.props);return N.createElement(D.a.Provider,{value:{prefixCls:B,selectable:De,showIcon:Ve,icon:Qe,switcherIcon:at,draggable:Ze,checkable:yt,checkStrictly:rt,disabled:dt,keyEntities:x,loadData:xt,filterTreeNode:mt,titleRender:ae,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}},N.createElement("div",{className:w()(B,de,(pe={},Object(fe.a)(pe,"".concat(B,"-show-line"),Re),Object(fe.a)(pe,"".concat(B,"-focused"),le),Object(fe.a)(pe,"".concat(B,"-active-focused"),W!==null),pe))},N.createElement(G,Object.assign({ref:this.listRef,prefixCls:B,style:_e,data:I,disabled:dt,selectable:De,checkable:!!yt,motion:Me,dragging:R,height:se,itemHeight:Z,virtual:q,focusable:Oe,focused:le,tabIndex:Ie,activeItem:this.getActiveItem(),onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.onKeyDown,onActiveChange:this.onActiveChange,onListChangeStart:this.onListChangeStart,onListChangeEnd:this.onListChangeEnd,onContextMenu:ue},this.getTreeNodeRequiredProps(),te))))}}],[{key:"getDerivedStateFromProps",value:function(pe,Ee){var le=Ee.prevProps,I={prevProps:pe};function x(Qe){return!le&&Qe in pe||le&&le[Qe]!==pe[Qe]}var R;if(x("treeData")?R=pe.treeData:x("children")&&(Object(L.a)(!1,"`children` of Tree is deprecated. Please use `treeData` instead."),R=Object(C.c)(pe.children)),R){I.treeData=R;var W=Object(C.a)(R);I.keyEntities=Object($.a)(Object(fe.a)({},s,g),W.keyEntities)}var J=I.keyEntities||Ee.keyEntities;if(x("expandedKeys")||le&&x("autoExpandParent"))I.expandedKeys=pe.autoExpandParent||!le&&pe.defaultExpandParent?Object(T.e)(pe.expandedKeys,J):pe.expandedKeys;else if(!le&&pe.defaultExpandAll){var B=Object($.a)({},J);delete B[s],I.expandedKeys=Object.keys(B).map(function(Qe){return B[Qe].key})}else!le&&pe.defaultExpandedKeys&&(I.expandedKeys=pe.autoExpandParent||pe.defaultExpandParent?Object(T.e)(pe.defaultExpandedKeys,J):pe.defaultExpandedKeys);if(I.expandedKeys||delete I.expandedKeys,R||I.expandedKeys){var de=Object(C.d)(R||Ee.treeData,I.expandedKeys||Ee.expandedKeys);I.flattenNodes=de}if(pe.selectable&&(x("selectedKeys")?I.selectedKeys=Object(T.d)(pe.selectedKeys,pe):!le&&pe.defaultSelectedKeys&&(I.selectedKeys=Object(T.d)(pe.defaultSelectedKeys,pe))),pe.checkable){var _e;if(x("checkedKeys")?_e=Object(T.j)(pe.checkedKeys)||{}:!le&&pe.defaultCheckedKeys?_e=Object(T.j)(pe.defaultCheckedKeys)||{}:R&&(_e=Object(T.j)(pe.checkedKeys)||{checkedKeys:Ee.checkedKeys,halfCheckedKeys:Ee.halfCheckedKeys}),_e){var Re=_e,Oe=Re.checkedKeys,ke=Oe===void 0?[]:Oe,Ie=Re.halfCheckedKeys,De=Ie===void 0?[]:Ie;if(!pe.checkStrictly){var Ve=Object(F.a)(ke,!0,J);ke=Ve.checkedKeys,De=Ve.halfCheckedKeys}I.checkedKeys=ke,I.halfCheckedKeys=De}}return x("loadedKeys")&&(I.loadedKeys=pe.loadedKeys),I}}]),Se}(N.Component);ie.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:[]},ie.TreeNode=c.a;var ge=ie,ye=Ke.b=ge},k4n4:function(qe,Ke,V){"use strict";var fe=V("tJVT"),$=V("q1tI"),P=V.n($),Y=V("e+RI"),U=V.n(Y),O=V("FTkQ"),H=V.n(O),N=V("E/GV"),k=V.n(N),L=function(w){var D=w.type,T=D===void 0?1:D,C=w.value,S=C===void 0?[]:C,f=w.onChange,l=w.disabled,i=l===void 0?!1:l,c=w.icon,E=Object($.useState)(),v=Object(fe.a)(E,2),p=v[0],u=v[1],y=function(h){f(h)};return T===1?P.a.createElement("div",null,S==null?void 0:S.map(function(d,h){return P.a.createElement("div",{key:h,className:i?"".concat(U.a.btn," ").concat(U.a.btnDisabled):U.a.btn},P.a.createElement("span",{className:U.a.s1},d.name),P.a.createElement("img",{src:H.a,className:U.a.s2,onClick:function(){return y(d.id)}}))})):P.a.createElement("div",null,S==null?void 0:S.map(function(d,h){return P.a.createElement("div",{key:h,className:U.a.btn2},P.a.createElement("span",{className:U.a.s1},P.a.createElement("img",{src:c||k.a}),d.name),P.a.createElement("img",{src:H.a,className:U.a.s2,onClick:function(){return y(d.id)}}))}))};Ke.a=L},kSUc:function(qe,Ke,V){},kqOp:function(qe,Ke,V){"use strict";V.d(Ke,"a",function(){return L});var fe=V("0Owb"),$=V("fWQN"),P=V("mtLc"),Y=V("yKVA"),U=V("879j"),O=V("q1tI"),H=V.n(O),N=V("Ot1p"),k="\u2581",L=function(_){Object(Y.a)(D,_);var w=Object(U.a)(D);function D(){var T;Object($.a)(this,D);for(var C=arguments.length,S=new Array(C),f=0;f<C;f++)S[f]=arguments[f];return T=w.call.apply(w,[this].concat(S)),T.getChCountBeforeCursor=function(l,i){for(var c=i.line,E=0,v=0;v<c;v++)E+=l.getLine(v).split(k).length-1;var p=l.getLine(c).substring(0,i.ch);return E+=p.split(k).length-1,E},T.onCMBeforeChange=function(l,i){var c=l.getRange(i.from,i.to),E=0;if(i.text.forEach(function(y){E+=y.split(k).length-1}),c&&c.indexOf(k)!=-1){var v=c.split(k).length-1,p=T.getChCountBeforeCursor(l,i.from);console.log("\u5220\u9664".concat(v,"\u4E2A\uFF0C \u4E4B\u524D\u6709").concat(p,"\u4E2A\uFF0C\u65B0\u589E").concat(E,"\u4E2A")),T.props.deleteEmptyDisabled?i.cancel():T.props.onPlaceholderChange&&T.props.onPlaceholderChange(p,v,E)}else if(E){var u=T.getChCountBeforeCursor(l,i.from);console.log("\u65B0\u589E".concat(E,"\u4E2A\uFF0C\u4E4B\u524D\u6709").concat(u,"\u4E2A")),T.props.onPlaceholderChange&&T.props.onPlaceholderChange(u,0,E)}},T}return Object(P.a)(D,[{key:"render",value:function(){return H.a.createElement(N.a,Object(fe.a)({},this.props,{onCMBeforeChange:this.onCMBeforeChange}))}}]),D}(O.Component)},lZu9:function(qe,Ke,V){(function(fe){fe(V("VrN/"),V("1eCo"),V("8EBN"))})(function(fe){"use strict";fe.defineMode("markdown",function($,P){var Y=fe.getMode($,"text/html"),U=Y.name=="null";function O(G){if(fe.findModeByName){var F=fe.findModeByName(G);F&&(G=F.mime||F.mimes[0])}var ie=fe.getMode($,G);return ie.name=="null"?null:ie}P.highlightFormatting===void 0&&(P.highlightFormatting=!1),P.maxBlockquoteDepth===void 0&&(P.maxBlockquoteDepth=0),P.taskLists===void 0&&(P.taskLists=!1),P.strikethrough===void 0&&(P.strikethrough=!1),P.emoji===void 0&&(P.emoji=!1),P.fencedCodeBlockHighlighting===void 0&&(P.fencedCodeBlockHighlighting=!0),P.fencedCodeBlockDefaultMode===void 0&&(P.fencedCodeBlockDefaultMode="text/plain"),P.xml===void 0&&(P.xml=!0),P.tokenTypeOverrides===void 0&&(P.tokenTypeOverrides={});var H={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough",emoji:"builtin"};for(var N in H)H.hasOwnProperty(N)&&P.tokenTypeOverrides[N]&&(H[N]=P.tokenTypeOverrides[N]);var k=/^([*\-_])(?:\s*\1){2,}\s*$/,L=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,_=/^\[(x| )\](?=\s)/i,w=P.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,D=/^ {0,3}(?:\={1,}|-{2,})\s*$/,T=/^[^#!\[\]*_\\<>` "'(~:]+/,C=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,S=/^\s*\[[^\]]+?\]:.*$/,f=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,l=" ";function i(G,F,ie){return F.f=F.inline=ie,ie(G,F)}function c(G,F,ie){return F.f=F.block=ie,ie(G,F)}function E(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 F=U;if(!F){var ie=fe.innerMode(Y,G.htmlState);F=ie.mode.name=="xml"&&ie.state.tagStart===null&&!ie.state.context&&ie.state.tokenize.isInText}F&&(G.f=s,G.block=p,G.htmlState=null)}return G.trailingSpace=0,G.trailingSpaceNewLine=!1,G.prevLine=G.thisLine,G.thisLine={stream:null},null}function p(G,F){var ie=G.column()===F.indentation,ge=E(F.prevLine.stream),ye=F.indentedCode,xe=F.prevLine.hr,Te=F.list!==!1,Se=(F.listStack[F.listStack.length-1]||0)+3;F.indentedCode=!1;var me=F.indentation;if(F.indentationDiff===null&&(F.indentationDiff=F.indentation,Te)){for(F.list=null;me<F.listStack[F.listStack.length-1];)F.listStack.pop(),F.listStack.length?F.indentation=F.listStack[F.listStack.length-1]:F.list=!1;F.list!==!1&&(F.indentationDiff=me-F.listStack[F.listStack.length-1])}var pe=!ge&&!xe&&!F.prevLine.header&&(!Te||!ye)&&!F.prevLine.fencedCodeEnd,Ee=(F.list===!1||xe||ge)&&F.indentation<=Se&&G.match(k),le=null;if(F.indentationDiff>=4&&(ye||F.prevLine.fencedCodeEnd||F.prevLine.header||ge))return G.skipToEnd(),F.indentedCode=!0,H.code;if(G.eatSpace())return null;if(ie&&F.indentation<=Se&&(le=G.match(w))&&le[1].length<=6)return F.quote=0,F.header=le[1].length,F.thisLine.header=!0,P.highlightFormatting&&(F.formatting="header"),F.f=F.inline,d(F);if(F.indentation<=Se&&G.eat(">"))return F.quote=ie?1:F.quote+1,P.highlightFormatting&&(F.formatting="quote"),G.eatSpace(),d(F);if(!Ee&&!F.setext&&ie&&F.indentation<=Se&&(le=G.match(L))){var I=le[1]?"ol":"ul";return F.indentation=me+G.current().length,F.list=!0,F.quote=0,F.listStack.push(F.indentation),F.em=!1,F.strong=!1,F.code=!1,F.strikethrough=!1,P.taskLists&&G.match(_,!1)&&(F.taskList=!0),F.f=F.inline,P.highlightFormatting&&(F.formatting=["list","list-"+I]),d(F)}else{if(ie&&F.indentation<=Se&&(le=G.match(C,!0)))return F.quote=0,F.fencedEndRE=new RegExp(le[1]+"+ *$"),F.localMode=P.fencedCodeBlockHighlighting&&O(le[2]||P.fencedCodeBlockDefaultMode),F.localMode&&(F.localState=fe.startState(F.localMode)),F.f=F.block=y,P.highlightFormatting&&(F.formatting="code-block"),F.code=-1,d(F);if(F.setext||(!pe||!Te)&&!F.quote&&F.list===!1&&!F.code&&!Ee&&!S.test(G.string)&&(le=G.lookAhead(1))&&(le=le.match(D)))return F.setext?(F.header=F.setext,F.setext=0,G.skipToEnd(),P.highlightFormatting&&(F.formatting="header")):(F.header=le[0].charAt(0)=="="?1:2,F.setext=F.header),F.thisLine.header=!0,F.f=F.inline,d(F);if(Ee)return G.skipToEnd(),F.hr=!0,F.thisLine.hr=!0,H.hr;if(G.peek()==="[")return i(G,F,M)}return i(G,F,F.inline)}function u(G,F){var ie=Y.token(G,F.htmlState);if(!U){var ge=fe.innerMode(Y,F.htmlState);(ge.mode.name=="xml"&&ge.state.tagStart===null&&!ge.state.context&&ge.state.tokenize.isInText||F.md_inside&&G.current().indexOf(">")>-1)&&(F.f=s,F.block=p,F.htmlState=null)}return ie}function y(G,F){var ie=F.listStack[F.listStack.length-1]||0,ge=F.indentation<ie,ye=ie+3;if(F.fencedEndRE&&F.indentation<=ye&&(ge||G.match(F.fencedEndRE))){P.highlightFormatting&&(F.formatting="code-block");var xe;return ge||(xe=d(F)),F.localMode=F.localState=null,F.block=p,F.f=s,F.fencedEndRE=null,F.code=0,F.thisLine.fencedCodeEnd=!0,ge?c(G,F,F.block):xe}else return F.localMode?F.localMode.token(G,F.localState):(G.skipToEnd(),H.code)}function d(G){var F=[];if(G.formatting){F.push(H.formatting),typeof G.formatting=="string"&&(G.formatting=[G.formatting]);for(var ie=0;ie<G.formatting.length;ie++)F.push(H.formatting+"-"+G.formatting[ie]),G.formatting[ie]==="header"&&F.push(H.formatting+"-"+G.formatting[ie]+"-"+G.header),G.formatting[ie]==="quote"&&(!P.maxBlockquoteDepth||P.maxBlockquoteDepth>=G.quote?F.push(H.formatting+"-"+G.formatting[ie]+"-"+G.quote):F.push("error"))}if(G.taskOpen)return F.push("meta"),F.length?F.join(" "):null;if(G.taskClosed)return F.push("property"),F.length?F.join(" "):null;if(G.linkHref?F.push(H.linkHref,"url"):(G.strong&&F.push(H.strong),G.em&&F.push(H.em),G.strikethrough&&F.push(H.strikethrough),G.emoji&&F.push(H.emoji),G.linkText&&F.push(H.linkText),G.code&&F.push(H.code),G.image&&F.push(H.image),G.imageAltText&&F.push(H.imageAltText,"link"),G.imageMarker&&F.push(H.imageMarker)),G.header&&F.push(H.header,H.header+"-"+G.header),G.quote&&(F.push(H.quote),!P.maxBlockquoteDepth||P.maxBlockquoteDepth>=G.quote?F.push(H.quote+"-"+G.quote):F.push(H.quote+"-"+P.maxBlockquoteDepth)),G.list!==!1){var ge=(G.listStack.length-1)%3;ge?ge===1?F.push(H.list2):F.push(H.list3):F.push(H.list1)}return G.trailingSpaceNewLine?F.push("trailing-space-new-line"):G.trailingSpace&&F.push("trailing-space-"+(G.trailingSpace%2?"a":"b")),F.length?F.join(" "):null}function h(G,F){return G.match(T,!0)?d(F):void 0}function s(G,F){var ie=F.text(G,F);if(typeof ie!="undefined")return ie;if(F.list)return F.list=null,d(F);if(F.taskList){var ge=G.match(_,!0)[1]===" ";return ge?F.taskOpen=!0:F.taskClosed=!0,P.highlightFormatting&&(F.formatting="task"),F.taskList=!1,d(F)}if(F.taskOpen=!1,F.taskClosed=!1,F.header&&G.match(/^#+$/,!0))return P.highlightFormatting&&(F.formatting="header"),d(F);var ye=G.next();if(F.linkTitle){F.linkTitle=!1;var xe=ye;ye==="("&&(xe=")"),xe=(xe+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var Te="^\\s*(?:[^"+xe+"\\\\]+|\\\\\\\\|\\\\.)"+xe;if(G.match(new RegExp(Te),!0))return H.linkHref}if(ye==="`"){var Se=F.formatting;P.highlightFormatting&&(F.formatting="code"),G.eatWhile("`");var me=G.current().length;if(F.code==0&&(!F.quote||me==1))return F.code=me,d(F);if(me==F.code){var pe=d(F);return F.code=0,pe}else return F.formatting=Se,d(F)}else if(F.code)return d(F);if(ye==="\\"&&(G.next(),P.highlightFormatting)){var Ee=d(F),le=H.formatting+"-escape";return Ee?Ee+" "+le:le}if(ye==="!"&&G.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return F.imageMarker=!0,F.image=!0,P.highlightFormatting&&(F.formatting="image"),d(F);if(ye==="["&&F.imageMarker&&G.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return F.imageMarker=!1,F.imageAltText=!0,P.highlightFormatting&&(F.formatting="image"),d(F);if(ye==="]"&&F.imageAltText){P.highlightFormatting&&(F.formatting="image");var Ee=d(F);return F.imageAltText=!1,F.image=!1,F.inline=F.f=g,Ee}if(ye==="["&&!F.image)return F.linkText&&G.match(/^.*?\]/)||(F.linkText=!0,P.highlightFormatting&&(F.formatting="link")),d(F);if(ye==="]"&&F.linkText){P.highlightFormatting&&(F.formatting="link");var Ee=d(F);return F.linkText=!1,F.inline=F.f=G.match(/\(.*?\)| ?\[.*?\]/,!1)?g:s,Ee}if(ye==="<"&&G.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){F.f=F.inline=a,P.highlightFormatting&&(F.formatting="link");var Ee=d(F);return Ee?Ee+=" ":Ee="",Ee+H.linkInline}if(ye==="<"&&G.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){F.f=F.inline=a,P.highlightFormatting&&(F.formatting="link");var Ee=d(F);return Ee?Ee+=" ":Ee="",Ee+H.linkEmail}if(P.xml&&ye==="<"&&G.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var I=G.string.indexOf(">",G.pos);if(I!=-1){var x=G.string.substring(G.start,I);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(x)&&(F.md_inside=!0)}return G.backUp(1),F.htmlState=fe.startState(Y),c(G,F,u)}if(P.xml&&ye==="<"&&G.match(/^\/\w*?>/))return F.md_inside=!1,"tag";if(ye==="*"||ye==="_"){for(var R=1,W=G.pos==1?" ":G.string.charAt(G.pos-2);R<3&&G.eat(ye);)R++;var J=G.peek()||" ",B=!/\s/.test(J)&&(!f.test(J)||/\s/.test(W)||f.test(W)),de=!/\s/.test(W)&&(!f.test(W)||/\s/.test(J)||f.test(J)),_e=null,Re=null;if(R%2&&(!F.em&&B&&(ye==="*"||!de||f.test(W))?_e=!0:F.em==ye&&de&&(ye==="*"||!B||f.test(J))&&(_e=!1)),R>1&&(!F.strong&&B&&(ye==="*"||!de||f.test(W))?Re=!0:F.strong==ye&&de&&(ye==="*"||!B||f.test(J))&&(Re=!1)),Re!=null||_e!=null){P.highlightFormatting&&(F.formatting=_e==null?"strong":Re==null?"em":"strong em"),_e===!0&&(F.em=ye),Re===!0&&(F.strong=ye);var pe=d(F);return _e===!1&&(F.em=!1),Re===!1&&(F.strong=!1),pe}}else if(ye===" "&&(G.eat("*")||G.eat("_"))){if(G.peek()===" ")return d(F);G.backUp(1)}if(P.strikethrough){if(ye==="~"&&G.eatWhile(ye)){if(F.strikethrough){P.highlightFormatting&&(F.formatting="strikethrough");var pe=d(F);return F.strikethrough=!1,pe}else if(G.match(/^[^\s]/,!1))return F.strikethrough=!0,P.highlightFormatting&&(F.formatting="strikethrough"),d(F)}else if(ye===" "&&G.match(/^~~/,!0)){if(G.peek()===" ")return d(F);G.backUp(2)}}if(P.emoji&&ye===":"&&G.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){F.emoji=!0,P.highlightFormatting&&(F.formatting="emoji");var Oe=d(F);return F.emoji=!1,Oe}return ye===" "&&(G.match(/^ +$/,!1)?F.trailingSpace++:F.trailingSpace&&(F.trailingSpaceNewLine=!0)),d(F)}function a(G,F){var ie=G.next();if(ie===">"){F.f=F.inline=s,P.highlightFormatting&&(F.formatting="link");var ge=d(F);return ge?ge+=" ":ge="",ge+H.linkInline}return G.match(/^[^>]+/,!0),H.linkInline}function g(G,F){if(G.eatSpace())return null;var ie=G.next();return ie==="("||ie==="["?(F.f=F.inline=b(ie==="("?")":"]"),P.highlightFormatting&&(F.formatting="link-string"),F.linkHref=!0,d(F)):"error"}var m={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function b(G){return function(F,ie){var ge=F.next();if(ge===G){ie.f=ie.inline=s,P.highlightFormatting&&(ie.formatting="link-string");var ye=d(ie);return ie.linkHref=!1,ye}return F.match(m[G]),ie.linkHref=!0,d(ie)}}function M(G,F){return G.match(/^([^\]\\]|\\.)*\]:/,!1)?(F.f=K,G.next(),P.highlightFormatting&&(F.formatting="link"),F.linkText=!0,d(F)):i(G,F,s)}function K(G,F){if(G.match(/^\]:/,!0)){F.f=F.inline=z,P.highlightFormatting&&(F.formatting="link");var ie=d(F);return F.linkText=!1,ie}return G.match(/^([^\]\\]|\\.)+/,!0),H.linkText}function z(G,F){return G.eatSpace()?null:(G.match(/^[^\s]+/,!0),G.peek()===void 0?F.linkTitle=!0:G.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),F.f=F.inline=s,H.linkHref+" url")}var ee={startState:function(){return{f:p,prevLine:{stream:null},thisLine:{stream:null},block:p,htmlState:null,indentation:0,inline:s,text:h,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(G){return{f:G.f,prevLine:G.prevLine,thisLine:G.thisLine,block:G.block,htmlState:G.htmlState&&fe.copyState(Y,G.htmlState),indentation:G.indentation,localMode:G.localMode,localState:G.localMode?fe.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,F){if(F.formatting=!1,G!=F.thisLine.stream){if(F.header=0,F.hr=!1,G.match(/^\s*$/,!0))return v(F),null;if(F.prevLine=F.thisLine,F.thisLine={stream:G},F.taskList=!1,F.trailingSpace=0,F.trailingSpaceNewLine=!1,!F.localState&&(F.f=F.block,F.f!=u)){var ie=G.match(/^\s*/,!0)[0].replace(/\t/g,l).length;if(F.indentation=ie,F.indentationDiff=null,ie>0)return null}}return F.f(G,F)},innerMode:function(G){return G.block==u?{state:G.htmlState,mode:Y}:G.localState?{state:G.localState,mode:G.localMode}:{state:G,mode:ee}},indent:function(G,F,ie){return G.block==u&&Y.indent?Y.indent(G.htmlState,F,ie):G.localState&&G.localMode.indent?G.localMode.indent(G.localState,F,ie):fe.Pass},blankLine:v,getType:d,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return ee},"xml"),fe.defineMIME("text/markdown","markdown"),fe.defineMIME("text/x-markdown","markdown")})},lnNo:function(qe,Ke,V){qe.exports=V.p+"static/up.69f3b3fd.svg"},m3fD:function(qe,Ke,V){qe.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(qe,Ke,V){(function(fe){fe(V("VrN/"))})(function(fe){"use strict";var $=fe.Pos;function P(f,l){return f.line-l.line||f.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",O=new RegExp("<(/?)(["+Y+"]["+U+"]*)","g");function H(f,l,i,c){this.line=l,this.ch=i,this.cm=f,this.text=f.getLine(l),this.min=c?Math.max(c.from,f.firstLine()):f.firstLine(),this.max=c?Math.min(c.to-1,f.lastLine()):f.lastLine()}function N(f,l){var i=f.cm.getTokenTypeAt($(f.line,l));return i&&/\btag\b/.test(i)}function k(f){return f.line>=f.max?void 0:(f.ch=0,f.text=f.cm.getLine(++f.line),!0)}function L(f){return f.line<=f.min?void 0:(f.text=f.cm.getLine(--f.line),f.ch=f.text.length,!0)}function _(f){for(;;){var l=f.text.indexOf(">",f.ch);if(l==-1){if(k(f))continue;return}if(!N(f,l+1)){f.ch=l+1;continue}var i=f.text.lastIndexOf("/",l),c=i>-1&&!/\S/.test(f.text.slice(i+1,l));return f.ch=l+1,c?"selfClose":"regular"}}function w(f){for(;;){var l=f.ch?f.text.lastIndexOf("<",f.ch-1):-1;if(l==-1){if(L(f))continue;return}if(!N(f,l+1)){f.ch=l;continue}O.lastIndex=l,f.ch=l;var i=O.exec(f.text);if(i&&i.index==l)return i}}function D(f){for(;;){O.lastIndex=f.ch;var l=O.exec(f.text);if(!l){if(k(f))continue;return}if(!N(f,l.index+1)){f.ch=l.index+1;continue}return f.ch=l.index+l[0].length,l}}function T(f){for(;;){var l=f.ch?f.text.lastIndexOf(">",f.ch-1):-1;if(l==-1){if(L(f))continue;return}if(!N(f,l+1)){f.ch=l;continue}var i=f.text.lastIndexOf("/",l),c=i>-1&&!/\S/.test(f.text.slice(i+1,l));return f.ch=l+1,c?"selfClose":"regular"}}function C(f,l){for(var i=[];;){var c=D(f),E,v=f.line,p=f.ch-(c?c[0].length:0);if(!c||!(E=_(f)))return;if(E=="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,p),to:$(f.line,f.ch)}}else i.push(c[2])}}function S(f,l){for(var i=[];;){var c=T(f);if(!c)return;if(c=="selfClose"){w(f);continue}var E=f.line,v=f.ch,p=w(f);if(!p)return;if(p[1])i.push(p[2]);else{for(var u=i.length-1;u>=0;--u)if(i[u]==p[2]){i.length=u;break}if(u<0&&(!l||l==p[2]))return{tag:p[2],from:$(f.line,f.ch),to:$(E,v)}}}}fe.registerHelper("fold","xml",function(f,l){for(var i=new H(f,l.line,0);;){var c=D(i);if(!c||i.line!=l.line)return;var E=_(i);if(!E)return;if(!c[1]&&E!="selfClose"){var v=$(i.line,i.ch),p=C(i,c[2]);return p&&P(p.from,v)>0?{from:v,to:p.from}:null}}}),fe.findMatchingTag=function(f,l,i){var c=new H(f,l.line,l.ch,i);if(c.text.indexOf(">")==-1&&c.text.indexOf("<")==-1)return;var E=_(c),v=E&&$(c.line,c.ch),p=E&&w(c);if(!E||!p||P(c,l)>0)return;var u={from:$(c.line,c.ch),to:v,tag:p[2]};return E=="selfClose"?{open:u,close:null,at:"open"}:p[1]?{open:S(c,p[2]),close:u,at:"close"}:(c=new H(f,v.line,v.ch,i),{open:u,close:C(c,p[2]),at:"open"})},fe.findEnclosingTag=function(f,l,i,c){for(var E=new H(f,l.line,l.ch,i);;){var v=S(E,c);if(!v)break;var p=new H(f,l.line,l.ch,i),u=C(p,v.tag);if(u)return{open:v,close:u}}},fe.scanForClosingTag=function(f,l,i,c){var E=new H(f,l.line,l.ch,c?{from:0,to:c}:null);return C(E,i)}})},p5ED:function(qe,Ke,V){"use strict";var fe=V("+L6B"),$=V("2/Rp"),P=V("5Dmo"),Y=V("3S7+"),U=V("k1fw"),O=V("9og8"),H=V("tJVT"),N=V("WmNS"),k=V.n(N),L=V("q1tI"),_=V.n(L),w=V("vHTk"),D=V.n(w),T=V("yEEn"),C=V("ZW9T"),S=V("1vsH"),f=V("V0Rq"),l=V("m3rI");Ke.a=function(i){var c,E,v,p,u,y,d,h=i.editOffice,s=h===void 0?"view":h,a=i.data,g=i.theme,m=i.type,b=i.filename,M=i.monacoEditor,K=i.className,z=i.style,ee=i.close,G=i.onClose,F=i.hasMask,ie=i.disabledDownload,ge=Object(L.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),ye=Object(H.a)(ge,2),xe=ye[0],Te=ye[1],Se=Object(L.useState)(""),me=Object(H.a)(Se,2),pe=me[0],Ee=me[1],le=Object(L.useState)(),I=Object(H.a)(le,2),x=I[0],R=I[1],W=window.ENV==="build"?"/react/build":"",J=l.a.PROXY_SERVER||location.origin,B,de=1024*1024,_e=10*de,Re=Object(L.useRef)();(c=a)!==null&&c!==void 0&&c.startsWith("/api")&&m!=="txt"&&(a=(l.a.API_SERVER||location.origin)+a),m==="office"&&(B=Object(S.T)(a).filesize,B>_e&&(m="other")),b&&M&&(M.filename=b),Object(L.useEffect)(function(){var De,Ve,Qe=(De=document.cookie)===null||De===void 0||((Ve=De.replace(/\s/g,""))===null||Ve===void 0)?void 0:Ve.split(";");Qe==null||Qe.map(function(at){var Ze=at.split("=");Ze[0]==="_educoder_session"&&Ee(Ze[1])})},[]),Object(L.useEffect)(function(){m==="office"&&Oe()},[m,a]);var Oe=function(){var De=Object(O.a)(k.a.mark(function Ve(){var Qe,at,Ze;return k.a.wrap(function(rt){for(;;)switch(rt.prev=rt.next){case 0:return console.log("data:",a),Qe=a,a.startsWith("http")||(Qe=location.origin+Qe),at=new URL(Qe).pathname.split("/").pop(),rt.next=6,Object(f.V)({attachment_id:at});case 6:Ze=rt.sent,R(Ze);case 8:case"end":return rt.stop()}},Ve)}));return function(){return De.apply(this,arguments)}}(),ke=function(){if(a.startsWith("http")||a.startsWith("blob:")){Ie();return}Object(S.z)(b||"educoder",a,b)},Ie=function(){Object(S.x)(b||"educoder",decodeURIComponent(a))};return _.a.createElement("div",{style:Object(U.a)({},z||{}),className:"".concat(F&&D.a.bgBlack," ").concat(m?D.a.wrp:"hide")},ee&&_.a.createElement("div",{className:D.a.close,ref:Re},!ie&&_.a.createElement(Y.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return Re.current}},_.a.createElement("span",{onClick:Ie},_.a.createElement("i",{className:"icon-quxiaozhiding"}))),_.a.createElement(Y.a,{title:"\u5173\u95ED",getPopupContainer:function(){return Re.current}},_.a.createElement("span",{className:"",onClick:G},_.a.createElement("i",{className:"icon-guanbi1"})))),_.a.createElement("div",{className:"".concat(D.a[K]," ").concat(K," ").concat(D.a.monaco," ").concat(m==="txt"?"show":"hide")},m==="txt"&&_.a.createElement(C.b,M)),m==="audio"&&_.a.createElement("audio",{src:"".concat(((E=a)===null||E===void 0?void 0:E.indexOf("http://"))>-1||((v=a)===null||v===void 0?void 0:v.indexOf("https://"))>-1?"":"data:audio/mp3;base64,").concat(a),autoPlay:!0}),m==="video"&&_.a.createElement(_.a.Fragment,null,((p=a)===null||p===void 0?void 0:p.indexOf("http"))>-1?_.a.createElement("video",{controls:!0,src:"".concat(a),autoPlay:!0}):_.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(a),autoPlay:!0})),m==="office"&&x&&_.a.createElement("iframe",{src:"".concat(W,"/office.html?key=").concat(x.key,"&url=").concat(J+x.url,"&callbackUrl=").concat(J+x.callbackUrl,"&fileType=").concat(x.fileType,"&title=").concat(x.title,"&model=").concat(s,"&officeServer=").concat(l.a.OFFICE_SERVER,"&disabledDownload=").concat(!!ie)}),m==="html"&&_.a.createElement("iframe",{src:a+"&disposition=inline"}),m==="pdf"&&_.a.createElement("iframe",{src:"".concat(W,"/js/pdfview/index.html?url=").concat(a,"&disabledDownload=").concat(!!ie)}),m==="image"&&_.a.createElement("img",{src:"".concat(((u=a)===null||u===void 0?void 0:u.indexOf("http://"))>-1||((y=a)===null||y===void 0?void 0:y.indexOf("https://"))>-1||(d=a)!==null&&d!==void 0&&d.startsWith("/api")?"":"data:image/png;base64,").concat(a)}),m==="other"&&_.a.createElement("div",null,_.a.createElement($.a,{type:"primary",size:"large",onClick:ke},_.a.createElement(T.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),m==="download"&&_.a.createElement($.a,{type:"primary",size:"large",onClick:ke},_.a.createElement(T.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(qe,Ke,V){},rUJ1:function(qe,Ke){const V=/[&<>"']/,fe=/[&<>"']/g,$=/[<>"']|&(?!#?\w+;)/,P=/[<>"']|&(?!#?\w+;)/g,Y={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},U=y=>Y[y];function O(y,d){if(d){if(V.test(y))return y.replace(fe,U)}else if($.test(y))return y.replace(P,U);return y}const H=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function N(y){return y.replace(H,(d,h)=>(h=h.toLowerCase(),h==="colon"?":":h.charAt(0)==="#"?h.charAt(1)==="x"?String.fromCharCode(parseInt(h.substring(2),16)):String.fromCharCode(+h.substring(1)):""))}const k=/(^|[^\[])\^/g;function L(y,d){y=y.source||y,d=d||"";const h={replace:(s,a)=>(a=a.source||a,a=a.replace(k,"$1"),y=y.replace(s,a),h),getRegex:()=>new RegExp(y,d)};return h}const _=/[^\w:]/g,w=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function D(y,d,h){if(y){let s;try{s=decodeURIComponent(N(h)).replace(_,"").toLowerCase()}catch(a){return null}if(s.indexOf("javascript:")===0||s.indexOf("vbscript:")===0||s.indexOf("data:")===0)return null}d&&!w.test(h)&&(h=l(d,h));try{h=encodeURI(h).replace(/%25/g,"%")}catch(s){return null}return h}const T={},C=/^[^:]+:\/*[^/]*$/,S=/^([^:]+:)[\s\S]*$/,f=/^([^:]+:\/*[^/]*)[\s\S]*$/;function l(y,d){T[" "+y]||(C.test(y)?T[" "+y]=y+"/":T[" "+y]=v(y,"/",!0)),y=T[" "+y];const h=y.indexOf(":")===-1;return d.substring(0,2)==="//"?h?d:y.replace(S,"$1")+d:d.charAt(0)==="/"?h?d:y.replace(f,"$1")+d:y+d}const i={exec:function(){}};function c(y){let d=1,h,s;for(;d<arguments.length;d++){h=arguments[d];for(s in h)Object.prototype.hasOwnProperty.call(h,s)&&(y[s]=h[s])}return y}function E(y,d){const h=y.replace(/\|/g,(g,m,b)=>{let M=!1,K=m;for(;--K>=0&&b[K]==="\\";)M=!M;return M?"|":" |"}),s=h.split(/ \|/);let a=0;if(s.length>d)s.splice(d);else for(;s.length<d;)s.push("");for(;a<s.length;a++)s[a]=s[a].trim().replace(/\\\|/g,"|");return s}function v(y,d,h){const s=y.length;if(s===0)return"";let a=0;for(;a<s;){const g=y.charAt(s-a-1);if(g===d&&!h)a++;else if(g!==d&&h)a++;else break}return y.substr(0,s-a)}function p(y,d){if(y.indexOf(d[1])===-1)return-1;const h=y.length;let s=0,a=0;for(;a<h;a++)if(y[a]==="\\")a++;else if(y[a]===d[0])s++;else if(y[a]===d[1]&&(s--,s<0))return a;return-1}function u(y){y&&y.sanitize&&!y.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}qe.exports={escape:O,unescape:N,edit:L,cleanUrl:D,resolveUrl:l,noopTest:i,merge:c,splitCells:E,rtrim:v,findClosingBracket:p,checkSanitizeDeprecation:u}},sbIO:function(qe,Ke,V){"use strict";var fe=V("DjyN"),$=V("NUBc"),P=V("5Dmo"),Y=V("3S7+"),U=V("/zsF"),O=V("PArb"),H=V("Q9mQ"),N=V("diRs"),k=V("+L6B"),L=V("2/Rp"),_=V("5NDa"),w=V("5rEg"),D=V("miYZ"),T=V("tsqr"),C=V("9og8"),S=V("giR+"),f=V("fyUT"),l=V("2qtc"),i=V("kLXV"),c=V("tJVT"),E=V("WmNS"),v=V.n(E),p=V("q1tI"),u=V.n(p),y=V("PsQE"),d=V.n(y),h=V("0eGx"),s=V.n(h),a=V("9Bee"),g=V("Ty5D"),m=V("9kvl"),b=V("ErOA"),M=V("+yhJ"),K=V.n(M),z=V("RZ/O"),ee=V.n(z),G=V("LvDl"),F=V("6K3P"),ie=V.n(F),ge=V("sRBo"),ye=V("kaz8"),xe=V("oBTY"),Te=V("PpiC"),Se=V("Ot1p"),me=V("kqOp"),pe=V("7qnI"),Ee=V("1vsH"),le=V("PGNT"),I=V.n(le),x=["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"],R=function(oe,he){var ce=oe.globalSetting,Ce=oe.loading,Ae=oe.dispatch,Ge=oe.isEdit,Ue=oe.editData,He=Object(Te.a)(oe,["globalSetting","loading","dispatch","isEdit","editData"]),Tt=Object(p.useState)(""),Xe=Object(c.a)(Tt,2),st=Xe[0],jt=Xe[1],ze=Object(p.useState)(""),It=Object(c.a)(ze,2),Zt=It[0],At=It[1],qt=Object(p.useState)([]),Gt=Object(c.a)(qt,2),Dt=Gt[0],Ot=Gt[1],ht=Object(p.useState)(""),kt=Object(c.a)(ht,2),bt=kt[0],_t=kt[1],Et=Object(p.useState)(),nt=Object(c.a)(Et,2),Be=nt[0],Rt=nt[1],Nt=Object(p.useState)(!1),Lt=Object(c.a)(Nt,2),Ft=Lt[0],Vt=Lt[1];Object(p.useEffect)(function(){if(!Ue||!Ge)return;jt(Ue==null?void 0:Ue.name),At(Ue==null?void 0:Ue.analysis),Rt(Ue==null?void 0:Ue.is_ordered),Vt(!0)},[Ue]),Object(p.useEffect)(function(){if(!Ft)return;var Cn=Ue==null?void 0:Ue.standard_answer.map(function(Xt){return Xt.answer_text});Ot(Cn),Vt(!1)},[Ft]),Object(p.useImperativeHandle)(he,function(){return{onSave:Jt,Clear:Je}});var Jt=function(){var Xt=[],Pt=!1;return st?(Dt.forEach(function(Sn,$e){Xt.push({position:$e+1,answer_text:[]}),Sn.forEach(function(ln,Ln){Xt[$e].answer_text.push(ln),(!ln||!Object(Ee.eb)(ln,1e4))&&(_t("".concat($e,"-").concat(Ln)),T.b.info(ln?"\u7B54\u6848\u4E0D\u80FD\u8D85\u8FC710000\u5B57\u7B26":"\u7B54\u6848\uFF1A\u4E0D\u80FD\u4E3A\u7A7A"),Pt=!0)})}),Pt?!1:(Xt==null?void 0:Xt.length)>20?(T.b.warn("\u586B\u7A7A\u9898\u6807\u51C6\u7B54\u6848\u4E0D\u80FD\u4E3A\u7A7A/\u4E0D\u80FD\u8D85\u8FC720\u4E2A\uFF01"),!1):{name:st,analysis:Zt,standard_answers:Xt,is_ordered:Be}):(T.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),!1)},Je=function(){jt(""),At(""),Ot([]),Rt(!1)},je=function(Xt,Pt,Sn){var $e=Dt.slice();if(Pt&&$e.splice(Xt,Pt),Sn)for(var ln=0;ln<Sn;ln++)$e.splice(Xt+ln,0,[""]);Ot($e)},ft=function(Xt,Pt,Sn){_t("");var $e=Dt.slice();$e[Xt][Pt]=Sn,Ot($e)},Rn=function(Xt){var Pt=Dt.slice();Pt[Xt]=[].concat(Object(xe.a)(Pt[Xt]),[""]),Ot(Pt)},hr=function(Xt,Pt){var Sn=Dt.slice();if(!Sn[Xt][Pt]){Sn[Xt]=Sn[Xt].filter(function($e,ln){return ln!==Pt}),Ot(Sn);return}i.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u63D0\u793A",content:"\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u53C2\u8003\u7B54\u6848\u5417\uFF1F",className:I.a.modal,onOk:function(){Sn[Xt]=Sn[Xt].filter(function(ln,Ln){return Ln!==Pt}),Ot(Sn)}})},vr=function(Xt){i.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u63D0\u793A",content:"\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u53C2\u8003\u7B54\u6848\u5417\uFF1F",className:I.a.modal,onOk:function(){var Sn=Dt.slice();Sn=Dt.filter(function($e,ln){return Xt!==ln}),Ot(Sn)}})};return u.a.createElement("section",{className:I.a.wrap},u.a.createElement("p",{className:I.a.titleWrap},u.a.createElement("span",{className:I.a.required},"*"),u.a.createElement("span",{className:I.a.title},"\u9898\u5E72\uFF1A")),u.a.createElement("div",null,u.a.createElement(me.a,{id:"completion-question-tittle",placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE",height:155,defaultValue:st,onChange:function(Xt){return jt(Xt)},showNullButton:!0,onPlaceholderChange:je})),u.a.createElement("div",{className:"mt20"},Dt.map(function(Cn,Xt){return u.a.createElement(pe.a,{key:Xt,answers:Cn,index:Xt,flex:1,is_md:!0,activeOptionErrorIndex:bt,onAnswerChange:ft,addChildAnswer:Rn,deleteChildAnswer:hr,deleteChildAnswermain:vr})})),u.a.createElement("div",{className:"mt20"},Dt.length>1&&u.a.createElement("span",null,u.a.createElement(ye.a,{checked:Be,onChange:function(Xt){return Rt(Xt.target.checked)},className:"".concat(I.a.color333," font14")},"\u591A\u4E2A\u586B\u7A7A\u7684\u7B54\u6848\u6709\u987A\u5E8F\u8981\u6C42"),u.a.createElement("span",{className:"".concat(I.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:I.a.titleWrap},u.a.createElement("span",{className:I.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),u.a.createElement(Se.a,{id:"single-question-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:Zt,onChange:function(Xt){return At(Xt)}}))},W=Object(m.a)(function(ne){var oe=ne.loading,he=ne.globalSetting;return{globalSetting:he,loading:oe.effects}},null,null,{forwardRef:!0})(Object(p.forwardRef)(R)),J=V("7Kak"),B=V("9yH6"),de=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],_e=function(oe,he){var ce=oe.globalSetting,Ce=oe.loading,Ae=oe.editData,Ge=oe.dispatch,Ue=oe.onRef,He=Ue===void 0?function(){}:Ue,Tt=oe.isEdit,Xe=Object(Te.a)(oe,["globalSetting","loading","editData","dispatch","onRef","isEdit"]),st=Object(p.useState)(),jt=Object(c.a)(st,2),ze=jt[0],It=jt[1],Zt=Object(p.useState)(""),At=Object(c.a)(Zt,2),qt=At[0],Gt=At[1],Dt=Object(p.useState)(""),Ot=Object(c.a)(Dt,2),ht=Ot[0],kt=Ot[1];Object(p.useEffect)(function(){if(!Ae||!Tt)return;Gt(Ae==null?void 0:Ae.name),kt(Ae==null?void 0:Ae.analysis);var Et=Ae==null?void 0:Ae.choices.find(function(nt){return nt.is_answer});It(Et.choice_text==="\u6B63\u786E"?"0":"1")},[Ae]),Object(p.useImperativeHandle)(he,function(){return{onSave:bt,Clear:_t}});var bt=function(){if(!qt)return T.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),!1;if(!ze)return T.b.info("\u8BF7\u5148\u70B9\u51FB\u9009\u62E9\u672C\u9009\u62E9\u9898\u7684\u6B63\u786E\u9009\u9879"),!1;var nt=[{choice_text:"\u6B63\u786E",is_answer:ze==="0"?1:0},{choice_text:"\u9519\u8BEF",is_answer:ze==="1"?1:0}];return{name:qt,choices:nt,analysis:ht}},_t=function(){Gt(""),kt(""),It("")};return u.a.createElement("section",{className:I.a.wrap},u.a.createElement("p",{className:I.a.titleWrap},u.a.createElement("span",{className:I.a.required},"*"),u.a.createElement("span",{className:I.a.title},"\u9898\u5E72\uFF1A")),u.a.createElement(Se.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:qt,onChange:function(nt){return Gt(nt)}}),u.a.createElement("p",{className:I.a.titleWrap},u.a.createElement("span",{className:I.a.required},"*"),u.a.createElement("span",{className:I.a.title},"\u7B54\u6848\u9009\u9879\uFF1A",u.a.createElement("span",{className:I.a.colorGray},"\u70B9\u51FB\u9009\u9879\u53EF\u8BBE\u7F6E\u6B63\u786E\u7B54\u6848"))),u.a.createElement(B.a.Group,{buttonStyle:"solid",value:ze,onChange:function(nt){return It(nt.target.value)}},u.a.createElement(B.a.Button,{value:"0",className:"".concat(I.a.radio," mr40")},"\u6B63\u786E"),u.a.createElement(B.a.Button,{value:"1",className:I.a.radio},"\u9519\u8BEF")),u.a.createElement("p",{className:I.a.titleWrap},u.a.createElement("span",{className:I.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),u.a.createElement(Se.a,{id:"single-question-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:ht,onChange:function(nt){return kt(nt)}}))},Re=Object(m.a)(function(ne){var oe=ne.loading,he=ne.globalSetting;return{globalSetting:he,loading:oe.effects}},null,null,{forwardRef:!0})(Object(p.forwardRef)(_e)),Oe=["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"],ke=function(oe,he){var ce=oe.editData,Ce=oe.globalSetting,Ae=oe.loading,Ge=oe.dispatch,Ue=oe.onRef,He=Ue===void 0?function(){}:Ue,Tt=oe.isEdit,Xe=Object(Te.a)(oe,["editData","globalSetting","loading","dispatch","onRef","isEdit"]),st=Object(p.useState)([]),jt=Object(c.a)(st,2),ze=jt[0],It=jt[1],Zt=Object(p.useState)(),At=Object(c.a)(Zt,2),qt=At[0],Gt=At[1],Dt=Object(p.useState)([]),Ot=Object(c.a)(Dt,2),ht=Ot[0],kt=Ot[1],bt=Object(p.useState)(""),_t=Object(c.a)(bt,2),Et=_t[0],nt=_t[1],Be=Object(p.useState)(""),Rt=Object(c.a)(Be,2),Nt=Rt[0],Lt=Rt[1];Object(p.useEffect)(function(){It(["","","",""])},[]),Object(p.useEffect)(function(){if(!ce||!Tt)return;nt(ce==null?void 0:ce.name),Lt(ce==null?void 0:ce.analysis),It(ce==null?void 0:ce.choices.map(function(Je){return Je.choice_text}));var Jt=[];ce==null||ce.choices.map(function(Je,je){Je.is_answer&&Jt.push(je)}),kt(Jt)},[ce]),Object(p.useImperativeHandle)(he,function(){return{onSave:Ft,Clear:Vt}});var Ft=function(){if(!Et)return T.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),!1;var Je=ze.findIndex(function(ft){return!ft});if(Je>-1)return T.b.info("\u8BF7\u5148\u8F93\u5165 ".concat(Oe[Je]," \u9009\u9879\u7684\u5185\u5BB9")),!1;if(!ht.length)return T.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(ht.length<2)return T.b.info("\u591A\u9009\u9898\u6700\u5C0F\u6B63\u786E\u9009\u9879\u4E3A2\u4E2A"),!1;var je=ze.map(function(ft,Rn){return{choice_text:ft,is_answer:ht.includes(Rn)?1:0}});return{name:Et,choices:je,analysis:Nt}},Vt=function(){It(["","","",""]),nt(""),Lt(""),kt("")};return u.a.createElement("section",{className:I.a.wrap},u.a.createElement("p",{className:I.a.titleWrap},u.a.createElement("span",{className:I.a.required},"*"),u.a.createElement("span",{className:I.a.title},"\u9898\u5E72\uFF1A")),u.a.createElement(Se.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:Et,onChange:function(Je){return nt(Je)}}),u.a.createElement("p",{className:I.a.titleWrap},u.a.createElement("span",{className:I.a.required},"*"),u.a.createElement("span",{className:I.a.title},"\u7B54\u6848\u9009\u9879\uFF1A",u.a.createElement("span",{className:I.a.colorGray},"\u70B9\u51FB\u9009\u9879\u53EF\u8BBE\u7F6E\u6B63\u786E\u7B54\u6848"))),ze.map(function(Jt,Je){return u.a.createElement("div",{className:I.a.choiceWrap,key:Je},u.a.createElement(Y.a,{title:"\u70B9\u51FB\u8BBE\u7F6E\u4E3A\u6807\u51C6\u7B54\u6848",placement:"left"},u.a.createElement("div",{className:"".concat(I.a.answer," ").concat(ht.includes(Je)?I.a.activeAnswer:""),onClick:function(){ht.includes(Je)?kt(ht.filter(function(ft){return ft!==Je})):kt([].concat(Object(xe.a)(ht),[Je]))}},Oe[Je])),u.a.createElement("div",{className:I.a.editorWrap},qt===Je?u.a.createElement(Se.a,{id:"single-question-option-".concat(Je),watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9009\u9879",defaultValue:Jt,onChange:function(ft){ze[Je]=ft,It(ze)}}):u.a.createElement("div",{className:I.a.htmlWrap,onClick:function(){return Gt(Je)}},u.a.createElement(a.a,{value:Jt}))),Je>1&&u.a.createElement(Y.a,{title:"\u5220\u9664"},u.a.createElement("i",{className:"".concat(I.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){It(ze.filter(function(ft,Rn){return Rn!==Je})),ht.includes(Je)?kt(ht.filter(function(ft){return ft!==Je})):kt([].concat(Object(xe.a)(ht),[Je]))}})),Je<7&&Je===ze.length-1&&u.a.createElement(Y.a,{title:"\u65B0\u589E\u53C2\u8003\u7B54\u6848"},u.a.createElement("i",{className:"".concat(I.a.addIcon," iconfont icon-roundaddfill ml6"),onClick:function(){return It([].concat(Object(xe.a)(ze),[""]))}})))}),u.a.createElement("p",{className:I.a.titleWrap},u.a.createElement("span",{className:I.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),u.a.createElement(Se.a,{id:"single-question-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:Nt,onChange:function(Je){return Lt(Je)}}))},Ie=Object(m.a)(function(ne){var oe=ne.loading,he=ne.globalSetting;return{globalSetting:he,loading:oe.effects}},null,null,{forwardRef:!0})(Object(p.forwardRef)(ke)),De=["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"],Ve=function(oe,he){var ce=oe.editData,Ce=oe.globalSetting,Ae=oe.loading,Ge=oe.dispatch,Ue=oe.onRef,He=Ue===void 0?function(){}:Ue,Tt=oe.isEdit,Xe=Object(Te.a)(oe,["editData","globalSetting","loading","dispatch","onRef","isEdit"]),st=Object(p.useState)([]),jt=Object(c.a)(st,2),ze=jt[0],It=jt[1],Zt=Object(p.useState)(),At=Object(c.a)(Zt,2),qt=At[0],Gt=At[1],Dt=Object(p.useState)(),Ot=Object(c.a)(Dt,2),ht=Ot[0],kt=Ot[1],bt=Object(p.useState)(""),_t=Object(c.a)(bt,2),Et=_t[0],nt=_t[1],Be=Object(p.useState)(""),Rt=Object(c.a)(Be,2),Nt=Rt[0],Lt=Rt[1];Object(p.useEffect)(function(){It(["","","",""])},[]),Object(p.useEffect)(function(){if(!ce||!Tt)return;nt(ce==null?void 0:ce.name),Lt(ce==null?void 0:ce.analysis),It(ce==null?void 0:ce.choices.map(function(Jt){return Jt.choice_text})),kt(ce==null?void 0:ce.choices.findIndex(function(Jt){return Jt.is_answer}))},[ce]),Object(p.useImperativeHandle)(he,function(){return{onSave:Ft,Clear:Vt}});var Ft=function(){if(!Et)return T.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),!1;var Je=ze.findIndex(function(ft){return!ft});if(Je>-1)return T.b.info("\u8BF7\u5148\u8F93\u5165 ".concat(De[Je]," \u9009\u9879\u7684\u5185\u5BB9")),!1;if(console.log("activeAnswer: ",ht),!(typeof ht=="number"))return T.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 je=ze.map(function(ft,Rn){return{choice_text:ft,is_answer:ht===Rn?1:0}});return{name:Et,choices:je,analysis:Nt}},Vt=function(){It(["","","",""]),nt(""),Lt(""),kt("")};return u.a.createElement("section",{className:I.a.wrap},u.a.createElement("p",{className:I.a.titleWrap},u.a.createElement("span",{className:I.a.required},"*"),u.a.createElement("span",{className:I.a.title},"\u9898\u5E72\uFF1A")),u.a.createElement(Se.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:Et,onChange:function(Je){return nt(Je)}}),u.a.createElement("p",{className:I.a.titleWrap},u.a.createElement("span",{className:I.a.required},"*"),u.a.createElement("span",{className:I.a.title},"\u7B54\u6848\u9009\u9879\uFF1A",u.a.createElement("span",{className:I.a.colorGray},"\u70B9\u51FB\u9009\u9879\u53EF\u8BBE\u7F6E\u6B63\u786E\u7B54\u6848"))),ze.map(function(Jt,Je){return u.a.createElement("div",{className:I.a.choiceWrap,key:Je},u.a.createElement(Y.a,{title:"\u70B9\u51FB\u8BBE\u7F6E\u4E3A\u6807\u51C6\u7B54\u6848",placement:"left"},u.a.createElement("div",{className:"".concat(I.a.answer," ").concat(ht===Je?I.a.activeAnswer:""),onClick:function(){return kt(Je)}},De[Je])),u.a.createElement("div",{className:I.a.editorWrap},qt===Je?u.a.createElement(Se.a,{id:"single-question-option-".concat(Je),watch:!0,height:155,isFocus:!0,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9009\u9879",defaultValue:Jt,onChange:function(ft){ze[Je]=ft,It(ze)}}):u.a.createElement("div",{className:I.a.htmlWrap,onClick:function(){return Gt(Je)}},u.a.createElement(a.a,{value:Jt}))),Je>1&&u.a.createElement(Y.a,{title:"\u5220\u9664"},u.a.createElement("i",{className:"".concat(I.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){It(ze.filter(function(ft,Rn){return Rn!==Je})),Je===ht&&kt(null)}})),Je<7&&Je===ze.length-1&&u.a.createElement(Y.a,{title:"\u65B0\u589E\u53C2\u8003\u7B54\u6848"},u.a.createElement("i",{className:"".concat(I.a.addIcon," iconfont icon-roundaddfill ml6"),onClick:function(){return It([].concat(Object(xe.a)(ze),[""]))}})))}),u.a.createElement("p",{className:I.a.titleWrap},u.a.createElement("span",{className:I.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),u.a.createElement(Se.a,{id:"single-question-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:Nt,onChange:function(Je){return Lt(Je)}}))},Qe=Object(m.a)(function(ne){var oe=ne.loading,he=ne.globalSetting;return{globalSetting:he,loading:oe.effects}},null,null,{forwardRef:!0})(Object(p.forwardRef)(Ve)),at=["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"],Ze=function(oe,he){var ce=oe.editData,Ce=oe.globalSetting,Ae=oe.loading,Ge=oe.dispatch,Ue=oe.onRef,He=Ue===void 0?function(){}:Ue,Tt=oe.isEdit,Xe=Object(Te.a)(oe,["editData","globalSetting","loading","dispatch","onRef","isEdit"]),st=Object(p.useState)(""),jt=Object(c.a)(st,2),ze=jt[0],It=jt[1],Zt=Object(p.useState)(""),At=Object(c.a)(Zt,2),qt=At[0],Gt=At[1],Dt=Object(p.useState)(""),Ot=Object(c.a)(Dt,2),ht=Ot[0],kt=Ot[1];Object(p.useEffect)(function(){var Et;if(!ce||!Tt)return;It(ce==null?void 0:ce.name),Gt(ce==null?void 0:ce.analysis),kt(ce==null||((Et=ce.answer_texts)===null||Et===void 0)?void 0:Et[0])},[ce]),Object(p.useImperativeHandle)(he,function(){return{onSave:bt,Clear:_t}});var bt=function(){return ze?ht?{name:ze,answer_texts:[ht],analysis:qt}:(T.b.info("\u8BF7\u60A8\u8F93\u5165\u53C2\u8003\u7B54\u6848"),!1):(T.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),!1)},_t=function(){It(""),Gt(""),kt("")};return u.a.createElement("section",{className:I.a.wrap},u.a.createElement("p",{className:I.a.titleWrap},u.a.createElement("span",{className:I.a.required},"*"),u.a.createElement("span",{className:I.a.title},"\u9898\u5E72\uFF1A")),u.a.createElement(Se.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:ze,onChange:function(nt){return It(nt)}}),u.a.createElement("p",{className:I.a.titleWrap},u.a.createElement("span",{className:I.a.title},"\u53C2\u8003\u7B54\u6848\uFF1A")),u.a.createElement(Se.a,{id:"single-question-reference-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u53C2\u8003\u7B54\u6848",defaultValue:ht,onChange:function(nt){return kt(nt)}}),u.a.createElement("p",{className:I.a.titleWrap},u.a.createElement("span",{className:I.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),u.a.createElement(Se.a,{id:"single-question-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:qt,onChange:function(nt){return Gt(nt)}}))},yt=Object(m.a)(function(ne){var oe=ne.loading,he=ne.globalSetting;return{globalSetting:he,loading:oe.effects}},null,null,{forwardRef:!0})(Object(p.forwardRef)(Ze)),rt=V("k1fw"),dt=["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"],Me=function(oe,he){var ce=oe.globalSetting,Ce=oe.loading,Ae=oe.dispatch,Ge=oe.editData,Ue=oe.onRef,He=Ue===void 0?function(){}:Ue,Tt=oe.isEdit,Xe=Object(Te.a)(oe,["globalSetting","loading","dispatch","editData","onRef","isEdit"]),st=Object(p.useState)(""),jt=Object(c.a)(st,2),ze=jt[0],It=jt[1],Zt=Object(p.useState)([]),At=Object(c.a)(Zt,2),qt=At[0],Gt=At[1];console.log(qt),Object(p.useEffect)(function(){var bt;if(!Ge||!Tt)return;It(Ge==null?void 0:Ge.name);var _t=Ge==null||((bt=Ge.sub_item_banks)===null||bt===void 0)?void 0:bt.map(function(Et){var nt,Be,Rt;return Object(rt.a)(Object(rt.a)({},Et),{},{id:Et.id,open:!1,qusList:Et==null||((nt=Et.choices)===null||nt===void 0)?void 0:nt.map(function(Nt){return Nt.choice_text}),activeQusEditor:null,qusAnswer:(Be=[Et==null||((Rt=Et.choices)===null||Rt===void 0)?void 0:Rt.findIndex(function(Nt){return Nt.is_answer})])===null||Be===void 0?void 0:Be.filter(function(Nt){return Nt!==-1})})});Gt(_t)},[Ge]),Object(p.useImperativeHandle)(he,function(){return{onSave:Dt,Clear:Ot}});var Dt=function(){if(!ze)return T.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),!1;if(qt.length===0)return T.b.info("\u8BF7\u60A8\u6DFB\u52A0\u5C0F\u9898"),!1;for(var _t=0;_t<qt.length;_t++){var Et,nt=qt[_t];if(!(nt!=null&&nt.name))return T.b.info("\u8BF7\u60A8\u8F93\u5165\u7B2C".concat(_t+1,"\u5C0F\u9898\u9898\u5E72")),!1;var Be=nt==null||((Et=nt.qusList)===null||Et===void 0)?void 0:Et.findIndex(function(Nt){return!Nt});if(Be>-1)return T.b.info("\u8BF7\u5148\u8F93\u5165\u7B2C".concat(_t+1,"\u5C0F\u9898").concat(dt[Be],"\u9009\u9879\u7684\u5185\u5BB9")),!1;if(!(nt!=null&&nt.qusAnswer.length))return T.b.info("\u8BF7\u8BBE\u7F6E\u7B2C".concat(_t+1,"\u5C0F\u9898\u7684\u6B63\u786E\u7B54\u6848\uFF0C\u70B9\u51FB\u9009\u9879A/B...\u5373\u53EF\u5B8C\u6210\u8BBE\u7F6E")),!1}var Rt=qt.map(function(Nt){return{id:Nt.id>1?Nt.id:null,name:Nt.name,item_type:Nt.item_type,analysis:Nt.analysis,choices:Nt.qusList.map(function(Lt,Ft){return{choice_text:Lt,is_answer:Nt.qusAnswer[0]===Ft?1:0}})}});return{name:ze,sub_item_banks:Rt}},Ot=function(){It(""),Gt([])},ht=function(){var _t={id:Math.random(),item_type:"SINGLE",open:!1,name:"",qusList:["","","",""],activeQusEditor:null,qusAnswer:[],analysis:""};Gt(qt.concat(_t))},kt=function(_t,Et,nt){var Be=Object(G.cloneDeep)(qt);if(_t==="open"&&(Be[Et].open=!Be[Et].open),_t==="delete"&&Be.splice(Et,1),_t==="value"&&(Be[Et].name=nt),_t==="answer"&&(Be[Et].qusAnswer=[nt]),_t==="edit"&&(Be[Et].activeQusEditor=nt),_t==="details"&&(Be[Et].qusList[Be[Et].activeQusEditor]=nt),_t==="addQus"&&(Be[Et].qusList=Be[Et].qusList.concat("")),_t==="deleteQus"){var Rt;Be[Et].qusList=Be[Et].qusList.filter(function(Nt,Lt){return Lt!==nt}),Be[Et].qusAnswer=(Rt=Be[Et].qusAnswer)===null||Rt===void 0?void 0:Rt.filter(function(Nt){return Nt!==nt})}_t==="analysis"&&(Be[Et].analysis=nt),Gt(Be)};return u.a.createElement("section",{className:I.a.wrap},u.a.createElement("p",{className:I.a.titleWrap},u.a.createElement("span",{className:I.a.required},"*"),u.a.createElement("span",{className:I.a.title},"\u9898\u5E72\uFF1A")),u.a.createElement(Se.a,{id:"combination-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:ze,onChange:function(_t){return It(_t)}}),qt==null?void 0:qt.map(function(bt,_t){var Et;return u.a.createElement("div",{className:I.a.fold,key:bt.id},u.a.createElement("div",{onClick:function(){return kt("open",_t)},className:I.a.head},u.a.createElement("i",{className:"iconfont icon-sanjiaoxing",style:{transform:bt.open?"initial":"rotate(270deg) translate(2px, 4px)"}}),u.a.createElement("span",null,"\u7B2C",_t+1,"\u5C0F\u9898\uFF08\u5355\u9009\u9898\uFF09"),u.a.createElement("b",{style:{visibility:"hidden"},onClick:function(Be){Be.stopPropagation(),kt("delete",_t)},className:"iconfont icon-shanchu8"})),u.a.createElement("div",{className:"mb10",style:{display:bt.open?"block":"none"}},u.a.createElement(Se.a,{watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:bt==null?void 0:bt.name,onChange:function(Be){return kt("value",_t,Be)}}),u.a.createElement("p",{className:I.a.titleWrap},u.a.createElement("span",{className:I.a.required},"*"),u.a.createElement("span",{className:I.a.title},"\u7B54\u6848\u9009\u9879\uFF1A",u.a.createElement("span",{className:I.a.colorGray},"\u70B9\u51FB\u9009\u9879\u53EF\u8BBE\u7F6E\u6B63\u786E\u7B54\u6848"))),bt==null||((Et=bt.qusList)===null||Et===void 0)?void 0:Et.map(function(nt,Be){var Rt,Nt;return u.a.createElement("div",{className:I.a.choiceWrap,key:Be},u.a.createElement(Y.a,{title:"\u70B9\u51FB\u8BBE\u7F6E\u4E3A\u6807\u51C6\u7B54\u6848",placement:"left"},u.a.createElement("div",{className:"".concat(I.a.answer," ").concat(bt!=null&&(Rt=bt.qusAnswer)!==null&&Rt!==void 0&&Rt.includes(Be)?I.a.activeAnswer:""),onClick:function(){return kt("answer",_t,Be)}},dt[Be])),u.a.createElement("div",{className:I.a.editorWrap},(bt==null?void 0:bt.activeQusEditor)===Be?u.a.createElement(Se.a,{id:"single-question-option-".concat(Be),watch:!0,height:155,isFocus:!0,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9009\u9879",defaultValue:nt,onChange:function(Ft){return kt("details",_t,Ft)}}):u.a.createElement("div",{className:I.a.htmlWrap,onClick:function(){return kt("edit",_t,Be)}},u.a.createElement(a.a,{value:nt}))),Be>1&&u.a.createElement(Y.a,{title:"\u5220\u9664"},u.a.createElement("i",{className:"".concat(I.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){return kt("deleteQus",_t,Be)}})),Be<7&&Be===(bt==null||((Nt=bt.qusList)===null||Nt===void 0)?void 0:Nt.length)-1&&u.a.createElement(Y.a,{title:"\u65B0\u589E\u53C2\u8003\u7B54\u6848"},u.a.createElement("i",{className:"".concat(I.a.addIcon," iconfont icon-roundaddfill ml6"),onClick:function(){return kt("addQus",_t)}})))}),u.a.createElement("p",{className:"mb10 mt10"},u.a.createElement("span",{className:I.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),u.a.createElement(Se.a,{id:"single-question-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:bt.analysis,onChange:function(Be){return kt("analysis",_t,Be)}})))}))},xt=Object(m.a)(function(ne){var oe=ne.loading,he=ne.globalSetting;return{globalSetting:he,loading:oe.effects}},null,null,{forwardRef:!0})(Object(p.forwardRef)(Me)),mt=V("14J3"),se=V("BMrR"),Z=V("ZWs3"),q=function(oe){var he=oe.visible,ce=oe.onCancel,Ce=oe.onRandomExchange,Ae=oe.selectFromProblemSet;return u.a.createElement(i.a,{title:"\u8BF7\u9009\u62E9\u66FF\u6362\u65B9\u5F0F",visible:he,onCancel:ce,centered:!0,maskClosable:!0,footer:null},u.a.createElement(se.a,{justify:"center"},u.a.createElement(Z.a,{onClick:Ce},"\u968F\u673A\u66F4\u6362"),u.a.createElement(L.a,{style:{marginLeft:24},onClick:Ae},"\u4ECE\u9898\u5E93\u4E2D\u9009\u62E9")))},ae=q,ue=function(oe){var he,ce,Ce,Ae,Ge,Ue,He,Tt,Xe=oe.data,st=oe.submit,jt=oe.goBack,ze=oe.loading,It=oe.onTypeScore,Zt=oe.editPreview,At=Zt===void 0?!1:Zt,qt=oe.onSkipExamination,Gt=oe.selectValue,Dt=oe.onExchange,Ot=Object(p.useRef)(),ht=Object(p.useRef)(Object(G.debounce)(function(){return Cn()},100,{leading:!0,trailing:!0})),kt=Object(p.useState)(null),bt=Object(c.a)(kt,2),_t=bt[0],Et=bt[1],nt=Object(p.useState)(!1),Be=Object(c.a)(nt,2),Rt=Be[0],Nt=Be[1],Lt=Object(p.useState)(!1),Ft=Object(c.a)(Lt,2),Vt=Ft[0],Jt=Ft[1],Je=Object(p.useRef)(),je=Object(g.i)();Object(p.useEffect)(function(){return window.addEventListener("scroll",ht==null?void 0:ht.current),function(){window.removeEventListener("scroll",ht==null?void 0:ht.current)}},[]),Object(p.useEffect)(function(){Nt(!0)},[]),Object(p.useEffect)(function(){var pt,Le,et,Ut,Ct=(pt=document.getElementById("examName"))===null||pt===void 0||((Le=pt.getElementsByClassName("ant-pagination-options-quick-jumper"))===null||Le===void 0||((et=Le[0])===null||et===void 0||((Ut=et.childNodes)===null||Ut===void 0)))?void 0:Ut[2];Ct&&(Ct.nodeValue="\u4EFD")},[Xe]);var ft=function(Le){var et=parseInt(Le);return isNaN(et)?"":et};function Rn(){var pt=0,Le=0,et=0;return document.body&&(Le=document.body.scrollTop),document.documentElement&&(et=document.documentElement.scrollTop),pt=Le-et>0?Le:et,pt}function hr(){var pt=0,Le=0,et=0;return document.body&&(Le=document.body.scrollHeight),document.documentElement&&(et=document.documentElement.scrollHeight),pt=Le-et>0?Le:et,pt}function vr(){var pt=0;return document.compatMode=="CSS1Compat"?pt=document.documentElement.clientHeight:pt=document.body.clientHeight,pt}var Cn=function(){var Le=document.getElementById("preview_btns"),et=document.getElementById("preview_btns_else");Rn()+vr()>=hr()-68?(Le.style.visibility="hidden",et.style.visibility="visible"):(Le.style.visibility="visible",et.style.visibility="hidden")},Xt=["\u5BB9\u6613","\u7B80\u5355","\u9002\u4E2D","\u56F0\u96BE"],Pt=function(Le){var et,Ut=[];return u.a.createElement(u.a.Fragment,null,u.a.createElement("aside",{className:d.a.single},Le==null||((et=Le.choices)===null||et===void 0)?void 0:et.map(function(Ct,wt){return Ct.is_answer&&Ut.push(Hr[wt]),u.a.createElement("ul",{key:wt},u.a.createElement("li",null,Hr[wt],"\u3001"),u.a.createElement("li",null,u.a.createElement(a.a,{value:Ct.choice_text})))})),u.a.createElement("div",{className:d.a.analysis},u.a.createElement("div",null,"\u6B63\u786E\u7B54\u6848\uFF1A",Ut.join(""),u.a.createElement("span",{className:"ml30"},"\u96BE\u5EA6\uFF1A",Xt[Le.difficulty])),u.a.createElement("aside",null,u.a.createElement("span",{className:d.a.text},"\u89E3\u6790:"),u.a.createElement(a.a,{value:Le.analysis?Le.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(Le==null?void 0:Le.discipline_name,"/").concat(Le==null?void 0:Le.sub_discipline_name)),u.a.createElement("li",null,u.a.createElement("span",{style:{color:"#5AB891",marginRight:10}},"\u77E5\u8BC6\u70B9:"),Le==null?void 0:Le.tag_discipline_name))))},Sn=function(Le){var et,Ut=Le==null||((et=Le.standard_answer)===null||et===void 0)?void 0:et.map(function(Ct){var wt;return"\u7B54\u6848\uFF08\u586B\u7A7A".concat(Ct.position,"\uFF09\uFF1A").concat(Ct==null||((wt=Ct.answer_text)===null||wt===void 0)?void 0:wt.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",Ut),u.a.createElement("aside",null,u.a.createElement("span",{className:d.a.text},"\u89E3\u6790:"),u.a.createElement(a.a,{value:Le.analysis?Le.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(Le==null?void 0:Le.discipline_name,"/").concat(Le==null?void 0:Le.sub_discipline_name)),u.a.createElement("li",null,u.a.createElement("span",{style:{color:"#5AB891",marginRight:10}},"\u77E5\u8BC6\u70B9:"),Le==null?void 0:Le.tag_discipline_name))))},$e=function(Le){var et;return u.a.createElement("div",{className:d.a.analysis},u.a.createElement("div",null,"\u6B63\u786E\u7B54\u6848\uFF1A",Le==null||((et=Le.answer_texts)===null||et===void 0)?void 0:et[0]),u.a.createElement("aside",null,u.a.createElement("span",{className:d.a.text},"\u89E3\u6790:"),u.a.createElement(a.a,{value:Le.analysis?Le.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(Le==null?void 0:Le.discipline_name,"/").concat(Le==null?void 0:Le.sub_discipline_name)),u.a.createElement("li",null,u.a.createElement("span",{style:{color:"#5AB891",marginRight:10}},"\u77E5\u8BC6\u70B9:"),Le==null?void 0:Le.tag_discipline_name)))},ln=function(Le){var et;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(a.a,{value:Le==null||((et=Le.program_attr)===null||et===void 0)?void 0:et.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(Le==null?void 0:Le.discipline_name,"/").concat(Le==null?void 0:Le.sub_discipline_name)),u.a.createElement("li",null,u.a.createElement("span",{style:{color:"#5AB891",marginRight:10}},"\u77E5\u8BC6\u70B9:"),Le==null?void 0:Le.tag_discipline_name)))},Ln=function(Le,et){var Ut;return u.a.createElement("div",null,Le==null||((Ut=Le.sub_item_banks)===null||Ut===void 0)?void 0:Ut.map(function(Ct,wt){var Wt,bn=[];return u.a.createElement(u.a.Fragment,null,u.a.createElement("div",{style:{marginLeft:25,fontSize:"16px",color:"#333"}},et+1+"."+(wt+1),"\uFF08\u5355\u9009\u9898\uFF09",Ct.name),u.a.createElement("aside",{className:d.a.single},Ct==null||((Wt=Ct.choices)===null||Wt===void 0)?void 0:Wt.map(function(En,rn){return En.is_answer&&bn.push(Hr[rn]),u.a.createElement("ul",{key:rn},u.a.createElement("li",null,Hr[rn],"\u3001"),u.a.createElement("li",null,u.a.createElement(a.a,{value:En.choice_text})))})),u.a.createElement("div",{className:d.a.analysis},u.a.createElement("div",null,"\u6B63\u786E\u7B54\u6848\uFF1A",bn.join(""),u.a.createElement("span",{className:"ml30"},"\u96BE\u5EA6\uFF1A",Xt[Ct.difficulty])),u.a.createElement("aside",null,u.a.createElement("span",{className:d.a.text},"\u89E3\u6790:"),u.a.createElement(a.a,{value:Ct.analysis?Ct.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(Le==null?void 0:Le.discipline_name,"/").concat(Le==null?void 0:Le.sub_discipline_name)),u.a.createElement("li",null,u.a.createElement("span",{style:{color:"#5AB891",marginRight:10}},"\u77E5\u8BC6\u70B9:"),Le==null?void 0:Le.tag_discipline_name))))}))},Hr=["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"],Kr=function(Le){var et,Ut=[];Le==null||((et=Le.questions)===null||et===void 0)||et.map(function(wt){var Wt;return wt==null||((Wt=wt.sub_item_banks)===null||Wt===void 0)?void 0:Wt.map(function(bn){Ut.push(bn)})});var Ct=0;Le.type==="COMBINATION"?Ct=Le.questions_score/Ut.length:Ct=Le.questions_score/Le.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,Le==null?void 0:Le.name,(Le==null?void 0:Le.type)==="COMBINATION"&&"\u4E2D\u7684\u6BCF\u5C0F\u9898","\uFF1A"),u.a.createElement(f.a,{min:1,parser:ft,defaultValue:Ct,onChange:function(Wt){Ct=Wt}}),u.a.createElement("span",{className:"ml5"},"\u5206/\u9898"))),okText:"\u786E\u8BA4",cancelText:"\u53D6\u6D88",onOk:function(){var wt=Object(C.a)(v.a.mark(function bn(){var En,rn;return v.a.wrap(function(kn){for(;;)switch(kn.prev=kn.next){case 0:if(Ct){kn.next=3;break}return T.b.warn("\u5206\u6570\u4E0D\u80FD\u4E3A\u7A7A\u6216\u4E3A0"),kn.abrupt("return",Promise.reject());case 3:Le.type==="COMBINATION"?(En={type:Le==null?void 0:Le.type,score:Ct,scoreTotal:Ct*(Ut==null?void 0:Ut.length)},It(En)):(rn={type:Le==null?void 0:Le.type,score:Ct,scoreTotal:Ct*Le.questions_count},It(rn));case 4:case"end":return kn.stop()}},bn)}));function Wt(){return wt.apply(this,arguments)}return Wt}()})},Nn=function(){var Le="";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:ie.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(w.a,{placeholder:"\u8BF7\u8F93\u5165\u8BD5\u5377\u540D\u79F0",min:0,maxLength:60,defaultValue:Le,onChange:function(Ut){Le=Ut.target.value}}))),okText:"\u786E\u8BA4",cancelText:"\u53D6\u6D88",onOk:function(){var et=Object(C.a)(v.a.mark(function Ct(){var wt,Wt,bn,En,rn;return v.a.wrap(function(kn){for(;;)switch(kn.prev=kn.next){case 0:if(Le){kn.next=3;break}return T.b.warn("\u8BD5\u5377\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A"),kn.abrupt("return",Promise.reject());case 3:return Wt=[],bn=[],En=[],Xe==null||((wt=Xe.questionList)===null||wt===void 0)||wt.forEach(function(er){var Bn;(Bn=er.questions)===null||Bn===void 0||Bn.forEach(function(Ir){Wt.push(Ir.id),bn.push(er.questions_score/er.questions_count),er.type==="COMBINATION"&&En.push({id:Ir.id,sub_item_bank_ids:Ir.sub_item_banks.map(function(Qn){return Qn.id})})})}),console.log("-----",En),rn={item_bank_ids:Wt,item_bank_scores:bn,name:Le,combination_item_banks:En},kn.next=11,st(rn);case 11:case"end":return kn.stop()}},Ct)}));function Ut(){return et.apply(this,arguments)}return Ut}()})},ii=function(Le,et,Ut,Ct){var wt,Wt="".concat(location.pathname).concat(location.search),bn=(wt=Ct.questions)===null||wt===void 0?void 0:wt.map(function(rn){return rn.id});if(Wt.includes("exercise"))Je.current={id:Le,ids:bn,type:et,index:Ut},Jt(!0);else var En=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 rn=Object(C.a)(v.a.mark(function kn(){return v.a.wrap(function(Bn){for(;;)switch(Bn.prev=Bn.next){case 0:return En.update({cancelButtonProps:{disabled:!0}}),Bn.next=3,Dt({single_question_id:Le,seleted_item_bank_ids:bn},{type:et,index:Ut});case 3:En.update({cancelButtonProps:{disabled:!1}}),T.b.success("\u5DF2\u91CD\u65B0\u968F\u673A\u751F\u6210\u8BD5\u9898");case 5:case"end":return Bn.stop()}},kn)}));function On(){return rn.apply(this,arguments)}return On}()})},ai=function(Le){var et,Ut=(et=Le.questions)===null||et===void 0?void 0:et.map(function(Wt){return Wt.id}),Ct=Le.name,wt=i.a.confirm({icon:null,className:"custom-modal-divider",centered:!0,title:"\u6E29\u99A8\u63D0\u793A",content:"\u786E\u8BA4\u66F4\u6362".concat(Ct,"\u4E2D\u7684\u6240\u6709\u8BD5\u9898\u5417\uFF1F"),cancelButtonProps:{disabled:!1},maskClosable:!1,keyboard:!1,okText:"\u786E\u8BA4",cancelText:"\u53D6\u6D88",onOk:function(){var Wt=Object(C.a)(v.a.mark(function En(){return v.a.wrap(function(On){for(;;)switch(On.prev=On.next){case 0:return wt.update({cancelButtonProps:{disabled:!0}}),On.next=3,Dt({seleted_item_bank_ids:Ut},{type:Le.type});case 3:wt.update({cancelButtonProps:{disabled:!1}}),T.b.success("\u5DF2\u91CD\u65B0\u968F\u673A\u751F\u6210".concat(Ct,"\u8BD5\u9898"));case 5:case"end":return On.stop()}},En)}));function bn(){return Wt.apply(this,arguments)}return bn}()})},yr=function(){var Le=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 et=Object(C.a)(v.a.mark(function Ct(){return v.a.wrap(function(Wt){for(;;)switch(Wt.prev=Wt.next){case 0:return Le.update({cancelButtonProps:{disabled:!0}}),Wt.next=3,Dt();case 3:Le.update({cancelButtonProps:{disabled:!1}}),T.b.success("\u5DF2\u91CD\u65B0\u968F\u673A\u751F\u6210\u6574\u5F20\u8BD5\u9898");case 5:case"end":return Wt.stop()}},Ct)}));function Ut(){return et.apply(this,arguments)}return Ut}()})},Mr=function(Le){console.log(Le,"key"),qt(Le-1)},oi=function(){return u.a.createElement(u.a.Fragment,null,u.a.createElement(N.a,{color:"#55575D",overlayClassName:d.a.popover,visible:Rt,getPopupContainer:function(et){return et==null?void 0:et.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 Nt(!0)},onMouseLeave:function(){return Nt(!1)},onClick:function(){Nn()}},"\u4FDD\u5B58")),u.a.createElement(L.a,{onClick:function(){document.body.scrollIntoView(),jt()}},"\u8FD4\u56DE"),u.a.createElement(L.a,{loading:ze,onClick:function(){return st()},type:"primary"},"\u63D0\u4EA4"))},qr=function(){var Le;return u.a.createElement(u.a.Fragment,null,u.a.createElement(L.a,{onClick:jt},"\u8FD4\u56DE"),Gt>0&&u.a.createElement(L.a,{onClick:function(){return Mr(Gt)},type:"primary"},"\u4E0A\u4E00\u4EFD"),Gt<(Xe==null||((Le=Xe.exam)===null||Le===void 0)?void 0:Le.total_num)-1&&u.a.createElement(L.a,{onClick:function(){return Mr(Gt+2)}},"\u4E0B\u4E00\u4EFD"))},br=function(Le,et){if(et==="SINGLE")return u.a.createElement(u.a.Fragment,null,u.a.createElement(Qe,{ref:Ot,editData:Le,isEdit:!0}),u.a.createElement(O.a,null));if(et==="MULTIPLE")return u.a.createElement(u.a.Fragment,null,u.a.createElement(Ie,{ref:Ot,editData:Le,isEdit:!0}),u.a.createElement(O.a,null));if(et==="JUDGMENT")return u.a.createElement(u.a.Fragment,null,u.a.createElement(Re,{ref:Ot,editData:Le,isEdit:!0}),u.a.createElement(O.a,null));if(et==="COMPLETION")return u.a.createElement(u.a.Fragment,null,u.a.createElement(W,{ref:Ot,editData:Le,isEdit:!0}),u.a.createElement(O.a,null));if(et==="SUBJECTIVE")return u.a.createElement(u.a.Fragment,null,u.a.createElement(yt,{ref:Ot,editData:Le,isEdit:!0}),u.a.createElement(O.a,null));if(et==="COMBINATION")return u.a.createElement(u.a.Fragment,null,u.a.createElement(xt,{ref:Ot,editData:Le,isEdit:!0}),u.a.createElement(O.a,null));if(et==="PROGRAM"){var Ut;m.d.push("/problems/".concat(Le==null||((Ut=Le.program_attr)===null||Ut===void 0)?void 0:Ut.identifier,"/edit?type=exercises&express_id=").concat(je.categoryId,"&question_id=").concat(Le==null?void 0:Le.id,"&score=").concat(Le==null?void 0:Le.score,"&callback_url=").concat(location.pathname,"&select=").concat(Gt,"&exercise=true"))}},Un=function(){var pt=Object(C.a)(v.a.mark(function Le(et,Ut){var Ct,wt,Wt,bn,En,rn,On,kn,er,Bn;return v.a.wrap(function(Qn){for(;;)switch(Qn.prev=Qn.next){case 0:return Qn.next=2,(Ct=Ot.current)===null||Ct===void 0?void 0:Ct.onSave();case 2:if(wt=Qn.sent,wt){Qn.next=5;break}return Qn.abrupt("return");case 5:return Wt={question_score:Ut.score,analysis:wt.analysis},(et==="SINGLE"||et==="MULTIPLE"||et==="JUDGMENT")&&(En=[],rn=[],Wt.question_type=et==="JUDGMENT"?2:1,Wt.question_title=wt==null?void 0:wt.name,wt==null||((bn=wt.choices)===null||bn===void 0)||bn.forEach(function(Tn,fr){En.push(Tn.choice_text),Tn!=null&&Tn.is_answer&&rn.push(fr+1)}),Wt.question_choices=En,Wt.standard_answers=rn),et==="COMPLETION"&&(Wt.is_ordered=wt.is_ordered,Wt.question_title=wt==null?void 0:wt.name,Wt.question_type=3,kn=[],wt==null||((On=wt.standard_answers)===null||On===void 0)||On.forEach(function(Tn,fr){kn.push({choice_id:Tn.position,answer_text:Tn.answer_text})}),Wt.standard_answers=kn),et==="SUBJECTIVE"&&(Wt.question_title=wt==null?void 0:wt.name,Wt.question_type=3,Wt.standard_answers=wt==null?void 0:wt.answer_texts),et==="COMBINATION"&&(Wt.question_title=wt==null?void 0:wt.name,Wt.question_type=7,Wt.sub_questions=wt==null||((er=wt.sub_item_banks)===null||er===void 0)?void 0:er.map(function(Tn,fr){return{id:Tn.id,question_title:Tn.name,question_type:1,question_choices:Tn.choices.map(function(wr){return wr.choice_text}),standard_answers:[Tn.choices.findIndex(function(wr){return wr.is_answer})+1],analysis:Tn.analysis}}),delete Wt.analysis),Qn.next=12,Object(b.a)("/api/exercise_questions/".concat(Ut.id,".json"),{method:"put",body:Wt});case 12:Bn=Qn.sent,(Bn==null?void 0:Bn.status)===0&&(T.b.success("\u7F16\u8F91\u6210\u529F"),Mr(Gt+1)),Et(null);case 15:case"end":return Qn.stop()}},Le)}));return function(et,Ut){return pt.apply(this,arguments)}}(),ei=function(){for(var Le=[],et=0;et<(Xe==null||((Ut=Xe.exam)===null||Ut===void 0)?void 0:Ut.total_num);et++){var Ut;Le.push({})}return Le},si=Xe==null||((he=Xe.questionList)===null||he===void 0)?void 0:he.reduce(function(pt,Le){return pt+Le.questions_score},0),Wn=At&&(Xe==null||((ce=Xe.exam)===null||ce===void 0)?void 0:ce.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(Le){var et=document.getElementById("id_left_preview");et.style.overflowY="auto"},onMouseLeave:function(Le){var et=document.getElementById("id_left_preview");et.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:K.a}),u.a.createElement("span",null,"\u9898\u6570(\u9053)"),u.a.createElement("aside",null,Xe==null?void 0:Xe.all_questions_count)),u.a.createElement("div",{className:"mr30 ml30"},u.a.createElement("img",{src:ee.a}),u.a.createElement("span",null,"\u603B\u5206(\u5206)"),u.a.createElement("aside",null,si)),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,Xe==null||((Ce=Xe.exam)===null||Ce===void 0)?void 0:Ce.time))),Xe==null||((Ae=Xe.questionList)===null||Ae===void 0)?void 0:Ae.map(function(pt,Le){var et;return u.a.createElement("div",{className:d.a.list,key:Le},u.a.createElement("div",{className:d.a.name},u.a.createElement("b",null),u.a.createElement("span",null,pt.name)),u.a.createElement("aside",null,u.a.createElement("div",null,"\u5171",u.a.createElement("span",{className:d.a.b},pt.questions_count),"\u9898"," ",u.a.createElement("span",{className:d.a.l},"|"),"\u5171",u.a.createElement("span",{className:d.a.r},pt.questions_score),"\u5206"),u.a.createElement("div",{className:d.a.answerSheet},pt==null||((et=pt.questions)===null||et===void 0)?void 0:et.map(function(Ut,Ct){return u.a.createElement("div",{onClick:function(){var Wt="Anchor_".concat(Ut.id),bn=document.getElementById(Wt);bn&&setTimeout(function(){return bn.scrollIntoView({block:"center",behavior:"smooth"})})},key:Ut.id,className:d.a.tag},Ct+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:Xe==null||((Ge=Xe.exam)===null||Ge===void 0)?void 0:Ge.name,getPopupContainer:function(Le){return Le.parentNode}},u.a.createElement("span",{className:d.a.t},Xe==null||((Ue=Xe.exam)===null||Ue===void 0)?void 0:Ue.name))),At?u.a.createElement($.a,{showTotal:function(Le){return u.a.createElement("span",{style:{color:"#656F87",fontSize:14}},"\u5171\u8BA1",u.a.createElement("span",{className:"c-light-primary"},Le),"\u4EFD\u8BD5\u5377")},total:Xe==null||((He=Xe.exam)===null||He===void 0)?void 0:He.total_num,pageSize:1,current:Gt+1,showSizeChanger:!1,onChange:Mr,showQuickJumper:!0,hideOnSinglePage:!1}):u.a.createElement(L.a,{onClick:yr,type:"primary"},"\u968F\u673A\u66F4\u6362")),u.a.createElement("div",{className:d.a.topWarp},Xe==null||((Tt=Xe.questionList)===null||Tt===void 0)?void 0:Tt.map(function(pt,Le){var et,Ut;return u.a.createElement(u.a.Fragment,{key:Le},u.a.createElement("div",{className:d.a.head,style:Le===0?{border:0,marginTop:-16}:{}},u.a.createElement("div",{className:d.a.name},u.a.createElement("b",null),u.a.createElement("span",null,pt.name)),u.a.createElement("div",{className:d.a.so},"\u5171",u.a.createElement("span",{className:d.a.b},pt.questions_count," "),"\u9898"," ",pt.type==="COMBINATION"&&"\uFF08\u5305\u542B".concat(pt==null||((et=pt.questions)===null||et===void 0)?void 0:et.map(function(Ct){var wt;return Ct==null||((wt=Ct.sub_item_banks)===null||wt===void 0)?void 0:wt.length}).reduce(function(Ct,wt){return Ct+wt}),"\u5C0F\u9898\uFF09"),u.a.createElement("span",{className:d.a.l},"|"),"\u5171",u.a.createElement("span",{className:d.a.r},pt.questions_score),"\u5206"),!At&&u.a.createElement("div",{className:d.a.btn},u.a.createElement(L.a,{onClick:function(){Kr(pt)},type:"primary",ghost:!0,className:"mr20"},"\u8BBE\u7F6E\u5F97\u5206"),u.a.createElement(L.a,{onClick:function(){return ai(pt)},type:"primary",ghost:!0},"\u968F\u673A\u66F4\u6362"))),pt==null||((Ut=pt.questions)===null||Ut===void 0)?void 0:Ut.map(function(Ct,wt){return _t===Ct.id?u.a.createElement("div",{id:"Anchor_".concat(Ct.id),className:d.a.content,style:{padding:0,marginTop:10},key:Ct.id},u.a.createElement("div",{style:{float:"right",marginTop:-6}},u.a.createElement(L.a,{onClick:function(){return Et(null)},className:"mr20",type:"primary",ghost:!0},"\u53D6\u6D88"),u.a.createElement(L.a,{onClick:function(){return Un(pt==null?void 0:pt.type,Ct)},type:"primary"},"\u4FDD\u5B58")),br(Ct,pt.type)):u.a.createElement("div",{id:"Anchor_".concat(Ct.id),className:d.a.content,key:Ct.id},u.a.createElement("div",{className:d.a.titleWrap},u.a.createElement(a.a,{style:{paddingRight:10},className:d.a.titleHtml,value:wt+1+"\u3001"+"".concat((Ct==null?void 0:Ct.item_type)==="combination"?"\uFF08\u9898\u5E72\uFF09":"")+Ct.name}),At&&u.a.createElement(L.a,{disabled:Wn,onClick:function(){if(_t){T.b.warn("\u5148\u4FDD\u5B58\u6216\u53D6\u6D88\u5F53\u524D\u6B63\u5728\u7F16\u8F91\u7684\u8BD5\u9898");return}Et(Ct.id)},type:"primary",className:"mr20",style:{marginLeft:"auto"},ghost:!0},"\u7F16\u8F91"),u.a.createElement(L.a,{disabled:Wn,onClick:function(){return ii(Ct.id,pt.type,wt,pt)},type:"primary",ghost:!0},"\u6362\u4E00\u9898")),(pt.type==="SINGLE"||pt.type==="JUDGMENT"||pt.type==="MULTIPLE")&&Pt(Ct),pt.type==="COMPLETION"&&Sn(Ct),pt.type==="SUBJECTIVE"&&$e(Ct),pt.type==="PROGRAM"&&ln(Ct),pt.type==="COMBINATION"&&Ln(Ct,wt),u.a.createElement("div",null))}))})),u.a.createElement("div",{className:d.a.btnsElse,id:"preview_btns_else"},At?qr():oi()),u.a.createElement("div",{className:d.a.btnsWrap,id:"preview_btns"},u.a.createElement("div",{className:d.a.btns},At?qr():oi()))),u.a.createElement(ae,{visible:Vt,onRandomExchange:Object(C.a)(v.a.mark(function pt(){var Le;return v.a.wrap(function(Ut){for(;;)switch(Ut.prev=Ut.next){case 0:return Le=Je.current,Ut.next=3,Dt({single_question_id:Le.id,seleted_item_bank_ids:Le.ids},{type:Le.type,index:Le.index});case 3:Jt(!1);case 4:case"end":return Ut.stop()}},pt)})),selectFromProblemSet:function(){var Le=Je.current,et="".concat(location.pathname).concat(location.search);et.includes("exercise")&&m.d.push("/paperlibrary/exchangequestion?type=exercise&qid=".concat(Le.id,"&qtype=").concat(Le.type,"&exerciseid=").concat(je.categoryId,"&from=").concat(et))},onCancel:function(){Jt(!1)}}))},te=Ke.a=ue},sboe:function(qe,Ke,V){"use strict";V.d(Ke,"a",function(){return P});var fe=V("q1tI"),$=V.n(fe),P=fe.createContext(null)},tmPe:function(qe,Ke,V){qe.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(qe,Ke,V){typeof window!="undefined"&&function($,P){qe.exports=P()}(this,function(){return function(fe){var $={};function P(Y){if($[Y])return $[Y].exports;var U=$[Y]={i:Y,l:!1,exports:{}};return fe[Y].call(U.exports,U,U.exports,P),U.l=!0,U.exports}return P.m=fe,P.c=$,P.d=function(Y,U,O){P.o(Y,U)||Object.defineProperty(Y,U,{enumerable:!0,get:O})},P.r=function(Y){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(Y,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(Y,"__esModule",{value:!0})},P.t=function(Y,U){if(U&1&&(Y=P(Y)),U&8)return Y;if(U&4&&typeof Y=="object"&&Y&&Y.__esModule)return Y;var O=Object.create(null);if(P.r(O),Object.defineProperty(O,"default",{enumerable:!0,value:Y}),U&2&&typeof Y!="string")for(var H in Y)P.d(O,H,function(N){return Y[N]}.bind(null,H));return O},P.n=function(Y){var U=Y&&Y.__esModule?function(){return Y.default}:function(){return Y};return P.d(U,"a",U),U},P.o=function(Y,U){return Object.prototype.hasOwnProperty.call(Y,U)},P.p="/dist/",P(P.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(fe,$,P){"use strict";var Y=Object.prototype.hasOwnProperty,U="~";function O(){}Object.create&&(O.prototype=Object.create(null),new O().__proto__||(U=!1));function H(_,w,D){this.fn=_,this.context=w,this.once=D||!1}function N(_,w,D,T,C){if(typeof D!="function")throw new TypeError("The listener must be a function");var S=new H(D,T||_,C),f=U?U+w:w;return _._events[f]?_._events[f].fn?_._events[f]=[_._events[f],S]:_._events[f].push(S):(_._events[f]=S,_._eventsCount++),_}function k(_,w){--_._eventsCount===0?_._events=new O:delete _._events[w]}function L(){this._events=new O,this._eventsCount=0}L.prototype.eventNames=function(){var w=[],D,T;if(this._eventsCount===0)return w;for(T in D=this._events)Y.call(D,T)&&w.push(U?T.slice(1):T);return Object.getOwnPropertySymbols?w.concat(Object.getOwnPropertySymbols(D)):w},L.prototype.listeners=function(w){var D=U?U+w:w,T=this._events[D];if(!T)return[];if(T.fn)return[T.fn];for(var C=0,S=T.length,f=new Array(S);C<S;C++)f[C]=T[C].fn;return f},L.prototype.listenerCount=function(w){var D=U?U+w:w,T=this._events[D];return T?T.fn?1:T.length:0},L.prototype.emit=function(w,D,T,C,S,f){var l=U?U+w:w;if(!this._events[l])return!1;var i=this._events[l],c=arguments.length,E,v;if(i.fn){i.once&&this.removeListener(w,i.fn,void 0,!0);switch(c){case 1:return i.fn.call(i.context),!0;case 2:return i.fn.call(i.context,D),!0;case 3:return i.fn.call(i.context,D,T),!0;case 4:return i.fn.call(i.context,D,T,C),!0;case 5:return i.fn.call(i.context,D,T,C,S),!0;case 6:return i.fn.call(i.context,D,T,C,S,f),!0}for(v=1,E=new Array(c-1);v<c;v++)E[v-1]=arguments[v];i.fn.apply(i.context,E)}else{var p=i.length,u;for(v=0;v<p;v++){i[v].once&&this.removeListener(w,i[v].fn,void 0,!0);switch(c){case 1:i[v].fn.call(i[v].context);break;case 2:i[v].fn.call(i[v].context,D);break;case 3:i[v].fn.call(i[v].context,D,T);break;case 4:i[v].fn.call(i[v].context,D,T,C);break;default:if(!E)for(u=1,E=new Array(c-1);u<c;u++)E[u-1]=arguments[u];i[v].fn.apply(i[v].context,E)}}}return!0},L.prototype.on=function(w,D,T){return N(this,w,D,T,!1)},L.prototype.once=function(w,D,T){return N(this,w,D,T,!0)},L.prototype.removeListener=function(w,D,T,C){var S=U?U+w:w;if(!this._events[S])return this;if(!D)return k(this,S),this;var f=this._events[S];if(f.fn)f.fn===D&&(!C||f.once)&&(!T||f.context===T)&&k(this,S);else{for(var l=0,i=[],c=f.length;l<c;l++)(f[l].fn!==D||C&&!f[l].once||T&&f[l].context!==T)&&i.push(f[l]);i.length?this._events[S]=i.length===1?i[0]:i:k(this,S)}return this},L.prototype.removeAllListeners=function(w){var D;return w?(D=U?U+w:w,this._events[D]&&k(this,D)):(this._events=new O,this._eventsCount=0),this},L.prototype.off=L.prototype.removeListener,L.prototype.addListener=L.prototype.on,L.prefixed=U,L.EventEmitter=L,fe.exports=L},"./node_modules/url-toolkit/src/url-toolkit.js":function(fe,$,P){(function(Y){var U=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,O=/^([^\/?#]*)([^]*)$/,H=/(?:\/|^)\.(?=\/)/g,N=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,k={buildAbsoluteURL:function(L,_,w){if(w=w||{},L=L.trim(),_=_.trim(),!_){if(!w.alwaysNormalize)return L;var D=k.parseURL(L);if(!D)throw new Error("Error trying to parse base URL.");return D.path=k.normalizePath(D.path),k.buildURLFromParts(D)}var T=k.parseURL(_);if(!T)throw new Error("Error trying to parse relative URL.");if(T.scheme)return w.alwaysNormalize?(T.path=k.normalizePath(T.path),k.buildURLFromParts(T)):_;var C=k.parseURL(L);if(!C)throw new Error("Error trying to parse base URL.");if(!C.netLoc&&C.path&&C.path[0]!=="/"){var S=O.exec(C.path);C.netLoc=S[1],C.path=S[2]}C.netLoc&&!C.path&&(C.path="/");var f={scheme:C.scheme,netLoc:T.netLoc,path:null,params:T.params,query:T.query,fragment:T.fragment};if(!T.netLoc&&(f.netLoc=C.netLoc,T.path[0]!=="/"))if(!T.path)f.path=C.path,T.params||(f.params=C.params,T.query||(f.query=C.query));else{var l=C.path,i=l.substring(0,l.lastIndexOf("/")+1)+T.path;f.path=k.normalizePath(i)}return f.path===null&&(f.path=w.alwaysNormalize?k.normalizePath(T.path):T.path),k.buildURLFromParts(f)},parseURL:function(L){var _=U.exec(L);return _?{scheme:_[1]||"",netLoc:_[2]||"",path:_[3]||"",params:_[4]||"",query:_[5]||"",fragment:_[6]||""}:null},normalizePath:function(L){for(L=L.split("").reverse().join("").replace(H,"");L.length!==(L=L.replace(N,"")).length;);return L.split("").reverse().join("")},buildURLFromParts:function(L){return L.scheme+L.netLoc+L.path+L.params+L.query+L.fragment}};fe.exports=k})(this)},"./node_modules/webworkify-webpack/index.js":function(fe,$,P){function Y(w){var D={};function T(S){if(D[S])return D[S].exports;var f=D[S]={i:S,l:!1,exports:{}};return w[S].call(f.exports,f,f.exports,T),f.l=!0,f.exports}T.m=w,T.c=D,T.i=function(S){return S},T.d=function(S,f,l){T.o(S,f)||Object.defineProperty(S,f,{configurable:!1,enumerable:!0,get:l})},T.r=function(S){Object.defineProperty(S,"__esModule",{value:!0})},T.n=function(S){var f=S&&S.__esModule?function(){return S.default}:function(){return S};return T.d(f,"a",f),f},T.o=function(S,f){return Object.prototype.hasOwnProperty.call(S,f)},T.p="/",T.oe=function(S){throw console.error(S),S};var C=T(T.s=ENTRY_MODULE);return C.default||C}var U="[\\.|\\-|\\+|\\w|/|@]+",O="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+U+").*?\\)";function H(w){return(w+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function N(w){return!isNaN(1*w)}function k(w,D,T){var C={};C[T]=[];var S=D.toString(),f=S.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!f)return C;for(var l=f[1],i=new RegExp("(\\\\n|\\W)"+H(l)+O,"g"),c;c=i.exec(S);){if(c[3]==="dll-reference")continue;C[T].push(c[3])}for(i=new RegExp("\\("+H(l)+'\\("(dll-reference\\s('+U+'))"\\)\\)'+O,"g");c=i.exec(S);)w[c[2]]||(C[T].push(c[1]),w[c[2]]=P(c[1]).m),C[c[2]]=C[c[2]]||[],C[c[2]].push(c[4]);for(var E=Object.keys(C),v=0;v<E.length;v++)for(var p=0;p<C[E[v]].length;p++)N(C[E[v]][p])&&(C[E[v]][p]=1*C[E[v]][p]);return C}function L(w){var D=Object.keys(w);return D.reduce(function(T,C){return T||w[C].length>0},!1)}function _(w,D){for(var T={main:[D]},C={main:[]},S={main:{}};L(T);)for(var f=Object.keys(T),l=0;l<f.length;l++){var i=f[l],c=T[i],E=c.pop();if(S[i]=S[i]||{},S[i][E]||!w[i][E])continue;S[i][E]=!0,C[i]=C[i]||[],C[i].push(E);for(var v=k(w,w[i][E],i),p=Object.keys(v),u=0;u<p.length;u++)T[p[u]]=T[p[u]]||[],T[p[u]]=T[p[u]].concat(v[p[u]])}return C}fe.exports=function(w,D){D=D||{};var T={main:P.m},C=D.all?{main:Object.keys(T.main)}:_(T,w),S="";Object.keys(C).filter(function(E){return E!=="main"}).forEach(function(E){for(var v=0;C[E][v];)v++;C[E].push(v),T[E][v]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",S=S+"var "+E+" = ("+Y.toString().replace("ENTRY_MODULE",JSON.stringify(v))+")({"+C[E].map(function(p){return""+JSON.stringify(p)+": "+T[E][p].toString()}).join(",")+`});
`}),S=S+"new (("+Y.toString().replace("ENTRY_MODULE",JSON.stringify(w))+")({"+C.main.map(function(E){return""+JSON.stringify(E)+": "+T.main[E].toString()}).join(",")+"}))(self);";var f=new window.Blob([S],{type:"text/javascript"});if(D.bare)return f;var l=window.URL||window.webkitURL||window.mozURL||window.msURL,i=l.createObjectURL(f),c=new window.Worker(i);return c.objectURL=i,c}},"./src/config.ts":function(fe,$,P){"use strict";P.r($),P.d($,"hlsDefaultConfig",function(){return u}),P.d($,"mergeConfig",function(){return d}),P.d($,"enableStreamingMode",function(){return h});var Y=P("./src/controller/abr-controller.ts"),U=P("./src/controller/audio-stream-controller.ts"),O=P("./src/controller/audio-track-controller.ts"),H=P("./src/controller/subtitle-stream-controller.ts"),N=P("./src/controller/subtitle-track-controller.ts"),k=P("./src/controller/buffer-controller.ts"),L=P("./src/controller/timeline-controller.ts"),_=P("./src/controller/cap-level-controller.ts"),w=P("./src/controller/fps-controller.ts"),D=P("./src/controller/eme-controller.ts"),T=P("./src/controller/cmcd-controller.ts"),C=P("./src/utils/xhr-loader.ts"),S=P("./src/utils/fetch-loader.ts"),f=P("./src/utils/cues.ts"),l=P("./src/utils/mediakeys-helper.ts"),i=P("./src/utils/logger.ts");function c(){return c=Object.assign||function(s){for(var a=1;a<arguments.length;a++){var g=arguments[a];for(var m in g)Object.prototype.hasOwnProperty.call(g,m)&&(s[m]=g[m])}return s},c.apply(this,arguments)}function E(s,a){var g=Object.keys(s);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(s);a&&(m=m.filter(function(b){return Object.getOwnPropertyDescriptor(s,b).enumerable})),g.push.apply(g,m)}return g}function v(s){for(var a=1;a<arguments.length;a++){var g=arguments[a]!=null?arguments[a]:{};a%2?E(Object(g),!0).forEach(function(m){p(s,m,g[m])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(g)):E(Object(g)).forEach(function(m){Object.defineProperty(s,m,Object.getOwnPropertyDescriptor(g,m))})}return s}function p(s,a,g){return a in s?Object.defineProperty(s,a,{value:g,enumerable:!0,configurable:!0,writable:!0}):s[a]=g,s}var u=v(v({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:Infinity,maxBufferSize:60*1e3*1e3,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:Infinity,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:C.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:Y.default,bufferController:k.default,capLevelController:_.default,fpsController:w.default,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystemOptions:{},requestMediaKeySystemAccessFunc:l.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},y()),{},{subtitleStreamController:H.SubtitleStreamController,subtitleTrackController:N.default,timelineController:L.TimelineController,audioStreamController:U.default,audioTrackController:O.default,emeController:D.default,cmcdController:T.default});function y(){return{cueHandler:f.default,enableCEA708Captions:!0,enableWebVTT:!0,enableIMSC1:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function d(s,a){if((a.liveSyncDurationCount||a.liveMaxLatencyDurationCount)&&(a.liveSyncDuration||a.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(a.liveMaxLatencyDurationCount!==void 0&&(a.liveSyncDurationCount===void 0||a.liveMaxLatencyDurationCount<=a.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(a.liveMaxLatencyDuration!==void 0&&(a.liveSyncDuration===void 0||a.liveMaxLatencyDuration<=a.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return c({},s,a)}function h(s){var a=s.loader;if(a!==S.default&&a!==C.default)i.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),s.progressive=!1;else{var g=Object(S.fetchSupported)();g&&(s.loader=S.default,s.progressive=!0,s.enableSoftwareAES=!0,i.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(fe,$,P){"use strict";P.r($);var Y=P("./src/polyfills/number.ts"),U=P("./src/utils/ewma-bandwidth-estimator.ts"),O=P("./src/events.ts"),H=P("./src/utils/buffer-helper.ts"),N=P("./src/errors.ts"),k=P("./src/types/loader.ts"),L=P("./src/utils/logger.ts");function _(T,C){for(var S=0;S<C.length;S++){var f=C[S];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(T,f.key,f)}}function w(T,C,S){return C&&_(T.prototype,C),S&&_(T,S),T}var D=function(){function T(S){this.hls=void 0,this.lastLoadedFragLevel=0,this._nextAutoLevel=-1,this.timer=void 0,this.onCheck=this._abandonRulesCheck.bind(this),this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this.hls=S;var f=S.config;this.bwEstimator=new U.default(f.abrEwmaSlowVoD,f.abrEwmaFastVoD,f.abrEwmaDefaultEstimate),this.registerListeners()}var C=T.prototype;return C.registerListeners=function(){var f=this.hls;f.on(O.Events.FRAG_LOADING,this.onFragLoading,this),f.on(O.Events.FRAG_LOADED,this.onFragLoaded,this),f.on(O.Events.FRAG_BUFFERED,this.onFragBuffered,this),f.on(O.Events.LEVEL_LOADED,this.onLevelLoaded,this),f.on(O.Events.ERROR,this.onError,this)},C.unregisterListeners=function(){var f=this.hls;f.off(O.Events.FRAG_LOADING,this.onFragLoading,this),f.off(O.Events.FRAG_LOADED,this.onFragLoaded,this),f.off(O.Events.FRAG_BUFFERED,this.onFragBuffered,this),f.off(O.Events.LEVEL_LOADED,this.onLevelLoaded,this),f.off(O.Events.ERROR,this.onError,this)},C.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},C.onFragLoading=function(f,l){var i=l.frag;if(i.type===k.PlaylistLevelType.MAIN&&!this.timer){var c;this.fragCurrent=i,this.partCurrent=(c=l.part)!=null?c:null,this.timer=self.setInterval(this.onCheck,100)}},C.onLevelLoaded=function(f,l){var i=this.hls.config;l.details.live?this.bwEstimator.update(i.abrEwmaSlowLive,i.abrEwmaFastLive):this.bwEstimator.update(i.abrEwmaSlowVoD,i.abrEwmaFastVoD)},C._abandonRulesCheck=function(){var f=this.fragCurrent,l=this.partCurrent,i=this.hls,c=i.autoLevelEnabled,E=i.config,v=i.media;if(!f||!v)return;var p=l?l.stats:f.stats,u=l?l.duration:f.duration;if(p.aborted){L.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!c||v.paused||!v.playbackRate||!v.readyState)return;var y=performance.now()-p.loading.start,d=Math.abs(v.playbackRate);if(y<=500*u/d)return;var h=i.levels,s=i.minAutoLevel,a=h[f.level],g=p.total||Math.max(p.loaded,Math.round(u*a.maxBitrate/8)),m=Math.max(1,p.bwEstimate?p.bwEstimate/8:p.loaded*1e3/y),b=(g-p.loaded)/m,M=v.currentTime,K=(H.BufferHelper.bufferInfo(v,M,E.maxBufferHole).end-M)/d;if(K>=2*u/d||b<=K)return;var z=Number.POSITIVE_INFINITY,ee;for(ee=f.level-1;ee>s;ee--){var G=h[ee].maxBitrate;if(z=u*G/(8*.8*m),z<K)break}if(z>=b)return;var F=this.bwEstimator.getEstimate();L.logger.warn("Fragment "+f.sn+(l?" part "+l.index:"")+" of level "+f.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+ee+`
Current BW estimate: `+(Object(Y.isFiniteNumber)(F)?(F/1024).toFixed(3):"Unknown")+` Kb/s
Estimated load time for current fragment: `+b.toFixed(3)+` s
Estimated load time for the next fragment: `+z.toFixed(3)+` s
Time to underbuffer: `+K.toFixed(3)+" s"),i.nextLoadLevel=ee,this.bwEstimator.sample(y,p.loaded),this.clearTimer(),f.loader&&(this.fragCurrent=this.partCurrent=null,f.loader.abort()),i.trigger(O.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:f,part:l,stats:p})},C.onFragLoaded=function(f,l){var i=l.frag,c=l.part;if(i.type===k.PlaylistLevelType.MAIN&&Object(Y.isFiniteNumber)(i.sn)){var E=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 p=this.hls.levels[i.level],u=(p.loaded?p.loaded.bytes:0)+E.loaded,y=(p.loaded?p.loaded.duration:0)+v;p.loaded={bytes:u,duration:y},p.realBitrate=Math.round(8*u/y)}if(i.bitrateTest){var d={stats:E,frag:i,part:c,id:i.type};this.onFragBuffered(O.Events.FRAG_BUFFERED,d),i.bitrateTest=!1}}},C.onFragBuffered=function(f,l){var i=l.frag,c=l.part,E=c?c.stats:i.stats;if(E.aborted)return;if(i.type!==k.PlaylistLevelType.MAIN||i.sn==="initSegment")return;var v=E.parsing.end-E.loading.start;this.bwEstimator.sample(v,E.loaded),E.bwEstimate=this.bwEstimator.getEstimate(),i.bitrateTest?this.bitrateTestDelay=v/1e3:this.bitrateTestDelay=0},C.onError=function(f,l){switch(l.details){case N.ErrorDetails.FRAG_LOAD_ERROR:case N.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},C.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},C.getNextABRAutoLevel=function(){var f=this.fragCurrent,l=this.partCurrent,i=this.hls,c=i.maxAutoLevel,E=i.config,v=i.minAutoLevel,p=i.media,u=l?l.duration:f?f.duration:0,y=p?p.currentTime:0,d=p&&p.playbackRate!==0?Math.abs(p.playbackRate):1,h=this.bwEstimator?this.bwEstimator.getEstimate():E.abrEwmaDefaultEstimate,s=(H.BufferHelper.bufferInfo(p,y,E.maxBufferHole).end-y)/d,a=this.findBestLevel(h,v,c,s,E.abrBandWidthFactor,E.abrBandWidthUpFactor);if(a>=0)return a;L.logger.trace((s?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var g=u?Math.min(u,E.maxStarvationDelay):E.maxStarvationDelay,m=E.abrBandWidthFactor,b=E.abrBandWidthUpFactor;if(!s){var M=this.bitrateTestDelay;if(M){var K=u?Math.min(u,E.maxLoadingDelay):E.maxLoadingDelay;g=K-M,L.logger.trace("bitrate test took "+Math.round(1e3*M)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*g)+" ms"),m=b=1}}return a=this.findBestLevel(h,v,c,s+g,m,b),Math.max(a,0)},C.findBestLevel=function(f,l,i,c,E,v){for(var p,u=this.fragCurrent,y=this.partCurrent,d=this.lastLoadedFragLevel,h=this.hls.levels,s=h[d],a=!!(s!=null&&(p=s.details)!==null&&p!==void 0&&p.live),g=s==null?void 0:s.codecSet,m=y?y.duration:u?u.duration:0,b=i;b>=l;b--){var M=h[b];if(!M||g&&M.codecSet!==g)continue;var K=M.details,z=(y?K==null?void 0:K.partTarget:K==null?void 0:K.averagetargetduration)||m,ee=void 0;b<=d?ee=E*f:ee=v*f;var G=h[b].maxBitrate,F=G*z/ee;if(L.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+b+"/"+Math.round(ee)+"/"+G+"/"+z+"/"+c+"/"+F),ee>G&&(!F||a&&!this.bitrateTestDelay||F<c))return b}return-1},w(T,[{key:"nextAutoLevel",get:function(){var f=this._nextAutoLevel,l=this.bwEstimator;if(f!==-1&&(!l||!l.canEstimate()))return f;var i=this.getNextABRAutoLevel();return f!==-1&&(i=Math.min(f,i)),i},set:function(f){this._nextAutoLevel=f}}]),T}();$.default=D},"./src/controller/audio-stream-controller.ts":function(fe,$,P){"use strict";P.r($);var Y=P("./src/polyfills/number.ts"),U=P("./src/controller/base-stream-controller.ts"),O=P("./src/events.ts"),H=P("./src/utils/buffer-helper.ts"),N=P("./src/controller/fragment-tracker.ts"),k=P("./src/types/level.ts"),L=P("./src/types/loader.ts"),_=P("./src/loader/fragment.ts"),w=P("./src/demux/chunk-cache.ts"),D=P("./src/demux/transmuxer-interface.ts"),T=P("./src/types/transmuxer.ts"),C=P("./src/controller/fragment-finders.ts"),S=P("./src/utils/discontinuities.ts"),f=P("./src/errors.ts"),l=P("./src/utils/logger.ts");function i(){return i=Object.assign||function(u){for(var y=1;y<arguments.length;y++){var d=arguments[y];for(var h in d)Object.prototype.hasOwnProperty.call(d,h)&&(u[h]=d[h])}return u},i.apply(this,arguments)}function c(u,y){u.prototype=Object.create(y.prototype),u.prototype.constructor=u,E(u,y)}function E(u,y){return E=Object.setPrototypeOf||function(h,s){return h.__proto__=s,h},E(u,y)}var v=100,p=function(u){c(y,u);function y(h,s){var a;return a=u.call(this,h,s,"[audio-stream-controller]")||this,a.videoBuffer=null,a.videoTrackCC=-1,a.waitingVideoCC=-1,a.audioSwitch=!1,a.trackId=-1,a.waitingData=null,a.mainDetails=null,a.bufferFlushed=!1,a._registerListeners(),a}var d=y.prototype;return d.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},d._registerListeners=function(){var s=this.hls;s.on(O.Events.MEDIA_ATTACHED,this.onMediaAttached,this),s.on(O.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.on(O.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.on(O.Events.LEVEL_LOADED,this.onLevelLoaded,this),s.on(O.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),s.on(O.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),s.on(O.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),s.on(O.Events.ERROR,this.onError,this),s.on(O.Events.BUFFER_RESET,this.onBufferReset,this),s.on(O.Events.BUFFER_CREATED,this.onBufferCreated,this),s.on(O.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),s.on(O.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),s.on(O.Events.FRAG_BUFFERED,this.onFragBuffered,this)},d._unregisterListeners=function(){var s=this.hls;s.off(O.Events.MEDIA_ATTACHED,this.onMediaAttached,this),s.off(O.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.off(O.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.off(O.Events.LEVEL_LOADED,this.onLevelLoaded,this),s.off(O.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),s.off(O.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),s.off(O.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),s.off(O.Events.ERROR,this.onError,this),s.off(O.Events.BUFFER_RESET,this.onBufferReset,this),s.off(O.Events.BUFFER_CREATED,this.onBufferCreated,this),s.off(O.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),s.off(O.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),s.off(O.Events.FRAG_BUFFERED,this.onFragBuffered,this)},d.onInitPtsFound=function(s,a){var g=a.frag,m=a.id,b=a.initPTS;if(m==="main"){var M=g.cc;this.initPTS[g.cc]=b,this.log("InitPTS for cc: "+M+" found from main: "+b),this.videoTrackCC=M,this.state===U.State.WAITING_INIT_PTS&&this.tick()}},d.startLoad=function(s){if(!this.levels){this.startPosition=s,this.state=U.State.STOPPED;return}var a=this.lastCurrentTime;this.stopLoad(),this.setInterval(v),this.fragLoadError=0,a>0&&s===-1?(this.log("Override startPosition with lastCurrentTime @"+a.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,a=this.levels,g=this.trackId,m=a==null||((s=a[g])===null||s===void 0)?void 0:s.details;if(m){if(this.waitForCdnTuneIn(m))break;this.state=U.State.WAITING_INIT_PTS}break}case U.State.FRAG_LOADING_WAITING_RETRY:{var b,M=performance.now(),K=this.retryDate;(!K||M>=K||(b=this.media)!==null&&b!==void 0&&b.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 ee=z.frag,G=z.part,F=z.cache,ie=z.complete;if(this.initPTS[ee.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=U.State.FRAG_LOADING;var ge=F.flush(),ye={frag:ee,part:G,payload:ge,networkDetails:null};this._handleFragmentLoadProgress(ye),ie&&u.prototype._handleFragmentLoadComplete.call(this,ye)}else if(this.videoTrackCC!==this.waitingVideoCC)l.logger.log("Waiting fragment cc ("+ee.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var xe=this.getLoadPosition(),Te=H.BufferHelper.bufferInfo(this.mediaBuffer,xe,this.config.maxBufferHole),Se=Object(C.fragmentWithinToleranceTest)(Te.end,this.config.maxFragLookUpTolerance,ee);Se<0&&(l.logger.log("Waiting fragment cc ("+ee.cc+") @ "+ee.start+" cancelled because another fragment at "+Te.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 a=this.mediaBuffer?this.mediaBuffer:s,g=a.buffered;!this.loadedmetadata&&g.length&&(this.loadedmetadata=!0),this.lastCurrentTime=s.currentTime},d.doTickIdle=function(){var s,a,g=this.hls,m=this.levels,b=this.media,M=this.trackId,K=g.config;if(!m||!m[M])return;if(!b&&(this.startFragRequested||!K.startFragPrefetch))return;var z=m[M],ee=z.details;if(!ee||ee.live&&this.levelLastLoaded!==M||this.waitForCdnTuneIn(ee)){this.state=U.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,_.ElementaryStreamTypes.AUDIO,L.PlaylistLevelType.AUDIO));var G=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,L.PlaylistLevelType.AUDIO);if(G===null)return;var F=G.len,ie=this.getMaxBufferLength(),ge=this.audioSwitch;if(F>=ie&&!ge)return;if(!ge&&this._streamEnded(G,ee)){g.trigger(O.Events.BUFFER_EOS,{type:"audio"}),this.state=U.State.ENDED;return}var ye=ee.fragments,xe=ye[0].start,Te=G.end;if(ge){var Se=this.getLoadPosition();Te=Se,ee.PTSKnown&&Se<xe&&((G.end>xe||G.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),b.currentTime=xe+.05))}var me=this.getNextFragment(Te,ee);if(!me){this.bufferFlushed=!0;return}((s=me.decryptdata)===null||s===void 0?void 0:s.keyFormat)==="identity"&&!((a=me.decryptdata)!==null&&a!==void 0&&a.key)?this.loadKey(me,ee):this.loadFragment(me,ee,Te)},d.getMaxBufferLength=function(){var s=u.prototype.getMaxBufferLength.call(this),a=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,L.PlaylistLevelType.MAIN);return a===null?s:Math.max(s,a.len)},d.onMediaDetaching=function(){this.videoBuffer=null,u.prototype.onMediaDetaching.call(this)},d.onAudioTracksUpdated=function(s,a){var g=a.audioTracks;this.resetTransmuxer(),this.levels=g.map(function(m){return new k.Level(m)})},d.onAudioTrackSwitching=function(s,a){var g=!!a.url;this.trackId=a.id;var m=this.fragCurrent;m!=null&&m.loader&&m.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),g?this.setInterval(v):this.resetTransmuxer(),g?(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,a){this.mainDetails=a.details},d.onAudioTrackLoaded=function(s,a){var g,m=this.levels,b=a.details,M=a.id;if(!m){this.warn("Audio tracks were reset while loading level "+M);return}this.log("Track "+M+" loaded ["+b.startSN+","+b.endSN+"],duration:"+b.totalduration);var K=m[M],z=0;if(b.live||(g=K.details)!==null&&g!==void 0&&g.live){var ee=this.mainDetails;if(b.fragments[0]||(b.deltaUpdateFailed=!0),b.deltaUpdateFailed||!ee)return;!K.details&&b.hasProgramDateTime&&ee.hasProgramDateTime?(Object(S.alignMediaPlaylistByPDT)(b,ee),z=b.fragments[0].start):z=this.alignPlaylists(b,K.details)}K.details=b,this.levelLastLoaded=M,!this.startFragRequested&&(this.mainDetails||!b.live)&&this.setStartPosition(K.details,z),this.state===U.State.WAITING_TRACK&&!this.waitForCdnTuneIn(b)&&(this.state=U.State.IDLE),this.tick()},d._handleFragmentLoadProgress=function(s){var a,g=s.frag,m=s.part,b=s.payload,M=this.config,K=this.trackId,z=this.levels;if(!z){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+g.sn+" of level "+g.level+" will not be buffered");return}var ee=z[K];console.assert(ee,"Audio track is defined on fragment load progress");var G=ee.details;console.assert(G,"Audio track details are defined on fragment load progress");var F=M.defaultAudioCodec||ee.audioCodec||"mp4a.40.2",ie=this.transmuxer;ie||(ie=this.transmuxer=new D.default(this.hls,L.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var ge=this.initPTS[g.cc],ye=(a=g.initSegment)===null||a===void 0?void 0:a.data;if(ge!==void 0){var xe=!1,Te=m?m.index:-1,Se=Te!==-1,me=new T.ChunkMetadata(g.level,g.sn,g.stats.chunkCount,b.byteLength,Te,Se);ie.push(b,ye,F,"",g,m,G.totalduration,xe,me,ge)}else{l.logger.log("Unknown video PTS for cc "+g.cc+", waiting for video PTS before demuxing audio frag "+g.sn+" of ["+G.startSN+" ,"+G.endSN+"],track "+K);var pe=this.waitingData=this.waitingData||{frag:g,part:m,cache:new w.default,complete:!1},Ee=pe.cache;Ee.push(new Uint8Array(b)),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,a){var g=a.tracks.audio;g&&(this.mediaBuffer=g.buffer),a.tracks.video&&(this.videoBuffer=a.tracks.video.buffer)},d.onFragBuffered=function(s,a){var g=a.frag,m=a.part;if(g.type!==L.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(g)){this.warn("Fragment "+g.sn+(m?" p: "+m.index:"")+" of level "+g.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}g.sn!=="initSegment"&&(this.fragPrevious=g,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(O.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(g,m)},d.onError=function(s,a){switch(a.details){case f.ErrorDetails.FRAG_LOAD_ERROR:case f.ErrorDetails.FRAG_LOAD_TIMEOUT:case f.ErrorDetails.KEY_LOAD_ERROR:case f.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(L.PlaylistLevelType.AUDIO,a);break;case f.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case f.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==U.State.ERROR&&this.state!==U.State.STOPPED&&(this.state=a.fatal?U.State.ERROR:U.State.IDLE,this.warn(a.details+" while loading frag, switching to "+this.state+" state"));break;case f.ErrorDetails.BUFFER_FULL_ERROR:if(a.parent==="audio"&&(this.state===U.State.PARSING||this.state===U.State.PARSED)){var g=!0,m=this.getFwdBufferInfo(this.mediaBuffer,L.PlaylistLevelType.AUDIO);m&&m.len>.5&&(g=!this.reduceMaxBufferLength(m.len)),g&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,u.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},d.onBufferFlushed=function(s,a){var g=a.type;g===_.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},d._handleTransmuxComplete=function(s){var a,g="audio",m=this.hls,b=s.remuxResult,M=s.chunkMeta,K=this.getCurrentContext(M);if(!K){this.warn("The loading context changed while buffering fragment "+M.sn+" of level "+M.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(M.level);return}var z=K.frag,ee=K.part,G=b.audio,F=b.text,ie=b.id3,ge=b.initSegment;if(this.fragContextChanged(z))return;if(this.state=U.State.PARSING,this.audioSwitch&&G&&this.completeAudioSwitch(),ge!=null&&ge.tracks&&(this._bufferInitSegment(ge.tracks,z,M),m.trigger(O.Events.FRAG_PARSING_INIT_SEGMENT,{frag:z,id:g,tracks:ge.tracks})),G){var ye=G.startPTS,xe=G.endPTS,Te=G.startDTS,Se=G.endDTS;ee&&(ee.elementaryStreams[_.ElementaryStreamTypes.AUDIO]={startPTS:ye,endPTS:xe,startDTS:Te,endDTS:Se}),z.setElementaryStreamInfo(_.ElementaryStreamTypes.AUDIO,ye,xe,Te,Se),this.bufferFragmentData(G,z,ee,M)}if(ie!=null&&(a=ie.samples)!==null&&a!==void 0&&a.length){var me=i({frag:z,id:g},ie);m.trigger(O.Events.FRAG_PARSING_METADATA,me)}if(F){var pe=i({frag:z,id:g},F);m.trigger(O.Events.FRAG_PARSING_USERDATA,pe)}},d._bufferInitSegment=function(s,a,g){if(this.state!==U.State.PARSING)return;s.video&&delete s.video;var m=s.audio;if(!m)return;m.levelCodec=m.codec,m.id="audio",this.log("Init audio buffer, container:"+m.container+", codecs[parsed]=["+m.codec+"]"),this.hls.trigger(O.Events.BUFFER_CODECS,s);var b=m.initSegment;if(b!=null&&b.byteLength){var M={type:"audio",frag:a,part:null,chunkMeta:g,parent:a.type,data:b};this.hls.trigger(O.Events.BUFFER_APPENDING,M)}this.tick()},d.loadFragment=function(s,a,g){var m=this.fragmentTracker.getState(s);this.fragCurrent=s,(this.audioSwitch||m===N.FragmentState.NOT_LOADED||m===N.FragmentState.PARTIAL)&&(s.sn==="initSegment"?this._loadInitSegment(s):a.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,a,g)))},d.completeAudioSwitch=function(){var s=this.hls,a=this.media,g=this.trackId;a&&(this.log("Switching audio track : flushing all audio"),u.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,s.trigger(O.Events.AUDIO_TRACK_SWITCHED,{id:g})},y}(U.default);$.default=p},"./src/controller/audio-track-controller.ts":function(fe,$,P){"use strict";P.r($);var Y=P("./src/events.ts"),U=P("./src/errors.ts"),O=P("./src/controller/base-playlist-controller.ts"),H=P("./src/types/loader.ts");function N(D,T){for(var C=0;C<T.length;C++){var S=T[C];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(D,S.key,S)}}function k(D,T,C){return T&&N(D.prototype,T),C&&N(D,C),D}function L(D,T){D.prototype=Object.create(T.prototype),D.prototype.constructor=D,_(D,T)}function _(D,T){return _=Object.setPrototypeOf||function(S,f){return S.__proto__=f,S},_(D,T)}var w=function(D){L(T,D);function T(S){var f;return f=D.call(this,S,"[audio-track-controller]")||this,f.tracks=[],f.groupId=null,f.tracksInGroup=[],f.trackId=-1,f.trackName="",f.selectDefaultTrack=!0,f.registerListeners(),f}var C=T.prototype;return C.registerListeners=function(){var f=this.hls;f.on(Y.Events.MANIFEST_LOADING,this.onManifestLoading,this),f.on(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this),f.on(Y.Events.LEVEL_LOADING,this.onLevelLoading,this),f.on(Y.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),f.on(Y.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),f.on(Y.Events.ERROR,this.onError,this)},C.unregisterListeners=function(){var f=this.hls;f.off(Y.Events.MANIFEST_LOADING,this.onManifestLoading,this),f.off(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this),f.off(Y.Events.LEVEL_LOADING,this.onLevelLoading,this),f.off(Y.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),f.off(Y.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),f.off(Y.Events.ERROR,this.onError,this)},C.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,D.prototype.destroy.call(this)},C.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},C.onManifestParsed=function(f,l){this.tracks=l.audioTracks||[]},C.onAudioTrackLoaded=function(f,l){var i=l.id,c=l.details,E=this.tracksInGroup[i];if(!E){this.warn("Invalid audio track id "+i);return}var v=E.details;E.details=l.details,this.log("audioTrack "+i+" loaded ["+c.startSN+"-"+c.endSN+"]"),i===this.trackId&&(this.retryCount=0,this.playlistLoaded(i,l,v))},C.onLevelLoading=function(f,l){this.switchLevel(l.level)},C.onLevelSwitching=function(f,l){this.switchLevel(l.level)},C.switchLevel=function(f){var l=this.hls.levels[f];if(!(l!=null&&l.audioGroupIds))return;var i=l.audioGroupIds[l.urlId];if(this.groupId!==i){this.groupId=i;var c=this.tracks.filter(function(v){return!i||v.groupId===i});this.selectDefaultTrack&&!c.some(function(v){return v.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=c;var E={audioTracks:c};this.log("Updating audio tracks, "+c.length+' track(s) found in "'+i+'" group-id'),this.hls.trigger(Y.Events.AUDIO_TRACKS_UPDATED,E),this.selectInitialTrack()}},C.onError=function(f,l){if(D.prototype.onError.call(this,f,l),l.fatal||!l.context)return;l.context.type===H.PlaylistContextType.AUDIO_TRACK&&l.context.id===this.trackId&&l.context.groupId===this.groupId&&this.retryLoadingOrFail(l)},C.setAudioTrack=function(f){var l=this.tracksInGroup;if(f<0||f>=l.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var i=l[this.trackId];this.log("Now switching to audio-track index "+f);var c=l[f],E=c.id,v=c.groupId,p=v===void 0?"":v,u=c.name,y=c.type,d=c.url;if(this.trackId=f,this.trackName=u,this.selectDefaultTrack=!1,this.hls.trigger(Y.Events.AUDIO_TRACK_SWITCHING,{id:E,groupId:p,name:u,type:y,url:d}),c.details&&!c.details.live)return;var h=this.switchParams(c.url,i==null?void 0:i.details);this.loadPlaylist(h)},C.selectInitialTrack=function(){var f=this.tracksInGroup;console.assert(f.length,"Initial audio track should be selected when tracks are known");var l=this.trackName,i=this.findTrackId(l)||this.findTrackId();i!==-1?this.setAudioTrack(i):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(Y.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},C.findTrackId=function(f){for(var l=this.tracksInGroup,i=0;i<l.length;i++){var c=l[i];if((!this.selectDefaultTrack||c.default)&&(!f||f===c.name))return c.id}return-1},C.loadPlaylist=function(f){var l=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(l)){var i=l.id,c=l.groupId,E=l.url;if(f)try{E=f.addDirectives(E)}catch(v){this.warn("Could not construct new URL with HLS Delivery Directives: "+v)}this.log("loading audio-track playlist for id: "+i),this.clearTimer(),this.hls.trigger(Y.Events.AUDIO_TRACK_LOADING,{url:E,id:i,groupId:c,deliveryDirectives:f||null})}},k(T,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(f){this.selectDefaultTrack=!1,this.setAudioTrack(f)}}]),T}(O.default);$.default=w},"./src/controller/base-playlist-controller.ts":function(fe,$,P){"use strict";P.r($),P.d($,"default",function(){return k});var Y=P("./src/polyfills/number.ts"),U=P("./src/types/level.ts"),O=P("./src/controller/level-helper.ts"),H=P("./src/utils/logger.ts"),N=P("./src/errors.ts"),k=function(){function L(w,D){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=H.logger.log.bind(H.logger,D+":"),this.warn=H.logger.warn.bind(H.logger,D+":"),this.hls=w}var _=L.prototype;return _.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},_.onError=function(D,T){T.fatal&&T.type===N.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},_.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},_.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},_.stopLoad=function(){this.canLoad=!1,this.clearTimer()},_.switchParams=function(D,T){var C=T==null?void 0:T.renditionReports;if(C)for(var S=0;S<C.length;S++){var f=C[S],l=""+f.URI;if(l===D.substr(-l.length)){var i=parseInt(f["LAST-MSN"]),c=parseInt(f["LAST-PART"]);if(T&&this.hls.config.lowLatencyMode){var E=Math.min(T.age-T.partTarget,T.targetduration);c!==void 0&&E>T.partTarget&&(c+=1)}if(Object(Y.isFiniteNumber)(i))return new U.HlsUrlParameters(i,Object(Y.isFiniteNumber)(c)?c:void 0,U.HlsSkip.No)}}},_.loadPlaylist=function(D){},_.shouldLoadTrack=function(D){return this.canLoad&&D&&!!D.url&&(!D.details||D.details.live)},_.playlistLoaded=function(D,T,C){var S=this,f=T.details,l=T.stats,i=l.loading.end?Math.max(0,self.performance.now()-l.loading.end):0;if(f.advancedDateTime=Date.now()-i,f.live||C!=null&&C.live){if(f.reloaded(C),C&&this.log("live playlist "+D+" "+(f.advanced?"REFRESHED "+f.lastPartSn+"-"+f.lastPartIndex:"MISSED")),C&&f.fragments.length>0&&Object(O.mergeDetails)(C,f),!this.canLoad||!f.live)return;var c,E=void 0,v=void 0;if(f.canBlockReload&&f.endSN&&f.advanced){var p=this.hls.config.lowLatencyMode,u=f.lastPartSn,y=f.endSN,d=f.lastPartIndex,h=d!==-1,s=u===y,a=p?0:d;h?(E=s?y+1:u,v=s?a:d+1):E=y+1;var g=f.age,m=g+f.ageHeader,b=Math.min(m-f.partTarget,f.targetduration*1.5);if(b>0){if(C&&b>C.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+C.tuneInGoal+" to: "+b+" with playlist age: "+f.age),b=0;else{var M=Math.floor(b/f.targetduration);if(E+=M,v!==void 0){var K=Math.round(b%f.targetduration/f.partTarget);v+=K}this.log("CDN Tune-in age: "+f.ageHeader+"s last advanced "+g.toFixed(2)+"s goal: "+b+" skip sn "+M+" to part "+v)}f.tuneInGoal=b}if(c=this.getDeliveryDirectives(f,T.deliveryDirectives,E,v),p||!s){this.loadPlaylist(c);return}}else c=this.getDeliveryDirectives(f,T.deliveryDirectives,E,v);var z=Object(O.computeReloadInterval)(f,l);E!==void 0&&f.canBlockReload&&(z-=f.partTarget||1),this.log("reload live playlist "+D+" in "+Math.round(z)+" ms"),this.timer=self.setTimeout(function(){return S.loadPlaylist(c)},z)}else this.clearTimer()},_.getDeliveryDirectives=function(D,T,C,S){var f=Object(U.getSkipValue)(D,C);return T!=null&&T.skip&&D.deltaUpdateFailed&&(C=T.msn,S=T.part,f=U.HlsSkip.No),new U.HlsUrlParameters(C,S,f)},_.retryLoadingOrFail=function(D){var T=this,C=this.hls.config,S=this.retryCount<C.levelLoadingMaxRetry;if(S){var f;if(this.retryCount++,D.details.indexOf("LoadTimeOut")>-1&&(f=D.context)!==null&&f!==void 0&&f.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+D.details+'"'),this.loadPlaylist();else{var l=Math.min(Math.pow(2,this.retryCount)*C.levelLoadingRetryDelay,C.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return T.loadPlaylist()},l),this.warn("retry playlist loading #"+this.retryCount+" in "+l+' ms after "'+D.details+'"')}}else this.warn('cannot recover from error "'+D.details+'"'),this.clearTimer(),D.fatal=!0;return S},L}()},"./src/controller/base-stream-controller.ts":function(fe,$,P){"use strict";P.r($),P.d($,"State",function(){return y}),P.d($,"default",function(){return d});var Y=P("./src/polyfills/number.ts"),U=P("./src/task-loop.ts"),O=P("./src/controller/fragment-tracker.ts"),H=P("./src/utils/buffer-helper.ts"),N=P("./src/utils/logger.ts"),k=P("./src/events.ts"),L=P("./src/errors.ts"),_=P("./src/types/transmuxer.ts"),w=P("./src/utils/mp4-tools.ts"),D=P("./src/utils/discontinuities.ts"),T=P("./src/controller/fragment-finders.ts"),C=P("./src/controller/level-helper.ts"),S=P("./src/loader/fragment-loader.ts"),f=P("./src/crypt/decrypter.ts"),l=P("./src/utils/time-ranges.ts"),i=P("./src/types/loader.ts");function c(h,s){for(var a=0;a<s.length;a++){var g=s[a];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(h,g.key,g)}}function E(h,s,a){return s&&c(h.prototype,s),a&&c(h,a),h}function v(h){if(h===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return h}function p(h,s){h.prototype=Object.create(s.prototype),h.prototype.constructor=h,u(h,s)}function u(h,s){return u=Object.setPrototypeOf||function(g,m){return g.__proto__=m,g},u(h,s)}var y={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",BACKTRACKING:"BACKTRACKING",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"},d=function(h){p(s,h);function s(g,m,b){var M;return M=h.call(this)||this,M.hls=void 0,M.fragPrevious=null,M.fragCurrent=null,M.fragmentTracker=void 0,M.transmuxer=null,M._state=y.STOPPED,M.media=void 0,M.mediaBuffer=void 0,M.config=void 0,M.bitrateTest=!1,M.lastCurrentTime=0,M.nextLoadPosition=0,M.startPosition=0,M.loadedmetadata=!1,M.fragLoadError=0,M.retryDate=0,M.levels=null,M.fragmentLoader=void 0,M.levelLastLoaded=null,M.startFragRequested=!1,M.decrypter=void 0,M.initPTS=[],M.onvseeking=null,M.onvended=null,M.logPrefix="",M.log=void 0,M.warn=void 0,M.logPrefix=b,M.log=N.logger.log.bind(N.logger,b+":"),M.warn=N.logger.warn.bind(N.logger,b+":"),M.hls=g,M.fragmentLoader=new S.default(g.config),M.fragmentTracker=m,M.config=g.config,M.decrypter=new f.default(g,g.config),g.on(k.Events.KEY_LOADED,M.onKeyLoaded,v(M)),M}var a=s.prototype;return a.doTick=function(){this.onTickEnd()},a.onTickEnd=function(){},a.startLoad=function(m){},a.stopLoad=function(){this.fragmentLoader.abort();var m=this.fragCurrent;m&&this.fragmentTracker.removeFragment(m),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=y.STOPPED},a._streamEnded=function(m,b){var M=this.fragCurrent,K=this.fragmentTracker;if(!b.live&&M&&M.sn===b.endSN&&!m.nextStart){var z=K.getState(M);return z===O.FragmentState.PARTIAL||z===O.FragmentState.OK}return!1},a.onMediaAttached=function(m,b){var M=this.media=this.mediaBuffer=b.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),M.addEventListener("seeking",this.onvseeking),M.addEventListener("ended",this.onvended);var K=this.config;this.levels&&K.autoStartLoad&&this.state===y.STOPPED&&this.startLoad(K.startPosition)},a.onMediaDetaching=function(){var m=this.media;m!=null&&m.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),m&&(m.removeEventListener("seeking",this.onvseeking),m.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},a.onMediaSeeking=function(){var m=this.config,b=this.fragCurrent,M=this.media,K=this.mediaBuffer,z=this.state,ee=M?M.currentTime:0,G=H.BufferHelper.bufferInfo(K||M,ee,m.maxBufferHole);if(this.log("media seeking to "+(Object(Y.isFiniteNumber)(ee)?ee.toFixed(3):ee)+", state: "+z),z===y.ENDED)this.resetLoadingState();else if(b&&!G.len){var F=m.maxFragLookUpTolerance,ie=b.start-F,ge=b.start+b.duration+F,ye=ee>ge;(ee<ie||ye)&&(ye&&b.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),b.loader.abort()),this.resetLoadingState())}M&&(this.lastCurrentTime=ee),!this.loadedmetadata&&!G.len&&(this.nextLoadPosition=this.startPosition=ee),this.tickImmediate()},a.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},a.onKeyLoaded=function(m,b){if(this.state!==y.KEY_LOADING||b.frag!==this.fragCurrent||!this.levels)return;this.state=y.IDLE;var M=this.levels[b.frag.level].details;M&&this.loadFragment(b.frag,M,b.frag.start)},a.onHandlerDestroying=function(){this.stopLoad(),h.prototype.onHandlerDestroying.call(this)},a.onHandlerDestroyed=function(){this.state=y.STOPPED,this.hls.off(k.Events.KEY_LOADED,this.onKeyLoaded,this),this.fragmentLoader&&this.fragmentLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.fragmentLoader=this.fragmentTracker=null,h.prototype.onHandlerDestroyed.call(this)},a.loadKey=function(m,b){this.log("Loading key for "+m.sn+" of ["+b.startSN+"-"+b.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+m.level),this.state=y.KEY_LOADING,this.fragCurrent=m,this.hls.trigger(k.Events.KEY_LOADING,{frag:m})},a.loadFragment=function(m,b,M){this._loadFragForPlayback(m,b,M)},a._loadFragForPlayback=function(m,b,M){var K=this,z=function(G){if(K.fragContextChanged(m)){K.warn("Fragment "+m.sn+(G.part?" p: "+G.part.index:"")+" of level "+m.level+" was dropped during download."),K.fragmentTracker.removeFragment(m);return}m.stats.chunkCount++,K._handleFragmentLoadProgress(G)};this._doFragLoad(m,b,M,z).then(function(ee){if(!ee)return;K.fragLoadError=0;var G=K.state;if(K.fragContextChanged(m)){(G===y.FRAG_LOADING||G===y.BACKTRACKING||!K.fragCurrent&&G===y.PARSING)&&(K.fragmentTracker.removeFragment(m),K.state=y.IDLE);return}if("payload"in ee&&(K.log("Loaded fragment "+m.sn+" of level "+m.level),K.hls.trigger(k.Events.FRAG_LOADED,ee),K.state===y.BACKTRACKING)){K.fragmentTracker.backtrack(m,ee),K.resetFragmentLoading(m);return}K._handleFragmentLoadComplete(ee)}).catch(function(ee){K.warn(ee),K.resetFragmentLoading(m)})},a.flushMainBuffer=function(m,b,M){if(M===void 0&&(M=null),!(m-b))return;var K={startOffset:m,endOffset:b,type:M};this.fragLoadError=0,this.hls.trigger(k.Events.BUFFER_FLUSHING,K)},a._loadInitSegment=function(m){var b=this;this._doFragLoad(m).then(function(M){if(!M||b.fragContextChanged(m)||!b.levels)throw new Error("init load aborted");return M}).then(function(M){var K=b.hls,z=M.payload,ee=m.decryptdata;if(z&&z.byteLength>0&&ee&&ee.key&&ee.iv&&ee.method==="AES-128"){var G=self.performance.now();return b.decrypter.webCryptoDecrypt(new Uint8Array(z),ee.key.buffer,ee.iv.buffer).then(function(F){var ie=self.performance.now();return K.trigger(k.Events.FRAG_DECRYPTED,{frag:m,payload:F,stats:{tstart:G,tdecrypt:ie}}),M.payload=F,M})}return M}).then(function(M){var K=b.fragCurrent,z=b.hls,ee=b.levels;if(!ee)throw new Error("init load aborted, missing levels");var G=ee[m.level].details;console.assert(G,"Level details are defined when init segment is loaded");var F=m.stats;b.state=y.IDLE,b.fragLoadError=0,m.data=new Uint8Array(M.payload),F.parsing.start=F.buffering.start=self.performance.now(),F.parsing.end=F.buffering.end=self.performance.now(),M.frag===K&&z.trigger(k.Events.FRAG_BUFFERED,{stats:F,frag:K,part:null,id:m.type}),b.tick()}).catch(function(M){b.warn(M),b.resetFragmentLoading(m)})},a.fragContextChanged=function(m){var b=this.fragCurrent;return!m||!b||m.level!==b.level||m.sn!==b.sn||m.urlId!==b.urlId},a.fragBufferedComplete=function(m,b){var M=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+m.type+" sn: "+m.sn+(b?" part: "+b.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+m.level+" "+l.default.toString(H.BufferHelper.getBuffered(M))),this.state=y.IDLE,this.tick()},a._handleFragmentLoadComplete=function(m){var b=this.transmuxer;if(!b)return;var M=m.frag,K=m.part,z=m.partsLoaded,ee=!z||z.length===0||z.some(function(F){return!F}),G=new _.ChunkMetadata(M.level,M.sn,M.stats.chunkCount+1,0,K?K.index:-1,!ee);b.flush(G)},a._handleFragmentLoadProgress=function(m){},a._doFragLoad=function(m,b,M,K){var z=this;if(M===void 0&&(M=null),!this.levels)throw new Error("frag load aborted, missing levels");if(M=Math.max(m.start,M||0),this.config.lowLatencyMode&&b){var ee=b.partList;if(ee&&K){M>m.end&&b.fragmentHint&&(m=b.fragmentHint);var G=this.getNextPart(ee,m,M);if(G>-1){var F=ee[G];return this.log("Loading part sn: "+m.sn+" p: "+F.index+" cc: "+m.cc+" of playlist ["+b.startSN+"-"+b.endSN+"] parts [0-"+G+"-"+(ee.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+m.level+", target: "+parseFloat(M.toFixed(3))),this.nextLoadPosition=F.start+F.duration,this.state=y.FRAG_LOADING,this.hls.trigger(k.Events.FRAG_LOADING,{frag:m,part:ee[G],targetBufferTime:M}),this.doFragPartsLoad(m,ee,G,K).catch(function(ie){return z.handleFragLoadError(ie)})}else if(!m.url||this.loadedEndOfParts(ee,M))return Promise.resolve(null)}}return this.log("Loading fragment "+m.sn+" cc: "+m.cc+" "+(b?"of ["+b.startSN+"-"+b.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+m.level+", target: "+parseFloat(M.toFixed(3))),Object(Y.isFiniteNumber)(m.sn)&&!this.bitrateTest&&(this.nextLoadPosition=m.start+m.duration),this.state=y.FRAG_LOADING,this.hls.trigger(k.Events.FRAG_LOADING,{frag:m,targetBufferTime:M}),this.fragmentLoader.load(m,K).catch(function(ie){return z.handleFragLoadError(ie)})},a.doFragPartsLoad=function(m,b,M,K){var z=this;return new Promise(function(ee,G){var F=[],ie=function ge(ye){var xe=b[ye];z.fragmentLoader.loadPart(m,xe,K).then(function(Te){F[xe.index]=Te;var Se=Te.part;z.hls.trigger(k.Events.FRAG_LOADED,Te);var me=b[ye+1];if(me&&me.fragment===m)ge(ye+1);else return ee({frag:m,part:Se,partsLoaded:F})}).catch(G)};ie(M)})},a.handleFragLoadError=function(m){var b=m.data;return b&&b.details===L.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(b.frag,b.part):this.hls.trigger(k.Events.ERROR,b),null},a._handleTransmuxerFlush=function(m){var b=this.getCurrentContext(m);if(!b||this.state!==y.PARSING){this.fragCurrent||(this.state=y.IDLE);return}var M=b.frag,K=b.part,z=b.level,ee=self.performance.now();M.stats.parsing.end=ee,K&&(K.stats.parsing.end=ee),this.updateLevelTiming(M,K,z,m.partial)},a.getCurrentContext=function(m){var b=this.levels,M=m.level,K=m.sn,z=m.part;if(!b||!b[M])return this.warn("Levels object was unset while buffering fragment "+K+" of level "+M+". The current chunk will not be buffered."),null;var ee=b[M],G=z>-1?Object(C.getPartWith)(ee,K,z):null,F=G?G.fragment:Object(C.getFragmentWithSN)(ee,K,this.fragCurrent);return F?{frag:F,part:G,level:ee}:null},a.bufferFragmentData=function(m,b,M,K){if(!m||this.state!==y.PARSING)return;var z=m.data1,ee=m.data2,G=z;if(z&&ee&&(G=Object(w.appendUint8Array)(z,ee)),!G||!G.length)return;var F={type:m.type,frag:b,part:M,chunkMeta:K,parent:b.type,data:G};this.hls.trigger(k.Events.BUFFER_APPENDING,F),m.dropped&&m.independent&&!M&&this.flushBufferGap(b)},a.flushBufferGap=function(m){var b=this.media;if(!b)return;if(!H.BufferHelper.isBuffered(b,b.currentTime)){this.flushMainBuffer(0,m.start);return}var M=b.currentTime,K=H.BufferHelper.bufferInfo(b,M,0),z=m.duration,ee=Math.min(this.config.maxFragLookUpTolerance*2,z*.25),G=Math.max(Math.min(m.start-ee,K.end-ee),M+ee);m.start-G>ee&&this.flushMainBuffer(G,m.start)},a.getFwdBufferInfo=function(m,b){var M=this.config,K=this.getLoadPosition();if(!Object(Y.isFiniteNumber)(K))return null;var z=H.BufferHelper.bufferInfo(m,K,M.maxBufferHole);if(z.len===0&&z.nextStart!==void 0){var ee=this.fragmentTracker.getBufferedFrag(K,b);if(ee&&z.nextStart<ee.end)return H.BufferHelper.bufferInfo(m,K,Math.max(z.nextStart,M.maxBufferHole))}return z},a.getMaxBufferLength=function(m){var b=this.config,M;return m?M=Math.max(8*b.maxBufferSize/m,b.maxBufferLength):M=b.maxBufferLength,Math.min(M,b.maxMaxBufferLength)},a.reduceMaxBufferLength=function(m){var b=this.config,M=m||b.maxBufferLength;return b.maxMaxBufferLength>=M?(b.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+b.maxMaxBufferLength+"s"),!0):!1},a.getNextFragment=function(m,b){var M,K,z=b.fragments,ee=z.length;if(!ee)return null;var G=this.config,F=z[0].start,ie;if(b.live){var ge=G.initialLiveManifestSize;if(ee<ge)return this.warn("Not enough fragments to start playback (have: "+ee+", need: "+ge+")"),null;!b.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(ie=this.getInitialLiveFragment(b,z),this.startPosition=ie?this.hls.liveSyncPosition||ie.start:m)}else m<=F&&(ie=z[0]);if(!ie){var ye=G.lowLatencyMode?b.partEnd:b.fragmentEnd;ie=this.getFragmentAtPosition(m,ye,b)}return(M=ie)!==null&&M!==void 0&&M.initSegment&&!((K=ie)!==null&&K!==void 0&&K.initSegment.data)&&!this.bitrateTest&&(ie=ie.initSegment),ie},a.getNextPart=function(m,b,M){for(var K=-1,z=!1,ee=!0,G=0,F=m.length;G<F;G++){var ie=m[G];if(ee=ee&&!ie.independent,K>-1&&M<ie.start)break;var ge=ie.loaded;!ge&&(z||ie.independent||ee)&&ie.fragment===b&&(K=G),z=ge}return K},a.loadedEndOfParts=function(m,b){var M=m[m.length-1];return M&&b>M.start&&M.loaded},a.getInitialLiveFragment=function(m,b){var M=this.fragPrevious,K=null;if(M){if(m.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+M.programDateTime),K=Object(T.findFragmentByPDT)(b,M.endProgramDateTime,this.config.maxFragLookUpTolerance)),!K){var z=M.sn+1;if(z>=m.startSN&&z<=m.endSN){var ee=b[z-m.startSN];M.cc===ee.cc&&(K=ee,this.log("Live playlist, switching playlist, load frag with next SN: "+K.sn))}K||(K=Object(T.findFragWithCC)(b,M.cc),K&&this.log("Live playlist, switching playlist, load frag with same CC: "+K.sn))}}else{var G=this.hls.liveSyncPosition;G!==null&&(K=this.getFragmentAtPosition(G,this.bitrateTest?m.fragmentEnd:m.edge,m))}return K},a.getFragmentAtPosition=function(m,b,M){var K=this.config,z=this.fragPrevious,ee=M.fragments,G=M.endSN,F=M.fragmentHint,ie=K.maxFragLookUpTolerance,ge=!!(K.lowLatencyMode&&M.partList&&F);ge&&F&&!this.bitrateTest&&(ee=ee.concat(F),G=F.sn);var ye;if(m<b){var xe=m>b-ie?0:ie;ye=Object(T.findFragmentByPTS)(z,ee,m,xe)}else ye=ee[ee.length-1];if(ye){var Te=ye.sn-M.startSN,Se=z&&ye.level===z.level,me=ee[Te+1],pe=this.fragmentTracker.getState(ye);if(pe===O.FragmentState.BACKTRACKED){ye=null;for(var Ee=Te;ee[Ee]&&this.fragmentTracker.getState(ee[Ee])===O.FragmentState.BACKTRACKED;)z?ye=ee[Ee--]:ye=ee[--Ee];ye||(ye=me)}else z&&ye.sn===z.sn&&!ge&&(Se&&(ye.sn<G&&this.fragmentTracker.getState(me)!==O.FragmentState.OK?(this.log("SN "+ye.sn+" just loaded, load next one: "+me.sn),ye=me):ye=null))}return ye},a.synchronizeToLiveEdge=function(m){var b=this.config,M=this.media;if(!M)return;var K=this.hls.liveSyncPosition,z=M.currentTime,ee=m.fragments[0].start,G=m.edge,F=z>=ee-b.maxFragLookUpTolerance&&z<=G;if(K!==null&&M.duration>K&&(z<K||!F)){var ie=b.liveMaxLatencyDuration!==void 0?b.liveMaxLatencyDuration:b.liveMaxLatencyDurationCount*m.targetduration;(!F&&M.readyState<4||z<G-ie)&&(this.loadedmetadata||(this.nextLoadPosition=K),M.readyState&&(this.warn("Playback: "+z.toFixed(3)+" is located too far from the end of live sliding playlist: "+G+", reset currentTime to : "+K.toFixed(3)),M.currentTime=K))}},a.alignPlaylists=function(m,b){var M=this.levels,K=this.levelLastLoaded,z=this.fragPrevious,ee=K!==null?M[K]:null,G=m.fragments.length;if(!G)return this.warn("No fragments in live playlist"),0;var F=m.fragments[0].start,ie=!b,ge=m.alignedSliding&&Object(Y.isFiniteNumber)(F);if(ie||!ge&&!F){Object(D.alignStream)(z,ee,m);var ye=m.fragments[0].start;return this.log("Live playlist sliding: "+ye.toFixed(2)+" start-sn: "+(b?b.startSN:"na")+"->"+m.startSN+" prev-sn: "+(z?z.sn:"na")+" fragments: "+G),ye}return F},a.waitForCdnTuneIn=function(m){var b=3;return m.live&&m.canBlockReload&&m.tuneInGoal>Math.max(m.partHoldBack,m.partTarget*b)},a.setStartPosition=function(m,b){var M=this.startPosition;if(M<b&&(M=-1),M===-1||this.lastCurrentTime===-1){var K=m.startTimeOffset;Object(Y.isFiniteNumber)(K)?(M=b+K,K<0&&(M+=m.totalduration),M=Math.min(Math.max(b,M),b+m.totalduration),this.log("Start time offset "+K+" found in playlist, adjust startPosition to "+M),this.startPosition=M):m.live?M=this.hls.liveSyncPosition||b:this.startPosition=M=0,this.lastCurrentTime=M}this.nextLoadPosition=M},a.getLoadPosition=function(){var m=this.media,b=0;return this.loadedmetadata&&m?b=m.currentTime:this.nextLoadPosition&&(b=this.nextLoadPosition),b},a.handleFragLoadAborted=function(m,b){this.transmuxer&&m.sn!=="initSegment"&&m.stats.aborted&&(this.warn("Fragment "+m.sn+(b?" part"+b.index:"")+" of level "+m.level+" was aborted"),this.resetFragmentLoading(m))},a.resetFragmentLoading=function(m){(!this.fragCurrent||!this.fragContextChanged(m))&&(this.state=y.IDLE)},a.onFragmentOrKeyLoadError=function(m,b){if(b.fatal)return;var M=b.frag;if(!M||M.type!==m)return;var K=this.fragCurrent;console.assert(K&&M.sn===K.sn&&M.level===K.level&&M.urlId===K.urlId,"Frag load error must match current frag to retry");var z=this.config;if(this.fragLoadError+1<=z.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(M.level))return;var ee=Math.min(Math.pow(2,this.fragLoadError)*z.fragLoadingRetryDelay,z.fragLoadingMaxRetryTimeout);this.warn("Fragment "+M.sn+" of "+m+" "+M.level+" failed to load, retrying in "+ee+"ms"),this.retryDate=self.performance.now()+ee,this.fragLoadError++,this.state=y.FRAG_LOADING_WAITING_RETRY}else b.levelRetry?(m===i.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=y.IDLE):(N.logger.error(b.details+" reaches max retry, redispatch as fatal ..."),b.fatal=!0,this.hls.stopLoad(),this.state=y.ERROR)},a.afterBufferFlushed=function(m,b,M){if(!m)return;var K=H.BufferHelper.getBuffered(m);this.fragmentTracker.detectEvictedFragments(b,K,M),this.state===y.ENDED&&this.resetLoadingState()},a.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=y.IDLE},a.resetLiveStartWhenNotLoaded=function(m){if(!this.loadedmetadata){this.startFragRequested=!1;var b=this.levels?this.levels[m].details:null;if(b!=null&&b.live)return this.startPosition=-1,this.setStartPosition(b,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},a.updateLevelTiming=function(m,b,M,K){var z=this,ee=M.details;console.assert(!!ee,"level.details must be defined");var G=Object.keys(m.elementaryStreams).reduce(function(F,ie){var ge=m.elementaryStreams[ie];if(ge){var ye=ge.endPTS-ge.startPTS;if(ye<=0)return z.warn("Could not parse fragment "+m.sn+" "+ie+" duration reliably ("+ye+") resetting transmuxer to fallback to playlist timing"),z.resetTransmuxer(),F||!1;var xe=K?0:Object(C.updateFragPTSDTS)(ee,m,ge.startPTS,ge.endPTS,ge.startDTS,ge.endDTS);return z.hls.trigger(k.Events.LEVEL_PTS_UPDATED,{details:ee,level:M,drift:xe,type:ie,frag:m,start:ge.startPTS,end:ge.endPTS}),!0}return F},!1);G?(this.state=y.PARSED,this.hls.trigger(k.Events.FRAG_PARSED,{frag:m,part:b})):this.resetLoadingState()},a.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},E(s,[{key:"state",get:function(){return this._state},set:function(m){var b=this._state;b!==m&&(this._state=m,this.log(b+"->"+m))}}]),s}(U.default)},"./src/controller/buffer-controller.ts":function(fe,$,P){"use strict";P.r($),P.d($,"default",function(){return T});var Y=P("./src/polyfills/number.ts"),U=P("./src/events.ts"),O=P("./src/utils/logger.ts"),H=P("./src/errors.ts"),N=P("./src/utils/buffer-helper.ts"),k=P("./src/utils/mediasource-helper.ts"),L=P("./src/loader/fragment.ts"),_=P("./src/controller/buffer-operation-queue.ts"),w=Object(k.getMediaSource)(),D=/([ha]vc.)(?:\.[^.,]+)+/,T=function(){function C(f){var l=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var i=l.hls,c=l.media,E=l.mediaSource;O.logger.log("[buffer-controller]: Media source opened"),c&&(l.updateMediaElementDuration(),i.trigger(U.Events.MEDIA_ATTACHED,{media:c})),E&&E.removeEventListener("sourceopen",l._onMediaSourceOpen),l.checkPendingTracks()},this._onMediaSourceClose=function(){O.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){O.logger.log("[buffer-controller]: Media source ended")},this.hls=f,this._initSourceBuffer(),this.registerListeners()}var S=C.prototype;return S.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},S.destroy=function(){this.unregisterListeners(),this.details=null},S.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)},S.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)},S._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new _.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},S.onManifestParsed=function(l,i){var c=2;(i.audio&&!i.video||!i.altAudio)&&(c=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=c,this.details=null,O.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},S.onMediaAttaching=function(l,i){var c=this.media=i.media;if(c&&w){var E=this.mediaSource=new w;E.addEventListener("sourceopen",this._onMediaSourceOpen),E.addEventListener("sourceended",this._onMediaSourceEnded),E.addEventListener("sourceclose",this._onMediaSourceClose),c.src=self.URL.createObjectURL(E),this._objectUrl=c.src}},S.onMediaDetaching=function(){var l=this.media,i=this.mediaSource,c=this._objectUrl;if(i){if(O.logger.log("[buffer-controller]: media source detaching"),i.readyState==="open")try{i.endOfStream()}catch(E){O.logger.warn("[buffer-controller]: onMediaDetaching: "+E.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()):O.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)},S.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(E){O.logger.warn("[buffer-controller]: Failed to reset the "+i+" buffer",E)}}),this._initSourceBuffer()},S.onBufferCodecs=function(l,i){var c=this,E=this.getSourceBufferTypes().length;if(Object.keys(i).forEach(function(v){if(E){var p=c.tracks[v];if(p&&typeof p.buffer.changeType=="function"){var u=i[v],y=u.codec,d=u.levelCodec,h=u.container,s=(p.levelCodec||p.codec).replace(D,"$1"),a=(d||y).replace(D,"$1");if(s!==a){var g=h+";codecs="+(d||y);c.appendChangeType(v,g)}}}else c.pendingTracks[v]=i[v]}),E)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},S.appendChangeType=function(l,i){var c=this,E=this.operationQueue,v={execute:function(){var u=c.sourceBuffer[l];u&&(O.logger.log("[buffer-controller]: changing "+l+" sourceBuffer type to "+i),u.changeType(i)),E.shiftAndExecuteNext(l)},onStart:function(){},onComplete:function(){},onError:function(u){O.logger.warn("[buffer-controller]: Failed to change "+l+" SourceBuffer type",u)}};E.append(v,l)},S.onBufferAppending=function(l,i){var c=this,E=this.hls,v=this.operationQueue,p=this.tracks,u=i.data,y=i.type,d=i.frag,h=i.part,s=i.chunkMeta,a=s.buffering[y],g=self.performance.now();a.start=g;var m=d.stats.buffering,b=h?h.stats.buffering:null;m.start===0&&(m.start=g),b&&b.start===0&&(b.start=g);var M=p.audio,K=y==="audio"&&s.id===1&&(M==null?void 0:M.container)==="audio/mpeg",z={execute:function(){if(a.executeStart=self.performance.now(),K){var G=c.sourceBuffer[y];if(G){var F=d.start-G.timestampOffset;Math.abs(F)>=.1&&(O.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+d.start+" (delta: "+F+") sn: "+d.sn+")"),G.timestampOffset=d.start)}}c.appendExecutor(u,y)},onStart:function(){},onComplete:function(){var G=self.performance.now();a.executeEnd=a.end=G,m.first===0&&(m.first=G),b&&b.first===0&&(b.first=G);var F=c.sourceBuffer,ie={};for(var ge in F)ie[ge]=N.BufferHelper.getBuffered(F[ge]);c.appendError=0,c.hls.trigger(U.Events.BUFFER_APPENDED,{type:y,frag:d,part:h,chunkMeta:s,parent:d.type,timeRanges:ie})},onError:function(G){O.logger.error("[buffer-controller]: Error encountered while trying to append to the "+y+" SourceBuffer",G);var F={type:H.ErrorTypes.MEDIA_ERROR,parent:d.type,details:H.ErrorDetails.BUFFER_APPEND_ERROR,err:G,fatal:!1};G.code===DOMException.QUOTA_EXCEEDED_ERR?F.details=H.ErrorDetails.BUFFER_FULL_ERROR:(c.appendError++,F.details=H.ErrorDetails.BUFFER_APPEND_ERROR,c.appendError>E.config.appendErrorMaxRetry&&(O.logger.error("[buffer-controller]: Failed "+E.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),F.fatal=!0)),E.trigger(U.Events.ERROR,F)}};v.append(z,y)},S.onBufferFlushing=function(l,i){var c=this,E=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){O.logger.warn("[buffer-controller]: Failed to remove from "+u+" SourceBuffer",d)}}};i.type?E.append(v(i.type),i.type):this.getSourceBufferTypes().forEach(function(p){E.append(v(p),p)})},S.onFragParsed=function(l,i){var c=this,E=i.frag,v=i.part,p=[],u=v?v.elementaryStreams:E.elementaryStreams;u[L.ElementaryStreamTypes.AUDIOVIDEO]?p.push("audiovideo"):(u[L.ElementaryStreamTypes.AUDIO]&&p.push("audio"),u[L.ElementaryStreamTypes.VIDEO]&&p.push("video"));var y=function(){var h=self.performance.now();E.stats.buffering.end=h,v&&(v.stats.buffering.end=h);var s=v?v.stats:E.stats;c.hls.trigger(U.Events.FRAG_BUFFERED,{frag:E,part:v,stats:s,id:E.type})};p.length===0&&O.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+E.type+" level: "+E.level+" sn: "+E.sn),this.blockBuffers(y,p)},S.onFragChanged=function(l,i){this.flushBackBuffer()},S.onBufferEos=function(l,i){var c=this,E=this.getSourceBufferTypes().reduce(function(v,p){var u=c.sourceBuffer[p];return(!i.type||i.type===p)&&(u&&!u.ended&&(u.ended=!0,O.logger.log("[buffer-controller]: "+p+" sourceBuffer now EOS"))),v&&!!(!u||u.ended)},!0);E&&this.blockBuffers(function(){var v=c.mediaSource;if(!v||v.readyState!=="open")return;v.endOfStream()})},S.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()},S.flushBackBuffer=function(){var l=this.hls,i=this.details,c=this.media,E=this.sourceBuffer;if(!c||i===null)return;var v=this.getSourceBufferTypes();if(!v.length)return;var p=i.live&&l.config.liveBackBufferLength!==null?l.config.liveBackBufferLength:l.config.backBufferLength;if(!Object(Y.isFiniteNumber)(p)||p<0)return;var u=c.currentTime,y=i.levelTargetDuration,d=Math.max(p,y),h=Math.floor(u/y)*y-d;v.forEach(function(s){var a=E[s];if(a){var g=N.BufferHelper.getBuffered(a);g.length>0&&h>g.start(0)&&(l.trigger(U.Events.BACK_BUFFER_REACHED,{bufferEnd:h}),i.live&&l.trigger(U.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:h}),l.trigger(U.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:h,type:s}))}})},S.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var l=this.details,i=this.hls,c=this.media,E=this.mediaSource,v=l.fragments[0].start+l.totalduration,p=c.duration,u=Object(Y.isFiniteNumber)(E.duration)?E.duration:0;l.live&&i.config.liveDurationInfinity?(O.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),E.duration=Infinity,this.updateSeekableRange(l)):(v>u&&v>p||!Object(Y.isFiniteNumber)(p))&&(O.logger.log("[buffer-controller]: Updating Media Source duration to "+v.toFixed(3)),E.duration=v)},S.updateSeekableRange=function(l){var i=this.mediaSource,c=l.fragments,E=c.length;if(E&&l.live&&i!==null&&i!==void 0&&i.setLiveSeekableRange){var v=Math.max(0,c[0].start),p=Math.max(v,v+l.totalduration);i.setLiveSeekableRange(v,p)}},S.checkPendingTracks=function(){var l=this.bufferCodecEventsExpected,i=this.operationQueue,c=this.pendingTracks,E=Object.keys(c).length;if(E&&!l||E===2){this.createSourceBuffers(c),this.pendingTracks={};var v=this.getSourceBufferTypes();if(v.length===0){this.hls.trigger(U.Events.ERROR,{type:H.ErrorTypes.MEDIA_ERROR,details:H.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}v.forEach(function(p){i.executeNext(p)})}},S.createSourceBuffers=function(l){var i=this.sourceBuffer,c=this.mediaSource;if(!c)throw Error("createSourceBuffers called when mediaSource was null");var E=0;for(var v in l)if(!i[v]){var p=l[v];if(!p)throw Error("source buffer exists for track "+v+", however track does not");var u=p.levelCodec||p.codec,y=p.container+";codecs="+u;O.logger.log("[buffer-controller]: creating sourceBuffer("+y+")");try{var d=i[v]=c.addSourceBuffer(y),h=v;this.addBufferListener(h,"updatestart",this._onSBUpdateStart),this.addBufferListener(h,"updateend",this._onSBUpdateEnd),this.addBufferListener(h,"error",this._onSBUpdateError),this.tracks[v]={buffer:d,codec:u,container:p.container,levelCodec:p.levelCodec,id:p.id},E++}catch(s){O.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+s.message),this.hls.trigger(U.Events.ERROR,{type:H.ErrorTypes.MEDIA_ERROR,details:H.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:s,mimeType:y})}}E&&this.hls.trigger(U.Events.BUFFER_CREATED,{tracks:this.tracks})},S._onSBUpdateStart=function(l){var i=this.operationQueue,c=i.current(l);c.onStart()},S._onSBUpdateEnd=function(l){var i=this.operationQueue,c=i.current(l);c.onComplete(),i.shiftAndExecuteNext(l)},S._onSBUpdateError=function(l,i){O.logger.error("[buffer-controller]: "+l+" SourceBuffer error",i),this.hls.trigger(U.Events.ERROR,{type:H.ErrorTypes.MEDIA_ERROR,details:H.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var c=this.operationQueue.current(l);c&&c.onError(i)},S.removeExecutor=function(l,i,c){var E=this.media,v=this.mediaSource,p=this.operationQueue,u=this.sourceBuffer,y=u[l];if(!E||!v||!y){O.logger.warn("[buffer-controller]: Attempting to remove from the "+l+" SourceBuffer, but it does not exist"),p.shiftAndExecuteNext(l);return}var d=Object(Y.isFiniteNumber)(E.duration)?E.duration:Infinity,h=Object(Y.isFiniteNumber)(v.duration)?v.duration:Infinity,s=Math.max(0,i),a=Math.min(c,d,h);a>s?(O.logger.log("[buffer-controller]: Removing ["+s+","+a+"] from the "+l+" SourceBuffer"),console.assert(!y.updating,l+" sourceBuffer must not be updating"),y.remove(s,a)):p.shiftAndExecuteNext(l)},S.appendExecutor=function(l,i){var c=this.operationQueue,E=this.sourceBuffer,v=E[i];if(!v){O.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)},S.blockBuffers=function(l,i){var c=this;if(i===void 0&&(i=this.getSourceBufferTypes()),!i.length){O.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(l);return}var E=this.operationQueue,v=i.map(function(p){return E.appendBlocker(p)});Promise.all(v).then(function(){l(),i.forEach(function(p){var u=c.sourceBuffer[p];(!u||!u.updating)&&E.shiftAndExecuteNext(p)})})},S.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},S.addBufferListener=function(l,i,c){var E=this.sourceBuffer[l];if(!E)return;var v=c.bind(this,l);this.listeners[l].push({event:i,listener:v}),E.addEventListener(i,v)},S.removeBufferListeners=function(l){var i=this.sourceBuffer[l];if(!i)return;this.listeners[l].forEach(function(c){i.removeEventListener(c.event,c.listener)})},C}()},"./src/controller/buffer-operation-queue.ts":function(fe,$,P){"use strict";P.r($),P.d($,"default",function(){return U});var Y=P("./src/utils/logger.ts"),U=function(){function O(N){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=N}var H=O.prototype;return H.append=function(k,L){var _=this.queues[L];_.push(k),_.length===1&&this.buffers[L]&&this.executeNext(L)},H.insertAbort=function(k,L){var _=this.queues[L];_.unshift(k),this.executeNext(L)},H.appendBlocker=function(k){var L,_=new Promise(function(D){L=D}),w={execute:L,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(w,k),_},H.executeNext=function(k){var L=this.buffers,_=this.queues,w=L[k],D=_[k];if(D.length){var T=D[0];try{T.execute()}catch(C){Y.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),T.onError(C),(!w||!w.updating)&&(D.shift(),this.executeNext(k))}}},H.shiftAndExecuteNext=function(k){this.queues[k].shift(),this.executeNext(k)},H.current=function(k){return this.queues[k][0]},O}()},"./src/controller/cap-level-controller.ts":function(fe,$,P){"use strict";P.r($);var Y=P("./src/events.ts");function U(N,k){for(var L=0;L<k.length;L++){var _=k[L];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(N,_.key,_)}}function O(N,k,L){return k&&U(N.prototype,k),L&&U(N,L),N}var H=function(){function N(L){this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.hls=void 0,this.streamController=void 0,this.clientRect=void 0,this.hls=L,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var k=N.prototype;return k.setStreamController=function(_){this.streamController=_},k.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},k.registerListeners=function(){var _=this.hls;_.on(Y.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),_.on(Y.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),_.on(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this),_.on(Y.Events.BUFFER_CODECS,this.onBufferCodecs,this),_.on(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},k.unregisterListener=function(){var _=this.hls;_.off(Y.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),_.off(Y.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),_.off(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this),_.off(Y.Events.BUFFER_CODECS,this.onBufferCodecs,this),_.off(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},k.onFpsDropLevelCapping=function(_,w){N.isLevelAllowed(w.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(w.droppedLevel)},k.onMediaAttaching=function(_,w){this.media=w.media instanceof HTMLVideoElement?w.media:null},k.onManifestParsed=function(_,w){var D=this.hls;this.restrictedLevels=[],this.firstLevel=w.firstLevel,D.config.capLevelToPlayerSize&&w.video&&this.startCapping()},k.onBufferCodecs=function(_,w){var D=this.hls;D.config.capLevelToPlayerSize&&w.video&&this.startCapping()},k.onMediaDetaching=function(){this.stopCapping()},k.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var _=this.hls.levels;if(_.length){var w=this.hls;w.autoLevelCapping=this.getMaxLevel(_.length-1),w.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=w.autoLevelCapping}}},k.getMaxLevel=function(_){var w=this,D=this.hls.levels;if(!D.length)return-1;var T=D.filter(function(C,S){return N.isLevelAllowed(S,w.restrictedLevels)&&S<=_});return this.clientRect=null,N.getMaxLevelByMediaSize(T,this.mediaWidth,this.mediaHeight)},k.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()},k.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},k.getDimensions=function(){if(this.clientRect)return this.clientRect;var _=this.media,w={width:0,height:0};if(_){var D=_.getBoundingClientRect();w.width=D.width,w.height=D.height,!w.width&&!w.height&&(w.width=D.right-D.left||_.width||0,w.height=D.bottom-D.top||_.height||0)}return this.clientRect=w,w},N.isLevelAllowed=function(_,w){return w===void 0&&(w=[]),w.indexOf(_)===-1},N.getMaxLevelByMediaSize=function(_,w,D){if(!_||!_.length)return-1;for(var T=function(i,c){return c?i.width!==c.width||i.height!==c.height:!0},C=_.length-1,S=0;S<_.length;S+=1){var f=_[S];if((f.width>=w||f.height>=D)&&T(f,_[S+1])){C=S;break}}return C},O(N,[{key:"mediaWidth",get:function(){return this.getDimensions().width*N.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*N.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var _=1;try{_=self.devicePixelRatio}catch(w){}return _}}]),N}();$.default=H},"./src/controller/cmcd-controller.ts":function(fe,$,P){"use strict";P.r($),P.d($,"default",function(){return T});var Y=P("./src/events.ts"),U=P("./src/types/cmcd.ts"),O=P("./src/utils/buffer-helper.ts"),H=P("./src/utils/logger.ts");function N(C,S){for(var f=0;f<S.length;f++){var l=S[f];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(C,l.key,l)}}function k(C,S,f){return S&&N(C.prototype,S),f&&N(C,f),C}function L(C,S){var f=typeof Symbol!="undefined"&&C[Symbol.iterator]||C["@@iterator"];if(f)return(f=f.call(C)).next.bind(f);if(Array.isArray(C)||(f=_(C))||S&&C&&typeof C.length=="number"){f&&(C=f);var l=0;return function(){return l>=C.length?{done:!0}:{done:!1,value:C[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 _(C,S){if(!C)return;if(typeof C=="string")return w(C,S);var f=Object.prototype.toString.call(C).slice(8,-1);if(f==="Object"&&C.constructor&&(f=C.constructor.name),f==="Map"||f==="Set")return Array.from(C);if(f==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(f))return w(C,S)}function w(C,S){(S==null||S>C.length)&&(S=C.length);for(var f=0,l=new Array(S);f<S;f++)l[f]=C[f];return l}function D(){return D=Object.assign||function(C){for(var S=1;S<arguments.length;S++){var f=arguments[S];for(var l in f)Object.prototype.hasOwnProperty.call(f,l)&&(C[l]=f[l])}return C},D.apply(this,arguments)}var T=function(){function C(f){var l=this;this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){l.initialized&&(l.starved=!0),l.buffering=!0},this.onPlaying=function(){l.initialized||(l.initialized=!0),l.buffering=!1},this.applyPlaylistData=function(E){try{l.apply(E,{ot:U.CMCDObjectType.MANIFEST,su:!l.initialized})}catch(v){H.logger.warn("Could not generate manifest CMCD data.",v)}},this.applyFragmentData=function(E){try{var v=E.frag,p=l.hls.levels[v.level],u=l.getObjectType(v),y={d:v.duration*1e3,ot:u};(u===U.CMCDObjectType.VIDEO||u===U.CMCDObjectType.AUDIO||u==U.CMCDObjectType.MUXED)&&(y.br=p.bitrate/1e3,y.tb=l.getTopBandwidth(u),y.bl=l.getBufferLength(u)),l.apply(E,y)}catch(d){H.logger.warn("Could not generate segment CMCD data.",d)}},this.hls=f;var i=this.config=f.config,c=i.cmcd;c!=null&&(i.pLoader=this.createPlaylistLoader(),i.fLoader=this.createFragmentLoader(),this.sid=c.sessionId||C.uuid(),this.cid=c.contentId,this.useHeaders=c.useHeaders===!0,this.registerListeners())}var S=C.prototype;return S.registerListeners=function(){var l=this.hls;l.on(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),l.on(Y.Events.MEDIA_DETACHED,this.onMediaDetached,this),l.on(Y.Events.BUFFER_CREATED,this.onBufferCreated,this)},S.unregisterListeners=function(){var l=this.hls;l.off(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),l.off(Y.Events.MEDIA_DETACHED,this.onMediaDetached,this),l.off(Y.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},S.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},S.onMediaAttached=function(l,i){this.media=i.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},S.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},S.onBufferCreated=function(l,i){var c,E;this.audioBuffer=(c=i.tracks.audio)===null||c===void 0?void 0:c.buffer,this.videoBuffer=(E=i.tracks.video)===null||E===void 0?void 0:E.buffer},S.createData=function(){var l;return{v:U.CMCDVersion,sf:U.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(l=this.media)===null||l===void 0?void 0:l.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},S.apply=function(l,i){i===void 0&&(i={}),D(i,this.createData());var c=i.ot===U.CMCDObjectType.INIT||i.ot===U.CMCDObjectType.VIDEO||i.ot===U.CMCDObjectType.MUXED;if(this.starved&&c&&(i.bs=!0,i.su=!0,this.starved=!1),i.su==null&&(i.su=this.buffering),this.useHeaders){var E=C.toHeaders(i);if(!Object.keys(E).length)return;l.headers||(l.headers={}),D(l.headers,E)}else{var v=C.toQuery(i);if(!v)return;l.url=C.appendQueryToUri(l.url,v)}},S.getObjectType=function(l){var i=l.type;return i==="subtitle"?U.CMCDObjectType.TIMED_TEXT:l.sn==="initSegment"?U.CMCDObjectType.INIT:i==="audio"?U.CMCDObjectType.AUDIO:i==="main"?this.hls.audioTracks.length?U.CMCDObjectType.VIDEO:U.CMCDObjectType.MUXED:void 0},S.getTopBandwidth=function(l){for(var i=0,c=l===U.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,E=L(c),v;!(v=E()).done;){var p=v.value;p.bitrate>i&&(i=p.bitrate)}return i>0?i:NaN},S.getBufferLength=function(l){var i=this.hls.media,c=l===U.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!c||!i)return NaN;var E=O.BufferHelper.bufferInfo(c,i.currentTime,this.config.maxBufferHole);return E.len*1e3},S.createPlaylistLoader=function(){var l=this.config.pLoader,i=this.applyPlaylistData,c=l||this.config.loader;return function(){function E(p){this.loader=void 0,this.loader=new c(p)}var v=E.prototype;return v.destroy=function(){this.loader.destroy()},v.abort=function(){this.loader.abort()},v.load=function(u,y,d){i(u),this.loader.load(u,y,d)},k(E,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),E}()},S.createFragmentLoader=function(){var l=this.config.fLoader,i=this.applyFragmentData,c=l||this.config.loader;return function(){function E(p){this.loader=void 0,this.loader=new c(p)}var v=E.prototype;return v.destroy=function(){this.loader.destroy()},v.abort=function(){this.loader.abort()},v.load=function(u,y,d){i(u),this.loader.load(u,y,d)},k(E,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),E}()},C.uuid=function(){var l=URL.createObjectURL(new Blob),i=l.toString();return URL.revokeObjectURL(l),i.substr(i.lastIndexOf("/")+1)},C.serialize=function(l){for(var i=[],c=function(K){return!Number.isNaN(K)&&K!=null&&K!==""&&K!==!1},E=function(K){return Math.round(K)},v=function(K){return E(K/100)*100},p=function(K){return encodeURIComponent(K)},u={br:E,d:E,bl:v,dl:v,mtp:v,nor:p,rtp:v,tb:E},y=Object.keys(l||{}).sort(),d=L(y),h;!(h=d()).done;){var s=h.value,a=l[s];if(!c(a))continue;if(s==="v"&&a===1)continue;if(s=="pr"&&a===1)continue;var g=u[s];g&&(a=g(a));var m=typeof a,b=void 0;s==="ot"||s==="sf"||s==="st"?b=s+"="+a:m==="boolean"?b=s:m==="number"?b=s+"="+a:b=s+"="+JSON.stringify(a),i.push(b)}return i.join(",")},C.toHeaders=function(l){for(var i=Object.keys(l),c={},E=["Object","Request","Session","Status"],v=[{},{},{},{}],p={br:0,d:0,ot:0,tb:0,bl:1,dl:1,mtp:1,nor:1,nrr:1,su:1,cid:2,pr:2,sf:2,sid:2,st:2,v:2,bs:3,rtp:3},u=0,y=i;u<y.length;u++){var d=y[u],h=p[d]!=null?p[d]:1;v[h][d]=l[d]}for(var s=0;s<v.length;s++){var a=C.serialize(v[s]);a&&(c["CMCD-"+E[s]]=a)}return c},C.toQuery=function(l){return"CMCD="+encodeURIComponent(C.serialize(l))},C.appendQueryToUri=function(l,i){if(!i)return l;var c=l.includes("?")?"&":"?";return""+l+c+i},C}()},"./src/controller/eme-controller.ts":function(fe,$,P){"use strict";P.r($);var Y=P("./src/events.ts"),U=P("./src/errors.ts"),O=P("./src/utils/logger.ts"),H=P("./src/utils/mediakeys-helper.ts");function N(T,C){for(var S=0;S<C.length;S++){var f=C[S];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(T,f.key,f)}}function k(T,C,S){return C&&N(T.prototype,C),S&&N(T,S),T}var L=3,_=function(C,S,f){var l={audioCapabilities:[],videoCapabilities:[]};return C.forEach(function(i){l.audioCapabilities.push({contentType:'audio/mp4; codecs="'+i+'"',robustness:f.audioRobustness||""})}),S.forEach(function(i){l.videoCapabilities.push({contentType:'video/mp4; codecs="'+i+'"',robustness:f.videoRobustness||""})}),[l]},w=function(C,S,f,l){switch(C){case H.KeySystems.WIDEVINE:return _(S,f,l);default:throw new Error("Unknown key-system: "+C)}},D=function(){function T(S){this.hls=void 0,this._widevineLicenseUrl=void 0,this._licenseXhrSetup=void 0,this._licenseResponseCallback=void 0,this._emeEnabled=void 0,this._requestMediaKeySystemAccess=void 0,this._drmSystemOptions=void 0,this._config=void 0,this._mediaKeysList=[],this._media=null,this._hasSetMediaKeys=!1,this._requestLicenseFailureCount=0,this.mediaKeysPromise=null,this._onMediaEncrypted=this.onMediaEncrypted.bind(this),this.hls=S,this._config=S.config,this._widevineLicenseUrl=this._config.widevineLicenseUrl,this._licenseXhrSetup=this._config.licenseXhrSetup,this._licenseResponseCallback=this._config.licenseResponseCallback,this._emeEnabled=this._config.emeEnabled,this._requestMediaKeySystemAccess=this._config.requestMediaKeySystemAccessFunc,this._drmSystemOptions=this._config.drmSystemOptions,this._registerListeners()}var C=T.prototype;return C.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},C._registerListeners=function(){this.hls.on(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(Y.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this)},C._unregisterListeners=function(){this.hls.off(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(Y.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this)},C.getLicenseServerUrl=function(f){switch(f){case H.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+f+'"')},C._attemptKeySystemAccess=function(f,l,i){var c=this,E=w(f,l,i,this._drmSystemOptions);O.logger.log("Requesting encrypted media key-system access");var v=this.requestMediaKeySystemAccess(f,E);this.mediaKeysPromise=v.then(function(p){return c._onMediaKeySystemAccessObtained(f,p)}),v.catch(function(p){O.logger.error('Failed to obtain key-system "'+f+'" access:',p)})},C._onMediaKeySystemAccessObtained=function(f,l){var i=this;O.logger.log('Access for key-system "'+f+'" obtained');var c={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:l,mediaKeySystemDomain:f};this._mediaKeysList.push(c);var E=Promise.resolve().then(function(){return l.createMediaKeys()}).then(function(v){return c.mediaKeys=v,O.logger.log('Media-keys created for key-system "'+f+'"'),i._onMediaKeysCreated(),v});return E.catch(function(v){O.logger.error("Failed to create media-keys:",v)}),E},C._onMediaKeysCreated=function(){var f=this;this._mediaKeysList.forEach(function(l){l.mediaKeysSession||(l.mediaKeysSession=l.mediaKeys.createSession(),f._onNewMediaKeySession(l.mediaKeysSession))})},C._onNewMediaKeySession=function(f){var l=this;O.logger.log("New key-system session "+f.sessionId),f.addEventListener("message",function(i){l._onKeySessionMessage(f,i.message)},!1)},C._onKeySessionMessage=function(f,l){O.logger.log("Got EME message event, creating license request"),this._requestLicense(l,function(i){O.logger.log("Received license data (length: "+(i&&i.byteLength)+"), updating key-session"),f.update(i)})},C.onMediaEncrypted=function(f){var l=this;if(O.logger.log('Media is encrypted using "'+f.initDataType+'" init data type'),!this.mediaKeysPromise){O.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(Y.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var i=function(E){if(!l._media)return;l._attemptSetMediaKeys(E),l._generateRequestWithPreferredKeySession(f.initDataType,f.initData)};this.mediaKeysPromise.then(i).catch(i)},C._attemptSetMediaKeys=function(f){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var l=this._mediaKeysList[0];if(!l||!l.mediaKeys){O.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(Y.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}O.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(l.mediaKeys),this._hasSetMediaKeys=!0}},C._generateRequestWithPreferredKeySession=function(f,l){var i=this,c=this._mediaKeysList[0];if(!c){O.logger.error("Fatal: Media is encrypted but not any 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}if(c.mediaKeysSessionInitialized){O.logger.warn("Key-Session already initialized but requested again");return}var E=c.mediaKeysSession;if(!E){O.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(Y.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!l){O.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(Y.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}O.logger.log('Generating key-session request for "'+f+'" init data type'),c.mediaKeysSessionInitialized=!0,E.generateRequest(f,l).then(function(){O.logger.debug("Key-session generation succeeded")}).catch(function(v){O.logger.error("Error generating key-session request:",v),i.hls.trigger(Y.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},C._createLicenseXhr=function(f,l,i){var c=new XMLHttpRequest;c.responseType="arraybuffer",c.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,c,f,l,i);var E=this._licenseXhrSetup;if(E)try{E.call(this.hls,c,f),E=void 0}catch(v){O.logger.error(v)}try{c.readyState||c.open("POST",f,!0),E&&E.call(this.hls,c,f)}catch(v){throw new Error("issue setting up KeySystem license XHR "+v)}return c},C._onLicenseRequestReadyStageChange=function(f,l,i,c){switch(f.readyState){case 4:if(f.status===200){this._requestLicenseFailureCount=0,O.logger.log("License request succeeded");var E=f.response,v=this._licenseResponseCallback;if(v)try{E=v.call(this.hls,f,l)}catch(u){O.logger.error(u)}c(E)}else{if(O.logger.error("License Request XHR failed ("+l+"). Status: "+f.status+" ("+f.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>L){this.hls.trigger(Y.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var p=L-this._requestLicenseFailureCount+1;O.logger.warn("Retrying license request, "+p+" attempts left"),this._requestLicense(i,c)}break}},C._generateLicenseRequestChallenge=function(f,l){switch(f.mediaKeySystemDomain){case H.KeySystems.WIDEVINE:return l}throw new Error("unsupported key-system: "+f.mediaKeySystemDomain)},C._requestLicense=function(f,l){O.logger.log("Requesting content license for key-system");var i=this._mediaKeysList[0];if(!i){O.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),E=this._createLicenseXhr(c,f,l);O.logger.log("Sending license request to URL: "+c);var v=this._generateLicenseRequestChallenge(i,f);E.send(v)}catch(p){O.logger.error("Failure requesting DRM license: "+p),this.hls.trigger(Y.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},C.onMediaAttached=function(f,l){if(!this._emeEnabled)return;var i=l.media;this._media=i,i.addEventListener("encrypted",this._onMediaEncrypted)},C.onMediaDetached=function(){var f=this._media,l=this._mediaKeysList;if(!f)return;f.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(l.map(function(i){if(i.mediaKeysSession)return i.mediaKeysSession.close().catch(function(){})})).then(function(){return f.setMediaKeys(null)}).catch(function(){})},C.onManifestParsed=function(f,l){if(!this._emeEnabled)return;var i=l.levels.map(function(E){return E.audioCodec}).filter(function(E){return!!E}),c=l.levels.map(function(E){return E.videoCodec}).filter(function(E){return!!E});this._attemptKeySystemAccess(H.KeySystems.WIDEVINE,i,c)},k(T,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),T}();$.default=D},"./src/controller/fps-controller.ts":function(fe,$,P){"use strict";P.r($);var Y=P("./src/events.ts"),U=P("./src/utils/logger.ts"),O=function(){function H(k){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=k,this.registerListeners()}var N=H.prototype;return N.setStreamController=function(L){this.streamController=L},N.registerListeners=function(){this.hls.on(Y.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},N.unregisterListeners=function(){this.hls.off(Y.Events.MEDIA_ATTACHING,this.onMediaAttaching)},N.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},N.onMediaAttaching=function(L,_){var w=this.hls.config;if(w.capLevelOnFPSDrop){var D=_.media instanceof self.HTMLVideoElement?_.media:null;this.media=D,D&&typeof D.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),w.fpsDroppedMonitoringPeriod)}},N.checkFPS=function(L,_,w){var D=performance.now();if(_){if(this.lastTime){var T=D-this.lastTime,C=w-this.lastDroppedFrames,S=_-this.lastDecodedFrames,f=1e3*C/T,l=this.hls;if(l.trigger(Y.Events.FPS_DROP,{currentDropped:C,currentDecoded:S,totalDroppedFrames:w}),f>0&&C>l.config.fpsDroppedMonitoringThreshold*S){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=D,this.lastDroppedFrames=w,this.lastDecodedFrames=_}},N.checkFPSInterval=function(){var L=this.media;if(L)if(this.isVideoPlaybackQualityAvailable){var _=L.getVideoPlaybackQuality();this.checkFPS(L,_.totalVideoFrames,_.droppedVideoFrames)}else this.checkFPS(L,L.webkitDecodedFrameCount,L.webkitDroppedFrameCount)},H}();$.default=O},"./src/controller/fragment-finders.ts":function(fe,$,P){"use strict";P.r($),P.d($,"findFragmentByPDT",function(){return O}),P.d($,"findFragmentByPTS",function(){return H}),P.d($,"fragmentWithinToleranceTest",function(){return N}),P.d($,"pdtWithinToleranceTest",function(){return k}),P.d($,"findFragWithCC",function(){return L});var Y=P("./src/polyfills/number.ts"),U=P("./src/utils/binary-search.ts");function O(_,w,D){if(w===null||!Array.isArray(_)||!_.length||!Object(Y.isFiniteNumber)(w))return null;var T=_[0].programDateTime;if(w<(T||0))return null;var C=_[_.length-1].endProgramDateTime;if(w>=(C||0))return null;D=D||0;for(var S=0;S<_.length;++S){var f=_[S];if(k(w,D,f))return f}return null}function H(_,w,D,T){D===void 0&&(D=0),T===void 0&&(T=0);var C=null;if(_?C=w[_.sn-w[0].sn+1]||null:D===0&&w[0].start===0&&(C=w[0]),C&&N(D,T,C)===0)return C;var S=U.default.search(w,N.bind(null,D,T));return S||C}function N(_,w,D){_===void 0&&(_=0),w===void 0&&(w=0);var T=Math.min(w,D.duration+(D.deltaPTS?D.deltaPTS:0));return D.start+D.duration-T<=_?1:D.start-T>_&&D.start?-1:0}function k(_,w,D){var T=Math.min(w,D.duration+(D.deltaPTS?D.deltaPTS:0))*1e3,C=D.endProgramDateTime||0;return C-T>_}function L(_,w){return U.default.search(_,function(D){return D.cc<w?1:D.cc>w?-1:0})}},"./src/controller/fragment-tracker.ts":function(fe,$,P){"use strict";P.r($),P.d($,"FragmentState",function(){return O}),P.d($,"FragmentTracker",function(){return H});var Y=P("./src/events.ts"),U=P("./src/types/loader.ts"),O;(function(L){L.NOT_LOADED="NOT_LOADED",L.BACKTRACKED="BACKTRACKED",L.APPENDING="APPENDING",L.PARTIAL="PARTIAL",L.OK="OK"})(O||(O={}));var H=function(){function L(w){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=w,this._registerListeners()}var _=L.prototype;return _._registerListeners=function(){var D=this.hls;D.on(Y.Events.BUFFER_APPENDED,this.onBufferAppended,this),D.on(Y.Events.FRAG_BUFFERED,this.onFragBuffered,this),D.on(Y.Events.FRAG_LOADED,this.onFragLoaded,this)},_._unregisterListeners=function(){var D=this.hls;D.off(Y.Events.BUFFER_APPENDED,this.onBufferAppended,this),D.off(Y.Events.FRAG_BUFFERED,this.onFragBuffered,this),D.off(Y.Events.FRAG_LOADED,this.onFragLoaded,this)},_.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},_.getAppendedFrag=function(D,T){if(T===U.PlaylistLevelType.MAIN){var C=this.activeFragment,S=this.activeParts;if(!C)return null;if(S)for(var f=S.length;f--;){var l=S[f],i=l?l.end:C.appendedPTS;if(l.start<=D&&i!==void 0&&D<=i)return f>9&&(this.activeParts=S.slice(f-9)),l}else if(C.start<=D&&C.appendedPTS!==void 0&&D<=C.appendedPTS)return C}return this.getBufferedFrag(D,T)},_.getBufferedFrag=function(D,T){for(var C=this.fragments,S=Object.keys(C),f=S.length;f--;){var l=C[S[f]];if((l==null?void 0:l.body.type)===T&&l.buffered){var i=l.body;if(i.start<=D&&D<=i.end)return i}}return null},_.detectEvictedFragments=function(D,T,C){var S=this;Object.keys(this.fragments).forEach(function(f){var l=S.fragments[f];if(!l)return;if(!l.buffered){l.body.type===C&&S.removeFragment(l.body);return}var i=l.range[D];if(!i)return;i.time.some(function(c){var E=!S.isTimeBuffered(c.startPTS,c.endPTS,T);return E&&S.removeFragment(l.body),E})})},_.detectPartialFragments=function(D){var T=this,C=this.timeRanges,S=D.frag,f=D.part;if(!C||S.sn==="initSegment")return;var l=k(S),i=this.fragments[l];if(!i)return;Object.keys(C).forEach(function(c){var E=S.elementaryStreams[c];if(!E)return;var v=C[c],p=f!==null||E.partial===!0;i.range[c]=T.getBufferedTimes(S,f,p,v)}),i.backtrack=i.loaded=null,Object.keys(i.range).length?i.buffered=!0:this.removeFragment(i.body)},_.fragBuffered=function(D){var T=k(D),C=this.fragments[T];C&&(C.backtrack=C.loaded=null,C.buffered=!0)},_.getBufferedTimes=function(D,T,C,S){for(var f={time:[],partial:C},l=T?T.start:D.start,i=T?T.end:D.end,c=D.minEndPTS||i,E=D.maxStartPTS||l,v=0;v<S.length;v++){var p=S.start(v)-this.bufferPadding,u=S.end(v)+this.bufferPadding;if(E>=p&&c<=u){f.time.push({startPTS:Math.max(l,S.start(v)),endPTS:Math.min(i,S.end(v))});break}else if(l<u&&i>p)f.partial=!0,f.time.push({startPTS:Math.max(l,S.start(v)),endPTS:Math.min(i,S.end(v))});else if(i<=p)break}return f},_.getPartialFragment=function(D){var T=null,C,S,f,l=0,i=this.bufferPadding,c=this.fragments;return Object.keys(c).forEach(function(E){var v=c[E];if(!v)return;N(v)&&(S=v.body.start-i,f=v.body.end+i,D>=S&&D<=f&&(C=Math.min(D-S,f-D),l<=C&&(T=v.body,l=C)))}),T},_.getState=function(D){var T=k(D),C=this.fragments[T];return C?C.buffered?N(C)?O.PARTIAL:O.OK:C.backtrack?O.BACKTRACKED:O.APPENDING:O.NOT_LOADED},_.backtrack=function(D,T){var C=k(D),S=this.fragments[C];if(!S||S.backtrack)return null;var f=S.backtrack=T||S.loaded;return S.loaded=null,f},_.getBacktrackData=function(D){var T=k(D),C=this.fragments[T];if(C){var S,f=C.backtrack;if(f!=null&&(S=f.payload)!==null&&S!==void 0&&S.byteLength)return f;this.removeFragment(D)}return null},_.isTimeBuffered=function(D,T,C){for(var S,f,l=0;l<C.length;l++){if(S=C.start(l)-this.bufferPadding,f=C.end(l)+this.bufferPadding,D>=S&&T<=f)return!0;if(T<=S)return!1}return!1},_.onFragLoaded=function(D,T){var C=T.frag,S=T.part;if(C.sn==="initSegment"||C.bitrateTest||S)return;var f=k(C);this.fragments[f]={body:C,loaded:T,backtrack:null,buffered:!1,range:Object.create(null)}},_.onBufferAppended=function(D,T){var C=this,S=T.frag,f=T.part,l=T.timeRanges;if(S.type===U.PlaylistLevelType.MAIN)if(this.activeFragment=S,f){var i=this.activeParts;i||(this.activeParts=i=[]),i.push(f)}else this.activeParts=null;this.timeRanges=l,Object.keys(l).forEach(function(c){var E=l[c];if(C.detectEvictedFragments(c,E),!f)for(var v=0;v<E.length;v++)S.appendedPTS=Math.max(E.end(v),S.appendedPTS||0)})},_.onFragBuffered=function(D,T){this.detectPartialFragments(T)},_.hasFragment=function(D){var T=k(D);return!!this.fragments[T]},_.removeFragmentsInRange=function(D,T,C){var S=this;Object.keys(this.fragments).forEach(function(f){var l=S.fragments[f];if(!l)return;if(l.buffered){var i=l.body;i.type===C&&i.start<T&&i.end>D&&S.removeFragment(i)}})},_.removeFragment=function(D){var T=k(D);D.stats.loaded=0,D.clearElementaryStreamInfo(),delete this.fragments[T]},_.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},L}();function N(L){var _,w;return L.buffered&&(((_=L.range.video)===null||_===void 0?void 0:_.partial)||((w=L.range.audio)===null||w===void 0?void 0:w.partial))}function k(L){return L.type+"_"+L.level+"_"+L.urlId+"_"+L.sn}},"./src/controller/gap-controller.ts":function(fe,$,P){"use strict";P.r($),P.d($,"STALL_MINIMUM_DURATION_MS",function(){return N}),P.d($,"MAX_START_GAP_JUMP",function(){return k}),P.d($,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return L}),P.d($,"SKIP_BUFFER_RANGE_START",function(){return _}),P.d($,"default",function(){return w});var Y=P("./src/utils/buffer-helper.ts"),U=P("./src/errors.ts"),O=P("./src/events.ts"),H=P("./src/utils/logger.ts"),N=250,k=2,L=.1,_=.05,w=function(){function D(C,S,f,l){this.config=void 0,this.media=void 0,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=C,this.media=S,this.fragmentTracker=f,this.hls=l}var T=D.prototype;return T.destroy=function(){this.hls=this.fragmentTracker=this.media=null},T.poll=function(S){var f=this.config,l=this.media,i=this.stalled,c=l.currentTime,E=l.seeking,v=this.seeking&&!E,p=!this.seeking&&E;if(this.seeking=E,c!==S){if(this.moved=!0,i!==null){if(this.stallReported){var u=self.performance.now()-i;H.logger.warn("playback not stuck anymore @"+c+", after "+Math.round(u)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((p||v)&&(this.stalled=null),l.paused||l.ended||l.playbackRate===0||!Y.BufferHelper.getBuffered(l).length)return;var y=Y.BufferHelper.bufferInfo(l,c,0),d=y.len>0,h=y.nextStart||0;if(!d&&!h)return;if(E){var s=y.len>k,a=!h||h-c>k&&!this.fragmentTracker.getPartialFragment(c);if(s||a)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var g,m=Math.max(h,y.start||0)-c,b=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,M=b==null||((g=b.details)===null||g===void 0)?void 0:g.live,K=M?b.details.targetduration*2:k;if(m>0&&m<=K){this._trySkipBufferHole(null);return}}var z=self.performance.now();if(i===null){this.stalled=z;return}var ee=z-i;!E&&ee>=N&&this._reportStall(y.len);var G=Y.BufferHelper.bufferInfo(l,c,f.maxBufferHole);this._tryFixBufferStall(G,ee)},T._tryFixBufferStall=function(S,f){var l=this.config,i=this.fragmentTracker,c=this.media,E=c.currentTime,v=i.getPartialFragment(E);if(v){var p=this._trySkipBufferHole(v);if(p)return}S.len>l.maxBufferHole&&f>l.highBufferWatchdogPeriod*1e3&&(H.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},T._reportStall=function(S){var f=this.hls,l=this.media,i=this.stallReported;i||(this.stallReported=!0,H.logger.warn("Playback stalling at @"+l.currentTime+" due to low buffer (buffer="+S+")"),f.trigger(O.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:S}))},T._trySkipBufferHole=function(S){for(var f=this.config,l=this.hls,i=this.media,c=i.currentTime,E=0,v=Y.BufferHelper.getBuffered(i),p=0;p<v.length;p++){var u=v.start(p);if(c+f.maxBufferHole>=E&&c<u){var y=Math.max(u+_,i.currentTime+L);return H.logger.warn("skipping hole, adjusting currentTime from "+c+" to "+y),this.moved=!0,this.stalled=null,i.currentTime=y,S&&l.trigger(O.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+c+" to "+y,frag:S}),y}E=v.end(p)}return 0},T._tryNudgeBuffer=function(){var S=this.config,f=this.hls,l=this.media,i=l.currentTime,c=(this.nudgeRetry||0)+1;if(this.nudgeRetry=c,c<S.nudgeMaxRetry){var E=i+c*S.nudgeOffset;H.logger.warn("Nudging 'currentTime' from "+i+" to "+E),l.currentTime=E,f.trigger(O.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else H.logger.error("Playhead still not moving while enough data buffered @"+i+" after "+S.nudgeMaxRetry+" nudges"),f.trigger(O.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},D}()},"./src/controller/id3-track-controller.ts":function(fe,$,P){"use strict";P.r($);var Y=P("./src/events.ts"),U=P("./src/utils/texttrack-utils.ts"),O=P("./src/demux/id3.ts"),H=.25,N=function(){function k(_){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=_,this._registerListeners()}var L=k.prototype;return L.destroy=function(){this._unregisterListeners()},L._registerListeners=function(){var w=this.hls;w.on(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),w.on(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),w.on(Y.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),w.on(Y.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},L._unregisterListeners=function(){var w=this.hls;w.off(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),w.off(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),w.off(Y.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),w.off(Y.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},L.onMediaAttached=function(w,D){this.media=D.media},L.onMediaDetaching=function(){if(!this.id3Track)return;Object(U.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},L.getID3Track=function(w){if(!this.media)return;for(var D=0;D<w.length;D++){var T=w[D];if(T.kind==="metadata"&&T.label==="id3")return Object(U.sendAddTrackEvent)(T,this.media),T}return this.media.addTextTrack("metadata","id3")},L.onFragParsingMetadata=function(w,D){if(!this.media)return;var T=D.frag,C=D.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var S=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,f=0;f<C.length;f++){var l=O.getID3Frames(C[f].data);if(l){var i=C[f].pts,c=f<C.length-1?C[f+1].pts:T.end,E=c-i;E<=0&&(c=i+H);for(var v=0;v<l.length;v++){var p=l[v];if(!O.isTimeStampFrame(p)){var u=new S(i,c,"");u.value=p,this.id3Track.addCue(u)}}}}},L.onBufferFlushing=function(w,D){var T=D.startOffset,C=D.endOffset,S=D.type;if(!S||S==="audio"){var f=this.id3Track;f&&Object(U.removeCuesInRange)(f,T,C)}},k}();$.default=N},"./src/controller/latency-controller.ts":function(fe,$,P){"use strict";P.r($),P.d($,"default",function(){return k});var Y=P("./src/errors.ts"),U=P("./src/events.ts"),O=P("./src/utils/logger.ts");function H(L,_){for(var w=0;w<_.length;w++){var D=_[w];D.enumerable=D.enumerable||!1,D.configurable=!0,"value"in D&&(D.writable=!0),Object.defineProperty(L,D.key,D)}}function N(L,_,w){return _&&H(L.prototype,_),w&&H(L,w),L}var k=function(){function L(w){var D=this;this.hls=void 0,this.config=void 0,this.media=null,this.levelDetails=null,this.currentTime=0,this.stallCount=0,this._latency=null,this.timeupdateHandler=function(){return D.timeupdate()},this.hls=w,this.config=w.config,this.registerListeners()}var _=L.prototype;return _.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},_.registerListeners=function(){this.hls.on(U.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(U.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(U.Events.ERROR,this.onError,this)},_.unregisterListeners=function(){this.hls.off(U.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(U.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(U.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(U.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(U.Events.ERROR,this.onError)},_.onMediaAttached=function(D,T){this.media=T.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},_.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},_.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},_.onLevelUpdated=function(D,T){var C=T.details;this.levelDetails=C,C.advanced&&this.timeupdate(),!C.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},_.onError=function(D,T){if(T.details!==Y.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,O.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},_.timeupdate=function(){var D=this.media,T=this.levelDetails;if(!D||!T)return;this.currentTime=D.currentTime;var C=this.computeLatency();if(C===null)return;this._latency=C;var S=this.config,f=S.lowLatencyMode,l=S.maxLiveSyncPlaybackRate;if(!f||l===1)return;var i=this.targetLatency;if(i===null)return;var c=C-i,E=Math.min(this.maxLatency,i+T.targetduration),v=c<E;if(T.live&&v&&c>.05&&this.forwardBufferLength>1){var p=Math.min(2,Math.max(1,l)),u=Math.round(2/(1+Math.exp(-.75*c-this.edgeStalled))*20)/20;D.playbackRate=Math.min(p,Math.max(1,u))}else D.playbackRate!==1&&D.playbackRate!==0&&(D.playbackRate=1)},_.estimateLiveEdge=function(){var D=this.levelDetails;return D===null?null:D.edge+D.age},_.computeLatency=function(){var D=this.estimateLiveEdge();return D===null?null:D-this.currentTime},N(L,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var D=this.config,T=this.levelDetails;return D.liveMaxLatencyDuration!==void 0?D.liveMaxLatencyDuration:T?D.liveMaxLatencyDurationCount*T.targetduration:0}},{key:"targetLatency",get:function(){var D=this.levelDetails;if(D===null)return null;var T=D.holdBack,C=D.partHoldBack,S=D.targetduration,f=this.config,l=f.liveSyncDuration,i=f.liveSyncDurationCount,c=f.lowLatencyMode,E=this.hls.userConfig,v=c&&C||T;(E.liveSyncDuration||E.liveSyncDurationCount||v===0)&&(v=l!==void 0?l:i*S);var p=S,u=1;return v+Math.min(this.stallCount*u,p)}},{key:"liveSyncPosition",get:function(){var D=this.estimateLiveEdge(),T=this.targetLatency,C=this.levelDetails;if(D===null||T===null||C===null)return null;var S=C.edge,f=D-T-this.edgeStalled,l=S-C.totalduration,i=S-(this.config.lowLatencyMode&&C.partTarget||C.targetduration);return Math.min(Math.max(l,f),i)}},{key:"drift",get:function(){var D=this.levelDetails;return D===null?1:D.drift}},{key:"edgeStalled",get:function(){var D=this.levelDetails;if(D===null)return 0;var T=(this.config.lowLatencyMode&&D.partTarget||D.targetduration)*3;return Math.max(D.age-T,0)}},{key:"forwardBufferLength",get:function(){var D=this.media,T=this.levelDetails;if(!D||!T)return 0;var C=D.buffered.length;return C?D.buffered.end(C-1):T.edge-this.currentTime}}]),L}()},"./src/controller/level-controller.ts":function(fe,$,P){"use strict";P.r($),P.d($,"default",function(){return f});var Y=P("./src/types/level.ts"),U=P("./src/events.ts"),O=P("./src/errors.ts"),H=P("./src/utils/codecs.ts"),N=P("./src/controller/level-helper.ts"),k=P("./src/controller/base-playlist-controller.ts"),L=P("./src/types/loader.ts");function _(){return _=Object.assign||function(l){for(var i=1;i<arguments.length;i++){var c=arguments[i];for(var E in c)Object.prototype.hasOwnProperty.call(c,E)&&(l[E]=c[E])}return l},_.apply(this,arguments)}function w(l,i){for(var c=0;c<i.length;c++){var E=i[c];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(l,E.key,E)}}function D(l,i,c){return i&&w(l.prototype,i),c&&w(l,c),l}function T(l,i){l.prototype=Object.create(i.prototype),l.prototype.constructor=l,C(l,i)}function C(l,i){return C=Object.setPrototypeOf||function(E,v){return E.__proto__=v,E},C(l,i)}var S=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),f=function(l){T(i,l);function i(E){var v;return v=l.call(this,E,"[level-controller]")||this,v._levels=[],v._firstLevel=-1,v._startLevel=void 0,v.currentLevelIndex=-1,v.manualLevelIndex=-1,v.onParsedComplete=void 0,v._registerListeners(),v}var c=i.prototype;return c._registerListeners=function(){var v=this.hls;v.on(U.Events.MANIFEST_LOADED,this.onManifestLoaded,this),v.on(U.Events.LEVEL_LOADED,this.onLevelLoaded,this),v.on(U.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),v.on(U.Events.FRAG_LOADED,this.onFragLoaded,this),v.on(U.Events.ERROR,this.onError,this)},c._unregisterListeners=function(){var v=this.hls;v.off(U.Events.MANIFEST_LOADED,this.onManifestLoaded,this),v.off(U.Events.LEVEL_LOADED,this.onLevelLoaded,this),v.off(U.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),v.off(U.Events.FRAG_LOADED,this.onFragLoaded,this),v.off(U.Events.ERROR,this.onError,this)},c.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,l.prototype.destroy.call(this)},c.startLoad=function(){var v=this._levels;v.forEach(function(p){p.loadError=0}),l.prototype.startLoad.call(this)},c.onManifestLoaded=function(v,p){var u=[],y=[],d=[],h,s={},a,g=!1,m=!1,b=!1;if(p.levels.forEach(function(ee){var G=ee.attrs;g=g||!!(ee.width&&ee.height),m=m||!!ee.videoCodec,b=b||!!ee.audioCodec,S&&ee.audioCodec&&ee.audioCodec.indexOf("mp4a.40.34")!==-1&&(ee.audioCodec=void 0);var F=ee.bitrate+"-"+ee.attrs.RESOLUTION+"-"+ee.attrs.CODECS;a=s[F],a?a.url.push(ee.url):(a=new Y.Level(ee),s[F]=a,u.push(a)),G&&(G.AUDIO&&Object(N.addGroupId)(a,"audio",G.AUDIO),G.SUBTITLES&&Object(N.addGroupId)(a,"text",G.SUBTITLES))}),(g||m)&&b&&(u=u.filter(function(ee){var G=ee.videoCodec,F=ee.width,ie=ee.height;return!!G||!!(F&&ie)})),u=u.filter(function(ee){var G=ee.audioCodec,F=ee.videoCodec;return(!G||Object(H.isCodecSupportedInMp4)(G,"audio"))&&(!F||Object(H.isCodecSupportedInMp4)(F,"video"))}),p.audioTracks&&(y=p.audioTracks.filter(function(ee){return!ee.audioCodec||Object(H.isCodecSupportedInMp4)(ee.audioCodec,"audio")}),Object(N.assignTrackIdsByGroup)(y)),p.subtitles&&(d=p.subtitles,Object(N.assignTrackIdsByGroup)(d)),u.length>0){h=u[0].bitrate,u.sort(function(ee,G){return ee.bitrate-G.bitrate}),this._levels=u;for(var M=0;M<u.length;M++)if(u[M].bitrate===h){this._firstLevel=M,this.log("manifest loaded, "+u.length+" level(s) found, first bitrate: "+h);break}var K=b&&!m,z={levels:u,audioTracks:y,subtitleTracks:d,firstLevel:this._firstLevel,stats:p.stats,audio:b,video:m,altAudio:!K&&y.some(function(ee){return!!ee.url})};this.hls.trigger(U.Events.MANIFEST_PARSED,z),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(U.Events.ERROR,{type:O.ErrorTypes.MEDIA_ERROR,details:O.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:p.url,reason:"no level with compatible codecs found in manifest"})},c.onError=function(v,p){if(l.prototype.onError.call(this,v,p),p.fatal)return;var u=p.context,y=this._levels[this.currentLevelIndex];if(u&&(u.type===L.PlaylistContextType.AUDIO_TRACK&&y.audioGroupIds&&u.groupId===y.audioGroupIds[y.urlId]||u.type===L.PlaylistContextType.SUBTITLE_TRACK&&y.textGroupIds&&u.groupId===y.textGroupIds[y.urlId])){this.redundantFailover(this.currentLevelIndex);return}var d=!1,h=!0,s;switch(p.details){case O.ErrorDetails.FRAG_LOAD_ERROR:case O.ErrorDetails.FRAG_LOAD_TIMEOUT:case O.ErrorDetails.KEY_LOAD_ERROR:case O.ErrorDetails.KEY_LOAD_TIMEOUT:if(p.frag){var a=this._levels[p.frag.level];a?(a.fragmentError++,a.fragmentError>this.hls.config.fragLoadingMaxRetry&&(s=p.frag.level)):s=p.frag.level}break;case O.ErrorDetails.LEVEL_LOAD_ERROR:case O.ErrorDetails.LEVEL_LOAD_TIMEOUT:u&&(u.deliveryDirectives&&(h=!1),s=u.level),d=!0;break;case O.ErrorDetails.REMUX_ALLOC_ERROR:s=p.level,d=!0;break}s!==void 0&&this.recoverLevel(p,s,d,h)},c.recoverLevel=function(v,p,u,y){var d=v.details,h=this._levels[p];if(h.loadError++,u){var s=this.retryLoadingOrFail(v);if(s)v.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(y){var a=h.url.length;if(a>1&&h.loadError<a)v.levelRetry=!0,this.redundantFailover(p);else if(this.manualLevelIndex===-1){var g=p===0?this._levels.length-1:p-1;this.currentLevelIndex!==g&&this._levels[g].loadError===0&&(this.warn(d+": switch to "+g),v.levelRetry=!0,this.hls.nextAutoLevel=g)}}},c.redundantFailover=function(v){var p=this._levels[v],u=p.url.length;if(u>1){var y=(p.urlId+1)%u;this.warn("Switching to redundant URL-id "+y),this._levels.forEach(function(d){d.urlId=y}),this.level=v}},c.onFragLoaded=function(v,p){var u=p.frag;if(u!==void 0&&u.type===L.PlaylistLevelType.MAIN){var y=this._levels[u.level];y!==void 0&&(y.fragmentError=0,y.loadError=0)}},c.onLevelLoaded=function(v,p){var u,y=p.level,d=p.details,h=this._levels[y];if(!h){var s;this.warn("Invalid level index "+y),(s=p.deliveryDirectives)!==null&&s!==void 0&&s.skip&&(d.deltaUpdateFailed=!0);return}y===this.currentLevelIndex?(h.fragmentError===0&&(h.loadError=0,this.retryCount=0),this.playlistLoaded(y,p,h.details)):(u=p.deliveryDirectives)!==null&&u!==void 0&&u.skip&&(d.deltaUpdateFailed=!0)},c.onAudioTrackSwitched=function(v,p){var u=this.hls.levels[this.currentLevelIndex];if(!u)return;if(u.audioGroupIds){for(var y=-1,d=this.hls.audioTracks[p.id].groupId,h=0;h<u.audioGroupIds.length;h++)if(u.audioGroupIds[h]===d){y=h;break}y!==u.urlId&&(u.urlId=y,this.startLoad())}},c.loadPlaylist=function(v){var p=this.currentLevelIndex,u=this._levels[p];if(this.canLoad&&u&&u.url.length>0){var y=u.urlId,d=u.url[y];if(v)try{d=v.addDirectives(d)}catch(h){this.warn("Could not construct new URL with HLS Delivery Directives: "+h)}this.log("Attempt loading level index "+p+(v?" at sn "+v.msn+" part "+v.part:"")+" with URL-id "+y+" "+d),this.clearTimer(),this.hls.trigger(U.Events.LEVEL_LOADING,{url:d,level:p,id:y,deliveryDirectives:v||null})}},c.removeLevel=function(v,p){var u=function(h,s){return s!==p},y=this._levels.filter(function(d,h){return h!==v?!0:d.url.length>1&&p!==void 0?(d.url=d.url.filter(u),d.audioGroupIds&&(d.audioGroupIds=d.audioGroupIds.filter(u)),d.textGroupIds&&(d.textGroupIds=d.textGroupIds.filter(u)),d.urlId=0,!0):!1}).map(function(d,h){var s=d.details;return s!=null&&s.fragments&&s.fragments.forEach(function(a){a.level=h}),d});this._levels=y,this.hls.trigger(U.Events.LEVELS_UPDATED,{levels:y})},D(i,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(v){var p,u=this._levels;if(u.length===0)return;if(this.currentLevelIndex===v&&(p=u[v])!==null&&p!==void 0&&p.details)return;if(v<0||v>=u.length){var y=v<0;if(this.hls.trigger(U.Events.ERROR,{type:O.ErrorTypes.OTHER_ERROR,details:O.ErrorDetails.LEVEL_SWITCH_ERROR,level:v,fatal:y,reason:"invalid level idx"}),y)return;v=Math.min(v,u.length-1)}this.clearTimer();var d=this.currentLevelIndex,h=u[d],s=u[v];this.log("switching to level "+v+" from "+d),this.currentLevelIndex=v;var a=_({},s,{level:v,maxBitrate:s.maxBitrate,uri:s.uri,urlId:s.urlId});delete a._urlId,this.hls.trigger(U.Events.LEVEL_SWITCHING,a);var g=s.details;if(!g||g.live){var m=this.switchParams(s.uri,h==null?void 0:h.details);this.loadPlaylist(m)}}},{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}(k.default)},"./src/controller/level-helper.ts":function(fe,$,P){"use strict";P.r($),P.d($,"addGroupId",function(){return O}),P.d($,"assignTrackIdsByGroup",function(){return H}),P.d($,"updatePTS",function(){return N}),P.d($,"updateFragPTSDTS",function(){return L}),P.d($,"mergeDetails",function(){return _}),P.d($,"mapPartIntersection",function(){return w}),P.d($,"mapFragmentIntersection",function(){return D}),P.d($,"adjustSliding",function(){return T}),P.d($,"addSliding",function(){return C}),P.d($,"computeReloadInterval",function(){return S}),P.d($,"getFragmentWithSN",function(){return f}),P.d($,"getPartWith",function(){return l});var Y=P("./src/polyfills/number.ts"),U=P("./src/utils/logger.ts");function O(i,c,E){switch(c){case"audio":i.audioGroupIds||(i.audioGroupIds=[]),i.audioGroupIds.push(E);break;case"text":i.textGroupIds||(i.textGroupIds=[]),i.textGroupIds.push(E);break}}function H(i){var c={};i.forEach(function(E){var v=E.groupId||"";E.id=c[v]=c[v]||0,c[v]++})}function N(i,c,E){var v=i[c],p=i[E];k(v,p)}function k(i,c){var E=c.startPTS;if(Object(Y.isFiniteNumber)(E)){var v=0,p;c.sn>i.sn?(v=E-i.start,p=i):(v=i.start-E,p=c),p.duration!==v&&(p.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,E,v,p,u){var y=v-E;y<=0&&(U.logger.warn("Fragment should have a positive duration",c),v=E+c.duration,u=p+c.duration);var d=E,h=v,s=c.startPTS,a=c.endPTS;if(Object(Y.isFiniteNumber)(s)){var g=Math.abs(s-E);Object(Y.isFiniteNumber)(c.deltaPTS)?c.deltaPTS=Math.max(g,c.deltaPTS):c.deltaPTS=g,d=Math.max(E,s),E=Math.min(E,s),p=Math.min(p,c.startDTS),h=Math.min(v,a),v=Math.max(v,a),u=Math.max(u,c.endDTS)}c.duration=v-E;var m=E-c.start;c.appendedPTS=v,c.start=c.startPTS=E,c.maxStartPTS=d,c.startDTS=p,c.endPTS=v,c.minEndPTS=h,c.endDTS=u;var b=c.sn;if(!i||b<i.startSN||b>i.endSN)return 0;var M,K=b-i.startSN,z=i.fragments;for(z[K]=c,M=K;M>0;M--)k(z[M],z[M-1]);for(M=K;M<z.length-1;M++)k(z[M],z[M+1]);return i.fragmentHint&&k(z[z.length-1],i.fragmentHint),i.PTSKnown=i.alignedSliding=!0,m}function _(i,c){for(var E=null,v=i.fragments,p=v.length-1;p>=0;p--){var u=v[p].initSegment;if(u){E=u;break}}i.fragmentHint&&delete i.fragmentHint.endPTS;var y=0,d;if(D(i,c,function(M,K){M.relurl&&(y=M.cc-K.cc),Object(Y.isFiniteNumber)(M.startPTS)&&Object(Y.isFiniteNumber)(M.endPTS)&&(K.start=K.startPTS=M.startPTS,K.startDTS=M.startDTS,K.appendedPTS=M.appendedPTS,K.maxStartPTS=M.maxStartPTS,K.endPTS=M.endPTS,K.endDTS=M.endDTS,K.minEndPTS=M.minEndPTS,K.duration=M.endPTS-M.startPTS,K.duration&&(d=K),c.PTSKnown=c.alignedSliding=!0),K.elementaryStreams=M.elementaryStreams,K.loader=M.loader,K.stats=M.stats,K.urlId=M.urlId,M.initSegment&&(K.initSegment=M.initSegment,E=M.initSegment)}),E){var h=c.fragmentHint?c.fragments.concat(c.fragmentHint):c.fragments;h.forEach(function(M){var K;(!M.initSegment||M.initSegment.relurl===((K=E)===null||K===void 0?void 0:K.relurl))&&(M.initSegment=E)})}if(c.skippedSegments&&(c.deltaUpdateFailed=c.fragments.some(function(M){return!M}),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 a=c.fragments;if(y){U.logger.warn("discontinuity sliding from playlist, take drift into account");for(var g=0;g<a.length;g++)a[g].cc+=y}c.skippedSegments&&(c.startCC=c.fragments[0].cc),w(i.partList,c.partList,function(M,K){K.elementaryStreams=M.elementaryStreams,K.stats=M.stats}),d?L(c,d,d.startPTS,d.endPTS,d.startDTS,d.endDTS):T(i,c),a.length&&(c.totalduration=c.edge-a[0].start),c.driftStartTime=i.driftStartTime,c.driftStart=i.driftStart;var m=c.advancedDateTime;if(c.advanced&&m){var b=c.edge;c.driftStart||(c.driftStartTime=m,c.driftStart=b),c.driftEndTime=m,c.driftEnd=b}else c.driftEndTime=i.driftEndTime,c.driftEnd=i.driftEnd,c.advancedDateTime=i.advancedDateTime}function w(i,c,E){if(i&&c)for(var v=0,p=0,u=i.length;p<=u;p++){var y=i[p],d=c[p+v];y&&d&&y.index===d.index&&y.fragment.sn===d.fragment.sn?E(y,d):v--}}function D(i,c,E){for(var v=c.skippedSegments,p=Math.max(i.startSN,c.startSN)-c.startSN,u=(i.fragmentHint?1:0)+(v?c.endSN:Math.min(i.endSN,c.endSN))-c.startSN,y=c.startSN-i.startSN,d=c.fragmentHint?c.fragments.concat(c.fragmentHint):c.fragments,h=i.fragmentHint?i.fragments.concat(i.fragmentHint):i.fragments,s=p;s<=u;s++){var a=h[y+s],g=d[s];v&&!g&&s<v&&(g=c.fragments[s]=a),a&&g&&E(a,g)}}function T(i,c){var E=c.startSN+c.skippedSegments-i.startSN,v=i.fragments;if(E<0||E>=v.length)return;C(c,v[E].start)}function C(i,c){if(c){for(var E=i.fragments,v=i.skippedSegments;v<E.length;v++)E[v].start+=c;i.fragmentHint&&(i.fragmentHint.start+=c)}}function S(i,c){var E=1e3*i.levelTargetDuration,v=E/2,p=i.age,u=p>0&&p<E*3,y=c.loading.end-c.loading.start,d,h=i.availabilityDelay;if(i.updated===!1)if(u){var s=333*i.misses;d=Math.max(Math.min(v,y*2),s),i.availabilityDelay=(i.availabilityDelay||0)+d}else d=v;else u?(h=Math.min(h||E/2,p),i.availabilityDelay=h,d=h+E-p):d=E-y;return Math.round(d)}function f(i,c,E){if(!i||!i.details)return null;var v=i.details,p=v.fragments[c-v.startSN];return p||(p=v.fragmentHint,p&&p.sn===c?p:c<v.startSN&&E&&E.sn===c?E:null)}function l(i,c,E){if(!i||!i.details)return null;var v=i.details.partList;if(v)for(var p=v.length;p--;){var u=v[p];if(u.index===E&&u.fragment.sn===c)return u}return null}},"./src/controller/stream-controller.ts":function(fe,$,P){"use strict";P.r($),P.d($,"default",function(){return v});var Y=P("./src/polyfills/number.ts"),U=P("./src/controller/base-stream-controller.ts"),O=P("./src/is-supported.ts"),H=P("./src/events.ts"),N=P("./src/utils/buffer-helper.ts"),k=P("./src/controller/fragment-tracker.ts"),L=P("./src/types/loader.ts"),_=P("./src/loader/fragment.ts"),w=P("./src/demux/transmuxer-interface.ts"),D=P("./src/types/transmuxer.ts"),T=P("./src/controller/gap-controller.ts"),C=P("./src/errors.ts"),S=P("./src/utils/logger.ts");function f(p,u){for(var y=0;y<u.length;y++){var d=u[y];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(p,d.key,d)}}function l(p,u,y){return u&&f(p.prototype,u),y&&f(p,y),p}function i(p,u){p.prototype=Object.create(u.prototype),p.prototype.constructor=p,c(p,u)}function c(p,u){return c=Object.setPrototypeOf||function(d,h){return d.__proto__=h,d},c(p,u)}var E=100,v=function(p){i(u,p);function u(d,h){var s;return s=p.call(this,d,h,"[stream-controller]")||this,s.audioCodecSwap=!1,s.gapController=null,s.level=-1,s._forceStartLoad=!1,s.altAudio=!1,s.audioOnly=!1,s.fragPlaying=null,s.onvplaying=null,s.onvseeked=null,s.fragLastKbps=0,s.stalled=!1,s.couldBacktrack=!1,s.audioCodecSwitch=!1,s.videoBuffer=null,s._registerListeners(),s}var y=u.prototype;return y._registerListeners=function(){var h=this.hls;h.on(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),h.on(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),h.on(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.on(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),h.on(H.Events.LEVEL_LOADING,this.onLevelLoading,this),h.on(H.Events.LEVEL_LOADED,this.onLevelLoaded,this),h.on(H.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),h.on(H.Events.ERROR,this.onError,this),h.on(H.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),h.on(H.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),h.on(H.Events.BUFFER_CREATED,this.onBufferCreated,this),h.on(H.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),h.on(H.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),h.on(H.Events.FRAG_BUFFERED,this.onFragBuffered,this)},y._unregisterListeners=function(){var h=this.hls;h.off(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),h.off(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),h.off(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.off(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),h.off(H.Events.LEVEL_LOADED,this.onLevelLoaded,this),h.off(H.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),h.off(H.Events.ERROR,this.onError,this),h.off(H.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),h.off(H.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),h.off(H.Events.BUFFER_CREATED,this.onBufferCreated,this),h.off(H.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),h.off(H.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),h.off(H.Events.FRAG_BUFFERED,this.onFragBuffered,this)},y.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},y.startLoad=function(h){if(this.levels){var s=this.lastCurrentTime,a=this.hls;if(this.stopLoad(),this.setInterval(E),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var g=a.startLevel;g===-1&&(a.config.testBandwidth?(g=0,this.bitrateTest=!0):g=a.nextAutoLevel),this.level=a.nextLoadLevel=g,this.loadedmetadata=!1}s>0&&h===-1&&(this.log("Override startPosition with lastCurrentTime @"+s.toFixed(3)),h=s),this.state=U.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=h,this.tick()}else this._forceStartLoad=!0,this.state=U.State.STOPPED},y.stopLoad=function(){this._forceStartLoad=!1,p.prototype.stopLoad.call(this)},y.doTick=function(){switch(this.state){case U.State.IDLE:this.doTickIdle();break;case U.State.WAITING_LEVEL:{var h,s=this.levels,a=this.level,g=s==null||((h=s[a])===null||h===void 0)?void 0:h.details;if(g&&(!g.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(g))break;this.state=U.State.IDLE;break}break}case U.State.FRAG_LOADING_WAITING_RETRY:{var m,b=self.performance.now(),M=this.retryDate;(!M||b>=M||(m=this.media)!==null&&m!==void 0&&m.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=U.State.IDLE)}break;default:break}this.onTickEnd()},y.onTickEnd=function(){p.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},y.doTickIdle=function(){var h,s,a=this.hls,g=this.levelLastLoaded,m=this.levels,b=this.media,M=a.config,K=a.nextLoadLevel;if(g===null||!b&&(this.startFragRequested||!M.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!m||!m[K])return;var z=m[K];this.level=a.nextLoadLevel=K;var ee=z.details;if(!ee||this.state===U.State.WAITING_LEVEL||ee.live&&this.levelLastLoaded!==K){this.state=U.State.WAITING_LEVEL;return}var G=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:b,L.PlaylistLevelType.MAIN);if(G===null)return;var F=G.len,ie=this.getMaxBufferLength(z.maxBitrate);if(F>=ie)return;if(this._streamEnded(G,ee)){var ge={};this.altAudio&&(ge.type="video"),this.hls.trigger(H.Events.BUFFER_EOS,ge),this.state=U.State.ENDED;return}var ye=G.end,xe=this.getNextFragment(ye,ee);if(this.couldBacktrack&&!this.fragPrevious&&xe&&xe.sn!=="initSegment"){var Te=xe.sn-ee.startSN;Te>1&&(xe=ee.fragments[Te-1],this.fragmentTracker.removeFragment(xe))}if(xe&&this.fragmentTracker.getState(xe)===k.FragmentState.OK&&this.nextLoadPosition>ye){var Se=this.audioOnly&&!this.altAudio?_.ElementaryStreamTypes.AUDIO:_.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(b,Se,L.PlaylistLevelType.MAIN),xe=this.getNextFragment(this.nextLoadPosition,ee)}if(!xe)return;xe.initSegment&&!xe.initSegment.data&&!this.bitrateTest&&(xe=xe.initSegment),((h=xe.decryptdata)===null||h===void 0?void 0:h.keyFormat)==="identity"&&!((s=xe.decryptdata)!==null&&s!==void 0&&s.key)?this.loadKey(xe,ee):this.loadFragment(xe,ee,ye)},y.loadFragment=function(h,s,a){var g,m=this.fragmentTracker.getState(h);if(this.fragCurrent=h,m===k.FragmentState.BACKTRACKED){var b=this.fragmentTracker.getBacktrackData(h);if(b){this._handleFragmentLoadProgress(b),this._handleFragmentLoadComplete(b);return}else m=k.FragmentState.NOT_LOADED}m===k.FragmentState.NOT_LOADED||m===k.FragmentState.PARTIAL?h.sn==="initSegment"?this._loadInitSegment(h):this.bitrateTest?(h.bitrateTest=!0,this.log("Fragment "+h.sn+" of level "+h.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(h)):(this.startFragRequested=!0,p.prototype.loadFragment.call(this,h,s,a)):m===k.FragmentState.APPENDING?this.reduceMaxBufferLength(h.duration)&&this.fragmentTracker.removeFragment(h):((g=this.media)===null||g===void 0?void 0:g.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},y.getAppendedFrag=function(h){var s=this.fragmentTracker.getAppendedFrag(h,L.PlaylistLevelType.MAIN);return s&&"fragment"in s?s.fragment:s},y.getBufferedFrag=function(h){return this.fragmentTracker.getBufferedFrag(h,L.PlaylistLevelType.MAIN)},y.followingBufferedFrag=function(h){return h?this.getBufferedFrag(h.end+.5):null},y.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},y.nextLevelSwitch=function(){var h=this.levels,s=this.media;if(s!=null&&s.readyState){var a,g=this.getAppendedFrag(s.currentTime);if(g&&g.start>1&&this.flushMainBuffer(0,g.start-1),!s.paused&&h){var m=this.hls.nextLoadLevel,b=h[m],M=this.fragLastKbps;M&&this.fragCurrent?a=this.fragCurrent.duration*b.maxBitrate/(1e3*M)+1:a=0}else a=0;var K=this.getBufferedFrag(s.currentTime+a);if(K){var z=this.followingBufferedFrag(K);if(z){this.abortCurrentFrag();var ee=z.maxStartPTS?z.maxStartPTS:z.start,G=z.duration,F=Math.max(K.end,ee+Math.min(Math.max(G-this.config.maxFragLookUpTolerance,G*.5),G*.75));this.flushMainBuffer(F,Number.POSITIVE_INFINITY)}}}},y.abortCurrentFrag=function(){var h=this.fragCurrent;this.fragCurrent=null,h!=null&&h.loader&&h.loader.abort(),this.state===U.State.KEY_LOADING&&(this.state=U.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},y.flushMainBuffer=function(h,s){p.prototype.flushMainBuffer.call(this,h,s,this.altAudio?"video":null)},y.onMediaAttached=function(h,s){p.prototype.onMediaAttached.call(this,h,s);var a=s.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),a.addEventListener("playing",this.onvplaying),a.addEventListener("seeked",this.onvseeked),this.gapController=new T.default(this.config,a,this.fragmentTracker,this.hls)},y.onMediaDetaching=function(){var h=this.media;h&&(h.removeEventListener("playing",this.onvplaying),h.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),p.prototype.onMediaDetaching.call(this)},y.onMediaPlaying=function(){this.tick()},y.onMediaSeeked=function(){var h=this.media,s=h?h.currentTime:null;Object(Y.isFiniteNumber)(s)&&this.log("Media seeked to "+s.toFixed(3)),this.tick()},y.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(H.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},y.onManifestParsed=function(h,s){var a=!1,g=!1,m;s.levels.forEach(function(b){m=b.audioCodec,m&&(m.indexOf("mp4a.40.2")!==-1&&(a=!0),m.indexOf("mp4a.40.5")!==-1&&(g=!0))}),this.audioCodecSwitch=a&&g&&!Object(O.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=s.levels,this.startFragRequested=!1},y.onLevelLoading=function(h,s){var a=this.levels;if(!a||this.state!==U.State.IDLE)return;var g=a[s.level];(!g.details||g.details.live&&this.levelLastLoaded!==s.level||this.waitForCdnTuneIn(g.details))&&(this.state=U.State.WAITING_LEVEL)},y.onLevelLoaded=function(h,s){var a,g=this.levels,m=s.level,b=s.details,M=b.totalduration;if(!g){this.warn("Levels were reset while loading level "+m);return}this.log("Level "+m+" loaded ["+b.startSN+","+b.endSN+"], cc ["+b.startCC+", "+b.endCC+"] duration:"+M);var K=this.fragCurrent;K&&(this.state===U.State.FRAG_LOADING||this.state===U.State.FRAG_LOADING_WAITING_RETRY)&&(K.level!==s.level&&K.loader&&(this.state=U.State.IDLE,K.loader.abort()));var z=g[m],ee=0;if(b.live||(a=z.details)!==null&&a!==void 0&&a.live){if(b.fragments[0]||(b.deltaUpdateFailed=!0),b.deltaUpdateFailed)return;ee=this.alignPlaylists(b,z.details)}if(z.details=b,this.levelLastLoaded=m,this.hls.trigger(H.Events.LEVEL_UPDATED,{details:b,level:m}),this.state===U.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(b))return;this.state=U.State.IDLE}this.startFragRequested?b.live&&this.synchronizeToLiveEdge(b):this.setStartPosition(b,ee),this.tick()},y._handleFragmentLoadProgress=function(h){var s,a=h.frag,g=h.part,m=h.payload,b=this.levels;if(!b){this.warn("Levels were reset while fragment load was in progress. Fragment "+a.sn+" of level "+a.level+" will not be buffered");return}var M=b[a.level],K=M.details;if(!K){this.warn("Dropping fragment "+a.sn+" of level "+a.level+" after level details were reset");return}var z=M.videoCodec,ee=K.PTSKnown||!K.live,G=(s=a.initSegment)===null||s===void 0?void 0:s.data,F=this._getAudioCodec(M),ie=this.transmuxer=this.transmuxer||new w.default(this.hls,L.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),ge=g?g.index:-1,ye=ge!==-1,xe=new D.ChunkMetadata(a.level,a.sn,a.stats.chunkCount,m.byteLength,ge,ye),Te=this.initPTS[a.cc];ie.push(m,G,F,z,a,g,K.totalduration,ee,xe,Te)},y.onAudioTrackSwitching=function(h,s){var a=this.altAudio,g=!!s.url,m=s.id;if(!g){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var b=this.fragCurrent;b!=null&&b.loader&&(this.log("Switching to main audio track, cancel main fragment load"),b.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var M=this.hls;a&&M.trigger(H.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),M.trigger(H.Events.AUDIO_TRACK_SWITCHED,{id:m})}},y.onAudioTrackSwitched=function(h,s){var a=s.id,g=!!this.hls.audioTracks[a].url;if(g){var m=this.videoBuffer;m&&this.mediaBuffer!==m&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=m)}this.altAudio=g,this.tick()},y.onBufferCreated=function(h,s){var a=s.tracks,g,m,b=!1;for(var M in a){var K=a[M];if(K.id==="main"){if(m=M,g=K,M==="video"){var z=a[M];z&&(this.videoBuffer=z.buffer)}}else b=!0}b&&g?(this.log("Alternate track found, use "+m+".buffered to schedule main fragment loading"),this.mediaBuffer=g.buffer):this.mediaBuffer=this.media},y.onFragBuffered=function(h,s){var a=s.frag,g=s.part;if(a&&a.type!==L.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(a)){this.warn("Fragment "+a.sn+(g?" p: "+g.index:"")+" of level "+a.level+" finished buffering, but was aborted. state: "+this.state),this.state===U.State.PARSED&&(this.state=U.State.IDLE);return}var m=g?g.stats:a.stats;this.fragLastKbps=Math.round(8*m.total/(m.buffering.end-m.loading.first)),a.sn!=="initSegment"&&(this.fragPrevious=a),this.fragBufferedComplete(a,g)},y.onError=function(h,s){switch(s.details){case C.ErrorDetails.FRAG_LOAD_ERROR:case C.ErrorDetails.FRAG_LOAD_TIMEOUT:case C.ErrorDetails.KEY_LOAD_ERROR:case C.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(L.PlaylistLevelType.MAIN,s);break;case C.ErrorDetails.LEVEL_LOAD_ERROR:case C.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 C.ErrorDetails.BUFFER_FULL_ERROR:if(s.parent==="main"&&(this.state===U.State.PARSING||this.state===U.State.PARSED)){var a=!0,g=this.getFwdBufferInfo(this.media,L.PlaylistLevelType.MAIN);g&&g.len>.5&&(a=!this.reduceMaxBufferLength(g.len)),a&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},y.checkBuffer=function(){var h=this.media,s=this.gapController;if(!h||!s||!h.readyState)return;var a=N.BufferHelper.getBuffered(h);!this.loadedmetadata&&a.length?(this.loadedmetadata=!0,this.seekToStartPos()):s.poll(this.lastCurrentTime),this.lastCurrentTime=h.currentTime},y.onFragLoadEmergencyAborted=function(){this.state=U.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},y.onBufferFlushed=function(h,s){var a=s.type;if(a!==_.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var g=(a===_.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(g,a,L.PlaylistLevelType.MAIN)}},y.onLevelsUpdated=function(h,s){this.levels=s.levels},y.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},y.seekToStartPos=function(){var h=this.media,s=h.currentTime,a=this.startPosition;if(a>=0&&s<a){if(h.seeking){S.logger.log("could not seek to "+a+", already seeking at "+s);return}var g=N.BufferHelper.getBuffered(h),m=g.length?g.start(0):0,b=m-a;b>0&&(b<this.config.maxBufferHole||b<this.config.maxFragLookUpTolerance)&&(S.logger.log("adjusting start position by "+b+" to match buffer start"),a+=b,this.startPosition=a),this.log("seek to target start position "+a+" from current time "+s),h.currentTime=a}},y._getAudioCodec=function(h){var s=this.config.defaultAudioCodec||h.audioCodec;return this.audioCodecSwap&&s&&(this.log("Swapping audio codec"),s.indexOf("mp4a.40.5")!==-1?s="mp4a.40.2":s="mp4a.40.5"),s},y._loadBitrateTestFrag=function(h){var s=this;this._doFragLoad(h).then(function(a){var g=s.hls;if(!a||g.nextLoadLevel||s.fragContextChanged(h))return;s.fragLoadError=0,s.state=U.State.IDLE,s.startFragRequested=!1,s.bitrateTest=!1;var m=h.stats;m.parsing.start=m.parsing.end=m.buffering.start=m.buffering.end=self.performance.now(),g.trigger(H.Events.FRAG_LOADED,a)})},y._handleTransmuxComplete=function(h){var s,a="main",g=this.hls,m=h.remuxResult,b=h.chunkMeta,M=this.getCurrentContext(b);if(!M){this.warn("The loading context changed while buffering fragment "+b.sn+" of level "+b.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(b.level);return}var K=M.frag,z=M.part,ee=M.level,G=m.video,F=m.text,ie=m.id3,ge=m.initSegment,ye=this.altAudio?void 0:m.audio;if(this.fragContextChanged(K))return;if(this.state=U.State.PARSING,ge){ge.tracks&&(this._bufferInitSegment(ee,ge.tracks,K,b),g.trigger(H.Events.FRAG_PARSING_INIT_SEGMENT,{frag:K,id:a,tracks:ge.tracks}));var xe=ge.initPTS,Te=ge.timescale;Object(Y.isFiniteNumber)(xe)&&(this.initPTS[K.cc]=xe,g.trigger(H.Events.INIT_PTS_FOUND,{frag:K,id:a,initPTS:xe,timescale:Te}))}if(G&&m.independent!==!1){if(ee.details){var Se=G.startPTS,me=G.endPTS,pe=G.startDTS,Ee=G.endDTS;if(z)z.elementaryStreams[G.type]={startPTS:Se,endPTS:me,startDTS:pe,endDTS:Ee};else if(G.firstKeyFrame&&G.independent&&(this.couldBacktrack=!0),G.dropped&&G.independent){var le=this.getLoadPosition()+this.config.maxBufferHole;if(le<Se){this.backtrack(K);return}K.setElementaryStreamInfo(G.type,K.start,me,K.start,Ee,!0)}K.setElementaryStreamInfo(G.type,Se,me,pe,Ee),this.bufferFragmentData(G,K,z,b)}}else if(m.independent===!1){this.backtrack(K);return}if(ye){var I=ye.startPTS,x=ye.endPTS,R=ye.startDTS,W=ye.endDTS;z&&(z.elementaryStreams[_.ElementaryStreamTypes.AUDIO]={startPTS:I,endPTS:x,startDTS:R,endDTS:W}),K.setElementaryStreamInfo(_.ElementaryStreamTypes.AUDIO,I,x,R,W),this.bufferFragmentData(ye,K,z,b)}if(ie!=null&&(s=ie.samples)!==null&&s!==void 0&&s.length){var J={frag:K,id:a,samples:ie.samples};g.trigger(H.Events.FRAG_PARSING_METADATA,J)}if(F){var B={frag:K,id:a,samples:F.samples};g.trigger(H.Events.FRAG_PARSING_USERDATA,B)}},y._bufferInitSegment=function(h,s,a,g){var m=this;if(this.state!==U.State.PARSING)return;this.audioOnly=!!s.audio&&!s.video,this.altAudio&&!this.audioOnly&&delete s.audio;var b=s.audio,M=s.video,K=s.audiovideo;if(b){var z=h.audioCodec,ee=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(z&&(z.indexOf("mp4a.40.5")!==-1?z="mp4a.40.2":z="mp4a.40.5"),b.metadata.channelCount!==1&&ee.indexOf("firefox")===-1&&(z="mp4a.40.5")),ee.indexOf("android")!==-1&&b.container!=="audio/mpeg"&&(z="mp4a.40.2",this.log("Android: force audio codec to "+z)),h.audioCodec&&h.audioCodec!==z&&this.log('Swapping manifest audio codec "'+h.audioCodec+'" for "'+z+'"'),b.levelCodec=z,b.id="main",this.log("Init audio buffer, container:"+b.container+", codecs[selected/level/parsed]=["+(z||"")+"/"+(h.audioCodec||"")+"/"+b.codec+"]")}M&&(M.levelCodec=h.videoCodec,M.id="main",this.log("Init video buffer, container:"+M.container+", codecs[level/parsed]=["+(h.videoCodec||"")+"/"+M.codec+"]")),K&&this.log("Init audiovideo buffer, container:"+K.container+", codecs[level/parsed]=["+(h.attrs.CODECS||"")+"/"+K.codec+"]"),this.hls.trigger(H.Events.BUFFER_CODECS,s),Object.keys(s).forEach(function(G){var F=s[G],ie=F.initSegment;ie!=null&&ie.byteLength&&m.hls.trigger(H.Events.BUFFER_APPENDING,{type:G,data:ie,frag:a,part:null,chunkMeta:g,parent:a.type})}),this.tick()},y.backtrack=function(h){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(h);var s=this.fragmentTracker.backtrack(h);this.fragPrevious=null,this.nextLoadPosition=h.start,s?this.resetFragmentLoading(h):this.state=U.State.BACKTRACKING},y.checkFragmentChanged=function(){var h=this.media,s=null;if(h&&h.readyState>1&&h.seeking===!1){var a=h.currentTime;if(N.BufferHelper.isBuffered(h,a)?s=this.getAppendedFrag(a):N.BufferHelper.isBuffered(h,a+.1)&&(s=this.getAppendedFrag(a+.1)),s){var g=this.fragPlaying,m=s.level;(!g||s.sn!==g.sn||g.level!==m||s.urlId!==g.urlId)&&(this.hls.trigger(H.Events.FRAG_CHANGED,{frag:s}),(!g||g.level!==m)&&this.hls.trigger(H.Events.LEVEL_SWITCHED,{level:m}),this.fragPlaying=s)}}},l(u,[{key:"nextLevel",get:function(){var h=this.nextBufferedFrag;return h?h.level:-1}},{key:"currentLevel",get:function(){var h=this.media;if(h){var s=this.getAppendedFrag(h.currentTime);if(s)return s.level}return-1}},{key:"nextBufferedFrag",get:function(){var h=this.media;if(h){var s=this.getAppendedFrag(h.currentTime);return this.followingBufferedFrag(s)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),u}(U.default)},"./src/controller/subtitle-stream-controller.ts":function(fe,$,P){"use strict";P.r($),P.d($,"SubtitleStreamController",function(){return i});var Y=P("./src/events.ts"),U=P("./src/utils/logger.ts"),O=P("./src/utils/buffer-helper.ts"),H=P("./src/controller/fragment-finders.ts"),N=P("./src/utils/discontinuities.ts"),k=P("./src/controller/level-helper.ts"),L=P("./src/controller/fragment-tracker.ts"),_=P("./src/controller/base-stream-controller.ts"),w=P("./src/types/loader.ts"),D=P("./src/types/level.ts");function T(c,E){for(var v=0;v<E.length;v++){var p=E[v];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(c,p.key,p)}}function C(c,E,v){return E&&T(c.prototype,E),v&&T(c,v),c}function S(c,E){c.prototype=Object.create(E.prototype),c.prototype.constructor=c,f(c,E)}function f(c,E){return f=Object.setPrototypeOf||function(p,u){return p.__proto__=u,p},f(c,E)}var l=500,i=function(c){S(E,c);function E(p,u){var y;return y=c.call(this,p,u,"[subtitle-stream-controller]")||this,y.levels=[],y.currentTrackId=-1,y.tracksBuffered=[],y.mainDetails=null,y._registerListeners(),y}var v=E.prototype;return v.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},v._registerListeners=function(){var u=this.hls;u.on(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),u.on(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.on(Y.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.on(Y.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.on(Y.Events.ERROR,this.onError,this),u.on(Y.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),u.on(Y.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),u.on(Y.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),u.on(Y.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),u.on(Y.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},v._unregisterListeners=function(){var u=this.hls;u.off(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),u.off(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.off(Y.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.off(Y.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.off(Y.Events.ERROR,this.onError,this),u.off(Y.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),u.off(Y.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),u.off(Y.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),u.off(Y.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),u.off(Y.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},v.startLoad=function(){this.stopLoad(),this.state=_.State.IDLE,this.setInterval(l),this.tick()},v.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},v.onLevelLoaded=function(u,y){this.mainDetails=y.details},v.onSubtitleFragProcessed=function(u,y){var d=y.frag,h=y.success;if(this.fragPrevious=d,this.state=_.State.IDLE,!h)return;var s=this.tracksBuffered[this.currentTrackId];if(!s)return;for(var a,g=d.start,m=0;m<s.length;m++)if(g>=s[m].start&&g<=s[m].end){a=s[m];break}var b=d.start+d.duration;a?a.end=b:(a={start:g,end:b},s.push(a)),this.fragmentTracker.fragBuffered(d)},v.onBufferFlushing=function(u,y){var d=y.startOffset,h=y.endOffset;if(d===0&&h!==Number.POSITIVE_INFINITY){var s=this.currentTrackId,a=this.levels;if(!a.length||!a[s]||!a[s].details)return;var g=a[s].details,m=g.targetduration,b=h-m;if(b<=0)return;y.endOffsetSubtitles=Math.max(0,b),this.tracksBuffered.forEach(function(M){for(var K=0;K<M.length;){if(M[K].end<=b){M.shift();continue}else if(M[K].start<b)M[K].start=b;else break;K++}}),this.fragmentTracker.removeFragmentsInRange(d,b,w.PlaylistLevelType.SUBTITLE)}},v.onError=function(u,y){var d,h=y.frag;if(!h||h.type!==w.PlaylistLevelType.SUBTITLE)return;(d=this.fragCurrent)!==null&&d!==void 0&&d.loader&&this.fragCurrent.loader.abort(),this.state=_.State.IDLE},v.onSubtitleTracksUpdated=function(u,y){var d=this,h=y.subtitleTracks;this.tracksBuffered=[],this.levels=h.map(function(s){return new D.Level(s)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(s){d.tracksBuffered[s.id]=[]}),this.mediaBuffer=null},v.onSubtitleTrackSwitch=function(u,y){if(this.currentTrackId=y.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var d=this.levels[this.currentTrackId];d!=null&&d.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,d&&this.setInterval(l)},v.onSubtitleTrackLoaded=function(u,y){var d,h=y.details,s=y.id,a=this.currentTrackId,g=this.levels;if(!g.length)return;var m=g[a];if(s>=g.length||s!==a||!m)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,h.live||(d=m.details)!==null&&d!==void 0&&d.live){var b=this.mainDetails;if(h.deltaUpdateFailed||!b)return;var M=b.fragments[0];if(!m.details)h.hasProgramDateTime&&b.hasProgramDateTime?Object(N.alignMediaPlaylistByPDT)(h,b):M&&Object(k.addSliding)(h,M.start);else{var K=this.alignPlaylists(h,m.details);K===0&&M&&Object(k.addSliding)(h,M.start)}}if(m.details=h,this.levelLastLoaded=s,this.tick(),h.live&&!this.fragCurrent&&this.media&&this.state===_.State.IDLE){var z=Object(H.findFragmentByPTS)(null,h.fragments,this.media.currentTime,0);z||(this.warn("Subtitle playlist not aligned with playback"),m.details=void 0)}},v._handleFragmentLoadComplete=function(u){var y=u.frag,d=u.payload,h=y.decryptdata,s=this.hls;if(this.fragContextChanged(y))return;if(d&&d.byteLength>0&&h&&h.key&&h.iv&&h.method==="AES-128"){var a=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(d),h.key.buffer,h.iv.buffer).then(function(g){var m=performance.now();s.trigger(Y.Events.FRAG_DECRYPTED,{frag:y,payload:g,stats:{tstart:a,tdecrypt:m}})})}},v.doTick=function(){if(!this.media){this.state=_.State.IDLE;return}if(this.state===_.State.IDLE){var u,y=this.currentTrackId,d=this.levels;if(!d.length||!d[y]||!d[y].details)return;var h=d[y].details,s=h.targetduration,a=this.config,g=this.media,m=O.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,g.currentTime-s,a.maxBufferHole),b=m.end,M=m.len,K=this.getMaxBufferLength()+s;if(M>K)return;console.assert(h,"Subtitle track details are defined on idle subtitle stream controller tick");var z=h.fragments,ee=z.length,G=h.edge,F,ie=this.fragPrevious;if(b<G){var ge=a.maxFragLookUpTolerance;ie&&h.hasProgramDateTime&&(F=Object(H.findFragmentByPDT)(z,ie.endProgramDateTime,ge)),F||(F=Object(H.findFragmentByPTS)(ie,z,b,ge),!F&&ie&&ie.start<z[0].start&&(F=z[0]))}else F=z[ee-1];(u=F)!==null&&u!==void 0&&u.encrypted?(U.logger.log("Loading key for "+F.sn),this.state=_.State.KEY_LOADING,this.hls.trigger(Y.Events.KEY_LOADING,{frag:F})):F&&this.fragmentTracker.getState(F)===L.FragmentState.NOT_LOADED&&this.loadFragment(F,h,b)}},v.loadFragment=function(u,y,d){this.fragCurrent=u,c.prototype.loadFragment.call(this,u,y,d)},C(E,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),E}(_.default)},"./src/controller/subtitle-track-controller.ts":function(fe,$,P){"use strict";P.r($);var Y=P("./src/events.ts"),U=P("./src/utils/texttrack-utils.ts"),O=P("./src/controller/base-playlist-controller.ts"),H=P("./src/types/loader.ts");function N(T,C){for(var S=0;S<C.length;S++){var f=C[S];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(T,f.key,f)}}function k(T,C,S){return C&&N(T.prototype,C),S&&N(T,S),T}function L(T,C){T.prototype=Object.create(C.prototype),T.prototype.constructor=T,_(T,C)}function _(T,C){return _=Object.setPrototypeOf||function(f,l){return f.__proto__=l,f},_(T,C)}var w=function(T){L(C,T);function C(f){var l;return l=T.call(this,f,"[subtitle-track-controller]")||this,l.media=null,l.tracks=[],l.groupId=null,l.tracksInGroup=[],l.trackId=-1,l.selectDefaultTrack=!0,l.queuedDefaultTrack=-1,l.trackChangeListener=function(){return l.onTextTracksChanged()},l.asyncPollTrackChange=function(){return l.pollTrackChange(0)},l.useTextTrackPolling=!1,l.subtitlePollingInterval=-1,l.subtitleDisplay=!0,l.registerListeners(),l}var S=C.prototype;return S.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,T.prototype.destroy.call(this)},S.registerListeners=function(){var l=this.hls;l.on(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),l.on(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.on(Y.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.on(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this),l.on(Y.Events.LEVEL_LOADING,this.onLevelLoading,this),l.on(Y.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),l.on(Y.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),l.on(Y.Events.ERROR,this.onError,this)},S.unregisterListeners=function(){var l=this.hls;l.off(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),l.off(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.off(Y.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.off(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this),l.off(Y.Events.LEVEL_LOADING,this.onLevelLoading,this),l.off(Y.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),l.off(Y.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),l.off(Y.Events.ERROR,this.onError,this)},S.onMediaAttached=function(l,i){if(this.media=i.media,!this.media)return;this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange)},S.pollTrackChange=function(l){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,l)},S.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=D(this.media.textTracks);l.forEach(function(i){Object(U.clearCurrentCues)(i)}),this.subtitleTrack=-1,this.media=null},S.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},S.onManifestParsed=function(l,i){this.tracks=i.subtitleTracks},S.onSubtitleTrackLoaded=function(l,i){var c=i.id,E=i.details,v=this.trackId,p=this.tracksInGroup[v];if(!p){this.warn("Invalid subtitle track id "+c);return}var u=p.details;p.details=i.details,this.log("subtitle track "+c+" loaded ["+E.startSN+"-"+E.endSN+"]"),c===this.trackId&&(this.retryCount=0,this.playlistLoaded(c,i,u))},S.onLevelLoading=function(l,i){this.switchLevel(i.level)},S.onLevelSwitching=function(l,i){this.switchLevel(i.level)},S.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 E=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,v=this.tracks.filter(function(y){return!c||y.groupId===c});this.tracksInGroup=v;var p=this.findTrackId(E==null?void 0:E.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),p!==-1&&this.setSubtitleTrack(p,E)}},S.findTrackId=function(l){for(var i=this.tracksInGroup,c=0;c<i.length;c++){var E=i[c];if((!this.selectDefaultTrack||E.default)&&(!l||l===E.name))return E.id}return-1},S.onError=function(l,i){if(T.prototype.onError.call(this,l,i),i.fatal||!i.context)return;i.context.type===H.PlaylistContextType.SUBTITLE_TRACK&&i.context.id===this.trackId&&i.context.groupId===this.groupId&&this.retryLoadingOrFail(i)},S.loadPlaylist=function(l){var i=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(i)){var c=i.id,E=i.groupId,v=i.url;if(l)try{v=l.addDirectives(v)}catch(p){this.warn("Could not construct new URL with HLS Delivery Directives: "+p)}this.log("Loading subtitle playlist for id "+c),this.hls.trigger(Y.Events.SUBTITLE_TRACK_LOADING,{url:v,id:c,groupId:E,deliveryDirectives:l||null})}},S.toggleTrackModes=function(l){var i=this,c=this.media,E=this.subtitleDisplay,v=this.trackId;if(!c)return;var p=D(c.textTracks),u=p.filter(function(h){return h.groupId===i.groupId});if(l===-1)[].slice.call(p).forEach(function(h){h.mode="disabled"});else{var y=u[v];y&&(y.mode="disabled")}var d=u[l];d&&(d.mode=E?"showing":"hidden")},S.setSubtitleTrack=function(l,i){var c,E=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=l;return}if(this.trackId!==l&&this.toggleTrackModes(l),this.trackId===l&&(l===-1||(c=E[l])!==null&&c!==void 0&&c.details)||l<-1||l>=E.length)return;this.clearTimer();var v=E[l];if(this.log("Switching to subtitle track "+l),this.trackId=l,v){var p=v.id,u=v.groupId,y=u===void 0?"":u,d=v.name,h=v.type,s=v.url;this.hls.trigger(Y.Events.SUBTITLE_TRACK_SWITCH,{id:p,groupId:y,name:d,type:h,url:s});var a=this.switchParams(v.url,i==null?void 0:i.details);this.loadPlaylist(a)}else this.hls.trigger(Y.Events.SUBTITLE_TRACK_SWITCH,{id:l})},S.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var l=-1,i=D(this.media.textTracks),c=0;c<i.length;c++)if(i[c].mode==="hidden")l=c;else if(i[c].mode==="showing"){l=c;break}this.subtitleTrack!==l&&(this.subtitleTrack=l)},k(C,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(l){this.selectDefaultTrack=!1;var i=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(l,i)}}]),C}(O.default);function D(T){for(var C=[],S=0;S<T.length;S++){var f=T[S];f.kind==="subtitles"&&f.label&&C.push(T[S])}return C}$.default=w},"./src/controller/timeline-controller.ts":function(fe,$,P){"use strict";P.r($),P.d($,"TimelineController",function(){return D});var Y=P("./src/polyfills/number.ts"),U=P("./src/events.ts"),O=P("./src/utils/cea-608-parser.ts"),H=P("./src/utils/output-filter.ts"),N=P("./src/utils/webvtt-parser.ts"),k=P("./src/utils/texttrack-utils.ts"),L=P("./src/utils/imsc1-ttml-parser.ts"),_=P("./src/types/loader.ts"),w=P("./src/utils/logger.ts"),D=function(){function f(i){if(this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.timescale=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=S(),this.captionsProperties=void 0,this.hls=i,this.config=i.config,this.Cues=i.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},this.config.enableCEA708Captions){var c=new H.default(this,"textTrack1"),E=new H.default(this,"textTrack2"),v=new H.default(this,"textTrack3"),p=new H.default(this,"textTrack4");this.cea608Parser1=new O.default(1,c,E),this.cea608Parser2=new O.default(3,v,p)}i.on(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),i.on(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),i.on(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),i.on(U.Events.MANIFEST_LOADED,this.onManifestLoaded,this),i.on(U.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),i.on(U.Events.FRAG_LOADING,this.onFragLoading,this),i.on(U.Events.FRAG_LOADED,this.onFragLoaded,this),i.on(U.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),i.on(U.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),i.on(U.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),i.on(U.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),i.on(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var l=f.prototype;return l.destroy=function(){var c=this.hls;c.off(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),c.off(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.off(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.off(U.Events.MANIFEST_LOADED,this.onManifestLoaded,this),c.off(U.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),c.off(U.Events.FRAG_LOADING,this.onFragLoading,this),c.off(U.Events.FRAG_LOADED,this.onFragLoaded,this),c.off(U.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),c.off(U.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),c.off(U.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),c.off(U.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),c.off(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},l.addCues=function(c,E,v,p,u){for(var y=!1,d=u.length;d--;){var h=u[d],s=C(h[0],h[1],E,v);if(s>=0&&(h[0]=Math.min(h[0],E),h[1]=Math.max(h[1],v),y=!0,s/(v-E)>.5))return}if(y||u.push([E,v]),this.config.renderTextTracksNatively){var a=this.captionsTracks[c];this.Cues.newCue(a,E,v,p)}else{var g=this.Cues.newCue(null,E,v,p);this.hls.trigger(U.Events.CUES_PARSED,{type:"captions",cues:g,track:c})}},l.onInitPtsFound=function(c,E){var v=this,p=E.frag,u=E.id,y=E.initPTS,d=E.timescale,h=this.unparsedVttFrags;u==="main"&&(this.initPTS[p.cc]=y,this.timescale[p.cc]=d),h.length&&(this.unparsedVttFrags=[],h.forEach(function(s){v.onFragLoaded(U.Events.FRAG_LOADED,s)}))},l.getExistingTrack=function(c){var E=this.media;if(E)for(var v=0;v<E.textTracks.length;v++){var p=E.textTracks[v];if(p[c])return p}return null},l.createCaptionsTrack=function(c){this.config.renderTextTracksNatively?this.createNativeTrack(c):this.createNonNativeTrack(c)},l.createNativeTrack=function(c){if(this.captionsTracks[c])return;var E=this.captionsProperties,v=this.captionsTracks,p=this.media,u=E[c],y=u.label,d=u.languageCode,h=this.getExistingTrack(c);if(h)v[c]=h,Object(k.clearCurrentCues)(v[c]),Object(k.sendAddTrackEvent)(v[c],p);else{var s=this.createTextTrack("captions",y,d);s&&(s[c]=!0,v[c]=s)}},l.createNonNativeTrack=function(c){if(this.nonNativeCaptionsTracks[c])return;var E=this.captionsProperties[c];if(!E)return;var v=E.label,p={_id:c,label:v,kind:"captions",default:E.media?!!E.media.default:!1,closedCaptions:E.media};this.nonNativeCaptionsTracks[c]=p,this.hls.trigger(U.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[p]})},l.createTextTrack=function(c,E,v){var p=this.media;return p?p.addTextTrack(c,E,v):void 0},l.onMediaAttaching=function(c,E){this.media=E.media,this._cleanTracks()},l.onMediaDetaching=function(){var c=this.captionsTracks;Object.keys(c).forEach(function(E){Object(k.clearCurrentCues)(c[E]),delete c[E]}),this.nonNativeCaptionsTracks={}},l.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=S(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=[],this.timescale=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},l._cleanTracks=function(){var c=this.media;if(!c)return;var E=c.textTracks;if(E)for(var v=0;v<E.length;v++)Object(k.clearCurrentCues)(E[v])},l.onSubtitleTracksUpdated=function(c,E){var v=this;this.textTracks=[];var p=E.subtitleTracks||[],u=p.some(function(s){return s.textCodec===L.IMSC1_CODEC});if(this.config.enableWebVTT||u&&this.config.enableIMSC1){var y=this.tracks&&p&&this.tracks.length===p.length;if(this.tracks=p||[],this.config.renderTextTracksNatively){var d=this.media?this.media.textTracks:[];this.tracks.forEach(function(s,a){var g;if(a<d.length){for(var m=null,b=0;b<d.length;b++)if(T(d[b],s)){m=d[b];break}m&&(g=m)}g?Object(k.clearCurrentCues)(g):(g=v.createTextTrack("subtitles",s.name,s.lang),g&&(g.mode="disabled")),g&&(g.groupId=s.groupId,v.textTracks.push(g))})}else if(!y&&this.tracks&&this.tracks.length){var h=this.tracks.map(function(s){return{label:s.name,kind:s.type.toLowerCase(),default:s.default,subtitleTrack:s}});this.hls.trigger(U.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:h})}}},l.onManifestLoaded=function(c,E){var v=this;this.config.enableCEA708Captions&&E.captions&&E.captions.forEach(function(p){var u=/(?:CC|SERVICE)([1-4])/.exec(p.instreamId);if(!u)return;var y="textTrack"+u[1],d=v.captionsProperties[y];if(!d)return;d.label=p.name,p.lang&&(d.languageCode=p.lang),d.media=p})},l.onFragLoading=function(c,E){var v=this.cea608Parser1,p=this.cea608Parser2,u=this.lastSn,y=this.lastPartIndex;if(!this.enabled||!(v&&p))return;if(E.frag.type===_.PlaylistLevelType.MAIN){var d,h,s=E.frag.sn,a=(d=E==null||((h=E.part)===null||h===void 0)?void 0:h.index)!=null?d:-1;s===u+1||s===u&&a===y+1||(v.reset(),p.reset()),this.lastSn=s,this.lastPartIndex=a}},l.onFragLoaded=function(c,E){var v=E.frag,p=E.payload,u=this.initPTS,y=this.unparsedVttFrags;if(v.type===_.PlaylistLevelType.SUBTITLE)if(p.byteLength){if(!Object(Y.isFiniteNumber)(u[v.cc])){y.push(E),u.length&&this.hls.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:v,error:new Error("Missing initial subtitle PTS")});return}var d=v.decryptdata;if(d==null||d.key==null||d.method!=="AES-128"){var h=this.tracks[v.level],s=this.vttCCs;s[v.cc]||(s[v.cc]={start:v.start,prevCC:this.prevCC,new:!0},this.prevCC=v.cc),h&&h.textCodec===L.IMSC1_CODEC?this._parseIMSC1(v,p):this._parseVTTs(v,p,s)}}else this.hls.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:v,error:new Error("Empty subtitle payload")})},l._parseIMSC1=function(c,E){var v=this,p=this.hls;Object(L.parseIMSC1)(E,this.initPTS[c.cc],this.timescale[c.cc],function(u){v._appendCues(u,c.level),p.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:c})},function(u){w.logger.log("Failed to parse IMSC1: "+u),p.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:c,error:u})})},l._parseVTTs=function(c,E,v){var p=this,u=this.hls;Object(N.parseWebVTT)(E,this.initPTS[c.cc],this.timescale[c.cc],v,c.cc,c.start,function(y){p._appendCues(y,c.level),u.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:c})},function(y){p._fallbackToIMSC1(c,E),w.logger.log("Failed to parse VTT cue: "+y),u.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:c,error:y})})},l._fallbackToIMSC1=function(c,E){var v=this,p=this.tracks[c.level];p.textCodec||Object(L.parseIMSC1)(E,this.initPTS[c.cc],this.timescale[c.cc],function(){p.textCodec=L.IMSC1_CODEC,v._parseIMSC1(c,E)},function(){p.textCodec="wvtt"})},l._appendCues=function(c,E){var v=this.hls;if(this.config.renderTextTracksNatively){var p=this.textTracks[E];if(p.mode==="disabled")return;c.forEach(function(d){return Object(k.addCueToTrack)(p,d)})}else{var u=this.tracks[E],y=u.default?"default":"subtitles"+E;v.trigger(U.Events.CUES_PARSED,{type:"subtitles",cues:c,track:y})}},l.onFragDecrypted=function(c,E){var v=E.frag;if(v.type===_.PlaylistLevelType.SUBTITLE){if(!Object(Y.isFiniteNumber)(this.initPTS[v.cc])){this.unparsedVttFrags.push(E);return}this.onFragLoaded(U.Events.FRAG_LOADED,E)}},l.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},l.onFragParsingUserdata=function(c,E){var v=this.cea608Parser1,p=this.cea608Parser2;if(!this.enabled||!(v&&p))return;for(var u=0;u<E.samples.length;u++){var y=E.samples[u].bytes;if(y){var d=this.extractCea608Data(y);v.addData(E.samples[u].pts,d[0]),p.addData(E.samples[u].pts,d[1])}}},l.onBufferFlushing=function(c,E){var v=E.startOffset,p=E.endOffset,u=E.endOffsetSubtitles,y=E.type,d=this.media;if(!d||d.currentTime<p)return;if(!y||y==="video"){var h=this.captionsTracks;Object.keys(h).forEach(function(a){return Object(k.removeCuesInRange)(h[a],v,p)})}if(this.config.renderTextTracksNatively&&(v===0&&u!==void 0)){var s=this.textTracks;Object.keys(s).forEach(function(a){return Object(k.removeCuesInRange)(s[a],v,u)})}},l.extractCea608Data=function(c){for(var E=c[0]&31,v=2,p=[[],[]],u=0;u<E;u++){var y=c[v++],d=127&c[v++],h=127&c[v++],s=(4&y)!==0,a=3&y;if(d===0&&h===0)continue;s&&((a===0||a===1)&&(p[a].push(d),p[a].push(h)))}return p},f}();function T(f,l){return f&&f.label===l.name&&!(f.textTrack1||f.textTrack2)}function C(f,l,i,c){return Math.min(l,c)-Math.max(f,i)}function S(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(fe,$,P){"use strict";P.r($),P.d($,"default",function(){return Y});var Y=function(){function U(H,N){this.subtle=void 0,this.aesIV=void 0,this.subtle=H,this.aesIV=N}var O=U.prototype;return O.decrypt=function(N,k){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},k,N)},U}()},"./src/crypt/aes-decryptor.ts":function(fe,$,P){"use strict";P.r($),P.d($,"removePadding",function(){return U}),P.d($,"default",function(){return O});var Y=P("./src/utils/typed-array.ts");function U(H){var N=H.byteLength,k=N&&new DataView(H.buffer).getUint8(N-1);return k?Object(Y.sliceUint8)(H,0,N-k):H}var O=function(){function H(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}var N=H.prototype;return N.uint8ArrayToUint32Array_=function(L){for(var _=new DataView(L),w=new Uint32Array(4),D=0;D<4;D++)w[D]=_.getUint32(D*4);return w},N.initTable=function(){var L=this.sBox,_=this.invSBox,w=this.subMix,D=w[0],T=w[1],C=w[2],S=w[3],f=this.invSubMix,l=f[0],i=f[1],c=f[2],E=f[3],v=new Uint32Array(256),p=0,u=0,y=0;for(y=0;y<256;y++)y<128?v[y]=y<<1:v[y]=y<<1^283;for(y=0;y<256;y++){var d=u^u<<1^u<<2^u<<3^u<<4;d=d>>>8^d&255^99,L[p]=d,_[d]=p;var h=v[p],s=v[h],a=v[s],g=v[d]*257^d*16843008;D[p]=g<<24|g>>>8,T[p]=g<<16|g>>>16,C[p]=g<<8|g>>>24,S[p]=g,g=a*16843009^s*65537^h*257^p*16843008,l[d]=g<<24|g>>>8,i[d]=g<<16|g>>>16,c[d]=g<<8|g>>>24,E[d]=g,p?(p=h^v[v[v[a^h]]],u^=v[v[u]]):p=u=1}},N.expandKey=function(L){for(var _=this.uint8ArrayToUint32Array_(L),w=!0,D=0;D<_.length&&w;)w=_[D]===this.key[D],D++;if(w)return;this.key=_;var T=this.keySize=_.length;if(T!==4&&T!==6&&T!==8)throw new Error("Invalid aes key size="+T);var C=this.ksRows=(T+6+1)*4,S,f,l=this.keySchedule=new Uint32Array(C),i=this.invKeySchedule=new Uint32Array(C),c=this.sBox,E=this.rcon,v=this.invSubMix,p=v[0],u=v[1],y=v[2],d=v[3],h,s;for(S=0;S<C;S++){if(S<T){h=l[S]=_[S];continue}s=h,S%T===0?(s=s<<8|s>>>24,s=c[s>>>24]<<24|c[s>>>16&255]<<16|c[s>>>8&255]<<8|c[s&255],s^=E[S/T|0]<<24):T>6&&S%T===4&&(s=c[s>>>24]<<24|c[s>>>16&255]<<16|c[s>>>8&255]<<8|c[s&255]),l[S]=h=(l[S-T]^s)>>>0}for(f=0;f<C;f++)S=C-f,f&3?s=l[S]:s=l[S-4],f<4||S<=4?i[f]=s:i[f]=p[c[s>>>24]]^u[c[s>>>16&255]]^y[c[s>>>8&255]]^d[c[s&255]],i[f]=i[f]>>>0},N.networkToHostOrderSwap=function(L){return L<<24|(L&65280)<<8|(L&16711680)>>8|L>>>24},N.decrypt=function(L,_,w){for(var D=this.keySize+6,T=this.invKeySchedule,C=this.invSBox,S=this.invSubMix,f=S[0],l=S[1],i=S[2],c=S[3],E=this.uint8ArrayToUint32Array_(w),v=E[0],p=E[1],u=E[2],y=E[3],d=new Int32Array(L),h=new Int32Array(d.length),s,a,g,m,b,M,K,z,ee,G,F,ie,ge,ye,xe=this.networkToHostOrderSwap;_<d.length;){for(ee=xe(d[_]),G=xe(d[_+1]),F=xe(d[_+2]),ie=xe(d[_+3]),b=ee^T[0],M=ie^T[1],K=F^T[2],z=G^T[3],ge=4,ye=1;ye<D;ye++)s=f[b>>>24]^l[M>>16&255]^i[K>>8&255]^c[z&255]^T[ge],a=f[M>>>24]^l[K>>16&255]^i[z>>8&255]^c[b&255]^T[ge+1],g=f[K>>>24]^l[z>>16&255]^i[b>>8&255]^c[M&255]^T[ge+2],m=f[z>>>24]^l[b>>16&255]^i[M>>8&255]^c[K&255]^T[ge+3],b=s,M=a,K=g,z=m,ge=ge+4;s=C[b>>>24]<<24^C[M>>16&255]<<16^C[K>>8&255]<<8^C[z&255]^T[ge],a=C[M>>>24]<<24^C[K>>16&255]<<16^C[z>>8&255]<<8^C[b&255]^T[ge+1],g=C[K>>>24]<<24^C[z>>16&255]<<16^C[b>>8&255]<<8^C[M&255]^T[ge+2],m=C[z>>>24]<<24^C[b>>16&255]<<16^C[M>>8&255]<<8^C[K&255]^T[ge+3],h[_]=xe(s^v),h[_+1]=xe(m^p),h[_+2]=xe(g^u),h[_+3]=xe(a^y),v=ee,p=G,u=F,y=ie,_=_+4}return h.buffer},H}()},"./src/crypt/decrypter.ts":function(fe,$,P){"use strict";P.r($),P.d($,"default",function(){return _});var Y=P("./src/crypt/aes-crypto.ts"),U=P("./src/crypt/fast-aes-key.ts"),O=P("./src/crypt/aes-decryptor.ts"),H=P("./src/utils/logger.ts"),N=P("./src/utils/mp4-tools.ts"),k=P("./src/utils/typed-array.ts"),L=16,_=function(){function w(T,C,S){var f=S===void 0?{}:S,l=f.removePKCS7Padding,i=l===void 0?!0:l;if(this.logEnabled=!0,this.observer=void 0,this.config=void 0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.observer=T,this.config=C,this.removePKCS7Padding=i,i)try{var c=self.crypto;c&&(this.subtle=c.subtle||c.webkitSubtle)}catch(E){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var D=w.prototype;return D.destroy=function(){this.observer=null},D.isSync=function(){return this.config.enableSoftwareAES},D.flush=function(){var C=this.currentResult;if(!C){this.reset();return}var S=new Uint8Array(C);return this.reset(),this.removePKCS7Padding?Object(O.removePadding)(S):S},D.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},D.decrypt=function(C,S,f,l){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(C),S,f);var i=this.flush();i&&l(i.buffer)}else this.webCryptoDecrypt(new Uint8Array(C),S,f).then(l)},D.softwareDecrypt=function(C,S,f){var l=this.currentIV,i=this.currentResult,c=this.remainderData;this.logOnce("JS AES decrypt"),c&&(C=Object(N.appendUint8Array)(c,C),this.remainderData=null);var E=this.getValidChunk(C);if(!E.length)return null;l&&(f=l);var v=this.softwareDecrypter;v||(v=this.softwareDecrypter=new O.default),v.expandKey(S);var p=i;return this.currentResult=v.decrypt(E.buffer,0,f),this.currentIV=Object(k.sliceUint8)(E,-16).buffer,p||null},D.webCryptoDecrypt=function(C,S,f){var l=this,i=this.subtle;return(this.key!==S||!this.fastAesKey)&&(this.key=S,this.fastAesKey=new U.default(i,S)),this.fastAesKey.expandKey().then(function(c){if(!i)return Promise.reject(new Error("web crypto not initialized"));var E=new Y.default(i,f);return E.decrypt(C.buffer,c)}).catch(function(c){return l.onWebCryptoError(c,C,S,f)})},D.onWebCryptoError=function(C,S,f,l){return H.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",C),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(S,f,l)},D.getValidChunk=function(C){var S=C,f=C.length-C.length%L;return f!==C.length&&(S=Object(k.sliceUint8)(C,0,f),this.remainderData=Object(k.sliceUint8)(C,f)),S},D.logOnce=function(C){if(!this.logEnabled)return;H.logger.log("[decrypter.ts]: "+C),this.logEnabled=!1},w}()},"./src/crypt/fast-aes-key.ts":function(fe,$,P){"use strict";P.r($),P.d($,"default",function(){return Y});var Y=function(){function U(H,N){this.subtle=void 0,this.key=void 0,this.subtle=H,this.key=N}var O=U.prototype;return O.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},U}()},"./src/demux/aacdemuxer.ts":function(fe,$,P){"use strict";P.r($);var Y=P("./src/demux/base-audio-demuxer.ts"),U=P("./src/demux/adts.ts"),O=P("./src/utils/logger.ts"),H=P("./src/demux/id3.ts");function N(_,w){_.prototype=Object.create(w.prototype),_.prototype.constructor=_,k(_,w)}function k(_,w){return k=Object.setPrototypeOf||function(T,C){return T.__proto__=C,T},k(_,w)}var L=function(_){N(w,_);function w(T,C){var S;return S=_.call(this)||this,S.observer=void 0,S.config=void 0,S.observer=T,S.config=C,S}var D=w.prototype;return D.resetInitSegment=function(C,S,f){_.prototype.resetInitSegment.call(this,C,S,f),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:C,duration:f,inputTimeScale:9e4,dropped:0}},w.probe=function(C){if(!C)return!1;for(var S=H.getID3Data(C,0)||[],f=S.length,l=C.length;f<l;f++)if(U.probe(C,f))return O.logger.log("ADTS sync word found !"),!0;return!1},D.canParse=function(C,S){return U.canParse(C,S)},D.appendFrame=function(C,S,f){U.initTrackConfig(C,this.observer,S,f,C.manifestCodec);var l=U.appendFrame(C,S,f,this.initPTS,this.frameIndex);if(l&&l.missing===0)return l},w}(Y.default);L.minProbeByteLength=9,$.default=L},"./src/demux/adts.ts":function(fe,$,P){"use strict";P.r($),P.d($,"getAudioConfig",function(){return H}),P.d($,"isHeaderPattern",function(){return N}),P.d($,"getHeaderLength",function(){return k}),P.d($,"getFullFrameLength",function(){return L}),P.d($,"canGetFrameLength",function(){return _}),P.d($,"isHeader",function(){return w}),P.d($,"canParse",function(){return D}),P.d($,"probe",function(){return T}),P.d($,"initTrackConfig",function(){return C}),P.d($,"getFrameDuration",function(){return S}),P.d($,"parseFrameHeader",function(){return f}),P.d($,"appendFrame",function(){return l});var Y=P("./src/utils/logger.ts"),U=P("./src/errors.ts"),O=P("./src/events.ts");function H(i,c,E,v){var p,u,y,d,h=navigator.userAgent.toLowerCase(),s=v,a=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];p=((c[E+2]&192)>>>6)+1;var g=(c[E+2]&60)>>>2;if(g>a.length-1){i.trigger(O.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+g});return}return y=(c[E+2]&1)<<2,y|=(c[E+3]&192)>>>6,Y.logger.log("manifest codec:"+v+", ADTS type:"+p+", samplingIndex:"+g),/firefox/i.test(h)?g>=6?(p=5,d=new Array(4),u=g-3):(p=2,d=new Array(2),u=g):h.indexOf("android")!==-1?(p=2,d=new Array(2),u=g):(p=5,d=new Array(4),v&&(v.indexOf("mp4a.40.29")!==-1||v.indexOf("mp4a.40.5")!==-1)||!v&&g>=6?u=g-3:((v&&v.indexOf("mp4a.40.2")!==-1&&(g>=6&&y===1||/vivaldi/i.test(h))||!v&&y===1)&&(p=2,d=new Array(2)),u=g)),d[0]=p<<3,d[0]|=(g&14)>>1,d[1]|=(g&1)<<7,d[1]|=y<<3,p===5&&(d[1]|=(u&14)>>1,d[2]=(u&1)<<7,d[2]|=2<<2,d[3]=0),{config:d,samplerate:a[g],channelCount:y,codec:"mp4a.40."+p,manifestCodec:s}}function N(i,c){return i[c]===255&&(i[c+1]&246)===240}function k(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 _(i,c){return c+5<i.length}function w(i,c){return c+1<i.length&&N(i,c)}function D(i,c){return _(i,c)&&N(i,c)&&L(i,c)<=i.length-c}function T(i,c){if(w(i,c)){var E=k(i,c);if(c+E>=i.length)return!1;var v=L(i,c);if(v<=E)return!1;var p=c+v;return p===i.length||w(i,p)}return!1}function C(i,c,E,v,p){if(!i.samplerate){var u=H(c,E,v,p);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 S(i){return 1024*9e4/i}function f(i,c,E,v,p){var u=k(i,c),y=L(i,c);if(y-=u,y>0){var d=E+v*p;return{headerLength:u,frameLength:y,stamp:d}}}function l(i,c,E,v,p){var u=S(i.samplerate),y=f(c,E,v,p,u);if(y){var d=y.frameLength,h=y.headerLength,s=y.stamp,a=h+d,g=Math.max(0,E+a-c.length),m;g?(m=new Uint8Array(a-h),m.set(c.subarray(E+h,c.length),0)):m=c.subarray(E+h,E+a);var b={unit:m,pts:s};return g||i.samples.push(b),{sample:b,length:a,missing:g}}}},"./src/demux/base-audio-demuxer.ts":function(fe,$,P){"use strict";P.r($),P.d($,"initPTSFn",function(){return L});var Y=P("./src/polyfills/number.ts"),U=P("./src/demux/id3.ts"),O=P("./src/demux/dummy-demuxed-track.ts"),H=P("./src/utils/mp4-tools.ts"),N=P("./src/utils/typed-array.ts"),k=function(){function _(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var w=_.prototype;return w.resetInitSegment=function(T,C,S){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},w.resetTimeStamp=function(){},w.resetContiguity=function(){},w.canParse=function(T,C){return!1},w.appendFrame=function(T,C,S){},w.demux=function(T,C){this.cachedData&&(T=Object(H.appendUint8Array)(this.cachedData,T),this.cachedData=null);var S=U.getID3Data(T,0),f=S?S.length:0,l,i,c=this._audioTrack,E=this._id3Track,v=S?U.getTimeStamp(S):void 0,p=T.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=L(v,C)),S&&S.length>0&&E.samples.push({pts:this.initPTS,dts:this.initPTS,data:S}),i=this.initPTS;f<p;){if(this.canParse(T,f)){var u=this.appendFrame(c,T,f);u?(this.frameIndex++,i=u.sample.pts,f+=u.length,l=f):f=p}else U.canParse(T,f)?(S=U.getID3Data(T,f),E.samples.push({pts:i,dts:i,data:S}),f+=S.length,l=f):f++;if(f===p&&l!==p){var y=Object(N.sliceUint8)(T,l);this.cachedData?this.cachedData=Object(H.appendUint8Array)(this.cachedData,y):this.cachedData=y}}return{audioTrack:c,avcTrack:Object(O.dummyTrack)(),id3Track:E,textTrack:Object(O.dummyTrack)()}},w.demuxSampleAes=function(T,C,S){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},w.flush=function(T){var C=this.cachedData;return C&&(this.cachedData=null,this.demux(C,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(O.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(O.dummyTrack)()}},w.destroy=function(){},_}(),L=function(w,D){return Object(Y.isFiniteNumber)(w)?w*90:D*9e4};$.default=k},"./src/demux/chunk-cache.ts":function(fe,$,P){"use strict";P.r($),P.d($,"default",function(){return Y});var Y=function(){function O(){this.chunks=[],this.dataLength=0}var H=O.prototype;return H.push=function(k){this.chunks.push(k),this.dataLength+=k.length},H.flush=function(){var k=this.chunks,L=this.dataLength,_;if(k.length)k.length===1?_=k[0]:_=U(k,L);else return new Uint8Array(0);return this.reset(),_},H.reset=function(){this.chunks.length=0,this.dataLength=0},O}();function U(O,H){for(var N=new Uint8Array(H),k=0,L=0;L<O.length;L++){var _=O[L];N.set(_,k),k+=_.length}return N}},"./src/demux/dummy-demuxed-track.ts":function(fe,$,P){"use strict";P.r($),P.d($,"dummyTrack",function(){return Y});function Y(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(fe,$,P){"use strict";P.r($);var Y=P("./src/utils/logger.ts"),U=function(){function O(N){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=N,this.bytesAvailable=N.byteLength,this.word=0,this.bitsAvailable=0}var H=O.prototype;return H.loadWord=function(){var k=this.data,L=this.bytesAvailable,_=k.byteLength-L,w=new Uint8Array(4),D=Math.min(4,L);if(D===0)throw new Error("no bytes available");w.set(k.subarray(_,_+D)),this.word=new DataView(w.buffer).getUint32(0),this.bitsAvailable=D*8,this.bytesAvailable-=D},H.skipBits=function(k){var L;this.bitsAvailable>k?(this.word<<=k,this.bitsAvailable-=k):(k-=this.bitsAvailable,L=k>>3,k-=L>>3,this.bytesAvailable-=L,this.loadWord(),this.word<<=k,this.bitsAvailable-=k)},H.readBits=function(k){var L=Math.min(this.bitsAvailable,k),_=this.word>>>32-L;return k>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=k-L,L>0&&this.bitsAvailable?_<<L|this.readBits(L):_},H.skipLZ=function(){var k;for(k=0;k<this.bitsAvailable;++k)if((this.word&2147483648>>>k)!==0)return this.word<<=k,this.bitsAvailable-=k,k;return this.loadWord(),k+this.skipLZ()},H.skipUEG=function(){this.skipBits(1+this.skipLZ())},H.skipEG=function(){this.skipBits(1+this.skipLZ())},H.readUEG=function(){var k=this.skipLZ();return this.readBits(k+1)-1},H.readEG=function(){var k=this.readUEG();return 1&k?1+k>>>1:-1*(k>>>1)},H.readBoolean=function(){return this.readBits(1)===1},H.readUByte=function(){return this.readBits(8)},H.readUShort=function(){return this.readBits(16)},H.readUInt=function(){return this.readBits(32)},H.skipScalingList=function(k){for(var L=8,_=8,w,D=0;D<k;D++)_!==0&&(w=this.readEG(),_=(L+w+256)%256),L=_===0?L:_},H.readSPS=function(){var k=0,L=0,_=0,w=0,D,T,C,S=this.readUByte.bind(this),f=this.readBits.bind(this),l=this.readUEG.bind(this),i=this.readBoolean.bind(this),c=this.skipBits.bind(this),E=this.skipEG.bind(this),v=this.skipUEG.bind(this),p=this.skipScalingList.bind(this);S();var u=S();if(f(5),c(3),S(),v(),u===100||u===110||u===122||u===244||u===44||u===83||u===86||u===118||u===128){var y=l();if(y===3&&c(1),v(),v(),c(1),i())for(T=y!==3?8:12,C=0;C<T;C++)i()&&(C<6?p(16):p(64))}v();var d=l();if(d===0)l();else if(d===1)for(c(1),E(),E(),D=l(),C=0;C<D;C++)E();v(),c(1);var h=l(),s=l(),a=f(1);a===0&&c(1),c(1),i()&&(k=l(),L=l(),_=l(),w=l());var g=[1,1];if(i()&&i()){var m=S();switch(m){case 1:g=[1,1];break;case 2:g=[12,11];break;case 3:g=[10,11];break;case 4:g=[16,11];break;case 5:g=[40,33];break;case 6:g=[24,11];break;case 7:g=[20,11];break;case 8:g=[32,11];break;case 9:g=[80,33];break;case 10:g=[18,11];break;case 11:g=[15,11];break;case 12:g=[64,33];break;case 13:g=[160,99];break;case 14:g=[4,3];break;case 15:g=[3,2];break;case 16:g=[2,1];break;case 255:{g=[S()<<8|S(),S()<<8|S()];break}}}return{width:Math.ceil((h+1)*16-k*2-L*2),height:(2-a)*(s+1)*16-(a?2:4)*(_+w),pixelRatio:g}},H.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},O}();$.default=U},"./src/demux/id3.ts":function(fe,$,P){"use strict";P.r($),P.d($,"isHeader",function(){return Y}),P.d($,"isFooter",function(){return U}),P.d($,"getID3Data",function(){return O}),P.d($,"canParse",function(){return N}),P.d($,"getTimeStamp",function(){return k}),P.d($,"isTimeStampFrame",function(){return L}),P.d($,"getID3Frames",function(){return w}),P.d($,"decodeFrame",function(){return D}),P.d($,"utf8ArrayToStr",function(){return l}),P.d($,"testables",function(){return i});var Y=function(p,u){return u+10<=p.length&&(p[u]===73&&p[u+1]===68&&p[u+2]===51&&(p[u+3]<255&&p[u+4]<255&&(p[u+6]<128&&p[u+7]<128&&p[u+8]<128&&p[u+9]<128)))},U=function(p,u){return u+10<=p.length&&(p[u]===51&&p[u+1]===68&&p[u+2]===73&&(p[u+3]<255&&p[u+4]<255&&(p[u+6]<128&&p[u+7]<128&&p[u+8]<128&&p[u+9]<128)))},O=function(p,u){for(var y=u,d=0;Y(p,u);){d+=10;var h=H(p,u+6);d+=h,U(p,u+10)&&(d+=10),u+=d}return d>0?p.subarray(y,y+d):void 0},H=function(p,u){var y=0;return y=(p[u]&127)<<21,y|=(p[u+1]&127)<<14,y|=(p[u+2]&127)<<7,y|=p[u+3]&127,y},N=function(p,u){return Y(p,u)&&H(p,u+6)+10<=p.length-u},k=function(p){for(var u=w(p),y=0;y<u.length;y++){var d=u[y];if(L(d))return f(d)}return},L=function(p){return p&&p.key==="PRIV"&&p.info==="com.apple.streaming.transportStreamTimestamp"},_=function(p){var u=String.fromCharCode(p[0],p[1],p[2],p[3]),y=H(p,4),d=10;return{type:u,size:y,data:p.subarray(d,d+y)}},w=function(p){for(var u=0,y=[];Y(p,u);){var d=H(p,u+6);u+=10;for(var h=u+d;u+8<h;){var s=_(p.subarray(u)),a=D(s);a&&y.push(a),u+=s.size+10}U(p,u)&&(u+=10)}return y},D=function(p){return p.type==="PRIV"?T(p):p.type[0]==="W"?S(p):C(p)},T=function(p){if(p.size<2)return;var u=l(p.data,!0),y=new Uint8Array(p.data.subarray(u.length+1));return{key:p.type,info:u,data:y.buffer}},C=function(p){if(p.size<2)return;if(p.type==="TXXX"){var u=1,y=l(p.data.subarray(u),!0);u+=y.length+1;var d=l(p.data.subarray(u));return{key:p.type,info:y,data:d}}var h=l(p.data.subarray(1));return{key:p.type,data:h}},S=function(p){if(p.type==="WXXX"){if(p.size<2)return;var u=1,y=l(p.data.subarray(u),!0);u+=y.length+1;var d=l(p.data.subarray(u));return{key:p.type,info:y,data:d}}var h=l(p.data);return{key:p.type,data:h}},f=function(p){if(p.data.byteLength===8){var u=new Uint8Array(p.data),y=u[3]&1,d=(u[4]<<23)+(u[5]<<15)+(u[6]<<7)+u[7];return d/=45,y&&(d+=4772185884e-2),Math.round(d)}return},l=function(p,u){u===void 0&&(u=!1);var y=E();if(y){var d=y.decode(p);if(u){var h=d.indexOf("\0");return h!==-1?d.substring(0,h):d}return d.replace(/\0/g,"")}for(var s=p.length,a,g,m,b="",M=0;M<s;){if(a=p[M++],a===0&&u)return b;if(a===0||a===3)continue;switch(a>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:b+=String.fromCharCode(a);break;case 12:case 13:g=p[M++],b+=String.fromCharCode((a&31)<<6|g&63);break;case 14:g=p[M++],m=p[M++],b+=String.fromCharCode((a&15)<<12|(g&63)<<6|(m&63)<<0);break;default:}}return b},i={decodeTextFrame:C},c;function E(){return!c&&typeof self.TextDecoder!="undefined"&&(c=new self.TextDecoder("utf-8")),c}},"./src/demux/mp3demuxer.ts":function(fe,$,P){"use strict";P.r($);var Y=P("./src/demux/base-audio-demuxer.ts"),U=P("./src/demux/id3.ts"),O=P("./src/utils/logger.ts"),H=P("./src/demux/mpegaudio.ts");function N(_,w){_.prototype=Object.create(w.prototype),_.prototype.constructor=_,k(_,w)}function k(_,w){return k=Object.setPrototypeOf||function(T,C){return T.__proto__=C,T},k(_,w)}var L=function(_){N(w,_);function w(){return _.apply(this,arguments)||this}var D=w.prototype;return D.resetInitSegment=function(C,S,f){_.prototype.resetInitSegment.call(this,C,S,f),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:C,duration:f,inputTimeScale:9e4,dropped:0}},w.probe=function(C){if(!C)return!1;for(var S=U.getID3Data(C,0)||[],f=S.length,l=C.length;f<l;f++)if(H.probe(C,f))return O.logger.log("MPEG Audio sync word found !"),!0;return!1},D.canParse=function(C,S){return H.canParse(C,S)},D.appendFrame=function(C,S,f){return this.initPTS===null?void 0:H.appendFrame(C,S,f,this.initPTS,this.frameIndex)},w}(Y.default);L.minProbeByteLength=4,$.default=L},"./src/demux/mp4demuxer.ts":function(fe,$,P){"use strict";P.r($);var Y=P("./src/utils/mp4-tools.ts"),U=P("./src/demux/dummy-demuxed-track.ts"),O=function(){function H(k,L){this.remainderData=null,this.config=void 0,this.config=L}var N=H.prototype;return N.resetTimeStamp=function(){},N.resetInitSegment=function(){},N.resetContiguity=function(){},H.probe=function(L){return Object(Y.findBox)({data:L,start:0,end:Math.min(L.length,16384)},["moof"]).length>0},N.demux=function(L){var _=L,w=Object(U.dummyTrack)();if(this.config.progressive){this.remainderData&&(_=Object(Y.appendUint8Array)(this.remainderData,L));var D=Object(Y.segmentValidRange)(_);this.remainderData=D.remainder,w.samples=D.valid||new Uint8Array}else w.samples=_;return{audioTrack:Object(U.dummyTrack)(),avcTrack:w,id3Track:Object(U.dummyTrack)(),textTrack:Object(U.dummyTrack)()}},N.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)()}},N.demuxSampleAes=function(L,_,w){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},N.destroy=function(){},H}();O.minProbeByteLength=1024,$.default=O},"./src/demux/mpegaudio.ts":function(fe,$,P){"use strict";P.r($),P.d($,"appendFrame",function(){return k}),P.d($,"parseHeader",function(){return L}),P.d($,"isHeaderPattern",function(){return _}),P.d($,"isHeader",function(){return w}),P.d($,"canParse",function(){return D}),P.d($,"probe",function(){return T});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],O=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],H=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],N=[0,1,1,4];function k(C,S,f,l,i){if(f+24>S.length)return;var c=L(S,f);if(c&&f+c.frameLength<=S.length){var E=c.samplesPerFrame*9e4/c.sampleRate,v=l+i*E,p={unit:S.subarray(f,f+c.frameLength),pts:v,dts:v};return C.config=[],C.channelCount=c.channelCount,C.samplerate=c.sampleRate,C.samples.push(p),{sample:p,length:c.frameLength,missing:0}}}function L(C,S){var f=C[S+1]>>3&3,l=C[S+1]>>1&3,i=C[S+2]>>4&15,c=C[S+2]>>2&3;if(f!==1&&i!==0&&i!==15&&c!==3){var E=C[S+2]>>1&1,v=C[S+3]>>6,p=f===3?3-l:l===3?3:4,u=U[p*14+i-1]*1e3,y=f===3?0:f===2?1:2,d=O[y*3+c],h=v===3?1:2,s=H[f][l],a=N[l],g=s*8*a,m=Math.floor(s*u/d+E)*a;if(Y===null){var b=navigator.userAgent||"",M=b.match(/Chrome\/(\d+)/i);Y=M?parseInt(M[1]):0}var K=!!Y&&Y<=87;return K&&l===2&&u>=224e3&&v===0&&(C[S+3]=C[S+3]|128),{sampleRate:d,channelCount:h,frameLength:m,samplesPerFrame:g}}}function _(C,S){return C[S]===255&&(C[S+1]&224)===224&&(C[S+1]&6)!==0}function w(C,S){return S+1<C.length&&_(C,S)}function D(C,S){var f=4;return _(C,S)&&f<=C.length-S}function T(C,S){if(S+1<C.length&&_(C,S)){var f=4,l=L(C,S),i=f;l!=null&&l.frameLength&&(i=l.frameLength);var c=S+i;return c===C.length||w(C,c)}return!1}},"./src/demux/sample-aes.ts":function(fe,$,P){"use strict";P.r($);var Y=P("./src/crypt/decrypter.ts"),U=P("./src/demux/tsdemuxer.ts"),O=function(){function H(k,L,_){this.keyData=void 0,this.decrypter=void 0,this.keyData=_,this.decrypter=new Y.default(k,L,{removePKCS7Padding:!1})}var N=H.prototype;return N.decryptBuffer=function(L,_){this.decrypter.decrypt(L,this.keyData.key.buffer,this.keyData.iv.buffer,_)},N.decryptAacSample=function(L,_,w,D){var T=L[_].unit,C=T.subarray(16,T.length-T.length%16),S=C.buffer.slice(C.byteOffset,C.byteOffset+C.length),f=this;this.decryptBuffer(S,function(l){var i=new Uint8Array(l);T.set(i,16),D||f.decryptAacSamples(L,_+1,w)})},N.decryptAacSamples=function(L,_,w){for(;;_++){if(_>=L.length){w();return}if(L[_].unit.length<32)continue;var D=this.decrypter.isSync();if(this.decryptAacSample(L,_,w,D),!D)return}},N.getAvcEncryptedData=function(L){for(var _=Math.floor((L.length-48)/160)*16+16,w=new Int8Array(_),D=0,T=32;T<=L.length-16;T+=160,D+=16)w.set(L.subarray(T,T+16),D);return w},N.getAvcDecryptedUnit=function(L,_){for(var w=new Uint8Array(_),D=0,T=32;T<=L.length-16;T+=160,D+=16)L.set(w.subarray(D,D+16),T);return L},N.decryptAvcSample=function(L,_,w,D,T,C){var S=Object(U.discardEPB)(T.data),f=this.getAvcEncryptedData(S),l=this;this.decryptBuffer(f.buffer,function(i){T.data=l.getAvcDecryptedUnit(S,i),C||l.decryptAvcSamples(L,_,w+1,D)})},N.decryptAvcSamples=function(L,_,w,D){if(L instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;_++,w=0){if(_>=L.length){D();return}for(var T=L[_].units;!(w>=T.length);w++){var C=T[w];if(C.data.length<=48||C.type!==1&&C.type!==5)continue;var S=this.decrypter.isSync();if(this.decryptAvcSample(L,_,w,D,C,S),!S)return}}},H}();$.default=O},"./src/demux/transmuxer-interface.ts":function(fe,$,P){"use strict";P.r($),P.d($,"default",function(){return T});var Y=P("./node_modules/webworkify-webpack/index.js"),U=P.n(Y),O=P("./src/events.ts"),H=P("./src/demux/transmuxer.ts"),N=P("./src/utils/logger.ts"),k=P("./src/errors.ts"),L=P("./src/utils/mediasource-helper.ts"),_=P("./node_modules/eventemitter3/index.js"),w=P.n(_),D=Object(L.getMediaSource)()||{isTypeSupported:function(){return!1}},T=function(){function C(f,l,i,c){var E=this;this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.hls=f,this.id=l,this.onTransmuxComplete=i,this.onFlush=c;var v=f.config,p=function(s,a){a=a||{},a.frag=E.frag,a.id=E.id,f.trigger(s,a)};this.observer=new _.EventEmitter,this.observer.on(O.Events.FRAG_DECRYPTED,p),this.observer.on(O.Events.ERROR,p);var u={mp4:D.isTypeSupported("video/mp4"),mpeg:D.isTypeSupported("audio/mpeg"),mp3:D.isTypeSupported('audio/mp4; codecs="mp3"')},y=navigator.vendor;if(v.enableWorker&&typeof Worker!="undefined"){N.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(h){f.trigger(O.Events.ERROR,{type:k.ErrorTypes.OTHER_ERROR,details:k.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(h.message+" ("+h.filename+":"+h.lineno+")")})},d.postMessage({cmd:"init",typeSupported:u,vendor:y,id:l,config:JSON.stringify(v)})}catch(h){N.logger.warn("Error in worker:",h),N.logger.error("Error while initializing DemuxerWorker, fallback to inline"),d&&self.URL.revokeObjectURL(d.objectURL),this.transmuxer=new H.default(this.observer,u,v,y,l),this.worker=null}}else this.transmuxer=new H.default(this.observer,u,v,y,l)}var S=C.prototype;return S.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},S.push=function(l,i,c,E,v,p,u,y,d,h){var s=this;d.transmuxing.start=self.performance.now();var a=this.transmuxer,g=this.worker,m=p?p.start:v.start,b=v.decryptdata,M=this.frag,K=!(M&&v.cc===M.cc),z=!(M&&d.level===M.level),ee=M?d.sn-M.sn:-1,G=this.part?d.part-this.part.index:1,F=!z&&(ee===1||ee===0&&G===1),ie=self.performance.now();(z||ee||v.stats.parsing.start===0)&&(v.stats.parsing.start=ie),p&&(G||!F)&&(p.stats.parsing.start=ie);var ge=new H.TransmuxState(K,F,y,z,m);if(!F||K){N.logger.log("[transmuxer-interface, "+v.type+"]: Starting new transmux session for sn: "+d.sn+" p: "+d.part+" level: "+d.level+" id: "+d.id+`
discontinuity: `+K+`
trackSwitch: `+z+`
contiguous: `+F+`
accurateTimeOffset: `+y+`
timeOffset: `+m);var ye=new H.TransmuxConfig(c,E,i,u,h);this.configureTransmuxer(ye)}if(this.frag=v,this.part=p,g)g.postMessage({cmd:"demux",data:l,decryptdata:b,chunkMeta:d,state:ge},l instanceof ArrayBuffer?[l]:[]);else if(a){var xe=a.push(l,b,d,ge);Object(H.isPromise)(xe)?xe.then(function(Te){s.handleTransmuxComplete(Te)}):this.handleTransmuxComplete(xe)}},S.flush=function(l){var i=this;l.transmuxing.start=self.performance.now();var c=this.transmuxer,E=this.worker;if(E)E.postMessage({cmd:"flush",chunkMeta:l});else if(c){var v=c.flush(l);Object(H.isPromise)(v)?v.then(function(p){i.handleFlushResult(p,l)}):this.handleFlushResult(v,l)}},S.handleFlushResult=function(l,i){var c=this;l.forEach(function(E){c.handleTransmuxComplete(E)}),this.onFlush(i)},S.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}}},S.configureTransmuxer=function(l){var i=this.worker,c=this.transmuxer;i?i.postMessage({cmd:"configure",config:l}):c&&c.configure(l)},S.handleTransmuxComplete=function(l){l.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(l)},C}()},"./src/demux/transmuxer-worker.ts":function(fe,$,P){"use strict";P.r($),P.d($,"default",function(){return k});var Y=P("./src/demux/transmuxer.ts"),U=P("./src/events.ts"),O=P("./src/utils/logger.ts"),H=P("./node_modules/eventemitter3/index.js"),N=P.n(H);function k(T){var C=new H.EventEmitter,S=function(l,i){T.postMessage({event:l,data:i})};C.on(U.Events.FRAG_DECRYPTED,S),C.on(U.Events.ERROR,S),T.addEventListener("message",function(f){var l=f.data;switch(l.cmd){case"init":{var i=JSON.parse(l.config);T.transmuxer=new Y.default(C,l.typeSupported,i,l.vendor,l.id),Object(O.enableLogs)(i.debug),S("init",null);break}case"configure":{T.transmuxer.configure(l.config);break}case"demux":{var c=T.transmuxer.push(l.data,l.decryptdata,l.chunkMeta,l.state);Object(Y.isPromise)(c)?c.then(function(p){L(T,p)}):L(T,c);break}case"flush":{var E=l.chunkMeta,v=T.transmuxer.flush(E);Object(Y.isPromise)(v)?v.then(function(p){w(T,p,E)}):w(T,v,E);break}default:break}})}function L(T,C){if(D(C.remuxResult))return;var S=[],f=C.remuxResult,l=f.audio,i=f.video;l&&_(S,l),i&&_(S,i),T.postMessage({event:"transmuxComplete",data:C},S)}function _(T,C){C.data1&&T.push(C.data1.buffer),C.data2&&T.push(C.data2.buffer)}function w(T,C,S){C.forEach(function(f){L(T,f)}),T.postMessage({event:"flush",data:S})}function D(T){return!T.audio&&!T.video&&!T.text&&!T.id3&&!T.initSegment}},"./src/demux/transmuxer.ts":function(fe,$,P){"use strict";P.r($),P.d($,"default",function(){return i}),P.d($,"isPromise",function(){return v}),P.d($,"TransmuxConfig",function(){return p}),P.d($,"TransmuxState",function(){return u});var Y=P("./src/events.ts"),U=P("./src/errors.ts"),O=P("./src/crypt/decrypter.ts"),H=P("./src/demux/aacdemuxer.ts"),N=P("./src/demux/mp4demuxer.ts"),k=P("./src/demux/tsdemuxer.ts"),L=P("./src/demux/mp3demuxer.ts"),_=P("./src/remux/mp4-remuxer.ts"),w=P("./src/remux/passthrough-remuxer.ts"),D=P("./src/demux/chunk-cache.ts"),T=P("./src/utils/mp4-tools.ts"),C=P("./src/utils/logger.ts"),S;try{S=self.performance.now.bind(self.performance)}catch(y){C.logger.debug("Unable to use Performance API on this environment"),S=self.Date.now}var f=[{demux:k.default,remux:_.default},{demux:N.default,remux:w.default},{demux:H.default,remux:_.default},{demux:L.default,remux:_.default}],l=1024;f.forEach(function(y){var d=y.demux;l=Math.max(l,d.minProbeByteLength)});var i=function(){function y(h,s,a,g,m){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 D.default,this.observer=h,this.typeSupported=s,this.config=a,this.vendor=g,this.id=m}var d=y.prototype;return d.configure=function(s){this.transmuxConfig=s,this.decrypter&&this.decrypter.reset()},d.push=function(s,a,g,m){var b=this,M=g.transmuxing;M.executeStart=S();var K=new Uint8Array(s),z=this.cache,ee=this.config,G=this.currentTransmuxState,F=this.transmuxConfig;m&&(this.currentTransmuxState=m);var ie=c(K,a);if(ie&&ie.method==="AES-128"){var ge=this.getDecrypter();if(ee.enableSoftwareAES){var ye=ge.softwareDecrypt(K,ie.key.buffer,ie.iv.buffer);if(!ye)return M.executeEnd=S(),E(g);K=new Uint8Array(ye)}else return this.decryptionPromise=ge.webCryptoDecrypt(K,ie.key.buffer,ie.iv.buffer).then(function(_e){var Re=b.push(_e,null,g);return b.decryptionPromise=null,Re}),this.decryptionPromise}var xe=m||G,Te=xe.contiguous,Se=xe.discontinuity,me=xe.trackSwitch,pe=xe.accurateTimeOffset,Ee=xe.timeOffset,le=F.audioCodec,I=F.videoCodec,x=F.defaultInitPts,R=F.duration,W=F.initSegmentData;if((Se||me)&&this.resetInitSegment(W,le,I,R),Se&&this.resetInitialTimestamp(x),Te||this.resetContiguity(),this.needsProbing(K,Se,me)){if(z.dataLength){var J=z.flush();K=Object(T.appendUint8Array)(J,K)}this.configureTransmuxer(K,F)}var B=this.transmux(K,ie,Ee,pe,g),de=this.currentTransmuxState;return de.contiguous=!0,de.discontinuity=!1,de.trackSwitch=!1,M.executeEnd=S(),B},d.flush=function(s){var a=this,g=s.transmuxing;g.executeStart=S();var m=this.decrypter,b=this.cache,M=this.currentTransmuxState,K=this.decryptionPromise;if(K)return K.then(function(){return a.flush(s)});var z=[],ee=M.timeOffset;if(m){var G=m.flush();G&&z.push(this.push(G,null,s))}var F=b.dataLength;b.reset();var ie=this.demuxer,ge=this.remuxer;if(!ie||!ge)return F>=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"}),g.executeEnd=S(),[E(s)];var ye=ie.flush(ee);return v(ye)?ye.then(function(xe){return a.flushRemux(z,xe,s),z}):(this.flushRemux(z,ye,s),z)},d.flushRemux=function(s,a,g){var m=a.audioTrack,b=a.avcTrack,M=a.id3Track,K=a.textTrack,z=this.currentTransmuxState,ee=z.accurateTimeOffset,G=z.timeOffset;C.logger.log("[transmuxer.ts]: Flushed fragment "+g.sn+(g.part>-1?" p: "+g.part:"")+" of level "+g.level);var F=this.remuxer.remux(m,b,M,K,G,ee,!0,this.id);s.push({remuxResult:F,chunkMeta:g}),g.transmuxing.executeEnd=S()},d.resetInitialTimestamp=function(s){var a=this.demuxer,g=this.remuxer;if(!a||!g)return;a.resetTimeStamp(s),g.resetTimeStamp(s)},d.resetContiguity=function(){var s=this.demuxer,a=this.remuxer;if(!s||!a)return;s.resetContiguity(),a.resetNextTimestamp()},d.resetInitSegment=function(s,a,g,m){var b=this.demuxer,M=this.remuxer;if(!b||!M)return;b.resetInitSegment(a,g,m),M.resetInitSegment(s,a,g)},d.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},d.transmux=function(s,a,g,m,b){var M;return a&&a.method==="SAMPLE-AES"?M=this.transmuxSampleAes(s,a,g,m,b):M=this.transmuxUnencrypted(s,g,m,b),M},d.transmuxUnencrypted=function(s,a,g,m){var b=this.demuxer.demux(s,a,!1,!this.config.progressive),M=b.audioTrack,K=b.avcTrack,z=b.id3Track,ee=b.textTrack,G=this.remuxer.remux(M,K,z,ee,a,g,!1,this.id);return{remuxResult:G,chunkMeta:m}},d.transmuxSampleAes=function(s,a,g,m,b){var M=this;return this.demuxer.demuxSampleAes(s,a,g).then(function(K){var z=M.remuxer.remux(K.audioTrack,K.avcTrack,K.id3Track,K.textTrack,g,m,!1,M.id);return{remuxResult:z,chunkMeta:b}})},d.configureTransmuxer=function(s,a){for(var g=this.config,m=this.observer,b=this.typeSupported,M=this.vendor,K=a.audioCodec,z=a.defaultInitPts,ee=a.duration,G=a.initSegmentData,F=a.videoCodec,ie,ge=0,ye=f.length;ge<ye;ge++)if(f[ge].demux.probe(s)){ie=f[ge];break}ie||(C.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),ie={demux:N.default,remux:w.default});var xe=this.demuxer,Te=this.remuxer,Se=ie.remux,me=ie.demux;(!Te||!(Te instanceof Se))&&(this.remuxer=new Se(m,g,b,M)),(!xe||!(xe instanceof me))&&(this.demuxer=new me(m,g,b),this.probe=me.probe),this.resetInitSegment(G,K,F,ee),this.resetInitialTimestamp(z)},d.needsProbing=function(s,a,g){return!this.demuxer||!this.remuxer||a||g},d.getDecrypter=function(){var s=this.decrypter;return s||(s=this.decrypter=new O.default(this.observer,this.config)),s},y}();function c(y,d){var h=null;return y.byteLength>0&&d!=null&&d.key!=null&&d.iv!==null&&d.method!=null&&(h=d),h}var E=function(d){return{remuxResult:{},chunkMeta:d}};function v(y){return"then"in y&&y.then instanceof Function}var p=function(d,h,s,a,g){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=d,this.videoCodec=h,this.initSegmentData=s,this.duration=a,this.defaultInitPts=g},u=function(d,h,s,a,g){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=d,this.contiguous=h,this.accurateTimeOffset=s,this.trackSwitch=a,this.timeOffset=g}},"./src/demux/tsdemuxer.ts":function(fe,$,P){"use strict";P.r($),P.d($,"discardEPB",function(){return E});var Y=P("./src/demux/adts.ts"),U=P("./src/demux/mpegaudio.ts"),O=P("./src/demux/exp-golomb.ts"),H=P("./src/demux/id3.ts"),N=P("./src/demux/sample-aes.ts"),k=P("./src/events.ts"),L=P("./src/utils/mp4-tools.ts"),_=P("./src/utils/logger.ts"),w=P("./src/errors.ts"),D={video:1,audio:2,id3:3,text:4},T=function(){function v(u,y,d){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this.aacLastPTS=null,this._initPTS=null,this._initDTS=null,this._pmtId=-1,this._avcTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.observer=u,this.config=y,this.typeSupported=d}v.probe=function(y){var d=v.syncOffset(y);return d<0?!1:(d&&_.logger.warn("MPEG2-TS detected but first sync word found @ offset "+d+", junk ahead ?"),!0)},v.syncOffset=function(y){for(var d=Math.min(1e3,y.length-3*188),h=0;h<d;){if(y[h]===71&&y[h+188]===71&&y[h+2*188]===71)return h;h++}return-1},v.createTrack=function(y,d){return{container:y==="video"||y==="audio"?"video/mp2t":void 0,type:y,id:D[y],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:y==="audio"?d:void 0}};var p=v.prototype;return p.resetInitSegment=function(y,d,h){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=v.createTrack("video",h),this._audioTrack=v.createTrack("audio",h),this._id3Track=v.createTrack("id3",h),this._txtTrack=v.createTrack("text",h),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=y,this.videoCodec=d,this._duration=h},p.resetTimeStamp=function(){},p.resetContiguity=function(){var y=this._audioTrack,d=this._avcTrack,h=this._id3Track;y&&(y.pesData=null),d&&(d.pesData=null),h&&(h.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},p.demux=function(y,d,h,s){h===void 0&&(h=!1),s===void 0&&(s=!1),h||(this.sampleAes=null);var a,g=this._avcTrack,m=this._audioTrack,b=this._id3Track,M=g.pid,K=g.pesData,z=m.pid,ee=b.pid,G=m.pesData,F=b.pesData,ie=!1,ge=this.pmtParsed,ye=this._pmtId,xe=y.length;if(this.remainderData&&(y=Object(L.appendUint8Array)(this.remainderData,y),xe=y.length,this.remainderData=null),xe<188&&!s)return this.remainderData=y,{audioTrack:m,avcTrack:g,id3Track:b,textTrack:this._txtTrack};var Te=Math.max(0,v.syncOffset(y));xe-=(xe+Te)%188,xe<y.byteLength&&!s&&(this.remainderData=new Uint8Array(y.buffer,xe,y.buffer.byteLength-xe));for(var Se=Te;Se<xe;Se+=188)if(y[Se]===71){var me=!!(y[Se+1]&64),pe=((y[Se+1]&31)<<8)+y[Se+2],Ee=(y[Se+3]&48)>>4,le=void 0;if(Ee>1){if(le=Se+5+y[Se+4],le===Se+188)continue}else le=Se+4;switch(pe){case M:me&&(K&&(a=l(K))&&this.parseAVCPES(a,!1),K={data:[],size:0}),K&&(K.data.push(y.subarray(le,Se+188)),K.size+=Se+188-le);break;case z:me&&(G&&(a=l(G))&&(m.isAAC?this.parseAACPES(a):this.parseMPEGPES(a)),G={data:[],size:0}),G&&(G.data.push(y.subarray(le,Se+188)),G.size+=Se+188-le);break;case ee:me&&(F&&(a=l(F))&&this.parseID3PES(a),F={data:[],size:0}),F&&(F.data.push(y.subarray(le,Se+188)),F.size+=Se+188-le);break;case 0:me&&(le+=y[le]+1),ye=this._pmtId=S(y,le);break;case ye:{me&&(le+=y[le]+1);var I=f(y,le,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,h);M=I.avc,M>0&&(g.pid=M),z=I.audio,z>0&&(m.pid=z,m.isAAC=I.isAAC),ee=I.id3,ee>0&&(b.pid=ee),ie&&!ge&&(_.logger.log("reparse from beginning"),ie=!1,Se=Te-188),ge=this.pmtParsed=!0;break}case 17:case 8191:break;default:ie=!0;break}}else this.observer.emit(k.Events.ERROR,k.Events.ERROR,{type:w.ErrorTypes.MEDIA_ERROR,details:w.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});g.pesData=K,m.pesData=G,b.pesData=F;var x={audioTrack:m,avcTrack:g,id3Track:b,textTrack:this._txtTrack};return s&&this.extractRemainingSamples(x),x},p.flush=function(){var y=this.remainderData;this.remainderData=null;var d;return y?d=this.demux(y,-1,!1,!0):d={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(d),this.sampleAes?this.decrypt(d,this.sampleAes):d},p.extractRemainingSamples=function(y){var d=y.audioTrack,h=y.avcTrack,s=y.id3Track,a=h.pesData,g=d.pesData,m=s.pesData,b;a&&(b=l(a))?(this.parseAVCPES(b,!0),h.pesData=null):h.pesData=a,g&&(b=l(g))?(d.isAAC?this.parseAACPES(b):this.parseMPEGPES(b),d.pesData=null):(g!=null&&g.size&&_.logger.log("last AAC PES packet truncated,might overlap between fragments"),d.pesData=g),m&&(b=l(m))?(this.parseID3PES(b),s.pesData=null):s.pesData=m},p.demuxSampleAes=function(y,d,h){var s=this.demux(y,h,!0,!this.config.progressive),a=this.sampleAes=new N.default(this.observer,this.config,d);return this.decrypt(s,a)},p.decrypt=function(y,d){return new Promise(function(h){var s=y.audioTrack,a=y.avcTrack;s.samples&&s.isAAC?d.decryptAacSamples(s.samples,0,function(){a.samples?d.decryptAvcSamples(a.samples,0,0,function(){h(y)}):h(y)}):a.samples&&d.decryptAvcSamples(a.samples,0,0,function(){h(y)})})},p.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},p.parseAVCPES=function(y,d){var h=this,s=this._avcTrack,a=this.parseAVCNALu(y.data),g=!1,m=this.avcSample,b,M=!1;y.data=null,m&&a.length&&!s.audFound&&(i(m,s),m=this.avcSample=C(!1,y.pts,y.dts,"")),a.forEach(function(K){switch(K.type){case 1:{b=!0,m||(m=h.avcSample=C(!0,y.pts,y.dts,"")),g&&(m.debug+="NDR "),m.frame=!0;var z=K.data;if(M&&z.length>4){var ee=new O.default(z).readSliceType();(ee===2||ee===4||ee===7||ee===9)&&(m.key=!0)}break}case 5:b=!0,m||(m=h.avcSample=C(!0,y.pts,y.dts,"")),g&&(m.debug+="IDR "),m.key=!0,m.frame=!0;break;case 6:{b=!0,g&&m&&(m.debug+="SEI ");var G=new O.default(E(K.data));G.readUByte();for(var F=0,ie=0,ge=!1,ye=0;!ge&&G.bytesAvailable>1;){F=0;do ye=G.readUByte(),F+=ye;while(ye===255);ie=0;do ye=G.readUByte(),ie+=ye;while(ye===255);if(F===4&&G.bytesAvailable!==0){ge=!0;var xe=G.readUByte();if(xe===181){var Te=G.readUShort();if(Te===49){var Se=G.readUInt();if(Se===1195456820){var me=G.readUByte();if(me===3){for(var pe=G.readUByte(),Ee=G.readUByte(),le=31&pe,I=[pe,Ee],x=0;x<le;x++)I.push(G.readUByte()),I.push(G.readUByte()),I.push(G.readUByte());c(h._txtTrack.samples,{type:3,pts:y.pts,bytes:I})}}}}}else if(F===5&&G.bytesAvailable!==0){if(ge=!0,ie>16){for(var R=[],W=0;W<16;W++)R.push(G.readUByte().toString(16)),(W===3||W===5||W===7||W===9)&&R.push("-");for(var J=ie-16,B=new Uint8Array(J),de=0;de<J;de++)B[de]=G.readUByte();c(h._txtTrack.samples,{pts:y.pts,payloadType:F,uuid:R.join(""),userData:Object(H.utf8ArrayToStr)(B),userDataBytes:B})}}else if(ie<G.bytesAvailable)for(var _e=0;_e<ie;_e++)G.readUByte()}break}case 7:if(b=!0,M=!0,g&&m&&(m.debug+="SPS "),!s.sps){var Re=new O.default(K.data),Oe=Re.readSPS();s.width=Oe.width,s.height=Oe.height,s.pixelRatio=Oe.pixelRatio,s.sps=[K.data],s.duration=h._duration;for(var ke=K.data.subarray(1,4),Ie="avc1.",De=0;De<3;De++){var Ve=ke[De].toString(16);Ve.length<2&&(Ve="0"+Ve),Ie+=Ve}s.codec=Ie}break;case 8:b=!0,g&&m&&(m.debug+="PPS "),s.pps||(s.pps=[K.data]);break;case 9:b=!1,s.audFound=!0,m&&i(m,s),m=h.avcSample=C(!1,y.pts,y.dts,g?"AUD ":"");break;case 12:b=!1;break;default:b=!1,m&&(m.debug+="unknown NAL "+K.type+" ");break}if(m&&b){var Qe=m.units;Qe.push(K)}}),d&&m&&(i(m,s),this.avcSample=null)},p.getLastNalUnit=function(){var y,d=this.avcSample,h;if(!d||d.units.length===0){var s=this._avcTrack.samples;d=s[s.length-1]}if((y=d)!==null&&y!==void 0&&y.units){var a=d.units;h=a[a.length-1]}return h},p.parseAVCNALu=function(y){var d=y.byteLength,h=this._avcTrack,s=h.naluState||0,a=s,g=[],m=0,b,M,K,z=-1,ee=0;for(s===-1&&(z=0,ee=y[0]&31,s=0,m=1);m<d;){if(b=y[m++],!s){s=b?0:1;continue}if(s===1){s=b?0:2;continue}if(!b)s=3;else if(b===1){if(z>=0){var G={data:y.subarray(z,m-s-1),type:ee};g.push(G)}else{var F=this.getLastNalUnit();if(F&&(a&&m<=4-a&&(F.state&&(F.data=F.data.subarray(0,F.data.byteLength-a))),M=m-s-1,M>0)){var ie=new Uint8Array(F.data.byteLength+M);ie.set(F.data,0),ie.set(y.subarray(0,M),F.data.byteLength),F.data=ie,F.state=0}}m<d?(K=y[m]&31,z=m,ee=K,s=0):s=-1}else s=0}if(z>=0&&s>=0){var ge={data:y.subarray(z,d),type:ee,state:s};g.push(ge)}if(g.length===0){var ye=this.getLastNalUnit();if(ye){var xe=new Uint8Array(ye.data.byteLength+y.byteLength);xe.set(ye.data,0),xe.set(y,ye.data.byteLength),ye.data=xe}}return h.naluState=s,g},p.parseAACPES=function(y){var d=0,h=this._audioTrack,s=this.aacOverFlow,a=y.data;if(s){this.aacOverFlow=null;var g=s.sample.unit.byteLength,m=Math.min(s.missing,g),b=g-m;s.sample.unit.set(a.subarray(0,m),b),h.samples.push(s.sample),d=s.missing}var M,K;for(M=d,K=a.length;M<K-1&&!Y.isHeader(a,M);M++);if(M!==d){var z,ee;if(M<K-1?(z="AAC PES did not start with ADTS header,offset:"+M,ee=!1):(z="no ADTS header found in AAC PES",ee=!0),_.logger.warn("parsing error:"+z),this.observer.emit(k.Events.ERROR,k.Events.ERROR,{type:w.ErrorTypes.MEDIA_ERROR,details:w.ErrorDetails.FRAG_PARSING_ERROR,fatal:ee,reason:z}),ee)return}Y.initTrackConfig(h,this.observer,a,M,this.audioCodec);var G;if(y.pts!==void 0)G=y.pts;else if(s){var F=Y.getFrameDuration(h.samplerate);G=s.sample.pts+F}else{_.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var ie=0;M<K;)if(Y.isHeader(a,M)){if(M+5<K){var ge=Y.appendFrame(h,a,M,G,ie);if(ge)if(ge.missing)this.aacOverFlow=ge;else{M+=ge.length,ie++;continue}}break}else M++},p.parseMPEGPES=function(y){var d=y.data,h=d.length,s=0,a=0,g=y.pts;if(g===void 0){_.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;a<h;)if(U.isHeader(d,a)){var m=U.appendFrame(this._audioTrack,d,a,g,s);if(m)a+=m.length,s++;else break}else a++},p.parseID3PES=function(y){if(y.pts===void 0){_.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(y)},v}();T.minProbeByteLength=188;function C(v,p,u,y){return{key:v,frame:!1,pts:p,dts:u,units:[],debug:y,length:0}}function S(v,p){return(v[p+10]&31)<<8|v[p+11]}function f(v,p,u,y){var d={audio:-1,avc:-1,id3:-1,isAAC:!0},h=(v[p+1]&15)<<8|v[p+2],s=p+3+h-4,a=(v[p+10]&15)<<8|v[p+11];for(p+=12+a;p<s;){var g=(v[p+1]&31)<<8|v[p+2];switch(v[p]){case 207:if(!y){_.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:d.audio===-1&&(d.audio=g);break;case 21:d.id3===-1&&(d.id3=g);break;case 219:if(!y){_.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:d.avc===-1&&(d.avc=g);break;case 3:case 4:u?d.audio===-1&&(d.audio=g,d.isAAC=!1):_.logger.log("MPEG audio found, not supported in this browser");break;case 36:_.logger.warn("Unsupported HEVC stream type found");break;default:break}p+=((v[p+3]&15)<<8|v[p+4])+5}return d}function l(v){var p=0,u,y,d,h,s,a=v.data;if(!v||v.size===0)return null;for(;a[0].length<19&&a.length>1;){var g=new Uint8Array(a[0].length+a[1].length);g.set(a[0]),g.set(a[1],a[0].length),a[0]=g,a.splice(1,1)}u=a[0];var m=(u[0]<<16)+(u[1]<<8)+u[2];if(m===1){if(y=(u[4]<<8)+u[5],y&&y>v.size-6)return null;var b=u[7];b&192&&(h=(u[9]&14)*536870912+(u[10]&255)*4194304+(u[11]&254)*16384+(u[12]&255)*128+(u[13]&254)/2,b&64?(s=(u[14]&14)*536870912+(u[15]&255)*4194304+(u[16]&254)*16384+(u[17]&255)*128+(u[18]&254)/2,h-s>60*9e4&&(_.logger.warn(Math.round((h-s)/9e4)+"s delta between PTS and DTS, align them"),h=s)):s=h),d=u[8];var M=d+9;if(v.size<=M)return null;v.size-=M;for(var K=new Uint8Array(v.size),z=0,ee=a.length;z<ee;z++){u=a[z];var G=u.byteLength;if(M)if(M>G){M-=G;continue}else u=u.subarray(M),G-=M,M=0;K.set(u,p),p+=G}return y&&(y-=d+3),{data:K,pts:h,dts:s,len:y}}return null}function i(v,p){if(v.units.length&&v.frame){if(v.pts===void 0){var u=p.samples,y=u.length;if(y){var d=u[y-1];v.pts=d.pts,v.dts=d.dts}else{p.dropped++;return}}p.samples.push(v)}v.debug.length&&_.logger.log(v.pts+"/"+v.dts+":"+v.debug)}function c(v,p){var u=v.length;if(u>0){if(p.pts>=v[u-1].pts)v.push(p);else for(var y=u-1;y>=0;y--)if(p.pts<v[y].pts){v.splice(y,0,p);break}}else v.push(p)}function E(v){for(var p=v.byteLength,u=[],y=1;y<p-2;)v[y]===0&&v[y+1]===0&&v[y+2]===3?(u.push(y+2),y+=2):y++;if(u.length===0)return v;var d=p-u.length,h=new Uint8Array(d),s=0;for(y=0;y<d;s++,y++)s===u[0]&&(s++,u.shift()),h[y]=v[s];return h}$.default=T},"./src/errors.ts":function(fe,$,P){"use strict";P.r($),P.d($,"ErrorTypes",function(){return Y}),P.d($,"ErrorDetails",function(){return U});var Y;(function(O){O.NETWORK_ERROR="networkError",O.MEDIA_ERROR="mediaError",O.KEY_SYSTEM_ERROR="keySystemError",O.MUX_ERROR="muxError",O.OTHER_ERROR="otherError"})(Y||(Y={}));var U;(function(O){O.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",O.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",O.KEY_SYSTEM_NO_SESSION="keySystemNoSession",O.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",O.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",O.MANIFEST_LOAD_ERROR="manifestLoadError",O.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",O.MANIFEST_PARSING_ERROR="manifestParsingError",O.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",O.LEVEL_EMPTY_ERROR="levelEmptyError",O.LEVEL_LOAD_ERROR="levelLoadError",O.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",O.LEVEL_SWITCH_ERROR="levelSwitchError",O.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",O.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",O.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",O.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",O.FRAG_LOAD_ERROR="fragLoadError",O.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",O.FRAG_DECRYPT_ERROR="fragDecryptError",O.FRAG_PARSING_ERROR="fragParsingError",O.REMUX_ALLOC_ERROR="remuxAllocError",O.KEY_LOAD_ERROR="keyLoadError",O.KEY_LOAD_TIMEOUT="keyLoadTimeOut",O.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",O.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",O.BUFFER_APPEND_ERROR="bufferAppendError",O.BUFFER_APPENDING_ERROR="bufferAppendingError",O.BUFFER_STALLED_ERROR="bufferStalledError",O.BUFFER_FULL_ERROR="bufferFullError",O.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",O.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",O.INTERNAL_EXCEPTION="internalException",O.INTERNAL_ABORTED="aborted",O.UNKNOWN="unknown"})(U||(U={}))},"./src/events.ts":function(fe,$,P){"use strict";P.r($),P.d($,"Events",function(){return Y});var Y;(function(U){U.MEDIA_ATTACHING="hlsMediaAttaching",U.MEDIA_ATTACHED="hlsMediaAttached",U.MEDIA_DETACHING="hlsMediaDetaching",U.MEDIA_DETACHED="hlsMediaDetached",U.BUFFER_RESET="hlsBufferReset",U.BUFFER_CODECS="hlsBufferCodecs",U.BUFFER_CREATED="hlsBufferCreated",U.BUFFER_APPENDING="hlsBufferAppending",U.BUFFER_APPENDED="hlsBufferAppended",U.BUFFER_EOS="hlsBufferEos",U.BUFFER_FLUSHING="hlsBufferFlushing",U.BUFFER_FLUSHED="hlsBufferFlushed",U.MANIFEST_LOADING="hlsManifestLoading",U.MANIFEST_LOADED="hlsManifestLoaded",U.MANIFEST_PARSED="hlsManifestParsed",U.LEVEL_SWITCHING="hlsLevelSwitching",U.LEVEL_SWITCHED="hlsLevelSwitched",U.LEVEL_LOADING="hlsLevelLoading",U.LEVEL_LOADED="hlsLevelLoaded",U.LEVEL_UPDATED="hlsLevelUpdated",U.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",U.LEVELS_UPDATED="hlsLevelsUpdated",U.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",U.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",U.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",U.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",U.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",U.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",U.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",U.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",U.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",U.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",U.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",U.CUES_PARSED="hlsCuesParsed",U.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",U.INIT_PTS_FOUND="hlsInitPtsFound",U.FRAG_LOADING="hlsFragLoading",U.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",U.FRAG_LOADED="hlsFragLoaded",U.FRAG_DECRYPTED="hlsFragDecrypted",U.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",U.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",U.FRAG_PARSING_METADATA="hlsFragParsingMetadata",U.FRAG_PARSED="hlsFragParsed",U.FRAG_BUFFERED="hlsFragBuffered",U.FRAG_CHANGED="hlsFragChanged",U.FPS_DROP="hlsFpsDrop",U.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",U.ERROR="hlsError",U.DESTROYING="hlsDestroying",U.KEY_LOADING="hlsKeyLoading",U.KEY_LOADED="hlsKeyLoaded",U.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",U.BACK_BUFFER_REACHED="hlsBackBufferReached"})(Y||(Y={}))},"./src/hls.ts":function(fe,$,P){"use strict";P.r($),P.d($,"default",function(){return v});var Y=P("./node_modules/url-toolkit/src/url-toolkit.js"),U=P.n(Y),O=P("./src/loader/playlist-loader.ts"),H=P("./src/loader/key-loader.ts"),N=P("./src/controller/id3-track-controller.ts"),k=P("./src/controller/latency-controller.ts"),L=P("./src/controller/level-controller.ts"),_=P("./src/controller/fragment-tracker.ts"),w=P("./src/controller/stream-controller.ts"),D=P("./src/is-supported.ts"),T=P("./src/utils/logger.ts"),C=P("./src/config.ts"),S=P("./node_modules/eventemitter3/index.js"),f=P.n(S),l=P("./src/events.ts"),i=P("./src/errors.ts");function c(p,u){for(var y=0;y<u.length;y++){var d=u[y];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(p,d.key,d)}}function E(p,u,y){return u&&c(p.prototype,u),y&&c(p,y),p}var v=function(){p.isSupported=function(){return Object(D.isSupported)()};function p(y){y===void 0&&(y={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new S.EventEmitter,this._autoLevelCapping=void 0,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null;var d=this.config=Object(C.mergeConfig)(p.DefaultConfig,y);this.userConfig=y,Object(T.enableLogs)(d.debug),this._autoLevelCapping=-1,d.progressive&&Object(C.enableStreamingMode)(d);var h=d.abrController,s=d.bufferController,a=d.capLevelController,g=d.fpsController,m=this.abrController=new h(this),b=this.bufferController=new s(this),M=this.capLevelController=new a(this),K=new g(this),z=new O.default(this),ee=new H.default(this),G=new N.default(this),F=this.levelController=new L.default(this),ie=new _.FragmentTracker(this),ge=this.streamController=new w.default(this,ie);M.setStreamController(ge),K.setStreamController(ge);var ye=[F,ge];this.networkControllers=ye;var xe=[z,ee,m,b,M,K,G,ie];this.audioTrackController=this.createController(d.audioTrackController,null,ye),this.createController(d.audioStreamController,ie,ye),this.subtitleTrackController=this.createController(d.subtitleTrackController,null,ye),this.createController(d.subtitleStreamController,ie,ye),this.createController(d.timelineController,null,xe),this.emeController=this.createController(d.emeController,null,xe),this.cmcdController=this.createController(d.cmcdController,null,xe),this.latencyController=this.createController(k.default,null,xe),this.coreComponents=xe}var u=p.prototype;return u.createController=function(d,h,s){if(d){var a=h?new d(this,h):new d(this);return s&&s.push(a),a}return null},u.on=function(d,h,s){s===void 0&&(s=this),this._emitter.on(d,h,s)},u.once=function(d,h,s){s===void 0&&(s=this),this._emitter.once(d,h,s)},u.removeAllListeners=function(d){this._emitter.removeAllListeners(d)},u.off=function(d,h,s,a){s===void 0&&(s=this),this._emitter.off(d,h,s,a)},u.listeners=function(d){return this._emitter.listeners(d)},u.emit=function(d,h,s){return this._emitter.emit(d,h,s)},u.trigger=function(d,h){if(this.config.debug)return this.emit(d,d,h);try{return this.emit(d,d,h)}catch(s){T.logger.error("An internal error happened while handling event "+d+'. Error message: "'+s.message+'". Here is a stacktrace:',s),this.trigger(l.Events.ERROR,{type:i.ErrorTypes.OTHER_ERROR,details:i.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:d,error:s})}return!1},u.listenerCount=function(d){return this._emitter.listenerCount(d)},u.destroy=function(){T.logger.log("destroy"),this.trigger(l.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(d){return d.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(d){return d.destroy()}),this.coreComponents.length=0},u.attachMedia=function(d){T.logger.log("attachMedia"),this._media=d,this.trigger(l.Events.MEDIA_ATTACHING,{media:d})},u.detachMedia=function(){T.logger.log("detachMedia"),this.trigger(l.Events.MEDIA_DETACHING,void 0),this._media=null},u.loadSource=function(d){this.stopLoad();var h=this.media,s=this.url,a=this.url=Y.buildAbsoluteURL(self.location.href,d,{alwaysNormalize:!0});T.logger.log("loadSource:"+a),h&&s&&s!==a&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(h)),this.trigger(l.Events.MANIFEST_LOADING,{url:d})},u.startLoad=function(d){d===void 0&&(d=-1),T.logger.log("startLoad("+d+")"),this.networkControllers.forEach(function(h){h.startLoad(d)})},u.stopLoad=function(){T.logger.log("stopLoad"),this.networkControllers.forEach(function(d){d.stopLoad()})},u.swapAudioCodec=function(){T.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},u.recoverMediaError=function(){T.logger.log("recoverMediaError");var d=this._media;this.detachMedia(),d&&this.attachMedia(d)},u.removeLevel=function(d,h){h===void 0&&(h=0),this.levelController.removeLevel(d,h)},E(p,[{key:"levels",get:function(){var d=this.levelController.levels;return d||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(d){T.logger.log("set currentLevel:"+d),this.loadLevel=d,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(d){T.logger.log("set nextLevel:"+d),this.levelController.manualLevel=d,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(d){T.logger.log("set loadLevel:"+d),this.levelController.manualLevel=d}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(d){this.levelController.nextLoadLevel=d}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(d){T.logger.log("set firstLevel:"+d),this.levelController.firstLevel=d}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(d){T.logger.log("set startLevel:"+d),d!==-1&&(d=Math.max(d,this.minAutoLevel)),this.levelController.startLevel=d}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(d){var h=!!d;h!==this.config.capLevelToPlayerSize&&(h?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=h)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(d){this._autoLevelCapping!==d&&(T.logger.log("set autoLevelCapping:"+d),this._autoLevelCapping=d)}},{key:"bandwidthEstimate",get:function(){var d=this.abrController.bwEstimator;return d?d.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var d=this.levels,h=this.config.minAutoBitrate;if(!d)return 0;for(var s=d.length,a=0;a<s;a++)if(d[a].maxBitrate>h)return a;return 0}},{key:"maxAutoLevel",get:function(){var d=this.levels,h=this.autoLevelCapping,s;return h===-1&&d&&d.length?s=d.length-1:s=h,s}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(d){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,d)}},{key:"audioTracks",get:function(){var d=this.audioTrackController;return d?d.audioTracks:[]}},{key:"audioTrack",get:function(){var d=this.audioTrackController;return d?d.audioTrack:-1},set:function(d){var h=this.audioTrackController;h&&(h.audioTrack=d)}},{key:"subtitleTracks",get:function(){var d=this.subtitleTrackController;return d?d.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var d=this.subtitleTrackController;return d?d.subtitleTrack:-1},set:function(d){var h=this.subtitleTrackController;h&&(h.subtitleTrack=d)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var d=this.subtitleTrackController;return d?d.subtitleDisplay:!1},set:function(d){var h=this.subtitleTrackController;h&&(h.subtitleDisplay=d)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(d){this.config.lowLatencyMode=d}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}],[{key:"version",get:function(){return"1.1.2"}},{key:"Events",get:function(){return l.Events}},{key:"ErrorTypes",get:function(){return i.ErrorTypes}},{key:"ErrorDetails",get:function(){return i.ErrorDetails}},{key:"DefaultConfig",get:function(){return p.defaultConfig?p.defaultConfig:C.hlsDefaultConfig},set:function(d){p.defaultConfig=d}}]),p}();v.defaultConfig=void 0},"./src/is-supported.ts":function(fe,$,P){"use strict";P.r($),P.d($,"isSupported",function(){return O}),P.d($,"changeTypeSupported",function(){return H});var Y=P("./src/utils/mediasource-helper.ts");function U(){return self.SourceBuffer||self.WebKitSourceBuffer}function O(){var N=Object(Y.getMediaSource)();if(!N)return!1;var k=U(),L=N&&typeof N.isTypeSupported=="function"&&N.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),_=!k||k.prototype&&typeof k.prototype.appendBuffer=="function"&&typeof k.prototype.remove=="function";return!!L&&!!_}function H(){var N,k=U();return typeof(k==null||((N=k.prototype)===null||N===void 0)?void 0:N.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(fe,$,P){"use strict";P.r($),P.d($,"default",function(){return T}),P.d($,"LoadError",function(){return S});var Y=P("./src/polyfills/number.ts"),U=P("./src/errors.ts");function O(f,l){f.prototype=Object.create(l.prototype),f.prototype.constructor=f,_(f,l)}function H(f){var l=typeof Map=="function"?new Map:void 0;return H=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,E)}function E(){return N(c,arguments,w(this).constructor)}return E.prototype=Object.create(c.prototype,{constructor:{value:E,enumerable:!1,writable:!0,configurable:!0}}),_(E,c)},H(f)}function N(f,l,i){return k()?N=Reflect.construct:N=function(E,v,p){var u=[null];u.push.apply(u,v);var y=Function.bind.apply(E,u),d=new y;return p&&_(d,p.prototype),d},N.apply(null,arguments)}function k(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(f){return!1}}function L(f){return Function.toString.call(f).indexOf("[native code]")!==-1}function _(f,l){return _=Object.setPrototypeOf||function(c,E){return c.__proto__=E,c},_(f,l)}function w(f){return w=Object.setPrototypeOf?Object.getPrototypeOf:function(i){return i.__proto__||Object.getPrototypeOf(i)},w(f)}var D=Math.pow(2,17),T=function(){function f(i){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=i}var l=f.prototype;return l.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},l.abort=function(){this.loader&&this.loader.abort()},l.load=function(c,E){var v=this,p=c.url;if(!p)return Promise.reject(new S({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:c,networkDetails:null},"Fragment does not have a "+(p?"part list":"url")));this.abort();var u=this.config,y=u.fLoader,d=u.loader;return new Promise(function(h,s){v.loader&&v.loader.destroy();var a=v.loader=c.loader=y?new y(u):new d(u),g=C(c),m={timeout:u.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:u.fragLoadingMaxRetryTimeout,highWaterMark:D};c.stats=a.stats,a.load(g,m,{onSuccess:function(M,K,z,ee){v.resetLoader(c,a),h({frag:c,part:null,payload:M.data,networkDetails:ee})},onError:function(M,K,z){v.resetLoader(c,a),s(new S({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:c,response:M,networkDetails:z}))},onAbort:function(M,K,z){v.resetLoader(c,a),s(new S({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:c,networkDetails:z}))},onTimeout:function(M,K,z){v.resetLoader(c,a),s(new S({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:c,networkDetails:z}))},onProgress:function(M,K,z,ee){E&&E({frag:c,part:null,payload:z,networkDetails:ee})}})})},l.loadPart=function(c,E,v){var p=this;this.abort();var u=this.config,y=u.fLoader,d=u.loader;return new Promise(function(h,s){p.loader&&p.loader.destroy();var a=p.loader=c.loader=y?new y(u):new d(u),g=C(c,E),m={timeout:u.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:u.fragLoadingMaxRetryTimeout,highWaterMark:D};E.stats=a.stats,a.load(g,m,{onSuccess:function(M,K,z,ee){p.resetLoader(c,a),p.updateStatsFromPart(c,E);var G={frag:c,part:E,payload:M.data,networkDetails:ee};v(G),h(G)},onError:function(M,K,z){p.resetLoader(c,a),s(new S({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:c,part:E,response:M,networkDetails:z}))},onAbort:function(M,K,z){c.stats.aborted=E.stats.aborted,p.resetLoader(c,a),s(new S({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:c,part:E,networkDetails:z}))},onTimeout:function(M,K,z){p.resetLoader(c,a),s(new S({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:c,part:E,networkDetails:z}))}})})},l.updateStatsFromPart=function(c,E){var v=c.stats,p=E.stats,u=p.total;if(v.loaded+=p.loaded,u){var y=Math.round(c.duration/E.duration),d=Math.min(Math.round(v.loaded/u),y),h=y-d,s=h*Math.round(v.loaded/d);v.total=v.loaded+s}else v.total=Math.max(v.loaded,v.total);var a=v.loading,g=p.loading;a.start?a.first+=g.first-g.start:(a.start=g.start,a.first=g.first),a.end=g.end},l.resetLoader=function(c,E){c.loader=null,this.loader===E&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),E.destroy()},f}();function C(f,l){l===void 0&&(l=null);var i=l||f,c={frag:f,part:l,responseType:"arraybuffer",url:i.url,headers:{},rangeStart:0,rangeEnd:0},E=i.byteRangeStartOffset,v=i.byteRangeEndOffset;return Object(Y.isFiniteNumber)(E)&&Object(Y.isFiniteNumber)(v)&&(c.rangeStart=E,c.rangeEnd=v),c}var S=function(f){O(l,f);function l(i){for(var c,E=arguments.length,v=new Array(E>1?E-1:0),p=1;p<E;p++)v[p-1]=arguments[p];return c=f.call.apply(f,[this].concat(v))||this,c.data=void 0,c.data=i,c}return l}(H(Error))},"./src/loader/fragment.ts":function(fe,$,P){"use strict";P.r($),P.d($,"ElementaryStreamTypes",function(){return T}),P.d($,"BaseSegment",function(){return C}),P.d($,"Fragment",function(){return S}),P.d($,"Part",function(){return f});var Y=P("./src/polyfills/number.ts"),U=P("./node_modules/url-toolkit/src/url-toolkit.js"),O=P.n(U),H=P("./src/utils/logger.ts"),N=P("./src/loader/level-key.ts"),k=P("./src/loader/load-stats.ts");function L(l,i){l.prototype=Object.create(i.prototype),l.prototype.constructor=l,_(l,i)}function _(l,i){return _=Object.setPrototypeOf||function(E,v){return E.__proto__=v,E},_(l,i)}function w(l,i){for(var c=0;c<i.length;c++){var E=i[c];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(l,E.key,E)}}function D(l,i,c){return i&&w(l.prototype,i),c&&w(l,c),l}var T;(function(l){l.AUDIO="audio",l.VIDEO="video",l.AUDIOVIDEO="audiovideo"})(T||(T={}));var C=function(){function l(c){var E;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(E={},E[T.AUDIO]=null,E[T.VIDEO]=null,E[T.AUDIOVIDEO]=null,E),this.baseurl=c}var i=l.prototype;return i.setByteRange=function(E,v){var p=E.split("@",2),u=[];p.length===1?u[0]=v?v.byteRangeEndOffset:0:u[0]=parseInt(p[1]),u[1]=parseInt(p[0])+u[0],this._byteRange=u},D(l,[{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Object(U.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(E){this._url=E}}]),l}(),S=function(l){L(i,l);function i(E,v){var p;return p=l.call(this,v)||this,p._decryptdata=null,p.rawProgramDateTime=null,p.programDateTime=null,p.tagList=[],p.duration=0,p.sn=0,p.levelkey=void 0,p.type=void 0,p.loader=null,p.level=-1,p.cc=0,p.startPTS=void 0,p.endPTS=void 0,p.appendedPTS=void 0,p.startDTS=void 0,p.endDTS=void 0,p.start=0,p.deltaPTS=void 0,p.maxStartPTS=void 0,p.minEndPTS=void 0,p.stats=new k.LoadStats,p.urlId=0,p.data=void 0,p.bitrateTest=!1,p.title=null,p.initSegment=null,p.type=E,p}var c=i.prototype;return c.createInitializationVector=function(v){for(var p=new Uint8Array(16),u=12;u<16;u++)p[u]=v>>8*(15-u)&255;return p},c.setDecryptDataFromLevelKey=function(v,p){var u=v;return(v==null?void 0:v.method)==="AES-128"&&v.uri&&!v.iv&&(u=N.LevelKey.fromURI(v.uri),u.method=v.method,u.iv=this.createInitializationVector(p),u.keyFormat="identity"),u},c.setElementaryStreamInfo=function(v,p,u,y,d,h){h===void 0&&(h=!1);var s=this.elementaryStreams,a=s[v];if(!a){s[v]={startPTS:p,endPTS:u,startDTS:y,endDTS:d,partial:h};return}a.startPTS=Math.min(a.startPTS,p),a.endPTS=Math.max(a.endPTS,u),a.startDTS=Math.min(a.startDTS,y),a.endDTS=Math.max(a.endDTS,d)},c.clearElementaryStreamInfo=function(){var v=this.elementaryStreams;v[T.AUDIO]=null,v[T.VIDEO]=null,v[T.AUDIOVIDEO]=null},D(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&&H.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}(C),f=function(l){L(i,l);function i(c,E,v,p,u){var y;y=l.call(this,v)||this,y.fragOffset=0,y.duration=0,y.gap=!1,y.independent=!1,y.relurl=void 0,y.fragment=void 0,y.index=void 0,y.stats=new k.LoadStats,y.duration=c.decimalFloatingPoint("DURATION"),y.gap=c.bool("GAP"),y.independent=c.bool("INDEPENDENT"),y.relurl=c.enumeratedString("URI"),y.fragment=E,y.index=p;var d=c.enumeratedString("BYTERANGE");return d&&y.setByteRange(d,u),u&&(y.fragOffset=u.fragOffset+u.duration),y}return D(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 E=this.elementaryStreams;return!!(E.audio||E.video||E.audiovideo)}}]),i}(C)},"./src/loader/key-loader.ts":function(fe,$,P){"use strict";P.r($),P.d($,"default",function(){return H});var Y=P("./src/events.ts"),U=P("./src/errors.ts"),O=P("./src/utils/logger.ts"),H=function(){function N(L){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=L,this._registerListeners()}var k=N.prototype;return k._registerListeners=function(){this.hls.on(Y.Events.KEY_LOADING,this.onKeyLoading,this)},k._unregisterListeners=function(){this.hls.off(Y.Events.KEY_LOADING,this.onKeyLoading)},k.destroy=function(){this._unregisterListeners();for(var _ in this.loaders){var w=this.loaders[_];w&&w.destroy()}this.loaders={}},k.onKeyLoading=function(_,w){var D=w.frag,T=D.type,C=this.loaders[T];if(!D.decryptdata){O.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var S=D.decryptdata.uri;if(S!==this.decrypturl||this.decryptkey===null){var f=this.hls.config;if(C&&(O.logger.warn("abort previous key loader for type:"+T),C.abort()),!S){O.logger.warn("key uri is falsy");return}var l=f.loader,i=D.loader=this.loaders[T]=new l(f);this.decrypturl=S,this.decryptkey=null;var c={url:S,frag:D,responseType:"arraybuffer"},E={timeout:f.fragLoadingTimeOut,maxRetry:0,retryDelay:f.fragLoadingRetryDelay,maxRetryDelay:f.fragLoadingMaxRetryTimeout,highWaterMark:0},v={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};i.load(c,E,v)}else this.decryptkey&&(D.decryptdata.key=this.decryptkey,this.hls.trigger(Y.Events.KEY_LOADED,{frag:D}))},k.loadsuccess=function(_,w,D){var T=D.frag;if(!T.decryptdata){O.logger.error("after key load, decryptdata unset");return}this.decryptkey=T.decryptdata.key=new Uint8Array(_.data),T.loader=null,delete this.loaders[T.type],this.hls.trigger(Y.Events.KEY_LOADED,{frag:T})},k.loaderror=function(_,w){var D=w.frag,T=D.loader;T&&T.abort(),delete this.loaders[D.type],this.hls.trigger(Y.Events.ERROR,{type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:D,response:_})},k.loadtimeout=function(_,w){var D=w.frag,T=D.loader;T&&T.abort(),delete this.loaders[D.type],this.hls.trigger(Y.Events.ERROR,{type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:D})},N}()},"./src/loader/level-details.ts":function(fe,$,P){"use strict";P.r($),P.d($,"LevelDetails",function(){return N});var Y=P("./src/polyfills/number.ts");function U(k,L){for(var _=0;_<L.length;_++){var w=L[_];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(k,w.key,w)}}function O(k,L,_){return L&&U(k.prototype,L),_&&U(k,_),k}var H=10,N=function(){function k(_){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.needSidxRanges=!1,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.fragments=[],this.url=_}var L=k.prototype;return L.reloaded=function(w){if(!w){this.advanced=!0,this.updated=!0;return}var D=this.lastPartSn-w.lastPartSn,T=this.lastPartIndex-w.lastPartIndex;this.updated=this.endSN!==w.endSN||!!T||!!D,this.advanced=this.endSN>w.endSN||D>0||D===0&&T>0,this.updated||this.advanced?this.misses=Math.floor(w.misses*.6):this.misses=w.misses+1,this.availabilityDelay=w.availabilityDelay},O(k,[{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||H}},{key:"drift",get:function(){var w=this.driftEndTime-this.driftStartTime;if(w>0){var D=this.driftEnd-this.driftStart;return D*1e3/w}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var w;return(w=this.partList)!==null&&w!==void 0&&w.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var w;return(w=this.fragments)!==null&&w!==void 0&&w.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 w;return(w=this.partList)!==null&&w!==void 0&&w.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var w;return(w=this.partList)!==null&&w!==void 0&&w.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),k}()},"./src/loader/level-key.ts":function(fe,$,P){"use strict";P.r($),P.d($,"LevelKey",function(){return N});var Y=P("./node_modules/url-toolkit/src/url-toolkit.js"),U=P.n(Y);function O(k,L){for(var _=0;_<L.length;_++){var w=L[_];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(k,w.key,w)}}function H(k,L,_){return L&&O(k.prototype,L),_&&O(k,_),k}var N=function(){k.fromURL=function(_,w){return new k(_,w)},k.fromURI=function(_){return new k(_)};function k(L,_){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,_?this._uri=Object(Y.buildAbsoluteURL)(L,_,{alwaysNormalize:!0}):this._uri=L}return H(k,[{key:"uri",get:function(){return this._uri}}]),k}()},"./src/loader/load-stats.ts":function(fe,$,P){"use strict";P.r($),P.d($,"LoadStats",function(){return Y});var Y=function(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}},"./src/loader/m3u8-parser.ts":function(fe,$,P){"use strict";P.r($),P.d($,"default",function(){return i});var Y=P("./src/polyfills/number.ts"),U=P("./node_modules/url-toolkit/src/url-toolkit.js"),O=P.n(U),H=P("./src/loader/fragment.ts"),N=P("./src/loader/level-details.ts"),k=P("./src/loader/level-key.ts"),L=P("./src/utils/attr-list.ts"),_=P("./src/utils/logger.ts"),w=P("./src/utils/codecs.ts"),D=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,T=/#EXT-X-MEDIA:(.*)/g,C=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),S=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(PLAYLIST-TYPE):(.+)/.source,/#EXT-X-(MEDIA-SEQUENCE): *(\d+)/.source,/#EXT-X-(SKIP):(.+)/.source,/#EXT-X-(TARGETDURATION): *(\d+)/.source,/#EXT-X-(KEY):(.+)/.source,/#EXT-X-(START):(.+)/.source,/#EXT-X-(ENDLIST)/.source,/#EXT-X-(DISCONTINUITY-SEQ)UENCE: *(\d+)/.source,/#EXT-X-(DIS)CONTINUITY/.source,/#EXT-X-(VERSION):(\d+)/.source,/#EXT-X-(MAP):(.+)/.source,/#EXT-X-(SERVER-CONTROL):(.+)/.source,/#EXT-X-(PART-INF):(.+)/.source,/#EXT-X-(GAP)/.source,/#EXT-X-(BITRATE):\s*(\d+)/.source,/#EXT-X-(PART):(.+)/.source,/#EXT-X-(PRELOAD-HINT):(.+)/.source,/#EXT-X-(RENDITION-REPORT):(.+)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),f=/\.(mp4|m4s|m4v|m4a)$/i;function l(u){var y,d;return f.test((y=(d=U.parseURL(u))===null||d===void 0?void 0:d.path)!=null?y:"")}var i=function(){function u(){}return u.findGroup=function(d,h){for(var s=0;s<d.length;s++){var a=d[s];if(a.id===h)return a}},u.convertAVC1ToAVCOTI=function(d){var h=d.split(".");if(h.length>2){var s=h.shift()+".";return s+=parseInt(h.shift()).toString(16),s+=("000"+parseInt(h.shift()).toString(16)).substr(-4),s}return d},u.resolve=function(d,h){return U.buildAbsoluteURL(h,d,{alwaysNormalize:!0})},u.parseMasterPlaylist=function(d,h){var s=[],a={},g=!1;D.lastIndex=0;for(var m;(m=D.exec(d))!=null;)if(m[1]){var b=new L.AttrList(m[1]),M={attrs:b,bitrate:b.decimalInteger("AVERAGE-BANDWIDTH")||b.decimalInteger("BANDWIDTH"),name:b.NAME,url:u.resolve(m[2],h)},K=b.decimalResolution("RESOLUTION");K&&(M.width=K.width,M.height=K.height),c((b.CODECS||"").split(/[ ,]+/).filter(function(ee){return ee}),M),M.videoCodec&&M.videoCodec.indexOf("avc1")!==-1&&(M.videoCodec=u.convertAVC1ToAVCOTI(M.videoCodec)),s.push(M)}else if(m[3]){var z=new L.AttrList(m[3]);z["DATA-ID"]&&(g=!0,a[z["DATA-ID"]]=z)}return{levels:s,sessionData:g?a:null}},u.parseMasterPlaylistMedia=function(d,h,s,a){a===void 0&&(a=[]);var g,m=[],b=0;for(T.lastIndex=0;(g=T.exec(d))!==null;){var M=new L.AttrList(g[1]);if(M.TYPE===s){var K={attrs:M,bitrate:0,id:b++,groupId:M["GROUP-ID"],instreamId:M["INSTREAM-ID"],name:M.NAME||M.LANGUAGE||"",type:s,default:M.bool("DEFAULT"),autoselect:M.bool("AUTOSELECT"),forced:M.bool("FORCED"),lang:M.LANGUAGE,url:M.URI?u.resolve(M.URI,h):""};if(a.length){var z=u.findGroup(a,K.groupId)||a[0];E(K,z,"audioCodec"),E(K,z,"textCodec")}m.push(K)}}return m},u.parseLevelPlaylist=function(d,h,s,a,g){var m=new N.LevelDetails(h),b=m.fragments,M=null,K=0,z=0,ee=0,G=0,F=null,ie=new H.Fragment(a,h),ge,ye,xe,Te=-1,Se=!1;for(C.lastIndex=0,m.m3u8=d;(ge=C.exec(d))!==null;){Se&&(Se=!1,ie=new H.Fragment(a,h),ie.start=ee,ie.sn=K,ie.cc=G,ie.level=s,M&&(ie.initSegment=M,ie.rawProgramDateTime=M.rawProgramDateTime));var me=ge[1];if(me){ie.duration=parseFloat(me);var pe=(" "+ge[2]).slice(1);ie.title=pe||null,ie.tagList.push(pe?["INF",me,pe]:["INF",me])}else if(ge[3])Object(Y.isFiniteNumber)(ie.duration)&&(ie.start=ee,xe&&(ie.levelkey=xe),ie.sn=K,ie.level=s,ie.cc=G,ie.urlId=g,b.push(ie),ie.relurl=(" "+ge[3]).slice(1),p(ie,F),F=ie,ee+=ie.duration,K++,z=0,Se=!0);else if(ge[4]){var Ee=(" "+ge[4]).slice(1);F?ie.setByteRange(Ee,F):ie.setByteRange(Ee)}else if(ge[5])ie.rawProgramDateTime=(" "+ge[5]).slice(1),ie.tagList.push(["PROGRAM-DATE-TIME",ie.rawProgramDateTime]),Te===-1&&(Te=b.length);else{if(ge=ge[0].match(S),!ge){_.logger.warn("No matches on slow regex match for level playlist!");continue}for(ye=1;ye<ge.length&&!(typeof ge[ye]!="undefined");ye++);var le=(" "+ge[ye]).slice(1),I=(" "+ge[ye+1]).slice(1),x=ge[ye+2]?(" "+ge[ye+2]).slice(1):"";switch(le){case"PLAYLIST-TYPE":m.type=I.toUpperCase();break;case"MEDIA-SEQUENCE":K=m.startSN=parseInt(I);break;case"SKIP":{var R=new L.AttrList(I),W=R.decimalInteger("SKIPPED-SEGMENTS");if(Object(Y.isFiniteNumber)(W)){m.skippedSegments=W;for(var J=W;J--;)b.unshift(null);K+=W}var B=R.enumeratedString("RECENTLY-REMOVED-DATERANGES");B&&(m.recentlyRemovedDateranges=B.split(" "));break}case"TARGETDURATION":m.targetduration=parseFloat(I);break;case"VERSION":m.version=parseInt(I);break;case"EXTM3U":break;case"ENDLIST":m.live=!1;break;case"#":(I||x)&&ie.tagList.push(x?[I,x]:[I]);break;case"DIS":G++;case"GAP":ie.tagList.push([le]);break;case"BITRATE":ie.tagList.push([le,I]);break;case"DISCONTINUITY-SEQ":G=parseInt(I);break;case"KEY":{var de,_e=new L.AttrList(I),Re=_e.enumeratedString("METHOD"),Oe=_e.URI,ke=_e.hexadecimalInteger("IV"),Ie=_e.enumeratedString("KEYFORMATVERSIONS"),De=_e.enumeratedString("KEYID"),Ve=(de=_e.enumeratedString("KEYFORMAT"))!=null?de:"identity",Qe=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(Qe.indexOf(Ve)>-1){_.logger.warn("Keyformat "+Ve+" is not supported from the manifest");continue}else if(Ve!=="identity")continue;Re&&(xe=k.LevelKey.fromURL(h,Oe),Oe&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(Re)>=0&&(xe.method=Re,xe.keyFormat=Ve,De&&(xe.keyID=De),Ie&&(xe.keyFormatVersions=Ie),xe.iv=ke));break}case"START":{var at=new L.AttrList(I),Ze=at.decimalFloatingPoint("TIME-OFFSET");Object(Y.isFiniteNumber)(Ze)&&(m.startTimeOffset=Ze);break}case"MAP":{var yt=new L.AttrList(I);ie.relurl=yt.URI,yt.BYTERANGE&&ie.setByteRange(yt.BYTERANGE),ie.level=s,ie.sn="initSegment",xe&&(ie.levelkey=xe),ie.initSegment=null,M=ie,Se=!0;break}case"SERVER-CONTROL":{var rt=new L.AttrList(I);m.canBlockReload=rt.bool("CAN-BLOCK-RELOAD"),m.canSkipUntil=rt.optionalFloat("CAN-SKIP-UNTIL",0),m.canSkipDateRanges=m.canSkipUntil>0&&rt.bool("CAN-SKIP-DATERANGES"),m.partHoldBack=rt.optionalFloat("PART-HOLD-BACK",0),m.holdBack=rt.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var dt=new L.AttrList(I);m.partTarget=dt.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Me=m.partList;Me||(Me=m.partList=[]);var xt=z>0?Me[Me.length-1]:void 0,mt=z++,se=new H.Part(new L.AttrList(I),ie,h,mt,xt);Me.push(se),ie.duration+=se.duration;break}case"PRELOAD-HINT":{var Z=new L.AttrList(I);m.preloadHint=Z;break}case"RENDITION-REPORT":{var q=new L.AttrList(I);m.renditionReports=m.renditionReports||[],m.renditionReports.push(q);break}default:_.logger.warn("line parsed but not handled: "+ge);break}}}F&&!F.relurl?(b.pop(),ee-=F.duration,m.partList&&(m.fragmentHint=F)):m.partList&&(p(ie,F),ie.cc=G,m.fragmentHint=ie);var ae=b.length,ue=b[0],te=b[ae-1];if(ee+=m.skippedSegments*m.targetduration,ee>0&&ae&&te){m.averagetargetduration=ee/ae;var ne=te.sn;m.endSN=ne!=="initSegment"?ne:0,ue&&(m.startCC=ue.cc,ue.initSegment||m.fragments.every(function(oe){return oe.relurl&&l(oe.relurl)})&&(_.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),ie=new H.Fragment(a,h),ie.relurl=te.relurl,ie.level=s,ie.sn="initSegment",ue.initSegment=ie,m.needSidxRanges=!0))}else m.endSN=0,m.startCC=0;return m.fragmentHint&&(ee+=m.fragmentHint.duration),m.totalduration=ee,m.endCC=G,Te>0&&v(b,Te),m},u}();function c(u,y){["video","audio","text"].forEach(function(d){var h=u.filter(function(a){return Object(w.isCodecType)(a,d)});if(h.length){var s=h.filter(function(a){return a.lastIndexOf("avc1",0)===0||a.lastIndexOf("mp4a",0)===0});y[d+"Codec"]=s.length>0?s[0]:h[0],u=u.filter(function(a){return h.indexOf(a)===-1})}}),y.unknownCodecs=u}function E(u,y,d){var h=y[d];h&&(u[d]=h)}function v(u,y){for(var d=u[y],h=y;h--;){var s=u[h];if(!s)return;s.programDateTime=d.programDateTime-s.duration*1e3,d=s}}function p(u,y){u.rawProgramDateTime?u.programDateTime=Date.parse(u.rawProgramDateTime):y!=null&&y.programDateTime&&(u.programDateTime=y.endProgramDateTime),Object(Y.isFiniteNumber)(u.programDateTime)||(u.programDateTime=null,u.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(fe,$,P){"use strict";P.r($);var Y=P("./src/polyfills/number.ts"),U=P("./src/events.ts"),O=P("./src/errors.ts"),H=P("./src/utils/logger.ts"),N=P("./src/utils/mp4-tools.ts"),k=P("./src/loader/m3u8-parser.ts"),L=P("./src/types/loader.ts"),_=P("./src/utils/attr-list.ts");function w(C){var S=C.type;switch(S){case L.PlaylistContextType.AUDIO_TRACK:return L.PlaylistLevelType.AUDIO;case L.PlaylistContextType.SUBTITLE_TRACK:return L.PlaylistLevelType.SUBTITLE;default:return L.PlaylistLevelType.MAIN}}function D(C,S){var f=C.url;return(f===void 0||f.indexOf("data:")===0)&&(f=S.url),f}var T=function(){function C(f){this.hls=void 0,this.loaders=Object.create(null),this.hls=f,this.registerListeners()}var S=C.prototype;return S.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)},S.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)},S.createInternalLoader=function(l){var i=this.hls.config,c=i.pLoader,E=i.loader,v=c||E,p=new v(i);return l.loader=p,this.loaders[l.type]=p,p},S.getInternalLoader=function(l){return this.loaders[l.type]},S.resetInternalLoader=function(l){this.loaders[l]&&delete this.loaders[l]},S.destroyInternalLoaders=function(){for(var l in this.loaders){var i=this.loaders[l];i&&i.destroy(),this.resetInternalLoader(l)}},S.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},S.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})},S.onLevelLoading=function(l,i){var c=i.id,E=i.level,v=i.url,p=i.deliveryDirectives;this.load({id:c,groupId:null,level:E,responseType:"text",type:L.PlaylistContextType.LEVEL,url:v,deliveryDirectives:p})},S.onAudioTrackLoading=function(l,i){var c=i.id,E=i.groupId,v=i.url,p=i.deliveryDirectives;this.load({id:c,groupId:E,level:null,responseType:"text",type:L.PlaylistContextType.AUDIO_TRACK,url:v,deliveryDirectives:p})},S.onSubtitleTrackLoading=function(l,i){var c=i.id,E=i.groupId,v=i.url,p=i.deliveryDirectives;this.load({id:c,groupId:E,level:null,responseType:"text",type:L.PlaylistContextType.SUBTITLE_TRACK,url:v,deliveryDirectives:p})},S.load=function(l){var i,c=this.hls.config,E=this.getInternalLoader(l);if(E){var v=E.context;if(v&&v.url===l.url){H.logger.trace("[playlist-loader]: playlist request ongoing");return}H.logger.log("[playlist-loader]: aborting previous loader for type: "+l.type),E.abort()}var p,u,y,d;switch(l.type){case L.PlaylistContextType.MANIFEST:p=c.manifestLoadingMaxRetry,u=c.manifestLoadingTimeOut,y=c.manifestLoadingRetryDelay,d=c.manifestLoadingMaxRetryTimeout;break;case L.PlaylistContextType.LEVEL:case L.PlaylistContextType.AUDIO_TRACK:case L.PlaylistContextType.SUBTITLE_TRACK:p=0,u=c.levelLoadingTimeOut;break;default:p=c.levelLoadingMaxRetry,u=c.levelLoadingTimeOut,y=c.levelLoadingRetryDelay,d=c.levelLoadingMaxRetryTimeout;break}if(E=this.createInternalLoader(l),(i=l.deliveryDirectives)!==null&&i!==void 0&&i.part){var h;if(l.type===L.PlaylistContextType.LEVEL&&l.level!==null?h=this.hls.levels[l.level].details:l.type===L.PlaylistContextType.AUDIO_TRACK&&l.id!==null?h=this.hls.audioTracks[l.id].details:l.type===L.PlaylistContextType.SUBTITLE_TRACK&&l.id!==null&&(h=this.hls.subtitleTracks[l.id].details),h){var s=h.partTarget,a=h.targetduration;s&&a&&(u=Math.min(Math.max(s*3,a*.8)*1e3,u))}}var g={timeout:u,maxRetry:p,retryDelay:y,maxRetryDelay:d,highWaterMark:0},m={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};E.load(l,g,m)},S.loadsuccess=function(l,i,c,E){if(E===void 0&&(E=null),c.isSidxRequest){this.handleSidxRequest(l,c),this.handlePlaylistLoaded(l,i,c,E);return}this.resetInternalLoader(c.type);var v=l.data;if(v.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(l,c,"no EXTM3U delimiter",E);return}i.parsing.start=performance.now(),v.indexOf("#EXTINF:")>0||v.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(l,i,c,E):this.handleMasterPlaylist(l,i,c,E)},S.loaderror=function(l,i,c){c===void 0&&(c=null),this.handleNetworkError(i,c,!1,l)},S.loadtimeout=function(l,i,c){c===void 0&&(c=null),this.handleNetworkError(i,c,!0)},S.handleMasterPlaylist=function(l,i,c,E){var v=this.hls,p=l.data,u=D(l,c),y=k.default.parseMasterPlaylist(p,u),d=y.levels,h=y.sessionData;if(!d.length){this.handleManifestParsingError(l,c,"no level found in manifest",E);return}var s=d.map(function(K){return{id:K.attrs.AUDIO,audioCodec:K.audioCodec}}),a=d.map(function(K){return{id:K.attrs.SUBTITLES,textCodec:K.textCodec}}),g=k.default.parseMasterPlaylistMedia(p,u,"AUDIO",s),m=k.default.parseMasterPlaylistMedia(p,u,"SUBTITLES",a),b=k.default.parseMasterPlaylistMedia(p,u,"CLOSED-CAPTIONS");if(g.length){var M=g.some(function(K){return!K.url});!M&&d[0].audioCodec&&!d[0].attrs.AUDIO&&(H.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),g.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new _.AttrList({}),bitrate:0,url:""}))}v.trigger(U.Events.MANIFEST_LOADED,{levels:d,audioTracks:g,subtitles:m,captions:b,url:u,stats:i,networkDetails:E,sessionData:h})},S.handleTrackOrLevelPlaylist=function(l,i,c,E){var v=this.hls,p=c.id,u=c.level,y=c.type,d=D(l,c),h=Object(Y.isFiniteNumber)(p)?p:0,s=Object(Y.isFiniteNumber)(u)?u:h,a=w(c),g=k.default.parseLevelPlaylist(l.data,d,s,a,h);if(!g.fragments.length){v.trigger(U.Events.ERROR,{type:O.ErrorTypes.NETWORK_ERROR,details:O.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:d,reason:"no fragments found in level",level:typeof c.level=="number"?c.level:void 0});return}if(y===L.PlaylistContextType.MANIFEST){var m={attrs:new _.AttrList({}),bitrate:0,details:g,name:"",url:d};v.trigger(U.Events.MANIFEST_LOADED,{levels:[m],audioTracks:[],url:d,stats:i,networkDetails:E,sessionData:null})}if(i.parsing.end=performance.now(),g.needSidxRanges){var b,M=(b=g.fragments[0].initSegment)===null||b===void 0?void 0:b.url;this.load({url:M,isSidxRequest:!0,type:y,level:u,levelDetails:g,id:p,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}c.levelDetails=g,this.handlePlaylistLoaded(l,i,c,E)},S.handleSidxRequest=function(l,i){var c=Object(N.parseSegmentIndex)(new Uint8Array(l.data));if(!c)return;var E=c.references,v=i.levelDetails;E.forEach(function(p,u){var y=p.info,d=v.fragments[u];d.byteRange.length===0&&d.setByteRange(String(1+y.end-y.start)+"@"+String(y.start)),d.initSegment&&d.initSegment.setByteRange(String(c.moovEndOffset)+"@0")})},S.handleManifestParsingError=function(l,i,c,E){this.hls.trigger(U.Events.ERROR,{type:O.ErrorTypes.NETWORK_ERROR,details:O.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:i.type===L.PlaylistContextType.MANIFEST,url:l.url,reason:c,response:l,context:i,networkDetails:E})},S.handleNetworkError=function(l,i,c,E){c===void 0&&(c=!1),H.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=O.ErrorDetails.UNKNOWN,p=!1,u=this.getInternalLoader(l);switch(l.type){case L.PlaylistContextType.MANIFEST:v=c?O.ErrorDetails.MANIFEST_LOAD_TIMEOUT:O.ErrorDetails.MANIFEST_LOAD_ERROR,p=!0;break;case L.PlaylistContextType.LEVEL:v=c?O.ErrorDetails.LEVEL_LOAD_TIMEOUT:O.ErrorDetails.LEVEL_LOAD_ERROR,p=!1;break;case L.PlaylistContextType.AUDIO_TRACK:v=c?O.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:O.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,p=!1;break;case L.PlaylistContextType.SUBTITLE_TRACK:v=c?O.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:O.ErrorDetails.SUBTITLE_LOAD_ERROR,p=!1;break}u&&this.resetInternalLoader(l.type);var y={type:O.ErrorTypes.NETWORK_ERROR,details:v,fatal:p,url:l.url,loader:u,context:l,networkDetails:i};E&&(y.response=E),this.hls.trigger(U.Events.ERROR,y)},S.handlePlaylistLoaded=function(l,i,c,E){var v=c.type,p=c.level,u=c.id,y=c.groupId,d=c.loader,h=c.levelDetails,s=c.deliveryDirectives;if(!(h!=null&&h.targetduration)){this.handleManifestParsingError(l,c,"invalid target duration",E);return}if(!d)return;h.live&&(d.getCacheAge&&(h.ageHeader=d.getCacheAge()||0),(!d.getCacheAge||isNaN(h.ageHeader))&&(h.ageHeader=0));switch(v){case L.PlaylistContextType.MANIFEST:case L.PlaylistContextType.LEVEL:this.hls.trigger(U.Events.LEVEL_LOADED,{details:h,level:p||0,id:u||0,stats:i,networkDetails:E,deliveryDirectives:s});break;case L.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(U.Events.AUDIO_TRACK_LOADED,{details:h,id:u||0,groupId:y||"",stats:i,networkDetails:E,deliveryDirectives:s});break;case L.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(U.Events.SUBTITLE_TRACK_LOADED,{details:h,id:u||0,groupId:y||"",stats:i,networkDetails:E,deliveryDirectives:s});break}},C}();$.default=T},"./src/polyfills/number.ts":function(fe,$,P){"use strict";P.r($),P.d($,"isFiniteNumber",function(){return Y}),P.d($,"MAX_SAFE_INTEGER",function(){return U});var Y=Number.isFinite||function(O){return typeof O=="number"&&isFinite(O)},U=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(fe,$,P){"use strict";P.r($);var Y=function(){function U(){}return U.getSilentFrame=function(H,N){switch(H){case"mp4a.40.2":if(N===1)return new Uint8Array([0,200,0,128,35,128]);if(N===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(N===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(N===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(N===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(N===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(N===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(N===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(N===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(fe,$,P){"use strict";P.r($);var Y=Math.pow(2,32)-1,U=function(){function O(){}return O.init=function(){O.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 N;for(N in O.types)O.types.hasOwnProperty(N)&&(O.types[N]=[N.charCodeAt(0),N.charCodeAt(1),N.charCodeAt(2),N.charCodeAt(3)]);var k=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]);O.HDLR_TYPES={video:k,audio:L};var _=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),w=new Uint8Array([0,0,0,0,0,0,0,0]);O.STTS=O.STSC=O.STCO=w,O.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),O.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),O.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),O.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var D=new Uint8Array([105,115,111,109]),T=new Uint8Array([97,118,99,49]),C=new Uint8Array([0,0,0,1]);O.FTYP=O.box(O.types.ftyp,D,C,D,T),O.DINF=O.box(O.types.dinf,O.box(O.types.dref,_))},O.box=function(N){for(var k=8,L=arguments.length,_=new Array(L>1?L-1:0),w=1;w<L;w++)_[w-1]=arguments[w];for(var D=_.length,T=D;D--;)k+=_[D].byteLength;var C=new Uint8Array(k);for(C[0]=k>>24&255,C[1]=k>>16&255,C[2]=k>>8&255,C[3]=k&255,C.set(N,4),D=0,k=8;D<T;D++)C.set(_[D],k),k+=_[D].byteLength;return C},O.hdlr=function(N){return O.box(O.types.hdlr,O.HDLR_TYPES[N])},O.mdat=function(N){return O.box(O.types.mdat,N)},O.mdhd=function(N,k){k*=N;var L=Math.floor(k/(Y+1)),_=Math.floor(k%(Y+1));return O.box(O.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,N>>24&255,N>>16&255,N>>8&255,N&255,L>>24,L>>16&255,L>>8&255,L&255,_>>24,_>>16&255,_>>8&255,_&255,85,196,0,0]))},O.mdia=function(N){return O.box(O.types.mdia,O.mdhd(N.timescale,N.duration),O.hdlr(N.type),O.minf(N))},O.mfhd=function(N){return O.box(O.types.mfhd,new Uint8Array([0,0,0,0,N>>24,N>>16&255,N>>8&255,N&255]))},O.minf=function(N){return N.type==="audio"?O.box(O.types.minf,O.box(O.types.smhd,O.SMHD),O.DINF,O.stbl(N)):O.box(O.types.minf,O.box(O.types.vmhd,O.VMHD),O.DINF,O.stbl(N))},O.moof=function(N,k,L){return O.box(O.types.moof,O.mfhd(N),O.traf(L,k))},O.moov=function(N){for(var k=N.length,L=[];k--;)L[k]=O.trak(N[k]);return O.box.apply(null,[O.types.moov,O.mvhd(N[0].timescale,N[0].duration)].concat(L).concat(O.mvex(N)))},O.mvex=function(N){for(var k=N.length,L=[];k--;)L[k]=O.trex(N[k]);return O.box.apply(null,[O.types.mvex].concat(L))},O.mvhd=function(N,k){k*=N;var L=Math.floor(k/(Y+1)),_=Math.floor(k%(Y+1)),w=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,N>>24&255,N>>16&255,N>>8&255,N&255,L>>24,L>>16&255,L>>8&255,L&255,_>>24,_>>16&255,_>>8&255,_&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 O.box(O.types.mvhd,w)},O.sdtp=function(N){var k=N.samples||[],L=new Uint8Array(4+k.length),_,w;for(_=0;_<k.length;_++)w=k[_].flags,L[_+4]=w.dependsOn<<4|w.isDependedOn<<2|w.hasRedundancy;return O.box(O.types.sdtp,L)},O.stbl=function(N){return O.box(O.types.stbl,O.stsd(N),O.box(O.types.stts,O.STTS),O.box(O.types.stsc,O.STSC),O.box(O.types.stsz,O.STSZ),O.box(O.types.stco,O.STCO))},O.avc1=function(N){var k=[],L=[],_,w,D;for(_=0;_<N.sps.length;_++)w=N.sps[_],D=w.byteLength,k.push(D>>>8&255),k.push(D&255),k=k.concat(Array.prototype.slice.call(w));for(_=0;_<N.pps.length;_++)w=N.pps[_],D=w.byteLength,L.push(D>>>8&255),L.push(D&255),L=L.concat(Array.prototype.slice.call(w));var T=O.box(O.types.avcC,new Uint8Array([1,k[3],k[4],k[5],252|3,224|N.sps.length].concat(k).concat([N.pps.length]).concat(L))),C=N.width,S=N.height,f=N.pixelRatio[0],l=N.pixelRatio[1];return O.box(O.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,C>>8&255,C&255,S>>8&255,S&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]),T,O.box(O.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),O.box(O.types.pasp,new Uint8Array([f>>24,f>>16&255,f>>8&255,f&255,l>>24,l>>16&255,l>>8&255,l&255])))},O.esds=function(N){var k=N.config.length;return new Uint8Array([0,0,0,0,3,23+k,0,1,0,4,15+k,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([k]).concat(N.config).concat([6,1,2]))},O.mp4a=function(N){var k=N.samplerate;return O.box(O.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,N.channelCount,0,16,0,0,0,0,k>>8&255,k&255,0,0]),O.box(O.types.esds,O.esds(N)))},O.mp3=function(N){var k=N.samplerate;return O.box(O.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,N.channelCount,0,16,0,0,0,0,k>>8&255,k&255,0,0]))},O.stsd=function(N){return N.type==="audio"?!N.isAAC&&N.codec==="mp3"?O.box(O.types.stsd,O.STSD,O.mp3(N)):O.box(O.types.stsd,O.STSD,O.mp4a(N)):O.box(O.types.stsd,O.STSD,O.avc1(N))},O.tkhd=function(N){var k=N.id,L=N.duration*N.timescale,_=N.width,w=N.height,D=Math.floor(L/(Y+1)),T=Math.floor(L%(Y+1));return O.box(O.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,k>>24&255,k>>16&255,k>>8&255,k&255,0,0,0,0,D>>24,D>>16&255,D>>8&255,D&255,T>>24,T>>16&255,T>>8&255,T&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,_>>8&255,_&255,0,0,w>>8&255,w&255,0,0]))},O.traf=function(N,k){var L=O.sdtp(N),_=N.id,w=Math.floor(k/(Y+1)),D=Math.floor(k%(Y+1));return O.box(O.types.traf,O.box(O.types.tfhd,new Uint8Array([0,0,0,0,_>>24,_>>16&255,_>>8&255,_&255])),O.box(O.types.tfdt,new Uint8Array([1,0,0,0,w>>24,w>>16&255,w>>8&255,w&255,D>>24,D>>16&255,D>>8&255,D&255])),O.trun(N,L.length+16+20+8+16+8+8),L)},O.trak=function(N){return N.duration=N.duration||4294967295,O.box(O.types.trak,O.tkhd(N),O.mdia(N))},O.trex=function(N){var k=N.id;return O.box(O.types.trex,new Uint8Array([0,0,0,0,k>>24,k>>16&255,k>>8&255,k&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},O.trun=function(N,k){var L=N.samples||[],_=L.length,w=12+16*_,D=new Uint8Array(w),T,C,S,f,l,i;for(k+=8+w,D.set([0,0,15,1,_>>>24&255,_>>>16&255,_>>>8&255,_&255,k>>>24&255,k>>>16&255,k>>>8&255,k&255],0),T=0;T<_;T++)C=L[T],S=C.duration,f=C.size,l=C.flags,i=C.cts,D.set([S>>>24&255,S>>>16&255,S>>>8&255,S&255,f>>>24&255,f>>>16&255,f>>>8&255,f&255,l.isLeading<<2|l.dependsOn,l.isDependedOn<<6|l.hasRedundancy<<4|l.paddingValue<<1|l.isNonSync,l.degradPrio&240<<8,l.degradPrio&15,i>>>24&255,i>>>16&255,i>>>8&255,i&255],12+16*T);return O.box(O.types.trun,D)},O.initSegment=function(N){O.types||O.init();var k=O.moov(N),L=new Uint8Array(O.FTYP.byteLength+k.byteLength);return L.set(O.FTYP),L.set(k,O.FTYP.byteLength),L},O}();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(fe,$,P){"use strict";P.r($),P.d($,"default",function(){return i}),P.d($,"normalizePts",function(){return c});var Y=P("./src/polyfills/number.ts"),U=P("./src/remux/aac-helper.ts"),O=P("./src/remux/mp4-generator.ts"),H=P("./src/events.ts"),N=P("./src/errors.ts"),k=P("./src/utils/logger.ts"),L=P("./src/types/loader.ts"),_=P("./src/utils/timescale-conversion.ts");function w(){return w=Object.assign||function(u){for(var y=1;y<arguments.length;y++){var d=arguments[y];for(var h in d)Object.prototype.hasOwnProperty.call(d,h)&&(u[h]=d[h])}return u},w.apply(this,arguments)}var D=10*1e3,T=1024,C=1152,S=null,f=null,l=!1,i=function(){function u(d,h,s,a){if(a===void 0&&(a=""),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=void 0,this._initDTS=void 0,this.nextAvcDts=null,this.nextAudioPts=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=d,this.config=h,this.typeSupported=s,this.ISGenerated=!1,S===null){var g=navigator.userAgent||"",m=g.match(/Chrome\/(\d+)/i);S=m?parseInt(m[1]):0}if(f===null){var b=navigator.userAgent.match(/Safari\/(\d+)/i);f=b?parseInt(b[1]):0}l=!!S&&S<75||!!f&&f<600}var y=u.prototype;return y.destroy=function(){},y.resetTimeStamp=function(h){k.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=h},y.resetNextTimestamp=function(){k.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},y.resetInitSegment=function(){k.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},y.getVideoStartPts=function(h){var s=!1,a=h.reduce(function(g,m){var b=m.pts-g;return b<-4294967296?(s=!0,c(g,m.pts)):b>0?g:m.pts},h[0].pts);return s&&k.logger.debug("PTS rollover detected"),a},y.remux=function(h,s,a,g,m,b,M,K){var z,ee,G,F,ie,ge,ye=m,xe=m,Te=h.pid>-1,Se=s.pid>-1,me=s.samples.length,pe=h.samples.length>0,Ee=me>1,le=(!Te||pe)&&(!Se||Ee)||this.ISGenerated||M;if(le){this.ISGenerated||(G=this.generateIS(h,s,m));var I=this.isVideoContiguous,x=-1;if(Ee&&(x=E(s.samples),!I&&this.config.forceKeyFrameOnDiscontinuity))if(ge=!0,x>0){k.logger.warn("[mp4-remuxer]: Dropped "+x+" out of "+me+" video samples due to a missing keyframe");var R=this.getVideoStartPts(s.samples);s.samples=s.samples.slice(x),s.dropped+=x,xe+=(s.samples[0].pts-R)/(s.timescale||9e4)}else x===-1&&(k.logger.warn("[mp4-remuxer]: No keyframe found out of "+me+" video samples"),ge=!1);if(this.ISGenerated){if(pe&&Ee){var W=this.getVideoStartPts(s.samples),J=c(h.samples[0].pts,W)-W,B=J/s.inputTimeScale;ye+=Math.max(0,B),xe+=Math.max(0,-B)}if(pe){if(h.samplerate||(k.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),G=this.generateIS(h,s,m)),ee=this.remuxAudio(h,ye,this.isAudioContiguous,b,Se||Ee||K===L.PlaylistLevelType.AUDIO?xe:void 0),Ee){var de=ee?ee.endPTS-ee.startPTS:0;s.inputTimeScale||(k.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),G=this.generateIS(h,s,m)),z=this.remuxVideo(s,xe,I,de)}}else Ee&&(z=this.remuxVideo(s,xe,I,0));z&&(z.firstKeyFrame=x,z.independent=x!==-1)}}return this.ISGenerated&&(a.samples.length&&(ie=this.remuxID3(a,m)),g.samples.length&&(F=this.remuxText(g,m))),{audio:ee,video:z,initSegment:G,independent:ge,text:F,id3:ie}},y.generateIS=function(h,s,a){var g=h.samples,m=s.samples,b=this.typeSupported,M={},K=!Object(Y.isFiniteNumber)(this._initPTS),z="audio/mp4",ee,G,F;if(K&&(ee=G=Infinity),h.config&&g.length&&(h.timescale=h.samplerate,h.isAAC||(b.mpeg?(z="audio/mpeg",h.codec=""):b.mp3&&(h.codec="mp3")),M.audio={id:"audio",container:z,codec:h.codec,initSegment:!h.isAAC&&b.mpeg?new Uint8Array(0):O.default.initSegment([h]),metadata:{channelCount:h.channelCount}},K&&(F=h.inputTimeScale,ee=G=g[0].pts-Math.round(F*a))),s.sps&&s.pps&&m.length&&(s.timescale=s.inputTimeScale,M.video={id:"main",container:"video/mp4",codec:s.codec,initSegment:O.default.initSegment([s]),metadata:{width:s.width,height:s.height}},K)){F=s.inputTimeScale;var ie=this.getVideoStartPts(m),ge=Math.round(F*a);G=Math.min(G,c(m[0].dts,ie)-ge),ee=Math.min(ee,ie-ge)}if(Object.keys(M).length)return this.ISGenerated=!0,K&&(this._initPTS=ee,this._initDTS=G),{tracks:M,initPTS:ee,timescale:F}},y.remuxVideo=function(h,s,a,g){var m=h.inputTimeScale,b=h.samples,M=[],K=b.length,z=this._initPTS,ee=this.nextAvcDts,G=8,F,ie,ge,ye=Number.POSITIVE_INFINITY,xe=Number.NEGATIVE_INFINITY,Te=0,Se=!1;if(!a||ee===null){var me=s*m,pe=b[0].pts-c(b[0].dts,b[0].pts);ee=me-pe}for(var Ee=0;Ee<K;Ee++){var le=b[Ee];if(le.pts=c(le.pts-z,ee),le.dts=c(le.dts-z,ee),le.dts>le.pts){var I=9e4*.2;Te=Math.max(Math.min(Te,le.pts-le.dts),-1*I)}le.dts<b[Ee>0?Ee-1:Ee].dts&&(Se=!0)}Se&&b.sort(function(Tt,Xe){var st=Tt.dts-Xe.dts,jt=Tt.pts-Xe.pts;return st||jt}),ie=b[0].dts,ge=b[b.length-1].dts;var x=Math.round((ge-ie)/(K-1));if(Te<0){if(Te<x*-2){k.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(_.toMsFromMpegTsClock)(-x,!0)+" ms");for(var R=Te,W=0;W<K;W++)b[W].dts=R=Math.max(R,b[W].pts-x),b[W].pts=Math.max(R,b[W].pts)}else{k.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(_.toMsFromMpegTsClock)(Te,!0)+" ms to overcome this issue");for(var J=0;J<K;J++)b[J].dts=b[J].dts+Te}ie=b[0].dts}if(a){var B=ie-ee,de=B>x,_e=B<-1;if(de||_e){de?k.logger.warn("AVC: "+Object(_.toMsFromMpegTsClock)(B,!0)+" ms ("+B+"dts) hole between fragments detected, filling it"):k.logger.warn("AVC: "+Object(_.toMsFromMpegTsClock)(-B,!0)+" ms ("+B+"dts) overlapping between fragments detected"),ie=ee;var Re=b[0].pts-B;b[0].dts=ie,b[0].pts=Re,k.logger.log("Video: First PTS/DTS adjusted: "+Object(_.toMsFromMpegTsClock)(Re,!0)+"/"+Object(_.toMsFromMpegTsClock)(ie,!0)+", delta: "+Object(_.toMsFromMpegTsClock)(B,!0)+" ms")}}l&&(ie=Math.max(0,ie));for(var Oe=0,ke=0,Ie=0;Ie<K;Ie++){for(var De=b[Ie],Ve=De.units,Qe=Ve.length,at=0,Ze=0;Ze<Qe;Ze++)at+=Ve[Ze].data.length;ke+=at,Oe+=Qe,De.length=at,De.dts=Math.max(De.dts,ie),De.pts=Math.max(De.pts,De.dts,0),ye=Math.min(De.pts,ye),xe=Math.max(De.pts,xe)}ge=b[K-1].dts;var yt=ke+4*Oe+8,rt;try{rt=new Uint8Array(yt)}catch(Tt){this.observer.emit(H.Events.ERROR,H.Events.ERROR,{type:N.ErrorTypes.MUX_ERROR,details:N.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:yt,reason:"fail allocating video mdat "+yt});return}var dt=new DataView(rt.buffer);dt.setUint32(0,yt),rt.set(O.default.types.mdat,4);for(var Me=0;Me<K;Me++){for(var xt=b[Me],mt=xt.units,se=0,Z=0,q=mt.length;Z<q;Z++){var ae=mt[Z],ue=ae.data,te=ae.data.byteLength;dt.setUint32(G,te),G+=4,rt.set(ue,G),G+=te,se+=4+te}if(Me<K-1)F=b[Me+1].dts-xt.dts;else{var ne=this.config,oe=xt.dts-b[Me>0?Me-1:Me].dts;if(ne.stretchShortVideoTrack&&this.nextAudioPts!==null){var he=Math.floor(ne.maxBufferHole*m),ce=(g?ye+g*m:this.nextAudioPts)-xt.pts;ce>he?(F=ce-oe,F<0&&(F=oe),k.logger.log("[mp4-remuxer]: It is approximately "+ce/90+" ms to the next segment; using duration "+F/90+" ms for the last video frame.")):F=oe}else F=oe}var Ce=Math.round(xt.pts-xt.dts);M.push(new v(xt.key,F,se,Ce))}if(M.length&&S&&S<70){var Ae=M[0].flags;Ae.dependsOn=2,Ae.isNonSync=0}console.assert(F!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=ee=ge+F,this.isVideoContiguous=!0;var Ge=O.default.moof(h.sequenceNumber++,ie,w({},h,{samples:M})),Ue="video",He={data1:Ge,data2:rt,startPTS:ye/m,endPTS:(xe+F)/m,startDTS:ie/m,endDTS:ee/m,type:Ue,hasAudio:!1,hasVideo:!0,nb:M.length,dropped:h.dropped};return h.samples=[],h.dropped=0,console.assert(rt.length,"MDAT length must not be zero"),He},y.remuxAudio=function(h,s,a,g,m){var b=h.inputTimeScale,M=h.samplerate?h.samplerate:b,K=b/M,z=h.isAAC?T:C,ee=z*K,G=this._initPTS,F=!h.isAAC&&this.typeSupported.mpeg,ie=[],ge=h.samples,ye=F?0:8,xe=this.nextAudioPts||-1,Te=s*b;if(this.isAudioContiguous=a=a||ge.length&&xe>0&&(g&&Math.abs(Te-xe)<9e3||Math.abs(c(ge[0].pts-G,Te)-xe)<20*ee),ge.forEach(function(ue){ue.pts=c(ue.pts-G,Te)}),!a||xe<0){if(ge=ge.filter(function(ue){return ue.pts>=0}),!ge.length)return;m===0?xe=0:g?xe=Math.max(0,Te):xe=ge[0].pts}if(h.isAAC)for(var Se=m!==void 0,me=this.config.maxAudioFramesDrift,pe=0,Ee=xe;pe<ge.length;pe++){var le=ge[pe],I=le.pts,x=I-Ee,R=Math.abs(1e3*x/b);if(x<=-me*ee&&Se)pe===0&&(k.logger.warn("Audio frame @ "+(I/b).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*x/b)+" ms."),this.nextAudioPts=xe=Ee=I);else if(x>=me*ee&&R<D&&Se){var W=Math.round(x/ee);Ee=I-W*ee,Ee<0&&(W--,Ee+=ee),pe===0&&(this.nextAudioPts=xe=Ee),k.logger.warn("[mp4-remuxer]: Injecting "+W+" audio frame @ "+(Ee/b).toFixed(3)+"s due to "+Math.round(1e3*x/b)+" ms gap.");for(var J=0;J<W;J++){var B=Math.max(Ee,0),de=U.default.getSilentFrame(h.manifestCodec||h.codec,h.channelCount);de||(k.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),de=le.unit.subarray()),ge.splice(pe,0,{unit:de,pts:B}),Ee+=ee,pe++}}le.pts=Ee,Ee+=ee}for(var _e=null,Re=null,Oe,ke=0,Ie=ge.length;Ie--;)ke+=ge[Ie].unit.byteLength;for(var De=0,Ve=ge.length;De<Ve;De++){var Qe=ge[De],at=Qe.unit,Ze=Qe.pts;if(Re!==null){var yt=ie[De-1];yt.duration=Math.round((Ze-Re)/K)}else if(a&&h.isAAC&&(Ze=xe),_e=Ze,ke>0){ke+=ye;try{Oe=new Uint8Array(ke)}catch(ue){this.observer.emit(H.Events.ERROR,H.Events.ERROR,{type:N.ErrorTypes.MUX_ERROR,details:N.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:ke,reason:"fail allocating audio mdat "+ke});return}if(!F){var rt=new DataView(Oe.buffer);rt.setUint32(0,ke),Oe.set(O.default.types.mdat,4)}}else return;Oe.set(at,ye);var dt=at.byteLength;ye+=dt,ie.push(new v(!0,z,dt,0)),Re=Ze}var Me=ie.length;if(!Me)return;var xt=ie[ie.length-1];this.nextAudioPts=xe=Re+K*xt.duration;var mt=F?new Uint8Array(0):O.default.moof(h.sequenceNumber++,_e/K,w({},h,{samples:ie}));h.samples=[];var se=_e/b,Z=xe/b,q="audio",ae={data1:mt,data2:Oe,startPTS:se,endPTS:Z,startDTS:se,endDTS:Z,type:q,hasAudio:!0,hasVideo:!1,nb:Me};return this.isAudioContiguous=!0,console.assert(Oe.length,"MDAT length must not be zero"),ae},y.remuxEmptyAudio=function(h,s,a,g){var m=h.inputTimeScale,b=h.samplerate?h.samplerate:m,M=m/b,K=this.nextAudioPts,z=(K!==null?K:g.startDTS*m)+this._initDTS,ee=g.endDTS*m+this._initDTS,G=M*T,F=Math.ceil((ee-z)/G),ie=U.default.getSilentFrame(h.manifestCodec||h.codec,h.channelCount);if(k.logger.warn("[mp4-remuxer]: remux empty Audio"),!ie){k.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var ge=[],ye=0;ye<F;ye++){var xe=z+ye*G;ge.push({unit:ie,pts:xe,dts:xe})}return h.samples=ge,this.remuxAudio(h,s,a,!1)},y.remuxID3=function(h,s){var a=h.samples.length;if(!a)return;for(var g=h.inputTimeScale,m=this._initPTS,b=this._initDTS,M=0;M<a;M++){var K=h.samples[M];K.pts=c(K.pts-m,s*g)/g,K.dts=c(K.dts-b,s*g)/g}var z=h.samples;return h.samples=[],{samples:z}},y.remuxText=function(h,s){var a=h.samples.length;if(!a)return;for(var g=h.inputTimeScale,m=this._initPTS,b=0;b<a;b++){var M=h.samples[b];M.pts=c(M.pts-m,s*g)/g}h.samples.sort(function(z,ee){return z.pts-ee.pts});var K=h.samples;return h.samples=[],{samples:K}},u}();function c(u,y){var d;if(y===null)return u;for(y<u?d=-8589934592:d=8589934592;Math.abs(u-y)>4294967296;)u+=d;return u}function E(u){for(var y=0;y<u.length;y++)if(u[y].key)return y;return-1}var v=function(y,d,h,s){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=d,this.size=h,this.cts=s,this.flags=new p(y)},p=function(y){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=y?2:1,this.isNonSync=y?0:1}},"./src/remux/passthrough-remuxer.ts":function(fe,$,P){"use strict";P.r($);var Y=P("./src/polyfills/number.ts"),U=P("./src/utils/mp4-tools.ts"),O=P("./src/loader/fragment.ts"),H=P("./src/utils/logger.ts"),N=function(){function _(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=void 0,this.initTracks=void 0,this.lastEndDTS=null}var w=_.prototype;return w.destroy=function(){},w.resetTimeStamp=function(T){this.initPTS=T,this.lastEndDTS=null},w.resetNextTimestamp=function(){this.lastEndDTS=null},w.resetInitSegment=function(T,C,S){this.audioCodec=C,this.videoCodec=S,this.generateInitSegment(T),this.emitInitSegment=!0},w.generateInitSegment=function(T){var C=this.audioCodec,S=this.videoCodec;if(!T||!T.byteLength){this.initTracks=void 0,this.initData=void 0;return}var f=this.initData=Object(U.parseInitSegment)(T);C||(C=L(f.audio,O.ElementaryStreamTypes.AUDIO)),S||(S=L(f.video,O.ElementaryStreamTypes.VIDEO));var l={};f.audio&&f.video?l.audiovideo={container:"video/mp4",codec:C+","+S,initSegment:T,id:"main"}:f.audio?l.audio={container:"audio/mp4",codec:C,initSegment:T,id:"audio"}:f.video?l.video={container:"video/mp4",codec:S,initSegment:T,id:"main"}:H.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=l},w.remux=function(T,C,S,f,l){var i=this.initPTS,c=this.lastEndDTS,E={audio:void 0,video:void 0,text:f,id3:S,initSegment:void 0};Object(Y.isFiniteNumber)(c)||(c=this.lastEndDTS=l||0);var v=C.samples;if(!v||!v.length)return E;var p={initPTS:void 0,timescale:1},u=this.initData;if((!u||!u.length)&&(this.generateInitSegment(v),u=this.initData),!u||!u.length)return H.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),E;this.emitInitSegment&&(p.tracks=this.initTracks,this.emitInitSegment=!1),Object(Y.isFiniteNumber)(i)||(this.initPTS=p.initPTS=i=k(u,v,c));var y=Object(U.getDuration)(v,u),d=c,h=y+d;Object(U.offsetStartDTS)(u,v,i),y>0?this.lastEndDTS=h:(H.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var s=!!u.audio,a=!!u.video,g="";s&&(g+="audio"),a&&(g+="video");var m={data1:v,startPTS:d,startDTS:d,endPTS:h,endDTS:h,type:g,hasAudio:s,hasVideo:a,nb:1,dropped:0};return E.audio=m.type==="audio"?m:void 0,E.video=m.type!=="audio"?m:void 0,E.text=f,E.id3=S,E.initSegment=p,E},_}(),k=function(w,D,T){return Object(U.getStartDTS)(w,D)-T};function L(_,w){var D=_==null?void 0:_.codec;return D&&D.length>4?D:D==="hvc1"?"hvc1.1.c.L120.90":D==="av01"?"av01.0.04M.08":D==="avc1"||w===O.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}$.default=N},"./src/task-loop.ts":function(fe,$,P){"use strict";P.r($),P.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 O=U.prototype;return O.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},O.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},O.onHandlerDestroyed=function(){},O.hasInterval=function(){return!!this._tickInterval},O.hasNextTick=function(){return!!this._tickTimer},O.setInterval=function(N){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,N),!0)},O.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},O.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},O.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},O.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},O.doTick=function(){},U}()},"./src/types/cmcd.ts":function(fe,$,P){"use strict";P.r($),P.d($,"CMCDVersion",function(){return Y}),P.d($,"CMCDObjectType",function(){return U}),P.d($,"CMCDStreamingFormat",function(){return O}),P.d($,"CMCDStreamType",function(){return H});var Y=1,U;(function(N){N.MANIFEST="m",N.AUDIO="a",N.VIDEO="v",N.MUXED="av",N.INIT="i",N.CAPTION="c",N.TIMED_TEXT="tt",N.KEY="k",N.OTHER="o"})(U||(U={}));var O;(function(N){N.DASH="d",N.HLS="h",N.SMOOTH="s",N.OTHER="o"})(O||(O={}));var H;(function(N){N.VOD="v",N.LIVE="l"})(H||(H={}))},"./src/types/level.ts":function(fe,$,P){"use strict";P.r($),P.d($,"HlsSkip",function(){return O}),P.d($,"getSkipValue",function(){return H}),P.d($,"HlsUrlParameters",function(){return N}),P.d($,"Level",function(){return k});function Y(L,_){for(var w=0;w<_.length;w++){var D=_[w];D.enumerable=D.enumerable||!1,D.configurable=!0,"value"in D&&(D.writable=!0),Object.defineProperty(L,D.key,D)}}function U(L,_,w){return _&&Y(L.prototype,_),w&&Y(L,w),L}var O;(function(L){L.No="",L.Yes="YES",L.v2="v2"})(O||(O={}));function H(L,_){var w=L.canSkipUntil,D=L.canSkipDateRanges,T=L.endSN,C=_!==void 0?_-T:0;return w&&C<w?D?O.v2:O.Yes:O.No}var N=function(){function L(w,D,T){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=w,this.part=D,this.skip=T}var _=L.prototype;return _.addDirectives=function(D){var T=new self.URL(D);return this.msn!==void 0&&T.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&T.searchParams.set("_HLS_part",this.part.toString()),this.skip&&T.searchParams.set("_HLS_skip",this.skip),T.toString()},L}(),k=function(){function L(_){this.attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.videoCodec=void 0,this.width=void 0,this.unknownCodecs=void 0,this.audioGroupIds=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.textGroupIds=void 0,this.url=void 0,this._urlId=0,this.url=[_.url],this.attrs=_.attrs,this.bitrate=_.bitrate,_.details&&(this.details=_.details),this.id=_.id||0,this.name=_.name,this.width=_.width||0,this.height=_.height||0,this.audioCodec=_.audioCodec,this.videoCodec=_.videoCodec,this.unknownCodecs=_.unknownCodecs,this.codecSet=[_.videoCodec,_.audioCodec].filter(function(w){return w}).join(",").replace(/\.[^.,]+/g,"")}return U(L,[{key:"maxBitrate",get:function(){return Math.max(this.realBitrate,this.bitrate)}},{key:"uri",get:function(){return this.url[this._urlId]||""}},{key:"urlId",get:function(){return this._urlId},set:function(w){var D=w%this.url.length;this._urlId!==D&&(this.details=void 0,this._urlId=D)}}]),L}()},"./src/types/loader.ts":function(fe,$,P){"use strict";P.r($),P.d($,"PlaylistContextType",function(){return Y}),P.d($,"PlaylistLevelType",function(){return U});var Y;(function(O){O.MANIFEST="manifest",O.LEVEL="level",O.AUDIO_TRACK="audioTrack",O.SUBTITLE_TRACK="subtitleTrack"})(Y||(Y={}));var U;(function(O){O.MAIN="main",O.AUDIO="audio",O.SUBTITLE="subtitle"})(U||(U={}))},"./src/types/transmuxer.ts":function(fe,$,P){"use strict";P.r($),P.d($,"ChunkMetadata",function(){return Y});var Y=function(H,N,k,L,_,w){L===void 0&&(L=0),_===void 0&&(_=-1),w===void 0&&(w=!1),this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=U(),this.buffering={audio:U(),video:U(),audiovideo:U()},this.level=H,this.sn=N,this.id=k,this.size=L,this.part=_,this.partial=w};function U(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(fe,$,P){"use strict";P.r($),P.d($,"AttrList",function(){return O});var Y=/^(\d+)x(\d+)$/,U=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,O=function(){function H(k){typeof k=="string"&&(k=H.parseAttrList(k));for(var L in k)k.hasOwnProperty(L)&&(this[L]=k[L])}var N=H.prototype;return N.decimalInteger=function(L){var _=parseInt(this[L],10);return _>Number.MAX_SAFE_INTEGER?Infinity:_},N.hexadecimalInteger=function(L){if(this[L]){var _=(this[L]||"0x").slice(2);_=(_.length&1?"0":"")+_;for(var w=new Uint8Array(_.length/2),D=0;D<_.length/2;D++)w[D]=parseInt(_.slice(D*2,D*2+2),16);return w}else return null},N.hexadecimalIntegerAsNumber=function(L){var _=parseInt(this[L],16);return _>Number.MAX_SAFE_INTEGER?Infinity:_},N.decimalFloatingPoint=function(L){return parseFloat(this[L])},N.optionalFloat=function(L,_){var w=this[L];return w?parseFloat(w):_},N.enumeratedString=function(L){return this[L]},N.bool=function(L){return this[L]==="YES"},N.decimalResolution=function(L){var _=Y.exec(this[L]);return _===null?void 0:{width:parseInt(_[1],10),height:parseInt(_[2],10)}},H.parseAttrList=function(L){var _,w={},D='"';for(U.lastIndex=0;(_=U.exec(L))!==null;){var T=_[2];T.indexOf(D)===0&&T.lastIndexOf(D)===T.length-1&&(T=T.slice(1,-1)),w[_[1]]=T}return w},H}()},"./src/utils/binary-search.ts":function(fe,$,P){"use strict";P.r($);var Y={search:function(O,H){for(var N=0,k=O.length-1,L=null,_=null;N<=k;){L=(N+k)/2|0,_=O[L];var w=H(_);if(w>0)N=L+1;else if(w<0)k=L-1;else return _}return null}};$.default=Y},"./src/utils/buffer-helper.ts":function(fe,$,P){"use strict";P.r($),P.d($,"BufferHelper",function(){return O});var Y=P("./src/utils/logger.ts"),U={length:0,start:function(){return 0},end:function(){return 0}},O=function(){function H(){}return H.isBuffered=function(k,L){try{if(k){for(var _=H.getBuffered(k),w=0;w<_.length;w++)if(L>=_.start(w)&&L<=_.end(w))return!0}}catch(D){}return!1},H.bufferInfo=function(k,L,_){try{if(k){var w=H.getBuffered(k),D=[],T;for(T=0;T<w.length;T++)D.push({start:w.start(T),end:w.end(T)});return this.bufferedInfo(D,L,_)}}catch(C){}return{len:0,start:L,end:L,nextStart:void 0}},H.bufferedInfo=function(k,L,_){L=Math.max(0,L),k.sort(function(p,u){var y=p.start-u.start;return y||u.end-p.end});var w=[];if(_)for(var D=0;D<k.length;D++){var T=w.length;if(T){var C=w[T-1].end;k[D].start-C<_?k[D].end>C&&(w[T-1].end=k[D].end):w.push(k[D])}else w.push(k[D])}else w=k;for(var S=0,f,l=L,i=L,c=0;c<w.length;c++){var E=w[c].start,v=w[c].end;if(L+_>=E&&L<v)l=E,i=v,S=i-L;else if(L+_<E){f=E;break}}return{len:S,start:l||0,end:i||0,nextStart:f}},H.getBuffered=function(k){try{return k.buffered}catch(L){return Y.logger.log("failed to get media.buffered",L),U}},H}()},"./src/utils/cea-608-parser.ts":function(fe,$,P){"use strict";P.r($),P.d($,"Row",function(){return i}),P.d($,"CaptionScreen",function(){return c});var Y=P("./src/utils/logger.ts"),U={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},O=function(h){var s=h;return U.hasOwnProperty(h)&&(s=U[h]),String.fromCharCode(s)},H=15,N=100,k={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},L={17:2,18:4,21:6,22:8,23:10,19:13,20:15},_={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},w={25:2,26:4,29:6,30:8,31:10,27:13,28:15},D=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],T;(function(d){d[d.ERROR=0]="ERROR",d[d.TEXT=1]="TEXT",d[d.WARNING=2]="WARNING",d[d.INFO=2]="INFO",d[d.DEBUG=3]="DEBUG",d[d.DATA=3]="DATA"})(T||(T={}));var C=function(){function d(){this.time=null,this.verboseLevel=T.ERROR}var h=d.prototype;return h.log=function(a,g){this.verboseLevel>=a&&Y.logger.log(this.time+" ["+a+"] "+g)},d}(),S=function(h){for(var s=[],a=0;a<h.length;a++)s.push(h[a].toString(16));return s},f=function(){function d(s,a,g,m,b){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=s||"white",this.underline=a||!1,this.italics=g||!1,this.background=m||"black",this.flash=b||!1}var h=d.prototype;return h.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},h.setStyles=function(a){for(var g=["foreground","underline","italics","background","flash"],m=0;m<g.length;m++){var b=g[m];a.hasOwnProperty(b)&&(this[b]=a[b])}},h.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},h.equals=function(a){return this.foreground===a.foreground&&this.underline===a.underline&&this.italics===a.italics&&this.background===a.background&&this.flash===a.flash},h.copy=function(a){this.foreground=a.foreground,this.underline=a.underline,this.italics=a.italics,this.background=a.background,this.flash=a.flash},h.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},d}(),l=function(){function d(s,a,g,m,b,M){this.uchar=void 0,this.penState=void 0,this.uchar=s||" ",this.penState=new f(a,g,m,b,M)}var h=d.prototype;return h.reset=function(){this.uchar=" ",this.penState.reset()},h.setChar=function(a,g){this.uchar=a,this.penState.copy(g)},h.setPenState=function(a){this.penState.copy(a)},h.equals=function(a){return this.uchar===a.uchar&&this.penState.equals(a.penState)},h.copy=function(a){this.uchar=a.uchar,this.penState.copy(a.penState)},h.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},d}(),i=function(){function d(s){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var a=0;a<N;a++)this.chars.push(new l);this.logger=s,this.pos=0,this.currPenState=new f}var h=d.prototype;return h.equals=function(a){for(var g=!0,m=0;m<N;m++)if(!this.chars[m].equals(a.chars[m])){g=!1;break}return g},h.copy=function(a){for(var g=0;g<N;g++)this.chars[g].copy(a.chars[g])},h.isEmpty=function(){for(var a=!0,g=0;g<N;g++)if(!this.chars[g].isEmpty()){a=!1;break}return a},h.setCursor=function(a){this.pos!==a&&(this.pos=a),this.pos<0?(this.logger.log(T.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>N&&(this.logger.log(T.DEBUG,"Too large cursor position "+this.pos),this.pos=N)},h.moveCursor=function(a){var g=this.pos+a;if(a>1)for(var m=this.pos+1;m<g+1;m++)this.chars[m].setPenState(this.currPenState);this.setCursor(g)},h.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},h.insertChar=function(a){a>=144&&this.backSpace();var g=O(a);if(this.pos>=N){this.logger.log(T.ERROR,"Cannot insert "+a.toString(16)+" ("+g+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(g,this.currPenState),this.moveCursor(1)},h.clearFromPos=function(a){var g;for(g=a;g<N;g++)this.chars[g].reset()},h.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},h.clearToEndOfRow=function(){this.clearFromPos(this.pos)},h.getTextString=function(){for(var a=[],g=!0,m=0;m<N;m++){var b=this.chars[m].uchar;b!==" "&&(g=!1),a.push(b)}return g?"":a.join("")},h.setPenStyles=function(a){this.currPenState.setStyles(a);var g=this.chars[this.pos];g.setPenState(this.currPenState)},d}(),c=function(){function d(s){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var a=0;a<H;a++)this.rows.push(new i(s));this.logger=s,this.currRow=H-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var h=d.prototype;return h.reset=function(){for(var a=0;a<H;a++)this.rows[a].clear();this.currRow=H-1},h.equals=function(a){for(var g=!0,m=0;m<H;m++)if(!this.rows[m].equals(a.rows[m])){g=!1;break}return g},h.copy=function(a){for(var g=0;g<H;g++)this.rows[g].copy(a.rows[g])},h.isEmpty=function(){for(var a=!0,g=0;g<H;g++)if(!this.rows[g].isEmpty()){a=!1;break}return a},h.backSpace=function(){var a=this.rows[this.currRow];a.backSpace()},h.clearToEndOfRow=function(){var a=this.rows[this.currRow];a.clearToEndOfRow()},h.insertChar=function(a){var g=this.rows[this.currRow];g.insertChar(a)},h.setPen=function(a){var g=this.rows[this.currRow];g.setPenStyles(a)},h.moveCursor=function(a){var g=this.rows[this.currRow];g.moveCursor(a)},h.setCursor=function(a){this.logger.log(T.INFO,"setCursor: "+a);var g=this.rows[this.currRow];g.setCursor(a)},h.setPAC=function(a){this.logger.log(T.INFO,"pacData = "+JSON.stringify(a));var g=a.row-1;if(this.nrRollUpRows&&g<this.nrRollUpRows-1&&(g=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==g){for(var m=0;m<H;m++)this.rows[m].clear();var b=this.currRow+1-this.nrRollUpRows,M=this.lastOutputScreen;if(M){var K=M.rows[b].cueStartTime,z=this.logger.time;if(K&&z!==null&&K<z)for(var ee=0;ee<this.nrRollUpRows;ee++)this.rows[g-this.nrRollUpRows+ee+1].copy(M.rows[b+ee])}}this.currRow=g;var G=this.rows[this.currRow];if(a.indent!==null){var F=a.indent,ie=Math.max(F-1,0);G.setCursor(a.indent),a.color=G.chars[ie].penState.foreground}var ge={foreground:a.color,underline:a.underline,italics:a.italics,background:"black",flash:!1};this.setPen(ge)},h.setBkgData=function(a){this.logger.log(T.INFO,"bkgData = "+JSON.stringify(a)),this.backSpace(),this.setPen(a),this.insertChar(32)},h.setRollUpRows=function(a){this.nrRollUpRows=a},h.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(T.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(T.TEXT,this.getDisplayText());var a=this.currRow+1-this.nrRollUpRows,g=this.rows.splice(a,1)[0];g.clear(),this.rows.splice(this.currRow,0,g),this.logger.log(T.INFO,"Rolling up")},h.getDisplayText=function(a){a=a||!1;for(var g=[],m="",b=-1,M=0;M<H;M++){var K=this.rows[M].getTextString();K&&(b=M+1,a?g.push("Row "+b+": '"+K+"'"):g.push(K.trim()))}return g.length>0&&(a?m="["+g.join(" | ")+"]":m=g.join(`
`)),m},h.getTextAndFormat=function(){return this.rows},d}(),E=function(){function d(s,a,g){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=s,this.outputFilter=a,this.mode=null,this.verbose=0,this.displayedMemory=new c(g),this.nonDisplayedMemory=new c(g),this.lastOutputScreen=new c(g),this.currRollUpRow=this.displayedMemory.rows[H-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=g}var h=d.prototype;return h.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[H-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},h.getHandler=function(){return this.outputFilter},h.setHandler=function(a){this.outputFilter=a},h.setPAC=function(a){this.writeScreen.setPAC(a)},h.setBkgData=function(a){this.writeScreen.setBkgData(a)},h.setMode=function(a){if(a===this.mode)return;this.mode=a,this.logger.log(T.INFO,"MODE="+a),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=a},h.insertChars=function(a){for(var g=0;g<a.length;g++)this.writeScreen.insertChar(a[g]);var m=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(T.INFO,m+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(T.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},h.ccRCL=function(){this.logger.log(T.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},h.ccBS=function(){if(this.logger.log(T.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},h.ccAOF=function(){},h.ccAON=function(){},h.ccDER=function(){this.logger.log(T.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},h.ccRU=function(a){this.logger.log(T.INFO,"RU("+a+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(a)},h.ccFON=function(){this.logger.log(T.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},h.ccRDC=function(){this.logger.log(T.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},h.ccTR=function(){this.logger.log(T.INFO,"TR"),this.setMode("MODE_TEXT")},h.ccRTD=function(){this.logger.log(T.INFO,"RTD"),this.setMode("MODE_TEXT")},h.ccEDM=function(){this.logger.log(T.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},h.ccCR=function(){this.logger.log(T.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},h.ccENM=function(){this.logger.log(T.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},h.ccEOC=function(){if(this.logger.log(T.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var a=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=a,this.writeScreen=this.nonDisplayedMemory,this.logger.log(T.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},h.ccTO=function(a){this.logger.log(T.INFO,"TO("+a+") - Tab Offset"),this.writeScreen.moveCursor(a)},h.ccMIDROW=function(a){var g={flash:!1};if(g.underline=a%2===1,g.italics=a>=46,g.italics)g.foreground="white";else{var m=Math.floor(a/2)-16,b=["white","green","blue","cyan","red","yellow","magenta"];g.foreground=b[m]}this.logger.log(T.INFO,"MIDROW: "+JSON.stringify(g)),this.writeScreen.setPen(g)},h.outputDataUpdate=function(a){a===void 0&&(a=!1);var g=this.logger.time;if(g===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=g:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,g,this.lastOutputScreen),a&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:g),this.lastOutputScreen.copy(this.displayedMemory))},h.cueSplitAtTime=function(a){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,a,this.displayedMemory),this.cueStartTime=a))},d}(),v=function(){function d(s,a,g){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var m=new C;this.channels=[null,new E(s,a,m),new E(s+1,g,m)],this.cmdHistory=y(),this.logger=m}var h=d.prototype;return h.getHandler=function(a){return this.channels[a].getHandler()},h.setHandler=function(a,g){this.channels[a].setHandler(g)},h.addData=function(a,g){var m,b,M,K=!1;this.logger.time=a;for(var z=0;z<g.length;z+=2){if(b=g[z]&127,M=g[z+1]&127,b===0&&M===0)continue;if(this.logger.log(T.DATA,"["+S([g[z],g[z+1]])+"] -> ("+S([b,M])+")"),m=this.parseCmd(b,M),m||(m=this.parseMidrow(b,M)),m||(m=this.parsePAC(b,M)),m||(m=this.parseBackgroundAttributes(b,M)),!m&&(K=this.parseChars(b,M),K)){var ee=this.currentChannel;if(ee&&ee>0){var G=this.channels[ee];G.insertChars(K)}else this.logger.log(T.WARNING,"No channel found yet. TEXT-MODE?")}!m&&!K&&this.logger.log(T.WARNING,"Couldn't parse cleaned data "+S([b,M])+" orig: "+S([g[z],g[z+1]]))}},h.parseCmd=function(a,g){var m=this.cmdHistory,b=(a===20||a===28||a===21||a===29)&&g>=32&&g<=47,M=(a===23||a===31)&&g>=33&&g<=35;if(!(b||M))return!1;if(u(a,g,m))return p(null,null,m),this.logger.log(T.DEBUG,"Repeated command ("+S([a,g])+") is dropped"),!0;var K=a===20||a===21||a===23?1:2,z=this.channels[K];return a===20||a===21||a===28||a===29?g===32?z.ccRCL():g===33?z.ccBS():g===34?z.ccAOF():g===35?z.ccAON():g===36?z.ccDER():g===37?z.ccRU(2):g===38?z.ccRU(3):g===39?z.ccRU(4):g===40?z.ccFON():g===41?z.ccRDC():g===42?z.ccTR():g===43?z.ccRTD():g===44?z.ccEDM():g===45?z.ccCR():g===46?z.ccENM():g===47&&z.ccEOC():z.ccTO(g-32),p(a,g,m),this.currentChannel=K,!0},h.parseMidrow=function(a,g){var m=0;if((a===17||a===25)&&g>=32&&g<=47){if(a===17?m=1:m=2,m!==this.currentChannel)return this.logger.log(T.ERROR,"Mismatch channel in midrow parsing"),!1;var b=this.channels[m];return b?(b.ccMIDROW(g),this.logger.log(T.DEBUG,"MIDROW ("+S([a,g])+")"),!0):!1}return!1},h.parsePAC=function(a,g){var m,b=this.cmdHistory,M=(a>=17&&a<=23||a>=25&&a<=31)&&g>=64&&g<=127,K=(a===16||a===24)&&g>=64&&g<=95;if(!(M||K))return!1;if(u(a,g,b))return p(null,null,b),!0;var z=a<=23?1:2;g>=64&&g<=95?m=z===1?k[a]:_[a]:m=z===1?L[a]:w[a];var ee=this.channels[z];return ee?(ee.setPAC(this.interpretPAC(m,g)),p(a,g,b),this.currentChannel=z,!0):!1},h.interpretPAC=function(a,g){var m,b={color:null,italics:!1,indent:null,underline:!1,row:a};return g>95?m=g-96:m=g-64,b.underline=(m&1)===1,m<=13?b.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(m/2)]:m<=15?(b.italics=!0,b.color="white"):b.indent=Math.floor((m-16)/2)*4,b},h.parseChars=function(a,g){var m,b=null,M=null;if(a>=25?(m=2,M=a-8):(m=1,M=a),M>=17&&M<=19){var K;M===17?K=g+80:M===18?K=g+112:K=g+144,this.logger.log(T.INFO,"Special char '"+O(K)+"' in channel "+m),b=[K]}else a>=32&&a<=127&&(b=g===0?[a]:[a,g]);if(b){var z=S(b);this.logger.log(T.DEBUG,"Char codes = "+z.join(",")),p(a,g,this.cmdHistory)}return b},h.parseBackgroundAttributes=function(a,g){var m=(a===16||a===24)&&g>=32&&g<=47,b=(a===23||a===31)&&g>=45&&g<=47;if(!(m||b))return!1;var M,K={};a===16||a===24?(M=Math.floor((g-32)/2),K.background=D[M],g%2===1&&(K.background=K.background+"_semi")):g===45?K.background="transparent":(K.foreground="black",g===47&&(K.underline=!0));var z=a<=23?1:2,ee=this.channels[z];return ee.setBkgData(K),p(a,g,this.cmdHistory),!0},h.reset=function(){for(var a=0;a<Object.keys(this.channels).length;a++){var g=this.channels[a];g&&g.reset()}this.cmdHistory=y()},h.cueSplitAtTime=function(a){for(var g=0;g<this.channels.length;g++){var m=this.channels[g];m&&m.cueSplitAtTime(a)}},d}();function p(d,h,s){s.a=d,s.b=h}function u(d,h,s){return s.a===d&&s.b===h}function y(){return{a:null,b:null}}$.default=v},"./src/utils/codecs.ts":function(fe,$,P){"use strict";P.r($),P.d($,"isCodecType",function(){return U}),P.d($,"isCodecSupportedInMp4",function(){return O});var Y={audio:{a3ds:!0,"ac-3":!0,"ac-4":!0,alac:!0,alaw:!0,dra1:!0,"dts+":!0,"dts-":!0,dtsc:!0,dtse:!0,dtsh:!0,"ec-3":!0,enca:!0,g719:!0,g726:!0,m4ae:!0,mha1:!0,mha2:!0,mhm1:!0,mhm2:!0,mlpa:!0,mp4a:!0,"raw ":!0,Opus:!0,samr:!0,sawb:!0,sawp:!0,sevc:!0,sqcp:!0,ssmv:!0,twos:!0,ulaw:!0},video:{avc1:!0,avc2:!0,avc3:!0,avc4:!0,avcp:!0,av01:!0,drac:!0,dvav:!0,dvhe:!0,encv:!0,hev1:!0,hvc1:!0,mjp2:!0,mp4v:!0,mvc1:!0,mvc2:!0,mvc3:!0,mvc4:!0,resv:!0,rv60:!0,s263:!0,svc1:!0,svc2:!0,"vc-1":!0,vp08:!0,vp09:!0},text:{stpp:!0,wvtt:!0}};function U(H,N){var k=Y[N];return!!k&&k[H.slice(0,4)]===!0}function O(H,N){return MediaSource.isTypeSupported((N||"video")+'/mp4;codecs="'+H+'"')}},"./src/utils/cues.ts":function(fe,$,P){"use strict";P.r($);var Y=P("./src/utils/vttparser.ts"),U=P("./src/utils/webvtt-parser.ts"),O=P("./src/utils/texttrack-utils.ts"),H=/\s/,N={newCue:function(L,_,w,D){for(var T=[],C,S,f,l,i,c=self.VTTCue||self.TextTrackCue,E=0;E<D.rows.length;E++)if(C=D.rows[E],f=!0,l=0,i="",!C.isEmpty()){for(var v=0;v<C.chars.length;v++)H.test(C.chars[v].uchar)&&f?l++:(i+=C.chars[v].uchar,f=!1);C.cueStartTime=_,_===w&&(w+=1e-4),l>=16?l--:l++;var p=Object(Y.fixLineBreaks)(i.trim()),u=Object(U.generateCueId)(_,w,p);(!L||!L.cues||!L.cues.getCueById(u))&&(S=new c(_,w,p),S.id=u,S.line=E+1,S.align="left",S.position=10+Math.min(80,Math.floor(l*8/32)*10),T.push(S))}return L&&T.length&&(T.sort(function(y,d){return y.line==="auto"||d.line==="auto"?0:y.line>8&&d.line>8?d.line-y.line:y.line-d.line}),T.forEach(function(y){return Object(O.addCueToTrack)(L,y)})),T}};$.default=N},"./src/utils/discontinuities.ts":function(fe,$,P){"use strict";P.r($),P.d($,"findFirstFragWithCC",function(){return H}),P.d($,"shouldAlignOnDiscontinuities",function(){return N}),P.d($,"findDiscontinuousReferenceFrag",function(){return k}),P.d($,"adjustSlidingStart",function(){return _}),P.d($,"alignStream",function(){return w}),P.d($,"alignPDT",function(){return T}),P.d($,"alignFragmentByPDTDelta",function(){return C}),P.d($,"alignMediaPlaylistByPDT",function(){return S});var Y=P("./src/polyfills/number.ts"),U=P("./src/utils/logger.ts"),O=P("./src/controller/level-helper.ts");function H(f,l){for(var i=null,c=0,E=f.length;c<E;c++){var v=f[c];if(v&&v.cc===l){i=v;break}}return i}function N(f,l,i){return!!(l.details&&(i.endCC>i.startCC||f&&f.cc<i.startCC))}function k(f,l){var i=f.fragments,c=l.fragments;if(!c.length||!i.length){U.logger.log("No fragments to align");return}var E=H(i,c[0].cc);if(!E||E&&!E.startPTS){U.logger.log("No frag in previous level to align on");return}return E}function L(f,l){if(f){var i=f.start+l;f.start=f.startPTS=i,f.endPTS=i+f.duration}}function _(f,l){for(var i=l.fragments,c=0,E=i.length;c<E;c++)L(i[c],f);l.fragmentHint&&L(l.fragmentHint,f),l.alignedSliding=!0}function w(f,l,i){if(!l)return;D(f,i,l),!i.alignedSliding&&l.details&&T(i,l.details),!i.alignedSliding&&l.details&&!i.skippedSegments&&Object(O.adjustSliding)(l.details,i)}function D(f,l,i){if(N(f,i,l)){var c=k(i.details,l);c&&Object(Y.isFiniteNumber)(c.start)&&(U.logger.log("Adjusting PTS using last level due to CC increase within current level "+l.url),_(c.start,l))}}function T(f,l){if(!l.fragments.length||!f.hasProgramDateTime||!l.hasProgramDateTime)return;var i=l.fragments[0].programDateTime,c=f.fragments[0].programDateTime,E=(c-i)/1e3+l.fragments[0].start;E&&Object(Y.isFiniteNumber)(E)&&(U.logger.log("Adjusting PTS using programDateTime delta "+(c-i)+"ms, sliding:"+E.toFixed(3)+" "+f.url+" "),_(E,f))}function C(f,l){var i=f.programDateTime;if(!i)return;var c=(i-l)/1e3;f.start=f.startPTS=c,f.endPTS=c+f.duration}function S(f,l){if(!l.fragments.length||!f.hasProgramDateTime||!l.hasProgramDateTime)return;var i=l.fragments[0].programDateTime,c=l.fragments[0].start,E=i-c*1e3;f.fragments.forEach(function(v){C(v,E)}),f.fragmentHint&&C(f.fragmentHint,E),f.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(fe,$,P){"use strict";P.r($);var Y=P("./src/utils/ewma.ts"),U=function(){function O(N,k,L){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=L,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new Y.default(N),this.fast_=new Y.default(k)}var H=O.prototype;return H.update=function(k,L){var _=this.slow_,w=this.fast_;this.slow_.halfLife!==k&&(this.slow_=new Y.default(k,_.getEstimate(),_.getTotalWeight())),this.fast_.halfLife!==L&&(this.fast_=new Y.default(L,w.getEstimate(),w.getTotalWeight()))},H.sample=function(k,L){k=Math.max(k,this.minDelayMs_);var _=8*L,w=k/1e3,D=_/w;this.fast_.sample(w,D),this.slow_.sample(w,D)},H.canEstimate=function(){var k=this.fast_;return k&&k.getTotalWeight()>=this.minWeight_},H.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},H.destroy=function(){},O}();$.default=U},"./src/utils/ewma.ts":function(fe,$,P){"use strict";P.r($);var Y=function(){function U(H,N,k){N===void 0&&(N=0),k===void 0&&(k=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=H,this.alpha_=H?Math.exp(Math.log(.5)/H):0,this.estimate_=N,this.totalWeight_=k}var O=U.prototype;return O.sample=function(N,k){var L=Math.pow(this.alpha_,N);this.estimate_=k*(1-L)+L*this.estimate_,this.totalWeight_+=N},O.getTotalWeight=function(){return this.totalWeight_},O.getEstimate=function(){if(this.alpha_){var N=1-Math.pow(this.alpha_,this.totalWeight_);if(N)return this.estimate_/N}return this.estimate_},U}();$.default=Y},"./src/utils/fetch-loader.ts":function(fe,$,P){"use strict";P.r($),P.d($,"fetchSupported",function(){return C});var Y=P("./src/polyfills/number.ts"),U=P("./src/loader/load-stats.ts"),O=P("./src/demux/chunk-cache.ts");function H(c,E){c.prototype=Object.create(E.prototype),c.prototype.constructor=c,w(c,E)}function N(c){var E=typeof Map=="function"?new Map:void 0;return N=function(p){if(p===null||!_(p))return p;if(typeof p!="function")throw new TypeError("Super expression must either be null or a function");if(typeof E!="undefined"){if(E.has(p))return E.get(p);E.set(p,u)}function u(){return k(p,arguments,D(this).constructor)}return u.prototype=Object.create(p.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),w(u,p)},N(c)}function k(c,E,v){return L()?k=Reflect.construct:k=function(u,y,d){var h=[null];h.push.apply(h,y);var s=Function.bind.apply(u,h),a=new s;return d&&w(a,d.prototype),a},k.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 _(c){return Function.toString.call(c).indexOf("[native code]")!==-1}function w(c,E){return w=Object.setPrototypeOf||function(p,u){return p.__proto__=u,p},w(c,E)}function D(c){return D=Object.setPrototypeOf?Object.getPrototypeOf:function(v){return v.__proto__||Object.getPrototypeOf(v)},D(c)}function T(){return T=Object.assign||function(c){for(var E=1;E<arguments.length;E++){var v=arguments[E];for(var p in v)Object.prototype.hasOwnProperty.call(v,p)&&(c[p]=v[p])}return c},T.apply(this,arguments)}function C(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(c){}return!1}var S=function(){function c(v){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=void 0,this.response=void 0,this.controller=void 0,this.context=void 0,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=v.fetchSetup||l,this.controller=new self.AbortController,this.stats=new U.LoadStats}var E=c.prototype;return E.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},E.abortInternal=function(){var p=this.response;(!p||!p.ok)&&(this.stats.aborted=!0,this.controller.abort())},E.abort=function(){var p;this.abortInternal(),(p=this.callbacks)!==null&&p!==void 0&&p.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},E.load=function(p,u,y){var d=this,h=this.stats;if(h.loading.start)throw new Error("Loader can only be used once.");h.loading.start=self.performance.now();var s=f(p,this.controller.signal),a=y.onProgress,g=p.responseType==="arraybuffer",m=g?"byteLength":"length";this.context=p,this.config=u,this.callbacks=y,this.request=this.fetchSetup(p,s),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){d.abortInternal(),y.onTimeout(h,p,d.response)},u.timeout),self.fetch(this.request).then(function(b){if(d.response=d.loader=b,!b.ok){var M=b.status,K=b.statusText;throw new i(K||"fetch, bad network response",M,b)}return h.loading.first=Math.max(self.performance.now(),h.loading.start),h.total=parseInt(b.headers.get("Content-Length")||"0"),a&&Object(Y.isFiniteNumber)(u.highWaterMark)?d.loadProgressively(b,h,p,u.highWaterMark,a):g?b.arrayBuffer():b.text()}).then(function(b){var M=d.response;self.clearTimeout(d.requestTimeout),h.loading.end=Math.max(self.performance.now(),h.loading.first),h.loaded=h.total=b[m];var K={url:M.url,data:b};a&&!Object(Y.isFiniteNumber)(u.highWaterMark)&&a(h,p,b,M),y.onSuccess(K,h,p,M)}).catch(function(b){if(self.clearTimeout(d.requestTimeout),h.aborted)return;var M=b.code||0;y.onError({code:M,text:b.message},p,b.details)})},E.getCacheAge=function(){var p=null;if(this.response){var u=this.response.headers.get("age");p=u?parseFloat(u):null}return p},E.loadProgressively=function(p,u,y,d,h){d===void 0&&(d=0);var s=new O.default,a=p.body.getReader(),g=function m(){return a.read().then(function(b){if(b.done)return s.dataLength&&h(u,y,s.flush(),p),Promise.resolve(new ArrayBuffer(0));var M=b.value,K=M.length;return u.loaded+=K,K<d||s.dataLength?(s.push(M),s.dataLength>=d&&h(u,y,s.flush(),p)):h(u,y,M,p),m()}).catch(function(){return Promise.reject()})};return g()},c}();function f(c,E){var v={method:"GET",mode:"cors",credentials:"same-origin",signal:E,headers:new self.Headers(T({},c.headers))};return c.rangeEnd&&v.headers.set("Range","bytes="+c.rangeStart+"-"+String(c.rangeEnd-1)),v}function l(c,E){return new self.Request(c.url,E)}var i=function(c){H(E,c);function E(v,p,u){var y;return y=c.call(this,v)||this,y.code=void 0,y.details=void 0,y.code=p,y.details=u,y}return E}(N(Error));$.default=S},"./src/utils/imsc1-ttml-parser.ts":function(fe,$,P){"use strict";P.r($),P.d($,"IMSC1_CODEC",function(){return _}),P.d($,"parseIMSC1",function(){return C});var Y=P("./src/utils/mp4-tools.ts"),U=P("./src/utils/vttparser.ts"),O=P("./src/utils/vttcue.ts"),H=P("./src/demux/id3.ts"),N=P("./src/utils/timescale-conversion.ts"),k=P("./src/utils/webvtt-parser.ts");function L(){return L=Object.assign||function(d){for(var h=1;h<arguments.length;h++){var s=arguments[h];for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(d[a]=s[a])}return d},L.apply(this,arguments)}var _="stpp.ttml.im1t",w=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,D=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,T={left:"start",center:"center",right:"end",start:"start",end:"end"};function C(d,h,s,a,g){var m=Object(Y.findBox)(new Uint8Array(d),["mdat"]);if(m.length===0){g(new Error("Could not parse IMSC1 mdat"));return}var b=m[0],M=Object(H.utf8ArrayToStr)(new Uint8Array(d,b.start,b.end-b.start)),K=Object(N.toTimescaleFromScale)(h,1,s);try{a(S(M,K))}catch(z){g(z)}}function S(d,h){var s=new DOMParser,a=s.parseFromString(d,"text/xml"),g=a.getElementsByTagName("tt")[0];if(!g)throw new Error("Invalid ttml");var m={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},b=Object.keys(m).reduce(function(G,F){return G[F]=g.getAttribute("ttp:"+F)||m[F],G},{}),M=g.getAttribute("xml:space")!=="preserve",K=l(f(g,"styling","style")),z=l(f(g,"layout","region")),ee=f(g,"body","[begin]");return[].map.call(ee,function(G){var F=i(G,M);if(!F||!G.hasAttribute("begin"))return null;var ie=p(G.getAttribute("begin"),b),ge=p(G.getAttribute("dur"),b),ye=p(G.getAttribute("end"),b);if(ie===null)throw v(G);if(ye===null){if(ge===null)throw v(G);ye=ie+ge}var xe=new O.default(ie-h,ye-h,F);xe.id=Object(k.generateCueId)(xe.startTime,xe.endTime,xe.text);var Te=z[G.getAttribute("region")],Se=K[G.getAttribute("style")];xe.position=10,xe.size=80;var me=c(Te,Se),pe=me.textAlign;if(pe){var Ee=T[pe];Ee&&(xe.lineAlign=Ee),xe.align=pe}return L(xe,me),xe}).filter(function(G){return G!==null})}function f(d,h,s){var a=d.getElementsByTagName(h)[0];return a?[].slice.call(a.querySelectorAll(s)):[]}function l(d){return d.reduce(function(h,s){var a=s.getAttribute("xml:id");return a&&(h[a]=s),h},{})}function i(d,h){return[].slice.call(d.childNodes).reduce(function(s,a,g){var m;return a.nodeName==="br"&&g?s+`
`:(m=a.childNodes)!==null&&m!==void 0&&m.length?i(a,h):h?s+a.textContent.trim().replace(/\s+/g," "):s+a.textContent},"")}function c(d,h){var s="http://www.w3.org/ns/ttml#styling",a=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return a.reduce(function(g,m){var b=E(h,s,m)||E(d,s,m);return b&&(g[m]=b),g},{})}function E(d,h,s){return d.hasAttributeNS(h,s)?d.getAttributeNS(h,s):null}function v(d){return new Error("Could not parse ttml timestamp "+d)}function p(d,h){if(!d)return null;var s=Object(U.parseTimeStamp)(d);return s===null&&(w.test(d)?s=u(d,h):D.test(d)&&(s=y(d,h))),s}function u(d,h){var s=w.exec(d),a=(s[4]|0)+(s[5]|0)/h.subFrameRate;return(s[1]|0)*3600+(s[2]|0)*60+(s[3]|0)+a/h.frameRate}function y(d,h){var s=D.exec(d),a=Number(s[1]),g=s[2];switch(g){case"h":return a*3600;case"m":return a*60;case"ms":return a*1e3;case"f":return a/h.frameRate;case"t":return a/h.tickRate}return a}},"./src/utils/logger.ts":function(fe,$,P){"use strict";P.r($),P.d($,"enableLogs",function(){return k}),P.d($,"logger",function(){return L});var Y=function(){},U={trace:Y,debug:Y,log:Y,warn:Y,info:Y,error:Y},O=U;function H(_){var w=self.console[_];return w?w.bind(self.console,"["+_+"] >"):Y}function N(_){for(var w=arguments.length,D=new Array(w>1?w-1:0),T=1;T<w;T++)D[T-1]=arguments[T];D.forEach(function(C){O[C]=_[C]?_[C].bind(_):H(C)})}function k(_){if(self.console&&_===!0||typeof _=="object"){N(_,"debug","log","info","warn","error");try{O.log()}catch(w){O=U}}else O=U}var L=O},"./src/utils/mediakeys-helper.ts":function(fe,$,P){"use strict";P.r($),P.d($,"KeySystems",function(){return Y}),P.d($,"requestMediaKeySystemAccess",function(){return U});var Y;(function(O){O.WIDEVINE="com.widevine.alpha",O.PLAYREADY="com.microsoft.playready"})(Y||(Y={}));var U=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(fe,$,P){"use strict";P.r($),P.d($,"getMediaSource",function(){return Y});function Y(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(fe,$,P){"use strict";P.r($),P.d($,"bin2str",function(){return N}),P.d($,"readUint16",function(){return k}),P.d($,"readUint32",function(){return L}),P.d($,"writeUint32",function(){return _}),P.d($,"findBox",function(){return w}),P.d($,"parseSegmentIndex",function(){return D}),P.d($,"parseInitSegment",function(){return T}),P.d($,"getStartDTS",function(){return C}),P.d($,"getDuration",function(){return S}),P.d($,"computeRawDurationFromSamples",function(){return f}),P.d($,"offsetStartDTS",function(){return l}),P.d($,"segmentValidRange",function(){return i}),P.d($,"appendUint8Array",function(){return c});var Y=P("./src/utils/typed-array.ts"),U=P("./src/loader/fragment.ts"),O=Math.pow(2,32)-1,H=[].push;function N(E){return String.fromCharCode.apply(null,E)}function k(E,v){"data"in E&&(v+=E.start,E=E.data);var p=E[v]<<8|E[v+1];return p<0?65536+p:p}function L(E,v){"data"in E&&(v+=E.start,E=E.data);var p=E[v]<<24|E[v+1]<<16|E[v+2]<<8|E[v+3];return p<0?4294967296+p:p}function _(E,v,p){"data"in E&&(v+=E.start,E=E.data),E[v]=p>>24,E[v+1]=p>>16&255,E[v+2]=p>>8&255,E[v+3]=p&255}function w(E,v){var p=[];if(!v.length)return p;var u,y,d;"data"in E?(u=E.data,y=E.start,d=E.end):(u=E,y=0,d=u.byteLength);for(var h=y;h<d;){var s=L(u,h),a=N(u.subarray(h+4,h+8)),g=s>1?h+s:d;if(a===v[0])if(v.length===1)p.push({data:u,start:h+8,end:g});else{var m=w({data:u,start:h+8,end:g},v.slice(1));m.length&&H.apply(p,m)}h=g}return p}function D(E){var v=w(E,["moov"]),p=v[0],u=p?p.end:null,y=w(E,["sidx"]);if(!y||!y[0])return null;var d=[],h=y[0],s=h.data[0],a=s===0?8:16,g=L(h,a);a+=4;var m=0,b=0;s===0?a+=8:a+=16,a+=2;var M=h.end+b,K=k(h,a);a+=2;for(var z=0;z<K;z++){var ee=a,G=L(h,ee);ee+=4;var F=G&2147483647,ie=(G&2147483648)>>>31;if(ie===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var ge=L(h,ee);ee+=4,d.push({referenceSize:F,subsegmentDuration:ge,info:{duration:ge/g,start:M,end:M+F-1}}),M+=F,ee+=4,a=ee}return{earliestPresentationTime:m,timescale:g,version:s,referencesCount:K,references:d,moovEndOffset:u}}function T(E){for(var v=[],p=w(E,["moov","trak"]),u=0;u<p.length;u++){var y=p[u],d=w(y,["tkhd"])[0];if(d){var h=d.data[d.start],s=h===0?12:20,a=L(d,s),g=w(y,["mdia","mdhd"])[0];if(g){h=g.data[g.start],s=h===0?12:20;var m=L(g,s),b=w(y,["mdia","hdlr"])[0];if(b){var M=N(b.data.subarray(b.start+8,b.start+12)),K={soun:U.ElementaryStreamTypes.AUDIO,vide:U.ElementaryStreamTypes.VIDEO}[M];if(K){var z=w(y,["mdia","minf","stbl","stsd"])[0],ee=void 0;z&&(ee=N(z.data.subarray(z.start+12,z.start+16))),v[a]={timescale:m,type:K},v[K]={timescale:m,id:a,codec:ee}}}}}}var G=w(E,["moov","mvex","trex"]);return G.forEach(function(F){var ie=L(F,4),ge=v[ie];ge&&(ge.default={duration:L(F,12),flags:L(F,20)})}),v}function C(E,v){return w(v,["moof","traf"]).reduce(function(p,u){var y=w(u,["tfdt"])[0],d=y.data[y.start],h=w(u,["tfhd"]).reduce(function(s,a){var g=L(a,4),m=E[g];if(m){var b=L(y,4);d===1&&(b*=Math.pow(2,32),b+=L(y,8));var M=m.timescale||9e4,K=b/M;if(isFinite(K)&&(s===null||K<s))return K}return s},null);return h!==null&&isFinite(h)&&(p===null||h<p)?h:p},null)||0}function S(E,v){for(var p=0,u=0,y=0,d=w(E,["moof","traf"]),h=0;h<d.length;h++){var s=d[h],a=w(s,["tfhd"])[0],g=L(a,4),m=v[g];if(!m)continue;var b=m.default,M=L(a,0)|(b==null?void 0:b.flags),K=b==null?void 0:b.duration;M&8&&(M&2?K=L(a,12):K=L(a,8));for(var z=m.timescale||9e4,ee=w(s,["trun"]),G=0;G<ee.length;G++){if(K){var F=L(ee[G],4);p=K*F}else p=f(ee[G]);m.type===U.ElementaryStreamTypes.VIDEO?u+=p/z:m.type===U.ElementaryStreamTypes.AUDIO&&(y+=p/z)}}if(u===0&&y===0){var ie=D(E);if(ie!=null&&ie.references)return ie.references.reduce(function(ge,ye){return ge+ye.info.duration||0},0)}return u||y}function f(E){var v=L(E,0),p=8;v&1&&(p+=4),v&4&&(p+=4);for(var u=0,y=L(E,4),d=0;d<y;d++){if(v&256){var h=L(E,p);u+=h,p+=4}v&512&&(p+=4),v&1024&&(p+=4),v&2048&&(p+=4)}return u}function l(E,v,p){w(v,["moof","traf"]).forEach(function(u){w(u,["tfhd"]).forEach(function(y){var d=L(y,4),h=E[d];if(!h)return;var s=h.timescale||9e4;w(u,["tfdt"]).forEach(function(a){var g=a.data[a.start],m=L(a,4);if(g===0)_(a,4,m-p*s);else{m*=Math.pow(2,32),m+=L(a,8),m-=p*s,m=Math.max(m,0);var b=Math.floor(m/(O+1)),M=Math.floor(m%(O+1));_(a,4,b),_(a,8,M)}})})})}function i(E){var v={valid:null,remainder:null},p=w(E,["moof"]);if(p){if(p.length<2)return v.remainder=E,v}else return v;var u=p[p.length-1];return v.valid=Object(Y.sliceUint8)(E,0,u.start-8),v.remainder=Object(Y.sliceUint8)(E,u.start-8),v}function c(E,v){var p=new Uint8Array(E.length+v.length);return p.set(E),p.set(v,E.length),p}},"./src/utils/output-filter.ts":function(fe,$,P){"use strict";P.r($),P.d($,"default",function(){return Y});var Y=function(){function U(H,N){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=H,this.trackName=N}var O=U.prototype;return O.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},O.newCue=function(N,k,L){(this.startTime===null||this.startTime>N)&&(this.startTime=N),this.endTime=k,this.screen=L,this.timelineController.createCaptionsTrack(this.trackName)},O.reset=function(){this.cueRanges=[]},U}()},"./src/utils/texttrack-utils.ts":function(fe,$,P){"use strict";P.r($),P.d($,"sendAddTrackEvent",function(){return U}),P.d($,"addCueToTrack",function(){return O}),P.d($,"clearCurrentCues",function(){return H}),P.d($,"removeCuesInRange",function(){return N}),P.d($,"getCuesInRange",function(){return L});var Y=P("./src/utils/logger.ts");function U(_,w){var D;try{D=new Event("addtrack")}catch(T){D=document.createEvent("Event"),D.initEvent("addtrack",!1,!1)}D.track=_,w.dispatchEvent(D)}function O(_,w){var D=_.mode;if(D==="disabled"&&(_.mode="hidden"),_.cues&&!_.cues.getCueById(w.id))try{if(_.addCue(w),!_.cues.getCueById(w.id))throw new Error("addCue is failed for: "+w)}catch(C){Y.logger.debug("[texttrack-utils]: "+C);var T=new self.TextTrackCue(w.startTime,w.endTime,w.text);T.id=w.id,_.addCue(T)}D==="disabled"&&(_.mode=D)}function H(_){var w=_.mode;if(w==="disabled"&&(_.mode="hidden"),_.cues)for(var D=_.cues.length;D--;)_.removeCue(_.cues[D]);w==="disabled"&&(_.mode=w)}function N(_,w,D){var T=_.mode;if(T==="disabled"&&(_.mode="hidden"),_.cues&&_.cues.length>0)for(var C=L(_.cues,w,D),S=0;S<C.length;S++)_.removeCue(C[S]);T==="disabled"&&(_.mode=T)}function k(_,w){if(w<_[0].startTime)return 0;var D=_.length-1;if(w>_[D].endTime)return-1;for(var T=0,C=D;T<=C;){var S=Math.floor((C+T)/2);if(w<_[S].startTime)C=S-1;else if(w>_[S].startTime&&T<D)T=S+1;else return S}return _[T].startTime-w<w-_[C].startTime?T:C}function L(_,w,D){var T=[],C=k(_,w);if(C>-1)for(var S=C,f=_.length;S<f;S++){var l=_[S];if(l.startTime>=w&&l.endTime<=D)T.push(l);else if(l.startTime>D)return T}return T}},"./src/utils/time-ranges.ts":function(fe,$,P){"use strict";P.r($);var Y={toString:function(O){for(var H="",N=O.length,k=0;k<N;k++)H+="["+O.start(k).toFixed(3)+","+O.end(k).toFixed(3)+"]";return H}};$.default=Y},"./src/utils/timescale-conversion.ts":function(fe,$,P){"use strict";P.r($),P.d($,"toTimescaleFromBase",function(){return U}),P.d($,"toTimescaleFromScale",function(){return O}),P.d($,"toMsFromMpegTsClock",function(){return H}),P.d($,"toMpegTsClockFromTimescale",function(){return N});var Y=9e4;function U(k,L,_,w){_===void 0&&(_=1),w===void 0&&(w=!1);var D=k*L*_;return w?Math.round(D):D}function O(k,L,_,w){return _===void 0&&(_=1),w===void 0&&(w=!1),U(k,L,1/_,w)}function H(k,L){return L===void 0&&(L=!1),U(k,1e3,1/Y,L)}function N(k,L){return L===void 0&&(L=1),U(k,Y,1/L)}},"./src/utils/typed-array.ts":function(fe,$,P){"use strict";P.r($),P.d($,"sliceUint8",function(){return Y});function Y(U,O,H){return Uint8Array.prototype.slice?U.slice(O,H):new Uint8Array(Array.prototype.slice.call(U,O,H))}},"./src/utils/vttcue.ts":function(fe,$,P){"use strict";P.r($),$.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var Y=["","lr","rl"],U=["start","middle","end","left","right"];function O(_,w){if(typeof w!="string")return!1;if(!Array.isArray(_))return!1;var D=w.toLowerCase();return~_.indexOf(D)?D:!1}function H(_){return O(Y,_)}function N(_){return O(U,_)}function k(_){for(var w=arguments.length,D=new Array(w>1?w-1:0),T=1;T<w;T++)D[T-1]=arguments[T];for(var C=1;C<arguments.length;C++){var S=arguments[C];for(var f in S)_[f]=S[f]}return _}function L(_,w,D){var T=this,C={enumerable:!0};T.hasBeenReset=!1;var S="",f=!1,l=_,i=w,c=D,E=null,v="",p=!0,u="auto",y="start",d=50,h="middle",s=50,a="middle";Object.defineProperty(T,"id",k({},C,{get:function(){return S},set:function(m){S=""+m}})),Object.defineProperty(T,"pauseOnExit",k({},C,{get:function(){return f},set:function(m){f=!!m}})),Object.defineProperty(T,"startTime",k({},C,{get:function(){return l},set:function(m){if(typeof m!="number")throw new TypeError("Start time must be set to a number.");l=m,this.hasBeenReset=!0}})),Object.defineProperty(T,"endTime",k({},C,{get:function(){return i},set:function(m){if(typeof m!="number")throw new TypeError("End time must be set to a number.");i=m,this.hasBeenReset=!0}})),Object.defineProperty(T,"text",k({},C,{get:function(){return c},set:function(m){c=""+m,this.hasBeenReset=!0}})),Object.defineProperty(T,"region",k({},C,{get:function(){return E},set:function(m){E=m,this.hasBeenReset=!0}})),Object.defineProperty(T,"vertical",k({},C,{get:function(){return v},set:function(m){var b=H(m);if(b===!1)throw new SyntaxError("An invalid or illegal string was specified.");v=b,this.hasBeenReset=!0}})),Object.defineProperty(T,"snapToLines",k({},C,{get:function(){return p},set:function(m){p=!!m,this.hasBeenReset=!0}})),Object.defineProperty(T,"line",k({},C,{get:function(){return u},set:function(m){if(typeof m!="number"&&m!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");u=m,this.hasBeenReset=!0}})),Object.defineProperty(T,"lineAlign",k({},C,{get:function(){return y},set:function(m){var b=N(m);if(!b)throw new SyntaxError("An invalid or illegal string was specified.");y=b,this.hasBeenReset=!0}})),Object.defineProperty(T,"position",k({},C,{get:function(){return d},set:function(m){if(m<0||m>100)throw new Error("Position must be between 0 and 100.");d=m,this.hasBeenReset=!0}})),Object.defineProperty(T,"positionAlign",k({},C,{get:function(){return h},set:function(m){var b=N(m);if(!b)throw new SyntaxError("An invalid or illegal string was specified.");h=b,this.hasBeenReset=!0}})),Object.defineProperty(T,"size",k({},C,{get:function(){return s},set:function(m){if(m<0||m>100)throw new Error("Size must be between 0 and 100.");s=m,this.hasBeenReset=!0}})),Object.defineProperty(T,"align",k({},C,{get:function(){return a},set:function(m){var b=N(m);if(!b)throw new SyntaxError("An invalid or illegal string was specified.");a=b,this.hasBeenReset=!0}})),T.displayState=void 0}return L.prototype.getCueAsHTML=function(){var _=self.WebVTT;return _.convertCueToDOMTree(self,this.text)},L}()},"./src/utils/vttparser.ts":function(fe,$,P){"use strict";P.r($),P.d($,"parseTimeStamp",function(){return O}),P.d($,"fixLineBreaks",function(){return w}),P.d($,"VTTParser",function(){return D});var Y=P("./src/utils/vttcue.ts"),U=function(){function T(){}var C=T.prototype;return C.decode=function(f,l){if(!f)return"";if(typeof f!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(f))},T}();function O(T){function C(f,l,i,c){return(f|0)*3600+(l|0)*60+(i|0)+parseFloat(c||0)}var S=T.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return S?parseFloat(S[2])>59?C(S[2],S[3],0,S[4]):C(S[1],S[2],S[3],S[4]):null}var H=function(){function T(){this.values=Object.create(null)}var C=T.prototype;return C.set=function(f,l){!this.get(f)&&l!==""&&(this.values[f]=l)},C.get=function(f,l,i){return i?this.has(f)?this.values[f]:l[i]:this.has(f)?this.values[f]:l},C.has=function(f){return f in this.values},C.alt=function(f,l,i){for(var c=0;c<i.length;++c)if(l===i[c]){this.set(f,l);break}},C.integer=function(f,l){/^-?\d+$/.test(l)&&this.set(f,parseInt(l,10))},C.percent=function(f,l){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(l)){var i=parseFloat(l);if(i>=0&&i<=100)return this.set(f,i),!0}return!1},T}();function N(T,C,S,f){var l=f?T.split(f):[T];for(var i in l){if(typeof l[i]!="string")continue;var c=l[i].split(S);if(c.length!==2)continue;var E=c[0],v=c[1];C(E,v)}}var k=new Y.default(0,0,""),L=k.align==="middle"?"middle":"center";function _(T,C,S){var f=T;function l(){var E=O(T);if(E===null)throw new Error("Malformed timestamp: "+f);return T=T.replace(/^[^\sa-zA-Z-]+/,""),E}function i(E,v){var p=new H;N(E,function(d,h){var s;switch(d){case"region":for(var a=S.length-1;a>=0;a--)if(S[a].id===h){p.set(d,S[a].region);break}break;case"vertical":p.alt(d,h,["rl","lr"]);break;case"line":s=h.split(","),p.integer(d,s[0]),p.percent(d,s[0])&&p.set("snapToLines",!1),p.alt(d,s[0],["auto"]),s.length===2&&p.alt("lineAlign",s[1],["start",L,"end"]);break;case"position":s=h.split(","),p.percent(d,s[0]),s.length===2&&p.alt("positionAlign",s[1],["start",L,"end","line-left","line-right","auto"]);break;case"size":p.percent(d,h);break;case"align":p.alt(d,h,["start",L,"end","left","right"]);break}},/:/,/\s/),v.region=p.get("region",null),v.vertical=p.get("vertical","");var u=p.get("line","auto");u==="auto"&&k.line===-1&&(u=-1),v.line=u,v.lineAlign=p.get("lineAlign","start"),v.snapToLines=p.get("snapToLines",!0),v.size=p.get("size",100),v.align=p.get("align",L);var y=p.get("position","auto");y==="auto"&&k.position===50&&(y=v.align==="start"||v.align==="left"?0:v.align==="end"||v.align==="right"?100:50),v.position=y}function c(){T=T.replace(/^\s+/,"")}if(c(),C.startTime=l(),c(),T.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+f);T=T.substr(3),c(),C.endTime=l(),c(),i(T,C)}function w(T){return T.replace(/<br(?: \/)?>/gi,`
`)}var D=function(){function T(){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 C=T.prototype;return C.parse=function(f){var l=this;f&&(l.buffer+=l.decoder.decode(f,{stream:!0}));function i(){var y=l.buffer,d=0;for(y=w(y);d<y.length&&y[d]!=="\r"&&y[d]!==`
`;)++d;var h=y.substr(0,d);return y[d]==="\r"&&++d,y[d]===`
`&&++d,l.buffer=y.substr(d),h}function c(y){N(y,function(d,h){},/:/)}try{var E="";if(l.state==="INITIAL"){if(!/\r\n|\n/.test(l.buffer))return this;E=i();var v=E.match(/^()?WEBVTT([ \t].*)?$/);if(!v||!v[0])throw new Error("Malformed WebVTT signature.");l.state="HEADER"}for(var p=!1;l.buffer;){if(!/\r\n|\n/.test(l.buffer))return this;p?p=!1:E=i();switch(l.state){case"HEADER":/:/.test(E)?c(E):E||(l.state="ID");continue;case"NOTE":E||(l.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(E)){l.state="NOTE";break}if(!E)continue;if(l.cue=new Y.default(0,0,""),l.state="CUE",E.indexOf("-->")===-1){l.cue.id=E;continue}case"CUE":if(!l.cue){l.state="BADCUE";continue}try{_(E,l.cue,l.regionList)}catch(y){l.cue=null,l.state="BADCUE";continue}l.state="CUETEXT";continue;case"CUETEXT":{var u=E.indexOf("-->")!==-1;if(!E||u&&(p=!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+=E}continue;case"BADCUE":E||(l.state="ID")}}}catch(y){l.state==="CUETEXT"&&l.cue&&l.oncue&&l.oncue(l.cue),l.cue=null,l.state=l.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},C.flush=function(){var f=this;try{if((f.cue||f.state==="HEADER")&&(f.buffer+=`
`,f.parse()),f.state==="INITIAL"||f.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(l){f.onparsingerror&&f.onparsingerror(l)}return f.onflush&&f.onflush(),this},T}()},"./src/utils/webvtt-parser.ts":function(fe,$,P){"use strict";P.r($),P.d($,"generateCueId",function(){return D}),P.d($,"parseWebVTT",function(){return C});var Y=P("./src/polyfills/number.ts"),U=P("./src/utils/vttparser.ts"),O=P("./src/demux/id3.ts"),H=P("./src/utils/timescale-conversion.ts"),N=P("./src/remux/mp4-remuxer.ts"),k=/\r\n|\n\r|\n|\r/g,L=function(f,l,i){return i===void 0&&(i=0),f.substr(i,l.length)===l},_=function(f){var l=parseInt(f.substr(-3)),i=parseInt(f.substr(-6,2)),c=parseInt(f.substr(-9,2)),E=f.length>9?parseInt(f.substr(0,f.indexOf(":"))):0;if(!Object(Y.isFiniteNumber)(l)||!Object(Y.isFiniteNumber)(i)||!Object(Y.isFiniteNumber)(c)||!Object(Y.isFiniteNumber)(E))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+f);return l+=1e3*i,l+=60*1e3*c,l+=60*60*1e3*E,l},w=function(f){for(var l=5381,i=f.length;i;)l=l*33^f.charCodeAt(--i);return(l>>>0).toString()};function D(S,f,l){return w(S.toString())+w(f.toString())+w(l)}var T=function(f,l,i){var c=f[l],E=f[c.prevCC];if(!E||!E.new&&c.new){f.ccOffset=f.presentationOffset=c.start,c.new=!1;return}for(;(v=E)!==null&&v!==void 0&&v.new;){var v;f.ccOffset+=c.start-E.start,c.new=!1,c=E,E=f[c.prevCC]}f.presentationOffset=i};function C(S,f,l,i,c,E,v,p){var u=new U.VTTParser,y=Object(O.utf8ArrayToStr)(new Uint8Array(S)).trim().replace(k,`
`).split(`
`),d=[],h=Object(H.toMpegTsClockFromTimescale)(f,l),s="00:00.000",a=0,g=0,m,b=!0,M=!1;u.oncue=function(K){var z=i[c],ee=i.ccOffset,G=(a-h)/9e4;if(z!=null&&z.new&&(g!==void 0?ee=i.ccOffset=z.start:T(i,c,G)),G&&(ee=G-i.presentationOffset),M){var F=K.endTime-K.startTime,ie=Object(N.normalizePts)((K.startTime+ee-g)*9e4,E*9e4)/9e4;K.startTime=ie,K.endTime=ie+F}var ge=K.text.trim();K.text=decodeURIComponent(encodeURIComponent(ge)),K.id||(K.id=D(K.startTime,K.endTime,ge)),K.endTime>0&&d.push(K)},u.onparsingerror=function(K){m=K},u.onflush=function(){if(m){p(m);return}v(d)},y.forEach(function(K){if(b)if(L(K,"X-TIMESTAMP-MAP=")){b=!1,M=!0,K.substr(16).split(",").forEach(function(z){L(z,"LOCAL:")?s=z.substr(6):L(z,"MPEGTS:")&&(a=parseInt(z.substr(7)))});try{g=_(s)/1e3}catch(z){M=!1,m=z}return}else K===""&&(b=!1);u.parse(K+`
`)}),u.flush()}},"./src/utils/xhr-loader.ts":function(fe,$,P){"use strict";P.r($);var Y=P("./src/utils/logger.ts"),U=P("./src/loader/load-stats.ts"),O=/^age:\s*[\d.]+\s*$/m,H=function(){function N(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 k=N.prototype;return k.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},k.abortInternal=function(){var _=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),_&&(_.onreadystatechange=null,_.onprogress=null,_.readyState!==4&&(this.stats.aborted=!0,_.abort()))},k.abort=function(){var _;this.abortInternal(),(_=this.callbacks)!==null&&_!==void 0&&_.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},k.load=function(_,w,D){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=_,this.config=w,this.callbacks=D,this.retryDelay=w.retryDelay,this.loadInternal()},k.loadInternal=function(){var _=this.config,w=this.context;if(!_)return;var D=this.loader=new self.XMLHttpRequest,T=this.stats;T.loading.first=0,T.loaded=0;var C=this.xhrSetup;try{if(C)try{C(D,w.url)}catch(l){D.open("GET",w.url,!0),C(D,w.url)}D.readyState||D.open("GET",w.url,!0);var S=this.context.headers;if(S)for(var f in S)D.setRequestHeader(f,S[f])}catch(l){this.callbacks.onError({code:D.status,text:l.message},w,D);return}w.rangeEnd&&D.setRequestHeader("Range","bytes="+w.rangeStart+"-"+(w.rangeEnd-1)),D.onreadystatechange=this.readystatechange.bind(this),D.onprogress=this.loadprogress.bind(this),D.responseType=w.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),_.timeout),D.send()},k.readystatechange=function(){var _=this.context,w=this.loader,D=this.stats;if(!_||!w)return;var T=w.readyState,C=this.config;if(D.aborted)return;if(T>=2)if(self.clearTimeout(this.requestTimeout),D.loading.first===0&&(D.loading.first=Math.max(self.performance.now(),D.loading.start)),T===4){w.onreadystatechange=null,w.onprogress=null;var S=w.status;if(S>=200&&S<300){D.loading.end=Math.max(self.performance.now(),D.loading.first);var f,l;if(_.responseType==="arraybuffer"?(f=w.response,l=f.byteLength):(f=w.responseText,l=f.length),D.loaded=D.total=l,!this.callbacks)return;var i=this.callbacks.onProgress;if(i&&i(D,_,f,w),!this.callbacks)return;var c={url:w.responseURL,data:f};this.callbacks.onSuccess(c,D,_,w)}else D.retry>=C.maxRetry||S>=400&&S<499?(Y.logger.error(S+" while loading "+_.url),this.callbacks.onError({code:S,text:w.statusText},_,w)):(Y.logger.warn(S+" while loading "+_.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,C.maxRetryDelay),D.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),C.timeout)},k.loadtimeout=function(){Y.logger.warn("timeout while loading "+this.context.url);var _=this.callbacks;_&&(this.abortInternal(),_.onTimeout(this.stats,this.context,this.loader))},k.loadprogress=function(_){var w=this.stats;w.loaded=_.loaded,_.lengthComputable&&(w.total=_.total)},k.getCacheAge=function(){var _=null;if(this.loader&&O.test(this.loader.getAllResponseHeaders())){var w=this.loader.getResponseHeader("age");_=w?parseFloat(w):null}return _},N}();$.default=H}}).default})},vHTk:function(qe,Ke,V){qe.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}}}]);