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

361 lines
985 KiB

(window.webpackJsonp=window.webpackJsonp||[]).push([[246,7,14],{"+NIl":function(Ft,yt,ne){(function(ae){ae(ne("VrN/"))})(function(ae){"use strict";ae.defineMode("stex",function(X,D){"use strict";function K(O,L){O.cmdState.push(L)}function w(O){return O.cmdState.length>0?O.cmdState[O.cmdState.length-1]:null}function P(O){var L=O.cmdState.pop();L&&L.closeBracket()}function H(O){for(var L=O.cmdState,y=L.length-1;y>=0;y--){var u=L[y];if(u.name=="DEFAULT")continue;return u}return{styleIdentifier:function(){return null}}}function W(O,L,y){return function(){this.name=O,this.bracketNo=0,this.style=L,this.styles=y,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var I={};I.importmodule=W("importmodule","tag",["string","builtin"]),I.documentclass=W("documentclass","tag",["","atom"]),I.usepackage=W("usepackage","tag",["atom"]),I.begin=W("begin","tag",["atom"]),I.end=W("end","tag",["atom"]),I.label=W("label","tag",["atom"]),I.ref=W("ref","tag",["atom"]),I.eqref=W("eqref","tag",["atom"]),I.cite=W("cite","tag",["atom"]),I.bibitem=W("bibitem","tag",["atom"]),I.Bibitem=W("Bibitem","tag",["atom"]),I.RBibitem=W("RBibitem","tag",["atom"]),I.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function M(O,L){O.f=L}function b(O,L){var y;if(O.match(/^\\[a-zA-Z@]+/)){var u=O.current().slice(1);return y=I.hasOwnProperty(u)?I[u]:I.DEFAULT,y=new y,K(L,y),M(L,_),y.style}if(O.match(/^\\[$&%#{}_]/))return"tag";if(O.match(/^\\[,;!\/\\]/))return"tag";if(O.match("\\["))return M(L,function(s,d){return A(s,d,"\\]")}),"keyword";if(O.match("\\("))return M(L,function(s,d){return A(s,d,"\\)")}),"keyword";if(O.match("$$"))return M(L,function(s,d){return A(s,d,"$$")}),"keyword";if(O.match("$"))return M(L,function(s,d){return A(s,d,"$")}),"keyword";var a=O.next();if(a=="%")return O.skipToEnd(),"comment";if(a=="}"||a=="]"){if(y=w(L),y)y.closeBracket(a),M(L,_);else return"error";return"bracket"}else return a=="{"||a=="["?(y=I.DEFAULT,y=new y,K(L,y),"bracket"):/\d/.test(a)?(O.eatWhile(/[\w.%]/),"atom"):(O.eatWhile(/[\w\-_]/),y=H(L),y.name=="begin"&&(y.argument=O.current()),y.styleIdentifier())}function A(O,L,y){if(O.eatSpace())return null;if(y&&O.match(y))return M(L,b),"keyword";if(O.match(/^\\[a-zA-Z@]+/))return"tag";if(O.match(/^[a-zA-Z]+/))return"variable-2";if(O.match(/^\\[$&%#{}_]/))return"tag";if(O.match(/^\\[,;!\/]/))return"tag";if(O.match(/^[\^_&]/))return"tag";if(O.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(O.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var u=O.next();return u=="{"||u=="}"||u=="["||u=="]"||u=="("||u==")"?"bracket":u=="%"?(O.skipToEnd(),"comment"):"error"}function _(O,L){var y=O.peek(),u;return y=="{"||y=="["?(u=w(L),u.openBracket(y),O.eat(y),M(L,b),"bracket"):/[ \t\r]/.test(y)?(O.eat(y),null):(M(L,b),P(L),b(O,L))}return{startState:function(){var O=D.inMathMode?function(L,y){return A(L,y)}:b;return{cmdState:[],f:O}},copyState:function(O){return{cmdState:O.cmdState.slice(),f:O.f}},token:function(O,L){return L.f(O,L)},blankLine:function(O){O.f=b,O.cmdState.length=0},lineComment:"%"}}),ae.defineMIME("text/x-stex","stex"),ae.defineMIME("text/x-latex","stex")})},"19Vz":function(Ft,yt,ne){(function(ae){ae(ne("VrN/"))})(function(ae){ae.defineOption("placeholder","",function(W,I,M){var b=M&&M!=ae.Init;if(I&&!b)W.on("blur",w),W.on("change",P),W.on("swapDoc",P),ae.on(W.getInputField(),"compositionupdate",W.state.placeholderCompose=function(){K(W)}),P(W);else if(!I&&b){W.off("blur",w),W.off("change",P),W.off("swapDoc",P),ae.off(W.getInputField(),"compositionupdate",W.state.placeholderCompose),X(W);var A=W.getWrapperElement();A.className=A.className.replace(" CodeMirror-empty","")}I&&!W.hasFocus()&&w(W)});function X(W){W.state.placeholder&&(W.state.placeholder.parentNode.removeChild(W.state.placeholder),W.state.placeholder=null)}function D(W){X(W);var I=W.state.placeholder=document.createElement("pre");I.style.cssText="height: 0; overflow: visible",I.style.direction=W.getOption("direction"),I.className="CodeMirror-placeholder CodeMirror-line-like";var M=W.getOption("placeholder");typeof M=="string"&&(M=document.createTextNode(M)),I.appendChild(M),W.display.lineSpace.insertBefore(I,W.display.lineSpace.firstChild)}function K(W){setTimeout(function(){var I=!1,M=W.getInputField();M.nodeName=="TEXTAREA"?I=!M.value:W.lineCount()==1&&(I=!/[^\u200b]/.test(M.querySelector(".CodeMirror-line").textContent)),I?D(W):X(W)},20)}function w(W){H(W)&&D(W)}function P(W){var I=W.getWrapperElement(),M=H(W);I.className=I.className.replace(" CodeMirror-empty","")+(M?" CodeMirror-empty":""),M?D(W):X(W)}function H(W){return W.lineCount()===1&&W.getLine(0)===""}})},"1eCo":function(Ft,yt,ne){(function(ae){ae(ne("VrN/"))})(function(ae){"use strict";var X={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},D={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};ae.defineMode("xml",function(K,w){var P=K.indentUnit,H={},W=w.htmlMode?X:D;for(var I in W)H[I]=W[I];for(var I in w)H[I]=w[I];var M,b;function A(o,S){function v(z){return S.tokenize=z,z(o,S)}var T=o.next();if(T=="<")return o.eat("!")?o.eat("[")?o.match("CDATA[")?v(L("atom","]]>")):null:o.match("--")?v(L("comment","-->")):o.match("DOCTYPE",!0,!0)?(o.eatWhile(/[\w\._\-]/),v(y(1))):null:o.eat("?")?(o.eatWhile(/[\w\._\-]/),S.tokenize=L("meta","?>"),"meta"):(M=o.eat("/")?"closeTag":"openTag",S.tokenize=_,"tag bracket");if(T=="&"){var N;return o.eat("#")?o.eat("x")?N=o.eatWhile(/[a-fA-F\d]/)&&o.eat(";"):N=o.eatWhile(/[\d]/)&&o.eat(";"):N=o.eatWhile(/[\w\.\-:]/)&&o.eat(";"),N?"atom":"error"}else return o.eatWhile(/[^&<]/),null}A.isInText=!0;function _(o,S){var v=o.next();if(v==">"||v=="/"&&o.eat(">"))return S.tokenize=A,M=v==">"?"endTag":"selfcloseTag","tag bracket";if(v=="=")return M="equals",null;if(v=="<"){S.tokenize=A,S.state=d,S.tagName=S.tagStart=null;var T=S.tokenize(o,S);return T?T+" tag error":"tag error"}else return/[\'\"]/.test(v)?(S.tokenize=O(v),S.stringStartCol=o.column(),S.tokenize(o,S)):(o.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function O(o){var S=function(v,T){for(;!v.eol();)if(v.next()==o){T.tokenize=_;break}return"string"};return S.isInAttribute=!0,S}function L(o,S){return function(v,T){for(;!v.eol();){if(v.match(S)){T.tokenize=A;break}v.next()}return o}}function y(o){return function(S,v){for(var T;(T=S.next())!=null;){if(T=="<")return v.tokenize=y(o+1),v.tokenize(S,v);if(T==">")if(o==1){v.tokenize=A;break}else return v.tokenize=y(o-1),v.tokenize(S,v)}return"meta"}}function u(o,S,v){this.prev=o.context,this.tagName=S,this.indent=o.indented,this.startOfLine=v,(H.doNotIndent.hasOwnProperty(S)||o.context&&o.context.noIndent)&&(this.noIndent=!0)}function a(o){o.context&&(o.context=o.context.prev)}function s(o,S){for(var v;;){if(!o.context)return;if(v=o.context.tagName,!H.contextGrabbers.hasOwnProperty(v)||!H.contextGrabbers[v].hasOwnProperty(S))return;a(o)}}function d(o,S,v){return o=="openTag"?(v.tagStart=S.column(),E):o=="closeTag"?g:d}function E(o,S,v){return o=="word"?(v.tagName=S.current(),b="tag",x):H.allowMissingTagName&&o=="endTag"?(b="tag bracket",x(o,S,v)):(b="error",E)}function g(o,S,v){if(o=="word"){var T=S.current();return v.context&&v.context.tagName!=T&&H.implicitlyClosed.hasOwnProperty(v.context.tagName)&&a(v),v.context&&v.context.tagName==T||H.matchClosing===!1?(b="tag",m):(b="tag error",k)}else return H.allowMissingTagName&&o=="endTag"?(b="tag bracket",m(o,S,v)):(b="error",k)}function m(o,S,v){return o!="endTag"?(b="error",m):(a(v),d)}function k(o,S,v){return b="error",m(o,S,v)}function x(o,S,v){if(o=="word")return b="attribute",h;if(o=="endTag"||o=="selfcloseTag"){var T=v.tagName,N=v.tagStart;return v.tagName=v.tagStart=null,o=="selfcloseTag"||H.autoSelfClosers.hasOwnProperty(T)?s(v,T):(s(v,T),v.context=new u(v,T,N==v.indented)),d}return b="error",x}function h(o,S,v){return o=="equals"?p:(H.allowMissing||(b="error"),x(o,S,v))}function p(o,S,v){return o=="string"?c:o=="word"&&H.allowUnquoted?(b="string",x):(b="error",x(o,S,v))}function c(o,S,v){return o=="string"?c:x(o,S,v)}return{startState:function(o){var S={tokenize:A,state:d,indented:o||0,tagName:null,tagStart:null,context:null};return o!=null&&(S.baseIndent=o),S},token:function(o,S){if(!S.tagName&&o.sol()&&(S.indented=o.indentation()),o.eatSpace())return null;M=null;var v=S.tokenize(o,S);return(v||M)&&v!="comment"&&(b=null,S.state=S.state(M||v,o,S),b&&(v=b=="error"?v+" error":b)),v},indent:function(o,S,v){var T=o.context;if(o.tokenize.isInAttribute)return o.tagStart==o.indented?o.stringStartCol+1:o.indented+P;if(T&&T.noIndent)return ae.Pass;if(o.tokenize!=_&&o.tokenize!=A)return v?v.match(/^(\s*)/)[0].length:0;if(o.tagName)return H.multilineTagIndentPastTag!==!1?o.tagStart+o.tagName.length+2:o.tagStart+P*(H.multilineTagIndentFactor||1);if(H.alignCDATA&&/<!\[CDATA\[/.test(S))return 0;var N=S&&/^<(\/)?([\w_:\.-]*)/.exec(S);if(N&&N[1])for(;T;)if(T.tagName==N[2]){T=T.prev;break}else if(H.implicitlyClosed.hasOwnProperty(T.tagName))T=T.prev;else break;else if(N)for(;T;){var z=H.contextGrabbers[T.tagName];if(z&&z.hasOwnProperty(N[2]))T=T.prev;else break}for(;T&&T.prev&&!T.startOfLine;)T=T.prev;return T?T.indent+P:o.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:H.htmlMode?"html":"xml",helperType:H.htmlMode?"html":"xml",skipAttribute:function(o){o.state==p&&(o.state=x)},xmlCurrentTag:function(o){return o.tagName?{name:o.tagName,close:o.type=="closeTag"}:null},xmlCurrentContext:function(o){for(var S=[],v=o.context;v;v=v.prev)v.tagName&&S.push(v.tagName);return S.reverse()}}}),ae.defineMIME("text/xml","xml"),ae.defineMIME("application/xml","xml"),ae.mimeModes.hasOwnProperty("text/html")||ae.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"3TLj":function(Ft,yt,ne){Ft.exports={flex_box_center:"flex_box_center____TbjK",flex_space_between:"flex_space_between___2coRZ",flex_box_vertical_center:"flex_box_vertical_center___3NVFE",flex_box_center_end:"flex_box_center_end___3GKhy",flex_box_column:"flex_box_column___2SLfn",bg:"bg___3oKWe",formWrap:"formWrap___2Y1wq"}},"5v/u":function(Ft,yt,ne){"use strict";ne.r(yt);var ae=ne("5NDa"),X=ne("5rEg"),D=ne("2qtc"),K=ne("kLXV"),w=ne("9og8"),P=ne("k1fw"),H=ne("y8nQ"),W=ne("Vl3Y"),I=ne("tJVT"),M=ne("PpiC"),b=ne("Znn+"),A=ne("ZTPi"),_=ne("WmNS"),O=ne.n(_),L=ne("q1tI"),y=ne.n(L),u=ne("9kvl"),a=ne("Ot1p"),s=ne("HBuW"),d=ne("3TLj"),E=ne.n(d),g=ne("xKgJ"),m=ne("UqFu"),k=ne("9ZNV"),x=ne("nuEh"),h=A.a.TabPane,p=function(o){var S,v,T=o.shixunsDetail,N=o.dispatch,z=o.match,Y=o.practiceSetting,ee=Object(M.a)(o,["shixunsDetail","dispatch","match","practiceSetting"]),G=W.a.useForm(),j=Object(I.a)(G,1),te=j[0],de=Object(L.useState)({}),be=Object(I.a)(de,2),Oe=be[0],Ge=be[1],Me=T.challengesNew,Ie=Object(L.useRef)(null),Ue=Y.selectQuestionParams,Pe=Y.id,Te=Y.newQuestion,se=Object(L.useState)(!0),Fe=Object(I.a)(se,2),dt=Fe[0],it=Fe[1];Object(L.useEffect)(function(){it(!0),N({type:"shixunsDetail/getChallengesNew",payload:Object(P.a)({},z.params)}),it(!1)},[z.params]);var ot=function(){var st=Object(w.a)(O.a.mark(function qe(Ve){var Ke,ht,ut;return O.a.wrap(function(nt){for(;;)switch(nt.prev=nt.next){case 0:return Ke=Object(P.a)({},Oe),ht=!(!Ve.unity_3d_routes||Ve.unity_3d_routes==""),Ke.identifier=z.params.id,Ke.st=1,nt.next=6,Object(s.b)(Object(P.a)(Object(P.a)({},Ke),{},{unity_3d_routes:ht?Ve.unity_3d_routes:null,unity_3d:ht}));case 6:ut=nt.sent,ut.status===1&&(u.d.replace("/shixuns/".concat(z.params.id,"/edit/").concat(ut.challenge_id,"/editquestion?tab=2")),setTimeout(function(){N({type:"practiceSetting/setParams",payload:{newQuestion:null}}),N({type:"practiceSetting/setUpdateIndex"})},200));case 8:case"end":return nt.stop()}},qe)}));return function(Ve){return st.apply(this,arguments)}}(),ct=function(){rt()},je=function(qe){clearTimeout(Ie.current),Ie.current=setTimeout(function(){"subject"in qe&&Te&&N({type:"practiceSetting/setParams",payload:{newQuestion:{st:1,name:qe==null?void 0:qe.subject}}});var Ve=te.getFieldsValue(),Ke=Ve.subject,ht=Ve.task_pass;Ke!==""||ht!==Object(m.a)(Me.task_pass_default)?N({type:"practiceSetting/setSideBarTabs",payload:{confirmLeave:!0}}):N({type:"practiceSetting/setSideBarTabs",payload:{confirmLeave:!1}})},500)},Ye=function(qe){Ge(Object(P.a)({},te.getFieldsValue())),je(qe)},rt=function(){var qe,Ve=function(){u.d.push("/shixuns/".concat(Pe,"/challenges")),N({type:"practiceSetting/setSideBarTabs",payload:{confirmLeave:!1}})};Y!=null&&(qe=Y.sideBar)!==null&&qe!==void 0&&qe.confirmLeave?K.a.confirm({title:"\u79BB\u5F00\u6B64\u9875\u63D0\u793A",content:"\u7CFB\u7EDF\u53EF\u80FD\u4E0D\u4F1A\u4FDD\u5B58\u60A8\u6240\u505A\u7684\u66F4\u6539\u3002",okText:"\u79BB\u5F00",cancelText:"\u53D6\u6D88",onOk:function(){Ve()}}):Ve()};return y.a.createElement("section",{className:E.a.bg},y.a.createElement(A.a,{activeKey:"1"},y.a.createElement(h,{tab:"\u672C\u5173\u4EFB\u52A1",key:"1"},y.a.createElement(W.a,{form:te,className:E.a.formWrap,scrollToFirstError:!0,layout:"vertical",onValuesChange:Ye,onFinish:ot},y.a.createElement("div",{className:E.a.fieldWrap},y.a.createElement(W.a.Item,{initialValue:"",name:"subject",label:"\u4EFB\u52A1\u540D\u79F0:",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EFB\u52A1\u540D\u79F0"}]},y.a.createElement(X.a,{bordered:!1,maxLength:60,suffix:"".concat(((S=Oe.subject)===null||S===void 0?void 0:S.length)||0,"/60"),placeholder:"\u4F8B\u5982\uFF1A\u4ECEPython\u7A0B\u5E8F\u8BBE\u8BA1-\u5165\u95E8\u7CBE\u901A"}))),y.a.createElement("div",{className:E.a.mdWrap},y.a.createElement(W.a.Item,{name:"task_pass",label:"\u8FC7\u5173\u4EFB\u52A1:",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4F5C\u4E1A\u7684\u7B80\u4ECB"},{max:35e3,message:"\u6700\u5927\u9650\u523635000\u4E2A\u5B57\u7B26"}]},y.a.createElement(a.a,{watch:!0,defaultValue:Me.task_pass_default}))),Object(g.o)()&&y.a.createElement("div",{className:E.a.fieldWrap},y.a.createElement(W.a.Item,{initialValue:"",name:"unity_3d_routes",label:"\u5D4C\u5165\u7B2C\u4E09\u65B9\u5E73\u53F0:"},y.a.createElement(X.a,{bordered:!1,maxLength:60,suffix:"".concat(((v=Oe.unity_3d_routes)===null||v===void 0?void 0:v.length)||0,"/60"),placeholder:"\u8BF7\u8F93\u5165\u7B2C\u4E09\u65B9\u5E73\u53F0\u5730\u5740"}))),y.a.createElement(W.a.Item,{noStyle:!0},y.a.createElement(k.a,{okButtonProps:{htmlType:"submit"},className:"customFixedButton",onCancel:ct}))))),y.a.createElement(x.a,{loading:dt}))};yt.default=Object(u.a)(function(c){var o=c.shixunsDetail,S=c.practiceSetting;return{shixunsDetail:o,practiceSetting:S}})(p)},"7Cbv":function(Ft,yt,ne){"use strict";var ae=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),X=new Uint8Array(16);function D(){if(!ae)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ae(X)}var K=/^(?:[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 w(_){return typeof _=="string"&&K.test(_)}for(var P=w,H=[],W=0;W<256;++W)H.push((W+256).toString(16).substr(1));function I(_){var O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,L=(H[_[O+0]]+H[_[O+1]]+H[_[O+2]]+H[_[O+3]]+"-"+H[_[O+4]]+H[_[O+5]]+"-"+H[_[O+6]]+H[_[O+7]]+"-"+H[_[O+8]]+H[_[O+9]]+"-"+H[_[O+10]]+H[_[O+11]]+H[_[O+12]]+H[_[O+13]]+H[_[O+14]]+H[_[O+15]]).toLowerCase();if(!P(L))throw TypeError("Stringified UUID is invalid");return L}var M=I;function b(_,O,L){_=_||{};var y=_.random||(_.rng||D)();if(y[6]=y[6]&15|64,y[8]=y[8]&63|128,O){L=L||0;for(var u=0;u<16;++u)O[L+u]=y[u];return O}return M(y)}var A=yt.a=b},"7ahc":function(Ft,yt,ne){"use strict";ne.d(yt,"a",function(){return E});var ae=ne("k1fw"),X=ne("0Owb"),D=ne("+L6B"),K=ne("2/Rp"),w=ne("y8nQ"),P=ne("Vl3Y"),H=ne("tJVT"),W=ne("OaEy"),I=ne("2fM7"),M=ne("q1tI"),b=ne.n(M),A=ne("VrN/"),_=ne.n(A),O=ne("p77/"),L=ne.n(O),y=ne("c5Ni"),u=ne.n(y),a=I.a.Option,s={labelCol:{span:4},wrapperCol:{span:20}},d={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"]};yt.b=function(g){var m=g.callback,k=g.onCancel,x=Object(M.useState)("python"),h=Object(H.a)(x,2),p=h[0],c=h[1];function o(v){c(d[v][1])}function S(v){m(v)}return b.a.createElement(P.a,Object(X.a)({},s,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:S}),b.a.createElement(P.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},b.a.createElement(I.a,{onChange:o},Object.keys(d).map(function(v){return b.a.createElement(a,{key:v,value:v},d[v][0])}))),b.a.createElement(P.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},b.a.createElement(E,{mode:p})),b.a.createElement("div",{className:"flex-container flex-end"},b.a.createElement(K.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),b.a.createElement(K.a,{type:"ghost",onClick:k},"\u53D6\u6D88")))};function E(g){var m=g.value,k=g.onChange,x=g.mode,h=g.options,p=h===void 0?{}:h,c=Object(M.useRef)(),o=Object(M.useState)(),S=Object(H.a)(o,2),v=S[0],T=S[1];return Object(M.useEffect)(function(){if(v){function N(z){var Y=z.getValue();k&&k(Y)}return v.on("change",N),function(){v.off("change",N)}}},[v,k]),Object(M.useEffect)(function(){v&&v.setOption("mode",x)},[v,x]),Object(M.useEffect)(function(){v&&((m!==v.getValue()||m==="")&&setTimeout(function(){v.setValue(m||" ")},300))},[v,m]),Object(M.useEffect)(function(){if(c.current&&!v){var N=_.a.fromTextArea(c.current,Object(ae.a)({mode:x,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},p));T(N)}},[c.current,v]),b.a.createElement("div",{className:"my-codemirror-container"},b.a.createElement("textarea",{ref:c}))}},"7ixt":function(Ft,yt,ne){"use strict";ne.d(yt,"a",function(){return D});var ae={adjustX:1,adjustY:1},X=[0,0],D={left:{points:["cr","cl"],overflow:ae,offset:[-4,0],targetOffset:X},right:{points:["cl","cr"],overflow:ae,offset:[4,0],targetOffset:X},top:{points:["bc","tc"],overflow:ae,offset:[0,-4],targetOffset:X},bottom:{points:["tc","bc"],overflow:ae,offset:[0,4],targetOffset:X},topLeft:{points:["bl","tl"],overflow:ae,offset:[0,-4],targetOffset:X},leftTop:{points:["tr","tl"],overflow:ae,offset:[-4,0],targetOffset:X},topRight:{points:["br","tr"],overflow:ae,offset:[0,-4],targetOffset:X},rightTop:{points:["tl","tr"],overflow:ae,offset:[4,0],targetOffset:X},bottomRight:{points:["tr","br"],overflow:ae,offset:[0,4],targetOffset:X},rightBottom:{points:["bl","br"],overflow:ae,offset:[4,0],targetOffset:X},bottomLeft:{points:["tl","bl"],overflow:ae,offset:[0,4],targetOffset:X},leftBottom:{points:["br","bl"],overflow:ae,offset:[-4,0],targetOffset:X}},K=D},"8EBN":function(Ft,yt,ne){(function(ae){ae(ne("VrN/"))})(function(ae){"use strict";ae.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 X=0;X<ae.modeInfo.length;X++){var D=ae.modeInfo[X];D.mimes&&(D.mime=D.mimes[0])}ae.findModeByMIME=function(K){K=K.toLowerCase();for(var w=0;w<ae.modeInfo.length;w++){var P=ae.modeInfo[w];if(P.mime==K)return P;if(P.mimes){for(var H=0;H<P.mimes.length;H++)if(P.mimes[H]==K)return P}}if(/\+xml$/.test(K))return ae.findModeByMIME("application/xml");if(/\+json$/.test(K))return ae.findModeByMIME("application/json")},ae.findModeByExtension=function(K){K=K.toLowerCase();for(var w=0;w<ae.modeInfo.length;w++){var P=ae.modeInfo[w];if(P.ext){for(var H=0;H<P.ext.length;H++)if(P.ext[H]==K)return P}}},ae.findModeByFileName=function(K){for(var w=0;w<ae.modeInfo.length;w++){var P=ae.modeInfo[w];if(P.file&&P.file.test(K))return P}var H=K.lastIndexOf("."),W=H>-1&&K.substring(H+1,K.length);if(W)return ae.findModeByExtension(W)},ae.findModeByName=function(K){K=K.toLowerCase();for(var w=0;w<ae.modeInfo.length;w++){var P=ae.modeInfo[w];if(P.name.toLowerCase()==K)return P;if(P.alias){for(var H=0;H<P.alias.length;H++)if(P.alias[H].toLowerCase()==K)return P}}}})},"8hTe":function(Ft,yt,ne){Ft.exports={button:"button___1wy9m"}},"9Bee":function(Ft,yt,ne){"use strict";var ae=ne("DYRE"),X=ne("zeV3"),D=ne("+L6B"),K=ne("2/Rp"),w=ne("k1fw"),P=ne("9og8"),H=ne("tJVT"),W=ne("WmNS"),I=ne.n(W),M=ne("q1tI"),b=ne.n(M),A=ne("vg9a"),_=ne("DlQD"),O=ne.n(_),L=ne("rUJ1");function y(F,l){var f=F.match(/^(\s+)(?:```)/);if(f===null)return l;var R=f[1];return l.split(`
`).map(function(Q){var B=Q.match(/^\s+/);if(B===null)return Q;var ve=Object(H.a)(B,1),ze=ve[0];return ze.length>=R.length?Q.slice(R.length):Q}).join(`
`)}var u=[],a=["<ul>"],s=new O.a.Renderer,d=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function E(){u.length=0,a=["<ul>"]}var g={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function m(F,l,f,R){if(l>=F.length||F[l].level<=f)return l;var Q=F[l];R.push("<li><a href='#"+Q.anchor+"'>"+Q.text+"</a>"),l++;var B=[];return l=m(F,l,Q.level,B),B.length>0&&(R.push("<ul>"),B.forEach(function(ve){R.push(ve)}),R.push("</ul>")),R.push("</li>"),l=m(F,l,f,R),l}function k(){return m(u,0,0,a),a.push("</ul>"),a.join("")}var x={heading:function(l){var f=d.exec(l);if(f)return{type:"heading",raw:f[0],depth:f[1].length,text:f[2]}},fences:function(l){var f=this.rules.block.fences.exec(l);if(f){var R=f[0],Q=y(R,f[3]||""),B=f[2]?f[2].trim():f[2];if(["latex","katex","math"].indexOf(B)>=0){var ve=c(),ze=Q;Q=ve,o[ve]={type:"block",expression:ze}}return{type:"code",raw:R,lang:B,text:Q}}}},h=/(?:\${2})([^\n`]+?)(?:\${2})/gi,p=0,c=function(){return"__special_katext_id_".concat(p++,"__")},o={};function S(){return o}function v(){p=0,o={}}function T(F){return F=F.replace(h,function(l,f){var R=c();return o[R]={type:"inline",expression:f},R}),F}var N=s.listitem;s.listitem=function(F){return N(T(F))};var z=s.paragraph;s.paragraph=function(F){return z(T(F))};var Y=s.tablecell;s.tablecell=function(F,l){return Y(T(F),l)},s.code=function(F,l,f){var R=(l||"").match(/\S*/)[0];return R?["latex","katex","math"].indexOf(R)>=0?"<p class='editormd-tex'>".concat(F,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(l,'">').concat(f?F:Object(L.escape)(F,!0),`</code></pre>
`):'<pre class="prettyprint linenums"><code>'+(f?F:Object(L.escape)(F,!0))+"</code></pre>"},s.heading=function(F,l,f){var R=this.options.headerPrefix+f.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return u.push({anchor:R,level:l,text:F}),"<h"+l+' id="'+R+'">'+F+"</h"+l+">"},O.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),O.a.use({tokenizer:x,renderer:s});var ee=O.a,G=ne("SJMd"),j=ne("ulZh"),te=ne.n(j),de=ne("m3rI"),be=ne("Oy/b"),Oe=ne("p5ED"),Ge=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 Me=function(F,l){return(Me=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(f,R){f.__proto__=R}||function(f,R){for(var Q in R)Object.prototype.hasOwnProperty.call(R,Q)&&(f[Q]=R[Q])})(F,l)};function Ie(F,l){function f(){this.constructor=F}Me(F,l),F.prototype=l===null?Object.create(l):(f.prototype=l.prototype,new f)}function Ue(F,l,f,R){return new(f||(f=Promise))(function(Q,B){function ve(At){try{lt(R.next(At))}catch($e){B($e)}}function ze(At){try{lt(R.throw(At))}catch($e){B($e)}}function lt(At){var $e;At.done?Q(At.value):($e=At.value,$e instanceof f?$e:new f(function(Rt){Rt($e)})).then(ve,ze)}lt((R=R.apply(F,l||[])).next())})}function Pe(F,l){var f,R,Q,B,ve={label:0,sent:function(){if(1&Q[0])throw Q[1];return Q[1]},trys:[],ops:[]};return B={next:ze(0),throw:ze(1),return:ze(2)},typeof Symbol=="function"&&(B[Symbol.iterator]=function(){return this}),B;function ze(lt){return function(At){return function($e){if(f)throw new TypeError("Generator is already executing.");for(;ve;)try{if(f=1,R&&(Q=2&$e[0]?R.return:$e[0]?R.throw||((Q=R.return)&&Q.call(R),0):R.next)&&!(Q=Q.call(R,$e[1])).done)return Q;switch(R=0,Q&&($e=[2&$e[0],Q.value]),$e[0]){case 0:case 1:Q=$e;break;case 4:return ve.label++,{value:$e[1],done:!1};case 5:ve.label++,R=$e[1],$e=[0];continue;case 7:$e=ve.ops.pop(),ve.trys.pop();continue;default:if(!(Q=ve.trys,(Q=Q.length>0&&Q[Q.length-1])||$e[0]!==6&&$e[0]!==2)){ve=0;continue}if($e[0]===3&&(!Q||$e[1]>Q[0]&&$e[1]<Q[3])){ve.label=$e[1];break}if($e[0]===6&&ve.label<Q[1]){ve.label=Q[1],Q=$e;break}if(Q&&ve.label<Q[2]){ve.label=Q[2],ve.ops.push($e);break}Q[2]&&ve.ops.pop(),ve.trys.pop();continue}$e=l.call(F,ve)}catch(Rt){$e=[6,Rt],R=0}finally{f=Q=0}if(5&$e[0])throw $e[1];return{value:$e[0]?$e[1]:void 0,done:!0}}([lt,At])}}}function Te(){for(var F=0,l=0,f=arguments.length;l<f;l++)F+=arguments[l].length;var R=Array(F),Q=0;for(l=0;l<f;l++)for(var B=arguments[l],ve=0,ze=B.length;ve<ze;ve++,Q++)R[Q]=B[ve];return R}var se=function(){function F(){}return F.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},F.setAttributes=function(l,f){for(var R=0,Q=f;R<Q.length;R++){var B=Q[R],ve=B[0],ze=B[1];l.setAttribute(ve,ze)}},F.createRect=function(l,f,R){var Q=document.createElementNS("http://www.w3.org/2000/svg","rect");return Q.setAttribute("width",l.toString()),Q.setAttribute("height",f.toString()),R&&F.setAttributes(Q,R),Q},F.createLine=function(l,f,R,Q,B){var ve=document.createElementNS("http://www.w3.org/2000/svg","line");return ve.setAttribute("x1",l.toString()),ve.setAttribute("y1",f.toString()),ve.setAttribute("x2",R.toString()),ve.setAttribute("y2",Q.toString()),B&&F.setAttributes(ve,B),ve},F.createPolygon=function(l,f){var R=document.createElementNS("http://www.w3.org/2000/svg","polygon");return R.setAttribute("points",l),f&&F.setAttributes(R,f),R},F.createCircle=function(l,f){var R=document.createElementNS("http://www.w3.org/2000/svg","circle");return R.setAttribute("cx",(l/2).toString()),R.setAttribute("cy",(l/2).toString()),R.setAttribute("r",l.toString()),f&&F.setAttributes(R,f),R},F.createEllipse=function(l,f,R){var Q=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return Q.setAttribute("cx",(l/2).toString()),Q.setAttribute("cy",(f/2).toString()),Q.setAttribute("rx",(l/2).toString()),Q.setAttribute("ry",(f/2).toString()),R&&F.setAttributes(Q,R),Q},F.createGroup=function(l){var f=document.createElementNS("http://www.w3.org/2000/svg","g");return l&&F.setAttributes(f,l),f},F.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},F.createMarker=function(l,f,R,Q,B,ve,ze){var lt=document.createElementNS("http://www.w3.org/2000/svg","marker");return F.setAttributes(lt,[["id",l],["orient",f],["markerWidth",R.toString()],["markerHeight",Q.toString()],["refX",B.toString()],["refY",ve.toString()]]),lt.appendChild(ze),lt},F.createText=function(l){var f=document.createElementNS("http://www.w3.org/2000/svg","text");return f.setAttribute("x","0"),f.setAttribute("y","0"),l&&F.setAttributes(f,l),f},F.createTSpan=function(l,f){var R=document.createElementNS("http://www.w3.org/2000/svg","tspan");return R.textContent=l,f&&F.setAttributes(R,f),R},F.createImage=function(l){var f=document.createElementNS("http://www.w3.org/2000/svg","image");return l&&F.setAttributes(f,l),f},F.createPoint=function(l,f){var R=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return R.x=l,R.y=f,R},F.createPath=function(l,f){var R=document.createElementNS("http://www.w3.org/2000/svg","path");return R.setAttribute("d",l),f&&F.setAttributes(R,f),R},F}(),Fe=function(){function F(){}return F.addKey=function(l){F.key=l},Object.defineProperty(F,"isLicensed",{get:function(){return!!F.key&&new RegExp(/^MJS2-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(F.key)},enumerable:!1,configurable:!0}),F}(),dt=function(){function F(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return F.prototype.rasterize=function(l,f,R){var Q=this;return new Promise(function(B){var ve=R!==void 0?R:document.createElement("canvas");l===null&&(Q.markersOnly=!0,Q.naturalSize=!1);var ze=document.createElementNS("http://www.w3.org/2000/svg","svg");ze.setAttribute("xmlns","http://www.w3.org/2000/svg"),ze.setAttribute("width",f.width.baseVal.valueAsString),ze.setAttribute("height",f.height.baseVal.valueAsString),ze.setAttribute("viewBox","0 0 "+f.viewBox.baseVal.width.toString()+" "+f.viewBox.baseVal.height.toString()),ze.innerHTML=f.innerHTML,Q.naturalSize===!0?(ze.width.baseVal.value=l.naturalWidth,ze.height.baseVal.value=l.naturalHeight):Q.width!==void 0&&Q.height!==void 0&&(ze.width.baseVal.value=Q.width,ze.height.baseVal.value=Q.height),ve.width=ze.width.baseVal.value,ve.height=ze.height.baseVal.value;var lt=ze.outerHTML,At=ve.getContext("2d");Q.markersOnly!==!0&&At.drawImage(l,0,0,ve.width,ve.height);var $e=window.URL,Rt=new Image(ve.width,ve.height);Rt.setAttribute("crossOrigin","anonymous");var gr=new Blob([lt],{type:"image/svg+xml"}),Dr=$e.createObjectURL(gr);Rt.onload=function(){At.drawImage(Rt,0,0),$e.revokeObjectURL(Dr);var Ln=ve.toDataURL(Q.imageType,Q.imageQuality);B(Ln)},Rt.src=Dr})},F}(),it=function(){},ot=function(){function F(l){this._classNamePrefixBase="__markerjs2_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+l+"_"}return Object.defineProperty(F.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(F.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(F.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"fade_out"},enumerable:!1,configurable:!0}),F.prototype.addClass=function(l){return this.styleSheet===void 0&&this.addStyleSheet(),l.name=""+this.classNamePrefix+l.localName,this.classes.push(l),this.styleSheet.sheet.insertRule("."+l.name+" {"+l.style+"}",this.styleSheet.sheet.cssRules.length),l},F.prototype.addRule=function(l){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(l),this.styleSheet.sheet.insertRule(l.selector+" {"+l.style+"}",this.styleSheet.sheet.cssRules.length)},F.prototype.addStyleSheet=function(){var l;this.styleSheet=document.createElement("style"),((l=this.styleSheetRoot)!==null&&l!==void 0?l:document.head).appendChild(this.styleSheet),this.addRule(new ct("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new ct("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
from {
opacity: 0;
}
to {
opacity: 1;
}
`)),this.addRule(new ct("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
from {
opacity: 1;
}
to {
opacity: 0;
}
`)),this.addClass(new je("fade_in",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
`)),this.addClass(new je("fade_out",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
`))},F.prototype.removeStyleSheet=function(){var l;this.styleSheet&&(((l=this.styleSheetRoot)!==null&&l!==void 0?l:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},F}(),ct=function(F,l){this.selector=F,this.style=l},je=function(F,l){this.localName=F,this.style=l},Ye=function(){function F(l,f,R,Q,B){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=l,this.displayMode=f,this.markerItems=R,this.uiStyleSettings=Q,this.styles=B,this.addStyles(),this.adjustLayout=this.adjustLayout.bind(this),this.overflowButtonClicked=this.overflowButtonClicked.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this)}return F.prototype.show=function(l){var f=this;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=l,this.uiContainer.className=this.toolbarStyleClass.name+" "+this.styles.fadeInAnimationClassName+" "+(this.uiStyleSettings.toolbarStyleColorsClassName?this.uiStyleSettings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name);var R=document.createElement("div");R.className=this.toolbarBlockStyleClass.name,R.style.whiteSpace="nowrap",this.uiContainer.appendChild(R),this.addActionButton(R,'<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(R,'<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(R,'<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(R,'<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(R,'<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(R,'<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(R,'<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(R,'<svg viewBox="0 0 24 24"><path d="M18.13 12l1.26-1.26c.44-.44 1-.68 1.61-.74V9l-6-6H5c-1.11 0-2 .89-2 2v14a2 2 0 002 2h6v-1.87l.13-.13H5V5h7v7h6.13M14 4.5l5.5 5.5H14V4.5m5.13 9.33l2.04 2.04L15.04 22H13v-2.04l6.13-6.13m3.72.36l-.98.98-2.04-2.04.98-.98c.19-.2.52-.2.72 0l1.32 1.32c.2.2.2.53 0 .72z"/></svg>',"notes"),this.markerButtonBlock=document.createElement("div"),this.markerButtonBlock.className=this.toolbarBlockStyleClass.name,this.markerButtonBlock.style.flexGrow="2",this.markerButtonBlock.style.textAlign="center",this.uiContainer.appendChild(this.markerButtonBlock),this.markerButtonOverflowBlock=document.createElement("div"),this.markerButtonOverflowBlock.className=this.toolbarOverflowBlockStyleClass.name+" "+(this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName?this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName:this.toolbarOverflowBlockStyleColorsClass.name),this.markerButtonOverflowBlock.style.display="none",this.uiContainer.appendChild(this.markerButtonOverflowBlock),this.markerItems&&(this.markerItems.forEach(function(B){var ve=document.createElement("div");ve.className=""+f.toolbarButtonStyleClass.name,ve.setAttribute("data-type-name",B.typeName),ve.innerHTML=B.icon,ve.addEventListener("click",function(){f.markerToolbarButtonClicked(ve,B)}),f.buttons.push(ve),f.markerButtons.push(ve)}),this.overflowButton=document.createElement("div"),this.overflowButton.className=this.toolbarButtonStyleClass.name+" "+(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name),this.overflowButton.innerHTML='<svg viewBox="0 0 24 24"><path d="M12 16a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2m0-6a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2m0-6a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2z"/></svg>',this.overflowButton.addEventListener("click",this.overflowButtonClicked),this.markerButtonBlock.appendChild(this.overflowButton));var Q=document.createElement("div");Q.className=this.toolbarBlockStyleClass.name,Q.style.whiteSpace="nowrap",Q.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(Q),this.addActionButton(Q,'<svg viewBox="0 0 24 24"><path d="M9 20.42l-6.21-6.21 2.83-2.83L9 14.77l9.88-9.89 2.83 2.83L9 20.42z"/></svg>',"render"),this.addActionButton(Q,'<svg viewBox="0 0 24 24"><path d="M20 6.91L17.09 4 12 9.09 6.91 4 4 6.91 9.09 12 4 17.09 6.91 20 12 14.91 17.09 20 20 17.09 14.91 12 20 6.91z"/></svg>',"close"),this.markerjsContainer.appendChild(this.uiContainer),this.setSelectMode(),this.setCurrentMarker(),this.adjustLayout()},F.prototype.addButtonClickListener=function(l){this.buttonClickListeners.push(l)},F.prototype.removeButtonClickListener=function(l){this.buttonClickListeners.indexOf(l)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(l),1)},F.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},F.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var l=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var f=0;f<this.markerButtons.length;f++)f<l||f===l&&this.markerButtons.length-1===l?this.markerButtonBlock.appendChild(this.markerButtons[f]):(f===l&&this.markerButtonBlock.appendChild(this.overflowButton),this.markerButtonOverflowBlock.appendChild(this.markerButtons[f]))}},F.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")},F.prototype.resetButtonStyles=function(){var l=this;this.buttons.forEach(function(f){f.className=f.className.replace(l.uiStyleSettings.toolbarButtonStyleColorsClassName?l.uiStyleSettings.toolbarButtonStyleColorsClassName:l.toolbarButtonStyleColorsClass.name,"").trim(),f.className=f.className.replace(l.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?l.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:l.toolbarActiveButtonStyleColorsClass.name,"").trim(),f.className+=" "+(l.uiStyleSettings.toolbarButtonStyleColorsClassName?l.uiStyleSettings.toolbarButtonStyleColorsClassName:l.toolbarButtonStyleColorsClass.name)})},F.prototype.addActionButton=function(l,f,R){var Q=this,B=document.createElement("div");switch(B.className=""+this.toolbarButtonStyleClass.name,B.innerHTML=f,B.setAttribute("data-action",R),B.addEventListener("click",function(){Q.actionToolbarButtonClicked(B,R)}),R){case"select":B.style.fill=this.uiStyleSettings.selectButtonColor;break;case"delete":case"clear":B.style.fill=this.uiStyleSettings.deleteButtonColor;break;case"undo":case"redo":B.style.fill=this.uiStyleSettings.selectButtonColor;break;case"render":B.style.fill=this.uiStyleSettings.okButtonColor;break;case"close":B.style.fill=this.uiStyleSettings.closeButtonColor}l.appendChild(B),this.buttons.push(B)},F.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new je("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 je("toolbar_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
box-shadow: 0px 3px rgba(33, 33, 33, 0.1);
`)),this.toolbarBlockStyleClass=this.styles.addClass(new je("toolbar-block",`
display: inline-block;
box-sizing: content-box;
`)),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new je("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 je("toolbar-overflow-block_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`));var l=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new je("toolbar_button",`
display: inline-block;
width: `+(this.uiStyleSettings.toolbarHeight-2*l)+`px;
height: `+(this.uiStyleSettings.toolbarHeight-2*l)+`px;
padding: `+l+`px;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new je("toolbar_button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new je("toolbar_active_button",`
fill: `+this.uiStyleSettings.toolbarColor+`;
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`)),this.styles.addRule(new ct("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`)),this.styles.addRule(new ct("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`))},F.prototype.markerToolbarButtonClicked=function(l,f){this.setActiveButton(l),this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(R){return R("marker",f)}),this.markerButtonOverflowBlock.style.display="none"},F.prototype.actionToolbarButtonClicked=function(l,f){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(R){return R("action",f)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},F.prototype.setActiveButton=function(l){this.resetButtonStyles(),l.className=l.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),l.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},F.prototype.setActiveMarkerButton=function(l){var f=this.markerButtons.find(function(R){return R.getAttribute("data-type-name")===l});f&&this.setActiveButton(f)},F.prototype.setCurrentMarker=function(l){var f=this;this.currentMarker=l,this.buttons.filter(function(R){return/delete|notes/.test(R.getAttribute("data-action"))}).forEach(function(R){f.currentMarker===void 0?(R.style.fillOpacity="0.4",R.style.pointerEvents="none"):(R.style.fillOpacity="1",R.style.pointerEvents="all")})},F}(),rt=function(){function F(l,f,R,Q){this.panels=[],this.panelButtons=[],this.markerjsContainer=l,this.displayMode=f,this.uiStyleSettings=R,this.styles=Q,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return F.prototype.addStyles=function(){var l;this.toolboxStyleClass=this.styles.addClass(new je("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 je("toolbox_colors",`
color: `+this.uiStyleSettings.toolboxColor+`;
`));var f=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new je("toolbox-button-row",`
display: flex;
cursor: default;
box-sizing: content-box;
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new je("toolbox-button-row_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new je("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 je("toolbox-panel-row_colors",`
background-color: `+((l=this.uiStyleSettings.toolboxBackgroundColor)!==null&&l!==void 0?l:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
`)),this.toolboxButtonStyleClass=this.styles.addClass(new je("toolbox_button",`
display: inline-block;
width: `+(this.uiStyleSettings.toolbarHeight-2*f)+`px;
height: `+(this.uiStyleSettings.toolbarHeight-2*f)+`px;
padding: `+f+`px;
box-sizing: content-box;
`)),this.toolboxButtonStyleColorsClass=this.styles.addClass(new je("toolbox-button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new je("toolbox-active-button_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`;
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.styles.addRule(new ct("."+this.toolboxButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`)),this.styles.addRule(new ct("."+this.toolboxButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`))},F.prototype.show=function(l){var f;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=l,this.uiContainer.className=this.toolboxStyleClass.name+" "+((f=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&f!==void 0?f:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},F.prototype.setPanelButtons=function(l){var f,R,Q=this;this.panels=l,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((f=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&f!==void 0?f:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+((R=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&R!==void 0?R:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(B){var ve;B.uiStyleSettings=Q.uiStyleSettings;var ze=document.createElement("div");ze.className=Q.toolboxButtonStyleClass.name+" "+((ve=Q.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&ve!==void 0?ve:Q.toolboxButtonStyleColorsClass.name),ze.innerHTML=B.icon,ze.title=B.title,ze.addEventListener("click",function(){Q.panelButtonClick(B)}),Q.panelButtons.push(ze),Q.buttonRow.appendChild(ze)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},F.prototype.panelButtonClick=function(l){var f=this,R=-1;if(l!==this.activePanel){R=this.panels.indexOf(l),this.panelRow.innerHTML="";var Q=l.getUi();Q.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(Q),this.panelRow.style.display="flex",this.panelRow.style.visibility="visible",this.panelRow.className=this.panelRow.className.replace(this.styles.fadeOutAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeInAnimationClassName,this.activePanel=l}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){f.displayMode==="inline"?f.panelRow.style.display="none":f.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(B,ve){var ze,lt;B.className=f.toolboxButtonStyleClass.name+" "+(ve===R?""+((ze=f.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&ze!==void 0?ze:f.toolboxActiveButtonStyleColorsClass.name):""+((lt=f.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&lt!==void 0?lt:f.toolboxButtonStyleColorsClass.name))})},F}(),st=function(F,l){this.title=F,this.icon=l},qe=function(F){function l(f,R,Q,B){var ve=F.call(this,f,B||'<svg viewBox="0 0 24 24"><path d="M17.5 12a1.5 1.5 0 01-1.5-1.5A1.5 1.5 0 0117.5 9a1.5 1.5 0 011.5 1.5 1.5 1.5 0 01-1.5 1.5m-3-4A1.5 1.5 0 0113 6.5 1.5 1.5 0 0114.5 5 1.5 1.5 0 0116 6.5 1.5 1.5 0 0114.5 8m-5 0A1.5 1.5 0 018 6.5 1.5 1.5 0 019.5 5 1.5 1.5 0 0111 6.5 1.5 1.5 0 019.5 8m-3 4A1.5 1.5 0 015 10.5 1.5 1.5 0 016.5 9 1.5 1.5 0 018 10.5 1.5 1.5 0 016.5 12M12 3a9 9 0 00-9 9 9 9 0 009 9 1.5 1.5 0 001.5-1.5c0-.39-.15-.74-.39-1-.23-.27-.38-.62-.38-1a1.5 1.5 0 011.5-1.5H16a5 5 0 005-5c0-4.42-4.03-8-9-8z"/></svg>')||this;return ve.colors=[],ve.addTransparent=!1,ve.colorBoxes=[],ve.colors=R,ve.currentColor=Q,ve.setCurrentColor=ve.setCurrentColor.bind(ve),ve.getColorBox=ve.getColorBox.bind(ve),ve}return Ie(l,F),l.prototype.getUi=function(){var f=this,R=document.createElement("div");return R.style.overflow="hidden",R.style.whiteSpace="nowrap",this.colors.forEach(function(Q){var B=f.getColorBox(Q);R.appendChild(B),f.colorBoxes.push(B)}),R},l.prototype.getColorBox=function(f){var R=this,Q=this.uiStyleSettings.toolbarHeight/4,B=this.uiStyleSettings.toolbarHeight-Q,ve=document.createElement("div");ve.style.display="inline-block",ve.style.boxSizing="content-box",ve.style.width=B-2+"px",ve.style.height=B-2+"px",ve.style.padding="1px",ve.style.marginRight="2px",ve.style.marginBottom="2px",ve.style.borderWidth="2px",ve.style.borderStyle="solid",ve.style.borderRadius=(B+2)/2+"px",ve.style.borderColor=f===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",ve.addEventListener("click",function(){R.setCurrentColor(f,ve)});var ze=document.createElement("div");return ze.style.display="inline-block",ze.style.width=B-2+"px",ze.style.height=B-2+"px",ze.style.backgroundColor=f,ze.style.borderRadius=B/2+"px",f==="transparent"&&(ze.style.fill=this.uiStyleSettings.toolboxAccentColor,ze.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>`),ve.appendChild(ze),ve},l.prototype.setCurrentColor=function(f,R){var Q=this;this.currentColor=f,this.colorBoxes.forEach(function(B){B.style.borderColor=B===R?Q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(f)},l}(st),Ve=function(){function F(l,f,R){this._state="new",this._isSelected=!1,this._container=l,this._overlayContainer=f,this.globalSettings=R,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(F.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),F.prototype.ownsTarget=function(l){return!1},Object.defineProperty(F.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),F.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},F.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},F.prototype.pointerDown=function(l,f){},F.prototype.dblClick=function(l,f){},F.prototype.manipulate=function(l){},F.prototype.pointerUp=function(l){this.stateChanged()},F.prototype.dispose=function(){},F.prototype.addMarkerVisualToContainer=function(l){this.container.childNodes.length>0?this.container.insertBefore(l,this.container.childNodes[0]):this.container.appendChild(l)},F.prototype.getState=function(){return{typeName:F.typeName,state:this.state,notes:this.notes}},F.prototype.restoreState=function(l){this._state=l.state,this.notes=l.notes},F.prototype.scale=function(l,f){},F.prototype.colorChanged=function(l){this.onColorChanged&&this.onColorChanged(l),this.stateChanged()},F.prototype.fillColorChanged=function(l){this.onFillColorChanged&&this.onFillColorChanged(l),this.stateChanged()},F.prototype.stateChanged=function(){if(this.onStateChanged&&this.state!=="creating"&&this.state!=="new"){var l=this.getState();this.manipulationStartState!==void 0&&(this.manipulationStartState.state="select"),l.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(l)&&this.onStateChanged(this)}},F.typeName="MarkerBase",F}(),Ke=function(){function F(){this.findGripByVisual=this.findGripByVisual.bind(this)}return F.prototype.findGripByVisual=function(l){return this.topLeft.ownsTarget(l)?this.topLeft:this.topCenter.ownsTarget(l)?this.topCenter:this.topRight.ownsTarget(l)?this.topRight:this.centerLeft.ownsTarget(l)?this.centerLeft:this.centerRight.ownsTarget(l)?this.centerRight:this.bottomLeft.ownsTarget(l)?this.bottomLeft:this.bottomCenter.ownsTarget(l)?this.bottomCenter:this.bottomRight.ownsTarget(l)?this.bottomRight:void 0},F}(),ht=function(){function F(){this.GRIP_SIZE=10,this.visual=se.createGroup(),this.visual.appendChild(se.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(se.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return F.prototype.ownsTarget=function(l){return l===this.visual||l===this.visual.childNodes[0]||l===this.visual.childNodes[1]},F}(),ut=function(){function F(){}return F.toITransformMatrix=function(l){return{a:l.a,b:l.b,c:l.c,d:l.d,e:l.e,f:l.f}},F.toSVGMatrix=function(l,f){return l.a=f.a,l.b=f.b,l.c=f.c,l.d=f.d,l.e=f.e,l.f=f.f,l},F}(),ft=function(F){function l(f,R,Q){var B=F.call(this,f,R,Q)||this;return B.left=0,B.top=0,B.width=0,B.height=0,B.defaultSize={x:50,y:20},B.offsetX=0,B.offsetY=0,B.rotationAngle=0,B.CB_DISTANCE=10,B._suppressMarkerCreateEvent=!1,B.container.transform.baseVal.appendItem(se.createTransform()),B.setupControlBox(),B}return Ie(l,F),Object.defineProperty(l.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"visual",{get:function(){return this._visual},set:function(f){this._visual=f;var R=se.createTransform();this._visual.transform.baseVal.appendItem(R)},enumerable:!1,configurable:!0}),l.prototype.ownsTarget=function(f){return!!F.prototype.ownsTarget.call(this,f)||!!(this.controlGrips.findGripByVisual(f)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(f))},l.prototype.pointerDown=function(f,R){F.prototype.pointerDown.call(this,f,R),this.state==="new"&&(this.left=f.x,this.top=f.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var Q=this.unrotatePoint(f);if(this.manipulationStartX=Q.x,this.manipulationStartY=Q.y,this.offsetX=Q.x-this.left,this.offsetY=Q.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(R),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(R)){this.activeGrip=this.rotatorGrip;var B=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=B.x-this.width/2,this.top=B.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var ve=this.container.transform.baseVal.getItem(0);ve.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(ve,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},l.prototype.pointerUp=function(f){var R=this.state;F.prototype.pointerUp.call(this,f),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(f),this._state="select",R==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},l.prototype.moveVisual=function(f){this.visual.style.transform="translate("+f.x+"px, "+f.y+"px)"},l.prototype.manipulate=function(f){var R=this.unrotatePoint(f);this.state==="creating"?this.resize(f):this.state==="move"?(this.left=this.manipulationStartLeft+(R.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(R.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(R):this.state==="rotate"&&this.rotate(f)},l.prototype.resize=function(f){var R=this.manipulationStartLeft,Q=this.manipulationStartWidth,B=this.manipulationStartTop,ve=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:R=this.manipulationStartLeft+f.x-this.manipulationStartX,Q=this.manipulationStartWidth+this.manipulationStartLeft-R;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:Q=this.manipulationStartWidth+f.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:B=this.manipulationStartTop+f.y-this.manipulationStartY,ve=this.manipulationStartHeight+this.manipulationStartTop-B;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:ve=this.manipulationStartHeight+f.y-this.manipulationStartY}Q>=0?(this.left=R,this.width=Q):(this.left=R+Q,this.width=-Q),ve>=0?(this.top=B,this.height=ve):(this.top=B+ve,this.height=-ve),this.setSize()},l.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},l.prototype.rotate=function(f){if(Math.abs(f.x-this.centerX)>.1){var R=Math.sign(f.x-this.centerX);this.rotationAngle=180*Math.atan((f.y-this.centerY)/(f.x-this.centerX))/Math.PI+90*R,this.applyRotation()}},l.prototype.applyRotation=function(){var f=this.container.transform.baseVal.getItem(0);f.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(f,0)},l.prototype.rotatePoint=function(f){if(this.rotationAngle===0)return f;var R=this.container.getCTM(),Q=se.createPoint(f.x,f.y);return{x:(Q=Q.matrixTransform(R)).x,y:Q.y}},l.prototype.unrotatePoint=function(f){if(this.rotationAngle===0)return f;var R=this.container.getCTM();R=R.inverse();var Q=se.createPoint(f.x,f.y);return{x:(Q=Q.matrixTransform(R)).x,y:Q.y}},l.prototype.select=function(){F.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},l.prototype.deselect=function(){F.prototype.deselect.call(this),this.controlBox.style.display="none"},l.prototype.setupControlBox=function(){this.controlBox=se.createGroup();var f=se.createTransform();f.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(f),this.container.appendChild(this.controlBox),this.controlRect=se.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=se.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 Ke,this.addControlGrips(),this.controlBox.style.display="none"},l.prototype.adjustControlBox=function(){var f=this.controlBox.transform.baseVal.getItem(0);f.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(f,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()},l.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()},l.prototype.createGrip=function(){var f=new ht;return f.visual.transform.baseVal.appendItem(se.createTransform()),this.controlBox.appendChild(f.visual),f},l.prototype.positionGrips=function(){var f=this.controlGrips.topLeft.GRIP_SIZE,R=-f/2,Q=R,B=(this.width+this.CB_DISTANCE)/2-f/2,ve=(this.height+this.CB_DISTANCE)/2-f/2,ze=this.height+this.CB_DISTANCE-f/2,lt=this.width+this.CB_DISTANCE-f/2;this.positionGrip(this.controlGrips.topLeft.visual,R,Q),this.positionGrip(this.controlGrips.topCenter.visual,B,Q),this.positionGrip(this.controlGrips.topRight.visual,lt,Q),this.positionGrip(this.controlGrips.centerLeft.visual,R,ve),this.positionGrip(this.controlGrips.centerRight.visual,lt,ve),this.positionGrip(this.controlGrips.bottomLeft.visual,R,ze),this.positionGrip(this.controlGrips.bottomCenter.visual,B,ze),this.positionGrip(this.controlGrips.bottomRight.visual,lt,ze),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,B,Q-3*this.CB_DISTANCE)},l.prototype.positionGrip=function(f,R,Q){var B=f.transform.baseVal.getItem(0);B.setTranslate(R,Q),f.transform.baseVal.replaceItem(B,0)},l.prototype.hideControlBox=function(){this.controlBox.style.display="none"},l.prototype.showControlBox=function(){this.controlBox.style.display=""},l.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:ut.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:ut.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},F.prototype.getState.call(this))},l.prototype.restoreState=function(f){F.prototype.restoreState.call(this,f);var R=f;this.left=R.left,this.top=R.top,this.width=R.width,this.height=R.height,this.rotationAngle=R.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(ut.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,R.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(ut.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,R.containerTransformMatrix))},l.prototype.scale=function(f,R){F.prototype.scale.call(this,f,R);var Q=this.rotatePoint({x:this.left,y:this.top}),B=this.unrotatePoint({x:Q.x*f,y:Q.y*R});this.left=B.x,this.top=B.y,this.width=this.width*f,this.height=this.height*R,this.adjustControlBox()},l}(Ve),nt=function(F){function l(f,R,Q){var B=F.call(this,f,R,Q)||this;return B.fillColor="transparent",B.strokeColor="transparent",B.strokeWidth=0,B.strokeDasharray="",B.opacity=1,B.setStrokeColor=B.setStrokeColor.bind(B),B.setFillColor=B.setFillColor.bind(B),B.setStrokeWidth=B.setStrokeWidth.bind(B),B.setStrokeDasharray=B.setStrokeDasharray.bind(B),B.createVisual=B.createVisual.bind(B),B}return Ie(l,F),l.prototype.ownsTarget=function(f){return!(!F.prototype.ownsTarget.call(this,f)&&f!==this.visual)},l.prototype.createVisual=function(){this.visual=se.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)},l.prototype.pointerDown=function(f,R){F.prototype.pointerDown.call(this,f,R),this.state==="new"&&(this.createVisual(),this.moveVisual(f),this._state="creating")},l.prototype.manipulate=function(f){F.prototype.manipulate.call(this,f)},l.prototype.resize=function(f){F.prototype.resize.call(this,f),this.setSize()},l.prototype.setSize=function(){F.prototype.setSize.call(this),se.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},l.prototype.pointerUp=function(f){F.prototype.pointerUp.call(this,f),this.setSize()},l.prototype.setStrokeColor=function(f){this.strokeColor=f,this.visual&&se.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(f),this.stateChanged()},l.prototype.setFillColor=function(f){this.fillColor=f,this.visual&&se.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},l.prototype.setStrokeWidth=function(f){this.strokeWidth=f,this.visual&&se.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},l.prototype.setStrokeDasharray=function(f){this.strokeDasharray=f,this.visual&&se.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},l.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},F.prototype.getState.call(this))},l.prototype.restoreState=function(f){var R=f;this.fillColor=R.fillColor,this.strokeColor=R.strokeColor,this.strokeWidth=R.strokeWidth,this.strokeDasharray=R.strokeDasharray,this.opacity=R.opacity,this.createVisual(),F.prototype.restoreState.call(this,f),this.setSize()},l.prototype.scale=function(f,R){F.prototype.scale.call(this,f,R),this.setSize()},l.title="Rectangle marker",l}(ft),Lt=function(F){function l(f,R,Q,B){var ve=F.call(this,f,B||'<svg viewBox="0 0 24 24"><path d="M3 17h18v-2H3v2m0 3h18v-1H3v1m0-7h18v-3H3v3m0-9v4h18V4H3z"/></svg>')||this;return ve.widths=[],ve.widthBoxes=[],ve.widths=R,ve.currentWidth=Q,ve.setCurrentWidth=ve.setCurrentWidth.bind(ve),ve}return Ie(l,F),l.prototype.getUi=function(){var f=this,R=document.createElement("div");return R.style.display="flex",R.style.overflow="hidden",R.style.flexGrow="2",this.widths.forEach(function(Q){var B=document.createElement("div");B.style.display="flex",B.style.flexGrow="2",B.style.alignItems="center",B.style.justifyContent="space-between",B.style.padding="5px",B.style.borderWidth="2px",B.style.borderStyle="solid",B.style.borderColor=Q===f.currentWidth?f.uiStyleSettings.toolboxAccentColor:"transparent",B.addEventListener("click",function(){f.setCurrentWidth(Q,B)}),R.appendChild(B);var ve=document.createElement("div");ve.innerText=Q.toString(),ve.style.marginRight="5px",B.appendChild(ve);var ze=document.createElement("div");ze.style.minHeight="20px",ze.style.flexGrow="2",ze.style.display="flex",ze.style.alignItems="center";var lt=document.createElement("hr");lt.style.minWidth="20px",lt.style.border="0px",lt.style.borderTop=Q+"px solid "+f.uiStyleSettings.toolboxColor,lt.style.flexGrow="2",ze.appendChild(lt),B.appendChild(ze),f.widthBoxes.push(B)}),R},l.prototype.setCurrentWidth=function(f,R){var Q=this;this.currentWidth=f,this.widthBoxes.forEach(function(B){B.style.borderColor=B===R?Q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},l}(st),vt=function(F){function l(f,R,Q,B){var ve=F.call(this,f,B||'<svg viewBox="0 0 24 24"><path d="M3 16h5v-2H3v2m6.5 0h5v-2h-5v2m6.5 0h5v-2h-5v2M3 20h2v-2H3v2m4 0h2v-2H7v2m4 0h2v-2h-2v2m4 0h2v-2h-2v2m4 0h2v-2h-2v2M3 12h8v-2H3v2m10 0h8v-2h-8v2M3 4v4h18V4H3z"/></svg>')||this;return ve.styles=[],ve.styleBoxes=[],ve.styles=R,ve.currentStyle=Q,ve.setCurrentStyle=ve.setCurrentStyle.bind(ve),ve}return Ie(l,F),l.prototype.getUi=function(){var f=this,R=document.createElement("div");return R.style.display="flex",R.style.overflow="hidden",R.style.flexGrow="2",this.styles.forEach(function(Q){var B=document.createElement("div");B.style.display="flex",B.style.alignItems="center",B.style.justifyContent="space-between",B.style.padding="5px",B.style.borderWidth="2px",B.style.borderStyle="solid",B.style.overflow="hidden",B.style.maxWidth=100/f.styles.length-5+"%",B.style.borderColor=Q===f.currentStyle?f.uiStyleSettings.toolboxAccentColor:"transparent",B.addEventListener("click",function(){f.setCurrentStyle(Q,B)}),R.appendChild(B);var ve=document.createElement("div");ve.style.minHeight="20px",ve.style.flexGrow="2",ve.style.overflow="hidden";var ze=`<svg width="100" height="20">
<line x1="0" y1="10" x2="100" y2="10" stroke="`+f.uiStyleSettings.toolboxColor+'" stroke-width="3" '+(Q!==""?'stroke-dasharray="'+Q+'"':"")+` />
</svg>`;ve.innerHTML=ze,B.appendChild(ve),f.styleBoxes.push(B)}),R},l.prototype.setCurrentStyle=function(f,R){var Q=this;this.currentStyle=f,this.styleBoxes.forEach(function(B){B.style.borderColor=B===R?Q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},l}(st),bt=function(F){function l(f,R,Q){var B=F.call(this,f,R,Q)||this;return B.strokeColor=Q.defaultColor,B.strokeWidth=Q.defaultStrokeWidth,B.strokeDasharray=Q.defaultStrokeDasharray,B.strokePanel=new qe("Line color",Q.defaultColorSet,Q.defaultColor),B.strokePanel.onColorChanged=B.setStrokeColor,B.strokeWidthPanel=new Lt("Line width",Q.defaultStrokeWidths,Q.defaultStrokeWidth),B.strokeWidthPanel.onWidthChanged=B.setStrokeWidth,B.strokeStylePanel=new vt("Line style",Q.defaultStrokeDasharrays,Q.defaultStrokeDasharray),B.strokeStylePanel.onStyleChanged=B.setStrokeDasharray,B}return Ie(l,F),Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var f=F.prototype.getState.call(this);return f.typeName=l.typeName,f},l.typeName="FrameMarker",l.title="Frame marker",l.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>',l}(nt),Ne=function(){this.defaultColorSet=["#EF4444","#10B981","#2563EB","#FFFF00","#7C3AED","#F472B6","#000000","#FFFFFF"],this.defaultColor=this.defaultColorSet[0],this.defaultFillColor=this.defaultColorSet[0],this.defaultStrokeColor=this.defaultColorSet[7],this.defaultHighlightColor=this.defaultColorSet[3],this.defaultStrokeWidth=3,this.defaultStrokeDasharray="",this.defaultHighlightOpacity=.5,this.defaultFontFamily="Helvetica, Arial, sans-serif",this.defaultStrokeWidths=[1,2,3,5,10],this.defaultStrokeDasharrays=["","3","12 3","9 6 3 6"],this.defaultOpacitySteps=[.1,.25,.5,.75,1],this.displayMode="inline",this.defaultFontFamilies=['Times, "Times New Roman", serif',"Helvetica, Arial, sans-serif",'Courier, "Courier New", monospace',"cursive","fantasy"],this.popupMargin=30,this.newFreehandMarkerOnPointerUp=!1,this.defaultColorsFollowCurrentColors=!1,this.freehandPixelRatio=1,this.disableRotation=!1},Ot=function(F){function l(f,R,Q){var B=F.call(this,f,R,Q)||this;return B.x1=0,B.y1=0,B.x2=0,B.y2=0,B.defaultLength=50,B.manipulationStartX=0,B.manipulationStartY=0,B.manipulationStartX1=0,B.manipulationStartY1=0,B.manipulationStartX2=0,B.manipulationStartY2=0,B.setupControlBox(),B}return Ie(l,F),l.prototype.ownsTarget=function(f){return!!F.prototype.ownsTarget.call(this,f)||!(!this.grip1.ownsTarget(f)&&!this.grip2.ownsTarget(f))},l.prototype.pointerDown=function(f,R){F.prototype.pointerDown.call(this,f,R),this.manipulationStartX=f.x,this.manipulationStartY=f.y,this.state==="new"&&(this.x1=f.x,this.y1=f.y,this.x2=f.x,this.y2=f.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(R)?this.activeGrip=this.grip1:this.grip2.ownsTarget(R)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},l.prototype.pointerUp=function(f){var R=this.state;F.prototype.pointerUp.call(this,f),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(f),this._state="select",R==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},l.prototype.adjustVisual=function(){},l.prototype.manipulate=function(f){this.state==="creating"?this.resize(f):this.state==="move"?(this.x1=this.manipulationStartX1+f.x-this.manipulationStartX,this.y1=this.manipulationStartY1+f.y-this.manipulationStartY,this.x2=this.manipulationStartX2+f.x-this.manipulationStartX,this.y2=this.manipulationStartY2+f.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(f)},l.prototype.resize=function(f){switch(this.activeGrip){case this.grip1:this.x1=f.x,this.y1=f.y;break;case this.grip2:case void 0:this.x2=f.x,this.y2=f.y}this.adjustVisual(),this.adjustControlBox()},l.prototype.select=function(){F.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},l.prototype.deselect=function(){F.prototype.deselect.call(this),this.controlBox.style.display="none"},l.prototype.setupControlBox=function(){this.controlBox=se.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},l.prototype.adjustControlBox=function(){this.positionGrips()},l.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},l.prototype.createGrip=function(){var f=new ht;return f.visual.transform.baseVal.appendItem(se.createTransform()),this.controlBox.appendChild(f.visual),f},l.prototype.positionGrips=function(){var f=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-f/2,this.y1-f/2),this.positionGrip(this.grip2.visual,this.x2-f/2,this.y2-f/2)},l.prototype.positionGrip=function(f,R,Q){var B=f.transform.baseVal.getItem(0);B.setTranslate(R,Q),f.transform.baseVal.replaceItem(B,0)},l.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},F.prototype.getState.call(this))},l.prototype.restoreState=function(f){F.prototype.restoreState.call(this,f);var R=f;this.x1=R.x1,this.y1=R.y1,this.x2=R.x2,this.y2=R.y2},l.prototype.scale=function(f,R){F.prototype.scale.call(this,f,R),this.x1=this.x1*f,this.y1=this.y1*R,this.x2=this.x2*f,this.y2=this.y2*R,this.adjustVisual(),this.adjustControlBox()},l}(Ve),Et=function(F){function l(f,R,Q){var B=F.call(this,f,R,Q)||this;return B.strokeColor="transparent",B.strokeWidth=0,B.strokeDasharray="",B.setStrokeColor=B.setStrokeColor.bind(B),B.setStrokeWidth=B.setStrokeWidth.bind(B),B.setStrokeDasharray=B.setStrokeDasharray.bind(B),B.strokeColor=Q.defaultColor,B.strokeWidth=Q.defaultStrokeWidth,B.strokeDasharray=Q.defaultStrokeDasharray,B.strokePanel=new qe("Line color",Q.defaultColorSet,Q.defaultColor),B.strokePanel.onColorChanged=B.setStrokeColor,B.strokeWidthPanel=new Lt("Line width",Q.defaultStrokeWidths,Q.defaultStrokeWidth),B.strokeWidthPanel.onWidthChanged=B.setStrokeWidth,B.strokeStylePanel=new vt("Line style",Q.defaultStrokeDasharrays,Q.defaultStrokeDasharray),B.strokeStylePanel.onStyleChanged=B.setStrokeDasharray,B}return Ie(l,F),l.prototype.ownsTarget=function(f){return!(!F.prototype.ownsTarget.call(this,f)&&f!==this.visual&&f!==this.selectorLine&&f!==this.visibleLine)},l.prototype.createVisual=function(){this.visual=se.createGroup(),this.selectorLine=se.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=se.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)},l.prototype.pointerDown=function(f,R){F.prototype.pointerDown.call(this,f,R),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},l.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()),se.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),se.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),se.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},l.prototype.setStrokeColor=function(f){this.strokeColor=f,this.adjustVisual(),this.colorChanged(f)},l.prototype.setStrokeWidth=function(f){this.strokeWidth=f,this.adjustVisual()},l.prototype.setStrokeDasharray=function(f){this.strokeDasharray=f,this.adjustVisual(),this.stateChanged()},Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var f=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},F.prototype.getState.call(this));return f.typeName=l.typeName,f},l.prototype.restoreState=function(f){F.prototype.restoreState.call(this,f);var R=f;this.strokeColor=R.strokeColor,this.strokeWidth=R.strokeWidth,this.strokeDasharray=R.strokeDasharray,this.createVisual(),this.adjustVisual()},l.typeName="LineMarker",l.title="Line marker",l.icon='<svg viewBox="0 0 24 24"><path d="M19 13H5v-2h14v2z"/></svg>',l}(Ot),We=function(F){function l(f,R,Q,B){var ve=F.call(this,f,B||'<svg viewBox="0 0 24 24"><path d="M17 8h3v12h1v1h-4v-1h1v-3h-4l-1.5 3H14v1h-4v-1h1l6-12m1 1l-3.5 7H18V9M5 3h5c1.11 0 2 .89 2 2v11H9v-5H6v5H3V5c0-1.11.89-2 2-2m1 2v4h3V5H6z"/></svg>')||this;return ve.fonts=[],ve.fontBoxes=[],ve.fonts=R,ve.currentFont=Q,ve.setCurrentFont=ve.setCurrentFont.bind(ve),ve}return Ie(l,F),l.prototype.getUi=function(){var f=this,R=document.createElement("div");return R.style.overflow="hidden",R.style.flexGrow="2",this.fonts.forEach(function(Q){var B=document.createElement("div");B.style.display="inline-block",B.style.alignItems="center",B.style.justifyContent="space-between",B.style.padding="5px",B.style.borderWidth="2px",B.style.borderStyle="solid",B.style.overflow="hidden",B.style.maxWidth=100/f.fonts.length-5+"%",B.style.borderColor=Q===f.currentFont?f.uiStyleSettings.toolboxAccentColor:"transparent",B.addEventListener("click",function(){f.setCurrentFont(Q,B)}),R.appendChild(B);var ve=document.createElement("div");ve.style.display="flex",ve.style.minHeight="20px",ve.style.flexGrow="2",ve.style.fontFamily=Q,ve.style.overflow="hidden";var ze=document.createElement("div");ze.style.whiteSpace="nowrap",ze.style.overflow="hidden",ze.style.textOverflow="ellipsis",ze.innerHTML="The quick brown fox jumps over the lazy dog",ve.appendChild(ze),B.appendChild(ve),f.fontBoxes.push(B)}),R},l.prototype.setCurrentFont=function(f,R){var Q=this;this.currentFont=f,this.fontBoxes.forEach(function(B){B.style.borderColor=B===R?Q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},l}(st),Ze=function(F){function l(f,R,Q){var B=F.call(this,f,R,Q)||this;return B.color="transparent",B.padding=5,B.DEFAULT_TEXT="your text here",B.text=B.DEFAULT_TEXT,B.isMoved=!1,B.color=Q.defaultColor,B.fontFamily=Q.defaultFontFamily,B.defaultSize={x:100,y:30},B.setColor=B.setColor.bind(B),B.setFont=B.setFont.bind(B),B.renderText=B.renderText.bind(B),B.sizeText=B.sizeText.bind(B),B.textEditDivClicked=B.textEditDivClicked.bind(B),B.showTextEditor=B.showTextEditor.bind(B),B.setSize=B.setSize.bind(B),B.positionTextEditor=B.positionTextEditor.bind(B),B.colorPanel=new qe("Color",Q.defaultColorSet,Q.defaultColor),B.colorPanel.onColorChanged=B.setColor,B.fontFamilyPanel=new We("Font",Q.defaultFontFamilies,Q.defaultFontFamily),B.fontFamilyPanel.onFontChanged=B.setFont,B}return Ie(l,F),l.prototype.ownsTarget=function(f){if(F.prototype.ownsTarget.call(this,f)||f===this.visual||f===this.textElement||f===this.bgRectangle)return!0;var R=!1;return this.textElement.childNodes.forEach(function(Q){Q===f&&(R=!0)}),R},l.prototype.createVisual=function(){this.visual=se.createGroup(),this.bgRectangle=se.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=se.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(se.createTransform()),this.textElement.transform.baseVal.appendItem(se.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},l.prototype.pointerDown=function(f,R){F.prototype.pointerDown.call(this,f,R),this.isMoved=!1,this.pointerDownPoint=f,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(f),this._state="creating")},l.prototype.renderText=function(){var f=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(R){f.textElement.appendChild(se.createTSpan(R.trim()===""?" ":R.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},l.prototype.getTextScale=function(){var f=this.textElement.getBBox(),R=1;if(f.width>0&&f.height>0){var Q=(1*this.width-this.width*this.padding*2/100)/f.width,B=(1*this.height-this.height*this.padding*2/100)/f.height;R=Math.min(Q,B)}return R},l.prototype.getTextPosition=function(f){var R=this.textElement.getBBox(),Q=0,B=0;return R.width>0&&R.height>0&&(Q=(this.width-R.width*f)/2,B=this.height/2-R.height*f/2),{x:Q,y:B}},l.prototype.sizeText=function(){var f=this.textElement.getBBox(),R=this.getTextScale(),Q=this.getTextPosition(R);Q.y-=f.y*R,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+Q.x+"px, "+Q.y+"px) scale("+R+", "+R+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(Q.x,Q.y),this.textElement.transform.baseVal.getItem(1).setScale(R,R))},l.prototype.manipulate=function(f){F.prototype.manipulate.call(this,f),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(f.x-this.pointerDownPoint.x)>5||Math.abs(f.y-this.pointerDownPoint.y)>5)},l.prototype.resize=function(f){F.prototype.resize.call(this,f),this.isMoved=!0,this.setSize(),this.sizeText()},l.prototype.setSize=function(){F.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(se.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),se.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},l.prototype.pointerUp=function(f){var R=this.state;R==="creating"&&(this._suppressMarkerCreateEvent=!0),F.prototype.pointerUp.call(this,f),this.setSize(),(R==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},l.prototype.showTextEditor=function(){var f=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(R){R.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var R=Number.parseFloat(f.textEditor.style.fontSize);f.textEditor.clientWidth>=Number.parseInt(f.textEditor.style.maxWidth)&&R>.9;)R-=.1,f.textEditor.style.fontSize=Math.max(R,.9)+"em"}),this.textEditor.addEventListener("keyup",function(R){R.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(R){if(R.clipboardData){var Q=R.clipboardData.getData("text"),B=window.getSelection();if(!B.rangeCount)return!1;B.deleteFromDocument(),B.getRangeAt(0).insertNode(document.createTextNode(Q)),R.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){f.textEditDivClicked(f.textEditor.innerText)}),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},l.prototype.positionTextEditor=function(){if(this.state==="edit")if(this.textEditor===void 0)this.showTextEditor();else{this.textElement.style.display="";var f=this.getTextScale(),R=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),Q=this.textElement.getBBox(),B={x:Q.width*f,y:Q.height*f};R.x-=B.x/2,R.y-=B.y/2,this.textEditor.style.top=R.y+"px",this.textEditor.style.left=R.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-R.x+"px",this.textEditor.style.fontSize=Math.max(16*f,12)+"px",this.textElement.style.display="none"}},l.prototype.textEditDivClicked=function(f){this.text=f.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},l.prototype.select=function(){F.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},l.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),F.prototype.deselect.call(this)},l.prototype.dblClick=function(f,R){F.prototype.dblClick.call(this,f,R),this.showTextEditor()},l.prototype.setColor=function(f){this.textElement&&se.setAttributes(this.textElement,[["fill",f]]),this.color=f,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(f)},l.prototype.setFont=function(f){this.textElement&&se.setAttributes(this.textElement,[["font-family",f]]),this.fontFamily=f,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},l.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},l.prototype.showVisual=function(){this.state==="edit"&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var f=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},F.prototype.getState.call(this));return f.typeName=l.typeName,f},l.prototype.restoreState=function(f){var R=f;this.color=R.color,this.fontFamily=R.fontFamily,this.padding=R.padding,this.text=R.text,this.createVisual(),F.prototype.restoreState.call(this,f),this.setSize()},l.prototype.scale=function(f,R){F.prototype.scale.call(this,f,R),this.setSize(),this.sizeText(),this.positionTextEditor()},l.typeName="TextMarker",l.title="Text marker",l.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>',l}(ft),we=function(F){function l(f,R,Q){var B=F.call(this,f,R,Q)||this;return B.color="transparent",B.lineWidth=3,B.drawing=!1,B.pixelRatio=1,B.color=Q.defaultColor,B.lineWidth=Q.defaultStrokeWidth,B.pixelRatio=Q.freehandPixelRatio,B.setColor=B.setColor.bind(B),B.addCanvas=B.addCanvas.bind(B),B.finishCreation=B.finishCreation.bind(B),B.setLineWidth=B.setLineWidth.bind(B),B.colorPanel=new qe("Color",Q.defaultColorSet,Q.defaultColor),B.colorPanel.onColorChanged=B.setColor,B.lineWidthPanel=new Lt("Line width",Q.defaultStrokeWidths,Q.defaultStrokeWidth),B.lineWidthPanel.onWidthChanged=B.setLineWidth,B}return Ie(l,F),l.prototype.ownsTarget=function(f){return!(!F.prototype.ownsTarget.call(this,f)&&f!==this.visual&&f!==this.drawingImage)},l.prototype.createVisual=function(){this.visual=se.createGroup(),this.drawingImage=se.createImage(),this.visual.appendChild(this.drawingImage);var f=se.createTransform();this.visual.transform.baseVal.appendItem(f),this.addMarkerVisualToContainer(this.visual)},l.prototype.pointerDown=function(f,R){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(f.x,f.y),this.drawing=!0):F.prototype.pointerDown.call(this,f,R)},l.prototype.manipulate=function(f){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(f.x,f.y),this.canvasContext.stroke()):F.prototype.manipulate.call(this,f)},l.prototype.resize=function(f){F.prototype.resize.call(this,f),se.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),se.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},l.prototype.pointerUp=function(f){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):F.prototype.pointerUp.call(this,f)},l.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)},l.prototype.select=function(){this.state==="creating"&&this.finishCreation(),F.prototype.select.call(this)},l.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),F.prototype.deselect.call(this)},l.prototype.finishCreation=function(){for(var f=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),R=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],Q=R[0],B=R[1],ve=R[2],ze=R[3],lt=!1,At=0;At<this.canvasElement.height;At++)for(var $e=0;$e<this.canvasElement.width;$e++)f.data[At*this.canvasElement.width*4+4*$e+3]>0&&(lt=!0,At<B&&(B=At),$e<Q&&(Q=$e),At>ze&&(ze=At),$e>ve&&(ve=$e));if(lt){this.left=Q/this.pixelRatio,this.top=B/this.pixelRatio,this.width=(ve-Q)/this.pixelRatio,this.height=(ze-B)/this.pixelRatio;var Rt=document.createElement("canvas");Rt.width=ve-Q,Rt.height=ze-B,Rt.getContext("2d").putImageData(this.canvasContext.getImageData(Q,B,ve-Q,ze-B),0,0),this.drawingImgUrl=Rt.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},l.prototype.setDrawingImage=function(){se.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),se.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},l.prototype.setColor=function(f){this.color=f,this.colorChanged(f)},l.prototype.setLineWidth=function(f){this.lineWidth=f},Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return this.state==="new"||this.state==="creating"?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var f=Object.assign({drawingImgUrl:this.drawingImgUrl},F.prototype.getState.call(this));return f.typeName=l.typeName,f},l.prototype.restoreState=function(f){this.createVisual(),F.prototype.restoreState.call(this,f),this.drawingImgUrl=f.drawingImgUrl,this.setDrawingImage()},l.prototype.scale=function(f,R){F.prototype.scale.call(this,f,R),this.setDrawingImage()},l.typeName="FreehandMarker",l.title="Freehand marker",l.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>',l}(ft),ye=function(F){function l(f,R,Q){var B=F.call(this,f,Q||'<svg viewBox="0 0 24 24"><path d="M8 14v4l-6-6 6-6v4h8V6l6 6-6 6v-4H8z"/></svg>')||this;return B.typeBoxes=[],B.currentType=R,B.setCurrentType=B.setCurrentType.bind(B),B}return Ie(l,F),l.prototype.getUi=function(){var f=this,R=document.createElement("div");R.style.display="flex",R.style.overflow="hidden",R.style.flexGrow="2";for(var Q=function(ze){var lt="both";switch(ze){case 0:lt="both";break;case 1:lt="start";break;case 2:lt="end";break;case 3:lt="none"}var At=document.createElement("div");if(At.style.display="flex",At.style.flexGrow="2",At.style.alignItems="center",At.style.justifyContent="space-between",At.style.padding="5px",At.style.borderWidth="2px",At.style.borderStyle="solid",At.style.borderColor=lt===B.currentType?B.uiStyleSettings.toolboxAccentColor:"transparent",At.addEventListener("click",function(){f.setCurrentType(lt,At)}),R.appendChild(At),lt==="both"||lt==="start"){var $e=document.createElement("div");$e.style.display="flex",$e.style.alignItems="center",$e.style.minHeight="20px",$e.innerHTML=`<svg viewBox="0 0 10 10" width="10" height="10" xmlns="http://www.w3.org/2000/svg">
<polygon points="0,5 10,0 10,10" fill="`+(B.uiStyleSettings!==void 0?B.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
</svg>`,$e.style.marginLeft="5px",At.appendChild($e)}var Rt=document.createElement("div");Rt.style.display="flex",Rt.style.alignItems="center",Rt.style.minHeight="20px",Rt.style.flexGrow="2";var gr=document.createElement("hr");if(gr.style.minWidth="20px",gr.style.border="0px",gr.style.borderTop="3px solid "+(B.uiStyleSettings!==void 0?B.uiStyleSettings.toolboxColor:"#eeeeee"),gr.style.flexGrow="2",Rt.appendChild(gr),At.appendChild(Rt),lt==="both"||lt==="end"){var Dr=document.createElement("div");Dr.style.display="flex",Dr.style.alignItems="center",Dr.style.minHeight="20px",Dr.innerHTML=`<svg viewBox="0 0 10 10" width="10" height="10" xmlns="http://www.w3.org/2000/svg">
<polygon points="0,0 10,5 0,10" fill="`+(B.uiStyleSettings!==void 0?B.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
</svg>`,Dr.style.marginRight="5px",At.appendChild(Dr)}B.typeBoxes.push(At)},B=this,ve=0;ve<4;ve++)Q(ve);return R},l.prototype.setCurrentType=function(f,R){var Q=this;this.currentType=f,this.typeBoxes.forEach(function(B){B.style.borderColor=B===R?Q.uiStyleSettings!==void 0?Q.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},l}(st),Ee=function(F){function l(f,R,Q){var B=F.call(this,f,R,Q)||this;return B.arrowType="end",B.arrowBaseHeight=10,B.arrowBaseWidth=10,B.getArrowPoints=B.getArrowPoints.bind(B),B.setArrowType=B.setArrowType.bind(B),B.arrowTypePanel=new ye("Arrow type","end"),B.arrowTypePanel.onArrowTypeChanged=B.setArrowType,B}return Ie(l,F),l.prototype.ownsTarget=function(f){return!(!F.prototype.ownsTarget.call(this,f)&&f!==this.arrow1&&f!==this.arrow2)},l.prototype.getArrowPoints=function(f,R){var Q=this.arrowBaseWidth+2*this.strokeWidth,B=this.arrowBaseHeight+2*this.strokeWidth;return f-Q/2+","+(R+B/2)+" "+f+","+(R-B/2)+" "+(f+Q/2)+","+(R+B/2)},l.prototype.createTips=function(){this.arrow1=se.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(se.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=se.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(se.createTransform()),this.visual.appendChild(this.arrow2)},l.prototype.pointerDown=function(f,R){F.prototype.pointerDown.call(this,f,R),this.state==="creating"&&this.createTips()},l.prototype.adjustVisual=function(){if(F.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",se.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),se.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]),Math.abs(this.x1-this.x2)>.1)){var f=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),R=this.arrow1.transform.baseVal.getItem(0);R.setRotate(f,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(R,0);var Q=this.arrow2.transform.baseVal.getItem(0);Q.setRotate(f+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(Q,0)}},l.prototype.setArrowType=function(f){this.arrowType=f,this.adjustVisual(),this.stateChanged()},Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var f=Object.assign({arrowType:this.arrowType},F.prototype.getState.call(this));return f.typeName=l.typeName,f},l.prototype.restoreState=function(f){F.prototype.restoreState.call(this,f);var R=f;this.arrowType=R.arrowType,this.createTips(),this.adjustVisual()},l.typeName="ArrowMarker",l.title="Arrow marker",l.icon='<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 7 15.59V9H5v10h10v-2H8.41L19 6.41z"/></svg>',l}(Et),re=function(F){function l(f,R,Q){var B=F.call(this,f,R,Q)||this;return B.fillColor=Q.defaultFillColor,B.strokeWidth=0,B.fillPanel=new qe("Color",Q.defaultColorSet,Q.defaultFillColor),B.fillPanel.onColorChanged=B.setFillColor,B}return Ie(l,F),Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var f=F.prototype.getState.call(this);return f.typeName=l.typeName,f},l.typeName="CoverMarker",l.title="Cover marker",l.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>',l}(nt),ie=function(F){function l(f,R,Q,B){var ve=F.call(this,f,B||'<svg viewBox="0 0 24 24"><path d="M17.66 8L12 2.35 6.34 8A8.02 8.02 0 004 13.64c0 2 .78 4.11 2.34 5.67a7.99 7.99 0 0011.32 0c1.56-1.56 2.34-3.67 2.34-5.67S19.22 9.56 17.66 8M6 14c0-2 .62-3.27 1.76-4.4L12 5.27l4.24 4.38C17.38 10.77 18 12 18 14H6z"/></svg>')||this;return ve.opacities=[],ve.opacityBoxes=[],ve.opacities=R,ve.currentOpacity=Q,ve.setCurrentOpacity=ve.setCurrentOpacity.bind(ve),ve}return Ie(l,F),l.prototype.getUi=function(){var f=this,R=document.createElement("div");return R.style.display="flex",R.style.overflow="hidden",R.style.flexGrow="2",R.style.justifyContent="space-between",this.opacities.forEach(function(Q){var B=document.createElement("div");B.style.display="flex",B.style.alignItems="center",B.style.justifyContent="center",B.style.padding="5px",B.style.borderWidth="2px",B.style.borderStyle="solid",B.style.borderColor=Q===f.currentOpacity?f.uiStyleSettings.toolboxAccentColor:"transparent",B.addEventListener("click",function(){f.setCurrentOpacity(Q,B)}),R.appendChild(B);var ve=document.createElement("div");ve.innerText=100*Q+"%",B.appendChild(ve),f.opacityBoxes.push(B)}),R},l.prototype.setCurrentOpacity=function(f,R){var Q=this;this.currentOpacity=f,this.opacityBoxes.forEach(function(B){B.style.borderColor=B===R?Q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},l}(st),ue=function(F){function l(f,R,Q){var B=F.call(this,f,R,Q)||this;return B.setOpacity=B.setOpacity.bind(B),B.fillColor=Q.defaultHighlightColor,B.strokeWidth=0,B.opacity=Q.defaultHighlightOpacity,B.fillPanel=new qe("Color",Q.defaultColorSet,B.fillColor),B.fillPanel.onColorChanged=B.setFillColor,B.opacityPanel=new ie("Opacity",Q.defaultOpacitySteps,B.opacity),B.opacityPanel.onOpacityChanged=B.setOpacity,B}return Ie(l,F),l.prototype.setOpacity=function(f){this.opacity=f,this.visual&&se.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var f=F.prototype.getState.call(this);return f.typeName=l.typeName,f},l.typeName="HighlightMarker",l.title="Highlight marker",l.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>',l}(re),ge='<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>',Se=function(F){function l(f,R,Q){var B=F.call(this,f,R,Q)||this;return B.bgColor="transparent",B.tipPosition={x:0,y:0},B.tipBase1Position={x:0,y:0},B.tipBase2Position={x:0,y:0},B.tipMoving=!1,B.color=Q.defaultStrokeColor,B.bgColor=Q.defaultFillColor,B.fontFamily=Q.defaultFontFamily,B.defaultSize={x:100,y:30},B.setBgColor=B.setBgColor.bind(B),B.getTipPoints=B.getTipPoints.bind(B),B.positionTip=B.positionTip.bind(B),B.setTipPoints=B.setTipPoints.bind(B),B.colorPanel=new qe("Text color",Q.defaultColorSet,B.color,'<svg viewBox="0 0 24 24"><path d="M9.62 12L12 5.67 14.37 12M11 3L5.5 17h2.25l1.12-3h6.25l1.13 3h2.25L13 3h-2z"/></svg>'),B.colorPanel.onColorChanged=B.setColor,B.bgColorPanel=new qe("Fill color",Q.defaultColorSet,B.bgColor,ge),B.bgColorPanel.onColorChanged=B.setBgColor,B.fontFamilyPanel=new We("Font",Q.defaultFontFamilies,Q.defaultFontFamily),B.fontFamilyPanel.onFontChanged=B.setFont,B.tipGrip=new ht,B.tipGrip.visual.transform.baseVal.appendItem(se.createTransform()),B.controlBox.appendChild(B.tipGrip.visual),B}return Ie(l,F),l.prototype.ownsTarget=function(f){return F.prototype.ownsTarget.call(this,f)||this.tipGrip.ownsTarget(f)||this.tip===f},l.prototype.createTip=function(){se.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=se.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},l.prototype.pointerDown=function(f,R){this.state==="new"&&F.prototype.pointerDown.call(this,f,R),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(R)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):F.prototype.pointerDown.call(this,f,R)},l.prototype.pointerUp=function(f){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,F.prototype.pointerUp.call(this,f);else{var R=this.state==="creating";F.prototype.pointerUp.call(this,f),this.setTipPoints(R),this.positionTip()}},l.prototype.manipulate=function(f){if(this.tipMoving){var R=this.unrotatePoint(f);this.tipPosition={x:R.x-this.manipulationStartLeft,y:R.y-this.manipulationStartTop},this.positionTip()}else F.prototype.manipulate.call(this,f)},l.prototype.setBgColor=function(f){this.bgRectangle&&this.tip&&(se.setAttributes(this.bgRectangle,[["fill",f]]),se.setAttributes(this.tip,[["fill",f]])),this.bgColor=f,this.fillColorChanged(f)},l.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},l.prototype.setTipPoints=function(f){f===void 0&&(f=!1);var R=Math.min(this.height/2,15),Q=this.height/5;f&&(this.tipPosition={x:R+Q/2,y:this.height+20});var B=Math.atan(this.height/2/(this.width/2));this.tipPosition.x<this.width/2&&this.tipPosition.y<this.height/2?B<Math.atan((this.height/2-this.tipPosition.y)/(this.width/2-this.tipPosition.x))?(Q=this.width/5,R=Math.min(this.width/2,15),this.tipBase1Position={x:R,y:0},this.tipBase2Position={x:R+Q,y:0}):(this.tipBase1Position={x:0,y:R},this.tipBase2Position={x:0,y:R+Q}):this.tipPosition.x>=this.width/2&&this.tipPosition.y<this.height/2?B<Math.atan((this.height/2-this.tipPosition.y)/(this.tipPosition.x-this.width/2))?(Q=this.width/5,R=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-R-Q,y:0},this.tipBase2Position={x:this.width-R,y:0}):(this.tipBase1Position={x:this.width,y:R},this.tipBase2Position={x:this.width,y:R+Q}):this.tipPosition.x>=this.width/2&&this.tipPosition.y>=this.height/2?B<Math.atan((this.tipPosition.y-this.height/2)/(this.tipPosition.x-this.width/2))?(Q=this.width/5,R=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-R-Q,y:this.height},this.tipBase2Position={x:this.width-R,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-R-Q},this.tipBase2Position={x:this.width,y:this.height-R}):B<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?(Q=this.width/5,R=Math.min(this.width/2,15),this.tipBase1Position={x:R,y:this.height},this.tipBase2Position={x:R+Q,y:this.height}):(this.tipBase1Position={x:0,y:this.height-R},this.tipBase2Position={x:0,y:this.height-R-Q})},l.prototype.resize=function(f){F.prototype.resize.call(this,f),this.positionTip()},l.prototype.positionTip=function(){se.setAttributes(this.tip,[["points",this.getTipPoints()]]);var f=this.tipGrip.visual.transform.baseVal.getItem(0);f.setTranslate(this.tipPosition.x,this.tipPosition.y),this.tipGrip.visual.transform.baseVal.replaceItem(f,0)},Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.bgColorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),l.prototype.select=function(){this.positionTip(),F.prototype.select.call(this)},l.prototype.getState=function(){var f=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},F.prototype.getState.call(this));return f.typeName=l.typeName,f},l.prototype.restoreState=function(f){var R=f;this.bgColor=R.bgColor,this.tipPosition=R.tipPosition,F.prototype.restoreState.call(this,f),this.createTip(),this.setTipPoints()},l.prototype.scale=function(f,R){F.prototype.scale.call(this,f,R),this.tipPosition={x:this.tipPosition.x*f,y:this.tipPosition.y*R},this.positionTip()},l.typeName="CalloutMarker",l.title="Callout marker",l.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>',l}(Ze),Re=function(F){function l(f,R,Q){var B=F.call(this,f,R,Q)||this;return B.fillColor="transparent",B.strokeColor="transparent",B.strokeWidth=0,B.strokeDasharray="",B.opacity=1,B.strokeColor=Q.defaultColor,B.strokeWidth=Q.defaultStrokeWidth,B.strokeDasharray=Q.defaultStrokeDasharray,B.fillColor=Q.defaultFillColor,B.setStrokeColor=B.setStrokeColor.bind(B),B.setFillColor=B.setFillColor.bind(B),B.setStrokeWidth=B.setStrokeWidth.bind(B),B.setStrokeDasharray=B.setStrokeDasharray.bind(B),B.setOpacity=B.setOpacity.bind(B),B.createVisual=B.createVisual.bind(B),B.strokePanel=new qe("Line color",Te(Q.defaultColorSet,["transparent"]),Q.defaultColor),B.strokePanel.onColorChanged=B.setStrokeColor,B.fillPanel=new qe("Fill color",Te(Q.defaultColorSet,["transparent"]),B.fillColor,ge),B.fillPanel.onColorChanged=B.setFillColor,B.strokeWidthPanel=new Lt("Line width",Q.defaultStrokeWidths,Q.defaultStrokeWidth),B.strokeWidthPanel.onWidthChanged=B.setStrokeWidth,B.strokeStylePanel=new vt("Line style",Q.defaultStrokeDasharrays,Q.defaultStrokeDasharray),B.strokeStylePanel.onStyleChanged=B.setStrokeDasharray,B.opacityPanel=new ie("Opacity",Q.defaultOpacitySteps,B.opacity),B.opacityPanel.onOpacityChanged=B.setOpacity,B}return Ie(l,F),l.prototype.ownsTarget=function(f){return!(!F.prototype.ownsTarget.call(this,f)&&f!==this.visual)},l.prototype.createVisual=function(){this.visual=se.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)},l.prototype.pointerDown=function(f,R){F.prototype.pointerDown.call(this,f,R),this.state==="new"&&(this.createVisual(),this.moveVisual(f),this._state="creating")},l.prototype.manipulate=function(f){F.prototype.manipulate.call(this,f)},l.prototype.resize=function(f){F.prototype.resize.call(this,f),this.setSize()},l.prototype.setSize=function(){F.prototype.setSize.call(this),se.setAttributes(this.visual,[["cx",(this.width/2).toString()],["cy",(this.height/2).toString()],["rx",(this.width/2).toString()],["ry",(this.height/2).toString()]])},l.prototype.pointerUp=function(f){F.prototype.pointerUp.call(this,f),this.setSize()},l.prototype.setStrokeColor=function(f){this.strokeColor=f,this.visual&&se.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(f),this.stateChanged()},l.prototype.setFillColor=function(f){this.fillColor=f,this.visual&&se.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(f),this.stateChanged()},l.prototype.setStrokeWidth=function(f){this.strokeWidth=f,this.visual&&se.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},l.prototype.setStrokeDasharray=function(f){this.strokeDasharray=f,this.visual&&se.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},l.prototype.setOpacity=function(f){this.opacity=f,this.visual&&se.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var f=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},F.prototype.getState.call(this));return f.typeName=l.typeName,f},l.prototype.restoreState=function(f){var R=f;this.fillColor=R.fillColor,this.strokeColor=R.strokeColor,this.strokeWidth=R.strokeWidth,this.strokeDasharray=R.strokeDasharray,this.opacity=R.opacity,this.createVisual(),F.prototype.restoreState.call(this,f),this.setSize()},l.prototype.scale=function(f,R){F.prototype.scale.call(this,f,R),this.setSize()},l.typeName="EllipseMarker",l.title="Ellipse marker",l.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>',l}(ft),Xe=function(F){function l(f,R,Q){return F.call(this,f,R,Q)||this}return Ie(l,F),Object.defineProperty(l.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),l.prototype.ownsTarget=function(f){return!(!F.prototype.ownsTarget.call(this,f)&&f!==this.tip1&&f!==this.tip2)},l.prototype.createTips=function(){this.tip1=se.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(se.createTransform()),this.visual.appendChild(this.tip1),this.tip2=se.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(se.createTransform()),this.visual.appendChild(this.tip2)},l.prototype.pointerDown=function(f,R){F.prototype.pointerDown.call(this,f,R),this.state==="creating"&&this.createTips()},l.prototype.adjustVisual=function(){if(F.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(se.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()]]),se.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 f=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),R=this.tip1.transform.baseVal.getItem(0);R.setRotate(f,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(R,0);var Q=this.tip2.transform.baseVal.getItem(0);Q.setRotate(f+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(Q,0)}},Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var f=F.prototype.getState.call(this);return f.typeName=l.typeName,f},l.prototype.restoreState=function(f){F.prototype.restoreState.call(this,f),this.createTips(),this.adjustVisual()},l.typeName="MeasurementMarker",l.title="Measurement marker",l.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>',l}(Et),xt=function(F){function l(f,R,Q){var B=F.call(this,f,R,Q)||this;return B.strokePanel.colors=Q.defaultColorSet,B.fillColor="transparent",B}return Ie(l,F),Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var f=F.prototype.getState.call(this);return f.typeName=l.typeName,f},l.typeName="EllipseFrameMarker",l.title="Ellipse frame marker",l.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>',l}(Re),Mt=function(){function F(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(F.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),F.prototype.addUndoStep=function(l){this.undoStack.length!==0&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(l)||(this.undoStack.push(l),JSON.stringify(this.lastRedoStep)!==JSON.stringify(l)&&this.redoStack.splice(0,this.redoStack.length))},F.prototype.replaceLastUndoStep=function(l){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=l)},F.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},F.prototype.undo=function(){if(this.undoStack.length>1){var l=this.undoStack.pop();return l!==void 0&&this.redoStack.push(l),this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0}},F.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},F}(),kt=function(F){function l(f,R,Q){var B=F.call(this,f,R,Q)||this;return B.strokeColor="transparent",B.strokeWidth=0,B.strokeDasharray="",B.curveX=0,B.curveY=0,B.manipulationStartCurveX=0,B.manipulationStartCurveY=0,B.setStrokeColor=B.setStrokeColor.bind(B),B.setStrokeWidth=B.setStrokeWidth.bind(B),B.setStrokeDasharray=B.setStrokeDasharray.bind(B),B.positionGrips=B.positionGrips.bind(B),B.addControlGrips=B.addControlGrips.bind(B),B.adjustVisual=B.adjustVisual.bind(B),B.setupControlBox=B.setupControlBox.bind(B),B.resize=B.resize.bind(B),B.strokeColor=Q.defaultColor,B.strokeWidth=Q.defaultStrokeWidth,B.strokeDasharray=Q.defaultStrokeDasharray,B.strokePanel=new qe("Line color",Q.defaultColorSet,Q.defaultColor),B.strokePanel.onColorChanged=B.setStrokeColor,B.strokeWidthPanel=new Lt("Line width",Q.defaultStrokeWidths,Q.defaultStrokeWidth),B.strokeWidthPanel.onWidthChanged=B.setStrokeWidth,B.strokeStylePanel=new vt("Line style",Q.defaultStrokeDasharrays,Q.defaultStrokeDasharray),B.strokeStylePanel.onStyleChanged=B.setStrokeDasharray,B}return Ie(l,F),l.prototype.ownsTarget=function(f){return!(!F.prototype.ownsTarget.call(this,f)&&f!==this.visual&&f!==this.selectorCurve&&f!==this.visibleCurve&&!this.curveGrip.ownsTarget(f))},l.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},l.prototype.createVisual=function(){this.visual=se.createGroup(),this.selectorCurve=se.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=se.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)},l.prototype.pointerDown=function(f,R){F.prototype.pointerDown.call(this,f,R),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=f.x,this.curveY=f.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(R)&&(this.activeGrip=this.curveGrip,this._state="resize")},l.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),se.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),se.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),se.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},l.prototype.setupControlBox=function(){F.prototype.setupControlBox.call(this),this.curveControlLine1=se.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=se.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)},l.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,F.prototype.addControlGrips.call(this)},l.prototype.positionGrips=function(){F.prototype.positionGrips.call(this);var f=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-f/2,this.curveY-f/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()))},l.prototype.manipulate=function(f){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+f.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+f.y-this.manipulationStartY),F.prototype.manipulate.call(this,f)},l.prototype.resize=function(f){this.activeGrip===this.curveGrip&&(this.curveX=f.x,this.curveY=f.y),F.prototype.resize.call(this,f),this.state==="creating"&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},l.prototype.setStrokeColor=function(f){this.strokeColor=f,this.adjustVisual(),this.colorChanged(f)},l.prototype.setStrokeWidth=function(f){this.strokeWidth=f,this.adjustVisual()},l.prototype.setStrokeDasharray=function(f){this.strokeDasharray=f,this.adjustVisual()},l.prototype.scale=function(f,R){this.curveX=this.curveX*f,this.curveY=this.curveY*R,F.prototype.scale.call(this,f,R)},Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var f=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},F.prototype.getState.call(this));return f.typeName=l.typeName,f},l.prototype.restoreState=function(f){F.prototype.restoreState.call(this,f);var R=f;this.strokeColor=R.strokeColor,this.strokeWidth=R.strokeWidth,this.strokeDasharray=R.strokeDasharray,this.curveX=R.curveX,this.curveY=R.curveY,this.createVisual(),this.adjustVisual()},l.typeName="CurveMarker",l.title="Curve marker",l.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>',l}(Ot),Gt=function(){function F(l,f){f===void 0&&(f=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=l,this.cancelable=f}return Object.defineProperty(F.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),F.prototype.preventDefault=function(){this._defaultPrevented=!0},F}(),Kt=function(F){function l(f,R,Q){var B=F.call(this,f,!1)||this;return B.dataUrl=R,B.state=Q,B}return Ie(l,F),l}(Gt),Ct=function(F){function l(f,R,Q){Q===void 0&&(Q=!1);var B=F.call(this,f,Q)||this;return B.marker=R,B}return Ie(l,F),l}(Gt),pr=function(){function F(){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 F.prototype.addEventListener=function(l,f){this[l].push(f)},F.prototype.removeEventListener=function(l,f){var R=this[l].indexOf(f);R>-1&&this[l].splice(R,1)},F}(),rr=function(){function F(l){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new Ne,this._isOpen=!1,this.undoRedoManager=new Mt,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 pr,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=F.instanceCounter++,this.styles=new ot(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=l,this.targetRoot=document.body,this.width=l.clientWidth,this.height=l.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(F.prototype,"ALL_MARKER_TYPES",{get:function(){return[bt,we,Ee,Ze,xt,Re,ue,Se,Xe,re,Et,kt]},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[bt,we,Ee,Ze,Re,ue,Se]},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"BASIC_MARKER_TYPES",{get:function(){return[bt,we,Ee,Ze,ue]},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(l){var f=this;this._availableMarkerTypes.splice(0),l.forEach(function(R){if(typeof R=="string"){var Q=f.ALL_MARKER_TYPES.find(function(B){return B.typeName===R});Q!==void 0&&f._availableMarkerTypes.push(Q)}else f._availableMarkerTypes.push(R)})},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"zoomLevel",{get:function(){return this._zoomLevel},set:function(l){this._zoomLevel=l,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(F.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),F.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),this.settings.displayMode==="popup"&&this.onPopupTargetResize(),Fe.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},F.prototype.show=function(){var l=this;this.styles.styleSheetRoot===void 0&&it.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=it.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(f){return f(new Gt(l))})},F.prototype.render=function(){return Ue(this,void 0,void 0,function(){var l;return Pe(this,function(f){switch(f.label){case 0:return this.setCurrentMarker(),(l=new dt).naturalSize=this.renderAtNaturalSize,l.imageType=this.renderImageType,l.imageQuality=this.renderImageQuality,l.markersOnly=this.renderMarkersOnly,l.width=this.renderWidth,l.height=this.renderHeight,[4,l.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return f.sent(),[4,l.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,f.sent()]}})})},F.prototype.close=function(l){var f=this;if(l===void 0&&(l=!1),this.isOpen){var R=!1;l||this.eventListeners.beforeclose.forEach(function(Q){var B=new Gt(f,!0);Q(B),B.defaultPrevented&&(R=!0)}),R||(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.settings.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),this.eventListeners.close.forEach(function(Q){return Q(new Gt(f))}),this.detachEvents(),this._isOpen=!1)}},F.prototype.addMarkersToToolbar=function(){for(var l,f=[],R=0;R<arguments.length;R++)f[R]=arguments[R];(l=this._availableMarkerTypes).push.apply(l,f)},F.prototype.addRenderEventListener=function(l){this.addEventListener("render",function(f){l(f.dataUrl,f.state)})},F.prototype.removeRenderEventListener=function(l){},F.prototype.addCloseEventListener=function(l){this.addEventListener("close",function(){l()})},F.prototype.removeCloseEventListener=function(l){},F.prototype.setupResizeObserver=function(){var l=this;this.settings.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){l.resize(l.target.clientWidth,l.target.clientHeight)}),this.targetObserver.observe(this.target)):this.settings.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){return l.onPopupTargetResize()}),this.targetObserver.observe(this.editorCanvas)),window.addEventListener("resize",this.setWindowHeight))},F.prototype.onPopupTargetResize=function(){var l=1*this.target.clientWidth/this.target.clientHeight,f=this.editorCanvas.clientWidth/l>this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*l:this.editorCanvas.clientWidth,R=f<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/l;this.resize(f,R)},F.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},F.prototype.resize=function(l,f){this._isResizing=!0;var R=l/this.imageWidth,Q=f/this.imageHeight;this.imageWidth=Math.round(l),this.imageHeight=Math.round(f),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(R,Q),this._isResizing=!1},F.prototype.scaleMarkers=function(l,f){var R,Q=this;this._currentMarker&&this._currentMarker instanceof Ze?this._currentMarker.scale(l,f):(R=this._currentMarker,this.setCurrentMarker()),this.markers.forEach(function(B){B!==Q._currentMarker&&B.scale(l,f)}),R!==void 0&&this.setCurrentMarker(R)},F.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"},F.prototype.setTopLeft=function(){var l=this.editingTarget.getBoundingClientRect(),f=this.editorCanvas.getBoundingClientRect();this.left=l.left-f.left,this.top=l.top-f.top},F.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)},F.prototype.addDefs=function(){for(var l,f=[],R=0;R<arguments.length;R++)f[R]=arguments[R];this.defs=se.createDefs(),this.addDefsToImage(),(l=this.defs).append.apply(l,f)},F.prototype.addDefsToImage=function(){this.defs&&this.markerImage.insertBefore(this.defs,this.markerImage.firstChild)},F.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)},F.prototype.positionMarkerImage=function(){this.markerImageHolder.style.top=this.top/this.zoomLevel+"px",this.markerImageHolder.style.left=this.left/this.zoomLevel+"px"},F.prototype.attachEvents=function(){this.markerImage.addEventListener("pointerdown",this.onPointerDown),this.markerImage.addEventListener("dblclick",this.onDblClick),this.attachWindowEvents()},F.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)},F.prototype.detachEvents=function(){this.markerImage.removeEventListener("pointerdown",this.onPointerDown),this.markerImage.removeEventListener("dblclick",this.onDblClick),this.detachWindowEvents()},F.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)},F.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 l=document.createElement("a");l.href="https://markerjs.com/",l.target="_blank",l.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>',l.title="Powered by marker.js",l.style.display="grid",l.style.alignItems="center",l.style.justifyItems="center",l.style.padding="3px",l.style.width="20px",l.style.height="20px",this.logoUI.appendChild(l),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},F.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")},F.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"},F.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},F.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 l=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=l+"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 Ye(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 rt(this.uiDiv,this.settings.displayMode,this.uiStyleSettings,this.styles),this.toolbox.show(this._silentRenderMode||this.uiStyleSettings.hideToolbox?"hidden":"visible")},F.prototype.closeUI=function(){this.settings.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},F.prototype.removeMarker=function(l){this.markerImage.removeChild(l.container),this.markers.indexOf(l)>-1&&this.markers.splice(this.markers.indexOf(l),1),l.dispose()},F.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())},F.prototype.toolbarButtonClicked=function(l,f){if(l==="marker"&&f!==void 0)this.createNewMarker(f);else if(l==="action")switch(f){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()}},F.prototype.deleteSelectedMarker=function(){var l=this;if(this._currentMarker!==void 0){var f=!1;if(this.eventListeners.markerbeforedelete.forEach(function(Q){var B=new Ct(l,l._currentMarker,!0);Q(B),B.defaultPrevented&&(f=!0)}),!f){var R=this._currentMarker;this._currentMarker.dispose(),this.markerImage.removeChild(this._currentMarker.container),this.markers.splice(this.markers.indexOf(this._currentMarker),1),this.setCurrentMarker(),this.addUndoStep(),this.eventListeners.markerdelete.forEach(function(Q){return Q(new Ct(l,R))})}}},F.prototype.clear=function(){var l=this,f=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(ve){var ze=new Ct(l,void 0,!0);ve(ze),ze.defaultPrevented&&(f=!0)}),!f)){this.setCurrentMarker();for(var R=function(ve){var ze=Q.markers[ve];Q.setCurrentMarker(Q.markers[ve]),Q._currentMarker.dispose(),Q.markerImage.removeChild(Q._currentMarker.container),Q.markers.splice(Q.markers.indexOf(Q._currentMarker),1),Q.eventListeners.markerdelete.forEach(function(lt){return lt(new Ct(l,ze))})},Q=this,B=this.markers.length-1;B>=0;B--)R(B);this.addUndoStep()}},Object.defineProperty(F.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),F.prototype.showNotesEditor=function(){var l;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=(l=this._currentMarker.notes)!==null&&l!==void 0?l:"",this.overlayContainer.appendChild(this.notesArea))},F.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)},F.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},F.prototype.addUndoStep=function(){var l=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var f=this.getState(),R=this.undoRedoManager.getLastUndoStep();if(!R||R.width===f.width&&R.height===f.height){var Q=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(f),Q<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach(function(B){return B(new Gt(l))})}else this.undoRedoManager.replaceLastUndoStep(f),this.eventListeners.statechange.forEach(function(B){return B(new Gt(l))})}},F.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},F.prototype.undoStep=function(){var l=this,f=this.undoRedoManager.undo();f!==void 0&&(this.restoreState(f),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(R){return R(new Gt(l))}))},F.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},F.prototype.redoStep=function(){var l=this,f=this.undoRedoManager.redo();f!==void 0&&(this.restoreState(f),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(R){return R(new Gt(l))}))},F.prototype.stepZoom=function(){var l=this.zoomSteps.indexOf(this.zoomLevel);this.zoomLevel=l<this.zoomSteps.length-1?this.zoomSteps[l+1]:this.zoomSteps[0]},F.prototype.panTo=function(l){this.contentDiv.scrollBy({left:this.prevPanPoint.x-l.x,top:this.prevPanPoint.y-l.y}),this.prevPanPoint=l},F.prototype.startRenderAndClose=function(){return Ue(this,void 0,void 0,function(){var l,f,R=this;return Pe(this,function(Q){switch(Q.label){case 0:return[4,this.render()];case 1:return l=Q.sent(),f=this.getState(),this.eventListeners.render.forEach(function(B){return B(new Kt(R,l,f))}),this.close(!0),[2]}})})},F.prototype.getState=function(l){l===!0&&this.setCurrentMarker();var f={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach(function(R){return f.markers.push(R.getState())}),f},F.prototype.restoreState=function(l){var f=this;for(this.markers.splice(0);this.markerImage.lastChild;)this.markerImage.removeChild(this.markerImage.lastChild);l.markers.forEach(function(R){var Q=f._availableMarkerTypes.find(function(ve){return ve.typeName===R.typeName});if(Q!==void 0){var B=f.addNewMarker(Q);B.restoreState(R),f.markers.push(B)}}),l.width&&l.height&&(l.width!==this.imageWidth||l.height!==this.imageHeight)&&this.scaleMarkers(this.imageWidth/l.width,this.imageHeight/l.height),this.eventListeners.restorestate.forEach(function(R){return R(new Gt(f))})},F.prototype.addNewMarker=function(l){var f=se.createGroup();return this.markerImage.appendChild(f),new l(f,this.overlayContainer,this.settings)},F.prototype.createNewMarker=function(l){var f,R=this;(f=typeof l=="string"?this._availableMarkerTypes.find(function(Q){return Q.typeName===l}):l)&&(this.setCurrentMarker(),this.addUndoStep(),this._currentMarker=this.addNewMarker(f),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(f.typeName),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this.eventListeners.markercreating.forEach(function(Q){return Q(new Ct(R,R._currentMarker))}))},F.prototype.markerCreated=function(l){var f=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(l),this.setCurrentMarker(l),l instanceof we&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(we):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach(function(R){return R(new Ct(f,f._currentMarker))})},F.prototype.colorChanged=function(l){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultColor=l,this.settings.defaultStrokeColor=l)},F.prototype.fillColorChanged=function(l){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultFillColor=l)},F.prototype.markerStateChanged=function(l){var f=this;this.eventListeners.markerchange.forEach(function(R){return R(new Ct(f,l))})},F.prototype.setCurrentMarker=function(l){var f=this;this._currentMarker!==l&&this._currentMarker!==void 0&&(this._currentMarker.deselect(),this.toolbar.setCurrentMarker(),this.toolbox.setPanelButtons([]),this._isResizing||this.eventListeners.markerdeselect.forEach(function(R){return R(new Ct(f,f._currentMarker))})),this._currentMarker=l,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(R){return R(new Ct(f,f._currentMarker))}))},F.prototype.onPointerDown=function(l){if(this._isFocused||this.focus(),this.touchPoints++,this.touchPoints===1||l.pointerType!=="touch")if(this._currentMarker===void 0||this._currentMarker.state!=="new"&&this._currentMarker.state!=="creating"){if(this.mode==="select"){var f=this.markers.find(function(R){return R.ownsTarget(l.target)});f!==void 0?(this.setCurrentMarker(f),this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(l.clientX,l.clientY),l.target)):(this.setCurrentMarker(),this.isDragging=!0,this.prevPanPoint={x:l.clientX,y:l.clientY})}}else this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(l.clientX,l.clientY))},F.prototype.onDblClick=function(l){if(this._isFocused||this.focus(),this.mode==="select"){var f=this.markers.find(function(R){return R.ownsTarget(l.target)});f!==void 0&&f!==this._currentMarker&&this.setCurrentMarker(f),this._currentMarker!==void 0?this._currentMarker.dblClick(this.clientToLocalCoordinates(l.clientX,l.clientY),l.target):this.setCurrentMarker()}},F.prototype.onPointerMove=function(l){this.touchPoints!==1&&l.pointerType==="touch"||(this._currentMarker!==void 0||this.isDragging)&&(this._currentMarker!==void 0&&this._currentMarker.state==="edit"||l.preventDefault(),this._currentMarker!==void 0?this._currentMarker.manipulate(this.clientToLocalCoordinates(l.clientX,l.clientY)):this.zoomLevel>1&&this.panTo({x:l.clientX,y:l.clientY}))},F.prototype.onPointerUp=function(l){this.touchPoints>0&&this.touchPoints--,this.touchPoints===0&&this.isDragging&&this._currentMarker!==void 0&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(l.clientX,l.clientY)),this.isDragging=!1,this.addUndoStep()},F.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},F.prototype.onKeyUp=function(l){this._currentMarker===void 0||this.notesArea!==void 0||l.key!=="Delete"&&l.key!=="Backspace"||this.deleteSelectedMarker()},F.prototype.clientToLocalCoordinates=function(l,f){var R=this.markerImage.getBoundingClientRect();return{x:(l-R.left)/this.zoomLevel,y:(f-R.top)/this.zoomLevel}},F.prototype.onWindowResize=function(){this.positionUI()},F.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var l=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=l+"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()},F.prototype.addLicenseKey=function(l){Fe.addKey(l)},F.prototype.addEventListener=function(l,f){this.eventListeners.addEventListener(l,f)},F.prototype.removeEventListener=function(l,f){this.eventListeners.removeEventListener(l,f)},F.prototype.renderState=function(l){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(l),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(F.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),F.prototype.focus=function(){var l=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,this._previousCurrentMarker!==void 0&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach(function(f){return f(new Gt(l))}))},F.prototype.blur=function(){var l=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(f){return f(new Gt(l))}))},F.instanceCounter=0,F}();/* **********************************
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 Ir=function(F,l){return(Ir=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(f,R){f.__proto__=R}||function(f,R){for(var Q in R)Object.prototype.hasOwnProperty.call(R,Q)&&(f[Q]=R[Q])})(F,l)};function Pr(F,l){if(typeof l!="function"&&l!==null)throw new TypeError("Class extends value "+String(l)+" is not a constructor or null");function f(){this.constructor=F}Ir(F,l),F.prototype=l===null?Object.create(l):(f.prototype=l.prototype,new f)}function Vt(F,l,f,R){return new(f||(f=Promise))(function(Q,B){function ve(At){try{lt(R.next(At))}catch($e){B($e)}}function ze(At){try{lt(R.throw(At))}catch($e){B($e)}}function lt(At){var $e;At.done?Q(At.value):($e=At.value,$e instanceof f?$e:new f(function(Rt){Rt($e)})).then(ve,ze)}lt((R=R.apply(F,l||[])).next())})}function an(F,l){var f,R,Q,B,ve={label:0,sent:function(){if(1&Q[0])throw Q[1];return Q[1]},trys:[],ops:[]};return B={next:ze(0),throw:ze(1),return:ze(2)},typeof Symbol=="function"&&(B[Symbol.iterator]=function(){return this}),B;function ze(lt){return function(At){return function($e){if(f)throw new TypeError("Generator is already executing.");for(;ve;)try{if(f=1,R&&(Q=2&$e[0]?R.return:$e[0]?R.throw||((Q=R.return)&&Q.call(R),0):R.next)&&!(Q=Q.call(R,$e[1])).done)return Q;switch(R=0,Q&&($e=[2&$e[0],Q.value]),$e[0]){case 0:case 1:Q=$e;break;case 4:return ve.label++,{value:$e[1],done:!1};case 5:ve.label++,R=$e[1],$e=[0];continue;case 7:$e=ve.ops.pop(),ve.trys.pop();continue;default:if(!(Q=ve.trys,(Q=Q.length>0&&Q[Q.length-1])||$e[0]!==6&&$e[0]!==2)){ve=0;continue}if($e[0]===3&&(!Q||$e[1]>Q[0]&&$e[1]<Q[3])){ve.label=$e[1];break}if($e[0]===6&&ve.label<Q[1]){ve.label=Q[1],Q=$e;break}if(Q&&ve.label<Q[2]){ve.label=Q[2],ve.ops.push($e);break}Q[2]&&ve.ops.pop(),ve.trys.pop();continue}$e=l.call(F,ve)}catch(Rt){$e=[6,Rt],R=0}finally{f=Q=0}if(5&$e[0])throw $e[1];return{value:$e[0]?$e[1]:void 0,done:!0}}([lt,At])}}}var En=function(){function F(){}return F.addKey=function(l){F.key=l},Object.defineProperty(F,"isLicensed",{get:function(){return!!F.key&&new RegExp(/^CRPR-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(F.key)},enumerable:!1,configurable:!0}),F}(),It=function(){function F(){}return F.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},F.setAttributes=function(l,f){for(var R=0,Q=f;R<Q.length;R++){var B=Q[R],ve=B[0],ze=B[1];l.setAttribute(ve,ze)}},F.createRect=function(l,f,R){var Q=document.createElementNS("http://www.w3.org/2000/svg","rect");return Q.setAttribute("width",l.toString()),Q.setAttribute("height",f.toString()),R&&F.setAttributes(Q,R),Q},F.createLine=function(l,f,R,Q,B){var ve=document.createElementNS("http://www.w3.org/2000/svg","line");return ve.setAttribute("x1",l.toString()),ve.setAttribute("y1",f.toString()),ve.setAttribute("x2",R.toString()),ve.setAttribute("y2",Q.toString()),B&&F.setAttributes(ve,B),ve},F.createPolygon=function(l,f){var R=document.createElementNS("http://www.w3.org/2000/svg","polygon");return R.setAttribute("points",l),f&&F.setAttributes(R,f),R},F.createCircle=function(l,f){var R=document.createElementNS("http://www.w3.org/2000/svg","circle");return R.setAttribute("cx",(l/2).toString()),R.setAttribute("cy",(l/2).toString()),R.setAttribute("r",l.toString()),f&&F.setAttributes(R,f),R},F.createEllipse=function(l,f,R){var Q=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return Q.setAttribute("cx",(l/2).toString()),Q.setAttribute("cy",(f/2).toString()),Q.setAttribute("rx",(l/2).toString()),Q.setAttribute("ry",(f/2).toString()),R&&F.setAttributes(Q,R),Q},F.createGroup=function(l){var f=document.createElementNS("http://www.w3.org/2000/svg","g");return l&&F.setAttributes(f,l),f},F.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},F.createMarker=function(l,f,R,Q,B,ve,ze){var lt=document.createElementNS("http://www.w3.org/2000/svg","marker");return F.setAttributes(lt,[["id",l],["orient",f],["markerWidth",R.toString()],["markerHeight",Q.toString()],["refX",B.toString()],["refY",ve.toString()]]),lt.appendChild(ze),lt},F.createText=function(l){var f=document.createElementNS("http://www.w3.org/2000/svg","text");return f.setAttribute("x","0"),f.setAttribute("y","0"),l&&F.setAttributes(f,l),f},F.createTSpan=function(l,f){var R=document.createElementNS("http://www.w3.org/2000/svg","tspan");return R.textContent=l,f&&F.setAttributes(R,f),R},F.createImage=function(l){var f=document.createElementNS("http://www.w3.org/2000/svg","image");return l&&F.setAttributes(f,l),f},F.createPoint=function(l,f){var R=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return R.x=l,R.y=f,R},F.createPath=function(l,f){var R=document.createElementNS("http://www.w3.org/2000/svg","path");return R.setAttribute("d",l),f&&F.setAttributes(R,f),R},F.createElement=function(l,f){var R=document.createElementNS("http://www.w3.org/2000/svg",l);return f&&F.setAttributes(R,f),R},F.getHollowRectanglePath=function(l,f,R,Q,B,ve,ze,lt){return"M"+l+","+f+"V"+(f+Q)+"H"+(l+R)+"V"+f+"H"+B+"V"+ve+"H"+(B+ze)+"V"+(ve+lt)+"H"+B+"V"+f+"Z"},F}(),An=function(){function F(l){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+l+"_"}return Object.defineProperty(F.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(F.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(F.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_out"},enumerable:!1,configurable:!0}),F.prototype.addClass=function(l){return this.styleSheet===void 0&&this.addStyleSheet(),l.name=""+this.classNamePrefix+l.localName,this.classes.push(l),this.styleSheet.sheet.insertRule("."+l.name+" {"+l.style+"}",this.styleSheet.sheet.cssRules.length),l},F.prototype.addRule=function(l){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(l),this.styleSheet.sheet.insertRule(l.selector+" {"+l.style+"}",this.styleSheet.sheet.cssRules.length)},F.prototype.addStyleSheet=function(){var l;this.styleSheet=document.createElement("style"),((l=this.styleSheetRoot)!==null&&l!==void 0?l:document.head).appendChild(this.styleSheet),this.addRule(new on("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new on("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
from {
opacity: 0;
}
to {
opacity: 1;
}
`)),this.addRule(new on("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
from {
opacity: 1;
}
to {
opacity: 0;
}
`)),this.addClass(new sn("_fade_in",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
`)),this.addClass(new sn("_fade_out",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
`))},F.prototype.removeStyleSheet=function(){var l;this.styleSheet&&(((l=this.styleSheetRoot)!==null&&l!==void 0?l:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},F}(),on=function(F,l){this.selector=F,this.style=l},sn=function(F,l){this.localName=F,this.style=l},Un=function(){function F(){this.blocks=[],this.display=""}return F.prototype.addButtonBlock=function(l){l.className=this.blockClassName,l.buttonClassName=this.buttonClassName,l.buttonColorsClassName=this.buttonColorsClassName,l.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(l)},F.prototype.addElementBlock=function(l){l.className===void 0&&(l.className=this.blockClassName),this.blocks.push(l)},F.prototype.getUI=function(){var l=document.createElement("div");return l.className=this.className+" "+this.colorsClassName+" "+this.fadeInClassName,l.style.display=this.display,this.blocks.forEach(function(f){return l.appendChild(f.getUI())}),l},F}(),ci=function(){function F(){}return F.prototype.getUI=function(){var l=document.createElement("div");if(l.className=this.className,this.minWidth!==void 0&&(l.style.minWidth=this.minWidth),this.contentAlign!==void 0)switch(this.contentAlign){case"start":l.style.justifyContent="flex-start";break;case"center":l.style.justifyContent="center";break;case"end":l.style.justifyContent="flex-end"}return l.style.whiteSpace="nowrap",l},F}(),Qn=function(F){function l(){var f=F!==null&&F.apply(this,arguments)||this;return f.buttons=[],f}return Pr(l,F),l.prototype.addButton=function(f){f.className=this.buttonClassName,f.colorsClassName=this.buttonColorsClassName,f.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(f)},l.prototype.getUI=function(){var f=F.prototype.getUI.call(this);return this.buttons.forEach(function(R){return f.appendChild(R.getUI())}),f},l}(ci),mr=function(){function F(l,f){this._isActive=!1,this._isHidden=!1,this._icon=l,this.title=f,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(F.prototype,"icon",{get:function(){return this._icon},set:function(l){this._icon=l,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"isActive",{get:function(){return this._isActive},set:function(l){this._isActive=l,this.adjustClassName()},enumerable:!1,configurable:!0}),F.prototype.getUI=function(){var l=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 l.onClick()}),this.uiContainer.appendChild(this.buttonContainer),this.uiContainer.style.display=this._isHidden?"none":"inline-block",this.uiContainer},F.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,"")))},F.prototype.hide=function(){this._isHidden=!0},F}(),wt=function(F){function l(){var f=F!==null&&F.apply(this,arguments)||this;return f.elements=[],f}return Pr(l,F),l.prototype.addElement=function(f){this.elements.push(f)},l.prototype.getUI=function(){var f=F.prototype.getUI.call(this);return this.elements.forEach(function(R){return f.appendChild(R)}),f},l}(ci),Vn=function(){function F(l,f){this.horizontal=l,this.vertical=f}return Object.defineProperty(F.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),F.prototype.getVerticalLength=function(l){return l/this.ratio},F.prototype.getHorizontalLength=function(l){return l*this.ratio},F}(),oi=function(){function F(){}return F.getIcon=function(l,f){if(l>0&&f>0){var R=new Vn(l,f),Q=R.ratio>=1?20:R.getHorizontalLength(20),B=R.ratio<1?20:R.getVerticalLength(20),ve=document.createElementNS("http://www.w3.org/2000/svg","svg");ve.setAttribute("xmlns","http://www.w3.org/2000/svg"),ve.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(ve);var ze=It.createDefs();ve.appendChild(ze);var lt=It.createElement("clipPath",[["id","text-bg-clip"]]);ze.appendChild(lt);var At=It.createPath(It.getHollowRectanglePath((24-Q)/2,(24-B)/2,Q,B,(24-Q)/2+2,(24-B)/2+2,Q-4,B-4));ve.appendChild(At);var $e=It.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);$e.appendChild(It.createTSpan(l+":"+f)),ve.appendChild($e);var Rt=$e.getBBox();It.setAttributes($e,[["x",((24-Rt.width)/2).toString()],["y",((24-Rt.height)/2-Rt.y).toString()]]);var gr=It.createPath(It.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(Rt.width))/2,(24-Math.ceil(Rt.height))/2,Math.ceil(Rt.width),Math.ceil(Rt.height)));return lt.appendChild(gr),It.setAttributes(At,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(ve),ve.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>'},F}(),mn=function(F){function l(f,R,Q){var B=F.call(this,f,R)||this;return B.isDropdownOpen=!1,B.onClick=B.dropdownButtonClicked,B.dropdownButtons=Q,B}return Pr(l,F),l.prototype.setupDropdown=function(){var f=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(R){R.className=f.className,R.colorsClassName=f.colorsClassName,f.dropdownBlock.appendChild(R.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},l.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},l.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},l.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},l.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},l.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},l}(mr),nr=function(){function F(l,f){this.GRIP_SIZE=10,this.color=l,this.fillColor=f,this.visual=It.createGroup(),this.visual.appendChild(It.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(It.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return F.prototype.ownsTarget=function(l){return l===this.visual||l===this.visual.childNodes[0]||l===this.visual.childNodes[1]},F.prototype.setCenter=function(l,f){this.visual.childNodes.forEach(function(R){return It.setAttributes(R,[["cx",l.toString()],["cy",f.toString()]])})},F}(),Bn=function(){function F(l,f,R,Q){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=l,this.canvasHeight=f,this.margin=R,this.container=Q,this.attachEvents=this.attachEvents.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.resize=this.resize.bind(this),this.adjustCropRect=this.adjustCropRect.bind(this),this.scaleCanvas=this.scaleCanvas.bind(this),this.getRescaledRect=this.getRescaledRect.bind(this)}return Object.defineProperty(F.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(l){this._aspectRatio=l,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(l){this._isGridVisible=l,this.gridContainer&&It.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(l){this._zoomFactor=l,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),F.prototype.open=function(){var l=this;this.cropShadeElement=It.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=It.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var f=0;f<this.numberOfGridLines;f++)this.horizontalGridLines.push(It.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push(It.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]]));this.horizontalGridLines.forEach(function(R){return l.gridContainer.appendChild(R)}),this.verticalGridLines.forEach(function(R){return l.gridContainer.appendChild(R)}),this.cropRectElement=It.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new nr(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new nr(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new nr(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new nr(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomRightGrip.visual),this.attachEvents()},F.prototype.setCropRectangle=function(l){this.cropRect=l;var f=Object.assign({},this.cropRect);this.zoomFactor!==1&&(f.width=this.cropRect.width*this.zoomFactor,f.height=this.cropRect.height*this.zoomFactor,f.x=this.cropRect.height/this.cropRect.width<this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasWidth/2-f.width/2,f.y=this.cropRect.height/this.cropRect.width>this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-f.height/2),It.setAttributes(this.cropRectElement,[["x",f.x.toString()],["y",f.y.toString()],["width",f.width.toString()],["height",f.height.toString()]]);var R=f.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(B,ve){var ze=f.y+R*(ve+1);It.setAttributes(B,[["x1",""+f.x],["y1",""+ze],["x2",""+(f.x+f.width)],["y2",""+ze]])});var Q=f.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(B,ve){var ze=f.x+Q*(ve+1);It.setAttributes(B,[["x1",""+ze],["y1",""+f.y],["x2",""+ze],["y2",""+(f.y+f.height)]])}),It.setAttributes(this.cropShadeElement,[["d",It.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,f.x,f.y,f.width,f.height)]]),this.topLeftGrip.setCenter(f.x,f.y),this.topRightGrip.setCenter(f.x+f.width,f.y),this.bottomLeftGrip.setCenter(f.x,f.y+f.height),this.bottomRightGrip.setCenter(f.x+f.width,f.y+f.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},F.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)},F.prototype.clientToLocalCoordinates=function(l,f){var R=this.container.getBoundingClientRect();return{x:l-R.left+this.margin,y:f-R.top+this.margin}},F.prototype.onPointerDown=function(l){this.container.setPointerCapture(l.pointerId),this.previousPoint=this.clientToLocalCoordinates(l.clientX,l.clientY),this.cropRectElement===l.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(l.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(l.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(l.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(l.target)&&(this.activeGrip=this.bottomRightGrip)},F.prototype.onPointerMove=function(l){if(this.isMoving)this.move(this.clientToLocalCoordinates(l.clientX,l.clientY));else if(this.activeGrip){var f=this.clientToLocalCoordinates(l.clientX,l.clientY);this.resize(f)}l.preventDefault()},F.prototype.onPointerUp=function(l){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(l.pointerId)},F.prototype.move=function(l){var f=l.x-this.previousPoint.x,R=l.y-this.previousPoint.y;this.zoomFactor!==1&&(f=-f/this.zoomFactor,R=-R/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+f),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+R),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=l},F.prototype.resize=function(l){var f=Object.assign({},this.cropRect),R=l.x-this.previousPoint.x,Q=l.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:f.x+R<this.margin&&(R=this.margin-f.x),f.x+=R,f.width=this.cropRect.x+this.cropRect.width-f.x;break;case this.bottomRightGrip:case this.topRightGrip:f.width+R>this.canvasWidth*this.zoomFactor&&(R=this.canvasWidth*this.zoomFactor-f.width),f.width+=R}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(f.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(R),f.height=this.aspectRatio.getVerticalLength(f.width)):(f.y+=Q,f.height=this.cropRect.y+this.cropRect.height-f.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?f.height=this.aspectRatio.getVerticalLength(f.width):f.height+=Q}f.width<10&&(f.x=this.cropRect.x,f.width=10),f.height<10&&(f.y=this.cropRect.y,f.height=10),this.previousPoint=l,f.x>=this.margin&&f.y>=this.margin&&f.x-this.margin+f.width<=this.canvasWidth&&f.y-this.margin+f.height<=this.canvasHeight&&(this.cropRect=f,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},F.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var l=this.cropRect.x+this.cropRect.width/2,f=this.cropRect.y+this.cropRect.height/2,R=this.aspectRatio.getHorizontalLength(this.cropRect.height),Q=this.aspectRatio.getVerticalLength(this.cropRect.width);R/this.canvasWidth<Q/this.canvasHeight?this.cropRect.width=R:this.cropRect.height=Q,this.cropRect.width>this.canvasWidth&&(this.cropRect.height/=this.cropRect.width/this.canvasWidth,this.cropRect.width=this.canvasWidth),this.cropRect.height>this.canvasHeight&&(this.cropRect.width/=this.cropRect.height/this.canvasHeight,this.cropRect.height=this.canvasHeight),this.cropRect.x=l-this.cropRect.width/2,this.cropRect.y=f-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)}},F.prototype.getRescaledRect=function(l,f,R,Q,B,ve){var ze=R/l,lt=Q/f;return{x:(B.x-ve)*ze+ve,y:(B.y-ve)*lt+ve,width:B.width*ze,height:B.height*lt}},F.prototype.scaleCanvas=function(l,f){var R=this.getRescaledRect(this.canvasWidth,this.canvasHeight,l,f,this.cropRect,this.margin);this.canvasWidth=l,this.canvasHeight=f,this.onCropChange&&this.onCropChange(R),this.setCropRectangle(R)},F}(),Zn=function(){function F(l){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=l,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(F.prototype,"angle",{get:function(){return this._angle},set:function(l){this._angle=l,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),F.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},F.prototype.onPointerDown=function(l){this.controlContainer.setPointerCapture(l.pointerId),this.isDragging=!0,this.previousPoint={x:l.clientX,y:l.clientY}},F.prototype.onPointerMove=function(l){this.isDragging&&(this.onAngleChange&&this.onAngleChange((l.clientX-this.previousPoint.x)/5),this.previousPoint.x=l.clientX)},F.prototype.onPointerUp=function(l){this.isDragging&&this.onAngleChange&&this.onAngleChange((l.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(l.pointerId)},F.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var l=this.angleLabelText.getBBox();It.setAttributes(this.angleLabelElement,[["x",((this.width-l.width)/2).toString()],["y",(this.height/2).toString()]])}},F.prototype.positionScaleShape=function(){if(this.scaleShape){var l=this.scaleShape.transform.baseVal.getItem(0);l.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(l,0)}},F.prototype.getVisual=function(){var l=document.createElementNS("http://www.w3.org/2000/svg","svg");l.setAttribute("xmlns","http://www.w3.org/2000/svg"),l.setAttribute("width",this.width+"px"),l.setAttribute("height",this.height+"px"),l.setAttribute("viewBox","0 0 "+this.width+" "+this.height),l.style.flexShrink="0",document.body.appendChild(l);for(var f="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,R=1;R<=this.width/5+10;R++){var Q=R%5==0?this.height/3:this.height/6;f+="h4v"+-Q+"h1v"+Q}f+="v1H0Z",this.scaleShape=It.createPath(f);var B=It.createTransform();this.scaleShape.transform.baseVal.appendItem(B),l.appendChild(this.scaleShape),this.angleLabelElement=It.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=It.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var ve=It.createTSpan("");return ve.innerHTML="&deg;",this.angleLabelElement.appendChild(ve),l.appendChild(this.angleLabelElement),document.body.removeChild(l),l},F}(),hi=function(){function F(){this.naturalSize=!1,this.imageType="image/png"}return F.prototype.rasterize=function(l,f,R,Q,B,ve,ze){var lt=this;return new Promise(function(At){var $e=document.createElement("canvas");$e.width=l.width.baseVal.value-2*Q,$e.height=l.height.baseVal.value-2*Q;var Rt=1,gr=1;lt.naturalSize===!0?(Rt=f.naturalWidth/(l.width.baseVal.value-2*Q)/ve,gr=f.naturalHeight/(l.height.baseVal.value-2*Q)/ze,$e.width=f.naturalWidth/ve,$e.height=f.naturalHeight/ze):lt.width!==void 0&&lt.height!==void 0&&(Rt=lt.width/R.width,gr=lt.height/R.height,$e.width*=Rt,$e.height*=gr);var Dr=$e.getContext("2d");Dr.translate($e.width/2,$e.height/2),Dr.rotate(B*Math.PI/180),Dr.scale(ve,ze),Dr.translate(-$e.width/2,-$e.height/2),Dr.drawImage(f,0,0,$e.width,$e.height);var Ln=document.createElement("canvas");Ln.width=R.width*Rt,Ln.height=R.height*gr,Ln.getContext("2d").putImageData(Dr.getImageData((R.x-Q)*Rt,(R.y-Q)*gr,R.width*Rt,R.height*gr),0,0),At(Ln.toDataURL(lt.imageType,lt.imageQuality))})},F}(),Je=function(){function F(l){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=F.instanceCounter++,this.styles=new An(this.instanceNo),this.target=l,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(F.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(l){this._zoomToCropEnabled=l,l?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(l){this._isGridVisible=l,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"gridLines",{get:function(){return this._gridLines},set:function(l){this._gridLines=l,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(l){this._rotationAngle=l,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"aspectRatio",{get:function(){var l;return(l=this._aspectRatio)!==null&&l!==void 0?l:this.aspectRatios[0]},set:function(l){this._aspectRatio=l},enumerable:!1,configurable:!0}),F.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},F.prototype.show=function(){this.showUI(),this.open()},F.prototype.close=function(l){l===void 0&&(l=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),l||this.closeEventListeners.forEach(function(f){return f()}),this._isOpen=!1)},F.prototype.addRenderEventListener=function(l){this.renderEventListeners.push(l)},F.prototype.removeRenderEventListener=function(l){this.renderEventListeners.indexOf(l)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(l),1)},F.prototype.addCloseEventListener=function(l){this.closeEventListeners.push(l)},F.prototype.removeCloseEventListener=function(l){this.closeEventListeners.indexOf(l)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(l),1)},F.prototype.setupResizeObserver=function(){var l=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){l.resize(l.target.clientWidth,l.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))},F.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var l=1*this.target.clientWidth/this.target.clientHeight,f=this.contentDiv.clientWidth/l>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*l:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,R=f+2*this.CANVAS_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/l;this.resize(f,R)}},F.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},F.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",It.setAttributes(this.editingTarget,[["width",""+this.imageWidth],["height",""+this.imageHeight]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px"},F.prototype.resize=function(l,f){this.imageWidth=Math.round(l),this.imageHeight=Math.round(f),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()},F.prototype.setEditingTarget=function(){var l=document.createElement("canvas");l.width=this.target.naturalWidth,l.height=this.target.naturalHeight,l.getContext("2d").drawImage(this.target,0,0,this.target.naturalWidth,this.target.naturalHeight);var f=l.toDataURL();It.setAttributes(this.editingTarget,[["href",f]]),this.setEditingTargetSize()},F.prototype.setTopLeft=function(){var l=this.target.getBoundingClientRect(),f=this.editorCanvas.getBoundingClientRect();this.left=l.left-f.left-this.CANVAS_MARGIN,this.top=l.top-f.top-this.CANVAS_MARGIN},F.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=It.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=It.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=It.createGroup(),this.editingTargetRotationScaleContainer=It.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var l=It.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(l);var f=It.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(f),this.editingTargetContainer=It.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)},F.prototype.positionCropImage=function(){this.cropImageHolder.style.top=this.top+"px",this.cropImageHolder.style.left=this.left+"px"},F.prototype.initCropLayer=function(){this.cropRect={x:this.CANVAS_MARGIN,y:this.CANVAS_MARGIN,width:this.imageWidth,height:this.imageHeight},this.cropLayerContainer=It.createGroup(),this.cropImage.appendChild(this.cropLayerContainer),this.cropLayer=new Bn(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()},F.prototype.zoomToCrop=function(){if(this.cropRect){var l=this.cropRect.x-this.CANVAS_MARGIN+this.cropRect.width/2,f=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=l+"px "+f+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-l+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-f+this.CANVAS_MARGIN)+"px) scale("+this.zoomFactor+")",this.cropLayer.zoomFactor=this.zoomFactor)}},F.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)},F.prototype.cropRectChanged=function(l){this.cropRect=l,this.zoomToCropEnabled?this.zoomToCrop():this.cropLayer.zoomFactor=1},F.prototype.attachEvents=function(){window.addEventListener("resize",this.onWindowResize)},F.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"},F.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},F.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 l=this.styles.settings.hideTopToolbar?0:this.toolbarHeight,f=this.target.offsetTop>l+this.CANVAS_MARGIN?this.target.offsetTop-(l+this.CANVAS_MARGIN):0;this.coverDiv.style.top=f+"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},F.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},F.prototype.addTopToolbar=function(){var l=this;this.topToolbar=new Un,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 f=new Qn;f.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(f);var R=[];this.aspectRatios.forEach(function(gr){var Dr=new mr(oi.getIcon(gr.horizontal,gr.vertical),gr.horizontal===0&&gr.vertical===0?"FREE":gr.horizontal+":"+gr.vertical);Dr.onClick=function(){return l.ratioButtonClicked(gr)},R.push(Dr)}),this.aspectRatioButton=new mn(oi.getIcon(0,0),"Aspect ratio",R),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,f.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var Q=new mr('<svg viewBox="0 0 24 24"><path d="M10 4v4h4V4h-4m6 0v4h4V4h-4m0 6v4h4v-4h-4m0 6v4h4v-4h-4m-2 4v-4h-4v4h4m-6 0v-4H4v4h4m0-6v-4H4v4h4m0-6V4H4v4h4m2 6h4v-4h-4v4M4 2h16a2 2 0 012 2v16a2 2 0 01-2 2H4c-1.08 0-2-.9-2-2V4a2 2 0 012-2z"/></svg>',"Toggle grid");Q.isActive=this.isGridVisible,Q.onClick=function(){l.isGridVisible=!l.isGridVisible,Q.isActive=l.isGridVisible},f.addButton(Q);var B=new mr('<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(B.isActive=this.zoomToCropEnabled,B.onClick=function(){l.zoomToCropEnabled=!l.zoomToCropEnabled,B.isActive=l.zoomToCropEnabled},f.addButton(B),!En.isLicensed){var ve=new wt;this.topToolbar.addElementBlock(ve);var ze=document.createElement("div");ze.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var lt=document.createElement("a");lt.style.color="currentColor",lt.href="https://markerjs.com/products/cropro",lt.target="_blank",lt.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>',ze.appendChild(lt),ve.addElement(ze)}var At=new Qn;At.minWidth=3*this.toolbarHeight+"px",At.contentAlign="end",this.topToolbar.addButtonBlock(At);var $e=new mr('<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");$e.onClick=this.startRenderAndClose,At.addButton($e),this.styles.settings.toolbarOkButtonStyleColorsClassName&&($e.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var Rt=new mr('<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");Rt.onClick=this.close,At.addButton(Rt),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(Rt.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},F.prototype.addBottomToolbar=function(){var l=this;this.bottomToolbar=new Un,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 f=new Qn;f.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(f);var R=new mr('<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");R.onClick=this.rotateLeftButtonClicked,f.addButton(R);var Q=new mr('<svg viewBox="0 0 24 24"><path d="M16.89 15.5l1.42 1.39c.9-1.16 1.45-2.5 1.62-3.89h-2.02c-.14.87-.48 1.72-1.02 2.5M13 17.9v2.02c1.39-.17 2.74-.71 3.9-1.61l-1.44-1.44c-.75.54-1.59.89-2.46 1.03m6.93-6.9a7.906 7.906 0 00-1.62-3.89l-1.42 1.42c.54.75.88 1.6 1.02 2.47m-2.36-5.45L11 1v3.07C7.06 4.56 4 7.92 4 12s3.05 7.44 7 7.93v-2.02c-2.84-.48-5-2.94-5-5.91s2.16-5.43 5-5.91V10l4.55-4.45z"/></svg>',"Rotate right");Q.onClick=this.rotateRightButtonClicked,f.addButton(Q);var B=new wt;B.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(B),this.straightener=new Zn("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(At){l.rotateBy(At),l.straightener.angle=l.rotationAngle},B.addElement(this.straightener.getUI());var ve=new Qn;ve.minWidth=2*this.toolbarHeight+"px",ve.contentAlign="end",this.bottomToolbar.addButtonBlock(ve);var ze=new mr('<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");ze.onClick=this.flipHorizontallyButtonClicked,ve.addButton(ze);var lt=new mr('<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");lt.onClick=this.flipVerticallyButtonClicked,ve.addButton(lt)},F.prototype.ratioButtonClicked=function(l){this.aspectRatio=l,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},F.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=oi.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},F.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new Vn(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},F.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},F.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},F.prototype.restoreState=function(l){if(l){var f=this.cropLayer.getRescaledRect(l.width,l.height,this.imageWidth,this.imageHeight,l.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(f),this.cropRectChanged(f),this.flippedHorizontally=l.flippedHorizontally,this.flippedVertically=l.flippedVertically,this.applyFlip(),this.rotationAngle=l.rotationAngle,this.applyRotation()}},F.prototype.clientToLocalCoordinates=function(l,f){var R=this.cropImage.getBoundingClientRect();return{x:l-R.left,y:f-R.top}},F.prototype.onWindowResize=function(){this.positionUI()},F.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var l=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=l+"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()},F.prototype.rotateLeftButtonClicked=function(){var l=this.rotationAngle-90;this.rotationAngle%90!=0&&(l+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(l)},F.prototype.rotateRightButtonClicked=function(){var l=this.rotationAngle+90;this.rotationAngle%90!=0&&(l-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(l)},F.prototype.rotateTo=function(l){l=(l=l>180?l-360:l)<=-180?l+360:l,this.rotationAngle=l,this.applyRotation()},F.prototype.rotateBy=function(l){this.rotateTo((this.rotationAngle+l)%360)},F.prototype.applyRotation=function(){var l=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var f=this.editingTargetRotationContainer.transform.baseVal.getItem(0);f.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(f,0);var R=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/R.width,this.imageHeight/R.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=l},F.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},F.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},F.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},F.prototype.startRenderAndClose=function(){return Vt(this,void 0,void 0,function(){var l,f;return an(this,function(R){switch(R.label){case 0:return[4,this.render()];case 1:return l=R.sent(),f=this.getState(),this.renderEventListeners.forEach(function(Q){return Q(l,f)}),this.close(!0),[2]}})})},F.prototype.render=function(){return Vt(this,void 0,void 0,function(){var l;return an(this,function(f){switch(f.label){case 0:return(l=new hi).naturalSize=this.renderAtNaturalSize,l.imageType=this.renderImageType,l.imageQuality=this.renderImageQuality,l.width=this.renderWidth,l.height=this.renderHeight,this.unzoomFromCrop(),It.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,l.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 f.sent(),[4,l.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,f.sent()]}})})},F.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new sn("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 sn("toolbar_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarBlockStyleClass=this.styles.addClass(new sn("toolbar-block",`
display: flex;
align-items: center;
box-sizing: content-box;
`));var l=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new sn("toolbar_button",`
display: inline-block;
width: `+(this.toolbarHeight-2*l)+`px;
height: `+(this.toolbarHeight-2*l)+`px;
padding: `+l+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new sn("toolbar_button_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new sn("toolbar_active_button",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
`)),this.styles.addRule(new on("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.toolbarHeight/2+`px;
`)),this.styles.addRule(new on("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new sn("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 sn("toolbar_dropdown_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new sn("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 sn("toolbar_straightener",`
display: flex;
overflow: hidden;
justify-content: center;
height: `+(this.toolbarHeight-2*l)+`px;
padding: `+l+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new sn("toolbar_straightener_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`))},F.instanceCounter=0,F}(),jt=ne("8hTe"),si=ne.n(jt),fi=/<pre[^>]*>/g;function Si(F){var l=document.createElement("div");return l.innerHTML=F,l.childNodes.length===0?"":l.childNodes[0].nodeValue}var li=yt.a=function(F){var l=F.value,f=l===void 0?"":l,R=F.edit,Q=R===void 0?!1:R,B=F.className,ve=F.showTextOnly,ze=F.showLines,lt=F.replaces,At=F.zoomImg,$e=F.hasMask,Rt=F.style,gr=Rt===void 0?{}:Rt,Dr=F.stylesPrev,Ln=Dr===void 0?{}:Dr,gn=String(f),ln=Object(M.useRef)(),Jn=Object(M.useRef)(),Pi=Object(M.useState)(""),Qr=Object(H.a)(Pi,2),Fn=Qr[0],pi=Qr[1],ui=Object(M.useState)("office"),Sn=Object(H.a)(ui,2),Ii=Sn[0],Ci=Sn[1],Gi=function(){var vr=new Je(Jn.current);vr.displayMode="popup",vr.addRenderEventListener(function(){var Kr=Object(P.a)(I.a.mark(function qt(zr){var Sr;return I.a.wrap(function(tn){for(;;)switch(tn.prev=tn.next){case 0:return ln.current.style.display="none",tn.next=3,Object(Ge.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:zr}});case 3:Sr=tn.sent,Sr!=null&&Sr.id&&lt(Jn.current.getAttribute("src").replace(de.a.API_SERVER,""),"/api/attachments/".concat(Sr==null?void 0:Sr.id,"?type=").concat(Sr.content_type));case 5:case"end":return tn.stop()}},qt)}));return function(qt){return Kr.apply(this,arguments)}}()),vr.show()},Vi=function(){var vr=new rr(Jn.current);vr.settings.displayMode="popup",vr.addEventListener("render",function(){var Kr=Object(P.a)(I.a.mark(function qt(zr){var Sr;return I.a.wrap(function(tn){for(;;)switch(tn.prev=tn.next){case 0:if(ln.current.style.display="none",!Jn.current){tn.next=6;break}return tn.next=4,Object(Ge.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:zr.dataUrl}});case 4:Sr=tn.sent,Sr!=null&&Sr.id&&lt(Jn.current.getAttribute("src").replace(de.a.API_SERVER,""),"/api/attachments/".concat(Sr==null?void 0:Sr.id,"?type=").concat(Sr.content_type));case 6:case"end":return tn.stop()}},qt)}));return function(qt){return Kr.apply(this,arguments)}}()),vr.show(),window.markerArea=vr},qn=Object(M.useMemo)(function(){ln.current&&(ln.current.style.zIndex=-1);try{var Fr=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,vr=/\"\/api\/attachments\/|\"\/attachments\/download\//g,Kr=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;gn=gn.replace(Fr,"("+de.a.API_SERVER+"/api/attachments/").replace(vr,'"'+de.a.API_SERVER+"/api/attachments/").replace(Kr,'"'+de.a.API_SERVER+"/files/uploads/").replaceAll("http://video.educoder","https://video.educoder").replaceAll("http://www.educoder.net/api","https://data.educoder.net/api").replaceAll("https://www.educoder.net/api","https://data.educoder.net/api").replace(/\r\n/g,`
`)}catch(ei){}var qt=ee(gn),zr=S();if(gn.match(/\[TOC\]/)&&(qt=qt.replace("<p>[TOC]</p>",k()),E()),qt=qt.replace(/(__special_katext_id_\d+__)/g,function(ei,tn){var vn=zr[tn],Xi=vn.type,Ti=vn.expression;return Object(be.renderToString)(Si(Ti)||"",{displayMode:Xi==="block",throwOnError:!1,output:"html"})}),qt=qt.replace(/▁/g,"\u2581\u2581\u2581"),v(),ve){var Sr=document.createElement("div");return Sr.innerHTML=qt,Sr.innerText}return setTimeout(function(){return oa()},500),qt},[gn]),en=Object(M.useRef)();g.WebkitLineClamp=ze,ze&&(gr=Object(w.a)(Object(w.a)({},gr),g));function mi(Fr){var vr=Fr.target;if(vr.tagName.toUpperCase()==="IMG"){if(At){var Kr=vr.getAttribute("src");pi(Kr),Ci("image")}}else if(vr.tagName.toUpperCase()==="A"){var qt=vr.getAttribute("href");if(qt.indexOf("office")>-1)Fr.preventDefault(),pi(qt),Ci("office");else if(qt.indexOf("application/pdf")>-1)Fr.preventDefault(),pi(qt),Ci("pdf");else if(qt.indexOf("text/html")>-1)Fr.preventDefault(),pi(qt),Ci("html");else if(qt.startsWith("#")){Fr.preventDefault();var zr=document.getElementById(qt.replace("#",""));zr&&zr.scrollIntoView(!0)}}}var oa=function(){var vr,Kr=(vr=en.current)===null||vr===void 0?void 0:vr.querySelectorAll("video");Kr==null||Kr.forEach(function(qt){if(qt.oncontextmenu=function(){return!1},qt.src.indexOf(".m3u8")>-1&&!qt.canPlayType("application/vnd.apple.mpegurl")){if(te.a.isSupported()){var zr=new te.a;zr.loadSource(qt.src),zr.attachMedia(qt)}}})};Object(M.useEffect)(function(){if(en.current&&qn&&(qn.match(fi)&&window.PR.prettyPrint()),en.current)return en.current.addEventListener("click",mi),function(){en.current.removeEventListener("click",mi),v(),E()}},[qn,en.current,mi]);var Ni=function(vr){if(!Q)return;vr.target.nodeName==="IMG"?(ln.current.style.zIndex=1,ln.current.style.display="flex",ln.current.style.width=vr.target.clientWidth+"px",ln.current.style.height=vr.target.clientHeight+"px",ln.current.style.top=vr.target.offsetTop+"px",ln.current.style.left=vr.target.offsetLeft+"px",Jn.current.src=vr.target.getAttribute("src")):ln.current.style.display="none"};return b.a.createElement("div",{style:{position:"relative"}},b.a.createElement("div",{ref:en,style:Object(w.a)({},gr),className:"".concat(B||""," markdown-body ").concat(si.a.mdBody),onMouseOver:Ni,dangerouslySetInnerHTML:{__html:qn}}),b.a.createElement("div",{ref:ln,className:si.a.button},b.a.createElement(X.a,null,b.a.createElement(K.a,{onClick:function(){return Gi()}},"\u88C1\u526A"),b.a.createElement(K.a,{onClick:function(){return Vi()}},"\u7F16\u8F91"))),b.a.createElement("img",{ref:Jn,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),b.a.createElement(Oe.a,{close:!0,data:Fn,type:Fn!=null&&Fn.length?Ii:"",style:Object(w.a)({},Ln),onClose:function(){return pi("")}}))}},"9VGf":function(Ft,yt,ne){"use strict";ne.d(yt,"a",function(){return D});var ae=ne("q1tI"),X=ne.n(ae);function D(K,w){var P=Object(ae.useRef)();Object(ae.useEffect)(function(){P.current=K}),Object(ae.useEffect)(function(){function H(){P.current()}if(w!==null){var W=setInterval(H,w);return function(){return clearInterval(W)}}},[w])}},"9ZNV":function(Ft,yt,ne){"use strict";ne.d(yt,"a",function(){return M});var ae=ne("0Owb"),X=ne("+L6B"),D=ne("2/Rp"),K=ne("q1tI"),w=ne.n(K),P=ne("UUDw"),H=ne.n(P),W=ne("TSYQ"),I=ne.n(W),M=function(A){var _=A.cancelText,O=_===void 0?"\u53D6\u6D88":_,L=A.okText,y=L===void 0?"\u786E\u5B9A":L,u=A.loading,a=u===void 0?!1:u,s=A.hasOkBtn,d=s===void 0?!0:s,E=A.okButtonProps,g=E===void 0?{}:E,m=A.onCancel,k=m===void 0?function(){}:m,x=A.onOk,h=x===void 0?function(){}:x,p=A.className,c=p===void 0?"":p;return w.a.createElement("div",{className:I()(H.a.buttonFixed,c)},w.a.createElement("div",{className:H.a.buttonWrap},w.a.createElement(D.a,{size:"large",className:"".concat(H.a.button," mr20"),onClick:k},O),d&&w.a.createElement(D.a,Object(ae.a)({size:"large",type:"primary",className:"".concat(H.a.button," mr20"),loading:a,onClick:h},g),y)))}},Bd2K:function(Ft,yt,ne){(function(ae){ae(ne("VrN/"),ne("osHv"))})(function(ae){ae.defineOption("autoCloseTags",!1,function(I,M,b){if(b!=ae.Init&&b&&I.removeKeyMap("autoCloseTags"),!M)return;var A={name:"autoCloseTags"};(typeof M!="object"||M.whenClosing!==!1)&&(A["'/'"]=function(_){return P(_)}),(typeof M!="object"||M.whenOpening!==!1)&&(A["'>'"]=function(_){return K(_)}),I.addKeyMap(A)});var X=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],D=["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 K(I){if(I.getOption("disableInput"))return ae.Pass;for(var M=I.listSelections(),b=[],A=I.getOption("autoCloseTags"),_=0;_<M.length;_++){if(!M[_].empty())return ae.Pass;var O=M[_].head,L=I.getTokenAt(O),y=ae.innerMode(I.getMode(),L.state),u=y.state,a=y.mode.xmlCurrentTag&&y.mode.xmlCurrentTag(u),s=a&&a.name;if(!s)return ae.Pass;var d=y.mode.configuration=="html",E=typeof A=="object"&&A.dontCloseTags||d&&X,g=typeof A=="object"&&A.indentTags||d&&D;L.end>O.ch&&(s=s.slice(0,s.length-L.end+O.ch));var m=s.toLowerCase();if(!s||L.type=="string"&&(L.end!=O.ch||!/[\"\']/.test(L.string.charAt(L.string.length-1))||L.string.length==1)||L.type=="tag"&&a.close||L.string.indexOf("/")==O.ch-L.start-1||E&&H(E,m)>-1||W(I,y.mode.xmlCurrentContext&&y.mode.xmlCurrentContext(u)||[],s,O,!0))return ae.Pass;var k=typeof A=="object"&&A.emptyTags;if(k&&H(k,s)>-1){b[_]={text:"/>",newPos:ae.Pos(O.line,O.ch+2)};continue}var x=g&&H(g,m)>-1;b[_]={indent:x,text:">"+(x?`
`:"")+"</"+s+">",newPos:x?ae.Pos(O.line+1,0):ae.Pos(O.line,O.ch+1)}}for(var h=typeof A=="object"&&A.dontIndentOnAutoClose,_=M.length-1;_>=0;_--){var p=b[_];I.replaceRange(p.text,M[_].head,M[_].anchor,"+insert");var c=I.listSelections().slice(0);c[_]={head:p.newPos,anchor:p.newPos},I.setSelections(c),!h&&p.indent&&(I.indentLine(p.newPos.line,null,!0),I.indentLine(p.newPos.line+1,null,!0))}}function w(I,M){for(var b=I.listSelections(),A=[],_=M?"/":"</",O=I.getOption("autoCloseTags"),L=typeof O=="object"&&O.dontIndentOnSlash,y=0;y<b.length;y++){if(!b[y].empty())return ae.Pass;var u=b[y].head,a=I.getTokenAt(u),s=ae.innerMode(I.getMode(),a.state),d=s.state;if(M&&(a.type=="string"||a.string.charAt(0)!="<"||a.start!=u.ch-1))return ae.Pass;var E,g=s.mode.name!="xml"&&I.getMode().name=="htmlmixed";if(g&&s.mode.name=="javascript")E=_+"script";else if(g&&s.mode.name=="css")E=_+"style";else{var m=s.mode.xmlCurrentContext&&s.mode.xmlCurrentContext(d);if(!m||m.length&&W(I,m,m[m.length-1],u))return ae.Pass;E=_+m[m.length-1]}I.getLine(u.line).charAt(a.end)!=">"&&(E+=">"),A[y]=E}if(I.replaceSelections(A),b=I.listSelections(),!L)for(var y=0;y<b.length;y++)(y==b.length-1||b[y].head.line<b[y+1].head.line)&&I.indentLine(b[y].head.line)}function P(I){return I.getOption("disableInput")?ae.Pass:w(I,!0)}ae.commands.closeTag=function(I){return w(I)};function H(I,M){if(I.indexOf)return I.indexOf(M);for(var b=0,A=I.length;b<A;++b)if(I[b]==M)return b;return-1}function W(I,M,b,A,_){if(!ae.scanForClosingTag)return!1;var O=Math.min(I.lastLine()+1,A.line+500),L=ae.scanForClosingTag(I,A,null,O);if(!L||L.tag!=b)return!1;for(var y=_?1:0,u=M.length-1;u>=0&&M[u]==b;u--)++y;A=L.to;for(var u=1;u<y;u++){var a=ae.scanForClosingTag(I,A,null,O);if(!a||a.tag!=b)return!1;A=a.to}return!0}})},BjJ7:function(Ft,yt,ne){"use strict";ne.d(yt,"d",function(){return X}),ne.d(yt,"c",function(){return D}),ne.d(yt,"e",function(){return K}),ne.d(yt,"b",function(){return w}),ne.d(yt,"a",function(){return H});var ae=ne("m3rI");function X(W){var I=!0;if(W.length>0){for(var M=0;M<W.length;M++)if(W[M].compile_success==0||!W[M].compile_success){I=!1;break}}else I=!1;return I}function D(W){for(var I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",M=[],b=0;b<W.length;b++){var A=W[b],_=I?"".concat(I,"/").concat(A.name):"".concat(A.name);M.push({title:A.name,isLeaf:!(A.type==="tree"),key:_})}return M}function K(W,I,M){for(var b=0;b<W.length;b++){var A=W[b];if(A.key===I){A.children=M;break}A.children&&K(A.children,I,M)}return W}function w(W,I,M){var b;return function(){var A=this,_=arguments,O=function(){b=null,M||W.apply(A,_)},L=M&&!b;clearTimeout(b),b=setTimeout(O,I),L&&W.apply(A,_)}}var P=!0,H=ae.a.API_SERVER},"C+DQ":function(Ft,yt,ne){},DlQD:function(Ft,yt,ne){(function(ae,X){Ft.exports=X()})(this,function(){"use strict";function ae(we,ye){for(var Ee=0;Ee<ye.length;Ee++){var re=ye[Ee];re.enumerable=re.enumerable||!1,re.configurable=!0,"value"in re&&(re.writable=!0),Object.defineProperty(we,re.key,re)}}function X(we,ye,Ee){return ye&&ae(we.prototype,ye),Ee&&ae(we,Ee),we}function D(we,ye){if(!we)return;if(typeof we=="string")return K(we,ye);var Ee=Object.prototype.toString.call(we).slice(8,-1);if(Ee==="Object"&&we.constructor&&(Ee=we.constructor.name),Ee==="Map"||Ee==="Set")return Array.from(we);if(Ee==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(Ee))return K(we,ye)}function K(we,ye){(ye==null||ye>we.length)&&(ye=we.length);for(var Ee=0,re=new Array(ye);Ee<ye;Ee++)re[Ee]=we[Ee];return re}function w(we,ye){var Ee;if(typeof Symbol=="undefined"||we[Symbol.iterator]==null){if(Array.isArray(we)||(Ee=D(we))||ye&&we&&typeof we.length=="number"){Ee&&(we=Ee);var re=0;return function(){return re>=we.length?{done:!0}:{done:!1,value:we[re++]}}}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 Ee=we[Symbol.iterator](),Ee.next.bind(Ee)}function P(we,ye){return ye={exports:{}},we(ye,ye.exports),ye.exports}var H=P(function(we){function ye(){return{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}function Ee(re){we.exports.defaults=re}we.exports={defaults:ye(),getDefaults:ye,changeDefaults:Ee}}),W=H.defaults,I=H.getDefaults,M=H.changeDefaults,b=/[&<>"']/,A=/[&<>"']/g,_=/[<>"']|&(?!#?\w+;)/,O=/[<>"']|&(?!#?\w+;)/g,L={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},y=function(ye){return L[ye]};function u(we,ye){if(ye){if(b.test(we))return we.replace(A,y)}else if(_.test(we))return we.replace(O,y);return we}var a=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function s(we){return we.replace(a,function(ye,Ee){return Ee=Ee.toLowerCase(),Ee==="colon"?":":Ee.charAt(0)==="#"?Ee.charAt(1)==="x"?String.fromCharCode(parseInt(Ee.substring(2),16)):String.fromCharCode(+Ee.substring(1)):""})}var d=/(^|[^\[])\^/g;function E(we,ye){we=we.source||we,ye=ye||"";var Ee={replace:function(ie,ue){return ue=ue.source||ue,ue=ue.replace(d,"$1"),we=we.replace(ie,ue),Ee},getRegex:function(){return new RegExp(we,ye)}};return Ee}var g=/[^\w:]/g,m=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function k(we,ye,Ee){if(we){var re;try{re=decodeURIComponent(s(Ee)).replace(g,"").toLowerCase()}catch(ie){return null}if(re.indexOf("javascript:")===0||re.indexOf("vbscript:")===0||re.indexOf("data:")===0)return null}ye&&!m.test(Ee)&&(Ee=o(ye,Ee));try{Ee=encodeURI(Ee).replace(/%25/g,"%")}catch(ie){return null}return Ee}var x={},h=/^[^:]+:\/*[^/]*$/,p=/^([^:]+:)[\s\S]*$/,c=/^([^:]+:\/*[^/]*)[\s\S]*$/;function o(we,ye){x[" "+we]||(h.test(we)?x[" "+we]=we+"/":x[" "+we]=N(we,"/",!0)),we=x[" "+we];var Ee=we.indexOf(":")===-1;return ye.substring(0,2)==="//"?Ee?ye:we.replace(p,"$1")+ye:ye.charAt(0)==="/"?Ee?ye:we.replace(c,"$1")+ye:we+ye}var S={exec:function(){}};function v(we){for(var ye=1,Ee,re;ye<arguments.length;ye++){Ee=arguments[ye];for(re in Ee)Object.prototype.hasOwnProperty.call(Ee,re)&&(we[re]=Ee[re])}return we}function T(we,ye){var Ee=we.replace(/\|/g,function(ue,ge,Se){for(var Re=!1,Xe=ge;--Xe>=0&&Se[Xe]==="\\";)Re=!Re;return Re?"|":" |"}),re=Ee.split(/ \|/),ie=0;if(re.length>ye)re.splice(ye);else for(;re.length<ye;)re.push("");for(;ie<re.length;ie++)re[ie]=re[ie].trim().replace(/\\\|/g,"|");return re}function N(we,ye,Ee){var re=we.length;if(re===0)return"";for(var ie=0;ie<re;){var ue=we.charAt(re-ie-1);if(ue===ye&&!Ee)ie++;else if(ue!==ye&&Ee)ie++;else break}return we.substr(0,re-ie)}function z(we,ye){if(we.indexOf(ye[1])===-1)return-1;for(var Ee=we.length,re=0,ie=0;ie<Ee;ie++)if(we[ie]==="\\")ie++;else if(we[ie]===ye[0])re++;else if(we[ie]===ye[1]&&(re--,re<0))return ie;return-1}function Y(we){we&&we.sanitize&&!we.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}var ee={escape:u,unescape:s,edit:E,cleanUrl:k,resolveUrl:o,noopTest:S,merge:v,splitCells:T,rtrim:N,findClosingBracket:z,checkSanitizeDeprecation:Y},G=H.defaults,j=ee.rtrim,te=ee.splitCells,de=ee.escape,be=ee.findClosingBracket;function Oe(we,ye,Ee){var re=ye.href,ie=ye.title?de(ye.title):null,ue=we[1].replace(/\\([\[\]])/g,"$1");return we[0].charAt(0)!=="!"?{type:"link",raw:Ee,href:re,title:ie,text:ue}:{type:"image",raw:Ee,href:re,title:ie,text:de(ue)}}function Ge(we,ye){var Ee=we.match(/^(\s+)(?:```)/);if(Ee===null)return ye;var re=Ee[1];return ye.split(`
`).map(function(ie){var ue=ie.match(/^\s+/);if(ue===null)return ie;var ge=ue[0];return ge.length>=re.length?ie.slice(re.length):ie}).join(`
`)}var Me=function(){function we(Ee){this.options=Ee||G}var ye=we.prototype;return ye.space=function(re){var ie=this.rules.block.newline.exec(re);if(ie)return ie[0].length>1?{type:"space",raw:ie[0]}:{raw:`
`}},ye.code=function(re,ie){var ue=this.rules.block.code.exec(re);if(ue){var ge=ie[ie.length-1];if(ge&&ge.type==="paragraph")return{raw:ue[0],text:ue[0].trimRight()};var Se=ue[0].replace(/^ {4}/gm,"");return{type:"code",raw:ue[0],codeBlockStyle:"indented",text:this.options.pedantic?Se:j(Se,`
`)}}},ye.fences=function(re){var ie=this.rules.block.fences.exec(re);if(ie){var ue=ie[0],ge=Ge(ue,ie[3]||"");return{type:"code",raw:ue,lang:ie[2]?ie[2].trim():ie[2],text:ge}}},ye.heading=function(re){var ie=this.rules.block.heading.exec(re);if(ie)return{type:"heading",raw:ie[0],depth:ie[1].length,text:ie[2]}},ye.nptable=function(re){var ie=this.rules.block.nptable.exec(re);if(ie){var ue={type:"table",header:te(ie[1].replace(/^ *| *\| *$/g,"")),align:ie[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ie[3]?ie[3].replace(/\n$/,"").split(`
`):[],raw:ie[0]};if(ue.header.length===ue.align.length){var ge=ue.align.length,Se;for(Se=0;Se<ge;Se++)/^ *-+: *$/.test(ue.align[Se])?ue.align[Se]="right":/^ *:-+: *$/.test(ue.align[Se])?ue.align[Se]="center":/^ *:-+ *$/.test(ue.align[Se])?ue.align[Se]="left":ue.align[Se]=null;for(ge=ue.cells.length,Se=0;Se<ge;Se++)ue.cells[Se]=te(ue.cells[Se],ue.header.length);return ue}}},ye.hr=function(re){var ie=this.rules.block.hr.exec(re);if(ie)return{type:"hr",raw:ie[0]}},ye.blockquote=function(re){var ie=this.rules.block.blockquote.exec(re);if(ie){var ue=ie[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:ie[0],text:ue}}},ye.list=function(re){var ie=this.rules.block.list.exec(re);if(ie){for(var ue=ie[0],ge=ie[2],Se=ge.length>1,Re=ge[ge.length-1]===")",Xe={type:"list",raw:ue,ordered:Se,start:Se?+ge.slice(0,-1):"",loose:!1,items:[]},xt=ie[0].match(this.rules.block.item),Mt=!1,kt,Gt,Kt,Ct,pr,rr,Ir,Pr=xt.length,Vt=0;Vt<Pr;Vt++)kt=xt[Vt],ue=kt,Gt=kt.length,kt=kt.replace(/^ *([*+-]|\d+[.)]) */,""),~kt.indexOf(`
`)&&(Gt-=kt.length,kt=this.options.pedantic?kt.replace(/^ {1,4}/gm,""):kt.replace(new RegExp("^ {1,"+Gt+"}","gm"),"")),Vt!==Pr-1&&(Kt=this.rules.block.bullet.exec(xt[Vt+1])[0],(Se?Kt.length===1||!Re&&Kt[Kt.length-1]===")":Kt.length>1||this.options.smartLists&&Kt!==ge)&&(Ct=xt.slice(Vt+1).join(`
`),Xe.raw=Xe.raw.substring(0,Xe.raw.length-Ct.length),Vt=Pr-1)),pr=Mt||/\n\n(?!\s*$)/.test(kt),Vt!==Pr-1&&(Mt=kt.charAt(kt.length-1)===`
`,pr||(pr=Mt)),pr&&(Xe.loose=!0),rr=/^\[[ xX]\] /.test(kt),Ir=void 0,rr&&(Ir=kt[1]!==" ",kt=kt.replace(/^\[[ xX]\] +/,"")),Xe.items.push({type:"list_item",raw:ue,task:rr,checked:Ir,loose:pr,text:kt});return Xe}},ye.html=function(re){var ie=this.rules.block.html.exec(re);if(ie)return{type:this.options.sanitize?"paragraph":"html",raw:ie[0],pre:!this.options.sanitizer&&(ie[1]==="pre"||ie[1]==="script"||ie[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ie[0]):de(ie[0]):ie[0]}},ye.def=function(re){var ie=this.rules.block.def.exec(re);if(ie){ie[3]&&(ie[3]=ie[3].substring(1,ie[3].length-1));var ue=ie[1].toLowerCase().replace(/\s+/g," ");return{tag:ue,raw:ie[0],href:ie[2],title:ie[3]}}},ye.table=function(re){var ie=this.rules.block.table.exec(re);if(ie){var ue={type:"table",header:te(ie[1].replace(/^ *| *\| *$/g,"")),align:ie[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ie[3]?ie[3].replace(/\n$/,"").split(`
`):[]};if(ue.header.length===ue.align.length){ue.raw=ie[0];var ge=ue.align.length,Se;for(Se=0;Se<ge;Se++)/^ *-+: *$/.test(ue.align[Se])?ue.align[Se]="right":/^ *:-+: *$/.test(ue.align[Se])?ue.align[Se]="center":/^ *:-+ *$/.test(ue.align[Se])?ue.align[Se]="left":ue.align[Se]=null;for(ge=ue.cells.length,Se=0;Se<ge;Se++)ue.cells[Se]=te(ue.cells[Se].replace(/^ *\| *| *\| *$/g,""),ue.header.length);return ue}}},ye.lheading=function(re){var ie=this.rules.block.lheading.exec(re);if(ie)return{type:"heading",raw:ie[0],depth:ie[2].charAt(0)==="="?1:2,text:ie[1]}},ye.paragraph=function(re){var ie=this.rules.block.paragraph.exec(re);if(ie)return{type:"paragraph",raw:ie[0],text:ie[1].charAt(ie[1].length-1)===`
`?ie[1].slice(0,-1):ie[1]}},ye.text=function(re,ie){var ue=this.rules.block.text.exec(re);if(ue){var ge=ie[ie.length-1];return ge&&ge.type==="text"?{raw:ue[0],text:ue[0]}:{type:"text",raw:ue[0],text:ue[0]}}},ye.escape=function(re){var ie=this.rules.inline.escape.exec(re);if(ie)return{type:"escape",raw:ie[0],text:de(ie[1])}},ye.tag=function(re,ie,ue){var ge=this.rules.inline.tag.exec(re);if(ge)return!ie&&/^<a /i.test(ge[0])?ie=!0:ie&&/^<\/a>/i.test(ge[0])&&(ie=!1),!ue&&/^<(pre|code|kbd|script)(\s|>)/i.test(ge[0])?ue=!0:ue&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(ge[0])&&(ue=!1),{type:this.options.sanitize?"text":"html",raw:ge[0],inLink:ie,inRawBlock:ue,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ge[0]):de(ge[0]):ge[0]}},ye.link=function(re){var ie=this.rules.inline.link.exec(re);if(ie){var ue=be(ie[2],"()");if(ue>-1){var ge=ie[0].indexOf("!")===0?5:4,Se=ge+ie[1].length+ue;ie[2]=ie[2].substring(0,ue),ie[0]=ie[0].substring(0,Se).trim(),ie[3]=""}var Re=ie[2],Xe="";if(this.options.pedantic){var xt=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Re);xt?(Re=xt[1],Xe=xt[3]):Xe=""}else Xe=ie[3]?ie[3].slice(1,-1):"";Re=Re.trim().replace(/^<([\s\S]*)>$/,"$1");var Mt=Oe(ie,{href:Re&&Re.replace(this.rules.inline._escapes,"$1"),title:Xe&&Xe.replace(this.rules.inline._escapes,"$1")},ie[0]);return Mt}},ye.reflink=function(re,ie){var ue;if((ue=this.rules.inline.reflink.exec(re))||(ue=this.rules.inline.nolink.exec(re))){var ge=(ue[2]||ue[1]).replace(/\s+/g," ");if(ge=ie[ge.toLowerCase()],!ge||!ge.href){var Se=ue[0].charAt(0);return{type:"text",raw:Se,text:Se}}var Re=Oe(ue,ge,ue[0]);return Re}},ye.strong=function(re,ie,ue){ue===void 0&&(ue="");var ge=this.rules.inline.strong.start.exec(re);if(ge&&(!ge[1]||ge[1]&&(ue===""||this.rules.inline.punctuation.exec(ue)))){ie=ie.slice(-1*re.length);var Se=ge[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;Se.lastIndex=0;for(var Re;(ge=Se.exec(ie))!=null;)if(Re=this.rules.inline.strong.middle.exec(ie.slice(0,ge.index+3)),Re)return{type:"strong",raw:re.slice(0,Re[0].length),text:re.slice(2,Re[0].length-2)}}},ye.em=function(re,ie,ue){ue===void 0&&(ue="");var ge=this.rules.inline.em.start.exec(re);if(ge&&(!ge[1]||ge[1]&&(ue===""||this.rules.inline.punctuation.exec(ue)))){ie=ie.slice(-1*re.length);var Se=ge[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;Se.lastIndex=0;for(var Re;(ge=Se.exec(ie))!=null;)if(Re=this.rules.inline.em.middle.exec(ie.slice(0,ge.index+2)),Re)return{type:"em",raw:re.slice(0,Re[0].length),text:re.slice(1,Re[0].length-1)}}},ye.codespan=function(re){var ie=this.rules.inline.code.exec(re);if(ie){var ue=ie[2].replace(/\n/g," "),ge=/[^ ]/.test(ue),Se=ue.startsWith(" ")&&ue.endsWith(" ");return ge&&Se&&(ue=ue.substring(1,ue.length-1)),ue=de(ue,!0),{type:"codespan",raw:ie[0],text:ue}}},ye.br=function(re){var ie=this.rules.inline.br.exec(re);if(ie)return{type:"br",raw:ie[0]}},ye.del=function(re){var ie=this.rules.inline.del.exec(re);if(ie)return{type:"del",raw:ie[0],text:ie[1]}},ye.autolink=function(re,ie){var ue=this.rules.inline.autolink.exec(re);if(ue){var ge,Se;return ue[2]==="@"?(ge=de(this.options.mangle?ie(ue[1]):ue[1]),Se="mailto:"+ge):(ge=de(ue[1]),Se=ge),{type:"link",raw:ue[0],text:ge,href:Se,tokens:[{type:"text",raw:ge,text:ge}]}}},ye.url=function(re,ie){var ue;if(ue=this.rules.inline.url.exec(re)){var ge,Se;if(ue[2]==="@")ge=de(this.options.mangle?ie(ue[0]):ue[0]),Se="mailto:"+ge;else{var Re;do Re=ue[0],ue[0]=this.rules.inline._backpedal.exec(ue[0])[0];while(Re!==ue[0]);ge=de(ue[0]),ue[1]==="www."?Se="http://"+ge:Se=ge}return{type:"link",raw:ue[0],text:ge,href:Se,tokens:[{type:"text",raw:ge,text:ge}]}}},ye.inlineText=function(re,ie,ue){var ge=this.rules.inline.text.exec(re);if(ge){var Se;return ie?Se=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ge[0]):de(ge[0]):ge[0]:Se=de(this.options.smartypants?ue(ge[0]):ge[0]),{type:"text",raw:ge[0],text:Se}}},we}(),Ie=ee.noopTest,Ue=ee.edit,Pe=ee.merge,Te={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:Ie,table:Ie,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};Te._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,Te._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,Te.def=Ue(Te.def).replace("label",Te._label).replace("title",Te._title).getRegex(),Te.bullet=/(?:[*+-]|\d{1,9}[.)])/,Te.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,Te.item=Ue(Te.item,"gm").replace(/bull/g,Te.bullet).getRegex(),Te.list=Ue(Te.list).replace(/bull/g,Te.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+Te.def.source+")").getRegex(),Te._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",Te._comment=/<!--(?!-?>)[\s\S]*?-->/,Te.html=Ue(Te.html,"i").replace("comment",Te._comment).replace("tag",Te._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Te.paragraph=Ue(Te._paragraph).replace("hr",Te.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",Te._tag).getRegex(),Te.blockquote=Ue(Te.blockquote).replace("paragraph",Te.paragraph).getRegex(),Te.normal=Pe({},Te),Te.gfm=Pe({},Te.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*|$)"}),Te.gfm.nptable=Ue(Te.gfm.nptable).replace("hr",Te.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",Te._tag).getRegex(),Te.gfm.table=Ue(Te.gfm.table).replace("hr",Te.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",Te._tag).getRegex(),Te.pedantic=Pe({},Te.normal,{html:Ue(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Te._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:Ie,paragraph:Ue(Te.normal._paragraph).replace("hr",Te.hr).replace("heading",` *#{1,6} *[^
]`).replace("lheading",Te.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var se={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Ie,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:Ie,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};se._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",se.punctuation=Ue(se.punctuation).replace(/punctuation/g,se._punctuation).getRegex(),se._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",se._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",se.em.start=Ue(se.em.start).replace(/punctuation/g,se._punctuation).getRegex(),se.em.middle=Ue(se.em.middle).replace(/punctuation/g,se._punctuation).replace(/overlapSkip/g,se._overlapSkip).getRegex(),se.em.endAst=Ue(se.em.endAst,"g").replace(/punctuation/g,se._punctuation).getRegex(),se.em.endUnd=Ue(se.em.endUnd,"g").replace(/punctuation/g,se._punctuation).getRegex(),se.strong.start=Ue(se.strong.start).replace(/punctuation/g,se._punctuation).getRegex(),se.strong.middle=Ue(se.strong.middle).replace(/punctuation/g,se._punctuation).replace(/blockSkip/g,se._blockSkip).getRegex(),se.strong.endAst=Ue(se.strong.endAst,"g").replace(/punctuation/g,se._punctuation).getRegex(),se.strong.endUnd=Ue(se.strong.endUnd,"g").replace(/punctuation/g,se._punctuation).getRegex(),se.blockSkip=Ue(se._blockSkip,"g").getRegex(),se.overlapSkip=Ue(se._overlapSkip,"g").getRegex(),se._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,se._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,se._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])?)+(?![-_])/,se.autolink=Ue(se.autolink).replace("scheme",se._scheme).replace("email",se._email).getRegex(),se._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,se.tag=Ue(se.tag).replace("comment",Te._comment).replace("attribute",se._attribute).getRegex(),se._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,se._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,se._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,se.link=Ue(se.link).replace("label",se._label).replace("href",se._href).replace("title",se._title).getRegex(),se.reflink=Ue(se.reflink).replace("label",se._label).getRegex(),se.reflinkSearch=Ue(se.reflinkSearch,"g").replace("reflink",se.reflink).replace("nolink",se.nolink).getRegex(),se.normal=Pe({},se),se.pedantic=Pe({},se.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:Ue(/^!?\[(label)\]\((.*?)\)/).replace("label",se._label).getRegex(),reflink:Ue(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",se._label).getRegex()}),se.gfm=Pe({},se.normal,{escape:Ue(se.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.!#$%&'*+\/=?_`{\|}~-]+@))/}),se.gfm.url=Ue(se.gfm.url,"i").replace("email",se.gfm._extended_email).getRegex(),se.breaks=Pe({},se.gfm,{br:Ue(se.br).replace("{2,}","*").getRegex(),text:Ue(se.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var Fe={block:Te,inline:se},dt=H.defaults,it=Fe.block,ot=Fe.inline;function ct(we){return we.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 je(we){var ye="",Ee,re,ie=we.length;for(Ee=0;Ee<ie;Ee++)re=we.charCodeAt(Ee),Math.random()>.5&&(re="x"+re.toString(16)),ye+="&#"+re+";";return ye}var Ye=function(){function we(Ee){this.tokens=[],this.tokens.links=Object.create(null),this.options=Ee||dt,this.options.tokenizer=this.options.tokenizer||new Me,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var re={block:it.normal,inline:ot.normal};this.options.pedantic?(re.block=it.pedantic,re.inline=ot.pedantic):this.options.gfm&&(re.block=it.gfm,this.options.breaks?re.inline=ot.breaks:re.inline=ot.gfm),this.tokenizer.rules=re}we.lex=function(re,ie){var ue=new we(ie);return ue.lex(re)};var ye=we.prototype;return ye.lex=function(re){return re=re.replace(/\r\n|\r/g,`
`).replace(/\t/g," "),this.blockTokens(re,this.tokens,!0),this.inline(this.tokens),this.tokens},ye.blockTokens=function(re,ie,ue){ie===void 0&&(ie=[]),ue===void 0&&(ue=!0),re=re.replace(/^ +$/gm,"");for(var ge,Se,Re,Xe;re;){if(ge=this.tokenizer.space(re)){re=re.substring(ge.raw.length),ge.type&&ie.push(ge);continue}if(ge=this.tokenizer.code(re,ie)){re=re.substring(ge.raw.length),ge.type?ie.push(ge):(Xe=ie[ie.length-1],Xe.raw+=`
`+ge.raw,Xe.text+=`
`+ge.text);continue}if(ge=this.tokenizer.fences(re)){re=re.substring(ge.raw.length),ie.push(ge);continue}if(ge=this.tokenizer.heading(re)){re=re.substring(ge.raw.length),ie.push(ge);continue}if(ge=this.tokenizer.nptable(re)){re=re.substring(ge.raw.length),ie.push(ge);continue}if(ge=this.tokenizer.hr(re)){re=re.substring(ge.raw.length),ie.push(ge);continue}if(ge=this.tokenizer.blockquote(re)){re=re.substring(ge.raw.length),ge.tokens=this.blockTokens(ge.text,[],ue),ie.push(ge);continue}if(ge=this.tokenizer.list(re)){for(re=re.substring(ge.raw.length),Re=ge.items.length,Se=0;Se<Re;Se++)ge.items[Se].tokens=this.blockTokens(ge.items[Se].text,[],!1);ie.push(ge);continue}if(ge=this.tokenizer.html(re)){re=re.substring(ge.raw.length),ie.push(ge);continue}if(ue&&(ge=this.tokenizer.def(re))){re=re.substring(ge.raw.length),this.tokens.links[ge.tag]||(this.tokens.links[ge.tag]={href:ge.href,title:ge.title});continue}if(ge=this.tokenizer.table(re)){re=re.substring(ge.raw.length),ie.push(ge);continue}if(ge=this.tokenizer.lheading(re)){re=re.substring(ge.raw.length),ie.push(ge);continue}if(ue&&(ge=this.tokenizer.paragraph(re))){re=re.substring(ge.raw.length),ie.push(ge);continue}if(ge=this.tokenizer.text(re,ie)){re=re.substring(ge.raw.length),ge.type?ie.push(ge):(Xe=ie[ie.length-1],Xe.raw+=`
`+ge.raw,Xe.text+=`
`+ge.text);continue}if(re){var xt="Infinite loop on byte: "+re.charCodeAt(0);if(this.options.silent){console.error(xt);break}else throw new Error(xt)}}return ie},ye.inline=function(re){var ie,ue,ge,Se,Re,Xe,xt=re.length;for(ie=0;ie<xt;ie++){Xe=re[ie];switch(Xe.type){case"paragraph":case"text":case"heading":{Xe.tokens=[],this.inlineTokens(Xe.text,Xe.tokens);break}case"table":{for(Xe.tokens={header:[],cells:[]},Se=Xe.header.length,ue=0;ue<Se;ue++)Xe.tokens.header[ue]=[],this.inlineTokens(Xe.header[ue],Xe.tokens.header[ue]);for(Se=Xe.cells.length,ue=0;ue<Se;ue++)for(Re=Xe.cells[ue],Xe.tokens.cells[ue]=[],ge=0;ge<Re.length;ge++)Xe.tokens.cells[ue][ge]=[],this.inlineTokens(Re[ge],Xe.tokens.cells[ue][ge]);break}case"blockquote":{this.inline(Xe.tokens);break}case"list":{for(Se=Xe.items.length,ue=0;ue<Se;ue++)this.inline(Xe.items[ue].tokens);break}}}return re},ye.inlineTokens=function(re,ie,ue,ge,Se){ie===void 0&&(ie=[]),ue===void 0&&(ue=!1),ge===void 0&&(ge=!1),Se===void 0&&(Se="");var Re,Xe=re,xt;if(this.tokens.links){var Mt=Object.keys(this.tokens.links);if(Mt.length>0)for(;(xt=this.tokenizer.rules.inline.reflinkSearch.exec(Xe))!=null;)Mt.includes(xt[0].slice(xt[0].lastIndexOf("[")+1,-1))&&(Xe=Xe.slice(0,xt.index)+"["+"a".repeat(xt[0].length-2)+"]"+Xe.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(xt=this.tokenizer.rules.inline.blockSkip.exec(Xe))!=null;)Xe=Xe.slice(0,xt.index)+"["+"a".repeat(xt[0].length-2)+"]"+Xe.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;re;){if(Re=this.tokenizer.escape(re)){re=re.substring(Re.raw.length),ie.push(Re);continue}if(Re=this.tokenizer.tag(re,ue,ge)){re=re.substring(Re.raw.length),ue=Re.inLink,ge=Re.inRawBlock,ie.push(Re);continue}if(Re=this.tokenizer.link(re)){re=re.substring(Re.raw.length),Re.type==="link"&&(Re.tokens=this.inlineTokens(Re.text,[],!0,ge)),ie.push(Re);continue}if(Re=this.tokenizer.reflink(re,this.tokens.links)){re=re.substring(Re.raw.length),Re.type==="link"&&(Re.tokens=this.inlineTokens(Re.text,[],!0,ge)),ie.push(Re);continue}if(Re=this.tokenizer.strong(re,Xe,Se)){re=re.substring(Re.raw.length),Re.tokens=this.inlineTokens(Re.text,[],ue,ge),ie.push(Re);continue}if(Re=this.tokenizer.em(re,Xe,Se)){re=re.substring(Re.raw.length),Re.tokens=this.inlineTokens(Re.text,[],ue,ge),ie.push(Re);continue}if(Re=this.tokenizer.codespan(re)){re=re.substring(Re.raw.length),ie.push(Re);continue}if(Re=this.tokenizer.br(re)){re=re.substring(Re.raw.length),ie.push(Re);continue}if(Re=this.tokenizer.del(re)){re=re.substring(Re.raw.length),Re.tokens=this.inlineTokens(Re.text,[],ue,ge),ie.push(Re);continue}if(Re=this.tokenizer.autolink(re,je)){re=re.substring(Re.raw.length),ie.push(Re);continue}if(!ue&&(Re=this.tokenizer.url(re,je))){re=re.substring(Re.raw.length),ie.push(Re);continue}if(Re=this.tokenizer.inlineText(re,ge,ct)){re=re.substring(Re.raw.length),Se=Re.raw.slice(-1),ie.push(Re);continue}if(re){var kt="Infinite loop on byte: "+re.charCodeAt(0);if(this.options.silent){console.error(kt);break}else throw new Error(kt)}}return ie},X(we,null,[{key:"rules",get:function(){return{block:it,inline:ot}}}]),we}(),rt=H.defaults,st=ee.cleanUrl,qe=ee.escape,Ve=function(){function we(Ee){this.options=Ee||rt}var ye=we.prototype;return ye.code=function(re,ie,ue){var ge=(ie||"").match(/\S*/)[0];if(this.options.highlight){var Se=this.options.highlight(re,ge);Se!=null&&Se!==re&&(ue=!0,re=Se)}return ge?'<pre><code class="'+this.options.langPrefix+qe(ge,!0)+'">'+(ue?re:qe(re,!0))+`</code></pre>
`:"<pre><code>"+(ue?re:qe(re,!0))+`</code></pre>
`},ye.blockquote=function(re){return`<blockquote>
`+re+`</blockquote>
`},ye.html=function(re){return re},ye.heading=function(re,ie,ue,ge){return this.options.headerIds?"<h"+ie+' id="'+this.options.headerPrefix+ge.slug(ue)+'">'+re+"</h"+ie+`>
`:"<h"+ie+">"+re+"</h"+ie+`>
`},ye.hr=function(){return this.options.xhtml?`<hr/>
`:`<hr>
`},ye.list=function(re,ie,ue){var ge=ie?"ol":"ul",Se=ie&&ue!==1?' start="'+ue+'"':"";return"<"+ge+Se+`>
`+re+"</"+ge+`>
`},ye.listitem=function(re){return"<li>"+re+`</li>
`},ye.checkbox=function(re){return"<input "+(re?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},ye.paragraph=function(re){return"<p>"+re+`</p>
`},ye.table=function(re,ie){return ie&&(ie="<tbody>"+ie+"</tbody>"),`<table>
<thead>
`+re+`</thead>
`+ie+`</table>
`},ye.tablerow=function(re){return`<tr>
`+re+`</tr>
`},ye.tablecell=function(re,ie){var ue=ie.header?"th":"td",ge=ie.align?"<"+ue+' align="'+ie.align+'">':"<"+ue+">";return ge+re+"</"+ue+`>
`},ye.strong=function(re){return"<strong>"+re+"</strong>"},ye.em=function(re){return"<em>"+re+"</em>"},ye.codespan=function(re){return"<code>"+re+"</code>"},ye.br=function(){return this.options.xhtml?"<br/>":"<br>"},ye.del=function(re){return"<del>"+re+"</del>"},ye.link=function(re,ie,ue){if(re=st(this.options.sanitize,this.options.baseUrl,re),re===null)return ue;var ge='<a href="'+qe(re)+'"';return ie&&(ge+=' title="'+ie+'"'),ge+=">"+ue+"</a>",ge},ye.image=function(re,ie,ue){if(re=st(this.options.sanitize,this.options.baseUrl,re),re===null)return ue;var ge='<img src="'+re+'" alt="'+ue+'"';return ie&&(ge+=' title="'+ie+'"'),ge+=this.options.xhtml?"/>":">",ge},ye.text=function(re){return re},we}(),Ke=function(){function we(){}var ye=we.prototype;return ye.strong=function(re){return re},ye.em=function(re){return re},ye.codespan=function(re){return re},ye.del=function(re){return re},ye.html=function(re){return re},ye.text=function(re){return re},ye.link=function(re,ie,ue){return""+ue},ye.image=function(re,ie,ue){return""+ue},ye.br=function(){return""},we}(),ht=function(){function we(){this.seen={}}var ye=we.prototype;return ye.slug=function(re){var ie=re.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(ie)){var ue=ie;do this.seen[ue]++,ie=ue+"-"+this.seen[ue];while(this.seen.hasOwnProperty(ie))}return this.seen[ie]=0,ie},we}(),ut=H.defaults,ft=ee.unescape,nt=function(){function we(Ee){this.options=Ee||ut,this.options.renderer=this.options.renderer||new Ve,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Ke,this.slugger=new ht}we.parse=function(re,ie){var ue=new we(ie);return ue.parse(re)};var ye=we.prototype;return ye.parse=function(re,ie){ie===void 0&&(ie=!0);var ue="",ge,Se,Re,Xe,xt,Mt,kt,Gt,Kt,Ct,pr,rr,Ir,Pr,Vt,an,En,It,An=re.length;for(ge=0;ge<An;ge++){Ct=re[ge];switch(Ct.type){case"space":continue;case"hr":{ue+=this.renderer.hr();continue}case"heading":{ue+=this.renderer.heading(this.parseInline(Ct.tokens),Ct.depth,ft(this.parseInline(Ct.tokens,this.textRenderer)),this.slugger);continue}case"code":{ue+=this.renderer.code(Ct.text,Ct.lang,Ct.escaped);continue}case"table":{for(Gt="",kt="",Xe=Ct.header.length,Se=0;Se<Xe;Se++)kt+=this.renderer.tablecell(this.parseInline(Ct.tokens.header[Se]),{header:!0,align:Ct.align[Se]});for(Gt+=this.renderer.tablerow(kt),Kt="",Xe=Ct.cells.length,Se=0;Se<Xe;Se++){for(Mt=Ct.tokens.cells[Se],kt="",xt=Mt.length,Re=0;Re<xt;Re++)kt+=this.renderer.tablecell(this.parseInline(Mt[Re]),{header:!1,align:Ct.align[Re]});Kt+=this.renderer.tablerow(kt)}ue+=this.renderer.table(Gt,Kt);continue}case"blockquote":{Kt=this.parse(Ct.tokens),ue+=this.renderer.blockquote(Kt);continue}case"list":{for(pr=Ct.ordered,rr=Ct.start,Ir=Ct.loose,Xe=Ct.items.length,Kt="",Se=0;Se<Xe;Se++)Vt=Ct.items[Se],an=Vt.checked,En=Vt.task,Pr="",Vt.task&&(It=this.renderer.checkbox(an),Ir?Vt.tokens.length>0&&Vt.tokens[0].type==="text"?(Vt.tokens[0].text=It+" "+Vt.tokens[0].text,Vt.tokens[0].tokens&&Vt.tokens[0].tokens.length>0&&Vt.tokens[0].tokens[0].type==="text"&&(Vt.tokens[0].tokens[0].text=It+" "+Vt.tokens[0].tokens[0].text)):Vt.tokens.unshift({type:"text",text:It}):Pr+=It),Pr+=this.parse(Vt.tokens,Ir),Kt+=this.renderer.listitem(Pr,En,an);ue+=this.renderer.list(Kt,pr,rr);continue}case"html":{ue+=this.renderer.html(Ct.text);continue}case"paragraph":{ue+=this.renderer.paragraph(this.parseInline(Ct.tokens));continue}case"text":{for(Kt=Ct.tokens?this.parseInline(Ct.tokens):Ct.text;ge+1<An&&re[ge+1].type==="text";)Ct=re[++ge],Kt+=`
`+(Ct.tokens?this.parseInline(Ct.tokens):Ct.text);ue+=ie?this.renderer.paragraph(Kt):Kt;continue}default:{var on='Token with "'+Ct.type+'" type was not found.';if(this.options.silent){console.error(on);return}else throw new Error(on)}}}return ue},ye.parseInline=function(re,ie){ie=ie||this.renderer;var ue="",ge,Se,Re=re.length;for(ge=0;ge<Re;ge++){Se=re[ge];switch(Se.type){case"escape":{ue+=ie.text(Se.text);break}case"html":{ue+=ie.html(Se.text);break}case"link":{ue+=ie.link(Se.href,Se.title,this.parseInline(Se.tokens,ie));break}case"image":{ue+=ie.image(Se.href,Se.title,Se.text);break}case"strong":{ue+=ie.strong(this.parseInline(Se.tokens,ie));break}case"em":{ue+=ie.em(this.parseInline(Se.tokens,ie));break}case"codespan":{ue+=ie.codespan(Se.text);break}case"br":{ue+=ie.br();break}case"del":{ue+=ie.del(this.parseInline(Se.tokens,ie));break}case"text":{ue+=ie.text(Se.text);break}default:{var Xe='Token with "'+Se.type+'" type was not found.';if(this.options.silent){console.error(Xe);return}else throw new Error(Xe)}}}return ue},we}(),Lt=ee.merge,vt=ee.checkSanitizeDeprecation,bt=ee.escape,Ne=H.getDefaults,Ot=H.changeDefaults,Et=H.defaults;function We(we,ye,Ee){if(typeof we=="undefined"||we===null)throw new Error("marked(): input parameter is undefined or null");if(typeof we!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(we)+", string expected");if(typeof ye=="function"&&(Ee=ye,ye=null),ye=Lt({},We.defaults,ye||{}),vt(ye),Ee){var re=ye.highlight,ie;try{ie=Ye.lex(we,ye)}catch(Re){return Ee(Re)}var ue=function(Xe){var xt;if(!Xe)try{xt=nt.parse(ie,ye)}catch(Mt){Xe=Mt}return ye.highlight=re,Xe?Ee(Xe):Ee(null,xt)};if(!re||re.length<3)return ue();if(delete ye.highlight,!ie.length)return ue();var ge=0;We.walkTokens(ie,function(Re){Re.type==="code"&&(ge++,setTimeout(function(){re(Re.text,Re.lang,function(Xe,xt){if(Xe)return ue(Xe);xt!=null&&xt!==Re.text&&(Re.text=xt,Re.escaped=!0),ge--,ge===0&&ue()})},0))}),ge===0&&ue();return}try{var Se=Ye.lex(we,ye);return ye.walkTokens&&We.walkTokens(Se,ye.walkTokens),nt.parse(Se,ye)}catch(Re){if(Re.message+=`
Please report this to https://github.com/markedjs/marked.`,ye.silent)return"<p>An error occurred:</p><pre>"+bt(Re.message+"",!0)+"</pre>";throw Re}}We.options=We.setOptions=function(we){return Lt(We.defaults,we),Ot(We.defaults),We},We.getDefaults=Ne,We.defaults=Et,We.use=function(we){var ye=Lt({},we);if(we.renderer&&function(){var re=We.defaults.renderer||new Ve,ie=function(Se){var Re=re[Se];re[Se]=function(){for(var Xe=arguments.length,xt=new Array(Xe),Mt=0;Mt<Xe;Mt++)xt[Mt]=arguments[Mt];var kt=we.renderer[Se].apply(re,xt);return kt===!1&&(kt=Re.apply(re,xt)),kt}};for(var ue in we.renderer)ie(ue);ye.renderer=re}(),we.tokenizer&&function(){var re=We.defaults.tokenizer||new Me,ie=function(Se){var Re=re[Se];re[Se]=function(){for(var Xe=arguments.length,xt=new Array(Xe),Mt=0;Mt<Xe;Mt++)xt[Mt]=arguments[Mt];var kt=we.tokenizer[Se].apply(re,xt);return kt===!1&&(kt=Re.apply(re,xt)),kt}};for(var ue in we.tokenizer)ie(ue);ye.tokenizer=re}(),we.walkTokens){var Ee=We.defaults.walkTokens;ye.walkTokens=function(re){we.walkTokens(re),Ee&&Ee(re)}}We.setOptions(ye)},We.walkTokens=function(we,ye){for(var Ee=w(we),re;!(re=Ee()).done;){var ie=re.value;ye(ie);switch(ie.type){case"table":{for(var ue=w(ie.tokens.header),ge;!(ge=ue()).done;){var Se=ge.value;We.walkTokens(Se,ye)}for(var Re=w(ie.tokens.cells),Xe;!(Xe=Re()).done;)for(var xt=Xe.value,Mt=w(xt),kt;!(kt=Mt()).done;){var Gt=kt.value;We.walkTokens(Gt,ye)}break}case"list":{We.walkTokens(ie.items,ye);break}default:ie.tokens&&We.walkTokens(ie.tokens,ye)}}},We.Parser=nt,We.parser=nt.parse,We.Renderer=Ve,We.TextRenderer=Ke,We.Lexer=Ye,We.lexer=Ye.lex,We.Tokenizer=Me,We.Slugger=ht,We.parse=We;var Ze=We;return Ze})},ELLl:function(Ft,yt,ne){(function(ae){ae(ne("VrN/"))})(function(ae){var X={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},D=ae.Pos;ae.defineOption("autoCloseBrackets",!1,function(L,y,u){u&&u!=ae.Init&&(L.removeKeyMap(w),L.state.closeBrackets=null),y&&(P(K(y,"pairs")),L.state.closeBrackets=y,L.addKeyMap(w))});function K(L,y){return y=="pairs"&&typeof L=="string"?L:typeof L=="object"&&L[y]!=null?L[y]:X[y]}var w={Backspace:I,Enter:M};function P(L){for(var y=0;y<L.length;y++){var u=L.charAt(y),a="'"+u+"'";w[a]||(w[a]=H(u))}}P(X.pairs+"`");function H(L){return function(y){return A(y,L)}}function W(L){var y=L.state.closeBrackets;if(!y||y.override)return y;var u=L.getModeAt(L.getCursor());return u.closeBrackets||y}function I(L){var y=W(L);if(!y||L.getOption("disableInput"))return ae.Pass;for(var u=K(y,"pairs"),a=L.listSelections(),s=0;s<a.length;s++){if(!a[s].empty())return ae.Pass;var d=_(L,a[s].head);if(!d||u.indexOf(d)%2!=0)return ae.Pass}for(var s=a.length-1;s>=0;s--){var E=a[s].head;L.replaceRange("",D(E.line,E.ch-1),D(E.line,E.ch+1),"+delete")}}function M(L){var y=W(L),u=y&&K(y,"explode");if(!u||L.getOption("disableInput"))return ae.Pass;for(var a=L.listSelections(),s=0;s<a.length;s++){if(!a[s].empty())return ae.Pass;var d=_(L,a[s].head);if(!d||u.indexOf(d)%2!=0)return ae.Pass}L.operation(function(){var E=L.lineSeparator()||`
`;L.replaceSelection(E+E,null),L.execCommand("goCharLeft"),a=L.listSelections();for(var g=0;g<a.length;g++){var m=a[g].head.line;L.indentLine(m,null,!0),L.indentLine(m+1,null,!0)}})}function b(L){var y=ae.cmpPos(L.anchor,L.head)>0;return{anchor:new D(L.anchor.line,L.anchor.ch+(y?-1:1)),head:new D(L.head.line,L.head.ch+(y?1:-1))}}function A(L,y){var u=W(L);if(!u||L.getOption("disableInput"))return ae.Pass;var a=K(u,"pairs"),s=a.indexOf(y);if(s==-1)return ae.Pass;for(var d=K(u,"closeBefore"),E=K(u,"triples"),g=a.charAt(s+1)==y,m=L.listSelections(),k=s%2==0,x,h=0;h<m.length;h++){var p=m[h],c=p.head,o,S=L.getRange(c,D(c.line,c.ch+1));if(k&&!p.empty())o="surround";else if((g||!k)&&S==y)g&&O(L,c)?o="both":E.indexOf(y)>=0&&L.getRange(c,D(c.line,c.ch+3))==y+y+y?o="skipThree":o="skip";else if(g&&c.ch>1&&E.indexOf(y)>=0&&L.getRange(D(c.line,c.ch-2),c)==y+y){if(c.ch>2&&/\bstring/.test(L.getTokenTypeAt(D(c.line,c.ch-2))))return ae.Pass;o="addFour"}else if(g){var v=c.ch==0?" ":L.getRange(D(c.line,c.ch-1),c);if(!ae.isWordChar(S)&&v!=y&&!ae.isWordChar(v))o="both";else return ae.Pass}else if(k&&(S.length===0||/\s/.test(S)||d.indexOf(S)>-1))o="both";else return ae.Pass;if(!x)x=o;else if(x!=o)return ae.Pass}var T=s%2?a.charAt(s-1):y,N=s%2?y:a.charAt(s+1);L.operation(function(){if(x=="skip")L.execCommand("goCharRight");else if(x=="skipThree")for(var z=0;z<3;z++)L.execCommand("goCharRight");else if(x=="surround"){for(var Y=L.getSelections(),z=0;z<Y.length;z++)Y[z]=T+Y[z]+N;L.replaceSelections(Y,"around"),Y=L.listSelections().slice();for(var z=0;z<Y.length;z++)Y[z]=b(Y[z]);L.setSelections(Y)}else x=="both"?(L.replaceSelection(T+N,null),L.triggerElectric(T+N),L.execCommand("goCharLeft")):x=="addFour"&&(L.replaceSelection(T+T+T+T,"before"),L.execCommand("goCharRight"))})}function _(L,y){var u=L.getRange(D(y.line,y.ch-1),D(y.line,y.ch+1));return u.length==2?u:null}function O(L,y){var u=L.getTokenAt(D(y.line,y.ch+1));return/\bstring/.test(u.type)&&u.start==y.ch&&(y.ch==0||!/\bstring/.test(L.getTokenTypeAt(y)))}})},F8wB:function(Ft,yt,ne){Ft.exports={loading:"loading___1SIOG"}},Gytx:function(Ft,yt){Ft.exports=function(ae,X,D,K){var w=D?D.call(K,ae,X):void 0;if(w!==void 0)return!!w;if(ae===X)return!0;if(typeof ae!="object"||!ae||typeof X!="object"||!X)return!1;var P=Object.keys(ae),H=Object.keys(X);if(P.length!==H.length)return!1;for(var W=Object.prototype.hasOwnProperty.bind(X),I=0;I<P.length;I++){var M=P[I];if(!W(M))return!1;var b=ae[M],A=X[M];if(w=D?D.call(K,b,A,M):void 0,w===!1||w===void 0&&b!==A)return!1}return!0}},HmJG:function(Ft,yt,ne){},I8Z2:function(Ft,yt,ne){"use strict";ne.d(yt,"a",function(){return K}),ne.d(yt,"b",function(){return _}),ne.d(yt,"c",function(){return L});var ae=ne("q1tI"),X=function(){var y=function(u,a){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,d){s.__proto__=d}||function(s,d){for(var E in d)d.hasOwnProperty(E)&&(s[E]=d[E])},y(u,a)};return function(u,a){y(u,a);function s(){this.constructor=u}u.prototype=a===null?Object.create(a):(s.prototype=a.prototype,new s)}}(),D=ae.createContext(null),K=function(y){X(u,y);function u(){return y!==null&&y.apply(this,arguments)||this}return u.prototype.render=function(){return ae.createElement(D.Provider,{value:this.props.store},this.props.children)},u}(ae.Component),w=ne("Gytx"),P=ne.n(w),H=ne("2mql"),W=ne.n(H),I=function(){var y=function(u,a){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,d){s.__proto__=d}||function(s,d){for(var E in d)d.hasOwnProperty(E)&&(s[E]=d[E])},y(u,a)};return function(u,a){y(u,a);function s(){this.constructor=u}u.prototype=a===null?Object.create(a):(s.prototype=a.prototype,new s)}}(),M=function(){return M=Object.assign||function(y){for(var u,a=1,s=arguments.length;a<s;a++){u=arguments[a];for(var d in u)Object.prototype.hasOwnProperty.call(u,d)&&(y[d]=u[d])}return y},M.apply(this,arguments)};function b(y){return y.displayName||y.name||"Component"}var A=function(){return{}};function _(y,u){u===void 0&&(u={});var a=!!y,s=y||A;return function(E){var g=function(k){I(x,k);function x(h,p){var c=k.call(this,h,p)||this;return c.unsubscribe=null,c.handleChange=function(){if(!c.unsubscribe)return;var o=s(c.store.getState(),c.props);c.setState({subscribed:o})},c.store=c.context,c.state={subscribed:s(c.store.getState(),h),store:c.store,props:h},c}return x.getDerivedStateFromProps=function(h,p){return y&&y.length===2&&h!==p.props?{subscribed:s(p.store.getState(),h),props:h}:{props:h}},x.prototype.componentDidMount=function(){this.trySubscribe()},x.prototype.componentWillUnmount=function(){this.tryUnsubscribe()},x.prototype.shouldComponentUpdate=function(h,p){return!P()(this.props,h)||!P()(this.state.subscribed,p.subscribed)},x.prototype.trySubscribe=function(){a&&(this.unsubscribe=this.store.subscribe(this.handleChange),this.handleChange())},x.prototype.tryUnsubscribe=function(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=null)},x.prototype.render=function(){var h=M(M(M({},this.props),this.state.subscribed),{store:this.store});return ae.createElement(E,M({},h,{ref:this.props.miniStoreForwardedRef}))},x.displayName="Connect("+b(E)+")",x.contextType=D,x}(ae.Component);if(u.forwardRef){var m=ae.forwardRef(function(k,x){return ae.createElement(g,M({},k,{miniStoreForwardedRef:x}))});return W()(m,E)}return W()(g,E)}}var O=function(){return O=Object.assign||function(y){for(var u,a=1,s=arguments.length;a<s;a++){u=arguments[a];for(var d in u)Object.prototype.hasOwnProperty.call(u,d)&&(y[d]=u[d])}return y},O.apply(this,arguments)};function L(y){var u=y,a=[];function s(g){u=O(O({},u),g);for(var m=0;m<a.length;m++)a[m]()}function d(){return u}function E(g){return a.push(g),function(){var k=a.indexOf(g);a.splice(k,1)}}return{setState:s,getState:d,subscribe:E}}},LdHM:function(Ft,yt,ne){"use strict";ne.d(yt,"b",function(){return d}),ne.d(yt,"a",function(){return g});var ae=ne("1OyB"),X=ne("vuIU"),D=ne("Ji7U"),K=ne("LK+K"),w=ne("q1tI"),P=ne("rePB"),H=ne("Ff2n"),W=ne("ODXe"),I=ne("4IlW"),M=ne("bX4T"),b=ne("YrtM"),A=ne("TSYQ"),_=ne.n(A),O=ne("+nKL"),L=ne("8OUc"),y=function(te,de){var be=te.prefixCls,Oe=te.id,Ge=te.flattenOptions,Me=te.childrenAsData,Ie=te.values,Ue=te.searchValue,Pe=te.multiple,Te=te.defaultActiveFirstOption,se=te.height,Fe=te.itemHeight,dt=te.notFoundContent,it=te.open,ot=te.menuItemSelectedIcon,ct=te.virtual,je=te.onSelect,Ye=te.onToggleOpen,rt=te.onActiveValue,st=te.onScroll,qe=te.onMouseEnter,Ve="".concat(be,"-item"),Ke=Object(b.a)(function(){return Ge},[it,Ge],function(Ze,we){return we[0]&&Ze[1]!==we[1]}),ht=w.useRef(null),ut=function(we){we.preventDefault()},ft=function(we){ht.current&&ht.current.scrollTo({index:we})},nt=function(we){for(var ye=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,Ee=Ke.length,re=0;re<Ee;re+=1){var ie=(we+re*ye+Ee)%Ee,ue=Ke[ie],ge=ue.group,Se=ue.data;if(!ge&&!Se.disabled)return ie}return-1},Lt=w.useState(function(){return nt(0)}),vt=Object(W.a)(Lt,2),bt=vt[0],Ne=vt[1],Ot=function(we){Ne(we);var ye=Ke[we];if(!ye){rt(null,-1);return}rt(ye.data.value,we)};w.useEffect(function(){Ot(Te!==!1?nt(0):-1)},[Ke.length,Ue]),w.useEffect(function(){var Ze=setTimeout(function(){if(!Pe&&it&&Ie.size===1){var we=Array.from(Ie)[0],ye=Ke.findIndex(function(Ee){var re=Ee.data;return re.value===we});Ot(ye),ft(ye)}});return function(){return clearTimeout(Ze)}},[it]);var Et=function(we){we!==void 0&&je(we,{selected:!Ie.has(we)}),Pe||Ye(!1)};if(w.useImperativeHandle(de,function(){return{onKeyDown:function(we){var ye=we.which;switch(ye){case I.a.UP:case I.a.DOWN:{var Ee=0;if(ye===I.a.UP?Ee=-1:ye===I.a.DOWN&&(Ee=1),Ee!==0){var re=nt(bt+Ee,Ee);ft(re),Ot(re)}break}case I.a.ENTER:{var ie=Ke[bt];ie&&!ie.data.disabled?Et(ie.data.value):Et(void 0),it&&we.preventDefault();break}case I.a.ESC:Ye(!1)}},onKeyUp:function(){},scrollTo:function(we){ft(we)}}}),Ke.length===0)return w.createElement("div",{role:"listbox",id:"".concat(Oe,"_list"),className:"".concat(Ve,"-empty"),onMouseDown:ut},dt);function We(Ze){var we=Ke[Ze];if(!we)return null;var ye=we.data||{},Ee=ye.value,re=ye.label,ie=ye.children,ue=Object(M.a)(ye,!0),ge=Me?ie:re;return we?w.createElement("div",Object.assign({"aria-label":typeof ge=="string"?ge:null},ue,{key:Ze,role:"option",id:"".concat(Oe,"_list_").concat(Ze),"aria-selected":Ie.has(Ee)}),Ee):null}return w.createElement(w.Fragment,null,w.createElement("div",{role:"listbox",id:"".concat(Oe,"_list"),style:{height:0,width:0,overflow:"hidden"}},We(bt-1),We(bt),We(bt+1)),w.createElement(O.a,{itemKey:"key",ref:ht,data:Ke,height:se,itemHeight:Fe,fullHeight:!1,onMouseDown:ut,onScroll:st,virtual:ct,onMouseEnter:qe},function(Ze,we){var ye,Ee=Ze.group,re=Ze.groupOption,ie=Ze.data,ue=ie.label,ge=ie.key;if(Ee)return w.createElement("div",{className:_()(Ve,"".concat(Ve,"-group"))},ue!==void 0?ue:ge);var Se=ie.disabled,Re=ie.value,Xe=ie.title,xt=ie.children,Mt=ie.style,kt=ie.className,Gt=Object(H.a)(ie,["disabled","value","title","children","style","className"]),Kt=Ie.has(Re),Ct="".concat(Ve,"-option"),pr=_()(Ve,Ct,kt,(ye={},Object(P.a)(ye,"".concat(Ct,"-grouped"),re),Object(P.a)(ye,"".concat(Ct,"-active"),bt===we&&!Se),Object(P.a)(ye,"".concat(Ct,"-disabled"),Se),Object(P.a)(ye,"".concat(Ct,"-selected"),Kt),ye)),rr=Me?xt:ue,Ir=!ot||typeof ot=="function"||Kt;return w.createElement("div",Object.assign({},Gt,{"aria-selected":Kt,className:pr,title:Xe,onMouseMove:function(){if(bt===we||Se)return;Ot(we)},onClick:function(){Se||Et(Re)},style:Mt}),w.createElement("div",{className:"".concat(Ct,"-content")},rr||Re),w.isValidElement(ot)||Kt,Ir&&w.createElement(L.a,{className:"".concat(Ve,"-option-state"),customizeIcon:ot,customizeIconProps:{isSelected:Kt}},Kt?"\u2713":null))}))},u=w.forwardRef(y);u.displayName="OptionList";var a=u,s=function(){return null};s.isSelectOption=!0;var d=s,E=function(){return null};E.isSelectOptGroup=!0;var g=E,m=ne("VTBJ"),k=ne("Zm9Q");function x(j){var te=j.key,de=j.props,be=de.children,Oe=de.value,Ge=Object(H.a)(de,["children","value"]);return Object(m.a)({key:te,value:Oe!==void 0?Oe:te,children:be},Ge)}function h(j){var te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(k.a)(j).map(function(de,be){if(!w.isValidElement(de)||!de.type)return null;var Oe=de.type.isSelectOptGroup,Ge=de.key,Me=de.props,Ie=Me.children,Ue=Object(H.a)(Me,["children"]);return te||!Oe?x(de):Object(m.a)(Object(m.a)({key:"__RC_SELECT_GRP__".concat(Ge===null?be:Ge,"__"),label:Ge},Ue),{},{options:h(Ie)})}).filter(function(de){return de})}var p=ne("2Qr1"),c=ne("qNPg"),o=ne("U8pU"),S=ne("Kwbf"),v=ne("WKfj");function T(j){var te=j.mode,de=j.options,be=j.children,Oe=j.backfill,Ge=j.allowClear,Me=j.placeholder,Ie=j.getInputElement,Ue=j.showSearch,Pe=j.onSearch,Te=j.defaultOpen,se=j.autoFocus,Fe=j.labelInValue,dt=j.value,it=j.inputValue,ot=j.optionLabelProp,ct=te==="multiple"||te==="tags",je=Ue!==void 0?Ue:ct||te==="combobox",Ye=de||h(be);if(Object(S.a)(te!=="tags"||Ye.every(function(Ve){return!Ve.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),te==="tags"||te==="combobox"){var rt=Ye.some(function(Ve){return Ve.options?Ve.options.some(function(Ke){return typeof("value"in Ke?Ke.value:Ke.key)=="number"}):typeof("value"in Ve?Ve.value:Ve.key)=="number"});Object(S.a)(!rt,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(S.a)(te!=="combobox"||!ot,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(S.a)(te==="combobox"||!Oe,"`backfill` only works with `combobox` mode."),Object(S.a)(te==="combobox"||!Ie,"`getInputElement` only work with `combobox` mode."),Object(S.b)(te!=="combobox"||!Ie||!Ge||!Me,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),Pe&&!je&&te!=="combobox"&&te!=="tags"&&Object(S.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(S.b)(!Te||se,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),dt!=null){var st=Object(v.d)(dt);Object(S.a)(!Fe||st.every(function(Ve){return Object(o.a)(Ve)==="object"&&("key"in Ve||"value"in Ve)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(S.a)(!ct||Array.isArray(dt),"`value` should be array when `mode` is `multiple` or `tags`")}if(be){var qe=null;Object(k.a)(be).some(function(Ve){if(!w.isValidElement(Ve)||!Ve.type)return!1;var Ke=Ve.type;if(Ke.isSelectOption)return!1;if(Ke.isSelectOptGroup){var ht=Object(k.a)(Ve.props.children).every(function(ut){return!w.isValidElement(ut)||!Ve.type||ut.type.isSelectOption?!0:(qe=ut.type,!1)});return!ht}return qe=Ke,!0}),qe&&Object(S.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(qe.displayName||qe.name||qe,"`.")),Object(S.a)(it===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var N=T,z=Object(c.a)({prefixCls:"rc-select",components:{optionList:a},convertChildrenToData:h,flattenOptions:p.d,getLabeledValue:p.e,filterOptions:p.b,isValueDisabled:p.g,findValueOption:p.c,warningProps:N,fillOptionsWithMissingValue:p.a}),Y=function(j){Object(D.a)(de,j);var te=Object(K.a)(de);function de(){var be;return Object(ae.a)(this,de),be=te.apply(this,arguments),be.selectRef=w.createRef(),be.focus=function(){be.selectRef.current.focus()},be.blur=function(){be.selectRef.current.blur()},be}return Object(X.a)(de,[{key:"render",value:function(){return w.createElement(z,Object.assign({ref:this.selectRef},this.props))}}]),de}(w.Component);Y.Option=d,Y.OptGroup=g;var ee=Y,G=yt.c=ee},M8RZ:function(Ft,yt,ne){"use strict";ne.d(yt,"a",function(){return I});var ae=ne("fWQN"),X=ne("mtLc"),D=ne("yKVA"),K=ne("879j"),w=ne("q1tI"),P=ne.n(w),H=ne("i8i4"),W=ne.n(H),I=function(M){Object(D.a)(A,M);var b=Object(K.a)(A);function A(_){var O;Object(ae.a)(this,A),O=b.call(this,_);var L=window.document;return O.node=L.createElement("div"),L.body.appendChild(O.node),O}return Object(X.a)(A,[{key:"render",value:function(){var O=this.props.children;return Object(H.createPortal)(O,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),A}(P.a.Component)},OLES:function(Ft,yt,ne){"use strict";var ae=ne("U8pU"),X=ne("VTBJ"),D=ne("Ff2n"),K=ne("q1tI"),w=ne("uciX"),P=ne("7ixt"),H=function(_){var O=_.overlay,L=_.prefixCls,y=_.id,u=_.overlayInnerStyle;return K.createElement("div",{className:"".concat(L,"-inner"),id:y,role:"tooltip",style:u},typeof O=="function"?O():O)},W=H,I=function(_,O){var L=_.overlayClassName,y=_.trigger,u=y===void 0?["hover"]:y,a=_.mouseEnterDelay,s=a===void 0?0:a,d=_.mouseLeaveDelay,E=d===void 0?.1:d,g=_.overlayStyle,m=_.prefixCls,k=m===void 0?"rc-tooltip":m,x=_.children,h=_.onVisibleChange,p=_.afterVisibleChange,c=_.transitionName,o=_.animation,S=_.placement,v=S===void 0?"right":S,T=_.align,N=T===void 0?{}:T,z=_.destroyTooltipOnHide,Y=z===void 0?!1:z,ee=_.defaultVisible,G=_.getTooltipContainer,j=_.overlayInnerStyle,te=Object(D.a)(_,["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle"]),de=Object(K.useRef)(null);Object(K.useImperativeHandle)(O,function(){return de.current});var be=Object(X.a)({},te);"visible"in _&&(be.popupVisible=_.visible);var Oe=function(){var Pe=_.arrowContent,Te=Pe===void 0?null:Pe,se=_.overlay,Fe=_.id;return[K.createElement("div",{className:"".concat(k,"-arrow"),key:"arrow"},Te),K.createElement(W,{key:"content",prefixCls:k,id:Fe,overlay:se,overlayInnerStyle:j})]},Ge=!1,Me=!1;if(typeof Y=="boolean")Ge=Y;else if(Y&&Object(ae.a)(Y)==="object"){var Ie=Y.keepParent;Ge=Ie===!0,Me=Ie===!1}return K.createElement(w.a,Object.assign({popupClassName:L,prefixCls:k,popup:Oe,action:u,builtinPlacements:P.a,popupPlacement:v,ref:de,popupAlign:N,getPopupContainer:G,onPopupVisibleChange:h,afterPopupVisibleChange:p,popupTransitionName:c,popupAnimation:o,defaultPopupVisible:ee,destroyPopupOnHide:Ge,autoDestroy:Me,mouseLeaveDelay:E,popupStyle:g,mouseEnterDelay:s},be),x)},M=Object(K.forwardRef)(I),b=yt.a=M},Ot1p:function(Ft,yt,ne){"use strict";var ae=ne("2qtc"),X=ne("kLXV"),D=ne("rAM+"),K=ne("miYZ"),w=ne("tsqr"),P=ne("9og8"),H=ne("tJVT"),W=ne("jrin"),I=ne("WmNS"),M=ne.n(I),b=ne("q1tI"),A=ne.n(b),_=ne("VrN/"),O=ne.n(_),L=ne("bdgK"),y=ne("p77/"),u=ne("Bd2K"),a=ne("ELLl"),s=ne("19Vz"),d=ne("lZu9"),E=ne("+NIl"),g=ne("kSUc"),m=ne("9Bee"),k=function(Se){var Re=Se.value,Xe=Re===void 0?"":Re,xt=Se.className,Mt=Se.showTextOnly,kt=Se.showLines,Gt=Se.style,Kt=Gt===void 0?{}:Gt,Ct=Object(b.useMemo)(function(){return""},[Xe]);return A.a.createElement(A.a.Fragment,null,A.a.createElement("div",{dangerouslySetInnerHTML:{__html:Ct}}))},x=ne("0Owb"),h=ne("dejd"),p=ne("C+DQ"),c=ne("1vsH"),o=ne("m3rI"),S=[{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 v(Se){var Re=Se.onActionCallback,Xe=Se.title,xt=Se.icon,Mt=Se.actionName,kt=Se.className,Gt=kt===void 0?"":kt,Kt=Se.children;function Ct(){Re(Mt)}return A.a.createElement("a",{title:Xe,className:Gt,onClick:Ct},A.a.createElement("i",{className:"md-iconfont ".concat(xt)}),Kt)}var T=function(Se){var Re=Se.watch,Xe=Se.showNullButton,xt=Se.onActionCallback,Mt=Se.fullScreen,kt=Se.insertTemp,Gt=Se.hidetoolBar,Kt=Se.uuid,Ct=Se.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(c.F)("_educoder_session_login"),"&_educoder_session=").concat(Object(c.F)("_educoder_session"),"&key=").concat(Kt,"&api=").concat(encodeURIComponent(o.a.PROXY_SERVER)));var pr=[].concat(S,[{title:"".concat(Re?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(Re?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return A.a.createElement("ul",{className:"markdown-toolbar-container"},!Gt&&pr.map(function(rr,Ir){return A.a.createElement("li",{key:Ir},rr.actionName?A.a.createElement(v,Object(x.a)({},rr,{onActionCallback:xt})):A.a.createElement("span",{className:"v-line"}))}),Xe?A.a.createElement("li",null,A.a.createElement(v,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:xt},A.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,kt&&A.a.createElement("li",null,A.a.createElement(v,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(kt),onActionCallback:xt},A.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),A.a.createElement("li",{className:"btn-full-screen"},A.a.createElement(v,{icon:"".concat(Mt?"icon-shrink":"icon-enlarge"),title:Mt?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:xt})))},N=ne("M8RZ"),z=ne("+L6B"),Y=ne("2/Rp"),ee=ne("y8nQ"),G=ne("Vl3Y"),j=ne("5NDa"),te=ne("5rEg"),de={labelCol:{span:4},wrapperCol:{span:20}},be=function(Se){var Re=Se.callback,Xe=Se.onCancel;function xt(Mt){Re(Mt)}return A.a.createElement(G.a,Object(x.a)({},de,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:xt}),A.a.createElement(G.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},A.a.createElement(te.a,null)),A.a.createElement(G.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},A.a.createElement(te.a,null)),A.a.createElement("div",{className:"flex-container flex-end"},A.a.createElement(Y.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),A.a.createElement(Y.a,{type:"ghost",onClick:Xe},"\u53D6\u6D88")))},Oe=ne("7ahc"),Ge=ne("HmJG"),Me=ne("BjJ7"),Ie=G.a.useForm,Ue={width:280,marginRight:10},Pe={labelCol:{span:5},wrapperCol:{span:19}},Te=function(Se){var Re=Se.callback,Xe=Se.onCancel,xt=Ie(),Mt=Object(H.a)(xt,1),kt=Mt[0];function Gt(pr){Re(pr)}function Kt(pr,rr){if(pr.status===-1){w.b.error(pr.message);return}kt.setFieldsValue({src:"/api/attachments/".concat(pr.id),type:rr.type})}function Ct(pr){var rr=pr.target.files[0];Fe(rr,Kt)}return A.a.createElement(G.a,Object(x.a)({form:kt},Pe,{className:"upload-image-panel",onFinish:Gt}),A.a.createElement(G.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},A.a.createElement("div",{className:"flex-container"},A.a.createElement(G.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},A.a.createElement(te.a,{style:Ue})),A.a.createElement(se,{onFileChange:Ct}))),A.a.createElement(G.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt"},A.a.createElement(te.a,{style:{width:264}})),A.a.createElement(G.a.Item,{style:{textAlign:"right"}},A.a.createElement(Y.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),A.a.createElement(Y.a,{type:"ghost",onClick:Xe},"\u53D6\u6D88")))};function se(Se){var Re=Se.onFileChange;return A.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",A.a.createElement("input",{type:"file",onChange:Re}))}function Fe(Se,Re){if(!Se)throw new String("\u6CA1\u6709\u6587\u4EF6");var Xe=new FormData;Xe.append("editormd-image-file",Se),Xe.append("file_param_name","editormd-image-file"),Xe.append("byxhr","true");var xt=new window.XMLHttpRequest;xt.withCredentials=!0,xt.addEventListener("load",function(Mt){Re(JSON.parse(Mt.target.responseText),Se)},!1),xt.addEventListener("error",function(Mt){console.error(Mt)},!1),xt.open("POST","".concat(Me.a,"/api/attachments.json")),xt.send(Xe)}var dt=ne("giR+"),it=ne("fyUT"),ot=ne("7Kak"),ct=ne("9yH6"),je=ct.a.Group,Ye={margin:"0 8px"},rt=function(Se){var Re=Se.callback,Xe=Se.onCancel;function xt(Mt){Re(Mt)}return A.a.createElement(G.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:xt},A.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},A.a.createElement("span",{style:Ye},"\u5355\u5143\u683C\u6570\uFF1A"),A.a.createElement("span",{style:Ye},"\u884C\u6570"),A.a.createElement(G.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},A.a.createElement(it.a,null)),A.a.createElement("span",{style:Ye},"\u5217\u6570"),A.a.createElement(G.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},A.a.createElement(it.a,null))),A.a.createElement("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"}},A.a.createElement("span",{style:Ye},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),A.a.createElement(G.a.Item,{name:"align"},A.a.createElement(je,null,A.a.createElement(ct.a,{value:"default"},A.a.createElement("i",{className:"fa fa-align-justify"})),A.a.createElement(ct.a,{value:"left"},A.a.createElement("i",{className:"fa fa-align-left"})),A.a.createElement(ct.a,{value:"center"},A.a.createElement("i",{className:"fa fa-align-center"})),A.a.createElement(ct.a,{value:"right"},A.a.createElement("i",{className:"fa fa-align-right"}))))),A.a.createElement("div",{className:"flex-container flex-end"},A.a.createElement(Y.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),A.a.createElement(Y.a,{type:"ghost",onClick:Xe},"\u53D6\u6D88")))},st=ne("ErOA"),qe=ne("7Cbv"),Ve="link",Ke="upload-image",ht="code-block",ut="add-table",ft="------------",nt={default:ft,left:":".concat(ft),center:":".concat(ft,":"),right:"".concat(ft,":")},Lt=ne("9VGf"),vt,bt;function Ne(){}var Ot=0,Et=1e4,We="\u2581",Ze=`
**\u6A21\u677F\u6807\u9898**
\u6A21\u677F\u6B63\u6587\u5185\u5BB9\uFF0C\u53EF\u8F93\u5165\u6587\u672C\u5185\u5BB9\u548C\u7C98\u8D34\u56FE\u7247\u7B49\u64CD\u4F5C`;function we(Se){return/^\d+$/.test(Se)?"".concat(Se,"px"):Se}var ye=navigator.platform.toUpperCase().indexOf("MAC")>=0,Ee=ye?"Cmd":"Ctrl",re=["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=(vt={},Object(W.a)(vt,Ee+"-B","bold"),Object(W.a)(vt,Ee+"-I","italic"),vt),ue=(bt={},Object(W.a)(bt,Ve,"\u6DFB\u52A0\u94FE\u63A5"),Object(W.a)(bt,ht,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(W.a)(bt,Ke,"\u6DFB\u52A0\u6587\u4EF6"),Object(W.a)(bt,ut,"\u6DFB\u52A0\u8868\u683C"),bt),ge=yt.a=function(Se){var Re=Se.defaultValue,Xe=Re===void 0?"":Re,xt=Se.onChange,Mt=Se.width,kt=Mt===void 0?"100%":Mt,Gt=Se.height,Kt=Gt===void 0?400:Gt,Ct=Se.miniToolbar,pr=Ct===void 0?!1:Ct,rr=Se.isFocus,Ir=rr===void 0?!1:rr,Pr=Se.watch,Vt=Se.insertTemp,an=Se.mode,En=an===void 0?"markdown":an,It=Se.id,An=It===void 0?"markdown-editor-id":It,on=Se.showResizeBar,sn=on===void 0?!1:on,Un=Se.noStorage,ci=Un===void 0?!1:Un,Qn=Se.showNullButton,mr=Qn===void 0?!1:Qn,wt=Se.hidetoolBar,Vn=wt===void 0?!1:wt,oi=Se.fullScreen,mn=oi===void 0?!1:oi,nr=Se.onBlur,Bn=Se.onCMBeforeChange,Zn=Se.onFullScreen,hi=Se.className,Je=hi===void 0?"":hi,jt=Se.disablePaste,si=jt===void 0?!1:jt,fi=Se.placeholder,Si=fi===void 0?"":fi,li=Se.values,F=li===void 0?"":li,l=Object(b.useState)(null),f=Object(H.a)(l,2),R=f[0],Q=f[1],B=Object(b.useState)(Xe),ve=Object(H.a)(B,2),ze=ve[0],lt=ve[1],At=Object(b.useState)(Pr),$e=Object(H.a)(At,2),Rt=$e[0],gr=$e[1],Dr=Object(b.useState)(mn),Ln=Object(H.a)(Dr,2),gn=Ln[0],ln=Ln[1],Jn=Object(b.useState)(""),Pi=Object(H.a)(Jn,2),Qr=Pi[0],Fn=Pi[1],pi=Object(b.useState)(0),ui=Object(H.a)(pi,2),Sn=ui[0],Ii=ui[1],Ci=Object(b.useState)(Kt),Gi=Object(H.a)(Ci,2),Vi=Gi[0],qn=Gi[1],en=Object(b.useState)(!1),mi=Object(H.a)(en,2),oa=mi[0],Ni=mi[1],Fr=Object(b.useRef)(Object(qe.a)()),vr=Object(b.useRef)(!1),Kr=Object(b.useRef)(),qt=Object(b.useRef)(),zr=Object(b.useRef)(),Sr=Object(b.useRef)(),ei=Object(b.useRef)(),tn=function(){var _t=Object(P.a)(M.a.mark(function zt(){var Pt,er;return M.a.wrap(function(Cr){for(;;)switch(Cr.prev=Cr.next){case 0:return Cr.next=2,Object(st.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:Fr.current}});case 2:er=Cr.sent,er!=null&&(Pt=er.attachments)!==null&&Pt!==void 0&&Pt.length&&(console.log("cm:",R,qt),er.attachments.map(function(ur){ur.content_type.indexOf("image")>-1?R.replaceSelection("![,](/api/attachments/".concat(ur.id,"?type=").concat(ur.content_type,")")):ur.content_type.indexOf("video")>-1?R.replaceSelection('<video width="100%" controls src="'.concat(o.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):ur.content_type.indexOf("pdf")>-1?R.replaceSelection('<a href="'.concat(o.a.API_SERVER,"/api/attachments/").concat(ur.id,"?type=").concat(ur.content_type,'&disposition=inline" target="_blank">').concat(ur.name,"</a>")):R.replaceSelection("[".concat(ur.name,"](").concat(o.a.API_SERVER,"/api/attachments/").concat(ur.id,"?type=").concat(ur.content_type,")"))}));case 4:case"end":return Cr.stop()}},zt)}));return function(){return _t.apply(this,arguments)}}();Object(b.useEffect)(function(){lt(F),R==null||R.setValue(F)},[F]),Object(b.useEffect)(function(){Zn==null||Zn(gn)},[gn]),Object(b.useEffect)(function(){if(qt.current){var _t=O.a.fromTextArea(qt.current,{mode:En,lineNumbers:!pr,lineWrapping:!0,value:Xe,autoCloseTags:!0,autoCloseBrackets:!0});Ir&&_t.focus();function zt(Pt,er){if(si){er.preventDefault();return}var hr=er.clipboardData;if(hr){var Cr=hr.types.toString(),ur=hr.items;if(Cr==="Files"||hr.types.indexOf("Files")>-1){if(er.preventDefault(),En=="stex")return;try{var Vr,_n=ur[1];((Vr=ur[0])===null||Vr===void 0?void 0:Vr.kind)==="file"&&(_n=ur[0]);var ir=_n.getAsFile(),gi=ir.name.split(".").pop();Fe(ir,function(br){if(br.id){var Cn,yn,Yn;(ir==null||((Cn=ir.type)===null||Cn===void 0)?void 0:Cn.indexOf("image"))>-1?_t.replaceSelection("![,](/api/attachments/".concat(br.id,"?type=").concat(br.content_type,")")):(ir==null||((yn=ir.type)===null||yn===void 0)?void 0:yn.indexOf("video"))>-1?_t.replaceSelection('<video width="100%" controls src="'.concat(o.a.API_SERVER,"/api/attachments/").concat(br.id,'"></video>')):(ir==null||((Yn=ir.type)===null||Yn===void 0)?void 0:Yn.indexOf("pdf"))>-1?_t.replaceSelection('<a href="'.concat(o.a.API_SERVER,"/api/attachments/").concat(br.id,"?type=").concat(ir.type,'&disposition=inline" target="_blank">').concat(ir.name,"</a>")):re.includes(gi)?_t.replaceSelection('<a href="'.concat(o.a.API_SERVER,"/api/attachments/").concat(br.id,'?type=office&disposition=inline" target="_blank">').concat(ir.name,"</a>")):_t.replaceSelection("[".concat(ir.name,"](").concat(o.a.API_SERVER,"/api/attachments/").concat(br.id,"?type=").concat(br.content_type,")"))}else(br==null?void 0:br.status)===401&&(document.location.href="/user/login")})}catch(br){w.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return _t.on("paste",zt),_t.on("dragleave",function(Pt,er){zr.current.classList.remove("mouse-hover-md")}),_t.on("dragover",function(Pt,er){zr.current.classList.add("mouse-hover-md")}),_t.on("drop",function(Pt,er){zr.current.classList.add("mouse-hover-md");var hr;if(hr=er.dataTransfer.files,hr.length>0){er.preventDefault(),er.stopPropagation();for(var Cr=function(_n){var ir=hr[_n],gi=ir.name.split(".").pop();Fe(ir,function(br){if(br.id){var Cn,yn,Yn;(ir==null||((Cn=ir.type)===null||Cn===void 0)?void 0:Cn.indexOf("image"))>-1?_t.replaceSelection("![,](/api/attachments/".concat(br.id,"?type=").concat(br.content_type,")")):(ir==null||((yn=ir.type)===null||yn===void 0)?void 0:yn.indexOf("video"))>-1?_t.replaceSelection('<video width="100%" controls src="'.concat(o.a.API_SERVER,"/api/attachments/").concat(br.id,'"></video>')):(ir==null||((Yn=ir.type)===null||Yn===void 0)?void 0:Yn.indexOf("pdf"))>-1?_t.replaceSelection('<a href="'.concat(o.a.API_SERVER,"/api/attachments/").concat(br.id,"?type=").concat(ir.type,'&disposition=inline" target="_blank">').concat(ir.name,"</a>")):re.includes(gi)?_t.replaceSelection('<a href="'.concat(o.a.API_SERVER,"/api/attachments/").concat(br.id,'?type=office&disposition=inline" target="_blank">').concat(ir.name,"</a>")):_t.replaceSelection("[".concat(ir.name,"](").concat(o.a.API_SERVER,"/api/attachments/").concat(br.id,"?type=").concat(br.content_type,")"))}else(br==null?void 0:br.status)===401&&(document.location.href="/user/login")})},ur=0;ur<hr.length;ur++)Cr(ur)}}),Q(_t),function(){_t.off("paste",zt)}}},[]);var vn=Object(b.useCallback)(function(){if(zr.current)try{}catch(_t){console.log(_t,"---- to set md editor body height")}},[Vi,zr,gn]);Object(b.useEffect)(function(){function _t(){var Pt=new L.default(function(er){var hr=Object(D.a)(er),Cr;try{for(hr.s();!(Cr=hr.n()).done;){var ur=Cr.value;(ur.target.offsetHeight>0||ur.target.offsetWidth>0)&&(vn(),R.setSize("100%","100%"),R.refresh())}}catch(Vr){hr.e(Vr)}finally{hr.f()}});return Pt.observe(qt.current.parentElement),Pt}if(R){var zt=_t();return function(){zt.unobserve(qt.current.parentElement)}}},[R,vn]),Object(b.useEffect)(function(){if(R){for(var _t=[],zt=function(){var ur=er[Pt];hr=Object(H.a)(ur,2);var Vr=hr[0],_n=hr[1],ir=Object(W.a)({},Vr,function(){Xi(_n)});_t.push(ir),R.addKeyMap(ir)},Pt=0,er=Object.entries(ie);Pt<er.length;Pt++){var hr;zt()}return Kr.current=setInterval(function(){vr.current&&tn()},4e3),function(){clearInterval(Kr.current);var Cr=Object(D.a)(_t),ur;try{for(Cr.s();!(ur=Cr.n()).done;){var Vr=ur.value;R.removeKeyMap(Vr)}}catch(_n){Cr.e(_n)}finally{Cr.f()}}}},[R]),Object(b.useEffect)(function(){mn!==gn&&ln(mn)},[mn]),Object(Lt.a)(function(){if(!ci&&Sn>0){var _t=new Date().getTime(),zt=window.sessionStorage.getItem(An);_t>=Sn+Et&&(!zt||zt!==ze)&&(window.sessionStorage.setItem(An,ze),Ni(!0))}},Et),Object(b.useEffect)(function(){gr(Pr)},[R,Pr]),Object(b.useEffect)(function(){R&&(Ir&&R.focus())},[R,Ir]),Object(b.useEffect)(function(){if(Rt&&R){var _t=R.getScrollerElement();function zt(Pt){var er=Pt.target;if(ei.current){var hr=er.scrollTop/er.scrollHeight;ei.current.scrollTop=ei.current.scrollHeight*hr}}return _t.addEventListener("scroll",zt),function(){_t.removeEventListener("scroll",zt)}}},[R,Rt]),Object(b.useEffect)(function(){if(R&&Bn){function _t(zt,Pt){Bn(zt,Pt)}return R.on("beforeChange",_t),function(){R.off("beforeChange",_t)}}},[R,Bn]),Object(b.useEffect)(function(){if(R&&nr){function _t(){nr(R.getValue())}return R.on("blur",_t),function(){R.off("blur",_t)}}},[R,nr]),Object(b.useEffect)(function(){if(R){function _t(zt){var Pt=zt.getValue();lt(Pt),Ii(new Date().getTime()),zt.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),xt&&xt(Pt)}return R.on("change",_t),function(){R.off("change",_t)}}},[R,xt]),Object(b.useEffect)(function(){R&&(Xe==null?(R.setValue(""),lt("")):Xe!==R.getValue()&&(R.setValue(Xe),lt(Xe),R.setCursor(R.lineCount(),0)))},[R,Xe]);var Xi=Object(b.useCallback)(function(_t){var zt=R.getCursor(),Pt=R.getSelection(),er=Pt.split(`
`);switch(_t){case"bold":return R.replaceSelection("**"+Pt+"**"),Pt===""&&R.setCursor(zt.line,zt.ch+2),R.focus();case"italic":return R.replaceSelection("*"+Pt+"*"),Pt===""&&R.setCursor(zt.line,zt.ch+1),R.focus();case"code":return R.replaceSelection("`"+Pt+"`"),Pt===""&&R.setCursor(zt.line,zt.ch+1),R.focus();case"inline-latex":return R.replaceSelection("`$$"+Pt+"$$`"),Pt===""&&R.setCursor(zt.line,zt.ch+3),R.focus();case"latex":return R.replaceSelection("```latex\n"+Pt+"\n```"),R.setCursor(zt.line+1,Pt.length+1),R.focus();case"line-break":return R.replaceSelection(`<br/>
`),R.focus();case"list-ul":return Pt===""?R.replaceSelection("- "+Pt):R.replaceSelection(er.map(function(hr){return hr===""?"":"- ".concat(hr)}).join(`
`)),R.focus();case"list-ol":return Pt===""?R.replaceSelection("1. "+Pt):R.replaceSelection(er.map(function(hr,Cr){return hr===""?"":"".concat(Cr+1,". ").concat(hr)}).join(`
`)),R.focus();case"add-null-ch":return Pt===""&&R.setCursor(zt.line,zt.ch+1),R.replaceSelection(We),R.focus();case"inster-template-1":return Pt===""&&R.setCursor(zt.line,zt.ch),R.replaceSelection(Ze),R.focus();case"eraser":return R.setValue(""),R.focus();case"trigger-watch":return gr(!Rt),R.focus();case"trigger-full-screen":return ln(!gn),R.focus();case Ve:Fn(Ve);return;case ht:Fn(ht);return;case Ke:Fn(Ke);return;case ut:Fn(ut);return;default:throw new Error}},[R,Rt,gn]),Ti=Object(b.useCallback)(function(_t){Fn("");switch(Qr){case Ve:var zt=_t.title,Pt=_t.link;return R.replaceSelection("[".concat(zt,"](").concat(Pt,")")),R.focus();case ht:var er=_t.language,hr=_t.content;return R.replaceSelection(["```"+er,hr,"```"].join(`
`)),R.focus();case Ke:var Cr=_t.src,ur=_t.alt;return ur?R.replaceSelection("![ ".concat(ur," ]( ").concat(Cr,' "').concat(ur,'" )')):R.replaceSelection("![,](".concat(Cr,")")),R.focus();case ut:for(var Vr=_t.row,_n=_t.col,ir=_t.align,gi=`
`,br=0;br<Vr;br++){for(var Cn=[],yn=[],Yn=0;Yn<_n;Yn++)br===1&&yn.push(nt[ir]),Cn.push(" ");br===1&&(gi+="| ".concat(yn.join(" | "),` |
`)),gi+="| ".concat(Cn.join(_n===1?"":" | "),` |
`)}return R.replaceSelection(gi+`
`),R.focus();default:throw new Error}},[R,Qr]),wi=Object(b.useMemo)(function(){switch(Qr){case Ve:return A.a.createElement(be,{callback:Ti,onCancel:jn});case ht:return A.a.createElement(Oe.b,{callback:Ti,onCancel:jn});case Ke:return A.a.createElement(Te,{callback:Ti,onCancel:jn});case ut:return A.a.createElement(rt,{callback:Ti,onCancel:jn});default:return null}},[Qr]);function jn(){Fn("")}Object(b.useEffect)(function(){if(Sr.current){var _t=Sr.current,zt=!1,Pt=0;function er(ur){zt=!0,Pt=ur.pageY}function hr(){zt=!1}function Cr(ur){if(zt){var Vr=ur.pageY-Pt;Vr<0&&(Vr=0),Vr>300&&(Vr=300);var _n=Kt+Vr+"px";qn(_n)}}return _t.addEventListener("mousedown",er),document.addEventListener("mousemove",Cr),document.addEventListener("mouseup",hr),function(){_t.removeEventListener("mousedown",er),document.removeEventListener("mousemove",Cr),document.removeEventListener("mouseup",hr)}}},[R,Sr]),Object(b.useEffect)(function(){qn(Kt)},[Kt]);var Wn=we(kt),sa=we(Vi),Xn={width:Wn,height:sa},la=Object(b.useMemo)(function(){if(Sn){var _t=new Date(Sn),zt=_t.getHours(),Pt=_t.getMinutes(),er=_t.getSeconds();return zt=zt<10?"0"+zt:zt,Pt=Pt<10?"0"+Pt:Pt,er=er<10?"0"+er:er,"".concat(zt,":").concat(Pt,":").concat(er)}return 0},[Sn]);function ua(){window.sessionStorage.removeItem(An),Ni(!1),Ii(0)}function Ui(){Ni(!1),Ii(0),R.setValue(window.sessionStorage.getItem(An))}function Ba(_t,zt){var Pt=R.getValue();Pt=Pt.replace(_t,zt),lt(Pt),R==null||R.setValue(Pt)}return A.a.createElement(b.Fragment,null,A.a.createElement("div",{className:"markdown-editor-wrapper",ref:zr},A.a.createElement("div",{className:"markdown-editor-container ".concat(Je," ").concat(Rt?"on-preview":""," ").concat(pr?"mini":""," ").concat(gn?"full-screen":""),style:Xn},A.a.createElement(T,{insertTemp:Vt,watch:Rt,fullScreen:gn,showNullButton:mr,onActionCallback:Xi,hidetoolBar:Vn,uuid:Fr.current,setOpenPhones:function(){vr.current=!0}}),A.a.createElement("div",{className:"markdown-editor-body"},A.a.createElement("div",{className:"codemirror-container"},A.a.createElement("textarea",{ref:qt,placeholder:Si})),Rt?A.a.createElement("div",{ref:ei,className:"preview-container"},En==="stex"&&A.a.createElement(k,{value:ze}),En!=="stex"&&A.a.createElement(m.a,{edit:!0,value:ze,replaces:Ba})):null))),sn?A.a.createElement("a",{ref:Sr,className:"editor-resize"}):null,A.a.createElement(N.a,null,ue[Qr]?A.a.createElement(X.a,{centered:!0,title:ue[Qr],visible:!0,onCancel:jn,footer:null,className:"markdown-popup-form"},wi):null))}},SJMd:function(Ft,yt){/**
* @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,ae,X,D=!1,K,w;window.PR_SHOULD_USE_CONTINUATION=!0;var P,H;(function(){var W=window,I=["break,continue,do,else,for,if,return,while"],M=[I,"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"],b=[M,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],A=[b,"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"],_=[b,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],O=[b,"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"],L="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",y=[b,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],u="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",a=[I,"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"],s=[I,"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"],d=[I,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],E=[A,O,_,y,u,a,s,d],g=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,m="str",k="kwd",x="com",h="typ",p="lit",c="pun",o="pln",S="tag",v="dec",T="src",N="atn",z="atv",Y="nocode",ee="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function G(je){for(var Ye=0,rt=!1,st=!1,qe=0,Ve=je.length;qe<Ve;++qe){var Ke=je[qe];if(Ke.ignoreCase)st=!0;else if(/[a-z]/i.test(Ke.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){rt=!0,st=!1;break}}var ht={b:8,t:9,n:10,v:11,f:12,r:13};function ut(bt){var Ne=bt.charCodeAt(0);if(Ne!==92)return Ne;var Ot=bt.charAt(1);return Ne=ht[Ot],Ne||("0"<=Ot&&Ot<="7"?parseInt(bt.substring(1),8):Ot==="u"||Ot==="x"?parseInt(bt.substring(2),16):bt.charCodeAt(1))}function ft(bt){if(bt<32)return(bt<16?"\\x0":"\\x")+bt.toString(16);var Ne=String.fromCharCode(bt);return Ne==="\\"||Ne==="-"||Ne==="]"||Ne==="^"?"\\"+Ne:Ne}function nt(bt){var Ne=bt.substring(1,bt.length-1).match(new RegExp("\\\\u[0-9A-Fa-f]{4}|\\\\x[0-9A-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\s\\S]|-|[^-\\\\]","g")),Ot=[],Et=Ne[0]==="^",We=["["];Et&&We.push("^");for(var Ze=Et?1:0,we=Ne.length;Ze<we;++Ze){var ye=Ne[Ze];if(/\\[bdsw]/i.test(ye))We.push(ye);else{var Ee=ut(ye),re;Ze+2<we&&Ne[Ze+1]==="-"?(re=ut(Ne[Ze+2]),Ze+=2):re=Ee,Ot.push([Ee,re]),re<65||Ee>122||(re<65||Ee>90||Ot.push([Math.max(65,Ee)|32,Math.min(re,90)|32]),re<97||Ee>122||Ot.push([Math.max(97,Ee)&~32,Math.min(re,122)&~32]))}}Ot.sort(function(Se,Re){return Se[0]-Re[0]||Re[1]-Se[1]});for(var ie=[],ue=[],Ze=0;Ze<Ot.length;++Ze){var ge=Ot[Ze];ge[0]<=ue[1]+1?ue[1]=Math.max(ue[1],ge[1]):ie.push(ue=ge)}for(var Ze=0;Ze<ie.length;++Ze){var ge=ie[Ze];We.push(ft(ge[0])),ge[1]>ge[0]&&(ge[1]+1>ge[0]&&We.push("-"),We.push(ft(ge[1])))}return We.push("]"),We.join("")}function Lt(bt){for(var Ne=bt.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g")),Ot=Ne.length,Et=[],We=0,Ze=0;We<Ot;++We){var we=Ne[We];if(we==="(")++Ze;else if(we.charAt(0)==="\\"){var ye=+we.substring(1);ye&&(ye<=Ze?Et[ye]=-1:Ne[We]=ft(ye))}}for(var We=1;We<Et.length;++We)Et[We]===-1&&(Et[We]=++Ye);for(var We=0,Ze=0;We<Ot;++We){var we=Ne[We];if(we==="(")++Ze,Et[Ze]||(Ne[We]="(?:");else if(we.charAt(0)==="\\"){var ye=+we.substring(1);ye&&ye<=Ze&&(Ne[We]="\\"+Et[ye])}}for(var We=0;We<Ot;++We)Ne[We]==="^"&&Ne[We+1]!=="^"&&(Ne[We]="");if(bt.ignoreCase&&rt)for(var We=0;We<Ot;++We){var we=Ne[We],Ee=we.charAt(0);we.length>=2&&Ee==="["?Ne[We]=nt(we):Ee!=="\\"&&(Ne[We]=we.replace(/[a-zA-Z]/g,function(ue){var ge=ue.charCodeAt(0);return"["+String.fromCharCode(ge&~32,ge|32)+"]"}))}return Ne.join("")}for(var vt=[],qe=0,Ve=je.length;qe<Ve;++qe){var Ke=je[qe];if(Ke.global||Ke.multiline)throw new Error(""+Ke);vt.push("(?:"+Lt(Ke)+")")}return new RegExp(vt.join("|"),st?"gi":"g")}function j(je,Ye){var rt=/(?:^|\s)nocode(?:\s|$)/,st=[],qe=0,Ve=[],Ke=0;function ht(ut){var ft=ut.nodeType;if(ft==1){if(rt.test(ut.className))return;for(var nt=ut.firstChild;nt;nt=nt.nextSibling)ht(nt);var Lt=ut.nodeName.toLowerCase();(Lt==="br"||Lt==="li")&&(st[Ke]=`
`,Ve[Ke<<1]=qe++,Ve[Ke++<<1|1]=ut)}else if(ft==3||ft==4){var vt=ut.nodeValue;vt.length&&(Ye?vt=vt.replace(/\r\n?/g,`
`):vt=vt.replace(/[ \t\r\n]+/g," "),st[Ke]=vt,Ve[Ke<<1]=qe,qe+=vt.length,Ve[Ke++<<1|1]=ut)}}return ht(je),{sourceCode:st.join("").replace(/\n$/,""),spans:Ve}}function te(je,Ye,rt,st,qe){if(!rt)return;var Ve={sourceNode:je,pre:1,langExtension:null,numberLines:null,sourceCode:rt,spans:null,basePos:Ye,decorations:null};st(Ve),qe.push.apply(qe,Ve.decorations)}var de=/\S/;function be(je){for(var Ye=void 0,rt=je.firstChild;rt;rt=rt.nextSibling){var st=rt.nodeType;Ye=st===1?Ye?je:rt:st===3&&de.test(rt.nodeValue)?je:Ye}return Ye===je?void 0:Ye}function Oe(je,Ye){var rt={},st;(function(){for(var Ke=je.concat(Ye),ht=[],ut={},ft=0,nt=Ke.length;ft<nt;++ft){var Lt=Ke[ft],vt=Lt[3];if(vt)for(var bt=vt.length;--bt>=0;)rt[vt.charAt(bt)]=Lt;var Ne=Lt[1],Ot=""+Ne;ut.hasOwnProperty(Ot)||(ht.push(Ne),ut[Ot]=null)}ht.push(/[\0-\uffff]/),st=G(ht)})();var qe=Ye.length,Ve=function(Ke){for(var ht=Ke.sourceCode,ut=Ke.basePos,ft=Ke.sourceNode,nt=[ut,o],Lt=0,vt=ht.match(st)||[],bt={},Ne=0,Ot=vt.length;Ne<Ot;++Ne){var Et=vt[Ne],We=bt[Et],Ze=void 0,we;if(typeof We=="string")we=!1;else{var ye=rt[Et.charAt(0)];if(ye)Ze=Et.match(ye[1]),We=ye[0];else{for(var Ee=0;Ee<qe;++Ee)if(ye=Ye[Ee],Ze=Et.match(ye[1]),Ze){We=ye[0];break}Ze||(We=o)}we=We.length>=5&&We.substring(0,5)==="lang-",we&&!(Ze&&typeof Ze[1]=="string")&&(we=!1,We=T),we||(bt[Et]=We)}var re=Lt;if(Lt+=Et.length,!we)nt.push(ut+re,We);else{var ie=Ze[1],ue=Et.indexOf(ie),ge=ue+ie.length;Ze[2]&&(ge=Et.length-Ze[2].length,ue=ge-ie.length);var Se=We.substring(5);te(ft,ut+re,Et.substring(0,ue),Ve,nt),te(ft,ut+re+ue,ie,se(Se,ie),nt),te(ft,ut+re+ge,Et.substring(ge),Ve,nt)}}Ke.decorations=nt};return Ve}function Ge(je){var Ye=[],rt=[];je.tripleQuotedStrings?Ye.push([m,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):je.multiLineStrings?Ye.push([m,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):Ye.push([m,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),je.verbatimStrings&&rt.push([m,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var st=je.hashComments;st&&(je.cStyleComments?(st>1?Ye.push([x,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):Ye.push([x,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),rt.push([m,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):Ye.push([x,/^#[^\r\n]*/,null,"#"])),je.cStyleComments&&(rt.push([x,/^\/\/[^\r\n]*/,null]),rt.push([x,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var qe=je.regexLiterals;if(qe){var Ve=qe>1?"":`
\r`,Ke=Ve?".":"[\\S\\s]",ht="/(?=[^/*"+Ve+"])(?:[^/\\x5B\\x5C"+Ve+"]|\\x5C"+Ke+"|\\x5B(?:[^\\x5C\\x5D"+Ve+"]|\\x5C"+Ke+")*(?:\\x5D|$))+/";rt.push(["lang-regex",RegExp("^"+ee+"("+ht+")")])}var ut=je.types;ut&&rt.push([h,ut]);var ft=(""+je.keywords).replace(/^ | $/g,"");ft.length&&rt.push([k,new RegExp("^(?:"+ft.replace(/[\s,]+/g,"|")+")\\b"),null]),Ye.push([o,/^\s+/,null,` \r
\xA0`]);var nt="^.[^\\s\\w.$@'\"`/\\\\]*";return je.regexLiterals&&(nt+="(?!s*/)"),rt.push([p,/^@[a-z_$][a-z_$@0-9]*/i,null],[h,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[o,/^[a-z_$][a-z_$@0-9]*/i,null],[p,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[o,/^\\[\s\S]?/,null],[c,new RegExp(nt),null]),Oe(Ye,rt)}var Me=Ge({keywords:E,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function Ie(je,Ye,rt){for(var st=/(?:^|\s)nocode(?:\s|$)/,qe=/\r\n?|\n/,Ve=je.ownerDocument,Ke=Ve.createElement("li");je.firstChild;)Ke.appendChild(je.firstChild);var ht=[Ke];function ut(Ne){var Ot=Ne.nodeType;if(Ot==1&&!st.test(Ne.className))if(Ne.nodeName==="br")ft(Ne),Ne.parentNode&&Ne.parentNode.removeChild(Ne);else for(var Et=Ne.firstChild;Et;Et=Et.nextSibling)ut(Et);else if((Ot==3||Ot==4)&&rt){var We=Ne.nodeValue,Ze=We.match(qe);if(Ze){var we=We.substring(0,Ze.index);Ne.nodeValue=we;var ye=We.substring(Ze.index+Ze[0].length);if(ye){var Ee=Ne.parentNode;Ee.insertBefore(Ve.createTextNode(ye),Ne.nextSibling)}ft(Ne),we||Ne.parentNode.removeChild(Ne)}}}function ft(Ne){for(;!Ne.nextSibling;)if(Ne=Ne.parentNode,!Ne)return;function Ot(Ze,we){var ye=we?Ze.cloneNode(!1):Ze,Ee=Ze.parentNode;if(Ee){var re=Ot(Ee,1),ie=Ze.nextSibling;re.appendChild(ye);for(var ue=ie;ue;ue=ie)ie=ue.nextSibling,re.appendChild(ue)}return ye}for(var Et=Ot(Ne.nextSibling,0),We;(We=Et.parentNode)&&We.nodeType===1;)Et=We;ht.push(Et)}for(var nt=0;nt<ht.length;++nt)ut(ht[nt]);Ye===(Ye|0)&&ht[0].setAttribute("value",Ye);var Lt=Ve.createElement("ol");Lt.className="linenums";for(var vt=Math.max(0,Ye-1|0)||0,nt=0,bt=ht.length;nt<bt;++nt)Ke=ht[nt],Ke.className="L"+(nt+vt)%10,Ke.firstChild||Ke.appendChild(Ve.createTextNode("\xA0")),Lt.appendChild(Ke);je.appendChild(Lt)}function Ue(je){var Ye=/\bMSIE\s(\d+)/.exec(navigator.userAgent);Ye=Ye&&+Ye[1]<=8;var rt=/\n/g,st=je.sourceCode,qe=st.length,Ve=0,Ke=je.spans,ht=Ke.length,ut=0,ft=je.decorations,nt=ft.length,Lt=0;ft[nt]=qe;var vt,bt;for(bt=vt=0;bt<nt;)ft[bt]!==ft[bt+2]?(ft[vt++]=ft[bt++],ft[vt++]=ft[bt++]):bt+=2;for(nt=vt,bt=vt=0;bt<nt;){for(var Ne=ft[bt],Ot=ft[bt+1],Et=bt+2;Et+2<=nt&&ft[Et+1]===Ot;)Et+=2;ft[vt++]=Ne,ft[vt++]=Ot,bt=Et}nt=ft.length=vt;var We=je.sourceNode,Ze="";We&&(Ze=We.style.display,We.style.display="none");try{for(var we=null;ut<ht;){var ye=Ke[ut],Ee=Ke[ut+2]||qe,re=ft[Lt+2]||qe,Et=Math.min(Ee,re),ie=Ke[ut+1],ue;if(ie.nodeType!==1&&(ue=st.substring(Ve,Et))){Ye&&(ue=ue.replace(rt,"\r")),ie.nodeValue=ue;var ge=ie.ownerDocument,Se=ge.createElement("span");Se.className=ft[Lt+1];var Re=ie.parentNode;Re.replaceChild(Se,ie),Se.appendChild(ie),Ve<Ee&&(Ke[ut+1]=ie=ge.createTextNode(st.substring(Et,Ee)),Re.insertBefore(ie,Se.nextSibling))}Ve=Et,Ve>=Ee&&(ut+=2),Ve>=re&&(Lt+=2)}}finally{We&&(We.style.display=Ze)}}var Pe={};function Te(je,Ye){for(var rt=Ye.length;--rt>=0;){var st=Ye[rt];Pe.hasOwnProperty(st)?W.console&&console.warn("cannot override language handler %s",st):Pe[st]=je}}function se(je,Ye){return je&&Pe.hasOwnProperty(je)||(je=/^\s*</.test(Ye)?"default-markup":"default-code"),Pe[je]}Te(Me,["default-code"]),Te(Oe([],[[o,/^[^<?]+/],[v,/^<!\w[^>]*(?:>|$)/],[x,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[c,/^(?:<[%?]|[%?]>)/],["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"]),Te(Oe([[o,/^[\s]+/,null,` \r
`],[z,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[S,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[N,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[c,/^[=<>\/]+/],["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"]),Te(Oe([],[[z,/^[\s\S]+/]]),["uq.val"]),Te(Ge({keywords:A,hashComments:!0,cStyleComments:!0,types:g}),["c","cc","cpp","cxx","cyc","m"]),Te(Ge({keywords:"null,true,false"}),["json"]),Te(Ge({keywords:O,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:g}),["cs"]),Te(Ge({keywords:_,cStyleComments:!0}),["java"]),Te(Ge({keywords:d,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),Te(Ge({keywords:a,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),Te(Ge({keywords:u,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),Te(Ge({keywords:s,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),Te(Ge({keywords:y,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),Te(Ge({keywords:L,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),Te(Oe([],[[m,/^[\s\S]+/]]),["regex"]);function Fe(je){var Ye=je.langExtension;try{var rt=j(je.sourceNode,je.pre),st=rt.sourceCode;je.sourceCode=st,je.spans=rt.spans,je.basePos=0,se(Ye,st)(je),Ue(je)}catch(qe){W.console&&console.log(qe&&qe.stack||qe)}}function dt(je,Ye,rt){var st=rt||!1,qe=Ye||null,Ve=document.createElement("div");Ve.innerHTML="<pre>"+je+"</pre>",Ve=Ve.firstChild,st&&Ie(Ve,st,!0);var Ke={langExtension:qe,numberLines:st,sourceNode:Ve,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return Fe(Ke),Ve.innerHTML}function it(je,Ye){var rt=Ye||document.body,st=rt.ownerDocument||document;function qe(ye){return rt.getElementsByTagName(ye)}for(var Ve=[qe("pre"),qe("code"),qe("xmp")],Ke=[],ht=0;ht<Ve.length;++ht)for(var ut=0,ft=Ve[ht].length;ut<ft;++ut)Ke.push(Ve[ht][ut]);Ve=null;var nt=Date;nt.now||(nt={now:function(){return+new Date}});var Lt=0,vt=/\blang(?:uage)?-([\w.]+)(?!\S)/,bt=/\bprettyprint\b/,Ne=/\bprettyprinted\b/,Ot=/pre|xmp/i,Et=/^code$/i,We=/^(?:pre|code|xmp)$/i,Ze={};function we(){for(var ye=W.PR_SHOULD_USE_CONTINUATION?nt.now()+250:Infinity;Lt<Ke.length&&nt.now()<ye;Lt++){for(var Ee=Ke[Lt],re=Ze,ie=Ee;ie=ie.previousSibling;){var ue=ie.nodeType,ge=(ue===7||ue===8)&&ie.nodeValue;if(ge?!/^\??prettify\b/.test(ge):ue!==3||/\S/.test(ie.nodeValue))break;if(ge){re={},ge.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Pr,Vt,an){re[Vt]=an});break}}var Se=Ee.className;if((re!==Ze||bt.test(Se))&&!Ne.test(Se)){for(var Re=!1,Xe=Ee.parentNode;Xe;Xe=Xe.parentNode){var xt=Xe.tagName;if(We.test(xt)&&Xe.className&&bt.test(Xe.className)){Re=!0;break}}if(!Re){Ee.className+=" prettyprinted";var Mt=re.lang;if(!Mt){Mt=Se.match(vt);var kt;!Mt&&(kt=be(Ee))&&Et.test(kt.tagName)&&(Mt=kt.className.match(vt)),Mt&&(Mt=Mt[1])}var Gt;if(Ot.test(Ee.tagName))Gt=1;else{var Kt=Ee.currentStyle,Ct=st.defaultView,pr=Kt?Kt.whiteSpace:Ct&&Ct.getComputedStyle?Ct.getComputedStyle(Ee,null).getPropertyValue("white-space"):0;Gt=pr&&pr.substring(0,3)==="pre"}var rr=re.linenums;(rr=rr==="true"||+rr)||(rr=Se.match(/\blinenums\b(?::(\d+))?/),rr=rr?rr[1]&&rr[1].length?+rr[1]:!0:!1),rr&&Ie(Ee,rr,Gt);var Ir={langExtension:Mt,sourceNode:Ee,numberLines:rr,pre:Gt,sourceCode:null,basePos:null,spans:null,decorations:null};Fe(Ir)}}}Lt<Ke.length?W.setTimeout(we,250):typeof je=="function"&&je()}we()}var ot=W.PR={createSimpleLexer:Oe,registerLangHandler:Te,sourceDecorator:Ge,PR_ATTRIB_NAME:N,PR_ATTRIB_VALUE:z,PR_COMMENT:x,PR_DECLARATION:v,PR_KEYWORD:k,PR_LITERAL:p,PR_NOCODE:Y,PR_PLAIN:o,PR_PUNCTUATION:c,PR_SOURCE:T,PR_STRING:m,PR_TAG:S,PR_TYPE:h,prettyPrintOne:D?W.prettyPrintOne=dt:P=dt,prettyPrint:H=D?W.prettyPrint=it:H=it},ct=W.define;typeof ct=="function"&&ct.amd&&ct("google-code-prettify",[],function(){return ot})})()},UUDw:function(Ft,yt,ne){Ft.exports={buttonFixed:"buttonFixed___2zLVJ",button:"button___-JgFH",buttonWrap:"buttonWrap___aZhhk"}},UqFu:function(Ft,yt,ne){"use strict";ne.d(yt,"a",function(){return ae});var ae=function(D){var K=document.createElement("textarea");return K.value=D,K.value}},"VrN/":function(Ft,yt,ne){(function(ae,X){Ft.exports=X()})(this,function(){"use strict";var ae=navigator.userAgent,X=navigator.platform,D=/gecko\/\d/i.test(ae),K=/MSIE \d/.test(ae),w=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ae),P=/Edge\/(\d+)/.exec(ae),H=K||w||P,W=H&&(K?document.documentMode||6:+(P||w)[1]),I=!P&&/WebKit\//.test(ae),M=I&&/Qt\/\d+\.\d+/.test(ae),b=!P&&/Chrome\//.test(ae),A=/Opera\//.test(ae),_=/Apple Computer/.test(navigator.vendor),O=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(ae),L=/PhantomJS/.test(ae),y=!P&&/AppleWebKit/.test(ae)&&/Mobile\/\w+/.test(ae),u=/Android/.test(ae),a=y||u||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(ae),s=y||/Mac/.test(X),d=/\bCrOS\b/.test(ae),E=/win/i.test(X),g=A&&ae.match(/Version\/(\d*\.\d*)/);g&&(g=Number(g[1])),g&&g>=15&&(A=!1,I=!0);var m=s&&(M||A&&(g==null||g<12.11)),k=D||H&&W>=9;function x(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var h=function(e,t){var n=e.className,r=x(t).exec(n);if(r){var i=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(i?r[1]+i:"")}};function p(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function c(e,t){return p(e).appendChild(t)}function o(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),typeof t=="string")i.appendChild(document.createTextNode(t));else if(t)for(var C=0;C<t.length;++C)i.appendChild(t[C]);return i}function S(e,t,n,r){var i=o(e,t,n,r);return i.setAttribute("role","presentation"),i}var v;document.createRange?v=function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}:v=function(e,t,n){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch(i){return r}return r.collapse(!0),r.moveEnd("character",n),r.moveStart("character",t),r};function T(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 N(){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 z(e,t){var n=e.className;x(t).test(n)||(e.className+=(n?" ":"")+t)}function Y(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!x(n[r]).test(t)&&(t+=" "+n[r]);return t}var ee=function(e){e.select()};y?ee=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:H&&(ee=function(e){try{e.select()}catch(t){}});function G(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function j(e,t,n){t||(t={});for(var r in e)e.hasOwnProperty(r)&&(n!==!1||!t.hasOwnProperty(r))&&(t[r]=e[r]);return t}function te(e,t,n,r,i){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var C=r||0,U=i||0;;){var V=e.indexOf(" ",C);if(V<0||V>=t)return U+(t-C);U+=V-C,U+=n-U%n,C=V+1}}var de=function(){this.id=null,this.f=null,this.time=0,this.handler=G(this.onTimeout,this)};de.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},de.prototype.set=function(e,t){this.f=t;var n=+new Date+e;(!this.id||n<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=n)};function be(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}var Oe=50,Ge={toString:function(){return"CodeMirror.Pass"}},Me={scroll:!1},Ie={origin:"*mouse"},Ue={origin:"+move"};function Pe(e,t,n){for(var r=0,i=0;;){var C=e.indexOf(" ",r);C==-1&&(C=e.length);var U=C-r;if(C==e.length||i+U>=t)return r+Math.min(U,t-i);if(i+=C-r,i+=n-i%n,r=C+1,i>=t)return r}}var Te=[""];function se(e){for(;Te.length<=e;)Te.push(Fe(Te)+" ");return Te[e]}function Fe(e){return e[e.length-1]}function dt(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function it(e,t,n){for(var r=0,i=n(t);r<e.length&&n(e[r])<=i;)r++;e.splice(r,0,t)}function ot(){}function ct(e,t){var n;return Object.create?n=Object.create(e):(ot.prototype=e,n=new ot),t&&j(t,n),n}var je=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function Ye(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||je.test(e))}function rt(e,t){return t?t.source.indexOf("\\w")>-1&&Ye(e)?!0:t.test(e):Ye(e)}function st(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var qe=/[\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 Ve(e){return e.charCodeAt(0)>=768&&qe.test(e)}function Ke(e,t,n){for(;(n<0?t>0:t<e.length)&&Ve(e.charAt(t));)t+=n;return t}function ht(e,t,n){for(var r=t>n?-1:1;;){if(t==n)return t;var i=(t+n)/2,C=r<0?Math.ceil(i):Math.floor(i);if(C==t)return e(C)?t:n;e(C)?n=C:t=C+r}}function ut(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var i=!1,C=0;C<e.length;++C){var U=e[C];(U.from<n&&U.to>t||t==n&&U.to==t)&&(r(Math.max(U.from,t),Math.min(U.to,n),U.level==1?"rtl":"ltr",C),i=!0)}i||r(t,n,"ltr")}var ft=null;function nt(e,t,n){var r;ft=null;for(var i=0;i<e.length;++i){var C=e[i];if(C.from<t&&C.to>t)return i;C.to==t&&(C.from!=C.to&&n=="before"?r=i:ft=i),C.from==t&&(C.from!=C.to&&n!="before"?r=i:ft=i)}return r!=null?r:ft}var Lt=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n(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]/,i=/[stwN]/,C=/[LRr]/,U=/[Lb1n]/,V=/[1n]/;function $(J,he,me){this.level=J,this.from=he,this.to=me}return function(J,he){var me=he=="ltr"?"L":"R";if(J.length==0||he=="ltr"&&!r.test(J))return!1;for(var _e=J.length,ke=[],He=0;He<_e;++He)ke.push(n(J.charCodeAt(He)));for(var Qe=0,at=me;Qe<_e;++Qe){var mt=ke[Qe];mt=="m"?ke[Qe]=at:at=mt}for(var St=0,gt=me;St<_e;++St){var Tt=ke[St];Tt=="1"&&gt=="r"?ke[St]="n":C.test(Tt)&&(gt=Tt,Tt=="r"&&(ke[St]="R"))}for(var Ht=1,Ut=ke[0];Ht<_e-1;++Ht){var tr=ke[Ht];tr=="+"&&Ut=="1"&&ke[Ht+1]=="1"?ke[Ht]="1":tr==","&&Ut==ke[Ht+1]&&(Ut=="1"||Ut=="n")&&(ke[Ht]=Ut),Ut=tr}for(var Rr=0;Rr<_e;++Rr){var bn=ke[Rr];if(bn==",")ke[Rr]="N";else if(bn=="%"){var Gr=void 0;for(Gr=Rr+1;Gr<_e&&ke[Gr]=="%";++Gr);for(var $n=Rr&&ke[Rr-1]=="!"||Gr<_e&&ke[Gr]=="1"?"1":"N",Kn=Rr;Kn<Gr;++Kn)ke[Kn]=$n;Rr=Gr-1}}for(var rn=0,zn=me;rn<_e;++rn){var wn=ke[rn];zn=="L"&&wn=="1"?ke[rn]="L":C.test(wn)&&(zn=wn)}for(var pn=0;pn<_e;++pn)if(i.test(ke[pn])){var nn=void 0;for(nn=pn+1;nn<_e&&i.test(ke[nn]);++nn);for(var $r=(pn?ke[pn-1]:me)=="L",Gn=(nn<_e?ke[nn]:me)=="L",Na=$r==Gn?$r?"L":"R":me,aa=pn;aa<nn;++aa)ke[aa]=Na;pn=nn-1}for(var Dn=[],Ri,xn=0;xn<_e;)if(U.test(ke[xn])){var ps=xn;for(++xn;xn<_e&&U.test(ke[xn]);++xn);Dn.push(new $(0,ps,xn))}else{var zi=xn,ga=Dn.length,va=he=="rtl"?1:0;for(++xn;xn<_e&&ke[xn]!="L";++xn);for(var Nn=zi;Nn<xn;)if(V.test(ke[Nn])){zi<Nn&&(Dn.splice(ga,0,new $(1,zi,Nn)),ga+=va);var Ua=Nn;for(++Nn;Nn<xn&&V.test(ke[Nn]);++Nn);Dn.splice(ga,0,new $(2,Ua,Nn)),ga+=va,zi=Nn}else++Nn;zi<xn&&Dn.splice(ga,0,new $(1,zi,xn))}return he=="ltr"&&(Dn[0].level==1&&(Ri=J.match(/^\s+/))&&(Dn[0].from=Ri[0].length,Dn.unshift(new $(0,0,Ri[0].length))),Fe(Dn).level==1&&(Ri=J.match(/\s+$/))&&(Fe(Dn).to-=Ri[0].length,Dn.push(new $(0,_e-Ri[0].length,_e)))),he=="rtl"?Dn.reverse():Dn}}();function vt(e,t){var n=e.order;return n==null&&(n=e.order=Lt(e.text,t)),n}var bt=[],Ne=function(e,t,n){if(e.addEventListener)e.addEventListener(t,n,!1);else if(e.attachEvent)e.attachEvent("on"+t,n);else{var r=e._handlers||(e._handlers={});r[t]=(r[t]||bt).concat(n)}};function Ot(e,t){return e._handlers&&e._handlers[t]||bt}function Et(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n,!1);else if(e.detachEvent)e.detachEvent("on"+t,n);else{var r=e._handlers,i=r&&r[t];if(i){var C=be(i,n);C>-1&&(r[t]=i.slice(0,C).concat(i.slice(C+1)))}}}function We(e,t){var n=Ot(e,t);if(!n.length)return;for(var r=Array.prototype.slice.call(arguments,2),i=0;i<n.length;++i)n[i].apply(null,r)}function Ze(e,t,n){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),We(e,n||t.type,e,t),ue(t)||t.codemirrorIgnore}function we(e){var t=e._handlers&&e._handlers.cursorActivity;if(!t)return;for(var n=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),r=0;r<t.length;++r)be(n,t[r])==-1&&n.push(t[r])}function ye(e,t){return Ot(e,t).length>0}function Ee(e){e.prototype.on=function(t,n){Ne(this,t,n)},e.prototype.off=function(t,n){Et(this,t,n)}}function re(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function ie(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function ue(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function ge(e){re(e),ie(e)}function Se(e){return e.target||e.srcElement}function Re(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),s&&e.ctrlKey&&t==1&&(t=3),t}var Xe=function(){if(H&&W<9)return!1;var e=o("div");return"draggable"in e||"dragDrop"in e}(),xt;function Mt(e){if(xt==null){var t=o("span","\u200B");c(e,o("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(xt=t.offsetWidth<=1&&t.offsetHeight>2&&!(H&&W<8))}var n=xt?o("span","\u200B"):o("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var kt;function Gt(e){if(kt!=null)return kt;var t=c(e,document.createTextNode("A\u062EA")),n=v(t,0,1).getBoundingClientRect(),r=v(t,1,2).getBoundingClientRect();return p(e),!n||n.left==n.right?!1:kt=r.right-n.right<3}var Kt=`
b`.split(/\n/).length!=3?function(e){for(var t=0,n=[],r=e.length;t<=r;){var i=e.indexOf(`
`,t);i==-1&&(i=e.length);var C=e.slice(t,e.charAt(i-1)=="\r"?i-1:i),U=C.indexOf("\r");U!=-1?(n.push(C.slice(0,U)),t+=U+1):(n.push(C),t=i+1)}return n}: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(n){}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},pr=function(){var e=o("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),rr=null;function Ir(e){if(rr!=null)return rr;var t=c(e,o("span","x")),n=t.getBoundingClientRect(),r=v(t,0,1).getBoundingClientRect();return rr=Math.abs(n.left-r.left)>1}var Pr={},Vt={};function an(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Pr[e]=t}function En(e,t){Vt[e]=t}function It(e){if(typeof e=="string"&&Vt.hasOwnProperty(e))e=Vt[e];else if(e&&typeof e.name=="string"&&Vt.hasOwnProperty(e.name)){var t=Vt[e.name];typeof t=="string"&&(t={name:t}),e=ct(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return It("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return It("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function An(e,t){t=It(t);var n=Pr[t.name];if(!n)return An(e,"text/plain");var r=n(e,t);if(on.hasOwnProperty(t.name)){var i=on[t.name];for(var C in i){if(!i.hasOwnProperty(C))continue;r.hasOwnProperty(C)&&(r["_"+C]=r[C]),r[C]=i[C]}}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var U in t.modeProps)r[U]=t.modeProps[U];return r}var on={};function sn(e,t){var n=on.hasOwnProperty(e)?on[e]:on[e]={};j(t,n)}function Un(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var i=t[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n}function ci(e,t){for(var n;e.innerMode&&!(n=e.innerMode(t),!n||n.mode==e);)t=n.state,e=n.mode;return n||{mode:e,state:t}}function Qn(e,t,n){return e.startState?e.startState(t,n):!0}var mr=function(e,t,n){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n};mr.prototype.eol=function(){return this.pos>=this.string.length},mr.prototype.sol=function(){return this.pos==this.lineStart},mr.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},mr.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},mr.prototype.eat=function(e){var t=this.string.charAt(this.pos),n;if(typeof e=="string"?n=t==e:n=t&&(e.test?e.test(t):e(t)),n)return++this.pos,t},mr.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},mr.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},mr.prototype.skipToEnd=function(){this.pos=this.string.length},mr.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},mr.prototype.backUp=function(e){this.pos-=e},mr.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=te(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?te(this.string,this.lineStart,this.tabSize):0)},mr.prototype.indentation=function(){return te(this.string,null,this.tabSize)-(this.lineStart?te(this.string,this.lineStart,this.tabSize):0)},mr.prototype.match=function(e,t,n){if(typeof e=="string"){var r=function(U){return n?U.toLowerCase():U},i=this.string.substr(this.pos,e.length);if(r(i)==r(e))return t!==!1&&(this.pos+=e.length),!0}else{var C=this.string.slice(this.pos).match(e);return C&&C.index>0?null:(C&&t!==!1&&(this.pos+=C[0].length),C)}},mr.prototype.current=function(){return this.string.slice(this.start,this.pos)},mr.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},mr.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},mr.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function wt(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var n=e;!n.lines;)for(var r=0;;++r){var i=n.children[r],C=i.chunkSize();if(t<C){n=i;break}t-=C}return n.lines[t]}function Vn(e,t,n){var r=[],i=t.line;return e.iter(t.line,n.line+1,function(C){var U=C.text;i==n.line&&(U=U.slice(0,n.ch)),i==t.line&&(U=U.slice(t.ch)),r.push(U),++i}),r}function oi(e,t,n){var r=[];return e.iter(t,n,function(i){r.push(i.text)}),r}function mn(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function nr(e){if(e.parent==null)return null;for(var t=e.parent,n=be(t.lines,e),r=t.parent;r;t=r,r=r.parent)for(var i=0;!(r.children[i]==t);++i)n+=r.children[i].chunkSize();return n+t.first}function Bn(e,t){var n=e.first;e:do{for(var r=0;r<e.children.length;++r){var i=e.children[r],C=i.height;if(t<C){e=i;continue e}t-=C,n+=i.chunkSize()}return n}while(!e.lines);for(var U=0;U<e.lines.length;++U){var V=e.lines[U],$=V.height;if(t<$)break;t-=$}return n+U}function Zn(e,t){return t>=e.first&&t<e.first+e.size}function hi(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function Je(e,t,n){if(n===void 0&&(n=null),!(this instanceof Je))return new Je(e,t,n);this.line=e,this.ch=t,this.sticky=n}function jt(e,t){return e.line-t.line||e.ch-t.ch}function si(e,t){return e.sticky==t.sticky&&jt(e,t)==0}function fi(e){return Je(e.line,e.ch)}function Si(e,t){return jt(e,t)<0?t:e}function li(e,t){return jt(e,t)<0?e:t}function F(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function l(e,t){if(t.line<e.first)return Je(e.first,0);var n=e.first+e.size-1;return t.line>n?Je(n,wt(e,n).text.length):f(t,wt(e,t.line).text.length)}function f(e,t){var n=e.ch;return n==null||n>t?Je(e.line,t):n<0?Je(e.line,0):e}function R(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=l(e,t[r]);return n}var Q=function(e,t){this.state=e,this.lookAhead=t},B=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};B.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},B.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}},B.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},B.fromSaved=function(e,t,n){return t instanceof Q?new B(e,Un(e.mode,t.state),n,t.lookAhead):new B(e,Un(e.mode,t),n)},B.prototype.save=function(e){var t=e!==!1?Un(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Q(t,this.maxLookAhead):t};function ve(e,t,n,r){var i=[e.state.modeGen],C={};gn(e,t.text,e.doc.mode,n,function(J,he){return i.push(J,he)},C,r);for(var U=n.state,V=function(J){n.baseTokens=i;var he=e.state.overlays[J],me=1,_e=0;n.state=!0,gn(e,t.text,he.mode,n,function(ke,He){for(var Qe=me;_e<ke;){var at=i[me];at>ke&&i.splice(me,1,ke,i[me+1],at),me+=2,_e=Math.min(ke,at)}if(!He)return;if(he.opaque)i.splice(Qe,me-Qe,ke,"overlay "+He),me=Qe+2;else for(;Qe<me;Qe+=2){var mt=i[Qe+1];i[Qe+1]=(mt?mt+" ":"")+"overlay "+He}},C),n.state=U,n.baseTokens=null,n.baseTokenPos=1},$=0;$<e.state.overlays.length;++$)V($);return{styles:i,classes:C.bgClass||C.textClass?C:null}}function ze(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=lt(e,nr(t)),i=t.text.length>e.options.maxHighlightLength&&Un(e.doc.mode,r.state),C=ve(e,t,r);i&&(r.state=i),t.stateAfter=r.save(!i),t.styles=C.styles,C.classes?t.styleClasses=C.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function lt(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new B(r,!0,t);var C=ln(e,t,n),U=C>r.first&&wt(r,C-1).stateAfter,V=U?B.fromSaved(r,U,C):new B(r,Qn(r.mode),C);return r.iter(C,t,function($){At(e,$.text,V);var J=V.line;$.stateAfter=J==t-1||J%5==0||J>=i.viewFrom&&J<i.viewTo?V.save():null,V.nextLine()}),n&&(r.modeFrontier=V.line),V}function At(e,t,n,r){var i=e.doc.mode,C=new mr(t,e.options.tabSize,n);for(C.start=C.pos=r||0,t==""&&$e(i,n.state);!C.eol();)Rt(i,C,n.state),C.start=C.pos}function $e(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var n=ci(e,t);if(n.mode.blankLine)return n.mode.blankLine(n.state)}function Rt(e,t,n,r){for(var i=0;i<10;i++){r&&(r[0]=ci(e,n).mode);var C=e.token(t,n);if(t.pos>t.start)return C}throw new Error("Mode "+e.name+" failed to advance stream.")}var gr=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function Dr(e,t,n,r){var i=e.doc,C=i.mode,U;t=l(i,t);var V=wt(i,t.line),$=lt(e,t.line,n),J=new mr(V.text,e.options.tabSize,$),he;for(r&&(he=[]);(r||J.pos<t.ch)&&!J.eol();)J.start=J.pos,U=Rt(C,J,$.state),r&&he.push(new gr(J,U,Un(i.mode,$.state)));return r?he:new gr(J,U,$.state)}function Ln(e,t){if(e)for(;;){var n=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!n)break;e=e.slice(0,n.index)+e.slice(n.index+n[0].length);var r=n[1]?"bgClass":"textClass";t[r]==null?t[r]=n[2]:new RegExp("(?:^|\\s)"+n[2]+"(?:$|\\s)").test(t[r])||(t[r]+=" "+n[2])}return e}function gn(e,t,n,r,i,C,U){var V=n.flattenSpans;V==null&&(V=e.options.flattenSpans);var $=0,J=null,he=new mr(t,e.options.tabSize,r),me,_e=e.options.addModeClass&&[null];for(t==""&&Ln($e(n,r.state),C);!he.eol();){if(he.pos>e.options.maxHighlightLength?(V=!1,U&&At(e,t,r,he.pos),he.pos=t.length,me=null):me=Ln(Rt(n,he,r.state,_e),C),_e){var ke=_e[0].name;ke&&(me="m-"+(me?ke+" "+me:ke))}if(!V||J!=me){for(;$<he.start;)$=Math.min(he.start,$+5e3),i($,J);J=me}he.start=he.pos}for(;$<he.pos;){var He=Math.min(he.pos,$+5e3);i(He,J),$=He}}function ln(e,t,n){for(var r,i,C=e.doc,U=n?-1:t-(e.doc.mode.innerMode?1e3:100),V=t;V>U;--V){if(V<=C.first)return C.first;var $=wt(C,V-1),J=$.stateAfter;if(J&&(!n||V+(J instanceof Q?J.lookAhead:0)<=C.modeFrontier))return V;var he=te($.text,null,e.options.tabSize);(i==null||r>he)&&(i=V-1,r=he)}return i}function Jn(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),e.highlightFrontier<t-10)return;for(var n=e.first,r=t-1;r>n;r--){var i=wt(e,r).stateAfter;if(i&&(!(i instanceof Q)||r+i.lookAhead<t)){n=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}var Pi=!1,Qr=!1;function Fn(){Pi=!0}function pi(){Qr=!0}function ui(e,t,n){this.marker=e,this.from=t,this.to=n}function Sn(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function Ii(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n||(n=[])).push(e[r]);return n}function Ci(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function Gi(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var C=e[i],U=C.marker,V=C.from==null||(U.inclusiveLeft?C.from<=t:C.from<t);if(V||C.from==t&&U.type=="bookmark"&&(!n||!C.marker.insertLeft)){var $=C.to==null||(U.inclusiveRight?C.to>=t:C.to>t);(r||(r=[])).push(new ui(U,C.from,$?null:C.to))}}return r}function Vi(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var C=e[i],U=C.marker,V=C.to==null||(U.inclusiveRight?C.to>=t:C.to>t);if(V||C.from==t&&U.type=="bookmark"&&(!n||C.marker.insertLeft)){var $=C.from==null||(U.inclusiveLeft?C.from<=t:C.from<t);(r||(r=[])).push(new ui(U,$?null:C.from-t,C.to==null?null:C.to-t))}}return r}function qn(e,t){if(t.full)return null;var n=Zn(e,t.from.line)&&wt(e,t.from.line).markedSpans,r=Zn(e,t.to.line)&&wt(e,t.to.line).markedSpans;if(!n&&!r)return null;var i=t.from.ch,C=t.to.ch,U=jt(t.from,t.to)==0,V=Gi(n,i,U),$=Vi(r,C,U),J=t.text.length==1,he=Fe(t.text).length+(J?i:0);if(V)for(var me=0;me<V.length;++me){var _e=V[me];if(_e.to==null){var ke=Sn($,_e.marker);ke?J&&(_e.to=ke.to==null?null:ke.to+he):_e.to=i}}if($)for(var He=0;He<$.length;++He){var Qe=$[He];if(Qe.to!=null&&(Qe.to+=he),Qe.from==null){var at=Sn(V,Qe.marker);at||(Qe.from=he,J&&(V||(V=[])).push(Qe))}else Qe.from+=he,J&&(V||(V=[])).push(Qe)}V&&(V=en(V)),$&&$!=V&&($=en($));var mt=[V];if(!J){var St=t.text.length-2,gt;if(St>0&&V)for(var Tt=0;Tt<V.length;++Tt)V[Tt].to==null&&(gt||(gt=[])).push(new ui(V[Tt].marker,null,null));for(var Ht=0;Ht<St;++Ht)mt.push(gt);mt.push($)}return mt}function en(e){for(var t=0;t<e.length;++t){var n=e[t];n.from!=null&&n.from==n.to&&n.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function mi(e,t,n){var r=null;if(e.iter(t.line,n.line+1,function(ke){if(ke.markedSpans)for(var He=0;He<ke.markedSpans.length;++He){var Qe=ke.markedSpans[He].marker;Qe.readOnly&&(!r||be(r,Qe)==-1)&&(r||(r=[])).push(Qe)}}),!r)return null;for(var i=[{from:t,to:n}],C=0;C<r.length;++C)for(var U=r[C],V=U.find(0),$=0;$<i.length;++$){var J=i[$];if(jt(J.to,V.from)<0||jt(J.from,V.to)>0)continue;var he=[$,1],me=jt(J.from,V.from),_e=jt(J.to,V.to);(me<0||!U.inclusiveLeft&&!me)&&he.push({from:J.from,to:V.from}),(_e>0||!U.inclusiveRight&&!_e)&&he.push({from:V.to,to:J.to}),i.splice.apply(i,he),$+=he.length-3}return i}function oa(e){var t=e.markedSpans;if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.detachLine(e);e.markedSpans=null}function Ni(e,t){if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}function Fr(e){return e.inclusiveLeft?-1:0}function vr(e){return e.inclusiveRight?1:0}function Kr(e,t){var n=e.lines.length-t.lines.length;if(n!=0)return n;var r=e.find(),i=t.find(),C=jt(r.from,i.from)||Fr(e)-Fr(t);if(C)return-C;var U=jt(r.to,i.to)||vr(e)-vr(t);return U||t.id-e.id}function qt(e,t){var n=Qr&&e.markedSpans,r;if(n)for(var i=void 0,C=0;C<n.length;++C)i=n[C],i.marker.collapsed&&(t?i.from:i.to)==null&&(!r||Kr(r,i.marker)<0)&&(r=i.marker);return r}function zr(e){return qt(e,!0)}function Sr(e){return qt(e,!1)}function ei(e,t){var n=Qr&&e.markedSpans,r;if(n)for(var i=0;i<n.length;++i){var C=n[i];C.marker.collapsed&&(C.from==null||C.from<t)&&(C.to==null||C.to>t)&&(!r||Kr(r,C.marker)<0)&&(r=C.marker)}return r}function tn(e,t,n,r,i){var C=wt(e,t),U=Qr&&C.markedSpans;if(U)for(var V=0;V<U.length;++V){var $=U[V];if(!$.marker.collapsed)continue;var J=$.marker.find(0),he=jt(J.from,n)||Fr($.marker)-Fr(i),me=jt(J.to,r)||vr($.marker)-vr(i);if(he>=0&&me<=0||he<=0&&me>=0)continue;if(he<=0&&($.marker.inclusiveRight&&i.inclusiveLeft?jt(J.to,n)>=0:jt(J.to,n)>0)||he>=0&&($.marker.inclusiveRight&&i.inclusiveLeft?jt(J.from,r)<=0:jt(J.from,r)<0))return!0}}function vn(e){for(var t;t=zr(e);)e=t.find(-1,!0).line;return e}function Xi(e){for(var t;t=Sr(e);)e=t.find(1,!0).line;return e}function Ti(e){for(var t,n;t=Sr(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function wi(e,t){var n=wt(e,t),r=vn(n);return n==r?t:nr(r)}function jn(e,t){if(t>e.lastLine())return t;var n=wt(e,t),r;if(!Wn(e,n))return t;for(;r=Sr(n);)n=r.find(1,!0).line;return nr(n)+1}function Wn(e,t){var n=Qr&&t.markedSpans;if(n)for(var r=void 0,i=0;i<n.length;++i){if(r=n[i],!r.marker.collapsed)continue;if(r.from==null)return!0;if(r.marker.widgetNode)continue;if(r.from==0&&r.marker.inclusiveLeft&&sa(e,t,r))return!0}}function sa(e,t,n){if(n.to==null){var r=n.marker.find(1,!0);return sa(e,r.line,Sn(r.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var i=void 0,C=0;C<t.markedSpans.length;++C)if(i=t.markedSpans[C],i.marker.collapsed&&!i.marker.widgetNode&&i.from==n.to&&(i.to==null||i.to!=n.from)&&(i.marker.inclusiveLeft||n.marker.inclusiveRight)&&sa(e,t,i))return!0}function Xn(e){e=vn(e);for(var t=0,n=e.parent,r=0;r<n.lines.length;++r){var i=n.lines[r];if(i==e)break;t+=i.height}for(var C=n.parent;C;n=C,C=n.parent)for(var U=0;U<C.children.length;++U){var V=C.children[U];if(V==n)break;t+=V.height}return t}function la(e){if(e.height==0)return 0;for(var t=e.text.length,n,r=e;n=zr(r);){var i=n.find(0,!0);r=i.from.line,t+=i.from.ch-i.to.ch}for(r=e;n=Sr(r);){var C=n.find(0,!0);t-=r.text.length-C.from.ch,r=C.to.line,t+=r.text.length-C.to.ch}return t}function ua(e){var t=e.display,n=e.doc;t.maxLine=wt(n,n.first),t.maxLineLength=la(t.maxLine),t.maxLineChanged=!0,n.iter(function(r){var i=la(r);i>t.maxLineLength&&(t.maxLineLength=i,t.maxLine=r)})}var Ui=function(e,t,n){this.text=e,Ni(this,t),this.height=n?n(this):1};Ui.prototype.lineNo=function(){return nr(this)},Ee(Ui);function Ba(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),oa(e),Ni(e,n);var i=r?r(e):1;i!=e.height&&mn(e,i)}function _t(e){e.parent=null,oa(e)}var zt={},Pt={};function er(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?Pt:zt;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function hr(e,t){var n=S("span",null,null,I?"padding-right: .1px":null),r={pre:S("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var C=i?t.rest[i-1]:t.line,U=void 0;r.pos=0,r.addToken=ur,Gt(e.display.measure)&&(U=vt(C,e.doc.direction))&&(r.addToken=_n(r.addToken,U)),r.map=[];var V=t!=e.display.externalMeasured&&nr(C);gi(C,r,ze(e,C,V)),C.styleClasses&&(C.styleClasses.bgClass&&(r.bgClass=Y(C.styleClasses.bgClass,r.bgClass||"")),C.styleClasses.textClass&&(r.textClass=Y(C.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(Mt(e.display.measure))),i==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(I){var $=r.content.lastChild;(/\bcm-tab\b/.test($.className)||$.querySelector&&$.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return We(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=Y(r.pre.className,r.textClass||"")),r}function Cr(e){var t=o("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function ur(e,t,n,r,i,C,U){if(!t)return;var V=e.splitSpaces?Vr(t,e.trailingSpace):t,$=e.cm.state.specialChars,J=!1,he;if(!$.test(t))e.col+=t.length,he=document.createTextNode(V),e.map.push(e.pos,e.pos+t.length,he),H&&W<9&&(J=!0),e.pos+=t.length;else{he=document.createDocumentFragment();for(var me=0;;){$.lastIndex=me;var _e=$.exec(t),ke=_e?_e.index-me:t.length-me;if(ke){var He=document.createTextNode(V.slice(me,me+ke));H&&W<9?he.appendChild(o("span",[He])):he.appendChild(He),e.map.push(e.pos,e.pos+ke,He),e.col+=ke,e.pos+=ke}if(!_e)break;me+=ke+1;var Qe=void 0;if(_e[0]==" "){var at=e.cm.options.tabSize,mt=at-e.col%at;Qe=he.appendChild(o("span",se(mt),"cm-tab")),Qe.setAttribute("role","presentation"),Qe.setAttribute("cm-text"," "),e.col+=mt}else _e[0]=="\r"||_e[0]==`
`?(Qe=he.appendChild(o("span",_e[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Qe.setAttribute("cm-text",_e[0]),e.col+=1):(Qe=e.cm.options.specialCharPlaceholder(_e[0]),Qe.setAttribute("cm-text",_e[0]),H&&W<9?he.appendChild(o("span",[Qe])):he.appendChild(Qe),e.col+=1);e.map.push(e.pos,e.pos+1,Qe),e.pos++}}if(e.trailingSpace=V.charCodeAt(t.length-1)==32,n||r||i||J||C||U){var St=n||"";r&&(St+=r),i&&(St+=i);var gt=o("span",[he],St,C);if(U)for(var Tt in U)U.hasOwnProperty(Tt)&&Tt!="style"&&Tt!="class"&&gt.setAttribute(Tt,U[Tt]);return e.content.appendChild(gt)}e.content.appendChild(he)}function Vr(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",i=0;i<e.length;i++){var C=e.charAt(i);C==" "&&n&&(i==e.length-1||e.charCodeAt(i+1)==32)&&(C="\xA0"),r+=C,n=C==" "}return r}function _n(e,t){return function(n,r,i,C,U,V,$){i=i?i+" cm-force-border":"cm-force-border";for(var J=n.pos,he=J+r.length;;){for(var me=void 0,_e=0;_e<t.length&&!(me=t[_e],me.to>J&&me.from<=J);_e++);if(me.to>=he)return e(n,r,i,C,U,V,$);e(n,r.slice(0,me.to-J),i,C,null,V,$),C=null,r=r.slice(me.to-J),J=me.to}}}function ir(e,t,n,r){var i=!r&&n.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!r&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",n.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function gi(e,t,n){var r=e.markedSpans,i=e.text,C=0;if(!r){for(var U=1;U<n.length;U+=2)t.addToken(t,i.slice(C,C=n[U]),er(n[U+1],t.cm.options));return}for(var V=i.length,$=0,J=1,he="",me,_e,ke=0,He,Qe,at,mt,St;;){if(ke==$){He=Qe=at=_e="",St=null,mt=null,ke=Infinity;for(var gt=[],Tt=void 0,Ht=0;Ht<r.length;++Ht){var Ut=r[Ht],tr=Ut.marker;if(tr.type=="bookmark"&&Ut.from==$&&tr.widgetNode)gt.push(tr);else if(Ut.from<=$&&(Ut.to==null||Ut.to>$||tr.collapsed&&Ut.to==$&&Ut.from==$)){if(Ut.to!=null&&Ut.to!=$&&ke>Ut.to&&(ke=Ut.to,Qe=""),tr.className&&(He+=" "+tr.className),tr.css&&(_e=(_e?_e+";":"")+tr.css),tr.startStyle&&Ut.from==$&&(at+=" "+tr.startStyle),tr.endStyle&&Ut.to==ke&&(Tt||(Tt=[])).push(tr.endStyle,Ut.to),tr.title&&((St||(St={})).title=tr.title),tr.attributes)for(var Rr in tr.attributes)(St||(St={}))[Rr]=tr.attributes[Rr];tr.collapsed&&(!mt||Kr(mt.marker,tr)<0)&&(mt=Ut)}else Ut.from>$&&ke>Ut.from&&(ke=Ut.from)}if(Tt)for(var bn=0;bn<Tt.length;bn+=2)Tt[bn+1]==ke&&(Qe+=" "+Tt[bn]);if(!mt||mt.from==$)for(var Gr=0;Gr<gt.length;++Gr)ir(t,0,gt[Gr]);if(mt&&(mt.from||0)==$){if(ir(t,(mt.to==null?V+1:mt.to)-$,mt.marker,mt.from==null),mt.to==null)return;mt.to==$&&(mt=!1)}}if($>=V)break;for(var $n=Math.min(V,ke);;){if(he){var Kn=$+he.length;if(!mt){var rn=Kn>$n?he.slice(0,$n-$):he;t.addToken(t,rn,me?me+He:He,at,$+rn.length==ke?Qe:"",_e,St)}if(Kn>=$n){he=he.slice($n-$),$=$n;break}$=Kn,at=""}he=i.slice(C,C=n[J++]),me=er(n[J++],t.cm.options)}}}function br(e,t,n){this.line=t,this.rest=Ti(t),this.size=this.rest?nr(Fe(this.rest))-n+1:1,this.node=this.text=null,this.hidden=Wn(e,t)}function Cn(e,t,n){for(var r=[],i,C=t;C<n;C=i){var U=new br(e.doc,wt(e.doc,C),C);i=C+U.size,r.push(U)}return r}var yn=null;function Yn(e){yn?yn.ops.push(e):e.ownsGroup=yn={ops:[e],delayedCallbacks:[]}}function Fa(e){var t=e.delayedCallbacks,n=0;do{for(;n<t.length;n++)t[n].call(null);for(var r=0;r<e.ops.length;r++){var i=e.ops[r];if(i.cursorActivityHandlers)for(;i.cursorActivityCalled<i.cursorActivityHandlers.length;)i.cursorActivityHandlers[i.cursorActivityCalled++].call(null,i.cm)}}while(n<t.length)}function Ko(e,t){var n=e.ownsGroup;if(!n)return;try{Fa(n)}finally{yn=null,t(n)}}var Yi=null;function Xr(e,t){var n=Ot(e,t);if(!n.length)return;var r=Array.prototype.slice.call(arguments,2),i;yn?i=yn.delayedCallbacks:Yi?i=Yi:(i=Yi=[],setTimeout(go,0));for(var C=function(V){i.push(function(){return n[V].apply(null,r)})},U=0;U<n.length;++U)C(U)}function go(){var e=Yi;Yi=null;for(var t=0;t<e.length;++t)e[t]()}function vo(e,t,n,r){for(var i=0;i<t.changes.length;i++){var C=t.changes[i];C=="text"?yo(e,t):C=="gutter"?Ha(e,t,n,r):C=="class"?Wa(e,t):C=="widget"&&Go(e,t,r)}t.changes=null}function da(e){return e.node==e.text&&(e.node=o("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),H&&W<8&&(e.node.style.zIndex=2)),e.node}function zo(e,t){var n=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(n&&(n+=" CodeMirror-linebackground"),t.background)n?t.background.className=n:(t.background.parentNode.removeChild(t.background),t.background=null);else if(n){var r=da(t);t.background=r.insertBefore(o("div",null,n),r.firstChild),e.display.input.setUneditable(t.background)}}function ja(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):hr(e,t)}function yo(e,t){var n=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,Wa(e,t)):n&&(t.text.className=n)}function Wa(e,t){zo(e,t),t.line.wrapClass?da(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var n=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=n||""}function Ha(e,t,n,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 i=da(t);t.gutterBackground=o("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),i.insertBefore(t.gutterBackground,t.text)}var C=t.line.gutterMarkers;if(e.options.lineNumbers||C){var U=da(t),V=t.gutter=o("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(e.display.input.setUneditable(V),U.insertBefore(V,t.text),t.line.gutterClass&&(V.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!C||!C["CodeMirror-linenumbers"])&&(t.lineNumber=V.appendChild(o("div",hi(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),C)for(var $=0;$<e.display.gutterSpecs.length;++$){var J=e.display.gutterSpecs[$].className,he=C.hasOwnProperty(J)&&C[J];he&&V.appendChild(o("div",[he],"CodeMirror-gutter-elt","left: "+r.gutterLeft[J]+"px; width: "+r.gutterWidth[J]+"px"))}}}function Go(e,t,n){t.alignable&&(t.alignable=null);for(var r=x("CodeMirror-linewidget"),i=t.node.firstChild,C=void 0;i;i=C)C=i.nextSibling,r.test(i.className)&&t.node.removeChild(i);Ka(e,t,n)}function bo(e,t,n,r){var i=ja(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),Wa(e,t),Ha(e,t,n,r),Ka(e,t,r),t.node}function Ka(e,t,n){if(xo(e,t.line,t,n,!0),t.rest)for(var r=0;r<t.rest.length;r++)xo(e,t.rest[r],t,n,!1)}function xo(e,t,n,r,i){if(!t.widgets)return;for(var C=da(n),U=0,V=t.widgets;U<V.length;++U){var $=V[U],J=o("div",[$.node],"CodeMirror-linewidget"+($.className?" "+$.className:""));$.handleMouseEvents||J.setAttribute("cm-ignore-events","true"),Vo($,J,n,r),e.display.input.setUneditable(J),i&&$.above?C.insertBefore(J,n.gutter||n.text):C.appendChild(J),Xr($,"redraw")}}function Vo(e,t,n,r){if(e.noHScroll){(n.alignable||(n.alignable=[])).push(t);var i=r.wrapperWidth;t.style.left=r.fixedPos+"px",e.coverGutter||(i-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px"),t.style.width=i+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}function $i(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!T(document.body,e.node)){var n="position: relative;";e.coverGutter&&(n+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(n+="width: "+t.display.wrapper.clientWidth+"px;"),c(t.display.measure,o("div",[e.node],null,n))}return e.height=e.node.parentNode.offsetHeight}function vi(e,t){for(var n=Se(t);n!=e.wrapper;n=n.parentNode)if(!n||n.nodeType==1&&n.getAttribute("cm-ignore-events")=="true"||n.parentNode==e.sizer&&n!=e.mover)return!0}function za(e){return e.lineSpace.offsetTop}function le(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function xe(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=c(e.measure,o("pre","x","CodeMirror-line-like")),n=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,r={left:parseInt(n.paddingLeft),right:parseInt(n.paddingRight)};return!isNaN(r.left)&&!isNaN(r.right)&&(e.cachedPaddingH=r),r}function Ae(e){return Oe-e.display.nativeBarWidth}function ce(e){return e.display.scroller.clientWidth-Ae(e)-e.display.barWidth}function Z(e){return e.display.scroller.clientHeight-Ae(e)-e.display.barHeight}function oe(e,t,n){var r=e.options.lineWrapping,i=r&&ce(e);if(!t.measure.heights||r&&t.measure.width!=i){var C=t.measure.heights=[];if(r){t.measure.width=i;for(var U=t.text.firstChild.getClientRects(),V=0;V<U.length-1;V++){var $=U[V],J=U[V+1];Math.abs($.bottom-J.bottom)>2&&C.push(($.bottom+J.top)/2-n.top)}}C.push(n.bottom-n.top)}}function q(e,t,n){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 i=0;i<e.rest.length;i++)if(nr(e.rest[i])>n)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function fe(e,t){t=vn(t);var n=nr(t),r=e.display.externalMeasured=new br(e.doc,t,n);r.lineN=n;var i=r.built=hr(e,r);return r.text=i.pre,c(e.display.lineMeasure,i.pre),r}function pe(e,t,n,r){return De(e,Ce(e,t),n,r)}function Le(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[Mr(e,t)];var n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size)return n}function Ce(e,t){var n=nr(t),r=Le(e,n);r&&!r.text?r=null:r&&r.changes&&(vo(e,r,n,jr(e)),e.curOp.forceUpdate=!0),r||(r=fe(e,t));var i=q(r,t,n);return{line:t,view:r,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function De(e,t,n,r,i){t.before&&(n=-1);var C=n+(r||""),U;return t.cache.hasOwnProperty(C)?U=t.cache[C]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(oe(e,t.view,t.rect),t.hasHeights=!0),U=pt(e,t,n,r),U.bogus||(t.cache[C]=U)),{left:U.left,right:U.right,top:i?U.rtop:U.top,bottom:i?U.rbottom:U.bottom}}var Be={left:0,right:0,top:0,bottom:0};function tt(e,t,n){for(var r,i,C,U,V,$,J=0;J<e.length;J+=3)if(V=e[J],$=e[J+1],t<V?(i=0,C=1,U="left"):t<$?(i=t-V,C=i+1):(J==e.length-3||t==$&&e[J+3]>t)&&(C=$-V,i=C-1,t>=$&&(U="right")),i!=null){if(r=e[J+2],V==$&&n==(r.insertLeft?"left":"right")&&(U=n),n=="left"&&i==0)for(;J&&e[J-2]==e[J-3]&&e[J-1].insertLeft;)r=e[(J-=3)+2],U="left";if(n=="right"&&i==$-V)for(;J<e.length-3&&e[J+3]==e[J+4]&&!e[J+5].insertLeft;)r=e[(J+=3)+2],U="right";break}return{node:r,start:i,end:C,collapse:U,coverStart:V,coverEnd:$}}function et(e,t){var n=Be;if(t=="left")for(var r=0;r<e.length&&!((n=e[r]).left!=n.right);r++);else for(var i=e.length-1;i>=0&&!((n=e[i]).left!=n.right);i--);return n}function pt(e,t,n,r){var i=tt(t.map,n,r),C=i.node,U=i.start,V=i.end,$=i.collapse,J;if(C.nodeType==3){for(var he=0;he<4;he++){for(;U&&Ve(t.line.text.charAt(i.coverStart+U));)--U;for(;i.coverStart+V<i.coverEnd&&Ve(t.line.text.charAt(i.coverStart+V));)++V;if(H&&W<9&&U==0&&V==i.coverEnd-i.coverStart?J=C.parentNode.getBoundingClientRect():J=et(v(C,U,V).getClientRects(),r),J.left||J.right||U==0)break;V=U,U=U-1,$="right"}H&&W<11&&(J=Wt(e.display.measure,J))}else{U>0&&($=r="right");var me;e.options.lineWrapping&&(me=C.getClientRects()).length>1?J=me[r=="right"?me.length-1:0]:J=C.getBoundingClientRect()}if(H&&W<9&&!U&&(!J||!J.left&&!J.right)){var _e=C.parentNode.getClientRects()[0];_e?J={left:_e.left,right:_e.left+un(e.display),top:_e.top,bottom:_e.bottom}:J=Be}for(var ke=J.top-t.rect.top,He=J.bottom-t.rect.top,Qe=(ke+He)/2,at=t.view.measure.heights,mt=0;mt<at.length-1&&!(Qe<at[mt]);mt++);var St=mt?at[mt-1]:0,gt=at[mt],Tt={left:($=="right"?J.right:J.left)-t.rect.left,right:($=="left"?J.left:J.right)-t.rect.left,top:St,bottom:gt};return!J.left&&!J.right&&(Tt.bogus=!0),e.options.singleCursorHeightPerLine||(Tt.rtop=ke,Tt.rbottom=He),Tt}function Wt(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!Ir(e))return t;var n=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*n,right:t.right*n,top:t.top*r,bottom:t.bottom*r}}function Zt(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 Xt(e){e.display.externalMeasure=null,p(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)Zt(e.display.view[t])}function Yt(e){Xt(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function Jt(){return b&&u?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function Qt(){return b&&u?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function $t(e){var t=0;if(e.widgets)for(var n=0;n<e.widgets.length;++n)e.widgets[n].above&&(t+=$i(e.widgets[n]));return t}function dr(e,t,n,r,i){if(!i){var C=$t(t);n.top+=C,n.bottom+=C}if(r=="line")return n;r||(r="local");var U=Xn(t);if(r=="local"?U+=za(e.display):U-=e.display.viewOffset,r=="page"||r=="window"){var V=e.display.lineSpace.getBoundingClientRect();U+=V.top+(r=="window"?0:Qt());var $=V.left+(r=="window"?0:Jt());n.left+=$,n.right+=$}return n.top+=U,n.bottom+=U,n}function ar(e,t,n){if(n=="div")return t;var r=t.left,i=t.top;if(n=="page")r-=Jt(),i-=Qt();else if(n=="local"||!n){var C=e.display.sizer.getBoundingClientRect();r+=C.left,i+=C.top}var U=e.display.lineSpace.getBoundingClientRect();return{left:r-U.left,top:i-U.top}}function Nr(e,t,n,r,i){return r||(r=wt(e.doc,t.line)),dr(e,r,pe(e,r,t.ch,i),n)}function or(e,t,n,r,i,C){r=r||wt(e.doc,t.line),i||(i=Ce(e,r));function U(He,Qe){var at=De(e,i,He,Qe?"right":"left",C);return Qe?at.left=at.right:at.right=at.left,dr(e,r,at,n)}var V=vt(r,e.doc.direction),$=t.ch,J=t.sticky;if($>=r.text.length?($=r.text.length,J="before"):$<=0&&($=0,J="after"),!V)return U(J=="before"?$-1:$,J=="before");function he(He,Qe,at){var mt=V[Qe],St=mt.level==1;return U(at?He-1:He,St!=at)}var me=nt(V,$,J),_e=ft,ke=he($,me,J=="before");return _e!=null&&(ke.other=he($,_e,J!="before")),ke}function Bt(e,t){var n=0;t=l(e.doc,t),e.options.lineWrapping||(n=un(e.display)*t.ch);var r=wt(e.doc,t.line),i=Xn(r)+za(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function Nt(e,t,n,r,i){var C=Je(e,t,n);return C.xRel=i,r&&(C.outside=r),C}function sr(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,n<0)return Nt(r.first,0,null,-1,-1);var i=Bn(r,n),C=r.first+r.size-1;if(i>C)return Nt(r.first+r.size-1,wt(r,C).text.length,null,1,1);t<0&&(t=0);for(var U=wt(r,i);;){var V=Ur(e,U,i,t,n),$=ei(U,V.ch+(V.xRel>0||V.outside>0?1:0));if(!$)return V;var J=$.find(1);if(J.line==i)return J;U=wt(r,i=J.line)}}function cr(e,t,n,r){r-=$t(t);var i=t.text.length,C=ht(function(U){return De(e,n,U-1).bottom<=r},i,0);return i=ht(function(U){return De(e,n,U).top>r},C,i),{begin:C,end:i}}function Dt(e,t,n,r){n||(n=Ce(e,t));var i=dr(e,t,De(e,n,r),"line").top;return cr(e,t,n,i)}function fr(e,t,n,r){return e.bottom<=n?!1:e.top>n?!0:(r?e.left:e.right)>t}function Ur(e,t,n,r,i){i-=Xn(t);var C=Ce(e,t),U=$t(t),V=0,$=t.text.length,J=!0,he=vt(t,e.doc.direction);if(he){var me=(e.options.lineWrapping?Lr:yr)(e,t,n,C,he,r,i);J=me.level!=1,V=J?me.from:me.to-1,$=J?me.to:me.from-1}var _e=null,ke=null,He=ht(function(Ht){var Ut=De(e,C,Ht);return Ut.top+=U,Ut.bottom+=U,fr(Ut,r,i,!1)?(Ut.top<=i&&Ut.left<=r&&(_e=Ht,ke=Ut),!0):!1},V,$),Qe,at,mt=!1;if(ke){var St=r-ke.left<ke.right-r,gt=St==J;He=_e+(gt?0:1),at=gt?"after":"before",Qe=St?ke.left:ke.right}else{!J&&(He==$||He==V)&&He++,at=He==0?"after":He==t.text.length?"before":De(e,C,He-(J?1:0)).bottom+U<=i==J?"after":"before";var Tt=or(e,Je(n,He,at),"line",t,C);Qe=Tt.left,mt=i<Tt.top?-1:i>=Tt.bottom?1:0}return He=Ke(t.text,He,1),Nt(n,He,at,mt,r-Qe)}function yr(e,t,n,r,i,C,U){var V=ht(function(me){var _e=i[me],ke=_e.level!=1;return fr(or(e,Je(n,ke?_e.to:_e.from,ke?"before":"after"),"line",t,r),C,U,!0)},0,i.length-1),$=i[V];if(V>0){var J=$.level!=1,he=or(e,Je(n,J?$.from:$.to,J?"after":"before"),"line",t,r);fr(he,C,U,!0)&&he.top>U&&($=i[V-1])}return $}function Lr(e,t,n,r,i,C,U){var V=cr(e,t,r,U),$=V.begin,J=V.end;/\s/.test(t.text.charAt(J-1))&&J--;for(var he=null,me=null,_e=0;_e<i.length;_e++){var ke=i[_e];if(ke.from>=J||ke.to<=$)continue;var He=ke.level!=1,Qe=De(e,r,He?Math.min(J,ke.to)-1:Math.max($,ke.from)).right,at=Qe<C?C-Qe+1e9:Qe-C;(!he||me>at)&&(he=ke,me=at)}return he||(he=i[i.length-1]),he.from<$&&(he={from:$,to:he.to,level:he.level}),he.to>J&&(he={from:he.from,to:J,level:he.level}),he}var wr;function Yr(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(wr==null){wr=o("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)wr.appendChild(document.createTextNode("x")),wr.appendChild(o("br"));wr.appendChild(document.createTextNode("x"))}c(e.measure,wr);var n=wr.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),p(e.measure),n||1}function un(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=o("span","xxxxxxxxxx"),n=o("pre",[t],"CodeMirror-line-like");c(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function jr(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,C=t.gutters.firstChild,U=0;C;C=C.nextSibling,++U){var V=e.display.gutterSpecs[U].className;n[V]=C.offsetLeft+C.clientLeft+i,r[V]=C.clientWidth}return{fixedPos:On(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function On(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function ti(e){var t=Yr(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/un(e.display)-3);return function(i){if(Wn(e.doc,i))return 0;var C=0;if(i.widgets)for(var U=0;U<i.widgets.length;U++)i.widgets[U].height&&(C+=i.widgets[U].height);return n?C+(Math.ceil(i.text.length/r)||1)*t:C+t}}function Mn(e){var t=e.doc,n=ti(e);t.iter(function(r){var i=n(r);i!=r.height&&mn(r,i)})}function dn(e,t,n,r){var i=e.display;if(!n&&Se(t).getAttribute("cm-not-content")=="true")return null;var C,U,V=i.lineSpace.getBoundingClientRect();try{C=t.clientX-V.left,U=t.clientY-V.top}catch(me){return null}var $=sr(e,C,U),J;if(r&&$.xRel>0&&(J=wt(e.doc,$.line).text).length==$.ch){var he=te(J,J.length,e.options.tabSize)-J.length;$=Je($.line,Math.max(0,Math.round((C-xe(e.display).left)/un(e.display))-he))}return $}function Mr(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var n=e.display.view,r=0;r<n.length;r++)if(t-=n[r].size,t<0)return r}function Or(e,t,n,r){t==null&&(t=e.doc.first),n==null&&(n=e.doc.first+e.doc.size),r||(r=0);var i=e.display;if(r&&n<i.viewTo&&(i.updateLineNumbers==null||i.updateLineNumbers>t)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)Qr&&wi(e.doc,t)<i.viewTo&&Br(e);else if(n<=i.viewFrom)Qr&&jn(e.doc,n+r)>i.viewFrom?Br(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)Br(e);else if(t<=i.viewFrom){var C=ri(e,n,n+r,1);C?(i.view=i.view.slice(C.index),i.viewFrom=C.lineN,i.viewTo+=r):Br(e)}else if(n>=i.viewTo){var U=ri(e,t,t,-1);U?(i.view=i.view.slice(0,U.index),i.viewTo=U.lineN):Br(e)}else{var V=ri(e,t,t,-1),$=ri(e,n,n+r,1);V&&$?(i.view=i.view.slice(0,V.index).concat(Cn(e,V.lineN,$.lineN)).concat(i.view.slice($.index)),i.viewTo+=r):Br(e)}var J=i.externalMeasured;J&&(n<J.lineN?J.lineN+=r:t<J.lineN+J.size&&(i.externalMeasured=null))}function Wr(e,t,n){e.curOp.viewChanged=!0;var r=e.display,i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size&&(r.externalMeasured=null),t<r.viewFrom||t>=r.viewTo)return;var C=r.view[Mr(e,t)];if(C.node==null)return;var U=C.changes||(C.changes=[]);be(U,n)==-1&&U.push(n)}function Br(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function ri(e,t,n,r){var i=Mr(e,t),C,U=e.display.view;if(!Qr||n==e.doc.first+e.doc.size)return{index:i,lineN:n};for(var V=e.display.viewFrom,$=0;$<i;$++)V+=U[$].size;if(V!=t){if(r>0){if(i==U.length-1)return null;C=V+U[i].size-t,i++}else C=V-t;t+=C,n+=C}for(;wi(e.doc,n)!=n;){if(i==(r<0?0:U.length-1))return null;n+=r*U[i-(r<0?1:0)].size,i+=r}return{index:i,lineN:n}}function Ai(e,t,n){var r=e.display,i=r.view;i.length==0||t>=r.viewTo||n<=r.viewFrom?(r.view=Cn(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=Cn(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(Mr(e,t))),r.viewFrom=t,r.viewTo<n?r.view=r.view.concat(Cn(e,r.viewTo,n)):r.viewTo>n&&(r.view=r.view.slice(0,Mr(e,n)))),r.viewTo=n}function Li(e){for(var t=e.display.view,n=0,r=0;r<t.length;r++){var i=t[r];!i.hidden&&(!i.node||i.changes)&&++n}return n}function Ar(e){e.display.input.showSelection(e.display.input.prepareSelection())}function di(e,t){t===void 0&&(t=!0);for(var n=e.doc,r={},i=r.cursors=document.createDocumentFragment(),C=r.selection=document.createDocumentFragment(),U=0;U<n.sel.ranges.length;U++){if(!t&&U==n.sel.primIndex)continue;var V=n.sel.ranges[U];if(V.from().line>=e.display.viewTo||V.to().line<e.display.viewFrom)continue;var $=V.empty();($||e.options.showCursorWhenSelecting)&&Oi(e,V.head,i),$||Tr(e,V,C)}return r}function Oi(e,t,n){var r=or(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),i=n.appendChild(o("div","\xA0","CodeMirror-cursor"));if(i.style.left=r.left+"px",i.style.top=r.top+"px",i.style.height=Math.max(0,r.bottom-r.top)*e.options.cursorHeight+"px",r.other){var C=n.appendChild(o("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));C.style.display="",C.style.left=r.other.left+"px",C.style.top=r.other.top+"px",C.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function _r(e,t){return e.top-t.top||e.left-t.left}function Tr(e,t,n){var r=e.display,i=e.doc,C=document.createDocumentFragment(),U=xe(e.display),V=U.left,$=Math.max(r.sizerWidth,ce(e)-r.sizer.offsetLeft)-U.right,J=i.direction=="ltr";function he(gt,Tt,Ht,Ut){Tt<0&&(Tt=0),Tt=Math.round(Tt),Ut=Math.round(Ut),C.appendChild(o("div",null,"CodeMirror-selected","position: absolute; left: "+gt+`px;
top: `+Tt+"px; width: "+(Ht==null?$-gt:Ht)+`px;
height: `+(Ut-Tt)+"px"))}function me(gt,Tt,Ht){var Ut=wt(i,gt),tr=Ut.text.length,Rr,bn;function Gr(rn,zn){return Nr(e,Je(gt,rn),"div",Ut,zn)}function $n(rn,zn,wn){var pn=Dt(e,Ut,null,rn),nn=zn=="ltr"==(wn=="after")?"left":"right",$r=wn=="after"?pn.begin:pn.end-(/\s/.test(Ut.text.charAt(pn.end-1))?2:1);return Gr($r,nn)[nn]}var Kn=vt(Ut,i.direction);return ut(Kn,Tt||0,Ht==null?tr:Ht,function(rn,zn,wn,pn){var nn=wn=="ltr",$r=Gr(rn,nn?"left":"right"),Gn=Gr(zn-1,nn?"right":"left"),Na=Tt==null&&rn==0,aa=Ht==null&&zn==tr,Dn=pn==0,Ri=!Kn||pn==Kn.length-1;if(Gn.top-$r.top<=3){var xn=(J?Na:aa)&&Dn,ps=(J?aa:Na)&&Ri,zi=xn?V:(nn?$r:Gn).left,ga=ps?$:(nn?Gn:$r).right;he(zi,$r.top,ga-zi,$r.bottom)}else{var va,Nn,Ua,ms;nn?(va=J&&Na&&Dn?V:$r.left,Nn=J?$:$n(rn,wn,"before"),Ua=J?V:$n(zn,wn,"after"),ms=J&&aa&&Ri?$:Gn.right):(va=J?$n(rn,wn,"before"):V,Nn=!J&&Na&&Dn?$:$r.right,Ua=!J&&aa&&Ri?V:Gn.left,ms=J?$n(zn,wn,"after"):$),he(va,$r.top,Nn-va,$r.bottom),$r.bottom<Gn.top&&he(V,$r.bottom,null,Gn.top),he(Ua,Gn.top,ms-Ua,Gn.bottom)}(!Rr||_r($r,Rr)<0)&&(Rr=$r),_r(Gn,Rr)<0&&(Rr=Gn),(!bn||_r($r,bn)<0)&&(bn=$r),_r(Gn,bn)<0&&(bn=Gn)}),{start:Rr,end:bn}}var _e=t.from(),ke=t.to();if(_e.line==ke.line)me(_e.line,_e.ch,ke.ch);else{var He=wt(i,_e.line),Qe=wt(i,ke.line),at=vn(He)==vn(Qe),mt=me(_e.line,_e.ch,at?He.text.length+1:null).end,St=me(ke.line,at?0:null,ke.ch).start;at&&(mt.top<St.top-2?(he(mt.right,mt.top,null,mt.bottom),he(V,St.top,St.left,St.bottom)):he(mt.right,mt.top,St.left-mt.right,mt.bottom)),mt.bottom<St.top&&he(V,mt.bottom,null,St.top)}n.appendChild(C)}function cn(e){if(!e.state.focused)return;var t=e.display;clearInterval(t.blinker);var n=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){e.hasFocus()||Qi(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function Eo(e){e.state.focused||(e.display.input.focus(),ki(e))}function Ga(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Qi(e))},100)}function ki(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(We(e,"focus",e,t),e.state.focused=!0,z(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),I&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),cn(e)}function Qi(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(We(e,"blur",e,t),e.state.focused=!1,h(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function ya(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var i=t.view[r],C=e.options.lineWrapping,U=void 0,V=0;if(i.hidden)continue;if(H&&W<8){var $=i.node.offsetTop+i.node.offsetHeight;U=$-n,n=$}else{var J=i.node.getBoundingClientRect();U=J.bottom-J.top,!C&&i.text.firstChild&&(V=i.text.firstChild.getBoundingClientRect().right-J.left-1)}var he=i.line.height-U;if((he>.005||he<-.005)&&(mn(i.line,U),Va(i.line),i.rest))for(var me=0;me<i.rest.length;me++)Va(i.rest[me]);if(V>e.display.sizerWidth){var _e=Math.ceil(V/un(e.display));_e>e.display.maxLineLength&&(e.display.maxLineLength=_e,e.display.maxLine=i.line,e.display.maxLineChanged=!0)}}}function Va(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var n=e.widgets[t],r=n.node.parentNode;r&&(n.height=r.offsetHeight)}}function ba(e,t,n){var r=n&&n.top!=null?Math.max(0,n.top):e.scroller.scrollTop;r=Math.floor(r-za(e));var i=n&&n.bottom!=null?n.bottom:r+e.wrapper.clientHeight,C=Bn(t,r),U=Bn(t,i);if(n&&n.ensure){var V=n.ensure.from.line,$=n.ensure.to.line;V<C?(C=V,U=Bn(t,Xn(wt(t,V))+e.wrapper.clientHeight)):Math.min($,t.lastLine())>=U&&(C=Bn(t,Xn(wt(t,$))-e.wrapper.clientHeight),U=$)}return{from:C,to:Math.max(U,C+1)}}function Xo(e,t){if(Ze(e,"scrollCursorIntoView"))return;var n=e.display,r=n.sizer.getBoundingClientRect(),i=null;if(t.top+r.top<0?i=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),i!=null&&!L){var C=o("div","\u200B",null,`position: absolute;
top: `+(t.top-n.viewOffset-za(e.display))+`px;
height: `+(t.bottom-t.top+Ae(e)+n.barHeight)+`px;
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(C),C.scrollIntoView(i),e.display.lineSpace.removeChild(C)}}function Yo(e,t,n,r){r==null&&(r=0);var i;!e.options.lineWrapping&&t==n&&(t=t.ch?Je(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,n=t.sticky=="before"?Je(t.line,t.ch+1,"before"):t);for(var C=0;C<5;C++){var U=!1,V=or(e,t),$=!n||n==t?V:or(e,n);i={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=Xa(e,i),he=e.doc.scrollTop,me=e.doc.scrollLeft;if(J.scrollTop!=null&&(qi(e,J.scrollTop),Math.abs(e.doc.scrollTop-he)>1&&(U=!0)),J.scrollLeft!=null&&(ni(e,J.scrollLeft),Math.abs(e.doc.scrollLeft-me)>1&&(U=!0)),!U)break}return i}function So(e,t){var n=Xa(e,t);n.scrollTop!=null&&qi(e,n.scrollTop),n.scrollLeft!=null&&ni(e,n.scrollLeft)}function Xa(e,t){var n=e.display,r=Yr(e.display);t.top<0&&(t.top=0);var i=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop,C=Z(e),U={};t.bottom-t.top>C&&(t.bottom=t.top+C);var V=e.doc.height+le(n),$=t.top<r,J=t.bottom>V-r;if(t.top<i)U.scrollTop=$?0:t.top;else if(t.bottom>i+C){var he=Math.min(t.top,(J?V:t.bottom)-C);he!=i&&(U.scrollTop=he)}var me=e.options.fixedGutter?0:n.gutters.offsetWidth,_e=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-me,ke=ce(e)-n.gutters.offsetWidth,He=t.right-t.left>ke;return He&&(t.right=t.left+ke),t.left<10?U.scrollLeft=0:t.left<_e?U.scrollLeft=Math.max(0,t.left+me-(He?0:10)):t.right>ke+_e-3&&(U.scrollLeft=t.right+(He?0:10)-ke),U}function Ya(e,t){if(t==null)return;xa(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function Zi(e){xa(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function Ji(e,t,n){(t!=null||n!=null)&&xa(e),t!=null&&(e.curOp.scrollLeft=t),n!=null&&(e.curOp.scrollTop=n)}function $o(e,t){xa(e),e.curOp.scrollToPos=t}function xa(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=Bt(e,t.from),r=Bt(e,t.to);ca(e,n,r,t.margin)}}function ca(e,t,n,r){var i=Xa(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-r,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+r});Ji(e,i.scrollLeft,i.scrollTop)}function qi(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;D||pa(e,{top:t}),ea(e,t,!0),D&&pa(e),fa(e,100)}function ea(e,t,n){if(t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),e.display.scroller.scrollTop==t&&!n)return;e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t)}function ni(e,t,n,r){if(t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r)return;e.doc.scrollLeft=t,lr(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function Bi(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+le(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:r,scrollHeight:r+Ae(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var Di=function(e,t,n){this.cm=n;var r=this.vert=o("div",[o("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=o("div",[o("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=i.tabIndex=-1,e(r),e(i),Ne(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),Ne(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,H&&W<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Di.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var i=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var C=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+C)+"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:n?r:0,bottom:t?r:0}},Di.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Di.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Di.prototype.zeroWidthHack=function(){var e=s&&!O?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new de,this.disableVert=new de},Di.prototype.enableZeroWidthBar=function(e,t,n){e.style.pointerEvents="auto";function r(){var i=e.getBoundingClientRect(),C=n=="vert"?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1);C!=e?e.style.pointerEvents="none":t.set(1e3,r)}t.set(1e3,r)},Di.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var ha=function(){};ha.prototype.update=function(){return{bottom:0,right:0}},ha.prototype.setScrollLeft=function(){},ha.prototype.setScrollTop=function(){},ha.prototype.clear=function(){};function Fi(e,t){t||(t=Bi(e));var n=e.display.barWidth,r=e.display.barHeight;Ea(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&ya(e),Ea(e,Bi(e)),n=e.display.barWidth,r=e.display.barHeight}function Ea(e,t){var n=e.display,r=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",n.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}var $a={native:Di,null:ha};function Sa(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&h(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new $a[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Ne(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,n){n=="horizontal"?ni(e,t):qi(e,t)},e),e.display.scrollbars.addClass&&z(e.display.wrapper,e.display.scrollbars.addClass)}var Qa=0;function _i(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:++Qa},Yn(e.curOp)}function ji(e){var t=e.curOp;t&&Ko(t,function(n){for(var r=0;r<n.ops.length;r++)n.ops[r].cm.curOp=null;Co(n)})}function Co(e){for(var t=e.ops,n=0;n<t.length;n++)Qo(t[n]);for(var r=0;r<t.length;r++)Zo(t[r]);for(var i=0;i<t.length;i++)Jo(t[i]);for(var C=0;C<t.length;C++)Za(t[C]);for(var U=0;U<t.length;U++)qo(t[U])}function Qo(e){var t=e.cm,n=t.display;To(t),e.updateMaxLine&&ua(t),e.mustUpdate=e.viewChanged||e.forceUpdate||e.scrollTop!=null||e.scrollToPos&&(e.scrollToPos.from.line<n.viewFrom||e.scrollToPos.to.line>=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new ii(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Zo(e){e.updatedDisplay=e.mustUpdate&&Wi(e.cm,e.update)}function Jo(e){var t=e.cm,n=t.display;e.updatedDisplay&&ya(t),e.barMeasure=Bi(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=pe(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+Ae(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-ce(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function Za(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 n=e.focus&&e.focus==N();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,n),(e.updatedDisplay||e.startHeight!=t.doc.height)&&Fi(t,e.barMeasure),e.updatedDisplay&&Er(t,e.barMeasure),e.selectionChanged&&cn(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),n&&Eo(e.cm)}function qo(e){var t=e.cm,n=t.display,r=t.doc;if(e.updatedDisplay&&Ca(t,e.update),n.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(n.wheelStartX=n.wheelStartY=null),e.scrollTop!=null&&ea(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&ni(t,e.scrollLeft,!0,!0),e.scrollToPos){var i=Yo(t,l(r,e.scrollToPos.from),l(r,e.scrollToPos.to),e.scrollToPos.margin);Xo(t,i)}var C=e.maybeHiddenMarkers,U=e.maybeUnhiddenMarkers;if(C)for(var V=0;V<C.length;++V)C[V].lines.length||We(C[V],"hide");if(U)for(var $=0;$<U.length;++$)U[$].lines.length&&We(U[$],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&We(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Rn(e,t){if(e.curOp)return t();_i(e);try{return t()}finally{ji(e)}}function Zr(e,t){return function(){if(e.curOp)return t.apply(e,arguments);_i(e);try{return t.apply(e,arguments)}finally{ji(e)}}}function Tn(e){return function(){if(this.curOp)return e.apply(this,arguments);_i(this);try{return e.apply(this,arguments)}finally{ji(this)}}}function Jr(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);_i(t);try{return e.apply(this,arguments)}finally{ji(t)}}}function fa(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,G(es,e))}function es(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var n=+new Date+e.options.workTime,r=lt(e,t.highlightFrontier),i=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(C){if(r.line>=e.display.viewFrom){var U=C.styles,V=C.text.length>e.options.maxHighlightLength?Un(t.mode,r.state):null,$=ve(e,C,r,!0);V&&(r.state=V),C.styles=$.styles;var J=C.styleClasses,he=$.classes;he?C.styleClasses=he:J&&(C.styleClasses=null);for(var me=!U||U.length!=C.styles.length||J!=he&&(!J||!he||J.bgClass!=he.bgClass||J.textClass!=he.textClass),_e=0;!me&&_e<U.length;++_e)me=U[_e]!=C.styles[_e];me&&i.push(r.line),C.stateAfter=r.save(),r.nextLine()}else C.text.length<=e.options.maxHighlightLength&&At(e,C.text,r),C.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>n)return fa(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),i.length&&Rn(e,function(){for(var C=0;C<i.length;C++)Wr(e,i[C],"text")})}var ii=function(e,t,n){var r=e.display;this.viewport=t,this.visible=ba(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=ce(e),this.force=n,this.dims=jr(e),this.events=[]};ii.prototype.signal=function(e,t){ye(e,t)&&this.events.push(arguments)},ii.prototype.finish=function(){for(var e=0;e<this.events.length;e++)We.apply(null,this.events[e])};function To(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=Ae(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Ae(e)+"px",t.scrollbarsClipped=!0)}function wo(e){if(e.hasFocus())return null;var t=N();if(!t||!T(e.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&T(e.display.lineDiv,r.anchorNode)&&(n.anchorNode=r.anchorNode,n.anchorOffset=r.anchorOffset,n.focusNode=r.focusNode,n.focusOffset=r.focusOffset)}return n}function Ao(e){if(!e||!e.activeElt||e.activeElt==N())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&T(document.body,e.anchorNode)&&T(document.body,e.focusNode)){var t=window.getSelection(),n=document.createRange();n.setEnd(e.anchorNode,e.anchorOffset),n.collapse(!1),t.removeAllRanges(),t.addRange(n),t.extend(e.focusNode,e.focusOffset)}}function Wi(e,t){var n=e.display,r=e.doc;if(t.editorIsHidden)return Br(e),!1;if(!t.force&&t.visible.from>=n.viewFrom&&t.visible.to<=n.viewTo&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&Li(e)==0)return!1;hn(e)&&(Br(e),t.dims=jr(e));var i=r.first+r.size,C=Math.max(t.visible.from-e.options.viewportMargin,r.first),U=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFrom<C&&C-n.viewFrom<20&&(C=Math.max(r.first,n.viewFrom)),n.viewTo>U&&n.viewTo-U<20&&(U=Math.min(i,n.viewTo)),Qr&&(C=wi(e.doc,C),U=jn(e.doc,U));var V=C!=n.viewFrom||U!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Ai(e,C,U),n.viewOffset=Xn(wt(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var $=Li(e);if(!V&&$==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;var J=wo(e);return $>4&&(n.lineDiv.style.display="none"),Lo(e,n.updateLineNumbers,t.dims),$>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,Ao(J),p(n.cursorDiv),p(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,V&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,fa(e,400)),n.updateLineNumbers=null,!0}function Ca(e,t){for(var n=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==ce(e)){if(n&&n.top!=null&&(n={top:Math.min(e.doc.height+le(e.display)-Z(e),n.top)}),t.visible=ba(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=ba(e.display,e.doc,n));if(!Wi(e,t))break;ya(e);var i=Bi(e);Ar(e),Fi(e,i),Er(e,i),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 pa(e,t){var n=new ii(e,t);if(Wi(e,n)){ya(e),Ca(e,n);var r=Bi(e);Ar(e),Fi(e,r),Er(e,r),n.finish()}}function Lo(e,t,n){var r=e.display,i=e.options.lineNumbers,C=r.lineDiv,U=C.firstChild;function V(He){var Qe=He.nextSibling;return I&&s&&e.display.currentWheelTarget==He?He.style.display="none":He.parentNode.removeChild(He),Qe}for(var $=r.view,J=r.viewFrom,he=0;he<$.length;he++){var me=$[he];if(!me.hidden)if(!me.node||me.node.parentNode!=C){var _e=bo(e,me,J,n);C.insertBefore(_e,U)}else{for(;U!=me.node;)U=V(U);var ke=i&&t!=null&&t<=J&&me.lineNumber;me.changes&&(be(me.changes,"gutter")>-1&&(ke=!1),vo(e,me,J,n)),ke&&(p(me.lineNumber),me.lineNumber.appendChild(document.createTextNode(hi(e.options,J)))),U=me.node.nextSibling}J+=me.size}for(;U;)U=V(U)}function Ta(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Er(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+Ae(e)+"px"}function lr(e){var t=e.display,n=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var r=On(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,C=r+"px",U=0;U<n.length;U++)if(!n[U].hidden){e.options.fixedGutter&&(n[U].gutter&&(n[U].gutter.style.left=C),n[U].gutterBackground&&(n[U].gutterBackground.style.left=C));var V=n[U].alignable;if(V)for(var $=0;$<V.length;$++)V[$].style.left=C}e.options.fixedGutter&&(t.gutters.style.left=r+i+"px")}function hn(e){if(!e.options.lineNumbers)return!1;var t=e.doc,n=hi(e.options,t.first+t.size-1),r=e.display;if(n.length!=r.lineNumChars){var i=r.measure.appendChild(o("div",[o("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),C=i.firstChild.offsetWidth,U=i.offsetWidth-C;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(C,r.lineGutter.offsetWidth-U)+1,r.lineNumWidth=r.lineNumInnerWidth+U,r.lineNumChars=r.lineNumInnerWidth?n.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",Ta(e.display),!0}return!1}function Pn(e,t){for(var n=[],r=!1,i=0;i<e.length;i++){var C=e[i],U=null;if(typeof C!="string"&&(U=C.style,C=C.className),C=="CodeMirror-linenumbers")if(t)r=!0;else continue;n.push({className:C,style:U})}return t&&!r&&n.push({className:"CodeMirror-linenumbers",style:null}),n}function ta(e){var t=e.gutters,n=e.gutterSpecs;p(t),e.lineGutter=null;for(var r=0;r<n.length;++r){var i=n[r],C=i.className,U=i.style,V=t.appendChild(o("div",null,"CodeMirror-gutter "+C));U&&(V.style.cssText=U),C=="CodeMirror-linenumbers"&&(e.lineGutter=V,V.style.width=(e.lineNumWidth||1)+"px")}t.style.display=n.length?"":"none",Ta(e)}function yi(e){ta(e.display),Or(e),lr(e)}function ma(e,t,n,r){var i=this;this.input=n,i.scrollbarFiller=o("div",null,"CodeMirror-scrollbar-filler"),i.scrollbarFiller.setAttribute("cm-not-content","true"),i.gutterFiller=o("div",null,"CodeMirror-gutter-filler"),i.gutterFiller.setAttribute("cm-not-content","true"),i.lineDiv=S("div",null,"CodeMirror-code"),i.selectionDiv=o("div",null,null,"position: relative; z-index: 1"),i.cursorDiv=o("div",null,"CodeMirror-cursors"),i.measure=o("div",null,"CodeMirror-measure"),i.lineMeasure=o("div",null,"CodeMirror-measure"),i.lineSpace=S("div",[i.measure,i.lineMeasure,i.selectionDiv,i.cursorDiv,i.lineDiv],null,"position: relative; outline: none");var C=S("div",[i.lineSpace],"CodeMirror-lines");i.mover=o("div",[C],null,"position: relative"),i.sizer=o("div",[i.mover],"CodeMirror-sizer"),i.sizerWidth=null,i.heightForcer=o("div",null,null,"position: absolute; height: "+Oe+"px; width: 1px;"),i.gutters=o("div",null,"CodeMirror-gutters"),i.lineGutter=null,i.scroller=o("div",[i.sizer,i.heightForcer,i.gutters],"CodeMirror-scroll"),i.scroller.setAttribute("tabIndex","-1"),i.wrapper=o("div",[i.scrollbarFiller,i.gutterFiller,i.scroller],"CodeMirror"),H&&W<8&&(i.gutters.style.zIndex=-1,i.scroller.style.paddingRight=0),!I&&!(D&&a)&&(i.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(i.wrapper):e(i.wrapper)),i.viewFrom=i.viewTo=t.first,i.reportedViewFrom=i.reportedViewTo=t.first,i.view=[],i.renderedView=null,i.externalMeasured=null,i.viewOffset=0,i.lastWrapHeight=i.lastWrapWidth=0,i.updateLineNumbers=null,i.nativeBarWidth=i.barHeight=i.barWidth=0,i.scrollbarsClipped=!1,i.lineNumWidth=i.lineNumInnerWidth=i.lineNumChars=null,i.alignWidgets=!1,i.cachedCharWidth=i.cachedTextHeight=i.cachedPaddingH=null,i.maxLine=null,i.maxLineLength=0,i.maxLineChanged=!1,i.wheelDX=i.wheelDY=i.wheelStartX=i.wheelStartY=null,i.shift=!1,i.selForContextMenu=null,i.activeTouch=null,i.gutterSpecs=Pn(r.gutters,r.lineNumbers),ta(i),n.init(i)}var Mi=0,fn=null;H?fn=-.53:D?fn=15:b?fn=-.7:_&&(fn=-1/3);function wa(e){var t=e.wheelDeltaX,n=e.wheelDeltaY;return t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),n==null&&e.detail&&e.axis==e.VERTICAL_AXIS?n=e.detail:n==null&&(n=e.wheelDelta),{x:t,y:n}}function Ja(e){var t=wa(e);return t.x*=fn,t.y*=fn,t}function qa(e,t){var n=wa(t),r=n.x,i=n.y,C=e.display,U=C.scroller,V=U.scrollWidth>U.clientWidth,$=U.scrollHeight>U.clientHeight;if(!(r&&V||i&&$))return;if(i&&s&&I){e:for(var J=t.target,he=C.view;J!=U;J=J.parentNode)for(var me=0;me<he.length;me++)if(he[me].node==J){e.display.currentWheelTarget=J;break e}}if(r&&!D&&!A&&fn!=null){i&&$&&qi(e,Math.max(0,U.scrollTop+i*fn)),ni(e,Math.max(0,U.scrollLeft+r*fn)),(!i||i&&$)&&re(t),C.wheelStartX=null;return}if(i&&fn!=null){var _e=i*fn,ke=e.doc.scrollTop,He=ke+C.wrapper.clientHeight;_e<0?ke=Math.max(0,ke+_e-50):He=Math.min(e.doc.height,He+_e+50),pa(e,{top:ke,bottom:He})}Mi<20&&(C.wheelStartX==null?(C.wheelStartX=U.scrollLeft,C.wheelStartY=U.scrollTop,C.wheelDX=r,C.wheelDY=i,setTimeout(function(){if(C.wheelStartX==null)return;var Qe=U.scrollLeft-C.wheelStartX,at=U.scrollTop-C.wheelStartY,mt=at&&C.wheelDY&&at/C.wheelDY||Qe&&C.wheelDX&&Qe/C.wheelDX;if(C.wheelStartX=C.wheelStartY=null,!mt)return;fn=(fn*Mi+mt)/(Mi+1),++Mi},200)):(C.wheelDX+=r,C.wheelDY+=i))}var In=function(e,t){this.ranges=e,this.primIndex=t};In.prototype.primary=function(){return this.ranges[this.primIndex]},In.prototype.equals=function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var n=this.ranges[t],r=e.ranges[t];if(!si(n.anchor,r.anchor)||!si(n.head,r.head))return!1}return!0},In.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new xr(fi(this.ranges[t].anchor),fi(this.ranges[t].head));return new In(e,this.primIndex)},In.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},In.prototype.contains=function(e,t){t||(t=e);for(var n=0;n<this.ranges.length;n++){var r=this.ranges[n];if(jt(t,r.from())>=0&&jt(e,r.to())<=0)return n}return-1};var xr=function(e,t){this.anchor=e,this.head=t};xr.prototype.from=function(){return li(this.anchor,this.head)},xr.prototype.to=function(){return Si(this.anchor,this.head)},xr.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function ai(e,t,n){var r=e&&e.options.selectionsMayTouch,i=t[n];t.sort(function(_e,ke){return jt(_e.from(),ke.from())}),n=be(t,i);for(var C=1;C<t.length;C++){var U=t[C],V=t[C-1],$=jt(V.to(),U.from());if(r&&!U.empty()?$>0:$>=0){var J=li(V.from(),U.from()),he=Si(V.to(),U.to()),me=V.empty()?U.from()==U.head:V.from()==V.head;C<=n&&--n,t.splice(--C,2,new xr(me?he:J,me?J:he))}}return new In(t,n)}function bi(e,t){return new In([new xr(e,t||e)],0)}function xi(e){return e.text?Je(e.from.line+e.text.length-1,Fe(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function eo(e,t){if(jt(e,t.from)<0)return e;if(jt(e,t.to)<=0)return xi(t);var n=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=xi(t).ch-t.to.ch),Je(n,r)}function Aa(e,t){for(var n=[],r=0;r<e.sel.ranges.length;r++){var i=e.sel.ranges[r];n.push(new xr(eo(i.anchor,t),eo(i.head,t)))}return ai(e.cm,n,e.sel.primIndex)}function Oo(e,t,n){return e.line==t.line?Je(n.line,e.ch-t.ch+n.ch):Je(n.line+(e.line-t.line),e.ch)}function ko(e,t,n){for(var r=[],i=Je(e.first,0),C=i,U=0;U<t.length;U++){var V=t[U],$=Oo(V.from,i,C),J=Oo(xi(V),i,C);if(i=V.to,C=J,n=="around"){var he=e.sel.ranges[U],me=jt(he.head,he.anchor)<0;r[U]=new xr(me?J:$,me?$:J)}else r[U]=new xr($,$)}return new In(r,e.sel.primIndex)}function Hi(e){e.doc.mode=An(e.options,e.doc.modeOption),to(e)}function to(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,fa(e,100),e.state.modeGen++,e.curOp&&Or(e)}function gs(e,t){return t.from.ch==0&&t.to.ch==0&&Fe(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function ts(e,t,n,r){function i(St){return n?n[St]:null}function C(St,gt,Tt){Ba(St,gt,Tt,r),Xr(St,"change",St,t)}function U(St,gt){for(var Tt=[],Ht=St;Ht<gt;++Ht)Tt.push(new Ui(J[Ht],i(Ht),r));return Tt}var V=t.from,$=t.to,J=t.text,he=wt(e,V.line),me=wt(e,$.line),_e=Fe(J),ke=i(J.length-1),He=$.line-V.line;if(t.full)e.insert(0,U(0,J.length)),e.remove(J.length,e.size-J.length);else if(gs(e,t)){var Qe=U(0,J.length-1);C(me,me.text,ke),He&&e.remove(V.line,He),Qe.length&&e.insert(V.line,Qe)}else if(he==me)if(J.length==1)C(he,he.text.slice(0,V.ch)+_e+he.text.slice($.ch),ke);else{var at=U(1,J.length-1);at.push(new Ui(_e+he.text.slice($.ch),ke,r)),C(he,he.text.slice(0,V.ch)+J[0],i(0)),e.insert(V.line+1,at)}else if(J.length==1)C(he,he.text.slice(0,V.ch)+J[0]+me.text.slice($.ch),i(0)),e.remove(V.line+1,He);else{C(he,he.text.slice(0,V.ch)+J[0],i(0)),C(me,_e+me.text.slice($.ch),ke);var mt=U(1,J.length-1);He>1&&e.remove(V.line+1,He-1),e.insert(V.line+1,mt)}Xr(e,"change",e,t)}function ra(e,t,n){function r(i,C,U){if(i.linked)for(var V=0;V<i.linked.length;++V){var $=i.linked[V];if($.doc==C)continue;var J=U&&$.sharedHist;if(n&&!J)continue;t($.doc,J),r($.doc,i,J)}}r(e,null,!0)}function vs(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,Mn(e),Hi(e),ys(e),e.options.lineWrapping||ua(e),e.options.mode=t.modeOption,Or(e)}function ys(e){(e.doc.direction=="rtl"?z:h)(e.display.lineDiv,"CodeMirror-rtl")}function fl(e){Rn(e,function(){ys(e),Or(e)})}function Do(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 rs(e,t){var n={from:fi(t.from),to:xi(t),text:Vn(e,t.from,t.to)};return Es(e,n,t.from.line,t.to.line+1),ra(e,function(r){return Es(r,n,t.from.line,t.to.line+1)},!0),n}function bs(e){for(;e.length;){var t=Fe(e);if(t.ranges)e.pop();else break}}function pl(e,t){if(t)return bs(e.done),Fe(e.done);if(e.done.length&&!Fe(e.done).ranges)return Fe(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),Fe(e.done)}function xs(e,t,n,r){var i=e.history;i.undone.length=0;var C=+new Date,U,V;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&i.lastModTime>C-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(U=pl(i,i.lastOp==r)))V=Fe(U.changes),jt(t.from,t.to)==0&&jt(t.from,V.to)==0?V.to=xi(t):U.changes.push(rs(e,t));else{var $=Fe(i.done);for((!$||!$.ranges)&&_o(e.sel,i.done),U={changes:[rs(e,t)],generation:i.generation},i.done.push(U);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(n),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=C,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,V||We(e,"historyAdded")}function ml(e,t,n,r){var i=t.charAt(0);return i=="*"||i=="+"&&n.ranges.length==r.ranges.length&&n.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function gl(e,t,n,r){var i=e.history,C=r&&r.origin;n==i.lastSelOp||C&&i.lastSelOrigin==C&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==C||ml(e,C,Fe(i.done),t))?i.done[i.done.length-1]=t:_o(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=C,i.lastSelOp=n,r&&r.clearRedo!==!1&&bs(i.undone)}function _o(e,t){var n=Fe(t);n&&n.ranges&&n.equals(e)||t.push(e)}function Es(e,t,n,r){var i=t["spans_"+e.id],C=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(U){U.markedSpans&&((i||(i=t["spans_"+e.id]={}))[C]=U.markedSpans),++C})}function vl(e){if(!e)return null;for(var t,n=0;n<e.length;++n)e[n].marker.explicitlyCleared?t||(t=e.slice(0,n)):t&&t.push(e[n]);return t?t.length?t:null:e}function yl(e,t){var n=t["spans_"+e.id];if(!n)return null;for(var r=[],i=0;i<t.text.length;++i)r.push(vl(n[i]));return r}function Ss(e,t){var n=yl(e,t),r=qn(e,t);if(!n)return r;if(!r)return n;for(var i=0;i<n.length;++i){var C=n[i],U=r[i];if(C&&U){e:for(var V=0;V<U.length;++V){for(var $=U[V],J=0;J<C.length;++J)if(C[J].marker==$.marker)continue e;C.push($)}}else U&&(n[i]=U)}return n}function La(e,t,n){for(var r=[],i=0;i<e.length;++i){var C=e[i];if(C.ranges){r.push(n?In.prototype.deepCopy.call(C):C);continue}var U=C.changes,V=[];r.push({changes:V});for(var $=0;$<U.length;++$){var J=U[$],he=void 0;if(V.push({from:J.from,to:J.to,text:J.text}),t)for(var me in J)(he=me.match(/^spans_(\d+)$/))&&(be(t,Number(he[1]))>-1&&(Fe(V)[me]=J[me],delete J[me]))}}return r}function ns(e,t,n,r){if(r){var i=e.anchor;if(n){var C=jt(t,i)<0;C!=jt(n,i)<0?(i=t,t=n):C!=jt(t,n)<0&&(t=n)}return new xr(i,t)}else return new xr(n||t,t)}function Mo(e,t,n,r,i){i==null&&(i=e.cm&&(e.cm.display.shift||e.extend)),kn(e,new In([ns(e.sel.primary(),t,n,i)],0),r)}function Cs(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),C=0;C<e.sel.ranges.length;C++)r[C]=ns(e.sel.ranges[C],t[C],null,i);var U=ai(e.cm,r,e.sel.primIndex);kn(e,U,n)}function is(e,t,n,r){var i=e.sel.ranges.slice(0);i[t]=n,kn(e,ai(e.cm,i,e.sel.primIndex),r)}function Ts(e,t,n,r){kn(e,bi(t,n),r)}function bl(e,t,n){var r={ranges:t.ranges,update:function(i){this.ranges=[];for(var C=0;C<i.length;C++)this.ranges[C]=new xr(l(e,i[C].anchor),l(e,i[C].head))},origin:n&&n.origin};return We(e,"beforeSelectionChange",e,r),e.cm&&We(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?ai(e.cm,r.ranges,r.ranges.length-1):t}function ws(e,t,n){var r=e.history.done,i=Fe(r);i&&i.ranges?(r[r.length-1]=t,Ro(e,t,n)):kn(e,t,n)}function kn(e,t,n){Ro(e,t,n),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function Ro(e,t,n){(ye(e,"beforeSelectionChange")||e.cm&&ye(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,n));var r=n&&n.bias||(jt(t.primary().head,e.sel.primary().head)<0?-1:1);As(e,Os(e,t,r,!0)),!(n&&n.scroll===!1)&&e.cm&&Zi(e.cm)}function As(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,we(e.cm)),Xr(e,"cursorActivity",e)}function Ls(e){As(e,Os(e,e.sel,null,!1))}function Os(e,t,n,r){for(var i,C=0;C<t.ranges.length;C++){var U=t.ranges[C],V=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[C],$=Po(e,U.anchor,V&&V.anchor,n,r),J=Po(e,U.head,V&&V.head,n,r);(i||$!=U.anchor||J!=U.head)&&(i||(i=t.ranges.slice(0,C)),i[C]=new xr($,J))}return i?ai(e.cm,i,t.primIndex):t}function Oa(e,t,n,r,i){var C=wt(e,t.line);if(C.markedSpans)for(var U=0;U<C.markedSpans.length;++U){var V=C.markedSpans[U],$=V.marker,J="selectLeft"in $?!$.selectLeft:$.inclusiveLeft,he="selectRight"in $?!$.selectRight:$.inclusiveRight;if((V.from==null||(J?V.from<=t.ch:V.from<t.ch))&&(V.to==null||(he?V.to>=t.ch:V.to>t.ch))){if(i&&(We($,"beforeCursorEnter"),$.explicitlyCleared))if(C.markedSpans){--U;continue}else break;if(!$.atomic)continue;if(n){var me=$.find(r<0?1:-1),_e=void 0;if((r<0?he:J)&&(me=ks(e,me,-r,me&&me.line==t.line?C:null)),me&&me.line==t.line&&(_e=jt(me,n))&&(r<0?_e<0:_e>0))return Oa(e,me,t,r,i)}var ke=$.find(r<0?-1:1);return(r<0?J:he)&&(ke=ks(e,ke,r,ke.line==t.line?C:null)),ke?Oa(e,ke,t,r,i):null}}return t}function Po(e,t,n,r,i){var C=r||1,U=Oa(e,t,n,C,i)||!i&&Oa(e,t,n,C,!0)||Oa(e,t,n,-C,i)||!i&&Oa(e,t,n,-C,!0);return U||(e.cantEdit=!0,Je(e.first,0))}function ks(e,t,n,r){return n<0&&t.ch==0?t.line>e.first?l(e,Je(t.line-1)):null:n>0&&t.ch==(r||wt(e,t.line)).text.length?t.line<e.first+e.size-1?Je(t.line+1,0):null:new Je(t.line,t.ch+n)}function Ds(e){e.setSelection(Je(e.firstLine(),0),Je(e.lastLine()),Me)}function _s(e,t,n){var r={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return r.canceled=!0}};return n&&(r.update=function(i,C,U,V){i&&(r.from=l(e,i)),C&&(r.to=l(e,C)),U&&(r.text=U),V!==void 0&&(r.origin=V)}),We(e,"beforeChange",e,r),e.cm&&We(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 ka(e,t,n){if(e.cm){if(!e.cm.curOp)return Zr(e.cm,ka)(e,t,n);if(e.cm.state.suppressEdits)return}if((ye(e,"beforeChange")||e.cm&&ye(e.cm,"beforeChange"))&&(t=_s(e,t,!0),!t))return;var r=Pi&&!n&&mi(e,t.from,t.to);if(r)for(var i=r.length-1;i>=0;--i)Ms(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else Ms(e,t)}function Ms(e,t){if(t.text.length==1&&t.text[0]==""&&jt(t.from,t.to)==0)return;var n=Aa(e,t);xs(e,t,n,e.cm?e.cm.curOp.id:NaN),ro(e,t,n,qn(e,t));var r=[];ra(e,function(i,C){!C&&be(r,i.history)==-1&&(Ns(i.history,t),r.push(i.history)),ro(i,t,null,qn(i,t))})}function Io(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(r&&!n)return;for(var i=e.history,C,U=e.sel,V=t=="undo"?i.done:i.undone,$=t=="undo"?i.undone:i.done,J=0;J<V.length&&!(C=V[J],n?C.ranges&&!C.equals(e.sel):!C.ranges);J++);if(J==V.length)return;for(i.lastOrigin=i.lastSelOrigin=null;;)if(C=V.pop(),C.ranges){if(_o(C,$),n&&!C.equals(e.sel)){kn(e,C,{clearRedo:!1});return}U=C}else if(r){V.push(C);return}else break;var he=[];_o(U,$),$.push({changes:he,generation:i.generation}),i.generation=C.generation||++i.maxGeneration;for(var me=ye(e,"beforeChange")||e.cm&&ye(e.cm,"beforeChange"),_e=function(Qe){var at=C.changes[Qe];if(at.origin=t,me&&!_s(e,at,!1))return V.length=0,{};he.push(rs(e,at));var mt=Qe?Aa(e,at):Fe(V);ro(e,at,mt,Ss(e,at)),!Qe&&e.cm&&e.cm.scrollIntoView({from:at.from,to:xi(at)});var St=[];ra(e,function(gt,Tt){!Tt&&be(St,gt.history)==-1&&(Ns(gt.history,at),St.push(gt.history)),ro(gt,at,null,Ss(gt,at))})},ke=C.changes.length-1;ke>=0;--ke){var He=_e(ke);if(He)return He.v}}function Rs(e,t){if(t==0)return;if(e.first+=t,e.sel=new In(dt(e.sel.ranges,function(i){return new xr(Je(i.anchor.line+t,i.anchor.ch),Je(i.head.line+t,i.head.ch))}),e.sel.primIndex),e.cm){Or(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;r<n.viewTo;r++)Wr(e.cm,r,"gutter")}}function ro(e,t,n,r){if(e.cm&&!e.cm.curOp)return Zr(e.cm,ro)(e,t,n,r);if(t.to.line<e.first){Rs(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 i=t.text.length-1-(e.first-t.from.line);Rs(e,i),t={from:Je(e.first,0),to:Je(t.to.line+i,t.to.ch),text:[Fe(t.text)],origin:t.origin}}var C=e.lastLine();t.to.line>C&&(t={from:t.from,to:Je(C,wt(e,C).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Vn(e,t.from,t.to),n||(n=Aa(e,t)),e.cm?xl(e.cm,t,r):ts(e,t,r),Ro(e,n,Me),e.cantEdit&&Po(e,Je(e.firstLine(),0))&&(e.cantEdit=!1)}function xl(e,t,n){var r=e.doc,i=e.display,C=t.from,U=t.to,V=!1,$=C.line;e.options.lineWrapping||($=nr(vn(wt(r,C.line))),r.iter($,U.line+1,function(ke){if(ke==i.maxLine)return V=!0,!0})),r.sel.contains(t.from,t.to)>-1&&we(e),ts(r,t,n,ti(e)),e.options.lineWrapping||(r.iter($,C.line+t.text.length,function(ke){var He=la(ke);He>i.maxLineLength&&(i.maxLine=ke,i.maxLineLength=He,i.maxLineChanged=!0,V=!1)}),V&&(e.curOp.updateMaxLine=!0)),Jn(r,C.line),fa(e,400);var J=t.text.length-(U.line-C.line)-1;t.full?Or(e):C.line==U.line&&t.text.length==1&&!gs(e.doc,t)?Wr(e,C.line,"text"):Or(e,C.line,U.line+1,J);var he=ye(e,"changes"),me=ye(e,"change");if(me||he){var _e={from:C,to:U,text:t.text,removed:t.removed,origin:t.origin};me&&Xr(e,"change",e,_e),he&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(_e)}e.display.selForContextMenu=null}function Da(e,t,n,r,i){var C;r||(r=n),jt(r,n)<0&&(C=[r,n],n=C[0],r=C[1]),typeof t=="string"&&(t=e.splitLines(t)),ka(e,{from:n,to:r,text:t,origin:i})}function Ps(e,t,n,r){n<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function Is(e,t,n,r){for(var i=0;i<e.length;++i){var C=e[i],U=!0;if(C.ranges){C.copied||(C=e[i]=C.deepCopy(),C.copied=!0);for(var V=0;V<C.ranges.length;V++)Ps(C.ranges[V].anchor,t,n,r),Ps(C.ranges[V].head,t,n,r);continue}for(var $=0;$<C.changes.length;++$){var J=C.changes[$];if(n<J.from.line)J.from=Je(J.from.line+r,J.from.ch),J.to=Je(J.to.line+r,J.to.ch);else if(t<=J.to.line){U=!1;break}}U||(e.splice(0,i+1),i=0)}}function Ns(e,t){var n=t.from.line,r=t.to.line,i=t.text.length-(r-n)-1;Is(e.done,n,r,i),Is(e.undone,n,r,i)}function no(e,t,n,r){var i=t,C=t;return typeof t=="number"?C=wt(e,F(e,t)):i=nr(t),i==null?null:(r(C,i)&&e.cm&&Wr(e.cm,i,n),C)}function io(e){this.lines=e,this.parent=null;for(var t=0,n=0;n<e.length;++n)e[n].parent=this,t+=e[n].height;this.height=t}io.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var n=e,r=e+t;n<r;++n){var i=this.lines[n];this.height-=i.height,_t(i),Xr(i,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,n){this.height+=n,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var r=0;r<t.length;++r)t[r].parent=this},iterN:function(e,t,n){for(var r=e+t;e<r;++e)if(n(this.lines[e]))return!0}};function ao(e){this.children=e;for(var t=0,n=0,r=0;r<e.length;++r){var i=e[r];t+=i.chunkSize(),n+=i.height,i.parent=this}this.size=t,this.height=n,this.parent=null}ao.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var n=0;n<this.children.length;++n){var r=this.children[n],i=r.chunkSize();if(e<i){var C=Math.min(t,i-e),U=r.height;if(r.removeInner(e,C),this.height-=U-r.height,i==C&&(this.children.splice(n--,1),r.parent=null),(t-=C)==0)break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof io))){var V=[];this.collapse(V),this.children=[new io(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,n){this.size+=t.length,this.height+=n;for(var r=0;r<this.children.length;++r){var i=this.children[r],C=i.chunkSize();if(e<=C){if(i.insertInner(e,t,n),i.lines&&i.lines.length>50){for(var U=i.lines.length%25+25,V=U;V<i.lines.length;){var $=new io(i.lines.slice(V,V+=25));i.height-=$.height,this.children.splice(++r,0,$),$.parent=this}i.lines=i.lines.slice(0,U),this.maybeSpill()}break}e-=C}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),n=new ao(t);if(e.parent){e.size-=n.size,e.height-=n.height;var i=be(e.parent.children,e);e.parent.children.splice(i+1,0,n)}else{var r=new ao(e.children);r.parent=e,e.children=[r,n],e=r}n.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iterN:function(e,t,n){for(var r=0;r<this.children.length;++r){var i=this.children[r],C=i.chunkSize();if(e<C){var U=Math.min(t,C-e);if(i.iterN(e,U,n))return!0;if((t-=U)==0)break;e=0}else e-=C}}};var oo=function(e,t,n){if(n)for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r]);this.doc=e,this.node=t};oo.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,n=this.line,r=nr(n);if(r==null||!t)return;for(var i=0;i<t.length;++i)t[i]==this&&t.splice(i--,1);t.length||(n.widgets=null);var C=$i(this);mn(n,Math.max(0,n.height-C)),e&&(Rn(e,function(){Us(e,n,-C),Wr(e,r,"widget")}),Xr(e,"lineWidgetCleared",e,this,r))},oo.prototype.changed=function(){var e=this,t=this.height,n=this.doc.cm,r=this.line;this.height=null;var i=$i(this)-t;if(!i)return;Wn(this.doc,r)||mn(r,r.height+i),n&&Rn(n,function(){n.curOp.forceUpdate=!0,Us(n,r,i),Xr(n,"lineWidgetChanged",n,e,nr(r))})},Ee(oo);function Us(e,t,n){Xn(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Ya(e,n)}function El(e,t,n,r){var i=new oo(e,n,r),C=e.cm;return C&&i.noHScroll&&(C.display.alignWidgets=!0),no(e,t,"widget",function(U){var V=U.widgets||(U.widgets=[]);if(i.insertAt==null?V.push(i):V.splice(Math.min(V.length-1,Math.max(0,i.insertAt)),0,i),i.line=U,C&&!Wn(e,U)){var $=Xn(U)<e.scrollTop;mn(U,U.height+$i(i)),$&&Ya(C,i.height),C.curOp.forceUpdate=!0}return!0}),C&&Xr(C,"lineWidgetAdded",C,i,typeof t=="number"?t:nr(t)),i}var Bs=0,na=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++Bs};na.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&_i(e),ye(this,"clear")){var n=this.find();n&&Xr(this,"clear",n.from,n.to)}for(var r=null,i=null,C=0;C<this.lines.length;++C){var U=this.lines[C],V=Sn(U.markedSpans,this);e&&!this.collapsed?Wr(e,nr(U),"text"):e&&(V.to!=null&&(i=nr(U)),V.from!=null&&(r=nr(U))),U.markedSpans=Ii(U.markedSpans,V),V.from==null&&this.collapsed&&!Wn(this.doc,U)&&e&&mn(U,Yr(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var $=0;$<this.lines.length;++$){var J=vn(this.lines[$]),he=la(J);he>e.display.maxLineLength&&(e.display.maxLine=J,e.display.maxLineLength=he,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&Or(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Ls(e.doc)),e&&Xr(e,"markerCleared",e,this,r,i),t&&ji(e),this.parent&&this.parent.clear()},na.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var n,r,i=0;i<this.lines.length;++i){var C=this.lines[i],U=Sn(C.markedSpans,this);if(U.from!=null&&(n=Je(t?C:nr(C),U.from),e==-1))return n;if(U.to!=null&&(r=Je(t?C:nr(C),U.to),e==1))return r}return n&&{from:n,to:r}},na.prototype.changed=function(){var e=this,t=this.find(-1,!0),n=this,r=this.doc.cm;if(!t||!r)return;Rn(r,function(){var i=t.line,C=nr(t.line),U=Le(r,C);if(U&&(Zt(U),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!Wn(n.doc,i)&&n.height!=null){var V=n.height;n.height=null;var $=$i(n)-V;$&&mn(i,i.height+$)}Xr(r,"markerChanged",r,e)})},na.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||be(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},na.prototype.detachLine=function(e){if(this.lines.splice(be(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},Ee(na);function _a(e,t,n,r,i){if(r&&r.shared)return Sl(e,t,n,r,i);if(e.cm&&!e.cm.curOp)return Zr(e.cm,_a)(e,t,n,r,i);var C=new na(e,i),U=jt(t,n);if(r&&j(r,C,!1),U>0||U==0&&C.clearWhenEmpty!==!1)return C;if(C.replacedWith&&(C.collapsed=!0,C.widgetNode=S("span",[C.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||C.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(C.widgetNode.insertLeft=!0)),C.collapsed){if(tn(e,t.line,t,n,C)||t.line!=n.line&&tn(e,n.line,t,n,C))throw new Error("Inserting collapsed marker partially overlapping an existing one");pi()}C.addToHistory&&xs(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var V=t.line,$=e.cm,J;if(e.iter(V,n.line+1,function(me){$&&C.collapsed&&!$.options.lineWrapping&&vn(me)==$.display.maxLine&&(J=!0),C.collapsed&&V!=t.line&&mn(me,0),Ci(me,new ui(C,V==t.line?t.ch:null,V==n.line?n.ch:null)),++V}),C.collapsed&&e.iter(t.line,n.line+1,function(me){Wn(e,me)&&mn(me,0)}),C.clearOnEnter&&Ne(C,"beforeCursorEnter",function(){return C.clear()}),C.readOnly&&(Fn(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),C.collapsed&&(C.id=++Bs,C.atomic=!0),$){if(J&&($.curOp.updateMaxLine=!0),C.collapsed)Or($,t.line,n.line+1);else if(C.className||C.startStyle||C.endStyle||C.css||C.attributes||C.title)for(var he=t.line;he<=n.line;he++)Wr($,he,"text");C.atomic&&Ls($.doc),Xr($,"markerAdded",$,C)}return C}var so=function(e,t){this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=this};so.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();Xr(this,"clear")},so.prototype.find=function(e,t){return this.primary.find(e,t)},Ee(so);function Sl(e,t,n,r,i){r=j(r),r.shared=!1;var C=[_a(e,t,n,r,i)],U=C[0],V=r.widgetNode;return ra(e,function($){V&&(r.widgetNode=V.cloneNode(!0)),C.push(_a($,l($,t),l($,n),r,i));for(var J=0;J<$.linked.length;++J)if($.linked[J].isParent)return;U=Fe(C)}),new so(C,U)}function Fs(e){return e.findMarks(Je(e.first,0),e.clipPos(Je(e.lastLine())),function(t){return t.parent})}function Cl(e,t){for(var n=0;n<t.length;n++){var r=t[n],i=r.find(),C=e.clipPos(i.from),U=e.clipPos(i.to);if(jt(C,U)){var V=_a(e,C,U,r.primary,r.primary.type);r.markers.push(V),V.parent=r}}}function Tl(e){for(var t=function(r){var i=e[r],C=[i.primary.doc];ra(i.primary.doc,function($){return C.push($)});for(var U=0;U<i.markers.length;U++){var V=i.markers[U];be(C,V.doc)==-1&&(V.parent=null,i.markers.splice(U--,1))}},n=0;n<e.length;n++)t(n)}var wl=0,Hn=function(e,t,n,r,i){if(!(this instanceof Hn))return new Hn(e,t,n,r,i);n==null&&(n=0),ao.call(this,[new io([new Ui("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n;var C=Je(n,0);this.sel=bi(C),this.history=new Do(null),this.id=++wl,this.modeOption=t,this.lineSep=r,this.direction=i=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),ts(this,{from:C,to:C,text:e}),kn(this,bi(C),Me)};Hn.prototype=ct(ao.prototype,{constructor:Hn,iter:function(e,t,n){n?this.iterN(e-this.first,t-e,n):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var n=0,r=0;r<t.length;++r)n+=t[r].height;this.insertInner(e-this.first,t,n)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=oi(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:Jr(function(e){var t=Je(this.first,0),n=this.first+this.size-1;ka(this,{from:t,to:Je(n,wt(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&Ji(this.cm,0,0),kn(this,bi(t),Me)}),replaceRange:function(e,t,n,r){t=l(this,t),n=n?l(this,n):t,Da(this,e,t,n,r)},getRange:function(e,t,n){var r=Vn(this,l(this,e),l(this,t));return n===!1?r:r.join(n||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(Zn(this,e))return wt(this,e)},getLineNumber:function(e){return nr(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=wt(this,e)),vn(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return l(this,e)},getCursor:function(e){var t=this.sel.primary(),n;return e==null||e=="head"?n=t.head:e=="anchor"?n=t.anchor:e=="end"||e=="to"||e===!1?n=t.to():n=t.from(),n},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:Jr(function(e,t,n){Ts(this,l(this,typeof e=="number"?Je(e,t||0):e),null,n)}),setSelection:Jr(function(e,t,n){Ts(this,l(this,e),l(this,t||e),n)}),extendSelection:Jr(function(e,t,n){Mo(this,l(this,e),t&&l(this,t),n)}),extendSelections:Jr(function(e,t){Cs(this,R(this,e),t)}),extendSelectionsBy:Jr(function(e,t){var n=dt(this.sel.ranges,e);Cs(this,R(this,n),t)}),setSelections:Jr(function(e,t,n){if(!e.length)return;for(var r=[],i=0;i<e.length;i++)r[i]=new xr(l(this,e[i].anchor),l(this,e[i].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),kn(this,ai(this.cm,r,t),n)}),addSelection:Jr(function(e,t,n){var r=this.sel.ranges.slice(0);r.push(new xr(l(this,e),l(this,t||e))),kn(this,ai(this.cm,r,r.length-1),n)}),getSelection:function(e){for(var t=this.sel.ranges,n,r=0;r<t.length;r++){var i=Vn(this,t[r].from(),t[r].to());n=n?n.concat(i):i}return e===!1?n:n.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],n=this.sel.ranges,r=0;r<n.length;r++){var i=Vn(this,n[r].from(),n[r].to());e!==!1&&(i=i.join(e||this.lineSeparator())),t[r]=i}return t},replaceSelection:function(e,t,n){for(var r=[],i=0;i<this.sel.ranges.length;i++)r[i]=e;this.replaceSelections(r,t,n||"+input")},replaceSelections:Jr(function(e,t,n){for(var r=[],i=this.sel,C=0;C<i.ranges.length;C++){var U=i.ranges[C];r[C]={from:U.from(),to:U.to(),text:this.splitLines(e[C]),origin:n}}for(var V=t&&t!="end"&&ko(this,r,t),$=r.length-1;$>=0;$--)ka(this,r[$]);V?ws(this,V):this.cm&&Zi(this.cm)}),undo:Jr(function(){Io(this,"undo")}),redo:Jr(function(){Io(this,"redo")}),undoSelection:Jr(function(){Io(this,"undo",!0)}),redoSelection:Jr(function(){Io(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,n=0,r=0;r<e.done.length;r++)e.done[r].ranges||++t;for(var i=0;i<e.undone.length;i++)e.undone[i].ranges||++n;return{undo:t,redo:n}},clearHistory:function(){var e=this;this.history=new Do(this.history.maxGeneration),ra(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:La(this.history.done),undone:La(this.history.undone)}},setHistory:function(e){var t=this.history=new Do(this.history.maxGeneration);t.done=La(e.done.slice(0),null,!0),t.undone=La(e.undone.slice(0),null,!0)},setGutterMarker:Jr(function(e,t,n){return no(this,e,"gutter",function(r){var i=r.gutterMarkers||(r.gutterMarkers={});return i[t]=n,!n&&st(i)&&(r.gutterMarkers=null),!0})}),clearGutter:Jr(function(e){var t=this;this.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&no(t,n,"gutter",function(){return n.gutterMarkers[e]=null,st(n.gutterMarkers)&&(n.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!Zn(this,e))return null;if(t=e,e=wt(this,e),!e)return null}else if(t=nr(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:Jr(function(e,t,n){return no(this,e,t=="gutter"?"gutter":"class",function(r){var i=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!r[i])r[i]=n;else{if(x(n).test(r[i]))return!1;r[i]+=" "+n}return!0})}),removeLineClass:Jr(function(e,t,n){return no(this,e,t=="gutter"?"gutter":"class",function(r){var i=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",C=r[i];if(C)if(n==null)r[i]=null;else{var U=C.match(x(n));if(!U)return!1;var V=U.index+U[0].length;r[i]=C.slice(0,U.index)+(!U.index||V==C.length?"":" ")+C.slice(V)||null}else return!1;return!0})}),addLineWidget:Jr(function(e,t,n){return El(this,e,t,n)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return _a(this,l(this,e),l(this,t),n,n&&n.type||"range")},setBookmark:function(e,t){var n={replacedWith:t&&(t.nodeType==null?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return e=l(this,e),_a(this,e,e,n,"bookmark")},findMarksAt:function(e){e=l(this,e);var t=[],n=wt(this,e.line).markedSpans;if(n)for(var r=0;r<n.length;++r){var i=n[r];(i.from==null||i.from<=e.ch)&&(i.to==null||i.to>=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,n){e=l(this,e),t=l(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,function(C){var U=C.markedSpans;if(U)for(var V=0;V<U.length;V++){var $=U[V];!($.to!=null&&i==e.line&&e.ch>=$.to||$.from==null&&i!=e.line||$.from!=null&&i==t.line&&$.from>=t.ch)&&(!n||n($.marker))&&r.push($.marker.parent||$.marker)}++i}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var n=t.markedSpans;if(n)for(var r=0;r<n.length;++r)n[r].from!=null&&e.push(n[r].marker)}),e},posFromIndex:function(e){var t,n=this.first,r=this.lineSeparator().length;return this.iter(function(i){var C=i.text.length+r;if(C>e)return t=e,!0;e-=C,++n}),l(this,Je(n,t))},indexFromPos:function(e){e=l(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var n=this.lineSeparator().length;return this.iter(this.first,e.line,function(r){t+=r.text.length+n}),t},copy:function(e){var t=new Hn(oi(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,n=this.first+this.size;e.from!=null&&e.from>t&&(t=e.from),e.to!=null&&e.to<n&&(n=e.to);var r=new Hn(oi(this,t,n),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,Fs(this)),r},unlinkDoc:function(e){if(e instanceof Hr&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){var n=this.linked[t];if(n.doc!=e)continue;this.linked.splice(t,1),e.unlinkDoc(this),Tl(Fs(this));break}if(e.history==this.history){var r=[e.id];ra(e,function(i){return r.push(i.id)},!0),e.history=new Do(null),e.history.done=La(this.history.done,r),e.history.undone=La(this.history.undone,r)}},iterLinkedDocs:function(e){ra(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):Kt(e)},lineSeparator:function(){return this.lineSep||`
`},setDirection:Jr(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)})}),Hn.prototype.eachLine=Hn.prototype.iter;var js=0;function Al(e){var t=this;if(Ws(t),Ze(t,e)||vi(t.display,e))return;re(e),H&&(js=+new Date);var n=dn(t,e,!0),r=e.dataTransfer.files;if(!n||t.isReadOnly())return;if(r&&r.length&&window.FileReader&&window.File)for(var i=r.length,C=Array(i),U=0,V=function(){++U==i&&Zr(t,function(){n=l(t.doc,n);var ke={from:n,to:n,text:t.doc.splitLines(C.filter(function(He){return He!=null}).join(t.doc.lineSeparator())),origin:"paste"};ka(t.doc,ke),ws(t.doc,bi(l(t.doc,n),l(t.doc,xi(ke))))})()},$=function(ke,He){if(t.options.allowDropFileTypes&&be(t.options.allowDropFileTypes,ke.type)==-1){V();return}var Qe=new FileReader;Qe.onerror=function(){return V()},Qe.onload=function(){var at=Qe.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(at)){V();return}C[He]=at,V()},Qe.readAsText(ke)},J=0;J<r.length;J++)$(r[J],J);else{if(t.state.draggingText&&t.doc.sel.contains(n)>-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var he=e.dataTransfer.getData("Text");if(he){var me;if(t.state.draggingText&&!t.state.draggingText.copy&&(me=t.listSelections()),Ro(t.doc,bi(n,n)),me)for(var _e=0;_e<me.length;++_e)Da(t.doc,"",me[_e].anchor,me[_e].head,"drag");t.replaceSelection(he,"around","paste"),t.display.input.focus()}}catch(ke){}}}function Ll(e,t){if(H&&(!e.state.draggingText||+new Date-js<100)){ge(t);return}if(Ze(e,t)||vi(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!_){var n=o("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",A&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),A&&n.parentNode.removeChild(n)}}function Ol(e,t){var n=dn(e,t);if(!n)return;var r=document.createDocumentFragment();Oi(e,n,r),e.display.dragCursor||(e.display.dragCursor=o("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),c(e.display.dragCursor,r)}function Ws(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function Hs(e){if(!document.getElementsByClassName)return;for(var t=document.getElementsByClassName("CodeMirror"),n=[],r=0;r<t.length;r++){var i=t[r].CodeMirror;i&&n.push(i)}n.length&&n[0].operation(function(){for(var C=0;C<n.length;C++)e(n[C])})}var Ks=!1;function kl(){if(Ks)return;Dl(),Ks=!0}function Dl(){var e;Ne(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,Hs(_l)},100))}),Ne(window,"blur",function(){return Hs(Qi)})}function _l(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var ia={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"},lo=0;lo<10;lo++)ia[lo+48]=ia[lo+96]=String(lo);for(var No=65;No<=90;No++)ia[No]=String.fromCharCode(No);for(var uo=1;uo<=12;uo++)ia[uo+111]=ia[uo+63235]="F"+uo;var Ki={};Ki.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"},Ki.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"},Ki.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"},Ki.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"]},Ki.default=s?Ki.macDefault:Ki.pcDefault;function Ml(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var n,r,i,C,U=0;U<t.length-1;U++){var V=t[U];if(/^(cmd|meta|m)$/i.test(V))C=!0;else if(/^a(lt)?$/i.test(V))n=!0;else if(/^(c|ctrl|control)$/i.test(V))r=!0;else if(/^s(hift)?$/i.test(V))i=!0;else throw new Error("Unrecognized modifier name: "+V)}return n&&(e="Alt-"+e),r&&(e="Ctrl-"+e),C&&(e="Cmd-"+e),i&&(e="Shift-"+e),e}function Rl(e){var t={};for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];if(/^(name|fallthrough|(de|at)tach)$/.test(n))continue;if(r=="..."){delete e[n];continue}for(var i=dt(n.split(" "),Ml),C=0;C<i.length;C++){var U=void 0,V=void 0;C==i.length-1?(V=i.join(" "),U=r):(V=i.slice(0,C+1).join(" "),U="...");var $=t[V];if(!$)t[V]=U;else if($!=U)throw new Error("Inconsistent bindings for "+V)}delete e[n]}for(var J in t)e[J]=t[J];return e}function Ma(e,t,n,r){t=Uo(t);var i=t.call?t.call(e,r):t[e];if(i===!1)return"nothing";if(i==="...")return"multi";if(i!=null&&n(i))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return Ma(e,t.fallthrough,n,r);for(var C=0;C<t.fallthrough.length;C++){var U=Ma(e,t.fallthrough[C],n,r);if(U)return U}}}function zs(e){var t=typeof e=="string"?e:ia[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function Gs(e,t,n){var r=e;return t.altKey&&r!="Alt"&&(e="Alt-"+e),(m?t.metaKey:t.ctrlKey)&&r!="Ctrl"&&(e="Ctrl-"+e),(m?t.ctrlKey:t.metaKey)&&r!="Mod"&&(e="Cmd-"+e),!n&&t.shiftKey&&r!="Shift"&&(e="Shift-"+e),e}function Vs(e,t){if(A&&e.keyCode==34&&e.char)return!1;var n=ia[e.keyCode];return n==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(n=e.code),Gs(n,e,t))}function Uo(e){return typeof e=="string"?Ki[e]:e}function Ra(e,t){for(var n=e.doc.sel.ranges,r=[],i=0;i<n.length;i++){for(var C=t(n[i]);r.length&&jt(C.from,Fe(r).to)<=0;){var U=r.pop();if(jt(U.from,C.from)<0){C.from=U.from;break}}r.push(C)}Rn(e,function(){for(var V=r.length-1;V>=0;V--)Da(e.doc,"",r[V].from,r[V].to,"+delete");Zi(e)})}function as(e,t,n){var r=Ke(e.text,t+n,n);return r<0||r>e.text.length?null:r}function os(e,t,n){var r=as(e,t.ch,n);return r==null?null:new Je(t.line,r,n<0?"after":"before")}function ss(e,t,n,r,i){if(e){t.doc.direction=="rtl"&&(i=-i);var C=vt(n,t.doc.direction);if(C){var U=i<0?Fe(C):C[0],V=i<0==(U.level==1),$=V?"after":"before",J;if(U.level>0||t.doc.direction=="rtl"){var he=Ce(t,n);J=i<0?n.text.length-1:0;var me=De(t,he,J).top;J=ht(function(_e){return De(t,he,_e).top==me},i<0==(U.level==1)?U.from:U.to-1,J),$=="before"&&(J=as(n,J,1))}else J=i<0?U.to:U.from;return new Je(r,J,$)}}return new Je(r,i<0?n.text.length:0,i<0?"before":"after")}function Pl(e,t,n,r){var i=vt(t,e.doc.direction);if(!i)return os(t,n,r);n.ch>=t.text.length?(n.ch=t.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var C=nt(i,n.ch,n.sticky),U=i[C];if(e.doc.direction=="ltr"&&U.level%2==0&&(r>0?U.to>n.ch:U.from<n.ch))return os(t,n,r);var V=function(mt,St){return as(t,mt instanceof Je?mt.ch:mt,St)},$,J=function(mt){return e.options.lineWrapping?($=$||Ce(e,t),Dt(e,t,$,mt)):{begin:0,end:t.text.length}},he=J(n.sticky=="before"?V(n,-1):n.ch);if(e.doc.direction=="rtl"||U.level==1){var me=U.level==1==r<0,_e=V(n,me?1:-1);if(_e!=null&&(me?_e<=U.to&&_e<=he.end:_e>=U.from&&_e>=he.begin)){var ke=me?"before":"after";return new Je(n.line,_e,ke)}}var He=function(mt,St,gt){for(var Tt=function(Rr,bn){return bn?new Je(n.line,V(Rr,1),"before"):new Je(n.line,Rr,"after")};mt>=0&&mt<i.length;mt+=St){var Ht=i[mt],Ut=St>0==(Ht.level!=1),tr=Ut?gt.begin:V(gt.end,-1);if(Ht.from<=tr&&tr<Ht.to)return Tt(tr,Ut);if(tr=Ut?Ht.from:V(Ht.to,-1),gt.begin<=tr&&tr<gt.end)return Tt(tr,Ut)}},Qe=He(C+r,r,he);if(Qe)return Qe;var at=r>0?he.end:V(he.begin,-1);return at!=null&&!(r>0&&at==t.text.length)&&(Qe=He(r>0?0:i.length-1,r,J(at)),Qe)?Qe:null}var co={selectAll:Ds,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),Me)},killLine:function(e){return Ra(e,function(t){if(t.empty()){var n=wt(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line<e.lastLine()?{from:t.head,to:Je(t.head.line+1,0)}:{from:t.head,to:Je(t.head.line,n)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return Ra(e,function(t){return{from:Je(t.from().line,0),to:l(e.doc,Je(t.to().line+1,0))}})},delLineLeft:function(e){return Ra(e,function(t){return{from:Je(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return Ra(e,function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return{from:r,to:t.from()}})},delWrappedLineRight:function(e){return Ra(e,function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"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(Je(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(Je(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return Xs(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return Ys(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 n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div")},Ue)},goLineLeft:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:n},"div")},Ue)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return r.ch<e.getLine(r.line).search(/\S/)?Ys(e,t.head):r},Ue)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"codepoint")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection(" ")},insertSoftTab:function(e){for(var t=[],n=e.listSelections(),r=e.options.tabSize,i=0;i<n.length;i++){var C=n[i].from(),U=te(e.getLine(C.line),C.ch,r);t.push(se(r-U%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return Rn(e,function(){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++){if(!t[r].empty())continue;var i=t[r].head,C=wt(e.doc,i.line).text;if(C){if(i.ch==C.length&&(i=new Je(i.line,i.ch-1)),i.ch>0)i=new Je(i.line,i.ch+1),e.replaceRange(C.charAt(i.ch-1)+C.charAt(i.ch-2),Je(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var U=wt(e.doc,i.line-1).text;U&&(i=new Je(i.line,1),e.replaceRange(C.charAt(0)+e.doc.lineSeparator()+U.charAt(U.length-1),Je(i.line-1,U.length-1),i,"+transpose"))}}n.push(new xr(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){return Rn(e,function(){for(var t=e.listSelections(),n=t.length-1;n>=0;n--)e.replaceRange(e.doc.lineSeparator(),t[n].anchor,t[n].head,"+input");t=e.listSelections();for(var r=0;r<t.length;r++)e.indentLine(t[r].from().line,null,!0);Zi(e)})},openLine:function(e){return e.replaceSelection(`
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function Xs(e,t){var n=wt(e.doc,t),r=vn(n);return r!=n&&(t=nr(r)),ss(!0,e,r,t,1)}function Il(e,t){var n=wt(e.doc,t),r=Xi(n);return r!=n&&(t=nr(r)),ss(!0,e,n,t,-1)}function Ys(e,t){var n=Xs(e,t.line),r=wt(e.doc,n.line),i=vt(r,e.doc.direction);if(!i||i[0].level==0){var C=Math.max(n.ch,r.text.search(/\S/)),U=t.line==n.line&&t.ch<=C&&t.ch;return Je(n.line,U?0:C,n.sticky)}return n}function Bo(e,t,n){if(typeof t=="string"&&(t=co[t],!t))return!1;e.display.input.ensurePolled();var r=e.display.shift,i=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n&&(e.display.shift=!1),i=t(e)!=Ge}finally{e.display.shift=r,e.state.suppressEdits=!1}return i}function Nl(e,t,n){for(var r=0;r<e.state.keyMaps.length;r++){var i=Ma(t,e.state.keyMaps[r],n,e);if(i)return i}return e.options.extraKeys&&Ma(t,e.options.extraKeys,n,e)||Ma(t,e.options.keyMap,n,e)}var Ul=new de;function ho(e,t,n,r){var i=e.state.keySeq;if(i){if(zs(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Ul.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),$s(e,i+" "+t,n,r))return!0}return $s(e,t,n,r)}function $s(e,t,n,r){var i=Nl(e,t,r);return i=="multi"&&(e.state.keySeq=t),i=="handled"&&Xr(e,"keyHandled",e,t,n),(i=="handled"||i=="multi")&&(re(n),cn(e)),!!i}function Qs(e,t){var n=Vs(t,!0);return n?t.shiftKey&&!e.state.keySeq?ho(e,"Shift-"+n,t,function(r){return Bo(e,r,!0)})||ho(e,n,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return Bo(e,r)}):ho(e,n,t,function(r){return Bo(e,r)}):!1}function Bl(e,t,n){return ho(e,"'"+n+"'",t,function(r){return Bo(e,r,!0)})}var ls=null;function Zs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=N(),Ze(t,e))return;H&&W<11&&e.keyCode==27&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=n==16||e.shiftKey;var r=Qs(t,e);A&&(ls=r?n:null,!r&&n==88&&!pr&&(s?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),D&&!s&&!r&&n==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),n==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Fl(t)}function Fl(e){var t=e.display.lineDiv;z(t,"CodeMirror-crosshair");function n(r){(r.keyCode==18||!r.altKey)&&(h(t,"CodeMirror-crosshair"),Et(document,"keyup",n),Et(document,"mouseover",n))}Ne(document,"keyup",n),Ne(document,"mouseover",n)}function Js(e){e.keyCode==16&&(this.doc.sel.shift=!1),Ze(this,e)}function qs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(vi(t.display,e)||Ze(t,e)||e.ctrlKey&&!e.altKey||s&&e.metaKey)return;var n=e.keyCode,r=e.charCode;if(A&&n==ls){ls=null,re(e);return}if(A&&(!e.which||e.which<10)&&Qs(t,e))return;var i=String.fromCharCode(r==null?n:r);if(i=="\b")return;if(Bl(t,e,i))return;t.display.input.onKeyPress(e)}var jl=400,us=function(e,t,n){this.time=e,this.pos=t,this.button=n};us.prototype.compare=function(e,t,n){return this.time+jl>e&&jt(t,this.pos)==0&&n==this.button};var fo,po;function Wl(e,t){var n=+new Date;return po&&po.compare(n,e,t)?(fo=po=null,"triple"):fo&&fo.compare(n,e,t)?(po=new us(n,e,t),fo=null,"double"):(fo=new us(n,e,t),po=null,"single")}function el(e){var t=this,n=t.display;if(Ze(t,e)||n.activeTouch&&n.input.supportsTouch())return;if(n.input.ensurePolled(),n.shift=e.shiftKey,vi(n,e)){I||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if(ds(t,e))return;var r=dn(t,e),i=Re(e),C=r?Wl(r,i):"single";if(window.focus(),i==1&&t.state.selectingText&&t.state.selectingText(e),r&&Hl(t,i,r,C,e))return;i==1?r?zl(t,r,C,e):Se(e)==n.scroller&&re(e):i==2?(r&&Mo(t.doc,r),setTimeout(function(){return n.input.focus()},20)):i==3&&(k?t.display.input.onContextMenu(e):Ga(t))}function Hl(e,t,n,r,i){var C="Click";return r=="double"?C="Double"+C:r=="triple"&&(C="Triple"+C),C=(t==1?"Left":t==2?"Middle":"Right")+C,ho(e,Gs(C,i),i,function(U){if(typeof U=="string"&&(U=co[U]),!U)return!1;var V=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),V=U(e,n)!=Ge}finally{e.state.suppressEdits=!1}return V})}function Kl(e,t,n){var r=e.getOption("configureMouse"),i=r?r(e,t,n):{};if(i.unit==null){var C=d?n.shiftKey&&n.metaKey:n.altKey;i.unit=C?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(i.extend==null||e.doc.extend)&&(i.extend=e.doc.extend||n.shiftKey),i.addNew==null&&(i.addNew=s?n.metaKey:n.ctrlKey),i.moveOnDrag==null&&(i.moveOnDrag=!(s?n.altKey:n.ctrlKey)),i}function zl(e,t,n,r){H?setTimeout(G(Eo,e),0):e.curOp.focus=N();var i=Kl(e,n,r),C=e.doc.sel,U;e.options.dragDrop&&Xe&&!e.isReadOnly()&&n=="single"&&(U=C.contains(t))>-1&&(jt((U=C.ranges[U]).from(),t)<0||t.xRel>0)&&(jt(U.to(),t)>0||t.xRel<0)?Gl(e,r,t,i):Vl(e,r,t,i)}function Gl(e,t,n,r){var i=e.display,C=!1,U=Zr(e,function(J){I&&(i.scroller.draggable=!1),e.state.draggingText=!1,Et(i.wrapper.ownerDocument,"mouseup",U),Et(i.wrapper.ownerDocument,"mousemove",V),Et(i.scroller,"dragstart",$),Et(i.scroller,"drop",U),C||(re(J),r.addNew||Mo(e.doc,n,null,null,r.extend),I&&!_||H&&W==9?setTimeout(function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()},20):i.input.focus())}),V=function(J){C=C||Math.abs(t.clientX-J.clientX)+Math.abs(t.clientY-J.clientY)>=10},$=function(){return C=!0};I&&(i.scroller.draggable=!0),e.state.draggingText=U,U.copy=!r.moveOnDrag,i.scroller.dragDrop&&i.scroller.dragDrop(),Ne(i.wrapper.ownerDocument,"mouseup",U),Ne(i.wrapper.ownerDocument,"mousemove",V),Ne(i.scroller,"dragstart",$),Ne(i.scroller,"drop",U),Ga(e),setTimeout(function(){return i.input.focus()},20)}function tl(e,t,n){if(n=="char")return new xr(t,t);if(n=="word")return e.findWordAt(t);if(n=="line")return new xr(Je(t.line,0),l(e.doc,Je(t.line+1,0)));var r=n(e,t);return new xr(r.from,r.to)}function Vl(e,t,n,r){var i=e.display,C=e.doc;re(t);var U,V,$=C.sel,J=$.ranges;if(r.addNew&&!r.extend?(V=C.sel.contains(n),V>-1?U=J[V]:U=new xr(n,n)):(U=C.sel.primary(),V=C.sel.primIndex),r.unit=="rectangle")r.addNew||(U=new xr(n,n)),n=dn(e,t,!0,!0),V=-1;else{var he=tl(e,n,r.unit);r.extend?U=ns(U,he.anchor,he.head,r.extend):U=he}r.addNew?V==-1?(V=J.length,kn(C,ai(e,J.concat([U]),V),{scroll:!1,origin:"*mouse"})):J.length>1&&J[V].empty()&&r.unit=="char"&&!r.extend?(kn(C,ai(e,J.slice(0,V).concat(J.slice(V+1)),0),{scroll:!1,origin:"*mouse"}),$=C.sel):is(C,V,U,Ie):(V=0,kn(C,new In([U],0),Ie),$=C.sel);var me=n;function _e(gt){if(jt(me,gt)==0)return;if(me=gt,r.unit=="rectangle"){for(var Tt=[],Ht=e.options.tabSize,Ut=te(wt(C,n.line).text,n.ch,Ht),tr=te(wt(C,gt.line).text,gt.ch,Ht),Rr=Math.min(Ut,tr),bn=Math.max(Ut,tr),Gr=Math.min(n.line,gt.line),$n=Math.min(e.lastLine(),Math.max(n.line,gt.line));Gr<=$n;Gr++){var Kn=wt(C,Gr).text,rn=Pe(Kn,Rr,Ht);Rr==bn?Tt.push(new xr(Je(Gr,rn),Je(Gr,rn))):Kn.length>rn&&Tt.push(new xr(Je(Gr,rn),Je(Gr,Pe(Kn,bn,Ht))))}Tt.length||Tt.push(new xr(n,n)),kn(C,ai(e,$.ranges.slice(0,V).concat(Tt),V),{origin:"*mouse",scroll:!1}),e.scrollIntoView(gt)}else{var zn=U,wn=tl(e,gt,r.unit),pn=zn.anchor,nn;jt(wn.anchor,pn)>0?(nn=wn.head,pn=li(zn.from(),wn.anchor)):(nn=wn.anchor,pn=Si(zn.to(),wn.head));var $r=$.ranges.slice(0);$r[V]=Xl(e,new xr(l(C,pn),nn)),kn(C,ai(e,$r,V),Ie)}}var ke=i.wrapper.getBoundingClientRect(),He=0;function Qe(gt){var Tt=++He,Ht=dn(e,gt,!0,r.unit=="rectangle");if(!Ht)return;if(jt(Ht,me)!=0){e.curOp.focus=N(),_e(Ht);var Ut=ba(i,C);(Ht.line>=Ut.to||Ht.line<Ut.from)&&setTimeout(Zr(e,function(){He==Tt&&Qe(gt)}),150)}else{var tr=gt.clientY<ke.top?-20:gt.clientY>ke.bottom?20:0;tr&&setTimeout(Zr(e,function(){if(He!=Tt)return;i.scroller.scrollTop+=tr,Qe(gt)}),50)}}function at(gt){e.state.selectingText=!1,He=Infinity,gt&&(re(gt),i.input.focus()),Et(i.wrapper.ownerDocument,"mousemove",mt),Et(i.wrapper.ownerDocument,"mouseup",St),C.history.lastSelOrigin=null}var mt=Zr(e,function(gt){gt.buttons===0||!Re(gt)?at(gt):Qe(gt)}),St=Zr(e,at);e.state.selectingText=St,Ne(i.wrapper.ownerDocument,"mousemove",mt),Ne(i.wrapper.ownerDocument,"mouseup",St)}function Xl(e,t){var n=t.anchor,r=t.head,i=wt(e.doc,n.line);if(jt(n,r)==0&&n.sticky==r.sticky)return t;var C=vt(i);if(!C)return t;var U=nt(C,n.ch,n.sticky),V=C[U];if(V.from!=n.ch&&V.to!=n.ch)return t;var $=U+(V.from==n.ch==(V.level!=1)?0:1);if($==0||$==C.length)return t;var J;if(r.line!=n.line)J=(r.line-n.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var he=nt(C,r.ch,r.sticky),me=he-U||(r.ch-n.ch)*(V.level==1?-1:1);he==$-1||he==$?J=me<0:J=me>0}var _e=C[$+(J?-1:0)],ke=J==(_e.level==1),He=ke?_e.from:_e.to,Qe=ke?"after":"before";return n.ch==He&&n.sticky==Qe?t:new xr(new Je(n.line,He,Qe),r)}function rl(e,t,n,r){var i,C;if(t.touches)i=t.touches[0].clientX,C=t.touches[0].clientY;else try{i=t.clientX,C=t.clientY}catch(_e){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&re(t);var U=e.display,V=U.lineDiv.getBoundingClientRect();if(C>V.bottom||!ye(e,n))return ue(t);C-=V.top-U.viewOffset;for(var $=0;$<e.display.gutterSpecs.length;++$){var J=U.gutters.childNodes[$];if(J&&J.getBoundingClientRect().right>=i){var he=Bn(e.doc,C),me=e.display.gutterSpecs[$];return We(e,n,e,he,me.className,t),ue(t)}}}function ds(e,t){return rl(e,t,"gutterClick",!0)}function nl(e,t){if(vi(e.display,t)||Yl(e,t))return;if(Ze(e,t,"contextmenu"))return;k||e.display.input.onContextMenu(t)}function Yl(e,t){return ye(e,"gutterContextMenu")?rl(e,t,"gutterContextMenu",!1):!1}function il(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),Yt(e)}var Pa={toString:function(){return"CodeMirror.Init"}},al={},Fo={};function $l(e){var t=e.optionHandlers;function n(r,i,C,U){e.defaults[r]=i,C&&(t[r]=U?function(V,$,J){J!=Pa&&C(V,$,J)}:C)}e.defineOption=n,e.Init=Pa,n("value","",function(r,i){return r.setValue(i)},!0),n("mode",null,function(r,i){r.doc.modeOption=i,Hi(r)},!0),n("indentUnit",2,Hi,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(r){to(r),Yt(r),Or(r)},!0),n("lineSeparator",null,function(r,i){if(r.doc.lineSep=i,!i)return;var C=[],U=r.doc.first;r.doc.iter(function($){for(var J=0;;){var he=$.text.indexOf(i,J);if(he==-1)break;J=he+i.length,C.push(Je(U,he))}U++});for(var V=C.length-1;V>=0;V--)Da(r.doc,i,C[V],Je(C[V].line,C[V].ch+i.length))}),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(r,i,C){r.state.specialChars=new RegExp(i.source+(i.test(" ")?"":"| "),"g"),C!=Pa&&r.refresh()}),n("specialCharPlaceholder",Cr,function(r){return r.refresh()},!0),n("electricChars",!0),n("inputStyle",a?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),n("spellcheck",!1,function(r,i){return r.getInputField().spellcheck=i},!0),n("autocorrect",!1,function(r,i){return r.getInputField().autocorrect=i},!0),n("autocapitalize",!1,function(r,i){return r.getInputField().autocapitalize=i},!0),n("rtlMoveVisually",!E),n("wholeLineUpdateBefore",!0),n("theme","default",function(r){il(r),yi(r)},!0),n("keyMap","default",function(r,i,C){var U=Uo(i),V=C!=Pa&&Uo(C);V&&V.detach&&V.detach(r,U),U.attach&&U.attach(r,V||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Zl,!0),n("gutters",[],function(r,i){r.display.gutterSpecs=Pn(i,r.options.lineNumbers),yi(r)},!0),n("fixedGutter",!0,function(r,i){r.display.gutters.style.left=i?On(r.display)+"px":"0",r.refresh()},!0),n("coverGutterNextToScrollbar",!1,function(r){return Fi(r)},!0),n("scrollbarStyle","native",function(r){Sa(r),Fi(r),r.display.scrollbars.setScrollTop(r.doc.scrollTop),r.display.scrollbars.setScrollLeft(r.doc.scrollLeft)},!0),n("lineNumbers",!1,function(r,i){r.display.gutterSpecs=Pn(r.options.gutters,i),yi(r)},!0),n("firstLineNumber",1,yi,!0),n("lineNumberFormatter",function(r){return r},yi,!0),n("showCursorWhenSelecting",!1,Ar,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,function(r,i){i=="nocursor"&&(Qi(r),r.display.input.blur()),r.display.input.readOnlyChanged(i)}),n("screenReaderLabel",null,function(r,i){i=i===""?null:i,r.display.input.screenReaderLabelChanged(i)}),n("disableInput",!1,function(r,i){i||r.display.input.reset()},!0),n("dragDrop",!0,Ql),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,Ar,!0),n("singleCursorHeightPerLine",!0,Ar,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,to,!0),n("addModeClass",!1,to,!0),n("pollInterval",100),n("undoDepth",200,function(r,i){return r.doc.history.undoDepth=i}),n("historyEventDelay",1250),n("viewportMargin",10,function(r){return r.refresh()},!0),n("maxHighlightLength",1e4,to,!0),n("moveInputWithCursor",!0,function(r,i){i||r.display.input.resetPosition()}),n("tabindex",null,function(r,i){return r.display.input.getField().tabIndex=i||""}),n("autofocus",null),n("direction","ltr",function(r,i){return r.doc.setDirection(i)},!0),n("phrases",null)}function Ql(e,t,n){var r=n&&n!=Pa;if(!t!=!r){var i=e.display.dragFunctions,C=t?Ne:Et;C(e.display.scroller,"dragstart",i.start),C(e.display.scroller,"dragenter",i.enter),C(e.display.scroller,"dragover",i.over),C(e.display.scroller,"dragleave",i.leave),C(e.display.scroller,"drop",i.drop)}}function Zl(e){e.options.lineWrapping?(z(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(h(e.display.wrapper,"CodeMirror-wrap"),ua(e)),Mn(e),Or(e),Yt(e),setTimeout(function(){return Fi(e)},100)}function Hr(e,t){var n=this;if(!(this instanceof Hr))return new Hr(e,t);this.options=t=t?j(t):{},j(al,t,!1);var r=t.value;typeof r=="string"?r=new Hn(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var i=new Hr.inputStyles[t.inputStyle](this),C=this.display=new ma(e,r,i,t);C.wrapper.CodeMirror=this,il(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Sa(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 de,keySeq:null,specialChars:null},t.autofocus&&!a&&C.input.focus(),H&&W<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Jl(this),kl(),_i(this),this.curOp.forceUpdate=!0,vs(this,r),t.autofocus&&!a||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&ki(n)},20):Qi(this);for(var U in Fo)Fo.hasOwnProperty(U)&&Fo[U](this,t[U],Pa);hn(this),t.finishInit&&t.finishInit(this);for(var V=0;V<cs.length;++V)cs[V](this);ji(this),I&&t.lineWrapping&&getComputedStyle(C.lineDiv).textRendering=="optimizelegibility"&&(C.lineDiv.style.textRendering="auto")}Hr.defaults=al,Hr.optionHandlers=Fo;function Jl(e){var t=e.display;Ne(t.scroller,"mousedown",Zr(e,el)),H&&W<11?Ne(t.scroller,"dblclick",Zr(e,function($){if(Ze(e,$))return;var J=dn(e,$);if(!J||ds(e,$)||vi(e.display,$))return;re($);var he=e.findWordAt(J);Mo(e.doc,he.anchor,he.head)})):Ne(t.scroller,"dblclick",function($){return Ze(e,$)||re($)}),Ne(t.scroller,"contextmenu",function($){return nl(e,$)}),Ne(t.input.getField(),"contextmenu",function($){t.scroller.contains($.target)||nl(e,$)});var n,r={end:0};function i(){t.activeTouch&&(n=setTimeout(function(){return t.activeTouch=null},1e3),r=t.activeTouch,r.end=+new Date)}function C($){if($.touches.length!=1)return!1;var J=$.touches[0];return J.radiusX<=1&&J.radiusY<=1}function U($,J){if(J.left==null)return!0;var he=J.left-$.left,me=J.top-$.top;return he*he+me*me>20*20}Ne(t.scroller,"touchstart",function($){if(!Ze(e,$)&&!C($)&&!ds(e,$)){t.input.ensurePolled(),clearTimeout(n);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)}}),Ne(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Ne(t.scroller,"touchend",function($){var J=t.activeTouch;if(J&&!vi(t,$)&&J.left!=null&&!J.moved&&new Date-J.start<300){var he=e.coordsChar(t.activeTouch,"page"),me;!J.prev||U(J,J.prev)?me=new xr(he,he):!J.prev.prev||U(J,J.prev.prev)?me=e.findWordAt(he):me=new xr(Je(he.line,0),l(e.doc,Je(he.line+1,0))),e.setSelection(me.anchor,me.head),e.focus(),re($)}i()}),Ne(t.scroller,"touchcancel",i),Ne(t.scroller,"scroll",function(){t.scroller.clientHeight&&(qi(e,t.scroller.scrollTop),ni(e,t.scroller.scrollLeft,!0),We(e,"scroll",e))}),Ne(t.scroller,"mousewheel",function($){return qa(e,$)}),Ne(t.scroller,"DOMMouseScroll",function($){return qa(e,$)}),Ne(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function($){Ze(e,$)||ge($)},over:function($){Ze(e,$)||(Ol(e,$),ge($))},start:function($){return Ll(e,$)},drop:Zr(e,Al),leave:function($){Ze(e,$)||Ws(e)}};var V=t.input.getField();Ne(V,"keyup",function($){return Js.call(e,$)}),Ne(V,"keydown",Zr(e,Zs)),Ne(V,"keypress",Zr(e,qs)),Ne(V,"focus",function($){return ki(e,$)}),Ne(V,"blur",function($){return Qi(e,$)})}var cs=[];Hr.defineInitHook=function(e){return cs.push(e)};function mo(e,t,n,r){var i=e.doc,C;n==null&&(n="add"),n=="smart"&&(i.mode.indent?C=lt(e,t).state:n="prev");var U=e.options.tabSize,V=wt(i,t),$=te(V.text,null,U);V.stateAfter&&(V.stateAfter=null);var J=V.text.match(/^\s*/)[0],he;if(!r&&!/\S/.test(V.text))he=0,n="not";else if(n=="smart"&&(he=i.mode.indent(C,V.text.slice(J.length),V.text),he==Ge||he>150)){if(!r)return;n="prev"}n=="prev"?t>i.first?he=te(wt(i,t-1).text,null,U):he=0:n=="add"?he=$+e.options.indentUnit:n=="subtract"?he=$-e.options.indentUnit:typeof n=="number"&&(he=$+n),he=Math.max(0,he);var me="",_e=0;if(e.options.indentWithTabs)for(var ke=Math.floor(he/U);ke;--ke)_e+=U,me+=" ";if(_e<he&&(me+=se(he-_e)),me!=J)return Da(i,me,Je(t,0),Je(t,J.length),"+input"),V.stateAfter=null,!0;for(var He=0;He<i.sel.ranges.length;He++){var Qe=i.sel.ranges[He];if(Qe.head.line==t&&Qe.head.ch<J.length){var at=Je(t,J.length);is(i,He,new xr(at,at));break}}}var Ei=null;function jo(e){Ei=e}function hs(e,t,n,r,i){var C=e.doc;e.display.shift=!1,r||(r=C.sel);var U=+new Date-200,V=i=="paste"||e.state.pasteIncoming>U,$=Kt(t),J=null;if(V&&r.ranges.length>1)if(Ei&&Ei.text.join(`
`)==t){if(r.ranges.length%Ei.text.length==0){J=[];for(var he=0;he<Ei.text.length;he++)J.push(C.splitLines(Ei.text[he]))}}else $.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(J=dt($,function(mt){return[mt]}));for(var me=e.curOp.updateInput,_e=r.ranges.length-1;_e>=0;_e--){var ke=r.ranges[_e],He=ke.from(),Qe=ke.to();ke.empty()&&(n&&n>0?He=Je(He.line,He.ch-n):e.state.overwrite&&!V?Qe=Je(Qe.line,Math.min(wt(C,Qe.line).text.length,Qe.ch+Fe($).length)):V&&Ei&&Ei.lineWise&&Ei.text.join(`
`)==$.join(`
`)&&(He=Qe=Je(He.line,0)));var at={from:He,to:Qe,text:J?J[_e%J.length]:$,origin:i||(V?"paste":e.state.cutIncoming>U?"cut":"+input")};ka(e.doc,at),Xr(e,"inputRead",e,at)}t&&!V&&sl(e,t),Zi(e),e.curOp.updateInput<2&&(e.curOp.updateInput=me),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function ol(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&Rn(t,function(){return hs(t,n,0,null,"paste")}),!0}function sl(e,t){if(!e.options.electricChars||!e.options.smartIndent)return;for(var n=e.doc.sel,r=n.ranges.length-1;r>=0;r--){var i=n.ranges[r];if(i.head.ch>100||r&&n.ranges[r-1].head.line==i.head.line)continue;var C=e.getModeAt(i.head),U=!1;if(C.electricChars){for(var V=0;V<C.electricChars.length;V++)if(t.indexOf(C.electricChars.charAt(V))>-1){U=mo(e,i.head.line,"smart");break}}else C.electricInput&&(C.electricInput.test(wt(e.doc,i.head.line).text.slice(0,i.head.ch))&&(U=mo(e,i.head.line,"smart")));U&&Xr(e,"electricInput",e,i.head.line)}}function ll(e){for(var t=[],n=[],r=0;r<e.doc.sel.ranges.length;r++){var i=e.doc.sel.ranges[r].head.line,C={anchor:Je(i,0),head:Je(i+1,0)};n.push(C),t.push(e.getRange(C.anchor,C.head))}return{text:t,ranges:n}}function ul(e,t,n,r){e.setAttribute("autocorrect",n?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function dl(){var e=o("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=o("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return I?e.style.width="1000px":e.setAttribute("wrap","off"),y&&(e.style.border="1px solid black"),ul(e),t}function ql(e){var t=e.optionHandlers,n=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(r,i){var C=this.options,U=C[r];if(C[r]==i&&r!="mode")return;C[r]=i,t.hasOwnProperty(r)&&Zr(this,t[r])(this,i,U),We(this,"optionChange",this,r)},getOption:function(r){return this.options[r]},getDoc:function(){return this.doc},addKeyMap:function(r,i){this.state.keyMaps[i?"push":"unshift"](Uo(r))},removeKeyMap:function(r){for(var i=this.state.keyMaps,C=0;C<i.length;++C)if(i[C]==r||i[C].name==r)return i.splice(C,1),!0},addOverlay:Tn(function(r,i){var C=r.token?r:e.getMode(this.options,r);if(C.startState)throw new Error("Overlays may not be stateful.");it(this.state.overlays,{mode:C,modeSpec:r,opaque:i&&i.opaque,priority:i&&i.priority||0},function(U){return U.priority}),this.state.modeGen++,Or(this)}),removeOverlay:Tn(function(r){for(var i=this.state.overlays,C=0;C<i.length;++C){var U=i[C].modeSpec;if(U==r||typeof r=="string"&&U.name==r){i.splice(C,1),this.state.modeGen++,Or(this);return}}}),indentLine:Tn(function(r,i,C){typeof i!="string"&&typeof i!="number"&&(i==null?i=this.options.smartIndent?"smart":"prev":i=i?"add":"subtract"),Zn(this.doc,r)&&mo(this,r,i,C)}),indentSelection:Tn(function(r){for(var i=this.doc.sel.ranges,C=-1,U=0;U<i.length;U++){var V=i[U];if(V.empty())V.head.line>C&&(mo(this,V.head.line,r,!0),C=V.head.line,U==this.doc.sel.primIndex&&Zi(this));else{var $=V.from(),J=V.to(),he=Math.max(C,$.line);C=Math.min(this.lastLine(),J.line-(J.ch?0:1))+1;for(var me=he;me<C;++me)mo(this,me,r);var _e=this.doc.sel.ranges;$.ch==0&&i.length==_e.length&&_e[U].from().ch>0&&is(this.doc,U,new xr($,_e[U].to()),Me)}}}),getTokenAt:function(r,i){return Dr(this,r,i)},getLineTokens:function(r,i){return Dr(this,Je(r),i,!0)},getTokenTypeAt:function(r){r=l(this.doc,r);var i=ze(this,wt(this.doc,r.line)),C=0,U=(i.length-1)/2,V=r.ch,$;if(V==0)$=i[2];else for(;;){var J=C+U>>1;if((J?i[J*2-1]:0)>=V)U=J;else if(i[J*2+1]<V)C=J+1;else{$=i[J*2+2];break}}var he=$?$.indexOf("overlay "):-1;return he<0?$:he==0?null:$.slice(0,he-1)},getModeAt:function(r){var i=this.doc.mode;return i.innerMode?e.innerMode(i,this.getTokenAt(r).state).mode:i},getHelper:function(r,i){return this.getHelpers(r,i)[0]},getHelpers:function(r,i){var C=[];if(!n.hasOwnProperty(i))return C;var U=n[i],V=this.getModeAt(r);if(typeof V[i]=="string")U[V[i]]&&C.push(U[V[i]]);else if(V[i])for(var $=0;$<V[i].length;$++){var J=U[V[i][$]];J&&C.push(J)}else V.helperType&&U[V.helperType]?C.push(U[V.helperType]):U[V.name]&&C.push(U[V.name]);for(var he=0;he<U._global.length;he++){var me=U._global[he];me.pred(V,this)&&be(C,me.val)==-1&&C.push(me.val)}return C},getStateAfter:function(r,i){var C=this.doc;return r=F(C,r==null?C.first+C.size-1:r),lt(this,r+1,i).state},cursorCoords:function(r,i){var C,U=this.doc.sel.primary();return r==null?C=U.head:typeof r=="object"?C=l(this.doc,r):C=r?U.from():U.to(),or(this,C,i||"page")},charCoords:function(r,i){return Nr(this,l(this.doc,r),i||"page")},coordsChar:function(r,i){return r=ar(this,r,i||"page"),sr(this,r.left,r.top)},lineAtHeight:function(r,i){return r=ar(this,{top:r,left:0},i||"page").top,Bn(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,i,C){var U=!1,V;if(typeof r=="number"){var $=this.doc.first+this.doc.size-1;r<this.doc.first?r=this.doc.first:r>$&&(r=$,U=!0),V=wt(this.doc,r)}else V=r;return dr(this,V,{top:0,left:0},i||"page",C||U).top+(U?this.doc.height-Xn(V):0)},defaultTextHeight:function(){return Yr(this.display)},defaultCharWidth:function(){return un(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,i,C,U,V){var $=this.display;r=or(this,l(this.doc,r));var J=r.bottom,he=r.left;if(i.style.position="absolute",i.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(i),$.sizer.appendChild(i),U=="over")J=r.top;else if(U=="above"||U=="near"){var me=Math.max($.wrapper.clientHeight,this.doc.height),_e=Math.max($.sizer.clientWidth,$.lineSpace.clientWidth);(U=="above"||r.bottom+i.offsetHeight>me)&&r.top>i.offsetHeight?J=r.top-i.offsetHeight:r.bottom+i.offsetHeight<=me&&(J=r.bottom),he+i.offsetWidth>_e&&(he=_e-i.offsetWidth)}i.style.top=J+"px",i.style.left=i.style.right="",V=="right"?(he=$.sizer.clientWidth-i.offsetWidth,i.style.right="0px"):(V=="left"?he=0:V=="middle"&&(he=($.sizer.clientWidth-i.offsetWidth)/2),i.style.left=he+"px"),C&&So(this,{left:he,top:J,right:he+i.offsetWidth,bottom:J+i.offsetHeight})},triggerOnKeyDown:Tn(Zs),triggerOnKeyPress:Tn(qs),triggerOnKeyUp:Js,triggerOnMouseDown:Tn(el),execCommand:function(r){if(co.hasOwnProperty(r))return co[r].call(null,this)},triggerElectric:Tn(function(r){sl(this,r)}),findPosH:function(r,i,C,U){var V=1;i<0&&(V=-1,i=-i);for(var $=l(this.doc,r),J=0;J<i&&!($=fs(this.doc,$,V,C,U),$.hitSide);++J);return $},moveH:Tn(function(r,i){var C=this;this.extendSelectionsBy(function(U){return C.display.shift||C.doc.extend||U.empty()?fs(C.doc,U.head,r,i,C.options.rtlMoveVisually):r<0?U.from():U.to()},Ue)}),deleteH:Tn(function(r,i){var C=this.doc.sel,U=this.doc;C.somethingSelected()?U.replaceSelection("",null,"+delete"):Ra(this,function(V){var $=fs(U,V.head,r,i,!1);return r<0?{from:$,to:V.head}:{from:V.head,to:$}})}),findPosV:function(r,i,C,U){var V=1,$=U;i<0&&(V=-1,i=-i);for(var J=l(this.doc,r),he=0;he<i;++he){var me=or(this,J,"div");if($==null?$=me.left:me.left=$,J=cl(this,me,V,C),J.hitSide)break}return J},moveV:Tn(function(r,i){var C=this,U=this.doc,V=[],$=!this.display.shift&&!U.extend&&U.sel.somethingSelected();if(U.extendSelectionsBy(function(he){if($)return r<0?he.from():he.to();var me=or(C,he.head,"div");he.goalColumn!=null&&(me.left=he.goalColumn),V.push(me.left);var _e=cl(C,me,r,i);return i=="page"&&he==U.sel.primary()&&Ya(C,Nr(C,_e,"div").top-me.top),_e},Ue),V.length)for(var J=0;J<U.sel.ranges.length;J++)U.sel.ranges[J].goalColumn=V[J]}),findWordAt:function(r){var i=this.doc,C=wt(i,r.line).text,U=r.ch,V=r.ch;if(C){var $=this.getHelper(r,"wordChars");(r.sticky=="before"||V==C.length)&&U?--U:++V;for(var J=C.charAt(U),he=rt(J,$)?function(me){return rt(me,$)}:/\s/.test(J)?function(me){return/\s/.test(me)}:function(me){return!/\s/.test(me)&&!rt(me)};U>0&&he(C.charAt(U-1));)--U;for(;V<C.length&&he(C.charAt(V));)++V}return new xr(Je(r.line,U),Je(r.line,V))},toggleOverwrite:function(r){if(r!=null&&r==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?z(this.display.cursorDiv,"CodeMirror-overwrite"):h(this.display.cursorDiv,"CodeMirror-overwrite"),We(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==N()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:Tn(function(r,i){Ji(this,r,i)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-Ae(this)-this.display.barHeight,width:r.scrollWidth-Ae(this)-this.display.barWidth,clientHeight:Z(this),clientWidth:ce(this)}},scrollIntoView:Tn(function(r,i){r==null?(r={from:this.doc.sel.primary().head,to:null},i==null&&(i=this.options.cursorScrollMargin)):typeof r=="number"?r={from:Je(r,0),to:null}:r.from==null&&(r={from:r,to:null}),r.to||(r.to=r.from),r.margin=i||0,r.from.line!=null?$o(this,r):ca(this,r.from,r.to,r.margin)}),setSize:Tn(function(r,i){var C=this,U=function($){return typeof $=="number"||/^\d+$/.test(String($))?$+"px":$};r!=null&&(this.display.wrapper.style.width=U(r)),i!=null&&(this.display.wrapper.style.height=U(i)),this.options.lineWrapping&&Xt(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){Wr(C,V,"widget");break}}++V}),this.curOp.forceUpdate=!0,We(this,"refresh",this)}),operation:function(r){return Rn(this,r)},startOperation:function(){return _i(this)},endOperation:function(){return ji(this)},refresh:Tn(function(){var r=this.display.cachedTextHeight;Or(this),this.curOp.forceUpdate=!0,Yt(this),Ji(this,this.doc.scrollLeft,this.doc.scrollTop),Ta(this.display),(r==null||Math.abs(r-Yr(this.display))>.5||this.options.lineWrapping)&&Mn(this),We(this,"refresh",this)}),swapDoc:Tn(function(r){var i=this.doc;return i.cm=null,this.state.selectingText&&this.state.selectingText(),vs(this,r),Yt(this),this.display.input.reset(),Ji(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,Xr(this,"swapDoc",this,i),i}),phrase:function(r){var i=this.options.phrases;return i&&Object.prototype.hasOwnProperty.call(i,r)?i[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}},Ee(e),e.registerHelper=function(r,i,C){n.hasOwnProperty(r)||(n[r]=e[r]={_global:[]}),n[r][i]=C},e.registerGlobalHelper=function(r,i,C,U){e.registerHelper(r,i,U),n[r]._global.push({pred:C,val:U})}}function fs(e,t,n,r,i){var C=t,U=n,V=wt(e,t.line),$=i&&e.direction=="rtl"?-n:n;function J(){var St=t.line+$;return St<e.first||St>=e.first+e.size?!1:(t=new Je(St,t.ch,t.sticky),V=wt(e,St))}function he(St){var gt;if(r=="codepoint"){var Tt=V.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(Tt)?gt=null:gt=new Je(t.line,Math.max(0,Math.min(V.text.length,t.ch+n*(Tt>=55296&&Tt<56320?2:1))),-n)}else i?gt=Pl(e.cm,V,t,n):gt=os(V,t,n);if(gt==null)if(!St&&J())t=ss(i,e.cm,V,t.line,$);else return!1;else t=gt;return!0}if(r=="char"||r=="codepoint")he();else if(r=="column")he(!0);else if(r=="word"||r=="group")for(var me=null,_e=r=="group",ke=e.cm&&e.cm.getHelper(t,"wordChars"),He=!0;!(n<0&&!he(!He));He=!1){var Qe=V.text.charAt(t.ch)||`
`,at=rt(Qe,ke)?"w":_e&&Qe==`
`?"n":!_e||/\s/.test(Qe)?null:"p";if(_e&&!He&&!at&&(at="s"),me&&me!=at){n<0&&(n=1,he(),t.sticky="after");break}if(at&&(me=at),n>0&&!he(!He))break}var mt=Po(e,t,C,U,!0);return si(C,mt)&&(mt.hitSide=!0),mt}function cl(e,t,n,r){var i=e.doc,C=t.left,U;if(r=="page"){var V=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),$=Math.max(V-.5*Yr(e.display),3);U=(n>0?t.bottom:t.top)+n*$}else r=="line"&&(U=n>0?t.bottom+3:t.top-3);for(var J;!(J=sr(e,C,U),!J.outside);){if(n<0?U<=0:U>=i.height){J.hitSide=!0;break}U+=n*5}return J}var kr=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new de,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};kr.prototype.init=function(e){var t=this,n=this,r=n.cm,i=n.div=e.lineDiv;ul(i,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function C(V){for(var $=V.target;$;$=$.parentNode){if($==i)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test($.className))break}return!1}Ne(i,"paste",function(V){if(!C(V)||Ze(r,V)||ol(V,r))return;W<=11&&setTimeout(Zr(r,function(){return t.updateFromDOM()}),20)}),Ne(i,"compositionstart",function(V){t.composing={data:V.data,done:!1}}),Ne(i,"compositionupdate",function(V){t.composing||(t.composing={data:V.data,done:!1})}),Ne(i,"compositionend",function(V){t.composing&&(V.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Ne(i,"touchstart",function(){return n.forceCompositionEnd()}),Ne(i,"input",function(){t.composing||t.readFromDOMSoon()});function U(V){if(!C(V)||Ze(r,V))return;if(r.somethingSelected())jo({lineWise:!1,text:r.getSelections()}),V.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var $=ll(r);jo({lineWise:!0,text:$.text}),V.type=="cut"&&r.operation(function(){r.setSelections($.ranges,0,Me),r.replaceSelection("",null,"cut")})}else return;if(V.clipboardData){V.clipboardData.clearData();var J=Ei.text.join(`
`);if(V.clipboardData.setData("Text",J),V.clipboardData.getData("Text")==J){V.preventDefault();return}}var he=dl(),me=he.firstChild;r.display.lineSpace.insertBefore(he,r.display.lineSpace.firstChild),me.value=Ei.text.join(`
`);var _e=document.activeElement;ee(me),setTimeout(function(){r.display.lineSpace.removeChild(he),_e.focus(),_e==i&&n.showPrimarySelection()},50)}Ne(i,"copy",U),Ne(i,"cut",U)},kr.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},kr.prototype.prepareSelection=function(){var e=di(this.cm,!1);return e.focus=document.activeElement==this.div,e},kr.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},kr.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},kr.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,n=t.doc.sel.primary(),r=n.from(),i=n.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||i.line<t.display.viewFrom){e.removeAllRanges();return}var C=Wo(t,e.anchorNode,e.anchorOffset),U=Wo(t,e.focusNode,e.focusOffset);if(C&&!C.bad&&U&&!U.bad&&jt(li(C,U),r)==0&&jt(Si(C,U),i)==0)return;var V=t.display.view,$=r.line>=t.display.viewFrom&&hl(t,r)||{node:V[0].measure.map[2],offset:0},J=i.line<t.display.viewTo&&hl(t,i);if(!J){var he=V[V.length-1].measure,me=he.maps?he.maps[he.maps.length-1]:he.map;J={node:me[me.length-1],offset:me[me.length-2]-me[me.length-3]}}if(!$||!J){e.removeAllRanges();return}var _e=e.rangeCount&&e.getRangeAt(0),ke;try{ke=v($.node,$.offset,J.offset,J.node)}catch(He){}ke&&(!D&&t.state.focused?(e.collapse($.node,$.offset),ke.collapsed||(e.removeAllRanges(),e.addRange(ke))):(e.removeAllRanges(),e.addRange(ke)),_e&&e.anchorNode==null?e.addRange(_e):D&&this.startGracePeriod()),this.rememberSelection()},kr.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)},kr.prototype.showMultipleSelections=function(e){c(this.cm.display.cursorDiv,e.cursors),c(this.cm.display.selectionDiv,e.selection)},kr.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},kr.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return T(this.div,t)},kr.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},kr.prototype.blur=function(){this.div.blur()},kr.prototype.getField=function(){return this.div},kr.prototype.supportsTouch=function(){return!0},kr.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():Rn(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)},kr.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},kr.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(u&&b&&this.cm.display.gutterSpecs.length&&eu(e.anchorNode)){this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus();return}if(this.composing)return;this.rememberSelection();var n=Wo(t,e.anchorNode,e.anchorOffset),r=Wo(t,e.focusNode,e.focusOffset);n&&r&&Rn(t,function(){kn(t.doc,bi(n,r),Me),(n.bad||r.bad)&&(t.curOp.selectionChanged=!0)})},kr.prototype.pollContent=function(){this.readDOMTimeout!=null&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,t=e.display,n=e.doc.sel.primary(),r=n.from(),i=n.to();if(r.ch==0&&r.line>e.firstLine()&&(r=Je(r.line-1,wt(e.doc,r.line-1).length)),i.ch==wt(e.doc,i.line).text.length&&i.line<e.lastLine()&&(i=Je(i.line+1,0)),r.line<t.viewFrom||i.line>t.viewTo-1)return!1;var C,U,V;r.line==t.viewFrom||(C=Mr(e,r.line))==0?(U=nr(t.view[0].line),V=t.view[0].node):(U=nr(t.view[C].line),V=t.view[C-1].node.nextSibling);var $=Mr(e,i.line),J,he;if($==t.view.length-1?(J=t.viewTo-1,he=t.lineDiv.lastChild):(J=nr(t.view[$+1].line)-1,he=t.view[$+1].node.previousSibling),!V)return!1;for(var me=e.doc.splitLines(tu(e,V,he,U,J)),_e=Vn(e.doc,Je(U,0),Je(J,wt(e.doc,J).text.length));me.length>1&&_e.length>1;)if(Fe(me)==Fe(_e))me.pop(),_e.pop(),J--;else if(me[0]==_e[0])me.shift(),_e.shift(),U++;else break;for(var ke=0,He=0,Qe=me[0],at=_e[0],mt=Math.min(Qe.length,at.length);ke<mt&&Qe.charCodeAt(ke)==at.charCodeAt(ke);)++ke;for(var St=Fe(me),gt=Fe(_e),Tt=Math.min(St.length-(me.length==1?ke:0),gt.length-(_e.length==1?ke:0));He<Tt&&St.charCodeAt(St.length-He-1)==gt.charCodeAt(gt.length-He-1);)++He;if(me.length==1&&_e.length==1&&U==r.line)for(;ke&&ke>r.ch&&St.charCodeAt(St.length-He-1)==gt.charCodeAt(gt.length-He-1);)ke--,He++;me[me.length-1]=St.slice(0,St.length-He).replace(/^\u200b+/,""),me[0]=me[0].slice(ke).replace(/\u200b+$/,"");var Ht=Je(U,ke),Ut=Je(J,_e.length?Fe(_e).length-He:0);if(me.length>1||me[0]||jt(Ht,Ut))return Da(e.doc,me,Ht,Ut,"+input"),!0},kr.prototype.ensurePolled=function(){this.forceCompositionEnd()},kr.prototype.reset=function(){this.forceCompositionEnd()},kr.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},kr.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)},kr.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&Rn(this.cm,function(){return Or(e.cm)})},kr.prototype.setUneditable=function(e){e.contentEditable="false"},kr.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||Zr(this.cm,hs)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},kr.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},kr.prototype.onContextMenu=function(){},kr.prototype.resetPosition=function(){},kr.prototype.needsContentAttribute=!0;function hl(e,t){var n=Le(e,t.line);if(!n||n.hidden)return null;var r=wt(e.doc,t.line),i=q(n,r,t.line),C=vt(r,e.doc.direction),U="left";if(C){var V=nt(C,t.ch);U=V%2?"right":"left"}var $=tt(i.map,t.ch,U);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 Ia(e,t){return t&&(e.bad=!0),e}function tu(e,t,n,r,i){var C="",U=!1,V=e.doc.lineSeparator(),$=!1;function J(ke){return function(He){return He.id==ke}}function he(){U&&(C+=V,$&&(C+=V),U=$=!1)}function me(ke){ke&&(he(),C+=ke)}function _e(ke){if(ke.nodeType==1){var He=ke.getAttribute("cm-text");if(He){me(He);return}var Qe=ke.getAttribute("cm-marker"),at;if(Qe){var mt=e.findMarks(Je(r,0),Je(i+1,0),J(+Qe));mt.length&&(at=mt[0].find(0))&&me(Vn(e.doc,at.from,at.to).join(V));return}if(ke.getAttribute("contenteditable")=="false")return;var St=/^(pre|div|p|li|table|br)$/i.test(ke.nodeName);if(!/^br$/i.test(ke.nodeName)&&ke.textContent.length==0)return;St&&he();for(var gt=0;gt<ke.childNodes.length;gt++)_e(ke.childNodes[gt]);/^(pre|p)$/i.test(ke.nodeName)&&($=!0),St&&(U=!0)}else ke.nodeType==3&&me(ke.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(_e(t),t==n);)t=t.nextSibling,$=!1;return C}function Wo(e,t,n){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[n],!r)return Ia(e.clipPos(Je(e.display.viewTo-1)),!0);t=null,n=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 i=0;i<e.display.view.length;i++){var C=e.display.view[i];if(C.node==r)return ru(C,t,n)}}function ru(e,t,n){var r=e.text.firstChild,i=!1;if(!t||!T(r,t))return Ia(Je(nr(e.line),0),!0);if(t==r&&(i=!0,t=r.childNodes[n],n=0,!t)){var C=e.rest?Fe(e.rest):e.line;return Ia(Je(nr(C),C.text.length),i)}var U=t.nodeType==3?t:null,V=t;for(!U&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(U=t.firstChild,n&&(n=U.nodeValue.length));V.parentNode!=r;)V=V.parentNode;var $=e.measure,J=$.maps;function he(at,mt,St){for(var gt=-1;gt<(J?J.length:0);gt++)for(var Tt=gt<0?$.map:J[gt],Ht=0;Ht<Tt.length;Ht+=3){var Ut=Tt[Ht+2];if(Ut==at||Ut==mt){var tr=nr(gt<0?e.line:e.rest[gt]),Rr=Tt[Ht]+St;return(St<0||Ut!=at)&&(Rr=Tt[Ht+(St?1:0)]),Je(tr,Rr)}}}var me=he(U,V,n);if(me)return Ia(me,i);for(var _e=V.nextSibling,ke=U?U.nodeValue.length-n:0;_e;_e=_e.nextSibling){if(me=he(_e,_e.firstChild,0),me)return Ia(Je(me.line,me.ch-ke),i);ke+=_e.textContent.length}for(var He=V.previousSibling,Qe=n;He;He=He.previousSibling){if(me=he(He,He.firstChild,-1),me)return Ia(Je(me.line,me.ch+Qe),i);Qe+=He.textContent.length}}var qr=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new de,this.hasSelection=!1,this.composing=null};qr.prototype.init=function(e){var t=this,n=this,r=this.cm;this.createField(e);var i=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),y&&(i.style.width="0px"),Ne(i,"input",function(){H&&W>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),Ne(i,"paste",function(U){if(Ze(r,U)||ol(U,r))return;r.state.pasteIncoming=+new Date,n.fastPoll()});function C(U){if(Ze(r,U))return;if(r.somethingSelected())jo({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var V=ll(r);jo({lineWise:!0,text:V.text}),U.type=="cut"?r.setSelections(V.ranges,null,Me):(n.prevInput="",i.value=V.text.join(`
`),ee(i))}else return;U.type=="cut"&&(r.state.cutIncoming=+new Date)}Ne(i,"cut",C),Ne(i,"copy",C),Ne(e.scroller,"paste",function(U){if(vi(e,U)||Ze(r,U))return;if(!i.dispatchEvent){r.state.pasteIncoming=+new Date,n.focus();return}var V=new Event("paste");V.clipboardData=U.clipboardData,i.dispatchEvent(V)}),Ne(e.lineSpace,"selectstart",function(U){vi(e,U)||re(U)}),Ne(i,"compositionstart",function(){var U=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:U,range:r.markText(U,r.getCursor("to"),{className:"CodeMirror-composing"})}}),Ne(i,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},qr.prototype.createField=function(e){this.wrapper=dl(),this.textarea=this.wrapper.firstChild},qr.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},qr.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=di(e);if(e.options.moveInputWithCursor){var i=or(e,n.sel.primary().head,"div"),C=t.wrapper.getBoundingClientRect(),U=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+U.top-C.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+U.left-C.left))}return r},qr.prototype.showSelection=function(e){var t=this.cm,n=t.display;c(n.cursorDiv,e.cursors),c(n.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},qr.prototype.reset=function(e){if(this.contextMenuPending||this.composing)return;var t=this.cm;if(t.somethingSelected()){this.prevInput="";var n=t.getSelection();this.textarea.value=n,t.state.focused&&ee(this.textarea),H&&W>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",H&&W>=9&&(this.hasSelection=null))},qr.prototype.getField=function(){return this.textarea},qr.prototype.supportsTouch=function(){return!1},qr.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!a||N()!=this.textarea))try{this.textarea.focus()}catch(e){}},qr.prototype.blur=function(){this.textarea.blur()},qr.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},qr.prototype.receivedFocus=function(){this.slowPoll()},qr.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()})},qr.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function n(){var r=t.poll();!r&&!e?(e=!0,t.polling.set(60,n)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,n)},qr.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||Ct(n)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=n.value;if(i==r&&!t.somethingSelected())return!1;if(H&&W>=9&&this.hasSelection===i||s&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var C=i.charCodeAt(0);if(C==8203&&!r&&(r="\u200B"),C==8666)return this.reset(),this.cm.execCommand("undo")}for(var U=0,V=Math.min(r.length,i.length);U<V&&r.charCodeAt(U)==i.charCodeAt(U);)++U;return Rn(t,function(){hs(t,i.slice(U),r.length-U,null,e.composing?"*compose":null),i.length>1e3||i.indexOf(`
`)>-1?n.value=e.prevInput="":e.prevInput=i,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},qr.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},qr.prototype.onKeyPress=function(){H&&W>=9&&(this.hasSelection=null),this.fastPoll()},qr.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var C=dn(n,e),U=r.scroller.scrollTop;if(!C||A)return;var V=n.options.resetSelectionOnContextMenu;V&&n.doc.sel.contains(C)==-1&&Zr(n,kn)(n.doc,bi(C),Me);var $=i.style.cssText,J=t.wrapper.style.cssText,he=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",i.style.cssText=`position: absolute; width: 30px; height: 30px;
top: `+(e.clientY-he.top-5)+"px; left: "+(e.clientX-he.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 me;I&&(me=window.scrollY),r.input.focus(),I&&window.scrollTo(null,me),r.input.reset(),n.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=ke,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll);function _e(){if(i.selectionStart!=null){var Qe=n.somethingSelected(),at="\u200B"+(Qe?i.value:"");i.value="\u21DA",i.value=at,t.prevInput=Qe?"":"\u200B",i.selectionStart=1,i.selectionEnd=at.length,r.selForContextMenu=n.doc.sel}}function ke(){if(t.contextMenuPending!=ke)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=J,i.style.cssText=$,H&&W<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=U),i.selectionStart!=null){(!H||H&&W<9)&&_e();var Qe=0,at=function(){r.selForContextMenu==n.doc.sel&&i.selectionStart==0&&i.selectionEnd>0&&t.prevInput=="\u200B"?Zr(n,Ds)(n):Qe++<10?r.detectingSelectAll=setTimeout(at,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(at,200)}}if(H&&W>=9&&_e(),k){ge(e);var He=function(){Et(window,"mouseup",He),setTimeout(ke,20)};Ne(window,"mouseup",He)}else setTimeout(ke,50)},qr.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},qr.prototype.setUneditable=function(){},qr.prototype.needsContentAttribute=!1;function nu(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 n=N();t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}function r(){e.value=V.getValue()}var i;if(e.form&&(Ne(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var C=e.form;i=C.submit;try{var U=C.submit=function(){r(),C.submit=i,C.submit(),C.submit=U}}catch($){}}t.finishInit=function($){$.save=r,$.getTextArea=function(){return e},$.toTextArea=function(){$.toTextArea=isNaN,r(),e.parentNode.removeChild($.getWrapperElement()),e.style.display="",e.form&&(Et(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=i))}},e.style.display="none";var V=Hr(function($){return e.parentNode.insertBefore($,e.nextSibling)},t);return V}function iu(e){e.off=Et,e.on=Ne,e.wheelEventPixels=Ja,e.Doc=Hn,e.splitLines=Kt,e.countColumn=te,e.findColumn=Pe,e.isWordChar=Ye,e.Pass=Ge,e.signal=We,e.Line=Ui,e.changeEnd=xi,e.scrollbarModel=$a,e.Pos=Je,e.cmpPos=jt,e.modes=Pr,e.mimeModes=Vt,e.resolveMode=It,e.getMode=An,e.modeExtensions=on,e.extendMode=sn,e.copyState=Un,e.startState=Qn,e.innerMode=ci,e.commands=co,e.keyMap=Ki,e.keyName=Vs,e.isModifierKey=zs,e.lookupKey=Ma,e.normalizeKeyMap=Rl,e.StringStream=mr,e.SharedTextMarker=so,e.TextMarker=na,e.LineWidget=oo,e.e_preventDefault=re,e.e_stopPropagation=ie,e.e_stop=ge,e.addClass=z,e.contains=T,e.rmClass=h,e.keyNames=ia}$l(Hr),ql(Hr);var au="iter insert remove copy getEditor constructor".split(" ");for(var Ho in Hn.prototype)Hn.prototype.hasOwnProperty(Ho)&&be(au,Ho)<0&&(Hr.prototype[Ho]=function(e){return function(){return e.apply(this.doc,arguments)}}(Hn.prototype[Ho]));return Ee(Hn),Hr.inputStyles={textarea:qr,contenteditable:kr},Hr.defineMode=function(e){!Hr.defaults.mode&&e!="null"&&(Hr.defaults.mode=e),an.apply(this,arguments)},Hr.defineMIME=En,Hr.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Hr.defineMIME("text/plain","null"),Hr.defineExtension=function(e,t){Hr.prototype[e]=t},Hr.defineDocExtension=function(e,t){Hn.prototype[e]=t},Hr.fromTextArea=nu,iu(Hr),Hr.version="5.58.2",Hr})},Y1PL:function(Ft,yt,ne){"use strict";ne.r(yt),ne.d(yt,"ResizableTextArea",function(){return be});var ae=ne("wx14"),X=ne("1OyB"),D=ne("vuIU"),K=ne("Ji7U"),w=ne("LK+K"),P=ne("q1tI"),H=ne("VTBJ"),W=ne("rePB"),I=ne("Zm9Q"),M=ne("Kwbf"),b=ne("c+Xe"),A=ne("m+aA"),_=ne("bdgK"),O=new Map;function L(Me){Me.forEach(function(Ie){var Ue,Pe=Ie.target;(Ue=O.get(Pe))===null||Ue===void 0||Ue.forEach(function(Te){return Te(Pe)})})}var y=new _.default(L),u=null,a=null;function s(Me,Ie){O.has(Me)||(O.set(Me,new Set),y.observe(Me)),O.get(Me).add(Ie)}function d(Me,Ie){O.has(Me)&&(O.get(Me).delete(Ie),O.get(Me).size||(y.unobserve(Me),O.delete(Me)))}var E=function(Me){Object(K.a)(Ue,Me);var Ie=Object(w.a)(Ue);function Ue(){return Object(X.a)(this,Ue),Ie.apply(this,arguments)}return Object(D.a)(Ue,[{key:"render",value:function(){return this.props.children}}]),Ue}(P.Component),g=P.createContext(null);function m(Me){var Ie=Me.children,Ue=Me.onBatchResize,Pe=P.useRef(0),Te=P.useRef([]),se=P.useContext(g),Fe=P.useCallback(function(dt,it,ot){Pe.current+=1;var ct=Pe.current;Te.current.push({size:dt,element:it,data:ot}),Promise.resolve().then(function(){ct===Pe.current&&(Ue==null||Ue(Te.current),Te.current=[])}),se==null||se(dt,it,ot)},[Ue,se]);return P.createElement(g.Provider,{value:Fe},Ie)}function k(Me){var Ie=Me.children,Ue=Me.disabled,Pe=P.useRef(null),Te=P.useRef(null),se=P.useContext(g),Fe=P.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),dt=P.isValidElement(Ie)&&Object(b.c)(Ie),it=dt?Ie.ref:null,ot=P.useMemo(function(){return Object(b.a)(it,Pe)},[it,Pe]),ct=P.useRef(Me);ct.current=Me;var je=P.useCallback(function(Ye){var rt=ct.current,st=rt.onResize,qe=rt.data,Ve=Ye.getBoundingClientRect(),Ke=Ve.width,ht=Ve.height,ut=Ye.offsetWidth,ft=Ye.offsetHeight,nt=Math.floor(Ke),Lt=Math.floor(ht);if(Fe.current.width!==nt||Fe.current.height!==Lt||Fe.current.offsetWidth!==ut||Fe.current.offsetHeight!==ft){var vt={width:nt,height:Lt,offsetWidth:ut,offsetHeight:ft};Fe.current=vt;var bt=ut===Math.round(Ke)?Ke:ut,Ne=ft===Math.round(ht)?ht:ft,Ot=Object(H.a)(Object(H.a)({},vt),{},{offsetWidth:bt,offsetHeight:Ne});se==null||se(Ot,Ye,qe),st&&Promise.resolve().then(function(){st(Ot,Ye)})}},[]);return P.useEffect(function(){var Ye=Object(A.a)(Pe.current)||Object(A.a)(Te.current);return Ye&&!Ue&&s(Ye,je),function(){return d(Ye,je)}},[Pe.current,Ue]),P.createElement(E,{ref:Te},dt?P.cloneElement(Ie,{ref:ot}):Ie)}var x="rc-observer-key";function h(Me){var Ie=Me.children,Ue=Object(I.a)(Ie);return Ue.map(function(Pe,Te){var se=(Pe==null?void 0:Pe.key)||"".concat(x,"-").concat(Te);return P.createElement(k,Object(ae.a)({},Me,{key:se}),Pe)})}h.Collection=m;var p=h,c=ne("bT9E"),o=ne("TSYQ"),S=ne.n(o),v=`
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
`,T=["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"],N={},z;function Y(Me){var Ie=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Ue=Me.getAttribute("id")||Me.getAttribute("data-reactid")||Me.getAttribute("name");if(Ie&&N[Ue])return N[Ue];var Pe=window.getComputedStyle(Me),Te=Pe.getPropertyValue("box-sizing")||Pe.getPropertyValue("-moz-box-sizing")||Pe.getPropertyValue("-webkit-box-sizing"),se=parseFloat(Pe.getPropertyValue("padding-bottom"))+parseFloat(Pe.getPropertyValue("padding-top")),Fe=parseFloat(Pe.getPropertyValue("border-bottom-width"))+parseFloat(Pe.getPropertyValue("border-top-width")),dt=T.map(function(ot){return"".concat(ot,":").concat(Pe.getPropertyValue(ot))}).join(";"),it={sizingStyle:dt,paddingSize:se,borderSize:Fe,boxSizing:Te};return Ie&&Ue&&(N[Ue]=it),it}function ee(Me){var Ie=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Ue=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,Pe=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;z||(z=document.createElement("textarea"),z.setAttribute("tab-index","-1"),z.setAttribute("aria-hidden","true"),document.body.appendChild(z)),Me.getAttribute("wrap")?z.setAttribute("wrap",Me.getAttribute("wrap")):z.removeAttribute("wrap");var Te=Y(Me,Ie),se=Te.paddingSize,Fe=Te.borderSize,dt=Te.boxSizing,it=Te.sizingStyle;z.setAttribute("style","".concat(it,";").concat(v)),z.value=Me.value||Me.placeholder||"";var ot=Number.MIN_SAFE_INTEGER,ct=Number.MAX_SAFE_INTEGER,je=z.scrollHeight,Ye;if(dt==="border-box"?je+=Fe:dt==="content-box"&&(je-=se),Ue!==null||Pe!==null){z.value=" ";var rt=z.scrollHeight-se;Ue!==null&&(ot=rt*Ue,dt==="border-box"&&(ot=ot+se+Fe),je=Math.max(ot,je)),Pe!==null&&(ct=rt*Pe,dt==="border-box"&&(ct=ct+se+Fe),Ye=je>ct?"":"hidden",je=Math.min(ct,je))}return{height:je,minHeight:ot,maxHeight:ct,overflowY:Ye,resize:"none"}}var G=ne("Gytx"),j=ne.n(G),te;(function(Me){Me[Me.NONE=0]="NONE",Me[Me.RESIZING=1]="RESIZING",Me[Me.RESIZED=2]="RESIZED"})(te||(te={}));var de=function(Me){Object(K.a)(Ue,Me);var Ie=Object(w.a)(Ue);function Ue(Pe){var Te;return Object(X.a)(this,Ue),Te=Ie.call(this,Pe),Te.nextFrameActionId=void 0,Te.resizeFrameId=void 0,Te.textArea=void 0,Te.saveTextArea=function(se){Te.textArea=se},Te.handleResize=function(se){var Fe=Te.state.resizeStatus,dt=Te.props,it=dt.autoSize,ot=dt.onResize;if(Fe!==te.NONE)return;typeof ot=="function"&&ot(se),it&&Te.resizeOnNextFrame()},Te.resizeOnNextFrame=function(){cancelAnimationFrame(Te.nextFrameActionId),Te.nextFrameActionId=requestAnimationFrame(Te.resizeTextarea)},Te.resizeTextarea=function(){var se=Te.props.autoSize;if(!se||!Te.textArea)return;var Fe=se.minRows,dt=se.maxRows,it=ee(Te.textArea,!1,Fe,dt);Te.setState({textareaStyles:it,resizeStatus:te.RESIZING},function(){cancelAnimationFrame(Te.resizeFrameId),Te.resizeFrameId=requestAnimationFrame(function(){Te.setState({resizeStatus:te.RESIZED},function(){Te.resizeFrameId=requestAnimationFrame(function(){Te.setState({resizeStatus:te.NONE}),Te.fixFirefoxAutoScroll()})})})})},Te.renderTextArea=function(){var se=Te.props,Fe=se.prefixCls,dt=Fe===void 0?"rc-textarea":Fe,it=se.autoSize,ot=se.onResize,ct=se.className,je=se.disabled,Ye=Te.state,rt=Ye.textareaStyles,st=Ye.resizeStatus,qe=Object(c.a)(Te.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Ve=S()(dt,ct,Object(W.a)({},"".concat(dt,"-disabled"),je));"value"in qe&&(qe.value=qe.value||"");var Ke=Object(H.a)(Object(H.a)(Object(H.a)({},Te.props.style),rt),st===te.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return P.createElement(p,{onResize:Te.handleResize,disabled:!(it||ot)},P.createElement("textarea",Object(ae.a)({},qe,{className:Ve,style:Ke,ref:Te.saveTextArea})))},Te.state={textareaStyles:{},resizeStatus:te.NONE},Te}return Object(D.a)(Ue,[{key:"componentDidUpdate",value:function(Te){(Te.value!==this.props.value||!j()(Te.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 Te=this.textArea.selectionStart,se=this.textArea.selectionEnd;this.textArea.setSelectionRange(Te,se)}}catch(Fe){}}},{key:"render",value:function(){return this.renderTextArea()}}]),Ue}(P.Component),be=de,Oe=function(Me){Object(K.a)(Ue,Me);var Ie=Object(w.a)(Ue);function Ue(Pe){var Te;Object(X.a)(this,Ue),Te=Ie.call(this,Pe),Te.resizableTextArea=void 0,Te.focus=function(){Te.resizableTextArea.textArea.focus()},Te.saveTextArea=function(Fe){Te.resizableTextArea=Fe},Te.handleChange=function(Fe){var dt=Te.props.onChange;Te.setValue(Fe.target.value,function(){Te.resizableTextArea.resizeTextarea()}),dt&&dt(Fe)},Te.handleKeyDown=function(Fe){var dt=Te.props,it=dt.onPressEnter,ot=dt.onKeyDown;Fe.keyCode===13&&it&&it(Fe),ot&&ot(Fe)};var se=typeof Pe.value=="undefined"||Pe.value===null?Pe.defaultValue:Pe.value;return Te.state={value:se},Te}return Object(D.a)(Ue,[{key:"setValue",value:function(Te,se){"value"in this.props||this.setState({value:Te},se)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return P.createElement(be,Object(ae.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(Te){return"value"in Te?{value:Te.value}:null}}]),Ue}(P.Component),Ge=yt.default=Oe},ZpRC:function(Ft,yt,ne){"use strict";function ae(b){return typeof b=="object"&&b!=null&&b.nodeType===1}function X(b,A){return(!A||b!=="hidden")&&b!=="visible"&&b!=="clip"}function D(b,A){if(b.clientHeight<b.scrollHeight||b.clientWidth<b.scrollWidth){var _=getComputedStyle(b,null);return X(_.overflowY,A)||X(_.overflowX,A)||function(O){var L=function(y){if(!y.ownerDocument||!y.ownerDocument.defaultView)return null;try{return y.ownerDocument.defaultView.frameElement}catch(u){return null}}(O);return!!L&&(L.clientHeight<O.scrollHeight||L.clientWidth<O.scrollWidth)}(b)}return!1}function K(b,A,_,O,L,y,u,a){return y<b&&u>A||y>b&&u<A?0:y<=b&&a<=_||u>=A&&a>=_?y-b-O:u>A&&a<_||y<b&&a>_?u-A+L:0}var w=function(b,A){var _=window,O=A.scrollMode,L=A.block,y=A.inline,u=A.boundary,a=A.skipOverflowHiddenElements,s=typeof u=="function"?u:function(rt){return rt!==u};if(!ae(b))throw new TypeError("Invalid target");for(var d=document.scrollingElement||document.documentElement,E=[],g=b;ae(g)&&s(g);){if((g=g.parentElement)===d){E.push(g);break}g!=null&&g===document.body&&D(g)&&!D(document.documentElement)||g!=null&&D(g,a)&&E.push(g)}for(var m=_.visualViewport?_.visualViewport.width:innerWidth,k=_.visualViewport?_.visualViewport.height:innerHeight,x=window.scrollX||pageXOffset,h=window.scrollY||pageYOffset,p=b.getBoundingClientRect(),c=p.height,o=p.width,S=p.top,v=p.right,T=p.bottom,N=p.left,z=L==="start"||L==="nearest"?S:L==="end"?T:S+c/2,Y=y==="center"?N+o/2:y==="end"?v:N,ee=[],G=0;G<E.length;G++){var j=E[G],te=j.getBoundingClientRect(),de=te.height,be=te.width,Oe=te.top,Ge=te.right,Me=te.bottom,Ie=te.left;if(O==="if-needed"&&S>=0&&N>=0&&T<=k&&v<=m&&S>=Oe&&T<=Me&&N>=Ie&&v<=Ge)return ee;var Ue=getComputedStyle(j),Pe=parseInt(Ue.borderLeftWidth,10),Te=parseInt(Ue.borderTopWidth,10),se=parseInt(Ue.borderRightWidth,10),Fe=parseInt(Ue.borderBottomWidth,10),dt=0,it=0,ot="offsetWidth"in j?j.offsetWidth-j.clientWidth-Pe-se:0,ct="offsetHeight"in j?j.offsetHeight-j.clientHeight-Te-Fe:0;if(d===j)dt=L==="start"?z:L==="end"?z-k:L==="nearest"?K(h,h+k,k,Te,Fe,h+z,h+z+c,c):z-k/2,it=y==="start"?Y:y==="center"?Y-m/2:y==="end"?Y-m:K(x,x+m,m,Pe,se,x+Y,x+Y+o,o),dt=Math.max(0,dt+h),it=Math.max(0,it+x);else{dt=L==="start"?z-Oe-Te:L==="end"?z-Me+Fe+ct:L==="nearest"?K(Oe,Me,de,Te,Fe+ct,z,z+c,c):z-(Oe+de/2)+ct/2,it=y==="start"?Y-Ie-Pe:y==="center"?Y-(Ie+be/2)+ot/2:y==="end"?Y-Ge+se+ot:K(Ie,Ge,be,Pe,se+ot,Y,Y+o,o);var je=j.scrollLeft,Ye=j.scrollTop;z+=Ye-(dt=Math.max(0,Math.min(Ye+dt,j.scrollHeight-de+ct))),Y+=je-(it=Math.max(0,Math.min(je+it,j.scrollWidth-be+ot)))}ee.push({el:j,top:dt,left:it})}return ee};function P(b){return b===Object(b)&&Object.keys(b).length!==0}function H(b,A){A===void 0&&(A="auto");var _="scrollBehavior"in document.body.style;b.forEach(function(O){var L=O.el,y=O.top,u=O.left;L.scroll&&_?L.scroll({top:y,left:u,behavior:A}):(L.scrollTop=y,L.scrollLeft=u)})}function W(b){return b===!1?{block:"end",inline:"nearest"}:P(b)?b:{block:"start",inline:"nearest"}}function I(b,A){var _=!b.ownerDocument.documentElement.contains(b);if(P(A)&&typeof A.behavior=="function")return A.behavior(_?[]:w(b,A));if(_)return;var O=W(A);return H(w(b,O),O.behavior)}var M=yt.a=I},bT9E:function(Ft,yt,ne){"use strict";ne.d(yt,"a",function(){return X});var ae=ne("VTBJ");function X(D,K){var w=Object(ae.a)({},D);return Array.isArray(K)&&K.forEach(function(P){delete w[P]}),w}},c5Ni:function(Ft,yt,ne){},dejd:function(Ft,yt,ne){},dmUQ:function(Ft,yt,ne){"use strict";var ae=ne("Ff2n"),X=ne("rePB"),D=ne("1OyB"),K=ne("vuIU"),w=ne("Ji7U"),P=ne("md7G"),H=ne("foSv"),W=ne("q1tI"),I=ne.n(W),M=ne("TSYQ"),b=ne.n(M),A=ne("4IlW");function _(c,o){var S=Object.keys(c);if(Object.getOwnPropertySymbols){var v=Object.getOwnPropertySymbols(c);o&&(v=v.filter(function(T){return Object.getOwnPropertyDescriptor(c,T).enumerable})),S.push.apply(S,v)}return S}function O(c){for(var o=1;o<arguments.length;o++){var S=arguments[o]!=null?arguments[o]:{};o%2?_(Object(S),!0).forEach(function(v){Object(X.a)(c,v,S[v])}):Object.getOwnPropertyDescriptors?Object.defineProperties(c,Object.getOwnPropertyDescriptors(S)):_(Object(S)).forEach(function(v){Object.defineProperty(c,v,Object.getOwnPropertyDescriptor(S,v))})}return c}function L(c){var o=y();return function(){var v=Object(H.a)(c),T;if(o){var N=Object(H.a)(this).constructor;T=Reflect.construct(v,arguments,N)}else T=v.apply(this,arguments);return Object(P.a)(this,T)}}function y(){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(c){return!1}}function u(){}function a(c){c.preventDefault()}var s=function(o){return o.replace(/[^\w.-]+/g,"")},d=200,E=600,g=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,m=function(o){return o!=null},k=function(o,S){return S===o||typeof S=="number"&&typeof o=="number"&&isNaN(S)&&isNaN(o)},x=function(c){Object(w.a)(S,c);var o=L(S);function S(v){var T;Object(D.a)(this,S),T=o.call(this,v),T.onKeyDown=function(Y){var ee=T.props,G=ee.onKeyDown,j=ee.onPressEnter;if(Y.keyCode===A.a.UP){var te=T.getRatio(Y);T.up(Y,te,null),T.stop()}else if(Y.keyCode===A.a.DOWN){var de=T.getRatio(Y);T.down(Y,de,null),T.stop()}else Y.keyCode===A.a.ENTER&&j&&j(Y);if(T.recordCursorPosition(),T.lastKeyCode=Y.keyCode,G){for(var be=arguments.length,Oe=new Array(be>1?be-1:0),Ge=1;Ge<be;Ge++)Oe[Ge-1]=arguments[Ge];G.apply(void 0,[Y].concat(Oe))}},T.onKeyUp=function(Y){var ee=T.props.onKeyUp;if(T.stop(),T.recordCursorPosition(),ee){for(var G=arguments.length,j=new Array(G>1?G-1:0),te=1;te<G;te++)j[te-1]=arguments[te];ee.apply(void 0,[Y].concat(j))}},T.onChange=function(Y){var ee=T.props.onChange;T.state.focused&&(T.inputting=!0),T.rawInput=T.props.parser(T.getValueFromEvent(Y)),T.setState({inputValue:T.rawInput}),ee(T.toNumber(T.rawInput))},T.onMouseUp=function(){var Y=T.props.onMouseUp;T.recordCursorPosition(),Y&&Y.apply(void 0,arguments)},T.onFocus=function(){var Y;T.setState({focused:!0}),(Y=T.props).onFocus.apply(Y,arguments)},T.onBlur=function(){var Y=T.props.onBlur;T.inputting=!1,T.setState({focused:!1});var ee=T.getCurrentValidValue(T.state.inputValue),G=T.setValue(ee,u);if(Y){var j=T.input.value,te=T.getInputDisplayValue({focus:!1,value:G});T.input.value=te&&Number(te),Y.apply(void 0,arguments),T.input.value=j}},T.getRatio=function(Y){var ee=1;return Y.metaKey||Y.ctrlKey?ee=.1:Y.shiftKey&&(ee=10),ee},T.getFullNum=function(Y){return isNaN(Y)?Y:/e/i.test(String(Y))?Number(Y).toFixed(18).replace(/\.?0+$/,""):Y},T.getPrecision=function(Y){if(m(T.props.precision))return T.props.precision;var ee=String(Y);if(ee.indexOf("e-")>=0)return parseInt(ee.slice(ee.indexOf("e-")+2),10);var G=0;return ee.indexOf(".")>=0&&(G=ee.length-ee.indexOf(".")-1),G},T.getInputDisplayValue=function(Y){var ee=Y||T.state,G=ee.focused,j=ee.inputValue,te=ee.value,de;G?de=j:de=T.toPrecisionAsStep(te),de==null&&(de="");var be=T.formatWrapper(de);return m(T.props.decimalSeparator)&&(be=be.toString().replace(".",T.props.decimalSeparator)),be},T.recordCursorPosition=function(){try{T.cursorStart=T.input.selectionStart,T.cursorEnd=T.input.selectionEnd,T.currentValue=T.input.value,T.cursorBefore=T.input.value.substring(0,T.cursorStart),T.cursorAfter=T.input.value.substring(T.cursorEnd)}catch(Y){}},T.restoreByAfter=function(Y){if(Y===void 0)return!1;var ee=T.input.value,G=ee.lastIndexOf(Y);if(G===-1)return!1;var j=T.cursorBefore.length;return T.lastKeyCode===A.a.DELETE&&T.cursorBefore.charAt(j-1)===Y[0]?(T.fixCaret(j,j),!0):G+Y.length===ee.length?(T.fixCaret(G,G),!0):!1},T.partRestoreByAfter=function(Y){return Y===void 0?!1:Array.prototype.some.call(Y,function(ee,G){var j=Y.substring(G);return T.restoreByAfter(j)})},T.isNotCompleteNumber=function(Y){return isNaN(Y)||Y===""||Y===null||Y&&Y.toString().indexOf(".")===Y.toString().length-1},T.stop=function(){T.autoStepTimer&&clearTimeout(T.autoStepTimer)},T.down=function(Y,ee,G){T.pressingUpOrDown=!0,T.step("down",Y,ee,G)},T.up=function(Y,ee,G){T.pressingUpOrDown=!0,T.step("up",Y,ee,G)},T.saveInput=function(Y){T.input=Y};var N=v.value;N===void 0&&(N=v.defaultValue),T.state={focused:v.autoFocus};var z=T.getValidValue(T.toNumber(N));return T.state=O(O({},T.state),{},{inputValue:T.toPrecisionAsStep(z),value:z}),T}return Object(K.a)(S,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(T){var N=this.props,z=N.value,Y=N.onChange,ee=N.max,G=N.min,j=this.state.focused;if(T){if(!k(T.value,z)||!k(T.max,ee)||!k(T.min,G)){var te=j?z:this.getValidValue(z),de;this.pressingUpOrDown?de=te:this.inputting?de=this.rawInput:de=this.toPrecisionAsStep(te),this.setState({value:te,inputValue:de})}var be="value"in this.props?z:this.state.value;"max"in this.props&&T.max!==ee&&typeof be=="number"&&be>ee&&Y&&Y(ee),"min"in this.props&&T.min!==G&&typeof be=="number"&&be<G&&Y&&Y(G)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var Oe=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===A.a.BACKSPACE?Oe=this.cursorStart-1:this.lastKeyCode===A.a.DELETE&&(Oe=this.cursorStart):Oe=this.input.value.length,this.fixCaret(Oe,Oe)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case A.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case A.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(Ge){}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(T){var N=T;return N===""?N="":this.isNotCompleteNumber(parseFloat(N))?N=this.state.value:N=this.getValidValue(N),this.toNumber(N)}},{key:"getValueFromEvent",value:function(T){var N=T.target.value.trim().replace(/。/g,".");return m(this.props.decimalSeparator)&&(N=N.replace(this.props.decimalSeparator,".")),N}},{key:"getValidValue",value:function(T){var N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,z=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,Y=parseFloat(T);return isNaN(Y)?T:(Y<N&&(Y=N),Y>z&&(Y=z),Y)}},{key:"setValue",value:function(T,N){var z=this.props.precision,Y=this.isNotCompleteNumber(parseFloat(T))?null:parseFloat(T),ee=this.state.value,G=ee===void 0?null:ee,j=this.state.inputValue,te=j===void 0?null:j,de=typeof Y=="number"?Y.toFixed(z):"".concat(Y),be=Y!==G||de!=="".concat(te);return"value"in this.props?(te=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:te},N)):this.setState({value:Y,inputValue:this.toPrecisionAsStep(T)},N),be&&this.props.onChange(Y),Y}},{key:"getMaxPrecision",value:function(T){var N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,z=this.props,Y=z.precision,ee=z.step;if(m(Y))return Y;var G=this.getPrecision(N),j=this.getPrecision(ee),te=this.getPrecision(T);return T?Math.max(te,G+j):G+j}},{key:"getPrecisionFactor",value:function(T){var N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,z=this.getMaxPrecision(T,N);return Math.pow(10,z)}},{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(T){return this.props.formatter?this.props.formatter(T):T}},{key:"toPrecisionAsStep",value:function(T){if(this.isNotCompleteNumber(T)||T==="")return T;var N=Math.abs(this.getMaxPrecision(T));return isNaN(N)?T.toString():Number(T).toFixed(N)}},{key:"toNumber",value:function(T){var N=this.props.precision,z=this.state.focused,Y=T&&T.length>16&&z;return this.isNotCompleteNumber(T)||Y?T:m(N)?Math.round(T*Math.pow(10,N))/Math.pow(10,N):Number(T)}},{key:"upStep",value:function(T,N){var z=this.props.step,Y=this.getPrecisionFactor(T,N),ee=Math.abs(this.getMaxPrecision(T,N)),G=((Y*T+Y*z*N)/Y).toFixed(ee);return this.toNumber(G)}},{key:"downStep",value:function(T,N){var z=this.props.step,Y=this.getPrecisionFactor(T,N),ee=Math.abs(this.getMaxPrecision(T,N)),G=((Y*T-Y*z*N)/Y).toFixed(ee);return this.toNumber(G)}},{key:"step",value:function(T,N){var z=this,Y=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,ee=arguments.length>3?arguments[3]:void 0;this.stop(),N&&(N.persist(),N.preventDefault());var G=this.props;if(G.disabled)return;var j=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(j))return;var te=this["".concat(T,"Step")](j,Y),de=te>G.max||te<G.min;if(te>G.max?te=G.max:te<G.min&&(te=G.min),this.setValue(te,null),this.setState({focused:!0},function(){z.pressingUpOrDown=!1}),de)return;this.autoStepTimer=setTimeout(function(){z[T](N,Y,!0)},ee?d:E)}},{key:"fixCaret",value:function(T,N){if(T===void 0||N===void 0||!this.input||!this.input.value)return;try{var z=this.input.selectionStart,Y=this.input.selectionEnd;(T!==z||N!==Y)&&this.input.setSelectionRange(T,N)}catch(ee){}}},{key:"render",value:function(){var T,N=this.props,z=N.prefixCls,Y=N.disabled,ee=N.readOnly,G=N.useTouch,j=N.autoComplete,te=N.upHandler,de=N.downHandler,be=N.className,Oe=N.max,Ge=N.min,Me=N.style,Ie=N.title,Ue=N.onMouseEnter,Pe=N.onMouseLeave,Te=N.onMouseOver,se=N.onMouseOut,Fe=N.required,dt=N.onClick,it=N.tabIndex,ot=N.type,ct=N.placeholder,je=N.id,Ye=N.inputMode,rt=N.pattern,st=N.step,qe=N.maxLength,Ve=N.autoFocus,Ke=N.name,ht=N.onPaste,ut=N.onInput,ft=Object(ae.a)(N,["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"]),nt=this.state,Lt=nt.value,vt=nt.focused,bt=b()(z,(T={},Object(X.a)(T,be,!!be),Object(X.a)(T,"".concat(z,"-disabled"),Y),Object(X.a)(T,"".concat(z,"-focused"),vt),T)),Ne={};Object.keys(ft).forEach(function(ge){(ge.substr(0,5)==="data-"||ge.substr(0,5)==="aria-"||ge==="role")&&(Ne[ge]=ft[ge])});var Ot=!ee&&!Y,Et=this.getInputDisplayValue(null),We=(Lt||Lt===0)&&(isNaN(Lt)||Number(Lt)>=Oe),Ze=(Lt||Lt===0)&&(isNaN(Lt)||Number(Lt)<=Ge),we=We||Y||ee,ye=Ze||Y||ee,Ee=b()("".concat(z,"-handler"),"".concat(z,"-handler-up"),Object(X.a)({},"".concat(z,"-handler-up-disabled"),we)),re=b()("".concat(z,"-handler"),"".concat(z,"-handler-down"),Object(X.a)({},"".concat(z,"-handler-down-disabled"),ye)),ie=G?{onTouchStart:we?u:this.up,onTouchEnd:this.stop}:{onMouseDown:we?u:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},ue=G?{onTouchStart:ye?u:this.down,onTouchEnd:this.stop}:{onMouseDown:ye?u:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return I.a.createElement("div",{className:bt,style:Me,title:Ie,onMouseEnter:Ue,onMouseLeave:Pe,onMouseOver:Te,onMouseOut:se,onFocus:function(){return null},onBlur:function(){return null}},I.a.createElement("div",{className:"".concat(z,"-handler-wrap")},I.a.createElement("span",Object.assign({unselectable:"on"},ie,{role:"button","aria-label":"Increase Value","aria-disabled":we,className:Ee}),te||I.a.createElement("span",{unselectable:"on",className:"".concat(z,"-handler-up-inner"),onClick:a})),I.a.createElement("span",Object.assign({unselectable:"on"},ue,{role:"button","aria-label":"Decrease Value","aria-disabled":ye,className:re}),de||I.a.createElement("span",{unselectable:"on",className:"".concat(z,"-handler-down-inner"),onClick:a}))),I.a.createElement("div",{className:"".concat(z,"-input-wrap")},I.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":Ge,"aria-valuemax":Oe,"aria-valuenow":Lt,required:Fe,type:ot,placeholder:ct,onPaste:ht,onClick:dt,onMouseUp:this.onMouseUp,className:"".concat(z,"-input"),tabIndex:it,autoComplete:j,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:Ot?this.onKeyDown:u,onKeyUp:Ot?this.onKeyUp:u,autoFocus:Ve,maxLength:qe,readOnly:ee,disabled:Y,max:Oe,min:Ge,step:st,name:Ke,title:Ie,id:je,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(Et),pattern:rt,inputMode:Ye,onInput:ut},Ne))))}}]),S}(I.a.Component);x.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:g,min:-g,step:1,style:{},onChange:u,onKeyDown:u,onPressEnter:u,onFocus:u,onBlur:u,parser:s,required:!1,autoComplete:"off"};var h=x,p=yt.a=h},k3GJ:function(Ft,yt,ne){"use strict";ne.d(yt,"a",function(){return bo});var ae=ne("rePB"),X=ne("ODXe"),D=ne("Ff2n"),K=ne("VTBJ"),w=ne("q1tI"),P=ne("TSYQ"),H=ne.n(P),W=ne("Zm9Q"),I=ne("6cGi"),M=ne("KQm4"),b=ne("xEkU"),A=ne.n(b),_=ne("t23M");function O(le){var xe=Object(w.useRef)(),Ae=Object(w.useRef)(!1);function ce(){for(var Z=arguments.length,oe=new Array(Z),q=0;q<Z;q++)oe[q]=arguments[q];Ae.current||(A.a.cancel(xe.current),xe.current=A()(function(){le.apply(void 0,oe)}))}return Object(w.useEffect)(function(){return function(){Ae.current=!0,A.a.cancel(xe.current)}},[]),ce}function L(le){var xe=Object(w.useRef)([]),Ae=Object(w.useState)({}),ce=Object(X.a)(Ae,2),Z=ce[1],oe=Object(w.useRef)(typeof le=="function"?le():le),q=O(function(){var pe=oe.current;xe.current.forEach(function(Le){pe=Le(pe)}),xe.current=[],oe.current=pe,Z({})});function fe(pe){xe.current.push(pe),q()}return[oe.current,fe]}var y=ne("4IlW");function u(le,xe){var Ae,ce=le.prefixCls,Z=le.id,oe=le.active,q=le.rtl,fe=le.tab,pe=fe.key,Le=fe.tab,Ce=fe.disabled,De=fe.closeIcon,Be=le.tabBarGutter,tt=le.tabPosition,et=le.closable,pt=le.renderWrapper,Wt=le.removeAriaLabel,Zt=le.editable,Xt=le.onClick,Yt=le.onRemove,Jt=le.onFocus,Qt="".concat(ce,"-tab");w.useEffect(function(){return Yt},[]);var $t={};tt==="top"||tt==="bottom"?$t[q?"marginLeft":"marginRight"]=Be:$t.marginBottom=Be;var dr=Zt&&et!==!1&&!Ce;function ar(Bt){if(Ce)return;Xt(Bt)}function Nr(Bt){Bt.preventDefault(),Bt.stopPropagation(),Zt.onEdit("remove",{key:pe,event:Bt})}var or=w.createElement("div",{key:pe,ref:xe,className:H()(Qt,(Ae={},Object(ae.a)(Ae,"".concat(Qt,"-with-remove"),dr),Object(ae.a)(Ae,"".concat(Qt,"-active"),oe),Object(ae.a)(Ae,"".concat(Qt,"-disabled"),Ce),Ae)),style:$t,onClick:ar},w.createElement("div",{role:"tab","aria-selected":oe,id:Z&&"".concat(Z,"-tab-").concat(pe),className:"".concat(Qt,"-btn"),"aria-controls":Z&&"".concat(Z,"-panel-").concat(pe),"aria-disabled":Ce,tabIndex:Ce?null:0,onClick:function(Nt){Nt.stopPropagation(),ar(Nt)},onKeyDown:function(Nt){[y.a.SPACE,y.a.ENTER].includes(Nt.which)&&(Nt.preventDefault(),ar(Nt))},onFocus:Jt},Le),dr&&w.createElement("button",{type:"button","aria-label":Wt||"remove",tabIndex:0,className:"".concat(Qt,"-remove"),onClick:function(Nt){Nt.stopPropagation(),Nr(Nt)}},De||Zt.removeIcon||"\xD7"));return pt&&(or=pt(or)),or}var a=w.forwardRef(u),s={width:0,height:0,left:0,top:0};function d(le,xe,Ae){return Object(w.useMemo)(function(){for(var ce,Z=new Map,oe=xe.get((ce=le[0])===null||ce===void 0?void 0:ce.key)||s,q=oe.left+oe.width,fe=0;fe<le.length;fe+=1){var pe=le[fe].key,Le=xe.get(pe);if(!Le){var Ce;Le=xe.get((Ce=le[fe-1])===null||Ce===void 0?void 0:Ce.key)||s}var De=Z.get(pe)||Object(K.a)({},Le);De.right=q-De.left-De.width,Z.set(pe,De)}return Z},[le.map(function(ce){return ce.key}).join("_"),xe,Ae])}var E={width:0,height:0,left:0,top:0,right:0};function g(le,xe,Ae,ce,Z){var oe=Z.tabs,q=Z.tabPosition,fe=Z.rtl,pe,Le,Ce;["top","bottom"].includes(q)?(pe="width",Le=fe?"right":"left",Ce=Math.abs(xe.left)):(pe="height",Le="top",Ce=-xe.top);var De=xe[pe],Be=Ae[pe],tt=ce[pe],et=De;return Be+tt>De&&(et=De-tt),Object(w.useMemo)(function(){if(!oe.length)return[0,0];for(var pt=oe.length,Wt=pt,Zt=0;Zt<pt;Zt+=1){var Xt=le.get(oe[Zt].key)||E;if(Xt[Le]+Xt[pe]>Ce+et){Wt=Zt-1;break}}for(var Yt=0,Jt=pt-1;Jt>=0;Jt-=1){var Qt=le.get(oe[Jt].key)||E;if(Qt[Le]<Ce){Yt=Jt+1;break}}return[Yt,Wt]},[le,Ce,et,q,oe.map(function(pt){return pt.key}).join("_"),fe])}var m=ne("wx14"),k=ne("1OyB"),x=ne("vuIU"),h=ne("JX7q"),p=ne("Ji7U"),c=ne("LK+K"),o=ne("I8Z2"),S=ne("bT9E"),v=ne("2GS6"),T=ne("Gytx"),N=ne.n(T),z=ne("U8pU"),Y=/iPhone/i,ee=/iPod/i,G=/iPad/i,j=/\bAndroid(?:.+)Mobile\b/i,te=/Android/i,de=/\bAndroid(?:.+)SD4930UR\b/i,be=/\bAndroid(?:.+)(?:KF[A-Z]{2,4})\b/i,Oe=/Windows Phone/i,Ge=/\bWindows(?:.+)ARM\b/i,Me=/BlackBerry/i,Ie=/BB10/i,Ue=/Opera Mini/i,Pe=/\b(CriOS|Chrome)(?:.+)Mobile/i,Te=/Mobile(?:.+)Firefox\b/i;function se(le,xe){return le.test(xe)}function Fe(le){var xe=le||(typeof navigator!="undefined"?navigator.userAgent:""),Ae=(xe||"").split("[FBAN");if(typeof Ae[1]!="undefined"){var ce=Ae,Z=Object(X.a)(ce,1);xe=Z[0]}if(Ae=xe.split("Twitter"),typeof Ae[1]!="undefined"){var oe=Ae,q=Object(X.a)(oe,1);xe=q[0]}var fe={apple:{phone:se(Y,xe)&&!se(Oe,xe),ipod:se(ee,xe),tablet:!se(Y,xe)&&se(G,xe)&&!se(Oe,xe),device:(se(Y,xe)||se(ee,xe)||se(G,xe))&&!se(Oe,xe)},amazon:{phone:se(de,xe),tablet:!se(de,xe)&&se(be,xe),device:se(de,xe)||se(be,xe)},android:{phone:!se(Oe,xe)&&se(de,xe)||!se(Oe,xe)&&se(j,xe),tablet:!se(Oe,xe)&&!se(de,xe)&&!se(j,xe)&&(se(be,xe)||se(te,xe)),device:!se(Oe,xe)&&(se(de,xe)||se(be,xe)||se(j,xe)||se(te,xe))||se(/\bokhttp\b/i,xe)},windows:{phone:se(Oe,xe),tablet:se(Ge,xe),device:se(Oe,xe)||se(Ge,xe)},other:{blackberry:se(Me,xe),blackberry10:se(Ie,xe),opera:se(Ue,xe),firefox:se(Te,xe),chrome:se(Pe,xe),device:se(Me,xe)||se(Ie,xe)||se(Ue,xe)||se(Te,xe)||se(Pe,xe)},any:null,phone:null,tablet:null};return fe.any=fe.apple.device||fe.android.device||fe.windows.device||fe.other.device,fe.phone=fe.apple.phone||fe.android.phone||fe.windows.phone,fe.tablet=fe.apple.tablet||fe.android.tablet||fe.windows.tablet,fe}var dt=Object(K.a)(Object(K.a)({},Fe()),{},{isMobile:Fe}),it=dt;function ot(){}function ct(le,xe,Ae){var ce=xe||"";return le.key||"".concat(ce,"item_").concat(Ae)}function je(le){return"".concat(le,"-menu-")}function Ye(le,xe){var Ae=-1;w.Children.forEach(le,function(ce){Ae+=1,ce&&ce.type&&ce.type.isMenuItemGroup?w.Children.forEach(ce.props.children,function(Z){Ae+=1,xe(Z,Ae)}):xe(ce,Ae)})}function rt(le,xe,Ae){if(!le||Ae.find)return;w.Children.forEach(le,function(ce){if(ce){var Z=ce.type;if(!Z||!(Z.isSubMenu||Z.isMenuItem||Z.isMenuItemGroup))return;xe.indexOf(ce.key)!==-1?Ae.find=!0:ce.props.children&&rt(ce.props.children,xe,Ae)}})}var st=["defaultSelectedKeys","selectedKeys","defaultOpenKeys","openKeys","mode","getPopupContainer","onSelect","onDeselect","onDestroy","openTransitionName","openAnimation","subMenuOpenDelay","subMenuCloseDelay","forceSubMenuRender","triggerSubMenuAction","level","selectable","multiple","onOpenChange","visible","focusable","defaultActiveFirst","prefixCls","inlineIndent","parentMenu","title","rootPrefixCls","eventKey","active","onItemHover","onTitleMouseEnter","onTitleMouseLeave","onTitleClick","popupAlign","popupOffset","isOpen","renderMenuItem","manualRef","subMenuKey","disabled","index","isSelected","store","activeKey","builtinPlacements","overflowedIndicator","motion","attribute","value","popupClassName","inlineCollapsed","menu","theme","itemIcon","expandIcon"],qe=function(xe){var Ae=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,ce=xe&&typeof xe.getBoundingClientRect=="function"&&xe.getBoundingClientRect().width;if(ce){if(Ae){var Z=getComputedStyle(xe),oe=Z.marginLeft,q=Z.marginRight;ce+=+oe.replace("px","")+ +q.replace("px","")}ce=+ce.toFixed(6)}return ce||0},Ve=function(xe,Ae,ce){xe&&Object(z.a)(xe.style)==="object"&&(xe.style[Ae]=ce)},Ke=function(){return it.any},ht=ne("bdgK"),ut=ne("i8i4"),ft=ne.n(ut),nt=ne("wgJM"),Lt=ne("l4aY"),vt=ne("m+aA"),bt=ne("c+Xe"),Ne=ne("zT1h"),Ot=ne("QC+M");function Et(le,xe,Ae){return Ae?le[0]===xe[0]:le[0]===xe[0]&&le[1]===xe[1]}function We(le,xe,Ae){var ce=le[xe]||{};return Object(K.a)(Object(K.a)({},ce),Ae)}function Ze(le,xe,Ae,ce){for(var Z=Ae.points,oe=Object.keys(le),q=0;q<oe.length;q+=1){var fe=oe[q];if(Et(le[fe].points,Z,ce))return"".concat(xe,"-placement-").concat(fe)}return""}var we=function(){if(typeof navigator=="undefined"||typeof window=="undefined")return!1;var le=navigator.userAgent||navigator.vendor||window.opera;return!!(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(le)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(le==null?void 0:le.substr(0,4)))},ye=ne("MNnm");function Ee(le,xe){var Ae={};return Ae[le.toLowerCase()]=xe.toLowerCase(),Ae["Webkit".concat(le)]="webkit".concat(xe),Ae["Moz".concat(le)]="moz".concat(xe),Ae["ms".concat(le)]="MS".concat(xe),Ae["O".concat(le)]="o".concat(xe.toLowerCase()),Ae}function re(le,xe){var Ae={animationend:Ee("Animation","AnimationEnd"),transitionend:Ee("Transition","TransitionEnd")};return le&&("AnimationEvent"in xe||delete Ae.animationend.animation,"TransitionEvent"in xe||delete Ae.transitionend.transition),Ae}var ie=re(Object(ye.a)(),typeof window!="undefined"?window:{}),ue={};if(Object(ye.a)()){var ge=document.createElement("div");ue=ge.style}var Se={};function Re(le){if(Se[le])return Se[le];var xe=ie[le];if(xe)for(var Ae=Object.keys(xe),ce=Ae.length,Z=0;Z<ce;Z+=1){var oe=Ae[Z];if(Object.prototype.hasOwnProperty.call(xe,oe)&&oe in ue)return Se[le]=xe[oe],Se[le]}return""}var Xe=Re("animationend"),xt=Re("transitionend"),Mt=!!(Xe&&xt),kt=Xe||"animationend",Gt=xt||"transitionend";function Kt(le,xe){if(!le)return null;if(Object(z.a)(le)==="object"){var Ae=xe.replace(/-\w/g,function(ce){return ce[1].toUpperCase()});return le[Ae]}return"".concat(le,"-").concat(xe)}var Ct="none",pr="appear",rr="enter",Ir="leave",Pr="none",Vt="prepare",an="start",En="active",It="end";function An(le){var xe=Object(w.useRef)(!1),Ae=Object(w.useState)(le),ce=Object(X.a)(Ae,2),Z=ce[0],oe=ce[1];function q(fe){xe.current||oe(fe)}return Object(w.useEffect)(function(){return function(){xe.current=!0}},[]),[Z,q]}var on=Object(ye.a)()?w.useLayoutEffect:w.useEffect,sn=on,Un=function(){var le=w.useRef(null);function xe(){nt.a.cancel(le.current)}function Ae(ce){var Z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;xe();var oe=Object(nt.a)(function(){Z<=1?ce({isCanceled:function(){return oe!==le.current}}):Ae(ce,Z-1)});le.current=oe}return w.useEffect(function(){return function(){xe()}},[]),[Ae,xe]},ci=[Vt,an,En,It],Qn=!1,mr=!0;function wt(le){return le===En||le===It}var Vn=function(le,xe){var Ae=w.useState(Pr),ce=Object(X.a)(Ae,2),Z=ce[0],oe=ce[1],q=Un(),fe=Object(X.a)(q,2),pe=fe[0],Le=fe[1];function Ce(){oe(Vt)}return sn(function(){if(Z!==Pr&&Z!==It){var De=ci.indexOf(Z),Be=ci[De+1],tt=xe(Z);tt===Qn?oe(Be):pe(function(et){function pt(){if(et.isCanceled())return;oe(Be)}tt===!0?pt():Promise.resolve(tt).then(pt)})}},[le,Z]),w.useEffect(function(){return function(){Le()}},[]),[Ce,Z]},oi=function(le){var xe=Object(w.useRef)(),Ae=Object(w.useRef)(le);Ae.current=le;var ce=w.useCallback(function(q){Ae.current(q)},[]);function Z(q){q&&(q.removeEventListener(Gt,ce),q.removeEventListener(kt,ce))}function oe(q){xe.current&&xe.current!==q&&Z(xe.current),q&&q!==xe.current&&(q.addEventListener(Gt,ce),q.addEventListener(kt,ce),xe.current=q)}return w.useEffect(function(){return function(){Z(xe.current)}},[]),[oe,Z]};function mn(le,xe,Ae,ce){var Z=ce.motionEnter,oe=Z===void 0?!0:Z,q=ce.motionAppear,fe=q===void 0?!0:q,pe=ce.motionLeave,Le=pe===void 0?!0:pe,Ce=ce.motionDeadline,De=ce.motionLeaveImmediately,Be=ce.onAppearPrepare,tt=ce.onEnterPrepare,et=ce.onLeavePrepare,pt=ce.onAppearStart,Wt=ce.onEnterStart,Zt=ce.onLeaveStart,Xt=ce.onAppearActive,Yt=ce.onEnterActive,Jt=ce.onLeaveActive,Qt=ce.onAppearEnd,$t=ce.onEnterEnd,dr=ce.onLeaveEnd,ar=ce.onVisibleChanged,Nr=An(),or=Object(X.a)(Nr,2),Bt=or[0],Nt=or[1],sr=An(Ct),cr=Object(X.a)(sr,2),Dt=cr[0],fr=cr[1],Ur=An(null),yr=Object(X.a)(Ur,2),Lr=yr[0],wr=yr[1],Yr=Object(w.useRef)(!1),un=Object(w.useRef)(null),jr=Object(w.useRef)(!1),On=Object(w.useRef)(null);function ti(){var _r=Ae();return _r||On.current}var Mn=Object(w.useRef)(!1);function dn(_r){var Tr=ti();if(_r&&!_r.deadline&&_r.target!==Tr)return;var cn;Dt===pr&&Mn.current?cn=Qt==null?void 0:Qt(Tr,_r):Dt===rr&&Mn.current?cn=$t==null?void 0:$t(Tr,_r):Dt===Ir&&Mn.current&&(cn=dr==null?void 0:dr(Tr,_r)),cn!==!1&&!jr.current&&(fr(Ct),wr(null))}var Mr=oi(dn),Or=Object(X.a)(Mr,1),Wr=Or[0],Br=w.useMemo(function(){var _r,Tr,cn;switch(Dt){case"appear":return _r={},Object(ae.a)(_r,Vt,Be),Object(ae.a)(_r,an,pt),Object(ae.a)(_r,En,Xt),_r;case"enter":return Tr={},Object(ae.a)(Tr,Vt,tt),Object(ae.a)(Tr,an,Wt),Object(ae.a)(Tr,En,Yt),Tr;case"leave":return cn={},Object(ae.a)(cn,Vt,et),Object(ae.a)(cn,an,Zt),Object(ae.a)(cn,En,Jt),cn;default:return{}}},[Dt]),ri=Vn(Dt,function(_r){if(_r===Vt){var Tr=Br[Vt];return Tr?Tr(ti()):Qn}if(Ar in Br){var cn;wr(((cn=Br[Ar])===null||cn===void 0?void 0:cn.call(Br,ti(),null))||null)}return Ar===En&&(Wr(ti()),Ce>0&&(clearTimeout(un.current),un.current=setTimeout(function(){dn({deadline:!0})},Ce))),mr}),Ai=Object(X.a)(ri,2),Li=Ai[0],Ar=Ai[1],di=wt(Ar);Mn.current=di,sn(function(){Nt(xe);var _r=Yr.current;if(Yr.current=!0,!le)return;var Tr;!_r&&xe&&fe&&(Tr=pr),_r&&xe&&oe&&(Tr=rr),(_r&&!xe&&Le||!_r&&De&&!xe&&Le)&&(Tr=Ir),Tr&&(fr(Tr),Li())},[xe]),Object(w.useEffect)(function(){(Dt===pr&&!fe||Dt===rr&&!oe||Dt===Ir&&!Le)&&fr(Ct)},[fe,oe,Le]),Object(w.useEffect)(function(){return function(){clearTimeout(un.current),jr.current=!0}},[]),Object(w.useEffect)(function(){Bt!==void 0&&Dt===Ct&&(ar==null||ar(Bt))},[Bt,Dt]);var Oi=Lr;return Br[Vt]&&Ar===an&&(Oi=Object(K.a)({transition:"none"},Oi)),[Dt,Ar,Oi,Bt!=null?Bt:xe]}var nr=function(le){Object(p.a)(Ae,le);var xe=Object(c.a)(Ae);function Ae(){return Object(k.a)(this,Ae),xe.apply(this,arguments)}return Object(x.a)(Ae,[{key:"render",value:function(){return this.props.children}}]),Ae}(w.Component),Bn=nr;function Zn(le){var xe=le;Object(z.a)(le)==="object"&&(xe=le.transitionSupport);function Ae(Z){return!!(Z.motionName&&xe)}var ce=w.forwardRef(function(Z,oe){var q=Z.visible,fe=q===void 0?!0:q,pe=Z.removeOnLeave,Le=pe===void 0?!0:pe,Ce=Z.forceRender,De=Z.children,Be=Z.motionName,tt=Z.leavedClassName,et=Z.eventProps,pt=Ae(Z),Wt=Object(w.useRef)(),Zt=Object(w.useRef)();function Xt(){try{return Object(vt.a)(Wt.current||Zt.current)}catch(fr){return null}}var Yt=mn(pt,fe,Xt,Z),Jt=Object(X.a)(Yt,4),Qt=Jt[0],$t=Jt[1],dr=Jt[2],ar=Jt[3],Nr=w.useRef(ar);ar&&(Nr.current=!0);var or=Object(w.useRef)(oe);or.current=oe;var Bt=w.useCallback(function(fr){Wt.current=fr,Object(bt.b)(or.current,fr)},[]),Nt,sr=Object(K.a)(Object(K.a)({},et),{},{visible:fe});if(!De)Nt=null;else if(Qt===Ct||!Ae(Z))ar?Nt=De(Object(K.a)({},sr),Bt):!Le&&Nr.current?Nt=De(Object(K.a)(Object(K.a)({},sr),{},{className:tt}),Bt):Ce?Nt=De(Object(K.a)(Object(K.a)({},sr),{},{style:{display:"none"}}),Bt):Nt=null;else{var cr,Dt;$t===Vt?Dt="prepare":wt($t)?Dt="active":$t===an&&(Dt="start"),Nt=De(Object(K.a)(Object(K.a)({},sr),{},{className:H()(Kt(Be,Qt),(cr={},Object(ae.a)(cr,Kt(Be,"".concat(Qt,"-").concat(Dt)),Dt),Object(ae.a)(cr,Be,typeof Be=="string"),cr)),style:dr}),Bt)}return w.createElement(Bn,{ref:Zt},Nt)});return ce.displayName="CSSMotion",ce}var hi=Zn(Mt),Je="add",jt="keep",si="remove",fi="removed";function Si(le){var xe;return le&&Object(z.a)(le)==="object"&&"key"in le?xe=le:xe={key:le},Object(K.a)(Object(K.a)({},xe),{},{key:String(xe.key)})}function li(){var le=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return le.map(Si)}function F(){var le=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],xe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],Ae=[],ce=0,Z=xe.length,oe=li(le),q=li(xe);oe.forEach(function(Le){for(var Ce=!1,De=ce;De<Z;De+=1){var Be=q[De];if(Be.key===Le.key){ce<De&&(Ae=Ae.concat(q.slice(ce,De).map(function(tt){return Object(K.a)(Object(K.a)({},tt),{},{status:Je})})),ce=De),Ae.push(Object(K.a)(Object(K.a)({},Be),{},{status:jt})),ce+=1,Ce=!0;break}}Ce||Ae.push(Object(K.a)(Object(K.a)({},Le),{},{status:si}))}),ce<Z&&(Ae=Ae.concat(q.slice(ce).map(function(Le){return Object(K.a)(Object(K.a)({},Le),{},{status:Je})})));var fe={};Ae.forEach(function(Le){var Ce=Le.key;fe[Ce]=(fe[Ce]||0)+1});var pe=Object.keys(fe).filter(function(Le){return fe[Le]>1});return pe.forEach(function(Le){Ae=Ae.filter(function(Ce){var De=Ce.key,Be=Ce.status;return De!==Le||Be!==si}),Ae.forEach(function(Ce){Ce.key===Le&&(Ce.status=jt)})}),Ae}var l=["eventProps","visible","children","motionName","motionAppear","motionEnter","motionLeave","motionLeaveImmediately","motionDeadline","removeOnLeave","leavedClassName","onAppearStart","onAppearActive","onAppearEnd","onEnterStart","onEnterActive","onEnterEnd","onLeaveStart","onLeaveActive","onLeaveEnd"];function f(le){var xe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:hi,Ae=function(ce){Object(p.a)(oe,ce);var Z=Object(c.a)(oe);function oe(){var q;return Object(k.a)(this,oe),q=Z.apply(this,arguments),q.state={keyEntities:[]},q.removeKey=function(fe){q.setState(function(pe){var Le=pe.keyEntities;return{keyEntities:Le.map(function(Ce){return Ce.key!==fe?Ce:Object(K.a)(Object(K.a)({},Ce),{},{status:fi})})}})},q}return Object(x.a)(oe,[{key:"render",value:function(){var fe=this,pe=this.state.keyEntities,Le=this.props,Ce=Le.component,De=Le.children,Be=Le.onVisibleChanged,tt=Object(D.a)(Le,["component","children","onVisibleChanged"]),et=Ce||w.Fragment,pt={};return l.forEach(function(Wt){pt[Wt]=tt[Wt],delete tt[Wt]}),delete tt.keys,w.createElement(et,tt,pe.map(function(Wt){var Zt=Wt.status,Xt=Object(D.a)(Wt,["status"]),Yt=Zt===Je||Zt===jt;return w.createElement(xe,Object(m.a)({},pt,{key:Xt.key,visible:Yt,eventProps:Xt,onVisibleChanged:function(Qt){Be==null||Be(Qt,{key:Xt.key}),Qt||fe.removeKey(Xt.key)}}),De)}))}}],[{key:"getDerivedStateFromProps",value:function(fe,pe){var Le=fe.keys,Ce=pe.keyEntities,De=li(Le),Be=F(Ce,De);return{keyEntities:Be.filter(function(tt){var et=Ce.find(function(pt){var Wt=pt.key;return tt.key===Wt});return!(et&&et.status===fi&&tt.status===si)})}}}]),oe}(w.Component);return Ae.defaultProps={component:"div"},Ae}var R=f(Mt),Q=hi;function B(le){var xe=le.prefixCls,Ae=le.motion,ce=le.animation,Z=le.transitionName;return Ae||(ce?{motionName:"".concat(xe,"-").concat(ce)}:Z?{motionName:Z}:null)}function ve(le){var xe=le.prefixCls,Ae=le.visible,ce=le.zIndex,Z=le.mask,oe=le.maskMotion,q=le.maskAnimation,fe=le.maskTransitionName;if(!Z)return null;var pe={};return(oe||fe||q)&&(pe=Object(K.a)({motionAppear:!0},B({motion:oe,prefixCls:xe,transitionName:fe,animation:q}))),w.createElement(Q,Object(m.a)({},pe,{visible:Ae,removeOnLeave:!0}),function(Le){var Ce=Le.className;return w.createElement("div",{style:{zIndex:ce},className:H()("".concat(xe,"-mask"),Ce)})})}var ze=ne("9mu1"),lt=ne("o0o1"),At=ne.n(lt),$e=ne("HaE+"),Rt=["measure","align",null,"motion"],gr=function(le,xe){var Ae=Object(w.useState)(null),ce=Object(X.a)(Ae,2),Z=ce[0],oe=ce[1],q=Object(w.useRef)(),fe=Object(w.useRef)(!1);function pe(De){fe.current||oe(De)}function Le(){nt.a.cancel(q.current)}function Ce(De){Le(),q.current=Object(nt.a)(function(){pe(function(Be){switch(Z){case"align":return"motion";case"motion":return"stable";default:}return Be}),De==null||De()})}return Object(w.useEffect)(function(){pe("measure")},[le]),Object(w.useEffect)(function(){switch(Z){case"measure":xe();break;default:}Z&&(q.current=Object(nt.a)(Object($e.a)(At.a.mark(function De(){var Be,tt;return At.a.wrap(function(pt){for(;;)switch(pt.prev=pt.next){case 0:Be=Rt.indexOf(Z),tt=Rt[Be+1],tt&&Be!==-1&&pe(tt);case 3:case"end":return pt.stop()}},De)}))))},[Z]),Object(w.useEffect)(function(){return function(){fe.current=!0,Le()}},[]),[Z,Ce]},Dr=function(le){var xe=w.useState({width:0,height:0}),Ae=Object(X.a)(xe,2),ce=Ae[0],Z=Ae[1];function oe(fe){Z({width:fe.offsetWidth,height:fe.offsetHeight})}var q=w.useMemo(function(){var fe={};if(le){var pe=ce.width,Le=ce.height;le.indexOf("height")!==-1&&Le?fe.height=Le:le.indexOf("minHeight")!==-1&&Le&&(fe.minHeight=Le),le.indexOf("width")!==-1&&pe?fe.width=pe:le.indexOf("minWidth")!==-1&&pe&&(fe.minWidth=pe)}return fe},[le,ce]);return[q,oe]},Ln=w.forwardRef(function(le,xe){var Ae=le.visible,ce=le.prefixCls,Z=le.className,oe=le.style,q=le.children,fe=le.zIndex,pe=le.stretch,Le=le.destroyPopupOnHide,Ce=le.forceRender,De=le.align,Be=le.point,tt=le.getRootDomNode,et=le.getClassNameFromAlign,pt=le.onAlign,Wt=le.onMouseEnter,Zt=le.onMouseLeave,Xt=le.onMouseDown,Yt=le.onTouchStart,Jt=Object(w.useRef)(),Qt=Object(w.useRef)(),$t=Object(w.useState)(),dr=Object(X.a)($t,2),ar=dr[0],Nr=dr[1],or=Dr(pe),Bt=Object(X.a)(or,2),Nt=Bt[0],sr=Bt[1];function cr(){pe&&sr(tt())}var Dt=gr(Ae,cr),fr=Object(X.a)(Dt,2),Ur=fr[0],yr=fr[1],Lr=Object(w.useRef)();function wr(){return Be||tt}function Yr(){var Mr;(Mr=Jt.current)===null||Mr===void 0||Mr.forceAlign()}function un(Mr,Or){var Wr=et(Or);ar!==Wr&&Nr(Wr),Ur==="align"&&(ar!==Wr?Promise.resolve().then(function(){Yr()}):yr(function(){var Br;(Br=Lr.current)===null||Br===void 0||Br.call(Lr)}),pt==null||pt(Mr,Or))}var jr=Object(K.a)({},B(le));["onAppearEnd","onEnterEnd","onLeaveEnd"].forEach(function(Mr){var Or=jr[Mr];jr[Mr]=function(Wr,Br){return yr(),Or==null?void 0:Or(Wr,Br)}});function On(){return new Promise(function(Mr){Lr.current=Mr})}w.useEffect(function(){!jr.motionName&&Ur==="motion"&&yr()},[jr.motionName,Ur]),w.useImperativeHandle(xe,function(){return{forceAlign:Yr,getElement:function(){return Qt.current}}});var ti=Object(K.a)(Object(K.a)({},Nt),{},{zIndex:fe,opacity:Ur==="motion"||Ur==="stable"||!Ae?void 0:0,pointerEvents:Ur==="stable"?void 0:"none"},oe),Mn=!0;(De==null?void 0:De.points)&&(Ur==="align"||Ur==="stable")&&(Mn=!1);var dn=q;return w.Children.count(q)>1&&(dn=w.createElement("div",{className:"".concat(ce,"-content")},q)),w.createElement(Q,Object(m.a)({visible:Ae,ref:Qt,leavedClassName:"".concat(ce,"-hidden")},jr,{onAppearPrepare:On,onEnterPrepare:On,removeOnLeave:Le,forceRender:Ce}),function(Mr,Or){var Wr=Mr.className,Br=Mr.style,ri=H()(ce,Z,ar,Wr);return w.createElement(ze.a,{target:wr(),key:"popup",ref:Jt,monitorWindowResize:!0,disabled:Mn,align:De,onAlign:un},w.createElement("div",{ref:Or,className:ri,onMouseEnter:Wt,onMouseLeave:Zt,onMouseDownCapture:Xt,onTouchStartCapture:Yt,style:Object(K.a)(Object(K.a)({},Br),ti)},dn))})});Ln.displayName="PopupInner";var gn=Ln,ln=w.forwardRef(function(le,xe){var Ae=le.prefixCls,ce=le.visible,Z=le.zIndex,oe=le.children,q=le.mobile;q=q===void 0?{}:q;var fe=q.popupClassName,pe=q.popupStyle,Le=q.popupMotion,Ce=Le===void 0?{}:Le,De=q.popupRender,Be=w.useRef();w.useImperativeHandle(xe,function(){return{forceAlign:function(){},getElement:function(){return Be.current}}});var tt=Object(K.a)({zIndex:Z},pe),et=oe;return w.Children.count(oe)>1&&(et=w.createElement("div",{className:"".concat(Ae,"-content")},oe)),De&&(et=De(et)),w.createElement(Q,Object(m.a)({visible:ce,ref:Be,removeOnLeave:!0},Ce),function(pt,Wt){var Zt=pt.className,Xt=pt.style,Yt=H()(Ae,fe,Zt);return w.createElement("div",{ref:Wt,className:Yt,style:Object(K.a)(Object(K.a)({},Xt),tt)},et)})});ln.displayName="MobilePopupInner";var Jn=ln,Pi=["visible","mobile"],Qr=w.forwardRef(function(le,xe){var Ae=le.visible,ce=le.mobile,Z=Object(D.a)(le,Pi),oe=Object(w.useState)(Ae),q=Object(X.a)(oe,2),fe=q[0],pe=q[1],Le=Object(w.useState)(!1),Ce=Object(X.a)(Le,2),De=Ce[0],Be=Ce[1],tt=Object(K.a)(Object(K.a)({},Z),{},{visible:fe});Object(w.useEffect)(function(){pe(Ae),Ae&&ce&&Be(we())},[Ae,ce]);var et=De?w.createElement(Jn,Object(m.a)({},tt,{mobile:ce,ref:xe})):w.createElement(gn,Object(m.a)({},tt,{ref:xe}));return w.createElement("div",null,w.createElement(ve,tt),et)});Qr.displayName="Popup";var Fn=Qr,pi=w.createContext(null),ui=pi;function Sn(){}function Ii(){return""}function Ci(le){return le?le.ownerDocument:window.document}var Gi=["onClick","onMouseDown","onTouchStart","onMouseEnter","onMouseLeave","onFocus","onBlur","onContextMenu"];function Vi(le){var xe=function(Ae){Object(p.a)(Z,Ae);var ce=Object(c.a)(Z);function Z(oe){var q;Object(k.a)(this,Z),q=ce.call(this,oe),q.popupRef=w.createRef(),q.triggerRef=w.createRef(),q.attachId=void 0,q.clickOutsideHandler=void 0,q.touchOutsideHandler=void 0,q.contextMenuOutsideHandler1=void 0,q.contextMenuOutsideHandler2=void 0,q.mouseDownTimeout=void 0,q.focusTime=void 0,q.preClickTime=void 0,q.preTouchTime=void 0,q.delayTimer=void 0,q.hasPopupMouseDown=void 0,q.onMouseEnter=function(pe){var Le=q.props.mouseEnterDelay;q.fireEvents("onMouseEnter",pe),q.delaySetPopupVisible(!0,Le,Le?null:pe)},q.onMouseMove=function(pe){q.fireEvents("onMouseMove",pe),q.setPoint(pe)},q.onMouseLeave=function(pe){q.fireEvents("onMouseLeave",pe),q.delaySetPopupVisible(!1,q.props.mouseLeaveDelay)},q.onPopupMouseEnter=function(){q.clearDelayTimer()},q.onPopupMouseLeave=function(pe){var Le;if(pe.relatedTarget&&!pe.relatedTarget.setTimeout&&Object(Lt.a)((Le=q.popupRef.current)===null||Le===void 0?void 0:Le.getElement(),pe.relatedTarget))return;q.delaySetPopupVisible(!1,q.props.mouseLeaveDelay)},q.onFocus=function(pe){q.fireEvents("onFocus",pe),q.clearDelayTimer(),q.isFocusToShow()&&(q.focusTime=Date.now(),q.delaySetPopupVisible(!0,q.props.focusDelay))},q.onMouseDown=function(pe){q.fireEvents("onMouseDown",pe),q.preClickTime=Date.now()},q.onTouchStart=function(pe){q.fireEvents("onTouchStart",pe),q.preTouchTime=Date.now()},q.onBlur=function(pe){q.fireEvents("onBlur",pe),q.clearDelayTimer(),q.isBlurToHide()&&q.delaySetPopupVisible(!1,q.props.blurDelay)},q.onContextMenu=function(pe){pe.preventDefault(),q.fireEvents("onContextMenu",pe),q.setPopupVisible(!0,pe)},q.onContextMenuClose=function(){q.isContextMenuToShow()&&q.close()},q.onClick=function(pe){if(q.fireEvents("onClick",pe),q.focusTime){var Le;if(q.preClickTime&&q.preTouchTime?Le=Math.min(q.preClickTime,q.preTouchTime):q.preClickTime?Le=q.preClickTime:q.preTouchTime&&(Le=q.preTouchTime),Math.abs(Le-q.focusTime)<20)return;q.focusTime=0}q.preClickTime=0,q.preTouchTime=0,q.isClickToShow()&&(q.isClickToHide()||q.isBlurToHide())&&pe&&pe.preventDefault&&pe.preventDefault();var Ce=!q.state.popupVisible;(q.isClickToHide()&&!Ce||Ce&&q.isClickToShow())&&q.setPopupVisible(!q.state.popupVisible,pe)},q.onPopupMouseDown=function(){if(q.hasPopupMouseDown=!0,clearTimeout(q.mouseDownTimeout),q.mouseDownTimeout=window.setTimeout(function(){q.hasPopupMouseDown=!1},0),q.context){var pe;(pe=q.context).onPopupMouseDown.apply(pe,arguments)}},q.onDocumentClick=function(pe){if(q.props.mask&&!q.props.maskClosable)return;var Le=pe.target,Ce=q.getRootDomNode(),De=q.getPopupDomNode();(!Object(Lt.a)(Ce,Le)||q.isContextMenuOnly())&&!Object(Lt.a)(De,Le)&&!q.hasPopupMouseDown&&q.close()},q.getRootDomNode=function(){var pe=q.props.getTriggerDOMNode;if(pe)return pe(q.triggerRef.current);try{var Le=Object(vt.a)(q.triggerRef.current);if(Le)return Le}catch(Ce){}return ft.a.findDOMNode(Object(h.a)(q))},q.getPopupClassNameFromAlign=function(pe){var Le=[],Ce=q.props,De=Ce.popupPlacement,Be=Ce.builtinPlacements,tt=Ce.prefixCls,et=Ce.alignPoint,pt=Ce.getPopupClassNameFromAlign;return De&&Be&&Le.push(Ze(Be,tt,pe,et)),pt&&Le.push(pt(pe)),Le.join(" ")},q.getComponent=function(){var pe=q.props,Le=pe.prefixCls,Ce=pe.destroyPopupOnHide,De=pe.popupClassName,Be=pe.onPopupAlign,tt=pe.popupMotion,et=pe.popupAnimation,pt=pe.popupTransitionName,Wt=pe.popupStyle,Zt=pe.mask,Xt=pe.maskAnimation,Yt=pe.maskTransitionName,Jt=pe.maskMotion,Qt=pe.zIndex,$t=pe.popup,dr=pe.stretch,ar=pe.alignPoint,Nr=pe.mobile,or=pe.forceRender,Bt=q.state,Nt=Bt.popupVisible,sr=Bt.point,cr=q.getPopupAlign(),Dt={};return q.isMouseEnterToShow()&&(Dt.onMouseEnter=q.onPopupMouseEnter),q.isMouseLeaveToHide()&&(Dt.onMouseLeave=q.onPopupMouseLeave),Dt.onMouseDown=q.onPopupMouseDown,Dt.onTouchStart=q.onPopupMouseDown,w.createElement(Fn,Object(m.a)({prefixCls:Le,destroyPopupOnHide:Ce,visible:Nt,point:ar&&sr,className:De,align:cr,onAlign:Be,animation:et,getClassNameFromAlign:q.getPopupClassNameFromAlign},Dt,{stretch:dr,getRootDomNode:q.getRootDomNode,style:Wt,mask:Zt,zIndex:Qt,transitionName:pt,maskAnimation:Xt,maskTransitionName:Yt,maskMotion:Jt,ref:q.popupRef,motion:tt,mobile:Nr,forceRender:or}),typeof $t=="function"?$t():$t)},q.attachParent=function(pe){nt.a.cancel(q.attachId);var Le=q.props,Ce=Le.getPopupContainer,De=Le.getDocument,Be=q.getRootDomNode(),tt;Ce?(Be||Ce.length===0)&&(tt=Ce(Be)):tt=De(q.getRootDomNode()).body,tt?tt.appendChild(pe):q.attachId=Object(nt.a)(function(){q.attachParent(pe)})},q.getContainer=function(){var pe=q.props.getDocument,Le=pe(q.getRootDomNode()).createElement("div");return Le.style.position="absolute",Le.style.top="0",Le.style.left="0",Le.style.width="100%",q.attachParent(Le),Le},q.setPoint=function(pe){var Le=q.props.alignPoint;if(!Le||!pe)return;q.setState({point:{pageX:pe.pageX,pageY:pe.pageY}})},q.handlePortalUpdate=function(){q.state.prevPopupVisible!==q.state.popupVisible&&q.props.afterPopupVisibleChange(q.state.popupVisible)},q.triggerContextValue={onPopupMouseDown:q.onPopupMouseDown};var fe;return"popupVisible"in oe?fe=!!oe.popupVisible:fe=!!oe.defaultPopupVisible,q.state={prevPopupVisible:fe,popupVisible:fe},Gi.forEach(function(pe){q["fire".concat(pe)]=function(Le){q.fireEvents(pe,Le)}}),q}return Object(x.a)(Z,[{key:"componentDidMount",value:function(){this.componentDidUpdate()}},{key:"componentDidUpdate",value:function(){var q=this.props,fe=this.state;if(fe.popupVisible){var pe;!this.clickOutsideHandler&&(this.isClickToHide()||this.isContextMenuToShow())&&(pe=q.getDocument(this.getRootDomNode()),this.clickOutsideHandler=Object(Ne.a)(pe,"mousedown",this.onDocumentClick)),this.touchOutsideHandler||(pe=pe||q.getDocument(this.getRootDomNode()),this.touchOutsideHandler=Object(Ne.a)(pe,"touchstart",this.onDocumentClick)),!this.contextMenuOutsideHandler1&&this.isContextMenuToShow()&&(pe=pe||q.getDocument(this.getRootDomNode()),this.contextMenuOutsideHandler1=Object(Ne.a)(pe,"scroll",this.onContextMenuClose)),!this.contextMenuOutsideHandler2&&this.isContextMenuToShow()&&(this.contextMenuOutsideHandler2=Object(Ne.a)(window,"blur",this.onContextMenuClose));return}this.clearOutsideHandler()}},{key:"componentWillUnmount",value:function(){this.clearDelayTimer(),this.clearOutsideHandler(),clearTimeout(this.mouseDownTimeout),nt.a.cancel(this.attachId)}},{key:"getPopupDomNode",value:function(){var q;return((q=this.popupRef.current)===null||q===void 0?void 0:q.getElement())||null}},{key:"getPopupAlign",value:function(){var q=this.props,fe=q.popupPlacement,pe=q.popupAlign,Le=q.builtinPlacements;return fe&&Le?We(Le,fe,pe):pe}},{key:"setPopupVisible",value:function(q,fe){var pe=this.props.alignPoint,Le=this.state.popupVisible;this.clearDelayTimer(),Le!==q&&("popupVisible"in this.props||this.setState({popupVisible:q,prevPopupVisible:Le}),this.props.onPopupVisibleChange(q)),pe&&fe&&q&&this.setPoint(fe)}},{key:"delaySetPopupVisible",value:function(q,fe,pe){var Le=this,Ce=fe*1e3;if(this.clearDelayTimer(),Ce){var De=pe?{pageX:pe.pageX,pageY:pe.pageY}:null;this.delayTimer=window.setTimeout(function(){Le.setPopupVisible(q,De),Le.clearDelayTimer()},Ce)}else this.setPopupVisible(q,pe)}},{key:"clearDelayTimer",value:function(){this.delayTimer&&(clearTimeout(this.delayTimer),this.delayTimer=null)}},{key:"clearOutsideHandler",value:function(){this.clickOutsideHandler&&(this.clickOutsideHandler.remove(),this.clickOutsideHandler=null),this.contextMenuOutsideHandler1&&(this.contextMenuOutsideHandler1.remove(),this.contextMenuOutsideHandler1=null),this.contextMenuOutsideHandler2&&(this.contextMenuOutsideHandler2.remove(),this.contextMenuOutsideHandler2=null),this.touchOutsideHandler&&(this.touchOutsideHandler.remove(),this.touchOutsideHandler=null)}},{key:"createTwoChains",value:function(q){var fe=this.props.children.props,pe=this.props;return fe[q]&&pe[q]?this["fire".concat(q)]:fe[q]||pe[q]}},{key:"isClickToShow",value:function(){var q=this.props,fe=q.action,pe=q.showAction;return fe.indexOf("click")!==-1||pe.indexOf("click")!==-1}},{key:"isContextMenuOnly",value:function(){var q=this.props.action;return q==="contextMenu"||q.length===1&&q[0]==="contextMenu"}},{key:"isContextMenuToShow",value:function(){var q=this.props,fe=q.action,pe=q.showAction;return fe.indexOf("contextMenu")!==-1||pe.indexOf("contextMenu")!==-1}},{key:"isClickToHide",value:function(){var q=this.props,fe=q.action,pe=q.hideAction;return fe.indexOf("click")!==-1||pe.indexOf("click")!==-1}},{key:"isMouseEnterToShow",value:function(){var q=this.props,fe=q.action,pe=q.showAction;return fe.indexOf("hover")!==-1||pe.indexOf("mouseEnter")!==-1}},{key:"isMouseLeaveToHide",value:function(){var q=this.props,fe=q.action,pe=q.hideAction;return fe.indexOf("hover")!==-1||pe.indexOf("mouseLeave")!==-1}},{key:"isFocusToShow",value:function(){var q=this.props,fe=q.action,pe=q.showAction;return fe.indexOf("focus")!==-1||pe.indexOf("focus")!==-1}},{key:"isBlurToHide",value:function(){var q=this.props,fe=q.action,pe=q.hideAction;return fe.indexOf("focus")!==-1||pe.indexOf("blur")!==-1}},{key:"forcePopupAlign",value:function(){if(this.state.popupVisible){var q;(q=this.popupRef.current)===null||q===void 0||q.forceAlign()}}},{key:"fireEvents",value:function(q,fe){var pe=this.props.children.props[q];pe&&pe(fe);var Le=this.props[q];Le&&Le(fe)}},{key:"close",value:function(){this.setPopupVisible(!1)}},{key:"render",value:function(){var q=this.state.popupVisible,fe=this.props,pe=fe.children,Le=fe.forceRender,Ce=fe.alignPoint,De=fe.className,Be=fe.autoDestroy,tt=w.Children.only(pe),et={key:"trigger"};this.isContextMenuToShow()?et.onContextMenu=this.onContextMenu:et.onContextMenu=this.createTwoChains("onContextMenu"),this.isClickToHide()||this.isClickToShow()?(et.onClick=this.onClick,et.onMouseDown=this.onMouseDown,et.onTouchStart=this.onTouchStart):(et.onClick=this.createTwoChains("onClick"),et.onMouseDown=this.createTwoChains("onMouseDown"),et.onTouchStart=this.createTwoChains("onTouchStart")),this.isMouseEnterToShow()?(et.onMouseEnter=this.onMouseEnter,Ce&&(et.onMouseMove=this.onMouseMove)):et.onMouseEnter=this.createTwoChains("onMouseEnter"),this.isMouseLeaveToHide()?et.onMouseLeave=this.onMouseLeave:et.onMouseLeave=this.createTwoChains("onMouseLeave"),this.isFocusToShow()||this.isBlurToHide()?(et.onFocus=this.onFocus,et.onBlur=this.onBlur):(et.onFocus=this.createTwoChains("onFocus"),et.onBlur=this.createTwoChains("onBlur"));var pt=H()(tt&&tt.props&&tt.props.className,De);pt&&(et.className=pt);var Wt=Object(K.a)({},et);Object(bt.c)(tt)&&(Wt.ref=Object(bt.a)(this.triggerRef,tt.ref));var Zt=w.cloneElement(tt,Wt),Xt;return(q||this.popupRef.current||Le)&&(Xt=w.createElement(le,{key:"portal",getContainer:this.getContainer,didUpdate:this.handlePortalUpdate},this.getComponent())),!q&&Be&&(Xt=null),w.createElement(ui.Provider,{value:this.triggerContextValue},Zt,Xt)}}],[{key:"getDerivedStateFromProps",value:function(q,fe){var pe=q.popupVisible,Le={};return pe!==void 0&&fe.popupVisible!==pe&&(Le.popupVisible=pe,Le.prevPopupVisible=fe.popupVisible),Le}}]),Z}(w.Component);return xe.contextType=ui,xe.defaultProps={prefixCls:"rc-trigger-popup",getPopupClassNameFromAlign:Ii,getDocument:Ci,onPopupVisibleChange:Sn,afterPopupVisibleChange:Sn,onPopupAlign:Sn,popupClassName:"",mouseEnterDelay:0,mouseLeaveDelay:.1,focusDelay:0,blurDelay:.15,popupStyle:{},destroyPopupOnHide:!1,popupAlign:{},defaultPopupVisible:!1,mask:!1,maskClosable:!0,action:[],showAction:[],hideAction:[],autoDestroy:!1},xe}var qn=Vi(Ot.a),en={adjustX:1,adjustY:1},mi={topLeft:{points:["bl","tl"],overflow:en,offset:[0,-7]},bottomLeft:{points:["tl","bl"],overflow:en,offset:[0,7]},leftTop:{points:["tr","tl"],overflow:en,offset:[-4,0]},rightTop:{points:["tl","tr"],overflow:en,offset:[4,0]}},oa={topLeft:{points:["bl","tl"],overflow:en,offset:[0,-7]},bottomLeft:{points:["tl","bl"],overflow:en,offset:[0,7]},rightTop:{points:["tr","tl"],overflow:en,offset:[-4,0]},leftTop:{points:["tl","tr"],overflow:en,offset:[4,0]}},Ni=mi,Fr=0,vr={horizontal:"bottomLeft",vertical:"rightTop","vertical-left":"rightTop","vertical-right":"leftTop"},Kr=function(xe,Ae,ce){var Z=je(Ae),oe=xe.getState();xe.setState({defaultActiveFirst:Object(K.a)(Object(K.a)({},oe.defaultActiveFirst),{},Object(ae.a)({},Z,ce))})},qt=function(le){Object(p.a)(Ae,le);var xe=Object(c.a)(Ae);function Ae(ce){var Z;Object(k.a)(this,Ae),Z=xe.call(this,ce),Z.onDestroy=function(Ce){Z.props.onDestroy(Ce)},Z.onKeyDown=function(Ce){var De=Ce.keyCode,Be=Z.menuInstance,tt=Z.props.store,et=Z.getVisible();if(De===y.a.ENTER)return Z.onTitleClick(Ce),Kr(tt,Z.props.eventKey,!0),!0;if(De===y.a.RIGHT)return et?Be.onKeyDown(Ce):(Z.triggerOpenChange(!0),Kr(tt,Z.props.eventKey,!0)),!0;if(De===y.a.LEFT){var pt;if(et)pt=Be.onKeyDown(Ce);else return;return pt||(Z.triggerOpenChange(!1),pt=!0),pt}return et&&(De===y.a.UP||De===y.a.DOWN)?Be.onKeyDown(Ce):void 0},Z.onOpenChange=function(Ce){Z.props.onOpenChange(Ce)},Z.onPopupVisibleChange=function(Ce){Z.triggerOpenChange(Ce,Ce?"mouseenter":"mouseleave")},Z.onMouseEnter=function(Ce){var De=Z.props,Be=De.eventKey,tt=De.onMouseEnter,et=De.store;Kr(et,Z.props.eventKey,!1),tt({key:Be,domEvent:Ce})},Z.onMouseLeave=function(Ce){var De=Z.props,Be=De.parentMenu,tt=De.eventKey,et=De.onMouseLeave;Be.subMenuInstance=Object(h.a)(Z),et({key:tt,domEvent:Ce})},Z.onTitleMouseEnter=function(Ce){var De=Z.props,Be=De.eventKey,tt=De.onItemHover,et=De.onTitleMouseEnter;tt({key:Be,hover:!0}),et({key:Be,domEvent:Ce})},Z.onTitleMouseLeave=function(Ce){var De=Z.props,Be=De.parentMenu,tt=De.eventKey,et=De.onItemHover,pt=De.onTitleMouseLeave;Be.subMenuInstance=Object(h.a)(Z),et({key:tt,hover:!1}),pt({key:tt,domEvent:Ce})},Z.onTitleClick=function(Ce){var De=Object(h.a)(Z),Be=De.props;if(Be.onTitleClick({key:Be.eventKey,domEvent:Ce}),Be.triggerSubMenuAction==="hover")return;Z.triggerOpenChange(!Z.getVisible(),"click"),Kr(Be.store,Z.props.eventKey,!1)},Z.onSubMenuClick=function(Ce){typeof Z.props.onClick=="function"&&Z.props.onClick(Z.addKeyPath(Ce))},Z.onSelect=function(Ce){Z.props.onSelect(Ce)},Z.onDeselect=function(Ce){Z.props.onDeselect(Ce)},Z.getPrefixCls=function(){return"".concat(Z.props.rootPrefixCls,"-submenu")},Z.getActiveClassName=function(){return"".concat(Z.getPrefixCls(),"-active")},Z.getDisabledClassName=function(){return"".concat(Z.getPrefixCls(),"-disabled")},Z.getSelectedClassName=function(){return"".concat(Z.getPrefixCls(),"-selected")},Z.getOpenClassName=function(){return"".concat(Z.props.rootPrefixCls,"-submenu-open")},Z.getVisible=function(){return Z.state.isOpen},Z.getMode=function(){return Z.state.mode},Z.saveMenuInstance=function(Ce){Z.menuInstance=Ce},Z.addKeyPath=function(Ce){return Object(K.a)(Object(K.a)({},Ce),{},{keyPath:(Ce.keyPath||[]).concat(Z.props.eventKey)})},Z.triggerOpenChange=function(Ce,De){var Be=Z.props.eventKey,tt=function(){Z.onOpenChange({key:Be,item:Object(h.a)(Z),trigger:De,open:Ce})};De==="mouseenter"?Z.mouseenterTimeout=setTimeout(function(){tt()},0):tt()},Z.isChildrenSelected=function(){var Ce={find:!1};return rt(Z.props.children,Z.props.selectedKeys,Ce),Ce.find},Z.isInlineMode=function(){return Z.getMode()==="inline"},Z.adjustWidth=function(){if(!Z.subMenuTitle||!Z.menuInstance)return;var Ce=ut.findDOMNode(Z.menuInstance);if(Ce.offsetWidth>=Z.subMenuTitle.offsetWidth)return;Ce.style.minWidth="".concat(Z.subMenuTitle.offsetWidth,"px")},Z.saveSubMenuTitle=function(Ce){Z.subMenuTitle=Ce},Z.getBaseProps=function(){var Ce=Object(h.a)(Z),De=Ce.props,Be=Z.getMode();return{mode:Be==="horizontal"?"vertical":Be,visible:Z.getVisible(),level:De.level+1,inlineIndent:De.inlineIndent,focusable:!1,onClick:Z.onSubMenuClick,onSelect:Z.onSelect,onDeselect:Z.onDeselect,onDestroy:Z.onDestroy,selectedKeys:De.selectedKeys,eventKey:"".concat(De.eventKey,"-menu-"),openKeys:De.openKeys,motion:De.motion,onOpenChange:Z.onOpenChange,subMenuOpenDelay:De.subMenuOpenDelay,parentMenu:Object(h.a)(Z),subMenuCloseDelay:De.subMenuCloseDelay,forceSubMenuRender:De.forceSubMenuRender,triggerSubMenuAction:De.triggerSubMenuAction,builtinPlacements:De.builtinPlacements,defaultActiveFirst:De.store.getState().defaultActiveFirst[je(De.eventKey)],multiple:De.multiple,prefixCls:De.rootPrefixCls,id:Z.internalMenuId,manualRef:Z.saveMenuInstance,itemIcon:De.itemIcon,expandIcon:De.expandIcon,direction:De.direction}},Z.getMotion=function(Ce,De){var Be=Object(h.a)(Z),tt=Be.haveRendered,et=Z.props,pt=et.motion,Wt=et.rootPrefixCls,Zt=Object(K.a)(Object(K.a)({},pt),{},{leavedClassName:"".concat(Wt,"-hidden"),removeOnLeave:!1,motionAppear:tt||!De||Ce!=="inline"});return Zt};var oe=ce.store,q=ce.eventKey,fe=oe.getState(),pe=fe.defaultActiveFirst;Z.isRootMenu=!1;var Le=!1;return pe&&(Le=pe[q]),Kr(oe,q,Le),Z.state={mode:ce.mode,isOpen:ce.isOpen},Z}return Object(x.a)(Ae,[{key:"componentDidMount",value:function(){this.componentDidUpdate()}},{key:"componentDidUpdate",value:function(){var Z=this,oe=this.props,q=oe.mode,fe=oe.parentMenu,pe=oe.manualRef,Le=oe.isOpen,Ce=function(){Z.setState({mode:q,isOpen:Le})},De=Le!==this.state.isOpen,Be=q!==this.state.mode;if((Be||De)&&(nt.a.cancel(this.updateStateRaf),Be?this.updateStateRaf=Object(nt.a)(Ce):Ce()),pe&&pe(this),q!=="horizontal"||!(fe==null?void 0:fe.isRootMenu)||!Le)return;this.minWidthTimeout=setTimeout(function(){return Z.adjustWidth()},0)}},{key:"componentWillUnmount",value:function(){var Z=this.props,oe=Z.onDestroy,q=Z.eventKey;oe&&oe(q),this.minWidthTimeout&&clearTimeout(this.minWidthTimeout),this.mouseenterTimeout&&clearTimeout(this.mouseenterTimeout),nt.a.cancel(this.updateStateRaf)}},{key:"renderPopupMenu",value:function(Z,oe){var q=this.getBaseProps();return w.createElement(ua,Object(m.a)({},q,{id:this.internalMenuId,className:Z,style:oe}),this.props.children)}},{key:"renderChildren",value:function(){var Z=this,oe=this.getBaseProps(),q=oe.mode,fe=oe.visible,pe=oe.forceSubMenuRender,Le=oe.direction,Ce=this.getMotion(q,fe);if(this.haveRendered=!0,this.haveOpened=this.haveOpened||fe||pe,!this.haveOpened)return w.createElement("div",null);var De=H()("".concat(oe.prefixCls,"-sub"),Object(ae.a)({},"".concat(oe.prefixCls,"-rtl"),Le==="rtl"));return this.isInlineMode()?w.createElement(Q,Object(m.a)({visible:oe.visible,forceRender:pe},Ce),function(Be){var tt=Be.className,et=Be.style,pt=H()(De,tt);return Z.renderPopupMenu(pt,et)}):this.renderPopupMenu(De)}},{key:"render",value:function(){var Z,oe,q,fe=Object(K.a)({},this.props),pe=this.getVisible(),Le=this.getPrefixCls(),Ce=this.isInlineMode(),De=this.getMode(),Be=H()(Le,"".concat(Le,"-").concat(De),(Z={},Object(ae.a)(Z,fe.className,!!fe.className),Object(ae.a)(Z,this.getOpenClassName(),pe),Object(ae.a)(Z,this.getActiveClassName(),fe.active||pe&&!Ce),Object(ae.a)(Z,this.getDisabledClassName(),fe.disabled),Object(ae.a)(Z,this.getSelectedClassName(),this.isChildrenSelected()),Z));this.internalMenuId||(fe.eventKey?this.internalMenuId="".concat(fe.eventKey,"$Menu"):(Fr+=1,this.internalMenuId="$__$".concat(Fr,"$Menu")));var tt={},et={},pt={};fe.disabled||(tt={onMouseLeave:this.onMouseLeave,onMouseEnter:this.onMouseEnter},et={onClick:this.onTitleClick},pt={onMouseEnter:this.onTitleMouseEnter,onMouseLeave:this.onTitleMouseLeave});var Wt={},Zt=fe.direction,Xt=Zt==="rtl";Ce&&(Xt?Wt.paddingRight=fe.inlineIndent*fe.level:Wt.paddingLeft=fe.inlineIndent*fe.level);var Yt={};this.getVisible()&&(Yt={"aria-owns":this.internalMenuId});var Jt=null;De!=="horizontal"&&(Jt=this.props.expandIcon,typeof this.props.expandIcon=="function"&&(Jt=w.createElement(this.props.expandIcon,Object(K.a)({},this.props))));var Qt=w.createElement("div",Object(m.a)({ref:this.saveSubMenuTitle,style:Wt,className:"".concat(Le,"-title"),role:"button"},pt,et,{"aria-expanded":pe},Yt,{"aria-haspopup":"true",title:typeof fe.title=="string"?fe.title:void 0}),fe.title,Jt||w.createElement("i",{className:"".concat(Le,"-arrow")})),$t=this.renderChildren(),dr=((oe=fe.parentMenu)===null||oe===void 0?void 0:oe.isRootMenu)?fe.parentMenu.props.getPopupContainer:function(wr){return wr.parentNode},ar=vr[De],Nr=fe.popupOffset?{offset:fe.popupOffset}:{},or=H()((q={},Object(ae.a)(q,fe.popupClassName,fe.popupClassName&&!Ce),Object(ae.a)(q,"".concat(Le,"-rtl"),Xt),q)),Bt=fe.disabled,Nt=fe.triggerSubMenuAction,sr=fe.subMenuOpenDelay,cr=fe.forceSubMenuRender,Dt=fe.subMenuCloseDelay,fr=fe.builtinPlacements;st.forEach(function(wr){return delete fe[wr]}),delete fe.onClick;var Ur=Xt?Object(K.a)(Object(K.a)({},oa),fr):Object(K.a)(Object(K.a)({},mi),fr);delete fe.direction;var yr=this.getBaseProps(),Lr=Ce?null:this.getMotion(yr.mode,yr.visible);return w.createElement("li",Object(m.a)({},fe,tt,{className:Be,role:"menuitem"}),w.createElement(qn,{prefixCls:Le,popupClassName:H()("".concat(Le,"-popup"),or),getPopupContainer:dr,builtinPlacements:Ur,popupPlacement:ar,popupVisible:Ce?!1:pe,popupAlign:Nr,popup:Ce?null:$t,action:Bt||Ce?[]:[Nt],mouseEnterDelay:sr,mouseLeaveDelay:Dt,onPopupVisibleChange:this.onPopupVisibleChange,forceRender:cr,popupMotion:Lr},Qt),Ce?$t:null)}}]),Ae}(w.Component);qt.defaultProps={onMouseEnter:ot,onMouseLeave:ot,onTitleMouseEnter:ot,onTitleMouseLeave:ot,onTitleClick:ot,manualRef:ot,mode:"vertical",title:""};var zr=Object(o.b)(function(le,xe){var Ae=le.openKeys,ce=le.activeKey,Z=le.selectedKeys,oe=xe.eventKey,q=xe.subMenuKey;return{isOpen:Ae.indexOf(oe)>-1,active:ce[q]===oe,selectedKeys:Z}})(qt);zr.isSubMenu=!0;var Sr=zr,ei="menuitem-overflowed",tn=.5,vn=function(le){Object(p.a)(Ae,le);var xe=Object(c.a)(Ae);function Ae(){var ce;return Object(k.a)(this,Ae),ce=xe.apply(this,arguments),ce.resizeObserver=null,ce.mutationObserver=null,ce.originalTotalWidth=0,ce.overflowedItems=[],ce.menuItemSizes=[],ce.cancelFrameId=null,ce.state={lastVisibleIndex:void 0},ce.childRef=w.createRef(),ce.getMenuItemNodes=function(){var Z=ce.props.prefixCls,oe=ce.childRef.current;return oe?[].slice.call(oe.children).filter(function(q){return q.className.split(" ").indexOf("".concat(Z,"-overflowed-submenu"))<0}):[]},ce.getOverflowedSubMenuItem=function(Z,oe,q){var fe=ce.props,pe=fe.overflowedIndicator,Le=fe.level,Ce=fe.mode,De=fe.prefixCls,Be=fe.theme;if(Le!==1||Ce!=="horizontal")return null;var tt=ce.props.children[0],et=tt.props,pt=et.children,Wt=et.title,Zt=et.style,Xt=Object(D.a)(et,["children","title","style"]),Yt=Object(K.a)({},Zt),Jt="".concat(Z,"-overflowed-indicator"),Qt="".concat(Z,"-overflowed-indicator");oe.length===0&&q!==!0?Yt=Object(K.a)(Object(K.a)({},Yt),{},{display:"none"}):q&&(Yt=Object(K.a)(Object(K.a)({},Yt),{},{visibility:"hidden",position:"absolute"}),Jt="".concat(Jt,"-placeholder"),Qt="".concat(Qt,"-placeholder"));var $t=Be?"".concat(De,"-").concat(Be):"",dr={};return st.forEach(function(ar){Xt[ar]!==void 0&&(dr[ar]=Xt[ar])}),w.createElement(Sr,Object(m.a)({title:pe,className:"".concat(De,"-overflowed-submenu"),popupClassName:$t},dr,{key:Jt,eventKey:Qt,disabled:!1,style:Yt}),oe)},ce.setChildrenWidthAndResize=function(){if(ce.props.mode!=="horizontal")return;var Z=ce.childRef.current;if(!Z)return;var oe=Z.children;if(!oe||oe.length===0)return;var q=Z.children[oe.length-1];Ve(q,"display","inline-block");var fe=ce.getMenuItemNodes(),pe=fe.filter(function(Le){return Le.className.split(" ").indexOf(ei)>=0});pe.forEach(function(Le){Ve(Le,"display","inline-block")}),ce.menuItemSizes=fe.map(function(Le){return qe(Le,!0)}),pe.forEach(function(Le){Ve(Le,"display","none")}),ce.overflowedIndicatorWidth=qe(Z.children[Z.children.length-1],!0),ce.originalTotalWidth=ce.menuItemSizes.reduce(function(Le,Ce){return Le+Ce},0),ce.handleResize(),Ve(q,"display","none")},ce.handleResize=function(){if(ce.props.mode!=="horizontal")return;var Z=ce.childRef.current;if(!Z)return;var oe=qe(Z);ce.overflowedItems=[];var q=0,fe;ce.originalTotalWidth>oe+tn&&(fe=-1,ce.menuItemSizes.forEach(function(pe){q+=pe,q+ce.overflowedIndicatorWidth<=oe&&(fe+=1)})),ce.setState({lastVisibleIndex:fe})},ce}return Object(x.a)(Ae,[{key:"componentDidMount",value:function(){var Z=this;if(this.setChildrenWidthAndResize(),this.props.level===1&&this.props.mode==="horizontal"){var oe=this.childRef.current;if(!oe)return;this.resizeObserver=new ht.default(function(q){q.forEach(function(){var fe=Z.cancelFrameId;cancelAnimationFrame(fe),Z.cancelFrameId=requestAnimationFrame(Z.setChildrenWidthAndResize)})}),[].slice.call(oe.children).concat(oe).forEach(function(q){Z.resizeObserver.observe(q)}),typeof MutationObserver!="undefined"&&(this.mutationObserver=new MutationObserver(function(){Z.resizeObserver.disconnect(),[].slice.call(oe.children).concat(oe).forEach(function(q){Z.resizeObserver.observe(q)}),Z.setChildrenWidthAndResize()}),this.mutationObserver.observe(oe,{attributes:!1,childList:!0,subTree:!1}))}}},{key:"componentWillUnmount",value:function(){this.resizeObserver&&this.resizeObserver.disconnect(),this.mutationObserver&&this.mutationObserver.disconnect(),cancelAnimationFrame(this.cancelFrameId)}},{key:"renderChildren",value:function(Z){var oe=this,q=this.state.lastVisibleIndex;return(Z||[]).reduce(function(fe,pe,Le){var Ce=pe;if(oe.props.mode==="horizontal"){var De=oe.getOverflowedSubMenuItem(pe.props.eventKey,[]);q!==void 0&&oe.props.className.indexOf("".concat(oe.props.prefixCls,"-root"))!==-1&&(Le>q&&(Ce=w.cloneElement(pe,{style:{display:"none"},eventKey:"".concat(pe.props.eventKey,"-hidden"),className:"".concat(ei)})),Le===q+1&&(oe.overflowedItems=Z.slice(q+1).map(function(tt){return w.cloneElement(tt,{key:tt.props.eventKey,mode:"vertical-left"})}),De=oe.getOverflowedSubMenuItem(pe.props.eventKey,oe.overflowedItems)));var Be=[].concat(Object(M.a)(fe),[De,Ce]);return Le===Z.length-1&&Be.push(oe.getOverflowedSubMenuItem(pe.props.eventKey,[],!0)),Be}return[].concat(Object(M.a)(fe),[Ce])},[])}},{key:"render",value:function(){var Z=this.props,oe=Z.visible,q=Z.prefixCls,fe=Z.overflowedIndicator,pe=Z.mode,Le=Z.level,Ce=Z.tag,De=Z.children,Be=Z.theme,tt=Object(D.a)(Z,["visible","prefixCls","overflowedIndicator","mode","level","tag","children","theme"]),et=Ce;return w.createElement(et,Object(m.a)({ref:this.childRef},tt),this.renderChildren(De))}}]),Ae}(w.Component);vn.defaultProps={tag:"div",className:""};var Xi=vn;function Ti(le){return le.length?le.every(function(xe){return!!xe.props.disabled}):!0}function wi(le,xe,Ae){var ce=le.getState();le.setState({activeKey:Object(K.a)(Object(K.a)({},ce.activeKey),{},Object(ae.a)({},xe,Ae))})}function jn(le){return le.eventKey||"0-menu-"}function Wn(le,xe){var Ae=xe,ce=le.children,Z=le.eventKey;if(Ae){var oe;if(Ye(ce,function(q,fe){q&&q.props&&!q.props.disabled&&Ae===ct(q,Z,fe)&&(oe=!0)}),oe)return Ae}return Ae=null,le.defaultActiveFirst&&Ye(ce,function(q,fe){!Ae&&q&&!q.props.disabled&&(Ae=ct(q,Z,fe))}),Ae}function sa(le){if(!le)return;var xe=this.instanceArray.indexOf(le);xe!==-1?this.instanceArray[xe]=le:this.instanceArray.push(le)}var Xn=function(le){Object(p.a)(Ae,le);var xe=Object(c.a)(Ae);function Ae(ce){var Z;return Object(k.a)(this,Ae),Z=xe.call(this,ce),Z.onKeyDown=function(oe,q){var fe=oe.keyCode,pe;if(Z.getFlatInstanceArray().forEach(function(Ce){Ce&&Ce.props.active&&Ce.onKeyDown&&(pe=Ce.onKeyDown(oe))}),pe)return 1;var Le=null;return(fe===y.a.UP||fe===y.a.DOWN)&&(Le=Z.step(fe===y.a.UP?-1:1)),Le?(oe.preventDefault(),wi(Z.props.store,jn(Z.props),Le.props.eventKey),typeof q=="function"&&q(Le),1):void 0},Z.onItemHover=function(oe){var q=oe.key,fe=oe.hover;wi(Z.props.store,jn(Z.props),fe?q:null)},Z.onDeselect=function(oe){Z.props.onDeselect(oe)},Z.onSelect=function(oe){Z.props.onSelect(oe)},Z.onClick=function(oe){Z.props.onClick(oe)},Z.onOpenChange=function(oe){Z.props.onOpenChange(oe)},Z.onDestroy=function(oe){Z.props.onDestroy(oe)},Z.getFlatInstanceArray=function(){return Z.instanceArray},Z.step=function(oe){var q=Z.getFlatInstanceArray(),fe=Z.props.store.getState().activeKey[jn(Z.props)],pe=q.length;if(!pe)return null;oe<0&&(q=q.concat().reverse());var Le=-1;if(q.every(function(tt,et){return tt&&tt.props.eventKey===fe?(Le=et,!1):!0}),!Z.props.defaultActiveFirst&&Le!==-1&&Ti(q.slice(Le,pe-1)))return;var Ce=(Le+1)%pe,De=Ce;do{var Be=q[De];if(!Be||Be.props.disabled)De=(De+1)%pe;else return Be}while(De!==Ce);return null},Z.renderCommonMenuItem=function(oe,q,fe){var pe=Z.props.store.getState(),Le=Object(h.a)(Z),Ce=Le.props,De=ct(oe,Ce.eventKey,q),Be=oe.props;if(!Be||typeof oe.type=="string")return oe;var tt=De===pe.activeKey,et=Object(K.a)(Object(K.a)({mode:Be.mode||Ce.mode,level:Ce.level,inlineIndent:Ce.inlineIndent,renderMenuItem:Z.renderMenuItem,rootPrefixCls:Ce.prefixCls,index:q,parentMenu:Ce.parentMenu,manualRef:Be.disabled?void 0:Object(v.a)(oe.ref,sa.bind(Object(h.a)(Z))),eventKey:De,active:!Be.disabled&&tt,multiple:Ce.multiple,onClick:function(Wt){(Be.onClick||ot)(Wt),Z.onClick(Wt)},onItemHover:Z.onItemHover,motion:Ce.motion,subMenuOpenDelay:Ce.subMenuOpenDelay,subMenuCloseDelay:Ce.subMenuCloseDelay,forceSubMenuRender:Ce.forceSubMenuRender,onOpenChange:Z.onOpenChange,onDeselect:Z.onDeselect,onSelect:Z.onSelect,builtinPlacements:Ce.builtinPlacements,itemIcon:Be.itemIcon||Z.props.itemIcon,expandIcon:Be.expandIcon||Z.props.expandIcon},fe),{},{direction:Ce.direction});return(Ce.mode==="inline"||Ke())&&(et.triggerSubMenuAction="click"),w.cloneElement(oe,Object(K.a)(Object(K.a)({},et),{},{key:De||q}))},Z.renderMenuItem=function(oe,q,fe){if(!oe)return null;var pe=Z.props.store.getState(),Le={openKeys:pe.openKeys,selectedKeys:pe.selectedKeys,triggerSubMenuAction:Z.props.triggerSubMenuAction,subMenuKey:fe};return Z.renderCommonMenuItem(oe,q,Le)},ce.store.setState({activeKey:Object(K.a)(Object(K.a)({},ce.store.getState().activeKey),{},Object(ae.a)({},ce.eventKey,Wn(ce,ce.activeKey)))}),Z.instanceArray=[],Z}return Object(x.a)(Ae,[{key:"componentDidMount",value:function(){this.props.manualRef&&this.props.manualRef(this)}},{key:"shouldComponentUpdate",value:function(Z){return this.props.visible||Z.visible||this.props.className!==Z.className||!N()(this.props.style,Z.style)}},{key:"componentDidUpdate",value:function(Z){var oe=this.props,q="activeKey"in oe?oe.activeKey:oe.store.getState().activeKey[jn(oe)],fe=Wn(oe,q);if(fe!==q)wi(oe.store,jn(oe),fe);else if("activeKey"in Z){var pe=Wn(Z,Z.activeKey);fe!==pe&&wi(oe.store,jn(oe),fe)}}},{key:"render",value:function(){var Z=this,oe=Object(m.a)({},this.props);this.instanceArray=[];var q=H()(oe.prefixCls,oe.className,"".concat(oe.prefixCls,"-").concat(oe.mode)),fe={className:q,role:oe.role||"menu"};oe.id&&(fe.id=oe.id),oe.focusable&&(fe.tabIndex=0,fe.onKeyDown=this.onKeyDown);var pe=oe.prefixCls,Le=oe.eventKey,Ce=oe.visible,De=oe.level,Be=oe.mode,tt=oe.overflowedIndicator,et=oe.theme;return st.forEach(function(pt){return delete oe[pt]}),delete oe.onClick,w.createElement(Xi,Object(m.a)({},oe,{prefixCls:pe,mode:Be,tag:"ul",level:De,theme:et,visible:Ce,overflowedIndicator:tt},fe),Object(W.a)(oe.children).map(function(pt,Wt){return Z.renderMenuItem(pt,Wt,Le||"0-menu-")}))}}]),Ae}(w.Component);Xn.defaultProps={prefixCls:"rc-menu",className:"",mode:"vertical",level:1,inlineIndent:24,visible:!0,focusable:!0,style:{},manualRef:ot};var la=Object(o.b)()(Xn),ua=la,Ui=ne("Kwbf");function Ba(le,xe,Ae){var ce=le.prefixCls,Z=le.motion,oe=le.defaultMotions,q=oe===void 0?{}:oe,fe=le.openAnimation,pe=le.openTransitionName,Le=xe.switchingModeFromInline;if(Z)return Z;if(Object(z.a)(fe)==="object"&&fe)Object(Ui.a)(!1,"Object type of `openAnimation` is removed. Please use `motion` instead.");else if(typeof fe=="string")return{motionName:"".concat(ce,"-open-").concat(fe)};if(pe)return{motionName:pe};var Ce=q[Ae];return Ce||(Le?null:q.other)}var _t=function(le){Object(p.a)(Ae,le);var xe=Object(c.a)(Ae);function Ae(ce){var Z;Object(k.a)(this,Ae),Z=xe.call(this,ce),Z.onSelect=function(fe){var pe=Object(h.a)(Z),Le=pe.props;if(Le.selectable){var Ce=Z.store.getState(),De=Ce.selectedKeys,Be=fe.key;Le.multiple?De=De.concat([Be]):De=[Be],"selectedKeys"in Le||Z.store.setState({selectedKeys:De}),Le.onSelect(Object(K.a)(Object(K.a)({},fe),{},{selectedKeys:De}))}},Z.onClick=function(fe){var pe=Z.getRealMenuMode(),Le=Object(h.a)(Z),Ce=Le.store,De=Le.props.onOpenChange;pe!=="inline"&&!("openKeys"in Z.props)&&(Ce.setState({openKeys:[]}),De([])),Z.props.onClick(fe)},Z.onKeyDown=function(fe,pe){Z.innerMenu.getWrappedInstance().onKeyDown(fe,pe)},Z.onOpenChange=function(fe){var pe=Object(h.a)(Z),Le=pe.props,Ce=Z.store.getState().openKeys.concat(),De=!1,Be=function(et){var pt=!1;if(et.open)pt=Ce.indexOf(et.key)===-1,pt&&Ce.push(et.key);else{var Wt=Ce.indexOf(et.key);pt=Wt!==-1,pt&&Ce.splice(Wt,1)}De=De||pt};Array.isArray(fe)?fe.forEach(Be):Be(fe),De&&("openKeys"in Z.props||Z.store.setState({openKeys:Ce}),Le.onOpenChange(Ce))},Z.onDeselect=function(fe){var pe=Object(h.a)(Z),Le=pe.props;if(Le.selectable){var Ce=Z.store.getState().selectedKeys.concat(),De=fe.key,Be=Ce.indexOf(De);Be!==-1&&Ce.splice(Be,1),"selectedKeys"in Le||Z.store.setState({selectedKeys:Ce}),Le.onDeselect(Object(K.a)(Object(K.a)({},fe),{},{selectedKeys:Ce}))}},Z.onMouseEnter=function(fe){Z.restoreModeVerticalFromInline();var pe=Z.props.onMouseEnter;pe&&pe(fe)},Z.onTransitionEnd=function(fe){var pe=fe.propertyName==="width"&&fe.target===fe.currentTarget,Le=fe.target.className,Ce=Object.prototype.toString.call(Le)==="[object SVGAnimatedString]"?Le.animVal:Le,De=fe.propertyName==="font-size"&&Ce.indexOf("anticon")>=0;(pe||De)&&Z.restoreModeVerticalFromInline()},Z.setInnerMenu=function(fe){Z.innerMenu=fe},Z.isRootMenu=!0;var oe=ce.defaultSelectedKeys,q=ce.defaultOpenKeys;return"selectedKeys"in ce&&(oe=ce.selectedKeys||[]),"openKeys"in ce&&(q=ce.openKeys||[]),Z.store=Object(o.c)({selectedKeys:oe,openKeys:q,activeKey:{"0-menu-":Wn(ce,ce.activeKey)}}),Z.state={switchingModeFromInline:!1,prevProps:ce,inlineOpenKeys:[],store:Z.store},Z}return Object(x.a)(Ae,[{key:"componentDidMount",value:function(){this.updateMiniStore(),this.updateMenuDisplay()}},{key:"componentDidUpdate",value:function(Z){var oe=this.props,q=oe.siderCollapsed,fe=oe.inlineCollapsed,pe=oe.onOpenChange;(!Z.inlineCollapsed&&fe||!Z.siderCollapsed&&q)&&pe([]),this.updateMiniStore(),this.updateMenuDisplay()}},{key:"updateMenuDisplay",value:function(){var Z=this.props.collapsedWidth,oe=this.store,q=this.prevOpenKeys,fe=this.getInlineCollapsed()&&(Z===0||Z==="0"||Z==="0px");fe?(this.prevOpenKeys=oe.getState().openKeys.concat(),this.store.setState({openKeys:[]})):q&&(this.store.setState({openKeys:q}),this.prevOpenKeys=null)}},{key:"getRealMenuMode",value:function(){var Z=this.props.mode,oe=this.state.switchingModeFromInline,q=this.getInlineCollapsed();return oe&&q?"inline":q?"vertical":Z}},{key:"getInlineCollapsed",value:function(){var Z=this.props,oe=Z.inlineCollapsed,q=Z.siderCollapsed;return q!==void 0?q:oe}},{key:"restoreModeVerticalFromInline",value:function(){var Z=this.state.switchingModeFromInline;Z&&this.setState({switchingModeFromInline:!1})}},{key:"updateMiniStore",value:function(){"selectedKeys"in this.props&&this.store.setState({selectedKeys:this.props.selectedKeys||[]}),"openKeys"in this.props&&this.store.setState({openKeys:this.props.openKeys||[]})}},{key:"render",value:function(){var Z=Object(K.a)({},Object(S.a)(this.props,["collapsedWidth","siderCollapsed","defaultMotions"])),oe=this.getRealMenuMode();return Z.className+=" ".concat(Z.prefixCls,"-root"),Z.direction==="rtl"&&(Z.className+=" ".concat(Z.prefixCls,"-rtl")),Z=Object(K.a)(Object(K.a)({},Z),{},{mode:oe,onClick:this.onClick,onOpenChange:this.onOpenChange,onDeselect:this.onDeselect,onSelect:this.onSelect,onMouseEnter:this.onMouseEnter,onTransitionEnd:this.onTransitionEnd,parentMenu:this,motion:Ba(this.props,this.state,oe)}),delete Z.openAnimation,delete Z.openTransitionName,w.createElement(o.a,{store:this.store},w.createElement(ua,Object(m.a)({},Z,{ref:this.setInnerMenu}),this.props.children))}}],[{key:"getDerivedStateFromProps",value:function(Z,oe){var q=oe.prevProps,fe=oe.store,pe=fe.getState(),Le={},Ce={prevProps:Z};return q.mode==="inline"&&Z.mode!=="inline"&&(Ce.switchingModeFromInline=!0),"openKeys"in Z?Le.openKeys=Z.openKeys||[]:((Z.inlineCollapsed&&!q.inlineCollapsed||Z.siderCollapsed&&!q.siderCollapsed)&&(Ce.switchingModeFromInline=!0,Ce.inlineOpenKeys=pe.openKeys,Le.openKeys=[]),(!Z.inlineCollapsed&&q.inlineCollapsed||!Z.siderCollapsed&&q.siderCollapsed)&&(Le.openKeys=oe.inlineOpenKeys,Ce.inlineOpenKeys=[])),Object.keys(Le).length&&fe.setState(Le),Ce}}]),Ae}(w.Component);_t.defaultProps={selectable:!0,onClick:ot,onSelect:ot,onOpenChange:ot,onDeselect:ot,defaultSelectedKeys:[],defaultOpenKeys:[],subMenuOpenDelay:.1,subMenuCloseDelay:.1,triggerSubMenuAction:"hover",prefixCls:"rc-menu",className:"",mode:"vertical",style:{},builtinPlacements:{},overflowedIndicator:w.createElement("span",null,"\xB7\xB7\xB7")};var zt=_t,Pt=function(le){Object(p.a)(Ae,le);var xe=Object(c.a)(Ae);function Ae(){var ce;return Object(k.a)(this,Ae),ce=xe.apply(this,arguments),ce.onKeyDown=function(Z){var oe=Z.keyCode;return oe===y.a.ENTER?(ce.onClick(Z),!0):void 0},ce.onMouseLeave=function(Z){var oe=ce.props,q=oe.eventKey,fe=oe.onItemHover,pe=oe.onMouseLeave;fe({key:q,hover:!1}),pe({key:q,domEvent:Z})},ce.onMouseEnter=function(Z){var oe=ce.props,q=oe.eventKey,fe=oe.onItemHover,pe=oe.onMouseEnter;fe({key:q,hover:!0}),pe({key:q,domEvent:Z})},ce.onClick=function(Z){var oe=ce.props,q=oe.eventKey,fe=oe.multiple,pe=oe.onClick,Le=oe.onSelect,Ce=oe.onDeselect,De=oe.isSelected,Be={key:q,keyPath:[q],item:Object(h.a)(ce),domEvent:Z};pe(Be),fe?De?Ce(Be):Le(Be):De||Le(Be)},ce.saveNode=function(Z){ce.node=Z},ce}return Object(x.a)(Ae,[{key:"componentDidMount",value:function(){this.callRef()}},{key:"componentDidUpdate",value:function(){this.callRef()}},{key:"componentWillUnmount",value:function(){var Z=this.props;Z.onDestroy&&Z.onDestroy(Z.eventKey)}},{key:"getPrefixCls",value:function(){return"".concat(this.props.rootPrefixCls,"-item")}},{key:"getActiveClassName",value:function(){return"".concat(this.getPrefixCls(),"-active")}},{key:"getSelectedClassName",value:function(){return"".concat(this.getPrefixCls(),"-selected")}},{key:"getDisabledClassName",value:function(){return"".concat(this.getPrefixCls(),"-disabled")}},{key:"callRef",value:function(){this.props.manualRef&&this.props.manualRef(this)}},{key:"render",value:function(){var Z,oe=Object(K.a)({},this.props),q=H()(this.getPrefixCls(),oe.className,(Z={},Object(ae.a)(Z,this.getActiveClassName(),!oe.disabled&&oe.active),Object(ae.a)(Z,this.getSelectedClassName(),oe.isSelected),Object(ae.a)(Z,this.getDisabledClassName(),oe.disabled),Z)),fe=Object(K.a)(Object(K.a)({},oe.attribute),{},{title:typeof oe.title=="string"?oe.title:void 0,className:q,role:oe.role||"menuitem","aria-disabled":oe.disabled});oe.role==="option"?fe=Object(K.a)(Object(K.a)({},fe),{},{role:"option","aria-selected":oe.isSelected}):(oe.role===null||oe.role==="none")&&(fe.role="none");var pe={onClick:oe.disabled?null:this.onClick,onMouseLeave:oe.disabled?null:this.onMouseLeave,onMouseEnter:oe.disabled?null:this.onMouseEnter},Le=Object(K.a)({},oe.style);oe.mode==="inline"&&(oe.direction==="rtl"?Le.paddingRight=oe.inlineIndent*oe.level:Le.paddingLeft=oe.inlineIndent*oe.level),st.forEach(function(De){return delete oe[De]}),delete oe.direction;var Ce=this.props.itemIcon;return typeof this.props.itemIcon=="function"&&(Ce=w.createElement(this.props.itemIcon,this.props)),w.createElement("li",Object(m.a)({},Object(S.a)(oe,["onClick","onMouseEnter","onMouseLeave","onSelect"]),fe,pe,{style:Le,ref:this.saveNode}),oe.children,Ce)}}]),Ae}(w.Component);Pt.isMenuItem=!0,Pt.defaultProps={onSelect:ot,onMouseEnter:ot,onMouseLeave:ot,manualRef:ot};var er=Object(o.b)(function(le,xe){var Ae=le.activeKey,ce=le.selectedKeys,Z=xe.eventKey,oe=xe.subMenuKey;return{active:Ae[oe]===Z,isSelected:Array.isArray(ce)?ce.indexOf(Z)!==-1:ce===Z}})(Pt),hr=er,Cr=function(le){Object(p.a)(Ae,le);var xe=Object(c.a)(Ae);function Ae(){var ce;return Object(k.a)(this,Ae),ce=xe.apply(this,arguments),ce.renderInnerMenuItem=function(Z){var oe=ce.props,q=oe.renderMenuItem,fe=oe.index;return q(Z,fe,ce.props.subMenuKey)},ce}return Object(x.a)(Ae,[{key:"render",value:function(){var Z=Object(m.a)({},this.props),oe=Z.className,q=oe===void 0?"":oe,fe=Z.rootPrefixCls,pe="".concat(fe,"-item-group-title"),Le="".concat(fe,"-item-group-list"),Ce=Z.title,De=Z.children;return st.forEach(function(Be){return delete Z[Be]}),delete Z.direction,w.createElement("li",Object(m.a)({},Z,{onClick:function(tt){return tt.stopPropagation()},className:"".concat(q," ").concat(fe,"-item-group")}),w.createElement("div",{className:pe,title:typeof Ce=="string"?Ce:void 0},Ce),w.createElement("ul",{className:Le},w.Children.map(De,this.renderInnerMenuItem)))}}]),Ae}(w.Component);Cr.isMenuItemGroup=!0,Cr.defaultProps={disabled:!0};var ur=Cr,Vr=function(xe){var Ae=xe.className,ce=xe.rootPrefixCls,Z=xe.style;return w.createElement("li",{className:"".concat(Ae," ").concat(ce,"-item-divider"),style:Z})};Vr.defaultProps={disabled:!0,className:"",style:{}};var _n=Vr,ir=zt,gi=ne("eDIo");function br(le,xe){var Ae=le.prefixCls,ce=le.editable,Z=le.locale,oe=le.style;return!ce||ce.showAdd===!1?null:w.createElement("button",{ref:xe,type:"button",className:"".concat(Ae,"-nav-add"),style:oe,"aria-label":(Z==null?void 0:Z.addAriaLabel)||"Add tab",onClick:function(fe){ce.onEdit("add",{event:fe})}},ce.addIcon||"+")}var Cn=w.forwardRef(br);function yn(le,xe){var Ae=le.prefixCls,ce=le.id,Z=le.tabs,oe=le.locale,q=le.mobile,fe=le.moreIcon,pe=fe===void 0?"More":fe,Le=le.moreTransitionName,Ce=le.style,De=le.className,Be=le.editable,tt=le.tabBarGutter,et=le.rtl,pt=le.onTabClick,Wt=Object(w.useState)(!1),Zt=Object(X.a)(Wt,2),Xt=Zt[0],Yt=Zt[1],Jt=Object(w.useState)(null),Qt=Object(X.a)(Jt,2),$t=Qt[0],dr=Qt[1],ar="".concat(ce,"-more-popup"),Nr="".concat(Ae,"-dropdown"),or=$t!==null?"".concat(ar,"-").concat($t):null,Bt=oe==null?void 0:oe.dropdownAriaLabel,Nt=w.createElement(ir,{onClick:function(Lr){var wr=Lr.key,Yr=Lr.domEvent;pt(wr,Yr),Yt(!1)},id:ar,tabIndex:-1,role:"listbox","aria-activedescendant":or,selectedKeys:[$t],"aria-label":Bt!==void 0?Bt:"expanded dropdown"},Z.map(function(yr){return w.createElement(hr,{key:yr.key,id:"".concat(ar,"-").concat(yr.key),role:"option","aria-controls":ce&&"".concat(ce,"-panel-").concat(yr.key),disabled:yr.disabled},yr.tab)}));function sr(yr){for(var Lr=Z.filter(function(On){return!On.disabled}),wr=Lr.findIndex(function(On){return On.key===$t})||0,Yr=Lr.length,un=0;un<Yr;un+=1){wr=(wr+yr+Yr)%Yr;var jr=Lr[wr];if(!jr.disabled){dr(jr.key);return}}}function cr(yr){var Lr=yr.which;if(!Xt){[y.a.DOWN,y.a.SPACE,y.a.ENTER].includes(Lr)&&(Yt(!0),yr.preventDefault());return}switch(Lr){case y.a.UP:sr(-1),yr.preventDefault();break;case y.a.DOWN:sr(1),yr.preventDefault();break;case y.a.ESC:Yt(!1);break;case y.a.SPACE:case y.a.ENTER:$t!==null&&pt($t,yr);break}}Object(w.useEffect)(function(){var yr=document.getElementById(or);yr&&yr.scrollIntoView&&yr.scrollIntoView(!1)},[$t]),Object(w.useEffect)(function(){Xt||dr(null)},[Xt]);var Dt=Object(ae.a)({},et?"marginLeft":"marginRight",tt);Z.length||(Dt.visibility="hidden",Dt.order=1);var fr=H()(Object(ae.a)({},"".concat(Nr,"-rtl"),et)),Ur=q?null:w.createElement(gi.a,{prefixCls:Nr,overlay:Nt,trigger:["hover"],visible:Xt,transitionName:Le,onVisibleChange:Yt,overlayClassName:fr,mouseEnterDelay:.1,mouseLeaveDelay:.1},w.createElement("button",{type:"button",className:"".concat(Ae,"-nav-more"),style:Dt,tabIndex:-1,"aria-hidden":"true","aria-haspopup":"listbox","aria-controls":ar,id:"".concat(ce,"-more"),"aria-expanded":Xt,onKeyDown:cr},pe));return w.createElement("div",{className:H()("".concat(Ae,"-nav-operations"),De),style:Ce,ref:xe},Ur,w.createElement(Cn,{prefixCls:Ae,locale:oe,editable:Be}))}var Yn=w.forwardRef(yn),Fa=Object(w.createContext)(null),Ko=.1,Yi=.01,Xr=20,go=Math.pow(.995,Xr);function vo(){var le=navigator.userAgent||navigator.vendor||window.opera;return!!(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(le)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(le.substr(0,4)))}function da(le,xe){var Ae=Object(w.useState)(),ce=Object(X.a)(Ae,2),Z=ce[0],oe=ce[1],q=Object(w.useState)(0),fe=Object(X.a)(q,2),pe=fe[0],Le=fe[1],Ce=Object(w.useState)(0),De=Object(X.a)(Ce,2),Be=De[0],tt=De[1],et=Object(w.useState)(),pt=Object(X.a)(et,2),Wt=pt[0],Zt=pt[1],Xt=Object(w.useRef)();function Yt(Bt){var Nt=Bt.touches[0],sr=Nt.screenX,cr=Nt.screenY;oe({x:sr,y:cr}),window.clearInterval(Xt.current)}function Jt(Bt){if(!Z)return;Bt.preventDefault();var Nt=Bt.touches[0],sr=Nt.screenX,cr=Nt.screenY;oe({x:sr,y:cr});var Dt=sr-Z.x,fr=cr-Z.y;xe(Dt,fr);var Ur=Date.now();Le(Ur),tt(Ur-pe),Zt({x:Dt,y:fr})}function Qt(){if(!Z)return;if(oe(null),Zt(null),Wt){var Bt=Wt.x/Be,Nt=Wt.y/Be,sr=Math.abs(Bt),cr=Math.abs(Nt);if(Math.max(sr,cr)<Ko)return;var Dt=Bt,fr=Nt;Xt.current=window.setInterval(function(){if(Math.abs(Dt)<Yi&&Math.abs(fr)<Yi){window.clearInterval(Xt.current);return}Dt*=go,fr*=go,xe(Dt*Xr,fr*Xr)},Xr)}}var $t=Object(w.useRef)(0),dr=Object(w.useRef)(!1),ar=Object(w.useRef)();function Nr(Bt){var Nt=Bt.deltaX,sr=Bt.deltaY,cr=0,Dt=Math.abs(Nt),fr=Math.abs(sr);Dt===fr?cr=ar.current==="x"?Nt:sr:Dt>fr?(cr=Nt,ar.current="x"):(cr=sr,ar.current="y");var Ur=Date.now();Ur-$t.current>100&&(dr.current=!1),(xe(-cr,-cr)||dr.current)&&(Bt.preventDefault(),dr.current=!0),$t.current=Ur}var or=Object(w.useRef)(null);or.current={onTouchStart:Yt,onTouchMove:Jt,onTouchEnd:Qt,onWheel:Nr},w.useEffect(function(){function Bt(Dt){or.current.onTouchStart(Dt)}function Nt(Dt){or.current.onTouchMove(Dt)}function sr(Dt){or.current.onTouchEnd(Dt)}function cr(Dt){or.current.onWheel(Dt)}return document.addEventListener("touchmove",Nt,{passive:!1}),document.addEventListener("touchend",sr,{passive:!1}),le.current.addEventListener("touchstart",Bt,{passive:!1}),le.current.addEventListener("wheel",cr),function(){document.removeEventListener("touchmove",Nt),document.removeEventListener("touchend",sr)}},[])}function zo(){var le=Object(w.useRef)(new Map);function xe(ce){return le.current.has(ce)||le.current.set(ce,w.createRef()),le.current.get(ce)}function Ae(ce){le.current.delete(ce)}return[xe,Ae]}function ja(le,xe){var Ae=w.useRef(le),ce=w.useState({}),Z=Object(X.a)(ce,2),oe=Z[1];function q(fe){var pe=typeof fe=="function"?fe(Ae.current):fe;pe!==Ae.current&&xe(pe,Ae.current),Ae.current=pe,oe({})}return[Ae.current,q]}var yo=function(xe){var Ae=xe.position,ce=xe.prefixCls,Z=xe.extra;if(!Z)return null;var oe,q=Z;return Ae==="right"&&(oe=q.right||!q.left&&q||null),Ae==="left"&&(oe=q.left||null),oe?w.createElement("div",{className:"".concat(ce,"-extra-content")},oe):null};function Wa(le,xe){var Ae,ce=w.useContext(Fa),Z=ce.prefixCls,oe=ce.tabs,q=le.className,fe=le.style,pe=le.id,Le=le.animated,Ce=le.activeKey,De=le.rtl,Be=le.extra,tt=le.editable,et=le.locale,pt=le.tabPosition,Wt=le.tabBarGutter,Zt=le.children,Xt=le.onTabClick,Yt=le.onTabScroll,Jt=Object(w.useRef)(),Qt=Object(w.useRef)(),$t=Object(w.useRef)(),dr=Object(w.useRef)(),ar=zo(),Nr=Object(X.a)(ar,2),or=Nr[0],Bt=Nr[1],Nt=pt==="top"||pt==="bottom",sr=ja(0,function(Er,lr){Nt&&Yt&&Yt({direction:Er>lr?"left":"right"})}),cr=Object(X.a)(sr,2),Dt=cr[0],fr=cr[1],Ur=ja(0,function(Er,lr){!Nt&&Yt&&Yt({direction:Er>lr?"top":"bottom"})}),yr=Object(X.a)(Ur,2),Lr=yr[0],wr=yr[1],Yr=Object(w.useState)(0),un=Object(X.a)(Yr,2),jr=un[0],On=un[1],ti=Object(w.useState)(0),Mn=Object(X.a)(ti,2),dn=Mn[0],Mr=Mn[1],Or=Object(w.useState)(0),Wr=Object(X.a)(Or,2),Br=Wr[0],ri=Wr[1],Ai=Object(w.useState)(0),Li=Object(X.a)(Ai,2),Ar=Li[0],di=Li[1],Oi=Object(w.useState)(null),_r=Object(X.a)(Oi,2),Tr=_r[0],cn=_r[1],Eo=Object(w.useState)(null),Ga=Object(X.a)(Eo,2),ki=Ga[0],Qi=Ga[1],ya=Object(w.useState)(0),Va=Object(X.a)(ya,2),ba=Va[0],Xo=Va[1],Yo=Object(w.useState)(0),So=Object(X.a)(Yo,2),Xa=So[0],Ya=So[1],Zi=L(new Map),Ji=Object(X.a)(Zi,2),$o=Ji[0],xa=Ji[1],ca=d(oe,$o,jr),qi="".concat(Z,"-nav-operations-hidden"),ea=0,ni=0;Nt?De?(ea=0,ni=Math.max(0,jr-Tr)):(ea=Math.min(0,Tr-jr),ni=0):(ea=Math.min(0,ki-dn),ni=0);function Bi(Er){return Er<ea?[ea,!1]:Er>ni?[ni,!1]:[Er,!0]}var Di=Object(w.useRef)(),ha=Object(w.useState)(),Fi=Object(X.a)(ha,2),Ea=Fi[0],$a=Fi[1];function Sa(){$a(Date.now())}function Qa(){window.clearTimeout(Di.current)}da(Jt,function(Er,lr){var hn=!1;function Pn(ta,yi){ta(function(ma){var Mi=Bi(ma+yi),fn=Object(X.a)(Mi,2),wa=fn[0],Ja=fn[1];return hn=Ja,wa})}if(Nt){if(Tr>=jr)return hn;Pn(fr,Er)}else{if(ki>=dn)return hn;Pn(wr,lr)}return Qa(),Sa(),hn}),Object(w.useEffect)(function(){return Qa(),Ea&&(Di.current=window.setTimeout(function(){$a(0)},100)),Qa},[Ea]);function _i(){var Er=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Ce,lr=ca.get(Er);if(!lr)return;if(Nt){var hn=Dt;De?lr.right<Dt?hn=lr.right:lr.right+lr.width>Dt+Tr&&(hn=lr.right+lr.width-Tr):lr.left<-Dt?hn=-lr.left:lr.left+lr.width>-Dt+Tr&&(hn=-(lr.left+lr.width-Tr)),wr(0),fr(Bi(hn)[0])}else{var Pn=Lr;lr.top<-Lr?Pn=-lr.top:lr.top+lr.height>-Lr+ki&&(Pn=-(lr.top+lr.height-ki)),fr(0),wr(Bi(Pn)[0])}}var ji=g(ca,{width:Tr,height:ki,left:Dt,top:Lr},{width:Br,height:Ar},{width:ba,height:Xa},Object(K.a)(Object(K.a)({},le),{},{tabs:oe})),Co=Object(X.a)(ji,2),Qo=Co[0],Zo=Co[1],Jo=oe.map(function(Er){var lr=Er.key;return w.createElement(a,{id:pe,prefixCls:Z,key:lr,rtl:De,tab:Er,closable:Er.closable,editable:tt,active:lr===Ce,tabPosition:pt,tabBarGutter:Wt,renderWrapper:Zt,removeAriaLabel:et==null?void 0:et.removeAriaLabel,ref:or(lr),onClick:function(Pn){Xt(lr,Pn)},onRemove:function(){Bt(lr)},onFocus:function(){_i(lr),Sa(),De||(Jt.current.scrollLeft=0),Jt.current.scrollTop=0}})}),Za=O(function(){var Er,lr,hn,Pn,ta,yi,ma,Mi,fn,wa=((Er=Jt.current)===null||Er===void 0?void 0:Er.offsetWidth)||0,Ja=((lr=Jt.current)===null||lr===void 0?void 0:lr.offsetHeight)||0,qa=((hn=dr.current)===null||hn===void 0?void 0:hn.offsetWidth)||0,In=((Pn=dr.current)===null||Pn===void 0?void 0:Pn.offsetHeight)||0,xr=((ta=$t.current)===null||ta===void 0?void 0:ta.offsetWidth)||0,ai=((yi=$t.current)===null||yi===void 0?void 0:yi.offsetHeight)||0;cn(wa),Qi(Ja),Xo(qa),Ya(In);var bi=(((ma=Qt.current)===null||ma===void 0?void 0:ma.offsetWidth)||0)-qa,xi=(((Mi=Qt.current)===null||Mi===void 0?void 0:Mi.offsetHeight)||0)-In;On(bi),Mr(xi);var eo=(fn=$t.current)===null||fn===void 0?void 0:fn.className.includes(qi);ri(bi-(eo?0:xr)),di(xi-(eo?0:ai)),xa(function(){var Aa=new Map;return oe.forEach(function(Oo){var ko=Oo.key,Hi=or(ko).current;Hi&&Aa.set(ko,{width:Hi.offsetWidth,height:Hi.offsetHeight,left:Hi.offsetLeft,top:Hi.offsetTop})}),Aa})}),qo=oe.slice(0,Qo),Rn=oe.slice(Zo+1),Zr=[].concat(Object(M.a)(qo),Object(M.a)(Rn)),Tn=Object(w.useState)(),Jr=Object(X.a)(Tn,2),fa=Jr[0],es=Jr[1],ii=ca.get(Ce),To=Object(w.useRef)();function wo(){A.a.cancel(To.current)}Object(w.useEffect)(function(){var Er={};return ii&&(Nt?(De?Er.right=ii.right:Er.left=ii.left,Er.width=ii.width):(Er.top=ii.top,Er.height=ii.height)),wo(),To.current=A()(function(){es(Er)}),wo},[ii,Nt,De]),Object(w.useEffect)(function(){_i()},[Ce,ii,ca,Nt]),Object(w.useEffect)(function(){Za()},[De,Wt,Ce,oe.map(function(Er){return Er.key}).join("_")]);var Ao=!!Zr.length,Wi="".concat(Z,"-nav-wrap"),Ca,pa,Lo,Ta;return Nt?De?(pa=Dt>0,Ca=Dt+Tr<jr):(Ca=Dt<0,pa=-Dt+Tr<jr):(Lo=Lr<0,Ta=-Lr+ki<dn),w.createElement("div",{ref:xe,role:"tablist",className:H()("".concat(Z,"-nav"),q),style:fe,onKeyDown:function(){Sa()}},w.createElement(yo,{position:"left",extra:Be,prefixCls:Z}),w.createElement(_.a,{onResize:Za},w.createElement("div",{className:H()(Wi,(Ae={},Object(ae.a)(Ae,"".concat(Wi,"-ping-left"),Ca),Object(ae.a)(Ae,"".concat(Wi,"-ping-right"),pa),Object(ae.a)(Ae,"".concat(Wi,"-ping-top"),Lo),Object(ae.a)(Ae,"".concat(Wi,"-ping-bottom"),Ta),Ae)),ref:Jt},w.createElement(_.a,{onResize:Za},w.createElement("div",{ref:Qt,className:"".concat(Z,"-nav-list"),style:{transform:"translate(".concat(Dt,"px, ").concat(Lr,"px)"),transition:Ea?"none":void 0}},Jo,w.createElement(Cn,{ref:dr,prefixCls:Z,locale:et,editable:tt,style:{visibility:Ao?"hidden":null}}),w.createElement("div",{className:H()("".concat(Z,"-ink-bar"),Object(ae.a)({},"".concat(Z,"-ink-bar-animated"),Le.inkBar)),style:fa}))))),w.createElement(Yn,Object.assign({},le,{ref:$t,prefixCls:Z,tabs:Zr,className:!Ao&&qi})),w.createElement(yo,{position:"right",extra:Be,prefixCls:Z}))}var Ha=w.forwardRef(Wa);function Go(le){var xe=le.id,Ae=le.activeKey,ce=le.animated,Z=le.tabPosition,oe=le.rtl,q=le.destroyInactiveTabPane,fe=w.useContext(Fa),pe=fe.prefixCls,Le=fe.tabs,Ce=ce.tabPane,De=Le.findIndex(function(Be){return Be.key===Ae});return w.createElement("div",{className:H()("".concat(pe,"-content-holder"))},w.createElement("div",{className:H()("".concat(pe,"-content"),"".concat(pe,"-content-").concat(Z),Object(ae.a)({},"".concat(pe,"-content-animated"),Ce)),style:De&&Ce?Object(ae.a)({},oe?"marginRight":"marginLeft","-".concat(De,"00%")):null},Le.map(function(Be){return w.cloneElement(Be.node,{key:Be.key,prefixCls:pe,tabKey:Be.key,id:xe,animated:Ce,active:Be.key===Ae,destroyInactiveTabPane:q})})))}function bo(le){var xe=le.prefixCls,Ae=le.forceRender,ce=le.className,Z=le.style,oe=le.id,q=le.active,fe=le.animated,pe=le.destroyInactiveTabPane,Le=le.tabKey,Ce=le.children,De=w.useState(Ae),Be=Object(X.a)(De,2),tt=Be[0],et=Be[1];w.useEffect(function(){q?et(!0):pe&&et(!1)},[q,pe]);var pt={};return q||(fe?(pt.visibility="hidden",pt.height=0,pt.overflowY="hidden"):pt.display="none"),w.createElement("div",{id:oe&&"".concat(oe,"-panel-").concat(Le),role:"tabpanel",tabIndex:q?0:-1,"aria-labelledby":oe&&"".concat(oe,"-tab-").concat(Le),"aria-hidden":!q,style:Object(K.a)(Object(K.a)({},pt),Z),className:H()("".concat(xe,"-tabpane"),q&&"".concat(xe,"-tabpane-active"),ce)},(q||tt||Ae)&&Ce)}var Ka=0;function xo(le){return Object(W.a)(le).map(function(xe){if(w.isValidElement(xe)){var Ae=xe.key!==void 0?String(xe.key):void 0;return Object(K.a)(Object(K.a)({key:Ae},xe.props),{},{node:xe})}return null}).filter(function(xe){return xe})}function Vo(le,xe){var Ae,ce=le.id,Z=le.prefixCls,oe=Z===void 0?"rc-tabs":Z,q=le.className,fe=le.children,pe=le.direction,Le=le.activeKey,Ce=le.defaultActiveKey,De=le.editable,Be=le.animated,tt=le.tabPosition,et=tt===void 0?"top":tt,pt=le.tabBarGutter,Wt=le.tabBarStyle,Zt=le.tabBarExtraContent,Xt=le.locale,Yt=le.moreIcon,Jt=le.moreTransitionName,Qt=le.destroyInactiveTabPane,$t=le.renderTabBar,dr=le.onChange,ar=le.onTabClick,Nr=le.onTabScroll,or=Object(D.a)(le,["id","prefixCls","className","children","direction","activeKey","defaultActiveKey","editable","animated","tabPosition","tabBarGutter","tabBarStyle","tabBarExtraContent","locale","moreIcon","moreTransitionName","destroyInactiveTabPane","renderTabBar","onChange","onTabClick","onTabScroll"]),Bt=xo(fe),Nt=pe==="rtl",sr;Be===!1?sr={inkBar:!1,tabPane:!1}:sr=Object(K.a)({inkBar:!0,tabPane:!1},Be!==!0?Be:null);var cr=Object(w.useState)(!1),Dt=Object(X.a)(cr,2),fr=Dt[0],Ur=Dt[1];Object(w.useEffect)(function(){Ur(vo())},[]);var yr=Object(I.a)(function(){var Ar;return(Ar=Bt[0])===null||Ar===void 0?void 0:Ar.key},{value:Le,defaultValue:Ce}),Lr=Object(X.a)(yr,2),wr=Lr[0],Yr=Lr[1],un=Object(w.useState)(function(){return Bt.findIndex(function(Ar){return Ar.key===wr})}),jr=Object(X.a)(un,2),On=jr[0],ti=jr[1];Object(w.useEffect)(function(){var Ar=Bt.findIndex(function(Oi){return Oi.key===wr});if(Ar===-1){var di;Ar=Math.max(0,Math.min(On,Bt.length-1)),Yr((di=Bt[Ar])===null||di===void 0?void 0:di.key)}ti(Ar)},[Bt.map(function(Ar){return Ar.key}).join("_"),wr,On]);var Mn=Object(I.a)(null,{value:ce}),dn=Object(X.a)(Mn,2),Mr=dn[0],Or=dn[1],Wr=et;fr&&!["left","right"].includes(et)&&(Wr="top"),Object(w.useEffect)(function(){ce||(Or("rc-tabs-".concat(Ka)),Ka+=1)},[]);function Br(Ar,di){ar==null||ar(Ar,di),Yr(Ar),dr==null||dr(Ar)}var ri={id:Mr,activeKey:wr,animated:sr,tabPosition:Wr,rtl:Nt,mobile:fr},Ai,Li=Object(K.a)(Object(K.a)({},ri),{},{editable:De,locale:Xt,moreIcon:Yt,moreTransitionName:Jt,tabBarGutter:pt,onTabClick:Br,onTabScroll:Nr,extra:Zt,style:Wt,panes:fe});return $t?Ai=$t(Li,Ha):Ai=w.createElement(Ha,Object.assign({},Li)),w.createElement(Fa.Provider,{value:{tabs:Bt,prefixCls:oe}},w.createElement("div",Object.assign({ref:xe,id:ce,className:H()(oe,"".concat(oe,"-").concat(Wr),(Ae={},Object(ae.a)(Ae,"".concat(oe,"-mobile"),fr),Object(ae.a)(Ae,"".concat(oe,"-editable"),De),Object(ae.a)(Ae,"".concat(oe,"-rtl"),Nt),Ae),q)},or),Ai,w.createElement(Go,Object.assign({destroyInactiveTabPane:Qt},ri,{animated:sr}))))}var $i=w.forwardRef(Vo);$i.TabPane=bo;var vi=$i,za=yt.b=vi},kSUc:function(Ft,yt,ne){},lZu9:function(Ft,yt,ne){(function(ae){ae(ne("VrN/"),ne("1eCo"),ne("8EBN"))})(function(ae){"use strict";ae.defineMode("markdown",function(X,D){var K=ae.getMode(X,"text/html"),w=K.name=="null";function P(G){if(ae.findModeByName){var j=ae.findModeByName(G);j&&(G=j.mime||j.mimes[0])}var te=ae.getMode(X,G);return te.name=="null"?null:te}D.highlightFormatting===void 0&&(D.highlightFormatting=!1),D.maxBlockquoteDepth===void 0&&(D.maxBlockquoteDepth=0),D.taskLists===void 0&&(D.taskLists=!1),D.strikethrough===void 0&&(D.strikethrough=!1),D.emoji===void 0&&(D.emoji=!1),D.fencedCodeBlockHighlighting===void 0&&(D.fencedCodeBlockHighlighting=!0),D.fencedCodeBlockDefaultMode===void 0&&(D.fencedCodeBlockDefaultMode="text/plain"),D.xml===void 0&&(D.xml=!0),D.tokenTypeOverrides===void 0&&(D.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 W in H)H.hasOwnProperty(W)&&D.tokenTypeOverrides[W]&&(H[W]=D.tokenTypeOverrides[W]);var I=/^([*\-_])(?:\s*\1){2,}\s*$/,M=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,b=/^\[(x| )\](?=\s)/i,A=D.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,_=/^ {0,3}(?:\={1,}|-{2,})\s*$/,O=/^[^#!\[\]*_\\<>` "'(~:]+/,L=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,y=/^\s*\[[^\]]+?\]:.*$/,u=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,a=" ";function s(G,j,te){return j.f=j.inline=te,te(G,j)}function d(G,j,te){return j.f=j.block=te,te(G,j)}function E(G){return!G||!/\S/.test(G.string)}function g(G){if(G.linkTitle=!1,G.linkHref=!1,G.linkText=!1,G.em=!1,G.strong=!1,G.strikethrough=!1,G.quote=0,G.indentedCode=!1,G.f==k){var j=w;if(!j){var te=ae.innerMode(K,G.htmlState);j=te.mode.name=="xml"&&te.state.tagStart===null&&!te.state.context&&te.state.tokenize.isInText}j&&(G.f=c,G.block=m,G.htmlState=null)}return G.trailingSpace=0,G.trailingSpaceNewLine=!1,G.prevLine=G.thisLine,G.thisLine={stream:null},null}function m(G,j){var te=G.column()===j.indentation,de=E(j.prevLine.stream),be=j.indentedCode,Oe=j.prevLine.hr,Ge=j.list!==!1,Me=(j.listStack[j.listStack.length-1]||0)+3;j.indentedCode=!1;var Ie=j.indentation;if(j.indentationDiff===null&&(j.indentationDiff=j.indentation,Ge)){for(j.list=null;Ie<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=Ie-j.listStack[j.listStack.length-1])}var Ue=!de&&!Oe&&!j.prevLine.header&&(!Ge||!be)&&!j.prevLine.fencedCodeEnd,Pe=(j.list===!1||Oe||de)&&j.indentation<=Me&&G.match(I),Te=null;if(j.indentationDiff>=4&&(be||j.prevLine.fencedCodeEnd||j.prevLine.header||de))return G.skipToEnd(),j.indentedCode=!0,H.code;if(G.eatSpace())return null;if(te&&j.indentation<=Me&&(Te=G.match(A))&&Te[1].length<=6)return j.quote=0,j.header=Te[1].length,j.thisLine.header=!0,D.highlightFormatting&&(j.formatting="header"),j.f=j.inline,h(j);if(j.indentation<=Me&&G.eat(">"))return j.quote=te?1:j.quote+1,D.highlightFormatting&&(j.formatting="quote"),G.eatSpace(),h(j);if(!Pe&&!j.setext&&te&&j.indentation<=Me&&(Te=G.match(M))){var se=Te[1]?"ol":"ul";return j.indentation=Ie+G.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,D.taskLists&&G.match(b,!1)&&(j.taskList=!0),j.f=j.inline,D.highlightFormatting&&(j.formatting=["list","list-"+se]),h(j)}else{if(te&&j.indentation<=Me&&(Te=G.match(L,!0)))return j.quote=0,j.fencedEndRE=new RegExp(Te[1]+"+ *$"),j.localMode=D.fencedCodeBlockHighlighting&&P(Te[2]||D.fencedCodeBlockDefaultMode),j.localMode&&(j.localState=ae.startState(j.localMode)),j.f=j.block=x,D.highlightFormatting&&(j.formatting="code-block"),j.code=-1,h(j);if(j.setext||(!Ue||!Ge)&&!j.quote&&j.list===!1&&!j.code&&!Pe&&!y.test(G.string)&&(Te=G.lookAhead(1))&&(Te=Te.match(_)))return j.setext?(j.header=j.setext,j.setext=0,G.skipToEnd(),D.highlightFormatting&&(j.formatting="header")):(j.header=Te[0].charAt(0)=="="?1:2,j.setext=j.header),j.thisLine.header=!0,j.f=j.inline,h(j);if(Pe)return G.skipToEnd(),j.hr=!0,j.thisLine.hr=!0,H.hr;if(G.peek()==="[")return s(G,j,N)}return s(G,j,j.inline)}function k(G,j){var te=K.token(G,j.htmlState);if(!w){var de=ae.innerMode(K,j.htmlState);(de.mode.name=="xml"&&de.state.tagStart===null&&!de.state.context&&de.state.tokenize.isInText||j.md_inside&&G.current().indexOf(">")>-1)&&(j.f=c,j.block=m,j.htmlState=null)}return te}function x(G,j){var te=j.listStack[j.listStack.length-1]||0,de=j.indentation<te,be=te+3;if(j.fencedEndRE&&j.indentation<=be&&(de||G.match(j.fencedEndRE))){D.highlightFormatting&&(j.formatting="code-block");var Oe;return de||(Oe=h(j)),j.localMode=j.localState=null,j.block=m,j.f=c,j.fencedEndRE=null,j.code=0,j.thisLine.fencedCodeEnd=!0,de?d(G,j,j.block):Oe}else return j.localMode?j.localMode.token(G,j.localState):(G.skipToEnd(),H.code)}function h(G){var j=[];if(G.formatting){j.push(H.formatting),typeof G.formatting=="string"&&(G.formatting=[G.formatting]);for(var te=0;te<G.formatting.length;te++)j.push(H.formatting+"-"+G.formatting[te]),G.formatting[te]==="header"&&j.push(H.formatting+"-"+G.formatting[te]+"-"+G.header),G.formatting[te]==="quote"&&(!D.maxBlockquoteDepth||D.maxBlockquoteDepth>=G.quote?j.push(H.formatting+"-"+G.formatting[te]+"-"+G.quote):j.push("error"))}if(G.taskOpen)return j.push("meta"),j.length?j.join(" "):null;if(G.taskClosed)return j.push("property"),j.length?j.join(" "):null;if(G.linkHref?j.push(H.linkHref,"url"):(G.strong&&j.push(H.strong),G.em&&j.push(H.em),G.strikethrough&&j.push(H.strikethrough),G.emoji&&j.push(H.emoji),G.linkText&&j.push(H.linkText),G.code&&j.push(H.code),G.image&&j.push(H.image),G.imageAltText&&j.push(H.imageAltText,"link"),G.imageMarker&&j.push(H.imageMarker)),G.header&&j.push(H.header,H.header+"-"+G.header),G.quote&&(j.push(H.quote),!D.maxBlockquoteDepth||D.maxBlockquoteDepth>=G.quote?j.push(H.quote+"-"+G.quote):j.push(H.quote+"-"+D.maxBlockquoteDepth)),G.list!==!1){var de=(G.listStack.length-1)%3;de?de===1?j.push(H.list2):j.push(H.list3):j.push(H.list1)}return G.trailingSpaceNewLine?j.push("trailing-space-new-line"):G.trailingSpace&&j.push("trailing-space-"+(G.trailingSpace%2?"a":"b")),j.length?j.join(" "):null}function p(G,j){return G.match(O,!0)?h(j):void 0}function c(G,j){var te=j.text(G,j);if(typeof te!="undefined")return te;if(j.list)return j.list=null,h(j);if(j.taskList){var de=G.match(b,!0)[1]===" ";return de?j.taskOpen=!0:j.taskClosed=!0,D.highlightFormatting&&(j.formatting="task"),j.taskList=!1,h(j)}if(j.taskOpen=!1,j.taskClosed=!1,j.header&&G.match(/^#+$/,!0))return D.highlightFormatting&&(j.formatting="header"),h(j);var be=G.next();if(j.linkTitle){j.linkTitle=!1;var Oe=be;be==="("&&(Oe=")"),Oe=(Oe+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var Ge="^\\s*(?:[^"+Oe+"\\\\]+|\\\\\\\\|\\\\.)"+Oe;if(G.match(new RegExp(Ge),!0))return H.linkHref}if(be==="`"){var Me=j.formatting;D.highlightFormatting&&(j.formatting="code"),G.eatWhile("`");var Ie=G.current().length;if(j.code==0&&(!j.quote||Ie==1))return j.code=Ie,h(j);if(Ie==j.code){var Ue=h(j);return j.code=0,Ue}else return j.formatting=Me,h(j)}else if(j.code)return h(j);if(be==="\\"&&(G.next(),D.highlightFormatting)){var Pe=h(j),Te=H.formatting+"-escape";return Pe?Pe+" "+Te:Te}if(be==="!"&&G.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return j.imageMarker=!0,j.image=!0,D.highlightFormatting&&(j.formatting="image"),h(j);if(be==="["&&j.imageMarker&&G.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return j.imageMarker=!1,j.imageAltText=!0,D.highlightFormatting&&(j.formatting="image"),h(j);if(be==="]"&&j.imageAltText){D.highlightFormatting&&(j.formatting="image");var Pe=h(j);return j.imageAltText=!1,j.image=!1,j.inline=j.f=S,Pe}if(be==="["&&!j.image)return j.linkText&&G.match(/^.*?\]/)||(j.linkText=!0,D.highlightFormatting&&(j.formatting="link")),h(j);if(be==="]"&&j.linkText){D.highlightFormatting&&(j.formatting="link");var Pe=h(j);return j.linkText=!1,j.inline=j.f=G.match(/\(.*?\)| ?\[.*?\]/,!1)?S:c,Pe}if(be==="<"&&G.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){j.f=j.inline=o,D.highlightFormatting&&(j.formatting="link");var Pe=h(j);return Pe?Pe+=" ":Pe="",Pe+H.linkInline}if(be==="<"&&G.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){j.f=j.inline=o,D.highlightFormatting&&(j.formatting="link");var Pe=h(j);return Pe?Pe+=" ":Pe="",Pe+H.linkEmail}if(D.xml&&be==="<"&&G.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var se=G.string.indexOf(">",G.pos);if(se!=-1){var Fe=G.string.substring(G.start,se);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(Fe)&&(j.md_inside=!0)}return G.backUp(1),j.htmlState=ae.startState(K),d(G,j,k)}if(D.xml&&be==="<"&&G.match(/^\/\w*?>/))return j.md_inside=!1,"tag";if(be==="*"||be==="_"){for(var dt=1,it=G.pos==1?" ":G.string.charAt(G.pos-2);dt<3&&G.eat(be);)dt++;var ot=G.peek()||" ",ct=!/\s/.test(ot)&&(!u.test(ot)||/\s/.test(it)||u.test(it)),je=!/\s/.test(it)&&(!u.test(it)||/\s/.test(ot)||u.test(ot)),Ye=null,rt=null;if(dt%2&&(!j.em&&ct&&(be==="*"||!je||u.test(it))?Ye=!0:j.em==be&&je&&(be==="*"||!ct||u.test(ot))&&(Ye=!1)),dt>1&&(!j.strong&&ct&&(be==="*"||!je||u.test(it))?rt=!0:j.strong==be&&je&&(be==="*"||!ct||u.test(ot))&&(rt=!1)),rt!=null||Ye!=null){D.highlightFormatting&&(j.formatting=Ye==null?"strong":rt==null?"em":"strong em"),Ye===!0&&(j.em=be),rt===!0&&(j.strong=be);var Ue=h(j);return Ye===!1&&(j.em=!1),rt===!1&&(j.strong=!1),Ue}}else if(be===" "&&(G.eat("*")||G.eat("_"))){if(G.peek()===" ")return h(j);G.backUp(1)}if(D.strikethrough){if(be==="~"&&G.eatWhile(be)){if(j.strikethrough){D.highlightFormatting&&(j.formatting="strikethrough");var Ue=h(j);return j.strikethrough=!1,Ue}else if(G.match(/^[^\s]/,!1))return j.strikethrough=!0,D.highlightFormatting&&(j.formatting="strikethrough"),h(j)}else if(be===" "&&G.match(/^~~/,!0)){if(G.peek()===" ")return h(j);G.backUp(2)}}if(D.emoji&&be===":"&&G.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){j.emoji=!0,D.highlightFormatting&&(j.formatting="emoji");var st=h(j);return j.emoji=!1,st}return be===" "&&(G.match(/^ +$/,!1)?j.trailingSpace++:j.trailingSpace&&(j.trailingSpaceNewLine=!0)),h(j)}function o(G,j){var te=G.next();if(te===">"){j.f=j.inline=c,D.highlightFormatting&&(j.formatting="link");var de=h(j);return de?de+=" ":de="",de+H.linkInline}return G.match(/^[^>]+/,!0),H.linkInline}function S(G,j){if(G.eatSpace())return null;var te=G.next();return te==="("||te==="["?(j.f=j.inline=T(te==="("?")":"]"),D.highlightFormatting&&(j.formatting="link-string"),j.linkHref=!0,h(j)):"error"}var v={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function T(G){return function(j,te){var de=j.next();if(de===G){te.f=te.inline=c,D.highlightFormatting&&(te.formatting="link-string");var be=h(te);return te.linkHref=!1,be}return j.match(v[G]),te.linkHref=!0,h(te)}}function N(G,j){return G.match(/^([^\]\\]|\\.)*\]:/,!1)?(j.f=z,G.next(),D.highlightFormatting&&(j.formatting="link"),j.linkText=!0,h(j)):s(G,j,c)}function z(G,j){if(G.match(/^\]:/,!0)){j.f=j.inline=Y,D.highlightFormatting&&(j.formatting="link");var te=h(j);return j.linkText=!1,te}return G.match(/^([^\]\\]|\\.)+/,!0),H.linkText}function Y(G,j){return G.eatSpace()?null:(G.match(/^[^\s]+/,!0),G.peek()===void 0?j.linkTitle=!0:G.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),j.f=j.inline=c,H.linkHref+" url")}var ee={startState:function(){return{f:m,prevLine:{stream:null},thisLine:{stream:null},block:m,htmlState:null,indentation:0,inline:c,text:p,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(G){return{f:G.f,prevLine:G.prevLine,thisLine:G.thisLine,block:G.block,htmlState:G.htmlState&&ae.copyState(K,G.htmlState),indentation:G.indentation,localMode:G.localMode,localState:G.localMode?ae.copyState(G.localMode,G.localState):null,inline:G.inline,text:G.text,formatting:!1,linkText:G.linkText,linkTitle:G.linkTitle,linkHref:G.linkHref,code:G.code,em:G.em,strong:G.strong,strikethrough:G.strikethrough,emoji:G.emoji,header:G.header,setext:G.setext,hr:G.hr,taskList:G.taskList,list:G.list,listStack:G.listStack.slice(0),quote:G.quote,indentedCode:G.indentedCode,trailingSpace:G.trailingSpace,trailingSpaceNewLine:G.trailingSpaceNewLine,md_inside:G.md_inside,fencedEndRE:G.fencedEndRE}},token:function(G,j){if(j.formatting=!1,G!=j.thisLine.stream){if(j.header=0,j.hr=!1,G.match(/^\s*$/,!0))return g(j),null;if(j.prevLine=j.thisLine,j.thisLine={stream:G},j.taskList=!1,j.trailingSpace=0,j.trailingSpaceNewLine=!1,!j.localState&&(j.f=j.block,j.f!=k)){var te=G.match(/^\s*/,!0)[0].replace(/\t/g,a).length;if(j.indentation=te,j.indentationDiff=null,te>0)return null}}return j.f(G,j)},innerMode:function(G){return G.block==k?{state:G.htmlState,mode:K}:G.localState?{state:G.localState,mode:G.localMode}:{state:G,mode:ee}},indent:function(G,j,te){return G.block==k&&K.indent?K.indent(G.htmlState,j,te):G.localState&&G.localMode.indent?G.localMode.indent(G.localState,j,te):ae.Pass},blankLine:g,getType:h,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return ee},"xml"),ae.defineMIME("text/markdown","markdown"),ae.defineMIME("text/x-markdown","markdown")})},nuEh:function(Ft,yt,ne){"use strict";var ae=ne("T2oS"),X=ne("W9HT"),D=ne("q1tI"),K=ne.n(D),w=ne("F8wB"),P=ne.n(w),H=function(I){var M=I.loading;return M?K.a.createElement("div",{className:P.a.loading},K.a.createElement(X.a,null)):K.a.createElement(K.a.Fragment,null)};yt.a=H},osHv:function(Ft,yt,ne){(function(ae){ae(ne("VrN/"))})(function(ae){"use strict";var X=ae.Pos;function D(u,a){return u.line-a.line||u.ch-a.ch}var K="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",w=K+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",P=new RegExp("<(/?)(["+K+"]["+w+"]*)","g");function H(u,a,s,d){this.line=a,this.ch=s,this.cm=u,this.text=u.getLine(a),this.min=d?Math.max(d.from,u.firstLine()):u.firstLine(),this.max=d?Math.min(d.to-1,u.lastLine()):u.lastLine()}function W(u,a){var s=u.cm.getTokenTypeAt(X(u.line,a));return s&&/\btag\b/.test(s)}function I(u){return u.line>=u.max?void 0:(u.ch=0,u.text=u.cm.getLine(++u.line),!0)}function M(u){return u.line<=u.min?void 0:(u.text=u.cm.getLine(--u.line),u.ch=u.text.length,!0)}function b(u){for(;;){var a=u.text.indexOf(">",u.ch);if(a==-1){if(I(u))continue;return}if(!W(u,a+1)){u.ch=a+1;continue}var s=u.text.lastIndexOf("/",a),d=s>-1&&!/\S/.test(u.text.slice(s+1,a));return u.ch=a+1,d?"selfClose":"regular"}}function A(u){for(;;){var a=u.ch?u.text.lastIndexOf("<",u.ch-1):-1;if(a==-1){if(M(u))continue;return}if(!W(u,a+1)){u.ch=a;continue}P.lastIndex=a,u.ch=a;var s=P.exec(u.text);if(s&&s.index==a)return s}}function _(u){for(;;){P.lastIndex=u.ch;var a=P.exec(u.text);if(!a){if(I(u))continue;return}if(!W(u,a.index+1)){u.ch=a.index+1;continue}return u.ch=a.index+a[0].length,a}}function O(u){for(;;){var a=u.ch?u.text.lastIndexOf(">",u.ch-1):-1;if(a==-1){if(M(u))continue;return}if(!W(u,a+1)){u.ch=a;continue}var s=u.text.lastIndexOf("/",a),d=s>-1&&!/\S/.test(u.text.slice(s+1,a));return u.ch=a+1,d?"selfClose":"regular"}}function L(u,a){for(var s=[];;){var d=_(u),E,g=u.line,m=u.ch-(d?d[0].length:0);if(!d||!(E=b(u)))return;if(E=="selfClose")continue;if(d[1]){for(var k=s.length-1;k>=0;--k)if(s[k]==d[2]){s.length=k;break}if(k<0&&(!a||a==d[2]))return{tag:d[2],from:X(g,m),to:X(u.line,u.ch)}}else s.push(d[2])}}function y(u,a){for(var s=[];;){var d=O(u);if(!d)return;if(d=="selfClose"){A(u);continue}var E=u.line,g=u.ch,m=A(u);if(!m)return;if(m[1])s.push(m[2]);else{for(var k=s.length-1;k>=0;--k)if(s[k]==m[2]){s.length=k;break}if(k<0&&(!a||a==m[2]))return{tag:m[2],from:X(u.line,u.ch),to:X(E,g)}}}}ae.registerHelper("fold","xml",function(u,a){for(var s=new H(u,a.line,0);;){var d=_(s);if(!d||s.line!=a.line)return;var E=b(s);if(!E)return;if(!d[1]&&E!="selfClose"){var g=X(s.line,s.ch),m=L(s,d[2]);return m&&D(m.from,g)>0?{from:g,to:m.from}:null}}}),ae.findMatchingTag=function(u,a,s){var d=new H(u,a.line,a.ch,s);if(d.text.indexOf(">")==-1&&d.text.indexOf("<")==-1)return;var E=b(d),g=E&&X(d.line,d.ch),m=E&&A(d);if(!E||!m||D(d,a)>0)return;var k={from:X(d.line,d.ch),to:g,tag:m[2]};return E=="selfClose"?{open:k,close:null,at:"open"}:m[1]?{open:y(d,m[2]),close:k,at:"close"}:(d=new H(u,g.line,g.ch,s),{open:k,close:L(d,m[2]),at:"open"})},ae.findEnclosingTag=function(u,a,s,d){for(var E=new H(u,a.line,a.ch,s);;){var g=y(E,d);if(!g)break;var m=new H(u,a.line,a.ch,s),k=L(m,g.tag);if(k)return{open:g,close:k}}},ae.scanForClosingTag=function(u,a,s,d){var E=new H(u,a.line,a.ch,d?{from:0,to:d}:null);return L(E,s)}})},p5ED:function(Ft,yt,ne){"use strict";var ae=ne("+L6B"),X=ne("2/Rp"),D=ne("5Dmo"),K=ne("3S7+"),w=ne("k1fw"),P=ne("9og8"),H=ne("tJVT"),W=ne("WmNS"),I=ne.n(W),M=ne("q1tI"),b=ne.n(M),A=ne("vHTk"),_=ne.n(A),O=ne("yEEn"),L=ne("ZW9T"),y=ne("1vsH"),u=ne("V0Rq"),a=ne("m3rI");yt.a=function(s){var d,E,g,m,k,x,h,p=s.editOffice,c=p===void 0?"view":p,o=s.data,S=s.theme,v=s.type,T=s.filename,N=s.monacoEditor,z=s.className,Y=s.style,ee=s.close,G=s.onClose,j=s.hasMask,te=s.disabledDownload,de=Object(M.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),be=Object(H.a)(de,2),Oe=be[0],Ge=be[1],Me=Object(M.useState)(""),Ie=Object(H.a)(Me,2),Ue=Ie[0],Pe=Ie[1],Te=Object(M.useState)(),se=Object(H.a)(Te,2),Fe=se[0],dt=se[1],it=window.ENV==="build"?"/react/build":"",ot=a.a.PROXY_SERVER||location.origin,ct,je=1024*1024,Ye=10*je,rt=Object(M.useRef)();(d=o)!==null&&d!==void 0&&d.startsWith("/api")&&v!=="txt"&&(o=a.a.API_SERVER+o),v==="office"&&(ct=Object(y.T)(o).filesize,ct>Ye&&(v="other")),T&&N&&(N.filename=T),Object(M.useEffect)(function(){var Ke,ht,ut=(Ke=document.cookie)===null||Ke===void 0||((ht=Ke.replace(/\s/g,""))===null||ht===void 0)?void 0:ht.split(";");ut==null||ut.map(function(ft){var nt=ft.split("=");nt[0]==="_educoder_session"&&Pe(nt[1])})},[]),Object(M.useEffect)(function(){v==="office"&&st()},[v,o]);var st=function(){var Ke=Object(P.a)(I.a.mark(function ht(){var ut,ft,nt;return I.a.wrap(function(vt){for(;;)switch(vt.prev=vt.next){case 0:return console.log("data:",o),ut=o,o.startsWith("http")||(ut=location.origin+ut),ft=new URL(ut).pathname.split("/").pop(),vt.next=6,Object(u.V)({attachment_id:ft});case 6:nt=vt.sent,dt(nt);case 8:case"end":return vt.stop()}},ht)}));return function(){return Ke.apply(this,arguments)}}(),qe=function(){if(o.startsWith("http")||o.startsWith("blob:")){Ve();return}Object(y.z)(T||"educoder",o,T)},Ve=function(){Object(y.x)(T||"educoder",decodeURIComponent(o))};return b.a.createElement("div",{style:Object(w.a)({},Y||{}),className:"".concat(j&&_.a.bgBlack," ").concat(v?_.a.wrp:"hide")},ee&&b.a.createElement("div",{className:_.a.close,ref:rt},!te&&b.a.createElement(K.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return rt.current}},b.a.createElement("span",{onClick:Ve},b.a.createElement("i",{className:"icon-quxiaozhiding"}))),b.a.createElement(K.a,{title:"\u5173\u95ED",getPopupContainer:function(){return rt.current}},b.a.createElement("span",{className:"",onClick:G},b.a.createElement("i",{className:"icon-guanbi1"})))),b.a.createElement("div",{className:"".concat(_.a[z]," ").concat(z," ").concat(_.a.monaco," ").concat(v==="txt"?"show":"hide")},v==="txt"&&b.a.createElement(L.b,N)),v==="audio"&&b.a.createElement("audio",{src:"".concat(((E=o)===null||E===void 0?void 0:E.indexOf("http://"))>-1||((g=o)===null||g===void 0?void 0:g.indexOf("https://"))>-1?"":"data:audio/mp3;base64,").concat(o),autoPlay:!0}),v==="video"&&b.a.createElement(b.a.Fragment,null,((m=o)===null||m===void 0?void 0:m.indexOf("http"))>-1?b.a.createElement("video",{controls:!0,src:"".concat(o),autoPlay:!0}):b.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(o),autoPlay:!0})),v==="office"&&Fe&&b.a.createElement("iframe",{src:"".concat(it,"/office.html?key=").concat(Fe.key,"&url=").concat(ot+Fe.url,"&callbackUrl=").concat(ot+Fe.callbackUrl,"&fileType=").concat(Fe.fileType,"&title=").concat(Fe.title,"&model=").concat(c,"&officeServer=").concat(a.a.OFFICE_SERVER,"&disabledDownload=").concat(!!te)}),v==="html"&&b.a.createElement("iframe",{src:o+"&disposition=inline"}),v==="pdf"&&b.a.createElement("iframe",{src:"".concat(it,"/js/pdfview/index.html?url=").concat(o,"&disabledDownload=").concat(!!te)}),v==="image"&&b.a.createElement("img",{src:"".concat(((k=o)===null||k===void 0?void 0:k.indexOf("http://"))>-1||((x=o)===null||x===void 0?void 0:x.indexOf("https://"))>-1||(h=o)!==null&&h!==void 0&&h.startsWith("/api")?"":"data:image/png;base64,").concat(o)}),v==="other"&&b.a.createElement("div",null,b.a.createElement(X.a,{type:"primary",size:"large",onClick:qe},b.a.createElement(O.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),v==="download"&&b.a.createElement(X.a,{type:"primary",size:"large",onClick:qe},b.a.createElement(O.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(Ft,yt,ne){},rUJ1:function(Ft,yt){const ne=/[&<>"']/,ae=/[&<>"']/g,X=/[<>"']|&(?!#?\w+;)/,D=/[<>"']|&(?!#?\w+;)/g,K={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},w=x=>K[x];function P(x,h){if(h){if(ne.test(x))return x.replace(ae,w)}else if(X.test(x))return x.replace(D,w);return x}const H=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function W(x){return x.replace(H,(h,p)=>(p=p.toLowerCase(),p==="colon"?":":p.charAt(0)==="#"?p.charAt(1)==="x"?String.fromCharCode(parseInt(p.substring(2),16)):String.fromCharCode(+p.substring(1)):""))}const I=/(^|[^\[])\^/g;function M(x,h){x=x.source||x,h=h||"";const p={replace:(c,o)=>(o=o.source||o,o=o.replace(I,"$1"),x=x.replace(c,o),p),getRegex:()=>new RegExp(x,h)};return p}const b=/[^\w:]/g,A=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function _(x,h,p){if(x){let c;try{c=decodeURIComponent(W(p)).replace(b,"").toLowerCase()}catch(o){return null}if(c.indexOf("javascript:")===0||c.indexOf("vbscript:")===0||c.indexOf("data:")===0)return null}h&&!A.test(p)&&(p=a(h,p));try{p=encodeURI(p).replace(/%25/g,"%")}catch(c){return null}return p}const O={},L=/^[^:]+:\/*[^/]*$/,y=/^([^:]+:)[\s\S]*$/,u=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(x,h){O[" "+x]||(L.test(x)?O[" "+x]=x+"/":O[" "+x]=g(x,"/",!0)),x=O[" "+x];const p=x.indexOf(":")===-1;return h.substring(0,2)==="//"?p?h:x.replace(y,"$1")+h:h.charAt(0)==="/"?p?h:x.replace(u,"$1")+h:x+h}const s={exec:function(){}};function d(x){let h=1,p,c;for(;h<arguments.length;h++){p=arguments[h];for(c in p)Object.prototype.hasOwnProperty.call(p,c)&&(x[c]=p[c])}return x}function E(x,h){const p=x.replace(/\|/g,(S,v,T)=>{let N=!1,z=v;for(;--z>=0&&T[z]==="\\";)N=!N;return N?"|":" |"}),c=p.split(/ \|/);let o=0;if(c.length>h)c.splice(h);else for(;c.length<h;)c.push("");for(;o<c.length;o++)c[o]=c[o].trim().replace(/\\\|/g,"|");return c}function g(x,h,p){const c=x.length;if(c===0)return"";let o=0;for(;o<c;){const S=x.charAt(c-o-1);if(S===h&&!p)o++;else if(S!==h&&p)o++;else break}return x.substr(0,c-o)}function m(x,h){if(x.indexOf(h[1])===-1)return-1;const p=x.length;let c=0,o=0;for(;o<p;o++)if(x[o]==="\\")o++;else if(x[o]===h[0])c++;else if(x[o]===h[1]&&(c--,c<0))return o;return-1}function k(x){x&&x.sanitize&&!x.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")}Ft.exports={escape:P,unescape:W,edit:M,cleanUrl:_,resolveUrl:a,noopTest:s,merge:d,splitCells:E,rtrim:g,findClosingBracket:m,checkSanitizeDeprecation:k}},t23M:function(Ft,yt,ne){"use strict";var ae=ne("VTBJ"),X=ne("1OyB"),D=ne("vuIU"),K=ne("Ji7U"),w=ne("LK+K"),P=ne("q1tI"),H=ne.n(P),W=ne("m+aA"),I=ne("Zm9Q"),M=ne("Kwbf"),b=ne("c+Xe"),A=ne("bdgK"),_="rc-observer-key",O=function(L){Object(K.a)(u,L);var y=Object(w.a)(u);function u(){var a;return Object(X.a)(this,u),a=y.apply(this,arguments),a.resizeObserver=null,a.childNode=null,a.currentElement=null,a.state={width:0,height:0,offsetHeight:0,offsetWidth:0},a.onResize=function(s){var d=a.props.onResize,E=s[0].target,g=E.getBoundingClientRect(),m=g.width,k=g.height,x=E.offsetWidth,h=E.offsetHeight,p=Math.floor(m),c=Math.floor(k);if(a.state.width!==p||a.state.height!==c||a.state.offsetWidth!==x||a.state.offsetHeight!==h){var o={width:p,height:c,offsetWidth:x,offsetHeight:h};a.setState(o),d&&Promise.resolve().then(function(){d(Object(ae.a)(Object(ae.a)({},o),{},{offsetWidth:x,offsetHeight:h}))})}},a.setChildNode=function(s){a.childNode=s},a}return Object(D.a)(u,[{key:"componentDidMount",value:function(){this.onComponentUpdated()}},{key:"componentDidUpdate",value:function(){this.onComponentUpdated()}},{key:"componentWillUnmount",value:function(){this.destroyObserver()}},{key:"onComponentUpdated",value:function(){var s=this.props.disabled;if(s){this.destroyObserver();return}var d=Object(W.a)(this.childNode||this),E=d!==this.currentElement;E&&(this.destroyObserver(),this.currentElement=d),!this.resizeObserver&&d&&(this.resizeObserver=new A.default(this.onResize),this.resizeObserver.observe(d))}},{key:"destroyObserver",value:function(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null)}},{key:"render",value:function(){var s=this.props.children,d=Object(I.a)(s);if(d.length>1)Object(M.a)(!1,"Find more than one child node with `children` in ResizeObserver. Will only observe first one.");else if(d.length===0)return Object(M.a)(!1,"`children` of ResizeObserver is empty. Nothing is in observe."),null;var E=d[0];if(P.isValidElement(E)&&Object(b.c)(E)){var g=E.ref;d[0]=P.cloneElement(E,{ref:Object(b.a)(g,this.setChildNode)})}return d.length===1?d[0]:d.map(function(m,k){return!P.isValidElement(m)||"key"in m&&m.key!==null?m:P.cloneElement(m,{key:"".concat(_,"-").concat(k)})})}}]),u}(P.Component);O.displayName="ResizeObserver",yt.a=O},ulZh:function(Ft,yt,ne){typeof window!="undefined"&&function(X,D){Ft.exports=D()}(this,function(){return function(ae){var X={};function D(K){if(X[K])return X[K].exports;var w=X[K]={i:K,l:!1,exports:{}};return ae[K].call(w.exports,w,w.exports,D),w.l=!0,w.exports}return D.m=ae,D.c=X,D.d=function(K,w,P){D.o(K,w)||Object.defineProperty(K,w,{enumerable:!0,get:P})},D.r=function(K){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(K,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(K,"__esModule",{value:!0})},D.t=function(K,w){if(w&1&&(K=D(K)),w&8)return K;if(w&4&&typeof K=="object"&&K&&K.__esModule)return K;var P=Object.create(null);if(D.r(P),Object.defineProperty(P,"default",{enumerable:!0,value:K}),w&2&&typeof K!="string")for(var H in K)D.d(P,H,function(W){return K[W]}.bind(null,H));return P},D.n=function(K){var w=K&&K.__esModule?function(){return K.default}:function(){return K};return D.d(w,"a",w),w},D.o=function(K,w){return Object.prototype.hasOwnProperty.call(K,w)},D.p="/dist/",D(D.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(ae,X,D){"use strict";var K=Object.prototype.hasOwnProperty,w="~";function P(){}Object.create&&(P.prototype=Object.create(null),new P().__proto__||(w=!1));function H(b,A,_){this.fn=b,this.context=A,this.once=_||!1}function W(b,A,_,O,L){if(typeof _!="function")throw new TypeError("The listener must be a function");var y=new H(_,O||b,L),u=w?w+A:A;return b._events[u]?b._events[u].fn?b._events[u]=[b._events[u],y]:b._events[u].push(y):(b._events[u]=y,b._eventsCount++),b}function I(b,A){--b._eventsCount===0?b._events=new P:delete b._events[A]}function M(){this._events=new P,this._eventsCount=0}M.prototype.eventNames=function(){var A=[],_,O;if(this._eventsCount===0)return A;for(O in _=this._events)K.call(_,O)&&A.push(w?O.slice(1):O);return Object.getOwnPropertySymbols?A.concat(Object.getOwnPropertySymbols(_)):A},M.prototype.listeners=function(A){var _=w?w+A:A,O=this._events[_];if(!O)return[];if(O.fn)return[O.fn];for(var L=0,y=O.length,u=new Array(y);L<y;L++)u[L]=O[L].fn;return u},M.prototype.listenerCount=function(A){var _=w?w+A:A,O=this._events[_];return O?O.fn?1:O.length:0},M.prototype.emit=function(A,_,O,L,y,u){var a=w?w+A:A;if(!this._events[a])return!1;var s=this._events[a],d=arguments.length,E,g;if(s.fn){s.once&&this.removeListener(A,s.fn,void 0,!0);switch(d){case 1:return s.fn.call(s.context),!0;case 2:return s.fn.call(s.context,_),!0;case 3:return s.fn.call(s.context,_,O),!0;case 4:return s.fn.call(s.context,_,O,L),!0;case 5:return s.fn.call(s.context,_,O,L,y),!0;case 6:return s.fn.call(s.context,_,O,L,y,u),!0}for(g=1,E=new Array(d-1);g<d;g++)E[g-1]=arguments[g];s.fn.apply(s.context,E)}else{var m=s.length,k;for(g=0;g<m;g++){s[g].once&&this.removeListener(A,s[g].fn,void 0,!0);switch(d){case 1:s[g].fn.call(s[g].context);break;case 2:s[g].fn.call(s[g].context,_);break;case 3:s[g].fn.call(s[g].context,_,O);break;case 4:s[g].fn.call(s[g].context,_,O,L);break;default:if(!E)for(k=1,E=new Array(d-1);k<d;k++)E[k-1]=arguments[k];s[g].fn.apply(s[g].context,E)}}}return!0},M.prototype.on=function(A,_,O){return W(this,A,_,O,!1)},M.prototype.once=function(A,_,O){return W(this,A,_,O,!0)},M.prototype.removeListener=function(A,_,O,L){var y=w?w+A:A;if(!this._events[y])return this;if(!_)return I(this,y),this;var u=this._events[y];if(u.fn)u.fn===_&&(!L||u.once)&&(!O||u.context===O)&&I(this,y);else{for(var a=0,s=[],d=u.length;a<d;a++)(u[a].fn!==_||L&&!u[a].once||O&&u[a].context!==O)&&s.push(u[a]);s.length?this._events[y]=s.length===1?s[0]:s:I(this,y)}return this},M.prototype.removeAllListeners=function(A){var _;return A?(_=w?w+A:A,this._events[_]&&I(this,_)):(this._events=new P,this._eventsCount=0),this},M.prototype.off=M.prototype.removeListener,M.prototype.addListener=M.prototype.on,M.prefixed=w,M.EventEmitter=M,ae.exports=M},"./node_modules/url-toolkit/src/url-toolkit.js":function(ae,X,D){(function(K){var w=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,P=/^([^\/?#]*)([^]*)$/,H=/(?:\/|^)\.(?=\/)/g,W=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,I={buildAbsoluteURL:function(M,b,A){if(A=A||{},M=M.trim(),b=b.trim(),!b){if(!A.alwaysNormalize)return M;var _=I.parseURL(M);if(!_)throw new Error("Error trying to parse base URL.");return _.path=I.normalizePath(_.path),I.buildURLFromParts(_)}var O=I.parseURL(b);if(!O)throw new Error("Error trying to parse relative URL.");if(O.scheme)return A.alwaysNormalize?(O.path=I.normalizePath(O.path),I.buildURLFromParts(O)):b;var L=I.parseURL(M);if(!L)throw new Error("Error trying to parse base URL.");if(!L.netLoc&&L.path&&L.path[0]!=="/"){var y=P.exec(L.path);L.netLoc=y[1],L.path=y[2]}L.netLoc&&!L.path&&(L.path="/");var u={scheme:L.scheme,netLoc:O.netLoc,path:null,params:O.params,query:O.query,fragment:O.fragment};if(!O.netLoc&&(u.netLoc=L.netLoc,O.path[0]!=="/"))if(!O.path)u.path=L.path,O.params||(u.params=L.params,O.query||(u.query=L.query));else{var a=L.path,s=a.substring(0,a.lastIndexOf("/")+1)+O.path;u.path=I.normalizePath(s)}return u.path===null&&(u.path=A.alwaysNormalize?I.normalizePath(O.path):O.path),I.buildURLFromParts(u)},parseURL:function(M){var b=w.exec(M);return b?{scheme:b[1]||"",netLoc:b[2]||"",path:b[3]||"",params:b[4]||"",query:b[5]||"",fragment:b[6]||""}:null},normalizePath:function(M){for(M=M.split("").reverse().join("").replace(H,"");M.length!==(M=M.replace(W,"")).length;);return M.split("").reverse().join("")},buildURLFromParts:function(M){return M.scheme+M.netLoc+M.path+M.params+M.query+M.fragment}};ae.exports=I})(this)},"./node_modules/webworkify-webpack/index.js":function(ae,X,D){function K(A){var _={};function O(y){if(_[y])return _[y].exports;var u=_[y]={i:y,l:!1,exports:{}};return A[y].call(u.exports,u,u.exports,O),u.l=!0,u.exports}O.m=A,O.c=_,O.i=function(y){return y},O.d=function(y,u,a){O.o(y,u)||Object.defineProperty(y,u,{configurable:!1,enumerable:!0,get:a})},O.r=function(y){Object.defineProperty(y,"__esModule",{value:!0})},O.n=function(y){var u=y&&y.__esModule?function(){return y.default}:function(){return y};return O.d(u,"a",u),u},O.o=function(y,u){return Object.prototype.hasOwnProperty.call(y,u)},O.p="/",O.oe=function(y){throw console.error(y),y};var L=O(O.s=ENTRY_MODULE);return L.default||L}var w="[\\.|\\-|\\+|\\w|/|@]+",P="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+w+").*?\\)";function H(A){return(A+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function W(A){return!isNaN(1*A)}function I(A,_,O){var L={};L[O]=[];var y=_.toString(),u=y.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!u)return L;for(var a=u[1],s=new RegExp("(\\\\n|\\W)"+H(a)+P,"g"),d;d=s.exec(y);){if(d[3]==="dll-reference")continue;L[O].push(d[3])}for(s=new RegExp("\\("+H(a)+'\\("(dll-reference\\s('+w+'))"\\)\\)'+P,"g");d=s.exec(y);)A[d[2]]||(L[O].push(d[1]),A[d[2]]=D(d[1]).m),L[d[2]]=L[d[2]]||[],L[d[2]].push(d[4]);for(var E=Object.keys(L),g=0;g<E.length;g++)for(var m=0;m<L[E[g]].length;m++)W(L[E[g]][m])&&(L[E[g]][m]=1*L[E[g]][m]);return L}function M(A){var _=Object.keys(A);return _.reduce(function(O,L){return O||A[L].length>0},!1)}function b(A,_){for(var O={main:[_]},L={main:[]},y={main:{}};M(O);)for(var u=Object.keys(O),a=0;a<u.length;a++){var s=u[a],d=O[s],E=d.pop();if(y[s]=y[s]||{},y[s][E]||!A[s][E])continue;y[s][E]=!0,L[s]=L[s]||[],L[s].push(E);for(var g=I(A,A[s][E],s),m=Object.keys(g),k=0;k<m.length;k++)O[m[k]]=O[m[k]]||[],O[m[k]]=O[m[k]].concat(g[m[k]])}return L}ae.exports=function(A,_){_=_||{};var O={main:D.m},L=_.all?{main:Object.keys(O.main)}:b(O,A),y="";Object.keys(L).filter(function(E){return E!=="main"}).forEach(function(E){for(var g=0;L[E][g];)g++;L[E].push(g),O[E][g]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",y=y+"var "+E+" = ("+K.toString().replace("ENTRY_MODULE",JSON.stringify(g))+")({"+L[E].map(function(m){return""+JSON.stringify(m)+": "+O[E][m].toString()}).join(",")+`});
`}),y=y+"new (("+K.toString().replace("ENTRY_MODULE",JSON.stringify(A))+")({"+L.main.map(function(E){return""+JSON.stringify(E)+": "+O.main[E].toString()}).join(",")+"}))(self);";var u=new window.Blob([y],{type:"text/javascript"});if(_.bare)return u;var a=window.URL||window.webkitURL||window.mozURL||window.msURL,s=a.createObjectURL(u),d=new window.Worker(s);return d.objectURL=s,d}},"./src/config.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"hlsDefaultConfig",function(){return k}),D.d(X,"mergeConfig",function(){return h}),D.d(X,"enableStreamingMode",function(){return p});var K=D("./src/controller/abr-controller.ts"),w=D("./src/controller/audio-stream-controller.ts"),P=D("./src/controller/audio-track-controller.ts"),H=D("./src/controller/subtitle-stream-controller.ts"),W=D("./src/controller/subtitle-track-controller.ts"),I=D("./src/controller/buffer-controller.ts"),M=D("./src/controller/timeline-controller.ts"),b=D("./src/controller/cap-level-controller.ts"),A=D("./src/controller/fps-controller.ts"),_=D("./src/controller/eme-controller.ts"),O=D("./src/controller/cmcd-controller.ts"),L=D("./src/utils/xhr-loader.ts"),y=D("./src/utils/fetch-loader.ts"),u=D("./src/utils/cues.ts"),a=D("./src/utils/mediakeys-helper.ts"),s=D("./src/utils/logger.ts");function d(){return d=Object.assign||function(c){for(var o=1;o<arguments.length;o++){var S=arguments[o];for(var v in S)Object.prototype.hasOwnProperty.call(S,v)&&(c[v]=S[v])}return c},d.apply(this,arguments)}function E(c,o){var S=Object.keys(c);if(Object.getOwnPropertySymbols){var v=Object.getOwnPropertySymbols(c);o&&(v=v.filter(function(T){return Object.getOwnPropertyDescriptor(c,T).enumerable})),S.push.apply(S,v)}return S}function g(c){for(var o=1;o<arguments.length;o++){var S=arguments[o]!=null?arguments[o]:{};o%2?E(Object(S),!0).forEach(function(v){m(c,v,S[v])}):Object.getOwnPropertyDescriptors?Object.defineProperties(c,Object.getOwnPropertyDescriptors(S)):E(Object(S)).forEach(function(v){Object.defineProperty(c,v,Object.getOwnPropertyDescriptor(S,v))})}return c}function m(c,o,S){return o in c?Object.defineProperty(c,o,{value:S,enumerable:!0,configurable:!0,writable:!0}):c[o]=S,c}var k=g(g({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:L.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:K.default,bufferController:I.default,capLevelController:b.default,fpsController:A.default,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystemOptions:{},requestMediaKeySystemAccessFunc:a.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},x()),{},{subtitleStreamController:H.SubtitleStreamController,subtitleTrackController:W.default,timelineController:M.TimelineController,audioStreamController:w.default,audioTrackController:P.default,emeController:_.default,cmcdController:O.default});function x(){return{cueHandler:u.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 h(c,o){if((o.liveSyncDurationCount||o.liveMaxLatencyDurationCount)&&(o.liveSyncDuration||o.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(o.liveMaxLatencyDurationCount!==void 0&&(o.liveSyncDurationCount===void 0||o.liveMaxLatencyDurationCount<=o.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(o.liveMaxLatencyDuration!==void 0&&(o.liveSyncDuration===void 0||o.liveMaxLatencyDuration<=o.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return d({},c,o)}function p(c){var o=c.loader;if(o!==y.default&&o!==L.default)s.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),c.progressive=!1;else{var S=Object(y.fetchSupported)();S&&(c.loader=y.default,c.progressive=!0,c.enableSoftwareAES=!0,s.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(ae,X,D){"use strict";D.r(X);var K=D("./src/polyfills/number.ts"),w=D("./src/utils/ewma-bandwidth-estimator.ts"),P=D("./src/events.ts"),H=D("./src/utils/buffer-helper.ts"),W=D("./src/errors.ts"),I=D("./src/types/loader.ts"),M=D("./src/utils/logger.ts");function b(O,L){for(var y=0;y<L.length;y++){var u=L[y];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(O,u.key,u)}}function A(O,L,y){return L&&b(O.prototype,L),y&&b(O,y),O}var _=function(){function O(y){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=y;var u=y.config;this.bwEstimator=new w.default(u.abrEwmaSlowVoD,u.abrEwmaFastVoD,u.abrEwmaDefaultEstimate),this.registerListeners()}var L=O.prototype;return L.registerListeners=function(){var u=this.hls;u.on(P.Events.FRAG_LOADING,this.onFragLoading,this),u.on(P.Events.FRAG_LOADED,this.onFragLoaded,this),u.on(P.Events.FRAG_BUFFERED,this.onFragBuffered,this),u.on(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.on(P.Events.ERROR,this.onError,this)},L.unregisterListeners=function(){var u=this.hls;u.off(P.Events.FRAG_LOADING,this.onFragLoading,this),u.off(P.Events.FRAG_LOADED,this.onFragLoaded,this),u.off(P.Events.FRAG_BUFFERED,this.onFragBuffered,this),u.off(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.off(P.Events.ERROR,this.onError,this)},L.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},L.onFragLoading=function(u,a){var s=a.frag;if(s.type===I.PlaylistLevelType.MAIN&&!this.timer){var d;this.fragCurrent=s,this.partCurrent=(d=a.part)!=null?d:null,this.timer=self.setInterval(this.onCheck,100)}},L.onLevelLoaded=function(u,a){var s=this.hls.config;a.details.live?this.bwEstimator.update(s.abrEwmaSlowLive,s.abrEwmaFastLive):this.bwEstimator.update(s.abrEwmaSlowVoD,s.abrEwmaFastVoD)},L._abandonRulesCheck=function(){var u=this.fragCurrent,a=this.partCurrent,s=this.hls,d=s.autoLevelEnabled,E=s.config,g=s.media;if(!u||!g)return;var m=a?a.stats:u.stats,k=a?a.duration:u.duration;if(m.aborted){M.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!d||g.paused||!g.playbackRate||!g.readyState)return;var x=performance.now()-m.loading.start,h=Math.abs(g.playbackRate);if(x<=500*k/h)return;var p=s.levels,c=s.minAutoLevel,o=p[u.level],S=m.total||Math.max(m.loaded,Math.round(k*o.maxBitrate/8)),v=Math.max(1,m.bwEstimate?m.bwEstimate/8:m.loaded*1e3/x),T=(S-m.loaded)/v,N=g.currentTime,z=(H.BufferHelper.bufferInfo(g,N,E.maxBufferHole).end-N)/h;if(z>=2*k/h||T<=z)return;var Y=Number.POSITIVE_INFINITY,ee;for(ee=u.level-1;ee>c;ee--){var G=p[ee].maxBitrate;if(Y=k*G/(8*.8*v),Y<z)break}if(Y>=T)return;var j=this.bwEstimator.getEstimate();M.logger.warn("Fragment "+u.sn+(a?" part "+a.index:"")+" of level "+u.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+ee+`
Current BW estimate: `+(Object(K.isFiniteNumber)(j)?(j/1024).toFixed(3):"Unknown")+` Kb/s
Estimated load time for current fragment: `+T.toFixed(3)+` s
Estimated load time for the next fragment: `+Y.toFixed(3)+` s
Time to underbuffer: `+z.toFixed(3)+" s"),s.nextLoadLevel=ee,this.bwEstimator.sample(x,m.loaded),this.clearTimer(),u.loader&&(this.fragCurrent=this.partCurrent=null,u.loader.abort()),s.trigger(P.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:u,part:a,stats:m})},L.onFragLoaded=function(u,a){var s=a.frag,d=a.part;if(s.type===I.PlaylistLevelType.MAIN&&Object(K.isFiniteNumber)(s.sn)){var E=d?d.stats:s.stats,g=d?d.duration:s.duration;if(this.clearTimer(),this.lastLoadedFragLevel=s.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var m=this.hls.levels[s.level],k=(m.loaded?m.loaded.bytes:0)+E.loaded,x=(m.loaded?m.loaded.duration:0)+g;m.loaded={bytes:k,duration:x},m.realBitrate=Math.round(8*k/x)}if(s.bitrateTest){var h={stats:E,frag:s,part:d,id:s.type};this.onFragBuffered(P.Events.FRAG_BUFFERED,h),s.bitrateTest=!1}}},L.onFragBuffered=function(u,a){var s=a.frag,d=a.part,E=d?d.stats:s.stats;if(E.aborted)return;if(s.type!==I.PlaylistLevelType.MAIN||s.sn==="initSegment")return;var g=E.parsing.end-E.loading.start;this.bwEstimator.sample(g,E.loaded),E.bwEstimate=this.bwEstimator.getEstimate(),s.bitrateTest?this.bitrateTestDelay=g/1e3:this.bitrateTestDelay=0},L.onError=function(u,a){switch(a.details){case W.ErrorDetails.FRAG_LOAD_ERROR:case W.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},L.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},L.getNextABRAutoLevel=function(){var u=this.fragCurrent,a=this.partCurrent,s=this.hls,d=s.maxAutoLevel,E=s.config,g=s.minAutoLevel,m=s.media,k=a?a.duration:u?u.duration:0,x=m?m.currentTime:0,h=m&&m.playbackRate!==0?Math.abs(m.playbackRate):1,p=this.bwEstimator?this.bwEstimator.getEstimate():E.abrEwmaDefaultEstimate,c=(H.BufferHelper.bufferInfo(m,x,E.maxBufferHole).end-x)/h,o=this.findBestLevel(p,g,d,c,E.abrBandWidthFactor,E.abrBandWidthUpFactor);if(o>=0)return o;M.logger.trace((c?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var S=k?Math.min(k,E.maxStarvationDelay):E.maxStarvationDelay,v=E.abrBandWidthFactor,T=E.abrBandWidthUpFactor;if(!c){var N=this.bitrateTestDelay;if(N){var z=k?Math.min(k,E.maxLoadingDelay):E.maxLoadingDelay;S=z-N,M.logger.trace("bitrate test took "+Math.round(1e3*N)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*S)+" ms"),v=T=1}}return o=this.findBestLevel(p,g,d,c+S,v,T),Math.max(o,0)},L.findBestLevel=function(u,a,s,d,E,g){for(var m,k=this.fragCurrent,x=this.partCurrent,h=this.lastLoadedFragLevel,p=this.hls.levels,c=p[h],o=!!(c!=null&&(m=c.details)!==null&&m!==void 0&&m.live),S=c==null?void 0:c.codecSet,v=x?x.duration:k?k.duration:0,T=s;T>=a;T--){var N=p[T];if(!N||S&&N.codecSet!==S)continue;var z=N.details,Y=(x?z==null?void 0:z.partTarget:z==null?void 0:z.averagetargetduration)||v,ee=void 0;T<=h?ee=E*u:ee=g*u;var G=p[T].maxBitrate,j=G*Y/ee;if(M.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+T+"/"+Math.round(ee)+"/"+G+"/"+Y+"/"+d+"/"+j),ee>G&&(!j||o&&!this.bitrateTestDelay||j<d))return T}return-1},A(O,[{key:"nextAutoLevel",get:function(){var u=this._nextAutoLevel,a=this.bwEstimator;if(u!==-1&&(!a||!a.canEstimate()))return u;var s=this.getNextABRAutoLevel();return u!==-1&&(s=Math.min(u,s)),s},set:function(u){this._nextAutoLevel=u}}]),O}();X.default=_},"./src/controller/audio-stream-controller.ts":function(ae,X,D){"use strict";D.r(X);var K=D("./src/polyfills/number.ts"),w=D("./src/controller/base-stream-controller.ts"),P=D("./src/events.ts"),H=D("./src/utils/buffer-helper.ts"),W=D("./src/controller/fragment-tracker.ts"),I=D("./src/types/level.ts"),M=D("./src/types/loader.ts"),b=D("./src/loader/fragment.ts"),A=D("./src/demux/chunk-cache.ts"),_=D("./src/demux/transmuxer-interface.ts"),O=D("./src/types/transmuxer.ts"),L=D("./src/controller/fragment-finders.ts"),y=D("./src/utils/discontinuities.ts"),u=D("./src/errors.ts"),a=D("./src/utils/logger.ts");function s(){return s=Object.assign||function(k){for(var x=1;x<arguments.length;x++){var h=arguments[x];for(var p in h)Object.prototype.hasOwnProperty.call(h,p)&&(k[p]=h[p])}return k},s.apply(this,arguments)}function d(k,x){k.prototype=Object.create(x.prototype),k.prototype.constructor=k,E(k,x)}function E(k,x){return E=Object.setPrototypeOf||function(p,c){return p.__proto__=c,p},E(k,x)}var g=100,m=function(k){d(x,k);function x(p,c){var o;return o=k.call(this,p,c,"[audio-stream-controller]")||this,o.videoBuffer=null,o.videoTrackCC=-1,o.waitingVideoCC=-1,o.audioSwitch=!1,o.trackId=-1,o.waitingData=null,o.mainDetails=null,o.bufferFlushed=!1,o._registerListeners(),o}var h=x.prototype;return h.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},h._registerListeners=function(){var c=this.hls;c.on(P.Events.MEDIA_ATTACHED,this.onMediaAttached,this),c.on(P.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.on(P.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.on(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.on(P.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),c.on(P.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),c.on(P.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),c.on(P.Events.ERROR,this.onError,this),c.on(P.Events.BUFFER_RESET,this.onBufferReset,this),c.on(P.Events.BUFFER_CREATED,this.onBufferCreated,this),c.on(P.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),c.on(P.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),c.on(P.Events.FRAG_BUFFERED,this.onFragBuffered,this)},h._unregisterListeners=function(){var c=this.hls;c.off(P.Events.MEDIA_ATTACHED,this.onMediaAttached,this),c.off(P.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.off(P.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.off(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.off(P.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),c.off(P.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),c.off(P.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),c.off(P.Events.ERROR,this.onError,this),c.off(P.Events.BUFFER_RESET,this.onBufferReset,this),c.off(P.Events.BUFFER_CREATED,this.onBufferCreated,this),c.off(P.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),c.off(P.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),c.off(P.Events.FRAG_BUFFERED,this.onFragBuffered,this)},h.onInitPtsFound=function(c,o){var S=o.frag,v=o.id,T=o.initPTS;if(v==="main"){var N=S.cc;this.initPTS[S.cc]=T,this.log("InitPTS for cc: "+N+" found from main: "+T),this.videoTrackCC=N,this.state===w.State.WAITING_INIT_PTS&&this.tick()}},h.startLoad=function(c){if(!this.levels){this.startPosition=c,this.state=w.State.STOPPED;return}var o=this.lastCurrentTime;this.stopLoad(),this.setInterval(g),this.fragLoadError=0,o>0&&c===-1?(this.log("Override startPosition with lastCurrentTime @"+o.toFixed(3)),this.state=w.State.IDLE):(this.loadedmetadata=!1,this.state=w.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=c,this.tick()},h.doTick=function(){switch(this.state){case w.State.IDLE:this.doTickIdle();break;case w.State.WAITING_TRACK:{var c,o=this.levels,S=this.trackId,v=o==null||((c=o[S])===null||c===void 0)?void 0:c.details;if(v){if(this.waitForCdnTuneIn(v))break;this.state=w.State.WAITING_INIT_PTS}break}case w.State.FRAG_LOADING_WAITING_RETRY:{var T,N=performance.now(),z=this.retryDate;(!z||N>=z||(T=this.media)!==null&&T!==void 0&&T.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=w.State.IDLE);break}case w.State.WAITING_INIT_PTS:{var Y=this.waitingData;if(Y){var ee=Y.frag,G=Y.part,j=Y.cache,te=Y.complete;if(this.initPTS[ee.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=w.State.FRAG_LOADING;var de=j.flush(),be={frag:ee,part:G,payload:de,networkDetails:null};this._handleFragmentLoadProgress(be),te&&k.prototype._handleFragmentLoadComplete.call(this,be)}else if(this.videoTrackCC!==this.waitingVideoCC)a.logger.log("Waiting fragment cc ("+ee.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var Oe=this.getLoadPosition(),Ge=H.BufferHelper.bufferInfo(this.mediaBuffer,Oe,this.config.maxBufferHole),Me=Object(L.fragmentWithinToleranceTest)(Ge.end,this.config.maxFragLookUpTolerance,ee);Me<0&&(a.logger.log("Waiting fragment cc ("+ee.cc+") @ "+ee.start+" cancelled because another fragment at "+Ge.end+" is needed"),this.clearWaitingFragment())}}else this.state=w.State.IDLE}}this.onTickEnd()},h.clearWaitingFragment=function(){var c=this.waitingData;c&&(this.fragmentTracker.removeFragment(c.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=w.State.IDLE)},h.onTickEnd=function(){var c=this.media;if(!c||!c.readyState)return;var o=this.mediaBuffer?this.mediaBuffer:c,S=o.buffered;!this.loadedmetadata&&S.length&&(this.loadedmetadata=!0),this.lastCurrentTime=c.currentTime},h.doTickIdle=function(){var c,o,S=this.hls,v=this.levels,T=this.media,N=this.trackId,z=S.config;if(!v||!v[N])return;if(!T&&(this.startFragRequested||!z.startFragPrefetch))return;var Y=v[N],ee=Y.details;if(!ee||ee.live&&this.levelLastLoaded!==N||this.waitForCdnTuneIn(ee)){this.state=w.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,b.ElementaryStreamTypes.AUDIO,M.PlaylistLevelType.AUDIO));var G=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,M.PlaylistLevelType.AUDIO);if(G===null)return;var j=G.len,te=this.getMaxBufferLength(),de=this.audioSwitch;if(j>=te&&!de)return;if(!de&&this._streamEnded(G,ee)){S.trigger(P.Events.BUFFER_EOS,{type:"audio"}),this.state=w.State.ENDED;return}var be=ee.fragments,Oe=be[0].start,Ge=G.end;if(de){var Me=this.getLoadPosition();Ge=Me,ee.PTSKnown&&Me<Oe&&((G.end>Oe||G.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),T.currentTime=Oe+.05))}var Ie=this.getNextFragment(Ge,ee);if(!Ie){this.bufferFlushed=!0;return}((c=Ie.decryptdata)===null||c===void 0?void 0:c.keyFormat)==="identity"&&!((o=Ie.decryptdata)!==null&&o!==void 0&&o.key)?this.loadKey(Ie,ee):this.loadFragment(Ie,ee,Ge)},h.getMaxBufferLength=function(){var c=k.prototype.getMaxBufferLength.call(this),o=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,M.PlaylistLevelType.MAIN);return o===null?c:Math.max(c,o.len)},h.onMediaDetaching=function(){this.videoBuffer=null,k.prototype.onMediaDetaching.call(this)},h.onAudioTracksUpdated=function(c,o){var S=o.audioTracks;this.resetTransmuxer(),this.levels=S.map(function(v){return new I.Level(v)})},h.onAudioTrackSwitching=function(c,o){var S=!!o.url;this.trackId=o.id;var v=this.fragCurrent;v!=null&&v.loader&&v.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),S?this.setInterval(g):this.resetTransmuxer(),S?(this.audioSwitch=!0,this.state=w.State.IDLE):this.state=w.State.STOPPED,this.tick()},h.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},h.onLevelLoaded=function(c,o){this.mainDetails=o.details},h.onAudioTrackLoaded=function(c,o){var S,v=this.levels,T=o.details,N=o.id;if(!v){this.warn("Audio tracks were reset while loading level "+N);return}this.log("Track "+N+" loaded ["+T.startSN+","+T.endSN+"],duration:"+T.totalduration);var z=v[N],Y=0;if(T.live||(S=z.details)!==null&&S!==void 0&&S.live){var ee=this.mainDetails;if(T.fragments[0]||(T.deltaUpdateFailed=!0),T.deltaUpdateFailed||!ee)return;!z.details&&T.hasProgramDateTime&&ee.hasProgramDateTime?(Object(y.alignMediaPlaylistByPDT)(T,ee),Y=T.fragments[0].start):Y=this.alignPlaylists(T,z.details)}z.details=T,this.levelLastLoaded=N,!this.startFragRequested&&(this.mainDetails||!T.live)&&this.setStartPosition(z.details,Y),this.state===w.State.WAITING_TRACK&&!this.waitForCdnTuneIn(T)&&(this.state=w.State.IDLE),this.tick()},h._handleFragmentLoadProgress=function(c){var o,S=c.frag,v=c.part,T=c.payload,N=this.config,z=this.trackId,Y=this.levels;if(!Y){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+S.sn+" of level "+S.level+" will not be buffered");return}var ee=Y[z];console.assert(ee,"Audio track is defined on fragment load progress");var G=ee.details;console.assert(G,"Audio track details are defined on fragment load progress");var j=N.defaultAudioCodec||ee.audioCodec||"mp4a.40.2",te=this.transmuxer;te||(te=this.transmuxer=new _.default(this.hls,M.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var de=this.initPTS[S.cc],be=(o=S.initSegment)===null||o===void 0?void 0:o.data;if(de!==void 0){var Oe=!1,Ge=v?v.index:-1,Me=Ge!==-1,Ie=new O.ChunkMetadata(S.level,S.sn,S.stats.chunkCount,T.byteLength,Ge,Me);te.push(T,be,j,"",S,v,G.totalduration,Oe,Ie,de)}else{a.logger.log("Unknown video PTS for cc "+S.cc+", waiting for video PTS before demuxing audio frag "+S.sn+" of ["+G.startSN+" ,"+G.endSN+"],track "+z);var Ue=this.waitingData=this.waitingData||{frag:S,part:v,cache:new A.default,complete:!1},Pe=Ue.cache;Pe.push(new Uint8Array(T)),this.waitingVideoCC=this.videoTrackCC,this.state=w.State.WAITING_INIT_PTS}},h._handleFragmentLoadComplete=function(c){if(this.waitingData){this.waitingData.complete=!0;return}k.prototype._handleFragmentLoadComplete.call(this,c)},h.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},h.onBufferCreated=function(c,o){var S=o.tracks.audio;S&&(this.mediaBuffer=S.buffer),o.tracks.video&&(this.videoBuffer=o.tracks.video.buffer)},h.onFragBuffered=function(c,o){var S=o.frag,v=o.part;if(S.type!==M.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(S)){this.warn("Fragment "+S.sn+(v?" p: "+v.index:"")+" of level "+S.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}S.sn!=="initSegment"&&(this.fragPrevious=S,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(P.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(S,v)},h.onError=function(c,o){switch(o.details){case u.ErrorDetails.FRAG_LOAD_ERROR:case u.ErrorDetails.FRAG_LOAD_TIMEOUT:case u.ErrorDetails.KEY_LOAD_ERROR:case u.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(M.PlaylistLevelType.AUDIO,o);break;case u.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case u.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==w.State.ERROR&&this.state!==w.State.STOPPED&&(this.state=o.fatal?w.State.ERROR:w.State.IDLE,this.warn(o.details+" while loading frag, switching to "+this.state+" state"));break;case u.ErrorDetails.BUFFER_FULL_ERROR:if(o.parent==="audio"&&(this.state===w.State.PARSING||this.state===w.State.PARSED)){var S=!0,v=this.getFwdBufferInfo(this.mediaBuffer,M.PlaylistLevelType.AUDIO);v&&v.len>.5&&(S=!this.reduceMaxBufferLength(v.len)),S&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,k.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},h.onBufferFlushed=function(c,o){var S=o.type;S===b.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},h._handleTransmuxComplete=function(c){var o,S="audio",v=this.hls,T=c.remuxResult,N=c.chunkMeta,z=this.getCurrentContext(N);if(!z){this.warn("The loading context changed while buffering fragment "+N.sn+" of level "+N.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(N.level);return}var Y=z.frag,ee=z.part,G=T.audio,j=T.text,te=T.id3,de=T.initSegment;if(this.fragContextChanged(Y))return;if(this.state=w.State.PARSING,this.audioSwitch&&G&&this.completeAudioSwitch(),de!=null&&de.tracks&&(this._bufferInitSegment(de.tracks,Y,N),v.trigger(P.Events.FRAG_PARSING_INIT_SEGMENT,{frag:Y,id:S,tracks:de.tracks})),G){var be=G.startPTS,Oe=G.endPTS,Ge=G.startDTS,Me=G.endDTS;ee&&(ee.elementaryStreams[b.ElementaryStreamTypes.AUDIO]={startPTS:be,endPTS:Oe,startDTS:Ge,endDTS:Me}),Y.setElementaryStreamInfo(b.ElementaryStreamTypes.AUDIO,be,Oe,Ge,Me),this.bufferFragmentData(G,Y,ee,N)}if(te!=null&&(o=te.samples)!==null&&o!==void 0&&o.length){var Ie=s({frag:Y,id:S},te);v.trigger(P.Events.FRAG_PARSING_METADATA,Ie)}if(j){var Ue=s({frag:Y,id:S},j);v.trigger(P.Events.FRAG_PARSING_USERDATA,Ue)}},h._bufferInitSegment=function(c,o,S){if(this.state!==w.State.PARSING)return;c.video&&delete c.video;var v=c.audio;if(!v)return;v.levelCodec=v.codec,v.id="audio",this.log("Init audio buffer, container:"+v.container+", codecs[parsed]=["+v.codec+"]"),this.hls.trigger(P.Events.BUFFER_CODECS,c);var T=v.initSegment;if(T!=null&&T.byteLength){var N={type:"audio",frag:o,part:null,chunkMeta:S,parent:o.type,data:T};this.hls.trigger(P.Events.BUFFER_APPENDING,N)}this.tick()},h.loadFragment=function(c,o,S){var v=this.fragmentTracker.getState(c);this.fragCurrent=c,(this.audioSwitch||v===W.FragmentState.NOT_LOADED||v===W.FragmentState.PARTIAL)&&(c.sn==="initSegment"?this._loadInitSegment(c):o.live&&!Object(K.isFiniteNumber)(this.initPTS[c.cc])?(this.log("Waiting for video PTS in continuity counter "+c.cc+" of live stream before loading audio fragment "+c.sn+" of level "+this.trackId),this.state=w.State.WAITING_INIT_PTS):(this.startFragRequested=!0,k.prototype.loadFragment.call(this,c,o,S)))},h.completeAudioSwitch=function(){var c=this.hls,o=this.media,S=this.trackId;o&&(this.log("Switching audio track : flushing all audio"),k.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,c.trigger(P.Events.AUDIO_TRACK_SWITCHED,{id:S})},x}(w.default);X.default=m},"./src/controller/audio-track-controller.ts":function(ae,X,D){"use strict";D.r(X);var K=D("./src/events.ts"),w=D("./src/errors.ts"),P=D("./src/controller/base-playlist-controller.ts"),H=D("./src/types/loader.ts");function W(_,O){for(var L=0;L<O.length;L++){var y=O[L];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(_,y.key,y)}}function I(_,O,L){return O&&W(_.prototype,O),L&&W(_,L),_}function M(_,O){_.prototype=Object.create(O.prototype),_.prototype.constructor=_,b(_,O)}function b(_,O){return b=Object.setPrototypeOf||function(y,u){return y.__proto__=u,y},b(_,O)}var A=function(_){M(O,_);function O(y){var u;return u=_.call(this,y,"[audio-track-controller]")||this,u.tracks=[],u.groupId=null,u.tracksInGroup=[],u.trackId=-1,u.trackName="",u.selectDefaultTrack=!0,u.registerListeners(),u}var L=O.prototype;return L.registerListeners=function(){var u=this.hls;u.on(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.on(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),u.on(K.Events.LEVEL_LOADING,this.onLevelLoading,this),u.on(K.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),u.on(K.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),u.on(K.Events.ERROR,this.onError,this)},L.unregisterListeners=function(){var u=this.hls;u.off(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.off(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),u.off(K.Events.LEVEL_LOADING,this.onLevelLoading,this),u.off(K.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),u.off(K.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),u.off(K.Events.ERROR,this.onError,this)},L.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,_.prototype.destroy.call(this)},L.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},L.onManifestParsed=function(u,a){this.tracks=a.audioTracks||[]},L.onAudioTrackLoaded=function(u,a){var s=a.id,d=a.details,E=this.tracksInGroup[s];if(!E){this.warn("Invalid audio track id "+s);return}var g=E.details;E.details=a.details,this.log("audioTrack "+s+" loaded ["+d.startSN+"-"+d.endSN+"]"),s===this.trackId&&(this.retryCount=0,this.playlistLoaded(s,a,g))},L.onLevelLoading=function(u,a){this.switchLevel(a.level)},L.onLevelSwitching=function(u,a){this.switchLevel(a.level)},L.switchLevel=function(u){var a=this.hls.levels[u];if(!(a!=null&&a.audioGroupIds))return;var s=a.audioGroupIds[a.urlId];if(this.groupId!==s){this.groupId=s;var d=this.tracks.filter(function(g){return!s||g.groupId===s});this.selectDefaultTrack&&!d.some(function(g){return g.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=d;var E={audioTracks:d};this.log("Updating audio tracks, "+d.length+' track(s) found in "'+s+'" group-id'),this.hls.trigger(K.Events.AUDIO_TRACKS_UPDATED,E),this.selectInitialTrack()}},L.onError=function(u,a){if(_.prototype.onError.call(this,u,a),a.fatal||!a.context)return;a.context.type===H.PlaylistContextType.AUDIO_TRACK&&a.context.id===this.trackId&&a.context.groupId===this.groupId&&this.retryLoadingOrFail(a)},L.setAudioTrack=function(u){var a=this.tracksInGroup;if(u<0||u>=a.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var s=a[this.trackId];this.log("Now switching to audio-track index "+u);var d=a[u],E=d.id,g=d.groupId,m=g===void 0?"":g,k=d.name,x=d.type,h=d.url;if(this.trackId=u,this.trackName=k,this.selectDefaultTrack=!1,this.hls.trigger(K.Events.AUDIO_TRACK_SWITCHING,{id:E,groupId:m,name:k,type:x,url:h}),d.details&&!d.details.live)return;var p=this.switchParams(d.url,s==null?void 0:s.details);this.loadPlaylist(p)},L.selectInitialTrack=function(){var u=this.tracksInGroup;console.assert(u.length,"Initial audio track should be selected when tracks are known");var a=this.trackName,s=this.findTrackId(a)||this.findTrackId();s!==-1?this.setAudioTrack(s):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(K.Events.ERROR,{type:w.ErrorTypes.MEDIA_ERROR,details:w.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},L.findTrackId=function(u){for(var a=this.tracksInGroup,s=0;s<a.length;s++){var d=a[s];if((!this.selectDefaultTrack||d.default)&&(!u||u===d.name))return d.id}return-1},L.loadPlaylist=function(u){var a=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(a)){var s=a.id,d=a.groupId,E=a.url;if(u)try{E=u.addDirectives(E)}catch(g){this.warn("Could not construct new URL with HLS Delivery Directives: "+g)}this.log("loading audio-track playlist for id: "+s),this.clearTimer(),this.hls.trigger(K.Events.AUDIO_TRACK_LOADING,{url:E,id:s,groupId:d,deliveryDirectives:u||null})}},I(O,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(u){this.selectDefaultTrack=!1,this.setAudioTrack(u)}}]),O}(P.default);X.default=A},"./src/controller/base-playlist-controller.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"default",function(){return I});var K=D("./src/polyfills/number.ts"),w=D("./src/types/level.ts"),P=D("./src/controller/level-helper.ts"),H=D("./src/utils/logger.ts"),W=D("./src/errors.ts"),I=function(){function M(A,_){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=A}var b=M.prototype;return b.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},b.onError=function(_,O){O.fatal&&O.type===W.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},b.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},b.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},b.stopLoad=function(){this.canLoad=!1,this.clearTimer()},b.switchParams=function(_,O){var L=O==null?void 0:O.renditionReports;if(L)for(var y=0;y<L.length;y++){var u=L[y],a=""+u.URI;if(a===_.substr(-a.length)){var s=parseInt(u["LAST-MSN"]),d=parseInt(u["LAST-PART"]);if(O&&this.hls.config.lowLatencyMode){var E=Math.min(O.age-O.partTarget,O.targetduration);d!==void 0&&E>O.partTarget&&(d+=1)}if(Object(K.isFiniteNumber)(s))return new w.HlsUrlParameters(s,Object(K.isFiniteNumber)(d)?d:void 0,w.HlsSkip.No)}}},b.loadPlaylist=function(_){},b.shouldLoadTrack=function(_){return this.canLoad&&_&&!!_.url&&(!_.details||_.details.live)},b.playlistLoaded=function(_,O,L){var y=this,u=O.details,a=O.stats,s=a.loading.end?Math.max(0,self.performance.now()-a.loading.end):0;if(u.advancedDateTime=Date.now()-s,u.live||L!=null&&L.live){if(u.reloaded(L),L&&this.log("live playlist "+_+" "+(u.advanced?"REFRESHED "+u.lastPartSn+"-"+u.lastPartIndex:"MISSED")),L&&u.fragments.length>0&&Object(P.mergeDetails)(L,u),!this.canLoad||!u.live)return;var d,E=void 0,g=void 0;if(u.canBlockReload&&u.endSN&&u.advanced){var m=this.hls.config.lowLatencyMode,k=u.lastPartSn,x=u.endSN,h=u.lastPartIndex,p=h!==-1,c=k===x,o=m?0:h;p?(E=c?x+1:k,g=c?o:h+1):E=x+1;var S=u.age,v=S+u.ageHeader,T=Math.min(v-u.partTarget,u.targetduration*1.5);if(T>0){if(L&&T>L.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+L.tuneInGoal+" to: "+T+" with playlist age: "+u.age),T=0;else{var N=Math.floor(T/u.targetduration);if(E+=N,g!==void 0){var z=Math.round(T%u.targetduration/u.partTarget);g+=z}this.log("CDN Tune-in age: "+u.ageHeader+"s last advanced "+S.toFixed(2)+"s goal: "+T+" skip sn "+N+" to part "+g)}u.tuneInGoal=T}if(d=this.getDeliveryDirectives(u,O.deliveryDirectives,E,g),m||!c){this.loadPlaylist(d);return}}else d=this.getDeliveryDirectives(u,O.deliveryDirectives,E,g);var Y=Object(P.computeReloadInterval)(u,a);E!==void 0&&u.canBlockReload&&(Y-=u.partTarget||1),this.log("reload live playlist "+_+" in "+Math.round(Y)+" ms"),this.timer=self.setTimeout(function(){return y.loadPlaylist(d)},Y)}else this.clearTimer()},b.getDeliveryDirectives=function(_,O,L,y){var u=Object(w.getSkipValue)(_,L);return O!=null&&O.skip&&_.deltaUpdateFailed&&(L=O.msn,y=O.part,u=w.HlsSkip.No),new w.HlsUrlParameters(L,y,u)},b.retryLoadingOrFail=function(_){var O=this,L=this.hls.config,y=this.retryCount<L.levelLoadingMaxRetry;if(y){var u;if(this.retryCount++,_.details.indexOf("LoadTimeOut")>-1&&(u=_.context)!==null&&u!==void 0&&u.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+_.details+'"'),this.loadPlaylist();else{var a=Math.min(Math.pow(2,this.retryCount)*L.levelLoadingRetryDelay,L.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return O.loadPlaylist()},a),this.warn("retry playlist loading #"+this.retryCount+" in "+a+' ms after "'+_.details+'"')}}else this.warn('cannot recover from error "'+_.details+'"'),this.clearTimer(),_.fatal=!0;return y},M}()},"./src/controller/base-stream-controller.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"State",function(){return x}),D.d(X,"default",function(){return h});var K=D("./src/polyfills/number.ts"),w=D("./src/task-loop.ts"),P=D("./src/controller/fragment-tracker.ts"),H=D("./src/utils/buffer-helper.ts"),W=D("./src/utils/logger.ts"),I=D("./src/events.ts"),M=D("./src/errors.ts"),b=D("./src/types/transmuxer.ts"),A=D("./src/utils/mp4-tools.ts"),_=D("./src/utils/discontinuities.ts"),O=D("./src/controller/fragment-finders.ts"),L=D("./src/controller/level-helper.ts"),y=D("./src/loader/fragment-loader.ts"),u=D("./src/crypt/decrypter.ts"),a=D("./src/utils/time-ranges.ts"),s=D("./src/types/loader.ts");function d(p,c){for(var o=0;o<c.length;o++){var S=c[o];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(p,S.key,S)}}function E(p,c,o){return c&&d(p.prototype,c),o&&d(p,o),p}function g(p){if(p===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return p}function m(p,c){p.prototype=Object.create(c.prototype),p.prototype.constructor=p,k(p,c)}function k(p,c){return k=Object.setPrototypeOf||function(S,v){return S.__proto__=v,S},k(p,c)}var x={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"},h=function(p){m(c,p);function c(S,v,T){var N;return N=p.call(this)||this,N.hls=void 0,N.fragPrevious=null,N.fragCurrent=null,N.fragmentTracker=void 0,N.transmuxer=null,N._state=x.STOPPED,N.media=void 0,N.mediaBuffer=void 0,N.config=void 0,N.bitrateTest=!1,N.lastCurrentTime=0,N.nextLoadPosition=0,N.startPosition=0,N.loadedmetadata=!1,N.fragLoadError=0,N.retryDate=0,N.levels=null,N.fragmentLoader=void 0,N.levelLastLoaded=null,N.startFragRequested=!1,N.decrypter=void 0,N.initPTS=[],N.onvseeking=null,N.onvended=null,N.logPrefix="",N.log=void 0,N.warn=void 0,N.logPrefix=T,N.log=W.logger.log.bind(W.logger,T+":"),N.warn=W.logger.warn.bind(W.logger,T+":"),N.hls=S,N.fragmentLoader=new y.default(S.config),N.fragmentTracker=v,N.config=S.config,N.decrypter=new u.default(S,S.config),S.on(I.Events.KEY_LOADED,N.onKeyLoaded,g(N)),N}var o=c.prototype;return o.doTick=function(){this.onTickEnd()},o.onTickEnd=function(){},o.startLoad=function(v){},o.stopLoad=function(){this.fragmentLoader.abort();var v=this.fragCurrent;v&&this.fragmentTracker.removeFragment(v),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=x.STOPPED},o._streamEnded=function(v,T){var N=this.fragCurrent,z=this.fragmentTracker;if(!T.live&&N&&N.sn===T.endSN&&!v.nextStart){var Y=z.getState(N);return Y===P.FragmentState.PARTIAL||Y===P.FragmentState.OK}return!1},o.onMediaAttached=function(v,T){var N=this.media=this.mediaBuffer=T.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),N.addEventListener("seeking",this.onvseeking),N.addEventListener("ended",this.onvended);var z=this.config;this.levels&&z.autoStartLoad&&this.state===x.STOPPED&&this.startLoad(z.startPosition)},o.onMediaDetaching=function(){var v=this.media;v!=null&&v.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),v&&(v.removeEventListener("seeking",this.onvseeking),v.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},o.onMediaSeeking=function(){var v=this.config,T=this.fragCurrent,N=this.media,z=this.mediaBuffer,Y=this.state,ee=N?N.currentTime:0,G=H.BufferHelper.bufferInfo(z||N,ee,v.maxBufferHole);if(this.log("media seeking to "+(Object(K.isFiniteNumber)(ee)?ee.toFixed(3):ee)+", state: "+Y),Y===x.ENDED)this.resetLoadingState();else if(T&&!G.len){var j=v.maxFragLookUpTolerance,te=T.start-j,de=T.start+T.duration+j,be=ee>de;(ee<te||be)&&(be&&T.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),T.loader.abort()),this.resetLoadingState())}N&&(this.lastCurrentTime=ee),!this.loadedmetadata&&!G.len&&(this.nextLoadPosition=this.startPosition=ee),this.tickImmediate()},o.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},o.onKeyLoaded=function(v,T){if(this.state!==x.KEY_LOADING||T.frag!==this.fragCurrent||!this.levels)return;this.state=x.IDLE;var N=this.levels[T.frag.level].details;N&&this.loadFragment(T.frag,N,T.frag.start)},o.onHandlerDestroying=function(){this.stopLoad(),p.prototype.onHandlerDestroying.call(this)},o.onHandlerDestroyed=function(){this.state=x.STOPPED,this.hls.off(I.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,p.prototype.onHandlerDestroyed.call(this)},o.loadKey=function(v,T){this.log("Loading key for "+v.sn+" of ["+T.startSN+"-"+T.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+v.level),this.state=x.KEY_LOADING,this.fragCurrent=v,this.hls.trigger(I.Events.KEY_LOADING,{frag:v})},o.loadFragment=function(v,T,N){this._loadFragForPlayback(v,T,N)},o._loadFragForPlayback=function(v,T,N){var z=this,Y=function(G){if(z.fragContextChanged(v)){z.warn("Fragment "+v.sn+(G.part?" p: "+G.part.index:"")+" of level "+v.level+" was dropped during download."),z.fragmentTracker.removeFragment(v);return}v.stats.chunkCount++,z._handleFragmentLoadProgress(G)};this._doFragLoad(v,T,N,Y).then(function(ee){if(!ee)return;z.fragLoadError=0;var G=z.state;if(z.fragContextChanged(v)){(G===x.FRAG_LOADING||G===x.BACKTRACKING||!z.fragCurrent&&G===x.PARSING)&&(z.fragmentTracker.removeFragment(v),z.state=x.IDLE);return}if("payload"in ee&&(z.log("Loaded fragment "+v.sn+" of level "+v.level),z.hls.trigger(I.Events.FRAG_LOADED,ee),z.state===x.BACKTRACKING)){z.fragmentTracker.backtrack(v,ee),z.resetFragmentLoading(v);return}z._handleFragmentLoadComplete(ee)}).catch(function(ee){z.warn(ee),z.resetFragmentLoading(v)})},o.flushMainBuffer=function(v,T,N){if(N===void 0&&(N=null),!(v-T))return;var z={startOffset:v,endOffset:T,type:N};this.fragLoadError=0,this.hls.trigger(I.Events.BUFFER_FLUSHING,z)},o._loadInitSegment=function(v){var T=this;this._doFragLoad(v).then(function(N){if(!N||T.fragContextChanged(v)||!T.levels)throw new Error("init load aborted");return N}).then(function(N){var z=T.hls,Y=N.payload,ee=v.decryptdata;if(Y&&Y.byteLength>0&&ee&&ee.key&&ee.iv&&ee.method==="AES-128"){var G=self.performance.now();return T.decrypter.webCryptoDecrypt(new Uint8Array(Y),ee.key.buffer,ee.iv.buffer).then(function(j){var te=self.performance.now();return z.trigger(I.Events.FRAG_DECRYPTED,{frag:v,payload:j,stats:{tstart:G,tdecrypt:te}}),N.payload=j,N})}return N}).then(function(N){var z=T.fragCurrent,Y=T.hls,ee=T.levels;if(!ee)throw new Error("init load aborted, missing levels");var G=ee[v.level].details;console.assert(G,"Level details are defined when init segment is loaded");var j=v.stats;T.state=x.IDLE,T.fragLoadError=0,v.data=new Uint8Array(N.payload),j.parsing.start=j.buffering.start=self.performance.now(),j.parsing.end=j.buffering.end=self.performance.now(),N.frag===z&&Y.trigger(I.Events.FRAG_BUFFERED,{stats:j,frag:z,part:null,id:v.type}),T.tick()}).catch(function(N){T.warn(N),T.resetFragmentLoading(v)})},o.fragContextChanged=function(v){var T=this.fragCurrent;return!v||!T||v.level!==T.level||v.sn!==T.sn||v.urlId!==T.urlId},o.fragBufferedComplete=function(v,T){var N=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+v.type+" sn: "+v.sn+(T?" part: "+T.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+v.level+" "+a.default.toString(H.BufferHelper.getBuffered(N))),this.state=x.IDLE,this.tick()},o._handleFragmentLoadComplete=function(v){var T=this.transmuxer;if(!T)return;var N=v.frag,z=v.part,Y=v.partsLoaded,ee=!Y||Y.length===0||Y.some(function(j){return!j}),G=new b.ChunkMetadata(N.level,N.sn,N.stats.chunkCount+1,0,z?z.index:-1,!ee);T.flush(G)},o._handleFragmentLoadProgress=function(v){},o._doFragLoad=function(v,T,N,z){var Y=this;if(N===void 0&&(N=null),!this.levels)throw new Error("frag load aborted, missing levels");if(N=Math.max(v.start,N||0),this.config.lowLatencyMode&&T){var ee=T.partList;if(ee&&z){N>v.end&&T.fragmentHint&&(v=T.fragmentHint);var G=this.getNextPart(ee,v,N);if(G>-1){var j=ee[G];return this.log("Loading part sn: "+v.sn+" p: "+j.index+" cc: "+v.cc+" of playlist ["+T.startSN+"-"+T.endSN+"] parts [0-"+G+"-"+(ee.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+v.level+", target: "+parseFloat(N.toFixed(3))),this.nextLoadPosition=j.start+j.duration,this.state=x.FRAG_LOADING,this.hls.trigger(I.Events.FRAG_LOADING,{frag:v,part:ee[G],targetBufferTime:N}),this.doFragPartsLoad(v,ee,G,z).catch(function(te){return Y.handleFragLoadError(te)})}else if(!v.url||this.loadedEndOfParts(ee,N))return Promise.resolve(null)}}return this.log("Loading fragment "+v.sn+" cc: "+v.cc+" "+(T?"of ["+T.startSN+"-"+T.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+v.level+", target: "+parseFloat(N.toFixed(3))),Object(K.isFiniteNumber)(v.sn)&&!this.bitrateTest&&(this.nextLoadPosition=v.start+v.duration),this.state=x.FRAG_LOADING,this.hls.trigger(I.Events.FRAG_LOADING,{frag:v,targetBufferTime:N}),this.fragmentLoader.load(v,z).catch(function(te){return Y.handleFragLoadError(te)})},o.doFragPartsLoad=function(v,T,N,z){var Y=this;return new Promise(function(ee,G){var j=[],te=function de(be){var Oe=T[be];Y.fragmentLoader.loadPart(v,Oe,z).then(function(Ge){j[Oe.index]=Ge;var Me=Ge.part;Y.hls.trigger(I.Events.FRAG_LOADED,Ge);var Ie=T[be+1];if(Ie&&Ie.fragment===v)de(be+1);else return ee({frag:v,part:Me,partsLoaded:j})}).catch(G)};te(N)})},o.handleFragLoadError=function(v){var T=v.data;return T&&T.details===M.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(T.frag,T.part):this.hls.trigger(I.Events.ERROR,T),null},o._handleTransmuxerFlush=function(v){var T=this.getCurrentContext(v);if(!T||this.state!==x.PARSING){this.fragCurrent||(this.state=x.IDLE);return}var N=T.frag,z=T.part,Y=T.level,ee=self.performance.now();N.stats.parsing.end=ee,z&&(z.stats.parsing.end=ee),this.updateLevelTiming(N,z,Y,v.partial)},o.getCurrentContext=function(v){var T=this.levels,N=v.level,z=v.sn,Y=v.part;if(!T||!T[N])return this.warn("Levels object was unset while buffering fragment "+z+" of level "+N+". The current chunk will not be buffered."),null;var ee=T[N],G=Y>-1?Object(L.getPartWith)(ee,z,Y):null,j=G?G.fragment:Object(L.getFragmentWithSN)(ee,z,this.fragCurrent);return j?{frag:j,part:G,level:ee}:null},o.bufferFragmentData=function(v,T,N,z){if(!v||this.state!==x.PARSING)return;var Y=v.data1,ee=v.data2,G=Y;if(Y&&ee&&(G=Object(A.appendUint8Array)(Y,ee)),!G||!G.length)return;var j={type:v.type,frag:T,part:N,chunkMeta:z,parent:T.type,data:G};this.hls.trigger(I.Events.BUFFER_APPENDING,j),v.dropped&&v.independent&&!N&&this.flushBufferGap(T)},o.flushBufferGap=function(v){var T=this.media;if(!T)return;if(!H.BufferHelper.isBuffered(T,T.currentTime)){this.flushMainBuffer(0,v.start);return}var N=T.currentTime,z=H.BufferHelper.bufferInfo(T,N,0),Y=v.duration,ee=Math.min(this.config.maxFragLookUpTolerance*2,Y*.25),G=Math.max(Math.min(v.start-ee,z.end-ee),N+ee);v.start-G>ee&&this.flushMainBuffer(G,v.start)},o.getFwdBufferInfo=function(v,T){var N=this.config,z=this.getLoadPosition();if(!Object(K.isFiniteNumber)(z))return null;var Y=H.BufferHelper.bufferInfo(v,z,N.maxBufferHole);if(Y.len===0&&Y.nextStart!==void 0){var ee=this.fragmentTracker.getBufferedFrag(z,T);if(ee&&Y.nextStart<ee.end)return H.BufferHelper.bufferInfo(v,z,Math.max(Y.nextStart,N.maxBufferHole))}return Y},o.getMaxBufferLength=function(v){var T=this.config,N;return v?N=Math.max(8*T.maxBufferSize/v,T.maxBufferLength):N=T.maxBufferLength,Math.min(N,T.maxMaxBufferLength)},o.reduceMaxBufferLength=function(v){var T=this.config,N=v||T.maxBufferLength;return T.maxMaxBufferLength>=N?(T.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+T.maxMaxBufferLength+"s"),!0):!1},o.getNextFragment=function(v,T){var N,z,Y=T.fragments,ee=Y.length;if(!ee)return null;var G=this.config,j=Y[0].start,te;if(T.live){var de=G.initialLiveManifestSize;if(ee<de)return this.warn("Not enough fragments to start playback (have: "+ee+", need: "+de+")"),null;!T.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(te=this.getInitialLiveFragment(T,Y),this.startPosition=te?this.hls.liveSyncPosition||te.start:v)}else v<=j&&(te=Y[0]);if(!te){var be=G.lowLatencyMode?T.partEnd:T.fragmentEnd;te=this.getFragmentAtPosition(v,be,T)}return(N=te)!==null&&N!==void 0&&N.initSegment&&!((z=te)!==null&&z!==void 0&&z.initSegment.data)&&!this.bitrateTest&&(te=te.initSegment),te},o.getNextPart=function(v,T,N){for(var z=-1,Y=!1,ee=!0,G=0,j=v.length;G<j;G++){var te=v[G];if(ee=ee&&!te.independent,z>-1&&N<te.start)break;var de=te.loaded;!de&&(Y||te.independent||ee)&&te.fragment===T&&(z=G),Y=de}return z},o.loadedEndOfParts=function(v,T){var N=v[v.length-1];return N&&T>N.start&&N.loaded},o.getInitialLiveFragment=function(v,T){var N=this.fragPrevious,z=null;if(N){if(v.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+N.programDateTime),z=Object(O.findFragmentByPDT)(T,N.endProgramDateTime,this.config.maxFragLookUpTolerance)),!z){var Y=N.sn+1;if(Y>=v.startSN&&Y<=v.endSN){var ee=T[Y-v.startSN];N.cc===ee.cc&&(z=ee,this.log("Live playlist, switching playlist, load frag with next SN: "+z.sn))}z||(z=Object(O.findFragWithCC)(T,N.cc),z&&this.log("Live playlist, switching playlist, load frag with same CC: "+z.sn))}}else{var G=this.hls.liveSyncPosition;G!==null&&(z=this.getFragmentAtPosition(G,this.bitrateTest?v.fragmentEnd:v.edge,v))}return z},o.getFragmentAtPosition=function(v,T,N){var z=this.config,Y=this.fragPrevious,ee=N.fragments,G=N.endSN,j=N.fragmentHint,te=z.maxFragLookUpTolerance,de=!!(z.lowLatencyMode&&N.partList&&j);de&&j&&!this.bitrateTest&&(ee=ee.concat(j),G=j.sn);var be;if(v<T){var Oe=v>T-te?0:te;be=Object(O.findFragmentByPTS)(Y,ee,v,Oe)}else be=ee[ee.length-1];if(be){var Ge=be.sn-N.startSN,Me=Y&&be.level===Y.level,Ie=ee[Ge+1],Ue=this.fragmentTracker.getState(be);if(Ue===P.FragmentState.BACKTRACKED){be=null;for(var Pe=Ge;ee[Pe]&&this.fragmentTracker.getState(ee[Pe])===P.FragmentState.BACKTRACKED;)Y?be=ee[Pe--]:be=ee[--Pe];be||(be=Ie)}else Y&&be.sn===Y.sn&&!de&&(Me&&(be.sn<G&&this.fragmentTracker.getState(Ie)!==P.FragmentState.OK?(this.log("SN "+be.sn+" just loaded, load next one: "+Ie.sn),be=Ie):be=null))}return be},o.synchronizeToLiveEdge=function(v){var T=this.config,N=this.media;if(!N)return;var z=this.hls.liveSyncPosition,Y=N.currentTime,ee=v.fragments[0].start,G=v.edge,j=Y>=ee-T.maxFragLookUpTolerance&&Y<=G;if(z!==null&&N.duration>z&&(Y<z||!j)){var te=T.liveMaxLatencyDuration!==void 0?T.liveMaxLatencyDuration:T.liveMaxLatencyDurationCount*v.targetduration;(!j&&N.readyState<4||Y<G-te)&&(this.loadedmetadata||(this.nextLoadPosition=z),N.readyState&&(this.warn("Playback: "+Y.toFixed(3)+" is located too far from the end of live sliding playlist: "+G+", reset currentTime to : "+z.toFixed(3)),N.currentTime=z))}},o.alignPlaylists=function(v,T){var N=this.levels,z=this.levelLastLoaded,Y=this.fragPrevious,ee=z!==null?N[z]:null,G=v.fragments.length;if(!G)return this.warn("No fragments in live playlist"),0;var j=v.fragments[0].start,te=!T,de=v.alignedSliding&&Object(K.isFiniteNumber)(j);if(te||!de&&!j){Object(_.alignStream)(Y,ee,v);var be=v.fragments[0].start;return this.log("Live playlist sliding: "+be.toFixed(2)+" start-sn: "+(T?T.startSN:"na")+"->"+v.startSN+" prev-sn: "+(Y?Y.sn:"na")+" fragments: "+G),be}return j},o.waitForCdnTuneIn=function(v){var T=3;return v.live&&v.canBlockReload&&v.tuneInGoal>Math.max(v.partHoldBack,v.partTarget*T)},o.setStartPosition=function(v,T){var N=this.startPosition;if(N<T&&(N=-1),N===-1||this.lastCurrentTime===-1){var z=v.startTimeOffset;Object(K.isFiniteNumber)(z)?(N=T+z,z<0&&(N+=v.totalduration),N=Math.min(Math.max(T,N),T+v.totalduration),this.log("Start time offset "+z+" found in playlist, adjust startPosition to "+N),this.startPosition=N):v.live?N=this.hls.liveSyncPosition||T:this.startPosition=N=0,this.lastCurrentTime=N}this.nextLoadPosition=N},o.getLoadPosition=function(){var v=this.media,T=0;return this.loadedmetadata&&v?T=v.currentTime:this.nextLoadPosition&&(T=this.nextLoadPosition),T},o.handleFragLoadAborted=function(v,T){this.transmuxer&&v.sn!=="initSegment"&&v.stats.aborted&&(this.warn("Fragment "+v.sn+(T?" part"+T.index:"")+" of level "+v.level+" was aborted"),this.resetFragmentLoading(v))},o.resetFragmentLoading=function(v){(!this.fragCurrent||!this.fragContextChanged(v))&&(this.state=x.IDLE)},o.onFragmentOrKeyLoadError=function(v,T){if(T.fatal)return;var N=T.frag;if(!N||N.type!==v)return;var z=this.fragCurrent;console.assert(z&&N.sn===z.sn&&N.level===z.level&&N.urlId===z.urlId,"Frag load error must match current frag to retry");var Y=this.config;if(this.fragLoadError+1<=Y.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(N.level))return;var ee=Math.min(Math.pow(2,this.fragLoadError)*Y.fragLoadingRetryDelay,Y.fragLoadingMaxRetryTimeout);this.warn("Fragment "+N.sn+" of "+v+" "+N.level+" failed to load, retrying in "+ee+"ms"),this.retryDate=self.performance.now()+ee,this.fragLoadError++,this.state=x.FRAG_LOADING_WAITING_RETRY}else T.levelRetry?(v===s.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=x.IDLE):(W.logger.error(T.details+" reaches max retry, redispatch as fatal ..."),T.fatal=!0,this.hls.stopLoad(),this.state=x.ERROR)},o.afterBufferFlushed=function(v,T,N){if(!v)return;var z=H.BufferHelper.getBuffered(v);this.fragmentTracker.detectEvictedFragments(T,z,N),this.state===x.ENDED&&this.resetLoadingState()},o.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=x.IDLE},o.resetLiveStartWhenNotLoaded=function(v){if(!this.loadedmetadata){this.startFragRequested=!1;var T=this.levels?this.levels[v].details:null;if(T!=null&&T.live)return this.startPosition=-1,this.setStartPosition(T,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},o.updateLevelTiming=function(v,T,N,z){var Y=this,ee=N.details;console.assert(!!ee,"level.details must be defined");var G=Object.keys(v.elementaryStreams).reduce(function(j,te){var de=v.elementaryStreams[te];if(de){var be=de.endPTS-de.startPTS;if(be<=0)return Y.warn("Could not parse fragment "+v.sn+" "+te+" duration reliably ("+be+") resetting transmuxer to fallback to playlist timing"),Y.resetTransmuxer(),j||!1;var Oe=z?0:Object(L.updateFragPTSDTS)(ee,v,de.startPTS,de.endPTS,de.startDTS,de.endDTS);return Y.hls.trigger(I.Events.LEVEL_PTS_UPDATED,{details:ee,level:N,drift:Oe,type:te,frag:v,start:de.startPTS,end:de.endPTS}),!0}return j},!1);G?(this.state=x.PARSED,this.hls.trigger(I.Events.FRAG_PARSED,{frag:v,part:T})):this.resetLoadingState()},o.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},E(c,[{key:"state",get:function(){return this._state},set:function(v){var T=this._state;T!==v&&(this._state=v,this.log(T+"->"+v))}}]),c}(w.default)},"./src/controller/buffer-controller.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"default",function(){return O});var K=D("./src/polyfills/number.ts"),w=D("./src/events.ts"),P=D("./src/utils/logger.ts"),H=D("./src/errors.ts"),W=D("./src/utils/buffer-helper.ts"),I=D("./src/utils/mediasource-helper.ts"),M=D("./src/loader/fragment.ts"),b=D("./src/controller/buffer-operation-queue.ts"),A=Object(I.getMediaSource)(),_=/([ha]vc.)(?:\.[^.,]+)+/,O=function(){function L(u){var a=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var s=a.hls,d=a.media,E=a.mediaSource;P.logger.log("[buffer-controller]: Media source opened"),d&&(a.updateMediaElementDuration(),s.trigger(w.Events.MEDIA_ATTACHED,{media:d})),E&&E.removeEventListener("sourceopen",a._onMediaSourceOpen),a.checkPendingTracks()},this._onMediaSourceClose=function(){P.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){P.logger.log("[buffer-controller]: Media source ended")},this.hls=u,this._initSourceBuffer(),this.registerListeners()}var y=L.prototype;return y.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},y.destroy=function(){this.unregisterListeners(),this.details=null},y.registerListeners=function(){var a=this.hls;a.on(w.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),a.on(w.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.on(w.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.on(w.Events.BUFFER_RESET,this.onBufferReset,this),a.on(w.Events.BUFFER_APPENDING,this.onBufferAppending,this),a.on(w.Events.BUFFER_CODECS,this.onBufferCodecs,this),a.on(w.Events.BUFFER_EOS,this.onBufferEos,this),a.on(w.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),a.on(w.Events.LEVEL_UPDATED,this.onLevelUpdated,this),a.on(w.Events.FRAG_PARSED,this.onFragParsed,this),a.on(w.Events.FRAG_CHANGED,this.onFragChanged,this)},y.unregisterListeners=function(){var a=this.hls;a.off(w.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),a.off(w.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.off(w.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.off(w.Events.BUFFER_RESET,this.onBufferReset,this),a.off(w.Events.BUFFER_APPENDING,this.onBufferAppending,this),a.off(w.Events.BUFFER_CODECS,this.onBufferCodecs,this),a.off(w.Events.BUFFER_EOS,this.onBufferEos,this),a.off(w.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),a.off(w.Events.LEVEL_UPDATED,this.onLevelUpdated,this),a.off(w.Events.FRAG_PARSED,this.onFragParsed,this),a.off(w.Events.FRAG_CHANGED,this.onFragChanged,this)},y._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new b.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},y.onManifestParsed=function(a,s){var d=2;(s.audio&&!s.video||!s.altAudio)&&(d=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=d,this.details=null,P.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},y.onMediaAttaching=function(a,s){var d=this.media=s.media;if(d&&A){var E=this.mediaSource=new A;E.addEventListener("sourceopen",this._onMediaSourceOpen),E.addEventListener("sourceended",this._onMediaSourceEnded),E.addEventListener("sourceclose",this._onMediaSourceClose),d.src=self.URL.createObjectURL(E),this._objectUrl=d.src}},y.onMediaDetaching=function(){var a=this.media,s=this.mediaSource,d=this._objectUrl;if(s){if(P.logger.log("[buffer-controller]: media source detaching"),s.readyState==="open")try{s.endOfStream()}catch(E){P.logger.warn("[buffer-controller]: onMediaDetaching: "+E.message+" while calling endOfStream")}this.onBufferReset(),s.removeEventListener("sourceopen",this._onMediaSourceOpen),s.removeEventListener("sourceended",this._onMediaSourceEnded),s.removeEventListener("sourceclose",this._onMediaSourceClose),a&&(d&&self.URL.revokeObjectURL(d),a.src===d?(a.removeAttribute("src"),a.load()):P.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(w.Events.MEDIA_DETACHED,void 0)},y.onBufferReset=function(){var a=this;this.getSourceBufferTypes().forEach(function(s){var d=a.sourceBuffer[s];try{d&&(a.removeBufferListeners(s),a.mediaSource&&a.mediaSource.removeSourceBuffer(d),a.sourceBuffer[s]=void 0)}catch(E){P.logger.warn("[buffer-controller]: Failed to reset the "+s+" buffer",E)}}),this._initSourceBuffer()},y.onBufferCodecs=function(a,s){var d=this,E=this.getSourceBufferTypes().length;if(Object.keys(s).forEach(function(g){if(E){var m=d.tracks[g];if(m&&typeof m.buffer.changeType=="function"){var k=s[g],x=k.codec,h=k.levelCodec,p=k.container,c=(m.levelCodec||m.codec).replace(_,"$1"),o=(h||x).replace(_,"$1");if(c!==o){var S=p+";codecs="+(h||x);d.appendChangeType(g,S)}}}else d.pendingTracks[g]=s[g]}),E)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},y.appendChangeType=function(a,s){var d=this,E=this.operationQueue,g={execute:function(){var k=d.sourceBuffer[a];k&&(P.logger.log("[buffer-controller]: changing "+a+" sourceBuffer type to "+s),k.changeType(s)),E.shiftAndExecuteNext(a)},onStart:function(){},onComplete:function(){},onError:function(k){P.logger.warn("[buffer-controller]: Failed to change "+a+" SourceBuffer type",k)}};E.append(g,a)},y.onBufferAppending=function(a,s){var d=this,E=this.hls,g=this.operationQueue,m=this.tracks,k=s.data,x=s.type,h=s.frag,p=s.part,c=s.chunkMeta,o=c.buffering[x],S=self.performance.now();o.start=S;var v=h.stats.buffering,T=p?p.stats.buffering:null;v.start===0&&(v.start=S),T&&T.start===0&&(T.start=S);var N=m.audio,z=x==="audio"&&c.id===1&&(N==null?void 0:N.container)==="audio/mpeg",Y={execute:function(){if(o.executeStart=self.performance.now(),z){var G=d.sourceBuffer[x];if(G){var j=h.start-G.timestampOffset;Math.abs(j)>=.1&&(P.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+h.start+" (delta: "+j+") sn: "+h.sn+")"),G.timestampOffset=h.start)}}d.appendExecutor(k,x)},onStart:function(){},onComplete:function(){var G=self.performance.now();o.executeEnd=o.end=G,v.first===0&&(v.first=G),T&&T.first===0&&(T.first=G);var j=d.sourceBuffer,te={};for(var de in j)te[de]=W.BufferHelper.getBuffered(j[de]);d.appendError=0,d.hls.trigger(w.Events.BUFFER_APPENDED,{type:x,frag:h,part:p,chunkMeta:c,parent:h.type,timeRanges:te})},onError:function(G){P.logger.error("[buffer-controller]: Error encountered while trying to append to the "+x+" SourceBuffer",G);var j={type:H.ErrorTypes.MEDIA_ERROR,parent:h.type,details:H.ErrorDetails.BUFFER_APPEND_ERROR,err:G,fatal:!1};G.code===DOMException.QUOTA_EXCEEDED_ERR?j.details=H.ErrorDetails.BUFFER_FULL_ERROR:(d.appendError++,j.details=H.ErrorDetails.BUFFER_APPEND_ERROR,d.appendError>E.config.appendErrorMaxRetry&&(P.logger.error("[buffer-controller]: Failed "+E.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),j.fatal=!0)),E.trigger(w.Events.ERROR,j)}};g.append(Y,x)},y.onBufferFlushing=function(a,s){var d=this,E=this.operationQueue,g=function(k){return{execute:d.removeExecutor.bind(d,k,s.startOffset,s.endOffset),onStart:function(){},onComplete:function(){d.hls.trigger(w.Events.BUFFER_FLUSHED,{type:k})},onError:function(h){P.logger.warn("[buffer-controller]: Failed to remove from "+k+" SourceBuffer",h)}}};s.type?E.append(g(s.type),s.type):this.getSourceBufferTypes().forEach(function(m){E.append(g(m),m)})},y.onFragParsed=function(a,s){var d=this,E=s.frag,g=s.part,m=[],k=g?g.elementaryStreams:E.elementaryStreams;k[M.ElementaryStreamTypes.AUDIOVIDEO]?m.push("audiovideo"):(k[M.ElementaryStreamTypes.AUDIO]&&m.push("audio"),k[M.ElementaryStreamTypes.VIDEO]&&m.push("video"));var x=function(){var p=self.performance.now();E.stats.buffering.end=p,g&&(g.stats.buffering.end=p);var c=g?g.stats:E.stats;d.hls.trigger(w.Events.FRAG_BUFFERED,{frag:E,part:g,stats:c,id:E.type})};m.length===0&&P.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+E.type+" level: "+E.level+" sn: "+E.sn),this.blockBuffers(x,m)},y.onFragChanged=function(a,s){this.flushBackBuffer()},y.onBufferEos=function(a,s){var d=this,E=this.getSourceBufferTypes().reduce(function(g,m){var k=d.sourceBuffer[m];return(!s.type||s.type===m)&&(k&&!k.ended&&(k.ended=!0,P.logger.log("[buffer-controller]: "+m+" sourceBuffer now EOS"))),g&&!!(!k||k.ended)},!0);E&&this.blockBuffers(function(){var g=d.mediaSource;if(!g||g.readyState!=="open")return;g.endOfStream()})},y.onLevelUpdated=function(a,s){var d=s.details;if(!d.fragments.length)return;this.details=d,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},y.flushBackBuffer=function(){var a=this.hls,s=this.details,d=this.media,E=this.sourceBuffer;if(!d||s===null)return;var g=this.getSourceBufferTypes();if(!g.length)return;var m=s.live&&a.config.liveBackBufferLength!==null?a.config.liveBackBufferLength:a.config.backBufferLength;if(!Object(K.isFiniteNumber)(m)||m<0)return;var k=d.currentTime,x=s.levelTargetDuration,h=Math.max(m,x),p=Math.floor(k/x)*x-h;g.forEach(function(c){var o=E[c];if(o){var S=W.BufferHelper.getBuffered(o);S.length>0&&p>S.start(0)&&(a.trigger(w.Events.BACK_BUFFER_REACHED,{bufferEnd:p}),s.live&&a.trigger(w.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:p}),a.trigger(w.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:p,type:c}))}})},y.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var a=this.details,s=this.hls,d=this.media,E=this.mediaSource,g=a.fragments[0].start+a.totalduration,m=d.duration,k=Object(K.isFiniteNumber)(E.duration)?E.duration:0;a.live&&s.config.liveDurationInfinity?(P.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),E.duration=Infinity,this.updateSeekableRange(a)):(g>k&&g>m||!Object(K.isFiniteNumber)(m))&&(P.logger.log("[buffer-controller]: Updating Media Source duration to "+g.toFixed(3)),E.duration=g)},y.updateSeekableRange=function(a){var s=this.mediaSource,d=a.fragments,E=d.length;if(E&&a.live&&s!==null&&s!==void 0&&s.setLiveSeekableRange){var g=Math.max(0,d[0].start),m=Math.max(g,g+a.totalduration);s.setLiveSeekableRange(g,m)}},y.checkPendingTracks=function(){var a=this.bufferCodecEventsExpected,s=this.operationQueue,d=this.pendingTracks,E=Object.keys(d).length;if(E&&!a||E===2){this.createSourceBuffers(d),this.pendingTracks={};var g=this.getSourceBufferTypes();if(g.length===0){this.hls.trigger(w.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}g.forEach(function(m){s.executeNext(m)})}},y.createSourceBuffers=function(a){var s=this.sourceBuffer,d=this.mediaSource;if(!d)throw Error("createSourceBuffers called when mediaSource was null");var E=0;for(var g in a)if(!s[g]){var m=a[g];if(!m)throw Error("source buffer exists for track "+g+", however track does not");var k=m.levelCodec||m.codec,x=m.container+";codecs="+k;P.logger.log("[buffer-controller]: creating sourceBuffer("+x+")");try{var h=s[g]=d.addSourceBuffer(x),p=g;this.addBufferListener(p,"updatestart",this._onSBUpdateStart),this.addBufferListener(p,"updateend",this._onSBUpdateEnd),this.addBufferListener(p,"error",this._onSBUpdateError),this.tracks[g]={buffer:h,codec:k,container:m.container,levelCodec:m.levelCodec,id:m.id},E++}catch(c){P.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+c.message),this.hls.trigger(w.Events.ERROR,{type:H.ErrorTypes.MEDIA_ERROR,details:H.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:c,mimeType:x})}}E&&this.hls.trigger(w.Events.BUFFER_CREATED,{tracks:this.tracks})},y._onSBUpdateStart=function(a){var s=this.operationQueue,d=s.current(a);d.onStart()},y._onSBUpdateEnd=function(a){var s=this.operationQueue,d=s.current(a);d.onComplete(),s.shiftAndExecuteNext(a)},y._onSBUpdateError=function(a,s){P.logger.error("[buffer-controller]: "+a+" SourceBuffer error",s),this.hls.trigger(w.Events.ERROR,{type:H.ErrorTypes.MEDIA_ERROR,details:H.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var d=this.operationQueue.current(a);d&&d.onError(s)},y.removeExecutor=function(a,s,d){var E=this.media,g=this.mediaSource,m=this.operationQueue,k=this.sourceBuffer,x=k[a];if(!E||!g||!x){P.logger.warn("[buffer-controller]: Attempting to remove from the "+a+" SourceBuffer, but it does not exist"),m.shiftAndExecuteNext(a);return}var h=Object(K.isFiniteNumber)(E.duration)?E.duration:Infinity,p=Object(K.isFiniteNumber)(g.duration)?g.duration:Infinity,c=Math.max(0,s),o=Math.min(d,h,p);o>c?(P.logger.log("[buffer-controller]: Removing ["+c+","+o+"] from the "+a+" SourceBuffer"),console.assert(!x.updating,a+" sourceBuffer must not be updating"),x.remove(c,o)):m.shiftAndExecuteNext(a)},y.appendExecutor=function(a,s){var d=this.operationQueue,E=this.sourceBuffer,g=E[s];if(!g){P.logger.warn("[buffer-controller]: Attempting to append to the "+s+" SourceBuffer, but it does not exist"),d.shiftAndExecuteNext(s);return}g.ended=!1,console.assert(!g.updating,s+" sourceBuffer must not be updating"),g.appendBuffer(a)},y.blockBuffers=function(a,s){var d=this;if(s===void 0&&(s=this.getSourceBufferTypes()),!s.length){P.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(a);return}var E=this.operationQueue,g=s.map(function(m){return E.appendBlocker(m)});Promise.all(g).then(function(){a(),s.forEach(function(m){var k=d.sourceBuffer[m];(!k||!k.updating)&&E.shiftAndExecuteNext(m)})})},y.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},y.addBufferListener=function(a,s,d){var E=this.sourceBuffer[a];if(!E)return;var g=d.bind(this,a);this.listeners[a].push({event:s,listener:g}),E.addEventListener(s,g)},y.removeBufferListeners=function(a){var s=this.sourceBuffer[a];if(!s)return;this.listeners[a].forEach(function(d){s.removeEventListener(d.event,d.listener)})},L}()},"./src/controller/buffer-operation-queue.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"default",function(){return w});var K=D("./src/utils/logger.ts"),w=function(){function P(W){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=W}var H=P.prototype;return H.append=function(I,M){var b=this.queues[M];b.push(I),b.length===1&&this.buffers[M]&&this.executeNext(M)},H.insertAbort=function(I,M){var b=this.queues[M];b.unshift(I),this.executeNext(M)},H.appendBlocker=function(I){var M,b=new Promise(function(_){M=_}),A={execute:M,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(A,I),b},H.executeNext=function(I){var M=this.buffers,b=this.queues,A=M[I],_=b[I];if(_.length){var O=_[0];try{O.execute()}catch(L){K.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),O.onError(L),(!A||!A.updating)&&(_.shift(),this.executeNext(I))}}},H.shiftAndExecuteNext=function(I){this.queues[I].shift(),this.executeNext(I)},H.current=function(I){return this.queues[I][0]},P}()},"./src/controller/cap-level-controller.ts":function(ae,X,D){"use strict";D.r(X);var K=D("./src/events.ts");function w(W,I){for(var M=0;M<I.length;M++){var b=I[M];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(W,b.key,b)}}function P(W,I,M){return I&&w(W.prototype,I),M&&w(W,M),W}var H=function(){function W(M){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=M,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var I=W.prototype;return I.setStreamController=function(b){this.streamController=b},I.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},I.registerListeners=function(){var b=this.hls;b.on(K.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),b.on(K.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),b.on(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),b.on(K.Events.BUFFER_CODECS,this.onBufferCodecs,this),b.on(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},I.unregisterListener=function(){var b=this.hls;b.off(K.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),b.off(K.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),b.off(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),b.off(K.Events.BUFFER_CODECS,this.onBufferCodecs,this),b.off(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},I.onFpsDropLevelCapping=function(b,A){W.isLevelAllowed(A.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(A.droppedLevel)},I.onMediaAttaching=function(b,A){this.media=A.media instanceof HTMLVideoElement?A.media:null},I.onManifestParsed=function(b,A){var _=this.hls;this.restrictedLevels=[],this.firstLevel=A.firstLevel,_.config.capLevelToPlayerSize&&A.video&&this.startCapping()},I.onBufferCodecs=function(b,A){var _=this.hls;_.config.capLevelToPlayerSize&&A.video&&this.startCapping()},I.onMediaDetaching=function(){this.stopCapping()},I.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var b=this.hls.levels;if(b.length){var A=this.hls;A.autoLevelCapping=this.getMaxLevel(b.length-1),A.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=A.autoLevelCapping}}},I.getMaxLevel=function(b){var A=this,_=this.hls.levels;if(!_.length)return-1;var O=_.filter(function(L,y){return W.isLevelAllowed(y,A.restrictedLevels)&&y<=b});return this.clientRect=null,W.getMaxLevelByMediaSize(O,this.mediaWidth,this.mediaHeight)},I.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()},I.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},I.getDimensions=function(){if(this.clientRect)return this.clientRect;var b=this.media,A={width:0,height:0};if(b){var _=b.getBoundingClientRect();A.width=_.width,A.height=_.height,!A.width&&!A.height&&(A.width=_.right-_.left||b.width||0,A.height=_.bottom-_.top||b.height||0)}return this.clientRect=A,A},W.isLevelAllowed=function(b,A){return A===void 0&&(A=[]),A.indexOf(b)===-1},W.getMaxLevelByMediaSize=function(b,A,_){if(!b||!b.length)return-1;for(var O=function(s,d){return d?s.width!==d.width||s.height!==d.height:!0},L=b.length-1,y=0;y<b.length;y+=1){var u=b[y];if((u.width>=A||u.height>=_)&&O(u,b[y+1])){L=y;break}}return L},P(W,[{key:"mediaWidth",get:function(){return this.getDimensions().width*W.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*W.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var b=1;try{b=self.devicePixelRatio}catch(A){}return b}}]),W}();X.default=H},"./src/controller/cmcd-controller.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"default",function(){return O});var K=D("./src/events.ts"),w=D("./src/types/cmcd.ts"),P=D("./src/utils/buffer-helper.ts"),H=D("./src/utils/logger.ts");function W(L,y){for(var u=0;u<y.length;u++){var a=y[u];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(L,a.key,a)}}function I(L,y,u){return y&&W(L.prototype,y),u&&W(L,u),L}function M(L,y){var u=typeof Symbol!="undefined"&&L[Symbol.iterator]||L["@@iterator"];if(u)return(u=u.call(L)).next.bind(u);if(Array.isArray(L)||(u=b(L))||y&&L&&typeof L.length=="number"){u&&(L=u);var a=0;return function(){return a>=L.length?{done:!0}:{done:!1,value:L[a++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function b(L,y){if(!L)return;if(typeof L=="string")return A(L,y);var u=Object.prototype.toString.call(L).slice(8,-1);if(u==="Object"&&L.constructor&&(u=L.constructor.name),u==="Map"||u==="Set")return Array.from(L);if(u==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(u))return A(L,y)}function A(L,y){(y==null||y>L.length)&&(y=L.length);for(var u=0,a=new Array(y);u<y;u++)a[u]=L[u];return a}function _(){return _=Object.assign||function(L){for(var y=1;y<arguments.length;y++){var u=arguments[y];for(var a in u)Object.prototype.hasOwnProperty.call(u,a)&&(L[a]=u[a])}return L},_.apply(this,arguments)}var O=function(){function L(u){var a=this;this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){a.initialized&&(a.starved=!0),a.buffering=!0},this.onPlaying=function(){a.initialized||(a.initialized=!0),a.buffering=!1},this.applyPlaylistData=function(E){try{a.apply(E,{ot:w.CMCDObjectType.MANIFEST,su:!a.initialized})}catch(g){H.logger.warn("Could not generate manifest CMCD data.",g)}},this.applyFragmentData=function(E){try{var g=E.frag,m=a.hls.levels[g.level],k=a.getObjectType(g),x={d:g.duration*1e3,ot:k};(k===w.CMCDObjectType.VIDEO||k===w.CMCDObjectType.AUDIO||k==w.CMCDObjectType.MUXED)&&(x.br=m.bitrate/1e3,x.tb=a.getTopBandwidth(k),x.bl=a.getBufferLength(k)),a.apply(E,x)}catch(h){H.logger.warn("Could not generate segment CMCD data.",h)}},this.hls=u;var s=this.config=u.config,d=s.cmcd;d!=null&&(s.pLoader=this.createPlaylistLoader(),s.fLoader=this.createFragmentLoader(),this.sid=d.sessionId||L.uuid(),this.cid=d.contentId,this.useHeaders=d.useHeaders===!0,this.registerListeners())}var y=L.prototype;return y.registerListeners=function(){var a=this.hls;a.on(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.on(K.Events.MEDIA_DETACHED,this.onMediaDetached,this),a.on(K.Events.BUFFER_CREATED,this.onBufferCreated,this)},y.unregisterListeners=function(){var a=this.hls;a.off(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.off(K.Events.MEDIA_DETACHED,this.onMediaDetached,this),a.off(K.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},y.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},y.onMediaAttached=function(a,s){this.media=s.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},y.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},y.onBufferCreated=function(a,s){var d,E;this.audioBuffer=(d=s.tracks.audio)===null||d===void 0?void 0:d.buffer,this.videoBuffer=(E=s.tracks.video)===null||E===void 0?void 0:E.buffer},y.createData=function(){var a;return{v:w.CMCDVersion,sf:w.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(a=this.media)===null||a===void 0?void 0:a.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},y.apply=function(a,s){s===void 0&&(s={}),_(s,this.createData());var d=s.ot===w.CMCDObjectType.INIT||s.ot===w.CMCDObjectType.VIDEO||s.ot===w.CMCDObjectType.MUXED;if(this.starved&&d&&(s.bs=!0,s.su=!0,this.starved=!1),s.su==null&&(s.su=this.buffering),this.useHeaders){var E=L.toHeaders(s);if(!Object.keys(E).length)return;a.headers||(a.headers={}),_(a.headers,E)}else{var g=L.toQuery(s);if(!g)return;a.url=L.appendQueryToUri(a.url,g)}},y.getObjectType=function(a){var s=a.type;return s==="subtitle"?w.CMCDObjectType.TIMED_TEXT:a.sn==="initSegment"?w.CMCDObjectType.INIT:s==="audio"?w.CMCDObjectType.AUDIO:s==="main"?this.hls.audioTracks.length?w.CMCDObjectType.VIDEO:w.CMCDObjectType.MUXED:void 0},y.getTopBandwidth=function(a){for(var s=0,d=a===w.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,E=M(d),g;!(g=E()).done;){var m=g.value;m.bitrate>s&&(s=m.bitrate)}return s>0?s:NaN},y.getBufferLength=function(a){var s=this.hls.media,d=a===w.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!d||!s)return NaN;var E=P.BufferHelper.bufferInfo(d,s.currentTime,this.config.maxBufferHole);return E.len*1e3},y.createPlaylistLoader=function(){var a=this.config.pLoader,s=this.applyPlaylistData,d=a||this.config.loader;return function(){function E(m){this.loader=void 0,this.loader=new d(m)}var g=E.prototype;return g.destroy=function(){this.loader.destroy()},g.abort=function(){this.loader.abort()},g.load=function(k,x,h){s(k),this.loader.load(k,x,h)},I(E,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),E}()},y.createFragmentLoader=function(){var a=this.config.fLoader,s=this.applyFragmentData,d=a||this.config.loader;return function(){function E(m){this.loader=void 0,this.loader=new d(m)}var g=E.prototype;return g.destroy=function(){this.loader.destroy()},g.abort=function(){this.loader.abort()},g.load=function(k,x,h){s(k),this.loader.load(k,x,h)},I(E,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),E}()},L.uuid=function(){var a=URL.createObjectURL(new Blob),s=a.toString();return URL.revokeObjectURL(a),s.substr(s.lastIndexOf("/")+1)},L.serialize=function(a){for(var s=[],d=function(z){return!Number.isNaN(z)&&z!=null&&z!==""&&z!==!1},E=function(z){return Math.round(z)},g=function(z){return E(z/100)*100},m=function(z){return encodeURIComponent(z)},k={br:E,d:E,bl:g,dl:g,mtp:g,nor:m,rtp:g,tb:E},x=Object.keys(a||{}).sort(),h=M(x),p;!(p=h()).done;){var c=p.value,o=a[c];if(!d(o))continue;if(c==="v"&&o===1)continue;if(c=="pr"&&o===1)continue;var S=k[c];S&&(o=S(o));var v=typeof o,T=void 0;c==="ot"||c==="sf"||c==="st"?T=c+"="+o:v==="boolean"?T=c:v==="number"?T=c+"="+o:T=c+"="+JSON.stringify(o),s.push(T)}return s.join(",")},L.toHeaders=function(a){for(var s=Object.keys(a),d={},E=["Object","Request","Session","Status"],g=[{},{},{},{}],m={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},k=0,x=s;k<x.length;k++){var h=x[k],p=m[h]!=null?m[h]:1;g[p][h]=a[h]}for(var c=0;c<g.length;c++){var o=L.serialize(g[c]);o&&(d["CMCD-"+E[c]]=o)}return d},L.toQuery=function(a){return"CMCD="+encodeURIComponent(L.serialize(a))},L.appendQueryToUri=function(a,s){if(!s)return a;var d=a.includes("?")?"&":"?";return""+a+d+s},L}()},"./src/controller/eme-controller.ts":function(ae,X,D){"use strict";D.r(X);var K=D("./src/events.ts"),w=D("./src/errors.ts"),P=D("./src/utils/logger.ts"),H=D("./src/utils/mediakeys-helper.ts");function W(O,L){for(var y=0;y<L.length;y++){var u=L[y];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(O,u.key,u)}}function I(O,L,y){return L&&W(O.prototype,L),y&&W(O,y),O}var M=3,b=function(L,y,u){var a={audioCapabilities:[],videoCapabilities:[]};return L.forEach(function(s){a.audioCapabilities.push({contentType:'audio/mp4; codecs="'+s+'"',robustness:u.audioRobustness||""})}),y.forEach(function(s){a.videoCapabilities.push({contentType:'video/mp4; codecs="'+s+'"',robustness:u.videoRobustness||""})}),[a]},A=function(L,y,u,a){switch(L){case H.KeySystems.WIDEVINE:return b(y,u,a);default:throw new Error("Unknown key-system: "+L)}},_=function(){function O(y){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=y,this._config=y.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 L=O.prototype;return L.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},L._registerListeners=function(){this.hls.on(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(K.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(K.Events.MANIFEST_PARSED,this.onManifestParsed,this)},L._unregisterListeners=function(){this.hls.off(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(K.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(K.Events.MANIFEST_PARSED,this.onManifestParsed,this)},L.getLicenseServerUrl=function(u){switch(u){case H.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+u+'"')},L._attemptKeySystemAccess=function(u,a,s){var d=this,E=A(u,a,s,this._drmSystemOptions);P.logger.log("Requesting encrypted media key-system access");var g=this.requestMediaKeySystemAccess(u,E);this.mediaKeysPromise=g.then(function(m){return d._onMediaKeySystemAccessObtained(u,m)}),g.catch(function(m){P.logger.error('Failed to obtain key-system "'+u+'" access:',m)})},L._onMediaKeySystemAccessObtained=function(u,a){var s=this;P.logger.log('Access for key-system "'+u+'" obtained');var d={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:a,mediaKeySystemDomain:u};this._mediaKeysList.push(d);var E=Promise.resolve().then(function(){return a.createMediaKeys()}).then(function(g){return d.mediaKeys=g,P.logger.log('Media-keys created for key-system "'+u+'"'),s._onMediaKeysCreated(),g});return E.catch(function(g){P.logger.error("Failed to create media-keys:",g)}),E},L._onMediaKeysCreated=function(){var u=this;this._mediaKeysList.forEach(function(a){a.mediaKeysSession||(a.mediaKeysSession=a.mediaKeys.createSession(),u._onNewMediaKeySession(a.mediaKeysSession))})},L._onNewMediaKeySession=function(u){var a=this;P.logger.log("New key-system session "+u.sessionId),u.addEventListener("message",function(s){a._onKeySessionMessage(u,s.message)},!1)},L._onKeySessionMessage=function(u,a){P.logger.log("Got EME message event, creating license request"),this._requestLicense(a,function(s){P.logger.log("Received license data (length: "+(s&&s.byteLength)+"), updating key-session"),u.update(s)})},L.onMediaEncrypted=function(u){var a=this;if(P.logger.log('Media is encrypted using "'+u.initDataType+'" init data type'),!this.mediaKeysPromise){P.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(K.Events.ERROR,{type:w.ErrorTypes.KEY_SYSTEM_ERROR,details:w.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var s=function(E){if(!a._media)return;a._attemptSetMediaKeys(E),a._generateRequestWithPreferredKeySession(u.initDataType,u.initData)};this.mediaKeysPromise.then(s).catch(s)},L._attemptSetMediaKeys=function(u){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var a=this._mediaKeysList[0];if(!a||!a.mediaKeys){P.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(K.Events.ERROR,{type:w.ErrorTypes.KEY_SYSTEM_ERROR,details:w.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}P.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(a.mediaKeys),this._hasSetMediaKeys=!0}},L._generateRequestWithPreferredKeySession=function(u,a){var s=this,d=this._mediaKeysList[0];if(!d){P.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(K.Events.ERROR,{type:w.ErrorTypes.KEY_SYSTEM_ERROR,details:w.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(d.mediaKeysSessionInitialized){P.logger.warn("Key-Session already initialized but requested again");return}var E=d.mediaKeysSession;if(!E){P.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(K.Events.ERROR,{type:w.ErrorTypes.KEY_SYSTEM_ERROR,details:w.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!a){P.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(K.Events.ERROR,{type:w.ErrorTypes.KEY_SYSTEM_ERROR,details:w.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}P.logger.log('Generating key-session request for "'+u+'" init data type'),d.mediaKeysSessionInitialized=!0,E.generateRequest(u,a).then(function(){P.logger.debug("Key-session generation succeeded")}).catch(function(g){P.logger.error("Error generating key-session request:",g),s.hls.trigger(K.Events.ERROR,{type:w.ErrorTypes.KEY_SYSTEM_ERROR,details:w.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},L._createLicenseXhr=function(u,a,s){var d=new XMLHttpRequest;d.responseType="arraybuffer",d.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,d,u,a,s);var E=this._licenseXhrSetup;if(E)try{E.call(this.hls,d,u),E=void 0}catch(g){P.logger.error(g)}try{d.readyState||d.open("POST",u,!0),E&&E.call(this.hls,d,u)}catch(g){throw new Error("issue setting up KeySystem license XHR "+g)}return d},L._onLicenseRequestReadyStageChange=function(u,a,s,d){switch(u.readyState){case 4:if(u.status===200){this._requestLicenseFailureCount=0,P.logger.log("License request succeeded");var E=u.response,g=this._licenseResponseCallback;if(g)try{E=g.call(this.hls,u,a)}catch(k){P.logger.error(k)}d(E)}else{if(P.logger.error("License Request XHR failed ("+a+"). Status: "+u.status+" ("+u.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>M){this.hls.trigger(K.Events.ERROR,{type:w.ErrorTypes.KEY_SYSTEM_ERROR,details:w.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var m=M-this._requestLicenseFailureCount+1;P.logger.warn("Retrying license request, "+m+" attempts left"),this._requestLicense(s,d)}break}},L._generateLicenseRequestChallenge=function(u,a){switch(u.mediaKeySystemDomain){case H.KeySystems.WIDEVINE:return a}throw new Error("unsupported key-system: "+u.mediaKeySystemDomain)},L._requestLicense=function(u,a){P.logger.log("Requesting content license for key-system");var s=this._mediaKeysList[0];if(!s){P.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(K.Events.ERROR,{type:w.ErrorTypes.KEY_SYSTEM_ERROR,details:w.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var d=this.getLicenseServerUrl(s.mediaKeySystemDomain),E=this._createLicenseXhr(d,u,a);P.logger.log("Sending license request to URL: "+d);var g=this._generateLicenseRequestChallenge(s,u);E.send(g)}catch(m){P.logger.error("Failure requesting DRM license: "+m),this.hls.trigger(K.Events.ERROR,{type:w.ErrorTypes.KEY_SYSTEM_ERROR,details:w.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},L.onMediaAttached=function(u,a){if(!this._emeEnabled)return;var s=a.media;this._media=s,s.addEventListener("encrypted",this._onMediaEncrypted)},L.onMediaDetached=function(){var u=this._media,a=this._mediaKeysList;if(!u)return;u.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(a.map(function(s){if(s.mediaKeysSession)return s.mediaKeysSession.close().catch(function(){})})).then(function(){return u.setMediaKeys(null)}).catch(function(){})},L.onManifestParsed=function(u,a){if(!this._emeEnabled)return;var s=a.levels.map(function(E){return E.audioCodec}).filter(function(E){return!!E}),d=a.levels.map(function(E){return E.videoCodec}).filter(function(E){return!!E});this._attemptKeySystemAccess(H.KeySystems.WIDEVINE,s,d)},I(O,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),O}();X.default=_},"./src/controller/fps-controller.ts":function(ae,X,D){"use strict";D.r(X);var K=D("./src/events.ts"),w=D("./src/utils/logger.ts"),P=function(){function H(I){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=I,this.registerListeners()}var W=H.prototype;return W.setStreamController=function(M){this.streamController=M},W.registerListeners=function(){this.hls.on(K.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},W.unregisterListeners=function(){this.hls.off(K.Events.MEDIA_ATTACHING,this.onMediaAttaching)},W.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},W.onMediaAttaching=function(M,b){var A=this.hls.config;if(A.capLevelOnFPSDrop){var _=b.media instanceof self.HTMLVideoElement?b.media:null;this.media=_,_&&typeof _.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),A.fpsDroppedMonitoringPeriod)}},W.checkFPS=function(M,b,A){var _=performance.now();if(b){if(this.lastTime){var O=_-this.lastTime,L=A-this.lastDroppedFrames,y=b-this.lastDecodedFrames,u=1e3*L/O,a=this.hls;if(a.trigger(K.Events.FPS_DROP,{currentDropped:L,currentDecoded:y,totalDroppedFrames:A}),u>0&&L>a.config.fpsDroppedMonitoringThreshold*y){var s=a.currentLevel;w.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+s),s>0&&(a.autoLevelCapping===-1||a.autoLevelCapping>=s)&&(s=s-1,a.trigger(K.Events.FPS_DROP_LEVEL_CAPPING,{level:s,droppedLevel:a.currentLevel}),a.autoLevelCapping=s,this.streamController.nextLevelSwitch())}}this.lastTime=_,this.lastDroppedFrames=A,this.lastDecodedFrames=b}},W.checkFPSInterval=function(){var M=this.media;if(M)if(this.isVideoPlaybackQualityAvailable){var b=M.getVideoPlaybackQuality();this.checkFPS(M,b.totalVideoFrames,b.droppedVideoFrames)}else this.checkFPS(M,M.webkitDecodedFrameCount,M.webkitDroppedFrameCount)},H}();X.default=P},"./src/controller/fragment-finders.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"findFragmentByPDT",function(){return P}),D.d(X,"findFragmentByPTS",function(){return H}),D.d(X,"fragmentWithinToleranceTest",function(){return W}),D.d(X,"pdtWithinToleranceTest",function(){return I}),D.d(X,"findFragWithCC",function(){return M});var K=D("./src/polyfills/number.ts"),w=D("./src/utils/binary-search.ts");function P(b,A,_){if(A===null||!Array.isArray(b)||!b.length||!Object(K.isFiniteNumber)(A))return null;var O=b[0].programDateTime;if(A<(O||0))return null;var L=b[b.length-1].endProgramDateTime;if(A>=(L||0))return null;_=_||0;for(var y=0;y<b.length;++y){var u=b[y];if(I(A,_,u))return u}return null}function H(b,A,_,O){_===void 0&&(_=0),O===void 0&&(O=0);var L=null;if(b?L=A[b.sn-A[0].sn+1]||null:_===0&&A[0].start===0&&(L=A[0]),L&&W(_,O,L)===0)return L;var y=w.default.search(A,W.bind(null,_,O));return y||L}function W(b,A,_){b===void 0&&(b=0),A===void 0&&(A=0);var O=Math.min(A,_.duration+(_.deltaPTS?_.deltaPTS:0));return _.start+_.duration-O<=b?1:_.start-O>b&&_.start?-1:0}function I(b,A,_){var O=Math.min(A,_.duration+(_.deltaPTS?_.deltaPTS:0))*1e3,L=_.endProgramDateTime||0;return L-O>b}function M(b,A){return w.default.search(b,function(_){return _.cc<A?1:_.cc>A?-1:0})}},"./src/controller/fragment-tracker.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"FragmentState",function(){return P}),D.d(X,"FragmentTracker",function(){return H});var K=D("./src/events.ts"),w=D("./src/types/loader.ts"),P;(function(M){M.NOT_LOADED="NOT_LOADED",M.BACKTRACKED="BACKTRACKED",M.APPENDING="APPENDING",M.PARTIAL="PARTIAL",M.OK="OK"})(P||(P={}));var H=function(){function M(A){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=A,this._registerListeners()}var b=M.prototype;return b._registerListeners=function(){var _=this.hls;_.on(K.Events.BUFFER_APPENDED,this.onBufferAppended,this),_.on(K.Events.FRAG_BUFFERED,this.onFragBuffered,this),_.on(K.Events.FRAG_LOADED,this.onFragLoaded,this)},b._unregisterListeners=function(){var _=this.hls;_.off(K.Events.BUFFER_APPENDED,this.onBufferAppended,this),_.off(K.Events.FRAG_BUFFERED,this.onFragBuffered,this),_.off(K.Events.FRAG_LOADED,this.onFragLoaded,this)},b.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},b.getAppendedFrag=function(_,O){if(O===w.PlaylistLevelType.MAIN){var L=this.activeFragment,y=this.activeParts;if(!L)return null;if(y)for(var u=y.length;u--;){var a=y[u],s=a?a.end:L.appendedPTS;if(a.start<=_&&s!==void 0&&_<=s)return u>9&&(this.activeParts=y.slice(u-9)),a}else if(L.start<=_&&L.appendedPTS!==void 0&&_<=L.appendedPTS)return L}return this.getBufferedFrag(_,O)},b.getBufferedFrag=function(_,O){for(var L=this.fragments,y=Object.keys(L),u=y.length;u--;){var a=L[y[u]];if((a==null?void 0:a.body.type)===O&&a.buffered){var s=a.body;if(s.start<=_&&_<=s.end)return s}}return null},b.detectEvictedFragments=function(_,O,L){var y=this;Object.keys(this.fragments).forEach(function(u){var a=y.fragments[u];if(!a)return;if(!a.buffered){a.body.type===L&&y.removeFragment(a.body);return}var s=a.range[_];if(!s)return;s.time.some(function(d){var E=!y.isTimeBuffered(d.startPTS,d.endPTS,O);return E&&y.removeFragment(a.body),E})})},b.detectPartialFragments=function(_){var O=this,L=this.timeRanges,y=_.frag,u=_.part;if(!L||y.sn==="initSegment")return;var a=I(y),s=this.fragments[a];if(!s)return;Object.keys(L).forEach(function(d){var E=y.elementaryStreams[d];if(!E)return;var g=L[d],m=u!==null||E.partial===!0;s.range[d]=O.getBufferedTimes(y,u,m,g)}),s.backtrack=s.loaded=null,Object.keys(s.range).length?s.buffered=!0:this.removeFragment(s.body)},b.fragBuffered=function(_){var O=I(_),L=this.fragments[O];L&&(L.backtrack=L.loaded=null,L.buffered=!0)},b.getBufferedTimes=function(_,O,L,y){for(var u={time:[],partial:L},a=O?O.start:_.start,s=O?O.end:_.end,d=_.minEndPTS||s,E=_.maxStartPTS||a,g=0;g<y.length;g++){var m=y.start(g)-this.bufferPadding,k=y.end(g)+this.bufferPadding;if(E>=m&&d<=k){u.time.push({startPTS:Math.max(a,y.start(g)),endPTS:Math.min(s,y.end(g))});break}else if(a<k&&s>m)u.partial=!0,u.time.push({startPTS:Math.max(a,y.start(g)),endPTS:Math.min(s,y.end(g))});else if(s<=m)break}return u},b.getPartialFragment=function(_){var O=null,L,y,u,a=0,s=this.bufferPadding,d=this.fragments;return Object.keys(d).forEach(function(E){var g=d[E];if(!g)return;W(g)&&(y=g.body.start-s,u=g.body.end+s,_>=y&&_<=u&&(L=Math.min(_-y,u-_),a<=L&&(O=g.body,a=L)))}),O},b.getState=function(_){var O=I(_),L=this.fragments[O];return L?L.buffered?W(L)?P.PARTIAL:P.OK:L.backtrack?P.BACKTRACKED:P.APPENDING:P.NOT_LOADED},b.backtrack=function(_,O){var L=I(_),y=this.fragments[L];if(!y||y.backtrack)return null;var u=y.backtrack=O||y.loaded;return y.loaded=null,u},b.getBacktrackData=function(_){var O=I(_),L=this.fragments[O];if(L){var y,u=L.backtrack;if(u!=null&&(y=u.payload)!==null&&y!==void 0&&y.byteLength)return u;this.removeFragment(_)}return null},b.isTimeBuffered=function(_,O,L){for(var y,u,a=0;a<L.length;a++){if(y=L.start(a)-this.bufferPadding,u=L.end(a)+this.bufferPadding,_>=y&&O<=u)return!0;if(O<=y)return!1}return!1},b.onFragLoaded=function(_,O){var L=O.frag,y=O.part;if(L.sn==="initSegment"||L.bitrateTest||y)return;var u=I(L);this.fragments[u]={body:L,loaded:O,backtrack:null,buffered:!1,range:Object.create(null)}},b.onBufferAppended=function(_,O){var L=this,y=O.frag,u=O.part,a=O.timeRanges;if(y.type===w.PlaylistLevelType.MAIN)if(this.activeFragment=y,u){var s=this.activeParts;s||(this.activeParts=s=[]),s.push(u)}else this.activeParts=null;this.timeRanges=a,Object.keys(a).forEach(function(d){var E=a[d];if(L.detectEvictedFragments(d,E),!u)for(var g=0;g<E.length;g++)y.appendedPTS=Math.max(E.end(g),y.appendedPTS||0)})},b.onFragBuffered=function(_,O){this.detectPartialFragments(O)},b.hasFragment=function(_){var O=I(_);return!!this.fragments[O]},b.removeFragmentsInRange=function(_,O,L){var y=this;Object.keys(this.fragments).forEach(function(u){var a=y.fragments[u];if(!a)return;if(a.buffered){var s=a.body;s.type===L&&s.start<O&&s.end>_&&y.removeFragment(s)}})},b.removeFragment=function(_){var O=I(_);_.stats.loaded=0,_.clearElementaryStreamInfo(),delete this.fragments[O]},b.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},M}();function W(M){var b,A;return M.buffered&&(((b=M.range.video)===null||b===void 0?void 0:b.partial)||((A=M.range.audio)===null||A===void 0?void 0:A.partial))}function I(M){return M.type+"_"+M.level+"_"+M.urlId+"_"+M.sn}},"./src/controller/gap-controller.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"STALL_MINIMUM_DURATION_MS",function(){return W}),D.d(X,"MAX_START_GAP_JUMP",function(){return I}),D.d(X,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return M}),D.d(X,"SKIP_BUFFER_RANGE_START",function(){return b}),D.d(X,"default",function(){return A});var K=D("./src/utils/buffer-helper.ts"),w=D("./src/errors.ts"),P=D("./src/events.ts"),H=D("./src/utils/logger.ts"),W=250,I=2,M=.1,b=.05,A=function(){function _(L,y,u,a){this.config=void 0,this.media=void 0,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=L,this.media=y,this.fragmentTracker=u,this.hls=a}var O=_.prototype;return O.destroy=function(){this.hls=this.fragmentTracker=this.media=null},O.poll=function(y){var u=this.config,a=this.media,s=this.stalled,d=a.currentTime,E=a.seeking,g=this.seeking&&!E,m=!this.seeking&&E;if(this.seeking=E,d!==y){if(this.moved=!0,s!==null){if(this.stallReported){var k=self.performance.now()-s;H.logger.warn("playback not stuck anymore @"+d+", after "+Math.round(k)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((m||g)&&(this.stalled=null),a.paused||a.ended||a.playbackRate===0||!K.BufferHelper.getBuffered(a).length)return;var x=K.BufferHelper.bufferInfo(a,d,0),h=x.len>0,p=x.nextStart||0;if(!h&&!p)return;if(E){var c=x.len>I,o=!p||p-d>I&&!this.fragmentTracker.getPartialFragment(d);if(c||o)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var S,v=Math.max(p,x.start||0)-d,T=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,N=T==null||((S=T.details)===null||S===void 0)?void 0:S.live,z=N?T.details.targetduration*2:I;if(v>0&&v<=z){this._trySkipBufferHole(null);return}}var Y=self.performance.now();if(s===null){this.stalled=Y;return}var ee=Y-s;!E&&ee>=W&&this._reportStall(x.len);var G=K.BufferHelper.bufferInfo(a,d,u.maxBufferHole);this._tryFixBufferStall(G,ee)},O._tryFixBufferStall=function(y,u){var a=this.config,s=this.fragmentTracker,d=this.media,E=d.currentTime,g=s.getPartialFragment(E);if(g){var m=this._trySkipBufferHole(g);if(m)return}y.len>a.maxBufferHole&&u>a.highBufferWatchdogPeriod*1e3&&(H.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},O._reportStall=function(y){var u=this.hls,a=this.media,s=this.stallReported;s||(this.stallReported=!0,H.logger.warn("Playback stalling at @"+a.currentTime+" due to low buffer (buffer="+y+")"),u.trigger(P.Events.ERROR,{type:w.ErrorTypes.MEDIA_ERROR,details:w.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:y}))},O._trySkipBufferHole=function(y){for(var u=this.config,a=this.hls,s=this.media,d=s.currentTime,E=0,g=K.BufferHelper.getBuffered(s),m=0;m<g.length;m++){var k=g.start(m);if(d+u.maxBufferHole>=E&&d<k){var x=Math.max(k+b,s.currentTime+M);return H.logger.warn("skipping hole, adjusting currentTime from "+d+" to "+x),this.moved=!0,this.stalled=null,s.currentTime=x,y&&a.trigger(P.Events.ERROR,{type:w.ErrorTypes.MEDIA_ERROR,details:w.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+d+" to "+x,frag:y}),x}E=g.end(m)}return 0},O._tryNudgeBuffer=function(){var y=this.config,u=this.hls,a=this.media,s=a.currentTime,d=(this.nudgeRetry||0)+1;if(this.nudgeRetry=d,d<y.nudgeMaxRetry){var E=s+d*y.nudgeOffset;H.logger.warn("Nudging 'currentTime' from "+s+" to "+E),a.currentTime=E,u.trigger(P.Events.ERROR,{type:w.ErrorTypes.MEDIA_ERROR,details:w.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else H.logger.error("Playhead still not moving while enough data buffered @"+s+" after "+y.nudgeMaxRetry+" nudges"),u.trigger(P.Events.ERROR,{type:w.ErrorTypes.MEDIA_ERROR,details:w.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},_}()},"./src/controller/id3-track-controller.ts":function(ae,X,D){"use strict";D.r(X);var K=D("./src/events.ts"),w=D("./src/utils/texttrack-utils.ts"),P=D("./src/demux/id3.ts"),H=.25,W=function(){function I(b){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=b,this._registerListeners()}var M=I.prototype;return M.destroy=function(){this._unregisterListeners()},M._registerListeners=function(){var A=this.hls;A.on(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),A.on(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),A.on(K.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),A.on(K.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},M._unregisterListeners=function(){var A=this.hls;A.off(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),A.off(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),A.off(K.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),A.off(K.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},M.onMediaAttached=function(A,_){this.media=_.media},M.onMediaDetaching=function(){if(!this.id3Track)return;Object(w.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},M.getID3Track=function(A){if(!this.media)return;for(var _=0;_<A.length;_++){var O=A[_];if(O.kind==="metadata"&&O.label==="id3")return Object(w.sendAddTrackEvent)(O,this.media),O}return this.media.addTextTrack("metadata","id3")},M.onFragParsingMetadata=function(A,_){if(!this.media)return;var O=_.frag,L=_.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var y=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,u=0;u<L.length;u++){var a=P.getID3Frames(L[u].data);if(a){var s=L[u].pts,d=u<L.length-1?L[u+1].pts:O.end,E=d-s;E<=0&&(d=s+H);for(var g=0;g<a.length;g++){var m=a[g];if(!P.isTimeStampFrame(m)){var k=new y(s,d,"");k.value=m,this.id3Track.addCue(k)}}}}},M.onBufferFlushing=function(A,_){var O=_.startOffset,L=_.endOffset,y=_.type;if(!y||y==="audio"){var u=this.id3Track;u&&Object(w.removeCuesInRange)(u,O,L)}},I}();X.default=W},"./src/controller/latency-controller.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"default",function(){return I});var K=D("./src/errors.ts"),w=D("./src/events.ts"),P=D("./src/utils/logger.ts");function H(M,b){for(var A=0;A<b.length;A++){var _=b[A];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(M,_.key,_)}}function W(M,b,A){return b&&H(M.prototype,b),A&&H(M,A),M}var I=function(){function M(A){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=A,this.config=A.config,this.registerListeners()}var b=M.prototype;return b.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},b.registerListeners=function(){this.hls.on(w.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(w.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(w.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(w.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(w.Events.ERROR,this.onError,this)},b.unregisterListeners=function(){this.hls.off(w.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(w.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(w.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(w.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(w.Events.ERROR,this.onError)},b.onMediaAttached=function(_,O){this.media=O.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},b.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},b.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},b.onLevelUpdated=function(_,O){var L=O.details;this.levelDetails=L,L.advanced&&this.timeupdate(),!L.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},b.onError=function(_,O){if(O.details!==K.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,P.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},b.timeupdate=function(){var _=this.media,O=this.levelDetails;if(!_||!O)return;this.currentTime=_.currentTime;var L=this.computeLatency();if(L===null)return;this._latency=L;var y=this.config,u=y.lowLatencyMode,a=y.maxLiveSyncPlaybackRate;if(!u||a===1)return;var s=this.targetLatency;if(s===null)return;var d=L-s,E=Math.min(this.maxLatency,s+O.targetduration),g=d<E;if(O.live&&g&&d>.05&&this.forwardBufferLength>1){var m=Math.min(2,Math.max(1,a)),k=Math.round(2/(1+Math.exp(-.75*d-this.edgeStalled))*20)/20;_.playbackRate=Math.min(m,Math.max(1,k))}else _.playbackRate!==1&&_.playbackRate!==0&&(_.playbackRate=1)},b.estimateLiveEdge=function(){var _=this.levelDetails;return _===null?null:_.edge+_.age},b.computeLatency=function(){var _=this.estimateLiveEdge();return _===null?null:_-this.currentTime},W(M,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var _=this.config,O=this.levelDetails;return _.liveMaxLatencyDuration!==void 0?_.liveMaxLatencyDuration:O?_.liveMaxLatencyDurationCount*O.targetduration:0}},{key:"targetLatency",get:function(){var _=this.levelDetails;if(_===null)return null;var O=_.holdBack,L=_.partHoldBack,y=_.targetduration,u=this.config,a=u.liveSyncDuration,s=u.liveSyncDurationCount,d=u.lowLatencyMode,E=this.hls.userConfig,g=d&&L||O;(E.liveSyncDuration||E.liveSyncDurationCount||g===0)&&(g=a!==void 0?a:s*y);var m=y,k=1;return g+Math.min(this.stallCount*k,m)}},{key:"liveSyncPosition",get:function(){var _=this.estimateLiveEdge(),O=this.targetLatency,L=this.levelDetails;if(_===null||O===null||L===null)return null;var y=L.edge,u=_-O-this.edgeStalled,a=y-L.totalduration,s=y-(this.config.lowLatencyMode&&L.partTarget||L.targetduration);return Math.min(Math.max(a,u),s)}},{key:"drift",get:function(){var _=this.levelDetails;return _===null?1:_.drift}},{key:"edgeStalled",get:function(){var _=this.levelDetails;if(_===null)return 0;var O=(this.config.lowLatencyMode&&_.partTarget||_.targetduration)*3;return Math.max(_.age-O,0)}},{key:"forwardBufferLength",get:function(){var _=this.media,O=this.levelDetails;if(!_||!O)return 0;var L=_.buffered.length;return L?_.buffered.end(L-1):O.edge-this.currentTime}}]),M}()},"./src/controller/level-controller.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"default",function(){return u});var K=D("./src/types/level.ts"),w=D("./src/events.ts"),P=D("./src/errors.ts"),H=D("./src/utils/codecs.ts"),W=D("./src/controller/level-helper.ts"),I=D("./src/controller/base-playlist-controller.ts"),M=D("./src/types/loader.ts");function b(){return b=Object.assign||function(a){for(var s=1;s<arguments.length;s++){var d=arguments[s];for(var E in d)Object.prototype.hasOwnProperty.call(d,E)&&(a[E]=d[E])}return a},b.apply(this,arguments)}function A(a,s){for(var d=0;d<s.length;d++){var E=s[d];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(a,E.key,E)}}function _(a,s,d){return s&&A(a.prototype,s),d&&A(a,d),a}function O(a,s){a.prototype=Object.create(s.prototype),a.prototype.constructor=a,L(a,s)}function L(a,s){return L=Object.setPrototypeOf||function(E,g){return E.__proto__=g,E},L(a,s)}var y=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),u=function(a){O(s,a);function s(E){var g;return g=a.call(this,E,"[level-controller]")||this,g._levels=[],g._firstLevel=-1,g._startLevel=void 0,g.currentLevelIndex=-1,g.manualLevelIndex=-1,g.onParsedComplete=void 0,g._registerListeners(),g}var d=s.prototype;return d._registerListeners=function(){var g=this.hls;g.on(w.Events.MANIFEST_LOADED,this.onManifestLoaded,this),g.on(w.Events.LEVEL_LOADED,this.onLevelLoaded,this),g.on(w.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),g.on(w.Events.FRAG_LOADED,this.onFragLoaded,this),g.on(w.Events.ERROR,this.onError,this)},d._unregisterListeners=function(){var g=this.hls;g.off(w.Events.MANIFEST_LOADED,this.onManifestLoaded,this),g.off(w.Events.LEVEL_LOADED,this.onLevelLoaded,this),g.off(w.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),g.off(w.Events.FRAG_LOADED,this.onFragLoaded,this),g.off(w.Events.ERROR,this.onError,this)},d.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,a.prototype.destroy.call(this)},d.startLoad=function(){var g=this._levels;g.forEach(function(m){m.loadError=0}),a.prototype.startLoad.call(this)},d.onManifestLoaded=function(g,m){var k=[],x=[],h=[],p,c={},o,S=!1,v=!1,T=!1;if(m.levels.forEach(function(ee){var G=ee.attrs;S=S||!!(ee.width&&ee.height),v=v||!!ee.videoCodec,T=T||!!ee.audioCodec,y&&ee.audioCodec&&ee.audioCodec.indexOf("mp4a.40.34")!==-1&&(ee.audioCodec=void 0);var j=ee.bitrate+"-"+ee.attrs.RESOLUTION+"-"+ee.attrs.CODECS;o=c[j],o?o.url.push(ee.url):(o=new K.Level(ee),c[j]=o,k.push(o)),G&&(G.AUDIO&&Object(W.addGroupId)(o,"audio",G.AUDIO),G.SUBTITLES&&Object(W.addGroupId)(o,"text",G.SUBTITLES))}),(S||v)&&T&&(k=k.filter(function(ee){var G=ee.videoCodec,j=ee.width,te=ee.height;return!!G||!!(j&&te)})),k=k.filter(function(ee){var G=ee.audioCodec,j=ee.videoCodec;return(!G||Object(H.isCodecSupportedInMp4)(G,"audio"))&&(!j||Object(H.isCodecSupportedInMp4)(j,"video"))}),m.audioTracks&&(x=m.audioTracks.filter(function(ee){return!ee.audioCodec||Object(H.isCodecSupportedInMp4)(ee.audioCodec,"audio")}),Object(W.assignTrackIdsByGroup)(x)),m.subtitles&&(h=m.subtitles,Object(W.assignTrackIdsByGroup)(h)),k.length>0){p=k[0].bitrate,k.sort(function(ee,G){return ee.bitrate-G.bitrate}),this._levels=k;for(var N=0;N<k.length;N++)if(k[N].bitrate===p){this._firstLevel=N,this.log("manifest loaded, "+k.length+" level(s) found, first bitrate: "+p);break}var z=T&&!v,Y={levels:k,audioTracks:x,subtitleTracks:h,firstLevel:this._firstLevel,stats:m.stats,audio:T,video:v,altAudio:!z&&x.some(function(ee){return!!ee.url})};this.hls.trigger(w.Events.MANIFEST_PARSED,Y),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(w.Events.ERROR,{type:P.ErrorTypes.MEDIA_ERROR,details:P.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:m.url,reason:"no level with compatible codecs found in manifest"})},d.onError=function(g,m){if(a.prototype.onError.call(this,g,m),m.fatal)return;var k=m.context,x=this._levels[this.currentLevelIndex];if(k&&(k.type===M.PlaylistContextType.AUDIO_TRACK&&x.audioGroupIds&&k.groupId===x.audioGroupIds[x.urlId]||k.type===M.PlaylistContextType.SUBTITLE_TRACK&&x.textGroupIds&&k.groupId===x.textGroupIds[x.urlId])){this.redundantFailover(this.currentLevelIndex);return}var h=!1,p=!0,c;switch(m.details){case P.ErrorDetails.FRAG_LOAD_ERROR:case P.ErrorDetails.FRAG_LOAD_TIMEOUT:case P.ErrorDetails.KEY_LOAD_ERROR:case P.ErrorDetails.KEY_LOAD_TIMEOUT:if(m.frag){var o=this._levels[m.frag.level];o?(o.fragmentError++,o.fragmentError>this.hls.config.fragLoadingMaxRetry&&(c=m.frag.level)):c=m.frag.level}break;case P.ErrorDetails.LEVEL_LOAD_ERROR:case P.ErrorDetails.LEVEL_LOAD_TIMEOUT:k&&(k.deliveryDirectives&&(p=!1),c=k.level),h=!0;break;case P.ErrorDetails.REMUX_ALLOC_ERROR:c=m.level,h=!0;break}c!==void 0&&this.recoverLevel(m,c,h,p)},d.recoverLevel=function(g,m,k,x){var h=g.details,p=this._levels[m];if(p.loadError++,k){var c=this.retryLoadingOrFail(g);if(c)g.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(x){var o=p.url.length;if(o>1&&p.loadError<o)g.levelRetry=!0,this.redundantFailover(m);else if(this.manualLevelIndex===-1){var S=m===0?this._levels.length-1:m-1;this.currentLevelIndex!==S&&this._levels[S].loadError===0&&(this.warn(h+": switch to "+S),g.levelRetry=!0,this.hls.nextAutoLevel=S)}}},d.redundantFailover=function(g){var m=this._levels[g],k=m.url.length;if(k>1){var x=(m.urlId+1)%k;this.warn("Switching to redundant URL-id "+x),this._levels.forEach(function(h){h.urlId=x}),this.level=g}},d.onFragLoaded=function(g,m){var k=m.frag;if(k!==void 0&&k.type===M.PlaylistLevelType.MAIN){var x=this._levels[k.level];x!==void 0&&(x.fragmentError=0,x.loadError=0)}},d.onLevelLoaded=function(g,m){var k,x=m.level,h=m.details,p=this._levels[x];if(!p){var c;this.warn("Invalid level index "+x),(c=m.deliveryDirectives)!==null&&c!==void 0&&c.skip&&(h.deltaUpdateFailed=!0);return}x===this.currentLevelIndex?(p.fragmentError===0&&(p.loadError=0,this.retryCount=0),this.playlistLoaded(x,m,p.details)):(k=m.deliveryDirectives)!==null&&k!==void 0&&k.skip&&(h.deltaUpdateFailed=!0)},d.onAudioTrackSwitched=function(g,m){var k=this.hls.levels[this.currentLevelIndex];if(!k)return;if(k.audioGroupIds){for(var x=-1,h=this.hls.audioTracks[m.id].groupId,p=0;p<k.audioGroupIds.length;p++)if(k.audioGroupIds[p]===h){x=p;break}x!==k.urlId&&(k.urlId=x,this.startLoad())}},d.loadPlaylist=function(g){var m=this.currentLevelIndex,k=this._levels[m];if(this.canLoad&&k&&k.url.length>0){var x=k.urlId,h=k.url[x];if(g)try{h=g.addDirectives(h)}catch(p){this.warn("Could not construct new URL with HLS Delivery Directives: "+p)}this.log("Attempt loading level index "+m+(g?" at sn "+g.msn+" part "+g.part:"")+" with URL-id "+x+" "+h),this.clearTimer(),this.hls.trigger(w.Events.LEVEL_LOADING,{url:h,level:m,id:x,deliveryDirectives:g||null})}},d.removeLevel=function(g,m){var k=function(p,c){return c!==m},x=this._levels.filter(function(h,p){return p!==g?!0:h.url.length>1&&m!==void 0?(h.url=h.url.filter(k),h.audioGroupIds&&(h.audioGroupIds=h.audioGroupIds.filter(k)),h.textGroupIds&&(h.textGroupIds=h.textGroupIds.filter(k)),h.urlId=0,!0):!1}).map(function(h,p){var c=h.details;return c!=null&&c.fragments&&c.fragments.forEach(function(o){o.level=p}),h});this._levels=x,this.hls.trigger(w.Events.LEVELS_UPDATED,{levels:x})},_(s,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(g){var m,k=this._levels;if(k.length===0)return;if(this.currentLevelIndex===g&&(m=k[g])!==null&&m!==void 0&&m.details)return;if(g<0||g>=k.length){var x=g<0;if(this.hls.trigger(w.Events.ERROR,{type:P.ErrorTypes.OTHER_ERROR,details:P.ErrorDetails.LEVEL_SWITCH_ERROR,level:g,fatal:x,reason:"invalid level idx"}),x)return;g=Math.min(g,k.length-1)}this.clearTimer();var h=this.currentLevelIndex,p=k[h],c=k[g];this.log("switching to level "+g+" from "+h),this.currentLevelIndex=g;var o=b({},c,{level:g,maxBitrate:c.maxBitrate,uri:c.uri,urlId:c.urlId});delete o._urlId,this.hls.trigger(w.Events.LEVEL_SWITCHING,o);var S=c.details;if(!S||S.live){var v=this.switchParams(c.uri,p==null?void 0:p.details);this.loadPlaylist(v)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(g){this.manualLevelIndex=g,this._startLevel===void 0&&(this._startLevel=g),g!==-1&&(this.level=g)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(g){this._firstLevel=g}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var g=this.hls.config.startLevel;return g!==void 0?g:this._firstLevel}else return this._startLevel},set:function(g){this._startLevel=g}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(g){this.level=g,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=g)}}]),s}(I.default)},"./src/controller/level-helper.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"addGroupId",function(){return P}),D.d(X,"assignTrackIdsByGroup",function(){return H}),D.d(X,"updatePTS",function(){return W}),D.d(X,"updateFragPTSDTS",function(){return M}),D.d(X,"mergeDetails",function(){return b}),D.d(X,"mapPartIntersection",function(){return A}),D.d(X,"mapFragmentIntersection",function(){return _}),D.d(X,"adjustSliding",function(){return O}),D.d(X,"addSliding",function(){return L}),D.d(X,"computeReloadInterval",function(){return y}),D.d(X,"getFragmentWithSN",function(){return u}),D.d(X,"getPartWith",function(){return a});var K=D("./src/polyfills/number.ts"),w=D("./src/utils/logger.ts");function P(s,d,E){switch(d){case"audio":s.audioGroupIds||(s.audioGroupIds=[]),s.audioGroupIds.push(E);break;case"text":s.textGroupIds||(s.textGroupIds=[]),s.textGroupIds.push(E);break}}function H(s){var d={};s.forEach(function(E){var g=E.groupId||"";E.id=d[g]=d[g]||0,d[g]++})}function W(s,d,E){var g=s[d],m=s[E];I(g,m)}function I(s,d){var E=d.startPTS;if(Object(K.isFiniteNumber)(E)){var g=0,m;d.sn>s.sn?(g=E-s.start,m=s):(g=s.start-E,m=d),m.duration!==g&&(m.duration=g)}else if(d.sn>s.sn){var k=s.cc===d.cc;k&&s.minEndPTS?d.start=s.start+(s.minEndPTS-s.start):d.start=s.start+s.duration}else d.start=Math.max(s.start-d.duration,0)}function M(s,d,E,g,m,k){var x=g-E;x<=0&&(w.logger.warn("Fragment should have a positive duration",d),g=E+d.duration,k=m+d.duration);var h=E,p=g,c=d.startPTS,o=d.endPTS;if(Object(K.isFiniteNumber)(c)){var S=Math.abs(c-E);Object(K.isFiniteNumber)(d.deltaPTS)?d.deltaPTS=Math.max(S,d.deltaPTS):d.deltaPTS=S,h=Math.max(E,c),E=Math.min(E,c),m=Math.min(m,d.startDTS),p=Math.min(g,o),g=Math.max(g,o),k=Math.max(k,d.endDTS)}d.duration=g-E;var v=E-d.start;d.appendedPTS=g,d.start=d.startPTS=E,d.maxStartPTS=h,d.startDTS=m,d.endPTS=g,d.minEndPTS=p,d.endDTS=k;var T=d.sn;if(!s||T<s.startSN||T>s.endSN)return 0;var N,z=T-s.startSN,Y=s.fragments;for(Y[z]=d,N=z;N>0;N--)I(Y[N],Y[N-1]);for(N=z;N<Y.length-1;N++)I(Y[N],Y[N+1]);return s.fragmentHint&&I(Y[Y.length-1],s.fragmentHint),s.PTSKnown=s.alignedSliding=!0,v}function b(s,d){for(var E=null,g=s.fragments,m=g.length-1;m>=0;m--){var k=g[m].initSegment;if(k){E=k;break}}s.fragmentHint&&delete s.fragmentHint.endPTS;var x=0,h;if(_(s,d,function(N,z){N.relurl&&(x=N.cc-z.cc),Object(K.isFiniteNumber)(N.startPTS)&&Object(K.isFiniteNumber)(N.endPTS)&&(z.start=z.startPTS=N.startPTS,z.startDTS=N.startDTS,z.appendedPTS=N.appendedPTS,z.maxStartPTS=N.maxStartPTS,z.endPTS=N.endPTS,z.endDTS=N.endDTS,z.minEndPTS=N.minEndPTS,z.duration=N.endPTS-N.startPTS,z.duration&&(h=z),d.PTSKnown=d.alignedSliding=!0),z.elementaryStreams=N.elementaryStreams,z.loader=N.loader,z.stats=N.stats,z.urlId=N.urlId,N.initSegment&&(z.initSegment=N.initSegment,E=N.initSegment)}),E){var p=d.fragmentHint?d.fragments.concat(d.fragmentHint):d.fragments;p.forEach(function(N){var z;(!N.initSegment||N.initSegment.relurl===((z=E)===null||z===void 0?void 0:z.relurl))&&(N.initSegment=E)})}if(d.skippedSegments&&(d.deltaUpdateFailed=d.fragments.some(function(N){return!N}),d.deltaUpdateFailed)){w.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var c=d.skippedSegments;c--;)d.fragments.shift();d.startSN=d.fragments[0].sn,d.startCC=d.fragments[0].cc}var o=d.fragments;if(x){w.logger.warn("discontinuity sliding from playlist, take drift into account");for(var S=0;S<o.length;S++)o[S].cc+=x}d.skippedSegments&&(d.startCC=d.fragments[0].cc),A(s.partList,d.partList,function(N,z){z.elementaryStreams=N.elementaryStreams,z.stats=N.stats}),h?M(d,h,h.startPTS,h.endPTS,h.startDTS,h.endDTS):O(s,d),o.length&&(d.totalduration=d.edge-o[0].start),d.driftStartTime=s.driftStartTime,d.driftStart=s.driftStart;var v=d.advancedDateTime;if(d.advanced&&v){var T=d.edge;d.driftStart||(d.driftStartTime=v,d.driftStart=T),d.driftEndTime=v,d.driftEnd=T}else d.driftEndTime=s.driftEndTime,d.driftEnd=s.driftEnd,d.advancedDateTime=s.advancedDateTime}function A(s,d,E){if(s&&d)for(var g=0,m=0,k=s.length;m<=k;m++){var x=s[m],h=d[m+g];x&&h&&x.index===h.index&&x.fragment.sn===h.fragment.sn?E(x,h):g--}}function _(s,d,E){for(var g=d.skippedSegments,m=Math.max(s.startSN,d.startSN)-d.startSN,k=(s.fragmentHint?1:0)+(g?d.endSN:Math.min(s.endSN,d.endSN))-d.startSN,x=d.startSN-s.startSN,h=d.fragmentHint?d.fragments.concat(d.fragmentHint):d.fragments,p=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments,c=m;c<=k;c++){var o=p[x+c],S=h[c];g&&!S&&c<g&&(S=d.fragments[c]=o),o&&S&&E(o,S)}}function O(s,d){var E=d.startSN+d.skippedSegments-s.startSN,g=s.fragments;if(E<0||E>=g.length)return;L(d,g[E].start)}function L(s,d){if(d){for(var E=s.fragments,g=s.skippedSegments;g<E.length;g++)E[g].start+=d;s.fragmentHint&&(s.fragmentHint.start+=d)}}function y(s,d){var E=1e3*s.levelTargetDuration,g=E/2,m=s.age,k=m>0&&m<E*3,x=d.loading.end-d.loading.start,h,p=s.availabilityDelay;if(s.updated===!1)if(k){var c=333*s.misses;h=Math.max(Math.min(g,x*2),c),s.availabilityDelay=(s.availabilityDelay||0)+h}else h=g;else k?(p=Math.min(p||E/2,m),s.availabilityDelay=p,h=p+E-m):h=E-x;return Math.round(h)}function u(s,d,E){if(!s||!s.details)return null;var g=s.details,m=g.fragments[d-g.startSN];return m||(m=g.fragmentHint,m&&m.sn===d?m:d<g.startSN&&E&&E.sn===d?E:null)}function a(s,d,E){if(!s||!s.details)return null;var g=s.details.partList;if(g)for(var m=g.length;m--;){var k=g[m];if(k.index===E&&k.fragment.sn===d)return k}return null}},"./src/controller/stream-controller.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"default",function(){return g});var K=D("./src/polyfills/number.ts"),w=D("./src/controller/base-stream-controller.ts"),P=D("./src/is-supported.ts"),H=D("./src/events.ts"),W=D("./src/utils/buffer-helper.ts"),I=D("./src/controller/fragment-tracker.ts"),M=D("./src/types/loader.ts"),b=D("./src/loader/fragment.ts"),A=D("./src/demux/transmuxer-interface.ts"),_=D("./src/types/transmuxer.ts"),O=D("./src/controller/gap-controller.ts"),L=D("./src/errors.ts"),y=D("./src/utils/logger.ts");function u(m,k){for(var x=0;x<k.length;x++){var h=k[x];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(m,h.key,h)}}function a(m,k,x){return k&&u(m.prototype,k),x&&u(m,x),m}function s(m,k){m.prototype=Object.create(k.prototype),m.prototype.constructor=m,d(m,k)}function d(m,k){return d=Object.setPrototypeOf||function(h,p){return h.__proto__=p,h},d(m,k)}var E=100,g=function(m){s(k,m);function k(h,p){var c;return c=m.call(this,h,p,"[stream-controller]")||this,c.audioCodecSwap=!1,c.gapController=null,c.level=-1,c._forceStartLoad=!1,c.altAudio=!1,c.audioOnly=!1,c.fragPlaying=null,c.onvplaying=null,c.onvseeked=null,c.fragLastKbps=0,c.stalled=!1,c.couldBacktrack=!1,c.audioCodecSwitch=!1,c.videoBuffer=null,c._registerListeners(),c}var x=k.prototype;return x._registerListeners=function(){var p=this.hls;p.on(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),p.on(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),p.on(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),p.on(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),p.on(H.Events.LEVEL_LOADING,this.onLevelLoading,this),p.on(H.Events.LEVEL_LOADED,this.onLevelLoaded,this),p.on(H.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),p.on(H.Events.ERROR,this.onError,this),p.on(H.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),p.on(H.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),p.on(H.Events.BUFFER_CREATED,this.onBufferCreated,this),p.on(H.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),p.on(H.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),p.on(H.Events.FRAG_BUFFERED,this.onFragBuffered,this)},x._unregisterListeners=function(){var p=this.hls;p.off(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),p.off(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),p.off(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),p.off(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),p.off(H.Events.LEVEL_LOADED,this.onLevelLoaded,this),p.off(H.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),p.off(H.Events.ERROR,this.onError,this),p.off(H.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),p.off(H.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),p.off(H.Events.BUFFER_CREATED,this.onBufferCreated,this),p.off(H.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),p.off(H.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),p.off(H.Events.FRAG_BUFFERED,this.onFragBuffered,this)},x.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},x.startLoad=function(p){if(this.levels){var c=this.lastCurrentTime,o=this.hls;if(this.stopLoad(),this.setInterval(E),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var S=o.startLevel;S===-1&&(o.config.testBandwidth?(S=0,this.bitrateTest=!0):S=o.nextAutoLevel),this.level=o.nextLoadLevel=S,this.loadedmetadata=!1}c>0&&p===-1&&(this.log("Override startPosition with lastCurrentTime @"+c.toFixed(3)),p=c),this.state=w.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=p,this.tick()}else this._forceStartLoad=!0,this.state=w.State.STOPPED},x.stopLoad=function(){this._forceStartLoad=!1,m.prototype.stopLoad.call(this)},x.doTick=function(){switch(this.state){case w.State.IDLE:this.doTickIdle();break;case w.State.WAITING_LEVEL:{var p,c=this.levels,o=this.level,S=c==null||((p=c[o])===null||p===void 0)?void 0:p.details;if(S&&(!S.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(S))break;this.state=w.State.IDLE;break}break}case w.State.FRAG_LOADING_WAITING_RETRY:{var v,T=self.performance.now(),N=this.retryDate;(!N||T>=N||(v=this.media)!==null&&v!==void 0&&v.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=w.State.IDLE)}break;default:break}this.onTickEnd()},x.onTickEnd=function(){m.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},x.doTickIdle=function(){var p,c,o=this.hls,S=this.levelLastLoaded,v=this.levels,T=this.media,N=o.config,z=o.nextLoadLevel;if(S===null||!T&&(this.startFragRequested||!N.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!v||!v[z])return;var Y=v[z];this.level=o.nextLoadLevel=z;var ee=Y.details;if(!ee||this.state===w.State.WAITING_LEVEL||ee.live&&this.levelLastLoaded!==z){this.state=w.State.WAITING_LEVEL;return}var G=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:T,M.PlaylistLevelType.MAIN);if(G===null)return;var j=G.len,te=this.getMaxBufferLength(Y.maxBitrate);if(j>=te)return;if(this._streamEnded(G,ee)){var de={};this.altAudio&&(de.type="video"),this.hls.trigger(H.Events.BUFFER_EOS,de),this.state=w.State.ENDED;return}var be=G.end,Oe=this.getNextFragment(be,ee);if(this.couldBacktrack&&!this.fragPrevious&&Oe&&Oe.sn!=="initSegment"){var Ge=Oe.sn-ee.startSN;Ge>1&&(Oe=ee.fragments[Ge-1],this.fragmentTracker.removeFragment(Oe))}if(Oe&&this.fragmentTracker.getState(Oe)===I.FragmentState.OK&&this.nextLoadPosition>be){var Me=this.audioOnly&&!this.altAudio?b.ElementaryStreamTypes.AUDIO:b.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(T,Me,M.PlaylistLevelType.MAIN),Oe=this.getNextFragment(this.nextLoadPosition,ee)}if(!Oe)return;Oe.initSegment&&!Oe.initSegment.data&&!this.bitrateTest&&(Oe=Oe.initSegment),((p=Oe.decryptdata)===null||p===void 0?void 0:p.keyFormat)==="identity"&&!((c=Oe.decryptdata)!==null&&c!==void 0&&c.key)?this.loadKey(Oe,ee):this.loadFragment(Oe,ee,be)},x.loadFragment=function(p,c,o){var S,v=this.fragmentTracker.getState(p);if(this.fragCurrent=p,v===I.FragmentState.BACKTRACKED){var T=this.fragmentTracker.getBacktrackData(p);if(T){this._handleFragmentLoadProgress(T),this._handleFragmentLoadComplete(T);return}else v=I.FragmentState.NOT_LOADED}v===I.FragmentState.NOT_LOADED||v===I.FragmentState.PARTIAL?p.sn==="initSegment"?this._loadInitSegment(p):this.bitrateTest?(p.bitrateTest=!0,this.log("Fragment "+p.sn+" of level "+p.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(p)):(this.startFragRequested=!0,m.prototype.loadFragment.call(this,p,c,o)):v===I.FragmentState.APPENDING?this.reduceMaxBufferLength(p.duration)&&this.fragmentTracker.removeFragment(p):((S=this.media)===null||S===void 0?void 0:S.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},x.getAppendedFrag=function(p){var c=this.fragmentTracker.getAppendedFrag(p,M.PlaylistLevelType.MAIN);return c&&"fragment"in c?c.fragment:c},x.getBufferedFrag=function(p){return this.fragmentTracker.getBufferedFrag(p,M.PlaylistLevelType.MAIN)},x.followingBufferedFrag=function(p){return p?this.getBufferedFrag(p.end+.5):null},x.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},x.nextLevelSwitch=function(){var p=this.levels,c=this.media;if(c!=null&&c.readyState){var o,S=this.getAppendedFrag(c.currentTime);if(S&&S.start>1&&this.flushMainBuffer(0,S.start-1),!c.paused&&p){var v=this.hls.nextLoadLevel,T=p[v],N=this.fragLastKbps;N&&this.fragCurrent?o=this.fragCurrent.duration*T.maxBitrate/(1e3*N)+1:o=0}else o=0;var z=this.getBufferedFrag(c.currentTime+o);if(z){var Y=this.followingBufferedFrag(z);if(Y){this.abortCurrentFrag();var ee=Y.maxStartPTS?Y.maxStartPTS:Y.start,G=Y.duration,j=Math.max(z.end,ee+Math.min(Math.max(G-this.config.maxFragLookUpTolerance,G*.5),G*.75));this.flushMainBuffer(j,Number.POSITIVE_INFINITY)}}}},x.abortCurrentFrag=function(){var p=this.fragCurrent;this.fragCurrent=null,p!=null&&p.loader&&p.loader.abort(),this.state===w.State.KEY_LOADING&&(this.state=w.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},x.flushMainBuffer=function(p,c){m.prototype.flushMainBuffer.call(this,p,c,this.altAudio?"video":null)},x.onMediaAttached=function(p,c){m.prototype.onMediaAttached.call(this,p,c);var o=c.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),o.addEventListener("playing",this.onvplaying),o.addEventListener("seeked",this.onvseeked),this.gapController=new O.default(this.config,o,this.fragmentTracker,this.hls)},x.onMediaDetaching=function(){var p=this.media;p&&(p.removeEventListener("playing",this.onvplaying),p.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),m.prototype.onMediaDetaching.call(this)},x.onMediaPlaying=function(){this.tick()},x.onMediaSeeked=function(){var p=this.media,c=p?p.currentTime:null;Object(K.isFiniteNumber)(c)&&this.log("Media seeked to "+c.toFixed(3)),this.tick()},x.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},x.onManifestParsed=function(p,c){var o=!1,S=!1,v;c.levels.forEach(function(T){v=T.audioCodec,v&&(v.indexOf("mp4a.40.2")!==-1&&(o=!0),v.indexOf("mp4a.40.5")!==-1&&(S=!0))}),this.audioCodecSwitch=o&&S&&!Object(P.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=c.levels,this.startFragRequested=!1},x.onLevelLoading=function(p,c){var o=this.levels;if(!o||this.state!==w.State.IDLE)return;var S=o[c.level];(!S.details||S.details.live&&this.levelLastLoaded!==c.level||this.waitForCdnTuneIn(S.details))&&(this.state=w.State.WAITING_LEVEL)},x.onLevelLoaded=function(p,c){var o,S=this.levels,v=c.level,T=c.details,N=T.totalduration;if(!S){this.warn("Levels were reset while loading level "+v);return}this.log("Level "+v+" loaded ["+T.startSN+","+T.endSN+"], cc ["+T.startCC+", "+T.endCC+"] duration:"+N);var z=this.fragCurrent;z&&(this.state===w.State.FRAG_LOADING||this.state===w.State.FRAG_LOADING_WAITING_RETRY)&&(z.level!==c.level&&z.loader&&(this.state=w.State.IDLE,z.loader.abort()));var Y=S[v],ee=0;if(T.live||(o=Y.details)!==null&&o!==void 0&&o.live){if(T.fragments[0]||(T.deltaUpdateFailed=!0),T.deltaUpdateFailed)return;ee=this.alignPlaylists(T,Y.details)}if(Y.details=T,this.levelLastLoaded=v,this.hls.trigger(H.Events.LEVEL_UPDATED,{details:T,level:v}),this.state===w.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(T))return;this.state=w.State.IDLE}this.startFragRequested?T.live&&this.synchronizeToLiveEdge(T):this.setStartPosition(T,ee),this.tick()},x._handleFragmentLoadProgress=function(p){var c,o=p.frag,S=p.part,v=p.payload,T=this.levels;if(!T){this.warn("Levels were reset while fragment load was in progress. Fragment "+o.sn+" of level "+o.level+" will not be buffered");return}var N=T[o.level],z=N.details;if(!z){this.warn("Dropping fragment "+o.sn+" of level "+o.level+" after level details were reset");return}var Y=N.videoCodec,ee=z.PTSKnown||!z.live,G=(c=o.initSegment)===null||c===void 0?void 0:c.data,j=this._getAudioCodec(N),te=this.transmuxer=this.transmuxer||new A.default(this.hls,M.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),de=S?S.index:-1,be=de!==-1,Oe=new _.ChunkMetadata(o.level,o.sn,o.stats.chunkCount,v.byteLength,de,be),Ge=this.initPTS[o.cc];te.push(v,G,j,Y,o,S,z.totalduration,ee,Oe,Ge)},x.onAudioTrackSwitching=function(p,c){var o=this.altAudio,S=!!c.url,v=c.id;if(!S){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var T=this.fragCurrent;T!=null&&T.loader&&(this.log("Switching to main audio track, cancel main fragment load"),T.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var N=this.hls;o&&N.trigger(H.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),N.trigger(H.Events.AUDIO_TRACK_SWITCHED,{id:v})}},x.onAudioTrackSwitched=function(p,c){var o=c.id,S=!!this.hls.audioTracks[o].url;if(S){var v=this.videoBuffer;v&&this.mediaBuffer!==v&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=v)}this.altAudio=S,this.tick()},x.onBufferCreated=function(p,c){var o=c.tracks,S,v,T=!1;for(var N in o){var z=o[N];if(z.id==="main"){if(v=N,S=z,N==="video"){var Y=o[N];Y&&(this.videoBuffer=Y.buffer)}}else T=!0}T&&S?(this.log("Alternate track found, use "+v+".buffered to schedule main fragment loading"),this.mediaBuffer=S.buffer):this.mediaBuffer=this.media},x.onFragBuffered=function(p,c){var o=c.frag,S=c.part;if(o&&o.type!==M.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(o)){this.warn("Fragment "+o.sn+(S?" p: "+S.index:"")+" of level "+o.level+" finished buffering, but was aborted. state: "+this.state),this.state===w.State.PARSED&&(this.state=w.State.IDLE);return}var v=S?S.stats:o.stats;this.fragLastKbps=Math.round(8*v.total/(v.buffering.end-v.loading.first)),o.sn!=="initSegment"&&(this.fragPrevious=o),this.fragBufferedComplete(o,S)},x.onError=function(p,c){switch(c.details){case L.ErrorDetails.FRAG_LOAD_ERROR:case L.ErrorDetails.FRAG_LOAD_TIMEOUT:case L.ErrorDetails.KEY_LOAD_ERROR:case L.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(M.PlaylistLevelType.MAIN,c);break;case L.ErrorDetails.LEVEL_LOAD_ERROR:case L.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==w.State.ERROR&&(c.fatal?(this.warn(""+c.details),this.state=w.State.ERROR):!c.levelRetry&&this.state===w.State.WAITING_LEVEL&&(this.state=w.State.IDLE));break;case L.ErrorDetails.BUFFER_FULL_ERROR:if(c.parent==="main"&&(this.state===w.State.PARSING||this.state===w.State.PARSED)){var o=!0,S=this.getFwdBufferInfo(this.media,M.PlaylistLevelType.MAIN);S&&S.len>.5&&(o=!this.reduceMaxBufferLength(S.len)),o&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},x.checkBuffer=function(){var p=this.media,c=this.gapController;if(!p||!c||!p.readyState)return;var o=W.BufferHelper.getBuffered(p);!this.loadedmetadata&&o.length?(this.loadedmetadata=!0,this.seekToStartPos()):c.poll(this.lastCurrentTime),this.lastCurrentTime=p.currentTime},x.onFragLoadEmergencyAborted=function(){this.state=w.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},x.onBufferFlushed=function(p,c){var o=c.type;if(o!==b.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var S=(o===b.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(S,o,M.PlaylistLevelType.MAIN)}},x.onLevelsUpdated=function(p,c){this.levels=c.levels},x.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},x.seekToStartPos=function(){var p=this.media,c=p.currentTime,o=this.startPosition;if(o>=0&&c<o){if(p.seeking){y.logger.log("could not seek to "+o+", already seeking at "+c);return}var S=W.BufferHelper.getBuffered(p),v=S.length?S.start(0):0,T=v-o;T>0&&(T<this.config.maxBufferHole||T<this.config.maxFragLookUpTolerance)&&(y.logger.log("adjusting start position by "+T+" to match buffer start"),o+=T,this.startPosition=o),this.log("seek to target start position "+o+" from current time "+c),p.currentTime=o}},x._getAudioCodec=function(p){var c=this.config.defaultAudioCodec||p.audioCodec;return this.audioCodecSwap&&c&&(this.log("Swapping audio codec"),c.indexOf("mp4a.40.5")!==-1?c="mp4a.40.2":c="mp4a.40.5"),c},x._loadBitrateTestFrag=function(p){var c=this;this._doFragLoad(p).then(function(o){var S=c.hls;if(!o||S.nextLoadLevel||c.fragContextChanged(p))return;c.fragLoadError=0,c.state=w.State.IDLE,c.startFragRequested=!1,c.bitrateTest=!1;var v=p.stats;v.parsing.start=v.parsing.end=v.buffering.start=v.buffering.end=self.performance.now(),S.trigger(H.Events.FRAG_LOADED,o)})},x._handleTransmuxComplete=function(p){var c,o="main",S=this.hls,v=p.remuxResult,T=p.chunkMeta,N=this.getCurrentContext(T);if(!N){this.warn("The loading context changed while buffering fragment "+T.sn+" of level "+T.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(T.level);return}var z=N.frag,Y=N.part,ee=N.level,G=v.video,j=v.text,te=v.id3,de=v.initSegment,be=this.altAudio?void 0:v.audio;if(this.fragContextChanged(z))return;if(this.state=w.State.PARSING,de){de.tracks&&(this._bufferInitSegment(ee,de.tracks,z,T),S.trigger(H.Events.FRAG_PARSING_INIT_SEGMENT,{frag:z,id:o,tracks:de.tracks}));var Oe=de.initPTS,Ge=de.timescale;Object(K.isFiniteNumber)(Oe)&&(this.initPTS[z.cc]=Oe,S.trigger(H.Events.INIT_PTS_FOUND,{frag:z,id:o,initPTS:Oe,timescale:Ge}))}if(G&&v.independent!==!1){if(ee.details){var Me=G.startPTS,Ie=G.endPTS,Ue=G.startDTS,Pe=G.endDTS;if(Y)Y.elementaryStreams[G.type]={startPTS:Me,endPTS:Ie,startDTS:Ue,endDTS:Pe};else if(G.firstKeyFrame&&G.independent&&(this.couldBacktrack=!0),G.dropped&&G.independent){var Te=this.getLoadPosition()+this.config.maxBufferHole;if(Te<Me){this.backtrack(z);return}z.setElementaryStreamInfo(G.type,z.start,Ie,z.start,Pe,!0)}z.setElementaryStreamInfo(G.type,Me,Ie,Ue,Pe),this.bufferFragmentData(G,z,Y,T)}}else if(v.independent===!1){this.backtrack(z);return}if(be){var se=be.startPTS,Fe=be.endPTS,dt=be.startDTS,it=be.endDTS;Y&&(Y.elementaryStreams[b.ElementaryStreamTypes.AUDIO]={startPTS:se,endPTS:Fe,startDTS:dt,endDTS:it}),z.setElementaryStreamInfo(b.ElementaryStreamTypes.AUDIO,se,Fe,dt,it),this.bufferFragmentData(be,z,Y,T)}if(te!=null&&(c=te.samples)!==null&&c!==void 0&&c.length){var ot={frag:z,id:o,samples:te.samples};S.trigger(H.Events.FRAG_PARSING_METADATA,ot)}if(j){var ct={frag:z,id:o,samples:j.samples};S.trigger(H.Events.FRAG_PARSING_USERDATA,ct)}},x._bufferInitSegment=function(p,c,o,S){var v=this;if(this.state!==w.State.PARSING)return;this.audioOnly=!!c.audio&&!c.video,this.altAudio&&!this.audioOnly&&delete c.audio;var T=c.audio,N=c.video,z=c.audiovideo;if(T){var Y=p.audioCodec,ee=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(Y&&(Y.indexOf("mp4a.40.5")!==-1?Y="mp4a.40.2":Y="mp4a.40.5"),T.metadata.channelCount!==1&&ee.indexOf("firefox")===-1&&(Y="mp4a.40.5")),ee.indexOf("android")!==-1&&T.container!=="audio/mpeg"&&(Y="mp4a.40.2",this.log("Android: force audio codec to "+Y)),p.audioCodec&&p.audioCodec!==Y&&this.log('Swapping manifest audio codec "'+p.audioCodec+'" for "'+Y+'"'),T.levelCodec=Y,T.id="main",this.log("Init audio buffer, container:"+T.container+", codecs[selected/level/parsed]=["+(Y||"")+"/"+(p.audioCodec||"")+"/"+T.codec+"]")}N&&(N.levelCodec=p.videoCodec,N.id="main",this.log("Init video buffer, container:"+N.container+", codecs[level/parsed]=["+(p.videoCodec||"")+"/"+N.codec+"]")),z&&this.log("Init audiovideo buffer, container:"+z.container+", codecs[level/parsed]=["+(p.attrs.CODECS||"")+"/"+z.codec+"]"),this.hls.trigger(H.Events.BUFFER_CODECS,c),Object.keys(c).forEach(function(G){var j=c[G],te=j.initSegment;te!=null&&te.byteLength&&v.hls.trigger(H.Events.BUFFER_APPENDING,{type:G,data:te,frag:o,part:null,chunkMeta:S,parent:o.type})}),this.tick()},x.backtrack=function(p){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(p);var c=this.fragmentTracker.backtrack(p);this.fragPrevious=null,this.nextLoadPosition=p.start,c?this.resetFragmentLoading(p):this.state=w.State.BACKTRACKING},x.checkFragmentChanged=function(){var p=this.media,c=null;if(p&&p.readyState>1&&p.seeking===!1){var o=p.currentTime;if(W.BufferHelper.isBuffered(p,o)?c=this.getAppendedFrag(o):W.BufferHelper.isBuffered(p,o+.1)&&(c=this.getAppendedFrag(o+.1)),c){var S=this.fragPlaying,v=c.level;(!S||c.sn!==S.sn||S.level!==v||c.urlId!==S.urlId)&&(this.hls.trigger(H.Events.FRAG_CHANGED,{frag:c}),(!S||S.level!==v)&&this.hls.trigger(H.Events.LEVEL_SWITCHED,{level:v}),this.fragPlaying=c)}}},a(k,[{key:"nextLevel",get:function(){var p=this.nextBufferedFrag;return p?p.level:-1}},{key:"currentLevel",get:function(){var p=this.media;if(p){var c=this.getAppendedFrag(p.currentTime);if(c)return c.level}return-1}},{key:"nextBufferedFrag",get:function(){var p=this.media;if(p){var c=this.getAppendedFrag(p.currentTime);return this.followingBufferedFrag(c)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),k}(w.default)},"./src/controller/subtitle-stream-controller.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"SubtitleStreamController",function(){return s});var K=D("./src/events.ts"),w=D("./src/utils/logger.ts"),P=D("./src/utils/buffer-helper.ts"),H=D("./src/controller/fragment-finders.ts"),W=D("./src/utils/discontinuities.ts"),I=D("./src/controller/level-helper.ts"),M=D("./src/controller/fragment-tracker.ts"),b=D("./src/controller/base-stream-controller.ts"),A=D("./src/types/loader.ts"),_=D("./src/types/level.ts");function O(d,E){for(var g=0;g<E.length;g++){var m=E[g];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(d,m.key,m)}}function L(d,E,g){return E&&O(d.prototype,E),g&&O(d,g),d}function y(d,E){d.prototype=Object.create(E.prototype),d.prototype.constructor=d,u(d,E)}function u(d,E){return u=Object.setPrototypeOf||function(m,k){return m.__proto__=k,m},u(d,E)}var a=500,s=function(d){y(E,d);function E(m,k){var x;return x=d.call(this,m,k,"[subtitle-stream-controller]")||this,x.levels=[],x.currentTrackId=-1,x.tracksBuffered=[],x.mainDetails=null,x._registerListeners(),x}var g=E.prototype;return g.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},g._registerListeners=function(){var k=this.hls;k.on(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),k.on(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),k.on(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),k.on(K.Events.LEVEL_LOADED,this.onLevelLoaded,this),k.on(K.Events.ERROR,this.onError,this),k.on(K.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),k.on(K.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),k.on(K.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),k.on(K.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),k.on(K.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},g._unregisterListeners=function(){var k=this.hls;k.off(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),k.off(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),k.off(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),k.off(K.Events.LEVEL_LOADED,this.onLevelLoaded,this),k.off(K.Events.ERROR,this.onError,this),k.off(K.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),k.off(K.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),k.off(K.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),k.off(K.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),k.off(K.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},g.startLoad=function(){this.stopLoad(),this.state=b.State.IDLE,this.setInterval(a),this.tick()},g.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},g.onLevelLoaded=function(k,x){this.mainDetails=x.details},g.onSubtitleFragProcessed=function(k,x){var h=x.frag,p=x.success;if(this.fragPrevious=h,this.state=b.State.IDLE,!p)return;var c=this.tracksBuffered[this.currentTrackId];if(!c)return;for(var o,S=h.start,v=0;v<c.length;v++)if(S>=c[v].start&&S<=c[v].end){o=c[v];break}var T=h.start+h.duration;o?o.end=T:(o={start:S,end:T},c.push(o)),this.fragmentTracker.fragBuffered(h)},g.onBufferFlushing=function(k,x){var h=x.startOffset,p=x.endOffset;if(h===0&&p!==Number.POSITIVE_INFINITY){var c=this.currentTrackId,o=this.levels;if(!o.length||!o[c]||!o[c].details)return;var S=o[c].details,v=S.targetduration,T=p-v;if(T<=0)return;x.endOffsetSubtitles=Math.max(0,T),this.tracksBuffered.forEach(function(N){for(var z=0;z<N.length;){if(N[z].end<=T){N.shift();continue}else if(N[z].start<T)N[z].start=T;else break;z++}}),this.fragmentTracker.removeFragmentsInRange(h,T,A.PlaylistLevelType.SUBTITLE)}},g.onError=function(k,x){var h,p=x.frag;if(!p||p.type!==A.PlaylistLevelType.SUBTITLE)return;(h=this.fragCurrent)!==null&&h!==void 0&&h.loader&&this.fragCurrent.loader.abort(),this.state=b.State.IDLE},g.onSubtitleTracksUpdated=function(k,x){var h=this,p=x.subtitleTracks;this.tracksBuffered=[],this.levels=p.map(function(c){return new _.Level(c)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(c){h.tracksBuffered[c.id]=[]}),this.mediaBuffer=null},g.onSubtitleTrackSwitch=function(k,x){if(this.currentTrackId=x.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var h=this.levels[this.currentTrackId];h!=null&&h.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,h&&this.setInterval(a)},g.onSubtitleTrackLoaded=function(k,x){var h,p=x.details,c=x.id,o=this.currentTrackId,S=this.levels;if(!S.length)return;var v=S[o];if(c>=S.length||c!==o||!v)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,p.live||(h=v.details)!==null&&h!==void 0&&h.live){var T=this.mainDetails;if(p.deltaUpdateFailed||!T)return;var N=T.fragments[0];if(!v.details)p.hasProgramDateTime&&T.hasProgramDateTime?Object(W.alignMediaPlaylistByPDT)(p,T):N&&Object(I.addSliding)(p,N.start);else{var z=this.alignPlaylists(p,v.details);z===0&&N&&Object(I.addSliding)(p,N.start)}}if(v.details=p,this.levelLastLoaded=c,this.tick(),p.live&&!this.fragCurrent&&this.media&&this.state===b.State.IDLE){var Y=Object(H.findFragmentByPTS)(null,p.fragments,this.media.currentTime,0);Y||(this.warn("Subtitle playlist not aligned with playback"),v.details=void 0)}},g._handleFragmentLoadComplete=function(k){var x=k.frag,h=k.payload,p=x.decryptdata,c=this.hls;if(this.fragContextChanged(x))return;if(h&&h.byteLength>0&&p&&p.key&&p.iv&&p.method==="AES-128"){var o=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(h),p.key.buffer,p.iv.buffer).then(function(S){var v=performance.now();c.trigger(K.Events.FRAG_DECRYPTED,{frag:x,payload:S,stats:{tstart:o,tdecrypt:v}})})}},g.doTick=function(){if(!this.media){this.state=b.State.IDLE;return}if(this.state===b.State.IDLE){var k,x=this.currentTrackId,h=this.levels;if(!h.length||!h[x]||!h[x].details)return;var p=h[x].details,c=p.targetduration,o=this.config,S=this.media,v=P.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,S.currentTime-c,o.maxBufferHole),T=v.end,N=v.len,z=this.getMaxBufferLength()+c;if(N>z)return;console.assert(p,"Subtitle track details are defined on idle subtitle stream controller tick");var Y=p.fragments,ee=Y.length,G=p.edge,j,te=this.fragPrevious;if(T<G){var de=o.maxFragLookUpTolerance;te&&p.hasProgramDateTime&&(j=Object(H.findFragmentByPDT)(Y,te.endProgramDateTime,de)),j||(j=Object(H.findFragmentByPTS)(te,Y,T,de),!j&&te&&te.start<Y[0].start&&(j=Y[0]))}else j=Y[ee-1];(k=j)!==null&&k!==void 0&&k.encrypted?(w.logger.log("Loading key for "+j.sn),this.state=b.State.KEY_LOADING,this.hls.trigger(K.Events.KEY_LOADING,{frag:j})):j&&this.fragmentTracker.getState(j)===M.FragmentState.NOT_LOADED&&this.loadFragment(j,p,T)}},g.loadFragment=function(k,x,h){this.fragCurrent=k,d.prototype.loadFragment.call(this,k,x,h)},L(E,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),E}(b.default)},"./src/controller/subtitle-track-controller.ts":function(ae,X,D){"use strict";D.r(X);var K=D("./src/events.ts"),w=D("./src/utils/texttrack-utils.ts"),P=D("./src/controller/base-playlist-controller.ts"),H=D("./src/types/loader.ts");function W(O,L){for(var y=0;y<L.length;y++){var u=L[y];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(O,u.key,u)}}function I(O,L,y){return L&&W(O.prototype,L),y&&W(O,y),O}function M(O,L){O.prototype=Object.create(L.prototype),O.prototype.constructor=O,b(O,L)}function b(O,L){return b=Object.setPrototypeOf||function(u,a){return u.__proto__=a,u},b(O,L)}var A=function(O){M(L,O);function L(u){var a;return a=O.call(this,u,"[subtitle-track-controller]")||this,a.media=null,a.tracks=[],a.groupId=null,a.tracksInGroup=[],a.trackId=-1,a.selectDefaultTrack=!0,a.queuedDefaultTrack=-1,a.trackChangeListener=function(){return a.onTextTracksChanged()},a.asyncPollTrackChange=function(){return a.pollTrackChange(0)},a.useTextTrackPolling=!1,a.subtitlePollingInterval=-1,a.subtitleDisplay=!0,a.registerListeners(),a}var y=L.prototype;return y.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,O.prototype.destroy.call(this)},y.registerListeners=function(){var a=this.hls;a.on(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.on(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.on(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.on(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.on(K.Events.LEVEL_LOADING,this.onLevelLoading,this),a.on(K.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),a.on(K.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),a.on(K.Events.ERROR,this.onError,this)},y.unregisterListeners=function(){var a=this.hls;a.off(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.off(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.off(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.off(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.off(K.Events.LEVEL_LOADING,this.onLevelLoading,this),a.off(K.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),a.off(K.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),a.off(K.Events.ERROR,this.onError,this)},y.onMediaAttached=function(a,s){if(this.media=s.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)},y.pollTrackChange=function(a){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,a)},y.onMediaDetaching=function(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId);var a=_(this.media.textTracks);a.forEach(function(s){Object(w.clearCurrentCues)(s)}),this.subtitleTrack=-1,this.media=null},y.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},y.onManifestParsed=function(a,s){this.tracks=s.subtitleTracks},y.onSubtitleTrackLoaded=function(a,s){var d=s.id,E=s.details,g=this.trackId,m=this.tracksInGroup[g];if(!m){this.warn("Invalid subtitle track id "+d);return}var k=m.details;m.details=s.details,this.log("subtitle track "+d+" loaded ["+E.startSN+"-"+E.endSN+"]"),d===this.trackId&&(this.retryCount=0,this.playlistLoaded(d,s,k))},y.onLevelLoading=function(a,s){this.switchLevel(s.level)},y.onLevelSwitching=function(a,s){this.switchLevel(s.level)},y.switchLevel=function(a){var s=this.hls.levels[a];if(!(s!=null&&s.textGroupIds))return;var d=s.textGroupIds[s.urlId];if(this.groupId!==d){var E=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,g=this.tracks.filter(function(x){return!d||x.groupId===d});this.tracksInGroup=g;var m=this.findTrackId(E==null?void 0:E.name)||this.findTrackId();this.groupId=d;var k={subtitleTracks:g};this.log("Updating subtitle tracks, "+g.length+' track(s) found in "'+d+'" group-id'),this.hls.trigger(K.Events.SUBTITLE_TRACKS_UPDATED,k),m!==-1&&this.setSubtitleTrack(m,E)}},y.findTrackId=function(a){for(var s=this.tracksInGroup,d=0;d<s.length;d++){var E=s[d];if((!this.selectDefaultTrack||E.default)&&(!a||a===E.name))return E.id}return-1},y.onError=function(a,s){if(O.prototype.onError.call(this,a,s),s.fatal||!s.context)return;s.context.type===H.PlaylistContextType.SUBTITLE_TRACK&&s.context.id===this.trackId&&s.context.groupId===this.groupId&&this.retryLoadingOrFail(s)},y.loadPlaylist=function(a){var s=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(s)){var d=s.id,E=s.groupId,g=s.url;if(a)try{g=a.addDirectives(g)}catch(m){this.warn("Could not construct new URL with HLS Delivery Directives: "+m)}this.log("Loading subtitle playlist for id "+d),this.hls.trigger(K.Events.SUBTITLE_TRACK_LOADING,{url:g,id:d,groupId:E,deliveryDirectives:a||null})}},y.toggleTrackModes=function(a){var s=this,d=this.media,E=this.subtitleDisplay,g=this.trackId;if(!d)return;var m=_(d.textTracks),k=m.filter(function(p){return p.groupId===s.groupId});if(a===-1)[].slice.call(m).forEach(function(p){p.mode="disabled"});else{var x=k[g];x&&(x.mode="disabled")}var h=k[a];h&&(h.mode=E?"showing":"hidden")},y.setSubtitleTrack=function(a,s){var d,E=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=a;return}if(this.trackId!==a&&this.toggleTrackModes(a),this.trackId===a&&(a===-1||(d=E[a])!==null&&d!==void 0&&d.details)||a<-1||a>=E.length)return;this.clearTimer();var g=E[a];if(this.log("Switching to subtitle track "+a),this.trackId=a,g){var m=g.id,k=g.groupId,x=k===void 0?"":k,h=g.name,p=g.type,c=g.url;this.hls.trigger(K.Events.SUBTITLE_TRACK_SWITCH,{id:m,groupId:x,name:h,type:p,url:c});var o=this.switchParams(g.url,s==null?void 0:s.details);this.loadPlaylist(o)}else this.hls.trigger(K.Events.SUBTITLE_TRACK_SWITCH,{id:a})},y.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var a=-1,s=_(this.media.textTracks),d=0;d<s.length;d++)if(s[d].mode==="hidden")a=d;else if(s[d].mode==="showing"){a=d;break}this.subtitleTrack!==a&&(this.subtitleTrack=a)},I(L,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(a){this.selectDefaultTrack=!1;var s=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(a,s)}}]),L}(P.default);function _(O){for(var L=[],y=0;y<O.length;y++){var u=O[y];u.kind==="subtitles"&&u.label&&L.push(O[y])}return L}X.default=A},"./src/controller/timeline-controller.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"TimelineController",function(){return _});var K=D("./src/polyfills/number.ts"),w=D("./src/events.ts"),P=D("./src/utils/cea-608-parser.ts"),H=D("./src/utils/output-filter.ts"),W=D("./src/utils/webvtt-parser.ts"),I=D("./src/utils/texttrack-utils.ts"),M=D("./src/utils/imsc1-ttml-parser.ts"),b=D("./src/types/loader.ts"),A=D("./src/utils/logger.ts"),_=function(){function u(s){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=y(),this.captionsProperties=void 0,this.hls=s,this.config=s.config,this.Cues=s.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 d=new H.default(this,"textTrack1"),E=new H.default(this,"textTrack2"),g=new H.default(this,"textTrack3"),m=new H.default(this,"textTrack4");this.cea608Parser1=new P.default(1,d,E),this.cea608Parser2=new P.default(3,g,m)}s.on(w.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),s.on(w.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.on(w.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.on(w.Events.MANIFEST_LOADED,this.onManifestLoaded,this),s.on(w.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),s.on(w.Events.FRAG_LOADING,this.onFragLoading,this),s.on(w.Events.FRAG_LOADED,this.onFragLoaded,this),s.on(w.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),s.on(w.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),s.on(w.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),s.on(w.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),s.on(w.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var a=u.prototype;return a.destroy=function(){var d=this.hls;d.off(w.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),d.off(w.Events.MEDIA_DETACHING,this.onMediaDetaching,this),d.off(w.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.off(w.Events.MANIFEST_LOADED,this.onManifestLoaded,this),d.off(w.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),d.off(w.Events.FRAG_LOADING,this.onFragLoading,this),d.off(w.Events.FRAG_LOADED,this.onFragLoaded,this),d.off(w.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),d.off(w.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),d.off(w.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),d.off(w.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),d.off(w.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},a.addCues=function(d,E,g,m,k){for(var x=!1,h=k.length;h--;){var p=k[h],c=L(p[0],p[1],E,g);if(c>=0&&(p[0]=Math.min(p[0],E),p[1]=Math.max(p[1],g),x=!0,c/(g-E)>.5))return}if(x||k.push([E,g]),this.config.renderTextTracksNatively){var o=this.captionsTracks[d];this.Cues.newCue(o,E,g,m)}else{var S=this.Cues.newCue(null,E,g,m);this.hls.trigger(w.Events.CUES_PARSED,{type:"captions",cues:S,track:d})}},a.onInitPtsFound=function(d,E){var g=this,m=E.frag,k=E.id,x=E.initPTS,h=E.timescale,p=this.unparsedVttFrags;k==="main"&&(this.initPTS[m.cc]=x,this.timescale[m.cc]=h),p.length&&(this.unparsedVttFrags=[],p.forEach(function(c){g.onFragLoaded(w.Events.FRAG_LOADED,c)}))},a.getExistingTrack=function(d){var E=this.media;if(E)for(var g=0;g<E.textTracks.length;g++){var m=E.textTracks[g];if(m[d])return m}return null},a.createCaptionsTrack=function(d){this.config.renderTextTracksNatively?this.createNativeTrack(d):this.createNonNativeTrack(d)},a.createNativeTrack=function(d){if(this.captionsTracks[d])return;var E=this.captionsProperties,g=this.captionsTracks,m=this.media,k=E[d],x=k.label,h=k.languageCode,p=this.getExistingTrack(d);if(p)g[d]=p,Object(I.clearCurrentCues)(g[d]),Object(I.sendAddTrackEvent)(g[d],m);else{var c=this.createTextTrack("captions",x,h);c&&(c[d]=!0,g[d]=c)}},a.createNonNativeTrack=function(d){if(this.nonNativeCaptionsTracks[d])return;var E=this.captionsProperties[d];if(!E)return;var g=E.label,m={_id:d,label:g,kind:"captions",default:E.media?!!E.media.default:!1,closedCaptions:E.media};this.nonNativeCaptionsTracks[d]=m,this.hls.trigger(w.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[m]})},a.createTextTrack=function(d,E,g){var m=this.media;return m?m.addTextTrack(d,E,g):void 0},a.onMediaAttaching=function(d,E){this.media=E.media,this._cleanTracks()},a.onMediaDetaching=function(){var d=this.captionsTracks;Object.keys(d).forEach(function(E){Object(I.clearCurrentCues)(d[E]),delete d[E]}),this.nonNativeCaptionsTracks={}},a.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=y(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=[],this.timescale=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},a._cleanTracks=function(){var d=this.media;if(!d)return;var E=d.textTracks;if(E)for(var g=0;g<E.length;g++)Object(I.clearCurrentCues)(E[g])},a.onSubtitleTracksUpdated=function(d,E){var g=this;this.textTracks=[];var m=E.subtitleTracks||[],k=m.some(function(c){return c.textCodec===M.IMSC1_CODEC});if(this.config.enableWebVTT||k&&this.config.enableIMSC1){var x=this.tracks&&m&&this.tracks.length===m.length;if(this.tracks=m||[],this.config.renderTextTracksNatively){var h=this.media?this.media.textTracks:[];this.tracks.forEach(function(c,o){var S;if(o<h.length){for(var v=null,T=0;T<h.length;T++)if(O(h[T],c)){v=h[T];break}v&&(S=v)}S?Object(I.clearCurrentCues)(S):(S=g.createTextTrack("subtitles",c.name,c.lang),S&&(S.mode="disabled")),S&&(S.groupId=c.groupId,g.textTracks.push(S))})}else if(!x&&this.tracks&&this.tracks.length){var p=this.tracks.map(function(c){return{label:c.name,kind:c.type.toLowerCase(),default:c.default,subtitleTrack:c}});this.hls.trigger(w.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:p})}}},a.onManifestLoaded=function(d,E){var g=this;this.config.enableCEA708Captions&&E.captions&&E.captions.forEach(function(m){var k=/(?:CC|SERVICE)([1-4])/.exec(m.instreamId);if(!k)return;var x="textTrack"+k[1],h=g.captionsProperties[x];if(!h)return;h.label=m.name,m.lang&&(h.languageCode=m.lang),h.media=m})},a.onFragLoading=function(d,E){var g=this.cea608Parser1,m=this.cea608Parser2,k=this.lastSn,x=this.lastPartIndex;if(!this.enabled||!(g&&m))return;if(E.frag.type===b.PlaylistLevelType.MAIN){var h,p,c=E.frag.sn,o=(h=E==null||((p=E.part)===null||p===void 0)?void 0:p.index)!=null?h:-1;c===k+1||c===k&&o===x+1||(g.reset(),m.reset()),this.lastSn=c,this.lastPartIndex=o}},a.onFragLoaded=function(d,E){var g=E.frag,m=E.payload,k=this.initPTS,x=this.unparsedVttFrags;if(g.type===b.PlaylistLevelType.SUBTITLE)if(m.byteLength){if(!Object(K.isFiniteNumber)(k[g.cc])){x.push(E),k.length&&this.hls.trigger(w.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:g,error:new Error("Missing initial subtitle PTS")});return}var h=g.decryptdata;if(h==null||h.key==null||h.method!=="AES-128"){var p=this.tracks[g.level],c=this.vttCCs;c[g.cc]||(c[g.cc]={start:g.start,prevCC:this.prevCC,new:!0},this.prevCC=g.cc),p&&p.textCodec===M.IMSC1_CODEC?this._parseIMSC1(g,m):this._parseVTTs(g,m,c)}}else this.hls.trigger(w.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:g,error:new Error("Empty subtitle payload")})},a._parseIMSC1=function(d,E){var g=this,m=this.hls;Object(M.parseIMSC1)(E,this.initPTS[d.cc],this.timescale[d.cc],function(k){g._appendCues(k,d.level),m.trigger(w.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:d})},function(k){A.logger.log("Failed to parse IMSC1: "+k),m.trigger(w.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:d,error:k})})},a._parseVTTs=function(d,E,g){var m=this,k=this.hls;Object(W.parseWebVTT)(E,this.initPTS[d.cc],this.timescale[d.cc],g,d.cc,d.start,function(x){m._appendCues(x,d.level),k.trigger(w.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:d})},function(x){m._fallbackToIMSC1(d,E),A.logger.log("Failed to parse VTT cue: "+x),k.trigger(w.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:d,error:x})})},a._fallbackToIMSC1=function(d,E){var g=this,m=this.tracks[d.level];m.textCodec||Object(M.parseIMSC1)(E,this.initPTS[d.cc],this.timescale[d.cc],function(){m.textCodec=M.IMSC1_CODEC,g._parseIMSC1(d,E)},function(){m.textCodec="wvtt"})},a._appendCues=function(d,E){var g=this.hls;if(this.config.renderTextTracksNatively){var m=this.textTracks[E];if(m.mode==="disabled")return;d.forEach(function(h){return Object(I.addCueToTrack)(m,h)})}else{var k=this.tracks[E],x=k.default?"default":"subtitles"+E;g.trigger(w.Events.CUES_PARSED,{type:"subtitles",cues:d,track:x})}},a.onFragDecrypted=function(d,E){var g=E.frag;if(g.type===b.PlaylistLevelType.SUBTITLE){if(!Object(K.isFiniteNumber)(this.initPTS[g.cc])){this.unparsedVttFrags.push(E);return}this.onFragLoaded(w.Events.FRAG_LOADED,E)}},a.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},a.onFragParsingUserdata=function(d,E){var g=this.cea608Parser1,m=this.cea608Parser2;if(!this.enabled||!(g&&m))return;for(var k=0;k<E.samples.length;k++){var x=E.samples[k].bytes;if(x){var h=this.extractCea608Data(x);g.addData(E.samples[k].pts,h[0]),m.addData(E.samples[k].pts,h[1])}}},a.onBufferFlushing=function(d,E){var g=E.startOffset,m=E.endOffset,k=E.endOffsetSubtitles,x=E.type,h=this.media;if(!h||h.currentTime<m)return;if(!x||x==="video"){var p=this.captionsTracks;Object.keys(p).forEach(function(o){return Object(I.removeCuesInRange)(p[o],g,m)})}if(this.config.renderTextTracksNatively&&(g===0&&k!==void 0)){var c=this.textTracks;Object.keys(c).forEach(function(o){return Object(I.removeCuesInRange)(c[o],g,k)})}},a.extractCea608Data=function(d){for(var E=d[0]&31,g=2,m=[[],[]],k=0;k<E;k++){var x=d[g++],h=127&d[g++],p=127&d[g++],c=(4&x)!==0,o=3&x;if(h===0&&p===0)continue;c&&((o===0||o===1)&&(m[o].push(h),m[o].push(p)))}return m},u}();function O(u,a){return u&&u.label===a.name&&!(u.textTrack1||u.textTrack2)}function L(u,a,s,d){return Math.min(a,d)-Math.max(u,s)}function y(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"default",function(){return K});var K=function(){function w(H,W){this.subtle=void 0,this.aesIV=void 0,this.subtle=H,this.aesIV=W}var P=w.prototype;return P.decrypt=function(W,I){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},I,W)},w}()},"./src/crypt/aes-decryptor.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"removePadding",function(){return w}),D.d(X,"default",function(){return P});var K=D("./src/utils/typed-array.ts");function w(H){var W=H.byteLength,I=W&&new DataView(H.buffer).getUint8(W-1);return I?Object(K.sliceUint8)(H,0,W-I):H}var P=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 W=H.prototype;return W.uint8ArrayToUint32Array_=function(M){for(var b=new DataView(M),A=new Uint32Array(4),_=0;_<4;_++)A[_]=b.getUint32(_*4);return A},W.initTable=function(){var M=this.sBox,b=this.invSBox,A=this.subMix,_=A[0],O=A[1],L=A[2],y=A[3],u=this.invSubMix,a=u[0],s=u[1],d=u[2],E=u[3],g=new Uint32Array(256),m=0,k=0,x=0;for(x=0;x<256;x++)x<128?g[x]=x<<1:g[x]=x<<1^283;for(x=0;x<256;x++){var h=k^k<<1^k<<2^k<<3^k<<4;h=h>>>8^h&255^99,M[m]=h,b[h]=m;var p=g[m],c=g[p],o=g[c],S=g[h]*257^h*16843008;_[m]=S<<24|S>>>8,O[m]=S<<16|S>>>16,L[m]=S<<8|S>>>24,y[m]=S,S=o*16843009^c*65537^p*257^m*16843008,a[h]=S<<24|S>>>8,s[h]=S<<16|S>>>16,d[h]=S<<8|S>>>24,E[h]=S,m?(m=p^g[g[g[o^p]]],k^=g[g[k]]):m=k=1}},W.expandKey=function(M){for(var b=this.uint8ArrayToUint32Array_(M),A=!0,_=0;_<b.length&&A;)A=b[_]===this.key[_],_++;if(A)return;this.key=b;var O=this.keySize=b.length;if(O!==4&&O!==6&&O!==8)throw new Error("Invalid aes key size="+O);var L=this.ksRows=(O+6+1)*4,y,u,a=this.keySchedule=new Uint32Array(L),s=this.invKeySchedule=new Uint32Array(L),d=this.sBox,E=this.rcon,g=this.invSubMix,m=g[0],k=g[1],x=g[2],h=g[3],p,c;for(y=0;y<L;y++){if(y<O){p=a[y]=b[y];continue}c=p,y%O===0?(c=c<<8|c>>>24,c=d[c>>>24]<<24|d[c>>>16&255]<<16|d[c>>>8&255]<<8|d[c&255],c^=E[y/O|0]<<24):O>6&&y%O===4&&(c=d[c>>>24]<<24|d[c>>>16&255]<<16|d[c>>>8&255]<<8|d[c&255]),a[y]=p=(a[y-O]^c)>>>0}for(u=0;u<L;u++)y=L-u,u&3?c=a[y]:c=a[y-4],u<4||y<=4?s[u]=c:s[u]=m[d[c>>>24]]^k[d[c>>>16&255]]^x[d[c>>>8&255]]^h[d[c&255]],s[u]=s[u]>>>0},W.networkToHostOrderSwap=function(M){return M<<24|(M&65280)<<8|(M&16711680)>>8|M>>>24},W.decrypt=function(M,b,A){for(var _=this.keySize+6,O=this.invKeySchedule,L=this.invSBox,y=this.invSubMix,u=y[0],a=y[1],s=y[2],d=y[3],E=this.uint8ArrayToUint32Array_(A),g=E[0],m=E[1],k=E[2],x=E[3],h=new Int32Array(M),p=new Int32Array(h.length),c,o,S,v,T,N,z,Y,ee,G,j,te,de,be,Oe=this.networkToHostOrderSwap;b<h.length;){for(ee=Oe(h[b]),G=Oe(h[b+1]),j=Oe(h[b+2]),te=Oe(h[b+3]),T=ee^O[0],N=te^O[1],z=j^O[2],Y=G^O[3],de=4,be=1;be<_;be++)c=u[T>>>24]^a[N>>16&255]^s[z>>8&255]^d[Y&255]^O[de],o=u[N>>>24]^a[z>>16&255]^s[Y>>8&255]^d[T&255]^O[de+1],S=u[z>>>24]^a[Y>>16&255]^s[T>>8&255]^d[N&255]^O[de+2],v=u[Y>>>24]^a[T>>16&255]^s[N>>8&255]^d[z&255]^O[de+3],T=c,N=o,z=S,Y=v,de=de+4;c=L[T>>>24]<<24^L[N>>16&255]<<16^L[z>>8&255]<<8^L[Y&255]^O[de],o=L[N>>>24]<<24^L[z>>16&255]<<16^L[Y>>8&255]<<8^L[T&255]^O[de+1],S=L[z>>>24]<<24^L[Y>>16&255]<<16^L[T>>8&255]<<8^L[N&255]^O[de+2],v=L[Y>>>24]<<24^L[T>>16&255]<<16^L[N>>8&255]<<8^L[z&255]^O[de+3],p[b]=Oe(c^g),p[b+1]=Oe(v^m),p[b+2]=Oe(S^k),p[b+3]=Oe(o^x),g=ee,m=G,k=j,x=te,b=b+4}return p.buffer},H}()},"./src/crypt/decrypter.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"default",function(){return b});var K=D("./src/crypt/aes-crypto.ts"),w=D("./src/crypt/fast-aes-key.ts"),P=D("./src/crypt/aes-decryptor.ts"),H=D("./src/utils/logger.ts"),W=D("./src/utils/mp4-tools.ts"),I=D("./src/utils/typed-array.ts"),M=16,b=function(){function A(O,L,y){var u=y===void 0?{}:y,a=u.removePKCS7Padding,s=a===void 0?!0:a;if(this.logEnabled=!0,this.observer=void 0,this.config=void 0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.observer=O,this.config=L,this.removePKCS7Padding=s,s)try{var d=self.crypto;d&&(this.subtle=d.subtle||d.webkitSubtle)}catch(E){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var _=A.prototype;return _.destroy=function(){this.observer=null},_.isSync=function(){return this.config.enableSoftwareAES},_.flush=function(){var L=this.currentResult;if(!L){this.reset();return}var y=new Uint8Array(L);return this.reset(),this.removePKCS7Padding?Object(P.removePadding)(y):y},_.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},_.decrypt=function(L,y,u,a){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(L),y,u);var s=this.flush();s&&a(s.buffer)}else this.webCryptoDecrypt(new Uint8Array(L),y,u).then(a)},_.softwareDecrypt=function(L,y,u){var a=this.currentIV,s=this.currentResult,d=this.remainderData;this.logOnce("JS AES decrypt"),d&&(L=Object(W.appendUint8Array)(d,L),this.remainderData=null);var E=this.getValidChunk(L);if(!E.length)return null;a&&(u=a);var g=this.softwareDecrypter;g||(g=this.softwareDecrypter=new P.default),g.expandKey(y);var m=s;return this.currentResult=g.decrypt(E.buffer,0,u),this.currentIV=Object(I.sliceUint8)(E,-16).buffer,m||null},_.webCryptoDecrypt=function(L,y,u){var a=this,s=this.subtle;return(this.key!==y||!this.fastAesKey)&&(this.key=y,this.fastAesKey=new w.default(s,y)),this.fastAesKey.expandKey().then(function(d){if(!s)return Promise.reject(new Error("web crypto not initialized"));var E=new K.default(s,u);return E.decrypt(L.buffer,d)}).catch(function(d){return a.onWebCryptoError(d,L,y,u)})},_.onWebCryptoError=function(L,y,u,a){return H.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",L),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(y,u,a)},_.getValidChunk=function(L){var y=L,u=L.length-L.length%M;return u!==L.length&&(y=Object(I.sliceUint8)(L,0,u),this.remainderData=Object(I.sliceUint8)(L,u)),y},_.logOnce=function(L){if(!this.logEnabled)return;H.logger.log("[decrypter.ts]: "+L),this.logEnabled=!1},A}()},"./src/crypt/fast-aes-key.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"default",function(){return K});var K=function(){function w(H,W){this.subtle=void 0,this.key=void 0,this.subtle=H,this.key=W}var P=w.prototype;return P.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},w}()},"./src/demux/aacdemuxer.ts":function(ae,X,D){"use strict";D.r(X);var K=D("./src/demux/base-audio-demuxer.ts"),w=D("./src/demux/adts.ts"),P=D("./src/utils/logger.ts"),H=D("./src/demux/id3.ts");function W(b,A){b.prototype=Object.create(A.prototype),b.prototype.constructor=b,I(b,A)}function I(b,A){return I=Object.setPrototypeOf||function(O,L){return O.__proto__=L,O},I(b,A)}var M=function(b){W(A,b);function A(O,L){var y;return y=b.call(this)||this,y.observer=void 0,y.config=void 0,y.observer=O,y.config=L,y}var _=A.prototype;return _.resetInitSegment=function(L,y,u){b.prototype.resetInitSegment.call(this,L,y,u),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:L,duration:u,inputTimeScale:9e4,dropped:0}},A.probe=function(L){if(!L)return!1;for(var y=H.getID3Data(L,0)||[],u=y.length,a=L.length;u<a;u++)if(w.probe(L,u))return P.logger.log("ADTS sync word found !"),!0;return!1},_.canParse=function(L,y){return w.canParse(L,y)},_.appendFrame=function(L,y,u){w.initTrackConfig(L,this.observer,y,u,L.manifestCodec);var a=w.appendFrame(L,y,u,this.initPTS,this.frameIndex);if(a&&a.missing===0)return a},A}(K.default);M.minProbeByteLength=9,X.default=M},"./src/demux/adts.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"getAudioConfig",function(){return H}),D.d(X,"isHeaderPattern",function(){return W}),D.d(X,"getHeaderLength",function(){return I}),D.d(X,"getFullFrameLength",function(){return M}),D.d(X,"canGetFrameLength",function(){return b}),D.d(X,"isHeader",function(){return A}),D.d(X,"canParse",function(){return _}),D.d(X,"probe",function(){return O}),D.d(X,"initTrackConfig",function(){return L}),D.d(X,"getFrameDuration",function(){return y}),D.d(X,"parseFrameHeader",function(){return u}),D.d(X,"appendFrame",function(){return a});var K=D("./src/utils/logger.ts"),w=D("./src/errors.ts"),P=D("./src/events.ts");function H(s,d,E,g){var m,k,x,h,p=navigator.userAgent.toLowerCase(),c=g,o=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];m=((d[E+2]&192)>>>6)+1;var S=(d[E+2]&60)>>>2;if(S>o.length-1){s.trigger(P.Events.ERROR,{type:w.ErrorTypes.MEDIA_ERROR,details:w.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+S});return}return x=(d[E+2]&1)<<2,x|=(d[E+3]&192)>>>6,K.logger.log("manifest codec:"+g+", ADTS type:"+m+", samplingIndex:"+S),/firefox/i.test(p)?S>=6?(m=5,h=new Array(4),k=S-3):(m=2,h=new Array(2),k=S):p.indexOf("android")!==-1?(m=2,h=new Array(2),k=S):(m=5,h=new Array(4),g&&(g.indexOf("mp4a.40.29")!==-1||g.indexOf("mp4a.40.5")!==-1)||!g&&S>=6?k=S-3:((g&&g.indexOf("mp4a.40.2")!==-1&&(S>=6&&x===1||/vivaldi/i.test(p))||!g&&x===1)&&(m=2,h=new Array(2)),k=S)),h[0]=m<<3,h[0]|=(S&14)>>1,h[1]|=(S&1)<<7,h[1]|=x<<3,m===5&&(h[1]|=(k&14)>>1,h[2]=(k&1)<<7,h[2]|=2<<2,h[3]=0),{config:h,samplerate:o[S],channelCount:x,codec:"mp4a.40."+m,manifestCodec:c}}function W(s,d){return s[d]===255&&(s[d+1]&246)===240}function I(s,d){return s[d+1]&1?7:9}function M(s,d){return(s[d+3]&3)<<11|s[d+4]<<3|(s[d+5]&224)>>>5}function b(s,d){return d+5<s.length}function A(s,d){return d+1<s.length&&W(s,d)}function _(s,d){return b(s,d)&&W(s,d)&&M(s,d)<=s.length-d}function O(s,d){if(A(s,d)){var E=I(s,d);if(d+E>=s.length)return!1;var g=M(s,d);if(g<=E)return!1;var m=d+g;return m===s.length||A(s,m)}return!1}function L(s,d,E,g,m){if(!s.samplerate){var k=H(d,E,g,m);if(!k)return;s.config=k.config,s.samplerate=k.samplerate,s.channelCount=k.channelCount,s.codec=k.codec,s.manifestCodec=k.manifestCodec,K.logger.log("parsed codec:"+s.codec+", rate:"+k.samplerate+", channels:"+k.channelCount)}}function y(s){return 1024*9e4/s}function u(s,d,E,g,m){var k=I(s,d),x=M(s,d);if(x-=k,x>0){var h=E+g*m;return{headerLength:k,frameLength:x,stamp:h}}}function a(s,d,E,g,m){var k=y(s.samplerate),x=u(d,E,g,m,k);if(x){var h=x.frameLength,p=x.headerLength,c=x.stamp,o=p+h,S=Math.max(0,E+o-d.length),v;S?(v=new Uint8Array(o-p),v.set(d.subarray(E+p,d.length),0)):v=d.subarray(E+p,E+o);var T={unit:v,pts:c};return S||s.samples.push(T),{sample:T,length:o,missing:S}}}},"./src/demux/base-audio-demuxer.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"initPTSFn",function(){return M});var K=D("./src/polyfills/number.ts"),w=D("./src/demux/id3.ts"),P=D("./src/demux/dummy-demuxed-track.ts"),H=D("./src/utils/mp4-tools.ts"),W=D("./src/utils/typed-array.ts"),I=function(){function b(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var A=b.prototype;return A.resetInitSegment=function(O,L,y){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},A.resetTimeStamp=function(){},A.resetContiguity=function(){},A.canParse=function(O,L){return!1},A.appendFrame=function(O,L,y){},A.demux=function(O,L){this.cachedData&&(O=Object(H.appendUint8Array)(this.cachedData,O),this.cachedData=null);var y=w.getID3Data(O,0),u=y?y.length:0,a,s,d=this._audioTrack,E=this._id3Track,g=y?w.getTimeStamp(y):void 0,m=O.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=M(g,L)),y&&y.length>0&&E.samples.push({pts:this.initPTS,dts:this.initPTS,data:y}),s=this.initPTS;u<m;){if(this.canParse(O,u)){var k=this.appendFrame(d,O,u);k?(this.frameIndex++,s=k.sample.pts,u+=k.length,a=u):u=m}else w.canParse(O,u)?(y=w.getID3Data(O,u),E.samples.push({pts:s,dts:s,data:y}),u+=y.length,a=u):u++;if(u===m&&a!==m){var x=Object(W.sliceUint8)(O,a);this.cachedData?this.cachedData=Object(H.appendUint8Array)(this.cachedData,x):this.cachedData=x}}return{audioTrack:d,avcTrack:Object(P.dummyTrack)(),id3Track:E,textTrack:Object(P.dummyTrack)()}},A.demuxSampleAes=function(O,L,y){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},A.flush=function(O){var L=this.cachedData;return L&&(this.cachedData=null,this.demux(L,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(P.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(P.dummyTrack)()}},A.destroy=function(){},b}(),M=function(A,_){return Object(K.isFiniteNumber)(A)?A*90:_*9e4};X.default=I},"./src/demux/chunk-cache.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"default",function(){return K});var K=function(){function P(){this.chunks=[],this.dataLength=0}var H=P.prototype;return H.push=function(I){this.chunks.push(I),this.dataLength+=I.length},H.flush=function(){var I=this.chunks,M=this.dataLength,b;if(I.length)I.length===1?b=I[0]:b=w(I,M);else return new Uint8Array(0);return this.reset(),b},H.reset=function(){this.chunks.length=0,this.dataLength=0},P}();function w(P,H){for(var W=new Uint8Array(H),I=0,M=0;M<P.length;M++){var b=P[M];W.set(b,I),I+=b.length}return W}},"./src/demux/dummy-demuxed-track.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"dummyTrack",function(){return K});function K(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(ae,X,D){"use strict";D.r(X);var K=D("./src/utils/logger.ts"),w=function(){function P(W){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=W,this.bytesAvailable=W.byteLength,this.word=0,this.bitsAvailable=0}var H=P.prototype;return H.loadWord=function(){var I=this.data,M=this.bytesAvailable,b=I.byteLength-M,A=new Uint8Array(4),_=Math.min(4,M);if(_===0)throw new Error("no bytes available");A.set(I.subarray(b,b+_)),this.word=new DataView(A.buffer).getUint32(0),this.bitsAvailable=_*8,this.bytesAvailable-=_},H.skipBits=function(I){var M;this.bitsAvailable>I?(this.word<<=I,this.bitsAvailable-=I):(I-=this.bitsAvailable,M=I>>3,I-=M>>3,this.bytesAvailable-=M,this.loadWord(),this.word<<=I,this.bitsAvailable-=I)},H.readBits=function(I){var M=Math.min(this.bitsAvailable,I),b=this.word>>>32-M;return I>32&&K.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=M,this.bitsAvailable>0?this.word<<=M:this.bytesAvailable>0&&this.loadWord(),M=I-M,M>0&&this.bitsAvailable?b<<M|this.readBits(M):b},H.skipLZ=function(){var I;for(I=0;I<this.bitsAvailable;++I)if((this.word&2147483648>>>I)!==0)return this.word<<=I,this.bitsAvailable-=I,I;return this.loadWord(),I+this.skipLZ()},H.skipUEG=function(){this.skipBits(1+this.skipLZ())},H.skipEG=function(){this.skipBits(1+this.skipLZ())},H.readUEG=function(){var I=this.skipLZ();return this.readBits(I+1)-1},H.readEG=function(){var I=this.readUEG();return 1&I?1+I>>>1:-1*(I>>>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(I){for(var M=8,b=8,A,_=0;_<I;_++)b!==0&&(A=this.readEG(),b=(M+A+256)%256),M=b===0?M:b},H.readSPS=function(){var I=0,M=0,b=0,A=0,_,O,L,y=this.readUByte.bind(this),u=this.readBits.bind(this),a=this.readUEG.bind(this),s=this.readBoolean.bind(this),d=this.skipBits.bind(this),E=this.skipEG.bind(this),g=this.skipUEG.bind(this),m=this.skipScalingList.bind(this);y();var k=y();if(u(5),d(3),y(),g(),k===100||k===110||k===122||k===244||k===44||k===83||k===86||k===118||k===128){var x=a();if(x===3&&d(1),g(),g(),d(1),s())for(O=x!==3?8:12,L=0;L<O;L++)s()&&(L<6?m(16):m(64))}g();var h=a();if(h===0)a();else if(h===1)for(d(1),E(),E(),_=a(),L=0;L<_;L++)E();g(),d(1);var p=a(),c=a(),o=u(1);o===0&&d(1),d(1),s()&&(I=a(),M=a(),b=a(),A=a());var S=[1,1];if(s()&&s()){var v=y();switch(v){case 1:S=[1,1];break;case 2:S=[12,11];break;case 3:S=[10,11];break;case 4:S=[16,11];break;case 5:S=[40,33];break;case 6:S=[24,11];break;case 7:S=[20,11];break;case 8:S=[32,11];break;case 9:S=[80,33];break;case 10:S=[18,11];break;case 11:S=[15,11];break;case 12:S=[64,33];break;case 13:S=[160,99];break;case 14:S=[4,3];break;case 15:S=[3,2];break;case 16:S=[2,1];break;case 255:{S=[y()<<8|y(),y()<<8|y()];break}}}return{width:Math.ceil((p+1)*16-I*2-M*2),height:(2-o)*(c+1)*16-(o?2:4)*(b+A),pixelRatio:S}},H.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},P}();X.default=w},"./src/demux/id3.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"isHeader",function(){return K}),D.d(X,"isFooter",function(){return w}),D.d(X,"getID3Data",function(){return P}),D.d(X,"canParse",function(){return W}),D.d(X,"getTimeStamp",function(){return I}),D.d(X,"isTimeStampFrame",function(){return M}),D.d(X,"getID3Frames",function(){return A}),D.d(X,"decodeFrame",function(){return _}),D.d(X,"utf8ArrayToStr",function(){return a}),D.d(X,"testables",function(){return s});var K=function(m,k){return k+10<=m.length&&(m[k]===73&&m[k+1]===68&&m[k+2]===51&&(m[k+3]<255&&m[k+4]<255&&(m[k+6]<128&&m[k+7]<128&&m[k+8]<128&&m[k+9]<128)))},w=function(m,k){return k+10<=m.length&&(m[k]===51&&m[k+1]===68&&m[k+2]===73&&(m[k+3]<255&&m[k+4]<255&&(m[k+6]<128&&m[k+7]<128&&m[k+8]<128&&m[k+9]<128)))},P=function(m,k){for(var x=k,h=0;K(m,k);){h+=10;var p=H(m,k+6);h+=p,w(m,k+10)&&(h+=10),k+=h}return h>0?m.subarray(x,x+h):void 0},H=function(m,k){var x=0;return x=(m[k]&127)<<21,x|=(m[k+1]&127)<<14,x|=(m[k+2]&127)<<7,x|=m[k+3]&127,x},W=function(m,k){return K(m,k)&&H(m,k+6)+10<=m.length-k},I=function(m){for(var k=A(m),x=0;x<k.length;x++){var h=k[x];if(M(h))return u(h)}return},M=function(m){return m&&m.key==="PRIV"&&m.info==="com.apple.streaming.transportStreamTimestamp"},b=function(m){var k=String.fromCharCode(m[0],m[1],m[2],m[3]),x=H(m,4),h=10;return{type:k,size:x,data:m.subarray(h,h+x)}},A=function(m){for(var k=0,x=[];K(m,k);){var h=H(m,k+6);k+=10;for(var p=k+h;k+8<p;){var c=b(m.subarray(k)),o=_(c);o&&x.push(o),k+=c.size+10}w(m,k)&&(k+=10)}return x},_=function(m){return m.type==="PRIV"?O(m):m.type[0]==="W"?y(m):L(m)},O=function(m){if(m.size<2)return;var k=a(m.data,!0),x=new Uint8Array(m.data.subarray(k.length+1));return{key:m.type,info:k,data:x.buffer}},L=function(m){if(m.size<2)return;if(m.type==="TXXX"){var k=1,x=a(m.data.subarray(k),!0);k+=x.length+1;var h=a(m.data.subarray(k));return{key:m.type,info:x,data:h}}var p=a(m.data.subarray(1));return{key:m.type,data:p}},y=function(m){if(m.type==="WXXX"){if(m.size<2)return;var k=1,x=a(m.data.subarray(k),!0);k+=x.length+1;var h=a(m.data.subarray(k));return{key:m.type,info:x,data:h}}var p=a(m.data);return{key:m.type,data:p}},u=function(m){if(m.data.byteLength===8){var k=new Uint8Array(m.data),x=k[3]&1,h=(k[4]<<23)+(k[5]<<15)+(k[6]<<7)+k[7];return h/=45,x&&(h+=4772185884e-2),Math.round(h)}return},a=function(m,k){k===void 0&&(k=!1);var x=E();if(x){var h=x.decode(m);if(k){var p=h.indexOf("\0");return p!==-1?h.substring(0,p):h}return h.replace(/\0/g,"")}for(var c=m.length,o,S,v,T="",N=0;N<c;){if(o=m[N++],o===0&&k)return T;if(o===0||o===3)continue;switch(o>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:T+=String.fromCharCode(o);break;case 12:case 13:S=m[N++],T+=String.fromCharCode((o&31)<<6|S&63);break;case 14:S=m[N++],v=m[N++],T+=String.fromCharCode((o&15)<<12|(S&63)<<6|(v&63)<<0);break;default:}}return T},s={decodeTextFrame:L},d;function E(){return!d&&typeof self.TextDecoder!="undefined"&&(d=new self.TextDecoder("utf-8")),d}},"./src/demux/mp3demuxer.ts":function(ae,X,D){"use strict";D.r(X);var K=D("./src/demux/base-audio-demuxer.ts"),w=D("./src/demux/id3.ts"),P=D("./src/utils/logger.ts"),H=D("./src/demux/mpegaudio.ts");function W(b,A){b.prototype=Object.create(A.prototype),b.prototype.constructor=b,I(b,A)}function I(b,A){return I=Object.setPrototypeOf||function(O,L){return O.__proto__=L,O},I(b,A)}var M=function(b){W(A,b);function A(){return b.apply(this,arguments)||this}var _=A.prototype;return _.resetInitSegment=function(L,y,u){b.prototype.resetInitSegment.call(this,L,y,u),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:L,duration:u,inputTimeScale:9e4,dropped:0}},A.probe=function(L){if(!L)return!1;for(var y=w.getID3Data(L,0)||[],u=y.length,a=L.length;u<a;u++)if(H.probe(L,u))return P.logger.log("MPEG Audio sync word found !"),!0;return!1},_.canParse=function(L,y){return H.canParse(L,y)},_.appendFrame=function(L,y,u){return this.initPTS===null?void 0:H.appendFrame(L,y,u,this.initPTS,this.frameIndex)},A}(K.default);M.minProbeByteLength=4,X.default=M},"./src/demux/mp4demuxer.ts":function(ae,X,D){"use strict";D.r(X);var K=D("./src/utils/mp4-tools.ts"),w=D("./src/demux/dummy-demuxed-track.ts"),P=function(){function H(I,M){this.remainderData=null,this.config=void 0,this.config=M}var W=H.prototype;return W.resetTimeStamp=function(){},W.resetInitSegment=function(){},W.resetContiguity=function(){},H.probe=function(M){return Object(K.findBox)({data:M,start:0,end:Math.min(M.length,16384)},["moof"]).length>0},W.demux=function(M){var b=M,A=Object(w.dummyTrack)();if(this.config.progressive){this.remainderData&&(b=Object(K.appendUint8Array)(this.remainderData,M));var _=Object(K.segmentValidRange)(b);this.remainderData=_.remainder,A.samples=_.valid||new Uint8Array}else A.samples=b;return{audioTrack:Object(w.dummyTrack)(),avcTrack:A,id3Track:Object(w.dummyTrack)(),textTrack:Object(w.dummyTrack)()}},W.flush=function(){var M=Object(w.dummyTrack)();return M.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(w.dummyTrack)(),avcTrack:M,id3Track:Object(w.dummyTrack)(),textTrack:Object(w.dummyTrack)()}},W.demuxSampleAes=function(M,b,A){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},W.destroy=function(){},H}();P.minProbeByteLength=1024,X.default=P},"./src/demux/mpegaudio.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"appendFrame",function(){return I}),D.d(X,"parseHeader",function(){return M}),D.d(X,"isHeaderPattern",function(){return b}),D.d(X,"isHeader",function(){return A}),D.d(X,"canParse",function(){return _}),D.d(X,"probe",function(){return O});var K=null,w=[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],P=[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]],W=[0,1,1,4];function I(L,y,u,a,s){if(u+24>y.length)return;var d=M(y,u);if(d&&u+d.frameLength<=y.length){var E=d.samplesPerFrame*9e4/d.sampleRate,g=a+s*E,m={unit:y.subarray(u,u+d.frameLength),pts:g,dts:g};return L.config=[],L.channelCount=d.channelCount,L.samplerate=d.sampleRate,L.samples.push(m),{sample:m,length:d.frameLength,missing:0}}}function M(L,y){var u=L[y+1]>>3&3,a=L[y+1]>>1&3,s=L[y+2]>>4&15,d=L[y+2]>>2&3;if(u!==1&&s!==0&&s!==15&&d!==3){var E=L[y+2]>>1&1,g=L[y+3]>>6,m=u===3?3-a:a===3?3:4,k=w[m*14+s-1]*1e3,x=u===3?0:u===2?1:2,h=P[x*3+d],p=g===3?1:2,c=H[u][a],o=W[a],S=c*8*o,v=Math.floor(c*k/h+E)*o;if(K===null){var T=navigator.userAgent||"",N=T.match(/Chrome\/(\d+)/i);K=N?parseInt(N[1]):0}var z=!!K&&K<=87;return z&&a===2&&k>=224e3&&g===0&&(L[y+3]=L[y+3]|128),{sampleRate:h,channelCount:p,frameLength:v,samplesPerFrame:S}}}function b(L,y){return L[y]===255&&(L[y+1]&224)===224&&(L[y+1]&6)!==0}function A(L,y){return y+1<L.length&&b(L,y)}function _(L,y){var u=4;return b(L,y)&&u<=L.length-y}function O(L,y){if(y+1<L.length&&b(L,y)){var u=4,a=M(L,y),s=u;a!=null&&a.frameLength&&(s=a.frameLength);var d=y+s;return d===L.length||A(L,d)}return!1}},"./src/demux/sample-aes.ts":function(ae,X,D){"use strict";D.r(X);var K=D("./src/crypt/decrypter.ts"),w=D("./src/demux/tsdemuxer.ts"),P=function(){function H(I,M,b){this.keyData=void 0,this.decrypter=void 0,this.keyData=b,this.decrypter=new K.default(I,M,{removePKCS7Padding:!1})}var W=H.prototype;return W.decryptBuffer=function(M,b){this.decrypter.decrypt(M,this.keyData.key.buffer,this.keyData.iv.buffer,b)},W.decryptAacSample=function(M,b,A,_){var O=M[b].unit,L=O.subarray(16,O.length-O.length%16),y=L.buffer.slice(L.byteOffset,L.byteOffset+L.length),u=this;this.decryptBuffer(y,function(a){var s=new Uint8Array(a);O.set(s,16),_||u.decryptAacSamples(M,b+1,A)})},W.decryptAacSamples=function(M,b,A){for(;;b++){if(b>=M.length){A();return}if(M[b].unit.length<32)continue;var _=this.decrypter.isSync();if(this.decryptAacSample(M,b,A,_),!_)return}},W.getAvcEncryptedData=function(M){for(var b=Math.floor((M.length-48)/160)*16+16,A=new Int8Array(b),_=0,O=32;O<=M.length-16;O+=160,_+=16)A.set(M.subarray(O,O+16),_);return A},W.getAvcDecryptedUnit=function(M,b){for(var A=new Uint8Array(b),_=0,O=32;O<=M.length-16;O+=160,_+=16)M.set(A.subarray(_,_+16),O);return M},W.decryptAvcSample=function(M,b,A,_,O,L){var y=Object(w.discardEPB)(O.data),u=this.getAvcEncryptedData(y),a=this;this.decryptBuffer(u.buffer,function(s){O.data=a.getAvcDecryptedUnit(y,s),L||a.decryptAvcSamples(M,b,A+1,_)})},W.decryptAvcSamples=function(M,b,A,_){if(M instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;b++,A=0){if(b>=M.length){_();return}for(var O=M[b].units;!(A>=O.length);A++){var L=O[A];if(L.data.length<=48||L.type!==1&&L.type!==5)continue;var y=this.decrypter.isSync();if(this.decryptAvcSample(M,b,A,_,L,y),!y)return}}},H}();X.default=P},"./src/demux/transmuxer-interface.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"default",function(){return O});var K=D("./node_modules/webworkify-webpack/index.js"),w=D.n(K),P=D("./src/events.ts"),H=D("./src/demux/transmuxer.ts"),W=D("./src/utils/logger.ts"),I=D("./src/errors.ts"),M=D("./src/utils/mediasource-helper.ts"),b=D("./node_modules/eventemitter3/index.js"),A=D.n(b),_=Object(M.getMediaSource)()||{isTypeSupported:function(){return!1}},O=function(){function L(u,a,s,d){var E=this;this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.hls=u,this.id=a,this.onTransmuxComplete=s,this.onFlush=d;var g=u.config,m=function(c,o){o=o||{},o.frag=E.frag,o.id=E.id,u.trigger(c,o)};this.observer=new b.EventEmitter,this.observer.on(P.Events.FRAG_DECRYPTED,m),this.observer.on(P.Events.ERROR,m);var k={mp4:_.isTypeSupported("video/mp4"),mpeg:_.isTypeSupported("audio/mpeg"),mp3:_.isTypeSupported('audio/mp4; codecs="mp3"')},x=navigator.vendor;if(g.enableWorker&&typeof Worker!="undefined"){W.logger.log("demuxing in webworker");var h;try{h=this.worker=K("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),h.addEventListener("message",this.onwmsg),h.onerror=function(p){u.trigger(P.Events.ERROR,{type:I.ErrorTypes.OTHER_ERROR,details:I.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(p.message+" ("+p.filename+":"+p.lineno+")")})},h.postMessage({cmd:"init",typeSupported:k,vendor:x,id:a,config:JSON.stringify(g)})}catch(p){W.logger.warn("Error in worker:",p),W.logger.error("Error while initializing DemuxerWorker, fallback to inline"),h&&self.URL.revokeObjectURL(h.objectURL),this.transmuxer=new H.default(this.observer,k,g,x,a),this.worker=null}}else this.transmuxer=new H.default(this.observer,k,g,x,a)}var y=L.prototype;return y.destroy=function(){var a=this.worker;if(a)a.removeEventListener("message",this.onwmsg),a.terminate(),this.worker=null;else{var s=this.transmuxer;s&&(s.destroy(),this.transmuxer=null)}var d=this.observer;d&&d.removeAllListeners(),this.observer=null},y.push=function(a,s,d,E,g,m,k,x,h,p){var c=this;h.transmuxing.start=self.performance.now();var o=this.transmuxer,S=this.worker,v=m?m.start:g.start,T=g.decryptdata,N=this.frag,z=!(N&&g.cc===N.cc),Y=!(N&&h.level===N.level),ee=N?h.sn-N.sn:-1,G=this.part?h.part-this.part.index:1,j=!Y&&(ee===1||ee===0&&G===1),te=self.performance.now();(Y||ee||g.stats.parsing.start===0)&&(g.stats.parsing.start=te),m&&(G||!j)&&(m.stats.parsing.start=te);var de=new H.TransmuxState(z,j,x,Y,v);if(!j||z){W.logger.log("[transmuxer-interface, "+g.type+"]: Starting new transmux session for sn: "+h.sn+" p: "+h.part+" level: "+h.level+" id: "+h.id+`
discontinuity: `+z+`
trackSwitch: `+Y+`
contiguous: `+j+`
accurateTimeOffset: `+x+`
timeOffset: `+v);var be=new H.TransmuxConfig(d,E,s,k,p);this.configureTransmuxer(be)}if(this.frag=g,this.part=m,S)S.postMessage({cmd:"demux",data:a,decryptdata:T,chunkMeta:h,state:de},a instanceof ArrayBuffer?[a]:[]);else if(o){var Oe=o.push(a,T,h,de);Object(H.isPromise)(Oe)?Oe.then(function(Ge){c.handleTransmuxComplete(Ge)}):this.handleTransmuxComplete(Oe)}},y.flush=function(a){var s=this;a.transmuxing.start=self.performance.now();var d=this.transmuxer,E=this.worker;if(E)E.postMessage({cmd:"flush",chunkMeta:a});else if(d){var g=d.flush(a);Object(H.isPromise)(g)?g.then(function(m){s.handleFlushResult(m,a)}):this.handleFlushResult(g,a)}},y.handleFlushResult=function(a,s){var d=this;a.forEach(function(E){d.handleTransmuxComplete(E)}),this.onFlush(s)},y.onWorkerMessage=function(a){var s=a.data,d=this.hls;switch(s.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(s.data);break}case"flush":{this.onFlush(s.data);break}default:{s.data=s.data||{},s.data.frag=this.frag,s.data.id=this.id,d.trigger(s.event,s.data);break}}},y.configureTransmuxer=function(a){var s=this.worker,d=this.transmuxer;s?s.postMessage({cmd:"configure",config:a}):d&&d.configure(a)},y.handleTransmuxComplete=function(a){a.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(a)},L}()},"./src/demux/transmuxer-worker.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"default",function(){return I});var K=D("./src/demux/transmuxer.ts"),w=D("./src/events.ts"),P=D("./src/utils/logger.ts"),H=D("./node_modules/eventemitter3/index.js"),W=D.n(H);function I(O){var L=new H.EventEmitter,y=function(a,s){O.postMessage({event:a,data:s})};L.on(w.Events.FRAG_DECRYPTED,y),L.on(w.Events.ERROR,y),O.addEventListener("message",function(u){var a=u.data;switch(a.cmd){case"init":{var s=JSON.parse(a.config);O.transmuxer=new K.default(L,a.typeSupported,s,a.vendor,a.id),Object(P.enableLogs)(s.debug),y("init",null);break}case"configure":{O.transmuxer.configure(a.config);break}case"demux":{var d=O.transmuxer.push(a.data,a.decryptdata,a.chunkMeta,a.state);Object(K.isPromise)(d)?d.then(function(m){M(O,m)}):M(O,d);break}case"flush":{var E=a.chunkMeta,g=O.transmuxer.flush(E);Object(K.isPromise)(g)?g.then(function(m){A(O,m,E)}):A(O,g,E);break}default:break}})}function M(O,L){if(_(L.remuxResult))return;var y=[],u=L.remuxResult,a=u.audio,s=u.video;a&&b(y,a),s&&b(y,s),O.postMessage({event:"transmuxComplete",data:L},y)}function b(O,L){L.data1&&O.push(L.data1.buffer),L.data2&&O.push(L.data2.buffer)}function A(O,L,y){L.forEach(function(u){M(O,u)}),O.postMessage({event:"flush",data:y})}function _(O){return!O.audio&&!O.video&&!O.text&&!O.id3&&!O.initSegment}},"./src/demux/transmuxer.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"default",function(){return s}),D.d(X,"isPromise",function(){return g}),D.d(X,"TransmuxConfig",function(){return m}),D.d(X,"TransmuxState",function(){return k});var K=D("./src/events.ts"),w=D("./src/errors.ts"),P=D("./src/crypt/decrypter.ts"),H=D("./src/demux/aacdemuxer.ts"),W=D("./src/demux/mp4demuxer.ts"),I=D("./src/demux/tsdemuxer.ts"),M=D("./src/demux/mp3demuxer.ts"),b=D("./src/remux/mp4-remuxer.ts"),A=D("./src/remux/passthrough-remuxer.ts"),_=D("./src/demux/chunk-cache.ts"),O=D("./src/utils/mp4-tools.ts"),L=D("./src/utils/logger.ts"),y;try{y=self.performance.now.bind(self.performance)}catch(x){L.logger.debug("Unable to use Performance API on this environment"),y=self.Date.now}var u=[{demux:I.default,remux:b.default},{demux:W.default,remux:A.default},{demux:H.default,remux:b.default},{demux:M.default,remux:b.default}],a=1024;u.forEach(function(x){var h=x.demux;a=Math.max(a,h.minProbeByteLength)});var s=function(){function x(p,c,o,S,v){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=p,this.typeSupported=c,this.config=o,this.vendor=S,this.id=v}var h=x.prototype;return h.configure=function(c){this.transmuxConfig=c,this.decrypter&&this.decrypter.reset()},h.push=function(c,o,S,v){var T=this,N=S.transmuxing;N.executeStart=y();var z=new Uint8Array(c),Y=this.cache,ee=this.config,G=this.currentTransmuxState,j=this.transmuxConfig;v&&(this.currentTransmuxState=v);var te=d(z,o);if(te&&te.method==="AES-128"){var de=this.getDecrypter();if(ee.enableSoftwareAES){var be=de.softwareDecrypt(z,te.key.buffer,te.iv.buffer);if(!be)return N.executeEnd=y(),E(S);z=new Uint8Array(be)}else return this.decryptionPromise=de.webCryptoDecrypt(z,te.key.buffer,te.iv.buffer).then(function(Ye){var rt=T.push(Ye,null,S);return T.decryptionPromise=null,rt}),this.decryptionPromise}var Oe=v||G,Ge=Oe.contiguous,Me=Oe.discontinuity,Ie=Oe.trackSwitch,Ue=Oe.accurateTimeOffset,Pe=Oe.timeOffset,Te=j.audioCodec,se=j.videoCodec,Fe=j.defaultInitPts,dt=j.duration,it=j.initSegmentData;if((Me||Ie)&&this.resetInitSegment(it,Te,se,dt),Me&&this.resetInitialTimestamp(Fe),Ge||this.resetContiguity(),this.needsProbing(z,Me,Ie)){if(Y.dataLength){var ot=Y.flush();z=Object(O.appendUint8Array)(ot,z)}this.configureTransmuxer(z,j)}var ct=this.transmux(z,te,Pe,Ue,S),je=this.currentTransmuxState;return je.contiguous=!0,je.discontinuity=!1,je.trackSwitch=!1,N.executeEnd=y(),ct},h.flush=function(c){var o=this,S=c.transmuxing;S.executeStart=y();var v=this.decrypter,T=this.cache,N=this.currentTransmuxState,z=this.decryptionPromise;if(z)return z.then(function(){return o.flush(c)});var Y=[],ee=N.timeOffset;if(v){var G=v.flush();G&&Y.push(this.push(G,null,c))}var j=T.dataLength;T.reset();var te=this.demuxer,de=this.remuxer;if(!te||!de)return j>=a&&this.observer.emit(K.Events.ERROR,K.Events.ERROR,{type:w.ErrorTypes.MEDIA_ERROR,details:w.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),S.executeEnd=y(),[E(c)];var be=te.flush(ee);return g(be)?be.then(function(Oe){return o.flushRemux(Y,Oe,c),Y}):(this.flushRemux(Y,be,c),Y)},h.flushRemux=function(c,o,S){var v=o.audioTrack,T=o.avcTrack,N=o.id3Track,z=o.textTrack,Y=this.currentTransmuxState,ee=Y.accurateTimeOffset,G=Y.timeOffset;L.logger.log("[transmuxer.ts]: Flushed fragment "+S.sn+(S.part>-1?" p: "+S.part:"")+" of level "+S.level);var j=this.remuxer.remux(v,T,N,z,G,ee,!0,this.id);c.push({remuxResult:j,chunkMeta:S}),S.transmuxing.executeEnd=y()},h.resetInitialTimestamp=function(c){var o=this.demuxer,S=this.remuxer;if(!o||!S)return;o.resetTimeStamp(c),S.resetTimeStamp(c)},h.resetContiguity=function(){var c=this.demuxer,o=this.remuxer;if(!c||!o)return;c.resetContiguity(),o.resetNextTimestamp()},h.resetInitSegment=function(c,o,S,v){var T=this.demuxer,N=this.remuxer;if(!T||!N)return;T.resetInitSegment(o,S,v),N.resetInitSegment(c,o,S)},h.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},h.transmux=function(c,o,S,v,T){var N;return o&&o.method==="SAMPLE-AES"?N=this.transmuxSampleAes(c,o,S,v,T):N=this.transmuxUnencrypted(c,S,v,T),N},h.transmuxUnencrypted=function(c,o,S,v){var T=this.demuxer.demux(c,o,!1,!this.config.progressive),N=T.audioTrack,z=T.avcTrack,Y=T.id3Track,ee=T.textTrack,G=this.remuxer.remux(N,z,Y,ee,o,S,!1,this.id);return{remuxResult:G,chunkMeta:v}},h.transmuxSampleAes=function(c,o,S,v,T){var N=this;return this.demuxer.demuxSampleAes(c,o,S).then(function(z){var Y=N.remuxer.remux(z.audioTrack,z.avcTrack,z.id3Track,z.textTrack,S,v,!1,N.id);return{remuxResult:Y,chunkMeta:T}})},h.configureTransmuxer=function(c,o){for(var S=this.config,v=this.observer,T=this.typeSupported,N=this.vendor,z=o.audioCodec,Y=o.defaultInitPts,ee=o.duration,G=o.initSegmentData,j=o.videoCodec,te,de=0,be=u.length;de<be;de++)if(u[de].demux.probe(c)){te=u[de];break}te||(L.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),te={demux:W.default,remux:A.default});var Oe=this.demuxer,Ge=this.remuxer,Me=te.remux,Ie=te.demux;(!Ge||!(Ge instanceof Me))&&(this.remuxer=new Me(v,S,T,N)),(!Oe||!(Oe instanceof Ie))&&(this.demuxer=new Ie(v,S,T),this.probe=Ie.probe),this.resetInitSegment(G,z,j,ee),this.resetInitialTimestamp(Y)},h.needsProbing=function(c,o,S){return!this.demuxer||!this.remuxer||o||S},h.getDecrypter=function(){var c=this.decrypter;return c||(c=this.decrypter=new P.default(this.observer,this.config)),c},x}();function d(x,h){var p=null;return x.byteLength>0&&h!=null&&h.key!=null&&h.iv!==null&&h.method!=null&&(p=h),p}var E=function(h){return{remuxResult:{},chunkMeta:h}};function g(x){return"then"in x&&x.then instanceof Function}var m=function(h,p,c,o,S){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=h,this.videoCodec=p,this.initSegmentData=c,this.duration=o,this.defaultInitPts=S},k=function(h,p,c,o,S){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=h,this.contiguous=p,this.accurateTimeOffset=c,this.trackSwitch=o,this.timeOffset=S}},"./src/demux/tsdemuxer.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"discardEPB",function(){return E});var K=D("./src/demux/adts.ts"),w=D("./src/demux/mpegaudio.ts"),P=D("./src/demux/exp-golomb.ts"),H=D("./src/demux/id3.ts"),W=D("./src/demux/sample-aes.ts"),I=D("./src/events.ts"),M=D("./src/utils/mp4-tools.ts"),b=D("./src/utils/logger.ts"),A=D("./src/errors.ts"),_={video:1,audio:2,id3:3,text:4},O=function(){function g(k,x,h){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=k,this.config=x,this.typeSupported=h}g.probe=function(x){var h=g.syncOffset(x);return h<0?!1:(h&&b.logger.warn("MPEG2-TS detected but first sync word found @ offset "+h+", junk ahead ?"),!0)},g.syncOffset=function(x){for(var h=Math.min(1e3,x.length-3*188),p=0;p<h;){if(x[p]===71&&x[p+188]===71&&x[p+2*188]===71)return p;p++}return-1},g.createTrack=function(x,h){return{container:x==="video"||x==="audio"?"video/mp2t":void 0,type:x,id:_[x],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:x==="audio"?h:void 0}};var m=g.prototype;return m.resetInitSegment=function(x,h,p){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=g.createTrack("video",p),this._audioTrack=g.createTrack("audio",p),this._id3Track=g.createTrack("id3",p),this._txtTrack=g.createTrack("text",p),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=x,this.videoCodec=h,this._duration=p},m.resetTimeStamp=function(){},m.resetContiguity=function(){var x=this._audioTrack,h=this._avcTrack,p=this._id3Track;x&&(x.pesData=null),h&&(h.pesData=null),p&&(p.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},m.demux=function(x,h,p,c){p===void 0&&(p=!1),c===void 0&&(c=!1),p||(this.sampleAes=null);var o,S=this._avcTrack,v=this._audioTrack,T=this._id3Track,N=S.pid,z=S.pesData,Y=v.pid,ee=T.pid,G=v.pesData,j=T.pesData,te=!1,de=this.pmtParsed,be=this._pmtId,Oe=x.length;if(this.remainderData&&(x=Object(M.appendUint8Array)(this.remainderData,x),Oe=x.length,this.remainderData=null),Oe<188&&!c)return this.remainderData=x,{audioTrack:v,avcTrack:S,id3Track:T,textTrack:this._txtTrack};var Ge=Math.max(0,g.syncOffset(x));Oe-=(Oe+Ge)%188,Oe<x.byteLength&&!c&&(this.remainderData=new Uint8Array(x.buffer,Oe,x.buffer.byteLength-Oe));for(var Me=Ge;Me<Oe;Me+=188)if(x[Me]===71){var Ie=!!(x[Me+1]&64),Ue=((x[Me+1]&31)<<8)+x[Me+2],Pe=(x[Me+3]&48)>>4,Te=void 0;if(Pe>1){if(Te=Me+5+x[Me+4],Te===Me+188)continue}else Te=Me+4;switch(Ue){case N:Ie&&(z&&(o=a(z))&&this.parseAVCPES(o,!1),z={data:[],size:0}),z&&(z.data.push(x.subarray(Te,Me+188)),z.size+=Me+188-Te);break;case Y:Ie&&(G&&(o=a(G))&&(v.isAAC?this.parseAACPES(o):this.parseMPEGPES(o)),G={data:[],size:0}),G&&(G.data.push(x.subarray(Te,Me+188)),G.size+=Me+188-Te);break;case ee:Ie&&(j&&(o=a(j))&&this.parseID3PES(o),j={data:[],size:0}),j&&(j.data.push(x.subarray(Te,Me+188)),j.size+=Me+188-Te);break;case 0:Ie&&(Te+=x[Te]+1),be=this._pmtId=y(x,Te);break;case be:{Ie&&(Te+=x[Te]+1);var se=u(x,Te,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,p);N=se.avc,N>0&&(S.pid=N),Y=se.audio,Y>0&&(v.pid=Y,v.isAAC=se.isAAC),ee=se.id3,ee>0&&(T.pid=ee),te&&!de&&(b.logger.log("reparse from beginning"),te=!1,Me=Ge-188),de=this.pmtParsed=!0;break}case 17:case 8191:break;default:te=!0;break}}else this.observer.emit(I.Events.ERROR,I.Events.ERROR,{type:A.ErrorTypes.MEDIA_ERROR,details:A.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});S.pesData=z,v.pesData=G,T.pesData=j;var Fe={audioTrack:v,avcTrack:S,id3Track:T,textTrack:this._txtTrack};return c&&this.extractRemainingSamples(Fe),Fe},m.flush=function(){var x=this.remainderData;this.remainderData=null;var h;return x?h=this.demux(x,-1,!1,!0):h={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(h),this.sampleAes?this.decrypt(h,this.sampleAes):h},m.extractRemainingSamples=function(x){var h=x.audioTrack,p=x.avcTrack,c=x.id3Track,o=p.pesData,S=h.pesData,v=c.pesData,T;o&&(T=a(o))?(this.parseAVCPES(T,!0),p.pesData=null):p.pesData=o,S&&(T=a(S))?(h.isAAC?this.parseAACPES(T):this.parseMPEGPES(T),h.pesData=null):(S!=null&&S.size&&b.logger.log("last AAC PES packet truncated,might overlap between fragments"),h.pesData=S),v&&(T=a(v))?(this.parseID3PES(T),c.pesData=null):c.pesData=v},m.demuxSampleAes=function(x,h,p){var c=this.demux(x,p,!0,!this.config.progressive),o=this.sampleAes=new W.default(this.observer,this.config,h);return this.decrypt(c,o)},m.decrypt=function(x,h){return new Promise(function(p){var c=x.audioTrack,o=x.avcTrack;c.samples&&c.isAAC?h.decryptAacSamples(c.samples,0,function(){o.samples?h.decryptAvcSamples(o.samples,0,0,function(){p(x)}):p(x)}):o.samples&&h.decryptAvcSamples(o.samples,0,0,function(){p(x)})})},m.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},m.parseAVCPES=function(x,h){var p=this,c=this._avcTrack,o=this.parseAVCNALu(x.data),S=!1,v=this.avcSample,T,N=!1;x.data=null,v&&o.length&&!c.audFound&&(s(v,c),v=this.avcSample=L(!1,x.pts,x.dts,"")),o.forEach(function(z){switch(z.type){case 1:{T=!0,v||(v=p.avcSample=L(!0,x.pts,x.dts,"")),S&&(v.debug+="NDR "),v.frame=!0;var Y=z.data;if(N&&Y.length>4){var ee=new P.default(Y).readSliceType();(ee===2||ee===4||ee===7||ee===9)&&(v.key=!0)}break}case 5:T=!0,v||(v=p.avcSample=L(!0,x.pts,x.dts,"")),S&&(v.debug+="IDR "),v.key=!0,v.frame=!0;break;case 6:{T=!0,S&&v&&(v.debug+="SEI ");var G=new P.default(E(z.data));G.readUByte();for(var j=0,te=0,de=!1,be=0;!de&&G.bytesAvailable>1;){j=0;do be=G.readUByte(),j+=be;while(be===255);te=0;do be=G.readUByte(),te+=be;while(be===255);if(j===4&&G.bytesAvailable!==0){de=!0;var Oe=G.readUByte();if(Oe===181){var Ge=G.readUShort();if(Ge===49){var Me=G.readUInt();if(Me===1195456820){var Ie=G.readUByte();if(Ie===3){for(var Ue=G.readUByte(),Pe=G.readUByte(),Te=31&Ue,se=[Ue,Pe],Fe=0;Fe<Te;Fe++)se.push(G.readUByte()),se.push(G.readUByte()),se.push(G.readUByte());d(p._txtTrack.samples,{type:3,pts:x.pts,bytes:se})}}}}}else if(j===5&&G.bytesAvailable!==0){if(de=!0,te>16){for(var dt=[],it=0;it<16;it++)dt.push(G.readUByte().toString(16)),(it===3||it===5||it===7||it===9)&&dt.push("-");for(var ot=te-16,ct=new Uint8Array(ot),je=0;je<ot;je++)ct[je]=G.readUByte();d(p._txtTrack.samples,{pts:x.pts,payloadType:j,uuid:dt.join(""),userData:Object(H.utf8ArrayToStr)(ct),userDataBytes:ct})}}else if(te<G.bytesAvailable)for(var Ye=0;Ye<te;Ye++)G.readUByte()}break}case 7:if(T=!0,N=!0,S&&v&&(v.debug+="SPS "),!c.sps){var rt=new P.default(z.data),st=rt.readSPS();c.width=st.width,c.height=st.height,c.pixelRatio=st.pixelRatio,c.sps=[z.data],c.duration=p._duration;for(var qe=z.data.subarray(1,4),Ve="avc1.",Ke=0;Ke<3;Ke++){var ht=qe[Ke].toString(16);ht.length<2&&(ht="0"+ht),Ve+=ht}c.codec=Ve}break;case 8:T=!0,S&&v&&(v.debug+="PPS "),c.pps||(c.pps=[z.data]);break;case 9:T=!1,c.audFound=!0,v&&s(v,c),v=p.avcSample=L(!1,x.pts,x.dts,S?"AUD ":"");break;case 12:T=!1;break;default:T=!1,v&&(v.debug+="unknown NAL "+z.type+" ");break}if(v&&T){var ut=v.units;ut.push(z)}}),h&&v&&(s(v,c),this.avcSample=null)},m.getLastNalUnit=function(){var x,h=this.avcSample,p;if(!h||h.units.length===0){var c=this._avcTrack.samples;h=c[c.length-1]}if((x=h)!==null&&x!==void 0&&x.units){var o=h.units;p=o[o.length-1]}return p},m.parseAVCNALu=function(x){var h=x.byteLength,p=this._avcTrack,c=p.naluState||0,o=c,S=[],v=0,T,N,z,Y=-1,ee=0;for(c===-1&&(Y=0,ee=x[0]&31,c=0,v=1);v<h;){if(T=x[v++],!c){c=T?0:1;continue}if(c===1){c=T?0:2;continue}if(!T)c=3;else if(T===1){if(Y>=0){var G={data:x.subarray(Y,v-c-1),type:ee};S.push(G)}else{var j=this.getLastNalUnit();if(j&&(o&&v<=4-o&&(j.state&&(j.data=j.data.subarray(0,j.data.byteLength-o))),N=v-c-1,N>0)){var te=new Uint8Array(j.data.byteLength+N);te.set(j.data,0),te.set(x.subarray(0,N),j.data.byteLength),j.data=te,j.state=0}}v<h?(z=x[v]&31,Y=v,ee=z,c=0):c=-1}else c=0}if(Y>=0&&c>=0){var de={data:x.subarray(Y,h),type:ee,state:c};S.push(de)}if(S.length===0){var be=this.getLastNalUnit();if(be){var Oe=new Uint8Array(be.data.byteLength+x.byteLength);Oe.set(be.data,0),Oe.set(x,be.data.byteLength),be.data=Oe}}return p.naluState=c,S},m.parseAACPES=function(x){var h=0,p=this._audioTrack,c=this.aacOverFlow,o=x.data;if(c){this.aacOverFlow=null;var S=c.sample.unit.byteLength,v=Math.min(c.missing,S),T=S-v;c.sample.unit.set(o.subarray(0,v),T),p.samples.push(c.sample),h=c.missing}var N,z;for(N=h,z=o.length;N<z-1&&!K.isHeader(o,N);N++);if(N!==h){var Y,ee;if(N<z-1?(Y="AAC PES did not start with ADTS header,offset:"+N,ee=!1):(Y="no ADTS header found in AAC PES",ee=!0),b.logger.warn("parsing error:"+Y),this.observer.emit(I.Events.ERROR,I.Events.ERROR,{type:A.ErrorTypes.MEDIA_ERROR,details:A.ErrorDetails.FRAG_PARSING_ERROR,fatal:ee,reason:Y}),ee)return}K.initTrackConfig(p,this.observer,o,N,this.audioCodec);var G;if(x.pts!==void 0)G=x.pts;else if(c){var j=K.getFrameDuration(p.samplerate);G=c.sample.pts+j}else{b.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var te=0;N<z;)if(K.isHeader(o,N)){if(N+5<z){var de=K.appendFrame(p,o,N,G,te);if(de)if(de.missing)this.aacOverFlow=de;else{N+=de.length,te++;continue}}break}else N++},m.parseMPEGPES=function(x){var h=x.data,p=h.length,c=0,o=0,S=x.pts;if(S===void 0){b.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;o<p;)if(w.isHeader(h,o)){var v=w.appendFrame(this._audioTrack,h,o,S,c);if(v)o+=v.length,c++;else break}else o++},m.parseID3PES=function(x){if(x.pts===void 0){b.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(x)},g}();O.minProbeByteLength=188;function L(g,m,k,x){return{key:g,frame:!1,pts:m,dts:k,units:[],debug:x,length:0}}function y(g,m){return(g[m+10]&31)<<8|g[m+11]}function u(g,m,k,x){var h={audio:-1,avc:-1,id3:-1,isAAC:!0},p=(g[m+1]&15)<<8|g[m+2],c=m+3+p-4,o=(g[m+10]&15)<<8|g[m+11];for(m+=12+o;m<c;){var S=(g[m+1]&31)<<8|g[m+2];switch(g[m]){case 207:if(!x){b.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:h.audio===-1&&(h.audio=S);break;case 21:h.id3===-1&&(h.id3=S);break;case 219:if(!x){b.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:h.avc===-1&&(h.avc=S);break;case 3:case 4:k?h.audio===-1&&(h.audio=S,h.isAAC=!1):b.logger.log("MPEG audio found, not supported in this browser");break;case 36:b.logger.warn("Unsupported HEVC stream type found");break;default:break}m+=((g[m+3]&15)<<8|g[m+4])+5}return h}function a(g){var m=0,k,x,h,p,c,o=g.data;if(!g||g.size===0)return null;for(;o[0].length<19&&o.length>1;){var S=new Uint8Array(o[0].length+o[1].length);S.set(o[0]),S.set(o[1],o[0].length),o[0]=S,o.splice(1,1)}k=o[0];var v=(k[0]<<16)+(k[1]<<8)+k[2];if(v===1){if(x=(k[4]<<8)+k[5],x&&x>g.size-6)return null;var T=k[7];T&192&&(p=(k[9]&14)*536870912+(k[10]&255)*4194304+(k[11]&254)*16384+(k[12]&255)*128+(k[13]&254)/2,T&64?(c=(k[14]&14)*536870912+(k[15]&255)*4194304+(k[16]&254)*16384+(k[17]&255)*128+(k[18]&254)/2,p-c>60*9e4&&(b.logger.warn(Math.round((p-c)/9e4)+"s delta between PTS and DTS, align them"),p=c)):c=p),h=k[8];var N=h+9;if(g.size<=N)return null;g.size-=N;for(var z=new Uint8Array(g.size),Y=0,ee=o.length;Y<ee;Y++){k=o[Y];var G=k.byteLength;if(N)if(N>G){N-=G;continue}else k=k.subarray(N),G-=N,N=0;z.set(k,m),m+=G}return x&&(x-=h+3),{data:z,pts:p,dts:c,len:x}}return null}function s(g,m){if(g.units.length&&g.frame){if(g.pts===void 0){var k=m.samples,x=k.length;if(x){var h=k[x-1];g.pts=h.pts,g.dts=h.dts}else{m.dropped++;return}}m.samples.push(g)}g.debug.length&&b.logger.log(g.pts+"/"+g.dts+":"+g.debug)}function d(g,m){var k=g.length;if(k>0){if(m.pts>=g[k-1].pts)g.push(m);else for(var x=k-1;x>=0;x--)if(m.pts<g[x].pts){g.splice(x,0,m);break}}else g.push(m)}function E(g){for(var m=g.byteLength,k=[],x=1;x<m-2;)g[x]===0&&g[x+1]===0&&g[x+2]===3?(k.push(x+2),x+=2):x++;if(k.length===0)return g;var h=m-k.length,p=new Uint8Array(h),c=0;for(x=0;x<h;c++,x++)c===k[0]&&(c++,k.shift()),p[x]=g[c];return p}X.default=O},"./src/errors.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"ErrorTypes",function(){return K}),D.d(X,"ErrorDetails",function(){return w});var K;(function(P){P.NETWORK_ERROR="networkError",P.MEDIA_ERROR="mediaError",P.KEY_SYSTEM_ERROR="keySystemError",P.MUX_ERROR="muxError",P.OTHER_ERROR="otherError"})(K||(K={}));var w;(function(P){P.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",P.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",P.KEY_SYSTEM_NO_SESSION="keySystemNoSession",P.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",P.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",P.MANIFEST_LOAD_ERROR="manifestLoadError",P.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",P.MANIFEST_PARSING_ERROR="manifestParsingError",P.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",P.LEVEL_EMPTY_ERROR="levelEmptyError",P.LEVEL_LOAD_ERROR="levelLoadError",P.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",P.LEVEL_SWITCH_ERROR="levelSwitchError",P.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",P.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",P.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",P.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",P.FRAG_LOAD_ERROR="fragLoadError",P.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",P.FRAG_DECRYPT_ERROR="fragDecryptError",P.FRAG_PARSING_ERROR="fragParsingError",P.REMUX_ALLOC_ERROR="remuxAllocError",P.KEY_LOAD_ERROR="keyLoadError",P.KEY_LOAD_TIMEOUT="keyLoadTimeOut",P.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",P.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",P.BUFFER_APPEND_ERROR="bufferAppendError",P.BUFFER_APPENDING_ERROR="bufferAppendingError",P.BUFFER_STALLED_ERROR="bufferStalledError",P.BUFFER_FULL_ERROR="bufferFullError",P.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",P.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",P.INTERNAL_EXCEPTION="internalException",P.INTERNAL_ABORTED="aborted",P.UNKNOWN="unknown"})(w||(w={}))},"./src/events.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"Events",function(){return K});var K;(function(w){w.MEDIA_ATTACHING="hlsMediaAttaching",w.MEDIA_ATTACHED="hlsMediaAttached",w.MEDIA_DETACHING="hlsMediaDetaching",w.MEDIA_DETACHED="hlsMediaDetached",w.BUFFER_RESET="hlsBufferReset",w.BUFFER_CODECS="hlsBufferCodecs",w.BUFFER_CREATED="hlsBufferCreated",w.BUFFER_APPENDING="hlsBufferAppending",w.BUFFER_APPENDED="hlsBufferAppended",w.BUFFER_EOS="hlsBufferEos",w.BUFFER_FLUSHING="hlsBufferFlushing",w.BUFFER_FLUSHED="hlsBufferFlushed",w.MANIFEST_LOADING="hlsManifestLoading",w.MANIFEST_LOADED="hlsManifestLoaded",w.MANIFEST_PARSED="hlsManifestParsed",w.LEVEL_SWITCHING="hlsLevelSwitching",w.LEVEL_SWITCHED="hlsLevelSwitched",w.LEVEL_LOADING="hlsLevelLoading",w.LEVEL_LOADED="hlsLevelLoaded",w.LEVEL_UPDATED="hlsLevelUpdated",w.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",w.LEVELS_UPDATED="hlsLevelsUpdated",w.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",w.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",w.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",w.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",w.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",w.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",w.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",w.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",w.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",w.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",w.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",w.CUES_PARSED="hlsCuesParsed",w.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",w.INIT_PTS_FOUND="hlsInitPtsFound",w.FRAG_LOADING="hlsFragLoading",w.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",w.FRAG_LOADED="hlsFragLoaded",w.FRAG_DECRYPTED="hlsFragDecrypted",w.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",w.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",w.FRAG_PARSING_METADATA="hlsFragParsingMetadata",w.FRAG_PARSED="hlsFragParsed",w.FRAG_BUFFERED="hlsFragBuffered",w.FRAG_CHANGED="hlsFragChanged",w.FPS_DROP="hlsFpsDrop",w.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",w.ERROR="hlsError",w.DESTROYING="hlsDestroying",w.KEY_LOADING="hlsKeyLoading",w.KEY_LOADED="hlsKeyLoaded",w.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",w.BACK_BUFFER_REACHED="hlsBackBufferReached"})(K||(K={}))},"./src/hls.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"default",function(){return g});var K=D("./node_modules/url-toolkit/src/url-toolkit.js"),w=D.n(K),P=D("./src/loader/playlist-loader.ts"),H=D("./src/loader/key-loader.ts"),W=D("./src/controller/id3-track-controller.ts"),I=D("./src/controller/latency-controller.ts"),M=D("./src/controller/level-controller.ts"),b=D("./src/controller/fragment-tracker.ts"),A=D("./src/controller/stream-controller.ts"),_=D("./src/is-supported.ts"),O=D("./src/utils/logger.ts"),L=D("./src/config.ts"),y=D("./node_modules/eventemitter3/index.js"),u=D.n(y),a=D("./src/events.ts"),s=D("./src/errors.ts");function d(m,k){for(var x=0;x<k.length;x++){var h=k[x];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(m,h.key,h)}}function E(m,k,x){return k&&d(m.prototype,k),x&&d(m,x),m}var g=function(){m.isSupported=function(){return Object(_.isSupported)()};function m(x){x===void 0&&(x={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new y.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 h=this.config=Object(L.mergeConfig)(m.DefaultConfig,x);this.userConfig=x,Object(O.enableLogs)(h.debug),this._autoLevelCapping=-1,h.progressive&&Object(L.enableStreamingMode)(h);var p=h.abrController,c=h.bufferController,o=h.capLevelController,S=h.fpsController,v=this.abrController=new p(this),T=this.bufferController=new c(this),N=this.capLevelController=new o(this),z=new S(this),Y=new P.default(this),ee=new H.default(this),G=new W.default(this),j=this.levelController=new M.default(this),te=new b.FragmentTracker(this),de=this.streamController=new A.default(this,te);N.setStreamController(de),z.setStreamController(de);var be=[j,de];this.networkControllers=be;var Oe=[Y,ee,v,T,N,z,G,te];this.audioTrackController=this.createController(h.audioTrackController,null,be),this.createController(h.audioStreamController,te,be),this.subtitleTrackController=this.createController(h.subtitleTrackController,null,be),this.createController(h.subtitleStreamController,te,be),this.createController(h.timelineController,null,Oe),this.emeController=this.createController(h.emeController,null,Oe),this.cmcdController=this.createController(h.cmcdController,null,Oe),this.latencyController=this.createController(I.default,null,Oe),this.coreComponents=Oe}var k=m.prototype;return k.createController=function(h,p,c){if(h){var o=p?new h(this,p):new h(this);return c&&c.push(o),o}return null},k.on=function(h,p,c){c===void 0&&(c=this),this._emitter.on(h,p,c)},k.once=function(h,p,c){c===void 0&&(c=this),this._emitter.once(h,p,c)},k.removeAllListeners=function(h){this._emitter.removeAllListeners(h)},k.off=function(h,p,c,o){c===void 0&&(c=this),this._emitter.off(h,p,c,o)},k.listeners=function(h){return this._emitter.listeners(h)},k.emit=function(h,p,c){return this._emitter.emit(h,p,c)},k.trigger=function(h,p){if(this.config.debug)return this.emit(h,h,p);try{return this.emit(h,h,p)}catch(c){O.logger.error("An internal error happened while handling event "+h+'. Error message: "'+c.message+'". Here is a stacktrace:',c),this.trigger(a.Events.ERROR,{type:s.ErrorTypes.OTHER_ERROR,details:s.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:h,error:c})}return!1},k.listenerCount=function(h){return this._emitter.listenerCount(h)},k.destroy=function(){O.logger.log("destroy"),this.trigger(a.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(h){return h.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(h){return h.destroy()}),this.coreComponents.length=0},k.attachMedia=function(h){O.logger.log("attachMedia"),this._media=h,this.trigger(a.Events.MEDIA_ATTACHING,{media:h})},k.detachMedia=function(){O.logger.log("detachMedia"),this.trigger(a.Events.MEDIA_DETACHING,void 0),this._media=null},k.loadSource=function(h){this.stopLoad();var p=this.media,c=this.url,o=this.url=K.buildAbsoluteURL(self.location.href,h,{alwaysNormalize:!0});O.logger.log("loadSource:"+o),p&&c&&c!==o&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(p)),this.trigger(a.Events.MANIFEST_LOADING,{url:h})},k.startLoad=function(h){h===void 0&&(h=-1),O.logger.log("startLoad("+h+")"),this.networkControllers.forEach(function(p){p.startLoad(h)})},k.stopLoad=function(){O.logger.log("stopLoad"),this.networkControllers.forEach(function(h){h.stopLoad()})},k.swapAudioCodec=function(){O.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},k.recoverMediaError=function(){O.logger.log("recoverMediaError");var h=this._media;this.detachMedia(),h&&this.attachMedia(h)},k.removeLevel=function(h,p){p===void 0&&(p=0),this.levelController.removeLevel(h,p)},E(m,[{key:"levels",get:function(){var h=this.levelController.levels;return h||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(h){O.logger.log("set currentLevel:"+h),this.loadLevel=h,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(h){O.logger.log("set nextLevel:"+h),this.levelController.manualLevel=h,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(h){O.logger.log("set loadLevel:"+h),this.levelController.manualLevel=h}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(h){this.levelController.nextLoadLevel=h}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(h){O.logger.log("set firstLevel:"+h),this.levelController.firstLevel=h}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(h){O.logger.log("set startLevel:"+h),h!==-1&&(h=Math.max(h,this.minAutoLevel)),this.levelController.startLevel=h}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(h){var p=!!h;p!==this.config.capLevelToPlayerSize&&(p?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=p)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(h){this._autoLevelCapping!==h&&(O.logger.log("set autoLevelCapping:"+h),this._autoLevelCapping=h)}},{key:"bandwidthEstimate",get:function(){var h=this.abrController.bwEstimator;return h?h.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var h=this.levels,p=this.config.minAutoBitrate;if(!h)return 0;for(var c=h.length,o=0;o<c;o++)if(h[o].maxBitrate>p)return o;return 0}},{key:"maxAutoLevel",get:function(){var h=this.levels,p=this.autoLevelCapping,c;return p===-1&&h&&h.length?c=h.length-1:c=p,c}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(h){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,h)}},{key:"audioTracks",get:function(){var h=this.audioTrackController;return h?h.audioTracks:[]}},{key:"audioTrack",get:function(){var h=this.audioTrackController;return h?h.audioTrack:-1},set:function(h){var p=this.audioTrackController;p&&(p.audioTrack=h)}},{key:"subtitleTracks",get:function(){var h=this.subtitleTrackController;return h?h.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var h=this.subtitleTrackController;return h?h.subtitleTrack:-1},set:function(h){var p=this.subtitleTrackController;p&&(p.subtitleTrack=h)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var h=this.subtitleTrackController;return h?h.subtitleDisplay:!1},set:function(h){var p=this.subtitleTrackController;p&&(p.subtitleDisplay=h)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(h){this.config.lowLatencyMode=h}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}],[{key:"version",get:function(){return"1.1.2"}},{key:"Events",get:function(){return a.Events}},{key:"ErrorTypes",get:function(){return s.ErrorTypes}},{key:"ErrorDetails",get:function(){return s.ErrorDetails}},{key:"DefaultConfig",get:function(){return m.defaultConfig?m.defaultConfig:L.hlsDefaultConfig},set:function(h){m.defaultConfig=h}}]),m}();g.defaultConfig=void 0},"./src/is-supported.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"isSupported",function(){return P}),D.d(X,"changeTypeSupported",function(){return H});var K=D("./src/utils/mediasource-helper.ts");function w(){return self.SourceBuffer||self.WebKitSourceBuffer}function P(){var W=Object(K.getMediaSource)();if(!W)return!1;var I=w(),M=W&&typeof W.isTypeSupported=="function"&&W.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),b=!I||I.prototype&&typeof I.prototype.appendBuffer=="function"&&typeof I.prototype.remove=="function";return!!M&&!!b}function H(){var W,I=w();return typeof(I==null||((W=I.prototype)===null||W===void 0)?void 0:W.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"default",function(){return O}),D.d(X,"LoadError",function(){return y});var K=D("./src/polyfills/number.ts"),w=D("./src/errors.ts");function P(u,a){u.prototype=Object.create(a.prototype),u.prototype.constructor=u,b(u,a)}function H(u){var a=typeof Map=="function"?new Map:void 0;return H=function(d){if(d===null||!M(d))return d;if(typeof d!="function")throw new TypeError("Super expression must either be null or a function");if(typeof a!="undefined"){if(a.has(d))return a.get(d);a.set(d,E)}function E(){return W(d,arguments,A(this).constructor)}return E.prototype=Object.create(d.prototype,{constructor:{value:E,enumerable:!1,writable:!0,configurable:!0}}),b(E,d)},H(u)}function W(u,a,s){return I()?W=Reflect.construct:W=function(E,g,m){var k=[null];k.push.apply(k,g);var x=Function.bind.apply(E,k),h=new x;return m&&b(h,m.prototype),h},W.apply(null,arguments)}function I(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(u){return!1}}function M(u){return Function.toString.call(u).indexOf("[native code]")!==-1}function b(u,a){return b=Object.setPrototypeOf||function(d,E){return d.__proto__=E,d},b(u,a)}function A(u){return A=Object.setPrototypeOf?Object.getPrototypeOf:function(s){return s.__proto__||Object.getPrototypeOf(s)},A(u)}var _=Math.pow(2,17),O=function(){function u(s){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=s}var a=u.prototype;return a.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},a.abort=function(){this.loader&&this.loader.abort()},a.load=function(d,E){var g=this,m=d.url;if(!m)return Promise.reject(new y({type:w.ErrorTypes.NETWORK_ERROR,details:w.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:d,networkDetails:null},"Fragment does not have a "+(m?"part list":"url")));this.abort();var k=this.config,x=k.fLoader,h=k.loader;return new Promise(function(p,c){g.loader&&g.loader.destroy();var o=g.loader=d.loader=x?new x(k):new h(k),S=L(d),v={timeout:k.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:k.fragLoadingMaxRetryTimeout,highWaterMark:_};d.stats=o.stats,o.load(S,v,{onSuccess:function(N,z,Y,ee){g.resetLoader(d,o),p({frag:d,part:null,payload:N.data,networkDetails:ee})},onError:function(N,z,Y){g.resetLoader(d,o),c(new y({type:w.ErrorTypes.NETWORK_ERROR,details:w.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:d,response:N,networkDetails:Y}))},onAbort:function(N,z,Y){g.resetLoader(d,o),c(new y({type:w.ErrorTypes.NETWORK_ERROR,details:w.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:d,networkDetails:Y}))},onTimeout:function(N,z,Y){g.resetLoader(d,o),c(new y({type:w.ErrorTypes.NETWORK_ERROR,details:w.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:d,networkDetails:Y}))},onProgress:function(N,z,Y,ee){E&&E({frag:d,part:null,payload:Y,networkDetails:ee})}})})},a.loadPart=function(d,E,g){var m=this;this.abort();var k=this.config,x=k.fLoader,h=k.loader;return new Promise(function(p,c){m.loader&&m.loader.destroy();var o=m.loader=d.loader=x?new x(k):new h(k),S=L(d,E),v={timeout:k.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:k.fragLoadingMaxRetryTimeout,highWaterMark:_};E.stats=o.stats,o.load(S,v,{onSuccess:function(N,z,Y,ee){m.resetLoader(d,o),m.updateStatsFromPart(d,E);var G={frag:d,part:E,payload:N.data,networkDetails:ee};g(G),p(G)},onError:function(N,z,Y){m.resetLoader(d,o),c(new y({type:w.ErrorTypes.NETWORK_ERROR,details:w.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:d,part:E,response:N,networkDetails:Y}))},onAbort:function(N,z,Y){d.stats.aborted=E.stats.aborted,m.resetLoader(d,o),c(new y({type:w.ErrorTypes.NETWORK_ERROR,details:w.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:d,part:E,networkDetails:Y}))},onTimeout:function(N,z,Y){m.resetLoader(d,o),c(new y({type:w.ErrorTypes.NETWORK_ERROR,details:w.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:d,part:E,networkDetails:Y}))}})})},a.updateStatsFromPart=function(d,E){var g=d.stats,m=E.stats,k=m.total;if(g.loaded+=m.loaded,k){var x=Math.round(d.duration/E.duration),h=Math.min(Math.round(g.loaded/k),x),p=x-h,c=p*Math.round(g.loaded/h);g.total=g.loaded+c}else g.total=Math.max(g.loaded,g.total);var o=g.loading,S=m.loading;o.start?o.first+=S.first-S.start:(o.start=S.start,o.first=S.first),o.end=S.end},a.resetLoader=function(d,E){d.loader=null,this.loader===E&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),E.destroy()},u}();function L(u,a){a===void 0&&(a=null);var s=a||u,d={frag:u,part:a,responseType:"arraybuffer",url:s.url,headers:{},rangeStart:0,rangeEnd:0},E=s.byteRangeStartOffset,g=s.byteRangeEndOffset;return Object(K.isFiniteNumber)(E)&&Object(K.isFiniteNumber)(g)&&(d.rangeStart=E,d.rangeEnd=g),d}var y=function(u){P(a,u);function a(s){for(var d,E=arguments.length,g=new Array(E>1?E-1:0),m=1;m<E;m++)g[m-1]=arguments[m];return d=u.call.apply(u,[this].concat(g))||this,d.data=void 0,d.data=s,d}return a}(H(Error))},"./src/loader/fragment.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"ElementaryStreamTypes",function(){return O}),D.d(X,"BaseSegment",function(){return L}),D.d(X,"Fragment",function(){return y}),D.d(X,"Part",function(){return u});var K=D("./src/polyfills/number.ts"),w=D("./node_modules/url-toolkit/src/url-toolkit.js"),P=D.n(w),H=D("./src/utils/logger.ts"),W=D("./src/loader/level-key.ts"),I=D("./src/loader/load-stats.ts");function M(a,s){a.prototype=Object.create(s.prototype),a.prototype.constructor=a,b(a,s)}function b(a,s){return b=Object.setPrototypeOf||function(E,g){return E.__proto__=g,E},b(a,s)}function A(a,s){for(var d=0;d<s.length;d++){var E=s[d];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(a,E.key,E)}}function _(a,s,d){return s&&A(a.prototype,s),d&&A(a,d),a}var O;(function(a){a.AUDIO="audio",a.VIDEO="video",a.AUDIOVIDEO="audiovideo"})(O||(O={}));var L=function(){function a(d){var E;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(E={},E[O.AUDIO]=null,E[O.VIDEO]=null,E[O.AUDIOVIDEO]=null,E),this.baseurl=d}var s=a.prototype;return s.setByteRange=function(E,g){var m=E.split("@",2),k=[];m.length===1?k[0]=g?g.byteRangeEndOffset:0:k[0]=parseInt(m[1]),k[1]=parseInt(m[0])+k[0],this._byteRange=k},_(a,[{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Object(w.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(E){this._url=E}}]),a}(),y=function(a){M(s,a);function s(E,g){var m;return m=a.call(this,g)||this,m._decryptdata=null,m.rawProgramDateTime=null,m.programDateTime=null,m.tagList=[],m.duration=0,m.sn=0,m.levelkey=void 0,m.type=void 0,m.loader=null,m.level=-1,m.cc=0,m.startPTS=void 0,m.endPTS=void 0,m.appendedPTS=void 0,m.startDTS=void 0,m.endDTS=void 0,m.start=0,m.deltaPTS=void 0,m.maxStartPTS=void 0,m.minEndPTS=void 0,m.stats=new I.LoadStats,m.urlId=0,m.data=void 0,m.bitrateTest=!1,m.title=null,m.initSegment=null,m.type=E,m}var d=s.prototype;return d.createInitializationVector=function(g){for(var m=new Uint8Array(16),k=12;k<16;k++)m[k]=g>>8*(15-k)&255;return m},d.setDecryptDataFromLevelKey=function(g,m){var k=g;return(g==null?void 0:g.method)==="AES-128"&&g.uri&&!g.iv&&(k=W.LevelKey.fromURI(g.uri),k.method=g.method,k.iv=this.createInitializationVector(m),k.keyFormat="identity"),k},d.setElementaryStreamInfo=function(g,m,k,x,h,p){p===void 0&&(p=!1);var c=this.elementaryStreams,o=c[g];if(!o){c[g]={startPTS:m,endPTS:k,startDTS:x,endDTS:h,partial:p};return}o.startPTS=Math.min(o.startPTS,m),o.endPTS=Math.max(o.endPTS,k),o.startDTS=Math.min(o.startDTS,x),o.endDTS=Math.max(o.endDTS,h)},d.clearElementaryStreamInfo=function(){var g=this.elementaryStreams;g[O.AUDIO]=null,g[O.VIDEO]=null,g[O.AUDIOVIDEO]=null},_(s,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var g=this.sn;typeof g!="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'),g=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,g)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(K.isFiniteNumber)(this.programDateTime))return null;var g=Object(K.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+g*1e3}},{key:"encrypted",get:function(){var g;return!!((g=this.decryptdata)!==null&&g!==void 0&&g.keyFormat&&this.decryptdata.uri)}}]),s}(L),u=function(a){M(s,a);function s(d,E,g,m,k){var x;x=a.call(this,g)||this,x.fragOffset=0,x.duration=0,x.gap=!1,x.independent=!1,x.relurl=void 0,x.fragment=void 0,x.index=void 0,x.stats=new I.LoadStats,x.duration=d.decimalFloatingPoint("DURATION"),x.gap=d.bool("GAP"),x.independent=d.bool("INDEPENDENT"),x.relurl=d.enumeratedString("URI"),x.fragment=E,x.index=m;var h=d.enumeratedString("BYTERANGE");return h&&x.setByteRange(h,k),k&&(x.fragOffset=k.fragOffset+k.duration),x}return _(s,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var E=this.elementaryStreams;return!!(E.audio||E.video||E.audiovideo)}}]),s}(L)},"./src/loader/key-loader.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"default",function(){return H});var K=D("./src/events.ts"),w=D("./src/errors.ts"),P=D("./src/utils/logger.ts"),H=function(){function W(M){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=M,this._registerListeners()}var I=W.prototype;return I._registerListeners=function(){this.hls.on(K.Events.KEY_LOADING,this.onKeyLoading,this)},I._unregisterListeners=function(){this.hls.off(K.Events.KEY_LOADING,this.onKeyLoading)},I.destroy=function(){this._unregisterListeners();for(var b in this.loaders){var A=this.loaders[b];A&&A.destroy()}this.loaders={}},I.onKeyLoading=function(b,A){var _=A.frag,O=_.type,L=this.loaders[O];if(!_.decryptdata){P.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var y=_.decryptdata.uri;if(y!==this.decrypturl||this.decryptkey===null){var u=this.hls.config;if(L&&(P.logger.warn("abort previous key loader for type:"+O),L.abort()),!y){P.logger.warn("key uri is falsy");return}var a=u.loader,s=_.loader=this.loaders[O]=new a(u);this.decrypturl=y,this.decryptkey=null;var d={url:y,frag:_,responseType:"arraybuffer"},E={timeout:u.fragLoadingTimeOut,maxRetry:0,retryDelay:u.fragLoadingRetryDelay,maxRetryDelay:u.fragLoadingMaxRetryTimeout,highWaterMark:0},g={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};s.load(d,E,g)}else this.decryptkey&&(_.decryptdata.key=this.decryptkey,this.hls.trigger(K.Events.KEY_LOADED,{frag:_}))},I.loadsuccess=function(b,A,_){var O=_.frag;if(!O.decryptdata){P.logger.error("after key load, decryptdata unset");return}this.decryptkey=O.decryptdata.key=new Uint8Array(b.data),O.loader=null,delete this.loaders[O.type],this.hls.trigger(K.Events.KEY_LOADED,{frag:O})},I.loaderror=function(b,A){var _=A.frag,O=_.loader;O&&O.abort(),delete this.loaders[_.type],this.hls.trigger(K.Events.ERROR,{type:w.ErrorTypes.NETWORK_ERROR,details:w.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:_,response:b})},I.loadtimeout=function(b,A){var _=A.frag,O=_.loader;O&&O.abort(),delete this.loaders[_.type],this.hls.trigger(K.Events.ERROR,{type:w.ErrorTypes.NETWORK_ERROR,details:w.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:_})},W}()},"./src/loader/level-details.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"LevelDetails",function(){return W});var K=D("./src/polyfills/number.ts");function w(I,M){for(var b=0;b<M.length;b++){var A=M[b];A.enumerable=A.enumerable||!1,A.configurable=!0,"value"in A&&(A.writable=!0),Object.defineProperty(I,A.key,A)}}function P(I,M,b){return M&&w(I.prototype,M),b&&w(I,b),I}var H=10,W=function(){function I(b){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=b}var M=I.prototype;return M.reloaded=function(A){if(!A){this.advanced=!0,this.updated=!0;return}var _=this.lastPartSn-A.lastPartSn,O=this.lastPartIndex-A.lastPartIndex;this.updated=this.endSN!==A.endSN||!!O||!!_,this.advanced=this.endSN>A.endSN||_>0||_===0&&O>0,this.updated||this.advanced?this.misses=Math.floor(A.misses*.6):this.misses=A.misses+1,this.availabilityDelay=A.availabilityDelay},P(I,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(K.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||H}},{key:"drift",get:function(){var A=this.driftEndTime-this.driftStartTime;if(A>0){var _=this.driftEnd-this.driftStart;return _*1e3/A}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var A;return(A=this.partList)!==null&&A!==void 0&&A.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var A;return(A=this.fragments)!==null&&A!==void 0&&A.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 A;return(A=this.partList)!==null&&A!==void 0&&A.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var A;return(A=this.partList)!==null&&A!==void 0&&A.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),I}()},"./src/loader/level-key.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"LevelKey",function(){return W});var K=D("./node_modules/url-toolkit/src/url-toolkit.js"),w=D.n(K);function P(I,M){for(var b=0;b<M.length;b++){var A=M[b];A.enumerable=A.enumerable||!1,A.configurable=!0,"value"in A&&(A.writable=!0),Object.defineProperty(I,A.key,A)}}function H(I,M,b){return M&&P(I.prototype,M),b&&P(I,b),I}var W=function(){I.fromURL=function(b,A){return new I(b,A)},I.fromURI=function(b){return new I(b)};function I(M,b){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,b?this._uri=Object(K.buildAbsoluteURL)(M,b,{alwaysNormalize:!0}):this._uri=M}return H(I,[{key:"uri",get:function(){return this._uri}}]),I}()},"./src/loader/load-stats.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"LoadStats",function(){return K});var K=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(ae,X,D){"use strict";D.r(X),D.d(X,"default",function(){return s});var K=D("./src/polyfills/number.ts"),w=D("./node_modules/url-toolkit/src/url-toolkit.js"),P=D.n(w),H=D("./src/loader/fragment.ts"),W=D("./src/loader/level-details.ts"),I=D("./src/loader/level-key.ts"),M=D("./src/utils/attr-list.ts"),b=D("./src/utils/logger.ts"),A=D("./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,O=/#EXT-X-MEDIA:(.*)/g,L=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),y=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("|")),u=/\.(mp4|m4s|m4v|m4a)$/i;function a(k){var x,h;return u.test((x=(h=w.parseURL(k))===null||h===void 0?void 0:h.path)!=null?x:"")}var s=function(){function k(){}return k.findGroup=function(h,p){for(var c=0;c<h.length;c++){var o=h[c];if(o.id===p)return o}},k.convertAVC1ToAVCOTI=function(h){var p=h.split(".");if(p.length>2){var c=p.shift()+".";return c+=parseInt(p.shift()).toString(16),c+=("000"+parseInt(p.shift()).toString(16)).substr(-4),c}return h},k.resolve=function(h,p){return w.buildAbsoluteURL(p,h,{alwaysNormalize:!0})},k.parseMasterPlaylist=function(h,p){var c=[],o={},S=!1;_.lastIndex=0;for(var v;(v=_.exec(h))!=null;)if(v[1]){var T=new M.AttrList(v[1]),N={attrs:T,bitrate:T.decimalInteger("AVERAGE-BANDWIDTH")||T.decimalInteger("BANDWIDTH"),name:T.NAME,url:k.resolve(v[2],p)},z=T.decimalResolution("RESOLUTION");z&&(N.width=z.width,N.height=z.height),d((T.CODECS||"").split(/[ ,]+/).filter(function(ee){return ee}),N),N.videoCodec&&N.videoCodec.indexOf("avc1")!==-1&&(N.videoCodec=k.convertAVC1ToAVCOTI(N.videoCodec)),c.push(N)}else if(v[3]){var Y=new M.AttrList(v[3]);Y["DATA-ID"]&&(S=!0,o[Y["DATA-ID"]]=Y)}return{levels:c,sessionData:S?o:null}},k.parseMasterPlaylistMedia=function(h,p,c,o){o===void 0&&(o=[]);var S,v=[],T=0;for(O.lastIndex=0;(S=O.exec(h))!==null;){var N=new M.AttrList(S[1]);if(N.TYPE===c){var z={attrs:N,bitrate:0,id:T++,groupId:N["GROUP-ID"],instreamId:N["INSTREAM-ID"],name:N.NAME||N.LANGUAGE||"",type:c,default:N.bool("DEFAULT"),autoselect:N.bool("AUTOSELECT"),forced:N.bool("FORCED"),lang:N.LANGUAGE,url:N.URI?k.resolve(N.URI,p):""};if(o.length){var Y=k.findGroup(o,z.groupId)||o[0];E(z,Y,"audioCodec"),E(z,Y,"textCodec")}v.push(z)}}return v},k.parseLevelPlaylist=function(h,p,c,o,S){var v=new W.LevelDetails(p),T=v.fragments,N=null,z=0,Y=0,ee=0,G=0,j=null,te=new H.Fragment(o,p),de,be,Oe,Ge=-1,Me=!1;for(L.lastIndex=0,v.m3u8=h;(de=L.exec(h))!==null;){Me&&(Me=!1,te=new H.Fragment(o,p),te.start=ee,te.sn=z,te.cc=G,te.level=c,N&&(te.initSegment=N,te.rawProgramDateTime=N.rawProgramDateTime));var Ie=de[1];if(Ie){te.duration=parseFloat(Ie);var Ue=(" "+de[2]).slice(1);te.title=Ue||null,te.tagList.push(Ue?["INF",Ie,Ue]:["INF",Ie])}else if(de[3])Object(K.isFiniteNumber)(te.duration)&&(te.start=ee,Oe&&(te.levelkey=Oe),te.sn=z,te.level=c,te.cc=G,te.urlId=S,T.push(te),te.relurl=(" "+de[3]).slice(1),m(te,j),j=te,ee+=te.duration,z++,Y=0,Me=!0);else if(de[4]){var Pe=(" "+de[4]).slice(1);j?te.setByteRange(Pe,j):te.setByteRange(Pe)}else if(de[5])te.rawProgramDateTime=(" "+de[5]).slice(1),te.tagList.push(["PROGRAM-DATE-TIME",te.rawProgramDateTime]),Ge===-1&&(Ge=T.length);else{if(de=de[0].match(y),!de){b.logger.warn("No matches on slow regex match for level playlist!");continue}for(be=1;be<de.length&&!(typeof de[be]!="undefined");be++);var Te=(" "+de[be]).slice(1),se=(" "+de[be+1]).slice(1),Fe=de[be+2]?(" "+de[be+2]).slice(1):"";switch(Te){case"PLAYLIST-TYPE":v.type=se.toUpperCase();break;case"MEDIA-SEQUENCE":z=v.startSN=parseInt(se);break;case"SKIP":{var dt=new M.AttrList(se),it=dt.decimalInteger("SKIPPED-SEGMENTS");if(Object(K.isFiniteNumber)(it)){v.skippedSegments=it;for(var ot=it;ot--;)T.unshift(null);z+=it}var ct=dt.enumeratedString("RECENTLY-REMOVED-DATERANGES");ct&&(v.recentlyRemovedDateranges=ct.split(" "));break}case"TARGETDURATION":v.targetduration=parseFloat(se);break;case"VERSION":v.version=parseInt(se);break;case"EXTM3U":break;case"ENDLIST":v.live=!1;break;case"#":(se||Fe)&&te.tagList.push(Fe?[se,Fe]:[se]);break;case"DIS":G++;case"GAP":te.tagList.push([Te]);break;case"BITRATE":te.tagList.push([Te,se]);break;case"DISCONTINUITY-SEQ":G=parseInt(se);break;case"KEY":{var je,Ye=new M.AttrList(se),rt=Ye.enumeratedString("METHOD"),st=Ye.URI,qe=Ye.hexadecimalInteger("IV"),Ve=Ye.enumeratedString("KEYFORMATVERSIONS"),Ke=Ye.enumeratedString("KEYID"),ht=(je=Ye.enumeratedString("KEYFORMAT"))!=null?je:"identity",ut=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(ut.indexOf(ht)>-1){b.logger.warn("Keyformat "+ht+" is not supported from the manifest");continue}else if(ht!=="identity")continue;rt&&(Oe=I.LevelKey.fromURL(p,st),st&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(rt)>=0&&(Oe.method=rt,Oe.keyFormat=ht,Ke&&(Oe.keyID=Ke),Ve&&(Oe.keyFormatVersions=Ve),Oe.iv=qe));break}case"START":{var ft=new M.AttrList(se),nt=ft.decimalFloatingPoint("TIME-OFFSET");Object(K.isFiniteNumber)(nt)&&(v.startTimeOffset=nt);break}case"MAP":{var Lt=new M.AttrList(se);te.relurl=Lt.URI,Lt.BYTERANGE&&te.setByteRange(Lt.BYTERANGE),te.level=c,te.sn="initSegment",Oe&&(te.levelkey=Oe),te.initSegment=null,N=te,Me=!0;break}case"SERVER-CONTROL":{var vt=new M.AttrList(se);v.canBlockReload=vt.bool("CAN-BLOCK-RELOAD"),v.canSkipUntil=vt.optionalFloat("CAN-SKIP-UNTIL",0),v.canSkipDateRanges=v.canSkipUntil>0&&vt.bool("CAN-SKIP-DATERANGES"),v.partHoldBack=vt.optionalFloat("PART-HOLD-BACK",0),v.holdBack=vt.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var bt=new M.AttrList(se);v.partTarget=bt.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Ne=v.partList;Ne||(Ne=v.partList=[]);var Ot=Y>0?Ne[Ne.length-1]:void 0,Et=Y++,We=new H.Part(new M.AttrList(se),te,p,Et,Ot);Ne.push(We),te.duration+=We.duration;break}case"PRELOAD-HINT":{var Ze=new M.AttrList(se);v.preloadHint=Ze;break}case"RENDITION-REPORT":{var we=new M.AttrList(se);v.renditionReports=v.renditionReports||[],v.renditionReports.push(we);break}default:b.logger.warn("line parsed but not handled: "+de);break}}}j&&!j.relurl?(T.pop(),ee-=j.duration,v.partList&&(v.fragmentHint=j)):v.partList&&(m(te,j),te.cc=G,v.fragmentHint=te);var ye=T.length,Ee=T[0],re=T[ye-1];if(ee+=v.skippedSegments*v.targetduration,ee>0&&ye&&re){v.averagetargetduration=ee/ye;var ie=re.sn;v.endSN=ie!=="initSegment"?ie:0,Ee&&(v.startCC=Ee.cc,Ee.initSegment||v.fragments.every(function(ue){return ue.relurl&&a(ue.relurl)})&&(b.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),te=new H.Fragment(o,p),te.relurl=re.relurl,te.level=c,te.sn="initSegment",Ee.initSegment=te,v.needSidxRanges=!0))}else v.endSN=0,v.startCC=0;return v.fragmentHint&&(ee+=v.fragmentHint.duration),v.totalduration=ee,v.endCC=G,Ge>0&&g(T,Ge),v},k}();function d(k,x){["video","audio","text"].forEach(function(h){var p=k.filter(function(o){return Object(A.isCodecType)(o,h)});if(p.length){var c=p.filter(function(o){return o.lastIndexOf("avc1",0)===0||o.lastIndexOf("mp4a",0)===0});x[h+"Codec"]=c.length>0?c[0]:p[0],k=k.filter(function(o){return p.indexOf(o)===-1})}}),x.unknownCodecs=k}function E(k,x,h){var p=x[h];p&&(k[h]=p)}function g(k,x){for(var h=k[x],p=x;p--;){var c=k[p];if(!c)return;c.programDateTime=h.programDateTime-c.duration*1e3,h=c}}function m(k,x){k.rawProgramDateTime?k.programDateTime=Date.parse(k.rawProgramDateTime):x!=null&&x.programDateTime&&(k.programDateTime=x.endProgramDateTime),Object(K.isFiniteNumber)(k.programDateTime)||(k.programDateTime=null,k.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(ae,X,D){"use strict";D.r(X);var K=D("./src/polyfills/number.ts"),w=D("./src/events.ts"),P=D("./src/errors.ts"),H=D("./src/utils/logger.ts"),W=D("./src/utils/mp4-tools.ts"),I=D("./src/loader/m3u8-parser.ts"),M=D("./src/types/loader.ts"),b=D("./src/utils/attr-list.ts");function A(L){var y=L.type;switch(y){case M.PlaylistContextType.AUDIO_TRACK:return M.PlaylistLevelType.AUDIO;case M.PlaylistContextType.SUBTITLE_TRACK:return M.PlaylistLevelType.SUBTITLE;default:return M.PlaylistLevelType.MAIN}}function _(L,y){var u=L.url;return(u===void 0||u.indexOf("data:")===0)&&(u=y.url),u}var O=function(){function L(u){this.hls=void 0,this.loaders=Object.create(null),this.hls=u,this.registerListeners()}var y=L.prototype;return y.registerListeners=function(){var a=this.hls;a.on(w.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.on(w.Events.LEVEL_LOADING,this.onLevelLoading,this),a.on(w.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),a.on(w.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},y.unregisterListeners=function(){var a=this.hls;a.off(w.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.off(w.Events.LEVEL_LOADING,this.onLevelLoading,this),a.off(w.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),a.off(w.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},y.createInternalLoader=function(a){var s=this.hls.config,d=s.pLoader,E=s.loader,g=d||E,m=new g(s);return a.loader=m,this.loaders[a.type]=m,m},y.getInternalLoader=function(a){return this.loaders[a.type]},y.resetInternalLoader=function(a){this.loaders[a]&&delete this.loaders[a]},y.destroyInternalLoaders=function(){for(var a in this.loaders){var s=this.loaders[a];s&&s.destroy(),this.resetInternalLoader(a)}},y.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},y.onManifestLoading=function(a,s){var d=s.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:M.PlaylistContextType.MANIFEST,url:d,deliveryDirectives:null})},y.onLevelLoading=function(a,s){var d=s.id,E=s.level,g=s.url,m=s.deliveryDirectives;this.load({id:d,groupId:null,level:E,responseType:"text",type:M.PlaylistContextType.LEVEL,url:g,deliveryDirectives:m})},y.onAudioTrackLoading=function(a,s){var d=s.id,E=s.groupId,g=s.url,m=s.deliveryDirectives;this.load({id:d,groupId:E,level:null,responseType:"text",type:M.PlaylistContextType.AUDIO_TRACK,url:g,deliveryDirectives:m})},y.onSubtitleTrackLoading=function(a,s){var d=s.id,E=s.groupId,g=s.url,m=s.deliveryDirectives;this.load({id:d,groupId:E,level:null,responseType:"text",type:M.PlaylistContextType.SUBTITLE_TRACK,url:g,deliveryDirectives:m})},y.load=function(a){var s,d=this.hls.config,E=this.getInternalLoader(a);if(E){var g=E.context;if(g&&g.url===a.url){H.logger.trace("[playlist-loader]: playlist request ongoing");return}H.logger.log("[playlist-loader]: aborting previous loader for type: "+a.type),E.abort()}var m,k,x,h;switch(a.type){case M.PlaylistContextType.MANIFEST:m=d.manifestLoadingMaxRetry,k=d.manifestLoadingTimeOut,x=d.manifestLoadingRetryDelay,h=d.manifestLoadingMaxRetryTimeout;break;case M.PlaylistContextType.LEVEL:case M.PlaylistContextType.AUDIO_TRACK:case M.PlaylistContextType.SUBTITLE_TRACK:m=0,k=d.levelLoadingTimeOut;break;default:m=d.levelLoadingMaxRetry,k=d.levelLoadingTimeOut,x=d.levelLoadingRetryDelay,h=d.levelLoadingMaxRetryTimeout;break}if(E=this.createInternalLoader(a),(s=a.deliveryDirectives)!==null&&s!==void 0&&s.part){var p;if(a.type===M.PlaylistContextType.LEVEL&&a.level!==null?p=this.hls.levels[a.level].details:a.type===M.PlaylistContextType.AUDIO_TRACK&&a.id!==null?p=this.hls.audioTracks[a.id].details:a.type===M.PlaylistContextType.SUBTITLE_TRACK&&a.id!==null&&(p=this.hls.subtitleTracks[a.id].details),p){var c=p.partTarget,o=p.targetduration;c&&o&&(k=Math.min(Math.max(c*3,o*.8)*1e3,k))}}var S={timeout:k,maxRetry:m,retryDelay:x,maxRetryDelay:h,highWaterMark:0},v={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};E.load(a,S,v)},y.loadsuccess=function(a,s,d,E){if(E===void 0&&(E=null),d.isSidxRequest){this.handleSidxRequest(a,d),this.handlePlaylistLoaded(a,s,d,E);return}this.resetInternalLoader(d.type);var g=a.data;if(g.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(a,d,"no EXTM3U delimiter",E);return}s.parsing.start=performance.now(),g.indexOf("#EXTINF:")>0||g.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(a,s,d,E):this.handleMasterPlaylist(a,s,d,E)},y.loaderror=function(a,s,d){d===void 0&&(d=null),this.handleNetworkError(s,d,!1,a)},y.loadtimeout=function(a,s,d){d===void 0&&(d=null),this.handleNetworkError(s,d,!0)},y.handleMasterPlaylist=function(a,s,d,E){var g=this.hls,m=a.data,k=_(a,d),x=I.default.parseMasterPlaylist(m,k),h=x.levels,p=x.sessionData;if(!h.length){this.handleManifestParsingError(a,d,"no level found in manifest",E);return}var c=h.map(function(z){return{id:z.attrs.AUDIO,audioCodec:z.audioCodec}}),o=h.map(function(z){return{id:z.attrs.SUBTITLES,textCodec:z.textCodec}}),S=I.default.parseMasterPlaylistMedia(m,k,"AUDIO",c),v=I.default.parseMasterPlaylistMedia(m,k,"SUBTITLES",o),T=I.default.parseMasterPlaylistMedia(m,k,"CLOSED-CAPTIONS");if(S.length){var N=S.some(function(z){return!z.url});!N&&h[0].audioCodec&&!h[0].attrs.AUDIO&&(H.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),S.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new b.AttrList({}),bitrate:0,url:""}))}g.trigger(w.Events.MANIFEST_LOADED,{levels:h,audioTracks:S,subtitles:v,captions:T,url:k,stats:s,networkDetails:E,sessionData:p})},y.handleTrackOrLevelPlaylist=function(a,s,d,E){var g=this.hls,m=d.id,k=d.level,x=d.type,h=_(a,d),p=Object(K.isFiniteNumber)(m)?m:0,c=Object(K.isFiniteNumber)(k)?k:p,o=A(d),S=I.default.parseLevelPlaylist(a.data,h,c,o,p);if(!S.fragments.length){g.trigger(w.Events.ERROR,{type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:h,reason:"no fragments found in level",level:typeof d.level=="number"?d.level:void 0});return}if(x===M.PlaylistContextType.MANIFEST){var v={attrs:new b.AttrList({}),bitrate:0,details:S,name:"",url:h};g.trigger(w.Events.MANIFEST_LOADED,{levels:[v],audioTracks:[],url:h,stats:s,networkDetails:E,sessionData:null})}if(s.parsing.end=performance.now(),S.needSidxRanges){var T,N=(T=S.fragments[0].initSegment)===null||T===void 0?void 0:T.url;this.load({url:N,isSidxRequest:!0,type:x,level:k,levelDetails:S,id:m,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}d.levelDetails=S,this.handlePlaylistLoaded(a,s,d,E)},y.handleSidxRequest=function(a,s){var d=Object(W.parseSegmentIndex)(new Uint8Array(a.data));if(!d)return;var E=d.references,g=s.levelDetails;E.forEach(function(m,k){var x=m.info,h=g.fragments[k];h.byteRange.length===0&&h.setByteRange(String(1+x.end-x.start)+"@"+String(x.start)),h.initSegment&&h.initSegment.setByteRange(String(d.moovEndOffset)+"@0")})},y.handleManifestParsingError=function(a,s,d,E){this.hls.trigger(w.Events.ERROR,{type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:s.type===M.PlaylistContextType.MANIFEST,url:a.url,reason:d,response:a,context:s,networkDetails:E})},y.handleNetworkError=function(a,s,d,E){d===void 0&&(d=!1),H.logger.warn("[playlist-loader]: A network "+(d?"timeout":"error")+" occurred while loading "+a.type+" level: "+a.level+" id: "+a.id+' group-id: "'+a.groupId+'"');var g=P.ErrorDetails.UNKNOWN,m=!1,k=this.getInternalLoader(a);switch(a.type){case M.PlaylistContextType.MANIFEST:g=d?P.ErrorDetails.MANIFEST_LOAD_TIMEOUT:P.ErrorDetails.MANIFEST_LOAD_ERROR,m=!0;break;case M.PlaylistContextType.LEVEL:g=d?P.ErrorDetails.LEVEL_LOAD_TIMEOUT:P.ErrorDetails.LEVEL_LOAD_ERROR,m=!1;break;case M.PlaylistContextType.AUDIO_TRACK:g=d?P.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:P.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,m=!1;break;case M.PlaylistContextType.SUBTITLE_TRACK:g=d?P.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:P.ErrorDetails.SUBTITLE_LOAD_ERROR,m=!1;break}k&&this.resetInternalLoader(a.type);var x={type:P.ErrorTypes.NETWORK_ERROR,details:g,fatal:m,url:a.url,loader:k,context:a,networkDetails:s};E&&(x.response=E),this.hls.trigger(w.Events.ERROR,x)},y.handlePlaylistLoaded=function(a,s,d,E){var g=d.type,m=d.level,k=d.id,x=d.groupId,h=d.loader,p=d.levelDetails,c=d.deliveryDirectives;if(!(p!=null&&p.targetduration)){this.handleManifestParsingError(a,d,"invalid target duration",E);return}if(!h)return;p.live&&(h.getCacheAge&&(p.ageHeader=h.getCacheAge()||0),(!h.getCacheAge||isNaN(p.ageHeader))&&(p.ageHeader=0));switch(g){case M.PlaylistContextType.MANIFEST:case M.PlaylistContextType.LEVEL:this.hls.trigger(w.Events.LEVEL_LOADED,{details:p,level:m||0,id:k||0,stats:s,networkDetails:E,deliveryDirectives:c});break;case M.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(w.Events.AUDIO_TRACK_LOADED,{details:p,id:k||0,groupId:x||"",stats:s,networkDetails:E,deliveryDirectives:c});break;case M.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(w.Events.SUBTITLE_TRACK_LOADED,{details:p,id:k||0,groupId:x||"",stats:s,networkDetails:E,deliveryDirectives:c});break}},L}();X.default=O},"./src/polyfills/number.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"isFiniteNumber",function(){return K}),D.d(X,"MAX_SAFE_INTEGER",function(){return w});var K=Number.isFinite||function(P){return typeof P=="number"&&isFinite(P)},w=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(ae,X,D){"use strict";D.r(X);var K=function(){function w(){}return w.getSilentFrame=function(H,W){switch(H){case"mp4a.40.2":if(W===1)return new Uint8Array([0,200,0,128,35,128]);if(W===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(W===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(W===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(W===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(W===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(W===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(W===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(W===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}return},w}();X.default=K},"./src/remux/mp4-generator.ts":function(ae,X,D){"use strict";D.r(X);var K=Math.pow(2,32)-1,w=function(){function P(){}return P.init=function(){P.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var W;for(W in P.types)P.types.hasOwnProperty(W)&&(P.types[W]=[W.charCodeAt(0),W.charCodeAt(1),W.charCodeAt(2),W.charCodeAt(3)]);var I=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]),M=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]);P.HDLR_TYPES={video:I,audio:M};var b=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),A=new Uint8Array([0,0,0,0,0,0,0,0]);P.STTS=P.STSC=P.STCO=A,P.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),P.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),P.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),P.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var _=new Uint8Array([105,115,111,109]),O=new Uint8Array([97,118,99,49]),L=new Uint8Array([0,0,0,1]);P.FTYP=P.box(P.types.ftyp,_,L,_,O),P.DINF=P.box(P.types.dinf,P.box(P.types.dref,b))},P.box=function(W){for(var I=8,M=arguments.length,b=new Array(M>1?M-1:0),A=1;A<M;A++)b[A-1]=arguments[A];for(var _=b.length,O=_;_--;)I+=b[_].byteLength;var L=new Uint8Array(I);for(L[0]=I>>24&255,L[1]=I>>16&255,L[2]=I>>8&255,L[3]=I&255,L.set(W,4),_=0,I=8;_<O;_++)L.set(b[_],I),I+=b[_].byteLength;return L},P.hdlr=function(W){return P.box(P.types.hdlr,P.HDLR_TYPES[W])},P.mdat=function(W){return P.box(P.types.mdat,W)},P.mdhd=function(W,I){I*=W;var M=Math.floor(I/(K+1)),b=Math.floor(I%(K+1));return P.box(P.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,W>>24&255,W>>16&255,W>>8&255,W&255,M>>24,M>>16&255,M>>8&255,M&255,b>>24,b>>16&255,b>>8&255,b&255,85,196,0,0]))},P.mdia=function(W){return P.box(P.types.mdia,P.mdhd(W.timescale,W.duration),P.hdlr(W.type),P.minf(W))},P.mfhd=function(W){return P.box(P.types.mfhd,new Uint8Array([0,0,0,0,W>>24,W>>16&255,W>>8&255,W&255]))},P.minf=function(W){return W.type==="audio"?P.box(P.types.minf,P.box(P.types.smhd,P.SMHD),P.DINF,P.stbl(W)):P.box(P.types.minf,P.box(P.types.vmhd,P.VMHD),P.DINF,P.stbl(W))},P.moof=function(W,I,M){return P.box(P.types.moof,P.mfhd(W),P.traf(M,I))},P.moov=function(W){for(var I=W.length,M=[];I--;)M[I]=P.trak(W[I]);return P.box.apply(null,[P.types.moov,P.mvhd(W[0].timescale,W[0].duration)].concat(M).concat(P.mvex(W)))},P.mvex=function(W){for(var I=W.length,M=[];I--;)M[I]=P.trex(W[I]);return P.box.apply(null,[P.types.mvex].concat(M))},P.mvhd=function(W,I){I*=W;var M=Math.floor(I/(K+1)),b=Math.floor(I%(K+1)),A=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,W>>24&255,W>>16&255,W>>8&255,W&255,M>>24,M>>16&255,M>>8&255,M&255,b>>24,b>>16&255,b>>8&255,b&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 P.box(P.types.mvhd,A)},P.sdtp=function(W){var I=W.samples||[],M=new Uint8Array(4+I.length),b,A;for(b=0;b<I.length;b++)A=I[b].flags,M[b+4]=A.dependsOn<<4|A.isDependedOn<<2|A.hasRedundancy;return P.box(P.types.sdtp,M)},P.stbl=function(W){return P.box(P.types.stbl,P.stsd(W),P.box(P.types.stts,P.STTS),P.box(P.types.stsc,P.STSC),P.box(P.types.stsz,P.STSZ),P.box(P.types.stco,P.STCO))},P.avc1=function(W){var I=[],M=[],b,A,_;for(b=0;b<W.sps.length;b++)A=W.sps[b],_=A.byteLength,I.push(_>>>8&255),I.push(_&255),I=I.concat(Array.prototype.slice.call(A));for(b=0;b<W.pps.length;b++)A=W.pps[b],_=A.byteLength,M.push(_>>>8&255),M.push(_&255),M=M.concat(Array.prototype.slice.call(A));var O=P.box(P.types.avcC,new Uint8Array([1,I[3],I[4],I[5],252|3,224|W.sps.length].concat(I).concat([W.pps.length]).concat(M))),L=W.width,y=W.height,u=W.pixelRatio[0],a=W.pixelRatio[1];return P.box(P.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,L>>8&255,L&255,y>>8&255,y&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]),O,P.box(P.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),P.box(P.types.pasp,new Uint8Array([u>>24,u>>16&255,u>>8&255,u&255,a>>24,a>>16&255,a>>8&255,a&255])))},P.esds=function(W){var I=W.config.length;return new Uint8Array([0,0,0,0,3,23+I,0,1,0,4,15+I,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([I]).concat(W.config).concat([6,1,2]))},P.mp4a=function(W){var I=W.samplerate;return P.box(P.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,W.channelCount,0,16,0,0,0,0,I>>8&255,I&255,0,0]),P.box(P.types.esds,P.esds(W)))},P.mp3=function(W){var I=W.samplerate;return P.box(P.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,W.channelCount,0,16,0,0,0,0,I>>8&255,I&255,0,0]))},P.stsd=function(W){return W.type==="audio"?!W.isAAC&&W.codec==="mp3"?P.box(P.types.stsd,P.STSD,P.mp3(W)):P.box(P.types.stsd,P.STSD,P.mp4a(W)):P.box(P.types.stsd,P.STSD,P.avc1(W))},P.tkhd=function(W){var I=W.id,M=W.duration*W.timescale,b=W.width,A=W.height,_=Math.floor(M/(K+1)),O=Math.floor(M%(K+1));return P.box(P.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,I>>24&255,I>>16&255,I>>8&255,I&255,0,0,0,0,_>>24,_>>16&255,_>>8&255,_&255,O>>24,O>>16&255,O>>8&255,O&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,b>>8&255,b&255,0,0,A>>8&255,A&255,0,0]))},P.traf=function(W,I){var M=P.sdtp(W),b=W.id,A=Math.floor(I/(K+1)),_=Math.floor(I%(K+1));return P.box(P.types.traf,P.box(P.types.tfhd,new Uint8Array([0,0,0,0,b>>24,b>>16&255,b>>8&255,b&255])),P.box(P.types.tfdt,new Uint8Array([1,0,0,0,A>>24,A>>16&255,A>>8&255,A&255,_>>24,_>>16&255,_>>8&255,_&255])),P.trun(W,M.length+16+20+8+16+8+8),M)},P.trak=function(W){return W.duration=W.duration||4294967295,P.box(P.types.trak,P.tkhd(W),P.mdia(W))},P.trex=function(W){var I=W.id;return P.box(P.types.trex,new Uint8Array([0,0,0,0,I>>24,I>>16&255,I>>8&255,I&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},P.trun=function(W,I){var M=W.samples||[],b=M.length,A=12+16*b,_=new Uint8Array(A),O,L,y,u,a,s;for(I+=8+A,_.set([0,0,15,1,b>>>24&255,b>>>16&255,b>>>8&255,b&255,I>>>24&255,I>>>16&255,I>>>8&255,I&255],0),O=0;O<b;O++)L=M[O],y=L.duration,u=L.size,a=L.flags,s=L.cts,_.set([y>>>24&255,y>>>16&255,y>>>8&255,y&255,u>>>24&255,u>>>16&255,u>>>8&255,u&255,a.isLeading<<2|a.dependsOn,a.isDependedOn<<6|a.hasRedundancy<<4|a.paddingValue<<1|a.isNonSync,a.degradPrio&240<<8,a.degradPrio&15,s>>>24&255,s>>>16&255,s>>>8&255,s&255],12+16*O);return P.box(P.types.trun,_)},P.initSegment=function(W){P.types||P.init();var I=P.moov(W),M=new Uint8Array(P.FTYP.byteLength+I.byteLength);return M.set(P.FTYP),M.set(I,P.FTYP.byteLength),M},P}();w.types=void 0,w.HDLR_TYPES=void 0,w.STTS=void 0,w.STSC=void 0,w.STCO=void 0,w.STSZ=void 0,w.VMHD=void 0,w.SMHD=void 0,w.STSD=void 0,w.FTYP=void 0,w.DINF=void 0,X.default=w},"./src/remux/mp4-remuxer.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"default",function(){return s}),D.d(X,"normalizePts",function(){return d});var K=D("./src/polyfills/number.ts"),w=D("./src/remux/aac-helper.ts"),P=D("./src/remux/mp4-generator.ts"),H=D("./src/events.ts"),W=D("./src/errors.ts"),I=D("./src/utils/logger.ts"),M=D("./src/types/loader.ts"),b=D("./src/utils/timescale-conversion.ts");function A(){return A=Object.assign||function(k){for(var x=1;x<arguments.length;x++){var h=arguments[x];for(var p in h)Object.prototype.hasOwnProperty.call(h,p)&&(k[p]=h[p])}return k},A.apply(this,arguments)}var _=10*1e3,O=1024,L=1152,y=null,u=null,a=!1,s=function(){function k(h,p,c,o){if(o===void 0&&(o=""),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=h,this.config=p,this.typeSupported=c,this.ISGenerated=!1,y===null){var S=navigator.userAgent||"",v=S.match(/Chrome\/(\d+)/i);y=v?parseInt(v[1]):0}if(u===null){var T=navigator.userAgent.match(/Safari\/(\d+)/i);u=T?parseInt(T[1]):0}a=!!y&&y<75||!!u&&u<600}var x=k.prototype;return x.destroy=function(){},x.resetTimeStamp=function(p){I.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=p},x.resetNextTimestamp=function(){I.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},x.resetInitSegment=function(){I.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},x.getVideoStartPts=function(p){var c=!1,o=p.reduce(function(S,v){var T=v.pts-S;return T<-4294967296?(c=!0,d(S,v.pts)):T>0?S:v.pts},p[0].pts);return c&&I.logger.debug("PTS rollover detected"),o},x.remux=function(p,c,o,S,v,T,N,z){var Y,ee,G,j,te,de,be=v,Oe=v,Ge=p.pid>-1,Me=c.pid>-1,Ie=c.samples.length,Ue=p.samples.length>0,Pe=Ie>1,Te=(!Ge||Ue)&&(!Me||Pe)||this.ISGenerated||N;if(Te){this.ISGenerated||(G=this.generateIS(p,c,v));var se=this.isVideoContiguous,Fe=-1;if(Pe&&(Fe=E(c.samples),!se&&this.config.forceKeyFrameOnDiscontinuity))if(de=!0,Fe>0){I.logger.warn("[mp4-remuxer]: Dropped "+Fe+" out of "+Ie+" video samples due to a missing keyframe");var dt=this.getVideoStartPts(c.samples);c.samples=c.samples.slice(Fe),c.dropped+=Fe,Oe+=(c.samples[0].pts-dt)/(c.timescale||9e4)}else Fe===-1&&(I.logger.warn("[mp4-remuxer]: No keyframe found out of "+Ie+" video samples"),de=!1);if(this.ISGenerated){if(Ue&&Pe){var it=this.getVideoStartPts(c.samples),ot=d(p.samples[0].pts,it)-it,ct=ot/c.inputTimeScale;be+=Math.max(0,ct),Oe+=Math.max(0,-ct)}if(Ue){if(p.samplerate||(I.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),G=this.generateIS(p,c,v)),ee=this.remuxAudio(p,be,this.isAudioContiguous,T,Me||Pe||z===M.PlaylistLevelType.AUDIO?Oe:void 0),Pe){var je=ee?ee.endPTS-ee.startPTS:0;c.inputTimeScale||(I.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),G=this.generateIS(p,c,v)),Y=this.remuxVideo(c,Oe,se,je)}}else Pe&&(Y=this.remuxVideo(c,Oe,se,0));Y&&(Y.firstKeyFrame=Fe,Y.independent=Fe!==-1)}}return this.ISGenerated&&(o.samples.length&&(te=this.remuxID3(o,v)),S.samples.length&&(j=this.remuxText(S,v))),{audio:ee,video:Y,initSegment:G,independent:de,text:j,id3:te}},x.generateIS=function(p,c,o){var S=p.samples,v=c.samples,T=this.typeSupported,N={},z=!Object(K.isFiniteNumber)(this._initPTS),Y="audio/mp4",ee,G,j;if(z&&(ee=G=Infinity),p.config&&S.length&&(p.timescale=p.samplerate,p.isAAC||(T.mpeg?(Y="audio/mpeg",p.codec=""):T.mp3&&(p.codec="mp3")),N.audio={id:"audio",container:Y,codec:p.codec,initSegment:!p.isAAC&&T.mpeg?new Uint8Array(0):P.default.initSegment([p]),metadata:{channelCount:p.channelCount}},z&&(j=p.inputTimeScale,ee=G=S[0].pts-Math.round(j*o))),c.sps&&c.pps&&v.length&&(c.timescale=c.inputTimeScale,N.video={id:"main",container:"video/mp4",codec:c.codec,initSegment:P.default.initSegment([c]),metadata:{width:c.width,height:c.height}},z)){j=c.inputTimeScale;var te=this.getVideoStartPts(v),de=Math.round(j*o);G=Math.min(G,d(v[0].dts,te)-de),ee=Math.min(ee,te-de)}if(Object.keys(N).length)return this.ISGenerated=!0,z&&(this._initPTS=ee,this._initDTS=G),{tracks:N,initPTS:ee,timescale:j}},x.remuxVideo=function(p,c,o,S){var v=p.inputTimeScale,T=p.samples,N=[],z=T.length,Y=this._initPTS,ee=this.nextAvcDts,G=8,j,te,de,be=Number.POSITIVE_INFINITY,Oe=Number.NEGATIVE_INFINITY,Ge=0,Me=!1;if(!o||ee===null){var Ie=c*v,Ue=T[0].pts-d(T[0].dts,T[0].pts);ee=Ie-Ue}for(var Pe=0;Pe<z;Pe++){var Te=T[Pe];if(Te.pts=d(Te.pts-Y,ee),Te.dts=d(Te.dts-Y,ee),Te.dts>Te.pts){var se=9e4*.2;Ge=Math.max(Math.min(Ge,Te.pts-Te.dts),-1*se)}Te.dts<T[Pe>0?Pe-1:Pe].dts&&(Me=!0)}Me&&T.sort(function(Gt,Kt){var Ct=Gt.dts-Kt.dts,pr=Gt.pts-Kt.pts;return Ct||pr}),te=T[0].dts,de=T[T.length-1].dts;var Fe=Math.round((de-te)/(z-1));if(Ge<0){if(Ge<Fe*-2){I.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(b.toMsFromMpegTsClock)(-Fe,!0)+" ms");for(var dt=Ge,it=0;it<z;it++)T[it].dts=dt=Math.max(dt,T[it].pts-Fe),T[it].pts=Math.max(dt,T[it].pts)}else{I.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(b.toMsFromMpegTsClock)(Ge,!0)+" ms to overcome this issue");for(var ot=0;ot<z;ot++)T[ot].dts=T[ot].dts+Ge}te=T[0].dts}if(o){var ct=te-ee,je=ct>Fe,Ye=ct<-1;if(je||Ye){je?I.logger.warn("AVC: "+Object(b.toMsFromMpegTsClock)(ct,!0)+" ms ("+ct+"dts) hole between fragments detected, filling it"):I.logger.warn("AVC: "+Object(b.toMsFromMpegTsClock)(-ct,!0)+" ms ("+ct+"dts) overlapping between fragments detected"),te=ee;var rt=T[0].pts-ct;T[0].dts=te,T[0].pts=rt,I.logger.log("Video: First PTS/DTS adjusted: "+Object(b.toMsFromMpegTsClock)(rt,!0)+"/"+Object(b.toMsFromMpegTsClock)(te,!0)+", delta: "+Object(b.toMsFromMpegTsClock)(ct,!0)+" ms")}}a&&(te=Math.max(0,te));for(var st=0,qe=0,Ve=0;Ve<z;Ve++){for(var Ke=T[Ve],ht=Ke.units,ut=ht.length,ft=0,nt=0;nt<ut;nt++)ft+=ht[nt].data.length;qe+=ft,st+=ut,Ke.length=ft,Ke.dts=Math.max(Ke.dts,te),Ke.pts=Math.max(Ke.pts,Ke.dts,0),be=Math.min(Ke.pts,be),Oe=Math.max(Ke.pts,Oe)}de=T[z-1].dts;var Lt=qe+4*st+8,vt;try{vt=new Uint8Array(Lt)}catch(Gt){this.observer.emit(H.Events.ERROR,H.Events.ERROR,{type:W.ErrorTypes.MUX_ERROR,details:W.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Lt,reason:"fail allocating video mdat "+Lt});return}var bt=new DataView(vt.buffer);bt.setUint32(0,Lt),vt.set(P.default.types.mdat,4);for(var Ne=0;Ne<z;Ne++){for(var Ot=T[Ne],Et=Ot.units,We=0,Ze=0,we=Et.length;Ze<we;Ze++){var ye=Et[Ze],Ee=ye.data,re=ye.data.byteLength;bt.setUint32(G,re),G+=4,vt.set(Ee,G),G+=re,We+=4+re}if(Ne<z-1)j=T[Ne+1].dts-Ot.dts;else{var ie=this.config,ue=Ot.dts-T[Ne>0?Ne-1:Ne].dts;if(ie.stretchShortVideoTrack&&this.nextAudioPts!==null){var ge=Math.floor(ie.maxBufferHole*v),Se=(S?be+S*v:this.nextAudioPts)-Ot.pts;Se>ge?(j=Se-ue,j<0&&(j=ue),I.logger.log("[mp4-remuxer]: It is approximately "+Se/90+" ms to the next segment; using duration "+j/90+" ms for the last video frame.")):j=ue}else j=ue}var Re=Math.round(Ot.pts-Ot.dts);N.push(new g(Ot.key,j,We,Re))}if(N.length&&y&&y<70){var Xe=N[0].flags;Xe.dependsOn=2,Xe.isNonSync=0}console.assert(j!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=ee=de+j,this.isVideoContiguous=!0;var xt=P.default.moof(p.sequenceNumber++,te,A({},p,{samples:N})),Mt="video",kt={data1:xt,data2:vt,startPTS:be/v,endPTS:(Oe+j)/v,startDTS:te/v,endDTS:ee/v,type:Mt,hasAudio:!1,hasVideo:!0,nb:N.length,dropped:p.dropped};return p.samples=[],p.dropped=0,console.assert(vt.length,"MDAT length must not be zero"),kt},x.remuxAudio=function(p,c,o,S,v){var T=p.inputTimeScale,N=p.samplerate?p.samplerate:T,z=T/N,Y=p.isAAC?O:L,ee=Y*z,G=this._initPTS,j=!p.isAAC&&this.typeSupported.mpeg,te=[],de=p.samples,be=j?0:8,Oe=this.nextAudioPts||-1,Ge=c*T;if(this.isAudioContiguous=o=o||de.length&&Oe>0&&(S&&Math.abs(Ge-Oe)<9e3||Math.abs(d(de[0].pts-G,Ge)-Oe)<20*ee),de.forEach(function(Ee){Ee.pts=d(Ee.pts-G,Ge)}),!o||Oe<0){if(de=de.filter(function(Ee){return Ee.pts>=0}),!de.length)return;v===0?Oe=0:S?Oe=Math.max(0,Ge):Oe=de[0].pts}if(p.isAAC)for(var Me=v!==void 0,Ie=this.config.maxAudioFramesDrift,Ue=0,Pe=Oe;Ue<de.length;Ue++){var Te=de[Ue],se=Te.pts,Fe=se-Pe,dt=Math.abs(1e3*Fe/T);if(Fe<=-Ie*ee&&Me)Ue===0&&(I.logger.warn("Audio frame @ "+(se/T).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*Fe/T)+" ms."),this.nextAudioPts=Oe=Pe=se);else if(Fe>=Ie*ee&&dt<_&&Me){var it=Math.round(Fe/ee);Pe=se-it*ee,Pe<0&&(it--,Pe+=ee),Ue===0&&(this.nextAudioPts=Oe=Pe),I.logger.warn("[mp4-remuxer]: Injecting "+it+" audio frame @ "+(Pe/T).toFixed(3)+"s due to "+Math.round(1e3*Fe/T)+" ms gap.");for(var ot=0;ot<it;ot++){var ct=Math.max(Pe,0),je=w.default.getSilentFrame(p.manifestCodec||p.codec,p.channelCount);je||(I.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),je=Te.unit.subarray()),de.splice(Ue,0,{unit:je,pts:ct}),Pe+=ee,Ue++}}Te.pts=Pe,Pe+=ee}for(var Ye=null,rt=null,st,qe=0,Ve=de.length;Ve--;)qe+=de[Ve].unit.byteLength;for(var Ke=0,ht=de.length;Ke<ht;Ke++){var ut=de[Ke],ft=ut.unit,nt=ut.pts;if(rt!==null){var Lt=te[Ke-1];Lt.duration=Math.round((nt-rt)/z)}else if(o&&p.isAAC&&(nt=Oe),Ye=nt,qe>0){qe+=be;try{st=new Uint8Array(qe)}catch(Ee){this.observer.emit(H.Events.ERROR,H.Events.ERROR,{type:W.ErrorTypes.MUX_ERROR,details:W.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:qe,reason:"fail allocating audio mdat "+qe});return}if(!j){var vt=new DataView(st.buffer);vt.setUint32(0,qe),st.set(P.default.types.mdat,4)}}else return;st.set(ft,be);var bt=ft.byteLength;be+=bt,te.push(new g(!0,Y,bt,0)),rt=nt}var Ne=te.length;if(!Ne)return;var Ot=te[te.length-1];this.nextAudioPts=Oe=rt+z*Ot.duration;var Et=j?new Uint8Array(0):P.default.moof(p.sequenceNumber++,Ye/z,A({},p,{samples:te}));p.samples=[];var We=Ye/T,Ze=Oe/T,we="audio",ye={data1:Et,data2:st,startPTS:We,endPTS:Ze,startDTS:We,endDTS:Ze,type:we,hasAudio:!0,hasVideo:!1,nb:Ne};return this.isAudioContiguous=!0,console.assert(st.length,"MDAT length must not be zero"),ye},x.remuxEmptyAudio=function(p,c,o,S){var v=p.inputTimeScale,T=p.samplerate?p.samplerate:v,N=v/T,z=this.nextAudioPts,Y=(z!==null?z:S.startDTS*v)+this._initDTS,ee=S.endDTS*v+this._initDTS,G=N*O,j=Math.ceil((ee-Y)/G),te=w.default.getSilentFrame(p.manifestCodec||p.codec,p.channelCount);if(I.logger.warn("[mp4-remuxer]: remux empty Audio"),!te){I.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var de=[],be=0;be<j;be++){var Oe=Y+be*G;de.push({unit:te,pts:Oe,dts:Oe})}return p.samples=de,this.remuxAudio(p,c,o,!1)},x.remuxID3=function(p,c){var o=p.samples.length;if(!o)return;for(var S=p.inputTimeScale,v=this._initPTS,T=this._initDTS,N=0;N<o;N++){var z=p.samples[N];z.pts=d(z.pts-v,c*S)/S,z.dts=d(z.dts-T,c*S)/S}var Y=p.samples;return p.samples=[],{samples:Y}},x.remuxText=function(p,c){var o=p.samples.length;if(!o)return;for(var S=p.inputTimeScale,v=this._initPTS,T=0;T<o;T++){var N=p.samples[T];N.pts=d(N.pts-v,c*S)/S}p.samples.sort(function(Y,ee){return Y.pts-ee.pts});var z=p.samples;return p.samples=[],{samples:z}},k}();function d(k,x){var h;if(x===null)return k;for(x<k?h=-8589934592:h=8589934592;Math.abs(k-x)>4294967296;)k+=h;return k}function E(k){for(var x=0;x<k.length;x++)if(k[x].key)return x;return-1}var g=function(x,h,p,c){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=h,this.size=p,this.cts=c,this.flags=new m(x)},m=function(x){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=x?2:1,this.isNonSync=x?0:1}},"./src/remux/passthrough-remuxer.ts":function(ae,X,D){"use strict";D.r(X);var K=D("./src/polyfills/number.ts"),w=D("./src/utils/mp4-tools.ts"),P=D("./src/loader/fragment.ts"),H=D("./src/utils/logger.ts"),W=function(){function b(){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 A=b.prototype;return A.destroy=function(){},A.resetTimeStamp=function(O){this.initPTS=O,this.lastEndDTS=null},A.resetNextTimestamp=function(){this.lastEndDTS=null},A.resetInitSegment=function(O,L,y){this.audioCodec=L,this.videoCodec=y,this.generateInitSegment(O),this.emitInitSegment=!0},A.generateInitSegment=function(O){var L=this.audioCodec,y=this.videoCodec;if(!O||!O.byteLength){this.initTracks=void 0,this.initData=void 0;return}var u=this.initData=Object(w.parseInitSegment)(O);L||(L=M(u.audio,P.ElementaryStreamTypes.AUDIO)),y||(y=M(u.video,P.ElementaryStreamTypes.VIDEO));var a={};u.audio&&u.video?a.audiovideo={container:"video/mp4",codec:L+","+y,initSegment:O,id:"main"}:u.audio?a.audio={container:"audio/mp4",codec:L,initSegment:O,id:"audio"}:u.video?a.video={container:"video/mp4",codec:y,initSegment:O,id:"main"}:H.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=a},A.remux=function(O,L,y,u,a){var s=this.initPTS,d=this.lastEndDTS,E={audio:void 0,video:void 0,text:u,id3:y,initSegment:void 0};Object(K.isFiniteNumber)(d)||(d=this.lastEndDTS=a||0);var g=L.samples;if(!g||!g.length)return E;var m={initPTS:void 0,timescale:1},k=this.initData;if((!k||!k.length)&&(this.generateInitSegment(g),k=this.initData),!k||!k.length)return H.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),E;this.emitInitSegment&&(m.tracks=this.initTracks,this.emitInitSegment=!1),Object(K.isFiniteNumber)(s)||(this.initPTS=m.initPTS=s=I(k,g,d));var x=Object(w.getDuration)(g,k),h=d,p=x+h;Object(w.offsetStartDTS)(k,g,s),x>0?this.lastEndDTS=p:(H.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var c=!!k.audio,o=!!k.video,S="";c&&(S+="audio"),o&&(S+="video");var v={data1:g,startPTS:h,startDTS:h,endPTS:p,endDTS:p,type:S,hasAudio:c,hasVideo:o,nb:1,dropped:0};return E.audio=v.type==="audio"?v:void 0,E.video=v.type!=="audio"?v:void 0,E.text=u,E.id3=y,E.initSegment=m,E},b}(),I=function(A,_,O){return Object(w.getStartDTS)(A,_)-O};function M(b,A){var _=b==null?void 0:b.codec;return _&&_.length>4?_:_==="hvc1"?"hvc1.1.c.L120.90":_==="av01"?"av01.0.04M.08":_==="avc1"||A===P.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}X.default=W},"./src/task-loop.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"default",function(){return K});var K=function(){function w(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var P=w.prototype;return P.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},P.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},P.onHandlerDestroyed=function(){},P.hasInterval=function(){return!!this._tickInterval},P.hasNextTick=function(){return!!this._tickTimer},P.setInterval=function(W){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,W),!0)},P.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},P.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},P.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},P.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},P.doTick=function(){},w}()},"./src/types/cmcd.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"CMCDVersion",function(){return K}),D.d(X,"CMCDObjectType",function(){return w}),D.d(X,"CMCDStreamingFormat",function(){return P}),D.d(X,"CMCDStreamType",function(){return H});var K=1,w;(function(W){W.MANIFEST="m",W.AUDIO="a",W.VIDEO="v",W.MUXED="av",W.INIT="i",W.CAPTION="c",W.TIMED_TEXT="tt",W.KEY="k",W.OTHER="o"})(w||(w={}));var P;(function(W){W.DASH="d",W.HLS="h",W.SMOOTH="s",W.OTHER="o"})(P||(P={}));var H;(function(W){W.VOD="v",W.LIVE="l"})(H||(H={}))},"./src/types/level.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"HlsSkip",function(){return P}),D.d(X,"getSkipValue",function(){return H}),D.d(X,"HlsUrlParameters",function(){return W}),D.d(X,"Level",function(){return I});function K(M,b){for(var A=0;A<b.length;A++){var _=b[A];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(M,_.key,_)}}function w(M,b,A){return b&&K(M.prototype,b),A&&K(M,A),M}var P;(function(M){M.No="",M.Yes="YES",M.v2="v2"})(P||(P={}));function H(M,b){var A=M.canSkipUntil,_=M.canSkipDateRanges,O=M.endSN,L=b!==void 0?b-O:0;return A&&L<A?_?P.v2:P.Yes:P.No}var W=function(){function M(A,_,O){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=A,this.part=_,this.skip=O}var b=M.prototype;return b.addDirectives=function(_){var O=new self.URL(_);return this.msn!==void 0&&O.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&O.searchParams.set("_HLS_part",this.part.toString()),this.skip&&O.searchParams.set("_HLS_skip",this.skip),O.toString()},M}(),I=function(){function M(b){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=[b.url],this.attrs=b.attrs,this.bitrate=b.bitrate,b.details&&(this.details=b.details),this.id=b.id||0,this.name=b.name,this.width=b.width||0,this.height=b.height||0,this.audioCodec=b.audioCodec,this.videoCodec=b.videoCodec,this.unknownCodecs=b.unknownCodecs,this.codecSet=[b.videoCodec,b.audioCodec].filter(function(A){return A}).join(",").replace(/\.[^.,]+/g,"")}return w(M,[{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(A){var _=A%this.url.length;this._urlId!==_&&(this.details=void 0,this._urlId=_)}}]),M}()},"./src/types/loader.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"PlaylistContextType",function(){return K}),D.d(X,"PlaylistLevelType",function(){return w});var K;(function(P){P.MANIFEST="manifest",P.LEVEL="level",P.AUDIO_TRACK="audioTrack",P.SUBTITLE_TRACK="subtitleTrack"})(K||(K={}));var w;(function(P){P.MAIN="main",P.AUDIO="audio",P.SUBTITLE="subtitle"})(w||(w={}))},"./src/types/transmuxer.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"ChunkMetadata",function(){return K});var K=function(H,W,I,M,b,A){M===void 0&&(M=0),b===void 0&&(b=-1),A===void 0&&(A=!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=w(),this.buffering={audio:w(),video:w(),audiovideo:w()},this.level=H,this.sn=W,this.id=I,this.size=M,this.part=b,this.partial=A};function w(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"AttrList",function(){return P});var K=/^(\d+)x(\d+)$/,w=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,P=function(){function H(I){typeof I=="string"&&(I=H.parseAttrList(I));for(var M in I)I.hasOwnProperty(M)&&(this[M]=I[M])}var W=H.prototype;return W.decimalInteger=function(M){var b=parseInt(this[M],10);return b>Number.MAX_SAFE_INTEGER?Infinity:b},W.hexadecimalInteger=function(M){if(this[M]){var b=(this[M]||"0x").slice(2);b=(b.length&1?"0":"")+b;for(var A=new Uint8Array(b.length/2),_=0;_<b.length/2;_++)A[_]=parseInt(b.slice(_*2,_*2+2),16);return A}else return null},W.hexadecimalIntegerAsNumber=function(M){var b=parseInt(this[M],16);return b>Number.MAX_SAFE_INTEGER?Infinity:b},W.decimalFloatingPoint=function(M){return parseFloat(this[M])},W.optionalFloat=function(M,b){var A=this[M];return A?parseFloat(A):b},W.enumeratedString=function(M){return this[M]},W.bool=function(M){return this[M]==="YES"},W.decimalResolution=function(M){var b=K.exec(this[M]);return b===null?void 0:{width:parseInt(b[1],10),height:parseInt(b[2],10)}},H.parseAttrList=function(M){var b,A={},_='"';for(w.lastIndex=0;(b=w.exec(M))!==null;){var O=b[2];O.indexOf(_)===0&&O.lastIndexOf(_)===O.length-1&&(O=O.slice(1,-1)),A[b[1]]=O}return A},H}()},"./src/utils/binary-search.ts":function(ae,X,D){"use strict";D.r(X);var K={search:function(P,H){for(var W=0,I=P.length-1,M=null,b=null;W<=I;){M=(W+I)/2|0,b=P[M];var A=H(b);if(A>0)W=M+1;else if(A<0)I=M-1;else return b}return null}};X.default=K},"./src/utils/buffer-helper.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"BufferHelper",function(){return P});var K=D("./src/utils/logger.ts"),w={length:0,start:function(){return 0},end:function(){return 0}},P=function(){function H(){}return H.isBuffered=function(I,M){try{if(I){for(var b=H.getBuffered(I),A=0;A<b.length;A++)if(M>=b.start(A)&&M<=b.end(A))return!0}}catch(_){}return!1},H.bufferInfo=function(I,M,b){try{if(I){var A=H.getBuffered(I),_=[],O;for(O=0;O<A.length;O++)_.push({start:A.start(O),end:A.end(O)});return this.bufferedInfo(_,M,b)}}catch(L){}return{len:0,start:M,end:M,nextStart:void 0}},H.bufferedInfo=function(I,M,b){M=Math.max(0,M),I.sort(function(m,k){var x=m.start-k.start;return x||k.end-m.end});var A=[];if(b)for(var _=0;_<I.length;_++){var O=A.length;if(O){var L=A[O-1].end;I[_].start-L<b?I[_].end>L&&(A[O-1].end=I[_].end):A.push(I[_])}else A.push(I[_])}else A=I;for(var y=0,u,a=M,s=M,d=0;d<A.length;d++){var E=A[d].start,g=A[d].end;if(M+b>=E&&M<g)a=E,s=g,y=s-M;else if(M+b<E){u=E;break}}return{len:y,start:a||0,end:s||0,nextStart:u}},H.getBuffered=function(I){try{return I.buffered}catch(M){return K.logger.log("failed to get media.buffered",M),w}},H}()},"./src/utils/cea-608-parser.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"Row",function(){return s}),D.d(X,"CaptionScreen",function(){return d});var K=D("./src/utils/logger.ts"),w={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},P=function(p){var c=p;return w.hasOwnProperty(p)&&(c=w[p]),String.fromCharCode(c)},H=15,W=100,I={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},M={17:2,18:4,21:6,22:8,23:10,19:13,20:15},b={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},A={25:2,26:4,29:6,30:8,31:10,27:13,28:15},_=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],O;(function(h){h[h.ERROR=0]="ERROR",h[h.TEXT=1]="TEXT",h[h.WARNING=2]="WARNING",h[h.INFO=2]="INFO",h[h.DEBUG=3]="DEBUG",h[h.DATA=3]="DATA"})(O||(O={}));var L=function(){function h(){this.time=null,this.verboseLevel=O.ERROR}var p=h.prototype;return p.log=function(o,S){this.verboseLevel>=o&&K.logger.log(this.time+" ["+o+"] "+S)},h}(),y=function(p){for(var c=[],o=0;o<p.length;o++)c.push(p[o].toString(16));return c},u=function(){function h(c,o,S,v,T){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=c||"white",this.underline=o||!1,this.italics=S||!1,this.background=v||"black",this.flash=T||!1}var p=h.prototype;return p.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},p.setStyles=function(o){for(var S=["foreground","underline","italics","background","flash"],v=0;v<S.length;v++){var T=S[v];o.hasOwnProperty(T)&&(this[T]=o[T])}},p.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},p.equals=function(o){return this.foreground===o.foreground&&this.underline===o.underline&&this.italics===o.italics&&this.background===o.background&&this.flash===o.flash},p.copy=function(o){this.foreground=o.foreground,this.underline=o.underline,this.italics=o.italics,this.background=o.background,this.flash=o.flash},p.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},h}(),a=function(){function h(c,o,S,v,T,N){this.uchar=void 0,this.penState=void 0,this.uchar=c||" ",this.penState=new u(o,S,v,T,N)}var p=h.prototype;return p.reset=function(){this.uchar=" ",this.penState.reset()},p.setChar=function(o,S){this.uchar=o,this.penState.copy(S)},p.setPenState=function(o){this.penState.copy(o)},p.equals=function(o){return this.uchar===o.uchar&&this.penState.equals(o.penState)},p.copy=function(o){this.uchar=o.uchar,this.penState.copy(o.penState)},p.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},h}(),s=function(){function h(c){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var o=0;o<W;o++)this.chars.push(new a);this.logger=c,this.pos=0,this.currPenState=new u}var p=h.prototype;return p.equals=function(o){for(var S=!0,v=0;v<W;v++)if(!this.chars[v].equals(o.chars[v])){S=!1;break}return S},p.copy=function(o){for(var S=0;S<W;S++)this.chars[S].copy(o.chars[S])},p.isEmpty=function(){for(var o=!0,S=0;S<W;S++)if(!this.chars[S].isEmpty()){o=!1;break}return o},p.setCursor=function(o){this.pos!==o&&(this.pos=o),this.pos<0?(this.logger.log(O.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>W&&(this.logger.log(O.DEBUG,"Too large cursor position "+this.pos),this.pos=W)},p.moveCursor=function(o){var S=this.pos+o;if(o>1)for(var v=this.pos+1;v<S+1;v++)this.chars[v].setPenState(this.currPenState);this.setCursor(S)},p.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},p.insertChar=function(o){o>=144&&this.backSpace();var S=P(o);if(this.pos>=W){this.logger.log(O.ERROR,"Cannot insert "+o.toString(16)+" ("+S+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(S,this.currPenState),this.moveCursor(1)},p.clearFromPos=function(o){var S;for(S=o;S<W;S++)this.chars[S].reset()},p.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},p.clearToEndOfRow=function(){this.clearFromPos(this.pos)},p.getTextString=function(){for(var o=[],S=!0,v=0;v<W;v++){var T=this.chars[v].uchar;T!==" "&&(S=!1),o.push(T)}return S?"":o.join("")},p.setPenStyles=function(o){this.currPenState.setStyles(o);var S=this.chars[this.pos];S.setPenState(this.currPenState)},h}(),d=function(){function h(c){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var o=0;o<H;o++)this.rows.push(new s(c));this.logger=c,this.currRow=H-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var p=h.prototype;return p.reset=function(){for(var o=0;o<H;o++)this.rows[o].clear();this.currRow=H-1},p.equals=function(o){for(var S=!0,v=0;v<H;v++)if(!this.rows[v].equals(o.rows[v])){S=!1;break}return S},p.copy=function(o){for(var S=0;S<H;S++)this.rows[S].copy(o.rows[S])},p.isEmpty=function(){for(var o=!0,S=0;S<H;S++)if(!this.rows[S].isEmpty()){o=!1;break}return o},p.backSpace=function(){var o=this.rows[this.currRow];o.backSpace()},p.clearToEndOfRow=function(){var o=this.rows[this.currRow];o.clearToEndOfRow()},p.insertChar=function(o){var S=this.rows[this.currRow];S.insertChar(o)},p.setPen=function(o){var S=this.rows[this.currRow];S.setPenStyles(o)},p.moveCursor=function(o){var S=this.rows[this.currRow];S.moveCursor(o)},p.setCursor=function(o){this.logger.log(O.INFO,"setCursor: "+o);var S=this.rows[this.currRow];S.setCursor(o)},p.setPAC=function(o){this.logger.log(O.INFO,"pacData = "+JSON.stringify(o));var S=o.row-1;if(this.nrRollUpRows&&S<this.nrRollUpRows-1&&(S=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==S){for(var v=0;v<H;v++)this.rows[v].clear();var T=this.currRow+1-this.nrRollUpRows,N=this.lastOutputScreen;if(N){var z=N.rows[T].cueStartTime,Y=this.logger.time;if(z&&Y!==null&&z<Y)for(var ee=0;ee<this.nrRollUpRows;ee++)this.rows[S-this.nrRollUpRows+ee+1].copy(N.rows[T+ee])}}this.currRow=S;var G=this.rows[this.currRow];if(o.indent!==null){var j=o.indent,te=Math.max(j-1,0);G.setCursor(o.indent),o.color=G.chars[te].penState.foreground}var de={foreground:o.color,underline:o.underline,italics:o.italics,background:"black",flash:!1};this.setPen(de)},p.setBkgData=function(o){this.logger.log(O.INFO,"bkgData = "+JSON.stringify(o)),this.backSpace(),this.setPen(o),this.insertChar(32)},p.setRollUpRows=function(o){this.nrRollUpRows=o},p.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(O.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(O.TEXT,this.getDisplayText());var o=this.currRow+1-this.nrRollUpRows,S=this.rows.splice(o,1)[0];S.clear(),this.rows.splice(this.currRow,0,S),this.logger.log(O.INFO,"Rolling up")},p.getDisplayText=function(o){o=o||!1;for(var S=[],v="",T=-1,N=0;N<H;N++){var z=this.rows[N].getTextString();z&&(T=N+1,o?S.push("Row "+T+": '"+z+"'"):S.push(z.trim()))}return S.length>0&&(o?v="["+S.join(" | ")+"]":v=S.join(`
`)),v},p.getTextAndFormat=function(){return this.rows},h}(),E=function(){function h(c,o,S){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=c,this.outputFilter=o,this.mode=null,this.verbose=0,this.displayedMemory=new d(S),this.nonDisplayedMemory=new d(S),this.lastOutputScreen=new d(S),this.currRollUpRow=this.displayedMemory.rows[H-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=S}var p=h.prototype;return p.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},p.getHandler=function(){return this.outputFilter},p.setHandler=function(o){this.outputFilter=o},p.setPAC=function(o){this.writeScreen.setPAC(o)},p.setBkgData=function(o){this.writeScreen.setBkgData(o)},p.setMode=function(o){if(o===this.mode)return;this.mode=o,this.logger.log(O.INFO,"MODE="+o),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=o},p.insertChars=function(o){for(var S=0;S<o.length;S++)this.writeScreen.insertChar(o[S]);var v=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(O.INFO,v+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(O.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},p.ccRCL=function(){this.logger.log(O.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},p.ccBS=function(){if(this.logger.log(O.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},p.ccAOF=function(){},p.ccAON=function(){},p.ccDER=function(){this.logger.log(O.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},p.ccRU=function(o){this.logger.log(O.INFO,"RU("+o+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(o)},p.ccFON=function(){this.logger.log(O.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},p.ccRDC=function(){this.logger.log(O.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},p.ccTR=function(){this.logger.log(O.INFO,"TR"),this.setMode("MODE_TEXT")},p.ccRTD=function(){this.logger.log(O.INFO,"RTD"),this.setMode("MODE_TEXT")},p.ccEDM=function(){this.logger.log(O.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},p.ccCR=function(){this.logger.log(O.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},p.ccENM=function(){this.logger.log(O.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},p.ccEOC=function(){if(this.logger.log(O.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var o=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=o,this.writeScreen=this.nonDisplayedMemory,this.logger.log(O.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},p.ccTO=function(o){this.logger.log(O.INFO,"TO("+o+") - Tab Offset"),this.writeScreen.moveCursor(o)},p.ccMIDROW=function(o){var S={flash:!1};if(S.underline=o%2===1,S.italics=o>=46,S.italics)S.foreground="white";else{var v=Math.floor(o/2)-16,T=["white","green","blue","cyan","red","yellow","magenta"];S.foreground=T[v]}this.logger.log(O.INFO,"MIDROW: "+JSON.stringify(S)),this.writeScreen.setPen(S)},p.outputDataUpdate=function(o){o===void 0&&(o=!1);var S=this.logger.time;if(S===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=S:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,S,this.lastOutputScreen),o&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:S),this.lastOutputScreen.copy(this.displayedMemory))},p.cueSplitAtTime=function(o){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,o,this.displayedMemory),this.cueStartTime=o))},h}(),g=function(){function h(c,o,S){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var v=new L;this.channels=[null,new E(c,o,v),new E(c+1,S,v)],this.cmdHistory=x(),this.logger=v}var p=h.prototype;return p.getHandler=function(o){return this.channels[o].getHandler()},p.setHandler=function(o,S){this.channels[o].setHandler(S)},p.addData=function(o,S){var v,T,N,z=!1;this.logger.time=o;for(var Y=0;Y<S.length;Y+=2){if(T=S[Y]&127,N=S[Y+1]&127,T===0&&N===0)continue;if(this.logger.log(O.DATA,"["+y([S[Y],S[Y+1]])+"] -> ("+y([T,N])+")"),v=this.parseCmd(T,N),v||(v=this.parseMidrow(T,N)),v||(v=this.parsePAC(T,N)),v||(v=this.parseBackgroundAttributes(T,N)),!v&&(z=this.parseChars(T,N),z)){var ee=this.currentChannel;if(ee&&ee>0){var G=this.channels[ee];G.insertChars(z)}else this.logger.log(O.WARNING,"No channel found yet. TEXT-MODE?")}!v&&!z&&this.logger.log(O.WARNING,"Couldn't parse cleaned data "+y([T,N])+" orig: "+y([S[Y],S[Y+1]]))}},p.parseCmd=function(o,S){var v=this.cmdHistory,T=(o===20||o===28||o===21||o===29)&&S>=32&&S<=47,N=(o===23||o===31)&&S>=33&&S<=35;if(!(T||N))return!1;if(k(o,S,v))return m(null,null,v),this.logger.log(O.DEBUG,"Repeated command ("+y([o,S])+") is dropped"),!0;var z=o===20||o===21||o===23?1:2,Y=this.channels[z];return o===20||o===21||o===28||o===29?S===32?Y.ccRCL():S===33?Y.ccBS():S===34?Y.ccAOF():S===35?Y.ccAON():S===36?Y.ccDER():S===37?Y.ccRU(2):S===38?Y.ccRU(3):S===39?Y.ccRU(4):S===40?Y.ccFON():S===41?Y.ccRDC():S===42?Y.ccTR():S===43?Y.ccRTD():S===44?Y.ccEDM():S===45?Y.ccCR():S===46?Y.ccENM():S===47&&Y.ccEOC():Y.ccTO(S-32),m(o,S,v),this.currentChannel=z,!0},p.parseMidrow=function(o,S){var v=0;if((o===17||o===25)&&S>=32&&S<=47){if(o===17?v=1:v=2,v!==this.currentChannel)return this.logger.log(O.ERROR,"Mismatch channel in midrow parsing"),!1;var T=this.channels[v];return T?(T.ccMIDROW(S),this.logger.log(O.DEBUG,"MIDROW ("+y([o,S])+")"),!0):!1}return!1},p.parsePAC=function(o,S){var v,T=this.cmdHistory,N=(o>=17&&o<=23||o>=25&&o<=31)&&S>=64&&S<=127,z=(o===16||o===24)&&S>=64&&S<=95;if(!(N||z))return!1;if(k(o,S,T))return m(null,null,T),!0;var Y=o<=23?1:2;S>=64&&S<=95?v=Y===1?I[o]:b[o]:v=Y===1?M[o]:A[o];var ee=this.channels[Y];return ee?(ee.setPAC(this.interpretPAC(v,S)),m(o,S,T),this.currentChannel=Y,!0):!1},p.interpretPAC=function(o,S){var v,T={color:null,italics:!1,indent:null,underline:!1,row:o};return S>95?v=S-96:v=S-64,T.underline=(v&1)===1,v<=13?T.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(v/2)]:v<=15?(T.italics=!0,T.color="white"):T.indent=Math.floor((v-16)/2)*4,T},p.parseChars=function(o,S){var v,T=null,N=null;if(o>=25?(v=2,N=o-8):(v=1,N=o),N>=17&&N<=19){var z;N===17?z=S+80:N===18?z=S+112:z=S+144,this.logger.log(O.INFO,"Special char '"+P(z)+"' in channel "+v),T=[z]}else o>=32&&o<=127&&(T=S===0?[o]:[o,S]);if(T){var Y=y(T);this.logger.log(O.DEBUG,"Char codes = "+Y.join(",")),m(o,S,this.cmdHistory)}return T},p.parseBackgroundAttributes=function(o,S){var v=(o===16||o===24)&&S>=32&&S<=47,T=(o===23||o===31)&&S>=45&&S<=47;if(!(v||T))return!1;var N,z={};o===16||o===24?(N=Math.floor((S-32)/2),z.background=_[N],S%2===1&&(z.background=z.background+"_semi")):S===45?z.background="transparent":(z.foreground="black",S===47&&(z.underline=!0));var Y=o<=23?1:2,ee=this.channels[Y];return ee.setBkgData(z),m(o,S,this.cmdHistory),!0},p.reset=function(){for(var o=0;o<Object.keys(this.channels).length;o++){var S=this.channels[o];S&&S.reset()}this.cmdHistory=x()},p.cueSplitAtTime=function(o){for(var S=0;S<this.channels.length;S++){var v=this.channels[S];v&&v.cueSplitAtTime(o)}},h}();function m(h,p,c){c.a=h,c.b=p}function k(h,p,c){return c.a===h&&c.b===p}function x(){return{a:null,b:null}}X.default=g},"./src/utils/codecs.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"isCodecType",function(){return w}),D.d(X,"isCodecSupportedInMp4",function(){return P});var K={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 w(H,W){var I=K[W];return!!I&&I[H.slice(0,4)]===!0}function P(H,W){return MediaSource.isTypeSupported((W||"video")+'/mp4;codecs="'+H+'"')}},"./src/utils/cues.ts":function(ae,X,D){"use strict";D.r(X);var K=D("./src/utils/vttparser.ts"),w=D("./src/utils/webvtt-parser.ts"),P=D("./src/utils/texttrack-utils.ts"),H=/\s/,W={newCue:function(M,b,A,_){for(var O=[],L,y,u,a,s,d=self.VTTCue||self.TextTrackCue,E=0;E<_.rows.length;E++)if(L=_.rows[E],u=!0,a=0,s="",!L.isEmpty()){for(var g=0;g<L.chars.length;g++)H.test(L.chars[g].uchar)&&u?a++:(s+=L.chars[g].uchar,u=!1);L.cueStartTime=b,b===A&&(A+=1e-4),a>=16?a--:a++;var m=Object(K.fixLineBreaks)(s.trim()),k=Object(w.generateCueId)(b,A,m);(!M||!M.cues||!M.cues.getCueById(k))&&(y=new d(b,A,m),y.id=k,y.line=E+1,y.align="left",y.position=10+Math.min(80,Math.floor(a*8/32)*10),O.push(y))}return M&&O.length&&(O.sort(function(x,h){return x.line==="auto"||h.line==="auto"?0:x.line>8&&h.line>8?h.line-x.line:x.line-h.line}),O.forEach(function(x){return Object(P.addCueToTrack)(M,x)})),O}};X.default=W},"./src/utils/discontinuities.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"findFirstFragWithCC",function(){return H}),D.d(X,"shouldAlignOnDiscontinuities",function(){return W}),D.d(X,"findDiscontinuousReferenceFrag",function(){return I}),D.d(X,"adjustSlidingStart",function(){return b}),D.d(X,"alignStream",function(){return A}),D.d(X,"alignPDT",function(){return O}),D.d(X,"alignFragmentByPDTDelta",function(){return L}),D.d(X,"alignMediaPlaylistByPDT",function(){return y});var K=D("./src/polyfills/number.ts"),w=D("./src/utils/logger.ts"),P=D("./src/controller/level-helper.ts");function H(u,a){for(var s=null,d=0,E=u.length;d<E;d++){var g=u[d];if(g&&g.cc===a){s=g;break}}return s}function W(u,a,s){return!!(a.details&&(s.endCC>s.startCC||u&&u.cc<s.startCC))}function I(u,a){var s=u.fragments,d=a.fragments;if(!d.length||!s.length){w.logger.log("No fragments to align");return}var E=H(s,d[0].cc);if(!E||E&&!E.startPTS){w.logger.log("No frag in previous level to align on");return}return E}function M(u,a){if(u){var s=u.start+a;u.start=u.startPTS=s,u.endPTS=s+u.duration}}function b(u,a){for(var s=a.fragments,d=0,E=s.length;d<E;d++)M(s[d],u);a.fragmentHint&&M(a.fragmentHint,u),a.alignedSliding=!0}function A(u,a,s){if(!a)return;_(u,s,a),!s.alignedSliding&&a.details&&O(s,a.details),!s.alignedSliding&&a.details&&!s.skippedSegments&&Object(P.adjustSliding)(a.details,s)}function _(u,a,s){if(W(u,s,a)){var d=I(s.details,a);d&&Object(K.isFiniteNumber)(d.start)&&(w.logger.log("Adjusting PTS using last level due to CC increase within current level "+a.url),b(d.start,a))}}function O(u,a){if(!a.fragments.length||!u.hasProgramDateTime||!a.hasProgramDateTime)return;var s=a.fragments[0].programDateTime,d=u.fragments[0].programDateTime,E=(d-s)/1e3+a.fragments[0].start;E&&Object(K.isFiniteNumber)(E)&&(w.logger.log("Adjusting PTS using programDateTime delta "+(d-s)+"ms, sliding:"+E.toFixed(3)+" "+u.url+" "),b(E,u))}function L(u,a){var s=u.programDateTime;if(!s)return;var d=(s-a)/1e3;u.start=u.startPTS=d,u.endPTS=d+u.duration}function y(u,a){if(!a.fragments.length||!u.hasProgramDateTime||!a.hasProgramDateTime)return;var s=a.fragments[0].programDateTime,d=a.fragments[0].start,E=s-d*1e3;u.fragments.forEach(function(g){L(g,E)}),u.fragmentHint&&L(u.fragmentHint,E),u.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(ae,X,D){"use strict";D.r(X);var K=D("./src/utils/ewma.ts"),w=function(){function P(W,I,M){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=M,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new K.default(W),this.fast_=new K.default(I)}var H=P.prototype;return H.update=function(I,M){var b=this.slow_,A=this.fast_;this.slow_.halfLife!==I&&(this.slow_=new K.default(I,b.getEstimate(),b.getTotalWeight())),this.fast_.halfLife!==M&&(this.fast_=new K.default(M,A.getEstimate(),A.getTotalWeight()))},H.sample=function(I,M){I=Math.max(I,this.minDelayMs_);var b=8*M,A=I/1e3,_=b/A;this.fast_.sample(A,_),this.slow_.sample(A,_)},H.canEstimate=function(){var I=this.fast_;return I&&I.getTotalWeight()>=this.minWeight_},H.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},H.destroy=function(){},P}();X.default=w},"./src/utils/ewma.ts":function(ae,X,D){"use strict";D.r(X);var K=function(){function w(H,W,I){W===void 0&&(W=0),I===void 0&&(I=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_=W,this.totalWeight_=I}var P=w.prototype;return P.sample=function(W,I){var M=Math.pow(this.alpha_,W);this.estimate_=I*(1-M)+M*this.estimate_,this.totalWeight_+=W},P.getTotalWeight=function(){return this.totalWeight_},P.getEstimate=function(){if(this.alpha_){var W=1-Math.pow(this.alpha_,this.totalWeight_);if(W)return this.estimate_/W}return this.estimate_},w}();X.default=K},"./src/utils/fetch-loader.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"fetchSupported",function(){return L});var K=D("./src/polyfills/number.ts"),w=D("./src/loader/load-stats.ts"),P=D("./src/demux/chunk-cache.ts");function H(d,E){d.prototype=Object.create(E.prototype),d.prototype.constructor=d,A(d,E)}function W(d){var E=typeof Map=="function"?new Map:void 0;return W=function(m){if(m===null||!b(m))return m;if(typeof m!="function")throw new TypeError("Super expression must either be null or a function");if(typeof E!="undefined"){if(E.has(m))return E.get(m);E.set(m,k)}function k(){return I(m,arguments,_(this).constructor)}return k.prototype=Object.create(m.prototype,{constructor:{value:k,enumerable:!1,writable:!0,configurable:!0}}),A(k,m)},W(d)}function I(d,E,g){return M()?I=Reflect.construct:I=function(k,x,h){var p=[null];p.push.apply(p,x);var c=Function.bind.apply(k,p),o=new c;return h&&A(o,h.prototype),o},I.apply(null,arguments)}function M(){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 b(d){return Function.toString.call(d).indexOf("[native code]")!==-1}function A(d,E){return A=Object.setPrototypeOf||function(m,k){return m.__proto__=k,m},A(d,E)}function _(d){return _=Object.setPrototypeOf?Object.getPrototypeOf:function(g){return g.__proto__||Object.getPrototypeOf(g)},_(d)}function O(){return O=Object.assign||function(d){for(var E=1;E<arguments.length;E++){var g=arguments[E];for(var m in g)Object.prototype.hasOwnProperty.call(g,m)&&(d[m]=g[m])}return d},O.apply(this,arguments)}function L(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(d){}return!1}var y=function(){function d(g){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=g.fetchSetup||a,this.controller=new self.AbortController,this.stats=new w.LoadStats}var E=d.prototype;return E.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},E.abortInternal=function(){var m=this.response;(!m||!m.ok)&&(this.stats.aborted=!0,this.controller.abort())},E.abort=function(){var m;this.abortInternal(),(m=this.callbacks)!==null&&m!==void 0&&m.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},E.load=function(m,k,x){var h=this,p=this.stats;if(p.loading.start)throw new Error("Loader can only be used once.");p.loading.start=self.performance.now();var c=u(m,this.controller.signal),o=x.onProgress,S=m.responseType==="arraybuffer",v=S?"byteLength":"length";this.context=m,this.config=k,this.callbacks=x,this.request=this.fetchSetup(m,c),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){h.abortInternal(),x.onTimeout(p,m,h.response)},k.timeout),self.fetch(this.request).then(function(T){if(h.response=h.loader=T,!T.ok){var N=T.status,z=T.statusText;throw new s(z||"fetch, bad network response",N,T)}return p.loading.first=Math.max(self.performance.now(),p.loading.start),p.total=parseInt(T.headers.get("Content-Length")||"0"),o&&Object(K.isFiniteNumber)(k.highWaterMark)?h.loadProgressively(T,p,m,k.highWaterMark,o):S?T.arrayBuffer():T.text()}).then(function(T){var N=h.response;self.clearTimeout(h.requestTimeout),p.loading.end=Math.max(self.performance.now(),p.loading.first),p.loaded=p.total=T[v];var z={url:N.url,data:T};o&&!Object(K.isFiniteNumber)(k.highWaterMark)&&o(p,m,T,N),x.onSuccess(z,p,m,N)}).catch(function(T){if(self.clearTimeout(h.requestTimeout),p.aborted)return;var N=T.code||0;x.onError({code:N,text:T.message},m,T.details)})},E.getCacheAge=function(){var m=null;if(this.response){var k=this.response.headers.get("age");m=k?parseFloat(k):null}return m},E.loadProgressively=function(m,k,x,h,p){h===void 0&&(h=0);var c=new P.default,o=m.body.getReader(),S=function v(){return o.read().then(function(T){if(T.done)return c.dataLength&&p(k,x,c.flush(),m),Promise.resolve(new ArrayBuffer(0));var N=T.value,z=N.length;return k.loaded+=z,z<h||c.dataLength?(c.push(N),c.dataLength>=h&&p(k,x,c.flush(),m)):p(k,x,N,m),v()}).catch(function(){return Promise.reject()})};return S()},d}();function u(d,E){var g={method:"GET",mode:"cors",credentials:"same-origin",signal:E,headers:new self.Headers(O({},d.headers))};return d.rangeEnd&&g.headers.set("Range","bytes="+d.rangeStart+"-"+String(d.rangeEnd-1)),g}function a(d,E){return new self.Request(d.url,E)}var s=function(d){H(E,d);function E(g,m,k){var x;return x=d.call(this,g)||this,x.code=void 0,x.details=void 0,x.code=m,x.details=k,x}return E}(W(Error));X.default=y},"./src/utils/imsc1-ttml-parser.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"IMSC1_CODEC",function(){return b}),D.d(X,"parseIMSC1",function(){return L});var K=D("./src/utils/mp4-tools.ts"),w=D("./src/utils/vttparser.ts"),P=D("./src/utils/vttcue.ts"),H=D("./src/demux/id3.ts"),W=D("./src/utils/timescale-conversion.ts"),I=D("./src/utils/webvtt-parser.ts");function M(){return M=Object.assign||function(h){for(var p=1;p<arguments.length;p++){var c=arguments[p];for(var o in c)Object.prototype.hasOwnProperty.call(c,o)&&(h[o]=c[o])}return h},M.apply(this,arguments)}var b="stpp.ttml.im1t",A=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,_=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,O={left:"start",center:"center",right:"end",start:"start",end:"end"};function L(h,p,c,o,S){var v=Object(K.findBox)(new Uint8Array(h),["mdat"]);if(v.length===0){S(new Error("Could not parse IMSC1 mdat"));return}var T=v[0],N=Object(H.utf8ArrayToStr)(new Uint8Array(h,T.start,T.end-T.start)),z=Object(W.toTimescaleFromScale)(p,1,c);try{o(y(N,z))}catch(Y){S(Y)}}function y(h,p){var c=new DOMParser,o=c.parseFromString(h,"text/xml"),S=o.getElementsByTagName("tt")[0];if(!S)throw new Error("Invalid ttml");var v={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},T=Object.keys(v).reduce(function(G,j){return G[j]=S.getAttribute("ttp:"+j)||v[j],G},{}),N=S.getAttribute("xml:space")!=="preserve",z=a(u(S,"styling","style")),Y=a(u(S,"layout","region")),ee=u(S,"body","[begin]");return[].map.call(ee,function(G){var j=s(G,N);if(!j||!G.hasAttribute("begin"))return null;var te=m(G.getAttribute("begin"),T),de=m(G.getAttribute("dur"),T),be=m(G.getAttribute("end"),T);if(te===null)throw g(G);if(be===null){if(de===null)throw g(G);be=te+de}var Oe=new P.default(te-p,be-p,j);Oe.id=Object(I.generateCueId)(Oe.startTime,Oe.endTime,Oe.text);var Ge=Y[G.getAttribute("region")],Me=z[G.getAttribute("style")];Oe.position=10,Oe.size=80;var Ie=d(Ge,Me),Ue=Ie.textAlign;if(Ue){var Pe=O[Ue];Pe&&(Oe.lineAlign=Pe),Oe.align=Ue}return M(Oe,Ie),Oe}).filter(function(G){return G!==null})}function u(h,p,c){var o=h.getElementsByTagName(p)[0];return o?[].slice.call(o.querySelectorAll(c)):[]}function a(h){return h.reduce(function(p,c){var o=c.getAttribute("xml:id");return o&&(p[o]=c),p},{})}function s(h,p){return[].slice.call(h.childNodes).reduce(function(c,o,S){var v;return o.nodeName==="br"&&S?c+`
`:(v=o.childNodes)!==null&&v!==void 0&&v.length?s(o,p):p?c+o.textContent.trim().replace(/\s+/g," "):c+o.textContent},"")}function d(h,p){var c="http://www.w3.org/ns/ttml#styling",o=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return o.reduce(function(S,v){var T=E(p,c,v)||E(h,c,v);return T&&(S[v]=T),S},{})}function E(h,p,c){return h.hasAttributeNS(p,c)?h.getAttributeNS(p,c):null}function g(h){return new Error("Could not parse ttml timestamp "+h)}function m(h,p){if(!h)return null;var c=Object(w.parseTimeStamp)(h);return c===null&&(A.test(h)?c=k(h,p):_.test(h)&&(c=x(h,p))),c}function k(h,p){var c=A.exec(h),o=(c[4]|0)+(c[5]|0)/p.subFrameRate;return(c[1]|0)*3600+(c[2]|0)*60+(c[3]|0)+o/p.frameRate}function x(h,p){var c=_.exec(h),o=Number(c[1]),S=c[2];switch(S){case"h":return o*3600;case"m":return o*60;case"ms":return o*1e3;case"f":return o/p.frameRate;case"t":return o/p.tickRate}return o}},"./src/utils/logger.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"enableLogs",function(){return I}),D.d(X,"logger",function(){return M});var K=function(){},w={trace:K,debug:K,log:K,warn:K,info:K,error:K},P=w;function H(b){var A=self.console[b];return A?A.bind(self.console,"["+b+"] >"):K}function W(b){for(var A=arguments.length,_=new Array(A>1?A-1:0),O=1;O<A;O++)_[O-1]=arguments[O];_.forEach(function(L){P[L]=b[L]?b[L].bind(b):H(L)})}function I(b){if(self.console&&b===!0||typeof b=="object"){W(b,"debug","log","info","warn","error");try{P.log()}catch(A){P=w}}else P=w}var M=P},"./src/utils/mediakeys-helper.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"KeySystems",function(){return K}),D.d(X,"requestMediaKeySystemAccess",function(){return w});var K;(function(P){P.WIDEVINE="com.widevine.alpha",P.PLAYREADY="com.microsoft.playready"})(K||(K={}));var w=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"getMediaSource",function(){return K});function K(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"bin2str",function(){return W}),D.d(X,"readUint16",function(){return I}),D.d(X,"readUint32",function(){return M}),D.d(X,"writeUint32",function(){return b}),D.d(X,"findBox",function(){return A}),D.d(X,"parseSegmentIndex",function(){return _}),D.d(X,"parseInitSegment",function(){return O}),D.d(X,"getStartDTS",function(){return L}),D.d(X,"getDuration",function(){return y}),D.d(X,"computeRawDurationFromSamples",function(){return u}),D.d(X,"offsetStartDTS",function(){return a}),D.d(X,"segmentValidRange",function(){return s}),D.d(X,"appendUint8Array",function(){return d});var K=D("./src/utils/typed-array.ts"),w=D("./src/loader/fragment.ts"),P=Math.pow(2,32)-1,H=[].push;function W(E){return String.fromCharCode.apply(null,E)}function I(E,g){"data"in E&&(g+=E.start,E=E.data);var m=E[g]<<8|E[g+1];return m<0?65536+m:m}function M(E,g){"data"in E&&(g+=E.start,E=E.data);var m=E[g]<<24|E[g+1]<<16|E[g+2]<<8|E[g+3];return m<0?4294967296+m:m}function b(E,g,m){"data"in E&&(g+=E.start,E=E.data),E[g]=m>>24,E[g+1]=m>>16&255,E[g+2]=m>>8&255,E[g+3]=m&255}function A(E,g){var m=[];if(!g.length)return m;var k,x,h;"data"in E?(k=E.data,x=E.start,h=E.end):(k=E,x=0,h=k.byteLength);for(var p=x;p<h;){var c=M(k,p),o=W(k.subarray(p+4,p+8)),S=c>1?p+c:h;if(o===g[0])if(g.length===1)m.push({data:k,start:p+8,end:S});else{var v=A({data:k,start:p+8,end:S},g.slice(1));v.length&&H.apply(m,v)}p=S}return m}function _(E){var g=A(E,["moov"]),m=g[0],k=m?m.end:null,x=A(E,["sidx"]);if(!x||!x[0])return null;var h=[],p=x[0],c=p.data[0],o=c===0?8:16,S=M(p,o);o+=4;var v=0,T=0;c===0?o+=8:o+=16,o+=2;var N=p.end+T,z=I(p,o);o+=2;for(var Y=0;Y<z;Y++){var ee=o,G=M(p,ee);ee+=4;var j=G&2147483647,te=(G&2147483648)>>>31;if(te===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var de=M(p,ee);ee+=4,h.push({referenceSize:j,subsegmentDuration:de,info:{duration:de/S,start:N,end:N+j-1}}),N+=j,ee+=4,o=ee}return{earliestPresentationTime:v,timescale:S,version:c,referencesCount:z,references:h,moovEndOffset:k}}function O(E){for(var g=[],m=A(E,["moov","trak"]),k=0;k<m.length;k++){var x=m[k],h=A(x,["tkhd"])[0];if(h){var p=h.data[h.start],c=p===0?12:20,o=M(h,c),S=A(x,["mdia","mdhd"])[0];if(S){p=S.data[S.start],c=p===0?12:20;var v=M(S,c),T=A(x,["mdia","hdlr"])[0];if(T){var N=W(T.data.subarray(T.start+8,T.start+12)),z={soun:w.ElementaryStreamTypes.AUDIO,vide:w.ElementaryStreamTypes.VIDEO}[N];if(z){var Y=A(x,["mdia","minf","stbl","stsd"])[0],ee=void 0;Y&&(ee=W(Y.data.subarray(Y.start+12,Y.start+16))),g[o]={timescale:v,type:z},g[z]={timescale:v,id:o,codec:ee}}}}}}var G=A(E,["moov","mvex","trex"]);return G.forEach(function(j){var te=M(j,4),de=g[te];de&&(de.default={duration:M(j,12),flags:M(j,20)})}),g}function L(E,g){return A(g,["moof","traf"]).reduce(function(m,k){var x=A(k,["tfdt"])[0],h=x.data[x.start],p=A(k,["tfhd"]).reduce(function(c,o){var S=M(o,4),v=E[S];if(v){var T=M(x,4);h===1&&(T*=Math.pow(2,32),T+=M(x,8));var N=v.timescale||9e4,z=T/N;if(isFinite(z)&&(c===null||z<c))return z}return c},null);return p!==null&&isFinite(p)&&(m===null||p<m)?p:m},null)||0}function y(E,g){for(var m=0,k=0,x=0,h=A(E,["moof","traf"]),p=0;p<h.length;p++){var c=h[p],o=A(c,["tfhd"])[0],S=M(o,4),v=g[S];if(!v)continue;var T=v.default,N=M(o,0)|(T==null?void 0:T.flags),z=T==null?void 0:T.duration;N&8&&(N&2?z=M(o,12):z=M(o,8));for(var Y=v.timescale||9e4,ee=A(c,["trun"]),G=0;G<ee.length;G++){if(z){var j=M(ee[G],4);m=z*j}else m=u(ee[G]);v.type===w.ElementaryStreamTypes.VIDEO?k+=m/Y:v.type===w.ElementaryStreamTypes.AUDIO&&(x+=m/Y)}}if(k===0&&x===0){var te=_(E);if(te!=null&&te.references)return te.references.reduce(function(de,be){return de+be.info.duration||0},0)}return k||x}function u(E){var g=M(E,0),m=8;g&1&&(m+=4),g&4&&(m+=4);for(var k=0,x=M(E,4),h=0;h<x;h++){if(g&256){var p=M(E,m);k+=p,m+=4}g&512&&(m+=4),g&1024&&(m+=4),g&2048&&(m+=4)}return k}function a(E,g,m){A(g,["moof","traf"]).forEach(function(k){A(k,["tfhd"]).forEach(function(x){var h=M(x,4),p=E[h];if(!p)return;var c=p.timescale||9e4;A(k,["tfdt"]).forEach(function(o){var S=o.data[o.start],v=M(o,4);if(S===0)b(o,4,v-m*c);else{v*=Math.pow(2,32),v+=M(o,8),v-=m*c,v=Math.max(v,0);var T=Math.floor(v/(P+1)),N=Math.floor(v%(P+1));b(o,4,T),b(o,8,N)}})})})}function s(E){var g={valid:null,remainder:null},m=A(E,["moof"]);if(m){if(m.length<2)return g.remainder=E,g}else return g;var k=m[m.length-1];return g.valid=Object(K.sliceUint8)(E,0,k.start-8),g.remainder=Object(K.sliceUint8)(E,k.start-8),g}function d(E,g){var m=new Uint8Array(E.length+g.length);return m.set(E),m.set(g,E.length),m}},"./src/utils/output-filter.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"default",function(){return K});var K=function(){function w(H,W){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=H,this.trackName=W}var P=w.prototype;return P.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},P.newCue=function(W,I,M){(this.startTime===null||this.startTime>W)&&(this.startTime=W),this.endTime=I,this.screen=M,this.timelineController.createCaptionsTrack(this.trackName)},P.reset=function(){this.cueRanges=[]},w}()},"./src/utils/texttrack-utils.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"sendAddTrackEvent",function(){return w}),D.d(X,"addCueToTrack",function(){return P}),D.d(X,"clearCurrentCues",function(){return H}),D.d(X,"removeCuesInRange",function(){return W}),D.d(X,"getCuesInRange",function(){return M});var K=D("./src/utils/logger.ts");function w(b,A){var _;try{_=new Event("addtrack")}catch(O){_=document.createEvent("Event"),_.initEvent("addtrack",!1,!1)}_.track=b,A.dispatchEvent(_)}function P(b,A){var _=b.mode;if(_==="disabled"&&(b.mode="hidden"),b.cues&&!b.cues.getCueById(A.id))try{if(b.addCue(A),!b.cues.getCueById(A.id))throw new Error("addCue is failed for: "+A)}catch(L){K.logger.debug("[texttrack-utils]: "+L);var O=new self.TextTrackCue(A.startTime,A.endTime,A.text);O.id=A.id,b.addCue(O)}_==="disabled"&&(b.mode=_)}function H(b){var A=b.mode;if(A==="disabled"&&(b.mode="hidden"),b.cues)for(var _=b.cues.length;_--;)b.removeCue(b.cues[_]);A==="disabled"&&(b.mode=A)}function W(b,A,_){var O=b.mode;if(O==="disabled"&&(b.mode="hidden"),b.cues&&b.cues.length>0)for(var L=M(b.cues,A,_),y=0;y<L.length;y++)b.removeCue(L[y]);O==="disabled"&&(b.mode=O)}function I(b,A){if(A<b[0].startTime)return 0;var _=b.length-1;if(A>b[_].endTime)return-1;for(var O=0,L=_;O<=L;){var y=Math.floor((L+O)/2);if(A<b[y].startTime)L=y-1;else if(A>b[y].startTime&&O<_)O=y+1;else return y}return b[O].startTime-A<A-b[L].startTime?O:L}function M(b,A,_){var O=[],L=I(b,A);if(L>-1)for(var y=L,u=b.length;y<u;y++){var a=b[y];if(a.startTime>=A&&a.endTime<=_)O.push(a);else if(a.startTime>_)return O}return O}},"./src/utils/time-ranges.ts":function(ae,X,D){"use strict";D.r(X);var K={toString:function(P){for(var H="",W=P.length,I=0;I<W;I++)H+="["+P.start(I).toFixed(3)+","+P.end(I).toFixed(3)+"]";return H}};X.default=K},"./src/utils/timescale-conversion.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"toTimescaleFromBase",function(){return w}),D.d(X,"toTimescaleFromScale",function(){return P}),D.d(X,"toMsFromMpegTsClock",function(){return H}),D.d(X,"toMpegTsClockFromTimescale",function(){return W});var K=9e4;function w(I,M,b,A){b===void 0&&(b=1),A===void 0&&(A=!1);var _=I*M*b;return A?Math.round(_):_}function P(I,M,b,A){return b===void 0&&(b=1),A===void 0&&(A=!1),w(I,M,1/b,A)}function H(I,M){return M===void 0&&(M=!1),w(I,1e3,1/K,M)}function W(I,M){return M===void 0&&(M=1),w(I,K,1/M)}},"./src/utils/typed-array.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"sliceUint8",function(){return K});function K(w,P,H){return Uint8Array.prototype.slice?w.slice(P,H):new Uint8Array(Array.prototype.slice.call(w,P,H))}},"./src/utils/vttcue.ts":function(ae,X,D){"use strict";D.r(X),X.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var K=["","lr","rl"],w=["start","middle","end","left","right"];function P(b,A){if(typeof A!="string")return!1;if(!Array.isArray(b))return!1;var _=A.toLowerCase();return~b.indexOf(_)?_:!1}function H(b){return P(K,b)}function W(b){return P(w,b)}function I(b){for(var A=arguments.length,_=new Array(A>1?A-1:0),O=1;O<A;O++)_[O-1]=arguments[O];for(var L=1;L<arguments.length;L++){var y=arguments[L];for(var u in y)b[u]=y[u]}return b}function M(b,A,_){var O=this,L={enumerable:!0};O.hasBeenReset=!1;var y="",u=!1,a=b,s=A,d=_,E=null,g="",m=!0,k="auto",x="start",h=50,p="middle",c=50,o="middle";Object.defineProperty(O,"id",I({},L,{get:function(){return y},set:function(v){y=""+v}})),Object.defineProperty(O,"pauseOnExit",I({},L,{get:function(){return u},set:function(v){u=!!v}})),Object.defineProperty(O,"startTime",I({},L,{get:function(){return a},set:function(v){if(typeof v!="number")throw new TypeError("Start time must be set to a number.");a=v,this.hasBeenReset=!0}})),Object.defineProperty(O,"endTime",I({},L,{get:function(){return s},set:function(v){if(typeof v!="number")throw new TypeError("End time must be set to a number.");s=v,this.hasBeenReset=!0}})),Object.defineProperty(O,"text",I({},L,{get:function(){return d},set:function(v){d=""+v,this.hasBeenReset=!0}})),Object.defineProperty(O,"region",I({},L,{get:function(){return E},set:function(v){E=v,this.hasBeenReset=!0}})),Object.defineProperty(O,"vertical",I({},L,{get:function(){return g},set:function(v){var T=H(v);if(T===!1)throw new SyntaxError("An invalid or illegal string was specified.");g=T,this.hasBeenReset=!0}})),Object.defineProperty(O,"snapToLines",I({},L,{get:function(){return m},set:function(v){m=!!v,this.hasBeenReset=!0}})),Object.defineProperty(O,"line",I({},L,{get:function(){return k},set:function(v){if(typeof v!="number"&&v!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");k=v,this.hasBeenReset=!0}})),Object.defineProperty(O,"lineAlign",I({},L,{get:function(){return x},set:function(v){var T=W(v);if(!T)throw new SyntaxError("An invalid or illegal string was specified.");x=T,this.hasBeenReset=!0}})),Object.defineProperty(O,"position",I({},L,{get:function(){return h},set:function(v){if(v<0||v>100)throw new Error("Position must be between 0 and 100.");h=v,this.hasBeenReset=!0}})),Object.defineProperty(O,"positionAlign",I({},L,{get:function(){return p},set:function(v){var T=W(v);if(!T)throw new SyntaxError("An invalid or illegal string was specified.");p=T,this.hasBeenReset=!0}})),Object.defineProperty(O,"size",I({},L,{get:function(){return c},set:function(v){if(v<0||v>100)throw new Error("Size must be between 0 and 100.");c=v,this.hasBeenReset=!0}})),Object.defineProperty(O,"align",I({},L,{get:function(){return o},set:function(v){var T=W(v);if(!T)throw new SyntaxError("An invalid or illegal string was specified.");o=T,this.hasBeenReset=!0}})),O.displayState=void 0}return M.prototype.getCueAsHTML=function(){var b=self.WebVTT;return b.convertCueToDOMTree(self,this.text)},M}()},"./src/utils/vttparser.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"parseTimeStamp",function(){return P}),D.d(X,"fixLineBreaks",function(){return A}),D.d(X,"VTTParser",function(){return _});var K=D("./src/utils/vttcue.ts"),w=function(){function O(){}var L=O.prototype;return L.decode=function(u,a){if(!u)return"";if(typeof u!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(u))},O}();function P(O){function L(u,a,s,d){return(u|0)*3600+(a|0)*60+(s|0)+parseFloat(d||0)}var y=O.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return y?parseFloat(y[2])>59?L(y[2],y[3],0,y[4]):L(y[1],y[2],y[3],y[4]):null}var H=function(){function O(){this.values=Object.create(null)}var L=O.prototype;return L.set=function(u,a){!this.get(u)&&a!==""&&(this.values[u]=a)},L.get=function(u,a,s){return s?this.has(u)?this.values[u]:a[s]:this.has(u)?this.values[u]:a},L.has=function(u){return u in this.values},L.alt=function(u,a,s){for(var d=0;d<s.length;++d)if(a===s[d]){this.set(u,a);break}},L.integer=function(u,a){/^-?\d+$/.test(a)&&this.set(u,parseInt(a,10))},L.percent=function(u,a){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(a)){var s=parseFloat(a);if(s>=0&&s<=100)return this.set(u,s),!0}return!1},O}();function W(O,L,y,u){var a=u?O.split(u):[O];for(var s in a){if(typeof a[s]!="string")continue;var d=a[s].split(y);if(d.length!==2)continue;var E=d[0],g=d[1];L(E,g)}}var I=new K.default(0,0,""),M=I.align==="middle"?"middle":"center";function b(O,L,y){var u=O;function a(){var E=P(O);if(E===null)throw new Error("Malformed timestamp: "+u);return O=O.replace(/^[^\sa-zA-Z-]+/,""),E}function s(E,g){var m=new H;W(E,function(h,p){var c;switch(h){case"region":for(var o=y.length-1;o>=0;o--)if(y[o].id===p){m.set(h,y[o].region);break}break;case"vertical":m.alt(h,p,["rl","lr"]);break;case"line":c=p.split(","),m.integer(h,c[0]),m.percent(h,c[0])&&m.set("snapToLines",!1),m.alt(h,c[0],["auto"]),c.length===2&&m.alt("lineAlign",c[1],["start",M,"end"]);break;case"position":c=p.split(","),m.percent(h,c[0]),c.length===2&&m.alt("positionAlign",c[1],["start",M,"end","line-left","line-right","auto"]);break;case"size":m.percent(h,p);break;case"align":m.alt(h,p,["start",M,"end","left","right"]);break}},/:/,/\s/),g.region=m.get("region",null),g.vertical=m.get("vertical","");var k=m.get("line","auto");k==="auto"&&I.line===-1&&(k=-1),g.line=k,g.lineAlign=m.get("lineAlign","start"),g.snapToLines=m.get("snapToLines",!0),g.size=m.get("size",100),g.align=m.get("align",M);var x=m.get("position","auto");x==="auto"&&I.position===50&&(x=g.align==="start"||g.align==="left"?0:g.align==="end"||g.align==="right"?100:50),g.position=x}function d(){O=O.replace(/^\s+/,"")}if(d(),L.startTime=a(),d(),O.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+u);O=O.substr(3),d(),L.endTime=a(),d(),s(O,L)}function A(O){return O.replace(/<br(?: \/)?>/gi,`
`)}var _=function(){function O(){this.state="INITIAL",this.buffer="",this.decoder=new w,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var L=O.prototype;return L.parse=function(u){var a=this;u&&(a.buffer+=a.decoder.decode(u,{stream:!0}));function s(){var x=a.buffer,h=0;for(x=A(x);h<x.length&&x[h]!=="\r"&&x[h]!==`
`;)++h;var p=x.substr(0,h);return x[h]==="\r"&&++h,x[h]===`
`&&++h,a.buffer=x.substr(h),p}function d(x){W(x,function(h,p){},/:/)}try{var E="";if(a.state==="INITIAL"){if(!/\r\n|\n/.test(a.buffer))return this;E=s();var g=E.match(/^()?WEBVTT([ \t].*)?$/);if(!g||!g[0])throw new Error("Malformed WebVTT signature.");a.state="HEADER"}for(var m=!1;a.buffer;){if(!/\r\n|\n/.test(a.buffer))return this;m?m=!1:E=s();switch(a.state){case"HEADER":/:/.test(E)?d(E):E||(a.state="ID");continue;case"NOTE":E||(a.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(E)){a.state="NOTE";break}if(!E)continue;if(a.cue=new K.default(0,0,""),a.state="CUE",E.indexOf("-->")===-1){a.cue.id=E;continue}case"CUE":if(!a.cue){a.state="BADCUE";continue}try{b(E,a.cue,a.regionList)}catch(x){a.cue=null,a.state="BADCUE";continue}a.state="CUETEXT";continue;case"CUETEXT":{var k=E.indexOf("-->")!==-1;if(!E||k&&(m=!0)){a.oncue&&a.cue&&a.oncue(a.cue),a.cue=null,a.state="ID";continue}if(a.cue===null)continue;a.cue.text&&(a.cue.text+=`
`),a.cue.text+=E}continue;case"BADCUE":E||(a.state="ID")}}}catch(x){a.state==="CUETEXT"&&a.cue&&a.oncue&&a.oncue(a.cue),a.cue=null,a.state=a.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},L.flush=function(){var u=this;try{if((u.cue||u.state==="HEADER")&&(u.buffer+=`
`,u.parse()),u.state==="INITIAL"||u.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(a){u.onparsingerror&&u.onparsingerror(a)}return u.onflush&&u.onflush(),this},O}()},"./src/utils/webvtt-parser.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"generateCueId",function(){return _}),D.d(X,"parseWebVTT",function(){return L});var K=D("./src/polyfills/number.ts"),w=D("./src/utils/vttparser.ts"),P=D("./src/demux/id3.ts"),H=D("./src/utils/timescale-conversion.ts"),W=D("./src/remux/mp4-remuxer.ts"),I=/\r\n|\n\r|\n|\r/g,M=function(u,a,s){return s===void 0&&(s=0),u.substr(s,a.length)===a},b=function(u){var a=parseInt(u.substr(-3)),s=parseInt(u.substr(-6,2)),d=parseInt(u.substr(-9,2)),E=u.length>9?parseInt(u.substr(0,u.indexOf(":"))):0;if(!Object(K.isFiniteNumber)(a)||!Object(K.isFiniteNumber)(s)||!Object(K.isFiniteNumber)(d)||!Object(K.isFiniteNumber)(E))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+u);return a+=1e3*s,a+=60*1e3*d,a+=60*60*1e3*E,a},A=function(u){for(var a=5381,s=u.length;s;)a=a*33^u.charCodeAt(--s);return(a>>>0).toString()};function _(y,u,a){return A(y.toString())+A(u.toString())+A(a)}var O=function(u,a,s){var d=u[a],E=u[d.prevCC];if(!E||!E.new&&d.new){u.ccOffset=u.presentationOffset=d.start,d.new=!1;return}for(;(g=E)!==null&&g!==void 0&&g.new;){var g;u.ccOffset+=d.start-E.start,d.new=!1,d=E,E=u[d.prevCC]}u.presentationOffset=s};function L(y,u,a,s,d,E,g,m){var k=new w.VTTParser,x=Object(P.utf8ArrayToStr)(new Uint8Array(y)).trim().replace(I,`
`).split(`
`),h=[],p=Object(H.toMpegTsClockFromTimescale)(u,a),c="00:00.000",o=0,S=0,v,T=!0,N=!1;k.oncue=function(z){var Y=s[d],ee=s.ccOffset,G=(o-p)/9e4;if(Y!=null&&Y.new&&(S!==void 0?ee=s.ccOffset=Y.start:O(s,d,G)),G&&(ee=G-s.presentationOffset),N){var j=z.endTime-z.startTime,te=Object(W.normalizePts)((z.startTime+ee-S)*9e4,E*9e4)/9e4;z.startTime=te,z.endTime=te+j}var de=z.text.trim();z.text=decodeURIComponent(encodeURIComponent(de)),z.id||(z.id=_(z.startTime,z.endTime,de)),z.endTime>0&&h.push(z)},k.onparsingerror=function(z){v=z},k.onflush=function(){if(v){m(v);return}g(h)},x.forEach(function(z){if(T)if(M(z,"X-TIMESTAMP-MAP=")){T=!1,N=!0,z.substr(16).split(",").forEach(function(Y){M(Y,"LOCAL:")?c=Y.substr(6):M(Y,"MPEGTS:")&&(o=parseInt(Y.substr(7)))});try{S=b(c)/1e3}catch(Y){N=!1,v=Y}return}else z===""&&(T=!1);k.parse(z+`
`)}),k.flush()}},"./src/utils/xhr-loader.ts":function(ae,X,D){"use strict";D.r(X);var K=D("./src/utils/logger.ts"),w=D("./src/loader/load-stats.ts"),P=/^age:\s*[\d.]+\s*$/m,H=function(){function W(M){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=M?M.xhrSetup:null,this.stats=new w.LoadStats,this.retryDelay=0}var I=W.prototype;return I.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},I.abortInternal=function(){var b=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),b&&(b.onreadystatechange=null,b.onprogress=null,b.readyState!==4&&(this.stats.aborted=!0,b.abort()))},I.abort=function(){var b;this.abortInternal(),(b=this.callbacks)!==null&&b!==void 0&&b.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},I.load=function(b,A,_){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=b,this.config=A,this.callbacks=_,this.retryDelay=A.retryDelay,this.loadInternal()},I.loadInternal=function(){var b=this.config,A=this.context;if(!b)return;var _=this.loader=new self.XMLHttpRequest,O=this.stats;O.loading.first=0,O.loaded=0;var L=this.xhrSetup;try{if(L)try{L(_,A.url)}catch(a){_.open("GET",A.url,!0),L(_,A.url)}_.readyState||_.open("GET",A.url,!0);var y=this.context.headers;if(y)for(var u in y)_.setRequestHeader(u,y[u])}catch(a){this.callbacks.onError({code:_.status,text:a.message},A,_);return}A.rangeEnd&&_.setRequestHeader("Range","bytes="+A.rangeStart+"-"+(A.rangeEnd-1)),_.onreadystatechange=this.readystatechange.bind(this),_.onprogress=this.loadprogress.bind(this),_.responseType=A.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),b.timeout),_.send()},I.readystatechange=function(){var b=this.context,A=this.loader,_=this.stats;if(!b||!A)return;var O=A.readyState,L=this.config;if(_.aborted)return;if(O>=2)if(self.clearTimeout(this.requestTimeout),_.loading.first===0&&(_.loading.first=Math.max(self.performance.now(),_.loading.start)),O===4){A.onreadystatechange=null,A.onprogress=null;var y=A.status;if(y>=200&&y<300){_.loading.end=Math.max(self.performance.now(),_.loading.first);var u,a;if(b.responseType==="arraybuffer"?(u=A.response,a=u.byteLength):(u=A.responseText,a=u.length),_.loaded=_.total=a,!this.callbacks)return;var s=this.callbacks.onProgress;if(s&&s(_,b,u,A),!this.callbacks)return;var d={url:A.responseURL,data:u};this.callbacks.onSuccess(d,_,b,A)}else _.retry>=L.maxRetry||y>=400&&y<499?(K.logger.error(y+" while loading "+b.url),this.callbacks.onError({code:y,text:A.statusText},b,A)):(K.logger.warn(y+" while loading "+b.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,L.maxRetryDelay),_.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),L.timeout)},I.loadtimeout=function(){K.logger.warn("timeout while loading "+this.context.url);var b=this.callbacks;b&&(this.abortInternal(),b.onTimeout(this.stats,this.context,this.loader))},I.loadprogress=function(b){var A=this.stats;A.loaded=b.loaded,b.lengthComputable&&(A.total=b.total)},I.getCacheAge=function(){var b=null;if(this.loader&&P.test(this.loader.getAllResponseHeaders())){var A=this.loader.getResponseHeader("age");b=A?parseFloat(A):null}return b},W}();X.default=H}}).default})},vHTk:function(Ft,yt,ne){Ft.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}}}]);