(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&&/$/,blockCommentStart:"",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;YY&&(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;we0,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;ve0&&(!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=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;h1&&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>> === !== &&= ??= ||= << && >= ** != == <= >> || ?? |> < / - + > : & % ? ^ | *".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(//),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=0&&p=0&&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=0&&m/),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-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=U.length?q.slice(U.length):q}).join(` `)}var l=[],a=["
    "],o=new h.a.Renderer,c=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function L(){l.length=0,a=["
      "]}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("
    • "+q.text+""),v++;var V=[];return v=T(X,v,q.level,V),V.length>0&&(U.push("
        "),V.forEach(function(be){U.push(be)}),U.push("
      ")),U.push("
    • "),v=T(X,v,C,U),v}function O(){return T(l,0,0,a),a.push("
    "),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?"

    ".concat(X,"

    "):'
    ').concat(C?X:Object(s.escape)(X,!0),`
    `):'
    '+(C?X:Object(s.escape)(X,!0))+"
    "},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}),"'+X+""},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]',"select"),this.addActionButton(U,'',"delete"),this.uiStyleSettings.clearButtonVisible&&this.addActionButton(U,'',"clear"),this.uiStyleSettings.undoButtonVisible&&this.addActionButton(U,'',"undo"),this.uiStyleSettings.redoButtonVisible&&this.addActionButton(U,'',"redo"),this.uiStyleSettings.zoomButtonVisible&&this.addActionButton(U,'',"zoom"),this.uiStyleSettings.zoomButtonVisible&&this.uiStyleSettings.zoomOutButtonVisible&&this.addActionButton(U,'',"zoom-out"),this.uiStyleSettings.notesButtonVisible&&this.addActionButton(U,'',"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='',this.overflowButton.addEventListener("click",this.overflowButtonClicked),this.markerButtonBlock.appendChild(this.overflowButton));var q=document.createElement("div");q.className=this.toolbarBlockStyleClass.name,q.style.whiteSpace="nowrap",q.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(q),this.addActionButton(q,'',"render"),this.addActionButton(q,'',"close"),this.markerjsContainer.appendChild(this.uiContainer),this.setSelectMode(),this.setCurrentMarker(),this.adjustLayout()},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;C0&&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||'')||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=` `),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||'')||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||'')||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=` `;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='',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='',v}(lt),De=function(X){function v(C,U,q,V){var be=X.call(this,C,V||'')||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='',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;gt0&&(qe=!0,gtWe&&(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='',v}(tt),ye=function(X){function v(C,U,q){var V=X.call(this,C,q||'')||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=` `,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=` `,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='',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='',v}(et),re=function(X){function v(C,U,q,V){var be=X.call(this,C,V||'')||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='',v}(ne),me='',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,''),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.width/2&&this.tipPosition.y>=this.height/2?V.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='',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='',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='',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;Uthis.editorCanvas.clientHeight?this.editorCanvas.clientHeight*v:this.editorCanvas.clientWidth,U=C',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-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),q1&&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]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''},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;Cthis.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+Uthis.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.canvasWidththis.canvasWidth&&(this.cropRect.height/=this.cropRect.width/this.canvasWidth,this.cropRect.width=this.canvasWidth),this.cropRect.height>this.canvasHeight&&(this.cropRect.width/=this.cropRect.height/this.canvasHeight,this.cropRect.height=this.canvasHeight),this.cropRect.x=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="°",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_MARGINv+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('',"Toggle grid");q.isActive=this.isGridVisible,q.onClick=function(){v.isGridVisible=!v.isGridVisible,q.isActive=v.isGridVisible},C.addButton(q);var V=new jt('',"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='',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('',"OK");Ge.onClick=this.startRenderAndClose,gt.addButton(Ge),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(Ge.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var xt=new jt('',"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('',"Rotate left");U.onClick=this.rotateLeftButtonClicked,C.addButton(U);var q=new jt('',"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('',"Flip horizontal");We.onClick=this.flipHorizontallyButtonClicked,be.addButton(We);var qe=new jt('',"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=/]*>/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("

    [TOC]

    ",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;fh.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?` `:"")+"",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?"/":""&&(L+=">"),p[u]=L}if(P.replaceSelections(p),m=P.listSelections(),!s)for(var u=0;u=0&&R[l]==m;l--)++u;p=s.to;for(var l=1;l0){for(var R=0;R1&&arguments[1]!==void 0?arguments[1]:"",R=[],m=0;mxe.length)&&(ye=xe.length);for(var _e=0,ne=new Array(ye);_e=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={"&":"&","<":"<",">":">",'"':""","'":"'"},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=0&&Ee[je]==="\\";)Me=!Me;return Me?"|":" |"}),ne=_e.split(/ \|/),re=0;if(ne.length>ye)ne.splice(ye);else for(;ne.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 ?/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;Je1||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/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]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|\\n*|\\n*|)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable: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=//,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",")|<(?: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",")|<(?: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",")|<(?:script|pre|style|!--)").replace("tag",fe._tag).getRegex(),fe.pedantic=pe({},fe.normal,{html:Ce(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\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:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\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-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,nolink:/^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",strong:{start:/^(?:(\*\*(?=[*punctuation]))|\*\*)(?![\s])|__/,middle:/^\*\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*\*$|^__(?![\s])((?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?)__$/,endAst:/[^punctuation\s]\*\*(?!\*)|[punctuation]\*\*(?!\*)(?:(?=[punctuation\s]|$))/,endUnd:/[^\s]__(?!_)(?:(?=[punctuation\s])|$)/},em:{start:/^(?:(\*(?=[punctuation]))|\*)(?![*\s])|_/,middle:/^\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*$|^_(?![_\s])(?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?_$/,endAst:/[^punctuation\s]\*(?!\*)|[punctuation]\*(?!\*)(?:(?=[punctuation\s]|$))/,endUnd:/[^\s]_(?!_)(?:(?=[punctuation\s])|$)/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:Se,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\?@\\[\\]`^{|}~",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]*?(?:(?=[\\.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;Ee0)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?'
    '+(de?ne:Fe(ne,!0))+`
    `:"
    "+(de?ne:Fe(ne,!0))+`
    `},ye.blockquote=function(ne){return`
    `+ne+`
    `},ye.html=function(ne){return ne},ye.heading=function(ne,re,de,me){return this.options.headerIds?"'+ne+" `:""+ne+" `},ye.hr=function(){return this.options.xhtml?`
    `:`
    `},ye.list=function(ne,re,de){var me=re?"ol":"ul",Ee=re&&de!==1?' start="'+de+'"':"";return"<"+me+Ee+`> `+ne+" `},ye.listitem=function(ne){return"
  • "+ne+`
  • `},ye.checkbox=function(ne){return" "},ye.paragraph=function(ne){return"

    "+ne+`

    `},ye.table=function(ne,re){return re&&(re=""+re+""),` `+ne+` `+re+`
    `},ye.tablerow=function(ne){return` `+ne+` `},ye.tablecell=function(ne,re){var de=re.header?"th":"td",me=re.align?"<"+de+' align="'+re.align+'">':"<"+de+">";return me+ne+" `},ye.strong=function(ne){return""+ne+""},ye.em=function(ne){return""+ne+""},ye.codespan=function(ne){return""+ne+""},ye.br=function(){return this.options.xhtml?"
    ":"
    "},ye.del=function(ne){return""+ne+""},ye.link=function(ne,re,de){if(ne=He(this.options.sanitize,this.options.baseUrl,ne),ne===null)return de;var me='",me},ye.image=function(ne,re,de){if(ne=He(this.options.sanitize,this.options.baseUrl,ne),ne===null)return de;var me=''+de+'":">",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;me0&&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+1An error occurred:

    "+Xe(Me.message+"",!0)+"
    ";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`,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=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;o0;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=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;D0&&(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=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;ve1&&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('')):Bt.content_type.indexOf("pdf")>-1?U.replaceSelection('
    ').concat(Bt.name,"")):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('')):(Ft==null||((Vi=Ft.type)===null||Vi===void 0)?void 0:Vi.indexOf("pdf"))>-1?bt.replaceSelection('').concat(Ft.name,"")):ne.includes(hn)?bt.replaceSelection('').concat(Ft.name,"")):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('')):(Ft==null||((Vi=Ft.type)===null||Vi===void 0)?void 0:Vi.indexOf("pdf"))>-1?bt.replaceSelection('').concat(Ft.name,"")):ne.includes(hn)?bt.replaceSelection('').concat(Ft.name,"")):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;Bt0||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);Tt0){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(`
    `),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;zt300&&(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;Fe122||(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;zeme[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=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=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=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=_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*]*(?:>|$)/],[A,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[E,/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),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="
    "+Te+"
    ",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;Ze0){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;h1&&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=0&&p=0&&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||x0&&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._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=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)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=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"\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:tn?-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;It||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;rt)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-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;r0}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.post},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.lastColumnPos0?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=e.first&&tn?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;ithis.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;ReOe&&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(;Kee.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&&eet.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.pose.options.maxHighlightLength?($=!1,z&>(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(;Jz;--$){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.highlightFrontiern;i--){var r=mt(e,i).stateAfter;if(r&&(!(r instanceof q)||i+r.lookAhead=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=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.from0&&$)for(var pt=0;pt<$.length;++pt)$[pt].to==null&&(at||(at=[])).push(new un($[pt].marker,null,null));for(var St=0;St0)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;nt)&&(!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;$=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;rt.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;ree&&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;zJ||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=$)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;I2&&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;in)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=n.lineN&&tt)&&(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=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+$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=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=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=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$e)&&(ce=Oe,ge=$e)}return ce||(ce=r[r.length-1]),ce.fromee&&(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;z0&&(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;it)&&(r.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=r.viewTo)ui&&cr(e.doc,t)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=r.lineN&&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;J0){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.viewFromn&&(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=e.display.viewTo||$.to().line0?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.005||ce<-.005)&&(bi(r.line,z),ys(r.line),r.rest))for(var ge=0;gee.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=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;if(t.topr+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.leftOe+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.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=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&&Ren)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=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.viewFromz&&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-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;zz.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=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;I0: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;i1&&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;$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-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=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=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;ie.lastLine())return;if(t.from.lineI&&(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){n1||!(this.children[0]instanceof Rr))){var $=[];this.collapse($),this.children=[new Rr($)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t50){for(var z=r.lines.length%25+25,$=z;$10);e.parent.maybeSpill()},iterN:function(e,t,n){for(var i=0;ie.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;r0||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=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.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;$=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;ie)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.linet&&(t=e.from),e.to!=null&&e.to-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var 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=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=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&&rt0==(St.level!=1),Dt=Et?at.begin:$(at.end,-1);if(St.from<=Dt&&Dt0?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.line0)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;ie&&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.lineOe.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=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;$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(Rez,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=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;$-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;iI&&(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;ge0&&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;ceJ&&(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;ee0&&ce(I.charAt(z-1));)--z;for(;$.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+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&&Ro(t,i)||{node:$[0].measure.map[2],offset:0},ee=r.linee.firstLine()&&(i=Ve(i.line-1,mt(e.doc,i.line-1).length)),r.ch==mt(e.doc,r.line).text.length&&r.linet.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);Oei.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=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 ",content:["#include "].join(` `)},{label:"#include ",content:["#include "].join(` `)},{label:"#include ",content:["#include "].join(` `)},{label:"#include ",content:["#include "].join(` `)},{label:"#include ",content:["#include "].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;G0||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(yt0||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.clientHeightp||u>m&&l=p&&a>=f?u-m-h:l>p&&af?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=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+(he1&&(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>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;Feke&&(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;d1?ie-1:0),we=1;we1?k-1:0),G=1;G=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"&&ie1&&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)?_:(jD&&(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||Gk.max?G=k.max:G=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;jD.length)&&(j=D.length);for(var H=0,k=new Array(j);H=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=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;jD.length)&&(j=D.length);for(var H=0,k=new Array(j);H=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=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=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=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:"",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;u1&&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=0&&h=0&&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=0&&f/),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.newlines0);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(/^(|]]>)$/.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("]*)/),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(//),cdata:A.starting_with(//),conditional_comment:A.starting_with(//),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("","ig"))}else this._is_content_unformatted(x)&&(A=this._input.readUntil(new RegExp("","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={"&":"&","<":"<",">":">",'"':""","'":"'"},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{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.length0},!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=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=_)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||y0&&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&&vese||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=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;oh.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-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;dY;(H0&&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=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-1&&FF.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=H-_.maxFragLookUpTolerance&&j<=k;if(D!==null&&F.duration>D&&(j"+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;R0&&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=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=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);lo&&(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;OR){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;um&&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.ccp?-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=T&&c<=O){l.time.push({startPTS:Math.max(a,u.start(w)),endPTS:Math.min(o,u.end(w))});break}else if(aT)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=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;wf&&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=L&&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;o0){S=O[0].bitrate,O.sort(function(H,k){return H.bitrate-k.bitrate}),this._levels=O;for(var F=0;Fthis.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.loadError1){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;S0){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.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=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=w.length)return;s(c,w[L].start)}function s(o,c){if(c){for(var L=o.fragments,w=o.skippedSegments;w0&&T0&&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&&E0&&(_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=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=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(_-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=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=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>>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>>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)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;lP?(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<>>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;f0?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>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;l0},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=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;Y0&&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>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;te16){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=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=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;F1;){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;jk){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.ptsS)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>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;mp.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;m2){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-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>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>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>>8&255),P.push(f&255),P=P.concat(Array.prototype.slice.call(p));for(m=0;m>>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>>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;A0?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;pefe.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(wete,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;Ue0?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=Se*H&&he0){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;ie4294967296;)O+=x;return O}function L(O){for(var A=0;A0?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;pNumber.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;fNumber.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.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;hs&&(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=L&&R=d&&Q.logger.log(this.time+" ["+d+"] "+b)},x}(),u=function(S){for(var E=[],d=0;dW&&(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=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;b0&&(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=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 ("+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=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;co.startCC||l&&l.cc=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=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"):Q}function W(m){for(var p=arguments.length,f=new Array(p>1?p-1:0),h=1;h>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;S1?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>>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;OW)&&(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;um[f].endTime)return-1;for(var h=0,s=f;h<=s;){var u=Math.floor((s+h)/2);if(pm[u].startTime&&h-1)for(var u=s,l=m.length;u=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;P1?p-1:0),h=1;h100)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=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(//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")===-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"}}}]);