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.
368 lines
951 KiB
368 lines
951 KiB
(window.webpackJsonp=window.webpackJsonp||[]).push([[73,5,7],{"+NIl":function(Ct,st,ne){(function(oe){oe(ne("VrN/"))})(function(oe){"use strict";oe.defineMode("stex",function(Z,k){"use strict";function Y(L,A){L.cmdState.push(A)}function P(L){return L.cmdState.length>0?L.cmdState[L.cmdState.length-1]:null}function I(L){var A=L.cmdState.pop();A&&A.closeBracket()}function H(L){for(var A=L.cmdState,C=A.length-1;C>=0;C--){var d=A[C];if(d.name=="DEFAULT")continue;return d}return{styleIdentifier:function(){return null}}}function U(L,A,C){return function(){this.name=L,this.bracketNo=0,this.style=A,this.styles=C,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var O={};O.importmodule=U("importmodule","tag",["string","builtin"]),O.documentclass=U("documentclass","tag",["","atom"]),O.usepackage=U("usepackage","tag",["atom"]),O.begin=U("begin","tag",["atom"]),O.end=U("end","tag",["atom"]),O.label=U("label","tag",["atom"]),O.ref=U("ref","tag",["atom"]),O.eqref=U("eqref","tag",["atom"]),O.cite=U("cite","tag",["atom"]),O.bibitem=U("bibitem","tag",["atom"]),O.Bibitem=U("Bibitem","tag",["atom"]),O.RBibitem=U("RBibitem","tag",["atom"]),O.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function R(L,A){L.f=A}function y(L,A){var C;if(L.match(/^\\[a-zA-Z@]+/)){var d=L.current().slice(1);return C=O.hasOwnProperty(d)?O[d]:O.DEFAULT,C=new C,Y(A,C),R(A,_),C.style}if(L.match(/^\\[$&%#{}_]/))return"tag";if(L.match(/^\\[,;!\/\\]/))return"tag";if(L.match("\\["))return R(A,function(l,h){return w(l,h,"\\]")}),"keyword";if(L.match("\\("))return R(A,function(l,h){return w(l,h,"\\)")}),"keyword";if(L.match("$$"))return R(A,function(l,h){return w(l,h,"$$")}),"keyword";if(L.match("$"))return R(A,function(l,h){return w(l,h,"$")}),"keyword";var o=L.next();if(o=="%")return L.skipToEnd(),"comment";if(o=="}"||o=="]"){if(C=P(A),C)C.closeBracket(o),R(A,_);else return"error";return"bracket"}else return o=="{"||o=="["?(C=O.DEFAULT,C=new C,Y(A,C),"bracket"):/\d/.test(o)?(L.eatWhile(/[\w.%]/),"atom"):(L.eatWhile(/[\w\-_]/),C=H(A),C.name=="begin"&&(C.argument=L.current()),C.styleIdentifier())}function w(L,A,C){if(L.eatSpace())return null;if(C&&L.match(C))return R(A,y),"keyword";if(L.match(/^\\[a-zA-Z@]+/))return"tag";if(L.match(/^[a-zA-Z]+/))return"variable-2";if(L.match(/^\\[$&%#{}_]/))return"tag";if(L.match(/^\\[,;!\/]/))return"tag";if(L.match(/^[\^_&]/))return"tag";if(L.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(L.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var d=L.next();return d=="{"||d=="}"||d=="["||d=="]"||d=="("||d==")"?"bracket":d=="%"?(L.skipToEnd(),"comment"):"error"}function _(L,A){var C=L.peek(),d;return C=="{"||C=="["?(d=P(A),d.openBracket(C),L.eat(C),R(A,y),"bracket"):/[ \t\r]/.test(C)?(L.eat(C),null):(R(A,y),I(A),y(L,A))}return{startState:function(){var L=k.inMathMode?function(A,C){return w(A,C)}:y;return{cmdState:[],f:L}},copyState:function(L){return{cmdState:L.cmdState.slice(),f:L.f}},token:function(L,A){return A.f(L,A)},blankLine:function(L){L.f=y,L.cmdState.length=0},lineComment:"%"}}),oe.defineMIME("text/x-stex","stex"),oe.defineMIME("text/x-latex","stex")})},"19Vz":function(Ct,st,ne){(function(oe){oe(ne("VrN/"))})(function(oe){oe.defineOption("placeholder","",function(U,O,R){var y=R&&R!=oe.Init;if(O&&!y)U.on("blur",P),U.on("change",I),U.on("swapDoc",I),oe.on(U.getInputField(),"compositionupdate",U.state.placeholderCompose=function(){Y(U)}),I(U);else if(!O&&y){U.off("blur",P),U.off("change",I),U.off("swapDoc",I),oe.off(U.getInputField(),"compositionupdate",U.state.placeholderCompose),Z(U);var w=U.getWrapperElement();w.className=w.className.replace(" CodeMirror-empty","")}O&&!U.hasFocus()&&P(U)});function Z(U){U.state.placeholder&&(U.state.placeholder.parentNode.removeChild(U.state.placeholder),U.state.placeholder=null)}function k(U){Z(U);var O=U.state.placeholder=document.createElement("pre");O.style.cssText="height: 0; overflow: visible",O.style.direction=U.getOption("direction"),O.className="CodeMirror-placeholder CodeMirror-line-like";var R=U.getOption("placeholder");typeof R=="string"&&(R=document.createTextNode(R)),O.appendChild(R),U.display.lineSpace.insertBefore(O,U.display.lineSpace.firstChild)}function Y(U){setTimeout(function(){var O=!1,R=U.getInputField();R.nodeName=="TEXTAREA"?O=!R.value:U.lineCount()==1&&(O=!/[^\u200b]/.test(R.querySelector(".CodeMirror-line").textContent)),O?k(U):Z(U)},20)}function P(U){H(U)&&k(U)}function I(U){var O=U.getWrapperElement(),R=H(U);O.className=O.className.replace(" CodeMirror-empty","")+(R?" CodeMirror-empty":""),R?k(U):Z(U)}function H(U){return U.lineCount()===1&&U.getLine(0)===""}})},"1eCo":function(Ct,st,ne){(function(oe){oe(ne("VrN/"))})(function(oe){"use strict";var Z={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},k={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};oe.defineMode("xml",function(Y,P){var I=Y.indentUnit,H={},U=P.htmlMode?Z:k;for(var O in U)H[O]=U[O];for(var O in P)H[O]=P[O];var R,y;function w(a,x){function b(G){return x.tokenize=G,G(a,x)}var v=a.next();if(v=="<")return a.eat("!")?a.eat("[")?a.match("CDATA[")?b(A("atom","]]>")):null:a.match("--")?b(A("comment","-->")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),b(C(1))):null:a.eat("?")?(a.eatWhile(/[\w\._\-]/),x.tokenize=A("meta","?>"),"meta"):(R=a.eat("/")?"closeTag":"openTag",x.tokenize=_,"tag bracket");if(v=="&"){var M;return a.eat("#")?a.eat("x")?M=a.eatWhile(/[a-fA-F\d]/)&&a.eat(";"):M=a.eatWhile(/[\d]/)&&a.eat(";"):M=a.eatWhile(/[\w\.\-:]/)&&a.eat(";"),M?"atom":"error"}else return a.eatWhile(/[^&<]/),null}w.isInText=!0;function _(a,x){var b=a.next();if(b==">"||b=="/"&&a.eat(">"))return x.tokenize=w,R=b==">"?"endTag":"selfcloseTag","tag bracket";if(b=="=")return R="equals",null;if(b=="<"){x.tokenize=w,x.state=h,x.tagName=x.tagStart=null;var v=x.tokenize(a,x);return v?v+" tag error":"tag error"}else return/[\'\"]/.test(b)?(x.tokenize=L(b),x.stringStartCol=a.column(),x.tokenize(a,x)):(a.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function L(a){var x=function(b,v){for(;!b.eol();)if(b.next()==a){v.tokenize=_;break}return"string"};return x.isInAttribute=!0,x}function A(a,x){return function(b,v){for(;!b.eol();){if(b.match(x)){v.tokenize=w;break}b.next()}return a}}function C(a){return function(x,b){for(var v;(v=x.next())!=null;){if(v=="<")return b.tokenize=C(a+1),b.tokenize(x,b);if(v==">")if(a==1){b.tokenize=w;break}else return b.tokenize=C(a-1),b.tokenize(x,b)}return"meta"}}function d(a,x,b){this.prev=a.context,this.tagName=x,this.indent=a.indented,this.startOfLine=b,(H.doNotIndent.hasOwnProperty(x)||a.context&&a.context.noIndent)&&(this.noIndent=!0)}function o(a){a.context&&(a.context=a.context.prev)}function l(a,x){for(var b;;){if(!a.context)return;if(b=a.context.tagName,!H.contextGrabbers.hasOwnProperty(b)||!H.contextGrabbers[b].hasOwnProperty(x))return;o(a)}}function h(a,x,b){return a=="openTag"?(b.tagStart=x.column(),T):a=="closeTag"?f:h}function T(a,x,b){return a=="word"?(b.tagName=x.current(),y="tag",E):H.allowMissingTagName&&a=="endTag"?(y="tag bracket",E(a,x,b)):(y="error",T)}function f(a,x,b){if(a=="word"){var v=x.current();return b.context&&b.context.tagName!=v&&H.implicitlyClosed.hasOwnProperty(b.context.tagName)&&o(b),b.context&&b.context.tagName==v||H.matchClosing===!1?(y="tag",p):(y="tag error",D)}else return H.allowMissingTagName&&a=="endTag"?(y="tag bracket",p(a,x,b)):(y="error",D)}function p(a,x,b){return a!="endTag"?(y="error",p):(o(b),h)}function D(a,x,b){return y="error",p(a,x,b)}function E(a,x,b){if(a=="word")return y="attribute",g;if(a=="endTag"||a=="selfcloseTag"){var v=b.tagName,M=b.tagStart;return b.tagName=b.tagStart=null,a=="selfcloseTag"||H.autoSelfClosers.hasOwnProperty(v)?l(b,v):(l(b,v),b.context=new d(b,v,M==b.indented)),h}return y="error",E}function g(a,x,b){return a=="equals"?c:(H.allowMissing||(y="error"),E(a,x,b))}function c(a,x,b){return a=="string"?u:a=="word"&&H.allowUnquoted?(y="string",E):(y="error",E(a,x,b))}function u(a,x,b){return a=="string"?u:E(a,x,b)}return{startState:function(a){var x={tokenize:w,state:h,indented:a||0,tagName:null,tagStart:null,context:null};return a!=null&&(x.baseIndent=a),x},token:function(a,x){if(!x.tagName&&a.sol()&&(x.indented=a.indentation()),a.eatSpace())return null;R=null;var b=x.tokenize(a,x);return(b||R)&&b!="comment"&&(y=null,x.state=x.state(R||b,a,x),y&&(b=y=="error"?b+" error":y)),b},indent:function(a,x,b){var v=a.context;if(a.tokenize.isInAttribute)return a.tagStart==a.indented?a.stringStartCol+1:a.indented+I;if(v&&v.noIndent)return oe.Pass;if(a.tokenize!=_&&a.tokenize!=w)return b?b.match(/^(\s*)/)[0].length:0;if(a.tagName)return H.multilineTagIndentPastTag!==!1?a.tagStart+a.tagName.length+2:a.tagStart+I*(H.multilineTagIndentFactor||1);if(H.alignCDATA&&/<!\[CDATA\[/.test(x))return 0;var M=x&&/^<(\/)?([\w_:\.-]*)/.exec(x);if(M&&M[1])for(;v;)if(v.tagName==M[2]){v=v.prev;break}else if(H.implicitlyClosed.hasOwnProperty(v.tagName))v=v.prev;else break;else if(M)for(;v;){var G=H.contextGrabbers[v.tagName];if(G&&G.hasOwnProperty(M[2]))v=v.prev;else break}for(;v&&v.prev&&!v.startOfLine;)v=v.prev;return v?v.indent+I:a.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:H.htmlMode?"html":"xml",helperType:H.htmlMode?"html":"xml",skipAttribute:function(a){a.state==c&&(a.state=E)},xmlCurrentTag:function(a){return a.tagName?{name:a.tagName,close:a.type=="closeTag"}:null},xmlCurrentContext:function(a){for(var x=[],b=a.context;b;b=b.prev)b.tagName&&x.push(b.tagName);return x.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(Ct,st,ne){"use strict";ne.r(st);var oe=ne("+L6B"),Z=ne("2/Rp"),k=ne("6UJt"),Y=ne("DFOY"),P=ne("/zsF"),I=ne("PArb"),H=ne("5NDa"),U=ne("5rEg"),O=ne("OaEy"),R=ne("2fM7"),y=ne("14J3"),w=ne("BMrR"),_=ne("jCWc"),L=ne("kPKH"),A=ne("sPJy"),C=ne("bE4q"),d=ne("miYZ"),o=ne("tsqr"),l=ne("k1fw"),h=ne("9og8"),T=ne("y8nQ"),f=ne("Vl3Y"),p=ne("tJVT"),D=ne("PpiC"),E=ne("B9cy"),g=ne("Ol7k"),c=ne("lUTK"),u=ne("BvKs"),a=ne("WmNS"),x=ne.n(a),b=ne("q1tI"),v=ne.n(b),M=ne("Ot1p"),G=ne("Ty5D"),X=ne("9kvl"),Q=ne("55Ip"),z=ne("gJ3r"),j=ne("m7e3"),q=ne.n(j),le=u.a.SubMenu,me=g.a.Content,be=g.a.Sider,Be=function(De){var de,pe,ae,re,we,ve,Re,Ae=De.graduation,Oe=De.globalSetting,Ee=De.loading,_e=De.user,Ie=De.dispatch,Ve=Object(D.a)(De,["graduation","globalSetting","loading","user","dispatch"]),Ue=Object(G.i)(),Fe=Object(G.h)(),Pe=_e.userInfo,et=f.a.useForm(),Je=Object(p.a)(et,1),Qe=Je[0],$e=Ae.addTopicData,ht=function(){var Xe=Object(h.a)(x.a.mark(function Ze(){var ke,at,it;return x.a.wrap(function(Ge){for(;;)switch(Ge.prev=Ge.next){case 0:return ke=Qe.getFieldsValue(),at=Object(l.a)({},ke),at.city&&(at.province=at.city[0],at.city=at.city[1]),Ge.next=5,Ie({type:"graduation/addTopic",payload:{coursesId:Ue.coursesId,attachment_ids:[],graduation_topic:at}});case 5:it=Ge.sent,it.status?o.b.error(it.message):X.d.push("/classrooms/".concat(Ue.coursesId,"/graduation_topics/").concat(Ue.categoryId));case 7:case"end":return Ge.stop()}},Ze)}));return function(){return Xe.apply(this,arguments)}}();return Object(b.useEffect)(function(){Ie({type:"graduation/addTopicDefaultData",payload:Object(l.a)({},Ue)})},[Ue.coursesId]),v.a.createElement("section",{className:"edu-container"},v.a.createElement("section",{className:"animated fadeIn"},v.a.createElement("aside",{className:"mt10"},Pe&&v.a.createElement(C.a,{separator:">"},v.a.createElement(C.a.Item,null,v.a.createElement(Q.a,{to:"".concat(Pe.first_category_url)},Pe==null||((de=Pe.course)===null||de===void 0)?void 0:de.course_name)),v.a.createElement(C.a.Item,null,v.a.createElement(Q.a,{to:"/classrooms/".concat(Ue.coursesId,"/graduation_topics/").concat(Ue.categoryId)},"\u6BD5\u8BBE\u9009\u9898")),v.a.createElement(C.a.Item,null,"\u65B0\u5EFA"))),v.a.createElement("aside",{className:[q.a.title,"mt20"].join(" ")},v.a.createElement(w.a,{style:{width:"100%"}},v.a.createElement(L.a,{flex:"1"},v.a.createElement("strong",{className:"font20 ml5"},"\u65B0\u5EFA\u6BD5\u8BBE\u9009\u9898")),v.a.createElement(L.a,null,v.a.createElement(Q.a,{className:"font16 c-light-black",to:"/classrooms/".concat(Ue.coursesId,"/exercise")},"\u8FD4\u56DE"))))),v.a.createElement("section",{className:[q.a.bg,"pt30","pl30","pr30","pb30","mt20"].join(" ")},v.a.createElement(f.a,{layout:"vertical",form:Qe,scrollToFirstError:!0,onFinish:function(){var Xe=Object(h.a)(x.a.mark(function Ze(ke){return x.a.wrap(function(it){for(;;)switch(it.prev=it.next){case 0:ht();case 1:case"end":return it.stop()}},Ze)}));return function(Ze){return Xe.apply(this,arguments)}}()},v.a.createElement(f.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(R.a,{size:"large",placeholder:"\u8BF7\u9009\u62E9\u6307\u5BFC\u8001\u5E08",style:{width:200}},(pe=$e.teacher_list)===null||pe===void 0?void 0:pe.map(function(Xe,Ze){return v.a.createElement(R.a.Option,{value:Xe.id,key:Ze},Xe.name)}))),v.a.createElement(f.a.Item,{name:"name",label:"\u9009\u9898\u540D\u79F0\uFF1A",rules:[{required:!0,message:"\u8BF7\u586B\u5199\u8BD5\u5377\u6807\u9898"}]},v.a.createElement(U.a,{maxLength:60,size:"large",placeholder:"\u8BD5\u5377\u6807\u9898\uFF0C\u6700\u5927\u9650\u523660\u4E2A\u5B57\u7B26"})),v.a.createElement(I.a,null),v.a.createElement(f.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(w.a,{gutter:[20,0]},v.a.createElement(L.a,{flex:"1"},v.a.createElement(f.a.Item,{name:"topic_type"},v.a.createElement(R.a,{size:"large",placeholder:"\u8BF7\u9009\u62E9\u9009\u9898\u7C7B\u578B"},(ae=$e.topic_type)===null||ae===void 0?void 0:ae.map(function(Xe,Ze){return v.a.createElement(R.a.Option,{value:Xe.id,key:Ze},Xe.name)})))),v.a.createElement(L.a,{flex:"1"},v.a.createElement(f.a.Item,{name:"topic_source"},v.a.createElement(R.a,{size:"large",placeholder:"\u8BF7\u9009\u62E9\u9009\u9898\u6765\u6E90"},(re=$e.topic_source)===null||re===void 0?void 0:re.map(function(Xe,Ze){return v.a.createElement(R.a.Option,{value:Xe.id,key:Ze},Xe.name)})))),v.a.createElement(L.a,{flex:"1"},v.a.createElement(f.a.Item,{name:"topic_property_first"},v.a.createElement(R.a,{size:"large",placeholder:"\u8BF7\u9009\u62E9\u9009\u9898\u6027\u8D281"},(we=$e.topic_property_first)===null||we===void 0?void 0:we.map(function(Xe,Ze){return v.a.createElement(R.a.Option,{value:Xe.id,key:Ze},Xe.name)})))),v.a.createElement(L.a,{flex:"1"},v.a.createElement(f.a.Item,{name:"topic_property_second"},v.a.createElement(R.a,{size:"large",placeholder:"\u8BF7\u9009\u62E9\u9009\u9898\u6027\u8D282"},(ve=$e.topic_property_second)===null||ve===void 0?void 0:ve.map(function(Xe,Ze){return v.a.createElement(R.a.Option,{value:Xe.id,key:Ze},Xe.name)})))),v.a.createElement(L.a,{flex:"150px"})),v.a.createElement(I.a,null),v.a.createElement(f.a.Item,{name:"source_unit",label:"\u9009\u9898\u6765\u6E90\u5355\u4F4D\uFF1A"},v.a.createElement(U.a,{width:"200",size:"large",style:{width:200},placeholder:"\u8BF7\u586B\u5199\u6765\u6E90\u5355\u4F4D"})),v.a.createElement(f.a.Item,{name:"topic_repeat",label:"\u9009\u9898\u91CD\u590D\u60C5\u51B5\uFF1A"},v.a.createElement(R.a,{size:"large",placeholder:"\u8BF7\u9009\u62E9\u91CD\u590D\u60C5\u51B5",style:{width:200}},(Re=$e.topic_repeat)===null||Re===void 0?void 0:Re.map(function(Xe,Ze){return v.a.createElement(R.a.Option,{value:Xe.id,key:Ze},Xe.name)}))),v.a.createElement(f.a.Item,{name:"city",label:"\u8C03\u7814\u6216\u5B9E\u4E60\u5730\u70B9\uFF1A"},v.a.createElement(Y.a,{size:"large",style:{width:200},options:z.a,placeholder:"\u8BF7\u9009\u62E9\u6240\u5728\u5730"})))),v.a.createElement("aside",{className:q.a.btns},v.a.createElement(Z.a,{type:"primary",onClick:function(){Qe.submit()}},"\u4FDD\u5B58"),v.a.createElement(Q.a,{to:"/classrooms/".concat(Ue.coursesId,"/graduation_topics/").concat(Ue.categoryId)},"\u53D6\u6D88")))};st.default=Object(X.a)(function(Le){var De=Le.graduation,de=Le.loading,pe=Le.user,ae=Le.globalSetting;return{graduation:De,globalSetting:ae,user:pe,loading:de.effects}})(Be)},"55Ip":function(Ct,st,ne){"use strict";ne.d(st,"a",function(){return l}),ne.d(st,"b",function(){return E});var oe=ne("Ty5D"),Z=ne("dI71"),k=ne("q1tI"),Y=ne.n(k),P=ne("YS25"),I=ne("17x9"),H=ne.n(I),U=ne("wx14"),O=ne("zLVn"),R=ne("9R94"),y=function(c){Object(Z.a)(u,c);function u(){for(var x,b=arguments.length,v=new Array(b),M=0;M<b;M++)v[M]=arguments[M];return x=c.call.apply(c,[this].concat(v))||this,x.history=Object(P.a)(x.props),x}var a=u.prototype;return a.render=function(){return Y.a.createElement(oe.c,{history:this.history,children:this.props.children})},u}(Y.a.Component),w=function(c){Object(Z.a)(u,c);function u(){for(var x,b=arguments.length,v=new Array(b),M=0;M<b;M++)v[M]=arguments[M];return x=c.call.apply(c,[this].concat(v))||this,x.history=Object(P.b)(x.props),x}var a=u.prototype;return a.render=function(){return Y.a.createElement(oe.c,{history:this.history,children:this.props.children})},u}(Y.a.Component),_=function(u,a){return typeof u=="function"?u(a):u},L=function(u,a){return typeof u=="string"?Object(P.c)(u,null,null,a):u},A=function(u){return u},C=Y.a.forwardRef;typeof C=="undefined"&&(C=A);function d(c){return!!(c.metaKey||c.altKey||c.ctrlKey||c.shiftKey)}var o=C(function(c,u){var a=c.innerRef,x=c.navigate,b=c.onClick,v=Object(O.a)(c,["innerRef","navigate","onClick"]),M=v.target,G=Object(U.a)({},v,{onClick:function(Q){try{b&&b(Q)}catch(z){throw Q.preventDefault(),z}!Q.defaultPrevented&&Q.button===0&&(!M||M==="_self")&&!d(Q)&&(Q.preventDefault(),x())}});return A!==C?G.ref=u||a:G.ref=a,Y.a.createElement("a",G)}),l=C(function(c,u){var a=c.component,x=a===void 0?o:a,b=c.replace,v=c.to,M=c.innerRef,G=Object(O.a)(c,["component","replace","to","innerRef"]);return Y.a.createElement(oe.e.Consumer,null,function(X){X||Object(R.a)(!1);var Q=X.history,z=L(_(v,X.location),X.location),j=z?Q.createHref(z):"",q=Object(U.a)({},G,{href:j,navigate:function(){var me=_(v,X.location),be=b?Q.replace:Q.push;be(me)}});return A!==C?q.ref=u||M:q.innerRef=M,Y.a.createElement(x,q)})});if(!1)var h,T;var f=function(u){return u},p=Y.a.forwardRef;typeof p=="undefined"&&(p=f);function D(){for(var c=arguments.length,u=new Array(c),a=0;a<c;a++)u[a]=arguments[a];return u.filter(function(x){return x}).join(" ")}var E=p(function(c,u){var a=c["aria-current"],x=a===void 0?"page":a,b=c.activeClassName,v=b===void 0?"active":b,M=c.activeStyle,G=c.className,X=c.exact,Q=c.isActive,z=c.location,j=c.sensitive,q=c.strict,le=c.style,me=c.to,be=c.innerRef,Be=Object(O.a)(c,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return Y.a.createElement(oe.e.Consumer,null,function(Le){Le||Object(R.a)(!1);var De=z||Le.location,de=L(_(me,De),De),pe=de.pathname,ae=pe&&pe.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),re=ae?Object(oe.f)(De.pathname,{path:ae,exact:X,sensitive:j,strict:q}):null,we=!!(Q?Q(re,De):re),ve=we?D(G,v):G,Re=we?Object(U.a)({},le,{},M):le,Ae=Object(U.a)({"aria-current":we&&x||null,className:ve,style:Re,to:de},Be);return f!==p?Ae.ref=u||be:Ae.innerRef=be,Y.a.createElement(l,Ae)})});if(!1)var g},"7Cbv":function(Ct,st,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),Z=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(Z)}var Y=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function P(_){return typeof _=="string"&&Y.test(_)}for(var I=P,H=[],U=0;U<256;++U)H.push((U+256).toString(16).substr(1));function O(_){var L=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,A=(H[_[L+0]]+H[_[L+1]]+H[_[L+2]]+H[_[L+3]]+"-"+H[_[L+4]]+H[_[L+5]]+"-"+H[_[L+6]]+H[_[L+7]]+"-"+H[_[L+8]]+H[_[L+9]]+"-"+H[_[L+10]]+H[_[L+11]]+H[_[L+12]]+H[_[L+13]]+H[_[L+14]]+H[_[L+15]]).toLowerCase();if(!I(A))throw TypeError("Stringified UUID is invalid");return A}var R=O;function y(_,L,A){_=_||{};var C=_.random||(_.rng||k)();if(C[6]=C[6]&15|64,C[8]=C[8]&63|128,L){A=A||0;for(var d=0;d<16;++d)L[A+d]=C[d];return L}return R(C)}var w=st.a=y},"7ahc":function(Ct,st,ne){"use strict";ne.d(st,"a",function(){return T});var oe=ne("k1fw"),Z=ne("0Owb"),k=ne("+L6B"),Y=ne("2/Rp"),P=ne("y8nQ"),I=ne("Vl3Y"),H=ne("tJVT"),U=ne("OaEy"),O=ne("2fM7"),R=ne("q1tI"),y=ne.n(R),w=ne("VrN/"),_=ne.n(w),L=ne("p77/"),A=ne.n(L),C=ne("c5Ni"),d=ne.n(C),o=O.a.Option,l={labelCol:{span:4},wrapperCol:{span:20}},h={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"]};st.b=function(f){var p=f.callback,D=f.onCancel,E=Object(R.useState)("python"),g=Object(H.a)(E,2),c=g[0],u=g[1];function a(b){u(h[b][1])}function x(b){p(b)}return y.a.createElement(I.a,Object(Z.a)({},l,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:x}),y.a.createElement(I.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},y.a.createElement(O.a,{onChange:a},Object.keys(h).map(function(b){return y.a.createElement(o,{key:b,value:b},h[b][0])}))),y.a.createElement(I.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},y.a.createElement(T,{mode:c})),y.a.createElement("div",{className:"flex-container flex-end"},y.a.createElement(Y.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),y.a.createElement(Y.a,{type:"ghost",onClick:D},"\u53D6\u6D88")))};function T(f){var p=f.value,D=f.onChange,E=f.mode,g=f.options,c=g===void 0?{}:g,u=Object(R.useRef)(),a=Object(R.useState)(),x=Object(H.a)(a,2),b=x[0],v=x[1];return Object(R.useEffect)(function(){if(b){function M(G){var X=G.getValue();D&&D(X)}return b.on("change",M),function(){b.off("change",M)}}},[b,D]),Object(R.useEffect)(function(){b&&b.setOption("mode",E)},[b,E]),Object(R.useEffect)(function(){b&&((p!==b.getValue()||p==="")&&setTimeout(function(){b.setValue(p||" ")},300))},[b,p]),Object(R.useEffect)(function(){if(u.current&&!b){var M=_.a.fromTextArea(u.current,Object(oe.a)({mode:E,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},c));v(M)}},[u.current,b]),y.a.createElement("div",{className:"my-codemirror-container"},y.a.createElement("textarea",{ref:u}))}},"8EBN":function(Ct,st,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 Z=0;Z<oe.modeInfo.length;Z++){var k=oe.modeInfo[Z];k.mimes&&(k.mime=k.mimes[0])}oe.findModeByMIME=function(Y){Y=Y.toLowerCase();for(var P=0;P<oe.modeInfo.length;P++){var I=oe.modeInfo[P];if(I.mime==Y)return I;if(I.mimes){for(var H=0;H<I.mimes.length;H++)if(I.mimes[H]==Y)return I}}if(/\+xml$/.test(Y))return oe.findModeByMIME("application/xml");if(/\+json$/.test(Y))return oe.findModeByMIME("application/json")},oe.findModeByExtension=function(Y){Y=Y.toLowerCase();for(var P=0;P<oe.modeInfo.length;P++){var I=oe.modeInfo[P];if(I.ext){for(var H=0;H<I.ext.length;H++)if(I.ext[H]==Y)return I}}},oe.findModeByFileName=function(Y){for(var P=0;P<oe.modeInfo.length;P++){var I=oe.modeInfo[P];if(I.file&&I.file.test(Y))return I}var H=Y.lastIndexOf("."),U=H>-1&&Y.substring(H+1,Y.length);if(U)return oe.findModeByExtension(U)},oe.findModeByName=function(Y){Y=Y.toLowerCase();for(var P=0;P<oe.modeInfo.length;P++){var I=oe.modeInfo[P];if(I.name.toLowerCase()==Y)return I;if(I.alias){for(var H=0;H<I.alias.length;H++)if(I.alias[H].toLowerCase()==Y)return I}}}})},"8hTe":function(Ct,st,ne){Ct.exports={button:"button___1wy9m"}},"9Bee":function(Ct,st,ne){"use strict";var oe=ne("DYRE"),Z=ne("zeV3"),k=ne("+L6B"),Y=ne("2/Rp"),P=ne("k1fw"),I=ne("9og8"),H=ne("tJVT"),U=ne("WmNS"),O=ne.n(U),R=ne("q1tI"),y=ne.n(R),w=ne("vg9a"),_=ne("DlQD"),L=ne.n(_),A=ne("rUJ1");function C(W,s){var m=W.match(/^(\s+)(?:```)/);if(m===null)return s;var B=m[1];return s.split(`
|
|
`).map(function(K){var F=K.match(/^\s+/);if(F===null)return K;var fe=Object(H.a)(F,1),We=fe[0];return We.length>=B.length?K.slice(B.length):K}).join(`
|
|
`)}var d=[],o=["<ul>"],l=new L.a.Renderer,h=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function T(){d.length=0,o=["<ul>"]}var f={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function p(W,s,m,B){if(s>=W.length||W[s].level<=m)return s;var K=W[s];B.push("<li><a href='#"+K.anchor+"'>"+K.text+"</a>"),s++;var F=[];return s=p(W,s,K.level,F),F.length>0&&(B.push("<ul>"),F.forEach(function(fe){B.push(fe)}),B.push("</ul>")),B.push("</li>"),s=p(W,s,m,B),s}function D(){return p(d,0,0,o),o.push("</ul>"),o.join("")}var E={heading:function(s){var m=h.exec(s);if(m)return{type:"heading",raw:m[0],depth:m[1].length,text:m[2]}},fences:function(s){var m=this.rules.block.fences.exec(s);if(m){var B=m[0],K=C(B,m[3]||""),F=m[2]?m[2].trim():m[2];if(["latex","katex","math"].indexOf(F)>=0){var fe=u(),We=K;K=fe,a[fe]={type:"block",expression:We}}return{type:"code",raw:B,lang:F,text:K}}}},g=/(?:\${2})([^\n`]+?)(?:\${2})/gi,c=0,u=function(){return"__special_katext_id_".concat(c++,"__")},a={};function x(){return a}function b(){c=0,a={}}function v(W){return W=W.replace(g,function(s,m){var B=u();return a[B]={type:"inline",expression:m},B}),W}var M=l.listitem;l.listitem=function(W){return M(v(W))};var G=l.paragraph;l.paragraph=function(W){return G(v(W))};var X=l.tablecell;l.tablecell=function(W,s){return X(v(W),s)},l.code=function(W,s,m){var B=(s||"").match(/\S*/)[0];return B?["latex","katex","math"].indexOf(B)>=0?"<p class='editormd-tex'>".concat(W,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(s,'">').concat(m?W:Object(A.escape)(W,!0),`</code></pre>
|
|
`):'<pre class="prettyprint linenums"><code>'+(m?W:Object(A.escape)(W,!0))+"</code></pre>"},l.heading=function(W,s,m){var B=this.options.headerPrefix+m.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return d.push({anchor:B,level:s,text:W}),"<h"+s+' id="'+B+'">'+W+"</h"+s+">"},L.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),L.a.use({tokenizer:E,renderer:l});var Q=L.a,z=ne("SJMd"),j=ne("ulZh"),q=ne.n(j),le=ne("m3rI"),me=ne("Oy/b"),be=ne("p5ED"),Be=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 Le=function(W,s){return(Le=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(m,B){m.__proto__=B}||function(m,B){for(var K in B)Object.prototype.hasOwnProperty.call(B,K)&&(m[K]=B[K])})(W,s)};function De(W,s){function m(){this.constructor=W}Le(W,s),W.prototype=s===null?Object.create(s):(m.prototype=s.prototype,new m)}function de(W,s,m,B){return new(m||(m=Promise))(function(K,F){function fe(ut){try{qe(B.next(ut))}catch(He){F(He)}}function We(ut){try{qe(B.throw(ut))}catch(He){F(He)}}function qe(ut){var He;ut.done?K(ut.value):(He=ut.value,He instanceof m?He:new m(function(xt){xt(He)})).then(fe,We)}qe((B=B.apply(W,s||[])).next())})}function pe(W,s){var m,B,K,F,fe={label:0,sent:function(){if(1&K[0])throw K[1];return K[1]},trys:[],ops:[]};return F={next:We(0),throw:We(1),return:We(2)},typeof Symbol=="function"&&(F[Symbol.iterator]=function(){return this}),F;function We(qe){return function(ut){return function(He){if(m)throw new TypeError("Generator is already executing.");for(;fe;)try{if(m=1,B&&(K=2&He[0]?B.return:He[0]?B.throw||((K=B.return)&&K.call(B),0):B.next)&&!(K=K.call(B,He[1])).done)return K;switch(B=0,K&&(He=[2&He[0],K.value]),He[0]){case 0:case 1:K=He;break;case 4:return fe.label++,{value:He[1],done:!1};case 5:fe.label++,B=He[1],He=[0];continue;case 7:He=fe.ops.pop(),fe.trys.pop();continue;default:if(!(K=fe.trys,(K=K.length>0&&K[K.length-1])||He[0]!==6&&He[0]!==2)){fe=0;continue}if(He[0]===3&&(!K||He[1]>K[0]&&He[1]<K[3])){fe.label=He[1];break}if(He[0]===6&&fe.label<K[1]){fe.label=K[1],K=He;break}if(K&&fe.label<K[2]){fe.label=K[2],fe.ops.push(He);break}K[2]&&fe.ops.pop(),fe.trys.pop();continue}He=s.call(W,fe)}catch(xt){He=[6,xt],B=0}finally{m=K=0}if(5&He[0])throw He[1];return{value:He[0]?He[1]:void 0,done:!0}}([qe,ut])}}}function ae(){for(var W=0,s=0,m=arguments.length;s<m;s++)W+=arguments[s].length;var B=Array(W),K=0;for(s=0;s<m;s++)for(var F=arguments[s],fe=0,We=F.length;fe<We;fe++,K++)B[K]=F[fe];return B}var re=function(){function W(){}return W.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},W.setAttributes=function(s,m){for(var B=0,K=m;B<K.length;B++){var F=K[B],fe=F[0],We=F[1];s.setAttribute(fe,We)}},W.createRect=function(s,m,B){var K=document.createElementNS("http://www.w3.org/2000/svg","rect");return K.setAttribute("width",s.toString()),K.setAttribute("height",m.toString()),B&&W.setAttributes(K,B),K},W.createLine=function(s,m,B,K,F){var fe=document.createElementNS("http://www.w3.org/2000/svg","line");return fe.setAttribute("x1",s.toString()),fe.setAttribute("y1",m.toString()),fe.setAttribute("x2",B.toString()),fe.setAttribute("y2",K.toString()),F&&W.setAttributes(fe,F),fe},W.createPolygon=function(s,m){var B=document.createElementNS("http://www.w3.org/2000/svg","polygon");return B.setAttribute("points",s),m&&W.setAttributes(B,m),B},W.createCircle=function(s,m){var B=document.createElementNS("http://www.w3.org/2000/svg","circle");return B.setAttribute("cx",(s/2).toString()),B.setAttribute("cy",(s/2).toString()),B.setAttribute("r",s.toString()),m&&W.setAttributes(B,m),B},W.createEllipse=function(s,m,B){var K=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return K.setAttribute("cx",(s/2).toString()),K.setAttribute("cy",(m/2).toString()),K.setAttribute("rx",(s/2).toString()),K.setAttribute("ry",(m/2).toString()),B&&W.setAttributes(K,B),K},W.createGroup=function(s){var m=document.createElementNS("http://www.w3.org/2000/svg","g");return s&&W.setAttributes(m,s),m},W.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},W.createMarker=function(s,m,B,K,F,fe,We){var qe=document.createElementNS("http://www.w3.org/2000/svg","marker");return W.setAttributes(qe,[["id",s],["orient",m],["markerWidth",B.toString()],["markerHeight",K.toString()],["refX",F.toString()],["refY",fe.toString()]]),qe.appendChild(We),qe},W.createText=function(s){var m=document.createElementNS("http://www.w3.org/2000/svg","text");return m.setAttribute("x","0"),m.setAttribute("y","0"),s&&W.setAttributes(m,s),m},W.createTSpan=function(s,m){var B=document.createElementNS("http://www.w3.org/2000/svg","tspan");return B.textContent=s,m&&W.setAttributes(B,m),B},W.createImage=function(s){var m=document.createElementNS("http://www.w3.org/2000/svg","image");return s&&W.setAttributes(m,s),m},W.createPoint=function(s,m){var B=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return B.x=s,B.y=m,B},W.createPath=function(s,m){var B=document.createElementNS("http://www.w3.org/2000/svg","path");return B.setAttribute("d",s),m&&W.setAttributes(B,m),B},W}(),we=function(){function W(){}return W.addKey=function(s){W.key=s},Object.defineProperty(W,"isLicensed",{get:function(){return!!W.key&&new RegExp(/^MJS2-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(W.key)},enumerable:!1,configurable:!0}),W}(),ve=function(){function W(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return W.prototype.rasterize=function(s,m,B){var K=this;return new Promise(function(F){var fe=B!==void 0?B:document.createElement("canvas");s===null&&(K.markersOnly=!0,K.naturalSize=!1);var We=document.createElementNS("http://www.w3.org/2000/svg","svg");We.setAttribute("xmlns","http://www.w3.org/2000/svg"),We.setAttribute("width",m.width.baseVal.valueAsString),We.setAttribute("height",m.height.baseVal.valueAsString),We.setAttribute("viewBox","0 0 "+m.viewBox.baseVal.width.toString()+" "+m.viewBox.baseVal.height.toString()),We.innerHTML=m.innerHTML,K.naturalSize===!0?(We.width.baseVal.value=s.naturalWidth,We.height.baseVal.value=s.naturalHeight):K.width!==void 0&&K.height!==void 0&&(We.width.baseVal.value=K.width,We.height.baseVal.value=K.height),fe.width=We.width.baseVal.value,fe.height=We.height.baseVal.value;var qe=We.outerHTML,ut=fe.getContext("2d");K.markersOnly!==!0&&ut.drawImage(s,0,0,fe.width,fe.height);var He=window.URL,xt=new Image(fe.width,fe.height);xt.setAttribute("crossOrigin","anonymous");var _t=new Blob([qe],{type:"image/svg+xml"}),Vt=He.createObjectURL(_t);xt.onload=function(){ut.drawImage(xt,0,0),He.revokeObjectURL(Vt);var Ir=fe.toDataURL(K.imageType,K.imageQuality);F(Ir)},xt.src=Vt})},W}(),Re=function(){},Ae=function(){function W(s){this._classNamePrefixBase="__markerjs2_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+s+"_"}return Object.defineProperty(W.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(W.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(W.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"fade_out"},enumerable:!1,configurable:!0}),W.prototype.addClass=function(s){return this.styleSheet===void 0&&this.addStyleSheet(),s.name=""+this.classNamePrefix+s.localName,this.classes.push(s),this.styleSheet.sheet.insertRule("."+s.name+" {"+s.style+"}",this.styleSheet.sheet.cssRules.length),s},W.prototype.addRule=function(s){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(s),this.styleSheet.sheet.insertRule(s.selector+" {"+s.style+"}",this.styleSheet.sheet.cssRules.length)},W.prototype.addStyleSheet=function(){var s;this.styleSheet=document.createElement("style"),((s=this.styleSheetRoot)!==null&&s!==void 0?s:document.head).appendChild(this.styleSheet),this.addRule(new Oe("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new Oe("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
|
|
from {
|
|
opacity: 0;
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
}
|
|
`)),this.addRule(new Oe("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
|
|
from {
|
|
opacity: 1;
|
|
}
|
|
to {
|
|
opacity: 0;
|
|
}
|
|
`)),this.addClass(new Ee("fade_in",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
|
|
`)),this.addClass(new Ee("fade_out",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
|
|
`))},W.prototype.removeStyleSheet=function(){var s;this.styleSheet&&(((s=this.styleSheetRoot)!==null&&s!==void 0?s:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},W}(),Oe=function(W,s){this.selector=W,this.style=s},Ee=function(W,s){this.localName=W,this.style=s},_e=function(){function W(s,m,B,K,F){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=s,this.displayMode=m,this.markerItems=B,this.uiStyleSettings=K,this.styles=F,this.addStyles(),this.adjustLayout=this.adjustLayout.bind(this),this.overflowButtonClicked=this.overflowButtonClicked.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this)}return W.prototype.show=function(s){var m=this;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=s,this.uiContainer.className=this.toolbarStyleClass.name+" "+this.styles.fadeInAnimationClassName+" "+(this.uiStyleSettings.toolbarStyleColorsClassName?this.uiStyleSettings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name);var B=document.createElement("div");B.className=this.toolbarBlockStyleClass.name,B.style.whiteSpace="nowrap",this.uiContainer.appendChild(B),this.addActionButton(B,'<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(B,'<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(B,'<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(B,'<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(B,'<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(B,'<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(B,'<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(B,'<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(F){var fe=document.createElement("div");fe.className=""+m.toolbarButtonStyleClass.name,fe.setAttribute("data-type-name",F.typeName),fe.innerHTML=F.icon,fe.addEventListener("click",function(){m.markerToolbarButtonClicked(fe,F)}),m.buttons.push(fe),m.markerButtons.push(fe)}),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 K=document.createElement("div");K.className=this.toolbarBlockStyleClass.name,K.style.whiteSpace="nowrap",K.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(K),this.addActionButton(K,'<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(K,'<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()},W.prototype.addButtonClickListener=function(s){this.buttonClickListeners.push(s)},W.prototype.removeButtonClickListener=function(s){this.buttonClickListeners.indexOf(s)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(s),1)},W.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},W.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var s=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var m=0;m<this.markerButtons.length;m++)m<s||m===s&&this.markerButtons.length-1===s?this.markerButtonBlock.appendChild(this.markerButtons[m]):(m===s&&this.markerButtonBlock.appendChild(this.overflowButton),this.markerButtonOverflowBlock.appendChild(this.markerButtons[m]))}},W.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")},W.prototype.resetButtonStyles=function(){var s=this;this.buttons.forEach(function(m){m.className=m.className.replace(s.uiStyleSettings.toolbarButtonStyleColorsClassName?s.uiStyleSettings.toolbarButtonStyleColorsClassName:s.toolbarButtonStyleColorsClass.name,"").trim(),m.className=m.className.replace(s.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?s.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:s.toolbarActiveButtonStyleColorsClass.name,"").trim(),m.className+=" "+(s.uiStyleSettings.toolbarButtonStyleColorsClassName?s.uiStyleSettings.toolbarButtonStyleColorsClassName:s.toolbarButtonStyleColorsClass.name)})},W.prototype.addActionButton=function(s,m,B){var K=this,F=document.createElement("div");switch(F.className=""+this.toolbarButtonStyleClass.name,F.innerHTML=m,F.setAttribute("data-action",B),F.addEventListener("click",function(){K.actionToolbarButtonClicked(F,B)}),B){case"select":F.style.fill=this.uiStyleSettings.selectButtonColor;break;case"delete":case"clear":F.style.fill=this.uiStyleSettings.deleteButtonColor;break;case"undo":case"redo":F.style.fill=this.uiStyleSettings.selectButtonColor;break;case"render":F.style.fill=this.uiStyleSettings.okButtonColor;break;case"close":F.style.fill=this.uiStyleSettings.closeButtonColor}s.appendChild(F),this.buttons.push(F)},W.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new Ee("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 Ee("toolbar_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
box-shadow: 0px 3px rgba(33, 33, 33, 0.1);
|
|
`)),this.toolbarBlockStyleClass=this.styles.addClass(new Ee("toolbar-block",`
|
|
display: inline-block;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new Ee("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 Ee("toolbar-overflow-block_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
`));var s=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new Ee("toolbar_button",`
|
|
display: inline-block;
|
|
width: `+(this.uiStyleSettings.toolbarHeight-2*s)+`px;
|
|
height: `+(this.uiStyleSettings.toolbarHeight-2*s)+`px;
|
|
padding: `+s+`px;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new Ee("toolbar_button_colors",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new Ee("toolbar_active_button",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`)),this.styles.addRule(new Oe("."+this.toolbarButtonStyleClass.name+" svg",`
|
|
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
|
|
`)),this.styles.addRule(new Oe("."+this.toolbarButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`))},W.prototype.markerToolbarButtonClicked=function(s,m){this.setActiveButton(s),this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(B){return B("marker",m)}),this.markerButtonOverflowBlock.style.display="none"},W.prototype.actionToolbarButtonClicked=function(s,m){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(B){return B("action",m)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},W.prototype.setActiveButton=function(s){this.resetButtonStyles(),s.className=s.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),s.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},W.prototype.setActiveMarkerButton=function(s){var m=this.markerButtons.find(function(B){return B.getAttribute("data-type-name")===s});m&&this.setActiveButton(m)},W.prototype.setCurrentMarker=function(s){var m=this;this.currentMarker=s,this.buttons.filter(function(B){return/delete|notes/.test(B.getAttribute("data-action"))}).forEach(function(B){m.currentMarker===void 0?(B.style.fillOpacity="0.4",B.style.pointerEvents="none"):(B.style.fillOpacity="1",B.style.pointerEvents="all")})},W}(),Ie=function(){function W(s,m,B,K){this.panels=[],this.panelButtons=[],this.markerjsContainer=s,this.displayMode=m,this.uiStyleSettings=B,this.styles=K,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return W.prototype.addStyles=function(){var s;this.toolboxStyleClass=this.styles.addClass(new Ee("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 Ee("toolbox_colors",`
|
|
color: `+this.uiStyleSettings.toolboxColor+`;
|
|
`));var m=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new Ee("toolbox-button-row",`
|
|
display: flex;
|
|
cursor: default;
|
|
box-sizing: content-box;
|
|
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new Ee("toolbox-button-row_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new Ee("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 Ee("toolbox-panel-row_colors",`
|
|
background-color: `+((s=this.uiStyleSettings.toolboxBackgroundColor)!==null&&s!==void 0?s:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
|
|
`)),this.toolboxButtonStyleClass=this.styles.addClass(new Ee("toolbox_button",`
|
|
display: inline-block;
|
|
width: `+(this.uiStyleSettings.toolbarHeight-2*m)+`px;
|
|
height: `+(this.uiStyleSettings.toolbarHeight-2*m)+`px;
|
|
padding: `+m+`px;
|
|
box-sizing: content-box;
|
|
`)),this.toolboxButtonStyleColorsClass=this.styles.addClass(new Ee("toolbox-button_colors",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new Ee("toolbox-active-button_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`;
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.styles.addRule(new Oe("."+this.toolboxButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`)),this.styles.addRule(new Oe("."+this.toolboxButtonStyleClass.name+" svg",`
|
|
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
|
|
`))},W.prototype.show=function(s){var m;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=s,this.uiContainer.className=this.toolboxStyleClass.name+" "+((m=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&m!==void 0?m:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},W.prototype.setPanelButtons=function(s){var m,B,K=this;this.panels=s,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((m=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&m!==void 0?m:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+((B=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&B!==void 0?B:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(F){var fe;F.uiStyleSettings=K.uiStyleSettings;var We=document.createElement("div");We.className=K.toolboxButtonStyleClass.name+" "+((fe=K.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&fe!==void 0?fe:K.toolboxButtonStyleColorsClass.name),We.innerHTML=F.icon,We.title=F.title,We.addEventListener("click",function(){K.panelButtonClick(F)}),K.panelButtons.push(We),K.buttonRow.appendChild(We)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},W.prototype.panelButtonClick=function(s){var m=this,B=-1;if(s!==this.activePanel){B=this.panels.indexOf(s),this.panelRow.innerHTML="";var K=s.getUi();K.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(K),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=s}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){m.displayMode==="inline"?m.panelRow.style.display="none":m.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(F,fe){var We,qe;F.className=m.toolboxButtonStyleClass.name+" "+(fe===B?""+((We=m.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&We!==void 0?We:m.toolboxActiveButtonStyleColorsClass.name):""+((qe=m.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&qe!==void 0?qe:m.toolboxButtonStyleColorsClass.name))})},W}(),Ve=function(W,s){this.title=W,this.icon=s},Ue=function(W){function s(m,B,K,F){var fe=W.call(this,m,F||'<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 fe.colors=[],fe.addTransparent=!1,fe.colorBoxes=[],fe.colors=B,fe.currentColor=K,fe.setCurrentColor=fe.setCurrentColor.bind(fe),fe.getColorBox=fe.getColorBox.bind(fe),fe}return De(s,W),s.prototype.getUi=function(){var m=this,B=document.createElement("div");return B.style.overflow="hidden",B.style.whiteSpace="nowrap",this.colors.forEach(function(K){var F=m.getColorBox(K);B.appendChild(F),m.colorBoxes.push(F)}),B},s.prototype.getColorBox=function(m){var B=this,K=this.uiStyleSettings.toolbarHeight/4,F=this.uiStyleSettings.toolbarHeight-K,fe=document.createElement("div");fe.style.display="inline-block",fe.style.boxSizing="content-box",fe.style.width=F-2+"px",fe.style.height=F-2+"px",fe.style.padding="1px",fe.style.marginRight="2px",fe.style.marginBottom="2px",fe.style.borderWidth="2px",fe.style.borderStyle="solid",fe.style.borderRadius=(F+2)/2+"px",fe.style.borderColor=m===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",fe.addEventListener("click",function(){B.setCurrentColor(m,fe)});var We=document.createElement("div");return We.style.display="inline-block",We.style.width=F-2+"px",We.style.height=F-2+"px",We.style.backgroundColor=m,We.style.borderRadius=F/2+"px",m==="transparent"&&(We.style.fill=this.uiStyleSettings.toolboxAccentColor,We.innerHTML=`<svg viewBox="0 0 24 24">
|
|
<path d="M2,5.27L3.28,4L20,20.72L18.73,22L15.65,18.92C14.5,19.3 13.28,19.5 12,19.5C7,19.5 2.73,16.39 1,12C1.69,10.24 2.79,8.69 4.19,7.46L2,5.27M12,9A3,3 0 0,1 15,12C15,12.35 14.94,12.69 14.83,13L11,9.17C11.31,9.06 11.65,9 12,9M12,4.5C17,4.5 21.27,7.61 23,12C22.18,14.08 20.79,15.88 19,17.19L17.58,15.76C18.94,14.82 20.06,13.54 20.82,12C19.17,8.64 15.76,6.5 12,6.5C10.91,6.5 9.84,6.68 8.84,7L7.3,5.47C8.74,4.85 10.33,4.5 12,4.5M3.18,12C4.83,15.36 8.24,17.5 12,17.5C12.69,17.5 13.37,17.43 14,17.29L11.72,15C10.29,14.85 9.15,13.71 9,12.28L5.6,8.87C4.61,9.72 3.78,10.78 3.18,12Z" />
|
|
</svg>`),fe.appendChild(We),fe},s.prototype.setCurrentColor=function(m,B){var K=this;this.currentColor=m,this.colorBoxes.forEach(function(F){F.style.borderColor=F===B?K.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(m)},s}(Ve),Fe=function(){function W(s,m,B){this._state="new",this._isSelected=!1,this._container=s,this._overlayContainer=m,this.globalSettings=B,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(W.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),W.prototype.ownsTarget=function(s){return!1},Object.defineProperty(W.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),W.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},W.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},W.prototype.pointerDown=function(s,m){},W.prototype.dblClick=function(s,m){},W.prototype.manipulate=function(s){},W.prototype.pointerUp=function(s){this.stateChanged()},W.prototype.dispose=function(){},W.prototype.addMarkerVisualToContainer=function(s){this.container.childNodes.length>0?this.container.insertBefore(s,this.container.childNodes[0]):this.container.appendChild(s)},W.prototype.getState=function(){return{typeName:W.typeName,state:this.state,notes:this.notes}},W.prototype.restoreState=function(s){this._state=s.state,this.notes=s.notes},W.prototype.scale=function(s,m){},W.prototype.colorChanged=function(s){this.onColorChanged&&this.onColorChanged(s),this.stateChanged()},W.prototype.fillColorChanged=function(s){this.onFillColorChanged&&this.onFillColorChanged(s),this.stateChanged()},W.prototype.stateChanged=function(){if(this.onStateChanged&&this.state!=="creating"&&this.state!=="new"){var s=this.getState();this.manipulationStartState!==void 0&&(this.manipulationStartState.state="select"),s.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(s)&&this.onStateChanged(this)}},W.typeName="MarkerBase",W}(),Pe=function(){function W(){this.findGripByVisual=this.findGripByVisual.bind(this)}return W.prototype.findGripByVisual=function(s){return this.topLeft.ownsTarget(s)?this.topLeft:this.topCenter.ownsTarget(s)?this.topCenter:this.topRight.ownsTarget(s)?this.topRight:this.centerLeft.ownsTarget(s)?this.centerLeft:this.centerRight.ownsTarget(s)?this.centerRight:this.bottomLeft.ownsTarget(s)?this.bottomLeft:this.bottomCenter.ownsTarget(s)?this.bottomCenter:this.bottomRight.ownsTarget(s)?this.bottomRight:void 0},W}(),et=function(){function W(){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 W.prototype.ownsTarget=function(s){return s===this.visual||s===this.visual.childNodes[0]||s===this.visual.childNodes[1]},W}(),Je=function(){function W(){}return W.toITransformMatrix=function(s){return{a:s.a,b:s.b,c:s.c,d:s.d,e:s.e,f:s.f}},W.toSVGMatrix=function(s,m){return s.a=m.a,s.b=m.b,s.c=m.c,s.d=m.d,s.e=m.e,s.f=m.f,s},W}(),Qe=function(W){function s(m,B,K){var F=W.call(this,m,B,K)||this;return F.left=0,F.top=0,F.width=0,F.height=0,F.defaultSize={x:50,y:20},F.offsetX=0,F.offsetY=0,F.rotationAngle=0,F.CB_DISTANCE=10,F._suppressMarkerCreateEvent=!1,F.container.transform.baseVal.appendItem(re.createTransform()),F.setupControlBox(),F}return De(s,W),Object.defineProperty(s.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"visual",{get:function(){return this._visual},set:function(m){this._visual=m;var B=re.createTransform();this._visual.transform.baseVal.appendItem(B)},enumerable:!1,configurable:!0}),s.prototype.ownsTarget=function(m){return!!W.prototype.ownsTarget.call(this,m)||!!(this.controlGrips.findGripByVisual(m)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(m))},s.prototype.pointerDown=function(m,B){W.prototype.pointerDown.call(this,m,B),this.state==="new"&&(this.left=m.x,this.top=m.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var K=this.unrotatePoint(m);if(this.manipulationStartX=K.x,this.manipulationStartY=K.y,this.offsetX=K.x-this.left,this.offsetY=K.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(B),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(B)){this.activeGrip=this.rotatorGrip;var F=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=F.x-this.width/2,this.top=F.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var fe=this.container.transform.baseVal.getItem(0);fe.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(fe,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},s.prototype.pointerUp=function(m){var B=this.state;W.prototype.pointerUp.call(this,m),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(m),this._state="select",B==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},s.prototype.moveVisual=function(m){this.visual.style.transform="translate("+m.x+"px, "+m.y+"px)"},s.prototype.manipulate=function(m){var B=this.unrotatePoint(m);this.state==="creating"?this.resize(m):this.state==="move"?(this.left=this.manipulationStartLeft+(B.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(B.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(B):this.state==="rotate"&&this.rotate(m)},s.prototype.resize=function(m){var B=this.manipulationStartLeft,K=this.manipulationStartWidth,F=this.manipulationStartTop,fe=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:B=this.manipulationStartLeft+m.x-this.manipulationStartX,K=this.manipulationStartWidth+this.manipulationStartLeft-B;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:K=this.manipulationStartWidth+m.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:F=this.manipulationStartTop+m.y-this.manipulationStartY,fe=this.manipulationStartHeight+this.manipulationStartTop-F;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:fe=this.manipulationStartHeight+m.y-this.manipulationStartY}K>=0?(this.left=B,this.width=K):(this.left=B+K,this.width=-K),fe>=0?(this.top=F,this.height=fe):(this.top=F+fe,this.height=-fe),this.setSize()},s.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},s.prototype.rotate=function(m){if(Math.abs(m.x-this.centerX)>.1){var B=Math.sign(m.x-this.centerX);this.rotationAngle=180*Math.atan((m.y-this.centerY)/(m.x-this.centerX))/Math.PI+90*B,this.applyRotation()}},s.prototype.applyRotation=function(){var m=this.container.transform.baseVal.getItem(0);m.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(m,0)},s.prototype.rotatePoint=function(m){if(this.rotationAngle===0)return m;var B=this.container.getCTM(),K=re.createPoint(m.x,m.y);return{x:(K=K.matrixTransform(B)).x,y:K.y}},s.prototype.unrotatePoint=function(m){if(this.rotationAngle===0)return m;var B=this.container.getCTM();B=B.inverse();var K=re.createPoint(m.x,m.y);return{x:(K=K.matrixTransform(B)).x,y:K.y}},s.prototype.select=function(){W.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},s.prototype.deselect=function(){W.prototype.deselect.call(this),this.controlBox.style.display="none"},s.prototype.setupControlBox=function(){this.controlBox=re.createGroup();var m=re.createTransform();m.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(m),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 Pe,this.addControlGrips(),this.controlBox.style.display="none"},s.prototype.adjustControlBox=function(){var m=this.controlBox.transform.baseVal.getItem(0);m.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(m,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()},s.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()},s.prototype.createGrip=function(){var m=new et;return m.visual.transform.baseVal.appendItem(re.createTransform()),this.controlBox.appendChild(m.visual),m},s.prototype.positionGrips=function(){var m=this.controlGrips.topLeft.GRIP_SIZE,B=-m/2,K=B,F=(this.width+this.CB_DISTANCE)/2-m/2,fe=(this.height+this.CB_DISTANCE)/2-m/2,We=this.height+this.CB_DISTANCE-m/2,qe=this.width+this.CB_DISTANCE-m/2;this.positionGrip(this.controlGrips.topLeft.visual,B,K),this.positionGrip(this.controlGrips.topCenter.visual,F,K),this.positionGrip(this.controlGrips.topRight.visual,qe,K),this.positionGrip(this.controlGrips.centerLeft.visual,B,fe),this.positionGrip(this.controlGrips.centerRight.visual,qe,fe),this.positionGrip(this.controlGrips.bottomLeft.visual,B,We),this.positionGrip(this.controlGrips.bottomCenter.visual,F,We),this.positionGrip(this.controlGrips.bottomRight.visual,qe,We),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,F,K-3*this.CB_DISTANCE)},s.prototype.positionGrip=function(m,B,K){var F=m.transform.baseVal.getItem(0);F.setTranslate(B,K),m.transform.baseVal.replaceItem(F,0)},s.prototype.hideControlBox=function(){this.controlBox.style.display="none"},s.prototype.showControlBox=function(){this.controlBox.style.display=""},s.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)},W.prototype.getState.call(this))},s.prototype.restoreState=function(m){W.prototype.restoreState.call(this,m);var B=m;this.left=B.left,this.top=B.top,this.width=B.width,this.height=B.height,this.rotationAngle=B.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(Je.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,B.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(Je.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,B.containerTransformMatrix))},s.prototype.scale=function(m,B){W.prototype.scale.call(this,m,B);var K=this.rotatePoint({x:this.left,y:this.top}),F=this.unrotatePoint({x:K.x*m,y:K.y*B});this.left=F.x,this.top=F.y,this.width=this.width*m,this.height=this.height*B,this.adjustControlBox()},s}(Fe),$e=function(W){function s(m,B,K){var F=W.call(this,m,B,K)||this;return F.fillColor="transparent",F.strokeColor="transparent",F.strokeWidth=0,F.strokeDasharray="",F.opacity=1,F.setStrokeColor=F.setStrokeColor.bind(F),F.setFillColor=F.setFillColor.bind(F),F.setStrokeWidth=F.setStrokeWidth.bind(F),F.setStrokeDasharray=F.setStrokeDasharray.bind(F),F.createVisual=F.createVisual.bind(F),F}return De(s,W),s.prototype.ownsTarget=function(m){return!(!W.prototype.ownsTarget.call(this,m)&&m!==this.visual)},s.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)},s.prototype.pointerDown=function(m,B){W.prototype.pointerDown.call(this,m,B),this.state==="new"&&(this.createVisual(),this.moveVisual(m),this._state="creating")},s.prototype.manipulate=function(m){W.prototype.manipulate.call(this,m)},s.prototype.resize=function(m){W.prototype.resize.call(this,m),this.setSize()},s.prototype.setSize=function(){W.prototype.setSize.call(this),re.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},s.prototype.pointerUp=function(m){W.prototype.pointerUp.call(this,m),this.setSize()},s.prototype.setStrokeColor=function(m){this.strokeColor=m,this.visual&&re.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(m),this.stateChanged()},s.prototype.setFillColor=function(m){this.fillColor=m,this.visual&&re.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},s.prototype.setStrokeWidth=function(m){this.strokeWidth=m,this.visual&&re.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},s.prototype.setStrokeDasharray=function(m){this.strokeDasharray=m,this.visual&&re.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},s.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},W.prototype.getState.call(this))},s.prototype.restoreState=function(m){var B=m;this.fillColor=B.fillColor,this.strokeColor=B.strokeColor,this.strokeWidth=B.strokeWidth,this.strokeDasharray=B.strokeDasharray,this.opacity=B.opacity,this.createVisual(),W.prototype.restoreState.call(this,m),this.setSize()},s.prototype.scale=function(m,B){W.prototype.scale.call(this,m,B),this.setSize()},s.title="Rectangle marker",s}(Qe),ht=function(W){function s(m,B,K,F){var fe=W.call(this,m,F||'<svg viewBox="0 0 24 24"><path d="M3 17h18v-2H3v2m0 3h18v-1H3v1m0-7h18v-3H3v3m0-9v4h18V4H3z"/></svg>')||this;return fe.widths=[],fe.widthBoxes=[],fe.widths=B,fe.currentWidth=K,fe.setCurrentWidth=fe.setCurrentWidth.bind(fe),fe}return De(s,W),s.prototype.getUi=function(){var m=this,B=document.createElement("div");return B.style.display="flex",B.style.overflow="hidden",B.style.flexGrow="2",this.widths.forEach(function(K){var F=document.createElement("div");F.style.display="flex",F.style.flexGrow="2",F.style.alignItems="center",F.style.justifyContent="space-between",F.style.padding="5px",F.style.borderWidth="2px",F.style.borderStyle="solid",F.style.borderColor=K===m.currentWidth?m.uiStyleSettings.toolboxAccentColor:"transparent",F.addEventListener("click",function(){m.setCurrentWidth(K,F)}),B.appendChild(F);var fe=document.createElement("div");fe.innerText=K.toString(),fe.style.marginRight="5px",F.appendChild(fe);var We=document.createElement("div");We.style.minHeight="20px",We.style.flexGrow="2",We.style.display="flex",We.style.alignItems="center";var qe=document.createElement("hr");qe.style.minWidth="20px",qe.style.border="0px",qe.style.borderTop=K+"px solid "+m.uiStyleSettings.toolboxColor,qe.style.flexGrow="2",We.appendChild(qe),F.appendChild(We),m.widthBoxes.push(F)}),B},s.prototype.setCurrentWidth=function(m,B){var K=this;this.currentWidth=m,this.widthBoxes.forEach(function(F){F.style.borderColor=F===B?K.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},s}(Ve),Xe=function(W){function s(m,B,K,F){var fe=W.call(this,m,F||'<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 fe.styles=[],fe.styleBoxes=[],fe.styles=B,fe.currentStyle=K,fe.setCurrentStyle=fe.setCurrentStyle.bind(fe),fe}return De(s,W),s.prototype.getUi=function(){var m=this,B=document.createElement("div");return B.style.display="flex",B.style.overflow="hidden",B.style.flexGrow="2",this.styles.forEach(function(K){var F=document.createElement("div");F.style.display="flex",F.style.alignItems="center",F.style.justifyContent="space-between",F.style.padding="5px",F.style.borderWidth="2px",F.style.borderStyle="solid",F.style.overflow="hidden",F.style.maxWidth=100/m.styles.length-5+"%",F.style.borderColor=K===m.currentStyle?m.uiStyleSettings.toolboxAccentColor:"transparent",F.addEventListener("click",function(){m.setCurrentStyle(K,F)}),B.appendChild(F);var fe=document.createElement("div");fe.style.minHeight="20px",fe.style.flexGrow="2",fe.style.overflow="hidden";var We=`<svg width="100" height="20">
|
|
<line x1="0" y1="10" x2="100" y2="10" stroke="`+m.uiStyleSettings.toolboxColor+'" stroke-width="3" '+(K!==""?'stroke-dasharray="'+K+'"':"")+` />
|
|
</svg>`;fe.innerHTML=We,F.appendChild(fe),m.styleBoxes.push(F)}),B},s.prototype.setCurrentStyle=function(m,B){var K=this;this.currentStyle=m,this.styleBoxes.forEach(function(F){F.style.borderColor=F===B?K.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},s}(Ve),Ze=function(W){function s(m,B,K){var F=W.call(this,m,B,K)||this;return F.strokeColor=K.defaultColor,F.strokeWidth=K.defaultStrokeWidth,F.strokeDasharray=K.defaultStrokeDasharray,F.strokePanel=new Ue("Line color",K.defaultColorSet,K.defaultColor),F.strokePanel.onColorChanged=F.setStrokeColor,F.strokeWidthPanel=new ht("Line width",K.defaultStrokeWidths,K.defaultStrokeWidth),F.strokeWidthPanel.onWidthChanged=F.setStrokeWidth,F.strokeStylePanel=new Xe("Line style",K.defaultStrokeDasharrays,K.defaultStrokeDasharray),F.strokeStylePanel.onStyleChanged=F.setStrokeDasharray,F}return De(s,W),Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var m=W.prototype.getState.call(this);return m.typeName=s.typeName,m},s.typeName="FrameMarker",s.title="Frame marker",s.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>',s}($e),ke=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},at=function(W){function s(m,B,K){var F=W.call(this,m,B,K)||this;return F.x1=0,F.y1=0,F.x2=0,F.y2=0,F.defaultLength=50,F.manipulationStartX=0,F.manipulationStartY=0,F.manipulationStartX1=0,F.manipulationStartY1=0,F.manipulationStartX2=0,F.manipulationStartY2=0,F.setupControlBox(),F}return De(s,W),s.prototype.ownsTarget=function(m){return!!W.prototype.ownsTarget.call(this,m)||!(!this.grip1.ownsTarget(m)&&!this.grip2.ownsTarget(m))},s.prototype.pointerDown=function(m,B){W.prototype.pointerDown.call(this,m,B),this.manipulationStartX=m.x,this.manipulationStartY=m.y,this.state==="new"&&(this.x1=m.x,this.y1=m.y,this.x2=m.x,this.y2=m.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(B)?this.activeGrip=this.grip1:this.grip2.ownsTarget(B)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},s.prototype.pointerUp=function(m){var B=this.state;W.prototype.pointerUp.call(this,m),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(m),this._state="select",B==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},s.prototype.adjustVisual=function(){},s.prototype.manipulate=function(m){this.state==="creating"?this.resize(m):this.state==="move"?(this.x1=this.manipulationStartX1+m.x-this.manipulationStartX,this.y1=this.manipulationStartY1+m.y-this.manipulationStartY,this.x2=this.manipulationStartX2+m.x-this.manipulationStartX,this.y2=this.manipulationStartY2+m.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(m)},s.prototype.resize=function(m){switch(this.activeGrip){case this.grip1:this.x1=m.x,this.y1=m.y;break;case this.grip2:case void 0:this.x2=m.x,this.y2=m.y}this.adjustVisual(),this.adjustControlBox()},s.prototype.select=function(){W.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},s.prototype.deselect=function(){W.prototype.deselect.call(this),this.controlBox.style.display="none"},s.prototype.setupControlBox=function(){this.controlBox=re.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},s.prototype.adjustControlBox=function(){this.positionGrips()},s.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},s.prototype.createGrip=function(){var m=new et;return m.visual.transform.baseVal.appendItem(re.createTransform()),this.controlBox.appendChild(m.visual),m},s.prototype.positionGrips=function(){var m=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-m/2,this.y1-m/2),this.positionGrip(this.grip2.visual,this.x2-m/2,this.y2-m/2)},s.prototype.positionGrip=function(m,B,K){var F=m.transform.baseVal.getItem(0);F.setTranslate(B,K),m.transform.baseVal.replaceItem(F,0)},s.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},W.prototype.getState.call(this))},s.prototype.restoreState=function(m){W.prototype.restoreState.call(this,m);var B=m;this.x1=B.x1,this.y1=B.y1,this.x2=B.x2,this.y2=B.y2},s.prototype.scale=function(m,B){W.prototype.scale.call(this,m,B),this.x1=this.x1*m,this.y1=this.y1*B,this.x2=this.x2*m,this.y2=this.y2*B,this.adjustVisual(),this.adjustControlBox()},s}(Fe),it=function(W){function s(m,B,K){var F=W.call(this,m,B,K)||this;return F.strokeColor="transparent",F.strokeWidth=0,F.strokeDasharray="",F.setStrokeColor=F.setStrokeColor.bind(F),F.setStrokeWidth=F.setStrokeWidth.bind(F),F.setStrokeDasharray=F.setStrokeDasharray.bind(F),F.strokeColor=K.defaultColor,F.strokeWidth=K.defaultStrokeWidth,F.strokeDasharray=K.defaultStrokeDasharray,F.strokePanel=new Ue("Line color",K.defaultColorSet,K.defaultColor),F.strokePanel.onColorChanged=F.setStrokeColor,F.strokeWidthPanel=new ht("Line width",K.defaultStrokeWidths,K.defaultStrokeWidth),F.strokeWidthPanel.onWidthChanged=F.setStrokeWidth,F.strokeStylePanel=new Xe("Line style",K.defaultStrokeDasharrays,K.defaultStrokeDasharray),F.strokeStylePanel.onStyleChanged=F.setStrokeDasharray,F}return De(s,W),s.prototype.ownsTarget=function(m){return!(!W.prototype.ownsTarget.call(this,m)&&m!==this.visual&&m!==this.selectorLine&&m!==this.visibleLine)},s.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)},s.prototype.pointerDown=function(m,B){W.prototype.pointerDown.call(this,m,B),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},s.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()]]))},s.prototype.setStrokeColor=function(m){this.strokeColor=m,this.adjustVisual(),this.colorChanged(m)},s.prototype.setStrokeWidth=function(m){this.strokeWidth=m,this.adjustVisual()},s.prototype.setStrokeDasharray=function(m){this.strokeDasharray=m,this.adjustVisual(),this.stateChanged()},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var m=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},W.prototype.getState.call(this));return m.typeName=s.typeName,m},s.prototype.restoreState=function(m){W.prototype.restoreState.call(this,m);var B=m;this.strokeColor=B.strokeColor,this.strokeWidth=B.strokeWidth,this.strokeDasharray=B.strokeDasharray,this.createVisual(),this.adjustVisual()},s.typeName="LineMarker",s.title="Line marker",s.icon='<svg viewBox="0 0 24 24"><path d="M19 13H5v-2h14v2z"/></svg>',s}(at),Me=function(W){function s(m,B,K,F){var fe=W.call(this,m,F||'<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 fe.fonts=[],fe.fontBoxes=[],fe.fonts=B,fe.currentFont=K,fe.setCurrentFont=fe.setCurrentFont.bind(fe),fe}return De(s,W),s.prototype.getUi=function(){var m=this,B=document.createElement("div");return B.style.overflow="hidden",B.style.flexGrow="2",this.fonts.forEach(function(K){var F=document.createElement("div");F.style.display="inline-block",F.style.alignItems="center",F.style.justifyContent="space-between",F.style.padding="5px",F.style.borderWidth="2px",F.style.borderStyle="solid",F.style.overflow="hidden",F.style.maxWidth=100/m.fonts.length-5+"%",F.style.borderColor=K===m.currentFont?m.uiStyleSettings.toolboxAccentColor:"transparent",F.addEventListener("click",function(){m.setCurrentFont(K,F)}),B.appendChild(F);var fe=document.createElement("div");fe.style.display="flex",fe.style.minHeight="20px",fe.style.flexGrow="2",fe.style.fontFamily=K,fe.style.overflow="hidden";var We=document.createElement("div");We.style.whiteSpace="nowrap",We.style.overflow="hidden",We.style.textOverflow="ellipsis",We.innerHTML="The quick brown fox jumps over the lazy dog",fe.appendChild(We),F.appendChild(fe),m.fontBoxes.push(F)}),B},s.prototype.setCurrentFont=function(m,B){var K=this;this.currentFont=m,this.fontBoxes.forEach(function(F){F.style.borderColor=F===B?K.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},s}(Ve),Ge=function(W){function s(m,B,K){var F=W.call(this,m,B,K)||this;return F.color="transparent",F.padding=5,F.DEFAULT_TEXT="your text here",F.text=F.DEFAULT_TEXT,F.isMoved=!1,F.color=K.defaultColor,F.fontFamily=K.defaultFontFamily,F.defaultSize={x:100,y:30},F.setColor=F.setColor.bind(F),F.setFont=F.setFont.bind(F),F.renderText=F.renderText.bind(F),F.sizeText=F.sizeText.bind(F),F.textEditDivClicked=F.textEditDivClicked.bind(F),F.showTextEditor=F.showTextEditor.bind(F),F.setSize=F.setSize.bind(F),F.positionTextEditor=F.positionTextEditor.bind(F),F.colorPanel=new Ue("Color",K.defaultColorSet,K.defaultColor),F.colorPanel.onColorChanged=F.setColor,F.fontFamilyPanel=new Me("Font",K.defaultFontFamilies,K.defaultFontFamily),F.fontFamilyPanel.onFontChanged=F.setFont,F}return De(s,W),s.prototype.ownsTarget=function(m){if(W.prototype.ownsTarget.call(this,m)||m===this.visual||m===this.textElement||m===this.bgRectangle)return!0;var B=!1;return this.textElement.childNodes.forEach(function(K){K===m&&(B=!0)}),B},s.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()},s.prototype.pointerDown=function(m,B){W.prototype.pointerDown.call(this,m,B),this.isMoved=!1,this.pointerDownPoint=m,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(m),this._state="creating")},s.prototype.renderText=function(){var m=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(B){m.textElement.appendChild(re.createTSpan(B.trim()===""?" ":B.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},s.prototype.getTextScale=function(){var m=this.textElement.getBBox(),B=1;if(m.width>0&&m.height>0){var K=(1*this.width-this.width*this.padding*2/100)/m.width,F=(1*this.height-this.height*this.padding*2/100)/m.height;B=Math.min(K,F)}return B},s.prototype.getTextPosition=function(m){var B=this.textElement.getBBox(),K=0,F=0;return B.width>0&&B.height>0&&(K=(this.width-B.width*m)/2,F=this.height/2-B.height*m/2),{x:K,y:F}},s.prototype.sizeText=function(){var m=this.textElement.getBBox(),B=this.getTextScale(),K=this.getTextPosition(B);K.y-=m.y*B,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+K.x+"px, "+K.y+"px) scale("+B+", "+B+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(K.x,K.y),this.textElement.transform.baseVal.getItem(1).setScale(B,B))},s.prototype.manipulate=function(m){W.prototype.manipulate.call(this,m),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(m.x-this.pointerDownPoint.x)>5||Math.abs(m.y-this.pointerDownPoint.y)>5)},s.prototype.resize=function(m){W.prototype.resize.call(this,m),this.isMoved=!0,this.setSize(),this.sizeText()},s.prototype.setSize=function(){W.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()]]))},s.prototype.pointerUp=function(m){var B=this.state;B==="creating"&&(this._suppressMarkerCreateEvent=!0),W.prototype.pointerUp.call(this,m),this.setSize(),(B==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},s.prototype.showTextEditor=function(){var m=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(B){B.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var B=Number.parseFloat(m.textEditor.style.fontSize);m.textEditor.clientWidth>=Number.parseInt(m.textEditor.style.maxWidth)&&B>.9;)B-=.1,m.textEditor.style.fontSize=Math.max(B,.9)+"em"}),this.textEditor.addEventListener("keyup",function(B){B.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(B){if(B.clipboardData){var K=B.clipboardData.getData("text"),F=window.getSelection();if(!F.rangeCount)return!1;F.deleteFromDocument(),F.getRangeAt(0).insertNode(document.createTextNode(K)),B.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){m.textEditDivClicked(m.textEditor.innerText)}),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},s.prototype.positionTextEditor=function(){if(this.state==="edit")if(this.textEditor===void 0)this.showTextEditor();else{this.textElement.style.display="";var m=this.getTextScale(),B=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),K=this.textElement.getBBox(),F={x:K.width*m,y:K.height*m};B.x-=F.x/2,B.y-=F.y/2,this.textEditor.style.top=B.y+"px",this.textEditor.style.left=B.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-B.x+"px",this.textEditor.style.fontSize=Math.max(16*m,12)+"px",this.textElement.style.display="none"}},s.prototype.textEditDivClicked=function(m){this.text=m.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},s.prototype.select=function(){W.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},s.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),W.prototype.deselect.call(this)},s.prototype.dblClick=function(m,B){W.prototype.dblClick.call(this,m,B),this.showTextEditor()},s.prototype.setColor=function(m){this.textElement&&re.setAttributes(this.textElement,[["fill",m]]),this.color=m,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(m)},s.prototype.setFont=function(m){this.textElement&&re.setAttributes(this.textElement,[["font-family",m]]),this.fontFamily=m,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},s.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},s.prototype.showVisual=function(){this.state==="edit"&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var m=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},W.prototype.getState.call(this));return m.typeName=s.typeName,m},s.prototype.restoreState=function(m){var B=m;this.color=B.color,this.fontFamily=B.fontFamily,this.padding=B.padding,this.text=B.text,this.createVisual(),W.prototype.restoreState.call(this,m),this.setSize()},s.prototype.scale=function(m,B){W.prototype.scale.call(this,m,B),this.setSize(),this.sizeText(),this.positionTextEditor()},s.typeName="TextMarker",s.title="Text marker",s.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>',s}(Qe),ye=function(W){function s(m,B,K){var F=W.call(this,m,B,K)||this;return F.color="transparent",F.lineWidth=3,F.drawing=!1,F.pixelRatio=1,F.color=K.defaultColor,F.lineWidth=K.defaultStrokeWidth,F.pixelRatio=K.freehandPixelRatio,F.setColor=F.setColor.bind(F),F.addCanvas=F.addCanvas.bind(F),F.finishCreation=F.finishCreation.bind(F),F.setLineWidth=F.setLineWidth.bind(F),F.colorPanel=new Ue("Color",K.defaultColorSet,K.defaultColor),F.colorPanel.onColorChanged=F.setColor,F.lineWidthPanel=new ht("Line width",K.defaultStrokeWidths,K.defaultStrokeWidth),F.lineWidthPanel.onWidthChanged=F.setLineWidth,F}return De(s,W),s.prototype.ownsTarget=function(m){return!(!W.prototype.ownsTarget.call(this,m)&&m!==this.visual&&m!==this.drawingImage)},s.prototype.createVisual=function(){this.visual=re.createGroup(),this.drawingImage=re.createImage(),this.visual.appendChild(this.drawingImage);var m=re.createTransform();this.visual.transform.baseVal.appendItem(m),this.addMarkerVisualToContainer(this.visual)},s.prototype.pointerDown=function(m,B){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(m.x,m.y),this.drawing=!0):W.prototype.pointerDown.call(this,m,B)},s.prototype.manipulate=function(m){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(m.x,m.y),this.canvasContext.stroke()):W.prototype.manipulate.call(this,m)},s.prototype.resize=function(m){W.prototype.resize.call(this,m),re.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),re.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},s.prototype.pointerUp=function(m){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):W.prototype.pointerUp.call(this,m)},s.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)},s.prototype.select=function(){this.state==="creating"&&this.finishCreation(),W.prototype.select.call(this)},s.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),W.prototype.deselect.call(this)},s.prototype.finishCreation=function(){for(var m=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),B=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],K=B[0],F=B[1],fe=B[2],We=B[3],qe=!1,ut=0;ut<this.canvasElement.height;ut++)for(var He=0;He<this.canvasElement.width;He++)m.data[ut*this.canvasElement.width*4+4*He+3]>0&&(qe=!0,ut<F&&(F=ut),He<K&&(K=He),ut>We&&(We=ut),He>fe&&(fe=He));if(qe){this.left=K/this.pixelRatio,this.top=F/this.pixelRatio,this.width=(fe-K)/this.pixelRatio,this.height=(We-F)/this.pixelRatio;var xt=document.createElement("canvas");xt.width=fe-K,xt.height=We-F,xt.getContext("2d").putImageData(this.canvasContext.getImageData(K,F,fe-K,We-F),0,0),this.drawingImgUrl=xt.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},s.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})},s.prototype.setColor=function(m){this.color=m,this.colorChanged(m)},s.prototype.setLineWidth=function(m){this.lineWidth=m},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return this.state==="new"||this.state==="creating"?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var m=Object.assign({drawingImgUrl:this.drawingImgUrl},W.prototype.getState.call(this));return m.typeName=s.typeName,m},s.prototype.restoreState=function(m){this.createVisual(),W.prototype.restoreState.call(this,m),this.drawingImgUrl=m.drawingImgUrl,this.setDrawingImage()},s.prototype.scale=function(m,B){W.prototype.scale.call(this,m,B),this.setDrawingImage()},s.typeName="FreehandMarker",s.title="Freehand marker",s.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>',s}(Qe),ce=function(W){function s(m,B,K){var F=W.call(this,m,K||'<svg viewBox="0 0 24 24"><path d="M8 14v4l-6-6 6-6v4h8V6l6 6-6 6v-4H8z"/></svg>')||this;return F.typeBoxes=[],F.currentType=B,F.setCurrentType=F.setCurrentType.bind(F),F}return De(s,W),s.prototype.getUi=function(){var m=this,B=document.createElement("div");B.style.display="flex",B.style.overflow="hidden",B.style.flexGrow="2";for(var K=function(We){var qe="both";switch(We){case 0:qe="both";break;case 1:qe="start";break;case 2:qe="end";break;case 3:qe="none"}var ut=document.createElement("div");if(ut.style.display="flex",ut.style.flexGrow="2",ut.style.alignItems="center",ut.style.justifyContent="space-between",ut.style.padding="5px",ut.style.borderWidth="2px",ut.style.borderStyle="solid",ut.style.borderColor=qe===F.currentType?F.uiStyleSettings.toolboxAccentColor:"transparent",ut.addEventListener("click",function(){m.setCurrentType(qe,ut)}),B.appendChild(ut),qe==="both"||qe==="start"){var He=document.createElement("div");He.style.display="flex",He.style.alignItems="center",He.style.minHeight="20px",He.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="`+(F.uiStyleSettings!==void 0?F.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
|
|
</svg>`,He.style.marginLeft="5px",ut.appendChild(He)}var xt=document.createElement("div");xt.style.display="flex",xt.style.alignItems="center",xt.style.minHeight="20px",xt.style.flexGrow="2";var _t=document.createElement("hr");if(_t.style.minWidth="20px",_t.style.border="0px",_t.style.borderTop="3px solid "+(F.uiStyleSettings!==void 0?F.uiStyleSettings.toolboxColor:"#eeeeee"),_t.style.flexGrow="2",xt.appendChild(_t),ut.appendChild(xt),qe==="both"||qe==="end"){var Vt=document.createElement("div");Vt.style.display="flex",Vt.style.alignItems="center",Vt.style.minHeight="20px",Vt.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="`+(F.uiStyleSettings!==void 0?F.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
|
|
</svg>`,Vt.style.marginRight="5px",ut.appendChild(Vt)}F.typeBoxes.push(ut)},F=this,fe=0;fe<4;fe++)K(fe);return B},s.prototype.setCurrentType=function(m,B){var K=this;this.currentType=m,this.typeBoxes.forEach(function(F){F.style.borderColor=F===B?K.uiStyleSettings!==void 0?K.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},s}(Ve),ge=function(W){function s(m,B,K){var F=W.call(this,m,B,K)||this;return F.arrowType="end",F.arrowBaseHeight=10,F.arrowBaseWidth=10,F.getArrowPoints=F.getArrowPoints.bind(F),F.setArrowType=F.setArrowType.bind(F),F.arrowTypePanel=new ce("Arrow type","end"),F.arrowTypePanel.onArrowTypeChanged=F.setArrowType,F}return De(s,W),s.prototype.ownsTarget=function(m){return!(!W.prototype.ownsTarget.call(this,m)&&m!==this.arrow1&&m!==this.arrow2)},s.prototype.getArrowPoints=function(m,B){var K=this.arrowBaseWidth+2*this.strokeWidth,F=this.arrowBaseHeight+2*this.strokeWidth;return m-K/2+","+(B+F/2)+" "+m+","+(B-F/2)+" "+(m+K/2)+","+(B+F/2)},s.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)},s.prototype.pointerDown=function(m,B){W.prototype.pointerDown.call(this,m,B),this.state==="creating"&&this.createTips()},s.prototype.adjustVisual=function(){if(W.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 m=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),B=this.arrow1.transform.baseVal.getItem(0);B.setRotate(m,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(B,0);var K=this.arrow2.transform.baseVal.getItem(0);K.setRotate(m+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(K,0)}},s.prototype.setArrowType=function(m){this.arrowType=m,this.adjustVisual(),this.stateChanged()},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var m=Object.assign({arrowType:this.arrowType},W.prototype.getState.call(this));return m.typeName=s.typeName,m},s.prototype.restoreState=function(m){W.prototype.restoreState.call(this,m);var B=m;this.arrowType=B.arrowType,this.createTips(),this.adjustVisual()},s.typeName="ArrowMarker",s.title="Arrow marker",s.icon='<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 7 15.59V9H5v10h10v-2H8.41L19 6.41z"/></svg>',s}(it),ee=function(W){function s(m,B,K){var F=W.call(this,m,B,K)||this;return F.fillColor=K.defaultFillColor,F.strokeWidth=0,F.fillPanel=new Ue("Color",K.defaultColorSet,K.defaultFillColor),F.fillPanel.onColorChanged=F.setFillColor,F}return De(s,W),Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var m=W.prototype.getState.call(this);return m.typeName=s.typeName,m},s.typeName="CoverMarker",s.title="Cover marker",s.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>',s}($e),te=function(W){function s(m,B,K,F){var fe=W.call(this,m,F||'<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 fe.opacities=[],fe.opacityBoxes=[],fe.opacities=B,fe.currentOpacity=K,fe.setCurrentOpacity=fe.setCurrentOpacity.bind(fe),fe}return De(s,W),s.prototype.getUi=function(){var m=this,B=document.createElement("div");return B.style.display="flex",B.style.overflow="hidden",B.style.flexGrow="2",B.style.justifyContent="space-between",this.opacities.forEach(function(K){var F=document.createElement("div");F.style.display="flex",F.style.alignItems="center",F.style.justifyContent="center",F.style.padding="5px",F.style.borderWidth="2px",F.style.borderStyle="solid",F.style.borderColor=K===m.currentOpacity?m.uiStyleSettings.toolboxAccentColor:"transparent",F.addEventListener("click",function(){m.setCurrentOpacity(K,F)}),B.appendChild(F);var fe=document.createElement("div");fe.innerText=100*K+"%",F.appendChild(fe),m.opacityBoxes.push(F)}),B},s.prototype.setCurrentOpacity=function(m,B){var K=this;this.currentOpacity=m,this.opacityBoxes.forEach(function(F){F.style.borderColor=F===B?K.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},s}(Ve),ie=function(W){function s(m,B,K){var F=W.call(this,m,B,K)||this;return F.setOpacity=F.setOpacity.bind(F),F.fillColor=K.defaultHighlightColor,F.strokeWidth=0,F.opacity=K.defaultHighlightOpacity,F.fillPanel=new Ue("Color",K.defaultColorSet,F.fillColor),F.fillPanel.onColorChanged=F.setFillColor,F.opacityPanel=new te("Opacity",K.defaultOpacitySteps,F.opacity),F.opacityPanel.onOpacityChanged=F.setOpacity,F}return De(s,W),s.prototype.setOpacity=function(m){this.opacity=m,this.visual&&re.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var m=W.prototype.getState.call(this);return m.typeName=s.typeName,m},s.typeName="HighlightMarker",s.title="Highlight marker",s.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>',s}(ee),se='<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>',Ce=function(W){function s(m,B,K){var F=W.call(this,m,B,K)||this;return F.bgColor="transparent",F.tipPosition={x:0,y:0},F.tipBase1Position={x:0,y:0},F.tipBase2Position={x:0,y:0},F.tipMoving=!1,F.color=K.defaultStrokeColor,F.bgColor=K.defaultFillColor,F.fontFamily=K.defaultFontFamily,F.defaultSize={x:100,y:30},F.setBgColor=F.setBgColor.bind(F),F.getTipPoints=F.getTipPoints.bind(F),F.positionTip=F.positionTip.bind(F),F.setTipPoints=F.setTipPoints.bind(F),F.colorPanel=new Ue("Text color",K.defaultColorSet,F.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>'),F.colorPanel.onColorChanged=F.setColor,F.bgColorPanel=new Ue("Fill color",K.defaultColorSet,F.bgColor,se),F.bgColorPanel.onColorChanged=F.setBgColor,F.fontFamilyPanel=new Me("Font",K.defaultFontFamilies,K.defaultFontFamily),F.fontFamilyPanel.onFontChanged=F.setFont,F.tipGrip=new et,F.tipGrip.visual.transform.baseVal.appendItem(re.createTransform()),F.controlBox.appendChild(F.tipGrip.visual),F}return De(s,W),s.prototype.ownsTarget=function(m){return W.prototype.ownsTarget.call(this,m)||this.tipGrip.ownsTarget(m)||this.tip===m},s.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)},s.prototype.pointerDown=function(m,B){this.state==="new"&&W.prototype.pointerDown.call(this,m,B),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(B)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):W.prototype.pointerDown.call(this,m,B)},s.prototype.pointerUp=function(m){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,W.prototype.pointerUp.call(this,m);else{var B=this.state==="creating";W.prototype.pointerUp.call(this,m),this.setTipPoints(B),this.positionTip()}},s.prototype.manipulate=function(m){if(this.tipMoving){var B=this.unrotatePoint(m);this.tipPosition={x:B.x-this.manipulationStartLeft,y:B.y-this.manipulationStartTop},this.positionTip()}else W.prototype.manipulate.call(this,m)},s.prototype.setBgColor=function(m){this.bgRectangle&&this.tip&&(re.setAttributes(this.bgRectangle,[["fill",m]]),re.setAttributes(this.tip,[["fill",m]])),this.bgColor=m,this.fillColorChanged(m)},s.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},s.prototype.setTipPoints=function(m){m===void 0&&(m=!1);var B=Math.min(this.height/2,15),K=this.height/5;m&&(this.tipPosition={x:B+K/2,y:this.height+20});var F=Math.atan(this.height/2/(this.width/2));this.tipPosition.x<this.width/2&&this.tipPosition.y<this.height/2?F<Math.atan((this.height/2-this.tipPosition.y)/(this.width/2-this.tipPosition.x))?(K=this.width/5,B=Math.min(this.width/2,15),this.tipBase1Position={x:B,y:0},this.tipBase2Position={x:B+K,y:0}):(this.tipBase1Position={x:0,y:B},this.tipBase2Position={x:0,y:B+K}):this.tipPosition.x>=this.width/2&&this.tipPosition.y<this.height/2?F<Math.atan((this.height/2-this.tipPosition.y)/(this.tipPosition.x-this.width/2))?(K=this.width/5,B=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-B-K,y:0},this.tipBase2Position={x:this.width-B,y:0}):(this.tipBase1Position={x:this.width,y:B},this.tipBase2Position={x:this.width,y:B+K}):this.tipPosition.x>=this.width/2&&this.tipPosition.y>=this.height/2?F<Math.atan((this.tipPosition.y-this.height/2)/(this.tipPosition.x-this.width/2))?(K=this.width/5,B=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-B-K,y:this.height},this.tipBase2Position={x:this.width-B,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-B-K},this.tipBase2Position={x:this.width,y:this.height-B}):F<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?(K=this.width/5,B=Math.min(this.width/2,15),this.tipBase1Position={x:B,y:this.height},this.tipBase2Position={x:B+K,y:this.height}):(this.tipBase1Position={x:0,y:this.height-B},this.tipBase2Position={x:0,y:this.height-B-K})},s.prototype.resize=function(m){W.prototype.resize.call(this,m),this.positionTip()},s.prototype.positionTip=function(){re.setAttributes(this.tip,[["points",this.getTipPoints()]]);var m=this.tipGrip.visual.transform.baseVal.getItem(0);m.setTranslate(this.tipPosition.x,this.tipPosition.y),this.tipGrip.visual.transform.baseVal.replaceItem(m,0)},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.bgColorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),s.prototype.select=function(){this.positionTip(),W.prototype.select.call(this)},s.prototype.getState=function(){var m=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},W.prototype.getState.call(this));return m.typeName=s.typeName,m},s.prototype.restoreState=function(m){var B=m;this.bgColor=B.bgColor,this.tipPosition=B.tipPosition,W.prototype.restoreState.call(this,m),this.createTip(),this.setTipPoints()},s.prototype.scale=function(m,B){W.prototype.scale.call(this,m,B),this.tipPosition={x:this.tipPosition.x*m,y:this.tipPosition.y*B},this.positionTip()},s.typeName="CalloutMarker",s.title="Callout marker",s.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>',s}(Ge),xe=function(W){function s(m,B,K){var F=W.call(this,m,B,K)||this;return F.fillColor="transparent",F.strokeColor="transparent",F.strokeWidth=0,F.strokeDasharray="",F.opacity=1,F.strokeColor=K.defaultColor,F.strokeWidth=K.defaultStrokeWidth,F.strokeDasharray=K.defaultStrokeDasharray,F.fillColor=K.defaultFillColor,F.setStrokeColor=F.setStrokeColor.bind(F),F.setFillColor=F.setFillColor.bind(F),F.setStrokeWidth=F.setStrokeWidth.bind(F),F.setStrokeDasharray=F.setStrokeDasharray.bind(F),F.setOpacity=F.setOpacity.bind(F),F.createVisual=F.createVisual.bind(F),F.strokePanel=new Ue("Line color",ae(K.defaultColorSet,["transparent"]),K.defaultColor),F.strokePanel.onColorChanged=F.setStrokeColor,F.fillPanel=new Ue("Fill color",ae(K.defaultColorSet,["transparent"]),F.fillColor,se),F.fillPanel.onColorChanged=F.setFillColor,F.strokeWidthPanel=new ht("Line width",K.defaultStrokeWidths,K.defaultStrokeWidth),F.strokeWidthPanel.onWidthChanged=F.setStrokeWidth,F.strokeStylePanel=new Xe("Line style",K.defaultStrokeDasharrays,K.defaultStrokeDasharray),F.strokeStylePanel.onStyleChanged=F.setStrokeDasharray,F.opacityPanel=new te("Opacity",K.defaultOpacitySteps,F.opacity),F.opacityPanel.onOpacityChanged=F.setOpacity,F}return De(s,W),s.prototype.ownsTarget=function(m){return!(!W.prototype.ownsTarget.call(this,m)&&m!==this.visual)},s.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)},s.prototype.pointerDown=function(m,B){W.prototype.pointerDown.call(this,m,B),this.state==="new"&&(this.createVisual(),this.moveVisual(m),this._state="creating")},s.prototype.manipulate=function(m){W.prototype.manipulate.call(this,m)},s.prototype.resize=function(m){W.prototype.resize.call(this,m),this.setSize()},s.prototype.setSize=function(){W.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()]])},s.prototype.pointerUp=function(m){W.prototype.pointerUp.call(this,m),this.setSize()},s.prototype.setStrokeColor=function(m){this.strokeColor=m,this.visual&&re.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(m),this.stateChanged()},s.prototype.setFillColor=function(m){this.fillColor=m,this.visual&&re.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(m),this.stateChanged()},s.prototype.setStrokeWidth=function(m){this.strokeWidth=m,this.visual&&re.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},s.prototype.setStrokeDasharray=function(m){this.strokeDasharray=m,this.visual&&re.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},s.prototype.setOpacity=function(m){this.opacity=m,this.visual&&re.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var m=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},W.prototype.getState.call(this));return m.typeName=s.typeName,m},s.prototype.restoreState=function(m){var B=m;this.fillColor=B.fillColor,this.strokeColor=B.strokeColor,this.strokeWidth=B.strokeWidth,this.strokeDasharray=B.strokeDasharray,this.opacity=B.opacity,this.createVisual(),W.prototype.restoreState.call(this,m),this.setSize()},s.prototype.scale=function(m,B){W.prototype.scale.call(this,m,B),this.setSize()},s.typeName="EllipseMarker",s.title="Ellipse marker",s.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>',s}(Qe),je=function(W){function s(m,B,K){return W.call(this,m,B,K)||this}return De(s,W),Object.defineProperty(s.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),s.prototype.ownsTarget=function(m){return!(!W.prototype.ownsTarget.call(this,m)&&m!==this.tip1&&m!==this.tip2)},s.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)},s.prototype.pointerDown=function(m,B){W.prototype.pointerDown.call(this,m,B),this.state==="creating"&&this.createTips()},s.prototype.adjustVisual=function(){if(W.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 m=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),B=this.tip1.transform.baseVal.getItem(0);B.setRotate(m,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(B,0);var K=this.tip2.transform.baseVal.getItem(0);K.setRotate(m+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(K,0)}},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var m=W.prototype.getState.call(this);return m.typeName=s.typeName,m},s.prototype.restoreState=function(m){W.prototype.restoreState.call(this,m),this.createTips(),this.adjustVisual()},s.typeName="MeasurementMarker",s.title="Measurement marker",s.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>',s}(it),nt=function(W){function s(m,B,K){var F=W.call(this,m,B,K)||this;return F.strokePanel.colors=K.defaultColorSet,F.fillColor="transparent",F}return De(s,W),Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var m=W.prototype.getState.call(this);return m.typeName=s.typeName,m},s.typeName="EllipseFrameMarker",s.title="Ellipse frame marker",s.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>',s}(xe),ft=function(){function W(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(W.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),W.prototype.addUndoStep=function(s){this.undoStack.length!==0&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(s)||(this.undoStack.push(s),JSON.stringify(this.lastRedoStep)!==JSON.stringify(s)&&this.redoStack.splice(0,this.redoStack.length))},W.prototype.replaceLastUndoStep=function(s){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=s)},W.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},W.prototype.undo=function(){if(this.undoStack.length>1){var s=this.undoStack.pop();return s!==void 0&&this.redoStack.push(s),this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0}},W.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},W}(),lt=function(W){function s(m,B,K){var F=W.call(this,m,B,K)||this;return F.strokeColor="transparent",F.strokeWidth=0,F.strokeDasharray="",F.curveX=0,F.curveY=0,F.manipulationStartCurveX=0,F.manipulationStartCurveY=0,F.setStrokeColor=F.setStrokeColor.bind(F),F.setStrokeWidth=F.setStrokeWidth.bind(F),F.setStrokeDasharray=F.setStrokeDasharray.bind(F),F.positionGrips=F.positionGrips.bind(F),F.addControlGrips=F.addControlGrips.bind(F),F.adjustVisual=F.adjustVisual.bind(F),F.setupControlBox=F.setupControlBox.bind(F),F.resize=F.resize.bind(F),F.strokeColor=K.defaultColor,F.strokeWidth=K.defaultStrokeWidth,F.strokeDasharray=K.defaultStrokeDasharray,F.strokePanel=new Ue("Line color",K.defaultColorSet,K.defaultColor),F.strokePanel.onColorChanged=F.setStrokeColor,F.strokeWidthPanel=new ht("Line width",K.defaultStrokeWidths,K.defaultStrokeWidth),F.strokeWidthPanel.onWidthChanged=F.setStrokeWidth,F.strokeStylePanel=new Xe("Line style",K.defaultStrokeDasharrays,K.defaultStrokeDasharray),F.strokeStylePanel.onStyleChanged=F.setStrokeDasharray,F}return De(s,W),s.prototype.ownsTarget=function(m){return!(!W.prototype.ownsTarget.call(this,m)&&m!==this.visual&&m!==this.selectorCurve&&m!==this.visibleCurve&&!this.curveGrip.ownsTarget(m))},s.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},s.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)},s.prototype.pointerDown=function(m,B){W.prototype.pointerDown.call(this,m,B),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=m.x,this.curveY=m.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(B)&&(this.activeGrip=this.curveGrip,this._state="resize")},s.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()]]))},s.prototype.setupControlBox=function(){W.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)},s.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,W.prototype.addControlGrips.call(this)},s.prototype.positionGrips=function(){W.prototype.positionGrips.call(this);var m=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-m/2,this.curveY-m/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()))},s.prototype.manipulate=function(m){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+m.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+m.y-this.manipulationStartY),W.prototype.manipulate.call(this,m)},s.prototype.resize=function(m){this.activeGrip===this.curveGrip&&(this.curveX=m.x,this.curveY=m.y),W.prototype.resize.call(this,m),this.state==="creating"&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},s.prototype.setStrokeColor=function(m){this.strokeColor=m,this.adjustVisual(),this.colorChanged(m)},s.prototype.setStrokeWidth=function(m){this.strokeWidth=m,this.adjustVisual()},s.prototype.setStrokeDasharray=function(m){this.strokeDasharray=m,this.adjustVisual()},s.prototype.scale=function(m,B){this.curveX=this.curveX*m,this.curveY=this.curveY*B,W.prototype.scale.call(this,m,B)},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var m=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},W.prototype.getState.call(this));return m.typeName=s.typeName,m},s.prototype.restoreState=function(m){W.prototype.restoreState.call(this,m);var B=m;this.strokeColor=B.strokeColor,this.strokeWidth=B.strokeWidth,this.strokeDasharray=B.strokeDasharray,this.curveX=B.curveX,this.curveY=B.curveY,this.createVisual(),this.adjustVisual()},s.typeName="CurveMarker",s.title="Curve marker",s.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>',s}(at),wt=function(){function W(s,m){m===void 0&&(m=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=s,this.cancelable=m}return Object.defineProperty(W.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),W.prototype.preventDefault=function(){this._defaultPrevented=!0},W}(),Et=function(W){function s(m,B,K){var F=W.call(this,m,!1)||this;return F.dataUrl=B,F.state=K,F}return De(s,W),s}(wt),ct=function(W){function s(m,B,K){K===void 0&&(K=!1);var F=W.call(this,m,K)||this;return F.marker=B,F}return De(s,W),s}(wt),zt=function(){function W(){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 W.prototype.addEventListener=function(s,m){this[s].push(m)},W.prototype.removeEventListener=function(s,m){var B=this[s].indexOf(m);B>-1&&this[s].splice(B,1)},W}(),It=function(){function W(s){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new ke,this._isOpen=!1,this.undoRedoManager=new ft,this.renderAtNaturalSize=!1,this.renderImageType="image/png",this.renderMarkersOnly=!1,this.zoomSteps=[1,1.5,2,4],this._zoomLevel=1,this._isResizing=!1,this.prevPanPoint={x:0,y:0},this.eventListeners=new zt,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=W.instanceCounter++,this.styles=new Ae(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=s,this.targetRoot=document.body,this.width=s.clientWidth,this.height=s.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(W.prototype,"ALL_MARKER_TYPES",{get:function(){return[Ze,ye,ge,Ge,nt,xe,ie,Ce,je,ee,it,lt]},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[Ze,ye,ge,Ge,xe,ie,Ce]},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"BASIC_MARKER_TYPES",{get:function(){return[Ze,ye,ge,Ge,ie]},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(s){var m=this;this._availableMarkerTypes.splice(0),s.forEach(function(B){if(typeof B=="string"){var K=m.ALL_MARKER_TYPES.find(function(F){return F.typeName===B});K!==void 0&&m._availableMarkerTypes.push(K)}else m._availableMarkerTypes.push(B)})},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"zoomLevel",{get:function(){return this._zoomLevel},set:function(s){this._zoomLevel=s,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(W.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),W.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),this.settings.displayMode==="popup"&&this.onPopupTargetResize(),we.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},W.prototype.show=function(){var s=this;this.styles.styleSheetRoot===void 0&&Re.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=Re.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(m){return m(new wt(s))})},W.prototype.render=function(){return de(this,void 0,void 0,function(){var s;return pe(this,function(m){switch(m.label){case 0:return this.setCurrentMarker(),(s=new ve).naturalSize=this.renderAtNaturalSize,s.imageType=this.renderImageType,s.imageQuality=this.renderImageQuality,s.markersOnly=this.renderMarkersOnly,s.width=this.renderWidth,s.height=this.renderHeight,[4,s.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return m.sent(),[4,s.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,m.sent()]}})})},W.prototype.close=function(s){var m=this;if(s===void 0&&(s=!1),this.isOpen){var B=!1;s||this.eventListeners.beforeclose.forEach(function(K){var F=new wt(m,!0);K(F),F.defaultPrevented&&(B=!0)}),B||(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(K){return K(new wt(m))}),this.detachEvents(),this._isOpen=!1)}},W.prototype.addMarkersToToolbar=function(){for(var s,m=[],B=0;B<arguments.length;B++)m[B]=arguments[B];(s=this._availableMarkerTypes).push.apply(s,m)},W.prototype.addRenderEventListener=function(s){this.addEventListener("render",function(m){s(m.dataUrl,m.state)})},W.prototype.removeRenderEventListener=function(s){},W.prototype.addCloseEventListener=function(s){this.addEventListener("close",function(){s()})},W.prototype.removeCloseEventListener=function(s){},W.prototype.setupResizeObserver=function(){var s=this;this.settings.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){s.resize(s.target.clientWidth,s.target.clientHeight)}),this.targetObserver.observe(this.target)):this.settings.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){return s.onPopupTargetResize()}),this.targetObserver.observe(this.editorCanvas)),window.addEventListener("resize",this.setWindowHeight))},W.prototype.onPopupTargetResize=function(){var s=1*this.target.clientWidth/this.target.clientHeight,m=this.editorCanvas.clientWidth/s>this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*s:this.editorCanvas.clientWidth,B=m<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/s;this.resize(m,B)},W.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},W.prototype.resize=function(s,m){this._isResizing=!0;var B=s/this.imageWidth,K=m/this.imageHeight;this.imageWidth=Math.round(s),this.imageHeight=Math.round(m),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(B,K),this._isResizing=!1},W.prototype.scaleMarkers=function(s,m){var B,K=this;this._currentMarker&&this._currentMarker instanceof Ge?this._currentMarker.scale(s,m):(B=this._currentMarker,this.setCurrentMarker()),this.markers.forEach(function(F){F!==K._currentMarker&&F.scale(s,m)}),B!==void 0&&this.setCurrentMarker(B)},W.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"},W.prototype.setTopLeft=function(){var s=this.editingTarget.getBoundingClientRect(),m=this.editorCanvas.getBoundingClientRect();this.left=s.left-m.left,this.top=s.top-m.top},W.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)},W.prototype.addDefs=function(){for(var s,m=[],B=0;B<arguments.length;B++)m[B]=arguments[B];this.defs=re.createDefs(),this.addDefsToImage(),(s=this.defs).append.apply(s,m)},W.prototype.addDefsToImage=function(){this.defs&&this.markerImage.insertBefore(this.defs,this.markerImage.firstChild)},W.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)},W.prototype.positionMarkerImage=function(){this.markerImageHolder.style.top=this.top/this.zoomLevel+"px",this.markerImageHolder.style.left=this.left/this.zoomLevel+"px"},W.prototype.attachEvents=function(){this.markerImage.addEventListener("pointerdown",this.onPointerDown),this.markerImage.addEventListener("dblclick",this.onDblClick),this.attachWindowEvents()},W.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)},W.prototype.detachEvents=function(){this.markerImage.removeEventListener("pointerdown",this.onPointerDown),this.markerImage.removeEventListener("dblclick",this.onDblClick),this.detachWindowEvents()},W.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)},W.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 s=document.createElement("a");s.href="https://markerjs.com/",s.target="_blank",s.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>',s.title="Powered by marker.js",s.style.display="grid",s.style.alignItems="center",s.style.justifyItems="center",s.style.padding="3px",s.style.width="20px",s.style.height="20px",this.logoUI.appendChild(s),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},W.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")},W.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"},W.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},W.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 s=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=s+"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 _e(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 Ie(this.uiDiv,this.settings.displayMode,this.uiStyleSettings,this.styles),this.toolbox.show(this._silentRenderMode||this.uiStyleSettings.hideToolbox?"hidden":"visible")},W.prototype.closeUI=function(){this.settings.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},W.prototype.removeMarker=function(s){this.markerImage.removeChild(s.container),this.markers.indexOf(s)>-1&&this.markers.splice(this.markers.indexOf(s),1),s.dispose()},W.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())},W.prototype.toolbarButtonClicked=function(s,m){if(s==="marker"&&m!==void 0)this.createNewMarker(m);else if(s==="action")switch(m){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()}},W.prototype.deleteSelectedMarker=function(){var s=this;if(this._currentMarker!==void 0){var m=!1;if(this.eventListeners.markerbeforedelete.forEach(function(K){var F=new ct(s,s._currentMarker,!0);K(F),F.defaultPrevented&&(m=!0)}),!m){var B=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(K){return K(new ct(s,B))})}}},W.prototype.clear=function(){var s=this,m=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(fe){var We=new ct(s,void 0,!0);fe(We),We.defaultPrevented&&(m=!0)}),!m)){this.setCurrentMarker();for(var B=function(fe){var We=K.markers[fe];K.setCurrentMarker(K.markers[fe]),K._currentMarker.dispose(),K.markerImage.removeChild(K._currentMarker.container),K.markers.splice(K.markers.indexOf(K._currentMarker),1),K.eventListeners.markerdelete.forEach(function(qe){return qe(new ct(s,We))})},K=this,F=this.markers.length-1;F>=0;F--)B(F);this.addUndoStep()}},Object.defineProperty(W.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),W.prototype.showNotesEditor=function(){var s;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=(s=this._currentMarker.notes)!==null&&s!==void 0?s:"",this.overlayContainer.appendChild(this.notesArea))},W.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)},W.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},W.prototype.addUndoStep=function(){var s=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var m=this.getState(),B=this.undoRedoManager.getLastUndoStep();if(!B||B.width===m.width&&B.height===m.height){var K=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(m),K<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach(function(F){return F(new wt(s))})}else this.undoRedoManager.replaceLastUndoStep(m),this.eventListeners.statechange.forEach(function(F){return F(new wt(s))})}},W.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},W.prototype.undoStep=function(){var s=this,m=this.undoRedoManager.undo();m!==void 0&&(this.restoreState(m),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(B){return B(new wt(s))}))},W.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},W.prototype.redoStep=function(){var s=this,m=this.undoRedoManager.redo();m!==void 0&&(this.restoreState(m),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(B){return B(new wt(s))}))},W.prototype.stepZoom=function(){var s=this.zoomSteps.indexOf(this.zoomLevel);this.zoomLevel=s<this.zoomSteps.length-1?this.zoomSteps[s+1]:this.zoomSteps[0]},W.prototype.panTo=function(s){this.contentDiv.scrollBy({left:this.prevPanPoint.x-s.x,top:this.prevPanPoint.y-s.y}),this.prevPanPoint=s},W.prototype.startRenderAndClose=function(){return de(this,void 0,void 0,function(){var s,m,B=this;return pe(this,function(K){switch(K.label){case 0:return[4,this.render()];case 1:return s=K.sent(),m=this.getState(),this.eventListeners.render.forEach(function(F){return F(new Et(B,s,m))}),this.close(!0),[2]}})})},W.prototype.getState=function(s){s===!0&&this.setCurrentMarker();var m={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach(function(B){return m.markers.push(B.getState())}),m},W.prototype.restoreState=function(s){var m=this;for(this.markers.splice(0);this.markerImage.lastChild;)this.markerImage.removeChild(this.markerImage.lastChild);s.markers.forEach(function(B){var K=m._availableMarkerTypes.find(function(fe){return fe.typeName===B.typeName});if(K!==void 0){var F=m.addNewMarker(K);F.restoreState(B),m.markers.push(F)}}),s.width&&s.height&&(s.width!==this.imageWidth||s.height!==this.imageHeight)&&this.scaleMarkers(this.imageWidth/s.width,this.imageHeight/s.height),this.eventListeners.restorestate.forEach(function(B){return B(new wt(m))})},W.prototype.addNewMarker=function(s){var m=re.createGroup();return this.markerImage.appendChild(m),new s(m,this.overlayContainer,this.settings)},W.prototype.createNewMarker=function(s){var m,B=this;(m=typeof s=="string"?this._availableMarkerTypes.find(function(K){return K.typeName===s}):s)&&(this.setCurrentMarker(),this.addUndoStep(),this._currentMarker=this.addNewMarker(m),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(m.typeName),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this.eventListeners.markercreating.forEach(function(K){return K(new ct(B,B._currentMarker))}))},W.prototype.markerCreated=function(s){var m=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(s),this.setCurrentMarker(s),s instanceof ye&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(ye):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach(function(B){return B(new ct(m,m._currentMarker))})},W.prototype.colorChanged=function(s){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultColor=s,this.settings.defaultStrokeColor=s)},W.prototype.fillColorChanged=function(s){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultFillColor=s)},W.prototype.markerStateChanged=function(s){var m=this;this.eventListeners.markerchange.forEach(function(B){return B(new ct(m,s))})},W.prototype.setCurrentMarker=function(s){var m=this;this._currentMarker!==s&&this._currentMarker!==void 0&&(this._currentMarker.deselect(),this.toolbar.setCurrentMarker(),this.toolbox.setPanelButtons([]),this._isResizing||this.eventListeners.markerdeselect.forEach(function(B){return B(new ct(m,m._currentMarker))})),this._currentMarker=s,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(B){return B(new ct(m,m._currentMarker))}))},W.prototype.onPointerDown=function(s){if(this._isFocused||this.focus(),this.touchPoints++,this.touchPoints===1||s.pointerType!=="touch")if(this._currentMarker===void 0||this._currentMarker.state!=="new"&&this._currentMarker.state!=="creating"){if(this.mode==="select"){var m=this.markers.find(function(B){return B.ownsTarget(s.target)});m!==void 0?(this.setCurrentMarker(m),this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(s.clientX,s.clientY),s.target)):(this.setCurrentMarker(),this.isDragging=!0,this.prevPanPoint={x:s.clientX,y:s.clientY})}}else this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(s.clientX,s.clientY))},W.prototype.onDblClick=function(s){if(this._isFocused||this.focus(),this.mode==="select"){var m=this.markers.find(function(B){return B.ownsTarget(s.target)});m!==void 0&&m!==this._currentMarker&&this.setCurrentMarker(m),this._currentMarker!==void 0?this._currentMarker.dblClick(this.clientToLocalCoordinates(s.clientX,s.clientY),s.target):this.setCurrentMarker()}},W.prototype.onPointerMove=function(s){this.touchPoints!==1&&s.pointerType==="touch"||(this._currentMarker!==void 0||this.isDragging)&&(this._currentMarker!==void 0&&this._currentMarker.state==="edit"||s.preventDefault(),this._currentMarker!==void 0?this._currentMarker.manipulate(this.clientToLocalCoordinates(s.clientX,s.clientY)):this.zoomLevel>1&&this.panTo({x:s.clientX,y:s.clientY}))},W.prototype.onPointerUp=function(s){this.touchPoints>0&&this.touchPoints--,this.touchPoints===0&&this.isDragging&&this._currentMarker!==void 0&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(s.clientX,s.clientY)),this.isDragging=!1,this.addUndoStep()},W.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},W.prototype.onKeyUp=function(s){this._currentMarker===void 0||this.notesArea!==void 0||s.key!=="Delete"&&s.key!=="Backspace"||this.deleteSelectedMarker()},W.prototype.clientToLocalCoordinates=function(s,m){var B=this.markerImage.getBoundingClientRect();return{x:(s-B.left)/this.zoomLevel,y:(m-B.top)/this.zoomLevel}},W.prototype.onWindowResize=function(){this.positionUI()},W.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var s=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=s+"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()},W.prototype.addLicenseKey=function(s){we.addKey(s)},W.prototype.addEventListener=function(s,m){this.eventListeners.addEventListener(s,m)},W.prototype.removeEventListener=function(s,m){this.eventListeners.removeEventListener(s,m)},W.prototype.renderState=function(s){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(s),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(W.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),W.prototype.focus=function(){var s=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,this._previousCurrentMarker!==void 0&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach(function(m){return m(new wt(s))}))},W.prototype.blur=function(){var s=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(m){return m(new wt(s))}))},W.instanceCounter=0,W}();/* **********************************
|
|
cropro version 1.2.0
|
|
@license SEE LICENSE IN LICENSE
|
|
|
|
copyright Alan Mendelevich
|
|
see README and LICENSE for details
|
|
********************************** *//*! *****************************************************************************
|
|
Copyright (c) Microsoft Corporation.
|
|
|
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
purpose with or without fee is hereby granted.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
PERFORMANCE OF THIS SOFTWARE.
|
|
***************************************************************************** */var Kt=function(W,s){return(Kt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(m,B){m.__proto__=B}||function(m,B){for(var K in B)Object.prototype.hasOwnProperty.call(B,K)&&(m[K]=B[K])})(W,s)};function Wt(W,s){if(typeof s!="function"&&s!==null)throw new TypeError("Class extends value "+String(s)+" is not a constructor or null");function m(){this.constructor=W}Kt(W,s),W.prototype=s===null?Object.create(s):(m.prototype=s.prototype,new m)}function Lt(W,s,m,B){return new(m||(m=Promise))(function(K,F){function fe(ut){try{qe(B.next(ut))}catch(He){F(He)}}function We(ut){try{qe(B.throw(ut))}catch(He){F(He)}}function qe(ut){var He;ut.done?K(ut.value):(He=ut.value,He instanceof m?He:new m(function(xt){xt(He)})).then(fe,We)}qe((B=B.apply(W,s||[])).next())})}function Wr(W,s){var m,B,K,F,fe={label:0,sent:function(){if(1&K[0])throw K[1];return K[1]},trys:[],ops:[]};return F={next:We(0),throw:We(1),return:We(2)},typeof Symbol=="function"&&(F[Symbol.iterator]=function(){return this}),F;function We(qe){return function(ut){return function(He){if(m)throw new TypeError("Generator is already executing.");for(;fe;)try{if(m=1,B&&(K=2&He[0]?B.return:He[0]?B.throw||((K=B.return)&&K.call(B),0):B.next)&&!(K=K.call(B,He[1])).done)return K;switch(B=0,K&&(He=[2&He[0],K.value]),He[0]){case 0:case 1:K=He;break;case 4:return fe.label++,{value:He[1],done:!1};case 5:fe.label++,B=He[1],He=[0];continue;case 7:He=fe.ops.pop(),fe.trys.pop();continue;default:if(!(K=fe.trys,(K=K.length>0&&K[K.length-1])||He[0]!==6&&He[0]!==2)){fe=0;continue}if(He[0]===3&&(!K||He[1]>K[0]&&He[1]<K[3])){fe.label=He[1];break}if(He[0]===6&&fe.label<K[1]){fe.label=K[1],K=He;break}if(K&&fe.label<K[2]){fe.label=K[2],fe.ops.push(He);break}K[2]&&fe.ops.pop(),fe.trys.pop();continue}He=s.call(W,fe)}catch(xt){He=[6,xt],B=0}finally{m=K=0}if(5&He[0])throw He[1];return{value:He[0]?He[1]:void 0,done:!0}}([qe,ut])}}}var ai=function(){function W(){}return W.addKey=function(s){W.key=s},Object.defineProperty(W,"isLicensed",{get:function(){return!!W.key&&new RegExp(/^CRPR-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(W.key)},enumerable:!1,configurable:!0}),W}(),vt=function(){function W(){}return W.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},W.setAttributes=function(s,m){for(var B=0,K=m;B<K.length;B++){var F=K[B],fe=F[0],We=F[1];s.setAttribute(fe,We)}},W.createRect=function(s,m,B){var K=document.createElementNS("http://www.w3.org/2000/svg","rect");return K.setAttribute("width",s.toString()),K.setAttribute("height",m.toString()),B&&W.setAttributes(K,B),K},W.createLine=function(s,m,B,K,F){var fe=document.createElementNS("http://www.w3.org/2000/svg","line");return fe.setAttribute("x1",s.toString()),fe.setAttribute("y1",m.toString()),fe.setAttribute("x2",B.toString()),fe.setAttribute("y2",K.toString()),F&&W.setAttributes(fe,F),fe},W.createPolygon=function(s,m){var B=document.createElementNS("http://www.w3.org/2000/svg","polygon");return B.setAttribute("points",s),m&&W.setAttributes(B,m),B},W.createCircle=function(s,m){var B=document.createElementNS("http://www.w3.org/2000/svg","circle");return B.setAttribute("cx",(s/2).toString()),B.setAttribute("cy",(s/2).toString()),B.setAttribute("r",s.toString()),m&&W.setAttributes(B,m),B},W.createEllipse=function(s,m,B){var K=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return K.setAttribute("cx",(s/2).toString()),K.setAttribute("cy",(m/2).toString()),K.setAttribute("rx",(s/2).toString()),K.setAttribute("ry",(m/2).toString()),B&&W.setAttributes(K,B),K},W.createGroup=function(s){var m=document.createElementNS("http://www.w3.org/2000/svg","g");return s&&W.setAttributes(m,s),m},W.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},W.createMarker=function(s,m,B,K,F,fe,We){var qe=document.createElementNS("http://www.w3.org/2000/svg","marker");return W.setAttributes(qe,[["id",s],["orient",m],["markerWidth",B.toString()],["markerHeight",K.toString()],["refX",F.toString()],["refY",fe.toString()]]),qe.appendChild(We),qe},W.createText=function(s){var m=document.createElementNS("http://www.w3.org/2000/svg","text");return m.setAttribute("x","0"),m.setAttribute("y","0"),s&&W.setAttributes(m,s),m},W.createTSpan=function(s,m){var B=document.createElementNS("http://www.w3.org/2000/svg","tspan");return B.textContent=s,m&&W.setAttributes(B,m),B},W.createImage=function(s){var m=document.createElementNS("http://www.w3.org/2000/svg","image");return s&&W.setAttributes(m,s),m},W.createPoint=function(s,m){var B=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return B.x=s,B.y=m,B},W.createPath=function(s,m){var B=document.createElementNS("http://www.w3.org/2000/svg","path");return B.setAttribute("d",s),m&&W.setAttributes(B,m),B},W.createElement=function(s,m){var B=document.createElementNS("http://www.w3.org/2000/svg",s);return m&&W.setAttributes(B,m),B},W.getHollowRectanglePath=function(s,m,B,K,F,fe,We,qe){return"M"+s+","+m+"V"+(m+K)+"H"+(s+B)+"V"+m+"H"+F+"V"+fe+"H"+(F+We)+"V"+(fe+qe)+"H"+F+"V"+m+"Z"},W}(),Vr=function(){function W(s){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+s+"_"}return Object.defineProperty(W.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(W.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(W.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_out"},enumerable:!1,configurable:!0}),W.prototype.addClass=function(s){return this.styleSheet===void 0&&this.addStyleSheet(),s.name=""+this.classNamePrefix+s.localName,this.classes.push(s),this.styleSheet.sheet.insertRule("."+s.name+" {"+s.style+"}",this.styleSheet.sheet.cssRules.length),s},W.prototype.addRule=function(s){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(s),this.styleSheet.sheet.insertRule(s.selector+" {"+s.style+"}",this.styleSheet.sheet.cssRules.length)},W.prototype.addStyleSheet=function(){var s;this.styleSheet=document.createElement("style"),((s=this.styleSheetRoot)!==null&&s!==void 0?s:document.head).appendChild(this.styleSheet),this.addRule(new nr("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new nr("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
|
|
from {
|
|
opacity: 0;
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
}
|
|
`)),this.addRule(new nr("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
|
|
from {
|
|
opacity: 1;
|
|
}
|
|
to {
|
|
opacity: 0;
|
|
}
|
|
`)),this.addClass(new cr("_fade_in",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
|
|
`)),this.addClass(new cr("_fade_out",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
|
|
`))},W.prototype.removeStyleSheet=function(){var s;this.styleSheet&&(((s=this.styleSheetRoot)!==null&&s!==void 0?s:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},W}(),nr=function(W,s){this.selector=W,this.style=s},cr=function(W,s){this.localName=W,this.style=s},Hr=function(){function W(){this.blocks=[],this.display=""}return W.prototype.addButtonBlock=function(s){s.className=this.blockClassName,s.buttonClassName=this.buttonClassName,s.buttonColorsClassName=this.buttonColorsClassName,s.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(s)},W.prototype.addElementBlock=function(s){s.className===void 0&&(s.className=this.blockClassName),this.blocks.push(s)},W.prototype.getUI=function(){var s=document.createElement("div");return s.className=this.className+" "+this.colorsClassName+" "+this.fadeInClassName,s.style.display=this.display,this.blocks.forEach(function(m){return s.appendChild(m.getUI())}),s},W}(),oi=function(){function W(){}return W.prototype.getUI=function(){var s=document.createElement("div");if(s.className=this.className,this.minWidth!==void 0&&(s.style.minWidth=this.minWidth),this.contentAlign!==void 0)switch(this.contentAlign){case"start":s.style.justifyContent="flex-start";break;case"center":s.style.justifyContent="center";break;case"end":s.style.justifyContent="flex-end"}return s.style.whiteSpace="nowrap",s},W}(),si=function(W){function s(){var m=W!==null&&W.apply(this,arguments)||this;return m.buttons=[],m}return Wt(s,W),s.prototype.addButton=function(m){m.className=this.buttonClassName,m.colorsClassName=this.buttonColorsClassName,m.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(m)},s.prototype.getUI=function(){var m=W.prototype.getUI.call(this);return this.buttons.forEach(function(B){return m.appendChild(B.getUI())}),m},s}(oi),Pt=function(){function W(s,m){this._isActive=!1,this._isHidden=!1,this._icon=s,this.title=m,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(W.prototype,"icon",{get:function(){return this._icon},set:function(s){this._icon=s,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"isActive",{get:function(){return this._isActive},set:function(s){this._isActive=s,this.adjustClassName()},enumerable:!1,configurable:!0}),W.prototype.getUI=function(){var s=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 s.onClick()}),this.uiContainer.appendChild(this.buttonContainer),this.uiContainer.style.display=this._isHidden?"none":"inline-block",this.uiContainer},W.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,"")))},W.prototype.hide=function(){this._isHidden=!0},W}(),pt=function(W){function s(){var m=W!==null&&W.apply(this,arguments)||this;return m.elements=[],m}return Wt(s,W),s.prototype.addElement=function(m){this.elements.push(m)},s.prototype.getUI=function(){var m=W.prototype.getUI.call(this);return this.elements.forEach(function(B){return m.appendChild(B)}),m},s}(oi),Pr=function(){function W(s,m){this.horizontal=s,this.vertical=m}return Object.defineProperty(W.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),W.prototype.getVerticalLength=function(s){return s/this.ratio},W.prototype.getHorizontalLength=function(s){return s*this.ratio},W}(),li=function(){function W(){}return W.getIcon=function(s,m){if(s>0&&m>0){var B=new Pr(s,m),K=B.ratio>=1?20:B.getHorizontalLength(20),F=B.ratio<1?20:B.getVerticalLength(20),fe=document.createElementNS("http://www.w3.org/2000/svg","svg");fe.setAttribute("xmlns","http://www.w3.org/2000/svg"),fe.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(fe);var We=vt.createDefs();fe.appendChild(We);var qe=vt.createElement("clipPath",[["id","text-bg-clip"]]);We.appendChild(qe);var ut=vt.createPath(vt.getHollowRectanglePath((24-K)/2,(24-F)/2,K,F,(24-K)/2+2,(24-F)/2+2,K-4,F-4));fe.appendChild(ut);var He=vt.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);He.appendChild(vt.createTSpan(s+":"+m)),fe.appendChild(He);var xt=He.getBBox();vt.setAttributes(He,[["x",((24-xt.width)/2).toString()],["y",((24-xt.height)/2-xt.y).toString()]]);var _t=vt.createPath(vt.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(xt.width))/2,(24-Math.ceil(xt.height))/2,Math.ceil(xt.width),Math.ceil(xt.height)));return qe.appendChild(_t),vt.setAttributes(ut,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(fe),fe.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>'},W}(),xr=function(W){function s(m,B,K){var F=W.call(this,m,B)||this;return F.isDropdownOpen=!1,F.onClick=F.dropdownButtonClicked,F.dropdownButtons=K,F}return Wt(s,W),s.prototype.setupDropdown=function(){var m=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(B){B.className=m.className,B.colorsClassName=m.colorsClassName,m.dropdownBlock.appendChild(B.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},s.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},s.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},s.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},s.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},s.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},s}(Pt),Dt=function(){function W(s,m){this.GRIP_SIZE=10,this.color=s,this.fillColor=m,this.visual=vt.createGroup(),this.visual.appendChild(vt.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(vt.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return W.prototype.ownsTarget=function(s){return s===this.visual||s===this.visual.childNodes[0]||s===this.visual.childNodes[1]},W.prototype.setCenter=function(s,m){this.visual.childNodes.forEach(function(B){return vt.setAttributes(B,[["cx",s.toString()],["cy",m.toString()]])})},W}(),Mr=function(){function W(s,m,B,K){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=s,this.canvasHeight=m,this.margin=B,this.container=K,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(W.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(s){this._aspectRatio=s,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(s){this._isGridVisible=s,this.gridContainer&&vt.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(s){this._zoomFactor=s,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),W.prototype.open=function(){var s=this;this.cropShadeElement=vt.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=vt.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var m=0;m<this.numberOfGridLines;m++)this.horizontalGridLines.push(vt.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push(vt.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]]));this.horizontalGridLines.forEach(function(B){return s.gridContainer.appendChild(B)}),this.verticalGridLines.forEach(function(B){return s.gridContainer.appendChild(B)}),this.cropRectElement=vt.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new Dt(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new Dt(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new Dt(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new Dt(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomRightGrip.visual),this.attachEvents()},W.prototype.setCropRectangle=function(s){this.cropRect=s;var m=Object.assign({},this.cropRect);this.zoomFactor!==1&&(m.width=this.cropRect.width*this.zoomFactor,m.height=this.cropRect.height*this.zoomFactor,m.x=this.cropRect.height/this.cropRect.width<this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasWidth/2-m.width/2,m.y=this.cropRect.height/this.cropRect.width>this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-m.height/2),vt.setAttributes(this.cropRectElement,[["x",m.x.toString()],["y",m.y.toString()],["width",m.width.toString()],["height",m.height.toString()]]);var B=m.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(F,fe){var We=m.y+B*(fe+1);vt.setAttributes(F,[["x1",""+m.x],["y1",""+We],["x2",""+(m.x+m.width)],["y2",""+We]])});var K=m.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(F,fe){var We=m.x+K*(fe+1);vt.setAttributes(F,[["x1",""+We],["y1",""+m.y],["x2",""+We],["y2",""+(m.y+m.height)]])}),vt.setAttributes(this.cropShadeElement,[["d",vt.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,m.x,m.y,m.width,m.height)]]),this.topLeftGrip.setCenter(m.x,m.y),this.topRightGrip.setCenter(m.x+m.width,m.y),this.bottomLeftGrip.setCenter(m.x,m.y+m.height),this.bottomRightGrip.setCenter(m.x+m.width,m.y+m.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},W.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)},W.prototype.clientToLocalCoordinates=function(s,m){var B=this.container.getBoundingClientRect();return{x:s-B.left+this.margin,y:m-B.top+this.margin}},W.prototype.onPointerDown=function(s){this.container.setPointerCapture(s.pointerId),this.previousPoint=this.clientToLocalCoordinates(s.clientX,s.clientY),this.cropRectElement===s.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(s.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(s.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(s.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(s.target)&&(this.activeGrip=this.bottomRightGrip)},W.prototype.onPointerMove=function(s){if(this.isMoving)this.move(this.clientToLocalCoordinates(s.clientX,s.clientY));else if(this.activeGrip){var m=this.clientToLocalCoordinates(s.clientX,s.clientY);this.resize(m)}s.preventDefault()},W.prototype.onPointerUp=function(s){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(s.pointerId)},W.prototype.move=function(s){var m=s.x-this.previousPoint.x,B=s.y-this.previousPoint.y;this.zoomFactor!==1&&(m=-m/this.zoomFactor,B=-B/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+m),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+B),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=s},W.prototype.resize=function(s){var m=Object.assign({},this.cropRect),B=s.x-this.previousPoint.x,K=s.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:m.x+B<this.margin&&(B=this.margin-m.x),m.x+=B,m.width=this.cropRect.x+this.cropRect.width-m.x;break;case this.bottomRightGrip:case this.topRightGrip:m.width+B>this.canvasWidth*this.zoomFactor&&(B=this.canvasWidth*this.zoomFactor-m.width),m.width+=B}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(m.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(B),m.height=this.aspectRatio.getVerticalLength(m.width)):(m.y+=K,m.height=this.cropRect.y+this.cropRect.height-m.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?m.height=this.aspectRatio.getVerticalLength(m.width):m.height+=K}m.width<10&&(m.x=this.cropRect.x,m.width=10),m.height<10&&(m.y=this.cropRect.y,m.height=10),this.previousPoint=s,m.x>=this.margin&&m.y>=this.margin&&m.x-this.margin+m.width<=this.canvasWidth&&m.y-this.margin+m.height<=this.canvasHeight&&(this.cropRect=m,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},W.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var s=this.cropRect.x+this.cropRect.width/2,m=this.cropRect.y+this.cropRect.height/2,B=this.aspectRatio.getHorizontalLength(this.cropRect.height),K=this.aspectRatio.getVerticalLength(this.cropRect.width);B/this.canvasWidth<K/this.canvasHeight?this.cropRect.width=B:this.cropRect.height=K,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=s-this.cropRect.width/2,this.cropRect.y=m-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)}},W.prototype.getRescaledRect=function(s,m,B,K,F,fe){var We=B/s,qe=K/m;return{x:(F.x-fe)*We+fe,y:(F.y-fe)*qe+fe,width:F.width*We,height:F.height*qe}},W.prototype.scaleCanvas=function(s,m){var B=this.getRescaledRect(this.canvasWidth,this.canvasHeight,s,m,this.cropRect,this.margin);this.canvasWidth=s,this.canvasHeight=m,this.onCropChange&&this.onCropChange(B),this.setCropRectangle(B)},W}(),Xr=function(){function W(s){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=s,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(W.prototype,"angle",{get:function(){return this._angle},set:function(s){this._angle=s,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),W.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},W.prototype.onPointerDown=function(s){this.controlContainer.setPointerCapture(s.pointerId),this.isDragging=!0,this.previousPoint={x:s.clientX,y:s.clientY}},W.prototype.onPointerMove=function(s){this.isDragging&&(this.onAngleChange&&this.onAngleChange((s.clientX-this.previousPoint.x)/5),this.previousPoint.x=s.clientX)},W.prototype.onPointerUp=function(s){this.isDragging&&this.onAngleChange&&this.onAngleChange((s.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(s.pointerId)},W.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var s=this.angleLabelText.getBBox();vt.setAttributes(this.angleLabelElement,[["x",((this.width-s.width)/2).toString()],["y",(this.height/2).toString()]])}},W.prototype.positionScaleShape=function(){if(this.scaleShape){var s=this.scaleShape.transform.baseVal.getItem(0);s.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(s,0)}},W.prototype.getVisual=function(){var s=document.createElementNS("http://www.w3.org/2000/svg","svg");s.setAttribute("xmlns","http://www.w3.org/2000/svg"),s.setAttribute("width",this.width+"px"),s.setAttribute("height",this.height+"px"),s.setAttribute("viewBox","0 0 "+this.width+" "+this.height),s.style.flexShrink="0",document.body.appendChild(s);for(var m="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,B=1;B<=this.width/5+10;B++){var K=B%5==0?this.height/3:this.height/6;m+="h4v"+-K+"h1v"+K}m+="v1H0Z",this.scaleShape=vt.createPath(m);var F=vt.createTransform();this.scaleShape.transform.baseVal.appendItem(F),s.appendChild(this.scaleShape),this.angleLabelElement=vt.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=vt.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var fe=vt.createTSpan("");return fe.innerHTML="°",this.angleLabelElement.appendChild(fe),s.appendChild(this.angleLabelElement),document.body.removeChild(s),s},W}(),ui=function(){function W(){this.naturalSize=!1,this.imageType="image/png"}return W.prototype.rasterize=function(s,m,B,K,F,fe,We){var qe=this;return new Promise(function(ut){var He=document.createElement("canvas");He.width=s.width.baseVal.value-2*K,He.height=s.height.baseVal.value-2*K;var xt=1,_t=1;qe.naturalSize===!0?(xt=m.naturalWidth/(s.width.baseVal.value-2*K)/fe,_t=m.naturalHeight/(s.height.baseVal.value-2*K)/We,He.width=m.naturalWidth/fe,He.height=m.naturalHeight/We):qe.width!==void 0&&qe.height!==void 0&&(xt=qe.width/B.width,_t=qe.height/B.height,He.width*=xt,He.height*=_t);var Vt=He.getContext("2d");Vt.translate(He.width/2,He.height/2),Vt.rotate(F*Math.PI/180),Vt.scale(fe,We),Vt.translate(-He.width/2,-He.height/2),Vt.drawImage(m,0,0,He.width,He.height);var Ir=document.createElement("canvas");Ir.width=B.width*xt,Ir.height=B.height*_t,Ir.getContext("2d").putImageData(Vt.getImageData((B.x-K)*xt,(B.y-K)*_t,B.width*xt,B.height*_t),0,0),ut(Ir.toDataURL(qe.imageType,qe.imageQuality))})},W}(),Ke=function(){function W(s){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=W.instanceCounter++,this.styles=new Vr(this.instanceNo),this.target=s,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(W.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(s){this._zoomToCropEnabled=s,s?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(s){this._isGridVisible=s,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"gridLines",{get:function(){return this._gridLines},set:function(s){this._gridLines=s,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(s){this._rotationAngle=s,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(W.prototype,"aspectRatio",{get:function(){var s;return(s=this._aspectRatio)!==null&&s!==void 0?s:this.aspectRatios[0]},set:function(s){this._aspectRatio=s},enumerable:!1,configurable:!0}),W.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},W.prototype.show=function(){this.showUI(),this.open()},W.prototype.close=function(s){s===void 0&&(s=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),s||this.closeEventListeners.forEach(function(m){return m()}),this._isOpen=!1)},W.prototype.addRenderEventListener=function(s){this.renderEventListeners.push(s)},W.prototype.removeRenderEventListener=function(s){this.renderEventListeners.indexOf(s)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(s),1)},W.prototype.addCloseEventListener=function(s){this.closeEventListeners.push(s)},W.prototype.removeCloseEventListener=function(s){this.closeEventListeners.indexOf(s)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(s),1)},W.prototype.setupResizeObserver=function(){var s=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){s.resize(s.target.clientWidth,s.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))},W.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var s=1*this.target.clientWidth/this.target.clientHeight,m=this.contentDiv.clientWidth/s>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*s:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,B=m+2*this.CANVAS_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/s;this.resize(m,B)}},W.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},W.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",vt.setAttributes(this.editingTarget,[["width",""+this.imageWidth],["height",""+this.imageHeight]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px"},W.prototype.resize=function(s,m){this.imageWidth=Math.round(s),this.imageHeight=Math.round(m),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()},W.prototype.setEditingTarget=function(){var s=document.createElement("canvas");s.width=this.target.naturalWidth,s.height=this.target.naturalHeight,s.getContext("2d").drawImage(this.target,0,0,this.target.naturalWidth,this.target.naturalHeight);var m=s.toDataURL();vt.setAttributes(this.editingTarget,[["href",m]]),this.setEditingTargetSize()},W.prototype.setTopLeft=function(){var s=this.target.getBoundingClientRect(),m=this.editorCanvas.getBoundingClientRect();this.left=s.left-m.left-this.CANVAS_MARGIN,this.top=s.top-m.top-this.CANVAS_MARGIN},W.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=vt.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=vt.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=vt.createGroup(),this.editingTargetRotationScaleContainer=vt.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var s=vt.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(s);var m=vt.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(m),this.editingTargetContainer=vt.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)},W.prototype.positionCropImage=function(){this.cropImageHolder.style.top=this.top+"px",this.cropImageHolder.style.left=this.left+"px"},W.prototype.initCropLayer=function(){this.cropRect={x:this.CANVAS_MARGIN,y:this.CANVAS_MARGIN,width:this.imageWidth,height:this.imageHeight},this.cropLayerContainer=vt.createGroup(),this.cropImage.appendChild(this.cropLayerContainer),this.cropLayer=new Mr(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()},W.prototype.zoomToCrop=function(){if(this.cropRect){var s=this.cropRect.x-this.CANVAS_MARGIN+this.cropRect.width/2,m=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=s+"px "+m+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-s+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-m+this.CANVAS_MARGIN)+"px) scale("+this.zoomFactor+")",this.cropLayer.zoomFactor=this.zoomFactor)}},W.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)},W.prototype.cropRectChanged=function(s){this.cropRect=s,this.zoomToCropEnabled?this.zoomToCrop():this.cropLayer.zoomFactor=1},W.prototype.attachEvents=function(){window.addEventListener("resize",this.onWindowResize)},W.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"},W.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},W.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 s=this.styles.settings.hideTopToolbar?0:this.toolbarHeight,m=this.target.offsetTop>s+this.CANVAS_MARGIN?this.target.offsetTop-(s+this.CANVAS_MARGIN):0;this.coverDiv.style.top=m+"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},W.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},W.prototype.addTopToolbar=function(){var s=this;this.topToolbar=new Hr,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 m=new si;m.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(m);var B=[];this.aspectRatios.forEach(function(_t){var Vt=new Pt(li.getIcon(_t.horizontal,_t.vertical),_t.horizontal===0&&_t.vertical===0?"FREE":_t.horizontal+":"+_t.vertical);Vt.onClick=function(){return s.ratioButtonClicked(_t)},B.push(Vt)}),this.aspectRatioButton=new xr(li.getIcon(0,0),"Aspect ratio",B),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,m.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var K=new Pt('<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");K.isActive=this.isGridVisible,K.onClick=function(){s.isGridVisible=!s.isGridVisible,K.isActive=s.isGridVisible},m.addButton(K);var F=new Pt('<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(F.isActive=this.zoomToCropEnabled,F.onClick=function(){s.zoomToCropEnabled=!s.zoomToCropEnabled,F.isActive=s.zoomToCropEnabled},m.addButton(F),!ai.isLicensed){var fe=new pt;this.topToolbar.addElementBlock(fe);var We=document.createElement("div");We.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var qe=document.createElement("a");qe.style.color="currentColor",qe.href="https://markerjs.com/products/cropro",qe.target="_blank",qe.innerHTML='<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2"><path d="M16.326 14.895c0 1.126-.558 1.688-1.673 1.688H9.931c-1.116 0-1.674-.562-1.674-1.688V3.733c0-1.126.558-1.688 1.674-1.688h4.722c1.115 0 1.673.562 1.673 1.688v2.899h-1.957V3.793h-4.124v11.042h4.124v-3.242h1.957v3.302z" fill="currentColor"/><path d="M15.94 7.364a.783.783 0 00-1.065-.304l-11.01 6.126a.783.783 0 00-.303 1.065l4.498 8.085a.783.783 0 001.065.304l11.01-6.126a.783.783 0 00.303-1.065L15.94 7.364zM5.311 14.173l3.737 6.718 9.641-5.364-3.737-6.718-9.641 5.364z" fill="#eef762"/></svg>',We.appendChild(qe),fe.addElement(We)}var ut=new si;ut.minWidth=3*this.toolbarHeight+"px",ut.contentAlign="end",this.topToolbar.addButtonBlock(ut);var He=new Pt('<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");He.onClick=this.startRenderAndClose,ut.addButton(He),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(He.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var xt=new Pt('<svg viewBox="0 0 24 24"><path d="M20 6.91L17.09 4 12 9.09 6.91 4 4 6.91 9.09 12 4 17.09 6.91 20 12 14.91 17.09 20 20 17.09 14.91 12 20 6.91z"/></svg>',"Close");xt.onClick=this.close,ut.addButton(xt),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(xt.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},W.prototype.addBottomToolbar=function(){var s=this;this.bottomToolbar=new Hr,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 m=new si;m.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(m);var B=new Pt('<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");B.onClick=this.rotateLeftButtonClicked,m.addButton(B);var K=new Pt('<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");K.onClick=this.rotateRightButtonClicked,m.addButton(K);var F=new pt;F.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(F),this.straightener=new Xr("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(ut){s.rotateBy(ut),s.straightener.angle=s.rotationAngle},F.addElement(this.straightener.getUI());var fe=new si;fe.minWidth=2*this.toolbarHeight+"px",fe.contentAlign="end",this.bottomToolbar.addButtonBlock(fe);var We=new Pt('<svg viewBox="0 0 24 24"><path d="M15 21h2v-2h-2m4-10h2V7h-2M3 5v14c0 1.1.9 2 2 2h4v-2H5V5h4V3H5c-1.1 0-2 .9-2 2m16-2v2h2c0-1.1-.9-2-2-2m-8 20h2V1h-2m8 16h2v-2h-2M15 5h2V3h-2m4 10h2v-2h-2m0 10c1.1 0 2-.9 2-2h-2z"/></svg>',"Flip horizontal");We.onClick=this.flipHorizontallyButtonClicked,fe.addButton(We);var qe=new Pt('<svg viewBox="0 0 24 24"><path d="M3 15v2h2v-2m10 4v2h2v-2m2-16H5c-1.1 0-2 .9-2 2v4h2V5h14v4h2V5c0-1.1-.9-2-2-2m2 16h-2v2c1.1 0 2-.9 2-2M1 11v2h22v-2M7 19v2h2v-2m10-4v2h2v-2m-10 4v2h2v-2M3 19c0 1.1.9 2 2 2v-2z"/></svg>',"Flip vertical");qe.onClick=this.flipVerticallyButtonClicked,fe.addButton(qe)},W.prototype.ratioButtonClicked=function(s){this.aspectRatio=s,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},W.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=li.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},W.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new Pr(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},W.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},W.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},W.prototype.restoreState=function(s){if(s){var m=this.cropLayer.getRescaledRect(s.width,s.height,this.imageWidth,this.imageHeight,s.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(m),this.cropRectChanged(m),this.flippedHorizontally=s.flippedHorizontally,this.flippedVertically=s.flippedVertically,this.applyFlip(),this.rotationAngle=s.rotationAngle,this.applyRotation()}},W.prototype.clientToLocalCoordinates=function(s,m){var B=this.cropImage.getBoundingClientRect();return{x:s-B.left,y:m-B.top}},W.prototype.onWindowResize=function(){this.positionUI()},W.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var s=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=s+"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()},W.prototype.rotateLeftButtonClicked=function(){var s=this.rotationAngle-90;this.rotationAngle%90!=0&&(s+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(s)},W.prototype.rotateRightButtonClicked=function(){var s=this.rotationAngle+90;this.rotationAngle%90!=0&&(s-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(s)},W.prototype.rotateTo=function(s){s=(s=s>180?s-360:s)<=-180?s+360:s,this.rotationAngle=s,this.applyRotation()},W.prototype.rotateBy=function(s){this.rotateTo((this.rotationAngle+s)%360)},W.prototype.applyRotation=function(){var s=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var m=this.editingTargetRotationContainer.transform.baseVal.getItem(0);m.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(m,0);var B=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/B.width,this.imageHeight/B.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=s},W.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},W.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},W.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},W.prototype.startRenderAndClose=function(){return Lt(this,void 0,void 0,function(){var s,m;return Wr(this,function(B){switch(B.label){case 0:return[4,this.render()];case 1:return s=B.sent(),m=this.getState(),this.renderEventListeners.forEach(function(K){return K(s,m)}),this.close(!0),[2]}})})},W.prototype.render=function(){return Lt(this,void 0,void 0,function(){var s;return Wr(this,function(m){switch(m.label){case 0:return(s=new ui).naturalSize=this.renderAtNaturalSize,s.imageType=this.renderImageType,s.imageQuality=this.renderImageQuality,s.width=this.renderWidth,s.height=this.renderHeight,this.unzoomFromCrop(),vt.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,s.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 m.sent(),[4,s.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,m.sent()]}})})},W.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new cr("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 cr("toolbar_colors",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
|
|
`)),this.toolbarBlockStyleClass=this.styles.addClass(new cr("toolbar-block",`
|
|
display: flex;
|
|
align-items: center;
|
|
box-sizing: content-box;
|
|
`));var s=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new cr("toolbar_button",`
|
|
display: inline-block;
|
|
width: `+(this.toolbarHeight-2*s)+`px;
|
|
height: `+(this.toolbarHeight-2*s)+`px;
|
|
padding: `+s+`px;
|
|
cursor: default;
|
|
user-select: none;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new cr("toolbar_button_colors",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new cr("toolbar_active_button",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
|
|
`)),this.styles.addRule(new nr("."+this.toolbarButtonStyleClass.name+" svg",`
|
|
height: `+this.toolbarHeight/2+`px;
|
|
`)),this.styles.addRule(new nr("."+this.toolbarButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
|
|
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new cr("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 cr("toolbar_dropdown_colors",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
|
|
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new cr("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 cr("toolbar_straightener",`
|
|
display: flex;
|
|
overflow: hidden;
|
|
justify-content: center;
|
|
height: `+(this.toolbarHeight-2*s)+`px;
|
|
padding: `+s+`px;
|
|
cursor: default;
|
|
user-select: none;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new cr("toolbar_straightener_colors",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
`))},W.instanceCounter=0,W}(),St=ne("8hTe"),di=ne.n(St),Li=/<pre[^>]*>/g;function hi(W){var s=document.createElement("div");return s.innerHTML=W,s.childNodes.length===0?"":s.childNodes[0].nodeValue}var Di=st.a=function(W){var s=W.value,m=s===void 0?"":s,B=W.edit,K=B===void 0?!1:B,F=W.className,fe=W.showTextOnly,We=W.showLines,qe=W.replaces,ut=W.zoomImg,He=W.hasMask,xt=W.style,_t=xt===void 0?{}:xt,Vt=W.stylesPrev,Ir=Vt===void 0?{}:Vt,Nr=String(m),ar=Object(R.useRef)(),Gr=Object(R.useRef)(),Hi=Object(R.useState)(""),Er=Object(H.a)(Hi,2),Br=Er[0],kr=Er[1],gi=Object(R.useState)("office"),Yr=Object(H.a)(gi,2),ci=Yr[0],ei=Yr[1],hn=function(){var Nt=new Ke(Gr.current);Nt.displayMode="popup",Nt.addRenderEventListener(function(){var fr=Object(I.a)(O.a.mark(function Mt(er){var Ut;return O.a.wrap(function(Qt){for(;;)switch(Qt.prev=Qt.next){case 0:return ar.current.style.display="none",Qt.next=3,Object(Be.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:er}});case 3:Ut=Qt.sent,Ut!=null&&Ut.id&&qe(Gr.current.getAttribute("src").replace(le.a.API_SERVER,""),"/api/attachments/".concat(Ut==null?void 0:Ut.id,"?type=").concat(Ut.content_type));case 5:case"end":return Qt.stop()}},Mt)}));return function(Mt){return fr.apply(this,arguments)}}()),Nt.show()},Gi=function(){var Nt=new It(Gr.current);Nt.settings.displayMode="popup",Nt.addEventListener("render",function(){var fr=Object(I.a)(O.a.mark(function Mt(er){var Ut;return O.a.wrap(function(Qt){for(;;)switch(Qt.prev=Qt.next){case 0:if(ar.current.style.display="none",!Gr.current){Qt.next=6;break}return Qt.next=4,Object(Be.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:er.dataUrl}});case 4:Ut=Qt.sent,Ut!=null&&Ut.id&&qe(Gr.current.getAttribute("src").replace(le.a.API_SERVER,""),"/api/attachments/".concat(Ut==null?void 0:Ut.id,"?type=").concat(Ut.content_type));case 6:case"end":return Qt.stop()}},Mt)}));return function(Mt){return fr.apply(this,arguments)}}()),Nt.show(),window.markerArea=Nt},$r=Object(R.useMemo)(function(){try{var Zt=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,Nt=/\"\/api\/attachments\/|\"\/attachments\/download\//g,fr=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;Nr=Nr.replace(Zt,"("+le.a.API_SERVER+"/api/attachments/").replace(Nt,'"'+le.a.API_SERVER+"/api/attachments/").replace(fr,'"'+le.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,`
|
|
`),Nr=Nr.replace(new RegExp("(?<!\\n)\\n(?!\\n)","g"),`
|
|
`)}catch(ti){}var Mt=Q(Nr),er=x();if(Nr.match(/\[TOC\]/)&&(Mt=Mt.replace("<p>[TOC]</p>",D()),T()),Mt=Mt.replace(/(__special_katext_id_\d+__)/g,function(ti,Qt){var Sr=er[Qt],zi=Sr.type,Ki=Sr.expression;return Object(me.renderToString)(hi(Ki)||"",{displayMode:zi==="block",throwOnError:!1,output:"html"})}),Mt=Mt.replace(/▁/g,"\u2581\u2581\u2581"),b(),fe){var Ut=document.createElement("div");return Ut.innerHTML=Mt,Ut.innerText}return setTimeout(function(){return _i()},500),Mt},[Nr]),Fr=Object(R.useRef)();f.WebkitLineClamp=We,We&&(_t=Object(P.a)(Object(P.a)({},_t),f));function ki(Zt){var Nt=Zt.target;if(Nt.tagName.toUpperCase()==="IMG"){if(ut){var fr=Nt.getAttribute("src");kr(fr),ei("image")}}else if(Nt.tagName.toUpperCase()==="A"){var Mt=Nt.getAttribute("href");if(Mt.indexOf("office")>-1)Zt.preventDefault(),kr(Mt),ei("office");else if(Mt.indexOf("application/pdf")>-1)Zt.preventDefault(),kr(Mt),ei("pdf");else if(Mt.indexOf("type=text")>-1)Zt.preventDefault(),kr(Mt),ei("html");else if(Mt.startsWith("#")){Zt.preventDefault();var er=document.getElementById(Mt.replace("#",""));er&&er.scrollIntoView(!0)}}}var _i=function(){var Nt,fr=(Nt=Fr.current)===null||Nt===void 0?void 0:Nt.querySelectorAll("video");fr==null||fr.forEach(function(Mt){if(Mt.oncontextmenu=function(){return!1},Mt.src.indexOf(".m3u8")>-1&&!Mt.canPlayType("application/vnd.apple.mpegurl")){if(q.a.isSupported()){var er=new q.a;er.loadSource(Mt.src),er.attachMedia(Mt)}}})};Object(R.useEffect)(function(){if(Fr.current&&$r&&($r.match(Li)&&window.PR.prettyPrint()),Fr.current)return Fr.current.addEventListener("click",ki),function(){Fr.current.removeEventListener("click",ki),b(),T()}},[$r,Fr.current,ki]);var cn=function(Nt){if(!K)return;Nt.target.nodeName==="IMG"?(ar.current.style.display="flex",ar.current.style.width=Nt.target.clientWidth+"px",ar.current.style.height=Nt.target.clientHeight+"px",ar.current.style.top=Nt.target.offsetTop+"px",ar.current.style.left=Nt.target.offsetLeft+"px",Gr.current.src=Nt.target.getAttribute("src")):ar.current.style.display="none"};return y.a.createElement("div",{style:{position:"relative"}},y.a.createElement("div",{ref:Fr,style:Object(P.a)({},_t),className:"".concat(F||""," markdown-body ").concat(di.a.mdBody),onMouseOver:cn,dangerouslySetInnerHTML:{__html:$r}}),y.a.createElement("div",{ref:ar,className:di.a.button},y.a.createElement(Z.a,null,y.a.createElement(Y.a,{onClick:function(){return hn()}},"\u88C1\u526A"),y.a.createElement(Y.a,{onClick:function(){return Gi()}},"\u7F16\u8F91"))),y.a.createElement("img",{ref:Gr,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),y.a.createElement(be.a,{close:!0,data:Br,hasMask:He,type:Br!=null&&Br.length?ci:"",style:Object(P.a)({},Ir),onClose:function(){return kr("")}}))}},"9VGf":function(Ct,st,ne){"use strict";ne.d(st,"a",function(){return k});var oe=ne("q1tI"),Z=ne.n(oe);function k(Y,P){var I=Object(oe.useRef)();Object(oe.useEffect)(function(){I.current=Y}),Object(oe.useEffect)(function(){function H(){I.current()}if(P!==null){var U=setInterval(H,P);return function(){return clearInterval(U)}}},[P])}},BU3w:function(Ct,st,ne){"use strict";ne.d(st,"a",function(){return I});var oe=ne("MNnm"),Z="rc-util-key";function k(H){if(H.attachTo)return H.attachTo;var U=document.querySelector("head");return U||document.body}function Y(H){var U,O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(oe.a)())return null;var R=document.createElement("style");if((U=O.csp)===null||U===void 0?void 0:U.nonce){var y;R.nonce=(y=O.csp)===null||y===void 0?void 0:y.nonce}R.innerHTML=H;var w=k(O),_=w.firstChild;return O.prepend&&w.prepend?w.prepend(R):O.prepend&&_?w.insertBefore(R,_):w.appendChild(R),R}var P=new Map;function I(H,U){var O=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},R=k(O);if(!P.has(R)){var y=Y("",O),w=y.parentNode;P.set(R,w),w.removeChild(y)}var _=Array.from(P.get(R).children).find(function(o){return o.tagName==="STYLE"&&o[Z]===U});if(_){var L,A;if(((L=O.csp)===null||L===void 0?void 0:L.nonce)&&_.nonce!==((A=O.csp)===null||A===void 0?void 0:A.nonce)){var C;_.nonce=(C=O.csp)===null||C===void 0?void 0:C.nonce}return _.innerHTML!==H&&(_.innerHTML=H),_}var d=Y(H,O);return d[Z]=U,d}},Bd2K:function(Ct,st,ne){(function(oe){oe(ne("VrN/"),ne("osHv"))})(function(oe){oe.defineOption("autoCloseTags",!1,function(O,R,y){if(y!=oe.Init&&y&&O.removeKeyMap("autoCloseTags"),!R)return;var w={name:"autoCloseTags"};(typeof R!="object"||R.whenClosing!==!1)&&(w["'/'"]=function(_){return I(_)}),(typeof R!="object"||R.whenOpening!==!1)&&(w["'>'"]=function(_){return Y(_)}),O.addKeyMap(w)});var Z=["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 Y(O){if(O.getOption("disableInput"))return oe.Pass;for(var R=O.listSelections(),y=[],w=O.getOption("autoCloseTags"),_=0;_<R.length;_++){if(!R[_].empty())return oe.Pass;var L=R[_].head,A=O.getTokenAt(L),C=oe.innerMode(O.getMode(),A.state),d=C.state,o=C.mode.xmlCurrentTag&&C.mode.xmlCurrentTag(d),l=o&&o.name;if(!l)return oe.Pass;var h=C.mode.configuration=="html",T=typeof w=="object"&&w.dontCloseTags||h&&Z,f=typeof w=="object"&&w.indentTags||h&&k;A.end>L.ch&&(l=l.slice(0,l.length-A.end+L.ch));var p=l.toLowerCase();if(!l||A.type=="string"&&(A.end!=L.ch||!/[\"\']/.test(A.string.charAt(A.string.length-1))||A.string.length==1)||A.type=="tag"&&o.close||A.string.indexOf("/")==L.ch-A.start-1||T&&H(T,p)>-1||U(O,C.mode.xmlCurrentContext&&C.mode.xmlCurrentContext(d)||[],l,L,!0))return oe.Pass;var D=typeof w=="object"&&w.emptyTags;if(D&&H(D,l)>-1){y[_]={text:"/>",newPos:oe.Pos(L.line,L.ch+2)};continue}var E=f&&H(f,p)>-1;y[_]={indent:E,text:">"+(E?`
|
|
|
|
`:"")+"</"+l+">",newPos:E?oe.Pos(L.line+1,0):oe.Pos(L.line,L.ch+1)}}for(var g=typeof w=="object"&&w.dontIndentOnAutoClose,_=R.length-1;_>=0;_--){var c=y[_];O.replaceRange(c.text,R[_].head,R[_].anchor,"+insert");var u=O.listSelections().slice(0);u[_]={head:c.newPos,anchor:c.newPos},O.setSelections(u),!g&&c.indent&&(O.indentLine(c.newPos.line,null,!0),O.indentLine(c.newPos.line+1,null,!0))}}function P(O,R){for(var y=O.listSelections(),w=[],_=R?"/":"</",L=O.getOption("autoCloseTags"),A=typeof L=="object"&&L.dontIndentOnSlash,C=0;C<y.length;C++){if(!y[C].empty())return oe.Pass;var d=y[C].head,o=O.getTokenAt(d),l=oe.innerMode(O.getMode(),o.state),h=l.state;if(R&&(o.type=="string"||o.string.charAt(0)!="<"||o.start!=d.ch-1))return oe.Pass;var T,f=l.mode.name!="xml"&&O.getMode().name=="htmlmixed";if(f&&l.mode.name=="javascript")T=_+"script";else if(f&&l.mode.name=="css")T=_+"style";else{var p=l.mode.xmlCurrentContext&&l.mode.xmlCurrentContext(h);if(!p||p.length&&U(O,p,p[p.length-1],d))return oe.Pass;T=_+p[p.length-1]}O.getLine(d.line).charAt(o.end)!=">"&&(T+=">"),w[C]=T}if(O.replaceSelections(w),y=O.listSelections(),!A)for(var C=0;C<y.length;C++)(C==y.length-1||y[C].head.line<y[C+1].head.line)&&O.indentLine(y[C].head.line)}function I(O){return O.getOption("disableInput")?oe.Pass:P(O,!0)}oe.commands.closeTag=function(O){return P(O)};function H(O,R){if(O.indexOf)return O.indexOf(R);for(var y=0,w=O.length;y<w;++y)if(O[y]==R)return y;return-1}function U(O,R,y,w,_){if(!oe.scanForClosingTag)return!1;var L=Math.min(O.lastLine()+1,w.line+500),A=oe.scanForClosingTag(O,w,null,L);if(!A||A.tag!=y)return!1;for(var C=_?1:0,d=R.length-1;d>=0&&R[d]==y;d--)++C;w=A.to;for(var d=1;d<C;d++){var o=oe.scanForClosingTag(O,w,null,L);if(!o||o.tag!=y)return!1;w=o.to}return!0}})},BjJ7:function(Ct,st,ne){"use strict";ne.d(st,"d",function(){return Z}),ne.d(st,"c",function(){return k}),ne.d(st,"e",function(){return Y}),ne.d(st,"b",function(){return P}),ne.d(st,"a",function(){return H});var oe=ne("m3rI");function Z(U){var O=!0;if(U.length>0){for(var R=0;R<U.length;R++)if(U[R].compile_success==0||!U[R].compile_success){O=!1;break}}else O=!1;return O}function k(U){for(var O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",R=[],y=0;y<U.length;y++){var w=U[y],_=O?"".concat(O,"/").concat(w.name):"".concat(w.name);R.push({title:w.name,isLeaf:!(w.type==="tree"),key:_})}return R}function Y(U,O,R){for(var y=0;y<U.length;y++){var w=U[y];if(w.key===O){w.children=R;break}w.children&&Y(w.children,O,R)}return U}function P(U,O,R){var y;return function(){var w=this,_=arguments,L=function(){y=null,R||U.apply(w,_)},A=R&&!y;clearTimeout(y),y=setTimeout(L,O),A&&U.apply(w,_)}}var I=!0,H=oe.a.API_SERVER},"C+DQ":function(Ct,st,ne){},DlQD:function(Ct,st,ne){(function(oe,Z){Ct.exports=Z()})(this,function(){"use strict";function oe(ye,ce){for(var ge=0;ge<ce.length;ge++){var ee=ce[ge];ee.enumerable=ee.enumerable||!1,ee.configurable=!0,"value"in ee&&(ee.writable=!0),Object.defineProperty(ye,ee.key,ee)}}function Z(ye,ce,ge){return ce&&oe(ye.prototype,ce),ge&&oe(ye,ge),ye}function k(ye,ce){if(!ye)return;if(typeof ye=="string")return Y(ye,ce);var ge=Object.prototype.toString.call(ye).slice(8,-1);if(ge==="Object"&&ye.constructor&&(ge=ye.constructor.name),ge==="Map"||ge==="Set")return Array.from(ye);if(ge==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(ge))return Y(ye,ce)}function Y(ye,ce){(ce==null||ce>ye.length)&&(ce=ye.length);for(var ge=0,ee=new Array(ce);ge<ce;ge++)ee[ge]=ye[ge];return ee}function P(ye,ce){var ge;if(typeof Symbol=="undefined"||ye[Symbol.iterator]==null){if(Array.isArray(ye)||(ge=k(ye))||ce&&ye&&typeof ye.length=="number"){ge&&(ye=ge);var ee=0;return function(){return ee>=ye.length?{done:!0}:{done:!1,value:ye[ee++]}}}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 ge=ye[Symbol.iterator](),ge.next.bind(ge)}function I(ye,ce){return ce={exports:{}},ye(ce,ce.exports),ce.exports}var H=I(function(ye){function ce(){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 ge(ee){ye.exports.defaults=ee}ye.exports={defaults:ce(),getDefaults:ce,changeDefaults:ge}}),U=H.defaults,O=H.getDefaults,R=H.changeDefaults,y=/[&<>"']/,w=/[&<>"']/g,_=/[<>"']|&(?!#?\w+;)/,L=/[<>"']|&(?!#?\w+;)/g,A={"&":"&","<":"<",">":">",'"':""","'":"'"},C=function(ce){return A[ce]};function d(ye,ce){if(ce){if(y.test(ye))return ye.replace(w,C)}else if(_.test(ye))return ye.replace(L,C);return ye}var o=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function l(ye){return ye.replace(o,function(ce,ge){return ge=ge.toLowerCase(),ge==="colon"?":":ge.charAt(0)==="#"?ge.charAt(1)==="x"?String.fromCharCode(parseInt(ge.substring(2),16)):String.fromCharCode(+ge.substring(1)):""})}var h=/(^|[^\[])\^/g;function T(ye,ce){ye=ye.source||ye,ce=ce||"";var ge={replace:function(te,ie){return ie=ie.source||ie,ie=ie.replace(h,"$1"),ye=ye.replace(te,ie),ge},getRegex:function(){return new RegExp(ye,ce)}};return ge}var f=/[^\w:]/g,p=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function D(ye,ce,ge){if(ye){var ee;try{ee=decodeURIComponent(l(ge)).replace(f,"").toLowerCase()}catch(te){return null}if(ee.indexOf("javascript:")===0||ee.indexOf("vbscript:")===0||ee.indexOf("data:")===0)return null}ce&&!p.test(ge)&&(ge=a(ce,ge));try{ge=encodeURI(ge).replace(/%25/g,"%")}catch(te){return null}return ge}var E={},g=/^[^:]+:\/*[^/]*$/,c=/^([^:]+:)[\s\S]*$/,u=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(ye,ce){E[" "+ye]||(g.test(ye)?E[" "+ye]=ye+"/":E[" "+ye]=M(ye,"/",!0)),ye=E[" "+ye];var ge=ye.indexOf(":")===-1;return ce.substring(0,2)==="//"?ge?ce:ye.replace(c,"$1")+ce:ce.charAt(0)==="/"?ge?ce:ye.replace(u,"$1")+ce:ye+ce}var x={exec:function(){}};function b(ye){for(var ce=1,ge,ee;ce<arguments.length;ce++){ge=arguments[ce];for(ee in ge)Object.prototype.hasOwnProperty.call(ge,ee)&&(ye[ee]=ge[ee])}return ye}function v(ye,ce){var ge=ye.replace(/\|/g,function(ie,se,Ce){for(var xe=!1,je=se;--je>=0&&Ce[je]==="\\";)xe=!xe;return xe?"|":" |"}),ee=ge.split(/ \|/),te=0;if(ee.length>ce)ee.splice(ce);else for(;ee.length<ce;)ee.push("");for(;te<ee.length;te++)ee[te]=ee[te].trim().replace(/\\\|/g,"|");return ee}function M(ye,ce,ge){var ee=ye.length;if(ee===0)return"";for(var te=0;te<ee;){var ie=ye.charAt(ee-te-1);if(ie===ce&&!ge)te++;else if(ie!==ce&&ge)te++;else break}return ye.substr(0,ee-te)}function G(ye,ce){if(ye.indexOf(ce[1])===-1)return-1;for(var ge=ye.length,ee=0,te=0;te<ge;te++)if(ye[te]==="\\")te++;else if(ye[te]===ce[0])ee++;else if(ye[te]===ce[1]&&(ee--,ee<0))return te;return-1}function X(ye){ye&&ye.sanitize&&!ye.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 Q={escape:d,unescape:l,edit:T,cleanUrl:D,resolveUrl:a,noopTest:x,merge:b,splitCells:v,rtrim:M,findClosingBracket:G,checkSanitizeDeprecation:X},z=H.defaults,j=Q.rtrim,q=Q.splitCells,le=Q.escape,me=Q.findClosingBracket;function be(ye,ce,ge){var ee=ce.href,te=ce.title?le(ce.title):null,ie=ye[1].replace(/\\([\[\]])/g,"$1");return ye[0].charAt(0)!=="!"?{type:"link",raw:ge,href:ee,title:te,text:ie}:{type:"image",raw:ge,href:ee,title:te,text:le(ie)}}function Be(ye,ce){var ge=ye.match(/^(\s+)(?:```)/);if(ge===null)return ce;var ee=ge[1];return ce.split(`
|
|
`).map(function(te){var ie=te.match(/^\s+/);if(ie===null)return te;var se=ie[0];return se.length>=ee.length?te.slice(ee.length):te}).join(`
|
|
`)}var Le=function(){function ye(ge){this.options=ge||z}var ce=ye.prototype;return ce.space=function(ee){var te=this.rules.block.newline.exec(ee);if(te)return te[0].length>1?{type:"space",raw:te[0]}:{raw:`
|
|
`}},ce.code=function(ee,te){var ie=this.rules.block.code.exec(ee);if(ie){var se=te[te.length-1];if(se&&se.type==="paragraph")return{raw:ie[0],text:ie[0].trimRight()};var Ce=ie[0].replace(/^ {4}/gm,"");return{type:"code",raw:ie[0],codeBlockStyle:"indented",text:this.options.pedantic?Ce:j(Ce,`
|
|
`)}}},ce.fences=function(ee){var te=this.rules.block.fences.exec(ee);if(te){var ie=te[0],se=Be(ie,te[3]||"");return{type:"code",raw:ie,lang:te[2]?te[2].trim():te[2],text:se}}},ce.heading=function(ee){var te=this.rules.block.heading.exec(ee);if(te)return{type:"heading",raw:te[0],depth:te[1].length,text:te[2]}},ce.nptable=function(ee){var te=this.rules.block.nptable.exec(ee);if(te){var ie={type:"table",header:q(te[1].replace(/^ *| *\| *$/g,"")),align:te[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:te[3]?te[3].replace(/\n$/,"").split(`
|
|
`):[],raw:te[0]};if(ie.header.length===ie.align.length){var se=ie.align.length,Ce;for(Ce=0;Ce<se;Ce++)/^ *-+: *$/.test(ie.align[Ce])?ie.align[Ce]="right":/^ *:-+: *$/.test(ie.align[Ce])?ie.align[Ce]="center":/^ *:-+ *$/.test(ie.align[Ce])?ie.align[Ce]="left":ie.align[Ce]=null;for(se=ie.cells.length,Ce=0;Ce<se;Ce++)ie.cells[Ce]=q(ie.cells[Ce],ie.header.length);return ie}}},ce.hr=function(ee){var te=this.rules.block.hr.exec(ee);if(te)return{type:"hr",raw:te[0]}},ce.blockquote=function(ee){var te=this.rules.block.blockquote.exec(ee);if(te){var ie=te[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:te[0],text:ie}}},ce.list=function(ee){var te=this.rules.block.list.exec(ee);if(te){for(var ie=te[0],se=te[2],Ce=se.length>1,xe=se[se.length-1]===")",je={type:"list",raw:ie,ordered:Ce,start:Ce?+se.slice(0,-1):"",loose:!1,items:[]},nt=te[0].match(this.rules.block.item),ft=!1,lt,wt,Et,ct,zt,It,Kt,Wt=nt.length,Lt=0;Lt<Wt;Lt++)lt=nt[Lt],ie=lt,wt=lt.length,lt=lt.replace(/^ *([*+-]|\d+[.)]) */,""),~lt.indexOf(`
|
|
`)&&(wt-=lt.length,lt=this.options.pedantic?lt.replace(/^ {1,4}/gm,""):lt.replace(new RegExp("^ {1,"+wt+"}","gm"),"")),Lt!==Wt-1&&(Et=this.rules.block.bullet.exec(nt[Lt+1])[0],(Ce?Et.length===1||!xe&&Et[Et.length-1]===")":Et.length>1||this.options.smartLists&&Et!==se)&&(ct=nt.slice(Lt+1).join(`
|
|
`),je.raw=je.raw.substring(0,je.raw.length-ct.length),Lt=Wt-1)),zt=ft||/\n\n(?!\s*$)/.test(lt),Lt!==Wt-1&&(ft=lt.charAt(lt.length-1)===`
|
|
`,zt||(zt=ft)),zt&&(je.loose=!0),It=/^\[[ xX]\] /.test(lt),Kt=void 0,It&&(Kt=lt[1]!==" ",lt=lt.replace(/^\[[ xX]\] +/,"")),je.items.push({type:"list_item",raw:ie,task:It,checked:Kt,loose:zt,text:lt});return je}},ce.html=function(ee){var te=this.rules.block.html.exec(ee);if(te)return{type:this.options.sanitize?"paragraph":"html",raw:te[0],pre:!this.options.sanitizer&&(te[1]==="pre"||te[1]==="script"||te[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(te[0]):le(te[0]):te[0]}},ce.def=function(ee){var te=this.rules.block.def.exec(ee);if(te){te[3]&&(te[3]=te[3].substring(1,te[3].length-1));var ie=te[1].toLowerCase().replace(/\s+/g," ");return{tag:ie,raw:te[0],href:te[2],title:te[3]}}},ce.table=function(ee){var te=this.rules.block.table.exec(ee);if(te){var ie={type:"table",header:q(te[1].replace(/^ *| *\| *$/g,"")),align:te[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:te[3]?te[3].replace(/\n$/,"").split(`
|
|
`):[]};if(ie.header.length===ie.align.length){ie.raw=te[0];var se=ie.align.length,Ce;for(Ce=0;Ce<se;Ce++)/^ *-+: *$/.test(ie.align[Ce])?ie.align[Ce]="right":/^ *:-+: *$/.test(ie.align[Ce])?ie.align[Ce]="center":/^ *:-+ *$/.test(ie.align[Ce])?ie.align[Ce]="left":ie.align[Ce]=null;for(se=ie.cells.length,Ce=0;Ce<se;Ce++)ie.cells[Ce]=q(ie.cells[Ce].replace(/^ *\| *| *\| *$/g,""),ie.header.length);return ie}}},ce.lheading=function(ee){var te=this.rules.block.lheading.exec(ee);if(te)return{type:"heading",raw:te[0],depth:te[2].charAt(0)==="="?1:2,text:te[1]}},ce.paragraph=function(ee){var te=this.rules.block.paragraph.exec(ee);if(te)return{type:"paragraph",raw:te[0],text:te[1].charAt(te[1].length-1)===`
|
|
`?te[1].slice(0,-1):te[1]}},ce.text=function(ee,te){var ie=this.rules.block.text.exec(ee);if(ie){var se=te[te.length-1];return se&&se.type==="text"?{raw:ie[0],text:ie[0]}:{type:"text",raw:ie[0],text:ie[0]}}},ce.escape=function(ee){var te=this.rules.inline.escape.exec(ee);if(te)return{type:"escape",raw:te[0],text:le(te[1])}},ce.tag=function(ee,te,ie){var se=this.rules.inline.tag.exec(ee);if(se)return!te&&/^<a /i.test(se[0])?te=!0:te&&/^<\/a>/i.test(se[0])&&(te=!1),!ie&&/^<(pre|code|kbd|script)(\s|>)/i.test(se[0])?ie=!0:ie&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(se[0])&&(ie=!1),{type:this.options.sanitize?"text":"html",raw:se[0],inLink:te,inRawBlock:ie,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(se[0]):le(se[0]):se[0]}},ce.link=function(ee){var te=this.rules.inline.link.exec(ee);if(te){var ie=me(te[2],"()");if(ie>-1){var se=te[0].indexOf("!")===0?5:4,Ce=se+te[1].length+ie;te[2]=te[2].substring(0,ie),te[0]=te[0].substring(0,Ce).trim(),te[3]=""}var xe=te[2],je="";if(this.options.pedantic){var nt=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(xe);nt?(xe=nt[1],je=nt[3]):je=""}else je=te[3]?te[3].slice(1,-1):"";xe=xe.trim().replace(/^<([\s\S]*)>$/,"$1");var ft=be(te,{href:xe&&xe.replace(this.rules.inline._escapes,"$1"),title:je&&je.replace(this.rules.inline._escapes,"$1")},te[0]);return ft}},ce.reflink=function(ee,te){var ie;if((ie=this.rules.inline.reflink.exec(ee))||(ie=this.rules.inline.nolink.exec(ee))){var se=(ie[2]||ie[1]).replace(/\s+/g," ");if(se=te[se.toLowerCase()],!se||!se.href){var Ce=ie[0].charAt(0);return{type:"text",raw:Ce,text:Ce}}var xe=be(ie,se,ie[0]);return xe}},ce.strong=function(ee,te,ie){ie===void 0&&(ie="");var se=this.rules.inline.strong.start.exec(ee);if(se&&(!se[1]||se[1]&&(ie===""||this.rules.inline.punctuation.exec(ie)))){te=te.slice(-1*ee.length);var Ce=se[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;Ce.lastIndex=0;for(var xe;(se=Ce.exec(te))!=null;)if(xe=this.rules.inline.strong.middle.exec(te.slice(0,se.index+3)),xe)return{type:"strong",raw:ee.slice(0,xe[0].length),text:ee.slice(2,xe[0].length-2)}}},ce.em=function(ee,te,ie){ie===void 0&&(ie="");var se=this.rules.inline.em.start.exec(ee);if(se&&(!se[1]||se[1]&&(ie===""||this.rules.inline.punctuation.exec(ie)))){te=te.slice(-1*ee.length);var Ce=se[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;Ce.lastIndex=0;for(var xe;(se=Ce.exec(te))!=null;)if(xe=this.rules.inline.em.middle.exec(te.slice(0,se.index+2)),xe)return{type:"em",raw:ee.slice(0,xe[0].length),text:ee.slice(1,xe[0].length-1)}}},ce.codespan=function(ee){var te=this.rules.inline.code.exec(ee);if(te){var ie=te[2].replace(/\n/g," "),se=/[^ ]/.test(ie),Ce=ie.startsWith(" ")&&ie.endsWith(" ");return se&&Ce&&(ie=ie.substring(1,ie.length-1)),ie=le(ie,!0),{type:"codespan",raw:te[0],text:ie}}},ce.br=function(ee){var te=this.rules.inline.br.exec(ee);if(te)return{type:"br",raw:te[0]}},ce.del=function(ee){var te=this.rules.inline.del.exec(ee);if(te)return{type:"del",raw:te[0],text:te[1]}},ce.autolink=function(ee,te){var ie=this.rules.inline.autolink.exec(ee);if(ie){var se,Ce;return ie[2]==="@"?(se=le(this.options.mangle?te(ie[1]):ie[1]),Ce="mailto:"+se):(se=le(ie[1]),Ce=se),{type:"link",raw:ie[0],text:se,href:Ce,tokens:[{type:"text",raw:se,text:se}]}}},ce.url=function(ee,te){var ie;if(ie=this.rules.inline.url.exec(ee)){var se,Ce;if(ie[2]==="@")se=le(this.options.mangle?te(ie[0]):ie[0]),Ce="mailto:"+se;else{var xe;do xe=ie[0],ie[0]=this.rules.inline._backpedal.exec(ie[0])[0];while(xe!==ie[0]);se=le(ie[0]),ie[1]==="www."?Ce="http://"+se:Ce=se}return{type:"link",raw:ie[0],text:se,href:Ce,tokens:[{type:"text",raw:se,text:se}]}}},ce.inlineText=function(ee,te,ie){var se=this.rules.inline.text.exec(ee);if(se){var Ce;return te?Ce=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(se[0]):le(se[0]):se[0]:Ce=le(this.options.smartypants?ie(se[0]):se[0]),{type:"text",raw:se[0],text:Ce}}},ye}(),De=Q.noopTest,de=Q.edit,pe=Q.merge,ae={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:De,table:De,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};ae._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,ae._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,ae.def=de(ae.def).replace("label",ae._label).replace("title",ae._title).getRegex(),ae.bullet=/(?:[*+-]|\d{1,9}[.)])/,ae.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,ae.item=de(ae.item,"gm").replace(/bull/g,ae.bullet).getRegex(),ae.list=de(ae.list).replace(/bull/g,ae.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+ae.def.source+")").getRegex(),ae._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",ae._comment=/<!--(?!-?>)[\s\S]*?-->/,ae.html=de(ae.html,"i").replace("comment",ae._comment).replace("tag",ae._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ae.paragraph=de(ae._paragraph).replace("hr",ae.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",ae._tag).getRegex(),ae.blockquote=de(ae.blockquote).replace("paragraph",ae.paragraph).getRegex(),ae.normal=pe({},ae),ae.gfm=pe({},ae.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*|$)"}),ae.gfm.nptable=de(ae.gfm.nptable).replace("hr",ae.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",ae._tag).getRegex(),ae.gfm.table=de(ae.gfm.table).replace("hr",ae.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",ae._tag).getRegex(),ae.pedantic=pe({},ae.normal,{html:de(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ae._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:De,paragraph:de(ae.normal._paragraph).replace("hr",ae.hr).replace("heading",` *#{1,6} *[^
|
|
]`).replace("lheading",ae.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var re={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:De,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:De,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};re._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",re.punctuation=de(re.punctuation).replace(/punctuation/g,re._punctuation).getRegex(),re._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",re._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",re.em.start=de(re.em.start).replace(/punctuation/g,re._punctuation).getRegex(),re.em.middle=de(re.em.middle).replace(/punctuation/g,re._punctuation).replace(/overlapSkip/g,re._overlapSkip).getRegex(),re.em.endAst=de(re.em.endAst,"g").replace(/punctuation/g,re._punctuation).getRegex(),re.em.endUnd=de(re.em.endUnd,"g").replace(/punctuation/g,re._punctuation).getRegex(),re.strong.start=de(re.strong.start).replace(/punctuation/g,re._punctuation).getRegex(),re.strong.middle=de(re.strong.middle).replace(/punctuation/g,re._punctuation).replace(/blockSkip/g,re._blockSkip).getRegex(),re.strong.endAst=de(re.strong.endAst,"g").replace(/punctuation/g,re._punctuation).getRegex(),re.strong.endUnd=de(re.strong.endUnd,"g").replace(/punctuation/g,re._punctuation).getRegex(),re.blockSkip=de(re._blockSkip,"g").getRegex(),re.overlapSkip=de(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=de(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=de(re.tag).replace("comment",ae._comment).replace("attribute",re._attribute).getRegex(),re._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,re._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,re._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,re.link=de(re.link).replace("label",re._label).replace("href",re._href).replace("title",re._title).getRegex(),re.reflink=de(re.reflink).replace("label",re._label).getRegex(),re.reflinkSearch=de(re.reflinkSearch,"g").replace("reflink",re.reflink).replace("nolink",re.nolink).getRegex(),re.normal=pe({},re),re.pedantic=pe({},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:de(/^!?\[(label)\]\((.*?)\)/).replace("label",re._label).getRegex(),reflink:de(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",re._label).getRegex()}),re.gfm=pe({},re.normal,{escape:de(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=de(re.gfm.url,"i").replace("email",re.gfm._extended_email).getRegex(),re.breaks=pe({},re.gfm,{br:de(re.br).replace("{2,}","*").getRegex(),text:de(re.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var we={block:ae,inline:re},ve=H.defaults,Re=we.block,Ae=we.inline;function Oe(ye){return ye.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 Ee(ye){var ce="",ge,ee,te=ye.length;for(ge=0;ge<te;ge++)ee=ye.charCodeAt(ge),Math.random()>.5&&(ee="x"+ee.toString(16)),ce+="&#"+ee+";";return ce}var _e=function(){function ye(ge){this.tokens=[],this.tokens.links=Object.create(null),this.options=ge||ve,this.options.tokenizer=this.options.tokenizer||new Le,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var ee={block:Re.normal,inline:Ae.normal};this.options.pedantic?(ee.block=Re.pedantic,ee.inline=Ae.pedantic):this.options.gfm&&(ee.block=Re.gfm,this.options.breaks?ee.inline=Ae.breaks:ee.inline=Ae.gfm),this.tokenizer.rules=ee}ye.lex=function(ee,te){var ie=new ye(te);return ie.lex(ee)};var ce=ye.prototype;return ce.lex=function(ee){return ee=ee.replace(/\r\n|\r/g,`
|
|
`).replace(/\t/g," "),this.blockTokens(ee,this.tokens,!0),this.inline(this.tokens),this.tokens},ce.blockTokens=function(ee,te,ie){te===void 0&&(te=[]),ie===void 0&&(ie=!0),ee=ee.replace(/^ +$/gm,"");for(var se,Ce,xe,je;ee;){if(se=this.tokenizer.space(ee)){ee=ee.substring(se.raw.length),se.type&&te.push(se);continue}if(se=this.tokenizer.code(ee,te)){ee=ee.substring(se.raw.length),se.type?te.push(se):(je=te[te.length-1],je.raw+=`
|
|
`+se.raw,je.text+=`
|
|
`+se.text);continue}if(se=this.tokenizer.fences(ee)){ee=ee.substring(se.raw.length),te.push(se);continue}if(se=this.tokenizer.heading(ee)){ee=ee.substring(se.raw.length),te.push(se);continue}if(se=this.tokenizer.nptable(ee)){ee=ee.substring(se.raw.length),te.push(se);continue}if(se=this.tokenizer.hr(ee)){ee=ee.substring(se.raw.length),te.push(se);continue}if(se=this.tokenizer.blockquote(ee)){ee=ee.substring(se.raw.length),se.tokens=this.blockTokens(se.text,[],ie),te.push(se);continue}if(se=this.tokenizer.list(ee)){for(ee=ee.substring(se.raw.length),xe=se.items.length,Ce=0;Ce<xe;Ce++)se.items[Ce].tokens=this.blockTokens(se.items[Ce].text,[],!1);te.push(se);continue}if(se=this.tokenizer.html(ee)){ee=ee.substring(se.raw.length),te.push(se);continue}if(ie&&(se=this.tokenizer.def(ee))){ee=ee.substring(se.raw.length),this.tokens.links[se.tag]||(this.tokens.links[se.tag]={href:se.href,title:se.title});continue}if(se=this.tokenizer.table(ee)){ee=ee.substring(se.raw.length),te.push(se);continue}if(se=this.tokenizer.lheading(ee)){ee=ee.substring(se.raw.length),te.push(se);continue}if(ie&&(se=this.tokenizer.paragraph(ee))){ee=ee.substring(se.raw.length),te.push(se);continue}if(se=this.tokenizer.text(ee,te)){ee=ee.substring(se.raw.length),se.type?te.push(se):(je=te[te.length-1],je.raw+=`
|
|
`+se.raw,je.text+=`
|
|
`+se.text);continue}if(ee){var nt="Infinite loop on byte: "+ee.charCodeAt(0);if(this.options.silent){console.error(nt);break}else throw new Error(nt)}}return te},ce.inline=function(ee){var te,ie,se,Ce,xe,je,nt=ee.length;for(te=0;te<nt;te++){je=ee[te];switch(je.type){case"paragraph":case"text":case"heading":{je.tokens=[],this.inlineTokens(je.text,je.tokens);break}case"table":{for(je.tokens={header:[],cells:[]},Ce=je.header.length,ie=0;ie<Ce;ie++)je.tokens.header[ie]=[],this.inlineTokens(je.header[ie],je.tokens.header[ie]);for(Ce=je.cells.length,ie=0;ie<Ce;ie++)for(xe=je.cells[ie],je.tokens.cells[ie]=[],se=0;se<xe.length;se++)je.tokens.cells[ie][se]=[],this.inlineTokens(xe[se],je.tokens.cells[ie][se]);break}case"blockquote":{this.inline(je.tokens);break}case"list":{for(Ce=je.items.length,ie=0;ie<Ce;ie++)this.inline(je.items[ie].tokens);break}}}return ee},ce.inlineTokens=function(ee,te,ie,se,Ce){te===void 0&&(te=[]),ie===void 0&&(ie=!1),se===void 0&&(se=!1),Ce===void 0&&(Ce="");var xe,je=ee,nt;if(this.tokens.links){var ft=Object.keys(this.tokens.links);if(ft.length>0)for(;(nt=this.tokenizer.rules.inline.reflinkSearch.exec(je))!=null;)ft.includes(nt[0].slice(nt[0].lastIndexOf("[")+1,-1))&&(je=je.slice(0,nt.index)+"["+"a".repeat(nt[0].length-2)+"]"+je.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(nt=this.tokenizer.rules.inline.blockSkip.exec(je))!=null;)je=je.slice(0,nt.index)+"["+"a".repeat(nt[0].length-2)+"]"+je.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;ee;){if(xe=this.tokenizer.escape(ee)){ee=ee.substring(xe.raw.length),te.push(xe);continue}if(xe=this.tokenizer.tag(ee,ie,se)){ee=ee.substring(xe.raw.length),ie=xe.inLink,se=xe.inRawBlock,te.push(xe);continue}if(xe=this.tokenizer.link(ee)){ee=ee.substring(xe.raw.length),xe.type==="link"&&(xe.tokens=this.inlineTokens(xe.text,[],!0,se)),te.push(xe);continue}if(xe=this.tokenizer.reflink(ee,this.tokens.links)){ee=ee.substring(xe.raw.length),xe.type==="link"&&(xe.tokens=this.inlineTokens(xe.text,[],!0,se)),te.push(xe);continue}if(xe=this.tokenizer.strong(ee,je,Ce)){ee=ee.substring(xe.raw.length),xe.tokens=this.inlineTokens(xe.text,[],ie,se),te.push(xe);continue}if(xe=this.tokenizer.em(ee,je,Ce)){ee=ee.substring(xe.raw.length),xe.tokens=this.inlineTokens(xe.text,[],ie,se),te.push(xe);continue}if(xe=this.tokenizer.codespan(ee)){ee=ee.substring(xe.raw.length),te.push(xe);continue}if(xe=this.tokenizer.br(ee)){ee=ee.substring(xe.raw.length),te.push(xe);continue}if(xe=this.tokenizer.del(ee)){ee=ee.substring(xe.raw.length),xe.tokens=this.inlineTokens(xe.text,[],ie,se),te.push(xe);continue}if(xe=this.tokenizer.autolink(ee,Ee)){ee=ee.substring(xe.raw.length),te.push(xe);continue}if(!ie&&(xe=this.tokenizer.url(ee,Ee))){ee=ee.substring(xe.raw.length),te.push(xe);continue}if(xe=this.tokenizer.inlineText(ee,se,Oe)){ee=ee.substring(xe.raw.length),Ce=xe.raw.slice(-1),te.push(xe);continue}if(ee){var lt="Infinite loop on byte: "+ee.charCodeAt(0);if(this.options.silent){console.error(lt);break}else throw new Error(lt)}}return te},Z(ye,null,[{key:"rules",get:function(){return{block:Re,inline:Ae}}}]),ye}(),Ie=H.defaults,Ve=Q.cleanUrl,Ue=Q.escape,Fe=function(){function ye(ge){this.options=ge||Ie}var ce=ye.prototype;return ce.code=function(ee,te,ie){var se=(te||"").match(/\S*/)[0];if(this.options.highlight){var Ce=this.options.highlight(ee,se);Ce!=null&&Ce!==ee&&(ie=!0,ee=Ce)}return se?'<pre><code class="'+this.options.langPrefix+Ue(se,!0)+'">'+(ie?ee:Ue(ee,!0))+`</code></pre>
|
|
`:"<pre><code>"+(ie?ee:Ue(ee,!0))+`</code></pre>
|
|
`},ce.blockquote=function(ee){return`<blockquote>
|
|
`+ee+`</blockquote>
|
|
`},ce.html=function(ee){return ee},ce.heading=function(ee,te,ie,se){return this.options.headerIds?"<h"+te+' id="'+this.options.headerPrefix+se.slug(ie)+'">'+ee+"</h"+te+`>
|
|
`:"<h"+te+">"+ee+"</h"+te+`>
|
|
`},ce.hr=function(){return this.options.xhtml?`<hr/>
|
|
`:`<hr>
|
|
`},ce.list=function(ee,te,ie){var se=te?"ol":"ul",Ce=te&&ie!==1?' start="'+ie+'"':"";return"<"+se+Ce+`>
|
|
`+ee+"</"+se+`>
|
|
`},ce.listitem=function(ee){return"<li>"+ee+`</li>
|
|
`},ce.checkbox=function(ee){return"<input "+(ee?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},ce.paragraph=function(ee){return"<p>"+ee+`</p>
|
|
`},ce.table=function(ee,te){return te&&(te="<tbody>"+te+"</tbody>"),`<table>
|
|
<thead>
|
|
`+ee+`</thead>
|
|
`+te+`</table>
|
|
`},ce.tablerow=function(ee){return`<tr>
|
|
`+ee+`</tr>
|
|
`},ce.tablecell=function(ee,te){var ie=te.header?"th":"td",se=te.align?"<"+ie+' align="'+te.align+'">':"<"+ie+">";return se+ee+"</"+ie+`>
|
|
`},ce.strong=function(ee){return"<strong>"+ee+"</strong>"},ce.em=function(ee){return"<em>"+ee+"</em>"},ce.codespan=function(ee){return"<code>"+ee+"</code>"},ce.br=function(){return this.options.xhtml?"<br/>":"<br>"},ce.del=function(ee){return"<del>"+ee+"</del>"},ce.link=function(ee,te,ie){if(ee=Ve(this.options.sanitize,this.options.baseUrl,ee),ee===null)return ie;var se='<a href="'+Ue(ee)+'"';return te&&(se+=' title="'+te+'"'),se+=">"+ie+"</a>",se},ce.image=function(ee,te,ie){if(ee=Ve(this.options.sanitize,this.options.baseUrl,ee),ee===null)return ie;var se='<img src="'+ee+'" alt="'+ie+'"';return te&&(se+=' title="'+te+'"'),se+=this.options.xhtml?"/>":">",se},ce.text=function(ee){return ee},ye}(),Pe=function(){function ye(){}var ce=ye.prototype;return ce.strong=function(ee){return ee},ce.em=function(ee){return ee},ce.codespan=function(ee){return ee},ce.del=function(ee){return ee},ce.html=function(ee){return ee},ce.text=function(ee){return ee},ce.link=function(ee,te,ie){return""+ie},ce.image=function(ee,te,ie){return""+ie},ce.br=function(){return""},ye}(),et=function(){function ye(){this.seen={}}var ce=ye.prototype;return ce.slug=function(ee){var te=ee.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(te)){var ie=te;do this.seen[ie]++,te=ie+"-"+this.seen[ie];while(this.seen.hasOwnProperty(te))}return this.seen[te]=0,te},ye}(),Je=H.defaults,Qe=Q.unescape,$e=function(){function ye(ge){this.options=ge||Je,this.options.renderer=this.options.renderer||new Fe,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Pe,this.slugger=new et}ye.parse=function(ee,te){var ie=new ye(te);return ie.parse(ee)};var ce=ye.prototype;return ce.parse=function(ee,te){te===void 0&&(te=!0);var ie="",se,Ce,xe,je,nt,ft,lt,wt,Et,ct,zt,It,Kt,Wt,Lt,Wr,ai,vt,Vr=ee.length;for(se=0;se<Vr;se++){ct=ee[se];switch(ct.type){case"space":continue;case"hr":{ie+=this.renderer.hr();continue}case"heading":{ie+=this.renderer.heading(this.parseInline(ct.tokens),ct.depth,Qe(this.parseInline(ct.tokens,this.textRenderer)),this.slugger);continue}case"code":{ie+=this.renderer.code(ct.text,ct.lang,ct.escaped);continue}case"table":{for(wt="",lt="",je=ct.header.length,Ce=0;Ce<je;Ce++)lt+=this.renderer.tablecell(this.parseInline(ct.tokens.header[Ce]),{header:!0,align:ct.align[Ce]});for(wt+=this.renderer.tablerow(lt),Et="",je=ct.cells.length,Ce=0;Ce<je;Ce++){for(ft=ct.tokens.cells[Ce],lt="",nt=ft.length,xe=0;xe<nt;xe++)lt+=this.renderer.tablecell(this.parseInline(ft[xe]),{header:!1,align:ct.align[xe]});Et+=this.renderer.tablerow(lt)}ie+=this.renderer.table(wt,Et);continue}case"blockquote":{Et=this.parse(ct.tokens),ie+=this.renderer.blockquote(Et);continue}case"list":{for(zt=ct.ordered,It=ct.start,Kt=ct.loose,je=ct.items.length,Et="",Ce=0;Ce<je;Ce++)Lt=ct.items[Ce],Wr=Lt.checked,ai=Lt.task,Wt="",Lt.task&&(vt=this.renderer.checkbox(Wr),Kt?Lt.tokens.length>0&&Lt.tokens[0].type==="text"?(Lt.tokens[0].text=vt+" "+Lt.tokens[0].text,Lt.tokens[0].tokens&&Lt.tokens[0].tokens.length>0&&Lt.tokens[0].tokens[0].type==="text"&&(Lt.tokens[0].tokens[0].text=vt+" "+Lt.tokens[0].tokens[0].text)):Lt.tokens.unshift({type:"text",text:vt}):Wt+=vt),Wt+=this.parse(Lt.tokens,Kt),Et+=this.renderer.listitem(Wt,ai,Wr);ie+=this.renderer.list(Et,zt,It);continue}case"html":{ie+=this.renderer.html(ct.text);continue}case"paragraph":{ie+=this.renderer.paragraph(this.parseInline(ct.tokens));continue}case"text":{for(Et=ct.tokens?this.parseInline(ct.tokens):ct.text;se+1<Vr&&ee[se+1].type==="text";)ct=ee[++se],Et+=`
|
|
`+(ct.tokens?this.parseInline(ct.tokens):ct.text);ie+=te?this.renderer.paragraph(Et):Et;continue}default:{var nr='Token with "'+ct.type+'" type was not found.';if(this.options.silent){console.error(nr);return}else throw new Error(nr)}}}return ie},ce.parseInline=function(ee,te){te=te||this.renderer;var ie="",se,Ce,xe=ee.length;for(se=0;se<xe;se++){Ce=ee[se];switch(Ce.type){case"escape":{ie+=te.text(Ce.text);break}case"html":{ie+=te.html(Ce.text);break}case"link":{ie+=te.link(Ce.href,Ce.title,this.parseInline(Ce.tokens,te));break}case"image":{ie+=te.image(Ce.href,Ce.title,Ce.text);break}case"strong":{ie+=te.strong(this.parseInline(Ce.tokens,te));break}case"em":{ie+=te.em(this.parseInline(Ce.tokens,te));break}case"codespan":{ie+=te.codespan(Ce.text);break}case"br":{ie+=te.br();break}case"del":{ie+=te.del(this.parseInline(Ce.tokens,te));break}case"text":{ie+=te.text(Ce.text);break}default:{var je='Token with "'+Ce.type+'" type was not found.';if(this.options.silent){console.error(je);return}else throw new Error(je)}}}return ie},ye}(),ht=Q.merge,Xe=Q.checkSanitizeDeprecation,Ze=Q.escape,ke=H.getDefaults,at=H.changeDefaults,it=H.defaults;function Me(ye,ce,ge){if(typeof ye=="undefined"||ye===null)throw new Error("marked(): input parameter is undefined or null");if(typeof ye!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(ye)+", string expected");if(typeof ce=="function"&&(ge=ce,ce=null),ce=ht({},Me.defaults,ce||{}),Xe(ce),ge){var ee=ce.highlight,te;try{te=_e.lex(ye,ce)}catch(xe){return ge(xe)}var ie=function(je){var nt;if(!je)try{nt=$e.parse(te,ce)}catch(ft){je=ft}return ce.highlight=ee,je?ge(je):ge(null,nt)};if(!ee||ee.length<3)return ie();if(delete ce.highlight,!te.length)return ie();var se=0;Me.walkTokens(te,function(xe){xe.type==="code"&&(se++,setTimeout(function(){ee(xe.text,xe.lang,function(je,nt){if(je)return ie(je);nt!=null&&nt!==xe.text&&(xe.text=nt,xe.escaped=!0),se--,se===0&&ie()})},0))}),se===0&&ie();return}try{var Ce=_e.lex(ye,ce);return ce.walkTokens&&Me.walkTokens(Ce,ce.walkTokens),$e.parse(Ce,ce)}catch(xe){if(xe.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,ce.silent)return"<p>An error occurred:</p><pre>"+Ze(xe.message+"",!0)+"</pre>";throw xe}}Me.options=Me.setOptions=function(ye){return ht(Me.defaults,ye),at(Me.defaults),Me},Me.getDefaults=ke,Me.defaults=it,Me.use=function(ye){var ce=ht({},ye);if(ye.renderer&&function(){var ee=Me.defaults.renderer||new Fe,te=function(Ce){var xe=ee[Ce];ee[Ce]=function(){for(var je=arguments.length,nt=new Array(je),ft=0;ft<je;ft++)nt[ft]=arguments[ft];var lt=ye.renderer[Ce].apply(ee,nt);return lt===!1&&(lt=xe.apply(ee,nt)),lt}};for(var ie in ye.renderer)te(ie);ce.renderer=ee}(),ye.tokenizer&&function(){var ee=Me.defaults.tokenizer||new Le,te=function(Ce){var xe=ee[Ce];ee[Ce]=function(){for(var je=arguments.length,nt=new Array(je),ft=0;ft<je;ft++)nt[ft]=arguments[ft];var lt=ye.tokenizer[Ce].apply(ee,nt);return lt===!1&&(lt=xe.apply(ee,nt)),lt}};for(var ie in ye.tokenizer)te(ie);ce.tokenizer=ee}(),ye.walkTokens){var ge=Me.defaults.walkTokens;ce.walkTokens=function(ee){ye.walkTokens(ee),ge&&ge(ee)}}Me.setOptions(ce)},Me.walkTokens=function(ye,ce){for(var ge=P(ye),ee;!(ee=ge()).done;){var te=ee.value;ce(te);switch(te.type){case"table":{for(var ie=P(te.tokens.header),se;!(se=ie()).done;){var Ce=se.value;Me.walkTokens(Ce,ce)}for(var xe=P(te.tokens.cells),je;!(je=xe()).done;)for(var nt=je.value,ft=P(nt),lt;!(lt=ft()).done;){var wt=lt.value;Me.walkTokens(wt,ce)}break}case"list":{Me.walkTokens(te.items,ce);break}default:te.tokens&&Me.walkTokens(te.tokens,ce)}}},Me.Parser=$e,Me.parser=$e.parse,Me.Renderer=Fe,Me.TextRenderer=Pe,Me.Lexer=_e,Me.lexer=_e.lex,Me.Tokenizer=Le,Me.Slugger=et,Me.parse=Me;var Ge=Me;return Ge})},ELLl:function(Ct,st,ne){(function(oe){oe(ne("VrN/"))})(function(oe){var Z={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},k=oe.Pos;oe.defineOption("autoCloseBrackets",!1,function(A,C,d){d&&d!=oe.Init&&(A.removeKeyMap(P),A.state.closeBrackets=null),C&&(I(Y(C,"pairs")),A.state.closeBrackets=C,A.addKeyMap(P))});function Y(A,C){return C=="pairs"&&typeof A=="string"?A:typeof A=="object"&&A[C]!=null?A[C]:Z[C]}var P={Backspace:O,Enter:R};function I(A){for(var C=0;C<A.length;C++){var d=A.charAt(C),o="'"+d+"'";P[o]||(P[o]=H(d))}}I(Z.pairs+"`");function H(A){return function(C){return w(C,A)}}function U(A){var C=A.state.closeBrackets;if(!C||C.override)return C;var d=A.getModeAt(A.getCursor());return d.closeBrackets||C}function O(A){var C=U(A);if(!C||A.getOption("disableInput"))return oe.Pass;for(var d=Y(C,"pairs"),o=A.listSelections(),l=0;l<o.length;l++){if(!o[l].empty())return oe.Pass;var h=_(A,o[l].head);if(!h||d.indexOf(h)%2!=0)return oe.Pass}for(var l=o.length-1;l>=0;l--){var T=o[l].head;A.replaceRange("",k(T.line,T.ch-1),k(T.line,T.ch+1),"+delete")}}function R(A){var C=U(A),d=C&&Y(C,"explode");if(!d||A.getOption("disableInput"))return oe.Pass;for(var o=A.listSelections(),l=0;l<o.length;l++){if(!o[l].empty())return oe.Pass;var h=_(A,o[l].head);if(!h||d.indexOf(h)%2!=0)return oe.Pass}A.operation(function(){var T=A.lineSeparator()||`
|
|
`;A.replaceSelection(T+T,null),A.execCommand("goCharLeft"),o=A.listSelections();for(var f=0;f<o.length;f++){var p=o[f].head.line;A.indentLine(p,null,!0),A.indentLine(p+1,null,!0)}})}function y(A){var C=oe.cmpPos(A.anchor,A.head)>0;return{anchor:new k(A.anchor.line,A.anchor.ch+(C?-1:1)),head:new k(A.head.line,A.head.ch+(C?1:-1))}}function w(A,C){var d=U(A);if(!d||A.getOption("disableInput"))return oe.Pass;var o=Y(d,"pairs"),l=o.indexOf(C);if(l==-1)return oe.Pass;for(var h=Y(d,"closeBefore"),T=Y(d,"triples"),f=o.charAt(l+1)==C,p=A.listSelections(),D=l%2==0,E,g=0;g<p.length;g++){var c=p[g],u=c.head,a,x=A.getRange(u,k(u.line,u.ch+1));if(D&&!c.empty())a="surround";else if((f||!D)&&x==C)f&&L(A,u)?a="both":T.indexOf(C)>=0&&A.getRange(u,k(u.line,u.ch+3))==C+C+C?a="skipThree":a="skip";else if(f&&u.ch>1&&T.indexOf(C)>=0&&A.getRange(k(u.line,u.ch-2),u)==C+C){if(u.ch>2&&/\bstring/.test(A.getTokenTypeAt(k(u.line,u.ch-2))))return oe.Pass;a="addFour"}else if(f){var b=u.ch==0?" ":A.getRange(k(u.line,u.ch-1),u);if(!oe.isWordChar(x)&&b!=C&&!oe.isWordChar(b))a="both";else return oe.Pass}else if(D&&(x.length===0||/\s/.test(x)||h.indexOf(x)>-1))a="both";else return oe.Pass;if(!E)E=a;else if(E!=a)return oe.Pass}var v=l%2?o.charAt(l-1):C,M=l%2?C:o.charAt(l+1);A.operation(function(){if(E=="skip")A.execCommand("goCharRight");else if(E=="skipThree")for(var G=0;G<3;G++)A.execCommand("goCharRight");else if(E=="surround"){for(var X=A.getSelections(),G=0;G<X.length;G++)X[G]=v+X[G]+M;A.replaceSelections(X,"around"),X=A.listSelections().slice();for(var G=0;G<X.length;G++)X[G]=y(X[G]);A.setSelections(X)}else E=="both"?(A.replaceSelection(v+M,null),A.triggerElectric(v+M),A.execCommand("goCharLeft")):E=="addFour"&&(A.replaceSelection(v+v+v+v,"before"),A.execCommand("goCharRight"))})}function _(A,C){var d=A.getRange(k(C.line,C.ch-1),k(C.line,C.ch+1));return d.length==2?d:null}function L(A,C){var d=A.getTokenAt(k(C.line,C.ch+1));return/\bstring/.test(d.type)&&d.start==C.ch&&(C.ch==0||!/\bstring/.test(A.getTokenTypeAt(C)))}})},HmJG:function(Ct,st,ne){},LdHM:function(Ct,st,ne){"use strict";ne.d(st,"b",function(){return h}),ne.d(st,"a",function(){return f});var oe=ne("1OyB"),Z=ne("vuIU"),k=ne("Ji7U"),Y=ne("LK+K"),P=ne("q1tI"),I=ne("rePB"),H=ne("Ff2n"),U=ne("ODXe"),O=ne("4IlW"),R=ne("bX4T"),y=ne("YrtM"),w=ne("TSYQ"),_=ne.n(w),L=ne("+nKL"),A=ne("8OUc"),C=function(q,le){var me=q.prefixCls,be=q.id,Be=q.flattenOptions,Le=q.childrenAsData,De=q.values,de=q.searchValue,pe=q.multiple,ae=q.defaultActiveFirstOption,re=q.height,we=q.itemHeight,ve=q.notFoundContent,Re=q.open,Ae=q.menuItemSelectedIcon,Oe=q.virtual,Ee=q.onSelect,_e=q.onToggleOpen,Ie=q.onActiveValue,Ve=q.onScroll,Ue=q.onMouseEnter,Fe="".concat(me,"-item"),Pe=Object(y.a)(function(){return Be},[Re,Be],function(Ge,ye){return ye[0]&&Ge[1]!==ye[1]}),et=P.useRef(null),Je=function(ye){ye.preventDefault()},Qe=function(ye){et.current&&et.current.scrollTo({index:ye})},$e=function(ye){for(var ce=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,ge=Pe.length,ee=0;ee<ge;ee+=1){var te=(ye+ee*ce+ge)%ge,ie=Pe[te],se=ie.group,Ce=ie.data;if(!se&&!Ce.disabled)return te}return-1},ht=P.useState(function(){return $e(0)}),Xe=Object(U.a)(ht,2),Ze=Xe[0],ke=Xe[1],at=function(ye){ke(ye);var ce=Pe[ye];if(!ce){Ie(null,-1);return}Ie(ce.data.value,ye)};P.useEffect(function(){at(ae!==!1?$e(0):-1)},[Pe.length,de]),P.useEffect(function(){var Ge=setTimeout(function(){if(!pe&&Re&&De.size===1){var ye=Array.from(De)[0],ce=Pe.findIndex(function(ge){var ee=ge.data;return ee.value===ye});at(ce),Qe(ce)}});return function(){return clearTimeout(Ge)}},[Re]);var it=function(ye){ye!==void 0&&Ee(ye,{selected:!De.has(ye)}),pe||_e(!1)};if(P.useImperativeHandle(le,function(){return{onKeyDown:function(ye){var ce=ye.which;switch(ce){case O.a.UP:case O.a.DOWN:{var ge=0;if(ce===O.a.UP?ge=-1:ce===O.a.DOWN&&(ge=1),ge!==0){var ee=$e(Ze+ge,ge);Qe(ee),at(ee)}break}case O.a.ENTER:{var te=Pe[Ze];te&&!te.data.disabled?it(te.data.value):it(void 0),Re&&ye.preventDefault();break}case O.a.ESC:_e(!1)}},onKeyUp:function(){},scrollTo:function(ye){Qe(ye)}}}),Pe.length===0)return P.createElement("div",{role:"listbox",id:"".concat(be,"_list"),className:"".concat(Fe,"-empty"),onMouseDown:Je},ve);function Me(Ge){var ye=Pe[Ge];if(!ye)return null;var ce=ye.data||{},ge=ce.value,ee=ce.label,te=ce.children,ie=Object(R.a)(ce,!0),se=Le?te:ee;return ye?P.createElement("div",Object.assign({"aria-label":typeof se=="string"?se:null},ie,{key:Ge,role:"option",id:"".concat(be,"_list_").concat(Ge),"aria-selected":De.has(ge)}),ge):null}return P.createElement(P.Fragment,null,P.createElement("div",{role:"listbox",id:"".concat(be,"_list"),style:{height:0,width:0,overflow:"hidden"}},Me(Ze-1),Me(Ze),Me(Ze+1)),P.createElement(L.a,{itemKey:"key",ref:et,data:Pe,height:re,itemHeight:we,fullHeight:!1,onMouseDown:Je,onScroll:Ve,virtual:Oe,onMouseEnter:Ue},function(Ge,ye){var ce,ge=Ge.group,ee=Ge.groupOption,te=Ge.data,ie=te.label,se=te.key;if(ge)return P.createElement("div",{className:_()(Fe,"".concat(Fe,"-group"))},ie!==void 0?ie:se);var Ce=te.disabled,xe=te.value,je=te.title,nt=te.children,ft=te.style,lt=te.className,wt=Object(H.a)(te,["disabled","value","title","children","style","className"]),Et=De.has(xe),ct="".concat(Fe,"-option"),zt=_()(Fe,ct,lt,(ce={},Object(I.a)(ce,"".concat(ct,"-grouped"),ee),Object(I.a)(ce,"".concat(ct,"-active"),Ze===ye&&!Ce),Object(I.a)(ce,"".concat(ct,"-disabled"),Ce),Object(I.a)(ce,"".concat(ct,"-selected"),Et),ce)),It=Le?nt:ie,Kt=!Ae||typeof Ae=="function"||Et;return P.createElement("div",Object.assign({},wt,{"aria-selected":Et,className:zt,title:je,onMouseMove:function(){if(Ze===ye||Ce)return;at(ye)},onClick:function(){Ce||it(xe)},style:ft}),P.createElement("div",{className:"".concat(ct,"-content")},It||xe),P.isValidElement(Ae)||Et,Kt&&P.createElement(A.a,{className:"".concat(Fe,"-option-state"),customizeIcon:Ae,customizeIconProps:{isSelected:Et}},Et?"\u2713":null))}))},d=P.forwardRef(C);d.displayName="OptionList";var o=d,l=function(){return null};l.isSelectOption=!0;var h=l,T=function(){return null};T.isSelectOptGroup=!0;var f=T,p=ne("VTBJ"),D=ne("Zm9Q");function E(j){var q=j.key,le=j.props,me=le.children,be=le.value,Be=Object(H.a)(le,["children","value"]);return Object(p.a)({key:q,value:be!==void 0?be:q,children:me},Be)}function g(j){var q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(D.a)(j).map(function(le,me){if(!P.isValidElement(le)||!le.type)return null;var be=le.type.isSelectOptGroup,Be=le.key,Le=le.props,De=Le.children,de=Object(H.a)(Le,["children"]);return q||!be?E(le):Object(p.a)(Object(p.a)({key:"__RC_SELECT_GRP__".concat(Be===null?me:Be,"__"),label:Be},de),{},{options:g(De)})}).filter(function(le){return le})}var c=ne("2Qr1"),u=ne("qNPg"),a=ne("U8pU"),x=ne("Kwbf"),b=ne("WKfj");function v(j){var q=j.mode,le=j.options,me=j.children,be=j.backfill,Be=j.allowClear,Le=j.placeholder,De=j.getInputElement,de=j.showSearch,pe=j.onSearch,ae=j.defaultOpen,re=j.autoFocus,we=j.labelInValue,ve=j.value,Re=j.inputValue,Ae=j.optionLabelProp,Oe=q==="multiple"||q==="tags",Ee=de!==void 0?de:Oe||q==="combobox",_e=le||g(me);if(Object(x.a)(q!=="tags"||_e.every(function(Fe){return!Fe.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),q==="tags"||q==="combobox"){var Ie=_e.some(function(Fe){return Fe.options?Fe.options.some(function(Pe){return typeof("value"in Pe?Pe.value:Pe.key)=="number"}):typeof("value"in Fe?Fe.value:Fe.key)=="number"});Object(x.a)(!Ie,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(x.a)(q!=="combobox"||!Ae,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(x.a)(q==="combobox"||!be,"`backfill` only works with `combobox` mode."),Object(x.a)(q==="combobox"||!De,"`getInputElement` only work with `combobox` mode."),Object(x.b)(q!=="combobox"||!De||!Be||!Le,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),pe&&!Ee&&q!=="combobox"&&q!=="tags"&&Object(x.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(x.b)(!ae||re,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),ve!=null){var Ve=Object(b.d)(ve);Object(x.a)(!we||Ve.every(function(Fe){return Object(a.a)(Fe)==="object"&&("key"in Fe||"value"in Fe)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(x.a)(!Oe||Array.isArray(ve),"`value` should be array when `mode` is `multiple` or `tags`")}if(me){var Ue=null;Object(D.a)(me).some(function(Fe){if(!P.isValidElement(Fe)||!Fe.type)return!1;var Pe=Fe.type;if(Pe.isSelectOption)return!1;if(Pe.isSelectOptGroup){var et=Object(D.a)(Fe.props.children).every(function(Je){return!P.isValidElement(Je)||!Fe.type||Je.type.isSelectOption?!0:(Ue=Je.type,!1)});return!et}return Ue=Pe,!0}),Ue&&Object(x.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(Ue.displayName||Ue.name||Ue,"`.")),Object(x.a)(Re===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var M=v,G=Object(u.a)({prefixCls:"rc-select",components:{optionList:o},convertChildrenToData:g,flattenOptions:c.d,getLabeledValue:c.e,filterOptions:c.b,isValueDisabled:c.g,findValueOption:c.c,warningProps:M,fillOptionsWithMissingValue:c.a}),X=function(j){Object(k.a)(le,j);var q=Object(Y.a)(le);function le(){var me;return Object(oe.a)(this,le),me=q.apply(this,arguments),me.selectRef=P.createRef(),me.focus=function(){me.selectRef.current.focus()},me.blur=function(){me.selectRef.current.blur()},me}return Object(Z.a)(le,[{key:"render",value:function(){return P.createElement(G,Object.assign({ref:this.selectRef},this.props))}}]),le}(P.Component);X.Option=h,X.OptGroup=f;var Q=X,z=st.c=Q},M8RZ:function(Ct,st,ne){"use strict";ne.d(st,"a",function(){return O});var oe=ne("fWQN"),Z=ne("mtLc"),k=ne("yKVA"),Y=ne("879j"),P=ne("q1tI"),I=ne.n(P),H=ne("i8i4"),U=ne.n(H),O=function(R){Object(k.a)(w,R);var y=Object(Y.a)(w);function w(_){var L;Object(oe.a)(this,w),L=y.call(this,_);var A=window.document;return L.node=A.createElement("div"),A.body.appendChild(L.node),L}return Object(Z.a)(w,[{key:"render",value:function(){var L=this.props.children;return Object(H.createPortal)(L,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),w}(I.a.Component)},Ot1p:function(Ct,st,ne){"use strict";var oe=ne("2qtc"),Z=ne("kLXV"),k=ne("rAM+"),Y=ne("miYZ"),P=ne("tsqr"),I=ne("9og8"),H=ne("tJVT"),U=ne("jrin"),O=ne("WmNS"),R=ne.n(O),y=ne("q1tI"),w=ne.n(y),_=ne("VrN/"),L=ne.n(_),A=ne("bdgK"),C=ne("p77/"),d=ne("Bd2K"),o=ne("ELLl"),l=ne("19Vz"),h=ne("lZu9"),T=ne("+NIl"),f=ne("kSUc"),p=ne("9Bee"),D=function(xe){var je=xe.value,nt=je===void 0?"":je,ft=xe.className,lt=xe.showTextOnly,wt=xe.showLines,Et=xe.style,ct=Et===void 0?{}:Et,zt=Object(y.useMemo)(function(){return""},[nt]);return w.a.createElement(w.a.Fragment,null,w.a.createElement("div",{dangerouslySetInnerHTML:{__html:zt}}))},E=ne("0Owb"),g=ne("dejd"),c=ne("C+DQ"),u=ne("1vsH"),a=ne("m3rI"),x=[{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 b(xe){var je=xe.onActionCallback,nt=xe.title,ft=xe.icon,lt=xe.actionName,wt=xe.className,Et=wt===void 0?"":wt,ct=xe.children;function zt(){je(lt)}return w.a.createElement("a",{title:nt,className:Et,onClick:zt},w.a.createElement("i",{className:"md-iconfont ".concat(ft)}),ct)}var v=function(xe){var je=xe.watch,nt=xe.showNullButton,ft=xe.onActionCallback,lt=xe.fullScreen,wt=xe.insertTemp,Et=xe.hidetoolBar,ct=xe.uuid,zt=xe.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(u.E)("_educoder_session_login"),"&_educoder_session=").concat(Object(u.E)("_educoder_session"),"&key=").concat(ct,"&api=").concat(encodeURIComponent(a.a.PROXY_SERVER)));var It=[].concat(x,[{title:"".concat(je?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(je?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return w.a.createElement("ul",{className:"markdown-toolbar-container"},!Et&&It.map(function(Kt,Wt){return w.a.createElement("li",{key:Wt},Kt.actionName?w.a.createElement(b,Object(E.a)({},Kt,{onActionCallback:ft})):w.a.createElement("span",{className:"v-line"}))}),nt?w.a.createElement("li",null,w.a.createElement(b,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:ft},w.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,wt&&w.a.createElement("li",null,w.a.createElement(b,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(wt),onActionCallback:ft},w.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),w.a.createElement("li",{className:"btn-full-screen"},w.a.createElement(b,{icon:"".concat(lt?"icon-shrink":"icon-enlarge"),title:lt?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:ft})))},M=ne("M8RZ"),G=ne("+L6B"),X=ne("2/Rp"),Q=ne("y8nQ"),z=ne("Vl3Y"),j=ne("5NDa"),q=ne("5rEg"),le={labelCol:{span:4},wrapperCol:{span:20}},me=function(xe){var je=xe.callback,nt=xe.onCancel;function ft(lt){je(lt)}return w.a.createElement(z.a,Object(E.a)({},le,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:ft}),w.a.createElement(z.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},w.a.createElement(q.a,null)),w.a.createElement(z.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},w.a.createElement(q.a,null)),w.a.createElement("div",{className:"flex-container flex-end"},w.a.createElement(X.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),w.a.createElement(X.a,{type:"ghost",onClick:nt},"\u53D6\u6D88")))},be=ne("7ahc"),Be=ne("k1fw"),Le=ne("HmJG"),De=ne("BjJ7"),de=z.a.useForm,pe={width:280,marginRight:10},ae={labelCol:{span:5},wrapperCol:{span:19}},re=function(xe){var je=xe.callback,nt=xe.onCancel,ft=de(),lt=Object(H.a)(ft,1),wt=lt[0],Et=Object(y.useRef)();function ct(Kt){je(Object(Be.a)(Object(Be.a)({},Kt),{},{name:Et.current}))}function zt(Kt,Wt){wt.setFieldsValue({src:"/api/attachments/".concat(Kt.id,"?type=").concat(Kt.content_type),type:Wt.type})}function It(Kt){var Wt=Kt.target.files[0];Et.current=Wt.name,ve(Wt,zt)}return w.a.createElement(z.a,Object(E.a)({form:wt},ae,{className:"upload-image-panel",onFinish:ct}),w.a.createElement(z.a.Item,{label:"\u6587\u4EF6\u5730\u5740",required:!0},w.a.createElement("div",{className:"flex-container"},w.a.createElement(z.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u6587\u4EF6\u5730\u5740"}]},w.a.createElement(q.a,{style:pe})),w.a.createElement(we,{onFileChange:It}))),w.a.createElement(z.a.Item,{label:"\u6587\u4EF6\u63CF\u8FF0",name:"alt"},w.a.createElement(q.a,{style:{width:264}})),w.a.createElement(z.a.Item,{style:{textAlign:"right"}},w.a.createElement(X.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),w.a.createElement(X.a,{type:"ghost",onClick:nt},"\u53D6\u6D88")))};function we(xe){var je=xe.onFileChange;return w.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",w.a.createElement("input",{type:"file",onChange:je}))}function ve(xe,je){if(!xe)throw new String("\u6CA1\u6709\u6587\u4EF6");var nt=new FormData;nt.append("editormd-image-file",xe),nt.append("file_param_name","editormd-image-file"),nt.append("byxhr","true");var ft=new window.XMLHttpRequest;ft.withCredentials=!0,ft.addEventListener("load",function(lt){je(JSON.parse(lt.target.responseText),xe)},!1),ft.addEventListener("error",function(lt){console.error(lt)},!1),ft.open("POST","".concat(De.a,"/api/attachments.json")),ft.send(nt)}var Re=ne("giR+"),Ae=ne("fyUT"),Oe=ne("7Kak"),Ee=ne("9yH6"),_e=Ee.a.Group,Ie={margin:"0 8px"},Ve=function(xe){var je=xe.callback,nt=xe.onCancel;function ft(lt){je(lt)}return w.a.createElement(z.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:ft},w.a.createElement("div",{className:"flex-container"},w.a.createElement("span",{style:Ie},"\u5355\u5143\u683C\u6570\uFF1A"),w.a.createElement("span",{style:Ie},"\u884C\u6570"),w.a.createElement(z.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},w.a.createElement(Ae.a,null)),w.a.createElement("span",{style:Ie},"\u5217\u6570"),w.a.createElement(z.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},w.a.createElement(Ae.a,null))),w.a.createElement("div",{className:"flex-container",style:{marginTop:12}},w.a.createElement("span",{style:Ie},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),w.a.createElement(z.a.Item,{name:"align"},w.a.createElement(_e,null,w.a.createElement(Ee.a,{value:"default"},w.a.createElement("i",{className:"fa fa-align-justify"})),w.a.createElement(Ee.a,{value:"left"},w.a.createElement("i",{className:"fa fa-align-left"})),w.a.createElement(Ee.a,{value:"center"},w.a.createElement("i",{className:"fa fa-align-center"})),w.a.createElement(Ee.a,{value:"right"},w.a.createElement("i",{className:"fa fa-align-right"}))))),w.a.createElement("div",{className:"flex-container flex-end"},w.a.createElement(X.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),w.a.createElement(X.a,{type:"ghost",onClick:nt},"\u53D6\u6D88")))},Ue=ne("ErOA"),Fe=ne("7Cbv"),Pe="link",et="upload-image",Je="code-block",Qe="add-table",$e="------------",ht={default:$e,left:":".concat($e),center:":".concat($e,":"),right:"".concat($e,":")},Xe=ne("9VGf"),Ze,ke;function at(){}var it=0,Me=1e4,Ge="\u2581",ye=`
|
|
**\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 ce(xe){return/^\d+$/.test(xe)?"".concat(xe,"px"):xe}var ge=navigator.platform.toUpperCase().indexOf("MAC")>=0,ee=ge?"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=(Ze={},Object(U.a)(Ze,ee+"-B","bold"),Object(U.a)(Ze,ee+"-I","italic"),Ze),se=(ke={},Object(U.a)(ke,Pe,"\u6DFB\u52A0\u94FE\u63A5"),Object(U.a)(ke,Je,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(U.a)(ke,et,"\u6DFB\u52A0\u6587\u4EF6"),Object(U.a)(ke,Qe,"\u6DFB\u52A0\u8868\u683C"),ke),Ce=st.a=function(xe){var je=xe.defaultValue,nt=je===void 0?"":je,ft=xe.onChange,lt=xe.width,wt=lt===void 0?"100%":lt,Et=xe.height,ct=Et===void 0?400:Et,zt=xe.miniToolbar,It=zt===void 0?!1:zt,Kt=xe.isFocus,Wt=Kt===void 0?!1:Kt,Lt=xe.watch,Wr=xe.insertTemp,ai=xe.mode,vt=ai===void 0?"markdown":ai,Vr=xe.id,nr=Vr===void 0?"markdown-editor-id":Vr,cr=xe.showResizeBar,Hr=cr===void 0?!1:cr,oi=xe.noStorage,si=oi===void 0?!1:oi,Pt=xe.showNullButton,pt=Pt===void 0?!1:Pt,Pr=xe.hidetoolBar,li=Pr===void 0?!1:Pr,xr=xe.fullScreen,Dt=xr===void 0?!1:xr,Mr=xe.onBlur,Xr=xe.onCMBeforeChange,ui=xe.onFullScreen,Ke=xe.className,St=Ke===void 0?"":Ke,di=xe.disablePaste,Li=di===void 0?!1:di,hi=xe.placeholder,Di=hi===void 0?"":hi,W=xe.values,s=W===void 0?"":W,m=Object(y.useState)(null),B=Object(H.a)(m,2),K=B[0],F=B[1],fe=Object(y.useState)(nt),We=Object(H.a)(fe,2),qe=We[0],ut=We[1],He=Object(y.useState)(Lt),xt=Object(H.a)(He,2),_t=xt[0],Vt=xt[1],Ir=Object(y.useState)(Dt),Nr=Object(H.a)(Ir,2),ar=Nr[0],Gr=Nr[1],Hi=Object(y.useState)(""),Er=Object(H.a)(Hi,2),Br=Er[0],kr=Er[1],gi=Object(y.useState)(0),Yr=Object(H.a)(gi,2),ci=Yr[0],ei=Yr[1],hn=Object(y.useState)(ct),Gi=Object(H.a)(hn,2),$r=Gi[0],Fr=Gi[1],ki=Object(y.useState)(!1),_i=Object(H.a)(ki,2),cn=_i[0],Zt=_i[1],Nt=Object(y.useRef)(Object(Fe.a)()),fr=Object(y.useRef)(!1),Mt=Object(y.useRef)(),er=Object(y.useRef)(),Ut=Object(y.useRef)(),ti=Object(y.useRef)(),Qt=Object(y.useRef)(),Sr=function(){var mt=Object(I.a)(R.a.mark(function Tt(){var yt,kt;return R.a.wrap(function(Ht){for(;;)switch(Ht.prev=Ht.next){case 0:return Ht.next=2,Object(Ue.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:Nt.current}});case 2:kt=Ht.sent,kt!=null&&(yt=kt.attachments)!==null&&yt!==void 0&&yt.length&&(console.log("cm:",K,er),kt.attachments.map(function(Ot){Ot.content_type.indexOf("image")>-1?K.replaceSelection(".concat(Ot.content_type,")")):Ot.content_type.indexOf("video")>-1?K.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):Ot.content_type.indexOf("pdf")>-1?K.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Ot.id,"?type=").concat(Ot.content_type,'&disposition=inline" target="_blank">').concat(Ot.name,"</a>")):K.replaceSelection("[".concat(Ot.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(Ot.id,"?type=").concat(Ot.content_type,")"))}));case 4:case"end":return Ht.stop()}},Tt)}));return function(){return mt.apply(this,arguments)}}();Object(y.useEffect)(function(){ut(s),K==null||K.setValue(s)},[s]),Object(y.useEffect)(function(){ui==null||ui(ar)},[ar]),Object(y.useEffect)(function(){if(er.current){var mt=L.a.fromTextArea(er.current,{mode:vt,lineNumbers:!It,lineWrapping:!0,value:nt,autoCloseTags:!0,autoCloseBrackets:!0});Wt&&mt.focus();function Tt(yt,kt){if(Li){kt.preventDefault();return}var Bt=kt.clipboardData;if(Bt){var Ht=Bt.types.toString(),Ot=Bt.items;if(Ht==="Files"||Bt.types.indexOf("Files")>-1){if(kt.preventDefault(),vt=="stex")return;try{var tr,Cr=Ot[1];((tr=Ot[0])===null||tr===void 0?void 0:tr.kind)==="file"&&(Cr=Ot[0]);var Rt=Cr.getAsFile(),yi=Rt.name.split(".").pop();ve(Rt,function(Ft){if(Ft.id){var sr,zr,Kr;(Rt==null||((sr=Rt.type)===null||sr===void 0)?void 0:sr.indexOf("image"))>-1?mt.replaceSelection(".concat(Ft.content_type,")")):(Rt==null||((zr=Rt.type)===null||zr===void 0)?void 0:zr.indexOf("video"))>-1?mt.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Ft.id,'"></video>')):(Rt==null||((Kr=Rt.type)===null||Kr===void 0)?void 0:Kr.indexOf("pdf"))>-1?mt.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Ft.id,"?type=").concat(Rt.type,'&disposition=inline" target="_blank">').concat(Rt.name,"</a>")):te.includes(yi)?mt.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Ft.id,'?type=office&disposition=inline" target="_blank">').concat(Rt.name,"</a>")):mt.replaceSelection("[".concat(Rt.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(Ft.id,"?type=").concat(Ft.content_type,")"))}else(Ft==null?void 0:Ft.status)===401&&(document.location.href="/user/login")})}catch(Ft){P.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return mt.on("paste",Tt),mt.on("dragleave",function(yt,kt){Ut.current.classList.remove("mouse-hover-md")}),mt.on("dragover",function(yt,kt){Ut.current.classList.add("mouse-hover-md")}),mt.on("drop",function(yt,kt){Ut.current.classList.add("mouse-hover-md");var Bt;if(Bt=kt.dataTransfer.files,Bt.length>0){kt.preventDefault(),kt.stopPropagation();for(var Ht=function(Cr){var Rt=Bt[Cr],yi=Rt.name.split(".").pop();ve(Rt,function(Ft){if(Ft.id){var sr,zr,Kr;(Rt==null||((sr=Rt.type)===null||sr===void 0)?void 0:sr.indexOf("image"))>-1?mt.replaceSelection(".concat(Ft.content_type,")")):(Rt==null||((zr=Rt.type)===null||zr===void 0)?void 0:zr.indexOf("video"))>-1?mt.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Ft.id,'"></video>')):(Rt==null||((Kr=Rt.type)===null||Kr===void 0)?void 0:Kr.indexOf("pdf"))>-1?mt.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Ft.id,"?type=").concat(Rt.type,'&disposition=inline" target="_blank">').concat(Rt.name,"</a>")):te.includes(yi)?mt.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Ft.id,'?type=office&disposition=inline" target="_blank">').concat(Rt.name,"</a>")):mt.replaceSelection("[".concat(Rt.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(Ft.id,"?type=").concat(Ft.content_type,")"))}else(Ft==null?void 0:Ft.status)===401&&(document.location.href="/user/login")})},Ot=0;Ot<Bt.length;Ot++)Ht(Ot)}}),F(mt),function(){mt.off("paste",Tt)}}},[]);var zi=Object(y.useCallback)(function(){if(Ut.current)try{}catch(mt){console.log(mt,"---- to set md editor body height")}},[$r,Ut,ar]);Object(y.useEffect)(function(){function mt(){var yt=new A.default(function(kt){var Bt=Object(k.a)(kt),Ht;try{for(Bt.s();!(Ht=Bt.n()).done;){var Ot=Ht.value;(Ot.target.offsetHeight>0||Ot.target.offsetWidth>0)&&(zi(),K.setSize("100%","100%"),K.refresh())}}catch(tr){Bt.e(tr)}finally{Bt.f()}});return yt.observe(er.current.parentElement),yt}if(K){var Tt=mt();return function(){Tt.unobserve(er.current.parentElement)}}},[K,zi]),Object(y.useEffect)(function(){if(K){for(var mt=[],Tt=function(){var Ot=kt[yt];Bt=Object(H.a)(Ot,2);var tr=Bt[0],Cr=Bt[1],Rt=Object(U.a)({},tr,function(){Ki(Cr)});mt.push(Rt),K.addKeyMap(Rt)},yt=0,kt=Object.entries(ie);yt<kt.length;yt++){var Bt;Tt()}return Mt.current=setInterval(function(){fr.current&&Sr()},4e3),function(){clearInterval(Mt.current);var Ht=Object(k.a)(mt),Ot;try{for(Ht.s();!(Ot=Ht.n()).done;){var tr=Ot.value;K.removeKeyMap(tr)}}catch(Cr){Ht.e(Cr)}finally{Ht.f()}}}},[K]),Object(y.useEffect)(function(){Dt!==ar&&Gr(Dt)},[Dt]),Object(Xe.a)(function(){if(!si&&ci>0){var mt=new Date().getTime(),Tt=window.sessionStorage.getItem(nr);mt>=ci+Me&&(!Tt||Tt!==qe)&&(window.sessionStorage.setItem(nr,qe),Zt(!0))}},Me),Object(y.useEffect)(function(){Vt(Lt)},[K,Lt]),Object(y.useEffect)(function(){K&&(Wt&&K.focus())},[K,Wt]),Object(y.useEffect)(function(){if(_t&&K){var mt=K.getScrollerElement();function Tt(yt){var kt=yt.target;if(Qt.current){var Bt=kt.scrollTop/kt.scrollHeight;Qt.current.scrollTop=Qt.current.scrollHeight*Bt}}return mt.addEventListener("scroll",Tt),function(){mt.removeEventListener("scroll",Tt)}}},[K,_t]),Object(y.useEffect)(function(){if(K&&Xr){function mt(Tt,yt){Xr(Tt,yt)}return K.on("beforeChange",mt),function(){K.off("beforeChange",mt)}}},[K,Xr]),Object(y.useEffect)(function(){if(K&&Mr){function mt(){Mr(K.getValue())}return K.on("blur",mt),function(){K.off("blur",mt)}}},[K,Mr]),Object(y.useEffect)(function(){if(K){function mt(Tt){var yt=Tt.getValue();ut(yt),ei(new Date().getTime()),Tt.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),ft&&ft(yt)}return K.on("change",mt),function(){K.off("change",mt)}}},[K,ft]),Object(y.useEffect)(function(){K&&(nt==null?(K.setValue(""),ut("")):nt!==K.getValue()&&(K.setValue(nt),ut(nt),K.setCursor(K.lineCount(),0)))},[K,nt]);var Ki=Object(y.useCallback)(function(mt){var Tt=K.getCursor(),yt=K.getSelection(),kt=yt.split(`
|
|
`);switch(mt){case"bold":return K.replaceSelection("**"+yt+"**"),yt===""&&K.setCursor(Tt.line,Tt.ch+2),K.focus();case"italic":return K.replaceSelection("*"+yt+"*"),yt===""&&K.setCursor(Tt.line,Tt.ch+1),K.focus();case"code":return K.replaceSelection("`"+yt+"`"),yt===""&&K.setCursor(Tt.line,Tt.ch+1),K.focus();case"inline-latex":return K.replaceSelection("`$$"+yt+"$$`"),yt===""&&K.setCursor(Tt.line,Tt.ch+3),K.focus();case"latex":return K.replaceSelection("```latex\n"+yt+"\n```"),K.setCursor(Tt.line+1,yt.length+1),K.focus();case"line-break":return K.replaceSelection(`<br/>
|
|
`),K.focus();case"list-ul":return yt===""?K.replaceSelection("- "+yt):K.replaceSelection(kt.map(function(Bt){return Bt===""?"":"- ".concat(Bt)}).join(`
|
|
`)),K.focus();case"list-ol":return yt===""?K.replaceSelection("1. "+yt):K.replaceSelection(kt.map(function(Bt,Ht){return Bt===""?"":"".concat(Ht+1,". ").concat(Bt)}).join(`
|
|
`)),K.focus();case"add-null-ch":return yt===""&&K.setCursor(Tt.line,Tt.ch+1),K.replaceSelection(Ge),K.focus();case"inster-template-1":return yt===""&&K.setCursor(Tt.line,Tt.ch),K.replaceSelection(ye),K.focus();case"eraser":return K.setValue(""),K.focus();case"trigger-watch":return Vt(!_t),K.focus();case"trigger-full-screen":return Gr(!ar),K.focus();case Pe:kr(Pe);return;case Je:kr(Je);return;case et:kr(et);return;case Qe:kr(Qe);return;default:throw new Error}},[K,_t,ar]),vi=Object(y.useCallback)(function(mt){kr("");switch(Br){case Pe:var Tt=mt.title,yt=mt.link;return K.replaceSelection("[".concat(Tt,"](").concat(yt,")")),K.focus();case Je:var kt=mt.language,Bt=mt.content;return K.replaceSelection(["```"+kt,Bt,"```"].join(`
|
|
`)),K.focus();case et:var Ht=mt.src,Ot=mt.alt,tr=mt.name;return Ht.indexOf("type=image")>-1?K.replaceSelection(".concat(Ht,' "').concat(Ot||"",'" )')):Ht.indexOf("type=application/pdf")>-1?K.replaceSelection('<a href="'.concat(Ht,'&disposition=inline" target="_blank">').concat(tr,"</a>")):K.replaceSelection('<a href="'.concat(Ht,'" target="_blank">').concat(tr,"</a>")),K.focus();case Qe:for(var Cr=mt.row,Rt=mt.col,yi=mt.align,Ft=`
|
|
`,sr=0;sr<Cr;sr++){for(var zr=[],Kr=[],Wn=0;Wn<Rt;Wn++)sr===1&&Kr.push(ht[yi]),zr.push(" ");sr===1&&(Ft+="| ".concat(Kr.join(" | "),` |
|
|
`)),Ft+="| ".concat(zr.join(Rt===1?"":" | "),` |
|
|
`)}return K.replaceSelection(Ft+`
|
|
`),K.focus();default:throw new Error}},[K,Br]),Un=Object(y.useMemo)(function(){switch(Br){case Pe:return w.a.createElement(me,{callback:vi,onCancel:_r});case Je:return w.a.createElement(be.b,{callback:vi,onCancel:_r});case et:return w.a.createElement(re,{callback:vi,onCancel:_r});case Qe:return w.a.createElement(Ve,{callback:vi,onCancel:_r});default:return null}},[Br]);function _r(){kr("")}Object(y.useEffect)(function(){if(ti.current){var mt=ti.current,Tt=!1,yt=0;function kt(Ot){Tt=!0,yt=Ot.pageY}function Bt(){Tt=!1}function Ht(Ot){if(Tt){var tr=Ot.pageY-yt;tr<0&&(tr=0),tr>300&&(tr=300);var Cr=ct+tr+"px";Fr(Cr)}}return mt.addEventListener("mousedown",kt),document.addEventListener("mousemove",Ht),document.addEventListener("mouseup",Bt),function(){mt.removeEventListener("mousedown",kt),document.removeEventListener("mousemove",Ht),document.removeEventListener("mouseup",Bt)}}},[K,ti]),Object(y.useEffect)(function(){Fr(ct)},[ct]);var fn=ce(wt),Zr=ce($r),Vi={width:fn,height:Zr},jn=Object(y.useMemo)(function(){if(ci){var mt=new Date(ci),Tt=mt.getHours(),yt=mt.getMinutes(),kt=mt.getSeconds();return Tt=Tt<10?"0"+Tt:Tt,yt=yt<10?"0"+yt:yt,kt=kt<10?"0"+kt:kt,"".concat(Tt,":").concat(yt,":").concat(kt)}return 0},[ci]);function Ri(){window.sessionStorage.removeItem(nr),Zt(!1),ei(0)}function $a(){Zt(!1),ei(0),K.setValue(window.sessionStorage.getItem(nr))}function da(mt,Tt){var yt=K.getValue();yt=yt.replace(mt,Tt),ut(yt),K==null||K.setValue(yt)}return w.a.createElement(y.Fragment,null,w.a.createElement("div",{className:"markdown-editor-wrapper",ref:Ut},w.a.createElement("div",{className:"markdown-editor-container ".concat(St," ").concat(_t?"on-preview":""," ").concat(It?"mini":""," ").concat(ar?"full-screen":""),style:Vi},w.a.createElement(v,{insertTemp:Wr,watch:_t,fullScreen:ar,showNullButton:pt,onActionCallback:Ki,hidetoolBar:li,uuid:Nt.current,setOpenPhones:function(){fr.current=!0}}),w.a.createElement("div",{className:"markdown-editor-body"},w.a.createElement("div",{className:"codemirror-container"},w.a.createElement("textarea",{ref:er,placeholder:Di})),_t?w.a.createElement("div",{ref:Qt,className:"preview-container"},vt==="stex"&&w.a.createElement(D,{value:qe}),vt!=="stex"&&w.a.createElement(p.a,{edit:!0,value:qe,replaces:da})):null))),Hr?w.a.createElement("a",{ref:ti,className:"editor-resize"}):null,w.a.createElement(M.a,null,se[Br]?w.a.createElement(Z.a,{centered:!0,title:se[Br],visible:!0,onCancel:_r,footer:null},Un):null))}},RxwV:function(Ct,st,ne){"use strict";var oe=ne("q1tI"),Z=ne("uciX"),k=ne("2W6z"),Y=ne.n(k),P=ne("4IlW"),I=ne("uK0f"),H=ne.n(I);function U(de,pe){if(de===pe)return!0;if(!de||!pe)return!1;var ae=de.length;if(pe.length!==ae)return!1;for(var re=0;re<ae;re++)if(de[re]!==pe[re])return!1;return!0}function O(de){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?O=function(ae){return typeof ae}:O=function(ae){return ae&&typeof Symbol=="function"&&ae.constructor===Symbol&&ae!==Symbol.prototype?"symbol":typeof ae},O(de)}function R(de,pe){if(!(de instanceof pe))throw new TypeError("Cannot call a class as a function")}function y(de,pe){for(var ae=0;ae<pe.length;ae++){var re=pe[ae];re.enumerable=re.enumerable||!1,re.configurable=!0,"value"in re&&(re.writable=!0),Object.defineProperty(de,re.key,re)}}function w(de,pe,ae){return pe&&y(de.prototype,pe),ae&&y(de,ae),de}function _(de,pe){if(typeof pe!="function"&&pe!==null)throw new TypeError("Super expression must either be null or a function");de.prototype=Object.create(pe&&pe.prototype,{constructor:{value:de,writable:!0,configurable:!0}}),pe&&L(de,pe)}function L(de,pe){return L=Object.setPrototypeOf||function(re,we){return re.__proto__=we,re},L(de,pe)}function A(de){var pe=o();return function(){var ae=l(de),re;if(pe){var we=l(this).constructor;re=Reflect.construct(ae,arguments,we)}else re=ae.apply(this,arguments);return C(this,re)}}function C(de,pe){return pe&&(O(pe)==="object"||typeof pe=="function")?pe:d(de)}function d(de){if(de===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return de}function o(){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(de){return!1}}function l(de){return l=Object.setPrototypeOf?Object.getPrototypeOf:function(ae){return ae.__proto__||Object.getPrototypeOf(ae)},l(de)}var h=function(){var de=function(pe){_(re,pe);var ae=A(re);function re(){var we;return R(this,re),we=ae.apply(this,arguments),we.menuItems={},we.saveMenuItem=function(ve){return function(Re){we.menuItems[ve]=Re}},we}return w(re,[{key:"componentDidMount",value:function(){this.scrollActiveItemToView()}},{key:"componentDidUpdate",value:function(ve){!ve.visible&&this.props.visible&&this.scrollActiveItemToView()}},{key:"getFieldName",value:function(ve){var Re=this.props,Ae=Re.fieldNames,Oe=Re.defaultFieldNames;return Ae[ve]||Oe[ve]}},{key:"getOption",value:function(ve,Re){var Ae=this.props,Oe=Ae.prefixCls,Ee=Ae.expandTrigger,_e=Ae.expandIcon,Ie=Ae.loadingIcon,Ve=this.props.onSelect.bind(this,ve,Re),Ue=this.props.onItemDoubleClick.bind(this,ve,Re),Fe={onClick:Ve,onDoubleClick:Ue},Pe="".concat(Oe,"-menu-item"),et=null,Je=ve[this.getFieldName("children")]&&ve[this.getFieldName("children")].length>0;(Je||ve.isLeaf===!1)&&(Pe+=" ".concat(Oe,"-menu-item-expand"),ve.loading||(et=oe.createElement("span",{className:"".concat(Oe,"-menu-item-expand-icon")},_e))),Ee==="hover"&&(Je||ve.isLeaf===!1)&&(Fe={onMouseEnter:this.delayOnSelect.bind(this,Ve),onMouseLeave:this.delayOnSelect.bind(this),onClick:Ve}),this.isActiveOption(ve,Re)&&(Pe+=" ".concat(Oe,"-menu-item-active"),Fe.ref=this.saveMenuItem(Re)),ve.disabled&&(Pe+=" ".concat(Oe,"-menu-item-disabled"));var Qe=null;ve.loading&&(Pe+=" ".concat(Oe,"-menu-item-loading"),Qe=Ie||null);var $e="";return"title"in ve?$e=ve.title:typeof ve[this.getFieldName("label")]=="string"&&($e=ve[this.getFieldName("label")]),oe.createElement("li",Object.assign({key:ve[this.getFieldName("value")],className:Pe,title:$e},Fe,{role:"menuitem",onMouseDown:function(Xe){return Xe.preventDefault()}}),ve[this.getFieldName("label")],et,Qe)}},{key:"getActiveOptions",value:function(ve){var Re=this,Ae=this.props.options,Oe=ve||this.props.activeValue;return H()(Ae,function(Ee,_e){return Ee[Re.getFieldName("value")]===Oe[_e]},{childrenKeyName:this.getFieldName("children")})}},{key:"getShowOptions",value:function(){var ve=this,Re=this.props.options,Ae=this.getActiveOptions().map(function(Oe){return Oe[ve.getFieldName("children")]}).filter(function(Oe){return!!Oe});return Ae.unshift(Re),Ae}},{key:"delayOnSelect",value:function(ve){for(var Re=this,Ae=arguments.length,Oe=new Array(Ae>1?Ae-1:0),Ee=1;Ee<Ae;Ee++)Oe[Ee-1]=arguments[Ee];this.delayTimer&&(clearTimeout(this.delayTimer),this.delayTimer=null),typeof ve=="function"&&(this.delayTimer=window.setTimeout(function(){ve(Oe),Re.delayTimer=null},150))}},{key:"scrollActiveItemToView",value:function(){for(var ve=this.getShowOptions().length,Re=0;Re<ve;Re++){var Ae=this.menuItems[Re];Ae&&Ae.parentElement&&(Ae.parentElement.scrollTop=Ae.offsetTop)}}},{key:"isActiveOption",value:function(ve,Re){var Ae=this.props.activeValue,Oe=Ae===void 0?[]:Ae;return Oe[Re]===ve[this.getFieldName("value")]}},{key:"render",value:function(){var ve=this,Re=this.props,Ae=Re.prefixCls,Oe=Re.dropdownMenuColumnStyle;return oe.createElement("div",null,this.getShowOptions().map(function(Ee,_e){return oe.createElement("ul",{className:"".concat(Ae,"-menu"),key:_e,style:Oe},Ee.map(function(Ie){return ve.getOption(Ie,_e)}))}))}}]),re}(oe.Component);return de.defaultProps={options:[],value:[],activeValue:[],onSelect:function(){},prefixCls:"rc-cascader-menus",visible:!1,expandTrigger:"click"},de}(),T=h,f={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}}},p=f;function D(de){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?D=function(ae){return typeof ae}:D=function(ae){return ae&&typeof Symbol=="function"&&ae.constructor===Symbol&&ae!==Symbol.prototype?"symbol":typeof ae},D(de)}function E(de,pe){if(de==null)return{};var ae=g(de,pe),re,we;if(Object.getOwnPropertySymbols){var ve=Object.getOwnPropertySymbols(de);for(we=0;we<ve.length;we++){if(re=ve[we],pe.indexOf(re)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(de,re))continue;ae[re]=de[re]}}return ae}function g(de,pe){if(de==null)return{};var ae={},re=Object.keys(de),we,ve;for(ve=0;ve<re.length;ve++){if(we=re[ve],pe.indexOf(we)>=0)continue;ae[we]=de[we]}return ae}function c(de){return b(de)||x(de)||a(de)||u()}function u(){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 a(de,pe){if(!de)return;if(typeof de=="string")return v(de,pe);var ae=Object.prototype.toString.call(de).slice(8,-1);if(ae==="Object"&&de.constructor&&(ae=de.constructor.name),ae==="Map"||ae==="Set")return Array.from(de);if(ae==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(ae))return v(de,pe)}function x(de){if(typeof Symbol!="undefined"&&Symbol.iterator in Object(de))return Array.from(de)}function b(de){if(Array.isArray(de))return v(de)}function v(de,pe){(pe==null||pe>de.length)&&(pe=de.length);for(var ae=0,re=new Array(pe);ae<pe;ae++)re[ae]=de[ae];return re}function M(de,pe){if(!(de instanceof pe))throw new TypeError("Cannot call a class as a function")}function G(de,pe){for(var ae=0;ae<pe.length;ae++){var re=pe[ae];re.enumerable=re.enumerable||!1,re.configurable=!0,"value"in re&&(re.writable=!0),Object.defineProperty(de,re.key,re)}}function X(de,pe,ae){return pe&&G(de.prototype,pe),ae&&G(de,ae),de}function Q(de,pe){if(typeof pe!="function"&&pe!==null)throw new TypeError("Super expression must either be null or a function");de.prototype=Object.create(pe&&pe.prototype,{constructor:{value:de,writable:!0,configurable:!0}}),pe&&z(de,pe)}function z(de,pe){return z=Object.setPrototypeOf||function(re,we){return re.__proto__=we,re},z(de,pe)}function j(de){var pe=me();return function(){var ae=be(de),re;if(pe){var we=be(this).constructor;re=Reflect.construct(ae,arguments,we)}else re=ae.apply(this,arguments);return q(this,re)}}function q(de,pe){return pe&&(D(pe)==="object"||typeof pe=="function")?pe:le(de)}function le(de){if(de===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return de}function me(){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(de){return!1}}function be(de){return be=Object.setPrototypeOf?Object.getPrototypeOf:function(ae){return ae.__proto__||Object.getPrototypeOf(ae)},be(de)}var Be=function(){var de=function(pe){Q(re,pe);var ae=j(re);function re(we){var ve;M(this,re),ve=ae.call(this,we),ve.setPopupVisible=function(Ae){var Oe=ve.state.value;"popupVisible"in ve.props||ve.setState({popupVisible:Ae}),Ae&&!ve.state.popupVisible&&ve.setState({activeValue:Oe}),ve.props.onPopupVisibleChange(Ae)},ve.handleChange=function(Ae,Oe,Ee){var _e=Oe.visible;(Ee.type!=="keydown"||Ee.keyCode===P.a.ENTER)&&(ve.props.onChange(Ae.map(function(Ie){return Ie[ve.getFieldName("value")]}),Ae),ve.setPopupVisible(_e))},ve.handlePopupVisibleChange=function(Ae){ve.setPopupVisible(Ae)},ve.handleMenuSelect=function(Ae,Oe,Ee){var _e=ve.trigger.getRootDomNode();_e&&_e.focus&&_e.focus();var Ie=ve.props,Ve=Ie.changeOnSelect,Ue=Ie.loadData,Fe=Ie.expandTrigger;if(!Ae||Ae.disabled)return;var Pe=ve.state.activeValue;Pe=Pe.slice(0,Oe+1),Pe[Oe]=Ae[ve.getFieldName("value")];var et=ve.getActiveOptions(Pe);if(Ae.isLeaf===!1&&!Ae[ve.getFieldName("children")]&&Ue){Ve&&ve.handleChange(et,{visible:!0},Ee),ve.setState({activeValue:Pe}),Ue(et);return}var Je={};!Ae[ve.getFieldName("children")]||!Ae[ve.getFieldName("children")].length?(ve.handleChange(et,{visible:!1},Ee),Je.value=Pe):Ve&&(Ee.type==="click"||Ee.type==="keydown")&&(Fe==="hover"?ve.handleChange(et,{visible:!1},Ee):ve.handleChange(et,{visible:!0},Ee),Je.value=Pe),Je.activeValue=Pe,("value"in ve.props||Ee.type==="keydown"&&Ee.keyCode!==P.a.ENTER)&&delete Je.value,ve.setState(Je)},ve.handleItemDoubleClick=function(){var Ae=ve.props.changeOnSelect;Ae&&ve.setPopupVisible(!1)},ve.handleKeyDown=function(Ae){var Oe=ve.props.children;if(Oe&&Oe.props.onKeyDown){Oe.props.onKeyDown(Ae);return}var Ee=c(ve.state.activeValue),_e=Ee.length-1<0?0:Ee.length-1,Ie=ve.getCurrentLevelOptions(),Ve=Ie.map(function(et){return et[ve.getFieldName("value")]}).indexOf(Ee[_e]);if(Ae.keyCode!==P.a.DOWN&&Ae.keyCode!==P.a.UP&&Ae.keyCode!==P.a.LEFT&&Ae.keyCode!==P.a.RIGHT&&Ae.keyCode!==P.a.ENTER&&Ae.keyCode!==P.a.SPACE&&Ae.keyCode!==P.a.BACKSPACE&&Ae.keyCode!==P.a.ESC&&Ae.keyCode!==P.a.TAB)return;if(!ve.state.popupVisible&&Ae.keyCode!==P.a.BACKSPACE&&Ae.keyCode!==P.a.LEFT&&Ae.keyCode!==P.a.RIGHT&&Ae.keyCode!==P.a.ESC&&Ae.keyCode!==P.a.TAB){ve.setPopupVisible(!0);return}if(Ae.keyCode===P.a.DOWN||Ae.keyCode===P.a.UP){Ae.preventDefault();var Ue=Ve;Ue!==-1?Ae.keyCode===P.a.DOWN?(Ue+=1,Ue=Ue>=Ie.length?0:Ue):(Ue-=1,Ue=Ue<0?Ie.length-1:Ue):Ue=0,Ee[_e]=Ie[Ue][ve.getFieldName("value")]}else if(Ae.keyCode===P.a.LEFT||Ae.keyCode===P.a.BACKSPACE)Ae.preventDefault(),Ee.splice(Ee.length-1,1);else if(Ae.keyCode===P.a.RIGHT)Ae.preventDefault(),Ie[Ve]&&Ie[Ve][ve.getFieldName("children")]&&Ee.push(Ie[Ve][ve.getFieldName("children")][0][ve.getFieldName("value")]);else if(Ae.keyCode===P.a.ESC||Ae.keyCode===P.a.TAB){ve.setPopupVisible(!1);return}(!Ee||Ee.length===0)&&ve.setPopupVisible(!1);var Fe=ve.getActiveOptions(Ee),Pe=Fe[Fe.length-1];ve.handleMenuSelect(Pe,Fe.length-1,Ae),ve.props.onKeyDown&&ve.props.onKeyDown(Ae)},ve.saveTrigger=function(Ae){ve.trigger=Ae};var Re=[];return"value"in we?Re=we.value||[]:"defaultValue"in we&&(Re=we.defaultValue||[]),Y()(!("filedNames"in we),"`filedNames` of Cascader is a typo usage and deprecated, please use `fieldNames` instead."),ve.state={popupVisible:we.popupVisible,activeValue:Re,value:Re,prevProps:we},ve.defaultFieldNames={label:"label",value:"value",children:"children"},ve}return X(re,[{key:"getPopupDOMNode",value:function(){return this.trigger.getPopupDomNode()}},{key:"getFieldName",value:function(ve){var Re=this.defaultFieldNames,Ae=this.props,Oe=Ae.fieldNames,Ee=Ae.filedNames;return"filedNames"in this.props?Ee[ve]||Re[ve]:Oe[ve]||Re[ve]}},{key:"getFieldNames",value:function(){var ve=this.props,Re=ve.fieldNames,Ae=ve.filedNames;return"filedNames"in this.props?Ae:Re}},{key:"getCurrentLevelOptions",value:function(){var ve=this,Re=this.props.options,Ae=Re===void 0?[]:Re,Oe=this.state.activeValue,Ee=Oe===void 0?[]:Oe,_e=H()(Ae,function(Ie,Ve){return Ie[ve.getFieldName("value")]===Ee[Ve]},{childrenKeyName:this.getFieldName("children")});return _e[_e.length-2]?_e[_e.length-2][this.getFieldName("children")]:c(Ae).filter(function(Ie){return!Ie.disabled})}},{key:"getActiveOptions",value:function(ve){var Re=this;return H()(this.props.options||[],function(Ae,Oe){return Ae[Re.getFieldName("value")]===ve[Oe]},{childrenKeyName:this.getFieldName("children")})}},{key:"render",value:function(){var ve=this.props,Re=ve.prefixCls,Ae=ve.transitionName,Oe=ve.popupClassName,Ee=ve.options,_e=Ee===void 0?[]:Ee,Ie=ve.disabled,Ve=ve.builtinPlacements,Ue=ve.popupPlacement,Fe=ve.children,Pe=ve.dropdownRender,et=E(ve,["prefixCls","transitionName","popupClassName","options","disabled","builtinPlacements","popupPlacement","children","dropdownRender"]),Je=oe.createElement("div",null),Qe="";_e&&_e.length>0?Je=oe.createElement(T,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(Re,"-menus-empty");var $e=Je;return Pe&&($e=Pe(Je)),oe.createElement(Z.a,Object.assign({ref:this.saveTrigger},et,{popupPlacement:Ue,builtinPlacements:Ve,popupTransitionName:Ae,action:Ie?[]:["click"],popupVisible:Ie?!1:this.state.popupVisible,onPopupVisibleChange:this.handlePopupVisibleChange,prefixCls:"".concat(Re,"-menus"),popupClassName:Oe+Qe,popup:$e}),oe.cloneElement(Fe,{onKeyDown:this.handleKeyDown,tabIndex:Ie?void 0:0}))}}],[{key:"getDerivedStateFromProps",value:function(ve,Re){var Ae=Re.prevProps,Oe=Ae===void 0?{}:Ae,Ee={prevProps:ve};return"value"in ve&&!U(Oe.value,ve.value)&&(Ee.value=ve.value||[],"loadData"in ve||(Ee.activeValue=ve.value||[])),"popupVisible"in ve&&(Ee.popupVisible=ve.popupVisible),Ee}}]),re}(oe.Component);return de.defaultProps={onChange:function(){},onPopupVisibleChange:function(){},disabled:!1,transitionName:"",prefixCls:"rc-cascader",popupClassName:"",popupPlacement:"bottomLeft",builtinPlacements:p,expandTrigger:"click",fieldNames:{label:"label",value:"value",children:"children"},expandIcon:">"},de}(),Le=Be,De=st.a=Le},SJMd:function(Ct,st){/**
|
|
* @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,Z,k=!1,Y,P;window.PR_SHOULD_USE_CONTINUATION=!0;var I,H;(function(){var U=window,O=["break,continue,do,else,for,if,return,while"],R=[O,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,restrict,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],y=[R,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],w=[y,"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"],_=[y,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],L=[y,"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"],A="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",C=[y,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],d="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",o=[O,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],l=[O,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],h=[O,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],T=[w,L,_,C,d,o,l,h],f=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,p="str",D="kwd",E="com",g="typ",c="lit",u="pun",a="pln",x="tag",b="dec",v="src",M="atn",G="atv",X="nocode",Q="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function z(Ee){for(var _e=0,Ie=!1,Ve=!1,Ue=0,Fe=Ee.length;Ue<Fe;++Ue){var Pe=Ee[Ue];if(Pe.ignoreCase)Ve=!0;else if(/[a-z]/i.test(Pe.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Ie=!0,Ve=!1;break}}var et={b:8,t:9,n:10,v:11,f:12,r:13};function Je(Ze){var ke=Ze.charCodeAt(0);if(ke!==92)return ke;var at=Ze.charAt(1);return ke=et[at],ke||("0"<=at&&at<="7"?parseInt(Ze.substring(1),8):at==="u"||at==="x"?parseInt(Ze.substring(2),16):Ze.charCodeAt(1))}function Qe(Ze){if(Ze<32)return(Ze<16?"\\x0":"\\x")+Ze.toString(16);var ke=String.fromCharCode(Ze);return ke==="\\"||ke==="-"||ke==="]"||ke==="^"?"\\"+ke:ke}function $e(Ze){var ke=Ze.substring(1,Ze.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")),at=[],it=ke[0]==="^",Me=["["];it&&Me.push("^");for(var Ge=it?1:0,ye=ke.length;Ge<ye;++Ge){var ce=ke[Ge];if(/\\[bdsw]/i.test(ce))Me.push(ce);else{var ge=Je(ce),ee;Ge+2<ye&&ke[Ge+1]==="-"?(ee=Je(ke[Ge+2]),Ge+=2):ee=ge,at.push([ge,ee]),ee<65||ge>122||(ee<65||ge>90||at.push([Math.max(65,ge)|32,Math.min(ee,90)|32]),ee<97||ge>122||at.push([Math.max(97,ge)&~32,Math.min(ee,122)&~32]))}}at.sort(function(Ce,xe){return Ce[0]-xe[0]||xe[1]-Ce[1]});for(var te=[],ie=[],Ge=0;Ge<at.length;++Ge){var se=at[Ge];se[0]<=ie[1]+1?ie[1]=Math.max(ie[1],se[1]):te.push(ie=se)}for(var Ge=0;Ge<te.length;++Ge){var se=te[Ge];Me.push(Qe(se[0])),se[1]>se[0]&&(se[1]+1>se[0]&&Me.push("-"),Me.push(Qe(se[1])))}return Me.push("]"),Me.join("")}function ht(Ze){for(var ke=Ze.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")),at=ke.length,it=[],Me=0,Ge=0;Me<at;++Me){var ye=ke[Me];if(ye==="(")++Ge;else if(ye.charAt(0)==="\\"){var ce=+ye.substring(1);ce&&(ce<=Ge?it[ce]=-1:ke[Me]=Qe(ce))}}for(var Me=1;Me<it.length;++Me)it[Me]===-1&&(it[Me]=++_e);for(var Me=0,Ge=0;Me<at;++Me){var ye=ke[Me];if(ye==="(")++Ge,it[Ge]||(ke[Me]="(?:");else if(ye.charAt(0)==="\\"){var ce=+ye.substring(1);ce&&ce<=Ge&&(ke[Me]="\\"+it[ce])}}for(var Me=0;Me<at;++Me)ke[Me]==="^"&&ke[Me+1]!=="^"&&(ke[Me]="");if(Ze.ignoreCase&&Ie)for(var Me=0;Me<at;++Me){var ye=ke[Me],ge=ye.charAt(0);ye.length>=2&&ge==="["?ke[Me]=$e(ye):ge!=="\\"&&(ke[Me]=ye.replace(/[a-zA-Z]/g,function(ie){var se=ie.charCodeAt(0);return"["+String.fromCharCode(se&~32,se|32)+"]"}))}return ke.join("")}for(var Xe=[],Ue=0,Fe=Ee.length;Ue<Fe;++Ue){var Pe=Ee[Ue];if(Pe.global||Pe.multiline)throw new Error(""+Pe);Xe.push("(?:"+ht(Pe)+")")}return new RegExp(Xe.join("|"),Ve?"gi":"g")}function j(Ee,_e){var Ie=/(?:^|\s)nocode(?:\s|$)/,Ve=[],Ue=0,Fe=[],Pe=0;function et(Je){var Qe=Je.nodeType;if(Qe==1){if(Ie.test(Je.className))return;for(var $e=Je.firstChild;$e;$e=$e.nextSibling)et($e);var ht=Je.nodeName.toLowerCase();(ht==="br"||ht==="li")&&(Ve[Pe]=`
|
|
`,Fe[Pe<<1]=Ue++,Fe[Pe++<<1|1]=Je)}else if(Qe==3||Qe==4){var Xe=Je.nodeValue;Xe.length&&(_e?Xe=Xe.replace(/\r\n?/g,`
|
|
`):Xe=Xe.replace(/[ \t\r\n]+/g," "),Ve[Pe]=Xe,Fe[Pe<<1]=Ue,Ue+=Xe.length,Fe[Pe++<<1|1]=Je)}}return et(Ee),{sourceCode:Ve.join("").replace(/\n$/,""),spans:Fe}}function q(Ee,_e,Ie,Ve,Ue){if(!Ie)return;var Fe={sourceNode:Ee,pre:1,langExtension:null,numberLines:null,sourceCode:Ie,spans:null,basePos:_e,decorations:null};Ve(Fe),Ue.push.apply(Ue,Fe.decorations)}var le=/\S/;function me(Ee){for(var _e=void 0,Ie=Ee.firstChild;Ie;Ie=Ie.nextSibling){var Ve=Ie.nodeType;_e=Ve===1?_e?Ee:Ie:Ve===3&&le.test(Ie.nodeValue)?Ee:_e}return _e===Ee?void 0:_e}function be(Ee,_e){var Ie={},Ve;(function(){for(var Pe=Ee.concat(_e),et=[],Je={},Qe=0,$e=Pe.length;Qe<$e;++Qe){var ht=Pe[Qe],Xe=ht[3];if(Xe)for(var Ze=Xe.length;--Ze>=0;)Ie[Xe.charAt(Ze)]=ht;var ke=ht[1],at=""+ke;Je.hasOwnProperty(at)||(et.push(ke),Je[at]=null)}et.push(/[\0-\uffff]/),Ve=z(et)})();var Ue=_e.length,Fe=function(Pe){for(var et=Pe.sourceCode,Je=Pe.basePos,Qe=Pe.sourceNode,$e=[Je,a],ht=0,Xe=et.match(Ve)||[],Ze={},ke=0,at=Xe.length;ke<at;++ke){var it=Xe[ke],Me=Ze[it],Ge=void 0,ye;if(typeof Me=="string")ye=!1;else{var ce=Ie[it.charAt(0)];if(ce)Ge=it.match(ce[1]),Me=ce[0];else{for(var ge=0;ge<Ue;++ge)if(ce=_e[ge],Ge=it.match(ce[1]),Ge){Me=ce[0];break}Ge||(Me=a)}ye=Me.length>=5&&Me.substring(0,5)==="lang-",ye&&!(Ge&&typeof Ge[1]=="string")&&(ye=!1,Me=v),ye||(Ze[it]=Me)}var ee=ht;if(ht+=it.length,!ye)$e.push(Je+ee,Me);else{var te=Ge[1],ie=it.indexOf(te),se=ie+te.length;Ge[2]&&(se=it.length-Ge[2].length,ie=se-te.length);var Ce=Me.substring(5);q(Qe,Je+ee,it.substring(0,ie),Fe,$e),q(Qe,Je+ee+ie,te,re(Ce,te),$e),q(Qe,Je+ee+se,it.substring(se),Fe,$e)}}Pe.decorations=$e};return Fe}function Be(Ee){var _e=[],Ie=[];Ee.tripleQuotedStrings?_e.push([p,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):Ee.multiLineStrings?_e.push([p,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):_e.push([p,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),Ee.verbatimStrings&&Ie.push([p,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Ve=Ee.hashComments;Ve&&(Ee.cStyleComments?(Ve>1?_e.push([E,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):_e.push([E,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Ie.push([p,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):_e.push([E,/^#[^\r\n]*/,null,"#"])),Ee.cStyleComments&&(Ie.push([E,/^\/\/[^\r\n]*/,null]),Ie.push([E,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Ue=Ee.regexLiterals;if(Ue){var Fe=Ue>1?"":`
|
|
\r`,Pe=Fe?".":"[\\S\\s]",et="/(?=[^/*"+Fe+"])(?:[^/\\x5B\\x5C"+Fe+"]|\\x5C"+Pe+"|\\x5B(?:[^\\x5C\\x5D"+Fe+"]|\\x5C"+Pe+")*(?:\\x5D|$))+/";Ie.push(["lang-regex",RegExp("^"+Q+"("+et+")")])}var Je=Ee.types;Je&&Ie.push([g,Je]);var Qe=(""+Ee.keywords).replace(/^ | $/g,"");Qe.length&&Ie.push([D,new RegExp("^(?:"+Qe.replace(/[\s,]+/g,"|")+")\\b"),null]),_e.push([a,/^\s+/,null,` \r
|
|
\xA0`]);var $e="^.[^\\s\\w.$@'\"`/\\\\]*";return Ee.regexLiterals&&($e+="(?!s*/)"),Ie.push([c,/^@[a-z_$][a-z_$@0-9]*/i,null],[g,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[a,/^[a-z_$][a-z_$@0-9]*/i,null],[c,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[a,/^\\[\s\S]?/,null],[u,new RegExp($e),null]),be(_e,Ie)}var Le=Be({keywords:T,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function De(Ee,_e,Ie){for(var Ve=/(?:^|\s)nocode(?:\s|$)/,Ue=/\r\n?|\n/,Fe=Ee.ownerDocument,Pe=Fe.createElement("li");Ee.firstChild;)Pe.appendChild(Ee.firstChild);var et=[Pe];function Je(ke){var at=ke.nodeType;if(at==1&&!Ve.test(ke.className))if(ke.nodeName==="br")Qe(ke),ke.parentNode&&ke.parentNode.removeChild(ke);else for(var it=ke.firstChild;it;it=it.nextSibling)Je(it);else if((at==3||at==4)&&Ie){var Me=ke.nodeValue,Ge=Me.match(Ue);if(Ge){var ye=Me.substring(0,Ge.index);ke.nodeValue=ye;var ce=Me.substring(Ge.index+Ge[0].length);if(ce){var ge=ke.parentNode;ge.insertBefore(Fe.createTextNode(ce),ke.nextSibling)}Qe(ke),ye||ke.parentNode.removeChild(ke)}}}function Qe(ke){for(;!ke.nextSibling;)if(ke=ke.parentNode,!ke)return;function at(Ge,ye){var ce=ye?Ge.cloneNode(!1):Ge,ge=Ge.parentNode;if(ge){var ee=at(ge,1),te=Ge.nextSibling;ee.appendChild(ce);for(var ie=te;ie;ie=te)te=ie.nextSibling,ee.appendChild(ie)}return ce}for(var it=at(ke.nextSibling,0),Me;(Me=it.parentNode)&&Me.nodeType===1;)it=Me;et.push(it)}for(var $e=0;$e<et.length;++$e)Je(et[$e]);_e===(_e|0)&&et[0].setAttribute("value",_e);var ht=Fe.createElement("ol");ht.className="linenums";for(var Xe=Math.max(0,_e-1|0)||0,$e=0,Ze=et.length;$e<Ze;++$e)Pe=et[$e],Pe.className="L"+($e+Xe)%10,Pe.firstChild||Pe.appendChild(Fe.createTextNode("\xA0")),ht.appendChild(Pe);Ee.appendChild(ht)}function de(Ee){var _e=/\bMSIE\s(\d+)/.exec(navigator.userAgent);_e=_e&&+_e[1]<=8;var Ie=/\n/g,Ve=Ee.sourceCode,Ue=Ve.length,Fe=0,Pe=Ee.spans,et=Pe.length,Je=0,Qe=Ee.decorations,$e=Qe.length,ht=0;Qe[$e]=Ue;var Xe,Ze;for(Ze=Xe=0;Ze<$e;)Qe[Ze]!==Qe[Ze+2]?(Qe[Xe++]=Qe[Ze++],Qe[Xe++]=Qe[Ze++]):Ze+=2;for($e=Xe,Ze=Xe=0;Ze<$e;){for(var ke=Qe[Ze],at=Qe[Ze+1],it=Ze+2;it+2<=$e&&Qe[it+1]===at;)it+=2;Qe[Xe++]=ke,Qe[Xe++]=at,Ze=it}$e=Qe.length=Xe;var Me=Ee.sourceNode,Ge="";Me&&(Ge=Me.style.display,Me.style.display="none");try{for(var ye=null;Je<et;){var ce=Pe[Je],ge=Pe[Je+2]||Ue,ee=Qe[ht+2]||Ue,it=Math.min(ge,ee),te=Pe[Je+1],ie;if(te.nodeType!==1&&(ie=Ve.substring(Fe,it))){_e&&(ie=ie.replace(Ie,"\r")),te.nodeValue=ie;var se=te.ownerDocument,Ce=se.createElement("span");Ce.className=Qe[ht+1];var xe=te.parentNode;xe.replaceChild(Ce,te),Ce.appendChild(te),Fe<ge&&(Pe[Je+1]=te=se.createTextNode(Ve.substring(it,ge)),xe.insertBefore(te,Ce.nextSibling))}Fe=it,Fe>=ge&&(Je+=2),Fe>=ee&&(ht+=2)}}finally{Me&&(Me.style.display=Ge)}}var pe={};function ae(Ee,_e){for(var Ie=_e.length;--Ie>=0;){var Ve=_e[Ie];pe.hasOwnProperty(Ve)?U.console&&console.warn("cannot override language handler %s",Ve):pe[Ve]=Ee}}function re(Ee,_e){return Ee&&pe.hasOwnProperty(Ee)||(Ee=/^\s*</.test(_e)?"default-markup":"default-code"),pe[Ee]}ae(Le,["default-code"]),ae(be([],[[a,/^[^<?]+/],[b,/^<!\w[^>]*(?:>|$)/],[E,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[u,/^(?:<[%?]|[%?]>)/],["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"]),ae(be([[a,/^[\s]+/,null,` \r
|
|
`],[G,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[x,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[M,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[u,/^[=<>\/]+/],["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"]),ae(be([],[[G,/^[\s\S]+/]]),["uq.val"]),ae(Be({keywords:w,hashComments:!0,cStyleComments:!0,types:f}),["c","cc","cpp","cxx","cyc","m"]),ae(Be({keywords:"null,true,false"}),["json"]),ae(Be({keywords:L,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:f}),["cs"]),ae(Be({keywords:_,cStyleComments:!0}),["java"]),ae(Be({keywords:h,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),ae(Be({keywords:o,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),ae(Be({keywords:d,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),ae(Be({keywords:l,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),ae(Be({keywords:C,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),ae(Be({keywords:A,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),ae(be([],[[p,/^[\s\S]+/]]),["regex"]);function we(Ee){var _e=Ee.langExtension;try{var Ie=j(Ee.sourceNode,Ee.pre),Ve=Ie.sourceCode;Ee.sourceCode=Ve,Ee.spans=Ie.spans,Ee.basePos=0,re(_e,Ve)(Ee),de(Ee)}catch(Ue){U.console&&console.log(Ue&&Ue.stack||Ue)}}function ve(Ee,_e,Ie){var Ve=Ie||!1,Ue=_e||null,Fe=document.createElement("div");Fe.innerHTML="<pre>"+Ee+"</pre>",Fe=Fe.firstChild,Ve&&De(Fe,Ve,!0);var Pe={langExtension:Ue,numberLines:Ve,sourceNode:Fe,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return we(Pe),Fe.innerHTML}function Re(Ee,_e){var Ie=_e||document.body,Ve=Ie.ownerDocument||document;function Ue(ce){return Ie.getElementsByTagName(ce)}for(var Fe=[Ue("pre"),Ue("code"),Ue("xmp")],Pe=[],et=0;et<Fe.length;++et)for(var Je=0,Qe=Fe[et].length;Je<Qe;++Je)Pe.push(Fe[et][Je]);Fe=null;var $e=Date;$e.now||($e={now:function(){return+new Date}});var ht=0,Xe=/\blang(?:uage)?-([\w.]+)(?!\S)/,Ze=/\bprettyprint\b/,ke=/\bprettyprinted\b/,at=/pre|xmp/i,it=/^code$/i,Me=/^(?:pre|code|xmp)$/i,Ge={};function ye(){for(var ce=U.PR_SHOULD_USE_CONTINUATION?$e.now()+250:Infinity;ht<Pe.length&&$e.now()<ce;ht++){for(var ge=Pe[ht],ee=Ge,te=ge;te=te.previousSibling;){var ie=te.nodeType,se=(ie===7||ie===8)&&te.nodeValue;if(se?!/^\??prettify\b/.test(se):ie!==3||/\S/.test(te.nodeValue))break;if(se){ee={},se.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Wt,Lt,Wr){ee[Lt]=Wr});break}}var Ce=ge.className;if((ee!==Ge||Ze.test(Ce))&&!ke.test(Ce)){for(var xe=!1,je=ge.parentNode;je;je=je.parentNode){var nt=je.tagName;if(Me.test(nt)&&je.className&&Ze.test(je.className)){xe=!0;break}}if(!xe){ge.className+=" prettyprinted";var ft=ee.lang;if(!ft){ft=Ce.match(Xe);var lt;!ft&&(lt=me(ge))&&it.test(lt.tagName)&&(ft=lt.className.match(Xe)),ft&&(ft=ft[1])}var wt;if(at.test(ge.tagName))wt=1;else{var Et=ge.currentStyle,ct=Ve.defaultView,zt=Et?Et.whiteSpace:ct&&ct.getComputedStyle?ct.getComputedStyle(ge,null).getPropertyValue("white-space"):0;wt=zt&&zt.substring(0,3)==="pre"}var It=ee.linenums;(It=It==="true"||+It)||(It=Ce.match(/\blinenums\b(?::(\d+))?/),It=It?It[1]&&It[1].length?+It[1]:!0:!1),It&&De(ge,It,wt);var Kt={langExtension:ft,sourceNode:ge,numberLines:It,pre:wt,sourceCode:null,basePos:null,spans:null,decorations:null};we(Kt)}}}ht<Pe.length?U.setTimeout(ye,250):typeof Ee=="function"&&Ee()}ye()}var Ae=U.PR={createSimpleLexer:be,registerLangHandler:ae,sourceDecorator:Be,PR_ATTRIB_NAME:M,PR_ATTRIB_VALUE:G,PR_COMMENT:E,PR_DECLARATION:b,PR_KEYWORD:D,PR_LITERAL:c,PR_NOCODE:X,PR_PLAIN:a,PR_PUNCTUATION:u,PR_SOURCE:v,PR_STRING:p,PR_TAG:x,PR_TYPE:g,prettyPrintOne:k?U.prettyPrintOne=ve:I=ve,prettyPrint:H=k?U.prettyPrint=Re:H=Re},Oe=U.define;typeof Oe=="function"&&Oe.amd&&Oe("google-code-prettify",[],function(){return Ae})})()},"VrN/":function(Ct,st,ne){(function(oe,Z){Ct.exports=Z()})(this,function(){"use strict";var oe=navigator.userAgent,Z=navigator.platform,k=/gecko\/\d/i.test(oe),Y=/MSIE \d/.test(oe),P=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(oe),I=/Edge\/(\d+)/.exec(oe),H=Y||P||I,U=H&&(Y?document.documentMode||6:+(I||P)[1]),O=!I&&/WebKit\//.test(oe),R=O&&/Qt\/\d+\.\d+/.test(oe),y=!I&&/Chrome\//.test(oe),w=/Opera\//.test(oe),_=/Apple Computer/.test(navigator.vendor),L=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(oe),A=/PhantomJS/.test(oe),C=!I&&/AppleWebKit/.test(oe)&&/Mobile\/\w+/.test(oe),d=/Android/.test(oe),o=C||d||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(oe),l=C||/Mac/.test(Z),h=/\bCrOS\b/.test(oe),T=/win/i.test(Z),f=w&&oe.match(/Version\/(\d*\.\d*)/);f&&(f=Number(f[1])),f&&f>=15&&(w=!1,O=!0);var p=l&&(R||w&&(f==null||f<12.11)),D=k||H&&U>=9;function E(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var g=function(e,t){var i=e.className,r=E(t).exec(i);if(r){var n=i.slice(r.index+r[0].length);e.className=i.slice(0,r.index)+(n?r[1]+n:"")}};function c(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function u(e,t){return c(e).appendChild(t)}function a(e,t,i,r){var n=document.createElement(e);if(i&&(n.className=i),r&&(n.style.cssText=r),typeof t=="string")n.appendChild(document.createTextNode(t));else if(t)for(var S=0;S<t.length;++S)n.appendChild(t[S]);return n}function x(e,t,i,r){var n=a(e,t,i,r);return n.setAttribute("role","presentation"),n}var b;document.createRange?b=function(e,t,i,r){var n=document.createRange();return n.setEnd(r||e,i),n.setStart(e,t),n}:b=function(e,t,i){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch(n){return r}return r.collapse(!0),r.moveEnd("character",i),r.moveStart("character",t),r};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 G(e,t){var i=e.className;E(t).test(i)||(e.className+=(i?" ":"")+t)}function X(e,t){for(var i=e.split(" "),r=0;r<i.length;r++)i[r]&&!E(i[r]).test(t)&&(t+=" "+i[r]);return t}var Q=function(e){e.select()};C?Q=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:H&&(Q=function(e){try{e.select()}catch(t){}});function z(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function j(e,t,i){t||(t={});for(var r in e)e.hasOwnProperty(r)&&(i!==!1||!t.hasOwnProperty(r))&&(t[r]=e[r]);return t}function q(e,t,i,r,n){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var S=r||0,N=n||0;;){var V=e.indexOf(" ",S);if(V<0||V>=t)return N+(t-S);N+=V-S,N+=i-N%i,S=V+1}}var le=function(){this.id=null,this.f=null,this.time=0,this.handler=z(this.onTimeout,this)};le.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},le.prototype.set=function(e,t){this.f=t;var i=+new Date+e;(!this.id||i<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=i)};function me(e,t){for(var i=0;i<e.length;++i)if(e[i]==t)return i;return-1}var be=50,Be={toString:function(){return"CodeMirror.Pass"}},Le={scroll:!1},De={origin:"*mouse"},de={origin:"+move"};function pe(e,t,i){for(var r=0,n=0;;){var S=e.indexOf(" ",r);S==-1&&(S=e.length);var N=S-r;if(S==e.length||n+N>=t)return r+Math.min(N,t-n);if(n+=S-r,n+=i-n%i,r=S+1,n>=t)return r}}var ae=[""];function re(e){for(;ae.length<=e;)ae.push(we(ae)+" ");return ae[e]}function we(e){return e[e.length-1]}function ve(e,t){for(var i=[],r=0;r<e.length;r++)i[r]=t(e[r],r);return i}function Re(e,t,i){for(var r=0,n=i(t);r<e.length&&i(e[r])<=n;)r++;e.splice(r,0,t)}function Ae(){}function Oe(e,t){var i;return Object.create?i=Object.create(e):(Ae.prototype=e,i=new Ae),t&&j(t,i),i}var Ee=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function _e(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||Ee.test(e))}function Ie(e,t){return t?t.source.indexOf("\\w")>-1&&_e(e)?!0:t.test(e):_e(e)}function Ve(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var Ue=/[\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 Fe(e){return e.charCodeAt(0)>=768&&Ue.test(e)}function Pe(e,t,i){for(;(i<0?t>0:t<e.length)&&Fe(e.charAt(t));)t+=i;return t}function et(e,t,i){for(var r=t>i?-1:1;;){if(t==i)return t;var n=(t+i)/2,S=r<0?Math.ceil(n):Math.floor(n);if(S==t)return e(S)?t:i;e(S)?i=S:t=S+r}}function Je(e,t,i,r){if(!e)return r(t,i,"ltr",0);for(var n=!1,S=0;S<e.length;++S){var N=e[S];(N.from<i&&N.to>t||t==i&&N.to==t)&&(r(Math.max(N.from,t),Math.min(N.to,i),N.level==1?"rtl":"ltr",S),n=!0)}n||r(t,i,"ltr")}var Qe=null;function $e(e,t,i){var r;Qe=null;for(var n=0;n<e.length;++n){var S=e[n];if(S.from<t&&S.to>t)return n;S.to==t&&(S.from!=S.to&&i=="before"?r=n:Qe=n),S.from==t&&(S.from!=S.to&&i!="before"?r=n:Qe=n)}return r!=null?r:Qe}var ht=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function i(J){return J<=247?e.charAt(J):1424<=J&&J<=1524?"R":1536<=J&&J<=1785?t.charAt(J-1536):1774<=J&&J<=2220?"r":8192<=J&&J<=8203?"w":J==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,n=/[stwN]/,S=/[LRr]/,N=/[Lb1n]/,V=/[1n]/;function $(J,ue,he){this.level=J,this.from=ue,this.to=he}return function(J,ue){var he=ue=="ltr"?"L":"R";if(J.length==0||ue=="ltr"&&!r.test(J))return!1;for(var Te=J.length,Se=[],Ne=0;Ne<Te;++Ne)Se.push(i(J.charCodeAt(Ne)));for(var ze=0,Ye=he;ze<Te;++ze){var tt=Se[ze];tt=="m"?Se[ze]=Ye:Ye=tt}for(var ot=0,rt=he;ot<Te;++ot){var dt=Se[ot];dt=="1"&&rt=="r"?Se[ot]="n":S.test(dt)&&(rt=dt,dt=="r"&&(Se[ot]="R"))}for(var bt=1,gt=Se[0];bt<Te-1;++bt){var At=Se[bt];At=="+"&>=="1"&&Se[bt+1]=="1"?Se[bt]="1":At==","&>==Se[bt+1]&&(gt=="1"||gt=="n")&&(Se[bt]=gt),gt=At}for(var Xt=0;Xt<Te;++Xt){var dr=Se[Xt];if(dr==",")Se[Xt]="N";else if(dr=="%"){var $t=void 0;for($t=Xt+1;$t<Te&&Se[$t]=="%";++$t);for(var Or=Xt&&Se[Xt-1]=="!"||$t<Te&&Se[$t]=="1"?"1":"N",Ar=Xt;Ar<$t;++Ar)Se[Ar]=Or;Xt=$t-1}}for(var rr=0,Lr=he;rr<Te;++rr){var mr=Se[rr];Lr=="L"&&mr=="1"?Se[rr]="L":S.test(mr)&&(Lr=mr)}for(var or=0;or<Te;++or)if(n.test(Se[or])){var ir=void 0;for(ir=or+1;ir<Te&&n.test(Se[ir]);++ir);for(var Jt=(or?Se[or-1]:he)=="L",Dr=(ir<Te?Se[ir]:he)=="L",un=Jt==Dr?Jt?"L":"R":he,Ai=or;Ai<ir;++Ai)Se[Ai]=un;or=ir-1}for(var vr=[],ni,hr=0;hr<Te;)if(N.test(Se[hr])){var Xa=hr;for(++hr;hr<Te&&N.test(Se[hr]);++hr);vr.push(new $(0,Xa,hr))}else{var mi=hr,ji=vr.length,Wi=ue=="rtl"?1:0;for(++hr;hr<Te&&Se[hr]!="L";++hr);for(var br=mi;br<hr;)if(V.test(Se[br])){mi<br&&(vr.splice(ji,0,new $(1,mi,br)),ji+=Wi);var dn=br;for(++br;br<hr&&V.test(Se[br]);++br);vr.splice(ji,0,new $(2,dn,br)),ji+=Wi,mi=br}else++br;mi<hr&&vr.splice(ji,0,new $(1,mi,hr))}return ue=="ltr"&&(vr[0].level==1&&(ni=J.match(/^\s+/))&&(vr[0].from=ni[0].length,vr.unshift(new $(0,0,ni[0].length))),we(vr).level==1&&(ni=J.match(/\s+$/))&&(we(vr).to-=ni[0].length,vr.push(new $(0,Te-ni[0].length,Te)))),ue=="rtl"?vr.reverse():vr}}();function Xe(e,t){var i=e.order;return i==null&&(i=e.order=ht(e.text,t)),i}var Ze=[],ke=function(e,t,i){if(e.addEventListener)e.addEventListener(t,i,!1);else if(e.attachEvent)e.attachEvent("on"+t,i);else{var r=e._handlers||(e._handlers={});r[t]=(r[t]||Ze).concat(i)}};function at(e,t){return e._handlers&&e._handlers[t]||Ze}function it(e,t,i){if(e.removeEventListener)e.removeEventListener(t,i,!1);else if(e.detachEvent)e.detachEvent("on"+t,i);else{var r=e._handlers,n=r&&r[t];if(n){var S=me(n,i);S>-1&&(r[t]=n.slice(0,S).concat(n.slice(S+1)))}}}function Me(e,t){var i=at(e,t);if(!i.length)return;for(var r=Array.prototype.slice.call(arguments,2),n=0;n<i.length;++n)i[n].apply(null,r)}function Ge(e,t,i){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Me(e,i||t.type,e,t),ie(t)||t.codemirrorIgnore}function ye(e){var t=e._handlers&&e._handlers.cursorActivity;if(!t)return;for(var i=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),r=0;r<t.length;++r)me(i,t[r])==-1&&i.push(t[r])}function ce(e,t){return at(e,t).length>0}function ge(e){e.prototype.on=function(t,i){ke(this,t,i)},e.prototype.off=function(t,i){it(this,t,i)}}function ee(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function te(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function ie(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function se(e){ee(e),te(e)}function Ce(e){return e.target||e.srcElement}function xe(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 je=function(){if(H&&U<9)return!1;var e=a("div");return"draggable"in e||"dragDrop"in e}(),nt;function ft(e){if(nt==null){var t=a("span","\u200B");u(e,a("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(nt=t.offsetWidth<=1&&t.offsetHeight>2&&!(H&&U<8))}var i=nt?a("span","\u200B"):a("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return i.setAttribute("cm-text",""),i}var lt;function wt(e){if(lt!=null)return lt;var t=u(e,document.createTextNode("A\u062EA")),i=b(t,0,1).getBoundingClientRect(),r=b(t,1,2).getBoundingClientRect();return c(e),!i||i.left==i.right?!1:lt=r.right-i.right<3}var Et=`
|
|
|
|
b`.split(/\n/).length!=3?function(e){for(var t=0,i=[],r=e.length;t<=r;){var n=e.indexOf(`
|
|
`,t);n==-1&&(n=e.length);var S=e.slice(t,e.charAt(n-1)=="\r"?n-1:n),N=S.indexOf("\r");N!=-1?(i.push(S.slice(0,N)),t+=N+1):(i.push(S),t=n+1)}return i}:function(e){return e.split(/\r\n?|\n/)},ct=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(i){}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},zt=function(){var e=a("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),It=null;function Kt(e){if(It!=null)return It;var t=u(e,a("span","x")),i=t.getBoundingClientRect(),r=b(t,0,1).getBoundingClientRect();return It=Math.abs(i.left-r.left)>1}var Wt={},Lt={};function Wr(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Wt[e]=t}function ai(e,t){Lt[e]=t}function vt(e){if(typeof e=="string"&&Lt.hasOwnProperty(e))e=Lt[e];else if(e&&typeof e.name=="string"&&Lt.hasOwnProperty(e.name)){var t=Lt[e.name];typeof t=="string"&&(t={name:t}),e=Oe(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return vt("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return vt("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function Vr(e,t){t=vt(t);var i=Wt[t.name];if(!i)return Vr(e,"text/plain");var r=i(e,t);if(nr.hasOwnProperty(t.name)){var n=nr[t.name];for(var S in n){if(!n.hasOwnProperty(S))continue;r.hasOwnProperty(S)&&(r["_"+S]=r[S]),r[S]=n[S]}}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var N in t.modeProps)r[N]=t.modeProps[N];return r}var nr={};function cr(e,t){var i=nr.hasOwnProperty(e)?nr[e]:nr[e]={};j(t,i)}function Hr(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var i={};for(var r in t){var n=t[r];n instanceof Array&&(n=n.concat([])),i[r]=n}return i}function oi(e,t){for(var i;e.innerMode&&!(i=e.innerMode(t),!i||i.mode==e);)t=i.state,e=i.mode;return i||{mode:e,state:t}}function si(e,t,i){return e.startState?e.startState(t,i):!0}var Pt=function(e,t,i){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=i};Pt.prototype.eol=function(){return this.pos>=this.string.length},Pt.prototype.sol=function(){return this.pos==this.lineStart},Pt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Pt.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Pt.prototype.eat=function(e){var t=this.string.charAt(this.pos),i;if(typeof e=="string"?i=t==e:i=t&&(e.test?e.test(t):e(t)),i)return++this.pos,t},Pt.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Pt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Pt.prototype.skipToEnd=function(){this.pos=this.string.length},Pt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Pt.prototype.backUp=function(e){this.pos-=e},Pt.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=q(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?q(this.string,this.lineStart,this.tabSize):0)},Pt.prototype.indentation=function(){return q(this.string,null,this.tabSize)-(this.lineStart?q(this.string,this.lineStart,this.tabSize):0)},Pt.prototype.match=function(e,t,i){if(typeof e=="string"){var r=function(N){return i?N.toLowerCase():N},n=this.string.substr(this.pos,e.length);if(r(n)==r(e))return t!==!1&&(this.pos+=e.length),!0}else{var S=this.string.slice(this.pos).match(e);return S&&S.index>0?null:(S&&t!==!1&&(this.pos+=S[0].length),S)}},Pt.prototype.current=function(){return this.string.slice(this.start,this.pos)},Pt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Pt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Pt.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 i=e;!i.lines;)for(var r=0;;++r){var n=i.children[r],S=n.chunkSize();if(t<S){i=n;break}t-=S}return i.lines[t]}function Pr(e,t,i){var r=[],n=t.line;return e.iter(t.line,i.line+1,function(S){var N=S.text;n==i.line&&(N=N.slice(0,i.ch)),n==t.line&&(N=N.slice(t.ch)),r.push(N),++n}),r}function li(e,t,i){var r=[];return e.iter(t,i,function(n){r.push(n.text)}),r}function xr(e,t){var i=t-e.height;if(i)for(var r=e;r;r=r.parent)r.height+=i}function Dt(e){if(e.parent==null)return null;for(var t=e.parent,i=me(t.lines,e),r=t.parent;r;t=r,r=r.parent)for(var n=0;!(r.children[n]==t);++n)i+=r.children[n].chunkSize();return i+t.first}function Mr(e,t){var i=e.first;e:do{for(var r=0;r<e.children.length;++r){var n=e.children[r],S=n.height;if(t<S){e=n;continue e}t-=S,i+=n.chunkSize()}return i}while(!e.lines);for(var N=0;N<e.lines.length;++N){var V=e.lines[N],$=V.height;if(t<$)break;t-=$}return i+N}function Xr(e,t){return t>=e.first&&t<e.first+e.size}function ui(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function Ke(e,t,i){if(i===void 0&&(i=null),!(this instanceof Ke))return new Ke(e,t,i);this.line=e,this.ch=t,this.sticky=i}function St(e,t){return e.line-t.line||e.ch-t.ch}function di(e,t){return e.sticky==t.sticky&&St(e,t)==0}function Li(e){return Ke(e.line,e.ch)}function hi(e,t){return St(e,t)<0?t:e}function Di(e,t){return St(e,t)<0?e:t}function W(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function s(e,t){if(t.line<e.first)return Ke(e.first,0);var i=e.first+e.size-1;return t.line>i?Ke(i,pt(e,i).text.length):m(t,pt(e,t.line).text.length)}function m(e,t){var i=e.ch;return i==null||i>t?Ke(e.line,t):i<0?Ke(e.line,0):e}function B(e,t){for(var i=[],r=0;r<t.length;r++)i[r]=s(e,t[r]);return i}var K=function(e,t){this.state=e,this.lookAhead=t},F=function(e,t,i,r){this.state=t,this.doc=e,this.line=i,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};F.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},F.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}},F.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},F.fromSaved=function(e,t,i){return t instanceof K?new F(e,Hr(e.mode,t.state),i,t.lookAhead):new F(e,Hr(e.mode,t),i)},F.prototype.save=function(e){var t=e!==!1?Hr(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new K(t,this.maxLookAhead):t};function fe(e,t,i,r){var n=[e.state.modeGen],S={};Nr(e,t.text,e.doc.mode,i,function(J,ue){return n.push(J,ue)},S,r);for(var N=i.state,V=function(J){i.baseTokens=n;var ue=e.state.overlays[J],he=1,Te=0;i.state=!0,Nr(e,t.text,ue.mode,i,function(Se,Ne){for(var ze=he;Te<Se;){var Ye=n[he];Ye>Se&&n.splice(he,1,Se,n[he+1],Ye),he+=2,Te=Math.min(Se,Ye)}if(!Ne)return;if(ue.opaque)n.splice(ze,he-ze,Se,"overlay "+Ne),he=ze+2;else for(;ze<he;ze+=2){var tt=n[ze+1];n[ze+1]=(tt?tt+" ":"")+"overlay "+Ne}},S),i.state=N,i.baseTokens=null,i.baseTokenPos=1},$=0;$<e.state.overlays.length;++$)V($);return{styles:n,classes:S.bgClass||S.textClass?S:null}}function We(e,t,i){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=qe(e,Dt(t)),n=t.text.length>e.options.maxHighlightLength&&Hr(e.doc.mode,r.state),S=fe(e,t,r);n&&(r.state=n),t.stateAfter=r.save(!n),t.styles=S.styles,S.classes?t.styleClasses=S.classes:t.styleClasses&&(t.styleClasses=null),i===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function qe(e,t,i){var r=e.doc,n=e.display;if(!r.mode.startState)return new F(r,!0,t);var S=ar(e,t,i),N=S>r.first&&pt(r,S-1).stateAfter,V=N?F.fromSaved(r,N,S):new F(r,si(r.mode),S);return r.iter(S,t,function($){ut(e,$.text,V);var J=V.line;$.stateAfter=J==t-1||J%5==0||J>=n.viewFrom&&J<n.viewTo?V.save():null,V.nextLine()}),i&&(r.modeFrontier=V.line),V}function ut(e,t,i,r){var n=e.doc.mode,S=new Pt(t,e.options.tabSize,i);for(S.start=S.pos=r||0,t==""&&He(n,i.state);!S.eol();)xt(n,S,i.state),S.start=S.pos}function He(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var i=oi(e,t);if(i.mode.blankLine)return i.mode.blankLine(i.state)}function xt(e,t,i,r){for(var n=0;n<10;n++){r&&(r[0]=oi(e,i).mode);var S=e.token(t,i);if(t.pos>t.start)return S}throw new Error("Mode "+e.name+" failed to advance stream.")}var _t=function(e,t,i){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=i};function Vt(e,t,i,r){var n=e.doc,S=n.mode,N;t=s(n,t);var V=pt(n,t.line),$=qe(e,t.line,i),J=new Pt(V.text,e.options.tabSize,$),ue;for(r&&(ue=[]);(r||J.pos<t.ch)&&!J.eol();)J.start=J.pos,N=xt(S,J,$.state),r&&ue.push(new _t(J,N,Hr(n.mode,$.state)));return r?ue:new _t(J,N,$.state)}function Ir(e,t){if(e)for(;;){var i=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!i)break;e=e.slice(0,i.index)+e.slice(i.index+i[0].length);var r=i[1]?"bgClass":"textClass";t[r]==null?t[r]=i[2]:new RegExp("(?:^|\\s)"+i[2]+"(?:$|\\s)").test(t[r])||(t[r]+=" "+i[2])}return e}function Nr(e,t,i,r,n,S,N){var V=i.flattenSpans;V==null&&(V=e.options.flattenSpans);var $=0,J=null,ue=new Pt(t,e.options.tabSize,r),he,Te=e.options.addModeClass&&[null];for(t==""&&Ir(He(i,r.state),S);!ue.eol();){if(ue.pos>e.options.maxHighlightLength?(V=!1,N&&ut(e,t,r,ue.pos),ue.pos=t.length,he=null):he=Ir(xt(i,ue,r.state,Te),S),Te){var Se=Te[0].name;Se&&(he="m-"+(he?Se+" "+he:Se))}if(!V||J!=he){for(;$<ue.start;)$=Math.min(ue.start,$+5e3),n($,J);J=he}ue.start=ue.pos}for(;$<ue.pos;){var Ne=Math.min(ue.pos,$+5e3);n(Ne,J),$=Ne}}function ar(e,t,i){for(var r,n,S=e.doc,N=i?-1:t-(e.doc.mode.innerMode?1e3:100),V=t;V>N;--V){if(V<=S.first)return S.first;var $=pt(S,V-1),J=$.stateAfter;if(J&&(!i||V+(J instanceof K?J.lookAhead:0)<=S.modeFrontier))return V;var ue=q($.text,null,e.options.tabSize);(n==null||r>ue)&&(n=V-1,r=ue)}return n}function Gr(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),e.highlightFrontier<t-10)return;for(var i=e.first,r=t-1;r>i;r--){var n=pt(e,r).stateAfter;if(n&&(!(n instanceof K)||r+n.lookAhead<t)){i=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,i)}var Hi=!1,Er=!1;function Br(){Hi=!0}function kr(){Er=!0}function gi(e,t,i){this.marker=e,this.from=t,this.to=i}function Yr(e,t){if(e)for(var i=0;i<e.length;++i){var r=e[i];if(r.marker==t)return r}}function ci(e,t){for(var i,r=0;r<e.length;++r)e[r]!=t&&(i||(i=[])).push(e[r]);return i}function ei(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function hn(e,t,i){var r;if(e)for(var n=0;n<e.length;++n){var S=e[n],N=S.marker,V=S.from==null||(N.inclusiveLeft?S.from<=t:S.from<t);if(V||S.from==t&&N.type=="bookmark"&&(!i||!S.marker.insertLeft)){var $=S.to==null||(N.inclusiveRight?S.to>=t:S.to>t);(r||(r=[])).push(new gi(N,S.from,$?null:S.to))}}return r}function Gi(e,t,i){var r;if(e)for(var n=0;n<e.length;++n){var S=e[n],N=S.marker,V=S.to==null||(N.inclusiveRight?S.to>=t:S.to>t);if(V||S.from==t&&N.type=="bookmark"&&(!i||S.marker.insertLeft)){var $=S.from==null||(N.inclusiveLeft?S.from<=t:S.from<t);(r||(r=[])).push(new gi(N,$?null:S.from-t,S.to==null?null:S.to-t))}}return r}function $r(e,t){if(t.full)return null;var i=Xr(e,t.from.line)&&pt(e,t.from.line).markedSpans,r=Xr(e,t.to.line)&&pt(e,t.to.line).markedSpans;if(!i&&!r)return null;var n=t.from.ch,S=t.to.ch,N=St(t.from,t.to)==0,V=hn(i,n,N),$=Gi(r,S,N),J=t.text.length==1,ue=we(t.text).length+(J?n:0);if(V)for(var he=0;he<V.length;++he){var Te=V[he];if(Te.to==null){var Se=Yr($,Te.marker);Se?J&&(Te.to=Se.to==null?null:Se.to+ue):Te.to=n}}if($)for(var Ne=0;Ne<$.length;++Ne){var ze=$[Ne];if(ze.to!=null&&(ze.to+=ue),ze.from==null){var Ye=Yr(V,ze.marker);Ye||(ze.from=ue,J&&(V||(V=[])).push(ze))}else ze.from+=ue,J&&(V||(V=[])).push(ze)}V&&(V=Fr(V)),$&&$!=V&&($=Fr($));var tt=[V];if(!J){var ot=t.text.length-2,rt;if(ot>0&&V)for(var dt=0;dt<V.length;++dt)V[dt].to==null&&(rt||(rt=[])).push(new gi(V[dt].marker,null,null));for(var bt=0;bt<ot;++bt)tt.push(rt);tt.push($)}return tt}function Fr(e){for(var t=0;t<e.length;++t){var i=e[t];i.from!=null&&i.from==i.to&&i.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function ki(e,t,i){var r=null;if(e.iter(t.line,i.line+1,function(Se){if(Se.markedSpans)for(var Ne=0;Ne<Se.markedSpans.length;++Ne){var ze=Se.markedSpans[Ne].marker;ze.readOnly&&(!r||me(r,ze)==-1)&&(r||(r=[])).push(ze)}}),!r)return null;for(var n=[{from:t,to:i}],S=0;S<r.length;++S)for(var N=r[S],V=N.find(0),$=0;$<n.length;++$){var J=n[$];if(St(J.to,V.from)<0||St(J.from,V.to)>0)continue;var ue=[$,1],he=St(J.from,V.from),Te=St(J.to,V.to);(he<0||!N.inclusiveLeft&&!he)&&ue.push({from:J.from,to:V.from}),(Te>0||!N.inclusiveRight&&!Te)&&ue.push({from:V.to,to:J.to}),n.splice.apply(n,ue),$+=ue.length-3}return n}function _i(e){var t=e.markedSpans;if(!t)return;for(var i=0;i<t.length;++i)t[i].marker.detachLine(e);e.markedSpans=null}function cn(e,t){if(!t)return;for(var i=0;i<t.length;++i)t[i].marker.attachLine(e);e.markedSpans=t}function Zt(e){return e.inclusiveLeft?-1:0}function Nt(e){return e.inclusiveRight?1:0}function fr(e,t){var i=e.lines.length-t.lines.length;if(i!=0)return i;var r=e.find(),n=t.find(),S=St(r.from,n.from)||Zt(e)-Zt(t);if(S)return-S;var N=St(r.to,n.to)||Nt(e)-Nt(t);return N||t.id-e.id}function Mt(e,t){var i=Er&&e.markedSpans,r;if(i)for(var n=void 0,S=0;S<i.length;++S)n=i[S],n.marker.collapsed&&(t?n.from:n.to)==null&&(!r||fr(r,n.marker)<0)&&(r=n.marker);return r}function er(e){return Mt(e,!0)}function Ut(e){return Mt(e,!1)}function ti(e,t){var i=Er&&e.markedSpans,r;if(i)for(var n=0;n<i.length;++n){var S=i[n];S.marker.collapsed&&(S.from==null||S.from<t)&&(S.to==null||S.to>t)&&(!r||fr(r,S.marker)<0)&&(r=S.marker)}return r}function Qt(e,t,i,r,n){var S=pt(e,t),N=Er&&S.markedSpans;if(N)for(var V=0;V<N.length;++V){var $=N[V];if(!$.marker.collapsed)continue;var J=$.marker.find(0),ue=St(J.from,i)||Zt($.marker)-Zt(n),he=St(J.to,r)||Nt($.marker)-Nt(n);if(ue>=0&&he<=0||ue<=0&&he>=0)continue;if(ue<=0&&($.marker.inclusiveRight&&n.inclusiveLeft?St(J.to,i)>=0:St(J.to,i)>0)||ue>=0&&($.marker.inclusiveRight&&n.inclusiveLeft?St(J.from,r)<=0:St(J.from,r)<0))return!0}}function Sr(e){for(var t;t=er(e);)e=t.find(-1,!0).line;return e}function zi(e){for(var t;t=Ut(e);)e=t.find(1,!0).line;return e}function Ki(e){for(var t,i;t=Ut(e);)e=t.find(1,!0).line,(i||(i=[])).push(e);return i}function vi(e,t){var i=pt(e,t),r=Sr(i);return i==r?t:Dt(r)}function Un(e,t){if(t>e.lastLine())return t;var i=pt(e,t),r;if(!_r(e,i))return t;for(;r=Ut(i);)i=r.find(1,!0).line;return Dt(i)+1}function _r(e,t){var i=Er&&t.markedSpans;if(i)for(var r=void 0,n=0;n<i.length;++n){if(r=i[n],!r.marker.collapsed)continue;if(r.from==null)return!0;if(r.marker.widgetNode)continue;if(r.from==0&&r.marker.inclusiveLeft&&fn(e,t,r))return!0}}function fn(e,t,i){if(i.to==null){var r=i.marker.find(1,!0);return fn(e,r.line,Yr(r.line.markedSpans,i.marker))}if(i.marker.inclusiveRight&&i.to==t.text.length)return!0;for(var n=void 0,S=0;S<t.markedSpans.length;++S)if(n=t.markedSpans[S],n.marker.collapsed&&!n.marker.widgetNode&&n.from==i.to&&(n.to==null||n.to!=i.from)&&(n.marker.inclusiveLeft||i.marker.inclusiveRight)&&fn(e,t,n))return!0}function Zr(e){e=Sr(e);for(var t=0,i=e.parent,r=0;r<i.lines.length;++r){var n=i.lines[r];if(n==e)break;t+=n.height}for(var S=i.parent;S;i=S,S=i.parent)for(var N=0;N<S.children.length;++N){var V=S.children[N];if(V==i)break;t+=V.height}return t}function Vi(e){if(e.height==0)return 0;for(var t=e.text.length,i,r=e;i=er(r);){var n=i.find(0,!0);r=n.from.line,t+=n.from.ch-n.to.ch}for(r=e;i=Ut(r);){var S=i.find(0,!0);t-=r.text.length-S.from.ch,r=S.to.line,t+=r.text.length-S.to.ch}return t}function jn(e){var t=e.display,i=e.doc;t.maxLine=pt(i,i.first),t.maxLineLength=Vi(t.maxLine),t.maxLineChanged=!0,i.iter(function(r){var n=Vi(r);n>t.maxLineLength&&(t.maxLineLength=n,t.maxLine=r)})}var Ri=function(e,t,i){this.text=e,cn(this,t),this.height=i?i(this):1};Ri.prototype.lineNo=function(){return Dt(this)},ge(Ri);function $a(e,t,i,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),_i(e),cn(e,i);var n=r?r(e):1;n!=e.height&&xr(e,n)}function da(e){e.parent=null,_i(e)}var mt={},Tt={};function yt(e,t){if(!e||/^\s*$/.test(e))return null;var i=t.addModeClass?Tt:mt;return i[e]||(i[e]=e.replace(/\S+/g,"cm-$&"))}function kt(e,t){var i=x("span",null,null,O?"padding-right: .1px":null),r={pre:x("pre",[i],"CodeMirror-line"),content:i,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 S=n?t.rest[n-1]:t.line,N=void 0;r.pos=0,r.addToken=Ht,wt(e.display.measure)&&(N=Xe(S,e.doc.direction))&&(r.addToken=tr(r.addToken,N)),r.map=[];var V=t!=e.display.externalMeasured&&Dt(S);Rt(S,r,We(e,S,V)),S.styleClasses&&(S.styleClasses.bgClass&&(r.bgClass=X(S.styleClasses.bgClass,r.bgClass||"")),S.styleClasses.textClass&&(r.textClass=X(S.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(ft(e.display.measure))),n==0?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(O){var $=r.content.lastChild;(/\bcm-tab\b/.test($.className)||$.querySelector&&$.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return Me(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=X(r.pre.className,r.textClass||"")),r}function Bt(e){var t=a("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Ht(e,t,i,r,n,S,N){if(!t)return;var V=e.splitSpaces?Ot(t,e.trailingSpace):t,$=e.cm.state.specialChars,J=!1,ue;if(!$.test(t))e.col+=t.length,ue=document.createTextNode(V),e.map.push(e.pos,e.pos+t.length,ue),H&&U<9&&(J=!0),e.pos+=t.length;else{ue=document.createDocumentFragment();for(var he=0;;){$.lastIndex=he;var Te=$.exec(t),Se=Te?Te.index-he:t.length-he;if(Se){var Ne=document.createTextNode(V.slice(he,he+Se));H&&U<9?ue.appendChild(a("span",[Ne])):ue.appendChild(Ne),e.map.push(e.pos,e.pos+Se,Ne),e.col+=Se,e.pos+=Se}if(!Te)break;he+=Se+1;var ze=void 0;if(Te[0]==" "){var Ye=e.cm.options.tabSize,tt=Ye-e.col%Ye;ze=ue.appendChild(a("span",re(tt),"cm-tab")),ze.setAttribute("role","presentation"),ze.setAttribute("cm-text"," "),e.col+=tt}else Te[0]=="\r"||Te[0]==`
|
|
`?(ze=ue.appendChild(a("span",Te[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),ze.setAttribute("cm-text",Te[0]),e.col+=1):(ze=e.cm.options.specialCharPlaceholder(Te[0]),ze.setAttribute("cm-text",Te[0]),H&&U<9?ue.appendChild(a("span",[ze])):ue.appendChild(ze),e.col+=1);e.map.push(e.pos,e.pos+1,ze),e.pos++}}if(e.trailingSpace=V.charCodeAt(t.length-1)==32,i||r||n||J||S||N){var ot=i||"";r&&(ot+=r),n&&(ot+=n);var rt=a("span",[ue],ot,S);if(N)for(var dt in N)N.hasOwnProperty(dt)&&dt!="style"&&dt!="class"&&rt.setAttribute(dt,N[dt]);return e.content.appendChild(rt)}e.content.appendChild(ue)}function Ot(e,t){if(e.length>1&&!/ /.test(e))return e;for(var i=t,r="",n=0;n<e.length;n++){var S=e.charAt(n);S==" "&&i&&(n==e.length-1||e.charCodeAt(n+1)==32)&&(S="\xA0"),r+=S,i=S==" "}return r}function tr(e,t){return function(i,r,n,S,N,V,$){n=n?n+" cm-force-border":"cm-force-border";for(var J=i.pos,ue=J+r.length;;){for(var he=void 0,Te=0;Te<t.length&&!(he=t[Te],he.to>J&&he.from<=J);Te++);if(he.to>=ue)return e(i,r,n,S,N,V,$);e(i,r.slice(0,he.to-J),n,S,null,V,$),S=null,r=r.slice(he.to-J),J=he.to}}}function Cr(e,t,i,r){var n=!r&&i.widgetNode;n&&e.map.push(e.pos,e.pos+t,n),!r&&e.cm.display.input.needsContentAttribute&&(n||(n=e.content.appendChild(document.createElement("span"))),n.setAttribute("cm-marker",i.id)),n&&(e.cm.display.input.setUneditable(n),e.content.appendChild(n)),e.pos+=t,e.trailingSpace=!1}function Rt(e,t,i){var r=e.markedSpans,n=e.text,S=0;if(!r){for(var N=1;N<i.length;N+=2)t.addToken(t,n.slice(S,S=i[N]),yt(i[N+1],t.cm.options));return}for(var V=n.length,$=0,J=1,ue="",he,Te,Se=0,Ne,ze,Ye,tt,ot;;){if(Se==$){Ne=ze=Ye=Te="",ot=null,tt=null,Se=Infinity;for(var rt=[],dt=void 0,bt=0;bt<r.length;++bt){var gt=r[bt],At=gt.marker;if(At.type=="bookmark"&>.from==$&&At.widgetNode)rt.push(At);else if(gt.from<=$&&(gt.to==null||gt.to>$||At.collapsed&>.to==$&>.from==$)){if(gt.to!=null&>.to!=$&&Se>gt.to&&(Se=gt.to,ze=""),At.className&&(Ne+=" "+At.className),At.css&&(Te=(Te?Te+";":"")+At.css),At.startStyle&>.from==$&&(Ye+=" "+At.startStyle),At.endStyle&>.to==Se&&(dt||(dt=[])).push(At.endStyle,gt.to),At.title&&((ot||(ot={})).title=At.title),At.attributes)for(var Xt in At.attributes)(ot||(ot={}))[Xt]=At.attributes[Xt];At.collapsed&&(!tt||fr(tt.marker,At)<0)&&(tt=gt)}else gt.from>$&&Se>gt.from&&(Se=gt.from)}if(dt)for(var dr=0;dr<dt.length;dr+=2)dt[dr+1]==Se&&(ze+=" "+dt[dr]);if(!tt||tt.from==$)for(var $t=0;$t<rt.length;++$t)Cr(t,0,rt[$t]);if(tt&&(tt.from||0)==$){if(Cr(t,(tt.to==null?V+1:tt.to)-$,tt.marker,tt.from==null),tt.to==null)return;tt.to==$&&(tt=!1)}}if($>=V)break;for(var Or=Math.min(V,Se);;){if(ue){var Ar=$+ue.length;if(!tt){var rr=Ar>Or?ue.slice(0,Or-$):ue;t.addToken(t,rr,he?he+Ne:Ne,Ye,$+rr.length==Se?ze:"",Te,ot)}if(Ar>=Or){ue=ue.slice(Or-$),$=Or;break}$=Ar,Ye=""}ue=n.slice(S,S=i[J++]),he=yt(i[J++],t.cm.options)}}}function yi(e,t,i){this.line=t,this.rest=Ki(t),this.size=this.rest?Dt(we(this.rest))-i+1:1,this.node=this.text=null,this.hidden=_r(e,t)}function Ft(e,t,i){for(var r=[],n,S=t;S<i;S=n){var N=new yi(e.doc,pt(e.doc,S),S);n=S+N.size,r.push(N)}return r}var sr=null;function zr(e){sr?sr.ops.push(e):e.ownsGroup=sr={ops:[e],delayedCallbacks:[]}}function Kr(e){var t=e.delayedCallbacks,i=0;do{for(;i<t.length;i++)t[i].call(null);for(var r=0;r<e.ops.length;r++){var n=e.ops[r];if(n.cursorActivityHandlers)for(;n.cursorActivityCalled<n.cursorActivityHandlers.length;)n.cursorActivityHandlers[n.cursorActivityCalled++].call(null,n.cm)}}while(i<t.length)}function Wn(e,t){var i=e.ownsGroup;if(!i)return;try{Kr(i)}finally{sr=null,t(i)}}var pn=null;function pr(e,t){var i=at(e,t);if(!i.length)return;var r=Array.prototype.slice.call(arguments,2),n;sr?n=sr.delayedCallbacks:pn?n=pn:(n=pn=[],setTimeout(Os,0));for(var S=function(V){n.push(function(){return i[V].apply(null,r)})},N=0;N<i.length;++N)S(N)}function Os(){var e=pn;pn=null;for(var t=0;t<e.length;++t)e[t]()}function Za(e,t,i,r){for(var n=0;n<t.changes.length;n++){var S=t.changes[n];S=="text"?Ms(e,t):S=="gutter"?Qa(e,t,i,r):S=="class"?ha(e,t):S=="widget"&&Is(e,t,r)}t.changes=null}function mn(e){return e.node==e.text&&(e.node=a("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),H&&U<8&&(e.node.style.zIndex=2)),e.node}function Ps(e,t){var i=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(i&&(i+=" CodeMirror-linebackground"),t.background)i?t.background.className=i:(t.background.parentNode.removeChild(t.background),t.background=null);else if(i){var r=mn(t);t.background=r.insertBefore(a("div",null,i),r.firstChild),e.display.input.setUneditable(t.background)}}function Ja(e,t){var i=e.display.externalMeasured;return i&&i.line==t.line?(e.display.externalMeasured=null,t.measure=i.measure,i.built):kt(e,t)}function Ms(e,t){var i=t.text.className,r=Ja(e,t);t.text==t.node&&(t.node=r.pre),t.text.parentNode.replaceChild(r.pre,t.text),t.text=r.pre,r.bgClass!=t.bgClass||r.textClass!=t.textClass?(t.bgClass=r.bgClass,t.textClass=r.textClass,ha(e,t)):i&&(t.text.className=i)}function ha(e,t){Ps(e,t),t.line.wrapClass?mn(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var i=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=i||""}function Qa(e,t,i,r){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=mn(t);t.gutterBackground=a("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),n.insertBefore(t.gutterBackground,t.text)}var S=t.line.gutterMarkers;if(e.options.lineNumbers||S){var N=mn(t),V=t.gutter=a("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(e.display.input.setUneditable(V),N.insertBefore(V,t.text),t.line.gutterClass&&(V.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!S||!S["CodeMirror-linenumbers"])&&(t.lineNumber=V.appendChild(a("div",ui(e.options,i),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),S)for(var $=0;$<e.display.gutterSpecs.length;++$){var J=e.display.gutterSpecs[$].className,ue=S.hasOwnProperty(J)&&S[J];ue&&V.appendChild(a("div",[ue],"CodeMirror-gutter-elt","left: "+r.gutterLeft[J]+"px; width: "+r.gutterWidth[J]+"px"))}}}function Is(e,t,i){t.alignable&&(t.alignable=null);for(var r=E("CodeMirror-linewidget"),n=t.node.firstChild,S=void 0;n;n=S)S=n.nextSibling,r.test(n.className)&&t.node.removeChild(n);qa(e,t,i)}function Ns(e,t,i,r){var n=Ja(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,i,r),qa(e,t,r),t.node}function qa(e,t,i){if(eo(e,t.line,t,i,!0),t.rest)for(var r=0;r<t.rest.length;r++)eo(e,t.rest[r],t,i,!1)}function eo(e,t,i,r,n){if(!t.widgets)return;for(var S=mn(i),N=0,V=t.widgets;N<V.length;++N){var $=V[N],J=a("div",[$.node],"CodeMirror-linewidget"+($.className?" "+$.className:""));$.handleMouseEvents||J.setAttribute("cm-ignore-events","true"),Bs($,J,i,r),e.display.input.setUneditable(J),n&&$.above?S.insertBefore(J,i.gutter||i.text):S.appendChild(J),pr($,"redraw")}}function Bs(e,t,i,r){if(e.noHScroll){(i.alignable||(i.alignable=[])).push(t);var n=r.wrapperWidth;t.style.left=r.fixedPos+"px",e.coverGutter||(n-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px"),t.style.width=n+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}function gn(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!v(document.body,e.node)){var i="position: relative;";e.coverGutter&&(i+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(i+="width: "+t.display.wrapper.clientWidth+"px;"),u(t.display.measure,a("div",[e.node],null,i))}return e.height=e.node.parentNode.offsetHeight}function fi(e,t){for(var i=Ce(t);i!=e.wrapper;i=i.parentNode)if(!i||i.nodeType==1&&i.getAttribute("cm-ignore-events")=="true"||i.parentNode==e.sizer&&i!=e.mover)return!0}function Hn(e){return e.lineSpace.offsetTop}function ca(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function to(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=u(e.measure,a("pre","x","CodeMirror-line-like")),i=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,r={left:parseInt(i.paddingLeft),right:parseInt(i.paddingRight)};return!isNaN(r.left)&&!isNaN(r.right)&&(e.cachedPaddingH=r),r}function ri(e){return be-e.display.nativeBarWidth}function Oi(e){return e.display.scroller.clientWidth-ri(e)-e.display.barWidth}function fa(e){return e.display.scroller.clientHeight-ri(e)-e.display.barHeight}function Fs(e,t,i){var r=e.options.lineWrapping,n=r&&Oi(e);if(!t.measure.heights||r&&t.measure.width!=n){var S=t.measure.heights=[];if(r){t.measure.width=n;for(var N=t.text.firstChild.getClientRects(),V=0;V<N.length-1;V++){var $=N[V],J=N[V+1];Math.abs($.bottom-J.bottom)>2&&S.push(($.bottom+J.top)/2-i.top)}}S.push(i.bottom-i.top)}}function ro(e,t,i){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var r=0;r<e.rest.length;r++)if(e.rest[r]==t)return{map:e.measure.maps[r],cache:e.measure.caches[r]};for(var n=0;n<e.rest.length;n++)if(Dt(e.rest[n])>i)return{map:e.measure.maps[n],cache:e.measure.caches[n],before:!0}}function Us(e,t){t=Sr(t);var i=Dt(t),r=e.display.externalMeasured=new yi(e.doc,t,i);r.lineN=i;var n=r.built=kt(e,r);return r.text=n.pre,u(e.display.lineMeasure,n.pre),r}function io(e,t,i,r){return ii(e,Xi(e,t),i,r)}function pa(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[Ii(e,t)];var i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size)return i}function Xi(e,t){var i=Dt(t),r=pa(e,i);r&&!r.text?r=null:r&&r.changes&&(Za(e,r,i,xa(e)),e.curOp.forceUpdate=!0),r||(r=Us(e,t));var n=ro(r,t,i);return{line:t,view:r,rect:null,map:n.map,cache:n.cache,before:n.before,hasHeights:!1}}function ii(e,t,i,r,n){t.before&&(i=-1);var S=i+(r||""),N;return t.cache.hasOwnProperty(S)?N=t.cache[S]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Fs(e,t.view,t.rect),t.hasHeights=!0),N=Ws(e,t,i,r),N.bogus||(t.cache[S]=N)),{left:N.left,right:N.right,top:n?N.rtop:N.top,bottom:n?N.rbottom:N.bottom}}var no={left:0,right:0,top:0,bottom:0};function ao(e,t,i){for(var r,n,S,N,V,$,J=0;J<e.length;J+=3)if(V=e[J],$=e[J+1],t<V?(n=0,S=1,N="left"):t<$?(n=t-V,S=n+1):(J==e.length-3||t==$&&e[J+3]>t)&&(S=$-V,n=S-1,t>=$&&(N="right")),n!=null){if(r=e[J+2],V==$&&i==(r.insertLeft?"left":"right")&&(N=i),i=="left"&&n==0)for(;J&&e[J-2]==e[J-3]&&e[J-1].insertLeft;)r=e[(J-=3)+2],N="left";if(i=="right"&&n==$-V)for(;J<e.length-3&&e[J+3]==e[J+4]&&!e[J+5].insertLeft;)r=e[(J+=3)+2],N="right";break}return{node:r,start:n,end:S,collapse:N,coverStart:V,coverEnd:$}}function js(e,t){var i=no;if(t=="left")for(var r=0;r<e.length&&!((i=e[r]).left!=i.right);r++);else for(var n=e.length-1;n>=0&&!((i=e[n]).left!=i.right);n--);return i}function Ws(e,t,i,r){var n=ao(t.map,i,r),S=n.node,N=n.start,V=n.end,$=n.collapse,J;if(S.nodeType==3){for(var ue=0;ue<4;ue++){for(;N&&Fe(t.line.text.charAt(n.coverStart+N));)--N;for(;n.coverStart+V<n.coverEnd&&Fe(t.line.text.charAt(n.coverStart+V));)++V;if(H&&U<9&&N==0&&V==n.coverEnd-n.coverStart?J=S.parentNode.getBoundingClientRect():J=js(b(S,N,V).getClientRects(),r),J.left||J.right||N==0)break;V=N,N=N-1,$="right"}H&&U<11&&(J=Hs(e.display.measure,J))}else{N>0&&($=r="right");var he;e.options.lineWrapping&&(he=S.getClientRects()).length>1?J=he[r=="right"?he.length-1:0]:J=S.getBoundingClientRect()}if(H&&U<9&&!N&&(!J||!J.left&&!J.right)){var Te=S.parentNode.getClientRects()[0];Te?J={left:Te.left,right:Te.left+$i(e.display),top:Te.top,bottom:Te.bottom}:J=no}for(var Se=J.top-t.rect.top,Ne=J.bottom-t.rect.top,ze=(Se+Ne)/2,Ye=t.view.measure.heights,tt=0;tt<Ye.length-1&&!(ze<Ye[tt]);tt++);var ot=tt?Ye[tt-1]:0,rt=Ye[tt],dt={left:($=="right"?J.right:J.left)-t.rect.left,right:($=="left"?J.left:J.right)-t.rect.left,top:ot,bottom:rt};return!J.left&&!J.right&&(dt.bogus=!0),e.options.singleCursorHeightPerLine||(dt.rtop=Se,dt.rbottom=Ne),dt}function Hs(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!Kt(e))return t;var i=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*i,right:t.right*i,top:t.top*r,bottom:t.bottom*r}}function oo(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 so(e){e.display.externalMeasure=null,c(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)oo(e.display.view[t])}function vn(e){so(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function lo(){return y&&d?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function uo(){return y&&d?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function ma(e){var t=0;if(e.widgets)for(var i=0;i<e.widgets.length;++i)e.widgets[i].above&&(t+=gn(e.widgets[i]));return t}function Gn(e,t,i,r,n){if(!n){var S=ma(t);i.top+=S,i.bottom+=S}if(r=="line")return i;r||(r="local");var N=Zr(t);if(r=="local"?N+=Hn(e.display):N-=e.display.viewOffset,r=="page"||r=="window"){var V=e.display.lineSpace.getBoundingClientRect();N+=V.top+(r=="window"?0:uo());var $=V.left+(r=="window"?0:lo());i.left+=$,i.right+=$}return i.top+=N,i.bottom+=N,i}function ho(e,t,i){if(i=="div")return t;var r=t.left,n=t.top;if(i=="page")r-=lo(),n-=uo();else if(i=="local"||!i){var S=e.display.sizer.getBoundingClientRect();r+=S.left,n+=S.top}var N=e.display.lineSpace.getBoundingClientRect();return{left:r-N.left,top:n-N.top}}function ga(e,t,i,r,n){return r||(r=pt(e.doc,t.line)),Gn(e,r,io(e,r,t.ch,n),i)}function Jr(e,t,i,r,n,S){r=r||pt(e.doc,t.line),n||(n=Xi(e,r));function N(Ne,ze){var Ye=ii(e,n,Ne,ze?"right":"left",S);return ze?Ye.left=Ye.right:Ye.right=Ye.left,Gn(e,r,Ye,i)}var V=Xe(r,e.doc.direction),$=t.ch,J=t.sticky;if($>=r.text.length?($=r.text.length,J="before"):$<=0&&($=0,J="after"),!V)return N(J=="before"?$-1:$,J=="before");function ue(Ne,ze,Ye){var tt=V[ze],ot=tt.level==1;return N(Ye?Ne-1:Ne,ot!=Ye)}var he=$e(V,$,J),Te=Qe,Se=ue($,he,J=="before");return Te!=null&&(Se.other=ue($,Te,J!="before")),Se}function co(e,t){var i=0;t=s(e.doc,t),e.options.lineWrapping||(i=$i(e.display)*t.ch);var r=pt(e.doc,t.line),n=Zr(r)+Hn(e.display);return{left:i,right:i,top:n,bottom:n+r.height}}function va(e,t,i,r,n){var S=Ke(e,t,i);return S.xRel=n,r&&(S.outside=r),S}function ya(e,t,i){var r=e.doc;if(i+=e.display.viewOffset,i<0)return va(r.first,0,null,-1,-1);var n=Mr(r,i),S=r.first+r.size-1;if(n>S)return va(r.first+r.size-1,pt(r,S).text.length,null,1,1);t<0&&(t=0);for(var N=pt(r,n);;){var V=Gs(e,N,n,t,i),$=ti(N,V.ch+(V.xRel>0||V.outside>0?1:0));if(!$)return V;var J=$.find(1);if(J.line==n)return J;N=pt(r,n=J.line)}}function fo(e,t,i,r){r-=ma(t);var n=t.text.length,S=et(function(N){return ii(e,i,N-1).bottom<=r},n,0);return n=et(function(N){return ii(e,i,N).top>r},S,n),{begin:S,end:n}}function po(e,t,i,r){i||(i=Xi(e,t));var n=Gn(e,t,ii(e,i,r),"line").top;return fo(e,t,i,n)}function ba(e,t,i,r){return e.bottom<=i?!1:e.top>i?!0:(r?e.left:e.right)>t}function Gs(e,t,i,r,n){n-=Zr(t);var S=Xi(e,t),N=ma(t),V=0,$=t.text.length,J=!0,ue=Xe(t,e.doc.direction);if(ue){var he=(e.options.lineWrapping?Ks:zs)(e,t,i,S,ue,r,n);J=he.level!=1,V=J?he.from:he.to-1,$=J?he.to:he.from-1}var Te=null,Se=null,Ne=et(function(bt){var gt=ii(e,S,bt);return gt.top+=N,gt.bottom+=N,ba(gt,r,n,!1)?(gt.top<=n&>.left<=r&&(Te=bt,Se=gt),!0):!1},V,$),ze,Ye,tt=!1;if(Se){var ot=r-Se.left<Se.right-r,rt=ot==J;Ne=Te+(rt?0:1),Ye=rt?"after":"before",ze=ot?Se.left:Se.right}else{!J&&(Ne==$||Ne==V)&&Ne++,Ye=Ne==0?"after":Ne==t.text.length?"before":ii(e,S,Ne-(J?1:0)).bottom+N<=n==J?"after":"before";var dt=Jr(e,Ke(i,Ne,Ye),"line",t,S);ze=dt.left,tt=n<dt.top?-1:n>=dt.bottom?1:0}return Ne=Pe(t.text,Ne,1),va(i,Ne,Ye,tt,r-ze)}function zs(e,t,i,r,n,S,N){var V=et(function(he){var Te=n[he],Se=Te.level!=1;return ba(Jr(e,Ke(i,Se?Te.to:Te.from,Se?"before":"after"),"line",t,r),S,N,!0)},0,n.length-1),$=n[V];if(V>0){var J=$.level!=1,ue=Jr(e,Ke(i,J?$.from:$.to,J?"after":"before"),"line",t,r);ba(ue,S,N,!0)&&ue.top>N&&($=n[V-1])}return $}function Ks(e,t,i,r,n,S,N){var V=fo(e,t,r,N),$=V.begin,J=V.end;/\s/.test(t.text.charAt(J-1))&&J--;for(var ue=null,he=null,Te=0;Te<n.length;Te++){var Se=n[Te];if(Se.from>=J||Se.to<=$)continue;var Ne=Se.level!=1,ze=ii(e,r,Ne?Math.min(J,Se.to)-1:Math.max($,Se.from)).right,Ye=ze<S?S-ze+1e9:ze-S;(!ue||he>Ye)&&(ue=Se,he=Ye)}return ue||(ue=n[n.length-1]),ue.from<$&&(ue={from:$,to:ue.to,level:ue.level}),ue.to>J&&(ue={from:ue.from,to:J,level:ue.level}),ue}var Pi;function Yi(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(Pi==null){Pi=a("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Pi.appendChild(document.createTextNode("x")),Pi.appendChild(a("br"));Pi.appendChild(document.createTextNode("x"))}u(e.measure,Pi);var i=Pi.offsetHeight/50;return i>3&&(e.cachedTextHeight=i),c(e.measure),i||1}function $i(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=a("span","xxxxxxxxxx"),i=a("pre",[t],"CodeMirror-line-like");u(e.measure,i);var r=t.getBoundingClientRect(),n=(r.right-r.left)/10;return n>2&&(e.cachedCharWidth=n),n||10}function xa(e){for(var t=e.display,i={},r={},n=t.gutters.clientLeft,S=t.gutters.firstChild,N=0;S;S=S.nextSibling,++N){var V=e.display.gutterSpecs[N].className;i[V]=S.offsetLeft+S.clientLeft+n,r[V]=S.clientWidth}return{fixedPos:Ea(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:i,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Ea(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function mo(e){var t=Yi(e.display),i=e.options.lineWrapping,r=i&&Math.max(5,e.display.scroller.clientWidth/$i(e.display)-3);return function(n){if(_r(e.doc,n))return 0;var S=0;if(n.widgets)for(var N=0;N<n.widgets.length;N++)n.widgets[N].height&&(S+=n.widgets[N].height);return i?S+(Math.ceil(n.text.length/r)||1)*t:S+t}}function Sa(e){var t=e.doc,i=mo(e);t.iter(function(r){var n=i(r);n!=r.height&&xr(r,n)})}function Mi(e,t,i,r){var n=e.display;if(!i&&Ce(t).getAttribute("cm-not-content")=="true")return null;var S,N,V=n.lineSpace.getBoundingClientRect();try{S=t.clientX-V.left,N=t.clientY-V.top}catch(he){return null}var $=ya(e,S,N),J;if(r&&$.xRel>0&&(J=pt(e.doc,$.line).text).length==$.ch){var ue=q(J,J.length,e.options.tabSize)-J.length;$=Ke($.line,Math.max(0,Math.round((S-to(e.display).left)/$i(e.display))-ue))}return $}function Ii(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var i=e.display.view,r=0;r<i.length;r++)if(t-=i[r].size,t<0)return r}function Tr(e,t,i,r){t==null&&(t=e.doc.first),i==null&&(i=e.doc.first+e.doc.size),r||(r=0);var n=e.display;if(r&&i<n.viewTo&&(n.updateLineNumbers==null||n.updateLineNumbers>t)&&(n.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=n.viewTo)Er&&vi(e.doc,t)<n.viewTo&&xi(e);else if(i<=n.viewFrom)Er&&Un(e.doc,i+r)>n.viewFrom?xi(e):(n.viewFrom+=r,n.viewTo+=r);else if(t<=n.viewFrom&&i>=n.viewTo)xi(e);else if(t<=n.viewFrom){var S=zn(e,i,i+r,1);S?(n.view=n.view.slice(S.index),n.viewFrom=S.lineN,n.viewTo+=r):xi(e)}else if(i>=n.viewTo){var N=zn(e,t,t,-1);N?(n.view=n.view.slice(0,N.index),n.viewTo=N.lineN):xi(e)}else{var V=zn(e,t,t,-1),$=zn(e,i,i+r,1);V&&$?(n.view=n.view.slice(0,V.index).concat(Ft(e,V.lineN,$.lineN)).concat(n.view.slice($.index)),n.viewTo+=r):xi(e)}var J=n.externalMeasured;J&&(i<J.lineN?J.lineN+=r:t<J.lineN+J.size&&(n.externalMeasured=null))}function bi(e,t,i){e.curOp.viewChanged=!0;var r=e.display,n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size&&(r.externalMeasured=null),t<r.viewFrom||t>=r.viewTo)return;var S=r.view[Ii(e,t)];if(S.node==null)return;var N=S.changes||(S.changes=[]);me(N,i)==-1&&N.push(i)}function xi(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function zn(e,t,i,r){var n=Ii(e,t),S,N=e.display.view;if(!Er||i==e.doc.first+e.doc.size)return{index:n,lineN:i};for(var V=e.display.viewFrom,$=0;$<n;$++)V+=N[$].size;if(V!=t){if(r>0){if(n==N.length-1)return null;S=V+N[n].size-t,n++}else S=V-t;t+=S,i+=S}for(;vi(e.doc,i)!=i;){if(n==(r<0?0:N.length-1))return null;i+=r*N[n-(r<0?1:0)].size,n+=r}return{index:n,lineN:i}}function Vs(e,t,i){var r=e.display,n=r.view;n.length==0||t>=r.viewTo||i<=r.viewFrom?(r.view=Ft(e,t,i),r.viewFrom=t):(r.viewFrom>t?r.view=Ft(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(Ii(e,t))),r.viewFrom=t,r.viewTo<i?r.view=r.view.concat(Ft(e,r.viewTo,i)):r.viewTo>i&&(r.view=r.view.slice(0,Ii(e,i)))),r.viewTo=i}function go(e){for(var t=e.display.view,i=0,r=0;r<t.length;r++){var n=t[r];!n.hidden&&(!n.node||n.changes)&&++i}return i}function yn(e){e.display.input.showSelection(e.display.input.prepareSelection())}function vo(e,t){t===void 0&&(t=!0);for(var i=e.doc,r={},n=r.cursors=document.createDocumentFragment(),S=r.selection=document.createDocumentFragment(),N=0;N<i.sel.ranges.length;N++){if(!t&&N==i.sel.primIndex)continue;var V=i.sel.ranges[N];if(V.from().line>=e.display.viewTo||V.to().line<e.display.viewFrom)continue;var $=V.empty();($||e.options.showCursorWhenSelecting)&&yo(e,V.head,n),$||Xs(e,V,S)}return r}function yo(e,t,i){var r=Jr(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),n=i.appendChild(a("div","\xA0","CodeMirror-cursor"));if(n.style.left=r.left+"px",n.style.top=r.top+"px",n.style.height=Math.max(0,r.bottom-r.top)*e.options.cursorHeight+"px",r.other){var S=i.appendChild(a("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));S.style.display="",S.style.left=r.other.left+"px",S.style.top=r.other.top+"px",S.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function Kn(e,t){return e.top-t.top||e.left-t.left}function Xs(e,t,i){var r=e.display,n=e.doc,S=document.createDocumentFragment(),N=to(e.display),V=N.left,$=Math.max(r.sizerWidth,Oi(e)-r.sizer.offsetLeft)-N.right,J=n.direction=="ltr";function ue(rt,dt,bt,gt){dt<0&&(dt=0),dt=Math.round(dt),gt=Math.round(gt),S.appendChild(a("div",null,"CodeMirror-selected","position: absolute; left: "+rt+`px;
|
|
top: `+dt+"px; width: "+(bt==null?$-rt:bt)+`px;
|
|
height: `+(gt-dt)+"px"))}function he(rt,dt,bt){var gt=pt(n,rt),At=gt.text.length,Xt,dr;function $t(rr,Lr){return ga(e,Ke(rt,rr),"div",gt,Lr)}function Or(rr,Lr,mr){var or=po(e,gt,null,rr),ir=Lr=="ltr"==(mr=="after")?"left":"right",Jt=mr=="after"?or.begin:or.end-(/\s/.test(gt.text.charAt(or.end-1))?2:1);return $t(Jt,ir)[ir]}var Ar=Xe(gt,n.direction);return Je(Ar,dt||0,bt==null?At:bt,function(rr,Lr,mr,or){var ir=mr=="ltr",Jt=$t(rr,ir?"left":"right"),Dr=$t(Lr-1,ir?"right":"left"),un=dt==null&&rr==0,Ai=bt==null&&Lr==At,vr=or==0,ni=!Ar||or==Ar.length-1;if(Dr.top-Jt.top<=3){var hr=(J?un:Ai)&&vr,Xa=(J?Ai:un)&&ni,mi=hr?V:(ir?Jt:Dr).left,ji=Xa?$:(ir?Dr:Jt).right;ue(mi,Jt.top,ji-mi,Jt.bottom)}else{var Wi,br,dn,Ya;ir?(Wi=J&&un&&vr?V:Jt.left,br=J?$:Or(rr,mr,"before"),dn=J?V:Or(Lr,mr,"after"),Ya=J&&Ai&&ni?$:Dr.right):(Wi=J?Or(rr,mr,"before"):V,br=!J&&un&&vr?$:Jt.right,dn=!J&&Ai&&ni?V:Dr.left,Ya=J?Or(Lr,mr,"after"):$),ue(Wi,Jt.top,br-Wi,Jt.bottom),Jt.bottom<Dr.top&&ue(V,Jt.bottom,null,Dr.top),ue(dn,Dr.top,Ya-dn,Dr.bottom)}(!Xt||Kn(Jt,Xt)<0)&&(Xt=Jt),Kn(Dr,Xt)<0&&(Xt=Dr),(!dr||Kn(Jt,dr)<0)&&(dr=Jt),Kn(Dr,dr)<0&&(dr=Dr)}),{start:Xt,end:dr}}var Te=t.from(),Se=t.to();if(Te.line==Se.line)he(Te.line,Te.ch,Se.ch);else{var Ne=pt(n,Te.line),ze=pt(n,Se.line),Ye=Sr(Ne)==Sr(ze),tt=he(Te.line,Te.ch,Ye?Ne.text.length+1:null).end,ot=he(Se.line,Ye?0:null,Se.ch).start;Ye&&(tt.top<ot.top-2?(ue(tt.right,tt.top,null,tt.bottom),ue(V,ot.top,ot.left,ot.bottom)):ue(tt.right,tt.top,ot.left-tt.right,tt.bottom)),tt.bottom<ot.top&&ue(V,tt.bottom,null,ot.top)}i.appendChild(S)}function Ca(e){if(!e.state.focused)return;var t=e.display;clearInterval(t.blinker);var i=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){e.hasFocus()||Zi(e),t.cursorDiv.style.visibility=(i=!i)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function bo(e){e.state.focused||(e.display.input.focus(),Ta(e))}function xo(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Zi(e))},100)}function Ta(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(Me(e,"focus",e,t),e.state.focused=!0,G(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),O&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Ca(e)}function Zi(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(Me(e,"blur",e,t),e.state.focused=!1,g(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function Vn(e){for(var t=e.display,i=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var n=t.view[r],S=e.options.lineWrapping,N=void 0,V=0;if(n.hidden)continue;if(H&&U<8){var $=n.node.offsetTop+n.node.offsetHeight;N=$-i,i=$}else{var J=n.node.getBoundingClientRect();N=J.bottom-J.top,!S&&n.text.firstChild&&(V=n.text.firstChild.getBoundingClientRect().right-J.left-1)}var ue=n.line.height-N;if((ue>.005||ue<-.005)&&(xr(n.line,N),Eo(n.line),n.rest))for(var he=0;he<n.rest.length;he++)Eo(n.rest[he]);if(V>e.display.sizerWidth){var Te=Math.ceil(V/$i(e.display));Te>e.display.maxLineLength&&(e.display.maxLineLength=Te,e.display.maxLine=n.line,e.display.maxLineChanged=!0)}}}function Eo(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var i=e.widgets[t],r=i.node.parentNode;r&&(i.height=r.offsetHeight)}}function Xn(e,t,i){var r=i&&i.top!=null?Math.max(0,i.top):e.scroller.scrollTop;r=Math.floor(r-Hn(e));var n=i&&i.bottom!=null?i.bottom:r+e.wrapper.clientHeight,S=Mr(t,r),N=Mr(t,n);if(i&&i.ensure){var V=i.ensure.from.line,$=i.ensure.to.line;V<S?(S=V,N=Mr(t,Zr(pt(t,V))+e.wrapper.clientHeight)):Math.min($,t.lastLine())>=N&&(S=Mr(t,Zr(pt(t,$))-e.wrapper.clientHeight),N=$)}return{from:S,to:Math.max(N,S+1)}}function Ys(e,t){if(Ge(e,"scrollCursorIntoView"))return;var i=e.display,r=i.sizer.getBoundingClientRect(),n=null;if(t.top+r.top<0?n=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(n=!1),n!=null&&!A){var S=a("div","\u200B",null,`position: absolute;
|
|
top: `+(t.top-i.viewOffset-Hn(e.display))+`px;
|
|
height: `+(t.bottom-t.top+ri(e)+i.barHeight)+`px;
|
|
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(S),S.scrollIntoView(n),e.display.lineSpace.removeChild(S)}}function $s(e,t,i,r){r==null&&(r=0);var n;!e.options.lineWrapping&&t==i&&(t=t.ch?Ke(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,i=t.sticky=="before"?Ke(t.line,t.ch+1,"before"):t);for(var S=0;S<5;S++){var N=!1,V=Jr(e,t),$=!i||i==t?V:Jr(e,i);n={left:Math.min(V.left,$.left),top:Math.min(V.top,$.top)-r,right:Math.max(V.left,$.left),bottom:Math.max(V.bottom,$.bottom)+r};var J=wa(e,n),ue=e.doc.scrollTop,he=e.doc.scrollLeft;if(J.scrollTop!=null&&(xn(e,J.scrollTop),Math.abs(e.doc.scrollTop-ue)>1&&(N=!0)),J.scrollLeft!=null&&(Ni(e,J.scrollLeft),Math.abs(e.doc.scrollLeft-he)>1&&(N=!0)),!N)break}return n}function Zs(e,t){var i=wa(e,t);i.scrollTop!=null&&xn(e,i.scrollTop),i.scrollLeft!=null&&Ni(e,i.scrollLeft)}function wa(e,t){var i=e.display,r=Yi(e.display);t.top<0&&(t.top=0);var n=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:i.scroller.scrollTop,S=fa(e),N={};t.bottom-t.top>S&&(t.bottom=t.top+S);var V=e.doc.height+ca(i),$=t.top<r,J=t.bottom>V-r;if(t.top<n)N.scrollTop=$?0:t.top;else if(t.bottom>n+S){var ue=Math.min(t.top,(J?V:t.bottom)-S);ue!=n&&(N.scrollTop=ue)}var he=e.options.fixedGutter?0:i.gutters.offsetWidth,Te=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:i.scroller.scrollLeft-he,Se=Oi(e)-i.gutters.offsetWidth,Ne=t.right-t.left>Se;return Ne&&(t.right=t.left+Se),t.left<10?N.scrollLeft=0:t.left<Te?N.scrollLeft=Math.max(0,t.left+he-(Ne?0:10)):t.right>Se+Te-3&&(N.scrollLeft=t.right+(Ne?0:10)-Se),N}function Aa(e,t){if(t==null)return;Yn(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function Ji(e){Yn(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function bn(e,t,i){(t!=null||i!=null)&&Yn(e),t!=null&&(e.curOp.scrollLeft=t),i!=null&&(e.curOp.scrollTop=i)}function Js(e,t){Yn(e),e.curOp.scrollToPos=t}function Yn(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var i=co(e,t.from),r=co(e,t.to);So(e,i,r,t.margin)}}function So(e,t,i,r){var n=wa(e,{left:Math.min(t.left,i.left),top:Math.min(t.top,i.top)-r,right:Math.max(t.right,i.right),bottom:Math.max(t.bottom,i.bottom)+r});bn(e,n.scrollLeft,n.scrollTop)}function xn(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;k||Da(e,{top:t}),Co(e,t,!0),k&&Da(e),Cn(e,100)}function Co(e,t,i){if(t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),e.display.scroller.scrollTop==t&&!i)return;e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t)}function Ni(e,t,i,r){if(t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(i?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r)return;e.doc.scrollLeft=t,Do(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function En(e){var t=e.display,i=t.gutters.offsetWidth,r=Math.round(e.doc.height+ca(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?i:0,docHeight:r,scrollHeight:r+ri(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:i}}var Bi=function(e,t,i){this.cm=i;var r=this.vert=a("div",[a("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),n=this.horiz=a("div",[a("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=n.tabIndex=-1,e(r),e(n),ke(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),ke(n,"scroll",function(){n.clientWidth&&t(n.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,H&&U<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Bi.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,i=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(i){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var n=e.viewHeight-(t?r: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=i?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var S=e.viewWidth-e.barLeft-(i?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+S)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(r==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:i?r:0,bottom:t?r:0}},Bi.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Bi.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Bi.prototype.zeroWidthHack=function(){var e=l&&!L?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new le,this.disableVert=new le},Bi.prototype.enableZeroWidthBar=function(e,t,i){e.style.pointerEvents="auto";function r(){var n=e.getBoundingClientRect(),S=i=="vert"?document.elementFromPoint(n.right-1,(n.top+n.bottom)/2):document.elementFromPoint((n.right+n.left)/2,n.bottom-1);S!=e?e.style.pointerEvents="none":t.set(1e3,r)}t.set(1e3,r)},Bi.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Sn=function(){};Sn.prototype.update=function(){return{bottom:0,right:0}},Sn.prototype.setScrollLeft=function(){},Sn.prototype.setScrollTop=function(){},Sn.prototype.clear=function(){};function Qi(e,t){t||(t=En(e));var i=e.display.barWidth,r=e.display.barHeight;To(e,t);for(var n=0;n<4&&i!=e.display.barWidth||r!=e.display.barHeight;n++)i!=e.display.barWidth&&e.options.lineWrapping&&Vn(e),To(e,En(e)),i=e.display.barWidth,r=e.display.barHeight}function To(e,t){var i=e.display,r=i.scrollbars.update(t);i.sizer.style.paddingRight=(i.barWidth=r.right)+"px",i.sizer.style.paddingBottom=(i.barHeight=r.bottom)+"px",i.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(i.scrollbarFiller.style.display="block",i.scrollbarFiller.style.height=r.bottom+"px",i.scrollbarFiller.style.width=r.right+"px"):i.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(i.gutterFiller.style.display="block",i.gutterFiller.style.height=r.bottom+"px",i.gutterFiller.style.width=t.gutterWidth+"px"):i.gutterFiller.style.display=""}var wo={native:Bi,null:Sn};function Ao(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&g(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new wo[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),ke(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,i){i=="horizontal"?Ni(e,t):xn(e,t)},e),e.display.scrollbars.addClass&&G(e.display.wrapper,e.display.scrollbars.addClass)}var Qs=0;function Fi(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:++Qs},zr(e.curOp)}function Ui(e){var t=e.curOp;t&&Wn(t,function(i){for(var r=0;r<i.ops.length;r++)i.ops[r].cm.curOp=null;qs(i)})}function qs(e){for(var t=e.ops,i=0;i<t.length;i++)el(t[i]);for(var r=0;r<t.length;r++)tl(t[r]);for(var n=0;n<t.length;n++)rl(t[n]);for(var S=0;S<t.length;S++)il(t[S]);for(var N=0;N<t.length;N++)nl(t[N])}function el(e){var t=e.cm,i=t.display;ol(t),e.updateMaxLine&&jn(t),e.mustUpdate=e.viewChanged||e.forceUpdate||e.scrollTop!=null||e.scrollToPos&&(e.scrollToPos.from.line<i.viewFrom||e.scrollToPos.to.line>=i.viewTo)||i.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new $n(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&La(e.cm,e.update)}function rl(e){var t=e.cm,i=t.display;e.updatedDisplay&&Vn(t),e.barMeasure=En(t),i.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=io(t,i.maxLine,i.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(i.scroller.clientWidth,i.sizer.offsetLeft+e.adjustWidthTo+ri(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,i.sizer.offsetLeft+e.adjustWidthTo-Oi(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=i.input.prepareSelection())}function il(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&Ni(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var i=e.focus&&e.focus==M();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,i),(e.updatedDisplay||e.startHeight!=t.doc.height)&&Qi(t,e.barMeasure),e.updatedDisplay&&_a(t,e.barMeasure),e.selectionChanged&&Ca(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),i&&bo(e.cm)}function nl(e){var t=e.cm,i=t.display,r=t.doc;if(e.updatedDisplay&&Lo(t,e.update),i.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(i.wheelStartX=i.wheelStartY=null),e.scrollTop!=null&&Co(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&Ni(t,e.scrollLeft,!0,!0),e.scrollToPos){var n=$s(t,s(r,e.scrollToPos.from),s(r,e.scrollToPos.to),e.scrollToPos.margin);Ys(t,n)}var S=e.maybeHiddenMarkers,N=e.maybeUnhiddenMarkers;if(S)for(var V=0;V<S.length;++V)S[V].lines.length||Me(S[V],"hide");if(N)for(var $=0;$<N.length;++$)N[$].lines.length&&Me(N[$],"unhide");i.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Me(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Rr(e,t){if(e.curOp)return t();Fi(e);try{return t()}finally{Ui(e)}}function lr(e,t){return function(){if(e.curOp)return t.apply(e,arguments);Fi(e);try{return t.apply(e,arguments)}finally{Ui(e)}}}function yr(e){return function(){if(this.curOp)return e.apply(this,arguments);Fi(this);try{return e.apply(this,arguments)}finally{Ui(this)}}}function ur(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);Fi(t);try{return e.apply(this,arguments)}finally{Ui(t)}}}function Cn(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,z(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var i=+new Date+e.options.workTime,r=qe(e,t.highlightFrontier),n=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(S){if(r.line>=e.display.viewFrom){var N=S.styles,V=S.text.length>e.options.maxHighlightLength?Hr(t.mode,r.state):null,$=fe(e,S,r,!0);V&&(r.state=V),S.styles=$.styles;var J=S.styleClasses,ue=$.classes;ue?S.styleClasses=ue:J&&(S.styleClasses=null);for(var he=!N||N.length!=S.styles.length||J!=ue&&(!J||!ue||J.bgClass!=ue.bgClass||J.textClass!=ue.textClass),Te=0;!he&&Te<N.length;++Te)he=N[Te]!=S.styles[Te];he&&n.push(r.line),S.stateAfter=r.save(),r.nextLine()}else S.text.length<=e.options.maxHighlightLength&&ut(e,S.text,r),S.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>i)return Cn(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),n.length&&Rr(e,function(){for(var S=0;S<n.length;S++)bi(e,n[S],"text")})}var $n=function(e,t,i){var r=e.display;this.viewport=t,this.visible=Xn(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=Oi(e),this.force=i,this.dims=xa(e),this.events=[]};$n.prototype.signal=function(e,t){ce(e,t)&&this.events.push(arguments)},$n.prototype.finish=function(){for(var e=0;e<this.events.length;e++)Me.apply(null,this.events[e])};function ol(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=ri(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=ri(e)+"px",t.scrollbarsClipped=!0)}function sl(e){if(e.hasFocus())return null;var t=M();if(!t||!v(e.display.lineDiv,t))return null;var i={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&v(e.display.lineDiv,r.anchorNode)&&(i.anchorNode=r.anchorNode,i.anchorOffset=r.anchorOffset,i.focusNode=r.focusNode,i.focusOffset=r.focusOffset)}return i}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(),i=document.createRange();i.setEnd(e.anchorNode,e.anchorOffset),i.collapse(!1),t.removeAllRanges(),t.addRange(i),t.extend(e.focusNode,e.focusOffset)}}function La(e,t){var i=e.display,r=e.doc;if(t.editorIsHidden)return xi(e),!1;if(!t.force&&t.visible.from>=i.viewFrom&&t.visible.to<=i.viewTo&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo)&&i.renderedView==i.view&&go(e)==0)return!1;ko(e)&&(xi(e),t.dims=xa(e));var n=r.first+r.size,S=Math.max(t.visible.from-e.options.viewportMargin,r.first),N=Math.min(n,t.visible.to+e.options.viewportMargin);i.viewFrom<S&&S-i.viewFrom<20&&(S=Math.max(r.first,i.viewFrom)),i.viewTo>N&&i.viewTo-N<20&&(N=Math.min(n,i.viewTo)),Er&&(S=vi(e.doc,S),N=Un(e.doc,N));var V=S!=i.viewFrom||N!=i.viewTo||i.lastWrapHeight!=t.wrapperHeight||i.lastWrapWidth!=t.wrapperWidth;Vs(e,S,N),i.viewOffset=Zr(pt(e.doc,i.viewFrom)),e.display.mover.style.top=i.viewOffset+"px";var $=go(e);if(!V&&$==0&&!t.force&&i.renderedView==i.view&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo))return!1;var J=sl(e);return $>4&&(i.lineDiv.style.display="none"),ul(e,i.updateLineNumbers,t.dims),$>4&&(i.lineDiv.style.display=""),i.renderedView=i.view,ll(J),c(i.cursorDiv),c(i.selectionDiv),i.gutters.style.height=i.sizer.style.minHeight=0,V&&(i.lastWrapHeight=t.wrapperHeight,i.lastWrapWidth=t.wrapperWidth,Cn(e,400)),i.updateLineNumbers=null,!0}function Lo(e,t){for(var i=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==Oi(e)){if(i&&i.top!=null&&(i={top:Math.min(e.doc.height+ca(e.display)-fa(e),i.top)}),t.visible=Xn(e.display,e.doc,i),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=Xn(e.display,e.doc,i));if(!La(e,t))break;Vn(e);var n=En(e);yn(e),Qi(e,n),_a(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 Da(e,t){var i=new $n(e,t);if(La(e,i)){Vn(e),Lo(e,i);var r=En(e);yn(e),Qi(e,r),_a(e,r),i.finish()}}function ul(e,t,i){var r=e.display,n=e.options.lineNumbers,S=r.lineDiv,N=S.firstChild;function V(Ne){var ze=Ne.nextSibling;return O&&l&&e.display.currentWheelTarget==Ne?Ne.style.display="none":Ne.parentNode.removeChild(Ne),ze}for(var $=r.view,J=r.viewFrom,ue=0;ue<$.length;ue++){var he=$[ue];if(!he.hidden)if(!he.node||he.node.parentNode!=S){var Te=Ns(e,he,J,i);S.insertBefore(Te,N)}else{for(;N!=he.node;)N=V(N);var Se=n&&t!=null&&t<=J&&he.lineNumber;he.changes&&(me(he.changes,"gutter")>-1&&(Se=!1),Za(e,he,J,i)),Se&&(c(he.lineNumber),he.lineNumber.appendChild(document.createTextNode(ui(e.options,J)))),N=he.node.nextSibling}J+=he.size}for(;N;)N=V(N)}function ka(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function _a(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+ri(e)+"px"}function Do(e){var t=e.display,i=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var r=Ea(t)-t.scroller.scrollLeft+e.doc.scrollLeft,n=t.gutters.offsetWidth,S=r+"px",N=0;N<i.length;N++)if(!i[N].hidden){e.options.fixedGutter&&(i[N].gutter&&(i[N].gutter.style.left=S),i[N].gutterBackground&&(i[N].gutterBackground.style.left=S));var V=i[N].alignable;if(V)for(var $=0;$<V.length;$++)V[$].style.left=S}e.options.fixedGutter&&(t.gutters.style.left=r+n+"px")}function ko(e){if(!e.options.lineNumbers)return!1;var t=e.doc,i=ui(e.options,t.first+t.size-1),r=e.display;if(i.length!=r.lineNumChars){var n=r.measure.appendChild(a("div",[a("div",i)],"CodeMirror-linenumber CodeMirror-gutter-elt")),S=n.firstChild.offsetWidth,N=n.offsetWidth-S;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(S,r.lineGutter.offsetWidth-N)+1,r.lineNumWidth=r.lineNumInnerWidth+N,r.lineNumChars=r.lineNumInnerWidth?i.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",ka(e.display),!0}return!1}function Ra(e,t){for(var i=[],r=!1,n=0;n<e.length;n++){var S=e[n],N=null;if(typeof S!="string"&&(N=S.style,S=S.className),S=="CodeMirror-linenumbers")if(t)r=!0;else continue;i.push({className:S,style:N})}return t&&!r&&i.push({className:"CodeMirror-linenumbers",style:null}),i}function _o(e){var t=e.gutters,i=e.gutterSpecs;c(t),e.lineGutter=null;for(var r=0;r<i.length;++r){var n=i[r],S=n.className,N=n.style,V=t.appendChild(a("div",null,"CodeMirror-gutter "+S));N&&(V.style.cssText=N),S=="CodeMirror-linenumbers"&&(e.lineGutter=V,V.style.width=(e.lineNumWidth||1)+"px")}t.style.display=i.length?"":"none",ka(e)}function Tn(e){_o(e.display),Tr(e),Do(e)}function dl(e,t,i,r){var n=this;this.input=i,n.scrollbarFiller=a("div",null,"CodeMirror-scrollbar-filler"),n.scrollbarFiller.setAttribute("cm-not-content","true"),n.gutterFiller=a("div",null,"CodeMirror-gutter-filler"),n.gutterFiller.setAttribute("cm-not-content","true"),n.lineDiv=x("div",null,"CodeMirror-code"),n.selectionDiv=a("div",null,null,"position: relative; z-index: 1"),n.cursorDiv=a("div",null,"CodeMirror-cursors"),n.measure=a("div",null,"CodeMirror-measure"),n.lineMeasure=a("div",null,"CodeMirror-measure"),n.lineSpace=x("div",[n.measure,n.lineMeasure,n.selectionDiv,n.cursorDiv,n.lineDiv],null,"position: relative; outline: none");var S=x("div",[n.lineSpace],"CodeMirror-lines");n.mover=a("div",[S],null,"position: relative"),n.sizer=a("div",[n.mover],"CodeMirror-sizer"),n.sizerWidth=null,n.heightForcer=a("div",null,null,"position: absolute; height: "+be+"px; width: 1px;"),n.gutters=a("div",null,"CodeMirror-gutters"),n.lineGutter=null,n.scroller=a("div",[n.sizer,n.heightForcer,n.gutters],"CodeMirror-scroll"),n.scroller.setAttribute("tabIndex","-1"),n.wrapper=a("div",[n.scrollbarFiller,n.gutterFiller,n.scroller],"CodeMirror"),H&&U<8&&(n.gutters.style.zIndex=-1,n.scroller.style.paddingRight=0),!O&&!(k&&o)&&(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=Ra(r.gutters,r.lineNumbers),_o(n),i.init(n)}var Zn=0,Ur=null;H?Ur=-.53:k?Ur=15:y?Ur=-.7:_&&(Ur=-1/3);function Ro(e){var t=e.wheelDeltaX,i=e.wheelDeltaY;return t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),i==null&&e.detail&&e.axis==e.VERTICAL_AXIS?i=e.detail:i==null&&(i=e.wheelDelta),{x:t,y:i}}function hl(e){var t=Ro(e);return t.x*=Ur,t.y*=Ur,t}function Oo(e,t){var i=Ro(t),r=i.x,n=i.y,S=e.display,N=S.scroller,V=N.scrollWidth>N.clientWidth,$=N.scrollHeight>N.clientHeight;if(!(r&&V||n&&$))return;if(n&&l&&O){e:for(var J=t.target,ue=S.view;J!=N;J=J.parentNode)for(var he=0;he<ue.length;he++)if(ue[he].node==J){e.display.currentWheelTarget=J;break e}}if(r&&!k&&!w&&Ur!=null){n&&$&&xn(e,Math.max(0,N.scrollTop+n*Ur)),Ni(e,Math.max(0,N.scrollLeft+r*Ur)),(!n||n&&$)&&ee(t),S.wheelStartX=null;return}if(n&&Ur!=null){var Te=n*Ur,Se=e.doc.scrollTop,Ne=Se+S.wrapper.clientHeight;Te<0?Se=Math.max(0,Se+Te-50):Ne=Math.min(e.doc.height,Ne+Te+50),Da(e,{top:Se,bottom:Ne})}Zn<20&&(S.wheelStartX==null?(S.wheelStartX=N.scrollLeft,S.wheelStartY=N.scrollTop,S.wheelDX=r,S.wheelDY=n,setTimeout(function(){if(S.wheelStartX==null)return;var ze=N.scrollLeft-S.wheelStartX,Ye=N.scrollTop-S.wheelStartY,tt=Ye&&S.wheelDY&&Ye/S.wheelDY||ze&&S.wheelDX&&ze/S.wheelDX;if(S.wheelStartX=S.wheelStartY=null,!tt)return;Ur=(Ur*Zn+tt)/(Zn+1),++Zn},200)):(S.wheelDX+=r,S.wheelDY+=n))}var jr=function(e,t){this.ranges=e,this.primIndex=t};jr.prototype.primary=function(){return this.ranges[this.primIndex]},jr.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 i=this.ranges[t],r=e.ranges[t];if(!di(i.anchor,r.anchor)||!di(i.head,r.head))return!1}return!0},jr.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new jt(Li(this.ranges[t].anchor),Li(this.ranges[t].head));return new jr(e,this.primIndex)},jr.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},jr.prototype.contains=function(e,t){t||(t=e);for(var i=0;i<this.ranges.length;i++){var r=this.ranges[i];if(St(t,r.from())>=0&&St(e,r.to())<=0)return i}return-1};var jt=function(e,t){this.anchor=e,this.head=t};jt.prototype.from=function(){return Di(this.anchor,this.head)},jt.prototype.to=function(){return hi(this.anchor,this.head)},jt.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Qr(e,t,i){var r=e&&e.options.selectionsMayTouch,n=t[i];t.sort(function(Te,Se){return St(Te.from(),Se.from())}),i=me(t,n);for(var S=1;S<t.length;S++){var N=t[S],V=t[S-1],$=St(V.to(),N.from());if(r&&!N.empty()?$>0:$>=0){var J=Di(V.from(),N.from()),ue=hi(V.to(),N.to()),he=V.empty()?N.from()==N.head:V.from()==V.head;S<=i&&--i,t.splice(--S,2,new jt(he?ue:J,he?J:ue))}}return new jr(t,i)}function Ei(e,t){return new jr([new jt(e,t||e)],0)}function Si(e){return e.text?Ke(e.from.line+e.text.length-1,we(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Po(e,t){if(St(e,t.from)<0)return e;if(St(e,t.to)<=0)return Si(t);var i=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=Si(t).ch-t.to.ch),Ke(i,r)}function Oa(e,t){for(var i=[],r=0;r<e.sel.ranges.length;r++){var n=e.sel.ranges[r];i.push(new jt(Po(n.anchor,t),Po(n.head,t)))}return Qr(e.cm,i,e.sel.primIndex)}function Mo(e,t,i){return e.line==t.line?Ke(i.line,e.ch-t.ch+i.ch):Ke(i.line+(e.line-t.line),e.ch)}function cl(e,t,i){for(var r=[],n=Ke(e.first,0),S=n,N=0;N<t.length;N++){var V=t[N],$=Mo(V.from,n,S),J=Mo(Si(V),n,S);if(n=V.to,S=J,i=="around"){var ue=e.sel.ranges[N],he=St(ue.head,ue.anchor)<0;r[N]=new jt(he?J:$,he?$:J)}else r[N]=new jt($,$)}return new jr(r,e.sel.primIndex)}function Pa(e){e.doc.mode=Vr(e.options,e.doc.modeOption),wn(e)}function wn(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,Cn(e,100),e.state.modeGen++,e.curOp&&Tr(e)}function Io(e,t){return t.from.ch==0&&t.to.ch==0&&we(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Ma(e,t,i,r){function n(ot){return i?i[ot]:null}function S(ot,rt,dt){$a(ot,rt,dt,r),pr(ot,"change",ot,t)}function N(ot,rt){for(var dt=[],bt=ot;bt<rt;++bt)dt.push(new Ri(J[bt],n(bt),r));return dt}var V=t.from,$=t.to,J=t.text,ue=pt(e,V.line),he=pt(e,$.line),Te=we(J),Se=n(J.length-1),Ne=$.line-V.line;if(t.full)e.insert(0,N(0,J.length)),e.remove(J.length,e.size-J.length);else if(Io(e,t)){var ze=N(0,J.length-1);S(he,he.text,Se),Ne&&e.remove(V.line,Ne),ze.length&&e.insert(V.line,ze)}else if(ue==he)if(J.length==1)S(ue,ue.text.slice(0,V.ch)+Te+ue.text.slice($.ch),Se);else{var Ye=N(1,J.length-1);Ye.push(new Ri(Te+ue.text.slice($.ch),Se,r)),S(ue,ue.text.slice(0,V.ch)+J[0],n(0)),e.insert(V.line+1,Ye)}else if(J.length==1)S(ue,ue.text.slice(0,V.ch)+J[0]+he.text.slice($.ch),n(0)),e.remove(V.line+1,Ne);else{S(ue,ue.text.slice(0,V.ch)+J[0],n(0)),S(he,Te+he.text.slice($.ch),Se);var tt=N(1,J.length-1);Ne>1&&e.remove(V.line+1,Ne-1),e.insert(V.line+1,tt)}pr(e,"change",e,t)}function Ci(e,t,i){function r(n,S,N){if(n.linked)for(var V=0;V<n.linked.length;++V){var $=n.linked[V];if($.doc==S)continue;var J=N&&$.sharedHist;if(i&&!J)continue;t($.doc,J),r($.doc,n,J)}}r(e,null,!0)}function No(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,Sa(e),Pa(e),Bo(e),e.options.lineWrapping||jn(e),e.options.mode=t.modeOption,Tr(e)}function Bo(e){(e.doc.direction=="rtl"?G:g)(e.display.lineDiv,"CodeMirror-rtl")}function fl(e){Rr(e,function(){Bo(e),Tr(e)})}function Jn(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 Ia(e,t){var i={from:Li(t.from),to:Si(t),text:Pr(e,t.from,t.to)};return jo(e,i,t.from.line,t.to.line+1),Ci(e,function(r){return jo(r,i,t.from.line,t.to.line+1)},!0),i}function Fo(e){for(;e.length;){var t=we(e);if(t.ranges)e.pop();else break}}function pl(e,t){if(t)return Fo(e.done),we(e.done);if(e.done.length&&!we(e.done).ranges)return we(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),we(e.done)}function Uo(e,t,i,r){var n=e.history;n.undone.length=0;var S=+new Date,N,V;if((n.lastOp==r||n.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&n.lastModTime>S-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(N=pl(n,n.lastOp==r)))V=we(N.changes),St(t.from,t.to)==0&&St(t.from,V.to)==0?V.to=Si(t):N.changes.push(Ia(e,t));else{var $=we(n.done);for((!$||!$.ranges)&&Qn(e.sel,n.done),N={changes:[Ia(e,t)],generation:n.generation},n.done.push(N);n.done.length>n.undoDepth;)n.done.shift(),n.done[0].ranges||n.done.shift()}n.done.push(i),n.generation=++n.maxGeneration,n.lastModTime=n.lastSelTime=S,n.lastOp=n.lastSelOp=r,n.lastOrigin=n.lastSelOrigin=t.origin,V||Me(e,"historyAdded")}function ml(e,t,i,r){var n=t.charAt(0);return n=="*"||n=="+"&&i.ranges.length==r.ranges.length&&i.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function gl(e,t,i,r){var n=e.history,S=r&&r.origin;i==n.lastSelOp||S&&n.lastSelOrigin==S&&(n.lastModTime==n.lastSelTime&&n.lastOrigin==S||ml(e,S,we(n.done),t))?n.done[n.done.length-1]=t:Qn(t,n.done),n.lastSelTime=+new Date,n.lastSelOrigin=S,n.lastSelOp=i,r&&r.clearRedo!==!1&&Fo(n.undone)}function Qn(e,t){var i=we(t);i&&i.ranges&&i.equals(e)||t.push(e)}function jo(e,t,i,r){var n=t["spans_"+e.id],S=0;e.iter(Math.max(e.first,i),Math.min(e.first+e.size,r),function(N){N.markedSpans&&((n||(n=t["spans_"+e.id]={}))[S]=N.markedSpans),++S})}function vl(e){if(!e)return null;for(var t,i=0;i<e.length;++i)e[i].marker.explicitlyCleared?t||(t=e.slice(0,i)):t&&t.push(e[i]);return t?t.length?t:null:e}function yl(e,t){var i=t["spans_"+e.id];if(!i)return null;for(var r=[],n=0;n<t.text.length;++n)r.push(vl(i[n]));return r}function Wo(e,t){var i=yl(e,t),r=$r(e,t);if(!i)return r;if(!r)return i;for(var n=0;n<i.length;++n){var S=i[n],N=r[n];if(S&&N){e:for(var V=0;V<N.length;++V){for(var $=N[V],J=0;J<S.length;++J)if(S[J].marker==$.marker)continue e;S.push($)}}else N&&(i[n]=N)}return i}function qi(e,t,i){for(var r=[],n=0;n<e.length;++n){var S=e[n];if(S.ranges){r.push(i?jr.prototype.deepCopy.call(S):S);continue}var N=S.changes,V=[];r.push({changes:V});for(var $=0;$<N.length;++$){var J=N[$],ue=void 0;if(V.push({from:J.from,to:J.to,text:J.text}),t)for(var he in J)(ue=he.match(/^spans_(\d+)$/))&&(me(t,Number(ue[1]))>-1&&(we(V)[he]=J[he],delete J[he]))}}return r}function Na(e,t,i,r){if(r){var n=e.anchor;if(i){var S=St(t,n)<0;S!=St(i,n)<0?(n=t,t=i):S!=St(t,i)<0&&(t=i)}return new jt(n,t)}else return new jt(i||t,t)}function qn(e,t,i,r,n){n==null&&(n=e.cm&&(e.cm.display.shift||e.extend)),gr(e,new jr([Na(e.sel.primary(),t,i,n)],0),r)}function Ho(e,t,i){for(var r=[],n=e.cm&&(e.cm.display.shift||e.extend),S=0;S<e.sel.ranges.length;S++)r[S]=Na(e.sel.ranges[S],t[S],null,n);var N=Qr(e.cm,r,e.sel.primIndex);gr(e,N,i)}function Ba(e,t,i,r){var n=e.sel.ranges.slice(0);n[t]=i,gr(e,Qr(e.cm,n,e.sel.primIndex),r)}function Go(e,t,i,r){gr(e,Ei(t,i),r)}function bl(e,t,i){var r={ranges:t.ranges,update:function(n){this.ranges=[];for(var S=0;S<n.length;S++)this.ranges[S]=new jt(s(e,n[S].anchor),s(e,n[S].head))},origin:i&&i.origin};return Me(e,"beforeSelectionChange",e,r),e.cm&&Me(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?Qr(e.cm,r.ranges,r.ranges.length-1):t}function zo(e,t,i){var r=e.history.done,n=we(r);n&&n.ranges?(r[r.length-1]=t,ea(e,t,i)):gr(e,t,i)}function gr(e,t,i){ea(e,t,i),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,i)}function ea(e,t,i){(ce(e,"beforeSelectionChange")||e.cm&&ce(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,i));var r=i&&i.bias||(St(t.primary().head,e.sel.primary().head)<0?-1:1);Ko(e,Xo(e,t,r,!0)),!(i&&i.scroll===!1)&&e.cm&&Ji(e.cm)}function Ko(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,ye(e.cm)),pr(e,"cursorActivity",e)}function Vo(e){Ko(e,Xo(e,e.sel,null,!1))}function Xo(e,t,i,r){for(var n,S=0;S<t.ranges.length;S++){var N=t.ranges[S],V=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[S],$=ta(e,N.anchor,V&&V.anchor,i,r),J=ta(e,N.head,V&&V.head,i,r);(n||$!=N.anchor||J!=N.head)&&(n||(n=t.ranges.slice(0,S)),n[S]=new jt($,J))}return n?Qr(e.cm,n,t.primIndex):t}function en(e,t,i,r,n){var S=pt(e,t.line);if(S.markedSpans)for(var N=0;N<S.markedSpans.length;++N){var V=S.markedSpans[N],$=V.marker,J="selectLeft"in $?!$.selectLeft:$.inclusiveLeft,ue="selectRight"in $?!$.selectRight:$.inclusiveRight;if((V.from==null||(J?V.from<=t.ch:V.from<t.ch))&&(V.to==null||(ue?V.to>=t.ch:V.to>t.ch))){if(n&&(Me($,"beforeCursorEnter"),$.explicitlyCleared))if(S.markedSpans){--N;continue}else break;if(!$.atomic)continue;if(i){var he=$.find(r<0?1:-1),Te=void 0;if((r<0?ue:J)&&(he=Yo(e,he,-r,he&&he.line==t.line?S:null)),he&&he.line==t.line&&(Te=St(he,i))&&(r<0?Te<0:Te>0))return en(e,he,t,r,n)}var Se=$.find(r<0?-1:1);return(r<0?J:ue)&&(Se=Yo(e,Se,r,Se.line==t.line?S:null)),Se?en(e,Se,t,r,n):null}}return t}function ta(e,t,i,r,n){var S=r||1,N=en(e,t,i,S,n)||!n&&en(e,t,i,S,!0)||en(e,t,i,-S,n)||!n&&en(e,t,i,-S,!0);return N||(e.cantEdit=!0,Ke(e.first,0))}function Yo(e,t,i,r){return i<0&&t.ch==0?t.line>e.first?s(e,Ke(t.line-1)):null:i>0&&t.ch==(r||pt(e,t.line)).text.length?t.line<e.first+e.size-1?Ke(t.line+1,0):null:new Ke(t.line,t.ch+i)}function $o(e){e.setSelection(Ke(e.firstLine(),0),Ke(e.lastLine()),Le)}function Zo(e,t,i){var r={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return r.canceled=!0}};return i&&(r.update=function(n,S,N,V){n&&(r.from=s(e,n)),S&&(r.to=s(e,S)),N&&(r.text=N),V!==void 0&&(r.origin=V)}),Me(e,"beforeChange",e,r),e.cm&&Me(e.cm,"beforeChange",e.cm,r),r.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:r.from,to:r.to,text:r.text,origin:r.origin}}function tn(e,t,i){if(e.cm){if(!e.cm.curOp)return lr(e.cm,tn)(e,t,i);if(e.cm.state.suppressEdits)return}if((ce(e,"beforeChange")||e.cm&&ce(e.cm,"beforeChange"))&&(t=Zo(e,t,!0),!t))return;var r=Hi&&!i&&ki(e,t.from,t.to);if(r)for(var n=r.length-1;n>=0;--n)Jo(e,{from:r[n].from,to:r[n].to,text:n?[""]:t.text,origin:t.origin});else Jo(e,t)}function Jo(e,t){if(t.text.length==1&&t.text[0]==""&&St(t.from,t.to)==0)return;var i=Oa(e,t);Uo(e,t,i,e.cm?e.cm.curOp.id:NaN),An(e,t,i,$r(e,t));var r=[];Ci(e,function(n,S){!S&&me(r,n.history)==-1&&(ts(n.history,t),r.push(n.history)),An(n,t,null,$r(n,t))})}function ra(e,t,i){var r=e.cm&&e.cm.state.suppressEdits;if(r&&!i)return;for(var n=e.history,S,N=e.sel,V=t=="undo"?n.done:n.undone,$=t=="undo"?n.undone:n.done,J=0;J<V.length&&!(S=V[J],i?S.ranges&&!S.equals(e.sel):!S.ranges);J++);if(J==V.length)return;for(n.lastOrigin=n.lastSelOrigin=null;;)if(S=V.pop(),S.ranges){if(Qn(S,$),i&&!S.equals(e.sel)){gr(e,S,{clearRedo:!1});return}N=S}else if(r){V.push(S);return}else break;var ue=[];Qn(N,$),$.push({changes:ue,generation:n.generation}),n.generation=S.generation||++n.maxGeneration;for(var he=ce(e,"beforeChange")||e.cm&&ce(e.cm,"beforeChange"),Te=function(ze){var Ye=S.changes[ze];if(Ye.origin=t,he&&!Zo(e,Ye,!1))return V.length=0,{};ue.push(Ia(e,Ye));var tt=ze?Oa(e,Ye):we(V);An(e,Ye,tt,Wo(e,Ye)),!ze&&e.cm&&e.cm.scrollIntoView({from:Ye.from,to:Si(Ye)});var ot=[];Ci(e,function(rt,dt){!dt&&me(ot,rt.history)==-1&&(ts(rt.history,Ye),ot.push(rt.history)),An(rt,Ye,null,Wo(rt,Ye))})},Se=S.changes.length-1;Se>=0;--Se){var Ne=Te(Se);if(Ne)return Ne.v}}function Qo(e,t){if(t==0)return;if(e.first+=t,e.sel=new jr(ve(e.sel.ranges,function(n){return new jt(Ke(n.anchor.line+t,n.anchor.ch),Ke(n.head.line+t,n.head.ch))}),e.sel.primIndex),e.cm){Tr(e.cm,e.first,e.first-t,t);for(var i=e.cm.display,r=i.viewFrom;r<i.viewTo;r++)bi(e.cm,r,"gutter")}}function An(e,t,i,r){if(e.cm&&!e.cm.curOp)return lr(e.cm,An)(e,t,i,r);if(t.to.line<e.first){Qo(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);Qo(e,n),t={from:Ke(e.first,0),to:Ke(t.to.line+n,t.to.ch),text:[we(t.text)],origin:t.origin}}var S=e.lastLine();t.to.line>S&&(t={from:t.from,to:Ke(S,pt(e,S).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Pr(e,t.from,t.to),i||(i=Oa(e,t)),e.cm?xl(e.cm,t,r):Ma(e,t,r),ea(e,i,Le),e.cantEdit&&ta(e,Ke(e.firstLine(),0))&&(e.cantEdit=!1)}function xl(e,t,i){var r=e.doc,n=e.display,S=t.from,N=t.to,V=!1,$=S.line;e.options.lineWrapping||($=Dt(Sr(pt(r,S.line))),r.iter($,N.line+1,function(Se){if(Se==n.maxLine)return V=!0,!0})),r.sel.contains(t.from,t.to)>-1&&ye(e),Ma(r,t,i,mo(e)),e.options.lineWrapping||(r.iter($,S.line+t.text.length,function(Se){var Ne=Vi(Se);Ne>n.maxLineLength&&(n.maxLine=Se,n.maxLineLength=Ne,n.maxLineChanged=!0,V=!1)}),V&&(e.curOp.updateMaxLine=!0)),Gr(r,S.line),Cn(e,400);var J=t.text.length-(N.line-S.line)-1;t.full?Tr(e):S.line==N.line&&t.text.length==1&&!Io(e.doc,t)?bi(e,S.line,"text"):Tr(e,S.line,N.line+1,J);var ue=ce(e,"changes"),he=ce(e,"change");if(he||ue){var Te={from:S,to:N,text:t.text,removed:t.removed,origin:t.origin};he&&pr(e,"change",e,Te),ue&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(Te)}e.display.selForContextMenu=null}function rn(e,t,i,r,n){var S;r||(r=i),St(r,i)<0&&(S=[r,i],i=S[0],r=S[1]),typeof t=="string"&&(t=e.splitLines(t)),tn(e,{from:i,to:r,text:t,origin:n})}function qo(e,t,i,r){i<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function es(e,t,i,r){for(var n=0;n<e.length;++n){var S=e[n],N=!0;if(S.ranges){S.copied||(S=e[n]=S.deepCopy(),S.copied=!0);for(var V=0;V<S.ranges.length;V++)qo(S.ranges[V].anchor,t,i,r),qo(S.ranges[V].head,t,i,r);continue}for(var $=0;$<S.changes.length;++$){var J=S.changes[$];if(i<J.from.line)J.from=Ke(J.from.line+r,J.from.ch),J.to=Ke(J.to.line+r,J.to.ch);else if(t<=J.to.line){N=!1;break}}N||(e.splice(0,n+1),n=0)}}function ts(e,t){var i=t.from.line,r=t.to.line,n=t.text.length-(r-i)-1;es(e.done,i,r,n),es(e.undone,i,r,n)}function Ln(e,t,i,r){var n=t,S=t;return typeof t=="number"?S=pt(e,W(e,t)):n=Dt(t),n==null?null:(r(S,n)&&e.cm&&bi(e.cm,n,i),S)}function Dn(e){this.lines=e,this.parent=null;for(var t=0,i=0;i<e.length;++i)e[i].parent=this,t+=e[i].height;this.height=t}Dn.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var i=e,r=e+t;i<r;++i){var n=this.lines[i];this.height-=n.height,da(n),pr(n,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,i){this.height+=i,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var r=0;r<t.length;++r)t[r].parent=this},iterN:function(e,t,i){for(var r=e+t;e<r;++e)if(i(this.lines[e]))return!0}};function kn(e){this.children=e;for(var t=0,i=0,r=0;r<e.length;++r){var n=e[r];t+=n.chunkSize(),i+=n.height,n.parent=this}this.size=t,this.height=i,this.parent=null}kn.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var i=0;i<this.children.length;++i){var r=this.children[i],n=r.chunkSize();if(e<n){var S=Math.min(t,n-e),N=r.height;if(r.removeInner(e,S),this.height-=N-r.height,n==S&&(this.children.splice(i--,1),r.parent=null),(t-=S)==0)break;e=0}else e-=n}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof Dn))){var V=[];this.collapse(V),this.children=[new Dn(V)],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,i){this.size+=t.length,this.height+=i;for(var r=0;r<this.children.length;++r){var n=this.children[r],S=n.chunkSize();if(e<=S){if(n.insertInner(e,t,i),n.lines&&n.lines.length>50){for(var N=n.lines.length%25+25,V=N;V<n.lines.length;){var $=new Dn(n.lines.slice(V,V+=25));n.height-=$.height,this.children.splice(++r,0,$),$.parent=this}n.lines=n.lines.slice(0,N),this.maybeSpill()}break}e-=S}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),i=new kn(t);if(e.parent){e.size-=i.size,e.height-=i.height;var n=me(e.parent.children,e);e.parent.children.splice(n+1,0,i)}else{var r=new kn(e.children);r.parent=e,e.children=[r,i],e=r}i.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iterN:function(e,t,i){for(var r=0;r<this.children.length;++r){var n=this.children[r],S=n.chunkSize();if(e<S){var N=Math.min(t,S-e);if(n.iterN(e,N,i))return!0;if((t-=N)==0)break;e=0}else e-=S}}};var _n=function(e,t,i){if(i)for(var r in i)i.hasOwnProperty(r)&&(this[r]=i[r]);this.doc=e,this.node=t};_n.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,i=this.line,r=Dt(i);if(r==null||!t)return;for(var n=0;n<t.length;++n)t[n]==this&&t.splice(n--,1);t.length||(i.widgets=null);var S=gn(this);xr(i,Math.max(0,i.height-S)),e&&(Rr(e,function(){rs(e,i,-S),bi(e,r,"widget")}),pr(e,"lineWidgetCleared",e,this,r))},_n.prototype.changed=function(){var e=this,t=this.height,i=this.doc.cm,r=this.line;this.height=null;var n=gn(this)-t;if(!n)return;_r(this.doc,r)||xr(r,r.height+n),i&&Rr(i,function(){i.curOp.forceUpdate=!0,rs(i,r,n),pr(i,"lineWidgetChanged",i,e,Dt(r))})},ge(_n);function rs(e,t,i){Zr(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Aa(e,i)}function El(e,t,i,r){var n=new _n(e,i,r),S=e.cm;return S&&n.noHScroll&&(S.display.alignWidgets=!0),Ln(e,t,"widget",function(N){var V=N.widgets||(N.widgets=[]);if(n.insertAt==null?V.push(n):V.splice(Math.min(V.length-1,Math.max(0,n.insertAt)),0,n),n.line=N,S&&!_r(e,N)){var $=Zr(N)<e.scrollTop;xr(N,N.height+gn(n)),$&&Aa(S,n.height),S.curOp.forceUpdate=!0}return!0}),S&&pr(S,"lineWidgetAdded",S,n,typeof t=="number"?t:Dt(t)),n}var is=0,Ti=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++is};Ti.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&Fi(e),ce(this,"clear")){var i=this.find();i&&pr(this,"clear",i.from,i.to)}for(var r=null,n=null,S=0;S<this.lines.length;++S){var N=this.lines[S],V=Yr(N.markedSpans,this);e&&!this.collapsed?bi(e,Dt(N),"text"):e&&(V.to!=null&&(n=Dt(N)),V.from!=null&&(r=Dt(N))),N.markedSpans=ci(N.markedSpans,V),V.from==null&&this.collapsed&&!_r(this.doc,N)&&e&&xr(N,Yi(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var $=0;$<this.lines.length;++$){var J=Sr(this.lines[$]),ue=Vi(J);ue>e.display.maxLineLength&&(e.display.maxLine=J,e.display.maxLineLength=ue,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&Tr(e,r,n+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Vo(e.doc)),e&&pr(e,"markerCleared",e,this,r,n),t&&Ui(e),this.parent&&this.parent.clear()},Ti.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var i,r,n=0;n<this.lines.length;++n){var S=this.lines[n],N=Yr(S.markedSpans,this);if(N.from!=null&&(i=Ke(t?S:Dt(S),N.from),e==-1))return i;if(N.to!=null&&(r=Ke(t?S:Dt(S),N.to),e==1))return r}return i&&{from:i,to:r}},Ti.prototype.changed=function(){var e=this,t=this.find(-1,!0),i=this,r=this.doc.cm;if(!t||!r)return;Rr(r,function(){var n=t.line,S=Dt(t.line),N=pa(r,S);if(N&&(oo(N),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!_r(i.doc,n)&&i.height!=null){var V=i.height;i.height=null;var $=gn(i)-V;$&&xr(n,n.height+$)}pr(r,"markerChanged",r,e)})},Ti.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||me(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Ti.prototype.detachLine=function(e){if(this.lines.splice(me(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},ge(Ti);function nn(e,t,i,r,n){if(r&&r.shared)return Sl(e,t,i,r,n);if(e.cm&&!e.cm.curOp)return lr(e.cm,nn)(e,t,i,r,n);var S=new Ti(e,n),N=St(t,i);if(r&&j(r,S,!1),N>0||N==0&&S.clearWhenEmpty!==!1)return S;if(S.replacedWith&&(S.collapsed=!0,S.widgetNode=x("span",[S.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||S.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(S.widgetNode.insertLeft=!0)),S.collapsed){if(Qt(e,t.line,t,i,S)||t.line!=i.line&&Qt(e,i.line,t,i,S))throw new Error("Inserting collapsed marker partially overlapping an existing one");kr()}S.addToHistory&&Uo(e,{from:t,to:i,origin:"markText"},e.sel,NaN);var V=t.line,$=e.cm,J;if(e.iter(V,i.line+1,function(he){$&&S.collapsed&&!$.options.lineWrapping&&Sr(he)==$.display.maxLine&&(J=!0),S.collapsed&&V!=t.line&&xr(he,0),ei(he,new gi(S,V==t.line?t.ch:null,V==i.line?i.ch:null)),++V}),S.collapsed&&e.iter(t.line,i.line+1,function(he){_r(e,he)&&xr(he,0)}),S.clearOnEnter&&ke(S,"beforeCursorEnter",function(){return S.clear()}),S.readOnly&&(Br(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),S.collapsed&&(S.id=++is,S.atomic=!0),$){if(J&&($.curOp.updateMaxLine=!0),S.collapsed)Tr($,t.line,i.line+1);else if(S.className||S.startStyle||S.endStyle||S.css||S.attributes||S.title)for(var ue=t.line;ue<=i.line;ue++)bi($,ue,"text");S.atomic&&Vo($.doc),pr($,"markerAdded",$,S)}return S}var Rn=function(e,t){this.markers=e,this.primary=t;for(var i=0;i<e.length;++i)e[i].parent=this};Rn.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();pr(this,"clear")},Rn.prototype.find=function(e,t){return this.primary.find(e,t)},ge(Rn);function Sl(e,t,i,r,n){r=j(r),r.shared=!1;var S=[nn(e,t,i,r,n)],N=S[0],V=r.widgetNode;return Ci(e,function($){V&&(r.widgetNode=V.cloneNode(!0)),S.push(nn($,s($,t),s($,i),r,n));for(var J=0;J<$.linked.length;++J)if($.linked[J].isParent)return;N=we(S)}),new Rn(S,N)}function ns(e){return e.findMarks(Ke(e.first,0),e.clipPos(Ke(e.lastLine())),function(t){return t.parent})}function Cl(e,t){for(var i=0;i<t.length;i++){var r=t[i],n=r.find(),S=e.clipPos(n.from),N=e.clipPos(n.to);if(St(S,N)){var V=nn(e,S,N,r.primary,r.primary.type);r.markers.push(V),V.parent=r}}}function Tl(e){for(var t=function(r){var n=e[r],S=[n.primary.doc];Ci(n.primary.doc,function($){return S.push($)});for(var N=0;N<n.markers.length;N++){var V=n.markers[N];me(S,V.doc)==-1&&(V.parent=null,n.markers.splice(N--,1))}},i=0;i<e.length;i++)t(i)}var wl=0,wr=function(e,t,i,r,n){if(!(this instanceof wr))return new wr(e,t,i,r,n);i==null&&(i=0),kn.call(this,[new Dn([new Ri("",null)])]),this.first=i,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=i;var S=Ke(i,0);this.sel=Ei(S),this.history=new Jn(null),this.id=++wl,this.modeOption=t,this.lineSep=r,this.direction=n=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),Ma(this,{from:S,to:S,text:e}),gr(this,Ei(S),Le)};wr.prototype=Oe(kn.prototype,{constructor:wr,iter:function(e,t,i){i?this.iterN(e-this.first,t-e,i):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var i=0,r=0;r<t.length;++r)i+=t[r].height;this.insertInner(e-this.first,t,i)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=li(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:ur(function(e){var t=Ke(this.first,0),i=this.first+this.size-1;tn(this,{from:t,to:Ke(i,pt(this,i).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&bn(this.cm,0,0),gr(this,Ei(t),Le)}),replaceRange:function(e,t,i,r){t=s(this,t),i=i?s(this,i):t,rn(this,e,t,i,r)},getRange:function(e,t,i){var r=Pr(this,s(this,e),s(this,t));return i===!1?r:r.join(i||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(Xr(this,e))return pt(this,e)},getLineNumber:function(e){return Dt(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=pt(this,e)),Sr(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return s(this,e)},getCursor:function(e){var t=this.sel.primary(),i;return e==null||e=="head"?i=t.head:e=="anchor"?i=t.anchor:e=="end"||e=="to"||e===!1?i=t.to():i=t.from(),i},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:ur(function(e,t,i){Go(this,s(this,typeof e=="number"?Ke(e,t||0):e),null,i)}),setSelection:ur(function(e,t,i){Go(this,s(this,e),s(this,t||e),i)}),extendSelection:ur(function(e,t,i){qn(this,s(this,e),t&&s(this,t),i)}),extendSelections:ur(function(e,t){Ho(this,B(this,e),t)}),extendSelectionsBy:ur(function(e,t){var i=ve(this.sel.ranges,e);Ho(this,B(this,i),t)}),setSelections:ur(function(e,t,i){if(!e.length)return;for(var r=[],n=0;n<e.length;n++)r[n]=new jt(s(this,e[n].anchor),s(this,e[n].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),gr(this,Qr(this.cm,r,t),i)}),addSelection:ur(function(e,t,i){var r=this.sel.ranges.slice(0);r.push(new jt(s(this,e),s(this,t||e))),gr(this,Qr(this.cm,r,r.length-1),i)}),getSelection:function(e){for(var t=this.sel.ranges,i,r=0;r<t.length;r++){var n=Pr(this,t[r].from(),t[r].to());i=i?i.concat(n):n}return e===!1?i:i.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],i=this.sel.ranges,r=0;r<i.length;r++){var n=Pr(this,i[r].from(),i[r].to());e!==!1&&(n=n.join(e||this.lineSeparator())),t[r]=n}return t},replaceSelection:function(e,t,i){for(var r=[],n=0;n<this.sel.ranges.length;n++)r[n]=e;this.replaceSelections(r,t,i||"+input")},replaceSelections:ur(function(e,t,i){for(var r=[],n=this.sel,S=0;S<n.ranges.length;S++){var N=n.ranges[S];r[S]={from:N.from(),to:N.to(),text:this.splitLines(e[S]),origin:i}}for(var V=t&&t!="end"&&cl(this,r,t),$=r.length-1;$>=0;$--)tn(this,r[$]);V?zo(this,V):this.cm&&Ji(this.cm)}),undo:ur(function(){ra(this,"undo")}),redo:ur(function(){ra(this,"redo")}),undoSelection:ur(function(){ra(this,"undo",!0)}),redoSelection:ur(function(){ra(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,i=0,r=0;r<e.done.length;r++)e.done[r].ranges||++t;for(var n=0;n<e.undone.length;n++)e.undone[n].ranges||++i;return{undo:t,redo:i}},clearHistory:function(){var e=this;this.history=new Jn(this.history.maxGeneration),Ci(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:qi(this.history.done),undone:qi(this.history.undone)}},setHistory:function(e){var t=this.history=new Jn(this.history.maxGeneration);t.done=qi(e.done.slice(0),null,!0),t.undone=qi(e.undone.slice(0),null,!0)},setGutterMarker:ur(function(e,t,i){return Ln(this,e,"gutter",function(r){var n=r.gutterMarkers||(r.gutterMarkers={});return n[t]=i,!i&&Ve(n)&&(r.gutterMarkers=null),!0})}),clearGutter:ur(function(e){var t=this;this.iter(function(i){i.gutterMarkers&&i.gutterMarkers[e]&&Ln(t,i,"gutter",function(){return i.gutterMarkers[e]=null,Ve(i.gutterMarkers)&&(i.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!Xr(this,e))return null;if(t=e,e=pt(this,e),!e)return null}else if(t=Dt(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:ur(function(e,t,i){return Ln(this,e,t=="gutter"?"gutter":"class",function(r){var n=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!r[n])r[n]=i;else{if(E(i).test(r[n]))return!1;r[n]+=" "+i}return!0})}),removeLineClass:ur(function(e,t,i){return Ln(this,e,t=="gutter"?"gutter":"class",function(r){var n=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",S=r[n];if(S)if(i==null)r[n]=null;else{var N=S.match(E(i));if(!N)return!1;var V=N.index+N[0].length;r[n]=S.slice(0,N.index)+(!N.index||V==S.length?"":" ")+S.slice(V)||null}else return!1;return!0})}),addLineWidget:ur(function(e,t,i){return El(this,e,t,i)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,i){return nn(this,s(this,e),s(this,t),i,i&&i.type||"range")},setBookmark:function(e,t){var i={replacedWith:t&&(t.nodeType==null?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return e=s(this,e),nn(this,e,e,i,"bookmark")},findMarksAt:function(e){e=s(this,e);var t=[],i=pt(this,e.line).markedSpans;if(i)for(var r=0;r<i.length;++r){var n=i[r];(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,i){e=s(this,e),t=s(this,t);var r=[],n=e.line;return this.iter(e.line,t.line+1,function(S){var N=S.markedSpans;if(N)for(var V=0;V<N.length;V++){var $=N[V];!($.to!=null&&n==e.line&&e.ch>=$.to||$.from==null&&n!=e.line||$.from!=null&&n==t.line&&$.from>=t.ch)&&(!i||i($.marker))&&r.push($.marker.parent||$.marker)}++n}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var i=t.markedSpans;if(i)for(var r=0;r<i.length;++r)i[r].from!=null&&e.push(i[r].marker)}),e},posFromIndex:function(e){var t,i=this.first,r=this.lineSeparator().length;return this.iter(function(n){var S=n.text.length+r;if(S>e)return t=e,!0;e-=S,++i}),s(this,Ke(i,t))},indexFromPos:function(e){e=s(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var i=this.lineSeparator().length;return this.iter(this.first,e.line,function(r){t+=r.text.length+i}),t},copy:function(e){var t=new wr(li(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,i=this.first+this.size;e.from!=null&&e.from>t&&(t=e.from),e.to!=null&&e.to<i&&(i=e.to);var r=new wr(li(this,t,i),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(r.history=this.history),(this.linked||(this.linked=[])).push({doc:r,sharedHist:e.sharedHist}),r.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],Cl(r,ns(this)),r},unlinkDoc:function(e){if(e instanceof Yt&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){var i=this.linked[t];if(i.doc!=e)continue;this.linked.splice(t,1),e.unlinkDoc(this),Tl(ns(this));break}if(e.history==this.history){var r=[e.id];Ci(e,function(n){return r.push(n.id)},!0),e.history=new Jn(null),e.history.done=qi(this.history.done,r),e.history.undone=qi(this.history.undone,r)}},iterLinkedDocs:function(e){Ci(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):Et(e)},lineSeparator:function(){return this.lineSep||`
|
|
`},setDirection:ur(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)})}),wr.prototype.eachLine=wr.prototype.iter;var as=0;function Al(e){var t=this;if(os(t),Ge(t,e)||fi(t.display,e))return;ee(e),H&&(as=+new Date);var i=Mi(t,e,!0),r=e.dataTransfer.files;if(!i||t.isReadOnly())return;if(r&&r.length&&window.FileReader&&window.File)for(var n=r.length,S=Array(n),N=0,V=function(){++N==n&&lr(t,function(){i=s(t.doc,i);var Se={from:i,to:i,text:t.doc.splitLines(S.filter(function(Ne){return Ne!=null}).join(t.doc.lineSeparator())),origin:"paste"};tn(t.doc,Se),zo(t.doc,Ei(s(t.doc,i),s(t.doc,Si(Se))))})()},$=function(Se,Ne){if(t.options.allowDropFileTypes&&me(t.options.allowDropFileTypes,Se.type)==-1){V();return}var ze=new FileReader;ze.onerror=function(){return V()},ze.onload=function(){var Ye=ze.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(Ye)){V();return}S[Ne]=Ye,V()},ze.readAsText(Se)},J=0;J<r.length;J++)$(r[J],J);else{if(t.state.draggingText&&t.doc.sel.contains(i)>-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var ue=e.dataTransfer.getData("Text");if(ue){var he;if(t.state.draggingText&&!t.state.draggingText.copy&&(he=t.listSelections()),ea(t.doc,Ei(i,i)),he)for(var Te=0;Te<he.length;++Te)rn(t.doc,"",he[Te].anchor,he[Te].head,"drag");t.replaceSelection(ue,"around","paste"),t.display.input.focus()}}catch(Se){}}}function Ll(e,t){if(H&&(!e.state.draggingText||+new Date-as<100)){se(t);return}if(Ge(e,t)||fi(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!_){var i=a("img",null,null,"position: fixed; left: 0; top: 0;");i.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",w&&(i.width=i.height=1,e.display.wrapper.appendChild(i),i._top=i.offsetTop),t.dataTransfer.setDragImage(i,0,0),w&&i.parentNode.removeChild(i)}}function Dl(e,t){var i=Mi(e,t);if(!i)return;var r=document.createDocumentFragment();yo(e,i,r),e.display.dragCursor||(e.display.dragCursor=a("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),u(e.display.dragCursor,r)}function os(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function ss(e){if(!document.getElementsByClassName)return;for(var t=document.getElementsByClassName("CodeMirror"),i=[],r=0;r<t.length;r++){var n=t[r].CodeMirror;n&&i.push(n)}i.length&&i[0].operation(function(){for(var S=0;S<i.length;S++)e(i[S])})}var ls=!1;function kl(){if(ls)return;_l(),ls=!0}function _l(){var e;ke(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,ss(Rl)},100))}),ke(window,"blur",function(){return ss(Zi)})}function Rl(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var wi={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"},On=0;On<10;On++)wi[On+48]=wi[On+96]=String(On);for(var ia=65;ia<=90;ia++)wi[ia]=String.fromCharCode(ia);for(var Pn=1;Pn<=12;Pn++)wi[Pn+111]=wi[Pn+63235]="F"+Pn;var pi={};pi.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"},pi.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"},pi.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"},pi.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"]},pi.default=l?pi.macDefault:pi.pcDefault;function Ol(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var i,r,n,S,N=0;N<t.length-1;N++){var V=t[N];if(/^(cmd|meta|m)$/i.test(V))S=!0;else if(/^a(lt)?$/i.test(V))i=!0;else if(/^(c|ctrl|control)$/i.test(V))r=!0;else if(/^s(hift)?$/i.test(V))n=!0;else throw new Error("Unrecognized modifier name: "+V)}return i&&(e="Alt-"+e),r&&(e="Ctrl-"+e),S&&(e="Cmd-"+e),n&&(e="Shift-"+e),e}function Pl(e){var t={};for(var i in e)if(e.hasOwnProperty(i)){var r=e[i];if(/^(name|fallthrough|(de|at)tach)$/.test(i))continue;if(r=="..."){delete e[i];continue}for(var n=ve(i.split(" "),Ol),S=0;S<n.length;S++){var N=void 0,V=void 0;S==n.length-1?(V=n.join(" "),N=r):(V=n.slice(0,S+1).join(" "),N="...");var $=t[V];if(!$)t[V]=N;else if($!=N)throw new Error("Inconsistent bindings for "+V)}delete e[i]}for(var J in t)e[J]=t[J];return e}function an(e,t,i,r){t=na(t);var n=t.call?t.call(e,r):t[e];if(n===!1)return"nothing";if(n==="...")return"multi";if(n!=null&&i(n))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return an(e,t.fallthrough,i,r);for(var S=0;S<t.fallthrough.length;S++){var N=an(e,t.fallthrough[S],i,r);if(N)return N}}}function us(e){var t=typeof e=="string"?e:wi[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function ds(e,t,i){var r=e;return t.altKey&&r!="Alt"&&(e="Alt-"+e),(p?t.metaKey:t.ctrlKey)&&r!="Ctrl"&&(e="Ctrl-"+e),(p?t.ctrlKey:t.metaKey)&&r!="Mod"&&(e="Cmd-"+e),!i&&t.shiftKey&&r!="Shift"&&(e="Shift-"+e),e}function hs(e,t){if(w&&e.keyCode==34&&e.char)return!1;var i=wi[e.keyCode];return i==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(i=e.code),ds(i,e,t))}function na(e){return typeof e=="string"?pi[e]:e}function on(e,t){for(var i=e.doc.sel.ranges,r=[],n=0;n<i.length;n++){for(var S=t(i[n]);r.length&&St(S.from,we(r).to)<=0;){var N=r.pop();if(St(N.from,S.from)<0){S.from=N.from;break}}r.push(S)}Rr(e,function(){for(var V=r.length-1;V>=0;V--)rn(e.doc,"",r[V].from,r[V].to,"+delete");Ji(e)})}function Fa(e,t,i){var r=Pe(e.text,t+i,i);return r<0||r>e.text.length?null:r}function Ua(e,t,i){var r=Fa(e,t.ch,i);return r==null?null:new Ke(t.line,r,i<0?"after":"before")}function ja(e,t,i,r,n){if(e){t.doc.direction=="rtl"&&(n=-n);var S=Xe(i,t.doc.direction);if(S){var N=n<0?we(S):S[0],V=n<0==(N.level==1),$=V?"after":"before",J;if(N.level>0||t.doc.direction=="rtl"){var ue=Xi(t,i);J=n<0?i.text.length-1:0;var he=ii(t,ue,J).top;J=et(function(Te){return ii(t,ue,Te).top==he},n<0==(N.level==1)?N.from:N.to-1,J),$=="before"&&(J=Fa(i,J,1))}else J=n<0?N.to:N.from;return new Ke(r,J,$)}}return new Ke(r,n<0?i.text.length:0,n<0?"before":"after")}function Ml(e,t,i,r){var n=Xe(t,e.doc.direction);if(!n)return Ua(t,i,r);i.ch>=t.text.length?(i.ch=t.text.length,i.sticky="before"):i.ch<=0&&(i.ch=0,i.sticky="after");var S=$e(n,i.ch,i.sticky),N=n[S];if(e.doc.direction=="ltr"&&N.level%2==0&&(r>0?N.to>i.ch:N.from<i.ch))return Ua(t,i,r);var V=function(tt,ot){return Fa(t,tt instanceof Ke?tt.ch:tt,ot)},$,J=function(tt){return e.options.lineWrapping?($=$||Xi(e,t),po(e,t,$,tt)):{begin:0,end:t.text.length}},ue=J(i.sticky=="before"?V(i,-1):i.ch);if(e.doc.direction=="rtl"||N.level==1){var he=N.level==1==r<0,Te=V(i,he?1:-1);if(Te!=null&&(he?Te<=N.to&&Te<=ue.end:Te>=N.from&&Te>=ue.begin)){var Se=he?"before":"after";return new Ke(i.line,Te,Se)}}var Ne=function(tt,ot,rt){for(var dt=function(Xt,dr){return dr?new Ke(i.line,V(Xt,1),"before"):new Ke(i.line,Xt,"after")};tt>=0&&tt<n.length;tt+=ot){var bt=n[tt],gt=ot>0==(bt.level!=1),At=gt?rt.begin:V(rt.end,-1);if(bt.from<=At&&At<bt.to)return dt(At,gt);if(At=gt?bt.from:V(bt.to,-1),rt.begin<=At&&At<rt.end)return dt(At,gt)}},ze=Ne(S+r,r,ue);if(ze)return ze;var Ye=r>0?ue.end:V(ue.begin,-1);return Ye!=null&&!(r>0&&Ye==t.text.length)&&(ze=Ne(r>0?0:n.length-1,r,J(Ye)),ze)?ze:null}var Mn={selectAll:$o,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),Le)},killLine:function(e){return on(e,function(t){if(t.empty()){var i=pt(e.doc,t.head.line).text.length;return t.head.ch==i&&t.head.line<e.lastLine()?{from:t.head,to:Ke(t.head.line+1,0)}:{from:t.head,to:Ke(t.head.line,i)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return on(e,function(t){return{from:Ke(t.from().line,0),to:s(e.doc,Ke(t.to().line+1,0))}})},delLineLeft:function(e){return on(e,function(t){return{from:Ke(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return on(e,function(t){var i=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:i},"div");return{from:r,to:t.from()}})},delWrappedLineRight:function(e){return on(e,function(t){var i=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:i},"div");return{from:t.from(),to:r}})},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(Ke(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(Ke(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return cs(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return fs(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return Il(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var i=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:i},"div")},de)},goLineLeft:function(e){return e.extendSelectionsBy(function(t){var i=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:i},"div")},de)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var i=e.cursorCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:i},"div");return r.ch<e.getLine(r.line).search(/\S/)?fs(e,t.head):r},de)},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=[],i=e.listSelections(),r=e.options.tabSize,n=0;n<i.length;n++){var S=i[n].from(),N=q(e.getLine(S.line),S.ch,r);t.push(re(r-N%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return Rr(e,function(){for(var t=e.listSelections(),i=[],r=0;r<t.length;r++){if(!t[r].empty())continue;var n=t[r].head,S=pt(e.doc,n.line).text;if(S){if(n.ch==S.length&&(n=new Ke(n.line,n.ch-1)),n.ch>0)n=new Ke(n.line,n.ch+1),e.replaceRange(S.charAt(n.ch-1)+S.charAt(n.ch-2),Ke(n.line,n.ch-2),n,"+transpose");else if(n.line>e.doc.first){var N=pt(e.doc,n.line-1).text;N&&(n=new Ke(n.line,1),e.replaceRange(S.charAt(0)+e.doc.lineSeparator()+N.charAt(N.length-1),Ke(n.line-1,N.length-1),n,"+transpose"))}}i.push(new jt(n,n))}e.setSelections(i)})},newlineAndIndent:function(e){return Rr(e,function(){for(var t=e.listSelections(),i=t.length-1;i>=0;i--)e.replaceRange(e.doc.lineSeparator(),t[i].anchor,t[i].head,"+input");t=e.listSelections();for(var r=0;r<t.length;r++)e.indentLine(t[r].from().line,null,!0);Ji(e)})},openLine:function(e){return e.replaceSelection(`
|
|
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function cs(e,t){var i=pt(e.doc,t),r=Sr(i);return r!=i&&(t=Dt(r)),ja(!0,e,r,t,1)}function Il(e,t){var i=pt(e.doc,t),r=zi(i);return r!=i&&(t=Dt(r)),ja(!0,e,i,t,-1)}function fs(e,t){var i=cs(e,t.line),r=pt(e.doc,i.line),n=Xe(r,e.doc.direction);if(!n||n[0].level==0){var S=Math.max(i.ch,r.text.search(/\S/)),N=t.line==i.line&&t.ch<=S&&t.ch;return Ke(i.line,N?0:S,i.sticky)}return i}function aa(e,t,i){if(typeof t=="string"&&(t=Mn[t],!t))return!1;e.display.input.ensurePolled();var r=e.display.shift,n=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),i&&(e.display.shift=!1),n=t(e)!=Be}finally{e.display.shift=r,e.state.suppressEdits=!1}return n}function Nl(e,t,i){for(var r=0;r<e.state.keyMaps.length;r++){var n=an(t,e.state.keyMaps[r],i,e);if(n)return n}return e.options.extraKeys&&an(t,e.options.extraKeys,i,e)||an(t,e.options.keyMap,i,e)}var Bl=new le;function In(e,t,i,r){var n=e.state.keySeq;if(n){if(us(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Bl.set(50,function(){e.state.keySeq==n&&(e.state.keySeq=null,e.display.input.reset())}),ps(e,n+" "+t,i,r))return!0}return ps(e,t,i,r)}function ps(e,t,i,r){var n=Nl(e,t,r);return n=="multi"&&(e.state.keySeq=t),n=="handled"&&pr(e,"keyHandled",e,t,i),(n=="handled"||n=="multi")&&(ee(i),Ca(e)),!!n}function ms(e,t){var i=hs(t,!0);return i?t.shiftKey&&!e.state.keySeq?In(e,"Shift-"+i,t,function(r){return aa(e,r,!0)})||In(e,i,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return aa(e,r)}):In(e,i,t,function(r){return aa(e,r)}):!1}function Fl(e,t,i){return In(e,"'"+i+"'",t,function(r){return aa(e,r,!0)})}var Wa=null;function gs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=M(),Ge(t,e))return;H&&U<11&&e.keyCode==27&&(e.returnValue=!1);var i=e.keyCode;t.display.shift=i==16||e.shiftKey;var r=ms(t,e);w&&(Wa=r?i:null,!r&&i==88&&!zt&&(l?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),k&&!l&&!r&&i==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),i==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Ul(t)}function Ul(e){var t=e.display.lineDiv;G(t,"CodeMirror-crosshair");function i(r){(r.keyCode==18||!r.altKey)&&(g(t,"CodeMirror-crosshair"),it(document,"keyup",i),it(document,"mouseover",i))}ke(document,"keyup",i),ke(document,"mouseover",i)}function vs(e){e.keyCode==16&&(this.doc.sel.shift=!1),Ge(this,e)}function ys(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(fi(t.display,e)||Ge(t,e)||e.ctrlKey&&!e.altKey||l&&e.metaKey)return;var i=e.keyCode,r=e.charCode;if(w&&i==Wa){Wa=null,ee(e);return}if(w&&(!e.which||e.which<10)&&ms(t,e))return;var n=String.fromCharCode(r==null?i:r);if(n=="\b")return;if(Fl(t,e,n))return;t.display.input.onKeyPress(e)}var jl=400,Ha=function(e,t,i){this.time=e,this.pos=t,this.button=i};Ha.prototype.compare=function(e,t,i){return this.time+jl>e&&St(t,this.pos)==0&&i==this.button};var Nn,Bn;function Wl(e,t){var i=+new Date;return Bn&&Bn.compare(i,e,t)?(Nn=Bn=null,"triple"):Nn&&Nn.compare(i,e,t)?(Bn=new Ha(i,e,t),Nn=null,"double"):(Nn=new Ha(i,e,t),Bn=null,"single")}function bs(e){var t=this,i=t.display;if(Ge(t,e)||i.activeTouch&&i.input.supportsTouch())return;if(i.input.ensurePolled(),i.shift=e.shiftKey,fi(i,e)){O||(i.scroller.draggable=!1,setTimeout(function(){return i.scroller.draggable=!0},100));return}if(Ga(t,e))return;var r=Mi(t,e),n=xe(e),S=r?Wl(r,n):"single";if(window.focus(),n==1&&t.state.selectingText&&t.state.selectingText(e),r&&Hl(t,n,r,S,e))return;n==1?r?zl(t,r,S,e):Ce(e)==i.scroller&&ee(e):n==2?(r&&qn(t.doc,r),setTimeout(function(){return i.input.focus()},20)):n==3&&(D?t.display.input.onContextMenu(e):xo(t))}function Hl(e,t,i,r,n){var S="Click";return r=="double"?S="Double"+S:r=="triple"&&(S="Triple"+S),S=(t==1?"Left":t==2?"Middle":"Right")+S,In(e,ds(S,n),n,function(N){if(typeof N=="string"&&(N=Mn[N]),!N)return!1;var V=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),V=N(e,i)!=Be}finally{e.state.suppressEdits=!1}return V})}function Gl(e,t,i){var r=e.getOption("configureMouse"),n=r?r(e,t,i):{};if(n.unit==null){var S=h?i.shiftKey&&i.metaKey:i.altKey;n.unit=S?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(n.extend==null||e.doc.extend)&&(n.extend=e.doc.extend||i.shiftKey),n.addNew==null&&(n.addNew=l?i.metaKey:i.ctrlKey),n.moveOnDrag==null&&(n.moveOnDrag=!(l?i.altKey:i.ctrlKey)),n}function zl(e,t,i,r){H?setTimeout(z(bo,e),0):e.curOp.focus=M();var n=Gl(e,i,r),S=e.doc.sel,N;e.options.dragDrop&&je&&!e.isReadOnly()&&i=="single"&&(N=S.contains(t))>-1&&(St((N=S.ranges[N]).from(),t)<0||t.xRel>0)&&(St(N.to(),t)>0||t.xRel<0)?Kl(e,r,t,n):Vl(e,r,t,n)}function Kl(e,t,i,r){var n=e.display,S=!1,N=lr(e,function(J){O&&(n.scroller.draggable=!1),e.state.draggingText=!1,it(n.wrapper.ownerDocument,"mouseup",N),it(n.wrapper.ownerDocument,"mousemove",V),it(n.scroller,"dragstart",$),it(n.scroller,"drop",N),S||(ee(J),r.addNew||qn(e.doc,i,null,null,r.extend),O&&!_||H&&U==9?setTimeout(function(){n.wrapper.ownerDocument.body.focus({preventScroll:!0}),n.input.focus()},20):n.input.focus())}),V=function(J){S=S||Math.abs(t.clientX-J.clientX)+Math.abs(t.clientY-J.clientY)>=10},$=function(){return S=!0};O&&(n.scroller.draggable=!0),e.state.draggingText=N,N.copy=!r.moveOnDrag,n.scroller.dragDrop&&n.scroller.dragDrop(),ke(n.wrapper.ownerDocument,"mouseup",N),ke(n.wrapper.ownerDocument,"mousemove",V),ke(n.scroller,"dragstart",$),ke(n.scroller,"drop",N),xo(e),setTimeout(function(){return n.input.focus()},20)}function xs(e,t,i){if(i=="char")return new jt(t,t);if(i=="word")return e.findWordAt(t);if(i=="line")return new jt(Ke(t.line,0),s(e.doc,Ke(t.line+1,0)));var r=i(e,t);return new jt(r.from,r.to)}function Vl(e,t,i,r){var n=e.display,S=e.doc;ee(t);var N,V,$=S.sel,J=$.ranges;if(r.addNew&&!r.extend?(V=S.sel.contains(i),V>-1?N=J[V]:N=new jt(i,i)):(N=S.sel.primary(),V=S.sel.primIndex),r.unit=="rectangle")r.addNew||(N=new jt(i,i)),i=Mi(e,t,!0,!0),V=-1;else{var ue=xs(e,i,r.unit);r.extend?N=Na(N,ue.anchor,ue.head,r.extend):N=ue}r.addNew?V==-1?(V=J.length,gr(S,Qr(e,J.concat([N]),V),{scroll:!1,origin:"*mouse"})):J.length>1&&J[V].empty()&&r.unit=="char"&&!r.extend?(gr(S,Qr(e,J.slice(0,V).concat(J.slice(V+1)),0),{scroll:!1,origin:"*mouse"}),$=S.sel):Ba(S,V,N,De):(V=0,gr(S,new jr([N],0),De),$=S.sel);var he=i;function Te(rt){if(St(he,rt)==0)return;if(he=rt,r.unit=="rectangle"){for(var dt=[],bt=e.options.tabSize,gt=q(pt(S,i.line).text,i.ch,bt),At=q(pt(S,rt.line).text,rt.ch,bt),Xt=Math.min(gt,At),dr=Math.max(gt,At),$t=Math.min(i.line,rt.line),Or=Math.min(e.lastLine(),Math.max(i.line,rt.line));$t<=Or;$t++){var Ar=pt(S,$t).text,rr=pe(Ar,Xt,bt);Xt==dr?dt.push(new jt(Ke($t,rr),Ke($t,rr))):Ar.length>rr&&dt.push(new jt(Ke($t,rr),Ke($t,pe(Ar,dr,bt))))}dt.length||dt.push(new jt(i,i)),gr(S,Qr(e,$.ranges.slice(0,V).concat(dt),V),{origin:"*mouse",scroll:!1}),e.scrollIntoView(rt)}else{var Lr=N,mr=xs(e,rt,r.unit),or=Lr.anchor,ir;St(mr.anchor,or)>0?(ir=mr.head,or=Di(Lr.from(),mr.anchor)):(ir=mr.anchor,or=hi(Lr.to(),mr.head));var Jt=$.ranges.slice(0);Jt[V]=Xl(e,new jt(s(S,or),ir)),gr(S,Qr(e,Jt,V),De)}}var Se=n.wrapper.getBoundingClientRect(),Ne=0;function ze(rt){var dt=++Ne,bt=Mi(e,rt,!0,r.unit=="rectangle");if(!bt)return;if(St(bt,he)!=0){e.curOp.focus=M(),Te(bt);var gt=Xn(n,S);(bt.line>=gt.to||bt.line<gt.from)&&setTimeout(lr(e,function(){Ne==dt&&ze(rt)}),150)}else{var At=rt.clientY<Se.top?-20:rt.clientY>Se.bottom?20:0;At&&setTimeout(lr(e,function(){if(Ne!=dt)return;n.scroller.scrollTop+=At,ze(rt)}),50)}}function Ye(rt){e.state.selectingText=!1,Ne=Infinity,rt&&(ee(rt),n.input.focus()),it(n.wrapper.ownerDocument,"mousemove",tt),it(n.wrapper.ownerDocument,"mouseup",ot),S.history.lastSelOrigin=null}var tt=lr(e,function(rt){rt.buttons===0||!xe(rt)?Ye(rt):ze(rt)}),ot=lr(e,Ye);e.state.selectingText=ot,ke(n.wrapper.ownerDocument,"mousemove",tt),ke(n.wrapper.ownerDocument,"mouseup",ot)}function Xl(e,t){var i=t.anchor,r=t.head,n=pt(e.doc,i.line);if(St(i,r)==0&&i.sticky==r.sticky)return t;var S=Xe(n);if(!S)return t;var N=$e(S,i.ch,i.sticky),V=S[N];if(V.from!=i.ch&&V.to!=i.ch)return t;var $=N+(V.from==i.ch==(V.level!=1)?0:1);if($==0||$==S.length)return t;var J;if(r.line!=i.line)J=(r.line-i.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var ue=$e(S,r.ch,r.sticky),he=ue-N||(r.ch-i.ch)*(V.level==1?-1:1);ue==$-1||ue==$?J=he<0:J=he>0}var Te=S[$+(J?-1:0)],Se=J==(Te.level==1),Ne=Se?Te.from:Te.to,ze=Se?"after":"before";return i.ch==Ne&&i.sticky==ze?t:new jt(new Ke(i.line,Ne,ze),r)}function Es(e,t,i,r){var n,S;if(t.touches)n=t.touches[0].clientX,S=t.touches[0].clientY;else try{n=t.clientX,S=t.clientY}catch(Te){return!1}if(n>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&ee(t);var N=e.display,V=N.lineDiv.getBoundingClientRect();if(S>V.bottom||!ce(e,i))return ie(t);S-=V.top-N.viewOffset;for(var $=0;$<e.display.gutterSpecs.length;++$){var J=N.gutters.childNodes[$];if(J&&J.getBoundingClientRect().right>=n){var ue=Mr(e.doc,S),he=e.display.gutterSpecs[$];return Me(e,i,e,ue,he.className,t),ie(t)}}}function Ga(e,t){return Es(e,t,"gutterClick",!0)}function Ss(e,t){if(fi(e.display,t)||Yl(e,t))return;if(Ge(e,t,"contextmenu"))return;D||e.display.input.onContextMenu(t)}function Yl(e,t){return ce(e,"gutterContextMenu")?Es(e,t,"gutterContextMenu",!1):!1}function Cs(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),vn(e)}var sn={toString:function(){return"CodeMirror.Init"}},Ts={},oa={};function $l(e){var t=e.optionHandlers;function i(r,n,S,N){e.defaults[r]=n,S&&(t[r]=N?function(V,$,J){J!=sn&&S(V,$,J)}:S)}e.defineOption=i,e.Init=sn,i("value","",function(r,n){return r.setValue(n)},!0),i("mode",null,function(r,n){r.doc.modeOption=n,Pa(r)},!0),i("indentUnit",2,Pa,!0),i("indentWithTabs",!1),i("smartIndent",!0),i("tabSize",4,function(r){wn(r),vn(r),Tr(r)},!0),i("lineSeparator",null,function(r,n){if(r.doc.lineSep=n,!n)return;var S=[],N=r.doc.first;r.doc.iter(function($){for(var J=0;;){var ue=$.text.indexOf(n,J);if(ue==-1)break;J=ue+n.length,S.push(Ke(N,ue))}N++});for(var V=S.length-1;V>=0;V--)rn(r.doc,n,S[V],Ke(S[V].line,S[V].ch+n.length))}),i("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(r,n,S){r.state.specialChars=new RegExp(n.source+(n.test(" ")?"":"| "),"g"),S!=sn&&r.refresh()}),i("specialCharPlaceholder",Bt,function(r){return r.refresh()},!0),i("electricChars",!0),i("inputStyle",o?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),i("spellcheck",!1,function(r,n){return r.getInputField().spellcheck=n},!0),i("autocorrect",!1,function(r,n){return r.getInputField().autocorrect=n},!0),i("autocapitalize",!1,function(r,n){return r.getInputField().autocapitalize=n},!0),i("rtlMoveVisually",!T),i("wholeLineUpdateBefore",!0),i("theme","default",function(r){Cs(r),Tn(r)},!0),i("keyMap","default",function(r,n,S){var N=na(n),V=S!=sn&&na(S);V&&V.detach&&V.detach(r,N),N.attach&&N.attach(r,V||null)}),i("extraKeys",null),i("configureMouse",null),i("lineWrapping",!1,Jl,!0),i("gutters",[],function(r,n){r.display.gutterSpecs=Ra(n,r.options.lineNumbers),Tn(r)},!0),i("fixedGutter",!0,function(r,n){r.display.gutters.style.left=n?Ea(r.display)+"px":"0",r.refresh()},!0),i("coverGutterNextToScrollbar",!1,function(r){return Qi(r)},!0),i("scrollbarStyle","native",function(r){Ao(r),Qi(r),r.display.scrollbars.setScrollTop(r.doc.scrollTop),r.display.scrollbars.setScrollLeft(r.doc.scrollLeft)},!0),i("lineNumbers",!1,function(r,n){r.display.gutterSpecs=Ra(r.options.gutters,n),Tn(r)},!0),i("firstLineNumber",1,Tn,!0),i("lineNumberFormatter",function(r){return r},Tn,!0),i("showCursorWhenSelecting",!1,yn,!0),i("resetSelectionOnContextMenu",!0),i("lineWiseCopyCut",!0),i("pasteLinesPerSelection",!0),i("selectionsMayTouch",!1),i("readOnly",!1,function(r,n){n=="nocursor"&&(Zi(r),r.display.input.blur()),r.display.input.readOnlyChanged(n)}),i("screenReaderLabel",null,function(r,n){n=n===""?null:n,r.display.input.screenReaderLabelChanged(n)}),i("disableInput",!1,function(r,n){n||r.display.input.reset()},!0),i("dragDrop",!0,Zl),i("allowDropFileTypes",null),i("cursorBlinkRate",530),i("cursorScrollMargin",0),i("cursorHeight",1,yn,!0),i("singleCursorHeightPerLine",!0,yn,!0),i("workTime",100),i("workDelay",100),i("flattenSpans",!0,wn,!0),i("addModeClass",!1,wn,!0),i("pollInterval",100),i("undoDepth",200,function(r,n){return r.doc.history.undoDepth=n}),i("historyEventDelay",1250),i("viewportMargin",10,function(r){return r.refresh()},!0),i("maxHighlightLength",1e4,wn,!0),i("moveInputWithCursor",!0,function(r,n){n||r.display.input.resetPosition()}),i("tabindex",null,function(r,n){return r.display.input.getField().tabIndex=n||""}),i("autofocus",null),i("direction","ltr",function(r,n){return r.doc.setDirection(n)},!0),i("phrases",null)}function Zl(e,t,i){var r=i&&i!=sn;if(!t!=!r){var n=e.display.dragFunctions,S=t?ke:it;S(e.display.scroller,"dragstart",n.start),S(e.display.scroller,"dragenter",n.enter),S(e.display.scroller,"dragover",n.over),S(e.display.scroller,"dragleave",n.leave),S(e.display.scroller,"drop",n.drop)}}function Jl(e){e.options.lineWrapping?(G(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(g(e.display.wrapper,"CodeMirror-wrap"),jn(e)),Sa(e),Tr(e),vn(e),setTimeout(function(){return Qi(e)},100)}function Yt(e,t){var i=this;if(!(this instanceof Yt))return new Yt(e,t);this.options=t=t?j(t):{},j(Ts,t,!1);var r=t.value;typeof r=="string"?r=new wr(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var n=new Yt.inputStyles[t.inputStyle](this),S=this.display=new dl(e,r,n,t);S.wrapper.CodeMirror=this,Cs(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Ao(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 le,keySeq:null,specialChars:null},t.autofocus&&!o&&S.input.focus(),H&&U<11&&setTimeout(function(){return i.display.input.reset(!0)},20),Ql(this),kl(),Fi(this),this.curOp.forceUpdate=!0,No(this,r),t.autofocus&&!o||this.hasFocus()?setTimeout(function(){i.hasFocus()&&!i.state.focused&&Ta(i)},20):Zi(this);for(var N in oa)oa.hasOwnProperty(N)&&oa[N](this,t[N],sn);ko(this),t.finishInit&&t.finishInit(this);for(var V=0;V<za.length;++V)za[V](this);Ui(this),O&&t.lineWrapping&&getComputedStyle(S.lineDiv).textRendering=="optimizelegibility"&&(S.lineDiv.style.textRendering="auto")}Yt.defaults=Ts,Yt.optionHandlers=oa;function Ql(e){var t=e.display;ke(t.scroller,"mousedown",lr(e,bs)),H&&U<11?ke(t.scroller,"dblclick",lr(e,function($){if(Ge(e,$))return;var J=Mi(e,$);if(!J||Ga(e,$)||fi(e.display,$))return;ee($);var ue=e.findWordAt(J);qn(e.doc,ue.anchor,ue.head)})):ke(t.scroller,"dblclick",function($){return Ge(e,$)||ee($)}),ke(t.scroller,"contextmenu",function($){return Ss(e,$)}),ke(t.input.getField(),"contextmenu",function($){t.scroller.contains($.target)||Ss(e,$)});var i,r={end:0};function n(){t.activeTouch&&(i=setTimeout(function(){return t.activeTouch=null},1e3),r=t.activeTouch,r.end=+new Date)}function S($){if($.touches.length!=1)return!1;var J=$.touches[0];return J.radiusX<=1&&J.radiusY<=1}function N($,J){if(J.left==null)return!0;var ue=J.left-$.left,he=J.top-$.top;return ue*ue+he*he>20*20}ke(t.scroller,"touchstart",function($){if(!Ge(e,$)&&!S($)&&!Ga(e,$)){t.input.ensurePolled(),clearTimeout(i);var J=+new Date;t.activeTouch={start:J,moved:!1,prev:J-r.end<=300?r:null},$.touches.length==1&&(t.activeTouch.left=$.touches[0].pageX,t.activeTouch.top=$.touches[0].pageY)}}),ke(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),ke(t.scroller,"touchend",function($){var J=t.activeTouch;if(J&&!fi(t,$)&&J.left!=null&&!J.moved&&new Date-J.start<300){var ue=e.coordsChar(t.activeTouch,"page"),he;!J.prev||N(J,J.prev)?he=new jt(ue,ue):!J.prev.prev||N(J,J.prev.prev)?he=e.findWordAt(ue):he=new jt(Ke(ue.line,0),s(e.doc,Ke(ue.line+1,0))),e.setSelection(he.anchor,he.head),e.focus(),ee($)}n()}),ke(t.scroller,"touchcancel",n),ke(t.scroller,"scroll",function(){t.scroller.clientHeight&&(xn(e,t.scroller.scrollTop),Ni(e,t.scroller.scrollLeft,!0),Me(e,"scroll",e))}),ke(t.scroller,"mousewheel",function($){return Oo(e,$)}),ke(t.scroller,"DOMMouseScroll",function($){return Oo(e,$)}),ke(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function($){Ge(e,$)||se($)},over:function($){Ge(e,$)||(Dl(e,$),se($))},start:function($){return Ll(e,$)},drop:lr(e,Al),leave:function($){Ge(e,$)||os(e)}};var V=t.input.getField();ke(V,"keyup",function($){return vs.call(e,$)}),ke(V,"keydown",lr(e,gs)),ke(V,"keypress",lr(e,ys)),ke(V,"focus",function($){return Ta(e,$)}),ke(V,"blur",function($){return Zi(e,$)})}var za=[];Yt.defineInitHook=function(e){return za.push(e)};function Fn(e,t,i,r){var n=e.doc,S;i==null&&(i="add"),i=="smart"&&(n.mode.indent?S=qe(e,t).state:i="prev");var N=e.options.tabSize,V=pt(n,t),$=q(V.text,null,N);V.stateAfter&&(V.stateAfter=null);var J=V.text.match(/^\s*/)[0],ue;if(!r&&!/\S/.test(V.text))ue=0,i="not";else if(i=="smart"&&(ue=n.mode.indent(S,V.text.slice(J.length),V.text),ue==Be||ue>150)){if(!r)return;i="prev"}i=="prev"?t>n.first?ue=q(pt(n,t-1).text,null,N):ue=0:i=="add"?ue=$+e.options.indentUnit:i=="subtract"?ue=$-e.options.indentUnit:typeof i=="number"&&(ue=$+i),ue=Math.max(0,ue);var he="",Te=0;if(e.options.indentWithTabs)for(var Se=Math.floor(ue/N);Se;--Se)Te+=N,he+=" ";if(Te<ue&&(he+=re(ue-Te)),he!=J)return rn(n,he,Ke(t,0),Ke(t,J.length),"+input"),V.stateAfter=null,!0;for(var Ne=0;Ne<n.sel.ranges.length;Ne++){var ze=n.sel.ranges[Ne];if(ze.head.line==t&&ze.head.ch<J.length){var Ye=Ke(t,J.length);Ba(n,Ne,new jt(Ye,Ye));break}}}var qr=null;function sa(e){qr=e}function Ka(e,t,i,r,n){var S=e.doc;e.display.shift=!1,r||(r=S.sel);var N=+new Date-200,V=n=="paste"||e.state.pasteIncoming>N,$=Et(t),J=null;if(V&&r.ranges.length>1)if(qr&&qr.text.join(`
|
|
`)==t){if(r.ranges.length%qr.text.length==0){J=[];for(var ue=0;ue<qr.text.length;ue++)J.push(S.splitLines(qr.text[ue]))}}else $.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(J=ve($,function(tt){return[tt]}));for(var he=e.curOp.updateInput,Te=r.ranges.length-1;Te>=0;Te--){var Se=r.ranges[Te],Ne=Se.from(),ze=Se.to();Se.empty()&&(i&&i>0?Ne=Ke(Ne.line,Ne.ch-i):e.state.overwrite&&!V?ze=Ke(ze.line,Math.min(pt(S,ze.line).text.length,ze.ch+we($).length)):V&&qr&&qr.lineWise&&qr.text.join(`
|
|
`)==$.join(`
|
|
`)&&(Ne=ze=Ke(Ne.line,0)));var Ye={from:Ne,to:ze,text:J?J[Te%J.length]:$,origin:n||(V?"paste":e.state.cutIncoming>N?"cut":"+input")};tn(e.doc,Ye),pr(e,"inputRead",e,Ye)}t&&!V&&As(e,t),Ji(e),e.curOp.updateInput<2&&(e.curOp.updateInput=he),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function ws(e,t){var i=e.clipboardData&&e.clipboardData.getData("Text");if(i)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&Rr(t,function(){return Ka(t,i,0,null,"paste")}),!0}function As(e,t){if(!e.options.electricChars||!e.options.smartIndent)return;for(var i=e.doc.sel,r=i.ranges.length-1;r>=0;r--){var n=i.ranges[r];if(n.head.ch>100||r&&i.ranges[r-1].head.line==n.head.line)continue;var S=e.getModeAt(n.head),N=!1;if(S.electricChars){for(var V=0;V<S.electricChars.length;V++)if(t.indexOf(S.electricChars.charAt(V))>-1){N=Fn(e,n.head.line,"smart");break}}else S.electricInput&&(S.electricInput.test(pt(e.doc,n.head.line).text.slice(0,n.head.ch))&&(N=Fn(e,n.head.line,"smart")));N&&pr(e,"electricInput",e,n.head.line)}}function Ls(e){for(var t=[],i=[],r=0;r<e.doc.sel.ranges.length;r++){var n=e.doc.sel.ranges[r].head.line,S={anchor:Ke(n,0),head:Ke(n+1,0)};i.push(S),t.push(e.getRange(S.anchor,S.head))}return{text:t,ranges:i}}function Ds(e,t,i,r){e.setAttribute("autocorrect",i?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function ks(){var e=a("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=a("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return O?e.style.width="1000px":e.setAttribute("wrap","off"),C&&(e.style.border="1px solid black"),Ds(e),t}function ql(e){var t=e.optionHandlers,i=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(r,n){var S=this.options,N=S[r];if(S[r]==n&&r!="mode")return;S[r]=n,t.hasOwnProperty(r)&&lr(this,t[r])(this,n,N),Me(this,"optionChange",this,r)},getOption:function(r){return this.options[r]},getDoc:function(){return this.doc},addKeyMap:function(r,n){this.state.keyMaps[n?"push":"unshift"](na(r))},removeKeyMap:function(r){for(var n=this.state.keyMaps,S=0;S<n.length;++S)if(n[S]==r||n[S].name==r)return n.splice(S,1),!0},addOverlay:yr(function(r,n){var S=r.token?r:e.getMode(this.options,r);if(S.startState)throw new Error("Overlays may not be stateful.");Re(this.state.overlays,{mode:S,modeSpec:r,opaque:n&&n.opaque,priority:n&&n.priority||0},function(N){return N.priority}),this.state.modeGen++,Tr(this)}),removeOverlay:yr(function(r){for(var n=this.state.overlays,S=0;S<n.length;++S){var N=n[S].modeSpec;if(N==r||typeof r=="string"&&N.name==r){n.splice(S,1),this.state.modeGen++,Tr(this);return}}}),indentLine:yr(function(r,n,S){typeof n!="string"&&typeof n!="number"&&(n==null?n=this.options.smartIndent?"smart":"prev":n=n?"add":"subtract"),Xr(this.doc,r)&&Fn(this,r,n,S)}),indentSelection:yr(function(r){for(var n=this.doc.sel.ranges,S=-1,N=0;N<n.length;N++){var V=n[N];if(V.empty())V.head.line>S&&(Fn(this,V.head.line,r,!0),S=V.head.line,N==this.doc.sel.primIndex&&Ji(this));else{var $=V.from(),J=V.to(),ue=Math.max(S,$.line);S=Math.min(this.lastLine(),J.line-(J.ch?0:1))+1;for(var he=ue;he<S;++he)Fn(this,he,r);var Te=this.doc.sel.ranges;$.ch==0&&n.length==Te.length&&Te[N].from().ch>0&&Ba(this.doc,N,new jt($,Te[N].to()),Le)}}}),getTokenAt:function(r,n){return Vt(this,r,n)},getLineTokens:function(r,n){return Vt(this,Ke(r),n,!0)},getTokenTypeAt:function(r){r=s(this.doc,r);var n=We(this,pt(this.doc,r.line)),S=0,N=(n.length-1)/2,V=r.ch,$;if(V==0)$=n[2];else for(;;){var J=S+N>>1;if((J?n[J*2-1]:0)>=V)N=J;else if(n[J*2+1]<V)S=J+1;else{$=n[J*2+2];break}}var ue=$?$.indexOf("overlay "):-1;return ue<0?$:ue==0?null:$.slice(0,ue-1)},getModeAt:function(r){var n=this.doc.mode;return n.innerMode?e.innerMode(n,this.getTokenAt(r).state).mode:n},getHelper:function(r,n){return this.getHelpers(r,n)[0]},getHelpers:function(r,n){var S=[];if(!i.hasOwnProperty(n))return S;var N=i[n],V=this.getModeAt(r);if(typeof V[n]=="string")N[V[n]]&&S.push(N[V[n]]);else if(V[n])for(var $=0;$<V[n].length;$++){var J=N[V[n][$]];J&&S.push(J)}else V.helperType&&N[V.helperType]?S.push(N[V.helperType]):N[V.name]&&S.push(N[V.name]);for(var ue=0;ue<N._global.length;ue++){var he=N._global[ue];he.pred(V,this)&&me(S,he.val)==-1&&S.push(he.val)}return S},getStateAfter:function(r,n){var S=this.doc;return r=W(S,r==null?S.first+S.size-1:r),qe(this,r+1,n).state},cursorCoords:function(r,n){var S,N=this.doc.sel.primary();return r==null?S=N.head:typeof r=="object"?S=s(this.doc,r):S=r?N.from():N.to(),Jr(this,S,n||"page")},charCoords:function(r,n){return ga(this,s(this.doc,r),n||"page")},coordsChar:function(r,n){return r=ho(this,r,n||"page"),ya(this,r.left,r.top)},lineAtHeight:function(r,n){return r=ho(this,{top:r,left:0},n||"page").top,Mr(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,n,S){var N=!1,V;if(typeof r=="number"){var $=this.doc.first+this.doc.size-1;r<this.doc.first?r=this.doc.first:r>$&&(r=$,N=!0),V=pt(this.doc,r)}else V=r;return Gn(this,V,{top:0,left:0},n||"page",S||N).top+(N?this.doc.height-Zr(V):0)},defaultTextHeight:function(){return Yi(this.display)},defaultCharWidth:function(){return $i(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,n,S,N,V){var $=this.display;r=Jr(this,s(this.doc,r));var J=r.bottom,ue=r.left;if(n.style.position="absolute",n.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(n),$.sizer.appendChild(n),N=="over")J=r.top;else if(N=="above"||N=="near"){var he=Math.max($.wrapper.clientHeight,this.doc.height),Te=Math.max($.sizer.clientWidth,$.lineSpace.clientWidth);(N=="above"||r.bottom+n.offsetHeight>he)&&r.top>n.offsetHeight?J=r.top-n.offsetHeight:r.bottom+n.offsetHeight<=he&&(J=r.bottom),ue+n.offsetWidth>Te&&(ue=Te-n.offsetWidth)}n.style.top=J+"px",n.style.left=n.style.right="",V=="right"?(ue=$.sizer.clientWidth-n.offsetWidth,n.style.right="0px"):(V=="left"?ue=0:V=="middle"&&(ue=($.sizer.clientWidth-n.offsetWidth)/2),n.style.left=ue+"px"),S&&Zs(this,{left:ue,top:J,right:ue+n.offsetWidth,bottom:J+n.offsetHeight})},triggerOnKeyDown:yr(gs),triggerOnKeyPress:yr(ys),triggerOnKeyUp:vs,triggerOnMouseDown:yr(bs),execCommand:function(r){if(Mn.hasOwnProperty(r))return Mn[r].call(null,this)},triggerElectric:yr(function(r){As(this,r)}),findPosH:function(r,n,S,N){var V=1;n<0&&(V=-1,n=-n);for(var $=s(this.doc,r),J=0;J<n&&!($=Va(this.doc,$,V,S,N),$.hitSide);++J);return $},moveH:yr(function(r,n){var S=this;this.extendSelectionsBy(function(N){return S.display.shift||S.doc.extend||N.empty()?Va(S.doc,N.head,r,n,S.options.rtlMoveVisually):r<0?N.from():N.to()},de)}),deleteH:yr(function(r,n){var S=this.doc.sel,N=this.doc;S.somethingSelected()?N.replaceSelection("",null,"+delete"):on(this,function(V){var $=Va(N,V.head,r,n,!1);return r<0?{from:$,to:V.head}:{from:V.head,to:$}})}),findPosV:function(r,n,S,N){var V=1,$=N;n<0&&(V=-1,n=-n);for(var J=s(this.doc,r),ue=0;ue<n;++ue){var he=Jr(this,J,"div");if($==null?$=he.left:he.left=$,J=_s(this,he,V,S),J.hitSide)break}return J},moveV:yr(function(r,n){var S=this,N=this.doc,V=[],$=!this.display.shift&&!N.extend&&N.sel.somethingSelected();if(N.extendSelectionsBy(function(ue){if($)return r<0?ue.from():ue.to();var he=Jr(S,ue.head,"div");ue.goalColumn!=null&&(he.left=ue.goalColumn),V.push(he.left);var Te=_s(S,he,r,n);return n=="page"&&ue==N.sel.primary()&&Aa(S,ga(S,Te,"div").top-he.top),Te},de),V.length)for(var J=0;J<N.sel.ranges.length;J++)N.sel.ranges[J].goalColumn=V[J]}),findWordAt:function(r){var n=this.doc,S=pt(n,r.line).text,N=r.ch,V=r.ch;if(S){var $=this.getHelper(r,"wordChars");(r.sticky=="before"||V==S.length)&&N?--N:++V;for(var J=S.charAt(N),ue=Ie(J,$)?function(he){return Ie(he,$)}:/\s/.test(J)?function(he){return/\s/.test(he)}:function(he){return!/\s/.test(he)&&!Ie(he)};N>0&&ue(S.charAt(N-1));)--N;for(;V<S.length&&ue(S.charAt(V));)++V}return new jt(Ke(r.line,N),Ke(r.line,V))},toggleOverwrite:function(r){if(r!=null&&r==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?G(this.display.cursorDiv,"CodeMirror-overwrite"):g(this.display.cursorDiv,"CodeMirror-overwrite"),Me(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==M()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:yr(function(r,n){bn(this,r,n)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-ri(this)-this.display.barHeight,width:r.scrollWidth-ri(this)-this.display.barWidth,clientHeight:fa(this),clientWidth:Oi(this)}},scrollIntoView:yr(function(r,n){r==null?(r={from:this.doc.sel.primary().head,to:null},n==null&&(n=this.options.cursorScrollMargin)):typeof r=="number"?r={from:Ke(r,0),to:null}:r.from==null&&(r={from:r,to:null}),r.to||(r.to=r.from),r.margin=n||0,r.from.line!=null?Js(this,r):So(this,r.from,r.to,r.margin)}),setSize:yr(function(r,n){var S=this,N=function($){return typeof $=="number"||/^\d+$/.test(String($))?$+"px":$};r!=null&&(this.display.wrapper.style.width=N(r)),n!=null&&(this.display.wrapper.style.height=N(n)),this.options.lineWrapping&&so(this);var V=this.display.viewFrom;this.doc.iter(V,this.display.viewTo,function($){if($.widgets){for(var J=0;J<$.widgets.length;J++)if($.widgets[J].noHScroll){bi(S,V,"widget");break}}++V}),this.curOp.forceUpdate=!0,Me(this,"refresh",this)}),operation:function(r){return Rr(this,r)},startOperation:function(){return Fi(this)},endOperation:function(){return Ui(this)},refresh:yr(function(){var r=this.display.cachedTextHeight;Tr(this),this.curOp.forceUpdate=!0,vn(this),bn(this,this.doc.scrollLeft,this.doc.scrollTop),ka(this.display),(r==null||Math.abs(r-Yi(this.display))>.5||this.options.lineWrapping)&&Sa(this),Me(this,"refresh",this)}),swapDoc:yr(function(r){var n=this.doc;return n.cm=null,this.state.selectingText&&this.state.selectingText(),No(this,r),vn(this),this.display.input.reset(),bn(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,pr(this,"swapDoc",this,n),n}),phrase:function(r){var n=this.options.phrases;return n&&Object.prototype.hasOwnProperty.call(n,r)?n[r]:r},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}},ge(e),e.registerHelper=function(r,n,S){i.hasOwnProperty(r)||(i[r]=e[r]={_global:[]}),i[r][n]=S},e.registerGlobalHelper=function(r,n,S,N){e.registerHelper(r,n,N),i[r]._global.push({pred:S,val:N})}}function Va(e,t,i,r,n){var S=t,N=i,V=pt(e,t.line),$=n&&e.direction=="rtl"?-i:i;function J(){var ot=t.line+$;return ot<e.first||ot>=e.first+e.size?!1:(t=new Ke(ot,t.ch,t.sticky),V=pt(e,ot))}function ue(ot){var rt;if(r=="codepoint"){var dt=V.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(dt)?rt=null:rt=new Ke(t.line,Math.max(0,Math.min(V.text.length,t.ch+i*(dt>=55296&&dt<56320?2:1))),-i)}else n?rt=Ml(e.cm,V,t,i):rt=Ua(V,t,i);if(rt==null)if(!ot&&J())t=ja(n,e.cm,V,t.line,$);else return!1;else t=rt;return!0}if(r=="char"||r=="codepoint")ue();else if(r=="column")ue(!0);else if(r=="word"||r=="group")for(var he=null,Te=r=="group",Se=e.cm&&e.cm.getHelper(t,"wordChars"),Ne=!0;!(i<0&&!ue(!Ne));Ne=!1){var ze=V.text.charAt(t.ch)||`
|
|
`,Ye=Ie(ze,Se)?"w":Te&&ze==`
|
|
`?"n":!Te||/\s/.test(ze)?null:"p";if(Te&&!Ne&&!Ye&&(Ye="s"),he&&he!=Ye){i<0&&(i=1,ue(),t.sticky="after");break}if(Ye&&(he=Ye),i>0&&!ue(!Ne))break}var tt=ta(e,t,S,N,!0);return di(S,tt)&&(tt.hitSide=!0),tt}function _s(e,t,i,r){var n=e.doc,S=t.left,N;if(r=="page"){var V=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),$=Math.max(V-.5*Yi(e.display),3);N=(i>0?t.bottom:t.top)+i*$}else r=="line"&&(N=i>0?t.bottom+3:t.top-3);for(var J;!(J=ya(e,S,N),!J.outside);){if(i<0?N<=0:N>=n.height){J.hitSide=!0;break}N+=i*5}return J}var Gt=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new le,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};Gt.prototype.init=function(e){var t=this,i=this,r=i.cm,n=i.div=e.lineDiv;Ds(n,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function S(V){for(var $=V.target;$;$=$.parentNode){if($==n)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test($.className))break}return!1}ke(n,"paste",function(V){if(!S(V)||Ge(r,V)||ws(V,r))return;U<=11&&setTimeout(lr(r,function(){return t.updateFromDOM()}),20)}),ke(n,"compositionstart",function(V){t.composing={data:V.data,done:!1}}),ke(n,"compositionupdate",function(V){t.composing||(t.composing={data:V.data,done:!1})}),ke(n,"compositionend",function(V){t.composing&&(V.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),ke(n,"touchstart",function(){return i.forceCompositionEnd()}),ke(n,"input",function(){t.composing||t.readFromDOMSoon()});function N(V){if(!S(V)||Ge(r,V))return;if(r.somethingSelected())sa({lineWise:!1,text:r.getSelections()}),V.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var $=Ls(r);sa({lineWise:!0,text:$.text}),V.type=="cut"&&r.operation(function(){r.setSelections($.ranges,0,Le),r.replaceSelection("",null,"cut")})}else return;if(V.clipboardData){V.clipboardData.clearData();var J=qr.text.join(`
|
|
`);if(V.clipboardData.setData("Text",J),V.clipboardData.getData("Text")==J){V.preventDefault();return}}var ue=ks(),he=ue.firstChild;r.display.lineSpace.insertBefore(ue,r.display.lineSpace.firstChild),he.value=qr.text.join(`
|
|
`);var Te=document.activeElement;Q(he),setTimeout(function(){r.display.lineSpace.removeChild(ue),Te.focus(),Te==n&&i.showPrimarySelection()},50)}ke(n,"copy",N),ke(n,"cut",N)},Gt.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Gt.prototype.prepareSelection=function(){var e=vo(this.cm,!1);return e.focus=document.activeElement==this.div,e},Gt.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},Gt.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Gt.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,i=t.doc.sel.primary(),r=i.from(),n=i.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||n.line<t.display.viewFrom){e.removeAllRanges();return}var S=la(t,e.anchorNode,e.anchorOffset),N=la(t,e.focusNode,e.focusOffset);if(S&&!S.bad&&N&&!N.bad&&St(Di(S,N),r)==0&&St(hi(S,N),n)==0)return;var V=t.display.view,$=r.line>=t.display.viewFrom&&Rs(t,r)||{node:V[0].measure.map[2],offset:0},J=n.line<t.display.viewTo&&Rs(t,n);if(!J){var ue=V[V.length-1].measure,he=ue.maps?ue.maps[ue.maps.length-1]:ue.map;J={node:he[he.length-1],offset:he[he.length-2]-he[he.length-3]}}if(!$||!J){e.removeAllRanges();return}var Te=e.rangeCount&&e.getRangeAt(0),Se;try{Se=b($.node,$.offset,J.offset,J.node)}catch(Ne){}Se&&(!k&&t.state.focused?(e.collapse($.node,$.offset),Se.collapsed||(e.removeAllRanges(),e.addRange(Se))):(e.removeAllRanges(),e.addRange(Se)),Te&&e.anchorNode==null?e.addRange(Te):k&&this.startGracePeriod()),this.rememberSelection()},Gt.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)},Gt.prototype.showMultipleSelections=function(e){u(this.cm.display.cursorDiv,e.cursors),u(this.cm.display.selectionDiv,e.selection)},Gt.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},Gt.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return v(this.div,t)},Gt.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},Gt.prototype.blur=function(){this.div.blur()},Gt.prototype.getField=function(){return this.div},Gt.prototype.supportsTouch=function(){return!0},Gt.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():Rr(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)},Gt.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},Gt.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(d&&y&&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 i=la(t,e.anchorNode,e.anchorOffset),r=la(t,e.focusNode,e.focusOffset);i&&r&&Rr(t,function(){gr(t.doc,Ei(i,r),Le),(i.bad||r.bad)&&(t.curOp.selectionChanged=!0)})},Gt.prototype.pollContent=function(){this.readDOMTimeout!=null&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,t=e.display,i=e.doc.sel.primary(),r=i.from(),n=i.to();if(r.ch==0&&r.line>e.firstLine()&&(r=Ke(r.line-1,pt(e.doc,r.line-1).length)),n.ch==pt(e.doc,n.line).text.length&&n.line<e.lastLine()&&(n=Ke(n.line+1,0)),r.line<t.viewFrom||n.line>t.viewTo-1)return!1;var S,N,V;r.line==t.viewFrom||(S=Ii(e,r.line))==0?(N=Dt(t.view[0].line),V=t.view[0].node):(N=Dt(t.view[S].line),V=t.view[S-1].node.nextSibling);var $=Ii(e,n.line),J,ue;if($==t.view.length-1?(J=t.viewTo-1,ue=t.lineDiv.lastChild):(J=Dt(t.view[$+1].line)-1,ue=t.view[$+1].node.previousSibling),!V)return!1;for(var he=e.doc.splitLines(tu(e,V,ue,N,J)),Te=Pr(e.doc,Ke(N,0),Ke(J,pt(e.doc,J).text.length));he.length>1&&Te.length>1;)if(we(he)==we(Te))he.pop(),Te.pop(),J--;else if(he[0]==Te[0])he.shift(),Te.shift(),N++;else break;for(var Se=0,Ne=0,ze=he[0],Ye=Te[0],tt=Math.min(ze.length,Ye.length);Se<tt&&ze.charCodeAt(Se)==Ye.charCodeAt(Se);)++Se;for(var ot=we(he),rt=we(Te),dt=Math.min(ot.length-(he.length==1?Se:0),rt.length-(Te.length==1?Se:0));Ne<dt&&ot.charCodeAt(ot.length-Ne-1)==rt.charCodeAt(rt.length-Ne-1);)++Ne;if(he.length==1&&Te.length==1&&N==r.line)for(;Se&&Se>r.ch&&ot.charCodeAt(ot.length-Ne-1)==rt.charCodeAt(rt.length-Ne-1);)Se--,Ne++;he[he.length-1]=ot.slice(0,ot.length-Ne).replace(/^\u200b+/,""),he[0]=he[0].slice(Se).replace(/\u200b+$/,"");var bt=Ke(N,Se),gt=Ke(J,Te.length?we(Te).length-Ne:0);if(he.length>1||he[0]||St(bt,gt))return rn(e.doc,he,bt,gt,"+input"),!0},Gt.prototype.ensurePolled=function(){this.forceCompositionEnd()},Gt.prototype.reset=function(){this.forceCompositionEnd()},Gt.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},Gt.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)},Gt.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&Rr(this.cm,function(){return Tr(e.cm)})},Gt.prototype.setUneditable=function(e){e.contentEditable="false"},Gt.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||lr(this.cm,Ka)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},Gt.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},Gt.prototype.onContextMenu=function(){},Gt.prototype.resetPosition=function(){},Gt.prototype.needsContentAttribute=!0;function Rs(e,t){var i=pa(e,t.line);if(!i||i.hidden)return null;var r=pt(e.doc,t.line),n=ro(i,r,t.line),S=Xe(r,e.doc.direction),N="left";if(S){var V=$e(S,t.ch);N=V%2?"right":"left"}var $=ao(n.map,t.ch,N);return $.offset=$.collapse=="right"?$.end:$.start,$}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,i,r,n){var S="",N=!1,V=e.doc.lineSeparator(),$=!1;function J(Se){return function(Ne){return Ne.id==Se}}function ue(){N&&(S+=V,$&&(S+=V),N=$=!1)}function he(Se){Se&&(ue(),S+=Se)}function Te(Se){if(Se.nodeType==1){var Ne=Se.getAttribute("cm-text");if(Ne){he(Ne);return}var ze=Se.getAttribute("cm-marker"),Ye;if(ze){var tt=e.findMarks(Ke(r,0),Ke(n+1,0),J(+ze));tt.length&&(Ye=tt[0].find(0))&&he(Pr(e.doc,Ye.from,Ye.to).join(V));return}if(Se.getAttribute("contenteditable")=="false")return;var ot=/^(pre|div|p|li|table|br)$/i.test(Se.nodeName);if(!/^br$/i.test(Se.nodeName)&&Se.textContent.length==0)return;ot&&ue();for(var rt=0;rt<Se.childNodes.length;rt++)Te(Se.childNodes[rt]);/^(pre|p)$/i.test(Se.nodeName)&&($=!0),ot&&(N=!0)}else Se.nodeType==3&&he(Se.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(Te(t),t==i);)t=t.nextSibling,$=!1;return S}function la(e,t,i){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[i],!r)return ln(e.clipPos(Ke(e.display.viewTo-1)),!0);t=null,i=0}else for(r=t;;r=r.parentNode){if(!r||r==e.display.lineDiv)return null;if(r.parentNode&&r.parentNode==e.display.lineDiv)break}for(var n=0;n<e.display.view.length;n++){var S=e.display.view[n];if(S.node==r)return ru(S,t,i)}}function ru(e,t,i){var r=e.text.firstChild,n=!1;if(!t||!v(r,t))return ln(Ke(Dt(e.line),0),!0);if(t==r&&(n=!0,t=r.childNodes[i],i=0,!t)){var S=e.rest?we(e.rest):e.line;return ln(Ke(Dt(S),S.text.length),n)}var N=t.nodeType==3?t:null,V=t;for(!N&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(N=t.firstChild,i&&(i=N.nodeValue.length));V.parentNode!=r;)V=V.parentNode;var $=e.measure,J=$.maps;function ue(Ye,tt,ot){for(var rt=-1;rt<(J?J.length:0);rt++)for(var dt=rt<0?$.map:J[rt],bt=0;bt<dt.length;bt+=3){var gt=dt[bt+2];if(gt==Ye||gt==tt){var At=Dt(rt<0?e.line:e.rest[rt]),Xt=dt[bt]+ot;return(ot<0||gt!=Ye)&&(Xt=dt[bt+(ot?1:0)]),Ke(At,Xt)}}}var he=ue(N,V,i);if(he)return ln(he,n);for(var Te=V.nextSibling,Se=N?N.nodeValue.length-i:0;Te;Te=Te.nextSibling){if(he=ue(Te,Te.firstChild,0),he)return ln(Ke(he.line,he.ch-Se),n);Se+=Te.textContent.length}for(var Ne=V.previousSibling,ze=i;Ne;Ne=Ne.previousSibling){if(he=ue(Ne,Ne.firstChild,-1),he)return ln(Ke(he.line,he.ch+ze),n);ze+=Ne.textContent.length}}var qt=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new le,this.hasSelection=!1,this.composing=null};qt.prototype.init=function(e){var t=this,i=this,r=this.cm;this.createField(e);var n=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),C&&(n.style.width="0px"),ke(n,"input",function(){H&&U>=9&&t.hasSelection&&(t.hasSelection=null),i.poll()}),ke(n,"paste",function(N){if(Ge(r,N)||ws(N,r))return;r.state.pasteIncoming=+new Date,i.fastPoll()});function S(N){if(Ge(r,N))return;if(r.somethingSelected())sa({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var V=Ls(r);sa({lineWise:!0,text:V.text}),N.type=="cut"?r.setSelections(V.ranges,null,Le):(i.prevInput="",n.value=V.text.join(`
|
|
`),Q(n))}else return;N.type=="cut"&&(r.state.cutIncoming=+new Date)}ke(n,"cut",S),ke(n,"copy",S),ke(e.scroller,"paste",function(N){if(fi(e,N)||Ge(r,N))return;if(!n.dispatchEvent){r.state.pasteIncoming=+new Date,i.focus();return}var V=new Event("paste");V.clipboardData=N.clipboardData,n.dispatchEvent(V)}),ke(e.lineSpace,"selectstart",function(N){fi(e,N)||ee(N)}),ke(n,"compositionstart",function(){var N=r.getCursor("from");i.composing&&i.composing.range.clear(),i.composing={start:N,range:r.markText(N,r.getCursor("to"),{className:"CodeMirror-composing"})}}),ke(n,"compositionend",function(){i.composing&&(i.poll(),i.composing.range.clear(),i.composing=null)})},qt.prototype.createField=function(e){this.wrapper=ks(),this.textarea=this.wrapper.firstChild},qt.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},qt.prototype.prepareSelection=function(){var e=this.cm,t=e.display,i=e.doc,r=vo(e);if(e.options.moveInputWithCursor){var n=Jr(e,i.sel.primary().head,"div"),S=t.wrapper.getBoundingClientRect(),N=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,n.top+N.top-S.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,n.left+N.left-S.left))}return r},qt.prototype.showSelection=function(e){var t=this.cm,i=t.display;u(i.cursorDiv,e.cursors),u(i.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},qt.prototype.reset=function(e){if(this.contextMenuPending||this.composing)return;var t=this.cm;if(t.somethingSelected()){this.prevInput="";var i=t.getSelection();this.textarea.value=i,t.state.focused&&Q(this.textarea),H&&U>=9&&(this.hasSelection=i)}else e||(this.prevInput=this.textarea.value="",H&&U>=9&&(this.hasSelection=null))},qt.prototype.getField=function(){return this.textarea},qt.prototype.supportsTouch=function(){return!1},qt.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!o||M()!=this.textarea))try{this.textarea.focus()}catch(e){}},qt.prototype.blur=function(){this.textarea.blur()},qt.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},qt.prototype.receivedFocus=function(){this.slowPoll()},qt.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()})},qt.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function i(){var r=t.poll();!r&&!e?(e=!0,t.polling.set(60,i)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,i)},qt.prototype.poll=function(){var e=this,t=this.cm,i=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||ct(i)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var n=i.value;if(n==r&&!t.somethingSelected())return!1;if(H&&U>=9&&this.hasSelection===n||l&&/[\uf700-\uf7ff]/.test(n))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var S=n.charCodeAt(0);if(S==8203&&!r&&(r="\u200B"),S==8666)return this.reset(),this.cm.execCommand("undo")}for(var N=0,V=Math.min(r.length,n.length);N<V&&r.charCodeAt(N)==n.charCodeAt(N);)++N;return Rr(t,function(){Ka(t,n.slice(N),r.length-N,null,e.composing?"*compose":null),n.length>1e3||n.indexOf(`
|
|
`)>-1?i.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},qt.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},qt.prototype.onKeyPress=function(){H&&U>=9&&(this.hasSelection=null),this.fastPoll()},qt.prototype.onContextMenu=function(e){var t=this,i=t.cm,r=i.display,n=t.textarea;t.contextMenuPending&&t.contextMenuPending();var S=Mi(i,e),N=r.scroller.scrollTop;if(!S||w)return;var V=i.options.resetSelectionOnContextMenu;V&&i.doc.sel.contains(S)==-1&&lr(i,gr)(i.doc,Ei(S),Le);var $=n.style.cssText,J=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: `+(H?"rgba(255, 255, 255, .05)":"transparent")+`;
|
|
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var he;O&&(he=window.scrollY),r.input.focus(),O&&window.scrollTo(null,he),r.input.reset(),i.somethingSelected()||(n.value=t.prevInput=" "),t.contextMenuPending=Se,r.selForContextMenu=i.doc.sel,clearTimeout(r.detectingSelectAll);function Te(){if(n.selectionStart!=null){var ze=i.somethingSelected(),Ye="\u200B"+(ze?n.value:"");n.value="\u21DA",n.value=Ye,t.prevInput=ze?"":"\u200B",n.selectionStart=1,n.selectionEnd=Ye.length,r.selForContextMenu=i.doc.sel}}function Se(){if(t.contextMenuPending!=Se)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=J,n.style.cssText=$,H&&U<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=N),n.selectionStart!=null){(!H||H&&U<9)&&Te();var ze=0,Ye=function(){r.selForContextMenu==i.doc.sel&&n.selectionStart==0&&n.selectionEnd>0&&t.prevInput=="\u200B"?lr(i,$o)(i):ze++<10?r.detectingSelectAll=setTimeout(Ye,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(Ye,200)}}if(H&&U>=9&&Te(),D){se(e);var Ne=function(){it(window,"mouseup",Ne),setTimeout(Se,20)};ke(window,"mouseup",Ne)}else setTimeout(Se,50)},qt.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},qt.prototype.setUneditable=function(){},qt.prototype.needsContentAttribute=!1;function iu(e,t){if(t=t?j(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 i=M();t.autofocus=i==e||e.getAttribute("autofocus")!=null&&i==document.body}function r(){e.value=V.getValue()}var n;if(e.form&&(ke(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var S=e.form;n=S.submit;try{var N=S.submit=function(){r(),S.submit=n,S.submit(),S.submit=N}}catch($){}}t.finishInit=function($){$.save=r,$.getTextArea=function(){return e},$.toTextArea=function(){$.toTextArea=isNaN,r(),e.parentNode.removeChild($.getWrapperElement()),e.style.display="",e.form&&(it(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=n))}},e.style.display="none";var V=Yt(function($){return e.parentNode.insertBefore($,e.nextSibling)},t);return V}function nu(e){e.off=it,e.on=ke,e.wheelEventPixels=hl,e.Doc=wr,e.splitLines=Et,e.countColumn=q,e.findColumn=pe,e.isWordChar=_e,e.Pass=Be,e.signal=Me,e.Line=Ri,e.changeEnd=Si,e.scrollbarModel=wo,e.Pos=Ke,e.cmpPos=St,e.modes=Wt,e.mimeModes=Lt,e.resolveMode=vt,e.getMode=Vr,e.modeExtensions=nr,e.extendMode=cr,e.copyState=Hr,e.startState=si,e.innerMode=oi,e.commands=Mn,e.keyMap=pi,e.keyName=hs,e.isModifierKey=us,e.lookupKey=an,e.normalizeKeyMap=Pl,e.StringStream=Pt,e.SharedTextMarker=Rn,e.TextMarker=Ti,e.LineWidget=_n,e.e_preventDefault=ee,e.e_stopPropagation=te,e.e_stop=se,e.addClass=G,e.contains=v,e.rmClass=g,e.keyNames=wi}$l(Yt),ql(Yt);var au="iter insert remove copy getEditor constructor".split(" ");for(var ua in wr.prototype)wr.prototype.hasOwnProperty(ua)&&me(au,ua)<0&&(Yt.prototype[ua]=function(e){return function(){return e.apply(this.doc,arguments)}}(wr.prototype[ua]));return ge(wr),Yt.inputStyles={textarea:qt,contenteditable:Gt},Yt.defineMode=function(e){!Yt.defaults.mode&&e!="null"&&(Yt.defaults.mode=e),Wr.apply(this,arguments)},Yt.defineMIME=ai,Yt.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Yt.defineMIME("text/plain","null"),Yt.defineExtension=function(e,t){Yt.prototype[e]=t},Yt.defineDocExtension=function(e,t){wr.prototype[e]=t},Yt.fromTextArea=iu,nu(Yt),Yt.version="5.58.2",Yt})},Y1PL:function(Ct,st,ne){"use strict";ne.r(st),ne.d(st,"ResizableTextArea",function(){return me});var oe=ne("wx14"),Z=ne("1OyB"),k=ne("vuIU"),Y=ne("Ji7U"),P=ne("LK+K"),I=ne("q1tI"),H=ne("VTBJ"),U=ne("rePB"),O=ne("Zm9Q"),R=ne("Kwbf"),y=ne("c+Xe"),w=ne("m+aA"),_=ne("bdgK"),L=new Map;function A(Le){Le.forEach(function(De){var de,pe=De.target;(de=L.get(pe))===null||de===void 0||de.forEach(function(ae){return ae(pe)})})}var C=new _.default(A),d=null,o=null;function l(Le,De){L.has(Le)||(L.set(Le,new Set),C.observe(Le)),L.get(Le).add(De)}function h(Le,De){L.has(Le)&&(L.get(Le).delete(De),L.get(Le).size||(C.unobserve(Le),L.delete(Le)))}var T=function(Le){Object(Y.a)(de,Le);var De=Object(P.a)(de);function de(){return Object(Z.a)(this,de),De.apply(this,arguments)}return Object(k.a)(de,[{key:"render",value:function(){return this.props.children}}]),de}(I.Component),f=I.createContext(null);function p(Le){var De=Le.children,de=Le.onBatchResize,pe=I.useRef(0),ae=I.useRef([]),re=I.useContext(f),we=I.useCallback(function(ve,Re,Ae){pe.current+=1;var Oe=pe.current;ae.current.push({size:ve,element:Re,data:Ae}),Promise.resolve().then(function(){Oe===pe.current&&(de==null||de(ae.current),ae.current=[])}),re==null||re(ve,Re,Ae)},[de,re]);return I.createElement(f.Provider,{value:we},De)}function D(Le){var De=Le.children,de=Le.disabled,pe=I.useRef(null),ae=I.useRef(null),re=I.useContext(f),we=I.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),ve=I.isValidElement(De)&&Object(y.c)(De),Re=ve?De.ref:null,Ae=I.useMemo(function(){return Object(y.a)(Re,pe)},[Re,pe]),Oe=I.useRef(Le);Oe.current=Le;var Ee=I.useCallback(function(_e){var Ie=Oe.current,Ve=Ie.onResize,Ue=Ie.data,Fe=_e.getBoundingClientRect(),Pe=Fe.width,et=Fe.height,Je=_e.offsetWidth,Qe=_e.offsetHeight,$e=Math.floor(Pe),ht=Math.floor(et);if(we.current.width!==$e||we.current.height!==ht||we.current.offsetWidth!==Je||we.current.offsetHeight!==Qe){var Xe={width:$e,height:ht,offsetWidth:Je,offsetHeight:Qe};we.current=Xe;var Ze=Je===Math.round(Pe)?Pe:Je,ke=Qe===Math.round(et)?et:Qe,at=Object(H.a)(Object(H.a)({},Xe),{},{offsetWidth:Ze,offsetHeight:ke});re==null||re(at,_e,Ue),Ve&&Promise.resolve().then(function(){Ve(at,_e)})}},[]);return I.useEffect(function(){var _e=Object(w.a)(pe.current)||Object(w.a)(ae.current);return _e&&!de&&l(_e,Ee),function(){return h(_e,Ee)}},[pe.current,de]),I.createElement(T,{ref:ae},ve?I.cloneElement(De,{ref:Ae}):De)}var E="rc-observer-key";function g(Le){var De=Le.children,de=Object(O.a)(De);return de.map(function(pe,ae){var re=(pe==null?void 0:pe.key)||"".concat(E,"-").concat(ae);return I.createElement(D,Object(oe.a)({},Le,{key:re}),pe)})}g.Collection=p;var c=g,u=ne("bT9E"),a=ne("TSYQ"),x=ne.n(a),b=`
|
|
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={},G;function X(Le){var De=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,de=Le.getAttribute("id")||Le.getAttribute("data-reactid")||Le.getAttribute("name");if(De&&M[de])return M[de];var pe=window.getComputedStyle(Le),ae=pe.getPropertyValue("box-sizing")||pe.getPropertyValue("-moz-box-sizing")||pe.getPropertyValue("-webkit-box-sizing"),re=parseFloat(pe.getPropertyValue("padding-bottom"))+parseFloat(pe.getPropertyValue("padding-top")),we=parseFloat(pe.getPropertyValue("border-bottom-width"))+parseFloat(pe.getPropertyValue("border-top-width")),ve=v.map(function(Ae){return"".concat(Ae,":").concat(pe.getPropertyValue(Ae))}).join(";"),Re={sizingStyle:ve,paddingSize:re,borderSize:we,boxSizing:ae};return De&&de&&(M[de]=Re),Re}function Q(Le){var De=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,de=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,pe=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;G||(G=document.createElement("textarea"),G.setAttribute("tab-index","-1"),G.setAttribute("aria-hidden","true"),document.body.appendChild(G)),Le.getAttribute("wrap")?G.setAttribute("wrap",Le.getAttribute("wrap")):G.removeAttribute("wrap");var ae=X(Le,De),re=ae.paddingSize,we=ae.borderSize,ve=ae.boxSizing,Re=ae.sizingStyle;G.setAttribute("style","".concat(Re,";").concat(b)),G.value=Le.value||Le.placeholder||"";var Ae=Number.MIN_SAFE_INTEGER,Oe=Number.MAX_SAFE_INTEGER,Ee=G.scrollHeight,_e;if(ve==="border-box"?Ee+=we:ve==="content-box"&&(Ee-=re),de!==null||pe!==null){G.value=" ";var Ie=G.scrollHeight-re;de!==null&&(Ae=Ie*de,ve==="border-box"&&(Ae=Ae+re+we),Ee=Math.max(Ae,Ee)),pe!==null&&(Oe=Ie*pe,ve==="border-box"&&(Oe=Oe+re+we),_e=Ee>Oe?"":"hidden",Ee=Math.min(Oe,Ee))}return{height:Ee,minHeight:Ae,maxHeight:Oe,overflowY:_e,resize:"none"}}var z=ne("Gytx"),j=ne.n(z),q;(function(Le){Le[Le.NONE=0]="NONE",Le[Le.RESIZING=1]="RESIZING",Le[Le.RESIZED=2]="RESIZED"})(q||(q={}));var le=function(Le){Object(Y.a)(de,Le);var De=Object(P.a)(de);function de(pe){var ae;return Object(Z.a)(this,de),ae=De.call(this,pe),ae.nextFrameActionId=void 0,ae.resizeFrameId=void 0,ae.textArea=void 0,ae.saveTextArea=function(re){ae.textArea=re},ae.handleResize=function(re){var we=ae.state.resizeStatus,ve=ae.props,Re=ve.autoSize,Ae=ve.onResize;if(we!==q.NONE)return;typeof Ae=="function"&&Ae(re),Re&&ae.resizeOnNextFrame()},ae.resizeOnNextFrame=function(){cancelAnimationFrame(ae.nextFrameActionId),ae.nextFrameActionId=requestAnimationFrame(ae.resizeTextarea)},ae.resizeTextarea=function(){var re=ae.props.autoSize;if(!re||!ae.textArea)return;var we=re.minRows,ve=re.maxRows,Re=Q(ae.textArea,!1,we,ve);ae.setState({textareaStyles:Re,resizeStatus:q.RESIZING},function(){cancelAnimationFrame(ae.resizeFrameId),ae.resizeFrameId=requestAnimationFrame(function(){ae.setState({resizeStatus:q.RESIZED},function(){ae.resizeFrameId=requestAnimationFrame(function(){ae.setState({resizeStatus:q.NONE}),ae.fixFirefoxAutoScroll()})})})})},ae.renderTextArea=function(){var re=ae.props,we=re.prefixCls,ve=we===void 0?"rc-textarea":we,Re=re.autoSize,Ae=re.onResize,Oe=re.className,Ee=re.disabled,_e=ae.state,Ie=_e.textareaStyles,Ve=_e.resizeStatus,Ue=Object(u.a)(ae.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Fe=x()(ve,Oe,Object(U.a)({},"".concat(ve,"-disabled"),Ee));"value"in Ue&&(Ue.value=Ue.value||"");var Pe=Object(H.a)(Object(H.a)(Object(H.a)({},ae.props.style),Ie),Ve===q.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return I.createElement(c,{onResize:ae.handleResize,disabled:!(Re||Ae)},I.createElement("textarea",Object(oe.a)({},Ue,{className:Fe,style:Pe,ref:ae.saveTextArea})))},ae.state={textareaStyles:{},resizeStatus:q.NONE},ae}return Object(k.a)(de,[{key:"componentDidUpdate",value:function(ae){(ae.value!==this.props.value||!j()(ae.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 ae=this.textArea.selectionStart,re=this.textArea.selectionEnd;this.textArea.setSelectionRange(ae,re)}}catch(we){}}},{key:"render",value:function(){return this.renderTextArea()}}]),de}(I.Component),me=le,be=function(Le){Object(Y.a)(de,Le);var De=Object(P.a)(de);function de(pe){var ae;Object(Z.a)(this,de),ae=De.call(this,pe),ae.resizableTextArea=void 0,ae.focus=function(){ae.resizableTextArea.textArea.focus()},ae.saveTextArea=function(we){ae.resizableTextArea=we},ae.handleChange=function(we){var ve=ae.props.onChange;ae.setValue(we.target.value,function(){ae.resizableTextArea.resizeTextarea()}),ve&&ve(we)},ae.handleKeyDown=function(we){var ve=ae.props,Re=ve.onPressEnter,Ae=ve.onKeyDown;we.keyCode===13&&Re&&Re(we),Ae&&Ae(we)};var re=typeof pe.value=="undefined"||pe.value===null?pe.defaultValue:pe.value;return ae.state={value:re},ae}return Object(k.a)(de,[{key:"setValue",value:function(ae,re){"value"in this.props||this.setState({value:ae},re)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return I.createElement(me,Object(oe.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(ae){return"value"in ae?{value:ae.value}:null}}]),de}(I.Component),Be=st.default=be},ZW9T:function(Ct,st,ne){"use strict";ne.d(st,"a",function(){return T});var oe=ne("k1fw"),Z=ne("miYZ"),k=ne("tsqr"),Y=ne("rAM+"),P=ne("tJVT"),I=ne("PpiC"),H=ne("q1tI"),U=ne.n(H),O=ne("bdgK");function R(f,p,D,E,g){var c=p.getWordUntilPosition(D),u={startLineNumber:D.lineNumber,endLineNumber:D.lineNumber,startColumn:c.startColumn,endColumn:c.endColumn},a=E.map(function(x){return{label:x,kind:f.languages.CompletionItemKind.Keyword,insertText:x,insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:u}});return g.map(function(x){a.push(Object(oe.a)(Object(oe.a)({},x),{},{range:u}))}),a}var y=function(f){var p={label:"ifelse",kind:f.languages.CompletionItemKind.Method,insertText:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
|
|
`),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet},D=["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","inline","restrict","_Bool","_Complex","_Imaginary","_Alignas","_Alignof","_Atomic","_Static_assert","_Noreturn","_Thread_local","_Generic"];f.languages.registerCompletionItemProvider("cpp",{provideCompletionItems:function(u,a){var x=R(f,u,a,D,[p]);return{suggestions:x}}});var E=["False","None","True","and","as","assert","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","nonlocal","not","or","pass","raise","return","try","while","with","yield"];f.languages.registerCompletionItemProvider("python",{provideCompletionItems:function(u,a){var x=[{label:"print",kind:f.languages.CompletionItemKind.Snippet,insertText:["print($0)"].join(`
|
|
`),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet}],b=R(f,u,a,E,x);return{suggestions:b}}});var g=["abstract","assert","boolean","break","byte","case","catch","char","class","const","continue","default","do","double","else","enum","extends","final","finally","float","for","goto","if","implements","import","instance of","int","interface","long","native","new","package","private","protected","public","return","strictfp","short","static","super","switch","synchronized","this","throw","throws","transient","try","void","volatile","while"];f.languages.registerCompletionItemProvider("java",{provideCompletionItems:function(u,a){var x=[p,{label:"main",kind:f.languages.CompletionItemKind.Snippet,insertText:["public static void main(String[] args) {"," $0","}"].join(`
|
|
`),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"System.out.print",kind:f.languages.CompletionItemKind.Snippet,insertText:["System.out.print($0)"].join(`
|
|
`),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet}],b=R(f,u,a,g,x);return{suggestions:b}}})},w="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",_=ne("LvDl");function L(f){return/^\d+$/.test(f)?"".concat(f,"px"):f}function A(){}var C=!1,d={"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 o(){var f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],p=f;if(Array.isArray(f)){for(var D=0;D<f.length;D++){var E=d[f[D]];if(E)return E}return p[0]}return d[p]||p}var l=null,h=st.b=function(f){var p=f.width,D=p===void 0?"100%":p,E=f.height,g=E===void 0?"100%":E,c=f.value,u=f.language,a=u===void 0?"javascript":u,x=f.style,b=x===void 0?{}:x,v=f.options,M=v===void 0?{}:v,G=f.overrideServices,X=G===void 0?{}:G,Q=f.theme,z=Q===void 0?"vs-dark":Q,j=f.onEditBlur,q=f.onSave,le=f.autoHeight,me=le===void 0?!1:le,be=f.forbidCopy,Be=be===void 0?!1:be,Le=f.onChange,De=Le===void 0?A:Le,de=f.editorDidMount,pe=de===void 0?A:de,ae=f.onFocus,re=ae===void 0?A:ae,we=f.filename,ve=we===void 0?"educoder.txt":we,Re=Object(I.a)(f,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename"]),Ae=Object(H.useRef)(),Oe=Object(H.useRef)({}),Ee=Object(H.useRef)(),_e=Object(H.useRef)(!1),Ie=Object(H.useRef)(),Ve=Object(H.useState)(!1),Ue=Object(P.a)(Ve,2),Fe=Ue[0],Pe=Ue[1];function et(){var ie;return Ae.current&&(ie=new O.default(function(se){var Ce=Object(Y.a)(se),xe;try{for(Ce.s();!(xe=Ce.n()).done;){var je=xe.value;(je.target.offsetHeight>0||je.target.offsetWidth>0)&&Oe.current.instance.layout()}}catch(nt){Ce.e(nt)}finally{Ce.f()}}),ie.observe(Ae.current)),ie}function Je(){k.b.warn(decodeURIComponent(w))}var Qe=function(){var se=Oe.current.instance;if(c!=null&&se&&Fe){var Ce=se.getModel();Ce&&c!==Ce.getValue()&&(C=!0,Ce.setValue(c),se.layout(),C=!1)}};Object(H.useEffect)(function(){Ee.current&&clearTimeout(Ee.current),Ee.current=setTimeout(function(){Qe()},500)},[c,Fe,Oe.current]);function $e(){var ie=Oe.current.instance;if(ie){var se=ie.getSelection(),Ce=Oe.current.pastePos||{},xe=new l.Range(Ce.startLineNumber||se.endLineNumber,Ce.startColumn||se.endColumn,Ce.endLineNumber||se.endLineNumber,Ce.endColumn||se.endColumn);setTimeout(function(){ie.executeEdits("",[{range:xe,text:""}])},300)}}function ht(ie){(window.navigator.platform.match("Mac")?ie.metaKey:ie.ctrlKey)&&ie.keyCode==83&&(ie.preventDefault(),q())}var Xe=function(){if(me&&Oe.current.instance){var se=Oe.current.instance.getContentHeight();ee(se<g?g:se)}else ee(g)};function Ze(ie){var se=document.createEvent("MouseEvents");se.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),ie.dispatchEvent(se)}function ke(ie,se){var Ce=window.URL||window.webkitURL||window,xe=new Blob([se]),je=document.createElementNS("http://www.w3.org/1999/xhtml","a");je.href=Ce.createObjectURL(xe),je.download=ie,Ze(je)}Object(H.useEffect)(function(){Xe()},[Xe]),Object(H.useEffect)(function(){Ae.current&&!Fe&&ne.e(27).then(ne.t.bind(null,"M/lh",7)).then(function(ie){try{l=ie,Oe.current.instance=l.editor.create(Ae.current,{value:c,language:o(a),theme:z,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0},X);var se=Oe.current.instance;if(pe(se,l),setTimeout(function(){Xe(),Oe.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){ke(ve||"educoder.txt",se.getValue())}})},500),Oe.current.subscription=se.onDidChangeModelContent(function(xe){_e.current?clearTimeout(Ie.current):(Xe(),De(se.getValue(),xe)),Ie.current=setTimeout(function(){_e.current=!1},500)}),window.Monaco||y(l),Be&&(se.addCommand(l.KeyMod.CtrlCmd|l.KeyMod.Shift|l.KeyCode.KEY_V,function(){return Je(),null}),se.addCommand(l.KeyMod.CtrlCmd|l.KeyCode.KEY_C,function(){return Je(),null})),window.Monaco=l,j&&se.onDidBlurEditorWidget(function(){j(se.getValue())}),re&&se.onDidFocusEditorText(function(){re(se.getValue())}),Be){se.addCommand(l.KeyMod.CtrlCmd|l.KeyCode.KEY_V,function(){return Je(),null}),se.onDidPaste(function(xe){Oe.current.pastePos=xe});try{window.addEventListener("paste",$e)}catch(xe){}}var Ce=et();return Pe(!0),function(){var xe=Oe.current.instance;xe.dispose();var je=xe.getModel();je&&je.dispose(),Oe.current.subscription&&Oe.current.subscription.dispose(),Be&&window.removeEventListener("paste",$e),Ce.unobserve(Ae.current)}}catch(xe){}})},[]),Object(H.useEffect)(function(){var ie=Oe.current.instance;if(ie&&Fe)return document.addEventListener("keydown",ht,!1),function(){document.removeEventListener("keydown",ht)}},[q,Fe]),Object(H.useEffect)(function(){var ie=Oe.current.instance;if(ie&&Fe){var se=o(a);l.editor.setModelLanguage(ie.getModel(),se),console.log("language:",a,ie.getModel(),se)}},[a,Fe]),Object(H.useEffect)(function(){var ie=Oe.current.instance;ie&&Fe&&l.editor.setTheme(z)},[z,Fe]),Object(H.useEffect)(function(){var ie=Oe.current.instance;ie&&Fe&&(ie.updateOptions(Object(oe.a)({},M)),setTimeout(function(){ie.getModel().updateOptions(Object(oe.a)({},M))},200))},[JSON.stringify(M),Fe]),Object(H.useEffect)(function(){var ie=Oe.current.instance;ie&&Fe&&ie.layout()},[D,g,Fe]);var at=Object(H.useState)(L(D)),it=Object(P.a)(at,2),Me=it[0],Ge=it[1],ye=Object(H.useState)(L(g)),ce=Object(P.a)(ye,2),ge=ce[0],ee=ce[1],te=Object(oe.a)(Object(oe.a)({},b),{},{width:Me,height:ge});return U.a.createElement("div",{className:"my-monaco-editor",ref:Ae,style:te})};function T(f){var p=f.width,D=p===void 0?"100%":p,E=f.height,g=E===void 0?"100%":E,c=f.original,u=f.modified,a=f.language,x=f.options,b=x===void 0?{}:x,v=Object(H.useRef)(),M=Object(H.useState)(null),G=Object(P.a)(M,2),X=G[0],Q=G[1];function z(me){var be;return v.current&&(be=new O.default(function(Be){var Le=Object(Y.a)(Be),De;try{for(Le.s();!(De=Le.n()).done;){var de=De.value;(de.target.offsetHeight>0||de.target.offsetWidth>0)&&me.layout()}}catch(pe){Le.e(pe)}finally{Le.f()}}),be.observe(v.current)),be}Object(H.useEffect)(function(){v.current&&ne.e(27).then(ne.t.bind(null,"M/lh",7)).then(function(me){l=me;var be=l.editor.createDiffEditor(v.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},b),{},{wordWrap:!0}));Q(be);var Be=z(be);return function(){be.dispose();var Le=be.getModel();Le&&Le.dispose(),Be.unobserve(v.current)}})},[]),Object(H.useEffect)(function(){X&&X.setModel({original:l.editor.createModel(c,a),modified:l.editor.createModel(u,a)})},[c,u,a,X]);var j=L(D),q=L(g),le={width:j,height:q};return U.a.createElement("div",{className:"my-diff-editor",ref:v,style:le})}},ZpRC:function(Ct,st,ne){"use strict";function oe(y){return typeof y=="object"&&y!=null&&y.nodeType===1}function Z(y,w){return(!w||y!=="hidden")&&y!=="visible"&&y!=="clip"}function k(y,w){if(y.clientHeight<y.scrollHeight||y.clientWidth<y.scrollWidth){var _=getComputedStyle(y,null);return Z(_.overflowY,w)||Z(_.overflowX,w)||function(L){var A=function(C){if(!C.ownerDocument||!C.ownerDocument.defaultView)return null;try{return C.ownerDocument.defaultView.frameElement}catch(d){return null}}(L);return!!A&&(A.clientHeight<L.scrollHeight||A.clientWidth<L.scrollWidth)}(y)}return!1}function Y(y,w,_,L,A,C,d,o){return C<y&&d>w||C>y&&d<w?0:C<=y&&o<=_||d>=w&&o>=_?C-y-L:d>w&&o<_||C<y&&o>_?d-w+A:0}var P=function(y,w){var _=window,L=w.scrollMode,A=w.block,C=w.inline,d=w.boundary,o=w.skipOverflowHiddenElements,l=typeof d=="function"?d:function(Ie){return Ie!==d};if(!oe(y))throw new TypeError("Invalid target");for(var h=document.scrollingElement||document.documentElement,T=[],f=y;oe(f)&&l(f);){if((f=f.parentElement)===h){T.push(f);break}f!=null&&f===document.body&&k(f)&&!k(document.documentElement)||f!=null&&k(f,o)&&T.push(f)}for(var p=_.visualViewport?_.visualViewport.width:innerWidth,D=_.visualViewport?_.visualViewport.height:innerHeight,E=window.scrollX||pageXOffset,g=window.scrollY||pageYOffset,c=y.getBoundingClientRect(),u=c.height,a=c.width,x=c.top,b=c.right,v=c.bottom,M=c.left,G=A==="start"||A==="nearest"?x:A==="end"?v:x+u/2,X=C==="center"?M+a/2:C==="end"?b:M,Q=[],z=0;z<T.length;z++){var j=T[z],q=j.getBoundingClientRect(),le=q.height,me=q.width,be=q.top,Be=q.right,Le=q.bottom,De=q.left;if(L==="if-needed"&&x>=0&&M>=0&&v<=D&&b<=p&&x>=be&&v<=Le&&M>=De&&b<=Be)return Q;var de=getComputedStyle(j),pe=parseInt(de.borderLeftWidth,10),ae=parseInt(de.borderTopWidth,10),re=parseInt(de.borderRightWidth,10),we=parseInt(de.borderBottomWidth,10),ve=0,Re=0,Ae="offsetWidth"in j?j.offsetWidth-j.clientWidth-pe-re:0,Oe="offsetHeight"in j?j.offsetHeight-j.clientHeight-ae-we:0;if(h===j)ve=A==="start"?G:A==="end"?G-D:A==="nearest"?Y(g,g+D,D,ae,we,g+G,g+G+u,u):G-D/2,Re=C==="start"?X:C==="center"?X-p/2:C==="end"?X-p:Y(E,E+p,p,pe,re,E+X,E+X+a,a),ve=Math.max(0,ve+g),Re=Math.max(0,Re+E);else{ve=A==="start"?G-be-ae:A==="end"?G-Le+we+Oe:A==="nearest"?Y(be,Le,le,ae,we+Oe,G,G+u,u):G-(be+le/2)+Oe/2,Re=C==="start"?X-De-pe:C==="center"?X-(De+me/2)+Ae/2:C==="end"?X-Be+re+Ae:Y(De,Be,me,pe,re+Ae,X,X+a,a);var Ee=j.scrollLeft,_e=j.scrollTop;G+=_e-(ve=Math.max(0,Math.min(_e+ve,j.scrollHeight-le+Oe))),X+=Ee-(Re=Math.max(0,Math.min(Ee+Re,j.scrollWidth-me+Ae)))}Q.push({el:j,top:ve,left:Re})}return Q};function I(y){return y===Object(y)&&Object.keys(y).length!==0}function H(y,w){w===void 0&&(w="auto");var _="scrollBehavior"in document.body.style;y.forEach(function(L){var A=L.el,C=L.top,d=L.left;A.scroll&&_?A.scroll({top:C,left:d,behavior:w}):(A.scrollTop=C,A.scrollLeft=d)})}function U(y){return y===!1?{block:"end",inline:"nearest"}:I(y)?y:{block:"start",inline:"nearest"}}function O(y,w){var _=!y.ownerDocument.documentElement.contains(y);if(I(w)&&typeof w.behavior=="function")return w.behavior(_?[]:P(y,w));if(_)return;var L=U(w);return H(P(y,L),L.behavior)}var R=st.a=O},bT9E:function(Ct,st,ne){"use strict";ne.d(st,"a",function(){return Z});var oe=ne("VTBJ");function Z(k,Y){var P=Object(oe.a)({},k);return Array.isArray(Y)&&Y.forEach(function(I){delete P[I]}),P}},c5Ni:function(Ct,st,ne){},dejd:function(Ct,st,ne){},dmUQ:function(Ct,st,ne){"use strict";var oe=ne("Ff2n"),Z=ne("rePB"),k=ne("1OyB"),Y=ne("vuIU"),P=ne("Ji7U"),I=ne("md7G"),H=ne("foSv"),U=ne("q1tI"),O=ne.n(U),R=ne("TSYQ"),y=ne.n(R),w=ne("4IlW");function _(u,a){var x=Object.keys(u);if(Object.getOwnPropertySymbols){var b=Object.getOwnPropertySymbols(u);a&&(b=b.filter(function(v){return Object.getOwnPropertyDescriptor(u,v).enumerable})),x.push.apply(x,b)}return x}function L(u){for(var a=1;a<arguments.length;a++){var x=arguments[a]!=null?arguments[a]:{};a%2?_(Object(x),!0).forEach(function(b){Object(Z.a)(u,b,x[b])}):Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(x)):_(Object(x)).forEach(function(b){Object.defineProperty(u,b,Object.getOwnPropertyDescriptor(x,b))})}return u}function A(u){var a=C();return function(){var b=Object(H.a)(u),v;if(a){var M=Object(H.a)(this).constructor;v=Reflect.construct(b,arguments,M)}else v=b.apply(this,arguments);return Object(I.a)(this,v)}}function C(){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(u){return!1}}function d(){}function o(u){u.preventDefault()}var l=function(a){return a.replace(/[^\w.-]+/g,"")},h=200,T=600,f=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,p=function(a){return a!=null},D=function(a,x){return x===a||typeof x=="number"&&typeof a=="number"&&isNaN(x)&&isNaN(a)},E=function(u){Object(P.a)(x,u);var a=A(x);function x(b){var v;Object(k.a)(this,x),v=a.call(this,b),v.onKeyDown=function(X){var Q=v.props,z=Q.onKeyDown,j=Q.onPressEnter;if(X.keyCode===w.a.UP){var q=v.getRatio(X);v.up(X,q,null),v.stop()}else if(X.keyCode===w.a.DOWN){var le=v.getRatio(X);v.down(X,le,null),v.stop()}else X.keyCode===w.a.ENTER&&j&&j(X);if(v.recordCursorPosition(),v.lastKeyCode=X.keyCode,z){for(var me=arguments.length,be=new Array(me>1?me-1:0),Be=1;Be<me;Be++)be[Be-1]=arguments[Be];z.apply(void 0,[X].concat(be))}},v.onKeyUp=function(X){var Q=v.props.onKeyUp;if(v.stop(),v.recordCursorPosition(),Q){for(var z=arguments.length,j=new Array(z>1?z-1:0),q=1;q<z;q++)j[q-1]=arguments[q];Q.apply(void 0,[X].concat(j))}},v.onChange=function(X){var Q=v.props.onChange;v.state.focused&&(v.inputting=!0),v.rawInput=v.props.parser(v.getValueFromEvent(X)),v.setState({inputValue:v.rawInput}),Q(v.toNumber(v.rawInput))},v.onMouseUp=function(){var X=v.props.onMouseUp;v.recordCursorPosition(),X&&X.apply(void 0,arguments)},v.onFocus=function(){var X;v.setState({focused:!0}),(X=v.props).onFocus.apply(X,arguments)},v.onBlur=function(){var X=v.props.onBlur;v.inputting=!1,v.setState({focused:!1});var Q=v.getCurrentValidValue(v.state.inputValue),z=v.setValue(Q,d);if(X){var j=v.input.value,q=v.getInputDisplayValue({focus:!1,value:z});v.input.value=q&&Number(q),X.apply(void 0,arguments),v.input.value=j}},v.getRatio=function(X){var Q=1;return X.metaKey||X.ctrlKey?Q=.1:X.shiftKey&&(Q=10),Q},v.getFullNum=function(X){return isNaN(X)?X:/e/i.test(String(X))?Number(X).toFixed(18).replace(/\.?0+$/,""):X},v.getPrecision=function(X){if(p(v.props.precision))return v.props.precision;var Q=String(X);if(Q.indexOf("e-")>=0)return parseInt(Q.slice(Q.indexOf("e-")+2),10);var z=0;return Q.indexOf(".")>=0&&(z=Q.length-Q.indexOf(".")-1),z},v.getInputDisplayValue=function(X){var Q=X||v.state,z=Q.focused,j=Q.inputValue,q=Q.value,le;z?le=j:le=v.toPrecisionAsStep(q),le==null&&(le="");var me=v.formatWrapper(le);return p(v.props.decimalSeparator)&&(me=me.toString().replace(".",v.props.decimalSeparator)),me},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(X){}},v.restoreByAfter=function(X){if(X===void 0)return!1;var Q=v.input.value,z=Q.lastIndexOf(X);if(z===-1)return!1;var j=v.cursorBefore.length;return v.lastKeyCode===w.a.DELETE&&v.cursorBefore.charAt(j-1)===X[0]?(v.fixCaret(j,j),!0):z+X.length===Q.length?(v.fixCaret(z,z),!0):!1},v.partRestoreByAfter=function(X){return X===void 0?!1:Array.prototype.some.call(X,function(Q,z){var j=X.substring(z);return v.restoreByAfter(j)})},v.isNotCompleteNumber=function(X){return isNaN(X)||X===""||X===null||X&&X.toString().indexOf(".")===X.toString().length-1},v.stop=function(){v.autoStepTimer&&clearTimeout(v.autoStepTimer)},v.down=function(X,Q,z){v.pressingUpOrDown=!0,v.step("down",X,Q,z)},v.up=function(X,Q,z){v.pressingUpOrDown=!0,v.step("up",X,Q,z)},v.saveInput=function(X){v.input=X};var M=b.value;M===void 0&&(M=b.defaultValue),v.state={focused:b.autoFocus};var G=v.getValidValue(v.toNumber(M));return v.state=L(L({},v.state),{},{inputValue:v.toPrecisionAsStep(G),value:G}),v}return Object(Y.a)(x,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(v){var M=this.props,G=M.value,X=M.onChange,Q=M.max,z=M.min,j=this.state.focused;if(v){if(!D(v.value,G)||!D(v.max,Q)||!D(v.min,z)){var q=j?G:this.getValidValue(G),le;this.pressingUpOrDown?le=q:this.inputting?le=this.rawInput:le=this.toPrecisionAsStep(q),this.setState({value:q,inputValue:le})}var me="value"in this.props?G:this.state.value;"max"in this.props&&v.max!==Q&&typeof me=="number"&&me>Q&&X&&X(Q),"min"in this.props&&v.min!==z&&typeof me=="number"&&me<z&&X&&X(z)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var be=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===w.a.BACKSPACE?be=this.cursorStart-1:this.lastKeyCode===w.a.DELETE&&(be=this.cursorStart):be=this.input.value.length,this.fixCaret(be,be)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case w.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case w.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(Be){}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 p(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,G=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,X=parseFloat(v);return isNaN(X)?v:(X<M&&(X=M),X>G&&(X=G),X)}},{key:"setValue",value:function(v,M){var G=this.props.precision,X=this.isNotCompleteNumber(parseFloat(v))?null:parseFloat(v),Q=this.state.value,z=Q===void 0?null:Q,j=this.state.inputValue,q=j===void 0?null:j,le=typeof X=="number"?X.toFixed(G):"".concat(X),me=X!==z||le!=="".concat(q);return"value"in this.props?(q=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:q},M)):this.setState({value:X,inputValue:this.toPrecisionAsStep(v)},M),me&&this.props.onChange(X),X}},{key:"getMaxPrecision",value:function(v){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,G=this.props,X=G.precision,Q=G.step;if(p(X))return X;var z=this.getPrecision(M),j=this.getPrecision(Q),q=this.getPrecision(v);return v?Math.max(q,z+j):z+j}},{key:"getPrecisionFactor",value:function(v){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,G=this.getMaxPrecision(v,M);return Math.pow(10,G)}},{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,G=this.state.focused,X=v&&v.length>16&&G;return this.isNotCompleteNumber(v)||X?v:p(M)?Math.round(v*Math.pow(10,M))/Math.pow(10,M):Number(v)}},{key:"upStep",value:function(v,M){var G=this.props.step,X=this.getPrecisionFactor(v,M),Q=Math.abs(this.getMaxPrecision(v,M)),z=((X*v+X*G*M)/X).toFixed(Q);return this.toNumber(z)}},{key:"downStep",value:function(v,M){var G=this.props.step,X=this.getPrecisionFactor(v,M),Q=Math.abs(this.getMaxPrecision(v,M)),z=((X*v-X*G*M)/X).toFixed(Q);return this.toNumber(z)}},{key:"step",value:function(v,M){var G=this,X=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,Q=arguments.length>3?arguments[3]:void 0;this.stop(),M&&(M.persist(),M.preventDefault());var z=this.props;if(z.disabled)return;var j=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(j))return;var q=this["".concat(v,"Step")](j,X),le=q>z.max||q<z.min;if(q>z.max?q=z.max:q<z.min&&(q=z.min),this.setValue(q,null),this.setState({focused:!0},function(){G.pressingUpOrDown=!1}),le)return;this.autoStepTimer=setTimeout(function(){G[v](M,X,!0)},Q?h:T)}},{key:"fixCaret",value:function(v,M){if(v===void 0||M===void 0||!this.input||!this.input.value)return;try{var G=this.input.selectionStart,X=this.input.selectionEnd;(v!==G||M!==X)&&this.input.setSelectionRange(v,M)}catch(Q){}}},{key:"render",value:function(){var v,M=this.props,G=M.prefixCls,X=M.disabled,Q=M.readOnly,z=M.useTouch,j=M.autoComplete,q=M.upHandler,le=M.downHandler,me=M.className,be=M.max,Be=M.min,Le=M.style,De=M.title,de=M.onMouseEnter,pe=M.onMouseLeave,ae=M.onMouseOver,re=M.onMouseOut,we=M.required,ve=M.onClick,Re=M.tabIndex,Ae=M.type,Oe=M.placeholder,Ee=M.id,_e=M.inputMode,Ie=M.pattern,Ve=M.step,Ue=M.maxLength,Fe=M.autoFocus,Pe=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"]),$e=this.state,ht=$e.value,Xe=$e.focused,Ze=y()(G,(v={},Object(Z.a)(v,me,!!me),Object(Z.a)(v,"".concat(G,"-disabled"),X),Object(Z.a)(v,"".concat(G,"-focused"),Xe),v)),ke={};Object.keys(Qe).forEach(function(se){(se.substr(0,5)==="data-"||se.substr(0,5)==="aria-"||se==="role")&&(ke[se]=Qe[se])});var at=!Q&&!X,it=this.getInputDisplayValue(null),Me=(ht||ht===0)&&(isNaN(ht)||Number(ht)>=be),Ge=(ht||ht===0)&&(isNaN(ht)||Number(ht)<=Be),ye=Me||X||Q,ce=Ge||X||Q,ge=y()("".concat(G,"-handler"),"".concat(G,"-handler-up"),Object(Z.a)({},"".concat(G,"-handler-up-disabled"),ye)),ee=y()("".concat(G,"-handler"),"".concat(G,"-handler-down"),Object(Z.a)({},"".concat(G,"-handler-down-disabled"),ce)),te=z?{onTouchStart:ye?d:this.up,onTouchEnd:this.stop}:{onMouseDown:ye?d:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},ie=z?{onTouchStart:ce?d:this.down,onTouchEnd:this.stop}:{onMouseDown:ce?d:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return O.a.createElement("div",{className:Ze,style:Le,title:De,onMouseEnter:de,onMouseLeave:pe,onMouseOver:ae,onMouseOut:re,onFocus:function(){return null},onBlur:function(){return null}},O.a.createElement("div",{className:"".concat(G,"-handler-wrap")},O.a.createElement("span",Object.assign({unselectable:"on"},te,{role:"button","aria-label":"Increase Value","aria-disabled":ye,className:ge}),q||O.a.createElement("span",{unselectable:"on",className:"".concat(G,"-handler-up-inner"),onClick:o})),O.a.createElement("span",Object.assign({unselectable:"on"},ie,{role:"button","aria-label":"Decrease Value","aria-disabled":ce,className:ee}),le||O.a.createElement("span",{unselectable:"on",className:"".concat(G,"-handler-down-inner"),onClick:o}))),O.a.createElement("div",{className:"".concat(G,"-input-wrap")},O.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":Be,"aria-valuemax":be,"aria-valuenow":ht,required:we,type:Ae,placeholder:Oe,onPaste:et,onClick:ve,onMouseUp:this.onMouseUp,className:"".concat(G,"-input"),tabIndex:Re,autoComplete:j,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:at?this.onKeyDown:d,onKeyUp:at?this.onKeyUp:d,autoFocus:Fe,maxLength:Ue,readOnly:Q,disabled:X,max:be,min:Be,step:Ve,name:Pe,title:De,id:Ee,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(it),pattern:Ie,inputMode:_e,onInput:Je},ke))))}}]),x}(O.a.Component);E.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:f,min:-f,step:1,style:{},onChange:d,onKeyDown:d,onPressEnter:d,onFocus:d,onBlur:d,parser:l,required:!1,autoComplete:"off"};var g=E,c=st.a=g},gJ3r:function(Ct,st,ne){"use strict";ne.d(st,"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(Ct,st,ne){},lZu9:function(Ct,st,ne){(function(oe){oe(ne("VrN/"),ne("1eCo"),ne("8EBN"))})(function(oe){"use strict";oe.defineMode("markdown",function(Z,k){var Y=oe.getMode(Z,"text/html"),P=Y.name=="null";function I(z){if(oe.findModeByName){var j=oe.findModeByName(z);j&&(z=j.mime||j.mimes[0])}var q=oe.getMode(Z,z);return q.name=="null"?null:q}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 H={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough",emoji:"builtin"};for(var U in H)H.hasOwnProperty(U)&&k.tokenTypeOverrides[U]&&(H[U]=k.tokenTypeOverrides[U]);var O=/^([*\-_])(?:\s*\1){2,}\s*$/,R=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,y=/^\[(x| )\](?=\s)/i,w=k.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,_=/^ {0,3}(?:\={1,}|-{2,})\s*$/,L=/^[^#!\[\]*_\\<>` "'(~:]+/,A=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,C=/^\s*\[[^\]]+?\]:.*$/,d=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\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]/,o=" ";function l(z,j,q){return j.f=j.inline=q,q(z,j)}function h(z,j,q){return j.f=j.block=q,q(z,j)}function T(z){return!z||!/\S/.test(z.string)}function f(z){if(z.linkTitle=!1,z.linkHref=!1,z.linkText=!1,z.em=!1,z.strong=!1,z.strikethrough=!1,z.quote=0,z.indentedCode=!1,z.f==D){var j=P;if(!j){var q=oe.innerMode(Y,z.htmlState);j=q.mode.name=="xml"&&q.state.tagStart===null&&!q.state.context&&q.state.tokenize.isInText}j&&(z.f=u,z.block=p,z.htmlState=null)}return z.trailingSpace=0,z.trailingSpaceNewLine=!1,z.prevLine=z.thisLine,z.thisLine={stream:null},null}function p(z,j){var q=z.column()===j.indentation,le=T(j.prevLine.stream),me=j.indentedCode,be=j.prevLine.hr,Be=j.list!==!1,Le=(j.listStack[j.listStack.length-1]||0)+3;j.indentedCode=!1;var De=j.indentation;if(j.indentationDiff===null&&(j.indentationDiff=j.indentation,Be)){for(j.list=null;De<j.listStack[j.listStack.length-1];)j.listStack.pop(),j.listStack.length?j.indentation=j.listStack[j.listStack.length-1]:j.list=!1;j.list!==!1&&(j.indentationDiff=De-j.listStack[j.listStack.length-1])}var de=!le&&!be&&!j.prevLine.header&&(!Be||!me)&&!j.prevLine.fencedCodeEnd,pe=(j.list===!1||be||le)&&j.indentation<=Le&&z.match(O),ae=null;if(j.indentationDiff>=4&&(me||j.prevLine.fencedCodeEnd||j.prevLine.header||le))return z.skipToEnd(),j.indentedCode=!0,H.code;if(z.eatSpace())return null;if(q&&j.indentation<=Le&&(ae=z.match(w))&&ae[1].length<=6)return j.quote=0,j.header=ae[1].length,j.thisLine.header=!0,k.highlightFormatting&&(j.formatting="header"),j.f=j.inline,g(j);if(j.indentation<=Le&&z.eat(">"))return j.quote=q?1:j.quote+1,k.highlightFormatting&&(j.formatting="quote"),z.eatSpace(),g(j);if(!pe&&!j.setext&&q&&j.indentation<=Le&&(ae=z.match(R))){var re=ae[1]?"ol":"ul";return j.indentation=De+z.current().length,j.list=!0,j.quote=0,j.listStack.push(j.indentation),j.em=!1,j.strong=!1,j.code=!1,j.strikethrough=!1,k.taskLists&&z.match(y,!1)&&(j.taskList=!0),j.f=j.inline,k.highlightFormatting&&(j.formatting=["list","list-"+re]),g(j)}else{if(q&&j.indentation<=Le&&(ae=z.match(A,!0)))return j.quote=0,j.fencedEndRE=new RegExp(ae[1]+"+ *$"),j.localMode=k.fencedCodeBlockHighlighting&&I(ae[2]||k.fencedCodeBlockDefaultMode),j.localMode&&(j.localState=oe.startState(j.localMode)),j.f=j.block=E,k.highlightFormatting&&(j.formatting="code-block"),j.code=-1,g(j);if(j.setext||(!de||!Be)&&!j.quote&&j.list===!1&&!j.code&&!pe&&!C.test(z.string)&&(ae=z.lookAhead(1))&&(ae=ae.match(_)))return j.setext?(j.header=j.setext,j.setext=0,z.skipToEnd(),k.highlightFormatting&&(j.formatting="header")):(j.header=ae[0].charAt(0)=="="?1:2,j.setext=j.header),j.thisLine.header=!0,j.f=j.inline,g(j);if(pe)return z.skipToEnd(),j.hr=!0,j.thisLine.hr=!0,H.hr;if(z.peek()==="[")return l(z,j,M)}return l(z,j,j.inline)}function D(z,j){var q=Y.token(z,j.htmlState);if(!P){var le=oe.innerMode(Y,j.htmlState);(le.mode.name=="xml"&&le.state.tagStart===null&&!le.state.context&&le.state.tokenize.isInText||j.md_inside&&z.current().indexOf(">")>-1)&&(j.f=u,j.block=p,j.htmlState=null)}return q}function E(z,j){var q=j.listStack[j.listStack.length-1]||0,le=j.indentation<q,me=q+3;if(j.fencedEndRE&&j.indentation<=me&&(le||z.match(j.fencedEndRE))){k.highlightFormatting&&(j.formatting="code-block");var be;return le||(be=g(j)),j.localMode=j.localState=null,j.block=p,j.f=u,j.fencedEndRE=null,j.code=0,j.thisLine.fencedCodeEnd=!0,le?h(z,j,j.block):be}else return j.localMode?j.localMode.token(z,j.localState):(z.skipToEnd(),H.code)}function g(z){var j=[];if(z.formatting){j.push(H.formatting),typeof z.formatting=="string"&&(z.formatting=[z.formatting]);for(var q=0;q<z.formatting.length;q++)j.push(H.formatting+"-"+z.formatting[q]),z.formatting[q]==="header"&&j.push(H.formatting+"-"+z.formatting[q]+"-"+z.header),z.formatting[q]==="quote"&&(!k.maxBlockquoteDepth||k.maxBlockquoteDepth>=z.quote?j.push(H.formatting+"-"+z.formatting[q]+"-"+z.quote):j.push("error"))}if(z.taskOpen)return j.push("meta"),j.length?j.join(" "):null;if(z.taskClosed)return j.push("property"),j.length?j.join(" "):null;if(z.linkHref?j.push(H.linkHref,"url"):(z.strong&&j.push(H.strong),z.em&&j.push(H.em),z.strikethrough&&j.push(H.strikethrough),z.emoji&&j.push(H.emoji),z.linkText&&j.push(H.linkText),z.code&&j.push(H.code),z.image&&j.push(H.image),z.imageAltText&&j.push(H.imageAltText,"link"),z.imageMarker&&j.push(H.imageMarker)),z.header&&j.push(H.header,H.header+"-"+z.header),z.quote&&(j.push(H.quote),!k.maxBlockquoteDepth||k.maxBlockquoteDepth>=z.quote?j.push(H.quote+"-"+z.quote):j.push(H.quote+"-"+k.maxBlockquoteDepth)),z.list!==!1){var le=(z.listStack.length-1)%3;le?le===1?j.push(H.list2):j.push(H.list3):j.push(H.list1)}return z.trailingSpaceNewLine?j.push("trailing-space-new-line"):z.trailingSpace&&j.push("trailing-space-"+(z.trailingSpace%2?"a":"b")),j.length?j.join(" "):null}function c(z,j){return z.match(L,!0)?g(j):void 0}function u(z,j){var q=j.text(z,j);if(typeof q!="undefined")return q;if(j.list)return j.list=null,g(j);if(j.taskList){var le=z.match(y,!0)[1]===" ";return le?j.taskOpen=!0:j.taskClosed=!0,k.highlightFormatting&&(j.formatting="task"),j.taskList=!1,g(j)}if(j.taskOpen=!1,j.taskClosed=!1,j.header&&z.match(/^#+$/,!0))return k.highlightFormatting&&(j.formatting="header"),g(j);var me=z.next();if(j.linkTitle){j.linkTitle=!1;var be=me;me==="("&&(be=")"),be=(be+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var Be="^\\s*(?:[^"+be+"\\\\]+|\\\\\\\\|\\\\.)"+be;if(z.match(new RegExp(Be),!0))return H.linkHref}if(me==="`"){var Le=j.formatting;k.highlightFormatting&&(j.formatting="code"),z.eatWhile("`");var De=z.current().length;if(j.code==0&&(!j.quote||De==1))return j.code=De,g(j);if(De==j.code){var de=g(j);return j.code=0,de}else return j.formatting=Le,g(j)}else if(j.code)return g(j);if(me==="\\"&&(z.next(),k.highlightFormatting)){var pe=g(j),ae=H.formatting+"-escape";return pe?pe+" "+ae:ae}if(me==="!"&&z.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return j.imageMarker=!0,j.image=!0,k.highlightFormatting&&(j.formatting="image"),g(j);if(me==="["&&j.imageMarker&&z.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return j.imageMarker=!1,j.imageAltText=!0,k.highlightFormatting&&(j.formatting="image"),g(j);if(me==="]"&&j.imageAltText){k.highlightFormatting&&(j.formatting="image");var pe=g(j);return j.imageAltText=!1,j.image=!1,j.inline=j.f=x,pe}if(me==="["&&!j.image)return j.linkText&&z.match(/^.*?\]/)||(j.linkText=!0,k.highlightFormatting&&(j.formatting="link")),g(j);if(me==="]"&&j.linkText){k.highlightFormatting&&(j.formatting="link");var pe=g(j);return j.linkText=!1,j.inline=j.f=z.match(/\(.*?\)| ?\[.*?\]/,!1)?x:u,pe}if(me==="<"&&z.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){j.f=j.inline=a,k.highlightFormatting&&(j.formatting="link");var pe=g(j);return pe?pe+=" ":pe="",pe+H.linkInline}if(me==="<"&&z.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){j.f=j.inline=a,k.highlightFormatting&&(j.formatting="link");var pe=g(j);return pe?pe+=" ":pe="",pe+H.linkEmail}if(k.xml&&me==="<"&&z.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var re=z.string.indexOf(">",z.pos);if(re!=-1){var we=z.string.substring(z.start,re);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(we)&&(j.md_inside=!0)}return z.backUp(1),j.htmlState=oe.startState(Y),h(z,j,D)}if(k.xml&&me==="<"&&z.match(/^\/\w*?>/))return j.md_inside=!1,"tag";if(me==="*"||me==="_"){for(var ve=1,Re=z.pos==1?" ":z.string.charAt(z.pos-2);ve<3&&z.eat(me);)ve++;var Ae=z.peek()||" ",Oe=!/\s/.test(Ae)&&(!d.test(Ae)||/\s/.test(Re)||d.test(Re)),Ee=!/\s/.test(Re)&&(!d.test(Re)||/\s/.test(Ae)||d.test(Ae)),_e=null,Ie=null;if(ve%2&&(!j.em&&Oe&&(me==="*"||!Ee||d.test(Re))?_e=!0:j.em==me&&Ee&&(me==="*"||!Oe||d.test(Ae))&&(_e=!1)),ve>1&&(!j.strong&&Oe&&(me==="*"||!Ee||d.test(Re))?Ie=!0:j.strong==me&&Ee&&(me==="*"||!Oe||d.test(Ae))&&(Ie=!1)),Ie!=null||_e!=null){k.highlightFormatting&&(j.formatting=_e==null?"strong":Ie==null?"em":"strong em"),_e===!0&&(j.em=me),Ie===!0&&(j.strong=me);var de=g(j);return _e===!1&&(j.em=!1),Ie===!1&&(j.strong=!1),de}}else if(me===" "&&(z.eat("*")||z.eat("_"))){if(z.peek()===" ")return g(j);z.backUp(1)}if(k.strikethrough){if(me==="~"&&z.eatWhile(me)){if(j.strikethrough){k.highlightFormatting&&(j.formatting="strikethrough");var de=g(j);return j.strikethrough=!1,de}else if(z.match(/^[^\s]/,!1))return j.strikethrough=!0,k.highlightFormatting&&(j.formatting="strikethrough"),g(j)}else if(me===" "&&z.match(/^~~/,!0)){if(z.peek()===" ")return g(j);z.backUp(2)}}if(k.emoji&&me===":"&&z.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){j.emoji=!0,k.highlightFormatting&&(j.formatting="emoji");var Ve=g(j);return j.emoji=!1,Ve}return me===" "&&(z.match(/^ +$/,!1)?j.trailingSpace++:j.trailingSpace&&(j.trailingSpaceNewLine=!0)),g(j)}function a(z,j){var q=z.next();if(q===">"){j.f=j.inline=u,k.highlightFormatting&&(j.formatting="link");var le=g(j);return le?le+=" ":le="",le+H.linkInline}return z.match(/^[^>]+/,!0),H.linkInline}function x(z,j){if(z.eatSpace())return null;var q=z.next();return q==="("||q==="["?(j.f=j.inline=v(q==="("?")":"]"),k.highlightFormatting&&(j.formatting="link-string"),j.linkHref=!0,g(j)):"error"}var b={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function v(z){return function(j,q){var le=j.next();if(le===z){q.f=q.inline=u,k.highlightFormatting&&(q.formatting="link-string");var me=g(q);return q.linkHref=!1,me}return j.match(b[z]),q.linkHref=!0,g(q)}}function M(z,j){return z.match(/^([^\]\\]|\\.)*\]:/,!1)?(j.f=G,z.next(),k.highlightFormatting&&(j.formatting="link"),j.linkText=!0,g(j)):l(z,j,u)}function G(z,j){if(z.match(/^\]:/,!0)){j.f=j.inline=X,k.highlightFormatting&&(j.formatting="link");var q=g(j);return j.linkText=!1,q}return z.match(/^([^\]\\]|\\.)+/,!0),H.linkText}function X(z,j){return z.eatSpace()?null:(z.match(/^[^\s]+/,!0),z.peek()===void 0?j.linkTitle=!0:z.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),j.f=j.inline=u,H.linkHref+" url")}var Q={startState:function(){return{f:p,prevLine:{stream:null},thisLine:{stream:null},block:p,htmlState:null,indentation:0,inline:u,text:c,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(z){return{f:z.f,prevLine:z.prevLine,thisLine:z.thisLine,block:z.block,htmlState:z.htmlState&&oe.copyState(Y,z.htmlState),indentation:z.indentation,localMode:z.localMode,localState:z.localMode?oe.copyState(z.localMode,z.localState):null,inline:z.inline,text:z.text,formatting:!1,linkText:z.linkText,linkTitle:z.linkTitle,linkHref:z.linkHref,code:z.code,em:z.em,strong:z.strong,strikethrough:z.strikethrough,emoji:z.emoji,header:z.header,setext:z.setext,hr:z.hr,taskList:z.taskList,list:z.list,listStack:z.listStack.slice(0),quote:z.quote,indentedCode:z.indentedCode,trailingSpace:z.trailingSpace,trailingSpaceNewLine:z.trailingSpaceNewLine,md_inside:z.md_inside,fencedEndRE:z.fencedEndRE}},token:function(z,j){if(j.formatting=!1,z!=j.thisLine.stream){if(j.header=0,j.hr=!1,z.match(/^\s*$/,!0))return f(j),null;if(j.prevLine=j.thisLine,j.thisLine={stream:z},j.taskList=!1,j.trailingSpace=0,j.trailingSpaceNewLine=!1,!j.localState&&(j.f=j.block,j.f!=D)){var q=z.match(/^\s*/,!0)[0].replace(/\t/g,o).length;if(j.indentation=q,j.indentationDiff=null,q>0)return null}}return j.f(z,j)},innerMode:function(z){return z.block==D?{state:z.htmlState,mode:Y}:z.localState?{state:z.localState,mode:z.localMode}:{state:z,mode:Q}},indent:function(z,j,q){return z.block==D&&Y.indent?Y.indent(z.htmlState,j,q):z.localState&&z.localMode.indent?z.localMode.indent(z.localState,j,q):oe.Pass},blankLine:f,getType:g,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return Q},"xml"),oe.defineMIME("text/markdown","markdown"),oe.defineMIME("text/x-markdown","markdown")})},m7e3:function(Ct,st,ne){Ct.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(Ct,st,ne){(function(oe){oe(ne("VrN/"))})(function(oe){"use strict";var Z=oe.Pos;function k(d,o){return d.line-o.line||d.ch-o.ch}var Y="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",P=Y+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",I=new RegExp("<(/?)(["+Y+"]["+P+"]*)","g");function H(d,o,l,h){this.line=o,this.ch=l,this.cm=d,this.text=d.getLine(o),this.min=h?Math.max(h.from,d.firstLine()):d.firstLine(),this.max=h?Math.min(h.to-1,d.lastLine()):d.lastLine()}function U(d,o){var l=d.cm.getTokenTypeAt(Z(d.line,o));return l&&/\btag\b/.test(l)}function O(d){return d.line>=d.max?void 0:(d.ch=0,d.text=d.cm.getLine(++d.line),!0)}function R(d){return d.line<=d.min?void 0:(d.text=d.cm.getLine(--d.line),d.ch=d.text.length,!0)}function y(d){for(;;){var o=d.text.indexOf(">",d.ch);if(o==-1){if(O(d))continue;return}if(!U(d,o+1)){d.ch=o+1;continue}var l=d.text.lastIndexOf("/",o),h=l>-1&&!/\S/.test(d.text.slice(l+1,o));return d.ch=o+1,h?"selfClose":"regular"}}function w(d){for(;;){var o=d.ch?d.text.lastIndexOf("<",d.ch-1):-1;if(o==-1){if(R(d))continue;return}if(!U(d,o+1)){d.ch=o;continue}I.lastIndex=o,d.ch=o;var l=I.exec(d.text);if(l&&l.index==o)return l}}function _(d){for(;;){I.lastIndex=d.ch;var o=I.exec(d.text);if(!o){if(O(d))continue;return}if(!U(d,o.index+1)){d.ch=o.index+1;continue}return d.ch=o.index+o[0].length,o}}function L(d){for(;;){var o=d.ch?d.text.lastIndexOf(">",d.ch-1):-1;if(o==-1){if(R(d))continue;return}if(!U(d,o+1)){d.ch=o;continue}var l=d.text.lastIndexOf("/",o),h=l>-1&&!/\S/.test(d.text.slice(l+1,o));return d.ch=o+1,h?"selfClose":"regular"}}function A(d,o){for(var l=[];;){var h=_(d),T,f=d.line,p=d.ch-(h?h[0].length:0);if(!h||!(T=y(d)))return;if(T=="selfClose")continue;if(h[1]){for(var D=l.length-1;D>=0;--D)if(l[D]==h[2]){l.length=D;break}if(D<0&&(!o||o==h[2]))return{tag:h[2],from:Z(f,p),to:Z(d.line,d.ch)}}else l.push(h[2])}}function C(d,o){for(var l=[];;){var h=L(d);if(!h)return;if(h=="selfClose"){w(d);continue}var T=d.line,f=d.ch,p=w(d);if(!p)return;if(p[1])l.push(p[2]);else{for(var D=l.length-1;D>=0;--D)if(l[D]==p[2]){l.length=D;break}if(D<0&&(!o||o==p[2]))return{tag:p[2],from:Z(d.line,d.ch),to:Z(T,f)}}}}oe.registerHelper("fold","xml",function(d,o){for(var l=new H(d,o.line,0);;){var h=_(l);if(!h||l.line!=o.line)return;var T=y(l);if(!T)return;if(!h[1]&&T!="selfClose"){var f=Z(l.line,l.ch),p=A(l,h[2]);return p&&k(p.from,f)>0?{from:f,to:p.from}:null}}}),oe.findMatchingTag=function(d,o,l){var h=new H(d,o.line,o.ch,l);if(h.text.indexOf(">")==-1&&h.text.indexOf("<")==-1)return;var T=y(h),f=T&&Z(h.line,h.ch),p=T&&w(h);if(!T||!p||k(h,o)>0)return;var D={from:Z(h.line,h.ch),to:f,tag:p[2]};return T=="selfClose"?{open:D,close:null,at:"open"}:p[1]?{open:C(h,p[2]),close:D,at:"close"}:(h=new H(d,f.line,f.ch,l),{open:D,close:A(h,p[2]),at:"open"})},oe.findEnclosingTag=function(d,o,l,h){for(var T=new H(d,o.line,o.ch,l);;){var f=C(T,h);if(!f)break;var p=new H(d,o.line,o.ch,l),D=A(p,f.tag);if(D)return{open:f,close:D}}},oe.scanForClosingTag=function(d,o,l,h){var T=new H(d,o.line,o.ch,h?{from:0,to:h}:null);return A(T,l)}})},p5ED:function(Ct,st,ne){"use strict";var oe=ne("+L6B"),Z=ne("2/Rp"),k=ne("5Dmo"),Y=ne("3S7+"),P=ne("k1fw"),I=ne("9og8"),H=ne("tJVT"),U=ne("WmNS"),O=ne.n(U),R=ne("q1tI"),y=ne.n(R),w=ne("vHTk"),_=ne.n(w),L=ne("yEEn"),A=ne("ZW9T"),C=ne("1vsH"),d=ne("V0Rq"),o=ne("m3rI"),l=function(T){var f=T.name,p=T.data,D=T.theme,E=T.type,g=T.filename,c=T.monacoEditor,u=T.className,a=T.style,x=T.close,b=T.onClose,v=T.hasMask,M=T.otherData,G=M===void 0?{}:M,X=Object(R.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),Q=Object(H.a)(X,2),z=Q[0],j=Q[1],q=Object(R.useState)(""),le=Object(H.a)(q,2),me=le[0],be=le[1],Be=Object(R.useState)(),Le=Object(H.a)(Be,2),De=Le[0],de=Le[1],pe=window.ENV==="build"?"/react/build/office.html":"/office.html",ae,re=1024*1024,we=10*re,ve=Object(R.useRef)();E==="office"&&(ae=Object(C.R)(p).filesize,ae>we&&(E="other")),g&&(c.filename=g),Object(R.useEffect)(function(){var Ee,_e,Ie=(Ee=document.cookie)===null||Ee===void 0||((_e=Ee.replace(/\s/g,""))===null||_e===void 0)?void 0:_e.split(";");Ie==null||Ie.map(function(Ve){var Ue=Ve.split("=");Ue[0]==="_educoder_session"&&be(Ue[1])})},[]),Object(R.useEffect)(function(){E==="office"&&Re()},[E]);var Re=function(){var Ee=Object(I.a)(O.a.mark(function _e(){var Ie,Ve,Ue;return O.a.wrap(function(Pe){for(;;)switch(Pe.prev=Pe.next){case 0:return console.log("data:",p),Ie=p,p.startsWith("http")||(Ie=location.origin+Ie),Ve=new URL(Ie).pathname.split("/").pop(),Pe.next=6,Object(d.U)({attachment_id:Ve});case 6:Ue=Pe.sent,de(Ue);case 8:case"end":return Pe.stop()}},_e)}));return function(){return Ee.apply(this,arguments)}}(),Ae=function(){if(p.startsWith("http")||p.startsWith("blob:")){Oe();return}Object(C.x)(g||"educoder",p,g)},Oe=function(){Object(C.v)(g||"educoder",decodeURIComponent(p))};return y.a.createElement("div",{style:Object(P.a)({},a||{}),className:"".concat(v&&_.a.bgBlack," ").concat(E?_.a.wrp:"hide")},x&&y.a.createElement("div",{className:_.a.close,ref:ve},y.a.createElement(Y.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return ve.current}},y.a.createElement("span",{onClick:Oe},y.a.createElement("i",{className:"icon-quxiaozhiding"}))),y.a.createElement(Y.a,{title:"\u5173\u95ED",getPopupContainer:function(){return ve.current}},y.a.createElement("span",{className:"",onClick:function(){b(),de(null)}},y.a.createElement("i",{className:"icon-guanbi1"})))),y.a.createElement("div",{className:"".concat(_.a[u]," ").concat(u," ").concat(_.a.monaco," ").concat(E==="txt"?"show":"hide")},E==="txt"&&y.a.createElement(A.b,c)),E==="audio"&&y.a.createElement("audio",{src:"".concat((p==null?void 0:p.indexOf("http://"))>-1||(p==null?void 0:p.indexOf("https://"))>-1?"":"data:audio/mp3;base64,").concat(p),autoPlay:!0}),E==="video"&&y.a.createElement(y.a.Fragment,null,(p==null?void 0:p.indexOf("/api"))>-1?y.a.createElement("video",{controls:!0,src:"".concat(p),autoPlay:!0}):y.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(p),autoPlay:!0})),E==="office"&&De&&y.a.createElement("iframe",{src:"".concat(pe,"?key=").concat(De.key,"&url=").concat(o.a.API_SERVER+De.url,"&callbackUrl=").concat(o.a.API_SERVER+De.callbackUrl,"&fileType=").concat(De.fileType,"&title=").concat(De.title,"&model=view")}),(E==="xlsx"||E==="doc"||E==="pptx"||E==="docx")&&y.a.createElement("iframe",{src:"".concat(pe,"?key=").concat(G.key,"&url=").concat(o.a.API_SERVER+G.url,"&callbackUrl=").concat(o.a.API_SERVER+G.callbackUrl,"&fileType=").concat(G.fileType,"&title=").concat(G.title,"&model=").concat(G.model)}),E==="html"&&y.a.createElement("iframe",{src:p+"&disposition=inline"}),E==="pdf"&&y.a.createElement("embed",{className:_.a.embed,src:p,type:"application/pdf"}),E==="image"&&y.a.createElement("img",{src:"".concat((p==null?void 0:p.indexOf("http://"))>-1||(p==null?void 0:p.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(p)}),E==="other"&&y.a.createElement("div",null,y.a.createElement(Z.a,{type:"primary",size:"large",onClick:Ae},y.a.createElement(L.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),E==="download"&&y.a.createElement(Z.a,{type:"primary",size:"large",onClick:Ae},y.a.createElement(L.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))};st.a=l},"p77/":function(Ct,st,ne){},"rAM+":function(Ct,st,ne){"use strict";ne.d(st,"a",function(){return Z});var oe=ne("Qw5x");function Z(k,Y){var P;if(typeof Symbol=="undefined"||k[Symbol.iterator]==null){if(Array.isArray(k)||(P=Object(oe.a)(k))||Y&&k&&typeof k.length=="number"){P&&(k=P);var I=0,H=function(){};return{s:H,n:function(){return I>=k.length?{done:!0}:{done:!1,value:k[I++]}},e:function(w){throw w},f:H}}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 U=!0,O=!1,R;return{s:function(){P=k[Symbol.iterator]()},n:function(){var w=P.next();return U=w.done,w},e:function(w){O=!0,R=w},f:function(){try{!U&&P.return!=null&&P.return()}finally{if(O)throw R}}}}},rUJ1:function(Ct,st){const ne=/[&<>"']/,oe=/[&<>"']/g,Z=/[<>"']|&(?!#?\w+;)/,k=/[<>"']|&(?!#?\w+;)/g,Y={"&":"&","<":"<",">":">",'"':""","'":"'"},P=E=>Y[E];function I(E,g){if(g){if(ne.test(E))return E.replace(oe,P)}else if(Z.test(E))return E.replace(k,P);return E}const H=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function U(E){return E.replace(H,(g,c)=>(c=c.toLowerCase(),c==="colon"?":":c.charAt(0)==="#"?c.charAt(1)==="x"?String.fromCharCode(parseInt(c.substring(2),16)):String.fromCharCode(+c.substring(1)):""))}const O=/(^|[^\[])\^/g;function R(E,g){E=E.source||E,g=g||"";const c={replace:(u,a)=>(a=a.source||a,a=a.replace(O,"$1"),E=E.replace(u,a),c),getRegex:()=>new RegExp(E,g)};return c}const y=/[^\w:]/g,w=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function _(E,g,c){if(E){let u;try{u=decodeURIComponent(U(c)).replace(y,"").toLowerCase()}catch(a){return null}if(u.indexOf("javascript:")===0||u.indexOf("vbscript:")===0||u.indexOf("data:")===0)return null}g&&!w.test(c)&&(c=o(g,c));try{c=encodeURI(c).replace(/%25/g,"%")}catch(u){return null}return c}const L={},A=/^[^:]+:\/*[^/]*$/,C=/^([^:]+:)[\s\S]*$/,d=/^([^:]+:\/*[^/]*)[\s\S]*$/;function o(E,g){L[" "+E]||(A.test(E)?L[" "+E]=E+"/":L[" "+E]=f(E,"/",!0)),E=L[" "+E];const c=E.indexOf(":")===-1;return g.substring(0,2)==="//"?c?g:E.replace(C,"$1")+g:g.charAt(0)==="/"?c?g:E.replace(d,"$1")+g:E+g}const l={exec:function(){}};function h(E){let g=1,c,u;for(;g<arguments.length;g++){c=arguments[g];for(u in c)Object.prototype.hasOwnProperty.call(c,u)&&(E[u]=c[u])}return E}function T(E,g){const c=E.replace(/\|/g,(x,b,v)=>{let M=!1,G=b;for(;--G>=0&&v[G]==="\\";)M=!M;return M?"|":" |"}),u=c.split(/ \|/);let a=0;if(u.length>g)u.splice(g);else for(;u.length<g;)u.push("");for(;a<u.length;a++)u[a]=u[a].trim().replace(/\\\|/g,"|");return u}function f(E,g,c){const u=E.length;if(u===0)return"";let a=0;for(;a<u;){const x=E.charAt(u-a-1);if(x===g&&!c)a++;else if(x!==g&&c)a++;else break}return E.substr(0,u-a)}function p(E,g){if(E.indexOf(g[1])===-1)return-1;const c=E.length;let u=0,a=0;for(;a<c;a++)if(E[a]==="\\")a++;else if(E[a]===g[0])u++;else if(E[a]===g[1]&&(u--,u<0))return a;return-1}function D(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")}Ct.exports={escape:I,unescape:U,edit:R,cleanUrl:_,resolveUrl:o,noopTest:l,merge:h,splitCells:T,rtrim:f,findClosingBracket:p,checkSanitizeDeprecation:D}},uK0f:function(Ct,st,ne){(function(oe,Z){Ct.exports=Z()})(this,function(){"use strict";function oe(Z,k,Y){Y=Y||{},Y.childrenKeyName=Y.childrenKeyName||"children";var P=Z||[],I=[],H=0;do{var U=P.filter(function(O){return k(O,H)})[0];if(!U)break;I.push(U),P=U[Y.childrenKeyName]||[],H+=1}while(P.length>0);return I}return oe})},ulZh:function(Ct,st,ne){typeof window!="undefined"&&function(Z,k){Ct.exports=k()}(this,function(){return function(oe){var Z={};function k(Y){if(Z[Y])return Z[Y].exports;var P=Z[Y]={i:Y,l:!1,exports:{}};return oe[Y].call(P.exports,P,P.exports,k),P.l=!0,P.exports}return k.m=oe,k.c=Z,k.d=function(Y,P,I){k.o(Y,P)||Object.defineProperty(Y,P,{enumerable:!0,get:I})},k.r=function(Y){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(Y,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(Y,"__esModule",{value:!0})},k.t=function(Y,P){if(P&1&&(Y=k(Y)),P&8)return Y;if(P&4&&typeof Y=="object"&&Y&&Y.__esModule)return Y;var I=Object.create(null);if(k.r(I),Object.defineProperty(I,"default",{enumerable:!0,value:Y}),P&2&&typeof Y!="string")for(var H in Y)k.d(I,H,function(U){return Y[U]}.bind(null,H));return I},k.n=function(Y){var P=Y&&Y.__esModule?function(){return Y.default}:function(){return Y};return k.d(P,"a",P),P},k.o=function(Y,P){return Object.prototype.hasOwnProperty.call(Y,P)},k.p="/dist/",k(k.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(oe,Z,k){"use strict";var Y=Object.prototype.hasOwnProperty,P="~";function I(){}Object.create&&(I.prototype=Object.create(null),new I().__proto__||(P=!1));function H(y,w,_){this.fn=y,this.context=w,this.once=_||!1}function U(y,w,_,L,A){if(typeof _!="function")throw new TypeError("The listener must be a function");var C=new H(_,L||y,A),d=P?P+w:w;return y._events[d]?y._events[d].fn?y._events[d]=[y._events[d],C]:y._events[d].push(C):(y._events[d]=C,y._eventsCount++),y}function O(y,w){--y._eventsCount===0?y._events=new I:delete y._events[w]}function R(){this._events=new I,this._eventsCount=0}R.prototype.eventNames=function(){var w=[],_,L;if(this._eventsCount===0)return w;for(L in _=this._events)Y.call(_,L)&&w.push(P?L.slice(1):L);return Object.getOwnPropertySymbols?w.concat(Object.getOwnPropertySymbols(_)):w},R.prototype.listeners=function(w){var _=P?P+w:w,L=this._events[_];if(!L)return[];if(L.fn)return[L.fn];for(var A=0,C=L.length,d=new Array(C);A<C;A++)d[A]=L[A].fn;return d},R.prototype.listenerCount=function(w){var _=P?P+w:w,L=this._events[_];return L?L.fn?1:L.length:0},R.prototype.emit=function(w,_,L,A,C,d){var o=P?P+w:w;if(!this._events[o])return!1;var l=this._events[o],h=arguments.length,T,f;if(l.fn){l.once&&this.removeListener(w,l.fn,void 0,!0);switch(h){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,_),!0;case 3:return l.fn.call(l.context,_,L),!0;case 4:return l.fn.call(l.context,_,L,A),!0;case 5:return l.fn.call(l.context,_,L,A,C),!0;case 6:return l.fn.call(l.context,_,L,A,C,d),!0}for(f=1,T=new Array(h-1);f<h;f++)T[f-1]=arguments[f];l.fn.apply(l.context,T)}else{var p=l.length,D;for(f=0;f<p;f++){l[f].once&&this.removeListener(w,l[f].fn,void 0,!0);switch(h){case 1:l[f].fn.call(l[f].context);break;case 2:l[f].fn.call(l[f].context,_);break;case 3:l[f].fn.call(l[f].context,_,L);break;case 4:l[f].fn.call(l[f].context,_,L,A);break;default:if(!T)for(D=1,T=new Array(h-1);D<h;D++)T[D-1]=arguments[D];l[f].fn.apply(l[f].context,T)}}}return!0},R.prototype.on=function(w,_,L){return U(this,w,_,L,!1)},R.prototype.once=function(w,_,L){return U(this,w,_,L,!0)},R.prototype.removeListener=function(w,_,L,A){var C=P?P+w:w;if(!this._events[C])return this;if(!_)return O(this,C),this;var d=this._events[C];if(d.fn)d.fn===_&&(!A||d.once)&&(!L||d.context===L)&&O(this,C);else{for(var o=0,l=[],h=d.length;o<h;o++)(d[o].fn!==_||A&&!d[o].once||L&&d[o].context!==L)&&l.push(d[o]);l.length?this._events[C]=l.length===1?l[0]:l:O(this,C)}return this},R.prototype.removeAllListeners=function(w){var _;return w?(_=P?P+w:w,this._events[_]&&O(this,_)):(this._events=new I,this._eventsCount=0),this},R.prototype.off=R.prototype.removeListener,R.prototype.addListener=R.prototype.on,R.prefixed=P,R.EventEmitter=R,oe.exports=R},"./node_modules/url-toolkit/src/url-toolkit.js":function(oe,Z,k){(function(Y){var P=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,I=/^([^\/?#]*)([^]*)$/,H=/(?:\/|^)\.(?=\/)/g,U=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,O={buildAbsoluteURL:function(R,y,w){if(w=w||{},R=R.trim(),y=y.trim(),!y){if(!w.alwaysNormalize)return R;var _=O.parseURL(R);if(!_)throw new Error("Error trying to parse base URL.");return _.path=O.normalizePath(_.path),O.buildURLFromParts(_)}var L=O.parseURL(y);if(!L)throw new Error("Error trying to parse relative URL.");if(L.scheme)return w.alwaysNormalize?(L.path=O.normalizePath(L.path),O.buildURLFromParts(L)):y;var A=O.parseURL(R);if(!A)throw new Error("Error trying to parse base URL.");if(!A.netLoc&&A.path&&A.path[0]!=="/"){var C=I.exec(A.path);A.netLoc=C[1],A.path=C[2]}A.netLoc&&!A.path&&(A.path="/");var d={scheme:A.scheme,netLoc:L.netLoc,path:null,params:L.params,query:L.query,fragment:L.fragment};if(!L.netLoc&&(d.netLoc=A.netLoc,L.path[0]!=="/"))if(!L.path)d.path=A.path,L.params||(d.params=A.params,L.query||(d.query=A.query));else{var o=A.path,l=o.substring(0,o.lastIndexOf("/")+1)+L.path;d.path=O.normalizePath(l)}return d.path===null&&(d.path=w.alwaysNormalize?O.normalizePath(L.path):L.path),O.buildURLFromParts(d)},parseURL:function(R){var y=P.exec(R);return y?{scheme:y[1]||"",netLoc:y[2]||"",path:y[3]||"",params:y[4]||"",query:y[5]||"",fragment:y[6]||""}:null},normalizePath:function(R){for(R=R.split("").reverse().join("").replace(H,"");R.length!==(R=R.replace(U,"")).length;);return R.split("").reverse().join("")},buildURLFromParts:function(R){return R.scheme+R.netLoc+R.path+R.params+R.query+R.fragment}};oe.exports=O})(this)},"./node_modules/webworkify-webpack/index.js":function(oe,Z,k){function Y(w){var _={};function L(C){if(_[C])return _[C].exports;var d=_[C]={i:C,l:!1,exports:{}};return w[C].call(d.exports,d,d.exports,L),d.l=!0,d.exports}L.m=w,L.c=_,L.i=function(C){return C},L.d=function(C,d,o){L.o(C,d)||Object.defineProperty(C,d,{configurable:!1,enumerable:!0,get:o})},L.r=function(C){Object.defineProperty(C,"__esModule",{value:!0})},L.n=function(C){var d=C&&C.__esModule?function(){return C.default}:function(){return C};return L.d(d,"a",d),d},L.o=function(C,d){return Object.prototype.hasOwnProperty.call(C,d)},L.p="/",L.oe=function(C){throw console.error(C),C};var A=L(L.s=ENTRY_MODULE);return A.default||A}var P="[\\.|\\-|\\+|\\w|/|@]+",I="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+P+").*?\\)";function H(w){return(w+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function U(w){return!isNaN(1*w)}function O(w,_,L){var A={};A[L]=[];var C=_.toString(),d=C.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!d)return A;for(var o=d[1],l=new RegExp("(\\\\n|\\W)"+H(o)+I,"g"),h;h=l.exec(C);){if(h[3]==="dll-reference")continue;A[L].push(h[3])}for(l=new RegExp("\\("+H(o)+'\\("(dll-reference\\s('+P+'))"\\)\\)'+I,"g");h=l.exec(C);)w[h[2]]||(A[L].push(h[1]),w[h[2]]=k(h[1]).m),A[h[2]]=A[h[2]]||[],A[h[2]].push(h[4]);for(var T=Object.keys(A),f=0;f<T.length;f++)for(var p=0;p<A[T[f]].length;p++)U(A[T[f]][p])&&(A[T[f]][p]=1*A[T[f]][p]);return A}function R(w){var _=Object.keys(w);return _.reduce(function(L,A){return L||w[A].length>0},!1)}function y(w,_){for(var L={main:[_]},A={main:[]},C={main:{}};R(L);)for(var d=Object.keys(L),o=0;o<d.length;o++){var l=d[o],h=L[l],T=h.pop();if(C[l]=C[l]||{},C[l][T]||!w[l][T])continue;C[l][T]=!0,A[l]=A[l]||[],A[l].push(T);for(var f=O(w,w[l][T],l),p=Object.keys(f),D=0;D<p.length;D++)L[p[D]]=L[p[D]]||[],L[p[D]]=L[p[D]].concat(f[p[D]])}return A}oe.exports=function(w,_){_=_||{};var L={main:k.m},A=_.all?{main:Object.keys(L.main)}:y(L,w),C="";Object.keys(A).filter(function(T){return T!=="main"}).forEach(function(T){for(var f=0;A[T][f];)f++;A[T].push(f),L[T][f]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",C=C+"var "+T+" = ("+Y.toString().replace("ENTRY_MODULE",JSON.stringify(f))+")({"+A[T].map(function(p){return""+JSON.stringify(p)+": "+L[T][p].toString()}).join(",")+`});
|
|
`}),C=C+"new (("+Y.toString().replace("ENTRY_MODULE",JSON.stringify(w))+")({"+A.main.map(function(T){return""+JSON.stringify(T)+": "+L.main[T].toString()}).join(",")+"}))(self);";var d=new window.Blob([C],{type:"text/javascript"});if(_.bare)return d;var o=window.URL||window.webkitURL||window.mozURL||window.msURL,l=o.createObjectURL(d),h=new window.Worker(l);return h.objectURL=l,h}},"./src/config.ts":function(oe,Z,k){"use strict";k.r(Z),k.d(Z,"hlsDefaultConfig",function(){return D}),k.d(Z,"mergeConfig",function(){return g}),k.d(Z,"enableStreamingMode",function(){return c});var Y=k("./src/controller/abr-controller.ts"),P=k("./src/controller/audio-stream-controller.ts"),I=k("./src/controller/audio-track-controller.ts"),H=k("./src/controller/subtitle-stream-controller.ts"),U=k("./src/controller/subtitle-track-controller.ts"),O=k("./src/controller/buffer-controller.ts"),R=k("./src/controller/timeline-controller.ts"),y=k("./src/controller/cap-level-controller.ts"),w=k("./src/controller/fps-controller.ts"),_=k("./src/controller/eme-controller.ts"),L=k("./src/controller/cmcd-controller.ts"),A=k("./src/utils/xhr-loader.ts"),C=k("./src/utils/fetch-loader.ts"),d=k("./src/utils/cues.ts"),o=k("./src/utils/mediakeys-helper.ts"),l=k("./src/utils/logger.ts");function h(){return h=Object.assign||function(u){for(var a=1;a<arguments.length;a++){var x=arguments[a];for(var b in x)Object.prototype.hasOwnProperty.call(x,b)&&(u[b]=x[b])}return u},h.apply(this,arguments)}function T(u,a){var x=Object.keys(u);if(Object.getOwnPropertySymbols){var b=Object.getOwnPropertySymbols(u);a&&(b=b.filter(function(v){return Object.getOwnPropertyDescriptor(u,v).enumerable})),x.push.apply(x,b)}return x}function f(u){for(var a=1;a<arguments.length;a++){var x=arguments[a]!=null?arguments[a]:{};a%2?T(Object(x),!0).forEach(function(b){p(u,b,x[b])}):Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(x)):T(Object(x)).forEach(function(b){Object.defineProperty(u,b,Object.getOwnPropertyDescriptor(x,b))})}return u}function p(u,a,x){return a in u?Object.defineProperty(u,a,{value:x,enumerable:!0,configurable:!0,writable:!0}):u[a]=x,u}var D=f(f({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:A.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:Y.default,bufferController:O.default,capLevelController:y.default,fpsController:w.default,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystemOptions:{},requestMediaKeySystemAccessFunc:o.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},E()),{},{subtitleStreamController:H.SubtitleStreamController,subtitleTrackController:U.default,timelineController:R.TimelineController,audioStreamController:P.default,audioTrackController:I.default,emeController:_.default,cmcdController:L.default});function E(){return{cueHandler:d.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 g(u,a){if((a.liveSyncDurationCount||a.liveMaxLatencyDurationCount)&&(a.liveSyncDuration||a.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(a.liveMaxLatencyDurationCount!==void 0&&(a.liveSyncDurationCount===void 0||a.liveMaxLatencyDurationCount<=a.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(a.liveMaxLatencyDuration!==void 0&&(a.liveSyncDuration===void 0||a.liveMaxLatencyDuration<=a.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return h({},u,a)}function c(u){var a=u.loader;if(a!==C.default&&a!==A.default)l.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),u.progressive=!1;else{var x=Object(C.fetchSupported)();x&&(u.loader=C.default,u.progressive=!0,u.enableSoftwareAES=!0,l.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(oe,Z,k){"use strict";k.r(Z);var Y=k("./src/polyfills/number.ts"),P=k("./src/utils/ewma-bandwidth-estimator.ts"),I=k("./src/events.ts"),H=k("./src/utils/buffer-helper.ts"),U=k("./src/errors.ts"),O=k("./src/types/loader.ts"),R=k("./src/utils/logger.ts");function y(L,A){for(var C=0;C<A.length;C++){var d=A[C];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(L,d.key,d)}}function w(L,A,C){return A&&y(L.prototype,A),C&&y(L,C),L}var _=function(){function L(C){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=C;var d=C.config;this.bwEstimator=new P.default(d.abrEwmaSlowVoD,d.abrEwmaFastVoD,d.abrEwmaDefaultEstimate),this.registerListeners()}var A=L.prototype;return A.registerListeners=function(){var d=this.hls;d.on(I.Events.FRAG_LOADING,this.onFragLoading,this),d.on(I.Events.FRAG_LOADED,this.onFragLoaded,this),d.on(I.Events.FRAG_BUFFERED,this.onFragBuffered,this),d.on(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.on(I.Events.ERROR,this.onError,this)},A.unregisterListeners=function(){var d=this.hls;d.off(I.Events.FRAG_LOADING,this.onFragLoading,this),d.off(I.Events.FRAG_LOADED,this.onFragLoaded,this),d.off(I.Events.FRAG_BUFFERED,this.onFragBuffered,this),d.off(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.off(I.Events.ERROR,this.onError,this)},A.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},A.onFragLoading=function(d,o){var l=o.frag;if(l.type===O.PlaylistLevelType.MAIN&&!this.timer){var h;this.fragCurrent=l,this.partCurrent=(h=o.part)!=null?h:null,this.timer=self.setInterval(this.onCheck,100)}},A.onLevelLoaded=function(d,o){var l=this.hls.config;o.details.live?this.bwEstimator.update(l.abrEwmaSlowLive,l.abrEwmaFastLive):this.bwEstimator.update(l.abrEwmaSlowVoD,l.abrEwmaFastVoD)},A._abandonRulesCheck=function(){var d=this.fragCurrent,o=this.partCurrent,l=this.hls,h=l.autoLevelEnabled,T=l.config,f=l.media;if(!d||!f)return;var p=o?o.stats:d.stats,D=o?o.duration:d.duration;if(p.aborted){R.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!h||f.paused||!f.playbackRate||!f.readyState)return;var E=performance.now()-p.loading.start,g=Math.abs(f.playbackRate);if(E<=500*D/g)return;var c=l.levels,u=l.minAutoLevel,a=c[d.level],x=p.total||Math.max(p.loaded,Math.round(D*a.maxBitrate/8)),b=Math.max(1,p.bwEstimate?p.bwEstimate/8:p.loaded*1e3/E),v=(x-p.loaded)/b,M=f.currentTime,G=(H.BufferHelper.bufferInfo(f,M,T.maxBufferHole).end-M)/g;if(G>=2*D/g||v<=G)return;var X=Number.POSITIVE_INFINITY,Q;for(Q=d.level-1;Q>u;Q--){var z=c[Q].maxBitrate;if(X=D*z/(8*.8*b),X<G)break}if(X>=v)return;var j=this.bwEstimator.getEstimate();R.logger.warn("Fragment "+d.sn+(o?" part "+o.index:"")+" of level "+d.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+Q+`
|
|
Current BW estimate: `+(Object(Y.isFiniteNumber)(j)?(j/1024).toFixed(3):"Unknown")+` Kb/s
|
|
Estimated load time for current fragment: `+v.toFixed(3)+` s
|
|
Estimated load time for the next fragment: `+X.toFixed(3)+` s
|
|
Time to underbuffer: `+G.toFixed(3)+" s"),l.nextLoadLevel=Q,this.bwEstimator.sample(E,p.loaded),this.clearTimer(),d.loader&&(this.fragCurrent=this.partCurrent=null,d.loader.abort()),l.trigger(I.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:d,part:o,stats:p})},A.onFragLoaded=function(d,o){var l=o.frag,h=o.part;if(l.type===O.PlaylistLevelType.MAIN&&Object(Y.isFiniteNumber)(l.sn)){var T=h?h.stats:l.stats,f=h?h.duration:l.duration;if(this.clearTimer(),this.lastLoadedFragLevel=l.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var p=this.hls.levels[l.level],D=(p.loaded?p.loaded.bytes:0)+T.loaded,E=(p.loaded?p.loaded.duration:0)+f;p.loaded={bytes:D,duration:E},p.realBitrate=Math.round(8*D/E)}if(l.bitrateTest){var g={stats:T,frag:l,part:h,id:l.type};this.onFragBuffered(I.Events.FRAG_BUFFERED,g),l.bitrateTest=!1}}},A.onFragBuffered=function(d,o){var l=o.frag,h=o.part,T=h?h.stats:l.stats;if(T.aborted)return;if(l.type!==O.PlaylistLevelType.MAIN||l.sn==="initSegment")return;var f=T.parsing.end-T.loading.start;this.bwEstimator.sample(f,T.loaded),T.bwEstimate=this.bwEstimator.getEstimate(),l.bitrateTest?this.bitrateTestDelay=f/1e3:this.bitrateTestDelay=0},A.onError=function(d,o){switch(o.details){case U.ErrorDetails.FRAG_LOAD_ERROR:case U.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},A.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},A.getNextABRAutoLevel=function(){var d=this.fragCurrent,o=this.partCurrent,l=this.hls,h=l.maxAutoLevel,T=l.config,f=l.minAutoLevel,p=l.media,D=o?o.duration:d?d.duration:0,E=p?p.currentTime:0,g=p&&p.playbackRate!==0?Math.abs(p.playbackRate):1,c=this.bwEstimator?this.bwEstimator.getEstimate():T.abrEwmaDefaultEstimate,u=(H.BufferHelper.bufferInfo(p,E,T.maxBufferHole).end-E)/g,a=this.findBestLevel(c,f,h,u,T.abrBandWidthFactor,T.abrBandWidthUpFactor);if(a>=0)return a;R.logger.trace((u?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var x=D?Math.min(D,T.maxStarvationDelay):T.maxStarvationDelay,b=T.abrBandWidthFactor,v=T.abrBandWidthUpFactor;if(!u){var M=this.bitrateTestDelay;if(M){var G=D?Math.min(D,T.maxLoadingDelay):T.maxLoadingDelay;x=G-M,R.logger.trace("bitrate test took "+Math.round(1e3*M)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*x)+" ms"),b=v=1}}return a=this.findBestLevel(c,f,h,u+x,b,v),Math.max(a,0)},A.findBestLevel=function(d,o,l,h,T,f){for(var p,D=this.fragCurrent,E=this.partCurrent,g=this.lastLoadedFragLevel,c=this.hls.levels,u=c[g],a=!!(u!=null&&(p=u.details)!==null&&p!==void 0&&p.live),x=u==null?void 0:u.codecSet,b=E?E.duration:D?D.duration:0,v=l;v>=o;v--){var M=c[v];if(!M||x&&M.codecSet!==x)continue;var G=M.details,X=(E?G==null?void 0:G.partTarget:G==null?void 0:G.averagetargetduration)||b,Q=void 0;v<=g?Q=T*d:Q=f*d;var z=c[v].maxBitrate,j=z*X/Q;if(R.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+v+"/"+Math.round(Q)+"/"+z+"/"+X+"/"+h+"/"+j),Q>z&&(!j||a&&!this.bitrateTestDelay||j<h))return v}return-1},w(L,[{key:"nextAutoLevel",get:function(){var d=this._nextAutoLevel,o=this.bwEstimator;if(d!==-1&&(!o||!o.canEstimate()))return d;var l=this.getNextABRAutoLevel();return d!==-1&&(l=Math.min(d,l)),l},set:function(d){this._nextAutoLevel=d}}]),L}();Z.default=_},"./src/controller/audio-stream-controller.ts":function(oe,Z,k){"use strict";k.r(Z);var Y=k("./src/polyfills/number.ts"),P=k("./src/controller/base-stream-controller.ts"),I=k("./src/events.ts"),H=k("./src/utils/buffer-helper.ts"),U=k("./src/controller/fragment-tracker.ts"),O=k("./src/types/level.ts"),R=k("./src/types/loader.ts"),y=k("./src/loader/fragment.ts"),w=k("./src/demux/chunk-cache.ts"),_=k("./src/demux/transmuxer-interface.ts"),L=k("./src/types/transmuxer.ts"),A=k("./src/controller/fragment-finders.ts"),C=k("./src/utils/discontinuities.ts"),d=k("./src/errors.ts"),o=k("./src/utils/logger.ts");function l(){return l=Object.assign||function(D){for(var E=1;E<arguments.length;E++){var g=arguments[E];for(var c in g)Object.prototype.hasOwnProperty.call(g,c)&&(D[c]=g[c])}return D},l.apply(this,arguments)}function h(D,E){D.prototype=Object.create(E.prototype),D.prototype.constructor=D,T(D,E)}function T(D,E){return T=Object.setPrototypeOf||function(c,u){return c.__proto__=u,c},T(D,E)}var f=100,p=function(D){h(E,D);function E(c,u){var a;return a=D.call(this,c,u,"[audio-stream-controller]")||this,a.videoBuffer=null,a.videoTrackCC=-1,a.waitingVideoCC=-1,a.audioSwitch=!1,a.trackId=-1,a.waitingData=null,a.mainDetails=null,a.bufferFlushed=!1,a._registerListeners(),a}var g=E.prototype;return g.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},g._registerListeners=function(){var u=this.hls;u.on(I.Events.MEDIA_ATTACHED,this.onMediaAttached,this),u.on(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.on(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.on(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.on(I.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),u.on(I.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),u.on(I.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),u.on(I.Events.ERROR,this.onError,this),u.on(I.Events.BUFFER_RESET,this.onBufferReset,this),u.on(I.Events.BUFFER_CREATED,this.onBufferCreated,this),u.on(I.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),u.on(I.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),u.on(I.Events.FRAG_BUFFERED,this.onFragBuffered,this)},g._unregisterListeners=function(){var u=this.hls;u.off(I.Events.MEDIA_ATTACHED,this.onMediaAttached,this),u.off(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.off(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.off(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.off(I.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),u.off(I.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),u.off(I.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),u.off(I.Events.ERROR,this.onError,this),u.off(I.Events.BUFFER_RESET,this.onBufferReset,this),u.off(I.Events.BUFFER_CREATED,this.onBufferCreated,this),u.off(I.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),u.off(I.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),u.off(I.Events.FRAG_BUFFERED,this.onFragBuffered,this)},g.onInitPtsFound=function(u,a){var x=a.frag,b=a.id,v=a.initPTS;if(b==="main"){var M=x.cc;this.initPTS[x.cc]=v,this.log("InitPTS for cc: "+M+" found from main: "+v),this.videoTrackCC=M,this.state===P.State.WAITING_INIT_PTS&&this.tick()}},g.startLoad=function(u){if(!this.levels){this.startPosition=u,this.state=P.State.STOPPED;return}var a=this.lastCurrentTime;this.stopLoad(),this.setInterval(f),this.fragLoadError=0,a>0&&u===-1?(this.log("Override startPosition with lastCurrentTime @"+a.toFixed(3)),this.state=P.State.IDLE):(this.loadedmetadata=!1,this.state=P.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=u,this.tick()},g.doTick=function(){switch(this.state){case P.State.IDLE:this.doTickIdle();break;case P.State.WAITING_TRACK:{var u,a=this.levels,x=this.trackId,b=a==null||((u=a[x])===null||u===void 0)?void 0:u.details;if(b){if(this.waitForCdnTuneIn(b))break;this.state=P.State.WAITING_INIT_PTS}break}case P.State.FRAG_LOADING_WAITING_RETRY:{var v,M=performance.now(),G=this.retryDate;(!G||M>=G||(v=this.media)!==null&&v!==void 0&&v.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=P.State.IDLE);break}case P.State.WAITING_INIT_PTS:{var X=this.waitingData;if(X){var Q=X.frag,z=X.part,j=X.cache,q=X.complete;if(this.initPTS[Q.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=P.State.FRAG_LOADING;var le=j.flush(),me={frag:Q,part:z,payload:le,networkDetails:null};this._handleFragmentLoadProgress(me),q&&D.prototype._handleFragmentLoadComplete.call(this,me)}else if(this.videoTrackCC!==this.waitingVideoCC)o.logger.log("Waiting fragment cc ("+Q.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var be=this.getLoadPosition(),Be=H.BufferHelper.bufferInfo(this.mediaBuffer,be,this.config.maxBufferHole),Le=Object(A.fragmentWithinToleranceTest)(Be.end,this.config.maxFragLookUpTolerance,Q);Le<0&&(o.logger.log("Waiting fragment cc ("+Q.cc+") @ "+Q.start+" cancelled because another fragment at "+Be.end+" is needed"),this.clearWaitingFragment())}}else this.state=P.State.IDLE}}this.onTickEnd()},g.clearWaitingFragment=function(){var u=this.waitingData;u&&(this.fragmentTracker.removeFragment(u.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=P.State.IDLE)},g.onTickEnd=function(){var u=this.media;if(!u||!u.readyState)return;var a=this.mediaBuffer?this.mediaBuffer:u,x=a.buffered;!this.loadedmetadata&&x.length&&(this.loadedmetadata=!0),this.lastCurrentTime=u.currentTime},g.doTickIdle=function(){var u,a,x=this.hls,b=this.levels,v=this.media,M=this.trackId,G=x.config;if(!b||!b[M])return;if(!v&&(this.startFragRequested||!G.startFragPrefetch))return;var X=b[M],Q=X.details;if(!Q||Q.live&&this.levelLastLoaded!==M||this.waitForCdnTuneIn(Q)){this.state=P.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,y.ElementaryStreamTypes.AUDIO,R.PlaylistLevelType.AUDIO));var z=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,R.PlaylistLevelType.AUDIO);if(z===null)return;var j=z.len,q=this.getMaxBufferLength(),le=this.audioSwitch;if(j>=q&&!le)return;if(!le&&this._streamEnded(z,Q)){x.trigger(I.Events.BUFFER_EOS,{type:"audio"}),this.state=P.State.ENDED;return}var me=Q.fragments,be=me[0].start,Be=z.end;if(le){var Le=this.getLoadPosition();Be=Le,Q.PTSKnown&&Le<be&&((z.end>be||z.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),v.currentTime=be+.05))}var De=this.getNextFragment(Be,Q);if(!De){this.bufferFlushed=!0;return}((u=De.decryptdata)===null||u===void 0?void 0:u.keyFormat)==="identity"&&!((a=De.decryptdata)!==null&&a!==void 0&&a.key)?this.loadKey(De,Q):this.loadFragment(De,Q,Be)},g.getMaxBufferLength=function(){var u=D.prototype.getMaxBufferLength.call(this),a=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,R.PlaylistLevelType.MAIN);return a===null?u:Math.max(u,a.len)},g.onMediaDetaching=function(){this.videoBuffer=null,D.prototype.onMediaDetaching.call(this)},g.onAudioTracksUpdated=function(u,a){var x=a.audioTracks;this.resetTransmuxer(),this.levels=x.map(function(b){return new O.Level(b)})},g.onAudioTrackSwitching=function(u,a){var x=!!a.url;this.trackId=a.id;var b=this.fragCurrent;b!=null&&b.loader&&b.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),x?this.setInterval(f):this.resetTransmuxer(),x?(this.audioSwitch=!0,this.state=P.State.IDLE):this.state=P.State.STOPPED,this.tick()},g.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},g.onLevelLoaded=function(u,a){this.mainDetails=a.details},g.onAudioTrackLoaded=function(u,a){var x,b=this.levels,v=a.details,M=a.id;if(!b){this.warn("Audio tracks were reset while loading level "+M);return}this.log("Track "+M+" loaded ["+v.startSN+","+v.endSN+"],duration:"+v.totalduration);var G=b[M],X=0;if(v.live||(x=G.details)!==null&&x!==void 0&&x.live){var Q=this.mainDetails;if(v.fragments[0]||(v.deltaUpdateFailed=!0),v.deltaUpdateFailed||!Q)return;!G.details&&v.hasProgramDateTime&&Q.hasProgramDateTime?(Object(C.alignMediaPlaylistByPDT)(v,Q),X=v.fragments[0].start):X=this.alignPlaylists(v,G.details)}G.details=v,this.levelLastLoaded=M,!this.startFragRequested&&(this.mainDetails||!v.live)&&this.setStartPosition(G.details,X),this.state===P.State.WAITING_TRACK&&!this.waitForCdnTuneIn(v)&&(this.state=P.State.IDLE),this.tick()},g._handleFragmentLoadProgress=function(u){var a,x=u.frag,b=u.part,v=u.payload,M=this.config,G=this.trackId,X=this.levels;if(!X){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+x.sn+" of level "+x.level+" will not be buffered");return}var Q=X[G];console.assert(Q,"Audio track is defined on fragment load progress");var z=Q.details;console.assert(z,"Audio track details are defined on fragment load progress");var j=M.defaultAudioCodec||Q.audioCodec||"mp4a.40.2",q=this.transmuxer;q||(q=this.transmuxer=new _.default(this.hls,R.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var le=this.initPTS[x.cc],me=(a=x.initSegment)===null||a===void 0?void 0:a.data;if(le!==void 0){var be=!1,Be=b?b.index:-1,Le=Be!==-1,De=new L.ChunkMetadata(x.level,x.sn,x.stats.chunkCount,v.byteLength,Be,Le);q.push(v,me,j,"",x,b,z.totalduration,be,De,le)}else{o.logger.log("Unknown video PTS for cc "+x.cc+", waiting for video PTS before demuxing audio frag "+x.sn+" of ["+z.startSN+" ,"+z.endSN+"],track "+G);var de=this.waitingData=this.waitingData||{frag:x,part:b,cache:new w.default,complete:!1},pe=de.cache;pe.push(new Uint8Array(v)),this.waitingVideoCC=this.videoTrackCC,this.state=P.State.WAITING_INIT_PTS}},g._handleFragmentLoadComplete=function(u){if(this.waitingData){this.waitingData.complete=!0;return}D.prototype._handleFragmentLoadComplete.call(this,u)},g.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},g.onBufferCreated=function(u,a){var x=a.tracks.audio;x&&(this.mediaBuffer=x.buffer),a.tracks.video&&(this.videoBuffer=a.tracks.video.buffer)},g.onFragBuffered=function(u,a){var x=a.frag,b=a.part;if(x.type!==R.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(x)){this.warn("Fragment "+x.sn+(b?" p: "+b.index:"")+" of level "+x.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}x.sn!=="initSegment"&&(this.fragPrevious=x,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(I.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(x,b)},g.onError=function(u,a){switch(a.details){case d.ErrorDetails.FRAG_LOAD_ERROR:case d.ErrorDetails.FRAG_LOAD_TIMEOUT:case d.ErrorDetails.KEY_LOAD_ERROR:case d.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(R.PlaylistLevelType.AUDIO,a);break;case d.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case d.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==P.State.ERROR&&this.state!==P.State.STOPPED&&(this.state=a.fatal?P.State.ERROR:P.State.IDLE,this.warn(a.details+" while loading frag, switching to "+this.state+" state"));break;case d.ErrorDetails.BUFFER_FULL_ERROR:if(a.parent==="audio"&&(this.state===P.State.PARSING||this.state===P.State.PARSED)){var x=!0,b=this.getFwdBufferInfo(this.mediaBuffer,R.PlaylistLevelType.AUDIO);b&&b.len>.5&&(x=!this.reduceMaxBufferLength(b.len)),x&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,D.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},g.onBufferFlushed=function(u,a){var x=a.type;x===y.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},g._handleTransmuxComplete=function(u){var a,x="audio",b=this.hls,v=u.remuxResult,M=u.chunkMeta,G=this.getCurrentContext(M);if(!G){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 X=G.frag,Q=G.part,z=v.audio,j=v.text,q=v.id3,le=v.initSegment;if(this.fragContextChanged(X))return;if(this.state=P.State.PARSING,this.audioSwitch&&z&&this.completeAudioSwitch(),le!=null&&le.tracks&&(this._bufferInitSegment(le.tracks,X,M),b.trigger(I.Events.FRAG_PARSING_INIT_SEGMENT,{frag:X,id:x,tracks:le.tracks})),z){var me=z.startPTS,be=z.endPTS,Be=z.startDTS,Le=z.endDTS;Q&&(Q.elementaryStreams[y.ElementaryStreamTypes.AUDIO]={startPTS:me,endPTS:be,startDTS:Be,endDTS:Le}),X.setElementaryStreamInfo(y.ElementaryStreamTypes.AUDIO,me,be,Be,Le),this.bufferFragmentData(z,X,Q,M)}if(q!=null&&(a=q.samples)!==null&&a!==void 0&&a.length){var De=l({frag:X,id:x},q);b.trigger(I.Events.FRAG_PARSING_METADATA,De)}if(j){var de=l({frag:X,id:x},j);b.trigger(I.Events.FRAG_PARSING_USERDATA,de)}},g._bufferInitSegment=function(u,a,x){if(this.state!==P.State.PARSING)return;u.video&&delete u.video;var b=u.audio;if(!b)return;b.levelCodec=b.codec,b.id="audio",this.log("Init audio buffer, container:"+b.container+", codecs[parsed]=["+b.codec+"]"),this.hls.trigger(I.Events.BUFFER_CODECS,u);var v=b.initSegment;if(v!=null&&v.byteLength){var M={type:"audio",frag:a,part:null,chunkMeta:x,parent:a.type,data:v};this.hls.trigger(I.Events.BUFFER_APPENDING,M)}this.tick()},g.loadFragment=function(u,a,x){var b=this.fragmentTracker.getState(u);this.fragCurrent=u,(this.audioSwitch||b===U.FragmentState.NOT_LOADED||b===U.FragmentState.PARTIAL)&&(u.sn==="initSegment"?this._loadInitSegment(u):a.live&&!Object(Y.isFiniteNumber)(this.initPTS[u.cc])?(this.log("Waiting for video PTS in continuity counter "+u.cc+" of live stream before loading audio fragment "+u.sn+" of level "+this.trackId),this.state=P.State.WAITING_INIT_PTS):(this.startFragRequested=!0,D.prototype.loadFragment.call(this,u,a,x)))},g.completeAudioSwitch=function(){var u=this.hls,a=this.media,x=this.trackId;a&&(this.log("Switching audio track : flushing all audio"),D.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,u.trigger(I.Events.AUDIO_TRACK_SWITCHED,{id:x})},E}(P.default);Z.default=p},"./src/controller/audio-track-controller.ts":function(oe,Z,k){"use strict";k.r(Z);var Y=k("./src/events.ts"),P=k("./src/errors.ts"),I=k("./src/controller/base-playlist-controller.ts"),H=k("./src/types/loader.ts");function U(_,L){for(var A=0;A<L.length;A++){var C=L[A];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(_,C.key,C)}}function O(_,L,A){return L&&U(_.prototype,L),A&&U(_,A),_}function R(_,L){_.prototype=Object.create(L.prototype),_.prototype.constructor=_,y(_,L)}function y(_,L){return y=Object.setPrototypeOf||function(C,d){return C.__proto__=d,C},y(_,L)}var w=function(_){R(L,_);function L(C){var d;return d=_.call(this,C,"[audio-track-controller]")||this,d.tracks=[],d.groupId=null,d.tracksInGroup=[],d.trackId=-1,d.trackName="",d.selectDefaultTrack=!0,d.registerListeners(),d}var A=L.prototype;return A.registerListeners=function(){var d=this.hls;d.on(Y.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.on(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.on(Y.Events.LEVEL_LOADING,this.onLevelLoading,this),d.on(Y.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),d.on(Y.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.on(Y.Events.ERROR,this.onError,this)},A.unregisterListeners=function(){var d=this.hls;d.off(Y.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.off(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.off(Y.Events.LEVEL_LOADING,this.onLevelLoading,this),d.off(Y.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),d.off(Y.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.off(Y.Events.ERROR,this.onError,this)},A.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,_.prototype.destroy.call(this)},A.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},A.onManifestParsed=function(d,o){this.tracks=o.audioTracks||[]},A.onAudioTrackLoaded=function(d,o){var l=o.id,h=o.details,T=this.tracksInGroup[l];if(!T){this.warn("Invalid audio track id "+l);return}var f=T.details;T.details=o.details,this.log("audioTrack "+l+" loaded ["+h.startSN+"-"+h.endSN+"]"),l===this.trackId&&(this.retryCount=0,this.playlistLoaded(l,o,f))},A.onLevelLoading=function(d,o){this.switchLevel(o.level)},A.onLevelSwitching=function(d,o){this.switchLevel(o.level)},A.switchLevel=function(d){var o=this.hls.levels[d];if(!(o!=null&&o.audioGroupIds))return;var l=o.audioGroupIds[o.urlId];if(this.groupId!==l){this.groupId=l;var h=this.tracks.filter(function(f){return!l||f.groupId===l});this.selectDefaultTrack&&!h.some(function(f){return f.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=h;var T={audioTracks:h};this.log("Updating audio tracks, "+h.length+' track(s) found in "'+l+'" group-id'),this.hls.trigger(Y.Events.AUDIO_TRACKS_UPDATED,T),this.selectInitialTrack()}},A.onError=function(d,o){if(_.prototype.onError.call(this,d,o),o.fatal||!o.context)return;o.context.type===H.PlaylistContextType.AUDIO_TRACK&&o.context.id===this.trackId&&o.context.groupId===this.groupId&&this.retryLoadingOrFail(o)},A.setAudioTrack=function(d){var o=this.tracksInGroup;if(d<0||d>=o.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var l=o[this.trackId];this.log("Now switching to audio-track index "+d);var h=o[d],T=h.id,f=h.groupId,p=f===void 0?"":f,D=h.name,E=h.type,g=h.url;if(this.trackId=d,this.trackName=D,this.selectDefaultTrack=!1,this.hls.trigger(Y.Events.AUDIO_TRACK_SWITCHING,{id:T,groupId:p,name:D,type:E,url:g}),h.details&&!h.details.live)return;var c=this.switchParams(h.url,l==null?void 0:l.details);this.loadPlaylist(c)},A.selectInitialTrack=function(){var d=this.tracksInGroup;console.assert(d.length,"Initial audio track should be selected when tracks are known");var o=this.trackName,l=this.findTrackId(o)||this.findTrackId();l!==-1?this.setAudioTrack(l):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(Y.Events.ERROR,{type:P.ErrorTypes.MEDIA_ERROR,details:P.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},A.findTrackId=function(d){for(var o=this.tracksInGroup,l=0;l<o.length;l++){var h=o[l];if((!this.selectDefaultTrack||h.default)&&(!d||d===h.name))return h.id}return-1},A.loadPlaylist=function(d){var o=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(o)){var l=o.id,h=o.groupId,T=o.url;if(d)try{T=d.addDirectives(T)}catch(f){this.warn("Could not construct new URL with HLS Delivery Directives: "+f)}this.log("loading audio-track playlist for id: "+l),this.clearTimer(),this.hls.trigger(Y.Events.AUDIO_TRACK_LOADING,{url:T,id:l,groupId:h,deliveryDirectives:d||null})}},O(L,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(d){this.selectDefaultTrack=!1,this.setAudioTrack(d)}}]),L}(I.default);Z.default=w},"./src/controller/base-playlist-controller.ts":function(oe,Z,k){"use strict";k.r(Z),k.d(Z,"default",function(){return O});var Y=k("./src/polyfills/number.ts"),P=k("./src/types/level.ts"),I=k("./src/controller/level-helper.ts"),H=k("./src/utils/logger.ts"),U=k("./src/errors.ts"),O=function(){function R(w,_){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=H.logger.log.bind(H.logger,_+":"),this.warn=H.logger.warn.bind(H.logger,_+":"),this.hls=w}var y=R.prototype;return y.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},y.onError=function(_,L){L.fatal&&L.type===U.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},y.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},y.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},y.stopLoad=function(){this.canLoad=!1,this.clearTimer()},y.switchParams=function(_,L){var A=L==null?void 0:L.renditionReports;if(A)for(var C=0;C<A.length;C++){var d=A[C],o=""+d.URI;if(o===_.substr(-o.length)){var l=parseInt(d["LAST-MSN"]),h=parseInt(d["LAST-PART"]);if(L&&this.hls.config.lowLatencyMode){var T=Math.min(L.age-L.partTarget,L.targetduration);h!==void 0&&T>L.partTarget&&(h+=1)}if(Object(Y.isFiniteNumber)(l))return new P.HlsUrlParameters(l,Object(Y.isFiniteNumber)(h)?h:void 0,P.HlsSkip.No)}}},y.loadPlaylist=function(_){},y.shouldLoadTrack=function(_){return this.canLoad&&_&&!!_.url&&(!_.details||_.details.live)},y.playlistLoaded=function(_,L,A){var C=this,d=L.details,o=L.stats,l=o.loading.end?Math.max(0,self.performance.now()-o.loading.end):0;if(d.advancedDateTime=Date.now()-l,d.live||A!=null&&A.live){if(d.reloaded(A),A&&this.log("live playlist "+_+" "+(d.advanced?"REFRESHED "+d.lastPartSn+"-"+d.lastPartIndex:"MISSED")),A&&d.fragments.length>0&&Object(I.mergeDetails)(A,d),!this.canLoad||!d.live)return;var h,T=void 0,f=void 0;if(d.canBlockReload&&d.endSN&&d.advanced){var p=this.hls.config.lowLatencyMode,D=d.lastPartSn,E=d.endSN,g=d.lastPartIndex,c=g!==-1,u=D===E,a=p?0:g;c?(T=u?E+1:D,f=u?a:g+1):T=E+1;var x=d.age,b=x+d.ageHeader,v=Math.min(b-d.partTarget,d.targetduration*1.5);if(v>0){if(A&&v>A.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+A.tuneInGoal+" to: "+v+" with playlist age: "+d.age),v=0;else{var M=Math.floor(v/d.targetduration);if(T+=M,f!==void 0){var G=Math.round(v%d.targetduration/d.partTarget);f+=G}this.log("CDN Tune-in age: "+d.ageHeader+"s last advanced "+x.toFixed(2)+"s goal: "+v+" skip sn "+M+" to part "+f)}d.tuneInGoal=v}if(h=this.getDeliveryDirectives(d,L.deliveryDirectives,T,f),p||!u){this.loadPlaylist(h);return}}else h=this.getDeliveryDirectives(d,L.deliveryDirectives,T,f);var X=Object(I.computeReloadInterval)(d,o);T!==void 0&&d.canBlockReload&&(X-=d.partTarget||1),this.log("reload live playlist "+_+" in "+Math.round(X)+" ms"),this.timer=self.setTimeout(function(){return C.loadPlaylist(h)},X)}else this.clearTimer()},y.getDeliveryDirectives=function(_,L,A,C){var d=Object(P.getSkipValue)(_,A);return L!=null&&L.skip&&_.deltaUpdateFailed&&(A=L.msn,C=L.part,d=P.HlsSkip.No),new P.HlsUrlParameters(A,C,d)},y.retryLoadingOrFail=function(_){var L=this,A=this.hls.config,C=this.retryCount<A.levelLoadingMaxRetry;if(C){var d;if(this.retryCount++,_.details.indexOf("LoadTimeOut")>-1&&(d=_.context)!==null&&d!==void 0&&d.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+_.details+'"'),this.loadPlaylist();else{var o=Math.min(Math.pow(2,this.retryCount)*A.levelLoadingRetryDelay,A.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return L.loadPlaylist()},o),this.warn("retry playlist loading #"+this.retryCount+" in "+o+' ms after "'+_.details+'"')}}else this.warn('cannot recover from error "'+_.details+'"'),this.clearTimer(),_.fatal=!0;return C},R}()},"./src/controller/base-stream-controller.ts":function(oe,Z,k){"use strict";k.r(Z),k.d(Z,"State",function(){return E}),k.d(Z,"default",function(){return g});var Y=k("./src/polyfills/number.ts"),P=k("./src/task-loop.ts"),I=k("./src/controller/fragment-tracker.ts"),H=k("./src/utils/buffer-helper.ts"),U=k("./src/utils/logger.ts"),O=k("./src/events.ts"),R=k("./src/errors.ts"),y=k("./src/types/transmuxer.ts"),w=k("./src/utils/mp4-tools.ts"),_=k("./src/utils/discontinuities.ts"),L=k("./src/controller/fragment-finders.ts"),A=k("./src/controller/level-helper.ts"),C=k("./src/loader/fragment-loader.ts"),d=k("./src/crypt/decrypter.ts"),o=k("./src/utils/time-ranges.ts"),l=k("./src/types/loader.ts");function h(c,u){for(var a=0;a<u.length;a++){var x=u[a];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(c,x.key,x)}}function T(c,u,a){return u&&h(c.prototype,u),a&&h(c,a),c}function f(c){if(c===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return c}function p(c,u){c.prototype=Object.create(u.prototype),c.prototype.constructor=c,D(c,u)}function D(c,u){return D=Object.setPrototypeOf||function(x,b){return x.__proto__=b,x},D(c,u)}var E={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"},g=function(c){p(u,c);function u(x,b,v){var M;return M=c.call(this)||this,M.hls=void 0,M.fragPrevious=null,M.fragCurrent=null,M.fragmentTracker=void 0,M.transmuxer=null,M._state=E.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=U.logger.log.bind(U.logger,v+":"),M.warn=U.logger.warn.bind(U.logger,v+":"),M.hls=x,M.fragmentLoader=new C.default(x.config),M.fragmentTracker=b,M.config=x.config,M.decrypter=new d.default(x,x.config),x.on(O.Events.KEY_LOADED,M.onKeyLoaded,f(M)),M}var a=u.prototype;return a.doTick=function(){this.onTickEnd()},a.onTickEnd=function(){},a.startLoad=function(b){},a.stopLoad=function(){this.fragmentLoader.abort();var b=this.fragCurrent;b&&this.fragmentTracker.removeFragment(b),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=E.STOPPED},a._streamEnded=function(b,v){var M=this.fragCurrent,G=this.fragmentTracker;if(!v.live&&M&&M.sn===v.endSN&&!b.nextStart){var X=G.getState(M);return X===I.FragmentState.PARTIAL||X===I.FragmentState.OK}return!1},a.onMediaAttached=function(b,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 G=this.config;this.levels&&G.autoStartLoad&&this.state===E.STOPPED&&this.startLoad(G.startPosition)},a.onMediaDetaching=function(){var b=this.media;b!=null&&b.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),b&&(b.removeEventListener("seeking",this.onvseeking),b.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},a.onMediaSeeking=function(){var b=this.config,v=this.fragCurrent,M=this.media,G=this.mediaBuffer,X=this.state,Q=M?M.currentTime:0,z=H.BufferHelper.bufferInfo(G||M,Q,b.maxBufferHole);if(this.log("media seeking to "+(Object(Y.isFiniteNumber)(Q)?Q.toFixed(3):Q)+", state: "+X),X===E.ENDED)this.resetLoadingState();else if(v&&!z.len){var j=b.maxFragLookUpTolerance,q=v.start-j,le=v.start+v.duration+j,me=Q>le;(Q<q||me)&&(me&&v.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),v.loader.abort()),this.resetLoadingState())}M&&(this.lastCurrentTime=Q),!this.loadedmetadata&&!z.len&&(this.nextLoadPosition=this.startPosition=Q),this.tickImmediate()},a.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},a.onKeyLoaded=function(b,v){if(this.state!==E.KEY_LOADING||v.frag!==this.fragCurrent||!this.levels)return;this.state=E.IDLE;var M=this.levels[v.frag.level].details;M&&this.loadFragment(v.frag,M,v.frag.start)},a.onHandlerDestroying=function(){this.stopLoad(),c.prototype.onHandlerDestroying.call(this)},a.onHandlerDestroyed=function(){this.state=E.STOPPED,this.hls.off(O.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,c.prototype.onHandlerDestroyed.call(this)},a.loadKey=function(b,v){this.log("Loading key for "+b.sn+" of ["+v.startSN+"-"+v.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+b.level),this.state=E.KEY_LOADING,this.fragCurrent=b,this.hls.trigger(O.Events.KEY_LOADING,{frag:b})},a.loadFragment=function(b,v,M){this._loadFragForPlayback(b,v,M)},a._loadFragForPlayback=function(b,v,M){var G=this,X=function(z){if(G.fragContextChanged(b)){G.warn("Fragment "+b.sn+(z.part?" p: "+z.part.index:"")+" of level "+b.level+" was dropped during download."),G.fragmentTracker.removeFragment(b);return}b.stats.chunkCount++,G._handleFragmentLoadProgress(z)};this._doFragLoad(b,v,M,X).then(function(Q){if(!Q)return;G.fragLoadError=0;var z=G.state;if(G.fragContextChanged(b)){(z===E.FRAG_LOADING||z===E.BACKTRACKING||!G.fragCurrent&&z===E.PARSING)&&(G.fragmentTracker.removeFragment(b),G.state=E.IDLE);return}if("payload"in Q&&(G.log("Loaded fragment "+b.sn+" of level "+b.level),G.hls.trigger(O.Events.FRAG_LOADED,Q),G.state===E.BACKTRACKING)){G.fragmentTracker.backtrack(b,Q),G.resetFragmentLoading(b);return}G._handleFragmentLoadComplete(Q)}).catch(function(Q){G.warn(Q),G.resetFragmentLoading(b)})},a.flushMainBuffer=function(b,v,M){if(M===void 0&&(M=null),!(b-v))return;var G={startOffset:b,endOffset:v,type:M};this.fragLoadError=0,this.hls.trigger(O.Events.BUFFER_FLUSHING,G)},a._loadInitSegment=function(b){var v=this;this._doFragLoad(b).then(function(M){if(!M||v.fragContextChanged(b)||!v.levels)throw new Error("init load aborted");return M}).then(function(M){var G=v.hls,X=M.payload,Q=b.decryptdata;if(X&&X.byteLength>0&&Q&&Q.key&&Q.iv&&Q.method==="AES-128"){var z=self.performance.now();return v.decrypter.webCryptoDecrypt(new Uint8Array(X),Q.key.buffer,Q.iv.buffer).then(function(j){var q=self.performance.now();return G.trigger(O.Events.FRAG_DECRYPTED,{frag:b,payload:j,stats:{tstart:z,tdecrypt:q}}),M.payload=j,M})}return M}).then(function(M){var G=v.fragCurrent,X=v.hls,Q=v.levels;if(!Q)throw new Error("init load aborted, missing levels");var z=Q[b.level].details;console.assert(z,"Level details are defined when init segment is loaded");var j=b.stats;v.state=E.IDLE,v.fragLoadError=0,b.data=new Uint8Array(M.payload),j.parsing.start=j.buffering.start=self.performance.now(),j.parsing.end=j.buffering.end=self.performance.now(),M.frag===G&&X.trigger(O.Events.FRAG_BUFFERED,{stats:j,frag:G,part:null,id:b.type}),v.tick()}).catch(function(M){v.warn(M),v.resetFragmentLoading(b)})},a.fragContextChanged=function(b){var v=this.fragCurrent;return!b||!v||b.level!==v.level||b.sn!==v.sn||b.urlId!==v.urlId},a.fragBufferedComplete=function(b,v){var M=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+b.type+" sn: "+b.sn+(v?" part: "+v.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+b.level+" "+o.default.toString(H.BufferHelper.getBuffered(M))),this.state=E.IDLE,this.tick()},a._handleFragmentLoadComplete=function(b){var v=this.transmuxer;if(!v)return;var M=b.frag,G=b.part,X=b.partsLoaded,Q=!X||X.length===0||X.some(function(j){return!j}),z=new y.ChunkMetadata(M.level,M.sn,M.stats.chunkCount+1,0,G?G.index:-1,!Q);v.flush(z)},a._handleFragmentLoadProgress=function(b){},a._doFragLoad=function(b,v,M,G){var X=this;if(M===void 0&&(M=null),!this.levels)throw new Error("frag load aborted, missing levels");if(M=Math.max(b.start,M||0),this.config.lowLatencyMode&&v){var Q=v.partList;if(Q&&G){M>b.end&&v.fragmentHint&&(b=v.fragmentHint);var z=this.getNextPart(Q,b,M);if(z>-1){var j=Q[z];return this.log("Loading part sn: "+b.sn+" p: "+j.index+" cc: "+b.cc+" of playlist ["+v.startSN+"-"+v.endSN+"] parts [0-"+z+"-"+(Q.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+b.level+", target: "+parseFloat(M.toFixed(3))),this.nextLoadPosition=j.start+j.duration,this.state=E.FRAG_LOADING,this.hls.trigger(O.Events.FRAG_LOADING,{frag:b,part:Q[z],targetBufferTime:M}),this.doFragPartsLoad(b,Q,z,G).catch(function(q){return X.handleFragLoadError(q)})}else if(!b.url||this.loadedEndOfParts(Q,M))return Promise.resolve(null)}}return this.log("Loading fragment "+b.sn+" cc: "+b.cc+" "+(v?"of ["+v.startSN+"-"+v.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+b.level+", target: "+parseFloat(M.toFixed(3))),Object(Y.isFiniteNumber)(b.sn)&&!this.bitrateTest&&(this.nextLoadPosition=b.start+b.duration),this.state=E.FRAG_LOADING,this.hls.trigger(O.Events.FRAG_LOADING,{frag:b,targetBufferTime:M}),this.fragmentLoader.load(b,G).catch(function(q){return X.handleFragLoadError(q)})},a.doFragPartsLoad=function(b,v,M,G){var X=this;return new Promise(function(Q,z){var j=[],q=function le(me){var be=v[me];X.fragmentLoader.loadPart(b,be,G).then(function(Be){j[be.index]=Be;var Le=Be.part;X.hls.trigger(O.Events.FRAG_LOADED,Be);var De=v[me+1];if(De&&De.fragment===b)le(me+1);else return Q({frag:b,part:Le,partsLoaded:j})}).catch(z)};q(M)})},a.handleFragLoadError=function(b){var v=b.data;return v&&v.details===R.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(v.frag,v.part):this.hls.trigger(O.Events.ERROR,v),null},a._handleTransmuxerFlush=function(b){var v=this.getCurrentContext(b);if(!v||this.state!==E.PARSING){this.fragCurrent||(this.state=E.IDLE);return}var M=v.frag,G=v.part,X=v.level,Q=self.performance.now();M.stats.parsing.end=Q,G&&(G.stats.parsing.end=Q),this.updateLevelTiming(M,G,X,b.partial)},a.getCurrentContext=function(b){var v=this.levels,M=b.level,G=b.sn,X=b.part;if(!v||!v[M])return this.warn("Levels object was unset while buffering fragment "+G+" of level "+M+". The current chunk will not be buffered."),null;var Q=v[M],z=X>-1?Object(A.getPartWith)(Q,G,X):null,j=z?z.fragment:Object(A.getFragmentWithSN)(Q,G,this.fragCurrent);return j?{frag:j,part:z,level:Q}:null},a.bufferFragmentData=function(b,v,M,G){if(!b||this.state!==E.PARSING)return;var X=b.data1,Q=b.data2,z=X;if(X&&Q&&(z=Object(w.appendUint8Array)(X,Q)),!z||!z.length)return;var j={type:b.type,frag:v,part:M,chunkMeta:G,parent:v.type,data:z};this.hls.trigger(O.Events.BUFFER_APPENDING,j),b.dropped&&b.independent&&!M&&this.flushBufferGap(v)},a.flushBufferGap=function(b){var v=this.media;if(!v)return;if(!H.BufferHelper.isBuffered(v,v.currentTime)){this.flushMainBuffer(0,b.start);return}var M=v.currentTime,G=H.BufferHelper.bufferInfo(v,M,0),X=b.duration,Q=Math.min(this.config.maxFragLookUpTolerance*2,X*.25),z=Math.max(Math.min(b.start-Q,G.end-Q),M+Q);b.start-z>Q&&this.flushMainBuffer(z,b.start)},a.getFwdBufferInfo=function(b,v){var M=this.config,G=this.getLoadPosition();if(!Object(Y.isFiniteNumber)(G))return null;var X=H.BufferHelper.bufferInfo(b,G,M.maxBufferHole);if(X.len===0&&X.nextStart!==void 0){var Q=this.fragmentTracker.getBufferedFrag(G,v);if(Q&&X.nextStart<Q.end)return H.BufferHelper.bufferInfo(b,G,Math.max(X.nextStart,M.maxBufferHole))}return X},a.getMaxBufferLength=function(b){var v=this.config,M;return b?M=Math.max(8*v.maxBufferSize/b,v.maxBufferLength):M=v.maxBufferLength,Math.min(M,v.maxMaxBufferLength)},a.reduceMaxBufferLength=function(b){var v=this.config,M=b||v.maxBufferLength;return v.maxMaxBufferLength>=M?(v.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+v.maxMaxBufferLength+"s"),!0):!1},a.getNextFragment=function(b,v){var M,G,X=v.fragments,Q=X.length;if(!Q)return null;var z=this.config,j=X[0].start,q;if(v.live){var le=z.initialLiveManifestSize;if(Q<le)return this.warn("Not enough fragments to start playback (have: "+Q+", need: "+le+")"),null;!v.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(q=this.getInitialLiveFragment(v,X),this.startPosition=q?this.hls.liveSyncPosition||q.start:b)}else b<=j&&(q=X[0]);if(!q){var me=z.lowLatencyMode?v.partEnd:v.fragmentEnd;q=this.getFragmentAtPosition(b,me,v)}return(M=q)!==null&&M!==void 0&&M.initSegment&&!((G=q)!==null&&G!==void 0&&G.initSegment.data)&&!this.bitrateTest&&(q=q.initSegment),q},a.getNextPart=function(b,v,M){for(var G=-1,X=!1,Q=!0,z=0,j=b.length;z<j;z++){var q=b[z];if(Q=Q&&!q.independent,G>-1&&M<q.start)break;var le=q.loaded;!le&&(X||q.independent||Q)&&q.fragment===v&&(G=z),X=le}return G},a.loadedEndOfParts=function(b,v){var M=b[b.length-1];return M&&v>M.start&&M.loaded},a.getInitialLiveFragment=function(b,v){var M=this.fragPrevious,G=null;if(M){if(b.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+M.programDateTime),G=Object(L.findFragmentByPDT)(v,M.endProgramDateTime,this.config.maxFragLookUpTolerance)),!G){var X=M.sn+1;if(X>=b.startSN&&X<=b.endSN){var Q=v[X-b.startSN];M.cc===Q.cc&&(G=Q,this.log("Live playlist, switching playlist, load frag with next SN: "+G.sn))}G||(G=Object(L.findFragWithCC)(v,M.cc),G&&this.log("Live playlist, switching playlist, load frag with same CC: "+G.sn))}}else{var z=this.hls.liveSyncPosition;z!==null&&(G=this.getFragmentAtPosition(z,this.bitrateTest?b.fragmentEnd:b.edge,b))}return G},a.getFragmentAtPosition=function(b,v,M){var G=this.config,X=this.fragPrevious,Q=M.fragments,z=M.endSN,j=M.fragmentHint,q=G.maxFragLookUpTolerance,le=!!(G.lowLatencyMode&&M.partList&&j);le&&j&&!this.bitrateTest&&(Q=Q.concat(j),z=j.sn);var me;if(b<v){var be=b>v-q?0:q;me=Object(L.findFragmentByPTS)(X,Q,b,be)}else me=Q[Q.length-1];if(me){var Be=me.sn-M.startSN,Le=X&&me.level===X.level,De=Q[Be+1],de=this.fragmentTracker.getState(me);if(de===I.FragmentState.BACKTRACKED){me=null;for(var pe=Be;Q[pe]&&this.fragmentTracker.getState(Q[pe])===I.FragmentState.BACKTRACKED;)X?me=Q[pe--]:me=Q[--pe];me||(me=De)}else X&&me.sn===X.sn&&!le&&(Le&&(me.sn<z&&this.fragmentTracker.getState(De)!==I.FragmentState.OK?(this.log("SN "+me.sn+" just loaded, load next one: "+De.sn),me=De):me=null))}return me},a.synchronizeToLiveEdge=function(b){var v=this.config,M=this.media;if(!M)return;var G=this.hls.liveSyncPosition,X=M.currentTime,Q=b.fragments[0].start,z=b.edge,j=X>=Q-v.maxFragLookUpTolerance&&X<=z;if(G!==null&&M.duration>G&&(X<G||!j)){var q=v.liveMaxLatencyDuration!==void 0?v.liveMaxLatencyDuration:v.liveMaxLatencyDurationCount*b.targetduration;(!j&&M.readyState<4||X<z-q)&&(this.loadedmetadata||(this.nextLoadPosition=G),M.readyState&&(this.warn("Playback: "+X.toFixed(3)+" is located too far from the end of live sliding playlist: "+z+", reset currentTime to : "+G.toFixed(3)),M.currentTime=G))}},a.alignPlaylists=function(b,v){var M=this.levels,G=this.levelLastLoaded,X=this.fragPrevious,Q=G!==null?M[G]:null,z=b.fragments.length;if(!z)return this.warn("No fragments in live playlist"),0;var j=b.fragments[0].start,q=!v,le=b.alignedSliding&&Object(Y.isFiniteNumber)(j);if(q||!le&&!j){Object(_.alignStream)(X,Q,b);var me=b.fragments[0].start;return this.log("Live playlist sliding: "+me.toFixed(2)+" start-sn: "+(v?v.startSN:"na")+"->"+b.startSN+" prev-sn: "+(X?X.sn:"na")+" fragments: "+z),me}return j},a.waitForCdnTuneIn=function(b){var v=3;return b.live&&b.canBlockReload&&b.tuneInGoal>Math.max(b.partHoldBack,b.partTarget*v)},a.setStartPosition=function(b,v){var M=this.startPosition;if(M<v&&(M=-1),M===-1||this.lastCurrentTime===-1){var G=b.startTimeOffset;Object(Y.isFiniteNumber)(G)?(M=v+G,G<0&&(M+=b.totalduration),M=Math.min(Math.max(v,M),v+b.totalduration),this.log("Start time offset "+G+" found in playlist, adjust startPosition to "+M),this.startPosition=M):b.live?M=this.hls.liveSyncPosition||v:this.startPosition=M=0,this.lastCurrentTime=M}this.nextLoadPosition=M},a.getLoadPosition=function(){var b=this.media,v=0;return this.loadedmetadata&&b?v=b.currentTime:this.nextLoadPosition&&(v=this.nextLoadPosition),v},a.handleFragLoadAborted=function(b,v){this.transmuxer&&b.sn!=="initSegment"&&b.stats.aborted&&(this.warn("Fragment "+b.sn+(v?" part"+v.index:"")+" of level "+b.level+" was aborted"),this.resetFragmentLoading(b))},a.resetFragmentLoading=function(b){(!this.fragCurrent||!this.fragContextChanged(b))&&(this.state=E.IDLE)},a.onFragmentOrKeyLoadError=function(b,v){if(v.fatal)return;var M=v.frag;if(!M||M.type!==b)return;var G=this.fragCurrent;console.assert(G&&M.sn===G.sn&&M.level===G.level&&M.urlId===G.urlId,"Frag load error must match current frag to retry");var X=this.config;if(this.fragLoadError+1<=X.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(M.level))return;var Q=Math.min(Math.pow(2,this.fragLoadError)*X.fragLoadingRetryDelay,X.fragLoadingMaxRetryTimeout);this.warn("Fragment "+M.sn+" of "+b+" "+M.level+" failed to load, retrying in "+Q+"ms"),this.retryDate=self.performance.now()+Q,this.fragLoadError++,this.state=E.FRAG_LOADING_WAITING_RETRY}else v.levelRetry?(b===l.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=E.IDLE):(U.logger.error(v.details+" reaches max retry, redispatch as fatal ..."),v.fatal=!0,this.hls.stopLoad(),this.state=E.ERROR)},a.afterBufferFlushed=function(b,v,M){if(!b)return;var G=H.BufferHelper.getBuffered(b);this.fragmentTracker.detectEvictedFragments(v,G,M),this.state===E.ENDED&&this.resetLoadingState()},a.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=E.IDLE},a.resetLiveStartWhenNotLoaded=function(b){if(!this.loadedmetadata){this.startFragRequested=!1;var v=this.levels?this.levels[b].details:null;if(v!=null&&v.live)return this.startPosition=-1,this.setStartPosition(v,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},a.updateLevelTiming=function(b,v,M,G){var X=this,Q=M.details;console.assert(!!Q,"level.details must be defined");var z=Object.keys(b.elementaryStreams).reduce(function(j,q){var le=b.elementaryStreams[q];if(le){var me=le.endPTS-le.startPTS;if(me<=0)return X.warn("Could not parse fragment "+b.sn+" "+q+" duration reliably ("+me+") resetting transmuxer to fallback to playlist timing"),X.resetTransmuxer(),j||!1;var be=G?0:Object(A.updateFragPTSDTS)(Q,b,le.startPTS,le.endPTS,le.startDTS,le.endDTS);return X.hls.trigger(O.Events.LEVEL_PTS_UPDATED,{details:Q,level:M,drift:be,type:q,frag:b,start:le.startPTS,end:le.endPTS}),!0}return j},!1);z?(this.state=E.PARSED,this.hls.trigger(O.Events.FRAG_PARSED,{frag:b,part:v})):this.resetLoadingState()},a.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},T(u,[{key:"state",get:function(){return this._state},set:function(b){var v=this._state;v!==b&&(this._state=b,this.log(v+"->"+b))}}]),u}(P.default)},"./src/controller/buffer-controller.ts":function(oe,Z,k){"use strict";k.r(Z),k.d(Z,"default",function(){return L});var Y=k("./src/polyfills/number.ts"),P=k("./src/events.ts"),I=k("./src/utils/logger.ts"),H=k("./src/errors.ts"),U=k("./src/utils/buffer-helper.ts"),O=k("./src/utils/mediasource-helper.ts"),R=k("./src/loader/fragment.ts"),y=k("./src/controller/buffer-operation-queue.ts"),w=Object(O.getMediaSource)(),_=/([ha]vc.)(?:\.[^.,]+)+/,L=function(){function A(d){var o=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=o.hls,h=o.media,T=o.mediaSource;I.logger.log("[buffer-controller]: Media source opened"),h&&(o.updateMediaElementDuration(),l.trigger(P.Events.MEDIA_ATTACHED,{media:h})),T&&T.removeEventListener("sourceopen",o._onMediaSourceOpen),o.checkPendingTracks()},this._onMediaSourceClose=function(){I.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){I.logger.log("[buffer-controller]: Media source ended")},this.hls=d,this._initSourceBuffer(),this.registerListeners()}var C=A.prototype;return C.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},C.destroy=function(){this.unregisterListeners(),this.details=null},C.registerListeners=function(){var o=this.hls;o.on(P.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.on(P.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(P.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(P.Events.BUFFER_RESET,this.onBufferReset,this),o.on(P.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.on(P.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.on(P.Events.BUFFER_EOS,this.onBufferEos,this),o.on(P.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.on(P.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.on(P.Events.FRAG_PARSED,this.onFragParsed,this),o.on(P.Events.FRAG_CHANGED,this.onFragChanged,this)},C.unregisterListeners=function(){var o=this.hls;o.off(P.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.off(P.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(P.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(P.Events.BUFFER_RESET,this.onBufferReset,this),o.off(P.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.off(P.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.off(P.Events.BUFFER_EOS,this.onBufferEos,this),o.off(P.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.off(P.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.off(P.Events.FRAG_PARSED,this.onFragParsed,this),o.off(P.Events.FRAG_CHANGED,this.onFragChanged,this)},C._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new y.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},C.onManifestParsed=function(o,l){var h=2;(l.audio&&!l.video||!l.altAudio)&&(h=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=h,this.details=null,I.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},C.onMediaAttaching=function(o,l){var h=this.media=l.media;if(h&&w){var T=this.mediaSource=new w;T.addEventListener("sourceopen",this._onMediaSourceOpen),T.addEventListener("sourceended",this._onMediaSourceEnded),T.addEventListener("sourceclose",this._onMediaSourceClose),h.src=self.URL.createObjectURL(T),this._objectUrl=h.src}},C.onMediaDetaching=function(){var o=this.media,l=this.mediaSource,h=this._objectUrl;if(l){if(I.logger.log("[buffer-controller]: media source detaching"),l.readyState==="open")try{l.endOfStream()}catch(T){I.logger.warn("[buffer-controller]: onMediaDetaching: "+T.message+" while calling endOfStream")}this.onBufferReset(),l.removeEventListener("sourceopen",this._onMediaSourceOpen),l.removeEventListener("sourceended",this._onMediaSourceEnded),l.removeEventListener("sourceclose",this._onMediaSourceClose),o&&(h&&self.URL.revokeObjectURL(h),o.src===h?(o.removeAttribute("src"),o.load()):I.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(P.Events.MEDIA_DETACHED,void 0)},C.onBufferReset=function(){var o=this;this.getSourceBufferTypes().forEach(function(l){var h=o.sourceBuffer[l];try{h&&(o.removeBufferListeners(l),o.mediaSource&&o.mediaSource.removeSourceBuffer(h),o.sourceBuffer[l]=void 0)}catch(T){I.logger.warn("[buffer-controller]: Failed to reset the "+l+" buffer",T)}}),this._initSourceBuffer()},C.onBufferCodecs=function(o,l){var h=this,T=this.getSourceBufferTypes().length;if(Object.keys(l).forEach(function(f){if(T){var p=h.tracks[f];if(p&&typeof p.buffer.changeType=="function"){var D=l[f],E=D.codec,g=D.levelCodec,c=D.container,u=(p.levelCodec||p.codec).replace(_,"$1"),a=(g||E).replace(_,"$1");if(u!==a){var x=c+";codecs="+(g||E);h.appendChangeType(f,x)}}}else h.pendingTracks[f]=l[f]}),T)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},C.appendChangeType=function(o,l){var h=this,T=this.operationQueue,f={execute:function(){var D=h.sourceBuffer[o];D&&(I.logger.log("[buffer-controller]: changing "+o+" sourceBuffer type to "+l),D.changeType(l)),T.shiftAndExecuteNext(o)},onStart:function(){},onComplete:function(){},onError:function(D){I.logger.warn("[buffer-controller]: Failed to change "+o+" SourceBuffer type",D)}};T.append(f,o)},C.onBufferAppending=function(o,l){var h=this,T=this.hls,f=this.operationQueue,p=this.tracks,D=l.data,E=l.type,g=l.frag,c=l.part,u=l.chunkMeta,a=u.buffering[E],x=self.performance.now();a.start=x;var b=g.stats.buffering,v=c?c.stats.buffering:null;b.start===0&&(b.start=x),v&&v.start===0&&(v.start=x);var M=p.audio,G=E==="audio"&&u.id===1&&(M==null?void 0:M.container)==="audio/mpeg",X={execute:function(){if(a.executeStart=self.performance.now(),G){var z=h.sourceBuffer[E];if(z){var j=g.start-z.timestampOffset;Math.abs(j)>=.1&&(I.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+g.start+" (delta: "+j+") sn: "+g.sn+")"),z.timestampOffset=g.start)}}h.appendExecutor(D,E)},onStart:function(){},onComplete:function(){var z=self.performance.now();a.executeEnd=a.end=z,b.first===0&&(b.first=z),v&&v.first===0&&(v.first=z);var j=h.sourceBuffer,q={};for(var le in j)q[le]=U.BufferHelper.getBuffered(j[le]);h.appendError=0,h.hls.trigger(P.Events.BUFFER_APPENDED,{type:E,frag:g,part:c,chunkMeta:u,parent:g.type,timeRanges:q})},onError:function(z){I.logger.error("[buffer-controller]: Error encountered while trying to append to the "+E+" SourceBuffer",z);var j={type:H.ErrorTypes.MEDIA_ERROR,parent:g.type,details:H.ErrorDetails.BUFFER_APPEND_ERROR,err:z,fatal:!1};z.code===DOMException.QUOTA_EXCEEDED_ERR?j.details=H.ErrorDetails.BUFFER_FULL_ERROR:(h.appendError++,j.details=H.ErrorDetails.BUFFER_APPEND_ERROR,h.appendError>T.config.appendErrorMaxRetry&&(I.logger.error("[buffer-controller]: Failed "+T.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),j.fatal=!0)),T.trigger(P.Events.ERROR,j)}};f.append(X,E)},C.onBufferFlushing=function(o,l){var h=this,T=this.operationQueue,f=function(D){return{execute:h.removeExecutor.bind(h,D,l.startOffset,l.endOffset),onStart:function(){},onComplete:function(){h.hls.trigger(P.Events.BUFFER_FLUSHED,{type:D})},onError:function(g){I.logger.warn("[buffer-controller]: Failed to remove from "+D+" SourceBuffer",g)}}};l.type?T.append(f(l.type),l.type):this.getSourceBufferTypes().forEach(function(p){T.append(f(p),p)})},C.onFragParsed=function(o,l){var h=this,T=l.frag,f=l.part,p=[],D=f?f.elementaryStreams:T.elementaryStreams;D[R.ElementaryStreamTypes.AUDIOVIDEO]?p.push("audiovideo"):(D[R.ElementaryStreamTypes.AUDIO]&&p.push("audio"),D[R.ElementaryStreamTypes.VIDEO]&&p.push("video"));var E=function(){var c=self.performance.now();T.stats.buffering.end=c,f&&(f.stats.buffering.end=c);var u=f?f.stats:T.stats;h.hls.trigger(P.Events.FRAG_BUFFERED,{frag:T,part:f,stats:u,id:T.type})};p.length===0&&I.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+T.type+" level: "+T.level+" sn: "+T.sn),this.blockBuffers(E,p)},C.onFragChanged=function(o,l){this.flushBackBuffer()},C.onBufferEos=function(o,l){var h=this,T=this.getSourceBufferTypes().reduce(function(f,p){var D=h.sourceBuffer[p];return(!l.type||l.type===p)&&(D&&!D.ended&&(D.ended=!0,I.logger.log("[buffer-controller]: "+p+" sourceBuffer now EOS"))),f&&!!(!D||D.ended)},!0);T&&this.blockBuffers(function(){var f=h.mediaSource;if(!f||f.readyState!=="open")return;f.endOfStream()})},C.onLevelUpdated=function(o,l){var h=l.details;if(!h.fragments.length)return;this.details=h,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},C.flushBackBuffer=function(){var o=this.hls,l=this.details,h=this.media,T=this.sourceBuffer;if(!h||l===null)return;var f=this.getSourceBufferTypes();if(!f.length)return;var p=l.live&&o.config.liveBackBufferLength!==null?o.config.liveBackBufferLength:o.config.backBufferLength;if(!Object(Y.isFiniteNumber)(p)||p<0)return;var D=h.currentTime,E=l.levelTargetDuration,g=Math.max(p,E),c=Math.floor(D/E)*E-g;f.forEach(function(u){var a=T[u];if(a){var x=U.BufferHelper.getBuffered(a);x.length>0&&c>x.start(0)&&(o.trigger(P.Events.BACK_BUFFER_REACHED,{bufferEnd:c}),l.live&&o.trigger(P.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:c}),o.trigger(P.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:c,type:u}))}})},C.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var o=this.details,l=this.hls,h=this.media,T=this.mediaSource,f=o.fragments[0].start+o.totalduration,p=h.duration,D=Object(Y.isFiniteNumber)(T.duration)?T.duration:0;o.live&&l.config.liveDurationInfinity?(I.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),T.duration=Infinity,this.updateSeekableRange(o)):(f>D&&f>p||!Object(Y.isFiniteNumber)(p))&&(I.logger.log("[buffer-controller]: Updating Media Source duration to "+f.toFixed(3)),T.duration=f)},C.updateSeekableRange=function(o){var l=this.mediaSource,h=o.fragments,T=h.length;if(T&&o.live&&l!==null&&l!==void 0&&l.setLiveSeekableRange){var f=Math.max(0,h[0].start),p=Math.max(f,f+o.totalduration);l.setLiveSeekableRange(f,p)}},C.checkPendingTracks=function(){var o=this.bufferCodecEventsExpected,l=this.operationQueue,h=this.pendingTracks,T=Object.keys(h).length;if(T&&!o||T===2){this.createSourceBuffers(h),this.pendingTracks={};var f=this.getSourceBufferTypes();if(f.length===0){this.hls.trigger(P.Events.ERROR,{type:H.ErrorTypes.MEDIA_ERROR,details:H.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}f.forEach(function(p){l.executeNext(p)})}},C.createSourceBuffers=function(o){var l=this.sourceBuffer,h=this.mediaSource;if(!h)throw Error("createSourceBuffers called when mediaSource was null");var T=0;for(var f in o)if(!l[f]){var p=o[f];if(!p)throw Error("source buffer exists for track "+f+", however track does not");var D=p.levelCodec||p.codec,E=p.container+";codecs="+D;I.logger.log("[buffer-controller]: creating sourceBuffer("+E+")");try{var g=l[f]=h.addSourceBuffer(E),c=f;this.addBufferListener(c,"updatestart",this._onSBUpdateStart),this.addBufferListener(c,"updateend",this._onSBUpdateEnd),this.addBufferListener(c,"error",this._onSBUpdateError),this.tracks[f]={buffer:g,codec:D,container:p.container,levelCodec:p.levelCodec,id:p.id},T++}catch(u){I.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+u.message),this.hls.trigger(P.Events.ERROR,{type:H.ErrorTypes.MEDIA_ERROR,details:H.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:u,mimeType:E})}}T&&this.hls.trigger(P.Events.BUFFER_CREATED,{tracks:this.tracks})},C._onSBUpdateStart=function(o){var l=this.operationQueue,h=l.current(o);h.onStart()},C._onSBUpdateEnd=function(o){var l=this.operationQueue,h=l.current(o);h.onComplete(),l.shiftAndExecuteNext(o)},C._onSBUpdateError=function(o,l){I.logger.error("[buffer-controller]: "+o+" SourceBuffer error",l),this.hls.trigger(P.Events.ERROR,{type:H.ErrorTypes.MEDIA_ERROR,details:H.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var h=this.operationQueue.current(o);h&&h.onError(l)},C.removeExecutor=function(o,l,h){var T=this.media,f=this.mediaSource,p=this.operationQueue,D=this.sourceBuffer,E=D[o];if(!T||!f||!E){I.logger.warn("[buffer-controller]: Attempting to remove from the "+o+" SourceBuffer, but it does not exist"),p.shiftAndExecuteNext(o);return}var g=Object(Y.isFiniteNumber)(T.duration)?T.duration:Infinity,c=Object(Y.isFiniteNumber)(f.duration)?f.duration:Infinity,u=Math.max(0,l),a=Math.min(h,g,c);a>u?(I.logger.log("[buffer-controller]: Removing ["+u+","+a+"] from the "+o+" SourceBuffer"),console.assert(!E.updating,o+" sourceBuffer must not be updating"),E.remove(u,a)):p.shiftAndExecuteNext(o)},C.appendExecutor=function(o,l){var h=this.operationQueue,T=this.sourceBuffer,f=T[l];if(!f){I.logger.warn("[buffer-controller]: Attempting to append to the "+l+" SourceBuffer, but it does not exist"),h.shiftAndExecuteNext(l);return}f.ended=!1,console.assert(!f.updating,l+" sourceBuffer must not be updating"),f.appendBuffer(o)},C.blockBuffers=function(o,l){var h=this;if(l===void 0&&(l=this.getSourceBufferTypes()),!l.length){I.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(o);return}var T=this.operationQueue,f=l.map(function(p){return T.appendBlocker(p)});Promise.all(f).then(function(){o(),l.forEach(function(p){var D=h.sourceBuffer[p];(!D||!D.updating)&&T.shiftAndExecuteNext(p)})})},C.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},C.addBufferListener=function(o,l,h){var T=this.sourceBuffer[o];if(!T)return;var f=h.bind(this,o);this.listeners[o].push({event:l,listener:f}),T.addEventListener(l,f)},C.removeBufferListeners=function(o){var l=this.sourceBuffer[o];if(!l)return;this.listeners[o].forEach(function(h){l.removeEventListener(h.event,h.listener)})},A}()},"./src/controller/buffer-operation-queue.ts":function(oe,Z,k){"use strict";k.r(Z),k.d(Z,"default",function(){return P});var Y=k("./src/utils/logger.ts"),P=function(){function I(U){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=U}var H=I.prototype;return H.append=function(O,R){var y=this.queues[R];y.push(O),y.length===1&&this.buffers[R]&&this.executeNext(R)},H.insertAbort=function(O,R){var y=this.queues[R];y.unshift(O),this.executeNext(R)},H.appendBlocker=function(O){var R,y=new Promise(function(_){R=_}),w={execute:R,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(w,O),y},H.executeNext=function(O){var R=this.buffers,y=this.queues,w=R[O],_=y[O];if(_.length){var L=_[0];try{L.execute()}catch(A){Y.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),L.onError(A),(!w||!w.updating)&&(_.shift(),this.executeNext(O))}}},H.shiftAndExecuteNext=function(O){this.queues[O].shift(),this.executeNext(O)},H.current=function(O){return this.queues[O][0]},I}()},"./src/controller/cap-level-controller.ts":function(oe,Z,k){"use strict";k.r(Z);var Y=k("./src/events.ts");function P(U,O){for(var R=0;R<O.length;R++){var y=O[R];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(U,y.key,y)}}function I(U,O,R){return O&&P(U.prototype,O),R&&P(U,R),U}var H=function(){function U(R){this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.hls=void 0,this.streamController=void 0,this.clientRect=void 0,this.hls=R,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var O=U.prototype;return O.setStreamController=function(y){this.streamController=y},O.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},O.registerListeners=function(){var y=this.hls;y.on(Y.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),y.on(Y.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),y.on(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this),y.on(Y.Events.BUFFER_CODECS,this.onBufferCodecs,this),y.on(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},O.unregisterListener=function(){var y=this.hls;y.off(Y.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),y.off(Y.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),y.off(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this),y.off(Y.Events.BUFFER_CODECS,this.onBufferCodecs,this),y.off(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},O.onFpsDropLevelCapping=function(y,w){U.isLevelAllowed(w.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(w.droppedLevel)},O.onMediaAttaching=function(y,w){this.media=w.media instanceof HTMLVideoElement?w.media:null},O.onManifestParsed=function(y,w){var _=this.hls;this.restrictedLevels=[],this.firstLevel=w.firstLevel,_.config.capLevelToPlayerSize&&w.video&&this.startCapping()},O.onBufferCodecs=function(y,w){var _=this.hls;_.config.capLevelToPlayerSize&&w.video&&this.startCapping()},O.onMediaDetaching=function(){this.stopCapping()},O.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var y=this.hls.levels;if(y.length){var w=this.hls;w.autoLevelCapping=this.getMaxLevel(y.length-1),w.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=w.autoLevelCapping}}},O.getMaxLevel=function(y){var w=this,_=this.hls.levels;if(!_.length)return-1;var L=_.filter(function(A,C){return U.isLevelAllowed(C,w.restrictedLevels)&&C<=y});return this.clientRect=null,U.getMaxLevelByMediaSize(L,this.mediaWidth,this.mediaHeight)},O.startCapping=function(){if(this.timer)return;this.autoLevelCapping=Number.POSITIVE_INFINITY,this.hls.firstLevel=this.getMaxLevel(this.firstLevel),self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize()},O.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},O.getDimensions=function(){if(this.clientRect)return this.clientRect;var y=this.media,w={width:0,height:0};if(y){var _=y.getBoundingClientRect();w.width=_.width,w.height=_.height,!w.width&&!w.height&&(w.width=_.right-_.left||y.width||0,w.height=_.bottom-_.top||y.height||0)}return this.clientRect=w,w},U.isLevelAllowed=function(y,w){return w===void 0&&(w=[]),w.indexOf(y)===-1},U.getMaxLevelByMediaSize=function(y,w,_){if(!y||!y.length)return-1;for(var L=function(l,h){return h?l.width!==h.width||l.height!==h.height:!0},A=y.length-1,C=0;C<y.length;C+=1){var d=y[C];if((d.width>=w||d.height>=_)&&L(d,y[C+1])){A=C;break}}return A},I(U,[{key:"mediaWidth",get:function(){return this.getDimensions().width*U.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*U.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var y=1;try{y=self.devicePixelRatio}catch(w){}return y}}]),U}();Z.default=H},"./src/controller/cmcd-controller.ts":function(oe,Z,k){"use strict";k.r(Z),k.d(Z,"default",function(){return L});var Y=k("./src/events.ts"),P=k("./src/types/cmcd.ts"),I=k("./src/utils/buffer-helper.ts"),H=k("./src/utils/logger.ts");function U(A,C){for(var d=0;d<C.length;d++){var o=C[d];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(A,o.key,o)}}function O(A,C,d){return C&&U(A.prototype,C),d&&U(A,d),A}function R(A,C){var d=typeof Symbol!="undefined"&&A[Symbol.iterator]||A["@@iterator"];if(d)return(d=d.call(A)).next.bind(d);if(Array.isArray(A)||(d=y(A))||C&&A&&typeof A.length=="number"){d&&(A=d);var o=0;return function(){return o>=A.length?{done:!0}:{done:!1,value:A[o++]}}}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 y(A,C){if(!A)return;if(typeof A=="string")return w(A,C);var d=Object.prototype.toString.call(A).slice(8,-1);if(d==="Object"&&A.constructor&&(d=A.constructor.name),d==="Map"||d==="Set")return Array.from(A);if(d==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(d))return w(A,C)}function w(A,C){(C==null||C>A.length)&&(C=A.length);for(var d=0,o=new Array(C);d<C;d++)o[d]=A[d];return o}function _(){return _=Object.assign||function(A){for(var C=1;C<arguments.length;C++){var d=arguments[C];for(var o in d)Object.prototype.hasOwnProperty.call(d,o)&&(A[o]=d[o])}return A},_.apply(this,arguments)}var L=function(){function A(d){var o=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(){o.initialized&&(o.starved=!0),o.buffering=!0},this.onPlaying=function(){o.initialized||(o.initialized=!0),o.buffering=!1},this.applyPlaylistData=function(T){try{o.apply(T,{ot:P.CMCDObjectType.MANIFEST,su:!o.initialized})}catch(f){H.logger.warn("Could not generate manifest CMCD data.",f)}},this.applyFragmentData=function(T){try{var f=T.frag,p=o.hls.levels[f.level],D=o.getObjectType(f),E={d:f.duration*1e3,ot:D};(D===P.CMCDObjectType.VIDEO||D===P.CMCDObjectType.AUDIO||D==P.CMCDObjectType.MUXED)&&(E.br=p.bitrate/1e3,E.tb=o.getTopBandwidth(D),E.bl=o.getBufferLength(D)),o.apply(T,E)}catch(g){H.logger.warn("Could not generate segment CMCD data.",g)}},this.hls=d;var l=this.config=d.config,h=l.cmcd;h!=null&&(l.pLoader=this.createPlaylistLoader(),l.fLoader=this.createFragmentLoader(),this.sid=h.sessionId||A.uuid(),this.cid=h.contentId,this.useHeaders=h.useHeaders===!0,this.registerListeners())}var C=A.prototype;return C.registerListeners=function(){var o=this.hls;o.on(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(Y.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.on(Y.Events.BUFFER_CREATED,this.onBufferCreated,this)},C.unregisterListeners=function(){var o=this.hls;o.off(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(Y.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.off(Y.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},C.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},C.onMediaAttached=function(o,l){this.media=l.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},C.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},C.onBufferCreated=function(o,l){var h,T;this.audioBuffer=(h=l.tracks.audio)===null||h===void 0?void 0:h.buffer,this.videoBuffer=(T=l.tracks.video)===null||T===void 0?void 0:T.buffer},C.createData=function(){var o;return{v:P.CMCDVersion,sf:P.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(o=this.media)===null||o===void 0?void 0:o.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},C.apply=function(o,l){l===void 0&&(l={}),_(l,this.createData());var h=l.ot===P.CMCDObjectType.INIT||l.ot===P.CMCDObjectType.VIDEO||l.ot===P.CMCDObjectType.MUXED;if(this.starved&&h&&(l.bs=!0,l.su=!0,this.starved=!1),l.su==null&&(l.su=this.buffering),this.useHeaders){var T=A.toHeaders(l);if(!Object.keys(T).length)return;o.headers||(o.headers={}),_(o.headers,T)}else{var f=A.toQuery(l);if(!f)return;o.url=A.appendQueryToUri(o.url,f)}},C.getObjectType=function(o){var l=o.type;return l==="subtitle"?P.CMCDObjectType.TIMED_TEXT:o.sn==="initSegment"?P.CMCDObjectType.INIT:l==="audio"?P.CMCDObjectType.AUDIO:l==="main"?this.hls.audioTracks.length?P.CMCDObjectType.VIDEO:P.CMCDObjectType.MUXED:void 0},C.getTopBandwidth=function(o){for(var l=0,h=o===P.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,T=R(h),f;!(f=T()).done;){var p=f.value;p.bitrate>l&&(l=p.bitrate)}return l>0?l:NaN},C.getBufferLength=function(o){var l=this.hls.media,h=o===P.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!h||!l)return NaN;var T=I.BufferHelper.bufferInfo(h,l.currentTime,this.config.maxBufferHole);return T.len*1e3},C.createPlaylistLoader=function(){var o=this.config.pLoader,l=this.applyPlaylistData,h=o||this.config.loader;return function(){function T(p){this.loader=void 0,this.loader=new h(p)}var f=T.prototype;return f.destroy=function(){this.loader.destroy()},f.abort=function(){this.loader.abort()},f.load=function(D,E,g){l(D),this.loader.load(D,E,g)},O(T,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),T}()},C.createFragmentLoader=function(){var o=this.config.fLoader,l=this.applyFragmentData,h=o||this.config.loader;return function(){function T(p){this.loader=void 0,this.loader=new h(p)}var f=T.prototype;return f.destroy=function(){this.loader.destroy()},f.abort=function(){this.loader.abort()},f.load=function(D,E,g){l(D),this.loader.load(D,E,g)},O(T,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),T}()},A.uuid=function(){var o=URL.createObjectURL(new Blob),l=o.toString();return URL.revokeObjectURL(o),l.substr(l.lastIndexOf("/")+1)},A.serialize=function(o){for(var l=[],h=function(G){return!Number.isNaN(G)&&G!=null&&G!==""&&G!==!1},T=function(G){return Math.round(G)},f=function(G){return T(G/100)*100},p=function(G){return encodeURIComponent(G)},D={br:T,d:T,bl:f,dl:f,mtp:f,nor:p,rtp:f,tb:T},E=Object.keys(o||{}).sort(),g=R(E),c;!(c=g()).done;){var u=c.value,a=o[u];if(!h(a))continue;if(u==="v"&&a===1)continue;if(u=="pr"&&a===1)continue;var x=D[u];x&&(a=x(a));var b=typeof a,v=void 0;u==="ot"||u==="sf"||u==="st"?v=u+"="+a:b==="boolean"?v=u:b==="number"?v=u+"="+a:v=u+"="+JSON.stringify(a),l.push(v)}return l.join(",")},A.toHeaders=function(o){for(var l=Object.keys(o),h={},T=["Object","Request","Session","Status"],f=[{},{},{},{}],p={br:0,d:0,ot:0,tb:0,bl:1,dl:1,mtp:1,nor:1,nrr:1,su:1,cid:2,pr:2,sf:2,sid:2,st:2,v:2,bs:3,rtp:3},D=0,E=l;D<E.length;D++){var g=E[D],c=p[g]!=null?p[g]:1;f[c][g]=o[g]}for(var u=0;u<f.length;u++){var a=A.serialize(f[u]);a&&(h["CMCD-"+T[u]]=a)}return h},A.toQuery=function(o){return"CMCD="+encodeURIComponent(A.serialize(o))},A.appendQueryToUri=function(o,l){if(!l)return o;var h=o.includes("?")?"&":"?";return""+o+h+l},A}()},"./src/controller/eme-controller.ts":function(oe,Z,k){"use strict";k.r(Z);var Y=k("./src/events.ts"),P=k("./src/errors.ts"),I=k("./src/utils/logger.ts"),H=k("./src/utils/mediakeys-helper.ts");function U(L,A){for(var C=0;C<A.length;C++){var d=A[C];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(L,d.key,d)}}function O(L,A,C){return A&&U(L.prototype,A),C&&U(L,C),L}var R=3,y=function(A,C,d){var o={audioCapabilities:[],videoCapabilities:[]};return A.forEach(function(l){o.audioCapabilities.push({contentType:'audio/mp4; codecs="'+l+'"',robustness:d.audioRobustness||""})}),C.forEach(function(l){o.videoCapabilities.push({contentType:'video/mp4; codecs="'+l+'"',robustness:d.videoRobustness||""})}),[o]},w=function(A,C,d,o){switch(A){case H.KeySystems.WIDEVINE:return y(C,d,o);default:throw new Error("Unknown key-system: "+A)}},_=function(){function L(C){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=C,this._config=C.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 A=L.prototype;return A.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},A._registerListeners=function(){this.hls.on(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(Y.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this)},A._unregisterListeners=function(){this.hls.off(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(Y.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this)},A.getLicenseServerUrl=function(d){switch(d){case H.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+d+'"')},A._attemptKeySystemAccess=function(d,o,l){var h=this,T=w(d,o,l,this._drmSystemOptions);I.logger.log("Requesting encrypted media key-system access");var f=this.requestMediaKeySystemAccess(d,T);this.mediaKeysPromise=f.then(function(p){return h._onMediaKeySystemAccessObtained(d,p)}),f.catch(function(p){I.logger.error('Failed to obtain key-system "'+d+'" access:',p)})},A._onMediaKeySystemAccessObtained=function(d,o){var l=this;I.logger.log('Access for key-system "'+d+'" obtained');var h={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:o,mediaKeySystemDomain:d};this._mediaKeysList.push(h);var T=Promise.resolve().then(function(){return o.createMediaKeys()}).then(function(f){return h.mediaKeys=f,I.logger.log('Media-keys created for key-system "'+d+'"'),l._onMediaKeysCreated(),f});return T.catch(function(f){I.logger.error("Failed to create media-keys:",f)}),T},A._onMediaKeysCreated=function(){var d=this;this._mediaKeysList.forEach(function(o){o.mediaKeysSession||(o.mediaKeysSession=o.mediaKeys.createSession(),d._onNewMediaKeySession(o.mediaKeysSession))})},A._onNewMediaKeySession=function(d){var o=this;I.logger.log("New key-system session "+d.sessionId),d.addEventListener("message",function(l){o._onKeySessionMessage(d,l.message)},!1)},A._onKeySessionMessage=function(d,o){I.logger.log("Got EME message event, creating license request"),this._requestLicense(o,function(l){I.logger.log("Received license data (length: "+(l&&l.byteLength)+"), updating key-session"),d.update(l)})},A.onMediaEncrypted=function(d){var o=this;if(I.logger.log('Media is encrypted using "'+d.initDataType+'" init data type'),!this.mediaKeysPromise){I.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(Y.Events.ERROR,{type:P.ErrorTypes.KEY_SYSTEM_ERROR,details:P.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var l=function(T){if(!o._media)return;o._attemptSetMediaKeys(T),o._generateRequestWithPreferredKeySession(d.initDataType,d.initData)};this.mediaKeysPromise.then(l).catch(l)},A._attemptSetMediaKeys=function(d){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var o=this._mediaKeysList[0];if(!o||!o.mediaKeys){I.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(Y.Events.ERROR,{type:P.ErrorTypes.KEY_SYSTEM_ERROR,details:P.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}I.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(o.mediaKeys),this._hasSetMediaKeys=!0}},A._generateRequestWithPreferredKeySession=function(d,o){var l=this,h=this._mediaKeysList[0];if(!h){I.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(Y.Events.ERROR,{type:P.ErrorTypes.KEY_SYSTEM_ERROR,details:P.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(h.mediaKeysSessionInitialized){I.logger.warn("Key-Session already initialized but requested again");return}var T=h.mediaKeysSession;if(!T){I.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(Y.Events.ERROR,{type:P.ErrorTypes.KEY_SYSTEM_ERROR,details:P.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!o){I.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(Y.Events.ERROR,{type:P.ErrorTypes.KEY_SYSTEM_ERROR,details:P.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}I.logger.log('Generating key-session request for "'+d+'" init data type'),h.mediaKeysSessionInitialized=!0,T.generateRequest(d,o).then(function(){I.logger.debug("Key-session generation succeeded")}).catch(function(f){I.logger.error("Error generating key-session request:",f),l.hls.trigger(Y.Events.ERROR,{type:P.ErrorTypes.KEY_SYSTEM_ERROR,details:P.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},A._createLicenseXhr=function(d,o,l){var h=new XMLHttpRequest;h.responseType="arraybuffer",h.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,h,d,o,l);var T=this._licenseXhrSetup;if(T)try{T.call(this.hls,h,d),T=void 0}catch(f){I.logger.error(f)}try{h.readyState||h.open("POST",d,!0),T&&T.call(this.hls,h,d)}catch(f){throw new Error("issue setting up KeySystem license XHR "+f)}return h},A._onLicenseRequestReadyStageChange=function(d,o,l,h){switch(d.readyState){case 4:if(d.status===200){this._requestLicenseFailureCount=0,I.logger.log("License request succeeded");var T=d.response,f=this._licenseResponseCallback;if(f)try{T=f.call(this.hls,d,o)}catch(D){I.logger.error(D)}h(T)}else{if(I.logger.error("License Request XHR failed ("+o+"). Status: "+d.status+" ("+d.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>R){this.hls.trigger(Y.Events.ERROR,{type:P.ErrorTypes.KEY_SYSTEM_ERROR,details:P.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var p=R-this._requestLicenseFailureCount+1;I.logger.warn("Retrying license request, "+p+" attempts left"),this._requestLicense(l,h)}break}},A._generateLicenseRequestChallenge=function(d,o){switch(d.mediaKeySystemDomain){case H.KeySystems.WIDEVINE:return o}throw new Error("unsupported key-system: "+d.mediaKeySystemDomain)},A._requestLicense=function(d,o){I.logger.log("Requesting content license for key-system");var l=this._mediaKeysList[0];if(!l){I.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(Y.Events.ERROR,{type:P.ErrorTypes.KEY_SYSTEM_ERROR,details:P.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var h=this.getLicenseServerUrl(l.mediaKeySystemDomain),T=this._createLicenseXhr(h,d,o);I.logger.log("Sending license request to URL: "+h);var f=this._generateLicenseRequestChallenge(l,d);T.send(f)}catch(p){I.logger.error("Failure requesting DRM license: "+p),this.hls.trigger(Y.Events.ERROR,{type:P.ErrorTypes.KEY_SYSTEM_ERROR,details:P.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},A.onMediaAttached=function(d,o){if(!this._emeEnabled)return;var l=o.media;this._media=l,l.addEventListener("encrypted",this._onMediaEncrypted)},A.onMediaDetached=function(){var d=this._media,o=this._mediaKeysList;if(!d)return;d.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(o.map(function(l){if(l.mediaKeysSession)return l.mediaKeysSession.close().catch(function(){})})).then(function(){return d.setMediaKeys(null)}).catch(function(){})},A.onManifestParsed=function(d,o){if(!this._emeEnabled)return;var l=o.levels.map(function(T){return T.audioCodec}).filter(function(T){return!!T}),h=o.levels.map(function(T){return T.videoCodec}).filter(function(T){return!!T});this._attemptKeySystemAccess(H.KeySystems.WIDEVINE,l,h)},O(L,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),L}();Z.default=_},"./src/controller/fps-controller.ts":function(oe,Z,k){"use strict";k.r(Z);var Y=k("./src/events.ts"),P=k("./src/utils/logger.ts"),I=function(){function H(O){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=O,this.registerListeners()}var U=H.prototype;return U.setStreamController=function(R){this.streamController=R},U.registerListeners=function(){this.hls.on(Y.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},U.unregisterListeners=function(){this.hls.off(Y.Events.MEDIA_ATTACHING,this.onMediaAttaching)},U.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},U.onMediaAttaching=function(R,y){var w=this.hls.config;if(w.capLevelOnFPSDrop){var _=y.media instanceof self.HTMLVideoElement?y.media:null;this.media=_,_&&typeof _.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),w.fpsDroppedMonitoringPeriod)}},U.checkFPS=function(R,y,w){var _=performance.now();if(y){if(this.lastTime){var L=_-this.lastTime,A=w-this.lastDroppedFrames,C=y-this.lastDecodedFrames,d=1e3*A/L,o=this.hls;if(o.trigger(Y.Events.FPS_DROP,{currentDropped:A,currentDecoded:C,totalDroppedFrames:w}),d>0&&A>o.config.fpsDroppedMonitoringThreshold*C){var l=o.currentLevel;P.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+l),l>0&&(o.autoLevelCapping===-1||o.autoLevelCapping>=l)&&(l=l-1,o.trigger(Y.Events.FPS_DROP_LEVEL_CAPPING,{level:l,droppedLevel:o.currentLevel}),o.autoLevelCapping=l,this.streamController.nextLevelSwitch())}}this.lastTime=_,this.lastDroppedFrames=w,this.lastDecodedFrames=y}},U.checkFPSInterval=function(){var R=this.media;if(R)if(this.isVideoPlaybackQualityAvailable){var y=R.getVideoPlaybackQuality();this.checkFPS(R,y.totalVideoFrames,y.droppedVideoFrames)}else this.checkFPS(R,R.webkitDecodedFrameCount,R.webkitDroppedFrameCount)},H}();Z.default=I},"./src/controller/fragment-finders.ts":function(oe,Z,k){"use strict";k.r(Z),k.d(Z,"findFragmentByPDT",function(){return I}),k.d(Z,"findFragmentByPTS",function(){return H}),k.d(Z,"fragmentWithinToleranceTest",function(){return U}),k.d(Z,"pdtWithinToleranceTest",function(){return O}),k.d(Z,"findFragWithCC",function(){return R});var Y=k("./src/polyfills/number.ts"),P=k("./src/utils/binary-search.ts");function I(y,w,_){if(w===null||!Array.isArray(y)||!y.length||!Object(Y.isFiniteNumber)(w))return null;var L=y[0].programDateTime;if(w<(L||0))return null;var A=y[y.length-1].endProgramDateTime;if(w>=(A||0))return null;_=_||0;for(var C=0;C<y.length;++C){var d=y[C];if(O(w,_,d))return d}return null}function H(y,w,_,L){_===void 0&&(_=0),L===void 0&&(L=0);var A=null;if(y?A=w[y.sn-w[0].sn+1]||null:_===0&&w[0].start===0&&(A=w[0]),A&&U(_,L,A)===0)return A;var C=P.default.search(w,U.bind(null,_,L));return C||A}function U(y,w,_){y===void 0&&(y=0),w===void 0&&(w=0);var L=Math.min(w,_.duration+(_.deltaPTS?_.deltaPTS:0));return _.start+_.duration-L<=y?1:_.start-L>y&&_.start?-1:0}function O(y,w,_){var L=Math.min(w,_.duration+(_.deltaPTS?_.deltaPTS:0))*1e3,A=_.endProgramDateTime||0;return A-L>y}function R(y,w){return P.default.search(y,function(_){return _.cc<w?1:_.cc>w?-1:0})}},"./src/controller/fragment-tracker.ts":function(oe,Z,k){"use strict";k.r(Z),k.d(Z,"FragmentState",function(){return I}),k.d(Z,"FragmentTracker",function(){return H});var Y=k("./src/events.ts"),P=k("./src/types/loader.ts"),I;(function(R){R.NOT_LOADED="NOT_LOADED",R.BACKTRACKED="BACKTRACKED",R.APPENDING="APPENDING",R.PARTIAL="PARTIAL",R.OK="OK"})(I||(I={}));var H=function(){function R(w){this.activeFragment=null,this.activeParts=null,this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hls=w,this._registerListeners()}var y=R.prototype;return y._registerListeners=function(){var _=this.hls;_.on(Y.Events.BUFFER_APPENDED,this.onBufferAppended,this),_.on(Y.Events.FRAG_BUFFERED,this.onFragBuffered,this),_.on(Y.Events.FRAG_LOADED,this.onFragLoaded,this)},y._unregisterListeners=function(){var _=this.hls;_.off(Y.Events.BUFFER_APPENDED,this.onBufferAppended,this),_.off(Y.Events.FRAG_BUFFERED,this.onFragBuffered,this),_.off(Y.Events.FRAG_LOADED,this.onFragLoaded,this)},y.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},y.getAppendedFrag=function(_,L){if(L===P.PlaylistLevelType.MAIN){var A=this.activeFragment,C=this.activeParts;if(!A)return null;if(C)for(var d=C.length;d--;){var o=C[d],l=o?o.end:A.appendedPTS;if(o.start<=_&&l!==void 0&&_<=l)return d>9&&(this.activeParts=C.slice(d-9)),o}else if(A.start<=_&&A.appendedPTS!==void 0&&_<=A.appendedPTS)return A}return this.getBufferedFrag(_,L)},y.getBufferedFrag=function(_,L){for(var A=this.fragments,C=Object.keys(A),d=C.length;d--;){var o=A[C[d]];if((o==null?void 0:o.body.type)===L&&o.buffered){var l=o.body;if(l.start<=_&&_<=l.end)return l}}return null},y.detectEvictedFragments=function(_,L,A){var C=this;Object.keys(this.fragments).forEach(function(d){var o=C.fragments[d];if(!o)return;if(!o.buffered){o.body.type===A&&C.removeFragment(o.body);return}var l=o.range[_];if(!l)return;l.time.some(function(h){var T=!C.isTimeBuffered(h.startPTS,h.endPTS,L);return T&&C.removeFragment(o.body),T})})},y.detectPartialFragments=function(_){var L=this,A=this.timeRanges,C=_.frag,d=_.part;if(!A||C.sn==="initSegment")return;var o=O(C),l=this.fragments[o];if(!l)return;Object.keys(A).forEach(function(h){var T=C.elementaryStreams[h];if(!T)return;var f=A[h],p=d!==null||T.partial===!0;l.range[h]=L.getBufferedTimes(C,d,p,f)}),l.backtrack=l.loaded=null,Object.keys(l.range).length?l.buffered=!0:this.removeFragment(l.body)},y.fragBuffered=function(_){var L=O(_),A=this.fragments[L];A&&(A.backtrack=A.loaded=null,A.buffered=!0)},y.getBufferedTimes=function(_,L,A,C){for(var d={time:[],partial:A},o=L?L.start:_.start,l=L?L.end:_.end,h=_.minEndPTS||l,T=_.maxStartPTS||o,f=0;f<C.length;f++){var p=C.start(f)-this.bufferPadding,D=C.end(f)+this.bufferPadding;if(T>=p&&h<=D){d.time.push({startPTS:Math.max(o,C.start(f)),endPTS:Math.min(l,C.end(f))});break}else if(o<D&&l>p)d.partial=!0,d.time.push({startPTS:Math.max(o,C.start(f)),endPTS:Math.min(l,C.end(f))});else if(l<=p)break}return d},y.getPartialFragment=function(_){var L=null,A,C,d,o=0,l=this.bufferPadding,h=this.fragments;return Object.keys(h).forEach(function(T){var f=h[T];if(!f)return;U(f)&&(C=f.body.start-l,d=f.body.end+l,_>=C&&_<=d&&(A=Math.min(_-C,d-_),o<=A&&(L=f.body,o=A)))}),L},y.getState=function(_){var L=O(_),A=this.fragments[L];return A?A.buffered?U(A)?I.PARTIAL:I.OK:A.backtrack?I.BACKTRACKED:I.APPENDING:I.NOT_LOADED},y.backtrack=function(_,L){var A=O(_),C=this.fragments[A];if(!C||C.backtrack)return null;var d=C.backtrack=L||C.loaded;return C.loaded=null,d},y.getBacktrackData=function(_){var L=O(_),A=this.fragments[L];if(A){var C,d=A.backtrack;if(d!=null&&(C=d.payload)!==null&&C!==void 0&&C.byteLength)return d;this.removeFragment(_)}return null},y.isTimeBuffered=function(_,L,A){for(var C,d,o=0;o<A.length;o++){if(C=A.start(o)-this.bufferPadding,d=A.end(o)+this.bufferPadding,_>=C&&L<=d)return!0;if(L<=C)return!1}return!1},y.onFragLoaded=function(_,L){var A=L.frag,C=L.part;if(A.sn==="initSegment"||A.bitrateTest||C)return;var d=O(A);this.fragments[d]={body:A,loaded:L,backtrack:null,buffered:!1,range:Object.create(null)}},y.onBufferAppended=function(_,L){var A=this,C=L.frag,d=L.part,o=L.timeRanges;if(C.type===P.PlaylistLevelType.MAIN)if(this.activeFragment=C,d){var l=this.activeParts;l||(this.activeParts=l=[]),l.push(d)}else this.activeParts=null;this.timeRanges=o,Object.keys(o).forEach(function(h){var T=o[h];if(A.detectEvictedFragments(h,T),!d)for(var f=0;f<T.length;f++)C.appendedPTS=Math.max(T.end(f),C.appendedPTS||0)})},y.onFragBuffered=function(_,L){this.detectPartialFragments(L)},y.hasFragment=function(_){var L=O(_);return!!this.fragments[L]},y.removeFragmentsInRange=function(_,L,A){var C=this;Object.keys(this.fragments).forEach(function(d){var o=C.fragments[d];if(!o)return;if(o.buffered){var l=o.body;l.type===A&&l.start<L&&l.end>_&&C.removeFragment(l)}})},y.removeFragment=function(_){var L=O(_);_.stats.loaded=0,_.clearElementaryStreamInfo(),delete this.fragments[L]},y.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},R}();function U(R){var y,w;return R.buffered&&(((y=R.range.video)===null||y===void 0?void 0:y.partial)||((w=R.range.audio)===null||w===void 0?void 0:w.partial))}function O(R){return R.type+"_"+R.level+"_"+R.urlId+"_"+R.sn}},"./src/controller/gap-controller.ts":function(oe,Z,k){"use strict";k.r(Z),k.d(Z,"STALL_MINIMUM_DURATION_MS",function(){return U}),k.d(Z,"MAX_START_GAP_JUMP",function(){return O}),k.d(Z,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return R}),k.d(Z,"SKIP_BUFFER_RANGE_START",function(){return y}),k.d(Z,"default",function(){return w});var Y=k("./src/utils/buffer-helper.ts"),P=k("./src/errors.ts"),I=k("./src/events.ts"),H=k("./src/utils/logger.ts"),U=250,O=2,R=.1,y=.05,w=function(){function _(A,C,d,o){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=A,this.media=C,this.fragmentTracker=d,this.hls=o}var L=_.prototype;return L.destroy=function(){this.hls=this.fragmentTracker=this.media=null},L.poll=function(C){var d=this.config,o=this.media,l=this.stalled,h=o.currentTime,T=o.seeking,f=this.seeking&&!T,p=!this.seeking&&T;if(this.seeking=T,h!==C){if(this.moved=!0,l!==null){if(this.stallReported){var D=self.performance.now()-l;H.logger.warn("playback not stuck anymore @"+h+", after "+Math.round(D)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((p||f)&&(this.stalled=null),o.paused||o.ended||o.playbackRate===0||!Y.BufferHelper.getBuffered(o).length)return;var E=Y.BufferHelper.bufferInfo(o,h,0),g=E.len>0,c=E.nextStart||0;if(!g&&!c)return;if(T){var u=E.len>O,a=!c||c-h>O&&!this.fragmentTracker.getPartialFragment(h);if(u||a)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var x,b=Math.max(c,E.start||0)-h,v=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,M=v==null||((x=v.details)===null||x===void 0)?void 0:x.live,G=M?v.details.targetduration*2:O;if(b>0&&b<=G){this._trySkipBufferHole(null);return}}var X=self.performance.now();if(l===null){this.stalled=X;return}var Q=X-l;!T&&Q>=U&&this._reportStall(E.len);var z=Y.BufferHelper.bufferInfo(o,h,d.maxBufferHole);this._tryFixBufferStall(z,Q)},L._tryFixBufferStall=function(C,d){var o=this.config,l=this.fragmentTracker,h=this.media,T=h.currentTime,f=l.getPartialFragment(T);if(f){var p=this._trySkipBufferHole(f);if(p)return}C.len>o.maxBufferHole&&d>o.highBufferWatchdogPeriod*1e3&&(H.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},L._reportStall=function(C){var d=this.hls,o=this.media,l=this.stallReported;l||(this.stallReported=!0,H.logger.warn("Playback stalling at @"+o.currentTime+" due to low buffer (buffer="+C+")"),d.trigger(I.Events.ERROR,{type:P.ErrorTypes.MEDIA_ERROR,details:P.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:C}))},L._trySkipBufferHole=function(C){for(var d=this.config,o=this.hls,l=this.media,h=l.currentTime,T=0,f=Y.BufferHelper.getBuffered(l),p=0;p<f.length;p++){var D=f.start(p);if(h+d.maxBufferHole>=T&&h<D){var E=Math.max(D+y,l.currentTime+R);return H.logger.warn("skipping hole, adjusting currentTime from "+h+" to "+E),this.moved=!0,this.stalled=null,l.currentTime=E,C&&o.trigger(I.Events.ERROR,{type:P.ErrorTypes.MEDIA_ERROR,details:P.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+h+" to "+E,frag:C}),E}T=f.end(p)}return 0},L._tryNudgeBuffer=function(){var C=this.config,d=this.hls,o=this.media,l=o.currentTime,h=(this.nudgeRetry||0)+1;if(this.nudgeRetry=h,h<C.nudgeMaxRetry){var T=l+h*C.nudgeOffset;H.logger.warn("Nudging 'currentTime' from "+l+" to "+T),o.currentTime=T,d.trigger(I.Events.ERROR,{type:P.ErrorTypes.MEDIA_ERROR,details:P.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else H.logger.error("Playhead still not moving while enough data buffered @"+l+" after "+C.nudgeMaxRetry+" nudges"),d.trigger(I.Events.ERROR,{type:P.ErrorTypes.MEDIA_ERROR,details:P.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},_}()},"./src/controller/id3-track-controller.ts":function(oe,Z,k){"use strict";k.r(Z);var Y=k("./src/events.ts"),P=k("./src/utils/texttrack-utils.ts"),I=k("./src/demux/id3.ts"),H=.25,U=function(){function O(y){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=y,this._registerListeners()}var R=O.prototype;return R.destroy=function(){this._unregisterListeners()},R._registerListeners=function(){var w=this.hls;w.on(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),w.on(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),w.on(Y.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),w.on(Y.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},R._unregisterListeners=function(){var w=this.hls;w.off(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),w.off(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),w.off(Y.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),w.off(Y.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},R.onMediaAttached=function(w,_){this.media=_.media},R.onMediaDetaching=function(){if(!this.id3Track)return;Object(P.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},R.getID3Track=function(w){if(!this.media)return;for(var _=0;_<w.length;_++){var L=w[_];if(L.kind==="metadata"&&L.label==="id3")return Object(P.sendAddTrackEvent)(L,this.media),L}return this.media.addTextTrack("metadata","id3")},R.onFragParsingMetadata=function(w,_){if(!this.media)return;var L=_.frag,A=_.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var C=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,d=0;d<A.length;d++){var o=I.getID3Frames(A[d].data);if(o){var l=A[d].pts,h=d<A.length-1?A[d+1].pts:L.end,T=h-l;T<=0&&(h=l+H);for(var f=0;f<o.length;f++){var p=o[f];if(!I.isTimeStampFrame(p)){var D=new C(l,h,"");D.value=p,this.id3Track.addCue(D)}}}}},R.onBufferFlushing=function(w,_){var L=_.startOffset,A=_.endOffset,C=_.type;if(!C||C==="audio"){var d=this.id3Track;d&&Object(P.removeCuesInRange)(d,L,A)}},O}();Z.default=U},"./src/controller/latency-controller.ts":function(oe,Z,k){"use strict";k.r(Z),k.d(Z,"default",function(){return O});var Y=k("./src/errors.ts"),P=k("./src/events.ts"),I=k("./src/utils/logger.ts");function H(R,y){for(var w=0;w<y.length;w++){var _=y[w];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(R,_.key,_)}}function U(R,y,w){return y&&H(R.prototype,y),w&&H(R,w),R}var O=function(){function R(w){var _=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 _.timeupdate()},this.hls=w,this.config=w.config,this.registerListeners()}var y=R.prototype;return y.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},y.registerListeners=function(){this.hls.on(P.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(P.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(P.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(P.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(P.Events.ERROR,this.onError,this)},y.unregisterListeners=function(){this.hls.off(P.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(P.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(P.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(P.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(P.Events.ERROR,this.onError)},y.onMediaAttached=function(_,L){this.media=L.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},y.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},y.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},y.onLevelUpdated=function(_,L){var A=L.details;this.levelDetails=A,A.advanced&&this.timeupdate(),!A.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},y.onError=function(_,L){if(L.details!==Y.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,I.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},y.timeupdate=function(){var _=this.media,L=this.levelDetails;if(!_||!L)return;this.currentTime=_.currentTime;var A=this.computeLatency();if(A===null)return;this._latency=A;var C=this.config,d=C.lowLatencyMode,o=C.maxLiveSyncPlaybackRate;if(!d||o===1)return;var l=this.targetLatency;if(l===null)return;var h=A-l,T=Math.min(this.maxLatency,l+L.targetduration),f=h<T;if(L.live&&f&&h>.05&&this.forwardBufferLength>1){var p=Math.min(2,Math.max(1,o)),D=Math.round(2/(1+Math.exp(-.75*h-this.edgeStalled))*20)/20;_.playbackRate=Math.min(p,Math.max(1,D))}else _.playbackRate!==1&&_.playbackRate!==0&&(_.playbackRate=1)},y.estimateLiveEdge=function(){var _=this.levelDetails;return _===null?null:_.edge+_.age},y.computeLatency=function(){var _=this.estimateLiveEdge();return _===null?null:_-this.currentTime},U(R,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var _=this.config,L=this.levelDetails;return _.liveMaxLatencyDuration!==void 0?_.liveMaxLatencyDuration:L?_.liveMaxLatencyDurationCount*L.targetduration:0}},{key:"targetLatency",get:function(){var _=this.levelDetails;if(_===null)return null;var L=_.holdBack,A=_.partHoldBack,C=_.targetduration,d=this.config,o=d.liveSyncDuration,l=d.liveSyncDurationCount,h=d.lowLatencyMode,T=this.hls.userConfig,f=h&&A||L;(T.liveSyncDuration||T.liveSyncDurationCount||f===0)&&(f=o!==void 0?o:l*C);var p=C,D=1;return f+Math.min(this.stallCount*D,p)}},{key:"liveSyncPosition",get:function(){var _=this.estimateLiveEdge(),L=this.targetLatency,A=this.levelDetails;if(_===null||L===null||A===null)return null;var C=A.edge,d=_-L-this.edgeStalled,o=C-A.totalduration,l=C-(this.config.lowLatencyMode&&A.partTarget||A.targetduration);return Math.min(Math.max(o,d),l)}},{key:"drift",get:function(){var _=this.levelDetails;return _===null?1:_.drift}},{key:"edgeStalled",get:function(){var _=this.levelDetails;if(_===null)return 0;var L=(this.config.lowLatencyMode&&_.partTarget||_.targetduration)*3;return Math.max(_.age-L,0)}},{key:"forwardBufferLength",get:function(){var _=this.media,L=this.levelDetails;if(!_||!L)return 0;var A=_.buffered.length;return A?_.buffered.end(A-1):L.edge-this.currentTime}}]),R}()},"./src/controller/level-controller.ts":function(oe,Z,k){"use strict";k.r(Z),k.d(Z,"default",function(){return d});var Y=k("./src/types/level.ts"),P=k("./src/events.ts"),I=k("./src/errors.ts"),H=k("./src/utils/codecs.ts"),U=k("./src/controller/level-helper.ts"),O=k("./src/controller/base-playlist-controller.ts"),R=k("./src/types/loader.ts");function y(){return y=Object.assign||function(o){for(var l=1;l<arguments.length;l++){var h=arguments[l];for(var T in h)Object.prototype.hasOwnProperty.call(h,T)&&(o[T]=h[T])}return o},y.apply(this,arguments)}function w(o,l){for(var h=0;h<l.length;h++){var T=l[h];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(o,T.key,T)}}function _(o,l,h){return l&&w(o.prototype,l),h&&w(o,h),o}function L(o,l){o.prototype=Object.create(l.prototype),o.prototype.constructor=o,A(o,l)}function A(o,l){return A=Object.setPrototypeOf||function(T,f){return T.__proto__=f,T},A(o,l)}var C=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),d=function(o){L(l,o);function l(T){var f;return f=o.call(this,T,"[level-controller]")||this,f._levels=[],f._firstLevel=-1,f._startLevel=void 0,f.currentLevelIndex=-1,f.manualLevelIndex=-1,f.onParsedComplete=void 0,f._registerListeners(),f}var h=l.prototype;return h._registerListeners=function(){var f=this.hls;f.on(P.Events.MANIFEST_LOADED,this.onManifestLoaded,this),f.on(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),f.on(P.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),f.on(P.Events.FRAG_LOADED,this.onFragLoaded,this),f.on(P.Events.ERROR,this.onError,this)},h._unregisterListeners=function(){var f=this.hls;f.off(P.Events.MANIFEST_LOADED,this.onManifestLoaded,this),f.off(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),f.off(P.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),f.off(P.Events.FRAG_LOADED,this.onFragLoaded,this),f.off(P.Events.ERROR,this.onError,this)},h.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,o.prototype.destroy.call(this)},h.startLoad=function(){var f=this._levels;f.forEach(function(p){p.loadError=0}),o.prototype.startLoad.call(this)},h.onManifestLoaded=function(f,p){var D=[],E=[],g=[],c,u={},a,x=!1,b=!1,v=!1;if(p.levels.forEach(function(Q){var z=Q.attrs;x=x||!!(Q.width&&Q.height),b=b||!!Q.videoCodec,v=v||!!Q.audioCodec,C&&Q.audioCodec&&Q.audioCodec.indexOf("mp4a.40.34")!==-1&&(Q.audioCodec=void 0);var j=Q.bitrate+"-"+Q.attrs.RESOLUTION+"-"+Q.attrs.CODECS;a=u[j],a?a.url.push(Q.url):(a=new Y.Level(Q),u[j]=a,D.push(a)),z&&(z.AUDIO&&Object(U.addGroupId)(a,"audio",z.AUDIO),z.SUBTITLES&&Object(U.addGroupId)(a,"text",z.SUBTITLES))}),(x||b)&&v&&(D=D.filter(function(Q){var z=Q.videoCodec,j=Q.width,q=Q.height;return!!z||!!(j&&q)})),D=D.filter(function(Q){var z=Q.audioCodec,j=Q.videoCodec;return(!z||Object(H.isCodecSupportedInMp4)(z,"audio"))&&(!j||Object(H.isCodecSupportedInMp4)(j,"video"))}),p.audioTracks&&(E=p.audioTracks.filter(function(Q){return!Q.audioCodec||Object(H.isCodecSupportedInMp4)(Q.audioCodec,"audio")}),Object(U.assignTrackIdsByGroup)(E)),p.subtitles&&(g=p.subtitles,Object(U.assignTrackIdsByGroup)(g)),D.length>0){c=D[0].bitrate,D.sort(function(Q,z){return Q.bitrate-z.bitrate}),this._levels=D;for(var M=0;M<D.length;M++)if(D[M].bitrate===c){this._firstLevel=M,this.log("manifest loaded, "+D.length+" level(s) found, first bitrate: "+c);break}var G=v&&!b,X={levels:D,audioTracks:E,subtitleTracks:g,firstLevel:this._firstLevel,stats:p.stats,audio:v,video:b,altAudio:!G&&E.some(function(Q){return!!Q.url})};this.hls.trigger(P.Events.MANIFEST_PARSED,X),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(P.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:p.url,reason:"no level with compatible codecs found in manifest"})},h.onError=function(f,p){if(o.prototype.onError.call(this,f,p),p.fatal)return;var D=p.context,E=this._levels[this.currentLevelIndex];if(D&&(D.type===R.PlaylistContextType.AUDIO_TRACK&&E.audioGroupIds&&D.groupId===E.audioGroupIds[E.urlId]||D.type===R.PlaylistContextType.SUBTITLE_TRACK&&E.textGroupIds&&D.groupId===E.textGroupIds[E.urlId])){this.redundantFailover(this.currentLevelIndex);return}var g=!1,c=!0,u;switch(p.details){case I.ErrorDetails.FRAG_LOAD_ERROR:case I.ErrorDetails.FRAG_LOAD_TIMEOUT:case I.ErrorDetails.KEY_LOAD_ERROR:case I.ErrorDetails.KEY_LOAD_TIMEOUT:if(p.frag){var a=this._levels[p.frag.level];a?(a.fragmentError++,a.fragmentError>this.hls.config.fragLoadingMaxRetry&&(u=p.frag.level)):u=p.frag.level}break;case I.ErrorDetails.LEVEL_LOAD_ERROR:case I.ErrorDetails.LEVEL_LOAD_TIMEOUT:D&&(D.deliveryDirectives&&(c=!1),u=D.level),g=!0;break;case I.ErrorDetails.REMUX_ALLOC_ERROR:u=p.level,g=!0;break}u!==void 0&&this.recoverLevel(p,u,g,c)},h.recoverLevel=function(f,p,D,E){var g=f.details,c=this._levels[p];if(c.loadError++,D){var u=this.retryLoadingOrFail(f);if(u)f.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(E){var a=c.url.length;if(a>1&&c.loadError<a)f.levelRetry=!0,this.redundantFailover(p);else if(this.manualLevelIndex===-1){var x=p===0?this._levels.length-1:p-1;this.currentLevelIndex!==x&&this._levels[x].loadError===0&&(this.warn(g+": switch to "+x),f.levelRetry=!0,this.hls.nextAutoLevel=x)}}},h.redundantFailover=function(f){var p=this._levels[f],D=p.url.length;if(D>1){var E=(p.urlId+1)%D;this.warn("Switching to redundant URL-id "+E),this._levels.forEach(function(g){g.urlId=E}),this.level=f}},h.onFragLoaded=function(f,p){var D=p.frag;if(D!==void 0&&D.type===R.PlaylistLevelType.MAIN){var E=this._levels[D.level];E!==void 0&&(E.fragmentError=0,E.loadError=0)}},h.onLevelLoaded=function(f,p){var D,E=p.level,g=p.details,c=this._levels[E];if(!c){var u;this.warn("Invalid level index "+E),(u=p.deliveryDirectives)!==null&&u!==void 0&&u.skip&&(g.deltaUpdateFailed=!0);return}E===this.currentLevelIndex?(c.fragmentError===0&&(c.loadError=0,this.retryCount=0),this.playlistLoaded(E,p,c.details)):(D=p.deliveryDirectives)!==null&&D!==void 0&&D.skip&&(g.deltaUpdateFailed=!0)},h.onAudioTrackSwitched=function(f,p){var D=this.hls.levels[this.currentLevelIndex];if(!D)return;if(D.audioGroupIds){for(var E=-1,g=this.hls.audioTracks[p.id].groupId,c=0;c<D.audioGroupIds.length;c++)if(D.audioGroupIds[c]===g){E=c;break}E!==D.urlId&&(D.urlId=E,this.startLoad())}},h.loadPlaylist=function(f){var p=this.currentLevelIndex,D=this._levels[p];if(this.canLoad&&D&&D.url.length>0){var E=D.urlId,g=D.url[E];if(f)try{g=f.addDirectives(g)}catch(c){this.warn("Could not construct new URL with HLS Delivery Directives: "+c)}this.log("Attempt loading level index "+p+(f?" at sn "+f.msn+" part "+f.part:"")+" with URL-id "+E+" "+g),this.clearTimer(),this.hls.trigger(P.Events.LEVEL_LOADING,{url:g,level:p,id:E,deliveryDirectives:f||null})}},h.removeLevel=function(f,p){var D=function(c,u){return u!==p},E=this._levels.filter(function(g,c){return c!==f?!0:g.url.length>1&&p!==void 0?(g.url=g.url.filter(D),g.audioGroupIds&&(g.audioGroupIds=g.audioGroupIds.filter(D)),g.textGroupIds&&(g.textGroupIds=g.textGroupIds.filter(D)),g.urlId=0,!0):!1}).map(function(g,c){var u=g.details;return u!=null&&u.fragments&&u.fragments.forEach(function(a){a.level=c}),g});this._levels=E,this.hls.trigger(P.Events.LEVELS_UPDATED,{levels:E})},_(l,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(f){var p,D=this._levels;if(D.length===0)return;if(this.currentLevelIndex===f&&(p=D[f])!==null&&p!==void 0&&p.details)return;if(f<0||f>=D.length){var E=f<0;if(this.hls.trigger(P.Events.ERROR,{type:I.ErrorTypes.OTHER_ERROR,details:I.ErrorDetails.LEVEL_SWITCH_ERROR,level:f,fatal:E,reason:"invalid level idx"}),E)return;f=Math.min(f,D.length-1)}this.clearTimer();var g=this.currentLevelIndex,c=D[g],u=D[f];this.log("switching to level "+f+" from "+g),this.currentLevelIndex=f;var a=y({},u,{level:f,maxBitrate:u.maxBitrate,uri:u.uri,urlId:u.urlId});delete a._urlId,this.hls.trigger(P.Events.LEVEL_SWITCHING,a);var x=u.details;if(!x||x.live){var b=this.switchParams(u.uri,c==null?void 0:c.details);this.loadPlaylist(b)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(f){this.manualLevelIndex=f,this._startLevel===void 0&&(this._startLevel=f),f!==-1&&(this.level=f)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(f){this._firstLevel=f}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var f=this.hls.config.startLevel;return f!==void 0?f:this._firstLevel}else return this._startLevel},set:function(f){this._startLevel=f}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(f){this.level=f,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=f)}}]),l}(O.default)},"./src/controller/level-helper.ts":function(oe,Z,k){"use strict";k.r(Z),k.d(Z,"addGroupId",function(){return I}),k.d(Z,"assignTrackIdsByGroup",function(){return H}),k.d(Z,"updatePTS",function(){return U}),k.d(Z,"updateFragPTSDTS",function(){return R}),k.d(Z,"mergeDetails",function(){return y}),k.d(Z,"mapPartIntersection",function(){return w}),k.d(Z,"mapFragmentIntersection",function(){return _}),k.d(Z,"adjustSliding",function(){return L}),k.d(Z,"addSliding",function(){return A}),k.d(Z,"computeReloadInterval",function(){return C}),k.d(Z,"getFragmentWithSN",function(){return d}),k.d(Z,"getPartWith",function(){return o});var Y=k("./src/polyfills/number.ts"),P=k("./src/utils/logger.ts");function I(l,h,T){switch(h){case"audio":l.audioGroupIds||(l.audioGroupIds=[]),l.audioGroupIds.push(T);break;case"text":l.textGroupIds||(l.textGroupIds=[]),l.textGroupIds.push(T);break}}function H(l){var h={};l.forEach(function(T){var f=T.groupId||"";T.id=h[f]=h[f]||0,h[f]++})}function U(l,h,T){var f=l[h],p=l[T];O(f,p)}function O(l,h){var T=h.startPTS;if(Object(Y.isFiniteNumber)(T)){var f=0,p;h.sn>l.sn?(f=T-l.start,p=l):(f=l.start-T,p=h),p.duration!==f&&(p.duration=f)}else if(h.sn>l.sn){var D=l.cc===h.cc;D&&l.minEndPTS?h.start=l.start+(l.minEndPTS-l.start):h.start=l.start+l.duration}else h.start=Math.max(l.start-h.duration,0)}function R(l,h,T,f,p,D){var E=f-T;E<=0&&(P.logger.warn("Fragment should have a positive duration",h),f=T+h.duration,D=p+h.duration);var g=T,c=f,u=h.startPTS,a=h.endPTS;if(Object(Y.isFiniteNumber)(u)){var x=Math.abs(u-T);Object(Y.isFiniteNumber)(h.deltaPTS)?h.deltaPTS=Math.max(x,h.deltaPTS):h.deltaPTS=x,g=Math.max(T,u),T=Math.min(T,u),p=Math.min(p,h.startDTS),c=Math.min(f,a),f=Math.max(f,a),D=Math.max(D,h.endDTS)}h.duration=f-T;var b=T-h.start;h.appendedPTS=f,h.start=h.startPTS=T,h.maxStartPTS=g,h.startDTS=p,h.endPTS=f,h.minEndPTS=c,h.endDTS=D;var v=h.sn;if(!l||v<l.startSN||v>l.endSN)return 0;var M,G=v-l.startSN,X=l.fragments;for(X[G]=h,M=G;M>0;M--)O(X[M],X[M-1]);for(M=G;M<X.length-1;M++)O(X[M],X[M+1]);return l.fragmentHint&&O(X[X.length-1],l.fragmentHint),l.PTSKnown=l.alignedSliding=!0,b}function y(l,h){for(var T=null,f=l.fragments,p=f.length-1;p>=0;p--){var D=f[p].initSegment;if(D){T=D;break}}l.fragmentHint&&delete l.fragmentHint.endPTS;var E=0,g;if(_(l,h,function(M,G){M.relurl&&(E=M.cc-G.cc),Object(Y.isFiniteNumber)(M.startPTS)&&Object(Y.isFiniteNumber)(M.endPTS)&&(G.start=G.startPTS=M.startPTS,G.startDTS=M.startDTS,G.appendedPTS=M.appendedPTS,G.maxStartPTS=M.maxStartPTS,G.endPTS=M.endPTS,G.endDTS=M.endDTS,G.minEndPTS=M.minEndPTS,G.duration=M.endPTS-M.startPTS,G.duration&&(g=G),h.PTSKnown=h.alignedSliding=!0),G.elementaryStreams=M.elementaryStreams,G.loader=M.loader,G.stats=M.stats,G.urlId=M.urlId,M.initSegment&&(G.initSegment=M.initSegment,T=M.initSegment)}),T){var c=h.fragmentHint?h.fragments.concat(h.fragmentHint):h.fragments;c.forEach(function(M){var G;(!M.initSegment||M.initSegment.relurl===((G=T)===null||G===void 0?void 0:G.relurl))&&(M.initSegment=T)})}if(h.skippedSegments&&(h.deltaUpdateFailed=h.fragments.some(function(M){return!M}),h.deltaUpdateFailed)){P.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var u=h.skippedSegments;u--;)h.fragments.shift();h.startSN=h.fragments[0].sn,h.startCC=h.fragments[0].cc}var a=h.fragments;if(E){P.logger.warn("discontinuity sliding from playlist, take drift into account");for(var x=0;x<a.length;x++)a[x].cc+=E}h.skippedSegments&&(h.startCC=h.fragments[0].cc),w(l.partList,h.partList,function(M,G){G.elementaryStreams=M.elementaryStreams,G.stats=M.stats}),g?R(h,g,g.startPTS,g.endPTS,g.startDTS,g.endDTS):L(l,h),a.length&&(h.totalduration=h.edge-a[0].start),h.driftStartTime=l.driftStartTime,h.driftStart=l.driftStart;var b=h.advancedDateTime;if(h.advanced&&b){var v=h.edge;h.driftStart||(h.driftStartTime=b,h.driftStart=v),h.driftEndTime=b,h.driftEnd=v}else h.driftEndTime=l.driftEndTime,h.driftEnd=l.driftEnd,h.advancedDateTime=l.advancedDateTime}function w(l,h,T){if(l&&h)for(var f=0,p=0,D=l.length;p<=D;p++){var E=l[p],g=h[p+f];E&&g&&E.index===g.index&&E.fragment.sn===g.fragment.sn?T(E,g):f--}}function _(l,h,T){for(var f=h.skippedSegments,p=Math.max(l.startSN,h.startSN)-h.startSN,D=(l.fragmentHint?1:0)+(f?h.endSN:Math.min(l.endSN,h.endSN))-h.startSN,E=h.startSN-l.startSN,g=h.fragmentHint?h.fragments.concat(h.fragmentHint):h.fragments,c=l.fragmentHint?l.fragments.concat(l.fragmentHint):l.fragments,u=p;u<=D;u++){var a=c[E+u],x=g[u];f&&!x&&u<f&&(x=h.fragments[u]=a),a&&x&&T(a,x)}}function L(l,h){var T=h.startSN+h.skippedSegments-l.startSN,f=l.fragments;if(T<0||T>=f.length)return;A(h,f[T].start)}function A(l,h){if(h){for(var T=l.fragments,f=l.skippedSegments;f<T.length;f++)T[f].start+=h;l.fragmentHint&&(l.fragmentHint.start+=h)}}function C(l,h){var T=1e3*l.levelTargetDuration,f=T/2,p=l.age,D=p>0&&p<T*3,E=h.loading.end-h.loading.start,g,c=l.availabilityDelay;if(l.updated===!1)if(D){var u=333*l.misses;g=Math.max(Math.min(f,E*2),u),l.availabilityDelay=(l.availabilityDelay||0)+g}else g=f;else D?(c=Math.min(c||T/2,p),l.availabilityDelay=c,g=c+T-p):g=T-E;return Math.round(g)}function d(l,h,T){if(!l||!l.details)return null;var f=l.details,p=f.fragments[h-f.startSN];return p||(p=f.fragmentHint,p&&p.sn===h?p:h<f.startSN&&T&&T.sn===h?T:null)}function o(l,h,T){if(!l||!l.details)return null;var f=l.details.partList;if(f)for(var p=f.length;p--;){var D=f[p];if(D.index===T&&D.fragment.sn===h)return D}return null}},"./src/controller/stream-controller.ts":function(oe,Z,k){"use strict";k.r(Z),k.d(Z,"default",function(){return f});var Y=k("./src/polyfills/number.ts"),P=k("./src/controller/base-stream-controller.ts"),I=k("./src/is-supported.ts"),H=k("./src/events.ts"),U=k("./src/utils/buffer-helper.ts"),O=k("./src/controller/fragment-tracker.ts"),R=k("./src/types/loader.ts"),y=k("./src/loader/fragment.ts"),w=k("./src/demux/transmuxer-interface.ts"),_=k("./src/types/transmuxer.ts"),L=k("./src/controller/gap-controller.ts"),A=k("./src/errors.ts"),C=k("./src/utils/logger.ts");function d(p,D){for(var E=0;E<D.length;E++){var g=D[E];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(p,g.key,g)}}function o(p,D,E){return D&&d(p.prototype,D),E&&d(p,E),p}function l(p,D){p.prototype=Object.create(D.prototype),p.prototype.constructor=p,h(p,D)}function h(p,D){return h=Object.setPrototypeOf||function(g,c){return g.__proto__=c,g},h(p,D)}var T=100,f=function(p){l(D,p);function D(g,c){var u;return u=p.call(this,g,c,"[stream-controller]")||this,u.audioCodecSwap=!1,u.gapController=null,u.level=-1,u._forceStartLoad=!1,u.altAudio=!1,u.audioOnly=!1,u.fragPlaying=null,u.onvplaying=null,u.onvseeked=null,u.fragLastKbps=0,u.stalled=!1,u.couldBacktrack=!1,u.audioCodecSwitch=!1,u.videoBuffer=null,u._registerListeners(),u}var E=D.prototype;return E._registerListeners=function(){var c=this.hls;c.on(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),c.on(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.on(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.on(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.on(H.Events.LEVEL_LOADING,this.onLevelLoading,this),c.on(H.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.on(H.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),c.on(H.Events.ERROR,this.onError,this),c.on(H.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),c.on(H.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),c.on(H.Events.BUFFER_CREATED,this.onBufferCreated,this),c.on(H.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),c.on(H.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),c.on(H.Events.FRAG_BUFFERED,this.onFragBuffered,this)},E._unregisterListeners=function(){var c=this.hls;c.off(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),c.off(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.off(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.off(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.off(H.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.off(H.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),c.off(H.Events.ERROR,this.onError,this),c.off(H.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),c.off(H.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),c.off(H.Events.BUFFER_CREATED,this.onBufferCreated,this),c.off(H.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),c.off(H.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),c.off(H.Events.FRAG_BUFFERED,this.onFragBuffered,this)},E.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},E.startLoad=function(c){if(this.levels){var u=this.lastCurrentTime,a=this.hls;if(this.stopLoad(),this.setInterval(T),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var x=a.startLevel;x===-1&&(a.config.testBandwidth?(x=0,this.bitrateTest=!0):x=a.nextAutoLevel),this.level=a.nextLoadLevel=x,this.loadedmetadata=!1}u>0&&c===-1&&(this.log("Override startPosition with lastCurrentTime @"+u.toFixed(3)),c=u),this.state=P.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=c,this.tick()}else this._forceStartLoad=!0,this.state=P.State.STOPPED},E.stopLoad=function(){this._forceStartLoad=!1,p.prototype.stopLoad.call(this)},E.doTick=function(){switch(this.state){case P.State.IDLE:this.doTickIdle();break;case P.State.WAITING_LEVEL:{var c,u=this.levels,a=this.level,x=u==null||((c=u[a])===null||c===void 0)?void 0:c.details;if(x&&(!x.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(x))break;this.state=P.State.IDLE;break}break}case P.State.FRAG_LOADING_WAITING_RETRY:{var b,v=self.performance.now(),M=this.retryDate;(!M||v>=M||(b=this.media)!==null&&b!==void 0&&b.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=P.State.IDLE)}break;default:break}this.onTickEnd()},E.onTickEnd=function(){p.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},E.doTickIdle=function(){var c,u,a=this.hls,x=this.levelLastLoaded,b=this.levels,v=this.media,M=a.config,G=a.nextLoadLevel;if(x===null||!v&&(this.startFragRequested||!M.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!b||!b[G])return;var X=b[G];this.level=a.nextLoadLevel=G;var Q=X.details;if(!Q||this.state===P.State.WAITING_LEVEL||Q.live&&this.levelLastLoaded!==G){this.state=P.State.WAITING_LEVEL;return}var z=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:v,R.PlaylistLevelType.MAIN);if(z===null)return;var j=z.len,q=this.getMaxBufferLength(X.maxBitrate);if(j>=q)return;if(this._streamEnded(z,Q)){var le={};this.altAudio&&(le.type="video"),this.hls.trigger(H.Events.BUFFER_EOS,le),this.state=P.State.ENDED;return}var me=z.end,be=this.getNextFragment(me,Q);if(this.couldBacktrack&&!this.fragPrevious&&be&&be.sn!=="initSegment"){var Be=be.sn-Q.startSN;Be>1&&(be=Q.fragments[Be-1],this.fragmentTracker.removeFragment(be))}if(be&&this.fragmentTracker.getState(be)===O.FragmentState.OK&&this.nextLoadPosition>me){var Le=this.audioOnly&&!this.altAudio?y.ElementaryStreamTypes.AUDIO:y.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(v,Le,R.PlaylistLevelType.MAIN),be=this.getNextFragment(this.nextLoadPosition,Q)}if(!be)return;be.initSegment&&!be.initSegment.data&&!this.bitrateTest&&(be=be.initSegment),((c=be.decryptdata)===null||c===void 0?void 0:c.keyFormat)==="identity"&&!((u=be.decryptdata)!==null&&u!==void 0&&u.key)?this.loadKey(be,Q):this.loadFragment(be,Q,me)},E.loadFragment=function(c,u,a){var x,b=this.fragmentTracker.getState(c);if(this.fragCurrent=c,b===O.FragmentState.BACKTRACKED){var v=this.fragmentTracker.getBacktrackData(c);if(v){this._handleFragmentLoadProgress(v),this._handleFragmentLoadComplete(v);return}else b=O.FragmentState.NOT_LOADED}b===O.FragmentState.NOT_LOADED||b===O.FragmentState.PARTIAL?c.sn==="initSegment"?this._loadInitSegment(c):this.bitrateTest?(c.bitrateTest=!0,this.log("Fragment "+c.sn+" of level "+c.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(c)):(this.startFragRequested=!0,p.prototype.loadFragment.call(this,c,u,a)):b===O.FragmentState.APPENDING?this.reduceMaxBufferLength(c.duration)&&this.fragmentTracker.removeFragment(c):((x=this.media)===null||x===void 0?void 0:x.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},E.getAppendedFrag=function(c){var u=this.fragmentTracker.getAppendedFrag(c,R.PlaylistLevelType.MAIN);return u&&"fragment"in u?u.fragment:u},E.getBufferedFrag=function(c){return this.fragmentTracker.getBufferedFrag(c,R.PlaylistLevelType.MAIN)},E.followingBufferedFrag=function(c){return c?this.getBufferedFrag(c.end+.5):null},E.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},E.nextLevelSwitch=function(){var c=this.levels,u=this.media;if(u!=null&&u.readyState){var a,x=this.getAppendedFrag(u.currentTime);if(x&&x.start>1&&this.flushMainBuffer(0,x.start-1),!u.paused&&c){var b=this.hls.nextLoadLevel,v=c[b],M=this.fragLastKbps;M&&this.fragCurrent?a=this.fragCurrent.duration*v.maxBitrate/(1e3*M)+1:a=0}else a=0;var G=this.getBufferedFrag(u.currentTime+a);if(G){var X=this.followingBufferedFrag(G);if(X){this.abortCurrentFrag();var Q=X.maxStartPTS?X.maxStartPTS:X.start,z=X.duration,j=Math.max(G.end,Q+Math.min(Math.max(z-this.config.maxFragLookUpTolerance,z*.5),z*.75));this.flushMainBuffer(j,Number.POSITIVE_INFINITY)}}}},E.abortCurrentFrag=function(){var c=this.fragCurrent;this.fragCurrent=null,c!=null&&c.loader&&c.loader.abort(),this.state===P.State.KEY_LOADING&&(this.state=P.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},E.flushMainBuffer=function(c,u){p.prototype.flushMainBuffer.call(this,c,u,this.altAudio?"video":null)},E.onMediaAttached=function(c,u){p.prototype.onMediaAttached.call(this,c,u);var a=u.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),a.addEventListener("playing",this.onvplaying),a.addEventListener("seeked",this.onvseeked),this.gapController=new L.default(this.config,a,this.fragmentTracker,this.hls)},E.onMediaDetaching=function(){var c=this.media;c&&(c.removeEventListener("playing",this.onvplaying),c.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),p.prototype.onMediaDetaching.call(this)},E.onMediaPlaying=function(){this.tick()},E.onMediaSeeked=function(){var c=this.media,u=c?c.currentTime:null;Object(Y.isFiniteNumber)(u)&&this.log("Media seeked to "+u.toFixed(3)),this.tick()},E.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(H.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},E.onManifestParsed=function(c,u){var a=!1,x=!1,b;u.levels.forEach(function(v){b=v.audioCodec,b&&(b.indexOf("mp4a.40.2")!==-1&&(a=!0),b.indexOf("mp4a.40.5")!==-1&&(x=!0))}),this.audioCodecSwitch=a&&x&&!Object(I.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=u.levels,this.startFragRequested=!1},E.onLevelLoading=function(c,u){var a=this.levels;if(!a||this.state!==P.State.IDLE)return;var x=a[u.level];(!x.details||x.details.live&&this.levelLastLoaded!==u.level||this.waitForCdnTuneIn(x.details))&&(this.state=P.State.WAITING_LEVEL)},E.onLevelLoaded=function(c,u){var a,x=this.levels,b=u.level,v=u.details,M=v.totalduration;if(!x){this.warn("Levels were reset while loading level "+b);return}this.log("Level "+b+" loaded ["+v.startSN+","+v.endSN+"], cc ["+v.startCC+", "+v.endCC+"] duration:"+M);var G=this.fragCurrent;G&&(this.state===P.State.FRAG_LOADING||this.state===P.State.FRAG_LOADING_WAITING_RETRY)&&(G.level!==u.level&&G.loader&&(this.state=P.State.IDLE,G.loader.abort()));var X=x[b],Q=0;if(v.live||(a=X.details)!==null&&a!==void 0&&a.live){if(v.fragments[0]||(v.deltaUpdateFailed=!0),v.deltaUpdateFailed)return;Q=this.alignPlaylists(v,X.details)}if(X.details=v,this.levelLastLoaded=b,this.hls.trigger(H.Events.LEVEL_UPDATED,{details:v,level:b}),this.state===P.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(v))return;this.state=P.State.IDLE}this.startFragRequested?v.live&&this.synchronizeToLiveEdge(v):this.setStartPosition(v,Q),this.tick()},E._handleFragmentLoadProgress=function(c){var u,a=c.frag,x=c.part,b=c.payload,v=this.levels;if(!v){this.warn("Levels were reset while fragment load was in progress. Fragment "+a.sn+" of level "+a.level+" will not be buffered");return}var M=v[a.level],G=M.details;if(!G){this.warn("Dropping fragment "+a.sn+" of level "+a.level+" after level details were reset");return}var X=M.videoCodec,Q=G.PTSKnown||!G.live,z=(u=a.initSegment)===null||u===void 0?void 0:u.data,j=this._getAudioCodec(M),q=this.transmuxer=this.transmuxer||new w.default(this.hls,R.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),le=x?x.index:-1,me=le!==-1,be=new _.ChunkMetadata(a.level,a.sn,a.stats.chunkCount,b.byteLength,le,me),Be=this.initPTS[a.cc];q.push(b,z,j,X,a,x,G.totalduration,Q,be,Be)},E.onAudioTrackSwitching=function(c,u){var a=this.altAudio,x=!!u.url,b=u.id;if(!x){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;a&&M.trigger(H.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),M.trigger(H.Events.AUDIO_TRACK_SWITCHED,{id:b})}},E.onAudioTrackSwitched=function(c,u){var a=u.id,x=!!this.hls.audioTracks[a].url;if(x){var b=this.videoBuffer;b&&this.mediaBuffer!==b&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=b)}this.altAudio=x,this.tick()},E.onBufferCreated=function(c,u){var a=u.tracks,x,b,v=!1;for(var M in a){var G=a[M];if(G.id==="main"){if(b=M,x=G,M==="video"){var X=a[M];X&&(this.videoBuffer=X.buffer)}}else v=!0}v&&x?(this.log("Alternate track found, use "+b+".buffered to schedule main fragment loading"),this.mediaBuffer=x.buffer):this.mediaBuffer=this.media},E.onFragBuffered=function(c,u){var a=u.frag,x=u.part;if(a&&a.type!==R.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(a)){this.warn("Fragment "+a.sn+(x?" p: "+x.index:"")+" of level "+a.level+" finished buffering, but was aborted. state: "+this.state),this.state===P.State.PARSED&&(this.state=P.State.IDLE);return}var b=x?x.stats:a.stats;this.fragLastKbps=Math.round(8*b.total/(b.buffering.end-b.loading.first)),a.sn!=="initSegment"&&(this.fragPrevious=a),this.fragBufferedComplete(a,x)},E.onError=function(c,u){switch(u.details){case A.ErrorDetails.FRAG_LOAD_ERROR:case A.ErrorDetails.FRAG_LOAD_TIMEOUT:case A.ErrorDetails.KEY_LOAD_ERROR:case A.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(R.PlaylistLevelType.MAIN,u);break;case A.ErrorDetails.LEVEL_LOAD_ERROR:case A.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==P.State.ERROR&&(u.fatal?(this.warn(""+u.details),this.state=P.State.ERROR):!u.levelRetry&&this.state===P.State.WAITING_LEVEL&&(this.state=P.State.IDLE));break;case A.ErrorDetails.BUFFER_FULL_ERROR:if(u.parent==="main"&&(this.state===P.State.PARSING||this.state===P.State.PARSED)){var a=!0,x=this.getFwdBufferInfo(this.media,R.PlaylistLevelType.MAIN);x&&x.len>.5&&(a=!this.reduceMaxBufferLength(x.len)),a&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},E.checkBuffer=function(){var c=this.media,u=this.gapController;if(!c||!u||!c.readyState)return;var a=U.BufferHelper.getBuffered(c);!this.loadedmetadata&&a.length?(this.loadedmetadata=!0,this.seekToStartPos()):u.poll(this.lastCurrentTime),this.lastCurrentTime=c.currentTime},E.onFragLoadEmergencyAborted=function(){this.state=P.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},E.onBufferFlushed=function(c,u){var a=u.type;if(a!==y.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var x=(a===y.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(x,a,R.PlaylistLevelType.MAIN)}},E.onLevelsUpdated=function(c,u){this.levels=u.levels},E.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},E.seekToStartPos=function(){var c=this.media,u=c.currentTime,a=this.startPosition;if(a>=0&&u<a){if(c.seeking){C.logger.log("could not seek to "+a+", already seeking at "+u);return}var x=U.BufferHelper.getBuffered(c),b=x.length?x.start(0):0,v=b-a;v>0&&(v<this.config.maxBufferHole||v<this.config.maxFragLookUpTolerance)&&(C.logger.log("adjusting start position by "+v+" to match buffer start"),a+=v,this.startPosition=a),this.log("seek to target start position "+a+" from current time "+u),c.currentTime=a}},E._getAudioCodec=function(c){var u=this.config.defaultAudioCodec||c.audioCodec;return this.audioCodecSwap&&u&&(this.log("Swapping audio codec"),u.indexOf("mp4a.40.5")!==-1?u="mp4a.40.2":u="mp4a.40.5"),u},E._loadBitrateTestFrag=function(c){var u=this;this._doFragLoad(c).then(function(a){var x=u.hls;if(!a||x.nextLoadLevel||u.fragContextChanged(c))return;u.fragLoadError=0,u.state=P.State.IDLE,u.startFragRequested=!1,u.bitrateTest=!1;var b=c.stats;b.parsing.start=b.parsing.end=b.buffering.start=b.buffering.end=self.performance.now(),x.trigger(H.Events.FRAG_LOADED,a)})},E._handleTransmuxComplete=function(c){var u,a="main",x=this.hls,b=c.remuxResult,v=c.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 G=M.frag,X=M.part,Q=M.level,z=b.video,j=b.text,q=b.id3,le=b.initSegment,me=this.altAudio?void 0:b.audio;if(this.fragContextChanged(G))return;if(this.state=P.State.PARSING,le){le.tracks&&(this._bufferInitSegment(Q,le.tracks,G,v),x.trigger(H.Events.FRAG_PARSING_INIT_SEGMENT,{frag:G,id:a,tracks:le.tracks}));var be=le.initPTS,Be=le.timescale;Object(Y.isFiniteNumber)(be)&&(this.initPTS[G.cc]=be,x.trigger(H.Events.INIT_PTS_FOUND,{frag:G,id:a,initPTS:be,timescale:Be}))}if(z&&b.independent!==!1){if(Q.details){var Le=z.startPTS,De=z.endPTS,de=z.startDTS,pe=z.endDTS;if(X)X.elementaryStreams[z.type]={startPTS:Le,endPTS:De,startDTS:de,endDTS:pe};else if(z.firstKeyFrame&&z.independent&&(this.couldBacktrack=!0),z.dropped&&z.independent){var ae=this.getLoadPosition()+this.config.maxBufferHole;if(ae<Le){this.backtrack(G);return}G.setElementaryStreamInfo(z.type,G.start,De,G.start,pe,!0)}G.setElementaryStreamInfo(z.type,Le,De,de,pe),this.bufferFragmentData(z,G,X,v)}}else if(b.independent===!1){this.backtrack(G);return}if(me){var re=me.startPTS,we=me.endPTS,ve=me.startDTS,Re=me.endDTS;X&&(X.elementaryStreams[y.ElementaryStreamTypes.AUDIO]={startPTS:re,endPTS:we,startDTS:ve,endDTS:Re}),G.setElementaryStreamInfo(y.ElementaryStreamTypes.AUDIO,re,we,ve,Re),this.bufferFragmentData(me,G,X,v)}if(q!=null&&(u=q.samples)!==null&&u!==void 0&&u.length){var Ae={frag:G,id:a,samples:q.samples};x.trigger(H.Events.FRAG_PARSING_METADATA,Ae)}if(j){var Oe={frag:G,id:a,samples:j.samples};x.trigger(H.Events.FRAG_PARSING_USERDATA,Oe)}},E._bufferInitSegment=function(c,u,a,x){var b=this;if(this.state!==P.State.PARSING)return;this.audioOnly=!!u.audio&&!u.video,this.altAudio&&!this.audioOnly&&delete u.audio;var v=u.audio,M=u.video,G=u.audiovideo;if(v){var X=c.audioCodec,Q=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(X&&(X.indexOf("mp4a.40.5")!==-1?X="mp4a.40.2":X="mp4a.40.5"),v.metadata.channelCount!==1&&Q.indexOf("firefox")===-1&&(X="mp4a.40.5")),Q.indexOf("android")!==-1&&v.container!=="audio/mpeg"&&(X="mp4a.40.2",this.log("Android: force audio codec to "+X)),c.audioCodec&&c.audioCodec!==X&&this.log('Swapping manifest audio codec "'+c.audioCodec+'" for "'+X+'"'),v.levelCodec=X,v.id="main",this.log("Init audio buffer, container:"+v.container+", codecs[selected/level/parsed]=["+(X||"")+"/"+(c.audioCodec||"")+"/"+v.codec+"]")}M&&(M.levelCodec=c.videoCodec,M.id="main",this.log("Init video buffer, container:"+M.container+", codecs[level/parsed]=["+(c.videoCodec||"")+"/"+M.codec+"]")),G&&this.log("Init audiovideo buffer, container:"+G.container+", codecs[level/parsed]=["+(c.attrs.CODECS||"")+"/"+G.codec+"]"),this.hls.trigger(H.Events.BUFFER_CODECS,u),Object.keys(u).forEach(function(z){var j=u[z],q=j.initSegment;q!=null&&q.byteLength&&b.hls.trigger(H.Events.BUFFER_APPENDING,{type:z,data:q,frag:a,part:null,chunkMeta:x,parent:a.type})}),this.tick()},E.backtrack=function(c){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(c);var u=this.fragmentTracker.backtrack(c);this.fragPrevious=null,this.nextLoadPosition=c.start,u?this.resetFragmentLoading(c):this.state=P.State.BACKTRACKING},E.checkFragmentChanged=function(){var c=this.media,u=null;if(c&&c.readyState>1&&c.seeking===!1){var a=c.currentTime;if(U.BufferHelper.isBuffered(c,a)?u=this.getAppendedFrag(a):U.BufferHelper.isBuffered(c,a+.1)&&(u=this.getAppendedFrag(a+.1)),u){var x=this.fragPlaying,b=u.level;(!x||u.sn!==x.sn||x.level!==b||u.urlId!==x.urlId)&&(this.hls.trigger(H.Events.FRAG_CHANGED,{frag:u}),(!x||x.level!==b)&&this.hls.trigger(H.Events.LEVEL_SWITCHED,{level:b}),this.fragPlaying=u)}}},o(D,[{key:"nextLevel",get:function(){var c=this.nextBufferedFrag;return c?c.level:-1}},{key:"currentLevel",get:function(){var c=this.media;if(c){var u=this.getAppendedFrag(c.currentTime);if(u)return u.level}return-1}},{key:"nextBufferedFrag",get:function(){var c=this.media;if(c){var u=this.getAppendedFrag(c.currentTime);return this.followingBufferedFrag(u)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),D}(P.default)},"./src/controller/subtitle-stream-controller.ts":function(oe,Z,k){"use strict";k.r(Z),k.d(Z,"SubtitleStreamController",function(){return l});var Y=k("./src/events.ts"),P=k("./src/utils/logger.ts"),I=k("./src/utils/buffer-helper.ts"),H=k("./src/controller/fragment-finders.ts"),U=k("./src/utils/discontinuities.ts"),O=k("./src/controller/level-helper.ts"),R=k("./src/controller/fragment-tracker.ts"),y=k("./src/controller/base-stream-controller.ts"),w=k("./src/types/loader.ts"),_=k("./src/types/level.ts");function L(h,T){for(var f=0;f<T.length;f++){var p=T[f];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(h,p.key,p)}}function A(h,T,f){return T&&L(h.prototype,T),f&&L(h,f),h}function C(h,T){h.prototype=Object.create(T.prototype),h.prototype.constructor=h,d(h,T)}function d(h,T){return d=Object.setPrototypeOf||function(p,D){return p.__proto__=D,p},d(h,T)}var o=500,l=function(h){C(T,h);function T(p,D){var E;return E=h.call(this,p,D,"[subtitle-stream-controller]")||this,E.levels=[],E.currentTrackId=-1,E.tracksBuffered=[],E.mainDetails=null,E._registerListeners(),E}var f=T.prototype;return f.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},f._registerListeners=function(){var D=this.hls;D.on(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),D.on(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),D.on(Y.Events.MANIFEST_LOADING,this.onManifestLoading,this),D.on(Y.Events.LEVEL_LOADED,this.onLevelLoaded,this),D.on(Y.Events.ERROR,this.onError,this),D.on(Y.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),D.on(Y.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),D.on(Y.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),D.on(Y.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),D.on(Y.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},f._unregisterListeners=function(){var D=this.hls;D.off(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),D.off(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),D.off(Y.Events.MANIFEST_LOADING,this.onManifestLoading,this),D.off(Y.Events.LEVEL_LOADED,this.onLevelLoaded,this),D.off(Y.Events.ERROR,this.onError,this),D.off(Y.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),D.off(Y.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),D.off(Y.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),D.off(Y.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),D.off(Y.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},f.startLoad=function(){this.stopLoad(),this.state=y.State.IDLE,this.setInterval(o),this.tick()},f.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},f.onLevelLoaded=function(D,E){this.mainDetails=E.details},f.onSubtitleFragProcessed=function(D,E){var g=E.frag,c=E.success;if(this.fragPrevious=g,this.state=y.State.IDLE,!c)return;var u=this.tracksBuffered[this.currentTrackId];if(!u)return;for(var a,x=g.start,b=0;b<u.length;b++)if(x>=u[b].start&&x<=u[b].end){a=u[b];break}var v=g.start+g.duration;a?a.end=v:(a={start:x,end:v},u.push(a)),this.fragmentTracker.fragBuffered(g)},f.onBufferFlushing=function(D,E){var g=E.startOffset,c=E.endOffset;if(g===0&&c!==Number.POSITIVE_INFINITY){var u=this.currentTrackId,a=this.levels;if(!a.length||!a[u]||!a[u].details)return;var x=a[u].details,b=x.targetduration,v=c-b;if(v<=0)return;E.endOffsetSubtitles=Math.max(0,v),this.tracksBuffered.forEach(function(M){for(var G=0;G<M.length;){if(M[G].end<=v){M.shift();continue}else if(M[G].start<v)M[G].start=v;else break;G++}}),this.fragmentTracker.removeFragmentsInRange(g,v,w.PlaylistLevelType.SUBTITLE)}},f.onError=function(D,E){var g,c=E.frag;if(!c||c.type!==w.PlaylistLevelType.SUBTITLE)return;(g=this.fragCurrent)!==null&&g!==void 0&&g.loader&&this.fragCurrent.loader.abort(),this.state=y.State.IDLE},f.onSubtitleTracksUpdated=function(D,E){var g=this,c=E.subtitleTracks;this.tracksBuffered=[],this.levels=c.map(function(u){return new _.Level(u)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(u){g.tracksBuffered[u.id]=[]}),this.mediaBuffer=null},f.onSubtitleTrackSwitch=function(D,E){if(this.currentTrackId=E.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var g=this.levels[this.currentTrackId];g!=null&&g.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,g&&this.setInterval(o)},f.onSubtitleTrackLoaded=function(D,E){var g,c=E.details,u=E.id,a=this.currentTrackId,x=this.levels;if(!x.length)return;var b=x[a];if(u>=x.length||u!==a||!b)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,c.live||(g=b.details)!==null&&g!==void 0&&g.live){var v=this.mainDetails;if(c.deltaUpdateFailed||!v)return;var M=v.fragments[0];if(!b.details)c.hasProgramDateTime&&v.hasProgramDateTime?Object(U.alignMediaPlaylistByPDT)(c,v):M&&Object(O.addSliding)(c,M.start);else{var G=this.alignPlaylists(c,b.details);G===0&&M&&Object(O.addSliding)(c,M.start)}}if(b.details=c,this.levelLastLoaded=u,this.tick(),c.live&&!this.fragCurrent&&this.media&&this.state===y.State.IDLE){var X=Object(H.findFragmentByPTS)(null,c.fragments,this.media.currentTime,0);X||(this.warn("Subtitle playlist not aligned with playback"),b.details=void 0)}},f._handleFragmentLoadComplete=function(D){var E=D.frag,g=D.payload,c=E.decryptdata,u=this.hls;if(this.fragContextChanged(E))return;if(g&&g.byteLength>0&&c&&c.key&&c.iv&&c.method==="AES-128"){var a=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(g),c.key.buffer,c.iv.buffer).then(function(x){var b=performance.now();u.trigger(Y.Events.FRAG_DECRYPTED,{frag:E,payload:x,stats:{tstart:a,tdecrypt:b}})})}},f.doTick=function(){if(!this.media){this.state=y.State.IDLE;return}if(this.state===y.State.IDLE){var D,E=this.currentTrackId,g=this.levels;if(!g.length||!g[E]||!g[E].details)return;var c=g[E].details,u=c.targetduration,a=this.config,x=this.media,b=I.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,x.currentTime-u,a.maxBufferHole),v=b.end,M=b.len,G=this.getMaxBufferLength()+u;if(M>G)return;console.assert(c,"Subtitle track details are defined on idle subtitle stream controller tick");var X=c.fragments,Q=X.length,z=c.edge,j,q=this.fragPrevious;if(v<z){var le=a.maxFragLookUpTolerance;q&&c.hasProgramDateTime&&(j=Object(H.findFragmentByPDT)(X,q.endProgramDateTime,le)),j||(j=Object(H.findFragmentByPTS)(q,X,v,le),!j&&q&&q.start<X[0].start&&(j=X[0]))}else j=X[Q-1];(D=j)!==null&&D!==void 0&&D.encrypted?(P.logger.log("Loading key for "+j.sn),this.state=y.State.KEY_LOADING,this.hls.trigger(Y.Events.KEY_LOADING,{frag:j})):j&&this.fragmentTracker.getState(j)===R.FragmentState.NOT_LOADED&&this.loadFragment(j,c,v)}},f.loadFragment=function(D,E,g){this.fragCurrent=D,h.prototype.loadFragment.call(this,D,E,g)},A(T,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),T}(y.default)},"./src/controller/subtitle-track-controller.ts":function(oe,Z,k){"use strict";k.r(Z);var Y=k("./src/events.ts"),P=k("./src/utils/texttrack-utils.ts"),I=k("./src/controller/base-playlist-controller.ts"),H=k("./src/types/loader.ts");function U(L,A){for(var C=0;C<A.length;C++){var d=A[C];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(L,d.key,d)}}function O(L,A,C){return A&&U(L.prototype,A),C&&U(L,C),L}function R(L,A){L.prototype=Object.create(A.prototype),L.prototype.constructor=L,y(L,A)}function y(L,A){return y=Object.setPrototypeOf||function(d,o){return d.__proto__=o,d},y(L,A)}var w=function(L){R(A,L);function A(d){var o;return o=L.call(this,d,"[subtitle-track-controller]")||this,o.media=null,o.tracks=[],o.groupId=null,o.tracksInGroup=[],o.trackId=-1,o.selectDefaultTrack=!0,o.queuedDefaultTrack=-1,o.trackChangeListener=function(){return o.onTextTracksChanged()},o.asyncPollTrackChange=function(){return o.pollTrackChange(0)},o.useTextTrackPolling=!1,o.subtitlePollingInterval=-1,o.subtitleDisplay=!0,o.registerListeners(),o}var C=A.prototype;return C.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,L.prototype.destroy.call(this)},C.registerListeners=function(){var o=this.hls;o.on(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(Y.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(Y.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(Y.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.on(Y.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.on(Y.Events.ERROR,this.onError,this)},C.unregisterListeners=function(){var o=this.hls;o.off(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(Y.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(Y.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(Y.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.off(Y.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.off(Y.Events.ERROR,this.onError,this)},C.onMediaAttached=function(o,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)},C.pollTrackChange=function(o){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,o)},C.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 o=_(this.media.textTracks);o.forEach(function(l){Object(P.clearCurrentCues)(l)}),this.subtitleTrack=-1,this.media=null},C.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},C.onManifestParsed=function(o,l){this.tracks=l.subtitleTracks},C.onSubtitleTrackLoaded=function(o,l){var h=l.id,T=l.details,f=this.trackId,p=this.tracksInGroup[f];if(!p){this.warn("Invalid subtitle track id "+h);return}var D=p.details;p.details=l.details,this.log("subtitle track "+h+" loaded ["+T.startSN+"-"+T.endSN+"]"),h===this.trackId&&(this.retryCount=0,this.playlistLoaded(h,l,D))},C.onLevelLoading=function(o,l){this.switchLevel(l.level)},C.onLevelSwitching=function(o,l){this.switchLevel(l.level)},C.switchLevel=function(o){var l=this.hls.levels[o];if(!(l!=null&&l.textGroupIds))return;var h=l.textGroupIds[l.urlId];if(this.groupId!==h){var T=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,f=this.tracks.filter(function(E){return!h||E.groupId===h});this.tracksInGroup=f;var p=this.findTrackId(T==null?void 0:T.name)||this.findTrackId();this.groupId=h;var D={subtitleTracks:f};this.log("Updating subtitle tracks, "+f.length+' track(s) found in "'+h+'" group-id'),this.hls.trigger(Y.Events.SUBTITLE_TRACKS_UPDATED,D),p!==-1&&this.setSubtitleTrack(p,T)}},C.findTrackId=function(o){for(var l=this.tracksInGroup,h=0;h<l.length;h++){var T=l[h];if((!this.selectDefaultTrack||T.default)&&(!o||o===T.name))return T.id}return-1},C.onError=function(o,l){if(L.prototype.onError.call(this,o,l),l.fatal||!l.context)return;l.context.type===H.PlaylistContextType.SUBTITLE_TRACK&&l.context.id===this.trackId&&l.context.groupId===this.groupId&&this.retryLoadingOrFail(l)},C.loadPlaylist=function(o){var l=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(l)){var h=l.id,T=l.groupId,f=l.url;if(o)try{f=o.addDirectives(f)}catch(p){this.warn("Could not construct new URL with HLS Delivery Directives: "+p)}this.log("Loading subtitle playlist for id "+h),this.hls.trigger(Y.Events.SUBTITLE_TRACK_LOADING,{url:f,id:h,groupId:T,deliveryDirectives:o||null})}},C.toggleTrackModes=function(o){var l=this,h=this.media,T=this.subtitleDisplay,f=this.trackId;if(!h)return;var p=_(h.textTracks),D=p.filter(function(c){return c.groupId===l.groupId});if(o===-1)[].slice.call(p).forEach(function(c){c.mode="disabled"});else{var E=D[f];E&&(E.mode="disabled")}var g=D[o];g&&(g.mode=T?"showing":"hidden")},C.setSubtitleTrack=function(o,l){var h,T=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=o;return}if(this.trackId!==o&&this.toggleTrackModes(o),this.trackId===o&&(o===-1||(h=T[o])!==null&&h!==void 0&&h.details)||o<-1||o>=T.length)return;this.clearTimer();var f=T[o];if(this.log("Switching to subtitle track "+o),this.trackId=o,f){var p=f.id,D=f.groupId,E=D===void 0?"":D,g=f.name,c=f.type,u=f.url;this.hls.trigger(Y.Events.SUBTITLE_TRACK_SWITCH,{id:p,groupId:E,name:g,type:c,url:u});var a=this.switchParams(f.url,l==null?void 0:l.details);this.loadPlaylist(a)}else this.hls.trigger(Y.Events.SUBTITLE_TRACK_SWITCH,{id:o})},C.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var o=-1,l=_(this.media.textTracks),h=0;h<l.length;h++)if(l[h].mode==="hidden")o=h;else if(l[h].mode==="showing"){o=h;break}this.subtitleTrack!==o&&(this.subtitleTrack=o)},O(A,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(o){this.selectDefaultTrack=!1;var l=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(o,l)}}]),A}(I.default);function _(L){for(var A=[],C=0;C<L.length;C++){var d=L[C];d.kind==="subtitles"&&d.label&&A.push(L[C])}return A}Z.default=w},"./src/controller/timeline-controller.ts":function(oe,Z,k){"use strict";k.r(Z),k.d(Z,"TimelineController",function(){return _});var Y=k("./src/polyfills/number.ts"),P=k("./src/events.ts"),I=k("./src/utils/cea-608-parser.ts"),H=k("./src/utils/output-filter.ts"),U=k("./src/utils/webvtt-parser.ts"),O=k("./src/utils/texttrack-utils.ts"),R=k("./src/utils/imsc1-ttml-parser.ts"),y=k("./src/types/loader.ts"),w=k("./src/utils/logger.ts"),_=function(){function d(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=C(),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 h=new H.default(this,"textTrack1"),T=new H.default(this,"textTrack2"),f=new H.default(this,"textTrack3"),p=new H.default(this,"textTrack4");this.cea608Parser1=new I.default(1,h,T),this.cea608Parser2=new I.default(3,f,p)}l.on(P.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),l.on(P.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.on(P.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.on(P.Events.MANIFEST_LOADED,this.onManifestLoaded,this),l.on(P.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),l.on(P.Events.FRAG_LOADING,this.onFragLoading,this),l.on(P.Events.FRAG_LOADED,this.onFragLoaded,this),l.on(P.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),l.on(P.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),l.on(P.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),l.on(P.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),l.on(P.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var o=d.prototype;return o.destroy=function(){var h=this.hls;h.off(P.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),h.off(P.Events.MEDIA_DETACHING,this.onMediaDetaching,this),h.off(P.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.off(P.Events.MANIFEST_LOADED,this.onManifestLoaded,this),h.off(P.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),h.off(P.Events.FRAG_LOADING,this.onFragLoading,this),h.off(P.Events.FRAG_LOADED,this.onFragLoaded,this),h.off(P.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),h.off(P.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),h.off(P.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),h.off(P.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),h.off(P.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},o.addCues=function(h,T,f,p,D){for(var E=!1,g=D.length;g--;){var c=D[g],u=A(c[0],c[1],T,f);if(u>=0&&(c[0]=Math.min(c[0],T),c[1]=Math.max(c[1],f),E=!0,u/(f-T)>.5))return}if(E||D.push([T,f]),this.config.renderTextTracksNatively){var a=this.captionsTracks[h];this.Cues.newCue(a,T,f,p)}else{var x=this.Cues.newCue(null,T,f,p);this.hls.trigger(P.Events.CUES_PARSED,{type:"captions",cues:x,track:h})}},o.onInitPtsFound=function(h,T){var f=this,p=T.frag,D=T.id,E=T.initPTS,g=T.timescale,c=this.unparsedVttFrags;D==="main"&&(this.initPTS[p.cc]=E,this.timescale[p.cc]=g),c.length&&(this.unparsedVttFrags=[],c.forEach(function(u){f.onFragLoaded(P.Events.FRAG_LOADED,u)}))},o.getExistingTrack=function(h){var T=this.media;if(T)for(var f=0;f<T.textTracks.length;f++){var p=T.textTracks[f];if(p[h])return p}return null},o.createCaptionsTrack=function(h){this.config.renderTextTracksNatively?this.createNativeTrack(h):this.createNonNativeTrack(h)},o.createNativeTrack=function(h){if(this.captionsTracks[h])return;var T=this.captionsProperties,f=this.captionsTracks,p=this.media,D=T[h],E=D.label,g=D.languageCode,c=this.getExistingTrack(h);if(c)f[h]=c,Object(O.clearCurrentCues)(f[h]),Object(O.sendAddTrackEvent)(f[h],p);else{var u=this.createTextTrack("captions",E,g);u&&(u[h]=!0,f[h]=u)}},o.createNonNativeTrack=function(h){if(this.nonNativeCaptionsTracks[h])return;var T=this.captionsProperties[h];if(!T)return;var f=T.label,p={_id:h,label:f,kind:"captions",default:T.media?!!T.media.default:!1,closedCaptions:T.media};this.nonNativeCaptionsTracks[h]=p,this.hls.trigger(P.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[p]})},o.createTextTrack=function(h,T,f){var p=this.media;return p?p.addTextTrack(h,T,f):void 0},o.onMediaAttaching=function(h,T){this.media=T.media,this._cleanTracks()},o.onMediaDetaching=function(){var h=this.captionsTracks;Object.keys(h).forEach(function(T){Object(O.clearCurrentCues)(h[T]),delete h[T]}),this.nonNativeCaptionsTracks={}},o.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=C(),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())},o._cleanTracks=function(){var h=this.media;if(!h)return;var T=h.textTracks;if(T)for(var f=0;f<T.length;f++)Object(O.clearCurrentCues)(T[f])},o.onSubtitleTracksUpdated=function(h,T){var f=this;this.textTracks=[];var p=T.subtitleTracks||[],D=p.some(function(u){return u.textCodec===R.IMSC1_CODEC});if(this.config.enableWebVTT||D&&this.config.enableIMSC1){var E=this.tracks&&p&&this.tracks.length===p.length;if(this.tracks=p||[],this.config.renderTextTracksNatively){var g=this.media?this.media.textTracks:[];this.tracks.forEach(function(u,a){var x;if(a<g.length){for(var b=null,v=0;v<g.length;v++)if(L(g[v],u)){b=g[v];break}b&&(x=b)}x?Object(O.clearCurrentCues)(x):(x=f.createTextTrack("subtitles",u.name,u.lang),x&&(x.mode="disabled")),x&&(x.groupId=u.groupId,f.textTracks.push(x))})}else if(!E&&this.tracks&&this.tracks.length){var c=this.tracks.map(function(u){return{label:u.name,kind:u.type.toLowerCase(),default:u.default,subtitleTrack:u}});this.hls.trigger(P.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:c})}}},o.onManifestLoaded=function(h,T){var f=this;this.config.enableCEA708Captions&&T.captions&&T.captions.forEach(function(p){var D=/(?:CC|SERVICE)([1-4])/.exec(p.instreamId);if(!D)return;var E="textTrack"+D[1],g=f.captionsProperties[E];if(!g)return;g.label=p.name,p.lang&&(g.languageCode=p.lang),g.media=p})},o.onFragLoading=function(h,T){var f=this.cea608Parser1,p=this.cea608Parser2,D=this.lastSn,E=this.lastPartIndex;if(!this.enabled||!(f&&p))return;if(T.frag.type===y.PlaylistLevelType.MAIN){var g,c,u=T.frag.sn,a=(g=T==null||((c=T.part)===null||c===void 0)?void 0:c.index)!=null?g:-1;u===D+1||u===D&&a===E+1||(f.reset(),p.reset()),this.lastSn=u,this.lastPartIndex=a}},o.onFragLoaded=function(h,T){var f=T.frag,p=T.payload,D=this.initPTS,E=this.unparsedVttFrags;if(f.type===y.PlaylistLevelType.SUBTITLE)if(p.byteLength){if(!Object(Y.isFiniteNumber)(D[f.cc])){E.push(T),D.length&&this.hls.trigger(P.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:f,error:new Error("Missing initial subtitle PTS")});return}var g=f.decryptdata;if(g==null||g.key==null||g.method!=="AES-128"){var c=this.tracks[f.level],u=this.vttCCs;u[f.cc]||(u[f.cc]={start:f.start,prevCC:this.prevCC,new:!0},this.prevCC=f.cc),c&&c.textCodec===R.IMSC1_CODEC?this._parseIMSC1(f,p):this._parseVTTs(f,p,u)}}else this.hls.trigger(P.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:f,error:new Error("Empty subtitle payload")})},o._parseIMSC1=function(h,T){var f=this,p=this.hls;Object(R.parseIMSC1)(T,this.initPTS[h.cc],this.timescale[h.cc],function(D){f._appendCues(D,h.level),p.trigger(P.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:h})},function(D){w.logger.log("Failed to parse IMSC1: "+D),p.trigger(P.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:h,error:D})})},o._parseVTTs=function(h,T,f){var p=this,D=this.hls;Object(U.parseWebVTT)(T,this.initPTS[h.cc],this.timescale[h.cc],f,h.cc,h.start,function(E){p._appendCues(E,h.level),D.trigger(P.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:h})},function(E){p._fallbackToIMSC1(h,T),w.logger.log("Failed to parse VTT cue: "+E),D.trigger(P.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:h,error:E})})},o._fallbackToIMSC1=function(h,T){var f=this,p=this.tracks[h.level];p.textCodec||Object(R.parseIMSC1)(T,this.initPTS[h.cc],this.timescale[h.cc],function(){p.textCodec=R.IMSC1_CODEC,f._parseIMSC1(h,T)},function(){p.textCodec="wvtt"})},o._appendCues=function(h,T){var f=this.hls;if(this.config.renderTextTracksNatively){var p=this.textTracks[T];if(p.mode==="disabled")return;h.forEach(function(g){return Object(O.addCueToTrack)(p,g)})}else{var D=this.tracks[T],E=D.default?"default":"subtitles"+T;f.trigger(P.Events.CUES_PARSED,{type:"subtitles",cues:h,track:E})}},o.onFragDecrypted=function(h,T){var f=T.frag;if(f.type===y.PlaylistLevelType.SUBTITLE){if(!Object(Y.isFiniteNumber)(this.initPTS[f.cc])){this.unparsedVttFrags.push(T);return}this.onFragLoaded(P.Events.FRAG_LOADED,T)}},o.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},o.onFragParsingUserdata=function(h,T){var f=this.cea608Parser1,p=this.cea608Parser2;if(!this.enabled||!(f&&p))return;for(var D=0;D<T.samples.length;D++){var E=T.samples[D].bytes;if(E){var g=this.extractCea608Data(E);f.addData(T.samples[D].pts,g[0]),p.addData(T.samples[D].pts,g[1])}}},o.onBufferFlushing=function(h,T){var f=T.startOffset,p=T.endOffset,D=T.endOffsetSubtitles,E=T.type,g=this.media;if(!g||g.currentTime<p)return;if(!E||E==="video"){var c=this.captionsTracks;Object.keys(c).forEach(function(a){return Object(O.removeCuesInRange)(c[a],f,p)})}if(this.config.renderTextTracksNatively&&(f===0&&D!==void 0)){var u=this.textTracks;Object.keys(u).forEach(function(a){return Object(O.removeCuesInRange)(u[a],f,D)})}},o.extractCea608Data=function(h){for(var T=h[0]&31,f=2,p=[[],[]],D=0;D<T;D++){var E=h[f++],g=127&h[f++],c=127&h[f++],u=(4&E)!==0,a=3&E;if(g===0&&c===0)continue;u&&((a===0||a===1)&&(p[a].push(g),p[a].push(c)))}return p},d}();function L(d,o){return d&&d.label===o.name&&!(d.textTrack1||d.textTrack2)}function A(d,o,l,h){return Math.min(o,h)-Math.max(d,l)}function C(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(oe,Z,k){"use strict";k.r(Z),k.d(Z,"default",function(){return Y});var Y=function(){function P(H,U){this.subtle=void 0,this.aesIV=void 0,this.subtle=H,this.aesIV=U}var I=P.prototype;return I.decrypt=function(U,O){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},O,U)},P}()},"./src/crypt/aes-decryptor.ts":function(oe,Z,k){"use strict";k.r(Z),k.d(Z,"removePadding",function(){return P}),k.d(Z,"default",function(){return I});var Y=k("./src/utils/typed-array.ts");function P(H){var U=H.byteLength,O=U&&new DataView(H.buffer).getUint8(U-1);return O?Object(Y.sliceUint8)(H,0,U-O):H}var I=function(){function H(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}var U=H.prototype;return U.uint8ArrayToUint32Array_=function(R){for(var y=new DataView(R),w=new Uint32Array(4),_=0;_<4;_++)w[_]=y.getUint32(_*4);return w},U.initTable=function(){var R=this.sBox,y=this.invSBox,w=this.subMix,_=w[0],L=w[1],A=w[2],C=w[3],d=this.invSubMix,o=d[0],l=d[1],h=d[2],T=d[3],f=new Uint32Array(256),p=0,D=0,E=0;for(E=0;E<256;E++)E<128?f[E]=E<<1:f[E]=E<<1^283;for(E=0;E<256;E++){var g=D^D<<1^D<<2^D<<3^D<<4;g=g>>>8^g&255^99,R[p]=g,y[g]=p;var c=f[p],u=f[c],a=f[u],x=f[g]*257^g*16843008;_[p]=x<<24|x>>>8,L[p]=x<<16|x>>>16,A[p]=x<<8|x>>>24,C[p]=x,x=a*16843009^u*65537^c*257^p*16843008,o[g]=x<<24|x>>>8,l[g]=x<<16|x>>>16,h[g]=x<<8|x>>>24,T[g]=x,p?(p=c^f[f[f[a^c]]],D^=f[f[D]]):p=D=1}},U.expandKey=function(R){for(var y=this.uint8ArrayToUint32Array_(R),w=!0,_=0;_<y.length&&w;)w=y[_]===this.key[_],_++;if(w)return;this.key=y;var L=this.keySize=y.length;if(L!==4&&L!==6&&L!==8)throw new Error("Invalid aes key size="+L);var A=this.ksRows=(L+6+1)*4,C,d,o=this.keySchedule=new Uint32Array(A),l=this.invKeySchedule=new Uint32Array(A),h=this.sBox,T=this.rcon,f=this.invSubMix,p=f[0],D=f[1],E=f[2],g=f[3],c,u;for(C=0;C<A;C++){if(C<L){c=o[C]=y[C];continue}u=c,C%L===0?(u=u<<8|u>>>24,u=h[u>>>24]<<24|h[u>>>16&255]<<16|h[u>>>8&255]<<8|h[u&255],u^=T[C/L|0]<<24):L>6&&C%L===4&&(u=h[u>>>24]<<24|h[u>>>16&255]<<16|h[u>>>8&255]<<8|h[u&255]),o[C]=c=(o[C-L]^u)>>>0}for(d=0;d<A;d++)C=A-d,d&3?u=o[C]:u=o[C-4],d<4||C<=4?l[d]=u:l[d]=p[h[u>>>24]]^D[h[u>>>16&255]]^E[h[u>>>8&255]]^g[h[u&255]],l[d]=l[d]>>>0},U.networkToHostOrderSwap=function(R){return R<<24|(R&65280)<<8|(R&16711680)>>8|R>>>24},U.decrypt=function(R,y,w){for(var _=this.keySize+6,L=this.invKeySchedule,A=this.invSBox,C=this.invSubMix,d=C[0],o=C[1],l=C[2],h=C[3],T=this.uint8ArrayToUint32Array_(w),f=T[0],p=T[1],D=T[2],E=T[3],g=new Int32Array(R),c=new Int32Array(g.length),u,a,x,b,v,M,G,X,Q,z,j,q,le,me,be=this.networkToHostOrderSwap;y<g.length;){for(Q=be(g[y]),z=be(g[y+1]),j=be(g[y+2]),q=be(g[y+3]),v=Q^L[0],M=q^L[1],G=j^L[2],X=z^L[3],le=4,me=1;me<_;me++)u=d[v>>>24]^o[M>>16&255]^l[G>>8&255]^h[X&255]^L[le],a=d[M>>>24]^o[G>>16&255]^l[X>>8&255]^h[v&255]^L[le+1],x=d[G>>>24]^o[X>>16&255]^l[v>>8&255]^h[M&255]^L[le+2],b=d[X>>>24]^o[v>>16&255]^l[M>>8&255]^h[G&255]^L[le+3],v=u,M=a,G=x,X=b,le=le+4;u=A[v>>>24]<<24^A[M>>16&255]<<16^A[G>>8&255]<<8^A[X&255]^L[le],a=A[M>>>24]<<24^A[G>>16&255]<<16^A[X>>8&255]<<8^A[v&255]^L[le+1],x=A[G>>>24]<<24^A[X>>16&255]<<16^A[v>>8&255]<<8^A[M&255]^L[le+2],b=A[X>>>24]<<24^A[v>>16&255]<<16^A[M>>8&255]<<8^A[G&255]^L[le+3],c[y]=be(u^f),c[y+1]=be(b^p),c[y+2]=be(x^D),c[y+3]=be(a^E),f=Q,p=z,D=j,E=q,y=y+4}return c.buffer},H}()},"./src/crypt/decrypter.ts":function(oe,Z,k){"use strict";k.r(Z),k.d(Z,"default",function(){return y});var Y=k("./src/crypt/aes-crypto.ts"),P=k("./src/crypt/fast-aes-key.ts"),I=k("./src/crypt/aes-decryptor.ts"),H=k("./src/utils/logger.ts"),U=k("./src/utils/mp4-tools.ts"),O=k("./src/utils/typed-array.ts"),R=16,y=function(){function w(L,A,C){var d=C===void 0?{}:C,o=d.removePKCS7Padding,l=o===void 0?!0:o;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=L,this.config=A,this.removePKCS7Padding=l,l)try{var h=self.crypto;h&&(this.subtle=h.subtle||h.webkitSubtle)}catch(T){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var _=w.prototype;return _.destroy=function(){this.observer=null},_.isSync=function(){return this.config.enableSoftwareAES},_.flush=function(){var A=this.currentResult;if(!A){this.reset();return}var C=new Uint8Array(A);return this.reset(),this.removePKCS7Padding?Object(I.removePadding)(C):C},_.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},_.decrypt=function(A,C,d,o){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(A),C,d);var l=this.flush();l&&o(l.buffer)}else this.webCryptoDecrypt(new Uint8Array(A),C,d).then(o)},_.softwareDecrypt=function(A,C,d){var o=this.currentIV,l=this.currentResult,h=this.remainderData;this.logOnce("JS AES decrypt"),h&&(A=Object(U.appendUint8Array)(h,A),this.remainderData=null);var T=this.getValidChunk(A);if(!T.length)return null;o&&(d=o);var f=this.softwareDecrypter;f||(f=this.softwareDecrypter=new I.default),f.expandKey(C);var p=l;return this.currentResult=f.decrypt(T.buffer,0,d),this.currentIV=Object(O.sliceUint8)(T,-16).buffer,p||null},_.webCryptoDecrypt=function(A,C,d){var o=this,l=this.subtle;return(this.key!==C||!this.fastAesKey)&&(this.key=C,this.fastAesKey=new P.default(l,C)),this.fastAesKey.expandKey().then(function(h){if(!l)return Promise.reject(new Error("web crypto not initialized"));var T=new Y.default(l,d);return T.decrypt(A.buffer,h)}).catch(function(h){return o.onWebCryptoError(h,A,C,d)})},_.onWebCryptoError=function(A,C,d,o){return H.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",A),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(C,d,o)},_.getValidChunk=function(A){var C=A,d=A.length-A.length%R;return d!==A.length&&(C=Object(O.sliceUint8)(A,0,d),this.remainderData=Object(O.sliceUint8)(A,d)),C},_.logOnce=function(A){if(!this.logEnabled)return;H.logger.log("[decrypter.ts]: "+A),this.logEnabled=!1},w}()},"./src/crypt/fast-aes-key.ts":function(oe,Z,k){"use strict";k.r(Z),k.d(Z,"default",function(){return Y});var Y=function(){function P(H,U){this.subtle=void 0,this.key=void 0,this.subtle=H,this.key=U}var I=P.prototype;return I.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},P}()},"./src/demux/aacdemuxer.ts":function(oe,Z,k){"use strict";k.r(Z);var Y=k("./src/demux/base-audio-demuxer.ts"),P=k("./src/demux/adts.ts"),I=k("./src/utils/logger.ts"),H=k("./src/demux/id3.ts");function U(y,w){y.prototype=Object.create(w.prototype),y.prototype.constructor=y,O(y,w)}function O(y,w){return O=Object.setPrototypeOf||function(L,A){return L.__proto__=A,L},O(y,w)}var R=function(y){U(w,y);function w(L,A){var C;return C=y.call(this)||this,C.observer=void 0,C.config=void 0,C.observer=L,C.config=A,C}var _=w.prototype;return _.resetInitSegment=function(A,C,d){y.prototype.resetInitSegment.call(this,A,C,d),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:A,duration:d,inputTimeScale:9e4,dropped:0}},w.probe=function(A){if(!A)return!1;for(var C=H.getID3Data(A,0)||[],d=C.length,o=A.length;d<o;d++)if(P.probe(A,d))return I.logger.log("ADTS sync word found !"),!0;return!1},_.canParse=function(A,C){return P.canParse(A,C)},_.appendFrame=function(A,C,d){P.initTrackConfig(A,this.observer,C,d,A.manifestCodec);var o=P.appendFrame(A,C,d,this.initPTS,this.frameIndex);if(o&&o.missing===0)return o},w}(Y.default);R.minProbeByteLength=9,Z.default=R},"./src/demux/adts.ts":function(oe,Z,k){"use strict";k.r(Z),k.d(Z,"getAudioConfig",function(){return H}),k.d(Z,"isHeaderPattern",function(){return U}),k.d(Z,"getHeaderLength",function(){return O}),k.d(Z,"getFullFrameLength",function(){return R}),k.d(Z,"canGetFrameLength",function(){return y}),k.d(Z,"isHeader",function(){return w}),k.d(Z,"canParse",function(){return _}),k.d(Z,"probe",function(){return L}),k.d(Z,"initTrackConfig",function(){return A}),k.d(Z,"getFrameDuration",function(){return C}),k.d(Z,"parseFrameHeader",function(){return d}),k.d(Z,"appendFrame",function(){return o});var Y=k("./src/utils/logger.ts"),P=k("./src/errors.ts"),I=k("./src/events.ts");function H(l,h,T,f){var p,D,E,g,c=navigator.userAgent.toLowerCase(),u=f,a=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];p=((h[T+2]&192)>>>6)+1;var x=(h[T+2]&60)>>>2;if(x>a.length-1){l.trigger(I.Events.ERROR,{type:P.ErrorTypes.MEDIA_ERROR,details:P.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+x});return}return E=(h[T+2]&1)<<2,E|=(h[T+3]&192)>>>6,Y.logger.log("manifest codec:"+f+", ADTS type:"+p+", samplingIndex:"+x),/firefox/i.test(c)?x>=6?(p=5,g=new Array(4),D=x-3):(p=2,g=new Array(2),D=x):c.indexOf("android")!==-1?(p=2,g=new Array(2),D=x):(p=5,g=new Array(4),f&&(f.indexOf("mp4a.40.29")!==-1||f.indexOf("mp4a.40.5")!==-1)||!f&&x>=6?D=x-3:((f&&f.indexOf("mp4a.40.2")!==-1&&(x>=6&&E===1||/vivaldi/i.test(c))||!f&&E===1)&&(p=2,g=new Array(2)),D=x)),g[0]=p<<3,g[0]|=(x&14)>>1,g[1]|=(x&1)<<7,g[1]|=E<<3,p===5&&(g[1]|=(D&14)>>1,g[2]=(D&1)<<7,g[2]|=2<<2,g[3]=0),{config:g,samplerate:a[x],channelCount:E,codec:"mp4a.40."+p,manifestCodec:u}}function U(l,h){return l[h]===255&&(l[h+1]&246)===240}function O(l,h){return l[h+1]&1?7:9}function R(l,h){return(l[h+3]&3)<<11|l[h+4]<<3|(l[h+5]&224)>>>5}function y(l,h){return h+5<l.length}function w(l,h){return h+1<l.length&&U(l,h)}function _(l,h){return y(l,h)&&U(l,h)&&R(l,h)<=l.length-h}function L(l,h){if(w(l,h)){var T=O(l,h);if(h+T>=l.length)return!1;var f=R(l,h);if(f<=T)return!1;var p=h+f;return p===l.length||w(l,p)}return!1}function A(l,h,T,f,p){if(!l.samplerate){var D=H(h,T,f,p);if(!D)return;l.config=D.config,l.samplerate=D.samplerate,l.channelCount=D.channelCount,l.codec=D.codec,l.manifestCodec=D.manifestCodec,Y.logger.log("parsed codec:"+l.codec+", rate:"+D.samplerate+", channels:"+D.channelCount)}}function C(l){return 1024*9e4/l}function d(l,h,T,f,p){var D=O(l,h),E=R(l,h);if(E-=D,E>0){var g=T+f*p;return{headerLength:D,frameLength:E,stamp:g}}}function o(l,h,T,f,p){var D=C(l.samplerate),E=d(h,T,f,p,D);if(E){var g=E.frameLength,c=E.headerLength,u=E.stamp,a=c+g,x=Math.max(0,T+a-h.length),b;x?(b=new Uint8Array(a-c),b.set(h.subarray(T+c,h.length),0)):b=h.subarray(T+c,T+a);var v={unit:b,pts:u};return x||l.samples.push(v),{sample:v,length:a,missing:x}}}},"./src/demux/base-audio-demuxer.ts":function(oe,Z,k){"use strict";k.r(Z),k.d(Z,"initPTSFn",function(){return R});var Y=k("./src/polyfills/number.ts"),P=k("./src/demux/id3.ts"),I=k("./src/demux/dummy-demuxed-track.ts"),H=k("./src/utils/mp4-tools.ts"),U=k("./src/utils/typed-array.ts"),O=function(){function y(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var w=y.prototype;return w.resetInitSegment=function(L,A,C){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},w.resetTimeStamp=function(){},w.resetContiguity=function(){},w.canParse=function(L,A){return!1},w.appendFrame=function(L,A,C){},w.demux=function(L,A){this.cachedData&&(L=Object(H.appendUint8Array)(this.cachedData,L),this.cachedData=null);var C=P.getID3Data(L,0),d=C?C.length:0,o,l,h=this._audioTrack,T=this._id3Track,f=C?P.getTimeStamp(C):void 0,p=L.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=R(f,A)),C&&C.length>0&&T.samples.push({pts:this.initPTS,dts:this.initPTS,data:C}),l=this.initPTS;d<p;){if(this.canParse(L,d)){var D=this.appendFrame(h,L,d);D?(this.frameIndex++,l=D.sample.pts,d+=D.length,o=d):d=p}else P.canParse(L,d)?(C=P.getID3Data(L,d),T.samples.push({pts:l,dts:l,data:C}),d+=C.length,o=d):d++;if(d===p&&o!==p){var E=Object(U.sliceUint8)(L,o);this.cachedData?this.cachedData=Object(H.appendUint8Array)(this.cachedData,E):this.cachedData=E}}return{audioTrack:h,avcTrack:Object(I.dummyTrack)(),id3Track:T,textTrack:Object(I.dummyTrack)()}},w.demuxSampleAes=function(L,A,C){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},w.flush=function(L){var A=this.cachedData;return A&&(this.cachedData=null,this.demux(A,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(I.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(I.dummyTrack)()}},w.destroy=function(){},y}(),R=function(w,_){return Object(Y.isFiniteNumber)(w)?w*90:_*9e4};Z.default=O},"./src/demux/chunk-cache.ts":function(oe,Z,k){"use strict";k.r(Z),k.d(Z,"default",function(){return Y});var Y=function(){function I(){this.chunks=[],this.dataLength=0}var H=I.prototype;return H.push=function(O){this.chunks.push(O),this.dataLength+=O.length},H.flush=function(){var O=this.chunks,R=this.dataLength,y;if(O.length)O.length===1?y=O[0]:y=P(O,R);else return new Uint8Array(0);return this.reset(),y},H.reset=function(){this.chunks.length=0,this.dataLength=0},I}();function P(I,H){for(var U=new Uint8Array(H),O=0,R=0;R<I.length;R++){var y=I[R];U.set(y,O),O+=y.length}return U}},"./src/demux/dummy-demuxed-track.ts":function(oe,Z,k){"use strict";k.r(Z),k.d(Z,"dummyTrack",function(){return Y});function Y(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(oe,Z,k){"use strict";k.r(Z);var Y=k("./src/utils/logger.ts"),P=function(){function I(U){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=U,this.bytesAvailable=U.byteLength,this.word=0,this.bitsAvailable=0}var H=I.prototype;return H.loadWord=function(){var O=this.data,R=this.bytesAvailable,y=O.byteLength-R,w=new Uint8Array(4),_=Math.min(4,R);if(_===0)throw new Error("no bytes available");w.set(O.subarray(y,y+_)),this.word=new DataView(w.buffer).getUint32(0),this.bitsAvailable=_*8,this.bytesAvailable-=_},H.skipBits=function(O){var R;this.bitsAvailable>O?(this.word<<=O,this.bitsAvailable-=O):(O-=this.bitsAvailable,R=O>>3,O-=R>>3,this.bytesAvailable-=R,this.loadWord(),this.word<<=O,this.bitsAvailable-=O)},H.readBits=function(O){var R=Math.min(this.bitsAvailable,O),y=this.word>>>32-R;return O>32&&Y.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=R,this.bitsAvailable>0?this.word<<=R:this.bytesAvailable>0&&this.loadWord(),R=O-R,R>0&&this.bitsAvailable?y<<R|this.readBits(R):y},H.skipLZ=function(){var O;for(O=0;O<this.bitsAvailable;++O)if((this.word&2147483648>>>O)!==0)return this.word<<=O,this.bitsAvailable-=O,O;return this.loadWord(),O+this.skipLZ()},H.skipUEG=function(){this.skipBits(1+this.skipLZ())},H.skipEG=function(){this.skipBits(1+this.skipLZ())},H.readUEG=function(){var O=this.skipLZ();return this.readBits(O+1)-1},H.readEG=function(){var O=this.readUEG();return 1&O?1+O>>>1:-1*(O>>>1)},H.readBoolean=function(){return this.readBits(1)===1},H.readUByte=function(){return this.readBits(8)},H.readUShort=function(){return this.readBits(16)},H.readUInt=function(){return this.readBits(32)},H.skipScalingList=function(O){for(var R=8,y=8,w,_=0;_<O;_++)y!==0&&(w=this.readEG(),y=(R+w+256)%256),R=y===0?R:y},H.readSPS=function(){var O=0,R=0,y=0,w=0,_,L,A,C=this.readUByte.bind(this),d=this.readBits.bind(this),o=this.readUEG.bind(this),l=this.readBoolean.bind(this),h=this.skipBits.bind(this),T=this.skipEG.bind(this),f=this.skipUEG.bind(this),p=this.skipScalingList.bind(this);C();var D=C();if(d(5),h(3),C(),f(),D===100||D===110||D===122||D===244||D===44||D===83||D===86||D===118||D===128){var E=o();if(E===3&&h(1),f(),f(),h(1),l())for(L=E!==3?8:12,A=0;A<L;A++)l()&&(A<6?p(16):p(64))}f();var g=o();if(g===0)o();else if(g===1)for(h(1),T(),T(),_=o(),A=0;A<_;A++)T();f(),h(1);var c=o(),u=o(),a=d(1);a===0&&h(1),h(1),l()&&(O=o(),R=o(),y=o(),w=o());var x=[1,1];if(l()&&l()){var b=C();switch(b){case 1:x=[1,1];break;case 2:x=[12,11];break;case 3:x=[10,11];break;case 4:x=[16,11];break;case 5:x=[40,33];break;case 6:x=[24,11];break;case 7:x=[20,11];break;case 8:x=[32,11];break;case 9:x=[80,33];break;case 10:x=[18,11];break;case 11:x=[15,11];break;case 12:x=[64,33];break;case 13:x=[160,99];break;case 14:x=[4,3];break;case 15:x=[3,2];break;case 16:x=[2,1];break;case 255:{x=[C()<<8|C(),C()<<8|C()];break}}}return{width:Math.ceil((c+1)*16-O*2-R*2),height:(2-a)*(u+1)*16-(a?2:4)*(y+w),pixelRatio:x}},H.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},I}();Z.default=P},"./src/demux/id3.ts":function(oe,Z,k){"use strict";k.r(Z),k.d(Z,"isHeader",function(){return Y}),k.d(Z,"isFooter",function(){return P}),k.d(Z,"getID3Data",function(){return I}),k.d(Z,"canParse",function(){return U}),k.d(Z,"getTimeStamp",function(){return O}),k.d(Z,"isTimeStampFrame",function(){return R}),k.d(Z,"getID3Frames",function(){return w}),k.d(Z,"decodeFrame",function(){return _}),k.d(Z,"utf8ArrayToStr",function(){return o}),k.d(Z,"testables",function(){return l});var Y=function(p,D){return D+10<=p.length&&(p[D]===73&&p[D+1]===68&&p[D+2]===51&&(p[D+3]<255&&p[D+4]<255&&(p[D+6]<128&&p[D+7]<128&&p[D+8]<128&&p[D+9]<128)))},P=function(p,D){return D+10<=p.length&&(p[D]===51&&p[D+1]===68&&p[D+2]===73&&(p[D+3]<255&&p[D+4]<255&&(p[D+6]<128&&p[D+7]<128&&p[D+8]<128&&p[D+9]<128)))},I=function(p,D){for(var E=D,g=0;Y(p,D);){g+=10;var c=H(p,D+6);g+=c,P(p,D+10)&&(g+=10),D+=g}return g>0?p.subarray(E,E+g):void 0},H=function(p,D){var E=0;return E=(p[D]&127)<<21,E|=(p[D+1]&127)<<14,E|=(p[D+2]&127)<<7,E|=p[D+3]&127,E},U=function(p,D){return Y(p,D)&&H(p,D+6)+10<=p.length-D},O=function(p){for(var D=w(p),E=0;E<D.length;E++){var g=D[E];if(R(g))return d(g)}return},R=function(p){return p&&p.key==="PRIV"&&p.info==="com.apple.streaming.transportStreamTimestamp"},y=function(p){var D=String.fromCharCode(p[0],p[1],p[2],p[3]),E=H(p,4),g=10;return{type:D,size:E,data:p.subarray(g,g+E)}},w=function(p){for(var D=0,E=[];Y(p,D);){var g=H(p,D+6);D+=10;for(var c=D+g;D+8<c;){var u=y(p.subarray(D)),a=_(u);a&&E.push(a),D+=u.size+10}P(p,D)&&(D+=10)}return E},_=function(p){return p.type==="PRIV"?L(p):p.type[0]==="W"?C(p):A(p)},L=function(p){if(p.size<2)return;var D=o(p.data,!0),E=new Uint8Array(p.data.subarray(D.length+1));return{key:p.type,info:D,data:E.buffer}},A=function(p){if(p.size<2)return;if(p.type==="TXXX"){var D=1,E=o(p.data.subarray(D),!0);D+=E.length+1;var g=o(p.data.subarray(D));return{key:p.type,info:E,data:g}}var c=o(p.data.subarray(1));return{key:p.type,data:c}},C=function(p){if(p.type==="WXXX"){if(p.size<2)return;var D=1,E=o(p.data.subarray(D),!0);D+=E.length+1;var g=o(p.data.subarray(D));return{key:p.type,info:E,data:g}}var c=o(p.data);return{key:p.type,data:c}},d=function(p){if(p.data.byteLength===8){var D=new Uint8Array(p.data),E=D[3]&1,g=(D[4]<<23)+(D[5]<<15)+(D[6]<<7)+D[7];return g/=45,E&&(g+=4772185884e-2),Math.round(g)}return},o=function(p,D){D===void 0&&(D=!1);var E=T();if(E){var g=E.decode(p);if(D){var c=g.indexOf("\0");return c!==-1?g.substring(0,c):g}return g.replace(/\0/g,"")}for(var u=p.length,a,x,b,v="",M=0;M<u;){if(a=p[M++],a===0&&D)return v;if(a===0||a===3)continue;switch(a>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:v+=String.fromCharCode(a);break;case 12:case 13:x=p[M++],v+=String.fromCharCode((a&31)<<6|x&63);break;case 14:x=p[M++],b=p[M++],v+=String.fromCharCode((a&15)<<12|(x&63)<<6|(b&63)<<0);break;default:}}return v},l={decodeTextFrame:A},h;function T(){return!h&&typeof self.TextDecoder!="undefined"&&(h=new self.TextDecoder("utf-8")),h}},"./src/demux/mp3demuxer.ts":function(oe,Z,k){"use strict";k.r(Z);var Y=k("./src/demux/base-audio-demuxer.ts"),P=k("./src/demux/id3.ts"),I=k("./src/utils/logger.ts"),H=k("./src/demux/mpegaudio.ts");function U(y,w){y.prototype=Object.create(w.prototype),y.prototype.constructor=y,O(y,w)}function O(y,w){return O=Object.setPrototypeOf||function(L,A){return L.__proto__=A,L},O(y,w)}var R=function(y){U(w,y);function w(){return y.apply(this,arguments)||this}var _=w.prototype;return _.resetInitSegment=function(A,C,d){y.prototype.resetInitSegment.call(this,A,C,d),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:A,duration:d,inputTimeScale:9e4,dropped:0}},w.probe=function(A){if(!A)return!1;for(var C=P.getID3Data(A,0)||[],d=C.length,o=A.length;d<o;d++)if(H.probe(A,d))return I.logger.log("MPEG Audio sync word found !"),!0;return!1},_.canParse=function(A,C){return H.canParse(A,C)},_.appendFrame=function(A,C,d){return this.initPTS===null?void 0:H.appendFrame(A,C,d,this.initPTS,this.frameIndex)},w}(Y.default);R.minProbeByteLength=4,Z.default=R},"./src/demux/mp4demuxer.ts":function(oe,Z,k){"use strict";k.r(Z);var Y=k("./src/utils/mp4-tools.ts"),P=k("./src/demux/dummy-demuxed-track.ts"),I=function(){function H(O,R){this.remainderData=null,this.config=void 0,this.config=R}var U=H.prototype;return U.resetTimeStamp=function(){},U.resetInitSegment=function(){},U.resetContiguity=function(){},H.probe=function(R){return Object(Y.findBox)({data:R,start:0,end:Math.min(R.length,16384)},["moof"]).length>0},U.demux=function(R){var y=R,w=Object(P.dummyTrack)();if(this.config.progressive){this.remainderData&&(y=Object(Y.appendUint8Array)(this.remainderData,R));var _=Object(Y.segmentValidRange)(y);this.remainderData=_.remainder,w.samples=_.valid||new Uint8Array}else w.samples=y;return{audioTrack:Object(P.dummyTrack)(),avcTrack:w,id3Track:Object(P.dummyTrack)(),textTrack:Object(P.dummyTrack)()}},U.flush=function(){var R=Object(P.dummyTrack)();return R.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(P.dummyTrack)(),avcTrack:R,id3Track:Object(P.dummyTrack)(),textTrack:Object(P.dummyTrack)()}},U.demuxSampleAes=function(R,y,w){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},U.destroy=function(){},H}();I.minProbeByteLength=1024,Z.default=I},"./src/demux/mpegaudio.ts":function(oe,Z,k){"use strict";k.r(Z),k.d(Z,"appendFrame",function(){return O}),k.d(Z,"parseHeader",function(){return R}),k.d(Z,"isHeaderPattern",function(){return y}),k.d(Z,"isHeader",function(){return w}),k.d(Z,"canParse",function(){return _}),k.d(Z,"probe",function(){return L});var Y=null,P=[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],I=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],H=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],U=[0,1,1,4];function O(A,C,d,o,l){if(d+24>C.length)return;var h=R(C,d);if(h&&d+h.frameLength<=C.length){var T=h.samplesPerFrame*9e4/h.sampleRate,f=o+l*T,p={unit:C.subarray(d,d+h.frameLength),pts:f,dts:f};return A.config=[],A.channelCount=h.channelCount,A.samplerate=h.sampleRate,A.samples.push(p),{sample:p,length:h.frameLength,missing:0}}}function R(A,C){var d=A[C+1]>>3&3,o=A[C+1]>>1&3,l=A[C+2]>>4&15,h=A[C+2]>>2&3;if(d!==1&&l!==0&&l!==15&&h!==3){var T=A[C+2]>>1&1,f=A[C+3]>>6,p=d===3?3-o:o===3?3:4,D=P[p*14+l-1]*1e3,E=d===3?0:d===2?1:2,g=I[E*3+h],c=f===3?1:2,u=H[d][o],a=U[o],x=u*8*a,b=Math.floor(u*D/g+T)*a;if(Y===null){var v=navigator.userAgent||"",M=v.match(/Chrome\/(\d+)/i);Y=M?parseInt(M[1]):0}var G=!!Y&&Y<=87;return G&&o===2&&D>=224e3&&f===0&&(A[C+3]=A[C+3]|128),{sampleRate:g,channelCount:c,frameLength:b,samplesPerFrame:x}}}function y(A,C){return A[C]===255&&(A[C+1]&224)===224&&(A[C+1]&6)!==0}function w(A,C){return C+1<A.length&&y(A,C)}function _(A,C){var d=4;return y(A,C)&&d<=A.length-C}function L(A,C){if(C+1<A.length&&y(A,C)){var d=4,o=R(A,C),l=d;o!=null&&o.frameLength&&(l=o.frameLength);var h=C+l;return h===A.length||w(A,h)}return!1}},"./src/demux/sample-aes.ts":function(oe,Z,k){"use strict";k.r(Z);var Y=k("./src/crypt/decrypter.ts"),P=k("./src/demux/tsdemuxer.ts"),I=function(){function H(O,R,y){this.keyData=void 0,this.decrypter=void 0,this.keyData=y,this.decrypter=new Y.default(O,R,{removePKCS7Padding:!1})}var U=H.prototype;return U.decryptBuffer=function(R,y){this.decrypter.decrypt(R,this.keyData.key.buffer,this.keyData.iv.buffer,y)},U.decryptAacSample=function(R,y,w,_){var L=R[y].unit,A=L.subarray(16,L.length-L.length%16),C=A.buffer.slice(A.byteOffset,A.byteOffset+A.length),d=this;this.decryptBuffer(C,function(o){var l=new Uint8Array(o);L.set(l,16),_||d.decryptAacSamples(R,y+1,w)})},U.decryptAacSamples=function(R,y,w){for(;;y++){if(y>=R.length){w();return}if(R[y].unit.length<32)continue;var _=this.decrypter.isSync();if(this.decryptAacSample(R,y,w,_),!_)return}},U.getAvcEncryptedData=function(R){for(var y=Math.floor((R.length-48)/160)*16+16,w=new Int8Array(y),_=0,L=32;L<=R.length-16;L+=160,_+=16)w.set(R.subarray(L,L+16),_);return w},U.getAvcDecryptedUnit=function(R,y){for(var w=new Uint8Array(y),_=0,L=32;L<=R.length-16;L+=160,_+=16)R.set(w.subarray(_,_+16),L);return R},U.decryptAvcSample=function(R,y,w,_,L,A){var C=Object(P.discardEPB)(L.data),d=this.getAvcEncryptedData(C),o=this;this.decryptBuffer(d.buffer,function(l){L.data=o.getAvcDecryptedUnit(C,l),A||o.decryptAvcSamples(R,y,w+1,_)})},U.decryptAvcSamples=function(R,y,w,_){if(R instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;y++,w=0){if(y>=R.length){_();return}for(var L=R[y].units;!(w>=L.length);w++){var A=L[w];if(A.data.length<=48||A.type!==1&&A.type!==5)continue;var C=this.decrypter.isSync();if(this.decryptAvcSample(R,y,w,_,A,C),!C)return}}},H}();Z.default=I},"./src/demux/transmuxer-interface.ts":function(oe,Z,k){"use strict";k.r(Z),k.d(Z,"default",function(){return L});var Y=k("./node_modules/webworkify-webpack/index.js"),P=k.n(Y),I=k("./src/events.ts"),H=k("./src/demux/transmuxer.ts"),U=k("./src/utils/logger.ts"),O=k("./src/errors.ts"),R=k("./src/utils/mediasource-helper.ts"),y=k("./node_modules/eventemitter3/index.js"),w=k.n(y),_=Object(R.getMediaSource)()||{isTypeSupported:function(){return!1}},L=function(){function A(d,o,l,h){var T=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=d,this.id=o,this.onTransmuxComplete=l,this.onFlush=h;var f=d.config,p=function(u,a){a=a||{},a.frag=T.frag,a.id=T.id,d.trigger(u,a)};this.observer=new y.EventEmitter,this.observer.on(I.Events.FRAG_DECRYPTED,p),this.observer.on(I.Events.ERROR,p);var D={mp4:_.isTypeSupported("video/mp4"),mpeg:_.isTypeSupported("audio/mpeg"),mp3:_.isTypeSupported('audio/mp4; codecs="mp3"')},E=navigator.vendor;if(f.enableWorker&&typeof Worker!="undefined"){U.logger.log("demuxing in webworker");var g;try{g=this.worker=Y("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),g.addEventListener("message",this.onwmsg),g.onerror=function(c){d.trigger(I.Events.ERROR,{type:O.ErrorTypes.OTHER_ERROR,details:O.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(c.message+" ("+c.filename+":"+c.lineno+")")})},g.postMessage({cmd:"init",typeSupported:D,vendor:E,id:o,config:JSON.stringify(f)})}catch(c){U.logger.warn("Error in worker:",c),U.logger.error("Error while initializing DemuxerWorker, fallback to inline"),g&&self.URL.revokeObjectURL(g.objectURL),this.transmuxer=new H.default(this.observer,D,f,E,o),this.worker=null}}else this.transmuxer=new H.default(this.observer,D,f,E,o)}var C=A.prototype;return C.destroy=function(){var o=this.worker;if(o)o.removeEventListener("message",this.onwmsg),o.terminate(),this.worker=null;else{var l=this.transmuxer;l&&(l.destroy(),this.transmuxer=null)}var h=this.observer;h&&h.removeAllListeners(),this.observer=null},C.push=function(o,l,h,T,f,p,D,E,g,c){var u=this;g.transmuxing.start=self.performance.now();var a=this.transmuxer,x=this.worker,b=p?p.start:f.start,v=f.decryptdata,M=this.frag,G=!(M&&f.cc===M.cc),X=!(M&&g.level===M.level),Q=M?g.sn-M.sn:-1,z=this.part?g.part-this.part.index:1,j=!X&&(Q===1||Q===0&&z===1),q=self.performance.now();(X||Q||f.stats.parsing.start===0)&&(f.stats.parsing.start=q),p&&(z||!j)&&(p.stats.parsing.start=q);var le=new H.TransmuxState(G,j,E,X,b);if(!j||G){U.logger.log("[transmuxer-interface, "+f.type+"]: Starting new transmux session for sn: "+g.sn+" p: "+g.part+" level: "+g.level+" id: "+g.id+`
|
|
discontinuity: `+G+`
|
|
trackSwitch: `+X+`
|
|
contiguous: `+j+`
|
|
accurateTimeOffset: `+E+`
|
|
timeOffset: `+b);var me=new H.TransmuxConfig(h,T,l,D,c);this.configureTransmuxer(me)}if(this.frag=f,this.part=p,x)x.postMessage({cmd:"demux",data:o,decryptdata:v,chunkMeta:g,state:le},o instanceof ArrayBuffer?[o]:[]);else if(a){var be=a.push(o,v,g,le);Object(H.isPromise)(be)?be.then(function(Be){u.handleTransmuxComplete(Be)}):this.handleTransmuxComplete(be)}},C.flush=function(o){var l=this;o.transmuxing.start=self.performance.now();var h=this.transmuxer,T=this.worker;if(T)T.postMessage({cmd:"flush",chunkMeta:o});else if(h){var f=h.flush(o);Object(H.isPromise)(f)?f.then(function(p){l.handleFlushResult(p,o)}):this.handleFlushResult(f,o)}},C.handleFlushResult=function(o,l){var h=this;o.forEach(function(T){h.handleTransmuxComplete(T)}),this.onFlush(l)},C.onWorkerMessage=function(o){var l=o.data,h=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,h.trigger(l.event,l.data);break}}},C.configureTransmuxer=function(o){var l=this.worker,h=this.transmuxer;l?l.postMessage({cmd:"configure",config:o}):h&&h.configure(o)},C.handleTransmuxComplete=function(o){o.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(o)},A}()},"./src/demux/transmuxer-worker.ts":function(oe,Z,k){"use strict";k.r(Z),k.d(Z,"default",function(){return O});var Y=k("./src/demux/transmuxer.ts"),P=k("./src/events.ts"),I=k("./src/utils/logger.ts"),H=k("./node_modules/eventemitter3/index.js"),U=k.n(H);function O(L){var A=new H.EventEmitter,C=function(o,l){L.postMessage({event:o,data:l})};A.on(P.Events.FRAG_DECRYPTED,C),A.on(P.Events.ERROR,C),L.addEventListener("message",function(d){var o=d.data;switch(o.cmd){case"init":{var l=JSON.parse(o.config);L.transmuxer=new Y.default(A,o.typeSupported,l,o.vendor,o.id),Object(I.enableLogs)(l.debug),C("init",null);break}case"configure":{L.transmuxer.configure(o.config);break}case"demux":{var h=L.transmuxer.push(o.data,o.decryptdata,o.chunkMeta,o.state);Object(Y.isPromise)(h)?h.then(function(p){R(L,p)}):R(L,h);break}case"flush":{var T=o.chunkMeta,f=L.transmuxer.flush(T);Object(Y.isPromise)(f)?f.then(function(p){w(L,p,T)}):w(L,f,T);break}default:break}})}function R(L,A){if(_(A.remuxResult))return;var C=[],d=A.remuxResult,o=d.audio,l=d.video;o&&y(C,o),l&&y(C,l),L.postMessage({event:"transmuxComplete",data:A},C)}function y(L,A){A.data1&&L.push(A.data1.buffer),A.data2&&L.push(A.data2.buffer)}function w(L,A,C){A.forEach(function(d){R(L,d)}),L.postMessage({event:"flush",data:C})}function _(L){return!L.audio&&!L.video&&!L.text&&!L.id3&&!L.initSegment}},"./src/demux/transmuxer.ts":function(oe,Z,k){"use strict";k.r(Z),k.d(Z,"default",function(){return l}),k.d(Z,"isPromise",function(){return f}),k.d(Z,"TransmuxConfig",function(){return p}),k.d(Z,"TransmuxState",function(){return D});var Y=k("./src/events.ts"),P=k("./src/errors.ts"),I=k("./src/crypt/decrypter.ts"),H=k("./src/demux/aacdemuxer.ts"),U=k("./src/demux/mp4demuxer.ts"),O=k("./src/demux/tsdemuxer.ts"),R=k("./src/demux/mp3demuxer.ts"),y=k("./src/remux/mp4-remuxer.ts"),w=k("./src/remux/passthrough-remuxer.ts"),_=k("./src/demux/chunk-cache.ts"),L=k("./src/utils/mp4-tools.ts"),A=k("./src/utils/logger.ts"),C;try{C=self.performance.now.bind(self.performance)}catch(E){A.logger.debug("Unable to use Performance API on this environment"),C=self.Date.now}var d=[{demux:O.default,remux:y.default},{demux:U.default,remux:w.default},{demux:H.default,remux:y.default},{demux:R.default,remux:y.default}],o=1024;d.forEach(function(E){var g=E.demux;o=Math.max(o,g.minProbeByteLength)});var l=function(){function E(c,u,a,x,b){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 _.default,this.observer=c,this.typeSupported=u,this.config=a,this.vendor=x,this.id=b}var g=E.prototype;return g.configure=function(u){this.transmuxConfig=u,this.decrypter&&this.decrypter.reset()},g.push=function(u,a,x,b){var v=this,M=x.transmuxing;M.executeStart=C();var G=new Uint8Array(u),X=this.cache,Q=this.config,z=this.currentTransmuxState,j=this.transmuxConfig;b&&(this.currentTransmuxState=b);var q=h(G,a);if(q&&q.method==="AES-128"){var le=this.getDecrypter();if(Q.enableSoftwareAES){var me=le.softwareDecrypt(G,q.key.buffer,q.iv.buffer);if(!me)return M.executeEnd=C(),T(x);G=new Uint8Array(me)}else return this.decryptionPromise=le.webCryptoDecrypt(G,q.key.buffer,q.iv.buffer).then(function(_e){var Ie=v.push(_e,null,x);return v.decryptionPromise=null,Ie}),this.decryptionPromise}var be=b||z,Be=be.contiguous,Le=be.discontinuity,De=be.trackSwitch,de=be.accurateTimeOffset,pe=be.timeOffset,ae=j.audioCodec,re=j.videoCodec,we=j.defaultInitPts,ve=j.duration,Re=j.initSegmentData;if((Le||De)&&this.resetInitSegment(Re,ae,re,ve),Le&&this.resetInitialTimestamp(we),Be||this.resetContiguity(),this.needsProbing(G,Le,De)){if(X.dataLength){var Ae=X.flush();G=Object(L.appendUint8Array)(Ae,G)}this.configureTransmuxer(G,j)}var Oe=this.transmux(G,q,pe,de,x),Ee=this.currentTransmuxState;return Ee.contiguous=!0,Ee.discontinuity=!1,Ee.trackSwitch=!1,M.executeEnd=C(),Oe},g.flush=function(u){var a=this,x=u.transmuxing;x.executeStart=C();var b=this.decrypter,v=this.cache,M=this.currentTransmuxState,G=this.decryptionPromise;if(G)return G.then(function(){return a.flush(u)});var X=[],Q=M.timeOffset;if(b){var z=b.flush();z&&X.push(this.push(z,null,u))}var j=v.dataLength;v.reset();var q=this.demuxer,le=this.remuxer;if(!q||!le)return j>=o&&this.observer.emit(Y.Events.ERROR,Y.Events.ERROR,{type:P.ErrorTypes.MEDIA_ERROR,details:P.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),x.executeEnd=C(),[T(u)];var me=q.flush(Q);return f(me)?me.then(function(be){return a.flushRemux(X,be,u),X}):(this.flushRemux(X,me,u),X)},g.flushRemux=function(u,a,x){var b=a.audioTrack,v=a.avcTrack,M=a.id3Track,G=a.textTrack,X=this.currentTransmuxState,Q=X.accurateTimeOffset,z=X.timeOffset;A.logger.log("[transmuxer.ts]: Flushed fragment "+x.sn+(x.part>-1?" p: "+x.part:"")+" of level "+x.level);var j=this.remuxer.remux(b,v,M,G,z,Q,!0,this.id);u.push({remuxResult:j,chunkMeta:x}),x.transmuxing.executeEnd=C()},g.resetInitialTimestamp=function(u){var a=this.demuxer,x=this.remuxer;if(!a||!x)return;a.resetTimeStamp(u),x.resetTimeStamp(u)},g.resetContiguity=function(){var u=this.demuxer,a=this.remuxer;if(!u||!a)return;u.resetContiguity(),a.resetNextTimestamp()},g.resetInitSegment=function(u,a,x,b){var v=this.demuxer,M=this.remuxer;if(!v||!M)return;v.resetInitSegment(a,x,b),M.resetInitSegment(u,a,x)},g.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},g.transmux=function(u,a,x,b,v){var M;return a&&a.method==="SAMPLE-AES"?M=this.transmuxSampleAes(u,a,x,b,v):M=this.transmuxUnencrypted(u,x,b,v),M},g.transmuxUnencrypted=function(u,a,x,b){var v=this.demuxer.demux(u,a,!1,!this.config.progressive),M=v.audioTrack,G=v.avcTrack,X=v.id3Track,Q=v.textTrack,z=this.remuxer.remux(M,G,X,Q,a,x,!1,this.id);return{remuxResult:z,chunkMeta:b}},g.transmuxSampleAes=function(u,a,x,b,v){var M=this;return this.demuxer.demuxSampleAes(u,a,x).then(function(G){var X=M.remuxer.remux(G.audioTrack,G.avcTrack,G.id3Track,G.textTrack,x,b,!1,M.id);return{remuxResult:X,chunkMeta:v}})},g.configureTransmuxer=function(u,a){for(var x=this.config,b=this.observer,v=this.typeSupported,M=this.vendor,G=a.audioCodec,X=a.defaultInitPts,Q=a.duration,z=a.initSegmentData,j=a.videoCodec,q,le=0,me=d.length;le<me;le++)if(d[le].demux.probe(u)){q=d[le];break}q||(A.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),q={demux:U.default,remux:w.default});var be=this.demuxer,Be=this.remuxer,Le=q.remux,De=q.demux;(!Be||!(Be instanceof Le))&&(this.remuxer=new Le(b,x,v,M)),(!be||!(be instanceof De))&&(this.demuxer=new De(b,x,v),this.probe=De.probe),this.resetInitSegment(z,G,j,Q),this.resetInitialTimestamp(X)},g.needsProbing=function(u,a,x){return!this.demuxer||!this.remuxer||a||x},g.getDecrypter=function(){var u=this.decrypter;return u||(u=this.decrypter=new I.default(this.observer,this.config)),u},E}();function h(E,g){var c=null;return E.byteLength>0&&g!=null&&g.key!=null&&g.iv!==null&&g.method!=null&&(c=g),c}var T=function(g){return{remuxResult:{},chunkMeta:g}};function f(E){return"then"in E&&E.then instanceof Function}var p=function(g,c,u,a,x){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=g,this.videoCodec=c,this.initSegmentData=u,this.duration=a,this.defaultInitPts=x},D=function(g,c,u,a,x){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=g,this.contiguous=c,this.accurateTimeOffset=u,this.trackSwitch=a,this.timeOffset=x}},"./src/demux/tsdemuxer.ts":function(oe,Z,k){"use strict";k.r(Z),k.d(Z,"discardEPB",function(){return T});var Y=k("./src/demux/adts.ts"),P=k("./src/demux/mpegaudio.ts"),I=k("./src/demux/exp-golomb.ts"),H=k("./src/demux/id3.ts"),U=k("./src/demux/sample-aes.ts"),O=k("./src/events.ts"),R=k("./src/utils/mp4-tools.ts"),y=k("./src/utils/logger.ts"),w=k("./src/errors.ts"),_={video:1,audio:2,id3:3,text:4},L=function(){function f(D,E,g){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=D,this.config=E,this.typeSupported=g}f.probe=function(E){var g=f.syncOffset(E);return g<0?!1:(g&&y.logger.warn("MPEG2-TS detected but first sync word found @ offset "+g+", junk ahead ?"),!0)},f.syncOffset=function(E){for(var g=Math.min(1e3,E.length-3*188),c=0;c<g;){if(E[c]===71&&E[c+188]===71&&E[c+2*188]===71)return c;c++}return-1},f.createTrack=function(E,g){return{container:E==="video"||E==="audio"?"video/mp2t":void 0,type:E,id:_[E],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:E==="audio"?g:void 0}};var p=f.prototype;return p.resetInitSegment=function(E,g,c){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=f.createTrack("video",c),this._audioTrack=f.createTrack("audio",c),this._id3Track=f.createTrack("id3",c),this._txtTrack=f.createTrack("text",c),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=E,this.videoCodec=g,this._duration=c},p.resetTimeStamp=function(){},p.resetContiguity=function(){var E=this._audioTrack,g=this._avcTrack,c=this._id3Track;E&&(E.pesData=null),g&&(g.pesData=null),c&&(c.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},p.demux=function(E,g,c,u){c===void 0&&(c=!1),u===void 0&&(u=!1),c||(this.sampleAes=null);var a,x=this._avcTrack,b=this._audioTrack,v=this._id3Track,M=x.pid,G=x.pesData,X=b.pid,Q=v.pid,z=b.pesData,j=v.pesData,q=!1,le=this.pmtParsed,me=this._pmtId,be=E.length;if(this.remainderData&&(E=Object(R.appendUint8Array)(this.remainderData,E),be=E.length,this.remainderData=null),be<188&&!u)return this.remainderData=E,{audioTrack:b,avcTrack:x,id3Track:v,textTrack:this._txtTrack};var Be=Math.max(0,f.syncOffset(E));be-=(be+Be)%188,be<E.byteLength&&!u&&(this.remainderData=new Uint8Array(E.buffer,be,E.buffer.byteLength-be));for(var Le=Be;Le<be;Le+=188)if(E[Le]===71){var De=!!(E[Le+1]&64),de=((E[Le+1]&31)<<8)+E[Le+2],pe=(E[Le+3]&48)>>4,ae=void 0;if(pe>1){if(ae=Le+5+E[Le+4],ae===Le+188)continue}else ae=Le+4;switch(de){case M:De&&(G&&(a=o(G))&&this.parseAVCPES(a,!1),G={data:[],size:0}),G&&(G.data.push(E.subarray(ae,Le+188)),G.size+=Le+188-ae);break;case X:De&&(z&&(a=o(z))&&(b.isAAC?this.parseAACPES(a):this.parseMPEGPES(a)),z={data:[],size:0}),z&&(z.data.push(E.subarray(ae,Le+188)),z.size+=Le+188-ae);break;case Q:De&&(j&&(a=o(j))&&this.parseID3PES(a),j={data:[],size:0}),j&&(j.data.push(E.subarray(ae,Le+188)),j.size+=Le+188-ae);break;case 0:De&&(ae+=E[ae]+1),me=this._pmtId=C(E,ae);break;case me:{De&&(ae+=E[ae]+1);var re=d(E,ae,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,c);M=re.avc,M>0&&(x.pid=M),X=re.audio,X>0&&(b.pid=X,b.isAAC=re.isAAC),Q=re.id3,Q>0&&(v.pid=Q),q&&!le&&(y.logger.log("reparse from beginning"),q=!1,Le=Be-188),le=this.pmtParsed=!0;break}case 17:case 8191:break;default:q=!0;break}}else this.observer.emit(O.Events.ERROR,O.Events.ERROR,{type:w.ErrorTypes.MEDIA_ERROR,details:w.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});x.pesData=G,b.pesData=z,v.pesData=j;var we={audioTrack:b,avcTrack:x,id3Track:v,textTrack:this._txtTrack};return u&&this.extractRemainingSamples(we),we},p.flush=function(){var E=this.remainderData;this.remainderData=null;var g;return E?g=this.demux(E,-1,!1,!0):g={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(g),this.sampleAes?this.decrypt(g,this.sampleAes):g},p.extractRemainingSamples=function(E){var g=E.audioTrack,c=E.avcTrack,u=E.id3Track,a=c.pesData,x=g.pesData,b=u.pesData,v;a&&(v=o(a))?(this.parseAVCPES(v,!0),c.pesData=null):c.pesData=a,x&&(v=o(x))?(g.isAAC?this.parseAACPES(v):this.parseMPEGPES(v),g.pesData=null):(x!=null&&x.size&&y.logger.log("last AAC PES packet truncated,might overlap between fragments"),g.pesData=x),b&&(v=o(b))?(this.parseID3PES(v),u.pesData=null):u.pesData=b},p.demuxSampleAes=function(E,g,c){var u=this.demux(E,c,!0,!this.config.progressive),a=this.sampleAes=new U.default(this.observer,this.config,g);return this.decrypt(u,a)},p.decrypt=function(E,g){return new Promise(function(c){var u=E.audioTrack,a=E.avcTrack;u.samples&&u.isAAC?g.decryptAacSamples(u.samples,0,function(){a.samples?g.decryptAvcSamples(a.samples,0,0,function(){c(E)}):c(E)}):a.samples&&g.decryptAvcSamples(a.samples,0,0,function(){c(E)})})},p.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},p.parseAVCPES=function(E,g){var c=this,u=this._avcTrack,a=this.parseAVCNALu(E.data),x=!1,b=this.avcSample,v,M=!1;E.data=null,b&&a.length&&!u.audFound&&(l(b,u),b=this.avcSample=A(!1,E.pts,E.dts,"")),a.forEach(function(G){switch(G.type){case 1:{v=!0,b||(b=c.avcSample=A(!0,E.pts,E.dts,"")),x&&(b.debug+="NDR "),b.frame=!0;var X=G.data;if(M&&X.length>4){var Q=new I.default(X).readSliceType();(Q===2||Q===4||Q===7||Q===9)&&(b.key=!0)}break}case 5:v=!0,b||(b=c.avcSample=A(!0,E.pts,E.dts,"")),x&&(b.debug+="IDR "),b.key=!0,b.frame=!0;break;case 6:{v=!0,x&&b&&(b.debug+="SEI ");var z=new I.default(T(G.data));z.readUByte();for(var j=0,q=0,le=!1,me=0;!le&&z.bytesAvailable>1;){j=0;do me=z.readUByte(),j+=me;while(me===255);q=0;do me=z.readUByte(),q+=me;while(me===255);if(j===4&&z.bytesAvailable!==0){le=!0;var be=z.readUByte();if(be===181){var Be=z.readUShort();if(Be===49){var Le=z.readUInt();if(Le===1195456820){var De=z.readUByte();if(De===3){for(var de=z.readUByte(),pe=z.readUByte(),ae=31&de,re=[de,pe],we=0;we<ae;we++)re.push(z.readUByte()),re.push(z.readUByte()),re.push(z.readUByte());h(c._txtTrack.samples,{type:3,pts:E.pts,bytes:re})}}}}}else if(j===5&&z.bytesAvailable!==0){if(le=!0,q>16){for(var ve=[],Re=0;Re<16;Re++)ve.push(z.readUByte().toString(16)),(Re===3||Re===5||Re===7||Re===9)&&ve.push("-");for(var Ae=q-16,Oe=new Uint8Array(Ae),Ee=0;Ee<Ae;Ee++)Oe[Ee]=z.readUByte();h(c._txtTrack.samples,{pts:E.pts,payloadType:j,uuid:ve.join(""),userData:Object(H.utf8ArrayToStr)(Oe),userDataBytes:Oe})}}else if(q<z.bytesAvailable)for(var _e=0;_e<q;_e++)z.readUByte()}break}case 7:if(v=!0,M=!0,x&&b&&(b.debug+="SPS "),!u.sps){var Ie=new I.default(G.data),Ve=Ie.readSPS();u.width=Ve.width,u.height=Ve.height,u.pixelRatio=Ve.pixelRatio,u.sps=[G.data],u.duration=c._duration;for(var Ue=G.data.subarray(1,4),Fe="avc1.",Pe=0;Pe<3;Pe++){var et=Ue[Pe].toString(16);et.length<2&&(et="0"+et),Fe+=et}u.codec=Fe}break;case 8:v=!0,x&&b&&(b.debug+="PPS "),u.pps||(u.pps=[G.data]);break;case 9:v=!1,u.audFound=!0,b&&l(b,u),b=c.avcSample=A(!1,E.pts,E.dts,x?"AUD ":"");break;case 12:v=!1;break;default:v=!1,b&&(b.debug+="unknown NAL "+G.type+" ");break}if(b&&v){var Je=b.units;Je.push(G)}}),g&&b&&(l(b,u),this.avcSample=null)},p.getLastNalUnit=function(){var E,g=this.avcSample,c;if(!g||g.units.length===0){var u=this._avcTrack.samples;g=u[u.length-1]}if((E=g)!==null&&E!==void 0&&E.units){var a=g.units;c=a[a.length-1]}return c},p.parseAVCNALu=function(E){var g=E.byteLength,c=this._avcTrack,u=c.naluState||0,a=u,x=[],b=0,v,M,G,X=-1,Q=0;for(u===-1&&(X=0,Q=E[0]&31,u=0,b=1);b<g;){if(v=E[b++],!u){u=v?0:1;continue}if(u===1){u=v?0:2;continue}if(!v)u=3;else if(v===1){if(X>=0){var z={data:E.subarray(X,b-u-1),type:Q};x.push(z)}else{var j=this.getLastNalUnit();if(j&&(a&&b<=4-a&&(j.state&&(j.data=j.data.subarray(0,j.data.byteLength-a))),M=b-u-1,M>0)){var q=new Uint8Array(j.data.byteLength+M);q.set(j.data,0),q.set(E.subarray(0,M),j.data.byteLength),j.data=q,j.state=0}}b<g?(G=E[b]&31,X=b,Q=G,u=0):u=-1}else u=0}if(X>=0&&u>=0){var le={data:E.subarray(X,g),type:Q,state:u};x.push(le)}if(x.length===0){var me=this.getLastNalUnit();if(me){var be=new Uint8Array(me.data.byteLength+E.byteLength);be.set(me.data,0),be.set(E,me.data.byteLength),me.data=be}}return c.naluState=u,x},p.parseAACPES=function(E){var g=0,c=this._audioTrack,u=this.aacOverFlow,a=E.data;if(u){this.aacOverFlow=null;var x=u.sample.unit.byteLength,b=Math.min(u.missing,x),v=x-b;u.sample.unit.set(a.subarray(0,b),v),c.samples.push(u.sample),g=u.missing}var M,G;for(M=g,G=a.length;M<G-1&&!Y.isHeader(a,M);M++);if(M!==g){var X,Q;if(M<G-1?(X="AAC PES did not start with ADTS header,offset:"+M,Q=!1):(X="no ADTS header found in AAC PES",Q=!0),y.logger.warn("parsing error:"+X),this.observer.emit(O.Events.ERROR,O.Events.ERROR,{type:w.ErrorTypes.MEDIA_ERROR,details:w.ErrorDetails.FRAG_PARSING_ERROR,fatal:Q,reason:X}),Q)return}Y.initTrackConfig(c,this.observer,a,M,this.audioCodec);var z;if(E.pts!==void 0)z=E.pts;else if(u){var j=Y.getFrameDuration(c.samplerate);z=u.sample.pts+j}else{y.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var q=0;M<G;)if(Y.isHeader(a,M)){if(M+5<G){var le=Y.appendFrame(c,a,M,z,q);if(le)if(le.missing)this.aacOverFlow=le;else{M+=le.length,q++;continue}}break}else M++},p.parseMPEGPES=function(E){var g=E.data,c=g.length,u=0,a=0,x=E.pts;if(x===void 0){y.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;a<c;)if(P.isHeader(g,a)){var b=P.appendFrame(this._audioTrack,g,a,x,u);if(b)a+=b.length,u++;else break}else a++},p.parseID3PES=function(E){if(E.pts===void 0){y.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(E)},f}();L.minProbeByteLength=188;function A(f,p,D,E){return{key:f,frame:!1,pts:p,dts:D,units:[],debug:E,length:0}}function C(f,p){return(f[p+10]&31)<<8|f[p+11]}function d(f,p,D,E){var g={audio:-1,avc:-1,id3:-1,isAAC:!0},c=(f[p+1]&15)<<8|f[p+2],u=p+3+c-4,a=(f[p+10]&15)<<8|f[p+11];for(p+=12+a;p<u;){var x=(f[p+1]&31)<<8|f[p+2];switch(f[p]){case 207:if(!E){y.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:g.audio===-1&&(g.audio=x);break;case 21:g.id3===-1&&(g.id3=x);break;case 219:if(!E){y.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:g.avc===-1&&(g.avc=x);break;case 3:case 4:D?g.audio===-1&&(g.audio=x,g.isAAC=!1):y.logger.log("MPEG audio found, not supported in this browser");break;case 36:y.logger.warn("Unsupported HEVC stream type found");break;default:break}p+=((f[p+3]&15)<<8|f[p+4])+5}return g}function o(f){var p=0,D,E,g,c,u,a=f.data;if(!f||f.size===0)return null;for(;a[0].length<19&&a.length>1;){var x=new Uint8Array(a[0].length+a[1].length);x.set(a[0]),x.set(a[1],a[0].length),a[0]=x,a.splice(1,1)}D=a[0];var b=(D[0]<<16)+(D[1]<<8)+D[2];if(b===1){if(E=(D[4]<<8)+D[5],E&&E>f.size-6)return null;var v=D[7];v&192&&(c=(D[9]&14)*536870912+(D[10]&255)*4194304+(D[11]&254)*16384+(D[12]&255)*128+(D[13]&254)/2,v&64?(u=(D[14]&14)*536870912+(D[15]&255)*4194304+(D[16]&254)*16384+(D[17]&255)*128+(D[18]&254)/2,c-u>60*9e4&&(y.logger.warn(Math.round((c-u)/9e4)+"s delta between PTS and DTS, align them"),c=u)):u=c),g=D[8];var M=g+9;if(f.size<=M)return null;f.size-=M;for(var G=new Uint8Array(f.size),X=0,Q=a.length;X<Q;X++){D=a[X];var z=D.byteLength;if(M)if(M>z){M-=z;continue}else D=D.subarray(M),z-=M,M=0;G.set(D,p),p+=z}return E&&(E-=g+3),{data:G,pts:c,dts:u,len:E}}return null}function l(f,p){if(f.units.length&&f.frame){if(f.pts===void 0){var D=p.samples,E=D.length;if(E){var g=D[E-1];f.pts=g.pts,f.dts=g.dts}else{p.dropped++;return}}p.samples.push(f)}f.debug.length&&y.logger.log(f.pts+"/"+f.dts+":"+f.debug)}function h(f,p){var D=f.length;if(D>0){if(p.pts>=f[D-1].pts)f.push(p);else for(var E=D-1;E>=0;E--)if(p.pts<f[E].pts){f.splice(E,0,p);break}}else f.push(p)}function T(f){for(var p=f.byteLength,D=[],E=1;E<p-2;)f[E]===0&&f[E+1]===0&&f[E+2]===3?(D.push(E+2),E+=2):E++;if(D.length===0)return f;var g=p-D.length,c=new Uint8Array(g),u=0;for(E=0;E<g;u++,E++)u===D[0]&&(u++,D.shift()),c[E]=f[u];return c}Z.default=L},"./src/errors.ts":function(oe,Z,k){"use strict";k.r(Z),k.d(Z,"ErrorTypes",function(){return Y}),k.d(Z,"ErrorDetails",function(){return P});var Y;(function(I){I.NETWORK_ERROR="networkError",I.MEDIA_ERROR="mediaError",I.KEY_SYSTEM_ERROR="keySystemError",I.MUX_ERROR="muxError",I.OTHER_ERROR="otherError"})(Y||(Y={}));var P;(function(I){I.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",I.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",I.KEY_SYSTEM_NO_SESSION="keySystemNoSession",I.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",I.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",I.MANIFEST_LOAD_ERROR="manifestLoadError",I.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",I.MANIFEST_PARSING_ERROR="manifestParsingError",I.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",I.LEVEL_EMPTY_ERROR="levelEmptyError",I.LEVEL_LOAD_ERROR="levelLoadError",I.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",I.LEVEL_SWITCH_ERROR="levelSwitchError",I.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",I.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",I.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",I.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",I.FRAG_LOAD_ERROR="fragLoadError",I.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",I.FRAG_DECRYPT_ERROR="fragDecryptError",I.FRAG_PARSING_ERROR="fragParsingError",I.REMUX_ALLOC_ERROR="remuxAllocError",I.KEY_LOAD_ERROR="keyLoadError",I.KEY_LOAD_TIMEOUT="keyLoadTimeOut",I.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",I.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",I.BUFFER_APPEND_ERROR="bufferAppendError",I.BUFFER_APPENDING_ERROR="bufferAppendingError",I.BUFFER_STALLED_ERROR="bufferStalledError",I.BUFFER_FULL_ERROR="bufferFullError",I.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",I.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",I.INTERNAL_EXCEPTION="internalException",I.INTERNAL_ABORTED="aborted",I.UNKNOWN="unknown"})(P||(P={}))},"./src/events.ts":function(oe,Z,k){"use strict";k.r(Z),k.d(Z,"Events",function(){return Y});var Y;(function(P){P.MEDIA_ATTACHING="hlsMediaAttaching",P.MEDIA_ATTACHED="hlsMediaAttached",P.MEDIA_DETACHING="hlsMediaDetaching",P.MEDIA_DETACHED="hlsMediaDetached",P.BUFFER_RESET="hlsBufferReset",P.BUFFER_CODECS="hlsBufferCodecs",P.BUFFER_CREATED="hlsBufferCreated",P.BUFFER_APPENDING="hlsBufferAppending",P.BUFFER_APPENDED="hlsBufferAppended",P.BUFFER_EOS="hlsBufferEos",P.BUFFER_FLUSHING="hlsBufferFlushing",P.BUFFER_FLUSHED="hlsBufferFlushed",P.MANIFEST_LOADING="hlsManifestLoading",P.MANIFEST_LOADED="hlsManifestLoaded",P.MANIFEST_PARSED="hlsManifestParsed",P.LEVEL_SWITCHING="hlsLevelSwitching",P.LEVEL_SWITCHED="hlsLevelSwitched",P.LEVEL_LOADING="hlsLevelLoading",P.LEVEL_LOADED="hlsLevelLoaded",P.LEVEL_UPDATED="hlsLevelUpdated",P.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",P.LEVELS_UPDATED="hlsLevelsUpdated",P.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",P.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",P.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",P.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",P.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",P.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",P.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",P.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",P.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",P.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",P.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",P.CUES_PARSED="hlsCuesParsed",P.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",P.INIT_PTS_FOUND="hlsInitPtsFound",P.FRAG_LOADING="hlsFragLoading",P.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",P.FRAG_LOADED="hlsFragLoaded",P.FRAG_DECRYPTED="hlsFragDecrypted",P.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",P.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",P.FRAG_PARSING_METADATA="hlsFragParsingMetadata",P.FRAG_PARSED="hlsFragParsed",P.FRAG_BUFFERED="hlsFragBuffered",P.FRAG_CHANGED="hlsFragChanged",P.FPS_DROP="hlsFpsDrop",P.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",P.ERROR="hlsError",P.DESTROYING="hlsDestroying",P.KEY_LOADING="hlsKeyLoading",P.KEY_LOADED="hlsKeyLoaded",P.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",P.BACK_BUFFER_REACHED="hlsBackBufferReached"})(Y||(Y={}))},"./src/hls.ts":function(oe,Z,k){"use strict";k.r(Z),k.d(Z,"default",function(){return f});var Y=k("./node_modules/url-toolkit/src/url-toolkit.js"),P=k.n(Y),I=k("./src/loader/playlist-loader.ts"),H=k("./src/loader/key-loader.ts"),U=k("./src/controller/id3-track-controller.ts"),O=k("./src/controller/latency-controller.ts"),R=k("./src/controller/level-controller.ts"),y=k("./src/controller/fragment-tracker.ts"),w=k("./src/controller/stream-controller.ts"),_=k("./src/is-supported.ts"),L=k("./src/utils/logger.ts"),A=k("./src/config.ts"),C=k("./node_modules/eventemitter3/index.js"),d=k.n(C),o=k("./src/events.ts"),l=k("./src/errors.ts");function h(p,D){for(var E=0;E<D.length;E++){var g=D[E];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(p,g.key,g)}}function T(p,D,E){return D&&h(p.prototype,D),E&&h(p,E),p}var f=function(){p.isSupported=function(){return Object(_.isSupported)()};function p(E){E===void 0&&(E={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new C.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 g=this.config=Object(A.mergeConfig)(p.DefaultConfig,E);this.userConfig=E,Object(L.enableLogs)(g.debug),this._autoLevelCapping=-1,g.progressive&&Object(A.enableStreamingMode)(g);var c=g.abrController,u=g.bufferController,a=g.capLevelController,x=g.fpsController,b=this.abrController=new c(this),v=this.bufferController=new u(this),M=this.capLevelController=new a(this),G=new x(this),X=new I.default(this),Q=new H.default(this),z=new U.default(this),j=this.levelController=new R.default(this),q=new y.FragmentTracker(this),le=this.streamController=new w.default(this,q);M.setStreamController(le),G.setStreamController(le);var me=[j,le];this.networkControllers=me;var be=[X,Q,b,v,M,G,z,q];this.audioTrackController=this.createController(g.audioTrackController,null,me),this.createController(g.audioStreamController,q,me),this.subtitleTrackController=this.createController(g.subtitleTrackController,null,me),this.createController(g.subtitleStreamController,q,me),this.createController(g.timelineController,null,be),this.emeController=this.createController(g.emeController,null,be),this.cmcdController=this.createController(g.cmcdController,null,be),this.latencyController=this.createController(O.default,null,be),this.coreComponents=be}var D=p.prototype;return D.createController=function(g,c,u){if(g){var a=c?new g(this,c):new g(this);return u&&u.push(a),a}return null},D.on=function(g,c,u){u===void 0&&(u=this),this._emitter.on(g,c,u)},D.once=function(g,c,u){u===void 0&&(u=this),this._emitter.once(g,c,u)},D.removeAllListeners=function(g){this._emitter.removeAllListeners(g)},D.off=function(g,c,u,a){u===void 0&&(u=this),this._emitter.off(g,c,u,a)},D.listeners=function(g){return this._emitter.listeners(g)},D.emit=function(g,c,u){return this._emitter.emit(g,c,u)},D.trigger=function(g,c){if(this.config.debug)return this.emit(g,g,c);try{return this.emit(g,g,c)}catch(u){L.logger.error("An internal error happened while handling event "+g+'. Error message: "'+u.message+'". Here is a stacktrace:',u),this.trigger(o.Events.ERROR,{type:l.ErrorTypes.OTHER_ERROR,details:l.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:g,error:u})}return!1},D.listenerCount=function(g){return this._emitter.listenerCount(g)},D.destroy=function(){L.logger.log("destroy"),this.trigger(o.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(g){return g.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(g){return g.destroy()}),this.coreComponents.length=0},D.attachMedia=function(g){L.logger.log("attachMedia"),this._media=g,this.trigger(o.Events.MEDIA_ATTACHING,{media:g})},D.detachMedia=function(){L.logger.log("detachMedia"),this.trigger(o.Events.MEDIA_DETACHING,void 0),this._media=null},D.loadSource=function(g){this.stopLoad();var c=this.media,u=this.url,a=this.url=Y.buildAbsoluteURL(self.location.href,g,{alwaysNormalize:!0});L.logger.log("loadSource:"+a),c&&u&&u!==a&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(c)),this.trigger(o.Events.MANIFEST_LOADING,{url:g})},D.startLoad=function(g){g===void 0&&(g=-1),L.logger.log("startLoad("+g+")"),this.networkControllers.forEach(function(c){c.startLoad(g)})},D.stopLoad=function(){L.logger.log("stopLoad"),this.networkControllers.forEach(function(g){g.stopLoad()})},D.swapAudioCodec=function(){L.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},D.recoverMediaError=function(){L.logger.log("recoverMediaError");var g=this._media;this.detachMedia(),g&&this.attachMedia(g)},D.removeLevel=function(g,c){c===void 0&&(c=0),this.levelController.removeLevel(g,c)},T(p,[{key:"levels",get:function(){var g=this.levelController.levels;return g||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(g){L.logger.log("set currentLevel:"+g),this.loadLevel=g,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(g){L.logger.log("set nextLevel:"+g),this.levelController.manualLevel=g,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(g){L.logger.log("set loadLevel:"+g),this.levelController.manualLevel=g}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(g){this.levelController.nextLoadLevel=g}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(g){L.logger.log("set firstLevel:"+g),this.levelController.firstLevel=g}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(g){L.logger.log("set startLevel:"+g),g!==-1&&(g=Math.max(g,this.minAutoLevel)),this.levelController.startLevel=g}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(g){var c=!!g;c!==this.config.capLevelToPlayerSize&&(c?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=c)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(g){this._autoLevelCapping!==g&&(L.logger.log("set autoLevelCapping:"+g),this._autoLevelCapping=g)}},{key:"bandwidthEstimate",get:function(){var g=this.abrController.bwEstimator;return g?g.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var g=this.levels,c=this.config.minAutoBitrate;if(!g)return 0;for(var u=g.length,a=0;a<u;a++)if(g[a].maxBitrate>c)return a;return 0}},{key:"maxAutoLevel",get:function(){var g=this.levels,c=this.autoLevelCapping,u;return c===-1&&g&&g.length?u=g.length-1:u=c,u}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(g){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,g)}},{key:"audioTracks",get:function(){var g=this.audioTrackController;return g?g.audioTracks:[]}},{key:"audioTrack",get:function(){var g=this.audioTrackController;return g?g.audioTrack:-1},set:function(g){var c=this.audioTrackController;c&&(c.audioTrack=g)}},{key:"subtitleTracks",get:function(){var g=this.subtitleTrackController;return g?g.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var g=this.subtitleTrackController;return g?g.subtitleTrack:-1},set:function(g){var c=this.subtitleTrackController;c&&(c.subtitleTrack=g)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var g=this.subtitleTrackController;return g?g.subtitleDisplay:!1},set:function(g){var c=this.subtitleTrackController;c&&(c.subtitleDisplay=g)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(g){this.config.lowLatencyMode=g}},{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 o.Events}},{key:"ErrorTypes",get:function(){return l.ErrorTypes}},{key:"ErrorDetails",get:function(){return l.ErrorDetails}},{key:"DefaultConfig",get:function(){return p.defaultConfig?p.defaultConfig:A.hlsDefaultConfig},set:function(g){p.defaultConfig=g}}]),p}();f.defaultConfig=void 0},"./src/is-supported.ts":function(oe,Z,k){"use strict";k.r(Z),k.d(Z,"isSupported",function(){return I}),k.d(Z,"changeTypeSupported",function(){return H});var Y=k("./src/utils/mediasource-helper.ts");function P(){return self.SourceBuffer||self.WebKitSourceBuffer}function I(){var U=Object(Y.getMediaSource)();if(!U)return!1;var O=P(),R=U&&typeof U.isTypeSupported=="function"&&U.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),y=!O||O.prototype&&typeof O.prototype.appendBuffer=="function"&&typeof O.prototype.remove=="function";return!!R&&!!y}function H(){var U,O=P();return typeof(O==null||((U=O.prototype)===null||U===void 0)?void 0:U.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(oe,Z,k){"use strict";k.r(Z),k.d(Z,"default",function(){return L}),k.d(Z,"LoadError",function(){return C});var Y=k("./src/polyfills/number.ts"),P=k("./src/errors.ts");function I(d,o){d.prototype=Object.create(o.prototype),d.prototype.constructor=d,y(d,o)}function H(d){var o=typeof Map=="function"?new Map:void 0;return H=function(h){if(h===null||!R(h))return h;if(typeof h!="function")throw new TypeError("Super expression must either be null or a function");if(typeof o!="undefined"){if(o.has(h))return o.get(h);o.set(h,T)}function T(){return U(h,arguments,w(this).constructor)}return T.prototype=Object.create(h.prototype,{constructor:{value:T,enumerable:!1,writable:!0,configurable:!0}}),y(T,h)},H(d)}function U(d,o,l){return O()?U=Reflect.construct:U=function(T,f,p){var D=[null];D.push.apply(D,f);var E=Function.bind.apply(T,D),g=new E;return p&&y(g,p.prototype),g},U.apply(null,arguments)}function O(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(d){return!1}}function R(d){return Function.toString.call(d).indexOf("[native code]")!==-1}function y(d,o){return y=Object.setPrototypeOf||function(h,T){return h.__proto__=T,h},y(d,o)}function w(d){return w=Object.setPrototypeOf?Object.getPrototypeOf:function(l){return l.__proto__||Object.getPrototypeOf(l)},w(d)}var _=Math.pow(2,17),L=function(){function d(l){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=l}var o=d.prototype;return o.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},o.abort=function(){this.loader&&this.loader.abort()},o.load=function(h,T){var f=this,p=h.url;if(!p)return Promise.reject(new C({type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:h,networkDetails:null},"Fragment does not have a "+(p?"part list":"url")));this.abort();var D=this.config,E=D.fLoader,g=D.loader;return new Promise(function(c,u){f.loader&&f.loader.destroy();var a=f.loader=h.loader=E?new E(D):new g(D),x=A(h),b={timeout:D.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:D.fragLoadingMaxRetryTimeout,highWaterMark:_};h.stats=a.stats,a.load(x,b,{onSuccess:function(M,G,X,Q){f.resetLoader(h,a),c({frag:h,part:null,payload:M.data,networkDetails:Q})},onError:function(M,G,X){f.resetLoader(h,a),u(new C({type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:h,response:M,networkDetails:X}))},onAbort:function(M,G,X){f.resetLoader(h,a),u(new C({type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:h,networkDetails:X}))},onTimeout:function(M,G,X){f.resetLoader(h,a),u(new C({type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:h,networkDetails:X}))},onProgress:function(M,G,X,Q){T&&T({frag:h,part:null,payload:X,networkDetails:Q})}})})},o.loadPart=function(h,T,f){var p=this;this.abort();var D=this.config,E=D.fLoader,g=D.loader;return new Promise(function(c,u){p.loader&&p.loader.destroy();var a=p.loader=h.loader=E?new E(D):new g(D),x=A(h,T),b={timeout:D.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:D.fragLoadingMaxRetryTimeout,highWaterMark:_};T.stats=a.stats,a.load(x,b,{onSuccess:function(M,G,X,Q){p.resetLoader(h,a),p.updateStatsFromPart(h,T);var z={frag:h,part:T,payload:M.data,networkDetails:Q};f(z),c(z)},onError:function(M,G,X){p.resetLoader(h,a),u(new C({type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:h,part:T,response:M,networkDetails:X}))},onAbort:function(M,G,X){h.stats.aborted=T.stats.aborted,p.resetLoader(h,a),u(new C({type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:h,part:T,networkDetails:X}))},onTimeout:function(M,G,X){p.resetLoader(h,a),u(new C({type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:h,part:T,networkDetails:X}))}})})},o.updateStatsFromPart=function(h,T){var f=h.stats,p=T.stats,D=p.total;if(f.loaded+=p.loaded,D){var E=Math.round(h.duration/T.duration),g=Math.min(Math.round(f.loaded/D),E),c=E-g,u=c*Math.round(f.loaded/g);f.total=f.loaded+u}else f.total=Math.max(f.loaded,f.total);var a=f.loading,x=p.loading;a.start?a.first+=x.first-x.start:(a.start=x.start,a.first=x.first),a.end=x.end},o.resetLoader=function(h,T){h.loader=null,this.loader===T&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),T.destroy()},d}();function A(d,o){o===void 0&&(o=null);var l=o||d,h={frag:d,part:o,responseType:"arraybuffer",url:l.url,headers:{},rangeStart:0,rangeEnd:0},T=l.byteRangeStartOffset,f=l.byteRangeEndOffset;return Object(Y.isFiniteNumber)(T)&&Object(Y.isFiniteNumber)(f)&&(h.rangeStart=T,h.rangeEnd=f),h}var C=function(d){I(o,d);function o(l){for(var h,T=arguments.length,f=new Array(T>1?T-1:0),p=1;p<T;p++)f[p-1]=arguments[p];return h=d.call.apply(d,[this].concat(f))||this,h.data=void 0,h.data=l,h}return o}(H(Error))},"./src/loader/fragment.ts":function(oe,Z,k){"use strict";k.r(Z),k.d(Z,"ElementaryStreamTypes",function(){return L}),k.d(Z,"BaseSegment",function(){return A}),k.d(Z,"Fragment",function(){return C}),k.d(Z,"Part",function(){return d});var Y=k("./src/polyfills/number.ts"),P=k("./node_modules/url-toolkit/src/url-toolkit.js"),I=k.n(P),H=k("./src/utils/logger.ts"),U=k("./src/loader/level-key.ts"),O=k("./src/loader/load-stats.ts");function R(o,l){o.prototype=Object.create(l.prototype),o.prototype.constructor=o,y(o,l)}function y(o,l){return y=Object.setPrototypeOf||function(T,f){return T.__proto__=f,T},y(o,l)}function w(o,l){for(var h=0;h<l.length;h++){var T=l[h];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(o,T.key,T)}}function _(o,l,h){return l&&w(o.prototype,l),h&&w(o,h),o}var L;(function(o){o.AUDIO="audio",o.VIDEO="video",o.AUDIOVIDEO="audiovideo"})(L||(L={}));var A=function(){function o(h){var T;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(T={},T[L.AUDIO]=null,T[L.VIDEO]=null,T[L.AUDIOVIDEO]=null,T),this.baseurl=h}var l=o.prototype;return l.setByteRange=function(T,f){var p=T.split("@",2),D=[];p.length===1?D[0]=f?f.byteRangeEndOffset:0:D[0]=parseInt(p[1]),D[1]=parseInt(p[0])+D[0],this._byteRange=D},_(o,[{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(P.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(T){this._url=T}}]),o}(),C=function(o){R(l,o);function l(T,f){var p;return p=o.call(this,f)||this,p._decryptdata=null,p.rawProgramDateTime=null,p.programDateTime=null,p.tagList=[],p.duration=0,p.sn=0,p.levelkey=void 0,p.type=void 0,p.loader=null,p.level=-1,p.cc=0,p.startPTS=void 0,p.endPTS=void 0,p.appendedPTS=void 0,p.startDTS=void 0,p.endDTS=void 0,p.start=0,p.deltaPTS=void 0,p.maxStartPTS=void 0,p.minEndPTS=void 0,p.stats=new O.LoadStats,p.urlId=0,p.data=void 0,p.bitrateTest=!1,p.title=null,p.initSegment=null,p.type=T,p}var h=l.prototype;return h.createInitializationVector=function(f){for(var p=new Uint8Array(16),D=12;D<16;D++)p[D]=f>>8*(15-D)&255;return p},h.setDecryptDataFromLevelKey=function(f,p){var D=f;return(f==null?void 0:f.method)==="AES-128"&&f.uri&&!f.iv&&(D=U.LevelKey.fromURI(f.uri),D.method=f.method,D.iv=this.createInitializationVector(p),D.keyFormat="identity"),D},h.setElementaryStreamInfo=function(f,p,D,E,g,c){c===void 0&&(c=!1);var u=this.elementaryStreams,a=u[f];if(!a){u[f]={startPTS:p,endPTS:D,startDTS:E,endDTS:g,partial:c};return}a.startPTS=Math.min(a.startPTS,p),a.endPTS=Math.max(a.endPTS,D),a.startDTS=Math.min(a.startDTS,E),a.endDTS=Math.max(a.endDTS,g)},h.clearElementaryStreamInfo=function(){var f=this.elementaryStreams;f[L.AUDIO]=null,f[L.VIDEO]=null,f[L.AUDIOVIDEO]=null},_(l,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var f=this.sn;typeof f!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&H.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),f=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,f)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(Y.isFiniteNumber)(this.programDateTime))return null;var f=Object(Y.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+f*1e3}},{key:"encrypted",get:function(){var f;return!!((f=this.decryptdata)!==null&&f!==void 0&&f.keyFormat&&this.decryptdata.uri)}}]),l}(A),d=function(o){R(l,o);function l(h,T,f,p,D){var E;E=o.call(this,f)||this,E.fragOffset=0,E.duration=0,E.gap=!1,E.independent=!1,E.relurl=void 0,E.fragment=void 0,E.index=void 0,E.stats=new O.LoadStats,E.duration=h.decimalFloatingPoint("DURATION"),E.gap=h.bool("GAP"),E.independent=h.bool("INDEPENDENT"),E.relurl=h.enumeratedString("URI"),E.fragment=T,E.index=p;var g=h.enumeratedString("BYTERANGE");return g&&E.setByteRange(g,D),D&&(E.fragOffset=D.fragOffset+D.duration),E}return _(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 T=this.elementaryStreams;return!!(T.audio||T.video||T.audiovideo)}}]),l}(A)},"./src/loader/key-loader.ts":function(oe,Z,k){"use strict";k.r(Z),k.d(Z,"default",function(){return H});var Y=k("./src/events.ts"),P=k("./src/errors.ts"),I=k("./src/utils/logger.ts"),H=function(){function U(R){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=R,this._registerListeners()}var O=U.prototype;return O._registerListeners=function(){this.hls.on(Y.Events.KEY_LOADING,this.onKeyLoading,this)},O._unregisterListeners=function(){this.hls.off(Y.Events.KEY_LOADING,this.onKeyLoading)},O.destroy=function(){this._unregisterListeners();for(var y in this.loaders){var w=this.loaders[y];w&&w.destroy()}this.loaders={}},O.onKeyLoading=function(y,w){var _=w.frag,L=_.type,A=this.loaders[L];if(!_.decryptdata){I.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var C=_.decryptdata.uri;if(C!==this.decrypturl||this.decryptkey===null){var d=this.hls.config;if(A&&(I.logger.warn("abort previous key loader for type:"+L),A.abort()),!C){I.logger.warn("key uri is falsy");return}var o=d.loader,l=_.loader=this.loaders[L]=new o(d);this.decrypturl=C,this.decryptkey=null;var h={url:C,frag:_,responseType:"arraybuffer"},T={timeout:d.fragLoadingTimeOut,maxRetry:0,retryDelay:d.fragLoadingRetryDelay,maxRetryDelay:d.fragLoadingMaxRetryTimeout,highWaterMark:0},f={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};l.load(h,T,f)}else this.decryptkey&&(_.decryptdata.key=this.decryptkey,this.hls.trigger(Y.Events.KEY_LOADED,{frag:_}))},O.loadsuccess=function(y,w,_){var L=_.frag;if(!L.decryptdata){I.logger.error("after key load, decryptdata unset");return}this.decryptkey=L.decryptdata.key=new Uint8Array(y.data),L.loader=null,delete this.loaders[L.type],this.hls.trigger(Y.Events.KEY_LOADED,{frag:L})},O.loaderror=function(y,w){var _=w.frag,L=_.loader;L&&L.abort(),delete this.loaders[_.type],this.hls.trigger(Y.Events.ERROR,{type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:_,response:y})},O.loadtimeout=function(y,w){var _=w.frag,L=_.loader;L&&L.abort(),delete this.loaders[_.type],this.hls.trigger(Y.Events.ERROR,{type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:_})},U}()},"./src/loader/level-details.ts":function(oe,Z,k){"use strict";k.r(Z),k.d(Z,"LevelDetails",function(){return U});var Y=k("./src/polyfills/number.ts");function P(O,R){for(var y=0;y<R.length;y++){var w=R[y];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(O,w.key,w)}}function I(O,R,y){return R&&P(O.prototype,R),y&&P(O,y),O}var H=10,U=function(){function O(y){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=y}var R=O.prototype;return R.reloaded=function(w){if(!w){this.advanced=!0,this.updated=!0;return}var _=this.lastPartSn-w.lastPartSn,L=this.lastPartIndex-w.lastPartIndex;this.updated=this.endSN!==w.endSN||!!L||!!_,this.advanced=this.endSN>w.endSN||_>0||_===0&&L>0,this.updated||this.advanced?this.misses=Math.floor(w.misses*.6):this.misses=w.misses+1,this.availabilityDelay=w.availabilityDelay},I(O,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(Y.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||H}},{key:"drift",get:function(){var w=this.driftEndTime-this.driftStartTime;if(w>0){var _=this.driftEnd-this.driftStart;return _*1e3/w}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var w;return(w=this.partList)!==null&&w!==void 0&&w.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var w;return(w=this.fragments)!==null&&w!==void 0&&w.length?this.fragments[this.fragments.length-1].end:0}},{key:"age",get:function(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}},{key:"lastPartIndex",get:function(){var w;return(w=this.partList)!==null&&w!==void 0&&w.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var w;return(w=this.partList)!==null&&w!==void 0&&w.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),O}()},"./src/loader/level-key.ts":function(oe,Z,k){"use strict";k.r(Z),k.d(Z,"LevelKey",function(){return U});var Y=k("./node_modules/url-toolkit/src/url-toolkit.js"),P=k.n(Y);function I(O,R){for(var y=0;y<R.length;y++){var w=R[y];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(O,w.key,w)}}function H(O,R,y){return R&&I(O.prototype,R),y&&I(O,y),O}var U=function(){O.fromURL=function(y,w){return new O(y,w)},O.fromURI=function(y){return new O(y)};function O(R,y){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,y?this._uri=Object(Y.buildAbsoluteURL)(R,y,{alwaysNormalize:!0}):this._uri=R}return H(O,[{key:"uri",get:function(){return this._uri}}]),O}()},"./src/loader/load-stats.ts":function(oe,Z,k){"use strict";k.r(Z),k.d(Z,"LoadStats",function(){return Y});var Y=function(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}},"./src/loader/m3u8-parser.ts":function(oe,Z,k){"use strict";k.r(Z),k.d(Z,"default",function(){return l});var Y=k("./src/polyfills/number.ts"),P=k("./node_modules/url-toolkit/src/url-toolkit.js"),I=k.n(P),H=k("./src/loader/fragment.ts"),U=k("./src/loader/level-details.ts"),O=k("./src/loader/level-key.ts"),R=k("./src/utils/attr-list.ts"),y=k("./src/utils/logger.ts"),w=k("./src/utils/codecs.ts"),_=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,L=/#EXT-X-MEDIA:(.*)/g,A=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),C=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("|")),d=/\.(mp4|m4s|m4v|m4a)$/i;function o(D){var E,g;return d.test((E=(g=P.parseURL(D))===null||g===void 0?void 0:g.path)!=null?E:"")}var l=function(){function D(){}return D.findGroup=function(g,c){for(var u=0;u<g.length;u++){var a=g[u];if(a.id===c)return a}},D.convertAVC1ToAVCOTI=function(g){var c=g.split(".");if(c.length>2){var u=c.shift()+".";return u+=parseInt(c.shift()).toString(16),u+=("000"+parseInt(c.shift()).toString(16)).substr(-4),u}return g},D.resolve=function(g,c){return P.buildAbsoluteURL(c,g,{alwaysNormalize:!0})},D.parseMasterPlaylist=function(g,c){var u=[],a={},x=!1;_.lastIndex=0;for(var b;(b=_.exec(g))!=null;)if(b[1]){var v=new R.AttrList(b[1]),M={attrs:v,bitrate:v.decimalInteger("AVERAGE-BANDWIDTH")||v.decimalInteger("BANDWIDTH"),name:v.NAME,url:D.resolve(b[2],c)},G=v.decimalResolution("RESOLUTION");G&&(M.width=G.width,M.height=G.height),h((v.CODECS||"").split(/[ ,]+/).filter(function(Q){return Q}),M),M.videoCodec&&M.videoCodec.indexOf("avc1")!==-1&&(M.videoCodec=D.convertAVC1ToAVCOTI(M.videoCodec)),u.push(M)}else if(b[3]){var X=new R.AttrList(b[3]);X["DATA-ID"]&&(x=!0,a[X["DATA-ID"]]=X)}return{levels:u,sessionData:x?a:null}},D.parseMasterPlaylistMedia=function(g,c,u,a){a===void 0&&(a=[]);var x,b=[],v=0;for(L.lastIndex=0;(x=L.exec(g))!==null;){var M=new R.AttrList(x[1]);if(M.TYPE===u){var G={attrs:M,bitrate:0,id:v++,groupId:M["GROUP-ID"],instreamId:M["INSTREAM-ID"],name:M.NAME||M.LANGUAGE||"",type:u,default:M.bool("DEFAULT"),autoselect:M.bool("AUTOSELECT"),forced:M.bool("FORCED"),lang:M.LANGUAGE,url:M.URI?D.resolve(M.URI,c):""};if(a.length){var X=D.findGroup(a,G.groupId)||a[0];T(G,X,"audioCodec"),T(G,X,"textCodec")}b.push(G)}}return b},D.parseLevelPlaylist=function(g,c,u,a,x){var b=new U.LevelDetails(c),v=b.fragments,M=null,G=0,X=0,Q=0,z=0,j=null,q=new H.Fragment(a,c),le,me,be,Be=-1,Le=!1;for(A.lastIndex=0,b.m3u8=g;(le=A.exec(g))!==null;){Le&&(Le=!1,q=new H.Fragment(a,c),q.start=Q,q.sn=G,q.cc=z,q.level=u,M&&(q.initSegment=M,q.rawProgramDateTime=M.rawProgramDateTime));var De=le[1];if(De){q.duration=parseFloat(De);var de=(" "+le[2]).slice(1);q.title=de||null,q.tagList.push(de?["INF",De,de]:["INF",De])}else if(le[3])Object(Y.isFiniteNumber)(q.duration)&&(q.start=Q,be&&(q.levelkey=be),q.sn=G,q.level=u,q.cc=z,q.urlId=x,v.push(q),q.relurl=(" "+le[3]).slice(1),p(q,j),j=q,Q+=q.duration,G++,X=0,Le=!0);else if(le[4]){var pe=(" "+le[4]).slice(1);j?q.setByteRange(pe,j):q.setByteRange(pe)}else if(le[5])q.rawProgramDateTime=(" "+le[5]).slice(1),q.tagList.push(["PROGRAM-DATE-TIME",q.rawProgramDateTime]),Be===-1&&(Be=v.length);else{if(le=le[0].match(C),!le){y.logger.warn("No matches on slow regex match for level playlist!");continue}for(me=1;me<le.length&&!(typeof le[me]!="undefined");me++);var ae=(" "+le[me]).slice(1),re=(" "+le[me+1]).slice(1),we=le[me+2]?(" "+le[me+2]).slice(1):"";switch(ae){case"PLAYLIST-TYPE":b.type=re.toUpperCase();break;case"MEDIA-SEQUENCE":G=b.startSN=parseInt(re);break;case"SKIP":{var ve=new R.AttrList(re),Re=ve.decimalInteger("SKIPPED-SEGMENTS");if(Object(Y.isFiniteNumber)(Re)){b.skippedSegments=Re;for(var Ae=Re;Ae--;)v.unshift(null);G+=Re}var Oe=ve.enumeratedString("RECENTLY-REMOVED-DATERANGES");Oe&&(b.recentlyRemovedDateranges=Oe.split(" "));break}case"TARGETDURATION":b.targetduration=parseFloat(re);break;case"VERSION":b.version=parseInt(re);break;case"EXTM3U":break;case"ENDLIST":b.live=!1;break;case"#":(re||we)&&q.tagList.push(we?[re,we]:[re]);break;case"DIS":z++;case"GAP":q.tagList.push([ae]);break;case"BITRATE":q.tagList.push([ae,re]);break;case"DISCONTINUITY-SEQ":z=parseInt(re);break;case"KEY":{var Ee,_e=new R.AttrList(re),Ie=_e.enumeratedString("METHOD"),Ve=_e.URI,Ue=_e.hexadecimalInteger("IV"),Fe=_e.enumeratedString("KEYFORMATVERSIONS"),Pe=_e.enumeratedString("KEYID"),et=(Ee=_e.enumeratedString("KEYFORMAT"))!=null?Ee:"identity",Je=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(Je.indexOf(et)>-1){y.logger.warn("Keyformat "+et+" is not supported from the manifest");continue}else if(et!=="identity")continue;Ie&&(be=O.LevelKey.fromURL(c,Ve),Ve&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(Ie)>=0&&(be.method=Ie,be.keyFormat=et,Pe&&(be.keyID=Pe),Fe&&(be.keyFormatVersions=Fe),be.iv=Ue));break}case"START":{var Qe=new R.AttrList(re),$e=Qe.decimalFloatingPoint("TIME-OFFSET");Object(Y.isFiniteNumber)($e)&&(b.startTimeOffset=$e);break}case"MAP":{var ht=new R.AttrList(re);q.relurl=ht.URI,ht.BYTERANGE&&q.setByteRange(ht.BYTERANGE),q.level=u,q.sn="initSegment",be&&(q.levelkey=be),q.initSegment=null,M=q,Le=!0;break}case"SERVER-CONTROL":{var Xe=new R.AttrList(re);b.canBlockReload=Xe.bool("CAN-BLOCK-RELOAD"),b.canSkipUntil=Xe.optionalFloat("CAN-SKIP-UNTIL",0),b.canSkipDateRanges=b.canSkipUntil>0&&Xe.bool("CAN-SKIP-DATERANGES"),b.partHoldBack=Xe.optionalFloat("PART-HOLD-BACK",0),b.holdBack=Xe.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var Ze=new R.AttrList(re);b.partTarget=Ze.decimalFloatingPoint("PART-TARGET");break}case"PART":{var ke=b.partList;ke||(ke=b.partList=[]);var at=X>0?ke[ke.length-1]:void 0,it=X++,Me=new H.Part(new R.AttrList(re),q,c,it,at);ke.push(Me),q.duration+=Me.duration;break}case"PRELOAD-HINT":{var Ge=new R.AttrList(re);b.preloadHint=Ge;break}case"RENDITION-REPORT":{var ye=new R.AttrList(re);b.renditionReports=b.renditionReports||[],b.renditionReports.push(ye);break}default:y.logger.warn("line parsed but not handled: "+le);break}}}j&&!j.relurl?(v.pop(),Q-=j.duration,b.partList&&(b.fragmentHint=j)):b.partList&&(p(q,j),q.cc=z,b.fragmentHint=q);var ce=v.length,ge=v[0],ee=v[ce-1];if(Q+=b.skippedSegments*b.targetduration,Q>0&&ce&&ee){b.averagetargetduration=Q/ce;var te=ee.sn;b.endSN=te!=="initSegment"?te:0,ge&&(b.startCC=ge.cc,ge.initSegment||b.fragments.every(function(ie){return ie.relurl&&o(ie.relurl)})&&(y.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),q=new H.Fragment(a,c),q.relurl=ee.relurl,q.level=u,q.sn="initSegment",ge.initSegment=q,b.needSidxRanges=!0))}else b.endSN=0,b.startCC=0;return b.fragmentHint&&(Q+=b.fragmentHint.duration),b.totalduration=Q,b.endCC=z,Be>0&&f(v,Be),b},D}();function h(D,E){["video","audio","text"].forEach(function(g){var c=D.filter(function(a){return Object(w.isCodecType)(a,g)});if(c.length){var u=c.filter(function(a){return a.lastIndexOf("avc1",0)===0||a.lastIndexOf("mp4a",0)===0});E[g+"Codec"]=u.length>0?u[0]:c[0],D=D.filter(function(a){return c.indexOf(a)===-1})}}),E.unknownCodecs=D}function T(D,E,g){var c=E[g];c&&(D[g]=c)}function f(D,E){for(var g=D[E],c=E;c--;){var u=D[c];if(!u)return;u.programDateTime=g.programDateTime-u.duration*1e3,g=u}}function p(D,E){D.rawProgramDateTime?D.programDateTime=Date.parse(D.rawProgramDateTime):E!=null&&E.programDateTime&&(D.programDateTime=E.endProgramDateTime),Object(Y.isFiniteNumber)(D.programDateTime)||(D.programDateTime=null,D.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(oe,Z,k){"use strict";k.r(Z);var Y=k("./src/polyfills/number.ts"),P=k("./src/events.ts"),I=k("./src/errors.ts"),H=k("./src/utils/logger.ts"),U=k("./src/utils/mp4-tools.ts"),O=k("./src/loader/m3u8-parser.ts"),R=k("./src/types/loader.ts"),y=k("./src/utils/attr-list.ts");function w(A){var C=A.type;switch(C){case R.PlaylistContextType.AUDIO_TRACK:return R.PlaylistLevelType.AUDIO;case R.PlaylistContextType.SUBTITLE_TRACK:return R.PlaylistLevelType.SUBTITLE;default:return R.PlaylistLevelType.MAIN}}function _(A,C){var d=A.url;return(d===void 0||d.indexOf("data:")===0)&&(d=C.url),d}var L=function(){function A(d){this.hls=void 0,this.loaders=Object.create(null),this.hls=d,this.registerListeners()}var C=A.prototype;return C.registerListeners=function(){var o=this.hls;o.on(P.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(P.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(P.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.on(P.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},C.unregisterListeners=function(){var o=this.hls;o.off(P.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(P.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(P.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.off(P.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},C.createInternalLoader=function(o){var l=this.hls.config,h=l.pLoader,T=l.loader,f=h||T,p=new f(l);return o.loader=p,this.loaders[o.type]=p,p},C.getInternalLoader=function(o){return this.loaders[o.type]},C.resetInternalLoader=function(o){this.loaders[o]&&delete this.loaders[o]},C.destroyInternalLoaders=function(){for(var o in this.loaders){var l=this.loaders[o];l&&l.destroy(),this.resetInternalLoader(o)}},C.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},C.onManifestLoading=function(o,l){var h=l.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:R.PlaylistContextType.MANIFEST,url:h,deliveryDirectives:null})},C.onLevelLoading=function(o,l){var h=l.id,T=l.level,f=l.url,p=l.deliveryDirectives;this.load({id:h,groupId:null,level:T,responseType:"text",type:R.PlaylistContextType.LEVEL,url:f,deliveryDirectives:p})},C.onAudioTrackLoading=function(o,l){var h=l.id,T=l.groupId,f=l.url,p=l.deliveryDirectives;this.load({id:h,groupId:T,level:null,responseType:"text",type:R.PlaylistContextType.AUDIO_TRACK,url:f,deliveryDirectives:p})},C.onSubtitleTrackLoading=function(o,l){var h=l.id,T=l.groupId,f=l.url,p=l.deliveryDirectives;this.load({id:h,groupId:T,level:null,responseType:"text",type:R.PlaylistContextType.SUBTITLE_TRACK,url:f,deliveryDirectives:p})},C.load=function(o){var l,h=this.hls.config,T=this.getInternalLoader(o);if(T){var f=T.context;if(f&&f.url===o.url){H.logger.trace("[playlist-loader]: playlist request ongoing");return}H.logger.log("[playlist-loader]: aborting previous loader for type: "+o.type),T.abort()}var p,D,E,g;switch(o.type){case R.PlaylistContextType.MANIFEST:p=h.manifestLoadingMaxRetry,D=h.manifestLoadingTimeOut,E=h.manifestLoadingRetryDelay,g=h.manifestLoadingMaxRetryTimeout;break;case R.PlaylistContextType.LEVEL:case R.PlaylistContextType.AUDIO_TRACK:case R.PlaylistContextType.SUBTITLE_TRACK:p=0,D=h.levelLoadingTimeOut;break;default:p=h.levelLoadingMaxRetry,D=h.levelLoadingTimeOut,E=h.levelLoadingRetryDelay,g=h.levelLoadingMaxRetryTimeout;break}if(T=this.createInternalLoader(o),(l=o.deliveryDirectives)!==null&&l!==void 0&&l.part){var c;if(o.type===R.PlaylistContextType.LEVEL&&o.level!==null?c=this.hls.levels[o.level].details:o.type===R.PlaylistContextType.AUDIO_TRACK&&o.id!==null?c=this.hls.audioTracks[o.id].details:o.type===R.PlaylistContextType.SUBTITLE_TRACK&&o.id!==null&&(c=this.hls.subtitleTracks[o.id].details),c){var u=c.partTarget,a=c.targetduration;u&&a&&(D=Math.min(Math.max(u*3,a*.8)*1e3,D))}}var x={timeout:D,maxRetry:p,retryDelay:E,maxRetryDelay:g,highWaterMark:0},b={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};T.load(o,x,b)},C.loadsuccess=function(o,l,h,T){if(T===void 0&&(T=null),h.isSidxRequest){this.handleSidxRequest(o,h),this.handlePlaylistLoaded(o,l,h,T);return}this.resetInternalLoader(h.type);var f=o.data;if(f.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(o,h,"no EXTM3U delimiter",T);return}l.parsing.start=performance.now(),f.indexOf("#EXTINF:")>0||f.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(o,l,h,T):this.handleMasterPlaylist(o,l,h,T)},C.loaderror=function(o,l,h){h===void 0&&(h=null),this.handleNetworkError(l,h,!1,o)},C.loadtimeout=function(o,l,h){h===void 0&&(h=null),this.handleNetworkError(l,h,!0)},C.handleMasterPlaylist=function(o,l,h,T){var f=this.hls,p=o.data,D=_(o,h),E=O.default.parseMasterPlaylist(p,D),g=E.levels,c=E.sessionData;if(!g.length){this.handleManifestParsingError(o,h,"no level found in manifest",T);return}var u=g.map(function(G){return{id:G.attrs.AUDIO,audioCodec:G.audioCodec}}),a=g.map(function(G){return{id:G.attrs.SUBTITLES,textCodec:G.textCodec}}),x=O.default.parseMasterPlaylistMedia(p,D,"AUDIO",u),b=O.default.parseMasterPlaylistMedia(p,D,"SUBTITLES",a),v=O.default.parseMasterPlaylistMedia(p,D,"CLOSED-CAPTIONS");if(x.length){var M=x.some(function(G){return!G.url});!M&&g[0].audioCodec&&!g[0].attrs.AUDIO&&(H.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),x.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new y.AttrList({}),bitrate:0,url:""}))}f.trigger(P.Events.MANIFEST_LOADED,{levels:g,audioTracks:x,subtitles:b,captions:v,url:D,stats:l,networkDetails:T,sessionData:c})},C.handleTrackOrLevelPlaylist=function(o,l,h,T){var f=this.hls,p=h.id,D=h.level,E=h.type,g=_(o,h),c=Object(Y.isFiniteNumber)(p)?p:0,u=Object(Y.isFiniteNumber)(D)?D:c,a=w(h),x=O.default.parseLevelPlaylist(o.data,g,u,a,c);if(!x.fragments.length){f.trigger(P.Events.ERROR,{type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:g,reason:"no fragments found in level",level:typeof h.level=="number"?h.level:void 0});return}if(E===R.PlaylistContextType.MANIFEST){var b={attrs:new y.AttrList({}),bitrate:0,details:x,name:"",url:g};f.trigger(P.Events.MANIFEST_LOADED,{levels:[b],audioTracks:[],url:g,stats:l,networkDetails:T,sessionData:null})}if(l.parsing.end=performance.now(),x.needSidxRanges){var v,M=(v=x.fragments[0].initSegment)===null||v===void 0?void 0:v.url;this.load({url:M,isSidxRequest:!0,type:E,level:D,levelDetails:x,id:p,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}h.levelDetails=x,this.handlePlaylistLoaded(o,l,h,T)},C.handleSidxRequest=function(o,l){var h=Object(U.parseSegmentIndex)(new Uint8Array(o.data));if(!h)return;var T=h.references,f=l.levelDetails;T.forEach(function(p,D){var E=p.info,g=f.fragments[D];g.byteRange.length===0&&g.setByteRange(String(1+E.end-E.start)+"@"+String(E.start)),g.initSegment&&g.initSegment.setByteRange(String(h.moovEndOffset)+"@0")})},C.handleManifestParsingError=function(o,l,h,T){this.hls.trigger(P.Events.ERROR,{type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:l.type===R.PlaylistContextType.MANIFEST,url:o.url,reason:h,response:o,context:l,networkDetails:T})},C.handleNetworkError=function(o,l,h,T){h===void 0&&(h=!1),H.logger.warn("[playlist-loader]: A network "+(h?"timeout":"error")+" occurred while loading "+o.type+" level: "+o.level+" id: "+o.id+' group-id: "'+o.groupId+'"');var f=I.ErrorDetails.UNKNOWN,p=!1,D=this.getInternalLoader(o);switch(o.type){case R.PlaylistContextType.MANIFEST:f=h?I.ErrorDetails.MANIFEST_LOAD_TIMEOUT:I.ErrorDetails.MANIFEST_LOAD_ERROR,p=!0;break;case R.PlaylistContextType.LEVEL:f=h?I.ErrorDetails.LEVEL_LOAD_TIMEOUT:I.ErrorDetails.LEVEL_LOAD_ERROR,p=!1;break;case R.PlaylistContextType.AUDIO_TRACK:f=h?I.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:I.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,p=!1;break;case R.PlaylistContextType.SUBTITLE_TRACK:f=h?I.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:I.ErrorDetails.SUBTITLE_LOAD_ERROR,p=!1;break}D&&this.resetInternalLoader(o.type);var E={type:I.ErrorTypes.NETWORK_ERROR,details:f,fatal:p,url:o.url,loader:D,context:o,networkDetails:l};T&&(E.response=T),this.hls.trigger(P.Events.ERROR,E)},C.handlePlaylistLoaded=function(o,l,h,T){var f=h.type,p=h.level,D=h.id,E=h.groupId,g=h.loader,c=h.levelDetails,u=h.deliveryDirectives;if(!(c!=null&&c.targetduration)){this.handleManifestParsingError(o,h,"invalid target duration",T);return}if(!g)return;c.live&&(g.getCacheAge&&(c.ageHeader=g.getCacheAge()||0),(!g.getCacheAge||isNaN(c.ageHeader))&&(c.ageHeader=0));switch(f){case R.PlaylistContextType.MANIFEST:case R.PlaylistContextType.LEVEL:this.hls.trigger(P.Events.LEVEL_LOADED,{details:c,level:p||0,id:D||0,stats:l,networkDetails:T,deliveryDirectives:u});break;case R.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(P.Events.AUDIO_TRACK_LOADED,{details:c,id:D||0,groupId:E||"",stats:l,networkDetails:T,deliveryDirectives:u});break;case R.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(P.Events.SUBTITLE_TRACK_LOADED,{details:c,id:D||0,groupId:E||"",stats:l,networkDetails:T,deliveryDirectives:u});break}},A}();Z.default=L},"./src/polyfills/number.ts":function(oe,Z,k){"use strict";k.r(Z),k.d(Z,"isFiniteNumber",function(){return Y}),k.d(Z,"MAX_SAFE_INTEGER",function(){return P});var Y=Number.isFinite||function(I){return typeof I=="number"&&isFinite(I)},P=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(oe,Z,k){"use strict";k.r(Z);var Y=function(){function P(){}return P.getSilentFrame=function(H,U){switch(H){case"mp4a.40.2":if(U===1)return new Uint8Array([0,200,0,128,35,128]);if(U===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(U===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(U===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(U===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(U===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(U===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(U===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(U===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},P}();Z.default=Y},"./src/remux/mp4-generator.ts":function(oe,Z,k){"use strict";k.r(Z);var Y=Math.pow(2,32)-1,P=function(){function I(){}return I.init=function(){I.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 U;for(U in I.types)I.types.hasOwnProperty(U)&&(I.types[U]=[U.charCodeAt(0),U.charCodeAt(1),U.charCodeAt(2),U.charCodeAt(3)]);var O=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),R=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);I.HDLR_TYPES={video:O,audio:R};var y=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),w=new Uint8Array([0,0,0,0,0,0,0,0]);I.STTS=I.STSC=I.STCO=w,I.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),I.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),I.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),I.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var _=new Uint8Array([105,115,111,109]),L=new Uint8Array([97,118,99,49]),A=new Uint8Array([0,0,0,1]);I.FTYP=I.box(I.types.ftyp,_,A,_,L),I.DINF=I.box(I.types.dinf,I.box(I.types.dref,y))},I.box=function(U){for(var O=8,R=arguments.length,y=new Array(R>1?R-1:0),w=1;w<R;w++)y[w-1]=arguments[w];for(var _=y.length,L=_;_--;)O+=y[_].byteLength;var A=new Uint8Array(O);for(A[0]=O>>24&255,A[1]=O>>16&255,A[2]=O>>8&255,A[3]=O&255,A.set(U,4),_=0,O=8;_<L;_++)A.set(y[_],O),O+=y[_].byteLength;return A},I.hdlr=function(U){return I.box(I.types.hdlr,I.HDLR_TYPES[U])},I.mdat=function(U){return I.box(I.types.mdat,U)},I.mdhd=function(U,O){O*=U;var R=Math.floor(O/(Y+1)),y=Math.floor(O%(Y+1));return I.box(I.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,U>>24&255,U>>16&255,U>>8&255,U&255,R>>24,R>>16&255,R>>8&255,R&255,y>>24,y>>16&255,y>>8&255,y&255,85,196,0,0]))},I.mdia=function(U){return I.box(I.types.mdia,I.mdhd(U.timescale,U.duration),I.hdlr(U.type),I.minf(U))},I.mfhd=function(U){return I.box(I.types.mfhd,new Uint8Array([0,0,0,0,U>>24,U>>16&255,U>>8&255,U&255]))},I.minf=function(U){return U.type==="audio"?I.box(I.types.minf,I.box(I.types.smhd,I.SMHD),I.DINF,I.stbl(U)):I.box(I.types.minf,I.box(I.types.vmhd,I.VMHD),I.DINF,I.stbl(U))},I.moof=function(U,O,R){return I.box(I.types.moof,I.mfhd(U),I.traf(R,O))},I.moov=function(U){for(var O=U.length,R=[];O--;)R[O]=I.trak(U[O]);return I.box.apply(null,[I.types.moov,I.mvhd(U[0].timescale,U[0].duration)].concat(R).concat(I.mvex(U)))},I.mvex=function(U){for(var O=U.length,R=[];O--;)R[O]=I.trex(U[O]);return I.box.apply(null,[I.types.mvex].concat(R))},I.mvhd=function(U,O){O*=U;var R=Math.floor(O/(Y+1)),y=Math.floor(O%(Y+1)),w=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,U>>24&255,U>>16&255,U>>8&255,U&255,R>>24,R>>16&255,R>>8&255,R&255,y>>24,y>>16&255,y>>8&255,y&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 I.box(I.types.mvhd,w)},I.sdtp=function(U){var O=U.samples||[],R=new Uint8Array(4+O.length),y,w;for(y=0;y<O.length;y++)w=O[y].flags,R[y+4]=w.dependsOn<<4|w.isDependedOn<<2|w.hasRedundancy;return I.box(I.types.sdtp,R)},I.stbl=function(U){return I.box(I.types.stbl,I.stsd(U),I.box(I.types.stts,I.STTS),I.box(I.types.stsc,I.STSC),I.box(I.types.stsz,I.STSZ),I.box(I.types.stco,I.STCO))},I.avc1=function(U){var O=[],R=[],y,w,_;for(y=0;y<U.sps.length;y++)w=U.sps[y],_=w.byteLength,O.push(_>>>8&255),O.push(_&255),O=O.concat(Array.prototype.slice.call(w));for(y=0;y<U.pps.length;y++)w=U.pps[y],_=w.byteLength,R.push(_>>>8&255),R.push(_&255),R=R.concat(Array.prototype.slice.call(w));var L=I.box(I.types.avcC,new Uint8Array([1,O[3],O[4],O[5],252|3,224|U.sps.length].concat(O).concat([U.pps.length]).concat(R))),A=U.width,C=U.height,d=U.pixelRatio[0],o=U.pixelRatio[1];return I.box(I.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,A>>8&255,A&255,C>>8&255,C&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]),L,I.box(I.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),I.box(I.types.pasp,new Uint8Array([d>>24,d>>16&255,d>>8&255,d&255,o>>24,o>>16&255,o>>8&255,o&255])))},I.esds=function(U){var O=U.config.length;return new Uint8Array([0,0,0,0,3,23+O,0,1,0,4,15+O,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([O]).concat(U.config).concat([6,1,2]))},I.mp4a=function(U){var O=U.samplerate;return I.box(I.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,U.channelCount,0,16,0,0,0,0,O>>8&255,O&255,0,0]),I.box(I.types.esds,I.esds(U)))},I.mp3=function(U){var O=U.samplerate;return I.box(I.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,U.channelCount,0,16,0,0,0,0,O>>8&255,O&255,0,0]))},I.stsd=function(U){return U.type==="audio"?!U.isAAC&&U.codec==="mp3"?I.box(I.types.stsd,I.STSD,I.mp3(U)):I.box(I.types.stsd,I.STSD,I.mp4a(U)):I.box(I.types.stsd,I.STSD,I.avc1(U))},I.tkhd=function(U){var O=U.id,R=U.duration*U.timescale,y=U.width,w=U.height,_=Math.floor(R/(Y+1)),L=Math.floor(R%(Y+1));return I.box(I.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,O>>24&255,O>>16&255,O>>8&255,O&255,0,0,0,0,_>>24,_>>16&255,_>>8&255,_&255,L>>24,L>>16&255,L>>8&255,L&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,y>>8&255,y&255,0,0,w>>8&255,w&255,0,0]))},I.traf=function(U,O){var R=I.sdtp(U),y=U.id,w=Math.floor(O/(Y+1)),_=Math.floor(O%(Y+1));return I.box(I.types.traf,I.box(I.types.tfhd,new Uint8Array([0,0,0,0,y>>24,y>>16&255,y>>8&255,y&255])),I.box(I.types.tfdt,new Uint8Array([1,0,0,0,w>>24,w>>16&255,w>>8&255,w&255,_>>24,_>>16&255,_>>8&255,_&255])),I.trun(U,R.length+16+20+8+16+8+8),R)},I.trak=function(U){return U.duration=U.duration||4294967295,I.box(I.types.trak,I.tkhd(U),I.mdia(U))},I.trex=function(U){var O=U.id;return I.box(I.types.trex,new Uint8Array([0,0,0,0,O>>24,O>>16&255,O>>8&255,O&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},I.trun=function(U,O){var R=U.samples||[],y=R.length,w=12+16*y,_=new Uint8Array(w),L,A,C,d,o,l;for(O+=8+w,_.set([0,0,15,1,y>>>24&255,y>>>16&255,y>>>8&255,y&255,O>>>24&255,O>>>16&255,O>>>8&255,O&255],0),L=0;L<y;L++)A=R[L],C=A.duration,d=A.size,o=A.flags,l=A.cts,_.set([C>>>24&255,C>>>16&255,C>>>8&255,C&255,d>>>24&255,d>>>16&255,d>>>8&255,d&255,o.isLeading<<2|o.dependsOn,o.isDependedOn<<6|o.hasRedundancy<<4|o.paddingValue<<1|o.isNonSync,o.degradPrio&240<<8,o.degradPrio&15,l>>>24&255,l>>>16&255,l>>>8&255,l&255],12+16*L);return I.box(I.types.trun,_)},I.initSegment=function(U){I.types||I.init();var O=I.moov(U),R=new Uint8Array(I.FTYP.byteLength+O.byteLength);return R.set(I.FTYP),R.set(O,I.FTYP.byteLength),R},I}();P.types=void 0,P.HDLR_TYPES=void 0,P.STTS=void 0,P.STSC=void 0,P.STCO=void 0,P.STSZ=void 0,P.VMHD=void 0,P.SMHD=void 0,P.STSD=void 0,P.FTYP=void 0,P.DINF=void 0,Z.default=P},"./src/remux/mp4-remuxer.ts":function(oe,Z,k){"use strict";k.r(Z),k.d(Z,"default",function(){return l}),k.d(Z,"normalizePts",function(){return h});var Y=k("./src/polyfills/number.ts"),P=k("./src/remux/aac-helper.ts"),I=k("./src/remux/mp4-generator.ts"),H=k("./src/events.ts"),U=k("./src/errors.ts"),O=k("./src/utils/logger.ts"),R=k("./src/types/loader.ts"),y=k("./src/utils/timescale-conversion.ts");function w(){return w=Object.assign||function(D){for(var E=1;E<arguments.length;E++){var g=arguments[E];for(var c in g)Object.prototype.hasOwnProperty.call(g,c)&&(D[c]=g[c])}return D},w.apply(this,arguments)}var _=10*1e3,L=1024,A=1152,C=null,d=null,o=!1,l=function(){function D(g,c,u,a){if(a===void 0&&(a=""),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=void 0,this._initDTS=void 0,this.nextAvcDts=null,this.nextAudioPts=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=g,this.config=c,this.typeSupported=u,this.ISGenerated=!1,C===null){var x=navigator.userAgent||"",b=x.match(/Chrome\/(\d+)/i);C=b?parseInt(b[1]):0}if(d===null){var v=navigator.userAgent.match(/Safari\/(\d+)/i);d=v?parseInt(v[1]):0}o=!!C&&C<75||!!d&&d<600}var E=D.prototype;return E.destroy=function(){},E.resetTimeStamp=function(c){O.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=c},E.resetNextTimestamp=function(){O.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},E.resetInitSegment=function(){O.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},E.getVideoStartPts=function(c){var u=!1,a=c.reduce(function(x,b){var v=b.pts-x;return v<-4294967296?(u=!0,h(x,b.pts)):v>0?x:b.pts},c[0].pts);return u&&O.logger.debug("PTS rollover detected"),a},E.remux=function(c,u,a,x,b,v,M,G){var X,Q,z,j,q,le,me=b,be=b,Be=c.pid>-1,Le=u.pid>-1,De=u.samples.length,de=c.samples.length>0,pe=De>1,ae=(!Be||de)&&(!Le||pe)||this.ISGenerated||M;if(ae){this.ISGenerated||(z=this.generateIS(c,u,b));var re=this.isVideoContiguous,we=-1;if(pe&&(we=T(u.samples),!re&&this.config.forceKeyFrameOnDiscontinuity))if(le=!0,we>0){O.logger.warn("[mp4-remuxer]: Dropped "+we+" out of "+De+" video samples due to a missing keyframe");var ve=this.getVideoStartPts(u.samples);u.samples=u.samples.slice(we),u.dropped+=we,be+=(u.samples[0].pts-ve)/(u.timescale||9e4)}else we===-1&&(O.logger.warn("[mp4-remuxer]: No keyframe found out of "+De+" video samples"),le=!1);if(this.ISGenerated){if(de&&pe){var Re=this.getVideoStartPts(u.samples),Ae=h(c.samples[0].pts,Re)-Re,Oe=Ae/u.inputTimeScale;me+=Math.max(0,Oe),be+=Math.max(0,-Oe)}if(de){if(c.samplerate||(O.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),z=this.generateIS(c,u,b)),Q=this.remuxAudio(c,me,this.isAudioContiguous,v,Le||pe||G===R.PlaylistLevelType.AUDIO?be:void 0),pe){var Ee=Q?Q.endPTS-Q.startPTS:0;u.inputTimeScale||(O.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),z=this.generateIS(c,u,b)),X=this.remuxVideo(u,be,re,Ee)}}else pe&&(X=this.remuxVideo(u,be,re,0));X&&(X.firstKeyFrame=we,X.independent=we!==-1)}}return this.ISGenerated&&(a.samples.length&&(q=this.remuxID3(a,b)),x.samples.length&&(j=this.remuxText(x,b))),{audio:Q,video:X,initSegment:z,independent:le,text:j,id3:q}},E.generateIS=function(c,u,a){var x=c.samples,b=u.samples,v=this.typeSupported,M={},G=!Object(Y.isFiniteNumber)(this._initPTS),X="audio/mp4",Q,z,j;if(G&&(Q=z=Infinity),c.config&&x.length&&(c.timescale=c.samplerate,c.isAAC||(v.mpeg?(X="audio/mpeg",c.codec=""):v.mp3&&(c.codec="mp3")),M.audio={id:"audio",container:X,codec:c.codec,initSegment:!c.isAAC&&v.mpeg?new Uint8Array(0):I.default.initSegment([c]),metadata:{channelCount:c.channelCount}},G&&(j=c.inputTimeScale,Q=z=x[0].pts-Math.round(j*a))),u.sps&&u.pps&&b.length&&(u.timescale=u.inputTimeScale,M.video={id:"main",container:"video/mp4",codec:u.codec,initSegment:I.default.initSegment([u]),metadata:{width:u.width,height:u.height}},G)){j=u.inputTimeScale;var q=this.getVideoStartPts(b),le=Math.round(j*a);z=Math.min(z,h(b[0].dts,q)-le),Q=Math.min(Q,q-le)}if(Object.keys(M).length)return this.ISGenerated=!0,G&&(this._initPTS=Q,this._initDTS=z),{tracks:M,initPTS:Q,timescale:j}},E.remuxVideo=function(c,u,a,x){var b=c.inputTimeScale,v=c.samples,M=[],G=v.length,X=this._initPTS,Q=this.nextAvcDts,z=8,j,q,le,me=Number.POSITIVE_INFINITY,be=Number.NEGATIVE_INFINITY,Be=0,Le=!1;if(!a||Q===null){var De=u*b,de=v[0].pts-h(v[0].dts,v[0].pts);Q=De-de}for(var pe=0;pe<G;pe++){var ae=v[pe];if(ae.pts=h(ae.pts-X,Q),ae.dts=h(ae.dts-X,Q),ae.dts>ae.pts){var re=9e4*.2;Be=Math.max(Math.min(Be,ae.pts-ae.dts),-1*re)}ae.dts<v[pe>0?pe-1:pe].dts&&(Le=!0)}Le&&v.sort(function(wt,Et){var ct=wt.dts-Et.dts,zt=wt.pts-Et.pts;return ct||zt}),q=v[0].dts,le=v[v.length-1].dts;var we=Math.round((le-q)/(G-1));if(Be<0){if(Be<we*-2){O.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(y.toMsFromMpegTsClock)(-we,!0)+" ms");for(var ve=Be,Re=0;Re<G;Re++)v[Re].dts=ve=Math.max(ve,v[Re].pts-we),v[Re].pts=Math.max(ve,v[Re].pts)}else{O.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(y.toMsFromMpegTsClock)(Be,!0)+" ms to overcome this issue");for(var Ae=0;Ae<G;Ae++)v[Ae].dts=v[Ae].dts+Be}q=v[0].dts}if(a){var Oe=q-Q,Ee=Oe>we,_e=Oe<-1;if(Ee||_e){Ee?O.logger.warn("AVC: "+Object(y.toMsFromMpegTsClock)(Oe,!0)+" ms ("+Oe+"dts) hole between fragments detected, filling it"):O.logger.warn("AVC: "+Object(y.toMsFromMpegTsClock)(-Oe,!0)+" ms ("+Oe+"dts) overlapping between fragments detected"),q=Q;var Ie=v[0].pts-Oe;v[0].dts=q,v[0].pts=Ie,O.logger.log("Video: First PTS/DTS adjusted: "+Object(y.toMsFromMpegTsClock)(Ie,!0)+"/"+Object(y.toMsFromMpegTsClock)(q,!0)+", delta: "+Object(y.toMsFromMpegTsClock)(Oe,!0)+" ms")}}o&&(q=Math.max(0,q));for(var Ve=0,Ue=0,Fe=0;Fe<G;Fe++){for(var Pe=v[Fe],et=Pe.units,Je=et.length,Qe=0,$e=0;$e<Je;$e++)Qe+=et[$e].data.length;Ue+=Qe,Ve+=Je,Pe.length=Qe,Pe.dts=Math.max(Pe.dts,q),Pe.pts=Math.max(Pe.pts,Pe.dts,0),me=Math.min(Pe.pts,me),be=Math.max(Pe.pts,be)}le=v[G-1].dts;var ht=Ue+4*Ve+8,Xe;try{Xe=new Uint8Array(ht)}catch(wt){this.observer.emit(H.Events.ERROR,H.Events.ERROR,{type:U.ErrorTypes.MUX_ERROR,details:U.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:ht,reason:"fail allocating video mdat "+ht});return}var Ze=new DataView(Xe.buffer);Ze.setUint32(0,ht),Xe.set(I.default.types.mdat,4);for(var ke=0;ke<G;ke++){for(var at=v[ke],it=at.units,Me=0,Ge=0,ye=it.length;Ge<ye;Ge++){var ce=it[Ge],ge=ce.data,ee=ce.data.byteLength;Ze.setUint32(z,ee),z+=4,Xe.set(ge,z),z+=ee,Me+=4+ee}if(ke<G-1)j=v[ke+1].dts-at.dts;else{var te=this.config,ie=at.dts-v[ke>0?ke-1:ke].dts;if(te.stretchShortVideoTrack&&this.nextAudioPts!==null){var se=Math.floor(te.maxBufferHole*b),Ce=(x?me+x*b:this.nextAudioPts)-at.pts;Ce>se?(j=Ce-ie,j<0&&(j=ie),O.logger.log("[mp4-remuxer]: It is approximately "+Ce/90+" ms to the next segment; using duration "+j/90+" ms for the last video frame.")):j=ie}else j=ie}var xe=Math.round(at.pts-at.dts);M.push(new f(at.key,j,Me,xe))}if(M.length&&C&&C<70){var je=M[0].flags;je.dependsOn=2,je.isNonSync=0}console.assert(j!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=Q=le+j,this.isVideoContiguous=!0;var nt=I.default.moof(c.sequenceNumber++,q,w({},c,{samples:M})),ft="video",lt={data1:nt,data2:Xe,startPTS:me/b,endPTS:(be+j)/b,startDTS:q/b,endDTS:Q/b,type:ft,hasAudio:!1,hasVideo:!0,nb:M.length,dropped:c.dropped};return c.samples=[],c.dropped=0,console.assert(Xe.length,"MDAT length must not be zero"),lt},E.remuxAudio=function(c,u,a,x,b){var v=c.inputTimeScale,M=c.samplerate?c.samplerate:v,G=v/M,X=c.isAAC?L:A,Q=X*G,z=this._initPTS,j=!c.isAAC&&this.typeSupported.mpeg,q=[],le=c.samples,me=j?0:8,be=this.nextAudioPts||-1,Be=u*v;if(this.isAudioContiguous=a=a||le.length&&be>0&&(x&&Math.abs(Be-be)<9e3||Math.abs(h(le[0].pts-z,Be)-be)<20*Q),le.forEach(function(ge){ge.pts=h(ge.pts-z,Be)}),!a||be<0){if(le=le.filter(function(ge){return ge.pts>=0}),!le.length)return;b===0?be=0:x?be=Math.max(0,Be):be=le[0].pts}if(c.isAAC)for(var Le=b!==void 0,De=this.config.maxAudioFramesDrift,de=0,pe=be;de<le.length;de++){var ae=le[de],re=ae.pts,we=re-pe,ve=Math.abs(1e3*we/v);if(we<=-De*Q&&Le)de===0&&(O.logger.warn("Audio frame @ "+(re/v).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*we/v)+" ms."),this.nextAudioPts=be=pe=re);else if(we>=De*Q&&ve<_&&Le){var Re=Math.round(we/Q);pe=re-Re*Q,pe<0&&(Re--,pe+=Q),de===0&&(this.nextAudioPts=be=pe),O.logger.warn("[mp4-remuxer]: Injecting "+Re+" audio frame @ "+(pe/v).toFixed(3)+"s due to "+Math.round(1e3*we/v)+" ms gap.");for(var Ae=0;Ae<Re;Ae++){var Oe=Math.max(pe,0),Ee=P.default.getSilentFrame(c.manifestCodec||c.codec,c.channelCount);Ee||(O.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),Ee=ae.unit.subarray()),le.splice(de,0,{unit:Ee,pts:Oe}),pe+=Q,de++}}ae.pts=pe,pe+=Q}for(var _e=null,Ie=null,Ve,Ue=0,Fe=le.length;Fe--;)Ue+=le[Fe].unit.byteLength;for(var Pe=0,et=le.length;Pe<et;Pe++){var Je=le[Pe],Qe=Je.unit,$e=Je.pts;if(Ie!==null){var ht=q[Pe-1];ht.duration=Math.round(($e-Ie)/G)}else if(a&&c.isAAC&&($e=be),_e=$e,Ue>0){Ue+=me;try{Ve=new Uint8Array(Ue)}catch(ge){this.observer.emit(H.Events.ERROR,H.Events.ERROR,{type:U.ErrorTypes.MUX_ERROR,details:U.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Ue,reason:"fail allocating audio mdat "+Ue});return}if(!j){var Xe=new DataView(Ve.buffer);Xe.setUint32(0,Ue),Ve.set(I.default.types.mdat,4)}}else return;Ve.set(Qe,me);var Ze=Qe.byteLength;me+=Ze,q.push(new f(!0,X,Ze,0)),Ie=$e}var ke=q.length;if(!ke)return;var at=q[q.length-1];this.nextAudioPts=be=Ie+G*at.duration;var it=j?new Uint8Array(0):I.default.moof(c.sequenceNumber++,_e/G,w({},c,{samples:q}));c.samples=[];var Me=_e/v,Ge=be/v,ye="audio",ce={data1:it,data2:Ve,startPTS:Me,endPTS:Ge,startDTS:Me,endDTS:Ge,type:ye,hasAudio:!0,hasVideo:!1,nb:ke};return this.isAudioContiguous=!0,console.assert(Ve.length,"MDAT length must not be zero"),ce},E.remuxEmptyAudio=function(c,u,a,x){var b=c.inputTimeScale,v=c.samplerate?c.samplerate:b,M=b/v,G=this.nextAudioPts,X=(G!==null?G:x.startDTS*b)+this._initDTS,Q=x.endDTS*b+this._initDTS,z=M*L,j=Math.ceil((Q-X)/z),q=P.default.getSilentFrame(c.manifestCodec||c.codec,c.channelCount);if(O.logger.warn("[mp4-remuxer]: remux empty Audio"),!q){O.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var le=[],me=0;me<j;me++){var be=X+me*z;le.push({unit:q,pts:be,dts:be})}return c.samples=le,this.remuxAudio(c,u,a,!1)},E.remuxID3=function(c,u){var a=c.samples.length;if(!a)return;for(var x=c.inputTimeScale,b=this._initPTS,v=this._initDTS,M=0;M<a;M++){var G=c.samples[M];G.pts=h(G.pts-b,u*x)/x,G.dts=h(G.dts-v,u*x)/x}var X=c.samples;return c.samples=[],{samples:X}},E.remuxText=function(c,u){var a=c.samples.length;if(!a)return;for(var x=c.inputTimeScale,b=this._initPTS,v=0;v<a;v++){var M=c.samples[v];M.pts=h(M.pts-b,u*x)/x}c.samples.sort(function(X,Q){return X.pts-Q.pts});var G=c.samples;return c.samples=[],{samples:G}},D}();function h(D,E){var g;if(E===null)return D;for(E<D?g=-8589934592:g=8589934592;Math.abs(D-E)>4294967296;)D+=g;return D}function T(D){for(var E=0;E<D.length;E++)if(D[E].key)return E;return-1}var f=function(E,g,c,u){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=g,this.size=c,this.cts=u,this.flags=new p(E)},p=function(E){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=E?2:1,this.isNonSync=E?0:1}},"./src/remux/passthrough-remuxer.ts":function(oe,Z,k){"use strict";k.r(Z);var Y=k("./src/polyfills/number.ts"),P=k("./src/utils/mp4-tools.ts"),I=k("./src/loader/fragment.ts"),H=k("./src/utils/logger.ts"),U=function(){function y(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=void 0,this.initTracks=void 0,this.lastEndDTS=null}var w=y.prototype;return w.destroy=function(){},w.resetTimeStamp=function(L){this.initPTS=L,this.lastEndDTS=null},w.resetNextTimestamp=function(){this.lastEndDTS=null},w.resetInitSegment=function(L,A,C){this.audioCodec=A,this.videoCodec=C,this.generateInitSegment(L),this.emitInitSegment=!0},w.generateInitSegment=function(L){var A=this.audioCodec,C=this.videoCodec;if(!L||!L.byteLength){this.initTracks=void 0,this.initData=void 0;return}var d=this.initData=Object(P.parseInitSegment)(L);A||(A=R(d.audio,I.ElementaryStreamTypes.AUDIO)),C||(C=R(d.video,I.ElementaryStreamTypes.VIDEO));var o={};d.audio&&d.video?o.audiovideo={container:"video/mp4",codec:A+","+C,initSegment:L,id:"main"}:d.audio?o.audio={container:"audio/mp4",codec:A,initSegment:L,id:"audio"}:d.video?o.video={container:"video/mp4",codec:C,initSegment:L,id:"main"}:H.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=o},w.remux=function(L,A,C,d,o){var l=this.initPTS,h=this.lastEndDTS,T={audio:void 0,video:void 0,text:d,id3:C,initSegment:void 0};Object(Y.isFiniteNumber)(h)||(h=this.lastEndDTS=o||0);var f=A.samples;if(!f||!f.length)return T;var p={initPTS:void 0,timescale:1},D=this.initData;if((!D||!D.length)&&(this.generateInitSegment(f),D=this.initData),!D||!D.length)return H.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),T;this.emitInitSegment&&(p.tracks=this.initTracks,this.emitInitSegment=!1),Object(Y.isFiniteNumber)(l)||(this.initPTS=p.initPTS=l=O(D,f,h));var E=Object(P.getDuration)(f,D),g=h,c=E+g;Object(P.offsetStartDTS)(D,f,l),E>0?this.lastEndDTS=c:(H.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var u=!!D.audio,a=!!D.video,x="";u&&(x+="audio"),a&&(x+="video");var b={data1:f,startPTS:g,startDTS:g,endPTS:c,endDTS:c,type:x,hasAudio:u,hasVideo:a,nb:1,dropped:0};return T.audio=b.type==="audio"?b:void 0,T.video=b.type!=="audio"?b:void 0,T.text=d,T.id3=C,T.initSegment=p,T},y}(),O=function(w,_,L){return Object(P.getStartDTS)(w,_)-L};function R(y,w){var _=y==null?void 0:y.codec;return _&&_.length>4?_:_==="hvc1"?"hvc1.1.c.L120.90":_==="av01"?"av01.0.04M.08":_==="avc1"||w===I.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}Z.default=U},"./src/task-loop.ts":function(oe,Z,k){"use strict";k.r(Z),k.d(Z,"default",function(){return Y});var Y=function(){function P(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var I=P.prototype;return I.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},I.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},I.onHandlerDestroyed=function(){},I.hasInterval=function(){return!!this._tickInterval},I.hasNextTick=function(){return!!this._tickTimer},I.setInterval=function(U){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,U),!0)},I.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},I.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},I.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},I.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},I.doTick=function(){},P}()},"./src/types/cmcd.ts":function(oe,Z,k){"use strict";k.r(Z),k.d(Z,"CMCDVersion",function(){return Y}),k.d(Z,"CMCDObjectType",function(){return P}),k.d(Z,"CMCDStreamingFormat",function(){return I}),k.d(Z,"CMCDStreamType",function(){return H});var Y=1,P;(function(U){U.MANIFEST="m",U.AUDIO="a",U.VIDEO="v",U.MUXED="av",U.INIT="i",U.CAPTION="c",U.TIMED_TEXT="tt",U.KEY="k",U.OTHER="o"})(P||(P={}));var I;(function(U){U.DASH="d",U.HLS="h",U.SMOOTH="s",U.OTHER="o"})(I||(I={}));var H;(function(U){U.VOD="v",U.LIVE="l"})(H||(H={}))},"./src/types/level.ts":function(oe,Z,k){"use strict";k.r(Z),k.d(Z,"HlsSkip",function(){return I}),k.d(Z,"getSkipValue",function(){return H}),k.d(Z,"HlsUrlParameters",function(){return U}),k.d(Z,"Level",function(){return O});function Y(R,y){for(var w=0;w<y.length;w++){var _=y[w];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(R,_.key,_)}}function P(R,y,w){return y&&Y(R.prototype,y),w&&Y(R,w),R}var I;(function(R){R.No="",R.Yes="YES",R.v2="v2"})(I||(I={}));function H(R,y){var w=R.canSkipUntil,_=R.canSkipDateRanges,L=R.endSN,A=y!==void 0?y-L:0;return w&&A<w?_?I.v2:I.Yes:I.No}var U=function(){function R(w,_,L){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=w,this.part=_,this.skip=L}var y=R.prototype;return y.addDirectives=function(_){var L=new self.URL(_);return this.msn!==void 0&&L.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&L.searchParams.set("_HLS_part",this.part.toString()),this.skip&&L.searchParams.set("_HLS_skip",this.skip),L.toString()},R}(),O=function(){function R(y){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=[y.url],this.attrs=y.attrs,this.bitrate=y.bitrate,y.details&&(this.details=y.details),this.id=y.id||0,this.name=y.name,this.width=y.width||0,this.height=y.height||0,this.audioCodec=y.audioCodec,this.videoCodec=y.videoCodec,this.unknownCodecs=y.unknownCodecs,this.codecSet=[y.videoCodec,y.audioCodec].filter(function(w){return w}).join(",").replace(/\.[^.,]+/g,"")}return P(R,[{key:"maxBitrate",get:function(){return Math.max(this.realBitrate,this.bitrate)}},{key:"uri",get:function(){return this.url[this._urlId]||""}},{key:"urlId",get:function(){return this._urlId},set:function(w){var _=w%this.url.length;this._urlId!==_&&(this.details=void 0,this._urlId=_)}}]),R}()},"./src/types/loader.ts":function(oe,Z,k){"use strict";k.r(Z),k.d(Z,"PlaylistContextType",function(){return Y}),k.d(Z,"PlaylistLevelType",function(){return P});var Y;(function(I){I.MANIFEST="manifest",I.LEVEL="level",I.AUDIO_TRACK="audioTrack",I.SUBTITLE_TRACK="subtitleTrack"})(Y||(Y={}));var P;(function(I){I.MAIN="main",I.AUDIO="audio",I.SUBTITLE="subtitle"})(P||(P={}))},"./src/types/transmuxer.ts":function(oe,Z,k){"use strict";k.r(Z),k.d(Z,"ChunkMetadata",function(){return Y});var Y=function(H,U,O,R,y,w){R===void 0&&(R=0),y===void 0&&(y=-1),w===void 0&&(w=!1),this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=P(),this.buffering={audio:P(),video:P(),audiovideo:P()},this.level=H,this.sn=U,this.id=O,this.size=R,this.part=y,this.partial=w};function P(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(oe,Z,k){"use strict";k.r(Z),k.d(Z,"AttrList",function(){return I});var Y=/^(\d+)x(\d+)$/,P=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,I=function(){function H(O){typeof O=="string"&&(O=H.parseAttrList(O));for(var R in O)O.hasOwnProperty(R)&&(this[R]=O[R])}var U=H.prototype;return U.decimalInteger=function(R){var y=parseInt(this[R],10);return y>Number.MAX_SAFE_INTEGER?Infinity:y},U.hexadecimalInteger=function(R){if(this[R]){var y=(this[R]||"0x").slice(2);y=(y.length&1?"0":"")+y;for(var w=new Uint8Array(y.length/2),_=0;_<y.length/2;_++)w[_]=parseInt(y.slice(_*2,_*2+2),16);return w}else return null},U.hexadecimalIntegerAsNumber=function(R){var y=parseInt(this[R],16);return y>Number.MAX_SAFE_INTEGER?Infinity:y},U.decimalFloatingPoint=function(R){return parseFloat(this[R])},U.optionalFloat=function(R,y){var w=this[R];return w?parseFloat(w):y},U.enumeratedString=function(R){return this[R]},U.bool=function(R){return this[R]==="YES"},U.decimalResolution=function(R){var y=Y.exec(this[R]);return y===null?void 0:{width:parseInt(y[1],10),height:parseInt(y[2],10)}},H.parseAttrList=function(R){var y,w={},_='"';for(P.lastIndex=0;(y=P.exec(R))!==null;){var L=y[2];L.indexOf(_)===0&&L.lastIndexOf(_)===L.length-1&&(L=L.slice(1,-1)),w[y[1]]=L}return w},H}()},"./src/utils/binary-search.ts":function(oe,Z,k){"use strict";k.r(Z);var Y={search:function(I,H){for(var U=0,O=I.length-1,R=null,y=null;U<=O;){R=(U+O)/2|0,y=I[R];var w=H(y);if(w>0)U=R+1;else if(w<0)O=R-1;else return y}return null}};Z.default=Y},"./src/utils/buffer-helper.ts":function(oe,Z,k){"use strict";k.r(Z),k.d(Z,"BufferHelper",function(){return I});var Y=k("./src/utils/logger.ts"),P={length:0,start:function(){return 0},end:function(){return 0}},I=function(){function H(){}return H.isBuffered=function(O,R){try{if(O){for(var y=H.getBuffered(O),w=0;w<y.length;w++)if(R>=y.start(w)&&R<=y.end(w))return!0}}catch(_){}return!1},H.bufferInfo=function(O,R,y){try{if(O){var w=H.getBuffered(O),_=[],L;for(L=0;L<w.length;L++)_.push({start:w.start(L),end:w.end(L)});return this.bufferedInfo(_,R,y)}}catch(A){}return{len:0,start:R,end:R,nextStart:void 0}},H.bufferedInfo=function(O,R,y){R=Math.max(0,R),O.sort(function(p,D){var E=p.start-D.start;return E||D.end-p.end});var w=[];if(y)for(var _=0;_<O.length;_++){var L=w.length;if(L){var A=w[L-1].end;O[_].start-A<y?O[_].end>A&&(w[L-1].end=O[_].end):w.push(O[_])}else w.push(O[_])}else w=O;for(var C=0,d,o=R,l=R,h=0;h<w.length;h++){var T=w[h].start,f=w[h].end;if(R+y>=T&&R<f)o=T,l=f,C=l-R;else if(R+y<T){d=T;break}}return{len:C,start:o||0,end:l||0,nextStart:d}},H.getBuffered=function(O){try{return O.buffered}catch(R){return Y.logger.log("failed to get media.buffered",R),P}},H}()},"./src/utils/cea-608-parser.ts":function(oe,Z,k){"use strict";k.r(Z),k.d(Z,"Row",function(){return l}),k.d(Z,"CaptionScreen",function(){return h});var Y=k("./src/utils/logger.ts"),P={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},I=function(c){var u=c;return P.hasOwnProperty(c)&&(u=P[c]),String.fromCharCode(u)},H=15,U=100,O={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},R={17:2,18:4,21:6,22:8,23:10,19:13,20:15},y={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},w={25:2,26:4,29:6,30:8,31:10,27:13,28:15},_=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],L;(function(g){g[g.ERROR=0]="ERROR",g[g.TEXT=1]="TEXT",g[g.WARNING=2]="WARNING",g[g.INFO=2]="INFO",g[g.DEBUG=3]="DEBUG",g[g.DATA=3]="DATA"})(L||(L={}));var A=function(){function g(){this.time=null,this.verboseLevel=L.ERROR}var c=g.prototype;return c.log=function(a,x){this.verboseLevel>=a&&Y.logger.log(this.time+" ["+a+"] "+x)},g}(),C=function(c){for(var u=[],a=0;a<c.length;a++)u.push(c[a].toString(16));return u},d=function(){function g(u,a,x,b,v){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=u||"white",this.underline=a||!1,this.italics=x||!1,this.background=b||"black",this.flash=v||!1}var c=g.prototype;return c.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},c.setStyles=function(a){for(var x=["foreground","underline","italics","background","flash"],b=0;b<x.length;b++){var v=x[b];a.hasOwnProperty(v)&&(this[v]=a[v])}},c.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},c.equals=function(a){return this.foreground===a.foreground&&this.underline===a.underline&&this.italics===a.italics&&this.background===a.background&&this.flash===a.flash},c.copy=function(a){this.foreground=a.foreground,this.underline=a.underline,this.italics=a.italics,this.background=a.background,this.flash=a.flash},c.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},g}(),o=function(){function g(u,a,x,b,v,M){this.uchar=void 0,this.penState=void 0,this.uchar=u||" ",this.penState=new d(a,x,b,v,M)}var c=g.prototype;return c.reset=function(){this.uchar=" ",this.penState.reset()},c.setChar=function(a,x){this.uchar=a,this.penState.copy(x)},c.setPenState=function(a){this.penState.copy(a)},c.equals=function(a){return this.uchar===a.uchar&&this.penState.equals(a.penState)},c.copy=function(a){this.uchar=a.uchar,this.penState.copy(a.penState)},c.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},g}(),l=function(){function g(u){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var a=0;a<U;a++)this.chars.push(new o);this.logger=u,this.pos=0,this.currPenState=new d}var c=g.prototype;return c.equals=function(a){for(var x=!0,b=0;b<U;b++)if(!this.chars[b].equals(a.chars[b])){x=!1;break}return x},c.copy=function(a){for(var x=0;x<U;x++)this.chars[x].copy(a.chars[x])},c.isEmpty=function(){for(var a=!0,x=0;x<U;x++)if(!this.chars[x].isEmpty()){a=!1;break}return a},c.setCursor=function(a){this.pos!==a&&(this.pos=a),this.pos<0?(this.logger.log(L.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>U&&(this.logger.log(L.DEBUG,"Too large cursor position "+this.pos),this.pos=U)},c.moveCursor=function(a){var x=this.pos+a;if(a>1)for(var b=this.pos+1;b<x+1;b++)this.chars[b].setPenState(this.currPenState);this.setCursor(x)},c.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},c.insertChar=function(a){a>=144&&this.backSpace();var x=I(a);if(this.pos>=U){this.logger.log(L.ERROR,"Cannot insert "+a.toString(16)+" ("+x+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(x,this.currPenState),this.moveCursor(1)},c.clearFromPos=function(a){var x;for(x=a;x<U;x++)this.chars[x].reset()},c.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},c.clearToEndOfRow=function(){this.clearFromPos(this.pos)},c.getTextString=function(){for(var a=[],x=!0,b=0;b<U;b++){var v=this.chars[b].uchar;v!==" "&&(x=!1),a.push(v)}return x?"":a.join("")},c.setPenStyles=function(a){this.currPenState.setStyles(a);var x=this.chars[this.pos];x.setPenState(this.currPenState)},g}(),h=function(){function g(u){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var a=0;a<H;a++)this.rows.push(new l(u));this.logger=u,this.currRow=H-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var c=g.prototype;return c.reset=function(){for(var a=0;a<H;a++)this.rows[a].clear();this.currRow=H-1},c.equals=function(a){for(var x=!0,b=0;b<H;b++)if(!this.rows[b].equals(a.rows[b])){x=!1;break}return x},c.copy=function(a){for(var x=0;x<H;x++)this.rows[x].copy(a.rows[x])},c.isEmpty=function(){for(var a=!0,x=0;x<H;x++)if(!this.rows[x].isEmpty()){a=!1;break}return a},c.backSpace=function(){var a=this.rows[this.currRow];a.backSpace()},c.clearToEndOfRow=function(){var a=this.rows[this.currRow];a.clearToEndOfRow()},c.insertChar=function(a){var x=this.rows[this.currRow];x.insertChar(a)},c.setPen=function(a){var x=this.rows[this.currRow];x.setPenStyles(a)},c.moveCursor=function(a){var x=this.rows[this.currRow];x.moveCursor(a)},c.setCursor=function(a){this.logger.log(L.INFO,"setCursor: "+a);var x=this.rows[this.currRow];x.setCursor(a)},c.setPAC=function(a){this.logger.log(L.INFO,"pacData = "+JSON.stringify(a));var x=a.row-1;if(this.nrRollUpRows&&x<this.nrRollUpRows-1&&(x=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==x){for(var b=0;b<H;b++)this.rows[b].clear();var v=this.currRow+1-this.nrRollUpRows,M=this.lastOutputScreen;if(M){var G=M.rows[v].cueStartTime,X=this.logger.time;if(G&&X!==null&&G<X)for(var Q=0;Q<this.nrRollUpRows;Q++)this.rows[x-this.nrRollUpRows+Q+1].copy(M.rows[v+Q])}}this.currRow=x;var z=this.rows[this.currRow];if(a.indent!==null){var j=a.indent,q=Math.max(j-1,0);z.setCursor(a.indent),a.color=z.chars[q].penState.foreground}var le={foreground:a.color,underline:a.underline,italics:a.italics,background:"black",flash:!1};this.setPen(le)},c.setBkgData=function(a){this.logger.log(L.INFO,"bkgData = "+JSON.stringify(a)),this.backSpace(),this.setPen(a),this.insertChar(32)},c.setRollUpRows=function(a){this.nrRollUpRows=a},c.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(L.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(L.TEXT,this.getDisplayText());var a=this.currRow+1-this.nrRollUpRows,x=this.rows.splice(a,1)[0];x.clear(),this.rows.splice(this.currRow,0,x),this.logger.log(L.INFO,"Rolling up")},c.getDisplayText=function(a){a=a||!1;for(var x=[],b="",v=-1,M=0;M<H;M++){var G=this.rows[M].getTextString();G&&(v=M+1,a?x.push("Row "+v+": '"+G+"'"):x.push(G.trim()))}return x.length>0&&(a?b="["+x.join(" | ")+"]":b=x.join(`
|
|
`)),b},c.getTextAndFormat=function(){return this.rows},g}(),T=function(){function g(u,a,x){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=u,this.outputFilter=a,this.mode=null,this.verbose=0,this.displayedMemory=new h(x),this.nonDisplayedMemory=new h(x),this.lastOutputScreen=new h(x),this.currRollUpRow=this.displayedMemory.rows[H-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=x}var c=g.prototype;return c.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[H-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},c.getHandler=function(){return this.outputFilter},c.setHandler=function(a){this.outputFilter=a},c.setPAC=function(a){this.writeScreen.setPAC(a)},c.setBkgData=function(a){this.writeScreen.setBkgData(a)},c.setMode=function(a){if(a===this.mode)return;this.mode=a,this.logger.log(L.INFO,"MODE="+a),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=a},c.insertChars=function(a){for(var x=0;x<a.length;x++)this.writeScreen.insertChar(a[x]);var b=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(L.INFO,b+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(L.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},c.ccRCL=function(){this.logger.log(L.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},c.ccBS=function(){if(this.logger.log(L.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},c.ccAOF=function(){},c.ccAON=function(){},c.ccDER=function(){this.logger.log(L.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},c.ccRU=function(a){this.logger.log(L.INFO,"RU("+a+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(a)},c.ccFON=function(){this.logger.log(L.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},c.ccRDC=function(){this.logger.log(L.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},c.ccTR=function(){this.logger.log(L.INFO,"TR"),this.setMode("MODE_TEXT")},c.ccRTD=function(){this.logger.log(L.INFO,"RTD"),this.setMode("MODE_TEXT")},c.ccEDM=function(){this.logger.log(L.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},c.ccCR=function(){this.logger.log(L.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},c.ccENM=function(){this.logger.log(L.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},c.ccEOC=function(){if(this.logger.log(L.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var a=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=a,this.writeScreen=this.nonDisplayedMemory,this.logger.log(L.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},c.ccTO=function(a){this.logger.log(L.INFO,"TO("+a+") - Tab Offset"),this.writeScreen.moveCursor(a)},c.ccMIDROW=function(a){var x={flash:!1};if(x.underline=a%2===1,x.italics=a>=46,x.italics)x.foreground="white";else{var b=Math.floor(a/2)-16,v=["white","green","blue","cyan","red","yellow","magenta"];x.foreground=v[b]}this.logger.log(L.INFO,"MIDROW: "+JSON.stringify(x)),this.writeScreen.setPen(x)},c.outputDataUpdate=function(a){a===void 0&&(a=!1);var x=this.logger.time;if(x===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=x:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,x,this.lastOutputScreen),a&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:x),this.lastOutputScreen.copy(this.displayedMemory))},c.cueSplitAtTime=function(a){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,a,this.displayedMemory),this.cueStartTime=a))},g}(),f=function(){function g(u,a,x){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var b=new A;this.channels=[null,new T(u,a,b),new T(u+1,x,b)],this.cmdHistory=E(),this.logger=b}var c=g.prototype;return c.getHandler=function(a){return this.channels[a].getHandler()},c.setHandler=function(a,x){this.channels[a].setHandler(x)},c.addData=function(a,x){var b,v,M,G=!1;this.logger.time=a;for(var X=0;X<x.length;X+=2){if(v=x[X]&127,M=x[X+1]&127,v===0&&M===0)continue;if(this.logger.log(L.DATA,"["+C([x[X],x[X+1]])+"] -> ("+C([v,M])+")"),b=this.parseCmd(v,M),b||(b=this.parseMidrow(v,M)),b||(b=this.parsePAC(v,M)),b||(b=this.parseBackgroundAttributes(v,M)),!b&&(G=this.parseChars(v,M),G)){var Q=this.currentChannel;if(Q&&Q>0){var z=this.channels[Q];z.insertChars(G)}else this.logger.log(L.WARNING,"No channel found yet. TEXT-MODE?")}!b&&!G&&this.logger.log(L.WARNING,"Couldn't parse cleaned data "+C([v,M])+" orig: "+C([x[X],x[X+1]]))}},c.parseCmd=function(a,x){var b=this.cmdHistory,v=(a===20||a===28||a===21||a===29)&&x>=32&&x<=47,M=(a===23||a===31)&&x>=33&&x<=35;if(!(v||M))return!1;if(D(a,x,b))return p(null,null,b),this.logger.log(L.DEBUG,"Repeated command ("+C([a,x])+") is dropped"),!0;var G=a===20||a===21||a===23?1:2,X=this.channels[G];return a===20||a===21||a===28||a===29?x===32?X.ccRCL():x===33?X.ccBS():x===34?X.ccAOF():x===35?X.ccAON():x===36?X.ccDER():x===37?X.ccRU(2):x===38?X.ccRU(3):x===39?X.ccRU(4):x===40?X.ccFON():x===41?X.ccRDC():x===42?X.ccTR():x===43?X.ccRTD():x===44?X.ccEDM():x===45?X.ccCR():x===46?X.ccENM():x===47&&X.ccEOC():X.ccTO(x-32),p(a,x,b),this.currentChannel=G,!0},c.parseMidrow=function(a,x){var b=0;if((a===17||a===25)&&x>=32&&x<=47){if(a===17?b=1:b=2,b!==this.currentChannel)return this.logger.log(L.ERROR,"Mismatch channel in midrow parsing"),!1;var v=this.channels[b];return v?(v.ccMIDROW(x),this.logger.log(L.DEBUG,"MIDROW ("+C([a,x])+")"),!0):!1}return!1},c.parsePAC=function(a,x){var b,v=this.cmdHistory,M=(a>=17&&a<=23||a>=25&&a<=31)&&x>=64&&x<=127,G=(a===16||a===24)&&x>=64&&x<=95;if(!(M||G))return!1;if(D(a,x,v))return p(null,null,v),!0;var X=a<=23?1:2;x>=64&&x<=95?b=X===1?O[a]:y[a]:b=X===1?R[a]:w[a];var Q=this.channels[X];return Q?(Q.setPAC(this.interpretPAC(b,x)),p(a,x,v),this.currentChannel=X,!0):!1},c.interpretPAC=function(a,x){var b,v={color:null,italics:!1,indent:null,underline:!1,row:a};return x>95?b=x-96:b=x-64,v.underline=(b&1)===1,b<=13?v.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(b/2)]:b<=15?(v.italics=!0,v.color="white"):v.indent=Math.floor((b-16)/2)*4,v},c.parseChars=function(a,x){var b,v=null,M=null;if(a>=25?(b=2,M=a-8):(b=1,M=a),M>=17&&M<=19){var G;M===17?G=x+80:M===18?G=x+112:G=x+144,this.logger.log(L.INFO,"Special char '"+I(G)+"' in channel "+b),v=[G]}else a>=32&&a<=127&&(v=x===0?[a]:[a,x]);if(v){var X=C(v);this.logger.log(L.DEBUG,"Char codes = "+X.join(",")),p(a,x,this.cmdHistory)}return v},c.parseBackgroundAttributes=function(a,x){var b=(a===16||a===24)&&x>=32&&x<=47,v=(a===23||a===31)&&x>=45&&x<=47;if(!(b||v))return!1;var M,G={};a===16||a===24?(M=Math.floor((x-32)/2),G.background=_[M],x%2===1&&(G.background=G.background+"_semi")):x===45?G.background="transparent":(G.foreground="black",x===47&&(G.underline=!0));var X=a<=23?1:2,Q=this.channels[X];return Q.setBkgData(G),p(a,x,this.cmdHistory),!0},c.reset=function(){for(var a=0;a<Object.keys(this.channels).length;a++){var x=this.channels[a];x&&x.reset()}this.cmdHistory=E()},c.cueSplitAtTime=function(a){for(var x=0;x<this.channels.length;x++){var b=this.channels[x];b&&b.cueSplitAtTime(a)}},g}();function p(g,c,u){u.a=g,u.b=c}function D(g,c,u){return u.a===g&&u.b===c}function E(){return{a:null,b:null}}Z.default=f},"./src/utils/codecs.ts":function(oe,Z,k){"use strict";k.r(Z),k.d(Z,"isCodecType",function(){return P}),k.d(Z,"isCodecSupportedInMp4",function(){return I});var Y={audio:{a3ds:!0,"ac-3":!0,"ac-4":!0,alac:!0,alaw:!0,dra1:!0,"dts+":!0,"dts-":!0,dtsc:!0,dtse:!0,dtsh:!0,"ec-3":!0,enca:!0,g719:!0,g726:!0,m4ae:!0,mha1:!0,mha2:!0,mhm1:!0,mhm2:!0,mlpa:!0,mp4a:!0,"raw ":!0,Opus:!0,samr:!0,sawb:!0,sawp:!0,sevc:!0,sqcp:!0,ssmv:!0,twos:!0,ulaw:!0},video:{avc1:!0,avc2:!0,avc3:!0,avc4:!0,avcp:!0,av01:!0,drac:!0,dvav:!0,dvhe:!0,encv:!0,hev1:!0,hvc1:!0,mjp2:!0,mp4v:!0,mvc1:!0,mvc2:!0,mvc3:!0,mvc4:!0,resv:!0,rv60:!0,s263:!0,svc1:!0,svc2:!0,"vc-1":!0,vp08:!0,vp09:!0},text:{stpp:!0,wvtt:!0}};function P(H,U){var O=Y[U];return!!O&&O[H.slice(0,4)]===!0}function I(H,U){return MediaSource.isTypeSupported((U||"video")+'/mp4;codecs="'+H+'"')}},"./src/utils/cues.ts":function(oe,Z,k){"use strict";k.r(Z);var Y=k("./src/utils/vttparser.ts"),P=k("./src/utils/webvtt-parser.ts"),I=k("./src/utils/texttrack-utils.ts"),H=/\s/,U={newCue:function(R,y,w,_){for(var L=[],A,C,d,o,l,h=self.VTTCue||self.TextTrackCue,T=0;T<_.rows.length;T++)if(A=_.rows[T],d=!0,o=0,l="",!A.isEmpty()){for(var f=0;f<A.chars.length;f++)H.test(A.chars[f].uchar)&&d?o++:(l+=A.chars[f].uchar,d=!1);A.cueStartTime=y,y===w&&(w+=1e-4),o>=16?o--:o++;var p=Object(Y.fixLineBreaks)(l.trim()),D=Object(P.generateCueId)(y,w,p);(!R||!R.cues||!R.cues.getCueById(D))&&(C=new h(y,w,p),C.id=D,C.line=T+1,C.align="left",C.position=10+Math.min(80,Math.floor(o*8/32)*10),L.push(C))}return R&&L.length&&(L.sort(function(E,g){return E.line==="auto"||g.line==="auto"?0:E.line>8&&g.line>8?g.line-E.line:E.line-g.line}),L.forEach(function(E){return Object(I.addCueToTrack)(R,E)})),L}};Z.default=U},"./src/utils/discontinuities.ts":function(oe,Z,k){"use strict";k.r(Z),k.d(Z,"findFirstFragWithCC",function(){return H}),k.d(Z,"shouldAlignOnDiscontinuities",function(){return U}),k.d(Z,"findDiscontinuousReferenceFrag",function(){return O}),k.d(Z,"adjustSlidingStart",function(){return y}),k.d(Z,"alignStream",function(){return w}),k.d(Z,"alignPDT",function(){return L}),k.d(Z,"alignFragmentByPDTDelta",function(){return A}),k.d(Z,"alignMediaPlaylistByPDT",function(){return C});var Y=k("./src/polyfills/number.ts"),P=k("./src/utils/logger.ts"),I=k("./src/controller/level-helper.ts");function H(d,o){for(var l=null,h=0,T=d.length;h<T;h++){var f=d[h];if(f&&f.cc===o){l=f;break}}return l}function U(d,o,l){return!!(o.details&&(l.endCC>l.startCC||d&&d.cc<l.startCC))}function O(d,o){var l=d.fragments,h=o.fragments;if(!h.length||!l.length){P.logger.log("No fragments to align");return}var T=H(l,h[0].cc);if(!T||T&&!T.startPTS){P.logger.log("No frag in previous level to align on");return}return T}function R(d,o){if(d){var l=d.start+o;d.start=d.startPTS=l,d.endPTS=l+d.duration}}function y(d,o){for(var l=o.fragments,h=0,T=l.length;h<T;h++)R(l[h],d);o.fragmentHint&&R(o.fragmentHint,d),o.alignedSliding=!0}function w(d,o,l){if(!o)return;_(d,l,o),!l.alignedSliding&&o.details&&L(l,o.details),!l.alignedSliding&&o.details&&!l.skippedSegments&&Object(I.adjustSliding)(o.details,l)}function _(d,o,l){if(U(d,l,o)){var h=O(l.details,o);h&&Object(Y.isFiniteNumber)(h.start)&&(P.logger.log("Adjusting PTS using last level due to CC increase within current level "+o.url),y(h.start,o))}}function L(d,o){if(!o.fragments.length||!d.hasProgramDateTime||!o.hasProgramDateTime)return;var l=o.fragments[0].programDateTime,h=d.fragments[0].programDateTime,T=(h-l)/1e3+o.fragments[0].start;T&&Object(Y.isFiniteNumber)(T)&&(P.logger.log("Adjusting PTS using programDateTime delta "+(h-l)+"ms, sliding:"+T.toFixed(3)+" "+d.url+" "),y(T,d))}function A(d,o){var l=d.programDateTime;if(!l)return;var h=(l-o)/1e3;d.start=d.startPTS=h,d.endPTS=h+d.duration}function C(d,o){if(!o.fragments.length||!d.hasProgramDateTime||!o.hasProgramDateTime)return;var l=o.fragments[0].programDateTime,h=o.fragments[0].start,T=l-h*1e3;d.fragments.forEach(function(f){A(f,T)}),d.fragmentHint&&A(d.fragmentHint,T),d.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(oe,Z,k){"use strict";k.r(Z);var Y=k("./src/utils/ewma.ts"),P=function(){function I(U,O,R){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=R,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new Y.default(U),this.fast_=new Y.default(O)}var H=I.prototype;return H.update=function(O,R){var y=this.slow_,w=this.fast_;this.slow_.halfLife!==O&&(this.slow_=new Y.default(O,y.getEstimate(),y.getTotalWeight())),this.fast_.halfLife!==R&&(this.fast_=new Y.default(R,w.getEstimate(),w.getTotalWeight()))},H.sample=function(O,R){O=Math.max(O,this.minDelayMs_);var y=8*R,w=O/1e3,_=y/w;this.fast_.sample(w,_),this.slow_.sample(w,_)},H.canEstimate=function(){var O=this.fast_;return O&&O.getTotalWeight()>=this.minWeight_},H.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},H.destroy=function(){},I}();Z.default=P},"./src/utils/ewma.ts":function(oe,Z,k){"use strict";k.r(Z);var Y=function(){function P(H,U,O){U===void 0&&(U=0),O===void 0&&(O=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=H,this.alpha_=H?Math.exp(Math.log(.5)/H):0,this.estimate_=U,this.totalWeight_=O}var I=P.prototype;return I.sample=function(U,O){var R=Math.pow(this.alpha_,U);this.estimate_=O*(1-R)+R*this.estimate_,this.totalWeight_+=U},I.getTotalWeight=function(){return this.totalWeight_},I.getEstimate=function(){if(this.alpha_){var U=1-Math.pow(this.alpha_,this.totalWeight_);if(U)return this.estimate_/U}return this.estimate_},P}();Z.default=Y},"./src/utils/fetch-loader.ts":function(oe,Z,k){"use strict";k.r(Z),k.d(Z,"fetchSupported",function(){return A});var Y=k("./src/polyfills/number.ts"),P=k("./src/loader/load-stats.ts"),I=k("./src/demux/chunk-cache.ts");function H(h,T){h.prototype=Object.create(T.prototype),h.prototype.constructor=h,w(h,T)}function U(h){var T=typeof Map=="function"?new Map:void 0;return U=function(p){if(p===null||!y(p))return p;if(typeof p!="function")throw new TypeError("Super expression must either be null or a function");if(typeof T!="undefined"){if(T.has(p))return T.get(p);T.set(p,D)}function D(){return O(p,arguments,_(this).constructor)}return D.prototype=Object.create(p.prototype,{constructor:{value:D,enumerable:!1,writable:!0,configurable:!0}}),w(D,p)},U(h)}function O(h,T,f){return R()?O=Reflect.construct:O=function(D,E,g){var c=[null];c.push.apply(c,E);var u=Function.bind.apply(D,c),a=new u;return g&&w(a,g.prototype),a},O.apply(null,arguments)}function R(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(h){return!1}}function y(h){return Function.toString.call(h).indexOf("[native code]")!==-1}function w(h,T){return w=Object.setPrototypeOf||function(p,D){return p.__proto__=D,p},w(h,T)}function _(h){return _=Object.setPrototypeOf?Object.getPrototypeOf:function(f){return f.__proto__||Object.getPrototypeOf(f)},_(h)}function L(){return L=Object.assign||function(h){for(var T=1;T<arguments.length;T++){var f=arguments[T];for(var p in f)Object.prototype.hasOwnProperty.call(f,p)&&(h[p]=f[p])}return h},L.apply(this,arguments)}function A(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(h){}return!1}var C=function(){function h(f){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=f.fetchSetup||o,this.controller=new self.AbortController,this.stats=new P.LoadStats}var T=h.prototype;return T.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},T.abortInternal=function(){var p=this.response;(!p||!p.ok)&&(this.stats.aborted=!0,this.controller.abort())},T.abort=function(){var p;this.abortInternal(),(p=this.callbacks)!==null&&p!==void 0&&p.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},T.load=function(p,D,E){var g=this,c=this.stats;if(c.loading.start)throw new Error("Loader can only be used once.");c.loading.start=self.performance.now();var u=d(p,this.controller.signal),a=E.onProgress,x=p.responseType==="arraybuffer",b=x?"byteLength":"length";this.context=p,this.config=D,this.callbacks=E,this.request=this.fetchSetup(p,u),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){g.abortInternal(),E.onTimeout(c,p,g.response)},D.timeout),self.fetch(this.request).then(function(v){if(g.response=g.loader=v,!v.ok){var M=v.status,G=v.statusText;throw new l(G||"fetch, bad network response",M,v)}return c.loading.first=Math.max(self.performance.now(),c.loading.start),c.total=parseInt(v.headers.get("Content-Length")||"0"),a&&Object(Y.isFiniteNumber)(D.highWaterMark)?g.loadProgressively(v,c,p,D.highWaterMark,a):x?v.arrayBuffer():v.text()}).then(function(v){var M=g.response;self.clearTimeout(g.requestTimeout),c.loading.end=Math.max(self.performance.now(),c.loading.first),c.loaded=c.total=v[b];var G={url:M.url,data:v};a&&!Object(Y.isFiniteNumber)(D.highWaterMark)&&a(c,p,v,M),E.onSuccess(G,c,p,M)}).catch(function(v){if(self.clearTimeout(g.requestTimeout),c.aborted)return;var M=v.code||0;E.onError({code:M,text:v.message},p,v.details)})},T.getCacheAge=function(){var p=null;if(this.response){var D=this.response.headers.get("age");p=D?parseFloat(D):null}return p},T.loadProgressively=function(p,D,E,g,c){g===void 0&&(g=0);var u=new I.default,a=p.body.getReader(),x=function b(){return a.read().then(function(v){if(v.done)return u.dataLength&&c(D,E,u.flush(),p),Promise.resolve(new ArrayBuffer(0));var M=v.value,G=M.length;return D.loaded+=G,G<g||u.dataLength?(u.push(M),u.dataLength>=g&&c(D,E,u.flush(),p)):c(D,E,M,p),b()}).catch(function(){return Promise.reject()})};return x()},h}();function d(h,T){var f={method:"GET",mode:"cors",credentials:"same-origin",signal:T,headers:new self.Headers(L({},h.headers))};return h.rangeEnd&&f.headers.set("Range","bytes="+h.rangeStart+"-"+String(h.rangeEnd-1)),f}function o(h,T){return new self.Request(h.url,T)}var l=function(h){H(T,h);function T(f,p,D){var E;return E=h.call(this,f)||this,E.code=void 0,E.details=void 0,E.code=p,E.details=D,E}return T}(U(Error));Z.default=C},"./src/utils/imsc1-ttml-parser.ts":function(oe,Z,k){"use strict";k.r(Z),k.d(Z,"IMSC1_CODEC",function(){return y}),k.d(Z,"parseIMSC1",function(){return A});var Y=k("./src/utils/mp4-tools.ts"),P=k("./src/utils/vttparser.ts"),I=k("./src/utils/vttcue.ts"),H=k("./src/demux/id3.ts"),U=k("./src/utils/timescale-conversion.ts"),O=k("./src/utils/webvtt-parser.ts");function R(){return R=Object.assign||function(g){for(var c=1;c<arguments.length;c++){var u=arguments[c];for(var a in u)Object.prototype.hasOwnProperty.call(u,a)&&(g[a]=u[a])}return g},R.apply(this,arguments)}var y="stpp.ttml.im1t",w=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,_=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,L={left:"start",center:"center",right:"end",start:"start",end:"end"};function A(g,c,u,a,x){var b=Object(Y.findBox)(new Uint8Array(g),["mdat"]);if(b.length===0){x(new Error("Could not parse IMSC1 mdat"));return}var v=b[0],M=Object(H.utf8ArrayToStr)(new Uint8Array(g,v.start,v.end-v.start)),G=Object(U.toTimescaleFromScale)(c,1,u);try{a(C(M,G))}catch(X){x(X)}}function C(g,c){var u=new DOMParser,a=u.parseFromString(g,"text/xml"),x=a.getElementsByTagName("tt")[0];if(!x)throw new Error("Invalid ttml");var b={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},v=Object.keys(b).reduce(function(z,j){return z[j]=x.getAttribute("ttp:"+j)||b[j],z},{}),M=x.getAttribute("xml:space")!=="preserve",G=o(d(x,"styling","style")),X=o(d(x,"layout","region")),Q=d(x,"body","[begin]");return[].map.call(Q,function(z){var j=l(z,M);if(!j||!z.hasAttribute("begin"))return null;var q=p(z.getAttribute("begin"),v),le=p(z.getAttribute("dur"),v),me=p(z.getAttribute("end"),v);if(q===null)throw f(z);if(me===null){if(le===null)throw f(z);me=q+le}var be=new I.default(q-c,me-c,j);be.id=Object(O.generateCueId)(be.startTime,be.endTime,be.text);var Be=X[z.getAttribute("region")],Le=G[z.getAttribute("style")];be.position=10,be.size=80;var De=h(Be,Le),de=De.textAlign;if(de){var pe=L[de];pe&&(be.lineAlign=pe),be.align=de}return R(be,De),be}).filter(function(z){return z!==null})}function d(g,c,u){var a=g.getElementsByTagName(c)[0];return a?[].slice.call(a.querySelectorAll(u)):[]}function o(g){return g.reduce(function(c,u){var a=u.getAttribute("xml:id");return a&&(c[a]=u),c},{})}function l(g,c){return[].slice.call(g.childNodes).reduce(function(u,a,x){var b;return a.nodeName==="br"&&x?u+`
|
|
`:(b=a.childNodes)!==null&&b!==void 0&&b.length?l(a,c):c?u+a.textContent.trim().replace(/\s+/g," "):u+a.textContent},"")}function h(g,c){var u="http://www.w3.org/ns/ttml#styling",a=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return a.reduce(function(x,b){var v=T(c,u,b)||T(g,u,b);return v&&(x[b]=v),x},{})}function T(g,c,u){return g.hasAttributeNS(c,u)?g.getAttributeNS(c,u):null}function f(g){return new Error("Could not parse ttml timestamp "+g)}function p(g,c){if(!g)return null;var u=Object(P.parseTimeStamp)(g);return u===null&&(w.test(g)?u=D(g,c):_.test(g)&&(u=E(g,c))),u}function D(g,c){var u=w.exec(g),a=(u[4]|0)+(u[5]|0)/c.subFrameRate;return(u[1]|0)*3600+(u[2]|0)*60+(u[3]|0)+a/c.frameRate}function E(g,c){var u=_.exec(g),a=Number(u[1]),x=u[2];switch(x){case"h":return a*3600;case"m":return a*60;case"ms":return a*1e3;case"f":return a/c.frameRate;case"t":return a/c.tickRate}return a}},"./src/utils/logger.ts":function(oe,Z,k){"use strict";k.r(Z),k.d(Z,"enableLogs",function(){return O}),k.d(Z,"logger",function(){return R});var Y=function(){},P={trace:Y,debug:Y,log:Y,warn:Y,info:Y,error:Y},I=P;function H(y){var w=self.console[y];return w?w.bind(self.console,"["+y+"] >"):Y}function U(y){for(var w=arguments.length,_=new Array(w>1?w-1:0),L=1;L<w;L++)_[L-1]=arguments[L];_.forEach(function(A){I[A]=y[A]?y[A].bind(y):H(A)})}function O(y){if(self.console&&y===!0||typeof y=="object"){U(y,"debug","log","info","warn","error");try{I.log()}catch(w){I=P}}else I=P}var R=I},"./src/utils/mediakeys-helper.ts":function(oe,Z,k){"use strict";k.r(Z),k.d(Z,"KeySystems",function(){return Y}),k.d(Z,"requestMediaKeySystemAccess",function(){return P});var Y;(function(I){I.WIDEVINE="com.widevine.alpha",I.PLAYREADY="com.microsoft.playready"})(Y||(Y={}));var P=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(oe,Z,k){"use strict";k.r(Z),k.d(Z,"getMediaSource",function(){return Y});function Y(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(oe,Z,k){"use strict";k.r(Z),k.d(Z,"bin2str",function(){return U}),k.d(Z,"readUint16",function(){return O}),k.d(Z,"readUint32",function(){return R}),k.d(Z,"writeUint32",function(){return y}),k.d(Z,"findBox",function(){return w}),k.d(Z,"parseSegmentIndex",function(){return _}),k.d(Z,"parseInitSegment",function(){return L}),k.d(Z,"getStartDTS",function(){return A}),k.d(Z,"getDuration",function(){return C}),k.d(Z,"computeRawDurationFromSamples",function(){return d}),k.d(Z,"offsetStartDTS",function(){return o}),k.d(Z,"segmentValidRange",function(){return l}),k.d(Z,"appendUint8Array",function(){return h});var Y=k("./src/utils/typed-array.ts"),P=k("./src/loader/fragment.ts"),I=Math.pow(2,32)-1,H=[].push;function U(T){return String.fromCharCode.apply(null,T)}function O(T,f){"data"in T&&(f+=T.start,T=T.data);var p=T[f]<<8|T[f+1];return p<0?65536+p:p}function R(T,f){"data"in T&&(f+=T.start,T=T.data);var p=T[f]<<24|T[f+1]<<16|T[f+2]<<8|T[f+3];return p<0?4294967296+p:p}function y(T,f,p){"data"in T&&(f+=T.start,T=T.data),T[f]=p>>24,T[f+1]=p>>16&255,T[f+2]=p>>8&255,T[f+3]=p&255}function w(T,f){var p=[];if(!f.length)return p;var D,E,g;"data"in T?(D=T.data,E=T.start,g=T.end):(D=T,E=0,g=D.byteLength);for(var c=E;c<g;){var u=R(D,c),a=U(D.subarray(c+4,c+8)),x=u>1?c+u:g;if(a===f[0])if(f.length===1)p.push({data:D,start:c+8,end:x});else{var b=w({data:D,start:c+8,end:x},f.slice(1));b.length&&H.apply(p,b)}c=x}return p}function _(T){var f=w(T,["moov"]),p=f[0],D=p?p.end:null,E=w(T,["sidx"]);if(!E||!E[0])return null;var g=[],c=E[0],u=c.data[0],a=u===0?8:16,x=R(c,a);a+=4;var b=0,v=0;u===0?a+=8:a+=16,a+=2;var M=c.end+v,G=O(c,a);a+=2;for(var X=0;X<G;X++){var Q=a,z=R(c,Q);Q+=4;var j=z&2147483647,q=(z&2147483648)>>>31;if(q===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var le=R(c,Q);Q+=4,g.push({referenceSize:j,subsegmentDuration:le,info:{duration:le/x,start:M,end:M+j-1}}),M+=j,Q+=4,a=Q}return{earliestPresentationTime:b,timescale:x,version:u,referencesCount:G,references:g,moovEndOffset:D}}function L(T){for(var f=[],p=w(T,["moov","trak"]),D=0;D<p.length;D++){var E=p[D],g=w(E,["tkhd"])[0];if(g){var c=g.data[g.start],u=c===0?12:20,a=R(g,u),x=w(E,["mdia","mdhd"])[0];if(x){c=x.data[x.start],u=c===0?12:20;var b=R(x,u),v=w(E,["mdia","hdlr"])[0];if(v){var M=U(v.data.subarray(v.start+8,v.start+12)),G={soun:P.ElementaryStreamTypes.AUDIO,vide:P.ElementaryStreamTypes.VIDEO}[M];if(G){var X=w(E,["mdia","minf","stbl","stsd"])[0],Q=void 0;X&&(Q=U(X.data.subarray(X.start+12,X.start+16))),f[a]={timescale:b,type:G},f[G]={timescale:b,id:a,codec:Q}}}}}}var z=w(T,["moov","mvex","trex"]);return z.forEach(function(j){var q=R(j,4),le=f[q];le&&(le.default={duration:R(j,12),flags:R(j,20)})}),f}function A(T,f){return w(f,["moof","traf"]).reduce(function(p,D){var E=w(D,["tfdt"])[0],g=E.data[E.start],c=w(D,["tfhd"]).reduce(function(u,a){var x=R(a,4),b=T[x];if(b){var v=R(E,4);g===1&&(v*=Math.pow(2,32),v+=R(E,8));var M=b.timescale||9e4,G=v/M;if(isFinite(G)&&(u===null||G<u))return G}return u},null);return c!==null&&isFinite(c)&&(p===null||c<p)?c:p},null)||0}function C(T,f){for(var p=0,D=0,E=0,g=w(T,["moof","traf"]),c=0;c<g.length;c++){var u=g[c],a=w(u,["tfhd"])[0],x=R(a,4),b=f[x];if(!b)continue;var v=b.default,M=R(a,0)|(v==null?void 0:v.flags),G=v==null?void 0:v.duration;M&8&&(M&2?G=R(a,12):G=R(a,8));for(var X=b.timescale||9e4,Q=w(u,["trun"]),z=0;z<Q.length;z++){if(G){var j=R(Q[z],4);p=G*j}else p=d(Q[z]);b.type===P.ElementaryStreamTypes.VIDEO?D+=p/X:b.type===P.ElementaryStreamTypes.AUDIO&&(E+=p/X)}}if(D===0&&E===0){var q=_(T);if(q!=null&&q.references)return q.references.reduce(function(le,me){return le+me.info.duration||0},0)}return D||E}function d(T){var f=R(T,0),p=8;f&1&&(p+=4),f&4&&(p+=4);for(var D=0,E=R(T,4),g=0;g<E;g++){if(f&256){var c=R(T,p);D+=c,p+=4}f&512&&(p+=4),f&1024&&(p+=4),f&2048&&(p+=4)}return D}function o(T,f,p){w(f,["moof","traf"]).forEach(function(D){w(D,["tfhd"]).forEach(function(E){var g=R(E,4),c=T[g];if(!c)return;var u=c.timescale||9e4;w(D,["tfdt"]).forEach(function(a){var x=a.data[a.start],b=R(a,4);if(x===0)y(a,4,b-p*u);else{b*=Math.pow(2,32),b+=R(a,8),b-=p*u,b=Math.max(b,0);var v=Math.floor(b/(I+1)),M=Math.floor(b%(I+1));y(a,4,v),y(a,8,M)}})})})}function l(T){var f={valid:null,remainder:null},p=w(T,["moof"]);if(p){if(p.length<2)return f.remainder=T,f}else return f;var D=p[p.length-1];return f.valid=Object(Y.sliceUint8)(T,0,D.start-8),f.remainder=Object(Y.sliceUint8)(T,D.start-8),f}function h(T,f){var p=new Uint8Array(T.length+f.length);return p.set(T),p.set(f,T.length),p}},"./src/utils/output-filter.ts":function(oe,Z,k){"use strict";k.r(Z),k.d(Z,"default",function(){return Y});var Y=function(){function P(H,U){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=H,this.trackName=U}var I=P.prototype;return I.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},I.newCue=function(U,O,R){(this.startTime===null||this.startTime>U)&&(this.startTime=U),this.endTime=O,this.screen=R,this.timelineController.createCaptionsTrack(this.trackName)},I.reset=function(){this.cueRanges=[]},P}()},"./src/utils/texttrack-utils.ts":function(oe,Z,k){"use strict";k.r(Z),k.d(Z,"sendAddTrackEvent",function(){return P}),k.d(Z,"addCueToTrack",function(){return I}),k.d(Z,"clearCurrentCues",function(){return H}),k.d(Z,"removeCuesInRange",function(){return U}),k.d(Z,"getCuesInRange",function(){return R});var Y=k("./src/utils/logger.ts");function P(y,w){var _;try{_=new Event("addtrack")}catch(L){_=document.createEvent("Event"),_.initEvent("addtrack",!1,!1)}_.track=y,w.dispatchEvent(_)}function I(y,w){var _=y.mode;if(_==="disabled"&&(y.mode="hidden"),y.cues&&!y.cues.getCueById(w.id))try{if(y.addCue(w),!y.cues.getCueById(w.id))throw new Error("addCue is failed for: "+w)}catch(A){Y.logger.debug("[texttrack-utils]: "+A);var L=new self.TextTrackCue(w.startTime,w.endTime,w.text);L.id=w.id,y.addCue(L)}_==="disabled"&&(y.mode=_)}function H(y){var w=y.mode;if(w==="disabled"&&(y.mode="hidden"),y.cues)for(var _=y.cues.length;_--;)y.removeCue(y.cues[_]);w==="disabled"&&(y.mode=w)}function U(y,w,_){var L=y.mode;if(L==="disabled"&&(y.mode="hidden"),y.cues&&y.cues.length>0)for(var A=R(y.cues,w,_),C=0;C<A.length;C++)y.removeCue(A[C]);L==="disabled"&&(y.mode=L)}function O(y,w){if(w<y[0].startTime)return 0;var _=y.length-1;if(w>y[_].endTime)return-1;for(var L=0,A=_;L<=A;){var C=Math.floor((A+L)/2);if(w<y[C].startTime)A=C-1;else if(w>y[C].startTime&&L<_)L=C+1;else return C}return y[L].startTime-w<w-y[A].startTime?L:A}function R(y,w,_){var L=[],A=O(y,w);if(A>-1)for(var C=A,d=y.length;C<d;C++){var o=y[C];if(o.startTime>=w&&o.endTime<=_)L.push(o);else if(o.startTime>_)return L}return L}},"./src/utils/time-ranges.ts":function(oe,Z,k){"use strict";k.r(Z);var Y={toString:function(I){for(var H="",U=I.length,O=0;O<U;O++)H+="["+I.start(O).toFixed(3)+","+I.end(O).toFixed(3)+"]";return H}};Z.default=Y},"./src/utils/timescale-conversion.ts":function(oe,Z,k){"use strict";k.r(Z),k.d(Z,"toTimescaleFromBase",function(){return P}),k.d(Z,"toTimescaleFromScale",function(){return I}),k.d(Z,"toMsFromMpegTsClock",function(){return H}),k.d(Z,"toMpegTsClockFromTimescale",function(){return U});var Y=9e4;function P(O,R,y,w){y===void 0&&(y=1),w===void 0&&(w=!1);var _=O*R*y;return w?Math.round(_):_}function I(O,R,y,w){return y===void 0&&(y=1),w===void 0&&(w=!1),P(O,R,1/y,w)}function H(O,R){return R===void 0&&(R=!1),P(O,1e3,1/Y,R)}function U(O,R){return R===void 0&&(R=1),P(O,Y,1/R)}},"./src/utils/typed-array.ts":function(oe,Z,k){"use strict";k.r(Z),k.d(Z,"sliceUint8",function(){return Y});function Y(P,I,H){return Uint8Array.prototype.slice?P.slice(I,H):new Uint8Array(Array.prototype.slice.call(P,I,H))}},"./src/utils/vttcue.ts":function(oe,Z,k){"use strict";k.r(Z),Z.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var Y=["","lr","rl"],P=["start","middle","end","left","right"];function I(y,w){if(typeof w!="string")return!1;if(!Array.isArray(y))return!1;var _=w.toLowerCase();return~y.indexOf(_)?_:!1}function H(y){return I(Y,y)}function U(y){return I(P,y)}function O(y){for(var w=arguments.length,_=new Array(w>1?w-1:0),L=1;L<w;L++)_[L-1]=arguments[L];for(var A=1;A<arguments.length;A++){var C=arguments[A];for(var d in C)y[d]=C[d]}return y}function R(y,w,_){var L=this,A={enumerable:!0};L.hasBeenReset=!1;var C="",d=!1,o=y,l=w,h=_,T=null,f="",p=!0,D="auto",E="start",g=50,c="middle",u=50,a="middle";Object.defineProperty(L,"id",O({},A,{get:function(){return C},set:function(b){C=""+b}})),Object.defineProperty(L,"pauseOnExit",O({},A,{get:function(){return d},set:function(b){d=!!b}})),Object.defineProperty(L,"startTime",O({},A,{get:function(){return o},set:function(b){if(typeof b!="number")throw new TypeError("Start time must be set to a number.");o=b,this.hasBeenReset=!0}})),Object.defineProperty(L,"endTime",O({},A,{get:function(){return l},set:function(b){if(typeof b!="number")throw new TypeError("End time must be set to a number.");l=b,this.hasBeenReset=!0}})),Object.defineProperty(L,"text",O({},A,{get:function(){return h},set:function(b){h=""+b,this.hasBeenReset=!0}})),Object.defineProperty(L,"region",O({},A,{get:function(){return T},set:function(b){T=b,this.hasBeenReset=!0}})),Object.defineProperty(L,"vertical",O({},A,{get:function(){return f},set:function(b){var v=H(b);if(v===!1)throw new SyntaxError("An invalid or illegal string was specified.");f=v,this.hasBeenReset=!0}})),Object.defineProperty(L,"snapToLines",O({},A,{get:function(){return p},set:function(b){p=!!b,this.hasBeenReset=!0}})),Object.defineProperty(L,"line",O({},A,{get:function(){return D},set:function(b){if(typeof b!="number"&&b!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");D=b,this.hasBeenReset=!0}})),Object.defineProperty(L,"lineAlign",O({},A,{get:function(){return E},set:function(b){var v=U(b);if(!v)throw new SyntaxError("An invalid or illegal string was specified.");E=v,this.hasBeenReset=!0}})),Object.defineProperty(L,"position",O({},A,{get:function(){return g},set:function(b){if(b<0||b>100)throw new Error("Position must be between 0 and 100.");g=b,this.hasBeenReset=!0}})),Object.defineProperty(L,"positionAlign",O({},A,{get:function(){return c},set:function(b){var v=U(b);if(!v)throw new SyntaxError("An invalid or illegal string was specified.");c=v,this.hasBeenReset=!0}})),Object.defineProperty(L,"size",O({},A,{get:function(){return u},set:function(b){if(b<0||b>100)throw new Error("Size must be between 0 and 100.");u=b,this.hasBeenReset=!0}})),Object.defineProperty(L,"align",O({},A,{get:function(){return a},set:function(b){var v=U(b);if(!v)throw new SyntaxError("An invalid or illegal string was specified.");a=v,this.hasBeenReset=!0}})),L.displayState=void 0}return R.prototype.getCueAsHTML=function(){var y=self.WebVTT;return y.convertCueToDOMTree(self,this.text)},R}()},"./src/utils/vttparser.ts":function(oe,Z,k){"use strict";k.r(Z),k.d(Z,"parseTimeStamp",function(){return I}),k.d(Z,"fixLineBreaks",function(){return w}),k.d(Z,"VTTParser",function(){return _});var Y=k("./src/utils/vttcue.ts"),P=function(){function L(){}var A=L.prototype;return A.decode=function(d,o){if(!d)return"";if(typeof d!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(d))},L}();function I(L){function A(d,o,l,h){return(d|0)*3600+(o|0)*60+(l|0)+parseFloat(h||0)}var C=L.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return C?parseFloat(C[2])>59?A(C[2],C[3],0,C[4]):A(C[1],C[2],C[3],C[4]):null}var H=function(){function L(){this.values=Object.create(null)}var A=L.prototype;return A.set=function(d,o){!this.get(d)&&o!==""&&(this.values[d]=o)},A.get=function(d,o,l){return l?this.has(d)?this.values[d]:o[l]:this.has(d)?this.values[d]:o},A.has=function(d){return d in this.values},A.alt=function(d,o,l){for(var h=0;h<l.length;++h)if(o===l[h]){this.set(d,o);break}},A.integer=function(d,o){/^-?\d+$/.test(o)&&this.set(d,parseInt(o,10))},A.percent=function(d,o){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(o)){var l=parseFloat(o);if(l>=0&&l<=100)return this.set(d,l),!0}return!1},L}();function U(L,A,C,d){var o=d?L.split(d):[L];for(var l in o){if(typeof o[l]!="string")continue;var h=o[l].split(C);if(h.length!==2)continue;var T=h[0],f=h[1];A(T,f)}}var O=new Y.default(0,0,""),R=O.align==="middle"?"middle":"center";function y(L,A,C){var d=L;function o(){var T=I(L);if(T===null)throw new Error("Malformed timestamp: "+d);return L=L.replace(/^[^\sa-zA-Z-]+/,""),T}function l(T,f){var p=new H;U(T,function(g,c){var u;switch(g){case"region":for(var a=C.length-1;a>=0;a--)if(C[a].id===c){p.set(g,C[a].region);break}break;case"vertical":p.alt(g,c,["rl","lr"]);break;case"line":u=c.split(","),p.integer(g,u[0]),p.percent(g,u[0])&&p.set("snapToLines",!1),p.alt(g,u[0],["auto"]),u.length===2&&p.alt("lineAlign",u[1],["start",R,"end"]);break;case"position":u=c.split(","),p.percent(g,u[0]),u.length===2&&p.alt("positionAlign",u[1],["start",R,"end","line-left","line-right","auto"]);break;case"size":p.percent(g,c);break;case"align":p.alt(g,c,["start",R,"end","left","right"]);break}},/:/,/\s/),f.region=p.get("region",null),f.vertical=p.get("vertical","");var D=p.get("line","auto");D==="auto"&&O.line===-1&&(D=-1),f.line=D,f.lineAlign=p.get("lineAlign","start"),f.snapToLines=p.get("snapToLines",!0),f.size=p.get("size",100),f.align=p.get("align",R);var E=p.get("position","auto");E==="auto"&&O.position===50&&(E=f.align==="start"||f.align==="left"?0:f.align==="end"||f.align==="right"?100:50),f.position=E}function h(){L=L.replace(/^\s+/,"")}if(h(),A.startTime=o(),h(),L.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+d);L=L.substr(3),h(),A.endTime=o(),h(),l(L,A)}function w(L){return L.replace(/<br(?: \/)?>/gi,`
|
|
`)}var _=function(){function L(){this.state="INITIAL",this.buffer="",this.decoder=new P,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var A=L.prototype;return A.parse=function(d){var o=this;d&&(o.buffer+=o.decoder.decode(d,{stream:!0}));function l(){var E=o.buffer,g=0;for(E=w(E);g<E.length&&E[g]!=="\r"&&E[g]!==`
|
|
`;)++g;var c=E.substr(0,g);return E[g]==="\r"&&++g,E[g]===`
|
|
`&&++g,o.buffer=E.substr(g),c}function h(E){U(E,function(g,c){},/:/)}try{var T="";if(o.state==="INITIAL"){if(!/\r\n|\n/.test(o.buffer))return this;T=l();var f=T.match(/^()?WEBVTT([ \t].*)?$/);if(!f||!f[0])throw new Error("Malformed WebVTT signature.");o.state="HEADER"}for(var p=!1;o.buffer;){if(!/\r\n|\n/.test(o.buffer))return this;p?p=!1:T=l();switch(o.state){case"HEADER":/:/.test(T)?h(T):T||(o.state="ID");continue;case"NOTE":T||(o.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(T)){o.state="NOTE";break}if(!T)continue;if(o.cue=new Y.default(0,0,""),o.state="CUE",T.indexOf("-->")===-1){o.cue.id=T;continue}case"CUE":if(!o.cue){o.state="BADCUE";continue}try{y(T,o.cue,o.regionList)}catch(E){o.cue=null,o.state="BADCUE";continue}o.state="CUETEXT";continue;case"CUETEXT":{var D=T.indexOf("-->")!==-1;if(!T||D&&(p=!0)){o.oncue&&o.cue&&o.oncue(o.cue),o.cue=null,o.state="ID";continue}if(o.cue===null)continue;o.cue.text&&(o.cue.text+=`
|
|
`),o.cue.text+=T}continue;case"BADCUE":T||(o.state="ID")}}}catch(E){o.state==="CUETEXT"&&o.cue&&o.oncue&&o.oncue(o.cue),o.cue=null,o.state=o.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},A.flush=function(){var d=this;try{if((d.cue||d.state==="HEADER")&&(d.buffer+=`
|
|
|
|
`,d.parse()),d.state==="INITIAL"||d.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(o){d.onparsingerror&&d.onparsingerror(o)}return d.onflush&&d.onflush(),this},L}()},"./src/utils/webvtt-parser.ts":function(oe,Z,k){"use strict";k.r(Z),k.d(Z,"generateCueId",function(){return _}),k.d(Z,"parseWebVTT",function(){return A});var Y=k("./src/polyfills/number.ts"),P=k("./src/utils/vttparser.ts"),I=k("./src/demux/id3.ts"),H=k("./src/utils/timescale-conversion.ts"),U=k("./src/remux/mp4-remuxer.ts"),O=/\r\n|\n\r|\n|\r/g,R=function(d,o,l){return l===void 0&&(l=0),d.substr(l,o.length)===o},y=function(d){var o=parseInt(d.substr(-3)),l=parseInt(d.substr(-6,2)),h=parseInt(d.substr(-9,2)),T=d.length>9?parseInt(d.substr(0,d.indexOf(":"))):0;if(!Object(Y.isFiniteNumber)(o)||!Object(Y.isFiniteNumber)(l)||!Object(Y.isFiniteNumber)(h)||!Object(Y.isFiniteNumber)(T))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+d);return o+=1e3*l,o+=60*1e3*h,o+=60*60*1e3*T,o},w=function(d){for(var o=5381,l=d.length;l;)o=o*33^d.charCodeAt(--l);return(o>>>0).toString()};function _(C,d,o){return w(C.toString())+w(d.toString())+w(o)}var L=function(d,o,l){var h=d[o],T=d[h.prevCC];if(!T||!T.new&&h.new){d.ccOffset=d.presentationOffset=h.start,h.new=!1;return}for(;(f=T)!==null&&f!==void 0&&f.new;){var f;d.ccOffset+=h.start-T.start,h.new=!1,h=T,T=d[h.prevCC]}d.presentationOffset=l};function A(C,d,o,l,h,T,f,p){var D=new P.VTTParser,E=Object(I.utf8ArrayToStr)(new Uint8Array(C)).trim().replace(O,`
|
|
`).split(`
|
|
`),g=[],c=Object(H.toMpegTsClockFromTimescale)(d,o),u="00:00.000",a=0,x=0,b,v=!0,M=!1;D.oncue=function(G){var X=l[h],Q=l.ccOffset,z=(a-c)/9e4;if(X!=null&&X.new&&(x!==void 0?Q=l.ccOffset=X.start:L(l,h,z)),z&&(Q=z-l.presentationOffset),M){var j=G.endTime-G.startTime,q=Object(U.normalizePts)((G.startTime+Q-x)*9e4,T*9e4)/9e4;G.startTime=q,G.endTime=q+j}var le=G.text.trim();G.text=decodeURIComponent(encodeURIComponent(le)),G.id||(G.id=_(G.startTime,G.endTime,le)),G.endTime>0&&g.push(G)},D.onparsingerror=function(G){b=G},D.onflush=function(){if(b){p(b);return}f(g)},E.forEach(function(G){if(v)if(R(G,"X-TIMESTAMP-MAP=")){v=!1,M=!0,G.substr(16).split(",").forEach(function(X){R(X,"LOCAL:")?u=X.substr(6):R(X,"MPEGTS:")&&(a=parseInt(X.substr(7)))});try{x=y(u)/1e3}catch(X){M=!1,b=X}return}else G===""&&(v=!1);D.parse(G+`
|
|
`)}),D.flush()}},"./src/utils/xhr-loader.ts":function(oe,Z,k){"use strict";k.r(Z);var Y=k("./src/utils/logger.ts"),P=k("./src/loader/load-stats.ts"),I=/^age:\s*[\d.]+\s*$/m,H=function(){function U(R){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=void 0,this.loader=null,this.stats=void 0,this.xhrSetup=R?R.xhrSetup:null,this.stats=new P.LoadStats,this.retryDelay=0}var O=U.prototype;return O.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},O.abortInternal=function(){var y=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),y&&(y.onreadystatechange=null,y.onprogress=null,y.readyState!==4&&(this.stats.aborted=!0,y.abort()))},O.abort=function(){var y;this.abortInternal(),(y=this.callbacks)!==null&&y!==void 0&&y.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},O.load=function(y,w,_){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=y,this.config=w,this.callbacks=_,this.retryDelay=w.retryDelay,this.loadInternal()},O.loadInternal=function(){var y=this.config,w=this.context;if(!y)return;var _=this.loader=new self.XMLHttpRequest,L=this.stats;L.loading.first=0,L.loaded=0;var A=this.xhrSetup;try{if(A)try{A(_,w.url)}catch(o){_.open("GET",w.url,!0),A(_,w.url)}_.readyState||_.open("GET",w.url,!0);var C=this.context.headers;if(C)for(var d in C)_.setRequestHeader(d,C[d])}catch(o){this.callbacks.onError({code:_.status,text:o.message},w,_);return}w.rangeEnd&&_.setRequestHeader("Range","bytes="+w.rangeStart+"-"+(w.rangeEnd-1)),_.onreadystatechange=this.readystatechange.bind(this),_.onprogress=this.loadprogress.bind(this),_.responseType=w.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),y.timeout),_.send()},O.readystatechange=function(){var y=this.context,w=this.loader,_=this.stats;if(!y||!w)return;var L=w.readyState,A=this.config;if(_.aborted)return;if(L>=2)if(self.clearTimeout(this.requestTimeout),_.loading.first===0&&(_.loading.first=Math.max(self.performance.now(),_.loading.start)),L===4){w.onreadystatechange=null,w.onprogress=null;var C=w.status;if(C>=200&&C<300){_.loading.end=Math.max(self.performance.now(),_.loading.first);var d,o;if(y.responseType==="arraybuffer"?(d=w.response,o=d.byteLength):(d=w.responseText,o=d.length),_.loaded=_.total=o,!this.callbacks)return;var l=this.callbacks.onProgress;if(l&&l(_,y,d,w),!this.callbacks)return;var h={url:w.responseURL,data:d};this.callbacks.onSuccess(h,_,y,w)}else _.retry>=A.maxRetry||C>=400&&C<499?(Y.logger.error(C+" while loading "+y.url),this.callbacks.onError({code:C,text:w.statusText},y,w)):(Y.logger.warn(C+" while loading "+y.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,A.maxRetryDelay),_.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),A.timeout)},O.loadtimeout=function(){Y.logger.warn("timeout while loading "+this.context.url);var y=this.callbacks;y&&(this.abortInternal(),y.onTimeout(this.stats,this.context,this.loader))},O.loadprogress=function(y){var w=this.stats;w.loaded=y.loaded,y.lengthComputable&&(w.total=y.total)},O.getCacheAge=function(){var y=null;if(this.loader&&I.test(this.loader.getAllResponseHeaders())){var w=this.loader.getResponseHeader("age");y=w?parseFloat(w):null}return y},U}();Z.default=H}}).default})},vHTk:function(Ct,st,ne){Ct.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}}}]);
|