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

432 lines
1.1 MiB

(window.webpackJsonp=window.webpackJsonp||[]).push([[78,5,7,20],{"+NIl":function(yt,at,ne){(function(oe){oe(ne("VrN/"))})(function(oe){"use strict";oe.defineMode("stex",function(J,k){"use strict";function $(h,o){h.cmdState.push(o)}function F(h){return h.cmdState.length>0?h.cmdState[h.cmdState.length-1]:null}function B(h){var o=h.cmdState.pop();o&&o.closeBracket()}function G(h){for(var o=h.cmdState,d=o.length-1;d>=0;d--){var s=o[d];if(s.name=="DEFAULT")continue;return s}return{styleIdentifier:function(){return null}}}function H(h,o,d){return function(){this.name=h,this.bracketNo=0,this.style=o,this.styles=d,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var D={};D.importmodule=H("importmodule","tag",["string","builtin"]),D.documentclass=H("documentclass","tag",["","atom"]),D.usepackage=H("usepackage","tag",["atom"]),D.begin=H("begin","tag",["atom"]),D.end=H("end","tag",["atom"]),D.label=H("label","tag",["atom"]),D.ref=H("ref","tag",["atom"]),D.eqref=H("eqref","tag",["atom"]),D.cite=H("cite","tag",["atom"]),D.bibitem=H("bibitem","tag",["atom"]),D.Bibitem=H("Bibitem","tag",["atom"]),D.RBibitem=H("RBibitem","tag",["atom"]),D.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function I(h,o){h.f=o}function g(h,o){var d;if(h.match(/^\\[a-zA-Z@]+/)){var s=h.current().slice(1);return d=D.hasOwnProperty(s)?D[s]:D.DEFAULT,d=new d,$(o,d),I(o,f),d.style}if(h.match(/^\\[$&%#{}_]/))return"tag";if(h.match(/^\\[,;!\/\\]/))return"tag";if(h.match("\\["))return I(o,function(l,c){return p(l,c,"\\]")}),"keyword";if(h.match("\\("))return I(o,function(l,c){return p(l,c,"\\)")}),"keyword";if(h.match("$$"))return I(o,function(l,c){return p(l,c,"$$")}),"keyword";if(h.match("$"))return I(o,function(l,c){return p(l,c,"$")}),"keyword";var a=h.next();if(a=="%")return h.skipToEnd(),"comment";if(a=="}"||a=="]"){if(d=F(o),d)d.closeBracket(a),I(o,f);else return"error";return"bracket"}else return a=="{"||a=="["?(d=D.DEFAULT,d=new d,$(o,d),"bracket"):/\d/.test(a)?(h.eatWhile(/[\w.%]/),"atom"):(h.eatWhile(/[\w\-_]/),d=G(o),d.name=="begin"&&(d.argument=h.current()),d.styleIdentifier())}function p(h,o,d){if(h.eatSpace())return null;if(d&&h.match(d))return I(o,g),"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 s=h.next();return s=="{"||s=="}"||s=="["||s=="]"||s=="("||s==")"?"bracket":s=="%"?(h.skipToEnd(),"comment"):"error"}function f(h,o){var d=h.peek(),s;return d=="{"||d=="["?(s=F(o),s.openBracket(d),h.eat(d),I(o,g),"bracket"):/[ \t\r]/.test(d)?(h.eat(d),null):(I(o,g),B(o),g(h,o))}return{startState:function(){var h=k.inMathMode?function(o,d){return p(o,d)}:g;return{cmdState:[],f:h}},copyState:function(h){return{cmdState:h.cmdState.slice(),f:h.f}},token:function(h,o){return o.f(h,o)},blankLine:function(h){h.f=g,h.cmdState.length=0},lineComment:"%"}}),oe.defineMIME("text/x-stex","stex"),oe.defineMIME("text/x-latex","stex")})},"+ua5":function(yt,at,ne){},"19Vz":function(yt,at,ne){(function(oe){oe(ne("VrN/"))})(function(oe){oe.defineOption("placeholder","",function(H,D,I){var g=I&&I!=oe.Init;if(D&&!g)H.on("blur",F),H.on("change",B),H.on("swapDoc",B),oe.on(H.getInputField(),"compositionupdate",H.state.placeholderCompose=function(){$(H)}),B(H);else if(!D&&g){H.off("blur",F),H.off("change",B),H.off("swapDoc",B),oe.off(H.getInputField(),"compositionupdate",H.state.placeholderCompose),J(H);var p=H.getWrapperElement();p.className=p.className.replace(" CodeMirror-empty","")}D&&!H.hasFocus()&&F(H)});function J(H){H.state.placeholder&&(H.state.placeholder.parentNode.removeChild(H.state.placeholder),H.state.placeholder=null)}function k(H){J(H);var D=H.state.placeholder=document.createElement("pre");D.style.cssText="height: 0; overflow: visible",D.style.direction=H.getOption("direction"),D.className="CodeMirror-placeholder CodeMirror-line-like";var I=H.getOption("placeholder");typeof I=="string"&&(I=document.createTextNode(I)),D.appendChild(I),H.display.lineSpace.insertBefore(D,H.display.lineSpace.firstChild)}function $(H){setTimeout(function(){var D=!1,I=H.getInputField();I.nodeName=="TEXTAREA"?D=!I.value:H.lineCount()==1&&(D=!/[^\u200b]/.test(I.querySelector(".CodeMirror-line").textContent)),D?k(H):J(H)},20)}function F(H){G(H)&&k(H)}function B(H){var D=H.getWrapperElement(),I=G(H);D.className=D.className.replace(" CodeMirror-empty","")+(I?" CodeMirror-empty":""),I?k(H):J(H)}function G(H){return H.lineCount()===1&&H.getLine(0)===""}})},"1eCo":function(yt,at,ne){(function(oe){oe(ne("VrN/"))})(function(oe){"use strict";var J={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},k={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};oe.defineMode("xml",function($,F){var B=$.indentUnit,G={},H=F.htmlMode?J:k;for(var D in H)G[D]=H[D];for(var D in F)G[D]=F[D];var I,g;function p(u,_){function m(P){return _.tokenize=P,P(u,_)}var v=u.next();if(v=="<")return u.eat("!")?u.eat("[")?u.match("CDATA[")?m(o("atom","]]>")):null:u.match("--")?m(o("comment","-->")):u.match("DOCTYPE",!0,!0)?(u.eatWhile(/[\w\._\-]/),m(d(1))):null:u.eat("?")?(u.eatWhile(/[\w\._\-]/),_.tokenize=o("meta","?>"),"meta"):(I=u.eat("/")?"closeTag":"openTag",_.tokenize=f,"tag bracket");if(v=="&"){var M;return u.eat("#")?u.eat("x")?M=u.eatWhile(/[a-fA-F\d]/)&&u.eat(";"):M=u.eatWhile(/[\d]/)&&u.eat(";"):M=u.eatWhile(/[\w\.\-:]/)&&u.eat(";"),M?"atom":"error"}else return u.eatWhile(/[^&<]/),null}p.isInText=!0;function f(u,_){var m=u.next();if(m==">"||m=="/"&&u.eat(">"))return _.tokenize=p,I=m==">"?"endTag":"selfcloseTag","tag bracket";if(m=="=")return I="equals",null;if(m=="<"){_.tokenize=p,_.state=c,_.tagName=_.tagStart=null;var v=_.tokenize(u,_);return v?v+" tag error":"tag error"}else return/[\'\"]/.test(m)?(_.tokenize=h(m),_.stringStartCol=u.column(),_.tokenize(u,_)):(u.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function h(u){var _=function(m,v){for(;!m.eol();)if(m.next()==u){v.tokenize=f;break}return"string"};return _.isInAttribute=!0,_}function o(u,_){return function(m,v){for(;!m.eol();){if(m.match(_)){v.tokenize=p;break}m.next()}return u}}function d(u){return function(_,m){for(var v;(v=_.next())!=null;){if(v=="<")return m.tokenize=d(u+1),m.tokenize(_,m);if(v==">")if(u==1){m.tokenize=p;break}else return m.tokenize=d(u-1),m.tokenize(_,m)}return"meta"}}function s(u,_,m){this.prev=u.context,this.tagName=_,this.indent=u.indented,this.startOfLine=m,(G.doNotIndent.hasOwnProperty(_)||u.context&&u.context.noIndent)&&(this.noIndent=!0)}function a(u){u.context&&(u.context=u.context.prev)}function l(u,_){for(var m;;){if(!u.context)return;if(m=u.context.tagName,!G.contextGrabbers.hasOwnProperty(m)||!G.contextGrabbers[m].hasOwnProperty(_))return;a(u)}}function c(u,_,m){return u=="openTag"?(m.tagStart=_.column(),R):u=="closeTag"?w:c}function R(u,_,m){return u=="word"?(m.tagName=_.current(),g="tag",A):G.allowMissingTagName&&u=="endTag"?(g="tag bracket",A(u,_,m)):(g="error",R)}function w(u,_,m){if(u=="word"){var v=_.current();return m.context&&m.context.tagName!=v&&G.implicitlyClosed.hasOwnProperty(m.context.tagName)&&a(m),m.context&&m.context.tagName==v||G.matchClosing===!1?(g="tag",x):(g="tag error",O)}else return G.allowMissingTagName&&u=="endTag"?(g="tag bracket",x(u,_,m)):(g="error",O)}function x(u,_,m){return u!="endTag"?(g="error",x):(a(m),c)}function O(u,_,m){return g="error",x(u,_,m)}function A(u,_,m){if(u=="word")return g="attribute",T;if(u=="endTag"||u=="selfcloseTag"){var v=m.tagName,M=m.tagStart;return m.tagName=m.tagStart=null,u=="selfcloseTag"||G.autoSelfClosers.hasOwnProperty(v)?l(m,v):(l(m,v),m.context=new s(m,v,M==m.indented)),c}return g="error",A}function T(u,_,m){return u=="equals"?E:(G.allowMissing||(g="error"),A(u,_,m))}function E(u,_,m){return u=="string"?b:u=="word"&&G.allowUnquoted?(g="string",A):(g="error",A(u,_,m))}function b(u,_,m){return u=="string"?b:A(u,_,m)}return{startState:function(u){var _={tokenize:p,state:c,indented:u||0,tagName:null,tagStart:null,context:null};return u!=null&&(_.baseIndent=u),_},token:function(u,_){if(!_.tagName&&u.sol()&&(_.indented=u.indentation()),u.eatSpace())return null;I=null;var m=_.tokenize(u,_);return(m||I)&&m!="comment"&&(g=null,_.state=_.state(I||m,u,_),g&&(m=g=="error"?m+" error":g)),m},indent:function(u,_,m){var v=u.context;if(u.tokenize.isInAttribute)return u.tagStart==u.indented?u.stringStartCol+1:u.indented+B;if(v&&v.noIndent)return oe.Pass;if(u.tokenize!=f&&u.tokenize!=p)return m?m.match(/^(\s*)/)[0].length:0;if(u.tagName)return G.multilineTagIndentPastTag!==!1?u.tagStart+u.tagName.length+2:u.tagStart+B*(G.multilineTagIndentFactor||1);if(G.alignCDATA&&/<!\[CDATA\[/.test(_))return 0;var M=_&&/^<(\/)?([\w_:\.-]*)/.exec(_);if(M&&M[1])for(;v;)if(v.tagName==M[2]){v=v.prev;break}else if(G.implicitlyClosed.hasOwnProperty(v.tagName))v=v.prev;else break;else if(M)for(;v;){var P=G.contextGrabbers[v.tagName];if(P&&P.hasOwnProperty(M[2]))v=v.prev;else break}for(;v&&v.prev&&!v.startOfLine;)v=v.prev;return v?v.indent+B:u.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:G.htmlMode?"html":"xml",helperType:G.htmlMode?"html":"xml",skipAttribute:function(u){u.state==E&&(u.state=A)},xmlCurrentTag:function(u){return u.tagName?{name:u.tagName,close:u.type=="closeTag"}:null},xmlCurrentContext:function(u){for(var _=[],m=u.context;m;m=m.prev)m.tagName&&_.push(m.tagName);return _.reverse()}}}),oe.defineMIME("text/xml","xml"),oe.defineMIME("application/xml","xml"),oe.mimeModes.hasOwnProperty("text/html")||oe.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"3Rgl":function(yt,at,ne){"use strict";ne.r(at);var oe=ne("+L6B"),J=ne("2/Rp"),k=ne("6UJt"),$=ne("DFOY"),F=ne("/zsF"),B=ne("PArb"),G=ne("5NDa"),H=ne("5rEg"),D=ne("OaEy"),I=ne("2fM7"),g=ne("14J3"),p=ne("BMrR"),f=ne("jCWc"),h=ne("kPKH"),o=ne("sPJy"),d=ne("bE4q"),s=ne("miYZ"),a=ne("tsqr"),l=ne("k1fw"),c=ne("9og8"),R=ne("y8nQ"),w=ne("Vl3Y"),x=ne("tJVT"),O=ne("PpiC"),A=ne("B9cy"),T=ne("Ol7k"),E=ne("lUTK"),b=ne("BvKs"),u=ne("WmNS"),_=ne.n(u),m=ne("q1tI"),v=ne.n(m),M=ne("Ot1p"),P=ne("Ty5D"),K=ne("9kvl"),V=ne("55Ip"),U=ne("gJ3r"),S=ne("m7e3"),X=ne.n(S),ee=b.a.SubMenu,ae=T.a.Content,de=T.a.Sider,Ae=function(we){var he,ce,se,re,xe,be,ke,Oe=we.graduation,Be=we.globalSetting,Ce=we.loading,De=we.user,Ne=we.dispatch,Ke=Object(O.a)(we,["graduation","globalSetting","loading","user","dispatch"]),Fe=Object(P.i)(),je=Object(P.h)(),Me=De.userInfo,et=w.a.useForm(),Je=Object(x.a)(et,1),qe=Je[0],Ze=Oe.addTopicData,dt=function(){var Xe=Object(c.a)(_.a.mark(function Ye(){var Ie,ot,tt;return _.a.wrap(function(We){for(;;)switch(We.prev=We.next){case 0:return Ie=qe.getFieldsValue(),ot=Object(l.a)({},Ie),ot.city&&(ot.province=ot.city[0],ot.city=ot.city[1]),We.next=5,Ne({type:"graduation/addTopic",payload:{coursesId:Fe.coursesId,attachment_ids:[],graduation_topic:ot}});case 5:tt=We.sent,tt.status?a.b.error(tt.message):K.d.push("/classrooms/".concat(Fe.coursesId,"/graduation_topics/").concat(Fe.categoryId));case 7:case"end":return We.stop()}},Ye)}));return function(){return Xe.apply(this,arguments)}}();return Object(m.useEffect)(function(){Ne({type:"graduation/addTopicDefaultData",payload:Object(l.a)({},Fe)})},[Fe.coursesId]),v.a.createElement("section",{className:"edu-container"},v.a.createElement("section",{className:"animated fadeIn"},v.a.createElement("aside",{className:"mt10"},Me&&v.a.createElement(d.a,{separator:">"},v.a.createElement(d.a.Item,null,v.a.createElement(V.a,{to:"".concat(Me.first_category_url)},Me==null||((he=Me.course)===null||he===void 0)?void 0:he.course_name)),v.a.createElement(d.a.Item,null,v.a.createElement(V.a,{to:"/classrooms/".concat(Fe.coursesId,"/graduation_topics/").concat(Fe.categoryId)},"\u6BD5\u8BBE\u9009\u9898")),v.a.createElement(d.a.Item,null,"\u65B0\u5EFA"))),v.a.createElement("aside",{className:[X.a.title,"mt20"].join(" ")},v.a.createElement(p.a,{style:{width:"100%"}},v.a.createElement(h.a,{flex:"1"},v.a.createElement("strong",{className:"font20 ml5"},"\u65B0\u5EFA\u6BD5\u8BBE\u9009\u9898")),v.a.createElement(h.a,null,v.a.createElement(V.a,{className:"font16 c-light-black",to:"/classrooms/".concat(Fe.coursesId,"/exercise")},"\u8FD4\u56DE"))))),v.a.createElement("section",{className:[X.a.bg,"pt30","pl30","pr30","pb30","mt20"].join(" ")},v.a.createElement(w.a,{layout:"vertical",form:qe,scrollToFirstError:!0,onFinish:function(){var Xe=Object(c.a)(_.a.mark(function Ye(Ie){return _.a.wrap(function(tt){for(;;)switch(tt.prev=tt.next){case 0:dt();case 1:case"end":return tt.stop()}},Ye)}));return function(Ye){return Xe.apply(this,arguments)}}()},v.a.createElement(w.a.Item,{name:"tea_id",label:"\u6307\u5BFC\u8001\u5E08\uFF1A",rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u6307\u5BFC\u8001\u5E08"}]},v.a.createElement(I.a,{size:"large",placeholder:"\u8BF7\u9009\u62E9\u6307\u5BFC\u8001\u5E08",style:{width:200}},(ce=Ze.teacher_list)===null||ce===void 0?void 0:ce.map(function(Xe,Ye){return v.a.createElement(I.a.Option,{value:Xe.id,key:Ye},Xe.name)}))),v.a.createElement(w.a.Item,{name:"name",label:"\u9009\u9898\u540D\u79F0\uFF1A",rules:[{required:!0,message:"\u8BF7\u586B\u5199\u8BD5\u5377\u6807\u9898"}]},v.a.createElement(H.a,{maxLength:60,size:"large",placeholder:"\u8BD5\u5377\u6807\u9898\uFF0C\u6700\u5927\u9650\u523660\u4E2A\u5B57\u7B26"})),v.a.createElement(B.a,null),v.a.createElement(w.a.Item,{label:"\u9009\u9898\u7B80\u4ECB",name:"description",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5185\u5BB9"}]},v.a.createElement(M.a,{watch:!0,placeholder:"\u8BF7\u7B80\u8981\u8BF4\u660E\u9009\u9898\u5185\u5BB9\uFF0C\u6700\u5927\u9650\u52365000\u4E2A\u5B57\u7B26"})),v.a.createElement(p.a,{gutter:[20,0]},v.a.createElement(h.a,{flex:"1"},v.a.createElement(w.a.Item,{name:"topic_type"},v.a.createElement(I.a,{size:"large",placeholder:"\u8BF7\u9009\u62E9\u9009\u9898\u7C7B\u578B"},(se=Ze.topic_type)===null||se===void 0?void 0:se.map(function(Xe,Ye){return v.a.createElement(I.a.Option,{value:Xe.id,key:Ye},Xe.name)})))),v.a.createElement(h.a,{flex:"1"},v.a.createElement(w.a.Item,{name:"topic_source"},v.a.createElement(I.a,{size:"large",placeholder:"\u8BF7\u9009\u62E9\u9009\u9898\u6765\u6E90"},(re=Ze.topic_source)===null||re===void 0?void 0:re.map(function(Xe,Ye){return v.a.createElement(I.a.Option,{value:Xe.id,key:Ye},Xe.name)})))),v.a.createElement(h.a,{flex:"1"},v.a.createElement(w.a.Item,{name:"topic_property_first"},v.a.createElement(I.a,{size:"large",placeholder:"\u8BF7\u9009\u62E9\u9009\u9898\u6027\u8D281"},(xe=Ze.topic_property_first)===null||xe===void 0?void 0:xe.map(function(Xe,Ye){return v.a.createElement(I.a.Option,{value:Xe.id,key:Ye},Xe.name)})))),v.a.createElement(h.a,{flex:"1"},v.a.createElement(w.a.Item,{name:"topic_property_second"},v.a.createElement(I.a,{size:"large",placeholder:"\u8BF7\u9009\u62E9\u9009\u9898\u6027\u8D282"},(be=Ze.topic_property_second)===null||be===void 0?void 0:be.map(function(Xe,Ye){return v.a.createElement(I.a.Option,{value:Xe.id,key:Ye},Xe.name)})))),v.a.createElement(h.a,{flex:"150px"})),v.a.createElement(B.a,null),v.a.createElement(w.a.Item,{name:"source_unit",label:"\u9009\u9898\u6765\u6E90\u5355\u4F4D\uFF1A"},v.a.createElement(H.a,{width:"200",size:"large",style:{width:200},placeholder:"\u8BF7\u586B\u5199\u6765\u6E90\u5355\u4F4D"})),v.a.createElement(w.a.Item,{name:"topic_repeat",label:"\u9009\u9898\u91CD\u590D\u60C5\u51B5\uFF1A"},v.a.createElement(I.a,{size:"large",placeholder:"\u8BF7\u9009\u62E9\u91CD\u590D\u60C5\u51B5",style:{width:200}},(ke=Ze.topic_repeat)===null||ke===void 0?void 0:ke.map(function(Xe,Ye){return v.a.createElement(I.a.Option,{value:Xe.id,key:Ye},Xe.name)}))),v.a.createElement(w.a.Item,{name:"city",label:"\u8C03\u7814\u6216\u5B9E\u4E60\u5730\u70B9\uFF1A"},v.a.createElement($.a,{size:"large",style:{width:200},options:U.a,placeholder:"\u8BF7\u9009\u62E9\u6240\u5728\u5730"})))),v.a.createElement("aside",{className:X.a.btns},v.a.createElement(J.a,{type:"primary",onClick:function(){qe.submit()}},"\u4FDD\u5B58"),v.a.createElement(V.a,{to:"/classrooms/".concat(Fe.coursesId,"/graduation_topics/").concat(Fe.categoryId)},"\u53D6\u6D88")))};at.default=Object(K.a)(function(Ee){var we=Ee.graduation,he=Ee.loading,ce=Ee.user,se=Ee.globalSetting;return{graduation:we,globalSetting:se,user:ce,loading:he.effects}})(Ae)},"55Ip":function(yt,at,ne){"use strict";ne.d(at,"a",function(){return l});var oe=ne("Ty5D"),J=ne("dI71"),k=ne("q1tI"),$=ne.n(k),F=ne("YS25"),B=ne("17x9"),G=ne.n(B),H=ne("wx14"),D=ne("zLVn"),I=ne("9R94"),g=function(E){Object(J.a)(b,E);function b(){for(var _,m=arguments.length,v=new Array(m),M=0;M<m;M++)v[M]=arguments[M];return _=E.call.apply(E,[this].concat(v))||this,_.history=Object(F.a)(_.props),_}var u=b.prototype;return u.render=function(){return $.a.createElement(oe.c,{history:this.history,children:this.props.children})},b}($.a.Component),p=function(E){Object(J.a)(b,E);function b(){for(var _,m=arguments.length,v=new Array(m),M=0;M<m;M++)v[M]=arguments[M];return _=E.call.apply(E,[this].concat(v))||this,_.history=Object(F.b)(_.props),_}var u=b.prototype;return u.render=function(){return $.a.createElement(oe.c,{history:this.history,children:this.props.children})},b}($.a.Component),f=function(b,u){return typeof b=="function"?b(u):b},h=function(b,u){return typeof b=="string"?Object(F.c)(b,null,null,u):b},o=function(b){return b},d=$.a.forwardRef;typeof d=="undefined"&&(d=o);function s(E){return!!(E.metaKey||E.altKey||E.ctrlKey||E.shiftKey)}var a=d(function(E,b){var u=E.innerRef,_=E.navigate,m=E.onClick,v=Object(D.a)(E,["innerRef","navigate","onClick"]),M=v.target,P=Object(H.a)({},v,{onClick:function(V){try{m&&m(V)}catch(U){throw V.preventDefault(),U}!V.defaultPrevented&&V.button===0&&(!M||M==="_self")&&!s(V)&&(V.preventDefault(),_())}});return o!==d?P.ref=b||u:P.ref=u,$.a.createElement("a",P)}),l=d(function(E,b){var u=E.component,_=u===void 0?a:u,m=E.replace,v=E.to,M=E.innerRef,P=Object(D.a)(E,["component","replace","to","innerRef"]);return $.a.createElement(oe.e.Consumer,null,function(K){K||Object(I.a)(!1);var V=K.history,U=h(f(v,K.location),K.location),S=U?V.createHref(U):"",X=Object(H.a)({},P,{href:S,navigate:function(){var ae=f(v,K.location),de=m?V.replace:V.push;de(ae)}});return o!==d?X.ref=b||M:X.innerRef=M,$.a.createElement(_,X)})});if(!1)var c,R;var w=function(b){return b},x=$.a.forwardRef;typeof x=="undefined"&&(x=w);function O(){for(var E=arguments.length,b=new Array(E),u=0;u<E;u++)b[u]=arguments[u];return b.filter(function(_){return _}).join(" ")}var A=x(function(E,b){var u=E["aria-current"],_=u===void 0?"page":u,m=E.activeClassName,v=m===void 0?"active":m,M=E.activeStyle,P=E.className,K=E.exact,V=E.isActive,U=E.location,S=E.sensitive,X=E.strict,ee=E.style,ae=E.to,de=E.innerRef,Ae=Object(D.a)(E,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return $.a.createElement(oe.e.Consumer,null,function(Ee){Ee||Object(I.a)(!1);var we=U||Ee.location,he=h(f(ae,we),we),ce=he.pathname,se=ce&&ce.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),re=se?Object(oe.f)(we.pathname,{path:se,exact:K,sensitive:S,strict:X}):null,xe=!!(V?V(re,we):re),be=xe?O(P,v):P,ke=xe?Object(H.a)({},ee,{},M):ee,Oe=Object(H.a)({"aria-current":xe&&_||null,className:be,style:ke,to:he},Ae);return w!==x?Oe.ref=b||de:Oe.innerRef=de,$.a.createElement(l,Oe)})});if(!1)var T},"5VLF":function(yt,at,ne){"use strict";var oe,J;function k($,F,B){var G=function(H,D){return $.js_beautify(H,D)};return G.js=$.js_beautify,G.css=F.css_beautify,G.html=B.html_beautify,G.js_beautify=$.js_beautify,G.css_beautify=F.css_beautify,G.html_beautify=B.html_beautify,G}!(oe=[ne("6UM0"),ne("TXwP"),ne("psGv")],J=function($,F,B){return k($,F,B)}.apply(at,oe),J!==void 0&&(yt.exports=J))},"6UM0":function(yt,at,ne){var oe,J;(function(){var k;(function(){"use strict";var F=[function(D,I,g){var p=g(1).Beautifier,f=g(5).Options;function h(o,d){var s=new p(o,d);return s.beautify()}D.exports=h,D.exports.defaultOptions=function(){return new f}},function(D,I,g){var p=g(2).Output,f=g(3).Token,h=g(4),o=g(5).Options,d=g(7).Tokenizer,s=g(7).line_starters,a=g(7).positionable_operators,l=g(7).TOKEN;function c(S,X){return X.indexOf(S)!==-1}function R(S){return S.replace(/^\s+/g,"")}function w(S){for(var X={},ee=0;ee<S.length;ee++)X[S[ee].replace(/-/g,"_")]=S[ee];return X}function x(S,X){return S&&S.type===l.RESERVED&&S.text===X}function O(S,X){return S&&S.type===l.RESERVED&&c(S.text,X)}var A=["case","return","do","if","throw","else","await","break","continue","async"],T=["before-newline","after-newline","preserve-newline"],E=w(T),b=[E.before_newline,E.preserve_newline],u={BlockStatement:"BlockStatement",Statement:"Statement",ObjectLiteral:"ObjectLiteral",ArrayLiteral:"ArrayLiteral",ForInitializer:"ForInitializer",Conditional:"Conditional",Expression:"Expression"};function _(S,X){if(X.multiline_frame||X.mode===u.ForInitializer||X.mode===u.Conditional)return;S.remove_indent(X.start_line_index)}function m(S){S=S.replace(h.allLineBreaks,`
`);for(var X=[],ee=S.indexOf(`
`);ee!==-1;)X.push(S.substring(0,ee)),S=S.substring(ee+1),ee=S.indexOf(`
`);return S.length&&X.push(S),X}function v(S){return S===u.ArrayLiteral}function M(S){return c(S,[u.Expression,u.ForInitializer,u.Conditional])}function P(S,X){for(var ee=0;ee<S.length;ee++){var ae=S[ee].trim();if(ae.charAt(0)!==X)return!1}return!0}function K(S,X){for(var ee=0,ae=S.length,de;ee<ae;ee++)if(de=S[ee],de&&de.indexOf(X)!==0)return!1;return!0}function V(S,X){X=X||{},this._source_text=S||"",this._output=null,this._tokens=null,this._last_last_text=null,this._flags=null,this._previous_flags=null,this._flag_store=null,this._options=new o(X)}V.prototype.create_flags=function(S,X){var ee=0;S&&(ee=S.indentation_level,!this._output.just_added_newline()&&S.line_indent_level>ee&&(ee=S.line_indent_level));var ae={mode:X,parent:S,last_token:S?S.last_token:new f(l.START_BLOCK,""),last_word:S?S.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:ee,alignment:0,line_indent_level:S?S.line_indent_level:ee,start_line_index:this._output.get_line_number(),ternary_depth:0};return ae},V.prototype._reset=function(S){var X=S.match(/^[\t ]*/)[0];this._last_last_text="",this._output=new p(this._options,X),this._output.raw=this._options.test_output_raw,this._flag_store=[],this.set_mode(u.BlockStatement);var ee=new d(S,this._options);return this._tokens=ee.tokenize(),S},V.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var S,X=this._reset(this._source_text),ee=this._options.eol;this._options.eol==="auto"&&(ee=`
`,X&&h.lineBreak.test(X||"")&&(ee=X.match(h.lineBreak)[0]));for(var ae=this._tokens.next();ae;)this.handle_token(ae),this._last_last_text=this._flags.last_token.text,this._flags.last_token=ae,ae=this._tokens.next();return S=this._output.get_code(ee),S},V.prototype.handle_token=function(S,X){S.type===l.START_EXPR?this.handle_start_expr(S):S.type===l.END_EXPR?this.handle_end_expr(S):S.type===l.START_BLOCK?this.handle_start_block(S):S.type===l.END_BLOCK?this.handle_end_block(S):S.type===l.WORD?this.handle_word(S):S.type===l.RESERVED?this.handle_word(S):S.type===l.SEMICOLON?this.handle_semicolon(S):S.type===l.STRING?this.handle_string(S):S.type===l.EQUALS?this.handle_equals(S):S.type===l.OPERATOR?this.handle_operator(S):S.type===l.COMMA?this.handle_comma(S):S.type===l.BLOCK_COMMENT?this.handle_block_comment(S,X):S.type===l.COMMENT?this.handle_comment(S,X):S.type===l.DOT?this.handle_dot(S):S.type===l.EOF?this.handle_eof(S):S.type===l.UNKNOWN?this.handle_unknown(S,X):this.handle_unknown(S,X)},V.prototype.handle_whitespace_and_comments=function(S,X){var ee=S.newlines,ae=this._options.keep_array_indentation&&v(this._flags.mode);if(S.comments_before)for(var de=S.comments_before.next();de;)this.handle_whitespace_and_comments(de,X),this.handle_token(de,X),de=S.comments_before.next();if(ae)for(var Ae=0;Ae<ee;Ae+=1)this.print_newline(Ae>0,X);else if(this._options.max_preserve_newlines&&ee>this._options.max_preserve_newlines&&(ee=this._options.max_preserve_newlines),this._options.preserve_newlines&&ee>1){this.print_newline(!1,X);for(var Ee=1;Ee<ee;Ee+=1)this.print_newline(!0,X)}};var U=["async","break","continue","return","throw","yield"];V.prototype.allow_wrap_or_preserved_newline=function(S,X){if(X=X===void 0?!1:X,this._output.just_added_newline())return;var ee=this._options.preserve_newlines&&S.newlines||X,ae=c(this._flags.last_token.text,a)||c(S.text,a);if(ae){var de=c(this._flags.last_token.text,a)&&c(this._options.operator_position,b)||c(S.text,a);ee=ee&&de}if(ee)this.print_newline(!1,!0);else if(this._options.wrap_line_length){if(O(this._flags.last_token,U))return;this._output.set_wrap_point()}},V.prototype.print_newline=function(S,X){if(!X&&(this._flags.last_token.text!==";"&&this._flags.last_token.text!==","&&this._flags.last_token.text!=="="&&(this._flags.last_token.type!==l.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++")))for(var ee=this._tokens.peek();this._flags.mode===u.Statement&&!(this._flags.if_block&&x(ee,"else"))&&!this._flags.do_block;)this.restore_mode();this._output.add_new_line(S)&&(this._flags.multiline_frame=!0)},V.prototype.print_token_line_indentation=function(S){this._output.just_added_newline()&&(this._options.keep_array_indentation&&S.newlines&&(S.text==="["||v(this._flags.mode))?(this._output.current_line.set_indent(-1),this._output.current_line.push(S.whitespace_before),this._output.space_before_token=!1):this._output.set_indent(this._flags.indentation_level,this._flags.alignment)&&(this._flags.line_indent_level=this._flags.indentation_level))},V.prototype.print_token=function(S){if(this._output.raw){this._output.add_raw_token(S);return}if(this._options.comma_first&&S.previous&&S.previous.type===l.COMMA&&this._output.just_added_newline()&&this._output.previous_line.last()===","){var X=this._output.previous_line.pop();this._output.previous_line.is_empty()&&(this._output.previous_line.push(X),this._output.trim(!0),this._output.current_line.pop(),this._output.trim()),this.print_token_line_indentation(S),this._output.add_token(","),this._output.space_before_token=!0}this.print_token_line_indentation(S),this._output.non_breaking_space=!0,this._output.add_token(S.text),this._output.previous_token_wrapped&&(this._flags.multiline_frame=!0)},V.prototype.indent=function(){this._flags.indentation_level+=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},V.prototype.deindent=function(){this._flags.indentation_level>0&&(!this._flags.parent||this._flags.indentation_level>this._flags.parent.indentation_level)&&(this._flags.indentation_level-=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},V.prototype.set_mode=function(S){this._flags?(this._flag_store.push(this._flags),this._previous_flags=this._flags):this._previous_flags=this.create_flags(null,S),this._flags=this.create_flags(this._previous_flags,S),this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},V.prototype.restore_mode=function(){this._flag_store.length>0&&(this._previous_flags=this._flags,this._flags=this._flag_store.pop(),this._previous_flags.mode===u.Statement&&_(this._output,this._previous_flags),this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},V.prototype.start_of_object_property=function(){return this._flags.parent.mode===u.ObjectLiteral&&this._flags.mode===u.Statement&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||O(this._flags.last_token,["get","set"]))},V.prototype.start_of_statement=function(S){var X=!1;return X=X||O(this._flags.last_token,["var","let","const"])&&S.type===l.WORD,X=X||x(this._flags.last_token,"do"),X=X||!(this._flags.parent.mode===u.ObjectLiteral&&this._flags.mode===u.Statement)&&O(this._flags.last_token,U)&&!S.newlines,X=X||x(this._flags.last_token,"else")&&!(x(S,"if")&&!S.comments_before),X=X||this._flags.last_token.type===l.END_EXPR&&(this._previous_flags.mode===u.ForInitializer||this._previous_flags.mode===u.Conditional),X=X||this._flags.last_token.type===l.WORD&&this._flags.mode===u.BlockStatement&&!this._flags.in_case&&!(S.text==="--"||S.text==="++")&&this._last_last_text!=="function"&&S.type!==l.WORD&&S.type!==l.RESERVED,X=X||this._flags.mode===u.ObjectLiteral&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||O(this._flags.last_token,["get","set"])),X?(this.set_mode(u.Statement),this.indent(),this.handle_whitespace_and_comments(S,!0),this.start_of_object_property()||this.allow_wrap_or_preserved_newline(S,O(S,["do","for","if","while"])),!0):!1},V.prototype.handle_start_expr=function(S){this.start_of_statement(S)||this.handle_whitespace_and_comments(S);var X=u.Expression;if(S.text==="["){if(this._flags.last_token.type===l.WORD||this._flags.last_token.text===")"){O(this._flags.last_token,s)&&(this._output.space_before_token=!0),this.print_token(S),this.set_mode(X),this.indent(),this._options.space_in_paren&&(this._output.space_before_token=!0);return}X=u.ArrayLiteral,v(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,[l.START_EXPR,l.END_EXPR,l.WORD,l.OPERATOR,l.DOT])||(this._output.space_before_token=!0)}else{if(this._flags.last_token.type===l.RESERVED)this._flags.last_token.text==="for"?(this._output.space_before_token=this._options.space_before_conditional,X=u.ForInitializer):c(this._flags.last_token.text,["if","while","switch"])?(this._output.space_before_token=this._options.space_before_conditional,X=u.Conditional):c(this._flags.last_word,["await","async"])?this._output.space_before_token=!0:this._flags.last_token.text==="import"&&S.whitespace_before===""?this._output.space_before_token=!1:(c(this._flags.last_token.text,s)||this._flags.last_token.text==="catch")&&(this._output.space_before_token=!0);else if(this._flags.last_token.type===l.EQUALS||this._flags.last_token.type===l.OPERATOR)this.start_of_object_property()||this.allow_wrap_or_preserved_newline(S);else if(this._flags.last_token.type===l.WORD){this._output.space_before_token=!1;var ee=this._tokens.peek(-3);if(this._options.space_after_named_function&&ee){var ae=this._tokens.peek(-4);O(ee,["async","function"])||ee.text==="*"&&O(ae,["async","function"])?this._output.space_before_token=!0:this._flags.mode===u.ObjectLiteral?(ee.text==="{"||ee.text===","||ee.text==="*"&&(ae.text==="{"||ae.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(S);(this._flags.last_token.type===l.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===u.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===l.START_BLOCK?this.print_newline():(this._flags.last_token.type===l.END_EXPR||this._flags.last_token.type===l.START_EXPR||this._flags.last_token.type===l.END_BLOCK||this._flags.last_token.text==="."||this._flags.last_token.type===l.COMMA)&&this.allow_wrap_or_preserved_newline(S,S.newlines),this.print_token(S),this.set_mode(X),this._options.space_in_paren&&(this._output.space_before_token=!0),this.indent()},V.prototype.handle_end_expr=function(S){for(;this._flags.mode===u.Statement;)this.restore_mode();this.handle_whitespace_and_comments(S),this._flags.multiline_frame&&this.allow_wrap_or_preserved_newline(S,S.text==="]"&&v(this._flags.mode)&&!this._options.keep_array_indentation),this._options.space_in_paren&&(this._flags.last_token.type===l.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(S),this.restore_mode(),_(this._output,this._previous_flags),this._flags.do_while&&this._previous_flags.mode===u.Conditional&&(this._previous_flags.mode=u.Expression,this._flags.do_block=!1,this._flags.do_while=!1)},V.prototype.handle_start_block=function(S){this.handle_whitespace_and_comments(S);var X=this._tokens.peek(),ee=this._tokens.peek(1);this._flags.last_word==="switch"&&this._flags.last_token.type===l.END_EXPR?(this.set_mode(u.BlockStatement),this._flags.in_case_statement=!0):this._flags.case_body?this.set_mode(u.BlockStatement):ee&&(c(ee.text,[":",","])&&c(X.type,[l.STRING,l.WORD,l.RESERVED])||c(X.text,["get","set","..."])&&c(ee.type,[l.WORD,l.RESERVED]))?c(this._last_last_text,["class","interface"])&&!c(ee.text,[":",","])?this.set_mode(u.BlockStatement):this.set_mode(u.ObjectLiteral):this._flags.last_token.type===l.OPERATOR&&this._flags.last_token.text==="=>"?this.set_mode(u.BlockStatement):c(this._flags.last_token.type,[l.EQUALS,l.START_EXPR,l.COMMA,l.OPERATOR])||O(this._flags.last_token,["return","throw","import","default"])?this.set_mode(u.ObjectLiteral):this.set_mode(u.BlockStatement),this._flags.last_token&&(O(this._flags.last_token.previous,["class","extends"])&&(this._flags.class_start_block=!0));var ae=!X.comments_before&&X.text==="}",de=ae&&this._flags.last_word==="function"&&this._flags.last_token.type===l.END_EXPR;if(this._options.brace_preserve_inline){var Ae=0,Ee=null;this._flags.inline_frame=!0;do if(Ae+=1,Ee=this._tokens.peek(Ae-1),Ee.newlines){this._flags.inline_frame=!1;break}while(Ee.type!==l.EOF&&!(Ee.type===l.END_BLOCK&&Ee.opened===S))}(this._options.brace_style==="expand"||this._options.brace_style==="none"&&S.newlines)&&!this._flags.inline_frame?this._flags.last_token.type!==l.OPERATOR&&(de||this._flags.last_token.type===l.EQUALS||O(this._flags.last_token,A)&&this._flags.last_token.text!=="else")?this._output.space_before_token=!0:this.print_newline(!1,!0):(v(this._previous_flags.mode)&&(this._flags.last_token.type===l.START_EXPR||this._flags.last_token.type===l.COMMA)&&((this._flags.last_token.type===l.COMMA||this._options.space_in_paren)&&(this._output.space_before_token=!0),(this._flags.last_token.type===l.COMMA||this._flags.last_token.type===l.START_EXPR&&this._flags.inline_frame)&&(this.allow_wrap_or_preserved_newline(S),this._previous_flags.multiline_frame=this._previous_flags.multiline_frame||this._flags.multiline_frame,this._flags.multiline_frame=!1)),this._flags.last_token.type!==l.OPERATOR&&this._flags.last_token.type!==l.START_EXPR&&(this._flags.last_token.type===l.START_BLOCK&&!this._flags.inline_frame?this.print_newline():this._output.space_before_token=!0)),this.print_token(S),this.indent(),!ae&&!(this._options.brace_preserve_inline&&this._flags.inline_frame)&&this.print_newline()},V.prototype.handle_end_block=function(S){for(this.handle_whitespace_and_comments(S);this._flags.mode===u.Statement;)this.restore_mode();var X=this._flags.last_token.type===l.START_BLOCK;this._flags.inline_frame&&!X?this._output.space_before_token=!0:this._options.brace_style==="expand"?X||this.print_newline():X||(v(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(S)},V.prototype.handle_word=function(S){if(S.type===l.RESERVED){if(c(S.text,["set","get"])&&this._flags.mode!==u.ObjectLiteral)S.type=l.WORD;else if(S.text==="import"&&c(this._tokens.peek().text,["(","."]))S.type=l.WORD;else if(c(S.text,["as","from"])&&!this._flags.import_block)S.type=l.WORD;else if(this._flags.mode===u.ObjectLiteral){var X=this._tokens.peek();X.text===":"&&(S.type=l.WORD)}}if(this.start_of_statement(S)?O(this._flags.last_token,["var","let","const"])&&S.type===l.WORD&&(this._flags.declaration_statement=!0):S.newlines&&!M(this._flags.mode)&&(this._flags.last_token.type!==l.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++")&&this._flags.last_token.type!==l.EQUALS&&(this._options.preserve_newlines||!O(this._flags.last_token,["var","let","const","set","get"]))?(this.handle_whitespace_and_comments(S),this.print_newline()):this.handle_whitespace_and_comments(S),this._flags.do_block&&!this._flags.do_while)if(x(S,"while")){this._output.space_before_token=!0,this.print_token(S),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&&x(S,"else"))this._flags.else_block=!0;else{for(;this._flags.mode===u.Statement;)this.restore_mode();this._flags.if_block=!1,this._flags.else_block=!1}if(this._flags.in_case_statement&&O(S,["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(S),this._flags.in_case=!0;return}if((this._flags.last_token.type===l.COMMA||this._flags.last_token.type===l.START_EXPR||this._flags.last_token.type===l.EQUALS||this._flags.last_token.type===l.OPERATOR)&&(this.start_of_object_property()||this.allow_wrap_or_preserved_newline(S)),x(S,"function")){(c(this._flags.last_token.text,["}",";"])||this._output.just_added_newline()&&!(c(this._flags.last_token.text,["(","[","{",":","=",","])||this._flags.last_token.type===l.OPERATOR))&&(!this._output.just_added_blankline()&&!S.comments_before&&(this.print_newline(),this.print_newline(!0))),this._flags.last_token.type===l.RESERVED||this._flags.last_token.type===l.WORD?O(this._flags.last_token,["get","set","new","export"])||O(this._flags.last_token,U)?this._output.space_before_token=!0:x(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===l.OPERATOR||this._flags.last_token.text==="="?this._output.space_before_token=!0:!this._flags.multiline_frame&&(M(this._flags.mode)||v(this._flags.mode))||this.print_newline(),this.print_token(S),this._flags.last_word=S.text;return}var ee="NONE";if(this._flags.last_token.type===l.END_BLOCK?this._previous_flags.inline_frame?ee="SPACE":O(S,["else","catch","finally","from"])?this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&S.newlines?ee="NEWLINE":(ee="SPACE",this._output.space_before_token=!0):ee="NEWLINE":this._flags.last_token.type===l.SEMICOLON&&this._flags.mode===u.BlockStatement?ee="NEWLINE":this._flags.last_token.type===l.SEMICOLON&&M(this._flags.mode)?ee="SPACE":this._flags.last_token.type===l.STRING?ee="NEWLINE":this._flags.last_token.type===l.RESERVED||this._flags.last_token.type===l.WORD||this._flags.last_token.text==="*"&&(c(this._last_last_text,["function","yield"])||this._flags.mode===u.ObjectLiteral&&c(this._last_last_text,["{",","]))?ee="SPACE":this._flags.last_token.type===l.START_BLOCK?this._flags.inline_frame?ee="SPACE":ee="NEWLINE":this._flags.last_token.type===l.END_EXPR&&(this._output.space_before_token=!0,ee="NEWLINE"),O(S,s)&&this._flags.last_token.text!==")"&&(this._flags.inline_frame||this._flags.last_token.text==="else"||this._flags.last_token.text==="export"?ee="SPACE":ee="NEWLINE"),O(S,["else","catch","finally"]))if((!(this._flags.last_token.type===l.END_BLOCK&&this._previous_flags.mode===u.BlockStatement)||this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&S.newlines)&&!this._flags.inline_frame)this.print_newline();else{this._output.trim(!0);var ae=this._output.current_line;ae.last()!=="}"&&this.print_newline(),this._output.space_before_token=!0}else ee==="NEWLINE"?O(this._flags.last_token,A)?this._output.space_before_token=!0:this._flags.last_token.text==="declare"&&O(S,["var","let","const"])?this._output.space_before_token=!0:this._flags.last_token.type!==l.END_EXPR?(this._flags.last_token.type!==l.START_EXPR||!O(S,["var","let","const"]))&&this._flags.last_token.text!==":"&&(x(S,"if")&&x(S.previous,"else")?this._output.space_before_token=!0:this.print_newline()):O(S,s)&&this._flags.last_token.text!==")"&&this.print_newline():this._flags.multiline_frame&&v(this._flags.mode)&&this._flags.last_token.text===","&&this._last_last_text==="}"?this.print_newline():ee==="SPACE"&&(this._output.space_before_token=!0);S.previous&&(S.previous.type===l.WORD||S.previous.type===l.RESERVED)&&(this._output.space_before_token=!0),this.print_token(S),this._flags.last_word=S.text,S.type===l.RESERVED&&(S.text==="do"?this._flags.do_block=!0:S.text==="if"?this._flags.if_block=!0:S.text==="import"?this._flags.import_block=!0:this._flags.import_block&&x(S,"from")&&(this._flags.import_block=!1))},V.prototype.handle_semicolon=function(S){this.start_of_statement(S)?this._output.space_before_token=!1:this.handle_whitespace_and_comments(S);for(var X=this._tokens.peek();this._flags.mode===u.Statement&&!(this._flags.if_block&&x(X,"else"))&&!this._flags.do_block;)this.restore_mode();this._flags.import_block&&(this._flags.import_block=!1),this.print_token(S)},V.prototype.handle_string=function(S){S.text.startsWith("`")&&S.newlines===0&&S.whitespace_before===""&&(S.previous.text===")"||this._flags.last_token.type===l.WORD)||(this.start_of_statement(S)?this._output.space_before_token=!0:(this.handle_whitespace_and_comments(S),this._flags.last_token.type===l.RESERVED||this._flags.last_token.type===l.WORD||this._flags.inline_frame?this._output.space_before_token=!0:this._flags.last_token.type===l.COMMA||this._flags.last_token.type===l.START_EXPR||this._flags.last_token.type===l.EQUALS||this._flags.last_token.type===l.OPERATOR?this.start_of_object_property()||this.allow_wrap_or_preserved_newline(S):S.text.startsWith("`")&&this._flags.last_token.type===l.END_EXPR&&(S.previous.text==="]"||S.previous.text===")")&&S.newlines===0?this._output.space_before_token=!0:this.print_newline())),this.print_token(S)},V.prototype.handle_equals=function(S){this.start_of_statement(S)||this.handle_whitespace_and_comments(S),this._flags.declaration_statement&&(this._flags.declaration_assignment=!0),this._output.space_before_token=!0,this.print_token(S),this._output.space_before_token=!0},V.prototype.handle_comma=function(S){this.handle_whitespace_and_comments(S,!0),this.print_token(S),this._output.space_before_token=!0,this._flags.declaration_statement?(M(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(S)):this._flags.mode===u.ObjectLiteral||this._flags.mode===u.Statement&&this._flags.parent.mode===u.ObjectLiteral?(this._flags.mode===u.Statement&&this.restore_mode(),this._flags.inline_frame||this.print_newline()):this._options.comma_first&&this.allow_wrap_or_preserved_newline(S)},V.prototype.handle_operator=function(S){var X=S.text==="*"&&(O(this._flags.last_token,["function","yield"])||c(this._flags.last_token.type,[l.START_BLOCK,l.COMMA,l.END_BLOCK,l.SEMICOLON])),ee=c(S.text,["-","+"])&&(c(this._flags.last_token.type,[l.START_BLOCK,l.START_EXPR,l.EQUALS,l.OPERATOR])||c(this._flags.last_token.text,s)||this._flags.last_token.text===",");if(!this.start_of_statement(S)){var ae=!X;this.handle_whitespace_and_comments(S,ae)}if(S.text==="*"&&this._flags.last_token.type===l.DOT){this.print_token(S);return}if(S.text==="::"){this.print_token(S);return}if(this._flags.last_token.type===l.OPERATOR&&c(this._options.operator_position,b)&&this.allow_wrap_or_preserved_newline(S),S.text===":"&&this._flags.in_case){this.print_token(S),this._flags.in_case=!1,this._flags.case_body=!0,this._tokens.peek().type!==l.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 de=!0,Ae=!0,Ee=!1;if(S.text===":"?this._flags.ternary_depth===0?de=!1:(this._flags.ternary_depth-=1,Ee=!0):S.text==="?"&&(this._flags.ternary_depth+=1),!ee&&!X&&this._options.preserve_newlines&&c(S.text,a)){var we=S.text===":",he=we&&Ee,ce=we&&!Ee;switch(this._options.operator_position){case E.before_newline:this._output.space_before_token=!ce,this.print_token(S),(!we||he)&&this.allow_wrap_or_preserved_newline(S),this._output.space_before_token=!0;return;case E.after_newline:this._output.space_before_token=!0,!we||he?this._tokens.peek().newlines?this.print_newline(!1,!0):this.allow_wrap_or_preserved_newline(S):this._output.space_before_token=!1,this.print_token(S),this._output.space_before_token=!0;return;case E.preserve_newline:ce||this.allow_wrap_or_preserved_newline(S),de=!(this._output.just_added_newline()||ce),this._output.space_before_token=de,this.print_token(S),this._output.space_before_token=!0;return}}if(X){this.allow_wrap_or_preserved_newline(S),de=!1;var se=this._tokens.peek();Ae=se&&c(se.type,[l.WORD,l.RESERVED])}else if(S.text==="...")this.allow_wrap_or_preserved_newline(S),de=this._flags.last_token.type===l.START_BLOCK,Ae=!1;else if(c(S.text,["--","++","!","~"])||ee){if((this._flags.last_token.type===l.COMMA||this._flags.last_token.type===l.START_EXPR)&&this.allow_wrap_or_preserved_newline(S),de=!1,Ae=!1,S.newlines&&(S.text==="--"||S.text==="++"||S.text==="~")){var re=O(this._flags.last_token,A)&&S.newlines;re&&(this._previous_flags.if_block||this._previous_flags.else_block)&&this.restore_mode(),this.print_newline(re,!0)}this._flags.last_token.text===";"&&M(this._flags.mode)&&(de=!0),this._flags.last_token.type===l.RESERVED?de=!0:this._flags.last_token.type===l.END_EXPR?de=!(this._flags.last_token.text==="]"&&(S.text==="--"||S.text==="++")):this._flags.last_token.type===l.OPERATOR&&(de=c(S.text,["--","-","++","+"])&&c(this._flags.last_token.text,["--","-","++","+"]),c(S.text,["+","-"])&&c(this._flags.last_token.text,["--","++"])&&(Ae=!0)),(this._flags.mode===u.BlockStatement&&!this._flags.inline_frame||this._flags.mode===u.Statement)&&(this._flags.last_token.text==="{"||this._flags.last_token.text===";")&&this.print_newline()}this._output.space_before_token=this._output.space_before_token||de,this.print_token(S),this._output.space_before_token=Ae},V.prototype.handle_block_comment=function(S,X){if(this._output.raw){this._output.add_raw_token(S),S.directives&&S.directives.preserve==="end"&&(this._output.raw=this._options.test_output_raw);return}if(S.directives){this.print_newline(!1,X),this.print_token(S),S.directives.preserve==="start"&&(this._output.raw=!0),this.print_newline(!1,!0);return}if(!h.newline.test(S.text)&&!S.newlines){this._output.space_before_token=!0,this.print_token(S),this._output.space_before_token=!0;return}else this.print_block_commment(S,X)},V.prototype.print_block_commment=function(S,X){var ee=m(S.text),ae,de=!1,Ae=!1,Ee=S.whitespace_before,we=Ee.length;if(this.print_newline(!1,X),this.print_token_line_indentation(S),this._output.add_token(ee[0]),this.print_newline(!1,X),ee.length>1){for(ee=ee.slice(1),de=P(ee,"*"),Ae=K(ee,Ee),de&&(this._flags.alignment=1),ae=0;ae<ee.length;ae++)de?(this.print_token_line_indentation(S),this._output.add_token(R(ee[ae]))):Ae&&ee[ae]?(this.print_token_line_indentation(S),this._output.add_token(ee[ae].substring(we))):(this._output.current_line.set_indent(-1),this._output.add_token(ee[ae])),this.print_newline(!1,X);this._flags.alignment=0}},V.prototype.handle_comment=function(S,X){S.newlines?this.print_newline(!1,X):this._output.trim(!0),this._output.space_before_token=!0,this.print_token(S),this.print_newline(!1,X)},V.prototype.handle_dot=function(S){this.start_of_statement(S)||this.handle_whitespace_and_comments(S,!0),this._flags.last_token.text.match("^[0-9]+$")&&(this._output.space_before_token=!0),O(this._flags.last_token,A)?this._output.space_before_token=!1:this.allow_wrap_or_preserved_newline(S,this._flags.last_token.text===")"&&this._options.break_chained_methods),this._options.unindent_chained_methods&&this._output.just_added_newline()&&this.deindent(),this.print_token(S)},V.prototype.handle_unknown=function(S,X){this.print_token(S),S.text[S.text.length-1]===`
`&&this.print_newline(!1,X)},V.prototype.handle_eof=function(S){for(;this._flags.mode===u.Statement;)this.restore_mode();this.handle_whitespace_and_comments(S)},D.exports.Beautifier=V},function(D){function I(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=[]}I.prototype.clone_empty=function(){var f=new I(this.__parent);return f.set_indent(this.__indent_count,this.__alignment_count),f},I.prototype.item=function(f){return f<0?this.__items[this.__items.length+f]:this.__items[f]},I.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},I.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))},I.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)},I.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},I.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},I.prototype.is_empty=function(){return this.__items.length===0},I.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},I.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},I.prototype.pop=function(){var f=null;return this.is_empty()||(f=this.__items.pop(),this.__character_count-=f.length),f},I.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},I.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},I.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},I.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 g(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}g.prototype.get_indent_size=function(f,h){var o=this.__base_string_length;return h=h||0,f<0&&(o=0),o+=f*this.__indent_size,o+=h,o},g.prototype.get_indent_string=function(f,h){var o=this.__base_string;return h=h||0,f<0&&(f=0,o=""),h+=f*this.__indent_size,this.__ensure_cache(h),o+=this.__cache[h],o},g.prototype.__ensure_cache=function(f){for(;f>=this.__cache.length;)this.__add_column()},g.prototype.__add_column=function(){var f=this.__cache.length,h=0,o="";this.__indent_size&&f>=this.__indent_size&&(h=Math.floor(f/this.__indent_size),f-=h*this.__indent_size,o=new Array(h+1).join(this.__indent_string)),f&&(o+=new Array(f+1).join(" ")),this.__cache.push(o)};function p(f,h){this.__indent_cache=new g(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 I(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 o=this.__lines.join(`
`);return f!==`
`&&(o=o.replace(/[\n]/g,f)),o},p.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},p.prototype.set_indent=function(f,h){return f=f||0,h=h||0,this.next_line.set_indent(f,h),this.__lines.length>1?(this.current_line.set_indent(f,h),!0):(this.current_line.set_indent(),!1)},p.prototype.add_raw_token=function(f){for(var h=0;h<f.newlines;h++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(f.whitespace_before),this.current_line.push(f.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},p.prototype.add_token=function(f){this.__add_space_before_token(),this.current_line.push(f),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},p.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},p.prototype.remove_indent=function(f){for(var h=this.__lines.length;f<h;)this.__lines[f]._remove_indent(),f++;this.current_line._remove_wrap_indent()},p.prototype.trim=function(f){for(f=f===void 0?!1:f,this.current_line.trim();f&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},p.prototype.just_added_newline=function(){return this.current_line.is_empty()},p.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},p.prototype.ensure_empty_line_above=function(f,h){for(var o=this.__lines.length-2;o>=0;){var d=this.__lines[o];if(d.is_empty())break;if(d.item(0).indexOf(f)!==0&&d.item(-1)!==h){this.__lines.splice(o+1,0,new I(this)),this.previous_line=this.__lines[this.__lines.length-2];break}o--}},D.exports.Output=p},function(D){function I(g,p,f,h){this.type=g,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}D.exports.Token=I},function(D,I){var g="\\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",o="(?:\\\\u[0-9a-fA-F]{4}|["+g+f+"])",d="(?:\\\\u[0-9a-fA-F]{4}|["+p+f+h+"])*";I.identifier=new RegExp(o+d,"g"),I.identifierStart=new RegExp(o),I.identifierMatch=new RegExp("(?:\\\\u[0-9a-fA-F]{4}|["+p+f+h+"])+");var s=/[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/;I.newline=/[\n\r\u2028\u2029]/,I.lineBreak=new RegExp(`\r
|`+I.newline.source),I.allLineBreaks=new RegExp(I.lineBreak.source,"g")},function(D,I,g){var p=g(6).Options,f=["before-newline","after-newline","preserve-newline"];function h(o){p.call(this,o,"js");var d=this.raw_options.brace_style||null;d==="expand-strict"?this.raw_options.brace_style="expand":d==="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 s=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<s.length;a++)s[a]==="preserve-inline"?this.brace_preserve_inline=!0:this.brace_style=s[a];this.unindent_chained_methods=this._get_boolean("unindent_chained_methods"),this.break_chained_methods=this._get_boolean("break_chained_methods"),this.space_in_paren=this._get_boolean("space_in_paren"),this.space_in_empty_paren=this._get_boolean("space_in_empty_paren"),this.jslint_happy=this._get_boolean("jslint_happy"),this.space_after_anon_function=this._get_boolean("space_after_anon_function"),this.space_after_named_function=this._get_boolean("space_after_named_function"),this.keep_array_indentation=this._get_boolean("keep_array_indentation"),this.space_before_conditional=this._get_boolean("space_before_conditional",!0),this.unescape_strings=this._get_boolean("unescape_strings"),this.e4x=this._get_boolean("e4x"),this.comma_first=this._get_boolean("comma_first"),this.operator_position=this._get_selection("operator_position",f),this.test_output_raw=this._get_boolean("test_output_raw"),this.jslint_happy&&(this.space_after_anon_function=!0)}h.prototype=new p,D.exports.Options=h},function(D){function I(f,h){this.raw_options=g(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"])}I.prototype._get_array=function(f,h){var o=this.raw_options[f],d=h||[];return typeof o=="object"?o!==null&&typeof o.concat=="function"&&(d=o.concat()):typeof o=="string"&&(d=o.split(/[^a-zA-Z0-9_\/\-]+/)),d},I.prototype._get_boolean=function(f,h){var o=this.raw_options[f],d=o===void 0?!!h:!!o;return d},I.prototype._get_characters=function(f,h){var o=this.raw_options[f],d=h||"";return typeof o=="string"&&(d=o.replace(/\\r/,"\r").replace(/\\n/,`
`).replace(/\\t/," ")),d},I.prototype._get_number=function(f,h){var o=this.raw_options[f];h=parseInt(h,10),isNaN(h)&&(h=0);var d=parseInt(o,10);return isNaN(d)&&(d=h),d},I.prototype._get_selection=function(f,h,o){var d=this._get_selection_list(f,h,o);if(d.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 d[0]},I.prototype._get_selection_list=function(f,h,o){if(!h||h.length===0)throw new Error("Selection list cannot be empty.");if(o=o||[h[0]],!this._is_valid_selection(o,h))throw new Error("Invalid Default Value!");var d=this._get_array(f,o);if(!this._is_valid_selection(d,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 d},I.prototype._is_valid_selection=function(f,h){return f.length&&h.length&&!f.some(function(o){return h.indexOf(o)===-1})};function g(f,h){var o={};f=p(f);var d;for(d in f)d!==h&&(o[d]=f[d]);if(h&&f[h])for(d in f[h])o[d]=f[h][d];return o}function p(f){var h={},o;for(o in f){var d=o.replace(/-/g,"_");h[d]=f[o]}return h}D.exports.Options=I,D.exports.normalizeOpts=p,D.exports.mergeOpts=g},function(D,I,g){var p=g(8).InputScanner,f=g(9).Tokenizer,h=g(9).TOKEN,o=g(13).Directives,d=g(4),s=g(12).Pattern,a=g(14).TemplatablePattern;function l(P,K){return K.indexOf(P)!==-1}var c={START_EXPR:"TK_START_EXPR",END_EXPR:"TK_END_EXPR",START_BLOCK:"TK_START_BLOCK",END_BLOCK:"TK_END_BLOCK",WORD:"TK_WORD",RESERVED:"TK_RESERVED",SEMICOLON:"TK_SEMICOLON",STRING:"TK_STRING",EQUALS:"TK_EQUALS",OPERATOR:"TK_OPERATOR",COMMA:"TK_COMMA",BLOCK_COMMENT:"TK_BLOCK_COMMENT",COMMENT:"TK_COMMENT",DOT:"TK_DOT",UNKNOWN:"TK_UNKNOWN",START:h.START,RAW:h.RAW,EOF:h.EOF},R=new o(/\/\*/,/\*\//),w=/0[xX][0123456789abcdefABCDEF_]*n?|0[oO][01234567_]*n?|0[bB][01_]*n?|\d[\d_]*n|(?:\.\d[\d_]*|\d[\d_]*\.?[\d_]*)(?:[eE][+-]?[\d_]+)?/,x=/[0-9]/,O=/[^\d\.]/,A=">>> === !== &&= ??= ||= << && >= ** != == <= >> || ?? |> < / - + > : & % ? ^ | *".split(" "),T=">>>= ... >>= <<= === >>> !== **= &&= ??= ||= => ^= :: /= << <= == && -= >= >> != -- += ** || ?? ++ %= &= *= |= |> = ! ? > < : / ^ - + * & % ~ |";T=T.replace(/[-[\]{}()*+?.,\\^$|#]/g,"\\$&"),T="\\?\\.(?!\\d) "+T,T=T.replace(/ /g,"|");var E=new RegExp(T),b="continue,try,throw,return,var,let,const,if,switch,case,default,for,while,break,function,import,export".split(","),u=b.concat(["do","in","of","else","get","set","new","catch","finally","typeof","yield","async","await","from","as","class","extends"]),_=new RegExp("^(?:"+u.join("|")+")$"),m,v=function(P,K){f.call(this,P,K),this._patterns.whitespace=this._patterns.whitespace.matching(/\u00A0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff/.source,/\u2028\u2029/.source);var V=new s(this._input),U=new a(this._input).read_options(this._options);this.__patterns={template:U,identifier:U.starting_with(d.identifier).matching(d.identifierMatch),number:V.matching(w),punct:V.matching(E),comment:V.starting_with(/\/\//).until(/[\n\r\u2028\u2029]/),block_comment:V.starting_with(/\/\*/).until_after(/\*\//),html_comment_start:V.matching(/<!--/),html_comment_end:V.matching(/-->/),include:V.starting_with(/#include/).until_after(d.lineBreak),shebang:V.starting_with(/#!/).until_after(d.lineBreak),xml:V.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:U.until(/['\\\n\r\u2028\u2029]/),double_quote:U.until(/["\\\n\r\u2028\u2029]/),template_text:U.until(/[`\\$]/),template_expression:U.until(/[`}\\]/)}};v.prototype=new f,v.prototype._is_comment=function(P){return P.type===c.COMMENT||P.type===c.BLOCK_COMMENT||P.type===c.UNKNOWN},v.prototype._is_opening=function(P){return P.type===c.START_BLOCK||P.type===c.START_EXPR},v.prototype._is_closing=function(P,K){return(P.type===c.END_BLOCK||P.type===c.END_EXPR)&&K&&(P.text==="]"&&K.text==="["||P.text===")"&&K.text==="("||P.text==="}"&&K.text==="{")},v.prototype._reset=function(){m=!1},v.prototype._get_next_token=function(P,K){var V=null;this._readWhitespace();var U=this._input.peek();return U===null?this._create_token(c.EOF,""):(V=V||this._read_non_javascript(U),V=V||this._read_string(U),V=V||this._read_word(P),V=V||this._read_singles(U),V=V||this._read_comment(U),V=V||this._read_regexp(U,P),V=V||this._read_xml(U,P),V=V||this._read_punctuation(),V=V||this._create_token(c.UNKNOWN,this._input.next()),V)},v.prototype._read_word=function(P){var K;if(K=this.__patterns.identifier.read(),K!=="")return K=K.replace(d.allLineBreaks,`
`),!(P.type===c.DOT||P.type===c.RESERVED&&(P.text==="set"||P.text==="get"))&&_.test(K)?(K==="in"||K==="of")&&(P.type===c.WORD||P.type===c.STRING)?this._create_token(c.OPERATOR,K):this._create_token(c.RESERVED,K):this._create_token(c.WORD,K);if(K=this.__patterns.number.read(),K!=="")return this._create_token(c.WORD,K)},v.prototype._read_singles=function(P){var K=null;return P==="("||P==="["?K=this._create_token(c.START_EXPR,P):P===")"||P==="]"?K=this._create_token(c.END_EXPR,P):P==="{"?K=this._create_token(c.START_BLOCK,P):P==="}"?K=this._create_token(c.END_BLOCK,P):P===";"?K=this._create_token(c.SEMICOLON,P):P==="."&&O.test(this._input.peek(1))?K=this._create_token(c.DOT,P):P===","&&(K=this._create_token(c.COMMA,P)),K&&this._input.next(),K},v.prototype._read_punctuation=function(){var P=this.__patterns.punct.read();if(P!=="")return P==="="?this._create_token(c.EQUALS,P):P==="?."?this._create_token(c.DOT,P):this._create_token(c.OPERATOR,P)},v.prototype._read_non_javascript=function(P){var K="";if(P==="#"){if(this._is_first_token()&&(K=this.__patterns.shebang.read(),K))return this._create_token(c.UNKNOWN,K.trim()+`
`);if(K=this.__patterns.include.read(),K)return this._create_token(c.UNKNOWN,K.trim()+`
`);P=this._input.next();var V="#";if(this._input.hasNext()&&this._input.testChar(x)){do P=this._input.next(),V+=P;while(this._input.hasNext()&&P!=="#"&&P!=="=");return P==="#"||(this._input.peek()==="["&&this._input.peek(1)==="]"?(V+="[]",this._input.next(),this._input.next()):this._input.peek()==="{"&&this._input.peek(1)==="}"&&(V+="{}",this._input.next(),this._input.next())),this._create_token(c.WORD,V)}this._input.back()}else if(P==="<"&&this._is_first_token()){if(K=this.__patterns.html_comment_start.read(),K){for(;this._input.hasNext()&&!this._input.testChar(d.newline);)K+=this._input.next();return m=!0,this._create_token(c.COMMENT,K)}}else if(m&&P==="-"&&(K=this.__patterns.html_comment_end.read(),K))return m=!1,this._create_token(c.COMMENT,K);return null},v.prototype._read_comment=function(P){var K=null;if(P==="/"){var V="";if(this._input.peek(1)==="*"){V=this.__patterns.block_comment.read();var U=R.get_directives(V);U&&U.ignore==="start"&&(V+=R.readIgnored(this._input)),V=V.replace(d.allLineBreaks,`
`),K=this._create_token(c.BLOCK_COMMENT,V),K.directives=U}else this._input.peek(1)==="/"&&(V=this.__patterns.comment.read(),K=this._create_token(c.COMMENT,V))}return K},v.prototype._read_string=function(P){if(P==="`"||P==="'"||P==='"'){var K=this._input.next();return this.has_char_escapes=!1,P==="`"?K+=this._read_string_recursive("`",!0,"${"):K+=this._read_string_recursive(P),this.has_char_escapes&&this._options.unescape_strings&&(K=M(K)),this._input.peek()===P&&(K+=this._input.next()),K=K.replace(d.allLineBreaks,`
`),this._create_token(c.STRING,K)}return null},v.prototype._allow_regexp_or_xml=function(P){return P.type===c.RESERVED&&l(P.text,["return","case","throw","else","do","typeof","yield"])||P.type===c.END_EXPR&&P.text===")"&&P.opened.previous.type===c.RESERVED&&l(P.opened.previous.text,["if","while","for"])||l(P.type,[c.COMMENT,c.START_EXPR,c.START_BLOCK,c.START,c.END_BLOCK,c.OPERATOR,c.EQUALS,c.EOF,c.SEMICOLON,c.COMMA])},v.prototype._read_regexp=function(P,K){if(P==="/"&&this._allow_regexp_or_xml(K)){for(var V=this._input.next(),U=!1,S=!1;this._input.hasNext()&&(U||S||this._input.peek()!==P)&&!this._input.testChar(d.newline);)V+=this._input.peek(),U?U=!1:(U=this._input.peek()==="\\",this._input.peek()==="["?S=!0:this._input.peek()==="]"&&(S=!1)),this._input.next();return this._input.peek()===P&&(V+=this._input.next(),V+=this._input.read(d.identifier)),this._create_token(c.STRING,V)}return null},v.prototype._read_xml=function(P,K){if(this._options.e4x&&P==="<"&&this._allow_regexp_or_xml(K)){var V="",U=this.__patterns.xml.read_match();if(U){for(var S=U[2].replace(/^{\s+/,"{").replace(/\s+}$/,"}"),X=S.indexOf("{")===0,ee=0;U;){var ae=!!U[1],de=U[2],Ae=!!U[U.length-1]||de.slice(0,8)==="![CDATA[";if(!Ae&&(de===S||X&&de.replace(/^{\s+/,"{").replace(/\s+}$/,"}"))&&(ae?--ee:++ee),V+=U[0],ee<=0)break;U=this.__patterns.xml.read_match()}return U||(V+=this._input.match(/[\s\S]*/g)[0]),V=V.replace(d.allLineBreaks,`
`),this._create_token(c.STRING,V)}}return null};function M(P){for(var K="",V=0,U=new p(P),S=null;U.hasNext();)if(S=U.match(/([\s]|[^\\]|\\\\)+/g),S&&(K+=S[0]),U.peek()==="\\"){if(U.next(),U.peek()==="x")S=U.match(/x([0-9A-Fa-f]{2})/g);else if(U.peek()==="u")S=U.match(/u([0-9A-Fa-f]{4})/g);else{K+="\\",U.hasNext()&&(K+=U.next());continue}if(!S)return P;if(V=parseInt(S[1],16),V>126&&V<=255&&S[0].indexOf("x")===0)return P;if(V>=0&&V<32){K+="\\"+S[0];continue}else V===34||V===39||V===92?K+="\\"+String.fromCharCode(V):K+=String.fromCharCode(V)}return K}v.prototype._read_string_recursive=function(P,K,V){var U,S;P==="'"?S=this.__patterns.single_quote:P==='"'?S=this.__patterns.double_quote:P==="`"?S=this.__patterns.template_text:P==="}"&&(S=this.__patterns.template_expression);for(var X=S.read(),ee="";this._input.hasNext();){if(ee=this._input.next(),ee===P||!K&&d.newline.test(ee)){this._input.back();break}else ee==="\\"&&this._input.hasNext()?(U=this._input.peek(),U==="x"||U==="u"?this.has_char_escapes=!0:U==="\r"&&this._input.peek(1)===`
`&&this._input.next(),ee+=this._input.next()):V&&(V==="${"&&ee==="$"&&this._input.peek()==="{"&&(ee+=this._input.next()),V===ee&&(P==="`"?ee+=this._read_string_recursive("}",K,"`"):ee+=this._read_string_recursive("`",K,"${"),this._input.hasNext()&&(ee+=this._input.next())));ee+=S.read(),X+=ee}return X},D.exports.Tokenizer=v,D.exports.TOKEN=c,D.exports.positionable_operators=A.slice(),D.exports.line_starters=b.slice()},function(D){var I=RegExp.prototype.hasOwnProperty("sticky");function g(p){this.__input=p||"",this.__input_length=this.__input.length,this.__position=0}g.prototype.restart=function(){this.__position=0},g.prototype.back=function(){this.__position>0&&(this.__position-=1)},g.prototype.hasNext=function(){return this.__position<this.__input_length},g.prototype.next=function(){var p=null;return this.hasNext()&&(p=this.__input.charAt(this.__position),this.__position+=1),p},g.prototype.peek=function(p){var f=null;return p=p||0,p+=this.__position,p>=0&&p<this.__input_length&&(f=this.__input.charAt(p)),f},g.prototype.__match=function(p,f){p.lastIndex=f;var h=p.exec(this.__input);return h&&!(I&&p.sticky)&&(h.index!==f&&(h=null)),h},g.prototype.test=function(p,f){return f=f||0,f+=this.__position,f>=0&&f<this.__input_length?!!this.__match(p,f):!1},g.prototype.testChar=function(p,f){var h=this.peek(f);return p.lastIndex=0,h!==null&&p.test(h)},g.prototype.match=function(p){var f=this.__match(p,this.__position);return f?this.__position+=f[0].length:f=null,f},g.prototype.read=function(p,f,h){var o="",d;return p&&(d=this.match(p),d&&(o+=d[0])),f&&(d||!p)&&(o+=this.readUntil(f,h)),o},g.prototype.readUntil=function(p,f){var h="",o=this.__position;p.lastIndex=this.__position;var d=p.exec(this.__input);return d?(o=d.index,f&&(o+=d[0].length)):o=this.__input_length,h=this.__input.substring(this.__position,o),this.__position=o,h},g.prototype.readUntilAfter=function(p){return this.readUntil(p,!0)},g.prototype.get_regexp=function(p,f){var h=null,o="g";return f&&I&&(o="y"),typeof p=="string"&&p!==""?h=new RegExp(p,o):p&&(h=new RegExp(p.source,o)),h},g.prototype.get_literal_regexp=function(p){return RegExp(p.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},g.prototype.peekUntilAfter=function(p){var f=this.__position,h=this.readUntilAfter(p);return this.__position=f,h},g.prototype.lookBack=function(p){var f=this.__position-1;return f>=p.length&&this.__input.substring(f-p.length,f).toLowerCase()===p},D.exports.InputScanner=g},function(D,I,g){var p=g(8).InputScanner,f=g(3).Token,h=g(10).TokenStream,o=g(11).WhitespacePattern,d={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},s=function(a,l){this._input=new p(a),this._options=l||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new o(this._input)};s.prototype.tokenize=function(){this._input.restart(),this.__tokens=new h,this._reset();for(var a,l=new f(d.START,""),c=null,R=[],w=new h;l.type!==d.EOF;){for(a=this._get_next_token(l,c);this._is_comment(a);)w.add(a),a=this._get_next_token(l,c);w.isEmpty()||(a.comments_before=w,w=new h),a.parent=c,this._is_opening(a)?(R.push(c),c=a):c&&this._is_closing(a,c)&&(a.opened=c,c.closed=a,c=R.pop(),a.parent=c),a.previous=l,l.next=a,this.__tokens.add(a),l=a}return this.__tokens},s.prototype._is_first_token=function(){return this.__tokens.isEmpty()},s.prototype._reset=function(){},s.prototype._get_next_token=function(a,l){this._readWhitespace();var c=this._input.read(/.+/g);return c?this._create_token(d.RAW,c):this._create_token(d.EOF,"")},s.prototype._is_comment=function(a){return!1},s.prototype._is_opening=function(a){return!1},s.prototype._is_closing=function(a,l){return!1},s.prototype._create_token=function(a,l){var c=new f(a,l,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return c},s.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},D.exports.Tokenizer=s,D.exports.TOKEN=d},function(D){function I(g){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=g}I.prototype.restart=function(){this.__position=0},I.prototype.isEmpty=function(){return this.__tokens_length===0},I.prototype.hasNext=function(){return this.__position<this.__tokens_length},I.prototype.next=function(){var g=null;return this.hasNext()&&(g=this.__tokens[this.__position],this.__position+=1),g},I.prototype.peek=function(g){var p=null;return g=g||0,g+=this.__position,g>=0&&g<this.__tokens_length&&(p=this.__tokens[g]),p},I.prototype.add=function(g){this.__parent_token&&(g.parent=this.__parent_token),this.__tokens.push(g),this.__tokens_length+=1},D.exports.TokenStream=I},function(D,I,g){var p=g(12).Pattern;function f(h,o){p.call(this,h,o),o?this._line_regexp=this._input.get_regexp(o._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}f.prototype=new p,f.prototype.__set_whitespace_patterns=function(h,o){h+="\\t ",o+="\\n\\r",this._match_pattern=this._input.get_regexp("["+h+o+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+o+"]")},f.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var h=this._input.read(this._match_pattern);if(h===" ")this.whitespace_before_token=" ";else if(h){var o=this.__split(this._newline_regexp,h);this.newline_count=o.length-1,this.whitespace_before_token=o[this.newline_count]}return h},f.prototype.matching=function(h,o){var d=this._create();return d.__set_whitespace_patterns(h,o),d._update(),d},f.prototype._create=function(){return new f(this._input,this)},f.prototype.__split=function(h,o){h.lastIndex=0;for(var d=0,s=[],a=h.exec(o);a;)s.push(o.substring(d,a.index)),d=a.index+a[0].length,a=h.exec(o);return d<o.length?s.push(o.substring(d,o.length)):s.push(""),s},D.exports.WhitespacePattern=f},function(D){function I(g,p){this._input=g,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,p&&(this._starting_pattern=this._input.get_regexp(p._starting_pattern,!0),this._match_pattern=this._input.get_regexp(p._match_pattern,!0),this._until_pattern=this._input.get_regexp(p._until_pattern),this._until_after=p._until_after)}I.prototype.read=function(){var g=this._input.read(this._starting_pattern);return(!this._starting_pattern||g)&&(g+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),g},I.prototype.read_match=function(){return this._input.match(this._match_pattern)},I.prototype.until_after=function(g){var p=this._create();return p._until_after=!0,p._until_pattern=this._input.get_regexp(g),p._update(),p},I.prototype.until=function(g){var p=this._create();return p._until_after=!1,p._until_pattern=this._input.get_regexp(g),p._update(),p},I.prototype.starting_with=function(g){var p=this._create();return p._starting_pattern=this._input.get_regexp(g,!0),p._update(),p},I.prototype.matching=function(g){var p=this._create();return p._match_pattern=this._input.get_regexp(g,!0),p._update(),p},I.prototype._create=function(){return new I(this._input,this)},I.prototype._update=function(){},D.exports.Pattern=I},function(D){function I(g,p){g=typeof g=="string"?g:g.source,p=typeof p=="string"?p:p.source,this.__directives_block_pattern=new RegExp(g+/ beautify( \w+[:]\w+)+ /.source+p,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(g+/\sbeautify\signore:end\s/.source+p,"g")}I.prototype.get_directives=function(g){if(!g.match(this.__directives_block_pattern))return null;var p={};this.__directive_pattern.lastIndex=0;for(var f=this.__directive_pattern.exec(g);f;)p[f[1]]=f[2],f=this.__directive_pattern.exec(g);return p},I.prototype.readIgnored=function(g){return g.readUntilAfter(this.__directives_end_ignore_pattern)},D.exports.Directives=I},function(D,I,g){var p=g(12).Pattern,f={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1};function h(o,d){p.call(this,o,d),this.__template_pattern=null,this._disabled=Object.assign({},f),this._excluded=Object.assign({},f),d&&(this.__template_pattern=this._input.get_regexp(d.__template_pattern),this._excluded=Object.assign(this._excluded,d._excluded),this._disabled=Object.assign(this._disabled,d._disabled));var s=new p(o);this.__patterns={handlebars_comment:s.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:s.starting_with(/{{{/).until_after(/}}}/),handlebars:s.starting_with(/{{/).until_after(/}}/),php:s.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:s.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:s.starting_with(/{%/).until_after(/%}/),django_value:s.starting_with(/{{/).until_after(/}}/),django_comment:s.starting_with(/{#/).until_after(/#}/),smarty:s.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:s.starting_with(/{\*/).until_after(/\*}/),smarty_literal:s.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(o){var d=this._create();return d._disabled[o]=!0,d._update(),d},h.prototype.read_options=function(o){var d=this._create();for(var s in f)d._disabled[s]=o.templating.indexOf(s)===-1;return d._update(),d},h.prototype.exclude=function(o){var d=this._create();return d._excluded[o]=!0,d._update(),d},h.prototype.read=function(){var o="";this._match_pattern?o=this._input.read(this._starting_pattern):o=this._input.read(this._starting_pattern,this.__template_pattern);for(var d=this._read_template();d;)this._match_pattern?d+=this._input.read(this._match_pattern):d+=this._input.readUntil(this.__template_pattern),o+=d,d=this._read_template();return this._until_after&&(o+=this._input.readUntilAfter(this._until_pattern)),o},h.prototype.__set_templated_pattern=function(){var o=[];this._disabled.php||o.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||o.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||o.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(o.push(this.__patterns.django._starting_pattern.source),o.push(this.__patterns.django_value._starting_pattern.source),o.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||o.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&o.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+o.join("|")+")")},h.prototype._read_template=function(){var o="",d=this._input.peek();if(d==="<"){var s=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&s==="?"&&(o=o||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&s==="%"&&(o=o||this.__patterns.erb.read())}else d==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(o=o||this.__patterns.handlebars_comment.read(),o=o||this.__patterns.handlebars_unescaped.read(),o=o||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(o=o||this.__patterns.django_value.read()),this._excluded.django||(o=o||this.__patterns.django_comment.read(),o=o||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(o=o||this.__patterns.smarty_comment.read(),o=o||this.__patterns.smarty_literal.read(),o=o||this.__patterns.smarty.read()));return o},D.exports.TemplatablePattern=h}],B={};function G(D){var I=B[D];if(I!==void 0)return I.exports;var g=B[D]={exports:{}};return F[D](g,g.exports,G),g.exports}var H=G(0);k=H})();var $=k;!(oe=[],J=function(){return{js_beautify:$}}.apply(at,oe),J!==void 0&&(yt.exports=J))})()},"7Cbv":function(yt,at,ne){"use strict";var oe=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),J=new Uint8Array(16);function k(){if(!oe)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return oe(J)}var $=/^(?:[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 F(f){return typeof f=="string"&&$.test(f)}for(var B=F,G=[],H=0;H<256;++H)G.push((H+256).toString(16).substr(1));function D(f){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,o=(G[f[h+0]]+G[f[h+1]]+G[f[h+2]]+G[f[h+3]]+"-"+G[f[h+4]]+G[f[h+5]]+"-"+G[f[h+6]]+G[f[h+7]]+"-"+G[f[h+8]]+G[f[h+9]]+"-"+G[f[h+10]]+G[f[h+11]]+G[f[h+12]]+G[f[h+13]]+G[f[h+14]]+G[f[h+15]]).toLowerCase();if(!B(o))throw TypeError("Stringified UUID is invalid");return o}var I=D;function g(f,h,o){f=f||{};var d=f.random||(f.rng||k)();if(d[6]=d[6]&15|64,d[8]=d[8]&63|128,h){o=o||0;for(var s=0;s<16;++s)h[o+s]=d[s];return h}return I(d)}var p=at.a=g},"7ahc":function(yt,at,ne){"use strict";ne.d(at,"a",function(){return R});var oe=ne("k1fw"),J=ne("0Owb"),k=ne("+L6B"),$=ne("2/Rp"),F=ne("y8nQ"),B=ne("Vl3Y"),G=ne("tJVT"),H=ne("OaEy"),D=ne("2fM7"),I=ne("q1tI"),g=ne.n(I),p=ne("VrN/"),f=ne.n(p),h=ne("p77/"),o=ne.n(h),d=ne("c5Ni"),s=ne.n(d),a=D.a.Option,l={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"]};at.b=function(w){var x=w.callback,O=w.onCancel,A=Object(I.useState)("python"),T=Object(G.a)(A,2),E=T[0],b=T[1];function u(m){b(c[m][1])}function _(m){x(m)}return g.a.createElement(B.a,Object(J.a)({},l,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:_}),g.a.createElement(B.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},g.a.createElement(D.a,{onChange:u},Object.keys(c).map(function(m){return g.a.createElement(a,{key:m,value:m},c[m][0])}))),g.a.createElement(B.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},g.a.createElement(R,{mode:E})),g.a.createElement("div",{className:"flex-container flex-end"},g.a.createElement($.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),g.a.createElement($.a,{type:"ghost",onClick:O},"\u53D6\u6D88")))};function R(w){var x=w.value,O=w.onChange,A=w.mode,T=w.options,E=T===void 0?{}:T,b=Object(I.useRef)(),u=Object(I.useState)(),_=Object(G.a)(u,2),m=_[0],v=_[1];return Object(I.useEffect)(function(){if(m){function M(P){var K=P.getValue();O&&O(K)}return m.on("change",M),function(){m.off("change",M)}}},[m,O]),Object(I.useEffect)(function(){m&&m.setOption("mode",A)},[m,A]),Object(I.useEffect)(function(){m&&((x!==m.getValue()||x==="")&&setTimeout(function(){m.setValue(x||" ")},300))},[m,x]),Object(I.useEffect)(function(){if(b.current&&!m){var M=f.a.fromTextArea(b.current,Object(oe.a)({mode:A,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},E));v(M)}},[b.current,m]),g.a.createElement("div",{className:"my-codemirror-container"},g.a.createElement("textarea",{ref:b}))}},"8EBN":function(yt,at,ne){(function(oe){oe(ne("VrN/"))})(function(oe){"use strict";oe.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded Javascript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var J=0;J<oe.modeInfo.length;J++){var k=oe.modeInfo[J];k.mimes&&(k.mime=k.mimes[0])}oe.findModeByMIME=function($){$=$.toLowerCase();for(var F=0;F<oe.modeInfo.length;F++){var B=oe.modeInfo[F];if(B.mime==$)return B;if(B.mimes){for(var G=0;G<B.mimes.length;G++)if(B.mimes[G]==$)return B}}if(/\+xml$/.test($))return oe.findModeByMIME("application/xml");if(/\+json$/.test($))return oe.findModeByMIME("application/json")},oe.findModeByExtension=function($){$=$.toLowerCase();for(var F=0;F<oe.modeInfo.length;F++){var B=oe.modeInfo[F];if(B.ext){for(var G=0;G<B.ext.length;G++)if(B.ext[G]==$)return B}}},oe.findModeByFileName=function($){for(var F=0;F<oe.modeInfo.length;F++){var B=oe.modeInfo[F];if(B.file&&B.file.test($))return B}var G=$.lastIndexOf("."),H=G>-1&&$.substring(G+1,$.length);if(H)return oe.findModeByExtension(H)},oe.findModeByName=function($){$=$.toLowerCase();for(var F=0;F<oe.modeInfo.length;F++){var B=oe.modeInfo[F];if(B.name.toLowerCase()==$)return B;if(B.alias){for(var G=0;G<B.alias.length;G++)if(B.alias[G].toLowerCase()==$)return B}}}})},"8hTe":function(yt,at,ne){yt.exports={button:"button___1wy9m"}},"9Bee":function(yt,at,ne){"use strict";var oe=ne("DYRE"),J=ne("zeV3"),k=ne("+L6B"),$=ne("2/Rp"),F=ne("k1fw"),B=ne("9og8"),G=ne("tJVT"),H=ne("WmNS"),D=ne.n(H),I=ne("q1tI"),g=ne.n(I),p=ne("vg9a"),f=ne("DlQD"),h=ne.n(f),o=ne("rUJ1");function d(z,y){var C=z.match(/^(\s+)(?:```)/);if(C===null)return y;var N=C[1];return y.split(`
`).map(function(Z){var W=Z.match(/^\s+/);if(W===null)return Z;var ge=Object(G.a)(W,1),Ue=ge[0];return Ue.length>=N.length?Z.slice(N.length):Z}).join(`
`)}var s=[],a=["<ul>"],l=new h.a.Renderer,c=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function R(){s.length=0,a=["<ul>"]}var w={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function x(z,y,C,N){if(y>=z.length||z[y].level<=C)return y;var Z=z[y];N.push("<li><a href='#"+Z.anchor+"'>"+Z.text+"</a>"),y++;var W=[];return y=x(z,y,Z.level,W),W.length>0&&(N.push("<ul>"),W.forEach(function(ge){N.push(ge)}),N.push("</ul>")),N.push("</li>"),y=x(z,y,C,N),y}function O(){return x(s,0,0,a),a.push("</ul>"),a.join("")}var A={heading:function(y){var C=c.exec(y);if(C)return{type:"heading",raw:C[0],depth:C[1].length,text:C[2]}},fences:function(y){var C=this.rules.block.fences.exec(y);if(C){var N=C[0],Z=d(N,C[3]||""),W=C[2]?C[2].trim():C[2];if(["latex","katex","math"].indexOf(W)>=0){var ge=b(),Ue=Z;Z=ge,u[ge]={type:"block",expression:Ue}}return{type:"code",raw:N,lang:W,text:Z}}}},T=/(?:\${2})([^\n`]+?)(?:\${2})/gi,E=0,b=function(){return"__special_katext_id_".concat(E++,"__")},u={};function _(){return u}function m(){E=0,u={}}function v(z){return z=z.replace(T,function(y,C){var N=b();return u[N]={type:"inline",expression:C},N}),z}var M=l.listitem;l.listitem=function(z){return M(v(z))};var P=l.paragraph;l.paragraph=function(z){return P(v(z))};var K=l.tablecell;l.tablecell=function(z,y){return K(v(z),y)},l.code=function(z,y,C){var N=(y||"").match(/\S*/)[0];return N?["latex","katex","math"].indexOf(N)>=0?"<p class='editormd-tex'>".concat(z,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(y,'">').concat(C?z:Object(o.escape)(z,!0),`</code></pre>
`):'<pre class="prettyprint linenums"><code>'+(C?z:Object(o.escape)(z,!0))+"</code></pre>"},l.heading=function(z,y,C){var N=this.options.headerPrefix+C.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return s.push({anchor:N,level:y,text:z}),"<h"+y+' id="'+N+'">'+z+"</h"+y+">"},h.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),h.a.use({tokenizer:A,renderer:l});var V=h.a,U=ne("SJMd"),S=ne("ulZh"),X=ne.n(S),ee=ne("m3rI"),ae=ne("Oy/b"),de=ne("p5ED"),Ae=ne("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 Ee=function(z,y){return(Ee=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(C,N){C.__proto__=N}||function(C,N){for(var Z in N)Object.prototype.hasOwnProperty.call(N,Z)&&(C[Z]=N[Z])})(z,y)};function we(z,y){function C(){this.constructor=z}Ee(z,y),z.prototype=y===null?Object.create(y):(C.prototype=y.prototype,new C)}function he(z,y,C,N){return new(C||(C=Promise))(function(Z,W){function ge(mt){try{it(N.next(mt))}catch(Ge){W(Ge)}}function Ue(mt){try{it(N.throw(mt))}catch(Ge){W(Ge)}}function it(mt){var Ge;mt.done?Z(mt.value):(Ge=mt.value,Ge instanceof C?Ge:new C(function(bt){bt(Ge)})).then(ge,Ue)}it((N=N.apply(z,y||[])).next())})}function ce(z,y){var C,N,Z,W,ge={label:0,sent:function(){if(1&Z[0])throw Z[1];return Z[1]},trys:[],ops:[]};return W={next:Ue(0),throw:Ue(1),return:Ue(2)},typeof Symbol=="function"&&(W[Symbol.iterator]=function(){return this}),W;function Ue(it){return function(mt){return function(Ge){if(C)throw new TypeError("Generator is already executing.");for(;ge;)try{if(C=1,N&&(Z=2&Ge[0]?N.return:Ge[0]?N.throw||((Z=N.return)&&Z.call(N),0):N.next)&&!(Z=Z.call(N,Ge[1])).done)return Z;switch(N=0,Z&&(Ge=[2&Ge[0],Z.value]),Ge[0]){case 0:case 1:Z=Ge;break;case 4:return ge.label++,{value:Ge[1],done:!1};case 5:ge.label++,N=Ge[1],Ge=[0];continue;case 7:Ge=ge.ops.pop(),ge.trys.pop();continue;default:if(!(Z=ge.trys,(Z=Z.length>0&&Z[Z.length-1])||Ge[0]!==6&&Ge[0]!==2)){ge=0;continue}if(Ge[0]===3&&(!Z||Ge[1]>Z[0]&&Ge[1]<Z[3])){ge.label=Ge[1];break}if(Ge[0]===6&&ge.label<Z[1]){ge.label=Z[1],Z=Ge;break}if(Z&&ge.label<Z[2]){ge.label=Z[2],ge.ops.push(Ge);break}Z[2]&&ge.ops.pop(),ge.trys.pop();continue}Ge=y.call(z,ge)}catch(bt){Ge=[6,bt],N=0}finally{C=Z=0}if(5&Ge[0])throw Ge[1];return{value:Ge[0]?Ge[1]:void 0,done:!0}}([it,mt])}}}function se(){for(var z=0,y=0,C=arguments.length;y<C;y++)z+=arguments[y].length;var N=Array(z),Z=0;for(y=0;y<C;y++)for(var W=arguments[y],ge=0,Ue=W.length;ge<Ue;ge++,Z++)N[Z]=W[ge];return N}var re=function(){function z(){}return z.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},z.setAttributes=function(y,C){for(var N=0,Z=C;N<Z.length;N++){var W=Z[N],ge=W[0],Ue=W[1];y.setAttribute(ge,Ue)}},z.createRect=function(y,C,N){var Z=document.createElementNS("http://www.w3.org/2000/svg","rect");return Z.setAttribute("width",y.toString()),Z.setAttribute("height",C.toString()),N&&z.setAttributes(Z,N),Z},z.createLine=function(y,C,N,Z,W){var ge=document.createElementNS("http://www.w3.org/2000/svg","line");return ge.setAttribute("x1",y.toString()),ge.setAttribute("y1",C.toString()),ge.setAttribute("x2",N.toString()),ge.setAttribute("y2",Z.toString()),W&&z.setAttributes(ge,W),ge},z.createPolygon=function(y,C){var N=document.createElementNS("http://www.w3.org/2000/svg","polygon");return N.setAttribute("points",y),C&&z.setAttributes(N,C),N},z.createCircle=function(y,C){var N=document.createElementNS("http://www.w3.org/2000/svg","circle");return N.setAttribute("cx",(y/2).toString()),N.setAttribute("cy",(y/2).toString()),N.setAttribute("r",y.toString()),C&&z.setAttributes(N,C),N},z.createEllipse=function(y,C,N){var Z=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return Z.setAttribute("cx",(y/2).toString()),Z.setAttribute("cy",(C/2).toString()),Z.setAttribute("rx",(y/2).toString()),Z.setAttribute("ry",(C/2).toString()),N&&z.setAttributes(Z,N),Z},z.createGroup=function(y){var C=document.createElementNS("http://www.w3.org/2000/svg","g");return y&&z.setAttributes(C,y),C},z.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},z.createMarker=function(y,C,N,Z,W,ge,Ue){var it=document.createElementNS("http://www.w3.org/2000/svg","marker");return z.setAttributes(it,[["id",y],["orient",C],["markerWidth",N.toString()],["markerHeight",Z.toString()],["refX",W.toString()],["refY",ge.toString()]]),it.appendChild(Ue),it},z.createText=function(y){var C=document.createElementNS("http://www.w3.org/2000/svg","text");return C.setAttribute("x","0"),C.setAttribute("y","0"),y&&z.setAttributes(C,y),C},z.createTSpan=function(y,C){var N=document.createElementNS("http://www.w3.org/2000/svg","tspan");return N.textContent=y,C&&z.setAttributes(N,C),N},z.createImage=function(y){var C=document.createElementNS("http://www.w3.org/2000/svg","image");return y&&z.setAttributes(C,y),C},z.createPoint=function(y,C){var N=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return N.x=y,N.y=C,N},z.createPath=function(y,C){var N=document.createElementNS("http://www.w3.org/2000/svg","path");return N.setAttribute("d",y),C&&z.setAttributes(N,C),N},z}(),xe=function(){function z(){}return z.addKey=function(y){z.key=y},Object.defineProperty(z,"isLicensed",{get:function(){return!!z.key&&new RegExp(/^MJS2-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(z.key)},enumerable:!1,configurable:!0}),z}(),be=function(){function z(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return z.prototype.rasterize=function(y,C,N){var Z=this;return new Promise(function(W){var ge=N!==void 0?N:document.createElement("canvas");y===null&&(Z.markersOnly=!0,Z.naturalSize=!1);var Ue=document.createElementNS("http://www.w3.org/2000/svg","svg");Ue.setAttribute("xmlns","http://www.w3.org/2000/svg"),Ue.setAttribute("width",C.width.baseVal.valueAsString),Ue.setAttribute("height",C.height.baseVal.valueAsString),Ue.setAttribute("viewBox","0 0 "+C.viewBox.baseVal.width.toString()+" "+C.viewBox.baseVal.height.toString()),Ue.innerHTML=C.innerHTML,Z.naturalSize===!0?(Ue.width.baseVal.value=y.naturalWidth,Ue.height.baseVal.value=y.naturalHeight):Z.width!==void 0&&Z.height!==void 0&&(Ue.width.baseVal.value=Z.width,Ue.height.baseVal.value=Z.height),ge.width=Ue.width.baseVal.value,ge.height=Ue.height.baseVal.value;var it=Ue.outerHTML,mt=ge.getContext("2d");Z.markersOnly!==!0&&mt.drawImage(y,0,0,ge.width,ge.height);var Ge=window.URL,bt=new Image(ge.width,ge.height);bt.setAttribute("crossOrigin","anonymous");var Ht=new Blob([it],{type:"image/svg+xml"}),$t=Ge.createObjectURL(Ht);bt.onload=function(){mt.drawImage(bt,0,0),Ge.revokeObjectURL($t);var Mi=ge.toDataURL(Z.imageType,Z.imageQuality);W(Mi)},bt.src=$t})},z}(),ke=function(){},Oe=function(){function z(y){this._classNamePrefixBase="__markerjs2_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+y+"_"}return Object.defineProperty(z.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"defaultSettings",{get:function(){return{canvasBackgroundColor:"#ffffff",toolbarBackgroundColor:"#111111",toolbarBackgroundHoverColor:"#333333",toolbarColor:"#eeeeee",toolbarHeight:40,toolboxColor:"#eeeeee",toolboxAccentColor:"#3080c3",undoButtonVisible:!0,redoButtonVisible:!1,zoomButtonVisible:!1,zoomOutButtonVisible:!1,clearButtonVisible:!1,resultButtonBlockVisible:!0,logoPosition:"left"}},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"fade_out"},enumerable:!1,configurable:!0}),z.prototype.addClass=function(y){return this.styleSheet===void 0&&this.addStyleSheet(),y.name=""+this.classNamePrefix+y.localName,this.classes.push(y),this.styleSheet.sheet.insertRule("."+y.name+" {"+y.style+"}",this.styleSheet.sheet.cssRules.length),y},z.prototype.addRule=function(y){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(y),this.styleSheet.sheet.insertRule(y.selector+" {"+y.style+"}",this.styleSheet.sheet.cssRules.length)},z.prototype.addStyleSheet=function(){var y;this.styleSheet=document.createElement("style"),((y=this.styleSheetRoot)!==null&&y!==void 0?y:document.head).appendChild(this.styleSheet),this.addRule(new Be("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new Be("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
from {
opacity: 0;
}
to {
opacity: 1;
}
`)),this.addRule(new Be("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
from {
opacity: 1;
}
to {
opacity: 0;
}
`)),this.addClass(new Ce("fade_in",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
`)),this.addClass(new Ce("fade_out",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
`))},z.prototype.removeStyleSheet=function(){var y;this.styleSheet&&(((y=this.styleSheetRoot)!==null&&y!==void 0?y:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},z}(),Be=function(z,y){this.selector=z,this.style=y},Ce=function(z,y){this.localName=z,this.style=y},De=function(){function z(y,C,N,Z,W){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=y,this.displayMode=C,this.markerItems=N,this.uiStyleSettings=Z,this.styles=W,this.addStyles(),this.adjustLayout=this.adjustLayout.bind(this),this.overflowButtonClicked=this.overflowButtonClicked.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this)}return z.prototype.show=function(y){var C=this;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=y,this.uiContainer.className=this.toolbarStyleClass.name+" "+this.styles.fadeInAnimationClassName+" "+(this.uiStyleSettings.toolbarStyleColorsClassName?this.uiStyleSettings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name);var N=document.createElement("div");N.className=this.toolbarBlockStyleClass.name,N.style.whiteSpace="nowrap",this.uiContainer.appendChild(N),this.addActionButton(N,'<svg viewBox="0 0 24 24"><path d="M10.07 14.27a.997.997 0 011.33.48l2.3 4.99 1.8-.85-2.31-4.98c-.24-.5-.02-1.1.48-1.33l.28-.08 2.3-.45L8 5.12V15.9l1.82-1.47.25-.16m3.57 7.7a.99.99 0 01-1.33-.47l-2.18-4.74-2.51 2.02c-.17.14-.38.22-.62.22a1 1 0 01-1-1V3a1 1 0 011-1c.24 0 .47.09.64.23l.01-.01 11.49 9.64a1.001 1.001 0 01-.44 1.75l-3.16.62 2.2 4.73c.26.5.02 1.09-.48 1.32l-3.62 1.69z"/></svg>',"select"),this.addActionButton(N,'<svg viewBox="0 0 24 24"><path d="M9 3v1H4v2h1v13a2 2 0 002 2h10a2 2 0 002-2V6h1V4h-5V3H9M7 6h10v13H7V6m2 2v9h2V8H9m4 0v9h2V8h-2z"/></svg>',"delete"),this.uiStyleSettings.clearButtonVisible&&this.addActionButton(N,'<svg viewBox="0 0 24 24"><path d="M19.36 2.72l1.42 1.42-5.72 5.71c1.07 1.54 1.22 3.39.32 4.59L9.06 8.12c1.2-.9 3.05-.75 4.59.32l5.71-5.72M5.93 17.57c-2.01-2.01-3.24-4.41-3.58-6.65l4.88-2.09 7.44 7.44-2.09 4.88c-2.24-.34-4.64-1.57-6.65-3.58z"/></svg>',"clear"),this.uiStyleSettings.undoButtonVisible&&this.addActionButton(N,'<svg viewBox="0 0 24 24"><path d="M12.5 8c-2.65 0-5.05 1-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8z"/></svg>',"undo"),this.uiStyleSettings.redoButtonVisible&&this.addActionButton(N,'<svg viewBox="0 0 24 24"><path d="M18.4 10.6C16.55 9 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22L3.9 16a8.002 8.002 0 017.6-5.5c1.95 0 3.73.72 5.12 1.88L13 16h9V7l-3.6 3.6z"/></svg>',"redo"),this.uiStyleSettings.zoomButtonVisible&&this.addActionButton(N,'<svg viewBox="0 0 24 24"><path d="M15.5 14l5 5-1.5 1.5-5-5v-.79l-.27-.28A6.471 6.471 0 019.5 16 6.5 6.5 0 013 9.5 6.5 6.5 0 019.5 3 6.5 6.5 0 0116 9.5c0 1.61-.59 3.09-1.57 4.23l.28.27h.79m-6 0C12 14 14 12 14 9.5S12 5 9.5 5 5 7 5 9.5 7 14 9.5 14m2.5-4h-2v2H9v-2H7V9h2V7h1v2h2v1z"/></svg>',"zoom"),this.uiStyleSettings.zoomButtonVisible&&this.uiStyleSettings.zoomOutButtonVisible&&this.addActionButton(N,'<svg viewBox="0 0 24 24"><path d="M15.5 14h-.79l-.28-.27A6.471 6.471 0 0016 9.5 6.5 6.5 0 009.5 3 6.5 6.5 0 003 9.5 6.5 6.5 0 009.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 5 1.5-1.5-5-5m-6 0C7 14 5 12 5 9.5S7 5 9.5 5 14 7 14 9.5 12 14 9.5 14M7 9h5v1H7V9z"/></svg>',"zoom-out"),this.uiStyleSettings.notesButtonVisible&&this.addActionButton(N,'<svg viewBox="0 0 24 24"><path d="M18.13 12l1.26-1.26c.44-.44 1-.68 1.61-.74V9l-6-6H5c-1.11 0-2 .89-2 2v14a2 2 0 002 2h6v-1.87l.13-.13H5V5h7v7h6.13M14 4.5l5.5 5.5H14V4.5m5.13 9.33l2.04 2.04L15.04 22H13v-2.04l6.13-6.13m3.72.36l-.98.98-2.04-2.04.98-.98c.19-.2.52-.2.72 0l1.32 1.32c.2.2.2.53 0 .72z"/></svg>',"notes"),this.markerButtonBlock=document.createElement("div"),this.markerButtonBlock.className=this.toolbarBlockStyleClass.name,this.markerButtonBlock.style.flexGrow="2",this.markerButtonBlock.style.textAlign="center",this.uiContainer.appendChild(this.markerButtonBlock),this.markerButtonOverflowBlock=document.createElement("div"),this.markerButtonOverflowBlock.className=this.toolbarOverflowBlockStyleClass.name+" "+(this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName?this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName:this.toolbarOverflowBlockStyleColorsClass.name),this.markerButtonOverflowBlock.style.display="none",this.uiContainer.appendChild(this.markerButtonOverflowBlock),this.markerItems&&(this.markerItems.forEach(function(W){var ge=document.createElement("div");ge.className=""+C.toolbarButtonStyleClass.name,ge.setAttribute("data-type-name",W.typeName),ge.innerHTML=W.icon,ge.addEventListener("click",function(){C.markerToolbarButtonClicked(ge,W)}),C.buttons.push(ge),C.markerButtons.push(ge)}),this.overflowButton=document.createElement("div"),this.overflowButton.className=this.toolbarButtonStyleClass.name+" "+(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name),this.overflowButton.innerHTML='<svg viewBox="0 0 24 24"><path d="M12 16a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2m0-6a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2m0-6a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2z"/></svg>',this.overflowButton.addEventListener("click",this.overflowButtonClicked),this.markerButtonBlock.appendChild(this.overflowButton));var Z=document.createElement("div");Z.className=this.toolbarBlockStyleClass.name,Z.style.whiteSpace="nowrap",Z.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(Z),this.addActionButton(Z,'<svg viewBox="0 0 24 24"><path d="M9 20.42l-6.21-6.21 2.83-2.83L9 14.77l9.88-9.89 2.83 2.83L9 20.42z"/></svg>',"render"),this.addActionButton(Z,'<svg viewBox="0 0 24 24"><path d="M20 6.91L17.09 4 12 9.09 6.91 4 4 6.91 9.09 12 4 17.09 6.91 20 12 14.91 17.09 20 20 17.09 14.91 12 20 6.91z"/></svg>',"close"),this.markerjsContainer.appendChild(this.uiContainer),this.setSelectMode(),this.setCurrentMarker(),this.adjustLayout()},z.prototype.addButtonClickListener=function(y){this.buttonClickListeners.push(y)},z.prototype.removeButtonClickListener=function(y){this.buttonClickListeners.indexOf(y)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(y),1)},z.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},z.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var y=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var C=0;C<this.markerButtons.length;C++)C<y||C===y&&this.markerButtons.length-1===y?this.markerButtonBlock.appendChild(this.markerButtons[C]):(C===y&&this.markerButtonBlock.appendChild(this.overflowButton),this.markerButtonOverflowBlock.appendChild(this.markerButtons[C]))}},z.prototype.overflowButtonClicked=function(){this.markerButtonOverflowBlock.style.display!=="none"?(this.markerButtonOverflowBlock.className=this.markerButtonOverflowBlock.className.replace(this.styles.fadeInAnimationClassName,""),this.markerButtonOverflowBlock.style.display="none"):(this.markerButtonOverflowBlock.className+=" "+this.styles.fadeInAnimationClassName,this.markerButtonOverflowBlock.style.top=this.uiContainer.offsetTop+this.overflowButton.offsetHeight+"px",this.markerButtonOverflowBlock.style.right=this.uiContainer.offsetWidth-this.overflowButton.offsetLeft-this.overflowButton.offsetWidth+2*this.uiContainer.offsetLeft+"px",this.markerButtonOverflowBlock.style.display="inline-block")},z.prototype.resetButtonStyles=function(){var y=this;this.buttons.forEach(function(C){C.className=C.className.replace(y.uiStyleSettings.toolbarButtonStyleColorsClassName?y.uiStyleSettings.toolbarButtonStyleColorsClassName:y.toolbarButtonStyleColorsClass.name,"").trim(),C.className=C.className.replace(y.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?y.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:y.toolbarActiveButtonStyleColorsClass.name,"").trim(),C.className+=" "+(y.uiStyleSettings.toolbarButtonStyleColorsClassName?y.uiStyleSettings.toolbarButtonStyleColorsClassName:y.toolbarButtonStyleColorsClass.name)})},z.prototype.addActionButton=function(y,C,N){var Z=this,W=document.createElement("div");switch(W.className=""+this.toolbarButtonStyleClass.name,W.innerHTML=C,W.setAttribute("data-action",N),W.addEventListener("click",function(){Z.actionToolbarButtonClicked(W,N)}),N){case"select":W.style.fill=this.uiStyleSettings.selectButtonColor;break;case"delete":case"clear":W.style.fill=this.uiStyleSettings.deleteButtonColor;break;case"undo":case"redo":W.style.fill=this.uiStyleSettings.selectButtonColor;break;case"render":W.style.fill=this.uiStyleSettings.okButtonColor;break;case"close":W.style.fill=this.uiStyleSettings.closeButtonColor}y.appendChild(W),this.buttons.push(W)},z.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new Ce("toolbar",`
width: 100%;
flex-shrink: 0;
display: flex;
flex-direction: row;
justify-content: space-between;
height: `+this.uiStyleSettings.toolbarHeight+`px;
box-sizing: content-box;
`+(this.displayMode==="inline"?"border-top-left-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
`+(this.displayMode==="inline"?"border-top-right-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
overflow: hidden;
`)),this.toolbarStyleColorsClass=this.styles.addClass(new Ce("toolbar_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
box-shadow: 0px 3px rgba(33, 33, 33, 0.1);
`)),this.toolbarBlockStyleClass=this.styles.addClass(new Ce("toolbar-block",`
display: inline-block;
box-sizing: content-box;
`)),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new Ce("toolbar-overflow-block",`
position: absolute;
top: `+this.uiStyleSettings.toolbarHeight+`px;
max-width: `+2*this.uiStyleSettings.toolbarHeight+`px;
z-index: 10;
box-sizing: content-box;
`)),this.toolbarOverflowBlockStyleColorsClass=this.styles.addClass(new Ce("toolbar-overflow-block_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`));var y=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new Ce("toolbar_button",`
display: inline-block;
width: `+(this.uiStyleSettings.toolbarHeight-2*y)+`px;
height: `+(this.uiStyleSettings.toolbarHeight-2*y)+`px;
padding: `+y+`px;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new Ce("toolbar_button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new Ce("toolbar_active_button",`
fill: `+this.uiStyleSettings.toolbarColor+`;
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`)),this.styles.addRule(new Be("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`)),this.styles.addRule(new Be("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`))},z.prototype.markerToolbarButtonClicked=function(y,C){this.setActiveButton(y),this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(N){return N("marker",C)}),this.markerButtonOverflowBlock.style.display="none"},z.prototype.actionToolbarButtonClicked=function(y,C){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(N){return N("action",C)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},z.prototype.setActiveButton=function(y){this.resetButtonStyles(),y.className=y.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),y.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},z.prototype.setActiveMarkerButton=function(y){var C=this.markerButtons.find(function(N){return N.getAttribute("data-type-name")===y});C&&this.setActiveButton(C)},z.prototype.setCurrentMarker=function(y){var C=this;this.currentMarker=y,this.buttons.filter(function(N){return/delete|notes/.test(N.getAttribute("data-action"))}).forEach(function(N){C.currentMarker===void 0?(N.style.fillOpacity="0.4",N.style.pointerEvents="none"):(N.style.fillOpacity="1",N.style.pointerEvents="all")})},z}(),Ne=function(){function z(y,C,N,Z){this.panels=[],this.panelButtons=[],this.markerjsContainer=y,this.displayMode=C,this.uiStyleSettings=N,this.styles=Z,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return z.prototype.addStyles=function(){var y;this.toolboxStyleClass=this.styles.addClass(new Ce("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 Ce("toolbox_colors",`
color: `+this.uiStyleSettings.toolboxColor+`;
`));var C=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new Ce("toolbox-button-row",`
display: flex;
cursor: default;
box-sizing: content-box;
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new Ce("toolbox-button-row_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new Ce("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 Ce("toolbox-panel-row_colors",`
background-color: `+((y=this.uiStyleSettings.toolboxBackgroundColor)!==null&&y!==void 0?y:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
`)),this.toolboxButtonStyleClass=this.styles.addClass(new Ce("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 Ce("toolbox-button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new Ce("toolbox-active-button_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`;
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.styles.addRule(new Be("."+this.toolboxButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`)),this.styles.addRule(new Be("."+this.toolboxButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`))},z.prototype.show=function(y){var C;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=y,this.uiContainer.className=this.toolboxStyleClass.name+" "+((C=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&C!==void 0?C:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},z.prototype.setPanelButtons=function(y){var C,N,Z=this;this.panels=y,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+" "+((N=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&N!==void 0?N:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(W){var ge;W.uiStyleSettings=Z.uiStyleSettings;var Ue=document.createElement("div");Ue.className=Z.toolboxButtonStyleClass.name+" "+((ge=Z.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&ge!==void 0?ge:Z.toolboxButtonStyleColorsClass.name),Ue.innerHTML=W.icon,Ue.title=W.title,Ue.addEventListener("click",function(){Z.panelButtonClick(W)}),Z.panelButtons.push(Ue),Z.buttonRow.appendChild(Ue)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},z.prototype.panelButtonClick=function(y){var C=this,N=-1;if(y!==this.activePanel){N=this.panels.indexOf(y),this.panelRow.innerHTML="";var Z=y.getUi();Z.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(Z),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=y}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(W,ge){var Ue,it;W.className=C.toolboxButtonStyleClass.name+" "+(ge===N?""+((Ue=C.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&Ue!==void 0?Ue:C.toolboxActiveButtonStyleColorsClass.name):""+((it=C.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&it!==void 0?it:C.toolboxButtonStyleColorsClass.name))})},z}(),Ke=function(z,y){this.title=z,this.icon=y},Fe=function(z){function y(C,N,Z,W){var ge=z.call(this,C,W||'<svg viewBox="0 0 24 24"><path d="M17.5 12a1.5 1.5 0 01-1.5-1.5A1.5 1.5 0 0117.5 9a1.5 1.5 0 011.5 1.5 1.5 1.5 0 01-1.5 1.5m-3-4A1.5 1.5 0 0113 6.5 1.5 1.5 0 0114.5 5 1.5 1.5 0 0116 6.5 1.5 1.5 0 0114.5 8m-5 0A1.5 1.5 0 018 6.5 1.5 1.5 0 019.5 5 1.5 1.5 0 0111 6.5 1.5 1.5 0 019.5 8m-3 4A1.5 1.5 0 015 10.5 1.5 1.5 0 016.5 9 1.5 1.5 0 018 10.5 1.5 1.5 0 016.5 12M12 3a9 9 0 00-9 9 9 9 0 009 9 1.5 1.5 0 001.5-1.5c0-.39-.15-.74-.39-1-.23-.27-.38-.62-.38-1a1.5 1.5 0 011.5-1.5H16a5 5 0 005-5c0-4.42-4.03-8-9-8z"/></svg>')||this;return ge.colors=[],ge.addTransparent=!1,ge.colorBoxes=[],ge.colors=N,ge.currentColor=Z,ge.setCurrentColor=ge.setCurrentColor.bind(ge),ge.getColorBox=ge.getColorBox.bind(ge),ge}return we(y,z),y.prototype.getUi=function(){var C=this,N=document.createElement("div");return N.style.overflow="hidden",N.style.whiteSpace="nowrap",this.colors.forEach(function(Z){var W=C.getColorBox(Z);N.appendChild(W),C.colorBoxes.push(W)}),N},y.prototype.getColorBox=function(C){var N=this,Z=this.uiStyleSettings.toolbarHeight/4,W=this.uiStyleSettings.toolbarHeight-Z,ge=document.createElement("div");ge.style.display="inline-block",ge.style.boxSizing="content-box",ge.style.width=W-2+"px",ge.style.height=W-2+"px",ge.style.padding="1px",ge.style.marginRight="2px",ge.style.marginBottom="2px",ge.style.borderWidth="2px",ge.style.borderStyle="solid",ge.style.borderRadius=(W+2)/2+"px",ge.style.borderColor=C===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",ge.addEventListener("click",function(){N.setCurrentColor(C,ge)});var Ue=document.createElement("div");return Ue.style.display="inline-block",Ue.style.width=W-2+"px",Ue.style.height=W-2+"px",Ue.style.backgroundColor=C,Ue.style.borderRadius=W/2+"px",C==="transparent"&&(Ue.style.fill=this.uiStyleSettings.toolboxAccentColor,Ue.innerHTML=`<svg viewBox="0 0 24 24">
<path d="M2,5.27L3.28,4L20,20.72L18.73,22L15.65,18.92C14.5,19.3 13.28,19.5 12,19.5C7,19.5 2.73,16.39 1,12C1.69,10.24 2.79,8.69 4.19,7.46L2,5.27M12,9A3,3 0 0,1 15,12C15,12.35 14.94,12.69 14.83,13L11,9.17C11.31,9.06 11.65,9 12,9M12,4.5C17,4.5 21.27,7.61 23,12C22.18,14.08 20.79,15.88 19,17.19L17.58,15.76C18.94,14.82 20.06,13.54 20.82,12C19.17,8.64 15.76,6.5 12,6.5C10.91,6.5 9.84,6.68 8.84,7L7.3,5.47C8.74,4.85 10.33,4.5 12,4.5M3.18,12C4.83,15.36 8.24,17.5 12,17.5C12.69,17.5 13.37,17.43 14,17.29L11.72,15C10.29,14.85 9.15,13.71 9,12.28L5.6,8.87C4.61,9.72 3.78,10.78 3.18,12Z" />
</svg>`),ge.appendChild(Ue),ge},y.prototype.setCurrentColor=function(C,N){var Z=this;this.currentColor=C,this.colorBoxes.forEach(function(W){W.style.borderColor=W===N?Z.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(C)},y}(Ke),je=function(){function z(y,C,N){this._state="new",this._isSelected=!1,this._container=y,this._overlayContainer=C,this.globalSettings=N,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(z.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),z.prototype.ownsTarget=function(y){return!1},Object.defineProperty(z.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),z.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},z.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},z.prototype.pointerDown=function(y,C){},z.prototype.dblClick=function(y,C){},z.prototype.manipulate=function(y){},z.prototype.pointerUp=function(y){this.stateChanged()},z.prototype.dispose=function(){},z.prototype.addMarkerVisualToContainer=function(y){this.container.childNodes.length>0?this.container.insertBefore(y,this.container.childNodes[0]):this.container.appendChild(y)},z.prototype.getState=function(){return{typeName:z.typeName,state:this.state,notes:this.notes}},z.prototype.restoreState=function(y){this._state=y.state,this.notes=y.notes},z.prototype.scale=function(y,C){},z.prototype.colorChanged=function(y){this.onColorChanged&&this.onColorChanged(y),this.stateChanged()},z.prototype.fillColorChanged=function(y){this.onFillColorChanged&&this.onFillColorChanged(y),this.stateChanged()},z.prototype.stateChanged=function(){if(this.onStateChanged&&this.state!=="creating"&&this.state!=="new"){var y=this.getState();this.manipulationStartState!==void 0&&(this.manipulationStartState.state="select"),y.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(y)&&this.onStateChanged(this)}},z.typeName="MarkerBase",z}(),Me=function(){function z(){this.findGripByVisual=this.findGripByVisual.bind(this)}return z.prototype.findGripByVisual=function(y){return this.topLeft.ownsTarget(y)?this.topLeft:this.topCenter.ownsTarget(y)?this.topCenter:this.topRight.ownsTarget(y)?this.topRight:this.centerLeft.ownsTarget(y)?this.centerLeft:this.centerRight.ownsTarget(y)?this.centerRight:this.bottomLeft.ownsTarget(y)?this.bottomLeft:this.bottomCenter.ownsTarget(y)?this.bottomCenter:this.bottomRight.ownsTarget(y)?this.bottomRight:void 0},z}(),et=function(){function z(){this.GRIP_SIZE=10,this.visual=re.createGroup(),this.visual.appendChild(re.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(re.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return z.prototype.ownsTarget=function(y){return y===this.visual||y===this.visual.childNodes[0]||y===this.visual.childNodes[1]},z}(),Je=function(){function z(){}return z.toITransformMatrix=function(y){return{a:y.a,b:y.b,c:y.c,d:y.d,e:y.e,f:y.f}},z.toSVGMatrix=function(y,C){return y.a=C.a,y.b=C.b,y.c=C.c,y.d=C.d,y.e=C.e,y.f=C.f,y},z}(),qe=function(z){function y(C,N,Z){var W=z.call(this,C,N,Z)||this;return W.left=0,W.top=0,W.width=0,W.height=0,W.defaultSize={x:50,y:20},W.offsetX=0,W.offsetY=0,W.rotationAngle=0,W.CB_DISTANCE=10,W._suppressMarkerCreateEvent=!1,W.container.transform.baseVal.appendItem(re.createTransform()),W.setupControlBox(),W}return we(y,z),Object.defineProperty(y.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"visual",{get:function(){return this._visual},set:function(C){this._visual=C;var N=re.createTransform();this._visual.transform.baseVal.appendItem(N)},enumerable:!1,configurable:!0}),y.prototype.ownsTarget=function(C){return!!z.prototype.ownsTarget.call(this,C)||!!(this.controlGrips.findGripByVisual(C)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(C))},y.prototype.pointerDown=function(C,N){z.prototype.pointerDown.call(this,C,N),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 Z=this.unrotatePoint(C);if(this.manipulationStartX=Z.x,this.manipulationStartY=Z.y,this.offsetX=Z.x-this.left,this.offsetY=Z.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(N),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(N)){this.activeGrip=this.rotatorGrip;var W=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=W.x-this.width/2,this.top=W.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var ge=this.container.transform.baseVal.getItem(0);ge.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(ge,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},y.prototype.pointerUp=function(C){var N=this.state;z.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",N==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},y.prototype.moveVisual=function(C){this.visual.style.transform="translate("+C.x+"px, "+C.y+"px)"},y.prototype.manipulate=function(C){var N=this.unrotatePoint(C);this.state==="creating"?this.resize(C):this.state==="move"?(this.left=this.manipulationStartLeft+(N.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(N.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(N):this.state==="rotate"&&this.rotate(C)},y.prototype.resize=function(C){var N=this.manipulationStartLeft,Z=this.manipulationStartWidth,W=this.manipulationStartTop,ge=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:N=this.manipulationStartLeft+C.x-this.manipulationStartX,Z=this.manipulationStartWidth+this.manipulationStartLeft-N;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:Z=this.manipulationStartWidth+C.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:W=this.manipulationStartTop+C.y-this.manipulationStartY,ge=this.manipulationStartHeight+this.manipulationStartTop-W;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:ge=this.manipulationStartHeight+C.y-this.manipulationStartY}Z>=0?(this.left=N,this.width=Z):(this.left=N+Z,this.width=-Z),ge>=0?(this.top=W,this.height=ge):(this.top=W+ge,this.height=-ge),this.setSize()},y.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},y.prototype.rotate=function(C){if(Math.abs(C.x-this.centerX)>.1){var N=Math.sign(C.x-this.centerX);this.rotationAngle=180*Math.atan((C.y-this.centerY)/(C.x-this.centerX))/Math.PI+90*N,this.applyRotation()}},y.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)},y.prototype.rotatePoint=function(C){if(this.rotationAngle===0)return C;var N=this.container.getCTM(),Z=re.createPoint(C.x,C.y);return{x:(Z=Z.matrixTransform(N)).x,y:Z.y}},y.prototype.unrotatePoint=function(C){if(this.rotationAngle===0)return C;var N=this.container.getCTM();N=N.inverse();var Z=re.createPoint(C.x,C.y);return{x:(Z=Z.matrixTransform(N)).x,y:Z.y}},y.prototype.select=function(){z.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},y.prototype.deselect=function(){z.prototype.deselect.call(this),this.controlBox.style.display="none"},y.prototype.setupControlBox=function(){this.controlBox=re.createGroup();var C=re.createTransform();C.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(C),this.container.appendChild(this.controlBox),this.controlRect=re.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=re.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 Me,this.addControlGrips(),this.controlBox.style.display="none"},y.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()},y.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()},y.prototype.createGrip=function(){var C=new et;return C.visual.transform.baseVal.appendItem(re.createTransform()),this.controlBox.appendChild(C.visual),C},y.prototype.positionGrips=function(){var C=this.controlGrips.topLeft.GRIP_SIZE,N=-C/2,Z=N,W=(this.width+this.CB_DISTANCE)/2-C/2,ge=(this.height+this.CB_DISTANCE)/2-C/2,Ue=this.height+this.CB_DISTANCE-C/2,it=this.width+this.CB_DISTANCE-C/2;this.positionGrip(this.controlGrips.topLeft.visual,N,Z),this.positionGrip(this.controlGrips.topCenter.visual,W,Z),this.positionGrip(this.controlGrips.topRight.visual,it,Z),this.positionGrip(this.controlGrips.centerLeft.visual,N,ge),this.positionGrip(this.controlGrips.centerRight.visual,it,ge),this.positionGrip(this.controlGrips.bottomLeft.visual,N,Ue),this.positionGrip(this.controlGrips.bottomCenter.visual,W,Ue),this.positionGrip(this.controlGrips.bottomRight.visual,it,Ue),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,W,Z-3*this.CB_DISTANCE)},y.prototype.positionGrip=function(C,N,Z){var W=C.transform.baseVal.getItem(0);W.setTranslate(N,Z),C.transform.baseVal.replaceItem(W,0)},y.prototype.hideControlBox=function(){this.controlBox.style.display="none"},y.prototype.showControlBox=function(){this.controlBox.style.display=""},y.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:Je.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:Je.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},z.prototype.getState.call(this))},y.prototype.restoreState=function(C){z.prototype.restoreState.call(this,C);var N=C;this.left=N.left,this.top=N.top,this.width=N.width,this.height=N.height,this.rotationAngle=N.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(Je.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,N.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(Je.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,N.containerTransformMatrix))},y.prototype.scale=function(C,N){z.prototype.scale.call(this,C,N);var Z=this.rotatePoint({x:this.left,y:this.top}),W=this.unrotatePoint({x:Z.x*C,y:Z.y*N});this.left=W.x,this.top=W.y,this.width=this.width*C,this.height=this.height*N,this.adjustControlBox()},y}(je),Ze=function(z){function y(C,N,Z){var W=z.call(this,C,N,Z)||this;return W.fillColor="transparent",W.strokeColor="transparent",W.strokeWidth=0,W.strokeDasharray="",W.opacity=1,W.setStrokeColor=W.setStrokeColor.bind(W),W.setFillColor=W.setFillColor.bind(W),W.setStrokeWidth=W.setStrokeWidth.bind(W),W.setStrokeDasharray=W.setStrokeDasharray.bind(W),W.createVisual=W.createVisual.bind(W),W}return we(y,z),y.prototype.ownsTarget=function(C){return!(!z.prototype.ownsTarget.call(this,C)&&C!==this.visual)},y.prototype.createVisual=function(){this.visual=re.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)},y.prototype.pointerDown=function(C,N){z.prototype.pointerDown.call(this,C,N),this.state==="new"&&(this.createVisual(),this.moveVisual(C),this._state="creating")},y.prototype.manipulate=function(C){z.prototype.manipulate.call(this,C)},y.prototype.resize=function(C){z.prototype.resize.call(this,C),this.setSize()},y.prototype.setSize=function(){z.prototype.setSize.call(this),re.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},y.prototype.pointerUp=function(C){z.prototype.pointerUp.call(this,C),this.setSize()},y.prototype.setStrokeColor=function(C){this.strokeColor=C,this.visual&&re.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(C),this.stateChanged()},y.prototype.setFillColor=function(C){this.fillColor=C,this.visual&&re.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},y.prototype.setStrokeWidth=function(C){this.strokeWidth=C,this.visual&&re.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},y.prototype.setStrokeDasharray=function(C){this.strokeDasharray=C,this.visual&&re.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},y.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},z.prototype.getState.call(this))},y.prototype.restoreState=function(C){var N=C;this.fillColor=N.fillColor,this.strokeColor=N.strokeColor,this.strokeWidth=N.strokeWidth,this.strokeDasharray=N.strokeDasharray,this.opacity=N.opacity,this.createVisual(),z.prototype.restoreState.call(this,C),this.setSize()},y.prototype.scale=function(C,N){z.prototype.scale.call(this,C,N),this.setSize()},y.title="Rectangle marker",y}(qe),dt=function(z){function y(C,N,Z,W){var ge=z.call(this,C,W||'<svg viewBox="0 0 24 24"><path d="M3 17h18v-2H3v2m0 3h18v-1H3v1m0-7h18v-3H3v3m0-9v4h18V4H3z"/></svg>')||this;return ge.widths=[],ge.widthBoxes=[],ge.widths=N,ge.currentWidth=Z,ge.setCurrentWidth=ge.setCurrentWidth.bind(ge),ge}return we(y,z),y.prototype.getUi=function(){var C=this,N=document.createElement("div");return N.style.display="flex",N.style.overflow="hidden",N.style.flexGrow="2",this.widths.forEach(function(Z){var W=document.createElement("div");W.style.display="flex",W.style.flexGrow="2",W.style.alignItems="center",W.style.justifyContent="space-between",W.style.padding="5px",W.style.borderWidth="2px",W.style.borderStyle="solid",W.style.borderColor=Z===C.currentWidth?C.uiStyleSettings.toolboxAccentColor:"transparent",W.addEventListener("click",function(){C.setCurrentWidth(Z,W)}),N.appendChild(W);var ge=document.createElement("div");ge.innerText=Z.toString(),ge.style.marginRight="5px",W.appendChild(ge);var Ue=document.createElement("div");Ue.style.minHeight="20px",Ue.style.flexGrow="2",Ue.style.display="flex",Ue.style.alignItems="center";var it=document.createElement("hr");it.style.minWidth="20px",it.style.border="0px",it.style.borderTop=Z+"px solid "+C.uiStyleSettings.toolboxColor,it.style.flexGrow="2",Ue.appendChild(it),W.appendChild(Ue),C.widthBoxes.push(W)}),N},y.prototype.setCurrentWidth=function(C,N){var Z=this;this.currentWidth=C,this.widthBoxes.forEach(function(W){W.style.borderColor=W===N?Z.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},y}(Ke),Xe=function(z){function y(C,N,Z,W){var ge=z.call(this,C,W||'<svg viewBox="0 0 24 24"><path d="M3 16h5v-2H3v2m6.5 0h5v-2h-5v2m6.5 0h5v-2h-5v2M3 20h2v-2H3v2m4 0h2v-2H7v2m4 0h2v-2h-2v2m4 0h2v-2h-2v2m4 0h2v-2h-2v2M3 12h8v-2H3v2m10 0h8v-2h-8v2M3 4v4h18V4H3z"/></svg>')||this;return ge.styles=[],ge.styleBoxes=[],ge.styles=N,ge.currentStyle=Z,ge.setCurrentStyle=ge.setCurrentStyle.bind(ge),ge}return we(y,z),y.prototype.getUi=function(){var C=this,N=document.createElement("div");return N.style.display="flex",N.style.overflow="hidden",N.style.flexGrow="2",this.styles.forEach(function(Z){var W=document.createElement("div");W.style.display="flex",W.style.alignItems="center",W.style.justifyContent="space-between",W.style.padding="5px",W.style.borderWidth="2px",W.style.borderStyle="solid",W.style.overflow="hidden",W.style.maxWidth=100/C.styles.length-5+"%",W.style.borderColor=Z===C.currentStyle?C.uiStyleSettings.toolboxAccentColor:"transparent",W.addEventListener("click",function(){C.setCurrentStyle(Z,W)}),N.appendChild(W);var ge=document.createElement("div");ge.style.minHeight="20px",ge.style.flexGrow="2",ge.style.overflow="hidden";var Ue=`<svg width="100" height="20">
<line x1="0" y1="10" x2="100" y2="10" stroke="`+C.uiStyleSettings.toolboxColor+'" stroke-width="3" '+(Z!==""?'stroke-dasharray="'+Z+'"':"")+` />
</svg>`;ge.innerHTML=Ue,W.appendChild(ge),C.styleBoxes.push(W)}),N},y.prototype.setCurrentStyle=function(C,N){var Z=this;this.currentStyle=C,this.styleBoxes.forEach(function(W){W.style.borderColor=W===N?Z.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},y}(Ke),Ye=function(z){function y(C,N,Z){var W=z.call(this,C,N,Z)||this;return W.strokeColor=Z.defaultColor,W.strokeWidth=Z.defaultStrokeWidth,W.strokeDasharray=Z.defaultStrokeDasharray,W.strokePanel=new Fe("Line color",Z.defaultColorSet,Z.defaultColor),W.strokePanel.onColorChanged=W.setStrokeColor,W.strokeWidthPanel=new dt("Line width",Z.defaultStrokeWidths,Z.defaultStrokeWidth),W.strokeWidthPanel.onWidthChanged=W.setStrokeWidth,W.strokeStylePanel=new Xe("Line style",Z.defaultStrokeDasharrays,Z.defaultStrokeDasharray),W.strokeStylePanel.onStyleChanged=W.setStrokeDasharray,W}return we(y,z),Object.defineProperty(y.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),y.prototype.getState=function(){var C=z.prototype.getState.call(this);return C.typeName=y.typeName,C},y.typeName="FrameMarker",y.title="Frame marker",y.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>',y}(Ze),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},ot=function(z){function y(C,N,Z){var W=z.call(this,C,N,Z)||this;return W.x1=0,W.y1=0,W.x2=0,W.y2=0,W.defaultLength=50,W.manipulationStartX=0,W.manipulationStartY=0,W.manipulationStartX1=0,W.manipulationStartY1=0,W.manipulationStartX2=0,W.manipulationStartY2=0,W.setupControlBox(),W}return we(y,z),y.prototype.ownsTarget=function(C){return!!z.prototype.ownsTarget.call(this,C)||!(!this.grip1.ownsTarget(C)&&!this.grip2.ownsTarget(C))},y.prototype.pointerDown=function(C,N){z.prototype.pointerDown.call(this,C,N),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(N)?this.activeGrip=this.grip1:this.grip2.ownsTarget(N)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},y.prototype.pointerUp=function(C){var N=this.state;z.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",N==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},y.prototype.adjustVisual=function(){},y.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)},y.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()},y.prototype.select=function(){z.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},y.prototype.deselect=function(){z.prototype.deselect.call(this),this.controlBox.style.display="none"},y.prototype.setupControlBox=function(){this.controlBox=re.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},y.prototype.adjustControlBox=function(){this.positionGrips()},y.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},y.prototype.createGrip=function(){var C=new et;return C.visual.transform.baseVal.appendItem(re.createTransform()),this.controlBox.appendChild(C.visual),C},y.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)},y.prototype.positionGrip=function(C,N,Z){var W=C.transform.baseVal.getItem(0);W.setTranslate(N,Z),C.transform.baseVal.replaceItem(W,0)},y.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},z.prototype.getState.call(this))},y.prototype.restoreState=function(C){z.prototype.restoreState.call(this,C);var N=C;this.x1=N.x1,this.y1=N.y1,this.x2=N.x2,this.y2=N.y2},y.prototype.scale=function(C,N){z.prototype.scale.call(this,C,N),this.x1=this.x1*C,this.y1=this.y1*N,this.x2=this.x2*C,this.y2=this.y2*N,this.adjustVisual(),this.adjustControlBox()},y}(je),tt=function(z){function y(C,N,Z){var W=z.call(this,C,N,Z)||this;return W.strokeColor="transparent",W.strokeWidth=0,W.strokeDasharray="",W.setStrokeColor=W.setStrokeColor.bind(W),W.setStrokeWidth=W.setStrokeWidth.bind(W),W.setStrokeDasharray=W.setStrokeDasharray.bind(W),W.strokeColor=Z.defaultColor,W.strokeWidth=Z.defaultStrokeWidth,W.strokeDasharray=Z.defaultStrokeDasharray,W.strokePanel=new Fe("Line color",Z.defaultColorSet,Z.defaultColor),W.strokePanel.onColorChanged=W.setStrokeColor,W.strokeWidthPanel=new dt("Line width",Z.defaultStrokeWidths,Z.defaultStrokeWidth),W.strokeWidthPanel.onWidthChanged=W.setStrokeWidth,W.strokeStylePanel=new Xe("Line style",Z.defaultStrokeDasharrays,Z.defaultStrokeDasharray),W.strokeStylePanel.onStyleChanged=W.setStrokeDasharray,W}return we(y,z),y.prototype.ownsTarget=function(C){return!(!z.prototype.ownsTarget.call(this,C)&&C!==this.visual&&C!==this.selectorLine&&C!==this.visibleLine)},y.prototype.createVisual=function(){this.visual=re.createGroup(),this.selectorLine=re.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=re.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)},y.prototype.pointerDown=function(C,N){z.prototype.pointerDown.call(this,C,N),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},y.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()),re.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),re.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),re.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},y.prototype.setStrokeColor=function(C){this.strokeColor=C,this.adjustVisual(),this.colorChanged(C)},y.prototype.setStrokeWidth=function(C){this.strokeWidth=C,this.adjustVisual()},y.prototype.setStrokeDasharray=function(C){this.strokeDasharray=C,this.adjustVisual(),this.stateChanged()},Object.defineProperty(y.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),y.prototype.getState=function(){var C=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},z.prototype.getState.call(this));return C.typeName=y.typeName,C},y.prototype.restoreState=function(C){z.prototype.restoreState.call(this,C);var N=C;this.strokeColor=N.strokeColor,this.strokeWidth=N.strokeWidth,this.strokeDasharray=N.strokeDasharray,this.createVisual(),this.adjustVisual()},y.typeName="LineMarker",y.title="Line marker",y.icon='<svg viewBox="0 0 24 24"><path d="M19 13H5v-2h14v2z"/></svg>',y}(ot),Re=function(z){function y(C,N,Z,W){var ge=z.call(this,C,W||'<svg viewBox="0 0 24 24"><path d="M17 8h3v12h1v1h-4v-1h1v-3h-4l-1.5 3H14v1h-4v-1h1l6-12m1 1l-3.5 7H18V9M5 3h5c1.11 0 2 .89 2 2v11H9v-5H6v5H3V5c0-1.11.89-2 2-2m1 2v4h3V5H6z"/></svg>')||this;return ge.fonts=[],ge.fontBoxes=[],ge.fonts=N,ge.currentFont=Z,ge.setCurrentFont=ge.setCurrentFont.bind(ge),ge}return we(y,z),y.prototype.getUi=function(){var C=this,N=document.createElement("div");return N.style.overflow="hidden",N.style.flexGrow="2",this.fonts.forEach(function(Z){var W=document.createElement("div");W.style.display="inline-block",W.style.alignItems="center",W.style.justifyContent="space-between",W.style.padding="5px",W.style.borderWidth="2px",W.style.borderStyle="solid",W.style.overflow="hidden",W.style.maxWidth=100/C.fonts.length-5+"%",W.style.borderColor=Z===C.currentFont?C.uiStyleSettings.toolboxAccentColor:"transparent",W.addEventListener("click",function(){C.setCurrentFont(Z,W)}),N.appendChild(W);var ge=document.createElement("div");ge.style.display="flex",ge.style.minHeight="20px",ge.style.flexGrow="2",ge.style.fontFamily=Z,ge.style.overflow="hidden";var Ue=document.createElement("div");Ue.style.whiteSpace="nowrap",Ue.style.overflow="hidden",Ue.style.textOverflow="ellipsis",Ue.innerHTML="The quick brown fox jumps over the lazy dog",ge.appendChild(Ue),W.appendChild(ge),C.fontBoxes.push(W)}),N},y.prototype.setCurrentFont=function(C,N){var Z=this;this.currentFont=C,this.fontBoxes.forEach(function(W){W.style.borderColor=W===N?Z.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},y}(Ke),We=function(z){function y(C,N,Z){var W=z.call(this,C,N,Z)||this;return W.color="transparent",W.padding=5,W.DEFAULT_TEXT="your text here",W.text=W.DEFAULT_TEXT,W.isMoved=!1,W.color=Z.defaultColor,W.fontFamily=Z.defaultFontFamily,W.defaultSize={x:100,y:30},W.setColor=W.setColor.bind(W),W.setFont=W.setFont.bind(W),W.renderText=W.renderText.bind(W),W.sizeText=W.sizeText.bind(W),W.textEditDivClicked=W.textEditDivClicked.bind(W),W.showTextEditor=W.showTextEditor.bind(W),W.setSize=W.setSize.bind(W),W.positionTextEditor=W.positionTextEditor.bind(W),W.colorPanel=new Fe("Color",Z.defaultColorSet,Z.defaultColor),W.colorPanel.onColorChanged=W.setColor,W.fontFamilyPanel=new Re("Font",Z.defaultFontFamilies,Z.defaultFontFamily),W.fontFamilyPanel.onFontChanged=W.setFont,W}return we(y,z),y.prototype.ownsTarget=function(C){if(z.prototype.ownsTarget.call(this,C)||C===this.visual||C===this.textElement||C===this.bgRectangle)return!0;var N=!1;return this.textElement.childNodes.forEach(function(Z){Z===C&&(N=!0)}),N},y.prototype.createVisual=function(){this.visual=re.createGroup(),this.bgRectangle=re.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=re.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(re.createTransform()),this.textElement.transform.baseVal.appendItem(re.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},y.prototype.pointerDown=function(C,N){z.prototype.pointerDown.call(this,C,N),this.isMoved=!1,this.pointerDownPoint=C,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(C),this._state="creating")},y.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(N){C.textElement.appendChild(re.createTSpan(N.trim()===""?" ":N.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},y.prototype.getTextScale=function(){var C=this.textElement.getBBox(),N=1;if(C.width>0&&C.height>0){var Z=(1*this.width-this.width*this.padding*2/100)/C.width,W=(1*this.height-this.height*this.padding*2/100)/C.height;N=Math.min(Z,W)}return N},y.prototype.getTextPosition=function(C){var N=this.textElement.getBBox(),Z=0,W=0;return N.width>0&&N.height>0&&(Z=(this.width-N.width*C)/2,W=this.height/2-N.height*C/2),{x:Z,y:W}},y.prototype.sizeText=function(){var C=this.textElement.getBBox(),N=this.getTextScale(),Z=this.getTextPosition(N);Z.y-=C.y*N,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+Z.x+"px, "+Z.y+"px) scale("+N+", "+N+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(Z.x,Z.y),this.textElement.transform.baseVal.getItem(1).setScale(N,N))},y.prototype.manipulate=function(C){z.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)},y.prototype.resize=function(C){z.prototype.resize.call(this,C),this.isMoved=!0,this.setSize(),this.sizeText()},y.prototype.setSize=function(){z.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(re.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),re.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},y.prototype.pointerUp=function(C){var N=this.state;N==="creating"&&(this._suppressMarkerCreateEvent=!0),z.prototype.pointerUp.call(this,C),this.setSize(),(N==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},y.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(N){N.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var N=Number.parseFloat(C.textEditor.style.fontSize);C.textEditor.clientWidth>=Number.parseInt(C.textEditor.style.maxWidth)&&N>.9;)N-=.1,C.textEditor.style.fontSize=Math.max(N,.9)+"em"}),this.textEditor.addEventListener("keyup",function(N){N.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(N){if(N.clipboardData){var Z=N.clipboardData.getData("text"),W=window.getSelection();if(!W.rangeCount)return!1;W.deleteFromDocument(),W.getRangeAt(0).insertNode(document.createTextNode(Z)),N.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")},y.prototype.positionTextEditor=function(){if(this.state==="edit")if(this.textEditor===void 0)this.showTextEditor();else{this.textElement.style.display="";var C=this.getTextScale(),N=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),Z=this.textElement.getBBox(),W={x:Z.width*C,y:Z.height*C};N.x-=W.x/2,N.y-=W.y/2,this.textEditor.style.top=N.y+"px",this.textEditor.style.left=N.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-N.x+"px",this.textEditor.style.fontSize=Math.max(16*C,12)+"px",this.textElement.style.display="none"}},y.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()},y.prototype.select=function(){z.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},y.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),z.prototype.deselect.call(this)},y.prototype.dblClick=function(C,N){z.prototype.dblClick.call(this,C,N),this.showTextEditor()},y.prototype.setColor=function(C){this.textElement&&re.setAttributes(this.textElement,[["fill",C]]),this.color=C,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(C)},y.prototype.setFont=function(C){this.textElement&&re.setAttributes(this.textElement,[["font-family",C]]),this.fontFamily=C,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},y.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},y.prototype.showVisual=function(){this.state==="edit"&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(y.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),y.prototype.getState=function(){var C=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},z.prototype.getState.call(this));return C.typeName=y.typeName,C},y.prototype.restoreState=function(C){var N=C;this.color=N.color,this.fontFamily=N.fontFamily,this.padding=N.padding,this.text=N.text,this.createVisual(),z.prototype.restoreState.call(this,C),this.setSize()},y.prototype.scale=function(C,N){z.prototype.scale.call(this,C,N),this.setSize(),this.sizeText(),this.positionTextEditor()},y.typeName="TextMarker",y.title="Text marker",y.icon='<svg viewBox="0 0 24 24"><path d="M9.6 14L12 7.7l2.4 6.3M11 5L5.5 19h2.2l1.1-3H15l1.1 3h2.2L13 5h-2z"/></svg>',y}(qe),_e=function(z){function y(C,N,Z){var W=z.call(this,C,N,Z)||this;return W.color="transparent",W.lineWidth=3,W.drawing=!1,W.pixelRatio=1,W.color=Z.defaultColor,W.lineWidth=Z.defaultStrokeWidth,W.pixelRatio=Z.freehandPixelRatio,W.setColor=W.setColor.bind(W),W.addCanvas=W.addCanvas.bind(W),W.finishCreation=W.finishCreation.bind(W),W.setLineWidth=W.setLineWidth.bind(W),W.colorPanel=new Fe("Color",Z.defaultColorSet,Z.defaultColor),W.colorPanel.onColorChanged=W.setColor,W.lineWidthPanel=new dt("Line width",Z.defaultStrokeWidths,Z.defaultStrokeWidth),W.lineWidthPanel.onWidthChanged=W.setLineWidth,W}return we(y,z),y.prototype.ownsTarget=function(C){return!(!z.prototype.ownsTarget.call(this,C)&&C!==this.visual&&C!==this.drawingImage)},y.prototype.createVisual=function(){this.visual=re.createGroup(),this.drawingImage=re.createImage(),this.visual.appendChild(this.drawingImage);var C=re.createTransform();this.visual.transform.baseVal.appendItem(C),this.addMarkerVisualToContainer(this.visual)},y.prototype.pointerDown=function(C,N){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):z.prototype.pointerDown.call(this,C,N)},y.prototype.manipulate=function(C){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(C.x,C.y),this.canvasContext.stroke()):z.prototype.manipulate.call(this,C)},y.prototype.resize=function(C){z.prototype.resize.call(this,C),re.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),re.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},y.prototype.pointerUp=function(C){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):z.prototype.pointerUp.call(this,C)},y.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)},y.prototype.select=function(){this.state==="creating"&&this.finishCreation(),z.prototype.select.call(this)},y.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),z.prototype.deselect.call(this)},y.prototype.finishCreation=function(){for(var C=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),N=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],Z=N[0],W=N[1],ge=N[2],Ue=N[3],it=!1,mt=0;mt<this.canvasElement.height;mt++)for(var Ge=0;Ge<this.canvasElement.width;Ge++)C.data[mt*this.canvasElement.width*4+4*Ge+3]>0&&(it=!0,mt<W&&(W=mt),Ge<Z&&(Z=Ge),mt>Ue&&(Ue=mt),Ge>ge&&(ge=Ge));if(it){this.left=Z/this.pixelRatio,this.top=W/this.pixelRatio,this.width=(ge-Z)/this.pixelRatio,this.height=(Ue-W)/this.pixelRatio;var bt=document.createElement("canvas");bt.width=ge-Z,bt.height=Ue-W,bt.getContext("2d").putImageData(this.canvasContext.getImageData(Z,W,ge-Z,Ue-W),0,0),this.drawingImgUrl=bt.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},y.prototype.setDrawingImage=function(){re.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),re.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},y.prototype.setColor=function(C){this.color=C,this.colorChanged(C)},y.prototype.setLineWidth=function(C){this.lineWidth=C},Object.defineProperty(y.prototype,"toolboxPanels",{get:function(){return this.state==="new"||this.state==="creating"?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),y.prototype.getState=function(){var C=Object.assign({drawingImgUrl:this.drawingImgUrl},z.prototype.getState.call(this));return C.typeName=y.typeName,C},y.prototype.restoreState=function(C){this.createVisual(),z.prototype.restoreState.call(this,C),this.drawingImgUrl=C.drawingImgUrl,this.setDrawingImage()},y.prototype.scale=function(C,N){z.prototype.scale.call(this,C,N),this.setDrawingImage()},y.typeName="FreehandMarker",y.title="Freehand marker",y.icon='<svg viewBox="0 0 24 24"><path d="M9.75 20.85c1.78-.7 1.39-2.63.49-3.85-.89-1.25-2.12-2.11-3.36-2.94A9.817 9.817 0 014.54 12c-.28-.33-.85-.94-.27-1.06.59-.12 1.61.46 2.13.68.91.38 1.81.82 2.65 1.34l1.01-1.7C8.5 10.23 6.5 9.32 4.64 9.05c-1.06-.16-2.18.06-2.54 1.21-.32.99.19 1.99.77 2.77 1.37 1.83 3.5 2.71 5.09 4.29.34.33.75.72.95 1.18.21.44.16.47-.31.47-1.24 0-2.79-.97-3.8-1.61l-1.01 1.7c1.53.94 4.09 2.41 5.96 1.79m11.09-15.6c.22-.22.22-.58 0-.79l-1.3-1.3a.562.562 0 00-.78 0l-1.02 1.02 2.08 2.08M11 10.92V13h2.08l6.15-6.15-2.08-2.08L11 10.92z"/></svg>',y}(qe),me=function(z){function y(C,N,Z){var W=z.call(this,C,Z||'<svg viewBox="0 0 24 24"><path d="M8 14v4l-6-6 6-6v4h8V6l6 6-6 6v-4H8z"/></svg>')||this;return W.typeBoxes=[],W.currentType=N,W.setCurrentType=W.setCurrentType.bind(W),W}return we(y,z),y.prototype.getUi=function(){var C=this,N=document.createElement("div");N.style.display="flex",N.style.overflow="hidden",N.style.flexGrow="2";for(var Z=function(Ue){var it="both";switch(Ue){case 0:it="both";break;case 1:it="start";break;case 2:it="end";break;case 3:it="none"}var mt=document.createElement("div");if(mt.style.display="flex",mt.style.flexGrow="2",mt.style.alignItems="center",mt.style.justifyContent="space-between",mt.style.padding="5px",mt.style.borderWidth="2px",mt.style.borderStyle="solid",mt.style.borderColor=it===W.currentType?W.uiStyleSettings.toolboxAccentColor:"transparent",mt.addEventListener("click",function(){C.setCurrentType(it,mt)}),N.appendChild(mt),it==="both"||it==="start"){var Ge=document.createElement("div");Ge.style.display="flex",Ge.style.alignItems="center",Ge.style.minHeight="20px",Ge.innerHTML=`<svg viewBox="0 0 10 10" width="10" height="10" xmlns="http://www.w3.org/2000/svg">
<polygon points="0,5 10,0 10,10" fill="`+(W.uiStyleSettings!==void 0?W.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
</svg>`,Ge.style.marginLeft="5px",mt.appendChild(Ge)}var bt=document.createElement("div");bt.style.display="flex",bt.style.alignItems="center",bt.style.minHeight="20px",bt.style.flexGrow="2";var Ht=document.createElement("hr");if(Ht.style.minWidth="20px",Ht.style.border="0px",Ht.style.borderTop="3px solid "+(W.uiStyleSettings!==void 0?W.uiStyleSettings.toolboxColor:"#eeeeee"),Ht.style.flexGrow="2",bt.appendChild(Ht),mt.appendChild(bt),it==="both"||it==="end"){var $t=document.createElement("div");$t.style.display="flex",$t.style.alignItems="center",$t.style.minHeight="20px",$t.innerHTML=`<svg viewBox="0 0 10 10" width="10" height="10" xmlns="http://www.w3.org/2000/svg">
<polygon points="0,0 10,5 0,10" fill="`+(W.uiStyleSettings!==void 0?W.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
</svg>`,$t.style.marginRight="5px",mt.appendChild($t)}W.typeBoxes.push(mt)},W=this,ge=0;ge<4;ge++)Z(ge);return N},y.prototype.setCurrentType=function(C,N){var Z=this;this.currentType=C,this.typeBoxes.forEach(function(W){W.style.borderColor=W===N?Z.uiStyleSettings!==void 0?Z.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},y}(Ke),ve=function(z){function y(C,N,Z){var W=z.call(this,C,N,Z)||this;return W.arrowType="end",W.arrowBaseHeight=10,W.arrowBaseWidth=10,W.getArrowPoints=W.getArrowPoints.bind(W),W.setArrowType=W.setArrowType.bind(W),W.arrowTypePanel=new me("Arrow type","end"),W.arrowTypePanel.onArrowTypeChanged=W.setArrowType,W}return we(y,z),y.prototype.ownsTarget=function(C){return!(!z.prototype.ownsTarget.call(this,C)&&C!==this.arrow1&&C!==this.arrow2)},y.prototype.getArrowPoints=function(C,N){var Z=this.arrowBaseWidth+2*this.strokeWidth,W=this.arrowBaseHeight+2*this.strokeWidth;return C-Z/2+","+(N+W/2)+" "+C+","+(N-W/2)+" "+(C+Z/2)+","+(N+W/2)},y.prototype.createTips=function(){this.arrow1=re.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(re.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=re.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(re.createTransform()),this.visual.appendChild(this.arrow2)},y.prototype.pointerDown=function(C,N){z.prototype.pointerDown.call(this,C,N),this.state==="creating"&&this.createTips()},y.prototype.adjustVisual=function(){if(z.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",re.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),re.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),N=this.arrow1.transform.baseVal.getItem(0);N.setRotate(C,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(N,0);var Z=this.arrow2.transform.baseVal.getItem(0);Z.setRotate(C+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(Z,0)}},y.prototype.setArrowType=function(C){this.arrowType=C,this.adjustVisual(),this.stateChanged()},Object.defineProperty(y.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),y.prototype.getState=function(){var C=Object.assign({arrowType:this.arrowType},z.prototype.getState.call(this));return C.typeName=y.typeName,C},y.prototype.restoreState=function(C){z.prototype.restoreState.call(this,C);var N=C;this.arrowType=N.arrowType,this.createTips(),this.adjustVisual()},y.typeName="ArrowMarker",y.title="Arrow marker",y.icon='<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 7 15.59V9H5v10h10v-2H8.41L19 6.41z"/></svg>',y}(tt),te=function(z){function y(C,N,Z){var W=z.call(this,C,N,Z)||this;return W.fillColor=Z.defaultFillColor,W.strokeWidth=0,W.fillPanel=new Fe("Color",Z.defaultColorSet,Z.defaultFillColor),W.fillPanel.onColorChanged=W.setFillColor,W}return we(y,z),Object.defineProperty(y.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),y.prototype.getState=function(){var C=z.prototype.getState.call(this);return C.typeName=y.typeName,C},y.typeName="CoverMarker",y.title="Cover marker",y.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>',y}(Ze),ie=function(z){function y(C,N,Z,W){var ge=z.call(this,C,W||'<svg viewBox="0 0 24 24"><path d="M17.66 8L12 2.35 6.34 8A8.02 8.02 0 004 13.64c0 2 .78 4.11 2.34 5.67a7.99 7.99 0 0011.32 0c1.56-1.56 2.34-3.67 2.34-5.67S19.22 9.56 17.66 8M6 14c0-2 .62-3.27 1.76-4.4L12 5.27l4.24 4.38C17.38 10.77 18 12 18 14H6z"/></svg>')||this;return ge.opacities=[],ge.opacityBoxes=[],ge.opacities=N,ge.currentOpacity=Z,ge.setCurrentOpacity=ge.setCurrentOpacity.bind(ge),ge}return we(y,z),y.prototype.getUi=function(){var C=this,N=document.createElement("div");return N.style.display="flex",N.style.overflow="hidden",N.style.flexGrow="2",N.style.justifyContent="space-between",this.opacities.forEach(function(Z){var W=document.createElement("div");W.style.display="flex",W.style.alignItems="center",W.style.justifyContent="center",W.style.padding="5px",W.style.borderWidth="2px",W.style.borderStyle="solid",W.style.borderColor=Z===C.currentOpacity?C.uiStyleSettings.toolboxAccentColor:"transparent",W.addEventListener("click",function(){C.setCurrentOpacity(Z,W)}),N.appendChild(W);var ge=document.createElement("div");ge.innerText=100*Z+"%",W.appendChild(ge),C.opacityBoxes.push(W)}),N},y.prototype.setCurrentOpacity=function(C,N){var Z=this;this.currentOpacity=C,this.opacityBoxes.forEach(function(W){W.style.borderColor=W===N?Z.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},y}(Ke),le=function(z){function y(C,N,Z){var W=z.call(this,C,N,Z)||this;return W.setOpacity=W.setOpacity.bind(W),W.fillColor=Z.defaultHighlightColor,W.strokeWidth=0,W.opacity=Z.defaultHighlightOpacity,W.fillPanel=new Fe("Color",Z.defaultColorSet,W.fillColor),W.fillPanel.onColorChanged=W.setFillColor,W.opacityPanel=new ie("Opacity",Z.defaultOpacitySteps,W.opacity),W.opacityPanel.onOpacityChanged=W.setOpacity,W}return we(y,z),y.prototype.setOpacity=function(C){this.opacity=C,this.visual&&re.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(y.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),y.prototype.getState=function(){var C=z.prototype.getState.call(this);return C.typeName=y.typeName,C},y.typeName="HighlightMarker",y.title="Highlight marker",y.icon='<svg viewBox="0 0 24 24"><path d="M18.5 1.15c-.53 0-1.04.19-1.43.58l-5.81 5.82 5.65 5.65 5.82-5.81c.77-.78.77-2.04 0-2.83l-2.84-2.83c-.39-.39-.89-.58-1.39-.58M10.3 8.5l-5.96 5.96c-.78.78-.78 2.04.02 2.85C3.14 18.54 1.9 19.77.67 21h5.66l.86-.86c.78.76 2.03.75 2.81-.02l5.95-5.96"/></svg>',y}(te),pe='<svg viewBox="0 0 24 24"><path d="M19 11.5s-2 2.17-2 3.5a2 2 0 002 2 2 2 0 002-2c0-1.33-2-3.5-2-3.5M5.21 10L10 5.21 14.79 10m1.77-1.06L7.62 0 6.21 1.41l2.38 2.38-5.15 5.15c-.59.56-.59 1.53 0 2.12l5.5 5.5c.29.29.68.44 1.06.44s.77-.15 1.06-.44l5.5-5.5c.59-.59.59-1.56 0-2.12z"/></svg>',ye=function(z){function y(C,N,Z){var W=z.call(this,C,N,Z)||this;return W.bgColor="transparent",W.tipPosition={x:0,y:0},W.tipBase1Position={x:0,y:0},W.tipBase2Position={x:0,y:0},W.tipMoving=!1,W.color=Z.defaultStrokeColor,W.bgColor=Z.defaultFillColor,W.fontFamily=Z.defaultFontFamily,W.defaultSize={x:100,y:30},W.setBgColor=W.setBgColor.bind(W),W.getTipPoints=W.getTipPoints.bind(W),W.positionTip=W.positionTip.bind(W),W.setTipPoints=W.setTipPoints.bind(W),W.colorPanel=new Fe("Text color",Z.defaultColorSet,W.color,'<svg viewBox="0 0 24 24"><path d="M9.62 12L12 5.67 14.37 12M11 3L5.5 17h2.25l1.12-3h6.25l1.13 3h2.25L13 3h-2z"/></svg>'),W.colorPanel.onColorChanged=W.setColor,W.bgColorPanel=new Fe("Fill color",Z.defaultColorSet,W.bgColor,pe),W.bgColorPanel.onColorChanged=W.setBgColor,W.fontFamilyPanel=new Re("Font",Z.defaultFontFamilies,Z.defaultFontFamily),W.fontFamilyPanel.onFontChanged=W.setFont,W.tipGrip=new et,W.tipGrip.visual.transform.baseVal.appendItem(re.createTransform()),W.controlBox.appendChild(W.tipGrip.visual),W}return we(y,z),y.prototype.ownsTarget=function(C){return z.prototype.ownsTarget.call(this,C)||this.tipGrip.ownsTarget(C)||this.tip===C},y.prototype.createTip=function(){re.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=re.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},y.prototype.pointerDown=function(C,N){this.state==="new"&&z.prototype.pointerDown.call(this,C,N),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(N)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):z.prototype.pointerDown.call(this,C,N)},y.prototype.pointerUp=function(C){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,z.prototype.pointerUp.call(this,C);else{var N=this.state==="creating";z.prototype.pointerUp.call(this,C),this.setTipPoints(N),this.positionTip()}},y.prototype.manipulate=function(C){if(this.tipMoving){var N=this.unrotatePoint(C);this.tipPosition={x:N.x-this.manipulationStartLeft,y:N.y-this.manipulationStartTop},this.positionTip()}else z.prototype.manipulate.call(this,C)},y.prototype.setBgColor=function(C){this.bgRectangle&&this.tip&&(re.setAttributes(this.bgRectangle,[["fill",C]]),re.setAttributes(this.tip,[["fill",C]])),this.bgColor=C,this.fillColorChanged(C)},y.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},y.prototype.setTipPoints=function(C){C===void 0&&(C=!1);var N=Math.min(this.height/2,15),Z=this.height/5;C&&(this.tipPosition={x:N+Z/2,y:this.height+20});var W=Math.atan(this.height/2/(this.width/2));this.tipPosition.x<this.width/2&&this.tipPosition.y<this.height/2?W<Math.atan((this.height/2-this.tipPosition.y)/(this.width/2-this.tipPosition.x))?(Z=this.width/5,N=Math.min(this.width/2,15),this.tipBase1Position={x:N,y:0},this.tipBase2Position={x:N+Z,y:0}):(this.tipBase1Position={x:0,y:N},this.tipBase2Position={x:0,y:N+Z}):this.tipPosition.x>=this.width/2&&this.tipPosition.y<this.height/2?W<Math.atan((this.height/2-this.tipPosition.y)/(this.tipPosition.x-this.width/2))?(Z=this.width/5,N=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-N-Z,y:0},this.tipBase2Position={x:this.width-N,y:0}):(this.tipBase1Position={x:this.width,y:N},this.tipBase2Position={x:this.width,y:N+Z}):this.tipPosition.x>=this.width/2&&this.tipPosition.y>=this.height/2?W<Math.atan((this.tipPosition.y-this.height/2)/(this.tipPosition.x-this.width/2))?(Z=this.width/5,N=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-N-Z,y:this.height},this.tipBase2Position={x:this.width-N,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-N-Z},this.tipBase2Position={x:this.width,y:this.height-N}):W<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?(Z=this.width/5,N=Math.min(this.width/2,15),this.tipBase1Position={x:N,y:this.height},this.tipBase2Position={x:N+Z,y:this.height}):(this.tipBase1Position={x:0,y:this.height-N},this.tipBase2Position={x:0,y:this.height-N-Z})},y.prototype.resize=function(C){z.prototype.resize.call(this,C),this.positionTip()},y.prototype.positionTip=function(){re.setAttributes(this.tip,[["points",this.getTipPoints()]]);var C=this.tipGrip.visual.transform.baseVal.getItem(0);C.setTranslate(this.tipPosition.x,this.tipPosition.y),this.tipGrip.visual.transform.baseVal.replaceItem(C,0)},Object.defineProperty(y.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.bgColorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),y.prototype.select=function(){this.positionTip(),z.prototype.select.call(this)},y.prototype.getState=function(){var C=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},z.prototype.getState.call(this));return C.typeName=y.typeName,C},y.prototype.restoreState=function(C){var N=C;this.bgColor=N.bgColor,this.tipPosition=N.tipPosition,z.prototype.restoreState.call(this,C),this.createTip(),this.setTipPoints()},y.prototype.scale=function(C,N){z.prototype.scale.call(this,C,N),this.tipPosition={x:this.tipPosition.x*C,y:this.tipPosition.y*N},this.positionTip()},y.typeName="CalloutMarker",y.title="Callout marker",y.icon='<svg viewBox="0 0 24 24"><path d="M4 2h16a2 2 0 012 2v12a2 2 0 01-2 2h-4l-4 4-4-4H4a2 2 0 01-2-2V4a2 2 0 012-2m0 2v12h4.83L12 19.17 15.17 16H20V4H4m2 3h12v2H6V7m0 4h10v2H6v-2z"/></svg>',y}(We),Le=function(z){function y(C,N,Z){var W=z.call(this,C,N,Z)||this;return W.fillColor="transparent",W.strokeColor="transparent",W.strokeWidth=0,W.strokeDasharray="",W.opacity=1,W.strokeColor=Z.defaultColor,W.strokeWidth=Z.defaultStrokeWidth,W.strokeDasharray=Z.defaultStrokeDasharray,W.fillColor=Z.defaultFillColor,W.setStrokeColor=W.setStrokeColor.bind(W),W.setFillColor=W.setFillColor.bind(W),W.setStrokeWidth=W.setStrokeWidth.bind(W),W.setStrokeDasharray=W.setStrokeDasharray.bind(W),W.setOpacity=W.setOpacity.bind(W),W.createVisual=W.createVisual.bind(W),W.strokePanel=new Fe("Line color",se(Z.defaultColorSet,["transparent"]),Z.defaultColor),W.strokePanel.onColorChanged=W.setStrokeColor,W.fillPanel=new Fe("Fill color",se(Z.defaultColorSet,["transparent"]),W.fillColor,pe),W.fillPanel.onColorChanged=W.setFillColor,W.strokeWidthPanel=new dt("Line width",Z.defaultStrokeWidths,Z.defaultStrokeWidth),W.strokeWidthPanel.onWidthChanged=W.setStrokeWidth,W.strokeStylePanel=new Xe("Line style",Z.defaultStrokeDasharrays,Z.defaultStrokeDasharray),W.strokeStylePanel.onStyleChanged=W.setStrokeDasharray,W.opacityPanel=new ie("Opacity",Z.defaultOpacitySteps,W.opacity),W.opacityPanel.onOpacityChanged=W.setOpacity,W}return we(y,z),y.prototype.ownsTarget=function(C){return!(!z.prototype.ownsTarget.call(this,C)&&C!==this.visual)},y.prototype.createVisual=function(){this.visual=re.createEllipse(this.width/2,this.height/2,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},y.prototype.pointerDown=function(C,N){z.prototype.pointerDown.call(this,C,N),this.state==="new"&&(this.createVisual(),this.moveVisual(C),this._state="creating")},y.prototype.manipulate=function(C){z.prototype.manipulate.call(this,C)},y.prototype.resize=function(C){z.prototype.resize.call(this,C),this.setSize()},y.prototype.setSize=function(){z.prototype.setSize.call(this),re.setAttributes(this.visual,[["cx",(this.width/2).toString()],["cy",(this.height/2).toString()],["rx",(this.width/2).toString()],["ry",(this.height/2).toString()]])},y.prototype.pointerUp=function(C){z.prototype.pointerUp.call(this,C),this.setSize()},y.prototype.setStrokeColor=function(C){this.strokeColor=C,this.visual&&re.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(C),this.stateChanged()},y.prototype.setFillColor=function(C){this.fillColor=C,this.visual&&re.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(C),this.stateChanged()},y.prototype.setStrokeWidth=function(C){this.strokeWidth=C,this.visual&&re.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},y.prototype.setStrokeDasharray=function(C){this.strokeDasharray=C,this.visual&&re.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},y.prototype.setOpacity=function(C){this.opacity=C,this.visual&&re.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(y.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),y.prototype.getState=function(){var C=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},z.prototype.getState.call(this));return C.typeName=y.typeName,C},y.prototype.restoreState=function(C){var N=C;this.fillColor=N.fillColor,this.strokeColor=N.strokeColor,this.strokeWidth=N.strokeWidth,this.strokeDasharray=N.strokeDasharray,this.opacity=N.opacity,this.createVisual(),z.prototype.restoreState.call(this,C),this.setSize()},y.prototype.scale=function(C,N){z.prototype.scale.call(this,C,N),this.setSize()},y.typeName="EllipseMarker",y.title="Ellipse marker",y.icon='<svg viewBox="0 0 24 24"><path d="M12 4C6.5 4 2 7.58 2 12s4.5 8 10 8 10-3.58 10-8-4.5-8-10-8z"/></svg>',y}(qe),He=function(z){function y(C,N,Z){return z.call(this,C,N,Z)||this}return we(y,z),Object.defineProperty(y.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),y.prototype.ownsTarget=function(C){return!(!z.prototype.ownsTarget.call(this,C)&&C!==this.tip1&&C!==this.tip2)},y.prototype.createTips=function(){this.tip1=re.createLine(this.x1-this.tipLength/2,this.y1,this.x1+this.tipLength/2,this.y1,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.tip1.transform.baseVal.appendItem(re.createTransform()),this.visual.appendChild(this.tip1),this.tip2=re.createLine(this.x2-this.tipLength/2,this.y2,this.x2+this.tipLength/2,this.y2,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.tip2.transform.baseVal.appendItem(re.createTransform()),this.visual.appendChild(this.tip2)},y.prototype.pointerDown=function(C,N){z.prototype.pointerDown.call(this,C,N),this.state==="creating"&&this.createTips()},y.prototype.adjustVisual=function(){if(z.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(re.setAttributes(this.tip1,[["x1",(this.x1-this.tipLength/2).toString()],["y1",this.y1.toString()],["x2",(this.x1+this.tipLength/2).toString()],["y2",this.y1.toString()],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),re.setAttributes(this.tip2,[["x1",(this.x2-this.tipLength/2).toString()],["y1",this.y2.toString()],["x2",(this.x2+this.tipLength/2).toString()],["y2",this.y2.toString()],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),Math.abs(this.x1-this.x2)>.1)){var C=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),N=this.tip1.transform.baseVal.getItem(0);N.setRotate(C,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(N,0);var Z=this.tip2.transform.baseVal.getItem(0);Z.setRotate(C+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(Z,0)}},Object.defineProperty(y.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),y.prototype.getState=function(){var C=z.prototype.getState.call(this);return C.typeName=y.typeName,C},y.prototype.restoreState=function(C){z.prototype.restoreState.call(this,C),this.createTips(),this.adjustVisual()},y.typeName="MeasurementMarker",y.title="Measurement marker",y.icon='<svg viewBox="0 0 24 24"><path d="M1.39 18.36l1.77-1.76L4.58 18l1.06-1.05-1.42-1.41 1.42-1.42 2.47 2.48 1.06-1.06-2.47-2.48 1.41-1.41 1.42 1.41L10.59 12l-1.42-1.41 1.42-1.42 2.47 2.48 1.06-1.06-2.47-2.48 1.41-1.41 1.41 1.41 1.07-1.06-1.42-1.41 1.42-1.42L18 6.7l1.07-1.06-2.47-2.48 1.76-1.77 4.25 4.25L5.64 22.61l-4.25-4.25z"/></svg>',y}(tt),st=function(z){function y(C,N,Z){var W=z.call(this,C,N,Z)||this;return W.strokePanel.colors=Z.defaultColorSet,W.fillColor="transparent",W}return we(y,z),Object.defineProperty(y.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),y.prototype.getState=function(){var C=z.prototype.getState.call(this);return C.typeName=y.typeName,C},y.typeName="EllipseFrameMarker",y.title="Ellipse frame marker",y.icon='<svg viewBox="0 0 24 24"><path d="M12 6c4.41 0 8 2.69 8 6s-3.59 6-8 6-8-2.69-8-6 3.59-6 8-6m0-2C6.5 4 2 7.58 2 12s4.5 8 10 8 10-3.58 10-8-4.5-8-10-8z"/></svg>',y}(Le),ct=function(){function z(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(z.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),z.prototype.addUndoStep=function(y){this.undoStack.length!==0&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(y)||(this.undoStack.push(y),JSON.stringify(this.lastRedoStep)!==JSON.stringify(y)&&this.redoStack.splice(0,this.redoStack.length))},z.prototype.replaceLastUndoStep=function(y){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=y)},z.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},z.prototype.undo=function(){if(this.undoStack.length>1){var y=this.undoStack.pop();return y!==void 0&&this.redoStack.push(y),this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0}},z.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},z}(),ft=function(z){function y(C,N,Z){var W=z.call(this,C,N,Z)||this;return W.strokeColor="transparent",W.strokeWidth=0,W.strokeDasharray="",W.curveX=0,W.curveY=0,W.manipulationStartCurveX=0,W.manipulationStartCurveY=0,W.setStrokeColor=W.setStrokeColor.bind(W),W.setStrokeWidth=W.setStrokeWidth.bind(W),W.setStrokeDasharray=W.setStrokeDasharray.bind(W),W.positionGrips=W.positionGrips.bind(W),W.addControlGrips=W.addControlGrips.bind(W),W.adjustVisual=W.adjustVisual.bind(W),W.setupControlBox=W.setupControlBox.bind(W),W.resize=W.resize.bind(W),W.strokeColor=Z.defaultColor,W.strokeWidth=Z.defaultStrokeWidth,W.strokeDasharray=Z.defaultStrokeDasharray,W.strokePanel=new Fe("Line color",Z.defaultColorSet,Z.defaultColor),W.strokePanel.onColorChanged=W.setStrokeColor,W.strokeWidthPanel=new dt("Line width",Z.defaultStrokeWidths,Z.defaultStrokeWidth),W.strokeWidthPanel.onWidthChanged=W.setStrokeWidth,W.strokeStylePanel=new Xe("Line style",Z.defaultStrokeDasharrays,Z.defaultStrokeDasharray),W.strokeStylePanel.onStyleChanged=W.setStrokeDasharray,W}return we(y,z),y.prototype.ownsTarget=function(C){return!(!z.prototype.ownsTarget.call(this,C)&&C!==this.visual&&C!==this.selectorCurve&&C!==this.visibleCurve&&!this.curveGrip.ownsTarget(C))},y.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},y.prototype.createVisual=function(){this.visual=re.createGroup(),this.selectorCurve=re.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=re.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)},y.prototype.pointerDown=function(C,N){z.prototype.pointerDown.call(this,C,N),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(N)&&(this.activeGrip=this.curveGrip,this._state="resize")},y.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),re.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),re.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),re.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},y.prototype.setupControlBox=function(){z.prototype.setupControlBox.call(this),this.curveControlLine1=re.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=re.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)},y.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,z.prototype.addControlGrips.call(this)},y.prototype.positionGrips=function(){z.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()))},y.prototype.manipulate=function(C){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+C.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+C.y-this.manipulationStartY),z.prototype.manipulate.call(this,C)},y.prototype.resize=function(C){this.activeGrip===this.curveGrip&&(this.curveX=C.x,this.curveY=C.y),z.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)},y.prototype.setStrokeColor=function(C){this.strokeColor=C,this.adjustVisual(),this.colorChanged(C)},y.prototype.setStrokeWidth=function(C){this.strokeWidth=C,this.adjustVisual()},y.prototype.setStrokeDasharray=function(C){this.strokeDasharray=C,this.adjustVisual()},y.prototype.scale=function(C,N){this.curveX=this.curveX*C,this.curveY=this.curveY*N,z.prototype.scale.call(this,C,N)},Object.defineProperty(y.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),y.prototype.getState=function(){var C=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},z.prototype.getState.call(this));return C.typeName=y.typeName,C},y.prototype.restoreState=function(C){z.prototype.restoreState.call(this,C);var N=C;this.strokeColor=N.strokeColor,this.strokeWidth=N.strokeWidth,this.strokeDasharray=N.strokeDasharray,this.curveX=N.curveX,this.curveY=N.curveY,this.createVisual(),this.adjustVisual()},y.typeName="CurveMarker",y.title="Curve marker",y.icon='<svg viewBox="0 0 24 24"><path d="M18.5 2A1.5 1.5 0 0120 3.5 1.5 1.5 0 0118.5 5c-.23 0-.45-.05-.65-.15l-3.69 3.7.34.45c2.19-1.26 4.76-2 7.5-2l1 .03v2.01L22 9c-2.58 0-5 .75-7 2.04A3.96 3.96 0 0111.04 15C9.75 17 9 19.42 9 22l.04 1H7.03L7 22c0-2.74.74-5.31 2-7.5l-.45-.34-3.7 3.69c.1.2.15.42.15.65A1.5 1.5 0 013.5 20 1.5 1.5 0 012 18.5 1.5 1.5 0 013.5 17c.23 0 .45.05.65.15l3.69-3.7C7.31 12.78 7 11.92 7 11a4 4 0 014-4c.92 0 1.78.31 2.45.84l3.7-3.69c-.1-.2-.15-.42-.15-.65A1.5 1.5 0 0118.5 2M11 9a2 2 0 00-2 2 2 2 0 002 2 2 2 0 002-2 2 2 0 00-2-2z"/></svg>',y}(ot),Ct=function(){function z(y,C){C===void 0&&(C=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=y,this.cancelable=C}return Object.defineProperty(z.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),z.prototype.preventDefault=function(){this._defaultPrevented=!0},z}(),xt=function(z){function y(C,N,Z){var W=z.call(this,C,!1)||this;return W.dataUrl=N,W.state=Z,W}return we(y,z),y}(Ct),ut=function(z){function y(C,N,Z){Z===void 0&&(Z=!1);var W=z.call(this,C,Z)||this;return W.marker=N,W}return we(y,z),y}(Ct),Bt=function(){function z(){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 z.prototype.addEventListener=function(y,C){this[y].push(C)},z.prototype.removeEventListener=function(y,C){var N=this[y].indexOf(C);N>-1&&this[y].splice(N,1)},z}(),Pt=function(){function z(y){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 ct,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 Bt,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=z.instanceCounter++,this.styles=new Oe(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=y,this.targetRoot=document.body,this.width=y.clientWidth,this.height=y.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(z.prototype,"ALL_MARKER_TYPES",{get:function(){return[Ye,_e,ve,We,st,Le,le,ye,He,te,tt,ft]},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[Ye,_e,ve,We,Le,le,ye]},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"BASIC_MARKER_TYPES",{get:function(){return[Ye,_e,ve,We,le]},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(y){var C=this;this._availableMarkerTypes.splice(0),y.forEach(function(N){if(typeof N=="string"){var Z=C.ALL_MARKER_TYPES.find(function(W){return W.typeName===N});Z!==void 0&&C._availableMarkerTypes.push(Z)}else C._availableMarkerTypes.push(N)})},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"zoomLevel",{get:function(){return this._zoomLevel},set:function(y){this._zoomLevel=y,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(z.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),z.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),this.settings.displayMode==="popup"&&this.onPopupTargetResize(),xe.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},z.prototype.show=function(){var y=this;this.styles.styleSheetRoot===void 0&&ke.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=ke.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(C){return C(new Ct(y))})},z.prototype.render=function(){return he(this,void 0,void 0,function(){var y;return ce(this,function(C){switch(C.label){case 0:return this.setCurrentMarker(),(y=new be).naturalSize=this.renderAtNaturalSize,y.imageType=this.renderImageType,y.imageQuality=this.renderImageQuality,y.markersOnly=this.renderMarkersOnly,y.width=this.renderWidth,y.height=this.renderHeight,[4,y.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return C.sent(),[4,y.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,C.sent()]}})})},z.prototype.close=function(y){var C=this;if(y===void 0&&(y=!1),this.isOpen){var N=!1;y||this.eventListeners.beforeclose.forEach(function(Z){var W=new Ct(C,!0);Z(W),W.defaultPrevented&&(N=!0)}),N||(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(Z){return Z(new Ct(C))}),this.detachEvents(),this._isOpen=!1)}},z.prototype.addMarkersToToolbar=function(){for(var y,C=[],N=0;N<arguments.length;N++)C[N]=arguments[N];(y=this._availableMarkerTypes).push.apply(y,C)},z.prototype.addRenderEventListener=function(y){this.addEventListener("render",function(C){y(C.dataUrl,C.state)})},z.prototype.removeRenderEventListener=function(y){},z.prototype.addCloseEventListener=function(y){this.addEventListener("close",function(){y()})},z.prototype.removeCloseEventListener=function(y){},z.prototype.setupResizeObserver=function(){var y=this;this.settings.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){y.resize(y.target.clientWidth,y.target.clientHeight)}),this.targetObserver.observe(this.target)):this.settings.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){return y.onPopupTargetResize()}),this.targetObserver.observe(this.editorCanvas)),window.addEventListener("resize",this.setWindowHeight))},z.prototype.onPopupTargetResize=function(){var y=1*this.target.clientWidth/this.target.clientHeight,C=this.editorCanvas.clientWidth/y>this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*y:this.editorCanvas.clientWidth,N=C<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/y;this.resize(C,N)},z.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},z.prototype.resize=function(y,C){this._isResizing=!0;var N=y/this.imageWidth,Z=C/this.imageHeight;this.imageWidth=Math.round(y),this.imageHeight=Math.round(C),this.target instanceof HTMLImageElement&&this.editingTarget instanceof HTMLImageElement&&(this.editingTarget.src=this.target.src),this.editingTarget.width=this.imageWidth,this.editingTarget.height=this.imageHeight,this.editingTarget.style.width=this.imageWidth+"px",this.editingTarget.style.height=this.imageHeight+"px",this.markerImage.setAttribute("width",this.imageWidth.toString()),this.markerImage.setAttribute("height",this.imageHeight.toString()),this.markerImage.setAttribute("viewBox","0 0 "+this.imageWidth.toString()+" "+this.imageHeight.toString()),this.markerImageHolder.style.width=this.imageWidth+"px",this.markerImageHolder.style.height=this.imageHeight+"px",this.overlayContainer.style.width=this.imageWidth+"px",this.overlayContainer.style.height=this.imageHeight+"px",this.settings.displayMode!=="popup"?this.coverDiv.style.width=this.imageWidth.toString()+"px":(this.setTopLeft(),this.positionMarkerImage()),this.toolbar!==void 0&&this.toolbar.adjustLayout(),this.positionLogo(),this.scaleMarkers(N,Z),this._isResizing=!1},z.prototype.scaleMarkers=function(y,C){var N,Z=this;this._currentMarker&&this._currentMarker instanceof We?this._currentMarker.scale(y,C):(N=this._currentMarker,this.setCurrentMarker()),this.markers.forEach(function(W){W!==Z._currentMarker&&W.scale(y,C)}),N!==void 0&&this.setCurrentMarker(N)},z.prototype.setEditingTarget=function(){this.imageWidth=Math.round(this.target.clientWidth),this.imageHeight=Math.round(this.target.clientHeight),this.target instanceof HTMLImageElement&&this.editingTarget instanceof HTMLImageElement&&(this.editingTarget.src=this.target.src),this.editingTarget.width=this.imageWidth,this.editingTarget.height=this.imageHeight,this.editingTarget.style.width=this.imageWidth+"px",this.editingTarget.style.height=this.imageHeight+"px"},z.prototype.setTopLeft=function(){var y=this.editingTarget.getBoundingClientRect(),C=this.editorCanvas.getBoundingClientRect();this.left=y.left-C.left,this.top=y.top-C.top},z.prototype.initMarkerCanvas=function(){this.markerImageHolder=document.createElement("div"),this.markerImageHolder.style.setProperty("touch-action","pinch-zoom"),this.markerImage=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.markerImage.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.markerImage.setAttribute("width",this.imageWidth.toString()),this.markerImage.setAttribute("height",this.imageHeight.toString()),this.markerImage.setAttribute("viewBox","0 0 "+this.imageWidth.toString()+" "+this.imageHeight.toString()),this.markerImage.style.pointerEvents="auto",this.markerImageHolder.style.position="absolute",this.markerImageHolder.style.width=this.imageWidth+"px",this.markerImageHolder.style.height=this.imageHeight+"px",this.markerImageHolder.style.transformOrigin="top left",this.positionMarkerImage(),this.markerImageHolder.appendChild(this.markerImage),this.editorCanvas.appendChild(this.markerImageHolder)},z.prototype.addDefs=function(){for(var y,C=[],N=0;N<arguments.length;N++)C[N]=arguments[N];this.defs=re.createDefs(),this.addDefsToImage(),(y=this.defs).append.apply(y,C)},z.prototype.addDefsToImage=function(){this.defs&&this.markerImage.insertBefore(this.defs,this.markerImage.firstChild)},z.prototype.initOverlay=function(){this.overlayContainer=document.createElement("div"),this.overlayContainer.style.position="absolute",this.overlayContainer.style.left="0px",this.overlayContainer.style.top="0px",this.overlayContainer.style.width=this.imageWidth+"px",this.overlayContainer.style.height=this.imageHeight+"px",this.overlayContainer.style.display="flex",this.markerImageHolder.appendChild(this.overlayContainer)},z.prototype.positionMarkerImage=function(){this.markerImageHolder.style.top=this.top/this.zoomLevel+"px",this.markerImageHolder.style.left=this.left/this.zoomLevel+"px"},z.prototype.attachEvents=function(){this.markerImage.addEventListener("pointerdown",this.onPointerDown),this.markerImage.addEventListener("dblclick",this.onDblClick),this.attachWindowEvents()},z.prototype.attachWindowEvents=function(){window.addEventListener("pointermove",this.onPointerMove),window.addEventListener("pointerup",this.onPointerUp),window.addEventListener("pointercancel",this.onPointerOut),window.addEventListener("pointerout",this.onPointerOut),window.addEventListener("pointerleave",this.onPointerUp),window.addEventListener("resize",this.onWindowResize),window.addEventListener("keyup",this.onKeyUp)},z.prototype.detachEvents=function(){this.markerImage.removeEventListener("pointerdown",this.onPointerDown),this.markerImage.removeEventListener("dblclick",this.onDblClick),this.detachWindowEvents()},z.prototype.detachWindowEvents=function(){window.removeEventListener("pointermove",this.onPointerMove),window.removeEventListener("pointerup",this.onPointerUp),window.removeEventListener("pointercancel",this.onPointerOut),window.removeEventListener("pointerout",this.onPointerOut),window.removeEventListener("pointerleave",this.onPointerUp),window.removeEventListener("resize",this.onWindowResize),window.removeEventListener("keyup",this.onKeyUp)},z.prototype.addLogo=function(){this.logoUI=document.createElement("div"),this.logoUI.style.display="inline-block",this.logoUI.style.margin="0px",this.logoUI.style.padding="0px",this.logoUI.style.fill="#333333";var y=document.createElement("a");y.href="https://markerjs.com/",y.target="_blank",y.innerHTML='<svg viewBox="0 0 112 96" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414"><path fill="#e5f20d" fill-opacity=".647" d="M0 40.386h111.96V95.62H0z"/><path d="M93.61 61.452c0 .987-.328 1.831-.987 2.53-.657.7-1.52 1.048-2.591 1.048-1.481 0-2.222-.74-2.222-2.22 0-16.617-.533-29.347-1.604-38.192-1.068-8.842-2.92-13.265-5.552-13.265-4.443 0-10.94 15.509-19.497 46.52v.124c0 .987-.328 1.831-.987 2.53-.657.7-1.52 1.048-2.592 1.048-1.48 0-2.22-.74-2.22-2.22 0-3.29.165-8.392.493-15.302.33-7.732.494-13.82.494-18.262 0-6.17-.186-10.55-.556-13.142-.37-2.591-1.172-3.887-2.406-3.887-2.796 0-6.333 5.12-10.612 15.363C38.494 34.367 34.01 46.44 29.32 60.34l-1.11 3.209a5.714 5.714 0 01-1.42 2.097c-.617.578-1.295.864-2.036.864-.987 0-1.644-.081-1.974-.247-.328-.162-.533-.656-.617-1.48-.41-4.03-.74-9.418-.987-16.165-.163-1.728-.329-4.566-.494-8.515-.822-13.901-1.562-23.3-2.221-28.196-.657-4.893-.987-7.628-.987-8.205 0-.657.33-1.44.987-2.345.659-.903 1.276-1.357 1.85-1.357 1.319 0 2.387.947 3.21 2.838.411.906.863 4.526 1.357 10.859.493 6.335.905 14.19 1.233 23.568l.617 18.88c4.527-13.983 9.216-26.673 14.068-38.068C45.65 6.686 50.093.988 54.123.988c2.715 0 4.566 1.974 5.553 5.923.987 3.949 1.481 9.667 1.481 17.152 0 3.949-.081 9.625-.247 17.029l-.123 5.676c3.373-11.762 6.725-21.634 10.057-29.615 3.331-7.979 6.685-11.97 10.056-11.97 8.475 0 12.71 18.757 12.71 56.269z" fill-rule="nonzero"/></svg>',y.title="Powered by marker.js",y.style.display="grid",y.style.alignItems="center",y.style.justifyItems="center",y.style.padding="3px",y.style.width="20px",y.style.height="20px",this.logoUI.appendChild(y),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},z.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")},z.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"},z.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},z.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 y=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=y+"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 De(this.uiDiv,this.settings.displayMode,this._availableMarkerTypes,this.uiStyleSettings,this.styles),this.toolbar.addButtonClickListener(this.toolbarButtonClicked),this.toolbar.show(this._silentRenderMode||this.uiStyleSettings.hideToolbar?"hidden":"visible"),this.contentDiv=document.createElement("div"),this.contentDiv.style.display="flex",this.contentDiv.style.flexDirection="row",this.contentDiv.style.flexGrow="2",this.contentDiv.style.flexShrink="1",this.settings.displayMode==="popup"&&(this.contentDiv.style.backgroundColor=this.uiStyleSettings.canvasBackgroundColor,this.contentDiv.style.maxHeight=this.windowHeight-2*this.settings.popupMargin-3.5*this.uiStyleSettings.toolbarHeight+"px",this.contentDiv.style.maxWidth="calc(100vw - "+2*this.settings.popupMargin+"px)"),this.contentDiv.style.overflow="auto",this.uiDiv.appendChild(this.contentDiv),this.editorCanvas=document.createElement("div"),this.editorCanvas.style.flexGrow="2",this.editorCanvas.style.flexShrink="1",this.editorCanvas.style.position="relative",this.editorCanvas.style.overflow="hidden",this.editorCanvas.style.display="flex",this.settings.displayMode==="popup"&&(this.editorCanvas.style.alignItems="center",this.editorCanvas.style.justifyContent="center"),this.editorCanvas.style.pointerEvents="none",this.editorCanvas.style.transformOrigin="left top",this.editorCanvas.style.transform="scale("+this.zoomLevel+")",this.contentDiv.appendChild(this.editorCanvas),this.editingTarget=this.target instanceof HTMLImageElement?document.createElement("img"):document.createElement("canvas"),this.target.getClientRects().item(0).y<this.styles.settings.toolbarHeight&&(this.editingTarget.style.marginTop=this.target.offsetTop-this.styles.settings.toolbarHeight+"px"),this.editorCanvas.appendChild(this.editingTarget),this.toolbox=new Ne(this.uiDiv,this.settings.displayMode,this.uiStyleSettings,this.styles),this.toolbox.show(this._silentRenderMode||this.uiStyleSettings.hideToolbox?"hidden":"visible")},z.prototype.closeUI=function(){this.settings.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},z.prototype.removeMarker=function(y){this.markerImage.removeChild(y.container),this.markers.indexOf(y)>-1&&this.markers.splice(this.markers.indexOf(y),1),y.dispose()},z.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())},z.prototype.toolbarButtonClicked=function(y,C){if(y==="marker"&&C!==void 0)this.createNewMarker(C);else if(y==="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()}},z.prototype.deleteSelectedMarker=function(){var y=this;if(this._currentMarker!==void 0){var C=!1;if(this.eventListeners.markerbeforedelete.forEach(function(Z){var W=new ut(y,y._currentMarker,!0);Z(W),W.defaultPrevented&&(C=!0)}),!C){var N=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(Z){return Z(new ut(y,N))})}}},z.prototype.clear=function(){var y=this,C=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(ge){var Ue=new ut(y,void 0,!0);ge(Ue),Ue.defaultPrevented&&(C=!0)}),!C)){this.setCurrentMarker();for(var N=function(ge){var Ue=Z.markers[ge];Z.setCurrentMarker(Z.markers[ge]),Z._currentMarker.dispose(),Z.markerImage.removeChild(Z._currentMarker.container),Z.markers.splice(Z.markers.indexOf(Z._currentMarker),1),Z.eventListeners.markerdelete.forEach(function(it){return it(new ut(y,Ue))})},Z=this,W=this.markers.length-1;W>=0;W--)N(W);this.addUndoStep()}},Object.defineProperty(z.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),z.prototype.showNotesEditor=function(){var y;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=(y=this._currentMarker.notes)!==null&&y!==void 0?y:"",this.overlayContainer.appendChild(this.notesArea))},z.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)},z.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},z.prototype.addUndoStep=function(){var y=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var C=this.getState(),N=this.undoRedoManager.getLastUndoStep();if(!N||N.width===C.width&&N.height===C.height){var Z=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(C),Z<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach(function(W){return W(new Ct(y))})}else this.undoRedoManager.replaceLastUndoStep(C),this.eventListeners.statechange.forEach(function(W){return W(new Ct(y))})}},z.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},z.prototype.undoStep=function(){var y=this,C=this.undoRedoManager.undo();C!==void 0&&(this.restoreState(C),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(N){return N(new Ct(y))}))},z.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},z.prototype.redoStep=function(){var y=this,C=this.undoRedoManager.redo();C!==void 0&&(this.restoreState(C),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(N){return N(new Ct(y))}))},z.prototype.stepZoom=function(){var y=this.zoomSteps.indexOf(this.zoomLevel);this.zoomLevel=y<this.zoomSteps.length-1?this.zoomSteps[y+1]:this.zoomSteps[0]},z.prototype.panTo=function(y){this.contentDiv.scrollBy({left:this.prevPanPoint.x-y.x,top:this.prevPanPoint.y-y.y}),this.prevPanPoint=y},z.prototype.startRenderAndClose=function(){return he(this,void 0,void 0,function(){var y,C,N=this;return ce(this,function(Z){switch(Z.label){case 0:return[4,this.render()];case 1:return y=Z.sent(),C=this.getState(),this.eventListeners.render.forEach(function(W){return W(new xt(N,y,C))}),this.close(!0),[2]}})})},z.prototype.getState=function(y){y===!0&&this.setCurrentMarker();var C={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach(function(N){return C.markers.push(N.getState())}),C},z.prototype.restoreState=function(y){var C=this;for(this.markers.splice(0);this.markerImage.lastChild;)this.markerImage.removeChild(this.markerImage.lastChild);y.markers.forEach(function(N){var Z=C._availableMarkerTypes.find(function(ge){return ge.typeName===N.typeName});if(Z!==void 0){var W=C.addNewMarker(Z);W.restoreState(N),C.markers.push(W)}}),y.width&&y.height&&(y.width!==this.imageWidth||y.height!==this.imageHeight)&&this.scaleMarkers(this.imageWidth/y.width,this.imageHeight/y.height),this.eventListeners.restorestate.forEach(function(N){return N(new Ct(C))})},z.prototype.addNewMarker=function(y){var C=re.createGroup();return this.markerImage.appendChild(C),new y(C,this.overlayContainer,this.settings)},z.prototype.createNewMarker=function(y){var C,N=this;(C=typeof y=="string"?this._availableMarkerTypes.find(function(Z){return Z.typeName===y}):y)&&(this.setCurrentMarker(),this.addUndoStep(),this._currentMarker=this.addNewMarker(C),this._currentMarker.onMarkerCreated=this.markerCreated,this._currentMarker.onColorChanged=this.colorChanged,this._currentMarker.onFillColorChanged=this.fillColorChanged,this._currentMarker.onStateChanged=this.markerStateChanged,this.markerImage.style.cursor="crosshair",this.toolbar.setActiveMarkerButton(C.typeName),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this.eventListeners.markercreating.forEach(function(Z){return Z(new ut(N,N._currentMarker))}))},z.prototype.markerCreated=function(y){var C=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(y),this.setCurrentMarker(y),y instanceof _e&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(_e):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach(function(N){return N(new ut(C,C._currentMarker))})},z.prototype.colorChanged=function(y){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultColor=y,this.settings.defaultStrokeColor=y)},z.prototype.fillColorChanged=function(y){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultFillColor=y)},z.prototype.markerStateChanged=function(y){var C=this;this.eventListeners.markerchange.forEach(function(N){return N(new ut(C,y))})},z.prototype.setCurrentMarker=function(y){var C=this;this._currentMarker!==y&&this._currentMarker!==void 0&&(this._currentMarker.deselect(),this.toolbar.setCurrentMarker(),this.toolbox.setPanelButtons([]),this._isResizing||this.eventListeners.markerdeselect.forEach(function(N){return N(new ut(C,C._currentMarker))})),this._currentMarker=y,this._currentMarker===void 0||this._currentMarker.isSelected||(this._currentMarker.state!=="new"&&this._currentMarker.select(),this.toolbar.setCurrentMarker(this._currentMarker),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this._isResizing||this.eventListeners.markerselect.forEach(function(N){return N(new ut(C,C._currentMarker))}))},z.prototype.onPointerDown=function(y){if(this._isFocused||this.focus(),this.touchPoints++,this.touchPoints===1||y.pointerType!=="touch")if(this._currentMarker===void 0||this._currentMarker.state!=="new"&&this._currentMarker.state!=="creating"){if(this.mode==="select"){var C=this.markers.find(function(N){return N.ownsTarget(y.target)});C!==void 0?(this.setCurrentMarker(C),this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(y.clientX,y.clientY),y.target)):(this.setCurrentMarker(),this.isDragging=!0,this.prevPanPoint={x:y.clientX,y:y.clientY})}}else this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(y.clientX,y.clientY))},z.prototype.onDblClick=function(y){if(this._isFocused||this.focus(),this.mode==="select"){var C=this.markers.find(function(N){return N.ownsTarget(y.target)});C!==void 0&&C!==this._currentMarker&&this.setCurrentMarker(C),this._currentMarker!==void 0?this._currentMarker.dblClick(this.clientToLocalCoordinates(y.clientX,y.clientY),y.target):this.setCurrentMarker()}},z.prototype.onPointerMove=function(y){this.touchPoints!==1&&y.pointerType==="touch"||(this._currentMarker!==void 0||this.isDragging)&&(this._currentMarker!==void 0&&this._currentMarker.state==="edit"||y.preventDefault(),this._currentMarker!==void 0?this._currentMarker.manipulate(this.clientToLocalCoordinates(y.clientX,y.clientY)):this.zoomLevel>1&&this.panTo({x:y.clientX,y:y.clientY}))},z.prototype.onPointerUp=function(y){this.touchPoints>0&&this.touchPoints--,this.touchPoints===0&&this.isDragging&&this._currentMarker!==void 0&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(y.clientX,y.clientY)),this.isDragging=!1,this.addUndoStep()},z.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},z.prototype.onKeyUp=function(y){this._currentMarker===void 0||this.notesArea!==void 0||y.key!=="Delete"&&y.key!=="Backspace"||this.deleteSelectedMarker()},z.prototype.clientToLocalCoordinates=function(y,C){var N=this.markerImage.getBoundingClientRect();return{x:(y-N.left)/this.zoomLevel,y:(C-N.top)/this.zoomLevel}},z.prototype.onWindowResize=function(){this.positionUI()},z.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var y=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=y+"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()},z.prototype.addLicenseKey=function(y){xe.addKey(y)},z.prototype.addEventListener=function(y,C){this.eventListeners.addEventListener(y,C)},z.prototype.removeEventListener=function(y,C){this.eventListeners.removeEventListener(y,C)},z.prototype.renderState=function(y){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(y),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(z.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),z.prototype.focus=function(){var y=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 Ct(y))}))},z.prototype.blur=function(){var y=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(C){return C(new Ct(y))}))},z.instanceCounter=0,z}();/* **********************************
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 Jt=function(z,y){return(Jt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(C,N){C.__proto__=N}||function(C,N){for(var Z in N)Object.prototype.hasOwnProperty.call(N,Z)&&(C[Z]=N[Z])})(z,y)};function Yt(z,y){if(typeof y!="function"&&y!==null)throw new TypeError("Class extends value "+String(y)+" is not a constructor or null");function C(){this.constructor=z}Jt(z,y),z.prototype=y===null?Object.create(y):(C.prototype=y.prototype,new C)}function Rt(z,y,C,N){return new(C||(C=Promise))(function(Z,W){function ge(mt){try{it(N.next(mt))}catch(Ge){W(Ge)}}function Ue(mt){try{it(N.throw(mt))}catch(Ge){W(Ge)}}function it(mt){var Ge;mt.done?Z(mt.value):(Ge=mt.value,Ge instanceof C?Ge:new C(function(bt){bt(Ge)})).then(ge,Ue)}it((N=N.apply(z,y||[])).next())})}function Ti(z,y){var C,N,Z,W,ge={label:0,sent:function(){if(1&Z[0])throw Z[1];return Z[1]},trys:[],ops:[]};return W={next:Ue(0),throw:Ue(1),return:Ue(2)},typeof Symbol=="function"&&(W[Symbol.iterator]=function(){return this}),W;function Ue(it){return function(mt){return function(Ge){if(C)throw new TypeError("Generator is already executing.");for(;ge;)try{if(C=1,N&&(Z=2&Ge[0]?N.return:Ge[0]?N.throw||((Z=N.return)&&Z.call(N),0):N.next)&&!(Z=Z.call(N,Ge[1])).done)return Z;switch(N=0,Z&&(Ge=[2&Ge[0],Z.value]),Ge[0]){case 0:case 1:Z=Ge;break;case 4:return ge.label++,{value:Ge[1],done:!1};case 5:ge.label++,N=Ge[1],Ge=[0];continue;case 7:Ge=ge.ops.pop(),ge.trys.pop();continue;default:if(!(Z=ge.trys,(Z=Z.length>0&&Z[Z.length-1])||Ge[0]!==6&&Ge[0]!==2)){ge=0;continue}if(Ge[0]===3&&(!Z||Ge[1]>Z[0]&&Ge[1]<Z[3])){ge.label=Ge[1];break}if(Ge[0]===6&&ge.label<Z[1]){ge.label=Z[1],Z=Ge;break}if(Z&&ge.label<Z[2]){ge.label=Z[2],ge.ops.push(Ge);break}Z[2]&&ge.ops.pop(),ge.trys.pop();continue}Ge=y.call(z,ge)}catch(bt){Ge=[6,bt],N=0}finally{C=Z=0}if(5&Ge[0])throw Ge[1];return{value:Ge[0]?Ge[1]:void 0,done:!0}}([it,mt])}}}var Bi=function(){function z(){}return z.addKey=function(y){z.key=y},Object.defineProperty(z,"isLicensed",{get:function(){return!!z.key&&new RegExp(/^CRPR-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(z.key)},enumerable:!1,configurable:!0}),z}(),Qe=function(){function z(){}return z.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},z.setAttributes=function(y,C){for(var N=0,Z=C;N<Z.length;N++){var W=Z[N],ge=W[0],Ue=W[1];y.setAttribute(ge,Ue)}},z.createRect=function(y,C,N){var Z=document.createElementNS("http://www.w3.org/2000/svg","rect");return Z.setAttribute("width",y.toString()),Z.setAttribute("height",C.toString()),N&&z.setAttributes(Z,N),Z},z.createLine=function(y,C,N,Z,W){var ge=document.createElementNS("http://www.w3.org/2000/svg","line");return ge.setAttribute("x1",y.toString()),ge.setAttribute("y1",C.toString()),ge.setAttribute("x2",N.toString()),ge.setAttribute("y2",Z.toString()),W&&z.setAttributes(ge,W),ge},z.createPolygon=function(y,C){var N=document.createElementNS("http://www.w3.org/2000/svg","polygon");return N.setAttribute("points",y),C&&z.setAttributes(N,C),N},z.createCircle=function(y,C){var N=document.createElementNS("http://www.w3.org/2000/svg","circle");return N.setAttribute("cx",(y/2).toString()),N.setAttribute("cy",(y/2).toString()),N.setAttribute("r",y.toString()),C&&z.setAttributes(N,C),N},z.createEllipse=function(y,C,N){var Z=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return Z.setAttribute("cx",(y/2).toString()),Z.setAttribute("cy",(C/2).toString()),Z.setAttribute("rx",(y/2).toString()),Z.setAttribute("ry",(C/2).toString()),N&&z.setAttributes(Z,N),Z},z.createGroup=function(y){var C=document.createElementNS("http://www.w3.org/2000/svg","g");return y&&z.setAttributes(C,y),C},z.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},z.createMarker=function(y,C,N,Z,W,ge,Ue){var it=document.createElementNS("http://www.w3.org/2000/svg","marker");return z.setAttributes(it,[["id",y],["orient",C],["markerWidth",N.toString()],["markerHeight",Z.toString()],["refX",W.toString()],["refY",ge.toString()]]),it.appendChild(Ue),it},z.createText=function(y){var C=document.createElementNS("http://www.w3.org/2000/svg","text");return C.setAttribute("x","0"),C.setAttribute("y","0"),y&&z.setAttributes(C,y),C},z.createTSpan=function(y,C){var N=document.createElementNS("http://www.w3.org/2000/svg","tspan");return N.textContent=y,C&&z.setAttributes(N,C),N},z.createImage=function(y){var C=document.createElementNS("http://www.w3.org/2000/svg","image");return y&&z.setAttributes(C,y),C},z.createPoint=function(y,C){var N=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return N.x=y,N.y=C,N},z.createPath=function(y,C){var N=document.createElementNS("http://www.w3.org/2000/svg","path");return N.setAttribute("d",y),C&&z.setAttributes(N,C),N},z.createElement=function(y,C){var N=document.createElementNS("http://www.w3.org/2000/svg",y);return C&&z.setAttributes(N,C),N},z.getHollowRectanglePath=function(y,C,N,Z,W,ge,Ue,it){return"M"+y+","+C+"V"+(C+Z)+"H"+(y+N)+"V"+C+"H"+W+"V"+ge+"H"+(W+Ue)+"V"+(ge+it)+"H"+W+"V"+C+"Z"},z}(),wt=function(){function z(y){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+y+"_"}return Object.defineProperty(z.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"defaultSettings",{get:function(){return{canvasBackgroundColor:"#333333",toolbarBackgroundColor:"#111111",toolbarBackgroundHoverColor:"#333333",toolbarBackgroundActiveColor:"#282828",toolbarColor:"#eeeeee",cropShadeColor:"#ffffff",cropFrameColor:"#ffffff",gripColor:"#333333",gripFillColor:"#cccccc",toolbarHeight:40}},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_out"},enumerable:!1,configurable:!0}),z.prototype.addClass=function(y){return this.styleSheet===void 0&&this.addStyleSheet(),y.name=""+this.classNamePrefix+y.localName,this.classes.push(y),this.styleSheet.sheet.insertRule("."+y.name+" {"+y.style+"}",this.styleSheet.sheet.cssRules.length),y},z.prototype.addRule=function(y){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(y),this.styleSheet.sheet.insertRule(y.selector+" {"+y.style+"}",this.styleSheet.sheet.cssRules.length)},z.prototype.addStyleSheet=function(){var y;this.styleSheet=document.createElement("style"),((y=this.styleSheetRoot)!==null&&y!==void 0?y:document.head).appendChild(this.styleSheet),this.addRule(new Ot("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new Ot("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
from {
opacity: 0;
}
to {
opacity: 1;
}
`)),this.addRule(new Ot("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
from {
opacity: 1;
}
to {
opacity: 0;
}
`)),this.addClass(new Lt("_fade_in",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
`)),this.addClass(new Lt("_fade_out",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
`))},z.prototype.removeStyleSheet=function(){var y;this.styleSheet&&(((y=this.styleSheetRoot)!==null&&y!==void 0?y:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},z}(),Ot=function(z,y){this.selector=z,this.style=y},Lt=function(z,y){this.localName=z,this.style=y},qt=function(){function z(){this.blocks=[],this.display=""}return z.prototype.addButtonBlock=function(y){y.className=this.blockClassName,y.buttonClassName=this.buttonClassName,y.buttonColorsClassName=this.buttonColorsClassName,y.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(y)},z.prototype.addElementBlock=function(y){y.className===void 0&&(y.className=this.blockClassName),this.blocks.push(y)},z.prototype.getUI=function(){var y=document.createElement("div");return y.className=this.className+" "+this.colorsClassName+" "+this.fadeInClassName,y.style.display=this.display,this.blocks.forEach(function(C){return y.appendChild(C.getUI())}),y},z}(),qi=function(){function z(){}return z.prototype.getUI=function(){var y=document.createElement("div");if(y.className=this.className,this.minWidth!==void 0&&(y.style.minWidth=this.minWidth),this.contentAlign!==void 0)switch(this.contentAlign){case"start":y.style.justifyContent="flex-start";break;case"center":y.style.justifyContent="center";break;case"end":y.style.justifyContent="flex-end"}return y.style.whiteSpace="nowrap",y},z}(),er=function(z){function y(){var C=z!==null&&z.apply(this,arguments)||this;return C.buttons=[],C}return Yt(y,z),y.prototype.addButton=function(C){C.className=this.buttonClassName,C.colorsClassName=this.buttonColorsClassName,C.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(C)},y.prototype.getUI=function(){var C=z.prototype.getUI.call(this);return this.buttons.forEach(function(N){return C.appendChild(N.getUI())}),C},y}(qi),Ut=function(){function z(y,C){this._isActive=!1,this._isHidden=!1,this._icon=y,this.title=C,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(z.prototype,"icon",{get:function(){return this._icon},set:function(y){this._icon=y,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isActive",{get:function(){return this._isActive},set:function(y){this._isActive=y,this.adjustClassName()},enumerable:!1,configurable:!0}),z.prototype.getUI=function(){var y=this;return this.buttonContainer=document.createElement("div"),this.buttonContainer.title=this.title,this.buttonContainer.className=this.className+" "+this.colorsClassName,this.adjustClassName(),this.buttonContainer.innerHTML=this._icon,this.onClick&&this.buttonContainer.addEventListener("click",function(){return y.onClick()}),this.uiContainer.appendChild(this.buttonContainer),this.uiContainer.style.display=this._isHidden?"none":"inline-block",this.uiContainer},z.prototype.adjustClassName=function(){this.activeColorsClassName&&(this._isActive&&this.buttonContainer.className.indexOf(this.activeColorsClassName)<0?this.buttonContainer.className+=" "+this.activeColorsClassName:this._isActive||(this.buttonContainer.className=this.buttonContainer.className.replace(this.activeColorsClassName,"")))},z.prototype.hide=function(){this._isHidden=!0},z}(),pt=function(z){function y(){var C=z!==null&&z.apply(this,arguments)||this;return C.elements=[],C}return Yt(y,z),y.prototype.addElement=function(C){this.elements.push(C)},y.prototype.getUI=function(){var C=z.prototype.getUI.call(this);return this.elements.forEach(function(N){return C.appendChild(N)}),C},y}(qi),Gi=function(){function z(y,C){this.horizontal=y,this.vertical=C}return Object.defineProperty(z.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),z.prototype.getVerticalLength=function(y){return y/this.ratio},z.prototype.getHorizontalLength=function(y){return y*this.ratio},z}(),tr=function(){function z(){}return z.getIcon=function(y,C){if(y>0&&C>0){var N=new Gi(y,C),Z=N.ratio>=1?20:N.getHorizontalLength(20),W=N.ratio<1?20:N.getVerticalLength(20),ge=document.createElementNS("http://www.w3.org/2000/svg","svg");ge.setAttribute("xmlns","http://www.w3.org/2000/svg"),ge.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(ge);var Ue=Qe.createDefs();ge.appendChild(Ue);var it=Qe.createElement("clipPath",[["id","text-bg-clip"]]);Ue.appendChild(it);var mt=Qe.createPath(Qe.getHollowRectanglePath((24-Z)/2,(24-W)/2,Z,W,(24-Z)/2+2,(24-W)/2+2,Z-4,W-4));ge.appendChild(mt);var Ge=Qe.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);Ge.appendChild(Qe.createTSpan(y+":"+C)),ge.appendChild(Ge);var bt=Ge.getBBox();Qe.setAttributes(Ge,[["x",((24-bt.width)/2).toString()],["y",((24-bt.height)/2-bt.y).toString()]]);var Ht=Qe.createPath(Qe.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(bt.width))/2,(24-Math.ceil(bt.height))/2,Math.ceil(bt.width),Math.ceil(bt.height)));return it.appendChild(Ht),Qe.setAttributes(mt,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(ge),ge.outerHTML}return'<svg viewBox="0 0 24 24"><path d="M19 12h-2v3h-3v2h5v-5M7 9h3V7H5v5h2V9m14-6H3a2 2 0 00-2 2v14a2 2 0 002 2h18a2 2 0 002-2V5a2 2 0 00-2-2m0 16H3V5h18v14z"/></svg>'},z}(),vi=function(z){function y(C,N,Z){var W=z.call(this,C,N)||this;return W.isDropdownOpen=!1,W.onClick=W.dropdownButtonClicked,W.dropdownButtons=Z,W}return Yt(y,z),y.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(N){N.className=C.className,N.colorsClassName=C.colorsClassName,C.dropdownBlock.appendChild(N.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},y.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},y.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},y.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},y.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},y.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},y}(Ut),kt=function(){function z(y,C){this.GRIP_SIZE=10,this.color=y,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 z.prototype.ownsTarget=function(y){return y===this.visual||y===this.visual.childNodes[0]||y===this.visual.childNodes[1]},z.prototype.setCenter=function(y,C){this.visual.childNodes.forEach(function(N){return Qe.setAttributes(N,[["cx",y.toString()],["cy",C.toString()]])})},z}(),Ui=function(){function z(y,C,N,Z){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=y,this.canvasHeight=C,this.margin=N,this.container=Z,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(z.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(y){this._aspectRatio=y,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(y){this._isGridVisible=y,this.gridContainer&&Qe.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(y){this._zoomFactor=y,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),z.prototype.open=function(){var y=this;this.cropShadeElement=Qe.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=Qe.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var C=0;C<this.numberOfGridLines;C++)this.horizontalGridLines.push(Qe.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push(Qe.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]]));this.horizontalGridLines.forEach(function(N){return y.gridContainer.appendChild(N)}),this.verticalGridLines.forEach(function(N){return y.gridContainer.appendChild(N)}),this.cropRectElement=Qe.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new kt(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new kt(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new kt(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new kt(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomRightGrip.visual),this.attachEvents()},z.prototype.setCropRectangle=function(y){this.cropRect=y;var C=Object.assign({},this.cropRect);this.zoomFactor!==1&&(C.width=this.cropRect.width*this.zoomFactor,C.height=this.cropRect.height*this.zoomFactor,C.x=this.cropRect.height/this.cropRect.width<this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasWidth/2-C.width/2,C.y=this.cropRect.height/this.cropRect.width>this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-C.height/2),Qe.setAttributes(this.cropRectElement,[["x",C.x.toString()],["y",C.y.toString()],["width",C.width.toString()],["height",C.height.toString()]]);var N=C.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(W,ge){var Ue=C.y+N*(ge+1);Qe.setAttributes(W,[["x1",""+C.x],["y1",""+Ue],["x2",""+(C.x+C.width)],["y2",""+Ue]])});var Z=C.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(W,ge){var Ue=C.x+Z*(ge+1);Qe.setAttributes(W,[["x1",""+Ue],["y1",""+C.y],["x2",""+Ue],["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},z.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)},z.prototype.clientToLocalCoordinates=function(y,C){var N=this.container.getBoundingClientRect();return{x:y-N.left+this.margin,y:C-N.top+this.margin}},z.prototype.onPointerDown=function(y){this.container.setPointerCapture(y.pointerId),this.previousPoint=this.clientToLocalCoordinates(y.clientX,y.clientY),this.cropRectElement===y.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(y.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(y.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(y.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(y.target)&&(this.activeGrip=this.bottomRightGrip)},z.prototype.onPointerMove=function(y){if(this.isMoving)this.move(this.clientToLocalCoordinates(y.clientX,y.clientY));else if(this.activeGrip){var C=this.clientToLocalCoordinates(y.clientX,y.clientY);this.resize(C)}y.preventDefault()},z.prototype.onPointerUp=function(y){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(y.pointerId)},z.prototype.move=function(y){var C=y.x-this.previousPoint.x,N=y.y-this.previousPoint.y;this.zoomFactor!==1&&(C=-C/this.zoomFactor,N=-N/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+N),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=y},z.prototype.resize=function(y){var C=Object.assign({},this.cropRect),N=y.x-this.previousPoint.x,Z=y.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:C.x+N<this.margin&&(N=this.margin-C.x),C.x+=N,C.width=this.cropRect.x+this.cropRect.width-C.x;break;case this.bottomRightGrip:case this.topRightGrip:C.width+N>this.canvasWidth*this.zoomFactor&&(N=this.canvasWidth*this.zoomFactor-C.width),C.width+=N}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(N),C.height=this.aspectRatio.getVerticalLength(C.width)):(C.y+=Z,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+=Z}C.width<10&&(C.x=this.cropRect.x,C.width=10),C.height<10&&(C.y=this.cropRect.y,C.height=10),this.previousPoint=y,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))},z.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var y=this.cropRect.x+this.cropRect.width/2,C=this.cropRect.y+this.cropRect.height/2,N=this.aspectRatio.getHorizontalLength(this.cropRect.height),Z=this.aspectRatio.getVerticalLength(this.cropRect.width);N/this.canvasWidth<Z/this.canvasHeight?this.cropRect.width=N:this.cropRect.height=Z,this.cropRect.width>this.canvasWidth&&(this.cropRect.height/=this.cropRect.width/this.canvasWidth,this.cropRect.width=this.canvasWidth),this.cropRect.height>this.canvasHeight&&(this.cropRect.width/=this.cropRect.height/this.canvasHeight,this.cropRect.height=this.canvasHeight),this.cropRect.x=y-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)}},z.prototype.getRescaledRect=function(y,C,N,Z,W,ge){var Ue=N/y,it=Z/C;return{x:(W.x-ge)*Ue+ge,y:(W.y-ge)*it+ge,width:W.width*Ue,height:W.height*it}},z.prototype.scaleCanvas=function(y,C){var N=this.getRescaledRect(this.canvasWidth,this.canvasHeight,y,C,this.cropRect,this.margin);this.canvasWidth=y,this.canvasHeight=C,this.onCropChange&&this.onCropChange(N),this.setCropRectangle(N)},z}(),Vi=function(){function z(y){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=y,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(z.prototype,"angle",{get:function(){return this._angle},set:function(y){this._angle=y,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),z.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},z.prototype.onPointerDown=function(y){this.controlContainer.setPointerCapture(y.pointerId),this.isDragging=!0,this.previousPoint={x:y.clientX,y:y.clientY}},z.prototype.onPointerMove=function(y){this.isDragging&&(this.onAngleChange&&this.onAngleChange((y.clientX-this.previousPoint.x)/5),this.previousPoint.x=y.clientX)},z.prototype.onPointerUp=function(y){this.isDragging&&this.onAngleChange&&this.onAngleChange((y.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(y.pointerId)},z.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var y=this.angleLabelText.getBBox();Qe.setAttributes(this.angleLabelElement,[["x",((this.width-y.width)/2).toString()],["y",(this.height/2).toString()]])}},z.prototype.positionScaleShape=function(){if(this.scaleShape){var y=this.scaleShape.transform.baseVal.getItem(0);y.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(y,0)}},z.prototype.getVisual=function(){var y=document.createElementNS("http://www.w3.org/2000/svg","svg");y.setAttribute("xmlns","http://www.w3.org/2000/svg"),y.setAttribute("width",this.width+"px"),y.setAttribute("height",this.height+"px"),y.setAttribute("viewBox","0 0 "+this.width+" "+this.height),y.style.flexShrink="0",document.body.appendChild(y);for(var C="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,N=1;N<=this.width/5+10;N++){var Z=N%5==0?this.height/3:this.height/6;C+="h4v"+-Z+"h1v"+Z}C+="v1H0Z",this.scaleShape=Qe.createPath(C);var W=Qe.createTransform();this.scaleShape.transform.baseVal.appendItem(W),y.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 ge=Qe.createTSpan("");return ge.innerHTML="&deg;",this.angleLabelElement.appendChild(ge),y.appendChild(this.angleLabelElement),document.body.removeChild(y),y},z}(),fr=function(){function z(){this.naturalSize=!1,this.imageType="image/png"}return z.prototype.rasterize=function(y,C,N,Z,W,ge,Ue){var it=this;return new Promise(function(mt){var Ge=document.createElement("canvas");Ge.width=y.width.baseVal.value-2*Z,Ge.height=y.height.baseVal.value-2*Z;var bt=1,Ht=1;it.naturalSize===!0?(bt=C.naturalWidth/(y.width.baseVal.value-2*Z)/ge,Ht=C.naturalHeight/(y.height.baseVal.value-2*Z)/Ue,Ge.width=C.naturalWidth/ge,Ge.height=C.naturalHeight/Ue):it.width!==void 0&&it.height!==void 0&&(bt=it.width/N.width,Ht=it.height/N.height,Ge.width*=bt,Ge.height*=Ht);var $t=Ge.getContext("2d");$t.translate(Ge.width/2,Ge.height/2),$t.rotate(W*Math.PI/180),$t.scale(ge,Ue),$t.translate(-Ge.width/2,-Ge.height/2),$t.drawImage(C,0,0,Ge.width,Ge.height);var Mi=document.createElement("canvas");Mi.width=N.width*bt,Mi.height=N.height*Ht,Mi.getContext("2d").putImageData($t.getImageData((N.x-Z)*bt,(N.y-Z)*Ht,N.width*bt,N.height*Ht),0,0),mt(Mi.toDataURL(it.imageType,it.imageQuality))})},z}(),Ve=function(){function z(y){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=z.instanceCounter++,this.styles=new wt(this.instanceNo),this.target=y,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(z.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(y){this._zoomToCropEnabled=y,y?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(y){this._isGridVisible=y,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"gridLines",{get:function(){return this._gridLines},set:function(y){this._gridLines=y,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(y){this._rotationAngle=y,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"aspectRatio",{get:function(){var y;return(y=this._aspectRatio)!==null&&y!==void 0?y:this.aspectRatios[0]},set:function(y){this._aspectRatio=y},enumerable:!1,configurable:!0}),z.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},z.prototype.show=function(){this.showUI(),this.open()},z.prototype.close=function(y){y===void 0&&(y=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),y||this.closeEventListeners.forEach(function(C){return C()}),this._isOpen=!1)},z.prototype.addRenderEventListener=function(y){this.renderEventListeners.push(y)},z.prototype.removeRenderEventListener=function(y){this.renderEventListeners.indexOf(y)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(y),1)},z.prototype.addCloseEventListener=function(y){this.closeEventListeners.push(y)},z.prototype.removeCloseEventListener=function(y){this.closeEventListeners.indexOf(y)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(y),1)},z.prototype.setupResizeObserver=function(){var y=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){y.resize(y.target.clientWidth,y.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))},z.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var y=1*this.target.clientWidth/this.target.clientHeight,C=this.contentDiv.clientWidth/y>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*y:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,N=C+2*this.CANVAS_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/y;this.resize(C,N)}},z.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},z.prototype.setEditingTargetSize=function(){this.editorCanvas.style.width=this.imageWidth+2*this.CANVAS_MARGIN+"px",this.editorCanvas.style.height=this.imageHeight+2*this.CANVAS_MARGIN+"px",Qe.setAttributes(this.editingTarget,[["width",""+this.imageWidth],["height",""+this.imageHeight]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px"},z.prototype.resize=function(y,C){this.imageWidth=Math.round(y),this.imageHeight=Math.round(C),this.setEditingTargetSize(),this.cropImage.setAttribute("width",this.paddedImageWidth.toString()),this.cropImage.setAttribute("height",this.paddedImageHeight.toString()),this.cropImage.setAttribute("viewBox","0 0 "+this.paddedImageWidth.toString()+" "+this.paddedImageHeight.toString()),this.cropImageHolder.style.width=this.paddedImageWidth+"px",this.cropImageHolder.style.height=this.paddedImageHeight+"px",this.displayMode!=="popup"?this.coverDiv.style.width=this.paddedImageWidth+"px":(this.setTopLeft(),this.positionCropImage()),this.cropLayer.scaleCanvas(this.imageWidth,this.imageHeight),this.applyRotation()},z.prototype.setEditingTarget=function(){var y=document.createElement("canvas");y.width=this.target.naturalWidth,y.height=this.target.naturalHeight,y.getContext("2d").drawImage(this.target,0,0,this.target.naturalWidth,this.target.naturalHeight);var C=y.toDataURL();Qe.setAttributes(this.editingTarget,[["href",C]]),this.setEditingTargetSize()},z.prototype.setTopLeft=function(){var y=this.target.getBoundingClientRect(),C=this.editorCanvas.getBoundingClientRect();this.left=y.left-C.left-this.CANVAS_MARGIN,this.top=y.top-C.top-this.CANVAS_MARGIN},z.prototype.initCropCanvas=function(){this.cropImageHolder=document.createElement("div"),this.cropImageHolder.style.setProperty("touch-action","none"),this.cropImageHolder.style.setProperty("-ms-touch-action","none"),this.cropImage=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.cropImage.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.cropImage.setAttribute("width",this.paddedImageWidth.toString()),this.cropImage.setAttribute("height",this.paddedImageHeight.toString()),this.cropImage.setAttribute("viewBox","0 0 "+this.paddedImageWidth.toString()+" "+this.paddedImageHeight.toString()),this.cropImage.style.pointerEvents="auto",this.cropImageHolder.style.width=this.paddedImageWidth+"px",this.cropImageHolder.style.height=this.paddedImageHeight+"px",this.cropImageHolder.style.transformOrigin="top left",this.positionCropImage(),this.defs=Qe.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=Qe.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=Qe.createGroup(),this.editingTargetRotationScaleContainer=Qe.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var y=Qe.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(y);var C=Qe.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(C),this.editingTargetContainer=Qe.createGroup(),this.editingTargetContainer.style.transform="translate("+this.CANVAS_MARGIN+"px, "+this.CANVAS_MARGIN+"px)",this.editingTargetContainer.appendChild(this.editingTargetRotationContainer),this.cropImage.appendChild(this.editingTargetContainer),this.cropImageHolder.appendChild(this.cropImage),this.editorCanvas.appendChild(this.cropImageHolder)},z.prototype.positionCropImage=function(){this.cropImageHolder.style.top=this.top+"px",this.cropImageHolder.style.left=this.left+"px"},z.prototype.initCropLayer=function(){this.cropRect={x:this.CANVAS_MARGIN,y:this.CANVAS_MARGIN,width:this.imageWidth,height:this.imageHeight},this.cropLayerContainer=Qe.createGroup(),this.cropImage.appendChild(this.cropLayerContainer),this.cropLayer=new Ui(this.imageWidth,this.imageHeight,this.CANVAS_MARGIN,this.cropLayerContainer),this.cropLayer.onCropChange=this.cropRectChanged,this.cropLayer.numberOfGridLines=this.gridLines,this.cropLayer.isGridVisible=this.isGridVisible,this.cropLayer.cropShadeColor=this.styles.settings.cropShadeColor,this.cropLayer.cropFrameColor=this.styles.settings.cropFrameColor,this.cropLayer.gripColor=this.styles.settings.gripColor,this.cropLayer.gripFillColor=this.styles.settings.gripFillColor,this.cropLayer.open(),this.cropLayer.setCropRectangle(this.cropRect),this.zoomToCropEnabled&&this.zoomToCrop()},z.prototype.zoomToCrop=function(){if(this.cropRect){var y=this.cropRect.x-this.CANVAS_MARGIN+this.cropRect.width/2,C=this.cropRect.y-this.CANVAS_MARGIN+this.cropRect.height/2;this.zoomFactor=Math.min(this.imageWidth/this.cropRect.width,this.imageHeight/this.cropRect.height),this.editingTargetContainer&&this.cropLayer&&(this.editingTargetContainer.style.transformOrigin=y+"px "+C+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-y+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-C+this.CANVAS_MARGIN)+"px) scale("+this.zoomFactor+")",this.cropLayer.zoomFactor=this.zoomFactor)}},z.prototype.unzoomFromCrop=function(){this.zoomFactor=1,this.editingTargetContainer&&this.cropLayer&&(this.editingTargetContainer.style.transformOrigin="center",this.editingTargetContainer.style.transform="translate("+this.CANVAS_MARGIN+"px, "+this.CANVAS_MARGIN+"px) scale(1)",this.cropLayer.zoomFactor=this.zoomFactor)},z.prototype.cropRectChanged=function(y){this.cropRect=y,this.zoomToCropEnabled?this.zoomToCrop():this.cropLayer.zoomFactor=1},z.prototype.attachEvents=function(){window.addEventListener("resize",this.onWindowResize)},z.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"},z.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},z.prototype.showUI=function(){switch(this.addStyles(),this.displayMode==="popup"&&this.overrideOverflow(),this.coverDiv=document.createElement("div"),this.coverDiv.className=this.styles.classNamePrefixBase+" "+this.styles.classNamePrefix,this.coverDiv.style.fontSize="16px",this.displayMode){case"inline":this.coverDiv.style.position="absolute";var y=this.styles.settings.hideTopToolbar?0:this.toolbarHeight,C=this.target.offsetTop>y+this.CANVAS_MARGIN?this.target.offsetTop-(y+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},z.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},z.prototype.addTopToolbar=function(){var y=this;this.topToolbar=new qt,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 er;C.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(C);var N=[];this.aspectRatios.forEach(function(Ht){var $t=new Ut(tr.getIcon(Ht.horizontal,Ht.vertical),Ht.horizontal===0&&Ht.vertical===0?"FREE":Ht.horizontal+":"+Ht.vertical);$t.onClick=function(){return y.ratioButtonClicked(Ht)},N.push($t)}),this.aspectRatioButton=new vi(tr.getIcon(0,0),"Aspect ratio",N),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 Z=new Ut('<svg viewBox="0 0 24 24"><path d="M10 4v4h4V4h-4m6 0v4h4V4h-4m0 6v4h4v-4h-4m0 6v4h4v-4h-4m-2 4v-4h-4v4h4m-6 0v-4H4v4h4m0-6v-4H4v4h4m0-6V4H4v4h4m2 6h4v-4h-4v4M4 2h16a2 2 0 012 2v16a2 2 0 01-2 2H4c-1.08 0-2-.9-2-2V4a2 2 0 012-2z"/></svg>',"Toggle grid");Z.isActive=this.isGridVisible,Z.onClick=function(){y.isGridVisible=!y.isGridVisible,Z.isActive=y.isGridVisible},C.addButton(Z);var W=new Ut('<svg viewBox="0 0 24 24"><path d="M15.5 14l5 5-1.5 1.5-5-5v-.79l-.27-.28A6.471 6.471 0 019.5 16 6.5 6.5 0 013 9.5 6.5 6.5 0 019.5 3 6.5 6.5 0 0116 9.5c0 1.61-.59 3.09-1.57 4.23l.28.27h.79m-6 0C12 14 14 12 14 9.5S12 5 9.5 5 5 7 5 9.5 7 14 9.5 14m2.5-4h-2v2H9v-2H7V9h2V7h1v2h2v1z"/></svg>',"Zoom to selection");if(W.isActive=this.zoomToCropEnabled,W.onClick=function(){y.zoomToCropEnabled=!y.zoomToCropEnabled,W.isActive=y.zoomToCropEnabled},C.addButton(W),!Bi.isLicensed){var ge=new pt;this.topToolbar.addElementBlock(ge);var Ue=document.createElement("div");Ue.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var it=document.createElement("a");it.style.color="currentColor",it.href="https://markerjs.com/products/cropro",it.target="_blank",it.innerHTML='<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2"><path d="M16.326 14.895c0 1.126-.558 1.688-1.673 1.688H9.931c-1.116 0-1.674-.562-1.674-1.688V3.733c0-1.126.558-1.688 1.674-1.688h4.722c1.115 0 1.673.562 1.673 1.688v2.899h-1.957V3.793h-4.124v11.042h4.124v-3.242h1.957v3.302z" fill="currentColor"/><path d="M15.94 7.364a.783.783 0 00-1.065-.304l-11.01 6.126a.783.783 0 00-.303 1.065l4.498 8.085a.783.783 0 001.065.304l11.01-6.126a.783.783 0 00.303-1.065L15.94 7.364zM5.311 14.173l3.737 6.718 9.641-5.364-3.737-6.718-9.641 5.364z" fill="#eef762"/></svg>',Ue.appendChild(it),ge.addElement(Ue)}var mt=new er;mt.minWidth=3*this.toolbarHeight+"px",mt.contentAlign="end",this.topToolbar.addButtonBlock(mt);var Ge=new Ut('<svg viewBox="0 0 24 24"><path d="M9 20.42l-6.21-6.21 2.83-2.83L9 14.77l9.88-9.89 2.83 2.83L9 20.42z"/></svg>',"OK");Ge.onClick=this.startRenderAndClose,mt.addButton(Ge),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(Ge.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var bt=new Ut('<svg viewBox="0 0 24 24"><path d="M20 6.91L17.09 4 12 9.09 6.91 4 4 6.91 9.09 12 4 17.09 6.91 20 12 14.91 17.09 20 20 17.09 14.91 12 20 6.91z"/></svg>',"Close");bt.onClick=this.close,mt.addButton(bt),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(bt.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},z.prototype.addBottomToolbar=function(){var y=this;this.bottomToolbar=new qt,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 er;C.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(C);var N=new Ut('<svg viewBox="0 0 24 24"><path d="M13 4.07V1L8.45 5.55 13 10V6.09c2.84.48 5 2.94 5 5.91s-2.16 5.43-5 5.91v2.02c3.95-.49 7-3.85 7-7.93s-3.05-7.44-7-7.93M7.1 18.32c1.16.9 2.51 1.44 3.9 1.61V17.9c-.87-.15-1.71-.49-2.46-1.03L7.1 18.32M6.09 13H4.07c.17 1.39.72 2.73 1.62 3.89l1.41-1.42c-.52-.75-.87-1.59-1.01-2.47m1.02-4.47L5.7 7.11C4.8 8.27 4.24 9.61 4.07 11h2.02c.14-.87.49-1.72 1.02-2.47z"/></svg>',"Rotate left");N.onClick=this.rotateLeftButtonClicked,C.addButton(N);var Z=new Ut('<svg viewBox="0 0 24 24"><path d="M16.89 15.5l1.42 1.39c.9-1.16 1.45-2.5 1.62-3.89h-2.02c-.14.87-.48 1.72-1.02 2.5M13 17.9v2.02c1.39-.17 2.74-.71 3.9-1.61l-1.44-1.44c-.75.54-1.59.89-2.46 1.03m6.93-6.9a7.906 7.906 0 00-1.62-3.89l-1.42 1.42c.54.75.88 1.6 1.02 2.47m-2.36-5.45L11 1v3.07C7.06 4.56 4 7.92 4 12s3.05 7.44 7 7.93v-2.02c-2.84-.48-5-2.94-5-5.91s2.16-5.43 5-5.91V10l4.55-4.45z"/></svg>',"Rotate right");Z.onClick=this.rotateRightButtonClicked,C.addButton(Z);var W=new pt;W.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(W),this.straightener=new Vi("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(mt){y.rotateBy(mt),y.straightener.angle=y.rotationAngle},W.addElement(this.straightener.getUI());var ge=new er;ge.minWidth=2*this.toolbarHeight+"px",ge.contentAlign="end",this.bottomToolbar.addButtonBlock(ge);var Ue=new Ut('<svg viewBox="0 0 24 24"><path d="M15 21h2v-2h-2m4-10h2V7h-2M3 5v14c0 1.1.9 2 2 2h4v-2H5V5h4V3H5c-1.1 0-2 .9-2 2m16-2v2h2c0-1.1-.9-2-2-2m-8 20h2V1h-2m8 16h2v-2h-2M15 5h2V3h-2m4 10h2v-2h-2m0 10c1.1 0 2-.9 2-2h-2z"/></svg>',"Flip horizontal");Ue.onClick=this.flipHorizontallyButtonClicked,ge.addButton(Ue);var it=new Ut('<svg viewBox="0 0 24 24"><path d="M3 15v2h2v-2m10 4v2h2v-2m2-16H5c-1.1 0-2 .9-2 2v4h2V5h14v4h2V5c0-1.1-.9-2-2-2m2 16h-2v2c1.1 0 2-.9 2-2M1 11v2h22v-2M7 19v2h2v-2m10-4v2h2v-2m-10 4v2h2v-2M3 19c0 1.1.9 2 2 2v-2z"/></svg>',"Flip vertical");it.onClick=this.flipVerticallyButtonClicked,ge.addButton(it)},z.prototype.ratioButtonClicked=function(y){this.aspectRatio=y,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},z.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=tr.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},z.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new Gi(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},z.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},z.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},z.prototype.restoreState=function(y){if(y){var C=this.cropLayer.getRescaledRect(y.width,y.height,this.imageWidth,this.imageHeight,y.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(C),this.cropRectChanged(C),this.flippedHorizontally=y.flippedHorizontally,this.flippedVertically=y.flippedVertically,this.applyFlip(),this.rotationAngle=y.rotationAngle,this.applyRotation()}},z.prototype.clientToLocalCoordinates=function(y,C){var N=this.cropImage.getBoundingClientRect();return{x:y-N.left,y:C-N.top}},z.prototype.onWindowResize=function(){this.positionUI()},z.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var y=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=y+"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()},z.prototype.rotateLeftButtonClicked=function(){var y=this.rotationAngle-90;this.rotationAngle%90!=0&&(y+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(y)},z.prototype.rotateRightButtonClicked=function(){var y=this.rotationAngle+90;this.rotationAngle%90!=0&&(y-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(y)},z.prototype.rotateTo=function(y){y=(y=y>180?y-360:y)<=-180?y+360:y,this.rotationAngle=y,this.applyRotation()},z.prototype.rotateBy=function(y){this.rotateTo((this.rotationAngle+y)%360)},z.prototype.applyRotation=function(){var y=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 N=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/N.width,this.imageHeight/N.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=y},z.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},z.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},z.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},z.prototype.startRenderAndClose=function(){return Rt(this,void 0,void 0,function(){var y,C;return Ti(this,function(N){switch(N.label){case 0:return[4,this.render()];case 1:return y=N.sent(),C=this.getState(),this.renderEventListeners.forEach(function(Z){return Z(y,C)}),this.close(!0),[2]}})})},z.prototype.render=function(){return Rt(this,void 0,void 0,function(){var y;return Ti(this,function(C){switch(C.label){case 0:return(y=new fr).naturalSize=this.renderAtNaturalSize,y.imageType=this.renderImageType,y.imageQuality=this.renderImageQuality,y.width=this.renderWidth,y.height=this.renderHeight,this.unzoomFromCrop(),Qe.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,y.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,y.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()]}})})},z.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new Lt("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 Lt("toolbar_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarBlockStyleClass=this.styles.addClass(new Lt("toolbar-block",`
display: flex;
align-items: center;
box-sizing: content-box;
`));var y=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new Lt("toolbar_button",`
display: inline-block;
width: `+(this.toolbarHeight-2*y)+`px;
height: `+(this.toolbarHeight-2*y)+`px;
padding: `+y+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new Lt("toolbar_button_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new Lt("toolbar_active_button",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
`)),this.styles.addRule(new Ot("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.toolbarHeight/2+`px;
`)),this.styles.addRule(new Ot("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new Lt("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 Lt("toolbar_dropdown_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new Lt("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 Lt("toolbar_straightener",`
display: flex;
overflow: hidden;
justify-content: center;
height: `+(this.toolbarHeight-2*y)+`px;
padding: `+y+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new Lt("toolbar_straightener_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`))},z.instanceCounter=0,z}(),Tt=ne("8hTe"),pr=ne.n(Tt),mr=/<pre[^>]*>/g;function gr(z){var y=document.createElement("div");return y.innerHTML=z,y.childNodes.length===0?"":y.childNodes[0].nodeValue}var vr=at.a=function(z){var y=z.value,C=y===void 0?"":y,N=z.edit,Z=N===void 0?!1:N,W=z.className,ge=z.showTextOnly,Ue=z.showLines,it=z.replaces,mt=z.zoomImg,Ge=z.hasMask,bt=z.style,Ht=bt===void 0?{}:bt,$t=z.stylesPrev,Mi=$t===void 0?{}:$t,yi=String(C),bi=Object(I.useRef)(),Xi=Object(I.useRef)(),Ir=Object(I.useState)(""),li=Object(G.a)(Ir,2),Hi=li[0],or=li[1],lr=Object(I.useState)("office"),Pi=Object(G.a)(lr,2),kr=Pi[0],yr=Pi[1],zr=function(){var jt=new Ve(Xi.current);jt.displayMode="popup",jt.addRenderEventListener(function(){var pi=Object(B.a)(D.a.mark(function Dt(ri){var zt;return D.a.wrap(function(ui){for(;;)switch(ui.prev=ui.next){case 0:return bi.current.style.display="none",ui.next=3,Object(Ae.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:ri}});case 3:zt=ui.sent,zt!=null&&zt.id&&it(Xi.current.getAttribute("src").replace(ee.a.API_SERVER,""),"/api/attachments/".concat(zt==null?void 0:zt.id,"?type=").concat(zt.content_type));case 5:case"end":return ui.stop()}},Dt)}));return function(Dt){return pi.apply(this,arguments)}}()),jt.show()},Kr=function(){var jt=new Pt(Xi.current);jt.settings.displayMode="popup",jt.addEventListener("render",function(){var pi=Object(B.a)(D.a.mark(function Dt(ri){var zt;return D.a.wrap(function(ui){for(;;)switch(ui.prev=ui.next){case 0:if(bi.current.style.display="none",!Xi.current){ui.next=6;break}return ui.next=4,Object(Ae.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:ri.dataUrl}});case 4:zt=ui.sent,zt!=null&&zt.id&&it(Xi.current.getAttribute("src").replace(ee.a.API_SERVER,""),"/api/attachments/".concat(zt==null?void 0:zt.id,"?type=").concat(zt.content_type));case 6:case"end":return ui.stop()}},Dt)}));return function(Dt){return pi.apply(this,arguments)}}()),jt.show(),window.markerArea=jt},Yi=Object(I.useMemo)(function(){bi.current&&(bi.current.style.zIndex=-1);try{var ti=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,jt=/\"\/api\/attachments\/|\"\/attachments\/download\//g,pi=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;yi=yi.replace(ti,"("+ee.a.API_SERVER+"/api/attachments/").replace(jt,'"'+ee.a.API_SERVER+"/api/attachments/").replace(pi,'"'+ee.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(ir){}var Dt=V(yi),ri=_();if(yi.match(/\[TOC\]/)&&(Dt=Dt.replace("<p>[TOC]</p>",O()),R()),Dt=Dt.replace(/(__special_katext_id_\d+__)/g,function(ir,ui){var wi=ri[ui],Vr=wi.type,Er=wi.expression;return Object(ae.renderToString)(gr(Er)||"",{displayMode:Vr==="block",throwOnError:!1,output:"html"})}),Dt=Dt.replace(/▁/g,"\u2581\u2581\u2581"),m(),ge){var zt=document.createElement("div");return zt.innerHTML=Dt,zt.innerText}return setTimeout(function(){return dn()},500),Dt},[yi]),zi=Object(I.useRef)();w.WebkitLineClamp=Ue,Ue&&(Ht=Object(F.a)(Object(F.a)({},Ht),w));function br(ti){var jt=ti.target;if(jt.tagName.toUpperCase()==="IMG"){if(mt){var pi=jt.getAttribute("src");or(pi),yr("image")}}else if(jt.tagName.toUpperCase()==="A"){var Dt=jt.getAttribute("href");if(Dt.indexOf("office")>-1)ti.preventDefault(),or(Dt),yr("office");else if(Dt.indexOf("application/pdf")>-1)ti.preventDefault(),or(Dt),yr("pdf");else if(Dt.indexOf("text/html")>-1)ti.preventDefault(),or(Dt),yr("html");else if(Dt.startsWith("#")){ti.preventDefault();var ri=document.getElementById(Dt.replace("#",""));ri&&ri.scrollIntoView(!0)}}}var dn=function(){var jt,pi=(jt=zi.current)===null||jt===void 0?void 0:jt.querySelectorAll("video");pi==null||pi.forEach(function(Dt){if(Dt.oncontextmenu=function(){return!1},Dt.src.indexOf(".m3u8")>-1&&!Dt.canPlayType("application/vnd.apple.mpegurl")){if(X.a.isSupported()){var ri=new X.a;ri.loadSource(Dt.src),ri.attachMedia(Dt)}}})};Object(I.useEffect)(function(){if(zi.current&&Yi&&(Yi.match(mr)&&window.PR.prettyPrint()),zi.current)return zi.current.addEventListener("click",br),function(){zi.current.removeEventListener("click",br),m(),R()}},[Yi,zi.current,br]);var _r=function(jt){if(!Z)return;jt.target.nodeName==="IMG"?(bi.current.style.zIndex=1,bi.current.style.display="flex",bi.current.style.width=jt.target.clientWidth+"px",bi.current.style.height=jt.target.clientHeight+"px",bi.current.style.top=jt.target.offsetTop+"px",bi.current.style.left=jt.target.offsetLeft+"px",Xi.current.src=jt.target.getAttribute("src")):bi.current.style.display="none"};return g.a.createElement("div",{style:{position:"relative"}},g.a.createElement("div",{ref:zi,style:Object(F.a)({},Ht),className:"".concat(W||""," markdown-body ").concat(pr.a.mdBody),onMouseOver:_r,dangerouslySetInnerHTML:{__html:Yi}}),g.a.createElement("div",{ref:bi,className:pr.a.button},g.a.createElement(J.a,null,g.a.createElement($.a,{onClick:function(){return zr()}},"\u88C1\u526A"),g.a.createElement($.a,{onClick:function(){return Kr()}},"\u7F16\u8F91"))),g.a.createElement("img",{ref:Xi,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),g.a.createElement(de.a,{close:!0,data:Hi,type:Hi!=null&&Hi.length?kr:"",style:Object(F.a)({},Mi),onClose:function(){return or("")}}))}},"9VGf":function(yt,at,ne){"use strict";ne.d(at,"a",function(){return k});var oe=ne("q1tI"),J=ne.n(oe);function k($,F){var B=Object(oe.useRef)();Object(oe.useEffect)(function(){B.current=$}),Object(oe.useEffect)(function(){function G(){B.current()}if(F!==null){var H=setInterval(G,F);return function(){return clearInterval(H)}}},[F])}},BU3w:function(yt,at,ne){"use strict";ne.d(at,"a",function(){return B});var oe=ne("MNnm"),J="rc-util-key";function k(G){if(G.attachTo)return G.attachTo;var H=document.querySelector("head");return H||document.body}function $(G){var H,D=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(oe.a)())return null;var I=document.createElement("style");if((H=D.csp)===null||H===void 0?void 0:H.nonce){var g;I.nonce=(g=D.csp)===null||g===void 0?void 0:g.nonce}I.innerHTML=G;var p=k(D),f=p.firstChild;return D.prepend&&p.prepend?p.prepend(I):D.prepend&&f?p.insertBefore(I,f):p.appendChild(I),I}var F=new Map;function B(G,H){var D=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},I=k(D);if(!F.has(I)){var g=$("",D),p=g.parentNode;F.set(I,p),p.removeChild(g)}var f=Array.from(F.get(I).children).find(function(a){return a.tagName==="STYLE"&&a[J]===H});if(f){var h,o;if(((h=D.csp)===null||h===void 0?void 0:h.nonce)&&f.nonce!==((o=D.csp)===null||o===void 0?void 0:o.nonce)){var d;f.nonce=(d=D.csp)===null||d===void 0?void 0:d.nonce}return f.innerHTML!==G&&(f.innerHTML=G),f}var s=$(G,D);return s[J]=H,s}},Bd2K:function(yt,at,ne){(function(oe){oe(ne("VrN/"),ne("osHv"))})(function(oe){oe.defineOption("autoCloseTags",!1,function(D,I,g){if(g!=oe.Init&&g&&D.removeKeyMap("autoCloseTags"),!I)return;var p={name:"autoCloseTags"};(typeof I!="object"||I.whenClosing!==!1)&&(p["'/'"]=function(f){return B(f)}),(typeof I!="object"||I.whenOpening!==!1)&&(p["'>'"]=function(f){return $(f)}),D.addKeyMap(p)});var J=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],k=["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 $(D){if(D.getOption("disableInput"))return oe.Pass;for(var I=D.listSelections(),g=[],p=D.getOption("autoCloseTags"),f=0;f<I.length;f++){if(!I[f].empty())return oe.Pass;var h=I[f].head,o=D.getTokenAt(h),d=oe.innerMode(D.getMode(),o.state),s=d.state,a=d.mode.xmlCurrentTag&&d.mode.xmlCurrentTag(s),l=a&&a.name;if(!l)return oe.Pass;var c=d.mode.configuration=="html",R=typeof p=="object"&&p.dontCloseTags||c&&J,w=typeof p=="object"&&p.indentTags||c&&k;o.end>h.ch&&(l=l.slice(0,l.length-o.end+h.ch));var x=l.toLowerCase();if(!l||o.type=="string"&&(o.end!=h.ch||!/[\"\']/.test(o.string.charAt(o.string.length-1))||o.string.length==1)||o.type=="tag"&&a.close||o.string.indexOf("/")==h.ch-o.start-1||R&&G(R,x)>-1||H(D,d.mode.xmlCurrentContext&&d.mode.xmlCurrentContext(s)||[],l,h,!0))return oe.Pass;var O=typeof p=="object"&&p.emptyTags;if(O&&G(O,l)>-1){g[f]={text:"/>",newPos:oe.Pos(h.line,h.ch+2)};continue}var A=w&&G(w,x)>-1;g[f]={indent:A,text:">"+(A?`
`:"")+"</"+l+">",newPos:A?oe.Pos(h.line+1,0):oe.Pos(h.line,h.ch+1)}}for(var T=typeof p=="object"&&p.dontIndentOnAutoClose,f=I.length-1;f>=0;f--){var E=g[f];D.replaceRange(E.text,I[f].head,I[f].anchor,"+insert");var b=D.listSelections().slice(0);b[f]={head:E.newPos,anchor:E.newPos},D.setSelections(b),!T&&E.indent&&(D.indentLine(E.newPos.line,null,!0),D.indentLine(E.newPos.line+1,null,!0))}}function F(D,I){for(var g=D.listSelections(),p=[],f=I?"/":"</",h=D.getOption("autoCloseTags"),o=typeof h=="object"&&h.dontIndentOnSlash,d=0;d<g.length;d++){if(!g[d].empty())return oe.Pass;var s=g[d].head,a=D.getTokenAt(s),l=oe.innerMode(D.getMode(),a.state),c=l.state;if(I&&(a.type=="string"||a.string.charAt(0)!="<"||a.start!=s.ch-1))return oe.Pass;var R,w=l.mode.name!="xml"&&D.getMode().name=="htmlmixed";if(w&&l.mode.name=="javascript")R=f+"script";else if(w&&l.mode.name=="css")R=f+"style";else{var x=l.mode.xmlCurrentContext&&l.mode.xmlCurrentContext(c);if(!x||x.length&&H(D,x,x[x.length-1],s))return oe.Pass;R=f+x[x.length-1]}D.getLine(s.line).charAt(a.end)!=">"&&(R+=">"),p[d]=R}if(D.replaceSelections(p),g=D.listSelections(),!o)for(var d=0;d<g.length;d++)(d==g.length-1||g[d].head.line<g[d+1].head.line)&&D.indentLine(g[d].head.line)}function B(D){return D.getOption("disableInput")?oe.Pass:F(D,!0)}oe.commands.closeTag=function(D){return F(D)};function G(D,I){if(D.indexOf)return D.indexOf(I);for(var g=0,p=D.length;g<p;++g)if(D[g]==I)return g;return-1}function H(D,I,g,p,f){if(!oe.scanForClosingTag)return!1;var h=Math.min(D.lastLine()+1,p.line+500),o=oe.scanForClosingTag(D,p,null,h);if(!o||o.tag!=g)return!1;for(var d=f?1:0,s=I.length-1;s>=0&&I[s]==g;s--)++d;p=o.to;for(var s=1;s<d;s++){var a=oe.scanForClosingTag(D,p,null,h);if(!a||a.tag!=g)return!1;p=a.to}return!0}})},BjJ7:function(yt,at,ne){"use strict";ne.d(at,"d",function(){return J}),ne.d(at,"c",function(){return k}),ne.d(at,"e",function(){return $}),ne.d(at,"b",function(){return F}),ne.d(at,"a",function(){return G});var oe=ne("m3rI");function J(H){var D=!0;if(H.length>0){for(var I=0;I<H.length;I++)if(H[I].compile_success==0||!H[I].compile_success){D=!1;break}}else D=!1;return D}function k(H){for(var D=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",I=[],g=0;g<H.length;g++){var p=H[g],f=D?"".concat(D,"/").concat(p.name):"".concat(p.name);I.push({title:p.name,isLeaf:!(p.type==="tree"),key:f})}return I}function $(H,D,I){for(var g=0;g<H.length;g++){var p=H[g];if(p.key===D){p.children=I;break}p.children&&$(p.children,D,I)}return H}function F(H,D,I){var g;return function(){var p=this,f=arguments,h=function(){g=null,I||H.apply(p,f)},o=I&&!g;clearTimeout(g),g=setTimeout(h,D),o&&H.apply(p,f)}}var B=!0,G=oe.a.API_SERVER},"C+DQ":function(yt,at,ne){},DlQD:function(yt,at,ne){(function(oe,J){yt.exports=J()})(this,function(){"use strict";function oe(_e,me){for(var ve=0;ve<me.length;ve++){var te=me[ve];te.enumerable=te.enumerable||!1,te.configurable=!0,"value"in te&&(te.writable=!0),Object.defineProperty(_e,te.key,te)}}function J(_e,me,ve){return me&&oe(_e.prototype,me),ve&&oe(_e,ve),_e}function k(_e,me){if(!_e)return;if(typeof _e=="string")return $(_e,me);var ve=Object.prototype.toString.call(_e).slice(8,-1);if(ve==="Object"&&_e.constructor&&(ve=_e.constructor.name),ve==="Map"||ve==="Set")return Array.from(_e);if(ve==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(ve))return $(_e,me)}function $(_e,me){(me==null||me>_e.length)&&(me=_e.length);for(var ve=0,te=new Array(me);ve<me;ve++)te[ve]=_e[ve];return te}function F(_e,me){var ve;if(typeof Symbol=="undefined"||_e[Symbol.iterator]==null){if(Array.isArray(_e)||(ve=k(_e))||me&&_e&&typeof _e.length=="number"){ve&&(_e=ve);var te=0;return function(){return te>=_e.length?{done:!0}:{done:!1,value:_e[te++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}return ve=_e[Symbol.iterator](),ve.next.bind(ve)}function B(_e,me){return me={exports:{}},_e(me,me.exports),me.exports}var G=B(function(_e){function me(){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 ve(te){_e.exports.defaults=te}_e.exports={defaults:me(),getDefaults:me,changeDefaults:ve}}),H=G.defaults,D=G.getDefaults,I=G.changeDefaults,g=/[&<>"']/,p=/[&<>"']/g,f=/[<>"']|&(?!#?\w+;)/,h=/[<>"']|&(?!#?\w+;)/g,o={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},d=function(me){return o[me]};function s(_e,me){if(me){if(g.test(_e))return _e.replace(p,d)}else if(f.test(_e))return _e.replace(h,d);return _e}var a=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function l(_e){return _e.replace(a,function(me,ve){return ve=ve.toLowerCase(),ve==="colon"?":":ve.charAt(0)==="#"?ve.charAt(1)==="x"?String.fromCharCode(parseInt(ve.substring(2),16)):String.fromCharCode(+ve.substring(1)):""})}var c=/(^|[^\[])\^/g;function R(_e,me){_e=_e.source||_e,me=me||"";var ve={replace:function(ie,le){return le=le.source||le,le=le.replace(c,"$1"),_e=_e.replace(ie,le),ve},getRegex:function(){return new RegExp(_e,me)}};return ve}var w=/[^\w:]/g,x=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function O(_e,me,ve){if(_e){var te;try{te=decodeURIComponent(l(ve)).replace(w,"").toLowerCase()}catch(ie){return null}if(te.indexOf("javascript:")===0||te.indexOf("vbscript:")===0||te.indexOf("data:")===0)return null}me&&!x.test(ve)&&(ve=u(me,ve));try{ve=encodeURI(ve).replace(/%25/g,"%")}catch(ie){return null}return ve}var A={},T=/^[^:]+:\/*[^/]*$/,E=/^([^:]+:)[\s\S]*$/,b=/^([^:]+:\/*[^/]*)[\s\S]*$/;function u(_e,me){A[" "+_e]||(T.test(_e)?A[" "+_e]=_e+"/":A[" "+_e]=M(_e,"/",!0)),_e=A[" "+_e];var ve=_e.indexOf(":")===-1;return me.substring(0,2)==="//"?ve?me:_e.replace(E,"$1")+me:me.charAt(0)==="/"?ve?me:_e.replace(b,"$1")+me:_e+me}var _={exec:function(){}};function m(_e){for(var me=1,ve,te;me<arguments.length;me++){ve=arguments[me];for(te in ve)Object.prototype.hasOwnProperty.call(ve,te)&&(_e[te]=ve[te])}return _e}function v(_e,me){var ve=_e.replace(/\|/g,function(le,pe,ye){for(var Le=!1,He=pe;--He>=0&&ye[He]==="\\";)Le=!Le;return Le?"|":" |"}),te=ve.split(/ \|/),ie=0;if(te.length>me)te.splice(me);else for(;te.length<me;)te.push("");for(;ie<te.length;ie++)te[ie]=te[ie].trim().replace(/\\\|/g,"|");return te}function M(_e,me,ve){var te=_e.length;if(te===0)return"";for(var ie=0;ie<te;){var le=_e.charAt(te-ie-1);if(le===me&&!ve)ie++;else if(le!==me&&ve)ie++;else break}return _e.substr(0,te-ie)}function P(_e,me){if(_e.indexOf(me[1])===-1)return-1;for(var ve=_e.length,te=0,ie=0;ie<ve;ie++)if(_e[ie]==="\\")ie++;else if(_e[ie]===me[0])te++;else if(_e[ie]===me[1]&&(te--,te<0))return ie;return-1}function K(_e){_e&&_e.sanitize&&!_e.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}var V={escape:s,unescape:l,edit:R,cleanUrl:O,resolveUrl:u,noopTest:_,merge:m,splitCells:v,rtrim:M,findClosingBracket:P,checkSanitizeDeprecation:K},U=G.defaults,S=V.rtrim,X=V.splitCells,ee=V.escape,ae=V.findClosingBracket;function de(_e,me,ve){var te=me.href,ie=me.title?ee(me.title):null,le=_e[1].replace(/\\([\[\]])/g,"$1");return _e[0].charAt(0)!=="!"?{type:"link",raw:ve,href:te,title:ie,text:le}:{type:"image",raw:ve,href:te,title:ie,text:ee(le)}}function Ae(_e,me){var ve=_e.match(/^(\s+)(?:```)/);if(ve===null)return me;var te=ve[1];return me.split(`
`).map(function(ie){var le=ie.match(/^\s+/);if(le===null)return ie;var pe=le[0];return pe.length>=te.length?ie.slice(te.length):ie}).join(`
`)}var Ee=function(){function _e(ve){this.options=ve||U}var me=_e.prototype;return me.space=function(te){var ie=this.rules.block.newline.exec(te);if(ie)return ie[0].length>1?{type:"space",raw:ie[0]}:{raw:`
`}},me.code=function(te,ie){var le=this.rules.block.code.exec(te);if(le){var pe=ie[ie.length-1];if(pe&&pe.type==="paragraph")return{raw:le[0],text:le[0].trimRight()};var ye=le[0].replace(/^ {4}/gm,"");return{type:"code",raw:le[0],codeBlockStyle:"indented",text:this.options.pedantic?ye:S(ye,`
`)}}},me.fences=function(te){var ie=this.rules.block.fences.exec(te);if(ie){var le=ie[0],pe=Ae(le,ie[3]||"");return{type:"code",raw:le,lang:ie[2]?ie[2].trim():ie[2],text:pe}}},me.heading=function(te){var ie=this.rules.block.heading.exec(te);if(ie)return{type:"heading",raw:ie[0],depth:ie[1].length,text:ie[2]}},me.nptable=function(te){var ie=this.rules.block.nptable.exec(te);if(ie){var le={type:"table",header:X(ie[1].replace(/^ *| *\| *$/g,"")),align:ie[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ie[3]?ie[3].replace(/\n$/,"").split(`
`):[],raw:ie[0]};if(le.header.length===le.align.length){var pe=le.align.length,ye;for(ye=0;ye<pe;ye++)/^ *-+: *$/.test(le.align[ye])?le.align[ye]="right":/^ *:-+: *$/.test(le.align[ye])?le.align[ye]="center":/^ *:-+ *$/.test(le.align[ye])?le.align[ye]="left":le.align[ye]=null;for(pe=le.cells.length,ye=0;ye<pe;ye++)le.cells[ye]=X(le.cells[ye],le.header.length);return le}}},me.hr=function(te){var ie=this.rules.block.hr.exec(te);if(ie)return{type:"hr",raw:ie[0]}},me.blockquote=function(te){var ie=this.rules.block.blockquote.exec(te);if(ie){var le=ie[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:ie[0],text:le}}},me.list=function(te){var ie=this.rules.block.list.exec(te);if(ie){for(var le=ie[0],pe=ie[2],ye=pe.length>1,Le=pe[pe.length-1]===")",He={type:"list",raw:le,ordered:ye,start:ye?+pe.slice(0,-1):"",loose:!1,items:[]},st=ie[0].match(this.rules.block.item),ct=!1,ft,Ct,xt,ut,Bt,Pt,Jt,Yt=st.length,Rt=0;Rt<Yt;Rt++)ft=st[Rt],le=ft,Ct=ft.length,ft=ft.replace(/^ *([*+-]|\d+[.)]) */,""),~ft.indexOf(`
`)&&(Ct-=ft.length,ft=this.options.pedantic?ft.replace(/^ {1,4}/gm,""):ft.replace(new RegExp("^ {1,"+Ct+"}","gm"),"")),Rt!==Yt-1&&(xt=this.rules.block.bullet.exec(st[Rt+1])[0],(ye?xt.length===1||!Le&&xt[xt.length-1]===")":xt.length>1||this.options.smartLists&&xt!==pe)&&(ut=st.slice(Rt+1).join(`
`),He.raw=He.raw.substring(0,He.raw.length-ut.length),Rt=Yt-1)),Bt=ct||/\n\n(?!\s*$)/.test(ft),Rt!==Yt-1&&(ct=ft.charAt(ft.length-1)===`
`,Bt||(Bt=ct)),Bt&&(He.loose=!0),Pt=/^\[[ xX]\] /.test(ft),Jt=void 0,Pt&&(Jt=ft[1]!==" ",ft=ft.replace(/^\[[ xX]\] +/,"")),He.items.push({type:"list_item",raw:le,task:Pt,checked:Jt,loose:Bt,text:ft});return He}},me.html=function(te){var ie=this.rules.block.html.exec(te);if(ie)return{type:this.options.sanitize?"paragraph":"html",raw:ie[0],pre:!this.options.sanitizer&&(ie[1]==="pre"||ie[1]==="script"||ie[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ie[0]):ee(ie[0]):ie[0]}},me.def=function(te){var ie=this.rules.block.def.exec(te);if(ie){ie[3]&&(ie[3]=ie[3].substring(1,ie[3].length-1));var le=ie[1].toLowerCase().replace(/\s+/g," ");return{tag:le,raw:ie[0],href:ie[2],title:ie[3]}}},me.table=function(te){var ie=this.rules.block.table.exec(te);if(ie){var le={type:"table",header:X(ie[1].replace(/^ *| *\| *$/g,"")),align:ie[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ie[3]?ie[3].replace(/\n$/,"").split(`
`):[]};if(le.header.length===le.align.length){le.raw=ie[0];var pe=le.align.length,ye;for(ye=0;ye<pe;ye++)/^ *-+: *$/.test(le.align[ye])?le.align[ye]="right":/^ *:-+: *$/.test(le.align[ye])?le.align[ye]="center":/^ *:-+ *$/.test(le.align[ye])?le.align[ye]="left":le.align[ye]=null;for(pe=le.cells.length,ye=0;ye<pe;ye++)le.cells[ye]=X(le.cells[ye].replace(/^ *\| *| *\| *$/g,""),le.header.length);return le}}},me.lheading=function(te){var ie=this.rules.block.lheading.exec(te);if(ie)return{type:"heading",raw:ie[0],depth:ie[2].charAt(0)==="="?1:2,text:ie[1]}},me.paragraph=function(te){var ie=this.rules.block.paragraph.exec(te);if(ie)return{type:"paragraph",raw:ie[0],text:ie[1].charAt(ie[1].length-1)===`
`?ie[1].slice(0,-1):ie[1]}},me.text=function(te,ie){var le=this.rules.block.text.exec(te);if(le){var pe=ie[ie.length-1];return pe&&pe.type==="text"?{raw:le[0],text:le[0]}:{type:"text",raw:le[0],text:le[0]}}},me.escape=function(te){var ie=this.rules.inline.escape.exec(te);if(ie)return{type:"escape",raw:ie[0],text:ee(ie[1])}},me.tag=function(te,ie,le){var pe=this.rules.inline.tag.exec(te);if(pe)return!ie&&/^<a /i.test(pe[0])?ie=!0:ie&&/^<\/a>/i.test(pe[0])&&(ie=!1),!le&&/^<(pre|code|kbd|script)(\s|>)/i.test(pe[0])?le=!0:le&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(pe[0])&&(le=!1),{type:this.options.sanitize?"text":"html",raw:pe[0],inLink:ie,inRawBlock:le,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(pe[0]):ee(pe[0]):pe[0]}},me.link=function(te){var ie=this.rules.inline.link.exec(te);if(ie){var le=ae(ie[2],"()");if(le>-1){var pe=ie[0].indexOf("!")===0?5:4,ye=pe+ie[1].length+le;ie[2]=ie[2].substring(0,le),ie[0]=ie[0].substring(0,ye).trim(),ie[3]=""}var Le=ie[2],He="";if(this.options.pedantic){var st=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Le);st?(Le=st[1],He=st[3]):He=""}else He=ie[3]?ie[3].slice(1,-1):"";Le=Le.trim().replace(/^<([\s\S]*)>$/,"$1");var ct=de(ie,{href:Le&&Le.replace(this.rules.inline._escapes,"$1"),title:He&&He.replace(this.rules.inline._escapes,"$1")},ie[0]);return ct}},me.reflink=function(te,ie){var le;if((le=this.rules.inline.reflink.exec(te))||(le=this.rules.inline.nolink.exec(te))){var pe=(le[2]||le[1]).replace(/\s+/g," ");if(pe=ie[pe.toLowerCase()],!pe||!pe.href){var ye=le[0].charAt(0);return{type:"text",raw:ye,text:ye}}var Le=de(le,pe,le[0]);return Le}},me.strong=function(te,ie,le){le===void 0&&(le="");var pe=this.rules.inline.strong.start.exec(te);if(pe&&(!pe[1]||pe[1]&&(le===""||this.rules.inline.punctuation.exec(le)))){ie=ie.slice(-1*te.length);var ye=pe[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;ye.lastIndex=0;for(var Le;(pe=ye.exec(ie))!=null;)if(Le=this.rules.inline.strong.middle.exec(ie.slice(0,pe.index+3)),Le)return{type:"strong",raw:te.slice(0,Le[0].length),text:te.slice(2,Le[0].length-2)}}},me.em=function(te,ie,le){le===void 0&&(le="");var pe=this.rules.inline.em.start.exec(te);if(pe&&(!pe[1]||pe[1]&&(le===""||this.rules.inline.punctuation.exec(le)))){ie=ie.slice(-1*te.length);var ye=pe[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;ye.lastIndex=0;for(var Le;(pe=ye.exec(ie))!=null;)if(Le=this.rules.inline.em.middle.exec(ie.slice(0,pe.index+2)),Le)return{type:"em",raw:te.slice(0,Le[0].length),text:te.slice(1,Le[0].length-1)}}},me.codespan=function(te){var ie=this.rules.inline.code.exec(te);if(ie){var le=ie[2].replace(/\n/g," "),pe=/[^ ]/.test(le),ye=le.startsWith(" ")&&le.endsWith(" ");return pe&&ye&&(le=le.substring(1,le.length-1)),le=ee(le,!0),{type:"codespan",raw:ie[0],text:le}}},me.br=function(te){var ie=this.rules.inline.br.exec(te);if(ie)return{type:"br",raw:ie[0]}},me.del=function(te){var ie=this.rules.inline.del.exec(te);if(ie)return{type:"del",raw:ie[0],text:ie[1]}},me.autolink=function(te,ie){var le=this.rules.inline.autolink.exec(te);if(le){var pe,ye;return le[2]==="@"?(pe=ee(this.options.mangle?ie(le[1]):le[1]),ye="mailto:"+pe):(pe=ee(le[1]),ye=pe),{type:"link",raw:le[0],text:pe,href:ye,tokens:[{type:"text",raw:pe,text:pe}]}}},me.url=function(te,ie){var le;if(le=this.rules.inline.url.exec(te)){var pe,ye;if(le[2]==="@")pe=ee(this.options.mangle?ie(le[0]):le[0]),ye="mailto:"+pe;else{var Le;do Le=le[0],le[0]=this.rules.inline._backpedal.exec(le[0])[0];while(Le!==le[0]);pe=ee(le[0]),le[1]==="www."?ye="http://"+pe:ye=pe}return{type:"link",raw:le[0],text:pe,href:ye,tokens:[{type:"text",raw:pe,text:pe}]}}},me.inlineText=function(te,ie,le){var pe=this.rules.inline.text.exec(te);if(pe){var ye;return ie?ye=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(pe[0]):ee(pe[0]):pe[0]:ye=ee(this.options.smartypants?le(pe[0]):pe[0]),{type:"text",raw:pe[0],text:ye}}},_e}(),we=V.noopTest,he=V.edit,ce=V.merge,se={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6}) +([^\n]*?)(?: +#+)? *(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|<![A-Z][\\s\\S]*?>\\n*|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>\\n*|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:we,table:we,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};se._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,se._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,se.def=he(se.def).replace("label",se._label).replace("title",se._title).getRegex(),se.bullet=/(?:[*+-]|\d{1,9}[.)])/,se.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,se.item=he(se.item,"gm").replace(/bull/g,se.bullet).getRegex(),se.list=he(se.list).replace(/bull/g,se.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+se.def.source+")").getRegex(),se._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",se._comment=/<!--(?!-?>)[\s\S]*?-->/,se.html=he(se.html,"i").replace("comment",se._comment).replace("tag",se._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),se.paragraph=he(se._paragraph).replace("hr",se.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",se._tag).getRegex(),se.blockquote=he(se.blockquote).replace("paragraph",se.paragraph).getRegex(),se.normal=ce({},se),se.gfm=ce({},se.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*|$)"}),se.gfm.nptable=he(se.gfm.nptable).replace("hr",se.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",se._tag).getRegex(),se.gfm.table=he(se.gfm.table).replace("hr",se.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",se._tag).getRegex(),se.pedantic=ce({},se.normal,{html:he(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",se._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,fences:we,paragraph:he(se.normal._paragraph).replace("hr",se.hr).replace("heading",` *#{1,6} *[^
]`).replace("lheading",se.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var re={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:we,tag:"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,nolink:/^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",strong:{start:/^(?:(\*\*(?=[*punctuation]))|\*\*)(?![\s])|__/,middle:/^\*\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*\*$|^__(?![\s])((?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?)__$/,endAst:/[^punctuation\s]\*\*(?!\*)|[punctuation]\*\*(?!\*)(?:(?=[punctuation\s]|$))/,endUnd:/[^\s]__(?!_)(?:(?=[punctuation\s])|$)/},em:{start:/^(?:(\*(?=[punctuation]))|\*)(?![*\s])|_/,middle:/^\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*$|^_(?![_\s])(?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?_$/,endAst:/[^punctuation\s]\*(?!\*)|[punctuation]\*(?!\*)(?:(?=[punctuation\s]|$))/,endUnd:/[^\s]_(?!_)(?:(?=[punctuation\s])|$)/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:we,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};re._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",re.punctuation=he(re.punctuation).replace(/punctuation/g,re._punctuation).getRegex(),re._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",re._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",re.em.start=he(re.em.start).replace(/punctuation/g,re._punctuation).getRegex(),re.em.middle=he(re.em.middle).replace(/punctuation/g,re._punctuation).replace(/overlapSkip/g,re._overlapSkip).getRegex(),re.em.endAst=he(re.em.endAst,"g").replace(/punctuation/g,re._punctuation).getRegex(),re.em.endUnd=he(re.em.endUnd,"g").replace(/punctuation/g,re._punctuation).getRegex(),re.strong.start=he(re.strong.start).replace(/punctuation/g,re._punctuation).getRegex(),re.strong.middle=he(re.strong.middle).replace(/punctuation/g,re._punctuation).replace(/blockSkip/g,re._blockSkip).getRegex(),re.strong.endAst=he(re.strong.endAst,"g").replace(/punctuation/g,re._punctuation).getRegex(),re.strong.endUnd=he(re.strong.endUnd,"g").replace(/punctuation/g,re._punctuation).getRegex(),re.blockSkip=he(re._blockSkip,"g").getRegex(),re.overlapSkip=he(re._overlapSkip,"g").getRegex(),re._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,re._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,re._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])?)+(?![-_])/,re.autolink=he(re.autolink).replace("scheme",re._scheme).replace("email",re._email).getRegex(),re._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,re.tag=he(re.tag).replace("comment",se._comment).replace("attribute",re._attribute).getRegex(),re._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,re._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,re._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,re.link=he(re.link).replace("label",re._label).replace("href",re._href).replace("title",re._title).getRegex(),re.reflink=he(re.reflink).replace("label",re._label).getRegex(),re.reflinkSearch=he(re.reflinkSearch,"g").replace("reflink",re.reflink).replace("nolink",re.nolink).getRegex(),re.normal=ce({},re),re.pedantic=ce({},re.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:he(/^!?\[(label)\]\((.*?)\)/).replace("label",re._label).getRegex(),reflink:he(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",re._label).getRegex()}),re.gfm=ce({},re.normal,{escape:he(re.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^~+(?=\S)([\s\S]*?\S)~+/,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*~]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))|(?= {2,}\n|[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))/}),re.gfm.url=he(re.gfm.url,"i").replace("email",re.gfm._extended_email).getRegex(),re.breaks=ce({},re.gfm,{br:he(re.br).replace("{2,}","*").getRegex(),text:he(re.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var xe={block:se,inline:re},be=G.defaults,ke=xe.block,Oe=xe.inline;function Be(_e){return _e.replace(/---/g,"\u2014").replace(/--/g,"\u2013").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1\u2018").replace(/'/g,"\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1\u201C").replace(/"/g,"\u201D").replace(/\.{3}/g,"\u2026")}function Ce(_e){var me="",ve,te,ie=_e.length;for(ve=0;ve<ie;ve++)te=_e.charCodeAt(ve),Math.random()>.5&&(te="x"+te.toString(16)),me+="&#"+te+";";return me}var De=function(){function _e(ve){this.tokens=[],this.tokens.links=Object.create(null),this.options=ve||be,this.options.tokenizer=this.options.tokenizer||new Ee,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var te={block:ke.normal,inline:Oe.normal};this.options.pedantic?(te.block=ke.pedantic,te.inline=Oe.pedantic):this.options.gfm&&(te.block=ke.gfm,this.options.breaks?te.inline=Oe.breaks:te.inline=Oe.gfm),this.tokenizer.rules=te}_e.lex=function(te,ie){var le=new _e(ie);return le.lex(te)};var me=_e.prototype;return me.lex=function(te){return te=te.replace(/\r\n|\r/g,`
`).replace(/\t/g," "),this.blockTokens(te,this.tokens,!0),this.inline(this.tokens),this.tokens},me.blockTokens=function(te,ie,le){ie===void 0&&(ie=[]),le===void 0&&(le=!0),te=te.replace(/^ +$/gm,"");for(var pe,ye,Le,He;te;){if(pe=this.tokenizer.space(te)){te=te.substring(pe.raw.length),pe.type&&ie.push(pe);continue}if(pe=this.tokenizer.code(te,ie)){te=te.substring(pe.raw.length),pe.type?ie.push(pe):(He=ie[ie.length-1],He.raw+=`
`+pe.raw,He.text+=`
`+pe.text);continue}if(pe=this.tokenizer.fences(te)){te=te.substring(pe.raw.length),ie.push(pe);continue}if(pe=this.tokenizer.heading(te)){te=te.substring(pe.raw.length),ie.push(pe);continue}if(pe=this.tokenizer.nptable(te)){te=te.substring(pe.raw.length),ie.push(pe);continue}if(pe=this.tokenizer.hr(te)){te=te.substring(pe.raw.length),ie.push(pe);continue}if(pe=this.tokenizer.blockquote(te)){te=te.substring(pe.raw.length),pe.tokens=this.blockTokens(pe.text,[],le),ie.push(pe);continue}if(pe=this.tokenizer.list(te)){for(te=te.substring(pe.raw.length),Le=pe.items.length,ye=0;ye<Le;ye++)pe.items[ye].tokens=this.blockTokens(pe.items[ye].text,[],!1);ie.push(pe);continue}if(pe=this.tokenizer.html(te)){te=te.substring(pe.raw.length),ie.push(pe);continue}if(le&&(pe=this.tokenizer.def(te))){te=te.substring(pe.raw.length),this.tokens.links[pe.tag]||(this.tokens.links[pe.tag]={href:pe.href,title:pe.title});continue}if(pe=this.tokenizer.table(te)){te=te.substring(pe.raw.length),ie.push(pe);continue}if(pe=this.tokenizer.lheading(te)){te=te.substring(pe.raw.length),ie.push(pe);continue}if(le&&(pe=this.tokenizer.paragraph(te))){te=te.substring(pe.raw.length),ie.push(pe);continue}if(pe=this.tokenizer.text(te,ie)){te=te.substring(pe.raw.length),pe.type?ie.push(pe):(He=ie[ie.length-1],He.raw+=`
`+pe.raw,He.text+=`
`+pe.text);continue}if(te){var st="Infinite loop on byte: "+te.charCodeAt(0);if(this.options.silent){console.error(st);break}else throw new Error(st)}}return ie},me.inline=function(te){var ie,le,pe,ye,Le,He,st=te.length;for(ie=0;ie<st;ie++){He=te[ie];switch(He.type){case"paragraph":case"text":case"heading":{He.tokens=[],this.inlineTokens(He.text,He.tokens);break}case"table":{for(He.tokens={header:[],cells:[]},ye=He.header.length,le=0;le<ye;le++)He.tokens.header[le]=[],this.inlineTokens(He.header[le],He.tokens.header[le]);for(ye=He.cells.length,le=0;le<ye;le++)for(Le=He.cells[le],He.tokens.cells[le]=[],pe=0;pe<Le.length;pe++)He.tokens.cells[le][pe]=[],this.inlineTokens(Le[pe],He.tokens.cells[le][pe]);break}case"blockquote":{this.inline(He.tokens);break}case"list":{for(ye=He.items.length,le=0;le<ye;le++)this.inline(He.items[le].tokens);break}}}return te},me.inlineTokens=function(te,ie,le,pe,ye){ie===void 0&&(ie=[]),le===void 0&&(le=!1),pe===void 0&&(pe=!1),ye===void 0&&(ye="");var Le,He=te,st;if(this.tokens.links){var ct=Object.keys(this.tokens.links);if(ct.length>0)for(;(st=this.tokenizer.rules.inline.reflinkSearch.exec(He))!=null;)ct.includes(st[0].slice(st[0].lastIndexOf("[")+1,-1))&&(He=He.slice(0,st.index)+"["+"a".repeat(st[0].length-2)+"]"+He.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(st=this.tokenizer.rules.inline.blockSkip.exec(He))!=null;)He=He.slice(0,st.index)+"["+"a".repeat(st[0].length-2)+"]"+He.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;te;){if(Le=this.tokenizer.escape(te)){te=te.substring(Le.raw.length),ie.push(Le);continue}if(Le=this.tokenizer.tag(te,le,pe)){te=te.substring(Le.raw.length),le=Le.inLink,pe=Le.inRawBlock,ie.push(Le);continue}if(Le=this.tokenizer.link(te)){te=te.substring(Le.raw.length),Le.type==="link"&&(Le.tokens=this.inlineTokens(Le.text,[],!0,pe)),ie.push(Le);continue}if(Le=this.tokenizer.reflink(te,this.tokens.links)){te=te.substring(Le.raw.length),Le.type==="link"&&(Le.tokens=this.inlineTokens(Le.text,[],!0,pe)),ie.push(Le);continue}if(Le=this.tokenizer.strong(te,He,ye)){te=te.substring(Le.raw.length),Le.tokens=this.inlineTokens(Le.text,[],le,pe),ie.push(Le);continue}if(Le=this.tokenizer.em(te,He,ye)){te=te.substring(Le.raw.length),Le.tokens=this.inlineTokens(Le.text,[],le,pe),ie.push(Le);continue}if(Le=this.tokenizer.codespan(te)){te=te.substring(Le.raw.length),ie.push(Le);continue}if(Le=this.tokenizer.br(te)){te=te.substring(Le.raw.length),ie.push(Le);continue}if(Le=this.tokenizer.del(te)){te=te.substring(Le.raw.length),Le.tokens=this.inlineTokens(Le.text,[],le,pe),ie.push(Le);continue}if(Le=this.tokenizer.autolink(te,Ce)){te=te.substring(Le.raw.length),ie.push(Le);continue}if(!le&&(Le=this.tokenizer.url(te,Ce))){te=te.substring(Le.raw.length),ie.push(Le);continue}if(Le=this.tokenizer.inlineText(te,pe,Be)){te=te.substring(Le.raw.length),ye=Le.raw.slice(-1),ie.push(Le);continue}if(te){var ft="Infinite loop on byte: "+te.charCodeAt(0);if(this.options.silent){console.error(ft);break}else throw new Error(ft)}}return ie},J(_e,null,[{key:"rules",get:function(){return{block:ke,inline:Oe}}}]),_e}(),Ne=G.defaults,Ke=V.cleanUrl,Fe=V.escape,je=function(){function _e(ve){this.options=ve||Ne}var me=_e.prototype;return me.code=function(te,ie,le){var pe=(ie||"").match(/\S*/)[0];if(this.options.highlight){var ye=this.options.highlight(te,pe);ye!=null&&ye!==te&&(le=!0,te=ye)}return pe?'<pre><code class="'+this.options.langPrefix+Fe(pe,!0)+'">'+(le?te:Fe(te,!0))+`</code></pre>
`:"<pre><code>"+(le?te:Fe(te,!0))+`</code></pre>
`},me.blockquote=function(te){return`<blockquote>
`+te+`</blockquote>
`},me.html=function(te){return te},me.heading=function(te,ie,le,pe){return this.options.headerIds?"<h"+ie+' id="'+this.options.headerPrefix+pe.slug(le)+'">'+te+"</h"+ie+`>
`:"<h"+ie+">"+te+"</h"+ie+`>
`},me.hr=function(){return this.options.xhtml?`<hr/>
`:`<hr>
`},me.list=function(te,ie,le){var pe=ie?"ol":"ul",ye=ie&&le!==1?' start="'+le+'"':"";return"<"+pe+ye+`>
`+te+"</"+pe+`>
`},me.listitem=function(te){return"<li>"+te+`</li>
`},me.checkbox=function(te){return"<input "+(te?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},me.paragraph=function(te){return"<p>"+te+`</p>
`},me.table=function(te,ie){return ie&&(ie="<tbody>"+ie+"</tbody>"),`<table>
<thead>
`+te+`</thead>
`+ie+`</table>
`},me.tablerow=function(te){return`<tr>
`+te+`</tr>
`},me.tablecell=function(te,ie){var le=ie.header?"th":"td",pe=ie.align?"<"+le+' align="'+ie.align+'">':"<"+le+">";return pe+te+"</"+le+`>
`},me.strong=function(te){return"<strong>"+te+"</strong>"},me.em=function(te){return"<em>"+te+"</em>"},me.codespan=function(te){return"<code>"+te+"</code>"},me.br=function(){return this.options.xhtml?"<br/>":"<br>"},me.del=function(te){return"<del>"+te+"</del>"},me.link=function(te,ie,le){if(te=Ke(this.options.sanitize,this.options.baseUrl,te),te===null)return le;var pe='<a href="'+Fe(te)+'"';return ie&&(pe+=' title="'+ie+'"'),pe+=">"+le+"</a>",pe},me.image=function(te,ie,le){if(te=Ke(this.options.sanitize,this.options.baseUrl,te),te===null)return le;var pe='<img src="'+te+'" alt="'+le+'"';return ie&&(pe+=' title="'+ie+'"'),pe+=this.options.xhtml?"/>":">",pe},me.text=function(te){return te},_e}(),Me=function(){function _e(){}var me=_e.prototype;return me.strong=function(te){return te},me.em=function(te){return te},me.codespan=function(te){return te},me.del=function(te){return te},me.html=function(te){return te},me.text=function(te){return te},me.link=function(te,ie,le){return""+le},me.image=function(te,ie,le){return""+le},me.br=function(){return""},_e}(),et=function(){function _e(){this.seen={}}var me=_e.prototype;return me.slug=function(te){var ie=te.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(ie)){var le=ie;do this.seen[le]++,ie=le+"-"+this.seen[le];while(this.seen.hasOwnProperty(ie))}return this.seen[ie]=0,ie},_e}(),Je=G.defaults,qe=V.unescape,Ze=function(){function _e(ve){this.options=ve||Je,this.options.renderer=this.options.renderer||new je,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Me,this.slugger=new et}_e.parse=function(te,ie){var le=new _e(ie);return le.parse(te)};var me=_e.prototype;return me.parse=function(te,ie){ie===void 0&&(ie=!0);var le="",pe,ye,Le,He,st,ct,ft,Ct,xt,ut,Bt,Pt,Jt,Yt,Rt,Ti,Bi,Qe,wt=te.length;for(pe=0;pe<wt;pe++){ut=te[pe];switch(ut.type){case"space":continue;case"hr":{le+=this.renderer.hr();continue}case"heading":{le+=this.renderer.heading(this.parseInline(ut.tokens),ut.depth,qe(this.parseInline(ut.tokens,this.textRenderer)),this.slugger);continue}case"code":{le+=this.renderer.code(ut.text,ut.lang,ut.escaped);continue}case"table":{for(Ct="",ft="",He=ut.header.length,ye=0;ye<He;ye++)ft+=this.renderer.tablecell(this.parseInline(ut.tokens.header[ye]),{header:!0,align:ut.align[ye]});for(Ct+=this.renderer.tablerow(ft),xt="",He=ut.cells.length,ye=0;ye<He;ye++){for(ct=ut.tokens.cells[ye],ft="",st=ct.length,Le=0;Le<st;Le++)ft+=this.renderer.tablecell(this.parseInline(ct[Le]),{header:!1,align:ut.align[Le]});xt+=this.renderer.tablerow(ft)}le+=this.renderer.table(Ct,xt);continue}case"blockquote":{xt=this.parse(ut.tokens),le+=this.renderer.blockquote(xt);continue}case"list":{for(Bt=ut.ordered,Pt=ut.start,Jt=ut.loose,He=ut.items.length,xt="",ye=0;ye<He;ye++)Rt=ut.items[ye],Ti=Rt.checked,Bi=Rt.task,Yt="",Rt.task&&(Qe=this.renderer.checkbox(Ti),Jt?Rt.tokens.length>0&&Rt.tokens[0].type==="text"?(Rt.tokens[0].text=Qe+" "+Rt.tokens[0].text,Rt.tokens[0].tokens&&Rt.tokens[0].tokens.length>0&&Rt.tokens[0].tokens[0].type==="text"&&(Rt.tokens[0].tokens[0].text=Qe+" "+Rt.tokens[0].tokens[0].text)):Rt.tokens.unshift({type:"text",text:Qe}):Yt+=Qe),Yt+=this.parse(Rt.tokens,Jt),xt+=this.renderer.listitem(Yt,Bi,Ti);le+=this.renderer.list(xt,Bt,Pt);continue}case"html":{le+=this.renderer.html(ut.text);continue}case"paragraph":{le+=this.renderer.paragraph(this.parseInline(ut.tokens));continue}case"text":{for(xt=ut.tokens?this.parseInline(ut.tokens):ut.text;pe+1<wt&&te[pe+1].type==="text";)ut=te[++pe],xt+=`
`+(ut.tokens?this.parseInline(ut.tokens):ut.text);le+=ie?this.renderer.paragraph(xt):xt;continue}default:{var Ot='Token with "'+ut.type+'" type was not found.';if(this.options.silent){console.error(Ot);return}else throw new Error(Ot)}}}return le},me.parseInline=function(te,ie){ie=ie||this.renderer;var le="",pe,ye,Le=te.length;for(pe=0;pe<Le;pe++){ye=te[pe];switch(ye.type){case"escape":{le+=ie.text(ye.text);break}case"html":{le+=ie.html(ye.text);break}case"link":{le+=ie.link(ye.href,ye.title,this.parseInline(ye.tokens,ie));break}case"image":{le+=ie.image(ye.href,ye.title,ye.text);break}case"strong":{le+=ie.strong(this.parseInline(ye.tokens,ie));break}case"em":{le+=ie.em(this.parseInline(ye.tokens,ie));break}case"codespan":{le+=ie.codespan(ye.text);break}case"br":{le+=ie.br();break}case"del":{le+=ie.del(this.parseInline(ye.tokens,ie));break}case"text":{le+=ie.text(ye.text);break}default:{var He='Token with "'+ye.type+'" type was not found.';if(this.options.silent){console.error(He);return}else throw new Error(He)}}}return le},_e}(),dt=V.merge,Xe=V.checkSanitizeDeprecation,Ye=V.escape,Ie=G.getDefaults,ot=G.changeDefaults,tt=G.defaults;function Re(_e,me,ve){if(typeof _e=="undefined"||_e===null)throw new Error("marked(): input parameter is undefined or null");if(typeof _e!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(_e)+", string expected");if(typeof me=="function"&&(ve=me,me=null),me=dt({},Re.defaults,me||{}),Xe(me),ve){var te=me.highlight,ie;try{ie=De.lex(_e,me)}catch(Le){return ve(Le)}var le=function(He){var st;if(!He)try{st=Ze.parse(ie,me)}catch(ct){He=ct}return me.highlight=te,He?ve(He):ve(null,st)};if(!te||te.length<3)return le();if(delete me.highlight,!ie.length)return le();var pe=0;Re.walkTokens(ie,function(Le){Le.type==="code"&&(pe++,setTimeout(function(){te(Le.text,Le.lang,function(He,st){if(He)return le(He);st!=null&&st!==Le.text&&(Le.text=st,Le.escaped=!0),pe--,pe===0&&le()})},0))}),pe===0&&le();return}try{var ye=De.lex(_e,me);return me.walkTokens&&Re.walkTokens(ye,me.walkTokens),Ze.parse(ye,me)}catch(Le){if(Le.message+=`
Please report this to https://github.com/markedjs/marked.`,me.silent)return"<p>An error occurred:</p><pre>"+Ye(Le.message+"",!0)+"</pre>";throw Le}}Re.options=Re.setOptions=function(_e){return dt(Re.defaults,_e),ot(Re.defaults),Re},Re.getDefaults=Ie,Re.defaults=tt,Re.use=function(_e){var me=dt({},_e);if(_e.renderer&&function(){var te=Re.defaults.renderer||new je,ie=function(ye){var Le=te[ye];te[ye]=function(){for(var He=arguments.length,st=new Array(He),ct=0;ct<He;ct++)st[ct]=arguments[ct];var ft=_e.renderer[ye].apply(te,st);return ft===!1&&(ft=Le.apply(te,st)),ft}};for(var le in _e.renderer)ie(le);me.renderer=te}(),_e.tokenizer&&function(){var te=Re.defaults.tokenizer||new Ee,ie=function(ye){var Le=te[ye];te[ye]=function(){for(var He=arguments.length,st=new Array(He),ct=0;ct<He;ct++)st[ct]=arguments[ct];var ft=_e.tokenizer[ye].apply(te,st);return ft===!1&&(ft=Le.apply(te,st)),ft}};for(var le in _e.tokenizer)ie(le);me.tokenizer=te}(),_e.walkTokens){var ve=Re.defaults.walkTokens;me.walkTokens=function(te){_e.walkTokens(te),ve&&ve(te)}}Re.setOptions(me)},Re.walkTokens=function(_e,me){for(var ve=F(_e),te;!(te=ve()).done;){var ie=te.value;me(ie);switch(ie.type){case"table":{for(var le=F(ie.tokens.header),pe;!(pe=le()).done;){var ye=pe.value;Re.walkTokens(ye,me)}for(var Le=F(ie.tokens.cells),He;!(He=Le()).done;)for(var st=He.value,ct=F(st),ft;!(ft=ct()).done;){var Ct=ft.value;Re.walkTokens(Ct,me)}break}case"list":{Re.walkTokens(ie.items,me);break}default:ie.tokens&&Re.walkTokens(ie.tokens,me)}}},Re.Parser=Ze,Re.parser=Ze.parse,Re.Renderer=je,Re.TextRenderer=Me,Re.Lexer=De,Re.lexer=De.lex,Re.Tokenizer=Ee,Re.Slugger=et,Re.parse=Re;var We=Re;return We})},ELLl:function(yt,at,ne){(function(oe){oe(ne("VrN/"))})(function(oe){var J={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},k=oe.Pos;oe.defineOption("autoCloseBrackets",!1,function(o,d,s){s&&s!=oe.Init&&(o.removeKeyMap(F),o.state.closeBrackets=null),d&&(B($(d,"pairs")),o.state.closeBrackets=d,o.addKeyMap(F))});function $(o,d){return d=="pairs"&&typeof o=="string"?o:typeof o=="object"&&o[d]!=null?o[d]:J[d]}var F={Backspace:D,Enter:I};function B(o){for(var d=0;d<o.length;d++){var s=o.charAt(d),a="'"+s+"'";F[a]||(F[a]=G(s))}}B(J.pairs+"`");function G(o){return function(d){return p(d,o)}}function H(o){var d=o.state.closeBrackets;if(!d||d.override)return d;var s=o.getModeAt(o.getCursor());return s.closeBrackets||d}function D(o){var d=H(o);if(!d||o.getOption("disableInput"))return oe.Pass;for(var s=$(d,"pairs"),a=o.listSelections(),l=0;l<a.length;l++){if(!a[l].empty())return oe.Pass;var c=f(o,a[l].head);if(!c||s.indexOf(c)%2!=0)return oe.Pass}for(var l=a.length-1;l>=0;l--){var R=a[l].head;o.replaceRange("",k(R.line,R.ch-1),k(R.line,R.ch+1),"+delete")}}function I(o){var d=H(o),s=d&&$(d,"explode");if(!s||o.getOption("disableInput"))return oe.Pass;for(var a=o.listSelections(),l=0;l<a.length;l++){if(!a[l].empty())return oe.Pass;var c=f(o,a[l].head);if(!c||s.indexOf(c)%2!=0)return oe.Pass}o.operation(function(){var R=o.lineSeparator()||`
`;o.replaceSelection(R+R,null),o.execCommand("goCharLeft"),a=o.listSelections();for(var w=0;w<a.length;w++){var x=a[w].head.line;o.indentLine(x,null,!0),o.indentLine(x+1,null,!0)}})}function g(o){var d=oe.cmpPos(o.anchor,o.head)>0;return{anchor:new k(o.anchor.line,o.anchor.ch+(d?-1:1)),head:new k(o.head.line,o.head.ch+(d?1:-1))}}function p(o,d){var s=H(o);if(!s||o.getOption("disableInput"))return oe.Pass;var a=$(s,"pairs"),l=a.indexOf(d);if(l==-1)return oe.Pass;for(var c=$(s,"closeBefore"),R=$(s,"triples"),w=a.charAt(l+1)==d,x=o.listSelections(),O=l%2==0,A,T=0;T<x.length;T++){var E=x[T],b=E.head,u,_=o.getRange(b,k(b.line,b.ch+1));if(O&&!E.empty())u="surround";else if((w||!O)&&_==d)w&&h(o,b)?u="both":R.indexOf(d)>=0&&o.getRange(b,k(b.line,b.ch+3))==d+d+d?u="skipThree":u="skip";else if(w&&b.ch>1&&R.indexOf(d)>=0&&o.getRange(k(b.line,b.ch-2),b)==d+d){if(b.ch>2&&/\bstring/.test(o.getTokenTypeAt(k(b.line,b.ch-2))))return oe.Pass;u="addFour"}else if(w){var m=b.ch==0?" ":o.getRange(k(b.line,b.ch-1),b);if(!oe.isWordChar(_)&&m!=d&&!oe.isWordChar(m))u="both";else return oe.Pass}else if(O&&(_.length===0||/\s/.test(_)||c.indexOf(_)>-1))u="both";else return oe.Pass;if(!A)A=u;else if(A!=u)return oe.Pass}var v=l%2?a.charAt(l-1):d,M=l%2?d:a.charAt(l+1);o.operation(function(){if(A=="skip")o.execCommand("goCharRight");else if(A=="skipThree")for(var P=0;P<3;P++)o.execCommand("goCharRight");else if(A=="surround"){for(var K=o.getSelections(),P=0;P<K.length;P++)K[P]=v+K[P]+M;o.replaceSelections(K,"around"),K=o.listSelections().slice();for(var P=0;P<K.length;P++)K[P]=g(K[P]);o.setSelections(K)}else A=="both"?(o.replaceSelection(v+M,null),o.triggerElectric(v+M),o.execCommand("goCharLeft")):A=="addFour"&&(o.replaceSelection(v+v+v+v,"before"),o.execCommand("goCharRight"))})}function f(o,d){var s=o.getRange(k(d.line,d.ch-1),k(d.line,d.ch+1));return s.length==2?s:null}function h(o,d){var s=o.getTokenAt(k(d.line,d.ch+1));return/\bstring/.test(s.type)&&s.start==d.ch&&(d.ch==0||!/\bstring/.test(o.getTokenTypeAt(d)))}})},HmJG:function(yt,at,ne){},LdHM:function(yt,at,ne){"use strict";ne.d(at,"b",function(){return c}),ne.d(at,"a",function(){return w});var oe=ne("1OyB"),J=ne("vuIU"),k=ne("Ji7U"),$=ne("LK+K"),F=ne("q1tI"),B=ne("rePB"),G=ne("Ff2n"),H=ne("ODXe"),D=ne("4IlW"),I=ne("bX4T"),g=ne("YrtM"),p=ne("TSYQ"),f=ne.n(p),h=ne("+nKL"),o=ne("8OUc"),d=function(X,ee){var ae=X.prefixCls,de=X.id,Ae=X.flattenOptions,Ee=X.childrenAsData,we=X.values,he=X.searchValue,ce=X.multiple,se=X.defaultActiveFirstOption,re=X.height,xe=X.itemHeight,be=X.notFoundContent,ke=X.open,Oe=X.menuItemSelectedIcon,Be=X.virtual,Ce=X.onSelect,De=X.onToggleOpen,Ne=X.onActiveValue,Ke=X.onScroll,Fe=X.onMouseEnter,je="".concat(ae,"-item"),Me=Object(g.a)(function(){return Ae},[ke,Ae],function(We,_e){return _e[0]&&We[1]!==_e[1]}),et=F.useRef(null),Je=function(_e){_e.preventDefault()},qe=function(_e){et.current&&et.current.scrollTo({index:_e})},Ze=function(_e){for(var me=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,ve=Me.length,te=0;te<ve;te+=1){var ie=(_e+te*me+ve)%ve,le=Me[ie],pe=le.group,ye=le.data;if(!pe&&!ye.disabled)return ie}return-1},dt=F.useState(function(){return Ze(0)}),Xe=Object(H.a)(dt,2),Ye=Xe[0],Ie=Xe[1],ot=function(_e){Ie(_e);var me=Me[_e];if(!me){Ne(null,-1);return}Ne(me.data.value,_e)};F.useEffect(function(){ot(se!==!1?Ze(0):-1)},[Me.length,he]),F.useEffect(function(){var We=setTimeout(function(){if(!ce&&ke&&we.size===1){var _e=Array.from(we)[0],me=Me.findIndex(function(ve){var te=ve.data;return te.value===_e});ot(me),qe(me)}});return function(){return clearTimeout(We)}},[ke]);var tt=function(_e){_e!==void 0&&Ce(_e,{selected:!we.has(_e)}),ce||De(!1)};if(F.useImperativeHandle(ee,function(){return{onKeyDown:function(_e){var me=_e.which;switch(me){case D.a.UP:case D.a.DOWN:{var ve=0;if(me===D.a.UP?ve=-1:me===D.a.DOWN&&(ve=1),ve!==0){var te=Ze(Ye+ve,ve);qe(te),ot(te)}break}case D.a.ENTER:{var ie=Me[Ye];ie&&!ie.data.disabled?tt(ie.data.value):tt(void 0),ke&&_e.preventDefault();break}case D.a.ESC:De(!1)}},onKeyUp:function(){},scrollTo:function(_e){qe(_e)}}}),Me.length===0)return F.createElement("div",{role:"listbox",id:"".concat(de,"_list"),className:"".concat(je,"-empty"),onMouseDown:Je},be);function Re(We){var _e=Me[We];if(!_e)return null;var me=_e.data||{},ve=me.value,te=me.label,ie=me.children,le=Object(I.a)(me,!0),pe=Ee?ie:te;return _e?F.createElement("div",Object.assign({"aria-label":typeof pe=="string"?pe:null},le,{key:We,role:"option",id:"".concat(de,"_list_").concat(We),"aria-selected":we.has(ve)}),ve):null}return F.createElement(F.Fragment,null,F.createElement("div",{role:"listbox",id:"".concat(de,"_list"),style:{height:0,width:0,overflow:"hidden"}},Re(Ye-1),Re(Ye),Re(Ye+1)),F.createElement(h.a,{itemKey:"key",ref:et,data:Me,height:re,itemHeight:xe,fullHeight:!1,onMouseDown:Je,onScroll:Ke,virtual:Be,onMouseEnter:Fe},function(We,_e){var me,ve=We.group,te=We.groupOption,ie=We.data,le=ie.label,pe=ie.key;if(ve)return F.createElement("div",{className:f()(je,"".concat(je,"-group"))},le!==void 0?le:pe);var ye=ie.disabled,Le=ie.value,He=ie.title,st=ie.children,ct=ie.style,ft=ie.className,Ct=Object(G.a)(ie,["disabled","value","title","children","style","className"]),xt=we.has(Le),ut="".concat(je,"-option"),Bt=f()(je,ut,ft,(me={},Object(B.a)(me,"".concat(ut,"-grouped"),te),Object(B.a)(me,"".concat(ut,"-active"),Ye===_e&&!ye),Object(B.a)(me,"".concat(ut,"-disabled"),ye),Object(B.a)(me,"".concat(ut,"-selected"),xt),me)),Pt=Ee?st:le,Jt=!Oe||typeof Oe=="function"||xt;return F.createElement("div",Object.assign({},Ct,{"aria-selected":xt,className:Bt,title:He,onMouseMove:function(){if(Ye===_e||ye)return;ot(_e)},onClick:function(){ye||tt(Le)},style:ct}),F.createElement("div",{className:"".concat(ut,"-content")},Pt||Le),F.isValidElement(Oe)||xt,Jt&&F.createElement(o.a,{className:"".concat(je,"-option-state"),customizeIcon:Oe,customizeIconProps:{isSelected:xt}},xt?"\u2713":null))}))},s=F.forwardRef(d);s.displayName="OptionList";var a=s,l=function(){return null};l.isSelectOption=!0;var c=l,R=function(){return null};R.isSelectOptGroup=!0;var w=R,x=ne("VTBJ"),O=ne("Zm9Q");function A(S){var X=S.key,ee=S.props,ae=ee.children,de=ee.value,Ae=Object(G.a)(ee,["children","value"]);return Object(x.a)({key:X,value:de!==void 0?de:X,children:ae},Ae)}function T(S){var X=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(O.a)(S).map(function(ee,ae){if(!F.isValidElement(ee)||!ee.type)return null;var de=ee.type.isSelectOptGroup,Ae=ee.key,Ee=ee.props,we=Ee.children,he=Object(G.a)(Ee,["children"]);return X||!de?A(ee):Object(x.a)(Object(x.a)({key:"__RC_SELECT_GRP__".concat(Ae===null?ae:Ae,"__"),label:Ae},he),{},{options:T(we)})}).filter(function(ee){return ee})}var E=ne("2Qr1"),b=ne("qNPg"),u=ne("U8pU"),_=ne("Kwbf"),m=ne("WKfj");function v(S){var X=S.mode,ee=S.options,ae=S.children,de=S.backfill,Ae=S.allowClear,Ee=S.placeholder,we=S.getInputElement,he=S.showSearch,ce=S.onSearch,se=S.defaultOpen,re=S.autoFocus,xe=S.labelInValue,be=S.value,ke=S.inputValue,Oe=S.optionLabelProp,Be=X==="multiple"||X==="tags",Ce=he!==void 0?he:Be||X==="combobox",De=ee||T(ae);if(Object(_.a)(X!=="tags"||De.every(function(je){return!je.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),X==="tags"||X==="combobox"){var Ne=De.some(function(je){return je.options?je.options.some(function(Me){return typeof("value"in Me?Me.value:Me.key)=="number"}):typeof("value"in je?je.value:je.key)=="number"});Object(_.a)(!Ne,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(_.a)(X!=="combobox"||!Oe,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(_.a)(X==="combobox"||!de,"`backfill` only works with `combobox` mode."),Object(_.a)(X==="combobox"||!we,"`getInputElement` only work with `combobox` mode."),Object(_.b)(X!=="combobox"||!we||!Ae||!Ee,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),ce&&!Ce&&X!=="combobox"&&X!=="tags"&&Object(_.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(_.b)(!se||re,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),be!=null){var Ke=Object(m.d)(be);Object(_.a)(!xe||Ke.every(function(je){return Object(u.a)(je)==="object"&&("key"in je||"value"in je)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(_.a)(!Be||Array.isArray(be),"`value` should be array when `mode` is `multiple` or `tags`")}if(ae){var Fe=null;Object(O.a)(ae).some(function(je){if(!F.isValidElement(je)||!je.type)return!1;var Me=je.type;if(Me.isSelectOption)return!1;if(Me.isSelectOptGroup){var et=Object(O.a)(je.props.children).every(function(Je){return!F.isValidElement(Je)||!je.type||Je.type.isSelectOption?!0:(Fe=Je.type,!1)});return!et}return Fe=Me,!0}),Fe&&Object(_.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(Fe.displayName||Fe.name||Fe,"`.")),Object(_.a)(ke===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var M=v,P=Object(b.a)({prefixCls:"rc-select",components:{optionList:a},convertChildrenToData:T,flattenOptions:E.d,getLabeledValue:E.e,filterOptions:E.b,isValueDisabled:E.g,findValueOption:E.c,warningProps:M,fillOptionsWithMissingValue:E.a}),K=function(S){Object(k.a)(ee,S);var X=Object($.a)(ee);function ee(){var ae;return Object(oe.a)(this,ee),ae=X.apply(this,arguments),ae.selectRef=F.createRef(),ae.focus=function(){ae.selectRef.current.focus()},ae.blur=function(){ae.selectRef.current.blur()},ae}return Object(J.a)(ee,[{key:"render",value:function(){return F.createElement(P,Object.assign({ref:this.selectRef},this.props))}}]),ee}(F.Component);K.Option=c,K.OptGroup=w;var V=K,U=at.c=V},M8RZ:function(yt,at,ne){"use strict";ne.d(at,"a",function(){return D});var oe=ne("fWQN"),J=ne("mtLc"),k=ne("yKVA"),$=ne("879j"),F=ne("q1tI"),B=ne.n(F),G=ne("i8i4"),H=ne.n(G),D=function(I){Object(k.a)(p,I);var g=Object($.a)(p);function p(f){var h;Object(oe.a)(this,p),h=g.call(this,f);var o=window.document;return h.node=o.createElement("div"),o.body.appendChild(h.node),h}return Object(J.a)(p,[{key:"render",value:function(){var h=this.props.children;return Object(G.createPortal)(h,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),p}(B.a.Component)},Ot1p:function(yt,at,ne){"use strict";var oe=ne("2qtc"),J=ne("kLXV"),k=ne("rAM+"),$=ne("miYZ"),F=ne("tsqr"),B=ne("9og8"),G=ne("tJVT"),H=ne("jrin"),D=ne("WmNS"),I=ne.n(D),g=ne("q1tI"),p=ne.n(g),f=ne("VrN/"),h=ne.n(f),o=ne("bdgK"),d=ne("p77/"),s=ne("Bd2K"),a=ne("ELLl"),l=ne("19Vz"),c=ne("lZu9"),R=ne("+NIl"),w=ne("kSUc"),x=ne("9Bee"),O=function(ye){var Le=ye.value,He=Le===void 0?"":Le,st=ye.className,ct=ye.showTextOnly,ft=ye.showLines,Ct=ye.style,xt=Ct===void 0?{}:Ct,ut=Object(g.useMemo)(function(){return""},[He]);return p.a.createElement(p.a.Fragment,null,p.a.createElement("div",{dangerouslySetInnerHTML:{__html:ut}}))},A=ne("0Owb"),T=ne("dejd"),E=ne("C+DQ"),b=ne("1vsH"),u=ne("m3rI"),_=[{title:"\u7C97\u4F53",icon:"icon-bold",actionName:"bold"},{title:"\u659C\u4F53",icon:"icon-italic",actionName:"italic"},"|",{title:"\u65E0\u5E8F\u5217\u8868",icon:"icon-unorder-list",actionName:"list-ul"},{title:"\u6709\u5E8F\u5217\u8868",icon:"icon-order-list",actionName:"list-ol"},"|",{title:"\u884C\u5185\u4EE3\u7801",icon:"icon-code",actionName:"code"},{title:"\u4EE3\u7801\u5757\uFF08\u591A\u8BED\u8A00\u98CE\u683C\uFF09",icon:"icon-file-code",actionName:"code-block"},{title:"\u94FE\u63A5",icon:"icon-link",actionName:"link"},"|",{title:"\u884C\u5185\u516C\u5F0F",icon:"icon-sum",actionName:"inline-latex"},{title:"\u591A\u884C\u516C\u5F0F",icon:"icon-formula",actionName:"latex"},"|",{title:"\u6DFB\u52A0\u56FE\u7247",icon:"icon-picture",actionName:"upload-image"},{title:"\u8868\u683C",icon:"icon-table",actionName:"add-table"},"|",{title:"\u6362\u884C",icon:"icon-minus",actionName:"line-break"},{title:"\u6E05\u7A7A",icon:"icon-eraser",actionName:"eraser"}];function m(ye){var Le=ye.onActionCallback,He=ye.title,st=ye.icon,ct=ye.actionName,ft=ye.className,Ct=ft===void 0?"":ft,xt=ye.children;function ut(){Le(ct)}return p.a.createElement("a",{title:He,className:Ct,onClick:ut},p.a.createElement("i",{className:"md-iconfont ".concat(st)}),xt)}var v=function(ye){var Le=ye.watch,He=ye.showNullButton,st=ye.onActionCallback,ct=ye.fullScreen,ft=ye.insertTemp,Ct=ye.hidetoolBar,xt=ye.uuid,ut=ye.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(b.F)("_educoder_session_login"),"&_educoder_session=").concat(Object(b.F)("_educoder_session"),"&key=").concat(xt,"&api=").concat(encodeURIComponent(u.a.PROXY_SERVER)));var Bt=[].concat(_,[{title:"".concat(Le?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(Le?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return p.a.createElement("ul",{className:"markdown-toolbar-container"},!Ct&&Bt.map(function(Pt,Jt){return p.a.createElement("li",{key:Jt},Pt.actionName?p.a.createElement(m,Object(A.a)({},Pt,{onActionCallback:st})):p.a.createElement("span",{className:"v-line"}))}),He?p.a.createElement("li",null,p.a.createElement(m,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:st},p.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,ft&&p.a.createElement("li",null,p.a.createElement(m,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(ft),onActionCallback:st},p.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),p.a.createElement("li",{className:"btn-full-screen"},p.a.createElement(m,{icon:"".concat(ct?"icon-shrink":"icon-enlarge"),title:ct?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:st})))},M=ne("M8RZ"),P=ne("+L6B"),K=ne("2/Rp"),V=ne("y8nQ"),U=ne("Vl3Y"),S=ne("5NDa"),X=ne("5rEg"),ee={labelCol:{span:4},wrapperCol:{span:20}},ae=function(ye){var Le=ye.callback,He=ye.onCancel;function st(ct){Le(ct)}return p.a.createElement(U.a,Object(A.a)({},ee,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:st}),p.a.createElement(U.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},p.a.createElement(X.a,null)),p.a.createElement(U.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},p.a.createElement(X.a,null)),p.a.createElement("div",{className:"flex-container flex-end"},p.a.createElement(K.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),p.a.createElement(K.a,{type:"ghost",onClick:He},"\u53D6\u6D88")))},de=ne("7ahc"),Ae=ne("HmJG"),Ee=ne("BjJ7"),we=U.a.useForm,he={width:280,marginRight:10},ce={labelCol:{span:5},wrapperCol:{span:19}},se=function(ye){var Le=ye.callback,He=ye.onCancel,st=we(),ct=Object(G.a)(st,1),ft=ct[0];function Ct(Bt){Le(Bt)}function xt(Bt,Pt){if(Bt.status===-1){F.b.error(Bt.message);return}ft.setFieldsValue({src:"/api/attachments/".concat(Bt.id),type:Pt.type})}function ut(Bt){var Pt=Bt.target.files[0];xe(Pt,xt)}return p.a.createElement(U.a,Object(A.a)({form:ft},ce,{className:"upload-image-panel",onFinish:Ct}),p.a.createElement(U.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},p.a.createElement("div",{className:"flex-container"},p.a.createElement(U.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},p.a.createElement(X.a,{style:he})),p.a.createElement(re,{onFileChange:ut}))),p.a.createElement(U.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt"},p.a.createElement(X.a,{style:{width:264}})),p.a.createElement(U.a.Item,{style:{textAlign:"right"}},p.a.createElement(K.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),p.a.createElement(K.a,{type:"ghost",onClick:He},"\u53D6\u6D88")))};function re(ye){var Le=ye.onFileChange;return p.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",p.a.createElement("input",{type:"file",onChange:Le}))}function xe(ye,Le){if(!ye)throw new String("\u6CA1\u6709\u6587\u4EF6");var He=new FormData;He.append("editormd-image-file",ye),He.append("file_param_name","editormd-image-file"),He.append("byxhr","true");var st=new window.XMLHttpRequest;st.withCredentials=!0,st.addEventListener("load",function(ct){Le(JSON.parse(ct.target.responseText),ye)},!1),st.addEventListener("error",function(ct){console.error(ct)},!1),st.open("POST","".concat(Ee.a,"/api/attachments.json")),st.send(He)}var be=ne("giR+"),ke=ne("fyUT"),Oe=ne("7Kak"),Be=ne("9yH6"),Ce=Be.a.Group,De={margin:"0 8px"},Ne=function(ye){var Le=ye.callback,He=ye.onCancel;function st(ct){Le(ct)}return p.a.createElement(U.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:st},p.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},p.a.createElement("span",{style:De},"\u5355\u5143\u683C\u6570\uFF1A"),p.a.createElement("span",{style:De},"\u884C\u6570"),p.a.createElement(U.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},p.a.createElement(ke.a,null)),p.a.createElement("span",{style:De},"\u5217\u6570"),p.a.createElement(U.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},p.a.createElement(ke.a,null))),p.a.createElement("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"}},p.a.createElement("span",{style:De},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),p.a.createElement(U.a.Item,{name:"align"},p.a.createElement(Ce,null,p.a.createElement(Be.a,{value:"default"},p.a.createElement("i",{className:"fa fa-align-justify"})),p.a.createElement(Be.a,{value:"left"},p.a.createElement("i",{className:"fa fa-align-left"})),p.a.createElement(Be.a,{value:"center"},p.a.createElement("i",{className:"fa fa-align-center"})),p.a.createElement(Be.a,{value:"right"},p.a.createElement("i",{className:"fa fa-align-right"}))))),p.a.createElement("div",{className:"flex-container flex-end"},p.a.createElement(K.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),p.a.createElement(K.a,{type:"ghost",onClick:He},"\u53D6\u6D88")))},Ke=ne("ErOA"),Fe=ne("7Cbv"),je="link",Me="upload-image",et="code-block",Je="add-table",qe="------------",Ze={default:qe,left:":".concat(qe),center:":".concat(qe,":"),right:"".concat(qe,":")},dt=ne("9VGf"),Xe,Ye;function Ie(){}var ot=0,tt=1e4,Re="\u2581",We=`
**\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 _e(ye){return/^\d+$/.test(ye)?"".concat(ye,"px"):ye}var me=navigator.platform.toUpperCase().indexOf("MAC")>=0,ve=me?"Cmd":"Ctrl",te=["pptm","pptx","ppt","pot","pps","ppa","potx","ppsx","ppam","pptm","potm","ppsm","doc","docx","dot","dotx","docm","dotm","xls","xlsx","csv","xlt","xla","xltx","xlsm","xltm","xlam","xlsb"],ie=(Xe={},Object(H.a)(Xe,ve+"-B","bold"),Object(H.a)(Xe,ve+"-I","italic"),Xe),le=(Ye={},Object(H.a)(Ye,je,"\u6DFB\u52A0\u94FE\u63A5"),Object(H.a)(Ye,et,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(H.a)(Ye,Me,"\u6DFB\u52A0\u6587\u4EF6"),Object(H.a)(Ye,Je,"\u6DFB\u52A0\u8868\u683C"),Ye),pe=at.a=function(ye){var Le=ye.defaultValue,He=Le===void 0?"":Le,st=ye.onChange,ct=ye.width,ft=ct===void 0?"100%":ct,Ct=ye.height,xt=Ct===void 0?400:Ct,ut=ye.miniToolbar,Bt=ut===void 0?!1:ut,Pt=ye.isFocus,Jt=Pt===void 0?!1:Pt,Yt=ye.watch,Rt=ye.insertTemp,Ti=ye.mode,Bi=Ti===void 0?"markdown":Ti,Qe=ye.id,wt=Qe===void 0?"markdown-editor-id":Qe,Ot=ye.showResizeBar,Lt=Ot===void 0?!1:Ot,qt=ye.noStorage,qi=qt===void 0?!1:qt,er=ye.showNullButton,Ut=er===void 0?!1:er,pt=ye.hidetoolBar,Gi=pt===void 0?!1:pt,tr=ye.fullScreen,vi=tr===void 0?!1:tr,kt=ye.onBlur,Ui=ye.onCMBeforeChange,Vi=ye.onFullScreen,fr=ye.className,Ve=fr===void 0?"":fr,Tt=ye.disablePaste,pr=Tt===void 0?!1:Tt,mr=ye.placeholder,gr=mr===void 0?"":mr,vr=ye.values,z=vr===void 0?"":vr,y=Object(g.useState)(null),C=Object(G.a)(y,2),N=C[0],Z=C[1],W=Object(g.useState)(He),ge=Object(G.a)(W,2),Ue=ge[0],it=ge[1],mt=Object(g.useState)(Yt),Ge=Object(G.a)(mt,2),bt=Ge[0],Ht=Ge[1],$t=Object(g.useState)(vi),Mi=Object(G.a)($t,2),yi=Mi[0],bi=Mi[1],Xi=Object(g.useState)(""),Ir=Object(G.a)(Xi,2),li=Ir[0],Hi=Ir[1],or=Object(g.useState)(0),lr=Object(G.a)(or,2),Pi=lr[0],kr=lr[1],yr=Object(g.useState)(xt),zr=Object(G.a)(yr,2),Kr=zr[0],Yi=zr[1],zi=Object(g.useState)(!1),br=Object(G.a)(zi,2),dn=br[0],_r=br[1],ti=Object(g.useRef)(Object(Fe.a)()),jt=Object(g.useRef)(!1),pi=Object(g.useRef)(),Dt=Object(g.useRef)(),ri=Object(g.useRef)(),zt=Object(g.useRef)(),ir=Object(g.useRef)(),ui=function(){var gt=Object(B.a)(I.a.mark(function St(){var _t,It;return I.a.wrap(function(Vt){for(;;)switch(Vt.prev=Vt.next){case 0:return Vt.next=2,Object(Ke.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:ti.current}});case 2:It=Vt.sent,It!=null&&(_t=It.attachments)!==null&&_t!==void 0&&_t.length&&(console.log("cm:",N,Dt),It.attachments.map(function(Nt){Nt.content_type.indexOf("image")>-1?N.replaceSelection("![,](/api/attachments/".concat(Nt.id,"?type=").concat(Nt.content_type,")")):Nt.content_type.indexOf("video")>-1?N.replaceSelection('<video width="100%" controls src="'.concat(u.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):Nt.content_type.indexOf("pdf")>-1?N.replaceSelection('<a href="'.concat(u.a.API_SERVER,"/api/attachments/").concat(Nt.id,"?type=").concat(Nt.content_type,'&disposition=inline" target="_blank">').concat(Nt.name,"</a>")):N.replaceSelection("[".concat(Nt.name,"](").concat(u.a.API_SERVER,"/api/attachments/").concat(Nt.id,"?type=").concat(Nt.content_type,")"))}));case 4:case"end":return Vt.stop()}},St)}));return function(){return gt.apply(this,arguments)}}();Object(g.useEffect)(function(){it(z),N==null||N.setValue(z)},[z]),Object(g.useEffect)(function(){Vi==null||Vi(yi)},[yi]),Object(g.useEffect)(function(){if(Dt.current){var gt=h.a.fromTextArea(Dt.current,{mode:Bi,lineNumbers:!Bt,lineWrapping:!0,value:He,autoCloseTags:!0,autoCloseBrackets:!0});Jt&&gt.focus();function St(_t,It){if(pr){It.preventDefault();return}var Ft=It.clipboardData;if(Ft){var Vt=Ft.types.toString(),Nt=Ft.items;if(Vt==="Files"||Ft.types.indexOf("Files")>-1){if(It.preventDefault(),Bi=="stex")return;try{var si,Ai=Nt[1];((si=Nt[0])===null||si===void 0?void 0:si.kind)==="file"&&(Ai=Nt[0]);var Mt=Ai.getAsFile(),ur=Mt.name.split(".").pop();xe(Mt,function(Wt){if(Wt.id){var Oi,_i,Ki;(Mt==null||((Oi=Mt.type)===null||Oi===void 0)?void 0:Oi.indexOf("image"))>-1?gt.replaceSelection("![,](/api/attachments/".concat(Wt.id,"?type=").concat(Wt.content_type,")")):(Mt==null||((_i=Mt.type)===null||_i===void 0)?void 0:_i.indexOf("video"))>-1?gt.replaceSelection('<video width="100%" controls src="'.concat(u.a.API_SERVER,"/api/attachments/").concat(Wt.id,'"></video>')):(Mt==null||((Ki=Mt.type)===null||Ki===void 0)?void 0:Ki.indexOf("pdf"))>-1?gt.replaceSelection('<a href="'.concat(u.a.API_SERVER,"/api/attachments/").concat(Wt.id,"?type=").concat(Mt.type,'&disposition=inline" target="_blank">').concat(Mt.name,"</a>")):te.includes(ur)?gt.replaceSelection('<a href="'.concat(u.a.API_SERVER,"/api/attachments/").concat(Wt.id,'?type=office&disposition=inline" target="_blank">').concat(Mt.name,"</a>")):gt.replaceSelection("[".concat(Mt.name,"](").concat(u.a.API_SERVER,"/api/attachments/").concat(Wt.id,"?type=").concat(Wt.content_type,")"))}else(Wt==null?void 0:Wt.status)===401&&(document.location.href="/user/login")})}catch(Wt){F.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return gt.on("paste",St),gt.on("dragleave",function(_t,It){ri.current.classList.remove("mouse-hover-md")}),gt.on("dragover",function(_t,It){ri.current.classList.add("mouse-hover-md")}),gt.on("drop",function(_t,It){ri.current.classList.add("mouse-hover-md");var Ft;if(Ft=It.dataTransfer.files,Ft.length>0){It.preventDefault(),It.stopPropagation();for(var Vt=function(Ai){var Mt=Ft[Ai],ur=Mt.name.split(".").pop();xe(Mt,function(Wt){if(Wt.id){var Oi,_i,Ki;(Mt==null||((Oi=Mt.type)===null||Oi===void 0)?void 0:Oi.indexOf("image"))>-1?gt.replaceSelection("![,](/api/attachments/".concat(Wt.id,"?type=").concat(Wt.content_type,")")):(Mt==null||((_i=Mt.type)===null||_i===void 0)?void 0:_i.indexOf("video"))>-1?gt.replaceSelection('<video width="100%" controls src="'.concat(u.a.API_SERVER,"/api/attachments/").concat(Wt.id,'"></video>')):(Mt==null||((Ki=Mt.type)===null||Ki===void 0)?void 0:Ki.indexOf("pdf"))>-1?gt.replaceSelection('<a href="'.concat(u.a.API_SERVER,"/api/attachments/").concat(Wt.id,"?type=").concat(Mt.type,'&disposition=inline" target="_blank">').concat(Mt.name,"</a>")):te.includes(ur)?gt.replaceSelection('<a href="'.concat(u.a.API_SERVER,"/api/attachments/").concat(Wt.id,'?type=office&disposition=inline" target="_blank">').concat(Mt.name,"</a>")):gt.replaceSelection("[".concat(Mt.name,"](").concat(u.a.API_SERVER,"/api/attachments/").concat(Wt.id,"?type=").concat(Wt.content_type,")"))}else(Wt==null?void 0:Wt.status)===401&&(document.location.href="/user/login")})},Nt=0;Nt<Ft.length;Nt++)Vt(Nt)}}),Z(gt),function(){gt.off("paste",St)}}},[]);var wi=Object(g.useCallback)(function(){if(ri.current)try{}catch(gt){console.log(gt,"---- to set md editor body height")}},[Kr,ri,yi]);Object(g.useEffect)(function(){function gt(){var _t=new o.default(function(It){var Ft=Object(k.a)(It),Vt;try{for(Ft.s();!(Vt=Ft.n()).done;){var Nt=Vt.value;(Nt.target.offsetHeight>0||Nt.target.offsetWidth>0)&&(wi(),N.setSize("100%","100%"),N.refresh())}}catch(si){Ft.e(si)}finally{Ft.f()}});return _t.observe(Dt.current.parentElement),_t}if(N){var St=gt();return function(){St.unobserve(Dt.current.parentElement)}}},[N,wi]),Object(g.useEffect)(function(){if(N){for(var gt=[],St=function(){var Nt=It[_t];Ft=Object(G.a)(Nt,2);var si=Ft[0],Ai=Ft[1],Mt=Object(H.a)({},si,function(){Vr(Ai)});gt.push(Mt),N.addKeyMap(Mt)},_t=0,It=Object.entries(ie);_t<It.length;_t++){var Ft;St()}return pi.current=setInterval(function(){jt.current&&ui()},4e3),function(){clearInterval(pi.current);var Vt=Object(k.a)(gt),Nt;try{for(Vt.s();!(Nt=Vt.n()).done;){var si=Nt.value;N.removeKeyMap(si)}}catch(Ai){Vt.e(Ai)}finally{Vt.f()}}}},[N]),Object(g.useEffect)(function(){vi!==yi&&bi(vi)},[vi]),Object(dt.a)(function(){if(!qi&&Pi>0){var gt=new Date().getTime(),St=window.sessionStorage.getItem(wt);gt>=Pi+tt&&(!St||St!==Ue)&&(window.sessionStorage.setItem(wt,Ue),_r(!0))}},tt),Object(g.useEffect)(function(){Ht(Yt)},[N,Yt]),Object(g.useEffect)(function(){N&&(Jt&&N.focus())},[N,Jt]),Object(g.useEffect)(function(){if(bt&&N){var gt=N.getScrollerElement();function St(_t){var It=_t.target;if(ir.current){var Ft=It.scrollTop/It.scrollHeight;ir.current.scrollTop=ir.current.scrollHeight*Ft}}return gt.addEventListener("scroll",St),function(){gt.removeEventListener("scroll",St)}}},[N,bt]),Object(g.useEffect)(function(){if(N&&Ui){function gt(St,_t){Ui(St,_t)}return N.on("beforeChange",gt),function(){N.off("beforeChange",gt)}}},[N,Ui]),Object(g.useEffect)(function(){if(N&&kt){function gt(){kt(N.getValue())}return N.on("blur",gt),function(){N.off("blur",gt)}}},[N,kt]),Object(g.useEffect)(function(){if(N){function gt(St){var _t=St.getValue();it(_t),kr(new Date().getTime()),St.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),st&&st(_t)}return N.on("change",gt),function(){N.off("change",gt)}}},[N,st]),Object(g.useEffect)(function(){N&&(He==null?(N.setValue(""),it("")):He!==N.getValue()&&(N.setValue(He),it(He),N.setCursor(N.lineCount(),0)))},[N,He]);var Vr=Object(g.useCallback)(function(gt){var St=N.getCursor(),_t=N.getSelection(),It=_t.split(`
`);switch(gt){case"bold":return N.replaceSelection("**"+_t+"**"),_t===""&&N.setCursor(St.line,St.ch+2),N.focus();case"italic":return N.replaceSelection("*"+_t+"*"),_t===""&&N.setCursor(St.line,St.ch+1),N.focus();case"code":return N.replaceSelection("`"+_t+"`"),_t===""&&N.setCursor(St.line,St.ch+1),N.focus();case"inline-latex":return N.replaceSelection("`$$"+_t+"$$`"),_t===""&&N.setCursor(St.line,St.ch+3),N.focus();case"latex":return N.replaceSelection("```latex\n"+_t+"\n```"),N.setCursor(St.line+1,_t.length+1),N.focus();case"line-break":return N.replaceSelection(`<br/>
`),N.focus();case"list-ul":return _t===""?N.replaceSelection("- "+_t):N.replaceSelection(It.map(function(Ft){return Ft===""?"":"- ".concat(Ft)}).join(`
`)),N.focus();case"list-ol":return _t===""?N.replaceSelection("1. "+_t):N.replaceSelection(It.map(function(Ft,Vt){return Ft===""?"":"".concat(Vt+1,". ").concat(Ft)}).join(`
`)),N.focus();case"add-null-ch":return _t===""&&N.setCursor(St.line,St.ch+1),N.replaceSelection(Re),N.focus();case"inster-template-1":return _t===""&&N.setCursor(St.line,St.ch),N.replaceSelection(We),N.focus();case"eraser":return N.setValue(""),N.focus();case"trigger-watch":return Ht(!bt),N.focus();case"trigger-full-screen":return bi(!yi),N.focus();case je:Hi(je);return;case et:Hi(et);return;case Me:Hi(Me);return;case Je:Hi(Je);return;default:throw new Error}},[N,bt,yi]),Er=Object(g.useCallback)(function(gt){Hi("");switch(li){case je:var St=gt.title,_t=gt.link;return N.replaceSelection("[".concat(St,"](").concat(_t,")")),N.focus();case et:var It=gt.language,Ft=gt.content;return N.replaceSelection(["```"+It,Ft,"```"].join(`
`)),N.focus();case Me:var Vt=gt.src,Nt=gt.alt;return Nt?N.replaceSelection("![ ".concat(Nt," ]( ").concat(Vt,' "').concat(Nt,'" )')):N.replaceSelection("![,](".concat(Vt,")")),N.focus();case Je:for(var si=gt.row,Ai=gt.col,Mt=gt.align,ur=`
`,Wt=0;Wt<si;Wt++){for(var Oi=[],_i=[],Ki=0;Ki<Ai;Ki++)Wt===1&&_i.push(Ze[Mt]),Oi.push(" ");Wt===1&&(ur+="| ".concat(_i.join(" | "),` |
`)),ur+="| ".concat(Oi.join(Ai===1?"":" | "),` |
`)}return N.replaceSelection(ur+`
`),N.focus();default:throw new Error}},[N,li]),cn=Object(g.useMemo)(function(){switch(li){case je:return p.a.createElement(ae,{callback:Er,onCancel:xr});case et:return p.a.createElement(de.b,{callback:Er,onCancel:xr});case Me:return p.a.createElement(se,{callback:Er,onCancel:xr});case Je:return p.a.createElement(Ne,{callback:Er,onCancel:xr});default:return null}},[li]);function xr(){Hi("")}Object(g.useEffect)(function(){if(zt.current){var gt=zt.current,St=!1,_t=0;function It(Nt){St=!0,_t=Nt.pageY}function Ft(){St=!1}function Vt(Nt){if(St){var si=Nt.pageY-_t;si<0&&(si=0),si>300&&(si=300);var Ai=xt+si+"px";Yi(Ai)}}return gt.addEventListener("mousedown",It),document.addEventListener("mousemove",Vt),document.addEventListener("mouseup",Ft),function(){gt.removeEventListener("mousedown",It),document.removeEventListener("mousemove",Vt),document.removeEventListener("mouseup",Ft)}}},[N,zt]),Object(g.useEffect)(function(){Yi(xt)},[xt]);var rr=_e(ft),fn=_e(Kr),$i={width:rr,height:fn},pn=Object(g.useMemo)(function(){if(Pi){var gt=new Date(Pi),St=gt.getHours(),_t=gt.getMinutes(),It=gt.getSeconds();return St=St<10?"0"+St:St,_t=_t<10?"0"+_t:_t,It=It<10?"0"+It:It,"".concat(St,":").concat(_t,":").concat(It)}return 0},[Pi]);function Hn(){window.sessionStorage.removeItem(wt),_r(!1),kr(0)}function Dr(){_r(!1),kr(0),N.setValue(window.sessionStorage.getItem(wt))}function ua(gt,St){var _t=N.getValue();_t=_t.replace(gt,St),it(_t),N==null||N.setValue(_t)}return p.a.createElement(g.Fragment,null,p.a.createElement("div",{className:"markdown-editor-wrapper",ref:ri},p.a.createElement("div",{className:"markdown-editor-container ".concat(Ve," ").concat(bt?"on-preview":""," ").concat(Bt?"mini":""," ").concat(yi?"full-screen":""),style:$i},p.a.createElement(v,{insertTemp:Rt,watch:bt,fullScreen:yi,showNullButton:Ut,onActionCallback:Vr,hidetoolBar:Gi,uuid:ti.current,setOpenPhones:function(){jt.current=!0}}),p.a.createElement("div",{className:"markdown-editor-body"},p.a.createElement("div",{className:"codemirror-container"},p.a.createElement("textarea",{ref:Dt,placeholder:gr})),bt?p.a.createElement("div",{ref:ir,className:"preview-container"},Bi==="stex"&&p.a.createElement(O,{value:Ue}),Bi!=="stex"&&p.a.createElement(x.a,{edit:!0,value:Ue,replaces:ua})):null))),Lt?p.a.createElement("a",{ref:zt,className:"editor-resize"}):null,p.a.createElement(M.a,null,le[li]?p.a.createElement(J.a,{centered:!0,title:le[li],visible:!0,onCancel:xr,footer:null,className:"markdown-popup-form"},cn):null))}},RxwV:function(yt,at,ne){"use strict";var oe=ne("q1tI"),J=ne("uciX"),k=ne("2W6z"),$=ne.n(k),F=ne("4IlW"),B=ne("uK0f"),G=ne.n(B);function H(he,ce){if(he===ce)return!0;if(!he||!ce)return!1;var se=he.length;if(ce.length!==se)return!1;for(var re=0;re<se;re++)if(he[re]!==ce[re])return!1;return!0}function D(he){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?D=function(se){return typeof se}:D=function(se){return se&&typeof Symbol=="function"&&se.constructor===Symbol&&se!==Symbol.prototype?"symbol":typeof se},D(he)}function I(he,ce){if(!(he instanceof ce))throw new TypeError("Cannot call a class as a function")}function g(he,ce){for(var se=0;se<ce.length;se++){var re=ce[se];re.enumerable=re.enumerable||!1,re.configurable=!0,"value"in re&&(re.writable=!0),Object.defineProperty(he,re.key,re)}}function p(he,ce,se){return ce&&g(he.prototype,ce),se&&g(he,se),he}function f(he,ce){if(typeof ce!="function"&&ce!==null)throw new TypeError("Super expression must either be null or a function");he.prototype=Object.create(ce&&ce.prototype,{constructor:{value:he,writable:!0,configurable:!0}}),ce&&h(he,ce)}function h(he,ce){return h=Object.setPrototypeOf||function(re,xe){return re.__proto__=xe,re},h(he,ce)}function o(he){var ce=a();return function(){var se=l(he),re;if(ce){var xe=l(this).constructor;re=Reflect.construct(se,arguments,xe)}else re=se.apply(this,arguments);return d(this,re)}}function d(he,ce){return ce&&(D(ce)==="object"||typeof ce=="function")?ce:s(he)}function s(he){if(he===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return he}function a(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(he){return!1}}function l(he){return l=Object.setPrototypeOf?Object.getPrototypeOf:function(se){return se.__proto__||Object.getPrototypeOf(se)},l(he)}var c=function(){var he=function(ce){f(re,ce);var se=o(re);function re(){var xe;return I(this,re),xe=se.apply(this,arguments),xe.menuItems={},xe.saveMenuItem=function(be){return function(ke){xe.menuItems[be]=ke}},xe}return p(re,[{key:"componentDidMount",value:function(){this.scrollActiveItemToView()}},{key:"componentDidUpdate",value:function(be){!be.visible&&this.props.visible&&this.scrollActiveItemToView()}},{key:"getFieldName",value:function(be){var ke=this.props,Oe=ke.fieldNames,Be=ke.defaultFieldNames;return Oe[be]||Be[be]}},{key:"getOption",value:function(be,ke){var Oe=this.props,Be=Oe.prefixCls,Ce=Oe.expandTrigger,De=Oe.expandIcon,Ne=Oe.loadingIcon,Ke=this.props.onSelect.bind(this,be,ke),Fe=this.props.onItemDoubleClick.bind(this,be,ke),je={onClick:Ke,onDoubleClick:Fe},Me="".concat(Be,"-menu-item"),et=null,Je=be[this.getFieldName("children")]&&be[this.getFieldName("children")].length>0;(Je||be.isLeaf===!1)&&(Me+=" ".concat(Be,"-menu-item-expand"),be.loading||(et=oe.createElement("span",{className:"".concat(Be,"-menu-item-expand-icon")},De))),Ce==="hover"&&(Je||be.isLeaf===!1)&&(je={onMouseEnter:this.delayOnSelect.bind(this,Ke),onMouseLeave:this.delayOnSelect.bind(this),onClick:Ke}),this.isActiveOption(be,ke)&&(Me+=" ".concat(Be,"-menu-item-active"),je.ref=this.saveMenuItem(ke)),be.disabled&&(Me+=" ".concat(Be,"-menu-item-disabled"));var qe=null;be.loading&&(Me+=" ".concat(Be,"-menu-item-loading"),qe=Ne||null);var Ze="";return"title"in be?Ze=be.title:typeof be[this.getFieldName("label")]=="string"&&(Ze=be[this.getFieldName("label")]),oe.createElement("li",Object.assign({key:be[this.getFieldName("value")],className:Me,title:Ze},je,{role:"menuitem",onMouseDown:function(Xe){return Xe.preventDefault()}}),be[this.getFieldName("label")],et,qe)}},{key:"getActiveOptions",value:function(be){var ke=this,Oe=this.props.options,Be=be||this.props.activeValue;return G()(Oe,function(Ce,De){return Ce[ke.getFieldName("value")]===Be[De]},{childrenKeyName:this.getFieldName("children")})}},{key:"getShowOptions",value:function(){var be=this,ke=this.props.options,Oe=this.getActiveOptions().map(function(Be){return Be[be.getFieldName("children")]}).filter(function(Be){return!!Be});return Oe.unshift(ke),Oe}},{key:"delayOnSelect",value:function(be){for(var ke=this,Oe=arguments.length,Be=new Array(Oe>1?Oe-1:0),Ce=1;Ce<Oe;Ce++)Be[Ce-1]=arguments[Ce];this.delayTimer&&(clearTimeout(this.delayTimer),this.delayTimer=null),typeof be=="function"&&(this.delayTimer=window.setTimeout(function(){be(Be),ke.delayTimer=null},150))}},{key:"scrollActiveItemToView",value:function(){for(var be=this.getShowOptions().length,ke=0;ke<be;ke++){var Oe=this.menuItems[ke];Oe&&Oe.parentElement&&(Oe.parentElement.scrollTop=Oe.offsetTop)}}},{key:"isActiveOption",value:function(be,ke){var Oe=this.props.activeValue,Be=Oe===void 0?[]:Oe;return Be[ke]===be[this.getFieldName("value")]}},{key:"render",value:function(){var be=this,ke=this.props,Oe=ke.prefixCls,Be=ke.dropdownMenuColumnStyle;return oe.createElement("div",null,this.getShowOptions().map(function(Ce,De){return oe.createElement("ul",{className:"".concat(Oe,"-menu"),key:De,style:Be},Ce.map(function(Ne){return be.getOption(Ne,De)}))}))}}]),re}(oe.Component);return he.defaultProps={options:[],value:[],activeValue:[],onSelect:function(){},prefixCls:"rc-cascader-menus",visible:!1,expandTrigger:"click"},he}(),R=c,w={bottomLeft:{points:["tl","bl"],offset:[0,4],overflow:{adjustX:1,adjustY:1}},topLeft:{points:["bl","tl"],offset:[0,-4],overflow:{adjustX:1,adjustY:1}},bottomRight:{points:["tr","br"],offset:[0,4],overflow:{adjustX:1,adjustY:1}},topRight:{points:["br","tr"],offset:[0,-4],overflow:{adjustX:1,adjustY:1}}},x=w;function O(he){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?O=function(se){return typeof se}:O=function(se){return se&&typeof Symbol=="function"&&se.constructor===Symbol&&se!==Symbol.prototype?"symbol":typeof se},O(he)}function A(he,ce){if(he==null)return{};var se=T(he,ce),re,xe;if(Object.getOwnPropertySymbols){var be=Object.getOwnPropertySymbols(he);for(xe=0;xe<be.length;xe++){if(re=be[xe],ce.indexOf(re)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(he,re))continue;se[re]=he[re]}}return se}function T(he,ce){if(he==null)return{};var se={},re=Object.keys(he),xe,be;for(be=0;be<re.length;be++){if(xe=re[be],ce.indexOf(xe)>=0)continue;se[xe]=he[xe]}return se}function E(he){return m(he)||_(he)||u(he)||b()}function b(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function u(he,ce){if(!he)return;if(typeof he=="string")return v(he,ce);var se=Object.prototype.toString.call(he).slice(8,-1);if(se==="Object"&&he.constructor&&(se=he.constructor.name),se==="Map"||se==="Set")return Array.from(he);if(se==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(se))return v(he,ce)}function _(he){if(typeof Symbol!="undefined"&&Symbol.iterator in Object(he))return Array.from(he)}function m(he){if(Array.isArray(he))return v(he)}function v(he,ce){(ce==null||ce>he.length)&&(ce=he.length);for(var se=0,re=new Array(ce);se<ce;se++)re[se]=he[se];return re}function M(he,ce){if(!(he instanceof ce))throw new TypeError("Cannot call a class as a function")}function P(he,ce){for(var se=0;se<ce.length;se++){var re=ce[se];re.enumerable=re.enumerable||!1,re.configurable=!0,"value"in re&&(re.writable=!0),Object.defineProperty(he,re.key,re)}}function K(he,ce,se){return ce&&P(he.prototype,ce),se&&P(he,se),he}function V(he,ce){if(typeof ce!="function"&&ce!==null)throw new TypeError("Super expression must either be null or a function");he.prototype=Object.create(ce&&ce.prototype,{constructor:{value:he,writable:!0,configurable:!0}}),ce&&U(he,ce)}function U(he,ce){return U=Object.setPrototypeOf||function(re,xe){return re.__proto__=xe,re},U(he,ce)}function S(he){var ce=ae();return function(){var se=de(he),re;if(ce){var xe=de(this).constructor;re=Reflect.construct(se,arguments,xe)}else re=se.apply(this,arguments);return X(this,re)}}function X(he,ce){return ce&&(O(ce)==="object"||typeof ce=="function")?ce:ee(he)}function ee(he){if(he===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return he}function ae(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(he){return!1}}function de(he){return de=Object.setPrototypeOf?Object.getPrototypeOf:function(se){return se.__proto__||Object.getPrototypeOf(se)},de(he)}var Ae=function(){var he=function(ce){V(re,ce);var se=S(re);function re(xe){var be;M(this,re),be=se.call(this,xe),be.setPopupVisible=function(Oe){var Be=be.state.value;"popupVisible"in be.props||be.setState({popupVisible:Oe}),Oe&&!be.state.popupVisible&&be.setState({activeValue:Be}),be.props.onPopupVisibleChange(Oe)},be.handleChange=function(Oe,Be,Ce){var De=Be.visible;(Ce.type!=="keydown"||Ce.keyCode===F.a.ENTER)&&(be.props.onChange(Oe.map(function(Ne){return Ne[be.getFieldName("value")]}),Oe),be.setPopupVisible(De))},be.handlePopupVisibleChange=function(Oe){be.setPopupVisible(Oe)},be.handleMenuSelect=function(Oe,Be,Ce){var De=be.trigger.getRootDomNode();De&&De.focus&&De.focus();var Ne=be.props,Ke=Ne.changeOnSelect,Fe=Ne.loadData,je=Ne.expandTrigger;if(!Oe||Oe.disabled)return;var Me=be.state.activeValue;Me=Me.slice(0,Be+1),Me[Be]=Oe[be.getFieldName("value")];var et=be.getActiveOptions(Me);if(Oe.isLeaf===!1&&!Oe[be.getFieldName("children")]&&Fe){Ke&&be.handleChange(et,{visible:!0},Ce),be.setState({activeValue:Me}),Fe(et);return}var Je={};!Oe[be.getFieldName("children")]||!Oe[be.getFieldName("children")].length?(be.handleChange(et,{visible:!1},Ce),Je.value=Me):Ke&&(Ce.type==="click"||Ce.type==="keydown")&&(je==="hover"?be.handleChange(et,{visible:!1},Ce):be.handleChange(et,{visible:!0},Ce),Je.value=Me),Je.activeValue=Me,("value"in be.props||Ce.type==="keydown"&&Ce.keyCode!==F.a.ENTER)&&delete Je.value,be.setState(Je)},be.handleItemDoubleClick=function(){var Oe=be.props.changeOnSelect;Oe&&be.setPopupVisible(!1)},be.handleKeyDown=function(Oe){var Be=be.props.children;if(Be&&Be.props.onKeyDown){Be.props.onKeyDown(Oe);return}var Ce=E(be.state.activeValue),De=Ce.length-1<0?0:Ce.length-1,Ne=be.getCurrentLevelOptions(),Ke=Ne.map(function(et){return et[be.getFieldName("value")]}).indexOf(Ce[De]);if(Oe.keyCode!==F.a.DOWN&&Oe.keyCode!==F.a.UP&&Oe.keyCode!==F.a.LEFT&&Oe.keyCode!==F.a.RIGHT&&Oe.keyCode!==F.a.ENTER&&Oe.keyCode!==F.a.SPACE&&Oe.keyCode!==F.a.BACKSPACE&&Oe.keyCode!==F.a.ESC&&Oe.keyCode!==F.a.TAB)return;if(!be.state.popupVisible&&Oe.keyCode!==F.a.BACKSPACE&&Oe.keyCode!==F.a.LEFT&&Oe.keyCode!==F.a.RIGHT&&Oe.keyCode!==F.a.ESC&&Oe.keyCode!==F.a.TAB){be.setPopupVisible(!0);return}if(Oe.keyCode===F.a.DOWN||Oe.keyCode===F.a.UP){Oe.preventDefault();var Fe=Ke;Fe!==-1?Oe.keyCode===F.a.DOWN?(Fe+=1,Fe=Fe>=Ne.length?0:Fe):(Fe-=1,Fe=Fe<0?Ne.length-1:Fe):Fe=0,Ce[De]=Ne[Fe][be.getFieldName("value")]}else if(Oe.keyCode===F.a.LEFT||Oe.keyCode===F.a.BACKSPACE)Oe.preventDefault(),Ce.splice(Ce.length-1,1);else if(Oe.keyCode===F.a.RIGHT)Oe.preventDefault(),Ne[Ke]&&Ne[Ke][be.getFieldName("children")]&&Ce.push(Ne[Ke][be.getFieldName("children")][0][be.getFieldName("value")]);else if(Oe.keyCode===F.a.ESC||Oe.keyCode===F.a.TAB){be.setPopupVisible(!1);return}(!Ce||Ce.length===0)&&be.setPopupVisible(!1);var je=be.getActiveOptions(Ce),Me=je[je.length-1];be.handleMenuSelect(Me,je.length-1,Oe),be.props.onKeyDown&&be.props.onKeyDown(Oe)},be.saveTrigger=function(Oe){be.trigger=Oe};var ke=[];return"value"in xe?ke=xe.value||[]:"defaultValue"in xe&&(ke=xe.defaultValue||[]),$()(!("filedNames"in xe),"`filedNames` of Cascader is a typo usage and deprecated, please use `fieldNames` instead."),be.state={popupVisible:xe.popupVisible,activeValue:ke,value:ke,prevProps:xe},be.defaultFieldNames={label:"label",value:"value",children:"children"},be}return K(re,[{key:"getPopupDOMNode",value:function(){return this.trigger.getPopupDomNode()}},{key:"getFieldName",value:function(be){var ke=this.defaultFieldNames,Oe=this.props,Be=Oe.fieldNames,Ce=Oe.filedNames;return"filedNames"in this.props?Ce[be]||ke[be]:Be[be]||ke[be]}},{key:"getFieldNames",value:function(){var be=this.props,ke=be.fieldNames,Oe=be.filedNames;return"filedNames"in this.props?Oe:ke}},{key:"getCurrentLevelOptions",value:function(){var be=this,ke=this.props.options,Oe=ke===void 0?[]:ke,Be=this.state.activeValue,Ce=Be===void 0?[]:Be,De=G()(Oe,function(Ne,Ke){return Ne[be.getFieldName("value")]===Ce[Ke]},{childrenKeyName:this.getFieldName("children")});return De[De.length-2]?De[De.length-2][this.getFieldName("children")]:E(Oe).filter(function(Ne){return!Ne.disabled})}},{key:"getActiveOptions",value:function(be){var ke=this;return G()(this.props.options||[],function(Oe,Be){return Oe[ke.getFieldName("value")]===be[Be]},{childrenKeyName:this.getFieldName("children")})}},{key:"render",value:function(){var be=this.props,ke=be.prefixCls,Oe=be.transitionName,Be=be.popupClassName,Ce=be.options,De=Ce===void 0?[]:Ce,Ne=be.disabled,Ke=be.builtinPlacements,Fe=be.popupPlacement,je=be.children,Me=be.dropdownRender,et=A(be,["prefixCls","transitionName","popupClassName","options","disabled","builtinPlacements","popupPlacement","children","dropdownRender"]),Je=oe.createElement("div",null),qe="";De&&De.length>0?Je=oe.createElement(R,Object.assign({},this.props,{fieldNames:this.getFieldNames(),defaultFieldNames:this.defaultFieldNames,activeValue:this.state.activeValue,onSelect:this.handleMenuSelect,onItemDoubleClick:this.handleItemDoubleClick,visible:this.state.popupVisible})):qe=" ".concat(ke,"-menus-empty");var Ze=Je;return Me&&(Ze=Me(Je)),oe.createElement(J.a,Object.assign({ref:this.saveTrigger},et,{popupPlacement:Fe,builtinPlacements:Ke,popupTransitionName:Oe,action:Ne?[]:["click"],popupVisible:Ne?!1:this.state.popupVisible,onPopupVisibleChange:this.handlePopupVisibleChange,prefixCls:"".concat(ke,"-menus"),popupClassName:Be+qe,popup:Ze}),oe.cloneElement(je,{onKeyDown:this.handleKeyDown,tabIndex:Ne?void 0:0}))}}],[{key:"getDerivedStateFromProps",value:function(be,ke){var Oe=ke.prevProps,Be=Oe===void 0?{}:Oe,Ce={prevProps:be};return"value"in be&&!H(Be.value,be.value)&&(Ce.value=be.value||[],"loadData"in be||(Ce.activeValue=be.value||[])),"popupVisible"in be&&(Ce.popupVisible=be.popupVisible),Ce}}]),re}(oe.Component);return he.defaultProps={onChange:function(){},onPopupVisibleChange:function(){},disabled:!1,transitionName:"",prefixCls:"rc-cascader",popupClassName:"",popupPlacement:"bottomLeft",builtinPlacements:x,expandTrigger:"click",fieldNames:{label:"label",value:"value",children:"children"},expandIcon:">"},he}(),Ee=Ae,we=at.a=Ee},SJMd:function(yt,at){/**
* @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 ne,oe,J,k=!1,$,F;window.PR_SHOULD_USE_CONTINUATION=!0;var B,G;(function(){var H=window,D=["break,continue,do,else,for,if,return,while"],I=[D,"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"],g=[I,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],p=[g,"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=[g,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],h=[g,"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"],o="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",d=[g,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],s="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=[D,"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"],l=[D,"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=[D,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],R=[p,h,f,d,s,a,l,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/,x="str",O="kwd",A="com",T="typ",E="lit",b="pun",u="pln",_="tag",m="dec",v="src",M="atn",P="atv",K="nocode",V="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function U(Ce){for(var De=0,Ne=!1,Ke=!1,Fe=0,je=Ce.length;Fe<je;++Fe){var Me=Ce[Fe];if(Me.ignoreCase)Ke=!0;else if(/[a-z]/i.test(Me.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Ne=!0,Ke=!1;break}}var et={b:8,t:9,n:10,v:11,f:12,r:13};function Je(Ye){var Ie=Ye.charCodeAt(0);if(Ie!==92)return Ie;var ot=Ye.charAt(1);return Ie=et[ot],Ie||("0"<=ot&&ot<="7"?parseInt(Ye.substring(1),8):ot==="u"||ot==="x"?parseInt(Ye.substring(2),16):Ye.charCodeAt(1))}function qe(Ye){if(Ye<32)return(Ye<16?"\\x0":"\\x")+Ye.toString(16);var Ie=String.fromCharCode(Ye);return Ie==="\\"||Ie==="-"||Ie==="]"||Ie==="^"?"\\"+Ie:Ie}function Ze(Ye){var Ie=Ye.substring(1,Ye.length-1).match(new RegExp("\\\\u[0-9A-Fa-f]{4}|\\\\x[0-9A-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\s\\S]|-|[^-\\\\]","g")),ot=[],tt=Ie[0]==="^",Re=["["];tt&&Re.push("^");for(var We=tt?1:0,_e=Ie.length;We<_e;++We){var me=Ie[We];if(/\\[bdsw]/i.test(me))Re.push(me);else{var ve=Je(me),te;We+2<_e&&Ie[We+1]==="-"?(te=Je(Ie[We+2]),We+=2):te=ve,ot.push([ve,te]),te<65||ve>122||(te<65||ve>90||ot.push([Math.max(65,ve)|32,Math.min(te,90)|32]),te<97||ve>122||ot.push([Math.max(97,ve)&~32,Math.min(te,122)&~32]))}}ot.sort(function(ye,Le){return ye[0]-Le[0]||Le[1]-ye[1]});for(var ie=[],le=[],We=0;We<ot.length;++We){var pe=ot[We];pe[0]<=le[1]+1?le[1]=Math.max(le[1],pe[1]):ie.push(le=pe)}for(var We=0;We<ie.length;++We){var pe=ie[We];Re.push(qe(pe[0])),pe[1]>pe[0]&&(pe[1]+1>pe[0]&&Re.push("-"),Re.push(qe(pe[1])))}return Re.push("]"),Re.join("")}function dt(Ye){for(var Ie=Ye.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")),ot=Ie.length,tt=[],Re=0,We=0;Re<ot;++Re){var _e=Ie[Re];if(_e==="(")++We;else if(_e.charAt(0)==="\\"){var me=+_e.substring(1);me&&(me<=We?tt[me]=-1:Ie[Re]=qe(me))}}for(var Re=1;Re<tt.length;++Re)tt[Re]===-1&&(tt[Re]=++De);for(var Re=0,We=0;Re<ot;++Re){var _e=Ie[Re];if(_e==="(")++We,tt[We]||(Ie[Re]="(?:");else if(_e.charAt(0)==="\\"){var me=+_e.substring(1);me&&me<=We&&(Ie[Re]="\\"+tt[me])}}for(var Re=0;Re<ot;++Re)Ie[Re]==="^"&&Ie[Re+1]!=="^"&&(Ie[Re]="");if(Ye.ignoreCase&&Ne)for(var Re=0;Re<ot;++Re){var _e=Ie[Re],ve=_e.charAt(0);_e.length>=2&&ve==="["?Ie[Re]=Ze(_e):ve!=="\\"&&(Ie[Re]=_e.replace(/[a-zA-Z]/g,function(le){var pe=le.charCodeAt(0);return"["+String.fromCharCode(pe&~32,pe|32)+"]"}))}return Ie.join("")}for(var Xe=[],Fe=0,je=Ce.length;Fe<je;++Fe){var Me=Ce[Fe];if(Me.global||Me.multiline)throw new Error(""+Me);Xe.push("(?:"+dt(Me)+")")}return new RegExp(Xe.join("|"),Ke?"gi":"g")}function S(Ce,De){var Ne=/(?:^|\s)nocode(?:\s|$)/,Ke=[],Fe=0,je=[],Me=0;function et(Je){var qe=Je.nodeType;if(qe==1){if(Ne.test(Je.className))return;for(var Ze=Je.firstChild;Ze;Ze=Ze.nextSibling)et(Ze);var dt=Je.nodeName.toLowerCase();(dt==="br"||dt==="li")&&(Ke[Me]=`
`,je[Me<<1]=Fe++,je[Me++<<1|1]=Je)}else if(qe==3||qe==4){var Xe=Je.nodeValue;Xe.length&&(De?Xe=Xe.replace(/\r\n?/g,`
`):Xe=Xe.replace(/[ \t\r\n]+/g," "),Ke[Me]=Xe,je[Me<<1]=Fe,Fe+=Xe.length,je[Me++<<1|1]=Je)}}return et(Ce),{sourceCode:Ke.join("").replace(/\n$/,""),spans:je}}function X(Ce,De,Ne,Ke,Fe){if(!Ne)return;var je={sourceNode:Ce,pre:1,langExtension:null,numberLines:null,sourceCode:Ne,spans:null,basePos:De,decorations:null};Ke(je),Fe.push.apply(Fe,je.decorations)}var ee=/\S/;function ae(Ce){for(var De=void 0,Ne=Ce.firstChild;Ne;Ne=Ne.nextSibling){var Ke=Ne.nodeType;De=Ke===1?De?Ce:Ne:Ke===3&&ee.test(Ne.nodeValue)?Ce:De}return De===Ce?void 0:De}function de(Ce,De){var Ne={},Ke;(function(){for(var Me=Ce.concat(De),et=[],Je={},qe=0,Ze=Me.length;qe<Ze;++qe){var dt=Me[qe],Xe=dt[3];if(Xe)for(var Ye=Xe.length;--Ye>=0;)Ne[Xe.charAt(Ye)]=dt;var Ie=dt[1],ot=""+Ie;Je.hasOwnProperty(ot)||(et.push(Ie),Je[ot]=null)}et.push(/[\0-\uffff]/),Ke=U(et)})();var Fe=De.length,je=function(Me){for(var et=Me.sourceCode,Je=Me.basePos,qe=Me.sourceNode,Ze=[Je,u],dt=0,Xe=et.match(Ke)||[],Ye={},Ie=0,ot=Xe.length;Ie<ot;++Ie){var tt=Xe[Ie],Re=Ye[tt],We=void 0,_e;if(typeof Re=="string")_e=!1;else{var me=Ne[tt.charAt(0)];if(me)We=tt.match(me[1]),Re=me[0];else{for(var ve=0;ve<Fe;++ve)if(me=De[ve],We=tt.match(me[1]),We){Re=me[0];break}We||(Re=u)}_e=Re.length>=5&&Re.substring(0,5)==="lang-",_e&&!(We&&typeof We[1]=="string")&&(_e=!1,Re=v),_e||(Ye[tt]=Re)}var te=dt;if(dt+=tt.length,!_e)Ze.push(Je+te,Re);else{var ie=We[1],le=tt.indexOf(ie),pe=le+ie.length;We[2]&&(pe=tt.length-We[2].length,le=pe-ie.length);var ye=Re.substring(5);X(qe,Je+te,tt.substring(0,le),je,Ze),X(qe,Je+te+le,ie,re(ye,ie),Ze),X(qe,Je+te+pe,tt.substring(pe),je,Ze)}}Me.decorations=Ze};return je}function Ae(Ce){var De=[],Ne=[];Ce.tripleQuotedStrings?De.push([x,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):Ce.multiLineStrings?De.push([x,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):De.push([x,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),Ce.verbatimStrings&&Ne.push([x,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Ke=Ce.hashComments;Ke&&(Ce.cStyleComments?(Ke>1?De.push([A,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):De.push([A,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Ne.push([x,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):De.push([A,/^#[^\r\n]*/,null,"#"])),Ce.cStyleComments&&(Ne.push([A,/^\/\/[^\r\n]*/,null]),Ne.push([A,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Fe=Ce.regexLiterals;if(Fe){var je=Fe>1?"":`
\r`,Me=je?".":"[\\S\\s]",et="/(?=[^/*"+je+"])(?:[^/\\x5B\\x5C"+je+"]|\\x5C"+Me+"|\\x5B(?:[^\\x5C\\x5D"+je+"]|\\x5C"+Me+")*(?:\\x5D|$))+/";Ne.push(["lang-regex",RegExp("^"+V+"("+et+")")])}var Je=Ce.types;Je&&Ne.push([T,Je]);var qe=(""+Ce.keywords).replace(/^ | $/g,"");qe.length&&Ne.push([O,new RegExp("^(?:"+qe.replace(/[\s,]+/g,"|")+")\\b"),null]),De.push([u,/^\s+/,null,` \r
\xA0`]);var Ze="^.[^\\s\\w.$@'\"`/\\\\]*";return Ce.regexLiterals&&(Ze+="(?!s*/)"),Ne.push([E,/^@[a-z_$][a-z_$@0-9]*/i,null],[T,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[u,/^[a-z_$][a-z_$@0-9]*/i,null],[E,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[u,/^\\[\s\S]?/,null],[b,new RegExp(Ze),null]),de(De,Ne)}var Ee=Ae({keywords:R,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function we(Ce,De,Ne){for(var Ke=/(?:^|\s)nocode(?:\s|$)/,Fe=/\r\n?|\n/,je=Ce.ownerDocument,Me=je.createElement("li");Ce.firstChild;)Me.appendChild(Ce.firstChild);var et=[Me];function Je(Ie){var ot=Ie.nodeType;if(ot==1&&!Ke.test(Ie.className))if(Ie.nodeName==="br")qe(Ie),Ie.parentNode&&Ie.parentNode.removeChild(Ie);else for(var tt=Ie.firstChild;tt;tt=tt.nextSibling)Je(tt);else if((ot==3||ot==4)&&Ne){var Re=Ie.nodeValue,We=Re.match(Fe);if(We){var _e=Re.substring(0,We.index);Ie.nodeValue=_e;var me=Re.substring(We.index+We[0].length);if(me){var ve=Ie.parentNode;ve.insertBefore(je.createTextNode(me),Ie.nextSibling)}qe(Ie),_e||Ie.parentNode.removeChild(Ie)}}}function qe(Ie){for(;!Ie.nextSibling;)if(Ie=Ie.parentNode,!Ie)return;function ot(We,_e){var me=_e?We.cloneNode(!1):We,ve=We.parentNode;if(ve){var te=ot(ve,1),ie=We.nextSibling;te.appendChild(me);for(var le=ie;le;le=ie)ie=le.nextSibling,te.appendChild(le)}return me}for(var tt=ot(Ie.nextSibling,0),Re;(Re=tt.parentNode)&&Re.nodeType===1;)tt=Re;et.push(tt)}for(var Ze=0;Ze<et.length;++Ze)Je(et[Ze]);De===(De|0)&&et[0].setAttribute("value",De);var dt=je.createElement("ol");dt.className="linenums";for(var Xe=Math.max(0,De-1|0)||0,Ze=0,Ye=et.length;Ze<Ye;++Ze)Me=et[Ze],Me.className="L"+(Ze+Xe)%10,Me.firstChild||Me.appendChild(je.createTextNode("\xA0")),dt.appendChild(Me);Ce.appendChild(dt)}function he(Ce){var De=/\bMSIE\s(\d+)/.exec(navigator.userAgent);De=De&&+De[1]<=8;var Ne=/\n/g,Ke=Ce.sourceCode,Fe=Ke.length,je=0,Me=Ce.spans,et=Me.length,Je=0,qe=Ce.decorations,Ze=qe.length,dt=0;qe[Ze]=Fe;var Xe,Ye;for(Ye=Xe=0;Ye<Ze;)qe[Ye]!==qe[Ye+2]?(qe[Xe++]=qe[Ye++],qe[Xe++]=qe[Ye++]):Ye+=2;for(Ze=Xe,Ye=Xe=0;Ye<Ze;){for(var Ie=qe[Ye],ot=qe[Ye+1],tt=Ye+2;tt+2<=Ze&&qe[tt+1]===ot;)tt+=2;qe[Xe++]=Ie,qe[Xe++]=ot,Ye=tt}Ze=qe.length=Xe;var Re=Ce.sourceNode,We="";Re&&(We=Re.style.display,Re.style.display="none");try{for(var _e=null;Je<et;){var me=Me[Je],ve=Me[Je+2]||Fe,te=qe[dt+2]||Fe,tt=Math.min(ve,te),ie=Me[Je+1],le;if(ie.nodeType!==1&&(le=Ke.substring(je,tt))){De&&(le=le.replace(Ne,"\r")),ie.nodeValue=le;var pe=ie.ownerDocument,ye=pe.createElement("span");ye.className=qe[dt+1];var Le=ie.parentNode;Le.replaceChild(ye,ie),ye.appendChild(ie),je<ve&&(Me[Je+1]=ie=pe.createTextNode(Ke.substring(tt,ve)),Le.insertBefore(ie,ye.nextSibling))}je=tt,je>=ve&&(Je+=2),je>=te&&(dt+=2)}}finally{Re&&(Re.style.display=We)}}var ce={};function se(Ce,De){for(var Ne=De.length;--Ne>=0;){var Ke=De[Ne];ce.hasOwnProperty(Ke)?H.console&&console.warn("cannot override language handler %s",Ke):ce[Ke]=Ce}}function re(Ce,De){return Ce&&ce.hasOwnProperty(Ce)||(Ce=/^\s*</.test(De)?"default-markup":"default-code"),ce[Ce]}se(Ee,["default-code"]),se(de([],[[u,/^[^<?]+/],[m,/^<!\w[^>]*(?:>|$)/],[A,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[b,/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),se(de([[u,/^[\s]+/,null,` \r
`],[P,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[_,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[M,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[b,/^[=<>\/]+/],["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"]),se(de([],[[P,/^[\s\S]+/]]),["uq.val"]),se(Ae({keywords:p,hashComments:!0,cStyleComments:!0,types:w}),["c","cc","cpp","cxx","cyc","m"]),se(Ae({keywords:"null,true,false"}),["json"]),se(Ae({keywords:h,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:w}),["cs"]),se(Ae({keywords:f,cStyleComments:!0}),["java"]),se(Ae({keywords:c,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),se(Ae({keywords:a,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),se(Ae({keywords:s,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),se(Ae({keywords:l,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),se(Ae({keywords:d,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),se(Ae({keywords:o,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),se(de([],[[x,/^[\s\S]+/]]),["regex"]);function xe(Ce){var De=Ce.langExtension;try{var Ne=S(Ce.sourceNode,Ce.pre),Ke=Ne.sourceCode;Ce.sourceCode=Ke,Ce.spans=Ne.spans,Ce.basePos=0,re(De,Ke)(Ce),he(Ce)}catch(Fe){H.console&&console.log(Fe&&Fe.stack||Fe)}}function be(Ce,De,Ne){var Ke=Ne||!1,Fe=De||null,je=document.createElement("div");je.innerHTML="<pre>"+Ce+"</pre>",je=je.firstChild,Ke&&we(je,Ke,!0);var Me={langExtension:Fe,numberLines:Ke,sourceNode:je,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return xe(Me),je.innerHTML}function ke(Ce,De){var Ne=De||document.body,Ke=Ne.ownerDocument||document;function Fe(me){return Ne.getElementsByTagName(me)}for(var je=[Fe("pre"),Fe("code"),Fe("xmp")],Me=[],et=0;et<je.length;++et)for(var Je=0,qe=je[et].length;Je<qe;++Je)Me.push(je[et][Je]);je=null;var Ze=Date;Ze.now||(Ze={now:function(){return+new Date}});var dt=0,Xe=/\blang(?:uage)?-([\w.]+)(?!\S)/,Ye=/\bprettyprint\b/,Ie=/\bprettyprinted\b/,ot=/pre|xmp/i,tt=/^code$/i,Re=/^(?:pre|code|xmp)$/i,We={};function _e(){for(var me=H.PR_SHOULD_USE_CONTINUATION?Ze.now()+250:Infinity;dt<Me.length&&Ze.now()<me;dt++){for(var ve=Me[dt],te=We,ie=ve;ie=ie.previousSibling;){var le=ie.nodeType,pe=(le===7||le===8)&&ie.nodeValue;if(pe?!/^\??prettify\b/.test(pe):le!==3||/\S/.test(ie.nodeValue))break;if(pe){te={},pe.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Yt,Rt,Ti){te[Rt]=Ti});break}}var ye=ve.className;if((te!==We||Ye.test(ye))&&!Ie.test(ye)){for(var Le=!1,He=ve.parentNode;He;He=He.parentNode){var st=He.tagName;if(Re.test(st)&&He.className&&Ye.test(He.className)){Le=!0;break}}if(!Le){ve.className+=" prettyprinted";var ct=te.lang;if(!ct){ct=ye.match(Xe);var ft;!ct&&(ft=ae(ve))&&tt.test(ft.tagName)&&(ct=ft.className.match(Xe)),ct&&(ct=ct[1])}var Ct;if(ot.test(ve.tagName))Ct=1;else{var xt=ve.currentStyle,ut=Ke.defaultView,Bt=xt?xt.whiteSpace:ut&&ut.getComputedStyle?ut.getComputedStyle(ve,null).getPropertyValue("white-space"):0;Ct=Bt&&Bt.substring(0,3)==="pre"}var Pt=te.linenums;(Pt=Pt==="true"||+Pt)||(Pt=ye.match(/\blinenums\b(?::(\d+))?/),Pt=Pt?Pt[1]&&Pt[1].length?+Pt[1]:!0:!1),Pt&&we(ve,Pt,Ct);var Jt={langExtension:ct,sourceNode:ve,numberLines:Pt,pre:Ct,sourceCode:null,basePos:null,spans:null,decorations:null};xe(Jt)}}}dt<Me.length?H.setTimeout(_e,250):typeof Ce=="function"&&Ce()}_e()}var Oe=H.PR={createSimpleLexer:de,registerLangHandler:se,sourceDecorator:Ae,PR_ATTRIB_NAME:M,PR_ATTRIB_VALUE:P,PR_COMMENT:A,PR_DECLARATION:m,PR_KEYWORD:O,PR_LITERAL:E,PR_NOCODE:K,PR_PLAIN:u,PR_PUNCTUATION:b,PR_SOURCE:v,PR_STRING:x,PR_TAG:_,PR_TYPE:T,prettyPrintOne:k?H.prettyPrintOne=be:B=be,prettyPrint:G=k?H.prettyPrint=ke:G=ke},Be=H.define;typeof Be=="function"&&Be.amd&&Be("google-code-prettify",[],function(){return Oe})})()},TXwP:function(yt,at,ne){var oe,J;(function(){var k;(function(){"use strict";var F=[,,function(D){function I(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=[]}I.prototype.clone_empty=function(){var f=new I(this.__parent);return f.set_indent(this.__indent_count,this.__alignment_count),f},I.prototype.item=function(f){return f<0?this.__items[this.__items.length+f]:this.__items[f]},I.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},I.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))},I.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)},I.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},I.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},I.prototype.is_empty=function(){return this.__items.length===0},I.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},I.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},I.prototype.pop=function(){var f=null;return this.is_empty()||(f=this.__items.pop(),this.__character_count-=f.length),f},I.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},I.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},I.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},I.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 g(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}g.prototype.get_indent_size=function(f,h){var o=this.__base_string_length;return h=h||0,f<0&&(o=0),o+=f*this.__indent_size,o+=h,o},g.prototype.get_indent_string=function(f,h){var o=this.__base_string;return h=h||0,f<0&&(f=0,o=""),h+=f*this.__indent_size,this.__ensure_cache(h),o+=this.__cache[h],o},g.prototype.__ensure_cache=function(f){for(;f>=this.__cache.length;)this.__add_column()},g.prototype.__add_column=function(){var f=this.__cache.length,h=0,o="";this.__indent_size&&f>=this.__indent_size&&(h=Math.floor(f/this.__indent_size),f-=h*this.__indent_size,o=new Array(h+1).join(this.__indent_string)),f&&(o+=new Array(f+1).join(" ")),this.__cache.push(o)};function p(f,h){this.__indent_cache=new g(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 I(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 o=this.__lines.join(`
`);return f!==`
`&&(o=o.replace(/[\n]/g,f)),o},p.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},p.prototype.set_indent=function(f,h){return f=f||0,h=h||0,this.next_line.set_indent(f,h),this.__lines.length>1?(this.current_line.set_indent(f,h),!0):(this.current_line.set_indent(),!1)},p.prototype.add_raw_token=function(f){for(var h=0;h<f.newlines;h++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(f.whitespace_before),this.current_line.push(f.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},p.prototype.add_token=function(f){this.__add_space_before_token(),this.current_line.push(f),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},p.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},p.prototype.remove_indent=function(f){for(var h=this.__lines.length;f<h;)this.__lines[f]._remove_indent(),f++;this.current_line._remove_wrap_indent()},p.prototype.trim=function(f){for(f=f===void 0?!1:f,this.current_line.trim();f&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},p.prototype.just_added_newline=function(){return this.current_line.is_empty()},p.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},p.prototype.ensure_empty_line_above=function(f,h){for(var o=this.__lines.length-2;o>=0;){var d=this.__lines[o];if(d.is_empty())break;if(d.item(0).indexOf(f)!==0&&d.item(-1)!==h){this.__lines.splice(o+1,0,new I(this)),this.previous_line=this.__lines[this.__lines.length-2];break}o--}},D.exports.Output=p},,,,function(D){function I(f,h){this.raw_options=g(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"])}I.prototype._get_array=function(f,h){var o=this.raw_options[f],d=h||[];return typeof o=="object"?o!==null&&typeof o.concat=="function"&&(d=o.concat()):typeof o=="string"&&(d=o.split(/[^a-zA-Z0-9_\/\-]+/)),d},I.prototype._get_boolean=function(f,h){var o=this.raw_options[f],d=o===void 0?!!h:!!o;return d},I.prototype._get_characters=function(f,h){var o=this.raw_options[f],d=h||"";return typeof o=="string"&&(d=o.replace(/\\r/,"\r").replace(/\\n/,`
`).replace(/\\t/," ")),d},I.prototype._get_number=function(f,h){var o=this.raw_options[f];h=parseInt(h,10),isNaN(h)&&(h=0);var d=parseInt(o,10);return isNaN(d)&&(d=h),d},I.prototype._get_selection=function(f,h,o){var d=this._get_selection_list(f,h,o);if(d.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 d[0]},I.prototype._get_selection_list=function(f,h,o){if(!h||h.length===0)throw new Error("Selection list cannot be empty.");if(o=o||[h[0]],!this._is_valid_selection(o,h))throw new Error("Invalid Default Value!");var d=this._get_array(f,o);if(!this._is_valid_selection(d,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 d},I.prototype._is_valid_selection=function(f,h){return f.length&&h.length&&!f.some(function(o){return h.indexOf(o)===-1})};function g(f,h){var o={};f=p(f);var d;for(d in f)d!==h&&(o[d]=f[d]);if(h&&f[h])for(d in f[h])o[d]=f[h][d];return o}function p(f){var h={},o;for(o in f){var d=o.replace(/-/g,"_");h[d]=f[o]}return h}D.exports.Options=I,D.exports.normalizeOpts=p,D.exports.mergeOpts=g},,function(D){var I=RegExp.prototype.hasOwnProperty("sticky");function g(p){this.__input=p||"",this.__input_length=this.__input.length,this.__position=0}g.prototype.restart=function(){this.__position=0},g.prototype.back=function(){this.__position>0&&(this.__position-=1)},g.prototype.hasNext=function(){return this.__position<this.__input_length},g.prototype.next=function(){var p=null;return this.hasNext()&&(p=this.__input.charAt(this.__position),this.__position+=1),p},g.prototype.peek=function(p){var f=null;return p=p||0,p+=this.__position,p>=0&&p<this.__input_length&&(f=this.__input.charAt(p)),f},g.prototype.__match=function(p,f){p.lastIndex=f;var h=p.exec(this.__input);return h&&!(I&&p.sticky)&&(h.index!==f&&(h=null)),h},g.prototype.test=function(p,f){return f=f||0,f+=this.__position,f>=0&&f<this.__input_length?!!this.__match(p,f):!1},g.prototype.testChar=function(p,f){var h=this.peek(f);return p.lastIndex=0,h!==null&&p.test(h)},g.prototype.match=function(p){var f=this.__match(p,this.__position);return f?this.__position+=f[0].length:f=null,f},g.prototype.read=function(p,f,h){var o="",d;return p&&(d=this.match(p),d&&(o+=d[0])),f&&(d||!p)&&(o+=this.readUntil(f,h)),o},g.prototype.readUntil=function(p,f){var h="",o=this.__position;p.lastIndex=this.__position;var d=p.exec(this.__input);return d?(o=d.index,f&&(o+=d[0].length)):o=this.__input_length,h=this.__input.substring(this.__position,o),this.__position=o,h},g.prototype.readUntilAfter=function(p){return this.readUntil(p,!0)},g.prototype.get_regexp=function(p,f){var h=null,o="g";return f&&I&&(o="y"),typeof p=="string"&&p!==""?h=new RegExp(p,o):p&&(h=new RegExp(p.source,o)),h},g.prototype.get_literal_regexp=function(p){return RegExp(p.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},g.prototype.peekUntilAfter=function(p){var f=this.__position,h=this.readUntilAfter(p);return this.__position=f,h},g.prototype.lookBack=function(p){var f=this.__position-1;return f>=p.length&&this.__input.substring(f-p.length,f).toLowerCase()===p},D.exports.InputScanner=g},,,,,function(D){function I(g,p){g=typeof g=="string"?g:g.source,p=typeof p=="string"?p:p.source,this.__directives_block_pattern=new RegExp(g+/ beautify( \w+[:]\w+)+ /.source+p,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(g+/\sbeautify\signore:end\s/.source+p,"g")}I.prototype.get_directives=function(g){if(!g.match(this.__directives_block_pattern))return null;var p={};this.__directive_pattern.lastIndex=0;for(var f=this.__directive_pattern.exec(g);f;)p[f[1]]=f[2],f=this.__directive_pattern.exec(g);return p},I.prototype.readIgnored=function(g){return g.readUntilAfter(this.__directives_end_ignore_pattern)},D.exports.Directives=I},,function(D,I,g){var p=g(16).Beautifier,f=g(17).Options;function h(o,d){var s=new p(o,d);return s.beautify()}D.exports=h,D.exports.defaultOptions=function(){return new f}},function(D,I,g){var p=g(17).Options,f=g(2).Output,h=g(8).InputScanner,o=g(13).Directives,d=new o(/\/\*/,/\*\//),s=/\r\n|[\r\n]/,a=/\r\n|[\r\n]/g,l=/\s/,c=/(?:\s|\n)+/g,R=/\/\*(?:[\s\S]*?)((?:\*\/)|$)/g,w=/\/\/(?:[^\n\r\u2028\u2029]*)/g;function x(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"]}x.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},x.prototype.eatWhitespace=function(O){for(var A=l.test(this._input.peek()),T=0;l.test(this._input.peek());)this._ch=this._input.next(),O&&this._ch===`
`&&((T===0||T<this._options.max_preserve_newlines)&&(T++,this._output.add_new_line(!0)));return A},x.prototype.foundNestedPseudoClass=function(){for(var O=0,A=1,T=this._input.peek(A);T;){if(T==="{")return!0;if(T==="(")O+=1;else if(T===")"){if(O===0)return!1;O-=1}else if(T===";"||T==="}")return!1;A++,T=this._input.peek(A)}return!1},x.prototype.print_string=function(O){this._output.set_indent(this._indentLevel),this._output.non_breaking_space=!0,this._output.add_token(O)},x.prototype.preserveSingleSpace=function(O){O&&(this._output.space_before_token=!0)},x.prototype.indent=function(){this._indentLevel++},x.prototype.outdent=function(){this._indentLevel>0&&this._indentLevel--},x.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var O=this._source_text,A=this._options.eol;A==="auto"&&(A=`
`,O&&s.test(O||"")&&(A=O.match(s)[0])),O=O.replace(a,`
`);var T=O.match(/^[\t ]*/)[0];this._output=new f(this._options,T),this._input=new h(O),this._indentLevel=0,this._nestedLevel=0,this._ch=null;for(var E=0,b=!1,u=!1,_=!1,m=!1,v=!1,M=!1,P=this._ch,K=!1,V,U,S;V=this._input.read(c),U=V!=="",S=P,this._ch=this._input.next(),this._ch==="\\"&&this._input.hasNext()&&(this._ch+=this._input.next()),P=this._ch,this._ch;)if(this._ch==="/"&&this._input.peek()==="*"){this._output.add_new_line(),this._input.back();var X=this._input.read(R),ee=d.get_directives(X);ee&&ee.ignore==="start"&&(X+=d.readIgnored(this._input)),this.print_string(X),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(U),this._input.peek()==="{")this.print_string(this._ch+this.eatString("}"));else{this.print_string(this._ch);var ae=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);ae.match(/[ :]$/)&&(ae=this.eatString(": ").replace(/\s$/,""),this.print_string(ae),this._output.space_before_token=!0),ae=ae.replace(/\s$/,""),ae==="extend"?m=!0:ae==="import"&&(v=!0),ae in this.NESTED_AT_RULE?(this._nestedLevel+=1,ae in this.CONDITIONAL_GROUP_RULE&&(_=!0)):!b&&E===0&&ae.indexOf(":")!==-1&&(u=!0,this.indent())}else if(this._ch==="#"&&this._input.peek()==="{")this.preserveSingleSpace(U),this.print_string(this._ch+this.eatString("}"));else if(this._ch==="{")u&&(u=!1,this.outdent()),_?(_=!1,b=this._indentLevel>=this._nestedLevel):b=this._indentLevel>=this._nestedLevel-1,this._options.newline_between_rules&&b&&(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)):(S==="("?this._output.space_before_token=!1:S!==","&&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(),S==="{"&&this._output.trim(!0),v=!1,m=!1,u&&(this.outdent(),u=!1),this.print_string(this._ch),b=!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 de=0;de<this.NON_SEMICOLON_NEWLINE_PROPERTY.length;de++)if(this._input.lookBack(this.NON_SEMICOLON_NEWLINE_PROPERTY[de])){K=!0;break}(b||_)&&!(this._input.lookBack("&")||this.foundNestedPseudoClass())&&!this._input.lookBack("(")&&!m&&E===0?(this.print_string(":"),u||(u=!0,this._output.space_before_token=!0,this.eatWhitespace(!0),this.indent())):(this._input.lookBack(" ")&&(this._output.space_before_token=!0),this._input.peek()===":"?(this._ch=this._input.next(),this.print_string("::")):this.print_string(":"))}else if(this._ch==='"'||this._ch==="'"){var Ae=S==='"'||S==="'";this.preserveSingleSpace(Ae||U),this.print_string(this._ch+this.eatString(this._ch)),this.eatWhitespace(!0)}else if(this._ch===";")K=!1,E===0?(u&&(this.outdent(),u=!1),m=!1,v=!1,this.print_string(this._ch),this.eatWhitespace(!0),this._input.peek()!=="/"&&this._output.add_new_line()):(this.print_string(this._ch),this.eatWhitespace(!0),this._output.space_before_token=!0);else if(this._ch==="(")if(this._input.lookBack("url"))this.print_string(this._ch),this.eatWhitespace(),E++,this.indent(),this._ch=this._input.next(),this._ch===")"||this._ch==='"'||this._ch==="'"?this._input.back():this._ch&&(this.print_string(this._ch+this.eatString(")")),E&&(E--,this.outdent()));else{var Ee=!1;this._input.lookBack("with")&&(Ee=!0),this.preserveSingleSpace(U||Ee),this.print_string(this._ch),u&&S==="$"&&this._options.selector_separator_newline?(this._output.add_new_line(),M=!0):(this.eatWhitespace(),E++,this.indent())}else if(this._ch===")")E&&(E--,this.outdent()),M&&this._input.peek()===";"&&this._options.selector_separator_newline&&(M=!1,this.outdent(),this._output.add_new_line()),this.print_string(this._ch);else if(this._ch===",")this.print_string(this._ch),this.eatWhitespace(!0),this._options.selector_separator_newline&&(!u||M)&&E===0&&!v&&!m?this._output.add_new_line():this._output.space_before_token=!0;else if((this._ch===">"||this._ch==="+"||this._ch==="~")&&!u&&E===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&&l.test(this._ch)&&(this._ch=""));else if(this._ch==="]")this.print_string(this._ch);else if(this._ch==="[")this.preserveSingleSpace(U),this.print_string(this._ch);else if(this._ch==="=")this.eatWhitespace(),this.print_string("="),l.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 we=S==='"'||S==="'";this.preserveSingleSpace(we||U),this.print_string(this._ch),!this._output.just_added_newline()&&this._input.peek()===`
`&&K&&this._output.add_new_line()}var he=this._output.get_code(A);return he},D.exports.Beautifier=x},function(D,I,g){var p=g(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 o=this._get_boolean("space_around_selector_separator");this.space_around_combinator=this._get_boolean("space_around_combinator")||o;var d=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_style="collapse";for(var s=0;s<d.length;s++)d[s]!=="expand"?this.brace_style="collapse":this.brace_style=d[s]}f.prototype=new p,D.exports.Options=f}],B={};function G(D){var I=B[D];if(I!==void 0)return I.exports;var g=B[D]={exports:{}};return F[D](g,g.exports,G),g.exports}var H=G(15);k=H})();var $=k;!(oe=[],J=function(){return{css_beautify:$}}.apply(at,oe),J!==void 0&&(yt.exports=J))})()},"VrN/":function(yt,at,ne){(function(oe,J){yt.exports=J()})(this,function(){"use strict";var oe=navigator.userAgent,J=navigator.platform,k=/gecko\/\d/i.test(oe),$=/MSIE \d/.test(oe),F=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(oe),B=/Edge\/(\d+)/.exec(oe),G=$||F||B,H=G&&($?document.documentMode||6:+(B||F)[1]),D=!B&&/WebKit\//.test(oe),I=D&&/Qt\/\d+\.\d+/.test(oe),g=!B&&/Chrome\//.test(oe),p=/Opera\//.test(oe),f=/Apple Computer/.test(navigator.vendor),h=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(oe),o=/PhantomJS/.test(oe),d=!B&&/AppleWebKit/.test(oe)&&/Mobile\/\w+/.test(oe),s=/Android/.test(oe),a=d||s||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(oe),l=d||/Mac/.test(J),c=/\bCrOS\b/.test(oe),R=/win/i.test(J),w=p&&oe.match(/Version\/(\d*\.\d*)/);w&&(w=Number(w[1])),w&&w>=15&&(p=!1,D=!0);var x=l&&(I||p&&(w==null||w<12.11)),O=k||G&&H>=9;function A(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var T=function(e,t){var r=e.className,i=A(t).exec(r);if(i){var n=r.slice(i.index+i[0].length);e.className=r.slice(0,i.index)+(n?i[1]+n:"")}};function E(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function b(e,t){return E(e).appendChild(t)}function u(e,t,r,i){var n=document.createElement(e);if(r&&(n.className=r),i&&(n.style.cssText=i),typeof t=="string")n.appendChild(document.createTextNode(t));else if(t)for(var L=0;L<t.length;++L)n.appendChild(t[L]);return n}function _(e,t,r,i){var n=u(e,t,r,i);return n.setAttribute("role","presentation"),n}var m;document.createRange?m=function(e,t,r,i){var n=document.createRange();return n.setEnd(i||e,r),n.setStart(e,t),n}:m=function(e,t,r){var i=document.body.createTextRange();try{i.moveToElementText(e.parentNode)}catch(n){return i}return i.collapse(!0),i.moveEnd("character",r),i.moveStart("character",t),i};function v(e,t){if(t.nodeType==3&&(t=t.parentNode),e.contains)return e.contains(t);do if(t.nodeType==11&&(t=t.host),t==e)return!0;while(t=t.parentNode)}function M(){var e;try{e=document.activeElement}catch(t){e=document.body||null}for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;return e}function P(e,t){var r=e.className;A(t).test(r)||(e.className+=(r?" ":"")+t)}function K(e,t){for(var r=e.split(" "),i=0;i<r.length;i++)r[i]&&!A(r[i]).test(t)&&(t+=" "+r[i]);return t}var V=function(e){e.select()};d?V=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:G&&(V=function(e){try{e.select()}catch(t){}});function U(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function S(e,t,r){t||(t={});for(var i in e)e.hasOwnProperty(i)&&(r!==!1||!t.hasOwnProperty(i))&&(t[i]=e[i]);return t}function X(e,t,r,i,n){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var L=i||0,j=n||0;;){var Y=e.indexOf(" ",L);if(Y<0||Y>=t)return j+(t-L);j+=Y-L,j+=r-j%r,L=Y+1}}var ee=function(){this.id=null,this.f=null,this.time=0,this.handler=U(this.onTimeout,this)};ee.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},ee.prototype.set=function(e,t){this.f=t;var r=+new Date+e;(!this.id||r<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=r)};function ae(e,t){for(var r=0;r<e.length;++r)if(e[r]==t)return r;return-1}var de=50,Ae={toString:function(){return"CodeMirror.Pass"}},Ee={scroll:!1},we={origin:"*mouse"},he={origin:"+move"};function ce(e,t,r){for(var i=0,n=0;;){var L=e.indexOf(" ",i);L==-1&&(L=e.length);var j=L-i;if(L==e.length||n+j>=t)return i+Math.min(j,t-n);if(n+=L-i,n+=r-n%r,i=L+1,n>=t)return i}}var se=[""];function re(e){for(;se.length<=e;)se.push(xe(se)+" ");return se[e]}function xe(e){return e[e.length-1]}function be(e,t){for(var r=[],i=0;i<e.length;i++)r[i]=t(e[i],i);return r}function ke(e,t,r){for(var i=0,n=r(t);i<e.length&&r(e[i])<=n;)i++;e.splice(i,0,t)}function Oe(){}function Be(e,t){var r;return Object.create?r=Object.create(e):(Oe.prototype=e,r=new Oe),t&&S(t,r),r}var Ce=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function De(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||Ce.test(e))}function Ne(e,t){return t?t.source.indexOf("\\w")>-1&&De(e)?!0:t.test(e):De(e)}function Ke(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 je(e){return e.charCodeAt(0)>=768&&Fe.test(e)}function Me(e,t,r){for(;(r<0?t>0:t<e.length)&&je(e.charAt(t));)t+=r;return t}function et(e,t,r){for(var i=t>r?-1:1;;){if(t==r)return t;var n=(t+r)/2,L=i<0?Math.ceil(n):Math.floor(n);if(L==t)return e(L)?t:r;e(L)?r=L:t=L+i}}function Je(e,t,r,i){if(!e)return i(t,r,"ltr",0);for(var n=!1,L=0;L<e.length;++L){var j=e[L];(j.from<r&&j.to>t||t==r&&j.to==t)&&(i(Math.max(j.from,t),Math.min(j.to,r),j.level==1?"rtl":"ltr",L),n=!0)}n||i(t,r,"ltr")}var qe=null;function Ze(e,t,r){var i;qe=null;for(var n=0;n<e.length;++n){var L=e[n];if(L.from<t&&L.to>t)return n;L.to==t&&(L.from!=L.to&&r=="before"?i=n:qe=n),L.from==t&&(L.from!=L.to&&r!="before"?i=n:qe=n)}return i!=null?i:qe}var dt=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function r(q){return q<=247?e.charAt(q):1424<=q&&q<=1524?"R":1536<=q&&q<=1785?t.charAt(q-1536):1774<=q&&q<=2220?"r":8192<=q&&q<=8203?"w":q==8204?"b":"L"}var i=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,n=/[stwN]/,L=/[LRr]/,j=/[Lb1n]/,Y=/[1n]/;function Q(q,ue,fe){this.level=q,this.from=ue,this.to=fe}return function(q,ue){var fe=ue=="ltr"?"L":"R";if(q.length==0||ue=="ltr"&&!i.test(q))return!1;for(var Se=q.length,Te=[],Pe=0;Pe<Se;++Pe)Te.push(r(q.charCodeAt(Pe)));for(var ze=0,$e=fe;ze<Se;++ze){var rt=Te[ze];rt=="m"?Te[ze]=$e:$e=rt}for(var lt=0,nt=fe;lt<Se;++lt){var ht=Te[lt];ht=="1"&&nt=="r"?Te[lt]="n":L.test(ht)&&(nt=ht,ht=="r"&&(Te[lt]="R"))}for(var Et=1,vt=Te[0];Et<Se-1;++Et){var At=Te[Et];At=="+"&&vt=="1"&&Te[Et+1]=="1"?Te[Et]="1":At==","&&vt==Te[Et+1]&&(vt=="1"||vt=="n")&&(Te[Et]=vt),vt=At}for(var Xt=0;Xt<Se;++Xt){var ci=Te[Xt];if(ci==",")Te[Xt]="N";else if(ci=="%"){var Zt=void 0;for(Zt=Xt+1;Zt<Se&&Te[Zt]=="%";++Zt);for(var Fi=Xt&&Te[Xt-1]=="!"||Zt<Se&&Te[Zt]=="1"?"1":"N",Ii=Xt;Ii<Zt;++Ii)Te[Ii]=Fi;Xt=Zt-1}}for(var ni=0,ki=fe;ni<Se;++ni){var gi=Te[ni];ki=="L"&&gi=="1"?Te[ni]="L":L.test(gi)&&(ki=gi)}for(var oi=0;oi<Se;++oi)if(n.test(Te[oi])){var ai=void 0;for(ai=oi+1;ai<Se&&n.test(Te[ai]);++ai);for(var ei=(oi?Te[oi-1]:fe)=="L",Di=(ai<Se?Te[ai]:fe)=="L",un=ei==Di?ei?"L":"R":fe,Lr=oi;Lr<ai;++Lr)Te[Lr]=un;oi=ai-1}for(var xi=[],sr,fi=0;fi<Se;)if(j.test(Te[fi])){var Va=fi;for(++fi;fi<Se&&j.test(Te[fi]);++fi);xi.push(new Q(0,Va,fi))}else{var cr=fi,Wr=xi.length,Gr=ue=="rtl"?1:0;for(++fi;fi<Se&&Te[fi]!="L";++fi);for(var Ci=cr;Ci<fi;)if(Y.test(Te[Ci])){cr<Ci&&(xi.splice(Wr,0,new Q(1,cr,Ci)),Wr+=Gr);var hn=Ci;for(++Ci;Ci<fi&&Y.test(Te[Ci]);++Ci);xi.splice(Wr,0,new Q(2,hn,Ci)),Wr+=Gr,cr=Ci}else++Ci;cr<fi&&xi.splice(Wr,0,new Q(1,cr,fi))}return ue=="ltr"&&(xi[0].level==1&&(sr=q.match(/^\s+/))&&(xi[0].from=sr[0].length,xi.unshift(new Q(0,0,sr[0].length))),xe(xi).level==1&&(sr=q.match(/\s+$/))&&(xe(xi).to-=sr[0].length,xi.push(new Q(0,Se-sr[0].length,Se)))),ue=="rtl"?xi.reverse():xi}}();function Xe(e,t){var r=e.order;return r==null&&(r=e.order=dt(e.text,t)),r}var Ye=[],Ie=function(e,t,r){if(e.addEventListener)e.addEventListener(t,r,!1);else if(e.attachEvent)e.attachEvent("on"+t,r);else{var i=e._handlers||(e._handlers={});i[t]=(i[t]||Ye).concat(r)}};function ot(e,t){return e._handlers&&e._handlers[t]||Ye}function tt(e,t,r){if(e.removeEventListener)e.removeEventListener(t,r,!1);else if(e.detachEvent)e.detachEvent("on"+t,r);else{var i=e._handlers,n=i&&i[t];if(n){var L=ae(n,r);L>-1&&(i[t]=n.slice(0,L).concat(n.slice(L+1)))}}}function Re(e,t){var r=ot(e,t);if(!r.length)return;for(var i=Array.prototype.slice.call(arguments,2),n=0;n<r.length;++n)r[n].apply(null,i)}function We(e,t,r){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Re(e,r||t.type,e,t),le(t)||t.codemirrorIgnore}function _e(e){var t=e._handlers&&e._handlers.cursorActivity;if(!t)return;for(var r=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),i=0;i<t.length;++i)ae(r,t[i])==-1&&r.push(t[i])}function me(e,t){return ot(e,t).length>0}function ve(e){e.prototype.on=function(t,r){Ie(this,t,r)},e.prototype.off=function(t,r){tt(this,t,r)}}function te(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function ie(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function le(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function pe(e){te(e),ie(e)}function ye(e){return e.target||e.srcElement}function Le(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),l&&e.ctrlKey&&t==1&&(t=3),t}var He=function(){if(G&&H<9)return!1;var e=u("div");return"draggable"in e||"dragDrop"in e}(),st;function ct(e){if(st==null){var t=u("span","\u200B");b(e,u("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(st=t.offsetWidth<=1&&t.offsetHeight>2&&!(G&&H<8))}var r=st?u("span","\u200B"):u("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}var ft;function Ct(e){if(ft!=null)return ft;var t=b(e,document.createTextNode("A\u062EA")),r=m(t,0,1).getBoundingClientRect(),i=m(t,1,2).getBoundingClientRect();return E(e),!r||r.left==r.right?!1:ft=i.right-r.right<3}var xt=`
b`.split(/\n/).length!=3?function(e){for(var t=0,r=[],i=e.length;t<=i;){var n=e.indexOf(`
`,t);n==-1&&(n=e.length);var L=e.slice(t,e.charAt(n-1)=="\r"?n-1:n),j=L.indexOf("\r");j!=-1?(r.push(L.slice(0,j)),t+=j+1):(r.push(L),t=n+1)}return r}:function(e){return e.split(/\r\n?|\n/)},ut=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(r){}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},Bt=function(){var e=u("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),Pt=null;function Jt(e){if(Pt!=null)return Pt;var t=b(e,u("span","x")),r=t.getBoundingClientRect(),i=m(t,0,1).getBoundingClientRect();return Pt=Math.abs(r.left-i.left)>1}var Yt={},Rt={};function Ti(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Yt[e]=t}function Bi(e,t){Rt[e]=t}function Qe(e){if(typeof e=="string"&&Rt.hasOwnProperty(e))e=Rt[e];else if(e&&typeof e.name=="string"&&Rt.hasOwnProperty(e.name)){var t=Rt[e.name];typeof t=="string"&&(t={name:t}),e=Be(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return 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 wt(e,t){t=Qe(t);var r=Yt[t.name];if(!r)return wt(e,"text/plain");var i=r(e,t);if(Ot.hasOwnProperty(t.name)){var n=Ot[t.name];for(var L in n){if(!n.hasOwnProperty(L))continue;i.hasOwnProperty(L)&&(i["_"+L]=i[L]),i[L]=n[L]}}if(i.name=t.name,t.helperType&&(i.helperType=t.helperType),t.modeProps)for(var j in t.modeProps)i[j]=t.modeProps[j];return i}var Ot={};function Lt(e,t){var r=Ot.hasOwnProperty(e)?Ot[e]:Ot[e]={};S(t,r)}function qt(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var r={};for(var i in t){var n=t[i];n instanceof Array&&(n=n.concat([])),r[i]=n}return r}function qi(e,t){for(var r;e.innerMode&&!(r=e.innerMode(t),!r||r.mode==e);)t=r.state,e=r.mode;return r||{mode:e,state:t}}function er(e,t,r){return e.startState?e.startState(t,r):!0}var Ut=function(e,t,r){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=r};Ut.prototype.eol=function(){return this.pos>=this.string.length},Ut.prototype.sol=function(){return this.pos==this.lineStart},Ut.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Ut.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Ut.prototype.eat=function(e){var t=this.string.charAt(this.pos),r;if(typeof e=="string"?r=t==e:r=t&&(e.test?e.test(t):e(t)),r)return++this.pos,t},Ut.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Ut.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Ut.prototype.skipToEnd=function(){this.pos=this.string.length},Ut.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Ut.prototype.backUp=function(e){this.pos-=e},Ut.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=X(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?X(this.string,this.lineStart,this.tabSize):0)},Ut.prototype.indentation=function(){return X(this.string,null,this.tabSize)-(this.lineStart?X(this.string,this.lineStart,this.tabSize):0)},Ut.prototype.match=function(e,t,r){if(typeof e=="string"){var i=function(j){return r?j.toLowerCase():j},n=this.string.substr(this.pos,e.length);if(i(n)==i(e))return t!==!1&&(this.pos+=e.length),!0}else{var L=this.string.slice(this.pos).match(e);return L&&L.index>0?null:(L&&t!==!1&&(this.pos+=L[0].length),L)}},Ut.prototype.current=function(){return this.string.slice(this.start,this.pos)},Ut.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Ut.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Ut.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function pt(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var r=e;!r.lines;)for(var i=0;;++i){var n=r.children[i],L=n.chunkSize();if(t<L){r=n;break}t-=L}return r.lines[t]}function Gi(e,t,r){var i=[],n=t.line;return e.iter(t.line,r.line+1,function(L){var j=L.text;n==r.line&&(j=j.slice(0,r.ch)),n==t.line&&(j=j.slice(t.ch)),i.push(j),++n}),i}function tr(e,t,r){var i=[];return e.iter(t,r,function(n){i.push(n.text)}),i}function vi(e,t){var r=t-e.height;if(r)for(var i=e;i;i=i.parent)i.height+=r}function kt(e){if(e.parent==null)return null;for(var t=e.parent,r=ae(t.lines,e),i=t.parent;i;t=i,i=i.parent)for(var n=0;!(i.children[n]==t);++n)r+=i.children[n].chunkSize();return r+t.first}function Ui(e,t){var r=e.first;e:do{for(var i=0;i<e.children.length;++i){var n=e.children[i],L=n.height;if(t<L){e=n;continue e}t-=L,r+=n.chunkSize()}return r}while(!e.lines);for(var j=0;j<e.lines.length;++j){var Y=e.lines[j],Q=Y.height;if(t<Q)break;t-=Q}return r+j}function Vi(e,t){return t>=e.first&&t<e.first+e.size}function fr(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function Ve(e,t,r){if(r===void 0&&(r=null),!(this instanceof Ve))return new Ve(e,t,r);this.line=e,this.ch=t,this.sticky=r}function Tt(e,t){return e.line-t.line||e.ch-t.ch}function pr(e,t){return e.sticky==t.sticky&&Tt(e,t)==0}function mr(e){return Ve(e.line,e.ch)}function gr(e,t){return Tt(e,t)<0?t:e}function vr(e,t){return Tt(e,t)<0?e:t}function z(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function y(e,t){if(t.line<e.first)return Ve(e.first,0);var r=e.first+e.size-1;return t.line>r?Ve(r,pt(e,r).text.length):C(t,pt(e,t.line).text.length)}function C(e,t){var r=e.ch;return r==null||r>t?Ve(e.line,t):r<0?Ve(e.line,0):e}function N(e,t){for(var r=[],i=0;i<t.length;i++)r[i]=y(e,t[i]);return r}var Z=function(e,t){this.state=e,this.lookAhead=t},W=function(e,t,r,i){this.state=t,this.doc=e,this.line=r,this.maxLookAhead=i||0,this.baseTokens=null,this.baseTokenPos=1};W.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},W.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},W.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},W.fromSaved=function(e,t,r){return t instanceof Z?new W(e,qt(e.mode,t.state),r,t.lookAhead):new W(e,qt(e.mode,t),r)},W.prototype.save=function(e){var t=e!==!1?qt(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Z(t,this.maxLookAhead):t};function ge(e,t,r,i){var n=[e.state.modeGen],L={};yi(e,t.text,e.doc.mode,r,function(q,ue){return n.push(q,ue)},L,i);for(var j=r.state,Y=function(q){r.baseTokens=n;var ue=e.state.overlays[q],fe=1,Se=0;r.state=!0,yi(e,t.text,ue.mode,r,function(Te,Pe){for(var ze=fe;Se<Te;){var $e=n[fe];$e>Te&&n.splice(fe,1,Te,n[fe+1],$e),fe+=2,Se=Math.min(Te,$e)}if(!Pe)return;if(ue.opaque)n.splice(ze,fe-ze,Te,"overlay "+Pe),fe=ze+2;else for(;ze<fe;ze+=2){var rt=n[ze+1];n[ze+1]=(rt?rt+" ":"")+"overlay "+Pe}},L),r.state=j,r.baseTokens=null,r.baseTokenPos=1},Q=0;Q<e.state.overlays.length;++Q)Y(Q);return{styles:n,classes:L.bgClass||L.textClass?L:null}}function Ue(e,t,r){if(!t.styles||t.styles[0]!=e.state.modeGen){var i=it(e,kt(t)),n=t.text.length>e.options.maxHighlightLength&&qt(e.doc.mode,i.state),L=ge(e,t,i);n&&(i.state=n),t.stateAfter=i.save(!n),t.styles=L.styles,L.classes?t.styleClasses=L.classes:t.styleClasses&&(t.styleClasses=null),r===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function it(e,t,r){var i=e.doc,n=e.display;if(!i.mode.startState)return new W(i,!0,t);var L=bi(e,t,r),j=L>i.first&&pt(i,L-1).stateAfter,Y=j?W.fromSaved(i,j,L):new W(i,er(i.mode),L);return i.iter(L,t,function(Q){mt(e,Q.text,Y);var q=Y.line;Q.stateAfter=q==t-1||q%5==0||q>=n.viewFrom&&q<n.viewTo?Y.save():null,Y.nextLine()}),r&&(i.modeFrontier=Y.line),Y}function mt(e,t,r,i){var n=e.doc.mode,L=new Ut(t,e.options.tabSize,r);for(L.start=L.pos=i||0,t==""&&Ge(n,r.state);!L.eol();)bt(n,L,r.state),L.start=L.pos}function Ge(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var r=qi(e,t);if(r.mode.blankLine)return r.mode.blankLine(r.state)}function bt(e,t,r,i){for(var n=0;n<10;n++){i&&(i[0]=qi(e,r).mode);var L=e.token(t,r);if(t.pos>t.start)return L}throw new Error("Mode "+e.name+" failed to advance stream.")}var Ht=function(e,t,r){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=r};function $t(e,t,r,i){var n=e.doc,L=n.mode,j;t=y(n,t);var Y=pt(n,t.line),Q=it(e,t.line,r),q=new Ut(Y.text,e.options.tabSize,Q),ue;for(i&&(ue=[]);(i||q.pos<t.ch)&&!q.eol();)q.start=q.pos,j=bt(L,q,Q.state),i&&ue.push(new Ht(q,j,qt(n.mode,Q.state)));return i?ue:new Ht(q,j,Q.state)}function Mi(e,t){if(e)for(;;){var r=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!r)break;e=e.slice(0,r.index)+e.slice(r.index+r[0].length);var i=r[1]?"bgClass":"textClass";t[i]==null?t[i]=r[2]:new RegExp("(?:^|\\s)"+r[2]+"(?:$|\\s)").test(t[i])||(t[i]+=" "+r[2])}return e}function yi(e,t,r,i,n,L,j){var Y=r.flattenSpans;Y==null&&(Y=e.options.flattenSpans);var Q=0,q=null,ue=new Ut(t,e.options.tabSize,i),fe,Se=e.options.addModeClass&&[null];for(t==""&&Mi(Ge(r,i.state),L);!ue.eol();){if(ue.pos>e.options.maxHighlightLength?(Y=!1,j&&mt(e,t,i,ue.pos),ue.pos=t.length,fe=null):fe=Mi(bt(r,ue,i.state,Se),L),Se){var Te=Se[0].name;Te&&(fe="m-"+(fe?Te+" "+fe:Te))}if(!Y||q!=fe){for(;Q<ue.start;)Q=Math.min(ue.start,Q+5e3),n(Q,q);q=fe}ue.start=ue.pos}for(;Q<ue.pos;){var Pe=Math.min(ue.pos,Q+5e3);n(Pe,q),Q=Pe}}function bi(e,t,r){for(var i,n,L=e.doc,j=r?-1:t-(e.doc.mode.innerMode?1e3:100),Y=t;Y>j;--Y){if(Y<=L.first)return L.first;var Q=pt(L,Y-1),q=Q.stateAfter;if(q&&(!r||Y+(q instanceof Z?q.lookAhead:0)<=L.modeFrontier))return Y;var ue=X(Q.text,null,e.options.tabSize);(n==null||i>ue)&&(n=Y-1,i=ue)}return n}function Xi(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),e.highlightFrontier<t-10)return;for(var r=e.first,i=t-1;i>r;i--){var n=pt(e,i).stateAfter;if(n&&(!(n instanceof Z)||i+n.lookAhead<t)){r=i+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,r)}var Ir=!1,li=!1;function Hi(){Ir=!0}function or(){li=!0}function lr(e,t,r){this.marker=e,this.from=t,this.to=r}function Pi(e,t){if(e)for(var r=0;r<e.length;++r){var i=e[r];if(i.marker==t)return i}}function kr(e,t){for(var r,i=0;i<e.length;++i)e[i]!=t&&(r||(r=[])).push(e[i]);return r}function yr(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function zr(e,t,r){var i;if(e)for(var n=0;n<e.length;++n){var L=e[n],j=L.marker,Y=L.from==null||(j.inclusiveLeft?L.from<=t:L.from<t);if(Y||L.from==t&&j.type=="bookmark"&&(!r||!L.marker.insertLeft)){var Q=L.to==null||(j.inclusiveRight?L.to>=t:L.to>t);(i||(i=[])).push(new lr(j,L.from,Q?null:L.to))}}return i}function Kr(e,t,r){var i;if(e)for(var n=0;n<e.length;++n){var L=e[n],j=L.marker,Y=L.to==null||(j.inclusiveRight?L.to>=t:L.to>t);if(Y||L.from==t&&j.type=="bookmark"&&(!r||L.marker.insertLeft)){var Q=L.from==null||(j.inclusiveLeft?L.from<=t:L.from<t);(i||(i=[])).push(new lr(j,Q?null:L.from-t,L.to==null?null:L.to-t))}}return i}function Yi(e,t){if(t.full)return null;var r=Vi(e,t.from.line)&&pt(e,t.from.line).markedSpans,i=Vi(e,t.to.line)&&pt(e,t.to.line).markedSpans;if(!r&&!i)return null;var n=t.from.ch,L=t.to.ch,j=Tt(t.from,t.to)==0,Y=zr(r,n,j),Q=Kr(i,L,j),q=t.text.length==1,ue=xe(t.text).length+(q?n:0);if(Y)for(var fe=0;fe<Y.length;++fe){var Se=Y[fe];if(Se.to==null){var Te=Pi(Q,Se.marker);Te?q&&(Se.to=Te.to==null?null:Te.to+ue):Se.to=n}}if(Q)for(var Pe=0;Pe<Q.length;++Pe){var ze=Q[Pe];if(ze.to!=null&&(ze.to+=ue),ze.from==null){var $e=Pi(Y,ze.marker);$e||(ze.from=ue,q&&(Y||(Y=[])).push(ze))}else ze.from+=ue,q&&(Y||(Y=[])).push(ze)}Y&&(Y=zi(Y)),Q&&Q!=Y&&(Q=zi(Q));var rt=[Y];if(!q){var lt=t.text.length-2,nt;if(lt>0&&Y)for(var ht=0;ht<Y.length;++ht)Y[ht].to==null&&(nt||(nt=[])).push(new lr(Y[ht].marker,null,null));for(var Et=0;Et<lt;++Et)rt.push(nt);rt.push(Q)}return rt}function zi(e){for(var t=0;t<e.length;++t){var r=e[t];r.from!=null&&r.from==r.to&&r.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function br(e,t,r){var i=null;if(e.iter(t.line,r.line+1,function(Te){if(Te.markedSpans)for(var Pe=0;Pe<Te.markedSpans.length;++Pe){var ze=Te.markedSpans[Pe].marker;ze.readOnly&&(!i||ae(i,ze)==-1)&&(i||(i=[])).push(ze)}}),!i)return null;for(var n=[{from:t,to:r}],L=0;L<i.length;++L)for(var j=i[L],Y=j.find(0),Q=0;Q<n.length;++Q){var q=n[Q];if(Tt(q.to,Y.from)<0||Tt(q.from,Y.to)>0)continue;var ue=[Q,1],fe=Tt(q.from,Y.from),Se=Tt(q.to,Y.to);(fe<0||!j.inclusiveLeft&&!fe)&&ue.push({from:q.from,to:Y.from}),(Se>0||!j.inclusiveRight&&!Se)&&ue.push({from:Y.to,to:q.to}),n.splice.apply(n,ue),Q+=ue.length-3}return n}function dn(e){var t=e.markedSpans;if(!t)return;for(var r=0;r<t.length;++r)t[r].marker.detachLine(e);e.markedSpans=null}function _r(e,t){if(!t)return;for(var r=0;r<t.length;++r)t[r].marker.attachLine(e);e.markedSpans=t}function ti(e){return e.inclusiveLeft?-1:0}function jt(e){return e.inclusiveRight?1:0}function pi(e,t){var r=e.lines.length-t.lines.length;if(r!=0)return r;var i=e.find(),n=t.find(),L=Tt(i.from,n.from)||ti(e)-ti(t);if(L)return-L;var j=Tt(i.to,n.to)||jt(e)-jt(t);return j||t.id-e.id}function Dt(e,t){var r=li&&e.markedSpans,i;if(r)for(var n=void 0,L=0;L<r.length;++L)n=r[L],n.marker.collapsed&&(t?n.from:n.to)==null&&(!i||pi(i,n.marker)<0)&&(i=n.marker);return i}function ri(e){return Dt(e,!0)}function zt(e){return Dt(e,!1)}function ir(e,t){var r=li&&e.markedSpans,i;if(r)for(var n=0;n<r.length;++n){var L=r[n];L.marker.collapsed&&(L.from==null||L.from<t)&&(L.to==null||L.to>t)&&(!i||pi(i,L.marker)<0)&&(i=L.marker)}return i}function ui(e,t,r,i,n){var L=pt(e,t),j=li&&L.markedSpans;if(j)for(var Y=0;Y<j.length;++Y){var Q=j[Y];if(!Q.marker.collapsed)continue;var q=Q.marker.find(0),ue=Tt(q.from,r)||ti(Q.marker)-ti(n),fe=Tt(q.to,i)||jt(Q.marker)-jt(n);if(ue>=0&&fe<=0||ue<=0&&fe>=0)continue;if(ue<=0&&(Q.marker.inclusiveRight&&n.inclusiveLeft?Tt(q.to,r)>=0:Tt(q.to,r)>0)||ue>=0&&(Q.marker.inclusiveRight&&n.inclusiveLeft?Tt(q.from,i)<=0:Tt(q.from,i)<0))return!0}}function wi(e){for(var t;t=ri(e);)e=t.find(-1,!0).line;return e}function Vr(e){for(var t;t=zt(e);)e=t.find(1,!0).line;return e}function Er(e){for(var t,r;t=zt(e);)e=t.find(1,!0).line,(r||(r=[])).push(e);return r}function cn(e,t){var r=pt(e,t),i=wi(r);return r==i?t:kt(i)}function xr(e,t){if(t>e.lastLine())return t;var r=pt(e,t),i;if(!rr(e,r))return t;for(;i=zt(r);)r=i.find(1,!0).line;return kt(r)+1}function rr(e,t){var r=li&&t.markedSpans;if(r)for(var i=void 0,n=0;n<r.length;++n){if(i=r[n],!i.marker.collapsed)continue;if(i.from==null)return!0;if(i.marker.widgetNode)continue;if(i.from==0&&i.marker.inclusiveLeft&&fn(e,t,i))return!0}}function fn(e,t,r){if(r.to==null){var i=r.marker.find(1,!0);return fn(e,i.line,Pi(i.line.markedSpans,r.marker))}if(r.marker.inclusiveRight&&r.to==t.text.length)return!0;for(var n=void 0,L=0;L<t.markedSpans.length;++L)if(n=t.markedSpans[L],n.marker.collapsed&&!n.marker.widgetNode&&n.from==r.to&&(n.to==null||n.to!=r.from)&&(n.marker.inclusiveLeft||r.marker.inclusiveRight)&&fn(e,t,n))return!0}function $i(e){e=wi(e);for(var t=0,r=e.parent,i=0;i<r.lines.length;++i){var n=r.lines[i];if(n==e)break;t+=n.height}for(var L=r.parent;L;r=L,L=r.parent)for(var j=0;j<L.children.length;++j){var Y=L.children[j];if(Y==r)break;t+=Y.height}return t}function pn(e){if(e.height==0)return 0;for(var t=e.text.length,r,i=e;r=ri(i);){var n=r.find(0,!0);i=n.from.line,t+=n.from.ch-n.to.ch}for(i=e;r=zt(i);){var L=r.find(0,!0);t-=i.text.length-L.from.ch,i=L.to.line,t+=i.text.length-L.to.ch}return t}function Hn(e){var t=e.display,r=e.doc;t.maxLine=pt(r,r.first),t.maxLineLength=pn(t.maxLine),t.maxLineChanged=!0,r.iter(function(i){var n=pn(i);n>t.maxLineLength&&(t.maxLineLength=n,t.maxLine=i)})}var Dr=function(e,t,r){this.text=e,_r(this,t),this.height=r?r(this):1};Dr.prototype.lineNo=function(){return kt(this)},ve(Dr);function ua(e,t,r,i){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),dn(e),_r(e,r);var n=i?i(e):1;n!=e.height&&vi(e,n)}function gt(e){e.parent=null,dn(e)}var St={},_t={};function It(e,t){if(!e||/^\s*$/.test(e))return null;var r=t.addModeClass?_t:St;return r[e]||(r[e]=e.replace(/\S+/g,"cm-$&"))}function Ft(e,t){var r=_("span",null,null,D?"padding-right: .1px":null),i={pre:_("pre",[r],"CodeMirror-line"),content:r,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var n=0;n<=(t.rest?t.rest.length:0);n++){var L=n?t.rest[n-1]:t.line,j=void 0;i.pos=0,i.addToken=Nt,Ct(e.display.measure)&&(j=Xe(L,e.doc.direction))&&(i.addToken=Ai(i.addToken,j)),i.map=[];var Y=t!=e.display.externalMeasured&&kt(L);ur(L,i,Ue(e,L,Y)),L.styleClasses&&(L.styleClasses.bgClass&&(i.bgClass=K(L.styleClasses.bgClass,i.bgClass||"")),L.styleClasses.textClass&&(i.textClass=K(L.styleClasses.textClass,i.textClass||""))),i.map.length==0&&i.map.push(0,0,i.content.appendChild(ct(e.display.measure))),n==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(D){var Q=i.content.lastChild;(/\bcm-tab\b/.test(Q.className)||Q.querySelector&&Q.querySelector(".cm-tab"))&&(i.content.className="cm-tab-wrap-hack")}return Re(e,"renderLine",e,t.line,i.pre),i.pre.className&&(i.textClass=K(i.pre.className,i.textClass||"")),i}function Vt(e){var t=u("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Nt(e,t,r,i,n,L,j){if(!t)return;var Y=e.splitSpaces?si(t,e.trailingSpace):t,Q=e.cm.state.specialChars,q=!1,ue;if(!Q.test(t))e.col+=t.length,ue=document.createTextNode(Y),e.map.push(e.pos,e.pos+t.length,ue),G&&H<9&&(q=!0),e.pos+=t.length;else{ue=document.createDocumentFragment();for(var fe=0;;){Q.lastIndex=fe;var Se=Q.exec(t),Te=Se?Se.index-fe:t.length-fe;if(Te){var Pe=document.createTextNode(Y.slice(fe,fe+Te));G&&H<9?ue.appendChild(u("span",[Pe])):ue.appendChild(Pe),e.map.push(e.pos,e.pos+Te,Pe),e.col+=Te,e.pos+=Te}if(!Se)break;fe+=Te+1;var ze=void 0;if(Se[0]==" "){var $e=e.cm.options.tabSize,rt=$e-e.col%$e;ze=ue.appendChild(u("span",re(rt),"cm-tab")),ze.setAttribute("role","presentation"),ze.setAttribute("cm-text"," "),e.col+=rt}else Se[0]=="\r"||Se[0]==`
`?(ze=ue.appendChild(u("span",Se[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),ze.setAttribute("cm-text",Se[0]),e.col+=1):(ze=e.cm.options.specialCharPlaceholder(Se[0]),ze.setAttribute("cm-text",Se[0]),G&&H<9?ue.appendChild(u("span",[ze])):ue.appendChild(ze),e.col+=1);e.map.push(e.pos,e.pos+1,ze),e.pos++}}if(e.trailingSpace=Y.charCodeAt(t.length-1)==32,r||i||n||q||L||j){var lt=r||"";i&&(lt+=i),n&&(lt+=n);var nt=u("span",[ue],lt,L);if(j)for(var ht in j)j.hasOwnProperty(ht)&&ht!="style"&&ht!="class"&&nt.setAttribute(ht,j[ht]);return e.content.appendChild(nt)}e.content.appendChild(ue)}function si(e,t){if(e.length>1&&!/ /.test(e))return e;for(var r=t,i="",n=0;n<e.length;n++){var L=e.charAt(n);L==" "&&r&&(n==e.length-1||e.charCodeAt(n+1)==32)&&(L="\xA0"),i+=L,r=L==" "}return i}function Ai(e,t){return function(r,i,n,L,j,Y,Q){n=n?n+" cm-force-border":"cm-force-border";for(var q=r.pos,ue=q+i.length;;){for(var fe=void 0,Se=0;Se<t.length&&!(fe=t[Se],fe.to>q&&fe.from<=q);Se++);if(fe.to>=ue)return e(r,i,n,L,j,Y,Q);e(r,i.slice(0,fe.to-q),n,L,null,Y,Q),L=null,i=i.slice(fe.to-q),q=fe.to}}}function Mt(e,t,r,i){var n=!i&&r.widgetNode;n&&e.map.push(e.pos,e.pos+t,n),!i&&e.cm.display.input.needsContentAttribute&&(n||(n=e.content.appendChild(document.createElement("span"))),n.setAttribute("cm-marker",r.id)),n&&(e.cm.display.input.setUneditable(n),e.content.appendChild(n)),e.pos+=t,e.trailingSpace=!1}function ur(e,t,r){var i=e.markedSpans,n=e.text,L=0;if(!i){for(var j=1;j<r.length;j+=2)t.addToken(t,n.slice(L,L=r[j]),It(r[j+1],t.cm.options));return}for(var Y=n.length,Q=0,q=1,ue="",fe,Se,Te=0,Pe,ze,$e,rt,lt;;){if(Te==Q){Pe=ze=$e=Se="",lt=null,rt=null,Te=Infinity;for(var nt=[],ht=void 0,Et=0;Et<i.length;++Et){var vt=i[Et],At=vt.marker;if(At.type=="bookmark"&&vt.from==Q&&At.widgetNode)nt.push(At);else if(vt.from<=Q&&(vt.to==null||vt.to>Q||At.collapsed&&vt.to==Q&&vt.from==Q)){if(vt.to!=null&&vt.to!=Q&&Te>vt.to&&(Te=vt.to,ze=""),At.className&&(Pe+=" "+At.className),At.css&&(Se=(Se?Se+";":"")+At.css),At.startStyle&&vt.from==Q&&($e+=" "+At.startStyle),At.endStyle&&vt.to==Te&&(ht||(ht=[])).push(At.endStyle,vt.to),At.title&&((lt||(lt={})).title=At.title),At.attributes)for(var Xt in At.attributes)(lt||(lt={}))[Xt]=At.attributes[Xt];At.collapsed&&(!rt||pi(rt.marker,At)<0)&&(rt=vt)}else vt.from>Q&&Te>vt.from&&(Te=vt.from)}if(ht)for(var ci=0;ci<ht.length;ci+=2)ht[ci+1]==Te&&(ze+=" "+ht[ci]);if(!rt||rt.from==Q)for(var Zt=0;Zt<nt.length;++Zt)Mt(t,0,nt[Zt]);if(rt&&(rt.from||0)==Q){if(Mt(t,(rt.to==null?Y+1:rt.to)-Q,rt.marker,rt.from==null),rt.to==null)return;rt.to==Q&&(rt=!1)}}if(Q>=Y)break;for(var Fi=Math.min(Y,Te);;){if(ue){var Ii=Q+ue.length;if(!rt){var ni=Ii>Fi?ue.slice(0,Fi-Q):ue;t.addToken(t,ni,fe?fe+Pe:Pe,$e,Q+ni.length==Te?ze:"",Se,lt)}if(Ii>=Fi){ue=ue.slice(Fi-Q),Q=Fi;break}Q=Ii,$e=""}ue=n.slice(L,L=r[q++]),fe=It(r[q++],t.cm.options)}}}function Wt(e,t,r){this.line=t,this.rest=Er(t),this.size=this.rest?kt(xe(this.rest))-r+1:1,this.node=this.text=null,this.hidden=rr(e,t)}function Oi(e,t,r){for(var i=[],n,L=t;L<r;L=n){var j=new Wt(e.doc,pt(e.doc,L),L);n=L+j.size,i.push(j)}return i}var _i=null;function Ki(e){_i?_i.ops.push(e):e.ownsGroup=_i={ops:[e],delayedCallbacks:[]}}function Lo(e){var t=e.delayedCallbacks,r=0;do{for(;r<t.length;r++)t[r].call(null);for(var i=0;i<e.ops.length;i++){var n=e.ops[i];if(n.cursorActivityHandlers)for(;n.cursorActivityCalled<n.cursorActivityHandlers.length;)n.cursorActivityHandlers[n.cursorActivityCalled++].call(null,n.cm)}}while(r<t.length)}function Io(e,t){var r=e.ownsGroup;if(!r)return;try{Lo(r)}finally{_i=null,t(r)}}var mn=null;function mi(e,t){var r=ot(e,t);if(!r.length)return;var i=Array.prototype.slice.call(arguments,2),n;_i?n=_i.delayedCallbacks:mn?n=mn:(n=mn=[],setTimeout(ko,0));for(var L=function(Y){n.push(function(){return r[Y].apply(null,i)})},j=0;j<r.length;++j)L(j)}function ko(){var e=mn;mn=null;for(var t=0;t<e.length;++t)e[t]()}function Ya(e,t,r,i){for(var n=0;n<t.changes.length;n++){var L=t.changes[n];L=="text"?Mo(e,t):L=="gutter"?Qa(e,t,r,i):L=="class"?ha(e,t):L=="widget"&&Po(e,t,i)}t.changes=null}function gn(e){return e.node==e.text&&(e.node=u("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),G&&H<8&&(e.node.style.zIndex=2)),e.node}function Do(e,t){var r=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(r&&(r+=" CodeMirror-linebackground"),t.background)r?t.background.className=r:(t.background.parentNode.removeChild(t.background),t.background=null);else if(r){var i=gn(t);t.background=i.insertBefore(u("div",null,r),i.firstChild),e.display.input.setUneditable(t.background)}}function $a(e,t){var r=e.display.externalMeasured;return r&&r.line==t.line?(e.display.externalMeasured=null,t.measure=r.measure,r.built):Ft(e,t)}function Mo(e,t){var r=t.text.className,i=$a(e,t);t.text==t.node&&(t.node=i.pre),t.text.parentNode.replaceChild(i.pre,t.text),t.text=i.pre,i.bgClass!=t.bgClass||i.textClass!=t.textClass?(t.bgClass=i.bgClass,t.textClass=i.textClass,ha(e,t)):r&&(t.text.className=r)}function ha(e,t){Do(e,t),t.line.wrapClass?gn(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var r=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=r||""}function Qa(e,t,r,i){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var n=gn(t);t.gutterBackground=u("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?i.fixedPos:-i.gutterTotalWidth)+"px; width: "+i.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),n.insertBefore(t.gutterBackground,t.text)}var L=t.line.gutterMarkers;if(e.options.lineNumbers||L){var j=gn(t),Y=t.gutter=u("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?i.fixedPos:-i.gutterTotalWidth)+"px");if(e.display.input.setUneditable(Y),j.insertBefore(Y,t.text),t.line.gutterClass&&(Y.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!L||!L["CodeMirror-linenumbers"])&&(t.lineNumber=Y.appendChild(u("div",fr(e.options,r),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+i.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),L)for(var Q=0;Q<e.display.gutterSpecs.length;++Q){var q=e.display.gutterSpecs[Q].className,ue=L.hasOwnProperty(q)&&L[q];ue&&Y.appendChild(u("div",[ue],"CodeMirror-gutter-elt","left: "+i.gutterLeft[q]+"px; width: "+i.gutterWidth[q]+"px"))}}}function Po(e,t,r){t.alignable&&(t.alignable=null);for(var i=A("CodeMirror-linewidget"),n=t.node.firstChild,L=void 0;n;n=L)L=n.nextSibling,i.test(n.className)&&t.node.removeChild(n);Ja(e,t,r)}function No(e,t,r,i){var n=$a(e,t);return t.text=t.node=n.pre,n.bgClass&&(t.bgClass=n.bgClass),n.textClass&&(t.textClass=n.textClass),ha(e,t),Qa(e,t,r,i),Ja(e,t,i),t.node}function Ja(e,t,r){if(Za(e,t.line,t,r,!0),t.rest)for(var i=0;i<t.rest.length;i++)Za(e,t.rest[i],t,r,!1)}function Za(e,t,r,i,n){if(!t.widgets)return;for(var L=gn(r),j=0,Y=t.widgets;j<Y.length;++j){var Q=Y[j],q=u("div",[Q.node],"CodeMirror-linewidget"+(Q.className?" "+Q.className:""));Q.handleMouseEvents||q.setAttribute("cm-ignore-events","true"),Fo(Q,q,r,i),e.display.input.setUneditable(q),n&&Q.above?L.insertBefore(q,r.gutter||r.text):L.appendChild(q),mi(Q,"redraw")}}function Fo(e,t,r,i){if(e.noHScroll){(r.alignable||(r.alignable=[])).push(t);var n=i.wrapperWidth;t.style.left=i.fixedPos+"px",e.coverGutter||(n-=i.gutterTotalWidth,t.style.paddingLeft=i.gutterTotalWidth+"px"),t.style.width=n+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-i.gutterTotalWidth+"px"))}function vn(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!v(document.body,e.node)){var r="position: relative;";e.coverGutter&&(r+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(r+="width: "+t.display.wrapper.clientWidth+"px;"),b(t.display.measure,u("div",[e.node],null,r))}return e.height=e.node.parentNode.offsetHeight}function hr(e,t){for(var r=ye(t);r!=e.wrapper;r=r.parentNode)if(!r||r.nodeType==1&&r.getAttribute("cm-ignore-events")=="true"||r.parentNode==e.sizer&&r!=e.mover)return!0}function jn(e){return e.lineSpace.offsetTop}function da(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function qa(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=b(e.measure,u("pre","x","CodeMirror-line-like")),r=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,i={left:parseInt(r.paddingLeft),right:parseInt(r.paddingRight)};return!isNaN(i.left)&&!isNaN(i.right)&&(e.cachedPaddingH=i),i}function nr(e){return de-e.display.nativeBarWidth}function Mr(e){return e.display.scroller.clientWidth-nr(e)-e.display.barWidth}function ca(e){return e.display.scroller.clientHeight-nr(e)-e.display.barHeight}function Bo(e,t,r){var i=e.options.lineWrapping,n=i&&Mr(e);if(!t.measure.heights||i&&t.measure.width!=n){var L=t.measure.heights=[];if(i){t.measure.width=n;for(var j=t.text.firstChild.getClientRects(),Y=0;Y<j.length-1;Y++){var Q=j[Y],q=j[Y+1];Math.abs(Q.bottom-q.bottom)>2&&L.push((Q.bottom+q.top)/2-r.top)}}L.push(r.bottom-r.top)}}function es(e,t,r){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var i=0;i<e.rest.length;i++)if(e.rest[i]==t)return{map:e.measure.maps[i],cache:e.measure.caches[i]};for(var n=0;n<e.rest.length;n++)if(kt(e.rest[n])>r)return{map:e.measure.maps[n],cache:e.measure.caches[n],before:!0}}function Uo(e,t){t=wi(t);var r=kt(t),i=e.display.externalMeasured=new Wt(e.doc,t,r);i.lineN=r;var n=i.built=Ft(e,i);return i.text=n.pre,b(e.display.lineMeasure,n.pre),i}function ts(e,t,r,i){return ar(e,Xr(e,t),r,i)}function fa(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[Fr(e,t)];var r=e.display.externalMeasured;if(r&&t>=r.lineN&&t<r.lineN+r.size)return r}function Xr(e,t){var r=kt(t),i=fa(e,r);i&&!i.text?i=null:i&&i.changes&&(Ya(e,i,r,ba(e)),e.curOp.forceUpdate=!0),i||(i=Uo(e,t));var n=es(i,t,r);return{line:t,view:i,rect:null,map:n.map,cache:n.cache,before:n.before,hasHeights:!1}}function ar(e,t,r,i,n){t.before&&(r=-1);var L=r+(i||""),j;return t.cache.hasOwnProperty(L)?j=t.cache[L]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Bo(e,t.view,t.rect),t.hasHeights=!0),j=jo(e,t,r,i),j.bogus||(t.cache[L]=j)),{left:j.left,right:j.right,top:n?j.rtop:j.top,bottom:n?j.rbottom:j.bottom}}var is={left:0,right:0,top:0,bottom:0};function rs(e,t,r){for(var i,n,L,j,Y,Q,q=0;q<e.length;q+=3)if(Y=e[q],Q=e[q+1],t<Y?(n=0,L=1,j="left"):t<Q?(n=t-Y,L=n+1):(q==e.length-3||t==Q&&e[q+3]>t)&&(L=Q-Y,n=L-1,t>=Q&&(j="right")),n!=null){if(i=e[q+2],Y==Q&&r==(i.insertLeft?"left":"right")&&(j=r),r=="left"&&n==0)for(;q&&e[q-2]==e[q-3]&&e[q-1].insertLeft;)i=e[(q-=3)+2],j="left";if(r=="right"&&n==Q-Y)for(;q<e.length-3&&e[q+3]==e[q+4]&&!e[q+5].insertLeft;)i=e[(q+=3)+2],j="right";break}return{node:i,start:n,end:L,collapse:j,coverStart:Y,coverEnd:Q}}function Ho(e,t){var r=is;if(t=="left")for(var i=0;i<e.length&&!((r=e[i]).left!=r.right);i++);else for(var n=e.length-1;n>=0&&!((r=e[n]).left!=r.right);n--);return r}function jo(e,t,r,i){var n=rs(t.map,r,i),L=n.node,j=n.start,Y=n.end,Q=n.collapse,q;if(L.nodeType==3){for(var ue=0;ue<4;ue++){for(;j&&je(t.line.text.charAt(n.coverStart+j));)--j;for(;n.coverStart+Y<n.coverEnd&&je(t.line.text.charAt(n.coverStart+Y));)++Y;if(G&&H<9&&j==0&&Y==n.coverEnd-n.coverStart?q=L.parentNode.getBoundingClientRect():q=Ho(m(L,j,Y).getClientRects(),i),q.left||q.right||j==0)break;Y=j,j=j-1,Q="right"}G&&H<11&&(q=Wo(e.display.measure,q))}else{j>0&&(Q=i="right");var fe;e.options.lineWrapping&&(fe=L.getClientRects()).length>1?q=fe[i=="right"?fe.length-1:0]:q=L.getBoundingClientRect()}if(G&&H<9&&!j&&(!q||!q.left&&!q.right)){var Se=L.parentNode.getClientRects()[0];Se?q={left:Se.left,right:Se.left+$r(e.display),top:Se.top,bottom:Se.bottom}:q=is}for(var Te=q.top-t.rect.top,Pe=q.bottom-t.rect.top,ze=(Te+Pe)/2,$e=t.view.measure.heights,rt=0;rt<$e.length-1&&!(ze<$e[rt]);rt++);var lt=rt?$e[rt-1]:0,nt=$e[rt],ht={left:(Q=="right"?q.right:q.left)-t.rect.left,right:(Q=="left"?q.left:q.right)-t.rect.left,top:lt,bottom:nt};return!q.left&&!q.right&&(ht.bogus=!0),e.options.singleCursorHeightPerLine||(ht.rtop=Te,ht.rbottom=Pe),ht}function Wo(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!Jt(e))return t;var r=screen.logicalXDPI/screen.deviceXDPI,i=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*r,right:t.right*r,top:t.top*i,bottom:t.bottom*i}}function ns(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function as(e){e.display.externalMeasure=null,E(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)ns(e.display.view[t])}function yn(e){as(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function ss(){return g&&s?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function os(){return g&&s?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function pa(e){var t=0;if(e.widgets)for(var r=0;r<e.widgets.length;++r)e.widgets[r].above&&(t+=vn(e.widgets[r]));return t}function Wn(e,t,r,i,n){if(!n){var L=pa(t);r.top+=L,r.bottom+=L}if(i=="line")return r;i||(i="local");var j=$i(t);if(i=="local"?j+=jn(e.display):j-=e.display.viewOffset,i=="page"||i=="window"){var Y=e.display.lineSpace.getBoundingClientRect();j+=Y.top+(i=="window"?0:os());var Q=Y.left+(i=="window"?0:ss());r.left+=Q,r.right+=Q}return r.top+=j,r.bottom+=j,r}function ls(e,t,r){if(r=="div")return t;var i=t.left,n=t.top;if(r=="page")i-=ss(),n-=os();else if(r=="local"||!r){var L=e.display.sizer.getBoundingClientRect();i+=L.left,n+=L.top}var j=e.display.lineSpace.getBoundingClientRect();return{left:i-j.left,top:n-j.top}}function ma(e,t,r,i,n){return i||(i=pt(e.doc,t.line)),Wn(e,i,ts(e,i,t.ch,n),r)}function Qi(e,t,r,i,n,L){i=i||pt(e.doc,t.line),n||(n=Xr(e,i));function j(Pe,ze){var $e=ar(e,n,Pe,ze?"right":"left",L);return ze?$e.left=$e.right:$e.right=$e.left,Wn(e,i,$e,r)}var Y=Xe(i,e.doc.direction),Q=t.ch,q=t.sticky;if(Q>=i.text.length?(Q=i.text.length,q="before"):Q<=0&&(Q=0,q="after"),!Y)return j(q=="before"?Q-1:Q,q=="before");function ue(Pe,ze,$e){var rt=Y[ze],lt=rt.level==1;return j($e?Pe-1:Pe,lt!=$e)}var fe=Ze(Y,Q,q),Se=qe,Te=ue(Q,fe,q=="before");return Se!=null&&(Te.other=ue(Q,Se,q!="before")),Te}function us(e,t){var r=0;t=y(e.doc,t),e.options.lineWrapping||(r=$r(e.display)*t.ch);var i=pt(e.doc,t.line),n=$i(i)+jn(e.display);return{left:r,right:r,top:n,bottom:n+i.height}}function ga(e,t,r,i,n){var L=Ve(e,t,r);return L.xRel=n,i&&(L.outside=i),L}function va(e,t,r){var i=e.doc;if(r+=e.display.viewOffset,r<0)return ga(i.first,0,null,-1,-1);var n=Ui(i,r),L=i.first+i.size-1;if(n>L)return ga(i.first+i.size-1,pt(i,L).text.length,null,1,1);t<0&&(t=0);for(var j=pt(i,n);;){var Y=Go(e,j,n,t,r),Q=ir(j,Y.ch+(Y.xRel>0||Y.outside>0?1:0));if(!Q)return Y;var q=Q.find(1);if(q.line==n)return q;j=pt(i,n=q.line)}}function hs(e,t,r,i){i-=pa(t);var n=t.text.length,L=et(function(j){return ar(e,r,j-1).bottom<=i},n,0);return n=et(function(j){return ar(e,r,j).top>i},L,n),{begin:L,end:n}}function ds(e,t,r,i){r||(r=Xr(e,t));var n=Wn(e,t,ar(e,r,i),"line").top;return hs(e,t,r,n)}function ya(e,t,r,i){return e.bottom<=r?!1:e.top>r?!0:(i?e.left:e.right)>t}function Go(e,t,r,i,n){n-=$i(t);var L=Xr(e,t),j=pa(t),Y=0,Q=t.text.length,q=!0,ue=Xe(t,e.doc.direction);if(ue){var fe=(e.options.lineWrapping?Ko:zo)(e,t,r,L,ue,i,n);q=fe.level!=1,Y=q?fe.from:fe.to-1,Q=q?fe.to:fe.from-1}var Se=null,Te=null,Pe=et(function(Et){var vt=ar(e,L,Et);return vt.top+=j,vt.bottom+=j,ya(vt,i,n,!1)?(vt.top<=n&&vt.left<=i&&(Se=Et,Te=vt),!0):!1},Y,Q),ze,$e,rt=!1;if(Te){var lt=i-Te.left<Te.right-i,nt=lt==q;Pe=Se+(nt?0:1),$e=nt?"after":"before",ze=lt?Te.left:Te.right}else{!q&&(Pe==Q||Pe==Y)&&Pe++,$e=Pe==0?"after":Pe==t.text.length?"before":ar(e,L,Pe-(q?1:0)).bottom+j<=n==q?"after":"before";var ht=Qi(e,Ve(r,Pe,$e),"line",t,L);ze=ht.left,rt=n<ht.top?-1:n>=ht.bottom?1:0}return Pe=Me(t.text,Pe,1),ga(r,Pe,$e,rt,i-ze)}function zo(e,t,r,i,n,L,j){var Y=et(function(fe){var Se=n[fe],Te=Se.level!=1;return ya(Qi(e,Ve(r,Te?Se.to:Se.from,Te?"before":"after"),"line",t,i),L,j,!0)},0,n.length-1),Q=n[Y];if(Y>0){var q=Q.level!=1,ue=Qi(e,Ve(r,q?Q.from:Q.to,q?"after":"before"),"line",t,i);ya(ue,L,j,!0)&&ue.top>j&&(Q=n[Y-1])}return Q}function Ko(e,t,r,i,n,L,j){var Y=hs(e,t,i,j),Q=Y.begin,q=Y.end;/\s/.test(t.text.charAt(q-1))&&q--;for(var ue=null,fe=null,Se=0;Se<n.length;Se++){var Te=n[Se];if(Te.from>=q||Te.to<=Q)continue;var Pe=Te.level!=1,ze=ar(e,i,Pe?Math.min(q,Te.to)-1:Math.max(Q,Te.from)).right,$e=ze<L?L-ze+1e9:ze-L;(!ue||fe>$e)&&(ue=Te,fe=$e)}return ue||(ue=n[n.length-1]),ue.from<Q&&(ue={from:Q,to:ue.to,level:ue.level}),ue.to>q&&(ue={from:ue.from,to:q,level:ue.level}),ue}var Pr;function Yr(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(Pr==null){Pr=u("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Pr.appendChild(document.createTextNode("x")),Pr.appendChild(u("br"));Pr.appendChild(document.createTextNode("x"))}b(e.measure,Pr);var r=Pr.offsetHeight/50;return r>3&&(e.cachedTextHeight=r),E(e.measure),r||1}function $r(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=u("span","xxxxxxxxxx"),r=u("pre",[t],"CodeMirror-line-like");b(e.measure,r);var i=t.getBoundingClientRect(),n=(i.right-i.left)/10;return n>2&&(e.cachedCharWidth=n),n||10}function ba(e){for(var t=e.display,r={},i={},n=t.gutters.clientLeft,L=t.gutters.firstChild,j=0;L;L=L.nextSibling,++j){var Y=e.display.gutterSpecs[j].className;r[Y]=L.offsetLeft+L.clientLeft+n,i[Y]=L.clientWidth}return{fixedPos:_a(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:r,gutterWidth:i,wrapperWidth:t.wrapper.clientWidth}}function _a(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function cs(e){var t=Yr(e.display),r=e.options.lineWrapping,i=r&&Math.max(5,e.display.scroller.clientWidth/$r(e.display)-3);return function(n){if(rr(e.doc,n))return 0;var L=0;if(n.widgets)for(var j=0;j<n.widgets.length;j++)n.widgets[j].height&&(L+=n.widgets[j].height);return r?L+(Math.ceil(n.text.length/i)||1)*t:L+t}}function Ea(e){var t=e.doc,r=cs(e);t.iter(function(i){var n=r(i);n!=i.height&&vi(i,n)})}function Nr(e,t,r,i){var n=e.display;if(!r&&ye(t).getAttribute("cm-not-content")=="true")return null;var L,j,Y=n.lineSpace.getBoundingClientRect();try{L=t.clientX-Y.left,j=t.clientY-Y.top}catch(fe){return null}var Q=va(e,L,j),q;if(i&&Q.xRel>0&&(q=pt(e.doc,Q.line).text).length==Q.ch){var ue=X(q,q.length,e.options.tabSize)-q.length;Q=Ve(Q.line,Math.max(0,Math.round((L-qa(e.display).left)/$r(e.display))-ue))}return Q}function Fr(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var r=e.display.view,i=0;i<r.length;i++)if(t-=r[i].size,t<0)return i}function Ri(e,t,r,i){t==null&&(t=e.doc.first),r==null&&(r=e.doc.first+e.doc.size),i||(i=0);var n=e.display;if(i&&r<n.viewTo&&(n.updateLineNumbers==null||n.updateLineNumbers>t)&&(n.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=n.viewTo)li&&cn(e.doc,t)<n.viewTo&&wr(e);else if(r<=n.viewFrom)li&&xr(e.doc,r+i)>n.viewFrom?wr(e):(n.viewFrom+=i,n.viewTo+=i);else if(t<=n.viewFrom&&r>=n.viewTo)wr(e);else if(t<=n.viewFrom){var L=Gn(e,r,r+i,1);L?(n.view=n.view.slice(L.index),n.viewFrom=L.lineN,n.viewTo+=i):wr(e)}else if(r>=n.viewTo){var j=Gn(e,t,t,-1);j?(n.view=n.view.slice(0,j.index),n.viewTo=j.lineN):wr(e)}else{var Y=Gn(e,t,t,-1),Q=Gn(e,r,r+i,1);Y&&Q?(n.view=n.view.slice(0,Y.index).concat(Oi(e,Y.lineN,Q.lineN)).concat(n.view.slice(Q.index)),n.viewTo+=i):wr(e)}var q=n.externalMeasured;q&&(r<q.lineN?q.lineN+=i:t<q.lineN+q.size&&(n.externalMeasured=null))}function Tr(e,t,r){e.curOp.viewChanged=!0;var i=e.display,n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size&&(i.externalMeasured=null),t<i.viewFrom||t>=i.viewTo)return;var L=i.view[Fr(e,t)];if(L.node==null)return;var j=L.changes||(L.changes=[]);ae(j,r)==-1&&j.push(r)}function wr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Gn(e,t,r,i){var n=Fr(e,t),L,j=e.display.view;if(!li||r==e.doc.first+e.doc.size)return{index:n,lineN:r};for(var Y=e.display.viewFrom,Q=0;Q<n;Q++)Y+=j[Q].size;if(Y!=t){if(i>0){if(n==j.length-1)return null;L=Y+j[n].size-t,n++}else L=Y-t;t+=L,r+=L}for(;cn(e.doc,r)!=r;){if(n==(i<0?0:j.length-1))return null;r+=i*j[n-(i<0?1:0)].size,n+=i}return{index:n,lineN:r}}function Vo(e,t,r){var i=e.display,n=i.view;n.length==0||t>=i.viewTo||r<=i.viewFrom?(i.view=Oi(e,t,r),i.viewFrom=t):(i.viewFrom>t?i.view=Oi(e,t,i.viewFrom).concat(i.view):i.viewFrom<t&&(i.view=i.view.slice(Fr(e,t))),i.viewFrom=t,i.viewTo<r?i.view=i.view.concat(Oi(e,i.viewTo,r)):i.viewTo>r&&(i.view=i.view.slice(0,Fr(e,r)))),i.viewTo=r}function fs(e){for(var t=e.display.view,r=0,i=0;i<t.length;i++){var n=t[i];!n.hidden&&(!n.node||n.changes)&&++r}return r}function bn(e){e.display.input.showSelection(e.display.input.prepareSelection())}function ps(e,t){t===void 0&&(t=!0);for(var r=e.doc,i={},n=i.cursors=document.createDocumentFragment(),L=i.selection=document.createDocumentFragment(),j=0;j<r.sel.ranges.length;j++){if(!t&&j==r.sel.primIndex)continue;var Y=r.sel.ranges[j];if(Y.from().line>=e.display.viewTo||Y.to().line<e.display.viewFrom)continue;var Q=Y.empty();(Q||e.options.showCursorWhenSelecting)&&ms(e,Y.head,n),Q||Xo(e,Y,L)}return i}function ms(e,t,r){var i=Qi(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),n=r.appendChild(u("div","\xA0","CodeMirror-cursor"));if(n.style.left=i.left+"px",n.style.top=i.top+"px",n.style.height=Math.max(0,i.bottom-i.top)*e.options.cursorHeight+"px",i.other){var L=r.appendChild(u("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));L.style.display="",L.style.left=i.other.left+"px",L.style.top=i.other.top+"px",L.style.height=(i.other.bottom-i.other.top)*.85+"px"}}function zn(e,t){return e.top-t.top||e.left-t.left}function Xo(e,t,r){var i=e.display,n=e.doc,L=document.createDocumentFragment(),j=qa(e.display),Y=j.left,Q=Math.max(i.sizerWidth,Mr(e)-i.sizer.offsetLeft)-j.right,q=n.direction=="ltr";function ue(nt,ht,Et,vt){ht<0&&(ht=0),ht=Math.round(ht),vt=Math.round(vt),L.appendChild(u("div",null,"CodeMirror-selected","position: absolute; left: "+nt+`px;
top: `+ht+"px; width: "+(Et==null?Q-nt:Et)+`px;
height: `+(vt-ht)+"px"))}function fe(nt,ht,Et){var vt=pt(n,nt),At=vt.text.length,Xt,ci;function Zt(ni,ki){return ma(e,Ve(nt,ni),"div",vt,ki)}function Fi(ni,ki,gi){var oi=ds(e,vt,null,ni),ai=ki=="ltr"==(gi=="after")?"left":"right",ei=gi=="after"?oi.begin:oi.end-(/\s/.test(vt.text.charAt(oi.end-1))?2:1);return Zt(ei,ai)[ai]}var Ii=Xe(vt,n.direction);return Je(Ii,ht||0,Et==null?At:Et,function(ni,ki,gi,oi){var ai=gi=="ltr",ei=Zt(ni,ai?"left":"right"),Di=Zt(ki-1,ai?"right":"left"),un=ht==null&&ni==0,Lr=Et==null&&ki==At,xi=oi==0,sr=!Ii||oi==Ii.length-1;if(Di.top-ei.top<=3){var fi=(q?un:Lr)&&xi,Va=(q?Lr:un)&&sr,cr=fi?Y:(ai?ei:Di).left,Wr=Va?Q:(ai?Di:ei).right;ue(cr,ei.top,Wr-cr,ei.bottom)}else{var Gr,Ci,hn,Xa;ai?(Gr=q&&un&&xi?Y:ei.left,Ci=q?Q:Fi(ni,gi,"before"),hn=q?Y:Fi(ki,gi,"after"),Xa=q&&Lr&&sr?Q:Di.right):(Gr=q?Fi(ni,gi,"before"):Y,Ci=!q&&un&&xi?Q:ei.right,hn=!q&&Lr&&sr?Y:Di.left,Xa=q?Fi(ki,gi,"after"):Q),ue(Gr,ei.top,Ci-Gr,ei.bottom),ei.bottom<Di.top&&ue(Y,ei.bottom,null,Di.top),ue(hn,Di.top,Xa-hn,Di.bottom)}(!Xt||zn(ei,Xt)<0)&&(Xt=ei),zn(Di,Xt)<0&&(Xt=Di),(!ci||zn(ei,ci)<0)&&(ci=ei),zn(Di,ci)<0&&(ci=Di)}),{start:Xt,end:ci}}var Se=t.from(),Te=t.to();if(Se.line==Te.line)fe(Se.line,Se.ch,Te.ch);else{var Pe=pt(n,Se.line),ze=pt(n,Te.line),$e=wi(Pe)==wi(ze),rt=fe(Se.line,Se.ch,$e?Pe.text.length+1:null).end,lt=fe(Te.line,$e?0:null,Te.ch).start;$e&&(rt.top<lt.top-2?(ue(rt.right,rt.top,null,rt.bottom),ue(Y,lt.top,lt.left,lt.bottom)):ue(rt.right,rt.top,lt.left-rt.right,rt.bottom)),rt.bottom<lt.top&&ue(Y,rt.bottom,null,lt.top)}r.appendChild(L)}function xa(e){if(!e.state.focused)return;var t=e.display;clearInterval(t.blinker);var r=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){e.hasFocus()||Qr(e),t.cursorDiv.style.visibility=(r=!r)?"":"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,Qr(e))},100)}function Ta(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(Re(e,"focus",e,t),e.state.focused=!0,P(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),D&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),xa(e)}function Qr(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(Re(e,"blur",e,t),e.state.focused=!1,T(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function Kn(e){for(var t=e.display,r=t.lineDiv.offsetTop,i=0;i<t.view.length;i++){var n=t.view[i],L=e.options.lineWrapping,j=void 0,Y=0;if(n.hidden)continue;if(G&&H<8){var Q=n.node.offsetTop+n.node.offsetHeight;j=Q-r,r=Q}else{var q=n.node.getBoundingClientRect();j=q.bottom-q.top,!L&&n.text.firstChild&&(Y=n.text.firstChild.getBoundingClientRect().right-q.left-1)}var ue=n.line.height-j;if((ue>.005||ue<-.005)&&(vi(n.line,j),ys(n.line),n.rest))for(var fe=0;fe<n.rest.length;fe++)ys(n.rest[fe]);if(Y>e.display.sizerWidth){var Se=Math.ceil(Y/$r(e.display));Se>e.display.maxLineLength&&(e.display.maxLineLength=Se,e.display.maxLine=n.line,e.display.maxLineChanged=!0)}}}function ys(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var r=e.widgets[t],i=r.node.parentNode;i&&(r.height=i.offsetHeight)}}function Vn(e,t,r){var i=r&&r.top!=null?Math.max(0,r.top):e.scroller.scrollTop;i=Math.floor(i-jn(e));var n=r&&r.bottom!=null?r.bottom:i+e.wrapper.clientHeight,L=Ui(t,i),j=Ui(t,n);if(r&&r.ensure){var Y=r.ensure.from.line,Q=r.ensure.to.line;Y<L?(L=Y,j=Ui(t,$i(pt(t,Y))+e.wrapper.clientHeight)):Math.min(Q,t.lastLine())>=j&&(L=Ui(t,$i(pt(t,Q))-e.wrapper.clientHeight),j=Q)}return{from:L,to:Math.max(j,L+1)}}function Yo(e,t){if(We(e,"scrollCursorIntoView"))return;var r=e.display,i=r.sizer.getBoundingClientRect(),n=null;if(t.top+i.top<0?n=!0:t.bottom+i.top>(window.innerHeight||document.documentElement.clientHeight)&&(n=!1),n!=null&&!o){var L=u("div","\u200B",null,`position: absolute;
top: `+(t.top-r.viewOffset-jn(e.display))+`px;
height: `+(t.bottom-t.top+nr(e)+r.barHeight)+`px;
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(L),L.scrollIntoView(n),e.display.lineSpace.removeChild(L)}}function $o(e,t,r,i){i==null&&(i=0);var n;!e.options.lineWrapping&&t==r&&(t=t.ch?Ve(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,r=t.sticky=="before"?Ve(t.line,t.ch+1,"before"):t);for(var L=0;L<5;L++){var j=!1,Y=Qi(e,t),Q=!r||r==t?Y:Qi(e,r);n={left:Math.min(Y.left,Q.left),top:Math.min(Y.top,Q.top)-i,right:Math.max(Y.left,Q.left),bottom:Math.max(Y.bottom,Q.bottom)+i};var q=wa(e,n),ue=e.doc.scrollTop,fe=e.doc.scrollLeft;if(q.scrollTop!=null&&(En(e,q.scrollTop),Math.abs(e.doc.scrollTop-ue)>1&&(j=!0)),q.scrollLeft!=null&&(Br(e,q.scrollLeft),Math.abs(e.doc.scrollLeft-fe)>1&&(j=!0)),!j)break}return n}function Qo(e,t){var r=wa(e,t);r.scrollTop!=null&&En(e,r.scrollTop),r.scrollLeft!=null&&Br(e,r.scrollLeft)}function wa(e,t){var r=e.display,i=Yr(e.display);t.top<0&&(t.top=0);var n=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:r.scroller.scrollTop,L=ca(e),j={};t.bottom-t.top>L&&(t.bottom=t.top+L);var Y=e.doc.height+da(r),Q=t.top<i,q=t.bottom>Y-i;if(t.top<n)j.scrollTop=Q?0:t.top;else if(t.bottom>n+L){var ue=Math.min(t.top,(q?Y:t.bottom)-L);ue!=n&&(j.scrollTop=ue)}var fe=e.options.fixedGutter?0:r.gutters.offsetWidth,Se=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:r.scroller.scrollLeft-fe,Te=Mr(e)-r.gutters.offsetWidth,Pe=t.right-t.left>Te;return Pe&&(t.right=t.left+Te),t.left<10?j.scrollLeft=0:t.left<Se?j.scrollLeft=Math.max(0,t.left+fe-(Pe?0:10)):t.right>Te+Se-3&&(j.scrollLeft=t.right+(Pe?0:10)-Te),j}function Sa(e,t){if(t==null)return;Xn(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function Jr(e){Xn(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function _n(e,t,r){(t!=null||r!=null)&&Xn(e),t!=null&&(e.curOp.scrollLeft=t),r!=null&&(e.curOp.scrollTop=r)}function Jo(e,t){Xn(e),e.curOp.scrollToPos=t}function Xn(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var r=us(e,t.from),i=us(e,t.to);bs(e,r,i,t.margin)}}function bs(e,t,r,i){var n=wa(e,{left:Math.min(t.left,r.left),top:Math.min(t.top,r.top)-i,right:Math.max(t.right,r.right),bottom:Math.max(t.bottom,r.bottom)+i});_n(e,n.scrollLeft,n.scrollTop)}function En(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;k||Aa(e,{top:t}),_s(e,t,!0),k&&Aa(e),wn(e,100)}function _s(e,t,r){if(t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),e.display.scroller.scrollTop==t&&!r)return;e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t)}function Br(e,t,r,i){if(t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(r?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!i)return;e.doc.scrollLeft=t,Ss(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function xn(e){var t=e.display,r=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?r:0,docHeight:i,scrollHeight:i+nr(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:r}}var Ur=function(e,t,r){this.cm=r;var i=this.vert=u("div",[u("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),n=this.horiz=u("div",[u("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");i.tabIndex=n.tabIndex=-1,e(i),e(n),Ie(i,"scroll",function(){i.clientHeight&&t(i.scrollTop,"vertical")}),Ie(n,"scroll",function(){n.clientWidth&&t(n.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,G&&H<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Ur.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,r=e.scrollHeight>e.clientHeight+1,i=e.nativeBarWidth;if(r){this.vert.style.display="block",this.vert.style.bottom=t?i+"px":"0";var n=e.viewHeight-(t?i:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+n)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=r?i+"px":"0",this.horiz.style.left=e.barLeft+"px";var L=e.viewWidth-e.barLeft-(r?i:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+L)+"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:r?i:0,bottom:t?i:0}},Ur.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Ur.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Ur.prototype.zeroWidthHack=function(){var e=l&&!h?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new ee,this.disableVert=new ee},Ur.prototype.enableZeroWidthBar=function(e,t,r){e.style.pointerEvents="auto";function i(){var n=e.getBoundingClientRect(),L=r=="vert"?document.elementFromPoint(n.right-1,(n.top+n.bottom)/2):document.elementFromPoint((n.right+n.left)/2,n.bottom-1);L!=e?e.style.pointerEvents="none":t.set(1e3,i)}t.set(1e3,i)},Ur.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Tn=function(){};Tn.prototype.update=function(){return{bottom:0,right:0}},Tn.prototype.setScrollLeft=function(){},Tn.prototype.setScrollTop=function(){},Tn.prototype.clear=function(){};function Zr(e,t){t||(t=xn(e));var r=e.display.barWidth,i=e.display.barHeight;Es(e,t);for(var n=0;n<4&&r!=e.display.barWidth||i!=e.display.barHeight;n++)r!=e.display.barWidth&&e.options.lineWrapping&&Kn(e),Es(e,xn(e)),r=e.display.barWidth,i=e.display.barHeight}function Es(e,t){var r=e.display,i=r.scrollbars.update(t);r.sizer.style.paddingRight=(r.barWidth=i.right)+"px",r.sizer.style.paddingBottom=(r.barHeight=i.bottom)+"px",r.heightForcer.style.borderBottom=i.bottom+"px solid transparent",i.right&&i.bottom?(r.scrollbarFiller.style.display="block",r.scrollbarFiller.style.height=i.bottom+"px",r.scrollbarFiller.style.width=i.right+"px"):r.scrollbarFiller.style.display="",i.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(r.gutterFiller.style.display="block",r.gutterFiller.style.height=i.bottom+"px",r.gutterFiller.style.width=t.gutterWidth+"px"):r.gutterFiller.style.display=""}var xs={native:Ur,null:Tn};function Ts(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&T(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,r){r=="horizontal"?Br(e,t):En(e,t)},e),e.display.scrollbars.addClass&&P(e.display.wrapper,e.display.scrollbars.addClass)}var Zo=0;function Hr(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:++Zo},Ki(e.curOp)}function jr(e){var t=e.curOp;t&&Io(t,function(r){for(var i=0;i<r.ops.length;i++)r.ops[i].cm.curOp=null;qo(r)})}function qo(e){for(var t=e.ops,r=0;r<t.length;r++)el(t[r]);for(var i=0;i<t.length;i++)tl(t[i]);for(var n=0;n<t.length;n++)il(t[n]);for(var L=0;L<t.length;L++)rl(t[L]);for(var j=0;j<t.length;j++)nl(t[j])}function el(e){var t=e.cm,r=t.display;sl(t),e.updateMaxLine&&Hn(t),e.mustUpdate=e.viewChanged||e.forceUpdate||e.scrollTop!=null||e.scrollToPos&&(e.scrollToPos.from.line<r.viewFrom||e.scrollToPos.to.line>=r.viewTo)||r.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new Yn(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,r=t.display;e.updatedDisplay&&Kn(t),e.barMeasure=xn(t),r.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=ts(t,r.maxLine,r.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(r.scroller.clientWidth,r.sizer.offsetLeft+e.adjustWidthTo+nr(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,r.sizer.offsetLeft+e.adjustWidthTo-Mr(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=r.input.prepareSelection())}function rl(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&Br(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var r=e.focus&&e.focus==M();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,r),(e.updatedDisplay||e.startHeight!=t.doc.height)&&Zr(t,e.barMeasure),e.updatedDisplay&&Ra(t,e.barMeasure),e.selectionChanged&&xa(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),r&&gs(e.cm)}function nl(e){var t=e.cm,r=t.display,i=t.doc;if(e.updatedDisplay&&ws(t,e.update),r.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(r.wheelStartX=r.wheelStartY=null),e.scrollTop!=null&&_s(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&Br(t,e.scrollLeft,!0,!0),e.scrollToPos){var n=$o(t,y(i,e.scrollToPos.from),y(i,e.scrollToPos.to),e.scrollToPos.margin);Yo(t,n)}var L=e.maybeHiddenMarkers,j=e.maybeUnhiddenMarkers;if(L)for(var Y=0;Y<L.length;++Y)L[Y].lines.length||Re(L[Y],"hide");if(j)for(var Q=0;Q<j.length;++Q)j[Q].lines.length&&Re(j[Q],"unhide");r.wrapper.offsetHeight&&(i.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Re(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Ni(e,t){if(e.curOp)return t();Hr(e);try{return t()}finally{jr(e)}}function hi(e,t){return function(){if(e.curOp)return t.apply(e,arguments);Hr(e);try{return t.apply(e,arguments)}finally{jr(e)}}}function Si(e){return function(){if(this.curOp)return e.apply(this,arguments);Hr(this);try{return e.apply(this,arguments)}finally{jr(this)}}}function di(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);Hr(t);try{return e.apply(this,arguments)}finally{jr(t)}}}function wn(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,U(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var r=+new Date+e.options.workTime,i=it(e,t.highlightFrontier),n=[];t.iter(i.line,Math.min(t.first+t.size,e.display.viewTo+500),function(L){if(i.line>=e.display.viewFrom){var j=L.styles,Y=L.text.length>e.options.maxHighlightLength?qt(t.mode,i.state):null,Q=ge(e,L,i,!0);Y&&(i.state=Y),L.styles=Q.styles;var q=L.styleClasses,ue=Q.classes;ue?L.styleClasses=ue:q&&(L.styleClasses=null);for(var fe=!j||j.length!=L.styles.length||q!=ue&&(!q||!ue||q.bgClass!=ue.bgClass||q.textClass!=ue.textClass),Se=0;!fe&&Se<j.length;++Se)fe=j[Se]!=L.styles[Se];fe&&n.push(i.line),L.stateAfter=i.save(),i.nextLine()}else L.text.length<=e.options.maxHighlightLength&&mt(e,L.text,i),L.stateAfter=i.line%5==0?i.save():null,i.nextLine();if(+new Date>r)return wn(e,e.options.workDelay),!0}),t.highlightFrontier=i.line,t.modeFrontier=Math.max(t.modeFrontier,i.line),n.length&&Ni(e,function(){for(var L=0;L<n.length;L++)Tr(e,n[L],"text")})}var Yn=function(e,t,r){var i=e.display;this.viewport=t,this.visible=Vn(i,e.doc,t),this.editorIsHidden=!i.wrapper.offsetWidth,this.wrapperHeight=i.wrapper.clientHeight,this.wrapperWidth=i.wrapper.clientWidth,this.oldDisplayWidth=Mr(e),this.force=r,this.dims=ba(e),this.events=[]};Yn.prototype.signal=function(e,t){me(e,t)&&this.events.push(arguments)},Yn.prototype.finish=function(){for(var e=0;e<this.events.length;e++)Re.apply(null,this.events[e])};function sl(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=nr(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=nr(e)+"px",t.scrollbarsClipped=!0)}function ol(e){if(e.hasFocus())return null;var t=M();if(!t||!v(e.display.lineDiv,t))return null;var r={activeElt:t};if(window.getSelection){var i=window.getSelection();i.anchorNode&&i.extend&&v(e.display.lineDiv,i.anchorNode)&&(r.anchorNode=i.anchorNode,r.anchorOffset=i.anchorOffset,r.focusNode=i.focusNode,r.focusOffset=i.focusOffset)}return r}function ll(e){if(!e||!e.activeElt||e.activeElt==M())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&v(document.body,e.anchorNode)&&v(document.body,e.focusNode)){var t=window.getSelection(),r=document.createRange();r.setEnd(e.anchorNode,e.anchorOffset),r.collapse(!1),t.removeAllRanges(),t.addRange(r),t.extend(e.focusNode,e.focusOffset)}}function Ca(e,t){var r=e.display,i=e.doc;if(t.editorIsHidden)return wr(e),!1;if(!t.force&&t.visible.from>=r.viewFrom&&t.visible.to<=r.viewTo&&(r.updateLineNumbers==null||r.updateLineNumbers>=r.viewTo)&&r.renderedView==r.view&&fs(e)==0)return!1;Cs(e)&&(wr(e),t.dims=ba(e));var n=i.first+i.size,L=Math.max(t.visible.from-e.options.viewportMargin,i.first),j=Math.min(n,t.visible.to+e.options.viewportMargin);r.viewFrom<L&&L-r.viewFrom<20&&(L=Math.max(i.first,r.viewFrom)),r.viewTo>j&&r.viewTo-j<20&&(j=Math.min(n,r.viewTo)),li&&(L=cn(e.doc,L),j=xr(e.doc,j));var Y=L!=r.viewFrom||j!=r.viewTo||r.lastWrapHeight!=t.wrapperHeight||r.lastWrapWidth!=t.wrapperWidth;Vo(e,L,j),r.viewOffset=$i(pt(e.doc,r.viewFrom)),e.display.mover.style.top=r.viewOffset+"px";var Q=fs(e);if(!Y&&Q==0&&!t.force&&r.renderedView==r.view&&(r.updateLineNumbers==null||r.updateLineNumbers>=r.viewTo))return!1;var q=ol(e);return Q>4&&(r.lineDiv.style.display="none"),ul(e,r.updateLineNumbers,t.dims),Q>4&&(r.lineDiv.style.display=""),r.renderedView=r.view,ll(q),E(r.cursorDiv),E(r.selectionDiv),r.gutters.style.height=r.sizer.style.minHeight=0,Y&&(r.lastWrapHeight=t.wrapperHeight,r.lastWrapWidth=t.wrapperWidth,wn(e,400)),r.updateLineNumbers=null,!0}function ws(e,t){for(var r=t.viewport,i=!0;;i=!1){if(!i||!e.options.lineWrapping||t.oldDisplayWidth==Mr(e)){if(r&&r.top!=null&&(r={top:Math.min(e.doc.height+da(e.display)-ca(e),r.top)}),t.visible=Vn(e.display,e.doc,r),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else i&&(t.visible=Vn(e.display,e.doc,r));if(!Ca(e,t))break;Kn(e);var n=xn(e);bn(e),Zr(e,n),Ra(e,n),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 r=new Yn(e,t);if(Ca(e,r)){Kn(e),ws(e,r);var i=xn(e);bn(e),Zr(e,i),Ra(e,i),r.finish()}}function ul(e,t,r){var i=e.display,n=e.options.lineNumbers,L=i.lineDiv,j=L.firstChild;function Y(Pe){var ze=Pe.nextSibling;return D&&l&&e.display.currentWheelTarget==Pe?Pe.style.display="none":Pe.parentNode.removeChild(Pe),ze}for(var Q=i.view,q=i.viewFrom,ue=0;ue<Q.length;ue++){var fe=Q[ue];if(!fe.hidden)if(!fe.node||fe.node.parentNode!=L){var Se=No(e,fe,q,r);L.insertBefore(Se,j)}else{for(;j!=fe.node;)j=Y(j);var Te=n&&t!=null&&t<=q&&fe.lineNumber;fe.changes&&(ae(fe.changes,"gutter")>-1&&(Te=!1),Ya(e,fe,q,r)),Te&&(E(fe.lineNumber),fe.lineNumber.appendChild(document.createTextNode(fr(e.options,q)))),j=fe.node.nextSibling}q+=fe.size}for(;j;)j=Y(j)}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+nr(e)+"px"}function Ss(e){var t=e.display,r=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var i=_a(t)-t.scroller.scrollLeft+e.doc.scrollLeft,n=t.gutters.offsetWidth,L=i+"px",j=0;j<r.length;j++)if(!r[j].hidden){e.options.fixedGutter&&(r[j].gutter&&(r[j].gutter.style.left=L),r[j].gutterBackground&&(r[j].gutterBackground.style.left=L));var Y=r[j].alignable;if(Y)for(var Q=0;Q<Y.length;Q++)Y[Q].style.left=L}e.options.fixedGutter&&(t.gutters.style.left=i+n+"px")}function Cs(e){if(!e.options.lineNumbers)return!1;var t=e.doc,r=fr(e.options,t.first+t.size-1),i=e.display;if(r.length!=i.lineNumChars){var n=i.measure.appendChild(u("div",[u("div",r)],"CodeMirror-linenumber CodeMirror-gutter-elt")),L=n.firstChild.offsetWidth,j=n.offsetWidth-L;return i.lineGutter.style.width="",i.lineNumInnerWidth=Math.max(L,i.lineGutter.offsetWidth-j)+1,i.lineNumWidth=i.lineNumInnerWidth+j,i.lineNumChars=i.lineNumInnerWidth?r.length:-1,i.lineGutter.style.width=i.lineNumWidth+"px",Oa(e.display),!0}return!1}function La(e,t){for(var r=[],i=!1,n=0;n<e.length;n++){var L=e[n],j=null;if(typeof L!="string"&&(j=L.style,L=L.className),L=="CodeMirror-linenumbers")if(t)i=!0;else continue;r.push({className:L,style:j})}return t&&!i&&r.push({className:"CodeMirror-linenumbers",style:null}),r}function As(e){var t=e.gutters,r=e.gutterSpecs;E(t),e.lineGutter=null;for(var i=0;i<r.length;++i){var n=r[i],L=n.className,j=n.style,Y=t.appendChild(u("div",null,"CodeMirror-gutter "+L));j&&(Y.style.cssText=j),L=="CodeMirror-linenumbers"&&(e.lineGutter=Y,Y.style.width=(e.lineNumWidth||1)+"px")}t.style.display=r.length?"":"none",Oa(e)}function Sn(e){As(e.display),Ri(e),Ss(e)}function hl(e,t,r,i){var n=this;this.input=r,n.scrollbarFiller=u("div",null,"CodeMirror-scrollbar-filler"),n.scrollbarFiller.setAttribute("cm-not-content","true"),n.gutterFiller=u("div",null,"CodeMirror-gutter-filler"),n.gutterFiller.setAttribute("cm-not-content","true"),n.lineDiv=_("div",null,"CodeMirror-code"),n.selectionDiv=u("div",null,null,"position: relative; z-index: 1"),n.cursorDiv=u("div",null,"CodeMirror-cursors"),n.measure=u("div",null,"CodeMirror-measure"),n.lineMeasure=u("div",null,"CodeMirror-measure"),n.lineSpace=_("div",[n.measure,n.lineMeasure,n.selectionDiv,n.cursorDiv,n.lineDiv],null,"position: relative; outline: none");var L=_("div",[n.lineSpace],"CodeMirror-lines");n.mover=u("div",[L],null,"position: relative"),n.sizer=u("div",[n.mover],"CodeMirror-sizer"),n.sizerWidth=null,n.heightForcer=u("div",null,null,"position: absolute; height: "+de+"px; width: 1px;"),n.gutters=u("div",null,"CodeMirror-gutters"),n.lineGutter=null,n.scroller=u("div",[n.sizer,n.heightForcer,n.gutters],"CodeMirror-scroll"),n.scroller.setAttribute("tabIndex","-1"),n.wrapper=u("div",[n.scrollbarFiller,n.gutterFiller,n.scroller],"CodeMirror"),G&&H<8&&(n.gutters.style.zIndex=-1,n.scroller.style.paddingRight=0),!D&&!(k&&a)&&(n.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(n.wrapper):e(n.wrapper)),n.viewFrom=n.viewTo=t.first,n.reportedViewFrom=n.reportedViewTo=t.first,n.view=[],n.renderedView=null,n.externalMeasured=null,n.viewOffset=0,n.lastWrapHeight=n.lastWrapWidth=0,n.updateLineNumbers=null,n.nativeBarWidth=n.barHeight=n.barWidth=0,n.scrollbarsClipped=!1,n.lineNumWidth=n.lineNumInnerWidth=n.lineNumChars=null,n.alignWidgets=!1,n.cachedCharWidth=n.cachedTextHeight=n.cachedPaddingH=null,n.maxLine=null,n.maxLineLength=0,n.maxLineChanged=!1,n.wheelDX=n.wheelDY=n.wheelStartX=n.wheelStartY=null,n.shift=!1,n.selForContextMenu=null,n.activeTouch=null,n.gutterSpecs=La(i.gutters,i.lineNumbers),As(n),r.init(n)}var $n=0,ji=null;G?ji=-.53:k?ji=15:g?ji=-.7:f&&(ji=-1/3);function Os(e){var t=e.wheelDeltaX,r=e.wheelDeltaY;return t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),r==null&&e.detail&&e.axis==e.VERTICAL_AXIS?r=e.detail:r==null&&(r=e.wheelDelta),{x:t,y:r}}function dl(e){var t=Os(e);return t.x*=ji,t.y*=ji,t}function Rs(e,t){var r=Os(t),i=r.x,n=r.y,L=e.display,j=L.scroller,Y=j.scrollWidth>j.clientWidth,Q=j.scrollHeight>j.clientHeight;if(!(i&&Y||n&&Q))return;if(n&&l&&D){e:for(var q=t.target,ue=L.view;q!=j;q=q.parentNode)for(var fe=0;fe<ue.length;fe++)if(ue[fe].node==q){e.display.currentWheelTarget=q;break e}}if(i&&!k&&!p&&ji!=null){n&&Q&&En(e,Math.max(0,j.scrollTop+n*ji)),Br(e,Math.max(0,j.scrollLeft+i*ji)),(!n||n&&Q)&&te(t),L.wheelStartX=null;return}if(n&&ji!=null){var Se=n*ji,Te=e.doc.scrollTop,Pe=Te+L.wrapper.clientHeight;Se<0?Te=Math.max(0,Te+Se-50):Pe=Math.min(e.doc.height,Pe+Se+50),Aa(e,{top:Te,bottom:Pe})}$n<20&&(L.wheelStartX==null?(L.wheelStartX=j.scrollLeft,L.wheelStartY=j.scrollTop,L.wheelDX=i,L.wheelDY=n,setTimeout(function(){if(L.wheelStartX==null)return;var ze=j.scrollLeft-L.wheelStartX,$e=j.scrollTop-L.wheelStartY,rt=$e&&L.wheelDY&&$e/L.wheelDY||ze&&L.wheelDX&&ze/L.wheelDX;if(L.wheelStartX=L.wheelStartY=null,!rt)return;ji=(ji*$n+rt)/($n+1),++$n},200)):(L.wheelDX+=i,L.wheelDY+=n))}var Wi=function(e,t){this.ranges=e,this.primIndex=t};Wi.prototype.primary=function(){return this.ranges[this.primIndex]},Wi.prototype.equals=function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var r=this.ranges[t],i=e.ranges[t];if(!pr(r.anchor,i.anchor)||!pr(r.head,i.head))return!1}return!0},Wi.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new Gt(mr(this.ranges[t].anchor),mr(this.ranges[t].head));return new Wi(e,this.primIndex)},Wi.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},Wi.prototype.contains=function(e,t){t||(t=e);for(var r=0;r<this.ranges.length;r++){var i=this.ranges[r];if(Tt(t,i.from())>=0&&Tt(e,i.to())<=0)return r}return-1};var Gt=function(e,t){this.anchor=e,this.head=t};Gt.prototype.from=function(){return vr(this.anchor,this.head)},Gt.prototype.to=function(){return gr(this.anchor,this.head)},Gt.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Ji(e,t,r){var i=e&&e.options.selectionsMayTouch,n=t[r];t.sort(function(Se,Te){return Tt(Se.from(),Te.from())}),r=ae(t,n);for(var L=1;L<t.length;L++){var j=t[L],Y=t[L-1],Q=Tt(Y.to(),j.from());if(i&&!j.empty()?Q>0:Q>=0){var q=vr(Y.from(),j.from()),ue=gr(Y.to(),j.to()),fe=Y.empty()?j.from()==j.head:Y.from()==Y.head;L<=r&&--r,t.splice(--L,2,new Gt(fe?ue:q,fe?q:ue))}}return new Wi(t,r)}function Sr(e,t){return new Wi([new Gt(e,t||e)],0)}function Cr(e){return e.text?Ve(e.from.line+e.text.length-1,xe(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Ls(e,t){if(Tt(e,t.from)<0)return e;if(Tt(e,t.to)<=0)return Cr(t);var r=e.line+t.text.length-(t.to.line-t.from.line)-1,i=e.ch;return e.line==t.to.line&&(i+=Cr(t).ch-t.to.ch),Ve(r,i)}function Ia(e,t){for(var r=[],i=0;i<e.sel.ranges.length;i++){var n=e.sel.ranges[i];r.push(new Gt(Ls(n.anchor,t),Ls(n.head,t)))}return Ji(e.cm,r,e.sel.primIndex)}function Is(e,t,r){return e.line==t.line?Ve(r.line,e.ch-t.ch+r.ch):Ve(r.line+(e.line-t.line),e.ch)}function cl(e,t,r){for(var i=[],n=Ve(e.first,0),L=n,j=0;j<t.length;j++){var Y=t[j],Q=Is(Y.from,n,L),q=Is(Cr(Y),n,L);if(n=Y.to,L=q,r=="around"){var ue=e.sel.ranges[j],fe=Tt(ue.head,ue.anchor)<0;i[j]=new Gt(fe?q:Q,fe?Q:q)}else i[j]=new Gt(Q,Q)}return new Wi(i,e.sel.primIndex)}function ka(e){e.doc.mode=wt(e.options,e.doc.modeOption),Cn(e)}function Cn(e){e.doc.iter(function(t){t.stateAfter&&(t.stateAfter=null),t.styles&&(t.styles=null)}),e.doc.modeFrontier=e.doc.highlightFrontier=e.doc.first,wn(e,100),e.state.modeGen++,e.curOp&&Ri(e)}function ks(e,t){return t.from.ch==0&&t.to.ch==0&&xe(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Da(e,t,r,i){function n(lt){return r?r[lt]:null}function L(lt,nt,ht){ua(lt,nt,ht,i),mi(lt,"change",lt,t)}function j(lt,nt){for(var ht=[],Et=lt;Et<nt;++Et)ht.push(new Dr(q[Et],n(Et),i));return ht}var Y=t.from,Q=t.to,q=t.text,ue=pt(e,Y.line),fe=pt(e,Q.line),Se=xe(q),Te=n(q.length-1),Pe=Q.line-Y.line;if(t.full)e.insert(0,j(0,q.length)),e.remove(q.length,e.size-q.length);else if(ks(e,t)){var ze=j(0,q.length-1);L(fe,fe.text,Te),Pe&&e.remove(Y.line,Pe),ze.length&&e.insert(Y.line,ze)}else if(ue==fe)if(q.length==1)L(ue,ue.text.slice(0,Y.ch)+Se+ue.text.slice(Q.ch),Te);else{var $e=j(1,q.length-1);$e.push(new Dr(Se+ue.text.slice(Q.ch),Te,i)),L(ue,ue.text.slice(0,Y.ch)+q[0],n(0)),e.insert(Y.line+1,$e)}else if(q.length==1)L(ue,ue.text.slice(0,Y.ch)+q[0]+fe.text.slice(Q.ch),n(0)),e.remove(Y.line+1,Pe);else{L(ue,ue.text.slice(0,Y.ch)+q[0],n(0)),L(fe,Se+fe.text.slice(Q.ch),Te);var rt=j(1,q.length-1);Pe>1&&e.remove(Y.line+1,Pe-1),e.insert(Y.line+1,rt)}mi(e,"change",e,t)}function Ar(e,t,r){function i(n,L,j){if(n.linked)for(var Y=0;Y<n.linked.length;++Y){var Q=n.linked[Y];if(Q.doc==L)continue;var q=j&&Q.sharedHist;if(r&&!q)continue;t(Q.doc,q),i(Q.doc,n,q)}}i(e,null,!0)}function Ds(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,Ea(e),ka(e),Ms(e),e.options.lineWrapping||Hn(e),e.options.mode=t.modeOption,Ri(e)}function Ms(e){(e.doc.direction=="rtl"?P:T)(e.display.lineDiv,"CodeMirror-rtl")}function fl(e){Ni(e,function(){Ms(e),Ri(e)})}function Qn(e){this.done=[],this.undone=[],this.undoDepth=Infinity,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function Ma(e,t){var r={from:mr(t.from),to:Cr(t),text:Gi(e,t.from,t.to)};return Fs(e,r,t.from.line,t.to.line+1),Ar(e,function(i){return Fs(i,r,t.from.line,t.to.line+1)},!0),r}function Ps(e){for(;e.length;){var t=xe(e);if(t.ranges)e.pop();else break}}function pl(e,t){if(t)return Ps(e.done),xe(e.done);if(e.done.length&&!xe(e.done).ranges)return xe(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),xe(e.done)}function Ns(e,t,r,i){var n=e.history;n.undone.length=0;var L=+new Date,j,Y;if((n.lastOp==i||n.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&n.lastModTime>L-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(j=pl(n,n.lastOp==i)))Y=xe(j.changes),Tt(t.from,t.to)==0&&Tt(t.from,Y.to)==0?Y.to=Cr(t):j.changes.push(Ma(e,t));else{var Q=xe(n.done);for((!Q||!Q.ranges)&&Jn(e.sel,n.done),j={changes:[Ma(e,t)],generation:n.generation},n.done.push(j);n.done.length>n.undoDepth;)n.done.shift(),n.done[0].ranges||n.done.shift()}n.done.push(r),n.generation=++n.maxGeneration,n.lastModTime=n.lastSelTime=L,n.lastOp=n.lastSelOp=i,n.lastOrigin=n.lastSelOrigin=t.origin,Y||Re(e,"historyAdded")}function ml(e,t,r,i){var n=t.charAt(0);return n=="*"||n=="+"&&r.ranges.length==i.ranges.length&&r.somethingSelected()==i.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function gl(e,t,r,i){var n=e.history,L=i&&i.origin;r==n.lastSelOp||L&&n.lastSelOrigin==L&&(n.lastModTime==n.lastSelTime&&n.lastOrigin==L||ml(e,L,xe(n.done),t))?n.done[n.done.length-1]=t:Jn(t,n.done),n.lastSelTime=+new Date,n.lastSelOrigin=L,n.lastSelOp=r,i&&i.clearRedo!==!1&&Ps(n.undone)}function Jn(e,t){var r=xe(t);r&&r.ranges&&r.equals(e)||t.push(e)}function Fs(e,t,r,i){var n=t["spans_"+e.id],L=0;e.iter(Math.max(e.first,r),Math.min(e.first+e.size,i),function(j){j.markedSpans&&((n||(n=t["spans_"+e.id]={}))[L]=j.markedSpans),++L})}function vl(e){if(!e)return null;for(var t,r=0;r<e.length;++r)e[r].marker.explicitlyCleared?t||(t=e.slice(0,r)):t&&t.push(e[r]);return t?t.length?t:null:e}function yl(e,t){var r=t["spans_"+e.id];if(!r)return null;for(var i=[],n=0;n<t.text.length;++n)i.push(vl(r[n]));return i}function Bs(e,t){var r=yl(e,t),i=Yi(e,t);if(!r)return i;if(!i)return r;for(var n=0;n<r.length;++n){var L=r[n],j=i[n];if(L&&j){e:for(var Y=0;Y<j.length;++Y){for(var Q=j[Y],q=0;q<L.length;++q)if(L[q].marker==Q.marker)continue e;L.push(Q)}}else j&&(r[n]=j)}return r}function qr(e,t,r){for(var i=[],n=0;n<e.length;++n){var L=e[n];if(L.ranges){i.push(r?Wi.prototype.deepCopy.call(L):L);continue}var j=L.changes,Y=[];i.push({changes:Y});for(var Q=0;Q<j.length;++Q){var q=j[Q],ue=void 0;if(Y.push({from:q.from,to:q.to,text:q.text}),t)for(var fe in q)(ue=fe.match(/^spans_(\d+)$/))&&(ae(t,Number(ue[1]))>-1&&(xe(Y)[fe]=q[fe],delete q[fe]))}}return i}function Pa(e,t,r,i){if(i){var n=e.anchor;if(r){var L=Tt(t,n)<0;L!=Tt(r,n)<0?(n=t,t=r):L!=Tt(t,r)<0&&(t=r)}return new Gt(n,t)}else return new Gt(r||t,t)}function Zn(e,t,r,i,n){n==null&&(n=e.cm&&(e.cm.display.shift||e.extend)),Ei(e,new Wi([Pa(e.sel.primary(),t,r,n)],0),i)}function Us(e,t,r){for(var i=[],n=e.cm&&(e.cm.display.shift||e.extend),L=0;L<e.sel.ranges.length;L++)i[L]=Pa(e.sel.ranges[L],t[L],null,n);var j=Ji(e.cm,i,e.sel.primIndex);Ei(e,j,r)}function Na(e,t,r,i){var n=e.sel.ranges.slice(0);n[t]=r,Ei(e,Ji(e.cm,n,e.sel.primIndex),i)}function Hs(e,t,r,i){Ei(e,Sr(t,r),i)}function bl(e,t,r){var i={ranges:t.ranges,update:function(n){this.ranges=[];for(var L=0;L<n.length;L++)this.ranges[L]=new Gt(y(e,n[L].anchor),y(e,n[L].head))},origin:r&&r.origin};return Re(e,"beforeSelectionChange",e,i),e.cm&&Re(e.cm,"beforeSelectionChange",e.cm,i),i.ranges!=t.ranges?Ji(e.cm,i.ranges,i.ranges.length-1):t}function js(e,t,r){var i=e.history.done,n=xe(i);n&&n.ranges?(i[i.length-1]=t,qn(e,t,r)):Ei(e,t,r)}function Ei(e,t,r){qn(e,t,r),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,r)}function qn(e,t,r){(me(e,"beforeSelectionChange")||e.cm&&me(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,r));var i=r&&r.bias||(Tt(t.primary().head,e.sel.primary().head)<0?-1:1);Ws(e,zs(e,t,i,!0)),!(r&&r.scroll===!1)&&e.cm&&Jr(e.cm)}function Ws(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,_e(e.cm)),mi(e,"cursorActivity",e)}function Gs(e){Ws(e,zs(e,e.sel,null,!1))}function zs(e,t,r,i){for(var n,L=0;L<t.ranges.length;L++){var j=t.ranges[L],Y=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[L],Q=ea(e,j.anchor,Y&&Y.anchor,r,i),q=ea(e,j.head,Y&&Y.head,r,i);(n||Q!=j.anchor||q!=j.head)&&(n||(n=t.ranges.slice(0,L)),n[L]=new Gt(Q,q))}return n?Ji(e.cm,n,t.primIndex):t}function en(e,t,r,i,n){var L=pt(e,t.line);if(L.markedSpans)for(var j=0;j<L.markedSpans.length;++j){var Y=L.markedSpans[j],Q=Y.marker,q="selectLeft"in Q?!Q.selectLeft:Q.inclusiveLeft,ue="selectRight"in Q?!Q.selectRight:Q.inclusiveRight;if((Y.from==null||(q?Y.from<=t.ch:Y.from<t.ch))&&(Y.to==null||(ue?Y.to>=t.ch:Y.to>t.ch))){if(n&&(Re(Q,"beforeCursorEnter"),Q.explicitlyCleared))if(L.markedSpans){--j;continue}else break;if(!Q.atomic)continue;if(r){var fe=Q.find(i<0?1:-1),Se=void 0;if((i<0?ue:q)&&(fe=Ks(e,fe,-i,fe&&fe.line==t.line?L:null)),fe&&fe.line==t.line&&(Se=Tt(fe,r))&&(i<0?Se<0:Se>0))return en(e,fe,t,i,n)}var Te=Q.find(i<0?-1:1);return(i<0?q:ue)&&(Te=Ks(e,Te,i,Te.line==t.line?L:null)),Te?en(e,Te,t,i,n):null}}return t}function ea(e,t,r,i,n){var L=i||1,j=en(e,t,r,L,n)||!n&&en(e,t,r,L,!0)||en(e,t,r,-L,n)||!n&&en(e,t,r,-L,!0);return j||(e.cantEdit=!0,Ve(e.first,0))}function Ks(e,t,r,i){return r<0&&t.ch==0?t.line>e.first?y(e,Ve(t.line-1)):null:r>0&&t.ch==(i||pt(e,t.line)).text.length?t.line<e.first+e.size-1?Ve(t.line+1,0):null:new Ve(t.line,t.ch+r)}function Vs(e){e.setSelection(Ve(e.firstLine(),0),Ve(e.lastLine()),Ee)}function Xs(e,t,r){var i={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return i.canceled=!0}};return r&&(i.update=function(n,L,j,Y){n&&(i.from=y(e,n)),L&&(i.to=y(e,L)),j&&(i.text=j),Y!==void 0&&(i.origin=Y)}),Re(e,"beforeChange",e,i),e.cm&&Re(e.cm,"beforeChange",e.cm,i),i.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:i.from,to:i.to,text:i.text,origin:i.origin}}function tn(e,t,r){if(e.cm){if(!e.cm.curOp)return hi(e.cm,tn)(e,t,r);if(e.cm.state.suppressEdits)return}if((me(e,"beforeChange")||e.cm&&me(e.cm,"beforeChange"))&&(t=Xs(e,t,!0),!t))return;var i=Ir&&!r&&br(e,t.from,t.to);if(i)for(var n=i.length-1;n>=0;--n)Ys(e,{from:i[n].from,to:i[n].to,text:n?[""]:t.text,origin:t.origin});else Ys(e,t)}function Ys(e,t){if(t.text.length==1&&t.text[0]==""&&Tt(t.from,t.to)==0)return;var r=Ia(e,t);Ns(e,t,r,e.cm?e.cm.curOp.id:NaN),An(e,t,r,Yi(e,t));var i=[];Ar(e,function(n,L){!L&&ae(i,n.history)==-1&&(Zs(n.history,t),i.push(n.history)),An(n,t,null,Yi(n,t))})}function ta(e,t,r){var i=e.cm&&e.cm.state.suppressEdits;if(i&&!r)return;for(var n=e.history,L,j=e.sel,Y=t=="undo"?n.done:n.undone,Q=t=="undo"?n.undone:n.done,q=0;q<Y.length&&!(L=Y[q],r?L.ranges&&!L.equals(e.sel):!L.ranges);q++);if(q==Y.length)return;for(n.lastOrigin=n.lastSelOrigin=null;;)if(L=Y.pop(),L.ranges){if(Jn(L,Q),r&&!L.equals(e.sel)){Ei(e,L,{clearRedo:!1});return}j=L}else if(i){Y.push(L);return}else break;var ue=[];Jn(j,Q),Q.push({changes:ue,generation:n.generation}),n.generation=L.generation||++n.maxGeneration;for(var fe=me(e,"beforeChange")||e.cm&&me(e.cm,"beforeChange"),Se=function(ze){var $e=L.changes[ze];if($e.origin=t,fe&&!Xs(e,$e,!1))return Y.length=0,{};ue.push(Ma(e,$e));var rt=ze?Ia(e,$e):xe(Y);An(e,$e,rt,Bs(e,$e)),!ze&&e.cm&&e.cm.scrollIntoView({from:$e.from,to:Cr($e)});var lt=[];Ar(e,function(nt,ht){!ht&&ae(lt,nt.history)==-1&&(Zs(nt.history,$e),lt.push(nt.history)),An(nt,$e,null,Bs(nt,$e))})},Te=L.changes.length-1;Te>=0;--Te){var Pe=Se(Te);if(Pe)return Pe.v}}function $s(e,t){if(t==0)return;if(e.first+=t,e.sel=new Wi(be(e.sel.ranges,function(n){return new Gt(Ve(n.anchor.line+t,n.anchor.ch),Ve(n.head.line+t,n.head.ch))}),e.sel.primIndex),e.cm){Ri(e.cm,e.first,e.first-t,t);for(var r=e.cm.display,i=r.viewFrom;i<r.viewTo;i++)Tr(e.cm,i,"gutter")}}function An(e,t,r,i){if(e.cm&&!e.cm.curOp)return hi(e.cm,An)(e,t,r,i);if(t.to.line<e.first){$s(e,t.text.length-1-(t.to.line-t.from.line));return}if(t.from.line>e.lastLine())return;if(t.from.line<e.first){var n=t.text.length-1-(e.first-t.from.line);$s(e,n),t={from:Ve(e.first,0),to:Ve(t.to.line+n,t.to.ch),text:[xe(t.text)],origin:t.origin}}var L=e.lastLine();t.to.line>L&&(t={from:t.from,to:Ve(L,pt(e,L).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Gi(e,t.from,t.to),r||(r=Ia(e,t)),e.cm?_l(e.cm,t,i):Da(e,t,i),qn(e,r,Ee),e.cantEdit&&ea(e,Ve(e.firstLine(),0))&&(e.cantEdit=!1)}function _l(e,t,r){var i=e.doc,n=e.display,L=t.from,j=t.to,Y=!1,Q=L.line;e.options.lineWrapping||(Q=kt(wi(pt(i,L.line))),i.iter(Q,j.line+1,function(Te){if(Te==n.maxLine)return Y=!0,!0})),i.sel.contains(t.from,t.to)>-1&&_e(e),Da(i,t,r,cs(e)),e.options.lineWrapping||(i.iter(Q,L.line+t.text.length,function(Te){var Pe=pn(Te);Pe>n.maxLineLength&&(n.maxLine=Te,n.maxLineLength=Pe,n.maxLineChanged=!0,Y=!1)}),Y&&(e.curOp.updateMaxLine=!0)),Xi(i,L.line),wn(e,400);var q=t.text.length-(j.line-L.line)-1;t.full?Ri(e):L.line==j.line&&t.text.length==1&&!ks(e.doc,t)?Tr(e,L.line,"text"):Ri(e,L.line,j.line+1,q);var ue=me(e,"changes"),fe=me(e,"change");if(fe||ue){var Se={from:L,to:j,text:t.text,removed:t.removed,origin:t.origin};fe&&mi(e,"change",e,Se),ue&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(Se)}e.display.selForContextMenu=null}function rn(e,t,r,i,n){var L;i||(i=r),Tt(i,r)<0&&(L=[i,r],r=L[0],i=L[1]),typeof t=="string"&&(t=e.splitLines(t)),tn(e,{from:r,to:i,text:t,origin:n})}function Qs(e,t,r,i){r<e.line?e.line+=i:t<e.line&&(e.line=t,e.ch=0)}function Js(e,t,r,i){for(var n=0;n<e.length;++n){var L=e[n],j=!0;if(L.ranges){L.copied||(L=e[n]=L.deepCopy(),L.copied=!0);for(var Y=0;Y<L.ranges.length;Y++)Qs(L.ranges[Y].anchor,t,r,i),Qs(L.ranges[Y].head,t,r,i);continue}for(var Q=0;Q<L.changes.length;++Q){var q=L.changes[Q];if(r<q.from.line)q.from=Ve(q.from.line+i,q.from.ch),q.to=Ve(q.to.line+i,q.to.ch);else if(t<=q.to.line){j=!1;break}}j||(e.splice(0,n+1),n=0)}}function Zs(e,t){var r=t.from.line,i=t.to.line,n=t.text.length-(i-r)-1;Js(e.done,r,i,n),Js(e.undone,r,i,n)}function On(e,t,r,i){var n=t,L=t;return typeof t=="number"?L=pt(e,z(e,t)):n=kt(t),n==null?null:(i(L,n)&&e.cm&&Tr(e.cm,n,r),L)}function Rn(e){this.lines=e,this.parent=null;for(var t=0,r=0;r<e.length;++r)e[r].parent=this,t+=e[r].height;this.height=t}Rn.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var r=e,i=e+t;r<i;++r){var n=this.lines[r];this.height-=n.height,gt(n),mi(n,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,r){this.height+=r,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var i=0;i<t.length;++i)t[i].parent=this},iterN:function(e,t,r){for(var i=e+t;e<i;++e)if(r(this.lines[e]))return!0}};function Ln(e){this.children=e;for(var t=0,r=0,i=0;i<e.length;++i){var n=e[i];t+=n.chunkSize(),r+=n.height,n.parent=this}this.size=t,this.height=r,this.parent=null}Ln.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var r=0;r<this.children.length;++r){var i=this.children[r],n=i.chunkSize();if(e<n){var L=Math.min(t,n-e),j=i.height;if(i.removeInner(e,L),this.height-=j-i.height,n==L&&(this.children.splice(r--,1),i.parent=null),(t-=L)==0)break;e=0}else e-=n}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof Rn))){var Y=[];this.collapse(Y),this.children=[new Rn(Y)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,r){this.size+=t.length,this.height+=r;for(var i=0;i<this.children.length;++i){var n=this.children[i],L=n.chunkSize();if(e<=L){if(n.insertInner(e,t,r),n.lines&&n.lines.length>50){for(var j=n.lines.length%25+25,Y=j;Y<n.lines.length;){var Q=new Rn(n.lines.slice(Y,Y+=25));n.height-=Q.height,this.children.splice(++i,0,Q),Q.parent=this}n.lines=n.lines.slice(0,j),this.maybeSpill()}break}e-=L}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),r=new Ln(t);if(e.parent){e.size-=r.size,e.height-=r.height;var n=ae(e.parent.children,e);e.parent.children.splice(n+1,0,r)}else{var i=new Ln(e.children);i.parent=e,e.children=[i,r],e=i}r.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iterN:function(e,t,r){for(var i=0;i<this.children.length;++i){var n=this.children[i],L=n.chunkSize();if(e<L){var j=Math.min(t,L-e);if(n.iterN(e,j,r))return!0;if((t-=j)==0)break;e=0}else e-=L}}};var In=function(e,t,r){if(r)for(var i in r)r.hasOwnProperty(i)&&(this[i]=r[i]);this.doc=e,this.node=t};In.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,r=this.line,i=kt(r);if(i==null||!t)return;for(var n=0;n<t.length;++n)t[n]==this&&t.splice(n--,1);t.length||(r.widgets=null);var L=vn(this);vi(r,Math.max(0,r.height-L)),e&&(Ni(e,function(){qs(e,r,-L),Tr(e,i,"widget")}),mi(e,"lineWidgetCleared",e,this,i))},In.prototype.changed=function(){var e=this,t=this.height,r=this.doc.cm,i=this.line;this.height=null;var n=vn(this)-t;if(!n)return;rr(this.doc,i)||vi(i,i.height+n),r&&Ni(r,function(){r.curOp.forceUpdate=!0,qs(r,i,n),mi(r,"lineWidgetChanged",r,e,kt(i))})},ve(In);function qs(e,t,r){$i(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Sa(e,r)}function El(e,t,r,i){var n=new In(e,r,i),L=e.cm;return L&&n.noHScroll&&(L.display.alignWidgets=!0),On(e,t,"widget",function(j){var Y=j.widgets||(j.widgets=[]);if(n.insertAt==null?Y.push(n):Y.splice(Math.min(Y.length-1,Math.max(0,n.insertAt)),0,n),n.line=j,L&&!rr(e,j)){var Q=$i(j)<e.scrollTop;vi(j,j.height+vn(n)),Q&&Sa(L,n.height),L.curOp.forceUpdate=!0}return!0}),L&&mi(L,"lineWidgetAdded",L,n,typeof t=="number"?t:kt(t)),n}var eo=0,Or=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++eo};Or.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&Hr(e),me(this,"clear")){var r=this.find();r&&mi(this,"clear",r.from,r.to)}for(var i=null,n=null,L=0;L<this.lines.length;++L){var j=this.lines[L],Y=Pi(j.markedSpans,this);e&&!this.collapsed?Tr(e,kt(j),"text"):e&&(Y.to!=null&&(n=kt(j)),Y.from!=null&&(i=kt(j))),j.markedSpans=kr(j.markedSpans,Y),Y.from==null&&this.collapsed&&!rr(this.doc,j)&&e&&vi(j,Yr(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var Q=0;Q<this.lines.length;++Q){var q=wi(this.lines[Q]),ue=pn(q);ue>e.display.maxLineLength&&(e.display.maxLine=q,e.display.maxLineLength=ue,e.display.maxLineChanged=!0)}i!=null&&e&&this.collapsed&&Ri(e,i,n+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Gs(e.doc)),e&&mi(e,"markerCleared",e,this,i,n),t&&jr(e),this.parent&&this.parent.clear()},Or.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var r,i,n=0;n<this.lines.length;++n){var L=this.lines[n],j=Pi(L.markedSpans,this);if(j.from!=null&&(r=Ve(t?L:kt(L),j.from),e==-1))return r;if(j.to!=null&&(i=Ve(t?L:kt(L),j.to),e==1))return i}return r&&{from:r,to:i}},Or.prototype.changed=function(){var e=this,t=this.find(-1,!0),r=this,i=this.doc.cm;if(!t||!i)return;Ni(i,function(){var n=t.line,L=kt(t.line),j=fa(i,L);if(j&&(ns(j),i.curOp.selectionChanged=i.curOp.forceUpdate=!0),i.curOp.updateMaxLine=!0,!rr(r.doc,n)&&r.height!=null){var Y=r.height;r.height=null;var Q=vn(r)-Y;Q&&vi(n,n.height+Q)}mi(i,"markerChanged",i,e)})},Or.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||ae(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Or.prototype.detachLine=function(e){if(this.lines.splice(ae(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},ve(Or);function nn(e,t,r,i,n){if(i&&i.shared)return xl(e,t,r,i,n);if(e.cm&&!e.cm.curOp)return hi(e.cm,nn)(e,t,r,i,n);var L=new Or(e,n),j=Tt(t,r);if(i&&S(i,L,!1),j>0||j==0&&L.clearWhenEmpty!==!1)return L;if(L.replacedWith&&(L.collapsed=!0,L.widgetNode=_("span",[L.replacedWith],"CodeMirror-widget"),i.handleMouseEvents||L.widgetNode.setAttribute("cm-ignore-events","true"),i.insertLeft&&(L.widgetNode.insertLeft=!0)),L.collapsed){if(ui(e,t.line,t,r,L)||t.line!=r.line&&ui(e,r.line,t,r,L))throw new Error("Inserting collapsed marker partially overlapping an existing one");or()}L.addToHistory&&Ns(e,{from:t,to:r,origin:"markText"},e.sel,NaN);var Y=t.line,Q=e.cm,q;if(e.iter(Y,r.line+1,function(fe){Q&&L.collapsed&&!Q.options.lineWrapping&&wi(fe)==Q.display.maxLine&&(q=!0),L.collapsed&&Y!=t.line&&vi(fe,0),yr(fe,new lr(L,Y==t.line?t.ch:null,Y==r.line?r.ch:null)),++Y}),L.collapsed&&e.iter(t.line,r.line+1,function(fe){rr(e,fe)&&vi(fe,0)}),L.clearOnEnter&&Ie(L,"beforeCursorEnter",function(){return L.clear()}),L.readOnly&&(Hi(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),L.collapsed&&(L.id=++eo,L.atomic=!0),Q){if(q&&(Q.curOp.updateMaxLine=!0),L.collapsed)Ri(Q,t.line,r.line+1);else if(L.className||L.startStyle||L.endStyle||L.css||L.attributes||L.title)for(var ue=t.line;ue<=r.line;ue++)Tr(Q,ue,"text");L.atomic&&Gs(Q.doc),mi(Q,"markerAdded",Q,L)}return L}var kn=function(e,t){this.markers=e,this.primary=t;for(var r=0;r<e.length;++r)e[r].parent=this};kn.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();mi(this,"clear")},kn.prototype.find=function(e,t){return this.primary.find(e,t)},ve(kn);function xl(e,t,r,i,n){i=S(i),i.shared=!1;var L=[nn(e,t,r,i,n)],j=L[0],Y=i.widgetNode;return Ar(e,function(Q){Y&&(i.widgetNode=Y.cloneNode(!0)),L.push(nn(Q,y(Q,t),y(Q,r),i,n));for(var q=0;q<Q.linked.length;++q)if(Q.linked[q].isParent)return;j=xe(L)}),new kn(L,j)}function to(e){return e.findMarks(Ve(e.first,0),e.clipPos(Ve(e.lastLine())),function(t){return t.parent})}function Tl(e,t){for(var r=0;r<t.length;r++){var i=t[r],n=i.find(),L=e.clipPos(n.from),j=e.clipPos(n.to);if(Tt(L,j)){var Y=nn(e,L,j,i.primary,i.primary.type);i.markers.push(Y),Y.parent=i}}}function wl(e){for(var t=function(i){var n=e[i],L=[n.primary.doc];Ar(n.primary.doc,function(Q){return L.push(Q)});for(var j=0;j<n.markers.length;j++){var Y=n.markers[j];ae(L,Y.doc)==-1&&(Y.parent=null,n.markers.splice(j--,1))}},r=0;r<e.length;r++)t(r)}var Sl=0,Li=function(e,t,r,i,n){if(!(this instanceof Li))return new Li(e,t,r,i,n);r==null&&(r=0),Ln.call(this,[new Rn([new Dr("",null)])]),this.first=r,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=r;var L=Ve(r,0);this.sel=Sr(L),this.history=new Qn(null),this.id=++Sl,this.modeOption=t,this.lineSep=i,this.direction=n=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),Da(this,{from:L,to:L,text:e}),Ei(this,Sr(L),Ee)};Li.prototype=Be(Ln.prototype,{constructor:Li,iter:function(e,t,r){r?this.iterN(e-this.first,t-e,r):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var r=0,i=0;i<t.length;++i)r+=t[i].height;this.insertInner(e-this.first,t,r)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=tr(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:di(function(e){var t=Ve(this.first,0),r=this.first+this.size-1;tn(this,{from:t,to:Ve(r,pt(this,r).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&_n(this.cm,0,0),Ei(this,Sr(t),Ee)}),replaceRange:function(e,t,r,i){t=y(this,t),r=r?y(this,r):t,rn(this,e,t,r,i)},getRange:function(e,t,r){var i=Gi(this,y(this,e),y(this,t));return r===!1?i:i.join(r||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(Vi(this,e))return pt(this,e)},getLineNumber:function(e){return kt(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=pt(this,e)),wi(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return y(this,e)},getCursor:function(e){var t=this.sel.primary(),r;return e==null||e=="head"?r=t.head:e=="anchor"?r=t.anchor:e=="end"||e=="to"||e===!1?r=t.to():r=t.from(),r},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:di(function(e,t,r){Hs(this,y(this,typeof e=="number"?Ve(e,t||0):e),null,r)}),setSelection:di(function(e,t,r){Hs(this,y(this,e),y(this,t||e),r)}),extendSelection:di(function(e,t,r){Zn(this,y(this,e),t&&y(this,t),r)}),extendSelections:di(function(e,t){Us(this,N(this,e),t)}),extendSelectionsBy:di(function(e,t){var r=be(this.sel.ranges,e);Us(this,N(this,r),t)}),setSelections:di(function(e,t,r){if(!e.length)return;for(var i=[],n=0;n<e.length;n++)i[n]=new Gt(y(this,e[n].anchor),y(this,e[n].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),Ei(this,Ji(this.cm,i,t),r)}),addSelection:di(function(e,t,r){var i=this.sel.ranges.slice(0);i.push(new Gt(y(this,e),y(this,t||e))),Ei(this,Ji(this.cm,i,i.length-1),r)}),getSelection:function(e){for(var t=this.sel.ranges,r,i=0;i<t.length;i++){var n=Gi(this,t[i].from(),t[i].to());r=r?r.concat(n):n}return e===!1?r:r.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],r=this.sel.ranges,i=0;i<r.length;i++){var n=Gi(this,r[i].from(),r[i].to());e!==!1&&(n=n.join(e||this.lineSeparator())),t[i]=n}return t},replaceSelection:function(e,t,r){for(var i=[],n=0;n<this.sel.ranges.length;n++)i[n]=e;this.replaceSelections(i,t,r||"+input")},replaceSelections:di(function(e,t,r){for(var i=[],n=this.sel,L=0;L<n.ranges.length;L++){var j=n.ranges[L];i[L]={from:j.from(),to:j.to(),text:this.splitLines(e[L]),origin:r}}for(var Y=t&&t!="end"&&cl(this,i,t),Q=i.length-1;Q>=0;Q--)tn(this,i[Q]);Y?js(this,Y):this.cm&&Jr(this.cm)}),undo:di(function(){ta(this,"undo")}),redo:di(function(){ta(this,"redo")}),undoSelection:di(function(){ta(this,"undo",!0)}),redoSelection:di(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,r=0,i=0;i<e.done.length;i++)e.done[i].ranges||++t;for(var n=0;n<e.undone.length;n++)e.undone[n].ranges||++r;return{undo:t,redo:r}},clearHistory:function(){var e=this;this.history=new Qn(this.history.maxGeneration),Ar(this,function(t){return t.history=e.history},!0)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:qr(this.history.done),undone:qr(this.history.undone)}},setHistory:function(e){var t=this.history=new Qn(this.history.maxGeneration);t.done=qr(e.done.slice(0),null,!0),t.undone=qr(e.undone.slice(0),null,!0)},setGutterMarker:di(function(e,t,r){return On(this,e,"gutter",function(i){var n=i.gutterMarkers||(i.gutterMarkers={});return n[t]=r,!r&&Ke(n)&&(i.gutterMarkers=null),!0})}),clearGutter:di(function(e){var t=this;this.iter(function(r){r.gutterMarkers&&r.gutterMarkers[e]&&On(t,r,"gutter",function(){return r.gutterMarkers[e]=null,Ke(r.gutterMarkers)&&(r.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!Vi(this,e))return null;if(t=e,e=pt(this,e),!e)return null}else if(t=kt(e),t==null)return null;return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},addLineClass:di(function(e,t,r){return On(this,e,t=="gutter"?"gutter":"class",function(i){var n=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!i[n])i[n]=r;else{if(A(r).test(i[n]))return!1;i[n]+=" "+r}return!0})}),removeLineClass:di(function(e,t,r){return On(this,e,t=="gutter"?"gutter":"class",function(i){var n=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",L=i[n];if(L)if(r==null)i[n]=null;else{var j=L.match(A(r));if(!j)return!1;var Y=j.index+j[0].length;i[n]=L.slice(0,j.index)+(!j.index||Y==L.length?"":" ")+L.slice(Y)||null}else return!1;return!0})}),addLineWidget:di(function(e,t,r){return El(this,e,t,r)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,r){return nn(this,y(this,e),y(this,t),r,r&&r.type||"range")},setBookmark:function(e,t){var r={replacedWith:t&&(t.nodeType==null?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return e=y(this,e),nn(this,e,e,r,"bookmark")},findMarksAt:function(e){e=y(this,e);var t=[],r=pt(this,e.line).markedSpans;if(r)for(var i=0;i<r.length;++i){var n=r[i];(n.from==null||n.from<=e.ch)&&(n.to==null||n.to>=e.ch)&&t.push(n.marker.parent||n.marker)}return t},findMarks:function(e,t,r){e=y(this,e),t=y(this,t);var i=[],n=e.line;return this.iter(e.line,t.line+1,function(L){var j=L.markedSpans;if(j)for(var Y=0;Y<j.length;Y++){var Q=j[Y];!(Q.to!=null&&n==e.line&&e.ch>=Q.to||Q.from==null&&n!=e.line||Q.from!=null&&n==t.line&&Q.from>=t.ch)&&(!r||r(Q.marker))&&i.push(Q.marker.parent||Q.marker)}++n}),i},getAllMarks:function(){var e=[];return this.iter(function(t){var r=t.markedSpans;if(r)for(var i=0;i<r.length;++i)r[i].from!=null&&e.push(r[i].marker)}),e},posFromIndex:function(e){var t,r=this.first,i=this.lineSeparator().length;return this.iter(function(n){var L=n.text.length+i;if(L>e)return t=e,!0;e-=L,++r}),y(this,Ve(r,t))},indexFromPos:function(e){e=y(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var r=this.lineSeparator().length;return this.iter(this.first,e.line,function(i){t+=i.text.length+r}),t},copy:function(e){var t=new Li(tr(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,r=this.first+this.size;e.from!=null&&e.from>t&&(t=e.from),e.to!=null&&e.to<r&&(r=e.to);var i=new Li(tr(this,t,r),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(i.history=this.history),(this.linked||(this.linked=[])).push({doc:i,sharedHist:e.sharedHist}),i.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],Tl(i,to(this)),i},unlinkDoc:function(e){if(e instanceof Qt&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){var r=this.linked[t];if(r.doc!=e)continue;this.linked.splice(t,1),e.unlinkDoc(this),wl(to(this));break}if(e.history==this.history){var i=[e.id];Ar(e,function(n){return i.push(n.id)},!0),e.history=new Qn(null),e.history.done=qr(this.history.done,i),e.history.undone=qr(this.history.undone,i)}},iterLinkedDocs:function(e){Ar(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):xt(e)},lineSeparator:function(){return this.lineSep||`
`},setDirection:di(function(e){if(e!="rtl"&&(e="ltr"),e==this.direction)return;this.direction=e,this.iter(function(t){return t.order=null}),this.cm&&fl(this.cm)})}),Li.prototype.eachLine=Li.prototype.iter;var io=0;function Cl(e){var t=this;if(ro(t),We(t,e)||hr(t.display,e))return;te(e),G&&(io=+new Date);var r=Nr(t,e,!0),i=e.dataTransfer.files;if(!r||t.isReadOnly())return;if(i&&i.length&&window.FileReader&&window.File)for(var n=i.length,L=Array(n),j=0,Y=function(){++j==n&&hi(t,function(){r=y(t.doc,r);var Te={from:r,to:r,text:t.doc.splitLines(L.filter(function(Pe){return Pe!=null}).join(t.doc.lineSeparator())),origin:"paste"};tn(t.doc,Te),js(t.doc,Sr(y(t.doc,r),y(t.doc,Cr(Te))))})()},Q=function(Te,Pe){if(t.options.allowDropFileTypes&&ae(t.options.allowDropFileTypes,Te.type)==-1){Y();return}var ze=new FileReader;ze.onerror=function(){return Y()},ze.onload=function(){var $e=ze.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test($e)){Y();return}L[Pe]=$e,Y()},ze.readAsText(Te)},q=0;q<i.length;q++)Q(i[q],q);else{if(t.state.draggingText&&t.doc.sel.contains(r)>-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var ue=e.dataTransfer.getData("Text");if(ue){var fe;if(t.state.draggingText&&!t.state.draggingText.copy&&(fe=t.listSelections()),qn(t.doc,Sr(r,r)),fe)for(var Se=0;Se<fe.length;++Se)rn(t.doc,"",fe[Se].anchor,fe[Se].head,"drag");t.replaceSelection(ue,"around","paste"),t.display.input.focus()}}catch(Te){}}}function Al(e,t){if(G&&(!e.state.draggingText||+new Date-io<100)){pe(t);return}if(We(e,t)||hr(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!f){var r=u("img",null,null,"position: fixed; left: 0; top: 0;");r.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",p&&(r.width=r.height=1,e.display.wrapper.appendChild(r),r._top=r.offsetTop),t.dataTransfer.setDragImage(r,0,0),p&&r.parentNode.removeChild(r)}}function Ol(e,t){var r=Nr(e,t);if(!r)return;var i=document.createDocumentFragment();ms(e,r,i),e.display.dragCursor||(e.display.dragCursor=u("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),b(e.display.dragCursor,i)}function ro(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function no(e){if(!document.getElementsByClassName)return;for(var t=document.getElementsByClassName("CodeMirror"),r=[],i=0;i<t.length;i++){var n=t[i].CodeMirror;n&&r.push(n)}r.length&&r[0].operation(function(){for(var L=0;L<r.length;L++)e(r[L])})}var ao=!1;function Rl(){if(ao)return;Ll(),ao=!0}function Ll(){var e;Ie(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,no(Il)},100))}),Ie(window,"blur",function(){return no(Qr)})}function Il(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var Rr={3:"Pause",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",224:"Mod",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},Dn=0;Dn<10;Dn++)Rr[Dn+48]=Rr[Dn+96]=String(Dn);for(var ia=65;ia<=90;ia++)Rr[ia]=String.fromCharCode(ia);for(var Mn=1;Mn<=12;Mn++)Rr[Mn+111]=Rr[Mn+63235]="F"+Mn;var dr={};dr.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},dr.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},dr.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},dr.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},dr.default=l?dr.macDefault:dr.pcDefault;function kl(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var r,i,n,L,j=0;j<t.length-1;j++){var Y=t[j];if(/^(cmd|meta|m)$/i.test(Y))L=!0;else if(/^a(lt)?$/i.test(Y))r=!0;else if(/^(c|ctrl|control)$/i.test(Y))i=!0;else if(/^s(hift)?$/i.test(Y))n=!0;else throw new Error("Unrecognized modifier name: "+Y)}return r&&(e="Alt-"+e),i&&(e="Ctrl-"+e),L&&(e="Cmd-"+e),n&&(e="Shift-"+e),e}function Dl(e){var t={};for(var r in e)if(e.hasOwnProperty(r)){var i=e[r];if(/^(name|fallthrough|(de|at)tach)$/.test(r))continue;if(i=="..."){delete e[r];continue}for(var n=be(r.split(" "),kl),L=0;L<n.length;L++){var j=void 0,Y=void 0;L==n.length-1?(Y=n.join(" "),j=i):(Y=n.slice(0,L+1).join(" "),j="...");var Q=t[Y];if(!Q)t[Y]=j;else if(Q!=j)throw new Error("Inconsistent bindings for "+Y)}delete e[r]}for(var q in t)e[q]=t[q];return e}function an(e,t,r,i){t=ra(t);var n=t.call?t.call(e,i):t[e];if(n===!1)return"nothing";if(n==="...")return"multi";if(n!=null&&r(n))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return an(e,t.fallthrough,r,i);for(var L=0;L<t.fallthrough.length;L++){var j=an(e,t.fallthrough[L],r,i);if(j)return j}}}function so(e){var t=typeof e=="string"?e:Rr[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function oo(e,t,r){var i=e;return t.altKey&&i!="Alt"&&(e="Alt-"+e),(x?t.metaKey:t.ctrlKey)&&i!="Ctrl"&&(e="Ctrl-"+e),(x?t.ctrlKey:t.metaKey)&&i!="Mod"&&(e="Cmd-"+e),!r&&t.shiftKey&&i!="Shift"&&(e="Shift-"+e),e}function lo(e,t){if(p&&e.keyCode==34&&e.char)return!1;var r=Rr[e.keyCode];return r==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(r=e.code),oo(r,e,t))}function ra(e){return typeof e=="string"?dr[e]:e}function sn(e,t){for(var r=e.doc.sel.ranges,i=[],n=0;n<r.length;n++){for(var L=t(r[n]);i.length&&Tt(L.from,xe(i).to)<=0;){var j=i.pop();if(Tt(j.from,L.from)<0){L.from=j.from;break}}i.push(L)}Ni(e,function(){for(var Y=i.length-1;Y>=0;Y--)rn(e.doc,"",i[Y].from,i[Y].to,"+delete");Jr(e)})}function Fa(e,t,r){var i=Me(e.text,t+r,r);return i<0||i>e.text.length?null:i}function Ba(e,t,r){var i=Fa(e,t.ch,r);return i==null?null:new Ve(t.line,i,r<0?"after":"before")}function Ua(e,t,r,i,n){if(e){t.doc.direction=="rtl"&&(n=-n);var L=Xe(r,t.doc.direction);if(L){var j=n<0?xe(L):L[0],Y=n<0==(j.level==1),Q=Y?"after":"before",q;if(j.level>0||t.doc.direction=="rtl"){var ue=Xr(t,r);q=n<0?r.text.length-1:0;var fe=ar(t,ue,q).top;q=et(function(Se){return ar(t,ue,Se).top==fe},n<0==(j.level==1)?j.from:j.to-1,q),Q=="before"&&(q=Fa(r,q,1))}else q=n<0?j.to:j.from;return new Ve(i,q,Q)}}return new Ve(i,n<0?r.text.length:0,n<0?"before":"after")}function Ml(e,t,r,i){var n=Xe(t,e.doc.direction);if(!n)return Ba(t,r,i);r.ch>=t.text.length?(r.ch=t.text.length,r.sticky="before"):r.ch<=0&&(r.ch=0,r.sticky="after");var L=Ze(n,r.ch,r.sticky),j=n[L];if(e.doc.direction=="ltr"&&j.level%2==0&&(i>0?j.to>r.ch:j.from<r.ch))return Ba(t,r,i);var Y=function(rt,lt){return Fa(t,rt instanceof Ve?rt.ch:rt,lt)},Q,q=function(rt){return e.options.lineWrapping?(Q=Q||Xr(e,t),ds(e,t,Q,rt)):{begin:0,end:t.text.length}},ue=q(r.sticky=="before"?Y(r,-1):r.ch);if(e.doc.direction=="rtl"||j.level==1){var fe=j.level==1==i<0,Se=Y(r,fe?1:-1);if(Se!=null&&(fe?Se<=j.to&&Se<=ue.end:Se>=j.from&&Se>=ue.begin)){var Te=fe?"before":"after";return new Ve(r.line,Se,Te)}}var Pe=function(rt,lt,nt){for(var ht=function(Xt,ci){return ci?new Ve(r.line,Y(Xt,1),"before"):new Ve(r.line,Xt,"after")};rt>=0&&rt<n.length;rt+=lt){var Et=n[rt],vt=lt>0==(Et.level!=1),At=vt?nt.begin:Y(nt.end,-1);if(Et.from<=At&&At<Et.to)return ht(At,vt);if(At=vt?Et.from:Y(Et.to,-1),nt.begin<=At&&At<nt.end)return ht(At,vt)}},ze=Pe(L+i,i,ue);if(ze)return ze;var $e=i>0?ue.end:Y(ue.begin,-1);return $e!=null&&!(i>0&&$e==t.text.length)&&(ze=Pe(i>0?0:n.length-1,i,q($e)),ze)?ze:null}var Pn={selectAll:Vs,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),Ee)},killLine:function(e){return sn(e,function(t){if(t.empty()){var r=pt(e.doc,t.head.line).text.length;return t.head.ch==r&&t.head.line<e.lastLine()?{from:t.head,to:Ve(t.head.line+1,0)}:{from:t.head,to:Ve(t.head.line,r)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return sn(e,function(t){return{from:Ve(t.from().line,0),to:y(e.doc,Ve(t.to().line+1,0))}})},delLineLeft:function(e){return sn(e,function(t){return{from:Ve(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return sn(e,function(t){var r=e.charCoords(t.head,"div").top+5,i=e.coordsChar({left:0,top:r},"div");return{from:i,to:t.from()}})},delWrappedLineRight:function(e){return sn(e,function(t){var r=e.charCoords(t.head,"div").top+5,i=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:r},"div");return{from:t.from(),to:i}})},undo:function(e){return e.undo()},redo:function(e){return e.redo()},undoSelection:function(e){return e.undoSelection()},redoSelection:function(e){return e.redoSelection()},goDocStart:function(e){return e.extendSelection(Ve(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(Ve(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return uo(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return ho(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return Pl(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var r=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:r},"div")},he)},goLineLeft:function(e){return e.extendSelectionsBy(function(t){var r=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:r},"div")},he)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var r=e.cursorCoords(t.head,"div").top+5,i=e.coordsChar({left:0,top:r},"div");return i.ch<e.getLine(i.line).search(/\S/)?ho(e,t.head):i},he)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"codepoint")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection(" ")},insertSoftTab:function(e){for(var t=[],r=e.listSelections(),i=e.options.tabSize,n=0;n<r.length;n++){var L=r[n].from(),j=X(e.getLine(L.line),L.ch,i);t.push(re(i-j%i))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return Ni(e,function(){for(var t=e.listSelections(),r=[],i=0;i<t.length;i++){if(!t[i].empty())continue;var n=t[i].head,L=pt(e.doc,n.line).text;if(L){if(n.ch==L.length&&(n=new Ve(n.line,n.ch-1)),n.ch>0)n=new Ve(n.line,n.ch+1),e.replaceRange(L.charAt(n.ch-1)+L.charAt(n.ch-2),Ve(n.line,n.ch-2),n,"+transpose");else if(n.line>e.doc.first){var j=pt(e.doc,n.line-1).text;j&&(n=new Ve(n.line,1),e.replaceRange(L.charAt(0)+e.doc.lineSeparator()+j.charAt(j.length-1),Ve(n.line-1,j.length-1),n,"+transpose"))}}r.push(new Gt(n,n))}e.setSelections(r)})},newlineAndIndent:function(e){return Ni(e,function(){for(var t=e.listSelections(),r=t.length-1;r>=0;r--)e.replaceRange(e.doc.lineSeparator(),t[r].anchor,t[r].head,"+input");t=e.listSelections();for(var i=0;i<t.length;i++)e.indentLine(t[i].from().line,null,!0);Jr(e)})},openLine:function(e){return e.replaceSelection(`
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function uo(e,t){var r=pt(e.doc,t),i=wi(r);return i!=r&&(t=kt(i)),Ua(!0,e,i,t,1)}function Pl(e,t){var r=pt(e.doc,t),i=Vr(r);return i!=r&&(t=kt(i)),Ua(!0,e,r,t,-1)}function ho(e,t){var r=uo(e,t.line),i=pt(e.doc,r.line),n=Xe(i,e.doc.direction);if(!n||n[0].level==0){var L=Math.max(r.ch,i.text.search(/\S/)),j=t.line==r.line&&t.ch<=L&&t.ch;return Ve(r.line,j?0:L,r.sticky)}return r}function na(e,t,r){if(typeof t=="string"&&(t=Pn[t],!t))return!1;e.display.input.ensurePolled();var i=e.display.shift,n=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),r&&(e.display.shift=!1),n=t(e)!=Ae}finally{e.display.shift=i,e.state.suppressEdits=!1}return n}function Nl(e,t,r){for(var i=0;i<e.state.keyMaps.length;i++){var n=an(t,e.state.keyMaps[i],r,e);if(n)return n}return e.options.extraKeys&&an(t,e.options.extraKeys,r,e)||an(t,e.options.keyMap,r,e)}var Fl=new ee;function Nn(e,t,r,i){var n=e.state.keySeq;if(n){if(so(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Fl.set(50,function(){e.state.keySeq==n&&(e.state.keySeq=null,e.display.input.reset())}),co(e,n+" "+t,r,i))return!0}return co(e,t,r,i)}function co(e,t,r,i){var n=Nl(e,t,i);return n=="multi"&&(e.state.keySeq=t),n=="handled"&&mi(e,"keyHandled",e,t,r),(n=="handled"||n=="multi")&&(te(r),xa(e)),!!n}function fo(e,t){var r=lo(t,!0);return r?t.shiftKey&&!e.state.keySeq?Nn(e,"Shift-"+r,t,function(i){return na(e,i,!0)})||Nn(e,r,t,function(i){if(typeof i=="string"?/^go[A-Z]/.test(i):i.motion)return na(e,i)}):Nn(e,r,t,function(i){return na(e,i)}):!1}function Bl(e,t,r){return Nn(e,"'"+r+"'",t,function(i){return na(e,i,!0)})}var Ha=null;function po(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=M(),We(t,e))return;G&&H<11&&e.keyCode==27&&(e.returnValue=!1);var r=e.keyCode;t.display.shift=r==16||e.shiftKey;var i=fo(t,e);p&&(Ha=i?r:null,!i&&r==88&&!Bt&&(l?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),k&&!l&&!i&&r==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),r==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Ul(t)}function Ul(e){var t=e.display.lineDiv;P(t,"CodeMirror-crosshair");function r(i){(i.keyCode==18||!i.altKey)&&(T(t,"CodeMirror-crosshair"),tt(document,"keyup",r),tt(document,"mouseover",r))}Ie(document,"keyup",r),Ie(document,"mouseover",r)}function mo(e){e.keyCode==16&&(this.doc.sel.shift=!1),We(this,e)}function go(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(hr(t.display,e)||We(t,e)||e.ctrlKey&&!e.altKey||l&&e.metaKey)return;var r=e.keyCode,i=e.charCode;if(p&&r==Ha){Ha=null,te(e);return}if(p&&(!e.which||e.which<10)&&fo(t,e))return;var n=String.fromCharCode(i==null?r:i);if(n=="\b")return;if(Bl(t,e,n))return;t.display.input.onKeyPress(e)}var Hl=400,ja=function(e,t,r){this.time=e,this.pos=t,this.button=r};ja.prototype.compare=function(e,t,r){return this.time+Hl>e&&Tt(t,this.pos)==0&&r==this.button};var Fn,Bn;function jl(e,t){var r=+new Date;return Bn&&Bn.compare(r,e,t)?(Fn=Bn=null,"triple"):Fn&&Fn.compare(r,e,t)?(Bn=new ja(r,e,t),Fn=null,"double"):(Fn=new ja(r,e,t),Bn=null,"single")}function vo(e){var t=this,r=t.display;if(We(t,e)||r.activeTouch&&r.input.supportsTouch())return;if(r.input.ensurePolled(),r.shift=e.shiftKey,hr(r,e)){D||(r.scroller.draggable=!1,setTimeout(function(){return r.scroller.draggable=!0},100));return}if(Wa(t,e))return;var i=Nr(t,e),n=Le(e),L=i?jl(i,n):"single";if(window.focus(),n==1&&t.state.selectingText&&t.state.selectingText(e),i&&Wl(t,n,i,L,e))return;n==1?i?zl(t,i,L,e):ye(e)==r.scroller&&te(e):n==2?(i&&Zn(t.doc,i),setTimeout(function(){return r.input.focus()},20)):n==3&&(O?t.display.input.onContextMenu(e):vs(t))}function Wl(e,t,r,i,n){var L="Click";return i=="double"?L="Double"+L:i=="triple"&&(L="Triple"+L),L=(t==1?"Left":t==2?"Middle":"Right")+L,Nn(e,oo(L,n),n,function(j){if(typeof j=="string"&&(j=Pn[j]),!j)return!1;var Y=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),Y=j(e,r)!=Ae}finally{e.state.suppressEdits=!1}return Y})}function Gl(e,t,r){var i=e.getOption("configureMouse"),n=i?i(e,t,r):{};if(n.unit==null){var L=c?r.shiftKey&&r.metaKey:r.altKey;n.unit=L?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(n.extend==null||e.doc.extend)&&(n.extend=e.doc.extend||r.shiftKey),n.addNew==null&&(n.addNew=l?r.metaKey:r.ctrlKey),n.moveOnDrag==null&&(n.moveOnDrag=!(l?r.altKey:r.ctrlKey)),n}function zl(e,t,r,i){G?setTimeout(U(gs,e),0):e.curOp.focus=M();var n=Gl(e,r,i),L=e.doc.sel,j;e.options.dragDrop&&He&&!e.isReadOnly()&&r=="single"&&(j=L.contains(t))>-1&&(Tt((j=L.ranges[j]).from(),t)<0||t.xRel>0)&&(Tt(j.to(),t)>0||t.xRel<0)?Kl(e,i,t,n):Vl(e,i,t,n)}function Kl(e,t,r,i){var n=e.display,L=!1,j=hi(e,function(q){D&&(n.scroller.draggable=!1),e.state.draggingText=!1,tt(n.wrapper.ownerDocument,"mouseup",j),tt(n.wrapper.ownerDocument,"mousemove",Y),tt(n.scroller,"dragstart",Q),tt(n.scroller,"drop",j),L||(te(q),i.addNew||Zn(e.doc,r,null,null,i.extend),D&&!f||G&&H==9?setTimeout(function(){n.wrapper.ownerDocument.body.focus({preventScroll:!0}),n.input.focus()},20):n.input.focus())}),Y=function(q){L=L||Math.abs(t.clientX-q.clientX)+Math.abs(t.clientY-q.clientY)>=10},Q=function(){return L=!0};D&&(n.scroller.draggable=!0),e.state.draggingText=j,j.copy=!i.moveOnDrag,n.scroller.dragDrop&&n.scroller.dragDrop(),Ie(n.wrapper.ownerDocument,"mouseup",j),Ie(n.wrapper.ownerDocument,"mousemove",Y),Ie(n.scroller,"dragstart",Q),Ie(n.scroller,"drop",j),vs(e),setTimeout(function(){return n.input.focus()},20)}function yo(e,t,r){if(r=="char")return new Gt(t,t);if(r=="word")return e.findWordAt(t);if(r=="line")return new Gt(Ve(t.line,0),y(e.doc,Ve(t.line+1,0)));var i=r(e,t);return new Gt(i.from,i.to)}function Vl(e,t,r,i){var n=e.display,L=e.doc;te(t);var j,Y,Q=L.sel,q=Q.ranges;if(i.addNew&&!i.extend?(Y=L.sel.contains(r),Y>-1?j=q[Y]:j=new Gt(r,r)):(j=L.sel.primary(),Y=L.sel.primIndex),i.unit=="rectangle")i.addNew||(j=new Gt(r,r)),r=Nr(e,t,!0,!0),Y=-1;else{var ue=yo(e,r,i.unit);i.extend?j=Pa(j,ue.anchor,ue.head,i.extend):j=ue}i.addNew?Y==-1?(Y=q.length,Ei(L,Ji(e,q.concat([j]),Y),{scroll:!1,origin:"*mouse"})):q.length>1&&q[Y].empty()&&i.unit=="char"&&!i.extend?(Ei(L,Ji(e,q.slice(0,Y).concat(q.slice(Y+1)),0),{scroll:!1,origin:"*mouse"}),Q=L.sel):Na(L,Y,j,we):(Y=0,Ei(L,new Wi([j],0),we),Q=L.sel);var fe=r;function Se(nt){if(Tt(fe,nt)==0)return;if(fe=nt,i.unit=="rectangle"){for(var ht=[],Et=e.options.tabSize,vt=X(pt(L,r.line).text,r.ch,Et),At=X(pt(L,nt.line).text,nt.ch,Et),Xt=Math.min(vt,At),ci=Math.max(vt,At),Zt=Math.min(r.line,nt.line),Fi=Math.min(e.lastLine(),Math.max(r.line,nt.line));Zt<=Fi;Zt++){var Ii=pt(L,Zt).text,ni=ce(Ii,Xt,Et);Xt==ci?ht.push(new Gt(Ve(Zt,ni),Ve(Zt,ni))):Ii.length>ni&&ht.push(new Gt(Ve(Zt,ni),Ve(Zt,ce(Ii,ci,Et))))}ht.length||ht.push(new Gt(r,r)),Ei(L,Ji(e,Q.ranges.slice(0,Y).concat(ht),Y),{origin:"*mouse",scroll:!1}),e.scrollIntoView(nt)}else{var ki=j,gi=yo(e,nt,i.unit),oi=ki.anchor,ai;Tt(gi.anchor,oi)>0?(ai=gi.head,oi=vr(ki.from(),gi.anchor)):(ai=gi.anchor,oi=gr(ki.to(),gi.head));var ei=Q.ranges.slice(0);ei[Y]=Xl(e,new Gt(y(L,oi),ai)),Ei(L,Ji(e,ei,Y),we)}}var Te=n.wrapper.getBoundingClientRect(),Pe=0;function ze(nt){var ht=++Pe,Et=Nr(e,nt,!0,i.unit=="rectangle");if(!Et)return;if(Tt(Et,fe)!=0){e.curOp.focus=M(),Se(Et);var vt=Vn(n,L);(Et.line>=vt.to||Et.line<vt.from)&&setTimeout(hi(e,function(){Pe==ht&&ze(nt)}),150)}else{var At=nt.clientY<Te.top?-20:nt.clientY>Te.bottom?20:0;At&&setTimeout(hi(e,function(){if(Pe!=ht)return;n.scroller.scrollTop+=At,ze(nt)}),50)}}function $e(nt){e.state.selectingText=!1,Pe=Infinity,nt&&(te(nt),n.input.focus()),tt(n.wrapper.ownerDocument,"mousemove",rt),tt(n.wrapper.ownerDocument,"mouseup",lt),L.history.lastSelOrigin=null}var rt=hi(e,function(nt){nt.buttons===0||!Le(nt)?$e(nt):ze(nt)}),lt=hi(e,$e);e.state.selectingText=lt,Ie(n.wrapper.ownerDocument,"mousemove",rt),Ie(n.wrapper.ownerDocument,"mouseup",lt)}function Xl(e,t){var r=t.anchor,i=t.head,n=pt(e.doc,r.line);if(Tt(r,i)==0&&r.sticky==i.sticky)return t;var L=Xe(n);if(!L)return t;var j=Ze(L,r.ch,r.sticky),Y=L[j];if(Y.from!=r.ch&&Y.to!=r.ch)return t;var Q=j+(Y.from==r.ch==(Y.level!=1)?0:1);if(Q==0||Q==L.length)return t;var q;if(i.line!=r.line)q=(i.line-r.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var ue=Ze(L,i.ch,i.sticky),fe=ue-j||(i.ch-r.ch)*(Y.level==1?-1:1);ue==Q-1||ue==Q?q=fe<0:q=fe>0}var Se=L[Q+(q?-1:0)],Te=q==(Se.level==1),Pe=Te?Se.from:Se.to,ze=Te?"after":"before";return r.ch==Pe&&r.sticky==ze?t:new Gt(new Ve(r.line,Pe,ze),i)}function bo(e,t,r,i){var n,L;if(t.touches)n=t.touches[0].clientX,L=t.touches[0].clientY;else try{n=t.clientX,L=t.clientY}catch(Se){return!1}if(n>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;i&&te(t);var j=e.display,Y=j.lineDiv.getBoundingClientRect();if(L>Y.bottom||!me(e,r))return le(t);L-=Y.top-j.viewOffset;for(var Q=0;Q<e.display.gutterSpecs.length;++Q){var q=j.gutters.childNodes[Q];if(q&&q.getBoundingClientRect().right>=n){var ue=Ui(e.doc,L),fe=e.display.gutterSpecs[Q];return Re(e,r,e,ue,fe.className,t),le(t)}}}function Wa(e,t){return bo(e,t,"gutterClick",!0)}function _o(e,t){if(hr(e.display,t)||Yl(e,t))return;if(We(e,t,"contextmenu"))return;O||e.display.input.onContextMenu(t)}function Yl(e,t){return me(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-"),yn(e)}var on={toString:function(){return"CodeMirror.Init"}},xo={},aa={};function $l(e){var t=e.optionHandlers;function r(i,n,L,j){e.defaults[i]=n,L&&(t[i]=j?function(Y,Q,q){q!=on&&L(Y,Q,q)}:L)}e.defineOption=r,e.Init=on,r("value","",function(i,n){return i.setValue(n)},!0),r("mode",null,function(i,n){i.doc.modeOption=n,ka(i)},!0),r("indentUnit",2,ka,!0),r("indentWithTabs",!1),r("smartIndent",!0),r("tabSize",4,function(i){Cn(i),yn(i),Ri(i)},!0),r("lineSeparator",null,function(i,n){if(i.doc.lineSep=n,!n)return;var L=[],j=i.doc.first;i.doc.iter(function(Q){for(var q=0;;){var ue=Q.text.indexOf(n,q);if(ue==-1)break;q=ue+n.length,L.push(Ve(j,ue))}j++});for(var Y=L.length-1;Y>=0;Y--)rn(i.doc,n,L[Y],Ve(L[Y].line,L[Y].ch+n.length))}),r("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(i,n,L){i.state.specialChars=new RegExp(n.source+(n.test(" ")?"":"| "),"g"),L!=on&&i.refresh()}),r("specialCharPlaceholder",Vt,function(i){return i.refresh()},!0),r("electricChars",!0),r("inputStyle",a?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),r("spellcheck",!1,function(i,n){return i.getInputField().spellcheck=n},!0),r("autocorrect",!1,function(i,n){return i.getInputField().autocorrect=n},!0),r("autocapitalize",!1,function(i,n){return i.getInputField().autocapitalize=n},!0),r("rtlMoveVisually",!R),r("wholeLineUpdateBefore",!0),r("theme","default",function(i){Eo(i),Sn(i)},!0),r("keyMap","default",function(i,n,L){var j=ra(n),Y=L!=on&&ra(L);Y&&Y.detach&&Y.detach(i,j),j.attach&&j.attach(i,Y||null)}),r("extraKeys",null),r("configureMouse",null),r("lineWrapping",!1,Jl,!0),r("gutters",[],function(i,n){i.display.gutterSpecs=La(n,i.options.lineNumbers),Sn(i)},!0),r("fixedGutter",!0,function(i,n){i.display.gutters.style.left=n?_a(i.display)+"px":"0",i.refresh()},!0),r("coverGutterNextToScrollbar",!1,function(i){return Zr(i)},!0),r("scrollbarStyle","native",function(i){Ts(i),Zr(i),i.display.scrollbars.setScrollTop(i.doc.scrollTop),i.display.scrollbars.setScrollLeft(i.doc.scrollLeft)},!0),r("lineNumbers",!1,function(i,n){i.display.gutterSpecs=La(i.options.gutters,n),Sn(i)},!0),r("firstLineNumber",1,Sn,!0),r("lineNumberFormatter",function(i){return i},Sn,!0),r("showCursorWhenSelecting",!1,bn,!0),r("resetSelectionOnContextMenu",!0),r("lineWiseCopyCut",!0),r("pasteLinesPerSelection",!0),r("selectionsMayTouch",!1),r("readOnly",!1,function(i,n){n=="nocursor"&&(Qr(i),i.display.input.blur()),i.display.input.readOnlyChanged(n)}),r("screenReaderLabel",null,function(i,n){n=n===""?null:n,i.display.input.screenReaderLabelChanged(n)}),r("disableInput",!1,function(i,n){n||i.display.input.reset()},!0),r("dragDrop",!0,Ql),r("allowDropFileTypes",null),r("cursorBlinkRate",530),r("cursorScrollMargin",0),r("cursorHeight",1,bn,!0),r("singleCursorHeightPerLine",!0,bn,!0),r("workTime",100),r("workDelay",100),r("flattenSpans",!0,Cn,!0),r("addModeClass",!1,Cn,!0),r("pollInterval",100),r("undoDepth",200,function(i,n){return i.doc.history.undoDepth=n}),r("historyEventDelay",1250),r("viewportMargin",10,function(i){return i.refresh()},!0),r("maxHighlightLength",1e4,Cn,!0),r("moveInputWithCursor",!0,function(i,n){n||i.display.input.resetPosition()}),r("tabindex",null,function(i,n){return i.display.input.getField().tabIndex=n||""}),r("autofocus",null),r("direction","ltr",function(i,n){return i.doc.setDirection(n)},!0),r("phrases",null)}function Ql(e,t,r){var i=r&&r!=on;if(!t!=!i){var n=e.display.dragFunctions,L=t?Ie:tt;L(e.display.scroller,"dragstart",n.start),L(e.display.scroller,"dragenter",n.enter),L(e.display.scroller,"dragover",n.over),L(e.display.scroller,"dragleave",n.leave),L(e.display.scroller,"drop",n.drop)}}function Jl(e){e.options.lineWrapping?(P(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(T(e.display.wrapper,"CodeMirror-wrap"),Hn(e)),Ea(e),Ri(e),yn(e),setTimeout(function(){return Zr(e)},100)}function Qt(e,t){var r=this;if(!(this instanceof Qt))return new Qt(e,t);this.options=t=t?S(t):{},S(xo,t,!1);var i=t.value;typeof i=="string"?i=new Li(i,t.mode,null,t.lineSeparator,t.direction):t.mode&&(i.modeOption=t.mode),this.doc=i;var n=new Qt.inputStyles[t.inputStyle](this),L=this.display=new hl(e,i,n,t);L.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 ee,keySeq:null,specialChars:null},t.autofocus&&!a&&L.input.focus(),G&&H<11&&setTimeout(function(){return r.display.input.reset(!0)},20),Zl(this),Rl(),Hr(this),this.curOp.forceUpdate=!0,Ds(this,i),t.autofocus&&!a||this.hasFocus()?setTimeout(function(){r.hasFocus()&&!r.state.focused&&Ta(r)},20):Qr(this);for(var j in aa)aa.hasOwnProperty(j)&&aa[j](this,t[j],on);Cs(this),t.finishInit&&t.finishInit(this);for(var Y=0;Y<Ga.length;++Y)Ga[Y](this);jr(this),D&&t.lineWrapping&&getComputedStyle(L.lineDiv).textRendering=="optimizelegibility"&&(L.lineDiv.style.textRendering="auto")}Qt.defaults=xo,Qt.optionHandlers=aa;function Zl(e){var t=e.display;Ie(t.scroller,"mousedown",hi(e,vo)),G&&H<11?Ie(t.scroller,"dblclick",hi(e,function(Q){if(We(e,Q))return;var q=Nr(e,Q);if(!q||Wa(e,Q)||hr(e.display,Q))return;te(Q);var ue=e.findWordAt(q);Zn(e.doc,ue.anchor,ue.head)})):Ie(t.scroller,"dblclick",function(Q){return We(e,Q)||te(Q)}),Ie(t.scroller,"contextmenu",function(Q){return _o(e,Q)}),Ie(t.input.getField(),"contextmenu",function(Q){t.scroller.contains(Q.target)||_o(e,Q)});var r,i={end:0};function n(){t.activeTouch&&(r=setTimeout(function(){return t.activeTouch=null},1e3),i=t.activeTouch,i.end=+new Date)}function L(Q){if(Q.touches.length!=1)return!1;var q=Q.touches[0];return q.radiusX<=1&&q.radiusY<=1}function j(Q,q){if(q.left==null)return!0;var ue=q.left-Q.left,fe=q.top-Q.top;return ue*ue+fe*fe>20*20}Ie(t.scroller,"touchstart",function(Q){if(!We(e,Q)&&!L(Q)&&!Wa(e,Q)){t.input.ensurePolled(),clearTimeout(r);var q=+new Date;t.activeTouch={start:q,moved:!1,prev:q-i.end<=300?i:null},Q.touches.length==1&&(t.activeTouch.left=Q.touches[0].pageX,t.activeTouch.top=Q.touches[0].pageY)}}),Ie(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Ie(t.scroller,"touchend",function(Q){var q=t.activeTouch;if(q&&!hr(t,Q)&&q.left!=null&&!q.moved&&new Date-q.start<300){var ue=e.coordsChar(t.activeTouch,"page"),fe;!q.prev||j(q,q.prev)?fe=new Gt(ue,ue):!q.prev.prev||j(q,q.prev.prev)?fe=e.findWordAt(ue):fe=new Gt(Ve(ue.line,0),y(e.doc,Ve(ue.line+1,0))),e.setSelection(fe.anchor,fe.head),e.focus(),te(Q)}n()}),Ie(t.scroller,"touchcancel",n),Ie(t.scroller,"scroll",function(){t.scroller.clientHeight&&(En(e,t.scroller.scrollTop),Br(e,t.scroller.scrollLeft,!0),Re(e,"scroll",e))}),Ie(t.scroller,"mousewheel",function(Q){return Rs(e,Q)}),Ie(t.scroller,"DOMMouseScroll",function(Q){return Rs(e,Q)}),Ie(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(Q){We(e,Q)||pe(Q)},over:function(Q){We(e,Q)||(Ol(e,Q),pe(Q))},start:function(Q){return Al(e,Q)},drop:hi(e,Cl),leave:function(Q){We(e,Q)||ro(e)}};var Y=t.input.getField();Ie(Y,"keyup",function(Q){return mo.call(e,Q)}),Ie(Y,"keydown",hi(e,po)),Ie(Y,"keypress",hi(e,go)),Ie(Y,"focus",function(Q){return Ta(e,Q)}),Ie(Y,"blur",function(Q){return Qr(e,Q)})}var Ga=[];Qt.defineInitHook=function(e){return Ga.push(e)};function Un(e,t,r,i){var n=e.doc,L;r==null&&(r="add"),r=="smart"&&(n.mode.indent?L=it(e,t).state:r="prev");var j=e.options.tabSize,Y=pt(n,t),Q=X(Y.text,null,j);Y.stateAfter&&(Y.stateAfter=null);var q=Y.text.match(/^\s*/)[0],ue;if(!i&&!/\S/.test(Y.text))ue=0,r="not";else if(r=="smart"&&(ue=n.mode.indent(L,Y.text.slice(q.length),Y.text),ue==Ae||ue>150)){if(!i)return;r="prev"}r=="prev"?t>n.first?ue=X(pt(n,t-1).text,null,j):ue=0:r=="add"?ue=Q+e.options.indentUnit:r=="subtract"?ue=Q-e.options.indentUnit:typeof r=="number"&&(ue=Q+r),ue=Math.max(0,ue);var fe="",Se=0;if(e.options.indentWithTabs)for(var Te=Math.floor(ue/j);Te;--Te)Se+=j,fe+=" ";if(Se<ue&&(fe+=re(ue-Se)),fe!=q)return rn(n,fe,Ve(t,0),Ve(t,q.length),"+input"),Y.stateAfter=null,!0;for(var Pe=0;Pe<n.sel.ranges.length;Pe++){var ze=n.sel.ranges[Pe];if(ze.head.line==t&&ze.head.ch<q.length){var $e=Ve(t,q.length);Na(n,Pe,new Gt($e,$e));break}}}var Zi=null;function sa(e){Zi=e}function za(e,t,r,i,n){var L=e.doc;e.display.shift=!1,i||(i=L.sel);var j=+new Date-200,Y=n=="paste"||e.state.pasteIncoming>j,Q=xt(t),q=null;if(Y&&i.ranges.length>1)if(Zi&&Zi.text.join(`
`)==t){if(i.ranges.length%Zi.text.length==0){q=[];for(var ue=0;ue<Zi.text.length;ue++)q.push(L.splitLines(Zi.text[ue]))}}else Q.length==i.ranges.length&&e.options.pasteLinesPerSelection&&(q=be(Q,function(rt){return[rt]}));for(var fe=e.curOp.updateInput,Se=i.ranges.length-1;Se>=0;Se--){var Te=i.ranges[Se],Pe=Te.from(),ze=Te.to();Te.empty()&&(r&&r>0?Pe=Ve(Pe.line,Pe.ch-r):e.state.overwrite&&!Y?ze=Ve(ze.line,Math.min(pt(L,ze.line).text.length,ze.ch+xe(Q).length)):Y&&Zi&&Zi.lineWise&&Zi.text.join(`
`)==Q.join(`
`)&&(Pe=ze=Ve(Pe.line,0)));var $e={from:Pe,to:ze,text:q?q[Se%q.length]:Q,origin:n||(Y?"paste":e.state.cutIncoming>j?"cut":"+input")};tn(e.doc,$e),mi(e,"inputRead",e,$e)}t&&!Y&&wo(e,t),Jr(e),e.curOp.updateInput<2&&(e.curOp.updateInput=fe),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function To(e,t){var r=e.clipboardData&&e.clipboardData.getData("Text");if(r)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&Ni(t,function(){return za(t,r,0,null,"paste")}),!0}function wo(e,t){if(!e.options.electricChars||!e.options.smartIndent)return;for(var r=e.doc.sel,i=r.ranges.length-1;i>=0;i--){var n=r.ranges[i];if(n.head.ch>100||i&&r.ranges[i-1].head.line==n.head.line)continue;var L=e.getModeAt(n.head),j=!1;if(L.electricChars){for(var Y=0;Y<L.electricChars.length;Y++)if(t.indexOf(L.electricChars.charAt(Y))>-1){j=Un(e,n.head.line,"smart");break}}else L.electricInput&&(L.electricInput.test(pt(e.doc,n.head.line).text.slice(0,n.head.ch))&&(j=Un(e,n.head.line,"smart")));j&&mi(e,"electricInput",e,n.head.line)}}function So(e){for(var t=[],r=[],i=0;i<e.doc.sel.ranges.length;i++){var n=e.doc.sel.ranges[i].head.line,L={anchor:Ve(n,0),head:Ve(n+1,0)};r.push(L),t.push(e.getRange(L.anchor,L.head))}return{text:t,ranges:r}}function Co(e,t,r,i){e.setAttribute("autocorrect",r?"":"off"),e.setAttribute("autocapitalize",i?"":"off"),e.setAttribute("spellcheck",!!t)}function Ao(){var e=u("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=u("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return D?e.style.width="1000px":e.setAttribute("wrap","off"),d&&(e.style.border="1px solid black"),Co(e),t}function ql(e){var t=e.optionHandlers,r=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(i,n){var L=this.options,j=L[i];if(L[i]==n&&i!="mode")return;L[i]=n,t.hasOwnProperty(i)&&hi(this,t[i])(this,n,j),Re(this,"optionChange",this,i)},getOption:function(i){return this.options[i]},getDoc:function(){return this.doc},addKeyMap:function(i,n){this.state.keyMaps[n?"push":"unshift"](ra(i))},removeKeyMap:function(i){for(var n=this.state.keyMaps,L=0;L<n.length;++L)if(n[L]==i||n[L].name==i)return n.splice(L,1),!0},addOverlay:Si(function(i,n){var L=i.token?i:e.getMode(this.options,i);if(L.startState)throw new Error("Overlays may not be stateful.");ke(this.state.overlays,{mode:L,modeSpec:i,opaque:n&&n.opaque,priority:n&&n.priority||0},function(j){return j.priority}),this.state.modeGen++,Ri(this)}),removeOverlay:Si(function(i){for(var n=this.state.overlays,L=0;L<n.length;++L){var j=n[L].modeSpec;if(j==i||typeof i=="string"&&j.name==i){n.splice(L,1),this.state.modeGen++,Ri(this);return}}}),indentLine:Si(function(i,n,L){typeof n!="string"&&typeof n!="number"&&(n==null?n=this.options.smartIndent?"smart":"prev":n=n?"add":"subtract"),Vi(this.doc,i)&&Un(this,i,n,L)}),indentSelection:Si(function(i){for(var n=this.doc.sel.ranges,L=-1,j=0;j<n.length;j++){var Y=n[j];if(Y.empty())Y.head.line>L&&(Un(this,Y.head.line,i,!0),L=Y.head.line,j==this.doc.sel.primIndex&&Jr(this));else{var Q=Y.from(),q=Y.to(),ue=Math.max(L,Q.line);L=Math.min(this.lastLine(),q.line-(q.ch?0:1))+1;for(var fe=ue;fe<L;++fe)Un(this,fe,i);var Se=this.doc.sel.ranges;Q.ch==0&&n.length==Se.length&&Se[j].from().ch>0&&Na(this.doc,j,new Gt(Q,Se[j].to()),Ee)}}}),getTokenAt:function(i,n){return $t(this,i,n)},getLineTokens:function(i,n){return $t(this,Ve(i),n,!0)},getTokenTypeAt:function(i){i=y(this.doc,i);var n=Ue(this,pt(this.doc,i.line)),L=0,j=(n.length-1)/2,Y=i.ch,Q;if(Y==0)Q=n[2];else for(;;){var q=L+j>>1;if((q?n[q*2-1]:0)>=Y)j=q;else if(n[q*2+1]<Y)L=q+1;else{Q=n[q*2+2];break}}var ue=Q?Q.indexOf("overlay "):-1;return ue<0?Q:ue==0?null:Q.slice(0,ue-1)},getModeAt:function(i){var n=this.doc.mode;return n.innerMode?e.innerMode(n,this.getTokenAt(i).state).mode:n},getHelper:function(i,n){return this.getHelpers(i,n)[0]},getHelpers:function(i,n){var L=[];if(!r.hasOwnProperty(n))return L;var j=r[n],Y=this.getModeAt(i);if(typeof Y[n]=="string")j[Y[n]]&&L.push(j[Y[n]]);else if(Y[n])for(var Q=0;Q<Y[n].length;Q++){var q=j[Y[n][Q]];q&&L.push(q)}else Y.helperType&&j[Y.helperType]?L.push(j[Y.helperType]):j[Y.name]&&L.push(j[Y.name]);for(var ue=0;ue<j._global.length;ue++){var fe=j._global[ue];fe.pred(Y,this)&&ae(L,fe.val)==-1&&L.push(fe.val)}return L},getStateAfter:function(i,n){var L=this.doc;return i=z(L,i==null?L.first+L.size-1:i),it(this,i+1,n).state},cursorCoords:function(i,n){var L,j=this.doc.sel.primary();return i==null?L=j.head:typeof i=="object"?L=y(this.doc,i):L=i?j.from():j.to(),Qi(this,L,n||"page")},charCoords:function(i,n){return ma(this,y(this.doc,i),n||"page")},coordsChar:function(i,n){return i=ls(this,i,n||"page"),va(this,i.left,i.top)},lineAtHeight:function(i,n){return i=ls(this,{top:i,left:0},n||"page").top,Ui(this.doc,i+this.display.viewOffset)},heightAtLine:function(i,n,L){var j=!1,Y;if(typeof i=="number"){var Q=this.doc.first+this.doc.size-1;i<this.doc.first?i=this.doc.first:i>Q&&(i=Q,j=!0),Y=pt(this.doc,i)}else Y=i;return Wn(this,Y,{top:0,left:0},n||"page",L||j).top+(j?this.doc.height-$i(Y):0)},defaultTextHeight:function(){return Yr(this.display)},defaultCharWidth:function(){return $r(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(i,n,L,j,Y){var Q=this.display;i=Qi(this,y(this.doc,i));var q=i.bottom,ue=i.left;if(n.style.position="absolute",n.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(n),Q.sizer.appendChild(n),j=="over")q=i.top;else if(j=="above"||j=="near"){var fe=Math.max(Q.wrapper.clientHeight,this.doc.height),Se=Math.max(Q.sizer.clientWidth,Q.lineSpace.clientWidth);(j=="above"||i.bottom+n.offsetHeight>fe)&&i.top>n.offsetHeight?q=i.top-n.offsetHeight:i.bottom+n.offsetHeight<=fe&&(q=i.bottom),ue+n.offsetWidth>Se&&(ue=Se-n.offsetWidth)}n.style.top=q+"px",n.style.left=n.style.right="",Y=="right"?(ue=Q.sizer.clientWidth-n.offsetWidth,n.style.right="0px"):(Y=="left"?ue=0:Y=="middle"&&(ue=(Q.sizer.clientWidth-n.offsetWidth)/2),n.style.left=ue+"px"),L&&Qo(this,{left:ue,top:q,right:ue+n.offsetWidth,bottom:q+n.offsetHeight})},triggerOnKeyDown:Si(po),triggerOnKeyPress:Si(go),triggerOnKeyUp:mo,triggerOnMouseDown:Si(vo),execCommand:function(i){if(Pn.hasOwnProperty(i))return Pn[i].call(null,this)},triggerElectric:Si(function(i){wo(this,i)}),findPosH:function(i,n,L,j){var Y=1;n<0&&(Y=-1,n=-n);for(var Q=y(this.doc,i),q=0;q<n&&!(Q=Ka(this.doc,Q,Y,L,j),Q.hitSide);++q);return Q},moveH:Si(function(i,n){var L=this;this.extendSelectionsBy(function(j){return L.display.shift||L.doc.extend||j.empty()?Ka(L.doc,j.head,i,n,L.options.rtlMoveVisually):i<0?j.from():j.to()},he)}),deleteH:Si(function(i,n){var L=this.doc.sel,j=this.doc;L.somethingSelected()?j.replaceSelection("",null,"+delete"):sn(this,function(Y){var Q=Ka(j,Y.head,i,n,!1);return i<0?{from:Q,to:Y.head}:{from:Y.head,to:Q}})}),findPosV:function(i,n,L,j){var Y=1,Q=j;n<0&&(Y=-1,n=-n);for(var q=y(this.doc,i),ue=0;ue<n;++ue){var fe=Qi(this,q,"div");if(Q==null?Q=fe.left:fe.left=Q,q=Oo(this,fe,Y,L),q.hitSide)break}return q},moveV:Si(function(i,n){var L=this,j=this.doc,Y=[],Q=!this.display.shift&&!j.extend&&j.sel.somethingSelected();if(j.extendSelectionsBy(function(ue){if(Q)return i<0?ue.from():ue.to();var fe=Qi(L,ue.head,"div");ue.goalColumn!=null&&(fe.left=ue.goalColumn),Y.push(fe.left);var Se=Oo(L,fe,i,n);return n=="page"&&ue==j.sel.primary()&&Sa(L,ma(L,Se,"div").top-fe.top),Se},he),Y.length)for(var q=0;q<j.sel.ranges.length;q++)j.sel.ranges[q].goalColumn=Y[q]}),findWordAt:function(i){var n=this.doc,L=pt(n,i.line).text,j=i.ch,Y=i.ch;if(L){var Q=this.getHelper(i,"wordChars");(i.sticky=="before"||Y==L.length)&&j?--j:++Y;for(var q=L.charAt(j),ue=Ne(q,Q)?function(fe){return Ne(fe,Q)}:/\s/.test(q)?function(fe){return/\s/.test(fe)}:function(fe){return!/\s/.test(fe)&&!Ne(fe)};j>0&&ue(L.charAt(j-1));)--j;for(;Y<L.length&&ue(L.charAt(Y));)++Y}return new Gt(Ve(i.line,j),Ve(i.line,Y))},toggleOverwrite:function(i){if(i!=null&&i==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?P(this.display.cursorDiv,"CodeMirror-overwrite"):T(this.display.cursorDiv,"CodeMirror-overwrite"),Re(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==M()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:Si(function(i,n){_n(this,i,n)}),getScrollInfo:function(){var i=this.display.scroller;return{left:i.scrollLeft,top:i.scrollTop,height:i.scrollHeight-nr(this)-this.display.barHeight,width:i.scrollWidth-nr(this)-this.display.barWidth,clientHeight:ca(this),clientWidth:Mr(this)}},scrollIntoView:Si(function(i,n){i==null?(i={from:this.doc.sel.primary().head,to:null},n==null&&(n=this.options.cursorScrollMargin)):typeof i=="number"?i={from:Ve(i,0),to:null}:i.from==null&&(i={from:i,to:null}),i.to||(i.to=i.from),i.margin=n||0,i.from.line!=null?Jo(this,i):bs(this,i.from,i.to,i.margin)}),setSize:Si(function(i,n){var L=this,j=function(Q){return typeof Q=="number"||/^\d+$/.test(String(Q))?Q+"px":Q};i!=null&&(this.display.wrapper.style.width=j(i)),n!=null&&(this.display.wrapper.style.height=j(n)),this.options.lineWrapping&&as(this);var Y=this.display.viewFrom;this.doc.iter(Y,this.display.viewTo,function(Q){if(Q.widgets){for(var q=0;q<Q.widgets.length;q++)if(Q.widgets[q].noHScroll){Tr(L,Y,"widget");break}}++Y}),this.curOp.forceUpdate=!0,Re(this,"refresh",this)}),operation:function(i){return Ni(this,i)},startOperation:function(){return Hr(this)},endOperation:function(){return jr(this)},refresh:Si(function(){var i=this.display.cachedTextHeight;Ri(this),this.curOp.forceUpdate=!0,yn(this),_n(this,this.doc.scrollLeft,this.doc.scrollTop),Oa(this.display),(i==null||Math.abs(i-Yr(this.display))>.5||this.options.lineWrapping)&&Ea(this),Re(this,"refresh",this)}),swapDoc:Si(function(i){var n=this.doc;return n.cm=null,this.state.selectingText&&this.state.selectingText(),Ds(this,i),yn(this),this.display.input.reset(),_n(this,i.scrollLeft,i.scrollTop),this.curOp.forceScroll=!0,mi(this,"swapDoc",this,n),n}),phrase:function(i){var n=this.options.phrases;return n&&Object.prototype.hasOwnProperty.call(n,i)?n[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}},ve(e),e.registerHelper=function(i,n,L){r.hasOwnProperty(i)||(r[i]=e[i]={_global:[]}),r[i][n]=L},e.registerGlobalHelper=function(i,n,L,j){e.registerHelper(i,n,j),r[i]._global.push({pred:L,val:j})}}function Ka(e,t,r,i,n){var L=t,j=r,Y=pt(e,t.line),Q=n&&e.direction=="rtl"?-r:r;function q(){var lt=t.line+Q;return lt<e.first||lt>=e.first+e.size?!1:(t=new Ve(lt,t.ch,t.sticky),Y=pt(e,lt))}function ue(lt){var nt;if(i=="codepoint"){var ht=Y.text.charCodeAt(t.ch+(i>0?0:-1));isNaN(ht)?nt=null:nt=new Ve(t.line,Math.max(0,Math.min(Y.text.length,t.ch+r*(ht>=55296&&ht<56320?2:1))),-r)}else n?nt=Ml(e.cm,Y,t,r):nt=Ba(Y,t,r);if(nt==null)if(!lt&&q())t=Ua(n,e.cm,Y,t.line,Q);else return!1;else t=nt;return!0}if(i=="char"||i=="codepoint")ue();else if(i=="column")ue(!0);else if(i=="word"||i=="group")for(var fe=null,Se=i=="group",Te=e.cm&&e.cm.getHelper(t,"wordChars"),Pe=!0;!(r<0&&!ue(!Pe));Pe=!1){var ze=Y.text.charAt(t.ch)||`
`,$e=Ne(ze,Te)?"w":Se&&ze==`
`?"n":!Se||/\s/.test(ze)?null:"p";if(Se&&!Pe&&!$e&&($e="s"),fe&&fe!=$e){r<0&&(r=1,ue(),t.sticky="after");break}if($e&&(fe=$e),r>0&&!ue(!Pe))break}var rt=ea(e,t,L,j,!0);return pr(L,rt)&&(rt.hitSide=!0),rt}function Oo(e,t,r,i){var n=e.doc,L=t.left,j;if(i=="page"){var Y=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),Q=Math.max(Y-.5*Yr(e.display),3);j=(r>0?t.bottom:t.top)+r*Q}else i=="line"&&(j=r>0?t.bottom+3:t.top-3);for(var q;!(q=va(e,L,j),!q.outside);){if(r<0?j<=0:j>=n.height){q.hitSide=!0;break}j+=r*5}return q}var Kt=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new ee,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};Kt.prototype.init=function(e){var t=this,r=this,i=r.cm,n=r.div=e.lineDiv;Co(n,i.options.spellcheck,i.options.autocorrect,i.options.autocapitalize);function L(Y){for(var Q=Y.target;Q;Q=Q.parentNode){if(Q==n)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(Q.className))break}return!1}Ie(n,"paste",function(Y){if(!L(Y)||We(i,Y)||To(Y,i))return;H<=11&&setTimeout(hi(i,function(){return t.updateFromDOM()}),20)}),Ie(n,"compositionstart",function(Y){t.composing={data:Y.data,done:!1}}),Ie(n,"compositionupdate",function(Y){t.composing||(t.composing={data:Y.data,done:!1})}),Ie(n,"compositionend",function(Y){t.composing&&(Y.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Ie(n,"touchstart",function(){return r.forceCompositionEnd()}),Ie(n,"input",function(){t.composing||t.readFromDOMSoon()});function j(Y){if(!L(Y)||We(i,Y))return;if(i.somethingSelected())sa({lineWise:!1,text:i.getSelections()}),Y.type=="cut"&&i.replaceSelection("",null,"cut");else if(i.options.lineWiseCopyCut){var Q=So(i);sa({lineWise:!0,text:Q.text}),Y.type=="cut"&&i.operation(function(){i.setSelections(Q.ranges,0,Ee),i.replaceSelection("",null,"cut")})}else return;if(Y.clipboardData){Y.clipboardData.clearData();var q=Zi.text.join(`
`);if(Y.clipboardData.setData("Text",q),Y.clipboardData.getData("Text")==q){Y.preventDefault();return}}var ue=Ao(),fe=ue.firstChild;i.display.lineSpace.insertBefore(ue,i.display.lineSpace.firstChild),fe.value=Zi.text.join(`
`);var Se=document.activeElement;V(fe),setTimeout(function(){i.display.lineSpace.removeChild(ue),Se.focus(),Se==n&&r.showPrimarySelection()},50)}Ie(n,"copy",j),Ie(n,"cut",j)},Kt.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Kt.prototype.prepareSelection=function(){var e=ps(this.cm,!1);return e.focus=document.activeElement==this.div,e},Kt.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},Kt.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Kt.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,r=t.doc.sel.primary(),i=r.from(),n=r.to();if(t.display.viewTo==t.display.viewFrom||i.line>=t.display.viewTo||n.line<t.display.viewFrom){e.removeAllRanges();return}var L=oa(t,e.anchorNode,e.anchorOffset),j=oa(t,e.focusNode,e.focusOffset);if(L&&!L.bad&&j&&!j.bad&&Tt(vr(L,j),i)==0&&Tt(gr(L,j),n)==0)return;var Y=t.display.view,Q=i.line>=t.display.viewFrom&&Ro(t,i)||{node:Y[0].measure.map[2],offset:0},q=n.line<t.display.viewTo&&Ro(t,n);if(!q){var ue=Y[Y.length-1].measure,fe=ue.maps?ue.maps[ue.maps.length-1]:ue.map;q={node:fe[fe.length-1],offset:fe[fe.length-2]-fe[fe.length-3]}}if(!Q||!q){e.removeAllRanges();return}var Se=e.rangeCount&&e.getRangeAt(0),Te;try{Te=m(Q.node,Q.offset,q.offset,q.node)}catch(Pe){}Te&&(!k&&t.state.focused?(e.collapse(Q.node,Q.offset),Te.collapsed||(e.removeAllRanges(),e.addRange(Te))):(e.removeAllRanges(),e.addRange(Te)),Se&&e.anchorNode==null?e.addRange(Se):k&&this.startGracePeriod()),this.rememberSelection()},Kt.prototype.startGracePeriod=function(){var e=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){e.gracePeriod=!1,e.selectionChanged()&&e.cm.operation(function(){return e.cm.curOp.selectionChanged=!0})},20)},Kt.prototype.showMultipleSelections=function(e){b(this.cm.display.cursorDiv,e.cursors),b(this.cm.display.selectionDiv,e.selection)},Kt.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},Kt.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return v(this.div,t)},Kt.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},Kt.prototype.blur=function(){this.div.blur()},Kt.prototype.getField=function(){return this.div},Kt.prototype.supportsTouch=function(){return!0},Kt.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():Ni(this.cm,function(){return e.cm.curOp.selectionChanged=!0});function t(){e.cm.state.focused&&(e.pollSelection(),e.polling.set(e.cm.options.pollInterval,t))}this.polling.set(this.cm.options.pollInterval,t)},Kt.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},Kt.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(s&&g&&this.cm.display.gutterSpecs.length&&eu(e.anchorNode)){this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus();return}if(this.composing)return;this.rememberSelection();var r=oa(t,e.anchorNode,e.anchorOffset),i=oa(t,e.focusNode,e.focusOffset);r&&i&&Ni(t,function(){Ei(t.doc,Sr(r,i),Ee),(r.bad||i.bad)&&(t.curOp.selectionChanged=!0)})},Kt.prototype.pollContent=function(){this.readDOMTimeout!=null&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,t=e.display,r=e.doc.sel.primary(),i=r.from(),n=r.to();if(i.ch==0&&i.line>e.firstLine()&&(i=Ve(i.line-1,pt(e.doc,i.line-1).length)),n.ch==pt(e.doc,n.line).text.length&&n.line<e.lastLine()&&(n=Ve(n.line+1,0)),i.line<t.viewFrom||n.line>t.viewTo-1)return!1;var L,j,Y;i.line==t.viewFrom||(L=Fr(e,i.line))==0?(j=kt(t.view[0].line),Y=t.view[0].node):(j=kt(t.view[L].line),Y=t.view[L-1].node.nextSibling);var Q=Fr(e,n.line),q,ue;if(Q==t.view.length-1?(q=t.viewTo-1,ue=t.lineDiv.lastChild):(q=kt(t.view[Q+1].line)-1,ue=t.view[Q+1].node.previousSibling),!Y)return!1;for(var fe=e.doc.splitLines(tu(e,Y,ue,j,q)),Se=Gi(e.doc,Ve(j,0),Ve(q,pt(e.doc,q).text.length));fe.length>1&&Se.length>1;)if(xe(fe)==xe(Se))fe.pop(),Se.pop(),q--;else if(fe[0]==Se[0])fe.shift(),Se.shift(),j++;else break;for(var Te=0,Pe=0,ze=fe[0],$e=Se[0],rt=Math.min(ze.length,$e.length);Te<rt&&ze.charCodeAt(Te)==$e.charCodeAt(Te);)++Te;for(var lt=xe(fe),nt=xe(Se),ht=Math.min(lt.length-(fe.length==1?Te:0),nt.length-(Se.length==1?Te:0));Pe<ht&&lt.charCodeAt(lt.length-Pe-1)==nt.charCodeAt(nt.length-Pe-1);)++Pe;if(fe.length==1&&Se.length==1&&j==i.line)for(;Te&&Te>i.ch&&lt.charCodeAt(lt.length-Pe-1)==nt.charCodeAt(nt.length-Pe-1);)Te--,Pe++;fe[fe.length-1]=lt.slice(0,lt.length-Pe).replace(/^\u200b+/,""),fe[0]=fe[0].slice(Te).replace(/\u200b+$/,"");var Et=Ve(j,Te),vt=Ve(q,Se.length?xe(Se).length-Pe:0);if(fe.length>1||fe[0]||Tt(Et,vt))return rn(e.doc,fe,Et,vt,"+input"),!0},Kt.prototype.ensurePolled=function(){this.forceCompositionEnd()},Kt.prototype.reset=function(){this.forceCompositionEnd()},Kt.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},Kt.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)},Kt.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&Ni(this.cm,function(){return Ri(e.cm)})},Kt.prototype.setUneditable=function(e){e.contentEditable="false"},Kt.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||hi(this.cm,za)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},Kt.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},Kt.prototype.onContextMenu=function(){},Kt.prototype.resetPosition=function(){},Kt.prototype.needsContentAttribute=!0;function Ro(e,t){var r=fa(e,t.line);if(!r||r.hidden)return null;var i=pt(e.doc,t.line),n=es(r,i,t.line),L=Xe(i,e.doc.direction),j="left";if(L){var Y=Ze(L,t.ch);j=Y%2?"right":"left"}var Q=rs(n.map,t.ch,j);return Q.offset=Q.collapse=="right"?Q.end:Q.start,Q}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function ln(e,t){return t&&(e.bad=!0),e}function tu(e,t,r,i,n){var L="",j=!1,Y=e.doc.lineSeparator(),Q=!1;function q(Te){return function(Pe){return Pe.id==Te}}function ue(){j&&(L+=Y,Q&&(L+=Y),j=Q=!1)}function fe(Te){Te&&(ue(),L+=Te)}function Se(Te){if(Te.nodeType==1){var Pe=Te.getAttribute("cm-text");if(Pe){fe(Pe);return}var ze=Te.getAttribute("cm-marker"),$e;if(ze){var rt=e.findMarks(Ve(i,0),Ve(n+1,0),q(+ze));rt.length&&($e=rt[0].find(0))&&fe(Gi(e.doc,$e.from,$e.to).join(Y));return}if(Te.getAttribute("contenteditable")=="false")return;var lt=/^(pre|div|p|li|table|br)$/i.test(Te.nodeName);if(!/^br$/i.test(Te.nodeName)&&Te.textContent.length==0)return;lt&&ue();for(var nt=0;nt<Te.childNodes.length;nt++)Se(Te.childNodes[nt]);/^(pre|p)$/i.test(Te.nodeName)&&(Q=!0),lt&&(j=!0)}else Te.nodeType==3&&fe(Te.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(Se(t),t==r);)t=t.nextSibling,Q=!1;return L}function oa(e,t,r){var i;if(t==e.display.lineDiv){if(i=e.display.lineDiv.childNodes[r],!i)return ln(e.clipPos(Ve(e.display.viewTo-1)),!0);t=null,r=0}else for(i=t;;i=i.parentNode){if(!i||i==e.display.lineDiv)return null;if(i.parentNode&&i.parentNode==e.display.lineDiv)break}for(var n=0;n<e.display.view.length;n++){var L=e.display.view[n];if(L.node==i)return iu(L,t,r)}}function iu(e,t,r){var i=e.text.firstChild,n=!1;if(!t||!v(i,t))return ln(Ve(kt(e.line),0),!0);if(t==i&&(n=!0,t=i.childNodes[r],r=0,!t)){var L=e.rest?xe(e.rest):e.line;return ln(Ve(kt(L),L.text.length),n)}var j=t.nodeType==3?t:null,Y=t;for(!j&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(j=t.firstChild,r&&(r=j.nodeValue.length));Y.parentNode!=i;)Y=Y.parentNode;var Q=e.measure,q=Q.maps;function ue($e,rt,lt){for(var nt=-1;nt<(q?q.length:0);nt++)for(var ht=nt<0?Q.map:q[nt],Et=0;Et<ht.length;Et+=3){var vt=ht[Et+2];if(vt==$e||vt==rt){var At=kt(nt<0?e.line:e.rest[nt]),Xt=ht[Et]+lt;return(lt<0||vt!=$e)&&(Xt=ht[Et+(lt?1:0)]),Ve(At,Xt)}}}var fe=ue(j,Y,r);if(fe)return ln(fe,n);for(var Se=Y.nextSibling,Te=j?j.nodeValue.length-r:0;Se;Se=Se.nextSibling){if(fe=ue(Se,Se.firstChild,0),fe)return ln(Ve(fe.line,fe.ch-Te),n);Te+=Se.textContent.length}for(var Pe=Y.previousSibling,ze=r;Pe;Pe=Pe.previousSibling){if(fe=ue(Pe,Pe.firstChild,-1),fe)return ln(Ve(fe.line,fe.ch+ze),n);ze+=Pe.textContent.length}}var ii=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new ee,this.hasSelection=!1,this.composing=null};ii.prototype.init=function(e){var t=this,r=this,i=this.cm;this.createField(e);var n=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),d&&(n.style.width="0px"),Ie(n,"input",function(){G&&H>=9&&t.hasSelection&&(t.hasSelection=null),r.poll()}),Ie(n,"paste",function(j){if(We(i,j)||To(j,i))return;i.state.pasteIncoming=+new Date,r.fastPoll()});function L(j){if(We(i,j))return;if(i.somethingSelected())sa({lineWise:!1,text:i.getSelections()});else if(i.options.lineWiseCopyCut){var Y=So(i);sa({lineWise:!0,text:Y.text}),j.type=="cut"?i.setSelections(Y.ranges,null,Ee):(r.prevInput="",n.value=Y.text.join(`
`),V(n))}else return;j.type=="cut"&&(i.state.cutIncoming=+new Date)}Ie(n,"cut",L),Ie(n,"copy",L),Ie(e.scroller,"paste",function(j){if(hr(e,j)||We(i,j))return;if(!n.dispatchEvent){i.state.pasteIncoming=+new Date,r.focus();return}var Y=new Event("paste");Y.clipboardData=j.clipboardData,n.dispatchEvent(Y)}),Ie(e.lineSpace,"selectstart",function(j){hr(e,j)||te(j)}),Ie(n,"compositionstart",function(){var j=i.getCursor("from");r.composing&&r.composing.range.clear(),r.composing={start:j,range:i.markText(j,i.getCursor("to"),{className:"CodeMirror-composing"})}}),Ie(n,"compositionend",function(){r.composing&&(r.poll(),r.composing.range.clear(),r.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,r=e.doc,i=ps(e);if(e.options.moveInputWithCursor){var n=Qi(e,r.sel.primary().head,"div"),L=t.wrapper.getBoundingClientRect(),j=t.lineDiv.getBoundingClientRect();i.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,n.top+j.top-L.top)),i.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,n.left+j.left-L.left))}return i},ii.prototype.showSelection=function(e){var t=this.cm,r=t.display;b(r.cursorDiv,e.cursors),b(r.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 r=t.getSelection();this.textarea.value=r,t.state.focused&&V(this.textarea),G&&H>=9&&(this.hasSelection=r)}else e||(this.prevInput=this.textarea.value="",G&&H>=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||M()!=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 r(){var i=t.poll();!i&&!e?(e=!0,t.polling.set(60,r)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,r)},ii.prototype.poll=function(){var e=this,t=this.cm,r=this.textarea,i=this.prevInput;if(this.contextMenuPending||!t.state.focused||ut(r)&&!i&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var n=r.value;if(n==i&&!t.somethingSelected())return!1;if(G&&H>=9&&this.hasSelection===n||l&&/[\uf700-\uf7ff]/.test(n))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var L=n.charCodeAt(0);if(L==8203&&!i&&(i="\u200B"),L==8666)return this.reset(),this.cm.execCommand("undo")}for(var j=0,Y=Math.min(i.length,n.length);j<Y&&i.charCodeAt(j)==n.charCodeAt(j);)++j;return Ni(t,function(){za(t,n.slice(j),i.length-j,null,e.composing?"*compose":null),n.length>1e3||n.indexOf(`
`)>-1?r.value=e.prevInput="":e.prevInput=n,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(){G&&H>=9&&(this.hasSelection=null),this.fastPoll()},ii.prototype.onContextMenu=function(e){var t=this,r=t.cm,i=r.display,n=t.textarea;t.contextMenuPending&&t.contextMenuPending();var L=Nr(r,e),j=i.scroller.scrollTop;if(!L||p)return;var Y=r.options.resetSelectionOnContextMenu;Y&&r.doc.sel.contains(L)==-1&&hi(r,Ei)(r.doc,Sr(L),Ee);var Q=n.style.cssText,q=t.wrapper.style.cssText,ue=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",n.style.cssText=`position: absolute; width: 30px; height: 30px;
top: `+(e.clientY-ue.top-5)+"px; left: "+(e.clientX-ue.left-5)+`px;
z-index: 1000; background: `+(G?"rgba(255, 255, 255, .05)":"transparent")+`;
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var fe;D&&(fe=window.scrollY),i.input.focus(),D&&window.scrollTo(null,fe),i.input.reset(),r.somethingSelected()||(n.value=t.prevInput=" "),t.contextMenuPending=Te,i.selForContextMenu=r.doc.sel,clearTimeout(i.detectingSelectAll);function Se(){if(n.selectionStart!=null){var ze=r.somethingSelected(),$e="\u200B"+(ze?n.value:"");n.value="\u21DA",n.value=$e,t.prevInput=ze?"":"\u200B",n.selectionStart=1,n.selectionEnd=$e.length,i.selForContextMenu=r.doc.sel}}function Te(){if(t.contextMenuPending!=Te)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=q,n.style.cssText=Q,G&&H<9&&i.scrollbars.setScrollTop(i.scroller.scrollTop=j),n.selectionStart!=null){(!G||G&&H<9)&&Se();var ze=0,$e=function(){i.selForContextMenu==r.doc.sel&&n.selectionStart==0&&n.selectionEnd>0&&t.prevInput=="\u200B"?hi(r,Vs)(r):ze++<10?i.detectingSelectAll=setTimeout($e,500):(i.selForContextMenu=null,i.input.reset())};i.detectingSelectAll=setTimeout($e,200)}}if(G&&H>=9&&Se(),O){pe(e);var Pe=function(){tt(window,"mouseup",Pe),setTimeout(Te,20)};Ie(window,"mouseup",Pe)}else setTimeout(Te,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 ru(e,t){if(t=t?S(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),t.autofocus==null){var r=M();t.autofocus=r==e||e.getAttribute("autofocus")!=null&&r==document.body}function i(){e.value=Y.getValue()}var n;if(e.form&&(Ie(e.form,"submit",i),!t.leaveSubmitMethodAlone)){var L=e.form;n=L.submit;try{var j=L.submit=function(){i(),L.submit=n,L.submit(),L.submit=j}}catch(Q){}}t.finishInit=function(Q){Q.save=i,Q.getTextArea=function(){return e},Q.toTextArea=function(){Q.toTextArea=isNaN,i(),e.parentNode.removeChild(Q.getWrapperElement()),e.style.display="",e.form&&(tt(e.form,"submit",i),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=n))}},e.style.display="none";var Y=Qt(function(Q){return e.parentNode.insertBefore(Q,e.nextSibling)},t);return Y}function nu(e){e.off=tt,e.on=Ie,e.wheelEventPixels=dl,e.Doc=Li,e.splitLines=xt,e.countColumn=X,e.findColumn=ce,e.isWordChar=De,e.Pass=Ae,e.signal=Re,e.Line=Dr,e.changeEnd=Cr,e.scrollbarModel=xs,e.Pos=Ve,e.cmpPos=Tt,e.modes=Yt,e.mimeModes=Rt,e.resolveMode=Qe,e.getMode=wt,e.modeExtensions=Ot,e.extendMode=Lt,e.copyState=qt,e.startState=er,e.innerMode=qi,e.commands=Pn,e.keyMap=dr,e.keyName=lo,e.isModifierKey=so,e.lookupKey=an,e.normalizeKeyMap=Dl,e.StringStream=Ut,e.SharedTextMarker=kn,e.TextMarker=Or,e.LineWidget=In,e.e_preventDefault=te,e.e_stopPropagation=ie,e.e_stop=pe,e.addClass=P,e.contains=v,e.rmClass=T,e.keyNames=Rr}$l(Qt),ql(Qt);var au="iter insert remove copy getEditor constructor".split(" ");for(var la in Li.prototype)Li.prototype.hasOwnProperty(la)&&ae(au,la)<0&&(Qt.prototype[la]=function(e){return function(){return e.apply(this.doc,arguments)}}(Li.prototype[la]));return ve(Li),Qt.inputStyles={textarea:ii,contenteditable:Kt},Qt.defineMode=function(e){!Qt.defaults.mode&&e!="null"&&(Qt.defaults.mode=e),Ti.apply(this,arguments)},Qt.defineMIME=Bi,Qt.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Qt.defineMIME("text/plain","null"),Qt.defineExtension=function(e,t){Qt.prototype[e]=t},Qt.defineDocExtension=function(e,t){Li.prototype[e]=t},Qt.fromTextArea=ru,nu(Qt),Qt.version="5.58.2",Qt})},Y1PL:function(yt,at,ne){"use strict";ne.r(at),ne.d(at,"ResizableTextArea",function(){return ae});var oe=ne("wx14"),J=ne("1OyB"),k=ne("vuIU"),$=ne("Ji7U"),F=ne("LK+K"),B=ne("q1tI"),G=ne("VTBJ"),H=ne("rePB"),D=ne("Zm9Q"),I=ne("Kwbf"),g=ne("c+Xe"),p=ne("m+aA"),f=ne("bdgK"),h=new Map;function o(Ee){Ee.forEach(function(we){var he,ce=we.target;(he=h.get(ce))===null||he===void 0||he.forEach(function(se){return se(ce)})})}var d=new f.default(o),s=null,a=null;function l(Ee,we){h.has(Ee)||(h.set(Ee,new Set),d.observe(Ee)),h.get(Ee).add(we)}function c(Ee,we){h.has(Ee)&&(h.get(Ee).delete(we),h.get(Ee).size||(d.unobserve(Ee),h.delete(Ee)))}var R=function(Ee){Object($.a)(he,Ee);var we=Object(F.a)(he);function he(){return Object(J.a)(this,he),we.apply(this,arguments)}return Object(k.a)(he,[{key:"render",value:function(){return this.props.children}}]),he}(B.Component),w=B.createContext(null);function x(Ee){var we=Ee.children,he=Ee.onBatchResize,ce=B.useRef(0),se=B.useRef([]),re=B.useContext(w),xe=B.useCallback(function(be,ke,Oe){ce.current+=1;var Be=ce.current;se.current.push({size:be,element:ke,data:Oe}),Promise.resolve().then(function(){Be===ce.current&&(he==null||he(se.current),se.current=[])}),re==null||re(be,ke,Oe)},[he,re]);return B.createElement(w.Provider,{value:xe},we)}function O(Ee){var we=Ee.children,he=Ee.disabled,ce=B.useRef(null),se=B.useRef(null),re=B.useContext(w),xe=B.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),be=B.isValidElement(we)&&Object(g.c)(we),ke=be?we.ref:null,Oe=B.useMemo(function(){return Object(g.a)(ke,ce)},[ke,ce]),Be=B.useRef(Ee);Be.current=Ee;var Ce=B.useCallback(function(De){var Ne=Be.current,Ke=Ne.onResize,Fe=Ne.data,je=De.getBoundingClientRect(),Me=je.width,et=je.height,Je=De.offsetWidth,qe=De.offsetHeight,Ze=Math.floor(Me),dt=Math.floor(et);if(xe.current.width!==Ze||xe.current.height!==dt||xe.current.offsetWidth!==Je||xe.current.offsetHeight!==qe){var Xe={width:Ze,height:dt,offsetWidth:Je,offsetHeight:qe};xe.current=Xe;var Ye=Je===Math.round(Me)?Me:Je,Ie=qe===Math.round(et)?et:qe,ot=Object(G.a)(Object(G.a)({},Xe),{},{offsetWidth:Ye,offsetHeight:Ie});re==null||re(ot,De,Fe),Ke&&Promise.resolve().then(function(){Ke(ot,De)})}},[]);return B.useEffect(function(){var De=Object(p.a)(ce.current)||Object(p.a)(se.current);return De&&!he&&l(De,Ce),function(){return c(De,Ce)}},[ce.current,he]),B.createElement(R,{ref:se},be?B.cloneElement(we,{ref:Oe}):we)}var A="rc-observer-key";function T(Ee){var we=Ee.children,he=Object(D.a)(we);return he.map(function(ce,se){var re=(ce==null?void 0:ce.key)||"".concat(A,"-").concat(se);return B.createElement(O,Object(oe.a)({},Ee,{key:re}),ce)})}T.Collection=x;var E=T,b=ne("bT9E"),u=ne("TSYQ"),_=ne.n(u),m=`
min-height:0 !important;
max-height:none !important;
height:0 !important;
visibility:hidden !important;
overflow:hidden !important;
position:absolute !important;
z-index:-1000 !important;
top:0 !important;
right:0 !important
`,v=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","font-variant","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing","word-break"],M={},P;function K(Ee){var we=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,he=Ee.getAttribute("id")||Ee.getAttribute("data-reactid")||Ee.getAttribute("name");if(we&&M[he])return M[he];var ce=window.getComputedStyle(Ee),se=ce.getPropertyValue("box-sizing")||ce.getPropertyValue("-moz-box-sizing")||ce.getPropertyValue("-webkit-box-sizing"),re=parseFloat(ce.getPropertyValue("padding-bottom"))+parseFloat(ce.getPropertyValue("padding-top")),xe=parseFloat(ce.getPropertyValue("border-bottom-width"))+parseFloat(ce.getPropertyValue("border-top-width")),be=v.map(function(Oe){return"".concat(Oe,":").concat(ce.getPropertyValue(Oe))}).join(";"),ke={sizingStyle:be,paddingSize:re,borderSize:xe,boxSizing:se};return we&&he&&(M[he]=ke),ke}function V(Ee){var we=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,he=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,ce=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;P||(P=document.createElement("textarea"),P.setAttribute("tab-index","-1"),P.setAttribute("aria-hidden","true"),document.body.appendChild(P)),Ee.getAttribute("wrap")?P.setAttribute("wrap",Ee.getAttribute("wrap")):P.removeAttribute("wrap");var se=K(Ee,we),re=se.paddingSize,xe=se.borderSize,be=se.boxSizing,ke=se.sizingStyle;P.setAttribute("style","".concat(ke,";").concat(m)),P.value=Ee.value||Ee.placeholder||"";var Oe=Number.MIN_SAFE_INTEGER,Be=Number.MAX_SAFE_INTEGER,Ce=P.scrollHeight,De;if(be==="border-box"?Ce+=xe:be==="content-box"&&(Ce-=re),he!==null||ce!==null){P.value=" ";var Ne=P.scrollHeight-re;he!==null&&(Oe=Ne*he,be==="border-box"&&(Oe=Oe+re+xe),Ce=Math.max(Oe,Ce)),ce!==null&&(Be=Ne*ce,be==="border-box"&&(Be=Be+re+xe),De=Ce>Be?"":"hidden",Ce=Math.min(Be,Ce))}return{height:Ce,minHeight:Oe,maxHeight:Be,overflowY:De,resize:"none"}}var U=ne("Gytx"),S=ne.n(U),X;(function(Ee){Ee[Ee.NONE=0]="NONE",Ee[Ee.RESIZING=1]="RESIZING",Ee[Ee.RESIZED=2]="RESIZED"})(X||(X={}));var ee=function(Ee){Object($.a)(he,Ee);var we=Object(F.a)(he);function he(ce){var se;return Object(J.a)(this,he),se=we.call(this,ce),se.nextFrameActionId=void 0,se.resizeFrameId=void 0,se.textArea=void 0,se.saveTextArea=function(re){se.textArea=re},se.handleResize=function(re){var xe=se.state.resizeStatus,be=se.props,ke=be.autoSize,Oe=be.onResize;if(xe!==X.NONE)return;typeof Oe=="function"&&Oe(re),ke&&se.resizeOnNextFrame()},se.resizeOnNextFrame=function(){cancelAnimationFrame(se.nextFrameActionId),se.nextFrameActionId=requestAnimationFrame(se.resizeTextarea)},se.resizeTextarea=function(){var re=se.props.autoSize;if(!re||!se.textArea)return;var xe=re.minRows,be=re.maxRows,ke=V(se.textArea,!1,xe,be);se.setState({textareaStyles:ke,resizeStatus:X.RESIZING},function(){cancelAnimationFrame(se.resizeFrameId),se.resizeFrameId=requestAnimationFrame(function(){se.setState({resizeStatus:X.RESIZED},function(){se.resizeFrameId=requestAnimationFrame(function(){se.setState({resizeStatus:X.NONE}),se.fixFirefoxAutoScroll()})})})})},se.renderTextArea=function(){var re=se.props,xe=re.prefixCls,be=xe===void 0?"rc-textarea":xe,ke=re.autoSize,Oe=re.onResize,Be=re.className,Ce=re.disabled,De=se.state,Ne=De.textareaStyles,Ke=De.resizeStatus,Fe=Object(b.a)(se.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),je=_()(be,Be,Object(H.a)({},"".concat(be,"-disabled"),Ce));"value"in Fe&&(Fe.value=Fe.value||"");var Me=Object(G.a)(Object(G.a)(Object(G.a)({},se.props.style),Ne),Ke===X.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return B.createElement(E,{onResize:se.handleResize,disabled:!(ke||Oe)},B.createElement("textarea",Object(oe.a)({},Fe,{className:je,style:Me,ref:se.saveTextArea})))},se.state={textareaStyles:{},resizeStatus:X.NONE},se}return Object(k.a)(he,[{key:"componentDidUpdate",value:function(se){(se.value!==this.props.value||!S()(se.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 se=this.textArea.selectionStart,re=this.textArea.selectionEnd;this.textArea.setSelectionRange(se,re)}}catch(xe){}}},{key:"render",value:function(){return this.renderTextArea()}}]),he}(B.Component),ae=ee,de=function(Ee){Object($.a)(he,Ee);var we=Object(F.a)(he);function he(ce){var se;Object(J.a)(this,he),se=we.call(this,ce),se.resizableTextArea=void 0,se.focus=function(){se.resizableTextArea.textArea.focus()},se.saveTextArea=function(xe){se.resizableTextArea=xe},se.handleChange=function(xe){var be=se.props.onChange;se.setValue(xe.target.value,function(){se.resizableTextArea.resizeTextarea()}),be&&be(xe)},se.handleKeyDown=function(xe){var be=se.props,ke=be.onPressEnter,Oe=be.onKeyDown;xe.keyCode===13&&ke&&ke(xe),Oe&&Oe(xe)};var re=typeof ce.value=="undefined"||ce.value===null?ce.defaultValue:ce.value;return se.state={value:re},se}return Object(k.a)(he,[{key:"setValue",value:function(se,re){"value"in this.props||this.setState({value:se},re)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return B.createElement(ae,Object(oe.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(se){return"value"in se?{value:se.value}:null}}]),he}(B.Component),Ae=at.default=de},ZW9T:function(yt,at,ne){"use strict";ne.d(at,"a",function(){return V});var oe=ne("k1fw"),J=ne("miYZ"),k=ne("tsqr"),$=ne("rAM+"),F=ne("tJVT"),B=ne("PpiC"),G=ne("q1tI"),H=ne.n(G),D=ne("bdgK"),I=ne("oBTY"),g=ne("9og8"),p=ne("WmNS"),f=ne.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"]},o={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"]},d={keywords:["abstract","amp","array","auto","bool","break","case","catch","char","class","const","constexpr","const_cast","continue","cpu","decltype","default","delegate","delete","do","double","dynamic_cast","each","else","enum","event","explicit","export","extern","false","final","finally","float","for","friend","gcnew","generic","goto","if","in","initonly","inline","int","interface","interior_ptr","internal","literal","long","mutable","namespace","new","noexcept","nullptr","__nullptr","operator","override","partial","pascal","pin_ptr","private","property","protected","public","ref","register","reinterpret_cast","restrict","return","safe_cast","sealed","short","signed","sizeof","static","static_assert","static_cast","struct","switch","template","this","thread_local","throw","tile_static","true","try","typedef","typeid","typename","union","unsigned","using","virtual","void","volatile","wchar_t","where","while","_asm","_based","_cdecl","_declspec","_fastcall","_if_exists","_if_not_exists","_inline","_multiple_inheritance","_pascal","_single_inheritance","_stdcall","_virtual_inheritance","_w64","__abstract","__alignof","__asm","__assume","__based","__box","__builtin_alignof","__cdecl","__clrcall","__declspec","__delegate","__event","__except","__fastcall","__finally","__forceinline","__gc","__hook","__identifier","__if_exists","__if_not_exists","__inline","__int128","__int16","__int32","__int64","__int8","__interface","__leave","__m128","__m128d","__m128i","__m256","__m256d","__m256i","__m64","__multiple_inheritance","__newslot","__nogc","__noop","__nounwind","__novtordisp","__pascal","__pin","__pragma","__property","__ptr32","__ptr64","__raise","__restrict","__resume","__sealed","__single_inheritance","__stdcall","__super","__thiscall","__try","__try_cast","__typeof","__unaligned","__unhook","__uuidof","__value","__virtual_inheritance","__w64","__wchar_t"],operators:["=",">","<","!","~","?",":","==","<=",">=","!=","&&","||","++","--","+","-","*","/","&","|","^","%","<<",">>",">>>","+=","-=","*=","/=","&=","|=","^=","%=","<<=",">>=",">>>="],quickKey:[{label:"ifelse",content:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
`)},{label:"#include",content:'include "$0"'},{label:"printf",content:"printf($0)"},{label:"main",content:["int main () {"," $0","}"].join(`
`)},{label:"for",content:["for( ; ; ){"," $0","}"].join(`
`)},{label:"trycatch",content:["try{"," $0","}catch(ExceptionName e){","}"].join(`
`)},{label:"using namespace std;",content:["using namespace std;"].join(`
`)},{label:"#include <iostream>",content:["#include <iostream>"].join(`
`)},{label:"#include <vector>",content:["#include <vector>"].join(`
`)},{label:"#include <sstream>",content:["#include <sstream>"].join(`
`)},{label:"#include <string>",content:["#include <string>"].join(`
`)},{label:"#include <cmath>",content:["#include <cmath>"].join(`
`)}]},s={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=ne("5VLF"),l=ne.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"]}},R=function(S,X){return X.map(function(ee){return{label:ee,kind:S.languages.CompletionItemKind.Keyword,insertText:ee}})},w=function(S){return Object.keys(c.tables).map(function(X){return{label:X,kind:S.languages.CompletionItemKind.Variable,insertText:X}})},x=function(S,X){var ee=c.tables[S];return ee?ee.map(function(ae){return{label:ae,kind:X.languages.CompletionItemKind.Field,insertText:ae}}):[]};function O(U,S,X,ee,ae){var de=S.getWordUntilPosition(X),Ae={startLineNumber:X.lineNumber,endLineNumber:X.lineNumber,startColumn:de.startColumn,endColumn:de.endColumn},Ee=ee.map(function(we){return{label:we,kind:U.languages.CompletionItemKind.Keyword,insertText:we,insertTextRules:U.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:Ae}});return ae.map(function(we){Ee.push(Object(oe.a)(Object(oe.a)({},we),{},{range:Ae}))}),Ee}var A=function(U){c.languages.map(function(ae){return U.languages.registerDocumentFormattingEditProvider(ae,{provideDocumentFormattingEdits:function(Ae,Ee,we){return Object(g.a)(f.a.mark(function he(){var ce;return f.a.wrap(function(re){for(;;)switch(re.prev=re.next){case 0:return ce=l()(Ae.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}),re.abrupt("return",[{range:Ae.getFullModelRange(),text:ce}]);case 2:case"end":return re.stop()}},he)}))()}}),ae});var S=d.quickKey.map(function(ae){return{label:ae.label,kind:U.languages.CompletionItemKind.Method,insertText:ae.content,insertTextRules:U.languages.CompletionItemInsertTextRule.InsertAsSnippet}}),X=s.quickKey.map(function(ae){return{label:ae.label,kind:U.languages.CompletionItemKind.Method,insertText:ae.content,insertTextRules:U.languages.CompletionItemInsertTextRule.InsertAsSnippet}}),ee=o.quickKey.map(function(ae){return{label:ae.label,kind:U.languages.CompletionItemKind.Method,insertText:ae.content,insertTextRules:U.languages.CompletionItemInsertTextRule.InsertAsSnippet}});U.languages.registerCompletionItemProvider("cpp",{triggerCharacters:["."," ","#"].concat(Object(I.a)(d.keywords),Object(I.a)(d.quickKey.map(function(ae){return ae.label}))),provideCompletionItems:function(de,Ae){var Ee=de.getValueInRange({startLineNumber:Ae.lineNumber,startColumn:1,endLineNumber:Ae.lineNumber,endColumn:Ae.column}),we=Ee.match(/cu/gim);console.log("match:",we,Ae,Ee,de);var he=[],ce=Ae.lineNumber,se=Ae.column,re=de.getValueInRange({startLineNumber:ce,startColumn:0,endLineNumber:ce,endColumn:se}),xe=re.trim().split(/\s+/),be=xe[xe.length-1];if(be.endsWith(".")){var ke=be.slice(0,be.length-1);Object.keys(c.tables).includes(ke)&&(he=Object(I.a)(x(ke,U)))}else be==="."?he=[]:he=[].concat(Object(I.a)(w(U)),Object(I.a)(R(U,d.keywords)),Object(I.a)(S));return{suggestions:he}}}),U.languages.registerCompletionItemProvider("c",{triggerCharacters:["."," ","#"].concat(Object(I.a)(h.keywords)),provideCompletionItems:function(de,Ae){var Ee=de.getValueInRange({startLineNumber:Ae.lineNumber,startColumn:1,endLineNumber:Ae.lineNumber,endColumn:Ae.column}),we=Ee.match(/cu/gim);console.log("match:",we,Ae,Ee,de);var he=[],ce=Ae.lineNumber,se=Ae.column,re=de.getValueInRange({startLineNumber:ce,startColumn:0,endLineNumber:ce,endColumn:se}),xe=re.trim().split(/\s+/),be=xe[xe.length-1];if(be.endsWith(".")){var ke=be.slice(0,be.length-1);Object.keys(c.tables).includes(ke)&&(he=Object(I.a)(x(ke,U)))}else be==="."?he=[]:he=[].concat(Object(I.a)(w(U)),Object(I.a)(R(U,h.keywords)));return{suggestions:he}}}),U.languages.registerCompletionItemProvider("java",{triggerCharacters:["."," "].concat(Object(I.a)(o.keywords)),provideCompletionItems:function(de,Ae){var Ee=[],we=Ae.lineNumber,he=Ae.column,ce=de.getValueInRange({startLineNumber:we,startColumn:0,endLineNumber:we,endColumn:he}),se=ce.trim().split(/\s+/),re=se[se.length-1];if(re.endsWith(".")){var xe=re.slice(0,re.length-1);Object.keys(c.tables).includes(xe)&&(Ee=Object(I.a)(x(xe,U)))}else re==="."?Ee=[]:Ee=[].concat(Object(I.a)(w(U)),Object(I.a)(R(U,o.keywords)),Object(I.a)(ee));return{suggestions:Ee}}}),U.languages.registerCompletionItemProvider("python",{triggerCharacters:["."," "].concat(Object(I.a)(s.keywords)),provideCompletionItems:function(de,Ae){var Ee=[],we=Ae.lineNumber,he=Ae.column,ce=de.getValueInRange({startLineNumber:we,startColumn:0,endLineNumber:we,endColumn:he}),se=ce.trim().split(/\s+/),re=se[se.length-1];if(re.endsWith(".")){var xe=re.slice(0,re.length-1);Object.keys(c.tables).includes(xe)&&(Ee=Object(I.a)(x(xe,U)))}else re==="."?Ee=[]:Ee=[].concat(Object(I.a)(w(U)),Object(I.a)(R(U,s.keywords)),Object(I.a)(X));return{suggestions:Ee}}})},T="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",E=ne("LvDl"),b=ne("+ua5");function u(U){return/^\d+$/.test(U)?"".concat(U,"px"):U}function _(){}var m=!1,v={"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 M(){var U=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],S=U;if(Array.isArray(U)){for(var X=0;X<U.length;X++){var ee=v[U[X]];if(ee)return ee}return S[0]}return v[S]||S}var P=null,K=at.b=function(U){var S=U.width,X=S===void 0?"100%":S,ee=U.height,ae=ee===void 0?"100%":ee,de=U.value,Ae=U.language,Ee=Ae===void 0?"javascript":Ae,we=U.style,he=we===void 0?{}:we,ce=U.options,se=ce===void 0?{}:ce,re=U.overrideServices,xe=re===void 0?{}:re,be=U.theme,ke=be===void 0?"vs-dark":be,Oe=U.onEditBlur,Be=U.onSave,Ce=U.autoHeight,De=Ce===void 0?!1:Ce,Ne=U.forbidCopy,Ke=Ne===void 0?!1:Ne,Fe=U.onChange,je=Fe===void 0?_:Fe,Me=U.editorDidMount,et=Me===void 0?_:Me,Je=U.onFocus,qe=Je===void 0?_:Je,Ze=U.filename,dt=Ze===void 0?"educoder.txt":Ze,Xe=U.errorLine,Ye=U.errorContent,Ie=Ye===void 0?"":Ye,ot=Object(B.a)(U,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename","errorLine","errorContent"]),tt=Object(G.useRef)(),Re=Object(G.useRef)({}),We=Object(G.useRef)(),_e=Object(G.useRef)(!1),me=Object(G.useRef)(),ve=Object(G.useState)(!1),te=Object(F.a)(ve,2),ie=te[0],le=te[1];function pe(){var Qe;return tt.current&&(Qe=new D.default(function(wt){var Ot=Object($.a)(wt),Lt;try{for(Ot.s();!(Lt=Ot.n()).done;){var qt=Lt.value;(qt.target.offsetHeight>0||qt.target.offsetWidth>0)&&Re.current.instance.layout()}}catch(qi){Ot.e(qi)}finally{Ot.f()}}),Qe.observe(tt.current)),Qe}function ye(){k.b.warn(decodeURIComponent(T))}var Le=function(){var wt=Re.current.instance;if(de!=null&&wt&&ie){var Ot=wt.getModel();Ot&&de!==Ot.getValue()&&(m=!0,Ot.setValue(de),wt.layout(),m=!1)}};Object(G.useEffect)(function(){We.current&&clearTimeout(We.current),We.current=setTimeout(function(){Le()},500)},[de,ie,Re.current]),Object(G.useEffect)(function(){if(Xe&&Re.current&&Re.current.instance){var Qe=Re.current.instance;Qe.changeViewZones(function(Ot){var Lt=document.createElement("div");Lt.style.padding="10px 20px",Lt.style.width="calc(100% - 20px)",Lt.className="my-error-line-wrp",Lt.innerHTML=Ie,Ot.addZone({afterLineNumber:Xe||11,heightInLines:3,domNode:Lt})});var wt={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(wt),Qe.revealPositionInCenter({lineNumber:20,column:1})}},[Xe,Re.current,ie]);function He(){var Qe=Re.current.instance;if(Qe){var wt=Qe.getSelection(),Ot=Re.current.pastePos||{},Lt=new P.Range(Ot.startLineNumber||wt.endLineNumber,Ot.startColumn||wt.endColumn,Ot.endLineNumber||wt.endLineNumber,Ot.endColumn||wt.endColumn);setTimeout(function(){Qe.executeEdits("",[{range:Lt,text:""}])},300)}}function st(Qe){(window.navigator.platform.match("Mac")?Qe.metaKey:Qe.ctrlKey)&&Qe.keyCode==83&&(Qe.preventDefault(),Be())}var ct=function(){if(De&&Re.current.instance){var wt=Re.current.instance.getContentHeight();Ti(wt<ae?ae:wt)}else Ti(ae)};function ft(Qe){var wt=document.createEvent("MouseEvents");wt.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),Qe.dispatchEvent(wt)}function Ct(Qe,wt){var Ot=window.URL||window.webkitURL||window,Lt=new Blob([wt]),qt=document.createElementNS("http://www.w3.org/1999/xhtml","a");qt.href=Ot.createObjectURL(Lt),qt.download=Qe,ft(qt)}Object(G.useEffect)(function(){ct()},[ct]),Object(G.useEffect)(function(){tt.current&&!ie&&ne.e(27).then(ne.t.bind(null,"M/lh",7)).then(function(Qe){try{P=Qe,Re.current.instance=P.editor.create(tt.current,{value:de,language:M(Ee),theme:ke,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0},xe);var wt=Re.current.instance;if(et(wt,P),setTimeout(function(){ct(),Re.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){Ct(dt||"educoder.txt",wt.getValue())}})},500),Re.current.subscription=wt.onDidChangeModelContent(function(Lt){_e.current?clearTimeout(me.current):(ct(),je(wt.getValue(),Lt)),me.current=setTimeout(function(){_e.current=!1},500)}),window.Monaco||A(P),Ke&&(wt.addCommand(P.KeyMod.CtrlCmd|P.KeyMod.Shift|P.KeyCode.KEY_V,function(){return ye(),null}),wt.addCommand(P.KeyMod.CtrlCmd|P.KeyCode.KEY_C,function(){return ye(),null})),window.Monaco=P,Oe&&wt.onDidBlurEditorWidget(function(){Oe(wt.getValue())}),qe&&wt.onDidFocusEditorText(function(){qe(wt.getValue())}),Ke){wt.addCommand(P.KeyMod.CtrlCmd|P.KeyCode.KEY_V,function(){return ye(),null}),wt.onDidPaste(function(Lt){Re.current.pastePos=Lt});try{window.addEventListener("paste",He)}catch(Lt){}}var Ot=pe();return le(!0),function(){var Lt=Re.current.instance;Lt.dispose();var qt=Lt.getModel();qt&&qt.dispose(),Re.current.subscription&&Re.current.subscription.dispose(),Ke&&window.removeEventListener("paste",He),Ot.unobserve(tt.current)}}catch(Lt){}})},[]),Object(G.useEffect)(function(){var Qe=Re.current.instance;if(Qe&&ie)return document.addEventListener("keydown",st,!1),function(){document.removeEventListener("keydown",st)}},[Be,ie]),Object(G.useEffect)(function(){var Qe=Re.current.instance;if(Qe&&ie){var wt=M(Ee);P.editor.setModelLanguage(Qe.getModel(),wt),console.log("language:",Ee,Qe.getModel(),wt)}},[Ee,ie]),Object(G.useEffect)(function(){var Qe=Re.current.instance;Qe&&ie&&P.editor.setTheme(ke)},[ke,ie]),Object(G.useEffect)(function(){var Qe=Re.current.instance;Qe&&ie&&(Qe.updateOptions(Object(oe.a)({},se)),setTimeout(function(){Qe.getModel().updateOptions(Object(oe.a)({},se))},200))},[JSON.stringify(se),ie]),Object(G.useEffect)(function(){var Qe=Re.current.instance;Qe&&ie&&Qe.layout()},[X,ae,ie]);var xt=Object(G.useState)(u(X)),ut=Object(F.a)(xt,2),Bt=ut[0],Pt=ut[1],Jt=Object(G.useState)(u(ae)),Yt=Object(F.a)(Jt,2),Rt=Yt[0],Ti=Yt[1],Bi=Object(oe.a)(Object(oe.a)({},he),{},{width:Bt,height:Rt});return H.a.createElement("div",{className:"my-monaco-editor",ref:tt,style:Bi})};function V(U){var S=U.width,X=S===void 0?"100%":S,ee=U.height,ae=ee===void 0?"100%":ee,de=U.original,Ae=U.modified,Ee=U.language,we=U.options,he=we===void 0?{}:we,ce=Object(G.useRef)(),se=Object(G.useState)(null),re=Object(F.a)(se,2),xe=re[0],be=re[1];function ke(De){var Ne;return ce.current&&(Ne=new D.default(function(Ke){var Fe=Object($.a)(Ke),je;try{for(Fe.s();!(je=Fe.n()).done;){var Me=je.value;(Me.target.offsetHeight>0||Me.target.offsetWidth>0)&&De.layout()}}catch(et){Fe.e(et)}finally{Fe.f()}}),Ne.observe(ce.current)),Ne}Object(G.useEffect)(function(){ce.current&&ne.e(27).then(ne.t.bind(null,"M/lh",7)).then(function(De){P=De;var Ne=P.editor.createDiffEditor(ce.current,Object(oe.a)(Object(oe.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},he),{},{wordWrap:!0}));be(Ne);var Ke=ke(Ne);return function(){Ne.dispose();var Fe=Ne.getModel();Fe&&Fe.dispose(),Ke.unobserve(ce.current)}})},[]),Object(G.useEffect)(function(){xe&&xe.setModel({original:P.editor.createModel(de,Ee),modified:P.editor.createModel(Ae,Ee)})},[de,Ae,Ee,xe]);var Oe=u(X),Be=u(ae),Ce={width:Oe,height:Be};return H.a.createElement("div",{className:"my-diff-editor",ref:ce,style:Ce})}},ZpRC:function(yt,at,ne){"use strict";function oe(g){return typeof g=="object"&&g!=null&&g.nodeType===1}function J(g,p){return(!p||g!=="hidden")&&g!=="visible"&&g!=="clip"}function k(g,p){if(g.clientHeight<g.scrollHeight||g.clientWidth<g.scrollWidth){var f=getComputedStyle(g,null);return J(f.overflowY,p)||J(f.overflowX,p)||function(h){var o=function(d){if(!d.ownerDocument||!d.ownerDocument.defaultView)return null;try{return d.ownerDocument.defaultView.frameElement}catch(s){return null}}(h);return!!o&&(o.clientHeight<h.scrollHeight||o.clientWidth<h.scrollWidth)}(g)}return!1}function $(g,p,f,h,o,d,s,a){return d<g&&s>p||d>g&&s<p?0:d<=g&&a<=f||s>=p&&a>=f?d-g-h:s>p&&a<f||d<g&&a>f?s-p+o:0}var F=function(g,p){var f=window,h=p.scrollMode,o=p.block,d=p.inline,s=p.boundary,a=p.skipOverflowHiddenElements,l=typeof s=="function"?s:function(Ne){return Ne!==s};if(!oe(g))throw new TypeError("Invalid target");for(var c=document.scrollingElement||document.documentElement,R=[],w=g;oe(w)&&l(w);){if((w=w.parentElement)===c){R.push(w);break}w!=null&&w===document.body&&k(w)&&!k(document.documentElement)||w!=null&&k(w,a)&&R.push(w)}for(var x=f.visualViewport?f.visualViewport.width:innerWidth,O=f.visualViewport?f.visualViewport.height:innerHeight,A=window.scrollX||pageXOffset,T=window.scrollY||pageYOffset,E=g.getBoundingClientRect(),b=E.height,u=E.width,_=E.top,m=E.right,v=E.bottom,M=E.left,P=o==="start"||o==="nearest"?_:o==="end"?v:_+b/2,K=d==="center"?M+u/2:d==="end"?m:M,V=[],U=0;U<R.length;U++){var S=R[U],X=S.getBoundingClientRect(),ee=X.height,ae=X.width,de=X.top,Ae=X.right,Ee=X.bottom,we=X.left;if(h==="if-needed"&&_>=0&&M>=0&&v<=O&&m<=x&&_>=de&&v<=Ee&&M>=we&&m<=Ae)return V;var he=getComputedStyle(S),ce=parseInt(he.borderLeftWidth,10),se=parseInt(he.borderTopWidth,10),re=parseInt(he.borderRightWidth,10),xe=parseInt(he.borderBottomWidth,10),be=0,ke=0,Oe="offsetWidth"in S?S.offsetWidth-S.clientWidth-ce-re:0,Be="offsetHeight"in S?S.offsetHeight-S.clientHeight-se-xe:0;if(c===S)be=o==="start"?P:o==="end"?P-O:o==="nearest"?$(T,T+O,O,se,xe,T+P,T+P+b,b):P-O/2,ke=d==="start"?K:d==="center"?K-x/2:d==="end"?K-x:$(A,A+x,x,ce,re,A+K,A+K+u,u),be=Math.max(0,be+T),ke=Math.max(0,ke+A);else{be=o==="start"?P-de-se:o==="end"?P-Ee+xe+Be:o==="nearest"?$(de,Ee,ee,se,xe+Be,P,P+b,b):P-(de+ee/2)+Be/2,ke=d==="start"?K-we-ce:d==="center"?K-(we+ae/2)+Oe/2:d==="end"?K-Ae+re+Oe:$(we,Ae,ae,ce,re+Oe,K,K+u,u);var Ce=S.scrollLeft,De=S.scrollTop;P+=De-(be=Math.max(0,Math.min(De+be,S.scrollHeight-ee+Be))),K+=Ce-(ke=Math.max(0,Math.min(Ce+ke,S.scrollWidth-ae+Oe)))}V.push({el:S,top:be,left:ke})}return V};function B(g){return g===Object(g)&&Object.keys(g).length!==0}function G(g,p){p===void 0&&(p="auto");var f="scrollBehavior"in document.body.style;g.forEach(function(h){var o=h.el,d=h.top,s=h.left;o.scroll&&f?o.scroll({top:d,left:s,behavior:p}):(o.scrollTop=d,o.scrollLeft=s)})}function H(g){return g===!1?{block:"end",inline:"nearest"}:B(g)?g:{block:"start",inline:"nearest"}}function D(g,p){var f=!g.ownerDocument.documentElement.contains(g);if(B(p)&&typeof p.behavior=="function")return p.behavior(f?[]:F(g,p));if(f)return;var h=H(p);return G(F(g,h),h.behavior)}var I=at.a=D},bT9E:function(yt,at,ne){"use strict";ne.d(at,"a",function(){return J});var oe=ne("VTBJ");function J(k,$){var F=Object(oe.a)({},k);return Array.isArray($)&&$.forEach(function(B){delete F[B]}),F}},c5Ni:function(yt,at,ne){},dejd:function(yt,at,ne){},dmUQ:function(yt,at,ne){"use strict";var oe=ne("Ff2n"),J=ne("rePB"),k=ne("1OyB"),$=ne("vuIU"),F=ne("Ji7U"),B=ne("md7G"),G=ne("foSv"),H=ne("q1tI"),D=ne.n(H),I=ne("TSYQ"),g=ne.n(I),p=ne("4IlW");function f(b,u){var _=Object.keys(b);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(b);u&&(m=m.filter(function(v){return Object.getOwnPropertyDescriptor(b,v).enumerable})),_.push.apply(_,m)}return _}function h(b){for(var u=1;u<arguments.length;u++){var _=arguments[u]!=null?arguments[u]:{};u%2?f(Object(_),!0).forEach(function(m){Object(J.a)(b,m,_[m])}):Object.getOwnPropertyDescriptors?Object.defineProperties(b,Object.getOwnPropertyDescriptors(_)):f(Object(_)).forEach(function(m){Object.defineProperty(b,m,Object.getOwnPropertyDescriptor(_,m))})}return b}function o(b){var u=d();return function(){var m=Object(G.a)(b),v;if(u){var M=Object(G.a)(this).constructor;v=Reflect.construct(m,arguments,M)}else v=m.apply(this,arguments);return Object(B.a)(this,v)}}function d(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(b){return!1}}function s(){}function a(b){b.preventDefault()}var l=function(u){return u.replace(/[^\w.-]+/g,"")},c=200,R=600,w=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,x=function(u){return u!=null},O=function(u,_){return _===u||typeof _=="number"&&typeof u=="number"&&isNaN(_)&&isNaN(u)},A=function(b){Object(F.a)(_,b);var u=o(_);function _(m){var v;Object(k.a)(this,_),v=u.call(this,m),v.onKeyDown=function(K){var V=v.props,U=V.onKeyDown,S=V.onPressEnter;if(K.keyCode===p.a.UP){var X=v.getRatio(K);v.up(K,X,null),v.stop()}else if(K.keyCode===p.a.DOWN){var ee=v.getRatio(K);v.down(K,ee,null),v.stop()}else K.keyCode===p.a.ENTER&&S&&S(K);if(v.recordCursorPosition(),v.lastKeyCode=K.keyCode,U){for(var ae=arguments.length,de=new Array(ae>1?ae-1:0),Ae=1;Ae<ae;Ae++)de[Ae-1]=arguments[Ae];U.apply(void 0,[K].concat(de))}},v.onKeyUp=function(K){var V=v.props.onKeyUp;if(v.stop(),v.recordCursorPosition(),V){for(var U=arguments.length,S=new Array(U>1?U-1:0),X=1;X<U;X++)S[X-1]=arguments[X];V.apply(void 0,[K].concat(S))}},v.onChange=function(K){var V=v.props.onChange;v.state.focused&&(v.inputting=!0),v.rawInput=v.props.parser(v.getValueFromEvent(K)),v.setState({inputValue:v.rawInput}),V(v.toNumber(v.rawInput))},v.onMouseUp=function(){var K=v.props.onMouseUp;v.recordCursorPosition(),K&&K.apply(void 0,arguments)},v.onFocus=function(){var K;v.setState({focused:!0}),(K=v.props).onFocus.apply(K,arguments)},v.onBlur=function(){var K=v.props.onBlur;v.inputting=!1,v.setState({focused:!1});var V=v.getCurrentValidValue(v.state.inputValue),U=v.setValue(V,s);if(K){var S=v.input.value,X=v.getInputDisplayValue({focus:!1,value:U});v.input.value=X&&Number(X),K.apply(void 0,arguments),v.input.value=S}},v.getRatio=function(K){var V=1;return K.metaKey||K.ctrlKey?V=.1:K.shiftKey&&(V=10),V},v.getFullNum=function(K){return isNaN(K)?K:/e/i.test(String(K))?Number(K).toFixed(18).replace(/\.?0+$/,""):K},v.getPrecision=function(K){if(x(v.props.precision))return v.props.precision;var V=String(K);if(V.indexOf("e-")>=0)return parseInt(V.slice(V.indexOf("e-")+2),10);var U=0;return V.indexOf(".")>=0&&(U=V.length-V.indexOf(".")-1),U},v.getInputDisplayValue=function(K){var V=K||v.state,U=V.focused,S=V.inputValue,X=V.value,ee;U?ee=S:ee=v.toPrecisionAsStep(X),ee==null&&(ee="");var ae=v.formatWrapper(ee);return x(v.props.decimalSeparator)&&(ae=ae.toString().replace(".",v.props.decimalSeparator)),ae},v.recordCursorPosition=function(){try{v.cursorStart=v.input.selectionStart,v.cursorEnd=v.input.selectionEnd,v.currentValue=v.input.value,v.cursorBefore=v.input.value.substring(0,v.cursorStart),v.cursorAfter=v.input.value.substring(v.cursorEnd)}catch(K){}},v.restoreByAfter=function(K){if(K===void 0)return!1;var V=v.input.value,U=V.lastIndexOf(K);if(U===-1)return!1;var S=v.cursorBefore.length;return v.lastKeyCode===p.a.DELETE&&v.cursorBefore.charAt(S-1)===K[0]?(v.fixCaret(S,S),!0):U+K.length===V.length?(v.fixCaret(U,U),!0):!1},v.partRestoreByAfter=function(K){return K===void 0?!1:Array.prototype.some.call(K,function(V,U){var S=K.substring(U);return v.restoreByAfter(S)})},v.isNotCompleteNumber=function(K){return isNaN(K)||K===""||K===null||K&&K.toString().indexOf(".")===K.toString().length-1},v.stop=function(){v.autoStepTimer&&clearTimeout(v.autoStepTimer)},v.down=function(K,V,U){v.pressingUpOrDown=!0,v.step("down",K,V,U)},v.up=function(K,V,U){v.pressingUpOrDown=!0,v.step("up",K,V,U)},v.saveInput=function(K){v.input=K};var M=m.value;M===void 0&&(M=m.defaultValue),v.state={focused:m.autoFocus};var P=v.getValidValue(v.toNumber(M));return v.state=h(h({},v.state),{},{inputValue:v.toPrecisionAsStep(P),value:P}),v}return Object($.a)(_,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(v){var M=this.props,P=M.value,K=M.onChange,V=M.max,U=M.min,S=this.state.focused;if(v){if(!O(v.value,P)||!O(v.max,V)||!O(v.min,U)){var X=S?P:this.getValidValue(P),ee;this.pressingUpOrDown?ee=X:this.inputting?ee=this.rawInput:ee=this.toPrecisionAsStep(X),this.setState({value:X,inputValue:ee})}var ae="value"in this.props?P:this.state.value;"max"in this.props&&v.max!==V&&typeof ae=="number"&&ae>V&&K&&K(V),"min"in this.props&&v.min!==U&&typeof ae=="number"&&ae<U&&K&&K(U)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var de=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===p.a.BACKSPACE?de=this.cursorStart-1:this.lastKeyCode===p.a.DELETE&&(de=this.cursorStart):de=this.input.value.length,this.fixCaret(de,de)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case p.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case p.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(Ae){}if(this.lastKeyCode=null,!this.pressingUpOrDown)return;this.props.focusOnUpDown&&this.state.focused&&(document.activeElement!==this.input&&this.focus())}},{key:"componentWillUnmount",value:function(){this.stop()}},{key:"getCurrentValidValue",value:function(v){var M=v;return M===""?M="":this.isNotCompleteNumber(parseFloat(M))?M=this.state.value:M=this.getValidValue(M),this.toNumber(M)}},{key:"getValueFromEvent",value:function(v){var M=v.target.value.trim().replace(/。/g,".");return x(this.props.decimalSeparator)&&(M=M.replace(this.props.decimalSeparator,".")),M}},{key:"getValidValue",value:function(v){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,P=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,K=parseFloat(v);return isNaN(K)?v:(K<M&&(K=M),K>P&&(K=P),K)}},{key:"setValue",value:function(v,M){var P=this.props.precision,K=this.isNotCompleteNumber(parseFloat(v))?null:parseFloat(v),V=this.state.value,U=V===void 0?null:V,S=this.state.inputValue,X=S===void 0?null:S,ee=typeof K=="number"?K.toFixed(P):"".concat(K),ae=K!==U||ee!=="".concat(X);return"value"in this.props?(X=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:X},M)):this.setState({value:K,inputValue:this.toPrecisionAsStep(v)},M),ae&&this.props.onChange(K),K}},{key:"getMaxPrecision",value:function(v){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,P=this.props,K=P.precision,V=P.step;if(x(K))return K;var U=this.getPrecision(M),S=this.getPrecision(V),X=this.getPrecision(v);return v?Math.max(X,U+S):U+S}},{key:"getPrecisionFactor",value:function(v){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,P=this.getMaxPrecision(v,M);return Math.pow(10,P)}},{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(v){return this.props.formatter?this.props.formatter(v):v}},{key:"toPrecisionAsStep",value:function(v){if(this.isNotCompleteNumber(v)||v==="")return v;var M=Math.abs(this.getMaxPrecision(v));return isNaN(M)?v.toString():Number(v).toFixed(M)}},{key:"toNumber",value:function(v){var M=this.props.precision,P=this.state.focused,K=v&&v.length>16&&P;return this.isNotCompleteNumber(v)||K?v:x(M)?Math.round(v*Math.pow(10,M))/Math.pow(10,M):Number(v)}},{key:"upStep",value:function(v,M){var P=this.props.step,K=this.getPrecisionFactor(v,M),V=Math.abs(this.getMaxPrecision(v,M)),U=((K*v+K*P*M)/K).toFixed(V);return this.toNumber(U)}},{key:"downStep",value:function(v,M){var P=this.props.step,K=this.getPrecisionFactor(v,M),V=Math.abs(this.getMaxPrecision(v,M)),U=((K*v-K*P*M)/K).toFixed(V);return this.toNumber(U)}},{key:"step",value:function(v,M){var P=this,K=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,V=arguments.length>3?arguments[3]:void 0;this.stop(),M&&(M.persist(),M.preventDefault());var U=this.props;if(U.disabled)return;var S=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(S))return;var X=this["".concat(v,"Step")](S,K),ee=X>U.max||X<U.min;if(X>U.max?X=U.max:X<U.min&&(X=U.min),this.setValue(X,null),this.setState({focused:!0},function(){P.pressingUpOrDown=!1}),ee)return;this.autoStepTimer=setTimeout(function(){P[v](M,K,!0)},V?c:R)}},{key:"fixCaret",value:function(v,M){if(v===void 0||M===void 0||!this.input||!this.input.value)return;try{var P=this.input.selectionStart,K=this.input.selectionEnd;(v!==P||M!==K)&&this.input.setSelectionRange(v,M)}catch(V){}}},{key:"render",value:function(){var v,M=this.props,P=M.prefixCls,K=M.disabled,V=M.readOnly,U=M.useTouch,S=M.autoComplete,X=M.upHandler,ee=M.downHandler,ae=M.className,de=M.max,Ae=M.min,Ee=M.style,we=M.title,he=M.onMouseEnter,ce=M.onMouseLeave,se=M.onMouseOver,re=M.onMouseOut,xe=M.required,be=M.onClick,ke=M.tabIndex,Oe=M.type,Be=M.placeholder,Ce=M.id,De=M.inputMode,Ne=M.pattern,Ke=M.step,Fe=M.maxLength,je=M.autoFocus,Me=M.name,et=M.onPaste,Je=M.onInput,qe=Object(oe.a)(M,["prefixCls","disabled","readOnly","useTouch","autoComplete","upHandler","downHandler","className","max","min","style","title","onMouseEnter","onMouseLeave","onMouseOver","onMouseOut","required","onClick","tabIndex","type","placeholder","id","inputMode","pattern","step","maxLength","autoFocus","name","onPaste","onInput"]),Ze=this.state,dt=Ze.value,Xe=Ze.focused,Ye=g()(P,(v={},Object(J.a)(v,ae,!!ae),Object(J.a)(v,"".concat(P,"-disabled"),K),Object(J.a)(v,"".concat(P,"-focused"),Xe),v)),Ie={};Object.keys(qe).forEach(function(pe){(pe.substr(0,5)==="data-"||pe.substr(0,5)==="aria-"||pe==="role")&&(Ie[pe]=qe[pe])});var ot=!V&&!K,tt=this.getInputDisplayValue(null),Re=(dt||dt===0)&&(isNaN(dt)||Number(dt)>=de),We=(dt||dt===0)&&(isNaN(dt)||Number(dt)<=Ae),_e=Re||K||V,me=We||K||V,ve=g()("".concat(P,"-handler"),"".concat(P,"-handler-up"),Object(J.a)({},"".concat(P,"-handler-up-disabled"),_e)),te=g()("".concat(P,"-handler"),"".concat(P,"-handler-down"),Object(J.a)({},"".concat(P,"-handler-down-disabled"),me)),ie=U?{onTouchStart:_e?s:this.up,onTouchEnd:this.stop}:{onMouseDown:_e?s:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},le=U?{onTouchStart:me?s:this.down,onTouchEnd:this.stop}:{onMouseDown:me?s:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return D.a.createElement("div",{className:Ye,style:Ee,title:we,onMouseEnter:he,onMouseLeave:ce,onMouseOver:se,onMouseOut:re,onFocus:function(){return null},onBlur:function(){return null}},D.a.createElement("div",{className:"".concat(P,"-handler-wrap")},D.a.createElement("span",Object.assign({unselectable:"on"},ie,{role:"button","aria-label":"Increase Value","aria-disabled":_e,className:ve}),X||D.a.createElement("span",{unselectable:"on",className:"".concat(P,"-handler-up-inner"),onClick:a})),D.a.createElement("span",Object.assign({unselectable:"on"},le,{role:"button","aria-label":"Decrease Value","aria-disabled":me,className:te}),ee||D.a.createElement("span",{unselectable:"on",className:"".concat(P,"-handler-down-inner"),onClick:a}))),D.a.createElement("div",{className:"".concat(P,"-input-wrap")},D.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":Ae,"aria-valuemax":de,"aria-valuenow":dt,required:xe,type:Oe,placeholder:Be,onPaste:et,onClick:be,onMouseUp:this.onMouseUp,className:"".concat(P,"-input"),tabIndex:ke,autoComplete:S,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:ot?this.onKeyDown:s,onKeyUp:ot?this.onKeyUp:s,autoFocus:je,maxLength:Fe,readOnly:V,disabled:K,max:de,min:Ae,step:Ke,name:Me,title:we,id:Ce,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(tt),pattern:Ne,inputMode:De,onInput:Je},Ie))))}}]),_}(D.a.Component);A.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:w,min:-w,step:1,style:{},onChange:s,onKeyDown:s,onPressEnter:s,onFocus:s,onBlur:s,parser:l,required:!1,autoComplete:"off"};var T=A,E=at.a=T},gJ3r:function(yt,at,ne){"use strict";ne.d(at,"a",function(){return oe});var oe=[{value:"\u5317\u4EAC",label:"\u5317\u4EAC",children:[{value:"\u4E1C\u57CE",label:"\u4E1C\u57CE"},{value:"\u897F\u57CE",label:"\u897F\u57CE"},{value:"\u671D\u9633",label:"\u671D\u9633"},{value:"\u4E30\u53F0",label:"\u4E30\u53F0"},{value:"\u77F3\u666F\u5C71",label:"\u77F3\u666F\u5C71"},{value:"\u6D77\u6DC0",label:"\u6D77\u6DC0"},{value:"\u95E8\u5934\u6C9F",label:"\u95E8\u5934\u6C9F"},{value:"\u623F\u5C71",label:"\u623F\u5C71"},{value:"\u901A\u5DDE",label:"\u901A\u5DDE"},{value:"\u987A\u4E49",label:"\u987A\u4E49"},{value:"\u660C\u5E73",label:"\u660C\u5E73"},{value:"\u5927\u5174",label:"\u5927\u5174"},{value:"\u5E73\u8C37",label:"\u5E73\u8C37"},{value:"\u6000\u67D4",label:"\u6000\u67D4"},{value:"\u5BC6\u4E91",label:"\u5BC6\u4E91"},{value:"\u5EF6\u5E86",label:"\u5EF6\u5E86"}]},{value:"\u4E0A\u6D77",label:"\u4E0A\u6D77",children:[{value:"\u5D07\u660E",label:"\u5D07\u660E"},{value:"\u9EC4\u6D66",label:"\u9EC4\u6D66"},{value:"\u5362\u6E7E",label:"\u5362\u6E7E"},{value:"\u5F90\u6C47",label:"\u5F90\u6C47"},{value:"\u957F\u5B81",label:"\u957F\u5B81"},{value:"\u9759\u5B89",label:"\u9759\u5B89"},{value:"\u666E\u9640",label:"\u666E\u9640"},{value:"\u95F8\u5317",label:"\u95F8\u5317"},{value:"\u8679\u53E3",label:"\u8679\u53E3"},{value:"\u6768\u6D66",label:"\u6768\u6D66"},{value:"\u95F5\u884C",label:"\u95F5\u884C"},{value:"\u5B9D\u5C71",label:"\u5B9D\u5C71"},{value:"\u5609\u5B9A",label:"\u5609\u5B9A"},{value:"\u6D66\u4E1C",label:"\u6D66\u4E1C"},{value:"\u91D1\u5C71",label:"\u91D1\u5C71"},{value:"\u677E\u6C5F",label:"\u677E\u6C5F"},{value:"\u9752\u6D66",label:"\u9752\u6D66"},{value:"\u5357\u6C47",label:"\u5357\u6C47"},{value:"\u5949\u8D24",label:"\u5949\u8D24"}]},{value:"\u5E7F\u4E1C",label:"\u5E7F\u4E1C",children:[{value:"\u5E7F\u5DDE",label:"\u5E7F\u5DDE"},{value:"\u6DF1\u5733",label:"\u6DF1\u5733"},{value:"\u73E0\u6D77",label:"\u73E0\u6D77"},{value:"\u4E1C\u839E",label:"\u4E1C\u839E"},{value:"\u4E2D\u5C71",label:"\u4E2D\u5C71"},{value:"\u4F5B\u5C71",label:"\u4F5B\u5C71"},{value:"\u60E0\u5DDE",label:"\u60E0\u5DDE"},{value:"\u6CB3\u6E90",label:"\u6CB3\u6E90"},{value:"\u6F6E\u5DDE",label:"\u6F6E\u5DDE"},{value:"\u6C5F\u95E8",label:"\u6C5F\u95E8"},{value:"\u63ED\u9633",label:"\u63ED\u9633"},{value:"\u8302\u540D",label:"\u8302\u540D"},{value:"\u6885\u5DDE",label:"\u6885\u5DDE"},{value:"\u6E05\u8FDC",label:"\u6E05\u8FDC"},{value:"\u6C55\u5934",label:"\u6C55\u5934"},{value:"\u6C55\u5C3E",label:"\u6C55\u5C3E"},{value:"\u97F6\u5173",label:"\u97F6\u5173"},{value:"\u987A\u5FB7",label:"\u987A\u5FB7"},{value:"\u9633\u6C5F",label:"\u9633\u6C5F"},{value:"\u4E91\u6D6E",label:"\u4E91\u6D6E"},{value:"\u6E5B\u6C5F",label:"\u6E5B\u6C5F"},{value:"\u8087\u5E86",label:"\u8087\u5E86"}]},{value:"\u6C5F\u82CF",label:"\u6C5F\u82CF",children:[{value:"\u5357\u4EAC",label:"\u5357\u4EAC"},{value:"\u5E38\u719F",label:"\u5E38\u719F"},{value:"\u5E38\u5DDE",label:"\u5E38\u5DDE"},{value:"\u6D77\u95E8",label:"\u6D77\u95E8"},{value:"\u6DEE\u5B89",label:"\u6DEE\u5B89"},{value:"\u6C5F\u90FD",label:"\u6C5F\u90FD"},{value:"\u6C5F\u9634",label:"\u6C5F\u9634"},{value:"\u6606\u5C71",label:"\u6606\u5C71"},{value:"\u8FDE\u4E91\u6E2F",label:"\u8FDE\u4E91\u6E2F"},{value:"\u5357\u901A",label:"\u5357\u901A"},{value:"\u542F\u4E1C",label:"\u542F\u4E1C"},{value:"\u6CAD\u9633",label:"\u6CAD\u9633"},{value:"\u5BBF\u8FC1",label:"\u5BBF\u8FC1"},{value:"\u82CF\u5DDE",label:"\u82CF\u5DDE"},{value:"\u592A\u4ED3",label:"\u592A\u4ED3"},{value:"\u6CF0\u5DDE",label:"\u6CF0\u5DDE"},{value:"\u540C\u91CC",label:"\u540C\u91CC"},{value:"\u65E0\u9521",label:"\u65E0\u9521"},{value:"\u5F90\u5DDE",label:"\u5F90\u5DDE"},{value:"\u76D0\u57CE",label:"\u76D0\u57CE"},{value:"\u626C\u5DDE",label:"\u626C\u5DDE"},{value:"\u5B9C\u5174",label:"\u5B9C\u5174"},{value:"\u4EEA\u5F81",label:"\u4EEA\u5F81"},{value:"\u5F20\u5BB6\u6E2F",label:"\u5F20\u5BB6\u6E2F"},{value:"\u9547\u6C5F",label:"\u9547\u6C5F"}]},{value:"\u91CD\u5E86",label:"\u91CD\u5E86",children:[{value:"\u4E07\u5DDE",label:"\u4E07\u5DDE"},{value:"\u6DAA\u9675",label:"\u6DAA\u9675"},{value:"\u6E1D\u4E2D",label:"\u6E1D\u4E2D"},{value:"\u5927\u6E21\u53E3",label:"\u5927\u6E21\u53E3"},{value:"\u6C5F\u5317",label:"\u6C5F\u5317"},{value:"\u6C99\u576A\u575D",label:"\u6C99\u576A\u575D"},{value:"\u4E5D\u9F99\u5761",label:"\u4E5D\u9F99\u5761"},{value:"\u5357\u5CB8",label:"\u5357\u5CB8"},{value:"\u5317\u789A",label:"\u5317\u789A"},{value:"\u4E07\u76DB",label:"\u4E07\u76DB"},{value:"\u53CC\u6322",label:"\u53CC\u6322"},{value:"\u6E1D\u5317",label:"\u6E1D\u5317"},{value:"\u5DF4\u5357",label:"\u5DF4\u5357"},{value:"\u9ED4\u6C5F",label:"\u9ED4\u6C5F"},{value:"\u957F\u5BFF",label:"\u957F\u5BFF"},{value:"\u7DA6\u6C5F",label:"\u7DA6\u6C5F"},{value:"\u6F7C\u5357",label:"\u6F7C\u5357"},{value:"\u94DC\u6881",label:"\u94DC\u6881"},{value:"\u5927\u8DB3",label:"\u5927\u8DB3"},{value:"\u8363\u660C",label:"\u8363\u660C"},{value:"\u58C1\u5C71",label:"\u58C1\u5C71"},{value:"\u6881\u5E73",label:"\u6881\u5E73"},{value:"\u57CE\u53E3",label:"\u57CE\u53E3"},{value:"\u4E30\u90FD",label:"\u4E30\u90FD"},{value:"\u57AB\u6C5F",label:"\u57AB\u6C5F"},{value:"\u6B66\u9686",label:"\u6B66\u9686"},{value:"\u5FE0\u53BF",label:"\u5FE0\u53BF"},{value:"\u5F00\u53BF",label:"\u5F00\u53BF"},{value:"\u4E91\u9633",label:"\u4E91\u9633"},{value:"\u5949\u8282",label:"\u5949\u8282"},{value:"\u5DEB\u5C71",label:"\u5DEB\u5C71"},{value:"\u5DEB\u6EAA",label:"\u5DEB\u6EAA"},{value:"\u77F3\u67F1",label:"\u77F3\u67F1"},{value:"\u79C0\u5C71",label:"\u79C0\u5C71"},{value:"\u9149\u9633",label:"\u9149\u9633"},{value:"\u5F6D\u6C34",label:"\u5F6D\u6C34"},{value:"\u6C5F\u6D25",label:"\u6C5F\u6D25"},{value:"\u5408\u5DDD",label:"\u5408\u5DDD"},{value:"\u6C38\u5DDD",label:"\u6C38\u5DDD"},{value:"\u5357\u5DDD",label:"\u5357\u5DDD"}]},{value:"\u5B89\u5FBD",label:"\u5B89\u5FBD",children:[{value:"\u5408\u80A5",label:"\u5408\u80A5"},{value:"\u5B89\u5E86",label:"\u5B89\u5E86"},{value:"\u868C\u57E0",label:"\u868C\u57E0"},{value:"\u4EB3\u5DDE",label:"\u4EB3\u5DDE"},{value:"\u5DE2\u6E56",label:"\u5DE2\u6E56"},{value:"\u6EC1\u5DDE",label:"\u6EC1\u5DDE"},{value:"\u961C\u9633",label:"\u961C\u9633"},{value:"\u8D35\u6C60",label:"\u8D35\u6C60"},{value:"\u6DEE\u5317",label:"\u6DEE\u5317"},{value:"\u6DEE\u5316",label:"\u6DEE\u5316"},{value:"\u6DEE\u5357",label:"\u6DEE\u5357"},{value:"\u9EC4\u5C71",label:"\u9EC4\u5C71"},{value:"\u4E5D\u534E\u5C71",label:"\u4E5D\u534E\u5C71"},{value:"\u516D\u5B89",label:"\u516D\u5B89"},{value:"\u9A6C\u978D\u5C71",label:"\u9A6C\u978D\u5C71"},{value:"\u5BBF\u5DDE",label:"\u5BBF\u5DDE"},{value:"\u94DC\u9675",label:"\u94DC\u9675"},{value:"\u5C6F\u6EAA",label:"\u5C6F\u6EAA"},{value:"\u829C\u6E56",label:"\u829C\u6E56"},{value:"\u5BA3\u57CE",label:"\u5BA3\u57CE"}]},{value:"\u798F\u5EFA",label:"\u798F\u5EFA",children:[{value:"\u798F\u5DDE",label:"\u798F\u5DDE"},{value:"\u53A6\u95E8",label:"\u53A6\u95E8"},{value:"\u6CC9\u5DDE",label:"\u6CC9\u5DDE"},{value:"\u6F33\u5DDE",label:"\u6F33\u5DDE"},{value:"\u9F99\u5CA9",label:"\u9F99\u5CA9"},{value:"\u5357\u5E73",label:"\u5357\u5E73"},{value:"\u5B81\u5FB7",label:"\u5B81\u5FB7"},{value:"\u8386\u7530",label:"\u8386\u7530"},{value:"\u4E09\u660E",label:"\u4E09\u660E"}]},{value:"\u7518\u8083",label:"\u7518\u8083",children:[{value:"\u5170\u5DDE",label:"\u5170\u5DDE"},{value:"\u5609\u5CEA\u5173",label:"\u5609\u5CEA\u5173"},{value:"\u767D\u94F6",label:"\u767D\u94F6"},{value:"\u5B9A\u897F",label:"\u5B9A\u897F"},{value:"\u6566\u714C",label:"\u6566\u714C"},{value:"\u7518\u5357",label:"\u7518\u5357"},{value:"\u91D1\u660C",label:"\u91D1\u660C"},{value:"\u9152\u6CC9",label:"\u9152\u6CC9"},{value:"\u4E34\u590F",label:"\u4E34\u590F"},{value:"\u5E73\u51C9",label:"\u5E73\u51C9"},{value:"\u5929\u6C34",label:"\u5929\u6C34"},{value:"\u9647\u5357",label:"\u9647\u5357"},{value:"\u6B66\u5A01",label:"\u6B66\u5A01"},{value:"\u897F\u5CF0",label:"\u897F\u5CF0"},{value:"\u5F20\u6396",label:"\u5F20\u6396"}]},{value:"\u5E7F\u897F",label:"\u5E7F\u897F",children:[{value:"\u5357\u5B81",label:"\u5357\u5B81"},{value:"\u6765\u5BBE",label:"\u6765\u5BBE"},{value:"\u767E\u8272",label:"\u767E\u8272"},{value:"\u5317\u6D77",label:"\u5317\u6D77"},{value:"\u6842\u6797",label:"\u6842\u6797"},{value:"\u9632\u57CE\u6E2F",label:"\u9632\u57CE\u6E2F"},{value:"\u8D35\u6E2F",label:"\u8D35\u6E2F"},{value:"\u6CB3\u6C60",label:"\u6CB3\u6C60"},{value:"\u8D3A\u5DDE",label:"\u8D3A\u5DDE"},{value:"\u67F3\u5DDE",label:"\u67F3\u5DDE"},{value:"\u94A6\u5DDE",label:"\u94A6\u5DDE"},{value:"\u68A7\u5DDE",label:"\u68A7\u5DDE"},{value:"\u7389\u6797",label:"\u7389\u6797"}]},{value:"\u8D35\u5DDE",label:"\u8D35\u5DDE",children:[{value:"\u8D35\u9633",label:"\u8D35\u9633"},{value:"\u5B89\u987A",label:"\u5B89\u987A"},{value:"\u6BD5\u8282",label:"\u6BD5\u8282"},{value:"\u90FD\u5300",label:"\u90FD\u5300"},{value:"\u51EF\u91CC",label:"\u51EF\u91CC"},{value:"\u516D\u76D8\u6C34",label:"\u516D\u76D8\u6C34"},{value:"\u94DC\u4EC1",label:"\u94DC\u4EC1"},{value:"\u5174\u4E49",label:"\u5174\u4E49"},{value:"\u7389\u5C4F",label:"\u7389\u5C4F"},{value:"\u9075\u4E49",label:"\u9075\u4E49"}]},{value:"\u6D77\u5357",label:"\u6D77\u5357",children:[{value:"\u6D77\u53E3",label:"\u6D77\u53E3"},{value:"\u510B\u53BF",label:"\u510B\u53BF"},{value:"\u9675\u6C34",label:"\u9675\u6C34"},{value:"\u743C\u6D77",label:"\u743C\u6D77"},{value:"\u4E09\u4E9A",label:"\u4E09\u4E9A"},{value:"\u901A\u4EC0",label:"\u901A\u4EC0"},{value:"\u4E07\u5B81",label:"\u4E07\u5B81"}]},{value:"\u6CB3\u5317",label:"\u6CB3\u5317",children:[{value:"\u77F3\u5BB6\u5E84",label:"\u77F3\u5BB6\u5E84"},{value:"\u4FDD\u5B9A",label:"\u4FDD\u5B9A"},{value:"\u5317\u6234\u6CB3",label:"\u5317\u6234\u6CB3"},{value:"\u6CA7\u5DDE",label:"\u6CA7\u5DDE"},{value:"\u627F\u5FB7",label:"\u627F\u5FB7"},{value:"\u4E30\u6DA6",label:"\u4E30\u6DA6"},{value:"\u90AF\u90F8",label:"\u90AF\u90F8"},{value:"\u8861\u6C34",label:"\u8861\u6C34"},{value:"\u5ECA\u574A",label:"\u5ECA\u574A"},{value:"\u5357\u6234\u6CB3",label:"\u5357\u6234\u6CB3"},{value:"\u79E6\u7687\u5C9B",label:"\u79E6\u7687\u5C9B"},{value:"\u5510\u5C71",label:"\u5510\u5C71"},{value:"\u65B0\u57CE",label:"\u65B0\u57CE"},{value:"\u90A2\u53F0",label:"\u90A2\u53F0"},{value:"\u5F20\u5BB6\u53E3",label:"\u5F20\u5BB6\u53E3"}]},{value:"\u9ED1\u9F99\u6C5F",label:"\u9ED1\u9F99\u6C5F",children:[{value:"\u54C8\u5C14\u6EE8",label:"\u54C8\u5C14\u6EE8"},{value:"\u5317\u5B89",label:"\u5317\u5B89"},{value:"\u5927\u5E86",label:"\u5927\u5E86"},{value:"\u5927\u5174\u5B89\u5CAD",label:"\u5927\u5174\u5B89\u5CAD"},{value:"\u9E64\u5C97",label:"\u9E64\u5C97"},{value:"\u9ED1\u6CB3",label:"\u9ED1\u6CB3"},{value:"\u4F73\u6728\u65AF",label:"\u4F73\u6728\u65AF"},{value:"\u9E21\u897F",label:"\u9E21\u897F"},{value:"\u7261\u4E39\u6C5F",label:"\u7261\u4E39\u6C5F"},{value:"\u9F50\u9F50\u54C8\u5C14",label:"\u9F50\u9F50\u54C8\u5C14"},{value:"\u4E03\u53F0\u6CB3",label:"\u4E03\u53F0\u6CB3"},{value:"\u53CC\u9E2D\u5C71",label:"\u53CC\u9E2D\u5C71"},{value:"\u7EE5\u5316",label:"\u7EE5\u5316"},{value:"\u4F0A\u6625",label:"\u4F0A\u6625"}]},{value:"\u6CB3\u5357",label:"\u6CB3\u5357",children:[{value:"\u90D1\u5DDE",label:"\u90D1\u5DDE"},{value:"\u5B89\u9633",label:"\u5B89\u9633"},{value:"\u9E64\u58C1",label:"\u9E64\u58C1"},{value:"\u6F62\u5DDD",label:"\u6F62\u5DDD"},{value:"\u7126\u4F5C",label:"\u7126\u4F5C"},{value:"\u6D4E\u6E90",label:"\u6D4E\u6E90"},{value:"\u5F00\u5C01",label:"\u5F00\u5C01"},{value:"\u6F2F\u6CB3",label:"\u6F2F\u6CB3"},{value:"\u6D1B\u9633",label:"\u6D1B\u9633"},{value:"\u5357\u9633",label:"\u5357\u9633"},{value:"\u5E73\u9876\u5C71",label:"\u5E73\u9876\u5C71"},{value:"\u6FEE\u9633",label:"\u6FEE\u9633"},{value:"\u4E09\u95E8\u5CE1",label:"\u4E09\u95E8\u5CE1"},{value:"\u5546\u4E18",label:"\u5546\u4E18"},{value:"\u65B0\u4E61",label:"\u65B0\u4E61"},{value:"\u4FE1\u9633",label:"\u4FE1\u9633"},{value:"\u8BB8\u660C",label:"\u8BB8\u660C"},{value:"\u5468\u53E3",label:"\u5468\u53E3"},{value:"\u9A7B\u9A6C\u5E97",label:"\u9A7B\u9A6C\u5E97"}]},{value:"\u9999\u6E2F",label:"\u9999\u6E2F",children:[{value:"\u9999\u6E2F",label:"\u9999\u6E2F"},{value:"\u4E5D\u9F99",label:"\u4E5D\u9F99"},{value:"\u65B0\u754C",label:"\u65B0\u754C"}]},{value:"\u6E56\u5317",label:"\u6E56\u5317",children:[{value:"\u6B66\u6C49",label:"\u6B66\u6C49"},{value:"\u5929\u95E8",label:"\u5929\u95E8"},{value:"\u6069\u65BD",label:"\u6069\u65BD"},{value:"\u9102\u5DDE",label:"\u9102\u5DDE"},{value:"\u9EC4\u5188",label:"\u9EC4\u5188"},{value:"\u9EC4\u77F3",label:"\u9EC4\u77F3"},{value:"\u8346\u95E8",label:"\u8346\u95E8"},{value:"\u8346\u5DDE",label:"\u8346\u5DDE"},{value:"\u6F5C\u6C5F",label:"\u6F5C\u6C5F"},{value:"\u5341\u5830",label:"\u5341\u5830"},{value:"\u968F\u5DDE",label:"\u968F\u5DDE"},{value:"\u6B66\u7A74",label:"\u6B66\u7A74"},{value:"\u4ED9\u6843",label:"\u4ED9\u6843"},{value:"\u54B8\u5B81",label:"\u54B8\u5B81"},{value:"\u8944\u9633",label:"\u8944\u9633"},{value:"\u8944\u6A0A",label:"\u8944\u6A0A"},{value:"\u5B5D\u611F",label:"\u5B5D\u611F"},{value:"\u5B9C\u660C",label:"\u5B9C\u660C"}]},{value:"\u6E56\u5357",label:"\u6E56\u5357",children:[{value:"\u957F\u6C99",label:"\u957F\u6C99"},{value:"\u5E38\u5FB7",label:"\u5E38\u5FB7"},{value:"\u90F4\u5DDE",label:"\u90F4\u5DDE"},{value:"\u8861\u9633",label:"\u8861\u9633"},{value:"\u6000\u5316",label:"\u6000\u5316"},{value:"\u5409\u9996",label:"\u5409\u9996"},{value:"\u5A04\u5E95",label:"\u5A04\u5E95"},{value:"\u90B5\u9633",label:"\u90B5\u9633"},{value:"\u6E58\u6F6D",label:"\u6E58\u6F6D"},{value:"\u76CA\u9633",label:"\u76CA\u9633"},{value:"\u5CB3\u9633",label:"\u5CB3\u9633"},{value:"\u6C38\u5DDE",label:"\u6C38\u5DDE"},{value:"\u5F20\u5BB6\u754C",label:"\u5F20\u5BB6\u754C"},{value:"\u682A\u6D32",label:"\u682A\u6D32"}]},{value:"\u6C5F\u897F",label:"\u6C5F\u897F",children:[{value:"\u5357\u660C",label:"\u5357\u660C"},{value:"\u629A\u5DDE",label:"\u629A\u5DDE"},{value:"\u8D63\u5DDE",label:"\u8D63\u5DDE"},{value:"\u5409\u5B89",label:"\u5409\u5B89"},{value:"\u666F\u5FB7\u9547",label:"\u666F\u5FB7\u9547"},{value:"\u4E95\u5188\u5C71",label:"\u4E95\u5188\u5C71"},{value:"\u4E5D\u6C5F",label:"\u4E5D\u6C5F"},{value:"\u5E90\u5C71",label:"\u5E90\u5C71"},{value:"\u840D\u4E61",label:"\u840D\u4E61"},{value:"\u4E0A\u9976",label:"\u4E0A\u9976"},{value:"\u65B0\u4F59",label:"\u65B0\u4F59"},{value:"\u5B9C\u6625",label:"\u5B9C\u6625"},{value:"\u9E70\u6F6D",label:"\u9E70\u6F6D"}]},{value:"\u5409\u6797",label:"\u5409\u6797",children:[{value:"\u957F\u6625",label:"\u957F\u6625"},{value:"\u5409\u6797",label:"\u5409\u6797"},{value:"\u767D\u57CE",label:"\u767D\u57CE"},{value:"\u767D\u5C71",label:"\u767D\u5C71"},{value:"\u73F2\u6625",label:"\u73F2\u6625"},{value:"\u8FBD\u6E90",label:"\u8FBD\u6E90"},{value:"\u6885\u6CB3",label:"\u6885\u6CB3"},{value:"\u56DB\u5E73",label:"\u56DB\u5E73"},{value:"\u677E\u539F",label:"\u677E\u539F"},{value:"\u901A\u5316",label:"\u901A\u5316"},{value:"\u5EF6\u5409",label:"\u5EF6\u5409"}]},{value:"\u8FBD\u5B81",label:"\u8FBD\u5B81",children:[{value:"\u6C88\u9633",label:"\u6C88\u9633"},{value:"\u978D\u5C71",label:"\u978D\u5C71"},{value:"\u672C\u6EAA",label:"\u672C\u6EAA"},{value:"\u671D\u9633",label:"\u671D\u9633"},{value:"\u5927\u8FDE",label:"\u5927\u8FDE"},{value:"\u4E39\u4E1C",label:"\u4E39\u4E1C"},{value:"\u629A\u987A",label:"\u629A\u987A"},{value:"\u961C\u65B0",label:"\u961C\u65B0"},{value:"\u846B\u82A6\u5C9B",label:"\u846B\u82A6\u5C9B"},{value:"\u9526\u5DDE",label:"\u9526\u5DDE"},{value:"\u8FBD\u9633",label:"\u8FBD\u9633"},{value:"\u76D8\u9526",label:"\u76D8\u9526"},{value:"\u94C1\u5CAD",label:"\u94C1\u5CAD"},{value:"\u8425\u53E3",label:"\u8425\u53E3"}]},{value:"\u6FB3\u95E8",label:"\u6FB3\u95E8",children:[{value:"\u6FB3\u95E8",label:"\u6FB3\u95E8"}]},{value:"\u5185\u8499\u53E4",label:"\u5185\u8499\u53E4",children:[{value:"\u547C\u548C\u6D69\u7279",label:"\u547C\u548C\u6D69\u7279"},{value:"\u963F\u62C9\u5584\u76DF",label:"\u963F\u62C9\u5584\u76DF"},{value:"\u5305\u5934",label:"\u5305\u5934"},{value:"\u8D64\u5CF0",label:"\u8D64\u5CF0"},{value:"\u4E1C\u80DC",label:"\u4E1C\u80DC"},{value:"\u6D77\u62C9\u5C14",label:"\u6D77\u62C9\u5C14"},{value:"\u96C6\u5B81",label:"\u96C6\u5B81"},{value:"\u4E34\u6CB3",label:"\u4E34\u6CB3"},{value:"\u901A\u8FBD",label:"\u901A\u8FBD"},{value:"\u4E4C\u6D77",label:"\u4E4C\u6D77"},{value:"\u4E4C\u5170\u6D69\u7279",label:"\u4E4C\u5170\u6D69\u7279"},{value:"\u9521\u6797\u6D69\u7279",label:"\u9521\u6797\u6D69\u7279"}]},{value:"\u5B81\u590F",label:"\u5B81\u590F",children:[{value:"\u94F6\u5DDD",label:"\u94F6\u5DDD"},{value:"\u56FA\u6E90",label:"\u56FA\u6E90"},{value:"\u77F3\u5634\u5C71",label:"\u77F3\u5634\u5C71"},{value:"\u5434\u5FE0",label:"\u5434\u5FE0"}]},{value:"\u9752\u6D77",label:"\u9752\u6D77",children:[{value:"\u897F\u5B81",label:"\u897F\u5B81"},{value:"\u5FB7\u4EE4\u54C8",label:"\u5FB7\u4EE4\u54C8"},{value:"\u683C\u5C14\u6728",label:"\u683C\u5C14\u6728"},{value:"\u5171\u548C",label:"\u5171\u548C"},{value:"\u6D77\u4E1C",label:"\u6D77\u4E1C"},{value:"\u6D77\u664F",label:"\u6D77\u664F"},{value:"\u739B\u6C81",label:"\u739B\u6C81"},{value:"\u540C\u4EC1",label:"\u540C\u4EC1"},{value:"\u7389\u6811",label:"\u7389\u6811"}]},{value:"\u5C71\u4E1C",label:"\u5C71\u4E1C",children:[{value:"\u6D4E\u5357",label:"\u6D4E\u5357"},{value:"\u6EE8\u5DDE",label:"\u6EE8\u5DDE"},{value:"\u5156\u5DDE",label:"\u5156\u5DDE"},{value:"\u5FB7\u5DDE",label:"\u5FB7\u5DDE"},{value:"\u4E1C\u8425",label:"\u4E1C\u8425"},{value:"\u83CF\u6CFD",label:"\u83CF\u6CFD"},{value:"\u6D4E\u5B81",label:"\u6D4E\u5B81"},{value:"\u83B1\u829C",label:"\u83B1\u829C"},{value:"\u804A\u57CE",label:"\u804A\u57CE"},{value:"\u4E34\u6C82",label:"\u4E34\u6C82"},{value:"\u84EC\u83B1",label:"\u84EC\u83B1"},{value:"\u9752\u5C9B",label:"\u9752\u5C9B"},{value:"\u66F2\u961C",label:"\u66F2\u961C"},{value:"\u65E5\u7167",label:"\u65E5\u7167"},{value:"\u6CF0\u5B89",label:"\u6CF0\u5B89"},{value:"\u6F4D\u574A",label:"\u6F4D\u574A"},{value:"\u5A01\u6D77",label:"\u5A01\u6D77"},{value:"\u70DF\u53F0",label:"\u70DF\u53F0"},{value:"\u67A3\u5E84",label:"\u67A3\u5E84"},{value:"\u6DC4\u535A",label:"\u6DC4\u535A"}]},{value:"\u5C71\u897F",label:"\u5C71\u897F",children:[{value:"\u592A\u539F",label:"\u592A\u539F"},{value:"\u5415\u6881",label:"\u5415\u6881"},{value:"\u957F\u6CBB",label:"\u957F\u6CBB"},{value:"\u5927\u540C",label:"\u5927\u540C"},{value:"\u5019\u9A6C",label:"\u5019\u9A6C"},{value:"\u664B\u57CE",label:"\u664B\u57CE"},{value:"\u79BB\u77F3",label:"\u79BB\u77F3"},{value:"\u4E34\u6C7E",label:"\u4E34\u6C7E"},{value:"\u5B81\u6B66",label:"\u5B81\u6B66"},{value:"\u6714\u5DDE",label:"\u6714\u5DDE"},{value:"\u5FFB\u5DDE",label:"\u5FFB\u5DDE"},{value:"\u9633\u6CC9",label:"\u9633\u6CC9"},{value:"\u6986\u6B21",label:"\u6986\u6B21"},{value:"\u664B\u4E2D",label:"\u664B\u4E2D"},{value:"\u8FD0\u57CE",label:"\u8FD0\u57CE"}]},{value:"\u9655\u897F",label:"\u9655\u897F",children:[{value:"\u897F\u5B89",label:"\u897F\u5B89"},{value:"\u5B89\u5EB7",label:"\u5B89\u5EB7"},{value:"\u5B9D\u9E21",label:"\u5B9D\u9E21"},{value:"\u6C49\u4E2D",label:"\u6C49\u4E2D"},{value:"\u6E2D\u5357",label:"\u6E2D\u5357"},{value:"\u5546\u5DDE",label:"\u5546\u5DDE"},{value:"\u7EE5\u5FB7",label:"\u7EE5\u5FB7"},{value:"\u94DC\u5DDD",label:"\u94DC\u5DDD"},{value:"\u54B8\u9633",label:"\u54B8\u9633"},{value:"\u5EF6\u5B89",label:"\u5EF6\u5B89"},{value:"\u6986\u6797",label:"\u6986\u6797"}]},{value:"\u56DB\u5DDD",label:"\u56DB\u5DDD",children:[{value:"\u6210\u90FD",label:"\u6210\u90FD"},{value:"\u5DF4\u4E2D",label:"\u5DF4\u4E2D"},{value:"\u8FBE\u5DDD",label:"\u8FBE\u5DDD"},{value:"\u5FB7\u9633",label:"\u5FB7\u9633"},{value:"\u90FD\u6C5F\u5830",label:"\u90FD\u6C5F\u5830"},{value:"\u5CE8\u7709\u5C71",label:"\u5CE8\u7709\u5C71"},{value:"\u6DAA\u9675",label:"\u6DAA\u9675"},{value:"\u5E7F\u5B89",label:"\u5E7F\u5B89"},{value:"\u5E7F\u5143",label:"\u5E7F\u5143"},{value:"\u4E5D\u5BE8\u6C9F",label:"\u4E5D\u5BE8\u6C9F"},{value:"\u5EB7\u5B9A",label:"\u5EB7\u5B9A"},{value:"\u4E50\u5C71",label:"\u4E50\u5C71"},{value:"\u6CF8\u5DDE",label:"\u6CF8\u5DDE"},{value:"\u9A6C\u5C14\u5EB7",label:"\u9A6C\u5C14\u5EB7"},{value:"\u7EF5\u9633",label:"\u7EF5\u9633"},{value:"\u7709\u5C71",label:"\u7709\u5C71"},{value:"\u5357\u5145",label:"\u5357\u5145"},{value:"\u5185\u6C5F",label:"\u5185\u6C5F"},{value:"\u6500\u679D\u82B1",label:"\u6500\u679D\u82B1"},{value:"\u9042\u5B81",label:"\u9042\u5B81"},{value:"\u6C76\u5DDD",label:"\u6C76\u5DDD"},{value:"\u897F\u660C",label:"\u897F\u660C"},{value:"\u96C5\u5B89",label:"\u96C5\u5B89"},{value:"\u5B9C\u5BBE",label:"\u5B9C\u5BBE"},{value:"\u81EA\u8D21",label:"\u81EA\u8D21"},{value:"\u8D44\u9633",label:"\u8D44\u9633"}]},{value:"\u53F0\u6E7E",label:"\u53F0\u6E7E",children:[{value:"\u53F0\u5317",label:"\u53F0\u5317"},{value:"\u57FA\u9686",label:"\u57FA\u9686"},{value:"\u53F0\u5357",label:"\u53F0\u5357"},{value:"\u53F0\u4E2D",label:"\u53F0\u4E2D"},{value:"\u9AD8\u96C4",label:"\u9AD8\u96C4"},{value:"\u5C4F\u4E1C",label:"\u5C4F\u4E1C"},{value:"\u5357\u6295",label:"\u5357\u6295"},{value:"\u4E91\u6797",label:"\u4E91\u6797"},{value:"\u65B0\u7AF9",label:"\u65B0\u7AF9"},{value:"\u5F70\u5316",label:"\u5F70\u5316"},{value:"\u82D7\u6817",label:"\u82D7\u6817"},{value:"\u5609\u4E49",label:"\u5609\u4E49"},{value:"\u6843\u56ED",label:"\u6843\u56ED"},{value:"\u5B9C\u5170",label:"\u5B9C\u5170"},{value:"\u53F0\u4E1C",label:"\u53F0\u4E1C"},{value:"\u91D1\u95E8",label:"\u91D1\u95E8"},{value:"\u9A6C\u7956",label:"\u9A6C\u7956"},{value:"\u6F8E\u6E56",label:"\u6F8E\u6E56"}]},{value:"\u5929\u6D25",label:"\u5929\u6D25",children:[{value:"\u5929\u6D25",label:"\u5929\u6D25"},{value:"\u548C\u5E73",label:"\u548C\u5E73"},{value:"\u4E1C\u4E3D",label:"\u4E1C\u4E3D"},{value:"\u6CB3\u4E1C",label:"\u6CB3\u4E1C"},{value:"\u897F\u9752",label:"\u897F\u9752"},{value:"\u6CB3\u897F",label:"\u6CB3\u897F"},{value:"\u6D25\u5357",label:"\u6D25\u5357"},{value:"\u5357\u5F00",label:"\u5357\u5F00"},{value:"\u5317\u8FB0",label:"\u5317\u8FB0"},{value:"\u6CB3\u5317",label:"\u6CB3\u5317"},{value:"\u6B66\u6E05",label:"\u6B66\u6E05"},{value:"\u7EA2\u6322",label:"\u7EA2\u6322"},{value:"\u5858\u6CBD",label:"\u5858\u6CBD"},{value:"\u6C49\u6CBD",label:"\u6C49\u6CBD"},{value:"\u5927\u6E2F",label:"\u5927\u6E2F"},{value:"\u5B81\u6CB3",label:"\u5B81\u6CB3"},{value:"\u9759\u6D77",label:"\u9759\u6D77"},{value:"\u5B9D\u577B",label:"\u5B9D\u577B"},{value:"\u84DF\u53BF",label:"\u84DF\u53BF"}]},{value:"\u65B0\u7586",label:"\u65B0\u7586",children:[{value:"\u4E4C\u9C81\u6728\u9F50",label:"\u4E4C\u9C81\u6728\u9F50"},{value:"\u963F\u514B\u82CF",label:"\u963F\u514B\u82CF"},{value:"\u963F\u52D2\u6CF0",label:"\u963F\u52D2\u6CF0"},{value:"\u963F\u56FE\u4EC0",label:"\u963F\u56FE\u4EC0"},{value:"\u535A\u4E50",label:"\u535A\u4E50"},{value:"\u660C\u5409",label:"\u660C\u5409"},{value:"\u4E1C\u5C71",label:"\u4E1C\u5C71"},{value:"\u54C8\u5BC6",label:"\u54C8\u5BC6"},{value:"\u548C\u7530",label:"\u548C\u7530"},{value:"\u5580\u4EC0",label:"\u5580\u4EC0"},{value:"\u514B\u62C9\u739B\u4F9D",label:"\u514B\u62C9\u739B\u4F9D"},{value:"\u5E93\u8F66",label:"\u5E93\u8F66"},{value:"\u5E93\u5C14\u52D2",label:"\u5E93\u5C14\u52D2"},{value:"\u594E\u5C6F",label:"\u594E\u5C6F"},{value:"\u77F3\u6CB3\u5B50",label:"\u77F3\u6CB3\u5B50"},{value:"\u5854\u57CE",label:"\u5854\u57CE"},{value:"\u5410\u9C81\u756A",label:"\u5410\u9C81\u756A"},{value:"\u4F0A\u5B81",label:"\u4F0A\u5B81"}]},{value:"\u897F\u85CF",label:"\u897F\u85CF",children:[{value:"\u62C9\u8428",label:"\u62C9\u8428"},{value:"\u963F\u91CC",label:"\u963F\u91CC"},{value:"\u660C\u90FD",label:"\u660C\u90FD"},{value:"\u6797\u829D",label:"\u6797\u829D"},{value:"\u90A3\u66F2",label:"\u90A3\u66F2"},{value:"\u65E5\u5580\u5219",label:"\u65E5\u5580\u5219"},{value:"\u5C71\u5357",label:"\u5C71\u5357"}]},{value:"\u4E91\u5357",label:"\u4E91\u5357",children:[{value:"\u6606\u660E",label:"\u6606\u660E"},{value:"\u5927\u7406",label:"\u5927\u7406"},{value:"\u4FDD\u5C71",label:"\u4FDD\u5C71"},{value:"\u695A\u96C4",label:"\u695A\u96C4"},{value:"\u5927\u7406",label:"\u5927\u7406"},{value:"\u4E1C\u5DDD",label:"\u4E1C\u5DDD"},{value:"\u4E2A\u65E7",label:"\u4E2A\u65E7"},{value:"\u666F\u6D2A",label:"\u666F\u6D2A"},{value:"\u5F00\u8FDC",label:"\u5F00\u8FDC"},{value:"\u4E34\u6CA7",label:"\u4E34\u6CA7"},{value:"\u4E3D\u6C5F",label:"\u4E3D\u6C5F"},{value:"\u516D\u5E93",label:"\u516D\u5E93"},{value:"\u6F5E\u897F",label:"\u6F5E\u897F"},{value:"\u66F2\u9756",label:"\u66F2\u9756"},{value:"\u601D\u8305",label:"\u601D\u8305"},{value:"\u6587\u5C71",label:"\u6587\u5C71"},{value:"\u897F\u53CC\u7248\u7EB3",label:"\u897F\u53CC\u7248\u7EB3"},{value:"\u7389\u6EAA",label:"\u7389\u6EAA"},{value:"\u4E2D\u7538",label:"\u4E2D\u7538"},{value:"\u662D\u901A",label:"\u662D\u901A"}]},{value:"\u6D59\u6C5F",label:"\u6D59\u6C5F",children:[{value:"\u676D\u5DDE",label:"\u676D\u5DDE"},{value:"\u6E29\u5DDE",label:"\u6E29\u5DDE"},{value:"\u5B89\u5409",label:"\u5B89\u5409"},{value:"\u6148\u6EAA",label:"\u6148\u6EAA"},{value:"\u5B9A\u6D77",label:"\u5B9A\u6D77"},{value:"\u5949\u5316",label:"\u5949\u5316"},{value:"\u6D77\u76D0",label:"\u6D77\u76D0"},{value:"\u9EC4\u5CA9",label:"\u9EC4\u5CA9"},{value:"\u6E56\u5DDE",label:"\u6E56\u5DDE"},{value:"\u5609\u5174",label:"\u5609\u5174"},{value:"\u91D1\u534E",label:"\u91D1\u534E"},{value:"\u4E34\u5B89",label:"\u4E34\u5B89"},{value:"\u4E34\u6D77",label:"\u4E34\u6D77"},{value:"\u4E3D\u6C34",label:"\u4E3D\u6C34"},{value:"\u5B81\u6CE2",label:"\u5B81\u6CE2"},{value:"\u74EF\u6D77",label:"\u74EF\u6D77"},{value:"\u5E73\u6E56",label:"\u5E73\u6E56"},{value:"\u5343\u5C9B\u6E56",label:"\u5343\u5C9B\u6E56"},{value:"\u8862\u5DDE",label:"\u8862\u5DDE"},{value:"\u6C5F\u5C71",label:"\u6C5F\u5C71"},{value:"\u745E\u5B89",label:"\u745E\u5B89"},{value:"\u7ECD\u5174",label:"\u7ECD\u5174"},{value:"\u5D4A\u5DDE",label:"\u5D4A\u5DDE"},{value:"\u53F0\u5DDE",label:"\u53F0\u5DDE"},{value:"\u6E29\u5CAD",label:"\u6E29\u5CAD"},{value:"\u4F59\u59DA",label:"\u4F59\u59DA"},{value:"\u821F\u5C71",label:"\u821F\u5C71"}]},{value:"\u6D77\u5916",label:"\u6D77\u5916",children:[{value:"\u7F8E\u56FD",label:"\u7F8E\u56FD"},{value:"\u65E5\u672C",label:"\u65E5\u672C"},{value:"\u82F1\u56FD",label:"\u82F1\u56FD"},{value:"\u6CD5\u56FD",label:"\u6CD5\u56FD"},{value:"\u5FB7\u56FD",label:"\u5FB7\u56FD"},{value:"\u5176\u4ED6",label:"\u5176\u4ED6"}]}]},kSUc:function(yt,at,ne){},lZu9:function(yt,at,ne){(function(oe){oe(ne("VrN/"),ne("1eCo"),ne("8EBN"))})(function(oe){"use strict";oe.defineMode("markdown",function(J,k){var $=oe.getMode(J,"text/html"),F=$.name=="null";function B(U){if(oe.findModeByName){var S=oe.findModeByName(U);S&&(U=S.mime||S.mimes[0])}var X=oe.getMode(J,U);return X.name=="null"?null:X}k.highlightFormatting===void 0&&(k.highlightFormatting=!1),k.maxBlockquoteDepth===void 0&&(k.maxBlockquoteDepth=0),k.taskLists===void 0&&(k.taskLists=!1),k.strikethrough===void 0&&(k.strikethrough=!1),k.emoji===void 0&&(k.emoji=!1),k.fencedCodeBlockHighlighting===void 0&&(k.fencedCodeBlockHighlighting=!0),k.fencedCodeBlockDefaultMode===void 0&&(k.fencedCodeBlockDefaultMode="text/plain"),k.xml===void 0&&(k.xml=!0),k.tokenTypeOverrides===void 0&&(k.tokenTypeOverrides={});var G={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 H in G)G.hasOwnProperty(H)&&k.tokenTypeOverrides[H]&&(G[H]=k.tokenTypeOverrides[H]);var D=/^([*\-_])(?:\s*\1){2,}\s*$/,I=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,g=/^\[(x| )\](?=\s)/i,p=k.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,f=/^ {0,3}(?:\={1,}|-{2,})\s*$/,h=/^[^#!\[\]*_\\<>` "'(~:]+/,o=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,d=/^\s*\[[^\]]+?\]:.*$/,s=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\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 l(U,S,X){return S.f=S.inline=X,X(U,S)}function c(U,S,X){return S.f=S.block=X,X(U,S)}function R(U){return!U||!/\S/.test(U.string)}function w(U){if(U.linkTitle=!1,U.linkHref=!1,U.linkText=!1,U.em=!1,U.strong=!1,U.strikethrough=!1,U.quote=0,U.indentedCode=!1,U.f==O){var S=F;if(!S){var X=oe.innerMode($,U.htmlState);S=X.mode.name=="xml"&&X.state.tagStart===null&&!X.state.context&&X.state.tokenize.isInText}S&&(U.f=b,U.block=x,U.htmlState=null)}return U.trailingSpace=0,U.trailingSpaceNewLine=!1,U.prevLine=U.thisLine,U.thisLine={stream:null},null}function x(U,S){var X=U.column()===S.indentation,ee=R(S.prevLine.stream),ae=S.indentedCode,de=S.prevLine.hr,Ae=S.list!==!1,Ee=(S.listStack[S.listStack.length-1]||0)+3;S.indentedCode=!1;var we=S.indentation;if(S.indentationDiff===null&&(S.indentationDiff=S.indentation,Ae)){for(S.list=null;we<S.listStack[S.listStack.length-1];)S.listStack.pop(),S.listStack.length?S.indentation=S.listStack[S.listStack.length-1]:S.list=!1;S.list!==!1&&(S.indentationDiff=we-S.listStack[S.listStack.length-1])}var he=!ee&&!de&&!S.prevLine.header&&(!Ae||!ae)&&!S.prevLine.fencedCodeEnd,ce=(S.list===!1||de||ee)&&S.indentation<=Ee&&U.match(D),se=null;if(S.indentationDiff>=4&&(ae||S.prevLine.fencedCodeEnd||S.prevLine.header||ee))return U.skipToEnd(),S.indentedCode=!0,G.code;if(U.eatSpace())return null;if(X&&S.indentation<=Ee&&(se=U.match(p))&&se[1].length<=6)return S.quote=0,S.header=se[1].length,S.thisLine.header=!0,k.highlightFormatting&&(S.formatting="header"),S.f=S.inline,T(S);if(S.indentation<=Ee&&U.eat(">"))return S.quote=X?1:S.quote+1,k.highlightFormatting&&(S.formatting="quote"),U.eatSpace(),T(S);if(!ce&&!S.setext&&X&&S.indentation<=Ee&&(se=U.match(I))){var re=se[1]?"ol":"ul";return S.indentation=we+U.current().length,S.list=!0,S.quote=0,S.listStack.push(S.indentation),S.em=!1,S.strong=!1,S.code=!1,S.strikethrough=!1,k.taskLists&&U.match(g,!1)&&(S.taskList=!0),S.f=S.inline,k.highlightFormatting&&(S.formatting=["list","list-"+re]),T(S)}else{if(X&&S.indentation<=Ee&&(se=U.match(o,!0)))return S.quote=0,S.fencedEndRE=new RegExp(se[1]+"+ *$"),S.localMode=k.fencedCodeBlockHighlighting&&B(se[2]||k.fencedCodeBlockDefaultMode),S.localMode&&(S.localState=oe.startState(S.localMode)),S.f=S.block=A,k.highlightFormatting&&(S.formatting="code-block"),S.code=-1,T(S);if(S.setext||(!he||!Ae)&&!S.quote&&S.list===!1&&!S.code&&!ce&&!d.test(U.string)&&(se=U.lookAhead(1))&&(se=se.match(f)))return S.setext?(S.header=S.setext,S.setext=0,U.skipToEnd(),k.highlightFormatting&&(S.formatting="header")):(S.header=se[0].charAt(0)=="="?1:2,S.setext=S.header),S.thisLine.header=!0,S.f=S.inline,T(S);if(ce)return U.skipToEnd(),S.hr=!0,S.thisLine.hr=!0,G.hr;if(U.peek()==="[")return l(U,S,M)}return l(U,S,S.inline)}function O(U,S){var X=$.token(U,S.htmlState);if(!F){var ee=oe.innerMode($,S.htmlState);(ee.mode.name=="xml"&&ee.state.tagStart===null&&!ee.state.context&&ee.state.tokenize.isInText||S.md_inside&&U.current().indexOf(">")>-1)&&(S.f=b,S.block=x,S.htmlState=null)}return X}function A(U,S){var X=S.listStack[S.listStack.length-1]||0,ee=S.indentation<X,ae=X+3;if(S.fencedEndRE&&S.indentation<=ae&&(ee||U.match(S.fencedEndRE))){k.highlightFormatting&&(S.formatting="code-block");var de;return ee||(de=T(S)),S.localMode=S.localState=null,S.block=x,S.f=b,S.fencedEndRE=null,S.code=0,S.thisLine.fencedCodeEnd=!0,ee?c(U,S,S.block):de}else return S.localMode?S.localMode.token(U,S.localState):(U.skipToEnd(),G.code)}function T(U){var S=[];if(U.formatting){S.push(G.formatting),typeof U.formatting=="string"&&(U.formatting=[U.formatting]);for(var X=0;X<U.formatting.length;X++)S.push(G.formatting+"-"+U.formatting[X]),U.formatting[X]==="header"&&S.push(G.formatting+"-"+U.formatting[X]+"-"+U.header),U.formatting[X]==="quote"&&(!k.maxBlockquoteDepth||k.maxBlockquoteDepth>=U.quote?S.push(G.formatting+"-"+U.formatting[X]+"-"+U.quote):S.push("error"))}if(U.taskOpen)return S.push("meta"),S.length?S.join(" "):null;if(U.taskClosed)return S.push("property"),S.length?S.join(" "):null;if(U.linkHref?S.push(G.linkHref,"url"):(U.strong&&S.push(G.strong),U.em&&S.push(G.em),U.strikethrough&&S.push(G.strikethrough),U.emoji&&S.push(G.emoji),U.linkText&&S.push(G.linkText),U.code&&S.push(G.code),U.image&&S.push(G.image),U.imageAltText&&S.push(G.imageAltText,"link"),U.imageMarker&&S.push(G.imageMarker)),U.header&&S.push(G.header,G.header+"-"+U.header),U.quote&&(S.push(G.quote),!k.maxBlockquoteDepth||k.maxBlockquoteDepth>=U.quote?S.push(G.quote+"-"+U.quote):S.push(G.quote+"-"+k.maxBlockquoteDepth)),U.list!==!1){var ee=(U.listStack.length-1)%3;ee?ee===1?S.push(G.list2):S.push(G.list3):S.push(G.list1)}return U.trailingSpaceNewLine?S.push("trailing-space-new-line"):U.trailingSpace&&S.push("trailing-space-"+(U.trailingSpace%2?"a":"b")),S.length?S.join(" "):null}function E(U,S){return U.match(h,!0)?T(S):void 0}function b(U,S){var X=S.text(U,S);if(typeof X!="undefined")return X;if(S.list)return S.list=null,T(S);if(S.taskList){var ee=U.match(g,!0)[1]===" ";return ee?S.taskOpen=!0:S.taskClosed=!0,k.highlightFormatting&&(S.formatting="task"),S.taskList=!1,T(S)}if(S.taskOpen=!1,S.taskClosed=!1,S.header&&U.match(/^#+$/,!0))return k.highlightFormatting&&(S.formatting="header"),T(S);var ae=U.next();if(S.linkTitle){S.linkTitle=!1;var de=ae;ae==="("&&(de=")"),de=(de+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var Ae="^\\s*(?:[^"+de+"\\\\]+|\\\\\\\\|\\\\.)"+de;if(U.match(new RegExp(Ae),!0))return G.linkHref}if(ae==="`"){var Ee=S.formatting;k.highlightFormatting&&(S.formatting="code"),U.eatWhile("`");var we=U.current().length;if(S.code==0&&(!S.quote||we==1))return S.code=we,T(S);if(we==S.code){var he=T(S);return S.code=0,he}else return S.formatting=Ee,T(S)}else if(S.code)return T(S);if(ae==="\\"&&(U.next(),k.highlightFormatting)){var ce=T(S),se=G.formatting+"-escape";return ce?ce+" "+se:se}if(ae==="!"&&U.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return S.imageMarker=!0,S.image=!0,k.highlightFormatting&&(S.formatting="image"),T(S);if(ae==="["&&S.imageMarker&&U.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return S.imageMarker=!1,S.imageAltText=!0,k.highlightFormatting&&(S.formatting="image"),T(S);if(ae==="]"&&S.imageAltText){k.highlightFormatting&&(S.formatting="image");var ce=T(S);return S.imageAltText=!1,S.image=!1,S.inline=S.f=_,ce}if(ae==="["&&!S.image)return S.linkText&&U.match(/^.*?\]/)||(S.linkText=!0,k.highlightFormatting&&(S.formatting="link")),T(S);if(ae==="]"&&S.linkText){k.highlightFormatting&&(S.formatting="link");var ce=T(S);return S.linkText=!1,S.inline=S.f=U.match(/\(.*?\)| ?\[.*?\]/,!1)?_:b,ce}if(ae==="<"&&U.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){S.f=S.inline=u,k.highlightFormatting&&(S.formatting="link");var ce=T(S);return ce?ce+=" ":ce="",ce+G.linkInline}if(ae==="<"&&U.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){S.f=S.inline=u,k.highlightFormatting&&(S.formatting="link");var ce=T(S);return ce?ce+=" ":ce="",ce+G.linkEmail}if(k.xml&&ae==="<"&&U.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var re=U.string.indexOf(">",U.pos);if(re!=-1){var xe=U.string.substring(U.start,re);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(xe)&&(S.md_inside=!0)}return U.backUp(1),S.htmlState=oe.startState($),c(U,S,O)}if(k.xml&&ae==="<"&&U.match(/^\/\w*?>/))return S.md_inside=!1,"tag";if(ae==="*"||ae==="_"){for(var be=1,ke=U.pos==1?" ":U.string.charAt(U.pos-2);be<3&&U.eat(ae);)be++;var Oe=U.peek()||" ",Be=!/\s/.test(Oe)&&(!s.test(Oe)||/\s/.test(ke)||s.test(ke)),Ce=!/\s/.test(ke)&&(!s.test(ke)||/\s/.test(Oe)||s.test(Oe)),De=null,Ne=null;if(be%2&&(!S.em&&Be&&(ae==="*"||!Ce||s.test(ke))?De=!0:S.em==ae&&Ce&&(ae==="*"||!Be||s.test(Oe))&&(De=!1)),be>1&&(!S.strong&&Be&&(ae==="*"||!Ce||s.test(ke))?Ne=!0:S.strong==ae&&Ce&&(ae==="*"||!Be||s.test(Oe))&&(Ne=!1)),Ne!=null||De!=null){k.highlightFormatting&&(S.formatting=De==null?"strong":Ne==null?"em":"strong em"),De===!0&&(S.em=ae),Ne===!0&&(S.strong=ae);var he=T(S);return De===!1&&(S.em=!1),Ne===!1&&(S.strong=!1),he}}else if(ae===" "&&(U.eat("*")||U.eat("_"))){if(U.peek()===" ")return T(S);U.backUp(1)}if(k.strikethrough){if(ae==="~"&&U.eatWhile(ae)){if(S.strikethrough){k.highlightFormatting&&(S.formatting="strikethrough");var he=T(S);return S.strikethrough=!1,he}else if(U.match(/^[^\s]/,!1))return S.strikethrough=!0,k.highlightFormatting&&(S.formatting="strikethrough"),T(S)}else if(ae===" "&&U.match(/^~~/,!0)){if(U.peek()===" ")return T(S);U.backUp(2)}}if(k.emoji&&ae===":"&&U.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){S.emoji=!0,k.highlightFormatting&&(S.formatting="emoji");var Ke=T(S);return S.emoji=!1,Ke}return ae===" "&&(U.match(/^ +$/,!1)?S.trailingSpace++:S.trailingSpace&&(S.trailingSpaceNewLine=!0)),T(S)}function u(U,S){var X=U.next();if(X===">"){S.f=S.inline=b,k.highlightFormatting&&(S.formatting="link");var ee=T(S);return ee?ee+=" ":ee="",ee+G.linkInline}return U.match(/^[^>]+/,!0),G.linkInline}function _(U,S){if(U.eatSpace())return null;var X=U.next();return X==="("||X==="["?(S.f=S.inline=v(X==="("?")":"]"),k.highlightFormatting&&(S.formatting="link-string"),S.linkHref=!0,T(S)):"error"}var m={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function v(U){return function(S,X){var ee=S.next();if(ee===U){X.f=X.inline=b,k.highlightFormatting&&(X.formatting="link-string");var ae=T(X);return X.linkHref=!1,ae}return S.match(m[U]),X.linkHref=!0,T(X)}}function M(U,S){return U.match(/^([^\]\\]|\\.)*\]:/,!1)?(S.f=P,U.next(),k.highlightFormatting&&(S.formatting="link"),S.linkText=!0,T(S)):l(U,S,b)}function P(U,S){if(U.match(/^\]:/,!0)){S.f=S.inline=K,k.highlightFormatting&&(S.formatting="link");var X=T(S);return S.linkText=!1,X}return U.match(/^([^\]\\]|\\.)+/,!0),G.linkText}function K(U,S){return U.eatSpace()?null:(U.match(/^[^\s]+/,!0),U.peek()===void 0?S.linkTitle=!0:U.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),S.f=S.inline=b,G.linkHref+" url")}var V={startState:function(){return{f:x,prevLine:{stream:null},thisLine:{stream:null},block:x,htmlState:null,indentation:0,inline:b,text:E,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(U){return{f:U.f,prevLine:U.prevLine,thisLine:U.thisLine,block:U.block,htmlState:U.htmlState&&oe.copyState($,U.htmlState),indentation:U.indentation,localMode:U.localMode,localState:U.localMode?oe.copyState(U.localMode,U.localState):null,inline:U.inline,text:U.text,formatting:!1,linkText:U.linkText,linkTitle:U.linkTitle,linkHref:U.linkHref,code:U.code,em:U.em,strong:U.strong,strikethrough:U.strikethrough,emoji:U.emoji,header:U.header,setext:U.setext,hr:U.hr,taskList:U.taskList,list:U.list,listStack:U.listStack.slice(0),quote:U.quote,indentedCode:U.indentedCode,trailingSpace:U.trailingSpace,trailingSpaceNewLine:U.trailingSpaceNewLine,md_inside:U.md_inside,fencedEndRE:U.fencedEndRE}},token:function(U,S){if(S.formatting=!1,U!=S.thisLine.stream){if(S.header=0,S.hr=!1,U.match(/^\s*$/,!0))return w(S),null;if(S.prevLine=S.thisLine,S.thisLine={stream:U},S.taskList=!1,S.trailingSpace=0,S.trailingSpaceNewLine=!1,!S.localState&&(S.f=S.block,S.f!=O)){var X=U.match(/^\s*/,!0)[0].replace(/\t/g,a).length;if(S.indentation=X,S.indentationDiff=null,X>0)return null}}return S.f(U,S)},innerMode:function(U){return U.block==O?{state:U.htmlState,mode:$}:U.localState?{state:U.localState,mode:U.localMode}:{state:U,mode:V}},indent:function(U,S,X){return U.block==O&&$.indent?$.indent(U.htmlState,S,X):U.localState&&U.localMode.indent?U.localMode.indent(U.localState,S,X):oe.Pass},blankLine:w,getType:T,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return V},"xml"),oe.defineMIME("text/markdown","markdown"),oe.defineMIME("text/x-markdown","markdown")})},m7e3:function(yt,at,ne){yt.exports={flex_box_center:"flex_box_center___cDhGq",flex_space_between:"flex_space_between___3OXHk",flex_box_vertical_center:"flex_box_vertical_center___3g3vC",flex_box_center_end:"flex_box_center_end___2QmKm",flex_box_column:"flex_box_column___2Id0h",bg:"bg___1JEmc",title:"title___3bVR_",titleLeft:"titleLeft___2rmGK",titleRight:"titleRight___1YZFf",btns:"btns___2IVL7"}},osHv:function(yt,at,ne){(function(oe){oe(ne("VrN/"))})(function(oe){"use strict";var J=oe.Pos;function k(s,a){return s.line-a.line||s.ch-a.ch}var $="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",F=$+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",B=new RegExp("<(/?)(["+$+"]["+F+"]*)","g");function G(s,a,l,c){this.line=a,this.ch=l,this.cm=s,this.text=s.getLine(a),this.min=c?Math.max(c.from,s.firstLine()):s.firstLine(),this.max=c?Math.min(c.to-1,s.lastLine()):s.lastLine()}function H(s,a){var l=s.cm.getTokenTypeAt(J(s.line,a));return l&&/\btag\b/.test(l)}function D(s){return s.line>=s.max?void 0:(s.ch=0,s.text=s.cm.getLine(++s.line),!0)}function I(s){return s.line<=s.min?void 0:(s.text=s.cm.getLine(--s.line),s.ch=s.text.length,!0)}function g(s){for(;;){var a=s.text.indexOf(">",s.ch);if(a==-1){if(D(s))continue;return}if(!H(s,a+1)){s.ch=a+1;continue}var l=s.text.lastIndexOf("/",a),c=l>-1&&!/\S/.test(s.text.slice(l+1,a));return s.ch=a+1,c?"selfClose":"regular"}}function p(s){for(;;){var a=s.ch?s.text.lastIndexOf("<",s.ch-1):-1;if(a==-1){if(I(s))continue;return}if(!H(s,a+1)){s.ch=a;continue}B.lastIndex=a,s.ch=a;var l=B.exec(s.text);if(l&&l.index==a)return l}}function f(s){for(;;){B.lastIndex=s.ch;var a=B.exec(s.text);if(!a){if(D(s))continue;return}if(!H(s,a.index+1)){s.ch=a.index+1;continue}return s.ch=a.index+a[0].length,a}}function h(s){for(;;){var a=s.ch?s.text.lastIndexOf(">",s.ch-1):-1;if(a==-1){if(I(s))continue;return}if(!H(s,a+1)){s.ch=a;continue}var l=s.text.lastIndexOf("/",a),c=l>-1&&!/\S/.test(s.text.slice(l+1,a));return s.ch=a+1,c?"selfClose":"regular"}}function o(s,a){for(var l=[];;){var c=f(s),R,w=s.line,x=s.ch-(c?c[0].length:0);if(!c||!(R=g(s)))return;if(R=="selfClose")continue;if(c[1]){for(var O=l.length-1;O>=0;--O)if(l[O]==c[2]){l.length=O;break}if(O<0&&(!a||a==c[2]))return{tag:c[2],from:J(w,x),to:J(s.line,s.ch)}}else l.push(c[2])}}function d(s,a){for(var l=[];;){var c=h(s);if(!c)return;if(c=="selfClose"){p(s);continue}var R=s.line,w=s.ch,x=p(s);if(!x)return;if(x[1])l.push(x[2]);else{for(var O=l.length-1;O>=0;--O)if(l[O]==x[2]){l.length=O;break}if(O<0&&(!a||a==x[2]))return{tag:x[2],from:J(s.line,s.ch),to:J(R,w)}}}}oe.registerHelper("fold","xml",function(s,a){for(var l=new G(s,a.line,0);;){var c=f(l);if(!c||l.line!=a.line)return;var R=g(l);if(!R)return;if(!c[1]&&R!="selfClose"){var w=J(l.line,l.ch),x=o(l,c[2]);return x&&k(x.from,w)>0?{from:w,to:x.from}:null}}}),oe.findMatchingTag=function(s,a,l){var c=new G(s,a.line,a.ch,l);if(c.text.indexOf(">")==-1&&c.text.indexOf("<")==-1)return;var R=g(c),w=R&&J(c.line,c.ch),x=R&&p(c);if(!R||!x||k(c,a)>0)return;var O={from:J(c.line,c.ch),to:w,tag:x[2]};return R=="selfClose"?{open:O,close:null,at:"open"}:x[1]?{open:d(c,x[2]),close:O,at:"close"}:(c=new G(s,w.line,w.ch,l),{open:O,close:o(c,x[2]),at:"open"})},oe.findEnclosingTag=function(s,a,l,c){for(var R=new G(s,a.line,a.ch,l);;){var w=d(R,c);if(!w)break;var x=new G(s,a.line,a.ch,l),O=o(x,w.tag);if(O)return{open:w,close:O}}},oe.scanForClosingTag=function(s,a,l,c){var R=new G(s,a.line,a.ch,c?{from:0,to:c}:null);return o(R,l)}})},p5ED:function(yt,at,ne){"use strict";var oe=ne("+L6B"),J=ne("2/Rp"),k=ne("5Dmo"),$=ne("3S7+"),F=ne("k1fw"),B=ne("tJVT"),G=ne("q1tI"),H=ne.n(G),D=ne("vHTk"),I=ne.n(D),g=ne("yEEn"),p=ne("ZW9T"),f=ne("1vsH");at.a=function(h){var o=h.name,d=h.data,s=h.theme,a=h.type,l=h.filename,c=h.monacoEditor,R=h.className,w=h.style,x=h.close,O=h.onClose,A=h.hasMask,T=Object(G.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),E=Object(B.a)(T,2),b=E[0],u=E[1],_=Object(G.useState)(""),m=Object(B.a)(_,2),v=m[0],M=m[1],P,K=1024*1024,V=10*K,U=Object(G.useRef)();a==="office"&&(P=Object(f.T)(d).filesize,P>V&&(a="other")),l&&(c.filename=l),Object(G.useEffect)(function(){var ee,ae,de=(ee=document.cookie)===null||ee===void 0||((ae=ee.replace(/\s/g,""))===null||ae===void 0)?void 0:ae.split(";");de==null||de.map(function(Ae){var Ee=Ae.split("=");Ee[0]==="_educoder_session"&&M(Ee[1])})},[]);var S=function(){if(d.startsWith("http")||d.startsWith("/")){X();return}Object(f.z)(l||"educoder",d,l)},X=function(){Object(f.x)(l||o,d)};return console.log("data:",d,"fileanme:",l," name:",o),H.a.createElement("div",{style:Object(F.a)({},w||{}),className:"".concat(A&&I.a.bgBlack," ").concat(a?I.a.wrp:"hide")},x&&H.a.createElement("div",{className:I.a.close,ref:U},H.a.createElement($.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return U.current}},H.a.createElement("span",{onClick:X},H.a.createElement("i",{className:"icon-quxiaozhiding"}))),H.a.createElement($.a,{title:"\u5173\u95ED",getPopupContainer:function(){return U.current}},H.a.createElement("span",{className:"",onClick:O},H.a.createElement("i",{className:"icon-guanbi1"})))),H.a.createElement("div",{className:"".concat(I.a[R]," ").concat(R," ").concat(I.a.monaco," ").concat(a==="txt"?"show":"hide")},a==="txt"&&H.a.createElement(p.b,c)),a==="audio"&&H.a.createElement("audio",{src:"".concat(d!=null&&d.startsWith("/")||(d==null?void 0:d.indexOf("https://"))>-1?d:"data:audio/mp3;base64,").concat(d),autoPlay:!0}),a==="video"&&H.a.createElement(H.a.Fragment,null,d!=null&&d.startsWith("/")?H.a.createElement("video",{controls:!0,src:"".concat(d),autoPlay:!0}):H.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(d),autoPlay:!0})),a==="html"&&H.a.createElement("iframe",{src:d+"&disposition=inline"}),a==="pdf"&&H.a.createElement("embed",{className:I.a.embed,src:d}),a==="image"&&H.a.createElement(H.a.Fragment,null,H.a.createElement("img",{src:"".concat(d!=null&&d.startsWith("/")||(d==null?void 0:d.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(d)})),a==="other"&&H.a.createElement("div",null,H.a.createElement(J.a,{type:"primary",size:"large",onClick:S},H.a.createElement(g.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),(a==="download"||a==="office")&&H.a.createElement(J.a,{type:"primary",size:"large",onClick:S},H.a.createElement(g.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(yt,at,ne){},psGv:function(yt,at,ne){var oe,J;(function(){var k;(function(){"use strict";var G=[,,function(g){function p(o){this.__parent=o,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 o=new p(this.__parent);return o.set_indent(this.__indent_count,this.__alignment_count),o},p.prototype.item=function(o){return o<0?this.__items[this.__items.length+o]:this.__items[o]},p.prototype.has_match=function(o){for(var d=this.__items.length-1;d>=0;d--)if(this.__items[d].match(o))return!0;return!1},p.prototype.set_indent=function(o,d){this.is_empty()&&(this.__indent_count=o||0,this.__alignment_count=d||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 o=this.__parent.current_line;return o.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),o.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),o.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,o.__items[0]===" "&&(o.__items.splice(0,1),o.__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(o){this.__items.push(o);var d=o.lastIndexOf(`
`);d!==-1?this.__character_count=o.length-d:this.__character_count+=o.length},p.prototype.pop=function(){var o=null;return this.is_empty()||(o=this.__items.pop(),this.__character_count-=o.length),o},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 o="";return this.is_empty()?this.__parent.indent_empty_lines&&(o=this.__parent.get_indent_string(this.__indent_count)):(o=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),o+=this.__items.join("")),o};function f(o,d){this.__cache=[""],this.__indent_size=o.indent_size,this.__indent_string=o.indent_char,o.indent_with_tabs||(this.__indent_string=new Array(o.indent_size+1).join(o.indent_char)),d=d||"",o.indent_level>0&&(d=new Array(o.indent_level+1).join(this.__indent_string)),this.__base_string=d,this.__base_string_length=d.length}f.prototype.get_indent_size=function(o,d){var s=this.__base_string_length;return d=d||0,o<0&&(s=0),s+=o*this.__indent_size,s+=d,s},f.prototype.get_indent_string=function(o,d){var s=this.__base_string;return d=d||0,o<0&&(o=0,s=""),d+=o*this.__indent_size,this.__ensure_cache(d),s+=this.__cache[d],s},f.prototype.__ensure_cache=function(o){for(;o>=this.__cache.length;)this.__add_column()},f.prototype.__add_column=function(){var o=this.__cache.length,d=0,s="";this.__indent_size&&o>=this.__indent_size&&(d=Math.floor(o/this.__indent_size),o-=d*this.__indent_size,s=new Array(d+1).join(this.__indent_string)),o&&(s+=new Array(o+1).join(" ")),this.__cache.push(s)};function h(o,d){this.__indent_cache=new f(o,d),this.raw=!1,this._end_with_newline=o.end_with_newline,this.indent_size=o.indent_size,this.wrap_line_length=o.wrap_line_length,this.indent_empty_lines=o.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(o,d){return this.__indent_cache.get_indent_string(o,d)},h.prototype.get_indent_size=function(o,d){return this.__indent_cache.get_indent_size(o,d)},h.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},h.prototype.add_new_line=function(o){return this.is_empty()||!o&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},h.prototype.get_code=function(o){this.trim(!0);var d=this.current_line.pop();d&&(d[d.length-1]===`
`&&(d=d.replace(/\n+$/g,"")),this.current_line.push(d)),this._end_with_newline&&this.__add_outputline();var s=this.__lines.join(`
`);return o!==`
`&&(s=s.replace(/[\n]/g,o)),s},h.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},h.prototype.set_indent=function(o,d){return o=o||0,d=d||0,this.next_line.set_indent(o,d),this.__lines.length>1?(this.current_line.set_indent(o,d),!0):(this.current_line.set_indent(),!1)},h.prototype.add_raw_token=function(o){for(var d=0;d<o.newlines;d++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(o.whitespace_before),this.current_line.push(o.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},h.prototype.add_token=function(o){this.__add_space_before_token(),this.current_line.push(o),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},h.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},h.prototype.remove_indent=function(o){for(var d=this.__lines.length;o<d;)this.__lines[o]._remove_indent(),o++;this.current_line._remove_wrap_indent()},h.prototype.trim=function(o){for(o=o===void 0?!1:o,this.current_line.trim();o&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},h.prototype.just_added_newline=function(){return this.current_line.is_empty()},h.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},h.prototype.ensure_empty_line_above=function(o,d){for(var s=this.__lines.length-2;s>=0;){var a=this.__lines[s];if(a.is_empty())break;if(a.item(0).indexOf(o)!==0&&a.item(-1)!==d){this.__lines.splice(s+1,0,new p(this)),this.previous_line=this.__lines[this.__lines.length-2];break}s--}},g.exports.Output=h},function(g){function p(f,h,o,d){this.type=f,this.text=h,this.comments_before=null,this.newlines=o||0,this.whitespace_before=d||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}g.exports.Token=p},,,function(g){function p(o,d){this.raw_options=f(o,d),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(o,d){var s=this.raw_options[o],a=d||[];return typeof s=="object"?s!==null&&typeof s.concat=="function"&&(a=s.concat()):typeof s=="string"&&(a=s.split(/[^a-zA-Z0-9_\/\-]+/)),a},p.prototype._get_boolean=function(o,d){var s=this.raw_options[o],a=s===void 0?!!d:!!s;return a},p.prototype._get_characters=function(o,d){var s=this.raw_options[o],a=d||"";return typeof s=="string"&&(a=s.replace(/\\r/,"\r").replace(/\\n/,`
`).replace(/\\t/," ")),a},p.prototype._get_number=function(o,d){var s=this.raw_options[o];d=parseInt(d,10),isNaN(d)&&(d=0);var a=parseInt(s,10);return isNaN(a)&&(a=d),a},p.prototype._get_selection=function(o,d,s){var a=this._get_selection_list(o,d,s);if(a.length!==1)throw new Error("Invalid Option Value: The option '"+o+`' can only be one of the following values:
`+d+`
You passed in: '`+this.raw_options[o]+"'");return a[0]},p.prototype._get_selection_list=function(o,d,s){if(!d||d.length===0)throw new Error("Selection list cannot be empty.");if(s=s||[d[0]],!this._is_valid_selection(s,d))throw new Error("Invalid Default Value!");var a=this._get_array(o,s);if(!this._is_valid_selection(a,d))throw new Error("Invalid Option Value: The option '"+o+`' can contain only the following values:
`+d+`
You passed in: '`+this.raw_options[o]+"'");return a},p.prototype._is_valid_selection=function(o,d){return o.length&&d.length&&!o.some(function(s){return d.indexOf(s)===-1})};function f(o,d){var s={};o=h(o);var a;for(a in o)a!==d&&(s[a]=o[a]);if(d&&o[d])for(a in o[d])s[a]=o[d][a];return s}function h(o){var d={},s;for(s in o){var a=s.replace(/-/g,"_");d[a]=o[s]}return d}g.exports.Options=p,g.exports.normalizeOpts=h,g.exports.mergeOpts=f},,function(g){var p=RegExp.prototype.hasOwnProperty("sticky");function f(h){this.__input=h||"",this.__input_length=this.__input.length,this.__position=0}f.prototype.restart=function(){this.__position=0},f.prototype.back=function(){this.__position>0&&(this.__position-=1)},f.prototype.hasNext=function(){return this.__position<this.__input_length},f.prototype.next=function(){var h=null;return this.hasNext()&&(h=this.__input.charAt(this.__position),this.__position+=1),h},f.prototype.peek=function(h){var o=null;return h=h||0,h+=this.__position,h>=0&&h<this.__input_length&&(o=this.__input.charAt(h)),o},f.prototype.__match=function(h,o){h.lastIndex=o;var d=h.exec(this.__input);return d&&!(p&&h.sticky)&&(d.index!==o&&(d=null)),d},f.prototype.test=function(h,o){return o=o||0,o+=this.__position,o>=0&&o<this.__input_length?!!this.__match(h,o):!1},f.prototype.testChar=function(h,o){var d=this.peek(o);return h.lastIndex=0,d!==null&&h.test(d)},f.prototype.match=function(h){var o=this.__match(h,this.__position);return o?this.__position+=o[0].length:o=null,o},f.prototype.read=function(h,o,d){var s="",a;return h&&(a=this.match(h),a&&(s+=a[0])),o&&(a||!h)&&(s+=this.readUntil(o,d)),s},f.prototype.readUntil=function(h,o){var d="",s=this.__position;h.lastIndex=this.__position;var a=h.exec(this.__input);return a?(s=a.index,o&&(s+=a[0].length)):s=this.__input_length,d=this.__input.substring(this.__position,s),this.__position=s,d},f.prototype.readUntilAfter=function(h){return this.readUntil(h,!0)},f.prototype.get_regexp=function(h,o){var d=null,s="g";return o&&p&&(s="y"),typeof h=="string"&&h!==""?d=new RegExp(h,s):h&&(d=new RegExp(h.source,s)),d},f.prototype.get_literal_regexp=function(h){return RegExp(h.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},f.prototype.peekUntilAfter=function(h){var o=this.__position,d=this.readUntilAfter(h);return this.__position=o,d},f.prototype.lookBack=function(h){var o=this.__position-1;return o>=h.length&&this.__input.substring(o-h.length,o).toLowerCase()===h},g.exports.InputScanner=f},function(g,p,f){var h=f(8).InputScanner,o=f(3).Token,d=f(10).TokenStream,s=f(11).WhitespacePattern,a={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},l=function(c,R){this._input=new h(c),this._options=R||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new s(this._input)};l.prototype.tokenize=function(){this._input.restart(),this.__tokens=new d,this._reset();for(var c,R=new o(a.START,""),w=null,x=[],O=new d;R.type!==a.EOF;){for(c=this._get_next_token(R,w);this._is_comment(c);)O.add(c),c=this._get_next_token(R,w);O.isEmpty()||(c.comments_before=O,O=new d),c.parent=w,this._is_opening(c)?(x.push(w),w=c):w&&this._is_closing(c,w)&&(c.opened=w,w.closed=c,w=x.pop(),c.parent=w),c.previous=R,R.next=c,this.__tokens.add(c),R=c}return this.__tokens},l.prototype._is_first_token=function(){return this.__tokens.isEmpty()},l.prototype._reset=function(){},l.prototype._get_next_token=function(c,R){this._readWhitespace();var w=this._input.read(/.+/g);return w?this._create_token(a.RAW,w):this._create_token(a.EOF,"")},l.prototype._is_comment=function(c){return!1},l.prototype._is_opening=function(c){return!1},l.prototype._is_closing=function(c,R){return!1},l.prototype._create_token=function(c,R){var w=new o(c,R,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return w},l.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},g.exports.Tokenizer=l,g.exports.TOKEN=a},function(g){function p(f){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=f}p.prototype.restart=function(){this.__position=0},p.prototype.isEmpty=function(){return this.__tokens_length===0},p.prototype.hasNext=function(){return this.__position<this.__tokens_length},p.prototype.next=function(){var f=null;return this.hasNext()&&(f=this.__tokens[this.__position],this.__position+=1),f},p.prototype.peek=function(f){var h=null;return f=f||0,f+=this.__position,f>=0&&f<this.__tokens_length&&(h=this.__tokens[f]),h},p.prototype.add=function(f){this.__parent_token&&(f.parent=this.__parent_token),this.__tokens.push(f),this.__tokens_length+=1},g.exports.TokenStream=p},function(g,p,f){var h=f(12).Pattern;function o(d,s){h.call(this,d,s),s?this._line_regexp=this._input.get_regexp(s._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}o.prototype=new h,o.prototype.__set_whitespace_patterns=function(d,s){d+="\\t ",s+="\\n\\r",this._match_pattern=this._input.get_regexp("["+d+s+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+s+"]")},o.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var d=this._input.read(this._match_pattern);if(d===" ")this.whitespace_before_token=" ";else if(d){var s=this.__split(this._newline_regexp,d);this.newline_count=s.length-1,this.whitespace_before_token=s[this.newline_count]}return d},o.prototype.matching=function(d,s){var a=this._create();return a.__set_whitespace_patterns(d,s),a._update(),a},o.prototype._create=function(){return new o(this._input,this)},o.prototype.__split=function(d,s){d.lastIndex=0;for(var a=0,l=[],c=d.exec(s);c;)l.push(s.substring(a,c.index)),a=c.index+c[0].length,c=d.exec(s);return a<s.length?l.push(s.substring(a,s.length)):l.push(""),l},g.exports.WhitespacePattern=o},function(g){function p(f,h){this._input=f,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,h&&(this._starting_pattern=this._input.get_regexp(h._starting_pattern,!0),this._match_pattern=this._input.get_regexp(h._match_pattern,!0),this._until_pattern=this._input.get_regexp(h._until_pattern),this._until_after=h._until_after)}p.prototype.read=function(){var f=this._input.read(this._starting_pattern);return(!this._starting_pattern||f)&&(f+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),f},p.prototype.read_match=function(){return this._input.match(this._match_pattern)},p.prototype.until_after=function(f){var h=this._create();return h._until_after=!0,h._until_pattern=this._input.get_regexp(f),h._update(),h},p.prototype.until=function(f){var h=this._create();return h._until_after=!1,h._until_pattern=this._input.get_regexp(f),h._update(),h},p.prototype.starting_with=function(f){var h=this._create();return h._starting_pattern=this._input.get_regexp(f,!0),h._update(),h},p.prototype.matching=function(f){var h=this._create();return h._match_pattern=this._input.get_regexp(f,!0),h._update(),h},p.prototype._create=function(){return new p(this._input,this)},p.prototype._update=function(){},g.exports.Pattern=p},function(g){function p(f,h){f=typeof f=="string"?f:f.source,h=typeof h=="string"?h:h.source,this.__directives_block_pattern=new RegExp(f+/ beautify( \w+[:]\w+)+ /.source+h,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(f+/\sbeautify\signore:end\s/.source+h,"g")}p.prototype.get_directives=function(f){if(!f.match(this.__directives_block_pattern))return null;var h={};this.__directive_pattern.lastIndex=0;for(var o=this.__directive_pattern.exec(f);o;)h[o[1]]=o[2],o=this.__directive_pattern.exec(f);return h},p.prototype.readIgnored=function(f){return f.readUntilAfter(this.__directives_end_ignore_pattern)},g.exports.Directives=p},function(g,p,f){var h=f(12).Pattern,o={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1};function d(s,a){h.call(this,s,a),this.__template_pattern=null,this._disabled=Object.assign({},o),this._excluded=Object.assign({},o),a&&(this.__template_pattern=this._input.get_regexp(a.__template_pattern),this._excluded=Object.assign(this._excluded,a._excluded),this._disabled=Object.assign(this._disabled,a._disabled));var l=new h(s);this.__patterns={handlebars_comment:l.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:l.starting_with(/{{{/).until_after(/}}}/),handlebars:l.starting_with(/{{/).until_after(/}}/),php:l.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:l.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:l.starting_with(/{%/).until_after(/%}/),django_value:l.starting_with(/{{/).until_after(/}}/),django_comment:l.starting_with(/{#/).until_after(/#}/),smarty:l.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:l.starting_with(/{\*/).until_after(/\*}/),smarty_literal:l.starting_with(/{literal}/).until_after(/{\/literal}/)}}d.prototype=new h,d.prototype._create=function(){return new d(this._input,this)},d.prototype._update=function(){this.__set_templated_pattern()},d.prototype.disable=function(s){var a=this._create();return a._disabled[s]=!0,a._update(),a},d.prototype.read_options=function(s){var a=this._create();for(var l in o)a._disabled[l]=s.templating.indexOf(l)===-1;return a._update(),a},d.prototype.exclude=function(s){var a=this._create();return a._excluded[s]=!0,a._update(),a},d.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 a=this._read_template();a;)this._match_pattern?a+=this._input.read(this._match_pattern):a+=this._input.readUntil(this.__template_pattern),s+=a,a=this._read_template();return this._until_after&&(s+=this._input.readUntilAfter(this._until_pattern)),s},d.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("|")+")")},d.prototype._read_template=function(){var s="",a=this._input.peek();if(a==="<"){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 a==="{"&&(!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},g.exports.TemplatablePattern=d},,,,function(g,p,f){var h=f(19).Beautifier,o=f(20).Options;function d(s,a,l,c){var R=new h(s,a,l,c);return R.beautify()}g.exports=d,g.exports.defaultOptions=function(){return new o}},function(g,p,f){var h=f(20).Options,o=f(2).Output,d=f(21).Tokenizer,s=f(21).TOKEN,a=/\r\n|[\r\n]/,l=/\r\n|[\r\n]/g,c=function(_,m){this.indent_level=0,this.alignment_size=0,this.max_preserve_newlines=_.max_preserve_newlines,this.preserve_newlines=_.preserve_newlines,this._output=new o(_,m)};c.prototype.current_line_has_match=function(_){return this._output.current_line.has_match(_)},c.prototype.set_space_before_token=function(_,m){this._output.space_before_token=_,this._output.non_breaking_space=m},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(_){this._output.add_raw_token(_)},c.prototype.print_preserved_newlines=function(_){var m=0;_.type!==s.TEXT&&_.previous.type!==s.TEXT&&(m=_.newlines?1:0),this.preserve_newlines&&(m=_.newlines<this.max_preserve_newlines+1?_.newlines:this.max_preserve_newlines+1);for(var v=0;v<m;v++)this.print_newline(v>0);return m!==0},c.prototype.traverse_whitespace=function(_){return _.whitespace_before||_.newlines?(this.print_preserved_newlines(_)||(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(_){this._output.add_new_line(_)},c.prototype.print_token=function(_){_.text&&(this._output.set_indent(this.indent_level,this.alignment_size),this._output.add_token(_.text))},c.prototype.indent=function(){this.indent_level++},c.prototype.get_full_indent=function(_){return _=this.indent_level+(_||0),_<1?"":this._output.get_indent_string(_)};var R=function(_){for(var m=null,v=_.next;v.type!==s.EOF&&_.closed!==v;){if(v.type===s.ATTRIBUTE&&v.text==="type"){v.next&&v.next.type===s.EQUALS&&v.next.next&&v.next.next.type===s.VALUE&&(m=v.next.next.text);break}v=v.next}return m},w=function(_,m){var v=null,M=null;return m.closed?(_==="script"?v="text/javascript":_==="style"&&(v="text/css"),v=R(m)||v,v.search("text/css")>-1?M="css":v.search(/module|((text|application|dojo)\/(x-)?(javascript|ecmascript|jscript|livescript|(ld\+)?json|method|aspect))/)>-1?M="javascript":v.search(/(text|application|dojo)\/(x-)?(html)/)>-1?M="html":v.search(/test\/null/)>-1&&(M="null"),M):null};function x(_,m){return m.indexOf(_)!==-1}function O(_,m,v){this.parent=_||null,this.tag=m?m.tag_name:"",this.indent_level=v||0,this.parser_token=m||null}function A(_){this._printer=_,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(_){var m=new O(this._current_frame,_,this._printer.indent_level);this._current_frame=m},A.prototype._try_pop_frame=function(_){var m=null;return _&&(m=_.parser_token,this._printer.indent_level=_.indent_level,this._current_frame=_.parent),m},A.prototype._get_frame=function(_,m){for(var v=this._current_frame;v&&!(_.indexOf(v.tag)!==-1);){if(m&&m.indexOf(v.tag)!==-1){v=null;break}v=v.parent}return v},A.prototype.try_pop=function(_,m){var v=this._get_frame([_],m);return this._try_pop_frame(v)},A.prototype.indent_to_tag=function(_){var m=this._get_frame(_);m&&(this._printer.indent_level=m.indent_level)};function T(_,m,v,M){this._source_text=_||"",m=m||{},this._js_beautify=v,this._css_beautify=M,this._tag_stack=null;var P=new h(m,"html");this._options=P,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"}T.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var _=this._source_text,m=this._options.eol;this._options.eol==="auto"&&(m=`
`,_&&a.test(_)&&(m=_.match(a)[0])),_=_.replace(l,`
`);var v=_.match(/^[\t ]*/)[0],M={text:"",type:""},P=new E,K=new c(this._options,v),V=new d(_,this._options).tokenize();this._tag_stack=new A(K);for(var U=null,S=V.next();S.type!==s.EOF;)S.type===s.TAG_OPEN||S.type===s.COMMENT?(U=this._handle_tag_open(K,S,P,M),P=U):S.type===s.ATTRIBUTE||S.type===s.EQUALS||S.type===s.VALUE||S.type===s.TEXT&&!P.tag_complete?U=this._handle_inside_tag(K,S,P,V):S.type===s.TAG_CLOSE?U=this._handle_tag_close(K,S,P):S.type===s.TEXT?U=this._handle_text(K,S,P):K.add_raw_token(S),M=U,S=V.next();var X=K._output.get_code(m);return X},T.prototype._handle_tag_close=function(_,m,v){var M={text:m.text,type:m.type};return _.alignment_size=0,v.tag_complete=!0,_.set_space_before_token(m.newlines||m.whitespace_before!=="",!0),v.is_unformatted?_.add_raw_token(m):(v.tag_start_char==="<"&&(_.set_space_before_token(m.text[0]==="/",!0),this._is_wrap_attributes_force_expand_multiline&&v.has_wrapped_attrs&&_.print_newline(!1)),_.print_token(m)),v.indent_content&&!(v.is_unformatted||v.is_content_unformatted)&&(_.indent(),v.indent_content=!1),!v.is_inline_element&&!(v.is_unformatted||v.is_content_unformatted)&&_.set_wrap_point(),M},T.prototype._handle_inside_tag=function(_,m,v,M){var P=v.has_wrapped_attrs,K={text:m.text,type:m.type};if(_.set_space_before_token(m.newlines||m.whitespace_before!=="",!0),v.is_unformatted)_.add_raw_token(m);else if(v.tag_start_char==="{"&&m.type===s.TEXT)_.print_preserved_newlines(m)?(m.newlines=0,_.add_raw_token(m)):_.print_token(m);else{if(m.type===s.ATTRIBUTE?(_.set_space_before_token(!0),v.attr_count+=1):(m.type===s.EQUALS||m.type===s.VALUE&&m.previous.type===s.EQUALS)&&_.set_space_before_token(!1),m.type===s.ATTRIBUTE&&v.tag_start_char==="<"&&((this._is_wrap_attributes_preserve||this._is_wrap_attributes_preserve_aligned)&&(_.traverse_whitespace(m),P=P||m.newlines!==0),this._is_wrap_attributes_force)){var V=v.attr_count>1;if(this._is_wrap_attributes_force_expand_multiline&&v.attr_count===1){var U=!0,S=0,X;do{if(X=M.peek(S),X.type===s.ATTRIBUTE){U=!1;break}S+=1}while(S<4&&X.type!==s.EOF&&X.type!==s.TAG_CLOSE);V=!U}V&&(_.print_newline(!1),P=!0)}_.print_token(m),P=P||_.previous_token_wrapped(),v.has_wrapped_attrs=P}return K},T.prototype._handle_text=function(_,m,v){var M={text:m.text,type:"TK_CONTENT"};return v.custom_beautifier_name?this._print_custom_beatifier_text(_,m,v):v.is_unformatted||v.is_content_unformatted?_.add_raw_token(m):(_.traverse_whitespace(m),_.print_token(m)),M},T.prototype._print_custom_beatifier_text=function(_,m,v){var M=this;if(m.text!==""){var P=m.text,K,V=1,U="",S="";v.custom_beautifier_name==="javascript"&&typeof this._js_beautify=="function"?K=this._js_beautify:v.custom_beautifier_name==="css"&&typeof this._css_beautify=="function"?K=this._css_beautify:v.custom_beautifier_name==="html"&&(K=function(Ee,we){var he=new T(Ee,we,M._js_beautify,M._css_beautify);return he.beautify()}),this._options.indent_scripts==="keep"?V=0:this._options.indent_scripts==="separate"&&(V=-_.indent_level);var X=_.get_full_indent(V);if(P=P.replace(/\n[ \t]*$/,""),v.custom_beautifier_name!=="html"&&P[0]==="<"&&P.match(/^(<!--|<!\[CDATA\[)/)){var ee=/^(<!--[^\n]*|<!\[CDATA\[)(\n?)([ \t\n]*)([\s\S]*)(-->|]]>)$/.exec(P);if(!ee){_.add_raw_token(m);return}U=X+ee[1]+`
`,P=ee[4],ee[5]&&(S=X+ee[5]),P=P.replace(/\n[ \t]*$/,""),(ee[2]||ee[3].indexOf(`
`)!==-1)&&(ee=ee[3].match(/[ \t]+$/),ee&&(m.whitespace_before=ee[0]))}if(P)if(K){var ae=function(){this.eol=`
`};ae.prototype=this._options.raw_options;var de=new ae;P=K(X+P,de)}else{var Ae=m.whitespace_before;Ae&&(P=P.replace(new RegExp(`
(`+Ae+")?","g"),`
`)),P=X+P.replace(/\n/g,`
`+X)}U&&(P?P=U+P+`
`+S:P=U+S),_.print_newline(!1),P&&(m.text=P,m.whitespace_before="",m.newlines=0,_.add_raw_token(m),_.print_newline(!0))}},T.prototype._handle_tag_open=function(_,m,v,M){var P=this._get_tag_open_token(m);return(v.is_unformatted||v.is_content_unformatted)&&!v.is_empty_element&&m.type===s.TAG_OPEN&&m.text.indexOf("</")===0?(_.add_raw_token(m),P.start_tag_token=this._tag_stack.try_pop(P.tag_name)):(_.traverse_whitespace(m),this._set_tag_position(_,m,P,v,M),P.is_inline_element||_.set_wrap_point(),_.print_token(m)),(this._is_wrap_attributes_force_aligned||this._is_wrap_attributes_aligned_multiple||this._is_wrap_attributes_preserve_aligned)&&(P.alignment_size=m.text.length+1),!P.tag_complete&&!P.is_unformatted&&(_.alignment_size=P.alignment_size),P};var E=function(_,m){if(this.parent=_||null,this.text="",this.type="TK_TAG_OPEN",this.tag_name="",this.is_inline_element=!1,this.is_unformatted=!1,this.is_content_unformatted=!1,this.is_empty_element=!1,this.is_start_tag=!1,this.is_end_tag=!1,this.indent_content=!1,this.multiline_content=!1,this.custom_beautifier_name=null,this.start_tag_token=null,this.attr_count=0,this.has_wrapped_attrs=!1,this.alignment_size=0,this.tag_complete=!1,this.tag_start_char="",this.tag_check="",!m)this.tag_complete=!0;else{var v;this.tag_start_char=m.text[0],this.text=m.text,this.tag_start_char==="<"?(v=m.text.match(/^<([^\s>]*)/),this.tag_check=v?v[1]:""):(v=m.text.match(/^{{~?(?:[\^]|#\*?)?([^\s}]+)/),this.tag_check=v?v[1]:"",(m.text.startsWith("{{#>")||m.text.startsWith("{{~#>"))&&this.tag_check[0]===">"&&(this.tag_check===">"&&m.next!==null?this.tag_check=m.next.text.split(" ")[0]:this.tag_check=m.text.split(">")[1])),this.tag_check=this.tag_check.toLowerCase(),m.type===s.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||m.closed&&m.closed.text==="/>";var M=2;this.tag_start_char==="{"&&this.text.length>=3&&(this.text.charAt(2)==="~"&&(M=3)),this.is_end_tag=this.is_end_tag||this.tag_start_char==="{"&&(this.text.length<3||/[^#\^]/.test(this.text.charAt(M)))}};T.prototype._get_tag_open_token=function(_){var m=new E(this._tag_stack.get_parser_token(),_);return m.alignment_size=this._options.wrap_attributes_indent_size,m.is_end_tag=m.is_end_tag||x(m.tag_check,this._options.void_elements),m.is_empty_element=m.tag_complete||m.is_start_tag&&m.is_end_tag,m.is_unformatted=!m.tag_complete&&x(m.tag_check,this._options.unformatted),m.is_content_unformatted=!m.is_empty_element&&x(m.tag_check,this._options.content_unformatted),m.is_inline_element=x(m.tag_name,this._options.inline)||m.tag_name.includes("-")||m.tag_start_char==="{",m},T.prototype._set_tag_position=function(_,m,v,M,P){if(v.is_empty_element||(v.is_end_tag?v.start_tag_token=this._tag_stack.try_pop(v.tag_name):(this._do_optional_end_element(v)&&(v.is_inline_element||_.print_newline(!1)),this._tag_stack.record_tag(v),(v.tag_name==="script"||v.tag_name==="style")&&!(v.is_unformatted||v.is_content_unformatted)&&(v.custom_beautifier_name=w(v.tag_check,m)))),x(v.tag_check,this._options.extra_liners)&&(_.print_newline(!1),_._output.just_added_blankline()||_.print_newline(!0)),v.is_empty_element){if(v.tag_start_char==="{"&&v.tag_check==="else"){this._tag_stack.indent_to_tag(["if","unless","each"]),v.indent_content=!0;var K=_.current_line_has_match(/{{#if/);K||_.print_newline(!1)}v.tag_name==="!--"&&P.type===s.TAG_CLOSE&&M.is_end_tag&&v.text.indexOf(`
`)===-1||(v.is_inline_element||v.is_unformatted||_.print_newline(!1),this._calcluate_parent_multiline(_,v))}else if(v.is_end_tag){var V=!1;V=v.start_tag_token&&v.start_tag_token.multiline_content,V=V||!v.is_inline_element&&!(M.is_inline_element||M.is_unformatted)&&!(P.type===s.TAG_CLOSE&&v.start_tag_token===M)&&P.type!=="TK_CONTENT",(v.is_content_unformatted||v.is_unformatted)&&(V=!1),V&&_.print_newline(!1)}else v.indent_content=!v.custom_beautifier_name,v.tag_start_char==="<"&&(v.tag_name==="html"?v.indent_content=this._options.indent_inner_html:v.tag_name==="head"?v.indent_content=this._options.indent_head_inner_html:v.tag_name==="body"&&(v.indent_content=this._options.indent_body_inner_html)),!(v.is_inline_element||v.is_unformatted)&&(P.type!=="TK_CONTENT"||v.is_content_unformatted)&&_.print_newline(!1),this._calcluate_parent_multiline(_,v)},T.prototype._calcluate_parent_multiline=function(_,m){m.parent&&_._output.just_added_newline()&&!((m.is_inline_element||m.is_unformatted)&&m.parent.is_inline_element)&&(m.parent.multiline_content=!0)};var b=["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"],u=["a","audio","del","ins","map","noscript","video"];T.prototype._do_optional_end_element=function(_){var m=null;if(_.is_empty_element||!_.is_start_tag||!_.parent)return;if(_.tag_name==="body")m=m||this._tag_stack.try_pop("head");else if(_.tag_name==="li")m=m||this._tag_stack.try_pop("li",["ol","ul"]);else if(_.tag_name==="dd"||_.tag_name==="dt")m=m||this._tag_stack.try_pop("dt",["dl"]),m=m||this._tag_stack.try_pop("dd",["dl"]);else if(_.parent.tag_name==="p"&&b.indexOf(_.tag_name)!==-1){var v=_.parent.parent;(!v||u.indexOf(v.tag_name)===-1)&&(m=m||this._tag_stack.try_pop("p"))}else _.tag_name==="rp"||_.tag_name==="rt"?(m=m||this._tag_stack.try_pop("rt",["ruby","rtc"]),m=m||this._tag_stack.try_pop("rp",["ruby","rtc"])):_.tag_name==="optgroup"?m=m||this._tag_stack.try_pop("optgroup",["select"]):_.tag_name==="option"?m=m||this._tag_stack.try_pop("option",["select","datalist","optgroup"]):_.tag_name==="colgroup"?m=m||this._tag_stack.try_pop("caption",["table"]):_.tag_name==="thead"?(m=m||this._tag_stack.try_pop("caption",["table"]),m=m||this._tag_stack.try_pop("colgroup",["table"])):_.tag_name==="tbody"||_.tag_name==="tfoot"?(m=m||this._tag_stack.try_pop("caption",["table"]),m=m||this._tag_stack.try_pop("colgroup",["table"]),m=m||this._tag_stack.try_pop("thead",["table"]),m=m||this._tag_stack.try_pop("tbody",["table"])):_.tag_name==="tr"?(m=m||this._tag_stack.try_pop("caption",["table"]),m=m||this._tag_stack.try_pop("colgroup",["table"]),m=m||this._tag_stack.try_pop("tr",["table","thead","tbody","tfoot"])):(_.tag_name==="th"||_.tag_name==="td")&&(m=m||this._tag_stack.try_pop("td",["table","thead","tbody","tfoot","tr"]),m=m||this._tag_stack.try_pop("th",["table","thead","tbody","tfoot","tr"]));return _.parent=this._tag_stack.get_parser_token(),m},g.exports.Beautifier=T},function(g,p,f){var h=f(6).Options;function o(d){h.call(this,d,"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"])}o.prototype=new h,g.exports.Options=o},function(g,p,f){var h=f(9).Tokenizer,o=f(9).TOKEN,d=f(13).Directives,s=f(14).TemplatablePattern,a=f(12).Pattern,l={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:o.START,RAW:o.RAW,EOF:o.EOF},c=new d(/<\!--/,/-->/),R=function(w,x){h.call(this,w,x),this._current_tag_name="";var O=new s(this._input).read_options(this._options),A=new a(this._input);if(this.__patterns={word:O.until(/[\n\r\t <]/),single_quote:O.until_after(/'/),double_quote:O.until_after(/"/),attribute:O.until(/[\n\r\t =>]|\/>/),element_name:O.until(/[\n\r\t >\/]/),handlebars_comment:A.starting_with(/{{!--/).until_after(/--}}/),handlebars:A.starting_with(/{{/).until_after(/}}/),handlebars_open:A.until(/[\n\r\t }]/),handlebars_raw_close:A.until(/}}/),comment:A.starting_with(/<!--/).until_after(/-->/),cdata:A.starting_with(/<!\[CDATA\[/).until_after(/]]>/),conditional_comment:A.starting_with(/<!\[/).until_after(/]>/),processing:A.starting_with(/<\?/).until_after(/\?>/)},this._options.indent_handlebars&&(this.__patterns.word=this.__patterns.word.exclude("handlebars")),this._unformatted_content_delimiter=null,this._options.unformatted_content_delimiter){var T=this._input.get_literal_regexp(this._options.unformatted_content_delimiter);this.__patterns.unformatted_content_delimiter=A.matching(T).until_after(T)}};R.prototype=new h,R.prototype._is_comment=function(w){return!1},R.prototype._is_opening=function(w){return w.type===l.TAG_OPEN},R.prototype._is_closing=function(w,x){return w.type===l.TAG_CLOSE&&x&&((w.text===">"||w.text==="/>")&&x.text[0]==="<"||w.text==="}}"&&x.text[0]==="{"&&x.text[1]==="{")},R.prototype._reset=function(){this._current_tag_name=""},R.prototype._get_next_token=function(w,x){var O=null;this._readWhitespace();var A=this._input.peek();return A===null?this._create_token(l.EOF,""):(O=O||this._read_open_handlebars(A,x),O=O||this._read_attribute(A,w,x),O=O||this._read_close(A,x),O=O||this._read_raw_content(A,w,x),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,x),O=O||this._create_token(l.UNKNOWN,this._input.next()),O)},R.prototype._read_comment_or_cdata=function(w){var x=null,O=null,A=null;if(w==="<"){var T=this._input.peek(1);T==="!"&&(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&&(x=this._create_token(l.COMMENT,O),x.directives=A)}return x},R.prototype._read_processing=function(w){var x=null,O=null,A=null;if(w==="<"){var T=this._input.peek(1);(T==="!"||T==="?")&&(O=this.__patterns.conditional_comment.read(),O=O||this.__patterns.processing.read()),O&&(x=this._create_token(l.COMMENT,O),x.directives=A)}return x},R.prototype._read_open=function(w,x){var O=null,A=null;return x||w==="<"&&(O=this._input.next(),this._input.peek()==="/"&&(O+=this._input.next()),O+=this.__patterns.element_name.read(),A=this._create_token(l.TAG_OPEN,O)),A},R.prototype._read_open_handlebars=function(w,x){var O=null,A=null;return x||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(l.COMMENT,O)):(O=this.__patterns.handlebars_open.read(),A=this._create_token(l.TAG_OPEN,O))),A},R.prototype._read_close=function(w,x){var O=null,A=null;return x&&(x.text[0]==="<"&&(w===">"||w==="/"&&this._input.peek(1)===">")?(O=this._input.next(),w==="/"&&(O+=this._input.next()),A=this._create_token(l.TAG_CLOSE,O)):x.text[0]==="{"&&w==="}"&&this._input.peek(1)==="}"&&(this._input.next(),this._input.next(),A=this._create_token(l.TAG_CLOSE,"}}"))),A},R.prototype._read_attribute=function(w,x,O){var A=null,T="";if(O&&O.text[0]==="<")if(w==="=")A=this._create_token(l.EQUALS,this._input.next());else if(w==='"'||w==="'"){var E=this._input.next();w==='"'?E+=this.__patterns.double_quote.read():E+=this.__patterns.single_quote.read(),A=this._create_token(l.VALUE,E)}else T=this.__patterns.attribute.read(),T&&(x.type===l.EQUALS?A=this._create_token(l.VALUE,T):A=this._create_token(l.ATTRIBUTE,T));return A},R.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)},R.prototype._read_raw_content=function(w,x,O){var A="";if(O&&O.text[0]==="{")A=this.__patterns.handlebars_raw_close.read();else if(x.type===l.TAG_CLOSE&&x.opened.text[0]==="<"&&x.text[0]!=="/"){var T=x.opened.text.substr(1).toLowerCase();if(T==="script"||T==="style"){var E=this._read_comment_or_cdata(w);if(E)return E.type=l.TEXT,E;A=this._input.readUntil(new RegExp("</"+T+"[\\n\\r\\t ]*?>","ig"))}else this._is_content_unformatted(T)&&(A=this._input.readUntil(new RegExp("</"+T+"[\\n\\r\\t ]*?>","ig")))}return A?this._create_token(l.TEXT,A):null},R.prototype._read_content_word=function(w){var x="";if(this._options.unformatted_content_delimiter&&(w===this._options.unformatted_content_delimiter[0]&&(x=this.__patterns.unformatted_content_delimiter.read())),x||(x=this.__patterns.word.read()),x)return this._create_token(l.TEXT,x)},g.exports.Tokenizer=R,g.exports.TOKEN=l}],H={};function D(g){var p=H[g];if(p!==void 0)return p.exports;var f=H[g]={exports:{}};return G[g](f,f.exports,D),f.exports}var I=D(18);k=I})();var $=k;if(!0)!(oe=[ne,ne("6UM0"),ne("TXwP")],J=function(G){var H=ne("6UM0"),D=ne("TXwP");return{html_beautify:function(I,g){return $(I,g,H.js_beautify,D.css_beautify)}}}.apply(at,oe),J!==void 0&&(yt.exports=J));else var F,B})()},"rAM+":function(yt,at,ne){"use strict";ne.d(at,"a",function(){return J});var oe=ne("Qw5x");function J(k,$){var F;if(typeof Symbol=="undefined"||k[Symbol.iterator]==null){if(Array.isArray(k)||(F=Object(oe.a)(k))||$&&k&&typeof k.length=="number"){F&&(k=F);var B=0,G=function(){};return{s:G,n:function(){return B>=k.length?{done:!0}:{done:!1,value:k[B++]}},e:function(p){throw p},f:G}}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 H=!0,D=!1,I;return{s:function(){F=k[Symbol.iterator]()},n:function(){var p=F.next();return H=p.done,p},e:function(p){D=!0,I=p},f:function(){try{!H&&F.return!=null&&F.return()}finally{if(D)throw I}}}}},rUJ1:function(yt,at){const ne=/[&<>"']/,oe=/[&<>"']/g,J=/[<>"']|&(?!#?\w+;)/,k=/[<>"']|&(?!#?\w+;)/g,$={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},F=A=>$[A];function B(A,T){if(T){if(ne.test(A))return A.replace(oe,F)}else if(J.test(A))return A.replace(k,F);return A}const G=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function H(A){return A.replace(G,(T,E)=>(E=E.toLowerCase(),E==="colon"?":":E.charAt(0)==="#"?E.charAt(1)==="x"?String.fromCharCode(parseInt(E.substring(2),16)):String.fromCharCode(+E.substring(1)):""))}const D=/(^|[^\[])\^/g;function I(A,T){A=A.source||A,T=T||"";const E={replace:(b,u)=>(u=u.source||u,u=u.replace(D,"$1"),A=A.replace(b,u),E),getRegex:()=>new RegExp(A,T)};return E}const g=/[^\w:]/g,p=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function f(A,T,E){if(A){let b;try{b=decodeURIComponent(H(E)).replace(g,"").toLowerCase()}catch(u){return null}if(b.indexOf("javascript:")===0||b.indexOf("vbscript:")===0||b.indexOf("data:")===0)return null}T&&!p.test(E)&&(E=a(T,E));try{E=encodeURI(E).replace(/%25/g,"%")}catch(b){return null}return E}const h={},o=/^[^:]+:\/*[^/]*$/,d=/^([^:]+:)[\s\S]*$/,s=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(A,T){h[" "+A]||(o.test(A)?h[" "+A]=A+"/":h[" "+A]=w(A,"/",!0)),A=h[" "+A];const E=A.indexOf(":")===-1;return T.substring(0,2)==="//"?E?T:A.replace(d,"$1")+T:T.charAt(0)==="/"?E?T:A.replace(s,"$1")+T:A+T}const l={exec:function(){}};function c(A){let T=1,E,b;for(;T<arguments.length;T++){E=arguments[T];for(b in E)Object.prototype.hasOwnProperty.call(E,b)&&(A[b]=E[b])}return A}function R(A,T){const E=A.replace(/\|/g,(_,m,v)=>{let M=!1,P=m;for(;--P>=0&&v[P]==="\\";)M=!M;return M?"|":" |"}),b=E.split(/ \|/);let u=0;if(b.length>T)b.splice(T);else for(;b.length<T;)b.push("");for(;u<b.length;u++)b[u]=b[u].trim().replace(/\\\|/g,"|");return b}function w(A,T,E){const b=A.length;if(b===0)return"";let u=0;for(;u<b;){const _=A.charAt(b-u-1);if(_===T&&!E)u++;else if(_!==T&&E)u++;else break}return A.substr(0,b-u)}function x(A,T){if(A.indexOf(T[1])===-1)return-1;const E=A.length;let b=0,u=0;for(;u<E;u++)if(A[u]==="\\")u++;else if(A[u]===T[0])b++;else if(A[u]===T[1]&&(b--,b<0))return u;return-1}function O(A){A&&A.sanitize&&!A.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}yt.exports={escape:B,unescape:H,edit:I,cleanUrl:f,resolveUrl:a,noopTest:l,merge:c,splitCells:R,rtrim:w,findClosingBracket:x,checkSanitizeDeprecation:O}},uK0f:function(yt,at,ne){(function(oe,J){yt.exports=J()})(this,function(){"use strict";function oe(J,k,$){$=$||{},$.childrenKeyName=$.childrenKeyName||"children";var F=J||[],B=[],G=0;do{var H=F.filter(function(D){return k(D,G)})[0];if(!H)break;B.push(H),F=H[$.childrenKeyName]||[],G+=1}while(F.length>0);return B}return oe})},ulZh:function(yt,at,ne){typeof window!="undefined"&&function(J,k){yt.exports=k()}(this,function(){return function(oe){var J={};function k($){if(J[$])return J[$].exports;var F=J[$]={i:$,l:!1,exports:{}};return oe[$].call(F.exports,F,F.exports,k),F.l=!0,F.exports}return k.m=oe,k.c=J,k.d=function($,F,B){k.o($,F)||Object.defineProperty($,F,{enumerable:!0,get:B})},k.r=function($){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty($,Symbol.toStringTag,{value:"Module"}),Object.defineProperty($,"__esModule",{value:!0})},k.t=function($,F){if(F&1&&($=k($)),F&8)return $;if(F&4&&typeof $=="object"&&$&&$.__esModule)return $;var B=Object.create(null);if(k.r(B),Object.defineProperty(B,"default",{enumerable:!0,value:$}),F&2&&typeof $!="string")for(var G in $)k.d(B,G,function(H){return $[H]}.bind(null,G));return B},k.n=function($){var F=$&&$.__esModule?function(){return $.default}:function(){return $};return k.d(F,"a",F),F},k.o=function($,F){return Object.prototype.hasOwnProperty.call($,F)},k.p="/dist/",k(k.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(oe,J,k){"use strict";var $=Object.prototype.hasOwnProperty,F="~";function B(){}Object.create&&(B.prototype=Object.create(null),new B().__proto__||(F=!1));function G(g,p,f){this.fn=g,this.context=p,this.once=f||!1}function H(g,p,f,h,o){if(typeof f!="function")throw new TypeError("The listener must be a function");var d=new G(f,h||g,o),s=F?F+p:p;return g._events[s]?g._events[s].fn?g._events[s]=[g._events[s],d]:g._events[s].push(d):(g._events[s]=d,g._eventsCount++),g}function D(g,p){--g._eventsCount===0?g._events=new B:delete g._events[p]}function I(){this._events=new B,this._eventsCount=0}I.prototype.eventNames=function(){var p=[],f,h;if(this._eventsCount===0)return p;for(h in f=this._events)$.call(f,h)&&p.push(F?h.slice(1):h);return Object.getOwnPropertySymbols?p.concat(Object.getOwnPropertySymbols(f)):p},I.prototype.listeners=function(p){var f=F?F+p:p,h=this._events[f];if(!h)return[];if(h.fn)return[h.fn];for(var o=0,d=h.length,s=new Array(d);o<d;o++)s[o]=h[o].fn;return s},I.prototype.listenerCount=function(p){var f=F?F+p:p,h=this._events[f];return h?h.fn?1:h.length:0},I.prototype.emit=function(p,f,h,o,d,s){var a=F?F+p:p;if(!this._events[a])return!1;var l=this._events[a],c=arguments.length,R,w;if(l.fn){l.once&&this.removeListener(p,l.fn,void 0,!0);switch(c){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,f),!0;case 3:return l.fn.call(l.context,f,h),!0;case 4:return l.fn.call(l.context,f,h,o),!0;case 5:return l.fn.call(l.context,f,h,o,d),!0;case 6:return l.fn.call(l.context,f,h,o,d,s),!0}for(w=1,R=new Array(c-1);w<c;w++)R[w-1]=arguments[w];l.fn.apply(l.context,R)}else{var x=l.length,O;for(w=0;w<x;w++){l[w].once&&this.removeListener(p,l[w].fn,void 0,!0);switch(c){case 1:l[w].fn.call(l[w].context);break;case 2:l[w].fn.call(l[w].context,f);break;case 3:l[w].fn.call(l[w].context,f,h);break;case 4:l[w].fn.call(l[w].context,f,h,o);break;default:if(!R)for(O=1,R=new Array(c-1);O<c;O++)R[O-1]=arguments[O];l[w].fn.apply(l[w].context,R)}}}return!0},I.prototype.on=function(p,f,h){return H(this,p,f,h,!1)},I.prototype.once=function(p,f,h){return H(this,p,f,h,!0)},I.prototype.removeListener=function(p,f,h,o){var d=F?F+p:p;if(!this._events[d])return this;if(!f)return D(this,d),this;var s=this._events[d];if(s.fn)s.fn===f&&(!o||s.once)&&(!h||s.context===h)&&D(this,d);else{for(var a=0,l=[],c=s.length;a<c;a++)(s[a].fn!==f||o&&!s[a].once||h&&s[a].context!==h)&&l.push(s[a]);l.length?this._events[d]=l.length===1?l[0]:l:D(this,d)}return this},I.prototype.removeAllListeners=function(p){var f;return p?(f=F?F+p:p,this._events[f]&&D(this,f)):(this._events=new B,this._eventsCount=0),this},I.prototype.off=I.prototype.removeListener,I.prototype.addListener=I.prototype.on,I.prefixed=F,I.EventEmitter=I,oe.exports=I},"./node_modules/url-toolkit/src/url-toolkit.js":function(oe,J,k){(function($){var F=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,B=/^([^\/?#]*)([^]*)$/,G=/(?:\/|^)\.(?=\/)/g,H=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,D={buildAbsoluteURL:function(I,g,p){if(p=p||{},I=I.trim(),g=g.trim(),!g){if(!p.alwaysNormalize)return I;var f=D.parseURL(I);if(!f)throw new Error("Error trying to parse base URL.");return f.path=D.normalizePath(f.path),D.buildURLFromParts(f)}var h=D.parseURL(g);if(!h)throw new Error("Error trying to parse relative URL.");if(h.scheme)return p.alwaysNormalize?(h.path=D.normalizePath(h.path),D.buildURLFromParts(h)):g;var o=D.parseURL(I);if(!o)throw new Error("Error trying to parse base URL.");if(!o.netLoc&&o.path&&o.path[0]!=="/"){var d=B.exec(o.path);o.netLoc=d[1],o.path=d[2]}o.netLoc&&!o.path&&(o.path="/");var s={scheme:o.scheme,netLoc:h.netLoc,path:null,params:h.params,query:h.query,fragment:h.fragment};if(!h.netLoc&&(s.netLoc=o.netLoc,h.path[0]!=="/"))if(!h.path)s.path=o.path,h.params||(s.params=o.params,h.query||(s.query=o.query));else{var a=o.path,l=a.substring(0,a.lastIndexOf("/")+1)+h.path;s.path=D.normalizePath(l)}return s.path===null&&(s.path=p.alwaysNormalize?D.normalizePath(h.path):h.path),D.buildURLFromParts(s)},parseURL:function(I){var g=F.exec(I);return g?{scheme:g[1]||"",netLoc:g[2]||"",path:g[3]||"",params:g[4]||"",query:g[5]||"",fragment:g[6]||""}:null},normalizePath:function(I){for(I=I.split("").reverse().join("").replace(G,"");I.length!==(I=I.replace(H,"")).length;);return I.split("").reverse().join("")},buildURLFromParts:function(I){return I.scheme+I.netLoc+I.path+I.params+I.query+I.fragment}};oe.exports=D})(this)},"./node_modules/webworkify-webpack/index.js":function(oe,J,k){function $(p){var f={};function h(d){if(f[d])return f[d].exports;var s=f[d]={i:d,l:!1,exports:{}};return p[d].call(s.exports,s,s.exports,h),s.l=!0,s.exports}h.m=p,h.c=f,h.i=function(d){return d},h.d=function(d,s,a){h.o(d,s)||Object.defineProperty(d,s,{configurable:!1,enumerable:!0,get:a})},h.r=function(d){Object.defineProperty(d,"__esModule",{value:!0})},h.n=function(d){var s=d&&d.__esModule?function(){return d.default}:function(){return d};return h.d(s,"a",s),s},h.o=function(d,s){return Object.prototype.hasOwnProperty.call(d,s)},h.p="/",h.oe=function(d){throw console.error(d),d};var o=h(h.s=ENTRY_MODULE);return o.default||o}var F="[\\.|\\-|\\+|\\w|/|@]+",B="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+F+").*?\\)";function G(p){return(p+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function H(p){return!isNaN(1*p)}function D(p,f,h){var o={};o[h]=[];var d=f.toString(),s=d.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!s)return o;for(var a=s[1],l=new RegExp("(\\\\n|\\W)"+G(a)+B,"g"),c;c=l.exec(d);){if(c[3]==="dll-reference")continue;o[h].push(c[3])}for(l=new RegExp("\\("+G(a)+'\\("(dll-reference\\s('+F+'))"\\)\\)'+B,"g");c=l.exec(d);)p[c[2]]||(o[h].push(c[1]),p[c[2]]=k(c[1]).m),o[c[2]]=o[c[2]]||[],o[c[2]].push(c[4]);for(var R=Object.keys(o),w=0;w<R.length;w++)for(var x=0;x<o[R[w]].length;x++)H(o[R[w]][x])&&(o[R[w]][x]=1*o[R[w]][x]);return o}function I(p){var f=Object.keys(p);return f.reduce(function(h,o){return h||p[o].length>0},!1)}function g(p,f){for(var h={main:[f]},o={main:[]},d={main:{}};I(h);)for(var s=Object.keys(h),a=0;a<s.length;a++){var l=s[a],c=h[l],R=c.pop();if(d[l]=d[l]||{},d[l][R]||!p[l][R])continue;d[l][R]=!0,o[l]=o[l]||[],o[l].push(R);for(var w=D(p,p[l][R],l),x=Object.keys(w),O=0;O<x.length;O++)h[x[O]]=h[x[O]]||[],h[x[O]]=h[x[O]].concat(w[x[O]])}return o}oe.exports=function(p,f){f=f||{};var h={main:k.m},o=f.all?{main:Object.keys(h.main)}:g(h,p),d="";Object.keys(o).filter(function(R){return R!=="main"}).forEach(function(R){for(var w=0;o[R][w];)w++;o[R].push(w),h[R][w]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",d=d+"var "+R+" = ("+$.toString().replace("ENTRY_MODULE",JSON.stringify(w))+")({"+o[R].map(function(x){return""+JSON.stringify(x)+": "+h[R][x].toString()}).join(",")+`});
`}),d=d+"new (("+$.toString().replace("ENTRY_MODULE",JSON.stringify(p))+")({"+o.main.map(function(R){return""+JSON.stringify(R)+": "+h.main[R].toString()}).join(",")+"}))(self);";var s=new window.Blob([d],{type:"text/javascript"});if(f.bare)return s;var a=window.URL||window.webkitURL||window.mozURL||window.msURL,l=a.createObjectURL(s),c=new window.Worker(l);return c.objectURL=l,c}},"./src/config.ts":function(oe,J,k){"use strict";k.r(J),k.d(J,"hlsDefaultConfig",function(){return O}),k.d(J,"mergeConfig",function(){return T}),k.d(J,"enableStreamingMode",function(){return E});var $=k("./src/controller/abr-controller.ts"),F=k("./src/controller/audio-stream-controller.ts"),B=k("./src/controller/audio-track-controller.ts"),G=k("./src/controller/subtitle-stream-controller.ts"),H=k("./src/controller/subtitle-track-controller.ts"),D=k("./src/controller/buffer-controller.ts"),I=k("./src/controller/timeline-controller.ts"),g=k("./src/controller/cap-level-controller.ts"),p=k("./src/controller/fps-controller.ts"),f=k("./src/controller/eme-controller.ts"),h=k("./src/controller/cmcd-controller.ts"),o=k("./src/utils/xhr-loader.ts"),d=k("./src/utils/fetch-loader.ts"),s=k("./src/utils/cues.ts"),a=k("./src/utils/mediakeys-helper.ts"),l=k("./src/utils/logger.ts");function c(){return c=Object.assign||function(b){for(var u=1;u<arguments.length;u++){var _=arguments[u];for(var m in _)Object.prototype.hasOwnProperty.call(_,m)&&(b[m]=_[m])}return b},c.apply(this,arguments)}function R(b,u){var _=Object.keys(b);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(b);u&&(m=m.filter(function(v){return Object.getOwnPropertyDescriptor(b,v).enumerable})),_.push.apply(_,m)}return _}function w(b){for(var u=1;u<arguments.length;u++){var _=arguments[u]!=null?arguments[u]:{};u%2?R(Object(_),!0).forEach(function(m){x(b,m,_[m])}):Object.getOwnPropertyDescriptors?Object.defineProperties(b,Object.getOwnPropertyDescriptors(_)):R(Object(_)).forEach(function(m){Object.defineProperty(b,m,Object.getOwnPropertyDescriptor(_,m))})}return b}function x(b,u,_){return u in b?Object.defineProperty(b,u,{value:_,enumerable:!0,configurable:!0,writable:!0}):b[u]=_,b}var O=w(w({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:Infinity,maxBufferSize:60*1e3*1e3,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:Infinity,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:o.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:$.default,bufferController:D.default,capLevelController:g.default,fpsController:p.default,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystemOptions:{},requestMediaKeySystemAccessFunc:a.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},A()),{},{subtitleStreamController:G.SubtitleStreamController,subtitleTrackController:H.default,timelineController:I.TimelineController,audioStreamController:F.default,audioTrackController:B.default,emeController:f.default,cmcdController:h.default});function A(){return{cueHandler:s.default,enableCEA708Captions:!0,enableWebVTT:!0,enableIMSC1:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function T(b,u){if((u.liveSyncDurationCount||u.liveMaxLatencyDurationCount)&&(u.liveSyncDuration||u.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(u.liveMaxLatencyDurationCount!==void 0&&(u.liveSyncDurationCount===void 0||u.liveMaxLatencyDurationCount<=u.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(u.liveMaxLatencyDuration!==void 0&&(u.liveSyncDuration===void 0||u.liveMaxLatencyDuration<=u.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return c({},b,u)}function E(b){var u=b.loader;if(u!==d.default&&u!==o.default)l.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),b.progressive=!1;else{var _=Object(d.fetchSupported)();_&&(b.loader=d.default,b.progressive=!0,b.enableSoftwareAES=!0,l.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(oe,J,k){"use strict";k.r(J);var $=k("./src/polyfills/number.ts"),F=k("./src/utils/ewma-bandwidth-estimator.ts"),B=k("./src/events.ts"),G=k("./src/utils/buffer-helper.ts"),H=k("./src/errors.ts"),D=k("./src/types/loader.ts"),I=k("./src/utils/logger.ts");function g(h,o){for(var d=0;d<o.length;d++){var s=o[d];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(h,s.key,s)}}function p(h,o,d){return o&&g(h.prototype,o),d&&g(h,d),h}var f=function(){function h(d){this.hls=void 0,this.lastLoadedFragLevel=0,this._nextAutoLevel=-1,this.timer=void 0,this.onCheck=this._abandonRulesCheck.bind(this),this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this.hls=d;var s=d.config;this.bwEstimator=new F.default(s.abrEwmaSlowVoD,s.abrEwmaFastVoD,s.abrEwmaDefaultEstimate),this.registerListeners()}var o=h.prototype;return o.registerListeners=function(){var s=this.hls;s.on(B.Events.FRAG_LOADING,this.onFragLoading,this),s.on(B.Events.FRAG_LOADED,this.onFragLoaded,this),s.on(B.Events.FRAG_BUFFERED,this.onFragBuffered,this),s.on(B.Events.LEVEL_LOADED,this.onLevelLoaded,this),s.on(B.Events.ERROR,this.onError,this)},o.unregisterListeners=function(){var s=this.hls;s.off(B.Events.FRAG_LOADING,this.onFragLoading,this),s.off(B.Events.FRAG_LOADED,this.onFragLoaded,this),s.off(B.Events.FRAG_BUFFERED,this.onFragBuffered,this),s.off(B.Events.LEVEL_LOADED,this.onLevelLoaded,this),s.off(B.Events.ERROR,this.onError,this)},o.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},o.onFragLoading=function(s,a){var l=a.frag;if(l.type===D.PlaylistLevelType.MAIN&&!this.timer){var c;this.fragCurrent=l,this.partCurrent=(c=a.part)!=null?c:null,this.timer=self.setInterval(this.onCheck,100)}},o.onLevelLoaded=function(s,a){var l=this.hls.config;a.details.live?this.bwEstimator.update(l.abrEwmaSlowLive,l.abrEwmaFastLive):this.bwEstimator.update(l.abrEwmaSlowVoD,l.abrEwmaFastVoD)},o._abandonRulesCheck=function(){var s=this.fragCurrent,a=this.partCurrent,l=this.hls,c=l.autoLevelEnabled,R=l.config,w=l.media;if(!s||!w)return;var x=a?a.stats:s.stats,O=a?a.duration:s.duration;if(x.aborted){I.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!c||w.paused||!w.playbackRate||!w.readyState)return;var A=performance.now()-x.loading.start,T=Math.abs(w.playbackRate);if(A<=500*O/T)return;var E=l.levels,b=l.minAutoLevel,u=E[s.level],_=x.total||Math.max(x.loaded,Math.round(O*u.maxBitrate/8)),m=Math.max(1,x.bwEstimate?x.bwEstimate/8:x.loaded*1e3/A),v=(_-x.loaded)/m,M=w.currentTime,P=(G.BufferHelper.bufferInfo(w,M,R.maxBufferHole).end-M)/T;if(P>=2*O/T||v<=P)return;var K=Number.POSITIVE_INFINITY,V;for(V=s.level-1;V>b;V--){var U=E[V].maxBitrate;if(K=O*U/(8*.8*m),K<P)break}if(K>=v)return;var S=this.bwEstimator.getEstimate();I.logger.warn("Fragment "+s.sn+(a?" part "+a.index:"")+" of level "+s.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+V+`
Current BW estimate: `+(Object($.isFiniteNumber)(S)?(S/1024).toFixed(3):"Unknown")+` Kb/s
Estimated load time for current fragment: `+v.toFixed(3)+` s
Estimated load time for the next fragment: `+K.toFixed(3)+` s
Time to underbuffer: `+P.toFixed(3)+" s"),l.nextLoadLevel=V,this.bwEstimator.sample(A,x.loaded),this.clearTimer(),s.loader&&(this.fragCurrent=this.partCurrent=null,s.loader.abort()),l.trigger(B.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:s,part:a,stats:x})},o.onFragLoaded=function(s,a){var l=a.frag,c=a.part;if(l.type===D.PlaylistLevelType.MAIN&&Object($.isFiniteNumber)(l.sn)){var R=c?c.stats:l.stats,w=c?c.duration:l.duration;if(this.clearTimer(),this.lastLoadedFragLevel=l.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var x=this.hls.levels[l.level],O=(x.loaded?x.loaded.bytes:0)+R.loaded,A=(x.loaded?x.loaded.duration:0)+w;x.loaded={bytes:O,duration:A},x.realBitrate=Math.round(8*O/A)}if(l.bitrateTest){var T={stats:R,frag:l,part:c,id:l.type};this.onFragBuffered(B.Events.FRAG_BUFFERED,T),l.bitrateTest=!1}}},o.onFragBuffered=function(s,a){var l=a.frag,c=a.part,R=c?c.stats:l.stats;if(R.aborted)return;if(l.type!==D.PlaylistLevelType.MAIN||l.sn==="initSegment")return;var w=R.parsing.end-R.loading.start;this.bwEstimator.sample(w,R.loaded),R.bwEstimate=this.bwEstimator.getEstimate(),l.bitrateTest?this.bitrateTestDelay=w/1e3:this.bitrateTestDelay=0},o.onError=function(s,a){switch(a.details){case H.ErrorDetails.FRAG_LOAD_ERROR:case H.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},o.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},o.getNextABRAutoLevel=function(){var s=this.fragCurrent,a=this.partCurrent,l=this.hls,c=l.maxAutoLevel,R=l.config,w=l.minAutoLevel,x=l.media,O=a?a.duration:s?s.duration:0,A=x?x.currentTime:0,T=x&&x.playbackRate!==0?Math.abs(x.playbackRate):1,E=this.bwEstimator?this.bwEstimator.getEstimate():R.abrEwmaDefaultEstimate,b=(G.BufferHelper.bufferInfo(x,A,R.maxBufferHole).end-A)/T,u=this.findBestLevel(E,w,c,b,R.abrBandWidthFactor,R.abrBandWidthUpFactor);if(u>=0)return u;I.logger.trace((b?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var _=O?Math.min(O,R.maxStarvationDelay):R.maxStarvationDelay,m=R.abrBandWidthFactor,v=R.abrBandWidthUpFactor;if(!b){var M=this.bitrateTestDelay;if(M){var P=O?Math.min(O,R.maxLoadingDelay):R.maxLoadingDelay;_=P-M,I.logger.trace("bitrate test took "+Math.round(1e3*M)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*_)+" ms"),m=v=1}}return u=this.findBestLevel(E,w,c,b+_,m,v),Math.max(u,0)},o.findBestLevel=function(s,a,l,c,R,w){for(var x,O=this.fragCurrent,A=this.partCurrent,T=this.lastLoadedFragLevel,E=this.hls.levels,b=E[T],u=!!(b!=null&&(x=b.details)!==null&&x!==void 0&&x.live),_=b==null?void 0:b.codecSet,m=A?A.duration:O?O.duration:0,v=l;v>=a;v--){var M=E[v];if(!M||_&&M.codecSet!==_)continue;var P=M.details,K=(A?P==null?void 0:P.partTarget:P==null?void 0:P.averagetargetduration)||m,V=void 0;v<=T?V=R*s:V=w*s;var U=E[v].maxBitrate,S=U*K/V;if(I.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+v+"/"+Math.round(V)+"/"+U+"/"+K+"/"+c+"/"+S),V>U&&(!S||u&&!this.bitrateTestDelay||S<c))return v}return-1},p(h,[{key:"nextAutoLevel",get:function(){var s=this._nextAutoLevel,a=this.bwEstimator;if(s!==-1&&(!a||!a.canEstimate()))return s;var l=this.getNextABRAutoLevel();return s!==-1&&(l=Math.min(s,l)),l},set:function(s){this._nextAutoLevel=s}}]),h}();J.default=f},"./src/controller/audio-stream-controller.ts":function(oe,J,k){"use strict";k.r(J);var $=k("./src/polyfills/number.ts"),F=k("./src/controller/base-stream-controller.ts"),B=k("./src/events.ts"),G=k("./src/utils/buffer-helper.ts"),H=k("./src/controller/fragment-tracker.ts"),D=k("./src/types/level.ts"),I=k("./src/types/loader.ts"),g=k("./src/loader/fragment.ts"),p=k("./src/demux/chunk-cache.ts"),f=k("./src/demux/transmuxer-interface.ts"),h=k("./src/types/transmuxer.ts"),o=k("./src/controller/fragment-finders.ts"),d=k("./src/utils/discontinuities.ts"),s=k("./src/errors.ts"),a=k("./src/utils/logger.ts");function l(){return l=Object.assign||function(O){for(var A=1;A<arguments.length;A++){var T=arguments[A];for(var E in T)Object.prototype.hasOwnProperty.call(T,E)&&(O[E]=T[E])}return O},l.apply(this,arguments)}function c(O,A){O.prototype=Object.create(A.prototype),O.prototype.constructor=O,R(O,A)}function R(O,A){return R=Object.setPrototypeOf||function(E,b){return E.__proto__=b,E},R(O,A)}var w=100,x=function(O){c(A,O);function A(E,b){var u;return u=O.call(this,E,b,"[audio-stream-controller]")||this,u.videoBuffer=null,u.videoTrackCC=-1,u.waitingVideoCC=-1,u.audioSwitch=!1,u.trackId=-1,u.waitingData=null,u.mainDetails=null,u.bufferFlushed=!1,u._registerListeners(),u}var T=A.prototype;return T.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},T._registerListeners=function(){var b=this.hls;b.on(B.Events.MEDIA_ATTACHED,this.onMediaAttached,this),b.on(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),b.on(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),b.on(B.Events.LEVEL_LOADED,this.onLevelLoaded,this),b.on(B.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),b.on(B.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),b.on(B.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),b.on(B.Events.ERROR,this.onError,this),b.on(B.Events.BUFFER_RESET,this.onBufferReset,this),b.on(B.Events.BUFFER_CREATED,this.onBufferCreated,this),b.on(B.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),b.on(B.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),b.on(B.Events.FRAG_BUFFERED,this.onFragBuffered,this)},T._unregisterListeners=function(){var b=this.hls;b.off(B.Events.MEDIA_ATTACHED,this.onMediaAttached,this),b.off(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),b.off(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),b.off(B.Events.LEVEL_LOADED,this.onLevelLoaded,this),b.off(B.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),b.off(B.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),b.off(B.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),b.off(B.Events.ERROR,this.onError,this),b.off(B.Events.BUFFER_RESET,this.onBufferReset,this),b.off(B.Events.BUFFER_CREATED,this.onBufferCreated,this),b.off(B.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),b.off(B.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),b.off(B.Events.FRAG_BUFFERED,this.onFragBuffered,this)},T.onInitPtsFound=function(b,u){var _=u.frag,m=u.id,v=u.initPTS;if(m==="main"){var M=_.cc;this.initPTS[_.cc]=v,this.log("InitPTS for cc: "+M+" found from main: "+v),this.videoTrackCC=M,this.state===F.State.WAITING_INIT_PTS&&this.tick()}},T.startLoad=function(b){if(!this.levels){this.startPosition=b,this.state=F.State.STOPPED;return}var u=this.lastCurrentTime;this.stopLoad(),this.setInterval(w),this.fragLoadError=0,u>0&&b===-1?(this.log("Override startPosition with lastCurrentTime @"+u.toFixed(3)),this.state=F.State.IDLE):(this.loadedmetadata=!1,this.state=F.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=b,this.tick()},T.doTick=function(){switch(this.state){case F.State.IDLE:this.doTickIdle();break;case F.State.WAITING_TRACK:{var b,u=this.levels,_=this.trackId,m=u==null||((b=u[_])===null||b===void 0)?void 0:b.details;if(m){if(this.waitForCdnTuneIn(m))break;this.state=F.State.WAITING_INIT_PTS}break}case F.State.FRAG_LOADING_WAITING_RETRY:{var v,M=performance.now(),P=this.retryDate;(!P||M>=P||(v=this.media)!==null&&v!==void 0&&v.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=F.State.IDLE);break}case F.State.WAITING_INIT_PTS:{var K=this.waitingData;if(K){var V=K.frag,U=K.part,S=K.cache,X=K.complete;if(this.initPTS[V.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=F.State.FRAG_LOADING;var ee=S.flush(),ae={frag:V,part:U,payload:ee,networkDetails:null};this._handleFragmentLoadProgress(ae),X&&O.prototype._handleFragmentLoadComplete.call(this,ae)}else if(this.videoTrackCC!==this.waitingVideoCC)a.logger.log("Waiting fragment cc ("+V.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var de=this.getLoadPosition(),Ae=G.BufferHelper.bufferInfo(this.mediaBuffer,de,this.config.maxBufferHole),Ee=Object(o.fragmentWithinToleranceTest)(Ae.end,this.config.maxFragLookUpTolerance,V);Ee<0&&(a.logger.log("Waiting fragment cc ("+V.cc+") @ "+V.start+" cancelled because another fragment at "+Ae.end+" is needed"),this.clearWaitingFragment())}}else this.state=F.State.IDLE}}this.onTickEnd()},T.clearWaitingFragment=function(){var b=this.waitingData;b&&(this.fragmentTracker.removeFragment(b.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=F.State.IDLE)},T.onTickEnd=function(){var b=this.media;if(!b||!b.readyState)return;var u=this.mediaBuffer?this.mediaBuffer:b,_=u.buffered;!this.loadedmetadata&&_.length&&(this.loadedmetadata=!0),this.lastCurrentTime=b.currentTime},T.doTickIdle=function(){var b,u,_=this.hls,m=this.levels,v=this.media,M=this.trackId,P=_.config;if(!m||!m[M])return;if(!v&&(this.startFragRequested||!P.startFragPrefetch))return;var K=m[M],V=K.details;if(!V||V.live&&this.levelLastLoaded!==M||this.waitForCdnTuneIn(V)){this.state=F.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,g.ElementaryStreamTypes.AUDIO,I.PlaylistLevelType.AUDIO));var U=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,I.PlaylistLevelType.AUDIO);if(U===null)return;var S=U.len,X=this.getMaxBufferLength(),ee=this.audioSwitch;if(S>=X&&!ee)return;if(!ee&&this._streamEnded(U,V)){_.trigger(B.Events.BUFFER_EOS,{type:"audio"}),this.state=F.State.ENDED;return}var ae=V.fragments,de=ae[0].start,Ae=U.end;if(ee){var Ee=this.getLoadPosition();Ae=Ee,V.PTSKnown&&Ee<de&&((U.end>de||U.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),v.currentTime=de+.05))}var we=this.getNextFragment(Ae,V);if(!we){this.bufferFlushed=!0;return}((b=we.decryptdata)===null||b===void 0?void 0:b.keyFormat)==="identity"&&!((u=we.decryptdata)!==null&&u!==void 0&&u.key)?this.loadKey(we,V):this.loadFragment(we,V,Ae)},T.getMaxBufferLength=function(){var b=O.prototype.getMaxBufferLength.call(this),u=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,I.PlaylistLevelType.MAIN);return u===null?b:Math.max(b,u.len)},T.onMediaDetaching=function(){this.videoBuffer=null,O.prototype.onMediaDetaching.call(this)},T.onAudioTracksUpdated=function(b,u){var _=u.audioTracks;this.resetTransmuxer(),this.levels=_.map(function(m){return new D.Level(m)})},T.onAudioTrackSwitching=function(b,u){var _=!!u.url;this.trackId=u.id;var m=this.fragCurrent;m!=null&&m.loader&&m.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),_?this.setInterval(w):this.resetTransmuxer(),_?(this.audioSwitch=!0,this.state=F.State.IDLE):this.state=F.State.STOPPED,this.tick()},T.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},T.onLevelLoaded=function(b,u){this.mainDetails=u.details},T.onAudioTrackLoaded=function(b,u){var _,m=this.levels,v=u.details,M=u.id;if(!m){this.warn("Audio tracks were reset while loading level "+M);return}this.log("Track "+M+" loaded ["+v.startSN+","+v.endSN+"],duration:"+v.totalduration);var P=m[M],K=0;if(v.live||(_=P.details)!==null&&_!==void 0&&_.live){var V=this.mainDetails;if(v.fragments[0]||(v.deltaUpdateFailed=!0),v.deltaUpdateFailed||!V)return;!P.details&&v.hasProgramDateTime&&V.hasProgramDateTime?(Object(d.alignMediaPlaylistByPDT)(v,V),K=v.fragments[0].start):K=this.alignPlaylists(v,P.details)}P.details=v,this.levelLastLoaded=M,!this.startFragRequested&&(this.mainDetails||!v.live)&&this.setStartPosition(P.details,K),this.state===F.State.WAITING_TRACK&&!this.waitForCdnTuneIn(v)&&(this.state=F.State.IDLE),this.tick()},T._handleFragmentLoadProgress=function(b){var u,_=b.frag,m=b.part,v=b.payload,M=this.config,P=this.trackId,K=this.levels;if(!K){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+_.sn+" of level "+_.level+" will not be buffered");return}var V=K[P];console.assert(V,"Audio track is defined on fragment load progress");var U=V.details;console.assert(U,"Audio track details are defined on fragment load progress");var S=M.defaultAudioCodec||V.audioCodec||"mp4a.40.2",X=this.transmuxer;X||(X=this.transmuxer=new f.default(this.hls,I.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var ee=this.initPTS[_.cc],ae=(u=_.initSegment)===null||u===void 0?void 0:u.data;if(ee!==void 0){var de=!1,Ae=m?m.index:-1,Ee=Ae!==-1,we=new h.ChunkMetadata(_.level,_.sn,_.stats.chunkCount,v.byteLength,Ae,Ee);X.push(v,ae,S,"",_,m,U.totalduration,de,we,ee)}else{a.logger.log("Unknown video PTS for cc "+_.cc+", waiting for video PTS before demuxing audio frag "+_.sn+" of ["+U.startSN+" ,"+U.endSN+"],track "+P);var he=this.waitingData=this.waitingData||{frag:_,part:m,cache:new p.default,complete:!1},ce=he.cache;ce.push(new Uint8Array(v)),this.waitingVideoCC=this.videoTrackCC,this.state=F.State.WAITING_INIT_PTS}},T._handleFragmentLoadComplete=function(b){if(this.waitingData){this.waitingData.complete=!0;return}O.prototype._handleFragmentLoadComplete.call(this,b)},T.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},T.onBufferCreated=function(b,u){var _=u.tracks.audio;_&&(this.mediaBuffer=_.buffer),u.tracks.video&&(this.videoBuffer=u.tracks.video.buffer)},T.onFragBuffered=function(b,u){var _=u.frag,m=u.part;if(_.type!==I.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(_)){this.warn("Fragment "+_.sn+(m?" p: "+m.index:"")+" of level "+_.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}_.sn!=="initSegment"&&(this.fragPrevious=_,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(B.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(_,m)},T.onError=function(b,u){switch(u.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(I.PlaylistLevelType.AUDIO,u);break;case s.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case s.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==F.State.ERROR&&this.state!==F.State.STOPPED&&(this.state=u.fatal?F.State.ERROR:F.State.IDLE,this.warn(u.details+" while loading frag, switching to "+this.state+" state"));break;case s.ErrorDetails.BUFFER_FULL_ERROR:if(u.parent==="audio"&&(this.state===F.State.PARSING||this.state===F.State.PARSED)){var _=!0,m=this.getFwdBufferInfo(this.mediaBuffer,I.PlaylistLevelType.AUDIO);m&&m.len>.5&&(_=!this.reduceMaxBufferLength(m.len)),_&&(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}},T.onBufferFlushed=function(b,u){var _=u.type;_===g.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},T._handleTransmuxComplete=function(b){var u,_="audio",m=this.hls,v=b.remuxResult,M=b.chunkMeta,P=this.getCurrentContext(M);if(!P){this.warn("The loading context changed while buffering fragment "+M.sn+" of level "+M.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(M.level);return}var K=P.frag,V=P.part,U=v.audio,S=v.text,X=v.id3,ee=v.initSegment;if(this.fragContextChanged(K))return;if(this.state=F.State.PARSING,this.audioSwitch&&U&&this.completeAudioSwitch(),ee!=null&&ee.tracks&&(this._bufferInitSegment(ee.tracks,K,M),m.trigger(B.Events.FRAG_PARSING_INIT_SEGMENT,{frag:K,id:_,tracks:ee.tracks})),U){var ae=U.startPTS,de=U.endPTS,Ae=U.startDTS,Ee=U.endDTS;V&&(V.elementaryStreams[g.ElementaryStreamTypes.AUDIO]={startPTS:ae,endPTS:de,startDTS:Ae,endDTS:Ee}),K.setElementaryStreamInfo(g.ElementaryStreamTypes.AUDIO,ae,de,Ae,Ee),this.bufferFragmentData(U,K,V,M)}if(X!=null&&(u=X.samples)!==null&&u!==void 0&&u.length){var we=l({frag:K,id:_},X);m.trigger(B.Events.FRAG_PARSING_METADATA,we)}if(S){var he=l({frag:K,id:_},S);m.trigger(B.Events.FRAG_PARSING_USERDATA,he)}},T._bufferInitSegment=function(b,u,_){if(this.state!==F.State.PARSING)return;b.video&&delete b.video;var m=b.audio;if(!m)return;m.levelCodec=m.codec,m.id="audio",this.log("Init audio buffer, container:"+m.container+", codecs[parsed]=["+m.codec+"]"),this.hls.trigger(B.Events.BUFFER_CODECS,b);var v=m.initSegment;if(v!=null&&v.byteLength){var M={type:"audio",frag:u,part:null,chunkMeta:_,parent:u.type,data:v};this.hls.trigger(B.Events.BUFFER_APPENDING,M)}this.tick()},T.loadFragment=function(b,u,_){var m=this.fragmentTracker.getState(b);this.fragCurrent=b,(this.audioSwitch||m===H.FragmentState.NOT_LOADED||m===H.FragmentState.PARTIAL)&&(b.sn==="initSegment"?this._loadInitSegment(b):u.live&&!Object($.isFiniteNumber)(this.initPTS[b.cc])?(this.log("Waiting for video PTS in continuity counter "+b.cc+" of live stream before loading audio fragment "+b.sn+" of level "+this.trackId),this.state=F.State.WAITING_INIT_PTS):(this.startFragRequested=!0,O.prototype.loadFragment.call(this,b,u,_)))},T.completeAudioSwitch=function(){var b=this.hls,u=this.media,_=this.trackId;u&&(this.log("Switching audio track : flushing all audio"),O.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,b.trigger(B.Events.AUDIO_TRACK_SWITCHED,{id:_})},A}(F.default);J.default=x},"./src/controller/audio-track-controller.ts":function(oe,J,k){"use strict";k.r(J);var $=k("./src/events.ts"),F=k("./src/errors.ts"),B=k("./src/controller/base-playlist-controller.ts"),G=k("./src/types/loader.ts");function H(f,h){for(var o=0;o<h.length;o++){var d=h[o];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(f,d.key,d)}}function D(f,h,o){return h&&H(f.prototype,h),o&&H(f,o),f}function I(f,h){f.prototype=Object.create(h.prototype),f.prototype.constructor=f,g(f,h)}function g(f,h){return g=Object.setPrototypeOf||function(d,s){return d.__proto__=s,d},g(f,h)}var p=function(f){I(h,f);function h(d){var s;return s=f.call(this,d,"[audio-track-controller]")||this,s.tracks=[],s.groupId=null,s.tracksInGroup=[],s.trackId=-1,s.trackName="",s.selectDefaultTrack=!0,s.registerListeners(),s}var o=h.prototype;return o.registerListeners=function(){var s=this.hls;s.on($.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.on($.Events.MANIFEST_PARSED,this.onManifestParsed,this),s.on($.Events.LEVEL_LOADING,this.onLevelLoading,this),s.on($.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),s.on($.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),s.on($.Events.ERROR,this.onError,this)},o.unregisterListeners=function(){var s=this.hls;s.off($.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.off($.Events.MANIFEST_PARSED,this.onManifestParsed,this),s.off($.Events.LEVEL_LOADING,this.onLevelLoading,this),s.off($.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),s.off($.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),s.off($.Events.ERROR,this.onError,this)},o.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,f.prototype.destroy.call(this)},o.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},o.onManifestParsed=function(s,a){this.tracks=a.audioTracks||[]},o.onAudioTrackLoaded=function(s,a){var l=a.id,c=a.details,R=this.tracksInGroup[l];if(!R){this.warn("Invalid audio track id "+l);return}var w=R.details;R.details=a.details,this.log("audioTrack "+l+" loaded ["+c.startSN+"-"+c.endSN+"]"),l===this.trackId&&(this.retryCount=0,this.playlistLoaded(l,a,w))},o.onLevelLoading=function(s,a){this.switchLevel(a.level)},o.onLevelSwitching=function(s,a){this.switchLevel(a.level)},o.switchLevel=function(s){var a=this.hls.levels[s];if(!(a!=null&&a.audioGroupIds))return;var l=a.audioGroupIds[a.urlId];if(this.groupId!==l){this.groupId=l;var c=this.tracks.filter(function(w){return!l||w.groupId===l});this.selectDefaultTrack&&!c.some(function(w){return w.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=c;var R={audioTracks:c};this.log("Updating audio tracks, "+c.length+' track(s) found in "'+l+'" group-id'),this.hls.trigger($.Events.AUDIO_TRACKS_UPDATED,R),this.selectInitialTrack()}},o.onError=function(s,a){if(f.prototype.onError.call(this,s,a),a.fatal||!a.context)return;a.context.type===G.PlaylistContextType.AUDIO_TRACK&&a.context.id===this.trackId&&a.context.groupId===this.groupId&&this.retryLoadingOrFail(a)},o.setAudioTrack=function(s){var a=this.tracksInGroup;if(s<0||s>=a.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var l=a[this.trackId];this.log("Now switching to audio-track index "+s);var c=a[s],R=c.id,w=c.groupId,x=w===void 0?"":w,O=c.name,A=c.type,T=c.url;if(this.trackId=s,this.trackName=O,this.selectDefaultTrack=!1,this.hls.trigger($.Events.AUDIO_TRACK_SWITCHING,{id:R,groupId:x,name:O,type:A,url:T}),c.details&&!c.details.live)return;var E=this.switchParams(c.url,l==null?void 0:l.details);this.loadPlaylist(E)},o.selectInitialTrack=function(){var s=this.tracksInGroup;console.assert(s.length,"Initial audio track should be selected when tracks are known");var a=this.trackName,l=this.findTrackId(a)||this.findTrackId();l!==-1?this.setAudioTrack(l):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger($.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},o.findTrackId=function(s){for(var a=this.tracksInGroup,l=0;l<a.length;l++){var c=a[l];if((!this.selectDefaultTrack||c.default)&&(!s||s===c.name))return c.id}return-1},o.loadPlaylist=function(s){var a=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(a)){var l=a.id,c=a.groupId,R=a.url;if(s)try{R=s.addDirectives(R)}catch(w){this.warn("Could not construct new URL with HLS Delivery Directives: "+w)}this.log("loading audio-track playlist for id: "+l),this.clearTimer(),this.hls.trigger($.Events.AUDIO_TRACK_LOADING,{url:R,id:l,groupId:c,deliveryDirectives:s||null})}},D(h,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(s){this.selectDefaultTrack=!1,this.setAudioTrack(s)}}]),h}(B.default);J.default=p},"./src/controller/base-playlist-controller.ts":function(oe,J,k){"use strict";k.r(J),k.d(J,"default",function(){return D});var $=k("./src/polyfills/number.ts"),F=k("./src/types/level.ts"),B=k("./src/controller/level-helper.ts"),G=k("./src/utils/logger.ts"),H=k("./src/errors.ts"),D=function(){function I(p,f){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=G.logger.log.bind(G.logger,f+":"),this.warn=G.logger.warn.bind(G.logger,f+":"),this.hls=p}var g=I.prototype;return g.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},g.onError=function(f,h){h.fatal&&h.type===H.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},g.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},g.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},g.stopLoad=function(){this.canLoad=!1,this.clearTimer()},g.switchParams=function(f,h){var o=h==null?void 0:h.renditionReports;if(o)for(var d=0;d<o.length;d++){var s=o[d],a=""+s.URI;if(a===f.substr(-a.length)){var l=parseInt(s["LAST-MSN"]),c=parseInt(s["LAST-PART"]);if(h&&this.hls.config.lowLatencyMode){var R=Math.min(h.age-h.partTarget,h.targetduration);c!==void 0&&R>h.partTarget&&(c+=1)}if(Object($.isFiniteNumber)(l))return new F.HlsUrlParameters(l,Object($.isFiniteNumber)(c)?c:void 0,F.HlsSkip.No)}}},g.loadPlaylist=function(f){},g.shouldLoadTrack=function(f){return this.canLoad&&f&&!!f.url&&(!f.details||f.details.live)},g.playlistLoaded=function(f,h,o){var d=this,s=h.details,a=h.stats,l=a.loading.end?Math.max(0,self.performance.now()-a.loading.end):0;if(s.advancedDateTime=Date.now()-l,s.live||o!=null&&o.live){if(s.reloaded(o),o&&this.log("live playlist "+f+" "+(s.advanced?"REFRESHED "+s.lastPartSn+"-"+s.lastPartIndex:"MISSED")),o&&s.fragments.length>0&&Object(B.mergeDetails)(o,s),!this.canLoad||!s.live)return;var c,R=void 0,w=void 0;if(s.canBlockReload&&s.endSN&&s.advanced){var x=this.hls.config.lowLatencyMode,O=s.lastPartSn,A=s.endSN,T=s.lastPartIndex,E=T!==-1,b=O===A,u=x?0:T;E?(R=b?A+1:O,w=b?u:T+1):R=A+1;var _=s.age,m=_+s.ageHeader,v=Math.min(m-s.partTarget,s.targetduration*1.5);if(v>0){if(o&&v>o.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+o.tuneInGoal+" to: "+v+" with playlist age: "+s.age),v=0;else{var M=Math.floor(v/s.targetduration);if(R+=M,w!==void 0){var P=Math.round(v%s.targetduration/s.partTarget);w+=P}this.log("CDN Tune-in age: "+s.ageHeader+"s last advanced "+_.toFixed(2)+"s goal: "+v+" skip sn "+M+" to part "+w)}s.tuneInGoal=v}if(c=this.getDeliveryDirectives(s,h.deliveryDirectives,R,w),x||!b){this.loadPlaylist(c);return}}else c=this.getDeliveryDirectives(s,h.deliveryDirectives,R,w);var K=Object(B.computeReloadInterval)(s,a);R!==void 0&&s.canBlockReload&&(K-=s.partTarget||1),this.log("reload live playlist "+f+" in "+Math.round(K)+" ms"),this.timer=self.setTimeout(function(){return d.loadPlaylist(c)},K)}else this.clearTimer()},g.getDeliveryDirectives=function(f,h,o,d){var s=Object(F.getSkipValue)(f,o);return h!=null&&h.skip&&f.deltaUpdateFailed&&(o=h.msn,d=h.part,s=F.HlsSkip.No),new F.HlsUrlParameters(o,d,s)},g.retryLoadingOrFail=function(f){var h=this,o=this.hls.config,d=this.retryCount<o.levelLoadingMaxRetry;if(d){var s;if(this.retryCount++,f.details.indexOf("LoadTimeOut")>-1&&(s=f.context)!==null&&s!==void 0&&s.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+f.details+'"'),this.loadPlaylist();else{var a=Math.min(Math.pow(2,this.retryCount)*o.levelLoadingRetryDelay,o.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 d},I}()},"./src/controller/base-stream-controller.ts":function(oe,J,k){"use strict";k.r(J),k.d(J,"State",function(){return A}),k.d(J,"default",function(){return T});var $=k("./src/polyfills/number.ts"),F=k("./src/task-loop.ts"),B=k("./src/controller/fragment-tracker.ts"),G=k("./src/utils/buffer-helper.ts"),H=k("./src/utils/logger.ts"),D=k("./src/events.ts"),I=k("./src/errors.ts"),g=k("./src/types/transmuxer.ts"),p=k("./src/utils/mp4-tools.ts"),f=k("./src/utils/discontinuities.ts"),h=k("./src/controller/fragment-finders.ts"),o=k("./src/controller/level-helper.ts"),d=k("./src/loader/fragment-loader.ts"),s=k("./src/crypt/decrypter.ts"),a=k("./src/utils/time-ranges.ts"),l=k("./src/types/loader.ts");function c(E,b){for(var u=0;u<b.length;u++){var _=b[u];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(E,_.key,_)}}function R(E,b,u){return b&&c(E.prototype,b),u&&c(E,u),E}function w(E){if(E===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return E}function x(E,b){E.prototype=Object.create(b.prototype),E.prototype.constructor=E,O(E,b)}function O(E,b){return O=Object.setPrototypeOf||function(_,m){return _.__proto__=m,_},O(E,b)}var A={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",BACKTRACKING:"BACKTRACKING",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"},T=function(E){x(b,E);function b(_,m,v){var M;return M=E.call(this)||this,M.hls=void 0,M.fragPrevious=null,M.fragCurrent=null,M.fragmentTracker=void 0,M.transmuxer=null,M._state=A.STOPPED,M.media=void 0,M.mediaBuffer=void 0,M.config=void 0,M.bitrateTest=!1,M.lastCurrentTime=0,M.nextLoadPosition=0,M.startPosition=0,M.loadedmetadata=!1,M.fragLoadError=0,M.retryDate=0,M.levels=null,M.fragmentLoader=void 0,M.levelLastLoaded=null,M.startFragRequested=!1,M.decrypter=void 0,M.initPTS=[],M.onvseeking=null,M.onvended=null,M.logPrefix="",M.log=void 0,M.warn=void 0,M.logPrefix=v,M.log=H.logger.log.bind(H.logger,v+":"),M.warn=H.logger.warn.bind(H.logger,v+":"),M.hls=_,M.fragmentLoader=new d.default(_.config),M.fragmentTracker=m,M.config=_.config,M.decrypter=new s.default(_,_.config),_.on(D.Events.KEY_LOADED,M.onKeyLoaded,w(M)),M}var u=b.prototype;return u.doTick=function(){this.onTickEnd()},u.onTickEnd=function(){},u.startLoad=function(m){},u.stopLoad=function(){this.fragmentLoader.abort();var m=this.fragCurrent;m&&this.fragmentTracker.removeFragment(m),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=A.STOPPED},u._streamEnded=function(m,v){var M=this.fragCurrent,P=this.fragmentTracker;if(!v.live&&M&&M.sn===v.endSN&&!m.nextStart){var K=P.getState(M);return K===B.FragmentState.PARTIAL||K===B.FragmentState.OK}return!1},u.onMediaAttached=function(m,v){var M=this.media=this.mediaBuffer=v.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),M.addEventListener("seeking",this.onvseeking),M.addEventListener("ended",this.onvended);var P=this.config;this.levels&&P.autoStartLoad&&this.state===A.STOPPED&&this.startLoad(P.startPosition)},u.onMediaDetaching=function(){var m=this.media;m!=null&&m.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),m&&(m.removeEventListener("seeking",this.onvseeking),m.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},u.onMediaSeeking=function(){var m=this.config,v=this.fragCurrent,M=this.media,P=this.mediaBuffer,K=this.state,V=M?M.currentTime:0,U=G.BufferHelper.bufferInfo(P||M,V,m.maxBufferHole);if(this.log("media seeking to "+(Object($.isFiniteNumber)(V)?V.toFixed(3):V)+", state: "+K),K===A.ENDED)this.resetLoadingState();else if(v&&!U.len){var S=m.maxFragLookUpTolerance,X=v.start-S,ee=v.start+v.duration+S,ae=V>ee;(V<X||ae)&&(ae&&v.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),v.loader.abort()),this.resetLoadingState())}M&&(this.lastCurrentTime=V),!this.loadedmetadata&&!U.len&&(this.nextLoadPosition=this.startPosition=V),this.tickImmediate()},u.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},u.onKeyLoaded=function(m,v){if(this.state!==A.KEY_LOADING||v.frag!==this.fragCurrent||!this.levels)return;this.state=A.IDLE;var M=this.levels[v.frag.level].details;M&&this.loadFragment(v.frag,M,v.frag.start)},u.onHandlerDestroying=function(){this.stopLoad(),E.prototype.onHandlerDestroying.call(this)},u.onHandlerDestroyed=function(){this.state=A.STOPPED,this.hls.off(D.Events.KEY_LOADED,this.onKeyLoaded,this),this.fragmentLoader&&this.fragmentLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.fragmentLoader=this.fragmentTracker=null,E.prototype.onHandlerDestroyed.call(this)},u.loadKey=function(m,v){this.log("Loading key for "+m.sn+" of ["+v.startSN+"-"+v.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+m.level),this.state=A.KEY_LOADING,this.fragCurrent=m,this.hls.trigger(D.Events.KEY_LOADING,{frag:m})},u.loadFragment=function(m,v,M){this._loadFragForPlayback(m,v,M)},u._loadFragForPlayback=function(m,v,M){var P=this,K=function(U){if(P.fragContextChanged(m)){P.warn("Fragment "+m.sn+(U.part?" p: "+U.part.index:"")+" of level "+m.level+" was dropped during download."),P.fragmentTracker.removeFragment(m);return}m.stats.chunkCount++,P._handleFragmentLoadProgress(U)};this._doFragLoad(m,v,M,K).then(function(V){if(!V)return;P.fragLoadError=0;var U=P.state;if(P.fragContextChanged(m)){(U===A.FRAG_LOADING||U===A.BACKTRACKING||!P.fragCurrent&&U===A.PARSING)&&(P.fragmentTracker.removeFragment(m),P.state=A.IDLE);return}if("payload"in V&&(P.log("Loaded fragment "+m.sn+" of level "+m.level),P.hls.trigger(D.Events.FRAG_LOADED,V),P.state===A.BACKTRACKING)){P.fragmentTracker.backtrack(m,V),P.resetFragmentLoading(m);return}P._handleFragmentLoadComplete(V)}).catch(function(V){P.warn(V),P.resetFragmentLoading(m)})},u.flushMainBuffer=function(m,v,M){if(M===void 0&&(M=null),!(m-v))return;var P={startOffset:m,endOffset:v,type:M};this.fragLoadError=0,this.hls.trigger(D.Events.BUFFER_FLUSHING,P)},u._loadInitSegment=function(m){var v=this;this._doFragLoad(m).then(function(M){if(!M||v.fragContextChanged(m)||!v.levels)throw new Error("init load aborted");return M}).then(function(M){var P=v.hls,K=M.payload,V=m.decryptdata;if(K&&K.byteLength>0&&V&&V.key&&V.iv&&V.method==="AES-128"){var U=self.performance.now();return v.decrypter.webCryptoDecrypt(new Uint8Array(K),V.key.buffer,V.iv.buffer).then(function(S){var X=self.performance.now();return P.trigger(D.Events.FRAG_DECRYPTED,{frag:m,payload:S,stats:{tstart:U,tdecrypt:X}}),M.payload=S,M})}return M}).then(function(M){var P=v.fragCurrent,K=v.hls,V=v.levels;if(!V)throw new Error("init load aborted, missing levels");var U=V[m.level].details;console.assert(U,"Level details are defined when init segment is loaded");var S=m.stats;v.state=A.IDLE,v.fragLoadError=0,m.data=new Uint8Array(M.payload),S.parsing.start=S.buffering.start=self.performance.now(),S.parsing.end=S.buffering.end=self.performance.now(),M.frag===P&&K.trigger(D.Events.FRAG_BUFFERED,{stats:S,frag:P,part:null,id:m.type}),v.tick()}).catch(function(M){v.warn(M),v.resetFragmentLoading(m)})},u.fragContextChanged=function(m){var v=this.fragCurrent;return!m||!v||m.level!==v.level||m.sn!==v.sn||m.urlId!==v.urlId},u.fragBufferedComplete=function(m,v){var M=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+m.type+" sn: "+m.sn+(v?" part: "+v.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+m.level+" "+a.default.toString(G.BufferHelper.getBuffered(M))),this.state=A.IDLE,this.tick()},u._handleFragmentLoadComplete=function(m){var v=this.transmuxer;if(!v)return;var M=m.frag,P=m.part,K=m.partsLoaded,V=!K||K.length===0||K.some(function(S){return!S}),U=new g.ChunkMetadata(M.level,M.sn,M.stats.chunkCount+1,0,P?P.index:-1,!V);v.flush(U)},u._handleFragmentLoadProgress=function(m){},u._doFragLoad=function(m,v,M,P){var K=this;if(M===void 0&&(M=null),!this.levels)throw new Error("frag load aborted, missing levels");if(M=Math.max(m.start,M||0),this.config.lowLatencyMode&&v){var V=v.partList;if(V&&P){M>m.end&&v.fragmentHint&&(m=v.fragmentHint);var U=this.getNextPart(V,m,M);if(U>-1){var S=V[U];return this.log("Loading part sn: "+m.sn+" p: "+S.index+" cc: "+m.cc+" of playlist ["+v.startSN+"-"+v.endSN+"] parts [0-"+U+"-"+(V.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+m.level+", target: "+parseFloat(M.toFixed(3))),this.nextLoadPosition=S.start+S.duration,this.state=A.FRAG_LOADING,this.hls.trigger(D.Events.FRAG_LOADING,{frag:m,part:V[U],targetBufferTime:M}),this.doFragPartsLoad(m,V,U,P).catch(function(X){return K.handleFragLoadError(X)})}else if(!m.url||this.loadedEndOfParts(V,M))return Promise.resolve(null)}}return this.log("Loading fragment "+m.sn+" cc: "+m.cc+" "+(v?"of ["+v.startSN+"-"+v.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+m.level+", target: "+parseFloat(M.toFixed(3))),Object($.isFiniteNumber)(m.sn)&&!this.bitrateTest&&(this.nextLoadPosition=m.start+m.duration),this.state=A.FRAG_LOADING,this.hls.trigger(D.Events.FRAG_LOADING,{frag:m,targetBufferTime:M}),this.fragmentLoader.load(m,P).catch(function(X){return K.handleFragLoadError(X)})},u.doFragPartsLoad=function(m,v,M,P){var K=this;return new Promise(function(V,U){var S=[],X=function ee(ae){var de=v[ae];K.fragmentLoader.loadPart(m,de,P).then(function(Ae){S[de.index]=Ae;var Ee=Ae.part;K.hls.trigger(D.Events.FRAG_LOADED,Ae);var we=v[ae+1];if(we&&we.fragment===m)ee(ae+1);else return V({frag:m,part:Ee,partsLoaded:S})}).catch(U)};X(M)})},u.handleFragLoadError=function(m){var v=m.data;return v&&v.details===I.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(v.frag,v.part):this.hls.trigger(D.Events.ERROR,v),null},u._handleTransmuxerFlush=function(m){var v=this.getCurrentContext(m);if(!v||this.state!==A.PARSING){this.fragCurrent||(this.state=A.IDLE);return}var M=v.frag,P=v.part,K=v.level,V=self.performance.now();M.stats.parsing.end=V,P&&(P.stats.parsing.end=V),this.updateLevelTiming(M,P,K,m.partial)},u.getCurrentContext=function(m){var v=this.levels,M=m.level,P=m.sn,K=m.part;if(!v||!v[M])return this.warn("Levels object was unset while buffering fragment "+P+" of level "+M+". The current chunk will not be buffered."),null;var V=v[M],U=K>-1?Object(o.getPartWith)(V,P,K):null,S=U?U.fragment:Object(o.getFragmentWithSN)(V,P,this.fragCurrent);return S?{frag:S,part:U,level:V}:null},u.bufferFragmentData=function(m,v,M,P){if(!m||this.state!==A.PARSING)return;var K=m.data1,V=m.data2,U=K;if(K&&V&&(U=Object(p.appendUint8Array)(K,V)),!U||!U.length)return;var S={type:m.type,frag:v,part:M,chunkMeta:P,parent:v.type,data:U};this.hls.trigger(D.Events.BUFFER_APPENDING,S),m.dropped&&m.independent&&!M&&this.flushBufferGap(v)},u.flushBufferGap=function(m){var v=this.media;if(!v)return;if(!G.BufferHelper.isBuffered(v,v.currentTime)){this.flushMainBuffer(0,m.start);return}var M=v.currentTime,P=G.BufferHelper.bufferInfo(v,M,0),K=m.duration,V=Math.min(this.config.maxFragLookUpTolerance*2,K*.25),U=Math.max(Math.min(m.start-V,P.end-V),M+V);m.start-U>V&&this.flushMainBuffer(U,m.start)},u.getFwdBufferInfo=function(m,v){var M=this.config,P=this.getLoadPosition();if(!Object($.isFiniteNumber)(P))return null;var K=G.BufferHelper.bufferInfo(m,P,M.maxBufferHole);if(K.len===0&&K.nextStart!==void 0){var V=this.fragmentTracker.getBufferedFrag(P,v);if(V&&K.nextStart<V.end)return G.BufferHelper.bufferInfo(m,P,Math.max(K.nextStart,M.maxBufferHole))}return K},u.getMaxBufferLength=function(m){var v=this.config,M;return m?M=Math.max(8*v.maxBufferSize/m,v.maxBufferLength):M=v.maxBufferLength,Math.min(M,v.maxMaxBufferLength)},u.reduceMaxBufferLength=function(m){var v=this.config,M=m||v.maxBufferLength;return v.maxMaxBufferLength>=M?(v.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+v.maxMaxBufferLength+"s"),!0):!1},u.getNextFragment=function(m,v){var M,P,K=v.fragments,V=K.length;if(!V)return null;var U=this.config,S=K[0].start,X;if(v.live){var ee=U.initialLiveManifestSize;if(V<ee)return this.warn("Not enough fragments to start playback (have: "+V+", need: "+ee+")"),null;!v.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(X=this.getInitialLiveFragment(v,K),this.startPosition=X?this.hls.liveSyncPosition||X.start:m)}else m<=S&&(X=K[0]);if(!X){var ae=U.lowLatencyMode?v.partEnd:v.fragmentEnd;X=this.getFragmentAtPosition(m,ae,v)}return(M=X)!==null&&M!==void 0&&M.initSegment&&!((P=X)!==null&&P!==void 0&&P.initSegment.data)&&!this.bitrateTest&&(X=X.initSegment),X},u.getNextPart=function(m,v,M){for(var P=-1,K=!1,V=!0,U=0,S=m.length;U<S;U++){var X=m[U];if(V=V&&!X.independent,P>-1&&M<X.start)break;var ee=X.loaded;!ee&&(K||X.independent||V)&&X.fragment===v&&(P=U),K=ee}return P},u.loadedEndOfParts=function(m,v){var M=m[m.length-1];return M&&v>M.start&&M.loaded},u.getInitialLiveFragment=function(m,v){var M=this.fragPrevious,P=null;if(M){if(m.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+M.programDateTime),P=Object(h.findFragmentByPDT)(v,M.endProgramDateTime,this.config.maxFragLookUpTolerance)),!P){var K=M.sn+1;if(K>=m.startSN&&K<=m.endSN){var V=v[K-m.startSN];M.cc===V.cc&&(P=V,this.log("Live playlist, switching playlist, load frag with next SN: "+P.sn))}P||(P=Object(h.findFragWithCC)(v,M.cc),P&&this.log("Live playlist, switching playlist, load frag with same CC: "+P.sn))}}else{var U=this.hls.liveSyncPosition;U!==null&&(P=this.getFragmentAtPosition(U,this.bitrateTest?m.fragmentEnd:m.edge,m))}return P},u.getFragmentAtPosition=function(m,v,M){var P=this.config,K=this.fragPrevious,V=M.fragments,U=M.endSN,S=M.fragmentHint,X=P.maxFragLookUpTolerance,ee=!!(P.lowLatencyMode&&M.partList&&S);ee&&S&&!this.bitrateTest&&(V=V.concat(S),U=S.sn);var ae;if(m<v){var de=m>v-X?0:X;ae=Object(h.findFragmentByPTS)(K,V,m,de)}else ae=V[V.length-1];if(ae){var Ae=ae.sn-M.startSN,Ee=K&&ae.level===K.level,we=V[Ae+1],he=this.fragmentTracker.getState(ae);if(he===B.FragmentState.BACKTRACKED){ae=null;for(var ce=Ae;V[ce]&&this.fragmentTracker.getState(V[ce])===B.FragmentState.BACKTRACKED;)K?ae=V[ce--]:ae=V[--ce];ae||(ae=we)}else K&&ae.sn===K.sn&&!ee&&(Ee&&(ae.sn<U&&this.fragmentTracker.getState(we)!==B.FragmentState.OK?(this.log("SN "+ae.sn+" just loaded, load next one: "+we.sn),ae=we):ae=null))}return ae},u.synchronizeToLiveEdge=function(m){var v=this.config,M=this.media;if(!M)return;var P=this.hls.liveSyncPosition,K=M.currentTime,V=m.fragments[0].start,U=m.edge,S=K>=V-v.maxFragLookUpTolerance&&K<=U;if(P!==null&&M.duration>P&&(K<P||!S)){var X=v.liveMaxLatencyDuration!==void 0?v.liveMaxLatencyDuration:v.liveMaxLatencyDurationCount*m.targetduration;(!S&&M.readyState<4||K<U-X)&&(this.loadedmetadata||(this.nextLoadPosition=P),M.readyState&&(this.warn("Playback: "+K.toFixed(3)+" is located too far from the end of live sliding playlist: "+U+", reset currentTime to : "+P.toFixed(3)),M.currentTime=P))}},u.alignPlaylists=function(m,v){var M=this.levels,P=this.levelLastLoaded,K=this.fragPrevious,V=P!==null?M[P]:null,U=m.fragments.length;if(!U)return this.warn("No fragments in live playlist"),0;var S=m.fragments[0].start,X=!v,ee=m.alignedSliding&&Object($.isFiniteNumber)(S);if(X||!ee&&!S){Object(f.alignStream)(K,V,m);var ae=m.fragments[0].start;return this.log("Live playlist sliding: "+ae.toFixed(2)+" start-sn: "+(v?v.startSN:"na")+"->"+m.startSN+" prev-sn: "+(K?K.sn:"na")+" fragments: "+U),ae}return S},u.waitForCdnTuneIn=function(m){var v=3;return m.live&&m.canBlockReload&&m.tuneInGoal>Math.max(m.partHoldBack,m.partTarget*v)},u.setStartPosition=function(m,v){var M=this.startPosition;if(M<v&&(M=-1),M===-1||this.lastCurrentTime===-1){var P=m.startTimeOffset;Object($.isFiniteNumber)(P)?(M=v+P,P<0&&(M+=m.totalduration),M=Math.min(Math.max(v,M),v+m.totalduration),this.log("Start time offset "+P+" found in playlist, adjust startPosition to "+M),this.startPosition=M):m.live?M=this.hls.liveSyncPosition||v:this.startPosition=M=0,this.lastCurrentTime=M}this.nextLoadPosition=M},u.getLoadPosition=function(){var m=this.media,v=0;return this.loadedmetadata&&m?v=m.currentTime:this.nextLoadPosition&&(v=this.nextLoadPosition),v},u.handleFragLoadAborted=function(m,v){this.transmuxer&&m.sn!=="initSegment"&&m.stats.aborted&&(this.warn("Fragment "+m.sn+(v?" part"+v.index:"")+" of level "+m.level+" was aborted"),this.resetFragmentLoading(m))},u.resetFragmentLoading=function(m){(!this.fragCurrent||!this.fragContextChanged(m))&&(this.state=A.IDLE)},u.onFragmentOrKeyLoadError=function(m,v){if(v.fatal)return;var M=v.frag;if(!M||M.type!==m)return;var P=this.fragCurrent;console.assert(P&&M.sn===P.sn&&M.level===P.level&&M.urlId===P.urlId,"Frag load error must match current frag to retry");var K=this.config;if(this.fragLoadError+1<=K.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(M.level))return;var V=Math.min(Math.pow(2,this.fragLoadError)*K.fragLoadingRetryDelay,K.fragLoadingMaxRetryTimeout);this.warn("Fragment "+M.sn+" of "+m+" "+M.level+" failed to load, retrying in "+V+"ms"),this.retryDate=self.performance.now()+V,this.fragLoadError++,this.state=A.FRAG_LOADING_WAITING_RETRY}else v.levelRetry?(m===l.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=A.IDLE):(H.logger.error(v.details+" reaches max retry, redispatch as fatal ..."),v.fatal=!0,this.hls.stopLoad(),this.state=A.ERROR)},u.afterBufferFlushed=function(m,v,M){if(!m)return;var P=G.BufferHelper.getBuffered(m);this.fragmentTracker.detectEvictedFragments(v,P,M),this.state===A.ENDED&&this.resetLoadingState()},u.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=A.IDLE},u.resetLiveStartWhenNotLoaded=function(m){if(!this.loadedmetadata){this.startFragRequested=!1;var v=this.levels?this.levels[m].details:null;if(v!=null&&v.live)return this.startPosition=-1,this.setStartPosition(v,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},u.updateLevelTiming=function(m,v,M,P){var K=this,V=M.details;console.assert(!!V,"level.details must be defined");var U=Object.keys(m.elementaryStreams).reduce(function(S,X){var ee=m.elementaryStreams[X];if(ee){var ae=ee.endPTS-ee.startPTS;if(ae<=0)return K.warn("Could not parse fragment "+m.sn+" "+X+" duration reliably ("+ae+") resetting transmuxer to fallback to playlist timing"),K.resetTransmuxer(),S||!1;var de=P?0:Object(o.updateFragPTSDTS)(V,m,ee.startPTS,ee.endPTS,ee.startDTS,ee.endDTS);return K.hls.trigger(D.Events.LEVEL_PTS_UPDATED,{details:V,level:M,drift:de,type:X,frag:m,start:ee.startPTS,end:ee.endPTS}),!0}return S},!1);U?(this.state=A.PARSED,this.hls.trigger(D.Events.FRAG_PARSED,{frag:m,part:v})):this.resetLoadingState()},u.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},R(b,[{key:"state",get:function(){return this._state},set:function(m){var v=this._state;v!==m&&(this._state=m,this.log(v+"->"+m))}}]),b}(F.default)},"./src/controller/buffer-controller.ts":function(oe,J,k){"use strict";k.r(J),k.d(J,"default",function(){return h});var $=k("./src/polyfills/number.ts"),F=k("./src/events.ts"),B=k("./src/utils/logger.ts"),G=k("./src/errors.ts"),H=k("./src/utils/buffer-helper.ts"),D=k("./src/utils/mediasource-helper.ts"),I=k("./src/loader/fragment.ts"),g=k("./src/controller/buffer-operation-queue.ts"),p=Object(D.getMediaSource)(),f=/([ha]vc.)(?:\.[^.,]+)+/,h=function(){function o(s){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 l=a.hls,c=a.media,R=a.mediaSource;B.logger.log("[buffer-controller]: Media source opened"),c&&(a.updateMediaElementDuration(),l.trigger(F.Events.MEDIA_ATTACHED,{media:c})),R&&R.removeEventListener("sourceopen",a._onMediaSourceOpen),a.checkPendingTracks()},this._onMediaSourceClose=function(){B.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){B.logger.log("[buffer-controller]: Media source ended")},this.hls=s,this._initSourceBuffer(),this.registerListeners()}var d=o.prototype;return d.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},d.destroy=function(){this.unregisterListeners(),this.details=null},d.registerListeners=function(){var a=this.hls;a.on(F.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),a.on(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.on(F.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.on(F.Events.BUFFER_RESET,this.onBufferReset,this),a.on(F.Events.BUFFER_APPENDING,this.onBufferAppending,this),a.on(F.Events.BUFFER_CODECS,this.onBufferCodecs,this),a.on(F.Events.BUFFER_EOS,this.onBufferEos,this),a.on(F.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),a.on(F.Events.LEVEL_UPDATED,this.onLevelUpdated,this),a.on(F.Events.FRAG_PARSED,this.onFragParsed,this),a.on(F.Events.FRAG_CHANGED,this.onFragChanged,this)},d.unregisterListeners=function(){var a=this.hls;a.off(F.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),a.off(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.off(F.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.off(F.Events.BUFFER_RESET,this.onBufferReset,this),a.off(F.Events.BUFFER_APPENDING,this.onBufferAppending,this),a.off(F.Events.BUFFER_CODECS,this.onBufferCodecs,this),a.off(F.Events.BUFFER_EOS,this.onBufferEos,this),a.off(F.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),a.off(F.Events.LEVEL_UPDATED,this.onLevelUpdated,this),a.off(F.Events.FRAG_PARSED,this.onFragParsed,this),a.off(F.Events.FRAG_CHANGED,this.onFragChanged,this)},d._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new g.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},d.onManifestParsed=function(a,l){var c=2;(l.audio&&!l.video||!l.altAudio)&&(c=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=c,this.details=null,B.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},d.onMediaAttaching=function(a,l){var c=this.media=l.media;if(c&&p){var R=this.mediaSource=new p;R.addEventListener("sourceopen",this._onMediaSourceOpen),R.addEventListener("sourceended",this._onMediaSourceEnded),R.addEventListener("sourceclose",this._onMediaSourceClose),c.src=self.URL.createObjectURL(R),this._objectUrl=c.src}},d.onMediaDetaching=function(){var a=this.media,l=this.mediaSource,c=this._objectUrl;if(l){if(B.logger.log("[buffer-controller]: media source detaching"),l.readyState==="open")try{l.endOfStream()}catch(R){B.logger.warn("[buffer-controller]: onMediaDetaching: "+R.message+" while calling endOfStream")}this.onBufferReset(),l.removeEventListener("sourceopen",this._onMediaSourceOpen),l.removeEventListener("sourceended",this._onMediaSourceEnded),l.removeEventListener("sourceclose",this._onMediaSourceClose),a&&(c&&self.URL.revokeObjectURL(c),a.src===c?(a.removeAttribute("src"),a.load()):B.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(F.Events.MEDIA_DETACHED,void 0)},d.onBufferReset=function(){var a=this;this.getSourceBufferTypes().forEach(function(l){var c=a.sourceBuffer[l];try{c&&(a.removeBufferListeners(l),a.mediaSource&&a.mediaSource.removeSourceBuffer(c),a.sourceBuffer[l]=void 0)}catch(R){B.logger.warn("[buffer-controller]: Failed to reset the "+l+" buffer",R)}}),this._initSourceBuffer()},d.onBufferCodecs=function(a,l){var c=this,R=this.getSourceBufferTypes().length;if(Object.keys(l).forEach(function(w){if(R){var x=c.tracks[w];if(x&&typeof x.buffer.changeType=="function"){var O=l[w],A=O.codec,T=O.levelCodec,E=O.container,b=(x.levelCodec||x.codec).replace(f,"$1"),u=(T||A).replace(f,"$1");if(b!==u){var _=E+";codecs="+(T||A);c.appendChangeType(w,_)}}}else c.pendingTracks[w]=l[w]}),R)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},d.appendChangeType=function(a,l){var c=this,R=this.operationQueue,w={execute:function(){var O=c.sourceBuffer[a];O&&(B.logger.log("[buffer-controller]: changing "+a+" sourceBuffer type to "+l),O.changeType(l)),R.shiftAndExecuteNext(a)},onStart:function(){},onComplete:function(){},onError:function(O){B.logger.warn("[buffer-controller]: Failed to change "+a+" SourceBuffer type",O)}};R.append(w,a)},d.onBufferAppending=function(a,l){var c=this,R=this.hls,w=this.operationQueue,x=this.tracks,O=l.data,A=l.type,T=l.frag,E=l.part,b=l.chunkMeta,u=b.buffering[A],_=self.performance.now();u.start=_;var m=T.stats.buffering,v=E?E.stats.buffering:null;m.start===0&&(m.start=_),v&&v.start===0&&(v.start=_);var M=x.audio,P=A==="audio"&&b.id===1&&(M==null?void 0:M.container)==="audio/mpeg",K={execute:function(){if(u.executeStart=self.performance.now(),P){var U=c.sourceBuffer[A];if(U){var S=T.start-U.timestampOffset;Math.abs(S)>=.1&&(B.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+T.start+" (delta: "+S+") sn: "+T.sn+")"),U.timestampOffset=T.start)}}c.appendExecutor(O,A)},onStart:function(){},onComplete:function(){var U=self.performance.now();u.executeEnd=u.end=U,m.first===0&&(m.first=U),v&&v.first===0&&(v.first=U);var S=c.sourceBuffer,X={};for(var ee in S)X[ee]=H.BufferHelper.getBuffered(S[ee]);c.appendError=0,c.hls.trigger(F.Events.BUFFER_APPENDED,{type:A,frag:T,part:E,chunkMeta:b,parent:T.type,timeRanges:X})},onError:function(U){B.logger.error("[buffer-controller]: Error encountered while trying to append to the "+A+" SourceBuffer",U);var S={type:G.ErrorTypes.MEDIA_ERROR,parent:T.type,details:G.ErrorDetails.BUFFER_APPEND_ERROR,err:U,fatal:!1};U.code===DOMException.QUOTA_EXCEEDED_ERR?S.details=G.ErrorDetails.BUFFER_FULL_ERROR:(c.appendError++,S.details=G.ErrorDetails.BUFFER_APPEND_ERROR,c.appendError>R.config.appendErrorMaxRetry&&(B.logger.error("[buffer-controller]: Failed "+R.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),S.fatal=!0)),R.trigger(F.Events.ERROR,S)}};w.append(K,A)},d.onBufferFlushing=function(a,l){var c=this,R=this.operationQueue,w=function(O){return{execute:c.removeExecutor.bind(c,O,l.startOffset,l.endOffset),onStart:function(){},onComplete:function(){c.hls.trigger(F.Events.BUFFER_FLUSHED,{type:O})},onError:function(T){B.logger.warn("[buffer-controller]: Failed to remove from "+O+" SourceBuffer",T)}}};l.type?R.append(w(l.type),l.type):this.getSourceBufferTypes().forEach(function(x){R.append(w(x),x)})},d.onFragParsed=function(a,l){var c=this,R=l.frag,w=l.part,x=[],O=w?w.elementaryStreams:R.elementaryStreams;O[I.ElementaryStreamTypes.AUDIOVIDEO]?x.push("audiovideo"):(O[I.ElementaryStreamTypes.AUDIO]&&x.push("audio"),O[I.ElementaryStreamTypes.VIDEO]&&x.push("video"));var A=function(){var E=self.performance.now();R.stats.buffering.end=E,w&&(w.stats.buffering.end=E);var b=w?w.stats:R.stats;c.hls.trigger(F.Events.FRAG_BUFFERED,{frag:R,part:w,stats:b,id:R.type})};x.length===0&&B.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+R.type+" level: "+R.level+" sn: "+R.sn),this.blockBuffers(A,x)},d.onFragChanged=function(a,l){this.flushBackBuffer()},d.onBufferEos=function(a,l){var c=this,R=this.getSourceBufferTypes().reduce(function(w,x){var O=c.sourceBuffer[x];return(!l.type||l.type===x)&&(O&&!O.ended&&(O.ended=!0,B.logger.log("[buffer-controller]: "+x+" sourceBuffer now EOS"))),w&&!!(!O||O.ended)},!0);R&&this.blockBuffers(function(){var w=c.mediaSource;if(!w||w.readyState!=="open")return;w.endOfStream()})},d.onLevelUpdated=function(a,l){var c=l.details;if(!c.fragments.length)return;this.details=c,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},d.flushBackBuffer=function(){var a=this.hls,l=this.details,c=this.media,R=this.sourceBuffer;if(!c||l===null)return;var w=this.getSourceBufferTypes();if(!w.length)return;var x=l.live&&a.config.liveBackBufferLength!==null?a.config.liveBackBufferLength:a.config.backBufferLength;if(!Object($.isFiniteNumber)(x)||x<0)return;var O=c.currentTime,A=l.levelTargetDuration,T=Math.max(x,A),E=Math.floor(O/A)*A-T;w.forEach(function(b){var u=R[b];if(u){var _=H.BufferHelper.getBuffered(u);_.length>0&&E>_.start(0)&&(a.trigger(F.Events.BACK_BUFFER_REACHED,{bufferEnd:E}),l.live&&a.trigger(F.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:E}),a.trigger(F.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:E,type:b}))}})},d.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var a=this.details,l=this.hls,c=this.media,R=this.mediaSource,w=a.fragments[0].start+a.totalduration,x=c.duration,O=Object($.isFiniteNumber)(R.duration)?R.duration:0;a.live&&l.config.liveDurationInfinity?(B.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),R.duration=Infinity,this.updateSeekableRange(a)):(w>O&&w>x||!Object($.isFiniteNumber)(x))&&(B.logger.log("[buffer-controller]: Updating Media Source duration to "+w.toFixed(3)),R.duration=w)},d.updateSeekableRange=function(a){var l=this.mediaSource,c=a.fragments,R=c.length;if(R&&a.live&&l!==null&&l!==void 0&&l.setLiveSeekableRange){var w=Math.max(0,c[0].start),x=Math.max(w,w+a.totalduration);l.setLiveSeekableRange(w,x)}},d.checkPendingTracks=function(){var a=this.bufferCodecEventsExpected,l=this.operationQueue,c=this.pendingTracks,R=Object.keys(c).length;if(R&&!a||R===2){this.createSourceBuffers(c),this.pendingTracks={};var w=this.getSourceBufferTypes();if(w.length===0){this.hls.trigger(F.Events.ERROR,{type:G.ErrorTypes.MEDIA_ERROR,details:G.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}w.forEach(function(x){l.executeNext(x)})}},d.createSourceBuffers=function(a){var l=this.sourceBuffer,c=this.mediaSource;if(!c)throw Error("createSourceBuffers called when mediaSource was null");var R=0;for(var w in a)if(!l[w]){var x=a[w];if(!x)throw Error("source buffer exists for track "+w+", however track does not");var O=x.levelCodec||x.codec,A=x.container+";codecs="+O;B.logger.log("[buffer-controller]: creating sourceBuffer("+A+")");try{var T=l[w]=c.addSourceBuffer(A),E=w;this.addBufferListener(E,"updatestart",this._onSBUpdateStart),this.addBufferListener(E,"updateend",this._onSBUpdateEnd),this.addBufferListener(E,"error",this._onSBUpdateError),this.tracks[w]={buffer:T,codec:O,container:x.container,levelCodec:x.levelCodec,id:x.id},R++}catch(b){B.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+b.message),this.hls.trigger(F.Events.ERROR,{type:G.ErrorTypes.MEDIA_ERROR,details:G.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:b,mimeType:A})}}R&&this.hls.trigger(F.Events.BUFFER_CREATED,{tracks:this.tracks})},d._onSBUpdateStart=function(a){var l=this.operationQueue,c=l.current(a);c.onStart()},d._onSBUpdateEnd=function(a){var l=this.operationQueue,c=l.current(a);c.onComplete(),l.shiftAndExecuteNext(a)},d._onSBUpdateError=function(a,l){B.logger.error("[buffer-controller]: "+a+" SourceBuffer error",l),this.hls.trigger(F.Events.ERROR,{type:G.ErrorTypes.MEDIA_ERROR,details:G.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var c=this.operationQueue.current(a);c&&c.onError(l)},d.removeExecutor=function(a,l,c){var R=this.media,w=this.mediaSource,x=this.operationQueue,O=this.sourceBuffer,A=O[a];if(!R||!w||!A){B.logger.warn("[buffer-controller]: Attempting to remove from the "+a+" SourceBuffer, but it does not exist"),x.shiftAndExecuteNext(a);return}var T=Object($.isFiniteNumber)(R.duration)?R.duration:Infinity,E=Object($.isFiniteNumber)(w.duration)?w.duration:Infinity,b=Math.max(0,l),u=Math.min(c,T,E);u>b?(B.logger.log("[buffer-controller]: Removing ["+b+","+u+"] from the "+a+" SourceBuffer"),console.assert(!A.updating,a+" sourceBuffer must not be updating"),A.remove(b,u)):x.shiftAndExecuteNext(a)},d.appendExecutor=function(a,l){var c=this.operationQueue,R=this.sourceBuffer,w=R[l];if(!w){B.logger.warn("[buffer-controller]: Attempting to append to the "+l+" SourceBuffer, but it does not exist"),c.shiftAndExecuteNext(l);return}w.ended=!1,console.assert(!w.updating,l+" sourceBuffer must not be updating"),w.appendBuffer(a)},d.blockBuffers=function(a,l){var c=this;if(l===void 0&&(l=this.getSourceBufferTypes()),!l.length){B.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(a);return}var R=this.operationQueue,w=l.map(function(x){return R.appendBlocker(x)});Promise.all(w).then(function(){a(),l.forEach(function(x){var O=c.sourceBuffer[x];(!O||!O.updating)&&R.shiftAndExecuteNext(x)})})},d.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},d.addBufferListener=function(a,l,c){var R=this.sourceBuffer[a];if(!R)return;var w=c.bind(this,a);this.listeners[a].push({event:l,listener:w}),R.addEventListener(l,w)},d.removeBufferListeners=function(a){var l=this.sourceBuffer[a];if(!l)return;this.listeners[a].forEach(function(c){l.removeEventListener(c.event,c.listener)})},o}()},"./src/controller/buffer-operation-queue.ts":function(oe,J,k){"use strict";k.r(J),k.d(J,"default",function(){return F});var $=k("./src/utils/logger.ts"),F=function(){function B(H){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=H}var G=B.prototype;return G.append=function(D,I){var g=this.queues[I];g.push(D),g.length===1&&this.buffers[I]&&this.executeNext(I)},G.insertAbort=function(D,I){var g=this.queues[I];g.unshift(D),this.executeNext(I)},G.appendBlocker=function(D){var I,g=new Promise(function(f){I=f}),p={execute:I,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(p,D),g},G.executeNext=function(D){var I=this.buffers,g=this.queues,p=I[D],f=g[D];if(f.length){var h=f[0];try{h.execute()}catch(o){$.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),h.onError(o),(!p||!p.updating)&&(f.shift(),this.executeNext(D))}}},G.shiftAndExecuteNext=function(D){this.queues[D].shift(),this.executeNext(D)},G.current=function(D){return this.queues[D][0]},B}()},"./src/controller/cap-level-controller.ts":function(oe,J,k){"use strict";k.r(J);var $=k("./src/events.ts");function F(H,D){for(var I=0;I<D.length;I++){var g=D[I];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(H,g.key,g)}}function B(H,D,I){return D&&F(H.prototype,D),I&&F(H,I),H}var G=function(){function H(I){this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.hls=void 0,this.streamController=void 0,this.clientRect=void 0,this.hls=I,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var D=H.prototype;return D.setStreamController=function(g){this.streamController=g},D.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},D.registerListeners=function(){var g=this.hls;g.on($.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),g.on($.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),g.on($.Events.MANIFEST_PARSED,this.onManifestParsed,this),g.on($.Events.BUFFER_CODECS,this.onBufferCodecs,this),g.on($.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},D.unregisterListener=function(){var g=this.hls;g.off($.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),g.off($.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),g.off($.Events.MANIFEST_PARSED,this.onManifestParsed,this),g.off($.Events.BUFFER_CODECS,this.onBufferCodecs,this),g.off($.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},D.onFpsDropLevelCapping=function(g,p){H.isLevelAllowed(p.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(p.droppedLevel)},D.onMediaAttaching=function(g,p){this.media=p.media instanceof HTMLVideoElement?p.media:null},D.onManifestParsed=function(g,p){var f=this.hls;this.restrictedLevels=[],this.firstLevel=p.firstLevel,f.config.capLevelToPlayerSize&&p.video&&this.startCapping()},D.onBufferCodecs=function(g,p){var f=this.hls;f.config.capLevelToPlayerSize&&p.video&&this.startCapping()},D.onMediaDetaching=function(){this.stopCapping()},D.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var g=this.hls.levels;if(g.length){var p=this.hls;p.autoLevelCapping=this.getMaxLevel(g.length-1),p.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=p.autoLevelCapping}}},D.getMaxLevel=function(g){var p=this,f=this.hls.levels;if(!f.length)return-1;var h=f.filter(function(o,d){return H.isLevelAllowed(d,p.restrictedLevels)&&d<=g});return this.clientRect=null,H.getMaxLevelByMediaSize(h,this.mediaWidth,this.mediaHeight)},D.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()},D.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},D.getDimensions=function(){if(this.clientRect)return this.clientRect;var g=this.media,p={width:0,height:0};if(g){var f=g.getBoundingClientRect();p.width=f.width,p.height=f.height,!p.width&&!p.height&&(p.width=f.right-f.left||g.width||0,p.height=f.bottom-f.top||g.height||0)}return this.clientRect=p,p},H.isLevelAllowed=function(g,p){return p===void 0&&(p=[]),p.indexOf(g)===-1},H.getMaxLevelByMediaSize=function(g,p,f){if(!g||!g.length)return-1;for(var h=function(l,c){return c?l.width!==c.width||l.height!==c.height:!0},o=g.length-1,d=0;d<g.length;d+=1){var s=g[d];if((s.width>=p||s.height>=f)&&h(s,g[d+1])){o=d;break}}return o},B(H,[{key:"mediaWidth",get:function(){return this.getDimensions().width*H.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*H.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var g=1;try{g=self.devicePixelRatio}catch(p){}return g}}]),H}();J.default=G},"./src/controller/cmcd-controller.ts":function(oe,J,k){"use strict";k.r(J),k.d(J,"default",function(){return h});var $=k("./src/events.ts"),F=k("./src/types/cmcd.ts"),B=k("./src/utils/buffer-helper.ts"),G=k("./src/utils/logger.ts");function H(o,d){for(var s=0;s<d.length;s++){var a=d[s];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(o,a.key,a)}}function D(o,d,s){return d&&H(o.prototype,d),s&&H(o,s),o}function I(o,d){var s=typeof Symbol!="undefined"&&o[Symbol.iterator]||o["@@iterator"];if(s)return(s=s.call(o)).next.bind(s);if(Array.isArray(o)||(s=g(o))||d&&o&&typeof o.length=="number"){s&&(o=s);var a=0;return function(){return a>=o.length?{done:!0}:{done:!1,value:o[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 g(o,d){if(!o)return;if(typeof o=="string")return p(o,d);var s=Object.prototype.toString.call(o).slice(8,-1);if(s==="Object"&&o.constructor&&(s=o.constructor.name),s==="Map"||s==="Set")return Array.from(o);if(s==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s))return p(o,d)}function p(o,d){(d==null||d>o.length)&&(d=o.length);for(var s=0,a=new Array(d);s<d;s++)a[s]=o[s];return a}function f(){return f=Object.assign||function(o){for(var d=1;d<arguments.length;d++){var s=arguments[d];for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(o[a]=s[a])}return o},f.apply(this,arguments)}var h=function(){function o(s){var a=this;this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){a.initialized&&(a.starved=!0),a.buffering=!0},this.onPlaying=function(){a.initialized||(a.initialized=!0),a.buffering=!1},this.applyPlaylistData=function(R){try{a.apply(R,{ot:F.CMCDObjectType.MANIFEST,su:!a.initialized})}catch(w){G.logger.warn("Could not generate manifest CMCD data.",w)}},this.applyFragmentData=function(R){try{var w=R.frag,x=a.hls.levels[w.level],O=a.getObjectType(w),A={d:w.duration*1e3,ot:O};(O===F.CMCDObjectType.VIDEO||O===F.CMCDObjectType.AUDIO||O==F.CMCDObjectType.MUXED)&&(A.br=x.bitrate/1e3,A.tb=a.getTopBandwidth(O),A.bl=a.getBufferLength(O)),a.apply(R,A)}catch(T){G.logger.warn("Could not generate segment CMCD data.",T)}},this.hls=s;var l=this.config=s.config,c=l.cmcd;c!=null&&(l.pLoader=this.createPlaylistLoader(),l.fLoader=this.createFragmentLoader(),this.sid=c.sessionId||o.uuid(),this.cid=c.contentId,this.useHeaders=c.useHeaders===!0,this.registerListeners())}var d=o.prototype;return d.registerListeners=function(){var a=this.hls;a.on($.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.on($.Events.MEDIA_DETACHED,this.onMediaDetached,this),a.on($.Events.BUFFER_CREATED,this.onBufferCreated,this)},d.unregisterListeners=function(){var a=this.hls;a.off($.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.off($.Events.MEDIA_DETACHED,this.onMediaDetached,this),a.off($.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},d.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},d.onMediaAttached=function(a,l){this.media=l.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},d.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},d.onBufferCreated=function(a,l){var c,R;this.audioBuffer=(c=l.tracks.audio)===null||c===void 0?void 0:c.buffer,this.videoBuffer=(R=l.tracks.video)===null||R===void 0?void 0:R.buffer},d.createData=function(){var a;return{v:F.CMCDVersion,sf:F.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(a=this.media)===null||a===void 0?void 0:a.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},d.apply=function(a,l){l===void 0&&(l={}),f(l,this.createData());var c=l.ot===F.CMCDObjectType.INIT||l.ot===F.CMCDObjectType.VIDEO||l.ot===F.CMCDObjectType.MUXED;if(this.starved&&c&&(l.bs=!0,l.su=!0,this.starved=!1),l.su==null&&(l.su=this.buffering),this.useHeaders){var R=o.toHeaders(l);if(!Object.keys(R).length)return;a.headers||(a.headers={}),f(a.headers,R)}else{var w=o.toQuery(l);if(!w)return;a.url=o.appendQueryToUri(a.url,w)}},d.getObjectType=function(a){var l=a.type;return l==="subtitle"?F.CMCDObjectType.TIMED_TEXT:a.sn==="initSegment"?F.CMCDObjectType.INIT:l==="audio"?F.CMCDObjectType.AUDIO:l==="main"?this.hls.audioTracks.length?F.CMCDObjectType.VIDEO:F.CMCDObjectType.MUXED:void 0},d.getTopBandwidth=function(a){for(var l=0,c=a===F.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,R=I(c),w;!(w=R()).done;){var x=w.value;x.bitrate>l&&(l=x.bitrate)}return l>0?l:NaN},d.getBufferLength=function(a){var l=this.hls.media,c=a===F.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!c||!l)return NaN;var R=B.BufferHelper.bufferInfo(c,l.currentTime,this.config.maxBufferHole);return R.len*1e3},d.createPlaylistLoader=function(){var a=this.config.pLoader,l=this.applyPlaylistData,c=a||this.config.loader;return function(){function R(x){this.loader=void 0,this.loader=new c(x)}var w=R.prototype;return w.destroy=function(){this.loader.destroy()},w.abort=function(){this.loader.abort()},w.load=function(O,A,T){l(O),this.loader.load(O,A,T)},D(R,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),R}()},d.createFragmentLoader=function(){var a=this.config.fLoader,l=this.applyFragmentData,c=a||this.config.loader;return function(){function R(x){this.loader=void 0,this.loader=new c(x)}var w=R.prototype;return w.destroy=function(){this.loader.destroy()},w.abort=function(){this.loader.abort()},w.load=function(O,A,T){l(O),this.loader.load(O,A,T)},D(R,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),R}()},o.uuid=function(){var a=URL.createObjectURL(new Blob),l=a.toString();return URL.revokeObjectURL(a),l.substr(l.lastIndexOf("/")+1)},o.serialize=function(a){for(var l=[],c=function(P){return!Number.isNaN(P)&&P!=null&&P!==""&&P!==!1},R=function(P){return Math.round(P)},w=function(P){return R(P/100)*100},x=function(P){return encodeURIComponent(P)},O={br:R,d:R,bl:w,dl:w,mtp:w,nor:x,rtp:w,tb:R},A=Object.keys(a||{}).sort(),T=I(A),E;!(E=T()).done;){var b=E.value,u=a[b];if(!c(u))continue;if(b==="v"&&u===1)continue;if(b=="pr"&&u===1)continue;var _=O[b];_&&(u=_(u));var m=typeof u,v=void 0;b==="ot"||b==="sf"||b==="st"?v=b+"="+u:m==="boolean"?v=b:m==="number"?v=b+"="+u:v=b+"="+JSON.stringify(u),l.push(v)}return l.join(",")},o.toHeaders=function(a){for(var l=Object.keys(a),c={},R=["Object","Request","Session","Status"],w=[{},{},{},{}],x={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=l;O<A.length;O++){var T=A[O],E=x[T]!=null?x[T]:1;w[E][T]=a[T]}for(var b=0;b<w.length;b++){var u=o.serialize(w[b]);u&&(c["CMCD-"+R[b]]=u)}return c},o.toQuery=function(a){return"CMCD="+encodeURIComponent(o.serialize(a))},o.appendQueryToUri=function(a,l){if(!l)return a;var c=a.includes("?")?"&":"?";return""+a+c+l},o}()},"./src/controller/eme-controller.ts":function(oe,J,k){"use strict";k.r(J);var $=k("./src/events.ts"),F=k("./src/errors.ts"),B=k("./src/utils/logger.ts"),G=k("./src/utils/mediakeys-helper.ts");function H(h,o){for(var d=0;d<o.length;d++){var s=o[d];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(h,s.key,s)}}function D(h,o,d){return o&&H(h.prototype,o),d&&H(h,d),h}var I=3,g=function(o,d,s){var a={audioCapabilities:[],videoCapabilities:[]};return o.forEach(function(l){a.audioCapabilities.push({contentType:'audio/mp4; codecs="'+l+'"',robustness:s.audioRobustness||""})}),d.forEach(function(l){a.videoCapabilities.push({contentType:'video/mp4; codecs="'+l+'"',robustness:s.videoRobustness||""})}),[a]},p=function(o,d,s,a){switch(o){case G.KeySystems.WIDEVINE:return g(d,s,a);default:throw new Error("Unknown key-system: "+o)}},f=function(){function h(d){this.hls=void 0,this._widevineLicenseUrl=void 0,this._licenseXhrSetup=void 0,this._licenseResponseCallback=void 0,this._emeEnabled=void 0,this._requestMediaKeySystemAccess=void 0,this._drmSystemOptions=void 0,this._config=void 0,this._mediaKeysList=[],this._media=null,this._hasSetMediaKeys=!1,this._requestLicenseFailureCount=0,this.mediaKeysPromise=null,this._onMediaEncrypted=this.onMediaEncrypted.bind(this),this.hls=d,this._config=d.config,this._widevineLicenseUrl=this._config.widevineLicenseUrl,this._licenseXhrSetup=this._config.licenseXhrSetup,this._licenseResponseCallback=this._config.licenseResponseCallback,this._emeEnabled=this._config.emeEnabled,this._requestMediaKeySystemAccess=this._config.requestMediaKeySystemAccessFunc,this._drmSystemOptions=this._config.drmSystemOptions,this._registerListeners()}var o=h.prototype;return o.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},o._registerListeners=function(){this.hls.on($.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on($.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on($.Events.MANIFEST_PARSED,this.onManifestParsed,this)},o._unregisterListeners=function(){this.hls.off($.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off($.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off($.Events.MANIFEST_PARSED,this.onManifestParsed,this)},o.getLicenseServerUrl=function(s){switch(s){case G.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+s+'"')},o._attemptKeySystemAccess=function(s,a,l){var c=this,R=p(s,a,l,this._drmSystemOptions);B.logger.log("Requesting encrypted media key-system access");var w=this.requestMediaKeySystemAccess(s,R);this.mediaKeysPromise=w.then(function(x){return c._onMediaKeySystemAccessObtained(s,x)}),w.catch(function(x){B.logger.error('Failed to obtain key-system "'+s+'" access:',x)})},o._onMediaKeySystemAccessObtained=function(s,a){var l=this;B.logger.log('Access for key-system "'+s+'" obtained');var c={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:a,mediaKeySystemDomain:s};this._mediaKeysList.push(c);var R=Promise.resolve().then(function(){return a.createMediaKeys()}).then(function(w){return c.mediaKeys=w,B.logger.log('Media-keys created for key-system "'+s+'"'),l._onMediaKeysCreated(),w});return R.catch(function(w){B.logger.error("Failed to create media-keys:",w)}),R},o._onMediaKeysCreated=function(){var s=this;this._mediaKeysList.forEach(function(a){a.mediaKeysSession||(a.mediaKeysSession=a.mediaKeys.createSession(),s._onNewMediaKeySession(a.mediaKeysSession))})},o._onNewMediaKeySession=function(s){var a=this;B.logger.log("New key-system session "+s.sessionId),s.addEventListener("message",function(l){a._onKeySessionMessage(s,l.message)},!1)},o._onKeySessionMessage=function(s,a){B.logger.log("Got EME message event, creating license request"),this._requestLicense(a,function(l){B.logger.log("Received license data (length: "+(l&&l.byteLength)+"), updating key-session"),s.update(l)})},o.onMediaEncrypted=function(s){var a=this;if(B.logger.log('Media is encrypted using "'+s.initDataType+'" init data type'),!this.mediaKeysPromise){B.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger($.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var l=function(R){if(!a._media)return;a._attemptSetMediaKeys(R),a._generateRequestWithPreferredKeySession(s.initDataType,s.initData)};this.mediaKeysPromise.then(l).catch(l)},o._attemptSetMediaKeys=function(s){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var a=this._mediaKeysList[0];if(!a||!a.mediaKeys){B.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger($.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}B.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(a.mediaKeys),this._hasSetMediaKeys=!0}},o._generateRequestWithPreferredKeySession=function(s,a){var l=this,c=this._mediaKeysList[0];if(!c){B.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger($.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(c.mediaKeysSessionInitialized){B.logger.warn("Key-Session already initialized but requested again");return}var R=c.mediaKeysSession;if(!R){B.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger($.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!a){B.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger($.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}B.logger.log('Generating key-session request for "'+s+'" init data type'),c.mediaKeysSessionInitialized=!0,R.generateRequest(s,a).then(function(){B.logger.debug("Key-session generation succeeded")}).catch(function(w){B.logger.error("Error generating key-session request:",w),l.hls.trigger($.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},o._createLicenseXhr=function(s,a,l){var c=new XMLHttpRequest;c.responseType="arraybuffer",c.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,c,s,a,l);var R=this._licenseXhrSetup;if(R)try{R.call(this.hls,c,s),R=void 0}catch(w){B.logger.error(w)}try{c.readyState||c.open("POST",s,!0),R&&R.call(this.hls,c,s)}catch(w){throw new Error("issue setting up KeySystem license XHR "+w)}return c},o._onLicenseRequestReadyStageChange=function(s,a,l,c){switch(s.readyState){case 4:if(s.status===200){this._requestLicenseFailureCount=0,B.logger.log("License request succeeded");var R=s.response,w=this._licenseResponseCallback;if(w)try{R=w.call(this.hls,s,a)}catch(O){B.logger.error(O)}c(R)}else{if(B.logger.error("License Request XHR failed ("+a+"). Status: "+s.status+" ("+s.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>I){this.hls.trigger($.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var x=I-this._requestLicenseFailureCount+1;B.logger.warn("Retrying license request, "+x+" attempts left"),this._requestLicense(l,c)}break}},o._generateLicenseRequestChallenge=function(s,a){switch(s.mediaKeySystemDomain){case G.KeySystems.WIDEVINE:return a}throw new Error("unsupported key-system: "+s.mediaKeySystemDomain)},o._requestLicense=function(s,a){B.logger.log("Requesting content license for key-system");var l=this._mediaKeysList[0];if(!l){B.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger($.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var c=this.getLicenseServerUrl(l.mediaKeySystemDomain),R=this._createLicenseXhr(c,s,a);B.logger.log("Sending license request to URL: "+c);var w=this._generateLicenseRequestChallenge(l,s);R.send(w)}catch(x){B.logger.error("Failure requesting DRM license: "+x),this.hls.trigger($.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},o.onMediaAttached=function(s,a){if(!this._emeEnabled)return;var l=a.media;this._media=l,l.addEventListener("encrypted",this._onMediaEncrypted)},o.onMediaDetached=function(){var s=this._media,a=this._mediaKeysList;if(!s)return;s.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(a.map(function(l){if(l.mediaKeysSession)return l.mediaKeysSession.close().catch(function(){})})).then(function(){return s.setMediaKeys(null)}).catch(function(){})},o.onManifestParsed=function(s,a){if(!this._emeEnabled)return;var l=a.levels.map(function(R){return R.audioCodec}).filter(function(R){return!!R}),c=a.levels.map(function(R){return R.videoCodec}).filter(function(R){return!!R});this._attemptKeySystemAccess(G.KeySystems.WIDEVINE,l,c)},D(h,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),h}();J.default=f},"./src/controller/fps-controller.ts":function(oe,J,k){"use strict";k.r(J);var $=k("./src/events.ts"),F=k("./src/utils/logger.ts"),B=function(){function G(D){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=D,this.registerListeners()}var H=G.prototype;return H.setStreamController=function(I){this.streamController=I},H.registerListeners=function(){this.hls.on($.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},H.unregisterListeners=function(){this.hls.off($.Events.MEDIA_ATTACHING,this.onMediaAttaching)},H.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},H.onMediaAttaching=function(I,g){var p=this.hls.config;if(p.capLevelOnFPSDrop){var f=g.media instanceof self.HTMLVideoElement?g.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)}},H.checkFPS=function(I,g,p){var f=performance.now();if(g){if(this.lastTime){var h=f-this.lastTime,o=p-this.lastDroppedFrames,d=g-this.lastDecodedFrames,s=1e3*o/h,a=this.hls;if(a.trigger($.Events.FPS_DROP,{currentDropped:o,currentDecoded:d,totalDroppedFrames:p}),s>0&&o>a.config.fpsDroppedMonitoringThreshold*d){var l=a.currentLevel;F.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+l),l>0&&(a.autoLevelCapping===-1||a.autoLevelCapping>=l)&&(l=l-1,a.trigger($.Events.FPS_DROP_LEVEL_CAPPING,{level:l,droppedLevel:a.currentLevel}),a.autoLevelCapping=l,this.streamController.nextLevelSwitch())}}this.lastTime=f,this.lastDroppedFrames=p,this.lastDecodedFrames=g}},H.checkFPSInterval=function(){var I=this.media;if(I)if(this.isVideoPlaybackQualityAvailable){var g=I.getVideoPlaybackQuality();this.checkFPS(I,g.totalVideoFrames,g.droppedVideoFrames)}else this.checkFPS(I,I.webkitDecodedFrameCount,I.webkitDroppedFrameCount)},G}();J.default=B},"./src/controller/fragment-finders.ts":function(oe,J,k){"use strict";k.r(J),k.d(J,"findFragmentByPDT",function(){return B}),k.d(J,"findFragmentByPTS",function(){return G}),k.d(J,"fragmentWithinToleranceTest",function(){return H}),k.d(J,"pdtWithinToleranceTest",function(){return D}),k.d(J,"findFragWithCC",function(){return I});var $=k("./src/polyfills/number.ts"),F=k("./src/utils/binary-search.ts");function B(g,p,f){if(p===null||!Array.isArray(g)||!g.length||!Object($.isFiniteNumber)(p))return null;var h=g[0].programDateTime;if(p<(h||0))return null;var o=g[g.length-1].endProgramDateTime;if(p>=(o||0))return null;f=f||0;for(var d=0;d<g.length;++d){var s=g[d];if(D(p,f,s))return s}return null}function G(g,p,f,h){f===void 0&&(f=0),h===void 0&&(h=0);var o=null;if(g?o=p[g.sn-p[0].sn+1]||null:f===0&&p[0].start===0&&(o=p[0]),o&&H(f,h,o)===0)return o;var d=F.default.search(p,H.bind(null,f,h));return d||o}function H(g,p,f){g===void 0&&(g=0),p===void 0&&(p=0);var h=Math.min(p,f.duration+(f.deltaPTS?f.deltaPTS:0));return f.start+f.duration-h<=g?1:f.start-h>g&&f.start?-1:0}function D(g,p,f){var h=Math.min(p,f.duration+(f.deltaPTS?f.deltaPTS:0))*1e3,o=f.endProgramDateTime||0;return o-h>g}function I(g,p){return F.default.search(g,function(f){return f.cc<p?1:f.cc>p?-1:0})}},"./src/controller/fragment-tracker.ts":function(oe,J,k){"use strict";k.r(J),k.d(J,"FragmentState",function(){return B}),k.d(J,"FragmentTracker",function(){return G});var $=k("./src/events.ts"),F=k("./src/types/loader.ts"),B;(function(I){I.NOT_LOADED="NOT_LOADED",I.BACKTRACKED="BACKTRACKED",I.APPENDING="APPENDING",I.PARTIAL="PARTIAL",I.OK="OK"})(B||(B={}));var G=function(){function I(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 g=I.prototype;return g._registerListeners=function(){var f=this.hls;f.on($.Events.BUFFER_APPENDED,this.onBufferAppended,this),f.on($.Events.FRAG_BUFFERED,this.onFragBuffered,this),f.on($.Events.FRAG_LOADED,this.onFragLoaded,this)},g._unregisterListeners=function(){var f=this.hls;f.off($.Events.BUFFER_APPENDED,this.onBufferAppended,this),f.off($.Events.FRAG_BUFFERED,this.onFragBuffered,this),f.off($.Events.FRAG_LOADED,this.onFragLoaded,this)},g.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},g.getAppendedFrag=function(f,h){if(h===F.PlaylistLevelType.MAIN){var o=this.activeFragment,d=this.activeParts;if(!o)return null;if(d)for(var s=d.length;s--;){var a=d[s],l=a?a.end:o.appendedPTS;if(a.start<=f&&l!==void 0&&f<=l)return s>9&&(this.activeParts=d.slice(s-9)),a}else if(o.start<=f&&o.appendedPTS!==void 0&&f<=o.appendedPTS)return o}return this.getBufferedFrag(f,h)},g.getBufferedFrag=function(f,h){for(var o=this.fragments,d=Object.keys(o),s=d.length;s--;){var a=o[d[s]];if((a==null?void 0:a.body.type)===h&&a.buffered){var l=a.body;if(l.start<=f&&f<=l.end)return l}}return null},g.detectEvictedFragments=function(f,h,o){var d=this;Object.keys(this.fragments).forEach(function(s){var a=d.fragments[s];if(!a)return;if(!a.buffered){a.body.type===o&&d.removeFragment(a.body);return}var l=a.range[f];if(!l)return;l.time.some(function(c){var R=!d.isTimeBuffered(c.startPTS,c.endPTS,h);return R&&d.removeFragment(a.body),R})})},g.detectPartialFragments=function(f){var h=this,o=this.timeRanges,d=f.frag,s=f.part;if(!o||d.sn==="initSegment")return;var a=D(d),l=this.fragments[a];if(!l)return;Object.keys(o).forEach(function(c){var R=d.elementaryStreams[c];if(!R)return;var w=o[c],x=s!==null||R.partial===!0;l.range[c]=h.getBufferedTimes(d,s,x,w)}),l.backtrack=l.loaded=null,Object.keys(l.range).length?l.buffered=!0:this.removeFragment(l.body)},g.fragBuffered=function(f){var h=D(f),o=this.fragments[h];o&&(o.backtrack=o.loaded=null,o.buffered=!0)},g.getBufferedTimes=function(f,h,o,d){for(var s={time:[],partial:o},a=h?h.start:f.start,l=h?h.end:f.end,c=f.minEndPTS||l,R=f.maxStartPTS||a,w=0;w<d.length;w++){var x=d.start(w)-this.bufferPadding,O=d.end(w)+this.bufferPadding;if(R>=x&&c<=O){s.time.push({startPTS:Math.max(a,d.start(w)),endPTS:Math.min(l,d.end(w))});break}else if(a<O&&l>x)s.partial=!0,s.time.push({startPTS:Math.max(a,d.start(w)),endPTS:Math.min(l,d.end(w))});else if(l<=x)break}return s},g.getPartialFragment=function(f){var h=null,o,d,s,a=0,l=this.bufferPadding,c=this.fragments;return Object.keys(c).forEach(function(R){var w=c[R];if(!w)return;H(w)&&(d=w.body.start-l,s=w.body.end+l,f>=d&&f<=s&&(o=Math.min(f-d,s-f),a<=o&&(h=w.body,a=o)))}),h},g.getState=function(f){var h=D(f),o=this.fragments[h];return o?o.buffered?H(o)?B.PARTIAL:B.OK:o.backtrack?B.BACKTRACKED:B.APPENDING:B.NOT_LOADED},g.backtrack=function(f,h){var o=D(f),d=this.fragments[o];if(!d||d.backtrack)return null;var s=d.backtrack=h||d.loaded;return d.loaded=null,s},g.getBacktrackData=function(f){var h=D(f),o=this.fragments[h];if(o){var d,s=o.backtrack;if(s!=null&&(d=s.payload)!==null&&d!==void 0&&d.byteLength)return s;this.removeFragment(f)}return null},g.isTimeBuffered=function(f,h,o){for(var d,s,a=0;a<o.length;a++){if(d=o.start(a)-this.bufferPadding,s=o.end(a)+this.bufferPadding,f>=d&&h<=s)return!0;if(h<=d)return!1}return!1},g.onFragLoaded=function(f,h){var o=h.frag,d=h.part;if(o.sn==="initSegment"||o.bitrateTest||d)return;var s=D(o);this.fragments[s]={body:o,loaded:h,backtrack:null,buffered:!1,range:Object.create(null)}},g.onBufferAppended=function(f,h){var o=this,d=h.frag,s=h.part,a=h.timeRanges;if(d.type===F.PlaylistLevelType.MAIN)if(this.activeFragment=d,s){var l=this.activeParts;l||(this.activeParts=l=[]),l.push(s)}else this.activeParts=null;this.timeRanges=a,Object.keys(a).forEach(function(c){var R=a[c];if(o.detectEvictedFragments(c,R),!s)for(var w=0;w<R.length;w++)d.appendedPTS=Math.max(R.end(w),d.appendedPTS||0)})},g.onFragBuffered=function(f,h){this.detectPartialFragments(h)},g.hasFragment=function(f){var h=D(f);return!!this.fragments[h]},g.removeFragmentsInRange=function(f,h,o){var d=this;Object.keys(this.fragments).forEach(function(s){var a=d.fragments[s];if(!a)return;if(a.buffered){var l=a.body;l.type===o&&l.start<h&&l.end>f&&d.removeFragment(l)}})},g.removeFragment=function(f){var h=D(f);f.stats.loaded=0,f.clearElementaryStreamInfo(),delete this.fragments[h]},g.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},I}();function H(I){var g,p;return I.buffered&&(((g=I.range.video)===null||g===void 0?void 0:g.partial)||((p=I.range.audio)===null||p===void 0?void 0:p.partial))}function D(I){return I.type+"_"+I.level+"_"+I.urlId+"_"+I.sn}},"./src/controller/gap-controller.ts":function(oe,J,k){"use strict";k.r(J),k.d(J,"STALL_MINIMUM_DURATION_MS",function(){return H}),k.d(J,"MAX_START_GAP_JUMP",function(){return D}),k.d(J,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return I}),k.d(J,"SKIP_BUFFER_RANGE_START",function(){return g}),k.d(J,"default",function(){return p});var $=k("./src/utils/buffer-helper.ts"),F=k("./src/errors.ts"),B=k("./src/events.ts"),G=k("./src/utils/logger.ts"),H=250,D=2,I=.1,g=.05,p=function(){function f(o,d,s,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=o,this.media=d,this.fragmentTracker=s,this.hls=a}var h=f.prototype;return h.destroy=function(){this.hls=this.fragmentTracker=this.media=null},h.poll=function(d){var s=this.config,a=this.media,l=this.stalled,c=a.currentTime,R=a.seeking,w=this.seeking&&!R,x=!this.seeking&&R;if(this.seeking=R,c!==d){if(this.moved=!0,l!==null){if(this.stallReported){var O=self.performance.now()-l;G.logger.warn("playback not stuck anymore @"+c+", after "+Math.round(O)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((x||w)&&(this.stalled=null),a.paused||a.ended||a.playbackRate===0||!$.BufferHelper.getBuffered(a).length)return;var A=$.BufferHelper.bufferInfo(a,c,0),T=A.len>0,E=A.nextStart||0;if(!T&&!E)return;if(R){var b=A.len>D,u=!E||E-c>D&&!this.fragmentTracker.getPartialFragment(c);if(b||u)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var _,m=Math.max(E,A.start||0)-c,v=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,M=v==null||((_=v.details)===null||_===void 0)?void 0:_.live,P=M?v.details.targetduration*2:D;if(m>0&&m<=P){this._trySkipBufferHole(null);return}}var K=self.performance.now();if(l===null){this.stalled=K;return}var V=K-l;!R&&V>=H&&this._reportStall(A.len);var U=$.BufferHelper.bufferInfo(a,c,s.maxBufferHole);this._tryFixBufferStall(U,V)},h._tryFixBufferStall=function(d,s){var a=this.config,l=this.fragmentTracker,c=this.media,R=c.currentTime,w=l.getPartialFragment(R);if(w){var x=this._trySkipBufferHole(w);if(x)return}d.len>a.maxBufferHole&&s>a.highBufferWatchdogPeriod*1e3&&(G.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},h._reportStall=function(d){var s=this.hls,a=this.media,l=this.stallReported;l||(this.stallReported=!0,G.logger.warn("Playback stalling at @"+a.currentTime+" due to low buffer (buffer="+d+")"),s.trigger(B.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:d}))},h._trySkipBufferHole=function(d){for(var s=this.config,a=this.hls,l=this.media,c=l.currentTime,R=0,w=$.BufferHelper.getBuffered(l),x=0;x<w.length;x++){var O=w.start(x);if(c+s.maxBufferHole>=R&&c<O){var A=Math.max(O+g,l.currentTime+I);return G.logger.warn("skipping hole, adjusting currentTime from "+c+" to "+A),this.moved=!0,this.stalled=null,l.currentTime=A,d&&a.trigger(B.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+c+" to "+A,frag:d}),A}R=w.end(x)}return 0},h._tryNudgeBuffer=function(){var d=this.config,s=this.hls,a=this.media,l=a.currentTime,c=(this.nudgeRetry||0)+1;if(this.nudgeRetry=c,c<d.nudgeMaxRetry){var R=l+c*d.nudgeOffset;G.logger.warn("Nudging 'currentTime' from "+l+" to "+R),a.currentTime=R,s.trigger(B.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else G.logger.error("Playhead still not moving while enough data buffered @"+l+" after "+d.nudgeMaxRetry+" nudges"),s.trigger(B.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},f}()},"./src/controller/id3-track-controller.ts":function(oe,J,k){"use strict";k.r(J);var $=k("./src/events.ts"),F=k("./src/utils/texttrack-utils.ts"),B=k("./src/demux/id3.ts"),G=.25,H=function(){function D(g){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=g,this._registerListeners()}var I=D.prototype;return I.destroy=function(){this._unregisterListeners()},I._registerListeners=function(){var p=this.hls;p.on($.Events.MEDIA_ATTACHED,this.onMediaAttached,this),p.on($.Events.MEDIA_DETACHING,this.onMediaDetaching,this),p.on($.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),p.on($.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},I._unregisterListeners=function(){var p=this.hls;p.off($.Events.MEDIA_ATTACHED,this.onMediaAttached,this),p.off($.Events.MEDIA_DETACHING,this.onMediaDetaching,this),p.off($.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),p.off($.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},I.onMediaAttached=function(p,f){this.media=f.media},I.onMediaDetaching=function(){if(!this.id3Track)return;Object(F.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},I.getID3Track=function(p){if(!this.media)return;for(var f=0;f<p.length;f++){var h=p[f];if(h.kind==="metadata"&&h.label==="id3")return Object(F.sendAddTrackEvent)(h,this.media),h}return this.media.addTextTrack("metadata","id3")},I.onFragParsingMetadata=function(p,f){if(!this.media)return;var h=f.frag,o=f.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var d=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,s=0;s<o.length;s++){var a=B.getID3Frames(o[s].data);if(a){var l=o[s].pts,c=s<o.length-1?o[s+1].pts:h.end,R=c-l;R<=0&&(c=l+G);for(var w=0;w<a.length;w++){var x=a[w];if(!B.isTimeStampFrame(x)){var O=new d(l,c,"");O.value=x,this.id3Track.addCue(O)}}}}},I.onBufferFlushing=function(p,f){var h=f.startOffset,o=f.endOffset,d=f.type;if(!d||d==="audio"){var s=this.id3Track;s&&Object(F.removeCuesInRange)(s,h,o)}},D}();J.default=H},"./src/controller/latency-controller.ts":function(oe,J,k){"use strict";k.r(J),k.d(J,"default",function(){return D});var $=k("./src/errors.ts"),F=k("./src/events.ts"),B=k("./src/utils/logger.ts");function G(I,g){for(var p=0;p<g.length;p++){var f=g[p];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(I,f.key,f)}}function H(I,g,p){return g&&G(I.prototype,g),p&&G(I,p),I}var D=function(){function I(p){var f=this;this.hls=void 0,this.config=void 0,this.media=null,this.levelDetails=null,this.currentTime=0,this.stallCount=0,this._latency=null,this.timeupdateHandler=function(){return f.timeupdate()},this.hls=p,this.config=p.config,this.registerListeners()}var g=I.prototype;return g.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},g.registerListeners=function(){this.hls.on(F.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(F.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(F.Events.ERROR,this.onError,this)},g.unregisterListeners=function(){this.hls.off(F.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(F.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(F.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(F.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(F.Events.ERROR,this.onError)},g.onMediaAttached=function(f,h){this.media=h.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},g.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},g.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},g.onLevelUpdated=function(f,h){var o=h.details;this.levelDetails=o,o.advanced&&this.timeupdate(),!o.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},g.onError=function(f,h){if(h.details!==$.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,B.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},g.timeupdate=function(){var f=this.media,h=this.levelDetails;if(!f||!h)return;this.currentTime=f.currentTime;var o=this.computeLatency();if(o===null)return;this._latency=o;var d=this.config,s=d.lowLatencyMode,a=d.maxLiveSyncPlaybackRate;if(!s||a===1)return;var l=this.targetLatency;if(l===null)return;var c=o-l,R=Math.min(this.maxLatency,l+h.targetduration),w=c<R;if(h.live&&w&&c>.05&&this.forwardBufferLength>1){var x=Math.min(2,Math.max(1,a)),O=Math.round(2/(1+Math.exp(-.75*c-this.edgeStalled))*20)/20;f.playbackRate=Math.min(x,Math.max(1,O))}else f.playbackRate!==1&&f.playbackRate!==0&&(f.playbackRate=1)},g.estimateLiveEdge=function(){var f=this.levelDetails;return f===null?null:f.edge+f.age},g.computeLatency=function(){var f=this.estimateLiveEdge();return f===null?null:f-this.currentTime},H(I,[{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,o=f.partHoldBack,d=f.targetduration,s=this.config,a=s.liveSyncDuration,l=s.liveSyncDurationCount,c=s.lowLatencyMode,R=this.hls.userConfig,w=c&&o||h;(R.liveSyncDuration||R.liveSyncDurationCount||w===0)&&(w=a!==void 0?a:l*d);var x=d,O=1;return w+Math.min(this.stallCount*O,x)}},{key:"liveSyncPosition",get:function(){var f=this.estimateLiveEdge(),h=this.targetLatency,o=this.levelDetails;if(f===null||h===null||o===null)return null;var d=o.edge,s=f-h-this.edgeStalled,a=d-o.totalduration,l=d-(this.config.lowLatencyMode&&o.partTarget||o.targetduration);return Math.min(Math.max(a,s),l)}},{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 o=f.buffered.length;return o?f.buffered.end(o-1):h.edge-this.currentTime}}]),I}()},"./src/controller/level-controller.ts":function(oe,J,k){"use strict";k.r(J),k.d(J,"default",function(){return s});var $=k("./src/types/level.ts"),F=k("./src/events.ts"),B=k("./src/errors.ts"),G=k("./src/utils/codecs.ts"),H=k("./src/controller/level-helper.ts"),D=k("./src/controller/base-playlist-controller.ts"),I=k("./src/types/loader.ts");function g(){return g=Object.assign||function(a){for(var l=1;l<arguments.length;l++){var c=arguments[l];for(var R in c)Object.prototype.hasOwnProperty.call(c,R)&&(a[R]=c[R])}return a},g.apply(this,arguments)}function p(a,l){for(var c=0;c<l.length;c++){var R=l[c];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(a,R.key,R)}}function f(a,l,c){return l&&p(a.prototype,l),c&&p(a,c),a}function h(a,l){a.prototype=Object.create(l.prototype),a.prototype.constructor=a,o(a,l)}function o(a,l){return o=Object.setPrototypeOf||function(R,w){return R.__proto__=w,R},o(a,l)}var d=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),s=function(a){h(l,a);function l(R){var w;return w=a.call(this,R,"[level-controller]")||this,w._levels=[],w._firstLevel=-1,w._startLevel=void 0,w.currentLevelIndex=-1,w.manualLevelIndex=-1,w.onParsedComplete=void 0,w._registerListeners(),w}var c=l.prototype;return c._registerListeners=function(){var w=this.hls;w.on(F.Events.MANIFEST_LOADED,this.onManifestLoaded,this),w.on(F.Events.LEVEL_LOADED,this.onLevelLoaded,this),w.on(F.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),w.on(F.Events.FRAG_LOADED,this.onFragLoaded,this),w.on(F.Events.ERROR,this.onError,this)},c._unregisterListeners=function(){var w=this.hls;w.off(F.Events.MANIFEST_LOADED,this.onManifestLoaded,this),w.off(F.Events.LEVEL_LOADED,this.onLevelLoaded,this),w.off(F.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),w.off(F.Events.FRAG_LOADED,this.onFragLoaded,this),w.off(F.Events.ERROR,this.onError,this)},c.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,a.prototype.destroy.call(this)},c.startLoad=function(){var w=this._levels;w.forEach(function(x){x.loadError=0}),a.prototype.startLoad.call(this)},c.onManifestLoaded=function(w,x){var O=[],A=[],T=[],E,b={},u,_=!1,m=!1,v=!1;if(x.levels.forEach(function(V){var U=V.attrs;_=_||!!(V.width&&V.height),m=m||!!V.videoCodec,v=v||!!V.audioCodec,d&&V.audioCodec&&V.audioCodec.indexOf("mp4a.40.34")!==-1&&(V.audioCodec=void 0);var S=V.bitrate+"-"+V.attrs.RESOLUTION+"-"+V.attrs.CODECS;u=b[S],u?u.url.push(V.url):(u=new $.Level(V),b[S]=u,O.push(u)),U&&(U.AUDIO&&Object(H.addGroupId)(u,"audio",U.AUDIO),U.SUBTITLES&&Object(H.addGroupId)(u,"text",U.SUBTITLES))}),(_||m)&&v&&(O=O.filter(function(V){var U=V.videoCodec,S=V.width,X=V.height;return!!U||!!(S&&X)})),O=O.filter(function(V){var U=V.audioCodec,S=V.videoCodec;return(!U||Object(G.isCodecSupportedInMp4)(U,"audio"))&&(!S||Object(G.isCodecSupportedInMp4)(S,"video"))}),x.audioTracks&&(A=x.audioTracks.filter(function(V){return!V.audioCodec||Object(G.isCodecSupportedInMp4)(V.audioCodec,"audio")}),Object(H.assignTrackIdsByGroup)(A)),x.subtitles&&(T=x.subtitles,Object(H.assignTrackIdsByGroup)(T)),O.length>0){E=O[0].bitrate,O.sort(function(V,U){return V.bitrate-U.bitrate}),this._levels=O;for(var M=0;M<O.length;M++)if(O[M].bitrate===E){this._firstLevel=M,this.log("manifest loaded, "+O.length+" level(s) found, first bitrate: "+E);break}var P=v&&!m,K={levels:O,audioTracks:A,subtitleTracks:T,firstLevel:this._firstLevel,stats:x.stats,audio:v,video:m,altAudio:!P&&A.some(function(V){return!!V.url})};this.hls.trigger(F.Events.MANIFEST_PARSED,K),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(F.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:x.url,reason:"no level with compatible codecs found in manifest"})},c.onError=function(w,x){if(a.prototype.onError.call(this,w,x),x.fatal)return;var O=x.context,A=this._levels[this.currentLevelIndex];if(O&&(O.type===I.PlaylistContextType.AUDIO_TRACK&&A.audioGroupIds&&O.groupId===A.audioGroupIds[A.urlId]||O.type===I.PlaylistContextType.SUBTITLE_TRACK&&A.textGroupIds&&O.groupId===A.textGroupIds[A.urlId])){this.redundantFailover(this.currentLevelIndex);return}var T=!1,E=!0,b;switch(x.details){case B.ErrorDetails.FRAG_LOAD_ERROR:case B.ErrorDetails.FRAG_LOAD_TIMEOUT:case B.ErrorDetails.KEY_LOAD_ERROR:case B.ErrorDetails.KEY_LOAD_TIMEOUT:if(x.frag){var u=this._levels[x.frag.level];u?(u.fragmentError++,u.fragmentError>this.hls.config.fragLoadingMaxRetry&&(b=x.frag.level)):b=x.frag.level}break;case B.ErrorDetails.LEVEL_LOAD_ERROR:case B.ErrorDetails.LEVEL_LOAD_TIMEOUT:O&&(O.deliveryDirectives&&(E=!1),b=O.level),T=!0;break;case B.ErrorDetails.REMUX_ALLOC_ERROR:b=x.level,T=!0;break}b!==void 0&&this.recoverLevel(x,b,T,E)},c.recoverLevel=function(w,x,O,A){var T=w.details,E=this._levels[x];if(E.loadError++,O){var b=this.retryLoadingOrFail(w);if(b)w.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(A){var u=E.url.length;if(u>1&&E.loadError<u)w.levelRetry=!0,this.redundantFailover(x);else if(this.manualLevelIndex===-1){var _=x===0?this._levels.length-1:x-1;this.currentLevelIndex!==_&&this._levels[_].loadError===0&&(this.warn(T+": switch to "+_),w.levelRetry=!0,this.hls.nextAutoLevel=_)}}},c.redundantFailover=function(w){var x=this._levels[w],O=x.url.length;if(O>1){var A=(x.urlId+1)%O;this.warn("Switching to redundant URL-id "+A),this._levels.forEach(function(T){T.urlId=A}),this.level=w}},c.onFragLoaded=function(w,x){var O=x.frag;if(O!==void 0&&O.type===I.PlaylistLevelType.MAIN){var A=this._levels[O.level];A!==void 0&&(A.fragmentError=0,A.loadError=0)}},c.onLevelLoaded=function(w,x){var O,A=x.level,T=x.details,E=this._levels[A];if(!E){var b;this.warn("Invalid level index "+A),(b=x.deliveryDirectives)!==null&&b!==void 0&&b.skip&&(T.deltaUpdateFailed=!0);return}A===this.currentLevelIndex?(E.fragmentError===0&&(E.loadError=0,this.retryCount=0),this.playlistLoaded(A,x,E.details)):(O=x.deliveryDirectives)!==null&&O!==void 0&&O.skip&&(T.deltaUpdateFailed=!0)},c.onAudioTrackSwitched=function(w,x){var O=this.hls.levels[this.currentLevelIndex];if(!O)return;if(O.audioGroupIds){for(var A=-1,T=this.hls.audioTracks[x.id].groupId,E=0;E<O.audioGroupIds.length;E++)if(O.audioGroupIds[E]===T){A=E;break}A!==O.urlId&&(O.urlId=A,this.startLoad())}},c.loadPlaylist=function(w){var x=this.currentLevelIndex,O=this._levels[x];if(this.canLoad&&O&&O.url.length>0){var A=O.urlId,T=O.url[A];if(w)try{T=w.addDirectives(T)}catch(E){this.warn("Could not construct new URL with HLS Delivery Directives: "+E)}this.log("Attempt loading level index "+x+(w?" at sn "+w.msn+" part "+w.part:"")+" with URL-id "+A+" "+T),this.clearTimer(),this.hls.trigger(F.Events.LEVEL_LOADING,{url:T,level:x,id:A,deliveryDirectives:w||null})}},c.removeLevel=function(w,x){var O=function(E,b){return b!==x},A=this._levels.filter(function(T,E){return E!==w?!0:T.url.length>1&&x!==void 0?(T.url=T.url.filter(O),T.audioGroupIds&&(T.audioGroupIds=T.audioGroupIds.filter(O)),T.textGroupIds&&(T.textGroupIds=T.textGroupIds.filter(O)),T.urlId=0,!0):!1}).map(function(T,E){var b=T.details;return b!=null&&b.fragments&&b.fragments.forEach(function(u){u.level=E}),T});this._levels=A,this.hls.trigger(F.Events.LEVELS_UPDATED,{levels:A})},f(l,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(w){var x,O=this._levels;if(O.length===0)return;if(this.currentLevelIndex===w&&(x=O[w])!==null&&x!==void 0&&x.details)return;if(w<0||w>=O.length){var A=w<0;if(this.hls.trigger(F.Events.ERROR,{type:B.ErrorTypes.OTHER_ERROR,details:B.ErrorDetails.LEVEL_SWITCH_ERROR,level:w,fatal:A,reason:"invalid level idx"}),A)return;w=Math.min(w,O.length-1)}this.clearTimer();var T=this.currentLevelIndex,E=O[T],b=O[w];this.log("switching to level "+w+" from "+T),this.currentLevelIndex=w;var u=g({},b,{level:w,maxBitrate:b.maxBitrate,uri:b.uri,urlId:b.urlId});delete u._urlId,this.hls.trigger(F.Events.LEVEL_SWITCHING,u);var _=b.details;if(!_||_.live){var m=this.switchParams(b.uri,E==null?void 0:E.details);this.loadPlaylist(m)}}},{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)}}]),l}(D.default)},"./src/controller/level-helper.ts":function(oe,J,k){"use strict";k.r(J),k.d(J,"addGroupId",function(){return B}),k.d(J,"assignTrackIdsByGroup",function(){return G}),k.d(J,"updatePTS",function(){return H}),k.d(J,"updateFragPTSDTS",function(){return I}),k.d(J,"mergeDetails",function(){return g}),k.d(J,"mapPartIntersection",function(){return p}),k.d(J,"mapFragmentIntersection",function(){return f}),k.d(J,"adjustSliding",function(){return h}),k.d(J,"addSliding",function(){return o}),k.d(J,"computeReloadInterval",function(){return d}),k.d(J,"getFragmentWithSN",function(){return s}),k.d(J,"getPartWith",function(){return a});var $=k("./src/polyfills/number.ts"),F=k("./src/utils/logger.ts");function B(l,c,R){switch(c){case"audio":l.audioGroupIds||(l.audioGroupIds=[]),l.audioGroupIds.push(R);break;case"text":l.textGroupIds||(l.textGroupIds=[]),l.textGroupIds.push(R);break}}function G(l){var c={};l.forEach(function(R){var w=R.groupId||"";R.id=c[w]=c[w]||0,c[w]++})}function H(l,c,R){var w=l[c],x=l[R];D(w,x)}function D(l,c){var R=c.startPTS;if(Object($.isFiniteNumber)(R)){var w=0,x;c.sn>l.sn?(w=R-l.start,x=l):(w=l.start-R,x=c),x.duration!==w&&(x.duration=w)}else if(c.sn>l.sn){var O=l.cc===c.cc;O&&l.minEndPTS?c.start=l.start+(l.minEndPTS-l.start):c.start=l.start+l.duration}else c.start=Math.max(l.start-c.duration,0)}function I(l,c,R,w,x,O){var A=w-R;A<=0&&(F.logger.warn("Fragment should have a positive duration",c),w=R+c.duration,O=x+c.duration);var T=R,E=w,b=c.startPTS,u=c.endPTS;if(Object($.isFiniteNumber)(b)){var _=Math.abs(b-R);Object($.isFiniteNumber)(c.deltaPTS)?c.deltaPTS=Math.max(_,c.deltaPTS):c.deltaPTS=_,T=Math.max(R,b),R=Math.min(R,b),x=Math.min(x,c.startDTS),E=Math.min(w,u),w=Math.max(w,u),O=Math.max(O,c.endDTS)}c.duration=w-R;var m=R-c.start;c.appendedPTS=w,c.start=c.startPTS=R,c.maxStartPTS=T,c.startDTS=x,c.endPTS=w,c.minEndPTS=E,c.endDTS=O;var v=c.sn;if(!l||v<l.startSN||v>l.endSN)return 0;var M,P=v-l.startSN,K=l.fragments;for(K[P]=c,M=P;M>0;M--)D(K[M],K[M-1]);for(M=P;M<K.length-1;M++)D(K[M],K[M+1]);return l.fragmentHint&&D(K[K.length-1],l.fragmentHint),l.PTSKnown=l.alignedSliding=!0,m}function g(l,c){for(var R=null,w=l.fragments,x=w.length-1;x>=0;x--){var O=w[x].initSegment;if(O){R=O;break}}l.fragmentHint&&delete l.fragmentHint.endPTS;var A=0,T;if(f(l,c,function(M,P){M.relurl&&(A=M.cc-P.cc),Object($.isFiniteNumber)(M.startPTS)&&Object($.isFiniteNumber)(M.endPTS)&&(P.start=P.startPTS=M.startPTS,P.startDTS=M.startDTS,P.appendedPTS=M.appendedPTS,P.maxStartPTS=M.maxStartPTS,P.endPTS=M.endPTS,P.endDTS=M.endDTS,P.minEndPTS=M.minEndPTS,P.duration=M.endPTS-M.startPTS,P.duration&&(T=P),c.PTSKnown=c.alignedSliding=!0),P.elementaryStreams=M.elementaryStreams,P.loader=M.loader,P.stats=M.stats,P.urlId=M.urlId,M.initSegment&&(P.initSegment=M.initSegment,R=M.initSegment)}),R){var E=c.fragmentHint?c.fragments.concat(c.fragmentHint):c.fragments;E.forEach(function(M){var P;(!M.initSegment||M.initSegment.relurl===((P=R)===null||P===void 0?void 0:P.relurl))&&(M.initSegment=R)})}if(c.skippedSegments&&(c.deltaUpdateFailed=c.fragments.some(function(M){return!M}),c.deltaUpdateFailed)){F.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var b=c.skippedSegments;b--;)c.fragments.shift();c.startSN=c.fragments[0].sn,c.startCC=c.fragments[0].cc}var u=c.fragments;if(A){F.logger.warn("discontinuity sliding from playlist, take drift into account");for(var _=0;_<u.length;_++)u[_].cc+=A}c.skippedSegments&&(c.startCC=c.fragments[0].cc),p(l.partList,c.partList,function(M,P){P.elementaryStreams=M.elementaryStreams,P.stats=M.stats}),T?I(c,T,T.startPTS,T.endPTS,T.startDTS,T.endDTS):h(l,c),u.length&&(c.totalduration=c.edge-u[0].start),c.driftStartTime=l.driftStartTime,c.driftStart=l.driftStart;var m=c.advancedDateTime;if(c.advanced&&m){var v=c.edge;c.driftStart||(c.driftStartTime=m,c.driftStart=v),c.driftEndTime=m,c.driftEnd=v}else c.driftEndTime=l.driftEndTime,c.driftEnd=l.driftEnd,c.advancedDateTime=l.advancedDateTime}function p(l,c,R){if(l&&c)for(var w=0,x=0,O=l.length;x<=O;x++){var A=l[x],T=c[x+w];A&&T&&A.index===T.index&&A.fragment.sn===T.fragment.sn?R(A,T):w--}}function f(l,c,R){for(var w=c.skippedSegments,x=Math.max(l.startSN,c.startSN)-c.startSN,O=(l.fragmentHint?1:0)+(w?c.endSN:Math.min(l.endSN,c.endSN))-c.startSN,A=c.startSN-l.startSN,T=c.fragmentHint?c.fragments.concat(c.fragmentHint):c.fragments,E=l.fragmentHint?l.fragments.concat(l.fragmentHint):l.fragments,b=x;b<=O;b++){var u=E[A+b],_=T[b];w&&!_&&b<w&&(_=c.fragments[b]=u),u&&_&&R(u,_)}}function h(l,c){var R=c.startSN+c.skippedSegments-l.startSN,w=l.fragments;if(R<0||R>=w.length)return;o(c,w[R].start)}function o(l,c){if(c){for(var R=l.fragments,w=l.skippedSegments;w<R.length;w++)R[w].start+=c;l.fragmentHint&&(l.fragmentHint.start+=c)}}function d(l,c){var R=1e3*l.levelTargetDuration,w=R/2,x=l.age,O=x>0&&x<R*3,A=c.loading.end-c.loading.start,T,E=l.availabilityDelay;if(l.updated===!1)if(O){var b=333*l.misses;T=Math.max(Math.min(w,A*2),b),l.availabilityDelay=(l.availabilityDelay||0)+T}else T=w;else O?(E=Math.min(E||R/2,x),l.availabilityDelay=E,T=E+R-x):T=R-A;return Math.round(T)}function s(l,c,R){if(!l||!l.details)return null;var w=l.details,x=w.fragments[c-w.startSN];return x||(x=w.fragmentHint,x&&x.sn===c?x:c<w.startSN&&R&&R.sn===c?R:null)}function a(l,c,R){if(!l||!l.details)return null;var w=l.details.partList;if(w)for(var x=w.length;x--;){var O=w[x];if(O.index===R&&O.fragment.sn===c)return O}return null}},"./src/controller/stream-controller.ts":function(oe,J,k){"use strict";k.r(J),k.d(J,"default",function(){return w});var $=k("./src/polyfills/number.ts"),F=k("./src/controller/base-stream-controller.ts"),B=k("./src/is-supported.ts"),G=k("./src/events.ts"),H=k("./src/utils/buffer-helper.ts"),D=k("./src/controller/fragment-tracker.ts"),I=k("./src/types/loader.ts"),g=k("./src/loader/fragment.ts"),p=k("./src/demux/transmuxer-interface.ts"),f=k("./src/types/transmuxer.ts"),h=k("./src/controller/gap-controller.ts"),o=k("./src/errors.ts"),d=k("./src/utils/logger.ts");function s(x,O){for(var A=0;A<O.length;A++){var T=O[A];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(x,T.key,T)}}function a(x,O,A){return O&&s(x.prototype,O),A&&s(x,A),x}function l(x,O){x.prototype=Object.create(O.prototype),x.prototype.constructor=x,c(x,O)}function c(x,O){return c=Object.setPrototypeOf||function(T,E){return T.__proto__=E,T},c(x,O)}var R=100,w=function(x){l(O,x);function O(T,E){var b;return b=x.call(this,T,E,"[stream-controller]")||this,b.audioCodecSwap=!1,b.gapController=null,b.level=-1,b._forceStartLoad=!1,b.altAudio=!1,b.audioOnly=!1,b.fragPlaying=null,b.onvplaying=null,b.onvseeked=null,b.fragLastKbps=0,b.stalled=!1,b.couldBacktrack=!1,b.audioCodecSwitch=!1,b.videoBuffer=null,b._registerListeners(),b}var A=O.prototype;return A._registerListeners=function(){var E=this.hls;E.on(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),E.on(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this),E.on(G.Events.MANIFEST_LOADING,this.onManifestLoading,this),E.on(G.Events.MANIFEST_PARSED,this.onManifestParsed,this),E.on(G.Events.LEVEL_LOADING,this.onLevelLoading,this),E.on(G.Events.LEVEL_LOADED,this.onLevelLoaded,this),E.on(G.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),E.on(G.Events.ERROR,this.onError,this),E.on(G.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),E.on(G.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),E.on(G.Events.BUFFER_CREATED,this.onBufferCreated,this),E.on(G.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),E.on(G.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),E.on(G.Events.FRAG_BUFFERED,this.onFragBuffered,this)},A._unregisterListeners=function(){var E=this.hls;E.off(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),E.off(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this),E.off(G.Events.MANIFEST_LOADING,this.onManifestLoading,this),E.off(G.Events.MANIFEST_PARSED,this.onManifestParsed,this),E.off(G.Events.LEVEL_LOADED,this.onLevelLoaded,this),E.off(G.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),E.off(G.Events.ERROR,this.onError,this),E.off(G.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),E.off(G.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),E.off(G.Events.BUFFER_CREATED,this.onBufferCreated,this),E.off(G.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),E.off(G.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),E.off(G.Events.FRAG_BUFFERED,this.onFragBuffered,this)},A.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},A.startLoad=function(E){if(this.levels){var b=this.lastCurrentTime,u=this.hls;if(this.stopLoad(),this.setInterval(R),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var _=u.startLevel;_===-1&&(u.config.testBandwidth?(_=0,this.bitrateTest=!0):_=u.nextAutoLevel),this.level=u.nextLoadLevel=_,this.loadedmetadata=!1}b>0&&E===-1&&(this.log("Override startPosition with lastCurrentTime @"+b.toFixed(3)),E=b),this.state=F.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=E,this.tick()}else this._forceStartLoad=!0,this.state=F.State.STOPPED},A.stopLoad=function(){this._forceStartLoad=!1,x.prototype.stopLoad.call(this)},A.doTick=function(){switch(this.state){case F.State.IDLE:this.doTickIdle();break;case F.State.WAITING_LEVEL:{var E,b=this.levels,u=this.level,_=b==null||((E=b[u])===null||E===void 0)?void 0:E.details;if(_&&(!_.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(_))break;this.state=F.State.IDLE;break}break}case F.State.FRAG_LOADING_WAITING_RETRY:{var m,v=self.performance.now(),M=this.retryDate;(!M||v>=M||(m=this.media)!==null&&m!==void 0&&m.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=F.State.IDLE)}break;default:break}this.onTickEnd()},A.onTickEnd=function(){x.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},A.doTickIdle=function(){var E,b,u=this.hls,_=this.levelLastLoaded,m=this.levels,v=this.media,M=u.config,P=u.nextLoadLevel;if(_===null||!v&&(this.startFragRequested||!M.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!m||!m[P])return;var K=m[P];this.level=u.nextLoadLevel=P;var V=K.details;if(!V||this.state===F.State.WAITING_LEVEL||V.live&&this.levelLastLoaded!==P){this.state=F.State.WAITING_LEVEL;return}var U=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:v,I.PlaylistLevelType.MAIN);if(U===null)return;var S=U.len,X=this.getMaxBufferLength(K.maxBitrate);if(S>=X)return;if(this._streamEnded(U,V)){var ee={};this.altAudio&&(ee.type="video"),this.hls.trigger(G.Events.BUFFER_EOS,ee),this.state=F.State.ENDED;return}var ae=U.end,de=this.getNextFragment(ae,V);if(this.couldBacktrack&&!this.fragPrevious&&de&&de.sn!=="initSegment"){var Ae=de.sn-V.startSN;Ae>1&&(de=V.fragments[Ae-1],this.fragmentTracker.removeFragment(de))}if(de&&this.fragmentTracker.getState(de)===D.FragmentState.OK&&this.nextLoadPosition>ae){var Ee=this.audioOnly&&!this.altAudio?g.ElementaryStreamTypes.AUDIO:g.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(v,Ee,I.PlaylistLevelType.MAIN),de=this.getNextFragment(this.nextLoadPosition,V)}if(!de)return;de.initSegment&&!de.initSegment.data&&!this.bitrateTest&&(de=de.initSegment),((E=de.decryptdata)===null||E===void 0?void 0:E.keyFormat)==="identity"&&!((b=de.decryptdata)!==null&&b!==void 0&&b.key)?this.loadKey(de,V):this.loadFragment(de,V,ae)},A.loadFragment=function(E,b,u){var _,m=this.fragmentTracker.getState(E);if(this.fragCurrent=E,m===D.FragmentState.BACKTRACKED){var v=this.fragmentTracker.getBacktrackData(E);if(v){this._handleFragmentLoadProgress(v),this._handleFragmentLoadComplete(v);return}else m=D.FragmentState.NOT_LOADED}m===D.FragmentState.NOT_LOADED||m===D.FragmentState.PARTIAL?E.sn==="initSegment"?this._loadInitSegment(E):this.bitrateTest?(E.bitrateTest=!0,this.log("Fragment "+E.sn+" of level "+E.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(E)):(this.startFragRequested=!0,x.prototype.loadFragment.call(this,E,b,u)):m===D.FragmentState.APPENDING?this.reduceMaxBufferLength(E.duration)&&this.fragmentTracker.removeFragment(E):((_=this.media)===null||_===void 0?void 0:_.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},A.getAppendedFrag=function(E){var b=this.fragmentTracker.getAppendedFrag(E,I.PlaylistLevelType.MAIN);return b&&"fragment"in b?b.fragment:b},A.getBufferedFrag=function(E){return this.fragmentTracker.getBufferedFrag(E,I.PlaylistLevelType.MAIN)},A.followingBufferedFrag=function(E){return E?this.getBufferedFrag(E.end+.5):null},A.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},A.nextLevelSwitch=function(){var E=this.levels,b=this.media;if(b!=null&&b.readyState){var u,_=this.getAppendedFrag(b.currentTime);if(_&&_.start>1&&this.flushMainBuffer(0,_.start-1),!b.paused&&E){var m=this.hls.nextLoadLevel,v=E[m],M=this.fragLastKbps;M&&this.fragCurrent?u=this.fragCurrent.duration*v.maxBitrate/(1e3*M)+1:u=0}else u=0;var P=this.getBufferedFrag(b.currentTime+u);if(P){var K=this.followingBufferedFrag(P);if(K){this.abortCurrentFrag();var V=K.maxStartPTS?K.maxStartPTS:K.start,U=K.duration,S=Math.max(P.end,V+Math.min(Math.max(U-this.config.maxFragLookUpTolerance,U*.5),U*.75));this.flushMainBuffer(S,Number.POSITIVE_INFINITY)}}}},A.abortCurrentFrag=function(){var E=this.fragCurrent;this.fragCurrent=null,E!=null&&E.loader&&E.loader.abort(),this.state===F.State.KEY_LOADING&&(this.state=F.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},A.flushMainBuffer=function(E,b){x.prototype.flushMainBuffer.call(this,E,b,this.altAudio?"video":null)},A.onMediaAttached=function(E,b){x.prototype.onMediaAttached.call(this,E,b);var u=b.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),u.addEventListener("playing",this.onvplaying),u.addEventListener("seeked",this.onvseeked),this.gapController=new h.default(this.config,u,this.fragmentTracker,this.hls)},A.onMediaDetaching=function(){var E=this.media;E&&(E.removeEventListener("playing",this.onvplaying),E.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),x.prototype.onMediaDetaching.call(this)},A.onMediaPlaying=function(){this.tick()},A.onMediaSeeked=function(){var E=this.media,b=E?E.currentTime:null;Object($.isFiniteNumber)(b)&&this.log("Media seeked to "+b.toFixed(3)),this.tick()},A.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(G.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},A.onManifestParsed=function(E,b){var u=!1,_=!1,m;b.levels.forEach(function(v){m=v.audioCodec,m&&(m.indexOf("mp4a.40.2")!==-1&&(u=!0),m.indexOf("mp4a.40.5")!==-1&&(_=!0))}),this.audioCodecSwitch=u&&_&&!Object(B.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=b.levels,this.startFragRequested=!1},A.onLevelLoading=function(E,b){var u=this.levels;if(!u||this.state!==F.State.IDLE)return;var _=u[b.level];(!_.details||_.details.live&&this.levelLastLoaded!==b.level||this.waitForCdnTuneIn(_.details))&&(this.state=F.State.WAITING_LEVEL)},A.onLevelLoaded=function(E,b){var u,_=this.levels,m=b.level,v=b.details,M=v.totalduration;if(!_){this.warn("Levels were reset while loading level "+m);return}this.log("Level "+m+" loaded ["+v.startSN+","+v.endSN+"], cc ["+v.startCC+", "+v.endCC+"] duration:"+M);var P=this.fragCurrent;P&&(this.state===F.State.FRAG_LOADING||this.state===F.State.FRAG_LOADING_WAITING_RETRY)&&(P.level!==b.level&&P.loader&&(this.state=F.State.IDLE,P.loader.abort()));var K=_[m],V=0;if(v.live||(u=K.details)!==null&&u!==void 0&&u.live){if(v.fragments[0]||(v.deltaUpdateFailed=!0),v.deltaUpdateFailed)return;V=this.alignPlaylists(v,K.details)}if(K.details=v,this.levelLastLoaded=m,this.hls.trigger(G.Events.LEVEL_UPDATED,{details:v,level:m}),this.state===F.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(v))return;this.state=F.State.IDLE}this.startFragRequested?v.live&&this.synchronizeToLiveEdge(v):this.setStartPosition(v,V),this.tick()},A._handleFragmentLoadProgress=function(E){var b,u=E.frag,_=E.part,m=E.payload,v=this.levels;if(!v){this.warn("Levels were reset while fragment load was in progress. Fragment "+u.sn+" of level "+u.level+" will not be buffered");return}var M=v[u.level],P=M.details;if(!P){this.warn("Dropping fragment "+u.sn+" of level "+u.level+" after level details were reset");return}var K=M.videoCodec,V=P.PTSKnown||!P.live,U=(b=u.initSegment)===null||b===void 0?void 0:b.data,S=this._getAudioCodec(M),X=this.transmuxer=this.transmuxer||new p.default(this.hls,I.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),ee=_?_.index:-1,ae=ee!==-1,de=new f.ChunkMetadata(u.level,u.sn,u.stats.chunkCount,m.byteLength,ee,ae),Ae=this.initPTS[u.cc];X.push(m,U,S,K,u,_,P.totalduration,V,de,Ae)},A.onAudioTrackSwitching=function(E,b){var u=this.altAudio,_=!!b.url,m=b.id;if(!_){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var v=this.fragCurrent;v!=null&&v.loader&&(this.log("Switching to main audio track, cancel main fragment load"),v.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var M=this.hls;u&&M.trigger(G.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),M.trigger(G.Events.AUDIO_TRACK_SWITCHED,{id:m})}},A.onAudioTrackSwitched=function(E,b){var u=b.id,_=!!this.hls.audioTracks[u].url;if(_){var m=this.videoBuffer;m&&this.mediaBuffer!==m&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=m)}this.altAudio=_,this.tick()},A.onBufferCreated=function(E,b){var u=b.tracks,_,m,v=!1;for(var M in u){var P=u[M];if(P.id==="main"){if(m=M,_=P,M==="video"){var K=u[M];K&&(this.videoBuffer=K.buffer)}}else v=!0}v&&_?(this.log("Alternate track found, use "+m+".buffered to schedule main fragment loading"),this.mediaBuffer=_.buffer):this.mediaBuffer=this.media},A.onFragBuffered=function(E,b){var u=b.frag,_=b.part;if(u&&u.type!==I.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(u)){this.warn("Fragment "+u.sn+(_?" p: "+_.index:"")+" of level "+u.level+" finished buffering, but was aborted. state: "+this.state),this.state===F.State.PARSED&&(this.state=F.State.IDLE);return}var m=_?_.stats:u.stats;this.fragLastKbps=Math.round(8*m.total/(m.buffering.end-m.loading.first)),u.sn!=="initSegment"&&(this.fragPrevious=u),this.fragBufferedComplete(u,_)},A.onError=function(E,b){switch(b.details){case o.ErrorDetails.FRAG_LOAD_ERROR:case o.ErrorDetails.FRAG_LOAD_TIMEOUT:case o.ErrorDetails.KEY_LOAD_ERROR:case o.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(I.PlaylistLevelType.MAIN,b);break;case o.ErrorDetails.LEVEL_LOAD_ERROR:case o.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==F.State.ERROR&&(b.fatal?(this.warn(""+b.details),this.state=F.State.ERROR):!b.levelRetry&&this.state===F.State.WAITING_LEVEL&&(this.state=F.State.IDLE));break;case o.ErrorDetails.BUFFER_FULL_ERROR:if(b.parent==="main"&&(this.state===F.State.PARSING||this.state===F.State.PARSED)){var u=!0,_=this.getFwdBufferInfo(this.media,I.PlaylistLevelType.MAIN);_&&_.len>.5&&(u=!this.reduceMaxBufferLength(_.len)),u&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},A.checkBuffer=function(){var E=this.media,b=this.gapController;if(!E||!b||!E.readyState)return;var u=H.BufferHelper.getBuffered(E);!this.loadedmetadata&&u.length?(this.loadedmetadata=!0,this.seekToStartPos()):b.poll(this.lastCurrentTime),this.lastCurrentTime=E.currentTime},A.onFragLoadEmergencyAborted=function(){this.state=F.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},A.onBufferFlushed=function(E,b){var u=b.type;if(u!==g.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var _=(u===g.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(_,u,I.PlaylistLevelType.MAIN)}},A.onLevelsUpdated=function(E,b){this.levels=b.levels},A.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},A.seekToStartPos=function(){var E=this.media,b=E.currentTime,u=this.startPosition;if(u>=0&&b<u){if(E.seeking){d.logger.log("could not seek to "+u+", already seeking at "+b);return}var _=H.BufferHelper.getBuffered(E),m=_.length?_.start(0):0,v=m-u;v>0&&(v<this.config.maxBufferHole||v<this.config.maxFragLookUpTolerance)&&(d.logger.log("adjusting start position by "+v+" to match buffer start"),u+=v,this.startPosition=u),this.log("seek to target start position "+u+" from current time "+b),E.currentTime=u}},A._getAudioCodec=function(E){var b=this.config.defaultAudioCodec||E.audioCodec;return this.audioCodecSwap&&b&&(this.log("Swapping audio codec"),b.indexOf("mp4a.40.5")!==-1?b="mp4a.40.2":b="mp4a.40.5"),b},A._loadBitrateTestFrag=function(E){var b=this;this._doFragLoad(E).then(function(u){var _=b.hls;if(!u||_.nextLoadLevel||b.fragContextChanged(E))return;b.fragLoadError=0,b.state=F.State.IDLE,b.startFragRequested=!1,b.bitrateTest=!1;var m=E.stats;m.parsing.start=m.parsing.end=m.buffering.start=m.buffering.end=self.performance.now(),_.trigger(G.Events.FRAG_LOADED,u)})},A._handleTransmuxComplete=function(E){var b,u="main",_=this.hls,m=E.remuxResult,v=E.chunkMeta,M=this.getCurrentContext(v);if(!M){this.warn("The loading context changed while buffering fragment "+v.sn+" of level "+v.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(v.level);return}var P=M.frag,K=M.part,V=M.level,U=m.video,S=m.text,X=m.id3,ee=m.initSegment,ae=this.altAudio?void 0:m.audio;if(this.fragContextChanged(P))return;if(this.state=F.State.PARSING,ee){ee.tracks&&(this._bufferInitSegment(V,ee.tracks,P,v),_.trigger(G.Events.FRAG_PARSING_INIT_SEGMENT,{frag:P,id:u,tracks:ee.tracks}));var de=ee.initPTS,Ae=ee.timescale;Object($.isFiniteNumber)(de)&&(this.initPTS[P.cc]=de,_.trigger(G.Events.INIT_PTS_FOUND,{frag:P,id:u,initPTS:de,timescale:Ae}))}if(U&&m.independent!==!1){if(V.details){var Ee=U.startPTS,we=U.endPTS,he=U.startDTS,ce=U.endDTS;if(K)K.elementaryStreams[U.type]={startPTS:Ee,endPTS:we,startDTS:he,endDTS:ce};else if(U.firstKeyFrame&&U.independent&&(this.couldBacktrack=!0),U.dropped&&U.independent){var se=this.getLoadPosition()+this.config.maxBufferHole;if(se<Ee){this.backtrack(P);return}P.setElementaryStreamInfo(U.type,P.start,we,P.start,ce,!0)}P.setElementaryStreamInfo(U.type,Ee,we,he,ce),this.bufferFragmentData(U,P,K,v)}}else if(m.independent===!1){this.backtrack(P);return}if(ae){var re=ae.startPTS,xe=ae.endPTS,be=ae.startDTS,ke=ae.endDTS;K&&(K.elementaryStreams[g.ElementaryStreamTypes.AUDIO]={startPTS:re,endPTS:xe,startDTS:be,endDTS:ke}),P.setElementaryStreamInfo(g.ElementaryStreamTypes.AUDIO,re,xe,be,ke),this.bufferFragmentData(ae,P,K,v)}if(X!=null&&(b=X.samples)!==null&&b!==void 0&&b.length){var Oe={frag:P,id:u,samples:X.samples};_.trigger(G.Events.FRAG_PARSING_METADATA,Oe)}if(S){var Be={frag:P,id:u,samples:S.samples};_.trigger(G.Events.FRAG_PARSING_USERDATA,Be)}},A._bufferInitSegment=function(E,b,u,_){var m=this;if(this.state!==F.State.PARSING)return;this.audioOnly=!!b.audio&&!b.video,this.altAudio&&!this.audioOnly&&delete b.audio;var v=b.audio,M=b.video,P=b.audiovideo;if(v){var K=E.audioCodec,V=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(K&&(K.indexOf("mp4a.40.5")!==-1?K="mp4a.40.2":K="mp4a.40.5"),v.metadata.channelCount!==1&&V.indexOf("firefox")===-1&&(K="mp4a.40.5")),V.indexOf("android")!==-1&&v.container!=="audio/mpeg"&&(K="mp4a.40.2",this.log("Android: force audio codec to "+K)),E.audioCodec&&E.audioCodec!==K&&this.log('Swapping manifest audio codec "'+E.audioCodec+'" for "'+K+'"'),v.levelCodec=K,v.id="main",this.log("Init audio buffer, container:"+v.container+", codecs[selected/level/parsed]=["+(K||"")+"/"+(E.audioCodec||"")+"/"+v.codec+"]")}M&&(M.levelCodec=E.videoCodec,M.id="main",this.log("Init video buffer, container:"+M.container+", codecs[level/parsed]=["+(E.videoCodec||"")+"/"+M.codec+"]")),P&&this.log("Init audiovideo buffer, container:"+P.container+", codecs[level/parsed]=["+(E.attrs.CODECS||"")+"/"+P.codec+"]"),this.hls.trigger(G.Events.BUFFER_CODECS,b),Object.keys(b).forEach(function(U){var S=b[U],X=S.initSegment;X!=null&&X.byteLength&&m.hls.trigger(G.Events.BUFFER_APPENDING,{type:U,data:X,frag:u,part:null,chunkMeta:_,parent:u.type})}),this.tick()},A.backtrack=function(E){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(E);var b=this.fragmentTracker.backtrack(E);this.fragPrevious=null,this.nextLoadPosition=E.start,b?this.resetFragmentLoading(E):this.state=F.State.BACKTRACKING},A.checkFragmentChanged=function(){var E=this.media,b=null;if(E&&E.readyState>1&&E.seeking===!1){var u=E.currentTime;if(H.BufferHelper.isBuffered(E,u)?b=this.getAppendedFrag(u):H.BufferHelper.isBuffered(E,u+.1)&&(b=this.getAppendedFrag(u+.1)),b){var _=this.fragPlaying,m=b.level;(!_||b.sn!==_.sn||_.level!==m||b.urlId!==_.urlId)&&(this.hls.trigger(G.Events.FRAG_CHANGED,{frag:b}),(!_||_.level!==m)&&this.hls.trigger(G.Events.LEVEL_SWITCHED,{level:m}),this.fragPlaying=b)}}},a(O,[{key:"nextLevel",get:function(){var E=this.nextBufferedFrag;return E?E.level:-1}},{key:"currentLevel",get:function(){var E=this.media;if(E){var b=this.getAppendedFrag(E.currentTime);if(b)return b.level}return-1}},{key:"nextBufferedFrag",get:function(){var E=this.media;if(E){var b=this.getAppendedFrag(E.currentTime);return this.followingBufferedFrag(b)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),O}(F.default)},"./src/controller/subtitle-stream-controller.ts":function(oe,J,k){"use strict";k.r(J),k.d(J,"SubtitleStreamController",function(){return l});var $=k("./src/events.ts"),F=k("./src/utils/logger.ts"),B=k("./src/utils/buffer-helper.ts"),G=k("./src/controller/fragment-finders.ts"),H=k("./src/utils/discontinuities.ts"),D=k("./src/controller/level-helper.ts"),I=k("./src/controller/fragment-tracker.ts"),g=k("./src/controller/base-stream-controller.ts"),p=k("./src/types/loader.ts"),f=k("./src/types/level.ts");function h(c,R){for(var w=0;w<R.length;w++){var x=R[w];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(c,x.key,x)}}function o(c,R,w){return R&&h(c.prototype,R),w&&h(c,w),c}function d(c,R){c.prototype=Object.create(R.prototype),c.prototype.constructor=c,s(c,R)}function s(c,R){return s=Object.setPrototypeOf||function(x,O){return x.__proto__=O,x},s(c,R)}var a=500,l=function(c){d(R,c);function R(x,O){var A;return A=c.call(this,x,O,"[subtitle-stream-controller]")||this,A.levels=[],A.currentTrackId=-1,A.tracksBuffered=[],A.mainDetails=null,A._registerListeners(),A}var w=R.prototype;return w.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},w._registerListeners=function(){var O=this.hls;O.on($.Events.MEDIA_ATTACHED,this.onMediaAttached,this),O.on($.Events.MEDIA_DETACHING,this.onMediaDetaching,this),O.on($.Events.MANIFEST_LOADING,this.onManifestLoading,this),O.on($.Events.LEVEL_LOADED,this.onLevelLoaded,this),O.on($.Events.ERROR,this.onError,this),O.on($.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),O.on($.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),O.on($.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),O.on($.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),O.on($.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},w._unregisterListeners=function(){var O=this.hls;O.off($.Events.MEDIA_ATTACHED,this.onMediaAttached,this),O.off($.Events.MEDIA_DETACHING,this.onMediaDetaching,this),O.off($.Events.MANIFEST_LOADING,this.onManifestLoading,this),O.off($.Events.LEVEL_LOADED,this.onLevelLoaded,this),O.off($.Events.ERROR,this.onError,this),O.off($.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),O.off($.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),O.off($.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),O.off($.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),O.off($.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},w.startLoad=function(){this.stopLoad(),this.state=g.State.IDLE,this.setInterval(a),this.tick()},w.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},w.onLevelLoaded=function(O,A){this.mainDetails=A.details},w.onSubtitleFragProcessed=function(O,A){var T=A.frag,E=A.success;if(this.fragPrevious=T,this.state=g.State.IDLE,!E)return;var b=this.tracksBuffered[this.currentTrackId];if(!b)return;for(var u,_=T.start,m=0;m<b.length;m++)if(_>=b[m].start&&_<=b[m].end){u=b[m];break}var v=T.start+T.duration;u?u.end=v:(u={start:_,end:v},b.push(u)),this.fragmentTracker.fragBuffered(T)},w.onBufferFlushing=function(O,A){var T=A.startOffset,E=A.endOffset;if(T===0&&E!==Number.POSITIVE_INFINITY){var b=this.currentTrackId,u=this.levels;if(!u.length||!u[b]||!u[b].details)return;var _=u[b].details,m=_.targetduration,v=E-m;if(v<=0)return;A.endOffsetSubtitles=Math.max(0,v),this.tracksBuffered.forEach(function(M){for(var P=0;P<M.length;){if(M[P].end<=v){M.shift();continue}else if(M[P].start<v)M[P].start=v;else break;P++}}),this.fragmentTracker.removeFragmentsInRange(T,v,p.PlaylistLevelType.SUBTITLE)}},w.onError=function(O,A){var T,E=A.frag;if(!E||E.type!==p.PlaylistLevelType.SUBTITLE)return;(T=this.fragCurrent)!==null&&T!==void 0&&T.loader&&this.fragCurrent.loader.abort(),this.state=g.State.IDLE},w.onSubtitleTracksUpdated=function(O,A){var T=this,E=A.subtitleTracks;this.tracksBuffered=[],this.levels=E.map(function(b){return new f.Level(b)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(b){T.tracksBuffered[b.id]=[]}),this.mediaBuffer=null},w.onSubtitleTrackSwitch=function(O,A){if(this.currentTrackId=A.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var T=this.levels[this.currentTrackId];T!=null&&T.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,T&&this.setInterval(a)},w.onSubtitleTrackLoaded=function(O,A){var T,E=A.details,b=A.id,u=this.currentTrackId,_=this.levels;if(!_.length)return;var m=_[u];if(b>=_.length||b!==u||!m)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,E.live||(T=m.details)!==null&&T!==void 0&&T.live){var v=this.mainDetails;if(E.deltaUpdateFailed||!v)return;var M=v.fragments[0];if(!m.details)E.hasProgramDateTime&&v.hasProgramDateTime?Object(H.alignMediaPlaylistByPDT)(E,v):M&&Object(D.addSliding)(E,M.start);else{var P=this.alignPlaylists(E,m.details);P===0&&M&&Object(D.addSliding)(E,M.start)}}if(m.details=E,this.levelLastLoaded=b,this.tick(),E.live&&!this.fragCurrent&&this.media&&this.state===g.State.IDLE){var K=Object(G.findFragmentByPTS)(null,E.fragments,this.media.currentTime,0);K||(this.warn("Subtitle playlist not aligned with playback"),m.details=void 0)}},w._handleFragmentLoadComplete=function(O){var A=O.frag,T=O.payload,E=A.decryptdata,b=this.hls;if(this.fragContextChanged(A))return;if(T&&T.byteLength>0&&E&&E.key&&E.iv&&E.method==="AES-128"){var u=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(T),E.key.buffer,E.iv.buffer).then(function(_){var m=performance.now();b.trigger($.Events.FRAG_DECRYPTED,{frag:A,payload:_,stats:{tstart:u,tdecrypt:m}})})}},w.doTick=function(){if(!this.media){this.state=g.State.IDLE;return}if(this.state===g.State.IDLE){var O,A=this.currentTrackId,T=this.levels;if(!T.length||!T[A]||!T[A].details)return;var E=T[A].details,b=E.targetduration,u=this.config,_=this.media,m=B.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,_.currentTime-b,u.maxBufferHole),v=m.end,M=m.len,P=this.getMaxBufferLength()+b;if(M>P)return;console.assert(E,"Subtitle track details are defined on idle subtitle stream controller tick");var K=E.fragments,V=K.length,U=E.edge,S,X=this.fragPrevious;if(v<U){var ee=u.maxFragLookUpTolerance;X&&E.hasProgramDateTime&&(S=Object(G.findFragmentByPDT)(K,X.endProgramDateTime,ee)),S||(S=Object(G.findFragmentByPTS)(X,K,v,ee),!S&&X&&X.start<K[0].start&&(S=K[0]))}else S=K[V-1];(O=S)!==null&&O!==void 0&&O.encrypted?(F.logger.log("Loading key for "+S.sn),this.state=g.State.KEY_LOADING,this.hls.trigger($.Events.KEY_LOADING,{frag:S})):S&&this.fragmentTracker.getState(S)===I.FragmentState.NOT_LOADED&&this.loadFragment(S,E,v)}},w.loadFragment=function(O,A,T){this.fragCurrent=O,c.prototype.loadFragment.call(this,O,A,T)},o(R,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),R}(g.default)},"./src/controller/subtitle-track-controller.ts":function(oe,J,k){"use strict";k.r(J);var $=k("./src/events.ts"),F=k("./src/utils/texttrack-utils.ts"),B=k("./src/controller/base-playlist-controller.ts"),G=k("./src/types/loader.ts");function H(h,o){for(var d=0;d<o.length;d++){var s=o[d];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(h,s.key,s)}}function D(h,o,d){return o&&H(h.prototype,o),d&&H(h,d),h}function I(h,o){h.prototype=Object.create(o.prototype),h.prototype.constructor=h,g(h,o)}function g(h,o){return g=Object.setPrototypeOf||function(s,a){return s.__proto__=a,s},g(h,o)}var p=function(h){I(o,h);function o(s){var a;return a=h.call(this,s,"[subtitle-track-controller]")||this,a.media=null,a.tracks=[],a.groupId=null,a.tracksInGroup=[],a.trackId=-1,a.selectDefaultTrack=!0,a.queuedDefaultTrack=-1,a.trackChangeListener=function(){return a.onTextTracksChanged()},a.asyncPollTrackChange=function(){return a.pollTrackChange(0)},a.useTextTrackPolling=!1,a.subtitlePollingInterval=-1,a.subtitleDisplay=!0,a.registerListeners(),a}var d=o.prototype;return d.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,h.prototype.destroy.call(this)},d.registerListeners=function(){var a=this.hls;a.on($.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.on($.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.on($.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.on($.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.on($.Events.LEVEL_LOADING,this.onLevelLoading,this),a.on($.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),a.on($.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),a.on($.Events.ERROR,this.onError,this)},d.unregisterListeners=function(){var a=this.hls;a.off($.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.off($.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.off($.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.off($.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.off($.Events.LEVEL_LOADING,this.onLevelLoading,this),a.off($.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),a.off($.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),a.off($.Events.ERROR,this.onError,this)},d.onMediaAttached=function(a,l){if(this.media=l.media,!this.media)return;this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange)},d.pollTrackChange=function(a){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,a)},d.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(l){Object(F.clearCurrentCues)(l)}),this.subtitleTrack=-1,this.media=null},d.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},d.onManifestParsed=function(a,l){this.tracks=l.subtitleTracks},d.onSubtitleTrackLoaded=function(a,l){var c=l.id,R=l.details,w=this.trackId,x=this.tracksInGroup[w];if(!x){this.warn("Invalid subtitle track id "+c);return}var O=x.details;x.details=l.details,this.log("subtitle track "+c+" loaded ["+R.startSN+"-"+R.endSN+"]"),c===this.trackId&&(this.retryCount=0,this.playlistLoaded(c,l,O))},d.onLevelLoading=function(a,l){this.switchLevel(l.level)},d.onLevelSwitching=function(a,l){this.switchLevel(l.level)},d.switchLevel=function(a){var l=this.hls.levels[a];if(!(l!=null&&l.textGroupIds))return;var c=l.textGroupIds[l.urlId];if(this.groupId!==c){var R=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,w=this.tracks.filter(function(A){return!c||A.groupId===c});this.tracksInGroup=w;var x=this.findTrackId(R==null?void 0:R.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($.Events.SUBTITLE_TRACKS_UPDATED,O),x!==-1&&this.setSubtitleTrack(x,R)}},d.findTrackId=function(a){for(var l=this.tracksInGroup,c=0;c<l.length;c++){var R=l[c];if((!this.selectDefaultTrack||R.default)&&(!a||a===R.name))return R.id}return-1},d.onError=function(a,l){if(h.prototype.onError.call(this,a,l),l.fatal||!l.context)return;l.context.type===G.PlaylistContextType.SUBTITLE_TRACK&&l.context.id===this.trackId&&l.context.groupId===this.groupId&&this.retryLoadingOrFail(l)},d.loadPlaylist=function(a){var l=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(l)){var c=l.id,R=l.groupId,w=l.url;if(a)try{w=a.addDirectives(w)}catch(x){this.warn("Could not construct new URL with HLS Delivery Directives: "+x)}this.log("Loading subtitle playlist for id "+c),this.hls.trigger($.Events.SUBTITLE_TRACK_LOADING,{url:w,id:c,groupId:R,deliveryDirectives:a||null})}},d.toggleTrackModes=function(a){var l=this,c=this.media,R=this.subtitleDisplay,w=this.trackId;if(!c)return;var x=f(c.textTracks),O=x.filter(function(E){return E.groupId===l.groupId});if(a===-1)[].slice.call(x).forEach(function(E){E.mode="disabled"});else{var A=O[w];A&&(A.mode="disabled")}var T=O[a];T&&(T.mode=R?"showing":"hidden")},d.setSubtitleTrack=function(a,l){var c,R=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=a;return}if(this.trackId!==a&&this.toggleTrackModes(a),this.trackId===a&&(a===-1||(c=R[a])!==null&&c!==void 0&&c.details)||a<-1||a>=R.length)return;this.clearTimer();var w=R[a];if(this.log("Switching to subtitle track "+a),this.trackId=a,w){var x=w.id,O=w.groupId,A=O===void 0?"":O,T=w.name,E=w.type,b=w.url;this.hls.trigger($.Events.SUBTITLE_TRACK_SWITCH,{id:x,groupId:A,name:T,type:E,url:b});var u=this.switchParams(w.url,l==null?void 0:l.details);this.loadPlaylist(u)}else this.hls.trigger($.Events.SUBTITLE_TRACK_SWITCH,{id:a})},d.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var a=-1,l=f(this.media.textTracks),c=0;c<l.length;c++)if(l[c].mode==="hidden")a=c;else if(l[c].mode==="showing"){a=c;break}this.subtitleTrack!==a&&(this.subtitleTrack=a)},D(o,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(a){this.selectDefaultTrack=!1;var l=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(a,l)}}]),o}(B.default);function f(h){for(var o=[],d=0;d<h.length;d++){var s=h[d];s.kind==="subtitles"&&s.label&&o.push(h[d])}return o}J.default=p},"./src/controller/timeline-controller.ts":function(oe,J,k){"use strict";k.r(J),k.d(J,"TimelineController",function(){return f});var $=k("./src/polyfills/number.ts"),F=k("./src/events.ts"),B=k("./src/utils/cea-608-parser.ts"),G=k("./src/utils/output-filter.ts"),H=k("./src/utils/webvtt-parser.ts"),D=k("./src/utils/texttrack-utils.ts"),I=k("./src/utils/imsc1-ttml-parser.ts"),g=k("./src/types/loader.ts"),p=k("./src/utils/logger.ts"),f=function(){function s(l){if(this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.timescale=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=d(),this.captionsProperties=void 0,this.hls=l,this.config=l.config,this.Cues=l.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},this.config.enableCEA708Captions){var c=new G.default(this,"textTrack1"),R=new G.default(this,"textTrack2"),w=new G.default(this,"textTrack3"),x=new G.default(this,"textTrack4");this.cea608Parser1=new B.default(1,c,R),this.cea608Parser2=new B.default(3,w,x)}l.on(F.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),l.on(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.on(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.on(F.Events.MANIFEST_LOADED,this.onManifestLoaded,this),l.on(F.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),l.on(F.Events.FRAG_LOADING,this.onFragLoading,this),l.on(F.Events.FRAG_LOADED,this.onFragLoaded,this),l.on(F.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),l.on(F.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),l.on(F.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),l.on(F.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),l.on(F.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var a=s.prototype;return a.destroy=function(){var c=this.hls;c.off(F.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),c.off(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.off(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.off(F.Events.MANIFEST_LOADED,this.onManifestLoaded,this),c.off(F.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),c.off(F.Events.FRAG_LOADING,this.onFragLoading,this),c.off(F.Events.FRAG_LOADED,this.onFragLoaded,this),c.off(F.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),c.off(F.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),c.off(F.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),c.off(F.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),c.off(F.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},a.addCues=function(c,R,w,x,O){for(var A=!1,T=O.length;T--;){var E=O[T],b=o(E[0],E[1],R,w);if(b>=0&&(E[0]=Math.min(E[0],R),E[1]=Math.max(E[1],w),A=!0,b/(w-R)>.5))return}if(A||O.push([R,w]),this.config.renderTextTracksNatively){var u=this.captionsTracks[c];this.Cues.newCue(u,R,w,x)}else{var _=this.Cues.newCue(null,R,w,x);this.hls.trigger(F.Events.CUES_PARSED,{type:"captions",cues:_,track:c})}},a.onInitPtsFound=function(c,R){var w=this,x=R.frag,O=R.id,A=R.initPTS,T=R.timescale,E=this.unparsedVttFrags;O==="main"&&(this.initPTS[x.cc]=A,this.timescale[x.cc]=T),E.length&&(this.unparsedVttFrags=[],E.forEach(function(b){w.onFragLoaded(F.Events.FRAG_LOADED,b)}))},a.getExistingTrack=function(c){var R=this.media;if(R)for(var w=0;w<R.textTracks.length;w++){var x=R.textTracks[w];if(x[c])return x}return null},a.createCaptionsTrack=function(c){this.config.renderTextTracksNatively?this.createNativeTrack(c):this.createNonNativeTrack(c)},a.createNativeTrack=function(c){if(this.captionsTracks[c])return;var R=this.captionsProperties,w=this.captionsTracks,x=this.media,O=R[c],A=O.label,T=O.languageCode,E=this.getExistingTrack(c);if(E)w[c]=E,Object(D.clearCurrentCues)(w[c]),Object(D.sendAddTrackEvent)(w[c],x);else{var b=this.createTextTrack("captions",A,T);b&&(b[c]=!0,w[c]=b)}},a.createNonNativeTrack=function(c){if(this.nonNativeCaptionsTracks[c])return;var R=this.captionsProperties[c];if(!R)return;var w=R.label,x={_id:c,label:w,kind:"captions",default:R.media?!!R.media.default:!1,closedCaptions:R.media};this.nonNativeCaptionsTracks[c]=x,this.hls.trigger(F.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[x]})},a.createTextTrack=function(c,R,w){var x=this.media;return x?x.addTextTrack(c,R,w):void 0},a.onMediaAttaching=function(c,R){this.media=R.media,this._cleanTracks()},a.onMediaDetaching=function(){var c=this.captionsTracks;Object.keys(c).forEach(function(R){Object(D.clearCurrentCues)(c[R]),delete c[R]}),this.nonNativeCaptionsTracks={}},a.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=d(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=[],this.timescale=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},a._cleanTracks=function(){var c=this.media;if(!c)return;var R=c.textTracks;if(R)for(var w=0;w<R.length;w++)Object(D.clearCurrentCues)(R[w])},a.onSubtitleTracksUpdated=function(c,R){var w=this;this.textTracks=[];var x=R.subtitleTracks||[],O=x.some(function(b){return b.textCodec===I.IMSC1_CODEC});if(this.config.enableWebVTT||O&&this.config.enableIMSC1){var A=this.tracks&&x&&this.tracks.length===x.length;if(this.tracks=x||[],this.config.renderTextTracksNatively){var T=this.media?this.media.textTracks:[];this.tracks.forEach(function(b,u){var _;if(u<T.length){for(var m=null,v=0;v<T.length;v++)if(h(T[v],b)){m=T[v];break}m&&(_=m)}_?Object(D.clearCurrentCues)(_):(_=w.createTextTrack("subtitles",b.name,b.lang),_&&(_.mode="disabled")),_&&(_.groupId=b.groupId,w.textTracks.push(_))})}else if(!A&&this.tracks&&this.tracks.length){var E=this.tracks.map(function(b){return{label:b.name,kind:b.type.toLowerCase(),default:b.default,subtitleTrack:b}});this.hls.trigger(F.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:E})}}},a.onManifestLoaded=function(c,R){var w=this;this.config.enableCEA708Captions&&R.captions&&R.captions.forEach(function(x){var O=/(?:CC|SERVICE)([1-4])/.exec(x.instreamId);if(!O)return;var A="textTrack"+O[1],T=w.captionsProperties[A];if(!T)return;T.label=x.name,x.lang&&(T.languageCode=x.lang),T.media=x})},a.onFragLoading=function(c,R){var w=this.cea608Parser1,x=this.cea608Parser2,O=this.lastSn,A=this.lastPartIndex;if(!this.enabled||!(w&&x))return;if(R.frag.type===g.PlaylistLevelType.MAIN){var T,E,b=R.frag.sn,u=(T=R==null||((E=R.part)===null||E===void 0)?void 0:E.index)!=null?T:-1;b===O+1||b===O&&u===A+1||(w.reset(),x.reset()),this.lastSn=b,this.lastPartIndex=u}},a.onFragLoaded=function(c,R){var w=R.frag,x=R.payload,O=this.initPTS,A=this.unparsedVttFrags;if(w.type===g.PlaylistLevelType.SUBTITLE)if(x.byteLength){if(!Object($.isFiniteNumber)(O[w.cc])){A.push(R),O.length&&this.hls.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:w,error:new Error("Missing initial subtitle PTS")});return}var T=w.decryptdata;if(T==null||T.key==null||T.method!=="AES-128"){var E=this.tracks[w.level],b=this.vttCCs;b[w.cc]||(b[w.cc]={start:w.start,prevCC:this.prevCC,new:!0},this.prevCC=w.cc),E&&E.textCodec===I.IMSC1_CODEC?this._parseIMSC1(w,x):this._parseVTTs(w,x,b)}}else this.hls.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:w,error:new Error("Empty subtitle payload")})},a._parseIMSC1=function(c,R){var w=this,x=this.hls;Object(I.parseIMSC1)(R,this.initPTS[c.cc],this.timescale[c.cc],function(O){w._appendCues(O,c.level),x.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:c})},function(O){p.logger.log("Failed to parse IMSC1: "+O),x.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:c,error:O})})},a._parseVTTs=function(c,R,w){var x=this,O=this.hls;Object(H.parseWebVTT)(R,this.initPTS[c.cc],this.timescale[c.cc],w,c.cc,c.start,function(A){x._appendCues(A,c.level),O.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:c})},function(A){x._fallbackToIMSC1(c,R),p.logger.log("Failed to parse VTT cue: "+A),O.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:c,error:A})})},a._fallbackToIMSC1=function(c,R){var w=this,x=this.tracks[c.level];x.textCodec||Object(I.parseIMSC1)(R,this.initPTS[c.cc],this.timescale[c.cc],function(){x.textCodec=I.IMSC1_CODEC,w._parseIMSC1(c,R)},function(){x.textCodec="wvtt"})},a._appendCues=function(c,R){var w=this.hls;if(this.config.renderTextTracksNatively){var x=this.textTracks[R];if(x.mode==="disabled")return;c.forEach(function(T){return Object(D.addCueToTrack)(x,T)})}else{var O=this.tracks[R],A=O.default?"default":"subtitles"+R;w.trigger(F.Events.CUES_PARSED,{type:"subtitles",cues:c,track:A})}},a.onFragDecrypted=function(c,R){var w=R.frag;if(w.type===g.PlaylistLevelType.SUBTITLE){if(!Object($.isFiniteNumber)(this.initPTS[w.cc])){this.unparsedVttFrags.push(R);return}this.onFragLoaded(F.Events.FRAG_LOADED,R)}},a.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},a.onFragParsingUserdata=function(c,R){var w=this.cea608Parser1,x=this.cea608Parser2;if(!this.enabled||!(w&&x))return;for(var O=0;O<R.samples.length;O++){var A=R.samples[O].bytes;if(A){var T=this.extractCea608Data(A);w.addData(R.samples[O].pts,T[0]),x.addData(R.samples[O].pts,T[1])}}},a.onBufferFlushing=function(c,R){var w=R.startOffset,x=R.endOffset,O=R.endOffsetSubtitles,A=R.type,T=this.media;if(!T||T.currentTime<x)return;if(!A||A==="video"){var E=this.captionsTracks;Object.keys(E).forEach(function(u){return Object(D.removeCuesInRange)(E[u],w,x)})}if(this.config.renderTextTracksNatively&&(w===0&&O!==void 0)){var b=this.textTracks;Object.keys(b).forEach(function(u){return Object(D.removeCuesInRange)(b[u],w,O)})}},a.extractCea608Data=function(c){for(var R=c[0]&31,w=2,x=[[],[]],O=0;O<R;O++){var A=c[w++],T=127&c[w++],E=127&c[w++],b=(4&A)!==0,u=3&A;if(T===0&&E===0)continue;b&&((u===0||u===1)&&(x[u].push(T),x[u].push(E)))}return x},s}();function h(s,a){return s&&s.label===a.name&&!(s.textTrack1||s.textTrack2)}function o(s,a,l,c){return Math.min(a,c)-Math.max(s,l)}function d(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(oe,J,k){"use strict";k.r(J),k.d(J,"default",function(){return $});var $=function(){function F(G,H){this.subtle=void 0,this.aesIV=void 0,this.subtle=G,this.aesIV=H}var B=F.prototype;return B.decrypt=function(H,D){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},D,H)},F}()},"./src/crypt/aes-decryptor.ts":function(oe,J,k){"use strict";k.r(J),k.d(J,"removePadding",function(){return F}),k.d(J,"default",function(){return B});var $=k("./src/utils/typed-array.ts");function F(G){var H=G.byteLength,D=H&&new DataView(G.buffer).getUint8(H-1);return D?Object($.sliceUint8)(G,0,H-D):G}var B=function(){function G(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}var H=G.prototype;return H.uint8ArrayToUint32Array_=function(I){for(var g=new DataView(I),p=new Uint32Array(4),f=0;f<4;f++)p[f]=g.getUint32(f*4);return p},H.initTable=function(){var I=this.sBox,g=this.invSBox,p=this.subMix,f=p[0],h=p[1],o=p[2],d=p[3],s=this.invSubMix,a=s[0],l=s[1],c=s[2],R=s[3],w=new Uint32Array(256),x=0,O=0,A=0;for(A=0;A<256;A++)A<128?w[A]=A<<1:w[A]=A<<1^283;for(A=0;A<256;A++){var T=O^O<<1^O<<2^O<<3^O<<4;T=T>>>8^T&255^99,I[x]=T,g[T]=x;var E=w[x],b=w[E],u=w[b],_=w[T]*257^T*16843008;f[x]=_<<24|_>>>8,h[x]=_<<16|_>>>16,o[x]=_<<8|_>>>24,d[x]=_,_=u*16843009^b*65537^E*257^x*16843008,a[T]=_<<24|_>>>8,l[T]=_<<16|_>>>16,c[T]=_<<8|_>>>24,R[T]=_,x?(x=E^w[w[w[u^E]]],O^=w[w[O]]):x=O=1}},H.expandKey=function(I){for(var g=this.uint8ArrayToUint32Array_(I),p=!0,f=0;f<g.length&&p;)p=g[f]===this.key[f],f++;if(p)return;this.key=g;var h=this.keySize=g.length;if(h!==4&&h!==6&&h!==8)throw new Error("Invalid aes key size="+h);var o=this.ksRows=(h+6+1)*4,d,s,a=this.keySchedule=new Uint32Array(o),l=this.invKeySchedule=new Uint32Array(o),c=this.sBox,R=this.rcon,w=this.invSubMix,x=w[0],O=w[1],A=w[2],T=w[3],E,b;for(d=0;d<o;d++){if(d<h){E=a[d]=g[d];continue}b=E,d%h===0?(b=b<<8|b>>>24,b=c[b>>>24]<<24|c[b>>>16&255]<<16|c[b>>>8&255]<<8|c[b&255],b^=R[d/h|0]<<24):h>6&&d%h===4&&(b=c[b>>>24]<<24|c[b>>>16&255]<<16|c[b>>>8&255]<<8|c[b&255]),a[d]=E=(a[d-h]^b)>>>0}for(s=0;s<o;s++)d=o-s,s&3?b=a[d]:b=a[d-4],s<4||d<=4?l[s]=b:l[s]=x[c[b>>>24]]^O[c[b>>>16&255]]^A[c[b>>>8&255]]^T[c[b&255]],l[s]=l[s]>>>0},H.networkToHostOrderSwap=function(I){return I<<24|(I&65280)<<8|(I&16711680)>>8|I>>>24},H.decrypt=function(I,g,p){for(var f=this.keySize+6,h=this.invKeySchedule,o=this.invSBox,d=this.invSubMix,s=d[0],a=d[1],l=d[2],c=d[3],R=this.uint8ArrayToUint32Array_(p),w=R[0],x=R[1],O=R[2],A=R[3],T=new Int32Array(I),E=new Int32Array(T.length),b,u,_,m,v,M,P,K,V,U,S,X,ee,ae,de=this.networkToHostOrderSwap;g<T.length;){for(V=de(T[g]),U=de(T[g+1]),S=de(T[g+2]),X=de(T[g+3]),v=V^h[0],M=X^h[1],P=S^h[2],K=U^h[3],ee=4,ae=1;ae<f;ae++)b=s[v>>>24]^a[M>>16&255]^l[P>>8&255]^c[K&255]^h[ee],u=s[M>>>24]^a[P>>16&255]^l[K>>8&255]^c[v&255]^h[ee+1],_=s[P>>>24]^a[K>>16&255]^l[v>>8&255]^c[M&255]^h[ee+2],m=s[K>>>24]^a[v>>16&255]^l[M>>8&255]^c[P&255]^h[ee+3],v=b,M=u,P=_,K=m,ee=ee+4;b=o[v>>>24]<<24^o[M>>16&255]<<16^o[P>>8&255]<<8^o[K&255]^h[ee],u=o[M>>>24]<<24^o[P>>16&255]<<16^o[K>>8&255]<<8^o[v&255]^h[ee+1],_=o[P>>>24]<<24^o[K>>16&255]<<16^o[v>>8&255]<<8^o[M&255]^h[ee+2],m=o[K>>>24]<<24^o[v>>16&255]<<16^o[M>>8&255]<<8^o[P&255]^h[ee+3],E[g]=de(b^w),E[g+1]=de(m^x),E[g+2]=de(_^O),E[g+3]=de(u^A),w=V,x=U,O=S,A=X,g=g+4}return E.buffer},G}()},"./src/crypt/decrypter.ts":function(oe,J,k){"use strict";k.r(J),k.d(J,"default",function(){return g});var $=k("./src/crypt/aes-crypto.ts"),F=k("./src/crypt/fast-aes-key.ts"),B=k("./src/crypt/aes-decryptor.ts"),G=k("./src/utils/logger.ts"),H=k("./src/utils/mp4-tools.ts"),D=k("./src/utils/typed-array.ts"),I=16,g=function(){function p(h,o,d){var s=d===void 0?{}:d,a=s.removePKCS7Padding,l=a===void 0?!0:a;if(this.logEnabled=!0,this.observer=void 0,this.config=void 0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.observer=h,this.config=o,this.removePKCS7Padding=l,l)try{var c=self.crypto;c&&(this.subtle=c.subtle||c.webkitSubtle)}catch(R){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var f=p.prototype;return f.destroy=function(){this.observer=null},f.isSync=function(){return this.config.enableSoftwareAES},f.flush=function(){var o=this.currentResult;if(!o){this.reset();return}var d=new Uint8Array(o);return this.reset(),this.removePKCS7Padding?Object(B.removePadding)(d):d},f.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},f.decrypt=function(o,d,s,a){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(o),d,s);var l=this.flush();l&&a(l.buffer)}else this.webCryptoDecrypt(new Uint8Array(o),d,s).then(a)},f.softwareDecrypt=function(o,d,s){var a=this.currentIV,l=this.currentResult,c=this.remainderData;this.logOnce("JS AES decrypt"),c&&(o=Object(H.appendUint8Array)(c,o),this.remainderData=null);var R=this.getValidChunk(o);if(!R.length)return null;a&&(s=a);var w=this.softwareDecrypter;w||(w=this.softwareDecrypter=new B.default),w.expandKey(d);var x=l;return this.currentResult=w.decrypt(R.buffer,0,s),this.currentIV=Object(D.sliceUint8)(R,-16).buffer,x||null},f.webCryptoDecrypt=function(o,d,s){var a=this,l=this.subtle;return(this.key!==d||!this.fastAesKey)&&(this.key=d,this.fastAesKey=new F.default(l,d)),this.fastAesKey.expandKey().then(function(c){if(!l)return Promise.reject(new Error("web crypto not initialized"));var R=new $.default(l,s);return R.decrypt(o.buffer,c)}).catch(function(c){return a.onWebCryptoError(c,o,d,s)})},f.onWebCryptoError=function(o,d,s,a){return G.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",o),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(d,s,a)},f.getValidChunk=function(o){var d=o,s=o.length-o.length%I;return s!==o.length&&(d=Object(D.sliceUint8)(o,0,s),this.remainderData=Object(D.sliceUint8)(o,s)),d},f.logOnce=function(o){if(!this.logEnabled)return;G.logger.log("[decrypter.ts]: "+o),this.logEnabled=!1},p}()},"./src/crypt/fast-aes-key.ts":function(oe,J,k){"use strict";k.r(J),k.d(J,"default",function(){return $});var $=function(){function F(G,H){this.subtle=void 0,this.key=void 0,this.subtle=G,this.key=H}var B=F.prototype;return B.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},F}()},"./src/demux/aacdemuxer.ts":function(oe,J,k){"use strict";k.r(J);var $=k("./src/demux/base-audio-demuxer.ts"),F=k("./src/demux/adts.ts"),B=k("./src/utils/logger.ts"),G=k("./src/demux/id3.ts");function H(g,p){g.prototype=Object.create(p.prototype),g.prototype.constructor=g,D(g,p)}function D(g,p){return D=Object.setPrototypeOf||function(h,o){return h.__proto__=o,h},D(g,p)}var I=function(g){H(p,g);function p(h,o){var d;return d=g.call(this)||this,d.observer=void 0,d.config=void 0,d.observer=h,d.config=o,d}var f=p.prototype;return f.resetInitSegment=function(o,d,s){g.prototype.resetInitSegment.call(this,o,d,s),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:o,duration:s,inputTimeScale:9e4,dropped:0}},p.probe=function(o){if(!o)return!1;for(var d=G.getID3Data(o,0)||[],s=d.length,a=o.length;s<a;s++)if(F.probe(o,s))return B.logger.log("ADTS sync word found !"),!0;return!1},f.canParse=function(o,d){return F.canParse(o,d)},f.appendFrame=function(o,d,s){F.initTrackConfig(o,this.observer,d,s,o.manifestCodec);var a=F.appendFrame(o,d,s,this.initPTS,this.frameIndex);if(a&&a.missing===0)return a},p}($.default);I.minProbeByteLength=9,J.default=I},"./src/demux/adts.ts":function(oe,J,k){"use strict";k.r(J),k.d(J,"getAudioConfig",function(){return G}),k.d(J,"isHeaderPattern",function(){return H}),k.d(J,"getHeaderLength",function(){return D}),k.d(J,"getFullFrameLength",function(){return I}),k.d(J,"canGetFrameLength",function(){return g}),k.d(J,"isHeader",function(){return p}),k.d(J,"canParse",function(){return f}),k.d(J,"probe",function(){return h}),k.d(J,"initTrackConfig",function(){return o}),k.d(J,"getFrameDuration",function(){return d}),k.d(J,"parseFrameHeader",function(){return s}),k.d(J,"appendFrame",function(){return a});var $=k("./src/utils/logger.ts"),F=k("./src/errors.ts"),B=k("./src/events.ts");function G(l,c,R,w){var x,O,A,T,E=navigator.userAgent.toLowerCase(),b=w,u=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];x=((c[R+2]&192)>>>6)+1;var _=(c[R+2]&60)>>>2;if(_>u.length-1){l.trigger(B.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+_});return}return A=(c[R+2]&1)<<2,A|=(c[R+3]&192)>>>6,$.logger.log("manifest codec:"+w+", ADTS type:"+x+", samplingIndex:"+_),/firefox/i.test(E)?_>=6?(x=5,T=new Array(4),O=_-3):(x=2,T=new Array(2),O=_):E.indexOf("android")!==-1?(x=2,T=new Array(2),O=_):(x=5,T=new Array(4),w&&(w.indexOf("mp4a.40.29")!==-1||w.indexOf("mp4a.40.5")!==-1)||!w&&_>=6?O=_-3:((w&&w.indexOf("mp4a.40.2")!==-1&&(_>=6&&A===1||/vivaldi/i.test(E))||!w&&A===1)&&(x=2,T=new Array(2)),O=_)),T[0]=x<<3,T[0]|=(_&14)>>1,T[1]|=(_&1)<<7,T[1]|=A<<3,x===5&&(T[1]|=(O&14)>>1,T[2]=(O&1)<<7,T[2]|=2<<2,T[3]=0),{config:T,samplerate:u[_],channelCount:A,codec:"mp4a.40."+x,manifestCodec:b}}function H(l,c){return l[c]===255&&(l[c+1]&246)===240}function D(l,c){return l[c+1]&1?7:9}function I(l,c){return(l[c+3]&3)<<11|l[c+4]<<3|(l[c+5]&224)>>>5}function g(l,c){return c+5<l.length}function p(l,c){return c+1<l.length&&H(l,c)}function f(l,c){return g(l,c)&&H(l,c)&&I(l,c)<=l.length-c}function h(l,c){if(p(l,c)){var R=D(l,c);if(c+R>=l.length)return!1;var w=I(l,c);if(w<=R)return!1;var x=c+w;return x===l.length||p(l,x)}return!1}function o(l,c,R,w,x){if(!l.samplerate){var O=G(c,R,w,x);if(!O)return;l.config=O.config,l.samplerate=O.samplerate,l.channelCount=O.channelCount,l.codec=O.codec,l.manifestCodec=O.manifestCodec,$.logger.log("parsed codec:"+l.codec+", rate:"+O.samplerate+", channels:"+O.channelCount)}}function d(l){return 1024*9e4/l}function s(l,c,R,w,x){var O=D(l,c),A=I(l,c);if(A-=O,A>0){var T=R+w*x;return{headerLength:O,frameLength:A,stamp:T}}}function a(l,c,R,w,x){var O=d(l.samplerate),A=s(c,R,w,x,O);if(A){var T=A.frameLength,E=A.headerLength,b=A.stamp,u=E+T,_=Math.max(0,R+u-c.length),m;_?(m=new Uint8Array(u-E),m.set(c.subarray(R+E,c.length),0)):m=c.subarray(R+E,R+u);var v={unit:m,pts:b};return _||l.samples.push(v),{sample:v,length:u,missing:_}}}},"./src/demux/base-audio-demuxer.ts":function(oe,J,k){"use strict";k.r(J),k.d(J,"initPTSFn",function(){return I});var $=k("./src/polyfills/number.ts"),F=k("./src/demux/id3.ts"),B=k("./src/demux/dummy-demuxed-track.ts"),G=k("./src/utils/mp4-tools.ts"),H=k("./src/utils/typed-array.ts"),D=function(){function g(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var p=g.prototype;return p.resetInitSegment=function(h,o,d){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,o){return!1},p.appendFrame=function(h,o,d){},p.demux=function(h,o){this.cachedData&&(h=Object(G.appendUint8Array)(this.cachedData,h),this.cachedData=null);var d=F.getID3Data(h,0),s=d?d.length:0,a,l,c=this._audioTrack,R=this._id3Track,w=d?F.getTimeStamp(d):void 0,x=h.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=I(w,o)),d&&d.length>0&&R.samples.push({pts:this.initPTS,dts:this.initPTS,data:d}),l=this.initPTS;s<x;){if(this.canParse(h,s)){var O=this.appendFrame(c,h,s);O?(this.frameIndex++,l=O.sample.pts,s+=O.length,a=s):s=x}else F.canParse(h,s)?(d=F.getID3Data(h,s),R.samples.push({pts:l,dts:l,data:d}),s+=d.length,a=s):s++;if(s===x&&a!==x){var A=Object(H.sliceUint8)(h,a);this.cachedData?this.cachedData=Object(G.appendUint8Array)(this.cachedData,A):this.cachedData=A}}return{audioTrack:c,avcTrack:Object(B.dummyTrack)(),id3Track:R,textTrack:Object(B.dummyTrack)()}},p.demuxSampleAes=function(h,o,d){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},p.flush=function(h){var o=this.cachedData;return o&&(this.cachedData=null,this.demux(o,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(B.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(B.dummyTrack)()}},p.destroy=function(){},g}(),I=function(p,f){return Object($.isFiniteNumber)(p)?p*90:f*9e4};J.default=D},"./src/demux/chunk-cache.ts":function(oe,J,k){"use strict";k.r(J),k.d(J,"default",function(){return $});var $=function(){function B(){this.chunks=[],this.dataLength=0}var G=B.prototype;return G.push=function(D){this.chunks.push(D),this.dataLength+=D.length},G.flush=function(){var D=this.chunks,I=this.dataLength,g;if(D.length)D.length===1?g=D[0]:g=F(D,I);else return new Uint8Array(0);return this.reset(),g},G.reset=function(){this.chunks.length=0,this.dataLength=0},B}();function F(B,G){for(var H=new Uint8Array(G),D=0,I=0;I<B.length;I++){var g=B[I];H.set(g,D),D+=g.length}return H}},"./src/demux/dummy-demuxed-track.ts":function(oe,J,k){"use strict";k.r(J),k.d(J,"dummyTrack",function(){return $});function $(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(oe,J,k){"use strict";k.r(J);var $=k("./src/utils/logger.ts"),F=function(){function B(H){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=H,this.bytesAvailable=H.byteLength,this.word=0,this.bitsAvailable=0}var G=B.prototype;return G.loadWord=function(){var D=this.data,I=this.bytesAvailable,g=D.byteLength-I,p=new Uint8Array(4),f=Math.min(4,I);if(f===0)throw new Error("no bytes available");p.set(D.subarray(g,g+f)),this.word=new DataView(p.buffer).getUint32(0),this.bitsAvailable=f*8,this.bytesAvailable-=f},G.skipBits=function(D){var I;this.bitsAvailable>D?(this.word<<=D,this.bitsAvailable-=D):(D-=this.bitsAvailable,I=D>>3,D-=I>>3,this.bytesAvailable-=I,this.loadWord(),this.word<<=D,this.bitsAvailable-=D)},G.readBits=function(D){var I=Math.min(this.bitsAvailable,D),g=this.word>>>32-I;return D>32&&$.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=I,this.bitsAvailable>0?this.word<<=I:this.bytesAvailable>0&&this.loadWord(),I=D-I,I>0&&this.bitsAvailable?g<<I|this.readBits(I):g},G.skipLZ=function(){var D;for(D=0;D<this.bitsAvailable;++D)if((this.word&2147483648>>>D)!==0)return this.word<<=D,this.bitsAvailable-=D,D;return this.loadWord(),D+this.skipLZ()},G.skipUEG=function(){this.skipBits(1+this.skipLZ())},G.skipEG=function(){this.skipBits(1+this.skipLZ())},G.readUEG=function(){var D=this.skipLZ();return this.readBits(D+1)-1},G.readEG=function(){var D=this.readUEG();return 1&D?1+D>>>1:-1*(D>>>1)},G.readBoolean=function(){return this.readBits(1)===1},G.readUByte=function(){return this.readBits(8)},G.readUShort=function(){return this.readBits(16)},G.readUInt=function(){return this.readBits(32)},G.skipScalingList=function(D){for(var I=8,g=8,p,f=0;f<D;f++)g!==0&&(p=this.readEG(),g=(I+p+256)%256),I=g===0?I:g},G.readSPS=function(){var D=0,I=0,g=0,p=0,f,h,o,d=this.readUByte.bind(this),s=this.readBits.bind(this),a=this.readUEG.bind(this),l=this.readBoolean.bind(this),c=this.skipBits.bind(this),R=this.skipEG.bind(this),w=this.skipUEG.bind(this),x=this.skipScalingList.bind(this);d();var O=d();if(s(5),c(3),d(),w(),O===100||O===110||O===122||O===244||O===44||O===83||O===86||O===118||O===128){var A=a();if(A===3&&c(1),w(),w(),c(1),l())for(h=A!==3?8:12,o=0;o<h;o++)l()&&(o<6?x(16):x(64))}w();var T=a();if(T===0)a();else if(T===1)for(c(1),R(),R(),f=a(),o=0;o<f;o++)R();w(),c(1);var E=a(),b=a(),u=s(1);u===0&&c(1),c(1),l()&&(D=a(),I=a(),g=a(),p=a());var _=[1,1];if(l()&&l()){var m=d();switch(m){case 1:_=[1,1];break;case 2:_=[12,11];break;case 3:_=[10,11];break;case 4:_=[16,11];break;case 5:_=[40,33];break;case 6:_=[24,11];break;case 7:_=[20,11];break;case 8:_=[32,11];break;case 9:_=[80,33];break;case 10:_=[18,11];break;case 11:_=[15,11];break;case 12:_=[64,33];break;case 13:_=[160,99];break;case 14:_=[4,3];break;case 15:_=[3,2];break;case 16:_=[2,1];break;case 255:{_=[d()<<8|d(),d()<<8|d()];break}}}return{width:Math.ceil((E+1)*16-D*2-I*2),height:(2-u)*(b+1)*16-(u?2:4)*(g+p),pixelRatio:_}},G.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},B}();J.default=F},"./src/demux/id3.ts":function(oe,J,k){"use strict";k.r(J),k.d(J,"isHeader",function(){return $}),k.d(J,"isFooter",function(){return F}),k.d(J,"getID3Data",function(){return B}),k.d(J,"canParse",function(){return H}),k.d(J,"getTimeStamp",function(){return D}),k.d(J,"isTimeStampFrame",function(){return I}),k.d(J,"getID3Frames",function(){return p}),k.d(J,"decodeFrame",function(){return f}),k.d(J,"utf8ArrayToStr",function(){return a}),k.d(J,"testables",function(){return l});var $=function(x,O){return O+10<=x.length&&(x[O]===73&&x[O+1]===68&&x[O+2]===51&&(x[O+3]<255&&x[O+4]<255&&(x[O+6]<128&&x[O+7]<128&&x[O+8]<128&&x[O+9]<128)))},F=function(x,O){return O+10<=x.length&&(x[O]===51&&x[O+1]===68&&x[O+2]===73&&(x[O+3]<255&&x[O+4]<255&&(x[O+6]<128&&x[O+7]<128&&x[O+8]<128&&x[O+9]<128)))},B=function(x,O){for(var A=O,T=0;$(x,O);){T+=10;var E=G(x,O+6);T+=E,F(x,O+10)&&(T+=10),O+=T}return T>0?x.subarray(A,A+T):void 0},G=function(x,O){var A=0;return A=(x[O]&127)<<21,A|=(x[O+1]&127)<<14,A|=(x[O+2]&127)<<7,A|=x[O+3]&127,A},H=function(x,O){return $(x,O)&&G(x,O+6)+10<=x.length-O},D=function(x){for(var O=p(x),A=0;A<O.length;A++){var T=O[A];if(I(T))return s(T)}return},I=function(x){return x&&x.key==="PRIV"&&x.info==="com.apple.streaming.transportStreamTimestamp"},g=function(x){var O=String.fromCharCode(x[0],x[1],x[2],x[3]),A=G(x,4),T=10;return{type:O,size:A,data:x.subarray(T,T+A)}},p=function(x){for(var O=0,A=[];$(x,O);){var T=G(x,O+6);O+=10;for(var E=O+T;O+8<E;){var b=g(x.subarray(O)),u=f(b);u&&A.push(u),O+=b.size+10}F(x,O)&&(O+=10)}return A},f=function(x){return x.type==="PRIV"?h(x):x.type[0]==="W"?d(x):o(x)},h=function(x){if(x.size<2)return;var O=a(x.data,!0),A=new Uint8Array(x.data.subarray(O.length+1));return{key:x.type,info:O,data:A.buffer}},o=function(x){if(x.size<2)return;if(x.type==="TXXX"){var O=1,A=a(x.data.subarray(O),!0);O+=A.length+1;var T=a(x.data.subarray(O));return{key:x.type,info:A,data:T}}var E=a(x.data.subarray(1));return{key:x.type,data:E}},d=function(x){if(x.type==="WXXX"){if(x.size<2)return;var O=1,A=a(x.data.subarray(O),!0);O+=A.length+1;var T=a(x.data.subarray(O));return{key:x.type,info:A,data:T}}var E=a(x.data);return{key:x.type,data:E}},s=function(x){if(x.data.byteLength===8){var O=new Uint8Array(x.data),A=O[3]&1,T=(O[4]<<23)+(O[5]<<15)+(O[6]<<7)+O[7];return T/=45,A&&(T+=4772185884e-2),Math.round(T)}return},a=function(x,O){O===void 0&&(O=!1);var A=R();if(A){var T=A.decode(x);if(O){var E=T.indexOf("\0");return E!==-1?T.substring(0,E):T}return T.replace(/\0/g,"")}for(var b=x.length,u,_,m,v="",M=0;M<b;){if(u=x[M++],u===0&&O)return v;if(u===0||u===3)continue;switch(u>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:v+=String.fromCharCode(u);break;case 12:case 13:_=x[M++],v+=String.fromCharCode((u&31)<<6|_&63);break;case 14:_=x[M++],m=x[M++],v+=String.fromCharCode((u&15)<<12|(_&63)<<6|(m&63)<<0);break;default:}}return v},l={decodeTextFrame:o},c;function R(){return!c&&typeof self.TextDecoder!="undefined"&&(c=new self.TextDecoder("utf-8")),c}},"./src/demux/mp3demuxer.ts":function(oe,J,k){"use strict";k.r(J);var $=k("./src/demux/base-audio-demuxer.ts"),F=k("./src/demux/id3.ts"),B=k("./src/utils/logger.ts"),G=k("./src/demux/mpegaudio.ts");function H(g,p){g.prototype=Object.create(p.prototype),g.prototype.constructor=g,D(g,p)}function D(g,p){return D=Object.setPrototypeOf||function(h,o){return h.__proto__=o,h},D(g,p)}var I=function(g){H(p,g);function p(){return g.apply(this,arguments)||this}var f=p.prototype;return f.resetInitSegment=function(o,d,s){g.prototype.resetInitSegment.call(this,o,d,s),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:o,duration:s,inputTimeScale:9e4,dropped:0}},p.probe=function(o){if(!o)return!1;for(var d=F.getID3Data(o,0)||[],s=d.length,a=o.length;s<a;s++)if(G.probe(o,s))return B.logger.log("MPEG Audio sync word found !"),!0;return!1},f.canParse=function(o,d){return G.canParse(o,d)},f.appendFrame=function(o,d,s){return this.initPTS===null?void 0:G.appendFrame(o,d,s,this.initPTS,this.frameIndex)},p}($.default);I.minProbeByteLength=4,J.default=I},"./src/demux/mp4demuxer.ts":function(oe,J,k){"use strict";k.r(J);var $=k("./src/utils/mp4-tools.ts"),F=k("./src/demux/dummy-demuxed-track.ts"),B=function(){function G(D,I){this.remainderData=null,this.config=void 0,this.config=I}var H=G.prototype;return H.resetTimeStamp=function(){},H.resetInitSegment=function(){},H.resetContiguity=function(){},G.probe=function(I){return Object($.findBox)({data:I,start:0,end:Math.min(I.length,16384)},["moof"]).length>0},H.demux=function(I){var g=I,p=Object(F.dummyTrack)();if(this.config.progressive){this.remainderData&&(g=Object($.appendUint8Array)(this.remainderData,I));var f=Object($.segmentValidRange)(g);this.remainderData=f.remainder,p.samples=f.valid||new Uint8Array}else p.samples=g;return{audioTrack:Object(F.dummyTrack)(),avcTrack:p,id3Track:Object(F.dummyTrack)(),textTrack:Object(F.dummyTrack)()}},H.flush=function(){var I=Object(F.dummyTrack)();return I.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(F.dummyTrack)(),avcTrack:I,id3Track:Object(F.dummyTrack)(),textTrack:Object(F.dummyTrack)()}},H.demuxSampleAes=function(I,g,p){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},H.destroy=function(){},G}();B.minProbeByteLength=1024,J.default=B},"./src/demux/mpegaudio.ts":function(oe,J,k){"use strict";k.r(J),k.d(J,"appendFrame",function(){return D}),k.d(J,"parseHeader",function(){return I}),k.d(J,"isHeaderPattern",function(){return g}),k.d(J,"isHeader",function(){return p}),k.d(J,"canParse",function(){return f}),k.d(J,"probe",function(){return h});var $=null,F=[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],B=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],G=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],H=[0,1,1,4];function D(o,d,s,a,l){if(s+24>d.length)return;var c=I(d,s);if(c&&s+c.frameLength<=d.length){var R=c.samplesPerFrame*9e4/c.sampleRate,w=a+l*R,x={unit:d.subarray(s,s+c.frameLength),pts:w,dts:w};return o.config=[],o.channelCount=c.channelCount,o.samplerate=c.sampleRate,o.samples.push(x),{sample:x,length:c.frameLength,missing:0}}}function I(o,d){var s=o[d+1]>>3&3,a=o[d+1]>>1&3,l=o[d+2]>>4&15,c=o[d+2]>>2&3;if(s!==1&&l!==0&&l!==15&&c!==3){var R=o[d+2]>>1&1,w=o[d+3]>>6,x=s===3?3-a:a===3?3:4,O=F[x*14+l-1]*1e3,A=s===3?0:s===2?1:2,T=B[A*3+c],E=w===3?1:2,b=G[s][a],u=H[a],_=b*8*u,m=Math.floor(b*O/T+R)*u;if($===null){var v=navigator.userAgent||"",M=v.match(/Chrome\/(\d+)/i);$=M?parseInt(M[1]):0}var P=!!$&&$<=87;return P&&a===2&&O>=224e3&&w===0&&(o[d+3]=o[d+3]|128),{sampleRate:T,channelCount:E,frameLength:m,samplesPerFrame:_}}}function g(o,d){return o[d]===255&&(o[d+1]&224)===224&&(o[d+1]&6)!==0}function p(o,d){return d+1<o.length&&g(o,d)}function f(o,d){var s=4;return g(o,d)&&s<=o.length-d}function h(o,d){if(d+1<o.length&&g(o,d)){var s=4,a=I(o,d),l=s;a!=null&&a.frameLength&&(l=a.frameLength);var c=d+l;return c===o.length||p(o,c)}return!1}},"./src/demux/sample-aes.ts":function(oe,J,k){"use strict";k.r(J);var $=k("./src/crypt/decrypter.ts"),F=k("./src/demux/tsdemuxer.ts"),B=function(){function G(D,I,g){this.keyData=void 0,this.decrypter=void 0,this.keyData=g,this.decrypter=new $.default(D,I,{removePKCS7Padding:!1})}var H=G.prototype;return H.decryptBuffer=function(I,g){this.decrypter.decrypt(I,this.keyData.key.buffer,this.keyData.iv.buffer,g)},H.decryptAacSample=function(I,g,p,f){var h=I[g].unit,o=h.subarray(16,h.length-h.length%16),d=o.buffer.slice(o.byteOffset,o.byteOffset+o.length),s=this;this.decryptBuffer(d,function(a){var l=new Uint8Array(a);h.set(l,16),f||s.decryptAacSamples(I,g+1,p)})},H.decryptAacSamples=function(I,g,p){for(;;g++){if(g>=I.length){p();return}if(I[g].unit.length<32)continue;var f=this.decrypter.isSync();if(this.decryptAacSample(I,g,p,f),!f)return}},H.getAvcEncryptedData=function(I){for(var g=Math.floor((I.length-48)/160)*16+16,p=new Int8Array(g),f=0,h=32;h<=I.length-16;h+=160,f+=16)p.set(I.subarray(h,h+16),f);return p},H.getAvcDecryptedUnit=function(I,g){for(var p=new Uint8Array(g),f=0,h=32;h<=I.length-16;h+=160,f+=16)I.set(p.subarray(f,f+16),h);return I},H.decryptAvcSample=function(I,g,p,f,h,o){var d=Object(F.discardEPB)(h.data),s=this.getAvcEncryptedData(d),a=this;this.decryptBuffer(s.buffer,function(l){h.data=a.getAvcDecryptedUnit(d,l),o||a.decryptAvcSamples(I,g,p+1,f)})},H.decryptAvcSamples=function(I,g,p,f){if(I instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;g++,p=0){if(g>=I.length){f();return}for(var h=I[g].units;!(p>=h.length);p++){var o=h[p];if(o.data.length<=48||o.type!==1&&o.type!==5)continue;var d=this.decrypter.isSync();if(this.decryptAvcSample(I,g,p,f,o,d),!d)return}}},G}();J.default=B},"./src/demux/transmuxer-interface.ts":function(oe,J,k){"use strict";k.r(J),k.d(J,"default",function(){return h});var $=k("./node_modules/webworkify-webpack/index.js"),F=k.n($),B=k("./src/events.ts"),G=k("./src/demux/transmuxer.ts"),H=k("./src/utils/logger.ts"),D=k("./src/errors.ts"),I=k("./src/utils/mediasource-helper.ts"),g=k("./node_modules/eventemitter3/index.js"),p=k.n(g),f=Object(I.getMediaSource)()||{isTypeSupported:function(){return!1}},h=function(){function o(s,a,l,c){var R=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=s,this.id=a,this.onTransmuxComplete=l,this.onFlush=c;var w=s.config,x=function(b,u){u=u||{},u.frag=R.frag,u.id=R.id,s.trigger(b,u)};this.observer=new g.EventEmitter,this.observer.on(B.Events.FRAG_DECRYPTED,x),this.observer.on(B.Events.ERROR,x);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"){H.logger.log("demuxing in webworker");var T;try{T=this.worker=$("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),T.addEventListener("message",this.onwmsg),T.onerror=function(E){s.trigger(B.Events.ERROR,{type:D.ErrorTypes.OTHER_ERROR,details:D.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(E.message+" ("+E.filename+":"+E.lineno+")")})},T.postMessage({cmd:"init",typeSupported:O,vendor:A,id:a,config:JSON.stringify(w)})}catch(E){H.logger.warn("Error in worker:",E),H.logger.error("Error while initializing DemuxerWorker, fallback to inline"),T&&self.URL.revokeObjectURL(T.objectURL),this.transmuxer=new G.default(this.observer,O,w,A,a),this.worker=null}}else this.transmuxer=new G.default(this.observer,O,w,A,a)}var d=o.prototype;return d.destroy=function(){var a=this.worker;if(a)a.removeEventListener("message",this.onwmsg),a.terminate(),this.worker=null;else{var l=this.transmuxer;l&&(l.destroy(),this.transmuxer=null)}var c=this.observer;c&&c.removeAllListeners(),this.observer=null},d.push=function(a,l,c,R,w,x,O,A,T,E){var b=this;T.transmuxing.start=self.performance.now();var u=this.transmuxer,_=this.worker,m=x?x.start:w.start,v=w.decryptdata,M=this.frag,P=!(M&&w.cc===M.cc),K=!(M&&T.level===M.level),V=M?T.sn-M.sn:-1,U=this.part?T.part-this.part.index:1,S=!K&&(V===1||V===0&&U===1),X=self.performance.now();(K||V||w.stats.parsing.start===0)&&(w.stats.parsing.start=X),x&&(U||!S)&&(x.stats.parsing.start=X);var ee=new G.TransmuxState(P,S,A,K,m);if(!S||P){H.logger.log("[transmuxer-interface, "+w.type+"]: Starting new transmux session for sn: "+T.sn+" p: "+T.part+" level: "+T.level+" id: "+T.id+`
discontinuity: `+P+`
trackSwitch: `+K+`
contiguous: `+S+`
accurateTimeOffset: `+A+`
timeOffset: `+m);var ae=new G.TransmuxConfig(c,R,l,O,E);this.configureTransmuxer(ae)}if(this.frag=w,this.part=x,_)_.postMessage({cmd:"demux",data:a,decryptdata:v,chunkMeta:T,state:ee},a instanceof ArrayBuffer?[a]:[]);else if(u){var de=u.push(a,v,T,ee);Object(G.isPromise)(de)?de.then(function(Ae){b.handleTransmuxComplete(Ae)}):this.handleTransmuxComplete(de)}},d.flush=function(a){var l=this;a.transmuxing.start=self.performance.now();var c=this.transmuxer,R=this.worker;if(R)R.postMessage({cmd:"flush",chunkMeta:a});else if(c){var w=c.flush(a);Object(G.isPromise)(w)?w.then(function(x){l.handleFlushResult(x,a)}):this.handleFlushResult(w,a)}},d.handleFlushResult=function(a,l){var c=this;a.forEach(function(R){c.handleTransmuxComplete(R)}),this.onFlush(l)},d.onWorkerMessage=function(a){var l=a.data,c=this.hls;switch(l.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(l.data);break}case"flush":{this.onFlush(l.data);break}default:{l.data=l.data||{},l.data.frag=this.frag,l.data.id=this.id,c.trigger(l.event,l.data);break}}},d.configureTransmuxer=function(a){var l=this.worker,c=this.transmuxer;l?l.postMessage({cmd:"configure",config:a}):c&&c.configure(a)},d.handleTransmuxComplete=function(a){a.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(a)},o}()},"./src/demux/transmuxer-worker.ts":function(oe,J,k){"use strict";k.r(J),k.d(J,"default",function(){return D});var $=k("./src/demux/transmuxer.ts"),F=k("./src/events.ts"),B=k("./src/utils/logger.ts"),G=k("./node_modules/eventemitter3/index.js"),H=k.n(G);function D(h){var o=new G.EventEmitter,d=function(a,l){h.postMessage({event:a,data:l})};o.on(F.Events.FRAG_DECRYPTED,d),o.on(F.Events.ERROR,d),h.addEventListener("message",function(s){var a=s.data;switch(a.cmd){case"init":{var l=JSON.parse(a.config);h.transmuxer=new $.default(o,a.typeSupported,l,a.vendor,a.id),Object(B.enableLogs)(l.debug),d("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($.isPromise)(c)?c.then(function(x){I(h,x)}):I(h,c);break}case"flush":{var R=a.chunkMeta,w=h.transmuxer.flush(R);Object($.isPromise)(w)?w.then(function(x){p(h,x,R)}):p(h,w,R);break}default:break}})}function I(h,o){if(f(o.remuxResult))return;var d=[],s=o.remuxResult,a=s.audio,l=s.video;a&&g(d,a),l&&g(d,l),h.postMessage({event:"transmuxComplete",data:o},d)}function g(h,o){o.data1&&h.push(o.data1.buffer),o.data2&&h.push(o.data2.buffer)}function p(h,o,d){o.forEach(function(s){I(h,s)}),h.postMessage({event:"flush",data:d})}function f(h){return!h.audio&&!h.video&&!h.text&&!h.id3&&!h.initSegment}},"./src/demux/transmuxer.ts":function(oe,J,k){"use strict";k.r(J),k.d(J,"default",function(){return l}),k.d(J,"isPromise",function(){return w}),k.d(J,"TransmuxConfig",function(){return x}),k.d(J,"TransmuxState",function(){return O});var $=k("./src/events.ts"),F=k("./src/errors.ts"),B=k("./src/crypt/decrypter.ts"),G=k("./src/demux/aacdemuxer.ts"),H=k("./src/demux/mp4demuxer.ts"),D=k("./src/demux/tsdemuxer.ts"),I=k("./src/demux/mp3demuxer.ts"),g=k("./src/remux/mp4-remuxer.ts"),p=k("./src/remux/passthrough-remuxer.ts"),f=k("./src/demux/chunk-cache.ts"),h=k("./src/utils/mp4-tools.ts"),o=k("./src/utils/logger.ts"),d;try{d=self.performance.now.bind(self.performance)}catch(A){o.logger.debug("Unable to use Performance API on this environment"),d=self.Date.now}var s=[{demux:D.default,remux:g.default},{demux:H.default,remux:p.default},{demux:G.default,remux:g.default},{demux:I.default,remux:g.default}],a=1024;s.forEach(function(A){var T=A.demux;a=Math.max(a,T.minProbeByteLength)});var l=function(){function A(E,b,u,_,m){this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.cache=new f.default,this.observer=E,this.typeSupported=b,this.config=u,this.vendor=_,this.id=m}var T=A.prototype;return T.configure=function(b){this.transmuxConfig=b,this.decrypter&&this.decrypter.reset()},T.push=function(b,u,_,m){var v=this,M=_.transmuxing;M.executeStart=d();var P=new Uint8Array(b),K=this.cache,V=this.config,U=this.currentTransmuxState,S=this.transmuxConfig;m&&(this.currentTransmuxState=m);var X=c(P,u);if(X&&X.method==="AES-128"){var ee=this.getDecrypter();if(V.enableSoftwareAES){var ae=ee.softwareDecrypt(P,X.key.buffer,X.iv.buffer);if(!ae)return M.executeEnd=d(),R(_);P=new Uint8Array(ae)}else return this.decryptionPromise=ee.webCryptoDecrypt(P,X.key.buffer,X.iv.buffer).then(function(De){var Ne=v.push(De,null,_);return v.decryptionPromise=null,Ne}),this.decryptionPromise}var de=m||U,Ae=de.contiguous,Ee=de.discontinuity,we=de.trackSwitch,he=de.accurateTimeOffset,ce=de.timeOffset,se=S.audioCodec,re=S.videoCodec,xe=S.defaultInitPts,be=S.duration,ke=S.initSegmentData;if((Ee||we)&&this.resetInitSegment(ke,se,re,be),Ee&&this.resetInitialTimestamp(xe),Ae||this.resetContiguity(),this.needsProbing(P,Ee,we)){if(K.dataLength){var Oe=K.flush();P=Object(h.appendUint8Array)(Oe,P)}this.configureTransmuxer(P,S)}var Be=this.transmux(P,X,ce,he,_),Ce=this.currentTransmuxState;return Ce.contiguous=!0,Ce.discontinuity=!1,Ce.trackSwitch=!1,M.executeEnd=d(),Be},T.flush=function(b){var u=this,_=b.transmuxing;_.executeStart=d();var m=this.decrypter,v=this.cache,M=this.currentTransmuxState,P=this.decryptionPromise;if(P)return P.then(function(){return u.flush(b)});var K=[],V=M.timeOffset;if(m){var U=m.flush();U&&K.push(this.push(U,null,b))}var S=v.dataLength;v.reset();var X=this.demuxer,ee=this.remuxer;if(!X||!ee)return S>=a&&this.observer.emit($.Events.ERROR,$.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),_.executeEnd=d(),[R(b)];var ae=X.flush(V);return w(ae)?ae.then(function(de){return u.flushRemux(K,de,b),K}):(this.flushRemux(K,ae,b),K)},T.flushRemux=function(b,u,_){var m=u.audioTrack,v=u.avcTrack,M=u.id3Track,P=u.textTrack,K=this.currentTransmuxState,V=K.accurateTimeOffset,U=K.timeOffset;o.logger.log("[transmuxer.ts]: Flushed fragment "+_.sn+(_.part>-1?" p: "+_.part:"")+" of level "+_.level);var S=this.remuxer.remux(m,v,M,P,U,V,!0,this.id);b.push({remuxResult:S,chunkMeta:_}),_.transmuxing.executeEnd=d()},T.resetInitialTimestamp=function(b){var u=this.demuxer,_=this.remuxer;if(!u||!_)return;u.resetTimeStamp(b),_.resetTimeStamp(b)},T.resetContiguity=function(){var b=this.demuxer,u=this.remuxer;if(!b||!u)return;b.resetContiguity(),u.resetNextTimestamp()},T.resetInitSegment=function(b,u,_,m){var v=this.demuxer,M=this.remuxer;if(!v||!M)return;v.resetInitSegment(u,_,m),M.resetInitSegment(b,u,_)},T.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},T.transmux=function(b,u,_,m,v){var M;return u&&u.method==="SAMPLE-AES"?M=this.transmuxSampleAes(b,u,_,m,v):M=this.transmuxUnencrypted(b,_,m,v),M},T.transmuxUnencrypted=function(b,u,_,m){var v=this.demuxer.demux(b,u,!1,!this.config.progressive),M=v.audioTrack,P=v.avcTrack,K=v.id3Track,V=v.textTrack,U=this.remuxer.remux(M,P,K,V,u,_,!1,this.id);return{remuxResult:U,chunkMeta:m}},T.transmuxSampleAes=function(b,u,_,m,v){var M=this;return this.demuxer.demuxSampleAes(b,u,_).then(function(P){var K=M.remuxer.remux(P.audioTrack,P.avcTrack,P.id3Track,P.textTrack,_,m,!1,M.id);return{remuxResult:K,chunkMeta:v}})},T.configureTransmuxer=function(b,u){for(var _=this.config,m=this.observer,v=this.typeSupported,M=this.vendor,P=u.audioCodec,K=u.defaultInitPts,V=u.duration,U=u.initSegmentData,S=u.videoCodec,X,ee=0,ae=s.length;ee<ae;ee++)if(s[ee].demux.probe(b)){X=s[ee];break}X||(o.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),X={demux:H.default,remux:p.default});var de=this.demuxer,Ae=this.remuxer,Ee=X.remux,we=X.demux;(!Ae||!(Ae instanceof Ee))&&(this.remuxer=new Ee(m,_,v,M)),(!de||!(de instanceof we))&&(this.demuxer=new we(m,_,v),this.probe=we.probe),this.resetInitSegment(U,P,S,V),this.resetInitialTimestamp(K)},T.needsProbing=function(b,u,_){return!this.demuxer||!this.remuxer||u||_},T.getDecrypter=function(){var b=this.decrypter;return b||(b=this.decrypter=new B.default(this.observer,this.config)),b},A}();function c(A,T){var E=null;return A.byteLength>0&&T!=null&&T.key!=null&&T.iv!==null&&T.method!=null&&(E=T),E}var R=function(T){return{remuxResult:{},chunkMeta:T}};function w(A){return"then"in A&&A.then instanceof Function}var x=function(T,E,b,u,_){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=T,this.videoCodec=E,this.initSegmentData=b,this.duration=u,this.defaultInitPts=_},O=function(T,E,b,u,_){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=T,this.contiguous=E,this.accurateTimeOffset=b,this.trackSwitch=u,this.timeOffset=_}},"./src/demux/tsdemuxer.ts":function(oe,J,k){"use strict";k.r(J),k.d(J,"discardEPB",function(){return R});var $=k("./src/demux/adts.ts"),F=k("./src/demux/mpegaudio.ts"),B=k("./src/demux/exp-golomb.ts"),G=k("./src/demux/id3.ts"),H=k("./src/demux/sample-aes.ts"),D=k("./src/events.ts"),I=k("./src/utils/mp4-tools.ts"),g=k("./src/utils/logger.ts"),p=k("./src/errors.ts"),f={video:1,audio:2,id3:3,text:4},h=function(){function w(O,A,T){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=T}w.probe=function(A){var T=w.syncOffset(A);return T<0?!1:(T&&g.logger.warn("MPEG2-TS detected but first sync word found @ offset "+T+", junk ahead ?"),!0)},w.syncOffset=function(A){for(var T=Math.min(1e3,A.length-3*188),E=0;E<T;){if(A[E]===71&&A[E+188]===71&&A[E+2*188]===71)return E;E++}return-1},w.createTrack=function(A,T){return{container:A==="video"||A==="audio"?"video/mp2t":void 0,type:A,id:f[A],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:A==="audio"?T:void 0}};var x=w.prototype;return x.resetInitSegment=function(A,T,E){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=w.createTrack("video",E),this._audioTrack=w.createTrack("audio",E),this._id3Track=w.createTrack("id3",E),this._txtTrack=w.createTrack("text",E),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=A,this.videoCodec=T,this._duration=E},x.resetTimeStamp=function(){},x.resetContiguity=function(){var A=this._audioTrack,T=this._avcTrack,E=this._id3Track;A&&(A.pesData=null),T&&(T.pesData=null),E&&(E.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},x.demux=function(A,T,E,b){E===void 0&&(E=!1),b===void 0&&(b=!1),E||(this.sampleAes=null);var u,_=this._avcTrack,m=this._audioTrack,v=this._id3Track,M=_.pid,P=_.pesData,K=m.pid,V=v.pid,U=m.pesData,S=v.pesData,X=!1,ee=this.pmtParsed,ae=this._pmtId,de=A.length;if(this.remainderData&&(A=Object(I.appendUint8Array)(this.remainderData,A),de=A.length,this.remainderData=null),de<188&&!b)return this.remainderData=A,{audioTrack:m,avcTrack:_,id3Track:v,textTrack:this._txtTrack};var Ae=Math.max(0,w.syncOffset(A));de-=(de+Ae)%188,de<A.byteLength&&!b&&(this.remainderData=new Uint8Array(A.buffer,de,A.buffer.byteLength-de));for(var Ee=Ae;Ee<de;Ee+=188)if(A[Ee]===71){var we=!!(A[Ee+1]&64),he=((A[Ee+1]&31)<<8)+A[Ee+2],ce=(A[Ee+3]&48)>>4,se=void 0;if(ce>1){if(se=Ee+5+A[Ee+4],se===Ee+188)continue}else se=Ee+4;switch(he){case M:we&&(P&&(u=a(P))&&this.parseAVCPES(u,!1),P={data:[],size:0}),P&&(P.data.push(A.subarray(se,Ee+188)),P.size+=Ee+188-se);break;case K:we&&(U&&(u=a(U))&&(m.isAAC?this.parseAACPES(u):this.parseMPEGPES(u)),U={data:[],size:0}),U&&(U.data.push(A.subarray(se,Ee+188)),U.size+=Ee+188-se);break;case V:we&&(S&&(u=a(S))&&this.parseID3PES(u),S={data:[],size:0}),S&&(S.data.push(A.subarray(se,Ee+188)),S.size+=Ee+188-se);break;case 0:we&&(se+=A[se]+1),ae=this._pmtId=d(A,se);break;case ae:{we&&(se+=A[se]+1);var re=s(A,se,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,E);M=re.avc,M>0&&(_.pid=M),K=re.audio,K>0&&(m.pid=K,m.isAAC=re.isAAC),V=re.id3,V>0&&(v.pid=V),X&&!ee&&(g.logger.log("reparse from beginning"),X=!1,Ee=Ae-188),ee=this.pmtParsed=!0;break}case 17:case 8191:break;default:X=!0;break}}else this.observer.emit(D.Events.ERROR,D.Events.ERROR,{type:p.ErrorTypes.MEDIA_ERROR,details:p.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});_.pesData=P,m.pesData=U,v.pesData=S;var xe={audioTrack:m,avcTrack:_,id3Track:v,textTrack:this._txtTrack};return b&&this.extractRemainingSamples(xe),xe},x.flush=function(){var A=this.remainderData;this.remainderData=null;var T;return A?T=this.demux(A,-1,!1,!0):T={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(T),this.sampleAes?this.decrypt(T,this.sampleAes):T},x.extractRemainingSamples=function(A){var T=A.audioTrack,E=A.avcTrack,b=A.id3Track,u=E.pesData,_=T.pesData,m=b.pesData,v;u&&(v=a(u))?(this.parseAVCPES(v,!0),E.pesData=null):E.pesData=u,_&&(v=a(_))?(T.isAAC?this.parseAACPES(v):this.parseMPEGPES(v),T.pesData=null):(_!=null&&_.size&&g.logger.log("last AAC PES packet truncated,might overlap between fragments"),T.pesData=_),m&&(v=a(m))?(this.parseID3PES(v),b.pesData=null):b.pesData=m},x.demuxSampleAes=function(A,T,E){var b=this.demux(A,E,!0,!this.config.progressive),u=this.sampleAes=new H.default(this.observer,this.config,T);return this.decrypt(b,u)},x.decrypt=function(A,T){return new Promise(function(E){var b=A.audioTrack,u=A.avcTrack;b.samples&&b.isAAC?T.decryptAacSamples(b.samples,0,function(){u.samples?T.decryptAvcSamples(u.samples,0,0,function(){E(A)}):E(A)}):u.samples&&T.decryptAvcSamples(u.samples,0,0,function(){E(A)})})},x.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},x.parseAVCPES=function(A,T){var E=this,b=this._avcTrack,u=this.parseAVCNALu(A.data),_=!1,m=this.avcSample,v,M=!1;A.data=null,m&&u.length&&!b.audFound&&(l(m,b),m=this.avcSample=o(!1,A.pts,A.dts,"")),u.forEach(function(P){switch(P.type){case 1:{v=!0,m||(m=E.avcSample=o(!0,A.pts,A.dts,"")),_&&(m.debug+="NDR "),m.frame=!0;var K=P.data;if(M&&K.length>4){var V=new B.default(K).readSliceType();(V===2||V===4||V===7||V===9)&&(m.key=!0)}break}case 5:v=!0,m||(m=E.avcSample=o(!0,A.pts,A.dts,"")),_&&(m.debug+="IDR "),m.key=!0,m.frame=!0;break;case 6:{v=!0,_&&m&&(m.debug+="SEI ");var U=new B.default(R(P.data));U.readUByte();for(var S=0,X=0,ee=!1,ae=0;!ee&&U.bytesAvailable>1;){S=0;do ae=U.readUByte(),S+=ae;while(ae===255);X=0;do ae=U.readUByte(),X+=ae;while(ae===255);if(S===4&&U.bytesAvailable!==0){ee=!0;var de=U.readUByte();if(de===181){var Ae=U.readUShort();if(Ae===49){var Ee=U.readUInt();if(Ee===1195456820){var we=U.readUByte();if(we===3){for(var he=U.readUByte(),ce=U.readUByte(),se=31&he,re=[he,ce],xe=0;xe<se;xe++)re.push(U.readUByte()),re.push(U.readUByte()),re.push(U.readUByte());c(E._txtTrack.samples,{type:3,pts:A.pts,bytes:re})}}}}}else if(S===5&&U.bytesAvailable!==0){if(ee=!0,X>16){for(var be=[],ke=0;ke<16;ke++)be.push(U.readUByte().toString(16)),(ke===3||ke===5||ke===7||ke===9)&&be.push("-");for(var Oe=X-16,Be=new Uint8Array(Oe),Ce=0;Ce<Oe;Ce++)Be[Ce]=U.readUByte();c(E._txtTrack.samples,{pts:A.pts,payloadType:S,uuid:be.join(""),userData:Object(G.utf8ArrayToStr)(Be),userDataBytes:Be})}}else if(X<U.bytesAvailable)for(var De=0;De<X;De++)U.readUByte()}break}case 7:if(v=!0,M=!0,_&&m&&(m.debug+="SPS "),!b.sps){var Ne=new B.default(P.data),Ke=Ne.readSPS();b.width=Ke.width,b.height=Ke.height,b.pixelRatio=Ke.pixelRatio,b.sps=[P.data],b.duration=E._duration;for(var Fe=P.data.subarray(1,4),je="avc1.",Me=0;Me<3;Me++){var et=Fe[Me].toString(16);et.length<2&&(et="0"+et),je+=et}b.codec=je}break;case 8:v=!0,_&&m&&(m.debug+="PPS "),b.pps||(b.pps=[P.data]);break;case 9:v=!1,b.audFound=!0,m&&l(m,b),m=E.avcSample=o(!1,A.pts,A.dts,_?"AUD ":"");break;case 12:v=!1;break;default:v=!1,m&&(m.debug+="unknown NAL "+P.type+" ");break}if(m&&v){var Je=m.units;Je.push(P)}}),T&&m&&(l(m,b),this.avcSample=null)},x.getLastNalUnit=function(){var A,T=this.avcSample,E;if(!T||T.units.length===0){var b=this._avcTrack.samples;T=b[b.length-1]}if((A=T)!==null&&A!==void 0&&A.units){var u=T.units;E=u[u.length-1]}return E},x.parseAVCNALu=function(A){var T=A.byteLength,E=this._avcTrack,b=E.naluState||0,u=b,_=[],m=0,v,M,P,K=-1,V=0;for(b===-1&&(K=0,V=A[0]&31,b=0,m=1);m<T;){if(v=A[m++],!b){b=v?0:1;continue}if(b===1){b=v?0:2;continue}if(!v)b=3;else if(v===1){if(K>=0){var U={data:A.subarray(K,m-b-1),type:V};_.push(U)}else{var S=this.getLastNalUnit();if(S&&(u&&m<=4-u&&(S.state&&(S.data=S.data.subarray(0,S.data.byteLength-u))),M=m-b-1,M>0)){var X=new Uint8Array(S.data.byteLength+M);X.set(S.data,0),X.set(A.subarray(0,M),S.data.byteLength),S.data=X,S.state=0}}m<T?(P=A[m]&31,K=m,V=P,b=0):b=-1}else b=0}if(K>=0&&b>=0){var ee={data:A.subarray(K,T),type:V,state:b};_.push(ee)}if(_.length===0){var ae=this.getLastNalUnit();if(ae){var de=new Uint8Array(ae.data.byteLength+A.byteLength);de.set(ae.data,0),de.set(A,ae.data.byteLength),ae.data=de}}return E.naluState=b,_},x.parseAACPES=function(A){var T=0,E=this._audioTrack,b=this.aacOverFlow,u=A.data;if(b){this.aacOverFlow=null;var _=b.sample.unit.byteLength,m=Math.min(b.missing,_),v=_-m;b.sample.unit.set(u.subarray(0,m),v),E.samples.push(b.sample),T=b.missing}var M,P;for(M=T,P=u.length;M<P-1&&!$.isHeader(u,M);M++);if(M!==T){var K,V;if(M<P-1?(K="AAC PES did not start with ADTS header,offset:"+M,V=!1):(K="no ADTS header found in AAC PES",V=!0),g.logger.warn("parsing error:"+K),this.observer.emit(D.Events.ERROR,D.Events.ERROR,{type:p.ErrorTypes.MEDIA_ERROR,details:p.ErrorDetails.FRAG_PARSING_ERROR,fatal:V,reason:K}),V)return}$.initTrackConfig(E,this.observer,u,M,this.audioCodec);var U;if(A.pts!==void 0)U=A.pts;else if(b){var S=$.getFrameDuration(E.samplerate);U=b.sample.pts+S}else{g.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var X=0;M<P;)if($.isHeader(u,M)){if(M+5<P){var ee=$.appendFrame(E,u,M,U,X);if(ee)if(ee.missing)this.aacOverFlow=ee;else{M+=ee.length,X++;continue}}break}else M++},x.parseMPEGPES=function(A){var T=A.data,E=T.length,b=0,u=0,_=A.pts;if(_===void 0){g.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;u<E;)if(F.isHeader(T,u)){var m=F.appendFrame(this._audioTrack,T,u,_,b);if(m)u+=m.length,b++;else break}else u++},x.parseID3PES=function(A){if(A.pts===void 0){g.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(A)},w}();h.minProbeByteLength=188;function o(w,x,O,A){return{key:w,frame:!1,pts:x,dts:O,units:[],debug:A,length:0}}function d(w,x){return(w[x+10]&31)<<8|w[x+11]}function s(w,x,O,A){var T={audio:-1,avc:-1,id3:-1,isAAC:!0},E=(w[x+1]&15)<<8|w[x+2],b=x+3+E-4,u=(w[x+10]&15)<<8|w[x+11];for(x+=12+u;x<b;){var _=(w[x+1]&31)<<8|w[x+2];switch(w[x]){case 207:if(!A){g.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:T.audio===-1&&(T.audio=_);break;case 21:T.id3===-1&&(T.id3=_);break;case 219:if(!A){g.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:T.avc===-1&&(T.avc=_);break;case 3:case 4:O?T.audio===-1&&(T.audio=_,T.isAAC=!1):g.logger.log("MPEG audio found, not supported in this browser");break;case 36:g.logger.warn("Unsupported HEVC stream type found");break;default:break}x+=((w[x+3]&15)<<8|w[x+4])+5}return T}function a(w){var x=0,O,A,T,E,b,u=w.data;if(!w||w.size===0)return null;for(;u[0].length<19&&u.length>1;){var _=new Uint8Array(u[0].length+u[1].length);_.set(u[0]),_.set(u[1],u[0].length),u[0]=_,u.splice(1,1)}O=u[0];var m=(O[0]<<16)+(O[1]<<8)+O[2];if(m===1){if(A=(O[4]<<8)+O[5],A&&A>w.size-6)return null;var v=O[7];v&192&&(E=(O[9]&14)*536870912+(O[10]&255)*4194304+(O[11]&254)*16384+(O[12]&255)*128+(O[13]&254)/2,v&64?(b=(O[14]&14)*536870912+(O[15]&255)*4194304+(O[16]&254)*16384+(O[17]&255)*128+(O[18]&254)/2,E-b>60*9e4&&(g.logger.warn(Math.round((E-b)/9e4)+"s delta between PTS and DTS, align them"),E=b)):b=E),T=O[8];var M=T+9;if(w.size<=M)return null;w.size-=M;for(var P=new Uint8Array(w.size),K=0,V=u.length;K<V;K++){O=u[K];var U=O.byteLength;if(M)if(M>U){M-=U;continue}else O=O.subarray(M),U-=M,M=0;P.set(O,x),x+=U}return A&&(A-=T+3),{data:P,pts:E,dts:b,len:A}}return null}function l(w,x){if(w.units.length&&w.frame){if(w.pts===void 0){var O=x.samples,A=O.length;if(A){var T=O[A-1];w.pts=T.pts,w.dts=T.dts}else{x.dropped++;return}}x.samples.push(w)}w.debug.length&&g.logger.log(w.pts+"/"+w.dts+":"+w.debug)}function c(w,x){var O=w.length;if(O>0){if(x.pts>=w[O-1].pts)w.push(x);else for(var A=O-1;A>=0;A--)if(x.pts<w[A].pts){w.splice(A,0,x);break}}else w.push(x)}function R(w){for(var x=w.byteLength,O=[],A=1;A<x-2;)w[A]===0&&w[A+1]===0&&w[A+2]===3?(O.push(A+2),A+=2):A++;if(O.length===0)return w;var T=x-O.length,E=new Uint8Array(T),b=0;for(A=0;A<T;b++,A++)b===O[0]&&(b++,O.shift()),E[A]=w[b];return E}J.default=h},"./src/errors.ts":function(oe,J,k){"use strict";k.r(J),k.d(J,"ErrorTypes",function(){return $}),k.d(J,"ErrorDetails",function(){return F});var $;(function(B){B.NETWORK_ERROR="networkError",B.MEDIA_ERROR="mediaError",B.KEY_SYSTEM_ERROR="keySystemError",B.MUX_ERROR="muxError",B.OTHER_ERROR="otherError"})($||($={}));var F;(function(B){B.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",B.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",B.KEY_SYSTEM_NO_SESSION="keySystemNoSession",B.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",B.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",B.MANIFEST_LOAD_ERROR="manifestLoadError",B.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",B.MANIFEST_PARSING_ERROR="manifestParsingError",B.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",B.LEVEL_EMPTY_ERROR="levelEmptyError",B.LEVEL_LOAD_ERROR="levelLoadError",B.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",B.LEVEL_SWITCH_ERROR="levelSwitchError",B.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",B.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",B.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",B.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",B.FRAG_LOAD_ERROR="fragLoadError",B.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",B.FRAG_DECRYPT_ERROR="fragDecryptError",B.FRAG_PARSING_ERROR="fragParsingError",B.REMUX_ALLOC_ERROR="remuxAllocError",B.KEY_LOAD_ERROR="keyLoadError",B.KEY_LOAD_TIMEOUT="keyLoadTimeOut",B.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",B.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",B.BUFFER_APPEND_ERROR="bufferAppendError",B.BUFFER_APPENDING_ERROR="bufferAppendingError",B.BUFFER_STALLED_ERROR="bufferStalledError",B.BUFFER_FULL_ERROR="bufferFullError",B.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",B.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",B.INTERNAL_EXCEPTION="internalException",B.INTERNAL_ABORTED="aborted",B.UNKNOWN="unknown"})(F||(F={}))},"./src/events.ts":function(oe,J,k){"use strict";k.r(J),k.d(J,"Events",function(){return $});var $;(function(F){F.MEDIA_ATTACHING="hlsMediaAttaching",F.MEDIA_ATTACHED="hlsMediaAttached",F.MEDIA_DETACHING="hlsMediaDetaching",F.MEDIA_DETACHED="hlsMediaDetached",F.BUFFER_RESET="hlsBufferReset",F.BUFFER_CODECS="hlsBufferCodecs",F.BUFFER_CREATED="hlsBufferCreated",F.BUFFER_APPENDING="hlsBufferAppending",F.BUFFER_APPENDED="hlsBufferAppended",F.BUFFER_EOS="hlsBufferEos",F.BUFFER_FLUSHING="hlsBufferFlushing",F.BUFFER_FLUSHED="hlsBufferFlushed",F.MANIFEST_LOADING="hlsManifestLoading",F.MANIFEST_LOADED="hlsManifestLoaded",F.MANIFEST_PARSED="hlsManifestParsed",F.LEVEL_SWITCHING="hlsLevelSwitching",F.LEVEL_SWITCHED="hlsLevelSwitched",F.LEVEL_LOADING="hlsLevelLoading",F.LEVEL_LOADED="hlsLevelLoaded",F.LEVEL_UPDATED="hlsLevelUpdated",F.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",F.LEVELS_UPDATED="hlsLevelsUpdated",F.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",F.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",F.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",F.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",F.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",F.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",F.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",F.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",F.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",F.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",F.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",F.CUES_PARSED="hlsCuesParsed",F.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",F.INIT_PTS_FOUND="hlsInitPtsFound",F.FRAG_LOADING="hlsFragLoading",F.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",F.FRAG_LOADED="hlsFragLoaded",F.FRAG_DECRYPTED="hlsFragDecrypted",F.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",F.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",F.FRAG_PARSING_METADATA="hlsFragParsingMetadata",F.FRAG_PARSED="hlsFragParsed",F.FRAG_BUFFERED="hlsFragBuffered",F.FRAG_CHANGED="hlsFragChanged",F.FPS_DROP="hlsFpsDrop",F.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",F.ERROR="hlsError",F.DESTROYING="hlsDestroying",F.KEY_LOADING="hlsKeyLoading",F.KEY_LOADED="hlsKeyLoaded",F.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",F.BACK_BUFFER_REACHED="hlsBackBufferReached"})($||($={}))},"./src/hls.ts":function(oe,J,k){"use strict";k.r(J),k.d(J,"default",function(){return w});var $=k("./node_modules/url-toolkit/src/url-toolkit.js"),F=k.n($),B=k("./src/loader/playlist-loader.ts"),G=k("./src/loader/key-loader.ts"),H=k("./src/controller/id3-track-controller.ts"),D=k("./src/controller/latency-controller.ts"),I=k("./src/controller/level-controller.ts"),g=k("./src/controller/fragment-tracker.ts"),p=k("./src/controller/stream-controller.ts"),f=k("./src/is-supported.ts"),h=k("./src/utils/logger.ts"),o=k("./src/config.ts"),d=k("./node_modules/eventemitter3/index.js"),s=k.n(d),a=k("./src/events.ts"),l=k("./src/errors.ts");function c(x,O){for(var A=0;A<O.length;A++){var T=O[A];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(x,T.key,T)}}function R(x,O,A){return O&&c(x.prototype,O),A&&c(x,A),x}var w=function(){x.isSupported=function(){return Object(f.isSupported)()};function x(A){A===void 0&&(A={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new d.EventEmitter,this._autoLevelCapping=void 0,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null;var T=this.config=Object(o.mergeConfig)(x.DefaultConfig,A);this.userConfig=A,Object(h.enableLogs)(T.debug),this._autoLevelCapping=-1,T.progressive&&Object(o.enableStreamingMode)(T);var E=T.abrController,b=T.bufferController,u=T.capLevelController,_=T.fpsController,m=this.abrController=new E(this),v=this.bufferController=new b(this),M=this.capLevelController=new u(this),P=new _(this),K=new B.default(this),V=new G.default(this),U=new H.default(this),S=this.levelController=new I.default(this),X=new g.FragmentTracker(this),ee=this.streamController=new p.default(this,X);M.setStreamController(ee),P.setStreamController(ee);var ae=[S,ee];this.networkControllers=ae;var de=[K,V,m,v,M,P,U,X];this.audioTrackController=this.createController(T.audioTrackController,null,ae),this.createController(T.audioStreamController,X,ae),this.subtitleTrackController=this.createController(T.subtitleTrackController,null,ae),this.createController(T.subtitleStreamController,X,ae),this.createController(T.timelineController,null,de),this.emeController=this.createController(T.emeController,null,de),this.cmcdController=this.createController(T.cmcdController,null,de),this.latencyController=this.createController(D.default,null,de),this.coreComponents=de}var O=x.prototype;return O.createController=function(T,E,b){if(T){var u=E?new T(this,E):new T(this);return b&&b.push(u),u}return null},O.on=function(T,E,b){b===void 0&&(b=this),this._emitter.on(T,E,b)},O.once=function(T,E,b){b===void 0&&(b=this),this._emitter.once(T,E,b)},O.removeAllListeners=function(T){this._emitter.removeAllListeners(T)},O.off=function(T,E,b,u){b===void 0&&(b=this),this._emitter.off(T,E,b,u)},O.listeners=function(T){return this._emitter.listeners(T)},O.emit=function(T,E,b){return this._emitter.emit(T,E,b)},O.trigger=function(T,E){if(this.config.debug)return this.emit(T,T,E);try{return this.emit(T,T,E)}catch(b){h.logger.error("An internal error happened while handling event "+T+'. Error message: "'+b.message+'". Here is a stacktrace:',b),this.trigger(a.Events.ERROR,{type:l.ErrorTypes.OTHER_ERROR,details:l.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:T,error:b})}return!1},O.listenerCount=function(T){return this._emitter.listenerCount(T)},O.destroy=function(){h.logger.log("destroy"),this.trigger(a.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(T){return T.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(T){return T.destroy()}),this.coreComponents.length=0},O.attachMedia=function(T){h.logger.log("attachMedia"),this._media=T,this.trigger(a.Events.MEDIA_ATTACHING,{media:T})},O.detachMedia=function(){h.logger.log("detachMedia"),this.trigger(a.Events.MEDIA_DETACHING,void 0),this._media=null},O.loadSource=function(T){this.stopLoad();var E=this.media,b=this.url,u=this.url=$.buildAbsoluteURL(self.location.href,T,{alwaysNormalize:!0});h.logger.log("loadSource:"+u),E&&b&&b!==u&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(E)),this.trigger(a.Events.MANIFEST_LOADING,{url:T})},O.startLoad=function(T){T===void 0&&(T=-1),h.logger.log("startLoad("+T+")"),this.networkControllers.forEach(function(E){E.startLoad(T)})},O.stopLoad=function(){h.logger.log("stopLoad"),this.networkControllers.forEach(function(T){T.stopLoad()})},O.swapAudioCodec=function(){h.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},O.recoverMediaError=function(){h.logger.log("recoverMediaError");var T=this._media;this.detachMedia(),T&&this.attachMedia(T)},O.removeLevel=function(T,E){E===void 0&&(E=0),this.levelController.removeLevel(T,E)},R(x,[{key:"levels",get:function(){var T=this.levelController.levels;return T||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(T){h.logger.log("set currentLevel:"+T),this.loadLevel=T,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(T){h.logger.log("set nextLevel:"+T),this.levelController.manualLevel=T,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(T){h.logger.log("set loadLevel:"+T),this.levelController.manualLevel=T}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(T){this.levelController.nextLoadLevel=T}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(T){h.logger.log("set firstLevel:"+T),this.levelController.firstLevel=T}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(T){h.logger.log("set startLevel:"+T),T!==-1&&(T=Math.max(T,this.minAutoLevel)),this.levelController.startLevel=T}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(T){var E=!!T;E!==this.config.capLevelToPlayerSize&&(E?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=E)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(T){this._autoLevelCapping!==T&&(h.logger.log("set autoLevelCapping:"+T),this._autoLevelCapping=T)}},{key:"bandwidthEstimate",get:function(){var T=this.abrController.bwEstimator;return T?T.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var T=this.levels,E=this.config.minAutoBitrate;if(!T)return 0;for(var b=T.length,u=0;u<b;u++)if(T[u].maxBitrate>E)return u;return 0}},{key:"maxAutoLevel",get:function(){var T=this.levels,E=this.autoLevelCapping,b;return E===-1&&T&&T.length?b=T.length-1:b=E,b}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(T){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,T)}},{key:"audioTracks",get:function(){var T=this.audioTrackController;return T?T.audioTracks:[]}},{key:"audioTrack",get:function(){var T=this.audioTrackController;return T?T.audioTrack:-1},set:function(T){var E=this.audioTrackController;E&&(E.audioTrack=T)}},{key:"subtitleTracks",get:function(){var T=this.subtitleTrackController;return T?T.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var T=this.subtitleTrackController;return T?T.subtitleTrack:-1},set:function(T){var E=this.subtitleTrackController;E&&(E.subtitleTrack=T)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var T=this.subtitleTrackController;return T?T.subtitleDisplay:!1},set:function(T){var E=this.subtitleTrackController;E&&(E.subtitleDisplay=T)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(T){this.config.lowLatencyMode=T}},{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 l.ErrorTypes}},{key:"ErrorDetails",get:function(){return l.ErrorDetails}},{key:"DefaultConfig",get:function(){return x.defaultConfig?x.defaultConfig:o.hlsDefaultConfig},set:function(T){x.defaultConfig=T}}]),x}();w.defaultConfig=void 0},"./src/is-supported.ts":function(oe,J,k){"use strict";k.r(J),k.d(J,"isSupported",function(){return B}),k.d(J,"changeTypeSupported",function(){return G});var $=k("./src/utils/mediasource-helper.ts");function F(){return self.SourceBuffer||self.WebKitSourceBuffer}function B(){var H=Object($.getMediaSource)();if(!H)return!1;var D=F(),I=H&&typeof H.isTypeSupported=="function"&&H.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),g=!D||D.prototype&&typeof D.prototype.appendBuffer=="function"&&typeof D.prototype.remove=="function";return!!I&&!!g}function G(){var H,D=F();return typeof(D==null||((H=D.prototype)===null||H===void 0)?void 0:H.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(oe,J,k){"use strict";k.r(J),k.d(J,"default",function(){return h}),k.d(J,"LoadError",function(){return d});var $=k("./src/polyfills/number.ts"),F=k("./src/errors.ts");function B(s,a){s.prototype=Object.create(a.prototype),s.prototype.constructor=s,g(s,a)}function G(s){var a=typeof Map=="function"?new Map:void 0;return G=function(c){if(c===null||!I(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,R)}function R(){return H(c,arguments,p(this).constructor)}return R.prototype=Object.create(c.prototype,{constructor:{value:R,enumerable:!1,writable:!0,configurable:!0}}),g(R,c)},G(s)}function H(s,a,l){return D()?H=Reflect.construct:H=function(R,w,x){var O=[null];O.push.apply(O,w);var A=Function.bind.apply(R,O),T=new A;return x&&g(T,x.prototype),T},H.apply(null,arguments)}function D(){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(s){return!1}}function I(s){return Function.toString.call(s).indexOf("[native code]")!==-1}function g(s,a){return g=Object.setPrototypeOf||function(c,R){return c.__proto__=R,c},g(s,a)}function p(s){return p=Object.setPrototypeOf?Object.getPrototypeOf:function(l){return l.__proto__||Object.getPrototypeOf(l)},p(s)}var f=Math.pow(2,17),h=function(){function s(l){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=l}var a=s.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,R){var w=this,x=c.url;if(!x)return Promise.reject(new d({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:c,networkDetails:null},"Fragment does not have a "+(x?"part list":"url")));this.abort();var O=this.config,A=O.fLoader,T=O.loader;return new Promise(function(E,b){w.loader&&w.loader.destroy();var u=w.loader=c.loader=A?new A(O):new T(O),_=o(c),m={timeout:O.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:O.fragLoadingMaxRetryTimeout,highWaterMark:f};c.stats=u.stats,u.load(_,m,{onSuccess:function(M,P,K,V){w.resetLoader(c,u),E({frag:c,part:null,payload:M.data,networkDetails:V})},onError:function(M,P,K){w.resetLoader(c,u),b(new d({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:c,response:M,networkDetails:K}))},onAbort:function(M,P,K){w.resetLoader(c,u),b(new d({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:c,networkDetails:K}))},onTimeout:function(M,P,K){w.resetLoader(c,u),b(new d({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:c,networkDetails:K}))},onProgress:function(M,P,K,V){R&&R({frag:c,part:null,payload:K,networkDetails:V})}})})},a.loadPart=function(c,R,w){var x=this;this.abort();var O=this.config,A=O.fLoader,T=O.loader;return new Promise(function(E,b){x.loader&&x.loader.destroy();var u=x.loader=c.loader=A?new A(O):new T(O),_=o(c,R),m={timeout:O.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:O.fragLoadingMaxRetryTimeout,highWaterMark:f};R.stats=u.stats,u.load(_,m,{onSuccess:function(M,P,K,V){x.resetLoader(c,u),x.updateStatsFromPart(c,R);var U={frag:c,part:R,payload:M.data,networkDetails:V};w(U),E(U)},onError:function(M,P,K){x.resetLoader(c,u),b(new d({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:c,part:R,response:M,networkDetails:K}))},onAbort:function(M,P,K){c.stats.aborted=R.stats.aborted,x.resetLoader(c,u),b(new d({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:c,part:R,networkDetails:K}))},onTimeout:function(M,P,K){x.resetLoader(c,u),b(new d({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:c,part:R,networkDetails:K}))}})})},a.updateStatsFromPart=function(c,R){var w=c.stats,x=R.stats,O=x.total;if(w.loaded+=x.loaded,O){var A=Math.round(c.duration/R.duration),T=Math.min(Math.round(w.loaded/O),A),E=A-T,b=E*Math.round(w.loaded/T);w.total=w.loaded+b}else w.total=Math.max(w.loaded,w.total);var u=w.loading,_=x.loading;u.start?u.first+=_.first-_.start:(u.start=_.start,u.first=_.first),u.end=_.end},a.resetLoader=function(c,R){c.loader=null,this.loader===R&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),R.destroy()},s}();function o(s,a){a===void 0&&(a=null);var l=a||s,c={frag:s,part:a,responseType:"arraybuffer",url:l.url,headers:{},rangeStart:0,rangeEnd:0},R=l.byteRangeStartOffset,w=l.byteRangeEndOffset;return Object($.isFiniteNumber)(R)&&Object($.isFiniteNumber)(w)&&(c.rangeStart=R,c.rangeEnd=w),c}var d=function(s){B(a,s);function a(l){for(var c,R=arguments.length,w=new Array(R>1?R-1:0),x=1;x<R;x++)w[x-1]=arguments[x];return c=s.call.apply(s,[this].concat(w))||this,c.data=void 0,c.data=l,c}return a}(G(Error))},"./src/loader/fragment.ts":function(oe,J,k){"use strict";k.r(J),k.d(J,"ElementaryStreamTypes",function(){return h}),k.d(J,"BaseSegment",function(){return o}),k.d(J,"Fragment",function(){return d}),k.d(J,"Part",function(){return s});var $=k("./src/polyfills/number.ts"),F=k("./node_modules/url-toolkit/src/url-toolkit.js"),B=k.n(F),G=k("./src/utils/logger.ts"),H=k("./src/loader/level-key.ts"),D=k("./src/loader/load-stats.ts");function I(a,l){a.prototype=Object.create(l.prototype),a.prototype.constructor=a,g(a,l)}function g(a,l){return g=Object.setPrototypeOf||function(R,w){return R.__proto__=w,R},g(a,l)}function p(a,l){for(var c=0;c<l.length;c++){var R=l[c];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(a,R.key,R)}}function f(a,l,c){return l&&p(a.prototype,l),c&&p(a,c),a}var h;(function(a){a.AUDIO="audio",a.VIDEO="video",a.AUDIOVIDEO="audiovideo"})(h||(h={}));var o=function(){function a(c){var R;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(R={},R[h.AUDIO]=null,R[h.VIDEO]=null,R[h.AUDIOVIDEO]=null,R),this.baseurl=c}var l=a.prototype;return l.setByteRange=function(R,w){var x=R.split("@",2),O=[];x.length===1?O[0]=w?w.byteRangeEndOffset:0:O[0]=parseInt(x[1]),O[1]=parseInt(x[0])+O[0],this._byteRange=O},f(a,[{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Object(F.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(R){this._url=R}}]),a}(),d=function(a){I(l,a);function l(R,w){var x;return x=a.call(this,w)||this,x._decryptdata=null,x.rawProgramDateTime=null,x.programDateTime=null,x.tagList=[],x.duration=0,x.sn=0,x.levelkey=void 0,x.type=void 0,x.loader=null,x.level=-1,x.cc=0,x.startPTS=void 0,x.endPTS=void 0,x.appendedPTS=void 0,x.startDTS=void 0,x.endDTS=void 0,x.start=0,x.deltaPTS=void 0,x.maxStartPTS=void 0,x.minEndPTS=void 0,x.stats=new D.LoadStats,x.urlId=0,x.data=void 0,x.bitrateTest=!1,x.title=null,x.initSegment=null,x.type=R,x}var c=l.prototype;return c.createInitializationVector=function(w){for(var x=new Uint8Array(16),O=12;O<16;O++)x[O]=w>>8*(15-O)&255;return x},c.setDecryptDataFromLevelKey=function(w,x){var O=w;return(w==null?void 0:w.method)==="AES-128"&&w.uri&&!w.iv&&(O=H.LevelKey.fromURI(w.uri),O.method=w.method,O.iv=this.createInitializationVector(x),O.keyFormat="identity"),O},c.setElementaryStreamInfo=function(w,x,O,A,T,E){E===void 0&&(E=!1);var b=this.elementaryStreams,u=b[w];if(!u){b[w]={startPTS:x,endPTS:O,startDTS:A,endDTS:T,partial:E};return}u.startPTS=Math.min(u.startPTS,x),u.endPTS=Math.max(u.endPTS,O),u.startDTS=Math.min(u.startDTS,A),u.endDTS=Math.max(u.endDTS,T)},c.clearElementaryStreamInfo=function(){var w=this.elementaryStreams;w[h.AUDIO]=null,w[h.VIDEO]=null,w[h.AUDIOVIDEO]=null},f(l,[{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&&G.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($.isFiniteNumber)(this.programDateTime))return null;var w=Object($.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)}}]),l}(o),s=function(a){I(l,a);function l(c,R,w,x,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 D.LoadStats,A.duration=c.decimalFloatingPoint("DURATION"),A.gap=c.bool("GAP"),A.independent=c.bool("INDEPENDENT"),A.relurl=c.enumeratedString("URI"),A.fragment=R,A.index=x;var T=c.enumeratedString("BYTERANGE");return T&&A.setByteRange(T,O),O&&(A.fragOffset=O.fragOffset+O.duration),A}return f(l,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var R=this.elementaryStreams;return!!(R.audio||R.video||R.audiovideo)}}]),l}(o)},"./src/loader/key-loader.ts":function(oe,J,k){"use strict";k.r(J),k.d(J,"default",function(){return G});var $=k("./src/events.ts"),F=k("./src/errors.ts"),B=k("./src/utils/logger.ts"),G=function(){function H(I){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=I,this._registerListeners()}var D=H.prototype;return D._registerListeners=function(){this.hls.on($.Events.KEY_LOADING,this.onKeyLoading,this)},D._unregisterListeners=function(){this.hls.off($.Events.KEY_LOADING,this.onKeyLoading)},D.destroy=function(){this._unregisterListeners();for(var g in this.loaders){var p=this.loaders[g];p&&p.destroy()}this.loaders={}},D.onKeyLoading=function(g,p){var f=p.frag,h=f.type,o=this.loaders[h];if(!f.decryptdata){B.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var d=f.decryptdata.uri;if(d!==this.decrypturl||this.decryptkey===null){var s=this.hls.config;if(o&&(B.logger.warn("abort previous key loader for type:"+h),o.abort()),!d){B.logger.warn("key uri is falsy");return}var a=s.loader,l=f.loader=this.loaders[h]=new a(s);this.decrypturl=d,this.decryptkey=null;var c={url:d,frag:f,responseType:"arraybuffer"},R={timeout:s.fragLoadingTimeOut,maxRetry:0,retryDelay:s.fragLoadingRetryDelay,maxRetryDelay:s.fragLoadingMaxRetryTimeout,highWaterMark:0},w={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};l.load(c,R,w)}else this.decryptkey&&(f.decryptdata.key=this.decryptkey,this.hls.trigger($.Events.KEY_LOADED,{frag:f}))},D.loadsuccess=function(g,p,f){var h=f.frag;if(!h.decryptdata){B.logger.error("after key load, decryptdata unset");return}this.decryptkey=h.decryptdata.key=new Uint8Array(g.data),h.loader=null,delete this.loaders[h.type],this.hls.trigger($.Events.KEY_LOADED,{frag:h})},D.loaderror=function(g,p){var f=p.frag,h=f.loader;h&&h.abort(),delete this.loaders[f.type],this.hls.trigger($.Events.ERROR,{type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:f,response:g})},D.loadtimeout=function(g,p){var f=p.frag,h=f.loader;h&&h.abort(),delete this.loaders[f.type],this.hls.trigger($.Events.ERROR,{type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:f})},H}()},"./src/loader/level-details.ts":function(oe,J,k){"use strict";k.r(J),k.d(J,"LevelDetails",function(){return H});var $=k("./src/polyfills/number.ts");function F(D,I){for(var g=0;g<I.length;g++){var p=I[g];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(D,p.key,p)}}function B(D,I,g){return I&&F(D.prototype,I),g&&F(D,g),D}var G=10,H=function(){function D(g){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.needSidxRanges=!1,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.fragments=[],this.url=g}var I=D.prototype;return I.reloaded=function(p){if(!p){this.advanced=!0,this.updated=!0;return}var f=this.lastPartSn-p.lastPartSn,h=this.lastPartIndex-p.lastPartIndex;this.updated=this.endSN!==p.endSN||!!h||!!f,this.advanced=this.endSN>p.endSN||f>0||f===0&&h>0,this.updated||this.advanced?this.misses=Math.floor(p.misses*.6):this.misses=p.misses+1,this.availabilityDelay=p.availabilityDelay},B(D,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object($.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||G}},{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}}]),D}()},"./src/loader/level-key.ts":function(oe,J,k){"use strict";k.r(J),k.d(J,"LevelKey",function(){return H});var $=k("./node_modules/url-toolkit/src/url-toolkit.js"),F=k.n($);function B(D,I){for(var g=0;g<I.length;g++){var p=I[g];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(D,p.key,p)}}function G(D,I,g){return I&&B(D.prototype,I),g&&B(D,g),D}var H=function(){D.fromURL=function(g,p){return new D(g,p)},D.fromURI=function(g){return new D(g)};function D(I,g){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,g?this._uri=Object($.buildAbsoluteURL)(I,g,{alwaysNormalize:!0}):this._uri=I}return G(D,[{key:"uri",get:function(){return this._uri}}]),D}()},"./src/loader/load-stats.ts":function(oe,J,k){"use strict";k.r(J),k.d(J,"LoadStats",function(){return $});var $=function(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}},"./src/loader/m3u8-parser.ts":function(oe,J,k){"use strict";k.r(J),k.d(J,"default",function(){return l});var $=k("./src/polyfills/number.ts"),F=k("./node_modules/url-toolkit/src/url-toolkit.js"),B=k.n(F),G=k("./src/loader/fragment.ts"),H=k("./src/loader/level-details.ts"),D=k("./src/loader/level-key.ts"),I=k("./src/utils/attr-list.ts"),g=k("./src/utils/logger.ts"),p=k("./src/utils/codecs.ts"),f=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,h=/#EXT-X-MEDIA:(.*)/g,o=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),d=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(PLAYLIST-TYPE):(.+)/.source,/#EXT-X-(MEDIA-SEQUENCE): *(\d+)/.source,/#EXT-X-(SKIP):(.+)/.source,/#EXT-X-(TARGETDURATION): *(\d+)/.source,/#EXT-X-(KEY):(.+)/.source,/#EXT-X-(START):(.+)/.source,/#EXT-X-(ENDLIST)/.source,/#EXT-X-(DISCONTINUITY-SEQ)UENCE: *(\d+)/.source,/#EXT-X-(DIS)CONTINUITY/.source,/#EXT-X-(VERSION):(\d+)/.source,/#EXT-X-(MAP):(.+)/.source,/#EXT-X-(SERVER-CONTROL):(.+)/.source,/#EXT-X-(PART-INF):(.+)/.source,/#EXT-X-(GAP)/.source,/#EXT-X-(BITRATE):\s*(\d+)/.source,/#EXT-X-(PART):(.+)/.source,/#EXT-X-(PRELOAD-HINT):(.+)/.source,/#EXT-X-(RENDITION-REPORT):(.+)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),s=/\.(mp4|m4s|m4v|m4a)$/i;function a(O){var A,T;return s.test((A=(T=F.parseURL(O))===null||T===void 0?void 0:T.path)!=null?A:"")}var l=function(){function O(){}return O.findGroup=function(T,E){for(var b=0;b<T.length;b++){var u=T[b];if(u.id===E)return u}},O.convertAVC1ToAVCOTI=function(T){var E=T.split(".");if(E.length>2){var b=E.shift()+".";return b+=parseInt(E.shift()).toString(16),b+=("000"+parseInt(E.shift()).toString(16)).substr(-4),b}return T},O.resolve=function(T,E){return F.buildAbsoluteURL(E,T,{alwaysNormalize:!0})},O.parseMasterPlaylist=function(T,E){var b=[],u={},_=!1;f.lastIndex=0;for(var m;(m=f.exec(T))!=null;)if(m[1]){var v=new I.AttrList(m[1]),M={attrs:v,bitrate:v.decimalInteger("AVERAGE-BANDWIDTH")||v.decimalInteger("BANDWIDTH"),name:v.NAME,url:O.resolve(m[2],E)},P=v.decimalResolution("RESOLUTION");P&&(M.width=P.width,M.height=P.height),c((v.CODECS||"").split(/[ ,]+/).filter(function(V){return V}),M),M.videoCodec&&M.videoCodec.indexOf("avc1")!==-1&&(M.videoCodec=O.convertAVC1ToAVCOTI(M.videoCodec)),b.push(M)}else if(m[3]){var K=new I.AttrList(m[3]);K["DATA-ID"]&&(_=!0,u[K["DATA-ID"]]=K)}return{levels:b,sessionData:_?u:null}},O.parseMasterPlaylistMedia=function(T,E,b,u){u===void 0&&(u=[]);var _,m=[],v=0;for(h.lastIndex=0;(_=h.exec(T))!==null;){var M=new I.AttrList(_[1]);if(M.TYPE===b){var P={attrs:M,bitrate:0,id:v++,groupId:M["GROUP-ID"],instreamId:M["INSTREAM-ID"],name:M.NAME||M.LANGUAGE||"",type:b,default:M.bool("DEFAULT"),autoselect:M.bool("AUTOSELECT"),forced:M.bool("FORCED"),lang:M.LANGUAGE,url:M.URI?O.resolve(M.URI,E):""};if(u.length){var K=O.findGroup(u,P.groupId)||u[0];R(P,K,"audioCodec"),R(P,K,"textCodec")}m.push(P)}}return m},O.parseLevelPlaylist=function(T,E,b,u,_){var m=new H.LevelDetails(E),v=m.fragments,M=null,P=0,K=0,V=0,U=0,S=null,X=new G.Fragment(u,E),ee,ae,de,Ae=-1,Ee=!1;for(o.lastIndex=0,m.m3u8=T;(ee=o.exec(T))!==null;){Ee&&(Ee=!1,X=new G.Fragment(u,E),X.start=V,X.sn=P,X.cc=U,X.level=b,M&&(X.initSegment=M,X.rawProgramDateTime=M.rawProgramDateTime));var we=ee[1];if(we){X.duration=parseFloat(we);var he=(" "+ee[2]).slice(1);X.title=he||null,X.tagList.push(he?["INF",we,he]:["INF",we])}else if(ee[3])Object($.isFiniteNumber)(X.duration)&&(X.start=V,de&&(X.levelkey=de),X.sn=P,X.level=b,X.cc=U,X.urlId=_,v.push(X),X.relurl=(" "+ee[3]).slice(1),x(X,S),S=X,V+=X.duration,P++,K=0,Ee=!0);else if(ee[4]){var ce=(" "+ee[4]).slice(1);S?X.setByteRange(ce,S):X.setByteRange(ce)}else if(ee[5])X.rawProgramDateTime=(" "+ee[5]).slice(1),X.tagList.push(["PROGRAM-DATE-TIME",X.rawProgramDateTime]),Ae===-1&&(Ae=v.length);else{if(ee=ee[0].match(d),!ee){g.logger.warn("No matches on slow regex match for level playlist!");continue}for(ae=1;ae<ee.length&&!(typeof ee[ae]!="undefined");ae++);var se=(" "+ee[ae]).slice(1),re=(" "+ee[ae+1]).slice(1),xe=ee[ae+2]?(" "+ee[ae+2]).slice(1):"";switch(se){case"PLAYLIST-TYPE":m.type=re.toUpperCase();break;case"MEDIA-SEQUENCE":P=m.startSN=parseInt(re);break;case"SKIP":{var be=new I.AttrList(re),ke=be.decimalInteger("SKIPPED-SEGMENTS");if(Object($.isFiniteNumber)(ke)){m.skippedSegments=ke;for(var Oe=ke;Oe--;)v.unshift(null);P+=ke}var Be=be.enumeratedString("RECENTLY-REMOVED-DATERANGES");Be&&(m.recentlyRemovedDateranges=Be.split(" "));break}case"TARGETDURATION":m.targetduration=parseFloat(re);break;case"VERSION":m.version=parseInt(re);break;case"EXTM3U":break;case"ENDLIST":m.live=!1;break;case"#":(re||xe)&&X.tagList.push(xe?[re,xe]:[re]);break;case"DIS":U++;case"GAP":X.tagList.push([se]);break;case"BITRATE":X.tagList.push([se,re]);break;case"DISCONTINUITY-SEQ":U=parseInt(re);break;case"KEY":{var Ce,De=new I.AttrList(re),Ne=De.enumeratedString("METHOD"),Ke=De.URI,Fe=De.hexadecimalInteger("IV"),je=De.enumeratedString("KEYFORMATVERSIONS"),Me=De.enumeratedString("KEYID"),et=(Ce=De.enumeratedString("KEYFORMAT"))!=null?Ce:"identity",Je=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(Je.indexOf(et)>-1){g.logger.warn("Keyformat "+et+" is not supported from the manifest");continue}else if(et!=="identity")continue;Ne&&(de=D.LevelKey.fromURL(E,Ke),Ke&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(Ne)>=0&&(de.method=Ne,de.keyFormat=et,Me&&(de.keyID=Me),je&&(de.keyFormatVersions=je),de.iv=Fe));break}case"START":{var qe=new I.AttrList(re),Ze=qe.decimalFloatingPoint("TIME-OFFSET");Object($.isFiniteNumber)(Ze)&&(m.startTimeOffset=Ze);break}case"MAP":{var dt=new I.AttrList(re);X.relurl=dt.URI,dt.BYTERANGE&&X.setByteRange(dt.BYTERANGE),X.level=b,X.sn="initSegment",de&&(X.levelkey=de),X.initSegment=null,M=X,Ee=!0;break}case"SERVER-CONTROL":{var Xe=new I.AttrList(re);m.canBlockReload=Xe.bool("CAN-BLOCK-RELOAD"),m.canSkipUntil=Xe.optionalFloat("CAN-SKIP-UNTIL",0),m.canSkipDateRanges=m.canSkipUntil>0&&Xe.bool("CAN-SKIP-DATERANGES"),m.partHoldBack=Xe.optionalFloat("PART-HOLD-BACK",0),m.holdBack=Xe.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var Ye=new I.AttrList(re);m.partTarget=Ye.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Ie=m.partList;Ie||(Ie=m.partList=[]);var ot=K>0?Ie[Ie.length-1]:void 0,tt=K++,Re=new G.Part(new I.AttrList(re),X,E,tt,ot);Ie.push(Re),X.duration+=Re.duration;break}case"PRELOAD-HINT":{var We=new I.AttrList(re);m.preloadHint=We;break}case"RENDITION-REPORT":{var _e=new I.AttrList(re);m.renditionReports=m.renditionReports||[],m.renditionReports.push(_e);break}default:g.logger.warn("line parsed but not handled: "+ee);break}}}S&&!S.relurl?(v.pop(),V-=S.duration,m.partList&&(m.fragmentHint=S)):m.partList&&(x(X,S),X.cc=U,m.fragmentHint=X);var me=v.length,ve=v[0],te=v[me-1];if(V+=m.skippedSegments*m.targetduration,V>0&&me&&te){m.averagetargetduration=V/me;var ie=te.sn;m.endSN=ie!=="initSegment"?ie:0,ve&&(m.startCC=ve.cc,ve.initSegment||m.fragments.every(function(le){return le.relurl&&a(le.relurl)})&&(g.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),X=new G.Fragment(u,E),X.relurl=te.relurl,X.level=b,X.sn="initSegment",ve.initSegment=X,m.needSidxRanges=!0))}else m.endSN=0,m.startCC=0;return m.fragmentHint&&(V+=m.fragmentHint.duration),m.totalduration=V,m.endCC=U,Ae>0&&w(v,Ae),m},O}();function c(O,A){["video","audio","text"].forEach(function(T){var E=O.filter(function(u){return Object(p.isCodecType)(u,T)});if(E.length){var b=E.filter(function(u){return u.lastIndexOf("avc1",0)===0||u.lastIndexOf("mp4a",0)===0});A[T+"Codec"]=b.length>0?b[0]:E[0],O=O.filter(function(u){return E.indexOf(u)===-1})}}),A.unknownCodecs=O}function R(O,A,T){var E=A[T];E&&(O[T]=E)}function w(O,A){for(var T=O[A],E=A;E--;){var b=O[E];if(!b)return;b.programDateTime=T.programDateTime-b.duration*1e3,T=b}}function x(O,A){O.rawProgramDateTime?O.programDateTime=Date.parse(O.rawProgramDateTime):A!=null&&A.programDateTime&&(O.programDateTime=A.endProgramDateTime),Object($.isFiniteNumber)(O.programDateTime)||(O.programDateTime=null,O.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(oe,J,k){"use strict";k.r(J);var $=k("./src/polyfills/number.ts"),F=k("./src/events.ts"),B=k("./src/errors.ts"),G=k("./src/utils/logger.ts"),H=k("./src/utils/mp4-tools.ts"),D=k("./src/loader/m3u8-parser.ts"),I=k("./src/types/loader.ts"),g=k("./src/utils/attr-list.ts");function p(o){var d=o.type;switch(d){case I.PlaylistContextType.AUDIO_TRACK:return I.PlaylistLevelType.AUDIO;case I.PlaylistContextType.SUBTITLE_TRACK:return I.PlaylistLevelType.SUBTITLE;default:return I.PlaylistLevelType.MAIN}}function f(o,d){var s=o.url;return(s===void 0||s.indexOf("data:")===0)&&(s=d.url),s}var h=function(){function o(s){this.hls=void 0,this.loaders=Object.create(null),this.hls=s,this.registerListeners()}var d=o.prototype;return d.registerListeners=function(){var a=this.hls;a.on(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.on(F.Events.LEVEL_LOADING,this.onLevelLoading,this),a.on(F.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),a.on(F.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},d.unregisterListeners=function(){var a=this.hls;a.off(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.off(F.Events.LEVEL_LOADING,this.onLevelLoading,this),a.off(F.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),a.off(F.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},d.createInternalLoader=function(a){var l=this.hls.config,c=l.pLoader,R=l.loader,w=c||R,x=new w(l);return a.loader=x,this.loaders[a.type]=x,x},d.getInternalLoader=function(a){return this.loaders[a.type]},d.resetInternalLoader=function(a){this.loaders[a]&&delete this.loaders[a]},d.destroyInternalLoaders=function(){for(var a in this.loaders){var l=this.loaders[a];l&&l.destroy(),this.resetInternalLoader(a)}},d.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},d.onManifestLoading=function(a,l){var c=l.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:I.PlaylistContextType.MANIFEST,url:c,deliveryDirectives:null})},d.onLevelLoading=function(a,l){var c=l.id,R=l.level,w=l.url,x=l.deliveryDirectives;this.load({id:c,groupId:null,level:R,responseType:"text",type:I.PlaylistContextType.LEVEL,url:w,deliveryDirectives:x})},d.onAudioTrackLoading=function(a,l){var c=l.id,R=l.groupId,w=l.url,x=l.deliveryDirectives;this.load({id:c,groupId:R,level:null,responseType:"text",type:I.PlaylistContextType.AUDIO_TRACK,url:w,deliveryDirectives:x})},d.onSubtitleTrackLoading=function(a,l){var c=l.id,R=l.groupId,w=l.url,x=l.deliveryDirectives;this.load({id:c,groupId:R,level:null,responseType:"text",type:I.PlaylistContextType.SUBTITLE_TRACK,url:w,deliveryDirectives:x})},d.load=function(a){var l,c=this.hls.config,R=this.getInternalLoader(a);if(R){var w=R.context;if(w&&w.url===a.url){G.logger.trace("[playlist-loader]: playlist request ongoing");return}G.logger.log("[playlist-loader]: aborting previous loader for type: "+a.type),R.abort()}var x,O,A,T;switch(a.type){case I.PlaylistContextType.MANIFEST:x=c.manifestLoadingMaxRetry,O=c.manifestLoadingTimeOut,A=c.manifestLoadingRetryDelay,T=c.manifestLoadingMaxRetryTimeout;break;case I.PlaylistContextType.LEVEL:case I.PlaylistContextType.AUDIO_TRACK:case I.PlaylistContextType.SUBTITLE_TRACK:x=0,O=c.levelLoadingTimeOut;break;default:x=c.levelLoadingMaxRetry,O=c.levelLoadingTimeOut,A=c.levelLoadingRetryDelay,T=c.levelLoadingMaxRetryTimeout;break}if(R=this.createInternalLoader(a),(l=a.deliveryDirectives)!==null&&l!==void 0&&l.part){var E;if(a.type===I.PlaylistContextType.LEVEL&&a.level!==null?E=this.hls.levels[a.level].details:a.type===I.PlaylistContextType.AUDIO_TRACK&&a.id!==null?E=this.hls.audioTracks[a.id].details:a.type===I.PlaylistContextType.SUBTITLE_TRACK&&a.id!==null&&(E=this.hls.subtitleTracks[a.id].details),E){var b=E.partTarget,u=E.targetduration;b&&u&&(O=Math.min(Math.max(b*3,u*.8)*1e3,O))}}var _={timeout:O,maxRetry:x,retryDelay:A,maxRetryDelay:T,highWaterMark:0},m={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};R.load(a,_,m)},d.loadsuccess=function(a,l,c,R){if(R===void 0&&(R=null),c.isSidxRequest){this.handleSidxRequest(a,c),this.handlePlaylistLoaded(a,l,c,R);return}this.resetInternalLoader(c.type);var w=a.data;if(w.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(a,c,"no EXTM3U delimiter",R);return}l.parsing.start=performance.now(),w.indexOf("#EXTINF:")>0||w.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(a,l,c,R):this.handleMasterPlaylist(a,l,c,R)},d.loaderror=function(a,l,c){c===void 0&&(c=null),this.handleNetworkError(l,c,!1,a)},d.loadtimeout=function(a,l,c){c===void 0&&(c=null),this.handleNetworkError(l,c,!0)},d.handleMasterPlaylist=function(a,l,c,R){var w=this.hls,x=a.data,O=f(a,c),A=D.default.parseMasterPlaylist(x,O),T=A.levels,E=A.sessionData;if(!T.length){this.handleManifestParsingError(a,c,"no level found in manifest",R);return}var b=T.map(function(P){return{id:P.attrs.AUDIO,audioCodec:P.audioCodec}}),u=T.map(function(P){return{id:P.attrs.SUBTITLES,textCodec:P.textCodec}}),_=D.default.parseMasterPlaylistMedia(x,O,"AUDIO",b),m=D.default.parseMasterPlaylistMedia(x,O,"SUBTITLES",u),v=D.default.parseMasterPlaylistMedia(x,O,"CLOSED-CAPTIONS");if(_.length){var M=_.some(function(P){return!P.url});!M&&T[0].audioCodec&&!T[0].attrs.AUDIO&&(G.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),_.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new g.AttrList({}),bitrate:0,url:""}))}w.trigger(F.Events.MANIFEST_LOADED,{levels:T,audioTracks:_,subtitles:m,captions:v,url:O,stats:l,networkDetails:R,sessionData:E})},d.handleTrackOrLevelPlaylist=function(a,l,c,R){var w=this.hls,x=c.id,O=c.level,A=c.type,T=f(a,c),E=Object($.isFiniteNumber)(x)?x:0,b=Object($.isFiniteNumber)(O)?O:E,u=p(c),_=D.default.parseLevelPlaylist(a.data,T,b,u,E);if(!_.fragments.length){w.trigger(F.Events.ERROR,{type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:T,reason:"no fragments found in level",level:typeof c.level=="number"?c.level:void 0});return}if(A===I.PlaylistContextType.MANIFEST){var m={attrs:new g.AttrList({}),bitrate:0,details:_,name:"",url:T};w.trigger(F.Events.MANIFEST_LOADED,{levels:[m],audioTracks:[],url:T,stats:l,networkDetails:R,sessionData:null})}if(l.parsing.end=performance.now(),_.needSidxRanges){var v,M=(v=_.fragments[0].initSegment)===null||v===void 0?void 0:v.url;this.load({url:M,isSidxRequest:!0,type:A,level:O,levelDetails:_,id:x,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}c.levelDetails=_,this.handlePlaylistLoaded(a,l,c,R)},d.handleSidxRequest=function(a,l){var c=Object(H.parseSegmentIndex)(new Uint8Array(a.data));if(!c)return;var R=c.references,w=l.levelDetails;R.forEach(function(x,O){var A=x.info,T=w.fragments[O];T.byteRange.length===0&&T.setByteRange(String(1+A.end-A.start)+"@"+String(A.start)),T.initSegment&&T.initSegment.setByteRange(String(c.moovEndOffset)+"@0")})},d.handleManifestParsingError=function(a,l,c,R){this.hls.trigger(F.Events.ERROR,{type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:l.type===I.PlaylistContextType.MANIFEST,url:a.url,reason:c,response:a,context:l,networkDetails:R})},d.handleNetworkError=function(a,l,c,R){c===void 0&&(c=!1),G.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=B.ErrorDetails.UNKNOWN,x=!1,O=this.getInternalLoader(a);switch(a.type){case I.PlaylistContextType.MANIFEST:w=c?B.ErrorDetails.MANIFEST_LOAD_TIMEOUT:B.ErrorDetails.MANIFEST_LOAD_ERROR,x=!0;break;case I.PlaylistContextType.LEVEL:w=c?B.ErrorDetails.LEVEL_LOAD_TIMEOUT:B.ErrorDetails.LEVEL_LOAD_ERROR,x=!1;break;case I.PlaylistContextType.AUDIO_TRACK:w=c?B.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:B.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,x=!1;break;case I.PlaylistContextType.SUBTITLE_TRACK:w=c?B.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:B.ErrorDetails.SUBTITLE_LOAD_ERROR,x=!1;break}O&&this.resetInternalLoader(a.type);var A={type:B.ErrorTypes.NETWORK_ERROR,details:w,fatal:x,url:a.url,loader:O,context:a,networkDetails:l};R&&(A.response=R),this.hls.trigger(F.Events.ERROR,A)},d.handlePlaylistLoaded=function(a,l,c,R){var w=c.type,x=c.level,O=c.id,A=c.groupId,T=c.loader,E=c.levelDetails,b=c.deliveryDirectives;if(!(E!=null&&E.targetduration)){this.handleManifestParsingError(a,c,"invalid target duration",R);return}if(!T)return;E.live&&(T.getCacheAge&&(E.ageHeader=T.getCacheAge()||0),(!T.getCacheAge||isNaN(E.ageHeader))&&(E.ageHeader=0));switch(w){case I.PlaylistContextType.MANIFEST:case I.PlaylistContextType.LEVEL:this.hls.trigger(F.Events.LEVEL_LOADED,{details:E,level:x||0,id:O||0,stats:l,networkDetails:R,deliveryDirectives:b});break;case I.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(F.Events.AUDIO_TRACK_LOADED,{details:E,id:O||0,groupId:A||"",stats:l,networkDetails:R,deliveryDirectives:b});break;case I.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(F.Events.SUBTITLE_TRACK_LOADED,{details:E,id:O||0,groupId:A||"",stats:l,networkDetails:R,deliveryDirectives:b});break}},o}();J.default=h},"./src/polyfills/number.ts":function(oe,J,k){"use strict";k.r(J),k.d(J,"isFiniteNumber",function(){return $}),k.d(J,"MAX_SAFE_INTEGER",function(){return F});var $=Number.isFinite||function(B){return typeof B=="number"&&isFinite(B)},F=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(oe,J,k){"use strict";k.r(J);var $=function(){function F(){}return F.getSilentFrame=function(G,H){switch(G){case"mp4a.40.2":if(H===1)return new Uint8Array([0,200,0,128,35,128]);if(H===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(H===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(H===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(H===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(H===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(H===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(H===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(H===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},F}();J.default=$},"./src/remux/mp4-generator.ts":function(oe,J,k){"use strict";k.r(J);var $=Math.pow(2,32)-1,F=function(){function B(){}return B.init=function(){B.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 H;for(H in B.types)B.types.hasOwnProperty(H)&&(B.types[H]=[H.charCodeAt(0),H.charCodeAt(1),H.charCodeAt(2),H.charCodeAt(3)]);var D=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]),I=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]);B.HDLR_TYPES={video:D,audio:I};var g=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]);B.STTS=B.STSC=B.STCO=p,B.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),B.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),B.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),B.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]),o=new Uint8Array([0,0,0,1]);B.FTYP=B.box(B.types.ftyp,f,o,f,h),B.DINF=B.box(B.types.dinf,B.box(B.types.dref,g))},B.box=function(H){for(var D=8,I=arguments.length,g=new Array(I>1?I-1:0),p=1;p<I;p++)g[p-1]=arguments[p];for(var f=g.length,h=f;f--;)D+=g[f].byteLength;var o=new Uint8Array(D);for(o[0]=D>>24&255,o[1]=D>>16&255,o[2]=D>>8&255,o[3]=D&255,o.set(H,4),f=0,D=8;f<h;f++)o.set(g[f],D),D+=g[f].byteLength;return o},B.hdlr=function(H){return B.box(B.types.hdlr,B.HDLR_TYPES[H])},B.mdat=function(H){return B.box(B.types.mdat,H)},B.mdhd=function(H,D){D*=H;var I=Math.floor(D/($+1)),g=Math.floor(D%($+1));return B.box(B.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,H>>24&255,H>>16&255,H>>8&255,H&255,I>>24,I>>16&255,I>>8&255,I&255,g>>24,g>>16&255,g>>8&255,g&255,85,196,0,0]))},B.mdia=function(H){return B.box(B.types.mdia,B.mdhd(H.timescale,H.duration),B.hdlr(H.type),B.minf(H))},B.mfhd=function(H){return B.box(B.types.mfhd,new Uint8Array([0,0,0,0,H>>24,H>>16&255,H>>8&255,H&255]))},B.minf=function(H){return H.type==="audio"?B.box(B.types.minf,B.box(B.types.smhd,B.SMHD),B.DINF,B.stbl(H)):B.box(B.types.minf,B.box(B.types.vmhd,B.VMHD),B.DINF,B.stbl(H))},B.moof=function(H,D,I){return B.box(B.types.moof,B.mfhd(H),B.traf(I,D))},B.moov=function(H){for(var D=H.length,I=[];D--;)I[D]=B.trak(H[D]);return B.box.apply(null,[B.types.moov,B.mvhd(H[0].timescale,H[0].duration)].concat(I).concat(B.mvex(H)))},B.mvex=function(H){for(var D=H.length,I=[];D--;)I[D]=B.trex(H[D]);return B.box.apply(null,[B.types.mvex].concat(I))},B.mvhd=function(H,D){D*=H;var I=Math.floor(D/($+1)),g=Math.floor(D%($+1)),p=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,H>>24&255,H>>16&255,H>>8&255,H&255,I>>24,I>>16&255,I>>8&255,I&255,g>>24,g>>16&255,g>>8&255,g&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 B.box(B.types.mvhd,p)},B.sdtp=function(H){var D=H.samples||[],I=new Uint8Array(4+D.length),g,p;for(g=0;g<D.length;g++)p=D[g].flags,I[g+4]=p.dependsOn<<4|p.isDependedOn<<2|p.hasRedundancy;return B.box(B.types.sdtp,I)},B.stbl=function(H){return B.box(B.types.stbl,B.stsd(H),B.box(B.types.stts,B.STTS),B.box(B.types.stsc,B.STSC),B.box(B.types.stsz,B.STSZ),B.box(B.types.stco,B.STCO))},B.avc1=function(H){var D=[],I=[],g,p,f;for(g=0;g<H.sps.length;g++)p=H.sps[g],f=p.byteLength,D.push(f>>>8&255),D.push(f&255),D=D.concat(Array.prototype.slice.call(p));for(g=0;g<H.pps.length;g++)p=H.pps[g],f=p.byteLength,I.push(f>>>8&255),I.push(f&255),I=I.concat(Array.prototype.slice.call(p));var h=B.box(B.types.avcC,new Uint8Array([1,D[3],D[4],D[5],252|3,224|H.sps.length].concat(D).concat([H.pps.length]).concat(I))),o=H.width,d=H.height,s=H.pixelRatio[0],a=H.pixelRatio[1];return B.box(B.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,o>>8&255,o&255,d>>8&255,d&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,B.box(B.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),B.box(B.types.pasp,new Uint8Array([s>>24,s>>16&255,s>>8&255,s&255,a>>24,a>>16&255,a>>8&255,a&255])))},B.esds=function(H){var D=H.config.length;return new Uint8Array([0,0,0,0,3,23+D,0,1,0,4,15+D,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([D]).concat(H.config).concat([6,1,2]))},B.mp4a=function(H){var D=H.samplerate;return B.box(B.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,H.channelCount,0,16,0,0,0,0,D>>8&255,D&255,0,0]),B.box(B.types.esds,B.esds(H)))},B.mp3=function(H){var D=H.samplerate;return B.box(B.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,H.channelCount,0,16,0,0,0,0,D>>8&255,D&255,0,0]))},B.stsd=function(H){return H.type==="audio"?!H.isAAC&&H.codec==="mp3"?B.box(B.types.stsd,B.STSD,B.mp3(H)):B.box(B.types.stsd,B.STSD,B.mp4a(H)):B.box(B.types.stsd,B.STSD,B.avc1(H))},B.tkhd=function(H){var D=H.id,I=H.duration*H.timescale,g=H.width,p=H.height,f=Math.floor(I/($+1)),h=Math.floor(I%($+1));return B.box(B.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,D>>24&255,D>>16&255,D>>8&255,D&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,g>>8&255,g&255,0,0,p>>8&255,p&255,0,0]))},B.traf=function(H,D){var I=B.sdtp(H),g=H.id,p=Math.floor(D/($+1)),f=Math.floor(D%($+1));return B.box(B.types.traf,B.box(B.types.tfhd,new Uint8Array([0,0,0,0,g>>24,g>>16&255,g>>8&255,g&255])),B.box(B.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])),B.trun(H,I.length+16+20+8+16+8+8),I)},B.trak=function(H){return H.duration=H.duration||4294967295,B.box(B.types.trak,B.tkhd(H),B.mdia(H))},B.trex=function(H){var D=H.id;return B.box(B.types.trex,new Uint8Array([0,0,0,0,D>>24,D>>16&255,D>>8&255,D&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},B.trun=function(H,D){var I=H.samples||[],g=I.length,p=12+16*g,f=new Uint8Array(p),h,o,d,s,a,l;for(D+=8+p,f.set([0,0,15,1,g>>>24&255,g>>>16&255,g>>>8&255,g&255,D>>>24&255,D>>>16&255,D>>>8&255,D&255],0),h=0;h<g;h++)o=I[h],d=o.duration,s=o.size,a=o.flags,l=o.cts,f.set([d>>>24&255,d>>>16&255,d>>>8&255,d&255,s>>>24&255,s>>>16&255,s>>>8&255,s&255,a.isLeading<<2|a.dependsOn,a.isDependedOn<<6|a.hasRedundancy<<4|a.paddingValue<<1|a.isNonSync,a.degradPrio&240<<8,a.degradPrio&15,l>>>24&255,l>>>16&255,l>>>8&255,l&255],12+16*h);return B.box(B.types.trun,f)},B.initSegment=function(H){B.types||B.init();var D=B.moov(H),I=new Uint8Array(B.FTYP.byteLength+D.byteLength);return I.set(B.FTYP),I.set(D,B.FTYP.byteLength),I},B}();F.types=void 0,F.HDLR_TYPES=void 0,F.STTS=void 0,F.STSC=void 0,F.STCO=void 0,F.STSZ=void 0,F.VMHD=void 0,F.SMHD=void 0,F.STSD=void 0,F.FTYP=void 0,F.DINF=void 0,J.default=F},"./src/remux/mp4-remuxer.ts":function(oe,J,k){"use strict";k.r(J),k.d(J,"default",function(){return l}),k.d(J,"normalizePts",function(){return c});var $=k("./src/polyfills/number.ts"),F=k("./src/remux/aac-helper.ts"),B=k("./src/remux/mp4-generator.ts"),G=k("./src/events.ts"),H=k("./src/errors.ts"),D=k("./src/utils/logger.ts"),I=k("./src/types/loader.ts"),g=k("./src/utils/timescale-conversion.ts");function p(){return p=Object.assign||function(O){for(var A=1;A<arguments.length;A++){var T=arguments[A];for(var E in T)Object.prototype.hasOwnProperty.call(T,E)&&(O[E]=T[E])}return O},p.apply(this,arguments)}var f=10*1e3,h=1024,o=1152,d=null,s=null,a=!1,l=function(){function O(T,E,b,u){if(u===void 0&&(u=""),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=void 0,this._initDTS=void 0,this.nextAvcDts=null,this.nextAudioPts=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=T,this.config=E,this.typeSupported=b,this.ISGenerated=!1,d===null){var _=navigator.userAgent||"",m=_.match(/Chrome\/(\d+)/i);d=m?parseInt(m[1]):0}if(s===null){var v=navigator.userAgent.match(/Safari\/(\d+)/i);s=v?parseInt(v[1]):0}a=!!d&&d<75||!!s&&s<600}var A=O.prototype;return A.destroy=function(){},A.resetTimeStamp=function(E){D.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=E},A.resetNextTimestamp=function(){D.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},A.resetInitSegment=function(){D.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},A.getVideoStartPts=function(E){var b=!1,u=E.reduce(function(_,m){var v=m.pts-_;return v<-4294967296?(b=!0,c(_,m.pts)):v>0?_:m.pts},E[0].pts);return b&&D.logger.debug("PTS rollover detected"),u},A.remux=function(E,b,u,_,m,v,M,P){var K,V,U,S,X,ee,ae=m,de=m,Ae=E.pid>-1,Ee=b.pid>-1,we=b.samples.length,he=E.samples.length>0,ce=we>1,se=(!Ae||he)&&(!Ee||ce)||this.ISGenerated||M;if(se){this.ISGenerated||(U=this.generateIS(E,b,m));var re=this.isVideoContiguous,xe=-1;if(ce&&(xe=R(b.samples),!re&&this.config.forceKeyFrameOnDiscontinuity))if(ee=!0,xe>0){D.logger.warn("[mp4-remuxer]: Dropped "+xe+" out of "+we+" video samples due to a missing keyframe");var be=this.getVideoStartPts(b.samples);b.samples=b.samples.slice(xe),b.dropped+=xe,de+=(b.samples[0].pts-be)/(b.timescale||9e4)}else xe===-1&&(D.logger.warn("[mp4-remuxer]: No keyframe found out of "+we+" video samples"),ee=!1);if(this.ISGenerated){if(he&&ce){var ke=this.getVideoStartPts(b.samples),Oe=c(E.samples[0].pts,ke)-ke,Be=Oe/b.inputTimeScale;ae+=Math.max(0,Be),de+=Math.max(0,-Be)}if(he){if(E.samplerate||(D.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),U=this.generateIS(E,b,m)),V=this.remuxAudio(E,ae,this.isAudioContiguous,v,Ee||ce||P===I.PlaylistLevelType.AUDIO?de:void 0),ce){var Ce=V?V.endPTS-V.startPTS:0;b.inputTimeScale||(D.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),U=this.generateIS(E,b,m)),K=this.remuxVideo(b,de,re,Ce)}}else ce&&(K=this.remuxVideo(b,de,re,0));K&&(K.firstKeyFrame=xe,K.independent=xe!==-1)}}return this.ISGenerated&&(u.samples.length&&(X=this.remuxID3(u,m)),_.samples.length&&(S=this.remuxText(_,m))),{audio:V,video:K,initSegment:U,independent:ee,text:S,id3:X}},A.generateIS=function(E,b,u){var _=E.samples,m=b.samples,v=this.typeSupported,M={},P=!Object($.isFiniteNumber)(this._initPTS),K="audio/mp4",V,U,S;if(P&&(V=U=Infinity),E.config&&_.length&&(E.timescale=E.samplerate,E.isAAC||(v.mpeg?(K="audio/mpeg",E.codec=""):v.mp3&&(E.codec="mp3")),M.audio={id:"audio",container:K,codec:E.codec,initSegment:!E.isAAC&&v.mpeg?new Uint8Array(0):B.default.initSegment([E]),metadata:{channelCount:E.channelCount}},P&&(S=E.inputTimeScale,V=U=_[0].pts-Math.round(S*u))),b.sps&&b.pps&&m.length&&(b.timescale=b.inputTimeScale,M.video={id:"main",container:"video/mp4",codec:b.codec,initSegment:B.default.initSegment([b]),metadata:{width:b.width,height:b.height}},P)){S=b.inputTimeScale;var X=this.getVideoStartPts(m),ee=Math.round(S*u);U=Math.min(U,c(m[0].dts,X)-ee),V=Math.min(V,X-ee)}if(Object.keys(M).length)return this.ISGenerated=!0,P&&(this._initPTS=V,this._initDTS=U),{tracks:M,initPTS:V,timescale:S}},A.remuxVideo=function(E,b,u,_){var m=E.inputTimeScale,v=E.samples,M=[],P=v.length,K=this._initPTS,V=this.nextAvcDts,U=8,S,X,ee,ae=Number.POSITIVE_INFINITY,de=Number.NEGATIVE_INFINITY,Ae=0,Ee=!1;if(!u||V===null){var we=b*m,he=v[0].pts-c(v[0].dts,v[0].pts);V=we-he}for(var ce=0;ce<P;ce++){var se=v[ce];if(se.pts=c(se.pts-K,V),se.dts=c(se.dts-K,V),se.dts>se.pts){var re=9e4*.2;Ae=Math.max(Math.min(Ae,se.pts-se.dts),-1*re)}se.dts<v[ce>0?ce-1:ce].dts&&(Ee=!0)}Ee&&v.sort(function(Ct,xt){var ut=Ct.dts-xt.dts,Bt=Ct.pts-xt.pts;return ut||Bt}),X=v[0].dts,ee=v[v.length-1].dts;var xe=Math.round((ee-X)/(P-1));if(Ae<0){if(Ae<xe*-2){D.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(g.toMsFromMpegTsClock)(-xe,!0)+" ms");for(var be=Ae,ke=0;ke<P;ke++)v[ke].dts=be=Math.max(be,v[ke].pts-xe),v[ke].pts=Math.max(be,v[ke].pts)}else{D.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(g.toMsFromMpegTsClock)(Ae,!0)+" ms to overcome this issue");for(var Oe=0;Oe<P;Oe++)v[Oe].dts=v[Oe].dts+Ae}X=v[0].dts}if(u){var Be=X-V,Ce=Be>xe,De=Be<-1;if(Ce||De){Ce?D.logger.warn("AVC: "+Object(g.toMsFromMpegTsClock)(Be,!0)+" ms ("+Be+"dts) hole between fragments detected, filling it"):D.logger.warn("AVC: "+Object(g.toMsFromMpegTsClock)(-Be,!0)+" ms ("+Be+"dts) overlapping between fragments detected"),X=V;var Ne=v[0].pts-Be;v[0].dts=X,v[0].pts=Ne,D.logger.log("Video: First PTS/DTS adjusted: "+Object(g.toMsFromMpegTsClock)(Ne,!0)+"/"+Object(g.toMsFromMpegTsClock)(X,!0)+", delta: "+Object(g.toMsFromMpegTsClock)(Be,!0)+" ms")}}a&&(X=Math.max(0,X));for(var Ke=0,Fe=0,je=0;je<P;je++){for(var Me=v[je],et=Me.units,Je=et.length,qe=0,Ze=0;Ze<Je;Ze++)qe+=et[Ze].data.length;Fe+=qe,Ke+=Je,Me.length=qe,Me.dts=Math.max(Me.dts,X),Me.pts=Math.max(Me.pts,Me.dts,0),ae=Math.min(Me.pts,ae),de=Math.max(Me.pts,de)}ee=v[P-1].dts;var dt=Fe+4*Ke+8,Xe;try{Xe=new Uint8Array(dt)}catch(Ct){this.observer.emit(G.Events.ERROR,G.Events.ERROR,{type:H.ErrorTypes.MUX_ERROR,details:H.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:dt,reason:"fail allocating video mdat "+dt});return}var Ye=new DataView(Xe.buffer);Ye.setUint32(0,dt),Xe.set(B.default.types.mdat,4);for(var Ie=0;Ie<P;Ie++){for(var ot=v[Ie],tt=ot.units,Re=0,We=0,_e=tt.length;We<_e;We++){var me=tt[We],ve=me.data,te=me.data.byteLength;Ye.setUint32(U,te),U+=4,Xe.set(ve,U),U+=te,Re+=4+te}if(Ie<P-1)S=v[Ie+1].dts-ot.dts;else{var ie=this.config,le=ot.dts-v[Ie>0?Ie-1:Ie].dts;if(ie.stretchShortVideoTrack&&this.nextAudioPts!==null){var pe=Math.floor(ie.maxBufferHole*m),ye=(_?ae+_*m:this.nextAudioPts)-ot.pts;ye>pe?(S=ye-le,S<0&&(S=le),D.logger.log("[mp4-remuxer]: It is approximately "+ye/90+" ms to the next segment; using duration "+S/90+" ms for the last video frame.")):S=le}else S=le}var Le=Math.round(ot.pts-ot.dts);M.push(new w(ot.key,S,Re,Le))}if(M.length&&d&&d<70){var He=M[0].flags;He.dependsOn=2,He.isNonSync=0}console.assert(S!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=V=ee+S,this.isVideoContiguous=!0;var st=B.default.moof(E.sequenceNumber++,X,p({},E,{samples:M})),ct="video",ft={data1:st,data2:Xe,startPTS:ae/m,endPTS:(de+S)/m,startDTS:X/m,endDTS:V/m,type:ct,hasAudio:!1,hasVideo:!0,nb:M.length,dropped:E.dropped};return E.samples=[],E.dropped=0,console.assert(Xe.length,"MDAT length must not be zero"),ft},A.remuxAudio=function(E,b,u,_,m){var v=E.inputTimeScale,M=E.samplerate?E.samplerate:v,P=v/M,K=E.isAAC?h:o,V=K*P,U=this._initPTS,S=!E.isAAC&&this.typeSupported.mpeg,X=[],ee=E.samples,ae=S?0:8,de=this.nextAudioPts||-1,Ae=b*v;if(this.isAudioContiguous=u=u||ee.length&&de>0&&(_&&Math.abs(Ae-de)<9e3||Math.abs(c(ee[0].pts-U,Ae)-de)<20*V),ee.forEach(function(ve){ve.pts=c(ve.pts-U,Ae)}),!u||de<0){if(ee=ee.filter(function(ve){return ve.pts>=0}),!ee.length)return;m===0?de=0:_?de=Math.max(0,Ae):de=ee[0].pts}if(E.isAAC)for(var Ee=m!==void 0,we=this.config.maxAudioFramesDrift,he=0,ce=de;he<ee.length;he++){var se=ee[he],re=se.pts,xe=re-ce,be=Math.abs(1e3*xe/v);if(xe<=-we*V&&Ee)he===0&&(D.logger.warn("Audio frame @ "+(re/v).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*xe/v)+" ms."),this.nextAudioPts=de=ce=re);else if(xe>=we*V&&be<f&&Ee){var ke=Math.round(xe/V);ce=re-ke*V,ce<0&&(ke--,ce+=V),he===0&&(this.nextAudioPts=de=ce),D.logger.warn("[mp4-remuxer]: Injecting "+ke+" audio frame @ "+(ce/v).toFixed(3)+"s due to "+Math.round(1e3*xe/v)+" ms gap.");for(var Oe=0;Oe<ke;Oe++){var Be=Math.max(ce,0),Ce=F.default.getSilentFrame(E.manifestCodec||E.codec,E.channelCount);Ce||(D.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),Ce=se.unit.subarray()),ee.splice(he,0,{unit:Ce,pts:Be}),ce+=V,he++}}se.pts=ce,ce+=V}for(var De=null,Ne=null,Ke,Fe=0,je=ee.length;je--;)Fe+=ee[je].unit.byteLength;for(var Me=0,et=ee.length;Me<et;Me++){var Je=ee[Me],qe=Je.unit,Ze=Je.pts;if(Ne!==null){var dt=X[Me-1];dt.duration=Math.round((Ze-Ne)/P)}else if(u&&E.isAAC&&(Ze=de),De=Ze,Fe>0){Fe+=ae;try{Ke=new Uint8Array(Fe)}catch(ve){this.observer.emit(G.Events.ERROR,G.Events.ERROR,{type:H.ErrorTypes.MUX_ERROR,details:H.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Fe,reason:"fail allocating audio mdat "+Fe});return}if(!S){var Xe=new DataView(Ke.buffer);Xe.setUint32(0,Fe),Ke.set(B.default.types.mdat,4)}}else return;Ke.set(qe,ae);var Ye=qe.byteLength;ae+=Ye,X.push(new w(!0,K,Ye,0)),Ne=Ze}var Ie=X.length;if(!Ie)return;var ot=X[X.length-1];this.nextAudioPts=de=Ne+P*ot.duration;var tt=S?new Uint8Array(0):B.default.moof(E.sequenceNumber++,De/P,p({},E,{samples:X}));E.samples=[];var Re=De/v,We=de/v,_e="audio",me={data1:tt,data2:Ke,startPTS:Re,endPTS:We,startDTS:Re,endDTS:We,type:_e,hasAudio:!0,hasVideo:!1,nb:Ie};return this.isAudioContiguous=!0,console.assert(Ke.length,"MDAT length must not be zero"),me},A.remuxEmptyAudio=function(E,b,u,_){var m=E.inputTimeScale,v=E.samplerate?E.samplerate:m,M=m/v,P=this.nextAudioPts,K=(P!==null?P:_.startDTS*m)+this._initDTS,V=_.endDTS*m+this._initDTS,U=M*h,S=Math.ceil((V-K)/U),X=F.default.getSilentFrame(E.manifestCodec||E.codec,E.channelCount);if(D.logger.warn("[mp4-remuxer]: remux empty Audio"),!X){D.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var ee=[],ae=0;ae<S;ae++){var de=K+ae*U;ee.push({unit:X,pts:de,dts:de})}return E.samples=ee,this.remuxAudio(E,b,u,!1)},A.remuxID3=function(E,b){var u=E.samples.length;if(!u)return;for(var _=E.inputTimeScale,m=this._initPTS,v=this._initDTS,M=0;M<u;M++){var P=E.samples[M];P.pts=c(P.pts-m,b*_)/_,P.dts=c(P.dts-v,b*_)/_}var K=E.samples;return E.samples=[],{samples:K}},A.remuxText=function(E,b){var u=E.samples.length;if(!u)return;for(var _=E.inputTimeScale,m=this._initPTS,v=0;v<u;v++){var M=E.samples[v];M.pts=c(M.pts-m,b*_)/_}E.samples.sort(function(K,V){return K.pts-V.pts});var P=E.samples;return E.samples=[],{samples:P}},O}();function c(O,A){var T;if(A===null)return O;for(A<O?T=-8589934592:T=8589934592;Math.abs(O-A)>4294967296;)O+=T;return O}function R(O){for(var A=0;A<O.length;A++)if(O[A].key)return A;return-1}var w=function(A,T,E,b){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=T,this.size=E,this.cts=b,this.flags=new x(A)},x=function(A){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=A?2:1,this.isNonSync=A?0:1}},"./src/remux/passthrough-remuxer.ts":function(oe,J,k){"use strict";k.r(J);var $=k("./src/polyfills/number.ts"),F=k("./src/utils/mp4-tools.ts"),B=k("./src/loader/fragment.ts"),G=k("./src/utils/logger.ts"),H=function(){function g(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=void 0,this.initTracks=void 0,this.lastEndDTS=null}var p=g.prototype;return p.destroy=function(){},p.resetTimeStamp=function(h){this.initPTS=h,this.lastEndDTS=null},p.resetNextTimestamp=function(){this.lastEndDTS=null},p.resetInitSegment=function(h,o,d){this.audioCodec=o,this.videoCodec=d,this.generateInitSegment(h),this.emitInitSegment=!0},p.generateInitSegment=function(h){var o=this.audioCodec,d=this.videoCodec;if(!h||!h.byteLength){this.initTracks=void 0,this.initData=void 0;return}var s=this.initData=Object(F.parseInitSegment)(h);o||(o=I(s.audio,B.ElementaryStreamTypes.AUDIO)),d||(d=I(s.video,B.ElementaryStreamTypes.VIDEO));var a={};s.audio&&s.video?a.audiovideo={container:"video/mp4",codec:o+","+d,initSegment:h,id:"main"}:s.audio?a.audio={container:"audio/mp4",codec:o,initSegment:h,id:"audio"}:s.video?a.video={container:"video/mp4",codec:d,initSegment:h,id:"main"}:G.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=a},p.remux=function(h,o,d,s,a){var l=this.initPTS,c=this.lastEndDTS,R={audio:void 0,video:void 0,text:s,id3:d,initSegment:void 0};Object($.isFiniteNumber)(c)||(c=this.lastEndDTS=a||0);var w=o.samples;if(!w||!w.length)return R;var x={initPTS:void 0,timescale:1},O=this.initData;if((!O||!O.length)&&(this.generateInitSegment(w),O=this.initData),!O||!O.length)return G.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),R;this.emitInitSegment&&(x.tracks=this.initTracks,this.emitInitSegment=!1),Object($.isFiniteNumber)(l)||(this.initPTS=x.initPTS=l=D(O,w,c));var A=Object(F.getDuration)(w,O),T=c,E=A+T;Object(F.offsetStartDTS)(O,w,l),A>0?this.lastEndDTS=E:(G.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var b=!!O.audio,u=!!O.video,_="";b&&(_+="audio"),u&&(_+="video");var m={data1:w,startPTS:T,startDTS:T,endPTS:E,endDTS:E,type:_,hasAudio:b,hasVideo:u,nb:1,dropped:0};return R.audio=m.type==="audio"?m:void 0,R.video=m.type!=="audio"?m:void 0,R.text=s,R.id3=d,R.initSegment=x,R},g}(),D=function(p,f,h){return Object(F.getStartDTS)(p,f)-h};function I(g,p){var f=g==null?void 0:g.codec;return f&&f.length>4?f:f==="hvc1"?"hvc1.1.c.L120.90":f==="av01"?"av01.0.04M.08":f==="avc1"||p===B.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}J.default=H},"./src/task-loop.ts":function(oe,J,k){"use strict";k.r(J),k.d(J,"default",function(){return $});var $=function(){function F(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var B=F.prototype;return B.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},B.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},B.onHandlerDestroyed=function(){},B.hasInterval=function(){return!!this._tickInterval},B.hasNextTick=function(){return!!this._tickTimer},B.setInterval=function(H){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,H),!0)},B.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},B.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},B.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},B.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},B.doTick=function(){},F}()},"./src/types/cmcd.ts":function(oe,J,k){"use strict";k.r(J),k.d(J,"CMCDVersion",function(){return $}),k.d(J,"CMCDObjectType",function(){return F}),k.d(J,"CMCDStreamingFormat",function(){return B}),k.d(J,"CMCDStreamType",function(){return G});var $=1,F;(function(H){H.MANIFEST="m",H.AUDIO="a",H.VIDEO="v",H.MUXED="av",H.INIT="i",H.CAPTION="c",H.TIMED_TEXT="tt",H.KEY="k",H.OTHER="o"})(F||(F={}));var B;(function(H){H.DASH="d",H.HLS="h",H.SMOOTH="s",H.OTHER="o"})(B||(B={}));var G;(function(H){H.VOD="v",H.LIVE="l"})(G||(G={}))},"./src/types/level.ts":function(oe,J,k){"use strict";k.r(J),k.d(J,"HlsSkip",function(){return B}),k.d(J,"getSkipValue",function(){return G}),k.d(J,"HlsUrlParameters",function(){return H}),k.d(J,"Level",function(){return D});function $(I,g){for(var p=0;p<g.length;p++){var f=g[p];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(I,f.key,f)}}function F(I,g,p){return g&&$(I.prototype,g),p&&$(I,p),I}var B;(function(I){I.No="",I.Yes="YES",I.v2="v2"})(B||(B={}));function G(I,g){var p=I.canSkipUntil,f=I.canSkipDateRanges,h=I.endSN,o=g!==void 0?g-h:0;return p&&o<p?f?B.v2:B.Yes:B.No}var H=function(){function I(p,f,h){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=p,this.part=f,this.skip=h}var g=I.prototype;return g.addDirectives=function(f){var h=new self.URL(f);return this.msn!==void 0&&h.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&h.searchParams.set("_HLS_part",this.part.toString()),this.skip&&h.searchParams.set("_HLS_skip",this.skip),h.toString()},I}(),D=function(){function I(g){this.attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.videoCodec=void 0,this.width=void 0,this.unknownCodecs=void 0,this.audioGroupIds=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.textGroupIds=void 0,this.url=void 0,this._urlId=0,this.url=[g.url],this.attrs=g.attrs,this.bitrate=g.bitrate,g.details&&(this.details=g.details),this.id=g.id||0,this.name=g.name,this.width=g.width||0,this.height=g.height||0,this.audioCodec=g.audioCodec,this.videoCodec=g.videoCodec,this.unknownCodecs=g.unknownCodecs,this.codecSet=[g.videoCodec,g.audioCodec].filter(function(p){return p}).join(",").replace(/\.[^.,]+/g,"")}return F(I,[{key:"maxBitrate",get:function(){return Math.max(this.realBitrate,this.bitrate)}},{key:"uri",get:function(){return this.url[this._urlId]||""}},{key:"urlId",get:function(){return this._urlId},set:function(p){var f=p%this.url.length;this._urlId!==f&&(this.details=void 0,this._urlId=f)}}]),I}()},"./src/types/loader.ts":function(oe,J,k){"use strict";k.r(J),k.d(J,"PlaylistContextType",function(){return $}),k.d(J,"PlaylistLevelType",function(){return F});var $;(function(B){B.MANIFEST="manifest",B.LEVEL="level",B.AUDIO_TRACK="audioTrack",B.SUBTITLE_TRACK="subtitleTrack"})($||($={}));var F;(function(B){B.MAIN="main",B.AUDIO="audio",B.SUBTITLE="subtitle"})(F||(F={}))},"./src/types/transmuxer.ts":function(oe,J,k){"use strict";k.r(J),k.d(J,"ChunkMetadata",function(){return $});var $=function(G,H,D,I,g,p){I===void 0&&(I=0),g===void 0&&(g=-1),p===void 0&&(p=!1),this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=F(),this.buffering={audio:F(),video:F(),audiovideo:F()},this.level=G,this.sn=H,this.id=D,this.size=I,this.part=g,this.partial=p};function F(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(oe,J,k){"use strict";k.r(J),k.d(J,"AttrList",function(){return B});var $=/^(\d+)x(\d+)$/,F=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,B=function(){function G(D){typeof D=="string"&&(D=G.parseAttrList(D));for(var I in D)D.hasOwnProperty(I)&&(this[I]=D[I])}var H=G.prototype;return H.decimalInteger=function(I){var g=parseInt(this[I],10);return g>Number.MAX_SAFE_INTEGER?Infinity:g},H.hexadecimalInteger=function(I){if(this[I]){var g=(this[I]||"0x").slice(2);g=(g.length&1?"0":"")+g;for(var p=new Uint8Array(g.length/2),f=0;f<g.length/2;f++)p[f]=parseInt(g.slice(f*2,f*2+2),16);return p}else return null},H.hexadecimalIntegerAsNumber=function(I){var g=parseInt(this[I],16);return g>Number.MAX_SAFE_INTEGER?Infinity:g},H.decimalFloatingPoint=function(I){return parseFloat(this[I])},H.optionalFloat=function(I,g){var p=this[I];return p?parseFloat(p):g},H.enumeratedString=function(I){return this[I]},H.bool=function(I){return this[I]==="YES"},H.decimalResolution=function(I){var g=$.exec(this[I]);return g===null?void 0:{width:parseInt(g[1],10),height:parseInt(g[2],10)}},G.parseAttrList=function(I){var g,p={},f='"';for(F.lastIndex=0;(g=F.exec(I))!==null;){var h=g[2];h.indexOf(f)===0&&h.lastIndexOf(f)===h.length-1&&(h=h.slice(1,-1)),p[g[1]]=h}return p},G}()},"./src/utils/binary-search.ts":function(oe,J,k){"use strict";k.r(J);var $={search:function(B,G){for(var H=0,D=B.length-1,I=null,g=null;H<=D;){I=(H+D)/2|0,g=B[I];var p=G(g);if(p>0)H=I+1;else if(p<0)D=I-1;else return g}return null}};J.default=$},"./src/utils/buffer-helper.ts":function(oe,J,k){"use strict";k.r(J),k.d(J,"BufferHelper",function(){return B});var $=k("./src/utils/logger.ts"),F={length:0,start:function(){return 0},end:function(){return 0}},B=function(){function G(){}return G.isBuffered=function(D,I){try{if(D){for(var g=G.getBuffered(D),p=0;p<g.length;p++)if(I>=g.start(p)&&I<=g.end(p))return!0}}catch(f){}return!1},G.bufferInfo=function(D,I,g){try{if(D){var p=G.getBuffered(D),f=[],h;for(h=0;h<p.length;h++)f.push({start:p.start(h),end:p.end(h)});return this.bufferedInfo(f,I,g)}}catch(o){}return{len:0,start:I,end:I,nextStart:void 0}},G.bufferedInfo=function(D,I,g){I=Math.max(0,I),D.sort(function(x,O){var A=x.start-O.start;return A||O.end-x.end});var p=[];if(g)for(var f=0;f<D.length;f++){var h=p.length;if(h){var o=p[h-1].end;D[f].start-o<g?D[f].end>o&&(p[h-1].end=D[f].end):p.push(D[f])}else p.push(D[f])}else p=D;for(var d=0,s,a=I,l=I,c=0;c<p.length;c++){var R=p[c].start,w=p[c].end;if(I+g>=R&&I<w)a=R,l=w,d=l-I;else if(I+g<R){s=R;break}}return{len:d,start:a||0,end:l||0,nextStart:s}},G.getBuffered=function(D){try{return D.buffered}catch(I){return $.logger.log("failed to get media.buffered",I),F}},G}()},"./src/utils/cea-608-parser.ts":function(oe,J,k){"use strict";k.r(J),k.d(J,"Row",function(){return l}),k.d(J,"CaptionScreen",function(){return c});var $=k("./src/utils/logger.ts"),F={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},B=function(E){var b=E;return F.hasOwnProperty(E)&&(b=F[E]),String.fromCharCode(b)},G=15,H=100,D={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},I={17:2,18:4,21:6,22:8,23:10,19:13,20:15},g={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},p={25:2,26:4,29:6,30:8,31:10,27:13,28:15},f=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],h;(function(T){T[T.ERROR=0]="ERROR",T[T.TEXT=1]="TEXT",T[T.WARNING=2]="WARNING",T[T.INFO=2]="INFO",T[T.DEBUG=3]="DEBUG",T[T.DATA=3]="DATA"})(h||(h={}));var o=function(){function T(){this.time=null,this.verboseLevel=h.ERROR}var E=T.prototype;return E.log=function(u,_){this.verboseLevel>=u&&$.logger.log(this.time+" ["+u+"] "+_)},T}(),d=function(E){for(var b=[],u=0;u<E.length;u++)b.push(E[u].toString(16));return b},s=function(){function T(b,u,_,m,v){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=b||"white",this.underline=u||!1,this.italics=_||!1,this.background=m||"black",this.flash=v||!1}var E=T.prototype;return E.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},E.setStyles=function(u){for(var _=["foreground","underline","italics","background","flash"],m=0;m<_.length;m++){var v=_[m];u.hasOwnProperty(v)&&(this[v]=u[v])}},E.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},E.equals=function(u){return this.foreground===u.foreground&&this.underline===u.underline&&this.italics===u.italics&&this.background===u.background&&this.flash===u.flash},E.copy=function(u){this.foreground=u.foreground,this.underline=u.underline,this.italics=u.italics,this.background=u.background,this.flash=u.flash},E.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},T}(),a=function(){function T(b,u,_,m,v,M){this.uchar=void 0,this.penState=void 0,this.uchar=b||" ",this.penState=new s(u,_,m,v,M)}var E=T.prototype;return E.reset=function(){this.uchar=" ",this.penState.reset()},E.setChar=function(u,_){this.uchar=u,this.penState.copy(_)},E.setPenState=function(u){this.penState.copy(u)},E.equals=function(u){return this.uchar===u.uchar&&this.penState.equals(u.penState)},E.copy=function(u){this.uchar=u.uchar,this.penState.copy(u.penState)},E.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},T}(),l=function(){function T(b){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var u=0;u<H;u++)this.chars.push(new a);this.logger=b,this.pos=0,this.currPenState=new s}var E=T.prototype;return E.equals=function(u){for(var _=!0,m=0;m<H;m++)if(!this.chars[m].equals(u.chars[m])){_=!1;break}return _},E.copy=function(u){for(var _=0;_<H;_++)this.chars[_].copy(u.chars[_])},E.isEmpty=function(){for(var u=!0,_=0;_<H;_++)if(!this.chars[_].isEmpty()){u=!1;break}return u},E.setCursor=function(u){this.pos!==u&&(this.pos=u),this.pos<0?(this.logger.log(h.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>H&&(this.logger.log(h.DEBUG,"Too large cursor position "+this.pos),this.pos=H)},E.moveCursor=function(u){var _=this.pos+u;if(u>1)for(var m=this.pos+1;m<_+1;m++)this.chars[m].setPenState(this.currPenState);this.setCursor(_)},E.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},E.insertChar=function(u){u>=144&&this.backSpace();var _=B(u);if(this.pos>=H){this.logger.log(h.ERROR,"Cannot insert "+u.toString(16)+" ("+_+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(_,this.currPenState),this.moveCursor(1)},E.clearFromPos=function(u){var _;for(_=u;_<H;_++)this.chars[_].reset()},E.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},E.clearToEndOfRow=function(){this.clearFromPos(this.pos)},E.getTextString=function(){for(var u=[],_=!0,m=0;m<H;m++){var v=this.chars[m].uchar;v!==" "&&(_=!1),u.push(v)}return _?"":u.join("")},E.setPenStyles=function(u){this.currPenState.setStyles(u);var _=this.chars[this.pos];_.setPenState(this.currPenState)},T}(),c=function(){function T(b){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var u=0;u<G;u++)this.rows.push(new l(b));this.logger=b,this.currRow=G-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var E=T.prototype;return E.reset=function(){for(var u=0;u<G;u++)this.rows[u].clear();this.currRow=G-1},E.equals=function(u){for(var _=!0,m=0;m<G;m++)if(!this.rows[m].equals(u.rows[m])){_=!1;break}return _},E.copy=function(u){for(var _=0;_<G;_++)this.rows[_].copy(u.rows[_])},E.isEmpty=function(){for(var u=!0,_=0;_<G;_++)if(!this.rows[_].isEmpty()){u=!1;break}return u},E.backSpace=function(){var u=this.rows[this.currRow];u.backSpace()},E.clearToEndOfRow=function(){var u=this.rows[this.currRow];u.clearToEndOfRow()},E.insertChar=function(u){var _=this.rows[this.currRow];_.insertChar(u)},E.setPen=function(u){var _=this.rows[this.currRow];_.setPenStyles(u)},E.moveCursor=function(u){var _=this.rows[this.currRow];_.moveCursor(u)},E.setCursor=function(u){this.logger.log(h.INFO,"setCursor: "+u);var _=this.rows[this.currRow];_.setCursor(u)},E.setPAC=function(u){this.logger.log(h.INFO,"pacData = "+JSON.stringify(u));var _=u.row-1;if(this.nrRollUpRows&&_<this.nrRollUpRows-1&&(_=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==_){for(var m=0;m<G;m++)this.rows[m].clear();var v=this.currRow+1-this.nrRollUpRows,M=this.lastOutputScreen;if(M){var P=M.rows[v].cueStartTime,K=this.logger.time;if(P&&K!==null&&P<K)for(var V=0;V<this.nrRollUpRows;V++)this.rows[_-this.nrRollUpRows+V+1].copy(M.rows[v+V])}}this.currRow=_;var U=this.rows[this.currRow];if(u.indent!==null){var S=u.indent,X=Math.max(S-1,0);U.setCursor(u.indent),u.color=U.chars[X].penState.foreground}var ee={foreground:u.color,underline:u.underline,italics:u.italics,background:"black",flash:!1};this.setPen(ee)},E.setBkgData=function(u){this.logger.log(h.INFO,"bkgData = "+JSON.stringify(u)),this.backSpace(),this.setPen(u),this.insertChar(32)},E.setRollUpRows=function(u){this.nrRollUpRows=u},E.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(h.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(h.TEXT,this.getDisplayText());var u=this.currRow+1-this.nrRollUpRows,_=this.rows.splice(u,1)[0];_.clear(),this.rows.splice(this.currRow,0,_),this.logger.log(h.INFO,"Rolling up")},E.getDisplayText=function(u){u=u||!1;for(var _=[],m="",v=-1,M=0;M<G;M++){var P=this.rows[M].getTextString();P&&(v=M+1,u?_.push("Row "+v+": '"+P+"'"):_.push(P.trim()))}return _.length>0&&(u?m="["+_.join(" | ")+"]":m=_.join(`
`)),m},E.getTextAndFormat=function(){return this.rows},T}(),R=function(){function T(b,u,_){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=b,this.outputFilter=u,this.mode=null,this.verbose=0,this.displayedMemory=new c(_),this.nonDisplayedMemory=new c(_),this.lastOutputScreen=new c(_),this.currRollUpRow=this.displayedMemory.rows[G-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=_}var E=T.prototype;return E.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[G-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},E.getHandler=function(){return this.outputFilter},E.setHandler=function(u){this.outputFilter=u},E.setPAC=function(u){this.writeScreen.setPAC(u)},E.setBkgData=function(u){this.writeScreen.setBkgData(u)},E.setMode=function(u){if(u===this.mode)return;this.mode=u,this.logger.log(h.INFO,"MODE="+u),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=u},E.insertChars=function(u){for(var _=0;_<u.length;_++)this.writeScreen.insertChar(u[_]);var m=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(h.INFO,m+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(h.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},E.ccRCL=function(){this.logger.log(h.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},E.ccBS=function(){if(this.logger.log(h.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},E.ccAOF=function(){},E.ccAON=function(){},E.ccDER=function(){this.logger.log(h.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},E.ccRU=function(u){this.logger.log(h.INFO,"RU("+u+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(u)},E.ccFON=function(){this.logger.log(h.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},E.ccRDC=function(){this.logger.log(h.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},E.ccTR=function(){this.logger.log(h.INFO,"TR"),this.setMode("MODE_TEXT")},E.ccRTD=function(){this.logger.log(h.INFO,"RTD"),this.setMode("MODE_TEXT")},E.ccEDM=function(){this.logger.log(h.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},E.ccCR=function(){this.logger.log(h.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},E.ccENM=function(){this.logger.log(h.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},E.ccEOC=function(){if(this.logger.log(h.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var u=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=u,this.writeScreen=this.nonDisplayedMemory,this.logger.log(h.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},E.ccTO=function(u){this.logger.log(h.INFO,"TO("+u+") - Tab Offset"),this.writeScreen.moveCursor(u)},E.ccMIDROW=function(u){var _={flash:!1};if(_.underline=u%2===1,_.italics=u>=46,_.italics)_.foreground="white";else{var m=Math.floor(u/2)-16,v=["white","green","blue","cyan","red","yellow","magenta"];_.foreground=v[m]}this.logger.log(h.INFO,"MIDROW: "+JSON.stringify(_)),this.writeScreen.setPen(_)},E.outputDataUpdate=function(u){u===void 0&&(u=!1);var _=this.logger.time;if(_===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=_:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,_,this.lastOutputScreen),u&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:_),this.lastOutputScreen.copy(this.displayedMemory))},E.cueSplitAtTime=function(u){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,u,this.displayedMemory),this.cueStartTime=u))},T}(),w=function(){function T(b,u,_){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var m=new o;this.channels=[null,new R(b,u,m),new R(b+1,_,m)],this.cmdHistory=A(),this.logger=m}var E=T.prototype;return E.getHandler=function(u){return this.channels[u].getHandler()},E.setHandler=function(u,_){this.channels[u].setHandler(_)},E.addData=function(u,_){var m,v,M,P=!1;this.logger.time=u;for(var K=0;K<_.length;K+=2){if(v=_[K]&127,M=_[K+1]&127,v===0&&M===0)continue;if(this.logger.log(h.DATA,"["+d([_[K],_[K+1]])+"] -> ("+d([v,M])+")"),m=this.parseCmd(v,M),m||(m=this.parseMidrow(v,M)),m||(m=this.parsePAC(v,M)),m||(m=this.parseBackgroundAttributes(v,M)),!m&&(P=this.parseChars(v,M),P)){var V=this.currentChannel;if(V&&V>0){var U=this.channels[V];U.insertChars(P)}else this.logger.log(h.WARNING,"No channel found yet. TEXT-MODE?")}!m&&!P&&this.logger.log(h.WARNING,"Couldn't parse cleaned data "+d([v,M])+" orig: "+d([_[K],_[K+1]]))}},E.parseCmd=function(u,_){var m=this.cmdHistory,v=(u===20||u===28||u===21||u===29)&&_>=32&&_<=47,M=(u===23||u===31)&&_>=33&&_<=35;if(!(v||M))return!1;if(O(u,_,m))return x(null,null,m),this.logger.log(h.DEBUG,"Repeated command ("+d([u,_])+") is dropped"),!0;var P=u===20||u===21||u===23?1:2,K=this.channels[P];return u===20||u===21||u===28||u===29?_===32?K.ccRCL():_===33?K.ccBS():_===34?K.ccAOF():_===35?K.ccAON():_===36?K.ccDER():_===37?K.ccRU(2):_===38?K.ccRU(3):_===39?K.ccRU(4):_===40?K.ccFON():_===41?K.ccRDC():_===42?K.ccTR():_===43?K.ccRTD():_===44?K.ccEDM():_===45?K.ccCR():_===46?K.ccENM():_===47&&K.ccEOC():K.ccTO(_-32),x(u,_,m),this.currentChannel=P,!0},E.parseMidrow=function(u,_){var m=0;if((u===17||u===25)&&_>=32&&_<=47){if(u===17?m=1:m=2,m!==this.currentChannel)return this.logger.log(h.ERROR,"Mismatch channel in midrow parsing"),!1;var v=this.channels[m];return v?(v.ccMIDROW(_),this.logger.log(h.DEBUG,"MIDROW ("+d([u,_])+")"),!0):!1}return!1},E.parsePAC=function(u,_){var m,v=this.cmdHistory,M=(u>=17&&u<=23||u>=25&&u<=31)&&_>=64&&_<=127,P=(u===16||u===24)&&_>=64&&_<=95;if(!(M||P))return!1;if(O(u,_,v))return x(null,null,v),!0;var K=u<=23?1:2;_>=64&&_<=95?m=K===1?D[u]:g[u]:m=K===1?I[u]:p[u];var V=this.channels[K];return V?(V.setPAC(this.interpretPAC(m,_)),x(u,_,v),this.currentChannel=K,!0):!1},E.interpretPAC=function(u,_){var m,v={color:null,italics:!1,indent:null,underline:!1,row:u};return _>95?m=_-96:m=_-64,v.underline=(m&1)===1,m<=13?v.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(m/2)]:m<=15?(v.italics=!0,v.color="white"):v.indent=Math.floor((m-16)/2)*4,v},E.parseChars=function(u,_){var m,v=null,M=null;if(u>=25?(m=2,M=u-8):(m=1,M=u),M>=17&&M<=19){var P;M===17?P=_+80:M===18?P=_+112:P=_+144,this.logger.log(h.INFO,"Special char '"+B(P)+"' in channel "+m),v=[P]}else u>=32&&u<=127&&(v=_===0?[u]:[u,_]);if(v){var K=d(v);this.logger.log(h.DEBUG,"Char codes = "+K.join(",")),x(u,_,this.cmdHistory)}return v},E.parseBackgroundAttributes=function(u,_){var m=(u===16||u===24)&&_>=32&&_<=47,v=(u===23||u===31)&&_>=45&&_<=47;if(!(m||v))return!1;var M,P={};u===16||u===24?(M=Math.floor((_-32)/2),P.background=f[M],_%2===1&&(P.background=P.background+"_semi")):_===45?P.background="transparent":(P.foreground="black",_===47&&(P.underline=!0));var K=u<=23?1:2,V=this.channels[K];return V.setBkgData(P),x(u,_,this.cmdHistory),!0},E.reset=function(){for(var u=0;u<Object.keys(this.channels).length;u++){var _=this.channels[u];_&&_.reset()}this.cmdHistory=A()},E.cueSplitAtTime=function(u){for(var _=0;_<this.channels.length;_++){var m=this.channels[_];m&&m.cueSplitAtTime(u)}},T}();function x(T,E,b){b.a=T,b.b=E}function O(T,E,b){return b.a===T&&b.b===E}function A(){return{a:null,b:null}}J.default=w},"./src/utils/codecs.ts":function(oe,J,k){"use strict";k.r(J),k.d(J,"isCodecType",function(){return F}),k.d(J,"isCodecSupportedInMp4",function(){return B});var $={audio:{a3ds:!0,"ac-3":!0,"ac-4":!0,alac:!0,alaw:!0,dra1:!0,"dts+":!0,"dts-":!0,dtsc:!0,dtse:!0,dtsh:!0,"ec-3":!0,enca:!0,g719:!0,g726:!0,m4ae:!0,mha1:!0,mha2:!0,mhm1:!0,mhm2:!0,mlpa:!0,mp4a:!0,"raw ":!0,Opus:!0,samr:!0,sawb:!0,sawp:!0,sevc:!0,sqcp:!0,ssmv:!0,twos:!0,ulaw:!0},video:{avc1:!0,avc2:!0,avc3:!0,avc4:!0,avcp:!0,av01:!0,drac:!0,dvav:!0,dvhe:!0,encv:!0,hev1:!0,hvc1:!0,mjp2:!0,mp4v:!0,mvc1:!0,mvc2:!0,mvc3:!0,mvc4:!0,resv:!0,rv60:!0,s263:!0,svc1:!0,svc2:!0,"vc-1":!0,vp08:!0,vp09:!0},text:{stpp:!0,wvtt:!0}};function F(G,H){var D=$[H];return!!D&&D[G.slice(0,4)]===!0}function B(G,H){return MediaSource.isTypeSupported((H||"video")+'/mp4;codecs="'+G+'"')}},"./src/utils/cues.ts":function(oe,J,k){"use strict";k.r(J);var $=k("./src/utils/vttparser.ts"),F=k("./src/utils/webvtt-parser.ts"),B=k("./src/utils/texttrack-utils.ts"),G=/\s/,H={newCue:function(I,g,p,f){for(var h=[],o,d,s,a,l,c=self.VTTCue||self.TextTrackCue,R=0;R<f.rows.length;R++)if(o=f.rows[R],s=!0,a=0,l="",!o.isEmpty()){for(var w=0;w<o.chars.length;w++)G.test(o.chars[w].uchar)&&s?a++:(l+=o.chars[w].uchar,s=!1);o.cueStartTime=g,g===p&&(p+=1e-4),a>=16?a--:a++;var x=Object($.fixLineBreaks)(l.trim()),O=Object(F.generateCueId)(g,p,x);(!I||!I.cues||!I.cues.getCueById(O))&&(d=new c(g,p,x),d.id=O,d.line=R+1,d.align="left",d.position=10+Math.min(80,Math.floor(a*8/32)*10),h.push(d))}return I&&h.length&&(h.sort(function(A,T){return A.line==="auto"||T.line==="auto"?0:A.line>8&&T.line>8?T.line-A.line:A.line-T.line}),h.forEach(function(A){return Object(B.addCueToTrack)(I,A)})),h}};J.default=H},"./src/utils/discontinuities.ts":function(oe,J,k){"use strict";k.r(J),k.d(J,"findFirstFragWithCC",function(){return G}),k.d(J,"shouldAlignOnDiscontinuities",function(){return H}),k.d(J,"findDiscontinuousReferenceFrag",function(){return D}),k.d(J,"adjustSlidingStart",function(){return g}),k.d(J,"alignStream",function(){return p}),k.d(J,"alignPDT",function(){return h}),k.d(J,"alignFragmentByPDTDelta",function(){return o}),k.d(J,"alignMediaPlaylistByPDT",function(){return d});var $=k("./src/polyfills/number.ts"),F=k("./src/utils/logger.ts"),B=k("./src/controller/level-helper.ts");function G(s,a){for(var l=null,c=0,R=s.length;c<R;c++){var w=s[c];if(w&&w.cc===a){l=w;break}}return l}function H(s,a,l){return!!(a.details&&(l.endCC>l.startCC||s&&s.cc<l.startCC))}function D(s,a){var l=s.fragments,c=a.fragments;if(!c.length||!l.length){F.logger.log("No fragments to align");return}var R=G(l,c[0].cc);if(!R||R&&!R.startPTS){F.logger.log("No frag in previous level to align on");return}return R}function I(s,a){if(s){var l=s.start+a;s.start=s.startPTS=l,s.endPTS=l+s.duration}}function g(s,a){for(var l=a.fragments,c=0,R=l.length;c<R;c++)I(l[c],s);a.fragmentHint&&I(a.fragmentHint,s),a.alignedSliding=!0}function p(s,a,l){if(!a)return;f(s,l,a),!l.alignedSliding&&a.details&&h(l,a.details),!l.alignedSliding&&a.details&&!l.skippedSegments&&Object(B.adjustSliding)(a.details,l)}function f(s,a,l){if(H(s,l,a)){var c=D(l.details,a);c&&Object($.isFiniteNumber)(c.start)&&(F.logger.log("Adjusting PTS using last level due to CC increase within current level "+a.url),g(c.start,a))}}function h(s,a){if(!a.fragments.length||!s.hasProgramDateTime||!a.hasProgramDateTime)return;var l=a.fragments[0].programDateTime,c=s.fragments[0].programDateTime,R=(c-l)/1e3+a.fragments[0].start;R&&Object($.isFiniteNumber)(R)&&(F.logger.log("Adjusting PTS using programDateTime delta "+(c-l)+"ms, sliding:"+R.toFixed(3)+" "+s.url+" "),g(R,s))}function o(s,a){var l=s.programDateTime;if(!l)return;var c=(l-a)/1e3;s.start=s.startPTS=c,s.endPTS=c+s.duration}function d(s,a){if(!a.fragments.length||!s.hasProgramDateTime||!a.hasProgramDateTime)return;var l=a.fragments[0].programDateTime,c=a.fragments[0].start,R=l-c*1e3;s.fragments.forEach(function(w){o(w,R)}),s.fragmentHint&&o(s.fragmentHint,R),s.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(oe,J,k){"use strict";k.r(J);var $=k("./src/utils/ewma.ts"),F=function(){function B(H,D,I){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=I,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new $.default(H),this.fast_=new $.default(D)}var G=B.prototype;return G.update=function(D,I){var g=this.slow_,p=this.fast_;this.slow_.halfLife!==D&&(this.slow_=new $.default(D,g.getEstimate(),g.getTotalWeight())),this.fast_.halfLife!==I&&(this.fast_=new $.default(I,p.getEstimate(),p.getTotalWeight()))},G.sample=function(D,I){D=Math.max(D,this.minDelayMs_);var g=8*I,p=D/1e3,f=g/p;this.fast_.sample(p,f),this.slow_.sample(p,f)},G.canEstimate=function(){var D=this.fast_;return D&&D.getTotalWeight()>=this.minWeight_},G.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},G.destroy=function(){},B}();J.default=F},"./src/utils/ewma.ts":function(oe,J,k){"use strict";k.r(J);var $=function(){function F(G,H,D){H===void 0&&(H=0),D===void 0&&(D=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=G,this.alpha_=G?Math.exp(Math.log(.5)/G):0,this.estimate_=H,this.totalWeight_=D}var B=F.prototype;return B.sample=function(H,D){var I=Math.pow(this.alpha_,H);this.estimate_=D*(1-I)+I*this.estimate_,this.totalWeight_+=H},B.getTotalWeight=function(){return this.totalWeight_},B.getEstimate=function(){if(this.alpha_){var H=1-Math.pow(this.alpha_,this.totalWeight_);if(H)return this.estimate_/H}return this.estimate_},F}();J.default=$},"./src/utils/fetch-loader.ts":function(oe,J,k){"use strict";k.r(J),k.d(J,"fetchSupported",function(){return o});var $=k("./src/polyfills/number.ts"),F=k("./src/loader/load-stats.ts"),B=k("./src/demux/chunk-cache.ts");function G(c,R){c.prototype=Object.create(R.prototype),c.prototype.constructor=c,p(c,R)}function H(c){var R=typeof Map=="function"?new Map:void 0;return H=function(x){if(x===null||!g(x))return x;if(typeof x!="function")throw new TypeError("Super expression must either be null or a function");if(typeof R!="undefined"){if(R.has(x))return R.get(x);R.set(x,O)}function O(){return D(x,arguments,f(this).constructor)}return O.prototype=Object.create(x.prototype,{constructor:{value:O,enumerable:!1,writable:!0,configurable:!0}}),p(O,x)},H(c)}function D(c,R,w){return I()?D=Reflect.construct:D=function(O,A,T){var E=[null];E.push.apply(E,A);var b=Function.bind.apply(O,E),u=new b;return T&&p(u,T.prototype),u},D.apply(null,arguments)}function I(){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 g(c){return Function.toString.call(c).indexOf("[native code]")!==-1}function p(c,R){return p=Object.setPrototypeOf||function(x,O){return x.__proto__=O,x},p(c,R)}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 R=1;R<arguments.length;R++){var w=arguments[R];for(var x in w)Object.prototype.hasOwnProperty.call(w,x)&&(c[x]=w[x])}return c},h.apply(this,arguments)}function o(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(c){}return!1}var d=function(){function c(w){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=void 0,this.response=void 0,this.controller=void 0,this.context=void 0,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=w.fetchSetup||a,this.controller=new self.AbortController,this.stats=new F.LoadStats}var R=c.prototype;return R.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},R.abortInternal=function(){var x=this.response;(!x||!x.ok)&&(this.stats.aborted=!0,this.controller.abort())},R.abort=function(){var x;this.abortInternal(),(x=this.callbacks)!==null&&x!==void 0&&x.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},R.load=function(x,O,A){var T=this,E=this.stats;if(E.loading.start)throw new Error("Loader can only be used once.");E.loading.start=self.performance.now();var b=s(x,this.controller.signal),u=A.onProgress,_=x.responseType==="arraybuffer",m=_?"byteLength":"length";this.context=x,this.config=O,this.callbacks=A,this.request=this.fetchSetup(x,b),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){T.abortInternal(),A.onTimeout(E,x,T.response)},O.timeout),self.fetch(this.request).then(function(v){if(T.response=T.loader=v,!v.ok){var M=v.status,P=v.statusText;throw new l(P||"fetch, bad network response",M,v)}return E.loading.first=Math.max(self.performance.now(),E.loading.start),E.total=parseInt(v.headers.get("Content-Length")||"0"),u&&Object($.isFiniteNumber)(O.highWaterMark)?T.loadProgressively(v,E,x,O.highWaterMark,u):_?v.arrayBuffer():v.text()}).then(function(v){var M=T.response;self.clearTimeout(T.requestTimeout),E.loading.end=Math.max(self.performance.now(),E.loading.first),E.loaded=E.total=v[m];var P={url:M.url,data:v};u&&!Object($.isFiniteNumber)(O.highWaterMark)&&u(E,x,v,M),A.onSuccess(P,E,x,M)}).catch(function(v){if(self.clearTimeout(T.requestTimeout),E.aborted)return;var M=v.code||0;A.onError({code:M,text:v.message},x,v.details)})},R.getCacheAge=function(){var x=null;if(this.response){var O=this.response.headers.get("age");x=O?parseFloat(O):null}return x},R.loadProgressively=function(x,O,A,T,E){T===void 0&&(T=0);var b=new B.default,u=x.body.getReader(),_=function m(){return u.read().then(function(v){if(v.done)return b.dataLength&&E(O,A,b.flush(),x),Promise.resolve(new ArrayBuffer(0));var M=v.value,P=M.length;return O.loaded+=P,P<T||b.dataLength?(b.push(M),b.dataLength>=T&&E(O,A,b.flush(),x)):E(O,A,M,x),m()}).catch(function(){return Promise.reject()})};return _()},c}();function s(c,R){var w={method:"GET",mode:"cors",credentials:"same-origin",signal:R,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,R){return new self.Request(c.url,R)}var l=function(c){G(R,c);function R(w,x,O){var A;return A=c.call(this,w)||this,A.code=void 0,A.details=void 0,A.code=x,A.details=O,A}return R}(H(Error));J.default=d},"./src/utils/imsc1-ttml-parser.ts":function(oe,J,k){"use strict";k.r(J),k.d(J,"IMSC1_CODEC",function(){return g}),k.d(J,"parseIMSC1",function(){return o});var $=k("./src/utils/mp4-tools.ts"),F=k("./src/utils/vttparser.ts"),B=k("./src/utils/vttcue.ts"),G=k("./src/demux/id3.ts"),H=k("./src/utils/timescale-conversion.ts"),D=k("./src/utils/webvtt-parser.ts");function I(){return I=Object.assign||function(T){for(var E=1;E<arguments.length;E++){var b=arguments[E];for(var u in b)Object.prototype.hasOwnProperty.call(b,u)&&(T[u]=b[u])}return T},I.apply(this,arguments)}var g="stpp.ttml.im1t",p=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,f=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,h={left:"start",center:"center",right:"end",start:"start",end:"end"};function o(T,E,b,u,_){var m=Object($.findBox)(new Uint8Array(T),["mdat"]);if(m.length===0){_(new Error("Could not parse IMSC1 mdat"));return}var v=m[0],M=Object(G.utf8ArrayToStr)(new Uint8Array(T,v.start,v.end-v.start)),P=Object(H.toTimescaleFromScale)(E,1,b);try{u(d(M,P))}catch(K){_(K)}}function d(T,E){var b=new DOMParser,u=b.parseFromString(T,"text/xml"),_=u.getElementsByTagName("tt")[0];if(!_)throw new Error("Invalid ttml");var m={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},v=Object.keys(m).reduce(function(U,S){return U[S]=_.getAttribute("ttp:"+S)||m[S],U},{}),M=_.getAttribute("xml:space")!=="preserve",P=a(s(_,"styling","style")),K=a(s(_,"layout","region")),V=s(_,"body","[begin]");return[].map.call(V,function(U){var S=l(U,M);if(!S||!U.hasAttribute("begin"))return null;var X=x(U.getAttribute("begin"),v),ee=x(U.getAttribute("dur"),v),ae=x(U.getAttribute("end"),v);if(X===null)throw w(U);if(ae===null){if(ee===null)throw w(U);ae=X+ee}var de=new B.default(X-E,ae-E,S);de.id=Object(D.generateCueId)(de.startTime,de.endTime,de.text);var Ae=K[U.getAttribute("region")],Ee=P[U.getAttribute("style")];de.position=10,de.size=80;var we=c(Ae,Ee),he=we.textAlign;if(he){var ce=h[he];ce&&(de.lineAlign=ce),de.align=he}return I(de,we),de}).filter(function(U){return U!==null})}function s(T,E,b){var u=T.getElementsByTagName(E)[0];return u?[].slice.call(u.querySelectorAll(b)):[]}function a(T){return T.reduce(function(E,b){var u=b.getAttribute("xml:id");return u&&(E[u]=b),E},{})}function l(T,E){return[].slice.call(T.childNodes).reduce(function(b,u,_){var m;return u.nodeName==="br"&&_?b+`
`:(m=u.childNodes)!==null&&m!==void 0&&m.length?l(u,E):E?b+u.textContent.trim().replace(/\s+/g," "):b+u.textContent},"")}function c(T,E){var b="http://www.w3.org/ns/ttml#styling",u=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return u.reduce(function(_,m){var v=R(E,b,m)||R(T,b,m);return v&&(_[m]=v),_},{})}function R(T,E,b){return T.hasAttributeNS(E,b)?T.getAttributeNS(E,b):null}function w(T){return new Error("Could not parse ttml timestamp "+T)}function x(T,E){if(!T)return null;var b=Object(F.parseTimeStamp)(T);return b===null&&(p.test(T)?b=O(T,E):f.test(T)&&(b=A(T,E))),b}function O(T,E){var b=p.exec(T),u=(b[4]|0)+(b[5]|0)/E.subFrameRate;return(b[1]|0)*3600+(b[2]|0)*60+(b[3]|0)+u/E.frameRate}function A(T,E){var b=f.exec(T),u=Number(b[1]),_=b[2];switch(_){case"h":return u*3600;case"m":return u*60;case"ms":return u*1e3;case"f":return u/E.frameRate;case"t":return u/E.tickRate}return u}},"./src/utils/logger.ts":function(oe,J,k){"use strict";k.r(J),k.d(J,"enableLogs",function(){return D}),k.d(J,"logger",function(){return I});var $=function(){},F={trace:$,debug:$,log:$,warn:$,info:$,error:$},B=F;function G(g){var p=self.console[g];return p?p.bind(self.console,"["+g+"] >"):$}function H(g){for(var p=arguments.length,f=new Array(p>1?p-1:0),h=1;h<p;h++)f[h-1]=arguments[h];f.forEach(function(o){B[o]=g[o]?g[o].bind(g):G(o)})}function D(g){if(self.console&&g===!0||typeof g=="object"){H(g,"debug","log","info","warn","error");try{B.log()}catch(p){B=F}}else B=F}var I=B},"./src/utils/mediakeys-helper.ts":function(oe,J,k){"use strict";k.r(J),k.d(J,"KeySystems",function(){return $}),k.d(J,"requestMediaKeySystemAccess",function(){return F});var $;(function(B){B.WIDEVINE="com.widevine.alpha",B.PLAYREADY="com.microsoft.playready"})($||($={}));var F=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(oe,J,k){"use strict";k.r(J),k.d(J,"getMediaSource",function(){return $});function $(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(oe,J,k){"use strict";k.r(J),k.d(J,"bin2str",function(){return H}),k.d(J,"readUint16",function(){return D}),k.d(J,"readUint32",function(){return I}),k.d(J,"writeUint32",function(){return g}),k.d(J,"findBox",function(){return p}),k.d(J,"parseSegmentIndex",function(){return f}),k.d(J,"parseInitSegment",function(){return h}),k.d(J,"getStartDTS",function(){return o}),k.d(J,"getDuration",function(){return d}),k.d(J,"computeRawDurationFromSamples",function(){return s}),k.d(J,"offsetStartDTS",function(){return a}),k.d(J,"segmentValidRange",function(){return l}),k.d(J,"appendUint8Array",function(){return c});var $=k("./src/utils/typed-array.ts"),F=k("./src/loader/fragment.ts"),B=Math.pow(2,32)-1,G=[].push;function H(R){return String.fromCharCode.apply(null,R)}function D(R,w){"data"in R&&(w+=R.start,R=R.data);var x=R[w]<<8|R[w+1];return x<0?65536+x:x}function I(R,w){"data"in R&&(w+=R.start,R=R.data);var x=R[w]<<24|R[w+1]<<16|R[w+2]<<8|R[w+3];return x<0?4294967296+x:x}function g(R,w,x){"data"in R&&(w+=R.start,R=R.data),R[w]=x>>24,R[w+1]=x>>16&255,R[w+2]=x>>8&255,R[w+3]=x&255}function p(R,w){var x=[];if(!w.length)return x;var O,A,T;"data"in R?(O=R.data,A=R.start,T=R.end):(O=R,A=0,T=O.byteLength);for(var E=A;E<T;){var b=I(O,E),u=H(O.subarray(E+4,E+8)),_=b>1?E+b:T;if(u===w[0])if(w.length===1)x.push({data:O,start:E+8,end:_});else{var m=p({data:O,start:E+8,end:_},w.slice(1));m.length&&G.apply(x,m)}E=_}return x}function f(R){var w=p(R,["moov"]),x=w[0],O=x?x.end:null,A=p(R,["sidx"]);if(!A||!A[0])return null;var T=[],E=A[0],b=E.data[0],u=b===0?8:16,_=I(E,u);u+=4;var m=0,v=0;b===0?u+=8:u+=16,u+=2;var M=E.end+v,P=D(E,u);u+=2;for(var K=0;K<P;K++){var V=u,U=I(E,V);V+=4;var S=U&2147483647,X=(U&2147483648)>>>31;if(X===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var ee=I(E,V);V+=4,T.push({referenceSize:S,subsegmentDuration:ee,info:{duration:ee/_,start:M,end:M+S-1}}),M+=S,V+=4,u=V}return{earliestPresentationTime:m,timescale:_,version:b,referencesCount:P,references:T,moovEndOffset:O}}function h(R){for(var w=[],x=p(R,["moov","trak"]),O=0;O<x.length;O++){var A=x[O],T=p(A,["tkhd"])[0];if(T){var E=T.data[T.start],b=E===0?12:20,u=I(T,b),_=p(A,["mdia","mdhd"])[0];if(_){E=_.data[_.start],b=E===0?12:20;var m=I(_,b),v=p(A,["mdia","hdlr"])[0];if(v){var M=H(v.data.subarray(v.start+8,v.start+12)),P={soun:F.ElementaryStreamTypes.AUDIO,vide:F.ElementaryStreamTypes.VIDEO}[M];if(P){var K=p(A,["mdia","minf","stbl","stsd"])[0],V=void 0;K&&(V=H(K.data.subarray(K.start+12,K.start+16))),w[u]={timescale:m,type:P},w[P]={timescale:m,id:u,codec:V}}}}}}var U=p(R,["moov","mvex","trex"]);return U.forEach(function(S){var X=I(S,4),ee=w[X];ee&&(ee.default={duration:I(S,12),flags:I(S,20)})}),w}function o(R,w){return p(w,["moof","traf"]).reduce(function(x,O){var A=p(O,["tfdt"])[0],T=A.data[A.start],E=p(O,["tfhd"]).reduce(function(b,u){var _=I(u,4),m=R[_];if(m){var v=I(A,4);T===1&&(v*=Math.pow(2,32),v+=I(A,8));var M=m.timescale||9e4,P=v/M;if(isFinite(P)&&(b===null||P<b))return P}return b},null);return E!==null&&isFinite(E)&&(x===null||E<x)?E:x},null)||0}function d(R,w){for(var x=0,O=0,A=0,T=p(R,["moof","traf"]),E=0;E<T.length;E++){var b=T[E],u=p(b,["tfhd"])[0],_=I(u,4),m=w[_];if(!m)continue;var v=m.default,M=I(u,0)|(v==null?void 0:v.flags),P=v==null?void 0:v.duration;M&8&&(M&2?P=I(u,12):P=I(u,8));for(var K=m.timescale||9e4,V=p(b,["trun"]),U=0;U<V.length;U++){if(P){var S=I(V[U],4);x=P*S}else x=s(V[U]);m.type===F.ElementaryStreamTypes.VIDEO?O+=x/K:m.type===F.ElementaryStreamTypes.AUDIO&&(A+=x/K)}}if(O===0&&A===0){var X=f(R);if(X!=null&&X.references)return X.references.reduce(function(ee,ae){return ee+ae.info.duration||0},0)}return O||A}function s(R){var w=I(R,0),x=8;w&1&&(x+=4),w&4&&(x+=4);for(var O=0,A=I(R,4),T=0;T<A;T++){if(w&256){var E=I(R,x);O+=E,x+=4}w&512&&(x+=4),w&1024&&(x+=4),w&2048&&(x+=4)}return O}function a(R,w,x){p(w,["moof","traf"]).forEach(function(O){p(O,["tfhd"]).forEach(function(A){var T=I(A,4),E=R[T];if(!E)return;var b=E.timescale||9e4;p(O,["tfdt"]).forEach(function(u){var _=u.data[u.start],m=I(u,4);if(_===0)g(u,4,m-x*b);else{m*=Math.pow(2,32),m+=I(u,8),m-=x*b,m=Math.max(m,0);var v=Math.floor(m/(B+1)),M=Math.floor(m%(B+1));g(u,4,v),g(u,8,M)}})})})}function l(R){var w={valid:null,remainder:null},x=p(R,["moof"]);if(x){if(x.length<2)return w.remainder=R,w}else return w;var O=x[x.length-1];return w.valid=Object($.sliceUint8)(R,0,O.start-8),w.remainder=Object($.sliceUint8)(R,O.start-8),w}function c(R,w){var x=new Uint8Array(R.length+w.length);return x.set(R),x.set(w,R.length),x}},"./src/utils/output-filter.ts":function(oe,J,k){"use strict";k.r(J),k.d(J,"default",function(){return $});var $=function(){function F(G,H){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=G,this.trackName=H}var B=F.prototype;return B.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},B.newCue=function(H,D,I){(this.startTime===null||this.startTime>H)&&(this.startTime=H),this.endTime=D,this.screen=I,this.timelineController.createCaptionsTrack(this.trackName)},B.reset=function(){this.cueRanges=[]},F}()},"./src/utils/texttrack-utils.ts":function(oe,J,k){"use strict";k.r(J),k.d(J,"sendAddTrackEvent",function(){return F}),k.d(J,"addCueToTrack",function(){return B}),k.d(J,"clearCurrentCues",function(){return G}),k.d(J,"removeCuesInRange",function(){return H}),k.d(J,"getCuesInRange",function(){return I});var $=k("./src/utils/logger.ts");function F(g,p){var f;try{f=new Event("addtrack")}catch(h){f=document.createEvent("Event"),f.initEvent("addtrack",!1,!1)}f.track=g,p.dispatchEvent(f)}function B(g,p){var f=g.mode;if(f==="disabled"&&(g.mode="hidden"),g.cues&&!g.cues.getCueById(p.id))try{if(g.addCue(p),!g.cues.getCueById(p.id))throw new Error("addCue is failed for: "+p)}catch(o){$.logger.debug("[texttrack-utils]: "+o);var h=new self.TextTrackCue(p.startTime,p.endTime,p.text);h.id=p.id,g.addCue(h)}f==="disabled"&&(g.mode=f)}function G(g){var p=g.mode;if(p==="disabled"&&(g.mode="hidden"),g.cues)for(var f=g.cues.length;f--;)g.removeCue(g.cues[f]);p==="disabled"&&(g.mode=p)}function H(g,p,f){var h=g.mode;if(h==="disabled"&&(g.mode="hidden"),g.cues&&g.cues.length>0)for(var o=I(g.cues,p,f),d=0;d<o.length;d++)g.removeCue(o[d]);h==="disabled"&&(g.mode=h)}function D(g,p){if(p<g[0].startTime)return 0;var f=g.length-1;if(p>g[f].endTime)return-1;for(var h=0,o=f;h<=o;){var d=Math.floor((o+h)/2);if(p<g[d].startTime)o=d-1;else if(p>g[d].startTime&&h<f)h=d+1;else return d}return g[h].startTime-p<p-g[o].startTime?h:o}function I(g,p,f){var h=[],o=D(g,p);if(o>-1)for(var d=o,s=g.length;d<s;d++){var a=g[d];if(a.startTime>=p&&a.endTime<=f)h.push(a);else if(a.startTime>f)return h}return h}},"./src/utils/time-ranges.ts":function(oe,J,k){"use strict";k.r(J);var $={toString:function(B){for(var G="",H=B.length,D=0;D<H;D++)G+="["+B.start(D).toFixed(3)+","+B.end(D).toFixed(3)+"]";return G}};J.default=$},"./src/utils/timescale-conversion.ts":function(oe,J,k){"use strict";k.r(J),k.d(J,"toTimescaleFromBase",function(){return F}),k.d(J,"toTimescaleFromScale",function(){return B}),k.d(J,"toMsFromMpegTsClock",function(){return G}),k.d(J,"toMpegTsClockFromTimescale",function(){return H});var $=9e4;function F(D,I,g,p){g===void 0&&(g=1),p===void 0&&(p=!1);var f=D*I*g;return p?Math.round(f):f}function B(D,I,g,p){return g===void 0&&(g=1),p===void 0&&(p=!1),F(D,I,1/g,p)}function G(D,I){return I===void 0&&(I=!1),F(D,1e3,1/$,I)}function H(D,I){return I===void 0&&(I=1),F(D,$,1/I)}},"./src/utils/typed-array.ts":function(oe,J,k){"use strict";k.r(J),k.d(J,"sliceUint8",function(){return $});function $(F,B,G){return Uint8Array.prototype.slice?F.slice(B,G):new Uint8Array(Array.prototype.slice.call(F,B,G))}},"./src/utils/vttcue.ts":function(oe,J,k){"use strict";k.r(J),J.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var $=["","lr","rl"],F=["start","middle","end","left","right"];function B(g,p){if(typeof p!="string")return!1;if(!Array.isArray(g))return!1;var f=p.toLowerCase();return~g.indexOf(f)?f:!1}function G(g){return B($,g)}function H(g){return B(F,g)}function D(g){for(var p=arguments.length,f=new Array(p>1?p-1:0),h=1;h<p;h++)f[h-1]=arguments[h];for(var o=1;o<arguments.length;o++){var d=arguments[o];for(var s in d)g[s]=d[s]}return g}function I(g,p,f){var h=this,o={enumerable:!0};h.hasBeenReset=!1;var d="",s=!1,a=g,l=p,c=f,R=null,w="",x=!0,O="auto",A="start",T=50,E="middle",b=50,u="middle";Object.defineProperty(h,"id",D({},o,{get:function(){return d},set:function(m){d=""+m}})),Object.defineProperty(h,"pauseOnExit",D({},o,{get:function(){return s},set:function(m){s=!!m}})),Object.defineProperty(h,"startTime",D({},o,{get:function(){return a},set:function(m){if(typeof m!="number")throw new TypeError("Start time must be set to a number.");a=m,this.hasBeenReset=!0}})),Object.defineProperty(h,"endTime",D({},o,{get:function(){return l},set:function(m){if(typeof m!="number")throw new TypeError("End time must be set to a number.");l=m,this.hasBeenReset=!0}})),Object.defineProperty(h,"text",D({},o,{get:function(){return c},set:function(m){c=""+m,this.hasBeenReset=!0}})),Object.defineProperty(h,"region",D({},o,{get:function(){return R},set:function(m){R=m,this.hasBeenReset=!0}})),Object.defineProperty(h,"vertical",D({},o,{get:function(){return w},set:function(m){var v=G(m);if(v===!1)throw new SyntaxError("An invalid or illegal string was specified.");w=v,this.hasBeenReset=!0}})),Object.defineProperty(h,"snapToLines",D({},o,{get:function(){return x},set:function(m){x=!!m,this.hasBeenReset=!0}})),Object.defineProperty(h,"line",D({},o,{get:function(){return O},set:function(m){if(typeof m!="number"&&m!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");O=m,this.hasBeenReset=!0}})),Object.defineProperty(h,"lineAlign",D({},o,{get:function(){return A},set:function(m){var v=H(m);if(!v)throw new SyntaxError("An invalid or illegal string was specified.");A=v,this.hasBeenReset=!0}})),Object.defineProperty(h,"position",D({},o,{get:function(){return T},set:function(m){if(m<0||m>100)throw new Error("Position must be between 0 and 100.");T=m,this.hasBeenReset=!0}})),Object.defineProperty(h,"positionAlign",D({},o,{get:function(){return E},set:function(m){var v=H(m);if(!v)throw new SyntaxError("An invalid or illegal string was specified.");E=v,this.hasBeenReset=!0}})),Object.defineProperty(h,"size",D({},o,{get:function(){return b},set:function(m){if(m<0||m>100)throw new Error("Size must be between 0 and 100.");b=m,this.hasBeenReset=!0}})),Object.defineProperty(h,"align",D({},o,{get:function(){return u},set:function(m){var v=H(m);if(!v)throw new SyntaxError("An invalid or illegal string was specified.");u=v,this.hasBeenReset=!0}})),h.displayState=void 0}return I.prototype.getCueAsHTML=function(){var g=self.WebVTT;return g.convertCueToDOMTree(self,this.text)},I}()},"./src/utils/vttparser.ts":function(oe,J,k){"use strict";k.r(J),k.d(J,"parseTimeStamp",function(){return B}),k.d(J,"fixLineBreaks",function(){return p}),k.d(J,"VTTParser",function(){return f});var $=k("./src/utils/vttcue.ts"),F=function(){function h(){}var o=h.prototype;return o.decode=function(s,a){if(!s)return"";if(typeof s!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(s))},h}();function B(h){function o(s,a,l,c){return(s|0)*3600+(a|0)*60+(l|0)+parseFloat(c||0)}var d=h.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return d?parseFloat(d[2])>59?o(d[2],d[3],0,d[4]):o(d[1],d[2],d[3],d[4]):null}var G=function(){function h(){this.values=Object.create(null)}var o=h.prototype;return o.set=function(s,a){!this.get(s)&&a!==""&&(this.values[s]=a)},o.get=function(s,a,l){return l?this.has(s)?this.values[s]:a[l]:this.has(s)?this.values[s]:a},o.has=function(s){return s in this.values},o.alt=function(s,a,l){for(var c=0;c<l.length;++c)if(a===l[c]){this.set(s,a);break}},o.integer=function(s,a){/^-?\d+$/.test(a)&&this.set(s,parseInt(a,10))},o.percent=function(s,a){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(a)){var l=parseFloat(a);if(l>=0&&l<=100)return this.set(s,l),!0}return!1},h}();function H(h,o,d,s){var a=s?h.split(s):[h];for(var l in a){if(typeof a[l]!="string")continue;var c=a[l].split(d);if(c.length!==2)continue;var R=c[0],w=c[1];o(R,w)}}var D=new $.default(0,0,""),I=D.align==="middle"?"middle":"center";function g(h,o,d){var s=h;function a(){var R=B(h);if(R===null)throw new Error("Malformed timestamp: "+s);return h=h.replace(/^[^\sa-zA-Z-]+/,""),R}function l(R,w){var x=new G;H(R,function(T,E){var b;switch(T){case"region":for(var u=d.length-1;u>=0;u--)if(d[u].id===E){x.set(T,d[u].region);break}break;case"vertical":x.alt(T,E,["rl","lr"]);break;case"line":b=E.split(","),x.integer(T,b[0]),x.percent(T,b[0])&&x.set("snapToLines",!1),x.alt(T,b[0],["auto"]),b.length===2&&x.alt("lineAlign",b[1],["start",I,"end"]);break;case"position":b=E.split(","),x.percent(T,b[0]),b.length===2&&x.alt("positionAlign",b[1],["start",I,"end","line-left","line-right","auto"]);break;case"size":x.percent(T,E);break;case"align":x.alt(T,E,["start",I,"end","left","right"]);break}},/:/,/\s/),w.region=x.get("region",null),w.vertical=x.get("vertical","");var O=x.get("line","auto");O==="auto"&&D.line===-1&&(O=-1),w.line=O,w.lineAlign=x.get("lineAlign","start"),w.snapToLines=x.get("snapToLines",!0),w.size=x.get("size",100),w.align=x.get("align",I);var A=x.get("position","auto");A==="auto"&&D.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(),o.startTime=a(),c(),h.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+s);h=h.substr(3),c(),o.endTime=a(),c(),l(h,o)}function p(h){return h.replace(/<br(?: \/)?>/gi,`
`)}var f=function(){function h(){this.state="INITIAL",this.buffer="",this.decoder=new F,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var o=h.prototype;return o.parse=function(s){var a=this;s&&(a.buffer+=a.decoder.decode(s,{stream:!0}));function l(){var A=a.buffer,T=0;for(A=p(A);T<A.length&&A[T]!=="\r"&&A[T]!==`
`;)++T;var E=A.substr(0,T);return A[T]==="\r"&&++T,A[T]===`
`&&++T,a.buffer=A.substr(T),E}function c(A){H(A,function(T,E){},/:/)}try{var R="";if(a.state==="INITIAL"){if(!/\r\n|\n/.test(a.buffer))return this;R=l();var w=R.match(/^()?WEBVTT([ \t].*)?$/);if(!w||!w[0])throw new Error("Malformed WebVTT signature.");a.state="HEADER"}for(var x=!1;a.buffer;){if(!/\r\n|\n/.test(a.buffer))return this;x?x=!1:R=l();switch(a.state){case"HEADER":/:/.test(R)?c(R):R||(a.state="ID");continue;case"NOTE":R||(a.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(R)){a.state="NOTE";break}if(!R)continue;if(a.cue=new $.default(0,0,""),a.state="CUE",R.indexOf("-->")===-1){a.cue.id=R;continue}case"CUE":if(!a.cue){a.state="BADCUE";continue}try{g(R,a.cue,a.regionList)}catch(A){a.cue=null,a.state="BADCUE";continue}a.state="CUETEXT";continue;case"CUETEXT":{var O=R.indexOf("-->")!==-1;if(!R||O&&(x=!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+=R}continue;case"BADCUE":R||(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},o.flush=function(){var s=this;try{if((s.cue||s.state==="HEADER")&&(s.buffer+=`
`,s.parse()),s.state==="INITIAL"||s.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(a){s.onparsingerror&&s.onparsingerror(a)}return s.onflush&&s.onflush(),this},h}()},"./src/utils/webvtt-parser.ts":function(oe,J,k){"use strict";k.r(J),k.d(J,"generateCueId",function(){return f}),k.d(J,"parseWebVTT",function(){return o});var $=k("./src/polyfills/number.ts"),F=k("./src/utils/vttparser.ts"),B=k("./src/demux/id3.ts"),G=k("./src/utils/timescale-conversion.ts"),H=k("./src/remux/mp4-remuxer.ts"),D=/\r\n|\n\r|\n|\r/g,I=function(s,a,l){return l===void 0&&(l=0),s.substr(l,a.length)===a},g=function(s){var a=parseInt(s.substr(-3)),l=parseInt(s.substr(-6,2)),c=parseInt(s.substr(-9,2)),R=s.length>9?parseInt(s.substr(0,s.indexOf(":"))):0;if(!Object($.isFiniteNumber)(a)||!Object($.isFiniteNumber)(l)||!Object($.isFiniteNumber)(c)||!Object($.isFiniteNumber)(R))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+s);return a+=1e3*l,a+=60*1e3*c,a+=60*60*1e3*R,a},p=function(s){for(var a=5381,l=s.length;l;)a=a*33^s.charCodeAt(--l);return(a>>>0).toString()};function f(d,s,a){return p(d.toString())+p(s.toString())+p(a)}var h=function(s,a,l){var c=s[a],R=s[c.prevCC];if(!R||!R.new&&c.new){s.ccOffset=s.presentationOffset=c.start,c.new=!1;return}for(;(w=R)!==null&&w!==void 0&&w.new;){var w;s.ccOffset+=c.start-R.start,c.new=!1,c=R,R=s[c.prevCC]}s.presentationOffset=l};function o(d,s,a,l,c,R,w,x){var O=new F.VTTParser,A=Object(B.utf8ArrayToStr)(new Uint8Array(d)).trim().replace(D,`
`).split(`
`),T=[],E=Object(G.toMpegTsClockFromTimescale)(s,a),b="00:00.000",u=0,_=0,m,v=!0,M=!1;O.oncue=function(P){var K=l[c],V=l.ccOffset,U=(u-E)/9e4;if(K!=null&&K.new&&(_!==void 0?V=l.ccOffset=K.start:h(l,c,U)),U&&(V=U-l.presentationOffset),M){var S=P.endTime-P.startTime,X=Object(H.normalizePts)((P.startTime+V-_)*9e4,R*9e4)/9e4;P.startTime=X,P.endTime=X+S}var ee=P.text.trim();P.text=decodeURIComponent(encodeURIComponent(ee)),P.id||(P.id=f(P.startTime,P.endTime,ee)),P.endTime>0&&T.push(P)},O.onparsingerror=function(P){m=P},O.onflush=function(){if(m){x(m);return}w(T)},A.forEach(function(P){if(v)if(I(P,"X-TIMESTAMP-MAP=")){v=!1,M=!0,P.substr(16).split(",").forEach(function(K){I(K,"LOCAL:")?b=K.substr(6):I(K,"MPEGTS:")&&(u=parseInt(K.substr(7)))});try{_=g(b)/1e3}catch(K){M=!1,m=K}return}else P===""&&(v=!1);O.parse(P+`
`)}),O.flush()}},"./src/utils/xhr-loader.ts":function(oe,J,k){"use strict";k.r(J);var $=k("./src/utils/logger.ts"),F=k("./src/loader/load-stats.ts"),B=/^age:\s*[\d.]+\s*$/m,G=function(){function H(I){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=I?I.xhrSetup:null,this.stats=new F.LoadStats,this.retryDelay=0}var D=H.prototype;return D.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},D.abortInternal=function(){var g=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),g&&(g.onreadystatechange=null,g.onprogress=null,g.readyState!==4&&(this.stats.aborted=!0,g.abort()))},D.abort=function(){var g;this.abortInternal(),(g=this.callbacks)!==null&&g!==void 0&&g.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},D.load=function(g,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=g,this.config=p,this.callbacks=f,this.retryDelay=p.retryDelay,this.loadInternal()},D.loadInternal=function(){var g=this.config,p=this.context;if(!g)return;var f=this.loader=new self.XMLHttpRequest,h=this.stats;h.loading.first=0,h.loaded=0;var o=this.xhrSetup;try{if(o)try{o(f,p.url)}catch(a){f.open("GET",p.url,!0),o(f,p.url)}f.readyState||f.open("GET",p.url,!0);var d=this.context.headers;if(d)for(var s in d)f.setRequestHeader(s,d[s])}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),g.timeout),f.send()},D.readystatechange=function(){var g=this.context,p=this.loader,f=this.stats;if(!g||!p)return;var h=p.readyState,o=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 d=p.status;if(d>=200&&d<300){f.loading.end=Math.max(self.performance.now(),f.loading.first);var s,a;if(g.responseType==="arraybuffer"?(s=p.response,a=s.byteLength):(s=p.responseText,a=s.length),f.loaded=f.total=a,!this.callbacks)return;var l=this.callbacks.onProgress;if(l&&l(f,g,s,p),!this.callbacks)return;var c={url:p.responseURL,data:s};this.callbacks.onSuccess(c,f,g,p)}else f.retry>=o.maxRetry||d>=400&&d<499?($.logger.error(d+" while loading "+g.url),this.callbacks.onError({code:d,text:p.statusText},g,p)):($.logger.warn(d+" while loading "+g.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,o.maxRetryDelay),f.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),o.timeout)},D.loadtimeout=function(){$.logger.warn("timeout while loading "+this.context.url);var g=this.callbacks;g&&(this.abortInternal(),g.onTimeout(this.stats,this.context,this.loader))},D.loadprogress=function(g){var p=this.stats;p.loaded=g.loaded,g.lengthComputable&&(p.total=g.total)},D.getCacheAge=function(){var g=null;if(this.loader&&B.test(this.loader.getAllResponseHeaders())){var p=this.loader.getResponseHeader("age");g=p?parseFloat(p):null}return g},H}();J.default=G}}).default})},vHTk:function(yt,at,ne){yt.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}}}]);