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__Three.cebb0270.async.js

436 lines
1.1 MiB

(window.webpackJsonp=window.webpackJsonp||[]).push([[254,5,6,7],{"+NIl":function(_t,ot,le){(function(ue){ue(le("VrN/"))})(function(ue){"use strict";ue.defineMode("stex",function(Z,M){"use strict";function Q(h,s){h.cmdState.push(s)}function B(h){return h.cmdState.length>0?h.cmdState[h.cmdState.length-1]:null}function N(h){var s=h.cmdState.pop();s&&s.closeBracket()}function K(h){for(var s=h.cmdState,u=s.length-1;u>=0;u--){var l=s[u];if(l.name=="DEFAULT")continue;return l}return{styleIdentifier:function(){return null}}}function W(h,s,u){return function(){this.name=h,this.bracketNo=0,this.style=s,this.styles=u,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var P={};P.importmodule=W("importmodule","tag",["string","builtin"]),P.documentclass=W("documentclass","tag",["","atom"]),P.usepackage=W("usepackage","tag",["atom"]),P.begin=W("begin","tag",["atom"]),P.end=W("end","tag",["atom"]),P.label=W("label","tag",["atom"]),P.ref=W("ref","tag",["atom"]),P.eqref=W("eqref","tag",["atom"]),P.cite=W("cite","tag",["atom"]),P.bibitem=W("bibitem","tag",["atom"]),P.Bibitem=W("Bibitem","tag",["atom"]),P.RBibitem=W("RBibitem","tag",["atom"]),P.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function R(h,s){h.f=s}function m(h,s){var u;if(h.match(/^\\[a-zA-Z@]+/)){var l=h.current().slice(1);return u=P.hasOwnProperty(l)?P[l]:P.DEFAULT,u=new u,Q(s,u),R(s,f),u.style}if(h.match(/^\\[$&%#{}_]/))return"tag";if(h.match(/^\\[,;!\/\\]/))return"tag";if(h.match("\\["))return R(s,function(o,c){return p(o,c,"\\]")}),"keyword";if(h.match("\\("))return R(s,function(o,c){return p(o,c,"\\)")}),"keyword";if(h.match("$$"))return R(s,function(o,c){return p(o,c,"$$")}),"keyword";if(h.match("$"))return R(s,function(o,c){return p(o,c,"$")}),"keyword";var a=h.next();if(a=="%")return h.skipToEnd(),"comment";if(a=="}"||a=="]"){if(u=B(s),u)u.closeBracket(a),R(s,f);else return"error";return"bracket"}else return a=="{"||a=="["?(u=P.DEFAULT,u=new u,Q(s,u),"bracket"):/\d/.test(a)?(h.eatWhile(/[\w.%]/),"atom"):(h.eatWhile(/[\w\-_]/),u=K(s),u.name=="begin"&&(u.argument=h.current()),u.styleIdentifier())}function p(h,s,u){if(h.eatSpace())return null;if(u&&h.match(u))return R(s,m),"keyword";if(h.match(/^\\[a-zA-Z@]+/))return"tag";if(h.match(/^[a-zA-Z]+/))return"variable-2";if(h.match(/^\\[$&%#{}_]/))return"tag";if(h.match(/^\\[,;!\/]/))return"tag";if(h.match(/^[\^_&]/))return"tag";if(h.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(h.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var l=h.next();return l=="{"||l=="}"||l=="["||l=="]"||l=="("||l==")"?"bracket":l=="%"?(h.skipToEnd(),"comment"):"error"}function f(h,s){var u=h.peek(),l;return u=="{"||u=="["?(l=B(s),l.openBracket(u),h.eat(u),R(s,m),"bracket"):/[ \t\r]/.test(u)?(h.eat(u),null):(R(s,m),N(s),m(h,s))}return{startState:function(){var h=M.inMathMode?function(s,u){return p(s,u)}:m;return{cmdState:[],f:h}},copyState:function(h){return{cmdState:h.cmdState.slice(),f:h.f}},token:function(h,s){return s.f(h,s)},blankLine:function(h){h.f=m,h.cmdState.length=0},lineComment:"%"}}),ue.defineMIME("text/x-stex","stex"),ue.defineMIME("text/x-latex","stex")})},"+ua5":function(_t,ot,le){},"19Vz":function(_t,ot,le){(function(ue){ue(le("VrN/"))})(function(ue){ue.defineOption("placeholder","",function(W,P,R){var m=R&&R!=ue.Init;if(P&&!m)W.on("blur",B),W.on("change",N),W.on("swapDoc",N),ue.on(W.getInputField(),"compositionupdate",W.state.placeholderCompose=function(){Q(W)}),N(W);else if(!P&&m){W.off("blur",B),W.off("change",N),W.off("swapDoc",N),ue.off(W.getInputField(),"compositionupdate",W.state.placeholderCompose),Z(W);var p=W.getWrapperElement();p.className=p.className.replace(" CodeMirror-empty","")}P&&!W.hasFocus()&&B(W)});function Z(W){W.state.placeholder&&(W.state.placeholder.parentNode.removeChild(W.state.placeholder),W.state.placeholder=null)}function M(W){Z(W);var P=W.state.placeholder=document.createElement("pre");P.style.cssText="height: 0; overflow: visible",P.style.direction=W.getOption("direction"),P.className="CodeMirror-placeholder CodeMirror-line-like";var R=W.getOption("placeholder");typeof R=="string"&&(R=document.createTextNode(R)),P.appendChild(R),W.display.lineSpace.insertBefore(P,W.display.lineSpace.firstChild)}function Q(W){setTimeout(function(){var P=!1,R=W.getInputField();R.nodeName=="TEXTAREA"?P=!R.value:W.lineCount()==1&&(P=!/[^\u200b]/.test(R.querySelector(".CodeMirror-line").textContent)),P?M(W):Z(W)},20)}function B(W){K(W)&&M(W)}function N(W){var P=W.getWrapperElement(),R=K(W);P.className=P.className.replace(" CodeMirror-empty","")+(R?" CodeMirror-empty":""),R?M(W):Z(W)}function K(W){return W.lineCount()===1&&W.getLine(0)===""}})},"1eCo":function(_t,ot,le){(function(ue){ue(le("VrN/"))})(function(ue){"use strict";var Z={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},M={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};ue.defineMode("xml",function(Q,B){var N=Q.indentUnit,K={},W=B.htmlMode?Z:M;for(var P in W)K[P]=W[P];for(var P in B)K[P]=B[P];var R,m;function p(d,b){function g(D){return b.tokenize=D,D(d,b)}var _=d.next();if(_=="<")return d.eat("!")?d.eat("[")?d.match("CDATA[")?g(s("atom","]]>")):null:d.match("--")?g(s("comment","-->")):d.match("DOCTYPE",!0,!0)?(d.eatWhile(/[\w\._\-]/),g(u(1))):null:d.eat("?")?(d.eatWhile(/[\w\._\-]/),b.tokenize=s("meta","?>"),"meta"):(R=d.eat("/")?"closeTag":"openTag",b.tokenize=f,"tag bracket");if(_=="&"){var F;return d.eat("#")?d.eat("x")?F=d.eatWhile(/[a-fA-F\d]/)&&d.eat(";"):F=d.eatWhile(/[\d]/)&&d.eat(";"):F=d.eatWhile(/[\w\.\-:]/)&&d.eat(";"),F?"atom":"error"}else return d.eatWhile(/[^&<]/),null}p.isInText=!0;function f(d,b){var g=d.next();if(g==">"||g=="/"&&d.eat(">"))return b.tokenize=p,R=g==">"?"endTag":"selfcloseTag","tag bracket";if(g=="=")return R="equals",null;if(g=="<"){b.tokenize=p,b.state=c,b.tagName=b.tagStart=null;var _=b.tokenize(d,b);return _?_+" tag error":"tag error"}else return/[\'\"]/.test(g)?(b.tokenize=h(g),b.stringStartCol=d.column(),b.tokenize(d,b)):(d.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function h(d){var b=function(g,_){for(;!g.eol();)if(g.next()==d){_.tokenize=f;break}return"string"};return b.isInAttribute=!0,b}function s(d,b){return function(g,_){for(;!g.eol();){if(g.match(b)){_.tokenize=p;break}g.next()}return d}}function u(d){return function(b,g){for(var _;(_=b.next())!=null;){if(_=="<")return g.tokenize=u(d+1),g.tokenize(b,g);if(_==">")if(d==1){g.tokenize=p;break}else return g.tokenize=u(d-1),g.tokenize(b,g)}return"meta"}}function l(d,b,g){this.prev=d.context,this.tagName=b,this.indent=d.indented,this.startOfLine=g,(K.doNotIndent.hasOwnProperty(b)||d.context&&d.context.noIndent)&&(this.noIndent=!0)}function a(d){d.context&&(d.context=d.context.prev)}function o(d,b){for(var g;;){if(!d.context)return;if(g=d.context.tagName,!K.contextGrabbers.hasOwnProperty(g)||!K.contextGrabbers[g].hasOwnProperty(b))return;a(d)}}function c(d,b,g){return d=="openTag"?(g.tagStart=b.column(),L):d=="closeTag"?w:c}function L(d,b,g){return d=="word"?(g.tagName=b.current(),m="tag",A):K.allowMissingTagName&&d=="endTag"?(m="tag bracket",A(d,b,g)):(m="error",L)}function w(d,b,g){if(d=="word"){var _=b.current();return g.context&&g.context.tagName!=_&&K.implicitlyClosed.hasOwnProperty(g.context.tagName)&&a(g),g.context&&g.context.tagName==_||K.matchClosing===!1?(m="tag",T):(m="tag error",O)}else return K.allowMissingTagName&&d=="endTag"?(m="tag bracket",T(d,b,g)):(m="error",O)}function T(d,b,g){return d!="endTag"?(m="error",T):(a(g),c)}function O(d,b,g){return m="error",T(d,b,g)}function A(d,b,g){if(d=="word")return m="attribute",x;if(d=="endTag"||d=="selfcloseTag"){var _=g.tagName,F=g.tagStart;return g.tagName=g.tagStart=null,d=="selfcloseTag"||K.autoSelfClosers.hasOwnProperty(_)?o(g,_):(o(g,_),g.context=new l(g,_,F==g.indented)),c}return m="error",A}function x(d,b,g){return d=="equals"?S:(K.allowMissing||(m="error"),A(d,b,g))}function S(d,b,g){return d=="string"?E:d=="word"&&K.allowUnquoted?(m="string",A):(m="error",A(d,b,g))}function E(d,b,g){return d=="string"?E:A(d,b,g)}return{startState:function(d){var b={tokenize:p,state:c,indented:d||0,tagName:null,tagStart:null,context:null};return d!=null&&(b.baseIndent=d),b},token:function(d,b){if(!b.tagName&&d.sol()&&(b.indented=d.indentation()),d.eatSpace())return null;R=null;var g=b.tokenize(d,b);return(g||R)&&g!="comment"&&(m=null,b.state=b.state(R||g,d,b),m&&(g=m=="error"?g+" error":m)),g},indent:function(d,b,g){var _=d.context;if(d.tokenize.isInAttribute)return d.tagStart==d.indented?d.stringStartCol+1:d.indented+N;if(_&&_.noIndent)return ue.Pass;if(d.tokenize!=f&&d.tokenize!=p)return g?g.match(/^(\s*)/)[0].length:0;if(d.tagName)return K.multilineTagIndentPastTag!==!1?d.tagStart+d.tagName.length+2:d.tagStart+N*(K.multilineTagIndentFactor||1);if(K.alignCDATA&&/<!\[CDATA\[/.test(b))return 0;var F=b&&/^<(\/)?([\w_:\.-]*)/.exec(b);if(F&&F[1])for(;_;)if(_.tagName==F[2]){_=_.prev;break}else if(K.implicitlyClosed.hasOwnProperty(_.tagName))_=_.prev;else break;else if(F)for(;_;){var D=K.contextGrabbers[_.tagName];if(D&&D.hasOwnProperty(F[2]))_=_.prev;else break}for(;_&&_.prev&&!_.startOfLine;)_=_.prev;return _?_.indent+N:d.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:K.htmlMode?"html":"xml",helperType:K.htmlMode?"html":"xml",skipAttribute:function(d){d.state==S&&(d.state=A)},xmlCurrentTag:function(d){return d.tagName?{name:d.tagName,close:d.type=="closeTag"}:null},xmlCurrentContext:function(d){for(var b=[],g=d.context;g;g=g.prev)g.tagName&&b.push(g.tagName);return b.reverse()}}}),ue.defineMIME("text/xml","xml"),ue.defineMIME("application/xml","xml"),ue.mimeModes.hasOwnProperty("text/html")||ue.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"5VLF":function(_t,ot,le){"use strict";var ue,Z;function M(Q,B,N){var K=function(W,P){return Q.js_beautify(W,P)};return K.js=Q.js_beautify,K.css=B.css_beautify,K.html=N.html_beautify,K.js_beautify=Q.js_beautify,K.css_beautify=B.css_beautify,K.html_beautify=N.html_beautify,K}!(ue=[le("6UM0"),le("TXwP"),le("psGv")],Z=function(Q,B,N){return M(Q,B,N)}.apply(ot,ue),Z!==void 0&&(_t.exports=Z))},"6UM0":function(_t,ot,le){var ue,Z;(function(){var M;(function(){"use strict";var B=[function(P,R,m){var p=m(1).Beautifier,f=m(5).Options;function h(s,u){var l=new p(s,u);return l.beautify()}P.exports=h,P.exports.defaultOptions=function(){return new f}},function(P,R,m){var p=m(2).Output,f=m(3).Token,h=m(4),s=m(5).Options,u=m(7).Tokenizer,l=m(7).line_starters,a=m(7).positionable_operators,o=m(7).TOKEN;function c(y,G){return G.indexOf(y)!==-1}function L(y){return y.replace(/^\s+/g,"")}function w(y){for(var G={},Y=0;Y<y.length;Y++)G[y[Y].replace(/-/g,"_")]=y[Y];return G}function T(y,G){return y&&y.type===o.RESERVED&&y.text===G}function O(y,G){return y&&y.type===o.RESERVED&&c(y.text,G)}var A=["case","return","do","if","throw","else","await","break","continue","async"],x=["before-newline","after-newline","preserve-newline"],S=w(x),E=[S.before_newline,S.preserve_newline],d={BlockStatement:"BlockStatement",Statement:"Statement",ObjectLiteral:"ObjectLiteral",ArrayLiteral:"ArrayLiteral",ForInitializer:"ForInitializer",Conditional:"Conditional",Expression:"Expression"};function b(y,G){if(G.multiline_frame||G.mode===d.ForInitializer||G.mode===d.Conditional)return;y.remove_indent(G.start_line_index)}function g(y){y=y.replace(h.allLineBreaks,`
`);for(var G=[],Y=y.indexOf(`
`);Y!==-1;)G.push(y.substring(0,Y)),y=y.substring(Y+1),Y=y.indexOf(`
`);return y.length&&G.push(y),G}function _(y){return y===d.ArrayLiteral}function F(y){return c(y,[d.Expression,d.ForInitializer,d.Conditional])}function D(y,G){for(var Y=0;Y<y.length;Y++){var ie=y[Y].trim();if(ie.charAt(0)!==G)return!1}return!0}function j(y,G){for(var Y=0,ie=y.length,se;Y<ie;Y++)if(se=y[Y],se&&se.indexOf(G)!==0)return!1;return!0}function H(y,G){G=G||{},this._source_text=y||"",this._output=null,this._tokens=null,this._last_last_text=null,this._flags=null,this._previous_flags=null,this._flag_store=null,this._options=new s(G)}H.prototype.create_flags=function(y,G){var Y=0;y&&(Y=y.indentation_level,!this._output.just_added_newline()&&y.line_indent_level>Y&&(Y=y.line_indent_level));var ie={mode:G,parent:y,last_token:y?y.last_token:new f(o.START_BLOCK,""),last_word:y?y.last_word:"",declaration_statement:!1,declaration_assignment:!1,multiline_frame:!1,inline_frame:!1,if_block:!1,else_block:!1,class_start_block:!1,do_block:!1,do_while:!1,import_block:!1,in_case_statement:!1,in_case:!1,case_body:!1,case_block:!1,indentation_level:Y,alignment:0,line_indent_level:y?y.line_indent_level:Y,start_line_index:this._output.get_line_number(),ternary_depth:0};return ie},H.prototype._reset=function(y){var G=y.match(/^[\t ]*/)[0];this._last_last_text="",this._output=new p(this._options,G),this._output.raw=this._options.test_output_raw,this._flag_store=[],this.set_mode(d.BlockStatement);var Y=new u(y,this._options);return this._tokens=Y.tokenize(),y},H.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var y,G=this._reset(this._source_text),Y=this._options.eol;this._options.eol==="auto"&&(Y=`
`,G&&h.lineBreak.test(G||"")&&(Y=G.match(h.lineBreak)[0]));for(var ie=this._tokens.next();ie;)this.handle_token(ie),this._last_last_text=this._flags.last_token.text,this._flags.last_token=ie,ie=this._tokens.next();return y=this._output.get_code(Y),y},H.prototype.handle_token=function(y,G){y.type===o.START_EXPR?this.handle_start_expr(y):y.type===o.END_EXPR?this.handle_end_expr(y):y.type===o.START_BLOCK?this.handle_start_block(y):y.type===o.END_BLOCK?this.handle_end_block(y):y.type===o.WORD?this.handle_word(y):y.type===o.RESERVED?this.handle_word(y):y.type===o.SEMICOLON?this.handle_semicolon(y):y.type===o.STRING?this.handle_string(y):y.type===o.EQUALS?this.handle_equals(y):y.type===o.OPERATOR?this.handle_operator(y):y.type===o.COMMA?this.handle_comma(y):y.type===o.BLOCK_COMMENT?this.handle_block_comment(y,G):y.type===o.COMMENT?this.handle_comment(y,G):y.type===o.DOT?this.handle_dot(y):y.type===o.EOF?this.handle_eof(y):y.type===o.UNKNOWN?this.handle_unknown(y,G):this.handle_unknown(y,G)},H.prototype.handle_whitespace_and_comments=function(y,G){var Y=y.newlines,ie=this._options.keep_array_indentation&&_(this._flags.mode);if(y.comments_before)for(var se=y.comments_before.next();se;)this.handle_whitespace_and_comments(se,G),this.handle_token(se,G),se=y.comments_before.next();if(ie)for(var we=0;we<Y;we+=1)this.print_newline(we>0,G);else if(this._options.max_preserve_newlines&&Y>this._options.max_preserve_newlines&&(Y=this._options.max_preserve_newlines),this._options.preserve_newlines&&Y>1){this.print_newline(!1,G);for(var ve=1;ve<Y;ve+=1)this.print_newline(!0,G)}};var k=["async","break","continue","return","throw","yield"];H.prototype.allow_wrap_or_preserved_newline=function(y,G){if(G=G===void 0?!1:G,this._output.just_added_newline())return;var Y=this._options.preserve_newlines&&y.newlines||G,ie=c(this._flags.last_token.text,a)||c(y.text,a);if(ie){var se=c(this._flags.last_token.text,a)&&c(this._options.operator_position,E)||c(y.text,a);Y=Y&&se}if(Y)this.print_newline(!1,!0);else if(this._options.wrap_line_length){if(O(this._flags.last_token,k))return;this._output.set_wrap_point()}},H.prototype.print_newline=function(y,G){if(!G&&(this._flags.last_token.text!==";"&&this._flags.last_token.text!==","&&this._flags.last_token.text!=="="&&(this._flags.last_token.type!==o.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++")))for(var Y=this._tokens.peek();this._flags.mode===d.Statement&&!(this._flags.if_block&&T(Y,"else"))&&!this._flags.do_block;)this.restore_mode();this._output.add_new_line(y)&&(this._flags.multiline_frame=!0)},H.prototype.print_token_line_indentation=function(y){this._output.just_added_newline()&&(this._options.keep_array_indentation&&y.newlines&&(y.text==="["||_(this._flags.mode))?(this._output.current_line.set_indent(-1),this._output.current_line.push(y.whitespace_before),this._output.space_before_token=!1):this._output.set_indent(this._flags.indentation_level,this._flags.alignment)&&(this._flags.line_indent_level=this._flags.indentation_level))},H.prototype.print_token=function(y){if(this._output.raw){this._output.add_raw_token(y);return}if(this._options.comma_first&&y.previous&&y.previous.type===o.COMMA&&this._output.just_added_newline()&&this._output.previous_line.last()===","){var G=this._output.previous_line.pop();this._output.previous_line.is_empty()&&(this._output.previous_line.push(G),this._output.trim(!0),this._output.current_line.pop(),this._output.trim()),this.print_token_line_indentation(y),this._output.add_token(","),this._output.space_before_token=!0}this.print_token_line_indentation(y),this._output.non_breaking_space=!0,this._output.add_token(y.text),this._output.previous_token_wrapped&&(this._flags.multiline_frame=!0)},H.prototype.indent=function(){this._flags.indentation_level+=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},H.prototype.deindent=function(){this._flags.indentation_level>0&&(!this._flags.parent||this._flags.indentation_level>this._flags.parent.indentation_level)&&(this._flags.indentation_level-=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},H.prototype.set_mode=function(y){this._flags?(this._flag_store.push(this._flags),this._previous_flags=this._flags):this._previous_flags=this.create_flags(null,y),this._flags=this.create_flags(this._previous_flags,y),this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},H.prototype.restore_mode=function(){this._flag_store.length>0&&(this._previous_flags=this._flags,this._flags=this._flag_store.pop(),this._previous_flags.mode===d.Statement&&b(this._output,this._previous_flags),this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},H.prototype.start_of_object_property=function(){return this._flags.parent.mode===d.ObjectLiteral&&this._flags.mode===d.Statement&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||O(this._flags.last_token,["get","set"]))},H.prototype.start_of_statement=function(y){var G=!1;return G=G||O(this._flags.last_token,["var","let","const"])&&y.type===o.WORD,G=G||T(this._flags.last_token,"do"),G=G||!(this._flags.parent.mode===d.ObjectLiteral&&this._flags.mode===d.Statement)&&O(this._flags.last_token,k)&&!y.newlines,G=G||T(this._flags.last_token,"else")&&!(T(y,"if")&&!y.comments_before),G=G||this._flags.last_token.type===o.END_EXPR&&(this._previous_flags.mode===d.ForInitializer||this._previous_flags.mode===d.Conditional),G=G||this._flags.last_token.type===o.WORD&&this._flags.mode===d.BlockStatement&&!this._flags.in_case&&!(y.text==="--"||y.text==="++")&&this._last_last_text!=="function"&&y.type!==o.WORD&&y.type!==o.RESERVED,G=G||this._flags.mode===d.ObjectLiteral&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||O(this._flags.last_token,["get","set"])),G?(this.set_mode(d.Statement),this.indent(),this.handle_whitespace_and_comments(y,!0),this.start_of_object_property()||this.allow_wrap_or_preserved_newline(y,O(y,["do","for","if","while"])),!0):!1},H.prototype.handle_start_expr=function(y){this.start_of_statement(y)||this.handle_whitespace_and_comments(y);var G=d.Expression;if(y.text==="["){if(this._flags.last_token.type===o.WORD||this._flags.last_token.text===")"){O(this._flags.last_token,l)&&(this._output.space_before_token=!0),this.print_token(y),this.set_mode(G),this.indent(),this._options.space_in_paren&&(this._output.space_before_token=!0);return}G=d.ArrayLiteral,_(this._flags.mode)&&((this._flags.last_token.text==="["||this._flags.last_token.text===","&&(this._last_last_text==="]"||this._last_last_text==="}"))&&(this._options.keep_array_indentation||this.print_newline())),c(this._flags.last_token.type,[o.START_EXPR,o.END_EXPR,o.WORD,o.OPERATOR,o.DOT])||(this._output.space_before_token=!0)}else{if(this._flags.last_token.type===o.RESERVED)this._flags.last_token.text==="for"?(this._output.space_before_token=this._options.space_before_conditional,G=d.ForInitializer):c(this._flags.last_token.text,["if","while","switch"])?(this._output.space_before_token=this._options.space_before_conditional,G=d.Conditional):c(this._flags.last_word,["await","async"])?this._output.space_before_token=!0:this._flags.last_token.text==="import"&&y.whitespace_before===""?this._output.space_before_token=!1:(c(this._flags.last_token.text,l)||this._flags.last_token.text==="catch")&&(this._output.space_before_token=!0);else if(this._flags.last_token.type===o.EQUALS||this._flags.last_token.type===o.OPERATOR)this.start_of_object_property()||this.allow_wrap_or_preserved_newline(y);else if(this._flags.last_token.type===o.WORD){this._output.space_before_token=!1;var Y=this._tokens.peek(-3);if(this._options.space_after_named_function&&Y){var ie=this._tokens.peek(-4);O(Y,["async","function"])||Y.text==="*"&&O(ie,["async","function"])?this._output.space_before_token=!0:this._flags.mode===d.ObjectLiteral?(Y.text==="{"||Y.text===","||Y.text==="*"&&(ie.text==="{"||ie.text===","))&&(this._output.space_before_token=!0):this._flags.parent&&this._flags.parent.class_start_block&&(this._output.space_before_token=!0)}}else this.allow_wrap_or_preserved_newline(y);(this._flags.last_token.type===o.RESERVED&&(this._flags.last_word==="function"||this._flags.last_word==="typeof")||this._flags.last_token.text==="*"&&(c(this._last_last_text,["function","yield"])||this._flags.mode===d.ObjectLiteral&&c(this._last_last_text,["{",","])))&&(this._output.space_before_token=this._options.space_after_anon_function)}this._flags.last_token.text===";"||this._flags.last_token.type===o.START_BLOCK?this.print_newline():(this._flags.last_token.type===o.END_EXPR||this._flags.last_token.type===o.START_EXPR||this._flags.last_token.type===o.END_BLOCK||this._flags.last_token.text==="."||this._flags.last_token.type===o.COMMA)&&this.allow_wrap_or_preserved_newline(y,y.newlines),this.print_token(y),this.set_mode(G),this._options.space_in_paren&&(this._output.space_before_token=!0),this.indent()},H.prototype.handle_end_expr=function(y){for(;this._flags.mode===d.Statement;)this.restore_mode();this.handle_whitespace_and_comments(y),this._flags.multiline_frame&&this.allow_wrap_or_preserved_newline(y,y.text==="]"&&_(this._flags.mode)&&!this._options.keep_array_indentation),this._options.space_in_paren&&(this._flags.last_token.type===o.START_EXPR&&!this._options.space_in_empty_paren?(this._output.trim(),this._output.space_before_token=!1):this._output.space_before_token=!0),this.deindent(),this.print_token(y),this.restore_mode(),b(this._output,this._previous_flags),this._flags.do_while&&this._previous_flags.mode===d.Conditional&&(this._previous_flags.mode=d.Expression,this._flags.do_block=!1,this._flags.do_while=!1)},H.prototype.handle_start_block=function(y){this.handle_whitespace_and_comments(y);var G=this._tokens.peek(),Y=this._tokens.peek(1);this._flags.last_word==="switch"&&this._flags.last_token.type===o.END_EXPR?(this.set_mode(d.BlockStatement),this._flags.in_case_statement=!0):this._flags.case_body?this.set_mode(d.BlockStatement):Y&&(c(Y.text,[":",","])&&c(G.type,[o.STRING,o.WORD,o.RESERVED])||c(G.text,["get","set","..."])&&c(Y.type,[o.WORD,o.RESERVED]))?c(this._last_last_text,["class","interface"])&&!c(Y.text,[":",","])?this.set_mode(d.BlockStatement):this.set_mode(d.ObjectLiteral):this._flags.last_token.type===o.OPERATOR&&this._flags.last_token.text==="=>"?this.set_mode(d.BlockStatement):c(this._flags.last_token.type,[o.EQUALS,o.START_EXPR,o.COMMA,o.OPERATOR])||O(this._flags.last_token,["return","throw","import","default"])?this.set_mode(d.ObjectLiteral):this.set_mode(d.BlockStatement),this._flags.last_token&&(O(this._flags.last_token.previous,["class","extends"])&&(this._flags.class_start_block=!0));var ie=!G.comments_before&&G.text==="}",se=ie&&this._flags.last_word==="function"&&this._flags.last_token.type===o.END_EXPR;if(this._options.brace_preserve_inline){var we=0,ve=null;this._flags.inline_frame=!0;do if(we+=1,ve=this._tokens.peek(we-1),ve.newlines){this._flags.inline_frame=!1;break}while(ve.type!==o.EOF&&!(ve.type===o.END_BLOCK&&ve.opened===y))}(this._options.brace_style==="expand"||this._options.brace_style==="none"&&y.newlines)&&!this._flags.inline_frame?this._flags.last_token.type!==o.OPERATOR&&(se||this._flags.last_token.type===o.EQUALS||O(this._flags.last_token,A)&&this._flags.last_token.text!=="else")?this._output.space_before_token=!0:this.print_newline(!1,!0):(_(this._previous_flags.mode)&&(this._flags.last_token.type===o.START_EXPR||this._flags.last_token.type===o.COMMA)&&((this._flags.last_token.type===o.COMMA||this._options.space_in_paren)&&(this._output.space_before_token=!0),(this._flags.last_token.type===o.COMMA||this._flags.last_token.type===o.START_EXPR&&this._flags.inline_frame)&&(this.allow_wrap_or_preserved_newline(y),this._previous_flags.multiline_frame=this._previous_flags.multiline_frame||this._flags.multiline_frame,this._flags.multiline_frame=!1)),this._flags.last_token.type!==o.OPERATOR&&this._flags.last_token.type!==o.START_EXPR&&(this._flags.last_token.type===o.START_BLOCK&&!this._flags.inline_frame?this.print_newline():this._output.space_before_token=!0)),this.print_token(y),this.indent(),!ie&&!(this._options.brace_preserve_inline&&this._flags.inline_frame)&&this.print_newline()},H.prototype.handle_end_block=function(y){for(this.handle_whitespace_and_comments(y);this._flags.mode===d.Statement;)this.restore_mode();var G=this._flags.last_token.type===o.START_BLOCK;this._flags.inline_frame&&!G?this._output.space_before_token=!0:this._options.brace_style==="expand"?G||this.print_newline():G||(_(this._flags.mode)&&this._options.keep_array_indentation?(this._options.keep_array_indentation=!1,this.print_newline(),this._options.keep_array_indentation=!0):this.print_newline()),this.restore_mode(),this.print_token(y)},H.prototype.handle_word=function(y){if(y.type===o.RESERVED){if(c(y.text,["set","get"])&&this._flags.mode!==d.ObjectLiteral)y.type=o.WORD;else if(y.text==="import"&&c(this._tokens.peek().text,["(","."]))y.type=o.WORD;else if(c(y.text,["as","from"])&&!this._flags.import_block)y.type=o.WORD;else if(this._flags.mode===d.ObjectLiteral){var G=this._tokens.peek();G.text===":"&&(y.type=o.WORD)}}if(this.start_of_statement(y)?O(this._flags.last_token,["var","let","const"])&&y.type===o.WORD&&(this._flags.declaration_statement=!0):y.newlines&&!F(this._flags.mode)&&(this._flags.last_token.type!==o.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++")&&this._flags.last_token.type!==o.EQUALS&&(this._options.preserve_newlines||!O(this._flags.last_token,["var","let","const","set","get"]))?(this.handle_whitespace_and_comments(y),this.print_newline()):this.handle_whitespace_and_comments(y),this._flags.do_block&&!this._flags.do_while)if(T(y,"while")){this._output.space_before_token=!0,this.print_token(y),this._output.space_before_token=!0,this._flags.do_while=!0;return}else this.print_newline(),this._flags.do_block=!1;if(this._flags.if_block)if(!this._flags.else_block&&T(y,"else"))this._flags.else_block=!0;else{for(;this._flags.mode===d.Statement;)this.restore_mode();this._flags.if_block=!1,this._flags.else_block=!1}if(this._flags.in_case_statement&&O(y,["case","default"])){this.print_newline(),!this._flags.case_block&&(this._flags.case_body||this._options.jslint_happy)&&this.deindent(),this._flags.case_body=!1,this.print_token(y),this._flags.in_case=!0;return}if((this._flags.last_token.type===o.COMMA||this._flags.last_token.type===o.START_EXPR||this._flags.last_token.type===o.EQUALS||this._flags.last_token.type===o.OPERATOR)&&(this.start_of_object_property()||this.allow_wrap_or_preserved_newline(y)),T(y,"function")){(c(this._flags.last_token.text,["}",";"])||this._output.just_added_newline()&&!(c(this._flags.last_token.text,["(","[","{",":","=",","])||this._flags.last_token.type===o.OPERATOR))&&(!this._output.just_added_blankline()&&!y.comments_before&&(this.print_newline(),this.print_newline(!0))),this._flags.last_token.type===o.RESERVED||this._flags.last_token.type===o.WORD?O(this._flags.last_token,["get","set","new","export"])||O(this._flags.last_token,k)?this._output.space_before_token=!0:T(this._flags.last_token,"default")&&this._last_last_text==="export"?this._output.space_before_token=!0:this._flags.last_token.text==="declare"?this._output.space_before_token=!0:this.print_newline():this._flags.last_token.type===o.OPERATOR||this._flags.last_token.text==="="?this._output.space_before_token=!0:!this._flags.multiline_frame&&(F(this._flags.mode)||_(this._flags.mode))||this.print_newline(),this.print_token(y),this._flags.last_word=y.text;return}var Y="NONE";if(this._flags.last_token.type===o.END_BLOCK?this._previous_flags.inline_frame?Y="SPACE":O(y,["else","catch","finally","from"])?this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&y.newlines?Y="NEWLINE":(Y="SPACE",this._output.space_before_token=!0):Y="NEWLINE":this._flags.last_token.type===o.SEMICOLON&&this._flags.mode===d.BlockStatement?Y="NEWLINE":this._flags.last_token.type===o.SEMICOLON&&F(this._flags.mode)?Y="SPACE":this._flags.last_token.type===o.STRING?Y="NEWLINE":this._flags.last_token.type===o.RESERVED||this._flags.last_token.type===o.WORD||this._flags.last_token.text==="*"&&(c(this._last_last_text,["function","yield"])||this._flags.mode===d.ObjectLiteral&&c(this._last_last_text,["{",","]))?Y="SPACE":this._flags.last_token.type===o.START_BLOCK?this._flags.inline_frame?Y="SPACE":Y="NEWLINE":this._flags.last_token.type===o.END_EXPR&&(this._output.space_before_token=!0,Y="NEWLINE"),O(y,l)&&this._flags.last_token.text!==")"&&(this._flags.inline_frame||this._flags.last_token.text==="else"||this._flags.last_token.text==="export"?Y="SPACE":Y="NEWLINE"),O(y,["else","catch","finally"]))if((!(this._flags.last_token.type===o.END_BLOCK&&this._previous_flags.mode===d.BlockStatement)||this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&y.newlines)&&!this._flags.inline_frame)this.print_newline();else{this._output.trim(!0);var ie=this._output.current_line;ie.last()!=="}"&&this.print_newline(),this._output.space_before_token=!0}else Y==="NEWLINE"?O(this._flags.last_token,A)?this._output.space_before_token=!0:this._flags.last_token.text==="declare"&&O(y,["var","let","const"])?this._output.space_before_token=!0:this._flags.last_token.type!==o.END_EXPR?(this._flags.last_token.type!==o.START_EXPR||!O(y,["var","let","const"]))&&this._flags.last_token.text!==":"&&(T(y,"if")&&T(y.previous,"else")?this._output.space_before_token=!0:this.print_newline()):O(y,l)&&this._flags.last_token.text!==")"&&this.print_newline():this._flags.multiline_frame&&_(this._flags.mode)&&this._flags.last_token.text===","&&this._last_last_text==="}"?this.print_newline():Y==="SPACE"&&(this._output.space_before_token=!0);y.previous&&(y.previous.type===o.WORD||y.previous.type===o.RESERVED)&&(this._output.space_before_token=!0),this.print_token(y),this._flags.last_word=y.text,y.type===o.RESERVED&&(y.text==="do"?this._flags.do_block=!0:y.text==="if"?this._flags.if_block=!0:y.text==="import"?this._flags.import_block=!0:this._flags.import_block&&T(y,"from")&&(this._flags.import_block=!1))},H.prototype.handle_semicolon=function(y){this.start_of_statement(y)?this._output.space_before_token=!1:this.handle_whitespace_and_comments(y);for(var G=this._tokens.peek();this._flags.mode===d.Statement&&!(this._flags.if_block&&T(G,"else"))&&!this._flags.do_block;)this.restore_mode();this._flags.import_block&&(this._flags.import_block=!1),this.print_token(y)},H.prototype.handle_string=function(y){y.text.startsWith("`")&&y.newlines===0&&y.whitespace_before===""&&(y.previous.text===")"||this._flags.last_token.type===o.WORD)||(this.start_of_statement(y)?this._output.space_before_token=!0:(this.handle_whitespace_and_comments(y),this._flags.last_token.type===o.RESERVED||this._flags.last_token.type===o.WORD||this._flags.inline_frame?this._output.space_before_token=!0:this._flags.last_token.type===o.COMMA||this._flags.last_token.type===o.START_EXPR||this._flags.last_token.type===o.EQUALS||this._flags.last_token.type===o.OPERATOR?this.start_of_object_property()||this.allow_wrap_or_preserved_newline(y):y.text.startsWith("`")&&this._flags.last_token.type===o.END_EXPR&&(y.previous.text==="]"||y.previous.text===")")&&y.newlines===0?this._output.space_before_token=!0:this.print_newline())),this.print_token(y)},H.prototype.handle_equals=function(y){this.start_of_statement(y)||this.handle_whitespace_and_comments(y),this._flags.declaration_statement&&(this._flags.declaration_assignment=!0),this._output.space_before_token=!0,this.print_token(y),this._output.space_before_token=!0},H.prototype.handle_comma=function(y){this.handle_whitespace_and_comments(y,!0),this.print_token(y),this._output.space_before_token=!0,this._flags.declaration_statement?(F(this._flags.parent.mode)&&(this._flags.declaration_assignment=!1),this._flags.declaration_assignment?(this._flags.declaration_assignment=!1,this.print_newline(!1,!0)):this._options.comma_first&&this.allow_wrap_or_preserved_newline(y)):this._flags.mode===d.ObjectLiteral||this._flags.mode===d.Statement&&this._flags.parent.mode===d.ObjectLiteral?(this._flags.mode===d.Statement&&this.restore_mode(),this._flags.inline_frame||this.print_newline()):this._options.comma_first&&this.allow_wrap_or_preserved_newline(y)},H.prototype.handle_operator=function(y){var G=y.text==="*"&&(O(this._flags.last_token,["function","yield"])||c(this._flags.last_token.type,[o.START_BLOCK,o.COMMA,o.END_BLOCK,o.SEMICOLON])),Y=c(y.text,["-","+"])&&(c(this._flags.last_token.type,[o.START_BLOCK,o.START_EXPR,o.EQUALS,o.OPERATOR])||c(this._flags.last_token.text,l)||this._flags.last_token.text===",");if(!this.start_of_statement(y)){var ie=!G;this.handle_whitespace_and_comments(y,ie)}if(y.text==="*"&&this._flags.last_token.type===o.DOT){this.print_token(y);return}if(y.text==="::"){this.print_token(y);return}if(this._flags.last_token.type===o.OPERATOR&&c(this._options.operator_position,E)&&this.allow_wrap_or_preserved_newline(y),y.text===":"&&this._flags.in_case){this.print_token(y),this._flags.in_case=!1,this._flags.case_body=!0,this._tokens.peek().type!==o.START_BLOCK?(this.indent(),this.print_newline(),this._flags.case_block=!1):(this._flags.case_block=!0,this._output.space_before_token=!0);return}var se=!0,we=!0,ve=!1;if(y.text===":"?this._flags.ternary_depth===0?se=!1:(this._flags.ternary_depth-=1,ve=!0):y.text==="?"&&(this._flags.ternary_depth+=1),!Y&&!G&&this._options.preserve_newlines&&c(y.text,a)){var Se=y.text===":",Ce=Se&&ve,pe=Se&&!ve;switch(this._options.operator_position){case S.before_newline:this._output.space_before_token=!pe,this.print_token(y),(!Se||Ce)&&this.allow_wrap_or_preserved_newline(y),this._output.space_before_token=!0;return;case S.after_newline:this._output.space_before_token=!0,!Se||Ce?this._tokens.peek().newlines?this.print_newline(!1,!0):this.allow_wrap_or_preserved_newline(y):this._output.space_before_token=!1,this.print_token(y),this._output.space_before_token=!0;return;case S.preserve_newline:pe||this.allow_wrap_or_preserved_newline(y),se=!(this._output.just_added_newline()||pe),this._output.space_before_token=se,this.print_token(y),this._output.space_before_token=!0;return}}if(G){this.allow_wrap_or_preserved_newline(y),se=!1;var fe=this._tokens.peek();we=fe&&c(fe.type,[o.WORD,o.RESERVED])}else if(y.text==="...")this.allow_wrap_or_preserved_newline(y),se=this._flags.last_token.type===o.START_BLOCK,we=!1;else if(c(y.text,["--","++","!","~"])||Y){if((this._flags.last_token.type===o.COMMA||this._flags.last_token.type===o.START_EXPR)&&this.allow_wrap_or_preserved_newline(y),se=!1,we=!1,y.newlines&&(y.text==="--"||y.text==="++"||y.text==="~")){var oe=O(this._flags.last_token,A)&&y.newlines;oe&&(this._previous_flags.if_block||this._previous_flags.else_block)&&this.restore_mode(),this.print_newline(oe,!0)}this._flags.last_token.text===";"&&F(this._flags.mode)&&(se=!0),this._flags.last_token.type===o.RESERVED?se=!0:this._flags.last_token.type===o.END_EXPR?se=!(this._flags.last_token.text==="]"&&(y.text==="--"||y.text==="++")):this._flags.last_token.type===o.OPERATOR&&(se=c(y.text,["--","-","++","+"])&&c(this._flags.last_token.text,["--","-","++","+"]),c(y.text,["+","-"])&&c(this._flags.last_token.text,["--","++"])&&(we=!0)),(this._flags.mode===d.BlockStatement&&!this._flags.inline_frame||this._flags.mode===d.Statement)&&(this._flags.last_token.text==="{"||this._flags.last_token.text===";")&&this.print_newline()}this._output.space_before_token=this._output.space_before_token||se,this.print_token(y),this._output.space_before_token=we},H.prototype.handle_block_comment=function(y,G){if(this._output.raw){this._output.add_raw_token(y),y.directives&&y.directives.preserve==="end"&&(this._output.raw=this._options.test_output_raw);return}if(y.directives){this.print_newline(!1,G),this.print_token(y),y.directives.preserve==="start"&&(this._output.raw=!0),this.print_newline(!1,!0);return}if(!h.newline.test(y.text)&&!y.newlines){this._output.space_before_token=!0,this.print_token(y),this._output.space_before_token=!0;return}else this.print_block_commment(y,G)},H.prototype.print_block_commment=function(y,G){var Y=g(y.text),ie,se=!1,we=!1,ve=y.whitespace_before,Se=ve.length;if(this.print_newline(!1,G),this.print_token_line_indentation(y),this._output.add_token(Y[0]),this.print_newline(!1,G),Y.length>1){for(Y=Y.slice(1),se=D(Y,"*"),we=j(Y,ve),se&&(this._flags.alignment=1),ie=0;ie<Y.length;ie++)se?(this.print_token_line_indentation(y),this._output.add_token(L(Y[ie]))):we&&Y[ie]?(this.print_token_line_indentation(y),this._output.add_token(Y[ie].substring(Se))):(this._output.current_line.set_indent(-1),this._output.add_token(Y[ie])),this.print_newline(!1,G);this._flags.alignment=0}},H.prototype.handle_comment=function(y,G){y.newlines?this.print_newline(!1,G):this._output.trim(!0),this._output.space_before_token=!0,this.print_token(y),this.print_newline(!1,G)},H.prototype.handle_dot=function(y){this.start_of_statement(y)||this.handle_whitespace_and_comments(y,!0),this._flags.last_token.text.match("^[0-9]+$")&&(this._output.space_before_token=!0),O(this._flags.last_token,A)?this._output.space_before_token=!1:this.allow_wrap_or_preserved_newline(y,this._flags.last_token.text===")"&&this._options.break_chained_methods),this._options.unindent_chained_methods&&this._output.just_added_newline()&&this.deindent(),this.print_token(y)},H.prototype.handle_unknown=function(y,G){this.print_token(y),y.text[y.text.length-1]===`
`&&this.print_newline(!1,G)},H.prototype.handle_eof=function(y){for(;this._flags.mode===d.Statement;)this.restore_mode();this.handle_whitespace_and_comments(y)},P.exports.Beautifier=H},function(P){function R(f){this.__parent=f,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}R.prototype.clone_empty=function(){var f=new R(this.__parent);return f.set_indent(this.__indent_count,this.__alignment_count),f},R.prototype.item=function(f){return f<0?this.__items[this.__items.length+f]:this.__items[f]},R.prototype.has_match=function(f){for(var h=this.__items.length-1;h>=0;h--)if(this.__items[h].match(f))return!0;return!1},R.prototype.set_indent=function(f,h){this.is_empty()&&(this.__indent_count=f||0,this.__alignment_count=h||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},R.prototype._set_wrap_point=function(){this.__parent.wrap_line_length&&(this.__wrap_point_index=this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count)},R.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count},R.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var f=this.__parent.current_line;return f.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),f.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),f.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,f.__items[0]===" "&&(f.__items.splice(0,1),f.__character_count-=1),!0}return!1},R.prototype.is_empty=function(){return this.__items.length===0},R.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},R.prototype.push=function(f){this.__items.push(f);var h=f.lastIndexOf(`
`);h!==-1?this.__character_count=f.length-h:this.__character_count+=f.length},R.prototype.pop=function(){var f=null;return this.is_empty()||(f=this.__items.pop(),this.__character_count-=f.length),f},R.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},R.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},R.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},R.prototype.toString=function(){var f="";return this.is_empty()?this.__parent.indent_empty_lines&&(f=this.__parent.get_indent_string(this.__indent_count)):(f=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),f+=this.__items.join("")),f};function m(f,h){this.__cache=[""],this.__indent_size=f.indent_size,this.__indent_string=f.indent_char,f.indent_with_tabs||(this.__indent_string=new Array(f.indent_size+1).join(f.indent_char)),h=h||"",f.indent_level>0&&(h=new Array(f.indent_level+1).join(this.__indent_string)),this.__base_string=h,this.__base_string_length=h.length}m.prototype.get_indent_size=function(f,h){var s=this.__base_string_length;return h=h||0,f<0&&(s=0),s+=f*this.__indent_size,s+=h,s},m.prototype.get_indent_string=function(f,h){var s=this.__base_string;return h=h||0,f<0&&(f=0,s=""),h+=f*this.__indent_size,this.__ensure_cache(h),s+=this.__cache[h],s},m.prototype.__ensure_cache=function(f){for(;f>=this.__cache.length;)this.__add_column()},m.prototype.__add_column=function(){var f=this.__cache.length,h=0,s="";this.__indent_size&&f>=this.__indent_size&&(h=Math.floor(f/this.__indent_size),f-=h*this.__indent_size,s=new Array(h+1).join(this.__indent_string)),f&&(s+=new Array(f+1).join(" ")),this.__cache.push(s)};function p(f,h){this.__indent_cache=new m(f,h),this.raw=!1,this._end_with_newline=f.end_with_newline,this.indent_size=f.indent_size,this.wrap_line_length=f.wrap_line_length,this.indent_empty_lines=f.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new R(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}p.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},p.prototype.get_line_number=function(){return this.__lines.length},p.prototype.get_indent_string=function(f,h){return this.__indent_cache.get_indent_string(f,h)},p.prototype.get_indent_size=function(f,h){return this.__indent_cache.get_indent_size(f,h)},p.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},p.prototype.add_new_line=function(f){return this.is_empty()||!f&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},p.prototype.get_code=function(f){this.trim(!0);var h=this.current_line.pop();h&&(h[h.length-1]===`
`&&(h=h.replace(/\n+$/g,"")),this.current_line.push(h)),this._end_with_newline&&this.__add_outputline();var s=this.__lines.join(`
`);return f!==`
`&&(s=s.replace(/[\n]/g,f)),s},p.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},p.prototype.set_indent=function(f,h){return f=f||0,h=h||0,this.next_line.set_indent(f,h),this.__lines.length>1?(this.current_line.set_indent(f,h),!0):(this.current_line.set_indent(),!1)},p.prototype.add_raw_token=function(f){for(var h=0;h<f.newlines;h++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(f.whitespace_before),this.current_line.push(f.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},p.prototype.add_token=function(f){this.__add_space_before_token(),this.current_line.push(f),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},p.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},p.prototype.remove_indent=function(f){for(var h=this.__lines.length;f<h;)this.__lines[f]._remove_indent(),f++;this.current_line._remove_wrap_indent()},p.prototype.trim=function(f){for(f=f===void 0?!1:f,this.current_line.trim();f&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},p.prototype.just_added_newline=function(){return this.current_line.is_empty()},p.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},p.prototype.ensure_empty_line_above=function(f,h){for(var s=this.__lines.length-2;s>=0;){var u=this.__lines[s];if(u.is_empty())break;if(u.item(0).indexOf(f)!==0&&u.item(-1)!==h){this.__lines.splice(s+1,0,new R(this)),this.previous_line=this.__lines[this.__lines.length-2];break}s--}},P.exports.Output=p},function(P){function R(m,p,f,h){this.type=m,this.text=p,this.comments_before=null,this.newlines=f||0,this.whitespace_before=h||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}P.exports.Token=R},function(P,R){var m="\\x23\\x24\\x40\\x41-\\x5a\\x5f\\x61-\\x7a",p="\\x24\\x30-\\x39\\x41-\\x5a\\x5f\\x61-\\x7a",f="\\xaa\\xb5\\xba\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u02c1\\u02c6-\\u02d1\\u02e0-\\u02e4\\u02ec\\u02ee\\u0370-\\u0374\\u0376\\u0377\\u037a-\\u037d\\u0386\\u0388-\\u038a\\u038c\\u038e-\\u03a1\\u03a3-\\u03f5\\u03f7-\\u0481\\u048a-\\u0527\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05d0-\\u05ea\\u05f0-\\u05f2\\u0620-\\u064a\\u066e\\u066f\\u0671-\\u06d3\\u06d5\\u06e5\\u06e6\\u06ee\\u06ef\\u06fa-\\u06fc\\u06ff\\u0710\\u0712-\\u072f\\u074d-\\u07a5\\u07b1\\u07ca-\\u07ea\\u07f4\\u07f5\\u07fa\\u0800-\\u0815\\u081a\\u0824\\u0828\\u0840-\\u0858\\u08a0\\u08a2-\\u08ac\\u0904-\\u0939\\u093d\\u0950\\u0958-\\u0961\\u0971-\\u0977\\u0979-\\u097f\\u0985-\\u098c\\u098f\\u0990\\u0993-\\u09a8\\u09aa-\\u09b0\\u09b2\\u09b6-\\u09b9\\u09bd\\u09ce\\u09dc\\u09dd\\u09df-\\u09e1\\u09f0\\u09f1\\u0a05-\\u0a0a\\u0a0f\\u0a10\\u0a13-\\u0a28\\u0a2a-\\u0a30\\u0a32\\u0a33\\u0a35\\u0a36\\u0a38\\u0a39\\u0a59-\\u0a5c\\u0a5e\\u0a72-\\u0a74\\u0a85-\\u0a8d\\u0a8f-\\u0a91\\u0a93-\\u0aa8\\u0aaa-\\u0ab0\\u0ab2\\u0ab3\\u0ab5-\\u0ab9\\u0abd\\u0ad0\\u0ae0\\u0ae1\\u0b05-\\u0b0c\\u0b0f\\u0b10\\u0b13-\\u0b28\\u0b2a-\\u0b30\\u0b32\\u0b33\\u0b35-\\u0b39\\u0b3d\\u0b5c\\u0b5d\\u0b5f-\\u0b61\\u0b71\\u0b83\\u0b85-\\u0b8a\\u0b8e-\\u0b90\\u0b92-\\u0b95\\u0b99\\u0b9a\\u0b9c\\u0b9e\\u0b9f\\u0ba3\\u0ba4\\u0ba8-\\u0baa\\u0bae-\\u0bb9\\u0bd0\\u0c05-\\u0c0c\\u0c0e-\\u0c10\\u0c12-\\u0c28\\u0c2a-\\u0c33\\u0c35-\\u0c39\\u0c3d\\u0c58\\u0c59\\u0c60\\u0c61\\u0c85-\\u0c8c\\u0c8e-\\u0c90\\u0c92-\\u0ca8\\u0caa-\\u0cb3\\u0cb5-\\u0cb9\\u0cbd\\u0cde\\u0ce0\\u0ce1\\u0cf1\\u0cf2\\u0d05-\\u0d0c\\u0d0e-\\u0d10\\u0d12-\\u0d3a\\u0d3d\\u0d4e\\u0d60\\u0d61\\u0d7a-\\u0d7f\\u0d85-\\u0d96\\u0d9a-\\u0db1\\u0db3-\\u0dbb\\u0dbd\\u0dc0-\\u0dc6\\u0e01-\\u0e30\\u0e32\\u0e33\\u0e40-\\u0e46\\u0e81\\u0e82\\u0e84\\u0e87\\u0e88\\u0e8a\\u0e8d\\u0e94-\\u0e97\\u0e99-\\u0e9f\\u0ea1-\\u0ea3\\u0ea5\\u0ea7\\u0eaa\\u0eab\\u0ead-\\u0eb0\\u0eb2\\u0eb3\\u0ebd\\u0ec0-\\u0ec4\\u0ec6\\u0edc-\\u0edf\\u0f00\\u0f40-\\u0f47\\u0f49-\\u0f6c\\u0f88-\\u0f8c\\u1000-\\u102a\\u103f\\u1050-\\u1055\\u105a-\\u105d\\u1061\\u1065\\u1066\\u106e-\\u1070\\u1075-\\u1081\\u108e\\u10a0-\\u10c5\\u10c7\\u10cd\\u10d0-\\u10fa\\u10fc-\\u1248\\u124a-\\u124d\\u1250-\\u1256\\u1258\\u125a-\\u125d\\u1260-\\u1288\\u128a-\\u128d\\u1290-\\u12b0\\u12b2-\\u12b5\\u12b8-\\u12be\\u12c0\\u12c2-\\u12c5\\u12c8-\\u12d6\\u12d8-\\u1310\\u1312-\\u1315\\u1318-\\u135a\\u1380-\\u138f\\u13a0-\\u13f4\\u1401-\\u166c\\u166f-\\u167f\\u1681-\\u169a\\u16a0-\\u16ea\\u16ee-\\u16f0\\u1700-\\u170c\\u170e-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176c\\u176e-\\u1770\\u1780-\\u17b3\\u17d7\\u17dc\\u1820-\\u1877\\u1880-\\u18a8\\u18aa\\u18b0-\\u18f5\\u1900-\\u191c\\u1950-\\u196d\\u1970-\\u1974\\u1980-\\u19ab\\u19c1-\\u19c7\\u1a00-\\u1a16\\u1a20-\\u1a54\\u1aa7\\u1b05-\\u1b33\\u1b45-\\u1b4b\\u1b83-\\u1ba0\\u1bae\\u1baf\\u1bba-\\u1be5\\u1c00-\\u1c23\\u1c4d-\\u1c4f\\u1c5a-\\u1c7d\\u1ce9-\\u1cec\\u1cee-\\u1cf1\\u1cf5\\u1cf6\\u1d00-\\u1dbf\\u1e00-\\u1f15\\u1f18-\\u1f1d\\u1f20-\\u1f45\\u1f48-\\u1f4d\\u1f50-\\u1f57\\u1f59\\u1f5b\\u1f5d\\u1f5f-\\u1f7d\\u1f80-\\u1fb4\\u1fb6-\\u1fbc\\u1fbe\\u1fc2-\\u1fc4\\u1fc6-\\u1fcc\\u1fd0-\\u1fd3\\u1fd6-\\u1fdb\\u1fe0-\\u1fec\\u1ff2-\\u1ff4\\u1ff6-\\u1ffc\\u2071\\u207f\\u2090-\\u209c\\u2102\\u2107\\u210a-\\u2113\\u2115\\u2119-\\u211d\\u2124\\u2126\\u2128\\u212a-\\u212d\\u212f-\\u2139\\u213c-\\u213f\\u2145-\\u2149\\u214e\\u2160-\\u2188\\u2c00-\\u2c2e\\u2c30-\\u2c5e\\u2c60-\\u2ce4\\u2ceb-\\u2cee\\u2cf2\\u2cf3\\u2d00-\\u2d25\\u2d27\\u2d2d\\u2d30-\\u2d67\\u2d6f\\u2d80-\\u2d96\\u2da0-\\u2da6\\u2da8-\\u2dae\\u2db0-\\u2db6\\u2db8-\\u2dbe\\u2dc0-\\u2dc6\\u2dc8-\\u2dce\\u2dd0-\\u2dd6\\u2dd8-\\u2dde\\u2e2f\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303c\\u3041-\\u3096\\u309d-\\u309f\\u30a1-\\u30fa\\u30fc-\\u30ff\\u3105-\\u312d\\u3131-\\u318e\\u31a0-\\u31ba\\u31f0-\\u31ff\\u3400-\\u4db5\\u4e00-\\u9fcc\\ua000-\\ua48c\\ua4d0-\\ua4fd\\ua500-\\ua60c\\ua610-\\ua61f\\ua62a\\ua62b\\ua640-\\ua66e\\ua67f-\\ua697\\ua6a0-\\ua6ef\\ua717-\\ua71f\\ua722-\\ua788\\ua78b-\\ua78e\\ua790-\\ua793\\ua7a0-\\ua7aa\\ua7f8-\\ua801\\ua803-\\ua805\\ua807-\\ua80a\\ua80c-\\ua822\\ua840-\\ua873\\ua882-\\ua8b3\\ua8f2-\\ua8f7\\ua8fb\\ua90a-\\ua925\\ua930-\\ua946\\ua960-\\ua97c\\ua984-\\ua9b2\\ua9cf\\uaa00-\\uaa28\\uaa40-\\uaa42\\uaa44-\\uaa4b\\uaa60-\\uaa76\\uaa7a\\uaa80-\\uaaaf\\uaab1\\uaab5\\uaab6\\uaab9-\\uaabd\\uaac0\\uaac2\\uaadb-\\uaadd\\uaae0-\\uaaea\\uaaf2-\\uaaf4\\uab01-\\uab06\\uab09-\\uab0e\\uab11-\\uab16\\uab20-\\uab26\\uab28-\\uab2e\\uabc0-\\uabe2\\uac00-\\ud7a3\\ud7b0-\\ud7c6\\ud7cb-\\ud7fb\\uf900-\\ufa6d\\ufa70-\\ufad9\\ufb00-\\ufb06\\ufb13-\\ufb17\\ufb1d\\ufb1f-\\ufb28\\ufb2a-\\ufb36\\ufb38-\\ufb3c\\ufb3e\\ufb40\\ufb41\\ufb43\\ufb44\\ufb46-\\ufbb1\\ufbd3-\\ufd3d\\ufd50-\\ufd8f\\ufd92-\\ufdc7\\ufdf0-\\ufdfb\\ufe70-\\ufe74\\ufe76-\\ufefc\\uff21-\\uff3a\\uff41-\\uff5a\\uff66-\\uffbe\\uffc2-\\uffc7\\uffca-\\uffcf\\uffd2-\\uffd7\\uffda-\\uffdc",h="\\u0300-\\u036f\\u0483-\\u0487\\u0591-\\u05bd\\u05bf\\u05c1\\u05c2\\u05c4\\u05c5\\u05c7\\u0610-\\u061a\\u0620-\\u0649\\u0672-\\u06d3\\u06e7-\\u06e8\\u06fb-\\u06fc\\u0730-\\u074a\\u0800-\\u0814\\u081b-\\u0823\\u0825-\\u0827\\u0829-\\u082d\\u0840-\\u0857\\u08e4-\\u08fe\\u0900-\\u0903\\u093a-\\u093c\\u093e-\\u094f\\u0951-\\u0957\\u0962-\\u0963\\u0966-\\u096f\\u0981-\\u0983\\u09bc\\u09be-\\u09c4\\u09c7\\u09c8\\u09d7\\u09df-\\u09e0\\u0a01-\\u0a03\\u0a3c\\u0a3e-\\u0a42\\u0a47\\u0a48\\u0a4b-\\u0a4d\\u0a51\\u0a66-\\u0a71\\u0a75\\u0a81-\\u0a83\\u0abc\\u0abe-\\u0ac5\\u0ac7-\\u0ac9\\u0acb-\\u0acd\\u0ae2-\\u0ae3\\u0ae6-\\u0aef\\u0b01-\\u0b03\\u0b3c\\u0b3e-\\u0b44\\u0b47\\u0b48\\u0b4b-\\u0b4d\\u0b56\\u0b57\\u0b5f-\\u0b60\\u0b66-\\u0b6f\\u0b82\\u0bbe-\\u0bc2\\u0bc6-\\u0bc8\\u0bca-\\u0bcd\\u0bd7\\u0be6-\\u0bef\\u0c01-\\u0c03\\u0c46-\\u0c48\\u0c4a-\\u0c4d\\u0c55\\u0c56\\u0c62-\\u0c63\\u0c66-\\u0c6f\\u0c82\\u0c83\\u0cbc\\u0cbe-\\u0cc4\\u0cc6-\\u0cc8\\u0cca-\\u0ccd\\u0cd5\\u0cd6\\u0ce2-\\u0ce3\\u0ce6-\\u0cef\\u0d02\\u0d03\\u0d46-\\u0d48\\u0d57\\u0d62-\\u0d63\\u0d66-\\u0d6f\\u0d82\\u0d83\\u0dca\\u0dcf-\\u0dd4\\u0dd6\\u0dd8-\\u0ddf\\u0df2\\u0df3\\u0e34-\\u0e3a\\u0e40-\\u0e45\\u0e50-\\u0e59\\u0eb4-\\u0eb9\\u0ec8-\\u0ecd\\u0ed0-\\u0ed9\\u0f18\\u0f19\\u0f20-\\u0f29\\u0f35\\u0f37\\u0f39\\u0f41-\\u0f47\\u0f71-\\u0f84\\u0f86-\\u0f87\\u0f8d-\\u0f97\\u0f99-\\u0fbc\\u0fc6\\u1000-\\u1029\\u1040-\\u1049\\u1067-\\u106d\\u1071-\\u1074\\u1082-\\u108d\\u108f-\\u109d\\u135d-\\u135f\\u170e-\\u1710\\u1720-\\u1730\\u1740-\\u1750\\u1772\\u1773\\u1780-\\u17b2\\u17dd\\u17e0-\\u17e9\\u180b-\\u180d\\u1810-\\u1819\\u1920-\\u192b\\u1930-\\u193b\\u1951-\\u196d\\u19b0-\\u19c0\\u19c8-\\u19c9\\u19d0-\\u19d9\\u1a00-\\u1a15\\u1a20-\\u1a53\\u1a60-\\u1a7c\\u1a7f-\\u1a89\\u1a90-\\u1a99\\u1b46-\\u1b4b\\u1b50-\\u1b59\\u1b6b-\\u1b73\\u1bb0-\\u1bb9\\u1be6-\\u1bf3\\u1c00-\\u1c22\\u1c40-\\u1c49\\u1c5b-\\u1c7d\\u1cd0-\\u1cd2\\u1d00-\\u1dbe\\u1e01-\\u1f15\\u200c\\u200d\\u203f\\u2040\\u2054\\u20d0-\\u20dc\\u20e1\\u20e5-\\u20f0\\u2d81-\\u2d96\\u2de0-\\u2dff\\u3021-\\u3028\\u3099\\u309a\\ua640-\\ua66d\\ua674-\\ua67d\\ua69f\\ua6f0-\\ua6f1\\ua7f8-\\ua800\\ua806\\ua80b\\ua823-\\ua827\\ua880-\\ua881\\ua8b4-\\ua8c4\\ua8d0-\\ua8d9\\ua8f3-\\ua8f7\\ua900-\\ua909\\ua926-\\ua92d\\ua930-\\ua945\\ua980-\\ua983\\ua9b3-\\ua9c0\\uaa00-\\uaa27\\uaa40-\\uaa41\\uaa4c-\\uaa4d\\uaa50-\\uaa59\\uaa7b\\uaae0-\\uaae9\\uaaf2-\\uaaf3\\uabc0-\\uabe1\\uabec\\uabed\\uabf0-\\uabf9\\ufb20-\\ufb28\\ufe00-\\ufe0f\\ufe20-\\ufe26\\ufe33\\ufe34\\ufe4d-\\ufe4f\\uff10-\\uff19\\uff3f",s="(?:\\\\u[0-9a-fA-F]{4}|["+m+f+"])",u="(?:\\\\u[0-9a-fA-F]{4}|["+p+f+h+"])*";R.identifier=new RegExp(s+u,"g"),R.identifierStart=new RegExp(s),R.identifierMatch=new RegExp("(?:\\\\u[0-9a-fA-F]{4}|["+p+f+h+"])+");var l=/[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/;R.newline=/[\n\r\u2028\u2029]/,R.lineBreak=new RegExp(`\r
|`+R.newline.source),R.allLineBreaks=new RegExp(R.lineBreak.source,"g")},function(P,R,m){var p=m(6).Options,f=["before-newline","after-newline","preserve-newline"];function h(s){p.call(this,s,"js");var u=this.raw_options.brace_style||null;u==="expand-strict"?this.raw_options.brace_style="expand":u==="collapse-preserve-inline"?this.raw_options.brace_style="collapse,preserve-inline":this.raw_options.braces_on_own_line!==void 0&&(this.raw_options.brace_style=this.raw_options.braces_on_own_line?"expand":"collapse");var l=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_preserve_inline=!1,this.brace_style="collapse";for(var a=0;a<l.length;a++)l[a]==="preserve-inline"?this.brace_preserve_inline=!0:this.brace_style=l[a];this.unindent_chained_methods=this._get_boolean("unindent_chained_methods"),this.break_chained_methods=this._get_boolean("break_chained_methods"),this.space_in_paren=this._get_boolean("space_in_paren"),this.space_in_empty_paren=this._get_boolean("space_in_empty_paren"),this.jslint_happy=this._get_boolean("jslint_happy"),this.space_after_anon_function=this._get_boolean("space_after_anon_function"),this.space_after_named_function=this._get_boolean("space_after_named_function"),this.keep_array_indentation=this._get_boolean("keep_array_indentation"),this.space_before_conditional=this._get_boolean("space_before_conditional",!0),this.unescape_strings=this._get_boolean("unescape_strings"),this.e4x=this._get_boolean("e4x"),this.comma_first=this._get_boolean("comma_first"),this.operator_position=this._get_selection("operator_position",f),this.test_output_raw=this._get_boolean("test_output_raw"),this.jslint_happy&&(this.space_after_anon_function=!0)}h.prototype=new p,P.exports.Options=h},function(P){function R(f,h){this.raw_options=m(f,h),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs",this.indent_char===" "),this.indent_with_tabs&&(this.indent_char=" ",this.indent_size===1&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","django","erb","handlebars","php","smarty"],["auto"])}R.prototype._get_array=function(f,h){var s=this.raw_options[f],u=h||[];return typeof s=="object"?s!==null&&typeof s.concat=="function"&&(u=s.concat()):typeof s=="string"&&(u=s.split(/[^a-zA-Z0-9_\/\-]+/)),u},R.prototype._get_boolean=function(f,h){var s=this.raw_options[f],u=s===void 0?!!h:!!s;return u},R.prototype._get_characters=function(f,h){var s=this.raw_options[f],u=h||"";return typeof s=="string"&&(u=s.replace(/\\r/,"\r").replace(/\\n/,`
`).replace(/\\t/," ")),u},R.prototype._get_number=function(f,h){var s=this.raw_options[f];h=parseInt(h,10),isNaN(h)&&(h=0);var u=parseInt(s,10);return isNaN(u)&&(u=h),u},R.prototype._get_selection=function(f,h,s){var u=this._get_selection_list(f,h,s);if(u.length!==1)throw new Error("Invalid Option Value: The option '"+f+`' can only be one of the following values:
`+h+`
You passed in: '`+this.raw_options[f]+"'");return u[0]},R.prototype._get_selection_list=function(f,h,s){if(!h||h.length===0)throw new Error("Selection list cannot be empty.");if(s=s||[h[0]],!this._is_valid_selection(s,h))throw new Error("Invalid Default Value!");var u=this._get_array(f,s);if(!this._is_valid_selection(u,h))throw new Error("Invalid Option Value: The option '"+f+`' can contain only the following values:
`+h+`
You passed in: '`+this.raw_options[f]+"'");return u},R.prototype._is_valid_selection=function(f,h){return f.length&&h.length&&!f.some(function(s){return h.indexOf(s)===-1})};function m(f,h){var s={};f=p(f);var u;for(u in f)u!==h&&(s[u]=f[u]);if(h&&f[h])for(u in f[h])s[u]=f[h][u];return s}function p(f){var h={},s;for(s in f){var u=s.replace(/-/g,"_");h[u]=f[s]}return h}P.exports.Options=R,P.exports.normalizeOpts=p,P.exports.mergeOpts=m},function(P,R,m){var p=m(8).InputScanner,f=m(9).Tokenizer,h=m(9).TOKEN,s=m(13).Directives,u=m(4),l=m(12).Pattern,a=m(14).TemplatablePattern;function o(D,j){return j.indexOf(D)!==-1}var c={START_EXPR:"TK_START_EXPR",END_EXPR:"TK_END_EXPR",START_BLOCK:"TK_START_BLOCK",END_BLOCK:"TK_END_BLOCK",WORD:"TK_WORD",RESERVED:"TK_RESERVED",SEMICOLON:"TK_SEMICOLON",STRING:"TK_STRING",EQUALS:"TK_EQUALS",OPERATOR:"TK_OPERATOR",COMMA:"TK_COMMA",BLOCK_COMMENT:"TK_BLOCK_COMMENT",COMMENT:"TK_COMMENT",DOT:"TK_DOT",UNKNOWN:"TK_UNKNOWN",START:h.START,RAW:h.RAW,EOF:h.EOF},L=new s(/\/\*/,/\*\//),w=/0[xX][0123456789abcdefABCDEF_]*n?|0[oO][01234567_]*n?|0[bB][01_]*n?|\d[\d_]*n|(?:\.\d[\d_]*|\d[\d_]*\.?[\d_]*)(?:[eE][+-]?[\d_]+)?/,T=/[0-9]/,O=/[^\d\.]/,A=">>> === !== &&= ??= ||= << && >= ** != == <= >> || ?? |> < / - + > : & % ? ^ | *".split(" "),x=">>>= ... >>= <<= === >>> !== **= &&= ??= ||= => ^= :: /= << <= == && -= >= >> != -- += ** || ?? ++ %= &= *= |= |> = ! ? > < : / ^ - + * & % ~ |";x=x.replace(/[-[\]{}()*+?.,\\^$|#]/g,"\\$&"),x="\\?\\.(?!\\d) "+x,x=x.replace(/ /g,"|");var S=new RegExp(x),E="continue,try,throw,return,var,let,const,if,switch,case,default,for,while,break,function,import,export".split(","),d=E.concat(["do","in","of","else","get","set","new","catch","finally","typeof","yield","async","await","from","as","class","extends"]),b=new RegExp("^(?:"+d.join("|")+")$"),g,_=function(D,j){f.call(this,D,j),this._patterns.whitespace=this._patterns.whitespace.matching(/\u00A0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff/.source,/\u2028\u2029/.source);var H=new l(this._input),k=new a(this._input).read_options(this._options);this.__patterns={template:k,identifier:k.starting_with(u.identifier).matching(u.identifierMatch),number:H.matching(w),punct:H.matching(S),comment:H.starting_with(/\/\//).until(/[\n\r\u2028\u2029]/),block_comment:H.starting_with(/\/\*/).until_after(/\*\//),html_comment_start:H.matching(/<!--/),html_comment_end:H.matching(/-->/),include:H.starting_with(/#include/).until_after(u.lineBreak),shebang:H.starting_with(/#!/).until_after(u.lineBreak),xml:H.matching(/[\s\S]*?<(\/?)([-a-zA-Z:0-9_.]+|{[^}]+?}|!\[CDATA\[[^\]]*?\]\]|)(\s*{[^}]+?}|\s+[-a-zA-Z:0-9_.]+|\s+[-a-zA-Z:0-9_.]+\s*=\s*('[^']*'|"[^"]*"|{([^{}]|{[^}]+?})+?}))*\s*(\/?)\s*>/),single_quote:k.until(/['\\\n\r\u2028\u2029]/),double_quote:k.until(/["\\\n\r\u2028\u2029]/),template_text:k.until(/[`\\$]/),template_expression:k.until(/[`}\\]/)}};_.prototype=new f,_.prototype._is_comment=function(D){return D.type===c.COMMENT||D.type===c.BLOCK_COMMENT||D.type===c.UNKNOWN},_.prototype._is_opening=function(D){return D.type===c.START_BLOCK||D.type===c.START_EXPR},_.prototype._is_closing=function(D,j){return(D.type===c.END_BLOCK||D.type===c.END_EXPR)&&j&&(D.text==="]"&&j.text==="["||D.text===")"&&j.text==="("||D.text==="}"&&j.text==="{")},_.prototype._reset=function(){g=!1},_.prototype._get_next_token=function(D,j){var H=null;this._readWhitespace();var k=this._input.peek();return k===null?this._create_token(c.EOF,""):(H=H||this._read_non_javascript(k),H=H||this._read_string(k),H=H||this._read_word(D),H=H||this._read_singles(k),H=H||this._read_comment(k),H=H||this._read_regexp(k,D),H=H||this._read_xml(k,D),H=H||this._read_punctuation(),H=H||this._create_token(c.UNKNOWN,this._input.next()),H)},_.prototype._read_word=function(D){var j;if(j=this.__patterns.identifier.read(),j!=="")return j=j.replace(u.allLineBreaks,`
`),!(D.type===c.DOT||D.type===c.RESERVED&&(D.text==="set"||D.text==="get"))&&b.test(j)?(j==="in"||j==="of")&&(D.type===c.WORD||D.type===c.STRING)?this._create_token(c.OPERATOR,j):this._create_token(c.RESERVED,j):this._create_token(c.WORD,j);if(j=this.__patterns.number.read(),j!=="")return this._create_token(c.WORD,j)},_.prototype._read_singles=function(D){var j=null;return D==="("||D==="["?j=this._create_token(c.START_EXPR,D):D===")"||D==="]"?j=this._create_token(c.END_EXPR,D):D==="{"?j=this._create_token(c.START_BLOCK,D):D==="}"?j=this._create_token(c.END_BLOCK,D):D===";"?j=this._create_token(c.SEMICOLON,D):D==="."&&O.test(this._input.peek(1))?j=this._create_token(c.DOT,D):D===","&&(j=this._create_token(c.COMMA,D)),j&&this._input.next(),j},_.prototype._read_punctuation=function(){var D=this.__patterns.punct.read();if(D!=="")return D==="="?this._create_token(c.EQUALS,D):D==="?."?this._create_token(c.DOT,D):this._create_token(c.OPERATOR,D)},_.prototype._read_non_javascript=function(D){var j="";if(D==="#"){if(this._is_first_token()&&(j=this.__patterns.shebang.read(),j))return this._create_token(c.UNKNOWN,j.trim()+`
`);if(j=this.__patterns.include.read(),j)return this._create_token(c.UNKNOWN,j.trim()+`
`);D=this._input.next();var H="#";if(this._input.hasNext()&&this._input.testChar(T)){do D=this._input.next(),H+=D;while(this._input.hasNext()&&D!=="#"&&D!=="=");return D==="#"||(this._input.peek()==="["&&this._input.peek(1)==="]"?(H+="[]",this._input.next(),this._input.next()):this._input.peek()==="{"&&this._input.peek(1)==="}"&&(H+="{}",this._input.next(),this._input.next())),this._create_token(c.WORD,H)}this._input.back()}else if(D==="<"&&this._is_first_token()){if(j=this.__patterns.html_comment_start.read(),j){for(;this._input.hasNext()&&!this._input.testChar(u.newline);)j+=this._input.next();return g=!0,this._create_token(c.COMMENT,j)}}else if(g&&D==="-"&&(j=this.__patterns.html_comment_end.read(),j))return g=!1,this._create_token(c.COMMENT,j);return null},_.prototype._read_comment=function(D){var j=null;if(D==="/"){var H="";if(this._input.peek(1)==="*"){H=this.__patterns.block_comment.read();var k=L.get_directives(H);k&&k.ignore==="start"&&(H+=L.readIgnored(this._input)),H=H.replace(u.allLineBreaks,`
`),j=this._create_token(c.BLOCK_COMMENT,H),j.directives=k}else this._input.peek(1)==="/"&&(H=this.__patterns.comment.read(),j=this._create_token(c.COMMENT,H))}return j},_.prototype._read_string=function(D){if(D==="`"||D==="'"||D==='"'){var j=this._input.next();return this.has_char_escapes=!1,D==="`"?j+=this._read_string_recursive("`",!0,"${"):j+=this._read_string_recursive(D),this.has_char_escapes&&this._options.unescape_strings&&(j=F(j)),this._input.peek()===D&&(j+=this._input.next()),j=j.replace(u.allLineBreaks,`
`),this._create_token(c.STRING,j)}return null},_.prototype._allow_regexp_or_xml=function(D){return D.type===c.RESERVED&&o(D.text,["return","case","throw","else","do","typeof","yield"])||D.type===c.END_EXPR&&D.text===")"&&D.opened.previous.type===c.RESERVED&&o(D.opened.previous.text,["if","while","for"])||o(D.type,[c.COMMENT,c.START_EXPR,c.START_BLOCK,c.START,c.END_BLOCK,c.OPERATOR,c.EQUALS,c.EOF,c.SEMICOLON,c.COMMA])},_.prototype._read_regexp=function(D,j){if(D==="/"&&this._allow_regexp_or_xml(j)){for(var H=this._input.next(),k=!1,y=!1;this._input.hasNext()&&(k||y||this._input.peek()!==D)&&!this._input.testChar(u.newline);)H+=this._input.peek(),k?k=!1:(k=this._input.peek()==="\\",this._input.peek()==="["?y=!0:this._input.peek()==="]"&&(y=!1)),this._input.next();return this._input.peek()===D&&(H+=this._input.next(),H+=this._input.read(u.identifier)),this._create_token(c.STRING,H)}return null},_.prototype._read_xml=function(D,j){if(this._options.e4x&&D==="<"&&this._allow_regexp_or_xml(j)){var H="",k=this.__patterns.xml.read_match();if(k){for(var y=k[2].replace(/^{\s+/,"{").replace(/\s+}$/,"}"),G=y.indexOf("{")===0,Y=0;k;){var ie=!!k[1],se=k[2],we=!!k[k.length-1]||se.slice(0,8)==="![CDATA[";if(!we&&(se===y||G&&se.replace(/^{\s+/,"{").replace(/\s+}$/,"}"))&&(ie?--Y:++Y),H+=k[0],Y<=0)break;k=this.__patterns.xml.read_match()}return k||(H+=this._input.match(/[\s\S]*/g)[0]),H=H.replace(u.allLineBreaks,`
`),this._create_token(c.STRING,H)}}return null};function F(D){for(var j="",H=0,k=new p(D),y=null;k.hasNext();)if(y=k.match(/([\s]|[^\\]|\\\\)+/g),y&&(j+=y[0]),k.peek()==="\\"){if(k.next(),k.peek()==="x")y=k.match(/x([0-9A-Fa-f]{2})/g);else if(k.peek()==="u")y=k.match(/u([0-9A-Fa-f]{4})/g);else{j+="\\",k.hasNext()&&(j+=k.next());continue}if(!y)return D;if(H=parseInt(y[1],16),H>126&&H<=255&&y[0].indexOf("x")===0)return D;if(H>=0&&H<32){j+="\\"+y[0];continue}else H===34||H===39||H===92?j+="\\"+String.fromCharCode(H):j+=String.fromCharCode(H)}return j}_.prototype._read_string_recursive=function(D,j,H){var k,y;D==="'"?y=this.__patterns.single_quote:D==='"'?y=this.__patterns.double_quote:D==="`"?y=this.__patterns.template_text:D==="}"&&(y=this.__patterns.template_expression);for(var G=y.read(),Y="";this._input.hasNext();){if(Y=this._input.next(),Y===D||!j&&u.newline.test(Y)){this._input.back();break}else Y==="\\"&&this._input.hasNext()?(k=this._input.peek(),k==="x"||k==="u"?this.has_char_escapes=!0:k==="\r"&&this._input.peek(1)===`
`&&this._input.next(),Y+=this._input.next()):H&&(H==="${"&&Y==="$"&&this._input.peek()==="{"&&(Y+=this._input.next()),H===Y&&(D==="`"?Y+=this._read_string_recursive("}",j,"`"):Y+=this._read_string_recursive("`",j,"${"),this._input.hasNext()&&(Y+=this._input.next())));Y+=y.read(),G+=Y}return G},P.exports.Tokenizer=_,P.exports.TOKEN=c,P.exports.positionable_operators=A.slice(),P.exports.line_starters=E.slice()},function(P){var R=RegExp.prototype.hasOwnProperty("sticky");function m(p){this.__input=p||"",this.__input_length=this.__input.length,this.__position=0}m.prototype.restart=function(){this.__position=0},m.prototype.back=function(){this.__position>0&&(this.__position-=1)},m.prototype.hasNext=function(){return this.__position<this.__input_length},m.prototype.next=function(){var p=null;return this.hasNext()&&(p=this.__input.charAt(this.__position),this.__position+=1),p},m.prototype.peek=function(p){var f=null;return p=p||0,p+=this.__position,p>=0&&p<this.__input_length&&(f=this.__input.charAt(p)),f},m.prototype.__match=function(p,f){p.lastIndex=f;var h=p.exec(this.__input);return h&&!(R&&p.sticky)&&(h.index!==f&&(h=null)),h},m.prototype.test=function(p,f){return f=f||0,f+=this.__position,f>=0&&f<this.__input_length?!!this.__match(p,f):!1},m.prototype.testChar=function(p,f){var h=this.peek(f);return p.lastIndex=0,h!==null&&p.test(h)},m.prototype.match=function(p){var f=this.__match(p,this.__position);return f?this.__position+=f[0].length:f=null,f},m.prototype.read=function(p,f,h){var s="",u;return p&&(u=this.match(p),u&&(s+=u[0])),f&&(u||!p)&&(s+=this.readUntil(f,h)),s},m.prototype.readUntil=function(p,f){var h="",s=this.__position;p.lastIndex=this.__position;var u=p.exec(this.__input);return u?(s=u.index,f&&(s+=u[0].length)):s=this.__input_length,h=this.__input.substring(this.__position,s),this.__position=s,h},m.prototype.readUntilAfter=function(p){return this.readUntil(p,!0)},m.prototype.get_regexp=function(p,f){var h=null,s="g";return f&&R&&(s="y"),typeof p=="string"&&p!==""?h=new RegExp(p,s):p&&(h=new RegExp(p.source,s)),h},m.prototype.get_literal_regexp=function(p){return RegExp(p.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},m.prototype.peekUntilAfter=function(p){var f=this.__position,h=this.readUntilAfter(p);return this.__position=f,h},m.prototype.lookBack=function(p){var f=this.__position-1;return f>=p.length&&this.__input.substring(f-p.length,f).toLowerCase()===p},P.exports.InputScanner=m},function(P,R,m){var p=m(8).InputScanner,f=m(3).Token,h=m(10).TokenStream,s=m(11).WhitespacePattern,u={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},l=function(a,o){this._input=new p(a),this._options=o||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new s(this._input)};l.prototype.tokenize=function(){this._input.restart(),this.__tokens=new h,this._reset();for(var a,o=new f(u.START,""),c=null,L=[],w=new h;o.type!==u.EOF;){for(a=this._get_next_token(o,c);this._is_comment(a);)w.add(a),a=this._get_next_token(o,c);w.isEmpty()||(a.comments_before=w,w=new h),a.parent=c,this._is_opening(a)?(L.push(c),c=a):c&&this._is_closing(a,c)&&(a.opened=c,c.closed=a,c=L.pop(),a.parent=c),a.previous=o,o.next=a,this.__tokens.add(a),o=a}return this.__tokens},l.prototype._is_first_token=function(){return this.__tokens.isEmpty()},l.prototype._reset=function(){},l.prototype._get_next_token=function(a,o){this._readWhitespace();var c=this._input.read(/.+/g);return c?this._create_token(u.RAW,c):this._create_token(u.EOF,"")},l.prototype._is_comment=function(a){return!1},l.prototype._is_opening=function(a){return!1},l.prototype._is_closing=function(a,o){return!1},l.prototype._create_token=function(a,o){var c=new f(a,o,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return c},l.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},P.exports.Tokenizer=l,P.exports.TOKEN=u},function(P){function R(m){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=m}R.prototype.restart=function(){this.__position=0},R.prototype.isEmpty=function(){return this.__tokens_length===0},R.prototype.hasNext=function(){return this.__position<this.__tokens_length},R.prototype.next=function(){var m=null;return this.hasNext()&&(m=this.__tokens[this.__position],this.__position+=1),m},R.prototype.peek=function(m){var p=null;return m=m||0,m+=this.__position,m>=0&&m<this.__tokens_length&&(p=this.__tokens[m]),p},R.prototype.add=function(m){this.__parent_token&&(m.parent=this.__parent_token),this.__tokens.push(m),this.__tokens_length+=1},P.exports.TokenStream=R},function(P,R,m){var p=m(12).Pattern;function f(h,s){p.call(this,h,s),s?this._line_regexp=this._input.get_regexp(s._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}f.prototype=new p,f.prototype.__set_whitespace_patterns=function(h,s){h+="\\t ",s+="\\n\\r",this._match_pattern=this._input.get_regexp("["+h+s+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+s+"]")},f.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var h=this._input.read(this._match_pattern);if(h===" ")this.whitespace_before_token=" ";else if(h){var s=this.__split(this._newline_regexp,h);this.newline_count=s.length-1,this.whitespace_before_token=s[this.newline_count]}return h},f.prototype.matching=function(h,s){var u=this._create();return u.__set_whitespace_patterns(h,s),u._update(),u},f.prototype._create=function(){return new f(this._input,this)},f.prototype.__split=function(h,s){h.lastIndex=0;for(var u=0,l=[],a=h.exec(s);a;)l.push(s.substring(u,a.index)),u=a.index+a[0].length,a=h.exec(s);return u<s.length?l.push(s.substring(u,s.length)):l.push(""),l},P.exports.WhitespacePattern=f},function(P){function R(m,p){this._input=m,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,p&&(this._starting_pattern=this._input.get_regexp(p._starting_pattern,!0),this._match_pattern=this._input.get_regexp(p._match_pattern,!0),this._until_pattern=this._input.get_regexp(p._until_pattern),this._until_after=p._until_after)}R.prototype.read=function(){var m=this._input.read(this._starting_pattern);return(!this._starting_pattern||m)&&(m+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),m},R.prototype.read_match=function(){return this._input.match(this._match_pattern)},R.prototype.until_after=function(m){var p=this._create();return p._until_after=!0,p._until_pattern=this._input.get_regexp(m),p._update(),p},R.prototype.until=function(m){var p=this._create();return p._until_after=!1,p._until_pattern=this._input.get_regexp(m),p._update(),p},R.prototype.starting_with=function(m){var p=this._create();return p._starting_pattern=this._input.get_regexp(m,!0),p._update(),p},R.prototype.matching=function(m){var p=this._create();return p._match_pattern=this._input.get_regexp(m,!0),p._update(),p},R.prototype._create=function(){return new R(this._input,this)},R.prototype._update=function(){},P.exports.Pattern=R},function(P){function R(m,p){m=typeof m=="string"?m:m.source,p=typeof p=="string"?p:p.source,this.__directives_block_pattern=new RegExp(m+/ beautify( \w+[:]\w+)+ /.source+p,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(m+/\sbeautify\signore:end\s/.source+p,"g")}R.prototype.get_directives=function(m){if(!m.match(this.__directives_block_pattern))return null;var p={};this.__directive_pattern.lastIndex=0;for(var f=this.__directive_pattern.exec(m);f;)p[f[1]]=f[2],f=this.__directive_pattern.exec(m);return p},R.prototype.readIgnored=function(m){return m.readUntilAfter(this.__directives_end_ignore_pattern)},P.exports.Directives=R},function(P,R,m){var p=m(12).Pattern,f={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1};function h(s,u){p.call(this,s,u),this.__template_pattern=null,this._disabled=Object.assign({},f),this._excluded=Object.assign({},f),u&&(this.__template_pattern=this._input.get_regexp(u.__template_pattern),this._excluded=Object.assign(this._excluded,u._excluded),this._disabled=Object.assign(this._disabled,u._disabled));var l=new p(s);this.__patterns={handlebars_comment:l.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:l.starting_with(/{{{/).until_after(/}}}/),handlebars:l.starting_with(/{{/).until_after(/}}/),php:l.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:l.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:l.starting_with(/{%/).until_after(/%}/),django_value:l.starting_with(/{{/).until_after(/}}/),django_comment:l.starting_with(/{#/).until_after(/#}/),smarty:l.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:l.starting_with(/{\*/).until_after(/\*}/),smarty_literal:l.starting_with(/{literal}/).until_after(/{\/literal}/)}}h.prototype=new p,h.prototype._create=function(){return new h(this._input,this)},h.prototype._update=function(){this.__set_templated_pattern()},h.prototype.disable=function(s){var u=this._create();return u._disabled[s]=!0,u._update(),u},h.prototype.read_options=function(s){var u=this._create();for(var l in f)u._disabled[l]=s.templating.indexOf(l)===-1;return u._update(),u},h.prototype.exclude=function(s){var u=this._create();return u._excluded[s]=!0,u._update(),u},h.prototype.read=function(){var s="";this._match_pattern?s=this._input.read(this._starting_pattern):s=this._input.read(this._starting_pattern,this.__template_pattern);for(var u=this._read_template();u;)this._match_pattern?u+=this._input.read(this._match_pattern):u+=this._input.readUntil(this.__template_pattern),s+=u,u=this._read_template();return this._until_after&&(s+=this._input.readUntilAfter(this._until_pattern)),s},h.prototype.__set_templated_pattern=function(){var s=[];this._disabled.php||s.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||s.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||s.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(s.push(this.__patterns.django._starting_pattern.source),s.push(this.__patterns.django_value._starting_pattern.source),s.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||s.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&s.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+s.join("|")+")")},h.prototype._read_template=function(){var s="",u=this._input.peek();if(u==="<"){var l=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&l==="?"&&(s=s||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&l==="%"&&(s=s||this.__patterns.erb.read())}else u==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(s=s||this.__patterns.handlebars_comment.read(),s=s||this.__patterns.handlebars_unescaped.read(),s=s||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(s=s||this.__patterns.django_value.read()),this._excluded.django||(s=s||this.__patterns.django_comment.read(),s=s||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(s=s||this.__patterns.smarty_comment.read(),s=s||this.__patterns.smarty_literal.read(),s=s||this.__patterns.smarty.read()));return s},P.exports.TemplatablePattern=h}],N={};function K(P){var R=N[P];if(R!==void 0)return R.exports;var m=N[P]={exports:{}};return B[P](m,m.exports,K),m.exports}var W=K(0);M=W})();var Q=M;!(ue=[],Z=function(){return{js_beautify:Q}}.apply(ot,ue),Z!==void 0&&(_t.exports=Z))})()},"7Cbv":function(_t,ot,le){"use strict";var ue=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),Z=new Uint8Array(16);function M(){if(!ue)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ue(Z)}var Q=/^(?:[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 B(f){return typeof f=="string"&&Q.test(f)}for(var N=B,K=[],W=0;W<256;++W)K.push((W+256).toString(16).substr(1));function P(f){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,s=(K[f[h+0]]+K[f[h+1]]+K[f[h+2]]+K[f[h+3]]+"-"+K[f[h+4]]+K[f[h+5]]+"-"+K[f[h+6]]+K[f[h+7]]+"-"+K[f[h+8]]+K[f[h+9]]+"-"+K[f[h+10]]+K[f[h+11]]+K[f[h+12]]+K[f[h+13]]+K[f[h+14]]+K[f[h+15]]).toLowerCase();if(!N(s))throw TypeError("Stringified UUID is invalid");return s}var R=P;function m(f,h,s){f=f||{};var u=f.random||(f.rng||M)();if(u[6]=u[6]&15|64,u[8]=u[8]&63|128,h){s=s||0;for(var l=0;l<16;++l)h[s+l]=u[l];return h}return R(u)}var p=ot.a=m},"7ahc":function(_t,ot,le){"use strict";le.d(ot,"a",function(){return L});var ue=le("k1fw"),Z=le("0Owb"),M=le("+L6B"),Q=le("2/Rp"),B=le("y8nQ"),N=le("Vl3Y"),K=le("tJVT"),W=le("OaEy"),P=le("2fM7"),R=le("q1tI"),m=le.n(R),p=le("VrN/"),f=le.n(p),h=le("p77/"),s=le.n(h),u=le("c5Ni"),l=le.n(u),a=P.a.Option,o={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"]};ot.b=function(w){var T=w.callback,O=w.onCancel,A=Object(R.useState)("python"),x=Object(K.a)(A,2),S=x[0],E=x[1];function d(g){E(c[g][1])}function b(g){T(g)}return m.a.createElement(N.a,Object(Z.a)({},o,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:b}),m.a.createElement(N.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},m.a.createElement(P.a,{onChange:d},Object.keys(c).map(function(g){return m.a.createElement(a,{key:g,value:g},c[g][0])}))),m.a.createElement(N.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},m.a.createElement(L,{mode:S})),m.a.createElement("div",{className:"flex-container flex-end"},m.a.createElement(Q.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),m.a.createElement(Q.a,{type:"ghost",onClick:O},"\u53D6\u6D88")))};function L(w){var T=w.value,O=w.onChange,A=w.mode,x=w.options,S=x===void 0?{}:x,E=Object(R.useRef)(),d=Object(R.useState)(),b=Object(K.a)(d,2),g=b[0],_=b[1];return Object(R.useEffect)(function(){if(g){function F(D){var j=D.getValue();O&&O(j)}return g.on("change",F),function(){g.off("change",F)}}},[g,O]),Object(R.useEffect)(function(){g&&g.setOption("mode",A)},[g,A]),Object(R.useEffect)(function(){g&&((T!==g.getValue()||T==="")&&setTimeout(function(){g.setValue(T||" ")},300))},[g,T]),Object(R.useEffect)(function(){if(E.current&&!g){var F=f.a.fromTextArea(E.current,Object(ue.a)({mode:A,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},S));_(F)}},[E.current,g]),m.a.createElement("div",{className:"my-codemirror-container"},m.a.createElement("textarea",{ref:E}))}},"8EBN":function(_t,ot,le){(function(ue){ue(le("VrN/"))})(function(ue){"use strict";ue.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 Z=0;Z<ue.modeInfo.length;Z++){var M=ue.modeInfo[Z];M.mimes&&(M.mime=M.mimes[0])}ue.findModeByMIME=function(Q){Q=Q.toLowerCase();for(var B=0;B<ue.modeInfo.length;B++){var N=ue.modeInfo[B];if(N.mime==Q)return N;if(N.mimes){for(var K=0;K<N.mimes.length;K++)if(N.mimes[K]==Q)return N}}if(/\+xml$/.test(Q))return ue.findModeByMIME("application/xml");if(/\+json$/.test(Q))return ue.findModeByMIME("application/json")},ue.findModeByExtension=function(Q){Q=Q.toLowerCase();for(var B=0;B<ue.modeInfo.length;B++){var N=ue.modeInfo[B];if(N.ext){for(var K=0;K<N.ext.length;K++)if(N.ext[K]==Q)return N}}},ue.findModeByFileName=function(Q){for(var B=0;B<ue.modeInfo.length;B++){var N=ue.modeInfo[B];if(N.file&&N.file.test(Q))return N}var K=Q.lastIndexOf("."),W=K>-1&&Q.substring(K+1,Q.length);if(W)return ue.findModeByExtension(W)},ue.findModeByName=function(Q){Q=Q.toLowerCase();for(var B=0;B<ue.modeInfo.length;B++){var N=ue.modeInfo[B];if(N.name.toLowerCase()==Q)return N;if(N.alias){for(var K=0;K<N.alias.length;K++)if(N.alias[K].toLowerCase()==Q)return N}}}})},"8hTe":function(_t,ot,le){_t.exports={button:"button___1wy9m"}},"9Bee":function(_t,ot,le){"use strict";var ue=le("DYRE"),Z=le("zeV3"),M=le("+L6B"),Q=le("2/Rp"),B=le("k1fw"),N=le("9og8"),K=le("tJVT"),W=le("WmNS"),P=le.n(W),R=le("q1tI"),m=le.n(R),p=le("vg9a"),f=le("DlQD"),h=le.n(f),s=le("rUJ1");function u(X,v){var C=X.match(/^(\s+)(?:```)/);if(C===null)return v;var U=C[1];return v.split(`
`).map(function(q){var V=q.match(/^\s+/);if(V===null)return q;var be=Object(K.a)(V,1),We=be[0];return We.length>=U.length?q.slice(U.length):q}).join(`
`)}var l=[],a=["<ul>"],o=new h.a.Renderer,c=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function L(){l.length=0,a=["<ul>"]}var w={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function T(X,v,C,U){if(v>=X.length||X[v].level<=C)return v;var q=X[v];U.push("<li><a href='#"+q.anchor+"'>"+q.text+"</a>"),v++;var V=[];return v=T(X,v,q.level,V),V.length>0&&(U.push("<ul>"),V.forEach(function(be){U.push(be)}),U.push("</ul>")),U.push("</li>"),v=T(X,v,C,U),v}function O(){return T(l,0,0,a),a.push("</ul>"),a.join("")}var A={heading:function(v){var C=c.exec(v);if(C)return{type:"heading",raw:C[0],depth:C[1].length,text:C[2]}},fences:function(v){var C=this.rules.block.fences.exec(v);if(C){var U=C[0],q=u(U,C[3]||""),V=C[2]?C[2].trim():C[2];if(["latex","katex","math"].indexOf(V)>=0){var be=E(),We=q;q=be,d[be]={type:"block",expression:We}}return{type:"code",raw:U,lang:V,text:q}}}},x=/(?:\${2})([^\n`]+?)(?:\${2})/gi,S=0,E=function(){return"__special_katext_id_".concat(S++,"__")},d={};function b(){return d}function g(){S=0,d={}}function _(X){return X=X.replace(x,function(v,C){var U=E();return d[U]={type:"inline",expression:C},U}),X}var F=o.listitem;o.listitem=function(X){return F(_(X))};var D=o.paragraph;o.paragraph=function(X){return D(_(X))};var j=o.tablecell;o.tablecell=function(X,v){return j(_(X),v)},o.code=function(X,v,C){var U=(v||"").match(/\S*/)[0];return U?["latex","katex","math"].indexOf(U)>=0?"<p class='editormd-tex'>".concat(X,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(v,'">').concat(C?X:Object(s.escape)(X,!0),`</code></pre>
`):'<pre class="prettyprint linenums"><code>'+(C?X:Object(s.escape)(X,!0))+"</code></pre>"},o.heading=function(X,v,C){var U=this.options.headerPrefix+C.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return l.push({anchor:U,level:v,text:X}),"<h"+v+' id="'+U+'">'+X+"</h"+v+">"},h.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),h.a.use({tokenizer:A,renderer:o});var H=h.a,k=le("SJMd"),y=le("ulZh"),G=le.n(y),Y=le("m3rI"),ie=le("Oy/b"),se=le("p5ED"),we=le("ErOA");/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var ve=function(X,v){return(ve=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(C,U){C.__proto__=U}||function(C,U){for(var q in U)Object.prototype.hasOwnProperty.call(U,q)&&(C[q]=U[q])})(X,v)};function Se(X,v){function C(){this.constructor=X}ve(X,v),X.prototype=v===null?Object.create(v):(C.prototype=v.prototype,new C)}function Ce(X,v,C,U){return new(C||(C=Promise))(function(q,V){function be(gt){try{qe(U.next(gt))}catch(Ge){V(Ge)}}function We(gt){try{qe(U.throw(gt))}catch(Ge){V(Ge)}}function qe(gt){var Ge;gt.done?q(gt.value):(Ge=gt.value,Ge instanceof C?Ge:new C(function(xt){xt(Ge)})).then(be,We)}qe((U=U.apply(X,v||[])).next())})}function pe(X,v){var C,U,q,V,be={label:0,sent:function(){if(1&q[0])throw q[1];return q[1]},trys:[],ops:[]};return V={next:We(0),throw:We(1),return:We(2)},typeof Symbol=="function"&&(V[Symbol.iterator]=function(){return this}),V;function We(qe){return function(gt){return function(Ge){if(C)throw new TypeError("Generator is already executing.");for(;be;)try{if(C=1,U&&(q=2&Ge[0]?U.return:Ge[0]?U.throw||((q=U.return)&&q.call(U),0):U.next)&&!(q=q.call(U,Ge[1])).done)return q;switch(U=0,q&&(Ge=[2&Ge[0],q.value]),Ge[0]){case 0:case 1:q=Ge;break;case 4:return be.label++,{value:Ge[1],done:!1};case 5:be.label++,U=Ge[1],Ge=[0];continue;case 7:Ge=be.ops.pop(),be.trys.pop();continue;default:if(!(q=be.trys,(q=q.length>0&&q[q.length-1])||Ge[0]!==6&&Ge[0]!==2)){be=0;continue}if(Ge[0]===3&&(!q||Ge[1]>q[0]&&Ge[1]<q[3])){be.label=Ge[1];break}if(Ge[0]===6&&be.label<q[1]){be.label=q[1],q=Ge;break}if(q&&be.label<q[2]){be.label=q[2],be.ops.push(Ge);break}q[2]&&be.ops.pop(),be.trys.pop();continue}Ge=v.call(X,be)}catch(xt){Ge=[6,xt],U=0}finally{C=q=0}if(5&Ge[0])throw Ge[1];return{value:Ge[0]?Ge[1]:void 0,done:!0}}([qe,gt])}}}function fe(){for(var X=0,v=0,C=arguments.length;v<C;v++)X+=arguments[v].length;var U=Array(X),q=0;for(v=0;v<C;v++)for(var V=arguments[v],be=0,We=V.length;be<We;be++,q++)U[q]=V[be];return U}var oe=function(){function X(){}return X.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},X.setAttributes=function(v,C){for(var U=0,q=C;U<q.length;U++){var V=q[U],be=V[0],We=V[1];v.setAttribute(be,We)}},X.createRect=function(v,C,U){var q=document.createElementNS("http://www.w3.org/2000/svg","rect");return q.setAttribute("width",v.toString()),q.setAttribute("height",C.toString()),U&&X.setAttributes(q,U),q},X.createLine=function(v,C,U,q,V){var be=document.createElementNS("http://www.w3.org/2000/svg","line");return be.setAttribute("x1",v.toString()),be.setAttribute("y1",C.toString()),be.setAttribute("x2",U.toString()),be.setAttribute("y2",q.toString()),V&&X.setAttributes(be,V),be},X.createPolygon=function(v,C){var U=document.createElementNS("http://www.w3.org/2000/svg","polygon");return U.setAttribute("points",v),C&&X.setAttributes(U,C),U},X.createCircle=function(v,C){var U=document.createElementNS("http://www.w3.org/2000/svg","circle");return U.setAttribute("cx",(v/2).toString()),U.setAttribute("cy",(v/2).toString()),U.setAttribute("r",v.toString()),C&&X.setAttributes(U,C),U},X.createEllipse=function(v,C,U){var q=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return q.setAttribute("cx",(v/2).toString()),q.setAttribute("cy",(C/2).toString()),q.setAttribute("rx",(v/2).toString()),q.setAttribute("ry",(C/2).toString()),U&&X.setAttributes(q,U),q},X.createGroup=function(v){var C=document.createElementNS("http://www.w3.org/2000/svg","g");return v&&X.setAttributes(C,v),C},X.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},X.createMarker=function(v,C,U,q,V,be,We){var qe=document.createElementNS("http://www.w3.org/2000/svg","marker");return X.setAttributes(qe,[["id",v],["orient",C],["markerWidth",U.toString()],["markerHeight",q.toString()],["refX",V.toString()],["refY",be.toString()]]),qe.appendChild(We),qe},X.createText=function(v){var C=document.createElementNS("http://www.w3.org/2000/svg","text");return C.setAttribute("x","0"),C.setAttribute("y","0"),v&&X.setAttributes(C,v),C},X.createTSpan=function(v,C){var U=document.createElementNS("http://www.w3.org/2000/svg","tspan");return U.textContent=v,C&&X.setAttributes(U,C),U},X.createImage=function(v){var C=document.createElementNS("http://www.w3.org/2000/svg","image");return v&&X.setAttributes(C,v),C},X.createPoint=function(v,C){var U=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return U.x=v,U.y=C,U},X.createPath=function(v,C){var U=document.createElementNS("http://www.w3.org/2000/svg","path");return U.setAttribute("d",v),C&&X.setAttributes(U,C),U},X}(),te=function(){function X(){}return X.addKey=function(v){X.key=v},Object.defineProperty(X,"isLicensed",{get:function(){return!!X.key&&new RegExp(/^MJS2-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(X.key)},enumerable:!1,configurable:!0}),X}(),he=function(){function X(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return X.prototype.rasterize=function(v,C,U){var q=this;return new Promise(function(V){var be=U!==void 0?U:document.createElement("canvas");v===null&&(q.markersOnly=!0,q.naturalSize=!1);var We=document.createElementNS("http://www.w3.org/2000/svg","svg");We.setAttribute("xmlns","http://www.w3.org/2000/svg"),We.setAttribute("width",C.width.baseVal.valueAsString),We.setAttribute("height",C.height.baseVal.valueAsString),We.setAttribute("viewBox","0 0 "+C.viewBox.baseVal.width.toString()+" "+C.viewBox.baseVal.height.toString()),We.innerHTML=C.innerHTML,q.naturalSize===!0?(We.width.baseVal.value=v.naturalWidth,We.height.baseVal.value=v.naturalHeight):q.width!==void 0&&q.height!==void 0&&(We.width.baseVal.value=q.width,We.height.baseVal.value=q.height),be.width=We.width.baseVal.value,be.height=We.height.baseVal.value;var qe=We.outerHTML,gt=be.getContext("2d");q.markersOnly!==!0&&gt.drawImage(v,0,0,be.width,be.height);var Ge=window.URL,xt=new Image(be.width,be.height);xt.setAttribute("crossOrigin","anonymous");var Wt=new Blob([qe],{type:"image/svg+xml"}),Qt=Ge.createObjectURL(Wt);xt.onload=function(){gt.drawImage(xt,0,0),Ge.revokeObjectURL(Qt);var Ni=be.toDataURL(q.imageType,q.imageQuality);V(Ni)},xt.src=Qt})},X}(),ae=function(){},Ae=function(){function X(v){this._classNamePrefixBase="__markerjs2_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+v+"_"}return Object.defineProperty(X.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(X.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(X.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"fade_out"},enumerable:!1,configurable:!0}),X.prototype.addClass=function(v){return this.styleSheet===void 0&&this.addStyleSheet(),v.name=""+this.classNamePrefix+v.localName,this.classes.push(v),this.styleSheet.sheet.insertRule("."+v.name+" {"+v.style+"}",this.styleSheet.sheet.cssRules.length),v},X.prototype.addRule=function(v){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(v),this.styleSheet.sheet.insertRule(v.selector+" {"+v.style+"}",this.styleSheet.sheet.cssRules.length)},X.prototype.addStyleSheet=function(){var v;this.styleSheet=document.createElement("style"),((v=this.styleSheetRoot)!==null&&v!==void 0?v:document.head).appendChild(this.styleSheet),this.addRule(new ke("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new ke("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
from {
opacity: 0;
}
to {
opacity: 1;
}
`)),this.addRule(new ke("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
from {
opacity: 1;
}
to {
opacity: 0;
}
`)),this.addClass(new Te("fade_in",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
`)),this.addClass(new Te("fade_out",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
`))},X.prototype.removeStyleSheet=function(){var v;this.styleSheet&&(((v=this.styleSheetRoot)!==null&&v!==void 0?v:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},X}(),ke=function(X,v){this.selector=X,this.style=v},Te=function(X,v){this.localName=X,this.style=v},Le=function(){function X(v,C,U,q,V){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=v,this.displayMode=C,this.markerItems=U,this.uiStyleSettings=q,this.styles=V,this.addStyles(),this.adjustLayout=this.adjustLayout.bind(this),this.overflowButtonClicked=this.overflowButtonClicked.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this)}return X.prototype.show=function(v){var C=this;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=v,this.uiContainer.className=this.toolbarStyleClass.name+" "+this.styles.fadeInAnimationClassName+" "+(this.uiStyleSettings.toolbarStyleColorsClassName?this.uiStyleSettings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name);var U=document.createElement("div");U.className=this.toolbarBlockStyleClass.name,U.style.whiteSpace="nowrap",this.uiContainer.appendChild(U),this.addActionButton(U,'<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(U,'<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(U,'<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(U,'<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(U,'<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(U,'<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(U,'<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(U,'<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(V){var be=document.createElement("div");be.className=""+C.toolbarButtonStyleClass.name,be.setAttribute("data-type-name",V.typeName),be.innerHTML=V.icon,be.addEventListener("click",function(){C.markerToolbarButtonClicked(be,V)}),C.buttons.push(be),C.markerButtons.push(be)}),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 q=document.createElement("div");q.className=this.toolbarBlockStyleClass.name,q.style.whiteSpace="nowrap",q.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(q),this.addActionButton(q,'<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(q,'<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()},X.prototype.addButtonClickListener=function(v){this.buttonClickListeners.push(v)},X.prototype.removeButtonClickListener=function(v){this.buttonClickListeners.indexOf(v)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(v),1)},X.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},X.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var v=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var C=0;C<this.markerButtons.length;C++)C<v||C===v&&this.markerButtons.length-1===v?this.markerButtonBlock.appendChild(this.markerButtons[C]):(C===v&&this.markerButtonBlock.appendChild(this.overflowButton),this.markerButtonOverflowBlock.appendChild(this.markerButtons[C]))}},X.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")},X.prototype.resetButtonStyles=function(){var v=this;this.buttons.forEach(function(C){C.className=C.className.replace(v.uiStyleSettings.toolbarButtonStyleColorsClassName?v.uiStyleSettings.toolbarButtonStyleColorsClassName:v.toolbarButtonStyleColorsClass.name,"").trim(),C.className=C.className.replace(v.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?v.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:v.toolbarActiveButtonStyleColorsClass.name,"").trim(),C.className+=" "+(v.uiStyleSettings.toolbarButtonStyleColorsClassName?v.uiStyleSettings.toolbarButtonStyleColorsClassName:v.toolbarButtonStyleColorsClass.name)})},X.prototype.addActionButton=function(v,C,U){var q=this,V=document.createElement("div");switch(V.className=""+this.toolbarButtonStyleClass.name,V.innerHTML=C,V.setAttribute("data-action",U),V.addEventListener("click",function(){q.actionToolbarButtonClicked(V,U)}),U){case"select":V.style.fill=this.uiStyleSettings.selectButtonColor;break;case"delete":case"clear":V.style.fill=this.uiStyleSettings.deleteButtonColor;break;case"undo":case"redo":V.style.fill=this.uiStyleSettings.selectButtonColor;break;case"render":V.style.fill=this.uiStyleSettings.okButtonColor;break;case"close":V.style.fill=this.uiStyleSettings.closeButtonColor}v.appendChild(V),this.buttons.push(V)},X.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new Te("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 Te("toolbar_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
box-shadow: 0px 3px rgba(33, 33, 33, 0.1);
`)),this.toolbarBlockStyleClass=this.styles.addClass(new Te("toolbar-block",`
display: inline-block;
box-sizing: content-box;
`)),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new Te("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 Te("toolbar-overflow-block_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`));var v=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new Te("toolbar_button",`
display: inline-block;
width: `+(this.uiStyleSettings.toolbarHeight-2*v)+`px;
height: `+(this.uiStyleSettings.toolbarHeight-2*v)+`px;
padding: `+v+`px;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new Te("toolbar_button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new Te("toolbar_active_button",`
fill: `+this.uiStyleSettings.toolbarColor+`;
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`)),this.styles.addRule(new ke("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`)),this.styles.addRule(new ke("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`))},X.prototype.markerToolbarButtonClicked=function(v,C){this.setActiveButton(v),this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(U){return U("marker",C)}),this.markerButtonOverflowBlock.style.display="none"},X.prototype.actionToolbarButtonClicked=function(v,C){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(U){return U("action",C)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},X.prototype.setActiveButton=function(v){this.resetButtonStyles(),v.className=v.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),v.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},X.prototype.setActiveMarkerButton=function(v){var C=this.markerButtons.find(function(U){return U.getAttribute("data-type-name")===v});C&&this.setActiveButton(C)},X.prototype.setCurrentMarker=function(v){var C=this;this.currentMarker=v,this.buttons.filter(function(U){return/delete|notes/.test(U.getAttribute("data-action"))}).forEach(function(U){C.currentMarker===void 0?(U.style.fillOpacity="0.4",U.style.pointerEvents="none"):(U.style.fillOpacity="1",U.style.pointerEvents="all")})},X}(),Pe=function(){function X(v,C,U,q){this.panels=[],this.panelButtons=[],this.markerjsContainer=v,this.displayMode=C,this.uiStyleSettings=U,this.styles=q,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return X.prototype.addStyles=function(){var v;this.toolboxStyleClass=this.styles.addClass(new Te("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 Te("toolbox_colors",`
color: `+this.uiStyleSettings.toolboxColor+`;
`));var C=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new Te("toolbox-button-row",`
display: flex;
cursor: default;
box-sizing: content-box;
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new Te("toolbox-button-row_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new Te("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 Te("toolbox-panel-row_colors",`
background-color: `+((v=this.uiStyleSettings.toolboxBackgroundColor)!==null&&v!==void 0?v:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
`)),this.toolboxButtonStyleClass=this.styles.addClass(new Te("toolbox_button",`
display: inline-block;
width: `+(this.uiStyleSettings.toolbarHeight-2*C)+`px;
height: `+(this.uiStyleSettings.toolbarHeight-2*C)+`px;
padding: `+C+`px;
box-sizing: content-box;
`)),this.toolboxButtonStyleColorsClass=this.styles.addClass(new Te("toolbox-button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new Te("toolbox-active-button_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`;
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.styles.addRule(new ke("."+this.toolboxButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`)),this.styles.addRule(new ke("."+this.toolboxButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`))},X.prototype.show=function(v){var C;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=v,this.uiContainer.className=this.toolboxStyleClass.name+" "+((C=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&C!==void 0?C:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},X.prototype.setPanelButtons=function(v){var C,U,q=this;this.panels=v,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((C=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&C!==void 0?C:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+((U=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&U!==void 0?U:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(V){var be;V.uiStyleSettings=q.uiStyleSettings;var We=document.createElement("div");We.className=q.toolboxButtonStyleClass.name+" "+((be=q.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&be!==void 0?be:q.toolboxButtonStyleColorsClass.name),We.innerHTML=V.icon,We.title=V.title,We.addEventListener("click",function(){q.panelButtonClick(V)}),q.panelButtons.push(We),q.buttonRow.appendChild(We)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},X.prototype.panelButtonClick=function(v){var C=this,U=-1;if(v!==this.activePanel){U=this.panels.indexOf(v),this.panelRow.innerHTML="";var q=v.getUi();q.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(q),this.panelRow.style.display="flex",this.panelRow.style.visibility="visible",this.panelRow.className=this.panelRow.className.replace(this.styles.fadeOutAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeInAnimationClassName,this.activePanel=v}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){C.displayMode==="inline"?C.panelRow.style.display="none":C.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(V,be){var We,qe;V.className=C.toolboxButtonStyleClass.name+" "+(be===U?""+((We=C.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&We!==void 0?We:C.toolboxActiveButtonStyleColorsClass.name):""+((qe=C.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&qe!==void 0?qe:C.toolboxButtonStyleColorsClass.name))})},X}(),He=function(X,v){this.title=X,this.icon=v},Fe=function(X){function v(C,U,q,V){var be=X.call(this,C,V||'<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 be.colors=[],be.addTransparent=!1,be.colorBoxes=[],be.colors=U,be.currentColor=q,be.setCurrentColor=be.setCurrentColor.bind(be),be.getColorBox=be.getColorBox.bind(be),be}return Se(v,X),v.prototype.getUi=function(){var C=this,U=document.createElement("div");return U.style.overflow="hidden",U.style.whiteSpace="nowrap",this.colors.forEach(function(q){var V=C.getColorBox(q);U.appendChild(V),C.colorBoxes.push(V)}),U},v.prototype.getColorBox=function(C){var U=this,q=this.uiStyleSettings.toolbarHeight/4,V=this.uiStyleSettings.toolbarHeight-q,be=document.createElement("div");be.style.display="inline-block",be.style.boxSizing="content-box",be.style.width=V-2+"px",be.style.height=V-2+"px",be.style.padding="1px",be.style.marginRight="2px",be.style.marginBottom="2px",be.style.borderWidth="2px",be.style.borderStyle="solid",be.style.borderRadius=(V+2)/2+"px",be.style.borderColor=C===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",be.addEventListener("click",function(){U.setCurrentColor(C,be)});var We=document.createElement("div");return We.style.display="inline-block",We.style.width=V-2+"px",We.style.height=V-2+"px",We.style.backgroundColor=C,We.style.borderRadius=V/2+"px",C==="transparent"&&(We.style.fill=this.uiStyleSettings.toolboxAccentColor,We.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>`),be.appendChild(We),be},v.prototype.setCurrentColor=function(C,U){var q=this;this.currentColor=C,this.colorBoxes.forEach(function(V){V.style.borderColor=V===U?q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(C)},v}(He),Ue=function(){function X(v,C,U){this._state="new",this._isSelected=!1,this._container=v,this._overlayContainer=C,this.globalSettings=U,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(X.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),X.prototype.ownsTarget=function(v){return!1},Object.defineProperty(X.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),X.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},X.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},X.prototype.pointerDown=function(v,C){},X.prototype.dblClick=function(v,C){},X.prototype.manipulate=function(v){},X.prototype.pointerUp=function(v){this.stateChanged()},X.prototype.dispose=function(){},X.prototype.addMarkerVisualToContainer=function(v){this.container.childNodes.length>0?this.container.insertBefore(v,this.container.childNodes[0]):this.container.appendChild(v)},X.prototype.getState=function(){return{typeName:X.typeName,state:this.state,notes:this.notes}},X.prototype.restoreState=function(v){this._state=v.state,this.notes=v.notes},X.prototype.scale=function(v,C){},X.prototype.colorChanged=function(v){this.onColorChanged&&this.onColorChanged(v),this.stateChanged()},X.prototype.fillColorChanged=function(v){this.onFillColorChanged&&this.onFillColorChanged(v),this.stateChanged()},X.prototype.stateChanged=function(){if(this.onStateChanged&&this.state!=="creating"&&this.state!=="new"){var v=this.getState();this.manipulationStartState!==void 0&&(this.manipulationStartState.state="select"),v.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(v)&&this.onStateChanged(this)}},X.typeName="MarkerBase",X}(),Ne=function(){function X(){this.findGripByVisual=this.findGripByVisual.bind(this)}return X.prototype.findGripByVisual=function(v){return this.topLeft.ownsTarget(v)?this.topLeft:this.topCenter.ownsTarget(v)?this.topCenter:this.topRight.ownsTarget(v)?this.topRight:this.centerLeft.ownsTarget(v)?this.centerLeft:this.centerRight.ownsTarget(v)?this.centerRight:this.bottomLeft.ownsTarget(v)?this.bottomLeft:this.bottomCenter.ownsTarget(v)?this.bottomCenter:this.bottomRight.ownsTarget(v)?this.bottomRight:void 0},X}(),Ze=function(){function X(){this.GRIP_SIZE=10,this.visual=oe.createGroup(),this.visual.appendChild(oe.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(oe.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return X.prototype.ownsTarget=function(v){return v===this.visual||v===this.visual.childNodes[0]||v===this.visual.childNodes[1]},X}(),st=function(){function X(){}return X.toITransformMatrix=function(v){return{a:v.a,b:v.b,c:v.c,d:v.d,e:v.e,f:v.f}},X.toSVGMatrix=function(v,C){return v.a=C.a,v.b=C.b,v.c=C.c,v.d=C.d,v.e=C.e,v.f=C.f,v},X}(),tt=function(X){function v(C,U,q){var V=X.call(this,C,U,q)||this;return V.left=0,V.top=0,V.width=0,V.height=0,V.defaultSize={x:50,y:20},V.offsetX=0,V.offsetY=0,V.rotationAngle=0,V.CB_DISTANCE=10,V._suppressMarkerCreateEvent=!1,V.container.transform.baseVal.appendItem(oe.createTransform()),V.setupControlBox(),V}return Se(v,X),Object.defineProperty(v.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"visual",{get:function(){return this._visual},set:function(C){this._visual=C;var U=oe.createTransform();this._visual.transform.baseVal.appendItem(U)},enumerable:!1,configurable:!0}),v.prototype.ownsTarget=function(C){return!!X.prototype.ownsTarget.call(this,C)||!!(this.controlGrips.findGripByVisual(C)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(C))},v.prototype.pointerDown=function(C,U){X.prototype.pointerDown.call(this,C,U),this.state==="new"&&(this.left=C.x,this.top=C.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var q=this.unrotatePoint(C);if(this.manipulationStartX=q.x,this.manipulationStartY=q.y,this.offsetX=q.x-this.left,this.offsetY=q.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(U),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(U)){this.activeGrip=this.rotatorGrip;var V=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=V.x-this.width/2,this.top=V.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var be=this.container.transform.baseVal.getItem(0);be.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(be,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},v.prototype.pointerUp=function(C){var U=this.state;X.prototype.pointerUp.call(this,C),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(C),this._state="select",U==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},v.prototype.moveVisual=function(C){this.visual.style.transform="translate("+C.x+"px, "+C.y+"px)"},v.prototype.manipulate=function(C){var U=this.unrotatePoint(C);this.state==="creating"?this.resize(C):this.state==="move"?(this.left=this.manipulationStartLeft+(U.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(U.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(U):this.state==="rotate"&&this.rotate(C)},v.prototype.resize=function(C){var U=this.manipulationStartLeft,q=this.manipulationStartWidth,V=this.manipulationStartTop,be=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:U=this.manipulationStartLeft+C.x-this.manipulationStartX,q=this.manipulationStartWidth+this.manipulationStartLeft-U;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:q=this.manipulationStartWidth+C.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:V=this.manipulationStartTop+C.y-this.manipulationStartY,be=this.manipulationStartHeight+this.manipulationStartTop-V;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:be=this.manipulationStartHeight+C.y-this.manipulationStartY}q>=0?(this.left=U,this.width=q):(this.left=U+q,this.width=-q),be>=0?(this.top=V,this.height=be):(this.top=V+be,this.height=-be),this.setSize()},v.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},v.prototype.rotate=function(C){if(Math.abs(C.x-this.centerX)>.1){var U=Math.sign(C.x-this.centerX);this.rotationAngle=180*Math.atan((C.y-this.centerY)/(C.x-this.centerX))/Math.PI+90*U,this.applyRotation()}},v.prototype.applyRotation=function(){var C=this.container.transform.baseVal.getItem(0);C.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(C,0)},v.prototype.rotatePoint=function(C){if(this.rotationAngle===0)return C;var U=this.container.getCTM(),q=oe.createPoint(C.x,C.y);return{x:(q=q.matrixTransform(U)).x,y:q.y}},v.prototype.unrotatePoint=function(C){if(this.rotationAngle===0)return C;var U=this.container.getCTM();U=U.inverse();var q=oe.createPoint(C.x,C.y);return{x:(q=q.matrixTransform(U)).x,y:q.y}},v.prototype.select=function(){X.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},v.prototype.deselect=function(){X.prototype.deselect.call(this),this.controlBox.style.display="none"},v.prototype.setupControlBox=function(){this.controlBox=oe.createGroup();var C=oe.createTransform();C.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(C),this.container.appendChild(this.controlBox),this.controlRect=oe.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=oe.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 Ne,this.addControlGrips(),this.controlBox.style.display="none"},v.prototype.adjustControlBox=function(){var C=this.controlBox.transform.baseVal.getItem(0);C.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(C,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()},v.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()},v.prototype.createGrip=function(){var C=new Ze;return C.visual.transform.baseVal.appendItem(oe.createTransform()),this.controlBox.appendChild(C.visual),C},v.prototype.positionGrips=function(){var C=this.controlGrips.topLeft.GRIP_SIZE,U=-C/2,q=U,V=(this.width+this.CB_DISTANCE)/2-C/2,be=(this.height+this.CB_DISTANCE)/2-C/2,We=this.height+this.CB_DISTANCE-C/2,qe=this.width+this.CB_DISTANCE-C/2;this.positionGrip(this.controlGrips.topLeft.visual,U,q),this.positionGrip(this.controlGrips.topCenter.visual,V,q),this.positionGrip(this.controlGrips.topRight.visual,qe,q),this.positionGrip(this.controlGrips.centerLeft.visual,U,be),this.positionGrip(this.controlGrips.centerRight.visual,qe,be),this.positionGrip(this.controlGrips.bottomLeft.visual,U,We),this.positionGrip(this.controlGrips.bottomCenter.visual,V,We),this.positionGrip(this.controlGrips.bottomRight.visual,qe,We),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,V,q-3*this.CB_DISTANCE)},v.prototype.positionGrip=function(C,U,q){var V=C.transform.baseVal.getItem(0);V.setTranslate(U,q),C.transform.baseVal.replaceItem(V,0)},v.prototype.hideControlBox=function(){this.controlBox.style.display="none"},v.prototype.showControlBox=function(){this.controlBox.style.display=""},v.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:st.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:st.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},X.prototype.getState.call(this))},v.prototype.restoreState=function(C){X.prototype.restoreState.call(this,C);var U=C;this.left=U.left,this.top=U.top,this.width=U.width,this.height=U.height,this.rotationAngle=U.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(st.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,U.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(st.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,U.containerTransformMatrix))},v.prototype.scale=function(C,U){X.prototype.scale.call(this,C,U);var q=this.rotatePoint({x:this.left,y:this.top}),V=this.unrotatePoint({x:q.x*C,y:q.y*U});this.left=V.x,this.top=V.y,this.width=this.width*C,this.height=this.height*U,this.adjustControlBox()},v}(Ue),et=function(X){function v(C,U,q){var V=X.call(this,C,U,q)||this;return V.fillColor="transparent",V.strokeColor="transparent",V.strokeWidth=0,V.strokeDasharray="",V.opacity=1,V.setStrokeColor=V.setStrokeColor.bind(V),V.setFillColor=V.setFillColor.bind(V),V.setStrokeWidth=V.setStrokeWidth.bind(V),V.setStrokeDasharray=V.setStrokeDasharray.bind(V),V.createVisual=V.createVisual.bind(V),V}return Se(v,X),v.prototype.ownsTarget=function(C){return!(!X.prototype.ownsTarget.call(this,C)&&C!==this.visual)},v.prototype.createVisual=function(){this.visual=oe.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)},v.prototype.pointerDown=function(C,U){X.prototype.pointerDown.call(this,C,U),this.state==="new"&&(this.createVisual(),this.moveVisual(C),this._state="creating")},v.prototype.manipulate=function(C){X.prototype.manipulate.call(this,C)},v.prototype.resize=function(C){X.prototype.resize.call(this,C),this.setSize()},v.prototype.setSize=function(){X.prototype.setSize.call(this),oe.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},v.prototype.pointerUp=function(C){X.prototype.pointerUp.call(this,C),this.setSize()},v.prototype.setStrokeColor=function(C){this.strokeColor=C,this.visual&&oe.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(C),this.stateChanged()},v.prototype.setFillColor=function(C){this.fillColor=C,this.visual&&oe.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},v.prototype.setStrokeWidth=function(C){this.strokeWidth=C,this.visual&&oe.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},v.prototype.setStrokeDasharray=function(C){this.strokeDasharray=C,this.visual&&oe.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},v.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},X.prototype.getState.call(this))},v.prototype.restoreState=function(C){var U=C;this.fillColor=U.fillColor,this.strokeColor=U.strokeColor,this.strokeWidth=U.strokeWidth,this.strokeDasharray=U.strokeDasharray,this.opacity=U.opacity,this.createVisual(),X.prototype.restoreState.call(this,C),this.setSize()},v.prototype.scale=function(C,U){X.prototype.scale.call(this,C,U),this.setSize()},v.title="Rectangle marker",v}(tt),ut=function(X){function v(C,U,q,V){var be=X.call(this,C,V||'<svg viewBox="0 0 24 24"><path d="M3 17h18v-2H3v2m0 3h18v-1H3v1m0-7h18v-3H3v3m0-9v4h18V4H3z"/></svg>')||this;return be.widths=[],be.widthBoxes=[],be.widths=U,be.currentWidth=q,be.setCurrentWidth=be.setCurrentWidth.bind(be),be}return Se(v,X),v.prototype.getUi=function(){var C=this,U=document.createElement("div");return U.style.display="flex",U.style.overflow="hidden",U.style.flexGrow="2",this.widths.forEach(function(q){var V=document.createElement("div");V.style.display="flex",V.style.flexGrow="2",V.style.alignItems="center",V.style.justifyContent="space-between",V.style.padding="5px",V.style.borderWidth="2px",V.style.borderStyle="solid",V.style.borderColor=q===C.currentWidth?C.uiStyleSettings.toolboxAccentColor:"transparent",V.addEventListener("click",function(){C.setCurrentWidth(q,V)}),U.appendChild(V);var be=document.createElement("div");be.innerText=q.toString(),be.style.marginRight="5px",V.appendChild(be);var We=document.createElement("div");We.style.minHeight="20px",We.style.flexGrow="2",We.style.display="flex",We.style.alignItems="center";var qe=document.createElement("hr");qe.style.minWidth="20px",qe.style.border="0px",qe.style.borderTop=q+"px solid "+C.uiStyleSettings.toolboxColor,qe.style.flexGrow="2",We.appendChild(qe),V.appendChild(We),C.widthBoxes.push(V)}),U},v.prototype.setCurrentWidth=function(C,U){var q=this;this.currentWidth=C,this.widthBoxes.forEach(function(V){V.style.borderColor=V===U?q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},v}(He),Ye=function(X){function v(C,U,q,V){var be=X.call(this,C,V||'<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 be.styles=[],be.styleBoxes=[],be.styles=U,be.currentStyle=q,be.setCurrentStyle=be.setCurrentStyle.bind(be),be}return Se(v,X),v.prototype.getUi=function(){var C=this,U=document.createElement("div");return U.style.display="flex",U.style.overflow="hidden",U.style.flexGrow="2",this.styles.forEach(function(q){var V=document.createElement("div");V.style.display="flex",V.style.alignItems="center",V.style.justifyContent="space-between",V.style.padding="5px",V.style.borderWidth="2px",V.style.borderStyle="solid",V.style.overflow="hidden",V.style.maxWidth=100/C.styles.length-5+"%",V.style.borderColor=q===C.currentStyle?C.uiStyleSettings.toolboxAccentColor:"transparent",V.addEventListener("click",function(){C.setCurrentStyle(q,V)}),U.appendChild(V);var be=document.createElement("div");be.style.minHeight="20px",be.style.flexGrow="2",be.style.overflow="hidden";var We=`<svg width="100" height="20">
<line x1="0" y1="10" x2="100" y2="10" stroke="`+C.uiStyleSettings.toolboxColor+'" stroke-width="3" '+(q!==""?'stroke-dasharray="'+q+'"':"")+` />
</svg>`;be.innerHTML=We,V.appendChild(be),C.styleBoxes.push(V)}),U},v.prototype.setCurrentStyle=function(C,U){var q=this;this.currentStyle=C,this.styleBoxes.forEach(function(V){V.style.borderColor=V===U?q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},v}(He),Xe=function(X){function v(C,U,q){var V=X.call(this,C,U,q)||this;return V.strokeColor=q.defaultColor,V.strokeWidth=q.defaultStrokeWidth,V.strokeDasharray=q.defaultStrokeDasharray,V.strokePanel=new Fe("Line color",q.defaultColorSet,q.defaultColor),V.strokePanel.onColorChanged=V.setStrokeColor,V.strokeWidthPanel=new ut("Line width",q.defaultStrokeWidths,q.defaultStrokeWidth),V.strokeWidthPanel.onWidthChanged=V.setStrokeWidth,V.strokeStylePanel=new Ye("Line style",q.defaultStrokeDasharrays,q.defaultStrokeDasharray),V.strokeStylePanel.onStyleChanged=V.setStrokeDasharray,V}return Se(v,X),Object.defineProperty(v.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),v.prototype.getState=function(){var C=X.prototype.getState.call(this);return C.typeName=v.typeName,C},v.typeName="FrameMarker",v.title="Frame marker",v.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>',v}(et),Ie=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},lt=function(X){function v(C,U,q){var V=X.call(this,C,U,q)||this;return V.x1=0,V.y1=0,V.x2=0,V.y2=0,V.defaultLength=50,V.manipulationStartX=0,V.manipulationStartY=0,V.manipulationStartX1=0,V.manipulationStartY1=0,V.manipulationStartX2=0,V.manipulationStartY2=0,V.setupControlBox(),V}return Se(v,X),v.prototype.ownsTarget=function(C){return!!X.prototype.ownsTarget.call(this,C)||!(!this.grip1.ownsTarget(C)&&!this.grip2.ownsTarget(C))},v.prototype.pointerDown=function(C,U){X.prototype.pointerDown.call(this,C,U),this.manipulationStartX=C.x,this.manipulationStartY=C.y,this.state==="new"&&(this.x1=C.x,this.y1=C.y,this.x2=C.x,this.y2=C.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(U)?this.activeGrip=this.grip1:this.grip2.ownsTarget(U)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},v.prototype.pointerUp=function(C){var U=this.state;X.prototype.pointerUp.call(this,C),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(C),this._state="select",U==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},v.prototype.adjustVisual=function(){},v.prototype.manipulate=function(C){this.state==="creating"?this.resize(C):this.state==="move"?(this.x1=this.manipulationStartX1+C.x-this.manipulationStartX,this.y1=this.manipulationStartY1+C.y-this.manipulationStartY,this.x2=this.manipulationStartX2+C.x-this.manipulationStartX,this.y2=this.manipulationStartY2+C.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(C)},v.prototype.resize=function(C){switch(this.activeGrip){case this.grip1:this.x1=C.x,this.y1=C.y;break;case this.grip2:case void 0:this.x2=C.x,this.y2=C.y}this.adjustVisual(),this.adjustControlBox()},v.prototype.select=function(){X.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},v.prototype.deselect=function(){X.prototype.deselect.call(this),this.controlBox.style.display="none"},v.prototype.setupControlBox=function(){this.controlBox=oe.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},v.prototype.adjustControlBox=function(){this.positionGrips()},v.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},v.prototype.createGrip=function(){var C=new Ze;return C.visual.transform.baseVal.appendItem(oe.createTransform()),this.controlBox.appendChild(C.visual),C},v.prototype.positionGrips=function(){var C=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-C/2,this.y1-C/2),this.positionGrip(this.grip2.visual,this.x2-C/2,this.y2-C/2)},v.prototype.positionGrip=function(C,U,q){var V=C.transform.baseVal.getItem(0);V.setTranslate(U,q),C.transform.baseVal.replaceItem(V,0)},v.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},X.prototype.getState.call(this))},v.prototype.restoreState=function(C){X.prototype.restoreState.call(this,C);var U=C;this.x1=U.x1,this.y1=U.y1,this.x2=U.x2,this.y2=U.y2},v.prototype.scale=function(C,U){X.prototype.scale.call(this,C,U),this.x1=this.x1*C,this.y1=this.y1*U,this.x2=this.x2*C,this.y2=this.y2*U,this.adjustVisual(),this.adjustControlBox()},v}(Ue),nt=function(X){function v(C,U,q){var V=X.call(this,C,U,q)||this;return V.strokeColor="transparent",V.strokeWidth=0,V.strokeDasharray="",V.setStrokeColor=V.setStrokeColor.bind(V),V.setStrokeWidth=V.setStrokeWidth.bind(V),V.setStrokeDasharray=V.setStrokeDasharray.bind(V),V.strokeColor=q.defaultColor,V.strokeWidth=q.defaultStrokeWidth,V.strokeDasharray=q.defaultStrokeDasharray,V.strokePanel=new Fe("Line color",q.defaultColorSet,q.defaultColor),V.strokePanel.onColorChanged=V.setStrokeColor,V.strokeWidthPanel=new ut("Line width",q.defaultStrokeWidths,q.defaultStrokeWidth),V.strokeWidthPanel.onWidthChanged=V.setStrokeWidth,V.strokeStylePanel=new Ye("Line style",q.defaultStrokeDasharrays,q.defaultStrokeDasharray),V.strokeStylePanel.onStyleChanged=V.setStrokeDasharray,V}return Se(v,X),v.prototype.ownsTarget=function(C){return!(!X.prototype.ownsTarget.call(this,C)&&C!==this.visual&&C!==this.selectorLine&&C!==this.visibleLine)},v.prototype.createVisual=function(){this.visual=oe.createGroup(),this.selectorLine=oe.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=oe.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)},v.prototype.pointerDown=function(C,U){X.prototype.pointerDown.call(this,C,U),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},v.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()),oe.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),oe.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),oe.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},v.prototype.setStrokeColor=function(C){this.strokeColor=C,this.adjustVisual(),this.colorChanged(C)},v.prototype.setStrokeWidth=function(C){this.strokeWidth=C,this.adjustVisual()},v.prototype.setStrokeDasharray=function(C){this.strokeDasharray=C,this.adjustVisual(),this.stateChanged()},Object.defineProperty(v.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),v.prototype.getState=function(){var C=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},X.prototype.getState.call(this));return C.typeName=v.typeName,C},v.prototype.restoreState=function(C){X.prototype.restoreState.call(this,C);var U=C;this.strokeColor=U.strokeColor,this.strokeWidth=U.strokeWidth,this.strokeDasharray=U.strokeDasharray,this.createVisual(),this.adjustVisual()},v.typeName="LineMarker",v.title="Line marker",v.icon='<svg viewBox="0 0 24 24"><path d="M19 13H5v-2h14v2z"/></svg>',v}(lt),De=function(X){function v(C,U,q,V){var be=X.call(this,C,V||'<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 be.fonts=[],be.fontBoxes=[],be.fonts=U,be.currentFont=q,be.setCurrentFont=be.setCurrentFont.bind(be),be}return Se(v,X),v.prototype.getUi=function(){var C=this,U=document.createElement("div");return U.style.overflow="hidden",U.style.flexGrow="2",this.fonts.forEach(function(q){var V=document.createElement("div");V.style.display="inline-block",V.style.alignItems="center",V.style.justifyContent="space-between",V.style.padding="5px",V.style.borderWidth="2px",V.style.borderStyle="solid",V.style.overflow="hidden",V.style.maxWidth=100/C.fonts.length-5+"%",V.style.borderColor=q===C.currentFont?C.uiStyleSettings.toolboxAccentColor:"transparent",V.addEventListener("click",function(){C.setCurrentFont(q,V)}),U.appendChild(V);var be=document.createElement("div");be.style.display="flex",be.style.minHeight="20px",be.style.flexGrow="2",be.style.fontFamily=q,be.style.overflow="hidden";var We=document.createElement("div");We.style.whiteSpace="nowrap",We.style.overflow="hidden",We.style.textOverflow="ellipsis",We.innerHTML="The quick brown fox jumps over the lazy dog",be.appendChild(We),V.appendChild(be),C.fontBoxes.push(V)}),U},v.prototype.setCurrentFont=function(C,U){var q=this;this.currentFont=C,this.fontBoxes.forEach(function(V){V.style.borderColor=V===U?q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},v}(He),ze=function(X){function v(C,U,q){var V=X.call(this,C,U,q)||this;return V.color="transparent",V.padding=5,V.DEFAULT_TEXT="your text here",V.text=V.DEFAULT_TEXT,V.isMoved=!1,V.color=q.defaultColor,V.fontFamily=q.defaultFontFamily,V.defaultSize={x:100,y:30},V.setColor=V.setColor.bind(V),V.setFont=V.setFont.bind(V),V.renderText=V.renderText.bind(V),V.sizeText=V.sizeText.bind(V),V.textEditDivClicked=V.textEditDivClicked.bind(V),V.showTextEditor=V.showTextEditor.bind(V),V.setSize=V.setSize.bind(V),V.positionTextEditor=V.positionTextEditor.bind(V),V.colorPanel=new Fe("Color",q.defaultColorSet,q.defaultColor),V.colorPanel.onColorChanged=V.setColor,V.fontFamilyPanel=new De("Font",q.defaultFontFamilies,q.defaultFontFamily),V.fontFamilyPanel.onFontChanged=V.setFont,V}return Se(v,X),v.prototype.ownsTarget=function(C){if(X.prototype.ownsTarget.call(this,C)||C===this.visual||C===this.textElement||C===this.bgRectangle)return!0;var U=!1;return this.textElement.childNodes.forEach(function(q){q===C&&(U=!0)}),U},v.prototype.createVisual=function(){this.visual=oe.createGroup(),this.bgRectangle=oe.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=oe.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(oe.createTransform()),this.textElement.transform.baseVal.appendItem(oe.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},v.prototype.pointerDown=function(C,U){X.prototype.pointerDown.call(this,C,U),this.isMoved=!1,this.pointerDownPoint=C,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(C),this._state="creating")},v.prototype.renderText=function(){var C=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(U){C.textElement.appendChild(oe.createTSpan(U.trim()===""?" ":U.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},v.prototype.getTextScale=function(){var C=this.textElement.getBBox(),U=1;if(C.width>0&&C.height>0){var q=(1*this.width-this.width*this.padding*2/100)/C.width,V=(1*this.height-this.height*this.padding*2/100)/C.height;U=Math.min(q,V)}return U},v.prototype.getTextPosition=function(C){var U=this.textElement.getBBox(),q=0,V=0;return U.width>0&&U.height>0&&(q=(this.width-U.width*C)/2,V=this.height/2-U.height*C/2),{x:q,y:V}},v.prototype.sizeText=function(){var C=this.textElement.getBBox(),U=this.getTextScale(),q=this.getTextPosition(U);q.y-=C.y*U,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+q.x+"px, "+q.y+"px) scale("+U+", "+U+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(q.x,q.y),this.textElement.transform.baseVal.getItem(1).setScale(U,U))},v.prototype.manipulate=function(C){X.prototype.manipulate.call(this,C),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(C.x-this.pointerDownPoint.x)>5||Math.abs(C.y-this.pointerDownPoint.y)>5)},v.prototype.resize=function(C){X.prototype.resize.call(this,C),this.isMoved=!0,this.setSize(),this.sizeText()},v.prototype.setSize=function(){X.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(oe.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),oe.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},v.prototype.pointerUp=function(C){var U=this.state;U==="creating"&&(this._suppressMarkerCreateEvent=!0),X.prototype.pointerUp.call(this,C),this.setSize(),(U==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},v.prototype.showTextEditor=function(){var C=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(U){U.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var U=Number.parseFloat(C.textEditor.style.fontSize);C.textEditor.clientWidth>=Number.parseInt(C.textEditor.style.maxWidth)&&U>.9;)U-=.1,C.textEditor.style.fontSize=Math.max(U,.9)+"em"}),this.textEditor.addEventListener("keyup",function(U){U.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(U){if(U.clipboardData){var q=U.clipboardData.getData("text"),V=window.getSelection();if(!V.rangeCount)return!1;V.deleteFromDocument(),V.getRangeAt(0).insertNode(document.createTextNode(q)),U.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){C.textEditDivClicked(C.textEditor.innerText)}),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},v.prototype.positionTextEditor=function(){if(this.state==="edit")if(this.textEditor===void 0)this.showTextEditor();else{this.textElement.style.display="";var C=this.getTextScale(),U=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),q=this.textElement.getBBox(),V={x:q.width*C,y:q.height*C};U.x-=V.x/2,U.y-=V.y/2,this.textEditor.style.top=U.y+"px",this.textEditor.style.left=U.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-U.x+"px",this.textEditor.style.fontSize=Math.max(16*C,12)+"px",this.textElement.style.display="none"}},v.prototype.textEditDivClicked=function(C){this.text=C.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},v.prototype.select=function(){X.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},v.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),X.prototype.deselect.call(this)},v.prototype.dblClick=function(C,U){X.prototype.dblClick.call(this,C,U),this.showTextEditor()},v.prototype.setColor=function(C){this.textElement&&oe.setAttributes(this.textElement,[["fill",C]]),this.color=C,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(C)},v.prototype.setFont=function(C){this.textElement&&oe.setAttributes(this.textElement,[["font-family",C]]),this.fontFamily=C,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},v.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},v.prototype.showVisual=function(){this.state==="edit"&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(v.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),v.prototype.getState=function(){var C=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},X.prototype.getState.call(this));return C.typeName=v.typeName,C},v.prototype.restoreState=function(C){var U=C;this.color=U.color,this.fontFamily=U.fontFamily,this.padding=U.padding,this.text=U.text,this.createVisual(),X.prototype.restoreState.call(this,C),this.setSize()},v.prototype.scale=function(C,U){X.prototype.scale.call(this,C,U),this.setSize(),this.sizeText(),this.positionTextEditor()},v.typeName="TextMarker",v.title="Text marker",v.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>',v}(tt),xe=function(X){function v(C,U,q){var V=X.call(this,C,U,q)||this;return V.color="transparent",V.lineWidth=3,V.drawing=!1,V.pixelRatio=1,V.color=q.defaultColor,V.lineWidth=q.defaultStrokeWidth,V.pixelRatio=q.freehandPixelRatio,V.setColor=V.setColor.bind(V),V.addCanvas=V.addCanvas.bind(V),V.finishCreation=V.finishCreation.bind(V),V.setLineWidth=V.setLineWidth.bind(V),V.colorPanel=new Fe("Color",q.defaultColorSet,q.defaultColor),V.colorPanel.onColorChanged=V.setColor,V.lineWidthPanel=new ut("Line width",q.defaultStrokeWidths,q.defaultStrokeWidth),V.lineWidthPanel.onWidthChanged=V.setLineWidth,V}return Se(v,X),v.prototype.ownsTarget=function(C){return!(!X.prototype.ownsTarget.call(this,C)&&C!==this.visual&&C!==this.drawingImage)},v.prototype.createVisual=function(){this.visual=oe.createGroup(),this.drawingImage=oe.createImage(),this.visual.appendChild(this.drawingImage);var C=oe.createTransform();this.visual.transform.baseVal.appendItem(C),this.addMarkerVisualToContainer(this.visual)},v.prototype.pointerDown=function(C,U){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(C.x,C.y),this.drawing=!0):X.prototype.pointerDown.call(this,C,U)},v.prototype.manipulate=function(C){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(C.x,C.y),this.canvasContext.stroke()):X.prototype.manipulate.call(this,C)},v.prototype.resize=function(C){X.prototype.resize.call(this,C),oe.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),oe.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},v.prototype.pointerUp=function(C){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):X.prototype.pointerUp.call(this,C)},v.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)},v.prototype.select=function(){this.state==="creating"&&this.finishCreation(),X.prototype.select.call(this)},v.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),X.prototype.deselect.call(this)},v.prototype.finishCreation=function(){for(var C=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),U=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],q=U[0],V=U[1],be=U[2],We=U[3],qe=!1,gt=0;gt<this.canvasElement.height;gt++)for(var Ge=0;Ge<this.canvasElement.width;Ge++)C.data[gt*this.canvasElement.width*4+4*Ge+3]>0&&(qe=!0,gt<V&&(V=gt),Ge<q&&(q=Ge),gt>We&&(We=gt),Ge>be&&(be=Ge));if(qe){this.left=q/this.pixelRatio,this.top=V/this.pixelRatio,this.width=(be-q)/this.pixelRatio,this.height=(We-V)/this.pixelRatio;var xt=document.createElement("canvas");xt.width=be-q,xt.height=We-V,xt.getContext("2d").putImageData(this.canvasContext.getImageData(q,V,be-q,We-V),0,0),this.drawingImgUrl=xt.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},v.prototype.setDrawingImage=function(){oe.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),oe.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},v.prototype.setColor=function(C){this.color=C,this.colorChanged(C)},v.prototype.setLineWidth=function(C){this.lineWidth=C},Object.defineProperty(v.prototype,"toolboxPanels",{get:function(){return this.state==="new"||this.state==="creating"?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),v.prototype.getState=function(){var C=Object.assign({drawingImgUrl:this.drawingImgUrl},X.prototype.getState.call(this));return C.typeName=v.typeName,C},v.prototype.restoreState=function(C){this.createVisual(),X.prototype.restoreState.call(this,C),this.drawingImgUrl=C.drawingImgUrl,this.setDrawingImage()},v.prototype.scale=function(C,U){X.prototype.scale.call(this,C,U),this.setDrawingImage()},v.typeName="FreehandMarker",v.title="Freehand marker",v.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>',v}(tt),ye=function(X){function v(C,U,q){var V=X.call(this,C,q||'<svg viewBox="0 0 24 24"><path d="M8 14v4l-6-6 6-6v4h8V6l6 6-6 6v-4H8z"/></svg>')||this;return V.typeBoxes=[],V.currentType=U,V.setCurrentType=V.setCurrentType.bind(V),V}return Se(v,X),v.prototype.getUi=function(){var C=this,U=document.createElement("div");U.style.display="flex",U.style.overflow="hidden",U.style.flexGrow="2";for(var q=function(We){var qe="both";switch(We){case 0:qe="both";break;case 1:qe="start";break;case 2:qe="end";break;case 3:qe="none"}var gt=document.createElement("div");if(gt.style.display="flex",gt.style.flexGrow="2",gt.style.alignItems="center",gt.style.justifyContent="space-between",gt.style.padding="5px",gt.style.borderWidth="2px",gt.style.borderStyle="solid",gt.style.borderColor=qe===V.currentType?V.uiStyleSettings.toolboxAccentColor:"transparent",gt.addEventListener("click",function(){C.setCurrentType(qe,gt)}),U.appendChild(gt),qe==="both"||qe==="start"){var Ge=document.createElement("div");Ge.style.display="flex",Ge.style.alignItems="center",Ge.style.minHeight="20px",Ge.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="`+(V.uiStyleSettings!==void 0?V.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
</svg>`,Ge.style.marginLeft="5px",gt.appendChild(Ge)}var xt=document.createElement("div");xt.style.display="flex",xt.style.alignItems="center",xt.style.minHeight="20px",xt.style.flexGrow="2";var Wt=document.createElement("hr");if(Wt.style.minWidth="20px",Wt.style.border="0px",Wt.style.borderTop="3px solid "+(V.uiStyleSettings!==void 0?V.uiStyleSettings.toolboxColor:"#eeeeee"),Wt.style.flexGrow="2",xt.appendChild(Wt),gt.appendChild(xt),qe==="both"||qe==="end"){var Qt=document.createElement("div");Qt.style.display="flex",Qt.style.alignItems="center",Qt.style.minHeight="20px",Qt.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="`+(V.uiStyleSettings!==void 0?V.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
</svg>`,Qt.style.marginRight="5px",gt.appendChild(Qt)}V.typeBoxes.push(gt)},V=this,be=0;be<4;be++)q(be);return U},v.prototype.setCurrentType=function(C,U){var q=this;this.currentType=C,this.typeBoxes.forEach(function(V){V.style.borderColor=V===U?q.uiStyleSettings!==void 0?q.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},v}(He),_e=function(X){function v(C,U,q){var V=X.call(this,C,U,q)||this;return V.arrowType="end",V.arrowBaseHeight=10,V.arrowBaseWidth=10,V.getArrowPoints=V.getArrowPoints.bind(V),V.setArrowType=V.setArrowType.bind(V),V.arrowTypePanel=new ye("Arrow type","end"),V.arrowTypePanel.onArrowTypeChanged=V.setArrowType,V}return Se(v,X),v.prototype.ownsTarget=function(C){return!(!X.prototype.ownsTarget.call(this,C)&&C!==this.arrow1&&C!==this.arrow2)},v.prototype.getArrowPoints=function(C,U){var q=this.arrowBaseWidth+2*this.strokeWidth,V=this.arrowBaseHeight+2*this.strokeWidth;return C-q/2+","+(U+V/2)+" "+C+","+(U-V/2)+" "+(C+q/2)+","+(U+V/2)},v.prototype.createTips=function(){this.arrow1=oe.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(oe.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=oe.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(oe.createTransform()),this.visual.appendChild(this.arrow2)},v.prototype.pointerDown=function(C,U){X.prototype.pointerDown.call(this,C,U),this.state==="creating"&&this.createTips()},v.prototype.adjustVisual=function(){if(X.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",oe.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),oe.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]),Math.abs(this.x1-this.x2)>.1)){var C=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),U=this.arrow1.transform.baseVal.getItem(0);U.setRotate(C,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(U,0);var q=this.arrow2.transform.baseVal.getItem(0);q.setRotate(C+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(q,0)}},v.prototype.setArrowType=function(C){this.arrowType=C,this.adjustVisual(),this.stateChanged()},Object.defineProperty(v.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),v.prototype.getState=function(){var C=Object.assign({arrowType:this.arrowType},X.prototype.getState.call(this));return C.typeName=v.typeName,C},v.prototype.restoreState=function(C){X.prototype.restoreState.call(this,C);var U=C;this.arrowType=U.arrowType,this.createTips(),this.adjustVisual()},v.typeName="ArrowMarker",v.title="Arrow marker",v.icon='<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 7 15.59V9H5v10h10v-2H8.41L19 6.41z"/></svg>',v}(nt),ne=function(X){function v(C,U,q){var V=X.call(this,C,U,q)||this;return V.fillColor=q.defaultFillColor,V.strokeWidth=0,V.fillPanel=new Fe("Color",q.defaultColorSet,q.defaultFillColor),V.fillPanel.onColorChanged=V.setFillColor,V}return Se(v,X),Object.defineProperty(v.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),v.prototype.getState=function(){var C=X.prototype.getState.call(this);return C.typeName=v.typeName,C},v.typeName="CoverMarker",v.title="Cover marker",v.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>',v}(et),re=function(X){function v(C,U,q,V){var be=X.call(this,C,V||'<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 be.opacities=[],be.opacityBoxes=[],be.opacities=U,be.currentOpacity=q,be.setCurrentOpacity=be.setCurrentOpacity.bind(be),be}return Se(v,X),v.prototype.getUi=function(){var C=this,U=document.createElement("div");return U.style.display="flex",U.style.overflow="hidden",U.style.flexGrow="2",U.style.justifyContent="space-between",this.opacities.forEach(function(q){var V=document.createElement("div");V.style.display="flex",V.style.alignItems="center",V.style.justifyContent="center",V.style.padding="5px",V.style.borderWidth="2px",V.style.borderStyle="solid",V.style.borderColor=q===C.currentOpacity?C.uiStyleSettings.toolboxAccentColor:"transparent",V.addEventListener("click",function(){C.setCurrentOpacity(q,V)}),U.appendChild(V);var be=document.createElement("div");be.innerText=100*q+"%",V.appendChild(be),C.opacityBoxes.push(V)}),U},v.prototype.setCurrentOpacity=function(C,U){var q=this;this.currentOpacity=C,this.opacityBoxes.forEach(function(V){V.style.borderColor=V===U?q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},v}(He),de=function(X){function v(C,U,q){var V=X.call(this,C,U,q)||this;return V.setOpacity=V.setOpacity.bind(V),V.fillColor=q.defaultHighlightColor,V.strokeWidth=0,V.opacity=q.defaultHighlightOpacity,V.fillPanel=new Fe("Color",q.defaultColorSet,V.fillColor),V.fillPanel.onColorChanged=V.setFillColor,V.opacityPanel=new re("Opacity",q.defaultOpacitySteps,V.opacity),V.opacityPanel.onOpacityChanged=V.setOpacity,V}return Se(v,X),v.prototype.setOpacity=function(C){this.opacity=C,this.visual&&oe.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(v.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),v.prototype.getState=function(){var C=X.prototype.getState.call(this);return C.typeName=v.typeName,C},v.typeName="HighlightMarker",v.title="Highlight marker",v.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>',v}(ne),me='<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>',Ee=function(X){function v(C,U,q){var V=X.call(this,C,U,q)||this;return V.bgColor="transparent",V.tipPosition={x:0,y:0},V.tipBase1Position={x:0,y:0},V.tipBase2Position={x:0,y:0},V.tipMoving=!1,V.color=q.defaultStrokeColor,V.bgColor=q.defaultFillColor,V.fontFamily=q.defaultFontFamily,V.defaultSize={x:100,y:30},V.setBgColor=V.setBgColor.bind(V),V.getTipPoints=V.getTipPoints.bind(V),V.positionTip=V.positionTip.bind(V),V.setTipPoints=V.setTipPoints.bind(V),V.colorPanel=new Fe("Text color",q.defaultColorSet,V.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>'),V.colorPanel.onColorChanged=V.setColor,V.bgColorPanel=new Fe("Fill color",q.defaultColorSet,V.bgColor,me),V.bgColorPanel.onColorChanged=V.setBgColor,V.fontFamilyPanel=new De("Font",q.defaultFontFamilies,q.defaultFontFamily),V.fontFamilyPanel.onFontChanged=V.setFont,V.tipGrip=new Ze,V.tipGrip.visual.transform.baseVal.appendItem(oe.createTransform()),V.controlBox.appendChild(V.tipGrip.visual),V}return Se(v,X),v.prototype.ownsTarget=function(C){return X.prototype.ownsTarget.call(this,C)||this.tipGrip.ownsTarget(C)||this.tip===C},v.prototype.createTip=function(){oe.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=oe.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},v.prototype.pointerDown=function(C,U){this.state==="new"&&X.prototype.pointerDown.call(this,C,U),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(U)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):X.prototype.pointerDown.call(this,C,U)},v.prototype.pointerUp=function(C){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,X.prototype.pointerUp.call(this,C);else{var U=this.state==="creating";X.prototype.pointerUp.call(this,C),this.setTipPoints(U),this.positionTip()}},v.prototype.manipulate=function(C){if(this.tipMoving){var U=this.unrotatePoint(C);this.tipPosition={x:U.x-this.manipulationStartLeft,y:U.y-this.manipulationStartTop},this.positionTip()}else X.prototype.manipulate.call(this,C)},v.prototype.setBgColor=function(C){this.bgRectangle&&this.tip&&(oe.setAttributes(this.bgRectangle,[["fill",C]]),oe.setAttributes(this.tip,[["fill",C]])),this.bgColor=C,this.fillColorChanged(C)},v.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},v.prototype.setTipPoints=function(C){C===void 0&&(C=!1);var U=Math.min(this.height/2,15),q=this.height/5;C&&(this.tipPosition={x:U+q/2,y:this.height+20});var V=Math.atan(this.height/2/(this.width/2));this.tipPosition.x<this.width/2&&this.tipPosition.y<this.height/2?V<Math.atan((this.height/2-this.tipPosition.y)/(this.width/2-this.tipPosition.x))?(q=this.width/5,U=Math.min(this.width/2,15),this.tipBase1Position={x:U,y:0},this.tipBase2Position={x:U+q,y:0}):(this.tipBase1Position={x:0,y:U},this.tipBase2Position={x:0,y:U+q}):this.tipPosition.x>=this.width/2&&this.tipPosition.y<this.height/2?V<Math.atan((this.height/2-this.tipPosition.y)/(this.tipPosition.x-this.width/2))?(q=this.width/5,U=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-U-q,y:0},this.tipBase2Position={x:this.width-U,y:0}):(this.tipBase1Position={x:this.width,y:U},this.tipBase2Position={x:this.width,y:U+q}):this.tipPosition.x>=this.width/2&&this.tipPosition.y>=this.height/2?V<Math.atan((this.tipPosition.y-this.height/2)/(this.tipPosition.x-this.width/2))?(q=this.width/5,U=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-U-q,y:this.height},this.tipBase2Position={x:this.width-U,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-U-q},this.tipBase2Position={x:this.width,y:this.height-U}):V<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?(q=this.width/5,U=Math.min(this.width/2,15),this.tipBase1Position={x:U,y:this.height},this.tipBase2Position={x:U+q,y:this.height}):(this.tipBase1Position={x:0,y:this.height-U},this.tipBase2Position={x:0,y:this.height-U-q})},v.prototype.resize=function(C){X.prototype.resize.call(this,C),this.positionTip()},v.prototype.positionTip=function(){oe.setAttributes(this.tip,[["points",this.getTipPoints()]]);var C=this.tipGrip.visual.transform.baseVal.getItem(0);C.setTranslate(this.tipPosition.x,this.tipPosition.y),this.tipGrip.visual.transform.baseVal.replaceItem(C,0)},Object.defineProperty(v.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.bgColorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),v.prototype.select=function(){this.positionTip(),X.prototype.select.call(this)},v.prototype.getState=function(){var C=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},X.prototype.getState.call(this));return C.typeName=v.typeName,C},v.prototype.restoreState=function(C){var U=C;this.bgColor=U.bgColor,this.tipPosition=U.tipPosition,X.prototype.restoreState.call(this,C),this.createTip(),this.setTipPoints()},v.prototype.scale=function(C,U){X.prototype.scale.call(this,C,U),this.tipPosition={x:this.tipPosition.x*C,y:this.tipPosition.y*U},this.positionTip()},v.typeName="CalloutMarker",v.title="Callout marker",v.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>',v}(ze),Me=function(X){function v(C,U,q){var V=X.call(this,C,U,q)||this;return V.fillColor="transparent",V.strokeColor="transparent",V.strokeWidth=0,V.strokeDasharray="",V.opacity=1,V.strokeColor=q.defaultColor,V.strokeWidth=q.defaultStrokeWidth,V.strokeDasharray=q.defaultStrokeDasharray,V.fillColor=q.defaultFillColor,V.setStrokeColor=V.setStrokeColor.bind(V),V.setFillColor=V.setFillColor.bind(V),V.setStrokeWidth=V.setStrokeWidth.bind(V),V.setStrokeDasharray=V.setStrokeDasharray.bind(V),V.setOpacity=V.setOpacity.bind(V),V.createVisual=V.createVisual.bind(V),V.strokePanel=new Fe("Line color",fe(q.defaultColorSet,["transparent"]),q.defaultColor),V.strokePanel.onColorChanged=V.setStrokeColor,V.fillPanel=new Fe("Fill color",fe(q.defaultColorSet,["transparent"]),V.fillColor,me),V.fillPanel.onColorChanged=V.setFillColor,V.strokeWidthPanel=new ut("Line width",q.defaultStrokeWidths,q.defaultStrokeWidth),V.strokeWidthPanel.onWidthChanged=V.setStrokeWidth,V.strokeStylePanel=new Ye("Line style",q.defaultStrokeDasharrays,q.defaultStrokeDasharray),V.strokeStylePanel.onStyleChanged=V.setStrokeDasharray,V.opacityPanel=new re("Opacity",q.defaultOpacitySteps,V.opacity),V.opacityPanel.onOpacityChanged=V.setOpacity,V}return Se(v,X),v.prototype.ownsTarget=function(C){return!(!X.prototype.ownsTarget.call(this,C)&&C!==this.visual)},v.prototype.createVisual=function(){this.visual=oe.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)},v.prototype.pointerDown=function(C,U){X.prototype.pointerDown.call(this,C,U),this.state==="new"&&(this.createVisual(),this.moveVisual(C),this._state="creating")},v.prototype.manipulate=function(C){X.prototype.manipulate.call(this,C)},v.prototype.resize=function(C){X.prototype.resize.call(this,C),this.setSize()},v.prototype.setSize=function(){X.prototype.setSize.call(this),oe.setAttributes(this.visual,[["cx",(this.width/2).toString()],["cy",(this.height/2).toString()],["rx",(this.width/2).toString()],["ry",(this.height/2).toString()]])},v.prototype.pointerUp=function(C){X.prototype.pointerUp.call(this,C),this.setSize()},v.prototype.setStrokeColor=function(C){this.strokeColor=C,this.visual&&oe.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(C),this.stateChanged()},v.prototype.setFillColor=function(C){this.fillColor=C,this.visual&&oe.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(C),this.stateChanged()},v.prototype.setStrokeWidth=function(C){this.strokeWidth=C,this.visual&&oe.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},v.prototype.setStrokeDasharray=function(C){this.strokeDasharray=C,this.visual&&oe.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},v.prototype.setOpacity=function(C){this.opacity=C,this.visual&&oe.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(v.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),v.prototype.getState=function(){var C=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},X.prototype.getState.call(this));return C.typeName=v.typeName,C},v.prototype.restoreState=function(C){var U=C;this.fillColor=U.fillColor,this.strokeColor=U.strokeColor,this.strokeWidth=U.strokeWidth,this.strokeDasharray=U.strokeDasharray,this.opacity=U.opacity,this.createVisual(),X.prototype.restoreState.call(this,C),this.setSize()},v.prototype.scale=function(C,U){X.prototype.scale.call(this,C,U),this.setSize()},v.typeName="EllipseMarker",v.title="Ellipse marker",v.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>',v}(tt),je=function(X){function v(C,U,q){return X.call(this,C,U,q)||this}return Se(v,X),Object.defineProperty(v.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),v.prototype.ownsTarget=function(C){return!(!X.prototype.ownsTarget.call(this,C)&&C!==this.tip1&&C!==this.tip2)},v.prototype.createTips=function(){this.tip1=oe.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(oe.createTransform()),this.visual.appendChild(this.tip1),this.tip2=oe.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(oe.createTransform()),this.visual.appendChild(this.tip2)},v.prototype.pointerDown=function(C,U){X.prototype.pointerDown.call(this,C,U),this.state==="creating"&&this.createTips()},v.prototype.adjustVisual=function(){if(X.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(oe.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()]]),oe.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 C=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),U=this.tip1.transform.baseVal.getItem(0);U.setRotate(C,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(U,0);var q=this.tip2.transform.baseVal.getItem(0);q.setRotate(C+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(q,0)}},Object.defineProperty(v.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),v.prototype.getState=function(){var C=X.prototype.getState.call(this);return C.typeName=v.typeName,C},v.prototype.restoreState=function(C){X.prototype.restoreState.call(this,C),this.createTips(),this.adjustVisual()},v.typeName="MeasurementMarker",v.title="Measurement marker",v.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>',v}(nt),it=function(X){function v(C,U,q){var V=X.call(this,C,U,q)||this;return V.strokePanel.colors=q.defaultColorSet,V.fillColor="transparent",V}return Se(v,X),Object.defineProperty(v.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),v.prototype.getState=function(){var C=X.prototype.getState.call(this);return C.typeName=v.typeName,C},v.typeName="EllipseFrameMarker",v.title="Ellipse frame marker",v.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>',v}(Me),ft=function(){function X(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(X.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),X.prototype.addUndoStep=function(v){this.undoStack.length!==0&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(v)||(this.undoStack.push(v),JSON.stringify(this.lastRedoStep)!==JSON.stringify(v)&&this.redoStack.splice(0,this.redoStack.length))},X.prototype.replaceLastUndoStep=function(v){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=v)},X.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},X.prototype.undo=function(){if(this.undoStack.length>1){var v=this.undoStack.pop();return v!==void 0&&this.redoStack.push(v),this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0}},X.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},X}(),ct=function(X){function v(C,U,q){var V=X.call(this,C,U,q)||this;return V.strokeColor="transparent",V.strokeWidth=0,V.strokeDasharray="",V.curveX=0,V.curveY=0,V.manipulationStartCurveX=0,V.manipulationStartCurveY=0,V.setStrokeColor=V.setStrokeColor.bind(V),V.setStrokeWidth=V.setStrokeWidth.bind(V),V.setStrokeDasharray=V.setStrokeDasharray.bind(V),V.positionGrips=V.positionGrips.bind(V),V.addControlGrips=V.addControlGrips.bind(V),V.adjustVisual=V.adjustVisual.bind(V),V.setupControlBox=V.setupControlBox.bind(V),V.resize=V.resize.bind(V),V.strokeColor=q.defaultColor,V.strokeWidth=q.defaultStrokeWidth,V.strokeDasharray=q.defaultStrokeDasharray,V.strokePanel=new Fe("Line color",q.defaultColorSet,q.defaultColor),V.strokePanel.onColorChanged=V.setStrokeColor,V.strokeWidthPanel=new ut("Line width",q.defaultStrokeWidths,q.defaultStrokeWidth),V.strokeWidthPanel.onWidthChanged=V.setStrokeWidth,V.strokeStylePanel=new Ye("Line style",q.defaultStrokeDasharrays,q.defaultStrokeDasharray),V.strokeStylePanel.onStyleChanged=V.setStrokeDasharray,V}return Se(v,X),v.prototype.ownsTarget=function(C){return!(!X.prototype.ownsTarget.call(this,C)&&C!==this.visual&&C!==this.selectorCurve&&C!==this.visibleCurve&&!this.curveGrip.ownsTarget(C))},v.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},v.prototype.createVisual=function(){this.visual=oe.createGroup(),this.selectorCurve=oe.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=oe.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)},v.prototype.pointerDown=function(C,U){X.prototype.pointerDown.call(this,C,U),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=C.x,this.curveY=C.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(U)&&(this.activeGrip=this.curveGrip,this._state="resize")},v.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),oe.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),oe.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),oe.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},v.prototype.setupControlBox=function(){X.prototype.setupControlBox.call(this),this.curveControlLine1=oe.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=oe.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)},v.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,X.prototype.addControlGrips.call(this)},v.prototype.positionGrips=function(){X.prototype.positionGrips.call(this);var C=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-C/2,this.curveY-C/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()))},v.prototype.manipulate=function(C){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+C.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+C.y-this.manipulationStartY),X.prototype.manipulate.call(this,C)},v.prototype.resize=function(C){this.activeGrip===this.curveGrip&&(this.curveX=C.x,this.curveY=C.y),X.prototype.resize.call(this,C),this.state==="creating"&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},v.prototype.setStrokeColor=function(C){this.strokeColor=C,this.adjustVisual(),this.colorChanged(C)},v.prototype.setStrokeWidth=function(C){this.strokeWidth=C,this.adjustVisual()},v.prototype.setStrokeDasharray=function(C){this.strokeDasharray=C,this.adjustVisual()},v.prototype.scale=function(C,U){this.curveX=this.curveX*C,this.curveY=this.curveY*U,X.prototype.scale.call(this,C,U)},Object.defineProperty(v.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),v.prototype.getState=function(){var C=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},X.prototype.getState.call(this));return C.typeName=v.typeName,C},v.prototype.restoreState=function(C){X.prototype.restoreState.call(this,C);var U=C;this.strokeColor=U.strokeColor,this.strokeWidth=U.strokeWidth,this.strokeDasharray=U.strokeDasharray,this.curveX=U.curveX,this.curveY=U.curveY,this.createVisual(),this.adjustVisual()},v.typeName="CurveMarker",v.title="Curve marker",v.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>',v}(lt),At=function(){function X(v,C){C===void 0&&(C=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=v,this.cancelable=C}return Object.defineProperty(X.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),X.prototype.preventDefault=function(){this._defaultPrevented=!0},X}(),wt=function(X){function v(C,U,q){var V=X.call(this,C,!1)||this;return V.dataUrl=U,V.state=q,V}return Se(v,X),v}(At),dt=function(X){function v(C,U,q){q===void 0&&(q=!1);var V=X.call(this,C,q)||this;return V.marker=U,V}return Se(v,X),v}(At),Ut=function(){function X(){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 X.prototype.addEventListener=function(v,C){this[v].push(C)},X.prototype.removeEventListener=function(v,C){var U=this[v].indexOf(C);U>-1&&this[v].splice(U,1)},X}(),vt=function(){function X(v){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new Ie,this._isOpen=!1,this.undoRedoManager=new ft,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 Ut,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=X.instanceCounter++,this.styles=new Ae(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=v,this.targetRoot=document.body,this.width=v.clientWidth,this.height=v.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(X.prototype,"ALL_MARKER_TYPES",{get:function(){return[Xe,xe,_e,ze,it,Me,de,Ee,je,ne,nt,ct]},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[Xe,xe,_e,ze,Me,de,Ee]},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"BASIC_MARKER_TYPES",{get:function(){return[Xe,xe,_e,ze,de]},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(v){var C=this;this._availableMarkerTypes.splice(0),v.forEach(function(U){if(typeof U=="string"){var q=C.ALL_MARKER_TYPES.find(function(V){return V.typeName===U});q!==void 0&&C._availableMarkerTypes.push(q)}else C._availableMarkerTypes.push(U)})},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"zoomLevel",{get:function(){return this._zoomLevel},set:function(v){this._zoomLevel=v,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(X.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),X.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),this.settings.displayMode==="popup"&&this.onPopupTargetResize(),te.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},X.prototype.show=function(){var v=this;this.styles.styleSheetRoot===void 0&&ae.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=ae.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(C){return C(new At(v))})},X.prototype.render=function(){return Ce(this,void 0,void 0,function(){var v;return pe(this,function(C){switch(C.label){case 0:return this.setCurrentMarker(),(v=new he).naturalSize=this.renderAtNaturalSize,v.imageType=this.renderImageType,v.imageQuality=this.renderImageQuality,v.markersOnly=this.renderMarkersOnly,v.width=this.renderWidth,v.height=this.renderHeight,[4,v.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return C.sent(),[4,v.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,C.sent()]}})})},X.prototype.close=function(v){var C=this;if(v===void 0&&(v=!1),this.isOpen){var U=!1;v||this.eventListeners.beforeclose.forEach(function(q){var V=new At(C,!0);q(V),V.defaultPrevented&&(U=!0)}),U||(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.settings.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),this.eventListeners.close.forEach(function(q){return q(new At(C))}),this.detachEvents(),this._isOpen=!1)}},X.prototype.addMarkersToToolbar=function(){for(var v,C=[],U=0;U<arguments.length;U++)C[U]=arguments[U];(v=this._availableMarkerTypes).push.apply(v,C)},X.prototype.addRenderEventListener=function(v){this.addEventListener("render",function(C){v(C.dataUrl,C.state)})},X.prototype.removeRenderEventListener=function(v){},X.prototype.addCloseEventListener=function(v){this.addEventListener("close",function(){v()})},X.prototype.removeCloseEventListener=function(v){},X.prototype.setupResizeObserver=function(){var v=this;this.settings.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){v.resize(v.target.clientWidth,v.target.clientHeight)}),this.targetObserver.observe(this.target)):this.settings.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){return v.onPopupTargetResize()}),this.targetObserver.observe(this.editorCanvas)),window.addEventListener("resize",this.setWindowHeight))},X.prototype.onPopupTargetResize=function(){var v=1*this.target.clientWidth/this.target.clientHeight,C=this.editorCanvas.clientWidth/v>this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*v:this.editorCanvas.clientWidth,U=C<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/v;this.resize(C,U)},X.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},X.prototype.resize=function(v,C){this._isResizing=!0;var U=v/this.imageWidth,q=C/this.imageHeight;this.imageWidth=Math.round(v),this.imageHeight=Math.round(C),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(U,q),this._isResizing=!1},X.prototype.scaleMarkers=function(v,C){var U,q=this;this._currentMarker&&this._currentMarker instanceof ze?this._currentMarker.scale(v,C):(U=this._currentMarker,this.setCurrentMarker()),this.markers.forEach(function(V){V!==q._currentMarker&&V.scale(v,C)}),U!==void 0&&this.setCurrentMarker(U)},X.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"},X.prototype.setTopLeft=function(){var v=this.editingTarget.getBoundingClientRect(),C=this.editorCanvas.getBoundingClientRect();this.left=v.left-C.left,this.top=v.top-C.top},X.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)},X.prototype.addDefs=function(){for(var v,C=[],U=0;U<arguments.length;U++)C[U]=arguments[U];this.defs=oe.createDefs(),this.addDefsToImage(),(v=this.defs).append.apply(v,C)},X.prototype.addDefsToImage=function(){this.defs&&this.markerImage.insertBefore(this.defs,this.markerImage.firstChild)},X.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)},X.prototype.positionMarkerImage=function(){this.markerImageHolder.style.top=this.top/this.zoomLevel+"px",this.markerImageHolder.style.left=this.left/this.zoomLevel+"px"},X.prototype.attachEvents=function(){this.markerImage.addEventListener("pointerdown",this.onPointerDown),this.markerImage.addEventListener("dblclick",this.onDblClick),this.attachWindowEvents()},X.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)},X.prototype.detachEvents=function(){this.markerImage.removeEventListener("pointerdown",this.onPointerDown),this.markerImage.removeEventListener("dblclick",this.onDblClick),this.detachWindowEvents()},X.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)},X.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 v=document.createElement("a");v.href="https://markerjs.com/",v.target="_blank",v.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>',v.title="Powered by marker.js",v.style.display="grid",v.style.alignItems="center",v.style.justifyItems="center",v.style.padding="3px",v.style.width="20px",v.style.height="20px",this.logoUI.appendChild(v),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},X.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")},X.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"},X.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},X.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 v=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=v+"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 Le(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 Pe(this.uiDiv,this.settings.displayMode,this.uiStyleSettings,this.styles),this.toolbox.show(this._silentRenderMode||this.uiStyleSettings.hideToolbox?"hidden":"visible")},X.prototype.closeUI=function(){this.settings.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},X.prototype.removeMarker=function(v){this.markerImage.removeChild(v.container),this.markers.indexOf(v)>-1&&this.markers.splice(this.markers.indexOf(v),1),v.dispose()},X.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())},X.prototype.toolbarButtonClicked=function(v,C){if(v==="marker"&&C!==void 0)this.createNewMarker(C);else if(v==="action")switch(C){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()}},X.prototype.deleteSelectedMarker=function(){var v=this;if(this._currentMarker!==void 0){var C=!1;if(this.eventListeners.markerbeforedelete.forEach(function(q){var V=new dt(v,v._currentMarker,!0);q(V),V.defaultPrevented&&(C=!0)}),!C){var U=this._currentMarker;this._currentMarker.dispose(),this.markerImage.removeChild(this._currentMarker.container),this.markers.splice(this.markers.indexOf(this._currentMarker),1),this.setCurrentMarker(),this.addUndoStep(),this.eventListeners.markerdelete.forEach(function(q){return q(new dt(v,U))})}}},X.prototype.clear=function(){var v=this,C=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(be){var We=new dt(v,void 0,!0);be(We),We.defaultPrevented&&(C=!0)}),!C)){this.setCurrentMarker();for(var U=function(be){var We=q.markers[be];q.setCurrentMarker(q.markers[be]),q._currentMarker.dispose(),q.markerImage.removeChild(q._currentMarker.container),q.markers.splice(q.markers.indexOf(q._currentMarker),1),q.eventListeners.markerdelete.forEach(function(qe){return qe(new dt(v,We))})},q=this,V=this.markers.length-1;V>=0;V--)U(V);this.addUndoStep()}},Object.defineProperty(X.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),X.prototype.showNotesEditor=function(){var v;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=(v=this._currentMarker.notes)!==null&&v!==void 0?v:"",this.overlayContainer.appendChild(this.notesArea))},X.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)},X.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},X.prototype.addUndoStep=function(){var v=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var C=this.getState(),U=this.undoRedoManager.getLastUndoStep();if(!U||U.width===C.width&&U.height===C.height){var q=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(C),q<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach(function(V){return V(new At(v))})}else this.undoRedoManager.replaceLastUndoStep(C),this.eventListeners.statechange.forEach(function(V){return V(new At(v))})}},X.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},X.prototype.undoStep=function(){var v=this,C=this.undoRedoManager.undo();C!==void 0&&(this.restoreState(C),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(U){return U(new At(v))}))},X.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},X.prototype.redoStep=function(){var v=this,C=this.undoRedoManager.redo();C!==void 0&&(this.restoreState(C),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(U){return U(new At(v))}))},X.prototype.stepZoom=function(){var v=this.zoomSteps.indexOf(this.zoomLevel);this.zoomLevel=v<this.zoomSteps.length-1?this.zoomSteps[v+1]:this.zoomSteps[0]},X.prototype.panTo=function(v){this.contentDiv.scrollBy({left:this.prevPanPoint.x-v.x,top:this.prevPanPoint.y-v.y}),this.prevPanPoint=v},X.prototype.startRenderAndClose=function(){return Ce(this,void 0,void 0,function(){var v,C,U=this;return pe(this,function(q){switch(q.label){case 0:return[4,this.render()];case 1:return v=q.sent(),C=this.getState(),this.eventListeners.render.forEach(function(V){return V(new wt(U,v,C))}),this.close(!0),[2]}})})},X.prototype.getState=function(v){v===!0&&this.setCurrentMarker();var C={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach(function(U){return C.markers.push(U.getState())}),C},X.prototype.restoreState=function(v){var C=this;for(this.markers.splice(0);this.markerImage.lastChild;)this.markerImage.removeChild(this.markerImage.lastChild);v.markers.forEach(function(U){var q=C._availableMarkerTypes.find(function(be){return be.typeName===U.typeName});if(q!==void 0){var V=C.addNewMarker(q);V.restoreState(U),C.markers.push(V)}}),v.width&&v.height&&(v.width!==this.imageWidth||v.height!==this.imageHeight)&&this.scaleMarkers(this.imageWidth/v.width,this.imageHeight/v.height),this.eventListeners.restorestate.forEach(function(U){return U(new At(C))})},X.prototype.addNewMarker=function(v){var C=oe.createGroup();return this.markerImage.appendChild(C),new v(C,this.overlayContainer,this.settings)},X.prototype.createNewMarker=function(v){var C,U=this;(C=typeof v=="string"?this._availableMarkerTypes.find(function(q){return q.typeName===v}):v)&&(this.setCurrentMarker(),this.addUndoStep(),this._currentMarker=this.addNewMarker(C),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(C.typeName),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this.eventListeners.markercreating.forEach(function(q){return q(new dt(U,U._currentMarker))}))},X.prototype.markerCreated=function(v){var C=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(v),this.setCurrentMarker(v),v instanceof xe&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(xe):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach(function(U){return U(new dt(C,C._currentMarker))})},X.prototype.colorChanged=function(v){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultColor=v,this.settings.defaultStrokeColor=v)},X.prototype.fillColorChanged=function(v){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultFillColor=v)},X.prototype.markerStateChanged=function(v){var C=this;this.eventListeners.markerchange.forEach(function(U){return U(new dt(C,v))})},X.prototype.setCurrentMarker=function(v){var C=this;this._currentMarker!==v&&this._currentMarker!==void 0&&(this._currentMarker.deselect(),this.toolbar.setCurrentMarker(),this.toolbox.setPanelButtons([]),this._isResizing||this.eventListeners.markerdeselect.forEach(function(U){return U(new dt(C,C._currentMarker))})),this._currentMarker=v,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(U){return U(new dt(C,C._currentMarker))}))},X.prototype.onPointerDown=function(v){if(this._isFocused||this.focus(),this.touchPoints++,this.touchPoints===1||v.pointerType!=="touch")if(this._currentMarker===void 0||this._currentMarker.state!=="new"&&this._currentMarker.state!=="creating"){if(this.mode==="select"){var C=this.markers.find(function(U){return U.ownsTarget(v.target)});C!==void 0?(this.setCurrentMarker(C),this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(v.clientX,v.clientY),v.target)):(this.setCurrentMarker(),this.isDragging=!0,this.prevPanPoint={x:v.clientX,y:v.clientY})}}else this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(v.clientX,v.clientY))},X.prototype.onDblClick=function(v){if(this._isFocused||this.focus(),this.mode==="select"){var C=this.markers.find(function(U){return U.ownsTarget(v.target)});C!==void 0&&C!==this._currentMarker&&this.setCurrentMarker(C),this._currentMarker!==void 0?this._currentMarker.dblClick(this.clientToLocalCoordinates(v.clientX,v.clientY),v.target):this.setCurrentMarker()}},X.prototype.onPointerMove=function(v){this.touchPoints!==1&&v.pointerType==="touch"||(this._currentMarker!==void 0||this.isDragging)&&(this._currentMarker!==void 0&&this._currentMarker.state==="edit"||v.preventDefault(),this._currentMarker!==void 0?this._currentMarker.manipulate(this.clientToLocalCoordinates(v.clientX,v.clientY)):this.zoomLevel>1&&this.panTo({x:v.clientX,y:v.clientY}))},X.prototype.onPointerUp=function(v){this.touchPoints>0&&this.touchPoints--,this.touchPoints===0&&this.isDragging&&this._currentMarker!==void 0&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(v.clientX,v.clientY)),this.isDragging=!1,this.addUndoStep()},X.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},X.prototype.onKeyUp=function(v){this._currentMarker===void 0||this.notesArea!==void 0||v.key!=="Delete"&&v.key!=="Backspace"||this.deleteSelectedMarker()},X.prototype.clientToLocalCoordinates=function(v,C){var U=this.markerImage.getBoundingClientRect();return{x:(v-U.left)/this.zoomLevel,y:(C-U.top)/this.zoomLevel}},X.prototype.onWindowResize=function(){this.positionUI()},X.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var v=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=v+"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()},X.prototype.addLicenseKey=function(v){te.addKey(v)},X.prototype.addEventListener=function(v,C){this.eventListeners.addEventListener(v,C)},X.prototype.removeEventListener=function(v,C){this.eventListeners.removeEventListener(v,C)},X.prototype.renderState=function(v){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(v),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(X.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),X.prototype.focus=function(){var v=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,this._previousCurrentMarker!==void 0&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach(function(C){return C(new At(v))}))},X.prototype.blur=function(){var v=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(C){return C(new At(v))}))},X.instanceCounter=0,X}();/* **********************************
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 Rt=function(X,v){return(Rt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(C,U){C.__proto__=U}||function(C,U){for(var q in U)Object.prototype.hasOwnProperty.call(U,q)&&(C[q]=U[q])})(X,v)};function Lt(X,v){if(typeof v!="function"&&v!==null)throw new TypeError("Class extends value "+String(v)+" is not a constructor or null");function C(){this.constructor=X}Rt(X,v),X.prototype=v===null?Object.create(v):(C.prototype=v.prototype,new C)}function Je(X,v,C,U){return new(C||(C=Promise))(function(q,V){function be(gt){try{qe(U.next(gt))}catch(Ge){V(Ge)}}function We(gt){try{qe(U.throw(gt))}catch(Ge){V(Ge)}}function qe(gt){var Ge;gt.done?q(gt.value):(Ge=gt.value,Ge instanceof C?Ge:new C(function(xt){xt(Ge)})).then(be,We)}qe((U=U.apply(X,v||[])).next())})}function li(X,v){var C,U,q,V,be={label:0,sent:function(){if(1&q[0])throw q[1];return q[1]},trys:[],ops:[]};return V={next:We(0),throw:We(1),return:We(2)},typeof Symbol=="function"&&(V[Symbol.iterator]=function(){return this}),V;function We(qe){return function(gt){return function(Ge){if(C)throw new TypeError("Generator is already executing.");for(;be;)try{if(C=1,U&&(q=2&Ge[0]?U.return:Ge[0]?U.throw||((q=U.return)&&q.call(U),0):U.next)&&!(q=q.call(U,Ge[1])).done)return q;switch(U=0,q&&(Ge=[2&Ge[0],q.value]),Ge[0]){case 0:case 1:q=Ge;break;case 4:return be.label++,{value:Ge[1],done:!1};case 5:be.label++,U=Ge[1],Ge=[0];continue;case 7:Ge=be.ops.pop(),be.trys.pop();continue;default:if(!(q=be.trys,(q=q.length>0&&q[q.length-1])||Ge[0]!==6&&Ge[0]!==2)){be=0;continue}if(Ge[0]===3&&(!q||Ge[1]>q[0]&&Ge[1]<q[3])){be.label=Ge[1];break}if(Ge[0]===6&&be.label<q[1]){be.label=q[1],q=Ge;break}if(q&&be.label<q[2]){be.label=q[2],be.ops.push(Ge);break}q[2]&&be.ops.pop(),be.trys.pop();continue}Ge=v.call(X,be)}catch(xt){Ge=[6,xt],U=0}finally{C=q=0}if(5&Ge[0])throw Ge[1];return{value:Ge[0]?Ge[1]:void 0,done:!0}}([qe,gt])}}}var mi=function(){function X(){}return X.addKey=function(v){X.key=v},Object.defineProperty(X,"isLicensed",{get:function(){return!!X.key&&new RegExp(/^CRPR-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(X.key)},enumerable:!1,configurable:!0}),X}(),Qe=function(){function X(){}return X.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},X.setAttributes=function(v,C){for(var U=0,q=C;U<q.length;U++){var V=q[U],be=V[0],We=V[1];v.setAttribute(be,We)}},X.createRect=function(v,C,U){var q=document.createElementNS("http://www.w3.org/2000/svg","rect");return q.setAttribute("width",v.toString()),q.setAttribute("height",C.toString()),U&&X.setAttributes(q,U),q},X.createLine=function(v,C,U,q,V){var be=document.createElementNS("http://www.w3.org/2000/svg","line");return be.setAttribute("x1",v.toString()),be.setAttribute("y1",C.toString()),be.setAttribute("x2",U.toString()),be.setAttribute("y2",q.toString()),V&&X.setAttributes(be,V),be},X.createPolygon=function(v,C){var U=document.createElementNS("http://www.w3.org/2000/svg","polygon");return U.setAttribute("points",v),C&&X.setAttributes(U,C),U},X.createCircle=function(v,C){var U=document.createElementNS("http://www.w3.org/2000/svg","circle");return U.setAttribute("cx",(v/2).toString()),U.setAttribute("cy",(v/2).toString()),U.setAttribute("r",v.toString()),C&&X.setAttributes(U,C),U},X.createEllipse=function(v,C,U){var q=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return q.setAttribute("cx",(v/2).toString()),q.setAttribute("cy",(C/2).toString()),q.setAttribute("rx",(v/2).toString()),q.setAttribute("ry",(C/2).toString()),U&&X.setAttributes(q,U),q},X.createGroup=function(v){var C=document.createElementNS("http://www.w3.org/2000/svg","g");return v&&X.setAttributes(C,v),C},X.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},X.createMarker=function(v,C,U,q,V,be,We){var qe=document.createElementNS("http://www.w3.org/2000/svg","marker");return X.setAttributes(qe,[["id",v],["orient",C],["markerWidth",U.toString()],["markerHeight",q.toString()],["refX",V.toString()],["refY",be.toString()]]),qe.appendChild(We),qe},X.createText=function(v){var C=document.createElementNS("http://www.w3.org/2000/svg","text");return C.setAttribute("x","0"),C.setAttribute("y","0"),v&&X.setAttributes(C,v),C},X.createTSpan=function(v,C){var U=document.createElementNS("http://www.w3.org/2000/svg","tspan");return U.textContent=v,C&&X.setAttributes(U,C),U},X.createImage=function(v){var C=document.createElementNS("http://www.w3.org/2000/svg","image");return v&&X.setAttributes(C,v),C},X.createPoint=function(v,C){var U=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return U.x=v,U.y=C,U},X.createPath=function(v,C){var U=document.createElementNS("http://www.w3.org/2000/svg","path");return U.setAttribute("d",v),C&&X.setAttributes(U,C),U},X.createElement=function(v,C){var U=document.createElementNS("http://www.w3.org/2000/svg",v);return C&&X.setAttributes(U,C),U},X.getHollowRectanglePath=function(v,C,U,q,V,be,We,qe){return"M"+v+","+C+"V"+(C+q)+"H"+(v+U)+"V"+C+"H"+V+"V"+be+"H"+(V+We)+"V"+(be+qe)+"H"+V+"V"+C+"Z"},X}(),yt=function(){function X(v){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+v+"_"}return Object.defineProperty(X.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(X.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(X.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_out"},enumerable:!1,configurable:!0}),X.prototype.addClass=function(v){return this.styleSheet===void 0&&this.addStyleSheet(),v.name=""+this.classNamePrefix+v.localName,this.classes.push(v),this.styleSheet.sheet.insertRule("."+v.name+" {"+v.style+"}",this.styleSheet.sheet.cssRules.length),v},X.prototype.addRule=function(v){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(v),this.styleSheet.sheet.insertRule(v.selector+" {"+v.style+"}",this.styleSheet.sheet.cssRules.length)},X.prototype.addStyleSheet=function(){var v;this.styleSheet=document.createElement("style"),((v=this.styleSheetRoot)!==null&&v!==void 0?v:document.head).appendChild(this.styleSheet),this.addRule(new It("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new It("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
from {
opacity: 0;
}
to {
opacity: 1;
}
`)),this.addRule(new It("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
from {
opacity: 1;
}
to {
opacity: 0;
}
`)),this.addClass(new kt("_fade_in",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
`)),this.addClass(new kt("_fade_out",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
`))},X.prototype.removeStyleSheet=function(){var v;this.styleSheet&&(((v=this.styleSheetRoot)!==null&&v!==void 0?v:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},X}(),It=function(X,v){this.selector=X,this.style=v},kt=function(X,v){this.localName=X,this.style=v},Jt=function(){function X(){this.blocks=[],this.display=""}return X.prototype.addButtonBlock=function(v){v.className=this.blockClassName,v.buttonClassName=this.buttonClassName,v.buttonColorsClassName=this.buttonColorsClassName,v.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(v)},X.prototype.addElementBlock=function(v){v.className===void 0&&(v.className=this.blockClassName),this.blocks.push(v)},X.prototype.getUI=function(){var v=document.createElement("div");return v.className=this.className+" "+this.colorsClassName+" "+this.fadeInClassName,v.style.display=this.display,this.blocks.forEach(function(C){return v.appendChild(C.getUI())}),v},X}(),Si=function(){function X(){}return X.prototype.getUI=function(){var v=document.createElement("div");if(v.className=this.className,this.minWidth!==void 0&&(v.style.minWidth=this.minWidth),this.contentAlign!==void 0)switch(this.contentAlign){case"start":v.style.justifyContent="flex-start";break;case"center":v.style.justifyContent="center";break;case"end":v.style.justifyContent="flex-end"}return v.style.whiteSpace="nowrap",v},X}(),en=function(X){function v(){var C=X!==null&&X.apply(this,arguments)||this;return C.buttons=[],C}return Lt(v,X),v.prototype.addButton=function(C){C.className=this.buttonClassName,C.colorsClassName=this.buttonColorsClassName,C.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(C)},v.prototype.getUI=function(){var C=X.prototype.getUI.call(this);return this.buttons.forEach(function(U){return C.appendChild(U.getUI())}),C},v}(Si),jt=function(){function X(v,C){this._isActive=!1,this._isHidden=!1,this._icon=v,this.title=C,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(X.prototype,"icon",{get:function(){return this._icon},set:function(v){this._icon=v,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"isActive",{get:function(){return this._isActive},set:function(v){this._isActive=v,this.adjustClassName()},enumerable:!1,configurable:!0}),X.prototype.getUI=function(){var v=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 v.onClick()}),this.uiContainer.appendChild(this.buttonContainer),this.uiContainer.style.display=this._isHidden?"none":"inline-block",this.uiContainer},X.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,"")))},X.prototype.hide=function(){this._isHidden=!0},X}(),mt=function(X){function v(){var C=X!==null&&X.apply(this,arguments)||this;return C.elements=[],C}return Lt(v,X),v.prototype.addElement=function(C){this.elements.push(C)},v.prototype.getUI=function(){var C=X.prototype.getUI.call(this);return this.elements.forEach(function(U){return C.appendChild(U)}),C},v}(Si),zi=function(){function X(v,C){this.horizontal=v,this.vertical=C}return Object.defineProperty(X.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),X.prototype.getVerticalLength=function(v){return v/this.ratio},X.prototype.getHorizontalLength=function(v){return v*this.ratio},X}(),tn=function(){function X(){}return X.getIcon=function(v,C){if(v>0&&C>0){var U=new zi(v,C),q=U.ratio>=1?20:U.getHorizontalLength(20),V=U.ratio<1?20:U.getVerticalLength(20),be=document.createElementNS("http://www.w3.org/2000/svg","svg");be.setAttribute("xmlns","http://www.w3.org/2000/svg"),be.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(be);var We=Qe.createDefs();be.appendChild(We);var qe=Qe.createElement("clipPath",[["id","text-bg-clip"]]);We.appendChild(qe);var gt=Qe.createPath(Qe.getHollowRectanglePath((24-q)/2,(24-V)/2,q,V,(24-q)/2+2,(24-V)/2+2,q-4,V-4));be.appendChild(gt);var Ge=Qe.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);Ge.appendChild(Qe.createTSpan(v+":"+C)),be.appendChild(Ge);var xt=Ge.getBBox();Qe.setAttributes(Ge,[["x",((24-xt.width)/2).toString()],["y",((24-xt.height)/2-xt.y).toString()]]);var Wt=Qe.createPath(Qe.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(xt.width))/2,(24-Math.ceil(xt.height))/2,Math.ceil(xt.width),Math.ceil(xt.height)));return qe.appendChild(Wt),Qe.setAttributes(gt,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(be),be.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>'},X}(),bi=function(X){function v(C,U,q){var V=X.call(this,C,U)||this;return V.isDropdownOpen=!1,V.onClick=V.dropdownButtonClicked,V.dropdownButtons=q,V}return Lt(v,X),v.prototype.setupDropdown=function(){var C=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(U){U.className=C.className,U.colorsClassName=C.colorsClassName,C.dropdownBlock.appendChild(U.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},v.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},v.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},v.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},v.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},v.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},v}(jt),Pt=function(){function X(v,C){this.GRIP_SIZE=10,this.color=v,this.fillColor=C,this.visual=Qe.createGroup(),this.visual.appendChild(Qe.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(Qe.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return X.prototype.ownsTarget=function(v){return v===this.visual||v===this.visual.childNodes[0]||v===this.visual.childNodes[1]},X.prototype.setCenter=function(v,C){this.visual.childNodes.forEach(function(U){return Qe.setAttributes(U,[["cx",v.toString()],["cy",C.toString()]])})},X}(),Hi=function(){function X(v,C,U,q){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=v,this.canvasHeight=C,this.margin=U,this.container=q,this.attachEvents=this.attachEvents.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.resize=this.resize.bind(this),this.adjustCropRect=this.adjustCropRect.bind(this),this.scaleCanvas=this.scaleCanvas.bind(this),this.getRescaledRect=this.getRescaledRect.bind(this)}return Object.defineProperty(X.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(v){this._aspectRatio=v,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(v){this._isGridVisible=v,this.gridContainer&&Qe.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(v){this._zoomFactor=v,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),X.prototype.open=function(){var v=this;this.cropShadeElement=Qe.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=Qe.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var C=0;C<this.numberOfGridLines;C++)this.horizontalGridLines.push(Qe.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push(Qe.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]]));this.horizontalGridLines.forEach(function(U){return v.gridContainer.appendChild(U)}),this.verticalGridLines.forEach(function(U){return v.gridContainer.appendChild(U)}),this.cropRectElement=Qe.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new Pt(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new Pt(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new Pt(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new Pt(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomRightGrip.visual),this.attachEvents()},X.prototype.setCropRectangle=function(v){this.cropRect=v;var C=Object.assign({},this.cropRect);this.zoomFactor!==1&&(C.width=this.cropRect.width*this.zoomFactor,C.height=this.cropRect.height*this.zoomFactor,C.x=this.cropRect.height/this.cropRect.width<this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasWidth/2-C.width/2,C.y=this.cropRect.height/this.cropRect.width>this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-C.height/2),Qe.setAttributes(this.cropRectElement,[["x",C.x.toString()],["y",C.y.toString()],["width",C.width.toString()],["height",C.height.toString()]]);var U=C.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(V,be){var We=C.y+U*(be+1);Qe.setAttributes(V,[["x1",""+C.x],["y1",""+We],["x2",""+(C.x+C.width)],["y2",""+We]])});var q=C.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(V,be){var We=C.x+q*(be+1);Qe.setAttributes(V,[["x1",""+We],["y1",""+C.y],["x2",""+We],["y2",""+(C.y+C.height)]])}),Qe.setAttributes(this.cropShadeElement,[["d",Qe.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,C.x,C.y,C.width,C.height)]]),this.topLeftGrip.setCenter(C.x,C.y),this.topRightGrip.setCenter(C.x+C.width,C.y),this.bottomLeftGrip.setCenter(C.x,C.y+C.height),this.bottomRightGrip.setCenter(C.x+C.width,C.y+C.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},X.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)},X.prototype.clientToLocalCoordinates=function(v,C){var U=this.container.getBoundingClientRect();return{x:v-U.left+this.margin,y:C-U.top+this.margin}},X.prototype.onPointerDown=function(v){this.container.setPointerCapture(v.pointerId),this.previousPoint=this.clientToLocalCoordinates(v.clientX,v.clientY),this.cropRectElement===v.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(v.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(v.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(v.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(v.target)&&(this.activeGrip=this.bottomRightGrip)},X.prototype.onPointerMove=function(v){if(this.isMoving)this.move(this.clientToLocalCoordinates(v.clientX,v.clientY));else if(this.activeGrip){var C=this.clientToLocalCoordinates(v.clientX,v.clientY);this.resize(C)}v.preventDefault()},X.prototype.onPointerUp=function(v){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(v.pointerId)},X.prototype.move=function(v){var C=v.x-this.previousPoint.x,U=v.y-this.previousPoint.y;this.zoomFactor!==1&&(C=-C/this.zoomFactor,U=-U/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+C),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+U),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=v},X.prototype.resize=function(v){var C=Object.assign({},this.cropRect),U=v.x-this.previousPoint.x,q=v.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:C.x+U<this.margin&&(U=this.margin-C.x),C.x+=U,C.width=this.cropRect.x+this.cropRect.width-C.x;break;case this.bottomRightGrip:case this.topRightGrip:C.width+U>this.canvasWidth*this.zoomFactor&&(U=this.canvasWidth*this.zoomFactor-C.width),C.width+=U}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(C.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(U),C.height=this.aspectRatio.getVerticalLength(C.width)):(C.y+=q,C.height=this.cropRect.y+this.cropRect.height-C.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?C.height=this.aspectRatio.getVerticalLength(C.width):C.height+=q}C.width<10&&(C.x=this.cropRect.x,C.width=10),C.height<10&&(C.y=this.cropRect.y,C.height=10),this.previousPoint=v,C.x>=this.margin&&C.y>=this.margin&&C.x-this.margin+C.width<=this.canvasWidth&&C.y-this.margin+C.height<=this.canvasHeight&&(this.cropRect=C,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},X.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var v=this.cropRect.x+this.cropRect.width/2,C=this.cropRect.y+this.cropRect.height/2,U=this.aspectRatio.getHorizontalLength(this.cropRect.height),q=this.aspectRatio.getVerticalLength(this.cropRect.width);U/this.canvasWidth<q/this.canvasHeight?this.cropRect.width=U:this.cropRect.height=q,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=v-this.cropRect.width/2,this.cropRect.y=C-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)}},X.prototype.getRescaledRect=function(v,C,U,q,V,be){var We=U/v,qe=q/C;return{x:(V.x-be)*We+be,y:(V.y-be)*qe+be,width:V.width*We,height:V.height*qe}},X.prototype.scaleCanvas=function(v,C){var U=this.getRescaledRect(this.canvasWidth,this.canvasHeight,v,C,this.cropRect,this.margin);this.canvasWidth=v,this.canvasHeight=C,this.onCropChange&&this.onCropChange(U),this.setCropRectangle(U)},X}(),Xi=function(){function X(v){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=v,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(X.prototype,"angle",{get:function(){return this._angle},set:function(v){this._angle=v,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),X.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},X.prototype.onPointerDown=function(v){this.controlContainer.setPointerCapture(v.pointerId),this.isDragging=!0,this.previousPoint={x:v.clientX,y:v.clientY}},X.prototype.onPointerMove=function(v){this.isDragging&&(this.onAngleChange&&this.onAngleChange((v.clientX-this.previousPoint.x)/5),this.previousPoint.x=v.clientX)},X.prototype.onPointerUp=function(v){this.isDragging&&this.onAngleChange&&this.onAngleChange((v.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(v.pointerId)},X.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var v=this.angleLabelText.getBBox();Qe.setAttributes(this.angleLabelElement,[["x",((this.width-v.width)/2).toString()],["y",(this.height/2).toString()]])}},X.prototype.positionScaleShape=function(){if(this.scaleShape){var v=this.scaleShape.transform.baseVal.getItem(0);v.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(v,0)}},X.prototype.getVisual=function(){var v=document.createElementNS("http://www.w3.org/2000/svg","svg");v.setAttribute("xmlns","http://www.w3.org/2000/svg"),v.setAttribute("width",this.width+"px"),v.setAttribute("height",this.height+"px"),v.setAttribute("viewBox","0 0 "+this.width+" "+this.height),v.style.flexShrink="0",document.body.appendChild(v);for(var C="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,U=1;U<=this.width/5+10;U++){var q=U%5==0?this.height/3:this.height/6;C+="h4v"+-q+"h1v"+q}C+="v1H0Z",this.scaleShape=Qe.createPath(C);var V=Qe.createTransform();this.scaleShape.transform.baseVal.appendItem(V),v.appendChild(this.scaleShape),this.angleLabelElement=Qe.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=Qe.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var be=Qe.createTSpan("");return be.innerHTML="&deg;",this.angleLabelElement.appendChild(be),v.appendChild(this.angleLabelElement),document.body.removeChild(v),v},X}(),pn=function(){function X(){this.naturalSize=!1,this.imageType="image/png"}return X.prototype.rasterize=function(v,C,U,q,V,be,We){var qe=this;return new Promise(function(gt){var Ge=document.createElement("canvas");Ge.width=v.width.baseVal.value-2*q,Ge.height=v.height.baseVal.value-2*q;var xt=1,Wt=1;qe.naturalSize===!0?(xt=C.naturalWidth/(v.width.baseVal.value-2*q)/be,Wt=C.naturalHeight/(v.height.baseVal.value-2*q)/We,Ge.width=C.naturalWidth/be,Ge.height=C.naturalHeight/We):qe.width!==void 0&&qe.height!==void 0&&(xt=qe.width/U.width,Wt=qe.height/U.height,Ge.width*=xt,Ge.height*=Wt);var Qt=Ge.getContext("2d");Qt.translate(Ge.width/2,Ge.height/2),Qt.rotate(V*Math.PI/180),Qt.scale(be,We),Qt.translate(-Ge.width/2,-Ge.height/2),Qt.drawImage(C,0,0,Ge.width,Ge.height);var Ni=document.createElement("canvas");Ni.width=U.width*xt,Ni.height=U.height*Wt,Ni.getContext("2d").putImageData(Qt.getImageData((U.x-q)*xt,(U.y-q)*Wt,U.width*xt,U.height*Wt),0,0),gt(Ni.toDataURL(qe.imageType,qe.imageQuality))})},X}(),Ve=function(){function X(v){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=X.instanceCounter++,this.styles=new yt(this.instanceNo),this.target=v,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(X.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(v){this._zoomToCropEnabled=v,v?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(v){this._isGridVisible=v,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"gridLines",{get:function(){return this._gridLines},set:function(v){this._gridLines=v,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(v){this._rotationAngle=v,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"aspectRatio",{get:function(){var v;return(v=this._aspectRatio)!==null&&v!==void 0?v:this.aspectRatios[0]},set:function(v){this._aspectRatio=v},enumerable:!1,configurable:!0}),X.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},X.prototype.show=function(){this.showUI(),this.open()},X.prototype.close=function(v){v===void 0&&(v=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),v||this.closeEventListeners.forEach(function(C){return C()}),this._isOpen=!1)},X.prototype.addRenderEventListener=function(v){this.renderEventListeners.push(v)},X.prototype.removeRenderEventListener=function(v){this.renderEventListeners.indexOf(v)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(v),1)},X.prototype.addCloseEventListener=function(v){this.closeEventListeners.push(v)},X.prototype.removeCloseEventListener=function(v){this.closeEventListeners.indexOf(v)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(v),1)},X.prototype.setupResizeObserver=function(){var v=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){v.resize(v.target.clientWidth,v.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))},X.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var v=1*this.target.clientWidth/this.target.clientHeight,C=this.contentDiv.clientWidth/v>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*v:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,U=C+2*this.CANVAS_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/v;this.resize(C,U)}},X.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},X.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",Qe.setAttributes(this.editingTarget,[["width",""+this.imageWidth],["height",""+this.imageHeight]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px"},X.prototype.resize=function(v,C){this.imageWidth=Math.round(v),this.imageHeight=Math.round(C),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()},X.prototype.setEditingTarget=function(){var v=document.createElement("canvas");v.width=this.target.naturalWidth,v.height=this.target.naturalHeight,v.getContext("2d").drawImage(this.target,0,0,this.target.naturalWidth,this.target.naturalHeight);var C=v.toDataURL();Qe.setAttributes(this.editingTarget,[["href",C]]),this.setEditingTargetSize()},X.prototype.setTopLeft=function(){var v=this.target.getBoundingClientRect(),C=this.editorCanvas.getBoundingClientRect();this.left=v.left-C.left-this.CANVAS_MARGIN,this.top=v.top-C.top-this.CANVAS_MARGIN},X.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=Qe.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=Qe.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=Qe.createGroup(),this.editingTargetRotationScaleContainer=Qe.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var v=Qe.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(v);var C=Qe.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(C),this.editingTargetContainer=Qe.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)},X.prototype.positionCropImage=function(){this.cropImageHolder.style.top=this.top+"px",this.cropImageHolder.style.left=this.left+"px"},X.prototype.initCropLayer=function(){this.cropRect={x:this.CANVAS_MARGIN,y:this.CANVAS_MARGIN,width:this.imageWidth,height:this.imageHeight},this.cropLayerContainer=Qe.createGroup(),this.cropImage.appendChild(this.cropLayerContainer),this.cropLayer=new Hi(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()},X.prototype.zoomToCrop=function(){if(this.cropRect){var v=this.cropRect.x-this.CANVAS_MARGIN+this.cropRect.width/2,C=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=v+"px "+C+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-v+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-C+this.CANVAS_MARGIN)+"px) scale("+this.zoomFactor+")",this.cropLayer.zoomFactor=this.zoomFactor)}},X.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)},X.prototype.cropRectChanged=function(v){this.cropRect=v,this.zoomToCropEnabled?this.zoomToCrop():this.cropLayer.zoomFactor=1},X.prototype.attachEvents=function(){window.addEventListener("resize",this.onWindowResize)},X.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"},X.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},X.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 v=this.styles.settings.hideTopToolbar?0:this.toolbarHeight,C=this.target.offsetTop>v+this.CANVAS_MARGIN?this.target.offsetTop-(v+this.CANVAS_MARGIN):0;this.coverDiv.style.top=C+"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},X.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},X.prototype.addTopToolbar=function(){var v=this;this.topToolbar=new Jt,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 C=new en;C.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(C);var U=[];this.aspectRatios.forEach(function(Wt){var Qt=new jt(tn.getIcon(Wt.horizontal,Wt.vertical),Wt.horizontal===0&&Wt.vertical===0?"FREE":Wt.horizontal+":"+Wt.vertical);Qt.onClick=function(){return v.ratioButtonClicked(Wt)},U.push(Qt)}),this.aspectRatioButton=new bi(tn.getIcon(0,0),"Aspect ratio",U),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,C.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var q=new jt('<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");q.isActive=this.isGridVisible,q.onClick=function(){v.isGridVisible=!v.isGridVisible,q.isActive=v.isGridVisible},C.addButton(q);var V=new jt('<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(V.isActive=this.zoomToCropEnabled,V.onClick=function(){v.zoomToCropEnabled=!v.zoomToCropEnabled,V.isActive=v.zoomToCropEnabled},C.addButton(V),!mi.isLicensed){var be=new mt;this.topToolbar.addElementBlock(be);var We=document.createElement("div");We.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var qe=document.createElement("a");qe.style.color="currentColor",qe.href="https://markerjs.com/products/cropro",qe.target="_blank",qe.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>',We.appendChild(qe),be.addElement(We)}var gt=new en;gt.minWidth=3*this.toolbarHeight+"px",gt.contentAlign="end",this.topToolbar.addButtonBlock(gt);var Ge=new jt('<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");Ge.onClick=this.startRenderAndClose,gt.addButton(Ge),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(Ge.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var xt=new jt('<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");xt.onClick=this.close,gt.addButton(xt),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(xt.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},X.prototype.addBottomToolbar=function(){var v=this;this.bottomToolbar=new Jt,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 C=new en;C.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(C);var U=new jt('<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");U.onClick=this.rotateLeftButtonClicked,C.addButton(U);var q=new jt('<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");q.onClick=this.rotateRightButtonClicked,C.addButton(q);var V=new mt;V.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(V),this.straightener=new Xi("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(gt){v.rotateBy(gt),v.straightener.angle=v.rotationAngle},V.addElement(this.straightener.getUI());var be=new en;be.minWidth=2*this.toolbarHeight+"px",be.contentAlign="end",this.bottomToolbar.addButtonBlock(be);var We=new jt('<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");We.onClick=this.flipHorizontallyButtonClicked,be.addButton(We);var qe=new jt('<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");qe.onClick=this.flipVerticallyButtonClicked,be.addButton(qe)},X.prototype.ratioButtonClicked=function(v){this.aspectRatio=v,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},X.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=tn.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},X.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new zi(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},X.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},X.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},X.prototype.restoreState=function(v){if(v){var C=this.cropLayer.getRescaledRect(v.width,v.height,this.imageWidth,this.imageHeight,v.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(C),this.cropRectChanged(C),this.flippedHorizontally=v.flippedHorizontally,this.flippedVertically=v.flippedVertically,this.applyFlip(),this.rotationAngle=v.rotationAngle,this.applyRotation()}},X.prototype.clientToLocalCoordinates=function(v,C){var U=this.cropImage.getBoundingClientRect();return{x:v-U.left,y:C-U.top}},X.prototype.onWindowResize=function(){this.positionUI()},X.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var v=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=v+"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()},X.prototype.rotateLeftButtonClicked=function(){var v=this.rotationAngle-90;this.rotationAngle%90!=0&&(v+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(v)},X.prototype.rotateRightButtonClicked=function(){var v=this.rotationAngle+90;this.rotationAngle%90!=0&&(v-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(v)},X.prototype.rotateTo=function(v){v=(v=v>180?v-360:v)<=-180?v+360:v,this.rotationAngle=v,this.applyRotation()},X.prototype.rotateBy=function(v){this.rotateTo((this.rotationAngle+v)%360)},X.prototype.applyRotation=function(){var v=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var C=this.editingTargetRotationContainer.transform.baseVal.getItem(0);C.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(C,0);var U=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/U.width,this.imageHeight/U.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=v},X.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},X.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},X.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},X.prototype.startRenderAndClose=function(){return Je(this,void 0,void 0,function(){var v,C;return li(this,function(U){switch(U.label){case 0:return[4,this.render()];case 1:return v=U.sent(),C=this.getState(),this.renderEventListeners.forEach(function(q){return q(v,C)}),this.close(!0),[2]}})})},X.prototype.render=function(){return Je(this,void 0,void 0,function(){var v;return li(this,function(C){switch(C.label){case 0:return(v=new pn).naturalSize=this.renderAtNaturalSize,v.imageType=this.renderImageType,v.imageQuality=this.renderImageQuality,v.width=this.renderWidth,v.height=this.renderHeight,this.unzoomFromCrop(),Qe.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,v.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 C.sent(),[4,v.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,C.sent()]}})})},X.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new kt("toolbar",`
width: `+(this.displayMode==="inline"?"100%":"calc(100vw - "+2*this.popupMargin+"px)")+`;
flex-shrink: 0;
display: flex;
flex-direction: row;
justify-content: space-between;
height: `+this.toolbarHeight+`px;
box-sizing: content-box;
overflow: hidden;
line-height: 0px;
`)),this.toolbarStyleColorsClass=this.styles.addClass(new kt("toolbar_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarBlockStyleClass=this.styles.addClass(new kt("toolbar-block",`
display: flex;
align-items: center;
box-sizing: content-box;
`));var v=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new kt("toolbar_button",`
display: inline-block;
width: `+(this.toolbarHeight-2*v)+`px;
height: `+(this.toolbarHeight-2*v)+`px;
padding: `+v+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new kt("toolbar_button_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new kt("toolbar_active_button",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
`)),this.styles.addRule(new It("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.toolbarHeight/2+`px;
`)),this.styles.addRule(new It("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new kt("toolbar_dropdown",`
position: absolute;
max-width: `+4*this.toolbarHeight+`px;
z-index: 20;
white-space: normal;
box-sizing: content-box;
box-shadow: 3px 3px rgba(33, 33, 33, 0.1);
margin: `+(this.displayMode==="inline"?"0":this.popupMargin)+`px;
line-height: 0px;
`)),this.toolbarDropdownStyleColorsClass=this.styles.addClass(new kt("toolbar_dropdown_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new kt("toolbar_straightener_block",`
display: flex;
overflow: hidden;
justify-content: center;
-webkit-mask-image: linear-gradient(90deg, rgba(0,0,0,0) 0%, rgba(0,0,0,1) 30%, rgba(0,0,0,1) 70%, rgba(0,0,0,0) 100%);
`)),this.toolbarStraightenerStyleClass=this.styles.addClass(new kt("toolbar_straightener",`
display: flex;
overflow: hidden;
justify-content: center;
height: `+(this.toolbarHeight-2*v)+`px;
padding: `+v+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new kt("toolbar_straightener_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`))},X.instanceCounter=0,X}(),Ct=le("8hTe"),mn=le.n(Ct),gn=/<pre[^>]*>/g;function vn(X){var v=document.createElement("div");return v.innerHTML=X,v.childNodes.length===0?"":v.childNodes[0].nodeValue}var yn=ot.a=function(X){var v=X.value,C=v===void 0?"":v,U=X.edit,q=U===void 0?!1:U,V=X.className,be=X.showTextOnly,We=X.showLines,qe=X.replaces,gt=X.zoomImg,Ge=X.hasMask,xt=X.style,Wt=xt===void 0?{}:xt,Qt=X.stylesPrev,Ni=Qt===void 0?{}:Qt,_i=String(C),Ei=Object(R.useRef)(),Yi=Object(R.useRef)(),kn=Object(R.useState)(""),ui=Object(K.a)(kn,2),ji=ui[0],ln=ui[1],un=Object(R.useState)("office"),Fi=Object(K.a)(un,2),Dn=Fi[0],bn=Fi[1],Kn=function(){var Gt=new Ve(Yi.current);Gt.displayMode="popup",Gt.addRenderEventListener(function(){var gi=Object(N.a)(P.a.mark(function Nt(ni){var Vt;return P.a.wrap(function(hi){for(;;)switch(hi.prev=hi.next){case 0:return Ei.current.style.display="none",hi.next=3,Object(we.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:ni}});case 3:Vt=hi.sent,Vt!=null&&Vt.id&&qe(Yi.current.getAttribute("src").replace(Y.a.API_SERVER,""),"/api/attachments/".concat(Vt==null?void 0:Vt.id,"?type=").concat(Vt.content_type));case 5:case"end":return hi.stop()}},Nt)}));return function(Nt){return gi.apply(this,arguments)}}()),Gt.show()},Vn=function(){var Gt=new vt(Yi.current);Gt.settings.displayMode="popup",Gt.addEventListener("render",function(){var gi=Object(N.a)(P.a.mark(function Nt(ni){var Vt;return P.a.wrap(function(hi){for(;;)switch(hi.prev=hi.next){case 0:if(Ei.current.style.display="none",!Yi.current){hi.next=6;break}return hi.next=4,Object(we.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:ni.dataUrl}});case 4:Vt=hi.sent,Vt!=null&&Vt.id&&qe(Yi.current.getAttribute("src").replace(Y.a.API_SERVER,""),"/api/attachments/".concat(Vt==null?void 0:Vt.id,"?type=").concat(Vt.content_type));case 6:case"end":return hi.stop()}},Nt)}));return function(Nt){return gi.apply(this,arguments)}}()),Gt.show(),window.markerArea=Gt},$i=Object(R.useMemo)(function(){Ei.current&&(Ei.current.style.zIndex=-1);try{var ti=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,Gt=/\"\/api\/attachments\/|\"\/attachments\/download\//g,gi=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;_i=_i.replace(ti,"("+Y.a.API_SERVER+"/api/attachments/").replace(Gt,'"'+Y.a.API_SERVER+"/api/attachments/").replace(gi,'"'+Y.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(nn){}var Nt=H(_i),ni=b();if(_i.match(/\[TOC\]/)&&(Nt=Nt.replace("<p>[TOC]</p>",O()),L()),Nt=Nt.replace(/(__special_katext_id_\d+__)/g,function(nn,hi){var Ci=ni[hi],Xn=Ci.type,xn=Ci.expression;return Object(ie.renderToString)(vn(xn)||"",{displayMode:Xn==="block",throwOnError:!1,output:"html"})}),Nt=Nt.replace(/▁/g,"\u2581\u2581\u2581"),g(),be){var Vt=document.createElement("div");return Vt.innerHTML=Nt,Vt.innerText}return setTimeout(function(){return dr()},500),Nt},[_i]),Ki=Object(R.useRef)();w.WebkitLineClamp=We,We&&(Wt=Object(B.a)(Object(B.a)({},Wt),w));function _n(ti){var Gt=ti.target;if(Gt.tagName.toUpperCase()==="IMG"){if(gt){var gi=Gt.getAttribute("src");ln(gi),bn("image")}}else if(Gt.tagName.toUpperCase()==="A"){var Nt=Gt.getAttribute("href");if(Nt.indexOf("office")>-1)ti.preventDefault(),ln(Nt),bn("office");else if(Nt.indexOf("application/pdf")>-1)ti.preventDefault(),ln(Nt),bn("pdf");else if(Nt.indexOf("text/html")>-1)ti.preventDefault(),ln(Nt),bn("html");else if(Nt.startsWith("#")){ti.preventDefault();var ni=document.getElementById(Nt.replace("#",""));ni&&ni.scrollIntoView(!0)}}}var dr=function(){var Gt,gi=(Gt=Ki.current)===null||Gt===void 0?void 0:Gt.querySelectorAll("video");gi==null||gi.forEach(function(Nt){if(Nt.oncontextmenu=function(){return!1},Nt.src.indexOf(".m3u8")>-1&&!Nt.canPlayType("application/vnd.apple.mpegurl")){if(G.a.isSupported()){var ni=new G.a;ni.loadSource(Nt.src),ni.attachMedia(Nt)}}})};Object(R.useEffect)(function(){if(Ki.current&&$i&&($i.match(gn)&&window.PR.prettyPrint()),Ki.current)return Ki.current.addEventListener("click",_n),function(){Ki.current.removeEventListener("click",_n),g(),L()}},[$i,Ki.current,_n]);var En=function(Gt){if(!q)return;Gt.target.nodeName==="IMG"?(Ei.current.style.zIndex=1,Ei.current.style.display="flex",Ei.current.style.width=Gt.target.clientWidth+"px",Ei.current.style.height=Gt.target.clientHeight+"px",Ei.current.style.top=Gt.target.offsetTop+"px",Ei.current.style.left=Gt.target.offsetLeft+"px",Yi.current.src=Gt.target.getAttribute("src")):Ei.current.style.display="none"};return m.a.createElement("div",{style:{position:"relative"}},m.a.createElement("div",{ref:Ki,style:Object(B.a)({},Wt),className:"".concat(V||""," markdown-body ").concat(mn.a.mdBody),onMouseOver:En,dangerouslySetInnerHTML:{__html:$i}}),m.a.createElement("div",{ref:Ei,className:mn.a.button},m.a.createElement(Z.a,null,m.a.createElement(Q.a,{onClick:function(){return Kn()}},"\u88C1\u526A"),m.a.createElement(Q.a,{onClick:function(){return Vn()}},"\u7F16\u8F91"))),m.a.createElement("img",{ref:Yi,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),m.a.createElement(se.a,{close:!0,data:ji,type:ji!=null&&ji.length?Dn:"",style:Object(B.a)({},Ni),onClose:function(){return ln("")}}))}},"9VGf":function(_t,ot,le){"use strict";le.d(ot,"a",function(){return M});var ue=le("q1tI"),Z=le.n(ue);function M(Q,B){var N=Object(ue.useRef)();Object(ue.useEffect)(function(){N.current=Q}),Object(ue.useEffect)(function(){function K(){N.current()}if(B!==null){var W=setInterval(K,B);return function(){return clearInterval(W)}}},[B])}},BU3w:function(_t,ot,le){"use strict";le.d(ot,"a",function(){return N});var ue=le("MNnm"),Z="rc-util-key";function M(K){if(K.attachTo)return K.attachTo;var W=document.querySelector("head");return W||document.body}function Q(K){var W,P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(ue.a)())return null;var R=document.createElement("style");if((W=P.csp)===null||W===void 0?void 0:W.nonce){var m;R.nonce=(m=P.csp)===null||m===void 0?void 0:m.nonce}R.innerHTML=K;var p=M(P),f=p.firstChild;return P.prepend&&p.prepend?p.prepend(R):P.prepend&&f?p.insertBefore(R,f):p.appendChild(R),R}var B=new Map;function N(K,W){var P=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},R=M(P);if(!B.has(R)){var m=Q("",P),p=m.parentNode;B.set(R,p),p.removeChild(m)}var f=Array.from(B.get(R).children).find(function(a){return a.tagName==="STYLE"&&a[Z]===W});if(f){var h,s;if(((h=P.csp)===null||h===void 0?void 0:h.nonce)&&f.nonce!==((s=P.csp)===null||s===void 0?void 0:s.nonce)){var u;f.nonce=(u=P.csp)===null||u===void 0?void 0:u.nonce}return f.innerHTML!==K&&(f.innerHTML=K),f}var l=Q(K,P);return l[Z]=W,l}},Bd2K:function(_t,ot,le){(function(ue){ue(le("VrN/"),le("osHv"))})(function(ue){ue.defineOption("autoCloseTags",!1,function(P,R,m){if(m!=ue.Init&&m&&P.removeKeyMap("autoCloseTags"),!R)return;var p={name:"autoCloseTags"};(typeof R!="object"||R.whenClosing!==!1)&&(p["'/'"]=function(f){return N(f)}),(typeof R!="object"||R.whenOpening!==!1)&&(p["'>'"]=function(f){return Q(f)}),P.addKeyMap(p)});var Z=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],M=["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 Q(P){if(P.getOption("disableInput"))return ue.Pass;for(var R=P.listSelections(),m=[],p=P.getOption("autoCloseTags"),f=0;f<R.length;f++){if(!R[f].empty())return ue.Pass;var h=R[f].head,s=P.getTokenAt(h),u=ue.innerMode(P.getMode(),s.state),l=u.state,a=u.mode.xmlCurrentTag&&u.mode.xmlCurrentTag(l),o=a&&a.name;if(!o)return ue.Pass;var c=u.mode.configuration=="html",L=typeof p=="object"&&p.dontCloseTags||c&&Z,w=typeof p=="object"&&p.indentTags||c&&M;s.end>h.ch&&(o=o.slice(0,o.length-s.end+h.ch));var T=o.toLowerCase();if(!o||s.type=="string"&&(s.end!=h.ch||!/[\"\']/.test(s.string.charAt(s.string.length-1))||s.string.length==1)||s.type=="tag"&&a.close||s.string.indexOf("/")==h.ch-s.start-1||L&&K(L,T)>-1||W(P,u.mode.xmlCurrentContext&&u.mode.xmlCurrentContext(l)||[],o,h,!0))return ue.Pass;var O=typeof p=="object"&&p.emptyTags;if(O&&K(O,o)>-1){m[f]={text:"/>",newPos:ue.Pos(h.line,h.ch+2)};continue}var A=w&&K(w,T)>-1;m[f]={indent:A,text:">"+(A?`
`:"")+"</"+o+">",newPos:A?ue.Pos(h.line+1,0):ue.Pos(h.line,h.ch+1)}}for(var x=typeof p=="object"&&p.dontIndentOnAutoClose,f=R.length-1;f>=0;f--){var S=m[f];P.replaceRange(S.text,R[f].head,R[f].anchor,"+insert");var E=P.listSelections().slice(0);E[f]={head:S.newPos,anchor:S.newPos},P.setSelections(E),!x&&S.indent&&(P.indentLine(S.newPos.line,null,!0),P.indentLine(S.newPos.line+1,null,!0))}}function B(P,R){for(var m=P.listSelections(),p=[],f=R?"/":"</",h=P.getOption("autoCloseTags"),s=typeof h=="object"&&h.dontIndentOnSlash,u=0;u<m.length;u++){if(!m[u].empty())return ue.Pass;var l=m[u].head,a=P.getTokenAt(l),o=ue.innerMode(P.getMode(),a.state),c=o.state;if(R&&(a.type=="string"||a.string.charAt(0)!="<"||a.start!=l.ch-1))return ue.Pass;var L,w=o.mode.name!="xml"&&P.getMode().name=="htmlmixed";if(w&&o.mode.name=="javascript")L=f+"script";else if(w&&o.mode.name=="css")L=f+"style";else{var T=o.mode.xmlCurrentContext&&o.mode.xmlCurrentContext(c);if(!T||T.length&&W(P,T,T[T.length-1],l))return ue.Pass;L=f+T[T.length-1]}P.getLine(l.line).charAt(a.end)!=">"&&(L+=">"),p[u]=L}if(P.replaceSelections(p),m=P.listSelections(),!s)for(var u=0;u<m.length;u++)(u==m.length-1||m[u].head.line<m[u+1].head.line)&&P.indentLine(m[u].head.line)}function N(P){return P.getOption("disableInput")?ue.Pass:B(P,!0)}ue.commands.closeTag=function(P){return B(P)};function K(P,R){if(P.indexOf)return P.indexOf(R);for(var m=0,p=P.length;m<p;++m)if(P[m]==R)return m;return-1}function W(P,R,m,p,f){if(!ue.scanForClosingTag)return!1;var h=Math.min(P.lastLine()+1,p.line+500),s=ue.scanForClosingTag(P,p,null,h);if(!s||s.tag!=m)return!1;for(var u=f?1:0,l=R.length-1;l>=0&&R[l]==m;l--)++u;p=s.to;for(var l=1;l<u;l++){var a=ue.scanForClosingTag(P,p,null,h);if(!a||a.tag!=m)return!1;p=a.to}return!0}})},BjJ7:function(_t,ot,le){"use strict";le.d(ot,"d",function(){return Z}),le.d(ot,"c",function(){return M}),le.d(ot,"e",function(){return Q}),le.d(ot,"b",function(){return B}),le.d(ot,"a",function(){return K});var ue=le("m3rI");function Z(W){var P=!0;if(W.length>0){for(var R=0;R<W.length;R++)if(W[R].compile_success==0||!W[R].compile_success){P=!1;break}}else P=!1;return P}function M(W){for(var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",R=[],m=0;m<W.length;m++){var p=W[m],f=P?"".concat(P,"/").concat(p.name):"".concat(p.name);R.push({title:p.name,isLeaf:!(p.type==="tree"),key:f})}return R}function Q(W,P,R){for(var m=0;m<W.length;m++){var p=W[m];if(p.key===P){p.children=R;break}p.children&&Q(p.children,P,R)}return W}function B(W,P,R){var m;return function(){var p=this,f=arguments,h=function(){m=null,R||W.apply(p,f)},s=R&&!m;clearTimeout(m),m=setTimeout(h,P),s&&W.apply(p,f)}}var N=!0,K=ue.a.API_SERVER},"C+DQ":function(_t,ot,le){},DlQD:function(_t,ot,le){(function(ue,Z){_t.exports=Z()})(this,function(){"use strict";function ue(xe,ye){for(var _e=0;_e<ye.length;_e++){var ne=ye[_e];ne.enumerable=ne.enumerable||!1,ne.configurable=!0,"value"in ne&&(ne.writable=!0),Object.defineProperty(xe,ne.key,ne)}}function Z(xe,ye,_e){return ye&&ue(xe.prototype,ye),_e&&ue(xe,_e),xe}function M(xe,ye){if(!xe)return;if(typeof xe=="string")return Q(xe,ye);var _e=Object.prototype.toString.call(xe).slice(8,-1);if(_e==="Object"&&xe.constructor&&(_e=xe.constructor.name),_e==="Map"||_e==="Set")return Array.from(xe);if(_e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(_e))return Q(xe,ye)}function Q(xe,ye){(ye==null||ye>xe.length)&&(ye=xe.length);for(var _e=0,ne=new Array(ye);_e<ye;_e++)ne[_e]=xe[_e];return ne}function B(xe,ye){var _e;if(typeof Symbol=="undefined"||xe[Symbol.iterator]==null){if(Array.isArray(xe)||(_e=M(xe))||ye&&xe&&typeof xe.length=="number"){_e&&(xe=_e);var ne=0;return function(){return ne>=xe.length?{done:!0}:{done:!1,value:xe[ne++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}return _e=xe[Symbol.iterator](),_e.next.bind(_e)}function N(xe,ye){return ye={exports:{}},xe(ye,ye.exports),ye.exports}var K=N(function(xe){function ye(){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 _e(ne){xe.exports.defaults=ne}xe.exports={defaults:ye(),getDefaults:ye,changeDefaults:_e}}),W=K.defaults,P=K.getDefaults,R=K.changeDefaults,m=/[&<>"']/,p=/[&<>"']/g,f=/[<>"']|&(?!#?\w+;)/,h=/[<>"']|&(?!#?\w+;)/g,s={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},u=function(ye){return s[ye]};function l(xe,ye){if(ye){if(m.test(xe))return xe.replace(p,u)}else if(f.test(xe))return xe.replace(h,u);return xe}var a=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function o(xe){return xe.replace(a,function(ye,_e){return _e=_e.toLowerCase(),_e==="colon"?":":_e.charAt(0)==="#"?_e.charAt(1)==="x"?String.fromCharCode(parseInt(_e.substring(2),16)):String.fromCharCode(+_e.substring(1)):""})}var c=/(^|[^\[])\^/g;function L(xe,ye){xe=xe.source||xe,ye=ye||"";var _e={replace:function(re,de){return de=de.source||de,de=de.replace(c,"$1"),xe=xe.replace(re,de),_e},getRegex:function(){return new RegExp(xe,ye)}};return _e}var w=/[^\w:]/g,T=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function O(xe,ye,_e){if(xe){var ne;try{ne=decodeURIComponent(o(_e)).replace(w,"").toLowerCase()}catch(re){return null}if(ne.indexOf("javascript:")===0||ne.indexOf("vbscript:")===0||ne.indexOf("data:")===0)return null}ye&&!T.test(_e)&&(_e=d(ye,_e));try{_e=encodeURI(_e).replace(/%25/g,"%")}catch(re){return null}return _e}var A={},x=/^[^:]+:\/*[^/]*$/,S=/^([^:]+:)[\s\S]*$/,E=/^([^:]+:\/*[^/]*)[\s\S]*$/;function d(xe,ye){A[" "+xe]||(x.test(xe)?A[" "+xe]=xe+"/":A[" "+xe]=F(xe,"/",!0)),xe=A[" "+xe];var _e=xe.indexOf(":")===-1;return ye.substring(0,2)==="//"?_e?ye:xe.replace(S,"$1")+ye:ye.charAt(0)==="/"?_e?ye:xe.replace(E,"$1")+ye:xe+ye}var b={exec:function(){}};function g(xe){for(var ye=1,_e,ne;ye<arguments.length;ye++){_e=arguments[ye];for(ne in _e)Object.prototype.hasOwnProperty.call(_e,ne)&&(xe[ne]=_e[ne])}return xe}function _(xe,ye){var _e=xe.replace(/\|/g,function(de,me,Ee){for(var Me=!1,je=me;--je>=0&&Ee[je]==="\\";)Me=!Me;return Me?"|":" |"}),ne=_e.split(/ \|/),re=0;if(ne.length>ye)ne.splice(ye);else for(;ne.length<ye;)ne.push("");for(;re<ne.length;re++)ne[re]=ne[re].trim().replace(/\\\|/g,"|");return ne}function F(xe,ye,_e){var ne=xe.length;if(ne===0)return"";for(var re=0;re<ne;){var de=xe.charAt(ne-re-1);if(de===ye&&!_e)re++;else if(de!==ye&&_e)re++;else break}return xe.substr(0,ne-re)}function D(xe,ye){if(xe.indexOf(ye[1])===-1)return-1;for(var _e=xe.length,ne=0,re=0;re<_e;re++)if(xe[re]==="\\")re++;else if(xe[re]===ye[0])ne++;else if(xe[re]===ye[1]&&(ne--,ne<0))return re;return-1}function j(xe){xe&&xe.sanitize&&!xe.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 H={escape:l,unescape:o,edit:L,cleanUrl:O,resolveUrl:d,noopTest:b,merge:g,splitCells:_,rtrim:F,findClosingBracket:D,checkSanitizeDeprecation:j},k=K.defaults,y=H.rtrim,G=H.splitCells,Y=H.escape,ie=H.findClosingBracket;function se(xe,ye,_e){var ne=ye.href,re=ye.title?Y(ye.title):null,de=xe[1].replace(/\\([\[\]])/g,"$1");return xe[0].charAt(0)!=="!"?{type:"link",raw:_e,href:ne,title:re,text:de}:{type:"image",raw:_e,href:ne,title:re,text:Y(de)}}function we(xe,ye){var _e=xe.match(/^(\s+)(?:```)/);if(_e===null)return ye;var ne=_e[1];return ye.split(`
`).map(function(re){var de=re.match(/^\s+/);if(de===null)return re;var me=de[0];return me.length>=ne.length?re.slice(ne.length):re}).join(`
`)}var ve=function(){function xe(_e){this.options=_e||k}var ye=xe.prototype;return ye.space=function(ne){var re=this.rules.block.newline.exec(ne);if(re)return re[0].length>1?{type:"space",raw:re[0]}:{raw:`
`}},ye.code=function(ne,re){var de=this.rules.block.code.exec(ne);if(de){var me=re[re.length-1];if(me&&me.type==="paragraph")return{raw:de[0],text:de[0].trimRight()};var Ee=de[0].replace(/^ {4}/gm,"");return{type:"code",raw:de[0],codeBlockStyle:"indented",text:this.options.pedantic?Ee:y(Ee,`
`)}}},ye.fences=function(ne){var re=this.rules.block.fences.exec(ne);if(re){var de=re[0],me=we(de,re[3]||"");return{type:"code",raw:de,lang:re[2]?re[2].trim():re[2],text:me}}},ye.heading=function(ne){var re=this.rules.block.heading.exec(ne);if(re)return{type:"heading",raw:re[0],depth:re[1].length,text:re[2]}},ye.nptable=function(ne){var re=this.rules.block.nptable.exec(ne);if(re){var de={type:"table",header:G(re[1].replace(/^ *| *\| *$/g,"")),align:re[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:re[3]?re[3].replace(/\n$/,"").split(`
`):[],raw:re[0]};if(de.header.length===de.align.length){var me=de.align.length,Ee;for(Ee=0;Ee<me;Ee++)/^ *-+: *$/.test(de.align[Ee])?de.align[Ee]="right":/^ *:-+: *$/.test(de.align[Ee])?de.align[Ee]="center":/^ *:-+ *$/.test(de.align[Ee])?de.align[Ee]="left":de.align[Ee]=null;for(me=de.cells.length,Ee=0;Ee<me;Ee++)de.cells[Ee]=G(de.cells[Ee],de.header.length);return de}}},ye.hr=function(ne){var re=this.rules.block.hr.exec(ne);if(re)return{type:"hr",raw:re[0]}},ye.blockquote=function(ne){var re=this.rules.block.blockquote.exec(ne);if(re){var de=re[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:re[0],text:de}}},ye.list=function(ne){var re=this.rules.block.list.exec(ne);if(re){for(var de=re[0],me=re[2],Ee=me.length>1,Me=me[me.length-1]===")",je={type:"list",raw:de,ordered:Ee,start:Ee?+me.slice(0,-1):"",loose:!1,items:[]},it=re[0].match(this.rules.block.item),ft=!1,ct,At,wt,dt,Ut,vt,Rt,Lt=it.length,Je=0;Je<Lt;Je++)ct=it[Je],de=ct,At=ct.length,ct=ct.replace(/^ *([*+-]|\d+[.)]) */,""),~ct.indexOf(`
`)&&(At-=ct.length,ct=this.options.pedantic?ct.replace(/^ {1,4}/gm,""):ct.replace(new RegExp("^ {1,"+At+"}","gm"),"")),Je!==Lt-1&&(wt=this.rules.block.bullet.exec(it[Je+1])[0],(Ee?wt.length===1||!Me&&wt[wt.length-1]===")":wt.length>1||this.options.smartLists&&wt!==me)&&(dt=it.slice(Je+1).join(`
`),je.raw=je.raw.substring(0,je.raw.length-dt.length),Je=Lt-1)),Ut=ft||/\n\n(?!\s*$)/.test(ct),Je!==Lt-1&&(ft=ct.charAt(ct.length-1)===`
`,Ut||(Ut=ft)),Ut&&(je.loose=!0),vt=/^\[[ xX]\] /.test(ct),Rt=void 0,vt&&(Rt=ct[1]!==" ",ct=ct.replace(/^\[[ xX]\] +/,"")),je.items.push({type:"list_item",raw:de,task:vt,checked:Rt,loose:Ut,text:ct});return je}},ye.html=function(ne){var re=this.rules.block.html.exec(ne);if(re)return{type:this.options.sanitize?"paragraph":"html",raw:re[0],pre:!this.options.sanitizer&&(re[1]==="pre"||re[1]==="script"||re[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(re[0]):Y(re[0]):re[0]}},ye.def=function(ne){var re=this.rules.block.def.exec(ne);if(re){re[3]&&(re[3]=re[3].substring(1,re[3].length-1));var de=re[1].toLowerCase().replace(/\s+/g," ");return{tag:de,raw:re[0],href:re[2],title:re[3]}}},ye.table=function(ne){var re=this.rules.block.table.exec(ne);if(re){var de={type:"table",header:G(re[1].replace(/^ *| *\| *$/g,"")),align:re[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:re[3]?re[3].replace(/\n$/,"").split(`
`):[]};if(de.header.length===de.align.length){de.raw=re[0];var me=de.align.length,Ee;for(Ee=0;Ee<me;Ee++)/^ *-+: *$/.test(de.align[Ee])?de.align[Ee]="right":/^ *:-+: *$/.test(de.align[Ee])?de.align[Ee]="center":/^ *:-+ *$/.test(de.align[Ee])?de.align[Ee]="left":de.align[Ee]=null;for(me=de.cells.length,Ee=0;Ee<me;Ee++)de.cells[Ee]=G(de.cells[Ee].replace(/^ *\| *| *\| *$/g,""),de.header.length);return de}}},ye.lheading=function(ne){var re=this.rules.block.lheading.exec(ne);if(re)return{type:"heading",raw:re[0],depth:re[2].charAt(0)==="="?1:2,text:re[1]}},ye.paragraph=function(ne){var re=this.rules.block.paragraph.exec(ne);if(re)return{type:"paragraph",raw:re[0],text:re[1].charAt(re[1].length-1)===`
`?re[1].slice(0,-1):re[1]}},ye.text=function(ne,re){var de=this.rules.block.text.exec(ne);if(de){var me=re[re.length-1];return me&&me.type==="text"?{raw:de[0],text:de[0]}:{type:"text",raw:de[0],text:de[0]}}},ye.escape=function(ne){var re=this.rules.inline.escape.exec(ne);if(re)return{type:"escape",raw:re[0],text:Y(re[1])}},ye.tag=function(ne,re,de){var me=this.rules.inline.tag.exec(ne);if(me)return!re&&/^<a /i.test(me[0])?re=!0:re&&/^<\/a>/i.test(me[0])&&(re=!1),!de&&/^<(pre|code|kbd|script)(\s|>)/i.test(me[0])?de=!0:de&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(me[0])&&(de=!1),{type:this.options.sanitize?"text":"html",raw:me[0],inLink:re,inRawBlock:de,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(me[0]):Y(me[0]):me[0]}},ye.link=function(ne){var re=this.rules.inline.link.exec(ne);if(re){var de=ie(re[2],"()");if(de>-1){var me=re[0].indexOf("!")===0?5:4,Ee=me+re[1].length+de;re[2]=re[2].substring(0,de),re[0]=re[0].substring(0,Ee).trim(),re[3]=""}var Me=re[2],je="";if(this.options.pedantic){var it=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Me);it?(Me=it[1],je=it[3]):je=""}else je=re[3]?re[3].slice(1,-1):"";Me=Me.trim().replace(/^<([\s\S]*)>$/,"$1");var ft=se(re,{href:Me&&Me.replace(this.rules.inline._escapes,"$1"),title:je&&je.replace(this.rules.inline._escapes,"$1")},re[0]);return ft}},ye.reflink=function(ne,re){var de;if((de=this.rules.inline.reflink.exec(ne))||(de=this.rules.inline.nolink.exec(ne))){var me=(de[2]||de[1]).replace(/\s+/g," ");if(me=re[me.toLowerCase()],!me||!me.href){var Ee=de[0].charAt(0);return{type:"text",raw:Ee,text:Ee}}var Me=se(de,me,de[0]);return Me}},ye.strong=function(ne,re,de){de===void 0&&(de="");var me=this.rules.inline.strong.start.exec(ne);if(me&&(!me[1]||me[1]&&(de===""||this.rules.inline.punctuation.exec(de)))){re=re.slice(-1*ne.length);var Ee=me[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;Ee.lastIndex=0;for(var Me;(me=Ee.exec(re))!=null;)if(Me=this.rules.inline.strong.middle.exec(re.slice(0,me.index+3)),Me)return{type:"strong",raw:ne.slice(0,Me[0].length),text:ne.slice(2,Me[0].length-2)}}},ye.em=function(ne,re,de){de===void 0&&(de="");var me=this.rules.inline.em.start.exec(ne);if(me&&(!me[1]||me[1]&&(de===""||this.rules.inline.punctuation.exec(de)))){re=re.slice(-1*ne.length);var Ee=me[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;Ee.lastIndex=0;for(var Me;(me=Ee.exec(re))!=null;)if(Me=this.rules.inline.em.middle.exec(re.slice(0,me.index+2)),Me)return{type:"em",raw:ne.slice(0,Me[0].length),text:ne.slice(1,Me[0].length-1)}}},ye.codespan=function(ne){var re=this.rules.inline.code.exec(ne);if(re){var de=re[2].replace(/\n/g," "),me=/[^ ]/.test(de),Ee=de.startsWith(" ")&&de.endsWith(" ");return me&&Ee&&(de=de.substring(1,de.length-1)),de=Y(de,!0),{type:"codespan",raw:re[0],text:de}}},ye.br=function(ne){var re=this.rules.inline.br.exec(ne);if(re)return{type:"br",raw:re[0]}},ye.del=function(ne){var re=this.rules.inline.del.exec(ne);if(re)return{type:"del",raw:re[0],text:re[1]}},ye.autolink=function(ne,re){var de=this.rules.inline.autolink.exec(ne);if(de){var me,Ee;return de[2]==="@"?(me=Y(this.options.mangle?re(de[1]):de[1]),Ee="mailto:"+me):(me=Y(de[1]),Ee=me),{type:"link",raw:de[0],text:me,href:Ee,tokens:[{type:"text",raw:me,text:me}]}}},ye.url=function(ne,re){var de;if(de=this.rules.inline.url.exec(ne)){var me,Ee;if(de[2]==="@")me=Y(this.options.mangle?re(de[0]):de[0]),Ee="mailto:"+me;else{var Me;do Me=de[0],de[0]=this.rules.inline._backpedal.exec(de[0])[0];while(Me!==de[0]);me=Y(de[0]),de[1]==="www."?Ee="http://"+me:Ee=me}return{type:"link",raw:de[0],text:me,href:Ee,tokens:[{type:"text",raw:me,text:me}]}}},ye.inlineText=function(ne,re,de){var me=this.rules.inline.text.exec(ne);if(me){var Ee;return re?Ee=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(me[0]):Y(me[0]):me[0]:Ee=Y(this.options.smartypants?de(me[0]):me[0]),{type:"text",raw:me[0],text:Ee}}},xe}(),Se=H.noopTest,Ce=H.edit,pe=H.merge,fe={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:Se,table:Se,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};fe._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,fe._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,fe.def=Ce(fe.def).replace("label",fe._label).replace("title",fe._title).getRegex(),fe.bullet=/(?:[*+-]|\d{1,9}[.)])/,fe.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,fe.item=Ce(fe.item,"gm").replace(/bull/g,fe.bullet).getRegex(),fe.list=Ce(fe.list).replace(/bull/g,fe.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+fe.def.source+")").getRegex(),fe._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",fe._comment=/<!--(?!-?>)[\s\S]*?-->/,fe.html=Ce(fe.html,"i").replace("comment",fe._comment).replace("tag",fe._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),fe.paragraph=Ce(fe._paragraph).replace("hr",fe.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",fe._tag).getRegex(),fe.blockquote=Ce(fe.blockquote).replace("paragraph",fe.paragraph).getRegex(),fe.normal=pe({},fe),fe.gfm=pe({},fe.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*|$)"}),fe.gfm.nptable=Ce(fe.gfm.nptable).replace("hr",fe.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",fe._tag).getRegex(),fe.gfm.table=Ce(fe.gfm.table).replace("hr",fe.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",fe._tag).getRegex(),fe.pedantic=pe({},fe.normal,{html:Ce(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",fe._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:Se,paragraph:Ce(fe.normal._paragraph).replace("hr",fe.hr).replace("heading",` *#{1,6} *[^
]`).replace("lheading",fe.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var oe={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Se,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:Se,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};oe._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",oe.punctuation=Ce(oe.punctuation).replace(/punctuation/g,oe._punctuation).getRegex(),oe._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",oe._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",oe.em.start=Ce(oe.em.start).replace(/punctuation/g,oe._punctuation).getRegex(),oe.em.middle=Ce(oe.em.middle).replace(/punctuation/g,oe._punctuation).replace(/overlapSkip/g,oe._overlapSkip).getRegex(),oe.em.endAst=Ce(oe.em.endAst,"g").replace(/punctuation/g,oe._punctuation).getRegex(),oe.em.endUnd=Ce(oe.em.endUnd,"g").replace(/punctuation/g,oe._punctuation).getRegex(),oe.strong.start=Ce(oe.strong.start).replace(/punctuation/g,oe._punctuation).getRegex(),oe.strong.middle=Ce(oe.strong.middle).replace(/punctuation/g,oe._punctuation).replace(/blockSkip/g,oe._blockSkip).getRegex(),oe.strong.endAst=Ce(oe.strong.endAst,"g").replace(/punctuation/g,oe._punctuation).getRegex(),oe.strong.endUnd=Ce(oe.strong.endUnd,"g").replace(/punctuation/g,oe._punctuation).getRegex(),oe.blockSkip=Ce(oe._blockSkip,"g").getRegex(),oe.overlapSkip=Ce(oe._overlapSkip,"g").getRegex(),oe._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,oe._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,oe._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])?)+(?![-_])/,oe.autolink=Ce(oe.autolink).replace("scheme",oe._scheme).replace("email",oe._email).getRegex(),oe._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,oe.tag=Ce(oe.tag).replace("comment",fe._comment).replace("attribute",oe._attribute).getRegex(),oe._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,oe._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,oe._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,oe.link=Ce(oe.link).replace("label",oe._label).replace("href",oe._href).replace("title",oe._title).getRegex(),oe.reflink=Ce(oe.reflink).replace("label",oe._label).getRegex(),oe.reflinkSearch=Ce(oe.reflinkSearch,"g").replace("reflink",oe.reflink).replace("nolink",oe.nolink).getRegex(),oe.normal=pe({},oe),oe.pedantic=pe({},oe.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:Ce(/^!?\[(label)\]\((.*?)\)/).replace("label",oe._label).getRegex(),reflink:Ce(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",oe._label).getRegex()}),oe.gfm=pe({},oe.normal,{escape:Ce(oe.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.!#$%&'*+\/=?_`{\|}~-]+@))/}),oe.gfm.url=Ce(oe.gfm.url,"i").replace("email",oe.gfm._extended_email).getRegex(),oe.breaks=pe({},oe.gfm,{br:Ce(oe.br).replace("{2,}","*").getRegex(),text:Ce(oe.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var te={block:fe,inline:oe},he=K.defaults,ae=te.block,Ae=te.inline;function ke(xe){return xe.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 Te(xe){var ye="",_e,ne,re=xe.length;for(_e=0;_e<re;_e++)ne=xe.charCodeAt(_e),Math.random()>.5&&(ne="x"+ne.toString(16)),ye+="&#"+ne+";";return ye}var Le=function(){function xe(_e){this.tokens=[],this.tokens.links=Object.create(null),this.options=_e||he,this.options.tokenizer=this.options.tokenizer||new ve,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var ne={block:ae.normal,inline:Ae.normal};this.options.pedantic?(ne.block=ae.pedantic,ne.inline=Ae.pedantic):this.options.gfm&&(ne.block=ae.gfm,this.options.breaks?ne.inline=Ae.breaks:ne.inline=Ae.gfm),this.tokenizer.rules=ne}xe.lex=function(ne,re){var de=new xe(re);return de.lex(ne)};var ye=xe.prototype;return ye.lex=function(ne){return ne=ne.replace(/\r\n|\r/g,`
`).replace(/\t/g," "),this.blockTokens(ne,this.tokens,!0),this.inline(this.tokens),this.tokens},ye.blockTokens=function(ne,re,de){re===void 0&&(re=[]),de===void 0&&(de=!0),ne=ne.replace(/^ +$/gm,"");for(var me,Ee,Me,je;ne;){if(me=this.tokenizer.space(ne)){ne=ne.substring(me.raw.length),me.type&&re.push(me);continue}if(me=this.tokenizer.code(ne,re)){ne=ne.substring(me.raw.length),me.type?re.push(me):(je=re[re.length-1],je.raw+=`
`+me.raw,je.text+=`
`+me.text);continue}if(me=this.tokenizer.fences(ne)){ne=ne.substring(me.raw.length),re.push(me);continue}if(me=this.tokenizer.heading(ne)){ne=ne.substring(me.raw.length),re.push(me);continue}if(me=this.tokenizer.nptable(ne)){ne=ne.substring(me.raw.length),re.push(me);continue}if(me=this.tokenizer.hr(ne)){ne=ne.substring(me.raw.length),re.push(me);continue}if(me=this.tokenizer.blockquote(ne)){ne=ne.substring(me.raw.length),me.tokens=this.blockTokens(me.text,[],de),re.push(me);continue}if(me=this.tokenizer.list(ne)){for(ne=ne.substring(me.raw.length),Me=me.items.length,Ee=0;Ee<Me;Ee++)me.items[Ee].tokens=this.blockTokens(me.items[Ee].text,[],!1);re.push(me);continue}if(me=this.tokenizer.html(ne)){ne=ne.substring(me.raw.length),re.push(me);continue}if(de&&(me=this.tokenizer.def(ne))){ne=ne.substring(me.raw.length),this.tokens.links[me.tag]||(this.tokens.links[me.tag]={href:me.href,title:me.title});continue}if(me=this.tokenizer.table(ne)){ne=ne.substring(me.raw.length),re.push(me);continue}if(me=this.tokenizer.lheading(ne)){ne=ne.substring(me.raw.length),re.push(me);continue}if(de&&(me=this.tokenizer.paragraph(ne))){ne=ne.substring(me.raw.length),re.push(me);continue}if(me=this.tokenizer.text(ne,re)){ne=ne.substring(me.raw.length),me.type?re.push(me):(je=re[re.length-1],je.raw+=`
`+me.raw,je.text+=`
`+me.text);continue}if(ne){var it="Infinite loop on byte: "+ne.charCodeAt(0);if(this.options.silent){console.error(it);break}else throw new Error(it)}}return re},ye.inline=function(ne){var re,de,me,Ee,Me,je,it=ne.length;for(re=0;re<it;re++){je=ne[re];switch(je.type){case"paragraph":case"text":case"heading":{je.tokens=[],this.inlineTokens(je.text,je.tokens);break}case"table":{for(je.tokens={header:[],cells:[]},Ee=je.header.length,de=0;de<Ee;de++)je.tokens.header[de]=[],this.inlineTokens(je.header[de],je.tokens.header[de]);for(Ee=je.cells.length,de=0;de<Ee;de++)for(Me=je.cells[de],je.tokens.cells[de]=[],me=0;me<Me.length;me++)je.tokens.cells[de][me]=[],this.inlineTokens(Me[me],je.tokens.cells[de][me]);break}case"blockquote":{this.inline(je.tokens);break}case"list":{for(Ee=je.items.length,de=0;de<Ee;de++)this.inline(je.items[de].tokens);break}}}return ne},ye.inlineTokens=function(ne,re,de,me,Ee){re===void 0&&(re=[]),de===void 0&&(de=!1),me===void 0&&(me=!1),Ee===void 0&&(Ee="");var Me,je=ne,it;if(this.tokens.links){var ft=Object.keys(this.tokens.links);if(ft.length>0)for(;(it=this.tokenizer.rules.inline.reflinkSearch.exec(je))!=null;)ft.includes(it[0].slice(it[0].lastIndexOf("[")+1,-1))&&(je=je.slice(0,it.index)+"["+"a".repeat(it[0].length-2)+"]"+je.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(it=this.tokenizer.rules.inline.blockSkip.exec(je))!=null;)je=je.slice(0,it.index)+"["+"a".repeat(it[0].length-2)+"]"+je.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;ne;){if(Me=this.tokenizer.escape(ne)){ne=ne.substring(Me.raw.length),re.push(Me);continue}if(Me=this.tokenizer.tag(ne,de,me)){ne=ne.substring(Me.raw.length),de=Me.inLink,me=Me.inRawBlock,re.push(Me);continue}if(Me=this.tokenizer.link(ne)){ne=ne.substring(Me.raw.length),Me.type==="link"&&(Me.tokens=this.inlineTokens(Me.text,[],!0,me)),re.push(Me);continue}if(Me=this.tokenizer.reflink(ne,this.tokens.links)){ne=ne.substring(Me.raw.length),Me.type==="link"&&(Me.tokens=this.inlineTokens(Me.text,[],!0,me)),re.push(Me);continue}if(Me=this.tokenizer.strong(ne,je,Ee)){ne=ne.substring(Me.raw.length),Me.tokens=this.inlineTokens(Me.text,[],de,me),re.push(Me);continue}if(Me=this.tokenizer.em(ne,je,Ee)){ne=ne.substring(Me.raw.length),Me.tokens=this.inlineTokens(Me.text,[],de,me),re.push(Me);continue}if(Me=this.tokenizer.codespan(ne)){ne=ne.substring(Me.raw.length),re.push(Me);continue}if(Me=this.tokenizer.br(ne)){ne=ne.substring(Me.raw.length),re.push(Me);continue}if(Me=this.tokenizer.del(ne)){ne=ne.substring(Me.raw.length),Me.tokens=this.inlineTokens(Me.text,[],de,me),re.push(Me);continue}if(Me=this.tokenizer.autolink(ne,Te)){ne=ne.substring(Me.raw.length),re.push(Me);continue}if(!de&&(Me=this.tokenizer.url(ne,Te))){ne=ne.substring(Me.raw.length),re.push(Me);continue}if(Me=this.tokenizer.inlineText(ne,me,ke)){ne=ne.substring(Me.raw.length),Ee=Me.raw.slice(-1),re.push(Me);continue}if(ne){var ct="Infinite loop on byte: "+ne.charCodeAt(0);if(this.options.silent){console.error(ct);break}else throw new Error(ct)}}return re},Z(xe,null,[{key:"rules",get:function(){return{block:ae,inline:Ae}}}]),xe}(),Pe=K.defaults,He=H.cleanUrl,Fe=H.escape,Ue=function(){function xe(_e){this.options=_e||Pe}var ye=xe.prototype;return ye.code=function(ne,re,de){var me=(re||"").match(/\S*/)[0];if(this.options.highlight){var Ee=this.options.highlight(ne,me);Ee!=null&&Ee!==ne&&(de=!0,ne=Ee)}return me?'<pre><code class="'+this.options.langPrefix+Fe(me,!0)+'">'+(de?ne:Fe(ne,!0))+`</code></pre>
`:"<pre><code>"+(de?ne:Fe(ne,!0))+`</code></pre>
`},ye.blockquote=function(ne){return`<blockquote>
`+ne+`</blockquote>
`},ye.html=function(ne){return ne},ye.heading=function(ne,re,de,me){return this.options.headerIds?"<h"+re+' id="'+this.options.headerPrefix+me.slug(de)+'">'+ne+"</h"+re+`>
`:"<h"+re+">"+ne+"</h"+re+`>
`},ye.hr=function(){return this.options.xhtml?`<hr/>
`:`<hr>
`},ye.list=function(ne,re,de){var me=re?"ol":"ul",Ee=re&&de!==1?' start="'+de+'"':"";return"<"+me+Ee+`>
`+ne+"</"+me+`>
`},ye.listitem=function(ne){return"<li>"+ne+`</li>
`},ye.checkbox=function(ne){return"<input "+(ne?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},ye.paragraph=function(ne){return"<p>"+ne+`</p>
`},ye.table=function(ne,re){return re&&(re="<tbody>"+re+"</tbody>"),`<table>
<thead>
`+ne+`</thead>
`+re+`</table>
`},ye.tablerow=function(ne){return`<tr>
`+ne+`</tr>
`},ye.tablecell=function(ne,re){var de=re.header?"th":"td",me=re.align?"<"+de+' align="'+re.align+'">':"<"+de+">";return me+ne+"</"+de+`>
`},ye.strong=function(ne){return"<strong>"+ne+"</strong>"},ye.em=function(ne){return"<em>"+ne+"</em>"},ye.codespan=function(ne){return"<code>"+ne+"</code>"},ye.br=function(){return this.options.xhtml?"<br/>":"<br>"},ye.del=function(ne){return"<del>"+ne+"</del>"},ye.link=function(ne,re,de){if(ne=He(this.options.sanitize,this.options.baseUrl,ne),ne===null)return de;var me='<a href="'+Fe(ne)+'"';return re&&(me+=' title="'+re+'"'),me+=">"+de+"</a>",me},ye.image=function(ne,re,de){if(ne=He(this.options.sanitize,this.options.baseUrl,ne),ne===null)return de;var me='<img src="'+ne+'" alt="'+de+'"';return re&&(me+=' title="'+re+'"'),me+=this.options.xhtml?"/>":">",me},ye.text=function(ne){return ne},xe}(),Ne=function(){function xe(){}var ye=xe.prototype;return ye.strong=function(ne){return ne},ye.em=function(ne){return ne},ye.codespan=function(ne){return ne},ye.del=function(ne){return ne},ye.html=function(ne){return ne},ye.text=function(ne){return ne},ye.link=function(ne,re,de){return""+de},ye.image=function(ne,re,de){return""+de},ye.br=function(){return""},xe}(),Ze=function(){function xe(){this.seen={}}var ye=xe.prototype;return ye.slug=function(ne){var re=ne.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(re)){var de=re;do this.seen[de]++,re=de+"-"+this.seen[de];while(this.seen.hasOwnProperty(re))}return this.seen[re]=0,re},xe}(),st=K.defaults,tt=H.unescape,et=function(){function xe(_e){this.options=_e||st,this.options.renderer=this.options.renderer||new Ue,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Ne,this.slugger=new Ze}xe.parse=function(ne,re){var de=new xe(re);return de.parse(ne)};var ye=xe.prototype;return ye.parse=function(ne,re){re===void 0&&(re=!0);var de="",me,Ee,Me,je,it,ft,ct,At,wt,dt,Ut,vt,Rt,Lt,Je,li,mi,Qe,yt=ne.length;for(me=0;me<yt;me++){dt=ne[me];switch(dt.type){case"space":continue;case"hr":{de+=this.renderer.hr();continue}case"heading":{de+=this.renderer.heading(this.parseInline(dt.tokens),dt.depth,tt(this.parseInline(dt.tokens,this.textRenderer)),this.slugger);continue}case"code":{de+=this.renderer.code(dt.text,dt.lang,dt.escaped);continue}case"table":{for(At="",ct="",je=dt.header.length,Ee=0;Ee<je;Ee++)ct+=this.renderer.tablecell(this.parseInline(dt.tokens.header[Ee]),{header:!0,align:dt.align[Ee]});for(At+=this.renderer.tablerow(ct),wt="",je=dt.cells.length,Ee=0;Ee<je;Ee++){for(ft=dt.tokens.cells[Ee],ct="",it=ft.length,Me=0;Me<it;Me++)ct+=this.renderer.tablecell(this.parseInline(ft[Me]),{header:!1,align:dt.align[Me]});wt+=this.renderer.tablerow(ct)}de+=this.renderer.table(At,wt);continue}case"blockquote":{wt=this.parse(dt.tokens),de+=this.renderer.blockquote(wt);continue}case"list":{for(Ut=dt.ordered,vt=dt.start,Rt=dt.loose,je=dt.items.length,wt="",Ee=0;Ee<je;Ee++)Je=dt.items[Ee],li=Je.checked,mi=Je.task,Lt="",Je.task&&(Qe=this.renderer.checkbox(li),Rt?Je.tokens.length>0&&Je.tokens[0].type==="text"?(Je.tokens[0].text=Qe+" "+Je.tokens[0].text,Je.tokens[0].tokens&&Je.tokens[0].tokens.length>0&&Je.tokens[0].tokens[0].type==="text"&&(Je.tokens[0].tokens[0].text=Qe+" "+Je.tokens[0].tokens[0].text)):Je.tokens.unshift({type:"text",text:Qe}):Lt+=Qe),Lt+=this.parse(Je.tokens,Rt),wt+=this.renderer.listitem(Lt,mi,li);de+=this.renderer.list(wt,Ut,vt);continue}case"html":{de+=this.renderer.html(dt.text);continue}case"paragraph":{de+=this.renderer.paragraph(this.parseInline(dt.tokens));continue}case"text":{for(wt=dt.tokens?this.parseInline(dt.tokens):dt.text;me+1<yt&&ne[me+1].type==="text";)dt=ne[++me],wt+=`
`+(dt.tokens?this.parseInline(dt.tokens):dt.text);de+=re?this.renderer.paragraph(wt):wt;continue}default:{var It='Token with "'+dt.type+'" type was not found.';if(this.options.silent){console.error(It);return}else throw new Error(It)}}}return de},ye.parseInline=function(ne,re){re=re||this.renderer;var de="",me,Ee,Me=ne.length;for(me=0;me<Me;me++){Ee=ne[me];switch(Ee.type){case"escape":{de+=re.text(Ee.text);break}case"html":{de+=re.html(Ee.text);break}case"link":{de+=re.link(Ee.href,Ee.title,this.parseInline(Ee.tokens,re));break}case"image":{de+=re.image(Ee.href,Ee.title,Ee.text);break}case"strong":{de+=re.strong(this.parseInline(Ee.tokens,re));break}case"em":{de+=re.em(this.parseInline(Ee.tokens,re));break}case"codespan":{de+=re.codespan(Ee.text);break}case"br":{de+=re.br();break}case"del":{de+=re.del(this.parseInline(Ee.tokens,re));break}case"text":{de+=re.text(Ee.text);break}default:{var je='Token with "'+Ee.type+'" type was not found.';if(this.options.silent){console.error(je);return}else throw new Error(je)}}}return de},xe}(),ut=H.merge,Ye=H.checkSanitizeDeprecation,Xe=H.escape,Ie=K.getDefaults,lt=K.changeDefaults,nt=K.defaults;function De(xe,ye,_e){if(typeof xe=="undefined"||xe===null)throw new Error("marked(): input parameter is undefined or null");if(typeof xe!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(xe)+", string expected");if(typeof ye=="function"&&(_e=ye,ye=null),ye=ut({},De.defaults,ye||{}),Ye(ye),_e){var ne=ye.highlight,re;try{re=Le.lex(xe,ye)}catch(Me){return _e(Me)}var de=function(je){var it;if(!je)try{it=et.parse(re,ye)}catch(ft){je=ft}return ye.highlight=ne,je?_e(je):_e(null,it)};if(!ne||ne.length<3)return de();if(delete ye.highlight,!re.length)return de();var me=0;De.walkTokens(re,function(Me){Me.type==="code"&&(me++,setTimeout(function(){ne(Me.text,Me.lang,function(je,it){if(je)return de(je);it!=null&&it!==Me.text&&(Me.text=it,Me.escaped=!0),me--,me===0&&de()})},0))}),me===0&&de();return}try{var Ee=Le.lex(xe,ye);return ye.walkTokens&&De.walkTokens(Ee,ye.walkTokens),et.parse(Ee,ye)}catch(Me){if(Me.message+=`
Please report this to https://github.com/markedjs/marked.`,ye.silent)return"<p>An error occurred:</p><pre>"+Xe(Me.message+"",!0)+"</pre>";throw Me}}De.options=De.setOptions=function(xe){return ut(De.defaults,xe),lt(De.defaults),De},De.getDefaults=Ie,De.defaults=nt,De.use=function(xe){var ye=ut({},xe);if(xe.renderer&&function(){var ne=De.defaults.renderer||new Ue,re=function(Ee){var Me=ne[Ee];ne[Ee]=function(){for(var je=arguments.length,it=new Array(je),ft=0;ft<je;ft++)it[ft]=arguments[ft];var ct=xe.renderer[Ee].apply(ne,it);return ct===!1&&(ct=Me.apply(ne,it)),ct}};for(var de in xe.renderer)re(de);ye.renderer=ne}(),xe.tokenizer&&function(){var ne=De.defaults.tokenizer||new ve,re=function(Ee){var Me=ne[Ee];ne[Ee]=function(){for(var je=arguments.length,it=new Array(je),ft=0;ft<je;ft++)it[ft]=arguments[ft];var ct=xe.tokenizer[Ee].apply(ne,it);return ct===!1&&(ct=Me.apply(ne,it)),ct}};for(var de in xe.tokenizer)re(de);ye.tokenizer=ne}(),xe.walkTokens){var _e=De.defaults.walkTokens;ye.walkTokens=function(ne){xe.walkTokens(ne),_e&&_e(ne)}}De.setOptions(ye)},De.walkTokens=function(xe,ye){for(var _e=B(xe),ne;!(ne=_e()).done;){var re=ne.value;ye(re);switch(re.type){case"table":{for(var de=B(re.tokens.header),me;!(me=de()).done;){var Ee=me.value;De.walkTokens(Ee,ye)}for(var Me=B(re.tokens.cells),je;!(je=Me()).done;)for(var it=je.value,ft=B(it),ct;!(ct=ft()).done;){var At=ct.value;De.walkTokens(At,ye)}break}case"list":{De.walkTokens(re.items,ye);break}default:re.tokens&&De.walkTokens(re.tokens,ye)}}},De.Parser=et,De.parser=et.parse,De.Renderer=Ue,De.TextRenderer=Ne,De.Lexer=Le,De.lexer=Le.lex,De.Tokenizer=ve,De.Slugger=Ze,De.parse=De;var ze=De;return ze})},ELLl:function(_t,ot,le){(function(ue){ue(le("VrN/"))})(function(ue){var Z={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},M=ue.Pos;ue.defineOption("autoCloseBrackets",!1,function(s,u,l){l&&l!=ue.Init&&(s.removeKeyMap(B),s.state.closeBrackets=null),u&&(N(Q(u,"pairs")),s.state.closeBrackets=u,s.addKeyMap(B))});function Q(s,u){return u=="pairs"&&typeof s=="string"?s:typeof s=="object"&&s[u]!=null?s[u]:Z[u]}var B={Backspace:P,Enter:R};function N(s){for(var u=0;u<s.length;u++){var l=s.charAt(u),a="'"+l+"'";B[a]||(B[a]=K(l))}}N(Z.pairs+"`");function K(s){return function(u){return p(u,s)}}function W(s){var u=s.state.closeBrackets;if(!u||u.override)return u;var l=s.getModeAt(s.getCursor());return l.closeBrackets||u}function P(s){var u=W(s);if(!u||s.getOption("disableInput"))return ue.Pass;for(var l=Q(u,"pairs"),a=s.listSelections(),o=0;o<a.length;o++){if(!a[o].empty())return ue.Pass;var c=f(s,a[o].head);if(!c||l.indexOf(c)%2!=0)return ue.Pass}for(var o=a.length-1;o>=0;o--){var L=a[o].head;s.replaceRange("",M(L.line,L.ch-1),M(L.line,L.ch+1),"+delete")}}function R(s){var u=W(s),l=u&&Q(u,"explode");if(!l||s.getOption("disableInput"))return ue.Pass;for(var a=s.listSelections(),o=0;o<a.length;o++){if(!a[o].empty())return ue.Pass;var c=f(s,a[o].head);if(!c||l.indexOf(c)%2!=0)return ue.Pass}s.operation(function(){var L=s.lineSeparator()||`
`;s.replaceSelection(L+L,null),s.execCommand("goCharLeft"),a=s.listSelections();for(var w=0;w<a.length;w++){var T=a[w].head.line;s.indentLine(T,null,!0),s.indentLine(T+1,null,!0)}})}function m(s){var u=ue.cmpPos(s.anchor,s.head)>0;return{anchor:new M(s.anchor.line,s.anchor.ch+(u?-1:1)),head:new M(s.head.line,s.head.ch+(u?1:-1))}}function p(s,u){var l=W(s);if(!l||s.getOption("disableInput"))return ue.Pass;var a=Q(l,"pairs"),o=a.indexOf(u);if(o==-1)return ue.Pass;for(var c=Q(l,"closeBefore"),L=Q(l,"triples"),w=a.charAt(o+1)==u,T=s.listSelections(),O=o%2==0,A,x=0;x<T.length;x++){var S=T[x],E=S.head,d,b=s.getRange(E,M(E.line,E.ch+1));if(O&&!S.empty())d="surround";else if((w||!O)&&b==u)w&&h(s,E)?d="both":L.indexOf(u)>=0&&s.getRange(E,M(E.line,E.ch+3))==u+u+u?d="skipThree":d="skip";else if(w&&E.ch>1&&L.indexOf(u)>=0&&s.getRange(M(E.line,E.ch-2),E)==u+u){if(E.ch>2&&/\bstring/.test(s.getTokenTypeAt(M(E.line,E.ch-2))))return ue.Pass;d="addFour"}else if(w){var g=E.ch==0?" ":s.getRange(M(E.line,E.ch-1),E);if(!ue.isWordChar(b)&&g!=u&&!ue.isWordChar(g))d="both";else return ue.Pass}else if(O&&(b.length===0||/\s/.test(b)||c.indexOf(b)>-1))d="both";else return ue.Pass;if(!A)A=d;else if(A!=d)return ue.Pass}var _=o%2?a.charAt(o-1):u,F=o%2?u:a.charAt(o+1);s.operation(function(){if(A=="skip")s.execCommand("goCharRight");else if(A=="skipThree")for(var D=0;D<3;D++)s.execCommand("goCharRight");else if(A=="surround"){for(var j=s.getSelections(),D=0;D<j.length;D++)j[D]=_+j[D]+F;s.replaceSelections(j,"around"),j=s.listSelections().slice();for(var D=0;D<j.length;D++)j[D]=m(j[D]);s.setSelections(j)}else A=="both"?(s.replaceSelection(_+F,null),s.triggerElectric(_+F),s.execCommand("goCharLeft")):A=="addFour"&&(s.replaceSelection(_+_+_+_,"before"),s.execCommand("goCharRight"))})}function f(s,u){var l=s.getRange(M(u.line,u.ch-1),M(u.line,u.ch+1));return l.length==2?l:null}function h(s,u){var l=s.getTokenAt(M(u.line,u.ch+1));return/\bstring/.test(l.type)&&l.start==u.ch&&(u.ch==0||!/\bstring/.test(s.getTokenTypeAt(u)))}})},GfqC:function(_t,ot,le){"use strict";var ue=le("q1tI"),Z=le.n(ue),M=le("TSYQ"),Q=le.n(M);function B(H,k){var y="cannot "+H.method+" "+H.action+" "+k.status+"'",G=new Error(y);return G.status=k.status,G.method=H.method,G.url=H.action,G}function N(H){var k=H.responseText||H.response;if(!k)return k;try{return JSON.parse(k)}catch(y){return k}}function K(H){var k=new XMLHttpRequest;H.onProgress&&k.upload&&(k.upload.onprogress=function(ie){ie.total>0&&(ie.percent=ie.loaded/ie.total*100),H.onProgress(ie)});var y=new FormData;H.data&&Object.keys(H.data).forEach(function(Y){var ie=H.data[Y];if(Array.isArray(ie)){ie.forEach(function(se){y.append(Y+"[]",se)});return}y.append(Y,H.data[Y])}),H.file instanceof Blob?y.append(H.filename,H.file,H.file.name):y.append(H.filename,H.file),k.onerror=function(ie){H.onError(ie)},k.onload=function(){return k.status<200||k.status>=300?H.onError(B(H,k),N(k)):H.onSuccess(N(k),k)},k.open(H.method,H.action,!0),H.withCredentials&&"withCredentials"in k&&(k.withCredentials=!0);var G=H.headers||{};return G["X-Requested-With"]!==null&&k.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(G).forEach(function(Y){G[Y]!==null&&k.setRequestHeader(Y,G[Y])}),k.send(y),{abort:function(){k.abort()}}}var W=+new Date,P=0;function R(){return"rc-upload-"+W+"-"+ ++P}function m(H,k){return H.indexOf(k,H.length-k.length)!==-1}var p=function(H,k){if(H&&k){var y=Array.isArray(k)?k:k.split(","),G=H.name||"",Y=H.type||"",ie=Y.replace(/\/.*$/,"");return y.some(function(se){var we=se.trim();return we.charAt(0)==="."?m(G.toLowerCase(),we.toLowerCase()):/\/\*$/.test(we)?ie===we.replace(/\/.*$/,""):Y===we})}return!0};function f(H,k){var y=H.createReader(),G=[];function Y(){y.readEntries(function(ie){var se=Array.prototype.slice.apply(ie);G=G.concat(se);var we=!se.length;we?k(G):Y()})}Y()}var h=function(k,y,G){var Y=function ie(se,we){we=we||"",se.isFile?se.file(function(ve){G(ve)&&(se.fullPath&&!ve.webkitRelativePath&&(Object.defineProperties(ve,{webkitRelativePath:{writable:!0}}),ve.webkitRelativePath=se.fullPath.replace(/^\//,""),Object.defineProperties(ve,{webkitRelativePath:{writable:!1}})),y([ve]))}):se.isDirectory&&f(se,function(ve){ve.forEach(function(Se){ie(Se,""+we+se.name+"/")})})};k.forEach(function(ie){Y(ie.webkitGetAsEntry())})},s=h,u=Object.assign||function(H){for(var k=1;k<arguments.length;k++){var y=arguments[k];for(var G in y)Object.prototype.hasOwnProperty.call(y,G)&&(H[G]=y[G])}return H},l=function(){function H(k,y){var G=[],Y=!0,ie=!1,se=void 0;try{for(var we=k[Symbol.iterator](),ve;!(Y=(ve=we.next()).done)&&!(G.push(ve.value),y&&G.length===y);Y=!0);}catch(Se){ie=!0,se=Se}finally{try{!Y&&we.return&&we.return()}finally{if(ie)throw se}}return G}return function(k,y){if(Array.isArray(k))return k;if(Symbol.iterator in Object(k))return H(k,y);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),a=function(){function H(k,y){for(var G=0;G<y.length;G++){var Y=y[G];Y.enumerable=Y.enumerable||!1,Y.configurable=!0,"value"in Y&&(Y.writable=!0),Object.defineProperty(k,Y.key,Y)}}return function(k,y,G){return y&&H(k.prototype,y),G&&H(k,G),k}}();function o(H,k,y){return k in H?Object.defineProperty(H,k,{value:y,enumerable:!0,configurable:!0,writable:!0}):H[k]=y,H}function c(H,k){var y={};for(var G in H){if(k.indexOf(G)>=0)continue;if(!Object.prototype.hasOwnProperty.call(H,G))continue;y[G]=H[G]}return y}function L(H,k){if(!(H instanceof k))throw new TypeError("Cannot call a class as a function")}function w(H,k){if(!H)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return k&&(typeof k=="object"||typeof k=="function")?k:H}function T(H,k){if(typeof k!="function"&&k!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof k);H.prototype=Object.create(k&&k.prototype,{constructor:{value:H,enumerable:!1,writable:!0,configurable:!0}}),k&&(Object.setPrototypeOf?Object.setPrototypeOf(H,k):H.__proto__=k)}var O=function(k){return Object.keys(k).reduce(function(y,G){return(G.substr(0,5)==="data-"||G.substr(0,5)==="aria-"||G==="role")&&(y[G]=k[G]),y},{})},A=function(H){T(k,H);function k(){var y,G,Y,ie;L(this,k);for(var se=arguments.length,we=Array(se),ve=0;ve<se;ve++)we[ve]=arguments[ve];return ie=(G=(Y=w(this,(y=k.__proto__||Object.getPrototypeOf(k)).call.apply(y,[this].concat(we))),Y),Y.state={uid:R()},Y.reqs={},Y.onChange=function(Se){var Ce=Se.target.files;Y.uploadFiles(Ce),Y.reset()},Y.onClick=function(Se){var Ce=Y.fileInput;if(!Ce)return;var pe=Y.props,fe=pe.children,oe=pe.onClick;fe&&fe.type==="button"&&(Ce.parentNode.focus(),Ce.parentNode.querySelector("button").blur()),Ce.click(),oe&&oe(Se)},Y.onKeyDown=function(Se){Se.key==="Enter"&&Y.onClick()},Y.onFileDrop=function(Se){var Ce=Y.props.multiple;if(Se.preventDefault(),Se.type==="dragover")return;if(Y.props.directory)s(Array.prototype.slice.call(Se.dataTransfer.items),Y.uploadFiles,function(fe){return p(fe,Y.props.accept)});else{var pe=Array.prototype.slice.call(Se.dataTransfer.files).filter(function(fe){return p(fe,Y.props.accept)});Ce===!1&&(pe=pe.slice(0,1)),Y.uploadFiles(pe)}},Y.uploadFiles=function(Se){var Ce=Array.prototype.slice.call(Se);Ce.map(function(pe){return pe.uid=R(),pe}).forEach(function(pe){Y.upload(pe,Ce)})},Y.saveFileInput=function(Se){Y.fileInput=Se},G),w(Y,ie)}return a(k,[{key:"componentDidMount",value:function(){this._isMounted=!0}},{key:"componentWillUnmount",value:function(){this._isMounted=!1,this.abort()}},{key:"upload",value:function(G,Y){var ie=this,se=this.props;if(!se.beforeUpload)return setTimeout(function(){return ie.post(G)},0);var we=se.beforeUpload(G,Y);we&&we.then?we.then(function(ve){var Se=Object.prototype.toString.call(ve);return Se==="[object File]"||Se==="[object Blob]"?ie.post(ve):ie.post(G)}).catch(function(ve){console.log(ve)}):we!==!1&&setTimeout(function(){return ie.post(G)},0);return}},{key:"post",value:function(G){var Y=this;if(!this._isMounted)return;var ie=this.props,se=ie.onStart,we=ie.onProgress,ve=ie.transformFile,Se=ve===void 0?function(Ce){return Ce}:ve;new Promise(function(Ce){var pe=ie.action;return typeof pe=="function"&&(pe=pe(G)),Ce(pe)}).then(function(Ce){var pe=G.uid,fe=ie.customRequest||K,oe=Promise.resolve(Se(G)).then(function(te){var he=ie.data;return typeof he=="function"&&(he=he(te)),Promise.all([te,he])}).catch(function(te){console.error(te)});oe.then(function(te){var he=l(te,2),ae=he[0],Ae=he[1],ke={action:Ce,filename:ie.name,data:Ae,file:ae,headers:ie.headers,withCredentials:ie.withCredentials,method:ie.method||"post",onProgress:we?function(Te){we(Te,G)}:null,onSuccess:function(Le,Pe){delete Y.reqs[pe],ie.onSuccess(Le,G,Pe)},onError:function(Le,Pe){delete Y.reqs[pe],ie.onError(Le,Pe,G)}};se(G),Y.reqs[pe]=fe(ke)})})}},{key:"reset",value:function(){this.setState({uid:R()})}},{key:"abort",value:function(G){var Y=this.reqs;if(G){var ie=G;G&&G.uid&&(ie=G.uid),Y[ie]&&Y[ie].abort&&Y[ie].abort(),delete Y[ie]}else Object.keys(Y).forEach(function(se){Y[se]&&Y[se].abort&&Y[se].abort(),delete Y[se]})}},{key:"render",value:function(){var G,Y=this.props,ie=Y.component,se=Y.prefixCls,we=Y.className,ve=Y.disabled,Se=Y.id,Ce=Y.style,pe=Y.multiple,fe=Y.accept,oe=Y.children,te=Y.directory,he=Y.openFileDialogOnClick,ae=Y.onMouseEnter,Ae=Y.onMouseLeave,ke=c(Y,["component","prefixCls","className","disabled","id","style","multiple","accept","children","directory","openFileDialogOnClick","onMouseEnter","onMouseLeave"]),Te=Q()((G={},o(G,se,!0),o(G,se+"-disabled",ve),o(G,we,we),G)),Le=ve?{}:{onClick:he?this.onClick:function(){},onKeyDown:he?this.onKeyDown:function(){},onMouseEnter:ae,onMouseLeave:Ae,onDrop:this.onFileDrop,onDragOver:this.onFileDrop,tabIndex:"0"};return Z.a.createElement(ie,u({},Le,{className:Te,role:"button",style:Ce}),Z.a.createElement("input",u({},O(ke),{id:Se,type:"file",ref:this.saveFileInput,onClick:function(He){return He.stopPropagation()},key:this.state.uid,style:{display:"none"},accept:fe,directory:te?"directory":null,webkitdirectory:te?"webkitdirectory":null,multiple:pe,onChange:this.onChange})),oe)}}]),k}(ue.Component),x=A,S=Object.assign||function(H){for(var k=1;k<arguments.length;k++){var y=arguments[k];for(var G in y)Object.prototype.hasOwnProperty.call(y,G)&&(H[G]=y[G])}return H},E=function(){function H(k,y){for(var G=0;G<y.length;G++){var Y=y[G];Y.enumerable=Y.enumerable||!1,Y.configurable=!0,"value"in Y&&(Y.writable=!0),Object.defineProperty(k,Y.key,Y)}}return function(k,y,G){return y&&H(k.prototype,y),G&&H(k,G),k}}();function d(H,k){if(!(H instanceof k))throw new TypeError("Cannot call a class as a function")}function b(H,k){if(!H)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return k&&(typeof k=="object"||typeof k=="function")?k:H}function g(H,k){if(typeof k!="function"&&k!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof k);H.prototype=Object.create(k&&k.prototype,{constructor:{value:H,enumerable:!1,writable:!0,configurable:!0}}),k&&(Object.setPrototypeOf?Object.setPrototypeOf(H,k):H.__proto__=k)}function _(){}var F=function(H){g(k,H);function k(){var y,G,Y,ie;d(this,k);for(var se=arguments.length,we=Array(se),ve=0;ve<se;ve++)we[ve]=arguments[ve];return ie=(G=(Y=b(this,(y=k.__proto__||Object.getPrototypeOf(k)).call.apply(y,[this].concat(we))),Y),Y.saveUploader=function(Se){Y.uploader=Se},G),b(Y,ie)}return E(k,[{key:"abort",value:function(G){this.uploader.abort(G)}},{key:"render",value:function(){return Z.a.createElement(x,S({},this.props,{ref:this.saveUploader}))}}]),k}(ue.Component);F.defaultProps={component:"span",prefixCls:"rc-upload",data:{},headers:{},name:"file",multipart:!1,onStart:_,onError:_,onSuccess:_,multiple:!1,beforeUpload:null,customRequest:null,withCredentials:!1,openFileDialogOnClick:!0};var D=F,j=ot.a=D},HmJG:function(_t,ot,le){},LdHM:function(_t,ot,le){"use strict";le.d(ot,"b",function(){return c}),le.d(ot,"a",function(){return w});var ue=le("1OyB"),Z=le("vuIU"),M=le("Ji7U"),Q=le("LK+K"),B=le("q1tI"),N=le("rePB"),K=le("Ff2n"),W=le("ODXe"),P=le("4IlW"),R=le("bX4T"),m=le("YrtM"),p=le("TSYQ"),f=le.n(p),h=le("+nKL"),s=le("8OUc"),u=function(G,Y){var ie=G.prefixCls,se=G.id,we=G.flattenOptions,ve=G.childrenAsData,Se=G.values,Ce=G.searchValue,pe=G.multiple,fe=G.defaultActiveFirstOption,oe=G.height,te=G.itemHeight,he=G.notFoundContent,ae=G.open,Ae=G.menuItemSelectedIcon,ke=G.virtual,Te=G.onSelect,Le=G.onToggleOpen,Pe=G.onActiveValue,He=G.onScroll,Fe=G.onMouseEnter,Ue="".concat(ie,"-item"),Ne=Object(m.a)(function(){return we},[ae,we],function(ze,xe){return xe[0]&&ze[1]!==xe[1]}),Ze=B.useRef(null),st=function(xe){xe.preventDefault()},tt=function(xe){Ze.current&&Ze.current.scrollTo({index:xe})},et=function(xe){for(var ye=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,_e=Ne.length,ne=0;ne<_e;ne+=1){var re=(xe+ne*ye+_e)%_e,de=Ne[re],me=de.group,Ee=de.data;if(!me&&!Ee.disabled)return re}return-1},ut=B.useState(function(){return et(0)}),Ye=Object(W.a)(ut,2),Xe=Ye[0],Ie=Ye[1],lt=function(xe){Ie(xe);var ye=Ne[xe];if(!ye){Pe(null,-1);return}Pe(ye.data.value,xe)};B.useEffect(function(){lt(fe!==!1?et(0):-1)},[Ne.length,Ce]),B.useEffect(function(){var ze=setTimeout(function(){if(!pe&&ae&&Se.size===1){var xe=Array.from(Se)[0],ye=Ne.findIndex(function(_e){var ne=_e.data;return ne.value===xe});lt(ye),tt(ye)}});return function(){return clearTimeout(ze)}},[ae]);var nt=function(xe){xe!==void 0&&Te(xe,{selected:!Se.has(xe)}),pe||Le(!1)};if(B.useImperativeHandle(Y,function(){return{onKeyDown:function(xe){var ye=xe.which;switch(ye){case P.a.UP:case P.a.DOWN:{var _e=0;if(ye===P.a.UP?_e=-1:ye===P.a.DOWN&&(_e=1),_e!==0){var ne=et(Xe+_e,_e);tt(ne),lt(ne)}break}case P.a.ENTER:{var re=Ne[Xe];re&&!re.data.disabled?nt(re.data.value):nt(void 0),ae&&xe.preventDefault();break}case P.a.ESC:Le(!1)}},onKeyUp:function(){},scrollTo:function(xe){tt(xe)}}}),Ne.length===0)return B.createElement("div",{role:"listbox",id:"".concat(se,"_list"),className:"".concat(Ue,"-empty"),onMouseDown:st},he);function De(ze){var xe=Ne[ze];if(!xe)return null;var ye=xe.data||{},_e=ye.value,ne=ye.label,re=ye.children,de=Object(R.a)(ye,!0),me=ve?re:ne;return xe?B.createElement("div",Object.assign({"aria-label":typeof me=="string"?me:null},de,{key:ze,role:"option",id:"".concat(se,"_list_").concat(ze),"aria-selected":Se.has(_e)}),_e):null}return B.createElement(B.Fragment,null,B.createElement("div",{role:"listbox",id:"".concat(se,"_list"),style:{height:0,width:0,overflow:"hidden"}},De(Xe-1),De(Xe),De(Xe+1)),B.createElement(h.a,{itemKey:"key",ref:Ze,data:Ne,height:oe,itemHeight:te,fullHeight:!1,onMouseDown:st,onScroll:He,virtual:ke,onMouseEnter:Fe},function(ze,xe){var ye,_e=ze.group,ne=ze.groupOption,re=ze.data,de=re.label,me=re.key;if(_e)return B.createElement("div",{className:f()(Ue,"".concat(Ue,"-group"))},de!==void 0?de:me);var Ee=re.disabled,Me=re.value,je=re.title,it=re.children,ft=re.style,ct=re.className,At=Object(K.a)(re,["disabled","value","title","children","style","className"]),wt=Se.has(Me),dt="".concat(Ue,"-option"),Ut=f()(Ue,dt,ct,(ye={},Object(N.a)(ye,"".concat(dt,"-grouped"),ne),Object(N.a)(ye,"".concat(dt,"-active"),Xe===xe&&!Ee),Object(N.a)(ye,"".concat(dt,"-disabled"),Ee),Object(N.a)(ye,"".concat(dt,"-selected"),wt),ye)),vt=ve?it:de,Rt=!Ae||typeof Ae=="function"||wt;return B.createElement("div",Object.assign({},At,{"aria-selected":wt,className:Ut,title:je,onMouseMove:function(){if(Xe===xe||Ee)return;lt(xe)},onClick:function(){Ee||nt(Me)},style:ft}),B.createElement("div",{className:"".concat(dt,"-content")},vt||Me),B.isValidElement(Ae)||wt,Rt&&B.createElement(s.a,{className:"".concat(Ue,"-option-state"),customizeIcon:Ae,customizeIconProps:{isSelected:wt}},wt?"\u2713":null))}))},l=B.forwardRef(u);l.displayName="OptionList";var a=l,o=function(){return null};o.isSelectOption=!0;var c=o,L=function(){return null};L.isSelectOptGroup=!0;var w=L,T=le("VTBJ"),O=le("Zm9Q");function A(y){var G=y.key,Y=y.props,ie=Y.children,se=Y.value,we=Object(K.a)(Y,["children","value"]);return Object(T.a)({key:G,value:se!==void 0?se:G,children:ie},we)}function x(y){var G=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(O.a)(y).map(function(Y,ie){if(!B.isValidElement(Y)||!Y.type)return null;var se=Y.type.isSelectOptGroup,we=Y.key,ve=Y.props,Se=ve.children,Ce=Object(K.a)(ve,["children"]);return G||!se?A(Y):Object(T.a)(Object(T.a)({key:"__RC_SELECT_GRP__".concat(we===null?ie:we,"__"),label:we},Ce),{},{options:x(Se)})}).filter(function(Y){return Y})}var S=le("2Qr1"),E=le("qNPg"),d=le("U8pU"),b=le("Kwbf"),g=le("WKfj");function _(y){var G=y.mode,Y=y.options,ie=y.children,se=y.backfill,we=y.allowClear,ve=y.placeholder,Se=y.getInputElement,Ce=y.showSearch,pe=y.onSearch,fe=y.defaultOpen,oe=y.autoFocus,te=y.labelInValue,he=y.value,ae=y.inputValue,Ae=y.optionLabelProp,ke=G==="multiple"||G==="tags",Te=Ce!==void 0?Ce:ke||G==="combobox",Le=Y||x(ie);if(Object(b.a)(G!=="tags"||Le.every(function(Ue){return!Ue.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),G==="tags"||G==="combobox"){var Pe=Le.some(function(Ue){return Ue.options?Ue.options.some(function(Ne){return typeof("value"in Ne?Ne.value:Ne.key)=="number"}):typeof("value"in Ue?Ue.value:Ue.key)=="number"});Object(b.a)(!Pe,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(b.a)(G!=="combobox"||!Ae,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(b.a)(G==="combobox"||!se,"`backfill` only works with `combobox` mode."),Object(b.a)(G==="combobox"||!Se,"`getInputElement` only work with `combobox` mode."),Object(b.b)(G!=="combobox"||!Se||!we||!ve,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),pe&&!Te&&G!=="combobox"&&G!=="tags"&&Object(b.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(b.b)(!fe||oe,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),he!=null){var He=Object(g.d)(he);Object(b.a)(!te||He.every(function(Ue){return Object(d.a)(Ue)==="object"&&("key"in Ue||"value"in Ue)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(b.a)(!ke||Array.isArray(he),"`value` should be array when `mode` is `multiple` or `tags`")}if(ie){var Fe=null;Object(O.a)(ie).some(function(Ue){if(!B.isValidElement(Ue)||!Ue.type)return!1;var Ne=Ue.type;if(Ne.isSelectOption)return!1;if(Ne.isSelectOptGroup){var Ze=Object(O.a)(Ue.props.children).every(function(st){return!B.isValidElement(st)||!Ue.type||st.type.isSelectOption?!0:(Fe=st.type,!1)});return!Ze}return Fe=Ne,!0}),Fe&&Object(b.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(Fe.displayName||Fe.name||Fe,"`.")),Object(b.a)(ae===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var F=_,D=Object(E.a)({prefixCls:"rc-select",components:{optionList:a},convertChildrenToData:x,flattenOptions:S.d,getLabeledValue:S.e,filterOptions:S.b,isValueDisabled:S.g,findValueOption:S.c,warningProps:F,fillOptionsWithMissingValue:S.a}),j=function(y){Object(M.a)(Y,y);var G=Object(Q.a)(Y);function Y(){var ie;return Object(ue.a)(this,Y),ie=G.apply(this,arguments),ie.selectRef=B.createRef(),ie.focus=function(){ie.selectRef.current.focus()},ie.blur=function(){ie.selectRef.current.blur()},ie}return Object(Z.a)(Y,[{key:"render",value:function(){return B.createElement(D,Object.assign({ref:this.selectRef},this.props))}}]),Y}(B.Component);j.Option=c,j.OptGroup=w;var H=j,k=ot.c=H},M8RZ:function(_t,ot,le){"use strict";le.d(ot,"a",function(){return P});var ue=le("fWQN"),Z=le("mtLc"),M=le("yKVA"),Q=le("879j"),B=le("q1tI"),N=le.n(B),K=le("i8i4"),W=le.n(K),P=function(R){Object(M.a)(p,R);var m=Object(Q.a)(p);function p(f){var h;Object(ue.a)(this,p),h=m.call(this,f);var s=window.document;return h.node=s.createElement("div"),s.body.appendChild(h.node),h}return Object(Z.a)(p,[{key:"render",value:function(){var h=this.props.children;return Object(K.createPortal)(h,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),p}(N.a.Component)},Ot1p:function(_t,ot,le){"use strict";var ue=le("2qtc"),Z=le("kLXV"),M=le("rAM+"),Q=le("miYZ"),B=le("tsqr"),N=le("9og8"),K=le("tJVT"),W=le("jrin"),P=le("WmNS"),R=le.n(P),m=le("q1tI"),p=le.n(m),f=le("VrN/"),h=le.n(f),s=le("bdgK"),u=le("p77/"),l=le("Bd2K"),a=le("ELLl"),o=le("19Vz"),c=le("lZu9"),L=le("+NIl"),w=le("kSUc"),T=le("9Bee"),O=function(Ee){var Me=Ee.value,je=Me===void 0?"":Me,it=Ee.className,ft=Ee.showTextOnly,ct=Ee.showLines,At=Ee.style,wt=At===void 0?{}:At,dt=Object(m.useMemo)(function(){return""},[je]);return p.a.createElement(p.a.Fragment,null,p.a.createElement("div",{dangerouslySetInnerHTML:{__html:dt}}))},A=le("0Owb"),x=le("dejd"),S=le("C+DQ"),E=le("1vsH"),d=le("m3rI"),b=[{title:"\u7C97\u4F53",icon:"icon-bold",actionName:"bold"},{title:"\u659C\u4F53",icon:"icon-italic",actionName:"italic"},"|",{title:"\u65E0\u5E8F\u5217\u8868",icon:"icon-unorder-list",actionName:"list-ul"},{title:"\u6709\u5E8F\u5217\u8868",icon:"icon-order-list",actionName:"list-ol"},"|",{title:"\u884C\u5185\u4EE3\u7801",icon:"icon-code",actionName:"code"},{title:"\u4EE3\u7801\u5757\uFF08\u591A\u8BED\u8A00\u98CE\u683C\uFF09",icon:"icon-file-code",actionName:"code-block"},{title:"\u94FE\u63A5",icon:"icon-link",actionName:"link"},"|",{title:"\u884C\u5185\u516C\u5F0F",icon:"icon-sum",actionName:"inline-latex"},{title:"\u591A\u884C\u516C\u5F0F",icon:"icon-formula",actionName:"latex"},"|",{title:"\u6DFB\u52A0\u56FE\u7247",icon:"icon-picture",actionName:"upload-image"},{title:"\u8868\u683C",icon:"icon-table",actionName:"add-table"},"|",{title:"\u6362\u884C",icon:"icon-minus",actionName:"line-break"},{title:"\u6E05\u7A7A",icon:"icon-eraser",actionName:"eraser"}];function g(Ee){var Me=Ee.onActionCallback,je=Ee.title,it=Ee.icon,ft=Ee.actionName,ct=Ee.className,At=ct===void 0?"":ct,wt=Ee.children;function dt(){Me(ft)}return p.a.createElement("a",{title:je,className:At,onClick:dt},p.a.createElement("i",{className:"md-iconfont ".concat(it)}),wt)}var _=function(Ee){var Me=Ee.watch,je=Ee.showNullButton,it=Ee.onActionCallback,ft=Ee.fullScreen,ct=Ee.insertTemp,At=Ee.hidetoolBar,wt=Ee.uuid,dt=Ee.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(E.F)("_educoder_session_login"),"&_educoder_session=").concat(Object(E.F)("_educoder_session"),"&key=").concat(wt,"&api=").concat(encodeURIComponent(d.a.PROXY_SERVER)));var Ut=[].concat(b,[{title:"".concat(Me?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(Me?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return p.a.createElement("ul",{className:"markdown-toolbar-container"},!At&&Ut.map(function(vt,Rt){return p.a.createElement("li",{key:Rt},vt.actionName?p.a.createElement(g,Object(A.a)({},vt,{onActionCallback:it})):p.a.createElement("span",{className:"v-line"}))}),je?p.a.createElement("li",null,p.a.createElement(g,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:it},p.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,ct&&p.a.createElement("li",null,p.a.createElement(g,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(ct),onActionCallback:it},p.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),p.a.createElement("li",{className:"btn-full-screen"},p.a.createElement(g,{icon:"".concat(ft?"icon-shrink":"icon-enlarge"),title:ft?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:it})))},F=le("M8RZ"),D=le("+L6B"),j=le("2/Rp"),H=le("y8nQ"),k=le("Vl3Y"),y=le("5NDa"),G=le("5rEg"),Y={labelCol:{span:4},wrapperCol:{span:20}},ie=function(Ee){var Me=Ee.callback,je=Ee.onCancel;function it(ft){Me(ft)}return p.a.createElement(k.a,Object(A.a)({},Y,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:it}),p.a.createElement(k.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},p.a.createElement(G.a,null)),p.a.createElement(k.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},p.a.createElement(G.a,null)),p.a.createElement("div",{className:"flex-container flex-end"},p.a.createElement(j.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),p.a.createElement(j.a,{type:"ghost",onClick:je},"\u53D6\u6D88")))},se=le("7ahc"),we=le("HmJG"),ve=le("BjJ7"),Se=k.a.useForm,Ce={width:280,marginRight:10},pe={labelCol:{span:5},wrapperCol:{span:19}},fe=function(Ee){var Me=Ee.callback,je=Ee.onCancel,it=Se(),ft=Object(K.a)(it,1),ct=ft[0];function At(Ut){Me(Ut)}function wt(Ut,vt){if(Ut.status===-1){B.b.error(Ut.message);return}ct.setFieldsValue({src:"/api/attachments/".concat(Ut.id),type:vt.type})}function dt(Ut){var vt=Ut.target.files[0];te(vt,wt)}return p.a.createElement(k.a,Object(A.a)({form:ct},pe,{className:"upload-image-panel",onFinish:At}),p.a.createElement(k.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},p.a.createElement("div",{className:"flex-container"},p.a.createElement(k.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},p.a.createElement(G.a,{style:Ce})),p.a.createElement(oe,{onFileChange:dt}))),p.a.createElement(k.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt"},p.a.createElement(G.a,{style:{width:264}})),p.a.createElement(k.a.Item,{style:{textAlign:"right"}},p.a.createElement(j.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),p.a.createElement(j.a,{type:"ghost",onClick:je},"\u53D6\u6D88")))};function oe(Ee){var Me=Ee.onFileChange;return p.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",p.a.createElement("input",{type:"file",onChange:Me}))}function te(Ee,Me){if(!Ee)throw new String("\u6CA1\u6709\u6587\u4EF6");var je=new FormData;je.append("editormd-image-file",Ee),je.append("file_param_name","editormd-image-file"),je.append("byxhr","true");var it=new window.XMLHttpRequest;it.withCredentials=!0,it.addEventListener("load",function(ft){Me(JSON.parse(ft.target.responseText),Ee)},!1),it.addEventListener("error",function(ft){console.error(ft)},!1),it.open("POST","".concat(ve.a,"/api/attachments.json")),it.send(je)}var he=le("giR+"),ae=le("fyUT"),Ae=le("7Kak"),ke=le("9yH6"),Te=ke.a.Group,Le={margin:"0 8px"},Pe=function(Ee){var Me=Ee.callback,je=Ee.onCancel;function it(ft){Me(ft)}return p.a.createElement(k.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:it},p.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},p.a.createElement("span",{style:Le},"\u5355\u5143\u683C\u6570\uFF1A"),p.a.createElement("span",{style:Le},"\u884C\u6570"),p.a.createElement(k.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},p.a.createElement(ae.a,null)),p.a.createElement("span",{style:Le},"\u5217\u6570"),p.a.createElement(k.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},p.a.createElement(ae.a,null))),p.a.createElement("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"}},p.a.createElement("span",{style:Le},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),p.a.createElement(k.a.Item,{name:"align"},p.a.createElement(Te,null,p.a.createElement(ke.a,{value:"default"},p.a.createElement("i",{className:"fa fa-align-justify"})),p.a.createElement(ke.a,{value:"left"},p.a.createElement("i",{className:"fa fa-align-left"})),p.a.createElement(ke.a,{value:"center"},p.a.createElement("i",{className:"fa fa-align-center"})),p.a.createElement(ke.a,{value:"right"},p.a.createElement("i",{className:"fa fa-align-right"}))))),p.a.createElement("div",{className:"flex-container flex-end"},p.a.createElement(j.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),p.a.createElement(j.a,{type:"ghost",onClick:je},"\u53D6\u6D88")))},He=le("ErOA"),Fe=le("7Cbv"),Ue="link",Ne="upload-image",Ze="code-block",st="add-table",tt="------------",et={default:tt,left:":".concat(tt),center:":".concat(tt,":"),right:"".concat(tt,":")},ut=le("9VGf"),Ye,Xe;function Ie(){}var lt=0,nt=1e4,De="\u2581",ze=`
**\u6A21\u677F\u6807\u9898**
\u6A21\u677F\u6B63\u6587\u5185\u5BB9\uFF0C\u53EF\u8F93\u5165\u6587\u672C\u5185\u5BB9\u548C\u7C98\u8D34\u56FE\u7247\u7B49\u64CD\u4F5C`;function xe(Ee){return/^\d+$/.test(Ee)?"".concat(Ee,"px"):Ee}var ye=navigator.platform.toUpperCase().indexOf("MAC")>=0,_e=ye?"Cmd":"Ctrl",ne=["pptm","pptx","ppt","pot","pps","ppa","potx","ppsx","ppam","pptm","potm","ppsm","doc","docx","dot","dotx","docm","dotm","xls","xlsx","csv","xlt","xla","xltx","xlsm","xltm","xlam","xlsb"],re=(Ye={},Object(W.a)(Ye,_e+"-B","bold"),Object(W.a)(Ye,_e+"-I","italic"),Ye),de=(Xe={},Object(W.a)(Xe,Ue,"\u6DFB\u52A0\u94FE\u63A5"),Object(W.a)(Xe,Ze,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(W.a)(Xe,Ne,"\u6DFB\u52A0\u6587\u4EF6"),Object(W.a)(Xe,st,"\u6DFB\u52A0\u8868\u683C"),Xe),me=ot.a=function(Ee){var Me=Ee.defaultValue,je=Me===void 0?"":Me,it=Ee.onChange,ft=Ee.width,ct=ft===void 0?"100%":ft,At=Ee.height,wt=At===void 0?400:At,dt=Ee.miniToolbar,Ut=dt===void 0?!1:dt,vt=Ee.isFocus,Rt=vt===void 0?!1:vt,Lt=Ee.watch,Je=Ee.insertTemp,li=Ee.mode,mi=li===void 0?"markdown":li,Qe=Ee.id,yt=Qe===void 0?"markdown-editor-id":Qe,It=Ee.showResizeBar,kt=It===void 0?!1:It,Jt=Ee.noStorage,Si=Jt===void 0?!1:Jt,en=Ee.showNullButton,jt=en===void 0?!1:en,mt=Ee.hidetoolBar,zi=mt===void 0?!1:mt,tn=Ee.fullScreen,bi=tn===void 0?!1:tn,Pt=Ee.onBlur,Hi=Ee.onCMBeforeChange,Xi=Ee.onFullScreen,pn=Ee.className,Ve=pn===void 0?"":pn,Ct=Ee.disablePaste,mn=Ct===void 0?!1:Ct,gn=Ee.placeholder,vn=gn===void 0?"":gn,yn=Ee.values,X=yn===void 0?"":yn,v=Object(m.useState)(null),C=Object(K.a)(v,2),U=C[0],q=C[1],V=Object(m.useState)(je),be=Object(K.a)(V,2),We=be[0],qe=be[1],gt=Object(m.useState)(Lt),Ge=Object(K.a)(gt,2),xt=Ge[0],Wt=Ge[1],Qt=Object(m.useState)(bi),Ni=Object(K.a)(Qt,2),_i=Ni[0],Ei=Ni[1],Yi=Object(m.useState)(""),kn=Object(K.a)(Yi,2),ui=kn[0],ji=kn[1],ln=Object(m.useState)(0),un=Object(K.a)(ln,2),Fi=un[0],Dn=un[1],bn=Object(m.useState)(wt),Kn=Object(K.a)(bn,2),Vn=Kn[0],$i=Kn[1],Ki=Object(m.useState)(!1),_n=Object(K.a)(Ki,2),dr=_n[0],En=_n[1],ti=Object(m.useRef)(Object(Fe.a)()),Gt=Object(m.useRef)(!1),gi=Object(m.useRef)(),Nt=Object(m.useRef)(),ni=Object(m.useRef)(),Vt=Object(m.useRef)(),nn=Object(m.useRef)(),hi=function(){var bt=Object(N.a)(R.a.mark(function Ot(){var Tt,Mt;return R.a.wrap(function(Yt){for(;;)switch(Yt.prev=Yt.next){case 0:return Yt.next=2,Object(He.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:ti.current}});case 2:Mt=Yt.sent,Mt!=null&&(Tt=Mt.attachments)!==null&&Tt!==void 0&&Tt.length&&(console.log("cm:",U,Nt),Mt.attachments.map(function(Bt){Bt.content_type.indexOf("image")>-1?U.replaceSelection("![,](/api/attachments/".concat(Bt.id,"?type=").concat(Bt.content_type,")")):Bt.content_type.indexOf("video")>-1?U.replaceSelection('<video width="100%" controls src="'.concat(d.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):Bt.content_type.indexOf("pdf")>-1?U.replaceSelection('<a href="'.concat(d.a.API_SERVER,"/api/attachments/").concat(Bt.id,"?type=").concat(Bt.content_type,'&disposition=inline" target="_blank">').concat(Bt.name,"</a>")):U.replaceSelection("[".concat(Bt.name,"](").concat(d.a.API_SERVER,"/api/attachments/").concat(Bt.id,"?type=").concat(Bt.content_type,")"))}));case 4:case"end":return Yt.stop()}},Ot)}));return function(){return bt.apply(this,arguments)}}();Object(m.useEffect)(function(){qe(X),U==null||U.setValue(X)},[X]),Object(m.useEffect)(function(){Xi==null||Xi(_i)},[_i]),Object(m.useEffect)(function(){if(Nt.current){var bt=h.a.fromTextArea(Nt.current,{mode:mi,lineNumbers:!Ut,lineWrapping:!0,value:je,autoCloseTags:!0,autoCloseBrackets:!0});Rt&&bt.focus();function Ot(Tt,Mt){if(mn){Mt.preventDefault();return}var Ht=Mt.clipboardData;if(Ht){var Yt=Ht.types.toString(),Bt=Ht.items;if(Yt==="Files"||Ht.types.indexOf("Files")>-1){if(Mt.preventDefault(),mi=="stex")return;try{var si,Ri=Bt[1];((si=Bt[0])===null||si===void 0?void 0:si.kind)==="file"&&(Ri=Bt[0]);var Ft=Ri.getAsFile(),hn=Ft.name.split(".").pop();te(Ft,function(zt){if(zt.id){var Li,xi,Vi;(Ft==null||((Li=Ft.type)===null||Li===void 0)?void 0:Li.indexOf("image"))>-1?bt.replaceSelection("![,](/api/attachments/".concat(zt.id,"?type=").concat(zt.content_type,")")):(Ft==null||((xi=Ft.type)===null||xi===void 0)?void 0:xi.indexOf("video"))>-1?bt.replaceSelection('<video width="100%" controls src="'.concat(d.a.API_SERVER,"/api/attachments/").concat(zt.id,'"></video>')):(Ft==null||((Vi=Ft.type)===null||Vi===void 0)?void 0:Vi.indexOf("pdf"))>-1?bt.replaceSelection('<a href="'.concat(d.a.API_SERVER,"/api/attachments/").concat(zt.id,"?type=").concat(Ft.type,'&disposition=inline" target="_blank">').concat(Ft.name,"</a>")):ne.includes(hn)?bt.replaceSelection('<a href="'.concat(d.a.API_SERVER,"/api/attachments/").concat(zt.id,'?type=office&disposition=inline" target="_blank">').concat(Ft.name,"</a>")):bt.replaceSelection("[".concat(Ft.name,"](").concat(d.a.API_SERVER,"/api/attachments/").concat(zt.id,"?type=").concat(zt.content_type,")"))}else(zt==null?void 0:zt.status)===401&&(document.location.href="/user/login")})}catch(zt){B.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return bt.on("paste",Ot),bt.on("dragleave",function(Tt,Mt){ni.current.classList.remove("mouse-hover-md")}),bt.on("dragover",function(Tt,Mt){ni.current.classList.add("mouse-hover-md")}),bt.on("drop",function(Tt,Mt){ni.current.classList.add("mouse-hover-md");var Ht;if(Ht=Mt.dataTransfer.files,Ht.length>0){Mt.preventDefault(),Mt.stopPropagation();for(var Yt=function(Ri){var Ft=Ht[Ri],hn=Ft.name.split(".").pop();te(Ft,function(zt){if(zt.id){var Li,xi,Vi;(Ft==null||((Li=Ft.type)===null||Li===void 0)?void 0:Li.indexOf("image"))>-1?bt.replaceSelection("![,](/api/attachments/".concat(zt.id,"?type=").concat(zt.content_type,")")):(Ft==null||((xi=Ft.type)===null||xi===void 0)?void 0:xi.indexOf("video"))>-1?bt.replaceSelection('<video width="100%" controls src="'.concat(d.a.API_SERVER,"/api/attachments/").concat(zt.id,'"></video>')):(Ft==null||((Vi=Ft.type)===null||Vi===void 0)?void 0:Vi.indexOf("pdf"))>-1?bt.replaceSelection('<a href="'.concat(d.a.API_SERVER,"/api/attachments/").concat(zt.id,"?type=").concat(Ft.type,'&disposition=inline" target="_blank">').concat(Ft.name,"</a>")):ne.includes(hn)?bt.replaceSelection('<a href="'.concat(d.a.API_SERVER,"/api/attachments/").concat(zt.id,'?type=office&disposition=inline" target="_blank">').concat(Ft.name,"</a>")):bt.replaceSelection("[".concat(Ft.name,"](").concat(d.a.API_SERVER,"/api/attachments/").concat(zt.id,"?type=").concat(zt.content_type,")"))}else(zt==null?void 0:zt.status)===401&&(document.location.href="/user/login")})},Bt=0;Bt<Ht.length;Bt++)Yt(Bt)}}),q(bt),function(){bt.off("paste",Ot)}}},[]);var Ci=Object(m.useCallback)(function(){if(ni.current)try{}catch(bt){console.log(bt,"---- to set md editor body height")}},[Vn,ni,_i]);Object(m.useEffect)(function(){function bt(){var Tt=new s.default(function(Mt){var Ht=Object(M.a)(Mt),Yt;try{for(Ht.s();!(Yt=Ht.n()).done;){var Bt=Yt.value;(Bt.target.offsetHeight>0||Bt.target.offsetWidth>0)&&(Ci(),U.setSize("100%","100%"),U.refresh())}}catch(si){Ht.e(si)}finally{Ht.f()}});return Tt.observe(Nt.current.parentElement),Tt}if(U){var Ot=bt();return function(){Ot.unobserve(Nt.current.parentElement)}}},[U,Ci]),Object(m.useEffect)(function(){if(U){for(var bt=[],Ot=function(){var Bt=Mt[Tt];Ht=Object(K.a)(Bt,2);var si=Ht[0],Ri=Ht[1],Ft=Object(W.a)({},si,function(){Xn(Ri)});bt.push(Ft),U.addKeyMap(Ft)},Tt=0,Mt=Object.entries(re);Tt<Mt.length;Tt++){var Ht;Ot()}return gi.current=setInterval(function(){Gt.current&&hi()},4e3),function(){clearInterval(gi.current);var Yt=Object(M.a)(bt),Bt;try{for(Yt.s();!(Bt=Yt.n()).done;){var si=Bt.value;U.removeKeyMap(si)}}catch(Ri){Yt.e(Ri)}finally{Yt.f()}}}},[U]),Object(m.useEffect)(function(){bi!==_i&&Ei(bi)},[bi]),Object(ut.a)(function(){if(!Si&&Fi>0){var bt=new Date().getTime(),Ot=window.sessionStorage.getItem(yt);bt>=Fi+nt&&(!Ot||Ot!==We)&&(window.sessionStorage.setItem(yt,We),En(!0))}},nt),Object(m.useEffect)(function(){Wt(Lt)},[U,Lt]),Object(m.useEffect)(function(){U&&(Rt&&U.focus())},[U,Rt]),Object(m.useEffect)(function(){if(xt&&U){var bt=U.getScrollerElement();function Ot(Tt){var Mt=Tt.target;if(nn.current){var Ht=Mt.scrollTop/Mt.scrollHeight;nn.current.scrollTop=nn.current.scrollHeight*Ht}}return bt.addEventListener("scroll",Ot),function(){bt.removeEventListener("scroll",Ot)}}},[U,xt]),Object(m.useEffect)(function(){if(U&&Hi){function bt(Ot,Tt){Hi(Ot,Tt)}return U.on("beforeChange",bt),function(){U.off("beforeChange",bt)}}},[U,Hi]),Object(m.useEffect)(function(){if(U&&Pt){function bt(){Pt(U.getValue())}return U.on("blur",bt),function(){U.off("blur",bt)}}},[U,Pt]),Object(m.useEffect)(function(){if(U){function bt(Ot){var Tt=Ot.getValue();qe(Tt),Dn(new Date().getTime()),Ot.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),it&&it(Tt)}return U.on("change",bt),function(){U.off("change",bt)}}},[U,it]),Object(m.useEffect)(function(){U&&(je==null?(U.setValue(""),qe("")):je!==U.getValue()&&(U.setValue(je),qe(je),U.setCursor(U.lineCount(),0)))},[U,je]);var Xn=Object(m.useCallback)(function(bt){var Ot=U.getCursor(),Tt=U.getSelection(),Mt=Tt.split(`
`);switch(bt){case"bold":return U.replaceSelection("**"+Tt+"**"),Tt===""&&U.setCursor(Ot.line,Ot.ch+2),U.focus();case"italic":return U.replaceSelection("*"+Tt+"*"),Tt===""&&U.setCursor(Ot.line,Ot.ch+1),U.focus();case"code":return U.replaceSelection("`"+Tt+"`"),Tt===""&&U.setCursor(Ot.line,Ot.ch+1),U.focus();case"inline-latex":return U.replaceSelection("`$$"+Tt+"$$`"),Tt===""&&U.setCursor(Ot.line,Ot.ch+3),U.focus();case"latex":return U.replaceSelection("```latex\n"+Tt+"\n```"),U.setCursor(Ot.line+1,Tt.length+1),U.focus();case"line-break":return U.replaceSelection(`<br/>
`),U.focus();case"list-ul":return Tt===""?U.replaceSelection("- "+Tt):U.replaceSelection(Mt.map(function(Ht){return Ht===""?"":"- ".concat(Ht)}).join(`
`)),U.focus();case"list-ol":return Tt===""?U.replaceSelection("1. "+Tt):U.replaceSelection(Mt.map(function(Ht,Yt){return Ht===""?"":"".concat(Yt+1,". ").concat(Ht)}).join(`
`)),U.focus();case"add-null-ch":return Tt===""&&U.setCursor(Ot.line,Ot.ch+1),U.replaceSelection(De),U.focus();case"inster-template-1":return Tt===""&&U.setCursor(Ot.line,Ot.ch),U.replaceSelection(ze),U.focus();case"eraser":return U.setValue(""),U.focus();case"trigger-watch":return Wt(!xt),U.focus();case"trigger-full-screen":return Ei(!_i),U.focus();case Ue:ji(Ue);return;case Ze:ji(Ze);return;case Ne:ji(Ne);return;case st:ji(st);return;default:throw new Error}},[U,xt,_i]),xn=Object(m.useCallback)(function(bt){ji("");switch(ui){case Ue:var Ot=bt.title,Tt=bt.link;return U.replaceSelection("[".concat(Ot,"](").concat(Tt,")")),U.focus();case Ze:var Mt=bt.language,Ht=bt.content;return U.replaceSelection(["```"+Mt,Ht,"```"].join(`
`)),U.focus();case Ne:var Yt=bt.src,Bt=bt.alt;return Bt?U.replaceSelection("![ ".concat(Bt," ]( ").concat(Yt,' "').concat(Bt,'" )')):U.replaceSelection("![,](".concat(Yt,")")),U.focus();case st:for(var si=bt.row,Ri=bt.col,Ft=bt.align,hn=`
`,zt=0;zt<si;zt++){for(var Li=[],xi=[],Vi=0;Vi<Ri;Vi++)zt===1&&xi.push(et[Ft]),Li.push(" ");zt===1&&(hn+="| ".concat(xi.join(" | "),` |
`)),hn+="| ".concat(Li.join(Ri===1?"":" | "),` |
`)}return U.replaceSelection(hn+`
`),U.focus();default:throw new Error}},[U,ui]),cr=Object(m.useMemo)(function(){switch(ui){case Ue:return p.a.createElement(ie,{callback:xn,onCancel:Tn});case Ze:return p.a.createElement(se.b,{callback:xn,onCancel:Tn});case Ne:return p.a.createElement(fe,{callback:xn,onCancel:Tn});case st:return p.a.createElement(Pe,{callback:xn,onCancel:Tn});default:return null}},[ui]);function Tn(){ji("")}Object(m.useEffect)(function(){if(Vt.current){var bt=Vt.current,Ot=!1,Tt=0;function Mt(Bt){Ot=!0,Tt=Bt.pageY}function Ht(){Ot=!1}function Yt(Bt){if(Ot){var si=Bt.pageY-Tt;si<0&&(si=0),si>300&&(si=300);var Ri=wt+si+"px";$i(Ri)}}return bt.addEventListener("mousedown",Mt),document.addEventListener("mousemove",Yt),document.addEventListener("mouseup",Ht),function(){bt.removeEventListener("mousedown",Mt),document.removeEventListener("mousemove",Yt),document.removeEventListener("mouseup",Ht)}}},[U,Vt]),Object(m.useEffect)(function(){$i(wt)},[wt]);var rn=xe(ct),fr=xe(Vn),Qi={width:rn,height:fr},pr=Object(m.useMemo)(function(){if(Fi){var bt=new Date(Fi),Ot=bt.getHours(),Tt=bt.getMinutes(),Mt=bt.getSeconds();return Ot=Ot<10?"0"+Ot:Ot,Tt=Tt<10?"0"+Tt:Tt,Mt=Mt<10?"0"+Mt:Mt,"".concat(Ot,":").concat(Tt,":").concat(Mt)}return 0},[Fi]);function Hr(){window.sessionStorage.removeItem(yt),En(!1),Dn(0)}function Mn(){En(!1),Dn(0),U.setValue(window.sessionStorage.getItem(yt))}function ua(bt,Ot){var Tt=U.getValue();Tt=Tt.replace(bt,Ot),qe(Tt),U==null||U.setValue(Tt)}return p.a.createElement(m.Fragment,null,p.a.createElement("div",{className:"markdown-editor-wrapper",ref:ni},p.a.createElement("div",{className:"markdown-editor-container ".concat(Ve," ").concat(xt?"on-preview":""," ").concat(Ut?"mini":""," ").concat(_i?"full-screen":""),style:Qi},p.a.createElement(_,{insertTemp:Je,watch:xt,fullScreen:_i,showNullButton:jt,onActionCallback:Xn,hidetoolBar:zi,uuid:ti.current,setOpenPhones:function(){Gt.current=!0}}),p.a.createElement("div",{className:"markdown-editor-body"},p.a.createElement("div",{className:"codemirror-container"},p.a.createElement("textarea",{ref:Nt,placeholder:vn})),xt?p.a.createElement("div",{ref:nn,className:"preview-container"},mi==="stex"&&p.a.createElement(O,{value:We}),mi!=="stex"&&p.a.createElement(T.a,{edit:!0,value:We,replaces:ua})):null))),kt?p.a.createElement("a",{ref:Vt,className:"editor-resize"}):null,p.a.createElement(F.a,null,de[ui]?p.a.createElement(Z.a,{centered:!0,title:de[ui],visible:!0,onCancel:Tn,footer:null,className:"markdown-popup-form"},cr):null))}},SJMd:function(_t,ot){/**
* @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 le,ue,Z,M=!1,Q,B;window.PR_SHOULD_USE_CONTINUATION=!0;var N,K;(function(){var W=window,P=["break,continue,do,else,for,if,return,while"],R=[P,"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"],m=[R,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],p=[m,"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"],f=[m,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],h=[m,"abstract,add,alias,as,ascending,async,await,base,bool,by,byte,checked,decimal,delegate,descending,dynamic,event,finally,fixed,foreach,from,get,global,group,implicit,in,interface,internal,into,is,join,let,lock,null,object,out,override,orderby,params,partial,readonly,ref,remove,sbyte,sealed,select,set,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,value,var,virtual,where,yield"],s="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes",u=[m,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],l="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",a=[P,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],o=[P,"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=[P,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],L=[p,h,f,u,l,a,o,c],w=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,T="str",O="kwd",A="com",x="typ",S="lit",E="pun",d="pln",b="tag",g="dec",_="src",F="atn",D="atv",j="nocode",H="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function k(Te){for(var Le=0,Pe=!1,He=!1,Fe=0,Ue=Te.length;Fe<Ue;++Fe){var Ne=Te[Fe];if(Ne.ignoreCase)He=!0;else if(/[a-z]/i.test(Ne.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Pe=!0,He=!1;break}}var Ze={b:8,t:9,n:10,v:11,f:12,r:13};function st(Xe){var Ie=Xe.charCodeAt(0);if(Ie!==92)return Ie;var lt=Xe.charAt(1);return Ie=Ze[lt],Ie||("0"<=lt&&lt<="7"?parseInt(Xe.substring(1),8):lt==="u"||lt==="x"?parseInt(Xe.substring(2),16):Xe.charCodeAt(1))}function tt(Xe){if(Xe<32)return(Xe<16?"\\x0":"\\x")+Xe.toString(16);var Ie=String.fromCharCode(Xe);return Ie==="\\"||Ie==="-"||Ie==="]"||Ie==="^"?"\\"+Ie:Ie}function et(Xe){var Ie=Xe.substring(1,Xe.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")),lt=[],nt=Ie[0]==="^",De=["["];nt&&De.push("^");for(var ze=nt?1:0,xe=Ie.length;ze<xe;++ze){var ye=Ie[ze];if(/\\[bdsw]/i.test(ye))De.push(ye);else{var _e=st(ye),ne;ze+2<xe&&Ie[ze+1]==="-"?(ne=st(Ie[ze+2]),ze+=2):ne=_e,lt.push([_e,ne]),ne<65||_e>122||(ne<65||_e>90||lt.push([Math.max(65,_e)|32,Math.min(ne,90)|32]),ne<97||_e>122||lt.push([Math.max(97,_e)&~32,Math.min(ne,122)&~32]))}}lt.sort(function(Ee,Me){return Ee[0]-Me[0]||Me[1]-Ee[1]});for(var re=[],de=[],ze=0;ze<lt.length;++ze){var me=lt[ze];me[0]<=de[1]+1?de[1]=Math.max(de[1],me[1]):re.push(de=me)}for(var ze=0;ze<re.length;++ze){var me=re[ze];De.push(tt(me[0])),me[1]>me[0]&&(me[1]+1>me[0]&&De.push("-"),De.push(tt(me[1])))}return De.push("]"),De.join("")}function ut(Xe){for(var Ie=Xe.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")),lt=Ie.length,nt=[],De=0,ze=0;De<lt;++De){var xe=Ie[De];if(xe==="(")++ze;else if(xe.charAt(0)==="\\"){var ye=+xe.substring(1);ye&&(ye<=ze?nt[ye]=-1:Ie[De]=tt(ye))}}for(var De=1;De<nt.length;++De)nt[De]===-1&&(nt[De]=++Le);for(var De=0,ze=0;De<lt;++De){var xe=Ie[De];if(xe==="(")++ze,nt[ze]||(Ie[De]="(?:");else if(xe.charAt(0)==="\\"){var ye=+xe.substring(1);ye&&ye<=ze&&(Ie[De]="\\"+nt[ye])}}for(var De=0;De<lt;++De)Ie[De]==="^"&&Ie[De+1]!=="^"&&(Ie[De]="");if(Xe.ignoreCase&&Pe)for(var De=0;De<lt;++De){var xe=Ie[De],_e=xe.charAt(0);xe.length>=2&&_e==="["?Ie[De]=et(xe):_e!=="\\"&&(Ie[De]=xe.replace(/[a-zA-Z]/g,function(de){var me=de.charCodeAt(0);return"["+String.fromCharCode(me&~32,me|32)+"]"}))}return Ie.join("")}for(var Ye=[],Fe=0,Ue=Te.length;Fe<Ue;++Fe){var Ne=Te[Fe];if(Ne.global||Ne.multiline)throw new Error(""+Ne);Ye.push("(?:"+ut(Ne)+")")}return new RegExp(Ye.join("|"),He?"gi":"g")}function y(Te,Le){var Pe=/(?:^|\s)nocode(?:\s|$)/,He=[],Fe=0,Ue=[],Ne=0;function Ze(st){var tt=st.nodeType;if(tt==1){if(Pe.test(st.className))return;for(var et=st.firstChild;et;et=et.nextSibling)Ze(et);var ut=st.nodeName.toLowerCase();(ut==="br"||ut==="li")&&(He[Ne]=`
`,Ue[Ne<<1]=Fe++,Ue[Ne++<<1|1]=st)}else if(tt==3||tt==4){var Ye=st.nodeValue;Ye.length&&(Le?Ye=Ye.replace(/\r\n?/g,`
`):Ye=Ye.replace(/[ \t\r\n]+/g," "),He[Ne]=Ye,Ue[Ne<<1]=Fe,Fe+=Ye.length,Ue[Ne++<<1|1]=st)}}return Ze(Te),{sourceCode:He.join("").replace(/\n$/,""),spans:Ue}}function G(Te,Le,Pe,He,Fe){if(!Pe)return;var Ue={sourceNode:Te,pre:1,langExtension:null,numberLines:null,sourceCode:Pe,spans:null,basePos:Le,decorations:null};He(Ue),Fe.push.apply(Fe,Ue.decorations)}var Y=/\S/;function ie(Te){for(var Le=void 0,Pe=Te.firstChild;Pe;Pe=Pe.nextSibling){var He=Pe.nodeType;Le=He===1?Le?Te:Pe:He===3&&Y.test(Pe.nodeValue)?Te:Le}return Le===Te?void 0:Le}function se(Te,Le){var Pe={},He;(function(){for(var Ne=Te.concat(Le),Ze=[],st={},tt=0,et=Ne.length;tt<et;++tt){var ut=Ne[tt],Ye=ut[3];if(Ye)for(var Xe=Ye.length;--Xe>=0;)Pe[Ye.charAt(Xe)]=ut;var Ie=ut[1],lt=""+Ie;st.hasOwnProperty(lt)||(Ze.push(Ie),st[lt]=null)}Ze.push(/[\0-\uffff]/),He=k(Ze)})();var Fe=Le.length,Ue=function(Ne){for(var Ze=Ne.sourceCode,st=Ne.basePos,tt=Ne.sourceNode,et=[st,d],ut=0,Ye=Ze.match(He)||[],Xe={},Ie=0,lt=Ye.length;Ie<lt;++Ie){var nt=Ye[Ie],De=Xe[nt],ze=void 0,xe;if(typeof De=="string")xe=!1;else{var ye=Pe[nt.charAt(0)];if(ye)ze=nt.match(ye[1]),De=ye[0];else{for(var _e=0;_e<Fe;++_e)if(ye=Le[_e],ze=nt.match(ye[1]),ze){De=ye[0];break}ze||(De=d)}xe=De.length>=5&&De.substring(0,5)==="lang-",xe&&!(ze&&typeof ze[1]=="string")&&(xe=!1,De=_),xe||(Xe[nt]=De)}var ne=ut;if(ut+=nt.length,!xe)et.push(st+ne,De);else{var re=ze[1],de=nt.indexOf(re),me=de+re.length;ze[2]&&(me=nt.length-ze[2].length,de=me-re.length);var Ee=De.substring(5);G(tt,st+ne,nt.substring(0,de),Ue,et),G(tt,st+ne+de,re,oe(Ee,re),et),G(tt,st+ne+me,nt.substring(me),Ue,et)}}Ne.decorations=et};return Ue}function we(Te){var Le=[],Pe=[];Te.tripleQuotedStrings?Le.push([T,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):Te.multiLineStrings?Le.push([T,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):Le.push([T,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),Te.verbatimStrings&&Pe.push([T,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var He=Te.hashComments;He&&(Te.cStyleComments?(He>1?Le.push([A,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):Le.push([A,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Pe.push([T,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):Le.push([A,/^#[^\r\n]*/,null,"#"])),Te.cStyleComments&&(Pe.push([A,/^\/\/[^\r\n]*/,null]),Pe.push([A,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Fe=Te.regexLiterals;if(Fe){var Ue=Fe>1?"":`
\r`,Ne=Ue?".":"[\\S\\s]",Ze="/(?=[^/*"+Ue+"])(?:[^/\\x5B\\x5C"+Ue+"]|\\x5C"+Ne+"|\\x5B(?:[^\\x5C\\x5D"+Ue+"]|\\x5C"+Ne+")*(?:\\x5D|$))+/";Pe.push(["lang-regex",RegExp("^"+H+"("+Ze+")")])}var st=Te.types;st&&Pe.push([x,st]);var tt=(""+Te.keywords).replace(/^ | $/g,"");tt.length&&Pe.push([O,new RegExp("^(?:"+tt.replace(/[\s,]+/g,"|")+")\\b"),null]),Le.push([d,/^\s+/,null,` \r
\xA0`]);var et="^.[^\\s\\w.$@'\"`/\\\\]*";return Te.regexLiterals&&(et+="(?!s*/)"),Pe.push([S,/^@[a-z_$][a-z_$@0-9]*/i,null],[x,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[d,/^[a-z_$][a-z_$@0-9]*/i,null],[S,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[d,/^\\[\s\S]?/,null],[E,new RegExp(et),null]),se(Le,Pe)}var ve=we({keywords:L,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function Se(Te,Le,Pe){for(var He=/(?:^|\s)nocode(?:\s|$)/,Fe=/\r\n?|\n/,Ue=Te.ownerDocument,Ne=Ue.createElement("li");Te.firstChild;)Ne.appendChild(Te.firstChild);var Ze=[Ne];function st(Ie){var lt=Ie.nodeType;if(lt==1&&!He.test(Ie.className))if(Ie.nodeName==="br")tt(Ie),Ie.parentNode&&Ie.parentNode.removeChild(Ie);else for(var nt=Ie.firstChild;nt;nt=nt.nextSibling)st(nt);else if((lt==3||lt==4)&&Pe){var De=Ie.nodeValue,ze=De.match(Fe);if(ze){var xe=De.substring(0,ze.index);Ie.nodeValue=xe;var ye=De.substring(ze.index+ze[0].length);if(ye){var _e=Ie.parentNode;_e.insertBefore(Ue.createTextNode(ye),Ie.nextSibling)}tt(Ie),xe||Ie.parentNode.removeChild(Ie)}}}function tt(Ie){for(;!Ie.nextSibling;)if(Ie=Ie.parentNode,!Ie)return;function lt(ze,xe){var ye=xe?ze.cloneNode(!1):ze,_e=ze.parentNode;if(_e){var ne=lt(_e,1),re=ze.nextSibling;ne.appendChild(ye);for(var de=re;de;de=re)re=de.nextSibling,ne.appendChild(de)}return ye}for(var nt=lt(Ie.nextSibling,0),De;(De=nt.parentNode)&&De.nodeType===1;)nt=De;Ze.push(nt)}for(var et=0;et<Ze.length;++et)st(Ze[et]);Le===(Le|0)&&Ze[0].setAttribute("value",Le);var ut=Ue.createElement("ol");ut.className="linenums";for(var Ye=Math.max(0,Le-1|0)||0,et=0,Xe=Ze.length;et<Xe;++et)Ne=Ze[et],Ne.className="L"+(et+Ye)%10,Ne.firstChild||Ne.appendChild(Ue.createTextNode("\xA0")),ut.appendChild(Ne);Te.appendChild(ut)}function Ce(Te){var Le=/\bMSIE\s(\d+)/.exec(navigator.userAgent);Le=Le&&+Le[1]<=8;var Pe=/\n/g,He=Te.sourceCode,Fe=He.length,Ue=0,Ne=Te.spans,Ze=Ne.length,st=0,tt=Te.decorations,et=tt.length,ut=0;tt[et]=Fe;var Ye,Xe;for(Xe=Ye=0;Xe<et;)tt[Xe]!==tt[Xe+2]?(tt[Ye++]=tt[Xe++],tt[Ye++]=tt[Xe++]):Xe+=2;for(et=Ye,Xe=Ye=0;Xe<et;){for(var Ie=tt[Xe],lt=tt[Xe+1],nt=Xe+2;nt+2<=et&&tt[nt+1]===lt;)nt+=2;tt[Ye++]=Ie,tt[Ye++]=lt,Xe=nt}et=tt.length=Ye;var De=Te.sourceNode,ze="";De&&(ze=De.style.display,De.style.display="none");try{for(var xe=null;st<Ze;){var ye=Ne[st],_e=Ne[st+2]||Fe,ne=tt[ut+2]||Fe,nt=Math.min(_e,ne),re=Ne[st+1],de;if(re.nodeType!==1&&(de=He.substring(Ue,nt))){Le&&(de=de.replace(Pe,"\r")),re.nodeValue=de;var me=re.ownerDocument,Ee=me.createElement("span");Ee.className=tt[ut+1];var Me=re.parentNode;Me.replaceChild(Ee,re),Ee.appendChild(re),Ue<_e&&(Ne[st+1]=re=me.createTextNode(He.substring(nt,_e)),Me.insertBefore(re,Ee.nextSibling))}Ue=nt,Ue>=_e&&(st+=2),Ue>=ne&&(ut+=2)}}finally{De&&(De.style.display=ze)}}var pe={};function fe(Te,Le){for(var Pe=Le.length;--Pe>=0;){var He=Le[Pe];pe.hasOwnProperty(He)?W.console&&console.warn("cannot override language handler %s",He):pe[He]=Te}}function oe(Te,Le){return Te&&pe.hasOwnProperty(Te)||(Te=/^\s*</.test(Le)?"default-markup":"default-code"),pe[Te]}fe(ve,["default-code"]),fe(se([],[[d,/^[^<?]+/],[g,/^<!\w[^>]*(?:>|$)/],[A,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[E,/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),fe(se([[d,/^[\s]+/,null,` \r
`],[D,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[b,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[F,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[E,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]),fe(se([],[[D,/^[\s\S]+/]]),["uq.val"]),fe(we({keywords:p,hashComments:!0,cStyleComments:!0,types:w}),["c","cc","cpp","cxx","cyc","m"]),fe(we({keywords:"null,true,false"}),["json"]),fe(we({keywords:h,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:w}),["cs"]),fe(we({keywords:f,cStyleComments:!0}),["java"]),fe(we({keywords:c,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),fe(we({keywords:a,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),fe(we({keywords:l,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),fe(we({keywords:o,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),fe(we({keywords:u,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),fe(we({keywords:s,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),fe(se([],[[T,/^[\s\S]+/]]),["regex"]);function te(Te){var Le=Te.langExtension;try{var Pe=y(Te.sourceNode,Te.pre),He=Pe.sourceCode;Te.sourceCode=He,Te.spans=Pe.spans,Te.basePos=0,oe(Le,He)(Te),Ce(Te)}catch(Fe){W.console&&console.log(Fe&&Fe.stack||Fe)}}function he(Te,Le,Pe){var He=Pe||!1,Fe=Le||null,Ue=document.createElement("div");Ue.innerHTML="<pre>"+Te+"</pre>",Ue=Ue.firstChild,He&&Se(Ue,He,!0);var Ne={langExtension:Fe,numberLines:He,sourceNode:Ue,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return te(Ne),Ue.innerHTML}function ae(Te,Le){var Pe=Le||document.body,He=Pe.ownerDocument||document;function Fe(ye){return Pe.getElementsByTagName(ye)}for(var Ue=[Fe("pre"),Fe("code"),Fe("xmp")],Ne=[],Ze=0;Ze<Ue.length;++Ze)for(var st=0,tt=Ue[Ze].length;st<tt;++st)Ne.push(Ue[Ze][st]);Ue=null;var et=Date;et.now||(et={now:function(){return+new Date}});var ut=0,Ye=/\blang(?:uage)?-([\w.]+)(?!\S)/,Xe=/\bprettyprint\b/,Ie=/\bprettyprinted\b/,lt=/pre|xmp/i,nt=/^code$/i,De=/^(?:pre|code|xmp)$/i,ze={};function xe(){for(var ye=W.PR_SHOULD_USE_CONTINUATION?et.now()+250:Infinity;ut<Ne.length&&et.now()<ye;ut++){for(var _e=Ne[ut],ne=ze,re=_e;re=re.previousSibling;){var de=re.nodeType,me=(de===7||de===8)&&re.nodeValue;if(me?!/^\??prettify\b/.test(me):de!==3||/\S/.test(re.nodeValue))break;if(me){ne={},me.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Lt,Je,li){ne[Je]=li});break}}var Ee=_e.className;if((ne!==ze||Xe.test(Ee))&&!Ie.test(Ee)){for(var Me=!1,je=_e.parentNode;je;je=je.parentNode){var it=je.tagName;if(De.test(it)&&je.className&&Xe.test(je.className)){Me=!0;break}}if(!Me){_e.className+=" prettyprinted";var ft=ne.lang;if(!ft){ft=Ee.match(Ye);var ct;!ft&&(ct=ie(_e))&&nt.test(ct.tagName)&&(ft=ct.className.match(Ye)),ft&&(ft=ft[1])}var At;if(lt.test(_e.tagName))At=1;else{var wt=_e.currentStyle,dt=He.defaultView,Ut=wt?wt.whiteSpace:dt&&dt.getComputedStyle?dt.getComputedStyle(_e,null).getPropertyValue("white-space"):0;At=Ut&&Ut.substring(0,3)==="pre"}var vt=ne.linenums;(vt=vt==="true"||+vt)||(vt=Ee.match(/\blinenums\b(?::(\d+))?/),vt=vt?vt[1]&&vt[1].length?+vt[1]:!0:!1),vt&&Se(_e,vt,At);var Rt={langExtension:ft,sourceNode:_e,numberLines:vt,pre:At,sourceCode:null,basePos:null,spans:null,decorations:null};te(Rt)}}}ut<Ne.length?W.setTimeout(xe,250):typeof Te=="function"&&Te()}xe()}var Ae=W.PR={createSimpleLexer:se,registerLangHandler:fe,sourceDecorator:we,PR_ATTRIB_NAME:F,PR_ATTRIB_VALUE:D,PR_COMMENT:A,PR_DECLARATION:g,PR_KEYWORD:O,PR_LITERAL:S,PR_NOCODE:j,PR_PLAIN:d,PR_PUNCTUATION:E,PR_SOURCE:_,PR_STRING:T,PR_TAG:b,PR_TYPE:x,prettyPrintOne:M?W.prettyPrintOne=he:N=he,prettyPrint:K=M?W.prettyPrint=ae:K=ae},ke=W.define;typeof ke=="function"&&ke.amd&&ke("google-code-prettify",[],function(){return Ae})})()},"T+//":function(_t,ot,le){"use strict";le.r(ot);var ue=le("Q9mQ"),Z=le("diRs"),M=le("2qtc"),Q=le("kLXV"),B=le("miYZ"),N=le("tsqr"),K=le("9og8"),W=le("tJVT"),P=le("B9cy"),R=le("Ol7k"),m=le("lUTK"),p=le("BvKs"),f=le("WmNS"),h=le.n(f),s=le("q1tI"),u=le.n(s),l=le("m3rI"),a=le("p0QG"),o=le.n(a),c=le("ErOA"),L=le("9kvl"),w=le("RCxd"),T=le("xGfz"),O=le("xKgJ"),A=le("5NDa"),x=le("5rEg");function S(pe){var fe=pe.user,oe=pe.CategoryId,te=pe.IsShow,he=pe.setIsShow,ae=pe.dispatch,Ae=pe.init,ke=Object(s.useState)(),Te=Object(W.a)(ke,2),Le=Te[0],Pe=Te[1];return u.a.createElement(Q.a,{title:oe?"\u65B0\u5EFA\u4E09\u7EA7\u7C7B\u76EE":"\u65B0\u5EFA\u4E8C\u7EA7\u7C7B\u76EE",width:424,onCancel:function(){he(!1)},onOk:Object(K.a)(h.a.mark(function He(){var Fe;return h.a.wrap(function(Ne){for(;;)switch(Ne.prev=Ne.next){case 0:if(Le){Ne.next=3;break}return N.b.error("\u680F\u76EE\u540D\u4E0D\u80FD\u4E3A\u7A7A"),Ne.abrupt("return");case 3:return Ne.next=5,Object(c.a)("/api/programas.json",{method:"post",body:{name:Le,parent_id:oe}});case 5:Fe=Ne.sent,Fe.status===0&&(N.b.info("\u521B\u5EFA\u6210\u529F"),he(!1),Pe(""),Ae());case 7:case"end":return Ne.stop()}},He)})),visible:te},u.a.createElement(x.a,{value:Le,onChange:function(Fe){return Pe(Fe.target.value)},placeholder:"\u8BF7\u8F93\u5165\u4E0D\u8D85\u8FC710\u4E2A\u6C49\u5B57\u7684\u540D\u79F0",maxLength:10}))}var E=Object(L.a)(function(pe){var fe=pe.user;return{user:fe}})(S);function d(pe){var fe=pe.user,oe=pe.CategoryId,te=pe.name,he=pe.IsShow,ae=pe.setIsShow,Ae=pe.dispatch,ke=pe.init,Te=Object(s.useState)(),Le=Object(W.a)(Te,2),Pe=Le[0],He=Le[1];return Object(s.useEffect)(function(){He(te)},[te]),u.a.createElement(Q.a,{title:"\u76EE\u5F55\u91CD\u547D\u540D",width:424,onCancel:function(){ae(!1)},onOk:Object(K.a)(h.a.mark(function Fe(){var Ue;return h.a.wrap(function(Ze){for(;;)switch(Ze.prev=Ze.next){case 0:if(Pe){Ze.next=3;break}return N.b.error("\u680F\u76EE\u540D\u4E0D\u80FD\u4E3A\u7A7A"),Ze.abrupt("return");case 3:return Ze.next=5,Object(c.a)("/api/programas/".concat(oe,"/rename.json"),{method:"put",body:{name:Pe,id:oe}});case 5:Ue=Ze.sent,Ue.status===0&&(N.b.info("\u4FEE\u6539\u6210\u529F"),ae(!1),He(""),ke());case 7:case"end":return Ze.stop()}},Fe)})),visible:he},u.a.createElement(x.a,{value:Pe,onChange:function(Ue){return He(Ue.target.value)},placeholder:"\u8BF7\u8F93\u5165\u4E0D\u8D85\u8FC710\u4E2A\u6C49\u5B57\u7684\u540D\u79F0",maxLength:10}))}var b=Object(L.a)(function(pe){var fe=pe.user;return{user:fe}})(d),g=le("+L6B"),_=le("2/Rp"),F=le("9Bee");function D(pe){var fe,oe,te,he,ae=pe.user,Ae=pe.ItemData,ke=pe.setIssee,Te=pe.dispatch,Le=pe.init;return u.a.createElement("div",null,u.a.createElement("div",{style:{textAlign:"right"}},Object(O.v)()&&u.a.createElement(_.a,{onClick:function(){return ke(!1)}},"\u7F16\u8F91")),u.a.createElement(F.a,{value:Ae.content}),(Ae==null||((fe=Ae.attachment)===null||fe===void 0)?void 0:fe.id)&&u.a.createElement("div",null,u.a.createElement("a",{href:Ae==null||((oe=Ae.attachment)===null||oe===void 0)?void 0:oe.url,target:"_self",download:Ae==null||((te=Ae.attachment)===null||te===void 0)?void 0:te.title},u.a.createElement("i",{style:{color:"#29BD8B"},className:"font-14 color-green iconfont icon-fujian mr8"}),u.a.createElement("span",{style:{color:"#000000"}},Ae==null||((he=Ae.attachment)===null||he===void 0)?void 0:he.title))))}var j=Object(L.a)(function(pe){var fe=pe.user;return{user:fe}})(D),H=le("DZo9"),k=le("8z0m"),y=le("Ot1p"),G=le("hJwl");function Y(pe){var fe=pe.user,oe=pe.ItemData,te=pe.setIssee,he=pe.CategoryId,ae=pe.dispatch,Ae=pe.init,ke=Object(s.useState)([]),Te=Object(W.a)(ke,2),Le=Te[0],Pe=Te[1],He=Object(s.useState)(oe.content),Fe=Object(W.a)(He,2),Ue=Fe[0],Ne=Fe[1];function Ze(){var Ye,Xe=[];return oe==null||((Ye=oe.attachments)===null||Ye===void 0)||Ye.map(function(Ie){var lt={uid:Ie==null?void 0:Ie.id,name:Ie.title,response:{id:Ie.id}};Xe.push(lt)}),Xe}var st={name:"file",multiple:!0,action:l.a.API_SERVER+"/api/attachments.json",defaultFileList:Ze(),onRemove:function(Xe){Object(G.t)({id:Xe.uid})},onChange:function(Xe){console.log("info",Xe);var Ie=Xe.file.status;Ie!=="uploading",Ie==="removed"&&Pe(Xe.fileList),Ie==="done"?(Pe(Xe.fileList),N.b.success("".concat(Xe.file.name," \u6587\u4EF6\u4E0A\u4F20\u6210\u529F"))):Ie==="error"&&N.b.error("".concat(Xe.file.name," \u6587\u4EF6\u4E0A\u4F20\u5931\u8D25"))},beforeUpload:function(Xe){var Ie=Xe.size/1024/1024<150;return Ie||N.b.info("\u6587\u4EF6\u5927\u5C0F\u5FC5\u987B\u5C0F\u4E8E150MB"),Ie}};function tt(){return et.apply(this,arguments)}function et(){return et=Object(K.a)(h.a.mark(function Ye(){var Xe;return h.a.wrap(function(lt){for(;;)switch(lt.prev=lt.next){case 0:return lt.next=2,Object(c.a)("/api/programas/".concat(he,"/update_content.json"),{method:"put",body:{id:he,content:Ue,attachment_id:ut(Le)}});case 2:Xe=lt.sent,Xe&&(N.b.info("\u63D0\u4EA4\u6210\u529F"),te(!0));case 4:case"end":return lt.stop()}},Ye)})),et.apply(this,arguments)}function ut(Ye){var Xe;return Ye&&Ye.map(function(Ie){Xe=Ie.response.id}),Xe}return u.a.createElement("div",null,u.a.createElement(y.a,{defaultValue:Ue,onChange:function(Xe){return Ne(Xe)}}),u.a.createElement(k.a,st,u.a.createElement(_.a,{className:"uploadBtn"},"\u4E0A\u4F20\u9644\u4EF6"),"(\u5355\u4E2A\u6587\u4EF6150M\u4EE5\u5185)"),u.a.createElement("p",{style:{marginTop:"10px"}},u.a.createElement(_.a,{style:{width:"90px"},onClick:function(){return tt()}},"\u63D0\u4EA4"),u.a.createElement(_.a,{style:{marginLeft:"30px",width:"90px"},type:"primary",onClick:function(){return te(!0)}},"\u53D6\u6D88")))}var ie=Object(L.a)(function(pe){var fe=pe.user;return{user:fe}})(Y),se=p.a.SubMenu,we=R.a.Content,ve=R.a.Sider;function Se(pe){var fe,oe=pe.user,te=pe.dispatch,he=pe.globalSetting,ae=Object(s.useState)(),Ae=Object(W.a)(ae,2),ke=Ae[0],Te=Ae[1],Le=Object(s.useState)(!1),Pe=Object(W.a)(Le,2),He=Pe[0],Fe=Pe[1],Ue=Object(s.useState)(),Ne=Object(W.a)(Ue,2),Ze=Ne[0],st=Ne[1],tt=Object(s.useState)(),et=Object(W.a)(tt,2),ut=et[0],Ye=et[1],Xe=Object(s.useState)(!1),Ie=Object(W.a)(Xe,2),lt=Ie[0],nt=Ie[1],De=Object(s.useState)(""),ze=Object(W.a)(De,2),xe=ze[0],ye=ze[1],_e=Object(s.useState)(""),ne=Object(W.a)(_e,2),re=ne[0],de=ne[1],me=Object(s.useState)(!0),Ee=Object(W.a)(me,2),Me=Ee[0],je=Ee[1];Object(s.useEffect)(function(){it()},[]),console.log("globalSetting",he);function it(){return ft.apply(this,arguments)}function ft(){return ft=Object(K.a)(h.a.mark(function vt(){var Rt;return h.a.wrap(function(Je){for(;;)switch(Je.prev=Je.next){case 0:return Je.next=2,Object(c.a)("/api/programas.json",{method:"get"});case 2:Rt=Je.sent,Rt&&st(Rt==null?void 0:Rt.programas);case 4:case"end":return Je.stop()}},vt)})),ft.apply(this,arguments)}var ct=function(){var vt=Object(K.a)(h.a.mark(function Rt(Lt,Je,li){var mi;return h.a.wrap(function(yt){for(;;)switch(yt.prev=yt.next){case 0:yt.t0=Lt,yt.next=yt.t0===1?3:yt.t0===2?6:yt.t0===3?10:yt.t0===4?15:17;break;case 3:return Ye(Je==null?void 0:Je.id),Fe(!0),yt.abrupt("break",17);case 6:return Ye(Je==null?void 0:Je.id),nt(!0),ye(Je==null?void 0:Je.name),yt.abrupt("break",17);case 10:return yt.next=12,Object(c.a)("/api/programas/".concat(Je==null?void 0:Je.id,"/top.json"),{method:"post",body:{id:Je==null?void 0:Je.id}});case 12:return mi=yt.sent,mi.status===0&&it(),yt.abrupt("break",17);case 15:return At(u.a.createElement("p",null,"\u5220\u9664\u4E4B\u540E\u4E0D\u80FD\u6062\u590D,",u.a.createElement("br",null),"\u662F\u5426\u786E\u8BA4\u5220\u9664?"),Object(K.a)(h.a.mark(function It(){var kt;return h.a.wrap(function(Si){for(;;)switch(Si.prev=Si.next){case 0:return Si.next=2,Object(c.a)("/api/programas/".concat(Je==null?void 0:Je.id,".json"),{method:"delete",body:{id:Je==null?void 0:Je.id}});case 2:kt=Si.sent,kt.status===0&&(N.b.info("\u5220\u9664\u6210\u529F"),it());case 4:case"end":return Si.stop()}},It)}))),yt.abrupt("break",17);case 17:case"end":return yt.stop()}},Rt)}));return function(Lt,Je,li){return vt.apply(this,arguments)}}(),At=function(Rt,Lt){Q.a.confirm({centered:!0,title:"\u63D0\u793A",icon:u.a.createElement(w.a,null),content:Rt,okText:"\u786E\u8BA4",onOk:function(){return Lt()},cancelText:"\u53D6\u6D88"})},wt=function(Rt,Lt){return u.a.createElement("div",{className:o.a.leftMenuActions},Lt===1&&u.a.createElement("p",{className:"current",onClick:function(){return ct(1,Rt,Lt)}},"\u65B0\u5EFA"),u.a.createElement("p",{className:"current",onClick:function(){return ct(2,Rt,Lt)}},"\u91CD\u547D\u540D"),u.a.createElement("p",{className:"current",onClick:function(){return ct(3,Rt,Lt)}},"\u7F6E\u9876"),u.a.createElement("p",{className:"current",onClick:function(){return ct(4,Rt,Lt)}},"\u5220\u9664"))};function dt(){return Ut.apply(this,arguments)}function Ut(){return Ut=Object(K.a)(h.a.mark(function vt(){var Rt;return h.a.wrap(function(Je){for(;;)switch(Je.prev=Je.next){case 0:return Je.next=2,Object(c.a)("/api/programas/".concat(ut,"/content.json"),{method:"get",params:{id:ut}});case 2:Rt=Je.sent,Rt&&de(Rt);case 4:case"end":return Je.stop()}},vt)})),Ut.apply(this,arguments)}return u.a.createElement("div",{style:{marginBottom:"40px"}},u.a.createElement("img",{style:{width:"100%"},src:l.a.IMG_SERVER+"/".concat(he==null||((fe=he.setting)===null||fe===void 0)?void 0:fe.shixun_banner_url)}),u.a.createElement("div",{className:"edu-container minH500",style:{display:"flex",width:"1200px"}},u.a.createElement(ve,{width:244,className:o.a.leftMenus,style:{background:"none",marginTop:"20px",height:"auto"}},u.a.createElement(p.a,{mode:"inline"},Ze==null?void 0:Ze.map(function(vt,Rt){if((vt==null?void 0:vt.children.length)>0){var Lt;return u.a.createElement(se,{title:u.a.createElement("span",{className:"font16"},u.a.createElement("span",null,vt.name),!Object(O.v)()&&u.a.createElement("span",null),Object(O.v)()&&u.a.createElement(Z.a,{placement:"right",content:function(){return wt(vt,1)},trigger:"hover"},u.a.createElement("span",{className:["iconfont icon-sandian",o.a.actions].join(" ")})))},vt==null||((Lt=vt.children)===null||Lt===void 0)?void 0:Lt.map(function(Je,li){return u.a.createElement(p.a.Item,{className:o.a===null||o.a===void 0?void 0:o.a.SubMentItem,onClick:function(){Ye(Je==null?void 0:Je.id),ut=Je==null?void 0:Je.id,dt()}},u.a.createElement("span",{style:{flex:"1"}},Je==null?void 0:Je.name),Object(O.v)()&&u.a.createElement(Z.a,{placement:"right",content:function(){return wt(Je,2)},trigger:"hover"},u.a.createElement("span",{className:["iconfont icon-sandian",o.a.actions].join(" ")})))}))}else return u.a.createElement(p.a.Item,{className:o.a===null||o.a===void 0?void 0:o.a.SubMentItem,onClick:function(){Ye(vt==null?void 0:vt.id),ut=vt==null?void 0:vt.id,dt()}},u.a.createElement("span",{style:{flex:"1"}},vt==null?void 0:vt.name),Object(O.v)()&&u.a.createElement(Z.a,{placement:"right",content:function(){return wt(vt,1)},trigger:"hover"},u.a.createElement("span",{className:["iconfont icon-sandian",o.a.actions].join(" ")})))}),u.a.createElement(p.a.Item,{onClick:function(){Ye(""),ut="",Fe(!0)},style:{color:"#0152d9",fontSize:"16px",height:"40px",display:"flex",alignItems:"center"},icon:u.a.createElement(T.a,{style:{color:"#0152d9",fontSize:"16px"}})},"\u65B0\u589E\u4E8C\u7EA7\u7C7B\u76EE"))),u.a.createElement("div",{style:{width:"937px",marginLeft:"17px",background:"#fff",padding:"20px"}},Me&&u.a.createElement(j,{ItemData:re,setIssee:je}),Me===!1&&u.a.createElement(ie,{ItemData:re,setIssee:je,CategoryId:ut}))),u.a.createElement(E,{CategoryId:ut,IsShow:He,setIsShow:Fe,init:it}),u.a.createElement(b,{CategoryId:ut,name:xe,IsShow:lt,setIsShow:nt,init:it}))}var Ce=ot.default=Object(L.a)(function(pe){var fe=pe.user,oe=pe.globalSetting;return{user:fe,globalSetting:oe}})(Se)},TXwP:function(_t,ot,le){var ue,Z;(function(){var M;(function(){"use strict";var B=[,,function(P){function R(f){this.__parent=f,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}R.prototype.clone_empty=function(){var f=new R(this.__parent);return f.set_indent(this.__indent_count,this.__alignment_count),f},R.prototype.item=function(f){return f<0?this.__items[this.__items.length+f]:this.__items[f]},R.prototype.has_match=function(f){for(var h=this.__items.length-1;h>=0;h--)if(this.__items[h].match(f))return!0;return!1},R.prototype.set_indent=function(f,h){this.is_empty()&&(this.__indent_count=f||0,this.__alignment_count=h||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},R.prototype._set_wrap_point=function(){this.__parent.wrap_line_length&&(this.__wrap_point_index=this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count)},R.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count},R.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var f=this.__parent.current_line;return f.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),f.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),f.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,f.__items[0]===" "&&(f.__items.splice(0,1),f.__character_count-=1),!0}return!1},R.prototype.is_empty=function(){return this.__items.length===0},R.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},R.prototype.push=function(f){this.__items.push(f);var h=f.lastIndexOf(`
`);h!==-1?this.__character_count=f.length-h:this.__character_count+=f.length},R.prototype.pop=function(){var f=null;return this.is_empty()||(f=this.__items.pop(),this.__character_count-=f.length),f},R.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},R.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},R.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},R.prototype.toString=function(){var f="";return this.is_empty()?this.__parent.indent_empty_lines&&(f=this.__parent.get_indent_string(this.__indent_count)):(f=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),f+=this.__items.join("")),f};function m(f,h){this.__cache=[""],this.__indent_size=f.indent_size,this.__indent_string=f.indent_char,f.indent_with_tabs||(this.__indent_string=new Array(f.indent_size+1).join(f.indent_char)),h=h||"",f.indent_level>0&&(h=new Array(f.indent_level+1).join(this.__indent_string)),this.__base_string=h,this.__base_string_length=h.length}m.prototype.get_indent_size=function(f,h){var s=this.__base_string_length;return h=h||0,f<0&&(s=0),s+=f*this.__indent_size,s+=h,s},m.prototype.get_indent_string=function(f,h){var s=this.__base_string;return h=h||0,f<0&&(f=0,s=""),h+=f*this.__indent_size,this.__ensure_cache(h),s+=this.__cache[h],s},m.prototype.__ensure_cache=function(f){for(;f>=this.__cache.length;)this.__add_column()},m.prototype.__add_column=function(){var f=this.__cache.length,h=0,s="";this.__indent_size&&f>=this.__indent_size&&(h=Math.floor(f/this.__indent_size),f-=h*this.__indent_size,s=new Array(h+1).join(this.__indent_string)),f&&(s+=new Array(f+1).join(" ")),this.__cache.push(s)};function p(f,h){this.__indent_cache=new m(f,h),this.raw=!1,this._end_with_newline=f.end_with_newline,this.indent_size=f.indent_size,this.wrap_line_length=f.wrap_line_length,this.indent_empty_lines=f.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new R(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}p.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},p.prototype.get_line_number=function(){return this.__lines.length},p.prototype.get_indent_string=function(f,h){return this.__indent_cache.get_indent_string(f,h)},p.prototype.get_indent_size=function(f,h){return this.__indent_cache.get_indent_size(f,h)},p.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},p.prototype.add_new_line=function(f){return this.is_empty()||!f&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},p.prototype.get_code=function(f){this.trim(!0);var h=this.current_line.pop();h&&(h[h.length-1]===`
`&&(h=h.replace(/\n+$/g,"")),this.current_line.push(h)),this._end_with_newline&&this.__add_outputline();var s=this.__lines.join(`
`);return f!==`
`&&(s=s.replace(/[\n]/g,f)),s},p.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},p.prototype.set_indent=function(f,h){return f=f||0,h=h||0,this.next_line.set_indent(f,h),this.__lines.length>1?(this.current_line.set_indent(f,h),!0):(this.current_line.set_indent(),!1)},p.prototype.add_raw_token=function(f){for(var h=0;h<f.newlines;h++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(f.whitespace_before),this.current_line.push(f.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},p.prototype.add_token=function(f){this.__add_space_before_token(),this.current_line.push(f),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},p.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},p.prototype.remove_indent=function(f){for(var h=this.__lines.length;f<h;)this.__lines[f]._remove_indent(),f++;this.current_line._remove_wrap_indent()},p.prototype.trim=function(f){for(f=f===void 0?!1:f,this.current_line.trim();f&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},p.prototype.just_added_newline=function(){return this.current_line.is_empty()},p.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},p.prototype.ensure_empty_line_above=function(f,h){for(var s=this.__lines.length-2;s>=0;){var u=this.__lines[s];if(u.is_empty())break;if(u.item(0).indexOf(f)!==0&&u.item(-1)!==h){this.__lines.splice(s+1,0,new R(this)),this.previous_line=this.__lines[this.__lines.length-2];break}s--}},P.exports.Output=p},,,,function(P){function R(f,h){this.raw_options=m(f,h),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs",this.indent_char===" "),this.indent_with_tabs&&(this.indent_char=" ",this.indent_size===1&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","django","erb","handlebars","php","smarty"],["auto"])}R.prototype._get_array=function(f,h){var s=this.raw_options[f],u=h||[];return typeof s=="object"?s!==null&&typeof s.concat=="function"&&(u=s.concat()):typeof s=="string"&&(u=s.split(/[^a-zA-Z0-9_\/\-]+/)),u},R.prototype._get_boolean=function(f,h){var s=this.raw_options[f],u=s===void 0?!!h:!!s;return u},R.prototype._get_characters=function(f,h){var s=this.raw_options[f],u=h||"";return typeof s=="string"&&(u=s.replace(/\\r/,"\r").replace(/\\n/,`
`).replace(/\\t/," ")),u},R.prototype._get_number=function(f,h){var s=this.raw_options[f];h=parseInt(h,10),isNaN(h)&&(h=0);var u=parseInt(s,10);return isNaN(u)&&(u=h),u},R.prototype._get_selection=function(f,h,s){var u=this._get_selection_list(f,h,s);if(u.length!==1)throw new Error("Invalid Option Value: The option '"+f+`' can only be one of the following values:
`+h+`
You passed in: '`+this.raw_options[f]+"'");return u[0]},R.prototype._get_selection_list=function(f,h,s){if(!h||h.length===0)throw new Error("Selection list cannot be empty.");if(s=s||[h[0]],!this._is_valid_selection(s,h))throw new Error("Invalid Default Value!");var u=this._get_array(f,s);if(!this._is_valid_selection(u,h))throw new Error("Invalid Option Value: The option '"+f+`' can contain only the following values:
`+h+`
You passed in: '`+this.raw_options[f]+"'");return u},R.prototype._is_valid_selection=function(f,h){return f.length&&h.length&&!f.some(function(s){return h.indexOf(s)===-1})};function m(f,h){var s={};f=p(f);var u;for(u in f)u!==h&&(s[u]=f[u]);if(h&&f[h])for(u in f[h])s[u]=f[h][u];return s}function p(f){var h={},s;for(s in f){var u=s.replace(/-/g,"_");h[u]=f[s]}return h}P.exports.Options=R,P.exports.normalizeOpts=p,P.exports.mergeOpts=m},,function(P){var R=RegExp.prototype.hasOwnProperty("sticky");function m(p){this.__input=p||"",this.__input_length=this.__input.length,this.__position=0}m.prototype.restart=function(){this.__position=0},m.prototype.back=function(){this.__position>0&&(this.__position-=1)},m.prototype.hasNext=function(){return this.__position<this.__input_length},m.prototype.next=function(){var p=null;return this.hasNext()&&(p=this.__input.charAt(this.__position),this.__position+=1),p},m.prototype.peek=function(p){var f=null;return p=p||0,p+=this.__position,p>=0&&p<this.__input_length&&(f=this.__input.charAt(p)),f},m.prototype.__match=function(p,f){p.lastIndex=f;var h=p.exec(this.__input);return h&&!(R&&p.sticky)&&(h.index!==f&&(h=null)),h},m.prototype.test=function(p,f){return f=f||0,f+=this.__position,f>=0&&f<this.__input_length?!!this.__match(p,f):!1},m.prototype.testChar=function(p,f){var h=this.peek(f);return p.lastIndex=0,h!==null&&p.test(h)},m.prototype.match=function(p){var f=this.__match(p,this.__position);return f?this.__position+=f[0].length:f=null,f},m.prototype.read=function(p,f,h){var s="",u;return p&&(u=this.match(p),u&&(s+=u[0])),f&&(u||!p)&&(s+=this.readUntil(f,h)),s},m.prototype.readUntil=function(p,f){var h="",s=this.__position;p.lastIndex=this.__position;var u=p.exec(this.__input);return u?(s=u.index,f&&(s+=u[0].length)):s=this.__input_length,h=this.__input.substring(this.__position,s),this.__position=s,h},m.prototype.readUntilAfter=function(p){return this.readUntil(p,!0)},m.prototype.get_regexp=function(p,f){var h=null,s="g";return f&&R&&(s="y"),typeof p=="string"&&p!==""?h=new RegExp(p,s):p&&(h=new RegExp(p.source,s)),h},m.prototype.get_literal_regexp=function(p){return RegExp(p.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},m.prototype.peekUntilAfter=function(p){var f=this.__position,h=this.readUntilAfter(p);return this.__position=f,h},m.prototype.lookBack=function(p){var f=this.__position-1;return f>=p.length&&this.__input.substring(f-p.length,f).toLowerCase()===p},P.exports.InputScanner=m},,,,,function(P){function R(m,p){m=typeof m=="string"?m:m.source,p=typeof p=="string"?p:p.source,this.__directives_block_pattern=new RegExp(m+/ beautify( \w+[:]\w+)+ /.source+p,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(m+/\sbeautify\signore:end\s/.source+p,"g")}R.prototype.get_directives=function(m){if(!m.match(this.__directives_block_pattern))return null;var p={};this.__directive_pattern.lastIndex=0;for(var f=this.__directive_pattern.exec(m);f;)p[f[1]]=f[2],f=this.__directive_pattern.exec(m);return p},R.prototype.readIgnored=function(m){return m.readUntilAfter(this.__directives_end_ignore_pattern)},P.exports.Directives=R},,function(P,R,m){var p=m(16).Beautifier,f=m(17).Options;function h(s,u){var l=new p(s,u);return l.beautify()}P.exports=h,P.exports.defaultOptions=function(){return new f}},function(P,R,m){var p=m(17).Options,f=m(2).Output,h=m(8).InputScanner,s=m(13).Directives,u=new s(/\/\*/,/\*\//),l=/\r\n|[\r\n]/,a=/\r\n|[\r\n]/g,o=/\s/,c=/(?:\s|\n)+/g,L=/\/\*(?:[\s\S]*?)((?:\*\/)|$)/g,w=/\/\/(?:[^\n\r\u2028\u2029]*)/g;function T(O,A){this._source_text=O||"",this._options=new p(A),this._ch=null,this._input=null,this.NESTED_AT_RULE={"@page":!0,"@font-face":!0,"@keyframes":!0,"@media":!0,"@supports":!0,"@document":!0},this.CONDITIONAL_GROUP_RULE={"@media":!0,"@supports":!0,"@document":!0},this.NON_SEMICOLON_NEWLINE_PROPERTY=["grid-template-areas","grid-template"]}T.prototype.eatString=function(O){var A="";for(this._ch=this._input.next();this._ch;){if(A+=this._ch,this._ch==="\\")A+=this._input.next();else if(O.indexOf(this._ch)!==-1||this._ch===`
`)break;this._ch=this._input.next()}return A},T.prototype.eatWhitespace=function(O){for(var A=o.test(this._input.peek()),x=0;o.test(this._input.peek());)this._ch=this._input.next(),O&&this._ch===`
`&&((x===0||x<this._options.max_preserve_newlines)&&(x++,this._output.add_new_line(!0)));return A},T.prototype.foundNestedPseudoClass=function(){for(var O=0,A=1,x=this._input.peek(A);x;){if(x==="{")return!0;if(x==="(")O+=1;else if(x===")"){if(O===0)return!1;O-=1}else if(x===";"||x==="}")return!1;A++,x=this._input.peek(A)}return!1},T.prototype.print_string=function(O){this._output.set_indent(this._indentLevel),this._output.non_breaking_space=!0,this._output.add_token(O)},T.prototype.preserveSingleSpace=function(O){O&&(this._output.space_before_token=!0)},T.prototype.indent=function(){this._indentLevel++},T.prototype.outdent=function(){this._indentLevel>0&&this._indentLevel--},T.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var O=this._source_text,A=this._options.eol;A==="auto"&&(A=`
`,O&&l.test(O||"")&&(A=O.match(l)[0])),O=O.replace(a,`
`);var x=O.match(/^[\t ]*/)[0];this._output=new f(this._options,x),this._input=new h(O),this._indentLevel=0,this._nestedLevel=0,this._ch=null;for(var S=0,E=!1,d=!1,b=!1,g=!1,_=!1,F=!1,D=this._ch,j=!1,H,k,y;H=this._input.read(c),k=H!=="",y=D,this._ch=this._input.next(),this._ch==="\\"&&this._input.hasNext()&&(this._ch+=this._input.next()),D=this._ch,this._ch;)if(this._ch==="/"&&this._input.peek()==="*"){this._output.add_new_line(),this._input.back();var G=this._input.read(L),Y=u.get_directives(G);Y&&Y.ignore==="start"&&(G+=u.readIgnored(this._input)),this.print_string(G),this.eatWhitespace(!0),this._output.add_new_line()}else if(this._ch==="/"&&this._input.peek()==="/")this._output.space_before_token=!0,this._input.back(),this.print_string(this._input.read(w)),this.eatWhitespace(!0);else if(this._ch==="@"||this._ch==="$")if(this.preserveSingleSpace(k),this._input.peek()==="{")this.print_string(this._ch+this.eatString("}"));else{this.print_string(this._ch);var ie=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);ie.match(/[ :]$/)&&(ie=this.eatString(": ").replace(/\s$/,""),this.print_string(ie),this._output.space_before_token=!0),ie=ie.replace(/\s$/,""),ie==="extend"?g=!0:ie==="import"&&(_=!0),ie in this.NESTED_AT_RULE?(this._nestedLevel+=1,ie in this.CONDITIONAL_GROUP_RULE&&(b=!0)):!E&&S===0&&ie.indexOf(":")!==-1&&(d=!0,this.indent())}else if(this._ch==="#"&&this._input.peek()==="{")this.preserveSingleSpace(k),this.print_string(this._ch+this.eatString("}"));else if(this._ch==="{")d&&(d=!1,this.outdent()),b?(b=!1,E=this._indentLevel>=this._nestedLevel):E=this._indentLevel>=this._nestedLevel-1,this._options.newline_between_rules&&E&&(this._output.previous_line&&this._output.previous_line.item(-1)!=="{"&&this._output.ensure_empty_line_above("/",",")),this._output.space_before_token=!0,this._options.brace_style==="expand"?(this._output.add_new_line(),this.print_string(this._ch),this.indent(),this._output.set_indent(this._indentLevel)):(y==="("?this._output.space_before_token=!1:y!==","&&this.indent(),this.print_string(this._ch)),this.eatWhitespace(!0),this._output.add_new_line();else if(this._ch==="}")this.outdent(),this._output.add_new_line(),y==="{"&&this._output.trim(!0),_=!1,g=!1,d&&(this.outdent(),d=!1),this.print_string(this._ch),E=!1,this._nestedLevel&&this._nestedLevel--,this.eatWhitespace(!0),this._output.add_new_line(),this._options.newline_between_rules&&!this._output.just_added_blankline()&&(this._input.peek()!=="}"&&this._output.add_new_line(!0)),this._input.peek()===")"&&(this._output.trim(!0),this._options.brace_style==="expand"&&this._output.add_new_line(!0));else if(this._ch===":"){for(var se=0;se<this.NON_SEMICOLON_NEWLINE_PROPERTY.length;se++)if(this._input.lookBack(this.NON_SEMICOLON_NEWLINE_PROPERTY[se])){j=!0;break}(E||b)&&!(this._input.lookBack("&")||this.foundNestedPseudoClass())&&!this._input.lookBack("(")&&!g&&S===0?(this.print_string(":"),d||(d=!0,this._output.space_before_token=!0,this.eatWhitespace(!0),this.indent())):(this._input.lookBack(" ")&&(this._output.space_before_token=!0),this._input.peek()===":"?(this._ch=this._input.next(),this.print_string("::")):this.print_string(":"))}else if(this._ch==='"'||this._ch==="'"){var we=y==='"'||y==="'";this.preserveSingleSpace(we||k),this.print_string(this._ch+this.eatString(this._ch)),this.eatWhitespace(!0)}else if(this._ch===";")j=!1,S===0?(d&&(this.outdent(),d=!1),g=!1,_=!1,this.print_string(this._ch),this.eatWhitespace(!0),this._input.peek()!=="/"&&this._output.add_new_line()):(this.print_string(this._ch),this.eatWhitespace(!0),this._output.space_before_token=!0);else if(this._ch==="(")if(this._input.lookBack("url"))this.print_string(this._ch),this.eatWhitespace(),S++,this.indent(),this._ch=this._input.next(),this._ch===")"||this._ch==='"'||this._ch==="'"?this._input.back():this._ch&&(this.print_string(this._ch+this.eatString(")")),S&&(S--,this.outdent()));else{var ve=!1;this._input.lookBack("with")&&(ve=!0),this.preserveSingleSpace(k||ve),this.print_string(this._ch),d&&y==="$"&&this._options.selector_separator_newline?(this._output.add_new_line(),F=!0):(this.eatWhitespace(),S++,this.indent())}else if(this._ch===")")S&&(S--,this.outdent()),F&&this._input.peek()===";"&&this._options.selector_separator_newline&&(F=!1,this.outdent(),this._output.add_new_line()),this.print_string(this._ch);else if(this._ch===",")this.print_string(this._ch),this.eatWhitespace(!0),this._options.selector_separator_newline&&(!d||F)&&S===0&&!_&&!g?this._output.add_new_line():this._output.space_before_token=!0;else if((this._ch===">"||this._ch==="+"||this._ch==="~")&&!d&&S===0)this._options.space_around_combinator?(this._output.space_before_token=!0,this.print_string(this._ch),this._output.space_before_token=!0):(this.print_string(this._ch),this.eatWhitespace(),this._ch&&o.test(this._ch)&&(this._ch=""));else if(this._ch==="]")this.print_string(this._ch);else if(this._ch==="[")this.preserveSingleSpace(k),this.print_string(this._ch);else if(this._ch==="=")this.eatWhitespace(),this.print_string("="),o.test(this._ch)&&(this._ch="");else if(this._ch==="!"&&!this._input.lookBack("\\"))this._output.space_before_token=!0,this.print_string(this._ch);else{var Se=y==='"'||y==="'";this.preserveSingleSpace(Se||k),this.print_string(this._ch),!this._output.just_added_newline()&&this._input.peek()===`
`&&j&&this._output.add_new_line()}var Ce=this._output.get_code(A);return Ce},P.exports.Beautifier=T},function(P,R,m){var p=m(6).Options;function f(h){p.call(this,h,"css"),this.selector_separator_newline=this._get_boolean("selector_separator_newline",!0),this.newline_between_rules=this._get_boolean("newline_between_rules",!0);var s=this._get_boolean("space_around_selector_separator");this.space_around_combinator=this._get_boolean("space_around_combinator")||s;var u=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_style="collapse";for(var l=0;l<u.length;l++)u[l]!=="expand"?this.brace_style="collapse":this.brace_style=u[l]}f.prototype=new p,P.exports.Options=f}],N={};function K(P){var R=N[P];if(R!==void 0)return R.exports;var m=N[P]={exports:{}};return B[P](m,m.exports,K),m.exports}var W=K(15);M=W})();var Q=M;!(ue=[],Z=function(){return{css_beautify:Q}}.apply(ot,ue),Z!==void 0&&(_t.exports=Z))})()},"VrN/":function(_t,ot,le){(function(ue,Z){_t.exports=Z()})(this,function(){"use strict";var ue=navigator.userAgent,Z=navigator.platform,M=/gecko\/\d/i.test(ue),Q=/MSIE \d/.test(ue),B=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ue),N=/Edge\/(\d+)/.exec(ue),K=Q||B||N,W=K&&(Q?document.documentMode||6:+(N||B)[1]),P=!N&&/WebKit\//.test(ue),R=P&&/Qt\/\d+\.\d+/.test(ue),m=!N&&/Chrome\//.test(ue),p=/Opera\//.test(ue),f=/Apple Computer/.test(navigator.vendor),h=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(ue),s=/PhantomJS/.test(ue),u=!N&&/AppleWebKit/.test(ue)&&/Mobile\/\w+/.test(ue),l=/Android/.test(ue),a=u||l||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(ue),o=u||/Mac/.test(Z),c=/\bCrOS\b/.test(ue),L=/win/i.test(Z),w=p&&ue.match(/Version\/(\d*\.\d*)/);w&&(w=Number(w[1])),w&&w>=15&&(p=!1,P=!0);var T=o&&(R||p&&(w==null||w<12.11)),O=M||K&&W>=9;function A(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var x=function(e,t){var n=e.className,i=A(t).exec(n);if(i){var r=n.slice(i.index+i[0].length);e.className=n.slice(0,i.index)+(r?i[1]+r:"")}};function S(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function E(e,t){return S(e).appendChild(t)}function d(e,t,n,i){var r=document.createElement(e);if(n&&(r.className=n),i&&(r.style.cssText=i),typeof t=="string")r.appendChild(document.createTextNode(t));else if(t)for(var I=0;I<t.length;++I)r.appendChild(t[I]);return r}function b(e,t,n,i){var r=d(e,t,n,i);return r.setAttribute("role","presentation"),r}var g;document.createRange?g=function(e,t,n,i){var r=document.createRange();return r.setEnd(i||e,n),r.setStart(e,t),r}:g=function(e,t,n){var i=document.body.createTextRange();try{i.moveToElementText(e.parentNode)}catch(r){return i}return i.collapse(!0),i.moveEnd("character",n),i.moveStart("character",t),i};function _(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 F(){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 D(e,t){var n=e.className;A(t).test(n)||(e.className+=(n?" ":"")+t)}function j(e,t){for(var n=e.split(" "),i=0;i<n.length;i++)n[i]&&!A(n[i]).test(t)&&(t+=" "+n[i]);return t}var H=function(e){e.select()};u?H=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:K&&(H=function(e){try{e.select()}catch(t){}});function k(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function y(e,t,n){t||(t={});for(var i in e)e.hasOwnProperty(i)&&(n!==!1||!t.hasOwnProperty(i))&&(t[i]=e[i]);return t}function G(e,t,n,i,r){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var I=i||0,z=r||0;;){var $=e.indexOf(" ",I);if($<0||$>=t)return z+(t-I);z+=$-I,z+=n-z%n,I=$+1}}var Y=function(){this.id=null,this.f=null,this.time=0,this.handler=k(this.onTimeout,this)};Y.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},Y.prototype.set=function(e,t){this.f=t;var n=+new Date+e;(!this.id||n<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=n)};function ie(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}var se=50,we={toString:function(){return"CodeMirror.Pass"}},ve={scroll:!1},Se={origin:"*mouse"},Ce={origin:"+move"};function pe(e,t,n){for(var i=0,r=0;;){var I=e.indexOf(" ",i);I==-1&&(I=e.length);var z=I-i;if(I==e.length||r+z>=t)return i+Math.min(z,t-r);if(r+=I-i,r+=n-r%n,i=I+1,r>=t)return i}}var fe=[""];function oe(e){for(;fe.length<=e;)fe.push(te(fe)+" ");return fe[e]}function te(e){return e[e.length-1]}function he(e,t){for(var n=[],i=0;i<e.length;i++)n[i]=t(e[i],i);return n}function ae(e,t,n){for(var i=0,r=n(t);i<e.length&&n(e[i])<=r;)i++;e.splice(i,0,t)}function Ae(){}function ke(e,t){var n;return Object.create?n=Object.create(e):(Ae.prototype=e,n=new Ae),t&&y(t,n),n}var Te=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function Le(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||Te.test(e))}function Pe(e,t){return t?t.source.indexOf("\\w")>-1&&Le(e)?!0:t.test(e):Le(e)}function He(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var Fe=/[\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 Ue(e){return e.charCodeAt(0)>=768&&Fe.test(e)}function Ne(e,t,n){for(;(n<0?t>0:t<e.length)&&Ue(e.charAt(t));)t+=n;return t}function Ze(e,t,n){for(var i=t>n?-1:1;;){if(t==n)return t;var r=(t+n)/2,I=i<0?Math.ceil(r):Math.floor(r);if(I==t)return e(I)?t:n;e(I)?n=I:t=I+i}}function st(e,t,n,i){if(!e)return i(t,n,"ltr",0);for(var r=!1,I=0;I<e.length;++I){var z=e[I];(z.from<n&&z.to>t||t==n&&z.to==t)&&(i(Math.max(z.from,t),Math.min(z.to,n),z.level==1?"rtl":"ltr",I),r=!0)}r||i(t,n,"ltr")}var tt=null;function et(e,t,n){var i;tt=null;for(var r=0;r<e.length;++r){var I=e[r];if(I.from<t&&I.to>t)return r;I.to==t&&(I.from!=I.to&&n=="before"?i=r:tt=r),I.from==t&&(I.from!=I.to&&n!="before"?i=r:tt=r)}return i!=null?i:tt}var ut=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n(ee){return ee<=247?e.charAt(ee):1424<=ee&&ee<=1524?"R":1536<=ee&&ee<=1785?t.charAt(ee-1536):1774<=ee&&ee<=2220?"r":8192<=ee&&ee<=8203?"w":ee==8204?"b":"L"}var i=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,r=/[stwN]/,I=/[LRr]/,z=/[Lb1n]/,$=/[1n]/;function J(ee,ce,ge){this.level=ee,this.from=ce,this.to=ge}return function(ee,ce){var ge=ce=="ltr"?"L":"R";if(ee.length==0||ce=="ltr"&&!i.test(ee))return!1;for(var Re=ee.length,Oe=[],Be=0;Be<Re;++Be)Oe.push(n(ee.charCodeAt(Be)));for(var Ke=0,$e=ge;Ke<Re;++Ke){var rt=Oe[Ke];rt=="m"?Oe[Ke]=$e:$e=rt}for(var ht=0,at=ge;ht<Re;++ht){var pt=Oe[ht];pt=="1"&&at=="r"?Oe[ht]="n":I.test(pt)&&(at=pt,pt=="r"&&(Oe[ht]="R"))}for(var St=1,Et=Oe[0];St<Re-1;++St){var Dt=Oe[St];Dt=="+"&&Et=="1"&&Oe[St+1]=="1"?Oe[St]="1":Dt==","&&Et==Oe[St+1]&&(Et=="1"||Et=="n")&&(Oe[St]=Et),Et=Dt}for(var $t=0;$t<Re;++$t){var fi=Oe[$t];if(fi==",")Oe[$t]="N";else if(fi=="%"){var qt=void 0;for(qt=$t+1;qt<Re&&Oe[qt]=="%";++qt);for(var Bi=$t&&Oe[$t-1]=="!"||qt<Re&&Oe[qt]=="1"?"1":"N",Di=$t;Di<qt;++Di)Oe[Di]=Bi;$t=qt-1}}for(var ri=0,Mi=ge;ri<Re;++ri){var yi=Oe[ri];Mi=="L"&&yi=="1"?Oe[ri]="L":I.test(yi)&&(Mi=yi)}for(var oi=0;oi<Re;++oi)if(r.test(Oe[oi])){var ai=void 0;for(ai=oi+1;ai<Re&&r.test(Oe[ai]);++ai);for(var ei=(oi?Oe[oi-1]:ge)=="L",Pi=(ai<Re?Oe[ai]:ge)=="L",ur=ei==Pi?ei?"L":"R":ge,In=oi;In<ai;++In)Oe[In]=ur;oi=ai-1}for(var wi=[],on,pi=0;pi<Re;)if(z.test(Oe[pi])){var Va=pi;for(++pi;pi<Re&&z.test(Oe[pi]);++pi);wi.push(new J(0,Va,pi))}else{var fn=pi,Gn=wi.length,zn=ce=="rtl"?1:0;for(++pi;pi<Re&&Oe[pi]!="L";++pi);for(var Oi=fn;Oi<pi;)if($.test(Oe[Oi])){fn<Oi&&(wi.splice(Gn,0,new J(1,fn,Oi)),Gn+=zn);var hr=Oi;for(++Oi;Oi<pi&&$.test(Oe[Oi]);++Oi);wi.splice(Gn,0,new J(2,hr,Oi)),Gn+=zn,fn=Oi}else++Oi;fn<pi&&wi.splice(Gn,0,new J(1,fn,pi))}return ce=="ltr"&&(wi[0].level==1&&(on=ee.match(/^\s+/))&&(wi[0].from=on[0].length,wi.unshift(new J(0,0,on[0].length))),te(wi).level==1&&(on=ee.match(/\s+$/))&&(te(wi).to-=on[0].length,wi.push(new J(0,Re-on[0].length,Re)))),ce=="rtl"?wi.reverse():wi}}();function Ye(e,t){var n=e.order;return n==null&&(n=e.order=ut(e.text,t)),n}var Xe=[],Ie=function(e,t,n){if(e.addEventListener)e.addEventListener(t,n,!1);else if(e.attachEvent)e.attachEvent("on"+t,n);else{var i=e._handlers||(e._handlers={});i[t]=(i[t]||Xe).concat(n)}};function lt(e,t){return e._handlers&&e._handlers[t]||Xe}function nt(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n,!1);else if(e.detachEvent)e.detachEvent("on"+t,n);else{var i=e._handlers,r=i&&i[t];if(r){var I=ie(r,n);I>-1&&(i[t]=r.slice(0,I).concat(r.slice(I+1)))}}}function De(e,t){var n=lt(e,t);if(!n.length)return;for(var i=Array.prototype.slice.call(arguments,2),r=0;r<n.length;++r)n[r].apply(null,i)}function ze(e,t,n){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),De(e,n||t.type,e,t),de(t)||t.codemirrorIgnore}function xe(e){var t=e._handlers&&e._handlers.cursorActivity;if(!t)return;for(var n=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),i=0;i<t.length;++i)ie(n,t[i])==-1&&n.push(t[i])}function ye(e,t){return lt(e,t).length>0}function _e(e){e.prototype.on=function(t,n){Ie(this,t,n)},e.prototype.off=function(t,n){nt(this,t,n)}}function ne(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function re(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function de(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function me(e){ne(e),re(e)}function Ee(e){return e.target||e.srcElement}function Me(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),o&&e.ctrlKey&&t==1&&(t=3),t}var je=function(){if(K&&W<9)return!1;var e=d("div");return"draggable"in e||"dragDrop"in e}(),it;function ft(e){if(it==null){var t=d("span","\u200B");E(e,d("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(it=t.offsetWidth<=1&&t.offsetHeight>2&&!(K&&W<8))}var n=it?d("span","\u200B"):d("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var ct;function At(e){if(ct!=null)return ct;var t=E(e,document.createTextNode("A\u062EA")),n=g(t,0,1).getBoundingClientRect(),i=g(t,1,2).getBoundingClientRect();return S(e),!n||n.left==n.right?!1:ct=i.right-n.right<3}var wt=`
b`.split(/\n/).length!=3?function(e){for(var t=0,n=[],i=e.length;t<=i;){var r=e.indexOf(`
`,t);r==-1&&(r=e.length);var I=e.slice(t,e.charAt(r-1)=="\r"?r-1:r),z=I.indexOf("\r");z!=-1?(n.push(I.slice(0,z)),t+=z+1):(n.push(I),t=r+1)}return n}:function(e){return e.split(/\r\n?|\n/)},dt=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(n){}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},Ut=function(){var e=d("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),vt=null;function Rt(e){if(vt!=null)return vt;var t=E(e,d("span","x")),n=t.getBoundingClientRect(),i=g(t,0,1).getBoundingClientRect();return vt=Math.abs(n.left-i.left)>1}var Lt={},Je={};function li(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Lt[e]=t}function mi(e,t){Je[e]=t}function Qe(e){if(typeof e=="string"&&Je.hasOwnProperty(e))e=Je[e];else if(e&&typeof e.name=="string"&&Je.hasOwnProperty(e.name)){var t=Je[e.name];typeof t=="string"&&(t={name:t}),e=ke(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Qe("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Qe("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function yt(e,t){t=Qe(t);var n=Lt[t.name];if(!n)return yt(e,"text/plain");var i=n(e,t);if(It.hasOwnProperty(t.name)){var r=It[t.name];for(var I in r){if(!r.hasOwnProperty(I))continue;i.hasOwnProperty(I)&&(i["_"+I]=i[I]),i[I]=r[I]}}if(i.name=t.name,t.helperType&&(i.helperType=t.helperType),t.modeProps)for(var z in t.modeProps)i[z]=t.modeProps[z];return i}var It={};function kt(e,t){var n=It.hasOwnProperty(e)?It[e]:It[e]={};y(t,n)}function Jt(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var n={};for(var i in t){var r=t[i];r instanceof Array&&(r=r.concat([])),n[i]=r}return n}function Si(e,t){for(var n;e.innerMode&&!(n=e.innerMode(t),!n||n.mode==e);)t=n.state,e=n.mode;return n||{mode:e,state:t}}function en(e,t,n){return e.startState?e.startState(t,n):!0}var jt=function(e,t,n){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n};jt.prototype.eol=function(){return this.pos>=this.string.length},jt.prototype.sol=function(){return this.pos==this.lineStart},jt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},jt.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},jt.prototype.eat=function(e){var t=this.string.charAt(this.pos),n;if(typeof e=="string"?n=t==e:n=t&&(e.test?e.test(t):e(t)),n)return++this.pos,t},jt.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},jt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},jt.prototype.skipToEnd=function(){this.pos=this.string.length},jt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},jt.prototype.backUp=function(e){this.pos-=e},jt.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=G(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?G(this.string,this.lineStart,this.tabSize):0)},jt.prototype.indentation=function(){return G(this.string,null,this.tabSize)-(this.lineStart?G(this.string,this.lineStart,this.tabSize):0)},jt.prototype.match=function(e,t,n){if(typeof e=="string"){var i=function(z){return n?z.toLowerCase():z},r=this.string.substr(this.pos,e.length);if(i(r)==i(e))return t!==!1&&(this.pos+=e.length),!0}else{var I=this.string.slice(this.pos).match(e);return I&&I.index>0?null:(I&&t!==!1&&(this.pos+=I[0].length),I)}},jt.prototype.current=function(){return this.string.slice(this.start,this.pos)},jt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},jt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},jt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function mt(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 n=e;!n.lines;)for(var i=0;;++i){var r=n.children[i],I=r.chunkSize();if(t<I){n=r;break}t-=I}return n.lines[t]}function zi(e,t,n){var i=[],r=t.line;return e.iter(t.line,n.line+1,function(I){var z=I.text;r==n.line&&(z=z.slice(0,n.ch)),r==t.line&&(z=z.slice(t.ch)),i.push(z),++r}),i}function tn(e,t,n){var i=[];return e.iter(t,n,function(r){i.push(r.text)}),i}function bi(e,t){var n=t-e.height;if(n)for(var i=e;i;i=i.parent)i.height+=n}function Pt(e){if(e.parent==null)return null;for(var t=e.parent,n=ie(t.lines,e),i=t.parent;i;t=i,i=i.parent)for(var r=0;!(i.children[r]==t);++r)n+=i.children[r].chunkSize();return n+t.first}function Hi(e,t){var n=e.first;e:do{for(var i=0;i<e.children.length;++i){var r=e.children[i],I=r.height;if(t<I){e=r;continue e}t-=I,n+=r.chunkSize()}return n}while(!e.lines);for(var z=0;z<e.lines.length;++z){var $=e.lines[z],J=$.height;if(t<J)break;t-=J}return n+z}function Xi(e,t){return t>=e.first&&t<e.first+e.size}function pn(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function Ve(e,t,n){if(n===void 0&&(n=null),!(this instanceof Ve))return new Ve(e,t,n);this.line=e,this.ch=t,this.sticky=n}function Ct(e,t){return e.line-t.line||e.ch-t.ch}function mn(e,t){return e.sticky==t.sticky&&Ct(e,t)==0}function gn(e){return Ve(e.line,e.ch)}function vn(e,t){return Ct(e,t)<0?t:e}function yn(e,t){return Ct(e,t)<0?e:t}function X(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function v(e,t){if(t.line<e.first)return Ve(e.first,0);var n=e.first+e.size-1;return t.line>n?Ve(n,mt(e,n).text.length):C(t,mt(e,t.line).text.length)}function C(e,t){var n=e.ch;return n==null||n>t?Ve(e.line,t):n<0?Ve(e.line,0):e}function U(e,t){for(var n=[],i=0;i<t.length;i++)n[i]=v(e,t[i]);return n}var q=function(e,t){this.state=e,this.lookAhead=t},V=function(e,t,n,i){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=i||0,this.baseTokens=null,this.baseTokenPos=1};V.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},V.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}},V.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},V.fromSaved=function(e,t,n){return t instanceof q?new V(e,Jt(e.mode,t.state),n,t.lookAhead):new V(e,Jt(e.mode,t),n)},V.prototype.save=function(e){var t=e!==!1?Jt(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new q(t,this.maxLookAhead):t};function be(e,t,n,i){var r=[e.state.modeGen],I={};_i(e,t.text,e.doc.mode,n,function(ee,ce){return r.push(ee,ce)},I,i);for(var z=n.state,$=function(ee){n.baseTokens=r;var ce=e.state.overlays[ee],ge=1,Re=0;n.state=!0,_i(e,t.text,ce.mode,n,function(Oe,Be){for(var Ke=ge;Re<Oe;){var $e=r[ge];$e>Oe&&r.splice(ge,1,Oe,r[ge+1],$e),ge+=2,Re=Math.min(Oe,$e)}if(!Be)return;if(ce.opaque)r.splice(Ke,ge-Ke,Oe,"overlay "+Be),ge=Ke+2;else for(;Ke<ge;Ke+=2){var rt=r[Ke+1];r[Ke+1]=(rt?rt+" ":"")+"overlay "+Be}},I),n.state=z,n.baseTokens=null,n.baseTokenPos=1},J=0;J<e.state.overlays.length;++J)$(J);return{styles:r,classes:I.bgClass||I.textClass?I:null}}function We(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var i=qe(e,Pt(t)),r=t.text.length>e.options.maxHighlightLength&&Jt(e.doc.mode,i.state),I=be(e,t,i);r&&(i.state=r),t.stateAfter=i.save(!r),t.styles=I.styles,I.classes?t.styleClasses=I.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function qe(e,t,n){var i=e.doc,r=e.display;if(!i.mode.startState)return new V(i,!0,t);var I=Ei(e,t,n),z=I>i.first&&mt(i,I-1).stateAfter,$=z?V.fromSaved(i,z,I):new V(i,en(i.mode),I);return i.iter(I,t,function(J){gt(e,J.text,$);var ee=$.line;J.stateAfter=ee==t-1||ee%5==0||ee>=r.viewFrom&&ee<r.viewTo?$.save():null,$.nextLine()}),n&&(i.modeFrontier=$.line),$}function gt(e,t,n,i){var r=e.doc.mode,I=new jt(t,e.options.tabSize,n);for(I.start=I.pos=i||0,t==""&&Ge(r,n.state);!I.eol();)xt(r,I,n.state),I.start=I.pos}function Ge(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var n=Si(e,t);if(n.mode.blankLine)return n.mode.blankLine(n.state)}function xt(e,t,n,i){for(var r=0;r<10;r++){i&&(i[0]=Si(e,n).mode);var I=e.token(t,n);if(t.pos>t.start)return I}throw new Error("Mode "+e.name+" failed to advance stream.")}var Wt=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function Qt(e,t,n,i){var r=e.doc,I=r.mode,z;t=v(r,t);var $=mt(r,t.line),J=qe(e,t.line,n),ee=new jt($.text,e.options.tabSize,J),ce;for(i&&(ce=[]);(i||ee.pos<t.ch)&&!ee.eol();)ee.start=ee.pos,z=xt(I,ee,J.state),i&&ce.push(new Wt(ee,z,Jt(r.mode,J.state)));return i?ce:new Wt(ee,z,J.state)}function Ni(e,t){if(e)for(;;){var n=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!n)break;e=e.slice(0,n.index)+e.slice(n.index+n[0].length);var i=n[1]?"bgClass":"textClass";t[i]==null?t[i]=n[2]:new RegExp("(?:^|\\s)"+n[2]+"(?:$|\\s)").test(t[i])||(t[i]+=" "+n[2])}return e}function _i(e,t,n,i,r,I,z){var $=n.flattenSpans;$==null&&($=e.options.flattenSpans);var J=0,ee=null,ce=new jt(t,e.options.tabSize,i),ge,Re=e.options.addModeClass&&[null];for(t==""&&Ni(Ge(n,i.state),I);!ce.eol();){if(ce.pos>e.options.maxHighlightLength?($=!1,z&&gt(e,t,i,ce.pos),ce.pos=t.length,ge=null):ge=Ni(xt(n,ce,i.state,Re),I),Re){var Oe=Re[0].name;Oe&&(ge="m-"+(ge?Oe+" "+ge:Oe))}if(!$||ee!=ge){for(;J<ce.start;)J=Math.min(ce.start,J+5e3),r(J,ee);ee=ge}ce.start=ce.pos}for(;J<ce.pos;){var Be=Math.min(ce.pos,J+5e3);r(Be,ee),J=Be}}function Ei(e,t,n){for(var i,r,I=e.doc,z=n?-1:t-(e.doc.mode.innerMode?1e3:100),$=t;$>z;--$){if($<=I.first)return I.first;var J=mt(I,$-1),ee=J.stateAfter;if(ee&&(!n||$+(ee instanceof q?ee.lookAhead:0)<=I.modeFrontier))return $;var ce=G(J.text,null,e.options.tabSize);(r==null||i>ce)&&(r=$-1,i=ce)}return r}function Yi(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),e.highlightFrontier<t-10)return;for(var n=e.first,i=t-1;i>n;i--){var r=mt(e,i).stateAfter;if(r&&(!(r instanceof q)||i+r.lookAhead<t)){n=i+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}var kn=!1,ui=!1;function ji(){kn=!0}function ln(){ui=!0}function un(e,t,n){this.marker=e,this.from=t,this.to=n}function Fi(e,t){if(e)for(var n=0;n<e.length;++n){var i=e[n];if(i.marker==t)return i}}function Dn(e,t){for(var n,i=0;i<e.length;++i)e[i]!=t&&(n||(n=[])).push(e[i]);return n}function bn(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function Kn(e,t,n){var i;if(e)for(var r=0;r<e.length;++r){var I=e[r],z=I.marker,$=I.from==null||(z.inclusiveLeft?I.from<=t:I.from<t);if($||I.from==t&&z.type=="bookmark"&&(!n||!I.marker.insertLeft)){var J=I.to==null||(z.inclusiveRight?I.to>=t:I.to>t);(i||(i=[])).push(new un(z,I.from,J?null:I.to))}}return i}function Vn(e,t,n){var i;if(e)for(var r=0;r<e.length;++r){var I=e[r],z=I.marker,$=I.to==null||(z.inclusiveRight?I.to>=t:I.to>t);if($||I.from==t&&z.type=="bookmark"&&(!n||I.marker.insertLeft)){var J=I.from==null||(z.inclusiveLeft?I.from<=t:I.from<t);(i||(i=[])).push(new un(z,J?null:I.from-t,I.to==null?null:I.to-t))}}return i}function $i(e,t){if(t.full)return null;var n=Xi(e,t.from.line)&&mt(e,t.from.line).markedSpans,i=Xi(e,t.to.line)&&mt(e,t.to.line).markedSpans;if(!n&&!i)return null;var r=t.from.ch,I=t.to.ch,z=Ct(t.from,t.to)==0,$=Kn(n,r,z),J=Vn(i,I,z),ee=t.text.length==1,ce=te(t.text).length+(ee?r:0);if($)for(var ge=0;ge<$.length;++ge){var Re=$[ge];if(Re.to==null){var Oe=Fi(J,Re.marker);Oe?ee&&(Re.to=Oe.to==null?null:Oe.to+ce):Re.to=r}}if(J)for(var Be=0;Be<J.length;++Be){var Ke=J[Be];if(Ke.to!=null&&(Ke.to+=ce),Ke.from==null){var $e=Fi($,Ke.marker);$e||(Ke.from=ce,ee&&($||($=[])).push(Ke))}else Ke.from+=ce,ee&&($||($=[])).push(Ke)}$&&($=Ki($)),J&&J!=$&&(J=Ki(J));var rt=[$];if(!ee){var ht=t.text.length-2,at;if(ht>0&&$)for(var pt=0;pt<$.length;++pt)$[pt].to==null&&(at||(at=[])).push(new un($[pt].marker,null,null));for(var St=0;St<ht;++St)rt.push(at);rt.push(J)}return rt}function Ki(e){for(var t=0;t<e.length;++t){var n=e[t];n.from!=null&&n.from==n.to&&n.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function _n(e,t,n){var i=null;if(e.iter(t.line,n.line+1,function(Oe){if(Oe.markedSpans)for(var Be=0;Be<Oe.markedSpans.length;++Be){var Ke=Oe.markedSpans[Be].marker;Ke.readOnly&&(!i||ie(i,Ke)==-1)&&(i||(i=[])).push(Ke)}}),!i)return null;for(var r=[{from:t,to:n}],I=0;I<i.length;++I)for(var z=i[I],$=z.find(0),J=0;J<r.length;++J){var ee=r[J];if(Ct(ee.to,$.from)<0||Ct(ee.from,$.to)>0)continue;var ce=[J,1],ge=Ct(ee.from,$.from),Re=Ct(ee.to,$.to);(ge<0||!z.inclusiveLeft&&!ge)&&ce.push({from:ee.from,to:$.from}),(Re>0||!z.inclusiveRight&&!Re)&&ce.push({from:$.to,to:ee.to}),r.splice.apply(r,ce),J+=ce.length-3}return r}function dr(e){var t=e.markedSpans;if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.detachLine(e);e.markedSpans=null}function En(e,t){if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}function ti(e){return e.inclusiveLeft?-1:0}function Gt(e){return e.inclusiveRight?1:0}function gi(e,t){var n=e.lines.length-t.lines.length;if(n!=0)return n;var i=e.find(),r=t.find(),I=Ct(i.from,r.from)||ti(e)-ti(t);if(I)return-I;var z=Ct(i.to,r.to)||Gt(e)-Gt(t);return z||t.id-e.id}function Nt(e,t){var n=ui&&e.markedSpans,i;if(n)for(var r=void 0,I=0;I<n.length;++I)r=n[I],r.marker.collapsed&&(t?r.from:r.to)==null&&(!i||gi(i,r.marker)<0)&&(i=r.marker);return i}function ni(e){return Nt(e,!0)}function Vt(e){return Nt(e,!1)}function nn(e,t){var n=ui&&e.markedSpans,i;if(n)for(var r=0;r<n.length;++r){var I=n[r];I.marker.collapsed&&(I.from==null||I.from<t)&&(I.to==null||I.to>t)&&(!i||gi(i,I.marker)<0)&&(i=I.marker)}return i}function hi(e,t,n,i,r){var I=mt(e,t),z=ui&&I.markedSpans;if(z)for(var $=0;$<z.length;++$){var J=z[$];if(!J.marker.collapsed)continue;var ee=J.marker.find(0),ce=Ct(ee.from,n)||ti(J.marker)-ti(r),ge=Ct(ee.to,i)||Gt(J.marker)-Gt(r);if(ce>=0&&ge<=0||ce<=0&&ge>=0)continue;if(ce<=0&&(J.marker.inclusiveRight&&r.inclusiveLeft?Ct(ee.to,n)>=0:Ct(ee.to,n)>0)||ce>=0&&(J.marker.inclusiveRight&&r.inclusiveLeft?Ct(ee.from,i)<=0:Ct(ee.from,i)<0))return!0}}function Ci(e){for(var t;t=ni(e);)e=t.find(-1,!0).line;return e}function Xn(e){for(var t;t=Vt(e);)e=t.find(1,!0).line;return e}function xn(e){for(var t,n;t=Vt(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function cr(e,t){var n=mt(e,t),i=Ci(n);return n==i?t:Pt(i)}function Tn(e,t){if(t>e.lastLine())return t;var n=mt(e,t),i;if(!rn(e,n))return t;for(;i=Vt(n);)n=i.find(1,!0).line;return Pt(n)+1}function rn(e,t){var n=ui&&t.markedSpans;if(n)for(var i=void 0,r=0;r<n.length;++r){if(i=n[r],!i.marker.collapsed)continue;if(i.from==null)return!0;if(i.marker.widgetNode)continue;if(i.from==0&&i.marker.inclusiveLeft&&fr(e,t,i))return!0}}function fr(e,t,n){if(n.to==null){var i=n.marker.find(1,!0);return fr(e,i.line,Fi(i.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var r=void 0,I=0;I<t.markedSpans.length;++I)if(r=t.markedSpans[I],r.marker.collapsed&&!r.marker.widgetNode&&r.from==n.to&&(r.to==null||r.to!=n.from)&&(r.marker.inclusiveLeft||n.marker.inclusiveRight)&&fr(e,t,r))return!0}function Qi(e){e=Ci(e);for(var t=0,n=e.parent,i=0;i<n.lines.length;++i){var r=n.lines[i];if(r==e)break;t+=r.height}for(var I=n.parent;I;n=I,I=n.parent)for(var z=0;z<I.children.length;++z){var $=I.children[z];if($==n)break;t+=$.height}return t}function pr(e){if(e.height==0)return 0;for(var t=e.text.length,n,i=e;n=ni(i);){var r=n.find(0,!0);i=r.from.line,t+=r.from.ch-r.to.ch}for(i=e;n=Vt(i);){var I=n.find(0,!0);t-=i.text.length-I.from.ch,i=I.to.line,t+=i.text.length-I.to.ch}return t}function Hr(e){var t=e.display,n=e.doc;t.maxLine=mt(n,n.first),t.maxLineLength=pr(t.maxLine),t.maxLineChanged=!0,n.iter(function(i){var r=pr(i);r>t.maxLineLength&&(t.maxLineLength=r,t.maxLine=i)})}var Mn=function(e,t,n){this.text=e,En(this,t),this.height=n?n(this):1};Mn.prototype.lineNo=function(){return Pt(this)},_e(Mn);function ua(e,t,n,i){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),dr(e),En(e,n);var r=i?i(e):1;r!=e.height&&bi(e,r)}function bt(e){e.parent=null,dr(e)}var Ot={},Tt={};function Mt(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?Tt:Ot;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Ht(e,t){var n=b("span",null,null,P?"padding-right: .1px":null),i={pre:b("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var r=0;r<=(t.rest?t.rest.length:0);r++){var I=r?t.rest[r-1]:t.line,z=void 0;i.pos=0,i.addToken=Bt,At(e.display.measure)&&(z=Ye(I,e.doc.direction))&&(i.addToken=Ri(i.addToken,z)),i.map=[];var $=t!=e.display.externalMeasured&&Pt(I);hn(I,i,We(e,I,$)),I.styleClasses&&(I.styleClasses.bgClass&&(i.bgClass=j(I.styleClasses.bgClass,i.bgClass||"")),I.styleClasses.textClass&&(i.textClass=j(I.styleClasses.textClass,i.textClass||""))),i.map.length==0&&i.map.push(0,0,i.content.appendChild(ft(e.display.measure))),r==0?(t.measure.map=i.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(i.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(P){var J=i.content.lastChild;(/\bcm-tab\b/.test(J.className)||J.querySelector&&J.querySelector(".cm-tab"))&&(i.content.className="cm-tab-wrap-hack")}return De(e,"renderLine",e,t.line,i.pre),i.pre.className&&(i.textClass=j(i.pre.className,i.textClass||"")),i}function Yt(e){var t=d("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Bt(e,t,n,i,r,I,z){if(!t)return;var $=e.splitSpaces?si(t,e.trailingSpace):t,J=e.cm.state.specialChars,ee=!1,ce;if(!J.test(t))e.col+=t.length,ce=document.createTextNode($),e.map.push(e.pos,e.pos+t.length,ce),K&&W<9&&(ee=!0),e.pos+=t.length;else{ce=document.createDocumentFragment();for(var ge=0;;){J.lastIndex=ge;var Re=J.exec(t),Oe=Re?Re.index-ge:t.length-ge;if(Oe){var Be=document.createTextNode($.slice(ge,ge+Oe));K&&W<9?ce.appendChild(d("span",[Be])):ce.appendChild(Be),e.map.push(e.pos,e.pos+Oe,Be),e.col+=Oe,e.pos+=Oe}if(!Re)break;ge+=Oe+1;var Ke=void 0;if(Re[0]==" "){var $e=e.cm.options.tabSize,rt=$e-e.col%$e;Ke=ce.appendChild(d("span",oe(rt),"cm-tab")),Ke.setAttribute("role","presentation"),Ke.setAttribute("cm-text"," "),e.col+=rt}else Re[0]=="\r"||Re[0]==`
`?(Ke=ce.appendChild(d("span",Re[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Ke.setAttribute("cm-text",Re[0]),e.col+=1):(Ke=e.cm.options.specialCharPlaceholder(Re[0]),Ke.setAttribute("cm-text",Re[0]),K&&W<9?ce.appendChild(d("span",[Ke])):ce.appendChild(Ke),e.col+=1);e.map.push(e.pos,e.pos+1,Ke),e.pos++}}if(e.trailingSpace=$.charCodeAt(t.length-1)==32,n||i||r||ee||I||z){var ht=n||"";i&&(ht+=i),r&&(ht+=r);var at=d("span",[ce],ht,I);if(z)for(var pt in z)z.hasOwnProperty(pt)&&pt!="style"&&pt!="class"&&at.setAttribute(pt,z[pt]);return e.content.appendChild(at)}e.content.appendChild(ce)}function si(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,i="",r=0;r<e.length;r++){var I=e.charAt(r);I==" "&&n&&(r==e.length-1||e.charCodeAt(r+1)==32)&&(I="\xA0"),i+=I,n=I==" "}return i}function Ri(e,t){return function(n,i,r,I,z,$,J){r=r?r+" cm-force-border":"cm-force-border";for(var ee=n.pos,ce=ee+i.length;;){for(var ge=void 0,Re=0;Re<t.length&&!(ge=t[Re],ge.to>ee&&ge.from<=ee);Re++);if(ge.to>=ce)return e(n,i,r,I,z,$,J);e(n,i.slice(0,ge.to-ee),r,I,null,$,J),I=null,i=i.slice(ge.to-ee),ee=ge.to}}}function Ft(e,t,n,i){var r=!i&&n.widgetNode;r&&e.map.push(e.pos,e.pos+t,r),!i&&e.cm.display.input.needsContentAttribute&&(r||(r=e.content.appendChild(document.createElement("span"))),r.setAttribute("cm-marker",n.id)),r&&(e.cm.display.input.setUneditable(r),e.content.appendChild(r)),e.pos+=t,e.trailingSpace=!1}function hn(e,t,n){var i=e.markedSpans,r=e.text,I=0;if(!i){for(var z=1;z<n.length;z+=2)t.addToken(t,r.slice(I,I=n[z]),Mt(n[z+1],t.cm.options));return}for(var $=r.length,J=0,ee=1,ce="",ge,Re,Oe=0,Be,Ke,$e,rt,ht;;){if(Oe==J){Be=Ke=$e=Re="",ht=null,rt=null,Oe=Infinity;for(var at=[],pt=void 0,St=0;St<i.length;++St){var Et=i[St],Dt=Et.marker;if(Dt.type=="bookmark"&&Et.from==J&&Dt.widgetNode)at.push(Dt);else if(Et.from<=J&&(Et.to==null||Et.to>J||Dt.collapsed&&Et.to==J&&Et.from==J)){if(Et.to!=null&&Et.to!=J&&Oe>Et.to&&(Oe=Et.to,Ke=""),Dt.className&&(Be+=" "+Dt.className),Dt.css&&(Re=(Re?Re+";":"")+Dt.css),Dt.startStyle&&Et.from==J&&($e+=" "+Dt.startStyle),Dt.endStyle&&Et.to==Oe&&(pt||(pt=[])).push(Dt.endStyle,Et.to),Dt.title&&((ht||(ht={})).title=Dt.title),Dt.attributes)for(var $t in Dt.attributes)(ht||(ht={}))[$t]=Dt.attributes[$t];Dt.collapsed&&(!rt||gi(rt.marker,Dt)<0)&&(rt=Et)}else Et.from>J&&Oe>Et.from&&(Oe=Et.from)}if(pt)for(var fi=0;fi<pt.length;fi+=2)pt[fi+1]==Oe&&(Ke+=" "+pt[fi]);if(!rt||rt.from==J)for(var qt=0;qt<at.length;++qt)Ft(t,0,at[qt]);if(rt&&(rt.from||0)==J){if(Ft(t,(rt.to==null?$+1:rt.to)-J,rt.marker,rt.from==null),rt.to==null)return;rt.to==J&&(rt=!1)}}if(J>=$)break;for(var Bi=Math.min($,Oe);;){if(ce){var Di=J+ce.length;if(!rt){var ri=Di>Bi?ce.slice(0,Bi-J):ce;t.addToken(t,ri,ge?ge+Be:Be,$e,J+ri.length==Oe?Ke:"",Re,ht)}if(Di>=Bi){ce=ce.slice(Bi-J),J=Bi;break}J=Di,$e=""}ce=r.slice(I,I=n[ee++]),ge=Mt(n[ee++],t.cm.options)}}}function zt(e,t,n){this.line=t,this.rest=xn(t),this.size=this.rest?Pt(te(this.rest))-n+1:1,this.node=this.text=null,this.hidden=rn(e,t)}function Li(e,t,n){for(var i=[],r,I=t;I<n;I=r){var z=new zt(e.doc,mt(e.doc,I),I);r=I+z.size,i.push(z)}return i}var xi=null;function Vi(e){xi?xi.ops.push(e):e.ownsGroup=xi={ops:[e],delayedCallbacks:[]}}function Lo(e){var t=e.delayedCallbacks,n=0;do{for(;n<t.length;n++)t[n].call(null);for(var i=0;i<e.ops.length;i++){var r=e.ops[i];if(r.cursorActivityHandlers)for(;r.cursorActivityCalled<r.cursorActivityHandlers.length;)r.cursorActivityHandlers[r.cursorActivityCalled++].call(null,r.cm)}}while(n<t.length)}function Io(e,t){var n=e.ownsGroup;if(!n)return;try{Lo(n)}finally{xi=null,t(n)}}var mr=null;function vi(e,t){var n=lt(e,t);if(!n.length)return;var i=Array.prototype.slice.call(arguments,2),r;xi?r=xi.delayedCallbacks:mr?r=mr:(r=mr=[],setTimeout(ko,0));for(var I=function($){r.push(function(){return n[$].apply(null,i)})},z=0;z<n.length;++z)I(z)}function ko(){var e=mr;mr=null;for(var t=0;t<e.length;++t)e[t]()}function Ya(e,t,n,i){for(var r=0;r<t.changes.length;r++){var I=t.changes[r];I=="text"?Mo(e,t):I=="gutter"?Qa(e,t,n,i):I=="class"?ha(e,t):I=="widget"&&Po(e,t,i)}t.changes=null}function gr(e){return e.node==e.text&&(e.node=d("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),K&&W<8&&(e.node.style.zIndex=2)),e.node}function Do(e,t){var n=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(n&&(n+=" CodeMirror-linebackground"),t.background)n?t.background.className=n:(t.background.parentNode.removeChild(t.background),t.background=null);else if(n){var i=gr(t);t.background=i.insertBefore(d("div",null,n),i.firstChild),e.display.input.setUneditable(t.background)}}function $a(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):Ht(e,t)}function Mo(e,t){var n=t.text.className,i=$a(e,t);t.text==t.node&&(t.node=i.pre),t.text.parentNode.replaceChild(i.pre,t.text),t.text=i.pre,i.bgClass!=t.bgClass||i.textClass!=t.textClass?(t.bgClass=i.bgClass,t.textClass=i.textClass,ha(e,t)):n&&(t.text.className=n)}function ha(e,t){Do(e,t),t.line.wrapClass?gr(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var n=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=n||""}function Qa(e,t,n,i){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 r=gr(t);t.gutterBackground=d("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?i.fixedPos:-i.gutterTotalWidth)+"px; width: "+i.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),r.insertBefore(t.gutterBackground,t.text)}var I=t.line.gutterMarkers;if(e.options.lineNumbers||I){var z=gr(t),$=t.gutter=d("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?i.fixedPos:-i.gutterTotalWidth)+"px");if(e.display.input.setUneditable($),z.insertBefore($,t.text),t.line.gutterClass&&($.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!I||!I["CodeMirror-linenumbers"])&&(t.lineNumber=$.appendChild(d("div",pn(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+i.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),I)for(var J=0;J<e.display.gutterSpecs.length;++J){var ee=e.display.gutterSpecs[J].className,ce=I.hasOwnProperty(ee)&&I[ee];ce&&$.appendChild(d("div",[ce],"CodeMirror-gutter-elt","left: "+i.gutterLeft[ee]+"px; width: "+i.gutterWidth[ee]+"px"))}}}function Po(e,t,n){t.alignable&&(t.alignable=null);for(var i=A("CodeMirror-linewidget"),r=t.node.firstChild,I=void 0;r;r=I)I=r.nextSibling,i.test(r.className)&&t.node.removeChild(r);Za(e,t,n)}function No(e,t,n,i){var r=$a(e,t);return t.text=t.node=r.pre,r.bgClass&&(t.bgClass=r.bgClass),r.textClass&&(t.textClass=r.textClass),ha(e,t),Qa(e,t,n,i),Za(e,t,i),t.node}function Za(e,t,n){if(Ja(e,t.line,t,n,!0),t.rest)for(var i=0;i<t.rest.length;i++)Ja(e,t.rest[i],t,n,!1)}function Ja(e,t,n,i,r){if(!t.widgets)return;for(var I=gr(n),z=0,$=t.widgets;z<$.length;++z){var J=$[z],ee=d("div",[J.node],"CodeMirror-linewidget"+(J.className?" "+J.className:""));J.handleMouseEvents||ee.setAttribute("cm-ignore-events","true"),Fo(J,ee,n,i),e.display.input.setUneditable(ee),r&&J.above?I.insertBefore(ee,n.gutter||n.text):I.appendChild(ee),vi(J,"redraw")}}function Fo(e,t,n,i){if(e.noHScroll){(n.alignable||(n.alignable=[])).push(t);var r=i.wrapperWidth;t.style.left=i.fixedPos+"px",e.coverGutter||(r-=i.gutterTotalWidth,t.style.paddingLeft=i.gutterTotalWidth+"px"),t.style.width=r+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-i.gutterTotalWidth+"px"))}function vr(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!_(document.body,e.node)){var n="position: relative;";e.coverGutter&&(n+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(n+="width: "+t.display.wrapper.clientWidth+"px;"),E(t.display.measure,d("div",[e.node],null,n))}return e.height=e.node.parentNode.offsetHeight}function dn(e,t){for(var n=Ee(t);n!=e.wrapper;n=n.parentNode)if(!n||n.nodeType==1&&n.getAttribute("cm-ignore-events")=="true"||n.parentNode==e.sizer&&n!=e.mover)return!0}function jr(e){return e.lineSpace.offsetTop}function da(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function qa(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=E(e.measure,d("pre","x","CodeMirror-line-like")),n=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,i={left:parseInt(n.paddingLeft),right:parseInt(n.paddingRight)};return!isNaN(i.left)&&!isNaN(i.right)&&(e.cachedPaddingH=i),i}function an(e){return se-e.display.nativeBarWidth}function Pn(e){return e.display.scroller.clientWidth-an(e)-e.display.barWidth}function ca(e){return e.display.scroller.clientHeight-an(e)-e.display.barHeight}function Uo(e,t,n){var i=e.options.lineWrapping,r=i&&Pn(e);if(!t.measure.heights||i&&t.measure.width!=r){var I=t.measure.heights=[];if(i){t.measure.width=r;for(var z=t.text.firstChild.getClientRects(),$=0;$<z.length-1;$++){var J=z[$],ee=z[$+1];Math.abs(J.bottom-ee.bottom)>2&&I.push((J.bottom+ee.top)/2-n.top)}}I.push(n.bottom-n.top)}}function es(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var i=0;i<e.rest.length;i++)if(e.rest[i]==t)return{map:e.measure.maps[i],cache:e.measure.caches[i]};for(var r=0;r<e.rest.length;r++)if(Pt(e.rest[r])>n)return{map:e.measure.maps[r],cache:e.measure.caches[r],before:!0}}function Bo(e,t){t=Ci(t);var n=Pt(t),i=e.display.externalMeasured=new zt(e.doc,t,n);i.lineN=n;var r=i.built=Ht(e,i);return i.text=r.pre,E(e.display.lineMeasure,r.pre),i}function ts(e,t,n,i){return sn(e,Yn(e,t),n,i)}function fa(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[Un(e,t)];var n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size)return n}function Yn(e,t){var n=Pt(t),i=fa(e,n);i&&!i.text?i=null:i&&i.changes&&(Ya(e,i,n,ba(e)),e.curOp.forceUpdate=!0),i||(i=Bo(e,t));var r=es(i,t,n);return{line:t,view:i,rect:null,map:r.map,cache:r.cache,before:r.before,hasHeights:!1}}function sn(e,t,n,i,r){t.before&&(n=-1);var I=n+(i||""),z;return t.cache.hasOwnProperty(I)?z=t.cache[I]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Uo(e,t.view,t.rect),t.hasHeights=!0),z=jo(e,t,n,i),z.bogus||(t.cache[I]=z)),{left:z.left,right:z.right,top:r?z.rtop:z.top,bottom:r?z.rbottom:z.bottom}}var is={left:0,right:0,top:0,bottom:0};function ns(e,t,n){for(var i,r,I,z,$,J,ee=0;ee<e.length;ee+=3)if($=e[ee],J=e[ee+1],t<$?(r=0,I=1,z="left"):t<J?(r=t-$,I=r+1):(ee==e.length-3||t==J&&e[ee+3]>t)&&(I=J-$,r=I-1,t>=J&&(z="right")),r!=null){if(i=e[ee+2],$==J&&n==(i.insertLeft?"left":"right")&&(z=n),n=="left"&&r==0)for(;ee&&e[ee-2]==e[ee-3]&&e[ee-1].insertLeft;)i=e[(ee-=3)+2],z="left";if(n=="right"&&r==J-$)for(;ee<e.length-3&&e[ee+3]==e[ee+4]&&!e[ee+5].insertLeft;)i=e[(ee+=3)+2],z="right";break}return{node:i,start:r,end:I,collapse:z,coverStart:$,coverEnd:J}}function Ho(e,t){var n=is;if(t=="left")for(var i=0;i<e.length&&!((n=e[i]).left!=n.right);i++);else for(var r=e.length-1;r>=0&&!((n=e[r]).left!=n.right);r--);return n}function jo(e,t,n,i){var r=ns(t.map,n,i),I=r.node,z=r.start,$=r.end,J=r.collapse,ee;if(I.nodeType==3){for(var ce=0;ce<4;ce++){for(;z&&Ue(t.line.text.charAt(r.coverStart+z));)--z;for(;r.coverStart+$<r.coverEnd&&Ue(t.line.text.charAt(r.coverStart+$));)++$;if(K&&W<9&&z==0&&$==r.coverEnd-r.coverStart?ee=I.parentNode.getBoundingClientRect():ee=Ho(g(I,z,$).getClientRects(),i),ee.left||ee.right||z==0)break;$=z,z=z-1,J="right"}K&&W<11&&(ee=Wo(e.display.measure,ee))}else{z>0&&(J=i="right");var ge;e.options.lineWrapping&&(ge=I.getClientRects()).length>1?ee=ge[i=="right"?ge.length-1:0]:ee=I.getBoundingClientRect()}if(K&&W<9&&!z&&(!ee||!ee.left&&!ee.right)){var Re=I.parentNode.getClientRects()[0];Re?ee={left:Re.left,right:Re.left+Qn(e.display),top:Re.top,bottom:Re.bottom}:ee=is}for(var Oe=ee.top-t.rect.top,Be=ee.bottom-t.rect.top,Ke=(Oe+Be)/2,$e=t.view.measure.heights,rt=0;rt<$e.length-1&&!(Ke<$e[rt]);rt++);var ht=rt?$e[rt-1]:0,at=$e[rt],pt={left:(J=="right"?ee.right:ee.left)-t.rect.left,right:(J=="left"?ee.left:ee.right)-t.rect.left,top:ht,bottom:at};return!ee.left&&!ee.right&&(pt.bogus=!0),e.options.singleCursorHeightPerLine||(pt.rtop=Oe,pt.rbottom=Be),pt}function Wo(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!Rt(e))return t;var n=screen.logicalXDPI/screen.deviceXDPI,i=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*n,right:t.right*n,top:t.top*i,bottom:t.bottom*i}}function rs(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 as(e){e.display.externalMeasure=null,S(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)rs(e.display.view[t])}function yr(e){as(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function ss(){return m&&l?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function os(){return m&&l?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function pa(e){var t=0;if(e.widgets)for(var n=0;n<e.widgets.length;++n)e.widgets[n].above&&(t+=vr(e.widgets[n]));return t}function Wr(e,t,n,i,r){if(!r){var I=pa(t);n.top+=I,n.bottom+=I}if(i=="line")return n;i||(i="local");var z=Qi(t);if(i=="local"?z+=jr(e.display):z-=e.display.viewOffset,i=="page"||i=="window"){var $=e.display.lineSpace.getBoundingClientRect();z+=$.top+(i=="window"?0:os());var J=$.left+(i=="window"?0:ss());n.left+=J,n.right+=J}return n.top+=z,n.bottom+=z,n}function ls(e,t,n){if(n=="div")return t;var i=t.left,r=t.top;if(n=="page")i-=ss(),r-=os();else if(n=="local"||!n){var I=e.display.sizer.getBoundingClientRect();i+=I.left,r+=I.top}var z=e.display.lineSpace.getBoundingClientRect();return{left:i-z.left,top:r-z.top}}function ma(e,t,n,i,r){return i||(i=mt(e.doc,t.line)),Wr(e,i,ts(e,i,t.ch,r),n)}function Zi(e,t,n,i,r,I){i=i||mt(e.doc,t.line),r||(r=Yn(e,i));function z(Be,Ke){var $e=sn(e,r,Be,Ke?"right":"left",I);return Ke?$e.left=$e.right:$e.right=$e.left,Wr(e,i,$e,n)}var $=Ye(i,e.doc.direction),J=t.ch,ee=t.sticky;if(J>=i.text.length?(J=i.text.length,ee="before"):J<=0&&(J=0,ee="after"),!$)return z(ee=="before"?J-1:J,ee=="before");function ce(Be,Ke,$e){var rt=$[Ke],ht=rt.level==1;return z($e?Be-1:Be,ht!=$e)}var ge=et($,J,ee),Re=tt,Oe=ce(J,ge,ee=="before");return Re!=null&&(Oe.other=ce(J,Re,ee!="before")),Oe}function us(e,t){var n=0;t=v(e.doc,t),e.options.lineWrapping||(n=Qn(e.display)*t.ch);var i=mt(e.doc,t.line),r=Qi(i)+jr(e.display);return{left:n,right:n,top:r,bottom:r+i.height}}function ga(e,t,n,i,r){var I=Ve(e,t,n);return I.xRel=r,i&&(I.outside=i),I}function va(e,t,n){var i=e.doc;if(n+=e.display.viewOffset,n<0)return ga(i.first,0,null,-1,-1);var r=Hi(i,n),I=i.first+i.size-1;if(r>I)return ga(i.first+i.size-1,mt(i,I).text.length,null,1,1);t<0&&(t=0);for(var z=mt(i,r);;){var $=Go(e,z,r,t,n),J=nn(z,$.ch+($.xRel>0||$.outside>0?1:0));if(!J)return $;var ee=J.find(1);if(ee.line==r)return ee;z=mt(i,r=ee.line)}}function hs(e,t,n,i){i-=pa(t);var r=t.text.length,I=Ze(function(z){return sn(e,n,z-1).bottom<=i},r,0);return r=Ze(function(z){return sn(e,n,z).top>i},I,r),{begin:I,end:r}}function ds(e,t,n,i){n||(n=Yn(e,t));var r=Wr(e,t,sn(e,n,i),"line").top;return hs(e,t,n,r)}function ya(e,t,n,i){return e.bottom<=n?!1:e.top>n?!0:(i?e.left:e.right)>t}function Go(e,t,n,i,r){r-=Qi(t);var I=Yn(e,t),z=pa(t),$=0,J=t.text.length,ee=!0,ce=Ye(t,e.doc.direction);if(ce){var ge=(e.options.lineWrapping?Ko:zo)(e,t,n,I,ce,i,r);ee=ge.level!=1,$=ee?ge.from:ge.to-1,J=ee?ge.to:ge.from-1}var Re=null,Oe=null,Be=Ze(function(St){var Et=sn(e,I,St);return Et.top+=z,Et.bottom+=z,ya(Et,i,r,!1)?(Et.top<=r&&Et.left<=i&&(Re=St,Oe=Et),!0):!1},$,J),Ke,$e,rt=!1;if(Oe){var ht=i-Oe.left<Oe.right-i,at=ht==ee;Be=Re+(at?0:1),$e=at?"after":"before",Ke=ht?Oe.left:Oe.right}else{!ee&&(Be==J||Be==$)&&Be++,$e=Be==0?"after":Be==t.text.length?"before":sn(e,I,Be-(ee?1:0)).bottom+z<=r==ee?"after":"before";var pt=Zi(e,Ve(n,Be,$e),"line",t,I);Ke=pt.left,rt=r<pt.top?-1:r>=pt.bottom?1:0}return Be=Ne(t.text,Be,1),ga(n,Be,$e,rt,i-Ke)}function zo(e,t,n,i,r,I,z){var $=Ze(function(ge){var Re=r[ge],Oe=Re.level!=1;return ya(Zi(e,Ve(n,Oe?Re.to:Re.from,Oe?"before":"after"),"line",t,i),I,z,!0)},0,r.length-1),J=r[$];if($>0){var ee=J.level!=1,ce=Zi(e,Ve(n,ee?J.from:J.to,ee?"after":"before"),"line",t,i);ya(ce,I,z,!0)&&ce.top>z&&(J=r[$-1])}return J}function Ko(e,t,n,i,r,I,z){var $=hs(e,t,i,z),J=$.begin,ee=$.end;/\s/.test(t.text.charAt(ee-1))&&ee--;for(var ce=null,ge=null,Re=0;Re<r.length;Re++){var Oe=r[Re];if(Oe.from>=ee||Oe.to<=J)continue;var Be=Oe.level!=1,Ke=sn(e,i,Be?Math.min(ee,Oe.to)-1:Math.max(J,Oe.from)).right,$e=Ke<I?I-Ke+1e9:Ke-I;(!ce||ge>$e)&&(ce=Oe,ge=$e)}return ce||(ce=r[r.length-1]),ce.from<J&&(ce={from:J,to:ce.to,level:ce.level}),ce.to>ee&&(ce={from:ce.from,to:ee,level:ce.level}),ce}var Nn;function $n(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(Nn==null){Nn=d("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Nn.appendChild(document.createTextNode("x")),Nn.appendChild(d("br"));Nn.appendChild(document.createTextNode("x"))}E(e.measure,Nn);var n=Nn.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),S(e.measure),n||1}function Qn(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=d("span","xxxxxxxxxx"),n=d("pre",[t],"CodeMirror-line-like");E(e.measure,n);var i=t.getBoundingClientRect(),r=(i.right-i.left)/10;return r>2&&(e.cachedCharWidth=r),r||10}function ba(e){for(var t=e.display,n={},i={},r=t.gutters.clientLeft,I=t.gutters.firstChild,z=0;I;I=I.nextSibling,++z){var $=e.display.gutterSpecs[z].className;n[$]=I.offsetLeft+I.clientLeft+r,i[$]=I.clientWidth}return{fixedPos:_a(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:i,wrapperWidth:t.wrapper.clientWidth}}function _a(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function cs(e){var t=$n(e.display),n=e.options.lineWrapping,i=n&&Math.max(5,e.display.scroller.clientWidth/Qn(e.display)-3);return function(r){if(rn(e.doc,r))return 0;var I=0;if(r.widgets)for(var z=0;z<r.widgets.length;z++)r.widgets[z].height&&(I+=r.widgets[z].height);return n?I+(Math.ceil(r.text.length/i)||1)*t:I+t}}function Ea(e){var t=e.doc,n=cs(e);t.iter(function(i){var r=n(i);r!=i.height&&bi(i,r)})}function Fn(e,t,n,i){var r=e.display;if(!n&&Ee(t).getAttribute("cm-not-content")=="true")return null;var I,z,$=r.lineSpace.getBoundingClientRect();try{I=t.clientX-$.left,z=t.clientY-$.top}catch(ge){return null}var J=va(e,I,z),ee;if(i&&J.xRel>0&&(ee=mt(e.doc,J.line).text).length==J.ch){var ce=G(ee,ee.length,e.options.tabSize)-ee.length;J=Ve(J.line,Math.max(0,Math.round((I-qa(e.display).left)/Qn(e.display))-ce))}return J}function Un(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var n=e.display.view,i=0;i<n.length;i++)if(t-=n[i].size,t<0)return i}function Ii(e,t,n,i){t==null&&(t=e.doc.first),n==null&&(n=e.doc.first+e.doc.size),i||(i=0);var r=e.display;if(i&&n<r.viewTo&&(r.updateLineNumbers==null||r.updateLineNumbers>t)&&(r.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=r.viewTo)ui&&cr(e.doc,t)<r.viewTo&&Sn(e);else if(n<=r.viewFrom)ui&&Tn(e.doc,n+i)>r.viewFrom?Sn(e):(r.viewFrom+=i,r.viewTo+=i);else if(t<=r.viewFrom&&n>=r.viewTo)Sn(e);else if(t<=r.viewFrom){var I=Gr(e,n,n+i,1);I?(r.view=r.view.slice(I.index),r.viewFrom=I.lineN,r.viewTo+=i):Sn(e)}else if(n>=r.viewTo){var z=Gr(e,t,t,-1);z?(r.view=r.view.slice(0,z.index),r.viewTo=z.lineN):Sn(e)}else{var $=Gr(e,t,t,-1),J=Gr(e,n,n+i,1);$&&J?(r.view=r.view.slice(0,$.index).concat(Li(e,$.lineN,J.lineN)).concat(r.view.slice(J.index)),r.viewTo+=i):Sn(e)}var ee=r.externalMeasured;ee&&(n<ee.lineN?ee.lineN+=i:t<ee.lineN+ee.size&&(r.externalMeasured=null))}function wn(e,t,n){e.curOp.viewChanged=!0;var i=e.display,r=e.display.externalMeasured;if(r&&t>=r.lineN&&t<r.lineN+r.size&&(i.externalMeasured=null),t<i.viewFrom||t>=i.viewTo)return;var I=i.view[Un(e,t)];if(I.node==null)return;var z=I.changes||(I.changes=[]);ie(z,n)==-1&&z.push(n)}function Sn(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Gr(e,t,n,i){var r=Un(e,t),I,z=e.display.view;if(!ui||n==e.doc.first+e.doc.size)return{index:r,lineN:n};for(var $=e.display.viewFrom,J=0;J<r;J++)$+=z[J].size;if($!=t){if(i>0){if(r==z.length-1)return null;I=$+z[r].size-t,r++}else I=$-t;t+=I,n+=I}for(;cr(e.doc,n)!=n;){if(r==(i<0?0:z.length-1))return null;n+=i*z[r-(i<0?1:0)].size,r+=i}return{index:r,lineN:n}}function Vo(e,t,n){var i=e.display,r=i.view;r.length==0||t>=i.viewTo||n<=i.viewFrom?(i.view=Li(e,t,n),i.viewFrom=t):(i.viewFrom>t?i.view=Li(e,t,i.viewFrom).concat(i.view):i.viewFrom<t&&(i.view=i.view.slice(Un(e,t))),i.viewFrom=t,i.viewTo<n?i.view=i.view.concat(Li(e,i.viewTo,n)):i.viewTo>n&&(i.view=i.view.slice(0,Un(e,n)))),i.viewTo=n}function fs(e){for(var t=e.display.view,n=0,i=0;i<t.length;i++){var r=t[i];!r.hidden&&(!r.node||r.changes)&&++n}return n}function br(e){e.display.input.showSelection(e.display.input.prepareSelection())}function ps(e,t){t===void 0&&(t=!0);for(var n=e.doc,i={},r=i.cursors=document.createDocumentFragment(),I=i.selection=document.createDocumentFragment(),z=0;z<n.sel.ranges.length;z++){if(!t&&z==n.sel.primIndex)continue;var $=n.sel.ranges[z];if($.from().line>=e.display.viewTo||$.to().line<e.display.viewFrom)continue;var J=$.empty();(J||e.options.showCursorWhenSelecting)&&ms(e,$.head,r),J||Xo(e,$,I)}return i}function ms(e,t,n){var i=Zi(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),r=n.appendChild(d("div","\xA0","CodeMirror-cursor"));if(r.style.left=i.left+"px",r.style.top=i.top+"px",r.style.height=Math.max(0,i.bottom-i.top)*e.options.cursorHeight+"px",i.other){var I=n.appendChild(d("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));I.style.display="",I.style.left=i.other.left+"px",I.style.top=i.other.top+"px",I.style.height=(i.other.bottom-i.other.top)*.85+"px"}}function zr(e,t){return e.top-t.top||e.left-t.left}function Xo(e,t,n){var i=e.display,r=e.doc,I=document.createDocumentFragment(),z=qa(e.display),$=z.left,J=Math.max(i.sizerWidth,Pn(e)-i.sizer.offsetLeft)-z.right,ee=r.direction=="ltr";function ce(at,pt,St,Et){pt<0&&(pt=0),pt=Math.round(pt),Et=Math.round(Et),I.appendChild(d("div",null,"CodeMirror-selected","position: absolute; left: "+at+`px;
top: `+pt+"px; width: "+(St==null?J-at:St)+`px;
height: `+(Et-pt)+"px"))}function ge(at,pt,St){var Et=mt(r,at),Dt=Et.text.length,$t,fi;function qt(ri,Mi){return ma(e,Ve(at,ri),"div",Et,Mi)}function Bi(ri,Mi,yi){var oi=ds(e,Et,null,ri),ai=Mi=="ltr"==(yi=="after")?"left":"right",ei=yi=="after"?oi.begin:oi.end-(/\s/.test(Et.text.charAt(oi.end-1))?2:1);return qt(ei,ai)[ai]}var Di=Ye(Et,r.direction);return st(Di,pt||0,St==null?Dt:St,function(ri,Mi,yi,oi){var ai=yi=="ltr",ei=qt(ri,ai?"left":"right"),Pi=qt(Mi-1,ai?"right":"left"),ur=pt==null&&ri==0,In=St==null&&Mi==Dt,wi=oi==0,on=!Di||oi==Di.length-1;if(Pi.top-ei.top<=3){var pi=(ee?ur:In)&&wi,Va=(ee?In:ur)&&on,fn=pi?$:(ai?ei:Pi).left,Gn=Va?J:(ai?Pi:ei).right;ce(fn,ei.top,Gn-fn,ei.bottom)}else{var zn,Oi,hr,Xa;ai?(zn=ee&&ur&&wi?$:ei.left,Oi=ee?J:Bi(ri,yi,"before"),hr=ee?$:Bi(Mi,yi,"after"),Xa=ee&&In&&on?J:Pi.right):(zn=ee?Bi(ri,yi,"before"):$,Oi=!ee&&ur&&wi?J:ei.right,hr=!ee&&In&&on?$:Pi.left,Xa=ee?Bi(Mi,yi,"after"):J),ce(zn,ei.top,Oi-zn,ei.bottom),ei.bottom<Pi.top&&ce($,ei.bottom,null,Pi.top),ce(hr,Pi.top,Xa-hr,Pi.bottom)}(!$t||zr(ei,$t)<0)&&($t=ei),zr(Pi,$t)<0&&($t=Pi),(!fi||zr(ei,fi)<0)&&(fi=ei),zr(Pi,fi)<0&&(fi=Pi)}),{start:$t,end:fi}}var Re=t.from(),Oe=t.to();if(Re.line==Oe.line)ge(Re.line,Re.ch,Oe.ch);else{var Be=mt(r,Re.line),Ke=mt(r,Oe.line),$e=Ci(Be)==Ci(Ke),rt=ge(Re.line,Re.ch,$e?Be.text.length+1:null).end,ht=ge(Oe.line,$e?0:null,Oe.ch).start;$e&&(rt.top<ht.top-2?(ce(rt.right,rt.top,null,rt.bottom),ce($,ht.top,ht.left,ht.bottom)):ce(rt.right,rt.top,ht.left-rt.right,rt.bottom)),rt.bottom<ht.top&&ce($,rt.bottom,null,ht.top)}n.appendChild(I)}function xa(e){if(!e.state.focused)return;var t=e.display;clearInterval(t.blinker);var n=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){e.hasFocus()||Zn(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function gs(e){e.state.focused||(e.display.input.focus(),Ta(e))}function vs(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Zn(e))},100)}function Ta(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(De(e,"focus",e,t),e.state.focused=!0,D(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),P&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),xa(e)}function Zn(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(De(e,"blur",e,t),e.state.focused=!1,x(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function Kr(e){for(var t=e.display,n=t.lineDiv.offsetTop,i=0;i<t.view.length;i++){var r=t.view[i],I=e.options.lineWrapping,z=void 0,$=0;if(r.hidden)continue;if(K&&W<8){var J=r.node.offsetTop+r.node.offsetHeight;z=J-n,n=J}else{var ee=r.node.getBoundingClientRect();z=ee.bottom-ee.top,!I&&r.text.firstChild&&($=r.text.firstChild.getBoundingClientRect().right-ee.left-1)}var ce=r.line.height-z;if((ce>.005||ce<-.005)&&(bi(r.line,z),ys(r.line),r.rest))for(var ge=0;ge<r.rest.length;ge++)ys(r.rest[ge]);if($>e.display.sizerWidth){var Re=Math.ceil($/Qn(e.display));Re>e.display.maxLineLength&&(e.display.maxLineLength=Re,e.display.maxLine=r.line,e.display.maxLineChanged=!0)}}}function ys(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var n=e.widgets[t],i=n.node.parentNode;i&&(n.height=i.offsetHeight)}}function Vr(e,t,n){var i=n&&n.top!=null?Math.max(0,n.top):e.scroller.scrollTop;i=Math.floor(i-jr(e));var r=n&&n.bottom!=null?n.bottom:i+e.wrapper.clientHeight,I=Hi(t,i),z=Hi(t,r);if(n&&n.ensure){var $=n.ensure.from.line,J=n.ensure.to.line;$<I?(I=$,z=Hi(t,Qi(mt(t,$))+e.wrapper.clientHeight)):Math.min(J,t.lastLine())>=z&&(I=Hi(t,Qi(mt(t,J))-e.wrapper.clientHeight),z=J)}return{from:I,to:Math.max(z,I+1)}}function Yo(e,t){if(ze(e,"scrollCursorIntoView"))return;var n=e.display,i=n.sizer.getBoundingClientRect(),r=null;if(t.top+i.top<0?r=!0:t.bottom+i.top>(window.innerHeight||document.documentElement.clientHeight)&&(r=!1),r!=null&&!s){var I=d("div","\u200B",null,`position: absolute;
top: `+(t.top-n.viewOffset-jr(e.display))+`px;
height: `+(t.bottom-t.top+an(e)+n.barHeight)+`px;
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(I),I.scrollIntoView(r),e.display.lineSpace.removeChild(I)}}function $o(e,t,n,i){i==null&&(i=0);var r;!e.options.lineWrapping&&t==n&&(t=t.ch?Ve(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,n=t.sticky=="before"?Ve(t.line,t.ch+1,"before"):t);for(var I=0;I<5;I++){var z=!1,$=Zi(e,t),J=!n||n==t?$:Zi(e,n);r={left:Math.min($.left,J.left),top:Math.min($.top,J.top)-i,right:Math.max($.left,J.left),bottom:Math.max($.bottom,J.bottom)+i};var ee=wa(e,r),ce=e.doc.scrollTop,ge=e.doc.scrollLeft;if(ee.scrollTop!=null&&(Er(e,ee.scrollTop),Math.abs(e.doc.scrollTop-ce)>1&&(z=!0)),ee.scrollLeft!=null&&(Bn(e,ee.scrollLeft),Math.abs(e.doc.scrollLeft-ge)>1&&(z=!0)),!z)break}return r}function Qo(e,t){var n=wa(e,t);n.scrollTop!=null&&Er(e,n.scrollTop),n.scrollLeft!=null&&Bn(e,n.scrollLeft)}function wa(e,t){var n=e.display,i=$n(e.display);t.top<0&&(t.top=0);var r=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop,I=ca(e),z={};t.bottom-t.top>I&&(t.bottom=t.top+I);var $=e.doc.height+da(n),J=t.top<i,ee=t.bottom>$-i;if(t.top<r)z.scrollTop=J?0:t.top;else if(t.bottom>r+I){var ce=Math.min(t.top,(ee?$:t.bottom)-I);ce!=r&&(z.scrollTop=ce)}var ge=e.options.fixedGutter?0:n.gutters.offsetWidth,Re=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-ge,Oe=Pn(e)-n.gutters.offsetWidth,Be=t.right-t.left>Oe;return Be&&(t.right=t.left+Oe),t.left<10?z.scrollLeft=0:t.left<Re?z.scrollLeft=Math.max(0,t.left+ge-(Be?0:10)):t.right>Oe+Re-3&&(z.scrollLeft=t.right+(Be?0:10)-Oe),z}function Sa(e,t){if(t==null)return;Xr(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function Jn(e){Xr(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function _r(e,t,n){(t!=null||n!=null)&&Xr(e),t!=null&&(e.curOp.scrollLeft=t),n!=null&&(e.curOp.scrollTop=n)}function Zo(e,t){Xr(e),e.curOp.scrollToPos=t}function Xr(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=us(e,t.from),i=us(e,t.to);bs(e,n,i,t.margin)}}function bs(e,t,n,i){var r=wa(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-i,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+i});_r(e,r.scrollLeft,r.scrollTop)}function Er(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;M||Aa(e,{top:t}),_s(e,t,!0),M&&Aa(e),wr(e,100)}function _s(e,t,n){if(t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),e.display.scroller.scrollTop==t&&!n)return;e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t)}function Bn(e,t,n,i){if(t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!i)return;e.doc.scrollLeft=t,Ss(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function xr(e){var t=e.display,n=t.gutters.offsetWidth,i=Math.round(e.doc.height+da(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?n:0,docHeight:i,scrollHeight:i+an(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var Hn=function(e,t,n){this.cm=n;var i=this.vert=d("div",[d("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),r=this.horiz=d("div",[d("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");i.tabIndex=r.tabIndex=-1,e(i),e(r),Ie(i,"scroll",function(){i.clientHeight&&t(i.scrollTop,"vertical")}),Ie(r,"scroll",function(){r.clientWidth&&t(r.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,K&&W<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Hn.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,i=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?i+"px":"0";var r=e.viewHeight-(t?i:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+r)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?i+"px":"0",this.horiz.style.left=e.barLeft+"px";var I=e.viewWidth-e.barLeft-(n?i:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+I)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(i==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?i:0,bottom:t?i:0}},Hn.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Hn.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Hn.prototype.zeroWidthHack=function(){var e=o&&!h?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new Y,this.disableVert=new Y},Hn.prototype.enableZeroWidthBar=function(e,t,n){e.style.pointerEvents="auto";function i(){var r=e.getBoundingClientRect(),I=n=="vert"?document.elementFromPoint(r.right-1,(r.top+r.bottom)/2):document.elementFromPoint((r.right+r.left)/2,r.bottom-1);I!=e?e.style.pointerEvents="none":t.set(1e3,i)}t.set(1e3,i)},Hn.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Tr=function(){};Tr.prototype.update=function(){return{bottom:0,right:0}},Tr.prototype.setScrollLeft=function(){},Tr.prototype.setScrollTop=function(){},Tr.prototype.clear=function(){};function qn(e,t){t||(t=xr(e));var n=e.display.barWidth,i=e.display.barHeight;Es(e,t);for(var r=0;r<4&&n!=e.display.barWidth||i!=e.display.barHeight;r++)n!=e.display.barWidth&&e.options.lineWrapping&&Kr(e),Es(e,xr(e)),n=e.display.barWidth,i=e.display.barHeight}function Es(e,t){var n=e.display,i=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=i.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=i.bottom)+"px",n.heightForcer.style.borderBottom=i.bottom+"px solid transparent",i.right&&i.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=i.bottom+"px",n.scrollbarFiller.style.width=i.right+"px"):n.scrollbarFiller.style.display="",i.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=i.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}var xs={native:Hn,null:Tr};function Ts(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&x(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new xs[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Ie(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,n){n=="horizontal"?Bn(e,t):Er(e,t)},e),e.display.scrollbars.addClass&&D(e.display.wrapper,e.display.scrollbars.addClass)}var Jo=0;function jn(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:++Jo},Vi(e.curOp)}function Wn(e){var t=e.curOp;t&&Io(t,function(n){for(var i=0;i<n.ops.length;i++)n.ops[i].cm.curOp=null;qo(n)})}function qo(e){for(var t=e.ops,n=0;n<t.length;n++)el(t[n]);for(var i=0;i<t.length;i++)tl(t[i]);for(var r=0;r<t.length;r++)il(t[r]);for(var I=0;I<t.length;I++)nl(t[I]);for(var z=0;z<t.length;z++)rl(t[z])}function el(e){var t=e.cm,n=t.display;sl(t),e.updateMaxLine&&Hr(t),e.mustUpdate=e.viewChanged||e.forceUpdate||e.scrollTop!=null||e.scrollToPos&&(e.scrollToPos.from.line<n.viewFrom||e.scrollToPos.to.line>=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new Yr(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&Ca(e.cm,e.update)}function il(e){var t=e.cm,n=t.display;e.updatedDisplay&&Kr(t),e.barMeasure=xr(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=ts(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+an(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-Pn(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function nl(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&Bn(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var n=e.focus&&e.focus==F();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,n),(e.updatedDisplay||e.startHeight!=t.doc.height)&&qn(t,e.barMeasure),e.updatedDisplay&&Ra(t,e.barMeasure),e.selectionChanged&&xa(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),n&&gs(e.cm)}function rl(e){var t=e.cm,n=t.display,i=t.doc;if(e.updatedDisplay&&ws(t,e.update),n.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(n.wheelStartX=n.wheelStartY=null),e.scrollTop!=null&&_s(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&Bn(t,e.scrollLeft,!0,!0),e.scrollToPos){var r=$o(t,v(i,e.scrollToPos.from),v(i,e.scrollToPos.to),e.scrollToPos.margin);Yo(t,r)}var I=e.maybeHiddenMarkers,z=e.maybeUnhiddenMarkers;if(I)for(var $=0;$<I.length;++$)I[$].lines.length||De(I[$],"hide");if(z)for(var J=0;J<z.length;++J)z[J].lines.length&&De(z[J],"unhide");n.wrapper.offsetHeight&&(i.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&De(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Ui(e,t){if(e.curOp)return t();jn(e);try{return t()}finally{Wn(e)}}function di(e,t){return function(){if(e.curOp)return t.apply(e,arguments);jn(e);try{return t.apply(e,arguments)}finally{Wn(e)}}}function Ai(e){return function(){if(this.curOp)return e.apply(this,arguments);jn(this);try{return e.apply(this,arguments)}finally{Wn(this)}}}function ci(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);jn(t);try{return e.apply(this,arguments)}finally{Wn(t)}}}function wr(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,k(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var n=+new Date+e.options.workTime,i=qe(e,t.highlightFrontier),r=[];t.iter(i.line,Math.min(t.first+t.size,e.display.viewTo+500),function(I){if(i.line>=e.display.viewFrom){var z=I.styles,$=I.text.length>e.options.maxHighlightLength?Jt(t.mode,i.state):null,J=be(e,I,i,!0);$&&(i.state=$),I.styles=J.styles;var ee=I.styleClasses,ce=J.classes;ce?I.styleClasses=ce:ee&&(I.styleClasses=null);for(var ge=!z||z.length!=I.styles.length||ee!=ce&&(!ee||!ce||ee.bgClass!=ce.bgClass||ee.textClass!=ce.textClass),Re=0;!ge&&Re<z.length;++Re)ge=z[Re]!=I.styles[Re];ge&&r.push(i.line),I.stateAfter=i.save(),i.nextLine()}else I.text.length<=e.options.maxHighlightLength&&gt(e,I.text,i),I.stateAfter=i.line%5==0?i.save():null,i.nextLine();if(+new Date>n)return wr(e,e.options.workDelay),!0}),t.highlightFrontier=i.line,t.modeFrontier=Math.max(t.modeFrontier,i.line),r.length&&Ui(e,function(){for(var I=0;I<r.length;I++)wn(e,r[I],"text")})}var Yr=function(e,t,n){var i=e.display;this.viewport=t,this.visible=Vr(i,e.doc,t),this.editorIsHidden=!i.wrapper.offsetWidth,this.wrapperHeight=i.wrapper.clientHeight,this.wrapperWidth=i.wrapper.clientWidth,this.oldDisplayWidth=Pn(e),this.force=n,this.dims=ba(e),this.events=[]};Yr.prototype.signal=function(e,t){ye(e,t)&&this.events.push(arguments)},Yr.prototype.finish=function(){for(var e=0;e<this.events.length;e++)De.apply(null,this.events[e])};function sl(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=an(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=an(e)+"px",t.scrollbarsClipped=!0)}function ol(e){if(e.hasFocus())return null;var t=F();if(!t||!_(e.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var i=window.getSelection();i.anchorNode&&i.extend&&_(e.display.lineDiv,i.anchorNode)&&(n.anchorNode=i.anchorNode,n.anchorOffset=i.anchorOffset,n.focusNode=i.focusNode,n.focusOffset=i.focusOffset)}return n}function ll(e){if(!e||!e.activeElt||e.activeElt==F())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&_(document.body,e.anchorNode)&&_(document.body,e.focusNode)){var t=window.getSelection(),n=document.createRange();n.setEnd(e.anchorNode,e.anchorOffset),n.collapse(!1),t.removeAllRanges(),t.addRange(n),t.extend(e.focusNode,e.focusOffset)}}function Ca(e,t){var n=e.display,i=e.doc;if(t.editorIsHidden)return Sn(e),!1;if(!t.force&&t.visible.from>=n.viewFrom&&t.visible.to<=n.viewTo&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&fs(e)==0)return!1;Cs(e)&&(Sn(e),t.dims=ba(e));var r=i.first+i.size,I=Math.max(t.visible.from-e.options.viewportMargin,i.first),z=Math.min(r,t.visible.to+e.options.viewportMargin);n.viewFrom<I&&I-n.viewFrom<20&&(I=Math.max(i.first,n.viewFrom)),n.viewTo>z&&n.viewTo-z<20&&(z=Math.min(r,n.viewTo)),ui&&(I=cr(e.doc,I),z=Tn(e.doc,z));var $=I!=n.viewFrom||z!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Vo(e,I,z),n.viewOffset=Qi(mt(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var J=fs(e);if(!$&&J==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;var ee=ol(e);return J>4&&(n.lineDiv.style.display="none"),ul(e,n.updateLineNumbers,t.dims),J>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,ll(ee),S(n.cursorDiv),S(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,$&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,wr(e,400)),n.updateLineNumbers=null,!0}function ws(e,t){for(var n=t.viewport,i=!0;;i=!1){if(!i||!e.options.lineWrapping||t.oldDisplayWidth==Pn(e)){if(n&&n.top!=null&&(n={top:Math.min(e.doc.height+da(e.display)-ca(e),n.top)}),t.visible=Vr(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else i&&(t.visible=Vr(e.display,e.doc,n));if(!Ca(e,t))break;Kr(e);var r=xr(e);br(e),qn(e,r),Ra(e,r),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 Aa(e,t){var n=new Yr(e,t);if(Ca(e,n)){Kr(e),ws(e,n);var i=xr(e);br(e),qn(e,i),Ra(e,i),n.finish()}}function ul(e,t,n){var i=e.display,r=e.options.lineNumbers,I=i.lineDiv,z=I.firstChild;function $(Be){var Ke=Be.nextSibling;return P&&o&&e.display.currentWheelTarget==Be?Be.style.display="none":Be.parentNode.removeChild(Be),Ke}for(var J=i.view,ee=i.viewFrom,ce=0;ce<J.length;ce++){var ge=J[ce];if(!ge.hidden)if(!ge.node||ge.node.parentNode!=I){var Re=No(e,ge,ee,n);I.insertBefore(Re,z)}else{for(;z!=ge.node;)z=$(z);var Oe=r&&t!=null&&t<=ee&&ge.lineNumber;ge.changes&&(ie(ge.changes,"gutter")>-1&&(Oe=!1),Ya(e,ge,ee,n)),Oe&&(S(ge.lineNumber),ge.lineNumber.appendChild(document.createTextNode(pn(e.options,ee)))),z=ge.node.nextSibling}ee+=ge.size}for(;z;)z=$(z)}function Oa(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Ra(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+an(e)+"px"}function Ss(e){var t=e.display,n=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var i=_a(t)-t.scroller.scrollLeft+e.doc.scrollLeft,r=t.gutters.offsetWidth,I=i+"px",z=0;z<n.length;z++)if(!n[z].hidden){e.options.fixedGutter&&(n[z].gutter&&(n[z].gutter.style.left=I),n[z].gutterBackground&&(n[z].gutterBackground.style.left=I));var $=n[z].alignable;if($)for(var J=0;J<$.length;J++)$[J].style.left=I}e.options.fixedGutter&&(t.gutters.style.left=i+r+"px")}function Cs(e){if(!e.options.lineNumbers)return!1;var t=e.doc,n=pn(e.options,t.first+t.size-1),i=e.display;if(n.length!=i.lineNumChars){var r=i.measure.appendChild(d("div",[d("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),I=r.firstChild.offsetWidth,z=r.offsetWidth-I;return i.lineGutter.style.width="",i.lineNumInnerWidth=Math.max(I,i.lineGutter.offsetWidth-z)+1,i.lineNumWidth=i.lineNumInnerWidth+z,i.lineNumChars=i.lineNumInnerWidth?n.length:-1,i.lineGutter.style.width=i.lineNumWidth+"px",Oa(e.display),!0}return!1}function La(e,t){for(var n=[],i=!1,r=0;r<e.length;r++){var I=e[r],z=null;if(typeof I!="string"&&(z=I.style,I=I.className),I=="CodeMirror-linenumbers")if(t)i=!0;else continue;n.push({className:I,style:z})}return t&&!i&&n.push({className:"CodeMirror-linenumbers",style:null}),n}function As(e){var t=e.gutters,n=e.gutterSpecs;S(t),e.lineGutter=null;for(var i=0;i<n.length;++i){var r=n[i],I=r.className,z=r.style,$=t.appendChild(d("div",null,"CodeMirror-gutter "+I));z&&($.style.cssText=z),I=="CodeMirror-linenumbers"&&(e.lineGutter=$,$.style.width=(e.lineNumWidth||1)+"px")}t.style.display=n.length?"":"none",Oa(e)}function Sr(e){As(e.display),Ii(e),Ss(e)}function hl(e,t,n,i){var r=this;this.input=n,r.scrollbarFiller=d("div",null,"CodeMirror-scrollbar-filler"),r.scrollbarFiller.setAttribute("cm-not-content","true"),r.gutterFiller=d("div",null,"CodeMirror-gutter-filler"),r.gutterFiller.setAttribute("cm-not-content","true"),r.lineDiv=b("div",null,"CodeMirror-code"),r.selectionDiv=d("div",null,null,"position: relative; z-index: 1"),r.cursorDiv=d("div",null,"CodeMirror-cursors"),r.measure=d("div",null,"CodeMirror-measure"),r.lineMeasure=d("div",null,"CodeMirror-measure"),r.lineSpace=b("div",[r.measure,r.lineMeasure,r.selectionDiv,r.cursorDiv,r.lineDiv],null,"position: relative; outline: none");var I=b("div",[r.lineSpace],"CodeMirror-lines");r.mover=d("div",[I],null,"position: relative"),r.sizer=d("div",[r.mover],"CodeMirror-sizer"),r.sizerWidth=null,r.heightForcer=d("div",null,null,"position: absolute; height: "+se+"px; width: 1px;"),r.gutters=d("div",null,"CodeMirror-gutters"),r.lineGutter=null,r.scroller=d("div",[r.sizer,r.heightForcer,r.gutters],"CodeMirror-scroll"),r.scroller.setAttribute("tabIndex","-1"),r.wrapper=d("div",[r.scrollbarFiller,r.gutterFiller,r.scroller],"CodeMirror"),K&&W<8&&(r.gutters.style.zIndex=-1,r.scroller.style.paddingRight=0),!P&&!(M&&a)&&(r.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(r.wrapper):e(r.wrapper)),r.viewFrom=r.viewTo=t.first,r.reportedViewFrom=r.reportedViewTo=t.first,r.view=[],r.renderedView=null,r.externalMeasured=null,r.viewOffset=0,r.lastWrapHeight=r.lastWrapWidth=0,r.updateLineNumbers=null,r.nativeBarWidth=r.barHeight=r.barWidth=0,r.scrollbarsClipped=!1,r.lineNumWidth=r.lineNumInnerWidth=r.lineNumChars=null,r.alignWidgets=!1,r.cachedCharWidth=r.cachedTextHeight=r.cachedPaddingH=null,r.maxLine=null,r.maxLineLength=0,r.maxLineChanged=!1,r.wheelDX=r.wheelDY=r.wheelStartX=r.wheelStartY=null,r.shift=!1,r.selForContextMenu=null,r.activeTouch=null,r.gutterSpecs=La(i.gutters,i.lineNumbers),As(r),n.init(r)}var $r=0,Wi=null;K?Wi=-.53:M?Wi=15:m?Wi=-.7:f&&(Wi=-1/3);function Os(e){var t=e.wheelDeltaX,n=e.wheelDeltaY;return t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),n==null&&e.detail&&e.axis==e.VERTICAL_AXIS?n=e.detail:n==null&&(n=e.wheelDelta),{x:t,y:n}}function dl(e){var t=Os(e);return t.x*=Wi,t.y*=Wi,t}function Rs(e,t){var n=Os(t),i=n.x,r=n.y,I=e.display,z=I.scroller,$=z.scrollWidth>z.clientWidth,J=z.scrollHeight>z.clientHeight;if(!(i&&$||r&&J))return;if(r&&o&&P){e:for(var ee=t.target,ce=I.view;ee!=z;ee=ee.parentNode)for(var ge=0;ge<ce.length;ge++)if(ce[ge].node==ee){e.display.currentWheelTarget=ee;break e}}if(i&&!M&&!p&&Wi!=null){r&&J&&Er(e,Math.max(0,z.scrollTop+r*Wi)),Bn(e,Math.max(0,z.scrollLeft+i*Wi)),(!r||r&&J)&&ne(t),I.wheelStartX=null;return}if(r&&Wi!=null){var Re=r*Wi,Oe=e.doc.scrollTop,Be=Oe+I.wrapper.clientHeight;Re<0?Oe=Math.max(0,Oe+Re-50):Be=Math.min(e.doc.height,Be+Re+50),Aa(e,{top:Oe,bottom:Be})}$r<20&&(I.wheelStartX==null?(I.wheelStartX=z.scrollLeft,I.wheelStartY=z.scrollTop,I.wheelDX=i,I.wheelDY=r,setTimeout(function(){if(I.wheelStartX==null)return;var Ke=z.scrollLeft-I.wheelStartX,$e=z.scrollTop-I.wheelStartY,rt=$e&&I.wheelDY&&$e/I.wheelDY||Ke&&I.wheelDX&&Ke/I.wheelDX;if(I.wheelStartX=I.wheelStartY=null,!rt)return;Wi=(Wi*$r+rt)/($r+1),++$r},200)):(I.wheelDX+=i,I.wheelDY+=r))}var Gi=function(e,t){this.ranges=e,this.primIndex=t};Gi.prototype.primary=function(){return this.ranges[this.primIndex]},Gi.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 n=this.ranges[t],i=e.ranges[t];if(!mn(n.anchor,i.anchor)||!mn(n.head,i.head))return!1}return!0},Gi.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new Kt(gn(this.ranges[t].anchor),gn(this.ranges[t].head));return new Gi(e,this.primIndex)},Gi.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},Gi.prototype.contains=function(e,t){t||(t=e);for(var n=0;n<this.ranges.length;n++){var i=this.ranges[n];if(Ct(t,i.from())>=0&&Ct(e,i.to())<=0)return n}return-1};var Kt=function(e,t){this.anchor=e,this.head=t};Kt.prototype.from=function(){return yn(this.anchor,this.head)},Kt.prototype.to=function(){return vn(this.anchor,this.head)},Kt.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Ji(e,t,n){var i=e&&e.options.selectionsMayTouch,r=t[n];t.sort(function(Re,Oe){return Ct(Re.from(),Oe.from())}),n=ie(t,r);for(var I=1;I<t.length;I++){var z=t[I],$=t[I-1],J=Ct($.to(),z.from());if(i&&!z.empty()?J>0:J>=0){var ee=yn($.from(),z.from()),ce=vn($.to(),z.to()),ge=$.empty()?z.from()==z.head:$.from()==$.head;I<=n&&--n,t.splice(--I,2,new Kt(ge?ce:ee,ge?ee:ce))}}return new Gi(t,n)}function Cn(e,t){return new Gi([new Kt(e,t||e)],0)}function An(e){return e.text?Ve(e.from.line+e.text.length-1,te(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Ls(e,t){if(Ct(e,t.from)<0)return e;if(Ct(e,t.to)<=0)return An(t);var n=e.line+t.text.length-(t.to.line-t.from.line)-1,i=e.ch;return e.line==t.to.line&&(i+=An(t).ch-t.to.ch),Ve(n,i)}function Ia(e,t){for(var n=[],i=0;i<e.sel.ranges.length;i++){var r=e.sel.ranges[i];n.push(new Kt(Ls(r.anchor,t),Ls(r.head,t)))}return Ji(e.cm,n,e.sel.primIndex)}function Is(e,t,n){return e.line==t.line?Ve(n.line,e.ch-t.ch+n.ch):Ve(n.line+(e.line-t.line),e.ch)}function cl(e,t,n){for(var i=[],r=Ve(e.first,0),I=r,z=0;z<t.length;z++){var $=t[z],J=Is($.from,r,I),ee=Is(An($),r,I);if(r=$.to,I=ee,n=="around"){var ce=e.sel.ranges[z],ge=Ct(ce.head,ce.anchor)<0;i[z]=new Kt(ge?ee:J,ge?J:ee)}else i[z]=new Kt(J,J)}return new Gi(i,e.sel.primIndex)}function ka(e){e.doc.mode=yt(e.options,e.doc.modeOption),Cr(e)}function Cr(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,wr(e,100),e.state.modeGen++,e.curOp&&Ii(e)}function ks(e,t){return t.from.ch==0&&t.to.ch==0&&te(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Da(e,t,n,i){function r(ht){return n?n[ht]:null}function I(ht,at,pt){ua(ht,at,pt,i),vi(ht,"change",ht,t)}function z(ht,at){for(var pt=[],St=ht;St<at;++St)pt.push(new Mn(ee[St],r(St),i));return pt}var $=t.from,J=t.to,ee=t.text,ce=mt(e,$.line),ge=mt(e,J.line),Re=te(ee),Oe=r(ee.length-1),Be=J.line-$.line;if(t.full)e.insert(0,z(0,ee.length)),e.remove(ee.length,e.size-ee.length);else if(ks(e,t)){var Ke=z(0,ee.length-1);I(ge,ge.text,Oe),Be&&e.remove($.line,Be),Ke.length&&e.insert($.line,Ke)}else if(ce==ge)if(ee.length==1)I(ce,ce.text.slice(0,$.ch)+Re+ce.text.slice(J.ch),Oe);else{var $e=z(1,ee.length-1);$e.push(new Mn(Re+ce.text.slice(J.ch),Oe,i)),I(ce,ce.text.slice(0,$.ch)+ee[0],r(0)),e.insert($.line+1,$e)}else if(ee.length==1)I(ce,ce.text.slice(0,$.ch)+ee[0]+ge.text.slice(J.ch),r(0)),e.remove($.line+1,Be);else{I(ce,ce.text.slice(0,$.ch)+ee[0],r(0)),I(ge,Re+ge.text.slice(J.ch),Oe);var rt=z(1,ee.length-1);Be>1&&e.remove($.line+1,Be-1),e.insert($.line+1,rt)}vi(e,"change",e,t)}function On(e,t,n){function i(r,I,z){if(r.linked)for(var $=0;$<r.linked.length;++$){var J=r.linked[$];if(J.doc==I)continue;var ee=z&&J.sharedHist;if(n&&!ee)continue;t(J.doc,ee),i(J.doc,r,ee)}}i(e,null,!0)}function Ds(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,Ea(e),ka(e),Ms(e),e.options.lineWrapping||Hr(e),e.options.mode=t.modeOption,Ii(e)}function Ms(e){(e.doc.direction=="rtl"?D:x)(e.display.lineDiv,"CodeMirror-rtl")}function fl(e){Ui(e,function(){Ms(e),Ii(e)})}function Qr(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 Ma(e,t){var n={from:gn(t.from),to:An(t),text:zi(e,t.from,t.to)};return Fs(e,n,t.from.line,t.to.line+1),On(e,function(i){return Fs(i,n,t.from.line,t.to.line+1)},!0),n}function Ps(e){for(;e.length;){var t=te(e);if(t.ranges)e.pop();else break}}function pl(e,t){if(t)return Ps(e.done),te(e.done);if(e.done.length&&!te(e.done).ranges)return te(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),te(e.done)}function Ns(e,t,n,i){var r=e.history;r.undone.length=0;var I=+new Date,z,$;if((r.lastOp==i||r.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&r.lastModTime>I-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(z=pl(r,r.lastOp==i)))$=te(z.changes),Ct(t.from,t.to)==0&&Ct(t.from,$.to)==0?$.to=An(t):z.changes.push(Ma(e,t));else{var J=te(r.done);for((!J||!J.ranges)&&Zr(e.sel,r.done),z={changes:[Ma(e,t)],generation:r.generation},r.done.push(z);r.done.length>r.undoDepth;)r.done.shift(),r.done[0].ranges||r.done.shift()}r.done.push(n),r.generation=++r.maxGeneration,r.lastModTime=r.lastSelTime=I,r.lastOp=r.lastSelOp=i,r.lastOrigin=r.lastSelOrigin=t.origin,$||De(e,"historyAdded")}function ml(e,t,n,i){var r=t.charAt(0);return r=="*"||r=="+"&&n.ranges.length==i.ranges.length&&n.somethingSelected()==i.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function gl(e,t,n,i){var r=e.history,I=i&&i.origin;n==r.lastSelOp||I&&r.lastSelOrigin==I&&(r.lastModTime==r.lastSelTime&&r.lastOrigin==I||ml(e,I,te(r.done),t))?r.done[r.done.length-1]=t:Zr(t,r.done),r.lastSelTime=+new Date,r.lastSelOrigin=I,r.lastSelOp=n,i&&i.clearRedo!==!1&&Ps(r.undone)}function Zr(e,t){var n=te(t);n&&n.ranges&&n.equals(e)||t.push(e)}function Fs(e,t,n,i){var r=t["spans_"+e.id],I=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,i),function(z){z.markedSpans&&((r||(r=t["spans_"+e.id]={}))[I]=z.markedSpans),++I})}function vl(e){if(!e)return null;for(var t,n=0;n<e.length;++n)e[n].marker.explicitlyCleared?t||(t=e.slice(0,n)):t&&t.push(e[n]);return t?t.length?t:null:e}function yl(e,t){var n=t["spans_"+e.id];if(!n)return null;for(var i=[],r=0;r<t.text.length;++r)i.push(vl(n[r]));return i}function Us(e,t){var n=yl(e,t),i=$i(e,t);if(!n)return i;if(!i)return n;for(var r=0;r<n.length;++r){var I=n[r],z=i[r];if(I&&z){e:for(var $=0;$<z.length;++$){for(var J=z[$],ee=0;ee<I.length;++ee)if(I[ee].marker==J.marker)continue e;I.push(J)}}else z&&(n[r]=z)}return n}function er(e,t,n){for(var i=[],r=0;r<e.length;++r){var I=e[r];if(I.ranges){i.push(n?Gi.prototype.deepCopy.call(I):I);continue}var z=I.changes,$=[];i.push({changes:$});for(var J=0;J<z.length;++J){var ee=z[J],ce=void 0;if($.push({from:ee.from,to:ee.to,text:ee.text}),t)for(var ge in ee)(ce=ge.match(/^spans_(\d+)$/))&&(ie(t,Number(ce[1]))>-1&&(te($)[ge]=ee[ge],delete ee[ge]))}}return i}function Pa(e,t,n,i){if(i){var r=e.anchor;if(n){var I=Ct(t,r)<0;I!=Ct(n,r)<0?(r=t,t=n):I!=Ct(t,n)<0&&(t=n)}return new Kt(r,t)}else return new Kt(n||t,t)}function Jr(e,t,n,i,r){r==null&&(r=e.cm&&(e.cm.display.shift||e.extend)),Ti(e,new Gi([Pa(e.sel.primary(),t,n,r)],0),i)}function Bs(e,t,n){for(var i=[],r=e.cm&&(e.cm.display.shift||e.extend),I=0;I<e.sel.ranges.length;I++)i[I]=Pa(e.sel.ranges[I],t[I],null,r);var z=Ji(e.cm,i,e.sel.primIndex);Ti(e,z,n)}function Na(e,t,n,i){var r=e.sel.ranges.slice(0);r[t]=n,Ti(e,Ji(e.cm,r,e.sel.primIndex),i)}function Hs(e,t,n,i){Ti(e,Cn(t,n),i)}function bl(e,t,n){var i={ranges:t.ranges,update:function(r){this.ranges=[];for(var I=0;I<r.length;I++)this.ranges[I]=new Kt(v(e,r[I].anchor),v(e,r[I].head))},origin:n&&n.origin};return De(e,"beforeSelectionChange",e,i),e.cm&&De(e.cm,"beforeSelectionChange",e.cm,i),i.ranges!=t.ranges?Ji(e.cm,i.ranges,i.ranges.length-1):t}function js(e,t,n){var i=e.history.done,r=te(i);r&&r.ranges?(i[i.length-1]=t,qr(e,t,n)):Ti(e,t,n)}function Ti(e,t,n){qr(e,t,n),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function qr(e,t,n){(ye(e,"beforeSelectionChange")||e.cm&&ye(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,n));var i=n&&n.bias||(Ct(t.primary().head,e.sel.primary().head)<0?-1:1);Ws(e,zs(e,t,i,!0)),!(n&&n.scroll===!1)&&e.cm&&Jn(e.cm)}function Ws(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,xe(e.cm)),vi(e,"cursorActivity",e)}function Gs(e){Ws(e,zs(e,e.sel,null,!1))}function zs(e,t,n,i){for(var r,I=0;I<t.ranges.length;I++){var z=t.ranges[I],$=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[I],J=ea(e,z.anchor,$&&$.anchor,n,i),ee=ea(e,z.head,$&&$.head,n,i);(r||J!=z.anchor||ee!=z.head)&&(r||(r=t.ranges.slice(0,I)),r[I]=new Kt(J,ee))}return r?Ji(e.cm,r,t.primIndex):t}function tr(e,t,n,i,r){var I=mt(e,t.line);if(I.markedSpans)for(var z=0;z<I.markedSpans.length;++z){var $=I.markedSpans[z],J=$.marker,ee="selectLeft"in J?!J.selectLeft:J.inclusiveLeft,ce="selectRight"in J?!J.selectRight:J.inclusiveRight;if(($.from==null||(ee?$.from<=t.ch:$.from<t.ch))&&($.to==null||(ce?$.to>=t.ch:$.to>t.ch))){if(r&&(De(J,"beforeCursorEnter"),J.explicitlyCleared))if(I.markedSpans){--z;continue}else break;if(!J.atomic)continue;if(n){var ge=J.find(i<0?1:-1),Re=void 0;if((i<0?ce:ee)&&(ge=Ks(e,ge,-i,ge&&ge.line==t.line?I:null)),ge&&ge.line==t.line&&(Re=Ct(ge,n))&&(i<0?Re<0:Re>0))return tr(e,ge,t,i,r)}var Oe=J.find(i<0?-1:1);return(i<0?ee:ce)&&(Oe=Ks(e,Oe,i,Oe.line==t.line?I:null)),Oe?tr(e,Oe,t,i,r):null}}return t}function ea(e,t,n,i,r){var I=i||1,z=tr(e,t,n,I,r)||!r&&tr(e,t,n,I,!0)||tr(e,t,n,-I,r)||!r&&tr(e,t,n,-I,!0);return z||(e.cantEdit=!0,Ve(e.first,0))}function Ks(e,t,n,i){return n<0&&t.ch==0?t.line>e.first?v(e,Ve(t.line-1)):null:n>0&&t.ch==(i||mt(e,t.line)).text.length?t.line<e.first+e.size-1?Ve(t.line+1,0):null:new Ve(t.line,t.ch+n)}function Vs(e){e.setSelection(Ve(e.firstLine(),0),Ve(e.lastLine()),ve)}function Xs(e,t,n){var i={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return i.canceled=!0}};return n&&(i.update=function(r,I,z,$){r&&(i.from=v(e,r)),I&&(i.to=v(e,I)),z&&(i.text=z),$!==void 0&&(i.origin=$)}),De(e,"beforeChange",e,i),e.cm&&De(e.cm,"beforeChange",e.cm,i),i.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:i.from,to:i.to,text:i.text,origin:i.origin}}function ir(e,t,n){if(e.cm){if(!e.cm.curOp)return di(e.cm,ir)(e,t,n);if(e.cm.state.suppressEdits)return}if((ye(e,"beforeChange")||e.cm&&ye(e.cm,"beforeChange"))&&(t=Xs(e,t,!0),!t))return;var i=kn&&!n&&_n(e,t.from,t.to);if(i)for(var r=i.length-1;r>=0;--r)Ys(e,{from:i[r].from,to:i[r].to,text:r?[""]:t.text,origin:t.origin});else Ys(e,t)}function Ys(e,t){if(t.text.length==1&&t.text[0]==""&&Ct(t.from,t.to)==0)return;var n=Ia(e,t);Ns(e,t,n,e.cm?e.cm.curOp.id:NaN),Ar(e,t,n,$i(e,t));var i=[];On(e,function(r,I){!I&&ie(i,r.history)==-1&&(Js(r.history,t),i.push(r.history)),Ar(r,t,null,$i(r,t))})}function ta(e,t,n){var i=e.cm&&e.cm.state.suppressEdits;if(i&&!n)return;for(var r=e.history,I,z=e.sel,$=t=="undo"?r.done:r.undone,J=t=="undo"?r.undone:r.done,ee=0;ee<$.length&&!(I=$[ee],n?I.ranges&&!I.equals(e.sel):!I.ranges);ee++);if(ee==$.length)return;for(r.lastOrigin=r.lastSelOrigin=null;;)if(I=$.pop(),I.ranges){if(Zr(I,J),n&&!I.equals(e.sel)){Ti(e,I,{clearRedo:!1});return}z=I}else if(i){$.push(I);return}else break;var ce=[];Zr(z,J),J.push({changes:ce,generation:r.generation}),r.generation=I.generation||++r.maxGeneration;for(var ge=ye(e,"beforeChange")||e.cm&&ye(e.cm,"beforeChange"),Re=function(Ke){var $e=I.changes[Ke];if($e.origin=t,ge&&!Xs(e,$e,!1))return $.length=0,{};ce.push(Ma(e,$e));var rt=Ke?Ia(e,$e):te($);Ar(e,$e,rt,Us(e,$e)),!Ke&&e.cm&&e.cm.scrollIntoView({from:$e.from,to:An($e)});var ht=[];On(e,function(at,pt){!pt&&ie(ht,at.history)==-1&&(Js(at.history,$e),ht.push(at.history)),Ar(at,$e,null,Us(at,$e))})},Oe=I.changes.length-1;Oe>=0;--Oe){var Be=Re(Oe);if(Be)return Be.v}}function $s(e,t){if(t==0)return;if(e.first+=t,e.sel=new Gi(he(e.sel.ranges,function(r){return new Kt(Ve(r.anchor.line+t,r.anchor.ch),Ve(r.head.line+t,r.head.ch))}),e.sel.primIndex),e.cm){Ii(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,i=n.viewFrom;i<n.viewTo;i++)wn(e.cm,i,"gutter")}}function Ar(e,t,n,i){if(e.cm&&!e.cm.curOp)return di(e.cm,Ar)(e,t,n,i);if(t.to.line<e.first){$s(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 r=t.text.length-1-(e.first-t.from.line);$s(e,r),t={from:Ve(e.first,0),to:Ve(t.to.line+r,t.to.ch),text:[te(t.text)],origin:t.origin}}var I=e.lastLine();t.to.line>I&&(t={from:t.from,to:Ve(I,mt(e,I).text.length),text:[t.text[0]],origin:t.origin}),t.removed=zi(e,t.from,t.to),n||(n=Ia(e,t)),e.cm?_l(e.cm,t,i):Da(e,t,i),qr(e,n,ve),e.cantEdit&&ea(e,Ve(e.firstLine(),0))&&(e.cantEdit=!1)}function _l(e,t,n){var i=e.doc,r=e.display,I=t.from,z=t.to,$=!1,J=I.line;e.options.lineWrapping||(J=Pt(Ci(mt(i,I.line))),i.iter(J,z.line+1,function(Oe){if(Oe==r.maxLine)return $=!0,!0})),i.sel.contains(t.from,t.to)>-1&&xe(e),Da(i,t,n,cs(e)),e.options.lineWrapping||(i.iter(J,I.line+t.text.length,function(Oe){var Be=pr(Oe);Be>r.maxLineLength&&(r.maxLine=Oe,r.maxLineLength=Be,r.maxLineChanged=!0,$=!1)}),$&&(e.curOp.updateMaxLine=!0)),Yi(i,I.line),wr(e,400);var ee=t.text.length-(z.line-I.line)-1;t.full?Ii(e):I.line==z.line&&t.text.length==1&&!ks(e.doc,t)?wn(e,I.line,"text"):Ii(e,I.line,z.line+1,ee);var ce=ye(e,"changes"),ge=ye(e,"change");if(ge||ce){var Re={from:I,to:z,text:t.text,removed:t.removed,origin:t.origin};ge&&vi(e,"change",e,Re),ce&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(Re)}e.display.selForContextMenu=null}function nr(e,t,n,i,r){var I;i||(i=n),Ct(i,n)<0&&(I=[i,n],n=I[0],i=I[1]),typeof t=="string"&&(t=e.splitLines(t)),ir(e,{from:n,to:i,text:t,origin:r})}function Qs(e,t,n,i){n<e.line?e.line+=i:t<e.line&&(e.line=t,e.ch=0)}function Zs(e,t,n,i){for(var r=0;r<e.length;++r){var I=e[r],z=!0;if(I.ranges){I.copied||(I=e[r]=I.deepCopy(),I.copied=!0);for(var $=0;$<I.ranges.length;$++)Qs(I.ranges[$].anchor,t,n,i),Qs(I.ranges[$].head,t,n,i);continue}for(var J=0;J<I.changes.length;++J){var ee=I.changes[J];if(n<ee.from.line)ee.from=Ve(ee.from.line+i,ee.from.ch),ee.to=Ve(ee.to.line+i,ee.to.ch);else if(t<=ee.to.line){z=!1;break}}z||(e.splice(0,r+1),r=0)}}function Js(e,t){var n=t.from.line,i=t.to.line,r=t.text.length-(i-n)-1;Zs(e.done,n,i,r),Zs(e.undone,n,i,r)}function Or(e,t,n,i){var r=t,I=t;return typeof t=="number"?I=mt(e,X(e,t)):r=Pt(t),r==null?null:(i(I,r)&&e.cm&&wn(e.cm,r,n),I)}function Rr(e){this.lines=e,this.parent=null;for(var t=0,n=0;n<e.length;++n)e[n].parent=this,t+=e[n].height;this.height=t}Rr.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var n=e,i=e+t;n<i;++n){var r=this.lines[n];this.height-=r.height,bt(r),vi(r,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,n){this.height+=n,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var i=0;i<t.length;++i)t[i].parent=this},iterN:function(e,t,n){for(var i=e+t;e<i;++e)if(n(this.lines[e]))return!0}};function Lr(e){this.children=e;for(var t=0,n=0,i=0;i<e.length;++i){var r=e[i];t+=r.chunkSize(),n+=r.height,r.parent=this}this.size=t,this.height=n,this.parent=null}Lr.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var n=0;n<this.children.length;++n){var i=this.children[n],r=i.chunkSize();if(e<r){var I=Math.min(t,r-e),z=i.height;if(i.removeInner(e,I),this.height-=z-i.height,r==I&&(this.children.splice(n--,1),i.parent=null),(t-=I)==0)break;e=0}else e-=r}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof Rr))){var $=[];this.collapse($),this.children=[new Rr($)],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,n){this.size+=t.length,this.height+=n;for(var i=0;i<this.children.length;++i){var r=this.children[i],I=r.chunkSize();if(e<=I){if(r.insertInner(e,t,n),r.lines&&r.lines.length>50){for(var z=r.lines.length%25+25,$=z;$<r.lines.length;){var J=new Rr(r.lines.slice($,$+=25));r.height-=J.height,this.children.splice(++i,0,J),J.parent=this}r.lines=r.lines.slice(0,z),this.maybeSpill()}break}e-=I}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),n=new Lr(t);if(e.parent){e.size-=n.size,e.height-=n.height;var r=ie(e.parent.children,e);e.parent.children.splice(r+1,0,n)}else{var i=new Lr(e.children);i.parent=e,e.children=[i,n],e=i}n.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iterN:function(e,t,n){for(var i=0;i<this.children.length;++i){var r=this.children[i],I=r.chunkSize();if(e<I){var z=Math.min(t,I-e);if(r.iterN(e,z,n))return!0;if((t-=z)==0)break;e=0}else e-=I}}};var Ir=function(e,t,n){if(n)for(var i in n)n.hasOwnProperty(i)&&(this[i]=n[i]);this.doc=e,this.node=t};Ir.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,n=this.line,i=Pt(n);if(i==null||!t)return;for(var r=0;r<t.length;++r)t[r]==this&&t.splice(r--,1);t.length||(n.widgets=null);var I=vr(this);bi(n,Math.max(0,n.height-I)),e&&(Ui(e,function(){qs(e,n,-I),wn(e,i,"widget")}),vi(e,"lineWidgetCleared",e,this,i))},Ir.prototype.changed=function(){var e=this,t=this.height,n=this.doc.cm,i=this.line;this.height=null;var r=vr(this)-t;if(!r)return;rn(this.doc,i)||bi(i,i.height+r),n&&Ui(n,function(){n.curOp.forceUpdate=!0,qs(n,i,r),vi(n,"lineWidgetChanged",n,e,Pt(i))})},_e(Ir);function qs(e,t,n){Qi(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Sa(e,n)}function El(e,t,n,i){var r=new Ir(e,n,i),I=e.cm;return I&&r.noHScroll&&(I.display.alignWidgets=!0),Or(e,t,"widget",function(z){var $=z.widgets||(z.widgets=[]);if(r.insertAt==null?$.push(r):$.splice(Math.min($.length-1,Math.max(0,r.insertAt)),0,r),r.line=z,I&&!rn(e,z)){var J=Qi(z)<e.scrollTop;bi(z,z.height+vr(r)),J&&Sa(I,r.height),I.curOp.forceUpdate=!0}return!0}),I&&vi(I,"lineWidgetAdded",I,r,typeof t=="number"?t:Pt(t)),r}var eo=0,Rn=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++eo};Rn.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&jn(e),ye(this,"clear")){var n=this.find();n&&vi(this,"clear",n.from,n.to)}for(var i=null,r=null,I=0;I<this.lines.length;++I){var z=this.lines[I],$=Fi(z.markedSpans,this);e&&!this.collapsed?wn(e,Pt(z),"text"):e&&($.to!=null&&(r=Pt(z)),$.from!=null&&(i=Pt(z))),z.markedSpans=Dn(z.markedSpans,$),$.from==null&&this.collapsed&&!rn(this.doc,z)&&e&&bi(z,$n(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var J=0;J<this.lines.length;++J){var ee=Ci(this.lines[J]),ce=pr(ee);ce>e.display.maxLineLength&&(e.display.maxLine=ee,e.display.maxLineLength=ce,e.display.maxLineChanged=!0)}i!=null&&e&&this.collapsed&&Ii(e,i,r+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Gs(e.doc)),e&&vi(e,"markerCleared",e,this,i,r),t&&Wn(e),this.parent&&this.parent.clear()},Rn.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var n,i,r=0;r<this.lines.length;++r){var I=this.lines[r],z=Fi(I.markedSpans,this);if(z.from!=null&&(n=Ve(t?I:Pt(I),z.from),e==-1))return n;if(z.to!=null&&(i=Ve(t?I:Pt(I),z.to),e==1))return i}return n&&{from:n,to:i}},Rn.prototype.changed=function(){var e=this,t=this.find(-1,!0),n=this,i=this.doc.cm;if(!t||!i)return;Ui(i,function(){var r=t.line,I=Pt(t.line),z=fa(i,I);if(z&&(rs(z),i.curOp.selectionChanged=i.curOp.forceUpdate=!0),i.curOp.updateMaxLine=!0,!rn(n.doc,r)&&n.height!=null){var $=n.height;n.height=null;var J=vr(n)-$;J&&bi(r,r.height+J)}vi(i,"markerChanged",i,e)})},Rn.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||ie(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Rn.prototype.detachLine=function(e){if(this.lines.splice(ie(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},_e(Rn);function rr(e,t,n,i,r){if(i&&i.shared)return xl(e,t,n,i,r);if(e.cm&&!e.cm.curOp)return di(e.cm,rr)(e,t,n,i,r);var I=new Rn(e,r),z=Ct(t,n);if(i&&y(i,I,!1),z>0||z==0&&I.clearWhenEmpty!==!1)return I;if(I.replacedWith&&(I.collapsed=!0,I.widgetNode=b("span",[I.replacedWith],"CodeMirror-widget"),i.handleMouseEvents||I.widgetNode.setAttribute("cm-ignore-events","true"),i.insertLeft&&(I.widgetNode.insertLeft=!0)),I.collapsed){if(hi(e,t.line,t,n,I)||t.line!=n.line&&hi(e,n.line,t,n,I))throw new Error("Inserting collapsed marker partially overlapping an existing one");ln()}I.addToHistory&&Ns(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var $=t.line,J=e.cm,ee;if(e.iter($,n.line+1,function(ge){J&&I.collapsed&&!J.options.lineWrapping&&Ci(ge)==J.display.maxLine&&(ee=!0),I.collapsed&&$!=t.line&&bi(ge,0),bn(ge,new un(I,$==t.line?t.ch:null,$==n.line?n.ch:null)),++$}),I.collapsed&&e.iter(t.line,n.line+1,function(ge){rn(e,ge)&&bi(ge,0)}),I.clearOnEnter&&Ie(I,"beforeCursorEnter",function(){return I.clear()}),I.readOnly&&(ji(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),I.collapsed&&(I.id=++eo,I.atomic=!0),J){if(ee&&(J.curOp.updateMaxLine=!0),I.collapsed)Ii(J,t.line,n.line+1);else if(I.className||I.startStyle||I.endStyle||I.css||I.attributes||I.title)for(var ce=t.line;ce<=n.line;ce++)wn(J,ce,"text");I.atomic&&Gs(J.doc),vi(J,"markerAdded",J,I)}return I}var kr=function(e,t){this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=this};kr.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();vi(this,"clear")},kr.prototype.find=function(e,t){return this.primary.find(e,t)},_e(kr);function xl(e,t,n,i,r){i=y(i),i.shared=!1;var I=[rr(e,t,n,i,r)],z=I[0],$=i.widgetNode;return On(e,function(J){$&&(i.widgetNode=$.cloneNode(!0)),I.push(rr(J,v(J,t),v(J,n),i,r));for(var ee=0;ee<J.linked.length;++ee)if(J.linked[ee].isParent)return;z=te(I)}),new kr(I,z)}function to(e){return e.findMarks(Ve(e.first,0),e.clipPos(Ve(e.lastLine())),function(t){return t.parent})}function Tl(e,t){for(var n=0;n<t.length;n++){var i=t[n],r=i.find(),I=e.clipPos(r.from),z=e.clipPos(r.to);if(Ct(I,z)){var $=rr(e,I,z,i.primary,i.primary.type);i.markers.push($),$.parent=i}}}function wl(e){for(var t=function(i){var r=e[i],I=[r.primary.doc];On(r.primary.doc,function(J){return I.push(J)});for(var z=0;z<r.markers.length;z++){var $=r.markers[z];ie(I,$.doc)==-1&&($.parent=null,r.markers.splice(z--,1))}},n=0;n<e.length;n++)t(n)}var Sl=0,ki=function(e,t,n,i,r){if(!(this instanceof ki))return new ki(e,t,n,i,r);n==null&&(n=0),Lr.call(this,[new Rr([new Mn("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n;var I=Ve(n,0);this.sel=Cn(I),this.history=new Qr(null),this.id=++Sl,this.modeOption=t,this.lineSep=i,this.direction=r=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),Da(this,{from:I,to:I,text:e}),Ti(this,Cn(I),ve)};ki.prototype=ke(Lr.prototype,{constructor:ki,iter:function(e,t,n){n?this.iterN(e-this.first,t-e,n):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var n=0,i=0;i<t.length;++i)n+=t[i].height;this.insertInner(e-this.first,t,n)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=tn(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:ci(function(e){var t=Ve(this.first,0),n=this.first+this.size-1;ir(this,{from:t,to:Ve(n,mt(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&_r(this.cm,0,0),Ti(this,Cn(t),ve)}),replaceRange:function(e,t,n,i){t=v(this,t),n=n?v(this,n):t,nr(this,e,t,n,i)},getRange:function(e,t,n){var i=zi(this,v(this,e),v(this,t));return n===!1?i:i.join(n||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(Xi(this,e))return mt(this,e)},getLineNumber:function(e){return Pt(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=mt(this,e)),Ci(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return v(this,e)},getCursor:function(e){var t=this.sel.primary(),n;return e==null||e=="head"?n=t.head:e=="anchor"?n=t.anchor:e=="end"||e=="to"||e===!1?n=t.to():n=t.from(),n},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:ci(function(e,t,n){Hs(this,v(this,typeof e=="number"?Ve(e,t||0):e),null,n)}),setSelection:ci(function(e,t,n){Hs(this,v(this,e),v(this,t||e),n)}),extendSelection:ci(function(e,t,n){Jr(this,v(this,e),t&&v(this,t),n)}),extendSelections:ci(function(e,t){Bs(this,U(this,e),t)}),extendSelectionsBy:ci(function(e,t){var n=he(this.sel.ranges,e);Bs(this,U(this,n),t)}),setSelections:ci(function(e,t,n){if(!e.length)return;for(var i=[],r=0;r<e.length;r++)i[r]=new Kt(v(this,e[r].anchor),v(this,e[r].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),Ti(this,Ji(this.cm,i,t),n)}),addSelection:ci(function(e,t,n){var i=this.sel.ranges.slice(0);i.push(new Kt(v(this,e),v(this,t||e))),Ti(this,Ji(this.cm,i,i.length-1),n)}),getSelection:function(e){for(var t=this.sel.ranges,n,i=0;i<t.length;i++){var r=zi(this,t[i].from(),t[i].to());n=n?n.concat(r):r}return e===!1?n:n.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],n=this.sel.ranges,i=0;i<n.length;i++){var r=zi(this,n[i].from(),n[i].to());e!==!1&&(r=r.join(e||this.lineSeparator())),t[i]=r}return t},replaceSelection:function(e,t,n){for(var i=[],r=0;r<this.sel.ranges.length;r++)i[r]=e;this.replaceSelections(i,t,n||"+input")},replaceSelections:ci(function(e,t,n){for(var i=[],r=this.sel,I=0;I<r.ranges.length;I++){var z=r.ranges[I];i[I]={from:z.from(),to:z.to(),text:this.splitLines(e[I]),origin:n}}for(var $=t&&t!="end"&&cl(this,i,t),J=i.length-1;J>=0;J--)ir(this,i[J]);$?js(this,$):this.cm&&Jn(this.cm)}),undo:ci(function(){ta(this,"undo")}),redo:ci(function(){ta(this,"redo")}),undoSelection:ci(function(){ta(this,"undo",!0)}),redoSelection:ci(function(){ta(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,n=0,i=0;i<e.done.length;i++)e.done[i].ranges||++t;for(var r=0;r<e.undone.length;r++)e.undone[r].ranges||++n;return{undo:t,redo:n}},clearHistory:function(){var e=this;this.history=new Qr(this.history.maxGeneration),On(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:er(this.history.done),undone:er(this.history.undone)}},setHistory:function(e){var t=this.history=new Qr(this.history.maxGeneration);t.done=er(e.done.slice(0),null,!0),t.undone=er(e.undone.slice(0),null,!0)},setGutterMarker:ci(function(e,t,n){return Or(this,e,"gutter",function(i){var r=i.gutterMarkers||(i.gutterMarkers={});return r[t]=n,!n&&He(r)&&(i.gutterMarkers=null),!0})}),clearGutter:ci(function(e){var t=this;this.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&Or(t,n,"gutter",function(){return n.gutterMarkers[e]=null,He(n.gutterMarkers)&&(n.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!Xi(this,e))return null;if(t=e,e=mt(this,e),!e)return null}else if(t=Pt(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:ci(function(e,t,n){return Or(this,e,t=="gutter"?"gutter":"class",function(i){var r=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!i[r])i[r]=n;else{if(A(n).test(i[r]))return!1;i[r]+=" "+n}return!0})}),removeLineClass:ci(function(e,t,n){return Or(this,e,t=="gutter"?"gutter":"class",function(i){var r=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",I=i[r];if(I)if(n==null)i[r]=null;else{var z=I.match(A(n));if(!z)return!1;var $=z.index+z[0].length;i[r]=I.slice(0,z.index)+(!z.index||$==I.length?"":" ")+I.slice($)||null}else return!1;return!0})}),addLineWidget:ci(function(e,t,n){return El(this,e,t,n)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return rr(this,v(this,e),v(this,t),n,n&&n.type||"range")},setBookmark:function(e,t){var n={replacedWith:t&&(t.nodeType==null?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return e=v(this,e),rr(this,e,e,n,"bookmark")},findMarksAt:function(e){e=v(this,e);var t=[],n=mt(this,e.line).markedSpans;if(n)for(var i=0;i<n.length;++i){var r=n[i];(r.from==null||r.from<=e.ch)&&(r.to==null||r.to>=e.ch)&&t.push(r.marker.parent||r.marker)}return t},findMarks:function(e,t,n){e=v(this,e),t=v(this,t);var i=[],r=e.line;return this.iter(e.line,t.line+1,function(I){var z=I.markedSpans;if(z)for(var $=0;$<z.length;$++){var J=z[$];!(J.to!=null&&r==e.line&&e.ch>=J.to||J.from==null&&r!=e.line||J.from!=null&&r==t.line&&J.from>=t.ch)&&(!n||n(J.marker))&&i.push(J.marker.parent||J.marker)}++r}),i},getAllMarks:function(){var e=[];return this.iter(function(t){var n=t.markedSpans;if(n)for(var i=0;i<n.length;++i)n[i].from!=null&&e.push(n[i].marker)}),e},posFromIndex:function(e){var t,n=this.first,i=this.lineSeparator().length;return this.iter(function(r){var I=r.text.length+i;if(I>e)return t=e,!0;e-=I,++n}),v(this,Ve(n,t))},indexFromPos:function(e){e=v(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var n=this.lineSeparator().length;return this.iter(this.first,e.line,function(i){t+=i.text.length+n}),t},copy:function(e){var t=new ki(tn(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,n=this.first+this.size;e.from!=null&&e.from>t&&(t=e.from),e.to!=null&&e.to<n&&(n=e.to);var i=new ki(tn(this,t,n),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(i.history=this.history),(this.linked||(this.linked=[])).push({doc:i,sharedHist:e.sharedHist}),i.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],Tl(i,to(this)),i},unlinkDoc:function(e){if(e instanceof Zt&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){var n=this.linked[t];if(n.doc!=e)continue;this.linked.splice(t,1),e.unlinkDoc(this),wl(to(this));break}if(e.history==this.history){var i=[e.id];On(e,function(r){return i.push(r.id)},!0),e.history=new Qr(null),e.history.done=er(this.history.done,i),e.history.undone=er(this.history.undone,i)}},iterLinkedDocs:function(e){On(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):wt(e)},lineSeparator:function(){return this.lineSep||`
`},setDirection:ci(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)})}),ki.prototype.eachLine=ki.prototype.iter;var io=0;function Cl(e){var t=this;if(no(t),ze(t,e)||dn(t.display,e))return;ne(e),K&&(io=+new Date);var n=Fn(t,e,!0),i=e.dataTransfer.files;if(!n||t.isReadOnly())return;if(i&&i.length&&window.FileReader&&window.File)for(var r=i.length,I=Array(r),z=0,$=function(){++z==r&&di(t,function(){n=v(t.doc,n);var Oe={from:n,to:n,text:t.doc.splitLines(I.filter(function(Be){return Be!=null}).join(t.doc.lineSeparator())),origin:"paste"};ir(t.doc,Oe),js(t.doc,Cn(v(t.doc,n),v(t.doc,An(Oe))))})()},J=function(Oe,Be){if(t.options.allowDropFileTypes&&ie(t.options.allowDropFileTypes,Oe.type)==-1){$();return}var Ke=new FileReader;Ke.onerror=function(){return $()},Ke.onload=function(){var $e=Ke.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test($e)){$();return}I[Be]=$e,$()},Ke.readAsText(Oe)},ee=0;ee<i.length;ee++)J(i[ee],ee);else{if(t.state.draggingText&&t.doc.sel.contains(n)>-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var ce=e.dataTransfer.getData("Text");if(ce){var ge;if(t.state.draggingText&&!t.state.draggingText.copy&&(ge=t.listSelections()),qr(t.doc,Cn(n,n)),ge)for(var Re=0;Re<ge.length;++Re)nr(t.doc,"",ge[Re].anchor,ge[Re].head,"drag");t.replaceSelection(ce,"around","paste"),t.display.input.focus()}}catch(Oe){}}}function Al(e,t){if(K&&(!e.state.draggingText||+new Date-io<100)){me(t);return}if(ze(e,t)||dn(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!f){var n=d("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",p&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),p&&n.parentNode.removeChild(n)}}function Ol(e,t){var n=Fn(e,t);if(!n)return;var i=document.createDocumentFragment();ms(e,n,i),e.display.dragCursor||(e.display.dragCursor=d("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),E(e.display.dragCursor,i)}function no(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function ro(e){if(!document.getElementsByClassName)return;for(var t=document.getElementsByClassName("CodeMirror"),n=[],i=0;i<t.length;i++){var r=t[i].CodeMirror;r&&n.push(r)}n.length&&n[0].operation(function(){for(var I=0;I<n.length;I++)e(n[I])})}var ao=!1;function Rl(){if(ao)return;Ll(),ao=!0}function Ll(){var e;Ie(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,ro(Il)},100))}),Ie(window,"blur",function(){return ro(Zn)})}function Il(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var Ln={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"},Dr=0;Dr<10;Dr++)Ln[Dr+48]=Ln[Dr+96]=String(Dr);for(var ia=65;ia<=90;ia++)Ln[ia]=String.fromCharCode(ia);for(var Mr=1;Mr<=12;Mr++)Ln[Mr+111]=Ln[Mr+63235]="F"+Mr;var cn={};cn.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"},cn.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"},cn.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"},cn.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"]},cn.default=o?cn.macDefault:cn.pcDefault;function kl(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var n,i,r,I,z=0;z<t.length-1;z++){var $=t[z];if(/^(cmd|meta|m)$/i.test($))I=!0;else if(/^a(lt)?$/i.test($))n=!0;else if(/^(c|ctrl|control)$/i.test($))i=!0;else if(/^s(hift)?$/i.test($))r=!0;else throw new Error("Unrecognized modifier name: "+$)}return n&&(e="Alt-"+e),i&&(e="Ctrl-"+e),I&&(e="Cmd-"+e),r&&(e="Shift-"+e),e}function Dl(e){var t={};for(var n in e)if(e.hasOwnProperty(n)){var i=e[n];if(/^(name|fallthrough|(de|at)tach)$/.test(n))continue;if(i=="..."){delete e[n];continue}for(var r=he(n.split(" "),kl),I=0;I<r.length;I++){var z=void 0,$=void 0;I==r.length-1?($=r.join(" "),z=i):($=r.slice(0,I+1).join(" "),z="...");var J=t[$];if(!J)t[$]=z;else if(J!=z)throw new Error("Inconsistent bindings for "+$)}delete e[n]}for(var ee in t)e[ee]=t[ee];return e}function ar(e,t,n,i){t=na(t);var r=t.call?t.call(e,i):t[e];if(r===!1)return"nothing";if(r==="...")return"multi";if(r!=null&&n(r))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return ar(e,t.fallthrough,n,i);for(var I=0;I<t.fallthrough.length;I++){var z=ar(e,t.fallthrough[I],n,i);if(z)return z}}}function so(e){var t=typeof e=="string"?e:Ln[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function oo(e,t,n){var i=e;return t.altKey&&i!="Alt"&&(e="Alt-"+e),(T?t.metaKey:t.ctrlKey)&&i!="Ctrl"&&(e="Ctrl-"+e),(T?t.ctrlKey:t.metaKey)&&i!="Mod"&&(e="Cmd-"+e),!n&&t.shiftKey&&i!="Shift"&&(e="Shift-"+e),e}function lo(e,t){if(p&&e.keyCode==34&&e.char)return!1;var n=Ln[e.keyCode];return n==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(n=e.code),oo(n,e,t))}function na(e){return typeof e=="string"?cn[e]:e}function sr(e,t){for(var n=e.doc.sel.ranges,i=[],r=0;r<n.length;r++){for(var I=t(n[r]);i.length&&Ct(I.from,te(i).to)<=0;){var z=i.pop();if(Ct(z.from,I.from)<0){I.from=z.from;break}}i.push(I)}Ui(e,function(){for(var $=i.length-1;$>=0;$--)nr(e.doc,"",i[$].from,i[$].to,"+delete");Jn(e)})}function Fa(e,t,n){var i=Ne(e.text,t+n,n);return i<0||i>e.text.length?null:i}function Ua(e,t,n){var i=Fa(e,t.ch,n);return i==null?null:new Ve(t.line,i,n<0?"after":"before")}function Ba(e,t,n,i,r){if(e){t.doc.direction=="rtl"&&(r=-r);var I=Ye(n,t.doc.direction);if(I){var z=r<0?te(I):I[0],$=r<0==(z.level==1),J=$?"after":"before",ee;if(z.level>0||t.doc.direction=="rtl"){var ce=Yn(t,n);ee=r<0?n.text.length-1:0;var ge=sn(t,ce,ee).top;ee=Ze(function(Re){return sn(t,ce,Re).top==ge},r<0==(z.level==1)?z.from:z.to-1,ee),J=="before"&&(ee=Fa(n,ee,1))}else ee=r<0?z.to:z.from;return new Ve(i,ee,J)}}return new Ve(i,r<0?n.text.length:0,r<0?"before":"after")}function Ml(e,t,n,i){var r=Ye(t,e.doc.direction);if(!r)return Ua(t,n,i);n.ch>=t.text.length?(n.ch=t.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var I=et(r,n.ch,n.sticky),z=r[I];if(e.doc.direction=="ltr"&&z.level%2==0&&(i>0?z.to>n.ch:z.from<n.ch))return Ua(t,n,i);var $=function(rt,ht){return Fa(t,rt instanceof Ve?rt.ch:rt,ht)},J,ee=function(rt){return e.options.lineWrapping?(J=J||Yn(e,t),ds(e,t,J,rt)):{begin:0,end:t.text.length}},ce=ee(n.sticky=="before"?$(n,-1):n.ch);if(e.doc.direction=="rtl"||z.level==1){var ge=z.level==1==i<0,Re=$(n,ge?1:-1);if(Re!=null&&(ge?Re<=z.to&&Re<=ce.end:Re>=z.from&&Re>=ce.begin)){var Oe=ge?"before":"after";return new Ve(n.line,Re,Oe)}}var Be=function(rt,ht,at){for(var pt=function($t,fi){return fi?new Ve(n.line,$($t,1),"before"):new Ve(n.line,$t,"after")};rt>=0&&rt<r.length;rt+=ht){var St=r[rt],Et=ht>0==(St.level!=1),Dt=Et?at.begin:$(at.end,-1);if(St.from<=Dt&&Dt<St.to)return pt(Dt,Et);if(Dt=Et?St.from:$(St.to,-1),at.begin<=Dt&&Dt<at.end)return pt(Dt,Et)}},Ke=Be(I+i,i,ce);if(Ke)return Ke;var $e=i>0?ce.end:$(ce.begin,-1);return $e!=null&&!(i>0&&$e==t.text.length)&&(Ke=Be(i>0?0:r.length-1,i,ee($e)),Ke)?Ke:null}var Pr={selectAll:Vs,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),ve)},killLine:function(e){return sr(e,function(t){if(t.empty()){var n=mt(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line<e.lastLine()?{from:t.head,to:Ve(t.head.line+1,0)}:{from:t.head,to:Ve(t.head.line,n)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return sr(e,function(t){return{from:Ve(t.from().line,0),to:v(e.doc,Ve(t.to().line+1,0))}})},delLineLeft:function(e){return sr(e,function(t){return{from:Ve(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return sr(e,function(t){var n=e.charCoords(t.head,"div").top+5,i=e.coordsChar({left:0,top:n},"div");return{from:i,to:t.from()}})},delWrappedLineRight:function(e){return sr(e,function(t){var n=e.charCoords(t.head,"div").top+5,i=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div");return{from:t.from(),to:i}})},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(Ve(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(Ve(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return uo(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return ho(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return Pl(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div")},Ce)},goLineLeft:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:n},"div")},Ce)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5,i=e.coordsChar({left:0,top:n},"div");return i.ch<e.getLine(i.line).search(/\S/)?ho(e,t.head):i},Ce)},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=[],n=e.listSelections(),i=e.options.tabSize,r=0;r<n.length;r++){var I=n[r].from(),z=G(e.getLine(I.line),I.ch,i);t.push(oe(i-z%i))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return Ui(e,function(){for(var t=e.listSelections(),n=[],i=0;i<t.length;i++){if(!t[i].empty())continue;var r=t[i].head,I=mt(e.doc,r.line).text;if(I){if(r.ch==I.length&&(r=new Ve(r.line,r.ch-1)),r.ch>0)r=new Ve(r.line,r.ch+1),e.replaceRange(I.charAt(r.ch-1)+I.charAt(r.ch-2),Ve(r.line,r.ch-2),r,"+transpose");else if(r.line>e.doc.first){var z=mt(e.doc,r.line-1).text;z&&(r=new Ve(r.line,1),e.replaceRange(I.charAt(0)+e.doc.lineSeparator()+z.charAt(z.length-1),Ve(r.line-1,z.length-1),r,"+transpose"))}}n.push(new Kt(r,r))}e.setSelections(n)})},newlineAndIndent:function(e){return Ui(e,function(){for(var t=e.listSelections(),n=t.length-1;n>=0;n--)e.replaceRange(e.doc.lineSeparator(),t[n].anchor,t[n].head,"+input");t=e.listSelections();for(var i=0;i<t.length;i++)e.indentLine(t[i].from().line,null,!0);Jn(e)})},openLine:function(e){return e.replaceSelection(`
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function uo(e,t){var n=mt(e.doc,t),i=Ci(n);return i!=n&&(t=Pt(i)),Ba(!0,e,i,t,1)}function Pl(e,t){var n=mt(e.doc,t),i=Xn(n);return i!=n&&(t=Pt(i)),Ba(!0,e,n,t,-1)}function ho(e,t){var n=uo(e,t.line),i=mt(e.doc,n.line),r=Ye(i,e.doc.direction);if(!r||r[0].level==0){var I=Math.max(n.ch,i.text.search(/\S/)),z=t.line==n.line&&t.ch<=I&&t.ch;return Ve(n.line,z?0:I,n.sticky)}return n}function ra(e,t,n){if(typeof t=="string"&&(t=Pr[t],!t))return!1;e.display.input.ensurePolled();var i=e.display.shift,r=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n&&(e.display.shift=!1),r=t(e)!=we}finally{e.display.shift=i,e.state.suppressEdits=!1}return r}function Nl(e,t,n){for(var i=0;i<e.state.keyMaps.length;i++){var r=ar(t,e.state.keyMaps[i],n,e);if(r)return r}return e.options.extraKeys&&ar(t,e.options.extraKeys,n,e)||ar(t,e.options.keyMap,n,e)}var Fl=new Y;function Nr(e,t,n,i){var r=e.state.keySeq;if(r){if(so(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Fl.set(50,function(){e.state.keySeq==r&&(e.state.keySeq=null,e.display.input.reset())}),co(e,r+" "+t,n,i))return!0}return co(e,t,n,i)}function co(e,t,n,i){var r=Nl(e,t,i);return r=="multi"&&(e.state.keySeq=t),r=="handled"&&vi(e,"keyHandled",e,t,n),(r=="handled"||r=="multi")&&(ne(n),xa(e)),!!r}function fo(e,t){var n=lo(t,!0);return n?t.shiftKey&&!e.state.keySeq?Nr(e,"Shift-"+n,t,function(i){return ra(e,i,!0)})||Nr(e,n,t,function(i){if(typeof i=="string"?/^go[A-Z]/.test(i):i.motion)return ra(e,i)}):Nr(e,n,t,function(i){return ra(e,i)}):!1}function Ul(e,t,n){return Nr(e,"'"+n+"'",t,function(i){return ra(e,i,!0)})}var Ha=null;function po(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=F(),ze(t,e))return;K&&W<11&&e.keyCode==27&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=n==16||e.shiftKey;var i=fo(t,e);p&&(Ha=i?n:null,!i&&n==88&&!Ut&&(o?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),M&&!o&&!i&&n==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),n==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Bl(t)}function Bl(e){var t=e.display.lineDiv;D(t,"CodeMirror-crosshair");function n(i){(i.keyCode==18||!i.altKey)&&(x(t,"CodeMirror-crosshair"),nt(document,"keyup",n),nt(document,"mouseover",n))}Ie(document,"keyup",n),Ie(document,"mouseover",n)}function mo(e){e.keyCode==16&&(this.doc.sel.shift=!1),ze(this,e)}function go(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(dn(t.display,e)||ze(t,e)||e.ctrlKey&&!e.altKey||o&&e.metaKey)return;var n=e.keyCode,i=e.charCode;if(p&&n==Ha){Ha=null,ne(e);return}if(p&&(!e.which||e.which<10)&&fo(t,e))return;var r=String.fromCharCode(i==null?n:i);if(r=="\b")return;if(Ul(t,e,r))return;t.display.input.onKeyPress(e)}var Hl=400,ja=function(e,t,n){this.time=e,this.pos=t,this.button=n};ja.prototype.compare=function(e,t,n){return this.time+Hl>e&&Ct(t,this.pos)==0&&n==this.button};var Fr,Ur;function jl(e,t){var n=+new Date;return Ur&&Ur.compare(n,e,t)?(Fr=Ur=null,"triple"):Fr&&Fr.compare(n,e,t)?(Ur=new ja(n,e,t),Fr=null,"double"):(Fr=new ja(n,e,t),Ur=null,"single")}function vo(e){var t=this,n=t.display;if(ze(t,e)||n.activeTouch&&n.input.supportsTouch())return;if(n.input.ensurePolled(),n.shift=e.shiftKey,dn(n,e)){P||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if(Wa(t,e))return;var i=Fn(t,e),r=Me(e),I=i?jl(i,r):"single";if(window.focus(),r==1&&t.state.selectingText&&t.state.selectingText(e),i&&Wl(t,r,i,I,e))return;r==1?i?zl(t,i,I,e):Ee(e)==n.scroller&&ne(e):r==2?(i&&Jr(t.doc,i),setTimeout(function(){return n.input.focus()},20)):r==3&&(O?t.display.input.onContextMenu(e):vs(t))}function Wl(e,t,n,i,r){var I="Click";return i=="double"?I="Double"+I:i=="triple"&&(I="Triple"+I),I=(t==1?"Left":t==2?"Middle":"Right")+I,Nr(e,oo(I,r),r,function(z){if(typeof z=="string"&&(z=Pr[z]),!z)return!1;var $=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),$=z(e,n)!=we}finally{e.state.suppressEdits=!1}return $})}function Gl(e,t,n){var i=e.getOption("configureMouse"),r=i?i(e,t,n):{};if(r.unit==null){var I=c?n.shiftKey&&n.metaKey:n.altKey;r.unit=I?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(r.extend==null||e.doc.extend)&&(r.extend=e.doc.extend||n.shiftKey),r.addNew==null&&(r.addNew=o?n.metaKey:n.ctrlKey),r.moveOnDrag==null&&(r.moveOnDrag=!(o?n.altKey:n.ctrlKey)),r}function zl(e,t,n,i){K?setTimeout(k(gs,e),0):e.curOp.focus=F();var r=Gl(e,n,i),I=e.doc.sel,z;e.options.dragDrop&&je&&!e.isReadOnly()&&n=="single"&&(z=I.contains(t))>-1&&(Ct((z=I.ranges[z]).from(),t)<0||t.xRel>0)&&(Ct(z.to(),t)>0||t.xRel<0)?Kl(e,i,t,r):Vl(e,i,t,r)}function Kl(e,t,n,i){var r=e.display,I=!1,z=di(e,function(ee){P&&(r.scroller.draggable=!1),e.state.draggingText=!1,nt(r.wrapper.ownerDocument,"mouseup",z),nt(r.wrapper.ownerDocument,"mousemove",$),nt(r.scroller,"dragstart",J),nt(r.scroller,"drop",z),I||(ne(ee),i.addNew||Jr(e.doc,n,null,null,i.extend),P&&!f||K&&W==9?setTimeout(function(){r.wrapper.ownerDocument.body.focus({preventScroll:!0}),r.input.focus()},20):r.input.focus())}),$=function(ee){I=I||Math.abs(t.clientX-ee.clientX)+Math.abs(t.clientY-ee.clientY)>=10},J=function(){return I=!0};P&&(r.scroller.draggable=!0),e.state.draggingText=z,z.copy=!i.moveOnDrag,r.scroller.dragDrop&&r.scroller.dragDrop(),Ie(r.wrapper.ownerDocument,"mouseup",z),Ie(r.wrapper.ownerDocument,"mousemove",$),Ie(r.scroller,"dragstart",J),Ie(r.scroller,"drop",z),vs(e),setTimeout(function(){return r.input.focus()},20)}function yo(e,t,n){if(n=="char")return new Kt(t,t);if(n=="word")return e.findWordAt(t);if(n=="line")return new Kt(Ve(t.line,0),v(e.doc,Ve(t.line+1,0)));var i=n(e,t);return new Kt(i.from,i.to)}function Vl(e,t,n,i){var r=e.display,I=e.doc;ne(t);var z,$,J=I.sel,ee=J.ranges;if(i.addNew&&!i.extend?($=I.sel.contains(n),$>-1?z=ee[$]:z=new Kt(n,n)):(z=I.sel.primary(),$=I.sel.primIndex),i.unit=="rectangle")i.addNew||(z=new Kt(n,n)),n=Fn(e,t,!0,!0),$=-1;else{var ce=yo(e,n,i.unit);i.extend?z=Pa(z,ce.anchor,ce.head,i.extend):z=ce}i.addNew?$==-1?($=ee.length,Ti(I,Ji(e,ee.concat([z]),$),{scroll:!1,origin:"*mouse"})):ee.length>1&&ee[$].empty()&&i.unit=="char"&&!i.extend?(Ti(I,Ji(e,ee.slice(0,$).concat(ee.slice($+1)),0),{scroll:!1,origin:"*mouse"}),J=I.sel):Na(I,$,z,Se):($=0,Ti(I,new Gi([z],0),Se),J=I.sel);var ge=n;function Re(at){if(Ct(ge,at)==0)return;if(ge=at,i.unit=="rectangle"){for(var pt=[],St=e.options.tabSize,Et=G(mt(I,n.line).text,n.ch,St),Dt=G(mt(I,at.line).text,at.ch,St),$t=Math.min(Et,Dt),fi=Math.max(Et,Dt),qt=Math.min(n.line,at.line),Bi=Math.min(e.lastLine(),Math.max(n.line,at.line));qt<=Bi;qt++){var Di=mt(I,qt).text,ri=pe(Di,$t,St);$t==fi?pt.push(new Kt(Ve(qt,ri),Ve(qt,ri))):Di.length>ri&&pt.push(new Kt(Ve(qt,ri),Ve(qt,pe(Di,fi,St))))}pt.length||pt.push(new Kt(n,n)),Ti(I,Ji(e,J.ranges.slice(0,$).concat(pt),$),{origin:"*mouse",scroll:!1}),e.scrollIntoView(at)}else{var Mi=z,yi=yo(e,at,i.unit),oi=Mi.anchor,ai;Ct(yi.anchor,oi)>0?(ai=yi.head,oi=yn(Mi.from(),yi.anchor)):(ai=yi.anchor,oi=vn(Mi.to(),yi.head));var ei=J.ranges.slice(0);ei[$]=Xl(e,new Kt(v(I,oi),ai)),Ti(I,Ji(e,ei,$),Se)}}var Oe=r.wrapper.getBoundingClientRect(),Be=0;function Ke(at){var pt=++Be,St=Fn(e,at,!0,i.unit=="rectangle");if(!St)return;if(Ct(St,ge)!=0){e.curOp.focus=F(),Re(St);var Et=Vr(r,I);(St.line>=Et.to||St.line<Et.from)&&setTimeout(di(e,function(){Be==pt&&Ke(at)}),150)}else{var Dt=at.clientY<Oe.top?-20:at.clientY>Oe.bottom?20:0;Dt&&setTimeout(di(e,function(){if(Be!=pt)return;r.scroller.scrollTop+=Dt,Ke(at)}),50)}}function $e(at){e.state.selectingText=!1,Be=Infinity,at&&(ne(at),r.input.focus()),nt(r.wrapper.ownerDocument,"mousemove",rt),nt(r.wrapper.ownerDocument,"mouseup",ht),I.history.lastSelOrigin=null}var rt=di(e,function(at){at.buttons===0||!Me(at)?$e(at):Ke(at)}),ht=di(e,$e);e.state.selectingText=ht,Ie(r.wrapper.ownerDocument,"mousemove",rt),Ie(r.wrapper.ownerDocument,"mouseup",ht)}function Xl(e,t){var n=t.anchor,i=t.head,r=mt(e.doc,n.line);if(Ct(n,i)==0&&n.sticky==i.sticky)return t;var I=Ye(r);if(!I)return t;var z=et(I,n.ch,n.sticky),$=I[z];if($.from!=n.ch&&$.to!=n.ch)return t;var J=z+($.from==n.ch==($.level!=1)?0:1);if(J==0||J==I.length)return t;var ee;if(i.line!=n.line)ee=(i.line-n.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var ce=et(I,i.ch,i.sticky),ge=ce-z||(i.ch-n.ch)*($.level==1?-1:1);ce==J-1||ce==J?ee=ge<0:ee=ge>0}var Re=I[J+(ee?-1:0)],Oe=ee==(Re.level==1),Be=Oe?Re.from:Re.to,Ke=Oe?"after":"before";return n.ch==Be&&n.sticky==Ke?t:new Kt(new Ve(n.line,Be,Ke),i)}function bo(e,t,n,i){var r,I;if(t.touches)r=t.touches[0].clientX,I=t.touches[0].clientY;else try{r=t.clientX,I=t.clientY}catch(Re){return!1}if(r>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;i&&ne(t);var z=e.display,$=z.lineDiv.getBoundingClientRect();if(I>$.bottom||!ye(e,n))return de(t);I-=$.top-z.viewOffset;for(var J=0;J<e.display.gutterSpecs.length;++J){var ee=z.gutters.childNodes[J];if(ee&&ee.getBoundingClientRect().right>=r){var ce=Hi(e.doc,I),ge=e.display.gutterSpecs[J];return De(e,n,e,ce,ge.className,t),de(t)}}}function Wa(e,t){return bo(e,t,"gutterClick",!0)}function _o(e,t){if(dn(e.display,t)||Yl(e,t))return;if(ze(e,t,"contextmenu"))return;O||e.display.input.onContextMenu(t)}function Yl(e,t){return ye(e,"gutterContextMenu")?bo(e,t,"gutterContextMenu",!1):!1}function Eo(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),yr(e)}var or={toString:function(){return"CodeMirror.Init"}},xo={},aa={};function $l(e){var t=e.optionHandlers;function n(i,r,I,z){e.defaults[i]=r,I&&(t[i]=z?function($,J,ee){ee!=or&&I($,J,ee)}:I)}e.defineOption=n,e.Init=or,n("value","",function(i,r){return i.setValue(r)},!0),n("mode",null,function(i,r){i.doc.modeOption=r,ka(i)},!0),n("indentUnit",2,ka,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(i){Cr(i),yr(i),Ii(i)},!0),n("lineSeparator",null,function(i,r){if(i.doc.lineSep=r,!r)return;var I=[],z=i.doc.first;i.doc.iter(function(J){for(var ee=0;;){var ce=J.text.indexOf(r,ee);if(ce==-1)break;ee=ce+r.length,I.push(Ve(z,ce))}z++});for(var $=I.length-1;$>=0;$--)nr(i.doc,r,I[$],Ve(I[$].line,I[$].ch+r.length))}),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(i,r,I){i.state.specialChars=new RegExp(r.source+(r.test(" ")?"":"| "),"g"),I!=or&&i.refresh()}),n("specialCharPlaceholder",Yt,function(i){return i.refresh()},!0),n("electricChars",!0),n("inputStyle",a?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),n("spellcheck",!1,function(i,r){return i.getInputField().spellcheck=r},!0),n("autocorrect",!1,function(i,r){return i.getInputField().autocorrect=r},!0),n("autocapitalize",!1,function(i,r){return i.getInputField().autocapitalize=r},!0),n("rtlMoveVisually",!L),n("wholeLineUpdateBefore",!0),n("theme","default",function(i){Eo(i),Sr(i)},!0),n("keyMap","default",function(i,r,I){var z=na(r),$=I!=or&&na(I);$&&$.detach&&$.detach(i,z),z.attach&&z.attach(i,$||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Zl,!0),n("gutters",[],function(i,r){i.display.gutterSpecs=La(r,i.options.lineNumbers),Sr(i)},!0),n("fixedGutter",!0,function(i,r){i.display.gutters.style.left=r?_a(i.display)+"px":"0",i.refresh()},!0),n("coverGutterNextToScrollbar",!1,function(i){return qn(i)},!0),n("scrollbarStyle","native",function(i){Ts(i),qn(i),i.display.scrollbars.setScrollTop(i.doc.scrollTop),i.display.scrollbars.setScrollLeft(i.doc.scrollLeft)},!0),n("lineNumbers",!1,function(i,r){i.display.gutterSpecs=La(i.options.gutters,r),Sr(i)},!0),n("firstLineNumber",1,Sr,!0),n("lineNumberFormatter",function(i){return i},Sr,!0),n("showCursorWhenSelecting",!1,br,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,function(i,r){r=="nocursor"&&(Zn(i),i.display.input.blur()),i.display.input.readOnlyChanged(r)}),n("screenReaderLabel",null,function(i,r){r=r===""?null:r,i.display.input.screenReaderLabelChanged(r)}),n("disableInput",!1,function(i,r){r||i.display.input.reset()},!0),n("dragDrop",!0,Ql),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,br,!0),n("singleCursorHeightPerLine",!0,br,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,Cr,!0),n("addModeClass",!1,Cr,!0),n("pollInterval",100),n("undoDepth",200,function(i,r){return i.doc.history.undoDepth=r}),n("historyEventDelay",1250),n("viewportMargin",10,function(i){return i.refresh()},!0),n("maxHighlightLength",1e4,Cr,!0),n("moveInputWithCursor",!0,function(i,r){r||i.display.input.resetPosition()}),n("tabindex",null,function(i,r){return i.display.input.getField().tabIndex=r||""}),n("autofocus",null),n("direction","ltr",function(i,r){return i.doc.setDirection(r)},!0),n("phrases",null)}function Ql(e,t,n){var i=n&&n!=or;if(!t!=!i){var r=e.display.dragFunctions,I=t?Ie:nt;I(e.display.scroller,"dragstart",r.start),I(e.display.scroller,"dragenter",r.enter),I(e.display.scroller,"dragover",r.over),I(e.display.scroller,"dragleave",r.leave),I(e.display.scroller,"drop",r.drop)}}function Zl(e){e.options.lineWrapping?(D(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(x(e.display.wrapper,"CodeMirror-wrap"),Hr(e)),Ea(e),Ii(e),yr(e),setTimeout(function(){return qn(e)},100)}function Zt(e,t){var n=this;if(!(this instanceof Zt))return new Zt(e,t);this.options=t=t?y(t):{},y(xo,t,!1);var i=t.value;typeof i=="string"?i=new ki(i,t.mode,null,t.lineSeparator,t.direction):t.mode&&(i.modeOption=t.mode),this.doc=i;var r=new Zt.inputStyles[t.inputStyle](this),I=this.display=new hl(e,i,r,t);I.wrapper.CodeMirror=this,Eo(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Ts(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 Y,keySeq:null,specialChars:null},t.autofocus&&!a&&I.input.focus(),K&&W<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Jl(this),Rl(),jn(this),this.curOp.forceUpdate=!0,Ds(this,i),t.autofocus&&!a||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&Ta(n)},20):Zn(this);for(var z in aa)aa.hasOwnProperty(z)&&aa[z](this,t[z],or);Cs(this),t.finishInit&&t.finishInit(this);for(var $=0;$<Ga.length;++$)Ga[$](this);Wn(this),P&&t.lineWrapping&&getComputedStyle(I.lineDiv).textRendering=="optimizelegibility"&&(I.lineDiv.style.textRendering="auto")}Zt.defaults=xo,Zt.optionHandlers=aa;function Jl(e){var t=e.display;Ie(t.scroller,"mousedown",di(e,vo)),K&&W<11?Ie(t.scroller,"dblclick",di(e,function(J){if(ze(e,J))return;var ee=Fn(e,J);if(!ee||Wa(e,J)||dn(e.display,J))return;ne(J);var ce=e.findWordAt(ee);Jr(e.doc,ce.anchor,ce.head)})):Ie(t.scroller,"dblclick",function(J){return ze(e,J)||ne(J)}),Ie(t.scroller,"contextmenu",function(J){return _o(e,J)}),Ie(t.input.getField(),"contextmenu",function(J){t.scroller.contains(J.target)||_o(e,J)});var n,i={end:0};function r(){t.activeTouch&&(n=setTimeout(function(){return t.activeTouch=null},1e3),i=t.activeTouch,i.end=+new Date)}function I(J){if(J.touches.length!=1)return!1;var ee=J.touches[0];return ee.radiusX<=1&&ee.radiusY<=1}function z(J,ee){if(ee.left==null)return!0;var ce=ee.left-J.left,ge=ee.top-J.top;return ce*ce+ge*ge>20*20}Ie(t.scroller,"touchstart",function(J){if(!ze(e,J)&&!I(J)&&!Wa(e,J)){t.input.ensurePolled(),clearTimeout(n);var ee=+new Date;t.activeTouch={start:ee,moved:!1,prev:ee-i.end<=300?i:null},J.touches.length==1&&(t.activeTouch.left=J.touches[0].pageX,t.activeTouch.top=J.touches[0].pageY)}}),Ie(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Ie(t.scroller,"touchend",function(J){var ee=t.activeTouch;if(ee&&!dn(t,J)&&ee.left!=null&&!ee.moved&&new Date-ee.start<300){var ce=e.coordsChar(t.activeTouch,"page"),ge;!ee.prev||z(ee,ee.prev)?ge=new Kt(ce,ce):!ee.prev.prev||z(ee,ee.prev.prev)?ge=e.findWordAt(ce):ge=new Kt(Ve(ce.line,0),v(e.doc,Ve(ce.line+1,0))),e.setSelection(ge.anchor,ge.head),e.focus(),ne(J)}r()}),Ie(t.scroller,"touchcancel",r),Ie(t.scroller,"scroll",function(){t.scroller.clientHeight&&(Er(e,t.scroller.scrollTop),Bn(e,t.scroller.scrollLeft,!0),De(e,"scroll",e))}),Ie(t.scroller,"mousewheel",function(J){return Rs(e,J)}),Ie(t.scroller,"DOMMouseScroll",function(J){return Rs(e,J)}),Ie(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(J){ze(e,J)||me(J)},over:function(J){ze(e,J)||(Ol(e,J),me(J))},start:function(J){return Al(e,J)},drop:di(e,Cl),leave:function(J){ze(e,J)||no(e)}};var $=t.input.getField();Ie($,"keyup",function(J){return mo.call(e,J)}),Ie($,"keydown",di(e,po)),Ie($,"keypress",di(e,go)),Ie($,"focus",function(J){return Ta(e,J)}),Ie($,"blur",function(J){return Zn(e,J)})}var Ga=[];Zt.defineInitHook=function(e){return Ga.push(e)};function Br(e,t,n,i){var r=e.doc,I;n==null&&(n="add"),n=="smart"&&(r.mode.indent?I=qe(e,t).state:n="prev");var z=e.options.tabSize,$=mt(r,t),J=G($.text,null,z);$.stateAfter&&($.stateAfter=null);var ee=$.text.match(/^\s*/)[0],ce;if(!i&&!/\S/.test($.text))ce=0,n="not";else if(n=="smart"&&(ce=r.mode.indent(I,$.text.slice(ee.length),$.text),ce==we||ce>150)){if(!i)return;n="prev"}n=="prev"?t>r.first?ce=G(mt(r,t-1).text,null,z):ce=0:n=="add"?ce=J+e.options.indentUnit:n=="subtract"?ce=J-e.options.indentUnit:typeof n=="number"&&(ce=J+n),ce=Math.max(0,ce);var ge="",Re=0;if(e.options.indentWithTabs)for(var Oe=Math.floor(ce/z);Oe;--Oe)Re+=z,ge+=" ";if(Re<ce&&(ge+=oe(ce-Re)),ge!=ee)return nr(r,ge,Ve(t,0),Ve(t,ee.length),"+input"),$.stateAfter=null,!0;for(var Be=0;Be<r.sel.ranges.length;Be++){var Ke=r.sel.ranges[Be];if(Ke.head.line==t&&Ke.head.ch<ee.length){var $e=Ve(t,ee.length);Na(r,Be,new Kt($e,$e));break}}}var qi=null;function sa(e){qi=e}function za(e,t,n,i,r){var I=e.doc;e.display.shift=!1,i||(i=I.sel);var z=+new Date-200,$=r=="paste"||e.state.pasteIncoming>z,J=wt(t),ee=null;if($&&i.ranges.length>1)if(qi&&qi.text.join(`
`)==t){if(i.ranges.length%qi.text.length==0){ee=[];for(var ce=0;ce<qi.text.length;ce++)ee.push(I.splitLines(qi.text[ce]))}}else J.length==i.ranges.length&&e.options.pasteLinesPerSelection&&(ee=he(J,function(rt){return[rt]}));for(var ge=e.curOp.updateInput,Re=i.ranges.length-1;Re>=0;Re--){var Oe=i.ranges[Re],Be=Oe.from(),Ke=Oe.to();Oe.empty()&&(n&&n>0?Be=Ve(Be.line,Be.ch-n):e.state.overwrite&&!$?Ke=Ve(Ke.line,Math.min(mt(I,Ke.line).text.length,Ke.ch+te(J).length)):$&&qi&&qi.lineWise&&qi.text.join(`
`)==J.join(`
`)&&(Be=Ke=Ve(Be.line,0)));var $e={from:Be,to:Ke,text:ee?ee[Re%ee.length]:J,origin:r||($?"paste":e.state.cutIncoming>z?"cut":"+input")};ir(e.doc,$e),vi(e,"inputRead",e,$e)}t&&!$&&wo(e,t),Jn(e),e.curOp.updateInput<2&&(e.curOp.updateInput=ge),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function To(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&Ui(t,function(){return za(t,n,0,null,"paste")}),!0}function wo(e,t){if(!e.options.electricChars||!e.options.smartIndent)return;for(var n=e.doc.sel,i=n.ranges.length-1;i>=0;i--){var r=n.ranges[i];if(r.head.ch>100||i&&n.ranges[i-1].head.line==r.head.line)continue;var I=e.getModeAt(r.head),z=!1;if(I.electricChars){for(var $=0;$<I.electricChars.length;$++)if(t.indexOf(I.electricChars.charAt($))>-1){z=Br(e,r.head.line,"smart");break}}else I.electricInput&&(I.electricInput.test(mt(e.doc,r.head.line).text.slice(0,r.head.ch))&&(z=Br(e,r.head.line,"smart")));z&&vi(e,"electricInput",e,r.head.line)}}function So(e){for(var t=[],n=[],i=0;i<e.doc.sel.ranges.length;i++){var r=e.doc.sel.ranges[i].head.line,I={anchor:Ve(r,0),head:Ve(r+1,0)};n.push(I),t.push(e.getRange(I.anchor,I.head))}return{text:t,ranges:n}}function Co(e,t,n,i){e.setAttribute("autocorrect",n?"":"off"),e.setAttribute("autocapitalize",i?"":"off"),e.setAttribute("spellcheck",!!t)}function Ao(){var e=d("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=d("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return P?e.style.width="1000px":e.setAttribute("wrap","off"),u&&(e.style.border="1px solid black"),Co(e),t}function ql(e){var t=e.optionHandlers,n=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(i,r){var I=this.options,z=I[i];if(I[i]==r&&i!="mode")return;I[i]=r,t.hasOwnProperty(i)&&di(this,t[i])(this,r,z),De(this,"optionChange",this,i)},getOption:function(i){return this.options[i]},getDoc:function(){return this.doc},addKeyMap:function(i,r){this.state.keyMaps[r?"push":"unshift"](na(i))},removeKeyMap:function(i){for(var r=this.state.keyMaps,I=0;I<r.length;++I)if(r[I]==i||r[I].name==i)return r.splice(I,1),!0},addOverlay:Ai(function(i,r){var I=i.token?i:e.getMode(this.options,i);if(I.startState)throw new Error("Overlays may not be stateful.");ae(this.state.overlays,{mode:I,modeSpec:i,opaque:r&&r.opaque,priority:r&&r.priority||0},function(z){return z.priority}),this.state.modeGen++,Ii(this)}),removeOverlay:Ai(function(i){for(var r=this.state.overlays,I=0;I<r.length;++I){var z=r[I].modeSpec;if(z==i||typeof i=="string"&&z.name==i){r.splice(I,1),this.state.modeGen++,Ii(this);return}}}),indentLine:Ai(function(i,r,I){typeof r!="string"&&typeof r!="number"&&(r==null?r=this.options.smartIndent?"smart":"prev":r=r?"add":"subtract"),Xi(this.doc,i)&&Br(this,i,r,I)}),indentSelection:Ai(function(i){for(var r=this.doc.sel.ranges,I=-1,z=0;z<r.length;z++){var $=r[z];if($.empty())$.head.line>I&&(Br(this,$.head.line,i,!0),I=$.head.line,z==this.doc.sel.primIndex&&Jn(this));else{var J=$.from(),ee=$.to(),ce=Math.max(I,J.line);I=Math.min(this.lastLine(),ee.line-(ee.ch?0:1))+1;for(var ge=ce;ge<I;++ge)Br(this,ge,i);var Re=this.doc.sel.ranges;J.ch==0&&r.length==Re.length&&Re[z].from().ch>0&&Na(this.doc,z,new Kt(J,Re[z].to()),ve)}}}),getTokenAt:function(i,r){return Qt(this,i,r)},getLineTokens:function(i,r){return Qt(this,Ve(i),r,!0)},getTokenTypeAt:function(i){i=v(this.doc,i);var r=We(this,mt(this.doc,i.line)),I=0,z=(r.length-1)/2,$=i.ch,J;if($==0)J=r[2];else for(;;){var ee=I+z>>1;if((ee?r[ee*2-1]:0)>=$)z=ee;else if(r[ee*2+1]<$)I=ee+1;else{J=r[ee*2+2];break}}var ce=J?J.indexOf("overlay "):-1;return ce<0?J:ce==0?null:J.slice(0,ce-1)},getModeAt:function(i){var r=this.doc.mode;return r.innerMode?e.innerMode(r,this.getTokenAt(i).state).mode:r},getHelper:function(i,r){return this.getHelpers(i,r)[0]},getHelpers:function(i,r){var I=[];if(!n.hasOwnProperty(r))return I;var z=n[r],$=this.getModeAt(i);if(typeof $[r]=="string")z[$[r]]&&I.push(z[$[r]]);else if($[r])for(var J=0;J<$[r].length;J++){var ee=z[$[r][J]];ee&&I.push(ee)}else $.helperType&&z[$.helperType]?I.push(z[$.helperType]):z[$.name]&&I.push(z[$.name]);for(var ce=0;ce<z._global.length;ce++){var ge=z._global[ce];ge.pred($,this)&&ie(I,ge.val)==-1&&I.push(ge.val)}return I},getStateAfter:function(i,r){var I=this.doc;return i=X(I,i==null?I.first+I.size-1:i),qe(this,i+1,r).state},cursorCoords:function(i,r){var I,z=this.doc.sel.primary();return i==null?I=z.head:typeof i=="object"?I=v(this.doc,i):I=i?z.from():z.to(),Zi(this,I,r||"page")},charCoords:function(i,r){return ma(this,v(this.doc,i),r||"page")},coordsChar:function(i,r){return i=ls(this,i,r||"page"),va(this,i.left,i.top)},lineAtHeight:function(i,r){return i=ls(this,{top:i,left:0},r||"page").top,Hi(this.doc,i+this.display.viewOffset)},heightAtLine:function(i,r,I){var z=!1,$;if(typeof i=="number"){var J=this.doc.first+this.doc.size-1;i<this.doc.first?i=this.doc.first:i>J&&(i=J,z=!0),$=mt(this.doc,i)}else $=i;return Wr(this,$,{top:0,left:0},r||"page",I||z).top+(z?this.doc.height-Qi($):0)},defaultTextHeight:function(){return $n(this.display)},defaultCharWidth:function(){return Qn(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(i,r,I,z,$){var J=this.display;i=Zi(this,v(this.doc,i));var ee=i.bottom,ce=i.left;if(r.style.position="absolute",r.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(r),J.sizer.appendChild(r),z=="over")ee=i.top;else if(z=="above"||z=="near"){var ge=Math.max(J.wrapper.clientHeight,this.doc.height),Re=Math.max(J.sizer.clientWidth,J.lineSpace.clientWidth);(z=="above"||i.bottom+r.offsetHeight>ge)&&i.top>r.offsetHeight?ee=i.top-r.offsetHeight:i.bottom+r.offsetHeight<=ge&&(ee=i.bottom),ce+r.offsetWidth>Re&&(ce=Re-r.offsetWidth)}r.style.top=ee+"px",r.style.left=r.style.right="",$=="right"?(ce=J.sizer.clientWidth-r.offsetWidth,r.style.right="0px"):($=="left"?ce=0:$=="middle"&&(ce=(J.sizer.clientWidth-r.offsetWidth)/2),r.style.left=ce+"px"),I&&Qo(this,{left:ce,top:ee,right:ce+r.offsetWidth,bottom:ee+r.offsetHeight})},triggerOnKeyDown:Ai(po),triggerOnKeyPress:Ai(go),triggerOnKeyUp:mo,triggerOnMouseDown:Ai(vo),execCommand:function(i){if(Pr.hasOwnProperty(i))return Pr[i].call(null,this)},triggerElectric:Ai(function(i){wo(this,i)}),findPosH:function(i,r,I,z){var $=1;r<0&&($=-1,r=-r);for(var J=v(this.doc,i),ee=0;ee<r&&!(J=Ka(this.doc,J,$,I,z),J.hitSide);++ee);return J},moveH:Ai(function(i,r){var I=this;this.extendSelectionsBy(function(z){return I.display.shift||I.doc.extend||z.empty()?Ka(I.doc,z.head,i,r,I.options.rtlMoveVisually):i<0?z.from():z.to()},Ce)}),deleteH:Ai(function(i,r){var I=this.doc.sel,z=this.doc;I.somethingSelected()?z.replaceSelection("",null,"+delete"):sr(this,function($){var J=Ka(z,$.head,i,r,!1);return i<0?{from:J,to:$.head}:{from:$.head,to:J}})}),findPosV:function(i,r,I,z){var $=1,J=z;r<0&&($=-1,r=-r);for(var ee=v(this.doc,i),ce=0;ce<r;++ce){var ge=Zi(this,ee,"div");if(J==null?J=ge.left:ge.left=J,ee=Oo(this,ge,$,I),ee.hitSide)break}return ee},moveV:Ai(function(i,r){var I=this,z=this.doc,$=[],J=!this.display.shift&&!z.extend&&z.sel.somethingSelected();if(z.extendSelectionsBy(function(ce){if(J)return i<0?ce.from():ce.to();var ge=Zi(I,ce.head,"div");ce.goalColumn!=null&&(ge.left=ce.goalColumn),$.push(ge.left);var Re=Oo(I,ge,i,r);return r=="page"&&ce==z.sel.primary()&&Sa(I,ma(I,Re,"div").top-ge.top),Re},Ce),$.length)for(var ee=0;ee<z.sel.ranges.length;ee++)z.sel.ranges[ee].goalColumn=$[ee]}),findWordAt:function(i){var r=this.doc,I=mt(r,i.line).text,z=i.ch,$=i.ch;if(I){var J=this.getHelper(i,"wordChars");(i.sticky=="before"||$==I.length)&&z?--z:++$;for(var ee=I.charAt(z),ce=Pe(ee,J)?function(ge){return Pe(ge,J)}:/\s/.test(ee)?function(ge){return/\s/.test(ge)}:function(ge){return!/\s/.test(ge)&&!Pe(ge)};z>0&&ce(I.charAt(z-1));)--z;for(;$<I.length&&ce(I.charAt($));)++$}return new Kt(Ve(i.line,z),Ve(i.line,$))},toggleOverwrite:function(i){if(i!=null&&i==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?D(this.display.cursorDiv,"CodeMirror-overwrite"):x(this.display.cursorDiv,"CodeMirror-overwrite"),De(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==F()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:Ai(function(i,r){_r(this,i,r)}),getScrollInfo:function(){var i=this.display.scroller;return{left:i.scrollLeft,top:i.scrollTop,height:i.scrollHeight-an(this)-this.display.barHeight,width:i.scrollWidth-an(this)-this.display.barWidth,clientHeight:ca(this),clientWidth:Pn(this)}},scrollIntoView:Ai(function(i,r){i==null?(i={from:this.doc.sel.primary().head,to:null},r==null&&(r=this.options.cursorScrollMargin)):typeof i=="number"?i={from:Ve(i,0),to:null}:i.from==null&&(i={from:i,to:null}),i.to||(i.to=i.from),i.margin=r||0,i.from.line!=null?Zo(this,i):bs(this,i.from,i.to,i.margin)}),setSize:Ai(function(i,r){var I=this,z=function(J){return typeof J=="number"||/^\d+$/.test(String(J))?J+"px":J};i!=null&&(this.display.wrapper.style.width=z(i)),r!=null&&(this.display.wrapper.style.height=z(r)),this.options.lineWrapping&&as(this);var $=this.display.viewFrom;this.doc.iter($,this.display.viewTo,function(J){if(J.widgets){for(var ee=0;ee<J.widgets.length;ee++)if(J.widgets[ee].noHScroll){wn(I,$,"widget");break}}++$}),this.curOp.forceUpdate=!0,De(this,"refresh",this)}),operation:function(i){return Ui(this,i)},startOperation:function(){return jn(this)},endOperation:function(){return Wn(this)},refresh:Ai(function(){var i=this.display.cachedTextHeight;Ii(this),this.curOp.forceUpdate=!0,yr(this),_r(this,this.doc.scrollLeft,this.doc.scrollTop),Oa(this.display),(i==null||Math.abs(i-$n(this.display))>.5||this.options.lineWrapping)&&Ea(this),De(this,"refresh",this)}),swapDoc:Ai(function(i){var r=this.doc;return r.cm=null,this.state.selectingText&&this.state.selectingText(),Ds(this,i),yr(this),this.display.input.reset(),_r(this,i.scrollLeft,i.scrollTop),this.curOp.forceScroll=!0,vi(this,"swapDoc",this,r),r}),phrase:function(i){var r=this.options.phrases;return r&&Object.prototype.hasOwnProperty.call(r,i)?r[i]:i},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}},_e(e),e.registerHelper=function(i,r,I){n.hasOwnProperty(i)||(n[i]=e[i]={_global:[]}),n[i][r]=I},e.registerGlobalHelper=function(i,r,I,z){e.registerHelper(i,r,z),n[i]._global.push({pred:I,val:z})}}function Ka(e,t,n,i,r){var I=t,z=n,$=mt(e,t.line),J=r&&e.direction=="rtl"?-n:n;function ee(){var ht=t.line+J;return ht<e.first||ht>=e.first+e.size?!1:(t=new Ve(ht,t.ch,t.sticky),$=mt(e,ht))}function ce(ht){var at;if(i=="codepoint"){var pt=$.text.charCodeAt(t.ch+(i>0?0:-1));isNaN(pt)?at=null:at=new Ve(t.line,Math.max(0,Math.min($.text.length,t.ch+n*(pt>=55296&&pt<56320?2:1))),-n)}else r?at=Ml(e.cm,$,t,n):at=Ua($,t,n);if(at==null)if(!ht&&ee())t=Ba(r,e.cm,$,t.line,J);else return!1;else t=at;return!0}if(i=="char"||i=="codepoint")ce();else if(i=="column")ce(!0);else if(i=="word"||i=="group")for(var ge=null,Re=i=="group",Oe=e.cm&&e.cm.getHelper(t,"wordChars"),Be=!0;!(n<0&&!ce(!Be));Be=!1){var Ke=$.text.charAt(t.ch)||`
`,$e=Pe(Ke,Oe)?"w":Re&&Ke==`
`?"n":!Re||/\s/.test(Ke)?null:"p";if(Re&&!Be&&!$e&&($e="s"),ge&&ge!=$e){n<0&&(n=1,ce(),t.sticky="after");break}if($e&&(ge=$e),n>0&&!ce(!Be))break}var rt=ea(e,t,I,z,!0);return mn(I,rt)&&(rt.hitSide=!0),rt}function Oo(e,t,n,i){var r=e.doc,I=t.left,z;if(i=="page"){var $=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),J=Math.max($-.5*$n(e.display),3);z=(n>0?t.bottom:t.top)+n*J}else i=="line"&&(z=n>0?t.bottom+3:t.top-3);for(var ee;!(ee=va(e,I,z),!ee.outside);){if(n<0?z<=0:z>=r.height){ee.hitSide=!0;break}z+=n*5}return ee}var Xt=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new Y,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};Xt.prototype.init=function(e){var t=this,n=this,i=n.cm,r=n.div=e.lineDiv;Co(r,i.options.spellcheck,i.options.autocorrect,i.options.autocapitalize);function I($){for(var J=$.target;J;J=J.parentNode){if(J==r)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(J.className))break}return!1}Ie(r,"paste",function($){if(!I($)||ze(i,$)||To($,i))return;W<=11&&setTimeout(di(i,function(){return t.updateFromDOM()}),20)}),Ie(r,"compositionstart",function($){t.composing={data:$.data,done:!1}}),Ie(r,"compositionupdate",function($){t.composing||(t.composing={data:$.data,done:!1})}),Ie(r,"compositionend",function($){t.composing&&($.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Ie(r,"touchstart",function(){return n.forceCompositionEnd()}),Ie(r,"input",function(){t.composing||t.readFromDOMSoon()});function z($){if(!I($)||ze(i,$))return;if(i.somethingSelected())sa({lineWise:!1,text:i.getSelections()}),$.type=="cut"&&i.replaceSelection("",null,"cut");else if(i.options.lineWiseCopyCut){var J=So(i);sa({lineWise:!0,text:J.text}),$.type=="cut"&&i.operation(function(){i.setSelections(J.ranges,0,ve),i.replaceSelection("",null,"cut")})}else return;if($.clipboardData){$.clipboardData.clearData();var ee=qi.text.join(`
`);if($.clipboardData.setData("Text",ee),$.clipboardData.getData("Text")==ee){$.preventDefault();return}}var ce=Ao(),ge=ce.firstChild;i.display.lineSpace.insertBefore(ce,i.display.lineSpace.firstChild),ge.value=qi.text.join(`
`);var Re=document.activeElement;H(ge),setTimeout(function(){i.display.lineSpace.removeChild(ce),Re.focus(),Re==r&&n.showPrimarySelection()},50)}Ie(r,"copy",z),Ie(r,"cut",z)},Xt.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Xt.prototype.prepareSelection=function(){var e=ps(this.cm,!1);return e.focus=document.activeElement==this.div,e},Xt.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},Xt.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Xt.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,n=t.doc.sel.primary(),i=n.from(),r=n.to();if(t.display.viewTo==t.display.viewFrom||i.line>=t.display.viewTo||r.line<t.display.viewFrom){e.removeAllRanges();return}var I=oa(t,e.anchorNode,e.anchorOffset),z=oa(t,e.focusNode,e.focusOffset);if(I&&!I.bad&&z&&!z.bad&&Ct(yn(I,z),i)==0&&Ct(vn(I,z),r)==0)return;var $=t.display.view,J=i.line>=t.display.viewFrom&&Ro(t,i)||{node:$[0].measure.map[2],offset:0},ee=r.line<t.display.viewTo&&Ro(t,r);if(!ee){var ce=$[$.length-1].measure,ge=ce.maps?ce.maps[ce.maps.length-1]:ce.map;ee={node:ge[ge.length-1],offset:ge[ge.length-2]-ge[ge.length-3]}}if(!J||!ee){e.removeAllRanges();return}var Re=e.rangeCount&&e.getRangeAt(0),Oe;try{Oe=g(J.node,J.offset,ee.offset,ee.node)}catch(Be){}Oe&&(!M&&t.state.focused?(e.collapse(J.node,J.offset),Oe.collapsed||(e.removeAllRanges(),e.addRange(Oe))):(e.removeAllRanges(),e.addRange(Oe)),Re&&e.anchorNode==null?e.addRange(Re):M&&this.startGracePeriod()),this.rememberSelection()},Xt.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)},Xt.prototype.showMultipleSelections=function(e){E(this.cm.display.cursorDiv,e.cursors),E(this.cm.display.selectionDiv,e.selection)},Xt.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},Xt.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return _(this.div,t)},Xt.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},Xt.prototype.blur=function(){this.div.blur()},Xt.prototype.getField=function(){return this.div},Xt.prototype.supportsTouch=function(){return!0},Xt.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():Ui(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)},Xt.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},Xt.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(l&&m&&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 n=oa(t,e.anchorNode,e.anchorOffset),i=oa(t,e.focusNode,e.focusOffset);n&&i&&Ui(t,function(){Ti(t.doc,Cn(n,i),ve),(n.bad||i.bad)&&(t.curOp.selectionChanged=!0)})},Xt.prototype.pollContent=function(){this.readDOMTimeout!=null&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,t=e.display,n=e.doc.sel.primary(),i=n.from(),r=n.to();if(i.ch==0&&i.line>e.firstLine()&&(i=Ve(i.line-1,mt(e.doc,i.line-1).length)),r.ch==mt(e.doc,r.line).text.length&&r.line<e.lastLine()&&(r=Ve(r.line+1,0)),i.line<t.viewFrom||r.line>t.viewTo-1)return!1;var I,z,$;i.line==t.viewFrom||(I=Un(e,i.line))==0?(z=Pt(t.view[0].line),$=t.view[0].node):(z=Pt(t.view[I].line),$=t.view[I-1].node.nextSibling);var J=Un(e,r.line),ee,ce;if(J==t.view.length-1?(ee=t.viewTo-1,ce=t.lineDiv.lastChild):(ee=Pt(t.view[J+1].line)-1,ce=t.view[J+1].node.previousSibling),!$)return!1;for(var ge=e.doc.splitLines(tu(e,$,ce,z,ee)),Re=zi(e.doc,Ve(z,0),Ve(ee,mt(e.doc,ee).text.length));ge.length>1&&Re.length>1;)if(te(ge)==te(Re))ge.pop(),Re.pop(),ee--;else if(ge[0]==Re[0])ge.shift(),Re.shift(),z++;else break;for(var Oe=0,Be=0,Ke=ge[0],$e=Re[0],rt=Math.min(Ke.length,$e.length);Oe<rt&&Ke.charCodeAt(Oe)==$e.charCodeAt(Oe);)++Oe;for(var ht=te(ge),at=te(Re),pt=Math.min(ht.length-(ge.length==1?Oe:0),at.length-(Re.length==1?Oe:0));Be<pt&&ht.charCodeAt(ht.length-Be-1)==at.charCodeAt(at.length-Be-1);)++Be;if(ge.length==1&&Re.length==1&&z==i.line)for(;Oe&&Oe>i.ch&&ht.charCodeAt(ht.length-Be-1)==at.charCodeAt(at.length-Be-1);)Oe--,Be++;ge[ge.length-1]=ht.slice(0,ht.length-Be).replace(/^\u200b+/,""),ge[0]=ge[0].slice(Oe).replace(/\u200b+$/,"");var St=Ve(z,Oe),Et=Ve(ee,Re.length?te(Re).length-Be:0);if(ge.length>1||ge[0]||Ct(St,Et))return nr(e.doc,ge,St,Et,"+input"),!0},Xt.prototype.ensurePolled=function(){this.forceCompositionEnd()},Xt.prototype.reset=function(){this.forceCompositionEnd()},Xt.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},Xt.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)},Xt.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&Ui(this.cm,function(){return Ii(e.cm)})},Xt.prototype.setUneditable=function(e){e.contentEditable="false"},Xt.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||di(this.cm,za)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},Xt.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},Xt.prototype.onContextMenu=function(){},Xt.prototype.resetPosition=function(){},Xt.prototype.needsContentAttribute=!0;function Ro(e,t){var n=fa(e,t.line);if(!n||n.hidden)return null;var i=mt(e.doc,t.line),r=es(n,i,t.line),I=Ye(i,e.doc.direction),z="left";if(I){var $=et(I,t.ch);z=$%2?"right":"left"}var J=ns(r.map,t.ch,z);return J.offset=J.collapse=="right"?J.end:J.start,J}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function lr(e,t){return t&&(e.bad=!0),e}function tu(e,t,n,i,r){var I="",z=!1,$=e.doc.lineSeparator(),J=!1;function ee(Oe){return function(Be){return Be.id==Oe}}function ce(){z&&(I+=$,J&&(I+=$),z=J=!1)}function ge(Oe){Oe&&(ce(),I+=Oe)}function Re(Oe){if(Oe.nodeType==1){var Be=Oe.getAttribute("cm-text");if(Be){ge(Be);return}var Ke=Oe.getAttribute("cm-marker"),$e;if(Ke){var rt=e.findMarks(Ve(i,0),Ve(r+1,0),ee(+Ke));rt.length&&($e=rt[0].find(0))&&ge(zi(e.doc,$e.from,$e.to).join($));return}if(Oe.getAttribute("contenteditable")=="false")return;var ht=/^(pre|div|p|li|table|br)$/i.test(Oe.nodeName);if(!/^br$/i.test(Oe.nodeName)&&Oe.textContent.length==0)return;ht&&ce();for(var at=0;at<Oe.childNodes.length;at++)Re(Oe.childNodes[at]);/^(pre|p)$/i.test(Oe.nodeName)&&(J=!0),ht&&(z=!0)}else Oe.nodeType==3&&ge(Oe.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(Re(t),t==n);)t=t.nextSibling,J=!1;return I}function oa(e,t,n){var i;if(t==e.display.lineDiv){if(i=e.display.lineDiv.childNodes[n],!i)return lr(e.clipPos(Ve(e.display.viewTo-1)),!0);t=null,n=0}else for(i=t;;i=i.parentNode){if(!i||i==e.display.lineDiv)return null;if(i.parentNode&&i.parentNode==e.display.lineDiv)break}for(var r=0;r<e.display.view.length;r++){var I=e.display.view[r];if(I.node==i)return iu(I,t,n)}}function iu(e,t,n){var i=e.text.firstChild,r=!1;if(!t||!_(i,t))return lr(Ve(Pt(e.line),0),!0);if(t==i&&(r=!0,t=i.childNodes[n],n=0,!t)){var I=e.rest?te(e.rest):e.line;return lr(Ve(Pt(I),I.text.length),r)}var z=t.nodeType==3?t:null,$=t;for(!z&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(z=t.firstChild,n&&(n=z.nodeValue.length));$.parentNode!=i;)$=$.parentNode;var J=e.measure,ee=J.maps;function ce($e,rt,ht){for(var at=-1;at<(ee?ee.length:0);at++)for(var pt=at<0?J.map:ee[at],St=0;St<pt.length;St+=3){var Et=pt[St+2];if(Et==$e||Et==rt){var Dt=Pt(at<0?e.line:e.rest[at]),$t=pt[St]+ht;return(ht<0||Et!=$e)&&($t=pt[St+(ht?1:0)]),Ve(Dt,$t)}}}var ge=ce(z,$,n);if(ge)return lr(ge,r);for(var Re=$.nextSibling,Oe=z?z.nodeValue.length-n:0;Re;Re=Re.nextSibling){if(ge=ce(Re,Re.firstChild,0),ge)return lr(Ve(ge.line,ge.ch-Oe),r);Oe+=Re.textContent.length}for(var Be=$.previousSibling,Ke=n;Be;Be=Be.previousSibling){if(ge=ce(Be,Be.firstChild,-1),ge)return lr(Ve(ge.line,ge.ch+Ke),r);Ke+=Be.textContent.length}}var ii=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new Y,this.hasSelection=!1,this.composing=null};ii.prototype.init=function(e){var t=this,n=this,i=this.cm;this.createField(e);var r=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),u&&(r.style.width="0px"),Ie(r,"input",function(){K&&W>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),Ie(r,"paste",function(z){if(ze(i,z)||To(z,i))return;i.state.pasteIncoming=+new Date,n.fastPoll()});function I(z){if(ze(i,z))return;if(i.somethingSelected())sa({lineWise:!1,text:i.getSelections()});else if(i.options.lineWiseCopyCut){var $=So(i);sa({lineWise:!0,text:$.text}),z.type=="cut"?i.setSelections($.ranges,null,ve):(n.prevInput="",r.value=$.text.join(`
`),H(r))}else return;z.type=="cut"&&(i.state.cutIncoming=+new Date)}Ie(r,"cut",I),Ie(r,"copy",I),Ie(e.scroller,"paste",function(z){if(dn(e,z)||ze(i,z))return;if(!r.dispatchEvent){i.state.pasteIncoming=+new Date,n.focus();return}var $=new Event("paste");$.clipboardData=z.clipboardData,r.dispatchEvent($)}),Ie(e.lineSpace,"selectstart",function(z){dn(e,z)||ne(z)}),Ie(r,"compositionstart",function(){var z=i.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:z,range:i.markText(z,i.getCursor("to"),{className:"CodeMirror-composing"})}}),Ie(r,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},ii.prototype.createField=function(e){this.wrapper=Ao(),this.textarea=this.wrapper.firstChild},ii.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},ii.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,i=ps(e);if(e.options.moveInputWithCursor){var r=Zi(e,n.sel.primary().head,"div"),I=t.wrapper.getBoundingClientRect(),z=t.lineDiv.getBoundingClientRect();i.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,r.top+z.top-I.top)),i.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,r.left+z.left-I.left))}return i},ii.prototype.showSelection=function(e){var t=this.cm,n=t.display;E(n.cursorDiv,e.cursors),E(n.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},ii.prototype.reset=function(e){if(this.contextMenuPending||this.composing)return;var t=this.cm;if(t.somethingSelected()){this.prevInput="";var n=t.getSelection();this.textarea.value=n,t.state.focused&&H(this.textarea),K&&W>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",K&&W>=9&&(this.hasSelection=null))},ii.prototype.getField=function(){return this.textarea},ii.prototype.supportsTouch=function(){return!1},ii.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!a||F()!=this.textarea))try{this.textarea.focus()}catch(e){}},ii.prototype.blur=function(){this.textarea.blur()},ii.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},ii.prototype.receivedFocus=function(){this.slowPoll()},ii.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()})},ii.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function n(){var i=t.poll();!i&&!e?(e=!0,t.polling.set(60,n)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,n)},ii.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,i=this.prevInput;if(this.contextMenuPending||!t.state.focused||dt(n)&&!i&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var r=n.value;if(r==i&&!t.somethingSelected())return!1;if(K&&W>=9&&this.hasSelection===r||o&&/[\uf700-\uf7ff]/.test(r))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var I=r.charCodeAt(0);if(I==8203&&!i&&(i="\u200B"),I==8666)return this.reset(),this.cm.execCommand("undo")}for(var z=0,$=Math.min(i.length,r.length);z<$&&i.charCodeAt(z)==r.charCodeAt(z);)++z;return Ui(t,function(){za(t,r.slice(z),i.length-z,null,e.composing?"*compose":null),r.length>1e3||r.indexOf(`
`)>-1?n.value=e.prevInput="":e.prevInput=r,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},ii.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},ii.prototype.onKeyPress=function(){K&&W>=9&&(this.hasSelection=null),this.fastPoll()},ii.prototype.onContextMenu=function(e){var t=this,n=t.cm,i=n.display,r=t.textarea;t.contextMenuPending&&t.contextMenuPending();var I=Fn(n,e),z=i.scroller.scrollTop;if(!I||p)return;var $=n.options.resetSelectionOnContextMenu;$&&n.doc.sel.contains(I)==-1&&di(n,Ti)(n.doc,Cn(I),ve);var J=r.style.cssText,ee=t.wrapper.style.cssText,ce=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",r.style.cssText=`position: absolute; width: 30px; height: 30px;
top: `+(e.clientY-ce.top-5)+"px; left: "+(e.clientX-ce.left-5)+`px;
z-index: 1000; background: `+(K?"rgba(255, 255, 255, .05)":"transparent")+`;
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var ge;P&&(ge=window.scrollY),i.input.focus(),P&&window.scrollTo(null,ge),i.input.reset(),n.somethingSelected()||(r.value=t.prevInput=" "),t.contextMenuPending=Oe,i.selForContextMenu=n.doc.sel,clearTimeout(i.detectingSelectAll);function Re(){if(r.selectionStart!=null){var Ke=n.somethingSelected(),$e="\u200B"+(Ke?r.value:"");r.value="\u21DA",r.value=$e,t.prevInput=Ke?"":"\u200B",r.selectionStart=1,r.selectionEnd=$e.length,i.selForContextMenu=n.doc.sel}}function Oe(){if(t.contextMenuPending!=Oe)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=ee,r.style.cssText=J,K&&W<9&&i.scrollbars.setScrollTop(i.scroller.scrollTop=z),r.selectionStart!=null){(!K||K&&W<9)&&Re();var Ke=0,$e=function(){i.selForContextMenu==n.doc.sel&&r.selectionStart==0&&r.selectionEnd>0&&t.prevInput=="\u200B"?di(n,Vs)(n):Ke++<10?i.detectingSelectAll=setTimeout($e,500):(i.selForContextMenu=null,i.input.reset())};i.detectingSelectAll=setTimeout($e,200)}}if(K&&W>=9&&Re(),O){me(e);var Be=function(){nt(window,"mouseup",Be),setTimeout(Oe,20)};Ie(window,"mouseup",Be)}else setTimeout(Oe,50)},ii.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},ii.prototype.setUneditable=function(){},ii.prototype.needsContentAttribute=!1;function nu(e,t){if(t=t?y(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 n=F();t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}function i(){e.value=$.getValue()}var r;if(e.form&&(Ie(e.form,"submit",i),!t.leaveSubmitMethodAlone)){var I=e.form;r=I.submit;try{var z=I.submit=function(){i(),I.submit=r,I.submit(),I.submit=z}}catch(J){}}t.finishInit=function(J){J.save=i,J.getTextArea=function(){return e},J.toTextArea=function(){J.toTextArea=isNaN,i(),e.parentNode.removeChild(J.getWrapperElement()),e.style.display="",e.form&&(nt(e.form,"submit",i),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=r))}},e.style.display="none";var $=Zt(function(J){return e.parentNode.insertBefore(J,e.nextSibling)},t);return $}function ru(e){e.off=nt,e.on=Ie,e.wheelEventPixels=dl,e.Doc=ki,e.splitLines=wt,e.countColumn=G,e.findColumn=pe,e.isWordChar=Le,e.Pass=we,e.signal=De,e.Line=Mn,e.changeEnd=An,e.scrollbarModel=xs,e.Pos=Ve,e.cmpPos=Ct,e.modes=Lt,e.mimeModes=Je,e.resolveMode=Qe,e.getMode=yt,e.modeExtensions=It,e.extendMode=kt,e.copyState=Jt,e.startState=en,e.innerMode=Si,e.commands=Pr,e.keyMap=cn,e.keyName=lo,e.isModifierKey=so,e.lookupKey=ar,e.normalizeKeyMap=Dl,e.StringStream=jt,e.SharedTextMarker=kr,e.TextMarker=Rn,e.LineWidget=Ir,e.e_preventDefault=ne,e.e_stopPropagation=re,e.e_stop=me,e.addClass=D,e.contains=_,e.rmClass=x,e.keyNames=Ln}$l(Zt),ql(Zt);var au="iter insert remove copy getEditor constructor".split(" ");for(var la in ki.prototype)ki.prototype.hasOwnProperty(la)&&ie(au,la)<0&&(Zt.prototype[la]=function(e){return function(){return e.apply(this.doc,arguments)}}(ki.prototype[la]));return _e(ki),Zt.inputStyles={textarea:ii,contenteditable:Xt},Zt.defineMode=function(e){!Zt.defaults.mode&&e!="null"&&(Zt.defaults.mode=e),li.apply(this,arguments)},Zt.defineMIME=mi,Zt.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Zt.defineMIME("text/plain","null"),Zt.defineExtension=function(e,t){Zt.prototype[e]=t},Zt.defineDocExtension=function(e,t){ki.prototype[e]=t},Zt.fromTextArea=nu,ru(Zt),Zt.version="5.58.2",Zt})},Y1PL:function(_t,ot,le){"use strict";le.r(ot),le.d(ot,"ResizableTextArea",function(){return ie});var ue=le("wx14"),Z=le("1OyB"),M=le("vuIU"),Q=le("Ji7U"),B=le("LK+K"),N=le("q1tI"),K=le("VTBJ"),W=le("rePB"),P=le("Zm9Q"),R=le("Kwbf"),m=le("c+Xe"),p=le("m+aA"),f=le("bdgK"),h=new Map;function s(ve){ve.forEach(function(Se){var Ce,pe=Se.target;(Ce=h.get(pe))===null||Ce===void 0||Ce.forEach(function(fe){return fe(pe)})})}var u=new f.default(s),l=null,a=null;function o(ve,Se){h.has(ve)||(h.set(ve,new Set),u.observe(ve)),h.get(ve).add(Se)}function c(ve,Se){h.has(ve)&&(h.get(ve).delete(Se),h.get(ve).size||(u.unobserve(ve),h.delete(ve)))}var L=function(ve){Object(Q.a)(Ce,ve);var Se=Object(B.a)(Ce);function Ce(){return Object(Z.a)(this,Ce),Se.apply(this,arguments)}return Object(M.a)(Ce,[{key:"render",value:function(){return this.props.children}}]),Ce}(N.Component),w=N.createContext(null);function T(ve){var Se=ve.children,Ce=ve.onBatchResize,pe=N.useRef(0),fe=N.useRef([]),oe=N.useContext(w),te=N.useCallback(function(he,ae,Ae){pe.current+=1;var ke=pe.current;fe.current.push({size:he,element:ae,data:Ae}),Promise.resolve().then(function(){ke===pe.current&&(Ce==null||Ce(fe.current),fe.current=[])}),oe==null||oe(he,ae,Ae)},[Ce,oe]);return N.createElement(w.Provider,{value:te},Se)}function O(ve){var Se=ve.children,Ce=ve.disabled,pe=N.useRef(null),fe=N.useRef(null),oe=N.useContext(w),te=N.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),he=N.isValidElement(Se)&&Object(m.c)(Se),ae=he?Se.ref:null,Ae=N.useMemo(function(){return Object(m.a)(ae,pe)},[ae,pe]),ke=N.useRef(ve);ke.current=ve;var Te=N.useCallback(function(Le){var Pe=ke.current,He=Pe.onResize,Fe=Pe.data,Ue=Le.getBoundingClientRect(),Ne=Ue.width,Ze=Ue.height,st=Le.offsetWidth,tt=Le.offsetHeight,et=Math.floor(Ne),ut=Math.floor(Ze);if(te.current.width!==et||te.current.height!==ut||te.current.offsetWidth!==st||te.current.offsetHeight!==tt){var Ye={width:et,height:ut,offsetWidth:st,offsetHeight:tt};te.current=Ye;var Xe=st===Math.round(Ne)?Ne:st,Ie=tt===Math.round(Ze)?Ze:tt,lt=Object(K.a)(Object(K.a)({},Ye),{},{offsetWidth:Xe,offsetHeight:Ie});oe==null||oe(lt,Le,Fe),He&&Promise.resolve().then(function(){He(lt,Le)})}},[]);return N.useEffect(function(){var Le=Object(p.a)(pe.current)||Object(p.a)(fe.current);return Le&&!Ce&&o(Le,Te),function(){return c(Le,Te)}},[pe.current,Ce]),N.createElement(L,{ref:fe},he?N.cloneElement(Se,{ref:Ae}):Se)}var A="rc-observer-key";function x(ve){var Se=ve.children,Ce=Object(P.a)(Se);return Ce.map(function(pe,fe){var oe=(pe==null?void 0:pe.key)||"".concat(A,"-").concat(fe);return N.createElement(O,Object(ue.a)({},ve,{key:oe}),pe)})}x.Collection=T;var S=x,E=le("bT9E"),d=le("TSYQ"),b=le.n(d),g=`
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
`,_=["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"],F={},D;function j(ve){var Se=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Ce=ve.getAttribute("id")||ve.getAttribute("data-reactid")||ve.getAttribute("name");if(Se&&F[Ce])return F[Ce];var pe=window.getComputedStyle(ve),fe=pe.getPropertyValue("box-sizing")||pe.getPropertyValue("-moz-box-sizing")||pe.getPropertyValue("-webkit-box-sizing"),oe=parseFloat(pe.getPropertyValue("padding-bottom"))+parseFloat(pe.getPropertyValue("padding-top")),te=parseFloat(pe.getPropertyValue("border-bottom-width"))+parseFloat(pe.getPropertyValue("border-top-width")),he=_.map(function(Ae){return"".concat(Ae,":").concat(pe.getPropertyValue(Ae))}).join(";"),ae={sizingStyle:he,paddingSize:oe,borderSize:te,boxSizing:fe};return Se&&Ce&&(F[Ce]=ae),ae}function H(ve){var Se=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Ce=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,pe=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;D||(D=document.createElement("textarea"),D.setAttribute("tab-index","-1"),D.setAttribute("aria-hidden","true"),document.body.appendChild(D)),ve.getAttribute("wrap")?D.setAttribute("wrap",ve.getAttribute("wrap")):D.removeAttribute("wrap");var fe=j(ve,Se),oe=fe.paddingSize,te=fe.borderSize,he=fe.boxSizing,ae=fe.sizingStyle;D.setAttribute("style","".concat(ae,";").concat(g)),D.value=ve.value||ve.placeholder||"";var Ae=Number.MIN_SAFE_INTEGER,ke=Number.MAX_SAFE_INTEGER,Te=D.scrollHeight,Le;if(he==="border-box"?Te+=te:he==="content-box"&&(Te-=oe),Ce!==null||pe!==null){D.value=" ";var Pe=D.scrollHeight-oe;Ce!==null&&(Ae=Pe*Ce,he==="border-box"&&(Ae=Ae+oe+te),Te=Math.max(Ae,Te)),pe!==null&&(ke=Pe*pe,he==="border-box"&&(ke=ke+oe+te),Le=Te>ke?"":"hidden",Te=Math.min(ke,Te))}return{height:Te,minHeight:Ae,maxHeight:ke,overflowY:Le,resize:"none"}}var k=le("Gytx"),y=le.n(k),G;(function(ve){ve[ve.NONE=0]="NONE",ve[ve.RESIZING=1]="RESIZING",ve[ve.RESIZED=2]="RESIZED"})(G||(G={}));var Y=function(ve){Object(Q.a)(Ce,ve);var Se=Object(B.a)(Ce);function Ce(pe){var fe;return Object(Z.a)(this,Ce),fe=Se.call(this,pe),fe.nextFrameActionId=void 0,fe.resizeFrameId=void 0,fe.textArea=void 0,fe.saveTextArea=function(oe){fe.textArea=oe},fe.handleResize=function(oe){var te=fe.state.resizeStatus,he=fe.props,ae=he.autoSize,Ae=he.onResize;if(te!==G.NONE)return;typeof Ae=="function"&&Ae(oe),ae&&fe.resizeOnNextFrame()},fe.resizeOnNextFrame=function(){cancelAnimationFrame(fe.nextFrameActionId),fe.nextFrameActionId=requestAnimationFrame(fe.resizeTextarea)},fe.resizeTextarea=function(){var oe=fe.props.autoSize;if(!oe||!fe.textArea)return;var te=oe.minRows,he=oe.maxRows,ae=H(fe.textArea,!1,te,he);fe.setState({textareaStyles:ae,resizeStatus:G.RESIZING},function(){cancelAnimationFrame(fe.resizeFrameId),fe.resizeFrameId=requestAnimationFrame(function(){fe.setState({resizeStatus:G.RESIZED},function(){fe.resizeFrameId=requestAnimationFrame(function(){fe.setState({resizeStatus:G.NONE}),fe.fixFirefoxAutoScroll()})})})})},fe.renderTextArea=function(){var oe=fe.props,te=oe.prefixCls,he=te===void 0?"rc-textarea":te,ae=oe.autoSize,Ae=oe.onResize,ke=oe.className,Te=oe.disabled,Le=fe.state,Pe=Le.textareaStyles,He=Le.resizeStatus,Fe=Object(E.a)(fe.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Ue=b()(he,ke,Object(W.a)({},"".concat(he,"-disabled"),Te));"value"in Fe&&(Fe.value=Fe.value||"");var Ne=Object(K.a)(Object(K.a)(Object(K.a)({},fe.props.style),Pe),He===G.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return N.createElement(S,{onResize:fe.handleResize,disabled:!(ae||Ae)},N.createElement("textarea",Object(ue.a)({},Fe,{className:Ue,style:Ne,ref:fe.saveTextArea})))},fe.state={textareaStyles:{},resizeStatus:G.NONE},fe}return Object(M.a)(Ce,[{key:"componentDidUpdate",value:function(fe){(fe.value!==this.props.value||!y()(fe.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 fe=this.textArea.selectionStart,oe=this.textArea.selectionEnd;this.textArea.setSelectionRange(fe,oe)}}catch(te){}}},{key:"render",value:function(){return this.renderTextArea()}}]),Ce}(N.Component),ie=Y,se=function(ve){Object(Q.a)(Ce,ve);var Se=Object(B.a)(Ce);function Ce(pe){var fe;Object(Z.a)(this,Ce),fe=Se.call(this,pe),fe.resizableTextArea=void 0,fe.focus=function(){fe.resizableTextArea.textArea.focus()},fe.saveTextArea=function(te){fe.resizableTextArea=te},fe.handleChange=function(te){var he=fe.props.onChange;fe.setValue(te.target.value,function(){fe.resizableTextArea.resizeTextarea()}),he&&he(te)},fe.handleKeyDown=function(te){var he=fe.props,ae=he.onPressEnter,Ae=he.onKeyDown;te.keyCode===13&&ae&&ae(te),Ae&&Ae(te)};var oe=typeof pe.value=="undefined"||pe.value===null?pe.defaultValue:pe.value;return fe.state={value:oe},fe}return Object(M.a)(Ce,[{key:"setValue",value:function(fe,oe){"value"in this.props||this.setState({value:fe},oe)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return N.createElement(ie,Object(ue.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(fe){return"value"in fe?{value:fe.value}:null}}]),Ce}(N.Component),we=ot.default=se},ZW9T:function(_t,ot,le){"use strict";le.d(ot,"a",function(){return H});var ue=le("k1fw"),Z=le("miYZ"),M=le("tsqr"),Q=le("rAM+"),B=le("tJVT"),N=le("PpiC"),K=le("q1tI"),W=le.n(K),P=le("bdgK"),R=le("oBTY"),m=le("9og8"),p=le("WmNS"),f=le.n(p),h={keywords:["print","auto","break","case","char","const","continue","default","do","double","else","enum","extern","float","for","goto","if","int","long","register","return","short","signed","sizeof","static","struct","switch","typedef","union","unsigned","void","volatile","while"]},s={quickKey:[{label:"main",content:["public static void main(String[] args) {"," $0","}"].join(`
`)},{label:"System.out.println",content:["System.out.println($0)"].join(`
`)},{label:"System.out.print",content:["System.out.print($0)"].join(`
`)}],keywords:["abstract","continue","for","new","switch","assert","default","goto","package","synchronized","boolean","do","if","private","this","break","double","implements","protected","throw","byte","else","import","public","throws","case","enum","instanceof","return","transient","catch","extends","int","short","try","char","final","interface","static","void","class","finally","long","strictfp","volatile","const","float","native","super","while","true","false"]},u={keywords:["abstract","amp","array","auto","bool","break","case","catch","char","class","const","constexpr","const_cast","continue","cpu","decltype","default","delegate","delete","do","double","dynamic_cast","each","else","enum","event","explicit","export","extern","false","final","finally","float","for","friend","gcnew","generic","goto","if","in","initonly","inline","int","interface","interior_ptr","internal","literal","long","mutable","namespace","new","noexcept","nullptr","__nullptr","operator","override","partial","pascal","pin_ptr","private","property","protected","public","ref","register","reinterpret_cast","restrict","return","safe_cast","sealed","short","signed","sizeof","static","static_assert","static_cast","struct","switch","template","this","thread_local","throw","tile_static","true","try","typedef","typeid","typename","union","unsigned","using","virtual","void","volatile","wchar_t","where","while","_asm","_based","_cdecl","_declspec","_fastcall","_if_exists","_if_not_exists","_inline","_multiple_inheritance","_pascal","_single_inheritance","_stdcall","_virtual_inheritance","_w64","__abstract","__alignof","__asm","__assume","__based","__box","__builtin_alignof","__cdecl","__clrcall","__declspec","__delegate","__event","__except","__fastcall","__finally","__forceinline","__gc","__hook","__identifier","__if_exists","__if_not_exists","__inline","__int128","__int16","__int32","__int64","__int8","__interface","__leave","__m128","__m128d","__m128i","__m256","__m256d","__m256i","__m64","__multiple_inheritance","__newslot","__nogc","__noop","__nounwind","__novtordisp","__pascal","__pin","__pragma","__property","__ptr32","__ptr64","__raise","__restrict","__resume","__sealed","__single_inheritance","__stdcall","__super","__thiscall","__try","__try_cast","__typeof","__unaligned","__unhook","__uuidof","__value","__virtual_inheritance","__w64","__wchar_t"],operators:["=",">","<","!","~","?",":","==","<=",">=","!=","&&","||","++","--","+","-","*","/","&","|","^","%","<<",">>",">>>","+=","-=","*=","/=","&=","|=","^=","%=","<<=",">>=",">>>="],quickKey:[{label:"ifelse",content:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
`)},{label:"#include",content:'include "$0"'},{label:"printf",content:"printf($0)"},{label:"main",content:["int main () {"," $0","}"].join(`
`)},{label:"for",content:["for( ; ; ){"," $0","}"].join(`
`)},{label:"trycatch",content:["try{"," $0","}catch(ExceptionName e){","}"].join(`
`)},{label:"using namespace std;",content:["using namespace std;"].join(`
`)},{label:"#include <iostream>",content:["#include <iostream>"].join(`
`)},{label:"#include <vector>",content:["#include <vector>"].join(`
`)},{label:"#include <sstream>",content:["#include <sstream>"].join(`
`)},{label:"#include <string>",content:["#include <string>"].join(`
`)},{label:"#include <cmath>",content:["#include <cmath>"].join(`
`)}]},l={keywords:["and","as","assert","break","class","continue","def","del","elif","else","except","exec","finally","for","from","global","if","import","in","is","lambda","None","not","or","pass","raise","return","self","try","while","with","yield","int","float","long","complex","hex","abs","all","any","apply","basestring","bin","bool","buffer","bytearray","callable","chr","classmethod","cmp","coerce","compile","complex","delattr","dict","dir","divmod","enumerate","eval","execfile","file","filter","format","frozenset","getattr","globals","hasattr","hash","help","id","input","intern","isinstance","issubclass","iter","len","locals","list","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","reversed","range","raw_input","reduce","reload","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","unichr","unicode","vars","xrange","zip","True","False","__dict__","__methods__","__members__","__class__","__bases__","__name__","__mro__","__subclasses__","__init__","__import__"],quickKey:[{label:"print",content:["print($0)"].join(`
`)}]},a=le("5VLF"),o=le.n(a),c={languages:["c","abap","apex","azcli","bat","cameligo","clojure","coffee","cpp","csharp","csp","css","dockerfile","fsharp","go","graphql","handlebars","html","ini","java","javascript","json","kotlin","less","lua","markdown","mips","msdax","mysql","objective-c","pascal","pascaligo","perl","pgsql","php","postiats","powerquery","powershell","pug","python","r","razor","redis","redshift","restructuredtext","ruby","rust","sb","scheme","scss","shell","solidity","sophia","sql","st","swift","tcl","twig","vb","xml","yaml'"],tables:{users:["name","id","email","phone","password"],roles:["id","name","order","created_at","updated_at","deleted_at"]}},L=function(y,G){return G.map(function(Y){return{label:Y,kind:y.languages.CompletionItemKind.Keyword,insertText:Y}})},w=function(y){return Object.keys(c.tables).map(function(G){return{label:G,kind:y.languages.CompletionItemKind.Variable,insertText:G}})},T=function(y,G){var Y=c.tables[y];return Y?Y.map(function(ie){return{label:ie,kind:G.languages.CompletionItemKind.Field,insertText:ie}}):[]};function O(k,y,G,Y,ie){var se=y.getWordUntilPosition(G),we={startLineNumber:G.lineNumber,endLineNumber:G.lineNumber,startColumn:se.startColumn,endColumn:se.endColumn},ve=Y.map(function(Se){return{label:Se,kind:k.languages.CompletionItemKind.Keyword,insertText:Se,insertTextRules:k.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:we}});return ie.map(function(Se){ve.push(Object(ue.a)(Object(ue.a)({},Se),{},{range:we}))}),ve}var A=function(k){c.languages.map(function(ie){return k.languages.registerDocumentFormattingEditProvider(ie,{provideDocumentFormattingEdits:function(we,ve,Se){return Object(m.a)(f.a.mark(function Ce(){var pe;return f.a.wrap(function(oe){for(;;)switch(oe.prev=oe.next){case 0:return pe=o()(we.getValue(),{indent_size:"2",indent_char:" ",max_preserve_newlines:"2",preserve_newlines:!0,keep_array_indentation:!0,break_chained_methods:!1,indent_scripts:"normal",brace_style:"collapse",space_before_conditional:!0,unescape_strings:!1,jslint_happy:!1,end_with_newline:!0,wrap_line_length:"0",indent_inner_html:!1,comma_first:!1,e4x:!1,indent_empty_lines:!1}),oe.abrupt("return",[{range:we.getFullModelRange(),text:pe}]);case 2:case"end":return oe.stop()}},Ce)}))()}}),ie});var y=u.quickKey.map(function(ie){return{label:ie.label,kind:k.languages.CompletionItemKind.Method,insertText:ie.content,insertTextRules:k.languages.CompletionItemInsertTextRule.InsertAsSnippet}}),G=l.quickKey.map(function(ie){return{label:ie.label,kind:k.languages.CompletionItemKind.Method,insertText:ie.content,insertTextRules:k.languages.CompletionItemInsertTextRule.InsertAsSnippet}}),Y=s.quickKey.map(function(ie){return{label:ie.label,kind:k.languages.CompletionItemKind.Method,insertText:ie.content,insertTextRules:k.languages.CompletionItemInsertTextRule.InsertAsSnippet}});k.languages.registerCompletionItemProvider("cpp",{triggerCharacters:["."," ","#"].concat(Object(R.a)(u.keywords),Object(R.a)(u.quickKey.map(function(ie){return ie.label}))),provideCompletionItems:function(se,we){var ve=se.getValueInRange({startLineNumber:we.lineNumber,startColumn:1,endLineNumber:we.lineNumber,endColumn:we.column}),Se=ve.match(/cu/gim);console.log("match:",Se,we,ve,se);var Ce=[],pe=we.lineNumber,fe=we.column,oe=se.getValueInRange({startLineNumber:pe,startColumn:0,endLineNumber:pe,endColumn:fe}),te=oe.trim().split(/\s+/),he=te[te.length-1];if(he.endsWith(".")){var ae=he.slice(0,he.length-1);Object.keys(c.tables).includes(ae)&&(Ce=Object(R.a)(T(ae,k)))}else he==="."?Ce=[]:Ce=[].concat(Object(R.a)(w(k)),Object(R.a)(L(k,u.keywords)),Object(R.a)(y));return{suggestions:Ce}}}),k.languages.registerCompletionItemProvider("c",{triggerCharacters:["."," ","#"].concat(Object(R.a)(h.keywords)),provideCompletionItems:function(se,we){var ve=se.getValueInRange({startLineNumber:we.lineNumber,startColumn:1,endLineNumber:we.lineNumber,endColumn:we.column}),Se=ve.match(/cu/gim);console.log("match:",Se,we,ve,se);var Ce=[],pe=we.lineNumber,fe=we.column,oe=se.getValueInRange({startLineNumber:pe,startColumn:0,endLineNumber:pe,endColumn:fe}),te=oe.trim().split(/\s+/),he=te[te.length-1];if(he.endsWith(".")){var ae=he.slice(0,he.length-1);Object.keys(c.tables).includes(ae)&&(Ce=Object(R.a)(T(ae,k)))}else he==="."?Ce=[]:Ce=[].concat(Object(R.a)(w(k)),Object(R.a)(L(k,h.keywords)));return{suggestions:Ce}}}),k.languages.registerCompletionItemProvider("java",{triggerCharacters:["."," "].concat(Object(R.a)(s.keywords)),provideCompletionItems:function(se,we){var ve=[],Se=we.lineNumber,Ce=we.column,pe=se.getValueInRange({startLineNumber:Se,startColumn:0,endLineNumber:Se,endColumn:Ce}),fe=pe.trim().split(/\s+/),oe=fe[fe.length-1];if(oe.endsWith(".")){var te=oe.slice(0,oe.length-1);Object.keys(c.tables).includes(te)&&(ve=Object(R.a)(T(te,k)))}else oe==="."?ve=[]:ve=[].concat(Object(R.a)(w(k)),Object(R.a)(L(k,s.keywords)),Object(R.a)(Y));return{suggestions:ve}}}),k.languages.registerCompletionItemProvider("python",{triggerCharacters:["."," "].concat(Object(R.a)(l.keywords)),provideCompletionItems:function(se,we){var ve=[],Se=we.lineNumber,Ce=we.column,pe=se.getValueInRange({startLineNumber:Se,startColumn:0,endLineNumber:Se,endColumn:Ce}),fe=pe.trim().split(/\s+/),oe=fe[fe.length-1];if(oe.endsWith(".")){var te=oe.slice(0,oe.length-1);Object.keys(c.tables).includes(te)&&(ve=Object(R.a)(T(te,k)))}else oe==="."?ve=[]:ve=[].concat(Object(R.a)(w(k)),Object(R.a)(L(k,l.keywords)),Object(R.a)(G));return{suggestions:ve}}})},x="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",S=le("LvDl"),E=le("+ua5");function d(k){return/^\d+$/.test(k)?"".concat(k,"px"):k}function b(){}var g=!1,_={"Python3.6":"python","Python2.7":"python",Dynamips:"cpp",Java:"java",Web:"php",Html:"html",Hive:"sql",Hadoop:"java",SDL:"cpp",PHP:"php",Matlab:"python",Git:"python",Python:"python","C/C++":"cpp","C++":"cpp",C:"cpp",Ruby:"ruby",Shell:"shell",JavaScript:"javascript",Perl6:"perl",Kotlin:"kotlin",Elixir:"elixir",Android:"java",JavaWeb:"java",Go:"go",Spark:"sql",MachineLearning:"python",Verilog:"xml","Verilog/VNC":"xml",Docker:"dockerfile","C#":"csharp",SQLite3:"sql",Oracle:"sql",Vhdl:"vhdl",R:"r",Swift:"swift",SQLServer:"mysql",MySQL:"mysql",Mongo:"sql",PostgreSql:"pgsql",Hbase:"powershell",Sqoop:"sql",Nasm:"cpp",Kafka:"java",Flink:"java",Sml:"javascript",OpenGL:"cpp",Perl5:"perl",Orange:"python"};function F(){var k=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],y=k;if(Array.isArray(k)){for(var G=0;G<k.length;G++){var Y=_[k[G]];if(Y)return Y}return y[0]}return _[y]||y}var D=null,j=ot.b=function(k){var y=k.width,G=y===void 0?"100%":y,Y=k.height,ie=Y===void 0?"100%":Y,se=k.value,we=k.language,ve=we===void 0?"javascript":we,Se=k.style,Ce=Se===void 0?{}:Se,pe=k.options,fe=pe===void 0?{}:pe,oe=k.overrideServices,te=oe===void 0?{}:oe,he=k.theme,ae=he===void 0?"vs-dark":he,Ae=k.onEditBlur,ke=k.onSave,Te=k.autoHeight,Le=Te===void 0?!1:Te,Pe=k.forbidCopy,He=Pe===void 0?!1:Pe,Fe=k.onChange,Ue=Fe===void 0?b:Fe,Ne=k.editorDidMount,Ze=Ne===void 0?b:Ne,st=k.onFocus,tt=st===void 0?b:st,et=k.filename,ut=et===void 0?"educoder.txt":et,Ye=k.errorLine,Xe=k.errorContent,Ie=Xe===void 0?"":Xe,lt=Object(N.a)(k,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename","errorLine","errorContent"]),nt=Object(K.useRef)(),De=Object(K.useRef)({}),ze=Object(K.useRef)(),xe=Object(K.useRef)(!1),ye=Object(K.useRef)(),_e=Object(K.useState)(!1),ne=Object(B.a)(_e,2),re=ne[0],de=ne[1];function me(){var Qe;return nt.current&&(Qe=new P.default(function(yt){var It=Object(Q.a)(yt),kt;try{for(It.s();!(kt=It.n()).done;){var Jt=kt.value;(Jt.target.offsetHeight>0||Jt.target.offsetWidth>0)&&De.current.instance.layout()}}catch(Si){It.e(Si)}finally{It.f()}}),Qe.observe(nt.current)),Qe}function Ee(){M.b.warn(decodeURIComponent(x))}var Me=function(){var yt=De.current.instance;if(se!=null&&yt&&re){var It=yt.getModel();It&&se!==It.getValue()&&(g=!0,It.setValue(se),yt.layout(),g=!1)}};Object(K.useEffect)(function(){ze.current&&clearTimeout(ze.current),ze.current=setTimeout(function(){Me()},500)},[se,re,De.current]),Object(K.useEffect)(function(){if(Ye&&De.current&&De.current.instance){var Qe=De.current.instance;Qe.changeViewZones(function(It){var kt=document.createElement("div");kt.style.padding="10px 20px",kt.style.width="calc(100% - 20px)",kt.className="my-error-line-wrp",kt.innerHTML=Ie,It.addZone({afterLineNumber:Ye||11,heightInLines:3,domNode:kt})});var yt={domNode:null,getId:function(){return"my.overlay.widget"},getDomNode:function(){return this.domNode||(this.domNode=document.createElement("div"),this.domNode.innerHTML="",this.domNode.style.width="100%",this.domNode.style.padding="20px 100px",this.domNode.style.right="0px",this.domNode.style.top="50px",this.domNode.style.position="relative",this.domNode.style.color="#333"),this.domNode},getPosition:function(){return null}};Qe.addOverlayWidget(yt),Qe.revealPositionInCenter({lineNumber:20,column:1})}},[Ye,De.current,re]);function je(){var Qe=De.current.instance;if(Qe){var yt=Qe.getSelection(),It=De.current.pastePos||{},kt=new D.Range(It.startLineNumber||yt.endLineNumber,It.startColumn||yt.endColumn,It.endLineNumber||yt.endLineNumber,It.endColumn||yt.endColumn);setTimeout(function(){Qe.executeEdits("",[{range:kt,text:""}])},300)}}function it(Qe){(window.navigator.platform.match("Mac")?Qe.metaKey:Qe.ctrlKey)&&Qe.keyCode==83&&(Qe.preventDefault(),ke())}var ft=function(){if(Le&&De.current.instance){var yt=De.current.instance.getContentHeight();li(yt<ie?ie:yt)}else li(ie)};function ct(Qe){var yt=document.createEvent("MouseEvents");yt.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),Qe.dispatchEvent(yt)}function At(Qe,yt){var It=window.URL||window.webkitURL||window,kt=new Blob([yt]),Jt=document.createElementNS("http://www.w3.org/1999/xhtml","a");Jt.href=It.createObjectURL(kt),Jt.download=Qe,ct(Jt)}Object(K.useEffect)(function(){ft()},[ft]),Object(K.useEffect)(function(){nt.current&&!re&&le.e(27).then(le.t.bind(null,"M/lh",7)).then(function(Qe){try{D=Qe,De.current.instance=D.editor.create(nt.current,{value:se,language:F(ve),theme:ae,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0},te);var yt=De.current.instance;if(Ze(yt,D),setTimeout(function(){ft(),De.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){At(ut||"educoder.txt",yt.getValue())}})},500),De.current.subscription=yt.onDidChangeModelContent(function(kt){xe.current?clearTimeout(ye.current):(ft(),Ue(yt.getValue(),kt)),ye.current=setTimeout(function(){xe.current=!1},500)}),window.Monaco||A(D),He&&(yt.addCommand(D.KeyMod.CtrlCmd|D.KeyMod.Shift|D.KeyCode.KEY_V,function(){return Ee(),null}),yt.addCommand(D.KeyMod.CtrlCmd|D.KeyCode.KEY_C,function(){return Ee(),null})),window.Monaco=D,Ae&&yt.onDidBlurEditorWidget(function(){Ae(yt.getValue())}),tt&&yt.onDidFocusEditorText(function(){tt(yt.getValue())}),He){yt.addCommand(D.KeyMod.CtrlCmd|D.KeyCode.KEY_V,function(){return Ee(),null}),yt.onDidPaste(function(kt){De.current.pastePos=kt});try{window.addEventListener("paste",je)}catch(kt){}}var It=me();return de(!0),function(){var kt=De.current.instance;kt.dispose();var Jt=kt.getModel();Jt&&Jt.dispose(),De.current.subscription&&De.current.subscription.dispose(),He&&window.removeEventListener("paste",je),It.unobserve(nt.current)}}catch(kt){}})},[]),Object(K.useEffect)(function(){var Qe=De.current.instance;if(Qe&&re)return document.addEventListener("keydown",it,!1),function(){document.removeEventListener("keydown",it)}},[ke,re]),Object(K.useEffect)(function(){var Qe=De.current.instance;if(Qe&&re){var yt=F(ve);D.editor.setModelLanguage(Qe.getModel(),yt),console.log("language:",ve,Qe.getModel(),yt)}},[ve,re]),Object(K.useEffect)(function(){var Qe=De.current.instance;Qe&&re&&D.editor.setTheme(ae)},[ae,re]),Object(K.useEffect)(function(){var Qe=De.current.instance;Qe&&re&&(Qe.updateOptions(Object(ue.a)({},fe)),setTimeout(function(){Qe.getModel().updateOptions(Object(ue.a)({},fe))},200))},[JSON.stringify(fe),re]),Object(K.useEffect)(function(){var Qe=De.current.instance;Qe&&re&&Qe.layout()},[G,ie,re]);var wt=Object(K.useState)(d(G)),dt=Object(B.a)(wt,2),Ut=dt[0],vt=dt[1],Rt=Object(K.useState)(d(ie)),Lt=Object(B.a)(Rt,2),Je=Lt[0],li=Lt[1],mi=Object(ue.a)(Object(ue.a)({},Ce),{},{width:Ut,height:Je});return W.a.createElement("div",{className:"my-monaco-editor",ref:nt,style:mi})};function H(k){var y=k.width,G=y===void 0?"100%":y,Y=k.height,ie=Y===void 0?"100%":Y,se=k.original,we=k.modified,ve=k.language,Se=k.options,Ce=Se===void 0?{}:Se,pe=Object(K.useRef)(),fe=Object(K.useState)(null),oe=Object(B.a)(fe,2),te=oe[0],he=oe[1];function ae(Le){var Pe;return pe.current&&(Pe=new P.default(function(He){var Fe=Object(Q.a)(He),Ue;try{for(Fe.s();!(Ue=Fe.n()).done;){var Ne=Ue.value;(Ne.target.offsetHeight>0||Ne.target.offsetWidth>0)&&Le.layout()}}catch(Ze){Fe.e(Ze)}finally{Fe.f()}}),Pe.observe(pe.current)),Pe}Object(K.useEffect)(function(){pe.current&&le.e(27).then(le.t.bind(null,"M/lh",7)).then(function(Le){D=Le;var Pe=D.editor.createDiffEditor(pe.current,Object(ue.a)(Object(ue.a)({enableSplitViewResizing:!1,scrollBeyondLastLine:!1,roundedSelection:!1,renderIndicators:!1,useShadows:!1,horizontal:"hidden",lineNumbers:"off",ignoreTrimWhitespace:!1,followsCaret:!0,ignoreCharChanges:!0,minimap:{enabled:!1},readOnly:!0},Ce),{},{wordWrap:!0}));he(Pe);var He=ae(Pe);return function(){Pe.dispose();var Fe=Pe.getModel();Fe&&Fe.dispose(),He.unobserve(pe.current)}})},[]),Object(K.useEffect)(function(){te&&te.setModel({original:D.editor.createModel(se,ve),modified:D.editor.createModel(we,ve)})},[se,we,ve,te]);var Ae=d(G),ke=d(ie),Te={width:Ae,height:ke};return W.a.createElement("div",{className:"my-diff-editor",ref:pe,style:Te})}},ZpRC:function(_t,ot,le){"use strict";function ue(m){return typeof m=="object"&&m!=null&&m.nodeType===1}function Z(m,p){return(!p||m!=="hidden")&&m!=="visible"&&m!=="clip"}function M(m,p){if(m.clientHeight<m.scrollHeight||m.clientWidth<m.scrollWidth){var f=getComputedStyle(m,null);return Z(f.overflowY,p)||Z(f.overflowX,p)||function(h){var s=function(u){if(!u.ownerDocument||!u.ownerDocument.defaultView)return null;try{return u.ownerDocument.defaultView.frameElement}catch(l){return null}}(h);return!!s&&(s.clientHeight<h.scrollHeight||s.clientWidth<h.scrollWidth)}(m)}return!1}function Q(m,p,f,h,s,u,l,a){return u<m&&l>p||u>m&&l<p?0:u<=m&&a<=f||l>=p&&a>=f?u-m-h:l>p&&a<f||u<m&&a>f?l-p+s:0}var B=function(m,p){var f=window,h=p.scrollMode,s=p.block,u=p.inline,l=p.boundary,a=p.skipOverflowHiddenElements,o=typeof l=="function"?l:function(Pe){return Pe!==l};if(!ue(m))throw new TypeError("Invalid target");for(var c=document.scrollingElement||document.documentElement,L=[],w=m;ue(w)&&o(w);){if((w=w.parentElement)===c){L.push(w);break}w!=null&&w===document.body&&M(w)&&!M(document.documentElement)||w!=null&&M(w,a)&&L.push(w)}for(var T=f.visualViewport?f.visualViewport.width:innerWidth,O=f.visualViewport?f.visualViewport.height:innerHeight,A=window.scrollX||pageXOffset,x=window.scrollY||pageYOffset,S=m.getBoundingClientRect(),E=S.height,d=S.width,b=S.top,g=S.right,_=S.bottom,F=S.left,D=s==="start"||s==="nearest"?b:s==="end"?_:b+E/2,j=u==="center"?F+d/2:u==="end"?g:F,H=[],k=0;k<L.length;k++){var y=L[k],G=y.getBoundingClientRect(),Y=G.height,ie=G.width,se=G.top,we=G.right,ve=G.bottom,Se=G.left;if(h==="if-needed"&&b>=0&&F>=0&&_<=O&&g<=T&&b>=se&&_<=ve&&F>=Se&&g<=we)return H;var Ce=getComputedStyle(y),pe=parseInt(Ce.borderLeftWidth,10),fe=parseInt(Ce.borderTopWidth,10),oe=parseInt(Ce.borderRightWidth,10),te=parseInt(Ce.borderBottomWidth,10),he=0,ae=0,Ae="offsetWidth"in y?y.offsetWidth-y.clientWidth-pe-oe:0,ke="offsetHeight"in y?y.offsetHeight-y.clientHeight-fe-te:0;if(c===y)he=s==="start"?D:s==="end"?D-O:s==="nearest"?Q(x,x+O,O,fe,te,x+D,x+D+E,E):D-O/2,ae=u==="start"?j:u==="center"?j-T/2:u==="end"?j-T:Q(A,A+T,T,pe,oe,A+j,A+j+d,d),he=Math.max(0,he+x),ae=Math.max(0,ae+A);else{he=s==="start"?D-se-fe:s==="end"?D-ve+te+ke:s==="nearest"?Q(se,ve,Y,fe,te+ke,D,D+E,E):D-(se+Y/2)+ke/2,ae=u==="start"?j-Se-pe:u==="center"?j-(Se+ie/2)+Ae/2:u==="end"?j-we+oe+Ae:Q(Se,we,ie,pe,oe+Ae,j,j+d,d);var Te=y.scrollLeft,Le=y.scrollTop;D+=Le-(he=Math.max(0,Math.min(Le+he,y.scrollHeight-Y+ke))),j+=Te-(ae=Math.max(0,Math.min(Te+ae,y.scrollWidth-ie+Ae)))}H.push({el:y,top:he,left:ae})}return H};function N(m){return m===Object(m)&&Object.keys(m).length!==0}function K(m,p){p===void 0&&(p="auto");var f="scrollBehavior"in document.body.style;m.forEach(function(h){var s=h.el,u=h.top,l=h.left;s.scroll&&f?s.scroll({top:u,left:l,behavior:p}):(s.scrollTop=u,s.scrollLeft=l)})}function W(m){return m===!1?{block:"end",inline:"nearest"}:N(m)?m:{block:"start",inline:"nearest"}}function P(m,p){var f=!m.ownerDocument.documentElement.contains(m);if(N(p)&&typeof p.behavior=="function")return p.behavior(f?[]:B(m,p));if(f)return;var h=W(p);return K(B(m,h),h.behavior)}var R=ot.a=P},Zss7:function(_t,ot,le){var ue;(function(Z){var M=/^\s+/,Q=/\s+$/,B=0,N=Z.round,K=Z.min,W=Z.max,P=Z.random;function R(te,he){if(te=te||"",he=he||{},te instanceof R)return te;if(!(this instanceof R))return new R(te,he);var ae=m(te);this._originalInput=te,this._r=ae.r,this._g=ae.g,this._b=ae.b,this._a=ae.a,this._roundA=N(100*this._a)/100,this._format=he.format||ae.format,this._gradientType=he.gradientType,this._r<1&&(this._r=N(this._r)),this._g<1&&(this._g=N(this._g)),this._b<1&&(this._b=N(this._b)),this._ok=ae.ok,this._tc_id=B++}R.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var te=this.toRgb();return(te.r*299+te.g*587+te.b*114)/1e3},getLuminance:function(){var te=this.toRgb(),he,ae,Ae,ke,Te,Le;return he=te.r/255,ae=te.g/255,Ae=te.b/255,he<=.03928?ke=he/12.92:ke=Z.pow((he+.055)/1.055,2.4),ae<=.03928?Te=ae/12.92:Te=Z.pow((ae+.055)/1.055,2.4),Ae<=.03928?Le=Ae/12.92:Le=Z.pow((Ae+.055)/1.055,2.4),.2126*ke+.7152*Te+.0722*Le},setAlpha:function(te){return this._a=H(te),this._roundA=N(100*this._a)/100,this},toHsv:function(){var te=s(this._r,this._g,this._b);return{h:te.h*360,s:te.s,v:te.v,a:this._a}},toHsvString:function(){var te=s(this._r,this._g,this._b),he=N(te.h*360),ae=N(te.s*100),Ae=N(te.v*100);return this._a==1?"hsv("+he+", "+ae+"%, "+Ae+"%)":"hsva("+he+", "+ae+"%, "+Ae+"%, "+this._roundA+")"},toHsl:function(){var te=f(this._r,this._g,this._b);return{h:te.h*360,s:te.s,l:te.l,a:this._a}},toHslString:function(){var te=f(this._r,this._g,this._b),he=N(te.h*360),ae=N(te.s*100),Ae=N(te.l*100);return this._a==1?"hsl("+he+", "+ae+"%, "+Ae+"%)":"hsla("+he+", "+ae+"%, "+Ae+"%, "+this._roundA+")"},toHex:function(te){return l(this._r,this._g,this._b,te)},toHexString:function(te){return"#"+this.toHex(te)},toHex8:function(te){return a(this._r,this._g,this._b,this._a,te)},toHex8String:function(te){return"#"+this.toHex8(te)},toRgb:function(){return{r:N(this._r),g:N(this._g),b:N(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+N(this._r)+", "+N(this._g)+", "+N(this._b)+")":"rgba("+N(this._r)+", "+N(this._g)+", "+N(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:N(k(this._r,255)*100)+"%",g:N(k(this._g,255)*100)+"%",b:N(k(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+N(k(this._r,255)*100)+"%, "+N(k(this._g,255)*100)+"%, "+N(k(this._b,255)*100)+"%)":"rgba("+N(k(this._r,255)*100)+"%, "+N(k(this._g,255)*100)+"%, "+N(k(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:D[l(this._r,this._g,this._b,!0)]||!1},toFilter:function(te){var he="#"+o(this._r,this._g,this._b,this._a),ae=he,Ae=this._gradientType?"GradientType = 1, ":"";if(te){var ke=R(te);ae="#"+o(ke._r,ke._g,ke._b,ke._a)}return"progid:DXImageTransform.Microsoft.gradient("+Ae+"startColorstr="+he+",endColorstr="+ae+")"},toString:function(te){var he=!!te;te=te||this._format;var ae=!1,Ae=this._a<1&&this._a>=0,ke=!he&&Ae&&(te==="hex"||te==="hex6"||te==="hex3"||te==="hex4"||te==="hex8"||te==="name");return ke?te==="name"&&this._a===0?this.toName():this.toRgbString():(te==="rgb"&&(ae=this.toRgbString()),te==="prgb"&&(ae=this.toPercentageRgbString()),(te==="hex"||te==="hex6")&&(ae=this.toHexString()),te==="hex3"&&(ae=this.toHexString(!0)),te==="hex4"&&(ae=this.toHex8String(!0)),te==="hex8"&&(ae=this.toHex8String()),te==="name"&&(ae=this.toName()),te==="hsl"&&(ae=this.toHslString()),te==="hsv"&&(ae=this.toHsvString()),ae||this.toHexString())},clone:function(){return R(this.toString())},_applyModification:function(te,he){var ae=te.apply(null,[this].concat([].slice.call(he)));return this._r=ae._r,this._g=ae._g,this._b=ae._b,this.setAlpha(ae._a),this},lighten:function(){return this._applyModification(T,arguments)},brighten:function(){return this._applyModification(O,arguments)},darken:function(){return this._applyModification(A,arguments)},desaturate:function(){return this._applyModification(c,arguments)},saturate:function(){return this._applyModification(L,arguments)},greyscale:function(){return this._applyModification(w,arguments)},spin:function(){return this._applyModification(x,arguments)},_applyCombination:function(te,he){return te.apply(null,[this].concat([].slice.call(he)))},analogous:function(){return this._applyCombination(g,arguments)},complement:function(){return this._applyCombination(S,arguments)},monochromatic:function(){return this._applyCombination(_,arguments)},splitcomplement:function(){return this._applyCombination(b,arguments)},triad:function(){return this._applyCombination(E,arguments)},tetrad:function(){return this._applyCombination(d,arguments)}},R.fromRatio=function(te,he){if(typeof te=="object"){var ae={};for(var Ae in te)te.hasOwnProperty(Ae)&&(Ae==="a"?ae[Ae]=te[Ae]:ae[Ae]=we(te[Ae]));te=ae}return R(te,he)};function m(te){var he={r:0,g:0,b:0},ae=1,Ae=null,ke=null,Te=null,Le=!1,Pe=!1;return typeof te=="string"&&(te=fe(te)),typeof te=="object"&&(pe(te.r)&&pe(te.g)&&pe(te.b)?(he=p(te.r,te.g,te.b),Le=!0,Pe=String(te.r).substr(-1)==="%"?"prgb":"rgb"):pe(te.h)&&pe(te.s)&&pe(te.v)?(Ae=we(te.s),ke=we(te.v),he=u(te.h,Ae,ke),Le=!0,Pe="hsv"):pe(te.h)&&pe(te.s)&&pe(te.l)&&(Ae=we(te.s),Te=we(te.l),he=h(te.h,Ae,Te),Le=!0,Pe="hsl"),te.hasOwnProperty("a")&&(ae=te.a)),ae=H(ae),{ok:Le,format:te.format||Pe,r:K(255,W(he.r,0)),g:K(255,W(he.g,0)),b:K(255,W(he.b,0)),a:ae}}function p(te,he,ae){return{r:k(te,255)*255,g:k(he,255)*255,b:k(ae,255)*255}}function f(te,he,ae){te=k(te,255),he=k(he,255),ae=k(ae,255);var Ae=W(te,he,ae),ke=K(te,he,ae),Te,Le,Pe=(Ae+ke)/2;if(Ae==ke)Te=Le=0;else{var He=Ae-ke;Le=Pe>.5?He/(2-Ae-ke):He/(Ae+ke);switch(Ae){case te:Te=(he-ae)/He+(he<ae?6:0);break;case he:Te=(ae-te)/He+2;break;case ae:Te=(te-he)/He+4;break}Te/=6}return{h:Te,s:Le,l:Pe}}function h(te,he,ae){var Ae,ke,Te;te=k(te,360),he=k(he,100),ae=k(ae,100);function Le(Fe,Ue,Ne){return Ne<0&&(Ne+=1),Ne>1&&(Ne-=1),Ne<1/6?Fe+(Ue-Fe)*6*Ne:Ne<1/2?Ue:Ne<2/3?Fe+(Ue-Fe)*(2/3-Ne)*6:Fe}if(he===0)Ae=ke=Te=ae;else{var Pe=ae<.5?ae*(1+he):ae+he-ae*he,He=2*ae-Pe;Ae=Le(He,Pe,te+1/3),ke=Le(He,Pe,te),Te=Le(He,Pe,te-1/3)}return{r:Ae*255,g:ke*255,b:Te*255}}function s(te,he,ae){te=k(te,255),he=k(he,255),ae=k(ae,255);var Ae=W(te,he,ae),ke=K(te,he,ae),Te,Le,Pe=Ae,He=Ae-ke;if(Le=Ae===0?0:He/Ae,Ae==ke)Te=0;else{switch(Ae){case te:Te=(he-ae)/He+(he<ae?6:0);break;case he:Te=(ae-te)/He+2;break;case ae:Te=(te-he)/He+4;break}Te/=6}return{h:Te,s:Le,v:Pe}}function u(te,he,ae){te=k(te,360)*6,he=k(he,100),ae=k(ae,100);var Ae=Z.floor(te),ke=te-Ae,Te=ae*(1-he),Le=ae*(1-ke*he),Pe=ae*(1-(1-ke)*he),He=Ae%6,Fe=[ae,Le,Te,Te,Pe,ae][He],Ue=[Pe,ae,ae,Le,Te,Te][He],Ne=[Te,Te,Pe,ae,ae,Le][He];return{r:Fe*255,g:Ue*255,b:Ne*255}}function l(te,he,ae,Ae){var ke=[se(N(te).toString(16)),se(N(he).toString(16)),se(N(ae).toString(16))];return Ae&&ke[0].charAt(0)==ke[0].charAt(1)&&ke[1].charAt(0)==ke[1].charAt(1)&&ke[2].charAt(0)==ke[2].charAt(1)?ke[0].charAt(0)+ke[1].charAt(0)+ke[2].charAt(0):ke.join("")}function a(te,he,ae,Ae,ke){var Te=[se(N(te).toString(16)),se(N(he).toString(16)),se(N(ae).toString(16)),se(ve(Ae))];return ke&&Te[0].charAt(0)==Te[0].charAt(1)&&Te[1].charAt(0)==Te[1].charAt(1)&&Te[2].charAt(0)==Te[2].charAt(1)&&Te[3].charAt(0)==Te[3].charAt(1)?Te[0].charAt(0)+Te[1].charAt(0)+Te[2].charAt(0)+Te[3].charAt(0):Te.join("")}function o(te,he,ae,Ae){var ke=[se(ve(Ae)),se(N(te).toString(16)),se(N(he).toString(16)),se(N(ae).toString(16))];return ke.join("")}R.equals=function(te,he){return!te||!he?!1:R(te).toRgbString()==R(he).toRgbString()},R.random=function(){return R.fromRatio({r:P(),g:P(),b:P()})};function c(te,he){he=he===0?0:he||10;var ae=R(te).toHsl();return ae.s-=he/100,ae.s=y(ae.s),R(ae)}function L(te,he){he=he===0?0:he||10;var ae=R(te).toHsl();return ae.s+=he/100,ae.s=y(ae.s),R(ae)}function w(te){return R(te).desaturate(100)}function T(te,he){he=he===0?0:he||10;var ae=R(te).toHsl();return ae.l+=he/100,ae.l=y(ae.l),R(ae)}function O(te,he){he=he===0?0:he||10;var ae=R(te).toRgb();return ae.r=W(0,K(255,ae.r-N(255*-(he/100)))),ae.g=W(0,K(255,ae.g-N(255*-(he/100)))),ae.b=W(0,K(255,ae.b-N(255*-(he/100)))),R(ae)}function A(te,he){he=he===0?0:he||10;var ae=R(te).toHsl();return ae.l-=he/100,ae.l=y(ae.l),R(ae)}function x(te,he){var ae=R(te).toHsl(),Ae=(ae.h+he)%360;return ae.h=Ae<0?360+Ae:Ae,R(ae)}function S(te){var he=R(te).toHsl();return he.h=(he.h+180)%360,R(he)}function E(te){var he=R(te).toHsl(),ae=he.h;return[R(te),R({h:(ae+120)%360,s:he.s,l:he.l}),R({h:(ae+240)%360,s:he.s,l:he.l})]}function d(te){var he=R(te).toHsl(),ae=he.h;return[R(te),R({h:(ae+90)%360,s:he.s,l:he.l}),R({h:(ae+180)%360,s:he.s,l:he.l}),R({h:(ae+270)%360,s:he.s,l:he.l})]}function b(te){var he=R(te).toHsl(),ae=he.h;return[R(te),R({h:(ae+72)%360,s:he.s,l:he.l}),R({h:(ae+216)%360,s:he.s,l:he.l})]}function g(te,he,ae){he=he||6,ae=ae||30;var Ae=R(te).toHsl(),ke=360/ae,Te=[R(te)];for(Ae.h=(Ae.h-(ke*he>>1)+720)%360;--he;)Ae.h=(Ae.h+ke)%360,Te.push(R(Ae));return Te}function _(te,he){he=he||6;for(var ae=R(te).toHsv(),Ae=ae.h,ke=ae.s,Te=ae.v,Le=[],Pe=1/he;he--;)Le.push(R({h:Ae,s:ke,v:Te})),Te=(Te+Pe)%1;return Le}R.mix=function(te,he,ae){ae=ae===0?0:ae||50;var Ae=R(te).toRgb(),ke=R(he).toRgb(),Te=ae/100,Le={r:(ke.r-Ae.r)*Te+Ae.r,g:(ke.g-Ae.g)*Te+Ae.g,b:(ke.b-Ae.b)*Te+Ae.b,a:(ke.a-Ae.a)*Te+Ae.a};return R(Le)},R.readability=function(te,he){var ae=R(te),Ae=R(he);return(Z.max(ae.getLuminance(),Ae.getLuminance())+.05)/(Z.min(ae.getLuminance(),Ae.getLuminance())+.05)},R.isReadable=function(te,he,ae){var Ae=R.readability(te,he),ke,Te;Te=!1,ke=oe(ae);switch(ke.level+ke.size){case"AAsmall":case"AAAlarge":Te=Ae>=4.5;break;case"AAlarge":Te=Ae>=3;break;case"AAAsmall":Te=Ae>=7;break}return Te},R.mostReadable=function(te,he,ae){var Ae=null,ke=0,Te,Le,Pe,He;ae=ae||{},Le=ae.includeFallbackColors,Pe=ae.level,He=ae.size;for(var Fe=0;Fe<he.length;Fe++)Te=R.readability(te,he[Fe]),Te>ke&&(ke=Te,Ae=R(he[Fe]));return R.isReadable(te,Ae,{level:Pe,size:He})||!Le?Ae:(ae.includeFallbackColors=!1,R.mostReadable(te,["#fff","#000"],ae))};var F=R.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},D=R.hexNames=j(F);function j(te){var he={};for(var ae in te)te.hasOwnProperty(ae)&&(he[te[ae]]=ae);return he}function H(te){return te=parseFloat(te),(isNaN(te)||te<0||te>1)&&(te=1),te}function k(te,he){Y(te)&&(te="100%");var ae=ie(te);return te=K(he,W(0,parseFloat(te))),ae&&(te=parseInt(te*he,10)/100),Z.abs(te-he)<1e-6?1:te%he/parseFloat(he)}function y(te){return K(1,W(0,te))}function G(te){return parseInt(te,16)}function Y(te){return typeof te=="string"&&te.indexOf(".")!=-1&&parseFloat(te)===1}function ie(te){return typeof te=="string"&&te.indexOf("%")!=-1}function se(te){return te.length==1?"0"+te:""+te}function we(te){return te<=1&&(te=te*100+"%"),te}function ve(te){return Z.round(parseFloat(te)*255).toString(16)}function Se(te){return G(te)/255}var Ce=function(){var te="[-\\+]?\\d+%?",he="[-\\+]?\\d*\\.\\d+%?",ae="(?:"+he+")|(?:"+te+")",Ae="[\\s|\\(]+("+ae+")[,|\\s]+("+ae+")[,|\\s]+("+ae+")\\s*\\)?",ke="[\\s|\\(]+("+ae+")[,|\\s]+("+ae+")[,|\\s]+("+ae+")[,|\\s]+("+ae+")\\s*\\)?";return{CSS_UNIT:new RegExp(ae),rgb:new RegExp("rgb"+Ae),rgba:new RegExp("rgba"+ke),hsl:new RegExp("hsl"+Ae),hsla:new RegExp("hsla"+ke),hsv:new RegExp("hsv"+Ae),hsva:new RegExp("hsva"+ke),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function pe(te){return!!Ce.CSS_UNIT.exec(te)}function fe(te){te=te.replace(M,"").replace(Q,"").toLowerCase();var he=!1;if(F[te])te=F[te],he=!0;else if(te=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var ae;return(ae=Ce.rgb.exec(te))?{r:ae[1],g:ae[2],b:ae[3]}:(ae=Ce.rgba.exec(te))?{r:ae[1],g:ae[2],b:ae[3],a:ae[4]}:(ae=Ce.hsl.exec(te))?{h:ae[1],s:ae[2],l:ae[3]}:(ae=Ce.hsla.exec(te))?{h:ae[1],s:ae[2],l:ae[3],a:ae[4]}:(ae=Ce.hsv.exec(te))?{h:ae[1],s:ae[2],v:ae[3]}:(ae=Ce.hsva.exec(te))?{h:ae[1],s:ae[2],v:ae[3],a:ae[4]}:(ae=Ce.hex8.exec(te))?{r:G(ae[1]),g:G(ae[2]),b:G(ae[3]),a:Se(ae[4]),format:he?"name":"hex8"}:(ae=Ce.hex6.exec(te))?{r:G(ae[1]),g:G(ae[2]),b:G(ae[3]),format:he?"name":"hex"}:(ae=Ce.hex4.exec(te))?{r:G(ae[1]+""+ae[1]),g:G(ae[2]+""+ae[2]),b:G(ae[3]+""+ae[3]),a:Se(ae[4]+""+ae[4]),format:he?"name":"hex8"}:(ae=Ce.hex3.exec(te))?{r:G(ae[1]+""+ae[1]),g:G(ae[2]+""+ae[2]),b:G(ae[3]+""+ae[3]),format:he?"name":"hex"}:!1}function oe(te){var he,ae;return te=te||{level:"AA",size:"small"},he=(te.level||"AA").toUpperCase(),ae=(te.size||"small").toLowerCase(),he!=="AA"&&he!=="AAA"&&(he="AA"),ae!=="small"&&ae!=="large"&&(ae="small"),{level:he,size:ae}}_t.exports?_t.exports=R:!(ue=function(){return R}.call(ot,le,ot,_t),ue!==void 0&&(_t.exports=ue))})(Math)},bT9E:function(_t,ot,le){"use strict";le.d(ot,"a",function(){return Z});var ue=le("VTBJ");function Z(M,Q){var B=Object(ue.a)({},M);return Array.isArray(Q)&&Q.forEach(function(N){delete B[N]}),B}},c5Ni:function(_t,ot,le){},dejd:function(_t,ot,le){},dmUQ:function(_t,ot,le){"use strict";var ue=le("Ff2n"),Z=le("rePB"),M=le("1OyB"),Q=le("vuIU"),B=le("Ji7U"),N=le("md7G"),K=le("foSv"),W=le("q1tI"),P=le.n(W),R=le("TSYQ"),m=le.n(R),p=le("4IlW");function f(E,d){var b=Object.keys(E);if(Object.getOwnPropertySymbols){var g=Object.getOwnPropertySymbols(E);d&&(g=g.filter(function(_){return Object.getOwnPropertyDescriptor(E,_).enumerable})),b.push.apply(b,g)}return b}function h(E){for(var d=1;d<arguments.length;d++){var b=arguments[d]!=null?arguments[d]:{};d%2?f(Object(b),!0).forEach(function(g){Object(Z.a)(E,g,b[g])}):Object.getOwnPropertyDescriptors?Object.defineProperties(E,Object.getOwnPropertyDescriptors(b)):f(Object(b)).forEach(function(g){Object.defineProperty(E,g,Object.getOwnPropertyDescriptor(b,g))})}return E}function s(E){var d=u();return function(){var g=Object(K.a)(E),_;if(d){var F=Object(K.a)(this).constructor;_=Reflect.construct(g,arguments,F)}else _=g.apply(this,arguments);return Object(N.a)(this,_)}}function u(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(E){return!1}}function l(){}function a(E){E.preventDefault()}var o=function(d){return d.replace(/[^\w.-]+/g,"")},c=200,L=600,w=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,T=function(d){return d!=null},O=function(d,b){return b===d||typeof b=="number"&&typeof d=="number"&&isNaN(b)&&isNaN(d)},A=function(E){Object(B.a)(b,E);var d=s(b);function b(g){var _;Object(M.a)(this,b),_=d.call(this,g),_.onKeyDown=function(j){var H=_.props,k=H.onKeyDown,y=H.onPressEnter;if(j.keyCode===p.a.UP){var G=_.getRatio(j);_.up(j,G,null),_.stop()}else if(j.keyCode===p.a.DOWN){var Y=_.getRatio(j);_.down(j,Y,null),_.stop()}else j.keyCode===p.a.ENTER&&y&&y(j);if(_.recordCursorPosition(),_.lastKeyCode=j.keyCode,k){for(var ie=arguments.length,se=new Array(ie>1?ie-1:0),we=1;we<ie;we++)se[we-1]=arguments[we];k.apply(void 0,[j].concat(se))}},_.onKeyUp=function(j){var H=_.props.onKeyUp;if(_.stop(),_.recordCursorPosition(),H){for(var k=arguments.length,y=new Array(k>1?k-1:0),G=1;G<k;G++)y[G-1]=arguments[G];H.apply(void 0,[j].concat(y))}},_.onChange=function(j){var H=_.props.onChange;_.state.focused&&(_.inputting=!0),_.rawInput=_.props.parser(_.getValueFromEvent(j)),_.setState({inputValue:_.rawInput}),H(_.toNumber(_.rawInput))},_.onMouseUp=function(){var j=_.props.onMouseUp;_.recordCursorPosition(),j&&j.apply(void 0,arguments)},_.onFocus=function(){var j;_.setState({focused:!0}),(j=_.props).onFocus.apply(j,arguments)},_.onBlur=function(){var j=_.props.onBlur;_.inputting=!1,_.setState({focused:!1});var H=_.getCurrentValidValue(_.state.inputValue),k=_.setValue(H,l);if(j){var y=_.input.value,G=_.getInputDisplayValue({focus:!1,value:k});_.input.value=G&&Number(G),j.apply(void 0,arguments),_.input.value=y}},_.getRatio=function(j){var H=1;return j.metaKey||j.ctrlKey?H=.1:j.shiftKey&&(H=10),H},_.getFullNum=function(j){return isNaN(j)?j:/e/i.test(String(j))?Number(j).toFixed(18).replace(/\.?0+$/,""):j},_.getPrecision=function(j){if(T(_.props.precision))return _.props.precision;var H=String(j);if(H.indexOf("e-")>=0)return parseInt(H.slice(H.indexOf("e-")+2),10);var k=0;return H.indexOf(".")>=0&&(k=H.length-H.indexOf(".")-1),k},_.getInputDisplayValue=function(j){var H=j||_.state,k=H.focused,y=H.inputValue,G=H.value,Y;k?Y=y:Y=_.toPrecisionAsStep(G),Y==null&&(Y="");var ie=_.formatWrapper(Y);return T(_.props.decimalSeparator)&&(ie=ie.toString().replace(".",_.props.decimalSeparator)),ie},_.recordCursorPosition=function(){try{_.cursorStart=_.input.selectionStart,_.cursorEnd=_.input.selectionEnd,_.currentValue=_.input.value,_.cursorBefore=_.input.value.substring(0,_.cursorStart),_.cursorAfter=_.input.value.substring(_.cursorEnd)}catch(j){}},_.restoreByAfter=function(j){if(j===void 0)return!1;var H=_.input.value,k=H.lastIndexOf(j);if(k===-1)return!1;var y=_.cursorBefore.length;return _.lastKeyCode===p.a.DELETE&&_.cursorBefore.charAt(y-1)===j[0]?(_.fixCaret(y,y),!0):k+j.length===H.length?(_.fixCaret(k,k),!0):!1},_.partRestoreByAfter=function(j){return j===void 0?!1:Array.prototype.some.call(j,function(H,k){var y=j.substring(k);return _.restoreByAfter(y)})},_.isNotCompleteNumber=function(j){return isNaN(j)||j===""||j===null||j&&j.toString().indexOf(".")===j.toString().length-1},_.stop=function(){_.autoStepTimer&&clearTimeout(_.autoStepTimer)},_.down=function(j,H,k){_.pressingUpOrDown=!0,_.step("down",j,H,k)},_.up=function(j,H,k){_.pressingUpOrDown=!0,_.step("up",j,H,k)},_.saveInput=function(j){_.input=j};var F=g.value;F===void 0&&(F=g.defaultValue),_.state={focused:g.autoFocus};var D=_.getValidValue(_.toNumber(F));return _.state=h(h({},_.state),{},{inputValue:_.toPrecisionAsStep(D),value:D}),_}return Object(Q.a)(b,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(_){var F=this.props,D=F.value,j=F.onChange,H=F.max,k=F.min,y=this.state.focused;if(_){if(!O(_.value,D)||!O(_.max,H)||!O(_.min,k)){var G=y?D:this.getValidValue(D),Y;this.pressingUpOrDown?Y=G:this.inputting?Y=this.rawInput:Y=this.toPrecisionAsStep(G),this.setState({value:G,inputValue:Y})}var ie="value"in this.props?D:this.state.value;"max"in this.props&&_.max!==H&&typeof ie=="number"&&ie>H&&j&&j(H),"min"in this.props&&_.min!==k&&typeof ie=="number"&&ie<k&&j&&j(k)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var se=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===p.a.BACKSPACE?se=this.cursorStart-1:this.lastKeyCode===p.a.DELETE&&(se=this.cursorStart):se=this.input.value.length,this.fixCaret(se,se)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case p.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case p.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(we){}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(_){var F=_;return F===""?F="":this.isNotCompleteNumber(parseFloat(F))?F=this.state.value:F=this.getValidValue(F),this.toNumber(F)}},{key:"getValueFromEvent",value:function(_){var F=_.target.value.trim().replace(/。/g,".");return T(this.props.decimalSeparator)&&(F=F.replace(this.props.decimalSeparator,".")),F}},{key:"getValidValue",value:function(_){var F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,D=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,j=parseFloat(_);return isNaN(j)?_:(j<F&&(j=F),j>D&&(j=D),j)}},{key:"setValue",value:function(_,F){var D=this.props.precision,j=this.isNotCompleteNumber(parseFloat(_))?null:parseFloat(_),H=this.state.value,k=H===void 0?null:H,y=this.state.inputValue,G=y===void 0?null:y,Y=typeof j=="number"?j.toFixed(D):"".concat(j),ie=j!==k||Y!=="".concat(G);return"value"in this.props?(G=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:G},F)):this.setState({value:j,inputValue:this.toPrecisionAsStep(_)},F),ie&&this.props.onChange(j),j}},{key:"getMaxPrecision",value:function(_){var F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,D=this.props,j=D.precision,H=D.step;if(T(j))return j;var k=this.getPrecision(F),y=this.getPrecision(H),G=this.getPrecision(_);return _?Math.max(G,k+y):k+y}},{key:"getPrecisionFactor",value:function(_){var F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,D=this.getMaxPrecision(_,F);return Math.pow(10,D)}},{key:"focus",value:function(){this.input.focus(),this.recordCursorPosition()}},{key:"blur",value:function(){this.input.blur()}},{key:"select",value:function(){this.input.select()}},{key:"formatWrapper",value:function(_){return this.props.formatter?this.props.formatter(_):_}},{key:"toPrecisionAsStep",value:function(_){if(this.isNotCompleteNumber(_)||_==="")return _;var F=Math.abs(this.getMaxPrecision(_));return isNaN(F)?_.toString():Number(_).toFixed(F)}},{key:"toNumber",value:function(_){var F=this.props.precision,D=this.state.focused,j=_&&_.length>16&&D;return this.isNotCompleteNumber(_)||j?_:T(F)?Math.round(_*Math.pow(10,F))/Math.pow(10,F):Number(_)}},{key:"upStep",value:function(_,F){var D=this.props.step,j=this.getPrecisionFactor(_,F),H=Math.abs(this.getMaxPrecision(_,F)),k=((j*_+j*D*F)/j).toFixed(H);return this.toNumber(k)}},{key:"downStep",value:function(_,F){var D=this.props.step,j=this.getPrecisionFactor(_,F),H=Math.abs(this.getMaxPrecision(_,F)),k=((j*_-j*D*F)/j).toFixed(H);return this.toNumber(k)}},{key:"step",value:function(_,F){var D=this,j=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,H=arguments.length>3?arguments[3]:void 0;this.stop(),F&&(F.persist(),F.preventDefault());var k=this.props;if(k.disabled)return;var y=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(y))return;var G=this["".concat(_,"Step")](y,j),Y=G>k.max||G<k.min;if(G>k.max?G=k.max:G<k.min&&(G=k.min),this.setValue(G,null),this.setState({focused:!0},function(){D.pressingUpOrDown=!1}),Y)return;this.autoStepTimer=setTimeout(function(){D[_](F,j,!0)},H?c:L)}},{key:"fixCaret",value:function(_,F){if(_===void 0||F===void 0||!this.input||!this.input.value)return;try{var D=this.input.selectionStart,j=this.input.selectionEnd;(_!==D||F!==j)&&this.input.setSelectionRange(_,F)}catch(H){}}},{key:"render",value:function(){var _,F=this.props,D=F.prefixCls,j=F.disabled,H=F.readOnly,k=F.useTouch,y=F.autoComplete,G=F.upHandler,Y=F.downHandler,ie=F.className,se=F.max,we=F.min,ve=F.style,Se=F.title,Ce=F.onMouseEnter,pe=F.onMouseLeave,fe=F.onMouseOver,oe=F.onMouseOut,te=F.required,he=F.onClick,ae=F.tabIndex,Ae=F.type,ke=F.placeholder,Te=F.id,Le=F.inputMode,Pe=F.pattern,He=F.step,Fe=F.maxLength,Ue=F.autoFocus,Ne=F.name,Ze=F.onPaste,st=F.onInput,tt=Object(ue.a)(F,["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"]),et=this.state,ut=et.value,Ye=et.focused,Xe=m()(D,(_={},Object(Z.a)(_,ie,!!ie),Object(Z.a)(_,"".concat(D,"-disabled"),j),Object(Z.a)(_,"".concat(D,"-focused"),Ye),_)),Ie={};Object.keys(tt).forEach(function(me){(me.substr(0,5)==="data-"||me.substr(0,5)==="aria-"||me==="role")&&(Ie[me]=tt[me])});var lt=!H&&!j,nt=this.getInputDisplayValue(null),De=(ut||ut===0)&&(isNaN(ut)||Number(ut)>=se),ze=(ut||ut===0)&&(isNaN(ut)||Number(ut)<=we),xe=De||j||H,ye=ze||j||H,_e=m()("".concat(D,"-handler"),"".concat(D,"-handler-up"),Object(Z.a)({},"".concat(D,"-handler-up-disabled"),xe)),ne=m()("".concat(D,"-handler"),"".concat(D,"-handler-down"),Object(Z.a)({},"".concat(D,"-handler-down-disabled"),ye)),re=k?{onTouchStart:xe?l:this.up,onTouchEnd:this.stop}:{onMouseDown:xe?l:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},de=k?{onTouchStart:ye?l:this.down,onTouchEnd:this.stop}:{onMouseDown:ye?l:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return P.a.createElement("div",{className:Xe,style:ve,title:Se,onMouseEnter:Ce,onMouseLeave:pe,onMouseOver:fe,onMouseOut:oe,onFocus:function(){return null},onBlur:function(){return null}},P.a.createElement("div",{className:"".concat(D,"-handler-wrap")},P.a.createElement("span",Object.assign({unselectable:"on"},re,{role:"button","aria-label":"Increase Value","aria-disabled":xe,className:_e}),G||P.a.createElement("span",{unselectable:"on",className:"".concat(D,"-handler-up-inner"),onClick:a})),P.a.createElement("span",Object.assign({unselectable:"on"},de,{role:"button","aria-label":"Decrease Value","aria-disabled":ye,className:ne}),Y||P.a.createElement("span",{unselectable:"on",className:"".concat(D,"-handler-down-inner"),onClick:a}))),P.a.createElement("div",{className:"".concat(D,"-input-wrap")},P.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":we,"aria-valuemax":se,"aria-valuenow":ut,required:te,type:Ae,placeholder:ke,onPaste:Ze,onClick:he,onMouseUp:this.onMouseUp,className:"".concat(D,"-input"),tabIndex:ae,autoComplete:y,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:lt?this.onKeyDown:l,onKeyUp:lt?this.onKeyUp:l,autoFocus:Ue,maxLength:Fe,readOnly:H,disabled:j,max:se,min:we,step:He,name:Ne,title:Se,id:Te,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(nt),pattern:Pe,inputMode:Le,onInput:st},Ie))))}}]),b}(P.a.Component);A.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:w,min:-w,step:1,style:{},onChange:l,onKeyDown:l,onPressEnter:l,onFocus:l,onBlur:l,parser:o,required:!1,autoComplete:"off"};var x=A,S=ot.a=x},h78n:function(_t,ot,le){"use strict";le.d(ot,"a",function(){return _});var ue=le("q1tI"),Z=le.n(ue),M=le("TSYQ"),Q=le.n(M),B={className:"",percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,style:{},trailColor:"#D9D9D9",trailWidth:1},N=function(j){var H=j.map(function(){return Object(ue.useRef)()}),k=Object(ue.useRef)();return Object(ue.useEffect)(function(){var y=Date.now(),G=!1;Object.keys(H).forEach(function(Y){var ie=H[Y].current;if(!ie)return;G=!0;var se=ie.style;se.transitionDuration=".3s, .3s, .3s, .06s",k.current&&y-k.current<100&&(se.transitionDuration="0s, 0s")}),G&&(k.current=Date.now())}),[H]};function K(){return K=Object.assign||function(D){for(var j=1;j<arguments.length;j++){var H=arguments[j];for(var k in H)Object.prototype.hasOwnProperty.call(H,k)&&(D[k]=H[k])}return D},K.apply(this,arguments)}function W(D,j){return f(D)||p(D,j)||R(D,j)||P()}function P(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function R(D,j){if(!D)return;if(typeof D=="string")return m(D,j);var H=Object.prototype.toString.call(D).slice(8,-1);if(H==="Object"&&D.constructor&&(H=D.constructor.name),H==="Map"||H==="Set")return Array.from(D);if(H==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(H))return m(D,j)}function m(D,j){(j==null||j>D.length)&&(j=D.length);for(var H=0,k=new Array(j);H<j;H++)k[H]=D[H];return k}function p(D,j){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(D)))return;var H=[],k=!0,y=!1,G=void 0;try{for(var Y=D[Symbol.iterator](),ie;!(k=(ie=Y.next()).done)&&!(H.push(ie.value),j&&H.length===j);k=!0);}catch(se){y=!0,G=se}finally{try{!k&&Y.return!=null&&Y.return()}finally{if(y)throw G}}return H}function f(D){if(Array.isArray(D))return D}function h(D,j){if(D==null)return{};var H=s(D,j),k,y;if(Object.getOwnPropertySymbols){var G=Object.getOwnPropertySymbols(D);for(y=0;y<G.length;y++){if(k=G[y],j.indexOf(k)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(D,k))continue;H[k]=D[k]}}return H}function s(D,j){if(D==null)return{};var H={},k=Object.keys(D),y,G;for(G=0;G<k.length;G++){if(y=k[G],j.indexOf(y)>=0)continue;H[y]=D[y]}return H}var u=function(j){var H=j.className,k=j.percent,y=j.prefixCls,G=j.strokeColor,Y=j.strokeLinecap,ie=j.strokeWidth,se=j.style,we=j.trailColor,ve=j.trailWidth,Se=j.transition,Ce=h(j,["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"]);delete Ce.gapPosition;var pe=Array.isArray(k)?k:[k],fe=Array.isArray(G)?G:[G],oe=N(pe),te=W(oe,1),he=te[0],ae=ie/2,Ae=100-ie/2,ke="M ".concat(Y==="round"?ae:0,",").concat(ae,`
L `).concat(Y==="round"?Ae:100,",").concat(ae),Te="0 0 100 ".concat(ie),Le=0;return Z.a.createElement("svg",K({className:Q()("".concat(y,"-line"),H),viewBox:Te,preserveAspectRatio:"none",style:se},Ce),Z.a.createElement("path",{className:"".concat(y,"-line-trail"),d:ke,strokeLinecap:Y,stroke:we,strokeWidth:ve||ie,fillOpacity:"0"}),pe.map(function(Pe,He){var Fe={strokeDasharray:"".concat(Pe,"px, 100px"),strokeDashoffset:"-".concat(Le,"px"),transition:Se||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},Ue=fe[He]||fe[fe.length-1];return Le+=Pe,Z.a.createElement("path",{key:He,className:"".concat(y,"-line-path"),d:ke,strokeLinecap:Y,stroke:Ue,strokeWidth:ie,fillOpacity:"0",ref:he[He],style:Fe})}))};u.defaultProps=B;var l=u;function a(){return a=Object.assign||function(D){for(var j=1;j<arguments.length;j++){var H=arguments[j];for(var k in H)Object.prototype.hasOwnProperty.call(H,k)&&(D[k]=H[k])}return D},a.apply(this,arguments)}function o(D,j){return O(D)||T(D,j)||L(D,j)||c()}function c(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function L(D,j){if(!D)return;if(typeof D=="string")return w(D,j);var H=Object.prototype.toString.call(D).slice(8,-1);if(H==="Object"&&D.constructor&&(H=D.constructor.name),H==="Map"||H==="Set")return Array.from(D);if(H==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(H))return w(D,j)}function w(D,j){(j==null||j>D.length)&&(j=D.length);for(var H=0,k=new Array(j);H<j;H++)k[H]=D[H];return k}function T(D,j){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(D)))return;var H=[],k=!0,y=!1,G=void 0;try{for(var Y=D[Symbol.iterator](),ie;!(k=(ie=Y.next()).done)&&!(H.push(ie.value),j&&H.length===j);k=!0);}catch(se){y=!0,G=se}finally{try{!k&&Y.return!=null&&Y.return()}finally{if(y)throw G}}return H}function O(D){if(Array.isArray(D))return D}function A(D,j){if(D==null)return{};var H=x(D,j),k,y;if(Object.getOwnPropertySymbols){var G=Object.getOwnPropertySymbols(D);for(y=0;y<G.length;y++){if(k=G[y],j.indexOf(k)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(D,k))continue;H[k]=D[k]}}return H}function x(D,j){if(D==null)return{};var H={},k=Object.keys(D),y,G;for(G=0;G<k.length;G++){if(y=k[G],j.indexOf(y)>=0)continue;H[y]=D[y]}return H}var S=0;function E(D){return+D.replace("%","")}function d(D){return Array.isArray(D)?D:[D]}function b(D,j,H,k){var y=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,G=arguments.length>5?arguments[5]:void 0,Y=50-k/2,ie=0,se=-Y,we=0,ve=-2*Y;switch(G){case"left":ie=-Y,se=0,we=2*Y,ve=0;break;case"right":ie=Y,se=0,we=-2*Y,ve=0;break;case"bottom":se=Y,ve=2*Y;break;default:}var Se="M 50,50 m ".concat(ie,",").concat(se,`
a `).concat(Y,",").concat(Y," 0 1 1 ").concat(we,",").concat(-ve,`
a `).concat(Y,",").concat(Y," 0 1 1 ").concat(-we,",").concat(ve),Ce=Math.PI*2*Y,pe={stroke:H,strokeDasharray:"".concat(j/100*(Ce-y),"px ").concat(Ce,"px"),strokeDashoffset:"-".concat(y/2+D/100*(Ce-y),"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"};return{pathString:Se,pathStyle:pe}}var g=function(j){var H=j.prefixCls,k=j.strokeWidth,y=j.trailWidth,G=j.gapDegree,Y=j.gapPosition,ie=j.trailColor,se=j.strokeLinecap,we=j.style,ve=j.className,Se=j.strokeColor,Ce=j.percent,pe=A(j,["prefixCls","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"]),fe=Object(ue.useMemo)(function(){return S+=1,S},[]),oe=b(0,100,ie,k,G,Y),te=oe.pathString,he=oe.pathStyle,ae=d(Ce),Ae=d(Se),ke=Ae.find(function(Fe){return Object.prototype.toString.call(Fe)==="[object Object]"}),Te=N(ae),Le=o(Te,1),Pe=Le[0],He=function(){var Ue=0;return ae.map(function(Ne,Ze){var st=Ae[Ze]||Ae[Ae.length-1],tt=Object.prototype.toString.call(st)==="[object Object]"?"url(#".concat(H,"-gradient-").concat(fe,")"):"",et=b(Ue,Ne,st,k,G,Y);return Ue+=Ne,Z.a.createElement("path",{key:Ze,className:"".concat(H,"-circle-path"),d:et.pathString,stroke:tt,strokeLinecap:se,strokeWidth:k,opacity:Ne===0?0:1,fillOpacity:"0",style:et.pathStyle,ref:Pe[Ze]})})};return Z.a.createElement("svg",a({className:Q()("".concat(H,"-circle"),ve),viewBox:"0 0 100 100",style:we},pe),ke&&Z.a.createElement("defs",null,Z.a.createElement("linearGradient",{id:"".concat(H,"-gradient-").concat(fe),x1:"100%",y1:"0%",x2:"0%",y2:"0%"},Object.keys(ke).sort(function(Fe,Ue){return E(Fe)-E(Ue)}).map(function(Fe,Ue){return Z.a.createElement("stop",{key:Ue,offset:Fe,stopColor:ke[Fe]})}))),Z.a.createElement("path",{className:"".concat(H,"-circle-trail"),d:te,stroke:ie,strokeLinecap:se,strokeWidth:y||k,fillOpacity:"0",style:he}),He().reverse())};g.defaultProps=B;var _=g,F={Line:l,Circle:_}},kSUc:function(_t,ot,le){},lZu9:function(_t,ot,le){(function(ue){ue(le("VrN/"),le("1eCo"),le("8EBN"))})(function(ue){"use strict";ue.defineMode("markdown",function(Z,M){var Q=ue.getMode(Z,"text/html"),B=Q.name=="null";function N(k){if(ue.findModeByName){var y=ue.findModeByName(k);y&&(k=y.mime||y.mimes[0])}var G=ue.getMode(Z,k);return G.name=="null"?null:G}M.highlightFormatting===void 0&&(M.highlightFormatting=!1),M.maxBlockquoteDepth===void 0&&(M.maxBlockquoteDepth=0),M.taskLists===void 0&&(M.taskLists=!1),M.strikethrough===void 0&&(M.strikethrough=!1),M.emoji===void 0&&(M.emoji=!1),M.fencedCodeBlockHighlighting===void 0&&(M.fencedCodeBlockHighlighting=!0),M.fencedCodeBlockDefaultMode===void 0&&(M.fencedCodeBlockDefaultMode="text/plain"),M.xml===void 0&&(M.xml=!0),M.tokenTypeOverrides===void 0&&(M.tokenTypeOverrides={});var K={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 W in K)K.hasOwnProperty(W)&&M.tokenTypeOverrides[W]&&(K[W]=M.tokenTypeOverrides[W]);var P=/^([*\-_])(?:\s*\1){2,}\s*$/,R=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,m=/^\[(x| )\](?=\s)/i,p=M.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,f=/^ {0,3}(?:\={1,}|-{2,})\s*$/,h=/^[^#!\[\]*_\\<>` "'(~:]+/,s=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,u=/^\s*\[[^\]]+?\]:.*$/,l=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\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]/,a=" ";function o(k,y,G){return y.f=y.inline=G,G(k,y)}function c(k,y,G){return y.f=y.block=G,G(k,y)}function L(k){return!k||!/\S/.test(k.string)}function w(k){if(k.linkTitle=!1,k.linkHref=!1,k.linkText=!1,k.em=!1,k.strong=!1,k.strikethrough=!1,k.quote=0,k.indentedCode=!1,k.f==O){var y=B;if(!y){var G=ue.innerMode(Q,k.htmlState);y=G.mode.name=="xml"&&G.state.tagStart===null&&!G.state.context&&G.state.tokenize.isInText}y&&(k.f=E,k.block=T,k.htmlState=null)}return k.trailingSpace=0,k.trailingSpaceNewLine=!1,k.prevLine=k.thisLine,k.thisLine={stream:null},null}function T(k,y){var G=k.column()===y.indentation,Y=L(y.prevLine.stream),ie=y.indentedCode,se=y.prevLine.hr,we=y.list!==!1,ve=(y.listStack[y.listStack.length-1]||0)+3;y.indentedCode=!1;var Se=y.indentation;if(y.indentationDiff===null&&(y.indentationDiff=y.indentation,we)){for(y.list=null;Se<y.listStack[y.listStack.length-1];)y.listStack.pop(),y.listStack.length?y.indentation=y.listStack[y.listStack.length-1]:y.list=!1;y.list!==!1&&(y.indentationDiff=Se-y.listStack[y.listStack.length-1])}var Ce=!Y&&!se&&!y.prevLine.header&&(!we||!ie)&&!y.prevLine.fencedCodeEnd,pe=(y.list===!1||se||Y)&&y.indentation<=ve&&k.match(P),fe=null;if(y.indentationDiff>=4&&(ie||y.prevLine.fencedCodeEnd||y.prevLine.header||Y))return k.skipToEnd(),y.indentedCode=!0,K.code;if(k.eatSpace())return null;if(G&&y.indentation<=ve&&(fe=k.match(p))&&fe[1].length<=6)return y.quote=0,y.header=fe[1].length,y.thisLine.header=!0,M.highlightFormatting&&(y.formatting="header"),y.f=y.inline,x(y);if(y.indentation<=ve&&k.eat(">"))return y.quote=G?1:y.quote+1,M.highlightFormatting&&(y.formatting="quote"),k.eatSpace(),x(y);if(!pe&&!y.setext&&G&&y.indentation<=ve&&(fe=k.match(R))){var oe=fe[1]?"ol":"ul";return y.indentation=Se+k.current().length,y.list=!0,y.quote=0,y.listStack.push(y.indentation),y.em=!1,y.strong=!1,y.code=!1,y.strikethrough=!1,M.taskLists&&k.match(m,!1)&&(y.taskList=!0),y.f=y.inline,M.highlightFormatting&&(y.formatting=["list","list-"+oe]),x(y)}else{if(G&&y.indentation<=ve&&(fe=k.match(s,!0)))return y.quote=0,y.fencedEndRE=new RegExp(fe[1]+"+ *$"),y.localMode=M.fencedCodeBlockHighlighting&&N(fe[2]||M.fencedCodeBlockDefaultMode),y.localMode&&(y.localState=ue.startState(y.localMode)),y.f=y.block=A,M.highlightFormatting&&(y.formatting="code-block"),y.code=-1,x(y);if(y.setext||(!Ce||!we)&&!y.quote&&y.list===!1&&!y.code&&!pe&&!u.test(k.string)&&(fe=k.lookAhead(1))&&(fe=fe.match(f)))return y.setext?(y.header=y.setext,y.setext=0,k.skipToEnd(),M.highlightFormatting&&(y.formatting="header")):(y.header=fe[0].charAt(0)=="="?1:2,y.setext=y.header),y.thisLine.header=!0,y.f=y.inline,x(y);if(pe)return k.skipToEnd(),y.hr=!0,y.thisLine.hr=!0,K.hr;if(k.peek()==="[")return o(k,y,F)}return o(k,y,y.inline)}function O(k,y){var G=Q.token(k,y.htmlState);if(!B){var Y=ue.innerMode(Q,y.htmlState);(Y.mode.name=="xml"&&Y.state.tagStart===null&&!Y.state.context&&Y.state.tokenize.isInText||y.md_inside&&k.current().indexOf(">")>-1)&&(y.f=E,y.block=T,y.htmlState=null)}return G}function A(k,y){var G=y.listStack[y.listStack.length-1]||0,Y=y.indentation<G,ie=G+3;if(y.fencedEndRE&&y.indentation<=ie&&(Y||k.match(y.fencedEndRE))){M.highlightFormatting&&(y.formatting="code-block");var se;return Y||(se=x(y)),y.localMode=y.localState=null,y.block=T,y.f=E,y.fencedEndRE=null,y.code=0,y.thisLine.fencedCodeEnd=!0,Y?c(k,y,y.block):se}else return y.localMode?y.localMode.token(k,y.localState):(k.skipToEnd(),K.code)}function x(k){var y=[];if(k.formatting){y.push(K.formatting),typeof k.formatting=="string"&&(k.formatting=[k.formatting]);for(var G=0;G<k.formatting.length;G++)y.push(K.formatting+"-"+k.formatting[G]),k.formatting[G]==="header"&&y.push(K.formatting+"-"+k.formatting[G]+"-"+k.header),k.formatting[G]==="quote"&&(!M.maxBlockquoteDepth||M.maxBlockquoteDepth>=k.quote?y.push(K.formatting+"-"+k.formatting[G]+"-"+k.quote):y.push("error"))}if(k.taskOpen)return y.push("meta"),y.length?y.join(" "):null;if(k.taskClosed)return y.push("property"),y.length?y.join(" "):null;if(k.linkHref?y.push(K.linkHref,"url"):(k.strong&&y.push(K.strong),k.em&&y.push(K.em),k.strikethrough&&y.push(K.strikethrough),k.emoji&&y.push(K.emoji),k.linkText&&y.push(K.linkText),k.code&&y.push(K.code),k.image&&y.push(K.image),k.imageAltText&&y.push(K.imageAltText,"link"),k.imageMarker&&y.push(K.imageMarker)),k.header&&y.push(K.header,K.header+"-"+k.header),k.quote&&(y.push(K.quote),!M.maxBlockquoteDepth||M.maxBlockquoteDepth>=k.quote?y.push(K.quote+"-"+k.quote):y.push(K.quote+"-"+M.maxBlockquoteDepth)),k.list!==!1){var Y=(k.listStack.length-1)%3;Y?Y===1?y.push(K.list2):y.push(K.list3):y.push(K.list1)}return k.trailingSpaceNewLine?y.push("trailing-space-new-line"):k.trailingSpace&&y.push("trailing-space-"+(k.trailingSpace%2?"a":"b")),y.length?y.join(" "):null}function S(k,y){return k.match(h,!0)?x(y):void 0}function E(k,y){var G=y.text(k,y);if(typeof G!="undefined")return G;if(y.list)return y.list=null,x(y);if(y.taskList){var Y=k.match(m,!0)[1]===" ";return Y?y.taskOpen=!0:y.taskClosed=!0,M.highlightFormatting&&(y.formatting="task"),y.taskList=!1,x(y)}if(y.taskOpen=!1,y.taskClosed=!1,y.header&&k.match(/^#+$/,!0))return M.highlightFormatting&&(y.formatting="header"),x(y);var ie=k.next();if(y.linkTitle){y.linkTitle=!1;var se=ie;ie==="("&&(se=")"),se=(se+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var we="^\\s*(?:[^"+se+"\\\\]+|\\\\\\\\|\\\\.)"+se;if(k.match(new RegExp(we),!0))return K.linkHref}if(ie==="`"){var ve=y.formatting;M.highlightFormatting&&(y.formatting="code"),k.eatWhile("`");var Se=k.current().length;if(y.code==0&&(!y.quote||Se==1))return y.code=Se,x(y);if(Se==y.code){var Ce=x(y);return y.code=0,Ce}else return y.formatting=ve,x(y)}else if(y.code)return x(y);if(ie==="\\"&&(k.next(),M.highlightFormatting)){var pe=x(y),fe=K.formatting+"-escape";return pe?pe+" "+fe:fe}if(ie==="!"&&k.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return y.imageMarker=!0,y.image=!0,M.highlightFormatting&&(y.formatting="image"),x(y);if(ie==="["&&y.imageMarker&&k.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return y.imageMarker=!1,y.imageAltText=!0,M.highlightFormatting&&(y.formatting="image"),x(y);if(ie==="]"&&y.imageAltText){M.highlightFormatting&&(y.formatting="image");var pe=x(y);return y.imageAltText=!1,y.image=!1,y.inline=y.f=b,pe}if(ie==="["&&!y.image)return y.linkText&&k.match(/^.*?\]/)||(y.linkText=!0,M.highlightFormatting&&(y.formatting="link")),x(y);if(ie==="]"&&y.linkText){M.highlightFormatting&&(y.formatting="link");var pe=x(y);return y.linkText=!1,y.inline=y.f=k.match(/\(.*?\)| ?\[.*?\]/,!1)?b:E,pe}if(ie==="<"&&k.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){y.f=y.inline=d,M.highlightFormatting&&(y.formatting="link");var pe=x(y);return pe?pe+=" ":pe="",pe+K.linkInline}if(ie==="<"&&k.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){y.f=y.inline=d,M.highlightFormatting&&(y.formatting="link");var pe=x(y);return pe?pe+=" ":pe="",pe+K.linkEmail}if(M.xml&&ie==="<"&&k.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var oe=k.string.indexOf(">",k.pos);if(oe!=-1){var te=k.string.substring(k.start,oe);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(te)&&(y.md_inside=!0)}return k.backUp(1),y.htmlState=ue.startState(Q),c(k,y,O)}if(M.xml&&ie==="<"&&k.match(/^\/\w*?>/))return y.md_inside=!1,"tag";if(ie==="*"||ie==="_"){for(var he=1,ae=k.pos==1?" ":k.string.charAt(k.pos-2);he<3&&k.eat(ie);)he++;var Ae=k.peek()||" ",ke=!/\s/.test(Ae)&&(!l.test(Ae)||/\s/.test(ae)||l.test(ae)),Te=!/\s/.test(ae)&&(!l.test(ae)||/\s/.test(Ae)||l.test(Ae)),Le=null,Pe=null;if(he%2&&(!y.em&&ke&&(ie==="*"||!Te||l.test(ae))?Le=!0:y.em==ie&&Te&&(ie==="*"||!ke||l.test(Ae))&&(Le=!1)),he>1&&(!y.strong&&ke&&(ie==="*"||!Te||l.test(ae))?Pe=!0:y.strong==ie&&Te&&(ie==="*"||!ke||l.test(Ae))&&(Pe=!1)),Pe!=null||Le!=null){M.highlightFormatting&&(y.formatting=Le==null?"strong":Pe==null?"em":"strong em"),Le===!0&&(y.em=ie),Pe===!0&&(y.strong=ie);var Ce=x(y);return Le===!1&&(y.em=!1),Pe===!1&&(y.strong=!1),Ce}}else if(ie===" "&&(k.eat("*")||k.eat("_"))){if(k.peek()===" ")return x(y);k.backUp(1)}if(M.strikethrough){if(ie==="~"&&k.eatWhile(ie)){if(y.strikethrough){M.highlightFormatting&&(y.formatting="strikethrough");var Ce=x(y);return y.strikethrough=!1,Ce}else if(k.match(/^[^\s]/,!1))return y.strikethrough=!0,M.highlightFormatting&&(y.formatting="strikethrough"),x(y)}else if(ie===" "&&k.match(/^~~/,!0)){if(k.peek()===" ")return x(y);k.backUp(2)}}if(M.emoji&&ie===":"&&k.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){y.emoji=!0,M.highlightFormatting&&(y.formatting="emoji");var He=x(y);return y.emoji=!1,He}return ie===" "&&(k.match(/^ +$/,!1)?y.trailingSpace++:y.trailingSpace&&(y.trailingSpaceNewLine=!0)),x(y)}function d(k,y){var G=k.next();if(G===">"){y.f=y.inline=E,M.highlightFormatting&&(y.formatting="link");var Y=x(y);return Y?Y+=" ":Y="",Y+K.linkInline}return k.match(/^[^>]+/,!0),K.linkInline}function b(k,y){if(k.eatSpace())return null;var G=k.next();return G==="("||G==="["?(y.f=y.inline=_(G==="("?")":"]"),M.highlightFormatting&&(y.formatting="link-string"),y.linkHref=!0,x(y)):"error"}var g={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function _(k){return function(y,G){var Y=y.next();if(Y===k){G.f=G.inline=E,M.highlightFormatting&&(G.formatting="link-string");var ie=x(G);return G.linkHref=!1,ie}return y.match(g[k]),G.linkHref=!0,x(G)}}function F(k,y){return k.match(/^([^\]\\]|\\.)*\]:/,!1)?(y.f=D,k.next(),M.highlightFormatting&&(y.formatting="link"),y.linkText=!0,x(y)):o(k,y,E)}function D(k,y){if(k.match(/^\]:/,!0)){y.f=y.inline=j,M.highlightFormatting&&(y.formatting="link");var G=x(y);return y.linkText=!1,G}return k.match(/^([^\]\\]|\\.)+/,!0),K.linkText}function j(k,y){return k.eatSpace()?null:(k.match(/^[^\s]+/,!0),k.peek()===void 0?y.linkTitle=!0:k.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),y.f=y.inline=E,K.linkHref+" url")}var H={startState:function(){return{f:T,prevLine:{stream:null},thisLine:{stream:null},block:T,htmlState:null,indentation:0,inline:E,text:S,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(k){return{f:k.f,prevLine:k.prevLine,thisLine:k.thisLine,block:k.block,htmlState:k.htmlState&&ue.copyState(Q,k.htmlState),indentation:k.indentation,localMode:k.localMode,localState:k.localMode?ue.copyState(k.localMode,k.localState):null,inline:k.inline,text:k.text,formatting:!1,linkText:k.linkText,linkTitle:k.linkTitle,linkHref:k.linkHref,code:k.code,em:k.em,strong:k.strong,strikethrough:k.strikethrough,emoji:k.emoji,header:k.header,setext:k.setext,hr:k.hr,taskList:k.taskList,list:k.list,listStack:k.listStack.slice(0),quote:k.quote,indentedCode:k.indentedCode,trailingSpace:k.trailingSpace,trailingSpaceNewLine:k.trailingSpaceNewLine,md_inside:k.md_inside,fencedEndRE:k.fencedEndRE}},token:function(k,y){if(y.formatting=!1,k!=y.thisLine.stream){if(y.header=0,y.hr=!1,k.match(/^\s*$/,!0))return w(y),null;if(y.prevLine=y.thisLine,y.thisLine={stream:k},y.taskList=!1,y.trailingSpace=0,y.trailingSpaceNewLine=!1,!y.localState&&(y.f=y.block,y.f!=O)){var G=k.match(/^\s*/,!0)[0].replace(/\t/g,a).length;if(y.indentation=G,y.indentationDiff=null,G>0)return null}}return y.f(k,y)},innerMode:function(k){return k.block==O?{state:k.htmlState,mode:Q}:k.localState?{state:k.localState,mode:k.localMode}:{state:k,mode:H}},indent:function(k,y,G){return k.block==O&&Q.indent?Q.indent(k.htmlState,y,G):k.localState&&k.localMode.indent?k.localMode.indent(k.localState,y,G):ue.Pass},blankLine:w,getType:x,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return H},"xml"),ue.defineMIME("text/markdown","markdown"),ue.defineMIME("text/x-markdown","markdown")})},osHv:function(_t,ot,le){(function(ue){ue(le("VrN/"))})(function(ue){"use strict";var Z=ue.Pos;function M(l,a){return l.line-a.line||l.ch-a.ch}var Q="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",B=Q+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",N=new RegExp("<(/?)(["+Q+"]["+B+"]*)","g");function K(l,a,o,c){this.line=a,this.ch=o,this.cm=l,this.text=l.getLine(a),this.min=c?Math.max(c.from,l.firstLine()):l.firstLine(),this.max=c?Math.min(c.to-1,l.lastLine()):l.lastLine()}function W(l,a){var o=l.cm.getTokenTypeAt(Z(l.line,a));return o&&/\btag\b/.test(o)}function P(l){return l.line>=l.max?void 0:(l.ch=0,l.text=l.cm.getLine(++l.line),!0)}function R(l){return l.line<=l.min?void 0:(l.text=l.cm.getLine(--l.line),l.ch=l.text.length,!0)}function m(l){for(;;){var a=l.text.indexOf(">",l.ch);if(a==-1){if(P(l))continue;return}if(!W(l,a+1)){l.ch=a+1;continue}var o=l.text.lastIndexOf("/",a),c=o>-1&&!/\S/.test(l.text.slice(o+1,a));return l.ch=a+1,c?"selfClose":"regular"}}function p(l){for(;;){var a=l.ch?l.text.lastIndexOf("<",l.ch-1):-1;if(a==-1){if(R(l))continue;return}if(!W(l,a+1)){l.ch=a;continue}N.lastIndex=a,l.ch=a;var o=N.exec(l.text);if(o&&o.index==a)return o}}function f(l){for(;;){N.lastIndex=l.ch;var a=N.exec(l.text);if(!a){if(P(l))continue;return}if(!W(l,a.index+1)){l.ch=a.index+1;continue}return l.ch=a.index+a[0].length,a}}function h(l){for(;;){var a=l.ch?l.text.lastIndexOf(">",l.ch-1):-1;if(a==-1){if(R(l))continue;return}if(!W(l,a+1)){l.ch=a;continue}var o=l.text.lastIndexOf("/",a),c=o>-1&&!/\S/.test(l.text.slice(o+1,a));return l.ch=a+1,c?"selfClose":"regular"}}function s(l,a){for(var o=[];;){var c=f(l),L,w=l.line,T=l.ch-(c?c[0].length:0);if(!c||!(L=m(l)))return;if(L=="selfClose")continue;if(c[1]){for(var O=o.length-1;O>=0;--O)if(o[O]==c[2]){o.length=O;break}if(O<0&&(!a||a==c[2]))return{tag:c[2],from:Z(w,T),to:Z(l.line,l.ch)}}else o.push(c[2])}}function u(l,a){for(var o=[];;){var c=h(l);if(!c)return;if(c=="selfClose"){p(l);continue}var L=l.line,w=l.ch,T=p(l);if(!T)return;if(T[1])o.push(T[2]);else{for(var O=o.length-1;O>=0;--O)if(o[O]==T[2]){o.length=O;break}if(O<0&&(!a||a==T[2]))return{tag:T[2],from:Z(l.line,l.ch),to:Z(L,w)}}}}ue.registerHelper("fold","xml",function(l,a){for(var o=new K(l,a.line,0);;){var c=f(o);if(!c||o.line!=a.line)return;var L=m(o);if(!L)return;if(!c[1]&&L!="selfClose"){var w=Z(o.line,o.ch),T=s(o,c[2]);return T&&M(T.from,w)>0?{from:w,to:T.from}:null}}}),ue.findMatchingTag=function(l,a,o){var c=new K(l,a.line,a.ch,o);if(c.text.indexOf(">")==-1&&c.text.indexOf("<")==-1)return;var L=m(c),w=L&&Z(c.line,c.ch),T=L&&p(c);if(!L||!T||M(c,a)>0)return;var O={from:Z(c.line,c.ch),to:w,tag:T[2]};return L=="selfClose"?{open:O,close:null,at:"open"}:T[1]?{open:u(c,T[2]),close:O,at:"close"}:(c=new K(l,w.line,w.ch,o),{open:O,close:s(c,T[2]),at:"open"})},ue.findEnclosingTag=function(l,a,o,c){for(var L=new K(l,a.line,a.ch,o);;){var w=u(L,c);if(!w)break;var T=new K(l,a.line,a.ch,o),O=s(T,w.tag);if(O)return{open:w,close:O}}},ue.scanForClosingTag=function(l,a,o,c){var L=new K(l,a.line,a.ch,c?{from:0,to:c}:null);return s(L,o)}})},p0QG:function(_t,ot,le){_t.exports={flex_box_center:"flex_box_center___2axlI",flex_space_between:"flex_space_between___F6m1U",flex_box_vertical_center:"flex_box_vertical_center___2GovZ",flex_box_center_end:"flex_box_center_end___2h9j0",flex_box_column:"flex_box_column___1kuIs",SubMentItem:"SubMentItem___34z-Y",MenuItem:"MenuItem___1bbPM",wrp:"wrp___3LRhb",classroomInfo:"classroomInfo___Ohxoq",title:"title___22ZLP",titleLeft:"titleLeft___1MP-h",titleRight:"titleRight___3zsz9",classroomUser:"classroomUser___1ePAN",headPic:"headPic___2lEg_",teacherInfo:"teacherInfo___3C0Dn",classroomDesc:"classroomDesc____QVZX",classroomDescBg:"classroomDescBg___1e7L7",joinCouses:"joinCouses___2G4vP",bg:"bg___2QojS",leftMenus:"leftMenus___34tjX",titleSelected:"titleSelected___K6QwW",menuText:"menuText___3qMqH",totalCount:"totalCount___R2q38",actions:"actions___26Ww0",task_count:"task_count___3UQ1V",container:"container___2EGM4",leftMenuActions:"leftMenuActions___3_J-1"}},p5ED:function(_t,ot,le){"use strict";var ue=le("+L6B"),Z=le("2/Rp"),M=le("5Dmo"),Q=le("3S7+"),B=le("k1fw"),N=le("tJVT"),K=le("q1tI"),W=le.n(K),P=le("vHTk"),R=le.n(P),m=le("yEEn"),p=le("ZW9T"),f=le("1vsH");ot.a=function(h){var s=h.name,u=h.data,l=h.theme,a=h.type,o=h.filename,c=h.monacoEditor,L=h.className,w=h.style,T=h.close,O=h.onClose,A=h.hasMask,x=Object(K.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),S=Object(N.a)(x,2),E=S[0],d=S[1],b=Object(K.useState)(""),g=Object(N.a)(b,2),_=g[0],F=g[1],D,j=1024*1024,H=10*j,k=Object(K.useRef)();a==="office"&&(D=Object(f.T)(u).filesize,D>H&&(a="other")),o&&(c.filename=o),Object(K.useEffect)(function(){var Y,ie,se=(Y=document.cookie)===null||Y===void 0||((ie=Y.replace(/\s/g,""))===null||ie===void 0)?void 0:ie.split(";");se==null||se.map(function(we){var ve=we.split("=");ve[0]==="_educoder_session"&&F(ve[1])})},[]);var y=function(){if(u.startsWith("http")||u.startsWith("/")){G();return}Object(f.z)(o||"educoder",u,o)},G=function(){Object(f.x)(o||s,u)};return console.log("data:",u,"fileanme:",o," name:",s),W.a.createElement("div",{style:Object(B.a)({},w||{}),className:"".concat(A&&R.a.bgBlack," ").concat(a?R.a.wrp:"hide")},T&&W.a.createElement("div",{className:R.a.close,ref:k},W.a.createElement(Q.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return k.current}},W.a.createElement("span",{onClick:G},W.a.createElement("i",{className:"icon-quxiaozhiding"}))),W.a.createElement(Q.a,{title:"\u5173\u95ED",getPopupContainer:function(){return k.current}},W.a.createElement("span",{className:"",onClick:O},W.a.createElement("i",{className:"icon-guanbi1"})))),W.a.createElement("div",{className:"".concat(R.a[L]," ").concat(L," ").concat(R.a.monaco," ").concat(a==="txt"?"show":"hide")},a==="txt"&&W.a.createElement(p.b,c)),a==="audio"&&W.a.createElement("audio",{src:"".concat(u!=null&&u.startsWith("/")||(u==null?void 0:u.indexOf("https://"))>-1?u:"data:audio/mp3;base64,").concat(u),autoPlay:!0}),a==="video"&&W.a.createElement(W.a.Fragment,null,u!=null&&u.startsWith("/")?W.a.createElement("video",{controls:!0,src:"".concat(u),autoPlay:!0}):W.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(u),autoPlay:!0})),a==="html"&&W.a.createElement("iframe",{src:u+"&disposition=inline"}),a==="pdf"&&W.a.createElement("embed",{className:R.a.embed,src:u}),a==="image"&&W.a.createElement(W.a.Fragment,null,W.a.createElement("img",{src:"".concat(u!=null&&u.startsWith("/")||(u==null?void 0:u.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(u)})),a==="other"&&W.a.createElement("div",null,W.a.createElement(Z.a,{type:"primary",size:"large",onClick:y},W.a.createElement(m.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),(a==="download"||a==="office")&&W.a.createElement(Z.a,{type:"primary",size:"large",onClick:y},W.a.createElement(m.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(_t,ot,le){},psGv:function(_t,ot,le){var ue,Z;(function(){var M;(function(){"use strict";var K=[,,function(m){function p(s){this.__parent=s,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}p.prototype.clone_empty=function(){var s=new p(this.__parent);return s.set_indent(this.__indent_count,this.__alignment_count),s},p.prototype.item=function(s){return s<0?this.__items[this.__items.length+s]:this.__items[s]},p.prototype.has_match=function(s){for(var u=this.__items.length-1;u>=0;u--)if(this.__items[u].match(s))return!0;return!1},p.prototype.set_indent=function(s,u){this.is_empty()&&(this.__indent_count=s||0,this.__alignment_count=u||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},p.prototype._set_wrap_point=function(){this.__parent.wrap_line_length&&(this.__wrap_point_index=this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count)},p.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count},p.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var s=this.__parent.current_line;return s.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),s.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),s.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,s.__items[0]===" "&&(s.__items.splice(0,1),s.__character_count-=1),!0}return!1},p.prototype.is_empty=function(){return this.__items.length===0},p.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},p.prototype.push=function(s){this.__items.push(s);var u=s.lastIndexOf(`
`);u!==-1?this.__character_count=s.length-u:this.__character_count+=s.length},p.prototype.pop=function(){var s=null;return this.is_empty()||(s=this.__items.pop(),this.__character_count-=s.length),s},p.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},p.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},p.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},p.prototype.toString=function(){var s="";return this.is_empty()?this.__parent.indent_empty_lines&&(s=this.__parent.get_indent_string(this.__indent_count)):(s=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),s+=this.__items.join("")),s};function f(s,u){this.__cache=[""],this.__indent_size=s.indent_size,this.__indent_string=s.indent_char,s.indent_with_tabs||(this.__indent_string=new Array(s.indent_size+1).join(s.indent_char)),u=u||"",s.indent_level>0&&(u=new Array(s.indent_level+1).join(this.__indent_string)),this.__base_string=u,this.__base_string_length=u.length}f.prototype.get_indent_size=function(s,u){var l=this.__base_string_length;return u=u||0,s<0&&(l=0),l+=s*this.__indent_size,l+=u,l},f.prototype.get_indent_string=function(s,u){var l=this.__base_string;return u=u||0,s<0&&(s=0,l=""),u+=s*this.__indent_size,this.__ensure_cache(u),l+=this.__cache[u],l},f.prototype.__ensure_cache=function(s){for(;s>=this.__cache.length;)this.__add_column()},f.prototype.__add_column=function(){var s=this.__cache.length,u=0,l="";this.__indent_size&&s>=this.__indent_size&&(u=Math.floor(s/this.__indent_size),s-=u*this.__indent_size,l=new Array(u+1).join(this.__indent_string)),s&&(l+=new Array(s+1).join(" ")),this.__cache.push(l)};function h(s,u){this.__indent_cache=new f(s,u),this.raw=!1,this._end_with_newline=s.end_with_newline,this.indent_size=s.indent_size,this.wrap_line_length=s.wrap_line_length,this.indent_empty_lines=s.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new p(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}h.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},h.prototype.get_line_number=function(){return this.__lines.length},h.prototype.get_indent_string=function(s,u){return this.__indent_cache.get_indent_string(s,u)},h.prototype.get_indent_size=function(s,u){return this.__indent_cache.get_indent_size(s,u)},h.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},h.prototype.add_new_line=function(s){return this.is_empty()||!s&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},h.prototype.get_code=function(s){this.trim(!0);var u=this.current_line.pop();u&&(u[u.length-1]===`
`&&(u=u.replace(/\n+$/g,"")),this.current_line.push(u)),this._end_with_newline&&this.__add_outputline();var l=this.__lines.join(`
`);return s!==`
`&&(l=l.replace(/[\n]/g,s)),l},h.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},h.prototype.set_indent=function(s,u){return s=s||0,u=u||0,this.next_line.set_indent(s,u),this.__lines.length>1?(this.current_line.set_indent(s,u),!0):(this.current_line.set_indent(),!1)},h.prototype.add_raw_token=function(s){for(var u=0;u<s.newlines;u++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(s.whitespace_before),this.current_line.push(s.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},h.prototype.add_token=function(s){this.__add_space_before_token(),this.current_line.push(s),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},h.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},h.prototype.remove_indent=function(s){for(var u=this.__lines.length;s<u;)this.__lines[s]._remove_indent(),s++;this.current_line._remove_wrap_indent()},h.prototype.trim=function(s){for(s=s===void 0?!1:s,this.current_line.trim();s&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},h.prototype.just_added_newline=function(){return this.current_line.is_empty()},h.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},h.prototype.ensure_empty_line_above=function(s,u){for(var l=this.__lines.length-2;l>=0;){var a=this.__lines[l];if(a.is_empty())break;if(a.item(0).indexOf(s)!==0&&a.item(-1)!==u){this.__lines.splice(l+1,0,new p(this)),this.previous_line=this.__lines[this.__lines.length-2];break}l--}},m.exports.Output=h},function(m){function p(f,h,s,u){this.type=f,this.text=h,this.comments_before=null,this.newlines=s||0,this.whitespace_before=u||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}m.exports.Token=p},,,function(m){function p(s,u){this.raw_options=f(s,u),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs",this.indent_char===" "),this.indent_with_tabs&&(this.indent_char=" ",this.indent_size===1&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","django","erb","handlebars","php","smarty"],["auto"])}p.prototype._get_array=function(s,u){var l=this.raw_options[s],a=u||[];return typeof l=="object"?l!==null&&typeof l.concat=="function"&&(a=l.concat()):typeof l=="string"&&(a=l.split(/[^a-zA-Z0-9_\/\-]+/)),a},p.prototype._get_boolean=function(s,u){var l=this.raw_options[s],a=l===void 0?!!u:!!l;return a},p.prototype._get_characters=function(s,u){var l=this.raw_options[s],a=u||"";return typeof l=="string"&&(a=l.replace(/\\r/,"\r").replace(/\\n/,`
`).replace(/\\t/," ")),a},p.prototype._get_number=function(s,u){var l=this.raw_options[s];u=parseInt(u,10),isNaN(u)&&(u=0);var a=parseInt(l,10);return isNaN(a)&&(a=u),a},p.prototype._get_selection=function(s,u,l){var a=this._get_selection_list(s,u,l);if(a.length!==1)throw new Error("Invalid Option Value: The option '"+s+`' can only be one of the following values:
`+u+`
You passed in: '`+this.raw_options[s]+"'");return a[0]},p.prototype._get_selection_list=function(s,u,l){if(!u||u.length===0)throw new Error("Selection list cannot be empty.");if(l=l||[u[0]],!this._is_valid_selection(l,u))throw new Error("Invalid Default Value!");var a=this._get_array(s,l);if(!this._is_valid_selection(a,u))throw new Error("Invalid Option Value: The option '"+s+`' can contain only the following values:
`+u+`
You passed in: '`+this.raw_options[s]+"'");return a},p.prototype._is_valid_selection=function(s,u){return s.length&&u.length&&!s.some(function(l){return u.indexOf(l)===-1})};function f(s,u){var l={};s=h(s);var a;for(a in s)a!==u&&(l[a]=s[a]);if(u&&s[u])for(a in s[u])l[a]=s[u][a];return l}function h(s){var u={},l;for(l in s){var a=l.replace(/-/g,"_");u[a]=s[l]}return u}m.exports.Options=p,m.exports.normalizeOpts=h,m.exports.mergeOpts=f},,function(m){var p=RegExp.prototype.hasOwnProperty("sticky");function f(h){this.__input=h||"",this.__input_length=this.__input.length,this.__position=0}f.prototype.restart=function(){this.__position=0},f.prototype.back=function(){this.__position>0&&(this.__position-=1)},f.prototype.hasNext=function(){return this.__position<this.__input_length},f.prototype.next=function(){var h=null;return this.hasNext()&&(h=this.__input.charAt(this.__position),this.__position+=1),h},f.prototype.peek=function(h){var s=null;return h=h||0,h+=this.__position,h>=0&&h<this.__input_length&&(s=this.__input.charAt(h)),s},f.prototype.__match=function(h,s){h.lastIndex=s;var u=h.exec(this.__input);return u&&!(p&&h.sticky)&&(u.index!==s&&(u=null)),u},f.prototype.test=function(h,s){return s=s||0,s+=this.__position,s>=0&&s<this.__input_length?!!this.__match(h,s):!1},f.prototype.testChar=function(h,s){var u=this.peek(s);return h.lastIndex=0,u!==null&&h.test(u)},f.prototype.match=function(h){var s=this.__match(h,this.__position);return s?this.__position+=s[0].length:s=null,s},f.prototype.read=function(h,s,u){var l="",a;return h&&(a=this.match(h),a&&(l+=a[0])),s&&(a||!h)&&(l+=this.readUntil(s,u)),l},f.prototype.readUntil=function(h,s){var u="",l=this.__position;h.lastIndex=this.__position;var a=h.exec(this.__input);return a?(l=a.index,s&&(l+=a[0].length)):l=this.__input_length,u=this.__input.substring(this.__position,l),this.__position=l,u},f.prototype.readUntilAfter=function(h){return this.readUntil(h,!0)},f.prototype.get_regexp=function(h,s){var u=null,l="g";return s&&p&&(l="y"),typeof h=="string"&&h!==""?u=new RegExp(h,l):h&&(u=new RegExp(h.source,l)),u},f.prototype.get_literal_regexp=function(h){return RegExp(h.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},f.prototype.peekUntilAfter=function(h){var s=this.__position,u=this.readUntilAfter(h);return this.__position=s,u},f.prototype.lookBack=function(h){var s=this.__position-1;return s>=h.length&&this.__input.substring(s-h.length,s).toLowerCase()===h},m.exports.InputScanner=f},function(m,p,f){var h=f(8).InputScanner,s=f(3).Token,u=f(10).TokenStream,l=f(11).WhitespacePattern,a={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},o=function(c,L){this._input=new h(c),this._options=L||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new l(this._input)};o.prototype.tokenize=function(){this._input.restart(),this.__tokens=new u,this._reset();for(var c,L=new s(a.START,""),w=null,T=[],O=new u;L.type!==a.EOF;){for(c=this._get_next_token(L,w);this._is_comment(c);)O.add(c),c=this._get_next_token(L,w);O.isEmpty()||(c.comments_before=O,O=new u),c.parent=w,this._is_opening(c)?(T.push(w),w=c):w&&this._is_closing(c,w)&&(c.opened=w,w.closed=c,w=T.pop(),c.parent=w),c.previous=L,L.next=c,this.__tokens.add(c),L=c}return this.__tokens},o.prototype._is_first_token=function(){return this.__tokens.isEmpty()},o.prototype._reset=function(){},o.prototype._get_next_token=function(c,L){this._readWhitespace();var w=this._input.read(/.+/g);return w?this._create_token(a.RAW,w):this._create_token(a.EOF,"")},o.prototype._is_comment=function(c){return!1},o.prototype._is_opening=function(c){return!1},o.prototype._is_closing=function(c,L){return!1},o.prototype._create_token=function(c,L){var w=new s(c,L,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return w},o.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},m.exports.Tokenizer=o,m.exports.TOKEN=a},function(m){function p(f){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=f}p.prototype.restart=function(){this.__position=0},p.prototype.isEmpty=function(){return this.__tokens_length===0},p.prototype.hasNext=function(){return this.__position<this.__tokens_length},p.prototype.next=function(){var f=null;return this.hasNext()&&(f=this.__tokens[this.__position],this.__position+=1),f},p.prototype.peek=function(f){var h=null;return f=f||0,f+=this.__position,f>=0&&f<this.__tokens_length&&(h=this.__tokens[f]),h},p.prototype.add=function(f){this.__parent_token&&(f.parent=this.__parent_token),this.__tokens.push(f),this.__tokens_length+=1},m.exports.TokenStream=p},function(m,p,f){var h=f(12).Pattern;function s(u,l){h.call(this,u,l),l?this._line_regexp=this._input.get_regexp(l._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}s.prototype=new h,s.prototype.__set_whitespace_patterns=function(u,l){u+="\\t ",l+="\\n\\r",this._match_pattern=this._input.get_regexp("["+u+l+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+l+"]")},s.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var u=this._input.read(this._match_pattern);if(u===" ")this.whitespace_before_token=" ";else if(u){var l=this.__split(this._newline_regexp,u);this.newline_count=l.length-1,this.whitespace_before_token=l[this.newline_count]}return u},s.prototype.matching=function(u,l){var a=this._create();return a.__set_whitespace_patterns(u,l),a._update(),a},s.prototype._create=function(){return new s(this._input,this)},s.prototype.__split=function(u,l){u.lastIndex=0;for(var a=0,o=[],c=u.exec(l);c;)o.push(l.substring(a,c.index)),a=c.index+c[0].length,c=u.exec(l);return a<l.length?o.push(l.substring(a,l.length)):o.push(""),o},m.exports.WhitespacePattern=s},function(m){function p(f,h){this._input=f,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,h&&(this._starting_pattern=this._input.get_regexp(h._starting_pattern,!0),this._match_pattern=this._input.get_regexp(h._match_pattern,!0),this._until_pattern=this._input.get_regexp(h._until_pattern),this._until_after=h._until_after)}p.prototype.read=function(){var f=this._input.read(this._starting_pattern);return(!this._starting_pattern||f)&&(f+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),f},p.prototype.read_match=function(){return this._input.match(this._match_pattern)},p.prototype.until_after=function(f){var h=this._create();return h._until_after=!0,h._until_pattern=this._input.get_regexp(f),h._update(),h},p.prototype.until=function(f){var h=this._create();return h._until_after=!1,h._until_pattern=this._input.get_regexp(f),h._update(),h},p.prototype.starting_with=function(f){var h=this._create();return h._starting_pattern=this._input.get_regexp(f,!0),h._update(),h},p.prototype.matching=function(f){var h=this._create();return h._match_pattern=this._input.get_regexp(f,!0),h._update(),h},p.prototype._create=function(){return new p(this._input,this)},p.prototype._update=function(){},m.exports.Pattern=p},function(m){function p(f,h){f=typeof f=="string"?f:f.source,h=typeof h=="string"?h:h.source,this.__directives_block_pattern=new RegExp(f+/ beautify( \w+[:]\w+)+ /.source+h,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(f+/\sbeautify\signore:end\s/.source+h,"g")}p.prototype.get_directives=function(f){if(!f.match(this.__directives_block_pattern))return null;var h={};this.__directive_pattern.lastIndex=0;for(var s=this.__directive_pattern.exec(f);s;)h[s[1]]=s[2],s=this.__directive_pattern.exec(f);return h},p.prototype.readIgnored=function(f){return f.readUntilAfter(this.__directives_end_ignore_pattern)},m.exports.Directives=p},function(m,p,f){var h=f(12).Pattern,s={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1};function u(l,a){h.call(this,l,a),this.__template_pattern=null,this._disabled=Object.assign({},s),this._excluded=Object.assign({},s),a&&(this.__template_pattern=this._input.get_regexp(a.__template_pattern),this._excluded=Object.assign(this._excluded,a._excluded),this._disabled=Object.assign(this._disabled,a._disabled));var o=new h(l);this.__patterns={handlebars_comment:o.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:o.starting_with(/{{{/).until_after(/}}}/),handlebars:o.starting_with(/{{/).until_after(/}}/),php:o.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:o.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:o.starting_with(/{%/).until_after(/%}/),django_value:o.starting_with(/{{/).until_after(/}}/),django_comment:o.starting_with(/{#/).until_after(/#}/),smarty:o.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:o.starting_with(/{\*/).until_after(/\*}/),smarty_literal:o.starting_with(/{literal}/).until_after(/{\/literal}/)}}u.prototype=new h,u.prototype._create=function(){return new u(this._input,this)},u.prototype._update=function(){this.__set_templated_pattern()},u.prototype.disable=function(l){var a=this._create();return a._disabled[l]=!0,a._update(),a},u.prototype.read_options=function(l){var a=this._create();for(var o in s)a._disabled[o]=l.templating.indexOf(o)===-1;return a._update(),a},u.prototype.exclude=function(l){var a=this._create();return a._excluded[l]=!0,a._update(),a},u.prototype.read=function(){var l="";this._match_pattern?l=this._input.read(this._starting_pattern):l=this._input.read(this._starting_pattern,this.__template_pattern);for(var a=this._read_template();a;)this._match_pattern?a+=this._input.read(this._match_pattern):a+=this._input.readUntil(this.__template_pattern),l+=a,a=this._read_template();return this._until_after&&(l+=this._input.readUntilAfter(this._until_pattern)),l},u.prototype.__set_templated_pattern=function(){var l=[];this._disabled.php||l.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||l.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||l.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(l.push(this.__patterns.django._starting_pattern.source),l.push(this.__patterns.django_value._starting_pattern.source),l.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||l.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&l.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+l.join("|")+")")},u.prototype._read_template=function(){var l="",a=this._input.peek();if(a==="<"){var o=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&o==="?"&&(l=l||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&o==="%"&&(l=l||this.__patterns.erb.read())}else a==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(l=l||this.__patterns.handlebars_comment.read(),l=l||this.__patterns.handlebars_unescaped.read(),l=l||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(l=l||this.__patterns.django_value.read()),this._excluded.django||(l=l||this.__patterns.django_comment.read(),l=l||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(l=l||this.__patterns.smarty_comment.read(),l=l||this.__patterns.smarty_literal.read(),l=l||this.__patterns.smarty.read()));return l},m.exports.TemplatablePattern=u},,,,function(m,p,f){var h=f(19).Beautifier,s=f(20).Options;function u(l,a,o,c){var L=new h(l,a,o,c);return L.beautify()}m.exports=u,m.exports.defaultOptions=function(){return new s}},function(m,p,f){var h=f(20).Options,s=f(2).Output,u=f(21).Tokenizer,l=f(21).TOKEN,a=/\r\n|[\r\n]/,o=/\r\n|[\r\n]/g,c=function(b,g){this.indent_level=0,this.alignment_size=0,this.max_preserve_newlines=b.max_preserve_newlines,this.preserve_newlines=b.preserve_newlines,this._output=new s(b,g)};c.prototype.current_line_has_match=function(b){return this._output.current_line.has_match(b)},c.prototype.set_space_before_token=function(b,g){this._output.space_before_token=b,this._output.non_breaking_space=g},c.prototype.set_wrap_point=function(){this._output.set_indent(this.indent_level,this.alignment_size),this._output.set_wrap_point()},c.prototype.add_raw_token=function(b){this._output.add_raw_token(b)},c.prototype.print_preserved_newlines=function(b){var g=0;b.type!==l.TEXT&&b.previous.type!==l.TEXT&&(g=b.newlines?1:0),this.preserve_newlines&&(g=b.newlines<this.max_preserve_newlines+1?b.newlines:this.max_preserve_newlines+1);for(var _=0;_<g;_++)this.print_newline(_>0);return g!==0},c.prototype.traverse_whitespace=function(b){return b.whitespace_before||b.newlines?(this.print_preserved_newlines(b)||(this._output.space_before_token=!0),!0):!1},c.prototype.previous_token_wrapped=function(){return this._output.previous_token_wrapped},c.prototype.print_newline=function(b){this._output.add_new_line(b)},c.prototype.print_token=function(b){b.text&&(this._output.set_indent(this.indent_level,this.alignment_size),this._output.add_token(b.text))},c.prototype.indent=function(){this.indent_level++},c.prototype.get_full_indent=function(b){return b=this.indent_level+(b||0),b<1?"":this._output.get_indent_string(b)};var L=function(b){for(var g=null,_=b.next;_.type!==l.EOF&&b.closed!==_;){if(_.type===l.ATTRIBUTE&&_.text==="type"){_.next&&_.next.type===l.EQUALS&&_.next.next&&_.next.next.type===l.VALUE&&(g=_.next.next.text);break}_=_.next}return g},w=function(b,g){var _=null,F=null;return g.closed?(b==="script"?_="text/javascript":b==="style"&&(_="text/css"),_=L(g)||_,_.search("text/css")>-1?F="css":_.search(/module|((text|application|dojo)\/(x-)?(javascript|ecmascript|jscript|livescript|(ld\+)?json|method|aspect))/)>-1?F="javascript":_.search(/(text|application|dojo)\/(x-)?(html)/)>-1?F="html":_.search(/test\/null/)>-1&&(F="null"),F):null};function T(b,g){return g.indexOf(b)!==-1}function O(b,g,_){this.parent=b||null,this.tag=g?g.tag_name:"",this.indent_level=_||0,this.parser_token=g||null}function A(b){this._printer=b,this._current_frame=null}A.prototype.get_parser_token=function(){return this._current_frame?this._current_frame.parser_token:null},A.prototype.record_tag=function(b){var g=new O(this._current_frame,b,this._printer.indent_level);this._current_frame=g},A.prototype._try_pop_frame=function(b){var g=null;return b&&(g=b.parser_token,this._printer.indent_level=b.indent_level,this._current_frame=b.parent),g},A.prototype._get_frame=function(b,g){for(var _=this._current_frame;_&&!(b.indexOf(_.tag)!==-1);){if(g&&g.indexOf(_.tag)!==-1){_=null;break}_=_.parent}return _},A.prototype.try_pop=function(b,g){var _=this._get_frame([b],g);return this._try_pop_frame(_)},A.prototype.indent_to_tag=function(b){var g=this._get_frame(b);g&&(this._printer.indent_level=g.indent_level)};function x(b,g,_,F){this._source_text=b||"",g=g||{},this._js_beautify=_,this._css_beautify=F,this._tag_stack=null;var D=new h(g,"html");this._options=D,this._is_wrap_attributes_force=this._options.wrap_attributes.substr(0,"force".length)==="force",this._is_wrap_attributes_force_expand_multiline=this._options.wrap_attributes==="force-expand-multiline",this._is_wrap_attributes_force_aligned=this._options.wrap_attributes==="force-aligned",this._is_wrap_attributes_aligned_multiple=this._options.wrap_attributes==="aligned-multiple",this._is_wrap_attributes_preserve=this._options.wrap_attributes.substr(0,"preserve".length)==="preserve",this._is_wrap_attributes_preserve_aligned=this._options.wrap_attributes==="preserve-aligned"}x.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var b=this._source_text,g=this._options.eol;this._options.eol==="auto"&&(g=`
`,b&&a.test(b)&&(g=b.match(a)[0])),b=b.replace(o,`
`);var _=b.match(/^[\t ]*/)[0],F={text:"",type:""},D=new S,j=new c(this._options,_),H=new u(b,this._options).tokenize();this._tag_stack=new A(j);for(var k=null,y=H.next();y.type!==l.EOF;)y.type===l.TAG_OPEN||y.type===l.COMMENT?(k=this._handle_tag_open(j,y,D,F),D=k):y.type===l.ATTRIBUTE||y.type===l.EQUALS||y.type===l.VALUE||y.type===l.TEXT&&!D.tag_complete?k=this._handle_inside_tag(j,y,D,H):y.type===l.TAG_CLOSE?k=this._handle_tag_close(j,y,D):y.type===l.TEXT?k=this._handle_text(j,y,D):j.add_raw_token(y),F=k,y=H.next();var G=j._output.get_code(g);return G},x.prototype._handle_tag_close=function(b,g,_){var F={text:g.text,type:g.type};return b.alignment_size=0,_.tag_complete=!0,b.set_space_before_token(g.newlines||g.whitespace_before!=="",!0),_.is_unformatted?b.add_raw_token(g):(_.tag_start_char==="<"&&(b.set_space_before_token(g.text[0]==="/",!0),this._is_wrap_attributes_force_expand_multiline&&_.has_wrapped_attrs&&b.print_newline(!1)),b.print_token(g)),_.indent_content&&!(_.is_unformatted||_.is_content_unformatted)&&(b.indent(),_.indent_content=!1),!_.is_inline_element&&!(_.is_unformatted||_.is_content_unformatted)&&b.set_wrap_point(),F},x.prototype._handle_inside_tag=function(b,g,_,F){var D=_.has_wrapped_attrs,j={text:g.text,type:g.type};if(b.set_space_before_token(g.newlines||g.whitespace_before!=="",!0),_.is_unformatted)b.add_raw_token(g);else if(_.tag_start_char==="{"&&g.type===l.TEXT)b.print_preserved_newlines(g)?(g.newlines=0,b.add_raw_token(g)):b.print_token(g);else{if(g.type===l.ATTRIBUTE?(b.set_space_before_token(!0),_.attr_count+=1):(g.type===l.EQUALS||g.type===l.VALUE&&g.previous.type===l.EQUALS)&&b.set_space_before_token(!1),g.type===l.ATTRIBUTE&&_.tag_start_char==="<"&&((this._is_wrap_attributes_preserve||this._is_wrap_attributes_preserve_aligned)&&(b.traverse_whitespace(g),D=D||g.newlines!==0),this._is_wrap_attributes_force)){var H=_.attr_count>1;if(this._is_wrap_attributes_force_expand_multiline&&_.attr_count===1){var k=!0,y=0,G;do{if(G=F.peek(y),G.type===l.ATTRIBUTE){k=!1;break}y+=1}while(y<4&&G.type!==l.EOF&&G.type!==l.TAG_CLOSE);H=!k}H&&(b.print_newline(!1),D=!0)}b.print_token(g),D=D||b.previous_token_wrapped(),_.has_wrapped_attrs=D}return j},x.prototype._handle_text=function(b,g,_){var F={text:g.text,type:"TK_CONTENT"};return _.custom_beautifier_name?this._print_custom_beatifier_text(b,g,_):_.is_unformatted||_.is_content_unformatted?b.add_raw_token(g):(b.traverse_whitespace(g),b.print_token(g)),F},x.prototype._print_custom_beatifier_text=function(b,g,_){var F=this;if(g.text!==""){var D=g.text,j,H=1,k="",y="";_.custom_beautifier_name==="javascript"&&typeof this._js_beautify=="function"?j=this._js_beautify:_.custom_beautifier_name==="css"&&typeof this._css_beautify=="function"?j=this._css_beautify:_.custom_beautifier_name==="html"&&(j=function(ve,Se){var Ce=new x(ve,Se,F._js_beautify,F._css_beautify);return Ce.beautify()}),this._options.indent_scripts==="keep"?H=0:this._options.indent_scripts==="separate"&&(H=-b.indent_level);var G=b.get_full_indent(H);if(D=D.replace(/\n[ \t]*$/,""),_.custom_beautifier_name!=="html"&&D[0]==="<"&&D.match(/^(<!--|<!\[CDATA\[)/)){var Y=/^(<!--[^\n]*|<!\[CDATA\[)(\n?)([ \t\n]*)([\s\S]*)(-->|]]>)$/.exec(D);if(!Y){b.add_raw_token(g);return}k=G+Y[1]+`
`,D=Y[4],Y[5]&&(y=G+Y[5]),D=D.replace(/\n[ \t]*$/,""),(Y[2]||Y[3].indexOf(`
`)!==-1)&&(Y=Y[3].match(/[ \t]+$/),Y&&(g.whitespace_before=Y[0]))}if(D)if(j){var ie=function(){this.eol=`
`};ie.prototype=this._options.raw_options;var se=new ie;D=j(G+D,se)}else{var we=g.whitespace_before;we&&(D=D.replace(new RegExp(`
(`+we+")?","g"),`
`)),D=G+D.replace(/\n/g,`
`+G)}k&&(D?D=k+D+`
`+y:D=k+y),b.print_newline(!1),D&&(g.text=D,g.whitespace_before="",g.newlines=0,b.add_raw_token(g),b.print_newline(!0))}},x.prototype._handle_tag_open=function(b,g,_,F){var D=this._get_tag_open_token(g);return(_.is_unformatted||_.is_content_unformatted)&&!_.is_empty_element&&g.type===l.TAG_OPEN&&g.text.indexOf("</")===0?(b.add_raw_token(g),D.start_tag_token=this._tag_stack.try_pop(D.tag_name)):(b.traverse_whitespace(g),this._set_tag_position(b,g,D,_,F),D.is_inline_element||b.set_wrap_point(),b.print_token(g)),(this._is_wrap_attributes_force_aligned||this._is_wrap_attributes_aligned_multiple||this._is_wrap_attributes_preserve_aligned)&&(D.alignment_size=g.text.length+1),!D.tag_complete&&!D.is_unformatted&&(b.alignment_size=D.alignment_size),D};var S=function(b,g){if(this.parent=b||null,this.text="",this.type="TK_TAG_OPEN",this.tag_name="",this.is_inline_element=!1,this.is_unformatted=!1,this.is_content_unformatted=!1,this.is_empty_element=!1,this.is_start_tag=!1,this.is_end_tag=!1,this.indent_content=!1,this.multiline_content=!1,this.custom_beautifier_name=null,this.start_tag_token=null,this.attr_count=0,this.has_wrapped_attrs=!1,this.alignment_size=0,this.tag_complete=!1,this.tag_start_char="",this.tag_check="",!g)this.tag_complete=!0;else{var _;this.tag_start_char=g.text[0],this.text=g.text,this.tag_start_char==="<"?(_=g.text.match(/^<([^\s>]*)/),this.tag_check=_?_[1]:""):(_=g.text.match(/^{{~?(?:[\^]|#\*?)?([^\s}]+)/),this.tag_check=_?_[1]:"",(g.text.startsWith("{{#>")||g.text.startsWith("{{~#>"))&&this.tag_check[0]===">"&&(this.tag_check===">"&&g.next!==null?this.tag_check=g.next.text.split(" ")[0]:this.tag_check=g.text.split(">")[1])),this.tag_check=this.tag_check.toLowerCase(),g.type===l.COMMENT&&(this.tag_complete=!0),this.is_start_tag=this.tag_check.charAt(0)!=="/",this.tag_name=this.is_start_tag?this.tag_check:this.tag_check.substr(1),this.is_end_tag=!this.is_start_tag||g.closed&&g.closed.text==="/>";var F=2;this.tag_start_char==="{"&&this.text.length>=3&&(this.text.charAt(2)==="~"&&(F=3)),this.is_end_tag=this.is_end_tag||this.tag_start_char==="{"&&(this.text.length<3||/[^#\^]/.test(this.text.charAt(F)))}};x.prototype._get_tag_open_token=function(b){var g=new S(this._tag_stack.get_parser_token(),b);return g.alignment_size=this._options.wrap_attributes_indent_size,g.is_end_tag=g.is_end_tag||T(g.tag_check,this._options.void_elements),g.is_empty_element=g.tag_complete||g.is_start_tag&&g.is_end_tag,g.is_unformatted=!g.tag_complete&&T(g.tag_check,this._options.unformatted),g.is_content_unformatted=!g.is_empty_element&&T(g.tag_check,this._options.content_unformatted),g.is_inline_element=T(g.tag_name,this._options.inline)||g.tag_name.includes("-")||g.tag_start_char==="{",g},x.prototype._set_tag_position=function(b,g,_,F,D){if(_.is_empty_element||(_.is_end_tag?_.start_tag_token=this._tag_stack.try_pop(_.tag_name):(this._do_optional_end_element(_)&&(_.is_inline_element||b.print_newline(!1)),this._tag_stack.record_tag(_),(_.tag_name==="script"||_.tag_name==="style")&&!(_.is_unformatted||_.is_content_unformatted)&&(_.custom_beautifier_name=w(_.tag_check,g)))),T(_.tag_check,this._options.extra_liners)&&(b.print_newline(!1),b._output.just_added_blankline()||b.print_newline(!0)),_.is_empty_element){if(_.tag_start_char==="{"&&_.tag_check==="else"){this._tag_stack.indent_to_tag(["if","unless","each"]),_.indent_content=!0;var j=b.current_line_has_match(/{{#if/);j||b.print_newline(!1)}_.tag_name==="!--"&&D.type===l.TAG_CLOSE&&F.is_end_tag&&_.text.indexOf(`
`)===-1||(_.is_inline_element||_.is_unformatted||b.print_newline(!1),this._calcluate_parent_multiline(b,_))}else if(_.is_end_tag){var H=!1;H=_.start_tag_token&&_.start_tag_token.multiline_content,H=H||!_.is_inline_element&&!(F.is_inline_element||F.is_unformatted)&&!(D.type===l.TAG_CLOSE&&_.start_tag_token===F)&&D.type!=="TK_CONTENT",(_.is_content_unformatted||_.is_unformatted)&&(H=!1),H&&b.print_newline(!1)}else _.indent_content=!_.custom_beautifier_name,_.tag_start_char==="<"&&(_.tag_name==="html"?_.indent_content=this._options.indent_inner_html:_.tag_name==="head"?_.indent_content=this._options.indent_head_inner_html:_.tag_name==="body"&&(_.indent_content=this._options.indent_body_inner_html)),!(_.is_inline_element||_.is_unformatted)&&(D.type!=="TK_CONTENT"||_.is_content_unformatted)&&b.print_newline(!1),this._calcluate_parent_multiline(b,_)},x.prototype._calcluate_parent_multiline=function(b,g){g.parent&&b._output.just_added_newline()&&!((g.is_inline_element||g.is_unformatted)&&g.parent.is_inline_element)&&(g.parent.multiline_content=!0)};var E=["address","article","aside","blockquote","details","div","dl","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hr","main","nav","ol","p","pre","section","table","ul"],d=["a","audio","del","ins","map","noscript","video"];x.prototype._do_optional_end_element=function(b){var g=null;if(b.is_empty_element||!b.is_start_tag||!b.parent)return;if(b.tag_name==="body")g=g||this._tag_stack.try_pop("head");else if(b.tag_name==="li")g=g||this._tag_stack.try_pop("li",["ol","ul"]);else if(b.tag_name==="dd"||b.tag_name==="dt")g=g||this._tag_stack.try_pop("dt",["dl"]),g=g||this._tag_stack.try_pop("dd",["dl"]);else if(b.parent.tag_name==="p"&&E.indexOf(b.tag_name)!==-1){var _=b.parent.parent;(!_||d.indexOf(_.tag_name)===-1)&&(g=g||this._tag_stack.try_pop("p"))}else b.tag_name==="rp"||b.tag_name==="rt"?(g=g||this._tag_stack.try_pop("rt",["ruby","rtc"]),g=g||this._tag_stack.try_pop("rp",["ruby","rtc"])):b.tag_name==="optgroup"?g=g||this._tag_stack.try_pop("optgroup",["select"]):b.tag_name==="option"?g=g||this._tag_stack.try_pop("option",["select","datalist","optgroup"]):b.tag_name==="colgroup"?g=g||this._tag_stack.try_pop("caption",["table"]):b.tag_name==="thead"?(g=g||this._tag_stack.try_pop("caption",["table"]),g=g||this._tag_stack.try_pop("colgroup",["table"])):b.tag_name==="tbody"||b.tag_name==="tfoot"?(g=g||this._tag_stack.try_pop("caption",["table"]),g=g||this._tag_stack.try_pop("colgroup",["table"]),g=g||this._tag_stack.try_pop("thead",["table"]),g=g||this._tag_stack.try_pop("tbody",["table"])):b.tag_name==="tr"?(g=g||this._tag_stack.try_pop("caption",["table"]),g=g||this._tag_stack.try_pop("colgroup",["table"]),g=g||this._tag_stack.try_pop("tr",["table","thead","tbody","tfoot"])):(b.tag_name==="th"||b.tag_name==="td")&&(g=g||this._tag_stack.try_pop("td",["table","thead","tbody","tfoot","tr"]),g=g||this._tag_stack.try_pop("th",["table","thead","tbody","tfoot","tr"]));return b.parent=this._tag_stack.get_parser_token(),g},m.exports.Beautifier=x},function(m,p,f){var h=f(6).Options;function s(u){h.call(this,u,"html"),this.templating.length===1&&this.templating[0]==="auto"&&(this.templating=["django","erb","handlebars","php"]),this.indent_inner_html=this._get_boolean("indent_inner_html"),this.indent_body_inner_html=this._get_boolean("indent_body_inner_html",!0),this.indent_head_inner_html=this._get_boolean("indent_head_inner_html",!0),this.indent_handlebars=this._get_boolean("indent_handlebars",!0),this.wrap_attributes=this._get_selection("wrap_attributes",["auto","force","force-aligned","force-expand-multiline","aligned-multiple","preserve","preserve-aligned"]),this.wrap_attributes_indent_size=this._get_number("wrap_attributes_indent_size",this.indent_size),this.extra_liners=this._get_array("extra_liners",["head","body","/html"]),this.inline=this._get_array("inline",["a","abbr","area","audio","b","bdi","bdo","br","button","canvas","cite","code","data","datalist","del","dfn","em","embed","i","iframe","img","input","ins","kbd","keygen","label","map","mark","math","meter","noscript","object","output","progress","q","ruby","s","samp","select","small","span","strong","sub","sup","svg","template","textarea","time","u","var","video","wbr","text","acronym","big","strike","tt"]),this.void_elements=this._get_array("void_elements",["area","base","br","col","embed","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr","!doctype","?xml","basefont","isindex"]),this.unformatted=this._get_array("unformatted",[]),this.content_unformatted=this._get_array("content_unformatted",["pre","textarea"]),this.unformatted_content_delimiter=this._get_characters("unformatted_content_delimiter"),this.indent_scripts=this._get_selection("indent_scripts",["normal","keep","separate"])}s.prototype=new h,m.exports.Options=s},function(m,p,f){var h=f(9).Tokenizer,s=f(9).TOKEN,u=f(13).Directives,l=f(14).TemplatablePattern,a=f(12).Pattern,o={TAG_OPEN:"TK_TAG_OPEN",TAG_CLOSE:"TK_TAG_CLOSE",ATTRIBUTE:"TK_ATTRIBUTE",EQUALS:"TK_EQUALS",VALUE:"TK_VALUE",COMMENT:"TK_COMMENT",TEXT:"TK_TEXT",UNKNOWN:"TK_UNKNOWN",START:s.START,RAW:s.RAW,EOF:s.EOF},c=new u(/<\!--/,/-->/),L=function(w,T){h.call(this,w,T),this._current_tag_name="";var O=new l(this._input).read_options(this._options),A=new a(this._input);if(this.__patterns={word:O.until(/[\n\r\t <]/),single_quote:O.until_after(/'/),double_quote:O.until_after(/"/),attribute:O.until(/[\n\r\t =>]|\/>/),element_name:O.until(/[\n\r\t >\/]/),handlebars_comment:A.starting_with(/{{!--/).until_after(/--}}/),handlebars:A.starting_with(/{{/).until_after(/}}/),handlebars_open:A.until(/[\n\r\t }]/),handlebars_raw_close:A.until(/}}/),comment:A.starting_with(/<!--/).until_after(/-->/),cdata:A.starting_with(/<!\[CDATA\[/).until_after(/]]>/),conditional_comment:A.starting_with(/<!\[/).until_after(/]>/),processing:A.starting_with(/<\?/).until_after(/\?>/)},this._options.indent_handlebars&&(this.__patterns.word=this.__patterns.word.exclude("handlebars")),this._unformatted_content_delimiter=null,this._options.unformatted_content_delimiter){var x=this._input.get_literal_regexp(this._options.unformatted_content_delimiter);this.__patterns.unformatted_content_delimiter=A.matching(x).until_after(x)}};L.prototype=new h,L.prototype._is_comment=function(w){return!1},L.prototype._is_opening=function(w){return w.type===o.TAG_OPEN},L.prototype._is_closing=function(w,T){return w.type===o.TAG_CLOSE&&T&&((w.text===">"||w.text==="/>")&&T.text[0]==="<"||w.text==="}}"&&T.text[0]==="{"&&T.text[1]==="{")},L.prototype._reset=function(){this._current_tag_name=""},L.prototype._get_next_token=function(w,T){var O=null;this._readWhitespace();var A=this._input.peek();return A===null?this._create_token(o.EOF,""):(O=O||this._read_open_handlebars(A,T),O=O||this._read_attribute(A,w,T),O=O||this._read_close(A,T),O=O||this._read_raw_content(A,w,T),O=O||this._read_content_word(A),O=O||this._read_comment_or_cdata(A),O=O||this._read_processing(A),O=O||this._read_open(A,T),O=O||this._create_token(o.UNKNOWN,this._input.next()),O)},L.prototype._read_comment_or_cdata=function(w){var T=null,O=null,A=null;if(w==="<"){var x=this._input.peek(1);x==="!"&&(O=this.__patterns.comment.read(),O?(A=c.get_directives(O),A&&A.ignore==="start"&&(O+=c.readIgnored(this._input))):O=this.__patterns.cdata.read()),O&&(T=this._create_token(o.COMMENT,O),T.directives=A)}return T},L.prototype._read_processing=function(w){var T=null,O=null,A=null;if(w==="<"){var x=this._input.peek(1);(x==="!"||x==="?")&&(O=this.__patterns.conditional_comment.read(),O=O||this.__patterns.processing.read()),O&&(T=this._create_token(o.COMMENT,O),T.directives=A)}return T},L.prototype._read_open=function(w,T){var O=null,A=null;return T||w==="<"&&(O=this._input.next(),this._input.peek()==="/"&&(O+=this._input.next()),O+=this.__patterns.element_name.read(),A=this._create_token(o.TAG_OPEN,O)),A},L.prototype._read_open_handlebars=function(w,T){var O=null,A=null;return T||this._options.indent_handlebars&&w==="{"&&this._input.peek(1)==="{"&&(this._input.peek(2)==="!"?(O=this.__patterns.handlebars_comment.read(),O=O||this.__patterns.handlebars.read(),A=this._create_token(o.COMMENT,O)):(O=this.__patterns.handlebars_open.read(),A=this._create_token(o.TAG_OPEN,O))),A},L.prototype._read_close=function(w,T){var O=null,A=null;return T&&(T.text[0]==="<"&&(w===">"||w==="/"&&this._input.peek(1)===">")?(O=this._input.next(),w==="/"&&(O+=this._input.next()),A=this._create_token(o.TAG_CLOSE,O)):T.text[0]==="{"&&w==="}"&&this._input.peek(1)==="}"&&(this._input.next(),this._input.next(),A=this._create_token(o.TAG_CLOSE,"}}"))),A},L.prototype._read_attribute=function(w,T,O){var A=null,x="";if(O&&O.text[0]==="<")if(w==="=")A=this._create_token(o.EQUALS,this._input.next());else if(w==='"'||w==="'"){var S=this._input.next();w==='"'?S+=this.__patterns.double_quote.read():S+=this.__patterns.single_quote.read(),A=this._create_token(o.VALUE,S)}else x=this.__patterns.attribute.read(),x&&(T.type===o.EQUALS?A=this._create_token(o.VALUE,x):A=this._create_token(o.ATTRIBUTE,x));return A},L.prototype._is_content_unformatted=function(w){return this._options.void_elements.indexOf(w)===-1&&(this._options.content_unformatted.indexOf(w)!==-1||this._options.unformatted.indexOf(w)!==-1)},L.prototype._read_raw_content=function(w,T,O){var A="";if(O&&O.text[0]==="{")A=this.__patterns.handlebars_raw_close.read();else if(T.type===o.TAG_CLOSE&&T.opened.text[0]==="<"&&T.text[0]!=="/"){var x=T.opened.text.substr(1).toLowerCase();if(x==="script"||x==="style"){var S=this._read_comment_or_cdata(w);if(S)return S.type=o.TEXT,S;A=this._input.readUntil(new RegExp("</"+x+"[\\n\\r\\t ]*?>","ig"))}else this._is_content_unformatted(x)&&(A=this._input.readUntil(new RegExp("</"+x+"[\\n\\r\\t ]*?>","ig")))}return A?this._create_token(o.TEXT,A):null},L.prototype._read_content_word=function(w){var T="";if(this._options.unformatted_content_delimiter&&(w===this._options.unformatted_content_delimiter[0]&&(T=this.__patterns.unformatted_content_delimiter.read())),T||(T=this.__patterns.word.read()),T)return this._create_token(o.TEXT,T)},m.exports.Tokenizer=L,m.exports.TOKEN=o}],W={};function P(m){var p=W[m];if(p!==void 0)return p.exports;var f=W[m]={exports:{}};return K[m](f,f.exports,P),f.exports}var R=P(18);M=R})();var Q=M;if(!0)!(ue=[le,le("6UM0"),le("TXwP")],Z=function(K){var W=le("6UM0"),P=le("TXwP");return{html_beautify:function(R,m){return Q(R,m,W.js_beautify,P.css_beautify)}}}.apply(ot,ue),Z!==void 0&&(_t.exports=Z));else var B,N})()},"rAM+":function(_t,ot,le){"use strict";le.d(ot,"a",function(){return Z});var ue=le("Qw5x");function Z(M,Q){var B;if(typeof Symbol=="undefined"||M[Symbol.iterator]==null){if(Array.isArray(M)||(B=Object(ue.a)(M))||Q&&M&&typeof M.length=="number"){B&&(M=B);var N=0,K=function(){};return{s:K,n:function(){return N>=M.length?{done:!0}:{done:!1,value:M[N++]}},e:function(p){throw p},f:K}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var W=!0,P=!1,R;return{s:function(){B=M[Symbol.iterator]()},n:function(){var p=B.next();return W=p.done,p},e:function(p){P=!0,R=p},f:function(){try{!W&&B.return!=null&&B.return()}finally{if(P)throw R}}}}},rUJ1:function(_t,ot){const le=/[&<>"']/,ue=/[&<>"']/g,Z=/[<>"']|&(?!#?\w+;)/,M=/[<>"']|&(?!#?\w+;)/g,Q={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},B=A=>Q[A];function N(A,x){if(x){if(le.test(A))return A.replace(ue,B)}else if(Z.test(A))return A.replace(M,B);return A}const K=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function W(A){return A.replace(K,(x,S)=>(S=S.toLowerCase(),S==="colon"?":":S.charAt(0)==="#"?S.charAt(1)==="x"?String.fromCharCode(parseInt(S.substring(2),16)):String.fromCharCode(+S.substring(1)):""))}const P=/(^|[^\[])\^/g;function R(A,x){A=A.source||A,x=x||"";const S={replace:(E,d)=>(d=d.source||d,d=d.replace(P,"$1"),A=A.replace(E,d),S),getRegex:()=>new RegExp(A,x)};return S}const m=/[^\w:]/g,p=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function f(A,x,S){if(A){let E;try{E=decodeURIComponent(W(S)).replace(m,"").toLowerCase()}catch(d){return null}if(E.indexOf("javascript:")===0||E.indexOf("vbscript:")===0||E.indexOf("data:")===0)return null}x&&!p.test(S)&&(S=a(x,S));try{S=encodeURI(S).replace(/%25/g,"%")}catch(E){return null}return S}const h={},s=/^[^:]+:\/*[^/]*$/,u=/^([^:]+:)[\s\S]*$/,l=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(A,x){h[" "+A]||(s.test(A)?h[" "+A]=A+"/":h[" "+A]=w(A,"/",!0)),A=h[" "+A];const S=A.indexOf(":")===-1;return x.substring(0,2)==="//"?S?x:A.replace(u,"$1")+x:x.charAt(0)==="/"?S?x:A.replace(l,"$1")+x:A+x}const o={exec:function(){}};function c(A){let x=1,S,E;for(;x<arguments.length;x++){S=arguments[x];for(E in S)Object.prototype.hasOwnProperty.call(S,E)&&(A[E]=S[E])}return A}function L(A,x){const S=A.replace(/\|/g,(b,g,_)=>{let F=!1,D=g;for(;--D>=0&&_[D]==="\\";)F=!F;return F?"|":" |"}),E=S.split(/ \|/);let d=0;if(E.length>x)E.splice(x);else for(;E.length<x;)E.push("");for(;d<E.length;d++)E[d]=E[d].trim().replace(/\\\|/g,"|");return E}function w(A,x,S){const E=A.length;if(E===0)return"";let d=0;for(;d<E;){const b=A.charAt(E-d-1);if(b===x&&!S)d++;else if(b!==x&&S)d++;else break}return A.substr(0,E-d)}function T(A,x){if(A.indexOf(x[1])===-1)return-1;const S=A.length;let E=0,d=0;for(;d<S;d++)if(A[d]==="\\")d++;else if(A[d]===x[0])E++;else if(A[d]===x[1]&&(E--,E<0))return d;return-1}function O(A){A&&A.sanitize&&!A.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")}_t.exports={escape:N,unescape:W,edit:R,cleanUrl:f,resolveUrl:a,noopTest:o,merge:c,splitCells:L,rtrim:w,findClosingBracket:T,checkSanitizeDeprecation:O}},ulZh:function(_t,ot,le){typeof window!="undefined"&&function(Z,M){_t.exports=M()}(this,function(){return function(ue){var Z={};function M(Q){if(Z[Q])return Z[Q].exports;var B=Z[Q]={i:Q,l:!1,exports:{}};return ue[Q].call(B.exports,B,B.exports,M),B.l=!0,B.exports}return M.m=ue,M.c=Z,M.d=function(Q,B,N){M.o(Q,B)||Object.defineProperty(Q,B,{enumerable:!0,get:N})},M.r=function(Q){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(Q,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(Q,"__esModule",{value:!0})},M.t=function(Q,B){if(B&1&&(Q=M(Q)),B&8)return Q;if(B&4&&typeof Q=="object"&&Q&&Q.__esModule)return Q;var N=Object.create(null);if(M.r(N),Object.defineProperty(N,"default",{enumerable:!0,value:Q}),B&2&&typeof Q!="string")for(var K in Q)M.d(N,K,function(W){return Q[W]}.bind(null,K));return N},M.n=function(Q){var B=Q&&Q.__esModule?function(){return Q.default}:function(){return Q};return M.d(B,"a",B),B},M.o=function(Q,B){return Object.prototype.hasOwnProperty.call(Q,B)},M.p="/dist/",M(M.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(ue,Z,M){"use strict";var Q=Object.prototype.hasOwnProperty,B="~";function N(){}Object.create&&(N.prototype=Object.create(null),new N().__proto__||(B=!1));function K(m,p,f){this.fn=m,this.context=p,this.once=f||!1}function W(m,p,f,h,s){if(typeof f!="function")throw new TypeError("The listener must be a function");var u=new K(f,h||m,s),l=B?B+p:p;return m._events[l]?m._events[l].fn?m._events[l]=[m._events[l],u]:m._events[l].push(u):(m._events[l]=u,m._eventsCount++),m}function P(m,p){--m._eventsCount===0?m._events=new N:delete m._events[p]}function R(){this._events=new N,this._eventsCount=0}R.prototype.eventNames=function(){var p=[],f,h;if(this._eventsCount===0)return p;for(h in f=this._events)Q.call(f,h)&&p.push(B?h.slice(1):h);return Object.getOwnPropertySymbols?p.concat(Object.getOwnPropertySymbols(f)):p},R.prototype.listeners=function(p){var f=B?B+p:p,h=this._events[f];if(!h)return[];if(h.fn)return[h.fn];for(var s=0,u=h.length,l=new Array(u);s<u;s++)l[s]=h[s].fn;return l},R.prototype.listenerCount=function(p){var f=B?B+p:p,h=this._events[f];return h?h.fn?1:h.length:0},R.prototype.emit=function(p,f,h,s,u,l){var a=B?B+p:p;if(!this._events[a])return!1;var o=this._events[a],c=arguments.length,L,w;if(o.fn){o.once&&this.removeListener(p,o.fn,void 0,!0);switch(c){case 1:return o.fn.call(o.context),!0;case 2:return o.fn.call(o.context,f),!0;case 3:return o.fn.call(o.context,f,h),!0;case 4:return o.fn.call(o.context,f,h,s),!0;case 5:return o.fn.call(o.context,f,h,s,u),!0;case 6:return o.fn.call(o.context,f,h,s,u,l),!0}for(w=1,L=new Array(c-1);w<c;w++)L[w-1]=arguments[w];o.fn.apply(o.context,L)}else{var T=o.length,O;for(w=0;w<T;w++){o[w].once&&this.removeListener(p,o[w].fn,void 0,!0);switch(c){case 1:o[w].fn.call(o[w].context);break;case 2:o[w].fn.call(o[w].context,f);break;case 3:o[w].fn.call(o[w].context,f,h);break;case 4:o[w].fn.call(o[w].context,f,h,s);break;default:if(!L)for(O=1,L=new Array(c-1);O<c;O++)L[O-1]=arguments[O];o[w].fn.apply(o[w].context,L)}}}return!0},R.prototype.on=function(p,f,h){return W(this,p,f,h,!1)},R.prototype.once=function(p,f,h){return W(this,p,f,h,!0)},R.prototype.removeListener=function(p,f,h,s){var u=B?B+p:p;if(!this._events[u])return this;if(!f)return P(this,u),this;var l=this._events[u];if(l.fn)l.fn===f&&(!s||l.once)&&(!h||l.context===h)&&P(this,u);else{for(var a=0,o=[],c=l.length;a<c;a++)(l[a].fn!==f||s&&!l[a].once||h&&l[a].context!==h)&&o.push(l[a]);o.length?this._events[u]=o.length===1?o[0]:o:P(this,u)}return this},R.prototype.removeAllListeners=function(p){var f;return p?(f=B?B+p:p,this._events[f]&&P(this,f)):(this._events=new N,this._eventsCount=0),this},R.prototype.off=R.prototype.removeListener,R.prototype.addListener=R.prototype.on,R.prefixed=B,R.EventEmitter=R,ue.exports=R},"./node_modules/url-toolkit/src/url-toolkit.js":function(ue,Z,M){(function(Q){var B=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,N=/^([^\/?#]*)([^]*)$/,K=/(?:\/|^)\.(?=\/)/g,W=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,P={buildAbsoluteURL:function(R,m,p){if(p=p||{},R=R.trim(),m=m.trim(),!m){if(!p.alwaysNormalize)return R;var f=P.parseURL(R);if(!f)throw new Error("Error trying to parse base URL.");return f.path=P.normalizePath(f.path),P.buildURLFromParts(f)}var h=P.parseURL(m);if(!h)throw new Error("Error trying to parse relative URL.");if(h.scheme)return p.alwaysNormalize?(h.path=P.normalizePath(h.path),P.buildURLFromParts(h)):m;var s=P.parseURL(R);if(!s)throw new Error("Error trying to parse base URL.");if(!s.netLoc&&s.path&&s.path[0]!=="/"){var u=N.exec(s.path);s.netLoc=u[1],s.path=u[2]}s.netLoc&&!s.path&&(s.path="/");var l={scheme:s.scheme,netLoc:h.netLoc,path:null,params:h.params,query:h.query,fragment:h.fragment};if(!h.netLoc&&(l.netLoc=s.netLoc,h.path[0]!=="/"))if(!h.path)l.path=s.path,h.params||(l.params=s.params,h.query||(l.query=s.query));else{var a=s.path,o=a.substring(0,a.lastIndexOf("/")+1)+h.path;l.path=P.normalizePath(o)}return l.path===null&&(l.path=p.alwaysNormalize?P.normalizePath(h.path):h.path),P.buildURLFromParts(l)},parseURL:function(R){var m=B.exec(R);return m?{scheme:m[1]||"",netLoc:m[2]||"",path:m[3]||"",params:m[4]||"",query:m[5]||"",fragment:m[6]||""}:null},normalizePath:function(R){for(R=R.split("").reverse().join("").replace(K,"");R.length!==(R=R.replace(W,"")).length;);return R.split("").reverse().join("")},buildURLFromParts:function(R){return R.scheme+R.netLoc+R.path+R.params+R.query+R.fragment}};ue.exports=P})(this)},"./node_modules/webworkify-webpack/index.js":function(ue,Z,M){function Q(p){var f={};function h(u){if(f[u])return f[u].exports;var l=f[u]={i:u,l:!1,exports:{}};return p[u].call(l.exports,l,l.exports,h),l.l=!0,l.exports}h.m=p,h.c=f,h.i=function(u){return u},h.d=function(u,l,a){h.o(u,l)||Object.defineProperty(u,l,{configurable:!1,enumerable:!0,get:a})},h.r=function(u){Object.defineProperty(u,"__esModule",{value:!0})},h.n=function(u){var l=u&&u.__esModule?function(){return u.default}:function(){return u};return h.d(l,"a",l),l},h.o=function(u,l){return Object.prototype.hasOwnProperty.call(u,l)},h.p="/",h.oe=function(u){throw console.error(u),u};var s=h(h.s=ENTRY_MODULE);return s.default||s}var B="[\\.|\\-|\\+|\\w|/|@]+",N="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+B+").*?\\)";function K(p){return(p+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function W(p){return!isNaN(1*p)}function P(p,f,h){var s={};s[h]=[];var u=f.toString(),l=u.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!l)return s;for(var a=l[1],o=new RegExp("(\\\\n|\\W)"+K(a)+N,"g"),c;c=o.exec(u);){if(c[3]==="dll-reference")continue;s[h].push(c[3])}for(o=new RegExp("\\("+K(a)+'\\("(dll-reference\\s('+B+'))"\\)\\)'+N,"g");c=o.exec(u);)p[c[2]]||(s[h].push(c[1]),p[c[2]]=M(c[1]).m),s[c[2]]=s[c[2]]||[],s[c[2]].push(c[4]);for(var L=Object.keys(s),w=0;w<L.length;w++)for(var T=0;T<s[L[w]].length;T++)W(s[L[w]][T])&&(s[L[w]][T]=1*s[L[w]][T]);return s}function R(p){var f=Object.keys(p);return f.reduce(function(h,s){return h||p[s].length>0},!1)}function m(p,f){for(var h={main:[f]},s={main:[]},u={main:{}};R(h);)for(var l=Object.keys(h),a=0;a<l.length;a++){var o=l[a],c=h[o],L=c.pop();if(u[o]=u[o]||{},u[o][L]||!p[o][L])continue;u[o][L]=!0,s[o]=s[o]||[],s[o].push(L);for(var w=P(p,p[o][L],o),T=Object.keys(w),O=0;O<T.length;O++)h[T[O]]=h[T[O]]||[],h[T[O]]=h[T[O]].concat(w[T[O]])}return s}ue.exports=function(p,f){f=f||{};var h={main:M.m},s=f.all?{main:Object.keys(h.main)}:m(h,p),u="";Object.keys(s).filter(function(L){return L!=="main"}).forEach(function(L){for(var w=0;s[L][w];)w++;s[L].push(w),h[L][w]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",u=u+"var "+L+" = ("+Q.toString().replace("ENTRY_MODULE",JSON.stringify(w))+")({"+s[L].map(function(T){return""+JSON.stringify(T)+": "+h[L][T].toString()}).join(",")+`});
`}),u=u+"new (("+Q.toString().replace("ENTRY_MODULE",JSON.stringify(p))+")({"+s.main.map(function(L){return""+JSON.stringify(L)+": "+h.main[L].toString()}).join(",")+"}))(self);";var l=new window.Blob([u],{type:"text/javascript"});if(f.bare)return l;var a=window.URL||window.webkitURL||window.mozURL||window.msURL,o=a.createObjectURL(l),c=new window.Worker(o);return c.objectURL=o,c}},"./src/config.ts":function(ue,Z,M){"use strict";M.r(Z),M.d(Z,"hlsDefaultConfig",function(){return O}),M.d(Z,"mergeConfig",function(){return x}),M.d(Z,"enableStreamingMode",function(){return S});var Q=M("./src/controller/abr-controller.ts"),B=M("./src/controller/audio-stream-controller.ts"),N=M("./src/controller/audio-track-controller.ts"),K=M("./src/controller/subtitle-stream-controller.ts"),W=M("./src/controller/subtitle-track-controller.ts"),P=M("./src/controller/buffer-controller.ts"),R=M("./src/controller/timeline-controller.ts"),m=M("./src/controller/cap-level-controller.ts"),p=M("./src/controller/fps-controller.ts"),f=M("./src/controller/eme-controller.ts"),h=M("./src/controller/cmcd-controller.ts"),s=M("./src/utils/xhr-loader.ts"),u=M("./src/utils/fetch-loader.ts"),l=M("./src/utils/cues.ts"),a=M("./src/utils/mediakeys-helper.ts"),o=M("./src/utils/logger.ts");function c(){return c=Object.assign||function(E){for(var d=1;d<arguments.length;d++){var b=arguments[d];for(var g in b)Object.prototype.hasOwnProperty.call(b,g)&&(E[g]=b[g])}return E},c.apply(this,arguments)}function L(E,d){var b=Object.keys(E);if(Object.getOwnPropertySymbols){var g=Object.getOwnPropertySymbols(E);d&&(g=g.filter(function(_){return Object.getOwnPropertyDescriptor(E,_).enumerable})),b.push.apply(b,g)}return b}function w(E){for(var d=1;d<arguments.length;d++){var b=arguments[d]!=null?arguments[d]:{};d%2?L(Object(b),!0).forEach(function(g){T(E,g,b[g])}):Object.getOwnPropertyDescriptors?Object.defineProperties(E,Object.getOwnPropertyDescriptors(b)):L(Object(b)).forEach(function(g){Object.defineProperty(E,g,Object.getOwnPropertyDescriptor(b,g))})}return E}function T(E,d,b){return d in E?Object.defineProperty(E,d,{value:b,enumerable:!0,configurable:!0,writable:!0}):E[d]=b,E}var O=w(w({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:s.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:Q.default,bufferController:P.default,capLevelController:m.default,fpsController:p.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:a.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},A()),{},{subtitleStreamController:K.SubtitleStreamController,subtitleTrackController:W.default,timelineController:R.TimelineController,audioStreamController:B.default,audioTrackController:N.default,emeController:f.default,cmcdController:h.default});function A(){return{cueHandler:l.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 x(E,d){if((d.liveSyncDurationCount||d.liveMaxLatencyDurationCount)&&(d.liveSyncDuration||d.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(d.liveMaxLatencyDurationCount!==void 0&&(d.liveSyncDurationCount===void 0||d.liveMaxLatencyDurationCount<=d.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(d.liveMaxLatencyDuration!==void 0&&(d.liveSyncDuration===void 0||d.liveMaxLatencyDuration<=d.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return c({},E,d)}function S(E){var d=E.loader;if(d!==u.default&&d!==s.default)o.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),E.progressive=!1;else{var b=Object(u.fetchSupported)();b&&(E.loader=u.default,E.progressive=!0,E.enableSoftwareAES=!0,o.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(ue,Z,M){"use strict";M.r(Z);var Q=M("./src/polyfills/number.ts"),B=M("./src/utils/ewma-bandwidth-estimator.ts"),N=M("./src/events.ts"),K=M("./src/utils/buffer-helper.ts"),W=M("./src/errors.ts"),P=M("./src/types/loader.ts"),R=M("./src/utils/logger.ts");function m(h,s){for(var u=0;u<s.length;u++){var l=s[u];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(h,l.key,l)}}function p(h,s,u){return s&&m(h.prototype,s),u&&m(h,u),h}var f=function(){function h(u){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=u;var l=u.config;this.bwEstimator=new B.default(l.abrEwmaSlowVoD,l.abrEwmaFastVoD,l.abrEwmaDefaultEstimate),this.registerListeners()}var s=h.prototype;return s.registerListeners=function(){var l=this.hls;l.on(N.Events.FRAG_LOADING,this.onFragLoading,this),l.on(N.Events.FRAG_LOADED,this.onFragLoaded,this),l.on(N.Events.FRAG_BUFFERED,this.onFragBuffered,this),l.on(N.Events.LEVEL_LOADED,this.onLevelLoaded,this),l.on(N.Events.ERROR,this.onError,this)},s.unregisterListeners=function(){var l=this.hls;l.off(N.Events.FRAG_LOADING,this.onFragLoading,this),l.off(N.Events.FRAG_LOADED,this.onFragLoaded,this),l.off(N.Events.FRAG_BUFFERED,this.onFragBuffered,this),l.off(N.Events.LEVEL_LOADED,this.onLevelLoaded,this),l.off(N.Events.ERROR,this.onError,this)},s.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},s.onFragLoading=function(l,a){var o=a.frag;if(o.type===P.PlaylistLevelType.MAIN&&!this.timer){var c;this.fragCurrent=o,this.partCurrent=(c=a.part)!=null?c:null,this.timer=self.setInterval(this.onCheck,100)}},s.onLevelLoaded=function(l,a){var o=this.hls.config;a.details.live?this.bwEstimator.update(o.abrEwmaSlowLive,o.abrEwmaFastLive):this.bwEstimator.update(o.abrEwmaSlowVoD,o.abrEwmaFastVoD)},s._abandonRulesCheck=function(){var l=this.fragCurrent,a=this.partCurrent,o=this.hls,c=o.autoLevelEnabled,L=o.config,w=o.media;if(!l||!w)return;var T=a?a.stats:l.stats,O=a?a.duration:l.duration;if(T.aborted){R.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!c||w.paused||!w.playbackRate||!w.readyState)return;var A=performance.now()-T.loading.start,x=Math.abs(w.playbackRate);if(A<=500*O/x)return;var S=o.levels,E=o.minAutoLevel,d=S[l.level],b=T.total||Math.max(T.loaded,Math.round(O*d.maxBitrate/8)),g=Math.max(1,T.bwEstimate?T.bwEstimate/8:T.loaded*1e3/A),_=(b-T.loaded)/g,F=w.currentTime,D=(K.BufferHelper.bufferInfo(w,F,L.maxBufferHole).end-F)/x;if(D>=2*O/x||_<=D)return;var j=Number.POSITIVE_INFINITY,H;for(H=l.level-1;H>E;H--){var k=S[H].maxBitrate;if(j=O*k/(8*.8*g),j<D)break}if(j>=_)return;var y=this.bwEstimator.getEstimate();R.logger.warn("Fragment "+l.sn+(a?" part "+a.index:"")+" of level "+l.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+H+`
Current BW estimate: `+(Object(Q.isFiniteNumber)(y)?(y/1024).toFixed(3):"Unknown")+` Kb/s
Estimated load time for current fragment: `+_.toFixed(3)+` s
Estimated load time for the next fragment: `+j.toFixed(3)+` s
Time to underbuffer: `+D.toFixed(3)+" s"),o.nextLoadLevel=H,this.bwEstimator.sample(A,T.loaded),this.clearTimer(),l.loader&&(this.fragCurrent=this.partCurrent=null,l.loader.abort()),o.trigger(N.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:l,part:a,stats:T})},s.onFragLoaded=function(l,a){var o=a.frag,c=a.part;if(o.type===P.PlaylistLevelType.MAIN&&Object(Q.isFiniteNumber)(o.sn)){var L=c?c.stats:o.stats,w=c?c.duration:o.duration;if(this.clearTimer(),this.lastLoadedFragLevel=o.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var T=this.hls.levels[o.level],O=(T.loaded?T.loaded.bytes:0)+L.loaded,A=(T.loaded?T.loaded.duration:0)+w;T.loaded={bytes:O,duration:A},T.realBitrate=Math.round(8*O/A)}if(o.bitrateTest){var x={stats:L,frag:o,part:c,id:o.type};this.onFragBuffered(N.Events.FRAG_BUFFERED,x),o.bitrateTest=!1}}},s.onFragBuffered=function(l,a){var o=a.frag,c=a.part,L=c?c.stats:o.stats;if(L.aborted)return;if(o.type!==P.PlaylistLevelType.MAIN||o.sn==="initSegment")return;var w=L.parsing.end-L.loading.start;this.bwEstimator.sample(w,L.loaded),L.bwEstimate=this.bwEstimator.getEstimate(),o.bitrateTest?this.bitrateTestDelay=w/1e3:this.bitrateTestDelay=0},s.onError=function(l,a){switch(a.details){case W.ErrorDetails.FRAG_LOAD_ERROR:case W.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},s.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},s.getNextABRAutoLevel=function(){var l=this.fragCurrent,a=this.partCurrent,o=this.hls,c=o.maxAutoLevel,L=o.config,w=o.minAutoLevel,T=o.media,O=a?a.duration:l?l.duration:0,A=T?T.currentTime:0,x=T&&T.playbackRate!==0?Math.abs(T.playbackRate):1,S=this.bwEstimator?this.bwEstimator.getEstimate():L.abrEwmaDefaultEstimate,E=(K.BufferHelper.bufferInfo(T,A,L.maxBufferHole).end-A)/x,d=this.findBestLevel(S,w,c,E,L.abrBandWidthFactor,L.abrBandWidthUpFactor);if(d>=0)return d;R.logger.trace((E?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var b=O?Math.min(O,L.maxStarvationDelay):L.maxStarvationDelay,g=L.abrBandWidthFactor,_=L.abrBandWidthUpFactor;if(!E){var F=this.bitrateTestDelay;if(F){var D=O?Math.min(O,L.maxLoadingDelay):L.maxLoadingDelay;b=D-F,R.logger.trace("bitrate test took "+Math.round(1e3*F)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*b)+" ms"),g=_=1}}return d=this.findBestLevel(S,w,c,E+b,g,_),Math.max(d,0)},s.findBestLevel=function(l,a,o,c,L,w){for(var T,O=this.fragCurrent,A=this.partCurrent,x=this.lastLoadedFragLevel,S=this.hls.levels,E=S[x],d=!!(E!=null&&(T=E.details)!==null&&T!==void 0&&T.live),b=E==null?void 0:E.codecSet,g=A?A.duration:O?O.duration:0,_=o;_>=a;_--){var F=S[_];if(!F||b&&F.codecSet!==b)continue;var D=F.details,j=(A?D==null?void 0:D.partTarget:D==null?void 0:D.averagetargetduration)||g,H=void 0;_<=x?H=L*l:H=w*l;var k=S[_].maxBitrate,y=k*j/H;if(R.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+_+"/"+Math.round(H)+"/"+k+"/"+j+"/"+c+"/"+y),H>k&&(!y||d&&!this.bitrateTestDelay||y<c))return _}return-1},p(h,[{key:"nextAutoLevel",get:function(){var l=this._nextAutoLevel,a=this.bwEstimator;if(l!==-1&&(!a||!a.canEstimate()))return l;var o=this.getNextABRAutoLevel();return l!==-1&&(o=Math.min(l,o)),o},set:function(l){this._nextAutoLevel=l}}]),h}();Z.default=f},"./src/controller/audio-stream-controller.ts":function(ue,Z,M){"use strict";M.r(Z);var Q=M("./src/polyfills/number.ts"),B=M("./src/controller/base-stream-controller.ts"),N=M("./src/events.ts"),K=M("./src/utils/buffer-helper.ts"),W=M("./src/controller/fragment-tracker.ts"),P=M("./src/types/level.ts"),R=M("./src/types/loader.ts"),m=M("./src/loader/fragment.ts"),p=M("./src/demux/chunk-cache.ts"),f=M("./src/demux/transmuxer-interface.ts"),h=M("./src/types/transmuxer.ts"),s=M("./src/controller/fragment-finders.ts"),u=M("./src/utils/discontinuities.ts"),l=M("./src/errors.ts"),a=M("./src/utils/logger.ts");function o(){return o=Object.assign||function(O){for(var A=1;A<arguments.length;A++){var x=arguments[A];for(var S in x)Object.prototype.hasOwnProperty.call(x,S)&&(O[S]=x[S])}return O},o.apply(this,arguments)}function c(O,A){O.prototype=Object.create(A.prototype),O.prototype.constructor=O,L(O,A)}function L(O,A){return L=Object.setPrototypeOf||function(S,E){return S.__proto__=E,S},L(O,A)}var w=100,T=function(O){c(A,O);function A(S,E){var d;return d=O.call(this,S,E,"[audio-stream-controller]")||this,d.videoBuffer=null,d.videoTrackCC=-1,d.waitingVideoCC=-1,d.audioSwitch=!1,d.trackId=-1,d.waitingData=null,d.mainDetails=null,d.bufferFlushed=!1,d._registerListeners(),d}var x=A.prototype;return x.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},x._registerListeners=function(){var E=this.hls;E.on(N.Events.MEDIA_ATTACHED,this.onMediaAttached,this),E.on(N.Events.MEDIA_DETACHING,this.onMediaDetaching,this),E.on(N.Events.MANIFEST_LOADING,this.onManifestLoading,this),E.on(N.Events.LEVEL_LOADED,this.onLevelLoaded,this),E.on(N.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),E.on(N.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),E.on(N.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),E.on(N.Events.ERROR,this.onError,this),E.on(N.Events.BUFFER_RESET,this.onBufferReset,this),E.on(N.Events.BUFFER_CREATED,this.onBufferCreated,this),E.on(N.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),E.on(N.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),E.on(N.Events.FRAG_BUFFERED,this.onFragBuffered,this)},x._unregisterListeners=function(){var E=this.hls;E.off(N.Events.MEDIA_ATTACHED,this.onMediaAttached,this),E.off(N.Events.MEDIA_DETACHING,this.onMediaDetaching,this),E.off(N.Events.MANIFEST_LOADING,this.onManifestLoading,this),E.off(N.Events.LEVEL_LOADED,this.onLevelLoaded,this),E.off(N.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),E.off(N.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),E.off(N.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),E.off(N.Events.ERROR,this.onError,this),E.off(N.Events.BUFFER_RESET,this.onBufferReset,this),E.off(N.Events.BUFFER_CREATED,this.onBufferCreated,this),E.off(N.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),E.off(N.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),E.off(N.Events.FRAG_BUFFERED,this.onFragBuffered,this)},x.onInitPtsFound=function(E,d){var b=d.frag,g=d.id,_=d.initPTS;if(g==="main"){var F=b.cc;this.initPTS[b.cc]=_,this.log("InitPTS for cc: "+F+" found from main: "+_),this.videoTrackCC=F,this.state===B.State.WAITING_INIT_PTS&&this.tick()}},x.startLoad=function(E){if(!this.levels){this.startPosition=E,this.state=B.State.STOPPED;return}var d=this.lastCurrentTime;this.stopLoad(),this.setInterval(w),this.fragLoadError=0,d>0&&E===-1?(this.log("Override startPosition with lastCurrentTime @"+d.toFixed(3)),this.state=B.State.IDLE):(this.loadedmetadata=!1,this.state=B.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=E,this.tick()},x.doTick=function(){switch(this.state){case B.State.IDLE:this.doTickIdle();break;case B.State.WAITING_TRACK:{var E,d=this.levels,b=this.trackId,g=d==null||((E=d[b])===null||E===void 0)?void 0:E.details;if(g){if(this.waitForCdnTuneIn(g))break;this.state=B.State.WAITING_INIT_PTS}break}case B.State.FRAG_LOADING_WAITING_RETRY:{var _,F=performance.now(),D=this.retryDate;(!D||F>=D||(_=this.media)!==null&&_!==void 0&&_.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=B.State.IDLE);break}case B.State.WAITING_INIT_PTS:{var j=this.waitingData;if(j){var H=j.frag,k=j.part,y=j.cache,G=j.complete;if(this.initPTS[H.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=B.State.FRAG_LOADING;var Y=y.flush(),ie={frag:H,part:k,payload:Y,networkDetails:null};this._handleFragmentLoadProgress(ie),G&&O.prototype._handleFragmentLoadComplete.call(this,ie)}else if(this.videoTrackCC!==this.waitingVideoCC)a.logger.log("Waiting fragment cc ("+H.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var se=this.getLoadPosition(),we=K.BufferHelper.bufferInfo(this.mediaBuffer,se,this.config.maxBufferHole),ve=Object(s.fragmentWithinToleranceTest)(we.end,this.config.maxFragLookUpTolerance,H);ve<0&&(a.logger.log("Waiting fragment cc ("+H.cc+") @ "+H.start+" cancelled because another fragment at "+we.end+" is needed"),this.clearWaitingFragment())}}else this.state=B.State.IDLE}}this.onTickEnd()},x.clearWaitingFragment=function(){var E=this.waitingData;E&&(this.fragmentTracker.removeFragment(E.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=B.State.IDLE)},x.onTickEnd=function(){var E=this.media;if(!E||!E.readyState)return;var d=this.mediaBuffer?this.mediaBuffer:E,b=d.buffered;!this.loadedmetadata&&b.length&&(this.loadedmetadata=!0),this.lastCurrentTime=E.currentTime},x.doTickIdle=function(){var E,d,b=this.hls,g=this.levels,_=this.media,F=this.trackId,D=b.config;if(!g||!g[F])return;if(!_&&(this.startFragRequested||!D.startFragPrefetch))return;var j=g[F],H=j.details;if(!H||H.live&&this.levelLastLoaded!==F||this.waitForCdnTuneIn(H)){this.state=B.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,m.ElementaryStreamTypes.AUDIO,R.PlaylistLevelType.AUDIO));var k=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,R.PlaylistLevelType.AUDIO);if(k===null)return;var y=k.len,G=this.getMaxBufferLength(),Y=this.audioSwitch;if(y>=G&&!Y)return;if(!Y&&this._streamEnded(k,H)){b.trigger(N.Events.BUFFER_EOS,{type:"audio"}),this.state=B.State.ENDED;return}var ie=H.fragments,se=ie[0].start,we=k.end;if(Y){var ve=this.getLoadPosition();we=ve,H.PTSKnown&&ve<se&&((k.end>se||k.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),_.currentTime=se+.05))}var Se=this.getNextFragment(we,H);if(!Se){this.bufferFlushed=!0;return}((E=Se.decryptdata)===null||E===void 0?void 0:E.keyFormat)==="identity"&&!((d=Se.decryptdata)!==null&&d!==void 0&&d.key)?this.loadKey(Se,H):this.loadFragment(Se,H,we)},x.getMaxBufferLength=function(){var E=O.prototype.getMaxBufferLength.call(this),d=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,R.PlaylistLevelType.MAIN);return d===null?E:Math.max(E,d.len)},x.onMediaDetaching=function(){this.videoBuffer=null,O.prototype.onMediaDetaching.call(this)},x.onAudioTracksUpdated=function(E,d){var b=d.audioTracks;this.resetTransmuxer(),this.levels=b.map(function(g){return new P.Level(g)})},x.onAudioTrackSwitching=function(E,d){var b=!!d.url;this.trackId=d.id;var g=this.fragCurrent;g!=null&&g.loader&&g.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),b?this.setInterval(w):this.resetTransmuxer(),b?(this.audioSwitch=!0,this.state=B.State.IDLE):this.state=B.State.STOPPED,this.tick()},x.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},x.onLevelLoaded=function(E,d){this.mainDetails=d.details},x.onAudioTrackLoaded=function(E,d){var b,g=this.levels,_=d.details,F=d.id;if(!g){this.warn("Audio tracks were reset while loading level "+F);return}this.log("Track "+F+" loaded ["+_.startSN+","+_.endSN+"],duration:"+_.totalduration);var D=g[F],j=0;if(_.live||(b=D.details)!==null&&b!==void 0&&b.live){var H=this.mainDetails;if(_.fragments[0]||(_.deltaUpdateFailed=!0),_.deltaUpdateFailed||!H)return;!D.details&&_.hasProgramDateTime&&H.hasProgramDateTime?(Object(u.alignMediaPlaylistByPDT)(_,H),j=_.fragments[0].start):j=this.alignPlaylists(_,D.details)}D.details=_,this.levelLastLoaded=F,!this.startFragRequested&&(this.mainDetails||!_.live)&&this.setStartPosition(D.details,j),this.state===B.State.WAITING_TRACK&&!this.waitForCdnTuneIn(_)&&(this.state=B.State.IDLE),this.tick()},x._handleFragmentLoadProgress=function(E){var d,b=E.frag,g=E.part,_=E.payload,F=this.config,D=this.trackId,j=this.levels;if(!j){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+b.sn+" of level "+b.level+" will not be buffered");return}var H=j[D];console.assert(H,"Audio track is defined on fragment load progress");var k=H.details;console.assert(k,"Audio track details are defined on fragment load progress");var y=F.defaultAudioCodec||H.audioCodec||"mp4a.40.2",G=this.transmuxer;G||(G=this.transmuxer=new f.default(this.hls,R.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var Y=this.initPTS[b.cc],ie=(d=b.initSegment)===null||d===void 0?void 0:d.data;if(Y!==void 0){var se=!1,we=g?g.index:-1,ve=we!==-1,Se=new h.ChunkMetadata(b.level,b.sn,b.stats.chunkCount,_.byteLength,we,ve);G.push(_,ie,y,"",b,g,k.totalduration,se,Se,Y)}else{a.logger.log("Unknown video PTS for cc "+b.cc+", waiting for video PTS before demuxing audio frag "+b.sn+" of ["+k.startSN+" ,"+k.endSN+"],track "+D);var Ce=this.waitingData=this.waitingData||{frag:b,part:g,cache:new p.default,complete:!1},pe=Ce.cache;pe.push(new Uint8Array(_)),this.waitingVideoCC=this.videoTrackCC,this.state=B.State.WAITING_INIT_PTS}},x._handleFragmentLoadComplete=function(E){if(this.waitingData){this.waitingData.complete=!0;return}O.prototype._handleFragmentLoadComplete.call(this,E)},x.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},x.onBufferCreated=function(E,d){var b=d.tracks.audio;b&&(this.mediaBuffer=b.buffer),d.tracks.video&&(this.videoBuffer=d.tracks.video.buffer)},x.onFragBuffered=function(E,d){var b=d.frag,g=d.part;if(b.type!==R.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(b)){this.warn("Fragment "+b.sn+(g?" p: "+g.index:"")+" of level "+b.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}b.sn!=="initSegment"&&(this.fragPrevious=b,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(N.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(b,g)},x.onError=function(E,d){switch(d.details){case l.ErrorDetails.FRAG_LOAD_ERROR:case l.ErrorDetails.FRAG_LOAD_TIMEOUT:case l.ErrorDetails.KEY_LOAD_ERROR:case l.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(R.PlaylistLevelType.AUDIO,d);break;case l.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case l.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==B.State.ERROR&&this.state!==B.State.STOPPED&&(this.state=d.fatal?B.State.ERROR:B.State.IDLE,this.warn(d.details+" while loading frag, switching to "+this.state+" state"));break;case l.ErrorDetails.BUFFER_FULL_ERROR:if(d.parent==="audio"&&(this.state===B.State.PARSING||this.state===B.State.PARSED)){var b=!0,g=this.getFwdBufferInfo(this.mediaBuffer,R.PlaylistLevelType.AUDIO);g&&g.len>.5&&(b=!this.reduceMaxBufferLength(g.len)),b&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,O.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},x.onBufferFlushed=function(E,d){var b=d.type;b===m.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},x._handleTransmuxComplete=function(E){var d,b="audio",g=this.hls,_=E.remuxResult,F=E.chunkMeta,D=this.getCurrentContext(F);if(!D){this.warn("The loading context changed while buffering fragment "+F.sn+" of level "+F.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(F.level);return}var j=D.frag,H=D.part,k=_.audio,y=_.text,G=_.id3,Y=_.initSegment;if(this.fragContextChanged(j))return;if(this.state=B.State.PARSING,this.audioSwitch&&k&&this.completeAudioSwitch(),Y!=null&&Y.tracks&&(this._bufferInitSegment(Y.tracks,j,F),g.trigger(N.Events.FRAG_PARSING_INIT_SEGMENT,{frag:j,id:b,tracks:Y.tracks})),k){var ie=k.startPTS,se=k.endPTS,we=k.startDTS,ve=k.endDTS;H&&(H.elementaryStreams[m.ElementaryStreamTypes.AUDIO]={startPTS:ie,endPTS:se,startDTS:we,endDTS:ve}),j.setElementaryStreamInfo(m.ElementaryStreamTypes.AUDIO,ie,se,we,ve),this.bufferFragmentData(k,j,H,F)}if(G!=null&&(d=G.samples)!==null&&d!==void 0&&d.length){var Se=o({frag:j,id:b},G);g.trigger(N.Events.FRAG_PARSING_METADATA,Se)}if(y){var Ce=o({frag:j,id:b},y);g.trigger(N.Events.FRAG_PARSING_USERDATA,Ce)}},x._bufferInitSegment=function(E,d,b){if(this.state!==B.State.PARSING)return;E.video&&delete E.video;var g=E.audio;if(!g)return;g.levelCodec=g.codec,g.id="audio",this.log("Init audio buffer, container:"+g.container+", codecs[parsed]=["+g.codec+"]"),this.hls.trigger(N.Events.BUFFER_CODECS,E);var _=g.initSegment;if(_!=null&&_.byteLength){var F={type:"audio",frag:d,part:null,chunkMeta:b,parent:d.type,data:_};this.hls.trigger(N.Events.BUFFER_APPENDING,F)}this.tick()},x.loadFragment=function(E,d,b){var g=this.fragmentTracker.getState(E);this.fragCurrent=E,(this.audioSwitch||g===W.FragmentState.NOT_LOADED||g===W.FragmentState.PARTIAL)&&(E.sn==="initSegment"?this._loadInitSegment(E):d.live&&!Object(Q.isFiniteNumber)(this.initPTS[E.cc])?(this.log("Waiting for video PTS in continuity counter "+E.cc+" of live stream before loading audio fragment "+E.sn+" of level "+this.trackId),this.state=B.State.WAITING_INIT_PTS):(this.startFragRequested=!0,O.prototype.loadFragment.call(this,E,d,b)))},x.completeAudioSwitch=function(){var E=this.hls,d=this.media,b=this.trackId;d&&(this.log("Switching audio track : flushing all audio"),O.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,E.trigger(N.Events.AUDIO_TRACK_SWITCHED,{id:b})},A}(B.default);Z.default=T},"./src/controller/audio-track-controller.ts":function(ue,Z,M){"use strict";M.r(Z);var Q=M("./src/events.ts"),B=M("./src/errors.ts"),N=M("./src/controller/base-playlist-controller.ts"),K=M("./src/types/loader.ts");function W(f,h){for(var s=0;s<h.length;s++){var u=h[s];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(f,u.key,u)}}function P(f,h,s){return h&&W(f.prototype,h),s&&W(f,s),f}function R(f,h){f.prototype=Object.create(h.prototype),f.prototype.constructor=f,m(f,h)}function m(f,h){return m=Object.setPrototypeOf||function(u,l){return u.__proto__=l,u},m(f,h)}var p=function(f){R(h,f);function h(u){var l;return l=f.call(this,u,"[audio-track-controller]")||this,l.tracks=[],l.groupId=null,l.tracksInGroup=[],l.trackId=-1,l.trackName="",l.selectDefaultTrack=!0,l.registerListeners(),l}var s=h.prototype;return s.registerListeners=function(){var l=this.hls;l.on(Q.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.on(Q.Events.MANIFEST_PARSED,this.onManifestParsed,this),l.on(Q.Events.LEVEL_LOADING,this.onLevelLoading,this),l.on(Q.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),l.on(Q.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),l.on(Q.Events.ERROR,this.onError,this)},s.unregisterListeners=function(){var l=this.hls;l.off(Q.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.off(Q.Events.MANIFEST_PARSED,this.onManifestParsed,this),l.off(Q.Events.LEVEL_LOADING,this.onLevelLoading,this),l.off(Q.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),l.off(Q.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),l.off(Q.Events.ERROR,this.onError,this)},s.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,f.prototype.destroy.call(this)},s.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},s.onManifestParsed=function(l,a){this.tracks=a.audioTracks||[]},s.onAudioTrackLoaded=function(l,a){var o=a.id,c=a.details,L=this.tracksInGroup[o];if(!L){this.warn("Invalid audio track id "+o);return}var w=L.details;L.details=a.details,this.log("audioTrack "+o+" loaded ["+c.startSN+"-"+c.endSN+"]"),o===this.trackId&&(this.retryCount=0,this.playlistLoaded(o,a,w))},s.onLevelLoading=function(l,a){this.switchLevel(a.level)},s.onLevelSwitching=function(l,a){this.switchLevel(a.level)},s.switchLevel=function(l){var a=this.hls.levels[l];if(!(a!=null&&a.audioGroupIds))return;var o=a.audioGroupIds[a.urlId];if(this.groupId!==o){this.groupId=o;var c=this.tracks.filter(function(w){return!o||w.groupId===o});this.selectDefaultTrack&&!c.some(function(w){return w.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=c;var L={audioTracks:c};this.log("Updating audio tracks, "+c.length+' track(s) found in "'+o+'" group-id'),this.hls.trigger(Q.Events.AUDIO_TRACKS_UPDATED,L),this.selectInitialTrack()}},s.onError=function(l,a){if(f.prototype.onError.call(this,l,a),a.fatal||!a.context)return;a.context.type===K.PlaylistContextType.AUDIO_TRACK&&a.context.id===this.trackId&&a.context.groupId===this.groupId&&this.retryLoadingOrFail(a)},s.setAudioTrack=function(l){var a=this.tracksInGroup;if(l<0||l>=a.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var o=a[this.trackId];this.log("Now switching to audio-track index "+l);var c=a[l],L=c.id,w=c.groupId,T=w===void 0?"":w,O=c.name,A=c.type,x=c.url;if(this.trackId=l,this.trackName=O,this.selectDefaultTrack=!1,this.hls.trigger(Q.Events.AUDIO_TRACK_SWITCHING,{id:L,groupId:T,name:O,type:A,url:x}),c.details&&!c.details.live)return;var S=this.switchParams(c.url,o==null?void 0:o.details);this.loadPlaylist(S)},s.selectInitialTrack=function(){var l=this.tracksInGroup;console.assert(l.length,"Initial audio track should be selected when tracks are known");var a=this.trackName,o=this.findTrackId(a)||this.findTrackId();o!==-1?this.setAudioTrack(o):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(Q.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},s.findTrackId=function(l){for(var a=this.tracksInGroup,o=0;o<a.length;o++){var c=a[o];if((!this.selectDefaultTrack||c.default)&&(!l||l===c.name))return c.id}return-1},s.loadPlaylist=function(l){var a=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(a)){var o=a.id,c=a.groupId,L=a.url;if(l)try{L=l.addDirectives(L)}catch(w){this.warn("Could not construct new URL with HLS Delivery Directives: "+w)}this.log("loading audio-track playlist for id: "+o),this.clearTimer(),this.hls.trigger(Q.Events.AUDIO_TRACK_LOADING,{url:L,id:o,groupId:c,deliveryDirectives:l||null})}},P(h,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(l){this.selectDefaultTrack=!1,this.setAudioTrack(l)}}]),h}(N.default);Z.default=p},"./src/controller/base-playlist-controller.ts":function(ue,Z,M){"use strict";M.r(Z),M.d(Z,"default",function(){return P});var Q=M("./src/polyfills/number.ts"),B=M("./src/types/level.ts"),N=M("./src/controller/level-helper.ts"),K=M("./src/utils/logger.ts"),W=M("./src/errors.ts"),P=function(){function R(p,f){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=K.logger.log.bind(K.logger,f+":"),this.warn=K.logger.warn.bind(K.logger,f+":"),this.hls=p}var m=R.prototype;return m.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},m.onError=function(f,h){h.fatal&&h.type===W.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},m.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},m.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},m.stopLoad=function(){this.canLoad=!1,this.clearTimer()},m.switchParams=function(f,h){var s=h==null?void 0:h.renditionReports;if(s)for(var u=0;u<s.length;u++){var l=s[u],a=""+l.URI;if(a===f.substr(-a.length)){var o=parseInt(l["LAST-MSN"]),c=parseInt(l["LAST-PART"]);if(h&&this.hls.config.lowLatencyMode){var L=Math.min(h.age-h.partTarget,h.targetduration);c!==void 0&&L>h.partTarget&&(c+=1)}if(Object(Q.isFiniteNumber)(o))return new B.HlsUrlParameters(o,Object(Q.isFiniteNumber)(c)?c:void 0,B.HlsSkip.No)}}},m.loadPlaylist=function(f){},m.shouldLoadTrack=function(f){return this.canLoad&&f&&!!f.url&&(!f.details||f.details.live)},m.playlistLoaded=function(f,h,s){var u=this,l=h.details,a=h.stats,o=a.loading.end?Math.max(0,self.performance.now()-a.loading.end):0;if(l.advancedDateTime=Date.now()-o,l.live||s!=null&&s.live){if(l.reloaded(s),s&&this.log("live playlist "+f+" "+(l.advanced?"REFRESHED "+l.lastPartSn+"-"+l.lastPartIndex:"MISSED")),s&&l.fragments.length>0&&Object(N.mergeDetails)(s,l),!this.canLoad||!l.live)return;var c,L=void 0,w=void 0;if(l.canBlockReload&&l.endSN&&l.advanced){var T=this.hls.config.lowLatencyMode,O=l.lastPartSn,A=l.endSN,x=l.lastPartIndex,S=x!==-1,E=O===A,d=T?0:x;S?(L=E?A+1:O,w=E?d:x+1):L=A+1;var b=l.age,g=b+l.ageHeader,_=Math.min(g-l.partTarget,l.targetduration*1.5);if(_>0){if(s&&_>s.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+s.tuneInGoal+" to: "+_+" with playlist age: "+l.age),_=0;else{var F=Math.floor(_/l.targetduration);if(L+=F,w!==void 0){var D=Math.round(_%l.targetduration/l.partTarget);w+=D}this.log("CDN Tune-in age: "+l.ageHeader+"s last advanced "+b.toFixed(2)+"s goal: "+_+" skip sn "+F+" to part "+w)}l.tuneInGoal=_}if(c=this.getDeliveryDirectives(l,h.deliveryDirectives,L,w),T||!E){this.loadPlaylist(c);return}}else c=this.getDeliveryDirectives(l,h.deliveryDirectives,L,w);var j=Object(N.computeReloadInterval)(l,a);L!==void 0&&l.canBlockReload&&(j-=l.partTarget||1),this.log("reload live playlist "+f+" in "+Math.round(j)+" ms"),this.timer=self.setTimeout(function(){return u.loadPlaylist(c)},j)}else this.clearTimer()},m.getDeliveryDirectives=function(f,h,s,u){var l=Object(B.getSkipValue)(f,s);return h!=null&&h.skip&&f.deltaUpdateFailed&&(s=h.msn,u=h.part,l=B.HlsSkip.No),new B.HlsUrlParameters(s,u,l)},m.retryLoadingOrFail=function(f){var h=this,s=this.hls.config,u=this.retryCount<s.levelLoadingMaxRetry;if(u){var l;if(this.retryCount++,f.details.indexOf("LoadTimeOut")>-1&&(l=f.context)!==null&&l!==void 0&&l.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+f.details+'"'),this.loadPlaylist();else{var a=Math.min(Math.pow(2,this.retryCount)*s.levelLoadingRetryDelay,s.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return h.loadPlaylist()},a),this.warn("retry playlist loading #"+this.retryCount+" in "+a+' ms after "'+f.details+'"')}}else this.warn('cannot recover from error "'+f.details+'"'),this.clearTimer(),f.fatal=!0;return u},R}()},"./src/controller/base-stream-controller.ts":function(ue,Z,M){"use strict";M.r(Z),M.d(Z,"State",function(){return A}),M.d(Z,"default",function(){return x});var Q=M("./src/polyfills/number.ts"),B=M("./src/task-loop.ts"),N=M("./src/controller/fragment-tracker.ts"),K=M("./src/utils/buffer-helper.ts"),W=M("./src/utils/logger.ts"),P=M("./src/events.ts"),R=M("./src/errors.ts"),m=M("./src/types/transmuxer.ts"),p=M("./src/utils/mp4-tools.ts"),f=M("./src/utils/discontinuities.ts"),h=M("./src/controller/fragment-finders.ts"),s=M("./src/controller/level-helper.ts"),u=M("./src/loader/fragment-loader.ts"),l=M("./src/crypt/decrypter.ts"),a=M("./src/utils/time-ranges.ts"),o=M("./src/types/loader.ts");function c(S,E){for(var d=0;d<E.length;d++){var b=E[d];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(S,b.key,b)}}function L(S,E,d){return E&&c(S.prototype,E),d&&c(S,d),S}function w(S){if(S===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return S}function T(S,E){S.prototype=Object.create(E.prototype),S.prototype.constructor=S,O(S,E)}function O(S,E){return O=Object.setPrototypeOf||function(b,g){return b.__proto__=g,b},O(S,E)}var A={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"},x=function(S){T(E,S);function E(b,g,_){var F;return F=S.call(this)||this,F.hls=void 0,F.fragPrevious=null,F.fragCurrent=null,F.fragmentTracker=void 0,F.transmuxer=null,F._state=A.STOPPED,F.media=void 0,F.mediaBuffer=void 0,F.config=void 0,F.bitrateTest=!1,F.lastCurrentTime=0,F.nextLoadPosition=0,F.startPosition=0,F.loadedmetadata=!1,F.fragLoadError=0,F.retryDate=0,F.levels=null,F.fragmentLoader=void 0,F.levelLastLoaded=null,F.startFragRequested=!1,F.decrypter=void 0,F.initPTS=[],F.onvseeking=null,F.onvended=null,F.logPrefix="",F.log=void 0,F.warn=void 0,F.logPrefix=_,F.log=W.logger.log.bind(W.logger,_+":"),F.warn=W.logger.warn.bind(W.logger,_+":"),F.hls=b,F.fragmentLoader=new u.default(b.config),F.fragmentTracker=g,F.config=b.config,F.decrypter=new l.default(b,b.config),b.on(P.Events.KEY_LOADED,F.onKeyLoaded,w(F)),F}var d=E.prototype;return d.doTick=function(){this.onTickEnd()},d.onTickEnd=function(){},d.startLoad=function(g){},d.stopLoad=function(){this.fragmentLoader.abort();var g=this.fragCurrent;g&&this.fragmentTracker.removeFragment(g),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=A.STOPPED},d._streamEnded=function(g,_){var F=this.fragCurrent,D=this.fragmentTracker;if(!_.live&&F&&F.sn===_.endSN&&!g.nextStart){var j=D.getState(F);return j===N.FragmentState.PARTIAL||j===N.FragmentState.OK}return!1},d.onMediaAttached=function(g,_){var F=this.media=this.mediaBuffer=_.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),F.addEventListener("seeking",this.onvseeking),F.addEventListener("ended",this.onvended);var D=this.config;this.levels&&D.autoStartLoad&&this.state===A.STOPPED&&this.startLoad(D.startPosition)},d.onMediaDetaching=function(){var g=this.media;g!=null&&g.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),g&&(g.removeEventListener("seeking",this.onvseeking),g.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},d.onMediaSeeking=function(){var g=this.config,_=this.fragCurrent,F=this.media,D=this.mediaBuffer,j=this.state,H=F?F.currentTime:0,k=K.BufferHelper.bufferInfo(D||F,H,g.maxBufferHole);if(this.log("media seeking to "+(Object(Q.isFiniteNumber)(H)?H.toFixed(3):H)+", state: "+j),j===A.ENDED)this.resetLoadingState();else if(_&&!k.len){var y=g.maxFragLookUpTolerance,G=_.start-y,Y=_.start+_.duration+y,ie=H>Y;(H<G||ie)&&(ie&&_.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),_.loader.abort()),this.resetLoadingState())}F&&(this.lastCurrentTime=H),!this.loadedmetadata&&!k.len&&(this.nextLoadPosition=this.startPosition=H),this.tickImmediate()},d.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},d.onKeyLoaded=function(g,_){if(this.state!==A.KEY_LOADING||_.frag!==this.fragCurrent||!this.levels)return;this.state=A.IDLE;var F=this.levels[_.frag.level].details;F&&this.loadFragment(_.frag,F,_.frag.start)},d.onHandlerDestroying=function(){this.stopLoad(),S.prototype.onHandlerDestroying.call(this)},d.onHandlerDestroyed=function(){this.state=A.STOPPED,this.hls.off(P.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,S.prototype.onHandlerDestroyed.call(this)},d.loadKey=function(g,_){this.log("Loading key for "+g.sn+" of ["+_.startSN+"-"+_.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+g.level),this.state=A.KEY_LOADING,this.fragCurrent=g,this.hls.trigger(P.Events.KEY_LOADING,{frag:g})},d.loadFragment=function(g,_,F){this._loadFragForPlayback(g,_,F)},d._loadFragForPlayback=function(g,_,F){var D=this,j=function(k){if(D.fragContextChanged(g)){D.warn("Fragment "+g.sn+(k.part?" p: "+k.part.index:"")+" of level "+g.level+" was dropped during download."),D.fragmentTracker.removeFragment(g);return}g.stats.chunkCount++,D._handleFragmentLoadProgress(k)};this._doFragLoad(g,_,F,j).then(function(H){if(!H)return;D.fragLoadError=0;var k=D.state;if(D.fragContextChanged(g)){(k===A.FRAG_LOADING||k===A.BACKTRACKING||!D.fragCurrent&&k===A.PARSING)&&(D.fragmentTracker.removeFragment(g),D.state=A.IDLE);return}if("payload"in H&&(D.log("Loaded fragment "+g.sn+" of level "+g.level),D.hls.trigger(P.Events.FRAG_LOADED,H),D.state===A.BACKTRACKING)){D.fragmentTracker.backtrack(g,H),D.resetFragmentLoading(g);return}D._handleFragmentLoadComplete(H)}).catch(function(H){D.warn(H),D.resetFragmentLoading(g)})},d.flushMainBuffer=function(g,_,F){if(F===void 0&&(F=null),!(g-_))return;var D={startOffset:g,endOffset:_,type:F};this.fragLoadError=0,this.hls.trigger(P.Events.BUFFER_FLUSHING,D)},d._loadInitSegment=function(g){var _=this;this._doFragLoad(g).then(function(F){if(!F||_.fragContextChanged(g)||!_.levels)throw new Error("init load aborted");return F}).then(function(F){var D=_.hls,j=F.payload,H=g.decryptdata;if(j&&j.byteLength>0&&H&&H.key&&H.iv&&H.method==="AES-128"){var k=self.performance.now();return _.decrypter.webCryptoDecrypt(new Uint8Array(j),H.key.buffer,H.iv.buffer).then(function(y){var G=self.performance.now();return D.trigger(P.Events.FRAG_DECRYPTED,{frag:g,payload:y,stats:{tstart:k,tdecrypt:G}}),F.payload=y,F})}return F}).then(function(F){var D=_.fragCurrent,j=_.hls,H=_.levels;if(!H)throw new Error("init load aborted, missing levels");var k=H[g.level].details;console.assert(k,"Level details are defined when init segment is loaded");var y=g.stats;_.state=A.IDLE,_.fragLoadError=0,g.data=new Uint8Array(F.payload),y.parsing.start=y.buffering.start=self.performance.now(),y.parsing.end=y.buffering.end=self.performance.now(),F.frag===D&&j.trigger(P.Events.FRAG_BUFFERED,{stats:y,frag:D,part:null,id:g.type}),_.tick()}).catch(function(F){_.warn(F),_.resetFragmentLoading(g)})},d.fragContextChanged=function(g){var _=this.fragCurrent;return!g||!_||g.level!==_.level||g.sn!==_.sn||g.urlId!==_.urlId},d.fragBufferedComplete=function(g,_){var F=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+g.type+" sn: "+g.sn+(_?" part: "+_.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+g.level+" "+a.default.toString(K.BufferHelper.getBuffered(F))),this.state=A.IDLE,this.tick()},d._handleFragmentLoadComplete=function(g){var _=this.transmuxer;if(!_)return;var F=g.frag,D=g.part,j=g.partsLoaded,H=!j||j.length===0||j.some(function(y){return!y}),k=new m.ChunkMetadata(F.level,F.sn,F.stats.chunkCount+1,0,D?D.index:-1,!H);_.flush(k)},d._handleFragmentLoadProgress=function(g){},d._doFragLoad=function(g,_,F,D){var j=this;if(F===void 0&&(F=null),!this.levels)throw new Error("frag load aborted, missing levels");if(F=Math.max(g.start,F||0),this.config.lowLatencyMode&&_){var H=_.partList;if(H&&D){F>g.end&&_.fragmentHint&&(g=_.fragmentHint);var k=this.getNextPart(H,g,F);if(k>-1){var y=H[k];return this.log("Loading part sn: "+g.sn+" p: "+y.index+" cc: "+g.cc+" of playlist ["+_.startSN+"-"+_.endSN+"] parts [0-"+k+"-"+(H.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+g.level+", target: "+parseFloat(F.toFixed(3))),this.nextLoadPosition=y.start+y.duration,this.state=A.FRAG_LOADING,this.hls.trigger(P.Events.FRAG_LOADING,{frag:g,part:H[k],targetBufferTime:F}),this.doFragPartsLoad(g,H,k,D).catch(function(G){return j.handleFragLoadError(G)})}else if(!g.url||this.loadedEndOfParts(H,F))return Promise.resolve(null)}}return this.log("Loading fragment "+g.sn+" cc: "+g.cc+" "+(_?"of ["+_.startSN+"-"+_.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+g.level+", target: "+parseFloat(F.toFixed(3))),Object(Q.isFiniteNumber)(g.sn)&&!this.bitrateTest&&(this.nextLoadPosition=g.start+g.duration),this.state=A.FRAG_LOADING,this.hls.trigger(P.Events.FRAG_LOADING,{frag:g,targetBufferTime:F}),this.fragmentLoader.load(g,D).catch(function(G){return j.handleFragLoadError(G)})},d.doFragPartsLoad=function(g,_,F,D){var j=this;return new Promise(function(H,k){var y=[],G=function Y(ie){var se=_[ie];j.fragmentLoader.loadPart(g,se,D).then(function(we){y[se.index]=we;var ve=we.part;j.hls.trigger(P.Events.FRAG_LOADED,we);var Se=_[ie+1];if(Se&&Se.fragment===g)Y(ie+1);else return H({frag:g,part:ve,partsLoaded:y})}).catch(k)};G(F)})},d.handleFragLoadError=function(g){var _=g.data;return _&&_.details===R.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(_.frag,_.part):this.hls.trigger(P.Events.ERROR,_),null},d._handleTransmuxerFlush=function(g){var _=this.getCurrentContext(g);if(!_||this.state!==A.PARSING){this.fragCurrent||(this.state=A.IDLE);return}var F=_.frag,D=_.part,j=_.level,H=self.performance.now();F.stats.parsing.end=H,D&&(D.stats.parsing.end=H),this.updateLevelTiming(F,D,j,g.partial)},d.getCurrentContext=function(g){var _=this.levels,F=g.level,D=g.sn,j=g.part;if(!_||!_[F])return this.warn("Levels object was unset while buffering fragment "+D+" of level "+F+". The current chunk will not be buffered."),null;var H=_[F],k=j>-1?Object(s.getPartWith)(H,D,j):null,y=k?k.fragment:Object(s.getFragmentWithSN)(H,D,this.fragCurrent);return y?{frag:y,part:k,level:H}:null},d.bufferFragmentData=function(g,_,F,D){if(!g||this.state!==A.PARSING)return;var j=g.data1,H=g.data2,k=j;if(j&&H&&(k=Object(p.appendUint8Array)(j,H)),!k||!k.length)return;var y={type:g.type,frag:_,part:F,chunkMeta:D,parent:_.type,data:k};this.hls.trigger(P.Events.BUFFER_APPENDING,y),g.dropped&&g.independent&&!F&&this.flushBufferGap(_)},d.flushBufferGap=function(g){var _=this.media;if(!_)return;if(!K.BufferHelper.isBuffered(_,_.currentTime)){this.flushMainBuffer(0,g.start);return}var F=_.currentTime,D=K.BufferHelper.bufferInfo(_,F,0),j=g.duration,H=Math.min(this.config.maxFragLookUpTolerance*2,j*.25),k=Math.max(Math.min(g.start-H,D.end-H),F+H);g.start-k>H&&this.flushMainBuffer(k,g.start)},d.getFwdBufferInfo=function(g,_){var F=this.config,D=this.getLoadPosition();if(!Object(Q.isFiniteNumber)(D))return null;var j=K.BufferHelper.bufferInfo(g,D,F.maxBufferHole);if(j.len===0&&j.nextStart!==void 0){var H=this.fragmentTracker.getBufferedFrag(D,_);if(H&&j.nextStart<H.end)return K.BufferHelper.bufferInfo(g,D,Math.max(j.nextStart,F.maxBufferHole))}return j},d.getMaxBufferLength=function(g){var _=this.config,F;return g?F=Math.max(8*_.maxBufferSize/g,_.maxBufferLength):F=_.maxBufferLength,Math.min(F,_.maxMaxBufferLength)},d.reduceMaxBufferLength=function(g){var _=this.config,F=g||_.maxBufferLength;return _.maxMaxBufferLength>=F?(_.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+_.maxMaxBufferLength+"s"),!0):!1},d.getNextFragment=function(g,_){var F,D,j=_.fragments,H=j.length;if(!H)return null;var k=this.config,y=j[0].start,G;if(_.live){var Y=k.initialLiveManifestSize;if(H<Y)return this.warn("Not enough fragments to start playback (have: "+H+", need: "+Y+")"),null;!_.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(G=this.getInitialLiveFragment(_,j),this.startPosition=G?this.hls.liveSyncPosition||G.start:g)}else g<=y&&(G=j[0]);if(!G){var ie=k.lowLatencyMode?_.partEnd:_.fragmentEnd;G=this.getFragmentAtPosition(g,ie,_)}return(F=G)!==null&&F!==void 0&&F.initSegment&&!((D=G)!==null&&D!==void 0&&D.initSegment.data)&&!this.bitrateTest&&(G=G.initSegment),G},d.getNextPart=function(g,_,F){for(var D=-1,j=!1,H=!0,k=0,y=g.length;k<y;k++){var G=g[k];if(H=H&&!G.independent,D>-1&&F<G.start)break;var Y=G.loaded;!Y&&(j||G.independent||H)&&G.fragment===_&&(D=k),j=Y}return D},d.loadedEndOfParts=function(g,_){var F=g[g.length-1];return F&&_>F.start&&F.loaded},d.getInitialLiveFragment=function(g,_){var F=this.fragPrevious,D=null;if(F){if(g.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+F.programDateTime),D=Object(h.findFragmentByPDT)(_,F.endProgramDateTime,this.config.maxFragLookUpTolerance)),!D){var j=F.sn+1;if(j>=g.startSN&&j<=g.endSN){var H=_[j-g.startSN];F.cc===H.cc&&(D=H,this.log("Live playlist, switching playlist, load frag with next SN: "+D.sn))}D||(D=Object(h.findFragWithCC)(_,F.cc),D&&this.log("Live playlist, switching playlist, load frag with same CC: "+D.sn))}}else{var k=this.hls.liveSyncPosition;k!==null&&(D=this.getFragmentAtPosition(k,this.bitrateTest?g.fragmentEnd:g.edge,g))}return D},d.getFragmentAtPosition=function(g,_,F){var D=this.config,j=this.fragPrevious,H=F.fragments,k=F.endSN,y=F.fragmentHint,G=D.maxFragLookUpTolerance,Y=!!(D.lowLatencyMode&&F.partList&&y);Y&&y&&!this.bitrateTest&&(H=H.concat(y),k=y.sn);var ie;if(g<_){var se=g>_-G?0:G;ie=Object(h.findFragmentByPTS)(j,H,g,se)}else ie=H[H.length-1];if(ie){var we=ie.sn-F.startSN,ve=j&&ie.level===j.level,Se=H[we+1],Ce=this.fragmentTracker.getState(ie);if(Ce===N.FragmentState.BACKTRACKED){ie=null;for(var pe=we;H[pe]&&this.fragmentTracker.getState(H[pe])===N.FragmentState.BACKTRACKED;)j?ie=H[pe--]:ie=H[--pe];ie||(ie=Se)}else j&&ie.sn===j.sn&&!Y&&(ve&&(ie.sn<k&&this.fragmentTracker.getState(Se)!==N.FragmentState.OK?(this.log("SN "+ie.sn+" just loaded, load next one: "+Se.sn),ie=Se):ie=null))}return ie},d.synchronizeToLiveEdge=function(g){var _=this.config,F=this.media;if(!F)return;var D=this.hls.liveSyncPosition,j=F.currentTime,H=g.fragments[0].start,k=g.edge,y=j>=H-_.maxFragLookUpTolerance&&j<=k;if(D!==null&&F.duration>D&&(j<D||!y)){var G=_.liveMaxLatencyDuration!==void 0?_.liveMaxLatencyDuration:_.liveMaxLatencyDurationCount*g.targetduration;(!y&&F.readyState<4||j<k-G)&&(this.loadedmetadata||(this.nextLoadPosition=D),F.readyState&&(this.warn("Playback: "+j.toFixed(3)+" is located too far from the end of live sliding playlist: "+k+", reset currentTime to : "+D.toFixed(3)),F.currentTime=D))}},d.alignPlaylists=function(g,_){var F=this.levels,D=this.levelLastLoaded,j=this.fragPrevious,H=D!==null?F[D]:null,k=g.fragments.length;if(!k)return this.warn("No fragments in live playlist"),0;var y=g.fragments[0].start,G=!_,Y=g.alignedSliding&&Object(Q.isFiniteNumber)(y);if(G||!Y&&!y){Object(f.alignStream)(j,H,g);var ie=g.fragments[0].start;return this.log("Live playlist sliding: "+ie.toFixed(2)+" start-sn: "+(_?_.startSN:"na")+"->"+g.startSN+" prev-sn: "+(j?j.sn:"na")+" fragments: "+k),ie}return y},d.waitForCdnTuneIn=function(g){var _=3;return g.live&&g.canBlockReload&&g.tuneInGoal>Math.max(g.partHoldBack,g.partTarget*_)},d.setStartPosition=function(g,_){var F=this.startPosition;if(F<_&&(F=-1),F===-1||this.lastCurrentTime===-1){var D=g.startTimeOffset;Object(Q.isFiniteNumber)(D)?(F=_+D,D<0&&(F+=g.totalduration),F=Math.min(Math.max(_,F),_+g.totalduration),this.log("Start time offset "+D+" found in playlist, adjust startPosition to "+F),this.startPosition=F):g.live?F=this.hls.liveSyncPosition||_:this.startPosition=F=0,this.lastCurrentTime=F}this.nextLoadPosition=F},d.getLoadPosition=function(){var g=this.media,_=0;return this.loadedmetadata&&g?_=g.currentTime:this.nextLoadPosition&&(_=this.nextLoadPosition),_},d.handleFragLoadAborted=function(g,_){this.transmuxer&&g.sn!=="initSegment"&&g.stats.aborted&&(this.warn("Fragment "+g.sn+(_?" part"+_.index:"")+" of level "+g.level+" was aborted"),this.resetFragmentLoading(g))},d.resetFragmentLoading=function(g){(!this.fragCurrent||!this.fragContextChanged(g))&&(this.state=A.IDLE)},d.onFragmentOrKeyLoadError=function(g,_){if(_.fatal)return;var F=_.frag;if(!F||F.type!==g)return;var D=this.fragCurrent;console.assert(D&&F.sn===D.sn&&F.level===D.level&&F.urlId===D.urlId,"Frag load error must match current frag to retry");var j=this.config;if(this.fragLoadError+1<=j.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(F.level))return;var H=Math.min(Math.pow(2,this.fragLoadError)*j.fragLoadingRetryDelay,j.fragLoadingMaxRetryTimeout);this.warn("Fragment "+F.sn+" of "+g+" "+F.level+" failed to load, retrying in "+H+"ms"),this.retryDate=self.performance.now()+H,this.fragLoadError++,this.state=A.FRAG_LOADING_WAITING_RETRY}else _.levelRetry?(g===o.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=A.IDLE):(W.logger.error(_.details+" reaches max retry, redispatch as fatal ..."),_.fatal=!0,this.hls.stopLoad(),this.state=A.ERROR)},d.afterBufferFlushed=function(g,_,F){if(!g)return;var D=K.BufferHelper.getBuffered(g);this.fragmentTracker.detectEvictedFragments(_,D,F),this.state===A.ENDED&&this.resetLoadingState()},d.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=A.IDLE},d.resetLiveStartWhenNotLoaded=function(g){if(!this.loadedmetadata){this.startFragRequested=!1;var _=this.levels?this.levels[g].details:null;if(_!=null&&_.live)return this.startPosition=-1,this.setStartPosition(_,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},d.updateLevelTiming=function(g,_,F,D){var j=this,H=F.details;console.assert(!!H,"level.details must be defined");var k=Object.keys(g.elementaryStreams).reduce(function(y,G){var Y=g.elementaryStreams[G];if(Y){var ie=Y.endPTS-Y.startPTS;if(ie<=0)return j.warn("Could not parse fragment "+g.sn+" "+G+" duration reliably ("+ie+") resetting transmuxer to fallback to playlist timing"),j.resetTransmuxer(),y||!1;var se=D?0:Object(s.updateFragPTSDTS)(H,g,Y.startPTS,Y.endPTS,Y.startDTS,Y.endDTS);return j.hls.trigger(P.Events.LEVEL_PTS_UPDATED,{details:H,level:F,drift:se,type:G,frag:g,start:Y.startPTS,end:Y.endPTS}),!0}return y},!1);k?(this.state=A.PARSED,this.hls.trigger(P.Events.FRAG_PARSED,{frag:g,part:_})):this.resetLoadingState()},d.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},L(E,[{key:"state",get:function(){return this._state},set:function(g){var _=this._state;_!==g&&(this._state=g,this.log(_+"->"+g))}}]),E}(B.default)},"./src/controller/buffer-controller.ts":function(ue,Z,M){"use strict";M.r(Z),M.d(Z,"default",function(){return h});var Q=M("./src/polyfills/number.ts"),B=M("./src/events.ts"),N=M("./src/utils/logger.ts"),K=M("./src/errors.ts"),W=M("./src/utils/buffer-helper.ts"),P=M("./src/utils/mediasource-helper.ts"),R=M("./src/loader/fragment.ts"),m=M("./src/controller/buffer-operation-queue.ts"),p=Object(P.getMediaSource)(),f=/([ha]vc.)(?:\.[^.,]+)+/,h=function(){function s(l){var a=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var o=a.hls,c=a.media,L=a.mediaSource;N.logger.log("[buffer-controller]: Media source opened"),c&&(a.updateMediaElementDuration(),o.trigger(B.Events.MEDIA_ATTACHED,{media:c})),L&&L.removeEventListener("sourceopen",a._onMediaSourceOpen),a.checkPendingTracks()},this._onMediaSourceClose=function(){N.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){N.logger.log("[buffer-controller]: Media source ended")},this.hls=l,this._initSourceBuffer(),this.registerListeners()}var u=s.prototype;return u.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},u.destroy=function(){this.unregisterListeners(),this.details=null},u.registerListeners=function(){var a=this.hls;a.on(B.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),a.on(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.on(B.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.on(B.Events.BUFFER_RESET,this.onBufferReset,this),a.on(B.Events.BUFFER_APPENDING,this.onBufferAppending,this),a.on(B.Events.BUFFER_CODECS,this.onBufferCodecs,this),a.on(B.Events.BUFFER_EOS,this.onBufferEos,this),a.on(B.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),a.on(B.Events.LEVEL_UPDATED,this.onLevelUpdated,this),a.on(B.Events.FRAG_PARSED,this.onFragParsed,this),a.on(B.Events.FRAG_CHANGED,this.onFragChanged,this)},u.unregisterListeners=function(){var a=this.hls;a.off(B.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),a.off(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.off(B.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.off(B.Events.BUFFER_RESET,this.onBufferReset,this),a.off(B.Events.BUFFER_APPENDING,this.onBufferAppending,this),a.off(B.Events.BUFFER_CODECS,this.onBufferCodecs,this),a.off(B.Events.BUFFER_EOS,this.onBufferEos,this),a.off(B.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),a.off(B.Events.LEVEL_UPDATED,this.onLevelUpdated,this),a.off(B.Events.FRAG_PARSED,this.onFragParsed,this),a.off(B.Events.FRAG_CHANGED,this.onFragChanged,this)},u._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new m.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},u.onManifestParsed=function(a,o){var c=2;(o.audio&&!o.video||!o.altAudio)&&(c=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=c,this.details=null,N.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},u.onMediaAttaching=function(a,o){var c=this.media=o.media;if(c&&p){var L=this.mediaSource=new p;L.addEventListener("sourceopen",this._onMediaSourceOpen),L.addEventListener("sourceended",this._onMediaSourceEnded),L.addEventListener("sourceclose",this._onMediaSourceClose),c.src=self.URL.createObjectURL(L),this._objectUrl=c.src}},u.onMediaDetaching=function(){var a=this.media,o=this.mediaSource,c=this._objectUrl;if(o){if(N.logger.log("[buffer-controller]: media source detaching"),o.readyState==="open")try{o.endOfStream()}catch(L){N.logger.warn("[buffer-controller]: onMediaDetaching: "+L.message+" while calling endOfStream")}this.onBufferReset(),o.removeEventListener("sourceopen",this._onMediaSourceOpen),o.removeEventListener("sourceended",this._onMediaSourceEnded),o.removeEventListener("sourceclose",this._onMediaSourceClose),a&&(c&&self.URL.revokeObjectURL(c),a.src===c?(a.removeAttribute("src"),a.load()):N.logger.warn("[buffer-controller]: media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(B.Events.MEDIA_DETACHED,void 0)},u.onBufferReset=function(){var a=this;this.getSourceBufferTypes().forEach(function(o){var c=a.sourceBuffer[o];try{c&&(a.removeBufferListeners(o),a.mediaSource&&a.mediaSource.removeSourceBuffer(c),a.sourceBuffer[o]=void 0)}catch(L){N.logger.warn("[buffer-controller]: Failed to reset the "+o+" buffer",L)}}),this._initSourceBuffer()},u.onBufferCodecs=function(a,o){var c=this,L=this.getSourceBufferTypes().length;if(Object.keys(o).forEach(function(w){if(L){var T=c.tracks[w];if(T&&typeof T.buffer.changeType=="function"){var O=o[w],A=O.codec,x=O.levelCodec,S=O.container,E=(T.levelCodec||T.codec).replace(f,"$1"),d=(x||A).replace(f,"$1");if(E!==d){var b=S+";codecs="+(x||A);c.appendChangeType(w,b)}}}else c.pendingTracks[w]=o[w]}),L)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},u.appendChangeType=function(a,o){var c=this,L=this.operationQueue,w={execute:function(){var O=c.sourceBuffer[a];O&&(N.logger.log("[buffer-controller]: changing "+a+" sourceBuffer type to "+o),O.changeType(o)),L.shiftAndExecuteNext(a)},onStart:function(){},onComplete:function(){},onError:function(O){N.logger.warn("[buffer-controller]: Failed to change "+a+" SourceBuffer type",O)}};L.append(w,a)},u.onBufferAppending=function(a,o){var c=this,L=this.hls,w=this.operationQueue,T=this.tracks,O=o.data,A=o.type,x=o.frag,S=o.part,E=o.chunkMeta,d=E.buffering[A],b=self.performance.now();d.start=b;var g=x.stats.buffering,_=S?S.stats.buffering:null;g.start===0&&(g.start=b),_&&_.start===0&&(_.start=b);var F=T.audio,D=A==="audio"&&E.id===1&&(F==null?void 0:F.container)==="audio/mpeg",j={execute:function(){if(d.executeStart=self.performance.now(),D){var k=c.sourceBuffer[A];if(k){var y=x.start-k.timestampOffset;Math.abs(y)>=.1&&(N.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+x.start+" (delta: "+y+") sn: "+x.sn+")"),k.timestampOffset=x.start)}}c.appendExecutor(O,A)},onStart:function(){},onComplete:function(){var k=self.performance.now();d.executeEnd=d.end=k,g.first===0&&(g.first=k),_&&_.first===0&&(_.first=k);var y=c.sourceBuffer,G={};for(var Y in y)G[Y]=W.BufferHelper.getBuffered(y[Y]);c.appendError=0,c.hls.trigger(B.Events.BUFFER_APPENDED,{type:A,frag:x,part:S,chunkMeta:E,parent:x.type,timeRanges:G})},onError:function(k){N.logger.error("[buffer-controller]: Error encountered while trying to append to the "+A+" SourceBuffer",k);var y={type:K.ErrorTypes.MEDIA_ERROR,parent:x.type,details:K.ErrorDetails.BUFFER_APPEND_ERROR,err:k,fatal:!1};k.code===DOMException.QUOTA_EXCEEDED_ERR?y.details=K.ErrorDetails.BUFFER_FULL_ERROR:(c.appendError++,y.details=K.ErrorDetails.BUFFER_APPEND_ERROR,c.appendError>L.config.appendErrorMaxRetry&&(N.logger.error("[buffer-controller]: Failed "+L.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),y.fatal=!0)),L.trigger(B.Events.ERROR,y)}};w.append(j,A)},u.onBufferFlushing=function(a,o){var c=this,L=this.operationQueue,w=function(O){return{execute:c.removeExecutor.bind(c,O,o.startOffset,o.endOffset),onStart:function(){},onComplete:function(){c.hls.trigger(B.Events.BUFFER_FLUSHED,{type:O})},onError:function(x){N.logger.warn("[buffer-controller]: Failed to remove from "+O+" SourceBuffer",x)}}};o.type?L.append(w(o.type),o.type):this.getSourceBufferTypes().forEach(function(T){L.append(w(T),T)})},u.onFragParsed=function(a,o){var c=this,L=o.frag,w=o.part,T=[],O=w?w.elementaryStreams:L.elementaryStreams;O[R.ElementaryStreamTypes.AUDIOVIDEO]?T.push("audiovideo"):(O[R.ElementaryStreamTypes.AUDIO]&&T.push("audio"),O[R.ElementaryStreamTypes.VIDEO]&&T.push("video"));var A=function(){var S=self.performance.now();L.stats.buffering.end=S,w&&(w.stats.buffering.end=S);var E=w?w.stats:L.stats;c.hls.trigger(B.Events.FRAG_BUFFERED,{frag:L,part:w,stats:E,id:L.type})};T.length===0&&N.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+L.type+" level: "+L.level+" sn: "+L.sn),this.blockBuffers(A,T)},u.onFragChanged=function(a,o){this.flushBackBuffer()},u.onBufferEos=function(a,o){var c=this,L=this.getSourceBufferTypes().reduce(function(w,T){var O=c.sourceBuffer[T];return(!o.type||o.type===T)&&(O&&!O.ended&&(O.ended=!0,N.logger.log("[buffer-controller]: "+T+" sourceBuffer now EOS"))),w&&!!(!O||O.ended)},!0);L&&this.blockBuffers(function(){var w=c.mediaSource;if(!w||w.readyState!=="open")return;w.endOfStream()})},u.onLevelUpdated=function(a,o){var c=o.details;if(!c.fragments.length)return;this.details=c,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},u.flushBackBuffer=function(){var a=this.hls,o=this.details,c=this.media,L=this.sourceBuffer;if(!c||o===null)return;var w=this.getSourceBufferTypes();if(!w.length)return;var T=o.live&&a.config.liveBackBufferLength!==null?a.config.liveBackBufferLength:a.config.backBufferLength;if(!Object(Q.isFiniteNumber)(T)||T<0)return;var O=c.currentTime,A=o.levelTargetDuration,x=Math.max(T,A),S=Math.floor(O/A)*A-x;w.forEach(function(E){var d=L[E];if(d){var b=W.BufferHelper.getBuffered(d);b.length>0&&S>b.start(0)&&(a.trigger(B.Events.BACK_BUFFER_REACHED,{bufferEnd:S}),o.live&&a.trigger(B.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:S}),a.trigger(B.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:S,type:E}))}})},u.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var a=this.details,o=this.hls,c=this.media,L=this.mediaSource,w=a.fragments[0].start+a.totalduration,T=c.duration,O=Object(Q.isFiniteNumber)(L.duration)?L.duration:0;a.live&&o.config.liveDurationInfinity?(N.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),L.duration=Infinity,this.updateSeekableRange(a)):(w>O&&w>T||!Object(Q.isFiniteNumber)(T))&&(N.logger.log("[buffer-controller]: Updating Media Source duration to "+w.toFixed(3)),L.duration=w)},u.updateSeekableRange=function(a){var o=this.mediaSource,c=a.fragments,L=c.length;if(L&&a.live&&o!==null&&o!==void 0&&o.setLiveSeekableRange){var w=Math.max(0,c[0].start),T=Math.max(w,w+a.totalduration);o.setLiveSeekableRange(w,T)}},u.checkPendingTracks=function(){var a=this.bufferCodecEventsExpected,o=this.operationQueue,c=this.pendingTracks,L=Object.keys(c).length;if(L&&!a||L===2){this.createSourceBuffers(c),this.pendingTracks={};var w=this.getSourceBufferTypes();if(w.length===0){this.hls.trigger(B.Events.ERROR,{type:K.ErrorTypes.MEDIA_ERROR,details:K.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}w.forEach(function(T){o.executeNext(T)})}},u.createSourceBuffers=function(a){var o=this.sourceBuffer,c=this.mediaSource;if(!c)throw Error("createSourceBuffers called when mediaSource was null");var L=0;for(var w in a)if(!o[w]){var T=a[w];if(!T)throw Error("source buffer exists for track "+w+", however track does not");var O=T.levelCodec||T.codec,A=T.container+";codecs="+O;N.logger.log("[buffer-controller]: creating sourceBuffer("+A+")");try{var x=o[w]=c.addSourceBuffer(A),S=w;this.addBufferListener(S,"updatestart",this._onSBUpdateStart),this.addBufferListener(S,"updateend",this._onSBUpdateEnd),this.addBufferListener(S,"error",this._onSBUpdateError),this.tracks[w]={buffer:x,codec:O,container:T.container,levelCodec:T.levelCodec,id:T.id},L++}catch(E){N.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+E.message),this.hls.trigger(B.Events.ERROR,{type:K.ErrorTypes.MEDIA_ERROR,details:K.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:E,mimeType:A})}}L&&this.hls.trigger(B.Events.BUFFER_CREATED,{tracks:this.tracks})},u._onSBUpdateStart=function(a){var o=this.operationQueue,c=o.current(a);c.onStart()},u._onSBUpdateEnd=function(a){var o=this.operationQueue,c=o.current(a);c.onComplete(),o.shiftAndExecuteNext(a)},u._onSBUpdateError=function(a,o){N.logger.error("[buffer-controller]: "+a+" SourceBuffer error",o),this.hls.trigger(B.Events.ERROR,{type:K.ErrorTypes.MEDIA_ERROR,details:K.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var c=this.operationQueue.current(a);c&&c.onError(o)},u.removeExecutor=function(a,o,c){var L=this.media,w=this.mediaSource,T=this.operationQueue,O=this.sourceBuffer,A=O[a];if(!L||!w||!A){N.logger.warn("[buffer-controller]: Attempting to remove from the "+a+" SourceBuffer, but it does not exist"),T.shiftAndExecuteNext(a);return}var x=Object(Q.isFiniteNumber)(L.duration)?L.duration:Infinity,S=Object(Q.isFiniteNumber)(w.duration)?w.duration:Infinity,E=Math.max(0,o),d=Math.min(c,x,S);d>E?(N.logger.log("[buffer-controller]: Removing ["+E+","+d+"] from the "+a+" SourceBuffer"),console.assert(!A.updating,a+" sourceBuffer must not be updating"),A.remove(E,d)):T.shiftAndExecuteNext(a)},u.appendExecutor=function(a,o){var c=this.operationQueue,L=this.sourceBuffer,w=L[o];if(!w){N.logger.warn("[buffer-controller]: Attempting to append to the "+o+" SourceBuffer, but it does not exist"),c.shiftAndExecuteNext(o);return}w.ended=!1,console.assert(!w.updating,o+" sourceBuffer must not be updating"),w.appendBuffer(a)},u.blockBuffers=function(a,o){var c=this;if(o===void 0&&(o=this.getSourceBufferTypes()),!o.length){N.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(a);return}var L=this.operationQueue,w=o.map(function(T){return L.appendBlocker(T)});Promise.all(w).then(function(){a(),o.forEach(function(T){var O=c.sourceBuffer[T];(!O||!O.updating)&&L.shiftAndExecuteNext(T)})})},u.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},u.addBufferListener=function(a,o,c){var L=this.sourceBuffer[a];if(!L)return;var w=c.bind(this,a);this.listeners[a].push({event:o,listener:w}),L.addEventListener(o,w)},u.removeBufferListeners=function(a){var o=this.sourceBuffer[a];if(!o)return;this.listeners[a].forEach(function(c){o.removeEventListener(c.event,c.listener)})},s}()},"./src/controller/buffer-operation-queue.ts":function(ue,Z,M){"use strict";M.r(Z),M.d(Z,"default",function(){return B});var Q=M("./src/utils/logger.ts"),B=function(){function N(W){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=W}var K=N.prototype;return K.append=function(P,R){var m=this.queues[R];m.push(P),m.length===1&&this.buffers[R]&&this.executeNext(R)},K.insertAbort=function(P,R){var m=this.queues[R];m.unshift(P),this.executeNext(R)},K.appendBlocker=function(P){var R,m=new Promise(function(f){R=f}),p={execute:R,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(p,P),m},K.executeNext=function(P){var R=this.buffers,m=this.queues,p=R[P],f=m[P];if(f.length){var h=f[0];try{h.execute()}catch(s){Q.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),h.onError(s),(!p||!p.updating)&&(f.shift(),this.executeNext(P))}}},K.shiftAndExecuteNext=function(P){this.queues[P].shift(),this.executeNext(P)},K.current=function(P){return this.queues[P][0]},N}()},"./src/controller/cap-level-controller.ts":function(ue,Z,M){"use strict";M.r(Z);var Q=M("./src/events.ts");function B(W,P){for(var R=0;R<P.length;R++){var m=P[R];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(W,m.key,m)}}function N(W,P,R){return P&&B(W.prototype,P),R&&B(W,R),W}var K=function(){function W(R){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=R,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var P=W.prototype;return P.setStreamController=function(m){this.streamController=m},P.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},P.registerListeners=function(){var m=this.hls;m.on(Q.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),m.on(Q.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),m.on(Q.Events.MANIFEST_PARSED,this.onManifestParsed,this),m.on(Q.Events.BUFFER_CODECS,this.onBufferCodecs,this),m.on(Q.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},P.unregisterListener=function(){var m=this.hls;m.off(Q.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),m.off(Q.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),m.off(Q.Events.MANIFEST_PARSED,this.onManifestParsed,this),m.off(Q.Events.BUFFER_CODECS,this.onBufferCodecs,this),m.off(Q.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},P.onFpsDropLevelCapping=function(m,p){W.isLevelAllowed(p.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(p.droppedLevel)},P.onMediaAttaching=function(m,p){this.media=p.media instanceof HTMLVideoElement?p.media:null},P.onManifestParsed=function(m,p){var f=this.hls;this.restrictedLevels=[],this.firstLevel=p.firstLevel,f.config.capLevelToPlayerSize&&p.video&&this.startCapping()},P.onBufferCodecs=function(m,p){var f=this.hls;f.config.capLevelToPlayerSize&&p.video&&this.startCapping()},P.onMediaDetaching=function(){this.stopCapping()},P.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var m=this.hls.levels;if(m.length){var p=this.hls;p.autoLevelCapping=this.getMaxLevel(m.length-1),p.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=p.autoLevelCapping}}},P.getMaxLevel=function(m){var p=this,f=this.hls.levels;if(!f.length)return-1;var h=f.filter(function(s,u){return W.isLevelAllowed(u,p.restrictedLevels)&&u<=m});return this.clientRect=null,W.getMaxLevelByMediaSize(h,this.mediaWidth,this.mediaHeight)},P.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()},P.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},P.getDimensions=function(){if(this.clientRect)return this.clientRect;var m=this.media,p={width:0,height:0};if(m){var f=m.getBoundingClientRect();p.width=f.width,p.height=f.height,!p.width&&!p.height&&(p.width=f.right-f.left||m.width||0,p.height=f.bottom-f.top||m.height||0)}return this.clientRect=p,p},W.isLevelAllowed=function(m,p){return p===void 0&&(p=[]),p.indexOf(m)===-1},W.getMaxLevelByMediaSize=function(m,p,f){if(!m||!m.length)return-1;for(var h=function(o,c){return c?o.width!==c.width||o.height!==c.height:!0},s=m.length-1,u=0;u<m.length;u+=1){var l=m[u];if((l.width>=p||l.height>=f)&&h(l,m[u+1])){s=u;break}}return s},N(W,[{key:"mediaWidth",get:function(){return this.getDimensions().width*W.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*W.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var m=1;try{m=self.devicePixelRatio}catch(p){}return m}}]),W}();Z.default=K},"./src/controller/cmcd-controller.ts":function(ue,Z,M){"use strict";M.r(Z),M.d(Z,"default",function(){return h});var Q=M("./src/events.ts"),B=M("./src/types/cmcd.ts"),N=M("./src/utils/buffer-helper.ts"),K=M("./src/utils/logger.ts");function W(s,u){for(var l=0;l<u.length;l++){var a=u[l];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(s,a.key,a)}}function P(s,u,l){return u&&W(s.prototype,u),l&&W(s,l),s}function R(s,u){var l=typeof Symbol!="undefined"&&s[Symbol.iterator]||s["@@iterator"];if(l)return(l=l.call(s)).next.bind(l);if(Array.isArray(s)||(l=m(s))||u&&s&&typeof s.length=="number"){l&&(s=l);var a=0;return function(){return a>=s.length?{done:!0}:{done:!1,value:s[a++]}}}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 m(s,u){if(!s)return;if(typeof s=="string")return p(s,u);var l=Object.prototype.toString.call(s).slice(8,-1);if(l==="Object"&&s.constructor&&(l=s.constructor.name),l==="Map"||l==="Set")return Array.from(s);if(l==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(l))return p(s,u)}function p(s,u){(u==null||u>s.length)&&(u=s.length);for(var l=0,a=new Array(u);l<u;l++)a[l]=s[l];return a}function f(){return f=Object.assign||function(s){for(var u=1;u<arguments.length;u++){var l=arguments[u];for(var a in l)Object.prototype.hasOwnProperty.call(l,a)&&(s[a]=l[a])}return s},f.apply(this,arguments)}var h=function(){function s(l){var a=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(){a.initialized&&(a.starved=!0),a.buffering=!0},this.onPlaying=function(){a.initialized||(a.initialized=!0),a.buffering=!1},this.applyPlaylistData=function(L){try{a.apply(L,{ot:B.CMCDObjectType.MANIFEST,su:!a.initialized})}catch(w){K.logger.warn("Could not generate manifest CMCD data.",w)}},this.applyFragmentData=function(L){try{var w=L.frag,T=a.hls.levels[w.level],O=a.getObjectType(w),A={d:w.duration*1e3,ot:O};(O===B.CMCDObjectType.VIDEO||O===B.CMCDObjectType.AUDIO||O==B.CMCDObjectType.MUXED)&&(A.br=T.bitrate/1e3,A.tb=a.getTopBandwidth(O),A.bl=a.getBufferLength(O)),a.apply(L,A)}catch(x){K.logger.warn("Could not generate segment CMCD data.",x)}},this.hls=l;var o=this.config=l.config,c=o.cmcd;c!=null&&(o.pLoader=this.createPlaylistLoader(),o.fLoader=this.createFragmentLoader(),this.sid=c.sessionId||s.uuid(),this.cid=c.contentId,this.useHeaders=c.useHeaders===!0,this.registerListeners())}var u=s.prototype;return u.registerListeners=function(){var a=this.hls;a.on(Q.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.on(Q.Events.MEDIA_DETACHED,this.onMediaDetached,this),a.on(Q.Events.BUFFER_CREATED,this.onBufferCreated,this)},u.unregisterListeners=function(){var a=this.hls;a.off(Q.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.off(Q.Events.MEDIA_DETACHED,this.onMediaDetached,this),a.off(Q.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},u.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},u.onMediaAttached=function(a,o){this.media=o.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},u.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},u.onBufferCreated=function(a,o){var c,L;this.audioBuffer=(c=o.tracks.audio)===null||c===void 0?void 0:c.buffer,this.videoBuffer=(L=o.tracks.video)===null||L===void 0?void 0:L.buffer},u.createData=function(){var a;return{v:B.CMCDVersion,sf:B.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(a=this.media)===null||a===void 0?void 0:a.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},u.apply=function(a,o){o===void 0&&(o={}),f(o,this.createData());var c=o.ot===B.CMCDObjectType.INIT||o.ot===B.CMCDObjectType.VIDEO||o.ot===B.CMCDObjectType.MUXED;if(this.starved&&c&&(o.bs=!0,o.su=!0,this.starved=!1),o.su==null&&(o.su=this.buffering),this.useHeaders){var L=s.toHeaders(o);if(!Object.keys(L).length)return;a.headers||(a.headers={}),f(a.headers,L)}else{var w=s.toQuery(o);if(!w)return;a.url=s.appendQueryToUri(a.url,w)}},u.getObjectType=function(a){var o=a.type;return o==="subtitle"?B.CMCDObjectType.TIMED_TEXT:a.sn==="initSegment"?B.CMCDObjectType.INIT:o==="audio"?B.CMCDObjectType.AUDIO:o==="main"?this.hls.audioTracks.length?B.CMCDObjectType.VIDEO:B.CMCDObjectType.MUXED:void 0},u.getTopBandwidth=function(a){for(var o=0,c=a===B.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,L=R(c),w;!(w=L()).done;){var T=w.value;T.bitrate>o&&(o=T.bitrate)}return o>0?o:NaN},u.getBufferLength=function(a){var o=this.hls.media,c=a===B.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!c||!o)return NaN;var L=N.BufferHelper.bufferInfo(c,o.currentTime,this.config.maxBufferHole);return L.len*1e3},u.createPlaylistLoader=function(){var a=this.config.pLoader,o=this.applyPlaylistData,c=a||this.config.loader;return function(){function L(T){this.loader=void 0,this.loader=new c(T)}var w=L.prototype;return w.destroy=function(){this.loader.destroy()},w.abort=function(){this.loader.abort()},w.load=function(O,A,x){o(O),this.loader.load(O,A,x)},P(L,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),L}()},u.createFragmentLoader=function(){var a=this.config.fLoader,o=this.applyFragmentData,c=a||this.config.loader;return function(){function L(T){this.loader=void 0,this.loader=new c(T)}var w=L.prototype;return w.destroy=function(){this.loader.destroy()},w.abort=function(){this.loader.abort()},w.load=function(O,A,x){o(O),this.loader.load(O,A,x)},P(L,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),L}()},s.uuid=function(){var a=URL.createObjectURL(new Blob),o=a.toString();return URL.revokeObjectURL(a),o.substr(o.lastIndexOf("/")+1)},s.serialize=function(a){for(var o=[],c=function(D){return!Number.isNaN(D)&&D!=null&&D!==""&&D!==!1},L=function(D){return Math.round(D)},w=function(D){return L(D/100)*100},T=function(D){return encodeURIComponent(D)},O={br:L,d:L,bl:w,dl:w,mtp:w,nor:T,rtp:w,tb:L},A=Object.keys(a||{}).sort(),x=R(A),S;!(S=x()).done;){var E=S.value,d=a[E];if(!c(d))continue;if(E==="v"&&d===1)continue;if(E=="pr"&&d===1)continue;var b=O[E];b&&(d=b(d));var g=typeof d,_=void 0;E==="ot"||E==="sf"||E==="st"?_=E+"="+d:g==="boolean"?_=E:g==="number"?_=E+"="+d:_=E+"="+JSON.stringify(d),o.push(_)}return o.join(",")},s.toHeaders=function(a){for(var o=Object.keys(a),c={},L=["Object","Request","Session","Status"],w=[{},{},{},{}],T={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},O=0,A=o;O<A.length;O++){var x=A[O],S=T[x]!=null?T[x]:1;w[S][x]=a[x]}for(var E=0;E<w.length;E++){var d=s.serialize(w[E]);d&&(c["CMCD-"+L[E]]=d)}return c},s.toQuery=function(a){return"CMCD="+encodeURIComponent(s.serialize(a))},s.appendQueryToUri=function(a,o){if(!o)return a;var c=a.includes("?")?"&":"?";return""+a+c+o},s}()},"./src/controller/eme-controller.ts":function(ue,Z,M){"use strict";M.r(Z);var Q=M("./src/events.ts"),B=M("./src/errors.ts"),N=M("./src/utils/logger.ts"),K=M("./src/utils/mediakeys-helper.ts");function W(h,s){for(var u=0;u<s.length;u++){var l=s[u];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(h,l.key,l)}}function P(h,s,u){return s&&W(h.prototype,s),u&&W(h,u),h}var R=3,m=function(s,u,l){var a={audioCapabilities:[],videoCapabilities:[]};return s.forEach(function(o){a.audioCapabilities.push({contentType:'audio/mp4; codecs="'+o+'"',robustness:l.audioRobustness||""})}),u.forEach(function(o){a.videoCapabilities.push({contentType:'video/mp4; codecs="'+o+'"',robustness:l.videoRobustness||""})}),[a]},p=function(s,u,l,a){switch(s){case K.KeySystems.WIDEVINE:return m(u,l,a);default:throw new Error("Unknown key-system: "+s)}},f=function(){function h(u){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=u,this._config=u.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 s=h.prototype;return s.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},s._registerListeners=function(){this.hls.on(Q.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(Q.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(Q.Events.MANIFEST_PARSED,this.onManifestParsed,this)},s._unregisterListeners=function(){this.hls.off(Q.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(Q.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(Q.Events.MANIFEST_PARSED,this.onManifestParsed,this)},s.getLicenseServerUrl=function(l){switch(l){case K.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+l+'"')},s._attemptKeySystemAccess=function(l,a,o){var c=this,L=p(l,a,o,this._drmSystemOptions);N.logger.log("Requesting encrypted media key-system access");var w=this.requestMediaKeySystemAccess(l,L);this.mediaKeysPromise=w.then(function(T){return c._onMediaKeySystemAccessObtained(l,T)}),w.catch(function(T){N.logger.error('Failed to obtain key-system "'+l+'" access:',T)})},s._onMediaKeySystemAccessObtained=function(l,a){var o=this;N.logger.log('Access for key-system "'+l+'" obtained');var c={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:a,mediaKeySystemDomain:l};this._mediaKeysList.push(c);var L=Promise.resolve().then(function(){return a.createMediaKeys()}).then(function(w){return c.mediaKeys=w,N.logger.log('Media-keys created for key-system "'+l+'"'),o._onMediaKeysCreated(),w});return L.catch(function(w){N.logger.error("Failed to create media-keys:",w)}),L},s._onMediaKeysCreated=function(){var l=this;this._mediaKeysList.forEach(function(a){a.mediaKeysSession||(a.mediaKeysSession=a.mediaKeys.createSession(),l._onNewMediaKeySession(a.mediaKeysSession))})},s._onNewMediaKeySession=function(l){var a=this;N.logger.log("New key-system session "+l.sessionId),l.addEventListener("message",function(o){a._onKeySessionMessage(l,o.message)},!1)},s._onKeySessionMessage=function(l,a){N.logger.log("Got EME message event, creating license request"),this._requestLicense(a,function(o){N.logger.log("Received license data (length: "+(o&&o.byteLength)+"), updating key-session"),l.update(o)})},s.onMediaEncrypted=function(l){var a=this;if(N.logger.log('Media is encrypted using "'+l.initDataType+'" init data type'),!this.mediaKeysPromise){N.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(Q.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var o=function(L){if(!a._media)return;a._attemptSetMediaKeys(L),a._generateRequestWithPreferredKeySession(l.initDataType,l.initData)};this.mediaKeysPromise.then(o).catch(o)},s._attemptSetMediaKeys=function(l){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var a=this._mediaKeysList[0];if(!a||!a.mediaKeys){N.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(Q.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}N.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(a.mediaKeys),this._hasSetMediaKeys=!0}},s._generateRequestWithPreferredKeySession=function(l,a){var o=this,c=this._mediaKeysList[0];if(!c){N.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(Q.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(c.mediaKeysSessionInitialized){N.logger.warn("Key-Session already initialized but requested again");return}var L=c.mediaKeysSession;if(!L){N.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(Q.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!a){N.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(Q.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}N.logger.log('Generating key-session request for "'+l+'" init data type'),c.mediaKeysSessionInitialized=!0,L.generateRequest(l,a).then(function(){N.logger.debug("Key-session generation succeeded")}).catch(function(w){N.logger.error("Error generating key-session request:",w),o.hls.trigger(Q.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},s._createLicenseXhr=function(l,a,o){var c=new XMLHttpRequest;c.responseType="arraybuffer",c.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,c,l,a,o);var L=this._licenseXhrSetup;if(L)try{L.call(this.hls,c,l),L=void 0}catch(w){N.logger.error(w)}try{c.readyState||c.open("POST",l,!0),L&&L.call(this.hls,c,l)}catch(w){throw new Error("issue setting up KeySystem license XHR "+w)}return c},s._onLicenseRequestReadyStageChange=function(l,a,o,c){switch(l.readyState){case 4:if(l.status===200){this._requestLicenseFailureCount=0,N.logger.log("License request succeeded");var L=l.response,w=this._licenseResponseCallback;if(w)try{L=w.call(this.hls,l,a)}catch(O){N.logger.error(O)}c(L)}else{if(N.logger.error("License Request XHR failed ("+a+"). Status: "+l.status+" ("+l.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>R){this.hls.trigger(Q.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var T=R-this._requestLicenseFailureCount+1;N.logger.warn("Retrying license request, "+T+" attempts left"),this._requestLicense(o,c)}break}},s._generateLicenseRequestChallenge=function(l,a){switch(l.mediaKeySystemDomain){case K.KeySystems.WIDEVINE:return a}throw new Error("unsupported key-system: "+l.mediaKeySystemDomain)},s._requestLicense=function(l,a){N.logger.log("Requesting content license for key-system");var o=this._mediaKeysList[0];if(!o){N.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(Q.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var c=this.getLicenseServerUrl(o.mediaKeySystemDomain),L=this._createLicenseXhr(c,l,a);N.logger.log("Sending license request to URL: "+c);var w=this._generateLicenseRequestChallenge(o,l);L.send(w)}catch(T){N.logger.error("Failure requesting DRM license: "+T),this.hls.trigger(Q.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},s.onMediaAttached=function(l,a){if(!this._emeEnabled)return;var o=a.media;this._media=o,o.addEventListener("encrypted",this._onMediaEncrypted)},s.onMediaDetached=function(){var l=this._media,a=this._mediaKeysList;if(!l)return;l.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(a.map(function(o){if(o.mediaKeysSession)return o.mediaKeysSession.close().catch(function(){})})).then(function(){return l.setMediaKeys(null)}).catch(function(){})},s.onManifestParsed=function(l,a){if(!this._emeEnabled)return;var o=a.levels.map(function(L){return L.audioCodec}).filter(function(L){return!!L}),c=a.levels.map(function(L){return L.videoCodec}).filter(function(L){return!!L});this._attemptKeySystemAccess(K.KeySystems.WIDEVINE,o,c)},P(h,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),h}();Z.default=f},"./src/controller/fps-controller.ts":function(ue,Z,M){"use strict";M.r(Z);var Q=M("./src/events.ts"),B=M("./src/utils/logger.ts"),N=function(){function K(P){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=P,this.registerListeners()}var W=K.prototype;return W.setStreamController=function(R){this.streamController=R},W.registerListeners=function(){this.hls.on(Q.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},W.unregisterListeners=function(){this.hls.off(Q.Events.MEDIA_ATTACHING,this.onMediaAttaching)},W.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},W.onMediaAttaching=function(R,m){var p=this.hls.config;if(p.capLevelOnFPSDrop){var f=m.media instanceof self.HTMLVideoElement?m.media:null;this.media=f,f&&typeof f.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),p.fpsDroppedMonitoringPeriod)}},W.checkFPS=function(R,m,p){var f=performance.now();if(m){if(this.lastTime){var h=f-this.lastTime,s=p-this.lastDroppedFrames,u=m-this.lastDecodedFrames,l=1e3*s/h,a=this.hls;if(a.trigger(Q.Events.FPS_DROP,{currentDropped:s,currentDecoded:u,totalDroppedFrames:p}),l>0&&s>a.config.fpsDroppedMonitoringThreshold*u){var o=a.currentLevel;B.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+o),o>0&&(a.autoLevelCapping===-1||a.autoLevelCapping>=o)&&(o=o-1,a.trigger(Q.Events.FPS_DROP_LEVEL_CAPPING,{level:o,droppedLevel:a.currentLevel}),a.autoLevelCapping=o,this.streamController.nextLevelSwitch())}}this.lastTime=f,this.lastDroppedFrames=p,this.lastDecodedFrames=m}},W.checkFPSInterval=function(){var R=this.media;if(R)if(this.isVideoPlaybackQualityAvailable){var m=R.getVideoPlaybackQuality();this.checkFPS(R,m.totalVideoFrames,m.droppedVideoFrames)}else this.checkFPS(R,R.webkitDecodedFrameCount,R.webkitDroppedFrameCount)},K}();Z.default=N},"./src/controller/fragment-finders.ts":function(ue,Z,M){"use strict";M.r(Z),M.d(Z,"findFragmentByPDT",function(){return N}),M.d(Z,"findFragmentByPTS",function(){return K}),M.d(Z,"fragmentWithinToleranceTest",function(){return W}),M.d(Z,"pdtWithinToleranceTest",function(){return P}),M.d(Z,"findFragWithCC",function(){return R});var Q=M("./src/polyfills/number.ts"),B=M("./src/utils/binary-search.ts");function N(m,p,f){if(p===null||!Array.isArray(m)||!m.length||!Object(Q.isFiniteNumber)(p))return null;var h=m[0].programDateTime;if(p<(h||0))return null;var s=m[m.length-1].endProgramDateTime;if(p>=(s||0))return null;f=f||0;for(var u=0;u<m.length;++u){var l=m[u];if(P(p,f,l))return l}return null}function K(m,p,f,h){f===void 0&&(f=0),h===void 0&&(h=0);var s=null;if(m?s=p[m.sn-p[0].sn+1]||null:f===0&&p[0].start===0&&(s=p[0]),s&&W(f,h,s)===0)return s;var u=B.default.search(p,W.bind(null,f,h));return u||s}function W(m,p,f){m===void 0&&(m=0),p===void 0&&(p=0);var h=Math.min(p,f.duration+(f.deltaPTS?f.deltaPTS:0));return f.start+f.duration-h<=m?1:f.start-h>m&&f.start?-1:0}function P(m,p,f){var h=Math.min(p,f.duration+(f.deltaPTS?f.deltaPTS:0))*1e3,s=f.endProgramDateTime||0;return s-h>m}function R(m,p){return B.default.search(m,function(f){return f.cc<p?1:f.cc>p?-1:0})}},"./src/controller/fragment-tracker.ts":function(ue,Z,M){"use strict";M.r(Z),M.d(Z,"FragmentState",function(){return N}),M.d(Z,"FragmentTracker",function(){return K});var Q=M("./src/events.ts"),B=M("./src/types/loader.ts"),N;(function(R){R.NOT_LOADED="NOT_LOADED",R.BACKTRACKED="BACKTRACKED",R.APPENDING="APPENDING",R.PARTIAL="PARTIAL",R.OK="OK"})(N||(N={}));var K=function(){function R(p){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=p,this._registerListeners()}var m=R.prototype;return m._registerListeners=function(){var f=this.hls;f.on(Q.Events.BUFFER_APPENDED,this.onBufferAppended,this),f.on(Q.Events.FRAG_BUFFERED,this.onFragBuffered,this),f.on(Q.Events.FRAG_LOADED,this.onFragLoaded,this)},m._unregisterListeners=function(){var f=this.hls;f.off(Q.Events.BUFFER_APPENDED,this.onBufferAppended,this),f.off(Q.Events.FRAG_BUFFERED,this.onFragBuffered,this),f.off(Q.Events.FRAG_LOADED,this.onFragLoaded,this)},m.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},m.getAppendedFrag=function(f,h){if(h===B.PlaylistLevelType.MAIN){var s=this.activeFragment,u=this.activeParts;if(!s)return null;if(u)for(var l=u.length;l--;){var a=u[l],o=a?a.end:s.appendedPTS;if(a.start<=f&&o!==void 0&&f<=o)return l>9&&(this.activeParts=u.slice(l-9)),a}else if(s.start<=f&&s.appendedPTS!==void 0&&f<=s.appendedPTS)return s}return this.getBufferedFrag(f,h)},m.getBufferedFrag=function(f,h){for(var s=this.fragments,u=Object.keys(s),l=u.length;l--;){var a=s[u[l]];if((a==null?void 0:a.body.type)===h&&a.buffered){var o=a.body;if(o.start<=f&&f<=o.end)return o}}return null},m.detectEvictedFragments=function(f,h,s){var u=this;Object.keys(this.fragments).forEach(function(l){var a=u.fragments[l];if(!a)return;if(!a.buffered){a.body.type===s&&u.removeFragment(a.body);return}var o=a.range[f];if(!o)return;o.time.some(function(c){var L=!u.isTimeBuffered(c.startPTS,c.endPTS,h);return L&&u.removeFragment(a.body),L})})},m.detectPartialFragments=function(f){var h=this,s=this.timeRanges,u=f.frag,l=f.part;if(!s||u.sn==="initSegment")return;var a=P(u),o=this.fragments[a];if(!o)return;Object.keys(s).forEach(function(c){var L=u.elementaryStreams[c];if(!L)return;var w=s[c],T=l!==null||L.partial===!0;o.range[c]=h.getBufferedTimes(u,l,T,w)}),o.backtrack=o.loaded=null,Object.keys(o.range).length?o.buffered=!0:this.removeFragment(o.body)},m.fragBuffered=function(f){var h=P(f),s=this.fragments[h];s&&(s.backtrack=s.loaded=null,s.buffered=!0)},m.getBufferedTimes=function(f,h,s,u){for(var l={time:[],partial:s},a=h?h.start:f.start,o=h?h.end:f.end,c=f.minEndPTS||o,L=f.maxStartPTS||a,w=0;w<u.length;w++){var T=u.start(w)-this.bufferPadding,O=u.end(w)+this.bufferPadding;if(L>=T&&c<=O){l.time.push({startPTS:Math.max(a,u.start(w)),endPTS:Math.min(o,u.end(w))});break}else if(a<O&&o>T)l.partial=!0,l.time.push({startPTS:Math.max(a,u.start(w)),endPTS:Math.min(o,u.end(w))});else if(o<=T)break}return l},m.getPartialFragment=function(f){var h=null,s,u,l,a=0,o=this.bufferPadding,c=this.fragments;return Object.keys(c).forEach(function(L){var w=c[L];if(!w)return;W(w)&&(u=w.body.start-o,l=w.body.end+o,f>=u&&f<=l&&(s=Math.min(f-u,l-f),a<=s&&(h=w.body,a=s)))}),h},m.getState=function(f){var h=P(f),s=this.fragments[h];return s?s.buffered?W(s)?N.PARTIAL:N.OK:s.backtrack?N.BACKTRACKED:N.APPENDING:N.NOT_LOADED},m.backtrack=function(f,h){var s=P(f),u=this.fragments[s];if(!u||u.backtrack)return null;var l=u.backtrack=h||u.loaded;return u.loaded=null,l},m.getBacktrackData=function(f){var h=P(f),s=this.fragments[h];if(s){var u,l=s.backtrack;if(l!=null&&(u=l.payload)!==null&&u!==void 0&&u.byteLength)return l;this.removeFragment(f)}return null},m.isTimeBuffered=function(f,h,s){for(var u,l,a=0;a<s.length;a++){if(u=s.start(a)-this.bufferPadding,l=s.end(a)+this.bufferPadding,f>=u&&h<=l)return!0;if(h<=u)return!1}return!1},m.onFragLoaded=function(f,h){var s=h.frag,u=h.part;if(s.sn==="initSegment"||s.bitrateTest||u)return;var l=P(s);this.fragments[l]={body:s,loaded:h,backtrack:null,buffered:!1,range:Object.create(null)}},m.onBufferAppended=function(f,h){var s=this,u=h.frag,l=h.part,a=h.timeRanges;if(u.type===B.PlaylistLevelType.MAIN)if(this.activeFragment=u,l){var o=this.activeParts;o||(this.activeParts=o=[]),o.push(l)}else this.activeParts=null;this.timeRanges=a,Object.keys(a).forEach(function(c){var L=a[c];if(s.detectEvictedFragments(c,L),!l)for(var w=0;w<L.length;w++)u.appendedPTS=Math.max(L.end(w),u.appendedPTS||0)})},m.onFragBuffered=function(f,h){this.detectPartialFragments(h)},m.hasFragment=function(f){var h=P(f);return!!this.fragments[h]},m.removeFragmentsInRange=function(f,h,s){var u=this;Object.keys(this.fragments).forEach(function(l){var a=u.fragments[l];if(!a)return;if(a.buffered){var o=a.body;o.type===s&&o.start<h&&o.end>f&&u.removeFragment(o)}})},m.removeFragment=function(f){var h=P(f);f.stats.loaded=0,f.clearElementaryStreamInfo(),delete this.fragments[h]},m.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},R}();function W(R){var m,p;return R.buffered&&(((m=R.range.video)===null||m===void 0?void 0:m.partial)||((p=R.range.audio)===null||p===void 0?void 0:p.partial))}function P(R){return R.type+"_"+R.level+"_"+R.urlId+"_"+R.sn}},"./src/controller/gap-controller.ts":function(ue,Z,M){"use strict";M.r(Z),M.d(Z,"STALL_MINIMUM_DURATION_MS",function(){return W}),M.d(Z,"MAX_START_GAP_JUMP",function(){return P}),M.d(Z,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return R}),M.d(Z,"SKIP_BUFFER_RANGE_START",function(){return m}),M.d(Z,"default",function(){return p});var Q=M("./src/utils/buffer-helper.ts"),B=M("./src/errors.ts"),N=M("./src/events.ts"),K=M("./src/utils/logger.ts"),W=250,P=2,R=.1,m=.05,p=function(){function f(s,u,l,a){this.config=void 0,this.media=void 0,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=s,this.media=u,this.fragmentTracker=l,this.hls=a}var h=f.prototype;return h.destroy=function(){this.hls=this.fragmentTracker=this.media=null},h.poll=function(u){var l=this.config,a=this.media,o=this.stalled,c=a.currentTime,L=a.seeking,w=this.seeking&&!L,T=!this.seeking&&L;if(this.seeking=L,c!==u){if(this.moved=!0,o!==null){if(this.stallReported){var O=self.performance.now()-o;K.logger.warn("playback not stuck anymore @"+c+", after "+Math.round(O)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((T||w)&&(this.stalled=null),a.paused||a.ended||a.playbackRate===0||!Q.BufferHelper.getBuffered(a).length)return;var A=Q.BufferHelper.bufferInfo(a,c,0),x=A.len>0,S=A.nextStart||0;if(!x&&!S)return;if(L){var E=A.len>P,d=!S||S-c>P&&!this.fragmentTracker.getPartialFragment(c);if(E||d)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var b,g=Math.max(S,A.start||0)-c,_=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,F=_==null||((b=_.details)===null||b===void 0)?void 0:b.live,D=F?_.details.targetduration*2:P;if(g>0&&g<=D){this._trySkipBufferHole(null);return}}var j=self.performance.now();if(o===null){this.stalled=j;return}var H=j-o;!L&&H>=W&&this._reportStall(A.len);var k=Q.BufferHelper.bufferInfo(a,c,l.maxBufferHole);this._tryFixBufferStall(k,H)},h._tryFixBufferStall=function(u,l){var a=this.config,o=this.fragmentTracker,c=this.media,L=c.currentTime,w=o.getPartialFragment(L);if(w){var T=this._trySkipBufferHole(w);if(T)return}u.len>a.maxBufferHole&&l>a.highBufferWatchdogPeriod*1e3&&(K.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},h._reportStall=function(u){var l=this.hls,a=this.media,o=this.stallReported;o||(this.stallReported=!0,K.logger.warn("Playback stalling at @"+a.currentTime+" due to low buffer (buffer="+u+")"),l.trigger(N.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:u}))},h._trySkipBufferHole=function(u){for(var l=this.config,a=this.hls,o=this.media,c=o.currentTime,L=0,w=Q.BufferHelper.getBuffered(o),T=0;T<w.length;T++){var O=w.start(T);if(c+l.maxBufferHole>=L&&c<O){var A=Math.max(O+m,o.currentTime+R);return K.logger.warn("skipping hole, adjusting currentTime from "+c+" to "+A),this.moved=!0,this.stalled=null,o.currentTime=A,u&&a.trigger(N.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+c+" to "+A,frag:u}),A}L=w.end(T)}return 0},h._tryNudgeBuffer=function(){var u=this.config,l=this.hls,a=this.media,o=a.currentTime,c=(this.nudgeRetry||0)+1;if(this.nudgeRetry=c,c<u.nudgeMaxRetry){var L=o+c*u.nudgeOffset;K.logger.warn("Nudging 'currentTime' from "+o+" to "+L),a.currentTime=L,l.trigger(N.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else K.logger.error("Playhead still not moving while enough data buffered @"+o+" after "+u.nudgeMaxRetry+" nudges"),l.trigger(N.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},f}()},"./src/controller/id3-track-controller.ts":function(ue,Z,M){"use strict";M.r(Z);var Q=M("./src/events.ts"),B=M("./src/utils/texttrack-utils.ts"),N=M("./src/demux/id3.ts"),K=.25,W=function(){function P(m){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=m,this._registerListeners()}var R=P.prototype;return R.destroy=function(){this._unregisterListeners()},R._registerListeners=function(){var p=this.hls;p.on(Q.Events.MEDIA_ATTACHED,this.onMediaAttached,this),p.on(Q.Events.MEDIA_DETACHING,this.onMediaDetaching,this),p.on(Q.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),p.on(Q.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},R._unregisterListeners=function(){var p=this.hls;p.off(Q.Events.MEDIA_ATTACHED,this.onMediaAttached,this),p.off(Q.Events.MEDIA_DETACHING,this.onMediaDetaching,this),p.off(Q.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),p.off(Q.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},R.onMediaAttached=function(p,f){this.media=f.media},R.onMediaDetaching=function(){if(!this.id3Track)return;Object(B.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},R.getID3Track=function(p){if(!this.media)return;for(var f=0;f<p.length;f++){var h=p[f];if(h.kind==="metadata"&&h.label==="id3")return Object(B.sendAddTrackEvent)(h,this.media),h}return this.media.addTextTrack("metadata","id3")},R.onFragParsingMetadata=function(p,f){if(!this.media)return;var h=f.frag,s=f.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var u=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,l=0;l<s.length;l++){var a=N.getID3Frames(s[l].data);if(a){var o=s[l].pts,c=l<s.length-1?s[l+1].pts:h.end,L=c-o;L<=0&&(c=o+K);for(var w=0;w<a.length;w++){var T=a[w];if(!N.isTimeStampFrame(T)){var O=new u(o,c,"");O.value=T,this.id3Track.addCue(O)}}}}},R.onBufferFlushing=function(p,f){var h=f.startOffset,s=f.endOffset,u=f.type;if(!u||u==="audio"){var l=this.id3Track;l&&Object(B.removeCuesInRange)(l,h,s)}},P}();Z.default=W},"./src/controller/latency-controller.ts":function(ue,Z,M){"use strict";M.r(Z),M.d(Z,"default",function(){return P});var Q=M("./src/errors.ts"),B=M("./src/events.ts"),N=M("./src/utils/logger.ts");function K(R,m){for(var p=0;p<m.length;p++){var f=m[p];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(R,f.key,f)}}function W(R,m,p){return m&&K(R.prototype,m),p&&K(R,p),R}var P=function(){function R(p){var f=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 f.timeupdate()},this.hls=p,this.config=p.config,this.registerListeners()}var m=R.prototype;return m.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},m.registerListeners=function(){this.hls.on(B.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(B.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(B.Events.ERROR,this.onError,this)},m.unregisterListeners=function(){this.hls.off(B.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(B.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(B.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(B.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(B.Events.ERROR,this.onError)},m.onMediaAttached=function(f,h){this.media=h.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},m.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},m.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},m.onLevelUpdated=function(f,h){var s=h.details;this.levelDetails=s,s.advanced&&this.timeupdate(),!s.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},m.onError=function(f,h){if(h.details!==Q.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,N.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},m.timeupdate=function(){var f=this.media,h=this.levelDetails;if(!f||!h)return;this.currentTime=f.currentTime;var s=this.computeLatency();if(s===null)return;this._latency=s;var u=this.config,l=u.lowLatencyMode,a=u.maxLiveSyncPlaybackRate;if(!l||a===1)return;var o=this.targetLatency;if(o===null)return;var c=s-o,L=Math.min(this.maxLatency,o+h.targetduration),w=c<L;if(h.live&&w&&c>.05&&this.forwardBufferLength>1){var T=Math.min(2,Math.max(1,a)),O=Math.round(2/(1+Math.exp(-.75*c-this.edgeStalled))*20)/20;f.playbackRate=Math.min(T,Math.max(1,O))}else f.playbackRate!==1&&f.playbackRate!==0&&(f.playbackRate=1)},m.estimateLiveEdge=function(){var f=this.levelDetails;return f===null?null:f.edge+f.age},m.computeLatency=function(){var f=this.estimateLiveEdge();return f===null?null:f-this.currentTime},W(R,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var f=this.config,h=this.levelDetails;return f.liveMaxLatencyDuration!==void 0?f.liveMaxLatencyDuration:h?f.liveMaxLatencyDurationCount*h.targetduration:0}},{key:"targetLatency",get:function(){var f=this.levelDetails;if(f===null)return null;var h=f.holdBack,s=f.partHoldBack,u=f.targetduration,l=this.config,a=l.liveSyncDuration,o=l.liveSyncDurationCount,c=l.lowLatencyMode,L=this.hls.userConfig,w=c&&s||h;(L.liveSyncDuration||L.liveSyncDurationCount||w===0)&&(w=a!==void 0?a:o*u);var T=u,O=1;return w+Math.min(this.stallCount*O,T)}},{key:"liveSyncPosition",get:function(){var f=this.estimateLiveEdge(),h=this.targetLatency,s=this.levelDetails;if(f===null||h===null||s===null)return null;var u=s.edge,l=f-h-this.edgeStalled,a=u-s.totalduration,o=u-(this.config.lowLatencyMode&&s.partTarget||s.targetduration);return Math.min(Math.max(a,l),o)}},{key:"drift",get:function(){var f=this.levelDetails;return f===null?1:f.drift}},{key:"edgeStalled",get:function(){var f=this.levelDetails;if(f===null)return 0;var h=(this.config.lowLatencyMode&&f.partTarget||f.targetduration)*3;return Math.max(f.age-h,0)}},{key:"forwardBufferLength",get:function(){var f=this.media,h=this.levelDetails;if(!f||!h)return 0;var s=f.buffered.length;return s?f.buffered.end(s-1):h.edge-this.currentTime}}]),R}()},"./src/controller/level-controller.ts":function(ue,Z,M){"use strict";M.r(Z),M.d(Z,"default",function(){return l});var Q=M("./src/types/level.ts"),B=M("./src/events.ts"),N=M("./src/errors.ts"),K=M("./src/utils/codecs.ts"),W=M("./src/controller/level-helper.ts"),P=M("./src/controller/base-playlist-controller.ts"),R=M("./src/types/loader.ts");function m(){return m=Object.assign||function(a){for(var o=1;o<arguments.length;o++){var c=arguments[o];for(var L in c)Object.prototype.hasOwnProperty.call(c,L)&&(a[L]=c[L])}return a},m.apply(this,arguments)}function p(a,o){for(var c=0;c<o.length;c++){var L=o[c];L.enumerable=L.enumerable||!1,L.configurable=!0,"value"in L&&(L.writable=!0),Object.defineProperty(a,L.key,L)}}function f(a,o,c){return o&&p(a.prototype,o),c&&p(a,c),a}function h(a,o){a.prototype=Object.create(o.prototype),a.prototype.constructor=a,s(a,o)}function s(a,o){return s=Object.setPrototypeOf||function(L,w){return L.__proto__=w,L},s(a,o)}var u=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),l=function(a){h(o,a);function o(L){var w;return w=a.call(this,L,"[level-controller]")||this,w._levels=[],w._firstLevel=-1,w._startLevel=void 0,w.currentLevelIndex=-1,w.manualLevelIndex=-1,w.onParsedComplete=void 0,w._registerListeners(),w}var c=o.prototype;return c._registerListeners=function(){var w=this.hls;w.on(B.Events.MANIFEST_LOADED,this.onManifestLoaded,this),w.on(B.Events.LEVEL_LOADED,this.onLevelLoaded,this),w.on(B.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),w.on(B.Events.FRAG_LOADED,this.onFragLoaded,this),w.on(B.Events.ERROR,this.onError,this)},c._unregisterListeners=function(){var w=this.hls;w.off(B.Events.MANIFEST_LOADED,this.onManifestLoaded,this),w.off(B.Events.LEVEL_LOADED,this.onLevelLoaded,this),w.off(B.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),w.off(B.Events.FRAG_LOADED,this.onFragLoaded,this),w.off(B.Events.ERROR,this.onError,this)},c.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,a.prototype.destroy.call(this)},c.startLoad=function(){var w=this._levels;w.forEach(function(T){T.loadError=0}),a.prototype.startLoad.call(this)},c.onManifestLoaded=function(w,T){var O=[],A=[],x=[],S,E={},d,b=!1,g=!1,_=!1;if(T.levels.forEach(function(H){var k=H.attrs;b=b||!!(H.width&&H.height),g=g||!!H.videoCodec,_=_||!!H.audioCodec,u&&H.audioCodec&&H.audioCodec.indexOf("mp4a.40.34")!==-1&&(H.audioCodec=void 0);var y=H.bitrate+"-"+H.attrs.RESOLUTION+"-"+H.attrs.CODECS;d=E[y],d?d.url.push(H.url):(d=new Q.Level(H),E[y]=d,O.push(d)),k&&(k.AUDIO&&Object(W.addGroupId)(d,"audio",k.AUDIO),k.SUBTITLES&&Object(W.addGroupId)(d,"text",k.SUBTITLES))}),(b||g)&&_&&(O=O.filter(function(H){var k=H.videoCodec,y=H.width,G=H.height;return!!k||!!(y&&G)})),O=O.filter(function(H){var k=H.audioCodec,y=H.videoCodec;return(!k||Object(K.isCodecSupportedInMp4)(k,"audio"))&&(!y||Object(K.isCodecSupportedInMp4)(y,"video"))}),T.audioTracks&&(A=T.audioTracks.filter(function(H){return!H.audioCodec||Object(K.isCodecSupportedInMp4)(H.audioCodec,"audio")}),Object(W.assignTrackIdsByGroup)(A)),T.subtitles&&(x=T.subtitles,Object(W.assignTrackIdsByGroup)(x)),O.length>0){S=O[0].bitrate,O.sort(function(H,k){return H.bitrate-k.bitrate}),this._levels=O;for(var F=0;F<O.length;F++)if(O[F].bitrate===S){this._firstLevel=F,this.log("manifest loaded, "+O.length+" level(s) found, first bitrate: "+S);break}var D=_&&!g,j={levels:O,audioTracks:A,subtitleTracks:x,firstLevel:this._firstLevel,stats:T.stats,audio:_,video:g,altAudio:!D&&A.some(function(H){return!!H.url})};this.hls.trigger(B.Events.MANIFEST_PARSED,j),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(B.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:T.url,reason:"no level with compatible codecs found in manifest"})},c.onError=function(w,T){if(a.prototype.onError.call(this,w,T),T.fatal)return;var O=T.context,A=this._levels[this.currentLevelIndex];if(O&&(O.type===R.PlaylistContextType.AUDIO_TRACK&&A.audioGroupIds&&O.groupId===A.audioGroupIds[A.urlId]||O.type===R.PlaylistContextType.SUBTITLE_TRACK&&A.textGroupIds&&O.groupId===A.textGroupIds[A.urlId])){this.redundantFailover(this.currentLevelIndex);return}var x=!1,S=!0,E;switch(T.details){case N.ErrorDetails.FRAG_LOAD_ERROR:case N.ErrorDetails.FRAG_LOAD_TIMEOUT:case N.ErrorDetails.KEY_LOAD_ERROR:case N.ErrorDetails.KEY_LOAD_TIMEOUT:if(T.frag){var d=this._levels[T.frag.level];d?(d.fragmentError++,d.fragmentError>this.hls.config.fragLoadingMaxRetry&&(E=T.frag.level)):E=T.frag.level}break;case N.ErrorDetails.LEVEL_LOAD_ERROR:case N.ErrorDetails.LEVEL_LOAD_TIMEOUT:O&&(O.deliveryDirectives&&(S=!1),E=O.level),x=!0;break;case N.ErrorDetails.REMUX_ALLOC_ERROR:E=T.level,x=!0;break}E!==void 0&&this.recoverLevel(T,E,x,S)},c.recoverLevel=function(w,T,O,A){var x=w.details,S=this._levels[T];if(S.loadError++,O){var E=this.retryLoadingOrFail(w);if(E)w.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(A){var d=S.url.length;if(d>1&&S.loadError<d)w.levelRetry=!0,this.redundantFailover(T);else if(this.manualLevelIndex===-1){var b=T===0?this._levels.length-1:T-1;this.currentLevelIndex!==b&&this._levels[b].loadError===0&&(this.warn(x+": switch to "+b),w.levelRetry=!0,this.hls.nextAutoLevel=b)}}},c.redundantFailover=function(w){var T=this._levels[w],O=T.url.length;if(O>1){var A=(T.urlId+1)%O;this.warn("Switching to redundant URL-id "+A),this._levels.forEach(function(x){x.urlId=A}),this.level=w}},c.onFragLoaded=function(w,T){var O=T.frag;if(O!==void 0&&O.type===R.PlaylistLevelType.MAIN){var A=this._levels[O.level];A!==void 0&&(A.fragmentError=0,A.loadError=0)}},c.onLevelLoaded=function(w,T){var O,A=T.level,x=T.details,S=this._levels[A];if(!S){var E;this.warn("Invalid level index "+A),(E=T.deliveryDirectives)!==null&&E!==void 0&&E.skip&&(x.deltaUpdateFailed=!0);return}A===this.currentLevelIndex?(S.fragmentError===0&&(S.loadError=0,this.retryCount=0),this.playlistLoaded(A,T,S.details)):(O=T.deliveryDirectives)!==null&&O!==void 0&&O.skip&&(x.deltaUpdateFailed=!0)},c.onAudioTrackSwitched=function(w,T){var O=this.hls.levels[this.currentLevelIndex];if(!O)return;if(O.audioGroupIds){for(var A=-1,x=this.hls.audioTracks[T.id].groupId,S=0;S<O.audioGroupIds.length;S++)if(O.audioGroupIds[S]===x){A=S;break}A!==O.urlId&&(O.urlId=A,this.startLoad())}},c.loadPlaylist=function(w){var T=this.currentLevelIndex,O=this._levels[T];if(this.canLoad&&O&&O.url.length>0){var A=O.urlId,x=O.url[A];if(w)try{x=w.addDirectives(x)}catch(S){this.warn("Could not construct new URL with HLS Delivery Directives: "+S)}this.log("Attempt loading level index "+T+(w?" at sn "+w.msn+" part "+w.part:"")+" with URL-id "+A+" "+x),this.clearTimer(),this.hls.trigger(B.Events.LEVEL_LOADING,{url:x,level:T,id:A,deliveryDirectives:w||null})}},c.removeLevel=function(w,T){var O=function(S,E){return E!==T},A=this._levels.filter(function(x,S){return S!==w?!0:x.url.length>1&&T!==void 0?(x.url=x.url.filter(O),x.audioGroupIds&&(x.audioGroupIds=x.audioGroupIds.filter(O)),x.textGroupIds&&(x.textGroupIds=x.textGroupIds.filter(O)),x.urlId=0,!0):!1}).map(function(x,S){var E=x.details;return E!=null&&E.fragments&&E.fragments.forEach(function(d){d.level=S}),x});this._levels=A,this.hls.trigger(B.Events.LEVELS_UPDATED,{levels:A})},f(o,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(w){var T,O=this._levels;if(O.length===0)return;if(this.currentLevelIndex===w&&(T=O[w])!==null&&T!==void 0&&T.details)return;if(w<0||w>=O.length){var A=w<0;if(this.hls.trigger(B.Events.ERROR,{type:N.ErrorTypes.OTHER_ERROR,details:N.ErrorDetails.LEVEL_SWITCH_ERROR,level:w,fatal:A,reason:"invalid level idx"}),A)return;w=Math.min(w,O.length-1)}this.clearTimer();var x=this.currentLevelIndex,S=O[x],E=O[w];this.log("switching to level "+w+" from "+x),this.currentLevelIndex=w;var d=m({},E,{level:w,maxBitrate:E.maxBitrate,uri:E.uri,urlId:E.urlId});delete d._urlId,this.hls.trigger(B.Events.LEVEL_SWITCHING,d);var b=E.details;if(!b||b.live){var g=this.switchParams(E.uri,S==null?void 0:S.details);this.loadPlaylist(g)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(w){this.manualLevelIndex=w,this._startLevel===void 0&&(this._startLevel=w),w!==-1&&(this.level=w)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(w){this._firstLevel=w}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var w=this.hls.config.startLevel;return w!==void 0?w:this._firstLevel}else return this._startLevel},set:function(w){this._startLevel=w}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(w){this.level=w,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=w)}}]),o}(P.default)},"./src/controller/level-helper.ts":function(ue,Z,M){"use strict";M.r(Z),M.d(Z,"addGroupId",function(){return N}),M.d(Z,"assignTrackIdsByGroup",function(){return K}),M.d(Z,"updatePTS",function(){return W}),M.d(Z,"updateFragPTSDTS",function(){return R}),M.d(Z,"mergeDetails",function(){return m}),M.d(Z,"mapPartIntersection",function(){return p}),M.d(Z,"mapFragmentIntersection",function(){return f}),M.d(Z,"adjustSliding",function(){return h}),M.d(Z,"addSliding",function(){return s}),M.d(Z,"computeReloadInterval",function(){return u}),M.d(Z,"getFragmentWithSN",function(){return l}),M.d(Z,"getPartWith",function(){return a});var Q=M("./src/polyfills/number.ts"),B=M("./src/utils/logger.ts");function N(o,c,L){switch(c){case"audio":o.audioGroupIds||(o.audioGroupIds=[]),o.audioGroupIds.push(L);break;case"text":o.textGroupIds||(o.textGroupIds=[]),o.textGroupIds.push(L);break}}function K(o){var c={};o.forEach(function(L){var w=L.groupId||"";L.id=c[w]=c[w]||0,c[w]++})}function W(o,c,L){var w=o[c],T=o[L];P(w,T)}function P(o,c){var L=c.startPTS;if(Object(Q.isFiniteNumber)(L)){var w=0,T;c.sn>o.sn?(w=L-o.start,T=o):(w=o.start-L,T=c),T.duration!==w&&(T.duration=w)}else if(c.sn>o.sn){var O=o.cc===c.cc;O&&o.minEndPTS?c.start=o.start+(o.minEndPTS-o.start):c.start=o.start+o.duration}else c.start=Math.max(o.start-c.duration,0)}function R(o,c,L,w,T,O){var A=w-L;A<=0&&(B.logger.warn("Fragment should have a positive duration",c),w=L+c.duration,O=T+c.duration);var x=L,S=w,E=c.startPTS,d=c.endPTS;if(Object(Q.isFiniteNumber)(E)){var b=Math.abs(E-L);Object(Q.isFiniteNumber)(c.deltaPTS)?c.deltaPTS=Math.max(b,c.deltaPTS):c.deltaPTS=b,x=Math.max(L,E),L=Math.min(L,E),T=Math.min(T,c.startDTS),S=Math.min(w,d),w=Math.max(w,d),O=Math.max(O,c.endDTS)}c.duration=w-L;var g=L-c.start;c.appendedPTS=w,c.start=c.startPTS=L,c.maxStartPTS=x,c.startDTS=T,c.endPTS=w,c.minEndPTS=S,c.endDTS=O;var _=c.sn;if(!o||_<o.startSN||_>o.endSN)return 0;var F,D=_-o.startSN,j=o.fragments;for(j[D]=c,F=D;F>0;F--)P(j[F],j[F-1]);for(F=D;F<j.length-1;F++)P(j[F],j[F+1]);return o.fragmentHint&&P(j[j.length-1],o.fragmentHint),o.PTSKnown=o.alignedSliding=!0,g}function m(o,c){for(var L=null,w=o.fragments,T=w.length-1;T>=0;T--){var O=w[T].initSegment;if(O){L=O;break}}o.fragmentHint&&delete o.fragmentHint.endPTS;var A=0,x;if(f(o,c,function(F,D){F.relurl&&(A=F.cc-D.cc),Object(Q.isFiniteNumber)(F.startPTS)&&Object(Q.isFiniteNumber)(F.endPTS)&&(D.start=D.startPTS=F.startPTS,D.startDTS=F.startDTS,D.appendedPTS=F.appendedPTS,D.maxStartPTS=F.maxStartPTS,D.endPTS=F.endPTS,D.endDTS=F.endDTS,D.minEndPTS=F.minEndPTS,D.duration=F.endPTS-F.startPTS,D.duration&&(x=D),c.PTSKnown=c.alignedSliding=!0),D.elementaryStreams=F.elementaryStreams,D.loader=F.loader,D.stats=F.stats,D.urlId=F.urlId,F.initSegment&&(D.initSegment=F.initSegment,L=F.initSegment)}),L){var S=c.fragmentHint?c.fragments.concat(c.fragmentHint):c.fragments;S.forEach(function(F){var D;(!F.initSegment||F.initSegment.relurl===((D=L)===null||D===void 0?void 0:D.relurl))&&(F.initSegment=L)})}if(c.skippedSegments&&(c.deltaUpdateFailed=c.fragments.some(function(F){return!F}),c.deltaUpdateFailed)){B.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var E=c.skippedSegments;E--;)c.fragments.shift();c.startSN=c.fragments[0].sn,c.startCC=c.fragments[0].cc}var d=c.fragments;if(A){B.logger.warn("discontinuity sliding from playlist, take drift into account");for(var b=0;b<d.length;b++)d[b].cc+=A}c.skippedSegments&&(c.startCC=c.fragments[0].cc),p(o.partList,c.partList,function(F,D){D.elementaryStreams=F.elementaryStreams,D.stats=F.stats}),x?R(c,x,x.startPTS,x.endPTS,x.startDTS,x.endDTS):h(o,c),d.length&&(c.totalduration=c.edge-d[0].start),c.driftStartTime=o.driftStartTime,c.driftStart=o.driftStart;var g=c.advancedDateTime;if(c.advanced&&g){var _=c.edge;c.driftStart||(c.driftStartTime=g,c.driftStart=_),c.driftEndTime=g,c.driftEnd=_}else c.driftEndTime=o.driftEndTime,c.driftEnd=o.driftEnd,c.advancedDateTime=o.advancedDateTime}function p(o,c,L){if(o&&c)for(var w=0,T=0,O=o.length;T<=O;T++){var A=o[T],x=c[T+w];A&&x&&A.index===x.index&&A.fragment.sn===x.fragment.sn?L(A,x):w--}}function f(o,c,L){for(var w=c.skippedSegments,T=Math.max(o.startSN,c.startSN)-c.startSN,O=(o.fragmentHint?1:0)+(w?c.endSN:Math.min(o.endSN,c.endSN))-c.startSN,A=c.startSN-o.startSN,x=c.fragmentHint?c.fragments.concat(c.fragmentHint):c.fragments,S=o.fragmentHint?o.fragments.concat(o.fragmentHint):o.fragments,E=T;E<=O;E++){var d=S[A+E],b=x[E];w&&!b&&E<w&&(b=c.fragments[E]=d),d&&b&&L(d,b)}}function h(o,c){var L=c.startSN+c.skippedSegments-o.startSN,w=o.fragments;if(L<0||L>=w.length)return;s(c,w[L].start)}function s(o,c){if(c){for(var L=o.fragments,w=o.skippedSegments;w<L.length;w++)L[w].start+=c;o.fragmentHint&&(o.fragmentHint.start+=c)}}function u(o,c){var L=1e3*o.levelTargetDuration,w=L/2,T=o.age,O=T>0&&T<L*3,A=c.loading.end-c.loading.start,x,S=o.availabilityDelay;if(o.updated===!1)if(O){var E=333*o.misses;x=Math.max(Math.min(w,A*2),E),o.availabilityDelay=(o.availabilityDelay||0)+x}else x=w;else O?(S=Math.min(S||L/2,T),o.availabilityDelay=S,x=S+L-T):x=L-A;return Math.round(x)}function l(o,c,L){if(!o||!o.details)return null;var w=o.details,T=w.fragments[c-w.startSN];return T||(T=w.fragmentHint,T&&T.sn===c?T:c<w.startSN&&L&&L.sn===c?L:null)}function a(o,c,L){if(!o||!o.details)return null;var w=o.details.partList;if(w)for(var T=w.length;T--;){var O=w[T];if(O.index===L&&O.fragment.sn===c)return O}return null}},"./src/controller/stream-controller.ts":function(ue,Z,M){"use strict";M.r(Z),M.d(Z,"default",function(){return w});var Q=M("./src/polyfills/number.ts"),B=M("./src/controller/base-stream-controller.ts"),N=M("./src/is-supported.ts"),K=M("./src/events.ts"),W=M("./src/utils/buffer-helper.ts"),P=M("./src/controller/fragment-tracker.ts"),R=M("./src/types/loader.ts"),m=M("./src/loader/fragment.ts"),p=M("./src/demux/transmuxer-interface.ts"),f=M("./src/types/transmuxer.ts"),h=M("./src/controller/gap-controller.ts"),s=M("./src/errors.ts"),u=M("./src/utils/logger.ts");function l(T,O){for(var A=0;A<O.length;A++){var x=O[A];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(T,x.key,x)}}function a(T,O,A){return O&&l(T.prototype,O),A&&l(T,A),T}function o(T,O){T.prototype=Object.create(O.prototype),T.prototype.constructor=T,c(T,O)}function c(T,O){return c=Object.setPrototypeOf||function(x,S){return x.__proto__=S,x},c(T,O)}var L=100,w=function(T){o(O,T);function O(x,S){var E;return E=T.call(this,x,S,"[stream-controller]")||this,E.audioCodecSwap=!1,E.gapController=null,E.level=-1,E._forceStartLoad=!1,E.altAudio=!1,E.audioOnly=!1,E.fragPlaying=null,E.onvplaying=null,E.onvseeked=null,E.fragLastKbps=0,E.stalled=!1,E.couldBacktrack=!1,E.audioCodecSwitch=!1,E.videoBuffer=null,E._registerListeners(),E}var A=O.prototype;return A._registerListeners=function(){var S=this.hls;S.on(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),S.on(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),S.on(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),S.on(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),S.on(K.Events.LEVEL_LOADING,this.onLevelLoading,this),S.on(K.Events.LEVEL_LOADED,this.onLevelLoaded,this),S.on(K.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),S.on(K.Events.ERROR,this.onError,this),S.on(K.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),S.on(K.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),S.on(K.Events.BUFFER_CREATED,this.onBufferCreated,this),S.on(K.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),S.on(K.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),S.on(K.Events.FRAG_BUFFERED,this.onFragBuffered,this)},A._unregisterListeners=function(){var S=this.hls;S.off(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),S.off(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),S.off(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),S.off(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),S.off(K.Events.LEVEL_LOADED,this.onLevelLoaded,this),S.off(K.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),S.off(K.Events.ERROR,this.onError,this),S.off(K.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),S.off(K.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),S.off(K.Events.BUFFER_CREATED,this.onBufferCreated,this),S.off(K.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),S.off(K.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),S.off(K.Events.FRAG_BUFFERED,this.onFragBuffered,this)},A.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},A.startLoad=function(S){if(this.levels){var E=this.lastCurrentTime,d=this.hls;if(this.stopLoad(),this.setInterval(L),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var b=d.startLevel;b===-1&&(d.config.testBandwidth?(b=0,this.bitrateTest=!0):b=d.nextAutoLevel),this.level=d.nextLoadLevel=b,this.loadedmetadata=!1}E>0&&S===-1&&(this.log("Override startPosition with lastCurrentTime @"+E.toFixed(3)),S=E),this.state=B.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=S,this.tick()}else this._forceStartLoad=!0,this.state=B.State.STOPPED},A.stopLoad=function(){this._forceStartLoad=!1,T.prototype.stopLoad.call(this)},A.doTick=function(){switch(this.state){case B.State.IDLE:this.doTickIdle();break;case B.State.WAITING_LEVEL:{var S,E=this.levels,d=this.level,b=E==null||((S=E[d])===null||S===void 0)?void 0:S.details;if(b&&(!b.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(b))break;this.state=B.State.IDLE;break}break}case B.State.FRAG_LOADING_WAITING_RETRY:{var g,_=self.performance.now(),F=this.retryDate;(!F||_>=F||(g=this.media)!==null&&g!==void 0&&g.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=B.State.IDLE)}break;default:break}this.onTickEnd()},A.onTickEnd=function(){T.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},A.doTickIdle=function(){var S,E,d=this.hls,b=this.levelLastLoaded,g=this.levels,_=this.media,F=d.config,D=d.nextLoadLevel;if(b===null||!_&&(this.startFragRequested||!F.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!g||!g[D])return;var j=g[D];this.level=d.nextLoadLevel=D;var H=j.details;if(!H||this.state===B.State.WAITING_LEVEL||H.live&&this.levelLastLoaded!==D){this.state=B.State.WAITING_LEVEL;return}var k=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:_,R.PlaylistLevelType.MAIN);if(k===null)return;var y=k.len,G=this.getMaxBufferLength(j.maxBitrate);if(y>=G)return;if(this._streamEnded(k,H)){var Y={};this.altAudio&&(Y.type="video"),this.hls.trigger(K.Events.BUFFER_EOS,Y),this.state=B.State.ENDED;return}var ie=k.end,se=this.getNextFragment(ie,H);if(this.couldBacktrack&&!this.fragPrevious&&se&&se.sn!=="initSegment"){var we=se.sn-H.startSN;we>1&&(se=H.fragments[we-1],this.fragmentTracker.removeFragment(se))}if(se&&this.fragmentTracker.getState(se)===P.FragmentState.OK&&this.nextLoadPosition>ie){var ve=this.audioOnly&&!this.altAudio?m.ElementaryStreamTypes.AUDIO:m.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(_,ve,R.PlaylistLevelType.MAIN),se=this.getNextFragment(this.nextLoadPosition,H)}if(!se)return;se.initSegment&&!se.initSegment.data&&!this.bitrateTest&&(se=se.initSegment),((S=se.decryptdata)===null||S===void 0?void 0:S.keyFormat)==="identity"&&!((E=se.decryptdata)!==null&&E!==void 0&&E.key)?this.loadKey(se,H):this.loadFragment(se,H,ie)},A.loadFragment=function(S,E,d){var b,g=this.fragmentTracker.getState(S);if(this.fragCurrent=S,g===P.FragmentState.BACKTRACKED){var _=this.fragmentTracker.getBacktrackData(S);if(_){this._handleFragmentLoadProgress(_),this._handleFragmentLoadComplete(_);return}else g=P.FragmentState.NOT_LOADED}g===P.FragmentState.NOT_LOADED||g===P.FragmentState.PARTIAL?S.sn==="initSegment"?this._loadInitSegment(S):this.bitrateTest?(S.bitrateTest=!0,this.log("Fragment "+S.sn+" of level "+S.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(S)):(this.startFragRequested=!0,T.prototype.loadFragment.call(this,S,E,d)):g===P.FragmentState.APPENDING?this.reduceMaxBufferLength(S.duration)&&this.fragmentTracker.removeFragment(S):((b=this.media)===null||b===void 0?void 0:b.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},A.getAppendedFrag=function(S){var E=this.fragmentTracker.getAppendedFrag(S,R.PlaylistLevelType.MAIN);return E&&"fragment"in E?E.fragment:E},A.getBufferedFrag=function(S){return this.fragmentTracker.getBufferedFrag(S,R.PlaylistLevelType.MAIN)},A.followingBufferedFrag=function(S){return S?this.getBufferedFrag(S.end+.5):null},A.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},A.nextLevelSwitch=function(){var S=this.levels,E=this.media;if(E!=null&&E.readyState){var d,b=this.getAppendedFrag(E.currentTime);if(b&&b.start>1&&this.flushMainBuffer(0,b.start-1),!E.paused&&S){var g=this.hls.nextLoadLevel,_=S[g],F=this.fragLastKbps;F&&this.fragCurrent?d=this.fragCurrent.duration*_.maxBitrate/(1e3*F)+1:d=0}else d=0;var D=this.getBufferedFrag(E.currentTime+d);if(D){var j=this.followingBufferedFrag(D);if(j){this.abortCurrentFrag();var H=j.maxStartPTS?j.maxStartPTS:j.start,k=j.duration,y=Math.max(D.end,H+Math.min(Math.max(k-this.config.maxFragLookUpTolerance,k*.5),k*.75));this.flushMainBuffer(y,Number.POSITIVE_INFINITY)}}}},A.abortCurrentFrag=function(){var S=this.fragCurrent;this.fragCurrent=null,S!=null&&S.loader&&S.loader.abort(),this.state===B.State.KEY_LOADING&&(this.state=B.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},A.flushMainBuffer=function(S,E){T.prototype.flushMainBuffer.call(this,S,E,this.altAudio?"video":null)},A.onMediaAttached=function(S,E){T.prototype.onMediaAttached.call(this,S,E);var d=E.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),d.addEventListener("playing",this.onvplaying),d.addEventListener("seeked",this.onvseeked),this.gapController=new h.default(this.config,d,this.fragmentTracker,this.hls)},A.onMediaDetaching=function(){var S=this.media;S&&(S.removeEventListener("playing",this.onvplaying),S.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),T.prototype.onMediaDetaching.call(this)},A.onMediaPlaying=function(){this.tick()},A.onMediaSeeked=function(){var S=this.media,E=S?S.currentTime:null;Object(Q.isFiniteNumber)(E)&&this.log("Media seeked to "+E.toFixed(3)),this.tick()},A.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(K.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},A.onManifestParsed=function(S,E){var d=!1,b=!1,g;E.levels.forEach(function(_){g=_.audioCodec,g&&(g.indexOf("mp4a.40.2")!==-1&&(d=!0),g.indexOf("mp4a.40.5")!==-1&&(b=!0))}),this.audioCodecSwitch=d&&b&&!Object(N.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=E.levels,this.startFragRequested=!1},A.onLevelLoading=function(S,E){var d=this.levels;if(!d||this.state!==B.State.IDLE)return;var b=d[E.level];(!b.details||b.details.live&&this.levelLastLoaded!==E.level||this.waitForCdnTuneIn(b.details))&&(this.state=B.State.WAITING_LEVEL)},A.onLevelLoaded=function(S,E){var d,b=this.levels,g=E.level,_=E.details,F=_.totalduration;if(!b){this.warn("Levels were reset while loading level "+g);return}this.log("Level "+g+" loaded ["+_.startSN+","+_.endSN+"], cc ["+_.startCC+", "+_.endCC+"] duration:"+F);var D=this.fragCurrent;D&&(this.state===B.State.FRAG_LOADING||this.state===B.State.FRAG_LOADING_WAITING_RETRY)&&(D.level!==E.level&&D.loader&&(this.state=B.State.IDLE,D.loader.abort()));var j=b[g],H=0;if(_.live||(d=j.details)!==null&&d!==void 0&&d.live){if(_.fragments[0]||(_.deltaUpdateFailed=!0),_.deltaUpdateFailed)return;H=this.alignPlaylists(_,j.details)}if(j.details=_,this.levelLastLoaded=g,this.hls.trigger(K.Events.LEVEL_UPDATED,{details:_,level:g}),this.state===B.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(_))return;this.state=B.State.IDLE}this.startFragRequested?_.live&&this.synchronizeToLiveEdge(_):this.setStartPosition(_,H),this.tick()},A._handleFragmentLoadProgress=function(S){var E,d=S.frag,b=S.part,g=S.payload,_=this.levels;if(!_){this.warn("Levels were reset while fragment load was in progress. Fragment "+d.sn+" of level "+d.level+" will not be buffered");return}var F=_[d.level],D=F.details;if(!D){this.warn("Dropping fragment "+d.sn+" of level "+d.level+" after level details were reset");return}var j=F.videoCodec,H=D.PTSKnown||!D.live,k=(E=d.initSegment)===null||E===void 0?void 0:E.data,y=this._getAudioCodec(F),G=this.transmuxer=this.transmuxer||new p.default(this.hls,R.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),Y=b?b.index:-1,ie=Y!==-1,se=new f.ChunkMetadata(d.level,d.sn,d.stats.chunkCount,g.byteLength,Y,ie),we=this.initPTS[d.cc];G.push(g,k,y,j,d,b,D.totalduration,H,se,we)},A.onAudioTrackSwitching=function(S,E){var d=this.altAudio,b=!!E.url,g=E.id;if(!b){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var _=this.fragCurrent;_!=null&&_.loader&&(this.log("Switching to main audio track, cancel main fragment load"),_.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var F=this.hls;d&&F.trigger(K.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),F.trigger(K.Events.AUDIO_TRACK_SWITCHED,{id:g})}},A.onAudioTrackSwitched=function(S,E){var d=E.id,b=!!this.hls.audioTracks[d].url;if(b){var g=this.videoBuffer;g&&this.mediaBuffer!==g&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=g)}this.altAudio=b,this.tick()},A.onBufferCreated=function(S,E){var d=E.tracks,b,g,_=!1;for(var F in d){var D=d[F];if(D.id==="main"){if(g=F,b=D,F==="video"){var j=d[F];j&&(this.videoBuffer=j.buffer)}}else _=!0}_&&b?(this.log("Alternate track found, use "+g+".buffered to schedule main fragment loading"),this.mediaBuffer=b.buffer):this.mediaBuffer=this.media},A.onFragBuffered=function(S,E){var d=E.frag,b=E.part;if(d&&d.type!==R.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(d)){this.warn("Fragment "+d.sn+(b?" p: "+b.index:"")+" of level "+d.level+" finished buffering, but was aborted. state: "+this.state),this.state===B.State.PARSED&&(this.state=B.State.IDLE);return}var g=b?b.stats:d.stats;this.fragLastKbps=Math.round(8*g.total/(g.buffering.end-g.loading.first)),d.sn!=="initSegment"&&(this.fragPrevious=d),this.fragBufferedComplete(d,b)},A.onError=function(S,E){switch(E.details){case s.ErrorDetails.FRAG_LOAD_ERROR:case s.ErrorDetails.FRAG_LOAD_TIMEOUT:case s.ErrorDetails.KEY_LOAD_ERROR:case s.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(R.PlaylistLevelType.MAIN,E);break;case s.ErrorDetails.LEVEL_LOAD_ERROR:case s.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==B.State.ERROR&&(E.fatal?(this.warn(""+E.details),this.state=B.State.ERROR):!E.levelRetry&&this.state===B.State.WAITING_LEVEL&&(this.state=B.State.IDLE));break;case s.ErrorDetails.BUFFER_FULL_ERROR:if(E.parent==="main"&&(this.state===B.State.PARSING||this.state===B.State.PARSED)){var d=!0,b=this.getFwdBufferInfo(this.media,R.PlaylistLevelType.MAIN);b&&b.len>.5&&(d=!this.reduceMaxBufferLength(b.len)),d&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},A.checkBuffer=function(){var S=this.media,E=this.gapController;if(!S||!E||!S.readyState)return;var d=W.BufferHelper.getBuffered(S);!this.loadedmetadata&&d.length?(this.loadedmetadata=!0,this.seekToStartPos()):E.poll(this.lastCurrentTime),this.lastCurrentTime=S.currentTime},A.onFragLoadEmergencyAborted=function(){this.state=B.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},A.onBufferFlushed=function(S,E){var d=E.type;if(d!==m.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var b=(d===m.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(b,d,R.PlaylistLevelType.MAIN)}},A.onLevelsUpdated=function(S,E){this.levels=E.levels},A.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},A.seekToStartPos=function(){var S=this.media,E=S.currentTime,d=this.startPosition;if(d>=0&&E<d){if(S.seeking){u.logger.log("could not seek to "+d+", already seeking at "+E);return}var b=W.BufferHelper.getBuffered(S),g=b.length?b.start(0):0,_=g-d;_>0&&(_<this.config.maxBufferHole||_<this.config.maxFragLookUpTolerance)&&(u.logger.log("adjusting start position by "+_+" to match buffer start"),d+=_,this.startPosition=d),this.log("seek to target start position "+d+" from current time "+E),S.currentTime=d}},A._getAudioCodec=function(S){var E=this.config.defaultAudioCodec||S.audioCodec;return this.audioCodecSwap&&E&&(this.log("Swapping audio codec"),E.indexOf("mp4a.40.5")!==-1?E="mp4a.40.2":E="mp4a.40.5"),E},A._loadBitrateTestFrag=function(S){var E=this;this._doFragLoad(S).then(function(d){var b=E.hls;if(!d||b.nextLoadLevel||E.fragContextChanged(S))return;E.fragLoadError=0,E.state=B.State.IDLE,E.startFragRequested=!1,E.bitrateTest=!1;var g=S.stats;g.parsing.start=g.parsing.end=g.buffering.start=g.buffering.end=self.performance.now(),b.trigger(K.Events.FRAG_LOADED,d)})},A._handleTransmuxComplete=function(S){var E,d="main",b=this.hls,g=S.remuxResult,_=S.chunkMeta,F=this.getCurrentContext(_);if(!F){this.warn("The loading context changed while buffering fragment "+_.sn+" of level "+_.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(_.level);return}var D=F.frag,j=F.part,H=F.level,k=g.video,y=g.text,G=g.id3,Y=g.initSegment,ie=this.altAudio?void 0:g.audio;if(this.fragContextChanged(D))return;if(this.state=B.State.PARSING,Y){Y.tracks&&(this._bufferInitSegment(H,Y.tracks,D,_),b.trigger(K.Events.FRAG_PARSING_INIT_SEGMENT,{frag:D,id:d,tracks:Y.tracks}));var se=Y.initPTS,we=Y.timescale;Object(Q.isFiniteNumber)(se)&&(this.initPTS[D.cc]=se,b.trigger(K.Events.INIT_PTS_FOUND,{frag:D,id:d,initPTS:se,timescale:we}))}if(k&&g.independent!==!1){if(H.details){var ve=k.startPTS,Se=k.endPTS,Ce=k.startDTS,pe=k.endDTS;if(j)j.elementaryStreams[k.type]={startPTS:ve,endPTS:Se,startDTS:Ce,endDTS:pe};else if(k.firstKeyFrame&&k.independent&&(this.couldBacktrack=!0),k.dropped&&k.independent){var fe=this.getLoadPosition()+this.config.maxBufferHole;if(fe<ve){this.backtrack(D);return}D.setElementaryStreamInfo(k.type,D.start,Se,D.start,pe,!0)}D.setElementaryStreamInfo(k.type,ve,Se,Ce,pe),this.bufferFragmentData(k,D,j,_)}}else if(g.independent===!1){this.backtrack(D);return}if(ie){var oe=ie.startPTS,te=ie.endPTS,he=ie.startDTS,ae=ie.endDTS;j&&(j.elementaryStreams[m.ElementaryStreamTypes.AUDIO]={startPTS:oe,endPTS:te,startDTS:he,endDTS:ae}),D.setElementaryStreamInfo(m.ElementaryStreamTypes.AUDIO,oe,te,he,ae),this.bufferFragmentData(ie,D,j,_)}if(G!=null&&(E=G.samples)!==null&&E!==void 0&&E.length){var Ae={frag:D,id:d,samples:G.samples};b.trigger(K.Events.FRAG_PARSING_METADATA,Ae)}if(y){var ke={frag:D,id:d,samples:y.samples};b.trigger(K.Events.FRAG_PARSING_USERDATA,ke)}},A._bufferInitSegment=function(S,E,d,b){var g=this;if(this.state!==B.State.PARSING)return;this.audioOnly=!!E.audio&&!E.video,this.altAudio&&!this.audioOnly&&delete E.audio;var _=E.audio,F=E.video,D=E.audiovideo;if(_){var j=S.audioCodec,H=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(j&&(j.indexOf("mp4a.40.5")!==-1?j="mp4a.40.2":j="mp4a.40.5"),_.metadata.channelCount!==1&&H.indexOf("firefox")===-1&&(j="mp4a.40.5")),H.indexOf("android")!==-1&&_.container!=="audio/mpeg"&&(j="mp4a.40.2",this.log("Android: force audio codec to "+j)),S.audioCodec&&S.audioCodec!==j&&this.log('Swapping manifest audio codec "'+S.audioCodec+'" for "'+j+'"'),_.levelCodec=j,_.id="main",this.log("Init audio buffer, container:"+_.container+", codecs[selected/level/parsed]=["+(j||"")+"/"+(S.audioCodec||"")+"/"+_.codec+"]")}F&&(F.levelCodec=S.videoCodec,F.id="main",this.log("Init video buffer, container:"+F.container+", codecs[level/parsed]=["+(S.videoCodec||"")+"/"+F.codec+"]")),D&&this.log("Init audiovideo buffer, container:"+D.container+", codecs[level/parsed]=["+(S.attrs.CODECS||"")+"/"+D.codec+"]"),this.hls.trigger(K.Events.BUFFER_CODECS,E),Object.keys(E).forEach(function(k){var y=E[k],G=y.initSegment;G!=null&&G.byteLength&&g.hls.trigger(K.Events.BUFFER_APPENDING,{type:k,data:G,frag:d,part:null,chunkMeta:b,parent:d.type})}),this.tick()},A.backtrack=function(S){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(S);var E=this.fragmentTracker.backtrack(S);this.fragPrevious=null,this.nextLoadPosition=S.start,E?this.resetFragmentLoading(S):this.state=B.State.BACKTRACKING},A.checkFragmentChanged=function(){var S=this.media,E=null;if(S&&S.readyState>1&&S.seeking===!1){var d=S.currentTime;if(W.BufferHelper.isBuffered(S,d)?E=this.getAppendedFrag(d):W.BufferHelper.isBuffered(S,d+.1)&&(E=this.getAppendedFrag(d+.1)),E){var b=this.fragPlaying,g=E.level;(!b||E.sn!==b.sn||b.level!==g||E.urlId!==b.urlId)&&(this.hls.trigger(K.Events.FRAG_CHANGED,{frag:E}),(!b||b.level!==g)&&this.hls.trigger(K.Events.LEVEL_SWITCHED,{level:g}),this.fragPlaying=E)}}},a(O,[{key:"nextLevel",get:function(){var S=this.nextBufferedFrag;return S?S.level:-1}},{key:"currentLevel",get:function(){var S=this.media;if(S){var E=this.getAppendedFrag(S.currentTime);if(E)return E.level}return-1}},{key:"nextBufferedFrag",get:function(){var S=this.media;if(S){var E=this.getAppendedFrag(S.currentTime);return this.followingBufferedFrag(E)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),O}(B.default)},"./src/controller/subtitle-stream-controller.ts":function(ue,Z,M){"use strict";M.r(Z),M.d(Z,"SubtitleStreamController",function(){return o});var Q=M("./src/events.ts"),B=M("./src/utils/logger.ts"),N=M("./src/utils/buffer-helper.ts"),K=M("./src/controller/fragment-finders.ts"),W=M("./src/utils/discontinuities.ts"),P=M("./src/controller/level-helper.ts"),R=M("./src/controller/fragment-tracker.ts"),m=M("./src/controller/base-stream-controller.ts"),p=M("./src/types/loader.ts"),f=M("./src/types/level.ts");function h(c,L){for(var w=0;w<L.length;w++){var T=L[w];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(c,T.key,T)}}function s(c,L,w){return L&&h(c.prototype,L),w&&h(c,w),c}function u(c,L){c.prototype=Object.create(L.prototype),c.prototype.constructor=c,l(c,L)}function l(c,L){return l=Object.setPrototypeOf||function(T,O){return T.__proto__=O,T},l(c,L)}var a=500,o=function(c){u(L,c);function L(T,O){var A;return A=c.call(this,T,O,"[subtitle-stream-controller]")||this,A.levels=[],A.currentTrackId=-1,A.tracksBuffered=[],A.mainDetails=null,A._registerListeners(),A}var w=L.prototype;return w.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},w._registerListeners=function(){var O=this.hls;O.on(Q.Events.MEDIA_ATTACHED,this.onMediaAttached,this),O.on(Q.Events.MEDIA_DETACHING,this.onMediaDetaching,this),O.on(Q.Events.MANIFEST_LOADING,this.onManifestLoading,this),O.on(Q.Events.LEVEL_LOADED,this.onLevelLoaded,this),O.on(Q.Events.ERROR,this.onError,this),O.on(Q.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),O.on(Q.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),O.on(Q.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),O.on(Q.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),O.on(Q.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},w._unregisterListeners=function(){var O=this.hls;O.off(Q.Events.MEDIA_ATTACHED,this.onMediaAttached,this),O.off(Q.Events.MEDIA_DETACHING,this.onMediaDetaching,this),O.off(Q.Events.MANIFEST_LOADING,this.onManifestLoading,this),O.off(Q.Events.LEVEL_LOADED,this.onLevelLoaded,this),O.off(Q.Events.ERROR,this.onError,this),O.off(Q.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),O.off(Q.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),O.off(Q.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),O.off(Q.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),O.off(Q.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},w.startLoad=function(){this.stopLoad(),this.state=m.State.IDLE,this.setInterval(a),this.tick()},w.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},w.onLevelLoaded=function(O,A){this.mainDetails=A.details},w.onSubtitleFragProcessed=function(O,A){var x=A.frag,S=A.success;if(this.fragPrevious=x,this.state=m.State.IDLE,!S)return;var E=this.tracksBuffered[this.currentTrackId];if(!E)return;for(var d,b=x.start,g=0;g<E.length;g++)if(b>=E[g].start&&b<=E[g].end){d=E[g];break}var _=x.start+x.duration;d?d.end=_:(d={start:b,end:_},E.push(d)),this.fragmentTracker.fragBuffered(x)},w.onBufferFlushing=function(O,A){var x=A.startOffset,S=A.endOffset;if(x===0&&S!==Number.POSITIVE_INFINITY){var E=this.currentTrackId,d=this.levels;if(!d.length||!d[E]||!d[E].details)return;var b=d[E].details,g=b.targetduration,_=S-g;if(_<=0)return;A.endOffsetSubtitles=Math.max(0,_),this.tracksBuffered.forEach(function(F){for(var D=0;D<F.length;){if(F[D].end<=_){F.shift();continue}else if(F[D].start<_)F[D].start=_;else break;D++}}),this.fragmentTracker.removeFragmentsInRange(x,_,p.PlaylistLevelType.SUBTITLE)}},w.onError=function(O,A){var x,S=A.frag;if(!S||S.type!==p.PlaylistLevelType.SUBTITLE)return;(x=this.fragCurrent)!==null&&x!==void 0&&x.loader&&this.fragCurrent.loader.abort(),this.state=m.State.IDLE},w.onSubtitleTracksUpdated=function(O,A){var x=this,S=A.subtitleTracks;this.tracksBuffered=[],this.levels=S.map(function(E){return new f.Level(E)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(E){x.tracksBuffered[E.id]=[]}),this.mediaBuffer=null},w.onSubtitleTrackSwitch=function(O,A){if(this.currentTrackId=A.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var x=this.levels[this.currentTrackId];x!=null&&x.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,x&&this.setInterval(a)},w.onSubtitleTrackLoaded=function(O,A){var x,S=A.details,E=A.id,d=this.currentTrackId,b=this.levels;if(!b.length)return;var g=b[d];if(E>=b.length||E!==d||!g)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,S.live||(x=g.details)!==null&&x!==void 0&&x.live){var _=this.mainDetails;if(S.deltaUpdateFailed||!_)return;var F=_.fragments[0];if(!g.details)S.hasProgramDateTime&&_.hasProgramDateTime?Object(W.alignMediaPlaylistByPDT)(S,_):F&&Object(P.addSliding)(S,F.start);else{var D=this.alignPlaylists(S,g.details);D===0&&F&&Object(P.addSliding)(S,F.start)}}if(g.details=S,this.levelLastLoaded=E,this.tick(),S.live&&!this.fragCurrent&&this.media&&this.state===m.State.IDLE){var j=Object(K.findFragmentByPTS)(null,S.fragments,this.media.currentTime,0);j||(this.warn("Subtitle playlist not aligned with playback"),g.details=void 0)}},w._handleFragmentLoadComplete=function(O){var A=O.frag,x=O.payload,S=A.decryptdata,E=this.hls;if(this.fragContextChanged(A))return;if(x&&x.byteLength>0&&S&&S.key&&S.iv&&S.method==="AES-128"){var d=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(x),S.key.buffer,S.iv.buffer).then(function(b){var g=performance.now();E.trigger(Q.Events.FRAG_DECRYPTED,{frag:A,payload:b,stats:{tstart:d,tdecrypt:g}})})}},w.doTick=function(){if(!this.media){this.state=m.State.IDLE;return}if(this.state===m.State.IDLE){var O,A=this.currentTrackId,x=this.levels;if(!x.length||!x[A]||!x[A].details)return;var S=x[A].details,E=S.targetduration,d=this.config,b=this.media,g=N.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,b.currentTime-E,d.maxBufferHole),_=g.end,F=g.len,D=this.getMaxBufferLength()+E;if(F>D)return;console.assert(S,"Subtitle track details are defined on idle subtitle stream controller tick");var j=S.fragments,H=j.length,k=S.edge,y,G=this.fragPrevious;if(_<k){var Y=d.maxFragLookUpTolerance;G&&S.hasProgramDateTime&&(y=Object(K.findFragmentByPDT)(j,G.endProgramDateTime,Y)),y||(y=Object(K.findFragmentByPTS)(G,j,_,Y),!y&&G&&G.start<j[0].start&&(y=j[0]))}else y=j[H-1];(O=y)!==null&&O!==void 0&&O.encrypted?(B.logger.log("Loading key for "+y.sn),this.state=m.State.KEY_LOADING,this.hls.trigger(Q.Events.KEY_LOADING,{frag:y})):y&&this.fragmentTracker.getState(y)===R.FragmentState.NOT_LOADED&&this.loadFragment(y,S,_)}},w.loadFragment=function(O,A,x){this.fragCurrent=O,c.prototype.loadFragment.call(this,O,A,x)},s(L,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),L}(m.default)},"./src/controller/subtitle-track-controller.ts":function(ue,Z,M){"use strict";M.r(Z);var Q=M("./src/events.ts"),B=M("./src/utils/texttrack-utils.ts"),N=M("./src/controller/base-playlist-controller.ts"),K=M("./src/types/loader.ts");function W(h,s){for(var u=0;u<s.length;u++){var l=s[u];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(h,l.key,l)}}function P(h,s,u){return s&&W(h.prototype,s),u&&W(h,u),h}function R(h,s){h.prototype=Object.create(s.prototype),h.prototype.constructor=h,m(h,s)}function m(h,s){return m=Object.setPrototypeOf||function(l,a){return l.__proto__=a,l},m(h,s)}var p=function(h){R(s,h);function s(l){var a;return a=h.call(this,l,"[subtitle-track-controller]")||this,a.media=null,a.tracks=[],a.groupId=null,a.tracksInGroup=[],a.trackId=-1,a.selectDefaultTrack=!0,a.queuedDefaultTrack=-1,a.trackChangeListener=function(){return a.onTextTracksChanged()},a.asyncPollTrackChange=function(){return a.pollTrackChange(0)},a.useTextTrackPolling=!1,a.subtitlePollingInterval=-1,a.subtitleDisplay=!0,a.registerListeners(),a}var u=s.prototype;return u.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,h.prototype.destroy.call(this)},u.registerListeners=function(){var a=this.hls;a.on(Q.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.on(Q.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.on(Q.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.on(Q.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.on(Q.Events.LEVEL_LOADING,this.onLevelLoading,this),a.on(Q.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),a.on(Q.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),a.on(Q.Events.ERROR,this.onError,this)},u.unregisterListeners=function(){var a=this.hls;a.off(Q.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.off(Q.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.off(Q.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.off(Q.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.off(Q.Events.LEVEL_LOADING,this.onLevelLoading,this),a.off(Q.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),a.off(Q.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),a.off(Q.Events.ERROR,this.onError,this)},u.onMediaAttached=function(a,o){if(this.media=o.media,!this.media)return;this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange)},u.pollTrackChange=function(a){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,a)},u.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 a=f(this.media.textTracks);a.forEach(function(o){Object(B.clearCurrentCues)(o)}),this.subtitleTrack=-1,this.media=null},u.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},u.onManifestParsed=function(a,o){this.tracks=o.subtitleTracks},u.onSubtitleTrackLoaded=function(a,o){var c=o.id,L=o.details,w=this.trackId,T=this.tracksInGroup[w];if(!T){this.warn("Invalid subtitle track id "+c);return}var O=T.details;T.details=o.details,this.log("subtitle track "+c+" loaded ["+L.startSN+"-"+L.endSN+"]"),c===this.trackId&&(this.retryCount=0,this.playlistLoaded(c,o,O))},u.onLevelLoading=function(a,o){this.switchLevel(o.level)},u.onLevelSwitching=function(a,o){this.switchLevel(o.level)},u.switchLevel=function(a){var o=this.hls.levels[a];if(!(o!=null&&o.textGroupIds))return;var c=o.textGroupIds[o.urlId];if(this.groupId!==c){var L=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,w=this.tracks.filter(function(A){return!c||A.groupId===c});this.tracksInGroup=w;var T=this.findTrackId(L==null?void 0:L.name)||this.findTrackId();this.groupId=c;var O={subtitleTracks:w};this.log("Updating subtitle tracks, "+w.length+' track(s) found in "'+c+'" group-id'),this.hls.trigger(Q.Events.SUBTITLE_TRACKS_UPDATED,O),T!==-1&&this.setSubtitleTrack(T,L)}},u.findTrackId=function(a){for(var o=this.tracksInGroup,c=0;c<o.length;c++){var L=o[c];if((!this.selectDefaultTrack||L.default)&&(!a||a===L.name))return L.id}return-1},u.onError=function(a,o){if(h.prototype.onError.call(this,a,o),o.fatal||!o.context)return;o.context.type===K.PlaylistContextType.SUBTITLE_TRACK&&o.context.id===this.trackId&&o.context.groupId===this.groupId&&this.retryLoadingOrFail(o)},u.loadPlaylist=function(a){var o=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(o)){var c=o.id,L=o.groupId,w=o.url;if(a)try{w=a.addDirectives(w)}catch(T){this.warn("Could not construct new URL with HLS Delivery Directives: "+T)}this.log("Loading subtitle playlist for id "+c),this.hls.trigger(Q.Events.SUBTITLE_TRACK_LOADING,{url:w,id:c,groupId:L,deliveryDirectives:a||null})}},u.toggleTrackModes=function(a){var o=this,c=this.media,L=this.subtitleDisplay,w=this.trackId;if(!c)return;var T=f(c.textTracks),O=T.filter(function(S){return S.groupId===o.groupId});if(a===-1)[].slice.call(T).forEach(function(S){S.mode="disabled"});else{var A=O[w];A&&(A.mode="disabled")}var x=O[a];x&&(x.mode=L?"showing":"hidden")},u.setSubtitleTrack=function(a,o){var c,L=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=a;return}if(this.trackId!==a&&this.toggleTrackModes(a),this.trackId===a&&(a===-1||(c=L[a])!==null&&c!==void 0&&c.details)||a<-1||a>=L.length)return;this.clearTimer();var w=L[a];if(this.log("Switching to subtitle track "+a),this.trackId=a,w){var T=w.id,O=w.groupId,A=O===void 0?"":O,x=w.name,S=w.type,E=w.url;this.hls.trigger(Q.Events.SUBTITLE_TRACK_SWITCH,{id:T,groupId:A,name:x,type:S,url:E});var d=this.switchParams(w.url,o==null?void 0:o.details);this.loadPlaylist(d)}else this.hls.trigger(Q.Events.SUBTITLE_TRACK_SWITCH,{id:a})},u.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var a=-1,o=f(this.media.textTracks),c=0;c<o.length;c++)if(o[c].mode==="hidden")a=c;else if(o[c].mode==="showing"){a=c;break}this.subtitleTrack!==a&&(this.subtitleTrack=a)},P(s,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(a){this.selectDefaultTrack=!1;var o=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(a,o)}}]),s}(N.default);function f(h){for(var s=[],u=0;u<h.length;u++){var l=h[u];l.kind==="subtitles"&&l.label&&s.push(h[u])}return s}Z.default=p},"./src/controller/timeline-controller.ts":function(ue,Z,M){"use strict";M.r(Z),M.d(Z,"TimelineController",function(){return f});var Q=M("./src/polyfills/number.ts"),B=M("./src/events.ts"),N=M("./src/utils/cea-608-parser.ts"),K=M("./src/utils/output-filter.ts"),W=M("./src/utils/webvtt-parser.ts"),P=M("./src/utils/texttrack-utils.ts"),R=M("./src/utils/imsc1-ttml-parser.ts"),m=M("./src/types/loader.ts"),p=M("./src/utils/logger.ts"),f=function(){function l(o){if(this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.timescale=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=u(),this.captionsProperties=void 0,this.hls=o,this.config=o.config,this.Cues=o.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},this.config.enableCEA708Captions){var c=new K.default(this,"textTrack1"),L=new K.default(this,"textTrack2"),w=new K.default(this,"textTrack3"),T=new K.default(this,"textTrack4");this.cea608Parser1=new N.default(1,c,L),this.cea608Parser2=new N.default(3,w,T)}o.on(B.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.on(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(B.Events.MANIFEST_LOADED,this.onManifestLoaded,this),o.on(B.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),o.on(B.Events.FRAG_LOADING,this.onFragLoading,this),o.on(B.Events.FRAG_LOADED,this.onFragLoaded,this),o.on(B.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),o.on(B.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),o.on(B.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),o.on(B.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),o.on(B.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var a=l.prototype;return a.destroy=function(){var c=this.hls;c.off(B.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),c.off(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.off(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.off(B.Events.MANIFEST_LOADED,this.onManifestLoaded,this),c.off(B.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),c.off(B.Events.FRAG_LOADING,this.onFragLoading,this),c.off(B.Events.FRAG_LOADED,this.onFragLoaded,this),c.off(B.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),c.off(B.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),c.off(B.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),c.off(B.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),c.off(B.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},a.addCues=function(c,L,w,T,O){for(var A=!1,x=O.length;x--;){var S=O[x],E=s(S[0],S[1],L,w);if(E>=0&&(S[0]=Math.min(S[0],L),S[1]=Math.max(S[1],w),A=!0,E/(w-L)>.5))return}if(A||O.push([L,w]),this.config.renderTextTracksNatively){var d=this.captionsTracks[c];this.Cues.newCue(d,L,w,T)}else{var b=this.Cues.newCue(null,L,w,T);this.hls.trigger(B.Events.CUES_PARSED,{type:"captions",cues:b,track:c})}},a.onInitPtsFound=function(c,L){var w=this,T=L.frag,O=L.id,A=L.initPTS,x=L.timescale,S=this.unparsedVttFrags;O==="main"&&(this.initPTS[T.cc]=A,this.timescale[T.cc]=x),S.length&&(this.unparsedVttFrags=[],S.forEach(function(E){w.onFragLoaded(B.Events.FRAG_LOADED,E)}))},a.getExistingTrack=function(c){var L=this.media;if(L)for(var w=0;w<L.textTracks.length;w++){var T=L.textTracks[w];if(T[c])return T}return null},a.createCaptionsTrack=function(c){this.config.renderTextTracksNatively?this.createNativeTrack(c):this.createNonNativeTrack(c)},a.createNativeTrack=function(c){if(this.captionsTracks[c])return;var L=this.captionsProperties,w=this.captionsTracks,T=this.media,O=L[c],A=O.label,x=O.languageCode,S=this.getExistingTrack(c);if(S)w[c]=S,Object(P.clearCurrentCues)(w[c]),Object(P.sendAddTrackEvent)(w[c],T);else{var E=this.createTextTrack("captions",A,x);E&&(E[c]=!0,w[c]=E)}},a.createNonNativeTrack=function(c){if(this.nonNativeCaptionsTracks[c])return;var L=this.captionsProperties[c];if(!L)return;var w=L.label,T={_id:c,label:w,kind:"captions",default:L.media?!!L.media.default:!1,closedCaptions:L.media};this.nonNativeCaptionsTracks[c]=T,this.hls.trigger(B.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[T]})},a.createTextTrack=function(c,L,w){var T=this.media;return T?T.addTextTrack(c,L,w):void 0},a.onMediaAttaching=function(c,L){this.media=L.media,this._cleanTracks()},a.onMediaDetaching=function(){var c=this.captionsTracks;Object.keys(c).forEach(function(L){Object(P.clearCurrentCues)(c[L]),delete c[L]}),this.nonNativeCaptionsTracks={}},a.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=u(),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())},a._cleanTracks=function(){var c=this.media;if(!c)return;var L=c.textTracks;if(L)for(var w=0;w<L.length;w++)Object(P.clearCurrentCues)(L[w])},a.onSubtitleTracksUpdated=function(c,L){var w=this;this.textTracks=[];var T=L.subtitleTracks||[],O=T.some(function(E){return E.textCodec===R.IMSC1_CODEC});if(this.config.enableWebVTT||O&&this.config.enableIMSC1){var A=this.tracks&&T&&this.tracks.length===T.length;if(this.tracks=T||[],this.config.renderTextTracksNatively){var x=this.media?this.media.textTracks:[];this.tracks.forEach(function(E,d){var b;if(d<x.length){for(var g=null,_=0;_<x.length;_++)if(h(x[_],E)){g=x[_];break}g&&(b=g)}b?Object(P.clearCurrentCues)(b):(b=w.createTextTrack("subtitles",E.name,E.lang),b&&(b.mode="disabled")),b&&(b.groupId=E.groupId,w.textTracks.push(b))})}else if(!A&&this.tracks&&this.tracks.length){var S=this.tracks.map(function(E){return{label:E.name,kind:E.type.toLowerCase(),default:E.default,subtitleTrack:E}});this.hls.trigger(B.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:S})}}},a.onManifestLoaded=function(c,L){var w=this;this.config.enableCEA708Captions&&L.captions&&L.captions.forEach(function(T){var O=/(?:CC|SERVICE)([1-4])/.exec(T.instreamId);if(!O)return;var A="textTrack"+O[1],x=w.captionsProperties[A];if(!x)return;x.label=T.name,T.lang&&(x.languageCode=T.lang),x.media=T})},a.onFragLoading=function(c,L){var w=this.cea608Parser1,T=this.cea608Parser2,O=this.lastSn,A=this.lastPartIndex;if(!this.enabled||!(w&&T))return;if(L.frag.type===m.PlaylistLevelType.MAIN){var x,S,E=L.frag.sn,d=(x=L==null||((S=L.part)===null||S===void 0)?void 0:S.index)!=null?x:-1;E===O+1||E===O&&d===A+1||(w.reset(),T.reset()),this.lastSn=E,this.lastPartIndex=d}},a.onFragLoaded=function(c,L){var w=L.frag,T=L.payload,O=this.initPTS,A=this.unparsedVttFrags;if(w.type===m.PlaylistLevelType.SUBTITLE)if(T.byteLength){if(!Object(Q.isFiniteNumber)(O[w.cc])){A.push(L),O.length&&this.hls.trigger(B.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:w,error:new Error("Missing initial subtitle PTS")});return}var x=w.decryptdata;if(x==null||x.key==null||x.method!=="AES-128"){var S=this.tracks[w.level],E=this.vttCCs;E[w.cc]||(E[w.cc]={start:w.start,prevCC:this.prevCC,new:!0},this.prevCC=w.cc),S&&S.textCodec===R.IMSC1_CODEC?this._parseIMSC1(w,T):this._parseVTTs(w,T,E)}}else this.hls.trigger(B.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:w,error:new Error("Empty subtitle payload")})},a._parseIMSC1=function(c,L){var w=this,T=this.hls;Object(R.parseIMSC1)(L,this.initPTS[c.cc],this.timescale[c.cc],function(O){w._appendCues(O,c.level),T.trigger(B.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:c})},function(O){p.logger.log("Failed to parse IMSC1: "+O),T.trigger(B.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:c,error:O})})},a._parseVTTs=function(c,L,w){var T=this,O=this.hls;Object(W.parseWebVTT)(L,this.initPTS[c.cc],this.timescale[c.cc],w,c.cc,c.start,function(A){T._appendCues(A,c.level),O.trigger(B.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:c})},function(A){T._fallbackToIMSC1(c,L),p.logger.log("Failed to parse VTT cue: "+A),O.trigger(B.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:c,error:A})})},a._fallbackToIMSC1=function(c,L){var w=this,T=this.tracks[c.level];T.textCodec||Object(R.parseIMSC1)(L,this.initPTS[c.cc],this.timescale[c.cc],function(){T.textCodec=R.IMSC1_CODEC,w._parseIMSC1(c,L)},function(){T.textCodec="wvtt"})},a._appendCues=function(c,L){var w=this.hls;if(this.config.renderTextTracksNatively){var T=this.textTracks[L];if(T.mode==="disabled")return;c.forEach(function(x){return Object(P.addCueToTrack)(T,x)})}else{var O=this.tracks[L],A=O.default?"default":"subtitles"+L;w.trigger(B.Events.CUES_PARSED,{type:"subtitles",cues:c,track:A})}},a.onFragDecrypted=function(c,L){var w=L.frag;if(w.type===m.PlaylistLevelType.SUBTITLE){if(!Object(Q.isFiniteNumber)(this.initPTS[w.cc])){this.unparsedVttFrags.push(L);return}this.onFragLoaded(B.Events.FRAG_LOADED,L)}},a.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},a.onFragParsingUserdata=function(c,L){var w=this.cea608Parser1,T=this.cea608Parser2;if(!this.enabled||!(w&&T))return;for(var O=0;O<L.samples.length;O++){var A=L.samples[O].bytes;if(A){var x=this.extractCea608Data(A);w.addData(L.samples[O].pts,x[0]),T.addData(L.samples[O].pts,x[1])}}},a.onBufferFlushing=function(c,L){var w=L.startOffset,T=L.endOffset,O=L.endOffsetSubtitles,A=L.type,x=this.media;if(!x||x.currentTime<T)return;if(!A||A==="video"){var S=this.captionsTracks;Object.keys(S).forEach(function(d){return Object(P.removeCuesInRange)(S[d],w,T)})}if(this.config.renderTextTracksNatively&&(w===0&&O!==void 0)){var E=this.textTracks;Object.keys(E).forEach(function(d){return Object(P.removeCuesInRange)(E[d],w,O)})}},a.extractCea608Data=function(c){for(var L=c[0]&31,w=2,T=[[],[]],O=0;O<L;O++){var A=c[w++],x=127&c[w++],S=127&c[w++],E=(4&A)!==0,d=3&A;if(x===0&&S===0)continue;E&&((d===0||d===1)&&(T[d].push(x),T[d].push(S)))}return T},l}();function h(l,a){return l&&l.label===a.name&&!(l.textTrack1||l.textTrack2)}function s(l,a,o,c){return Math.min(a,c)-Math.max(l,o)}function u(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(ue,Z,M){"use strict";M.r(Z),M.d(Z,"default",function(){return Q});var Q=function(){function B(K,W){this.subtle=void 0,this.aesIV=void 0,this.subtle=K,this.aesIV=W}var N=B.prototype;return N.decrypt=function(W,P){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},P,W)},B}()},"./src/crypt/aes-decryptor.ts":function(ue,Z,M){"use strict";M.r(Z),M.d(Z,"removePadding",function(){return B}),M.d(Z,"default",function(){return N});var Q=M("./src/utils/typed-array.ts");function B(K){var W=K.byteLength,P=W&&new DataView(K.buffer).getUint8(W-1);return P?Object(Q.sliceUint8)(K,0,W-P):K}var N=function(){function K(){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 W=K.prototype;return W.uint8ArrayToUint32Array_=function(R){for(var m=new DataView(R),p=new Uint32Array(4),f=0;f<4;f++)p[f]=m.getUint32(f*4);return p},W.initTable=function(){var R=this.sBox,m=this.invSBox,p=this.subMix,f=p[0],h=p[1],s=p[2],u=p[3],l=this.invSubMix,a=l[0],o=l[1],c=l[2],L=l[3],w=new Uint32Array(256),T=0,O=0,A=0;for(A=0;A<256;A++)A<128?w[A]=A<<1:w[A]=A<<1^283;for(A=0;A<256;A++){var x=O^O<<1^O<<2^O<<3^O<<4;x=x>>>8^x&255^99,R[T]=x,m[x]=T;var S=w[T],E=w[S],d=w[E],b=w[x]*257^x*16843008;f[T]=b<<24|b>>>8,h[T]=b<<16|b>>>16,s[T]=b<<8|b>>>24,u[T]=b,b=d*16843009^E*65537^S*257^T*16843008,a[x]=b<<24|b>>>8,o[x]=b<<16|b>>>16,c[x]=b<<8|b>>>24,L[x]=b,T?(T=S^w[w[w[d^S]]],O^=w[w[O]]):T=O=1}},W.expandKey=function(R){for(var m=this.uint8ArrayToUint32Array_(R),p=!0,f=0;f<m.length&&p;)p=m[f]===this.key[f],f++;if(p)return;this.key=m;var h=this.keySize=m.length;if(h!==4&&h!==6&&h!==8)throw new Error("Invalid aes key size="+h);var s=this.ksRows=(h+6+1)*4,u,l,a=this.keySchedule=new Uint32Array(s),o=this.invKeySchedule=new Uint32Array(s),c=this.sBox,L=this.rcon,w=this.invSubMix,T=w[0],O=w[1],A=w[2],x=w[3],S,E;for(u=0;u<s;u++){if(u<h){S=a[u]=m[u];continue}E=S,u%h===0?(E=E<<8|E>>>24,E=c[E>>>24]<<24|c[E>>>16&255]<<16|c[E>>>8&255]<<8|c[E&255],E^=L[u/h|0]<<24):h>6&&u%h===4&&(E=c[E>>>24]<<24|c[E>>>16&255]<<16|c[E>>>8&255]<<8|c[E&255]),a[u]=S=(a[u-h]^E)>>>0}for(l=0;l<s;l++)u=s-l,l&3?E=a[u]:E=a[u-4],l<4||u<=4?o[l]=E:o[l]=T[c[E>>>24]]^O[c[E>>>16&255]]^A[c[E>>>8&255]]^x[c[E&255]],o[l]=o[l]>>>0},W.networkToHostOrderSwap=function(R){return R<<24|(R&65280)<<8|(R&16711680)>>8|R>>>24},W.decrypt=function(R,m,p){for(var f=this.keySize+6,h=this.invKeySchedule,s=this.invSBox,u=this.invSubMix,l=u[0],a=u[1],o=u[2],c=u[3],L=this.uint8ArrayToUint32Array_(p),w=L[0],T=L[1],O=L[2],A=L[3],x=new Int32Array(R),S=new Int32Array(x.length),E,d,b,g,_,F,D,j,H,k,y,G,Y,ie,se=this.networkToHostOrderSwap;m<x.length;){for(H=se(x[m]),k=se(x[m+1]),y=se(x[m+2]),G=se(x[m+3]),_=H^h[0],F=G^h[1],D=y^h[2],j=k^h[3],Y=4,ie=1;ie<f;ie++)E=l[_>>>24]^a[F>>16&255]^o[D>>8&255]^c[j&255]^h[Y],d=l[F>>>24]^a[D>>16&255]^o[j>>8&255]^c[_&255]^h[Y+1],b=l[D>>>24]^a[j>>16&255]^o[_>>8&255]^c[F&255]^h[Y+2],g=l[j>>>24]^a[_>>16&255]^o[F>>8&255]^c[D&255]^h[Y+3],_=E,F=d,D=b,j=g,Y=Y+4;E=s[_>>>24]<<24^s[F>>16&255]<<16^s[D>>8&255]<<8^s[j&255]^h[Y],d=s[F>>>24]<<24^s[D>>16&255]<<16^s[j>>8&255]<<8^s[_&255]^h[Y+1],b=s[D>>>24]<<24^s[j>>16&255]<<16^s[_>>8&255]<<8^s[F&255]^h[Y+2],g=s[j>>>24]<<24^s[_>>16&255]<<16^s[F>>8&255]<<8^s[D&255]^h[Y+3],S[m]=se(E^w),S[m+1]=se(g^T),S[m+2]=se(b^O),S[m+3]=se(d^A),w=H,T=k,O=y,A=G,m=m+4}return S.buffer},K}()},"./src/crypt/decrypter.ts":function(ue,Z,M){"use strict";M.r(Z),M.d(Z,"default",function(){return m});var Q=M("./src/crypt/aes-crypto.ts"),B=M("./src/crypt/fast-aes-key.ts"),N=M("./src/crypt/aes-decryptor.ts"),K=M("./src/utils/logger.ts"),W=M("./src/utils/mp4-tools.ts"),P=M("./src/utils/typed-array.ts"),R=16,m=function(){function p(h,s,u){var l=u===void 0?{}:u,a=l.removePKCS7Padding,o=a===void 0?!0:a;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=h,this.config=s,this.removePKCS7Padding=o,o)try{var c=self.crypto;c&&(this.subtle=c.subtle||c.webkitSubtle)}catch(L){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var f=p.prototype;return f.destroy=function(){this.observer=null},f.isSync=function(){return this.config.enableSoftwareAES},f.flush=function(){var s=this.currentResult;if(!s){this.reset();return}var u=new Uint8Array(s);return this.reset(),this.removePKCS7Padding?Object(N.removePadding)(u):u},f.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},f.decrypt=function(s,u,l,a){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(s),u,l);var o=this.flush();o&&a(o.buffer)}else this.webCryptoDecrypt(new Uint8Array(s),u,l).then(a)},f.softwareDecrypt=function(s,u,l){var a=this.currentIV,o=this.currentResult,c=this.remainderData;this.logOnce("JS AES decrypt"),c&&(s=Object(W.appendUint8Array)(c,s),this.remainderData=null);var L=this.getValidChunk(s);if(!L.length)return null;a&&(l=a);var w=this.softwareDecrypter;w||(w=this.softwareDecrypter=new N.default),w.expandKey(u);var T=o;return this.currentResult=w.decrypt(L.buffer,0,l),this.currentIV=Object(P.sliceUint8)(L,-16).buffer,T||null},f.webCryptoDecrypt=function(s,u,l){var a=this,o=this.subtle;return(this.key!==u||!this.fastAesKey)&&(this.key=u,this.fastAesKey=new B.default(o,u)),this.fastAesKey.expandKey().then(function(c){if(!o)return Promise.reject(new Error("web crypto not initialized"));var L=new Q.default(o,l);return L.decrypt(s.buffer,c)}).catch(function(c){return a.onWebCryptoError(c,s,u,l)})},f.onWebCryptoError=function(s,u,l,a){return K.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",s),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(u,l,a)},f.getValidChunk=function(s){var u=s,l=s.length-s.length%R;return l!==s.length&&(u=Object(P.sliceUint8)(s,0,l),this.remainderData=Object(P.sliceUint8)(s,l)),u},f.logOnce=function(s){if(!this.logEnabled)return;K.logger.log("[decrypter.ts]: "+s),this.logEnabled=!1},p}()},"./src/crypt/fast-aes-key.ts":function(ue,Z,M){"use strict";M.r(Z),M.d(Z,"default",function(){return Q});var Q=function(){function B(K,W){this.subtle=void 0,this.key=void 0,this.subtle=K,this.key=W}var N=B.prototype;return N.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},B}()},"./src/demux/aacdemuxer.ts":function(ue,Z,M){"use strict";M.r(Z);var Q=M("./src/demux/base-audio-demuxer.ts"),B=M("./src/demux/adts.ts"),N=M("./src/utils/logger.ts"),K=M("./src/demux/id3.ts");function W(m,p){m.prototype=Object.create(p.prototype),m.prototype.constructor=m,P(m,p)}function P(m,p){return P=Object.setPrototypeOf||function(h,s){return h.__proto__=s,h},P(m,p)}var R=function(m){W(p,m);function p(h,s){var u;return u=m.call(this)||this,u.observer=void 0,u.config=void 0,u.observer=h,u.config=s,u}var f=p.prototype;return f.resetInitSegment=function(s,u,l){m.prototype.resetInitSegment.call(this,s,u,l),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:s,duration:l,inputTimeScale:9e4,dropped:0}},p.probe=function(s){if(!s)return!1;for(var u=K.getID3Data(s,0)||[],l=u.length,a=s.length;l<a;l++)if(B.probe(s,l))return N.logger.log("ADTS sync word found !"),!0;return!1},f.canParse=function(s,u){return B.canParse(s,u)},f.appendFrame=function(s,u,l){B.initTrackConfig(s,this.observer,u,l,s.manifestCodec);var a=B.appendFrame(s,u,l,this.initPTS,this.frameIndex);if(a&&a.missing===0)return a},p}(Q.default);R.minProbeByteLength=9,Z.default=R},"./src/demux/adts.ts":function(ue,Z,M){"use strict";M.r(Z),M.d(Z,"getAudioConfig",function(){return K}),M.d(Z,"isHeaderPattern",function(){return W}),M.d(Z,"getHeaderLength",function(){return P}),M.d(Z,"getFullFrameLength",function(){return R}),M.d(Z,"canGetFrameLength",function(){return m}),M.d(Z,"isHeader",function(){return p}),M.d(Z,"canParse",function(){return f}),M.d(Z,"probe",function(){return h}),M.d(Z,"initTrackConfig",function(){return s}),M.d(Z,"getFrameDuration",function(){return u}),M.d(Z,"parseFrameHeader",function(){return l}),M.d(Z,"appendFrame",function(){return a});var Q=M("./src/utils/logger.ts"),B=M("./src/errors.ts"),N=M("./src/events.ts");function K(o,c,L,w){var T,O,A,x,S=navigator.userAgent.toLowerCase(),E=w,d=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];T=((c[L+2]&192)>>>6)+1;var b=(c[L+2]&60)>>>2;if(b>d.length-1){o.trigger(N.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+b});return}return A=(c[L+2]&1)<<2,A|=(c[L+3]&192)>>>6,Q.logger.log("manifest codec:"+w+", ADTS type:"+T+", samplingIndex:"+b),/firefox/i.test(S)?b>=6?(T=5,x=new Array(4),O=b-3):(T=2,x=new Array(2),O=b):S.indexOf("android")!==-1?(T=2,x=new Array(2),O=b):(T=5,x=new Array(4),w&&(w.indexOf("mp4a.40.29")!==-1||w.indexOf("mp4a.40.5")!==-1)||!w&&b>=6?O=b-3:((w&&w.indexOf("mp4a.40.2")!==-1&&(b>=6&&A===1||/vivaldi/i.test(S))||!w&&A===1)&&(T=2,x=new Array(2)),O=b)),x[0]=T<<3,x[0]|=(b&14)>>1,x[1]|=(b&1)<<7,x[1]|=A<<3,T===5&&(x[1]|=(O&14)>>1,x[2]=(O&1)<<7,x[2]|=2<<2,x[3]=0),{config:x,samplerate:d[b],channelCount:A,codec:"mp4a.40."+T,manifestCodec:E}}function W(o,c){return o[c]===255&&(o[c+1]&246)===240}function P(o,c){return o[c+1]&1?7:9}function R(o,c){return(o[c+3]&3)<<11|o[c+4]<<3|(o[c+5]&224)>>>5}function m(o,c){return c+5<o.length}function p(o,c){return c+1<o.length&&W(o,c)}function f(o,c){return m(o,c)&&W(o,c)&&R(o,c)<=o.length-c}function h(o,c){if(p(o,c)){var L=P(o,c);if(c+L>=o.length)return!1;var w=R(o,c);if(w<=L)return!1;var T=c+w;return T===o.length||p(o,T)}return!1}function s(o,c,L,w,T){if(!o.samplerate){var O=K(c,L,w,T);if(!O)return;o.config=O.config,o.samplerate=O.samplerate,o.channelCount=O.channelCount,o.codec=O.codec,o.manifestCodec=O.manifestCodec,Q.logger.log("parsed codec:"+o.codec+", rate:"+O.samplerate+", channels:"+O.channelCount)}}function u(o){return 1024*9e4/o}function l(o,c,L,w,T){var O=P(o,c),A=R(o,c);if(A-=O,A>0){var x=L+w*T;return{headerLength:O,frameLength:A,stamp:x}}}function a(o,c,L,w,T){var O=u(o.samplerate),A=l(c,L,w,T,O);if(A){var x=A.frameLength,S=A.headerLength,E=A.stamp,d=S+x,b=Math.max(0,L+d-c.length),g;b?(g=new Uint8Array(d-S),g.set(c.subarray(L+S,c.length),0)):g=c.subarray(L+S,L+d);var _={unit:g,pts:E};return b||o.samples.push(_),{sample:_,length:d,missing:b}}}},"./src/demux/base-audio-demuxer.ts":function(ue,Z,M){"use strict";M.r(Z),M.d(Z,"initPTSFn",function(){return R});var Q=M("./src/polyfills/number.ts"),B=M("./src/demux/id3.ts"),N=M("./src/demux/dummy-demuxed-track.ts"),K=M("./src/utils/mp4-tools.ts"),W=M("./src/utils/typed-array.ts"),P=function(){function m(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var p=m.prototype;return p.resetInitSegment=function(h,s,u){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},p.resetTimeStamp=function(){},p.resetContiguity=function(){},p.canParse=function(h,s){return!1},p.appendFrame=function(h,s,u){},p.demux=function(h,s){this.cachedData&&(h=Object(K.appendUint8Array)(this.cachedData,h),this.cachedData=null);var u=B.getID3Data(h,0),l=u?u.length:0,a,o,c=this._audioTrack,L=this._id3Track,w=u?B.getTimeStamp(u):void 0,T=h.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=R(w,s)),u&&u.length>0&&L.samples.push({pts:this.initPTS,dts:this.initPTS,data:u}),o=this.initPTS;l<T;){if(this.canParse(h,l)){var O=this.appendFrame(c,h,l);O?(this.frameIndex++,o=O.sample.pts,l+=O.length,a=l):l=T}else B.canParse(h,l)?(u=B.getID3Data(h,l),L.samples.push({pts:o,dts:o,data:u}),l+=u.length,a=l):l++;if(l===T&&a!==T){var A=Object(W.sliceUint8)(h,a);this.cachedData?this.cachedData=Object(K.appendUint8Array)(this.cachedData,A):this.cachedData=A}}return{audioTrack:c,avcTrack:Object(N.dummyTrack)(),id3Track:L,textTrack:Object(N.dummyTrack)()}},p.demuxSampleAes=function(h,s,u){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},p.flush=function(h){var s=this.cachedData;return s&&(this.cachedData=null,this.demux(s,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(N.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(N.dummyTrack)()}},p.destroy=function(){},m}(),R=function(p,f){return Object(Q.isFiniteNumber)(p)?p*90:f*9e4};Z.default=P},"./src/demux/chunk-cache.ts":function(ue,Z,M){"use strict";M.r(Z),M.d(Z,"default",function(){return Q});var Q=function(){function N(){this.chunks=[],this.dataLength=0}var K=N.prototype;return K.push=function(P){this.chunks.push(P),this.dataLength+=P.length},K.flush=function(){var P=this.chunks,R=this.dataLength,m;if(P.length)P.length===1?m=P[0]:m=B(P,R);else return new Uint8Array(0);return this.reset(),m},K.reset=function(){this.chunks.length=0,this.dataLength=0},N}();function B(N,K){for(var W=new Uint8Array(K),P=0,R=0;R<N.length;R++){var m=N[R];W.set(m,P),P+=m.length}return W}},"./src/demux/dummy-demuxed-track.ts":function(ue,Z,M){"use strict";M.r(Z),M.d(Z,"dummyTrack",function(){return Q});function Q(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(ue,Z,M){"use strict";M.r(Z);var Q=M("./src/utils/logger.ts"),B=function(){function N(W){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=W,this.bytesAvailable=W.byteLength,this.word=0,this.bitsAvailable=0}var K=N.prototype;return K.loadWord=function(){var P=this.data,R=this.bytesAvailable,m=P.byteLength-R,p=new Uint8Array(4),f=Math.min(4,R);if(f===0)throw new Error("no bytes available");p.set(P.subarray(m,m+f)),this.word=new DataView(p.buffer).getUint32(0),this.bitsAvailable=f*8,this.bytesAvailable-=f},K.skipBits=function(P){var R;this.bitsAvailable>P?(this.word<<=P,this.bitsAvailable-=P):(P-=this.bitsAvailable,R=P>>3,P-=R>>3,this.bytesAvailable-=R,this.loadWord(),this.word<<=P,this.bitsAvailable-=P)},K.readBits=function(P){var R=Math.min(this.bitsAvailable,P),m=this.word>>>32-R;return P>32&&Q.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=R,this.bitsAvailable>0?this.word<<=R:this.bytesAvailable>0&&this.loadWord(),R=P-R,R>0&&this.bitsAvailable?m<<R|this.readBits(R):m},K.skipLZ=function(){var P;for(P=0;P<this.bitsAvailable;++P)if((this.word&2147483648>>>P)!==0)return this.word<<=P,this.bitsAvailable-=P,P;return this.loadWord(),P+this.skipLZ()},K.skipUEG=function(){this.skipBits(1+this.skipLZ())},K.skipEG=function(){this.skipBits(1+this.skipLZ())},K.readUEG=function(){var P=this.skipLZ();return this.readBits(P+1)-1},K.readEG=function(){var P=this.readUEG();return 1&P?1+P>>>1:-1*(P>>>1)},K.readBoolean=function(){return this.readBits(1)===1},K.readUByte=function(){return this.readBits(8)},K.readUShort=function(){return this.readBits(16)},K.readUInt=function(){return this.readBits(32)},K.skipScalingList=function(P){for(var R=8,m=8,p,f=0;f<P;f++)m!==0&&(p=this.readEG(),m=(R+p+256)%256),R=m===0?R:m},K.readSPS=function(){var P=0,R=0,m=0,p=0,f,h,s,u=this.readUByte.bind(this),l=this.readBits.bind(this),a=this.readUEG.bind(this),o=this.readBoolean.bind(this),c=this.skipBits.bind(this),L=this.skipEG.bind(this),w=this.skipUEG.bind(this),T=this.skipScalingList.bind(this);u();var O=u();if(l(5),c(3),u(),w(),O===100||O===110||O===122||O===244||O===44||O===83||O===86||O===118||O===128){var A=a();if(A===3&&c(1),w(),w(),c(1),o())for(h=A!==3?8:12,s=0;s<h;s++)o()&&(s<6?T(16):T(64))}w();var x=a();if(x===0)a();else if(x===1)for(c(1),L(),L(),f=a(),s=0;s<f;s++)L();w(),c(1);var S=a(),E=a(),d=l(1);d===0&&c(1),c(1),o()&&(P=a(),R=a(),m=a(),p=a());var b=[1,1];if(o()&&o()){var g=u();switch(g){case 1:b=[1,1];break;case 2:b=[12,11];break;case 3:b=[10,11];break;case 4:b=[16,11];break;case 5:b=[40,33];break;case 6:b=[24,11];break;case 7:b=[20,11];break;case 8:b=[32,11];break;case 9:b=[80,33];break;case 10:b=[18,11];break;case 11:b=[15,11];break;case 12:b=[64,33];break;case 13:b=[160,99];break;case 14:b=[4,3];break;case 15:b=[3,2];break;case 16:b=[2,1];break;case 255:{b=[u()<<8|u(),u()<<8|u()];break}}}return{width:Math.ceil((S+1)*16-P*2-R*2),height:(2-d)*(E+1)*16-(d?2:4)*(m+p),pixelRatio:b}},K.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},N}();Z.default=B},"./src/demux/id3.ts":function(ue,Z,M){"use strict";M.r(Z),M.d(Z,"isHeader",function(){return Q}),M.d(Z,"isFooter",function(){return B}),M.d(Z,"getID3Data",function(){return N}),M.d(Z,"canParse",function(){return W}),M.d(Z,"getTimeStamp",function(){return P}),M.d(Z,"isTimeStampFrame",function(){return R}),M.d(Z,"getID3Frames",function(){return p}),M.d(Z,"decodeFrame",function(){return f}),M.d(Z,"utf8ArrayToStr",function(){return a}),M.d(Z,"testables",function(){return o});var Q=function(T,O){return O+10<=T.length&&(T[O]===73&&T[O+1]===68&&T[O+2]===51&&(T[O+3]<255&&T[O+4]<255&&(T[O+6]<128&&T[O+7]<128&&T[O+8]<128&&T[O+9]<128)))},B=function(T,O){return O+10<=T.length&&(T[O]===51&&T[O+1]===68&&T[O+2]===73&&(T[O+3]<255&&T[O+4]<255&&(T[O+6]<128&&T[O+7]<128&&T[O+8]<128&&T[O+9]<128)))},N=function(T,O){for(var A=O,x=0;Q(T,O);){x+=10;var S=K(T,O+6);x+=S,B(T,O+10)&&(x+=10),O+=x}return x>0?T.subarray(A,A+x):void 0},K=function(T,O){var A=0;return A=(T[O]&127)<<21,A|=(T[O+1]&127)<<14,A|=(T[O+2]&127)<<7,A|=T[O+3]&127,A},W=function(T,O){return Q(T,O)&&K(T,O+6)+10<=T.length-O},P=function(T){for(var O=p(T),A=0;A<O.length;A++){var x=O[A];if(R(x))return l(x)}return},R=function(T){return T&&T.key==="PRIV"&&T.info==="com.apple.streaming.transportStreamTimestamp"},m=function(T){var O=String.fromCharCode(T[0],T[1],T[2],T[3]),A=K(T,4),x=10;return{type:O,size:A,data:T.subarray(x,x+A)}},p=function(T){for(var O=0,A=[];Q(T,O);){var x=K(T,O+6);O+=10;for(var S=O+x;O+8<S;){var E=m(T.subarray(O)),d=f(E);d&&A.push(d),O+=E.size+10}B(T,O)&&(O+=10)}return A},f=function(T){return T.type==="PRIV"?h(T):T.type[0]==="W"?u(T):s(T)},h=function(T){if(T.size<2)return;var O=a(T.data,!0),A=new Uint8Array(T.data.subarray(O.length+1));return{key:T.type,info:O,data:A.buffer}},s=function(T){if(T.size<2)return;if(T.type==="TXXX"){var O=1,A=a(T.data.subarray(O),!0);O+=A.length+1;var x=a(T.data.subarray(O));return{key:T.type,info:A,data:x}}var S=a(T.data.subarray(1));return{key:T.type,data:S}},u=function(T){if(T.type==="WXXX"){if(T.size<2)return;var O=1,A=a(T.data.subarray(O),!0);O+=A.length+1;var x=a(T.data.subarray(O));return{key:T.type,info:A,data:x}}var S=a(T.data);return{key:T.type,data:S}},l=function(T){if(T.data.byteLength===8){var O=new Uint8Array(T.data),A=O[3]&1,x=(O[4]<<23)+(O[5]<<15)+(O[6]<<7)+O[7];return x/=45,A&&(x+=4772185884e-2),Math.round(x)}return},a=function(T,O){O===void 0&&(O=!1);var A=L();if(A){var x=A.decode(T);if(O){var S=x.indexOf("\0");return S!==-1?x.substring(0,S):x}return x.replace(/\0/g,"")}for(var E=T.length,d,b,g,_="",F=0;F<E;){if(d=T[F++],d===0&&O)return _;if(d===0||d===3)continue;switch(d>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:_+=String.fromCharCode(d);break;case 12:case 13:b=T[F++],_+=String.fromCharCode((d&31)<<6|b&63);break;case 14:b=T[F++],g=T[F++],_+=String.fromCharCode((d&15)<<12|(b&63)<<6|(g&63)<<0);break;default:}}return _},o={decodeTextFrame:s},c;function L(){return!c&&typeof self.TextDecoder!="undefined"&&(c=new self.TextDecoder("utf-8")),c}},"./src/demux/mp3demuxer.ts":function(ue,Z,M){"use strict";M.r(Z);var Q=M("./src/demux/base-audio-demuxer.ts"),B=M("./src/demux/id3.ts"),N=M("./src/utils/logger.ts"),K=M("./src/demux/mpegaudio.ts");function W(m,p){m.prototype=Object.create(p.prototype),m.prototype.constructor=m,P(m,p)}function P(m,p){return P=Object.setPrototypeOf||function(h,s){return h.__proto__=s,h},P(m,p)}var R=function(m){W(p,m);function p(){return m.apply(this,arguments)||this}var f=p.prototype;return f.resetInitSegment=function(s,u,l){m.prototype.resetInitSegment.call(this,s,u,l),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:s,duration:l,inputTimeScale:9e4,dropped:0}},p.probe=function(s){if(!s)return!1;for(var u=B.getID3Data(s,0)||[],l=u.length,a=s.length;l<a;l++)if(K.probe(s,l))return N.logger.log("MPEG Audio sync word found !"),!0;return!1},f.canParse=function(s,u){return K.canParse(s,u)},f.appendFrame=function(s,u,l){return this.initPTS===null?void 0:K.appendFrame(s,u,l,this.initPTS,this.frameIndex)},p}(Q.default);R.minProbeByteLength=4,Z.default=R},"./src/demux/mp4demuxer.ts":function(ue,Z,M){"use strict";M.r(Z);var Q=M("./src/utils/mp4-tools.ts"),B=M("./src/demux/dummy-demuxed-track.ts"),N=function(){function K(P,R){this.remainderData=null,this.config=void 0,this.config=R}var W=K.prototype;return W.resetTimeStamp=function(){},W.resetInitSegment=function(){},W.resetContiguity=function(){},K.probe=function(R){return Object(Q.findBox)({data:R,start:0,end:Math.min(R.length,16384)},["moof"]).length>0},W.demux=function(R){var m=R,p=Object(B.dummyTrack)();if(this.config.progressive){this.remainderData&&(m=Object(Q.appendUint8Array)(this.remainderData,R));var f=Object(Q.segmentValidRange)(m);this.remainderData=f.remainder,p.samples=f.valid||new Uint8Array}else p.samples=m;return{audioTrack:Object(B.dummyTrack)(),avcTrack:p,id3Track:Object(B.dummyTrack)(),textTrack:Object(B.dummyTrack)()}},W.flush=function(){var R=Object(B.dummyTrack)();return R.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(B.dummyTrack)(),avcTrack:R,id3Track:Object(B.dummyTrack)(),textTrack:Object(B.dummyTrack)()}},W.demuxSampleAes=function(R,m,p){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},W.destroy=function(){},K}();N.minProbeByteLength=1024,Z.default=N},"./src/demux/mpegaudio.ts":function(ue,Z,M){"use strict";M.r(Z),M.d(Z,"appendFrame",function(){return P}),M.d(Z,"parseHeader",function(){return R}),M.d(Z,"isHeaderPattern",function(){return m}),M.d(Z,"isHeader",function(){return p}),M.d(Z,"canParse",function(){return f}),M.d(Z,"probe",function(){return h});var Q=null,B=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],N=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],K=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],W=[0,1,1,4];function P(s,u,l,a,o){if(l+24>u.length)return;var c=R(u,l);if(c&&l+c.frameLength<=u.length){var L=c.samplesPerFrame*9e4/c.sampleRate,w=a+o*L,T={unit:u.subarray(l,l+c.frameLength),pts:w,dts:w};return s.config=[],s.channelCount=c.channelCount,s.samplerate=c.sampleRate,s.samples.push(T),{sample:T,length:c.frameLength,missing:0}}}function R(s,u){var l=s[u+1]>>3&3,a=s[u+1]>>1&3,o=s[u+2]>>4&15,c=s[u+2]>>2&3;if(l!==1&&o!==0&&o!==15&&c!==3){var L=s[u+2]>>1&1,w=s[u+3]>>6,T=l===3?3-a:a===3?3:4,O=B[T*14+o-1]*1e3,A=l===3?0:l===2?1:2,x=N[A*3+c],S=w===3?1:2,E=K[l][a],d=W[a],b=E*8*d,g=Math.floor(E*O/x+L)*d;if(Q===null){var _=navigator.userAgent||"",F=_.match(/Chrome\/(\d+)/i);Q=F?parseInt(F[1]):0}var D=!!Q&&Q<=87;return D&&a===2&&O>=224e3&&w===0&&(s[u+3]=s[u+3]|128),{sampleRate:x,channelCount:S,frameLength:g,samplesPerFrame:b}}}function m(s,u){return s[u]===255&&(s[u+1]&224)===224&&(s[u+1]&6)!==0}function p(s,u){return u+1<s.length&&m(s,u)}function f(s,u){var l=4;return m(s,u)&&l<=s.length-u}function h(s,u){if(u+1<s.length&&m(s,u)){var l=4,a=R(s,u),o=l;a!=null&&a.frameLength&&(o=a.frameLength);var c=u+o;return c===s.length||p(s,c)}return!1}},"./src/demux/sample-aes.ts":function(ue,Z,M){"use strict";M.r(Z);var Q=M("./src/crypt/decrypter.ts"),B=M("./src/demux/tsdemuxer.ts"),N=function(){function K(P,R,m){this.keyData=void 0,this.decrypter=void 0,this.keyData=m,this.decrypter=new Q.default(P,R,{removePKCS7Padding:!1})}var W=K.prototype;return W.decryptBuffer=function(R,m){this.decrypter.decrypt(R,this.keyData.key.buffer,this.keyData.iv.buffer,m)},W.decryptAacSample=function(R,m,p,f){var h=R[m].unit,s=h.subarray(16,h.length-h.length%16),u=s.buffer.slice(s.byteOffset,s.byteOffset+s.length),l=this;this.decryptBuffer(u,function(a){var o=new Uint8Array(a);h.set(o,16),f||l.decryptAacSamples(R,m+1,p)})},W.decryptAacSamples=function(R,m,p){for(;;m++){if(m>=R.length){p();return}if(R[m].unit.length<32)continue;var f=this.decrypter.isSync();if(this.decryptAacSample(R,m,p,f),!f)return}},W.getAvcEncryptedData=function(R){for(var m=Math.floor((R.length-48)/160)*16+16,p=new Int8Array(m),f=0,h=32;h<=R.length-16;h+=160,f+=16)p.set(R.subarray(h,h+16),f);return p},W.getAvcDecryptedUnit=function(R,m){for(var p=new Uint8Array(m),f=0,h=32;h<=R.length-16;h+=160,f+=16)R.set(p.subarray(f,f+16),h);return R},W.decryptAvcSample=function(R,m,p,f,h,s){var u=Object(B.discardEPB)(h.data),l=this.getAvcEncryptedData(u),a=this;this.decryptBuffer(l.buffer,function(o){h.data=a.getAvcDecryptedUnit(u,o),s||a.decryptAvcSamples(R,m,p+1,f)})},W.decryptAvcSamples=function(R,m,p,f){if(R instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;m++,p=0){if(m>=R.length){f();return}for(var h=R[m].units;!(p>=h.length);p++){var s=h[p];if(s.data.length<=48||s.type!==1&&s.type!==5)continue;var u=this.decrypter.isSync();if(this.decryptAvcSample(R,m,p,f,s,u),!u)return}}},K}();Z.default=N},"./src/demux/transmuxer-interface.ts":function(ue,Z,M){"use strict";M.r(Z),M.d(Z,"default",function(){return h});var Q=M("./node_modules/webworkify-webpack/index.js"),B=M.n(Q),N=M("./src/events.ts"),K=M("./src/demux/transmuxer.ts"),W=M("./src/utils/logger.ts"),P=M("./src/errors.ts"),R=M("./src/utils/mediasource-helper.ts"),m=M("./node_modules/eventemitter3/index.js"),p=M.n(m),f=Object(R.getMediaSource)()||{isTypeSupported:function(){return!1}},h=function(){function s(l,a,o,c){var L=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=l,this.id=a,this.onTransmuxComplete=o,this.onFlush=c;var w=l.config,T=function(E,d){d=d||{},d.frag=L.frag,d.id=L.id,l.trigger(E,d)};this.observer=new m.EventEmitter,this.observer.on(N.Events.FRAG_DECRYPTED,T),this.observer.on(N.Events.ERROR,T);var O={mp4:f.isTypeSupported("video/mp4"),mpeg:f.isTypeSupported("audio/mpeg"),mp3:f.isTypeSupported('audio/mp4; codecs="mp3"')},A=navigator.vendor;if(w.enableWorker&&typeof Worker!="undefined"){W.logger.log("demuxing in webworker");var x;try{x=this.worker=Q("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),x.addEventListener("message",this.onwmsg),x.onerror=function(S){l.trigger(N.Events.ERROR,{type:P.ErrorTypes.OTHER_ERROR,details:P.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(S.message+" ("+S.filename+":"+S.lineno+")")})},x.postMessage({cmd:"init",typeSupported:O,vendor:A,id:a,config:JSON.stringify(w)})}catch(S){W.logger.warn("Error in worker:",S),W.logger.error("Error while initializing DemuxerWorker, fallback to inline"),x&&self.URL.revokeObjectURL(x.objectURL),this.transmuxer=new K.default(this.observer,O,w,A,a),this.worker=null}}else this.transmuxer=new K.default(this.observer,O,w,A,a)}var u=s.prototype;return u.destroy=function(){var a=this.worker;if(a)a.removeEventListener("message",this.onwmsg),a.terminate(),this.worker=null;else{var o=this.transmuxer;o&&(o.destroy(),this.transmuxer=null)}var c=this.observer;c&&c.removeAllListeners(),this.observer=null},u.push=function(a,o,c,L,w,T,O,A,x,S){var E=this;x.transmuxing.start=self.performance.now();var d=this.transmuxer,b=this.worker,g=T?T.start:w.start,_=w.decryptdata,F=this.frag,D=!(F&&w.cc===F.cc),j=!(F&&x.level===F.level),H=F?x.sn-F.sn:-1,k=this.part?x.part-this.part.index:1,y=!j&&(H===1||H===0&&k===1),G=self.performance.now();(j||H||w.stats.parsing.start===0)&&(w.stats.parsing.start=G),T&&(k||!y)&&(T.stats.parsing.start=G);var Y=new K.TransmuxState(D,y,A,j,g);if(!y||D){W.logger.log("[transmuxer-interface, "+w.type+"]: Starting new transmux session for sn: "+x.sn+" p: "+x.part+" level: "+x.level+" id: "+x.id+`
discontinuity: `+D+`
trackSwitch: `+j+`
contiguous: `+y+`
accurateTimeOffset: `+A+`
timeOffset: `+g);var ie=new K.TransmuxConfig(c,L,o,O,S);this.configureTransmuxer(ie)}if(this.frag=w,this.part=T,b)b.postMessage({cmd:"demux",data:a,decryptdata:_,chunkMeta:x,state:Y},a instanceof ArrayBuffer?[a]:[]);else if(d){var se=d.push(a,_,x,Y);Object(K.isPromise)(se)?se.then(function(we){E.handleTransmuxComplete(we)}):this.handleTransmuxComplete(se)}},u.flush=function(a){var o=this;a.transmuxing.start=self.performance.now();var c=this.transmuxer,L=this.worker;if(L)L.postMessage({cmd:"flush",chunkMeta:a});else if(c){var w=c.flush(a);Object(K.isPromise)(w)?w.then(function(T){o.handleFlushResult(T,a)}):this.handleFlushResult(w,a)}},u.handleFlushResult=function(a,o){var c=this;a.forEach(function(L){c.handleTransmuxComplete(L)}),this.onFlush(o)},u.onWorkerMessage=function(a){var o=a.data,c=this.hls;switch(o.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(o.data);break}case"flush":{this.onFlush(o.data);break}default:{o.data=o.data||{},o.data.frag=this.frag,o.data.id=this.id,c.trigger(o.event,o.data);break}}},u.configureTransmuxer=function(a){var o=this.worker,c=this.transmuxer;o?o.postMessage({cmd:"configure",config:a}):c&&c.configure(a)},u.handleTransmuxComplete=function(a){a.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(a)},s}()},"./src/demux/transmuxer-worker.ts":function(ue,Z,M){"use strict";M.r(Z),M.d(Z,"default",function(){return P});var Q=M("./src/demux/transmuxer.ts"),B=M("./src/events.ts"),N=M("./src/utils/logger.ts"),K=M("./node_modules/eventemitter3/index.js"),W=M.n(K);function P(h){var s=new K.EventEmitter,u=function(a,o){h.postMessage({event:a,data:o})};s.on(B.Events.FRAG_DECRYPTED,u),s.on(B.Events.ERROR,u),h.addEventListener("message",function(l){var a=l.data;switch(a.cmd){case"init":{var o=JSON.parse(a.config);h.transmuxer=new Q.default(s,a.typeSupported,o,a.vendor,a.id),Object(N.enableLogs)(o.debug),u("init",null);break}case"configure":{h.transmuxer.configure(a.config);break}case"demux":{var c=h.transmuxer.push(a.data,a.decryptdata,a.chunkMeta,a.state);Object(Q.isPromise)(c)?c.then(function(T){R(h,T)}):R(h,c);break}case"flush":{var L=a.chunkMeta,w=h.transmuxer.flush(L);Object(Q.isPromise)(w)?w.then(function(T){p(h,T,L)}):p(h,w,L);break}default:break}})}function R(h,s){if(f(s.remuxResult))return;var u=[],l=s.remuxResult,a=l.audio,o=l.video;a&&m(u,a),o&&m(u,o),h.postMessage({event:"transmuxComplete",data:s},u)}function m(h,s){s.data1&&h.push(s.data1.buffer),s.data2&&h.push(s.data2.buffer)}function p(h,s,u){s.forEach(function(l){R(h,l)}),h.postMessage({event:"flush",data:u})}function f(h){return!h.audio&&!h.video&&!h.text&&!h.id3&&!h.initSegment}},"./src/demux/transmuxer.ts":function(ue,Z,M){"use strict";M.r(Z),M.d(Z,"default",function(){return o}),M.d(Z,"isPromise",function(){return w}),M.d(Z,"TransmuxConfig",function(){return T}),M.d(Z,"TransmuxState",function(){return O});var Q=M("./src/events.ts"),B=M("./src/errors.ts"),N=M("./src/crypt/decrypter.ts"),K=M("./src/demux/aacdemuxer.ts"),W=M("./src/demux/mp4demuxer.ts"),P=M("./src/demux/tsdemuxer.ts"),R=M("./src/demux/mp3demuxer.ts"),m=M("./src/remux/mp4-remuxer.ts"),p=M("./src/remux/passthrough-remuxer.ts"),f=M("./src/demux/chunk-cache.ts"),h=M("./src/utils/mp4-tools.ts"),s=M("./src/utils/logger.ts"),u;try{u=self.performance.now.bind(self.performance)}catch(A){s.logger.debug("Unable to use Performance API on this environment"),u=self.Date.now}var l=[{demux:P.default,remux:m.default},{demux:W.default,remux:p.default},{demux:K.default,remux:m.default},{demux:R.default,remux:m.default}],a=1024;l.forEach(function(A){var x=A.demux;a=Math.max(a,x.minProbeByteLength)});var o=function(){function A(S,E,d,b,g){this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.cache=new f.default,this.observer=S,this.typeSupported=E,this.config=d,this.vendor=b,this.id=g}var x=A.prototype;return x.configure=function(E){this.transmuxConfig=E,this.decrypter&&this.decrypter.reset()},x.push=function(E,d,b,g){var _=this,F=b.transmuxing;F.executeStart=u();var D=new Uint8Array(E),j=this.cache,H=this.config,k=this.currentTransmuxState,y=this.transmuxConfig;g&&(this.currentTransmuxState=g);var G=c(D,d);if(G&&G.method==="AES-128"){var Y=this.getDecrypter();if(H.enableSoftwareAES){var ie=Y.softwareDecrypt(D,G.key.buffer,G.iv.buffer);if(!ie)return F.executeEnd=u(),L(b);D=new Uint8Array(ie)}else return this.decryptionPromise=Y.webCryptoDecrypt(D,G.key.buffer,G.iv.buffer).then(function(Le){var Pe=_.push(Le,null,b);return _.decryptionPromise=null,Pe}),this.decryptionPromise}var se=g||k,we=se.contiguous,ve=se.discontinuity,Se=se.trackSwitch,Ce=se.accurateTimeOffset,pe=se.timeOffset,fe=y.audioCodec,oe=y.videoCodec,te=y.defaultInitPts,he=y.duration,ae=y.initSegmentData;if((ve||Se)&&this.resetInitSegment(ae,fe,oe,he),ve&&this.resetInitialTimestamp(te),we||this.resetContiguity(),this.needsProbing(D,ve,Se)){if(j.dataLength){var Ae=j.flush();D=Object(h.appendUint8Array)(Ae,D)}this.configureTransmuxer(D,y)}var ke=this.transmux(D,G,pe,Ce,b),Te=this.currentTransmuxState;return Te.contiguous=!0,Te.discontinuity=!1,Te.trackSwitch=!1,F.executeEnd=u(),ke},x.flush=function(E){var d=this,b=E.transmuxing;b.executeStart=u();var g=this.decrypter,_=this.cache,F=this.currentTransmuxState,D=this.decryptionPromise;if(D)return D.then(function(){return d.flush(E)});var j=[],H=F.timeOffset;if(g){var k=g.flush();k&&j.push(this.push(k,null,E))}var y=_.dataLength;_.reset();var G=this.demuxer,Y=this.remuxer;if(!G||!Y)return y>=a&&this.observer.emit(Q.Events.ERROR,Q.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),b.executeEnd=u(),[L(E)];var ie=G.flush(H);return w(ie)?ie.then(function(se){return d.flushRemux(j,se,E),j}):(this.flushRemux(j,ie,E),j)},x.flushRemux=function(E,d,b){var g=d.audioTrack,_=d.avcTrack,F=d.id3Track,D=d.textTrack,j=this.currentTransmuxState,H=j.accurateTimeOffset,k=j.timeOffset;s.logger.log("[transmuxer.ts]: Flushed fragment "+b.sn+(b.part>-1?" p: "+b.part:"")+" of level "+b.level);var y=this.remuxer.remux(g,_,F,D,k,H,!0,this.id);E.push({remuxResult:y,chunkMeta:b}),b.transmuxing.executeEnd=u()},x.resetInitialTimestamp=function(E){var d=this.demuxer,b=this.remuxer;if(!d||!b)return;d.resetTimeStamp(E),b.resetTimeStamp(E)},x.resetContiguity=function(){var E=this.demuxer,d=this.remuxer;if(!E||!d)return;E.resetContiguity(),d.resetNextTimestamp()},x.resetInitSegment=function(E,d,b,g){var _=this.demuxer,F=this.remuxer;if(!_||!F)return;_.resetInitSegment(d,b,g),F.resetInitSegment(E,d,b)},x.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},x.transmux=function(E,d,b,g,_){var F;return d&&d.method==="SAMPLE-AES"?F=this.transmuxSampleAes(E,d,b,g,_):F=this.transmuxUnencrypted(E,b,g,_),F},x.transmuxUnencrypted=function(E,d,b,g){var _=this.demuxer.demux(E,d,!1,!this.config.progressive),F=_.audioTrack,D=_.avcTrack,j=_.id3Track,H=_.textTrack,k=this.remuxer.remux(F,D,j,H,d,b,!1,this.id);return{remuxResult:k,chunkMeta:g}},x.transmuxSampleAes=function(E,d,b,g,_){var F=this;return this.demuxer.demuxSampleAes(E,d,b).then(function(D){var j=F.remuxer.remux(D.audioTrack,D.avcTrack,D.id3Track,D.textTrack,b,g,!1,F.id);return{remuxResult:j,chunkMeta:_}})},x.configureTransmuxer=function(E,d){for(var b=this.config,g=this.observer,_=this.typeSupported,F=this.vendor,D=d.audioCodec,j=d.defaultInitPts,H=d.duration,k=d.initSegmentData,y=d.videoCodec,G,Y=0,ie=l.length;Y<ie;Y++)if(l[Y].demux.probe(E)){G=l[Y];break}G||(s.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),G={demux:W.default,remux:p.default});var se=this.demuxer,we=this.remuxer,ve=G.remux,Se=G.demux;(!we||!(we instanceof ve))&&(this.remuxer=new ve(g,b,_,F)),(!se||!(se instanceof Se))&&(this.demuxer=new Se(g,b,_),this.probe=Se.probe),this.resetInitSegment(k,D,y,H),this.resetInitialTimestamp(j)},x.needsProbing=function(E,d,b){return!this.demuxer||!this.remuxer||d||b},x.getDecrypter=function(){var E=this.decrypter;return E||(E=this.decrypter=new N.default(this.observer,this.config)),E},A}();function c(A,x){var S=null;return A.byteLength>0&&x!=null&&x.key!=null&&x.iv!==null&&x.method!=null&&(S=x),S}var L=function(x){return{remuxResult:{},chunkMeta:x}};function w(A){return"then"in A&&A.then instanceof Function}var T=function(x,S,E,d,b){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=x,this.videoCodec=S,this.initSegmentData=E,this.duration=d,this.defaultInitPts=b},O=function(x,S,E,d,b){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=x,this.contiguous=S,this.accurateTimeOffset=E,this.trackSwitch=d,this.timeOffset=b}},"./src/demux/tsdemuxer.ts":function(ue,Z,M){"use strict";M.r(Z),M.d(Z,"discardEPB",function(){return L});var Q=M("./src/demux/adts.ts"),B=M("./src/demux/mpegaudio.ts"),N=M("./src/demux/exp-golomb.ts"),K=M("./src/demux/id3.ts"),W=M("./src/demux/sample-aes.ts"),P=M("./src/events.ts"),R=M("./src/utils/mp4-tools.ts"),m=M("./src/utils/logger.ts"),p=M("./src/errors.ts"),f={video:1,audio:2,id3:3,text:4},h=function(){function w(O,A,x){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=O,this.config=A,this.typeSupported=x}w.probe=function(A){var x=w.syncOffset(A);return x<0?!1:(x&&m.logger.warn("MPEG2-TS detected but first sync word found @ offset "+x+", junk ahead ?"),!0)},w.syncOffset=function(A){for(var x=Math.min(1e3,A.length-3*188),S=0;S<x;){if(A[S]===71&&A[S+188]===71&&A[S+2*188]===71)return S;S++}return-1},w.createTrack=function(A,x){return{container:A==="video"||A==="audio"?"video/mp2t":void 0,type:A,id:f[A],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:A==="audio"?x:void 0}};var T=w.prototype;return T.resetInitSegment=function(A,x,S){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=w.createTrack("video",S),this._audioTrack=w.createTrack("audio",S),this._id3Track=w.createTrack("id3",S),this._txtTrack=w.createTrack("text",S),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=A,this.videoCodec=x,this._duration=S},T.resetTimeStamp=function(){},T.resetContiguity=function(){var A=this._audioTrack,x=this._avcTrack,S=this._id3Track;A&&(A.pesData=null),x&&(x.pesData=null),S&&(S.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},T.demux=function(A,x,S,E){S===void 0&&(S=!1),E===void 0&&(E=!1),S||(this.sampleAes=null);var d,b=this._avcTrack,g=this._audioTrack,_=this._id3Track,F=b.pid,D=b.pesData,j=g.pid,H=_.pid,k=g.pesData,y=_.pesData,G=!1,Y=this.pmtParsed,ie=this._pmtId,se=A.length;if(this.remainderData&&(A=Object(R.appendUint8Array)(this.remainderData,A),se=A.length,this.remainderData=null),se<188&&!E)return this.remainderData=A,{audioTrack:g,avcTrack:b,id3Track:_,textTrack:this._txtTrack};var we=Math.max(0,w.syncOffset(A));se-=(se+we)%188,se<A.byteLength&&!E&&(this.remainderData=new Uint8Array(A.buffer,se,A.buffer.byteLength-se));for(var ve=we;ve<se;ve+=188)if(A[ve]===71){var Se=!!(A[ve+1]&64),Ce=((A[ve+1]&31)<<8)+A[ve+2],pe=(A[ve+3]&48)>>4,fe=void 0;if(pe>1){if(fe=ve+5+A[ve+4],fe===ve+188)continue}else fe=ve+4;switch(Ce){case F:Se&&(D&&(d=a(D))&&this.parseAVCPES(d,!1),D={data:[],size:0}),D&&(D.data.push(A.subarray(fe,ve+188)),D.size+=ve+188-fe);break;case j:Se&&(k&&(d=a(k))&&(g.isAAC?this.parseAACPES(d):this.parseMPEGPES(d)),k={data:[],size:0}),k&&(k.data.push(A.subarray(fe,ve+188)),k.size+=ve+188-fe);break;case H:Se&&(y&&(d=a(y))&&this.parseID3PES(d),y={data:[],size:0}),y&&(y.data.push(A.subarray(fe,ve+188)),y.size+=ve+188-fe);break;case 0:Se&&(fe+=A[fe]+1),ie=this._pmtId=u(A,fe);break;case ie:{Se&&(fe+=A[fe]+1);var oe=l(A,fe,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,S);F=oe.avc,F>0&&(b.pid=F),j=oe.audio,j>0&&(g.pid=j,g.isAAC=oe.isAAC),H=oe.id3,H>0&&(_.pid=H),G&&!Y&&(m.logger.log("reparse from beginning"),G=!1,ve=we-188),Y=this.pmtParsed=!0;break}case 17:case 8191:break;default:G=!0;break}}else this.observer.emit(P.Events.ERROR,P.Events.ERROR,{type:p.ErrorTypes.MEDIA_ERROR,details:p.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});b.pesData=D,g.pesData=k,_.pesData=y;var te={audioTrack:g,avcTrack:b,id3Track:_,textTrack:this._txtTrack};return E&&this.extractRemainingSamples(te),te},T.flush=function(){var A=this.remainderData;this.remainderData=null;var x;return A?x=this.demux(A,-1,!1,!0):x={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(x),this.sampleAes?this.decrypt(x,this.sampleAes):x},T.extractRemainingSamples=function(A){var x=A.audioTrack,S=A.avcTrack,E=A.id3Track,d=S.pesData,b=x.pesData,g=E.pesData,_;d&&(_=a(d))?(this.parseAVCPES(_,!0),S.pesData=null):S.pesData=d,b&&(_=a(b))?(x.isAAC?this.parseAACPES(_):this.parseMPEGPES(_),x.pesData=null):(b!=null&&b.size&&m.logger.log("last AAC PES packet truncated,might overlap between fragments"),x.pesData=b),g&&(_=a(g))?(this.parseID3PES(_),E.pesData=null):E.pesData=g},T.demuxSampleAes=function(A,x,S){var E=this.demux(A,S,!0,!this.config.progressive),d=this.sampleAes=new W.default(this.observer,this.config,x);return this.decrypt(E,d)},T.decrypt=function(A,x){return new Promise(function(S){var E=A.audioTrack,d=A.avcTrack;E.samples&&E.isAAC?x.decryptAacSamples(E.samples,0,function(){d.samples?x.decryptAvcSamples(d.samples,0,0,function(){S(A)}):S(A)}):d.samples&&x.decryptAvcSamples(d.samples,0,0,function(){S(A)})})},T.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},T.parseAVCPES=function(A,x){var S=this,E=this._avcTrack,d=this.parseAVCNALu(A.data),b=!1,g=this.avcSample,_,F=!1;A.data=null,g&&d.length&&!E.audFound&&(o(g,E),g=this.avcSample=s(!1,A.pts,A.dts,"")),d.forEach(function(D){switch(D.type){case 1:{_=!0,g||(g=S.avcSample=s(!0,A.pts,A.dts,"")),b&&(g.debug+="NDR "),g.frame=!0;var j=D.data;if(F&&j.length>4){var H=new N.default(j).readSliceType();(H===2||H===4||H===7||H===9)&&(g.key=!0)}break}case 5:_=!0,g||(g=S.avcSample=s(!0,A.pts,A.dts,"")),b&&(g.debug+="IDR "),g.key=!0,g.frame=!0;break;case 6:{_=!0,b&&g&&(g.debug+="SEI ");var k=new N.default(L(D.data));k.readUByte();for(var y=0,G=0,Y=!1,ie=0;!Y&&k.bytesAvailable>1;){y=0;do ie=k.readUByte(),y+=ie;while(ie===255);G=0;do ie=k.readUByte(),G+=ie;while(ie===255);if(y===4&&k.bytesAvailable!==0){Y=!0;var se=k.readUByte();if(se===181){var we=k.readUShort();if(we===49){var ve=k.readUInt();if(ve===1195456820){var Se=k.readUByte();if(Se===3){for(var Ce=k.readUByte(),pe=k.readUByte(),fe=31&Ce,oe=[Ce,pe],te=0;te<fe;te++)oe.push(k.readUByte()),oe.push(k.readUByte()),oe.push(k.readUByte());c(S._txtTrack.samples,{type:3,pts:A.pts,bytes:oe})}}}}}else if(y===5&&k.bytesAvailable!==0){if(Y=!0,G>16){for(var he=[],ae=0;ae<16;ae++)he.push(k.readUByte().toString(16)),(ae===3||ae===5||ae===7||ae===9)&&he.push("-");for(var Ae=G-16,ke=new Uint8Array(Ae),Te=0;Te<Ae;Te++)ke[Te]=k.readUByte();c(S._txtTrack.samples,{pts:A.pts,payloadType:y,uuid:he.join(""),userData:Object(K.utf8ArrayToStr)(ke),userDataBytes:ke})}}else if(G<k.bytesAvailable)for(var Le=0;Le<G;Le++)k.readUByte()}break}case 7:if(_=!0,F=!0,b&&g&&(g.debug+="SPS "),!E.sps){var Pe=new N.default(D.data),He=Pe.readSPS();E.width=He.width,E.height=He.height,E.pixelRatio=He.pixelRatio,E.sps=[D.data],E.duration=S._duration;for(var Fe=D.data.subarray(1,4),Ue="avc1.",Ne=0;Ne<3;Ne++){var Ze=Fe[Ne].toString(16);Ze.length<2&&(Ze="0"+Ze),Ue+=Ze}E.codec=Ue}break;case 8:_=!0,b&&g&&(g.debug+="PPS "),E.pps||(E.pps=[D.data]);break;case 9:_=!1,E.audFound=!0,g&&o(g,E),g=S.avcSample=s(!1,A.pts,A.dts,b?"AUD ":"");break;case 12:_=!1;break;default:_=!1,g&&(g.debug+="unknown NAL "+D.type+" ");break}if(g&&_){var st=g.units;st.push(D)}}),x&&g&&(o(g,E),this.avcSample=null)},T.getLastNalUnit=function(){var A,x=this.avcSample,S;if(!x||x.units.length===0){var E=this._avcTrack.samples;x=E[E.length-1]}if((A=x)!==null&&A!==void 0&&A.units){var d=x.units;S=d[d.length-1]}return S},T.parseAVCNALu=function(A){var x=A.byteLength,S=this._avcTrack,E=S.naluState||0,d=E,b=[],g=0,_,F,D,j=-1,H=0;for(E===-1&&(j=0,H=A[0]&31,E=0,g=1);g<x;){if(_=A[g++],!E){E=_?0:1;continue}if(E===1){E=_?0:2;continue}if(!_)E=3;else if(_===1){if(j>=0){var k={data:A.subarray(j,g-E-1),type:H};b.push(k)}else{var y=this.getLastNalUnit();if(y&&(d&&g<=4-d&&(y.state&&(y.data=y.data.subarray(0,y.data.byteLength-d))),F=g-E-1,F>0)){var G=new Uint8Array(y.data.byteLength+F);G.set(y.data,0),G.set(A.subarray(0,F),y.data.byteLength),y.data=G,y.state=0}}g<x?(D=A[g]&31,j=g,H=D,E=0):E=-1}else E=0}if(j>=0&&E>=0){var Y={data:A.subarray(j,x),type:H,state:E};b.push(Y)}if(b.length===0){var ie=this.getLastNalUnit();if(ie){var se=new Uint8Array(ie.data.byteLength+A.byteLength);se.set(ie.data,0),se.set(A,ie.data.byteLength),ie.data=se}}return S.naluState=E,b},T.parseAACPES=function(A){var x=0,S=this._audioTrack,E=this.aacOverFlow,d=A.data;if(E){this.aacOverFlow=null;var b=E.sample.unit.byteLength,g=Math.min(E.missing,b),_=b-g;E.sample.unit.set(d.subarray(0,g),_),S.samples.push(E.sample),x=E.missing}var F,D;for(F=x,D=d.length;F<D-1&&!Q.isHeader(d,F);F++);if(F!==x){var j,H;if(F<D-1?(j="AAC PES did not start with ADTS header,offset:"+F,H=!1):(j="no ADTS header found in AAC PES",H=!0),m.logger.warn("parsing error:"+j),this.observer.emit(P.Events.ERROR,P.Events.ERROR,{type:p.ErrorTypes.MEDIA_ERROR,details:p.ErrorDetails.FRAG_PARSING_ERROR,fatal:H,reason:j}),H)return}Q.initTrackConfig(S,this.observer,d,F,this.audioCodec);var k;if(A.pts!==void 0)k=A.pts;else if(E){var y=Q.getFrameDuration(S.samplerate);k=E.sample.pts+y}else{m.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var G=0;F<D;)if(Q.isHeader(d,F)){if(F+5<D){var Y=Q.appendFrame(S,d,F,k,G);if(Y)if(Y.missing)this.aacOverFlow=Y;else{F+=Y.length,G++;continue}}break}else F++},T.parseMPEGPES=function(A){var x=A.data,S=x.length,E=0,d=0,b=A.pts;if(b===void 0){m.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;d<S;)if(B.isHeader(x,d)){var g=B.appendFrame(this._audioTrack,x,d,b,E);if(g)d+=g.length,E++;else break}else d++},T.parseID3PES=function(A){if(A.pts===void 0){m.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(A)},w}();h.minProbeByteLength=188;function s(w,T,O,A){return{key:w,frame:!1,pts:T,dts:O,units:[],debug:A,length:0}}function u(w,T){return(w[T+10]&31)<<8|w[T+11]}function l(w,T,O,A){var x={audio:-1,avc:-1,id3:-1,isAAC:!0},S=(w[T+1]&15)<<8|w[T+2],E=T+3+S-4,d=(w[T+10]&15)<<8|w[T+11];for(T+=12+d;T<E;){var b=(w[T+1]&31)<<8|w[T+2];switch(w[T]){case 207:if(!A){m.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:x.audio===-1&&(x.audio=b);break;case 21:x.id3===-1&&(x.id3=b);break;case 219:if(!A){m.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:x.avc===-1&&(x.avc=b);break;case 3:case 4:O?x.audio===-1&&(x.audio=b,x.isAAC=!1):m.logger.log("MPEG audio found, not supported in this browser");break;case 36:m.logger.warn("Unsupported HEVC stream type found");break;default:break}T+=((w[T+3]&15)<<8|w[T+4])+5}return x}function a(w){var T=0,O,A,x,S,E,d=w.data;if(!w||w.size===0)return null;for(;d[0].length<19&&d.length>1;){var b=new Uint8Array(d[0].length+d[1].length);b.set(d[0]),b.set(d[1],d[0].length),d[0]=b,d.splice(1,1)}O=d[0];var g=(O[0]<<16)+(O[1]<<8)+O[2];if(g===1){if(A=(O[4]<<8)+O[5],A&&A>w.size-6)return null;var _=O[7];_&192&&(S=(O[9]&14)*536870912+(O[10]&255)*4194304+(O[11]&254)*16384+(O[12]&255)*128+(O[13]&254)/2,_&64?(E=(O[14]&14)*536870912+(O[15]&255)*4194304+(O[16]&254)*16384+(O[17]&255)*128+(O[18]&254)/2,S-E>60*9e4&&(m.logger.warn(Math.round((S-E)/9e4)+"s delta between PTS and DTS, align them"),S=E)):E=S),x=O[8];var F=x+9;if(w.size<=F)return null;w.size-=F;for(var D=new Uint8Array(w.size),j=0,H=d.length;j<H;j++){O=d[j];var k=O.byteLength;if(F)if(F>k){F-=k;continue}else O=O.subarray(F),k-=F,F=0;D.set(O,T),T+=k}return A&&(A-=x+3),{data:D,pts:S,dts:E,len:A}}return null}function o(w,T){if(w.units.length&&w.frame){if(w.pts===void 0){var O=T.samples,A=O.length;if(A){var x=O[A-1];w.pts=x.pts,w.dts=x.dts}else{T.dropped++;return}}T.samples.push(w)}w.debug.length&&m.logger.log(w.pts+"/"+w.dts+":"+w.debug)}function c(w,T){var O=w.length;if(O>0){if(T.pts>=w[O-1].pts)w.push(T);else for(var A=O-1;A>=0;A--)if(T.pts<w[A].pts){w.splice(A,0,T);break}}else w.push(T)}function L(w){for(var T=w.byteLength,O=[],A=1;A<T-2;)w[A]===0&&w[A+1]===0&&w[A+2]===3?(O.push(A+2),A+=2):A++;if(O.length===0)return w;var x=T-O.length,S=new Uint8Array(x),E=0;for(A=0;A<x;E++,A++)E===O[0]&&(E++,O.shift()),S[A]=w[E];return S}Z.default=h},"./src/errors.ts":function(ue,Z,M){"use strict";M.r(Z),M.d(Z,"ErrorTypes",function(){return Q}),M.d(Z,"ErrorDetails",function(){return B});var Q;(function(N){N.NETWORK_ERROR="networkError",N.MEDIA_ERROR="mediaError",N.KEY_SYSTEM_ERROR="keySystemError",N.MUX_ERROR="muxError",N.OTHER_ERROR="otherError"})(Q||(Q={}));var B;(function(N){N.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",N.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",N.KEY_SYSTEM_NO_SESSION="keySystemNoSession",N.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",N.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",N.MANIFEST_LOAD_ERROR="manifestLoadError",N.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",N.MANIFEST_PARSING_ERROR="manifestParsingError",N.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",N.LEVEL_EMPTY_ERROR="levelEmptyError",N.LEVEL_LOAD_ERROR="levelLoadError",N.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",N.LEVEL_SWITCH_ERROR="levelSwitchError",N.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",N.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",N.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",N.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",N.FRAG_LOAD_ERROR="fragLoadError",N.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",N.FRAG_DECRYPT_ERROR="fragDecryptError",N.FRAG_PARSING_ERROR="fragParsingError",N.REMUX_ALLOC_ERROR="remuxAllocError",N.KEY_LOAD_ERROR="keyLoadError",N.KEY_LOAD_TIMEOUT="keyLoadTimeOut",N.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",N.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",N.BUFFER_APPEND_ERROR="bufferAppendError",N.BUFFER_APPENDING_ERROR="bufferAppendingError",N.BUFFER_STALLED_ERROR="bufferStalledError",N.BUFFER_FULL_ERROR="bufferFullError",N.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",N.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",N.INTERNAL_EXCEPTION="internalException",N.INTERNAL_ABORTED="aborted",N.UNKNOWN="unknown"})(B||(B={}))},"./src/events.ts":function(ue,Z,M){"use strict";M.r(Z),M.d(Z,"Events",function(){return Q});var Q;(function(B){B.MEDIA_ATTACHING="hlsMediaAttaching",B.MEDIA_ATTACHED="hlsMediaAttached",B.MEDIA_DETACHING="hlsMediaDetaching",B.MEDIA_DETACHED="hlsMediaDetached",B.BUFFER_RESET="hlsBufferReset",B.BUFFER_CODECS="hlsBufferCodecs",B.BUFFER_CREATED="hlsBufferCreated",B.BUFFER_APPENDING="hlsBufferAppending",B.BUFFER_APPENDED="hlsBufferAppended",B.BUFFER_EOS="hlsBufferEos",B.BUFFER_FLUSHING="hlsBufferFlushing",B.BUFFER_FLUSHED="hlsBufferFlushed",B.MANIFEST_LOADING="hlsManifestLoading",B.MANIFEST_LOADED="hlsManifestLoaded",B.MANIFEST_PARSED="hlsManifestParsed",B.LEVEL_SWITCHING="hlsLevelSwitching",B.LEVEL_SWITCHED="hlsLevelSwitched",B.LEVEL_LOADING="hlsLevelLoading",B.LEVEL_LOADED="hlsLevelLoaded",B.LEVEL_UPDATED="hlsLevelUpdated",B.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",B.LEVELS_UPDATED="hlsLevelsUpdated",B.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",B.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",B.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",B.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",B.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",B.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",B.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",B.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",B.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",B.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",B.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",B.CUES_PARSED="hlsCuesParsed",B.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",B.INIT_PTS_FOUND="hlsInitPtsFound",B.FRAG_LOADING="hlsFragLoading",B.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",B.FRAG_LOADED="hlsFragLoaded",B.FRAG_DECRYPTED="hlsFragDecrypted",B.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",B.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",B.FRAG_PARSING_METADATA="hlsFragParsingMetadata",B.FRAG_PARSED="hlsFragParsed",B.FRAG_BUFFERED="hlsFragBuffered",B.FRAG_CHANGED="hlsFragChanged",B.FPS_DROP="hlsFpsDrop",B.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",B.ERROR="hlsError",B.DESTROYING="hlsDestroying",B.KEY_LOADING="hlsKeyLoading",B.KEY_LOADED="hlsKeyLoaded",B.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",B.BACK_BUFFER_REACHED="hlsBackBufferReached"})(Q||(Q={}))},"./src/hls.ts":function(ue,Z,M){"use strict";M.r(Z),M.d(Z,"default",function(){return w});var Q=M("./node_modules/url-toolkit/src/url-toolkit.js"),B=M.n(Q),N=M("./src/loader/playlist-loader.ts"),K=M("./src/loader/key-loader.ts"),W=M("./src/controller/id3-track-controller.ts"),P=M("./src/controller/latency-controller.ts"),R=M("./src/controller/level-controller.ts"),m=M("./src/controller/fragment-tracker.ts"),p=M("./src/controller/stream-controller.ts"),f=M("./src/is-supported.ts"),h=M("./src/utils/logger.ts"),s=M("./src/config.ts"),u=M("./node_modules/eventemitter3/index.js"),l=M.n(u),a=M("./src/events.ts"),o=M("./src/errors.ts");function c(T,O){for(var A=0;A<O.length;A++){var x=O[A];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(T,x.key,x)}}function L(T,O,A){return O&&c(T.prototype,O),A&&c(T,A),T}var w=function(){T.isSupported=function(){return Object(f.isSupported)()};function T(A){A===void 0&&(A={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new u.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 x=this.config=Object(s.mergeConfig)(T.DefaultConfig,A);this.userConfig=A,Object(h.enableLogs)(x.debug),this._autoLevelCapping=-1,x.progressive&&Object(s.enableStreamingMode)(x);var S=x.abrController,E=x.bufferController,d=x.capLevelController,b=x.fpsController,g=this.abrController=new S(this),_=this.bufferController=new E(this),F=this.capLevelController=new d(this),D=new b(this),j=new N.default(this),H=new K.default(this),k=new W.default(this),y=this.levelController=new R.default(this),G=new m.FragmentTracker(this),Y=this.streamController=new p.default(this,G);F.setStreamController(Y),D.setStreamController(Y);var ie=[y,Y];this.networkControllers=ie;var se=[j,H,g,_,F,D,k,G];this.audioTrackController=this.createController(x.audioTrackController,null,ie),this.createController(x.audioStreamController,G,ie),this.subtitleTrackController=this.createController(x.subtitleTrackController,null,ie),this.createController(x.subtitleStreamController,G,ie),this.createController(x.timelineController,null,se),this.emeController=this.createController(x.emeController,null,se),this.cmcdController=this.createController(x.cmcdController,null,se),this.latencyController=this.createController(P.default,null,se),this.coreComponents=se}var O=T.prototype;return O.createController=function(x,S,E){if(x){var d=S?new x(this,S):new x(this);return E&&E.push(d),d}return null},O.on=function(x,S,E){E===void 0&&(E=this),this._emitter.on(x,S,E)},O.once=function(x,S,E){E===void 0&&(E=this),this._emitter.once(x,S,E)},O.removeAllListeners=function(x){this._emitter.removeAllListeners(x)},O.off=function(x,S,E,d){E===void 0&&(E=this),this._emitter.off(x,S,E,d)},O.listeners=function(x){return this._emitter.listeners(x)},O.emit=function(x,S,E){return this._emitter.emit(x,S,E)},O.trigger=function(x,S){if(this.config.debug)return this.emit(x,x,S);try{return this.emit(x,x,S)}catch(E){h.logger.error("An internal error happened while handling event "+x+'. Error message: "'+E.message+'". Here is a stacktrace:',E),this.trigger(a.Events.ERROR,{type:o.ErrorTypes.OTHER_ERROR,details:o.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:x,error:E})}return!1},O.listenerCount=function(x){return this._emitter.listenerCount(x)},O.destroy=function(){h.logger.log("destroy"),this.trigger(a.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(x){return x.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(x){return x.destroy()}),this.coreComponents.length=0},O.attachMedia=function(x){h.logger.log("attachMedia"),this._media=x,this.trigger(a.Events.MEDIA_ATTACHING,{media:x})},O.detachMedia=function(){h.logger.log("detachMedia"),this.trigger(a.Events.MEDIA_DETACHING,void 0),this._media=null},O.loadSource=function(x){this.stopLoad();var S=this.media,E=this.url,d=this.url=Q.buildAbsoluteURL(self.location.href,x,{alwaysNormalize:!0});h.logger.log("loadSource:"+d),S&&E&&E!==d&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(S)),this.trigger(a.Events.MANIFEST_LOADING,{url:x})},O.startLoad=function(x){x===void 0&&(x=-1),h.logger.log("startLoad("+x+")"),this.networkControllers.forEach(function(S){S.startLoad(x)})},O.stopLoad=function(){h.logger.log("stopLoad"),this.networkControllers.forEach(function(x){x.stopLoad()})},O.swapAudioCodec=function(){h.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},O.recoverMediaError=function(){h.logger.log("recoverMediaError");var x=this._media;this.detachMedia(),x&&this.attachMedia(x)},O.removeLevel=function(x,S){S===void 0&&(S=0),this.levelController.removeLevel(x,S)},L(T,[{key:"levels",get:function(){var x=this.levelController.levels;return x||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(x){h.logger.log("set currentLevel:"+x),this.loadLevel=x,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(x){h.logger.log("set nextLevel:"+x),this.levelController.manualLevel=x,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(x){h.logger.log("set loadLevel:"+x),this.levelController.manualLevel=x}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(x){this.levelController.nextLoadLevel=x}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(x){h.logger.log("set firstLevel:"+x),this.levelController.firstLevel=x}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(x){h.logger.log("set startLevel:"+x),x!==-1&&(x=Math.max(x,this.minAutoLevel)),this.levelController.startLevel=x}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(x){var S=!!x;S!==this.config.capLevelToPlayerSize&&(S?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=S)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(x){this._autoLevelCapping!==x&&(h.logger.log("set autoLevelCapping:"+x),this._autoLevelCapping=x)}},{key:"bandwidthEstimate",get:function(){var x=this.abrController.bwEstimator;return x?x.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var x=this.levels,S=this.config.minAutoBitrate;if(!x)return 0;for(var E=x.length,d=0;d<E;d++)if(x[d].maxBitrate>S)return d;return 0}},{key:"maxAutoLevel",get:function(){var x=this.levels,S=this.autoLevelCapping,E;return S===-1&&x&&x.length?E=x.length-1:E=S,E}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(x){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,x)}},{key:"audioTracks",get:function(){var x=this.audioTrackController;return x?x.audioTracks:[]}},{key:"audioTrack",get:function(){var x=this.audioTrackController;return x?x.audioTrack:-1},set:function(x){var S=this.audioTrackController;S&&(S.audioTrack=x)}},{key:"subtitleTracks",get:function(){var x=this.subtitleTrackController;return x?x.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var x=this.subtitleTrackController;return x?x.subtitleTrack:-1},set:function(x){var S=this.subtitleTrackController;S&&(S.subtitleTrack=x)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var x=this.subtitleTrackController;return x?x.subtitleDisplay:!1},set:function(x){var S=this.subtitleTrackController;S&&(S.subtitleDisplay=x)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(x){this.config.lowLatencyMode=x}},{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 a.Events}},{key:"ErrorTypes",get:function(){return o.ErrorTypes}},{key:"ErrorDetails",get:function(){return o.ErrorDetails}},{key:"DefaultConfig",get:function(){return T.defaultConfig?T.defaultConfig:s.hlsDefaultConfig},set:function(x){T.defaultConfig=x}}]),T}();w.defaultConfig=void 0},"./src/is-supported.ts":function(ue,Z,M){"use strict";M.r(Z),M.d(Z,"isSupported",function(){return N}),M.d(Z,"changeTypeSupported",function(){return K});var Q=M("./src/utils/mediasource-helper.ts");function B(){return self.SourceBuffer||self.WebKitSourceBuffer}function N(){var W=Object(Q.getMediaSource)();if(!W)return!1;var P=B(),R=W&&typeof W.isTypeSupported=="function"&&W.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),m=!P||P.prototype&&typeof P.prototype.appendBuffer=="function"&&typeof P.prototype.remove=="function";return!!R&&!!m}function K(){var W,P=B();return typeof(P==null||((W=P.prototype)===null||W===void 0)?void 0:W.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(ue,Z,M){"use strict";M.r(Z),M.d(Z,"default",function(){return h}),M.d(Z,"LoadError",function(){return u});var Q=M("./src/polyfills/number.ts"),B=M("./src/errors.ts");function N(l,a){l.prototype=Object.create(a.prototype),l.prototype.constructor=l,m(l,a)}function K(l){var a=typeof Map=="function"?new Map:void 0;return K=function(c){if(c===null||!R(c))return c;if(typeof c!="function")throw new TypeError("Super expression must either be null or a function");if(typeof a!="undefined"){if(a.has(c))return a.get(c);a.set(c,L)}function L(){return W(c,arguments,p(this).constructor)}return L.prototype=Object.create(c.prototype,{constructor:{value:L,enumerable:!1,writable:!0,configurable:!0}}),m(L,c)},K(l)}function W(l,a,o){return P()?W=Reflect.construct:W=function(L,w,T){var O=[null];O.push.apply(O,w);var A=Function.bind.apply(L,O),x=new A;return T&&m(x,T.prototype),x},W.apply(null,arguments)}function P(){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(l){return!1}}function R(l){return Function.toString.call(l).indexOf("[native code]")!==-1}function m(l,a){return m=Object.setPrototypeOf||function(c,L){return c.__proto__=L,c},m(l,a)}function p(l){return p=Object.setPrototypeOf?Object.getPrototypeOf:function(o){return o.__proto__||Object.getPrototypeOf(o)},p(l)}var f=Math.pow(2,17),h=function(){function l(o){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=o}var a=l.prototype;return a.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},a.abort=function(){this.loader&&this.loader.abort()},a.load=function(c,L){var w=this,T=c.url;if(!T)return Promise.reject(new u({type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:c,networkDetails:null},"Fragment does not have a "+(T?"part list":"url")));this.abort();var O=this.config,A=O.fLoader,x=O.loader;return new Promise(function(S,E){w.loader&&w.loader.destroy();var d=w.loader=c.loader=A?new A(O):new x(O),b=s(c),g={timeout:O.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:O.fragLoadingMaxRetryTimeout,highWaterMark:f};c.stats=d.stats,d.load(b,g,{onSuccess:function(F,D,j,H){w.resetLoader(c,d),S({frag:c,part:null,payload:F.data,networkDetails:H})},onError:function(F,D,j){w.resetLoader(c,d),E(new u({type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:c,response:F,networkDetails:j}))},onAbort:function(F,D,j){w.resetLoader(c,d),E(new u({type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:c,networkDetails:j}))},onTimeout:function(F,D,j){w.resetLoader(c,d),E(new u({type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:c,networkDetails:j}))},onProgress:function(F,D,j,H){L&&L({frag:c,part:null,payload:j,networkDetails:H})}})})},a.loadPart=function(c,L,w){var T=this;this.abort();var O=this.config,A=O.fLoader,x=O.loader;return new Promise(function(S,E){T.loader&&T.loader.destroy();var d=T.loader=c.loader=A?new A(O):new x(O),b=s(c,L),g={timeout:O.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:O.fragLoadingMaxRetryTimeout,highWaterMark:f};L.stats=d.stats,d.load(b,g,{onSuccess:function(F,D,j,H){T.resetLoader(c,d),T.updateStatsFromPart(c,L);var k={frag:c,part:L,payload:F.data,networkDetails:H};w(k),S(k)},onError:function(F,D,j){T.resetLoader(c,d),E(new u({type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:c,part:L,response:F,networkDetails:j}))},onAbort:function(F,D,j){c.stats.aborted=L.stats.aborted,T.resetLoader(c,d),E(new u({type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:c,part:L,networkDetails:j}))},onTimeout:function(F,D,j){T.resetLoader(c,d),E(new u({type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:c,part:L,networkDetails:j}))}})})},a.updateStatsFromPart=function(c,L){var w=c.stats,T=L.stats,O=T.total;if(w.loaded+=T.loaded,O){var A=Math.round(c.duration/L.duration),x=Math.min(Math.round(w.loaded/O),A),S=A-x,E=S*Math.round(w.loaded/x);w.total=w.loaded+E}else w.total=Math.max(w.loaded,w.total);var d=w.loading,b=T.loading;d.start?d.first+=b.first-b.start:(d.start=b.start,d.first=b.first),d.end=b.end},a.resetLoader=function(c,L){c.loader=null,this.loader===L&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),L.destroy()},l}();function s(l,a){a===void 0&&(a=null);var o=a||l,c={frag:l,part:a,responseType:"arraybuffer",url:o.url,headers:{},rangeStart:0,rangeEnd:0},L=o.byteRangeStartOffset,w=o.byteRangeEndOffset;return Object(Q.isFiniteNumber)(L)&&Object(Q.isFiniteNumber)(w)&&(c.rangeStart=L,c.rangeEnd=w),c}var u=function(l){N(a,l);function a(o){for(var c,L=arguments.length,w=new Array(L>1?L-1:0),T=1;T<L;T++)w[T-1]=arguments[T];return c=l.call.apply(l,[this].concat(w))||this,c.data=void 0,c.data=o,c}return a}(K(Error))},"./src/loader/fragment.ts":function(ue,Z,M){"use strict";M.r(Z),M.d(Z,"ElementaryStreamTypes",function(){return h}),M.d(Z,"BaseSegment",function(){return s}),M.d(Z,"Fragment",function(){return u}),M.d(Z,"Part",function(){return l});var Q=M("./src/polyfills/number.ts"),B=M("./node_modules/url-toolkit/src/url-toolkit.js"),N=M.n(B),K=M("./src/utils/logger.ts"),W=M("./src/loader/level-key.ts"),P=M("./src/loader/load-stats.ts");function R(a,o){a.prototype=Object.create(o.prototype),a.prototype.constructor=a,m(a,o)}function m(a,o){return m=Object.setPrototypeOf||function(L,w){return L.__proto__=w,L},m(a,o)}function p(a,o){for(var c=0;c<o.length;c++){var L=o[c];L.enumerable=L.enumerable||!1,L.configurable=!0,"value"in L&&(L.writable=!0),Object.defineProperty(a,L.key,L)}}function f(a,o,c){return o&&p(a.prototype,o),c&&p(a,c),a}var h;(function(a){a.AUDIO="audio",a.VIDEO="video",a.AUDIOVIDEO="audiovideo"})(h||(h={}));var s=function(){function a(c){var L;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(L={},L[h.AUDIO]=null,L[h.VIDEO]=null,L[h.AUDIOVIDEO]=null,L),this.baseurl=c}var o=a.prototype;return o.setByteRange=function(L,w){var T=L.split("@",2),O=[];T.length===1?O[0]=w?w.byteRangeEndOffset:0:O[0]=parseInt(T[1]),O[1]=parseInt(T[0])+O[0],this._byteRange=O},f(a,[{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(B.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(L){this._url=L}}]),a}(),u=function(a){R(o,a);function o(L,w){var T;return T=a.call(this,w)||this,T._decryptdata=null,T.rawProgramDateTime=null,T.programDateTime=null,T.tagList=[],T.duration=0,T.sn=0,T.levelkey=void 0,T.type=void 0,T.loader=null,T.level=-1,T.cc=0,T.startPTS=void 0,T.endPTS=void 0,T.appendedPTS=void 0,T.startDTS=void 0,T.endDTS=void 0,T.start=0,T.deltaPTS=void 0,T.maxStartPTS=void 0,T.minEndPTS=void 0,T.stats=new P.LoadStats,T.urlId=0,T.data=void 0,T.bitrateTest=!1,T.title=null,T.initSegment=null,T.type=L,T}var c=o.prototype;return c.createInitializationVector=function(w){for(var T=new Uint8Array(16),O=12;O<16;O++)T[O]=w>>8*(15-O)&255;return T},c.setDecryptDataFromLevelKey=function(w,T){var O=w;return(w==null?void 0:w.method)==="AES-128"&&w.uri&&!w.iv&&(O=W.LevelKey.fromURI(w.uri),O.method=w.method,O.iv=this.createInitializationVector(T),O.keyFormat="identity"),O},c.setElementaryStreamInfo=function(w,T,O,A,x,S){S===void 0&&(S=!1);var E=this.elementaryStreams,d=E[w];if(!d){E[w]={startPTS:T,endPTS:O,startDTS:A,endDTS:x,partial:S};return}d.startPTS=Math.min(d.startPTS,T),d.endPTS=Math.max(d.endPTS,O),d.startDTS=Math.min(d.startDTS,A),d.endDTS=Math.max(d.endDTS,x)},c.clearElementaryStreamInfo=function(){var w=this.elementaryStreams;w[h.AUDIO]=null,w[h.VIDEO]=null,w[h.AUDIOVIDEO]=null},f(o,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var w=this.sn;typeof w!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&K.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),w=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,w)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(Q.isFiniteNumber)(this.programDateTime))return null;var w=Object(Q.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+w*1e3}},{key:"encrypted",get:function(){var w;return!!((w=this.decryptdata)!==null&&w!==void 0&&w.keyFormat&&this.decryptdata.uri)}}]),o}(s),l=function(a){R(o,a);function o(c,L,w,T,O){var A;A=a.call(this,w)||this,A.fragOffset=0,A.duration=0,A.gap=!1,A.independent=!1,A.relurl=void 0,A.fragment=void 0,A.index=void 0,A.stats=new P.LoadStats,A.duration=c.decimalFloatingPoint("DURATION"),A.gap=c.bool("GAP"),A.independent=c.bool("INDEPENDENT"),A.relurl=c.enumeratedString("URI"),A.fragment=L,A.index=T;var x=c.enumeratedString("BYTERANGE");return x&&A.setByteRange(x,O),O&&(A.fragOffset=O.fragOffset+O.duration),A}return f(o,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var L=this.elementaryStreams;return!!(L.audio||L.video||L.audiovideo)}}]),o}(s)},"./src/loader/key-loader.ts":function(ue,Z,M){"use strict";M.r(Z),M.d(Z,"default",function(){return K});var Q=M("./src/events.ts"),B=M("./src/errors.ts"),N=M("./src/utils/logger.ts"),K=function(){function W(R){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=R,this._registerListeners()}var P=W.prototype;return P._registerListeners=function(){this.hls.on(Q.Events.KEY_LOADING,this.onKeyLoading,this)},P._unregisterListeners=function(){this.hls.off(Q.Events.KEY_LOADING,this.onKeyLoading)},P.destroy=function(){this._unregisterListeners();for(var m in this.loaders){var p=this.loaders[m];p&&p.destroy()}this.loaders={}},P.onKeyLoading=function(m,p){var f=p.frag,h=f.type,s=this.loaders[h];if(!f.decryptdata){N.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var u=f.decryptdata.uri;if(u!==this.decrypturl||this.decryptkey===null){var l=this.hls.config;if(s&&(N.logger.warn("abort previous key loader for type:"+h),s.abort()),!u){N.logger.warn("key uri is falsy");return}var a=l.loader,o=f.loader=this.loaders[h]=new a(l);this.decrypturl=u,this.decryptkey=null;var c={url:u,frag:f,responseType:"arraybuffer"},L={timeout:l.fragLoadingTimeOut,maxRetry:0,retryDelay:l.fragLoadingRetryDelay,maxRetryDelay:l.fragLoadingMaxRetryTimeout,highWaterMark:0},w={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};o.load(c,L,w)}else this.decryptkey&&(f.decryptdata.key=this.decryptkey,this.hls.trigger(Q.Events.KEY_LOADED,{frag:f}))},P.loadsuccess=function(m,p,f){var h=f.frag;if(!h.decryptdata){N.logger.error("after key load, decryptdata unset");return}this.decryptkey=h.decryptdata.key=new Uint8Array(m.data),h.loader=null,delete this.loaders[h.type],this.hls.trigger(Q.Events.KEY_LOADED,{frag:h})},P.loaderror=function(m,p){var f=p.frag,h=f.loader;h&&h.abort(),delete this.loaders[f.type],this.hls.trigger(Q.Events.ERROR,{type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:f,response:m})},P.loadtimeout=function(m,p){var f=p.frag,h=f.loader;h&&h.abort(),delete this.loaders[f.type],this.hls.trigger(Q.Events.ERROR,{type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:f})},W}()},"./src/loader/level-details.ts":function(ue,Z,M){"use strict";M.r(Z),M.d(Z,"LevelDetails",function(){return W});var Q=M("./src/polyfills/number.ts");function B(P,R){for(var m=0;m<R.length;m++){var p=R[m];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(P,p.key,p)}}function N(P,R,m){return R&&B(P.prototype,R),m&&B(P,m),P}var K=10,W=function(){function P(m){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=m}var R=P.prototype;return R.reloaded=function(p){if(!p){this.advanced=!0,this.updated=!0;return}var f=this.lastPartSn-p.lastPartSn,h=this.lastPartIndex-p.lastPartIndex;this.updated=this.endSN!==p.endSN||!!h||!!f,this.advanced=this.endSN>p.endSN||f>0||f===0&&h>0,this.updated||this.advanced?this.misses=Math.floor(p.misses*.6):this.misses=p.misses+1,this.availabilityDelay=p.availabilityDelay},N(P,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(Q.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||K}},{key:"drift",get:function(){var p=this.driftEndTime-this.driftStartTime;if(p>0){var f=this.driftEnd-this.driftStart;return f*1e3/p}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var p;return(p=this.partList)!==null&&p!==void 0&&p.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var p;return(p=this.fragments)!==null&&p!==void 0&&p.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 p;return(p=this.partList)!==null&&p!==void 0&&p.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var p;return(p=this.partList)!==null&&p!==void 0&&p.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),P}()},"./src/loader/level-key.ts":function(ue,Z,M){"use strict";M.r(Z),M.d(Z,"LevelKey",function(){return W});var Q=M("./node_modules/url-toolkit/src/url-toolkit.js"),B=M.n(Q);function N(P,R){for(var m=0;m<R.length;m++){var p=R[m];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(P,p.key,p)}}function K(P,R,m){return R&&N(P.prototype,R),m&&N(P,m),P}var W=function(){P.fromURL=function(m,p){return new P(m,p)},P.fromURI=function(m){return new P(m)};function P(R,m){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,m?this._uri=Object(Q.buildAbsoluteURL)(R,m,{alwaysNormalize:!0}):this._uri=R}return K(P,[{key:"uri",get:function(){return this._uri}}]),P}()},"./src/loader/load-stats.ts":function(ue,Z,M){"use strict";M.r(Z),M.d(Z,"LoadStats",function(){return Q});var Q=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(ue,Z,M){"use strict";M.r(Z),M.d(Z,"default",function(){return o});var Q=M("./src/polyfills/number.ts"),B=M("./node_modules/url-toolkit/src/url-toolkit.js"),N=M.n(B),K=M("./src/loader/fragment.ts"),W=M("./src/loader/level-details.ts"),P=M("./src/loader/level-key.ts"),R=M("./src/utils/attr-list.ts"),m=M("./src/utils/logger.ts"),p=M("./src/utils/codecs.ts"),f=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,h=/#EXT-X-MEDIA:(.*)/g,s=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),u=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("|")),l=/\.(mp4|m4s|m4v|m4a)$/i;function a(O){var A,x;return l.test((A=(x=B.parseURL(O))===null||x===void 0?void 0:x.path)!=null?A:"")}var o=function(){function O(){}return O.findGroup=function(x,S){for(var E=0;E<x.length;E++){var d=x[E];if(d.id===S)return d}},O.convertAVC1ToAVCOTI=function(x){var S=x.split(".");if(S.length>2){var E=S.shift()+".";return E+=parseInt(S.shift()).toString(16),E+=("000"+parseInt(S.shift()).toString(16)).substr(-4),E}return x},O.resolve=function(x,S){return B.buildAbsoluteURL(S,x,{alwaysNormalize:!0})},O.parseMasterPlaylist=function(x,S){var E=[],d={},b=!1;f.lastIndex=0;for(var g;(g=f.exec(x))!=null;)if(g[1]){var _=new R.AttrList(g[1]),F={attrs:_,bitrate:_.decimalInteger("AVERAGE-BANDWIDTH")||_.decimalInteger("BANDWIDTH"),name:_.NAME,url:O.resolve(g[2],S)},D=_.decimalResolution("RESOLUTION");D&&(F.width=D.width,F.height=D.height),c((_.CODECS||"").split(/[ ,]+/).filter(function(H){return H}),F),F.videoCodec&&F.videoCodec.indexOf("avc1")!==-1&&(F.videoCodec=O.convertAVC1ToAVCOTI(F.videoCodec)),E.push(F)}else if(g[3]){var j=new R.AttrList(g[3]);j["DATA-ID"]&&(b=!0,d[j["DATA-ID"]]=j)}return{levels:E,sessionData:b?d:null}},O.parseMasterPlaylistMedia=function(x,S,E,d){d===void 0&&(d=[]);var b,g=[],_=0;for(h.lastIndex=0;(b=h.exec(x))!==null;){var F=new R.AttrList(b[1]);if(F.TYPE===E){var D={attrs:F,bitrate:0,id:_++,groupId:F["GROUP-ID"],instreamId:F["INSTREAM-ID"],name:F.NAME||F.LANGUAGE||"",type:E,default:F.bool("DEFAULT"),autoselect:F.bool("AUTOSELECT"),forced:F.bool("FORCED"),lang:F.LANGUAGE,url:F.URI?O.resolve(F.URI,S):""};if(d.length){var j=O.findGroup(d,D.groupId)||d[0];L(D,j,"audioCodec"),L(D,j,"textCodec")}g.push(D)}}return g},O.parseLevelPlaylist=function(x,S,E,d,b){var g=new W.LevelDetails(S),_=g.fragments,F=null,D=0,j=0,H=0,k=0,y=null,G=new K.Fragment(d,S),Y,ie,se,we=-1,ve=!1;for(s.lastIndex=0,g.m3u8=x;(Y=s.exec(x))!==null;){ve&&(ve=!1,G=new K.Fragment(d,S),G.start=H,G.sn=D,G.cc=k,G.level=E,F&&(G.initSegment=F,G.rawProgramDateTime=F.rawProgramDateTime));var Se=Y[1];if(Se){G.duration=parseFloat(Se);var Ce=(" "+Y[2]).slice(1);G.title=Ce||null,G.tagList.push(Ce?["INF",Se,Ce]:["INF",Se])}else if(Y[3])Object(Q.isFiniteNumber)(G.duration)&&(G.start=H,se&&(G.levelkey=se),G.sn=D,G.level=E,G.cc=k,G.urlId=b,_.push(G),G.relurl=(" "+Y[3]).slice(1),T(G,y),y=G,H+=G.duration,D++,j=0,ve=!0);else if(Y[4]){var pe=(" "+Y[4]).slice(1);y?G.setByteRange(pe,y):G.setByteRange(pe)}else if(Y[5])G.rawProgramDateTime=(" "+Y[5]).slice(1),G.tagList.push(["PROGRAM-DATE-TIME",G.rawProgramDateTime]),we===-1&&(we=_.length);else{if(Y=Y[0].match(u),!Y){m.logger.warn("No matches on slow regex match for level playlist!");continue}for(ie=1;ie<Y.length&&!(typeof Y[ie]!="undefined");ie++);var fe=(" "+Y[ie]).slice(1),oe=(" "+Y[ie+1]).slice(1),te=Y[ie+2]?(" "+Y[ie+2]).slice(1):"";switch(fe){case"PLAYLIST-TYPE":g.type=oe.toUpperCase();break;case"MEDIA-SEQUENCE":D=g.startSN=parseInt(oe);break;case"SKIP":{var he=new R.AttrList(oe),ae=he.decimalInteger("SKIPPED-SEGMENTS");if(Object(Q.isFiniteNumber)(ae)){g.skippedSegments=ae;for(var Ae=ae;Ae--;)_.unshift(null);D+=ae}var ke=he.enumeratedString("RECENTLY-REMOVED-DATERANGES");ke&&(g.recentlyRemovedDateranges=ke.split(" "));break}case"TARGETDURATION":g.targetduration=parseFloat(oe);break;case"VERSION":g.version=parseInt(oe);break;case"EXTM3U":break;case"ENDLIST":g.live=!1;break;case"#":(oe||te)&&G.tagList.push(te?[oe,te]:[oe]);break;case"DIS":k++;case"GAP":G.tagList.push([fe]);break;case"BITRATE":G.tagList.push([fe,oe]);break;case"DISCONTINUITY-SEQ":k=parseInt(oe);break;case"KEY":{var Te,Le=new R.AttrList(oe),Pe=Le.enumeratedString("METHOD"),He=Le.URI,Fe=Le.hexadecimalInteger("IV"),Ue=Le.enumeratedString("KEYFORMATVERSIONS"),Ne=Le.enumeratedString("KEYID"),Ze=(Te=Le.enumeratedString("KEYFORMAT"))!=null?Te:"identity",st=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(st.indexOf(Ze)>-1){m.logger.warn("Keyformat "+Ze+" is not supported from the manifest");continue}else if(Ze!=="identity")continue;Pe&&(se=P.LevelKey.fromURL(S,He),He&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(Pe)>=0&&(se.method=Pe,se.keyFormat=Ze,Ne&&(se.keyID=Ne),Ue&&(se.keyFormatVersions=Ue),se.iv=Fe));break}case"START":{var tt=new R.AttrList(oe),et=tt.decimalFloatingPoint("TIME-OFFSET");Object(Q.isFiniteNumber)(et)&&(g.startTimeOffset=et);break}case"MAP":{var ut=new R.AttrList(oe);G.relurl=ut.URI,ut.BYTERANGE&&G.setByteRange(ut.BYTERANGE),G.level=E,G.sn="initSegment",se&&(G.levelkey=se),G.initSegment=null,F=G,ve=!0;break}case"SERVER-CONTROL":{var Ye=new R.AttrList(oe);g.canBlockReload=Ye.bool("CAN-BLOCK-RELOAD"),g.canSkipUntil=Ye.optionalFloat("CAN-SKIP-UNTIL",0),g.canSkipDateRanges=g.canSkipUntil>0&&Ye.bool("CAN-SKIP-DATERANGES"),g.partHoldBack=Ye.optionalFloat("PART-HOLD-BACK",0),g.holdBack=Ye.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var Xe=new R.AttrList(oe);g.partTarget=Xe.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Ie=g.partList;Ie||(Ie=g.partList=[]);var lt=j>0?Ie[Ie.length-1]:void 0,nt=j++,De=new K.Part(new R.AttrList(oe),G,S,nt,lt);Ie.push(De),G.duration+=De.duration;break}case"PRELOAD-HINT":{var ze=new R.AttrList(oe);g.preloadHint=ze;break}case"RENDITION-REPORT":{var xe=new R.AttrList(oe);g.renditionReports=g.renditionReports||[],g.renditionReports.push(xe);break}default:m.logger.warn("line parsed but not handled: "+Y);break}}}y&&!y.relurl?(_.pop(),H-=y.duration,g.partList&&(g.fragmentHint=y)):g.partList&&(T(G,y),G.cc=k,g.fragmentHint=G);var ye=_.length,_e=_[0],ne=_[ye-1];if(H+=g.skippedSegments*g.targetduration,H>0&&ye&&ne){g.averagetargetduration=H/ye;var re=ne.sn;g.endSN=re!=="initSegment"?re:0,_e&&(g.startCC=_e.cc,_e.initSegment||g.fragments.every(function(de){return de.relurl&&a(de.relurl)})&&(m.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),G=new K.Fragment(d,S),G.relurl=ne.relurl,G.level=E,G.sn="initSegment",_e.initSegment=G,g.needSidxRanges=!0))}else g.endSN=0,g.startCC=0;return g.fragmentHint&&(H+=g.fragmentHint.duration),g.totalduration=H,g.endCC=k,we>0&&w(_,we),g},O}();function c(O,A){["video","audio","text"].forEach(function(x){var S=O.filter(function(d){return Object(p.isCodecType)(d,x)});if(S.length){var E=S.filter(function(d){return d.lastIndexOf("avc1",0)===0||d.lastIndexOf("mp4a",0)===0});A[x+"Codec"]=E.length>0?E[0]:S[0],O=O.filter(function(d){return S.indexOf(d)===-1})}}),A.unknownCodecs=O}function L(O,A,x){var S=A[x];S&&(O[x]=S)}function w(O,A){for(var x=O[A],S=A;S--;){var E=O[S];if(!E)return;E.programDateTime=x.programDateTime-E.duration*1e3,x=E}}function T(O,A){O.rawProgramDateTime?O.programDateTime=Date.parse(O.rawProgramDateTime):A!=null&&A.programDateTime&&(O.programDateTime=A.endProgramDateTime),Object(Q.isFiniteNumber)(O.programDateTime)||(O.programDateTime=null,O.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(ue,Z,M){"use strict";M.r(Z);var Q=M("./src/polyfills/number.ts"),B=M("./src/events.ts"),N=M("./src/errors.ts"),K=M("./src/utils/logger.ts"),W=M("./src/utils/mp4-tools.ts"),P=M("./src/loader/m3u8-parser.ts"),R=M("./src/types/loader.ts"),m=M("./src/utils/attr-list.ts");function p(s){var u=s.type;switch(u){case R.PlaylistContextType.AUDIO_TRACK:return R.PlaylistLevelType.AUDIO;case R.PlaylistContextType.SUBTITLE_TRACK:return R.PlaylistLevelType.SUBTITLE;default:return R.PlaylistLevelType.MAIN}}function f(s,u){var l=s.url;return(l===void 0||l.indexOf("data:")===0)&&(l=u.url),l}var h=function(){function s(l){this.hls=void 0,this.loaders=Object.create(null),this.hls=l,this.registerListeners()}var u=s.prototype;return u.registerListeners=function(){var a=this.hls;a.on(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.on(B.Events.LEVEL_LOADING,this.onLevelLoading,this),a.on(B.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),a.on(B.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},u.unregisterListeners=function(){var a=this.hls;a.off(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.off(B.Events.LEVEL_LOADING,this.onLevelLoading,this),a.off(B.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),a.off(B.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},u.createInternalLoader=function(a){var o=this.hls.config,c=o.pLoader,L=o.loader,w=c||L,T=new w(o);return a.loader=T,this.loaders[a.type]=T,T},u.getInternalLoader=function(a){return this.loaders[a.type]},u.resetInternalLoader=function(a){this.loaders[a]&&delete this.loaders[a]},u.destroyInternalLoaders=function(){for(var a in this.loaders){var o=this.loaders[a];o&&o.destroy(),this.resetInternalLoader(a)}},u.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},u.onManifestLoading=function(a,o){var c=o.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:R.PlaylistContextType.MANIFEST,url:c,deliveryDirectives:null})},u.onLevelLoading=function(a,o){var c=o.id,L=o.level,w=o.url,T=o.deliveryDirectives;this.load({id:c,groupId:null,level:L,responseType:"text",type:R.PlaylistContextType.LEVEL,url:w,deliveryDirectives:T})},u.onAudioTrackLoading=function(a,o){var c=o.id,L=o.groupId,w=o.url,T=o.deliveryDirectives;this.load({id:c,groupId:L,level:null,responseType:"text",type:R.PlaylistContextType.AUDIO_TRACK,url:w,deliveryDirectives:T})},u.onSubtitleTrackLoading=function(a,o){var c=o.id,L=o.groupId,w=o.url,T=o.deliveryDirectives;this.load({id:c,groupId:L,level:null,responseType:"text",type:R.PlaylistContextType.SUBTITLE_TRACK,url:w,deliveryDirectives:T})},u.load=function(a){var o,c=this.hls.config,L=this.getInternalLoader(a);if(L){var w=L.context;if(w&&w.url===a.url){K.logger.trace("[playlist-loader]: playlist request ongoing");return}K.logger.log("[playlist-loader]: aborting previous loader for type: "+a.type),L.abort()}var T,O,A,x;switch(a.type){case R.PlaylistContextType.MANIFEST:T=c.manifestLoadingMaxRetry,O=c.manifestLoadingTimeOut,A=c.manifestLoadingRetryDelay,x=c.manifestLoadingMaxRetryTimeout;break;case R.PlaylistContextType.LEVEL:case R.PlaylistContextType.AUDIO_TRACK:case R.PlaylistContextType.SUBTITLE_TRACK:T=0,O=c.levelLoadingTimeOut;break;default:T=c.levelLoadingMaxRetry,O=c.levelLoadingTimeOut,A=c.levelLoadingRetryDelay,x=c.levelLoadingMaxRetryTimeout;break}if(L=this.createInternalLoader(a),(o=a.deliveryDirectives)!==null&&o!==void 0&&o.part){var S;if(a.type===R.PlaylistContextType.LEVEL&&a.level!==null?S=this.hls.levels[a.level].details:a.type===R.PlaylistContextType.AUDIO_TRACK&&a.id!==null?S=this.hls.audioTracks[a.id].details:a.type===R.PlaylistContextType.SUBTITLE_TRACK&&a.id!==null&&(S=this.hls.subtitleTracks[a.id].details),S){var E=S.partTarget,d=S.targetduration;E&&d&&(O=Math.min(Math.max(E*3,d*.8)*1e3,O))}}var b={timeout:O,maxRetry:T,retryDelay:A,maxRetryDelay:x,highWaterMark:0},g={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};L.load(a,b,g)},u.loadsuccess=function(a,o,c,L){if(L===void 0&&(L=null),c.isSidxRequest){this.handleSidxRequest(a,c),this.handlePlaylistLoaded(a,o,c,L);return}this.resetInternalLoader(c.type);var w=a.data;if(w.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(a,c,"no EXTM3U delimiter",L);return}o.parsing.start=performance.now(),w.indexOf("#EXTINF:")>0||w.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(a,o,c,L):this.handleMasterPlaylist(a,o,c,L)},u.loaderror=function(a,o,c){c===void 0&&(c=null),this.handleNetworkError(o,c,!1,a)},u.loadtimeout=function(a,o,c){c===void 0&&(c=null),this.handleNetworkError(o,c,!0)},u.handleMasterPlaylist=function(a,o,c,L){var w=this.hls,T=a.data,O=f(a,c),A=P.default.parseMasterPlaylist(T,O),x=A.levels,S=A.sessionData;if(!x.length){this.handleManifestParsingError(a,c,"no level found in manifest",L);return}var E=x.map(function(D){return{id:D.attrs.AUDIO,audioCodec:D.audioCodec}}),d=x.map(function(D){return{id:D.attrs.SUBTITLES,textCodec:D.textCodec}}),b=P.default.parseMasterPlaylistMedia(T,O,"AUDIO",E),g=P.default.parseMasterPlaylistMedia(T,O,"SUBTITLES",d),_=P.default.parseMasterPlaylistMedia(T,O,"CLOSED-CAPTIONS");if(b.length){var F=b.some(function(D){return!D.url});!F&&x[0].audioCodec&&!x[0].attrs.AUDIO&&(K.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),b.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new m.AttrList({}),bitrate:0,url:""}))}w.trigger(B.Events.MANIFEST_LOADED,{levels:x,audioTracks:b,subtitles:g,captions:_,url:O,stats:o,networkDetails:L,sessionData:S})},u.handleTrackOrLevelPlaylist=function(a,o,c,L){var w=this.hls,T=c.id,O=c.level,A=c.type,x=f(a,c),S=Object(Q.isFiniteNumber)(T)?T:0,E=Object(Q.isFiniteNumber)(O)?O:S,d=p(c),b=P.default.parseLevelPlaylist(a.data,x,E,d,S);if(!b.fragments.length){w.trigger(B.Events.ERROR,{type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:x,reason:"no fragments found in level",level:typeof c.level=="number"?c.level:void 0});return}if(A===R.PlaylistContextType.MANIFEST){var g={attrs:new m.AttrList({}),bitrate:0,details:b,name:"",url:x};w.trigger(B.Events.MANIFEST_LOADED,{levels:[g],audioTracks:[],url:x,stats:o,networkDetails:L,sessionData:null})}if(o.parsing.end=performance.now(),b.needSidxRanges){var _,F=(_=b.fragments[0].initSegment)===null||_===void 0?void 0:_.url;this.load({url:F,isSidxRequest:!0,type:A,level:O,levelDetails:b,id:T,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}c.levelDetails=b,this.handlePlaylistLoaded(a,o,c,L)},u.handleSidxRequest=function(a,o){var c=Object(W.parseSegmentIndex)(new Uint8Array(a.data));if(!c)return;var L=c.references,w=o.levelDetails;L.forEach(function(T,O){var A=T.info,x=w.fragments[O];x.byteRange.length===0&&x.setByteRange(String(1+A.end-A.start)+"@"+String(A.start)),x.initSegment&&x.initSegment.setByteRange(String(c.moovEndOffset)+"@0")})},u.handleManifestParsingError=function(a,o,c,L){this.hls.trigger(B.Events.ERROR,{type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:o.type===R.PlaylistContextType.MANIFEST,url:a.url,reason:c,response:a,context:o,networkDetails:L})},u.handleNetworkError=function(a,o,c,L){c===void 0&&(c=!1),K.logger.warn("[playlist-loader]: A network "+(c?"timeout":"error")+" occurred while loading "+a.type+" level: "+a.level+" id: "+a.id+' group-id: "'+a.groupId+'"');var w=N.ErrorDetails.UNKNOWN,T=!1,O=this.getInternalLoader(a);switch(a.type){case R.PlaylistContextType.MANIFEST:w=c?N.ErrorDetails.MANIFEST_LOAD_TIMEOUT:N.ErrorDetails.MANIFEST_LOAD_ERROR,T=!0;break;case R.PlaylistContextType.LEVEL:w=c?N.ErrorDetails.LEVEL_LOAD_TIMEOUT:N.ErrorDetails.LEVEL_LOAD_ERROR,T=!1;break;case R.PlaylistContextType.AUDIO_TRACK:w=c?N.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:N.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,T=!1;break;case R.PlaylistContextType.SUBTITLE_TRACK:w=c?N.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:N.ErrorDetails.SUBTITLE_LOAD_ERROR,T=!1;break}O&&this.resetInternalLoader(a.type);var A={type:N.ErrorTypes.NETWORK_ERROR,details:w,fatal:T,url:a.url,loader:O,context:a,networkDetails:o};L&&(A.response=L),this.hls.trigger(B.Events.ERROR,A)},u.handlePlaylistLoaded=function(a,o,c,L){var w=c.type,T=c.level,O=c.id,A=c.groupId,x=c.loader,S=c.levelDetails,E=c.deliveryDirectives;if(!(S!=null&&S.targetduration)){this.handleManifestParsingError(a,c,"invalid target duration",L);return}if(!x)return;S.live&&(x.getCacheAge&&(S.ageHeader=x.getCacheAge()||0),(!x.getCacheAge||isNaN(S.ageHeader))&&(S.ageHeader=0));switch(w){case R.PlaylistContextType.MANIFEST:case R.PlaylistContextType.LEVEL:this.hls.trigger(B.Events.LEVEL_LOADED,{details:S,level:T||0,id:O||0,stats:o,networkDetails:L,deliveryDirectives:E});break;case R.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(B.Events.AUDIO_TRACK_LOADED,{details:S,id:O||0,groupId:A||"",stats:o,networkDetails:L,deliveryDirectives:E});break;case R.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(B.Events.SUBTITLE_TRACK_LOADED,{details:S,id:O||0,groupId:A||"",stats:o,networkDetails:L,deliveryDirectives:E});break}},s}();Z.default=h},"./src/polyfills/number.ts":function(ue,Z,M){"use strict";M.r(Z),M.d(Z,"isFiniteNumber",function(){return Q}),M.d(Z,"MAX_SAFE_INTEGER",function(){return B});var Q=Number.isFinite||function(N){return typeof N=="number"&&isFinite(N)},B=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(ue,Z,M){"use strict";M.r(Z);var Q=function(){function B(){}return B.getSilentFrame=function(K,W){switch(K){case"mp4a.40.2":if(W===1)return new Uint8Array([0,200,0,128,35,128]);if(W===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(W===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(W===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(W===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(W===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(W===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(W===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(W===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},B}();Z.default=Q},"./src/remux/mp4-generator.ts":function(ue,Z,M){"use strict";M.r(Z);var Q=Math.pow(2,32)-1,B=function(){function N(){}return N.init=function(){N.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var W;for(W in N.types)N.types.hasOwnProperty(W)&&(N.types[W]=[W.charCodeAt(0),W.charCodeAt(1),W.charCodeAt(2),W.charCodeAt(3)]);var P=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]),R=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);N.HDLR_TYPES={video:P,audio:R};var m=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),p=new Uint8Array([0,0,0,0,0,0,0,0]);N.STTS=N.STSC=N.STCO=p,N.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),N.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),N.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),N.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var f=new Uint8Array([105,115,111,109]),h=new Uint8Array([97,118,99,49]),s=new Uint8Array([0,0,0,1]);N.FTYP=N.box(N.types.ftyp,f,s,f,h),N.DINF=N.box(N.types.dinf,N.box(N.types.dref,m))},N.box=function(W){for(var P=8,R=arguments.length,m=new Array(R>1?R-1:0),p=1;p<R;p++)m[p-1]=arguments[p];for(var f=m.length,h=f;f--;)P+=m[f].byteLength;var s=new Uint8Array(P);for(s[0]=P>>24&255,s[1]=P>>16&255,s[2]=P>>8&255,s[3]=P&255,s.set(W,4),f=0,P=8;f<h;f++)s.set(m[f],P),P+=m[f].byteLength;return s},N.hdlr=function(W){return N.box(N.types.hdlr,N.HDLR_TYPES[W])},N.mdat=function(W){return N.box(N.types.mdat,W)},N.mdhd=function(W,P){P*=W;var R=Math.floor(P/(Q+1)),m=Math.floor(P%(Q+1));return N.box(N.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,W>>24&255,W>>16&255,W>>8&255,W&255,R>>24,R>>16&255,R>>8&255,R&255,m>>24,m>>16&255,m>>8&255,m&255,85,196,0,0]))},N.mdia=function(W){return N.box(N.types.mdia,N.mdhd(W.timescale,W.duration),N.hdlr(W.type),N.minf(W))},N.mfhd=function(W){return N.box(N.types.mfhd,new Uint8Array([0,0,0,0,W>>24,W>>16&255,W>>8&255,W&255]))},N.minf=function(W){return W.type==="audio"?N.box(N.types.minf,N.box(N.types.smhd,N.SMHD),N.DINF,N.stbl(W)):N.box(N.types.minf,N.box(N.types.vmhd,N.VMHD),N.DINF,N.stbl(W))},N.moof=function(W,P,R){return N.box(N.types.moof,N.mfhd(W),N.traf(R,P))},N.moov=function(W){for(var P=W.length,R=[];P--;)R[P]=N.trak(W[P]);return N.box.apply(null,[N.types.moov,N.mvhd(W[0].timescale,W[0].duration)].concat(R).concat(N.mvex(W)))},N.mvex=function(W){for(var P=W.length,R=[];P--;)R[P]=N.trex(W[P]);return N.box.apply(null,[N.types.mvex].concat(R))},N.mvhd=function(W,P){P*=W;var R=Math.floor(P/(Q+1)),m=Math.floor(P%(Q+1)),p=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,W>>24&255,W>>16&255,W>>8&255,W&255,R>>24,R>>16&255,R>>8&255,R&255,m>>24,m>>16&255,m>>8&255,m&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return N.box(N.types.mvhd,p)},N.sdtp=function(W){var P=W.samples||[],R=new Uint8Array(4+P.length),m,p;for(m=0;m<P.length;m++)p=P[m].flags,R[m+4]=p.dependsOn<<4|p.isDependedOn<<2|p.hasRedundancy;return N.box(N.types.sdtp,R)},N.stbl=function(W){return N.box(N.types.stbl,N.stsd(W),N.box(N.types.stts,N.STTS),N.box(N.types.stsc,N.STSC),N.box(N.types.stsz,N.STSZ),N.box(N.types.stco,N.STCO))},N.avc1=function(W){var P=[],R=[],m,p,f;for(m=0;m<W.sps.length;m++)p=W.sps[m],f=p.byteLength,P.push(f>>>8&255),P.push(f&255),P=P.concat(Array.prototype.slice.call(p));for(m=0;m<W.pps.length;m++)p=W.pps[m],f=p.byteLength,R.push(f>>>8&255),R.push(f&255),R=R.concat(Array.prototype.slice.call(p));var h=N.box(N.types.avcC,new Uint8Array([1,P[3],P[4],P[5],252|3,224|W.sps.length].concat(P).concat([W.pps.length]).concat(R))),s=W.width,u=W.height,l=W.pixelRatio[0],a=W.pixelRatio[1];return N.box(N.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,s>>8&255,s&255,u>>8&255,u&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]),h,N.box(N.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),N.box(N.types.pasp,new Uint8Array([l>>24,l>>16&255,l>>8&255,l&255,a>>24,a>>16&255,a>>8&255,a&255])))},N.esds=function(W){var P=W.config.length;return new Uint8Array([0,0,0,0,3,23+P,0,1,0,4,15+P,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([P]).concat(W.config).concat([6,1,2]))},N.mp4a=function(W){var P=W.samplerate;return N.box(N.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,W.channelCount,0,16,0,0,0,0,P>>8&255,P&255,0,0]),N.box(N.types.esds,N.esds(W)))},N.mp3=function(W){var P=W.samplerate;return N.box(N.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,W.channelCount,0,16,0,0,0,0,P>>8&255,P&255,0,0]))},N.stsd=function(W){return W.type==="audio"?!W.isAAC&&W.codec==="mp3"?N.box(N.types.stsd,N.STSD,N.mp3(W)):N.box(N.types.stsd,N.STSD,N.mp4a(W)):N.box(N.types.stsd,N.STSD,N.avc1(W))},N.tkhd=function(W){var P=W.id,R=W.duration*W.timescale,m=W.width,p=W.height,f=Math.floor(R/(Q+1)),h=Math.floor(R%(Q+1));return N.box(N.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,P>>24&255,P>>16&255,P>>8&255,P&255,0,0,0,0,f>>24,f>>16&255,f>>8&255,f&255,h>>24,h>>16&255,h>>8&255,h&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,m>>8&255,m&255,0,0,p>>8&255,p&255,0,0]))},N.traf=function(W,P){var R=N.sdtp(W),m=W.id,p=Math.floor(P/(Q+1)),f=Math.floor(P%(Q+1));return N.box(N.types.traf,N.box(N.types.tfhd,new Uint8Array([0,0,0,0,m>>24,m>>16&255,m>>8&255,m&255])),N.box(N.types.tfdt,new Uint8Array([1,0,0,0,p>>24,p>>16&255,p>>8&255,p&255,f>>24,f>>16&255,f>>8&255,f&255])),N.trun(W,R.length+16+20+8+16+8+8),R)},N.trak=function(W){return W.duration=W.duration||4294967295,N.box(N.types.trak,N.tkhd(W),N.mdia(W))},N.trex=function(W){var P=W.id;return N.box(N.types.trex,new Uint8Array([0,0,0,0,P>>24,P>>16&255,P>>8&255,P&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},N.trun=function(W,P){var R=W.samples||[],m=R.length,p=12+16*m,f=new Uint8Array(p),h,s,u,l,a,o;for(P+=8+p,f.set([0,0,15,1,m>>>24&255,m>>>16&255,m>>>8&255,m&255,P>>>24&255,P>>>16&255,P>>>8&255,P&255],0),h=0;h<m;h++)s=R[h],u=s.duration,l=s.size,a=s.flags,o=s.cts,f.set([u>>>24&255,u>>>16&255,u>>>8&255,u&255,l>>>24&255,l>>>16&255,l>>>8&255,l&255,a.isLeading<<2|a.dependsOn,a.isDependedOn<<6|a.hasRedundancy<<4|a.paddingValue<<1|a.isNonSync,a.degradPrio&240<<8,a.degradPrio&15,o>>>24&255,o>>>16&255,o>>>8&255,o&255],12+16*h);return N.box(N.types.trun,f)},N.initSegment=function(W){N.types||N.init();var P=N.moov(W),R=new Uint8Array(N.FTYP.byteLength+P.byteLength);return R.set(N.FTYP),R.set(P,N.FTYP.byteLength),R},N}();B.types=void 0,B.HDLR_TYPES=void 0,B.STTS=void 0,B.STSC=void 0,B.STCO=void 0,B.STSZ=void 0,B.VMHD=void 0,B.SMHD=void 0,B.STSD=void 0,B.FTYP=void 0,B.DINF=void 0,Z.default=B},"./src/remux/mp4-remuxer.ts":function(ue,Z,M){"use strict";M.r(Z),M.d(Z,"default",function(){return o}),M.d(Z,"normalizePts",function(){return c});var Q=M("./src/polyfills/number.ts"),B=M("./src/remux/aac-helper.ts"),N=M("./src/remux/mp4-generator.ts"),K=M("./src/events.ts"),W=M("./src/errors.ts"),P=M("./src/utils/logger.ts"),R=M("./src/types/loader.ts"),m=M("./src/utils/timescale-conversion.ts");function p(){return p=Object.assign||function(O){for(var A=1;A<arguments.length;A++){var x=arguments[A];for(var S in x)Object.prototype.hasOwnProperty.call(x,S)&&(O[S]=x[S])}return O},p.apply(this,arguments)}var f=10*1e3,h=1024,s=1152,u=null,l=null,a=!1,o=function(){function O(x,S,E,d){if(d===void 0&&(d=""),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=x,this.config=S,this.typeSupported=E,this.ISGenerated=!1,u===null){var b=navigator.userAgent||"",g=b.match(/Chrome\/(\d+)/i);u=g?parseInt(g[1]):0}if(l===null){var _=navigator.userAgent.match(/Safari\/(\d+)/i);l=_?parseInt(_[1]):0}a=!!u&&u<75||!!l&&l<600}var A=O.prototype;return A.destroy=function(){},A.resetTimeStamp=function(S){P.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=S},A.resetNextTimestamp=function(){P.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},A.resetInitSegment=function(){P.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},A.getVideoStartPts=function(S){var E=!1,d=S.reduce(function(b,g){var _=g.pts-b;return _<-4294967296?(E=!0,c(b,g.pts)):_>0?b:g.pts},S[0].pts);return E&&P.logger.debug("PTS rollover detected"),d},A.remux=function(S,E,d,b,g,_,F,D){var j,H,k,y,G,Y,ie=g,se=g,we=S.pid>-1,ve=E.pid>-1,Se=E.samples.length,Ce=S.samples.length>0,pe=Se>1,fe=(!we||Ce)&&(!ve||pe)||this.ISGenerated||F;if(fe){this.ISGenerated||(k=this.generateIS(S,E,g));var oe=this.isVideoContiguous,te=-1;if(pe&&(te=L(E.samples),!oe&&this.config.forceKeyFrameOnDiscontinuity))if(Y=!0,te>0){P.logger.warn("[mp4-remuxer]: Dropped "+te+" out of "+Se+" video samples due to a missing keyframe");var he=this.getVideoStartPts(E.samples);E.samples=E.samples.slice(te),E.dropped+=te,se+=(E.samples[0].pts-he)/(E.timescale||9e4)}else te===-1&&(P.logger.warn("[mp4-remuxer]: No keyframe found out of "+Se+" video samples"),Y=!1);if(this.ISGenerated){if(Ce&&pe){var ae=this.getVideoStartPts(E.samples),Ae=c(S.samples[0].pts,ae)-ae,ke=Ae/E.inputTimeScale;ie+=Math.max(0,ke),se+=Math.max(0,-ke)}if(Ce){if(S.samplerate||(P.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),k=this.generateIS(S,E,g)),H=this.remuxAudio(S,ie,this.isAudioContiguous,_,ve||pe||D===R.PlaylistLevelType.AUDIO?se:void 0),pe){var Te=H?H.endPTS-H.startPTS:0;E.inputTimeScale||(P.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),k=this.generateIS(S,E,g)),j=this.remuxVideo(E,se,oe,Te)}}else pe&&(j=this.remuxVideo(E,se,oe,0));j&&(j.firstKeyFrame=te,j.independent=te!==-1)}}return this.ISGenerated&&(d.samples.length&&(G=this.remuxID3(d,g)),b.samples.length&&(y=this.remuxText(b,g))),{audio:H,video:j,initSegment:k,independent:Y,text:y,id3:G}},A.generateIS=function(S,E,d){var b=S.samples,g=E.samples,_=this.typeSupported,F={},D=!Object(Q.isFiniteNumber)(this._initPTS),j="audio/mp4",H,k,y;if(D&&(H=k=Infinity),S.config&&b.length&&(S.timescale=S.samplerate,S.isAAC||(_.mpeg?(j="audio/mpeg",S.codec=""):_.mp3&&(S.codec="mp3")),F.audio={id:"audio",container:j,codec:S.codec,initSegment:!S.isAAC&&_.mpeg?new Uint8Array(0):N.default.initSegment([S]),metadata:{channelCount:S.channelCount}},D&&(y=S.inputTimeScale,H=k=b[0].pts-Math.round(y*d))),E.sps&&E.pps&&g.length&&(E.timescale=E.inputTimeScale,F.video={id:"main",container:"video/mp4",codec:E.codec,initSegment:N.default.initSegment([E]),metadata:{width:E.width,height:E.height}},D)){y=E.inputTimeScale;var G=this.getVideoStartPts(g),Y=Math.round(y*d);k=Math.min(k,c(g[0].dts,G)-Y),H=Math.min(H,G-Y)}if(Object.keys(F).length)return this.ISGenerated=!0,D&&(this._initPTS=H,this._initDTS=k),{tracks:F,initPTS:H,timescale:y}},A.remuxVideo=function(S,E,d,b){var g=S.inputTimeScale,_=S.samples,F=[],D=_.length,j=this._initPTS,H=this.nextAvcDts,k=8,y,G,Y,ie=Number.POSITIVE_INFINITY,se=Number.NEGATIVE_INFINITY,we=0,ve=!1;if(!d||H===null){var Se=E*g,Ce=_[0].pts-c(_[0].dts,_[0].pts);H=Se-Ce}for(var pe=0;pe<D;pe++){var fe=_[pe];if(fe.pts=c(fe.pts-j,H),fe.dts=c(fe.dts-j,H),fe.dts>fe.pts){var oe=9e4*.2;we=Math.max(Math.min(we,fe.pts-fe.dts),-1*oe)}fe.dts<_[pe>0?pe-1:pe].dts&&(ve=!0)}ve&&_.sort(function(At,wt){var dt=At.dts-wt.dts,Ut=At.pts-wt.pts;return dt||Ut}),G=_[0].dts,Y=_[_.length-1].dts;var te=Math.round((Y-G)/(D-1));if(we<0){if(we<te*-2){P.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(m.toMsFromMpegTsClock)(-te,!0)+" ms");for(var he=we,ae=0;ae<D;ae++)_[ae].dts=he=Math.max(he,_[ae].pts-te),_[ae].pts=Math.max(he,_[ae].pts)}else{P.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(m.toMsFromMpegTsClock)(we,!0)+" ms to overcome this issue");for(var Ae=0;Ae<D;Ae++)_[Ae].dts=_[Ae].dts+we}G=_[0].dts}if(d){var ke=G-H,Te=ke>te,Le=ke<-1;if(Te||Le){Te?P.logger.warn("AVC: "+Object(m.toMsFromMpegTsClock)(ke,!0)+" ms ("+ke+"dts) hole between fragments detected, filling it"):P.logger.warn("AVC: "+Object(m.toMsFromMpegTsClock)(-ke,!0)+" ms ("+ke+"dts) overlapping between fragments detected"),G=H;var Pe=_[0].pts-ke;_[0].dts=G,_[0].pts=Pe,P.logger.log("Video: First PTS/DTS adjusted: "+Object(m.toMsFromMpegTsClock)(Pe,!0)+"/"+Object(m.toMsFromMpegTsClock)(G,!0)+", delta: "+Object(m.toMsFromMpegTsClock)(ke,!0)+" ms")}}a&&(G=Math.max(0,G));for(var He=0,Fe=0,Ue=0;Ue<D;Ue++){for(var Ne=_[Ue],Ze=Ne.units,st=Ze.length,tt=0,et=0;et<st;et++)tt+=Ze[et].data.length;Fe+=tt,He+=st,Ne.length=tt,Ne.dts=Math.max(Ne.dts,G),Ne.pts=Math.max(Ne.pts,Ne.dts,0),ie=Math.min(Ne.pts,ie),se=Math.max(Ne.pts,se)}Y=_[D-1].dts;var ut=Fe+4*He+8,Ye;try{Ye=new Uint8Array(ut)}catch(At){this.observer.emit(K.Events.ERROR,K.Events.ERROR,{type:W.ErrorTypes.MUX_ERROR,details:W.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:ut,reason:"fail allocating video mdat "+ut});return}var Xe=new DataView(Ye.buffer);Xe.setUint32(0,ut),Ye.set(N.default.types.mdat,4);for(var Ie=0;Ie<D;Ie++){for(var lt=_[Ie],nt=lt.units,De=0,ze=0,xe=nt.length;ze<xe;ze++){var ye=nt[ze],_e=ye.data,ne=ye.data.byteLength;Xe.setUint32(k,ne),k+=4,Ye.set(_e,k),k+=ne,De+=4+ne}if(Ie<D-1)y=_[Ie+1].dts-lt.dts;else{var re=this.config,de=lt.dts-_[Ie>0?Ie-1:Ie].dts;if(re.stretchShortVideoTrack&&this.nextAudioPts!==null){var me=Math.floor(re.maxBufferHole*g),Ee=(b?ie+b*g:this.nextAudioPts)-lt.pts;Ee>me?(y=Ee-de,y<0&&(y=de),P.logger.log("[mp4-remuxer]: It is approximately "+Ee/90+" ms to the next segment; using duration "+y/90+" ms for the last video frame.")):y=de}else y=de}var Me=Math.round(lt.pts-lt.dts);F.push(new w(lt.key,y,De,Me))}if(F.length&&u&&u<70){var je=F[0].flags;je.dependsOn=2,je.isNonSync=0}console.assert(y!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=H=Y+y,this.isVideoContiguous=!0;var it=N.default.moof(S.sequenceNumber++,G,p({},S,{samples:F})),ft="video",ct={data1:it,data2:Ye,startPTS:ie/g,endPTS:(se+y)/g,startDTS:G/g,endDTS:H/g,type:ft,hasAudio:!1,hasVideo:!0,nb:F.length,dropped:S.dropped};return S.samples=[],S.dropped=0,console.assert(Ye.length,"MDAT length must not be zero"),ct},A.remuxAudio=function(S,E,d,b,g){var _=S.inputTimeScale,F=S.samplerate?S.samplerate:_,D=_/F,j=S.isAAC?h:s,H=j*D,k=this._initPTS,y=!S.isAAC&&this.typeSupported.mpeg,G=[],Y=S.samples,ie=y?0:8,se=this.nextAudioPts||-1,we=E*_;if(this.isAudioContiguous=d=d||Y.length&&se>0&&(b&&Math.abs(we-se)<9e3||Math.abs(c(Y[0].pts-k,we)-se)<20*H),Y.forEach(function(_e){_e.pts=c(_e.pts-k,we)}),!d||se<0){if(Y=Y.filter(function(_e){return _e.pts>=0}),!Y.length)return;g===0?se=0:b?se=Math.max(0,we):se=Y[0].pts}if(S.isAAC)for(var ve=g!==void 0,Se=this.config.maxAudioFramesDrift,Ce=0,pe=se;Ce<Y.length;Ce++){var fe=Y[Ce],oe=fe.pts,te=oe-pe,he=Math.abs(1e3*te/_);if(te<=-Se*H&&ve)Ce===0&&(P.logger.warn("Audio frame @ "+(oe/_).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*te/_)+" ms."),this.nextAudioPts=se=pe=oe);else if(te>=Se*H&&he<f&&ve){var ae=Math.round(te/H);pe=oe-ae*H,pe<0&&(ae--,pe+=H),Ce===0&&(this.nextAudioPts=se=pe),P.logger.warn("[mp4-remuxer]: Injecting "+ae+" audio frame @ "+(pe/_).toFixed(3)+"s due to "+Math.round(1e3*te/_)+" ms gap.");for(var Ae=0;Ae<ae;Ae++){var ke=Math.max(pe,0),Te=B.default.getSilentFrame(S.manifestCodec||S.codec,S.channelCount);Te||(P.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),Te=fe.unit.subarray()),Y.splice(Ce,0,{unit:Te,pts:ke}),pe+=H,Ce++}}fe.pts=pe,pe+=H}for(var Le=null,Pe=null,He,Fe=0,Ue=Y.length;Ue--;)Fe+=Y[Ue].unit.byteLength;for(var Ne=0,Ze=Y.length;Ne<Ze;Ne++){var st=Y[Ne],tt=st.unit,et=st.pts;if(Pe!==null){var ut=G[Ne-1];ut.duration=Math.round((et-Pe)/D)}else if(d&&S.isAAC&&(et=se),Le=et,Fe>0){Fe+=ie;try{He=new Uint8Array(Fe)}catch(_e){this.observer.emit(K.Events.ERROR,K.Events.ERROR,{type:W.ErrorTypes.MUX_ERROR,details:W.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Fe,reason:"fail allocating audio mdat "+Fe});return}if(!y){var Ye=new DataView(He.buffer);Ye.setUint32(0,Fe),He.set(N.default.types.mdat,4)}}else return;He.set(tt,ie);var Xe=tt.byteLength;ie+=Xe,G.push(new w(!0,j,Xe,0)),Pe=et}var Ie=G.length;if(!Ie)return;var lt=G[G.length-1];this.nextAudioPts=se=Pe+D*lt.duration;var nt=y?new Uint8Array(0):N.default.moof(S.sequenceNumber++,Le/D,p({},S,{samples:G}));S.samples=[];var De=Le/_,ze=se/_,xe="audio",ye={data1:nt,data2:He,startPTS:De,endPTS:ze,startDTS:De,endDTS:ze,type:xe,hasAudio:!0,hasVideo:!1,nb:Ie};return this.isAudioContiguous=!0,console.assert(He.length,"MDAT length must not be zero"),ye},A.remuxEmptyAudio=function(S,E,d,b){var g=S.inputTimeScale,_=S.samplerate?S.samplerate:g,F=g/_,D=this.nextAudioPts,j=(D!==null?D:b.startDTS*g)+this._initDTS,H=b.endDTS*g+this._initDTS,k=F*h,y=Math.ceil((H-j)/k),G=B.default.getSilentFrame(S.manifestCodec||S.codec,S.channelCount);if(P.logger.warn("[mp4-remuxer]: remux empty Audio"),!G){P.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var Y=[],ie=0;ie<y;ie++){var se=j+ie*k;Y.push({unit:G,pts:se,dts:se})}return S.samples=Y,this.remuxAudio(S,E,d,!1)},A.remuxID3=function(S,E){var d=S.samples.length;if(!d)return;for(var b=S.inputTimeScale,g=this._initPTS,_=this._initDTS,F=0;F<d;F++){var D=S.samples[F];D.pts=c(D.pts-g,E*b)/b,D.dts=c(D.dts-_,E*b)/b}var j=S.samples;return S.samples=[],{samples:j}},A.remuxText=function(S,E){var d=S.samples.length;if(!d)return;for(var b=S.inputTimeScale,g=this._initPTS,_=0;_<d;_++){var F=S.samples[_];F.pts=c(F.pts-g,E*b)/b}S.samples.sort(function(j,H){return j.pts-H.pts});var D=S.samples;return S.samples=[],{samples:D}},O}();function c(O,A){var x;if(A===null)return O;for(A<O?x=-8589934592:x=8589934592;Math.abs(O-A)>4294967296;)O+=x;return O}function L(O){for(var A=0;A<O.length;A++)if(O[A].key)return A;return-1}var w=function(A,x,S,E){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=x,this.size=S,this.cts=E,this.flags=new T(A)},T=function(A){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=A?2:1,this.isNonSync=A?0:1}},"./src/remux/passthrough-remuxer.ts":function(ue,Z,M){"use strict";M.r(Z);var Q=M("./src/polyfills/number.ts"),B=M("./src/utils/mp4-tools.ts"),N=M("./src/loader/fragment.ts"),K=M("./src/utils/logger.ts"),W=function(){function m(){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 p=m.prototype;return p.destroy=function(){},p.resetTimeStamp=function(h){this.initPTS=h,this.lastEndDTS=null},p.resetNextTimestamp=function(){this.lastEndDTS=null},p.resetInitSegment=function(h,s,u){this.audioCodec=s,this.videoCodec=u,this.generateInitSegment(h),this.emitInitSegment=!0},p.generateInitSegment=function(h){var s=this.audioCodec,u=this.videoCodec;if(!h||!h.byteLength){this.initTracks=void 0,this.initData=void 0;return}var l=this.initData=Object(B.parseInitSegment)(h);s||(s=R(l.audio,N.ElementaryStreamTypes.AUDIO)),u||(u=R(l.video,N.ElementaryStreamTypes.VIDEO));var a={};l.audio&&l.video?a.audiovideo={container:"video/mp4",codec:s+","+u,initSegment:h,id:"main"}:l.audio?a.audio={container:"audio/mp4",codec:s,initSegment:h,id:"audio"}:l.video?a.video={container:"video/mp4",codec:u,initSegment:h,id:"main"}:K.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=a},p.remux=function(h,s,u,l,a){var o=this.initPTS,c=this.lastEndDTS,L={audio:void 0,video:void 0,text:l,id3:u,initSegment:void 0};Object(Q.isFiniteNumber)(c)||(c=this.lastEndDTS=a||0);var w=s.samples;if(!w||!w.length)return L;var T={initPTS:void 0,timescale:1},O=this.initData;if((!O||!O.length)&&(this.generateInitSegment(w),O=this.initData),!O||!O.length)return K.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),L;this.emitInitSegment&&(T.tracks=this.initTracks,this.emitInitSegment=!1),Object(Q.isFiniteNumber)(o)||(this.initPTS=T.initPTS=o=P(O,w,c));var A=Object(B.getDuration)(w,O),x=c,S=A+x;Object(B.offsetStartDTS)(O,w,o),A>0?this.lastEndDTS=S:(K.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var E=!!O.audio,d=!!O.video,b="";E&&(b+="audio"),d&&(b+="video");var g={data1:w,startPTS:x,startDTS:x,endPTS:S,endDTS:S,type:b,hasAudio:E,hasVideo:d,nb:1,dropped:0};return L.audio=g.type==="audio"?g:void 0,L.video=g.type!=="audio"?g:void 0,L.text=l,L.id3=u,L.initSegment=T,L},m}(),P=function(p,f,h){return Object(B.getStartDTS)(p,f)-h};function R(m,p){var f=m==null?void 0:m.codec;return f&&f.length>4?f:f==="hvc1"?"hvc1.1.c.L120.90":f==="av01"?"av01.0.04M.08":f==="avc1"||p===N.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}Z.default=W},"./src/task-loop.ts":function(ue,Z,M){"use strict";M.r(Z),M.d(Z,"default",function(){return Q});var Q=function(){function B(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var N=B.prototype;return N.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},N.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},N.onHandlerDestroyed=function(){},N.hasInterval=function(){return!!this._tickInterval},N.hasNextTick=function(){return!!this._tickTimer},N.setInterval=function(W){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,W),!0)},N.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},N.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},N.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},N.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},N.doTick=function(){},B}()},"./src/types/cmcd.ts":function(ue,Z,M){"use strict";M.r(Z),M.d(Z,"CMCDVersion",function(){return Q}),M.d(Z,"CMCDObjectType",function(){return B}),M.d(Z,"CMCDStreamingFormat",function(){return N}),M.d(Z,"CMCDStreamType",function(){return K});var Q=1,B;(function(W){W.MANIFEST="m",W.AUDIO="a",W.VIDEO="v",W.MUXED="av",W.INIT="i",W.CAPTION="c",W.TIMED_TEXT="tt",W.KEY="k",W.OTHER="o"})(B||(B={}));var N;(function(W){W.DASH="d",W.HLS="h",W.SMOOTH="s",W.OTHER="o"})(N||(N={}));var K;(function(W){W.VOD="v",W.LIVE="l"})(K||(K={}))},"./src/types/level.ts":function(ue,Z,M){"use strict";M.r(Z),M.d(Z,"HlsSkip",function(){return N}),M.d(Z,"getSkipValue",function(){return K}),M.d(Z,"HlsUrlParameters",function(){return W}),M.d(Z,"Level",function(){return P});function Q(R,m){for(var p=0;p<m.length;p++){var f=m[p];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(R,f.key,f)}}function B(R,m,p){return m&&Q(R.prototype,m),p&&Q(R,p),R}var N;(function(R){R.No="",R.Yes="YES",R.v2="v2"})(N||(N={}));function K(R,m){var p=R.canSkipUntil,f=R.canSkipDateRanges,h=R.endSN,s=m!==void 0?m-h:0;return p&&s<p?f?N.v2:N.Yes:N.No}var W=function(){function R(p,f,h){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=p,this.part=f,this.skip=h}var m=R.prototype;return m.addDirectives=function(f){var h=new self.URL(f);return this.msn!==void 0&&h.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&h.searchParams.set("_HLS_part",this.part.toString()),this.skip&&h.searchParams.set("_HLS_skip",this.skip),h.toString()},R}(),P=function(){function R(m){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=[m.url],this.attrs=m.attrs,this.bitrate=m.bitrate,m.details&&(this.details=m.details),this.id=m.id||0,this.name=m.name,this.width=m.width||0,this.height=m.height||0,this.audioCodec=m.audioCodec,this.videoCodec=m.videoCodec,this.unknownCodecs=m.unknownCodecs,this.codecSet=[m.videoCodec,m.audioCodec].filter(function(p){return p}).join(",").replace(/\.[^.,]+/g,"")}return B(R,[{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(p){var f=p%this.url.length;this._urlId!==f&&(this.details=void 0,this._urlId=f)}}]),R}()},"./src/types/loader.ts":function(ue,Z,M){"use strict";M.r(Z),M.d(Z,"PlaylistContextType",function(){return Q}),M.d(Z,"PlaylistLevelType",function(){return B});var Q;(function(N){N.MANIFEST="manifest",N.LEVEL="level",N.AUDIO_TRACK="audioTrack",N.SUBTITLE_TRACK="subtitleTrack"})(Q||(Q={}));var B;(function(N){N.MAIN="main",N.AUDIO="audio",N.SUBTITLE="subtitle"})(B||(B={}))},"./src/types/transmuxer.ts":function(ue,Z,M){"use strict";M.r(Z),M.d(Z,"ChunkMetadata",function(){return Q});var Q=function(K,W,P,R,m,p){R===void 0&&(R=0),m===void 0&&(m=-1),p===void 0&&(p=!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=B(),this.buffering={audio:B(),video:B(),audiovideo:B()},this.level=K,this.sn=W,this.id=P,this.size=R,this.part=m,this.partial=p};function B(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(ue,Z,M){"use strict";M.r(Z),M.d(Z,"AttrList",function(){return N});var Q=/^(\d+)x(\d+)$/,B=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,N=function(){function K(P){typeof P=="string"&&(P=K.parseAttrList(P));for(var R in P)P.hasOwnProperty(R)&&(this[R]=P[R])}var W=K.prototype;return W.decimalInteger=function(R){var m=parseInt(this[R],10);return m>Number.MAX_SAFE_INTEGER?Infinity:m},W.hexadecimalInteger=function(R){if(this[R]){var m=(this[R]||"0x").slice(2);m=(m.length&1?"0":"")+m;for(var p=new Uint8Array(m.length/2),f=0;f<m.length/2;f++)p[f]=parseInt(m.slice(f*2,f*2+2),16);return p}else return null},W.hexadecimalIntegerAsNumber=function(R){var m=parseInt(this[R],16);return m>Number.MAX_SAFE_INTEGER?Infinity:m},W.decimalFloatingPoint=function(R){return parseFloat(this[R])},W.optionalFloat=function(R,m){var p=this[R];return p?parseFloat(p):m},W.enumeratedString=function(R){return this[R]},W.bool=function(R){return this[R]==="YES"},W.decimalResolution=function(R){var m=Q.exec(this[R]);return m===null?void 0:{width:parseInt(m[1],10),height:parseInt(m[2],10)}},K.parseAttrList=function(R){var m,p={},f='"';for(B.lastIndex=0;(m=B.exec(R))!==null;){var h=m[2];h.indexOf(f)===0&&h.lastIndexOf(f)===h.length-1&&(h=h.slice(1,-1)),p[m[1]]=h}return p},K}()},"./src/utils/binary-search.ts":function(ue,Z,M){"use strict";M.r(Z);var Q={search:function(N,K){for(var W=0,P=N.length-1,R=null,m=null;W<=P;){R=(W+P)/2|0,m=N[R];var p=K(m);if(p>0)W=R+1;else if(p<0)P=R-1;else return m}return null}};Z.default=Q},"./src/utils/buffer-helper.ts":function(ue,Z,M){"use strict";M.r(Z),M.d(Z,"BufferHelper",function(){return N});var Q=M("./src/utils/logger.ts"),B={length:0,start:function(){return 0},end:function(){return 0}},N=function(){function K(){}return K.isBuffered=function(P,R){try{if(P){for(var m=K.getBuffered(P),p=0;p<m.length;p++)if(R>=m.start(p)&&R<=m.end(p))return!0}}catch(f){}return!1},K.bufferInfo=function(P,R,m){try{if(P){var p=K.getBuffered(P),f=[],h;for(h=0;h<p.length;h++)f.push({start:p.start(h),end:p.end(h)});return this.bufferedInfo(f,R,m)}}catch(s){}return{len:0,start:R,end:R,nextStart:void 0}},K.bufferedInfo=function(P,R,m){R=Math.max(0,R),P.sort(function(T,O){var A=T.start-O.start;return A||O.end-T.end});var p=[];if(m)for(var f=0;f<P.length;f++){var h=p.length;if(h){var s=p[h-1].end;P[f].start-s<m?P[f].end>s&&(p[h-1].end=P[f].end):p.push(P[f])}else p.push(P[f])}else p=P;for(var u=0,l,a=R,o=R,c=0;c<p.length;c++){var L=p[c].start,w=p[c].end;if(R+m>=L&&R<w)a=L,o=w,u=o-R;else if(R+m<L){l=L;break}}return{len:u,start:a||0,end:o||0,nextStart:l}},K.getBuffered=function(P){try{return P.buffered}catch(R){return Q.logger.log("failed to get media.buffered",R),B}},K}()},"./src/utils/cea-608-parser.ts":function(ue,Z,M){"use strict";M.r(Z),M.d(Z,"Row",function(){return o}),M.d(Z,"CaptionScreen",function(){return c});var Q=M("./src/utils/logger.ts"),B={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},N=function(S){var E=S;return B.hasOwnProperty(S)&&(E=B[S]),String.fromCharCode(E)},K=15,W=100,P={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},R={17:2,18:4,21:6,22:8,23:10,19:13,20:15},m={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},p={25:2,26:4,29:6,30:8,31:10,27:13,28:15},f=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],h;(function(x){x[x.ERROR=0]="ERROR",x[x.TEXT=1]="TEXT",x[x.WARNING=2]="WARNING",x[x.INFO=2]="INFO",x[x.DEBUG=3]="DEBUG",x[x.DATA=3]="DATA"})(h||(h={}));var s=function(){function x(){this.time=null,this.verboseLevel=h.ERROR}var S=x.prototype;return S.log=function(d,b){this.verboseLevel>=d&&Q.logger.log(this.time+" ["+d+"] "+b)},x}(),u=function(S){for(var E=[],d=0;d<S.length;d++)E.push(S[d].toString(16));return E},l=function(){function x(E,d,b,g,_){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=E||"white",this.underline=d||!1,this.italics=b||!1,this.background=g||"black",this.flash=_||!1}var S=x.prototype;return S.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},S.setStyles=function(d){for(var b=["foreground","underline","italics","background","flash"],g=0;g<b.length;g++){var _=b[g];d.hasOwnProperty(_)&&(this[_]=d[_])}},S.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},S.equals=function(d){return this.foreground===d.foreground&&this.underline===d.underline&&this.italics===d.italics&&this.background===d.background&&this.flash===d.flash},S.copy=function(d){this.foreground=d.foreground,this.underline=d.underline,this.italics=d.italics,this.background=d.background,this.flash=d.flash},S.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},x}(),a=function(){function x(E,d,b,g,_,F){this.uchar=void 0,this.penState=void 0,this.uchar=E||" ",this.penState=new l(d,b,g,_,F)}var S=x.prototype;return S.reset=function(){this.uchar=" ",this.penState.reset()},S.setChar=function(d,b){this.uchar=d,this.penState.copy(b)},S.setPenState=function(d){this.penState.copy(d)},S.equals=function(d){return this.uchar===d.uchar&&this.penState.equals(d.penState)},S.copy=function(d){this.uchar=d.uchar,this.penState.copy(d.penState)},S.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},x}(),o=function(){function x(E){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var d=0;d<W;d++)this.chars.push(new a);this.logger=E,this.pos=0,this.currPenState=new l}var S=x.prototype;return S.equals=function(d){for(var b=!0,g=0;g<W;g++)if(!this.chars[g].equals(d.chars[g])){b=!1;break}return b},S.copy=function(d){for(var b=0;b<W;b++)this.chars[b].copy(d.chars[b])},S.isEmpty=function(){for(var d=!0,b=0;b<W;b++)if(!this.chars[b].isEmpty()){d=!1;break}return d},S.setCursor=function(d){this.pos!==d&&(this.pos=d),this.pos<0?(this.logger.log(h.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>W&&(this.logger.log(h.DEBUG,"Too large cursor position "+this.pos),this.pos=W)},S.moveCursor=function(d){var b=this.pos+d;if(d>1)for(var g=this.pos+1;g<b+1;g++)this.chars[g].setPenState(this.currPenState);this.setCursor(b)},S.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},S.insertChar=function(d){d>=144&&this.backSpace();var b=N(d);if(this.pos>=W){this.logger.log(h.ERROR,"Cannot insert "+d.toString(16)+" ("+b+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(b,this.currPenState),this.moveCursor(1)},S.clearFromPos=function(d){var b;for(b=d;b<W;b++)this.chars[b].reset()},S.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},S.clearToEndOfRow=function(){this.clearFromPos(this.pos)},S.getTextString=function(){for(var d=[],b=!0,g=0;g<W;g++){var _=this.chars[g].uchar;_!==" "&&(b=!1),d.push(_)}return b?"":d.join("")},S.setPenStyles=function(d){this.currPenState.setStyles(d);var b=this.chars[this.pos];b.setPenState(this.currPenState)},x}(),c=function(){function x(E){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var d=0;d<K;d++)this.rows.push(new o(E));this.logger=E,this.currRow=K-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var S=x.prototype;return S.reset=function(){for(var d=0;d<K;d++)this.rows[d].clear();this.currRow=K-1},S.equals=function(d){for(var b=!0,g=0;g<K;g++)if(!this.rows[g].equals(d.rows[g])){b=!1;break}return b},S.copy=function(d){for(var b=0;b<K;b++)this.rows[b].copy(d.rows[b])},S.isEmpty=function(){for(var d=!0,b=0;b<K;b++)if(!this.rows[b].isEmpty()){d=!1;break}return d},S.backSpace=function(){var d=this.rows[this.currRow];d.backSpace()},S.clearToEndOfRow=function(){var d=this.rows[this.currRow];d.clearToEndOfRow()},S.insertChar=function(d){var b=this.rows[this.currRow];b.insertChar(d)},S.setPen=function(d){var b=this.rows[this.currRow];b.setPenStyles(d)},S.moveCursor=function(d){var b=this.rows[this.currRow];b.moveCursor(d)},S.setCursor=function(d){this.logger.log(h.INFO,"setCursor: "+d);var b=this.rows[this.currRow];b.setCursor(d)},S.setPAC=function(d){this.logger.log(h.INFO,"pacData = "+JSON.stringify(d));var b=d.row-1;if(this.nrRollUpRows&&b<this.nrRollUpRows-1&&(b=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==b){for(var g=0;g<K;g++)this.rows[g].clear();var _=this.currRow+1-this.nrRollUpRows,F=this.lastOutputScreen;if(F){var D=F.rows[_].cueStartTime,j=this.logger.time;if(D&&j!==null&&D<j)for(var H=0;H<this.nrRollUpRows;H++)this.rows[b-this.nrRollUpRows+H+1].copy(F.rows[_+H])}}this.currRow=b;var k=this.rows[this.currRow];if(d.indent!==null){var y=d.indent,G=Math.max(y-1,0);k.setCursor(d.indent),d.color=k.chars[G].penState.foreground}var Y={foreground:d.color,underline:d.underline,italics:d.italics,background:"black",flash:!1};this.setPen(Y)},S.setBkgData=function(d){this.logger.log(h.INFO,"bkgData = "+JSON.stringify(d)),this.backSpace(),this.setPen(d),this.insertChar(32)},S.setRollUpRows=function(d){this.nrRollUpRows=d},S.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(h.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(h.TEXT,this.getDisplayText());var d=this.currRow+1-this.nrRollUpRows,b=this.rows.splice(d,1)[0];b.clear(),this.rows.splice(this.currRow,0,b),this.logger.log(h.INFO,"Rolling up")},S.getDisplayText=function(d){d=d||!1;for(var b=[],g="",_=-1,F=0;F<K;F++){var D=this.rows[F].getTextString();D&&(_=F+1,d?b.push("Row "+_+": '"+D+"'"):b.push(D.trim()))}return b.length>0&&(d?g="["+b.join(" | ")+"]":g=b.join(`
`)),g},S.getTextAndFormat=function(){return this.rows},x}(),L=function(){function x(E,d,b){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=E,this.outputFilter=d,this.mode=null,this.verbose=0,this.displayedMemory=new c(b),this.nonDisplayedMemory=new c(b),this.lastOutputScreen=new c(b),this.currRollUpRow=this.displayedMemory.rows[K-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=b}var S=x.prototype;return S.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[K-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},S.getHandler=function(){return this.outputFilter},S.setHandler=function(d){this.outputFilter=d},S.setPAC=function(d){this.writeScreen.setPAC(d)},S.setBkgData=function(d){this.writeScreen.setBkgData(d)},S.setMode=function(d){if(d===this.mode)return;this.mode=d,this.logger.log(h.INFO,"MODE="+d),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=d},S.insertChars=function(d){for(var b=0;b<d.length;b++)this.writeScreen.insertChar(d[b]);var g=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(h.INFO,g+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(h.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},S.ccRCL=function(){this.logger.log(h.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},S.ccBS=function(){if(this.logger.log(h.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},S.ccAOF=function(){},S.ccAON=function(){},S.ccDER=function(){this.logger.log(h.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},S.ccRU=function(d){this.logger.log(h.INFO,"RU("+d+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(d)},S.ccFON=function(){this.logger.log(h.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},S.ccRDC=function(){this.logger.log(h.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},S.ccTR=function(){this.logger.log(h.INFO,"TR"),this.setMode("MODE_TEXT")},S.ccRTD=function(){this.logger.log(h.INFO,"RTD"),this.setMode("MODE_TEXT")},S.ccEDM=function(){this.logger.log(h.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},S.ccCR=function(){this.logger.log(h.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},S.ccENM=function(){this.logger.log(h.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},S.ccEOC=function(){if(this.logger.log(h.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var d=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=d,this.writeScreen=this.nonDisplayedMemory,this.logger.log(h.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},S.ccTO=function(d){this.logger.log(h.INFO,"TO("+d+") - Tab Offset"),this.writeScreen.moveCursor(d)},S.ccMIDROW=function(d){var b={flash:!1};if(b.underline=d%2===1,b.italics=d>=46,b.italics)b.foreground="white";else{var g=Math.floor(d/2)-16,_=["white","green","blue","cyan","red","yellow","magenta"];b.foreground=_[g]}this.logger.log(h.INFO,"MIDROW: "+JSON.stringify(b)),this.writeScreen.setPen(b)},S.outputDataUpdate=function(d){d===void 0&&(d=!1);var b=this.logger.time;if(b===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=b:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,b,this.lastOutputScreen),d&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:b),this.lastOutputScreen.copy(this.displayedMemory))},S.cueSplitAtTime=function(d){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,d,this.displayedMemory),this.cueStartTime=d))},x}(),w=function(){function x(E,d,b){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var g=new s;this.channels=[null,new L(E,d,g),new L(E+1,b,g)],this.cmdHistory=A(),this.logger=g}var S=x.prototype;return S.getHandler=function(d){return this.channels[d].getHandler()},S.setHandler=function(d,b){this.channels[d].setHandler(b)},S.addData=function(d,b){var g,_,F,D=!1;this.logger.time=d;for(var j=0;j<b.length;j+=2){if(_=b[j]&127,F=b[j+1]&127,_===0&&F===0)continue;if(this.logger.log(h.DATA,"["+u([b[j],b[j+1]])+"] -> ("+u([_,F])+")"),g=this.parseCmd(_,F),g||(g=this.parseMidrow(_,F)),g||(g=this.parsePAC(_,F)),g||(g=this.parseBackgroundAttributes(_,F)),!g&&(D=this.parseChars(_,F),D)){var H=this.currentChannel;if(H&&H>0){var k=this.channels[H];k.insertChars(D)}else this.logger.log(h.WARNING,"No channel found yet. TEXT-MODE?")}!g&&!D&&this.logger.log(h.WARNING,"Couldn't parse cleaned data "+u([_,F])+" orig: "+u([b[j],b[j+1]]))}},S.parseCmd=function(d,b){var g=this.cmdHistory,_=(d===20||d===28||d===21||d===29)&&b>=32&&b<=47,F=(d===23||d===31)&&b>=33&&b<=35;if(!(_||F))return!1;if(O(d,b,g))return T(null,null,g),this.logger.log(h.DEBUG,"Repeated command ("+u([d,b])+") is dropped"),!0;var D=d===20||d===21||d===23?1:2,j=this.channels[D];return d===20||d===21||d===28||d===29?b===32?j.ccRCL():b===33?j.ccBS():b===34?j.ccAOF():b===35?j.ccAON():b===36?j.ccDER():b===37?j.ccRU(2):b===38?j.ccRU(3):b===39?j.ccRU(4):b===40?j.ccFON():b===41?j.ccRDC():b===42?j.ccTR():b===43?j.ccRTD():b===44?j.ccEDM():b===45?j.ccCR():b===46?j.ccENM():b===47&&j.ccEOC():j.ccTO(b-32),T(d,b,g),this.currentChannel=D,!0},S.parseMidrow=function(d,b){var g=0;if((d===17||d===25)&&b>=32&&b<=47){if(d===17?g=1:g=2,g!==this.currentChannel)return this.logger.log(h.ERROR,"Mismatch channel in midrow parsing"),!1;var _=this.channels[g];return _?(_.ccMIDROW(b),this.logger.log(h.DEBUG,"MIDROW ("+u([d,b])+")"),!0):!1}return!1},S.parsePAC=function(d,b){var g,_=this.cmdHistory,F=(d>=17&&d<=23||d>=25&&d<=31)&&b>=64&&b<=127,D=(d===16||d===24)&&b>=64&&b<=95;if(!(F||D))return!1;if(O(d,b,_))return T(null,null,_),!0;var j=d<=23?1:2;b>=64&&b<=95?g=j===1?P[d]:m[d]:g=j===1?R[d]:p[d];var H=this.channels[j];return H?(H.setPAC(this.interpretPAC(g,b)),T(d,b,_),this.currentChannel=j,!0):!1},S.interpretPAC=function(d,b){var g,_={color:null,italics:!1,indent:null,underline:!1,row:d};return b>95?g=b-96:g=b-64,_.underline=(g&1)===1,g<=13?_.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(g/2)]:g<=15?(_.italics=!0,_.color="white"):_.indent=Math.floor((g-16)/2)*4,_},S.parseChars=function(d,b){var g,_=null,F=null;if(d>=25?(g=2,F=d-8):(g=1,F=d),F>=17&&F<=19){var D;F===17?D=b+80:F===18?D=b+112:D=b+144,this.logger.log(h.INFO,"Special char '"+N(D)+"' in channel "+g),_=[D]}else d>=32&&d<=127&&(_=b===0?[d]:[d,b]);if(_){var j=u(_);this.logger.log(h.DEBUG,"Char codes = "+j.join(",")),T(d,b,this.cmdHistory)}return _},S.parseBackgroundAttributes=function(d,b){var g=(d===16||d===24)&&b>=32&&b<=47,_=(d===23||d===31)&&b>=45&&b<=47;if(!(g||_))return!1;var F,D={};d===16||d===24?(F=Math.floor((b-32)/2),D.background=f[F],b%2===1&&(D.background=D.background+"_semi")):b===45?D.background="transparent":(D.foreground="black",b===47&&(D.underline=!0));var j=d<=23?1:2,H=this.channels[j];return H.setBkgData(D),T(d,b,this.cmdHistory),!0},S.reset=function(){for(var d=0;d<Object.keys(this.channels).length;d++){var b=this.channels[d];b&&b.reset()}this.cmdHistory=A()},S.cueSplitAtTime=function(d){for(var b=0;b<this.channels.length;b++){var g=this.channels[b];g&&g.cueSplitAtTime(d)}},x}();function T(x,S,E){E.a=x,E.b=S}function O(x,S,E){return E.a===x&&E.b===S}function A(){return{a:null,b:null}}Z.default=w},"./src/utils/codecs.ts":function(ue,Z,M){"use strict";M.r(Z),M.d(Z,"isCodecType",function(){return B}),M.d(Z,"isCodecSupportedInMp4",function(){return N});var Q={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 B(K,W){var P=Q[W];return!!P&&P[K.slice(0,4)]===!0}function N(K,W){return MediaSource.isTypeSupported((W||"video")+'/mp4;codecs="'+K+'"')}},"./src/utils/cues.ts":function(ue,Z,M){"use strict";M.r(Z);var Q=M("./src/utils/vttparser.ts"),B=M("./src/utils/webvtt-parser.ts"),N=M("./src/utils/texttrack-utils.ts"),K=/\s/,W={newCue:function(R,m,p,f){for(var h=[],s,u,l,a,o,c=self.VTTCue||self.TextTrackCue,L=0;L<f.rows.length;L++)if(s=f.rows[L],l=!0,a=0,o="",!s.isEmpty()){for(var w=0;w<s.chars.length;w++)K.test(s.chars[w].uchar)&&l?a++:(o+=s.chars[w].uchar,l=!1);s.cueStartTime=m,m===p&&(p+=1e-4),a>=16?a--:a++;var T=Object(Q.fixLineBreaks)(o.trim()),O=Object(B.generateCueId)(m,p,T);(!R||!R.cues||!R.cues.getCueById(O))&&(u=new c(m,p,T),u.id=O,u.line=L+1,u.align="left",u.position=10+Math.min(80,Math.floor(a*8/32)*10),h.push(u))}return R&&h.length&&(h.sort(function(A,x){return A.line==="auto"||x.line==="auto"?0:A.line>8&&x.line>8?x.line-A.line:A.line-x.line}),h.forEach(function(A){return Object(N.addCueToTrack)(R,A)})),h}};Z.default=W},"./src/utils/discontinuities.ts":function(ue,Z,M){"use strict";M.r(Z),M.d(Z,"findFirstFragWithCC",function(){return K}),M.d(Z,"shouldAlignOnDiscontinuities",function(){return W}),M.d(Z,"findDiscontinuousReferenceFrag",function(){return P}),M.d(Z,"adjustSlidingStart",function(){return m}),M.d(Z,"alignStream",function(){return p}),M.d(Z,"alignPDT",function(){return h}),M.d(Z,"alignFragmentByPDTDelta",function(){return s}),M.d(Z,"alignMediaPlaylistByPDT",function(){return u});var Q=M("./src/polyfills/number.ts"),B=M("./src/utils/logger.ts"),N=M("./src/controller/level-helper.ts");function K(l,a){for(var o=null,c=0,L=l.length;c<L;c++){var w=l[c];if(w&&w.cc===a){o=w;break}}return o}function W(l,a,o){return!!(a.details&&(o.endCC>o.startCC||l&&l.cc<o.startCC))}function P(l,a){var o=l.fragments,c=a.fragments;if(!c.length||!o.length){B.logger.log("No fragments to align");return}var L=K(o,c[0].cc);if(!L||L&&!L.startPTS){B.logger.log("No frag in previous level to align on");return}return L}function R(l,a){if(l){var o=l.start+a;l.start=l.startPTS=o,l.endPTS=o+l.duration}}function m(l,a){for(var o=a.fragments,c=0,L=o.length;c<L;c++)R(o[c],l);a.fragmentHint&&R(a.fragmentHint,l),a.alignedSliding=!0}function p(l,a,o){if(!a)return;f(l,o,a),!o.alignedSliding&&a.details&&h(o,a.details),!o.alignedSliding&&a.details&&!o.skippedSegments&&Object(N.adjustSliding)(a.details,o)}function f(l,a,o){if(W(l,o,a)){var c=P(o.details,a);c&&Object(Q.isFiniteNumber)(c.start)&&(B.logger.log("Adjusting PTS using last level due to CC increase within current level "+a.url),m(c.start,a))}}function h(l,a){if(!a.fragments.length||!l.hasProgramDateTime||!a.hasProgramDateTime)return;var o=a.fragments[0].programDateTime,c=l.fragments[0].programDateTime,L=(c-o)/1e3+a.fragments[0].start;L&&Object(Q.isFiniteNumber)(L)&&(B.logger.log("Adjusting PTS using programDateTime delta "+(c-o)+"ms, sliding:"+L.toFixed(3)+" "+l.url+" "),m(L,l))}function s(l,a){var o=l.programDateTime;if(!o)return;var c=(o-a)/1e3;l.start=l.startPTS=c,l.endPTS=c+l.duration}function u(l,a){if(!a.fragments.length||!l.hasProgramDateTime||!a.hasProgramDateTime)return;var o=a.fragments[0].programDateTime,c=a.fragments[0].start,L=o-c*1e3;l.fragments.forEach(function(w){s(w,L)}),l.fragmentHint&&s(l.fragmentHint,L),l.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(ue,Z,M){"use strict";M.r(Z);var Q=M("./src/utils/ewma.ts"),B=function(){function N(W,P,R){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=R,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new Q.default(W),this.fast_=new Q.default(P)}var K=N.prototype;return K.update=function(P,R){var m=this.slow_,p=this.fast_;this.slow_.halfLife!==P&&(this.slow_=new Q.default(P,m.getEstimate(),m.getTotalWeight())),this.fast_.halfLife!==R&&(this.fast_=new Q.default(R,p.getEstimate(),p.getTotalWeight()))},K.sample=function(P,R){P=Math.max(P,this.minDelayMs_);var m=8*R,p=P/1e3,f=m/p;this.fast_.sample(p,f),this.slow_.sample(p,f)},K.canEstimate=function(){var P=this.fast_;return P&&P.getTotalWeight()>=this.minWeight_},K.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},K.destroy=function(){},N}();Z.default=B},"./src/utils/ewma.ts":function(ue,Z,M){"use strict";M.r(Z);var Q=function(){function B(K,W,P){W===void 0&&(W=0),P===void 0&&(P=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=K,this.alpha_=K?Math.exp(Math.log(.5)/K):0,this.estimate_=W,this.totalWeight_=P}var N=B.prototype;return N.sample=function(W,P){var R=Math.pow(this.alpha_,W);this.estimate_=P*(1-R)+R*this.estimate_,this.totalWeight_+=W},N.getTotalWeight=function(){return this.totalWeight_},N.getEstimate=function(){if(this.alpha_){var W=1-Math.pow(this.alpha_,this.totalWeight_);if(W)return this.estimate_/W}return this.estimate_},B}();Z.default=Q},"./src/utils/fetch-loader.ts":function(ue,Z,M){"use strict";M.r(Z),M.d(Z,"fetchSupported",function(){return s});var Q=M("./src/polyfills/number.ts"),B=M("./src/loader/load-stats.ts"),N=M("./src/demux/chunk-cache.ts");function K(c,L){c.prototype=Object.create(L.prototype),c.prototype.constructor=c,p(c,L)}function W(c){var L=typeof Map=="function"?new Map:void 0;return W=function(T){if(T===null||!m(T))return T;if(typeof T!="function")throw new TypeError("Super expression must either be null or a function");if(typeof L!="undefined"){if(L.has(T))return L.get(T);L.set(T,O)}function O(){return P(T,arguments,f(this).constructor)}return O.prototype=Object.create(T.prototype,{constructor:{value:O,enumerable:!1,writable:!0,configurable:!0}}),p(O,T)},W(c)}function P(c,L,w){return R()?P=Reflect.construct:P=function(O,A,x){var S=[null];S.push.apply(S,A);var E=Function.bind.apply(O,S),d=new E;return x&&p(d,x.prototype),d},P.apply(null,arguments)}function R(){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 m(c){return Function.toString.call(c).indexOf("[native code]")!==-1}function p(c,L){return p=Object.setPrototypeOf||function(T,O){return T.__proto__=O,T},p(c,L)}function f(c){return f=Object.setPrototypeOf?Object.getPrototypeOf:function(w){return w.__proto__||Object.getPrototypeOf(w)},f(c)}function h(){return h=Object.assign||function(c){for(var L=1;L<arguments.length;L++){var w=arguments[L];for(var T in w)Object.prototype.hasOwnProperty.call(w,T)&&(c[T]=w[T])}return c},h.apply(this,arguments)}function s(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(c){}return!1}var u=function(){function c(w){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=w.fetchSetup||a,this.controller=new self.AbortController,this.stats=new B.LoadStats}var L=c.prototype;return L.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},L.abortInternal=function(){var T=this.response;(!T||!T.ok)&&(this.stats.aborted=!0,this.controller.abort())},L.abort=function(){var T;this.abortInternal(),(T=this.callbacks)!==null&&T!==void 0&&T.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},L.load=function(T,O,A){var x=this,S=this.stats;if(S.loading.start)throw new Error("Loader can only be used once.");S.loading.start=self.performance.now();var E=l(T,this.controller.signal),d=A.onProgress,b=T.responseType==="arraybuffer",g=b?"byteLength":"length";this.context=T,this.config=O,this.callbacks=A,this.request=this.fetchSetup(T,E),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){x.abortInternal(),A.onTimeout(S,T,x.response)},O.timeout),self.fetch(this.request).then(function(_){if(x.response=x.loader=_,!_.ok){var F=_.status,D=_.statusText;throw new o(D||"fetch, bad network response",F,_)}return S.loading.first=Math.max(self.performance.now(),S.loading.start),S.total=parseInt(_.headers.get("Content-Length")||"0"),d&&Object(Q.isFiniteNumber)(O.highWaterMark)?x.loadProgressively(_,S,T,O.highWaterMark,d):b?_.arrayBuffer():_.text()}).then(function(_){var F=x.response;self.clearTimeout(x.requestTimeout),S.loading.end=Math.max(self.performance.now(),S.loading.first),S.loaded=S.total=_[g];var D={url:F.url,data:_};d&&!Object(Q.isFiniteNumber)(O.highWaterMark)&&d(S,T,_,F),A.onSuccess(D,S,T,F)}).catch(function(_){if(self.clearTimeout(x.requestTimeout),S.aborted)return;var F=_.code||0;A.onError({code:F,text:_.message},T,_.details)})},L.getCacheAge=function(){var T=null;if(this.response){var O=this.response.headers.get("age");T=O?parseFloat(O):null}return T},L.loadProgressively=function(T,O,A,x,S){x===void 0&&(x=0);var E=new N.default,d=T.body.getReader(),b=function g(){return d.read().then(function(_){if(_.done)return E.dataLength&&S(O,A,E.flush(),T),Promise.resolve(new ArrayBuffer(0));var F=_.value,D=F.length;return O.loaded+=D,D<x||E.dataLength?(E.push(F),E.dataLength>=x&&S(O,A,E.flush(),T)):S(O,A,F,T),g()}).catch(function(){return Promise.reject()})};return b()},c}();function l(c,L){var w={method:"GET",mode:"cors",credentials:"same-origin",signal:L,headers:new self.Headers(h({},c.headers))};return c.rangeEnd&&w.headers.set("Range","bytes="+c.rangeStart+"-"+String(c.rangeEnd-1)),w}function a(c,L){return new self.Request(c.url,L)}var o=function(c){K(L,c);function L(w,T,O){var A;return A=c.call(this,w)||this,A.code=void 0,A.details=void 0,A.code=T,A.details=O,A}return L}(W(Error));Z.default=u},"./src/utils/imsc1-ttml-parser.ts":function(ue,Z,M){"use strict";M.r(Z),M.d(Z,"IMSC1_CODEC",function(){return m}),M.d(Z,"parseIMSC1",function(){return s});var Q=M("./src/utils/mp4-tools.ts"),B=M("./src/utils/vttparser.ts"),N=M("./src/utils/vttcue.ts"),K=M("./src/demux/id3.ts"),W=M("./src/utils/timescale-conversion.ts"),P=M("./src/utils/webvtt-parser.ts");function R(){return R=Object.assign||function(x){for(var S=1;S<arguments.length;S++){var E=arguments[S];for(var d in E)Object.prototype.hasOwnProperty.call(E,d)&&(x[d]=E[d])}return x},R.apply(this,arguments)}var m="stpp.ttml.im1t",p=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,f=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,h={left:"start",center:"center",right:"end",start:"start",end:"end"};function s(x,S,E,d,b){var g=Object(Q.findBox)(new Uint8Array(x),["mdat"]);if(g.length===0){b(new Error("Could not parse IMSC1 mdat"));return}var _=g[0],F=Object(K.utf8ArrayToStr)(new Uint8Array(x,_.start,_.end-_.start)),D=Object(W.toTimescaleFromScale)(S,1,E);try{d(u(F,D))}catch(j){b(j)}}function u(x,S){var E=new DOMParser,d=E.parseFromString(x,"text/xml"),b=d.getElementsByTagName("tt")[0];if(!b)throw new Error("Invalid ttml");var g={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},_=Object.keys(g).reduce(function(k,y){return k[y]=b.getAttribute("ttp:"+y)||g[y],k},{}),F=b.getAttribute("xml:space")!=="preserve",D=a(l(b,"styling","style")),j=a(l(b,"layout","region")),H=l(b,"body","[begin]");return[].map.call(H,function(k){var y=o(k,F);if(!y||!k.hasAttribute("begin"))return null;var G=T(k.getAttribute("begin"),_),Y=T(k.getAttribute("dur"),_),ie=T(k.getAttribute("end"),_);if(G===null)throw w(k);if(ie===null){if(Y===null)throw w(k);ie=G+Y}var se=new N.default(G-S,ie-S,y);se.id=Object(P.generateCueId)(se.startTime,se.endTime,se.text);var we=j[k.getAttribute("region")],ve=D[k.getAttribute("style")];se.position=10,se.size=80;var Se=c(we,ve),Ce=Se.textAlign;if(Ce){var pe=h[Ce];pe&&(se.lineAlign=pe),se.align=Ce}return R(se,Se),se}).filter(function(k){return k!==null})}function l(x,S,E){var d=x.getElementsByTagName(S)[0];return d?[].slice.call(d.querySelectorAll(E)):[]}function a(x){return x.reduce(function(S,E){var d=E.getAttribute("xml:id");return d&&(S[d]=E),S},{})}function o(x,S){return[].slice.call(x.childNodes).reduce(function(E,d,b){var g;return d.nodeName==="br"&&b?E+`
`:(g=d.childNodes)!==null&&g!==void 0&&g.length?o(d,S):S?E+d.textContent.trim().replace(/\s+/g," "):E+d.textContent},"")}function c(x,S){var E="http://www.w3.org/ns/ttml#styling",d=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return d.reduce(function(b,g){var _=L(S,E,g)||L(x,E,g);return _&&(b[g]=_),b},{})}function L(x,S,E){return x.hasAttributeNS(S,E)?x.getAttributeNS(S,E):null}function w(x){return new Error("Could not parse ttml timestamp "+x)}function T(x,S){if(!x)return null;var E=Object(B.parseTimeStamp)(x);return E===null&&(p.test(x)?E=O(x,S):f.test(x)&&(E=A(x,S))),E}function O(x,S){var E=p.exec(x),d=(E[4]|0)+(E[5]|0)/S.subFrameRate;return(E[1]|0)*3600+(E[2]|0)*60+(E[3]|0)+d/S.frameRate}function A(x,S){var E=f.exec(x),d=Number(E[1]),b=E[2];switch(b){case"h":return d*3600;case"m":return d*60;case"ms":return d*1e3;case"f":return d/S.frameRate;case"t":return d/S.tickRate}return d}},"./src/utils/logger.ts":function(ue,Z,M){"use strict";M.r(Z),M.d(Z,"enableLogs",function(){return P}),M.d(Z,"logger",function(){return R});var Q=function(){},B={trace:Q,debug:Q,log:Q,warn:Q,info:Q,error:Q},N=B;function K(m){var p=self.console[m];return p?p.bind(self.console,"["+m+"] >"):Q}function W(m){for(var p=arguments.length,f=new Array(p>1?p-1:0),h=1;h<p;h++)f[h-1]=arguments[h];f.forEach(function(s){N[s]=m[s]?m[s].bind(m):K(s)})}function P(m){if(self.console&&m===!0||typeof m=="object"){W(m,"debug","log","info","warn","error");try{N.log()}catch(p){N=B}}else N=B}var R=N},"./src/utils/mediakeys-helper.ts":function(ue,Z,M){"use strict";M.r(Z),M.d(Z,"KeySystems",function(){return Q}),M.d(Z,"requestMediaKeySystemAccess",function(){return B});var Q;(function(N){N.WIDEVINE="com.widevine.alpha",N.PLAYREADY="com.microsoft.playready"})(Q||(Q={}));var B=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(ue,Z,M){"use strict";M.r(Z),M.d(Z,"getMediaSource",function(){return Q});function Q(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(ue,Z,M){"use strict";M.r(Z),M.d(Z,"bin2str",function(){return W}),M.d(Z,"readUint16",function(){return P}),M.d(Z,"readUint32",function(){return R}),M.d(Z,"writeUint32",function(){return m}),M.d(Z,"findBox",function(){return p}),M.d(Z,"parseSegmentIndex",function(){return f}),M.d(Z,"parseInitSegment",function(){return h}),M.d(Z,"getStartDTS",function(){return s}),M.d(Z,"getDuration",function(){return u}),M.d(Z,"computeRawDurationFromSamples",function(){return l}),M.d(Z,"offsetStartDTS",function(){return a}),M.d(Z,"segmentValidRange",function(){return o}),M.d(Z,"appendUint8Array",function(){return c});var Q=M("./src/utils/typed-array.ts"),B=M("./src/loader/fragment.ts"),N=Math.pow(2,32)-1,K=[].push;function W(L){return String.fromCharCode.apply(null,L)}function P(L,w){"data"in L&&(w+=L.start,L=L.data);var T=L[w]<<8|L[w+1];return T<0?65536+T:T}function R(L,w){"data"in L&&(w+=L.start,L=L.data);var T=L[w]<<24|L[w+1]<<16|L[w+2]<<8|L[w+3];return T<0?4294967296+T:T}function m(L,w,T){"data"in L&&(w+=L.start,L=L.data),L[w]=T>>24,L[w+1]=T>>16&255,L[w+2]=T>>8&255,L[w+3]=T&255}function p(L,w){var T=[];if(!w.length)return T;var O,A,x;"data"in L?(O=L.data,A=L.start,x=L.end):(O=L,A=0,x=O.byteLength);for(var S=A;S<x;){var E=R(O,S),d=W(O.subarray(S+4,S+8)),b=E>1?S+E:x;if(d===w[0])if(w.length===1)T.push({data:O,start:S+8,end:b});else{var g=p({data:O,start:S+8,end:b},w.slice(1));g.length&&K.apply(T,g)}S=b}return T}function f(L){var w=p(L,["moov"]),T=w[0],O=T?T.end:null,A=p(L,["sidx"]);if(!A||!A[0])return null;var x=[],S=A[0],E=S.data[0],d=E===0?8:16,b=R(S,d);d+=4;var g=0,_=0;E===0?d+=8:d+=16,d+=2;var F=S.end+_,D=P(S,d);d+=2;for(var j=0;j<D;j++){var H=d,k=R(S,H);H+=4;var y=k&2147483647,G=(k&2147483648)>>>31;if(G===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var Y=R(S,H);H+=4,x.push({referenceSize:y,subsegmentDuration:Y,info:{duration:Y/b,start:F,end:F+y-1}}),F+=y,H+=4,d=H}return{earliestPresentationTime:g,timescale:b,version:E,referencesCount:D,references:x,moovEndOffset:O}}function h(L){for(var w=[],T=p(L,["moov","trak"]),O=0;O<T.length;O++){var A=T[O],x=p(A,["tkhd"])[0];if(x){var S=x.data[x.start],E=S===0?12:20,d=R(x,E),b=p(A,["mdia","mdhd"])[0];if(b){S=b.data[b.start],E=S===0?12:20;var g=R(b,E),_=p(A,["mdia","hdlr"])[0];if(_){var F=W(_.data.subarray(_.start+8,_.start+12)),D={soun:B.ElementaryStreamTypes.AUDIO,vide:B.ElementaryStreamTypes.VIDEO}[F];if(D){var j=p(A,["mdia","minf","stbl","stsd"])[0],H=void 0;j&&(H=W(j.data.subarray(j.start+12,j.start+16))),w[d]={timescale:g,type:D},w[D]={timescale:g,id:d,codec:H}}}}}}var k=p(L,["moov","mvex","trex"]);return k.forEach(function(y){var G=R(y,4),Y=w[G];Y&&(Y.default={duration:R(y,12),flags:R(y,20)})}),w}function s(L,w){return p(w,["moof","traf"]).reduce(function(T,O){var A=p(O,["tfdt"])[0],x=A.data[A.start],S=p(O,["tfhd"]).reduce(function(E,d){var b=R(d,4),g=L[b];if(g){var _=R(A,4);x===1&&(_*=Math.pow(2,32),_+=R(A,8));var F=g.timescale||9e4,D=_/F;if(isFinite(D)&&(E===null||D<E))return D}return E},null);return S!==null&&isFinite(S)&&(T===null||S<T)?S:T},null)||0}function u(L,w){for(var T=0,O=0,A=0,x=p(L,["moof","traf"]),S=0;S<x.length;S++){var E=x[S],d=p(E,["tfhd"])[0],b=R(d,4),g=w[b];if(!g)continue;var _=g.default,F=R(d,0)|(_==null?void 0:_.flags),D=_==null?void 0:_.duration;F&8&&(F&2?D=R(d,12):D=R(d,8));for(var j=g.timescale||9e4,H=p(E,["trun"]),k=0;k<H.length;k++){if(D){var y=R(H[k],4);T=D*y}else T=l(H[k]);g.type===B.ElementaryStreamTypes.VIDEO?O+=T/j:g.type===B.ElementaryStreamTypes.AUDIO&&(A+=T/j)}}if(O===0&&A===0){var G=f(L);if(G!=null&&G.references)return G.references.reduce(function(Y,ie){return Y+ie.info.duration||0},0)}return O||A}function l(L){var w=R(L,0),T=8;w&1&&(T+=4),w&4&&(T+=4);for(var O=0,A=R(L,4),x=0;x<A;x++){if(w&256){var S=R(L,T);O+=S,T+=4}w&512&&(T+=4),w&1024&&(T+=4),w&2048&&(T+=4)}return O}function a(L,w,T){p(w,["moof","traf"]).forEach(function(O){p(O,["tfhd"]).forEach(function(A){var x=R(A,4),S=L[x];if(!S)return;var E=S.timescale||9e4;p(O,["tfdt"]).forEach(function(d){var b=d.data[d.start],g=R(d,4);if(b===0)m(d,4,g-T*E);else{g*=Math.pow(2,32),g+=R(d,8),g-=T*E,g=Math.max(g,0);var _=Math.floor(g/(N+1)),F=Math.floor(g%(N+1));m(d,4,_),m(d,8,F)}})})})}function o(L){var w={valid:null,remainder:null},T=p(L,["moof"]);if(T){if(T.length<2)return w.remainder=L,w}else return w;var O=T[T.length-1];return w.valid=Object(Q.sliceUint8)(L,0,O.start-8),w.remainder=Object(Q.sliceUint8)(L,O.start-8),w}function c(L,w){var T=new Uint8Array(L.length+w.length);return T.set(L),T.set(w,L.length),T}},"./src/utils/output-filter.ts":function(ue,Z,M){"use strict";M.r(Z),M.d(Z,"default",function(){return Q});var Q=function(){function B(K,W){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=K,this.trackName=W}var N=B.prototype;return N.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},N.newCue=function(W,P,R){(this.startTime===null||this.startTime>W)&&(this.startTime=W),this.endTime=P,this.screen=R,this.timelineController.createCaptionsTrack(this.trackName)},N.reset=function(){this.cueRanges=[]},B}()},"./src/utils/texttrack-utils.ts":function(ue,Z,M){"use strict";M.r(Z),M.d(Z,"sendAddTrackEvent",function(){return B}),M.d(Z,"addCueToTrack",function(){return N}),M.d(Z,"clearCurrentCues",function(){return K}),M.d(Z,"removeCuesInRange",function(){return W}),M.d(Z,"getCuesInRange",function(){return R});var Q=M("./src/utils/logger.ts");function B(m,p){var f;try{f=new Event("addtrack")}catch(h){f=document.createEvent("Event"),f.initEvent("addtrack",!1,!1)}f.track=m,p.dispatchEvent(f)}function N(m,p){var f=m.mode;if(f==="disabled"&&(m.mode="hidden"),m.cues&&!m.cues.getCueById(p.id))try{if(m.addCue(p),!m.cues.getCueById(p.id))throw new Error("addCue is failed for: "+p)}catch(s){Q.logger.debug("[texttrack-utils]: "+s);var h=new self.TextTrackCue(p.startTime,p.endTime,p.text);h.id=p.id,m.addCue(h)}f==="disabled"&&(m.mode=f)}function K(m){var p=m.mode;if(p==="disabled"&&(m.mode="hidden"),m.cues)for(var f=m.cues.length;f--;)m.removeCue(m.cues[f]);p==="disabled"&&(m.mode=p)}function W(m,p,f){var h=m.mode;if(h==="disabled"&&(m.mode="hidden"),m.cues&&m.cues.length>0)for(var s=R(m.cues,p,f),u=0;u<s.length;u++)m.removeCue(s[u]);h==="disabled"&&(m.mode=h)}function P(m,p){if(p<m[0].startTime)return 0;var f=m.length-1;if(p>m[f].endTime)return-1;for(var h=0,s=f;h<=s;){var u=Math.floor((s+h)/2);if(p<m[u].startTime)s=u-1;else if(p>m[u].startTime&&h<f)h=u+1;else return u}return m[h].startTime-p<p-m[s].startTime?h:s}function R(m,p,f){var h=[],s=P(m,p);if(s>-1)for(var u=s,l=m.length;u<l;u++){var a=m[u];if(a.startTime>=p&&a.endTime<=f)h.push(a);else if(a.startTime>f)return h}return h}},"./src/utils/time-ranges.ts":function(ue,Z,M){"use strict";M.r(Z);var Q={toString:function(N){for(var K="",W=N.length,P=0;P<W;P++)K+="["+N.start(P).toFixed(3)+","+N.end(P).toFixed(3)+"]";return K}};Z.default=Q},"./src/utils/timescale-conversion.ts":function(ue,Z,M){"use strict";M.r(Z),M.d(Z,"toTimescaleFromBase",function(){return B}),M.d(Z,"toTimescaleFromScale",function(){return N}),M.d(Z,"toMsFromMpegTsClock",function(){return K}),M.d(Z,"toMpegTsClockFromTimescale",function(){return W});var Q=9e4;function B(P,R,m,p){m===void 0&&(m=1),p===void 0&&(p=!1);var f=P*R*m;return p?Math.round(f):f}function N(P,R,m,p){return m===void 0&&(m=1),p===void 0&&(p=!1),B(P,R,1/m,p)}function K(P,R){return R===void 0&&(R=!1),B(P,1e3,1/Q,R)}function W(P,R){return R===void 0&&(R=1),B(P,Q,1/R)}},"./src/utils/typed-array.ts":function(ue,Z,M){"use strict";M.r(Z),M.d(Z,"sliceUint8",function(){return Q});function Q(B,N,K){return Uint8Array.prototype.slice?B.slice(N,K):new Uint8Array(Array.prototype.slice.call(B,N,K))}},"./src/utils/vttcue.ts":function(ue,Z,M){"use strict";M.r(Z),Z.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var Q=["","lr","rl"],B=["start","middle","end","left","right"];function N(m,p){if(typeof p!="string")return!1;if(!Array.isArray(m))return!1;var f=p.toLowerCase();return~m.indexOf(f)?f:!1}function K(m){return N(Q,m)}function W(m){return N(B,m)}function P(m){for(var p=arguments.length,f=new Array(p>1?p-1:0),h=1;h<p;h++)f[h-1]=arguments[h];for(var s=1;s<arguments.length;s++){var u=arguments[s];for(var l in u)m[l]=u[l]}return m}function R(m,p,f){var h=this,s={enumerable:!0};h.hasBeenReset=!1;var u="",l=!1,a=m,o=p,c=f,L=null,w="",T=!0,O="auto",A="start",x=50,S="middle",E=50,d="middle";Object.defineProperty(h,"id",P({},s,{get:function(){return u},set:function(g){u=""+g}})),Object.defineProperty(h,"pauseOnExit",P({},s,{get:function(){return l},set:function(g){l=!!g}})),Object.defineProperty(h,"startTime",P({},s,{get:function(){return a},set:function(g){if(typeof g!="number")throw new TypeError("Start time must be set to a number.");a=g,this.hasBeenReset=!0}})),Object.defineProperty(h,"endTime",P({},s,{get:function(){return o},set:function(g){if(typeof g!="number")throw new TypeError("End time must be set to a number.");o=g,this.hasBeenReset=!0}})),Object.defineProperty(h,"text",P({},s,{get:function(){return c},set:function(g){c=""+g,this.hasBeenReset=!0}})),Object.defineProperty(h,"region",P({},s,{get:function(){return L},set:function(g){L=g,this.hasBeenReset=!0}})),Object.defineProperty(h,"vertical",P({},s,{get:function(){return w},set:function(g){var _=K(g);if(_===!1)throw new SyntaxError("An invalid or illegal string was specified.");w=_,this.hasBeenReset=!0}})),Object.defineProperty(h,"snapToLines",P({},s,{get:function(){return T},set:function(g){T=!!g,this.hasBeenReset=!0}})),Object.defineProperty(h,"line",P({},s,{get:function(){return O},set:function(g){if(typeof g!="number"&&g!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");O=g,this.hasBeenReset=!0}})),Object.defineProperty(h,"lineAlign",P({},s,{get:function(){return A},set:function(g){var _=W(g);if(!_)throw new SyntaxError("An invalid or illegal string was specified.");A=_,this.hasBeenReset=!0}})),Object.defineProperty(h,"position",P({},s,{get:function(){return x},set:function(g){if(g<0||g>100)throw new Error("Position must be between 0 and 100.");x=g,this.hasBeenReset=!0}})),Object.defineProperty(h,"positionAlign",P({},s,{get:function(){return S},set:function(g){var _=W(g);if(!_)throw new SyntaxError("An invalid or illegal string was specified.");S=_,this.hasBeenReset=!0}})),Object.defineProperty(h,"size",P({},s,{get:function(){return E},set:function(g){if(g<0||g>100)throw new Error("Size must be between 0 and 100.");E=g,this.hasBeenReset=!0}})),Object.defineProperty(h,"align",P({},s,{get:function(){return d},set:function(g){var _=W(g);if(!_)throw new SyntaxError("An invalid or illegal string was specified.");d=_,this.hasBeenReset=!0}})),h.displayState=void 0}return R.prototype.getCueAsHTML=function(){var m=self.WebVTT;return m.convertCueToDOMTree(self,this.text)},R}()},"./src/utils/vttparser.ts":function(ue,Z,M){"use strict";M.r(Z),M.d(Z,"parseTimeStamp",function(){return N}),M.d(Z,"fixLineBreaks",function(){return p}),M.d(Z,"VTTParser",function(){return f});var Q=M("./src/utils/vttcue.ts"),B=function(){function h(){}var s=h.prototype;return s.decode=function(l,a){if(!l)return"";if(typeof l!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(l))},h}();function N(h){function s(l,a,o,c){return(l|0)*3600+(a|0)*60+(o|0)+parseFloat(c||0)}var u=h.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return u?parseFloat(u[2])>59?s(u[2],u[3],0,u[4]):s(u[1],u[2],u[3],u[4]):null}var K=function(){function h(){this.values=Object.create(null)}var s=h.prototype;return s.set=function(l,a){!this.get(l)&&a!==""&&(this.values[l]=a)},s.get=function(l,a,o){return o?this.has(l)?this.values[l]:a[o]:this.has(l)?this.values[l]:a},s.has=function(l){return l in this.values},s.alt=function(l,a,o){for(var c=0;c<o.length;++c)if(a===o[c]){this.set(l,a);break}},s.integer=function(l,a){/^-?\d+$/.test(a)&&this.set(l,parseInt(a,10))},s.percent=function(l,a){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(a)){var o=parseFloat(a);if(o>=0&&o<=100)return this.set(l,o),!0}return!1},h}();function W(h,s,u,l){var a=l?h.split(l):[h];for(var o in a){if(typeof a[o]!="string")continue;var c=a[o].split(u);if(c.length!==2)continue;var L=c[0],w=c[1];s(L,w)}}var P=new Q.default(0,0,""),R=P.align==="middle"?"middle":"center";function m(h,s,u){var l=h;function a(){var L=N(h);if(L===null)throw new Error("Malformed timestamp: "+l);return h=h.replace(/^[^\sa-zA-Z-]+/,""),L}function o(L,w){var T=new K;W(L,function(x,S){var E;switch(x){case"region":for(var d=u.length-1;d>=0;d--)if(u[d].id===S){T.set(x,u[d].region);break}break;case"vertical":T.alt(x,S,["rl","lr"]);break;case"line":E=S.split(","),T.integer(x,E[0]),T.percent(x,E[0])&&T.set("snapToLines",!1),T.alt(x,E[0],["auto"]),E.length===2&&T.alt("lineAlign",E[1],["start",R,"end"]);break;case"position":E=S.split(","),T.percent(x,E[0]),E.length===2&&T.alt("positionAlign",E[1],["start",R,"end","line-left","line-right","auto"]);break;case"size":T.percent(x,S);break;case"align":T.alt(x,S,["start",R,"end","left","right"]);break}},/:/,/\s/),w.region=T.get("region",null),w.vertical=T.get("vertical","");var O=T.get("line","auto");O==="auto"&&P.line===-1&&(O=-1),w.line=O,w.lineAlign=T.get("lineAlign","start"),w.snapToLines=T.get("snapToLines",!0),w.size=T.get("size",100),w.align=T.get("align",R);var A=T.get("position","auto");A==="auto"&&P.position===50&&(A=w.align==="start"||w.align==="left"?0:w.align==="end"||w.align==="right"?100:50),w.position=A}function c(){h=h.replace(/^\s+/,"")}if(c(),s.startTime=a(),c(),h.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+l);h=h.substr(3),c(),s.endTime=a(),c(),o(h,s)}function p(h){return h.replace(/<br(?: \/)?>/gi,`
`)}var f=function(){function h(){this.state="INITIAL",this.buffer="",this.decoder=new B,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var s=h.prototype;return s.parse=function(l){var a=this;l&&(a.buffer+=a.decoder.decode(l,{stream:!0}));function o(){var A=a.buffer,x=0;for(A=p(A);x<A.length&&A[x]!=="\r"&&A[x]!==`
`;)++x;var S=A.substr(0,x);return A[x]==="\r"&&++x,A[x]===`
`&&++x,a.buffer=A.substr(x),S}function c(A){W(A,function(x,S){},/:/)}try{var L="";if(a.state==="INITIAL"){if(!/\r\n|\n/.test(a.buffer))return this;L=o();var w=L.match(/^()?WEBVTT([ \t].*)?$/);if(!w||!w[0])throw new Error("Malformed WebVTT signature.");a.state="HEADER"}for(var T=!1;a.buffer;){if(!/\r\n|\n/.test(a.buffer))return this;T?T=!1:L=o();switch(a.state){case"HEADER":/:/.test(L)?c(L):L||(a.state="ID");continue;case"NOTE":L||(a.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(L)){a.state="NOTE";break}if(!L)continue;if(a.cue=new Q.default(0,0,""),a.state="CUE",L.indexOf("-->")===-1){a.cue.id=L;continue}case"CUE":if(!a.cue){a.state="BADCUE";continue}try{m(L,a.cue,a.regionList)}catch(A){a.cue=null,a.state="BADCUE";continue}a.state="CUETEXT";continue;case"CUETEXT":{var O=L.indexOf("-->")!==-1;if(!L||O&&(T=!0)){a.oncue&&a.cue&&a.oncue(a.cue),a.cue=null,a.state="ID";continue}if(a.cue===null)continue;a.cue.text&&(a.cue.text+=`
`),a.cue.text+=L}continue;case"BADCUE":L||(a.state="ID")}}}catch(A){a.state==="CUETEXT"&&a.cue&&a.oncue&&a.oncue(a.cue),a.cue=null,a.state=a.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},s.flush=function(){var l=this;try{if((l.cue||l.state==="HEADER")&&(l.buffer+=`
`,l.parse()),l.state==="INITIAL"||l.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(a){l.onparsingerror&&l.onparsingerror(a)}return l.onflush&&l.onflush(),this},h}()},"./src/utils/webvtt-parser.ts":function(ue,Z,M){"use strict";M.r(Z),M.d(Z,"generateCueId",function(){return f}),M.d(Z,"parseWebVTT",function(){return s});var Q=M("./src/polyfills/number.ts"),B=M("./src/utils/vttparser.ts"),N=M("./src/demux/id3.ts"),K=M("./src/utils/timescale-conversion.ts"),W=M("./src/remux/mp4-remuxer.ts"),P=/\r\n|\n\r|\n|\r/g,R=function(l,a,o){return o===void 0&&(o=0),l.substr(o,a.length)===a},m=function(l){var a=parseInt(l.substr(-3)),o=parseInt(l.substr(-6,2)),c=parseInt(l.substr(-9,2)),L=l.length>9?parseInt(l.substr(0,l.indexOf(":"))):0;if(!Object(Q.isFiniteNumber)(a)||!Object(Q.isFiniteNumber)(o)||!Object(Q.isFiniteNumber)(c)||!Object(Q.isFiniteNumber)(L))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+l);return a+=1e3*o,a+=60*1e3*c,a+=60*60*1e3*L,a},p=function(l){for(var a=5381,o=l.length;o;)a=a*33^l.charCodeAt(--o);return(a>>>0).toString()};function f(u,l,a){return p(u.toString())+p(l.toString())+p(a)}var h=function(l,a,o){var c=l[a],L=l[c.prevCC];if(!L||!L.new&&c.new){l.ccOffset=l.presentationOffset=c.start,c.new=!1;return}for(;(w=L)!==null&&w!==void 0&&w.new;){var w;l.ccOffset+=c.start-L.start,c.new=!1,c=L,L=l[c.prevCC]}l.presentationOffset=o};function s(u,l,a,o,c,L,w,T){var O=new B.VTTParser,A=Object(N.utf8ArrayToStr)(new Uint8Array(u)).trim().replace(P,`
`).split(`
`),x=[],S=Object(K.toMpegTsClockFromTimescale)(l,a),E="00:00.000",d=0,b=0,g,_=!0,F=!1;O.oncue=function(D){var j=o[c],H=o.ccOffset,k=(d-S)/9e4;if(j!=null&&j.new&&(b!==void 0?H=o.ccOffset=j.start:h(o,c,k)),k&&(H=k-o.presentationOffset),F){var y=D.endTime-D.startTime,G=Object(W.normalizePts)((D.startTime+H-b)*9e4,L*9e4)/9e4;D.startTime=G,D.endTime=G+y}var Y=D.text.trim();D.text=decodeURIComponent(encodeURIComponent(Y)),D.id||(D.id=f(D.startTime,D.endTime,Y)),D.endTime>0&&x.push(D)},O.onparsingerror=function(D){g=D},O.onflush=function(){if(g){T(g);return}w(x)},A.forEach(function(D){if(_)if(R(D,"X-TIMESTAMP-MAP=")){_=!1,F=!0,D.substr(16).split(",").forEach(function(j){R(j,"LOCAL:")?E=j.substr(6):R(j,"MPEGTS:")&&(d=parseInt(j.substr(7)))});try{b=m(E)/1e3}catch(j){F=!1,g=j}return}else D===""&&(_=!1);O.parse(D+`
`)}),O.flush()}},"./src/utils/xhr-loader.ts":function(ue,Z,M){"use strict";M.r(Z);var Q=M("./src/utils/logger.ts"),B=M("./src/loader/load-stats.ts"),N=/^age:\s*[\d.]+\s*$/m,K=function(){function W(R){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=R?R.xhrSetup:null,this.stats=new B.LoadStats,this.retryDelay=0}var P=W.prototype;return P.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},P.abortInternal=function(){var m=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),m&&(m.onreadystatechange=null,m.onprogress=null,m.readyState!==4&&(this.stats.aborted=!0,m.abort()))},P.abort=function(){var m;this.abortInternal(),(m=this.callbacks)!==null&&m!==void 0&&m.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},P.load=function(m,p,f){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=m,this.config=p,this.callbacks=f,this.retryDelay=p.retryDelay,this.loadInternal()},P.loadInternal=function(){var m=this.config,p=this.context;if(!m)return;var f=this.loader=new self.XMLHttpRequest,h=this.stats;h.loading.first=0,h.loaded=0;var s=this.xhrSetup;try{if(s)try{s(f,p.url)}catch(a){f.open("GET",p.url,!0),s(f,p.url)}f.readyState||f.open("GET",p.url,!0);var u=this.context.headers;if(u)for(var l in u)f.setRequestHeader(l,u[l])}catch(a){this.callbacks.onError({code:f.status,text:a.message},p,f);return}p.rangeEnd&&f.setRequestHeader("Range","bytes="+p.rangeStart+"-"+(p.rangeEnd-1)),f.onreadystatechange=this.readystatechange.bind(this),f.onprogress=this.loadprogress.bind(this),f.responseType=p.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),m.timeout),f.send()},P.readystatechange=function(){var m=this.context,p=this.loader,f=this.stats;if(!m||!p)return;var h=p.readyState,s=this.config;if(f.aborted)return;if(h>=2)if(self.clearTimeout(this.requestTimeout),f.loading.first===0&&(f.loading.first=Math.max(self.performance.now(),f.loading.start)),h===4){p.onreadystatechange=null,p.onprogress=null;var u=p.status;if(u>=200&&u<300){f.loading.end=Math.max(self.performance.now(),f.loading.first);var l,a;if(m.responseType==="arraybuffer"?(l=p.response,a=l.byteLength):(l=p.responseText,a=l.length),f.loaded=f.total=a,!this.callbacks)return;var o=this.callbacks.onProgress;if(o&&o(f,m,l,p),!this.callbacks)return;var c={url:p.responseURL,data:l};this.callbacks.onSuccess(c,f,m,p)}else f.retry>=s.maxRetry||u>=400&&u<499?(Q.logger.error(u+" while loading "+m.url),this.callbacks.onError({code:u,text:p.statusText},m,p)):(Q.logger.warn(u+" while loading "+m.url+", retrying in "+this.retryDelay+"..."),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,s.maxRetryDelay),f.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),s.timeout)},P.loadtimeout=function(){Q.logger.warn("timeout while loading "+this.context.url);var m=this.callbacks;m&&(this.abortInternal(),m.onTimeout(this.stats,this.context,this.loader))},P.loadprogress=function(m){var p=this.stats;p.loaded=m.loaded,m.lengthComputable&&(p.total=m.total)},P.getCacheAge=function(){var m=null;if(this.loader&&N.test(this.loader.getAllResponseHeaders())){var p=this.loader.getResponseHeader("age");m=p?parseFloat(p):null}return m},W}();Z.default=K}}).default})},vHTk:function(_t,ot,le){_t.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}}}]);