(window.webpackJsonp=window.webpackJsonp||[]).push([[163,5,6,7],{"+NIl":function(st,ze,q){(function(re){re(q("VrN/"))})(function(re){"use strict";re.defineMode("stex",function(V,A){"use strict";function G(C,T){C.cmdState.push(T)}function I(C){return C.cmdState.length>0?C.cmdState[C.cmdState.length-1]:null}function R(C){var T=C.cmdState.pop();T&&T.closeBracket()}function B(C){for(var T=C.cmdState,g=T.length-1;g>=0;g--){var d=T[g];if(d.name=="DEFAULT")continue;return d}return{styleIdentifier:function(){return null}}}function U(C,T,g){return function(){this.name=C,this.bracketNo=0,this.style=T,this.styles=g,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var k={};k.importmodule=U("importmodule","tag",["string","builtin"]),k.documentclass=U("documentclass","tag",["","atom"]),k.usepackage=U("usepackage","tag",["atom"]),k.begin=U("begin","tag",["atom"]),k.end=U("end","tag",["atom"]),k.label=U("label","tag",["atom"]),k.ref=U("ref","tag",["atom"]),k.eqref=U("eqref","tag",["atom"]),k.cite=U("cite","tag",["atom"]),k.bibitem=U("bibitem","tag",["atom"]),k.Bibitem=U("Bibitem","tag",["atom"]),k.RBibitem=U("RBibitem","tag",["atom"]),k.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function L(C,T){C.f=T}function y(C,T){var g;if(C.match(/^\\[a-zA-Z@]+/)){var d=C.current().slice(1);return g=k.hasOwnProperty(d)?k[d]:k.DEFAULT,g=new g,G(T,g),L(T,O),g.style}if(C.match(/^\\[$&%#{}_]/))return"tag";if(C.match(/^\\[,;!\/\\]/))return"tag";if(C.match("\\["))return L(T,function(u,s){return x(u,s,"\\]")}),"keyword";if(C.match("\\("))return L(T,function(u,s){return x(u,s,"\\)")}),"keyword";if(C.match("$$"))return L(T,function(u,s){return x(u,s,"$$")}),"keyword";if(C.match("$"))return L(T,function(u,s){return x(u,s,"$")}),"keyword";var o=C.next();if(o=="%")return C.skipToEnd(),"comment";if(o=="}"||o=="]"){if(g=I(T),g)g.closeBracket(o),L(T,O);else return"error";return"bracket"}else return o=="{"||o=="["?(g=k.DEFAULT,g=new g,G(T,g),"bracket"):/\d/.test(o)?(C.eatWhile(/[\w.%]/),"atom"):(C.eatWhile(/[\w\-_]/),g=B(T),g.name=="begin"&&(g.argument=C.current()),g.styleIdentifier())}function x(C,T,g){if(C.eatSpace())return null;if(g&&C.match(g))return L(T,y),"keyword";if(C.match(/^\\[a-zA-Z@]+/))return"tag";if(C.match(/^[a-zA-Z]+/))return"variable-2";if(C.match(/^\\[$&%#{}_]/))return"tag";if(C.match(/^\\[,;!\/]/))return"tag";if(C.match(/^[\^_&]/))return"tag";if(C.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(C.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var d=C.next();return d=="{"||d=="}"||d=="["||d=="]"||d=="("||d==")"?"bracket":d=="%"?(C.skipToEnd(),"comment"):"error"}function O(C,T){var g=C.peek(),d;return g=="{"||g=="["?(d=I(T),d.openBracket(g),C.eat(g),L(T,y),"bracket"):/[ \t\r]/.test(g)?(C.eat(g),null):(L(T,y),R(T),y(C,T))}return{startState:function(){var C=A.inMathMode?function(T,g){return x(T,g)}:y;return{cmdState:[],f:C}},copyState:function(C){return{cmdState:C.cmdState.slice(),f:C.f}},token:function(C,T){return T.f(C,T)},blankLine:function(C){C.f=y,C.cmdState.length=0},lineComment:"%"}}),re.defineMIME("text/x-stex","stex"),re.defineMIME("text/x-latex","stex")})},"+ua5":function(st,ze,q){},"19Vz":function(st,ze,q){(function(re){re(q("VrN/"))})(function(re){re.defineOption("placeholder","",function(U,k,L){var y=L&&L!=re.Init;if(k&&!y)U.on("blur",I),U.on("change",R),U.on("swapDoc",R),re.on(U.getInputField(),"compositionupdate",U.state.placeholderCompose=function(){G(U)}),R(U);else if(!k&&y){U.off("blur",I),U.off("change",R),U.off("swapDoc",R),re.off(U.getInputField(),"compositionupdate",U.state.placeholderCompose),V(U);var x=U.getWrapperElement();x.className=x.className.replace(" CodeMirror-empty","")}k&&!U.hasFocus()&&I(U)});function V(U){U.state.placeholder&&(U.state.placeholder.parentNode.removeChild(U.state.placeholder),U.state.placeholder=null)}function A(U){V(U);var k=U.state.placeholder=document.createElement("pre");k.style.cssText="height: 0; overflow: visible",k.style.direction=U.getOption("direction"),k.className="CodeMirror-placeholder CodeMirror-line-like";var L=U.getOption("placeholder");typeof L=="string"&&(L=document.createTextNode(L)),k.appendChild(L),U.display.lineSpace.insertBefore(k,U.display.lineSpace.firstChild)}function G(U){setTimeout(function(){var k=!1,L=U.getInputField();L.nodeName=="TEXTAREA"?k=!L.value:U.lineCount()==1&&(k=!/[^\u200b]/.test(L.querySelector(".CodeMirror-line").textContent)),k?A(U):V(U)},20)}function I(U){B(U)&&A(U)}function R(U){var k=U.getWrapperElement(),L=B(U);k.className=k.className.replace(" CodeMirror-empty","")+(L?" CodeMirror-empty":""),L?A(U):V(U)}function B(U){return U.lineCount()===1&&U.getLine(0)===""}})},"1eCo":function(st,ze,q){(function(re){re(q("VrN/"))})(function(re){"use strict";var V={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},A={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};re.defineMode("xml",function(G,I){var R=G.indentUnit,B={},U=I.htmlMode?V:A;for(var k in U)B[k]=U[k];for(var k in I)B[k]=I[k];var L,y;function x(a,v){function m(F){return v.tokenize=F,F(a,v)}var E=a.next();if(E=="<")return a.eat("!")?a.eat("[")?a.match("CDATA[")?m(T("atom","]]>")):null:a.match("--")?m(T("comment","-->")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),m(g(1))):null:a.eat("?")?(a.eatWhile(/[\w\._\-]/),v.tokenize=T("meta","?>"),"meta"):(L=a.eat("/")?"closeTag":"openTag",v.tokenize=O,"tag bracket");if(E=="&"){var M;return a.eat("#")?a.eat("x")?M=a.eatWhile(/[a-fA-F\d]/)&&a.eat(";"):M=a.eatWhile(/[\d]/)&&a.eat(";"):M=a.eatWhile(/[\w\.\-:]/)&&a.eat(";"),M?"atom":"error"}else return a.eatWhile(/[^&<]/),null}x.isInText=!0;function O(a,v){var m=a.next();if(m==">"||m=="/"&&a.eat(">"))return v.tokenize=x,L=m==">"?"endTag":"selfcloseTag","tag bracket";if(m=="=")return L="equals",null;if(m=="<"){v.tokenize=x,v.state=s,v.tagName=v.tagStart=null;var E=v.tokenize(a,v);return E?E+" tag error":"tag error"}else return/[\'\"]/.test(m)?(v.tokenize=C(m),v.stringStartCol=a.column(),v.tokenize(a,v)):(a.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function C(a){var v=function(m,E){for(;!m.eol();)if(m.next()==a){E.tokenize=O;break}return"string"};return v.isInAttribute=!0,v}function T(a,v){return function(m,E){for(;!m.eol();){if(m.match(v)){E.tokenize=x;break}m.next()}return a}}function g(a){return function(v,m){for(var E;(E=v.next())!=null;){if(E=="<")return m.tokenize=g(a+1),m.tokenize(v,m);if(E==">")if(a==1){m.tokenize=x;break}else return m.tokenize=g(a-1),m.tokenize(v,m)}return"meta"}}function d(a,v,m){this.prev=a.context,this.tagName=v,this.indent=a.indented,this.startOfLine=m,(B.doNotIndent.hasOwnProperty(v)||a.context&&a.context.noIndent)&&(this.noIndent=!0)}function o(a){a.context&&(a.context=a.context.prev)}function u(a,v){for(var m;;){if(!a.context)return;if(m=a.context.tagName,!B.contextGrabbers.hasOwnProperty(m)||!B.contextGrabbers[m].hasOwnProperty(v))return;o(a)}}function s(a,v,m){return a=="openTag"?(m.tagStart=v.column(),w):a=="closeTag"?p:s}function w(a,v,m){return a=="word"?(m.tagName=v.current(),y="tag",b):B.allowMissingTagName&&a=="endTag"?(y="tag bracket",b(a,v,m)):(y="error",w)}function p(a,v,m){if(a=="word"){var E=v.current();return m.context&&m.context.tagName!=E&&B.implicitlyClosed.hasOwnProperty(m.context.tagName)&&o(m),m.context&&m.context.tagName==E||B.matchClosing===!1?(y="tag",f):(y="tag error",_)}else return B.allowMissingTagName&&a=="endTag"?(y="tag bracket",f(a,v,m)):(y="error",_)}function f(a,v,m){return a!="endTag"?(y="error",f):(o(m),s)}function _(a,v,m){return y="error",f(a,v,m)}function b(a,v,m){if(a=="word")return y="attribute",h;if(a=="endTag"||a=="selfcloseTag"){var E=m.tagName,M=m.tagStart;return m.tagName=m.tagStart=null,a=="selfcloseTag"||B.autoSelfClosers.hasOwnProperty(E)?u(m,E):(u(m,E),m.context=new d(m,E,M==m.indented)),s}return y="error",b}function h(a,v,m){return a=="equals"?c:(B.allowMissing||(y="error"),b(a,v,m))}function c(a,v,m){return a=="string"?l:a=="word"&&B.allowUnquoted?(y="string",b):(y="error",b(a,v,m))}function l(a,v,m){return a=="string"?l:b(a,v,m)}return{startState:function(a){var v={tokenize:x,state:s,indented:a||0,tagName:null,tagStart:null,context:null};return a!=null&&(v.baseIndent=a),v},token:function(a,v){if(!v.tagName&&a.sol()&&(v.indented=a.indentation()),a.eatSpace())return null;L=null;var m=v.tokenize(a,v);return(m||L)&&m!="comment"&&(y=null,v.state=v.state(L||m,a,v),y&&(m=y=="error"?m+" error":y)),m},indent:function(a,v,m){var E=a.context;if(a.tokenize.isInAttribute)return a.tagStart==a.indented?a.stringStartCol+1:a.indented+R;if(E&&E.noIndent)return re.Pass;if(a.tokenize!=O&&a.tokenize!=x)return m?m.match(/^(\s*)/)[0].length:0;if(a.tagName)return B.multilineTagIndentPastTag!==!1?a.tagStart+a.tagName.length+2:a.tagStart+R*(B.multilineTagIndentFactor||1);if(B.alignCDATA&&/$/,blockCommentStart:"",configuration:B.htmlMode?"html":"xml",helperType:B.htmlMode?"html":"xml",skipAttribute:function(a){a.state==c&&(a.state=b)},xmlCurrentTag:function(a){return a.tagName?{name:a.tagName,close:a.type=="closeTag"}:null},xmlCurrentContext:function(a){for(var v=[],m=a.context;m;m=m.prev)m.tagName&&v.push(m.tagName);return v.reverse()}}}),re.defineMIME("text/xml","xml"),re.defineMIME("application/xml","xml"),re.mimeModes.hasOwnProperty("text/html")||re.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"500L":function(st,ze,q){"use strict";q.d(ze,"a",function(){return p});var re=q("+L6B"),V=q("2/Rp"),A=q("2qtc"),G=q("kLXV"),I=q("9og8"),R=q("k1fw"),B=q("miYZ"),U=q("tsqr"),k=q("oBTY"),L=q("tJVT"),y=q("DZo9"),x=q("8z0m"),O=q("WmNS"),C=q.n(O),T=q("cDcd"),g=q.n(T),d=q("m3rI"),o=q("wzkS"),u=q("y5JW"),s=q("LtfV"),w=x.a.Dragger;function p(f){var _=[];return f&&f.length>0&&(_=f.map(function(b){return{uid:b.id,id:b.id,name:b.title+u.c+b.filesize,url:b.url,filesize:b.filesize,status:"done",response:{id:b.id}}})),_}ze.b=function(f){var _=f.value,b=f.onChange,h=f.action,c=f.className,l=f.maxSize,a=l===void 0?150:l,v=f.title,m=v===void 0?"\u4E0A\u4F20\u9644\u4EF6":v,E=f.showRemoveModal,M=E===void 0?!1:E,F=f.accept,j=F===void 0?"":F,W=f.additionalText,D=f.isDragger,P=f.number,H=P===void 0?1e3:P,Y=f.aloneClear,ee=Y===void 0?!1:Y,oe=Object(T.useState)(!1),Te=Object(L.a)(oe,2),ve=Te[0],ge=Te[1],he=Object(T.useState)(_||[]),fe=Object(L.a)(he,2),ae=fe[0],me=fe[1];Object(T.useEffect)(function(){_&&(me(Object(k.a)(_)),H===(_==null?void 0:_.length)&&ge(!0))},[_]);var J=function(){setTimeout(function(){ae.pop(),me(Object(k.a)(ae))},500)},ne={multiple:!0,disabled:ve,accept:j,withCredentials:!0,fileList:ae,beforeUpload:function(Ce,ye){var we=Ce.size/1024/1024;return ae.concat(ye).length>H?(ae.pop(),me(Object(k.a)(ae)),U.b.error("\u6700\u591A\u53EA\u80FD\u4E0A\u4F20".concat(H,"\u4E2A\u6587\u4EF6")),ee?Promise.reject():(J(),!1)):!0},action:h||"".concat(d.a.API_SERVER,"/api/attachments.json"),onChange:function(Ce){var ye,we,De=Object(k.a)(Ce.fileList);if(Ce.file.status==="done"&&((ye=Ce.file)===null||ye===void 0||((we=ye.response)===null||we===void 0)?void 0:we.status)===-1){var Pe,ke;U.b.error((Pe=Ce.file)===null||Pe===void 0||((ke=Pe.response)===null||ke===void 0)?void 0:ke.message);return}De.length>=H?ge(!0):ge(!1),me(Object(k.a)(De)),De=De.map(function(Oe){var Re;if(Oe!=null&&(Re=Oe.response)!==null&&Re!==void 0&&Re.id){var Ge;Oe.url="/api/attachments/".concat(Oe==null||((Ge=Oe.response)===null||Ge===void 0)?void 0:Ge.id)}return Oe.name.indexOf(u.c)===-1&&(Oe.name="".concat(Oe.name).concat(u.c).concat(Object(u.a)(Oe.size))),Object(R.a)({},Oe)}),console.log("info:",Ce),b(De)},onRemove:function(){var Ee=Object(I.a)(C.a.mark(function ye(we){var De;return C.a.wrap(function(ke){for(;;)switch(ke.prev=ke.next){case 0:if(De=function(){var Oe=Object(I.a)(C.a.mark(function Re(){var Ge,$e;return C.a.wrap(function(He){for(;;)switch(He.prev=He.next){case 0:if(Ge=we.response?we.response.id:we.id,!Ge){He.next=8;break}return He.next=4,Object(o.d)(we.response?we.response.id:we.uid);case 4:return $e=He.sent,He.abrupt("return",$e);case 8:return He.abrupt("return",!0);case 9:case"end":return He.stop()}},Re)}));return function(){return Oe.apply(this,arguments)}}(),!M){ke.next=5;break}return ke.abrupt("return",new Promise(function(Oe,Re){G.a.confirm({centered:!0,width:530,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u63D0\u793A",content:g.a.createElement("div",{className:"tc font16"},"\u662F\u5426\u786E\u8BA4\u5220\u9664?"),onOk:function(){var Ge=Object(I.a)(C.a.mark(function Be(){var He;return C.a.wrap(function(Je){for(;;)switch(Je.prev=Je.next){case 0:return Je.next=2,De();case 2:He=Je.sent,U.b.success("\u5220\u9664\u6210\u529F"),Oe(!0);case 5:case"end":return Je.stop()}},Be)}));function $e(){return Ge.apply(this,arguments)}return $e}(),onCancel:function(){return Oe(!1)}})}));case 5:return ke.next=7,De();case 7:return ke.abrupt("return",ke.sent);case 8:case"end":return ke.stop()}},ye)}));function Ce(ye){return Ee.apply(this,arguments)}return Ce}()};function Q(Ee){Ee.preventDefault(),Ee.stopPropagation()}return g.a.createElement("div",{className:"multi-upload ".concat(c||"")},D&&g.a.createElement(w,ne,g.a.createElement("p",{className:"ant-upload-drag-icon"},g.a.createElement(s.a,null)),g.a.createElement("p",{className:"ant-upload-text"},"\u70B9\u51FB\u4E0A\u4F20\u56FE\u6807\uFF0C\u9009\u62E9\u8981\u4E0A\u4F20\u7684\u6587\u4EF6\u6216\u5C06\u6587\u4EF6\u62D6\u62FD\u5230\u6B64",g.a.createElement("br",null),"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927\u9650\u5236\u4E3A",a,"MB)"," "),W),!D&&g.a.createElement(x.a,ne,g.a.createElement(V.a,{disabled:ve},m),g.a.createElement("span",{onClick:Q,style:{marginLeft:10,color:"#FA6400"}},"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927",a,"MB)"," ")))}},"55Ip":function(st,ze,q){"use strict";q.d(ze,"a",function(){return u});var re=q("Ty5D"),V=q("dI71"),A=q("cDcd"),G=q.n(A),I=q("YS25"),R=q("17x9"),B=q.n(R),U=q("wx14"),k=q("zLVn"),L=q("9R94"),y=function(c){Object(V.a)(l,c);function l(){for(var v,m=arguments.length,E=new Array(m),M=0;M1&&arguments[1]!==void 0?arguments[1]:0,T=(B[O[C+0]]+B[O[C+1]]+B[O[C+2]]+B[O[C+3]]+"-"+B[O[C+4]]+B[O[C+5]]+"-"+B[O[C+6]]+B[O[C+7]]+"-"+B[O[C+8]]+B[O[C+9]]+"-"+B[O[C+10]]+B[O[C+11]]+B[O[C+12]]+B[O[C+13]]+B[O[C+14]]+B[O[C+15]]).toLowerCase();if(!R(T))throw TypeError("Stringified UUID is invalid");return T}var L=k;function y(O,C,T){O=O||{};var g=O.random||(O.rng||A)();if(g[6]=g[6]&15|64,g[8]=g[8]&63|128,C){T=T||0;for(var d=0;d<16;++d)C[T+d]=g[d];return C}return L(g)}var x=ze.a=y},"7ahc":function(st,ze,q){"use strict";q.d(ze,"a",function(){return w});var re=q("k1fw"),V=q("0Owb"),A=q("+L6B"),G=q("2/Rp"),I=q("y8nQ"),R=q("Vl3Y"),B=q("tJVT"),U=q("OaEy"),k=q("2fM7"),L=q("cDcd"),y=q.n(L),x=q("VrN/"),O=q.n(x),C=q("p77/"),T=q.n(C),g=q("c5Ni"),d=q.n(g),o=k.a.Option,u={labelCol:{span:4},wrapperCol:{span:20}},s={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"]};ze.b=function(p){var f=p.callback,_=p.onCancel,b=Object(L.useState)("python"),h=Object(B.a)(b,2),c=h[0],l=h[1];function a(m){l(s[m][1])}function v(m){f(m)}return y.a.createElement(R.a,Object(V.a)({},u,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:v}),y.a.createElement(R.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},y.a.createElement(k.a,{onChange:a},Object.keys(s).map(function(m){return y.a.createElement(o,{key:m,value:m},s[m][0])}))),y.a.createElement(R.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},y.a.createElement(w,{mode:c})),y.a.createElement("div",{className:"flex-container flex-end"},y.a.createElement(G.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),y.a.createElement(G.a,{type:"ghost",onClick:_},"\u53D6\u6D88")))};function w(p){var f=p.value,_=p.onChange,b=p.mode,h=p.options,c=h===void 0?{}:h,l=Object(L.useRef)(),a=Object(L.useState)(),v=Object(B.a)(a,2),m=v[0],E=v[1];return Object(L.useEffect)(function(){if(m){function M(F){var j=F.getValue();_&&_(j)}return m.on("change",M),function(){m.off("change",M)}}},[m,_]),Object(L.useEffect)(function(){m&&m.setOption("mode",b)},[m,b]),Object(L.useEffect)(function(){m&&((f!==m.getValue()||f==="")&&setTimeout(function(){m.setValue(f||" ")},300))},[m,f]),Object(L.useEffect)(function(){if(l.current&&!m){var M=O.a.fromTextArea(l.current,Object(re.a)({mode:b,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},c));E(M)}},[l.current,m]),y.a.createElement("div",{className:"my-codemirror-container"},y.a.createElement("textarea",{ref:l}))}},"8EBN":function(st,ze,q){(function(re){re(q("VrN/"))})(function(re){"use strict";re.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 V=0;V-1&&G.substring(B+1,G.length);if(U)return re.findModeByExtension(U)},re.findModeByName=function(G){G=G.toLowerCase();for(var I=0;I=ae.length?me.slice(ae.length):me}).join(` `)}var C=[],T=["
    "],g=new y.a.Renderer,d=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function o(){C.length=0,T=["
      "]}var u={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function s(ge,he,fe,ae){if(he>=ge.length||ge[he].level<=fe)return he;var me=ge[he];ae.push("
    • "+me.text+""),he++;var J=[];return he=s(ge,he,me.level,J),J.length>0&&(ae.push("
        "),J.forEach(function(ne){ae.push(ne)}),ae.push("
      ")),ae.push("
    • "),he=s(ge,he,fe,ae),he}function w(){return s(C,0,0,T),T.push("
    "),T.join("")}var p={heading:function(he){var fe=d.exec(he);if(fe)return{type:"heading",raw:fe[0],depth:fe[1].length,text:fe[2]}},fences:function(he){var fe=this.rules.block.fences.exec(he);if(fe){var ae=fe[0],me=O(ae,fe[3]||""),J=fe[2]?fe[2].trim():fe[2];if(["latex","katex","math"].indexOf(J)>=0){var ne=b(),Q=me;me=ne,h[ne]={type:"block",expression:Q}}return{type:"code",raw:ae,lang:J,text:me}}}},f=/(?:\${2})([^\n`]+?)(?:\${2})/gi,_=0,b=function(){return"__special_katext_id_".concat(_++,"__")},h={};function c(){return h}function l(){_=0,h={}}function a(ge){return ge=ge.replace(f,function(he,fe){var ae=b();return h[ae]={type:"inline",expression:fe},ae}),ge}var v=g.listitem;g.listitem=function(ge){return v(a(ge))};var m=g.paragraph;g.paragraph=function(ge){return m(a(ge))};var E=g.tablecell;g.tablecell=function(ge,he){return E(a(ge),he)},g.code=function(ge,he,fe){var ae=(he||"").match(/\S*/)[0];return ae?["latex","katex","math"].indexOf(ae)>=0?"

    ".concat(ge,"

    "):'
    ').concat(fe?ge:Object(x.escape)(ge,!0),`
    `):'
    '+(fe?ge:Object(x.escape)(ge,!0))+"
    "},g.heading=function(ge,he,fe){var ae=this.options.headerPrefix+fe.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return C.push({anchor:ae,level:he,text:ge}),"'+ge+""},y.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),y.a.use({tokenizer:p,renderer:g});var M=y.a,F=q("SJMd"),j=q("ulZh"),W=q.n(j),D=q("m3rI"),P=q("Oy/b"),H=q("p5ED"),Y=q("8hTe"),ee=q.n(Y),oe=/]*>/g;function Te(ge){var he=document.createElement("div");return he.innerHTML=ge,he.childNodes.length===0?"":he.childNodes[0].nodeValue}var ve=ze.a=function(ge){var he=ge.value,fe=he===void 0?"":he,ae=ge.edit,me=ae===void 0?!1:ae,J=ge.className,ne=ge.showTextOnly,Q=ge.showLines,Ee=ge.replaces,Ce=ge.zoomImg,ye=ge.hasMask,we=ge.style,De=we===void 0?{}:we,Pe=ge.stylesPrev,ke=Pe===void 0?{}:Pe,Oe=String(fe),Re=Object(B.useRef)(),Ge=Object(B.useRef)(),$e=Object(B.useState)(""),Be=Object(R.a)($e,2),He=Be[0],rt=Be[1],Je=Object(B.useState)("office"),qe=Object(R.a)(Je,2),Se=qe[0],Ze=qe[1],Ke=Object(B.useMemo)(function(){try{var de=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,$=/\"\/api\/attachments\/|\"\/attachments\/download\//g,Z=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;Oe=Oe.replace(de,"("+D.a.API_SERVER+"/api/attachments/").replace($,'"'+D.a.API_SERVER+"/api/attachments/").replace(Z,'"'+D.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(Ae){}var te=M(Oe),le=c();if(Oe.match(/\[TOC\]/)&&(te=te.replace("

    [TOC]

    ",w()),o()),te=te.replace(/(__special_katext_id_\d+__)/g,function(Ae,_e){var Ue=le[_e],Qe=Ue.type,Ve=Ue.expression;return Object(P.renderToString)(Te(Ve)||"",{displayMode:Qe==="block",throwOnError:!1,output:"html"})}),te=te.replace(/▁/g,"\u2581\u2581\u2581"),l(),ne){var ce=document.createElement("div");return ce.innerHTML=te,ce.innerText}return setTimeout(function(){return pe()},500),te},[Oe]),Le=Object(B.useRef)();u.WebkitLineClamp=Q,Q&&(De=Object(I.a)(Object(I.a)({},De),u));function Ie(de){var $=de.target;if($.tagName.toUpperCase()==="IMG"){if(Ce){var Z=$.getAttribute("src");rt(Z),Ze("image")}}else if($.tagName.toUpperCase()==="A"){var te=$.getAttribute("href");if(te.indexOf("office")>-1)de.preventDefault(),rt(te),Ze("office");else if(te.indexOf("application/pdf")>-1)de.preventDefault(),rt(te),Ze("pdf");else if(te.indexOf("text/html")>-1)de.preventDefault(),rt(te),Ze("html");else if(te.startsWith("#")){de.preventDefault();var le=document.getElementById(te.replace("#",""));le&&le.scrollIntoView(!0)}}}var pe=function(){var $,Z=($=Le.current)===null||$===void 0?void 0:$.querySelectorAll("video");Z==null||Z.forEach(function(te){if(te.oncontextmenu=function(){return!1},te.src.indexOf(".m3u8")>-1&&!te.canPlayType("application/vnd.apple.mpegurl")){if(W.a.isSupported()){var le=new W.a;le.loadSource(te.src),le.attachMedia(te)}}})};Object(B.useEffect)(function(){if(Le.current&&Ke&&(Ke.match(oe)&&window.PR.prettyPrint()),Le.current)return Le.current.addEventListener("click",Ie),function(){Le.current.removeEventListener("click",Ie),l(),o()}},[Ke,Le.current,Ie]);var se=function($){if(!me)return;$.target.nodeName==="IMG"?(Re.current.style.display="flex",Re.current.style.width=$.target.clientWidth+"px",Re.current.style.height=$.target.clientHeight+"px",Re.current.style.top=$.target.offsetTop+"px",Re.current.style.left=$.target.offsetLeft+"px",Ge.current.src=$.target.getAttribute("src")):Re.current.style.display="none"};return U.a.createElement("div",{style:{position:"relative"}},U.a.createElement("div",{ref:Le,style:Object(I.a)({},De),className:"".concat(J||""," markdown-body ").concat(ee.a.mdBody),onMouseOver:se,dangerouslySetInnerHTML:{__html:Ke}}),U.a.createElement("div",{ref:Re,className:ee.a.button},U.a.createElement(V.a,null,U.a.createElement(G.a,{onClick:function(){return openCrop()}},"\u88C1\u526A"),U.a.createElement(G.a,{onClick:function(){return openEditor()}},"\u7F16\u8F91"))),U.a.createElement("img",{ref:Ge,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1,top:"-10000px"}}),U.a.createElement(H.a,{close:!0,data:He,type:He!=null&&He.length?Se:"",style:Object(I.a)({},ke),onClose:function(){return rt("")}}))}},"9VGf":function(st,ze,q){"use strict";q.d(ze,"a",function(){return A});var re=q("cDcd"),V=q.n(re);function A(G,I){var R=Object(re.useRef)();Object(re.useEffect)(function(){R.current=G}),Object(re.useEffect)(function(){function B(){R.current()}if(I!==null){var U=setInterval(B,I);return function(){return clearInterval(U)}}},[I])}},BU3w:function(st,ze,q){"use strict";q.d(ze,"a",function(){return R});var re=q("MNnm"),V="rc-util-key";function A(B){if(B.attachTo)return B.attachTo;var U=document.querySelector("head");return U||document.body}function G(B){var U,k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(re.a)())return null;var L=document.createElement("style");if((U=k.csp)===null||U===void 0?void 0:U.nonce){var y;L.nonce=(y=k.csp)===null||y===void 0?void 0:y.nonce}L.innerHTML=B;var x=A(k),O=x.firstChild;return k.prepend&&x.prepend?x.prepend(L):k.prepend&&O?x.insertBefore(L,O):x.appendChild(L),L}var I=new Map;function R(B,U){var k=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},L=A(k);if(!I.has(L)){var y=G("",k),x=y.parentNode;I.set(L,x),x.removeChild(y)}var O=Array.from(I.get(L).children).find(function(o){return o.tagName==="STYLE"&&o[V]===U});if(O){var C,T;if(((C=k.csp)===null||C===void 0?void 0:C.nonce)&&O.nonce!==((T=k.csp)===null||T===void 0?void 0:T.nonce)){var g;O.nonce=(g=k.csp)===null||g===void 0?void 0:g.nonce}return O.innerHTML!==B&&(O.innerHTML=B),O}var d=G(B,k);return d[V]=U,d}},Bd2K:function(st,ze,q){(function(re){re(q("VrN/"),q("osHv"))})(function(re){re.defineOption("autoCloseTags",!1,function(k,L,y){if(y!=re.Init&&y&&k.removeKeyMap("autoCloseTags"),!L)return;var x={name:"autoCloseTags"};(typeof L!="object"||L.whenClosing!==!1)&&(x["'/'"]=function(O){return R(O)}),(typeof L!="object"||L.whenOpening!==!1)&&(x["'>'"]=function(O){return G(O)}),k.addKeyMap(x)});var V=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],A=["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 G(k){if(k.getOption("disableInput"))return re.Pass;for(var L=k.listSelections(),y=[],x=k.getOption("autoCloseTags"),O=0;OC.ch&&(u=u.slice(0,u.length-T.end+C.ch));var f=u.toLowerCase();if(!u||T.type=="string"&&(T.end!=C.ch||!/[\"\']/.test(T.string.charAt(T.string.length-1))||T.string.length==1)||T.type=="tag"&&o.close||T.string.indexOf("/")==C.ch-T.start-1||w&&B(w,f)>-1||U(k,g.mode.xmlCurrentContext&&g.mode.xmlCurrentContext(d)||[],u,C,!0))return re.Pass;var _=typeof x=="object"&&x.emptyTags;if(_&&B(_,u)>-1){y[O]={text:"/>",newPos:re.Pos(C.line,C.ch+2)};continue}var b=p&&B(p,f)>-1;y[O]={indent:b,text:">"+(b?` `:"")+"",newPos:b?re.Pos(C.line+1,0):re.Pos(C.line,C.ch+1)}}for(var h=typeof x=="object"&&x.dontIndentOnAutoClose,O=L.length-1;O>=0;O--){var c=y[O];k.replaceRange(c.text,L[O].head,L[O].anchor,"+insert");var l=k.listSelections().slice(0);l[O]={head:c.newPos,anchor:c.newPos},k.setSelections(l),!h&&c.indent&&(k.indentLine(c.newPos.line,null,!0),k.indentLine(c.newPos.line+1,null,!0))}}function I(k,L){for(var y=k.listSelections(),x=[],O=L?"/":""&&(w+=">"),x[g]=w}if(k.replaceSelections(x),y=k.listSelections(),!T)for(var g=0;g=0&&L[d]==y;d--)++g;x=T.to;for(var d=1;d0){for(var L=0;L1&&arguments[1]!==void 0?arguments[1]:"",L=[],y=0;ype.length)&&(se=pe.length);for(var de=0,$=new Array(se);de=pe.length?{done:!0}:{done:!1,value:pe[$++]}}}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 de=pe[Symbol.iterator](),de.next.bind(de)}function R(pe,se){return se={exports:{}},pe(se,se.exports),se.exports}var B=R(function(pe){function se(){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 de($){pe.exports.defaults=$}pe.exports={defaults:se(),getDefaults:se,changeDefaults:de}}),U=B.defaults,k=B.getDefaults,L=B.changeDefaults,y=/[&<>"']/,x=/[&<>"']/g,O=/[<>"']|&(?!#?\w+;)/,C=/[<>"']|&(?!#?\w+;)/g,T={"&":"&","<":"<",">":">",'"':""","'":"'"},g=function(se){return T[se]};function d(pe,se){if(se){if(y.test(pe))return pe.replace(x,g)}else if(O.test(pe))return pe.replace(C,g);return pe}var o=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function u(pe){return pe.replace(o,function(se,de){return de=de.toLowerCase(),de==="colon"?":":de.charAt(0)==="#"?de.charAt(1)==="x"?String.fromCharCode(parseInt(de.substring(2),16)):String.fromCharCode(+de.substring(1)):""})}var s=/(^|[^\[])\^/g;function w(pe,se){pe=pe.source||pe,se=se||"";var de={replace:function(Z,te){return te=te.source||te,te=te.replace(s,"$1"),pe=pe.replace(Z,te),de},getRegex:function(){return new RegExp(pe,se)}};return de}var p=/[^\w:]/g,f=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function _(pe,se,de){if(pe){var $;try{$=decodeURIComponent(u(de)).replace(p,"").toLowerCase()}catch(Z){return null}if($.indexOf("javascript:")===0||$.indexOf("vbscript:")===0||$.indexOf("data:")===0)return null}se&&!f.test(de)&&(de=a(se,de));try{de=encodeURI(de).replace(/%25/g,"%")}catch(Z){return null}return de}var b={},h=/^[^:]+:\/*[^/]*$/,c=/^([^:]+:)[\s\S]*$/,l=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(pe,se){b[" "+pe]||(h.test(pe)?b[" "+pe]=pe+"/":b[" "+pe]=M(pe,"/",!0)),pe=b[" "+pe];var de=pe.indexOf(":")===-1;return se.substring(0,2)==="//"?de?se:pe.replace(c,"$1")+se:se.charAt(0)==="/"?de?se:pe.replace(l,"$1")+se:pe+se}var v={exec:function(){}};function m(pe){for(var se=1,de,$;se=0&&ce[_e]==="\\";)Ae=!Ae;return Ae?"|":" |"}),$=de.split(/ \|/),Z=0;if($.length>se)$.splice(se);else for(;$.length=$.length?Z.slice($.length):Z}).join(` `)}var ve=function(){function pe(de){this.options=de||D}var se=pe.prototype;return se.space=function($){var Z=this.rules.block.newline.exec($);if(Z)return Z[0].length>1?{type:"space",raw:Z[0]}:{raw:` `}},se.code=function($,Z){var te=this.rules.block.code.exec($);if(te){var le=Z[Z.length-1];if(le&&le.type==="paragraph")return{raw:te[0],text:te[0].trimRight()};var ce=te[0].replace(/^ {4}/gm,"");return{type:"code",raw:te[0],codeBlockStyle:"indented",text:this.options.pedantic?ce:P(ce,` `)}}},se.fences=function($){var Z=this.rules.block.fences.exec($);if(Z){var te=Z[0],le=Te(te,Z[3]||"");return{type:"code",raw:te,lang:Z[2]?Z[2].trim():Z[2],text:le}}},se.heading=function($){var Z=this.rules.block.heading.exec($);if(Z)return{type:"heading",raw:Z[0],depth:Z[1].length,text:Z[2]}},se.nptable=function($){var Z=this.rules.block.nptable.exec($);if(Z){var te={type:"table",header:H(Z[1].replace(/^ *| *\| *$/g,"")),align:Z[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:Z[3]?Z[3].replace(/\n$/,"").split(` `):[],raw:Z[0]};if(te.header.length===te.align.length){var le=te.align.length,ce;for(ce=0;ce ?/gm,"");return{type:"blockquote",raw:Z[0],text:te}}},se.list=function($){var Z=this.rules.block.list.exec($);if(Z){for(var te=Z[0],le=Z[2],ce=le.length>1,Ae=le[le.length-1]===")",_e={type:"list",raw:te,ordered:ce,start:ce?+le.slice(0,-1):"",loose:!1,items:[]},Ue=Z[0].match(this.rules.block.item),Qe=!1,Ve,mt,dt,ot,Ct,bt,Bt,Ut=Ue.length,Et=0;Et1||this.options.smartLists&&dt!==le)&&(ot=Ue.slice(Et+1).join(` `),_e.raw=_e.raw.substring(0,_e.raw.length-ot.length),Et=Ut-1)),Ct=Qe||/\n\n(?!\s*$)/.test(Ve),Et!==Ut-1&&(Qe=Ve.charAt(Ve.length-1)===` `,Ct||(Ct=Qe)),Ct&&(_e.loose=!0),bt=/^\[[ xX]\] /.test(Ve),Bt=void 0,bt&&(Bt=Ve[1]!==" ",Ve=Ve.replace(/^\[[ xX]\] +/,"")),_e.items.push({type:"list_item",raw:te,task:bt,checked:Bt,loose:Ct,text:Ve});return _e}},se.html=function($){var Z=this.rules.block.html.exec($);if(Z)return{type:this.options.sanitize?"paragraph":"html",raw:Z[0],pre:!this.options.sanitizer&&(Z[1]==="pre"||Z[1]==="script"||Z[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(Z[0]):Y(Z[0]):Z[0]}},se.def=function($){var Z=this.rules.block.def.exec($);if(Z){Z[3]&&(Z[3]=Z[3].substring(1,Z[3].length-1));var te=Z[1].toLowerCase().replace(/\s+/g," ");return{tag:te,raw:Z[0],href:Z[2],title:Z[3]}}},se.table=function($){var Z=this.rules.block.table.exec($);if(Z){var te={type:"table",header:H(Z[1].replace(/^ *| *\| *$/g,"")),align:Z[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:Z[3]?Z[3].replace(/\n$/,"").split(` `):[]};if(te.header.length===te.align.length){te.raw=Z[0];var le=te.align.length,ce;for(ce=0;ce/i.test(le[0])&&(Z=!1),!te&&/^<(pre|code|kbd|script)(\s|>)/i.test(le[0])?te=!0:te&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(le[0])&&(te=!1),{type:this.options.sanitize?"text":"html",raw:le[0],inLink:Z,inRawBlock:te,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(le[0]):Y(le[0]):le[0]}},se.link=function($){var Z=this.rules.inline.link.exec($);if(Z){var te=ee(Z[2],"()");if(te>-1){var le=Z[0].indexOf("!")===0?5:4,ce=le+Z[1].length+te;Z[2]=Z[2].substring(0,te),Z[0]=Z[0].substring(0,ce).trim(),Z[3]=""}var Ae=Z[2],_e="";if(this.options.pedantic){var Ue=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Ae);Ue?(Ae=Ue[1],_e=Ue[3]):_e=""}else _e=Z[3]?Z[3].slice(1,-1):"";Ae=Ae.trim().replace(/^<([\s\S]*)>$/,"$1");var Qe=oe(Z,{href:Ae&&Ae.replace(this.rules.inline._escapes,"$1"),title:_e&&_e.replace(this.rules.inline._escapes,"$1")},Z[0]);return Qe}},se.reflink=function($,Z){var te;if((te=this.rules.inline.reflink.exec($))||(te=this.rules.inline.nolink.exec($))){var le=(te[2]||te[1]).replace(/\s+/g," ");if(le=Z[le.toLowerCase()],!le||!le.href){var ce=te[0].charAt(0);return{type:"text",raw:ce,text:ce}}var Ae=oe(te,le,te[0]);return Ae}},se.strong=function($,Z,te){te===void 0&&(te="");var le=this.rules.inline.strong.start.exec($);if(le&&(!le[1]||le[1]&&(te===""||this.rules.inline.punctuation.exec(te)))){Z=Z.slice(-1*$.length);var ce=le[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;ce.lastIndex=0;for(var Ae;(le=ce.exec(Z))!=null;)if(Ae=this.rules.inline.strong.middle.exec(Z.slice(0,le.index+3)),Ae)return{type:"strong",raw:$.slice(0,Ae[0].length),text:$.slice(2,Ae[0].length-2)}}},se.em=function($,Z,te){te===void 0&&(te="");var le=this.rules.inline.em.start.exec($);if(le&&(!le[1]||le[1]&&(te===""||this.rules.inline.punctuation.exec(te)))){Z=Z.slice(-1*$.length);var ce=le[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;ce.lastIndex=0;for(var Ae;(le=ce.exec(Z))!=null;)if(Ae=this.rules.inline.em.middle.exec(Z.slice(0,le.index+2)),Ae)return{type:"em",raw:$.slice(0,Ae[0].length),text:$.slice(1,Ae[0].length-1)}}},se.codespan=function($){var Z=this.rules.inline.code.exec($);if(Z){var te=Z[2].replace(/\n/g," "),le=/[^ ]/.test(te),ce=te.startsWith(" ")&&te.endsWith(" ");return le&&ce&&(te=te.substring(1,te.length-1)),te=Y(te,!0),{type:"codespan",raw:Z[0],text:te}}},se.br=function($){var Z=this.rules.inline.br.exec($);if(Z)return{type:"br",raw:Z[0]}},se.del=function($){var Z=this.rules.inline.del.exec($);if(Z)return{type:"del",raw:Z[0],text:Z[1]}},se.autolink=function($,Z){var te=this.rules.inline.autolink.exec($);if(te){var le,ce;return te[2]==="@"?(le=Y(this.options.mangle?Z(te[1]):te[1]),ce="mailto:"+le):(le=Y(te[1]),ce=le),{type:"link",raw:te[0],text:le,href:ce,tokens:[{type:"text",raw:le,text:le}]}}},se.url=function($,Z){var te;if(te=this.rules.inline.url.exec($)){var le,ce;if(te[2]==="@")le=Y(this.options.mangle?Z(te[0]):te[0]),ce="mailto:"+le;else{var Ae;do Ae=te[0],te[0]=this.rules.inline._backpedal.exec(te[0])[0];while(Ae!==te[0]);le=Y(te[0]),te[1]==="www."?ce="http://"+le:ce=le}return{type:"link",raw:te[0],text:le,href:ce,tokens:[{type:"text",raw:le,text:le}]}}},se.inlineText=function($,Z,te){var le=this.rules.inline.text.exec($);if(le){var ce;return Z?ce=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(le[0]):Y(le[0]):le[0]:ce=Y(this.options.smartypants?te(le[0]):le[0]),{type:"text",raw:le[0],text:ce}}},pe}(),ge=W.noopTest,he=W.edit,fe=W.merge,ae={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6}) +([^\n]*?)(?: +#+)? *(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|\\n*|\\n*|)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:ge,table:ge,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};ae._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,ae._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,ae.def=he(ae.def).replace("label",ae._label).replace("title",ae._title).getRegex(),ae.bullet=/(?:[*+-]|\d{1,9}[.)])/,ae.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,ae.item=he(ae.item,"gm").replace(/bull/g,ae.bullet).getRegex(),ae.list=he(ae.list).replace(/bull/g,ae.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+ae.def.source+")").getRegex(),ae._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",ae._comment=//,ae.html=he(ae.html,"i").replace("comment",ae._comment).replace("tag",ae._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ae.paragraph=he(ae._paragraph).replace("hr",ae.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|!--)").replace("tag",ae._tag).getRegex(),ae.blockquote=he(ae.blockquote).replace("paragraph",ae.paragraph).getRegex(),ae.normal=fe({},ae),ae.gfm=fe({},ae.normal,{nptable:"^ *([^|\\n ].*\\|.*)\\n *([-:]+ *\\|[-| :]*)(?:\\n((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)",table:"^ *\\|(.+)\\n *\\|?( *[-:]+[-| :]*)(?:\\n *((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),ae.gfm.nptable=he(ae.gfm.nptable).replace("hr",ae.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|!--)").replace("tag",ae._tag).getRegex(),ae.gfm.table=he(ae.gfm.table).replace("hr",ae.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|!--)").replace("tag",ae._tag).getRegex(),ae.pedantic=fe({},ae.normal,{html:he(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ae._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,fences:ge,paragraph:he(ae.normal._paragraph).replace("hr",ae.hr).replace("heading",` *#{1,6} *[^ ]`).replace("lheading",ae.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var me={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:ge,tag:"^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,nolink:/^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",strong:{start:/^(?:(\*\*(?=[*punctuation]))|\*\*)(?![\s])|__/,middle:/^\*\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*\*$|^__(?![\s])((?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?)__$/,endAst:/[^punctuation\s]\*\*(?!\*)|[punctuation]\*\*(?!\*)(?:(?=[punctuation\s]|$))/,endUnd:/[^\s]__(?!_)(?:(?=[punctuation\s])|$)/},em:{start:/^(?:(\*(?=[punctuation]))|\*)(?![*\s])|_/,middle:/^\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*$|^_(?![_\s])(?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?_$/,endAst:/[^punctuation\s]\*(?!\*)|[punctuation]\*(?!\*)(?:(?=[punctuation\s]|$))/,endUnd:/[^\s]_(?!_)(?:(?=[punctuation\s])|$)/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:ge,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\?@\\[\\]`^{|}~",me.punctuation=he(me.punctuation).replace(/punctuation/g,me._punctuation).getRegex(),me._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",me._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",me.em.start=he(me.em.start).replace(/punctuation/g,me._punctuation).getRegex(),me.em.middle=he(me.em.middle).replace(/punctuation/g,me._punctuation).replace(/overlapSkip/g,me._overlapSkip).getRegex(),me.em.endAst=he(me.em.endAst,"g").replace(/punctuation/g,me._punctuation).getRegex(),me.em.endUnd=he(me.em.endUnd,"g").replace(/punctuation/g,me._punctuation).getRegex(),me.strong.start=he(me.strong.start).replace(/punctuation/g,me._punctuation).getRegex(),me.strong.middle=he(me.strong.middle).replace(/punctuation/g,me._punctuation).replace(/blockSkip/g,me._blockSkip).getRegex(),me.strong.endAst=he(me.strong.endAst,"g").replace(/punctuation/g,me._punctuation).getRegex(),me.strong.endUnd=he(me.strong.endUnd,"g").replace(/punctuation/g,me._punctuation).getRegex(),me.blockSkip=he(me._blockSkip,"g").getRegex(),me.overlapSkip=he(me._overlapSkip,"g").getRegex(),me._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,me._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,me._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])?)+(?![-_])/,me.autolink=he(me.autolink).replace("scheme",me._scheme).replace("email",me._email).getRegex(),me._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,me.tag=he(me.tag).replace("comment",ae._comment).replace("attribute",me._attribute).getRegex(),me._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,me._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,me._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,me.link=he(me.link).replace("label",me._label).replace("href",me._href).replace("title",me._title).getRegex(),me.reflink=he(me.reflink).replace("label",me._label).getRegex(),me.reflinkSearch=he(me.reflinkSearch,"g").replace("reflink",me.reflink).replace("nolink",me.nolink).getRegex(),me.normal=fe({},me),me.pedantic=fe({},me.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:he(/^!?\[(label)\]\((.*?)\)/).replace("label",me._label).getRegex(),reflink:he(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",me._label).getRegex()}),me.gfm=fe({},me.normal,{escape:he(me.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^~+(?=\S)([\s\S]*?\S)~+/,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\.5&&($="x"+$.toString(16)),se+="&#"+$+";";return se}var we=function(){function pe(de){this.tokens=[],this.tokens.links=Object.create(null),this.options=de||ne,this.options.tokenizer=this.options.tokenizer||new ve,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var $={block:Q.normal,inline:Ee.normal};this.options.pedantic?($.block=Q.pedantic,$.inline=Ee.pedantic):this.options.gfm&&($.block=Q.gfm,this.options.breaks?$.inline=Ee.breaks:$.inline=Ee.gfm),this.tokenizer.rules=$}pe.lex=function($,Z){var te=new pe(Z);return te.lex($)};var se=pe.prototype;return se.lex=function($){return $=$.replace(/\r\n|\r/g,` `).replace(/\t/g," "),this.blockTokens($,this.tokens,!0),this.inline(this.tokens),this.tokens},se.blockTokens=function($,Z,te){Z===void 0&&(Z=[]),te===void 0&&(te=!0),$=$.replace(/^ +$/gm,"");for(var le,ce,Ae,_e;$;){if(le=this.tokenizer.space($)){$=$.substring(le.raw.length),le.type&&Z.push(le);continue}if(le=this.tokenizer.code($,Z)){$=$.substring(le.raw.length),le.type?Z.push(le):(_e=Z[Z.length-1],_e.raw+=` `+le.raw,_e.text+=` `+le.text);continue}if(le=this.tokenizer.fences($)){$=$.substring(le.raw.length),Z.push(le);continue}if(le=this.tokenizer.heading($)){$=$.substring(le.raw.length),Z.push(le);continue}if(le=this.tokenizer.nptable($)){$=$.substring(le.raw.length),Z.push(le);continue}if(le=this.tokenizer.hr($)){$=$.substring(le.raw.length),Z.push(le);continue}if(le=this.tokenizer.blockquote($)){$=$.substring(le.raw.length),le.tokens=this.blockTokens(le.text,[],te),Z.push(le);continue}if(le=this.tokenizer.list($)){for($=$.substring(le.raw.length),Ae=le.items.length,ce=0;ce0)for(;(Ue=this.tokenizer.rules.inline.reflinkSearch.exec(_e))!=null;)Qe.includes(Ue[0].slice(Ue[0].lastIndexOf("[")+1,-1))&&(_e=_e.slice(0,Ue.index)+"["+"a".repeat(Ue[0].length-2)+"]"+_e.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(Ue=this.tokenizer.rules.inline.blockSkip.exec(_e))!=null;)_e=_e.slice(0,Ue.index)+"["+"a".repeat(Ue[0].length-2)+"]"+_e.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;$;){if(Ae=this.tokenizer.escape($)){$=$.substring(Ae.raw.length),Z.push(Ae);continue}if(Ae=this.tokenizer.tag($,te,le)){$=$.substring(Ae.raw.length),te=Ae.inLink,le=Ae.inRawBlock,Z.push(Ae);continue}if(Ae=this.tokenizer.link($)){$=$.substring(Ae.raw.length),Ae.type==="link"&&(Ae.tokens=this.inlineTokens(Ae.text,[],!0,le)),Z.push(Ae);continue}if(Ae=this.tokenizer.reflink($,this.tokens.links)){$=$.substring(Ae.raw.length),Ae.type==="link"&&(Ae.tokens=this.inlineTokens(Ae.text,[],!0,le)),Z.push(Ae);continue}if(Ae=this.tokenizer.strong($,_e,ce)){$=$.substring(Ae.raw.length),Ae.tokens=this.inlineTokens(Ae.text,[],te,le),Z.push(Ae);continue}if(Ae=this.tokenizer.em($,_e,ce)){$=$.substring(Ae.raw.length),Ae.tokens=this.inlineTokens(Ae.text,[],te,le),Z.push(Ae);continue}if(Ae=this.tokenizer.codespan($)){$=$.substring(Ae.raw.length),Z.push(Ae);continue}if(Ae=this.tokenizer.br($)){$=$.substring(Ae.raw.length),Z.push(Ae);continue}if(Ae=this.tokenizer.del($)){$=$.substring(Ae.raw.length),Ae.tokens=this.inlineTokens(Ae.text,[],te,le),Z.push(Ae);continue}if(Ae=this.tokenizer.autolink($,ye)){$=$.substring(Ae.raw.length),Z.push(Ae);continue}if(!te&&(Ae=this.tokenizer.url($,ye))){$=$.substring(Ae.raw.length),Z.push(Ae);continue}if(Ae=this.tokenizer.inlineText($,le,Ce)){$=$.substring(Ae.raw.length),ce=Ae.raw.slice(-1),Z.push(Ae);continue}if($){var Ve="Infinite loop on byte: "+$.charCodeAt(0);if(this.options.silent){console.error(Ve);break}else throw new Error(Ve)}}return Z},V(pe,null,[{key:"rules",get:function(){return{block:Q,inline:Ee}}}]),pe}(),De=B.defaults,Pe=W.cleanUrl,ke=W.escape,Oe=function(){function pe(de){this.options=de||De}var se=pe.prototype;return se.code=function($,Z,te){var le=(Z||"").match(/\S*/)[0];if(this.options.highlight){var ce=this.options.highlight($,le);ce!=null&&ce!==$&&(te=!0,$=ce)}return le?'
    '+(te?$:ke($,!0))+`
    `:"
    "+(te?$:ke($,!0))+`
    `},se.blockquote=function($){return`
    `+$+`
    `},se.html=function($){return $},se.heading=function($,Z,te,le){return this.options.headerIds?"'+$+" `:""+$+" `},se.hr=function(){return this.options.xhtml?`
    `:`
    `},se.list=function($,Z,te){var le=Z?"ol":"ul",ce=Z&&te!==1?' start="'+te+'"':"";return"<"+le+ce+`> `+$+" `},se.listitem=function($){return"
  • "+$+`
  • `},se.checkbox=function($){return" "},se.paragraph=function($){return"

    "+$+`

    `},se.table=function($,Z){return Z&&(Z=""+Z+""),` `+$+` `+Z+`
    `},se.tablerow=function($){return` `+$+` `},se.tablecell=function($,Z){var te=Z.header?"th":"td",le=Z.align?"<"+te+' align="'+Z.align+'">':"<"+te+">";return le+$+" `},se.strong=function($){return""+$+""},se.em=function($){return""+$+""},se.codespan=function($){return""+$+""},se.br=function(){return this.options.xhtml?"
    ":"
    "},se.del=function($){return""+$+""},se.link=function($,Z,te){if($=Pe(this.options.sanitize,this.options.baseUrl,$),$===null)return te;var le='",le},se.image=function($,Z,te){if($=Pe(this.options.sanitize,this.options.baseUrl,$),$===null)return te;var le=''+te+'":">",le},se.text=function($){return $},pe}(),Re=function(){function pe(){}var se=pe.prototype;return se.strong=function($){return $},se.em=function($){return $},se.codespan=function($){return $},se.del=function($){return $},se.html=function($){return $},se.text=function($){return $},se.link=function($,Z,te){return""+te},se.image=function($,Z,te){return""+te},se.br=function(){return""},pe}(),Ge=function(){function pe(){this.seen={}}var se=pe.prototype;return se.slug=function($){var Z=$.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(Z)){var te=Z;do this.seen[te]++,Z=te+"-"+this.seen[te];while(this.seen.hasOwnProperty(Z))}return this.seen[Z]=0,Z},pe}(),$e=B.defaults,Be=W.unescape,He=function(){function pe(de){this.options=de||$e,this.options.renderer=this.options.renderer||new Oe,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Re,this.slugger=new Ge}pe.parse=function($,Z){var te=new pe(Z);return te.parse($)};var se=pe.prototype;return se.parse=function($,Z){Z===void 0&&(Z=!0);var te="",le,ce,Ae,_e,Ue,Qe,Ve,mt,dt,ot,Ct,bt,Bt,Ut,Et,Cr,Rr,lr,pr=$.length;for(le=0;le0&&Et.tokens[0].type==="text"?(Et.tokens[0].text=lr+" "+Et.tokens[0].text,Et.tokens[0].tokens&&Et.tokens[0].tokens.length>0&&Et.tokens[0].tokens[0].type==="text"&&(Et.tokens[0].tokens[0].text=lr+" "+Et.tokens[0].tokens[0].text)):Et.tokens.unshift({type:"text",text:lr}):Ut+=lr),Ut+=this.parse(Et.tokens,Bt),dt+=this.renderer.listitem(Ut,Rr,Cr);te+=this.renderer.list(dt,Ct,bt);continue}case"html":{te+=this.renderer.html(ot.text);continue}case"paragraph":{te+=this.renderer.paragraph(this.parseInline(ot.tokens));continue}case"text":{for(dt=ot.tokens?this.parseInline(ot.tokens):ot.text;le+1An error occurred:

    "+qe(Ae.message+"",!0)+"
    ";throw Ae}}Le.options=Le.setOptions=function(pe){return rt(Le.defaults,pe),Ze(Le.defaults),Le},Le.getDefaults=Se,Le.defaults=Ke,Le.use=function(pe){var se=rt({},pe);if(pe.renderer&&function(){var $=Le.defaults.renderer||new Oe,Z=function(ce){var Ae=$[ce];$[ce]=function(){for(var _e=arguments.length,Ue=new Array(_e),Qe=0;Qe<_e;Qe++)Ue[Qe]=arguments[Qe];var Ve=pe.renderer[ce].apply($,Ue);return Ve===!1&&(Ve=Ae.apply($,Ue)),Ve}};for(var te in pe.renderer)Z(te);se.renderer=$}(),pe.tokenizer&&function(){var $=Le.defaults.tokenizer||new ve,Z=function(ce){var Ae=$[ce];$[ce]=function(){for(var _e=arguments.length,Ue=new Array(_e),Qe=0;Qe<_e;Qe++)Ue[Qe]=arguments[Qe];var Ve=pe.tokenizer[ce].apply($,Ue);return Ve===!1&&(Ve=Ae.apply($,Ue)),Ve}};for(var te in pe.tokenizer)Z(te);se.tokenizer=$}(),pe.walkTokens){var de=Le.defaults.walkTokens;se.walkTokens=function($){pe.walkTokens($),de&&de($)}}Le.setOptions(se)},Le.walkTokens=function(pe,se){for(var de=I(pe),$;!($=de()).done;){var Z=$.value;se(Z);switch(Z.type){case"table":{for(var te=I(Z.tokens.header),le;!(le=te()).done;){var ce=le.value;Le.walkTokens(ce,se)}for(var Ae=I(Z.tokens.cells),_e;!(_e=Ae()).done;)for(var Ue=_e.value,Qe=I(Ue),Ve;!(Ve=Qe()).done;){var mt=Ve.value;Le.walkTokens(mt,se)}break}case"list":{Le.walkTokens(Z.items,se);break}default:Z.tokens&&Le.walkTokens(Z.tokens,se)}}},Le.Parser=He,Le.parser=He.parse,Le.Renderer=Oe,Le.TextRenderer=Re,Le.Lexer=we,Le.lexer=we.lex,Le.Tokenizer=ve,Le.Slugger=Ge,Le.parse=Le;var Ie=Le;return Ie})},ELLl:function(st,ze,q){(function(re){re(q("VrN/"))})(function(re){var V={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},A=re.Pos;re.defineOption("autoCloseBrackets",!1,function(T,g,d){d&&d!=re.Init&&(T.removeKeyMap(I),T.state.closeBrackets=null),g&&(R(G(g,"pairs")),T.state.closeBrackets=g,T.addKeyMap(I))});function G(T,g){return g=="pairs"&&typeof T=="string"?T:typeof T=="object"&&T[g]!=null?T[g]:V[g]}var I={Backspace:k,Enter:L};function R(T){for(var g=0;g=0;u--){var w=o[u].head;T.replaceRange("",A(w.line,w.ch-1),A(w.line,w.ch+1),"+delete")}}function L(T){var g=U(T),d=g&&G(g,"explode");if(!d||T.getOption("disableInput"))return re.Pass;for(var o=T.listSelections(),u=0;u0;return{anchor:new A(T.anchor.line,T.anchor.ch+(g?-1:1)),head:new A(T.head.line,T.head.ch+(g?1:-1))}}function x(T,g){var d=U(T);if(!d||T.getOption("disableInput"))return re.Pass;var o=G(d,"pairs"),u=o.indexOf(g);if(u==-1)return re.Pass;for(var s=G(d,"closeBefore"),w=G(d,"triples"),p=o.charAt(u+1)==g,f=T.listSelections(),_=u%2==0,b,h=0;h=0&&T.getRange(l,A(l.line,l.ch+3))==g+g+g?a="skipThree":a="skip";else if(p&&l.ch>1&&w.indexOf(g)>=0&&T.getRange(A(l.line,l.ch-2),l)==g+g){if(l.ch>2&&/\bstring/.test(T.getTokenTypeAt(A(l.line,l.ch-2))))return re.Pass;a="addFour"}else if(p){var m=l.ch==0?" ":T.getRange(A(l.line,l.ch-1),l);if(!re.isWordChar(v)&&m!=g&&!re.isWordChar(m))a="both";else return re.Pass}else if(_&&(v.length===0||/\s/.test(v)||s.indexOf(v)>-1))a="both";else return re.Pass;if(!b)b=a;else if(b!=a)return re.Pass}var E=u%2?o.charAt(u-1):g,M=u%2?g:o.charAt(u+1);T.operation(function(){if(b=="skip")T.execCommand("goCharRight");else if(b=="skipThree")for(var F=0;F<3;F++)T.execCommand("goCharRight");else if(b=="surround"){for(var j=T.getSelections(),F=0;F0&&(ee.percent=ee.loaded/ee.total*100),W.onProgress(ee)});var P=new FormData;W.data&&Object.keys(W.data).forEach(function(Y){var ee=W.data[Y];if(Array.isArray(ee)){ee.forEach(function(oe){P.append(Y+"[]",oe)});return}P.append(Y,W.data[Y])}),W.file instanceof Blob?P.append(W.filename,W.file,W.file.name):P.append(W.filename,W.file),D.onerror=function(ee){W.onError(ee)},D.onload=function(){return D.status<200||D.status>=300?W.onError(I(W,D),R(D)):W.onSuccess(R(D),D)},D.open(W.method,W.action,!0),W.withCredentials&&"withCredentials"in D&&(D.withCredentials=!0);var H=W.headers||{};return H["X-Requested-With"]!==null&&D.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(H).forEach(function(Y){H[Y]!==null&&D.setRequestHeader(Y,H[Y])}),D.send(P),{abort:function(){D.abort()}}}var U=+new Date,k=0;function L(){return"rc-upload-"+U+"-"+ ++k}function y(W,D){return W.indexOf(D,W.length-D.length)!==-1}var x=function(W,D){if(W&&D){var P=Array.isArray(D)?D:D.split(","),H=W.name||"",Y=W.type||"",ee=Y.replace(/\/.*$/,"");return P.some(function(oe){var Te=oe.trim();return Te.charAt(0)==="."?y(H.toLowerCase(),Te.toLowerCase()):/\/\*$/.test(Te)?ee===Te.replace(/\/.*$/,""):Y===Te})}return!0};function O(W,D){var P=W.createReader(),H=[];function Y(){P.readEntries(function(ee){var oe=Array.prototype.slice.apply(ee);H=H.concat(oe);var Te=!oe.length;Te?D(H):Y()})}Y()}var C=function(D,P,H){var Y=function ee(oe,Te){Te=Te||"",oe.isFile?oe.file(function(ve){H(ve)&&(oe.fullPath&&!ve.webkitRelativePath&&(Object.defineProperties(ve,{webkitRelativePath:{writable:!0}}),ve.webkitRelativePath=oe.fullPath.replace(/^\//,""),Object.defineProperties(ve,{webkitRelativePath:{writable:!1}})),P([ve]))}):oe.isDirectory&&O(oe,function(ve){ve.forEach(function(ge){ee(ge,""+Te+oe.name+"/")})})};D.forEach(function(ee){Y(ee.webkitGetAsEntry())})},T=C,g=Object.assign||function(W){for(var D=1;D=0)continue;if(!Object.prototype.hasOwnProperty.call(W,H))continue;P[H]=W[H]}return P}function w(W,D){if(!(W instanceof D))throw new TypeError("Cannot call a class as a function")}function p(W,D){if(!W)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return D&&(typeof D=="object"||typeof D=="function")?D:W}function f(W,D){if(typeof D!="function"&&D!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof D);W.prototype=Object.create(D&&D.prototype,{constructor:{value:W,enumerable:!1,writable:!0,configurable:!0}}),D&&(Object.setPrototypeOf?Object.setPrototypeOf(W,D):W.__proto__=D)}var _=function(D){return Object.keys(D).reduce(function(P,H){return(H.substr(0,5)==="data-"||H.substr(0,5)==="aria-"||H==="role")&&(P[H]=D[H]),P},{})},b=function(W){f(D,W);function D(){var P,H,Y,ee;w(this,D);for(var oe=arguments.length,Te=Array(oe),ve=0;ve1&&arguments[1]!==void 0?arguments[1]:1,de=Re.length,$=0;$1&&arguments[1]!==void 0?arguments[1]:!1;return Object(_.a)(P).map(function(Y,ee){if(!I.isValidElement(Y)||!Y.type)return null;var oe=Y.type.isSelectOptGroup,Te=Y.key,ve=Y.props,ge=ve.children,he=Object(B.a)(ve,["children"]);return H||!oe?b(Y):Object(f.a)(Object(f.a)({key:"__RC_SELECT_GRP__".concat(Te===null?ee:Te,"__"),label:Te},he),{},{options:h(ge)})}).filter(function(Y){return Y})}var c=q("2Qr1"),l=q("qNPg"),a=q("U8pU"),v=q("Kwbf"),m=q("WKfj");function E(P){var H=P.mode,Y=P.options,ee=P.children,oe=P.backfill,Te=P.allowClear,ve=P.placeholder,ge=P.getInputElement,he=P.showSearch,fe=P.onSearch,ae=P.defaultOpen,me=P.autoFocus,J=P.labelInValue,ne=P.value,Q=P.inputValue,Ee=P.optionLabelProp,Ce=H==="multiple"||H==="tags",ye=he!==void 0?he:Ce||H==="combobox",we=Y||h(ee);if(Object(v.a)(H!=="tags"||we.every(function(Oe){return!Oe.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),H==="tags"||H==="combobox"){var De=we.some(function(Oe){return Oe.options?Oe.options.some(function(Re){return typeof("value"in Re?Re.value:Re.key)=="number"}):typeof("value"in Oe?Oe.value:Oe.key)=="number"});Object(v.a)(!De,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(v.a)(H!=="combobox"||!Ee,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(v.a)(H==="combobox"||!oe,"`backfill` only works with `combobox` mode."),Object(v.a)(H==="combobox"||!ge,"`getInputElement` only work with `combobox` mode."),Object(v.b)(H!=="combobox"||!ge||!Te||!ve,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),fe&&!ye&&H!=="combobox"&&H!=="tags"&&Object(v.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(v.b)(!ae||me,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),ne!=null){var Pe=Object(m.d)(ne);Object(v.a)(!J||Pe.every(function(Oe){return Object(a.a)(Oe)==="object"&&("key"in Oe||"value"in Oe)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(v.a)(!Ce||Array.isArray(ne),"`value` should be array when `mode` is `multiple` or `tags`")}if(ee){var ke=null;Object(_.a)(ee).some(function(Oe){if(!I.isValidElement(Oe)||!Oe.type)return!1;var Re=Oe.type;if(Re.isSelectOption)return!1;if(Re.isSelectOptGroup){var Ge=Object(_.a)(Oe.props.children).every(function($e){return!I.isValidElement($e)||!Oe.type||$e.type.isSelectOption?!0:(ke=$e.type,!1)});return!Ge}return ke=Re,!0}),ke&&Object(v.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(ke.displayName||ke.name||ke,"`.")),Object(v.a)(Q===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var M=E,F=Object(l.a)({prefixCls:"rc-select",components:{optionList:o},convertChildrenToData:h,flattenOptions:c.d,getLabeledValue:c.e,filterOptions:c.b,isValueDisabled:c.g,findValueOption:c.c,warningProps:M,fillOptionsWithMissingValue:c.a}),j=function(P){Object(A.a)(Y,P);var H=Object(G.a)(Y);function Y(){var ee;return Object(re.a)(this,Y),ee=H.apply(this,arguments),ee.selectRef=I.createRef(),ee.focus=function(){ee.selectRef.current.focus()},ee.blur=function(){ee.selectRef.current.blur()},ee}return Object(V.a)(Y,[{key:"render",value:function(){return I.createElement(F,Object.assign({ref:this.selectRef},this.props))}}]),Y}(I.Component);j.Option=s,j.OptGroup=p;var W=j,D=ze.c=W},M8RZ:function(st,ze,q){"use strict";q.d(ze,"a",function(){return k});var re=q("fWQN"),V=q("mtLc"),A=q("yKVA"),G=q("879j"),I=q("cDcd"),R=q.n(I),B=q("faye"),U=q.n(B),k=function(L){Object(A.a)(x,L);var y=Object(G.a)(x);function x(O){var C;Object(re.a)(this,x),C=y.call(this,O);var T=window.document;return C.node=T.createElement("div"),T.body.appendChild(C.node),C}return Object(V.a)(x,[{key:"render",value:function(){var C=this.props.children;return Object(B.createPortal)(C,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),x}(R.a.Component)},Ot1p:function(st,ze,q){"use strict";var re=q("2qtc"),V=q("kLXV"),A=q("rAM+"),G=q("miYZ"),I=q("tsqr"),R=q("9og8"),B=q("tJVT"),U=q("jrin"),k=q("WmNS"),L=q.n(k),y=q("cDcd"),x=q.n(y),O=q("VrN/"),C=q.n(O),T=q("bdgK"),g=q("p77/"),d=q("Bd2K"),o=q("ELLl"),u=q("19Vz"),s=q("lZu9"),w=q("+NIl"),p=q("kSUc"),f=q("9Bee"),_=function(ce){var Ae=ce.value,_e=Ae===void 0?"":Ae,Ue=ce.className,Qe=ce.showTextOnly,Ve=ce.showLines,mt=ce.style,dt=mt===void 0?{}:mt,ot=Object(y.useMemo)(function(){return""},[_e]);return x.a.createElement(x.a.Fragment,null,x.a.createElement("div",{dangerouslySetInnerHTML:{__html:ot}}))},b=q("0Owb"),h=q("dejd"),c=q("C+DQ"),l=q("1vsH"),a=q("m3rI"),v=[{title:"\u7C97\u4F53",icon:"icon-bold",actionName:"bold"},{title:"\u659C\u4F53",icon:"icon-italic",actionName:"italic"},"|",{title:"\u65E0\u5E8F\u5217\u8868",icon:"icon-unorder-list",actionName:"list-ul"},{title:"\u6709\u5E8F\u5217\u8868",icon:"icon-order-list",actionName:"list-ol"},"|",{title:"\u884C\u5185\u4EE3\u7801",icon:"icon-code",actionName:"code"},{title:"\u4EE3\u7801\u5757\uFF08\u591A\u8BED\u8A00\u98CE\u683C\uFF09",icon:"icon-file-code",actionName:"code-block"},{title:"\u94FE\u63A5",icon:"icon-link",actionName:"link"},"|",{title:"\u884C\u5185\u516C\u5F0F",icon:"icon-sum",actionName:"inline-latex"},{title:"\u591A\u884C\u516C\u5F0F",icon:"icon-formula",actionName:"latex"},"|",{title:"\u6DFB\u52A0\u56FE\u7247",icon:"icon-picture",actionName:"upload-image"},{title:"\u8868\u683C",icon:"icon-table",actionName:"add-table"},"|",{title:"\u6362\u884C",icon:"icon-minus",actionName:"line-break"},{title:"\u6E05\u7A7A",icon:"icon-eraser",actionName:"eraser"}];function m(ce){var Ae=ce.onActionCallback,_e=ce.title,Ue=ce.icon,Qe=ce.actionName,Ve=ce.className,mt=Ve===void 0?"":Ve,dt=ce.children;function ot(){Ae(Qe)}return x.a.createElement("a",{title:_e,className:mt,onClick:ot},x.a.createElement("i",{className:"md-iconfont ".concat(Ue)}),dt)}var E=function(ce){var Ae=ce.watch,_e=ce.showNullButton,Ue=ce.onActionCallback,Qe=ce.fullScreen,Ve=ce.insertTemp,mt=ce.hidetoolBar,dt=ce.uuid,ot=ce.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(l.G)("_educoder_session_login"),"&_educoder_session=").concat(Object(l.G)("_educoder_session"),"&key=").concat(dt,"&api=").concat(encodeURIComponent(a.a.PROXY_SERVER)));var Ct=[].concat(v,[{title:"".concat(Ae?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(Ae?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return x.a.createElement("ul",{className:"markdown-toolbar-container"},!mt&&Ct.map(function(bt,Bt){return x.a.createElement("li",{key:Bt},bt.actionName?x.a.createElement(m,Object(b.a)({},bt,{onActionCallback:Ue})):x.a.createElement("span",{className:"v-line"}))}),_e?x.a.createElement("li",null,x.a.createElement(m,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:Ue},x.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,Ve&&x.a.createElement("li",null,x.a.createElement(m,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(Ve),onActionCallback:Ue},x.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),x.a.createElement("li",{className:"btn-full-screen"},x.a.createElement(m,{icon:"".concat(Qe?"icon-shrink":"icon-enlarge"),title:Qe?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:Ue})))},M=q("M8RZ"),F=q("+L6B"),j=q("2/Rp"),W=q("y8nQ"),D=q("Vl3Y"),P=q("5NDa"),H=q("5rEg"),Y={labelCol:{span:4},wrapperCol:{span:20}},ee=function(ce){var Ae=ce.callback,_e=ce.onCancel;function Ue(Qe){Ae(Qe)}return x.a.createElement(D.a,Object(b.a)({},Y,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:Ue}),x.a.createElement(D.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},x.a.createElement(H.a,null)),x.a.createElement(D.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},x.a.createElement(H.a,null)),x.a.createElement("div",{className:"flex-container flex-end"},x.a.createElement(j.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),x.a.createElement(j.a,{type:"ghost",onClick:_e},"\u53D6\u6D88")))},oe=q("7ahc"),Te=q("HmJG"),ve=q("BjJ7"),ge=D.a.useForm,he={width:280,marginRight:10},fe={labelCol:{span:5},wrapperCol:{span:19}},ae=function(ce){var Ae=ce.callback,_e=ce.onCancel,Ue=ge(),Qe=Object(B.a)(Ue,1),Ve=Qe[0];function mt(Ct){Ae(Ct)}function dt(Ct,bt){if(Ct.status===-1){I.b.error(Ct.message);return}Ve.setFieldsValue({src:"/api/attachments/".concat(Ct.id),type:bt.type})}function ot(Ct){var bt=Ct.target.files[0];J(bt,dt)}return x.a.createElement(D.a,Object(b.a)({form:Ve},fe,{className:"upload-image-panel",onFinish:mt}),x.a.createElement(D.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},x.a.createElement("div",{className:"flex-container"},x.a.createElement(D.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},x.a.createElement(H.a,{style:he})),x.a.createElement(me,{onFileChange:ot}))),x.a.createElement(D.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt"},x.a.createElement(H.a,{style:{width:264}})),x.a.createElement(D.a.Item,{style:{textAlign:"right"}},x.a.createElement(j.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),x.a.createElement(j.a,{type:"ghost",onClick:_e},"\u53D6\u6D88")))};function me(ce){var Ae=ce.onFileChange;return x.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",x.a.createElement("input",{type:"file",onChange:Ae}))}function J(ce,Ae){if(!ce)throw new String("\u6CA1\u6709\u6587\u4EF6");var _e=new FormData;_e.append("editormd-image-file",ce),_e.append("file_param_name","editormd-image-file"),_e.append("byxhr","true");var Ue=new window.XMLHttpRequest;Ue.withCredentials=!0,Ue.addEventListener("load",function(Qe){Ae(JSON.parse(Qe.target.responseText),ce)},!1),Ue.addEventListener("error",function(Qe){console.error(Qe)},!1),Ue.open("POST","".concat(ve.a,"/api/attachments.json")),Ue.send(_e)}var ne=q("giR+"),Q=q("fyUT"),Ee=q("7Kak"),Ce=q("9yH6"),ye=Ce.a.Group,we={margin:"0 8px"},De=function(ce){var Ae=ce.callback,_e=ce.onCancel;function Ue(Qe){Ae(Qe)}return x.a.createElement(D.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:Ue},x.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},x.a.createElement("span",{style:we},"\u5355\u5143\u683C\u6570\uFF1A"),x.a.createElement("span",{style:we},"\u884C\u6570"),x.a.createElement(D.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},x.a.createElement(Q.a,null)),x.a.createElement("span",{style:we},"\u5217\u6570"),x.a.createElement(D.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},x.a.createElement(Q.a,null))),x.a.createElement("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"}},x.a.createElement("span",{style:we},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),x.a.createElement(D.a.Item,{name:"align"},x.a.createElement(ye,null,x.a.createElement(Ce.a,{value:"default"},x.a.createElement("i",{className:"fa fa-align-justify"})),x.a.createElement(Ce.a,{value:"left"},x.a.createElement("i",{className:"fa fa-align-left"})),x.a.createElement(Ce.a,{value:"center"},x.a.createElement("i",{className:"fa fa-align-center"})),x.a.createElement(Ce.a,{value:"right"},x.a.createElement("i",{className:"fa fa-align-right"}))))),x.a.createElement("div",{className:"flex-container flex-end"},x.a.createElement(j.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),x.a.createElement(j.a,{type:"ghost",onClick:_e},"\u53D6\u6D88")))},Pe=q("ErOA"),ke=q("7Cbv"),Oe="link",Re="upload-image",Ge="code-block",$e="add-table",Be="------------",He={default:Be,left:":".concat(Be),center:":".concat(Be,":"),right:"".concat(Be,":")},rt=q("9VGf"),Je,qe;function Se(){}var Ze=0,Ke=1e4,Le="\u2581",Ie=` **\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 pe(ce){return/^\d+$/.test(ce)?"".concat(ce,"px"):ce}var se=navigator.platform.toUpperCase().indexOf("MAC")>=0,de=se?"Cmd":"Ctrl",$=["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"],Z=(Je={},Object(U.a)(Je,de+"-B","bold"),Object(U.a)(Je,de+"-I","italic"),Je),te=(qe={},Object(U.a)(qe,Oe,"\u6DFB\u52A0\u94FE\u63A5"),Object(U.a)(qe,Ge,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(U.a)(qe,Re,"\u6DFB\u52A0\u6587\u4EF6"),Object(U.a)(qe,$e,"\u6DFB\u52A0\u8868\u683C"),qe),le=ze.a=function(ce){var Ae=ce.defaultValue,_e=Ae===void 0?"":Ae,Ue=ce.onChange,Qe=ce.width,Ve=Qe===void 0?"100%":Qe,mt=ce.height,dt=mt===void 0?400:mt,ot=ce.miniToolbar,Ct=ot===void 0?!1:ot,bt=ce.isFocus,Bt=bt===void 0?!1:bt,Ut=ce.watch,Et=ce.insertTemp,Cr=ce.mode,Rr=Cr===void 0?"markdown":Cr,lr=ce.id,pr=lr===void 0?"markdown-editor-id":lr,fr=ce.showResizeBar,ia=fr===void 0?!1:fr,_r=ce.noStorage,Hn=_r===void 0?!1:_r,Kn=ce.showNullButton,Rt=Kn===void 0?!1:Kn,nt=ce.hidetoolBar,Pr=nt===void 0?!1:nt,mn=ce.fullScreen,Qt=mn===void 0?!1:mn,Tt=ce.onBlur,gr=ce.onCMBeforeChange,Mr=ce.onFullScreen,pn=ce.className,Ne=pn===void 0?"":pn,ct=ce.disablePaste,Gn=ct===void 0?!1:ct,gn=ce.placeholder,vn=gn===void 0?"":gn,Zr=ce.values,yn=Zr===void 0?"":Zr,ht=Object(y.useState)(null),_i=Object(B.a)(ht,2),je=_i[0],bn=_i[1],hr=Object(y.useState)(_e),zn=Object(B.a)(hr,2),Qr=zn[0],vr=zn[1],Vn=Object(y.useState)(Ut),Xn=Object(B.a)(Vn,2),yr=Xn[0],Yn=Xn[1],Ai=Object(y.useState)(Qt),$n=Object(B.a)(Ai,2),br=$n[0],Li=$n[1],aa=Object(y.useState)(""),Jn=Object(B.a)(aa,2),$t=Jn[0],Wr=Jn[1],oa=Object(y.useState)(0),qr=Object(B.a)(oa,2),Er=qr[0],Zn=qr[1],sa=Object(y.useState)(dt),Di=Object(B.a)(sa,2),Oi=Di[0],En=Di[1],Ri=Object(y.useState)(!1),Pi=Object(B.a)(Ri,2),la=Pi[0],xn=Pi[1],en=Object(y.useRef)(Object(ke.a)()),tn=Object(y.useRef)(!1),Tn=Object(y.useRef)(),kr=Object(y.useRef)(),Ir=Object(y.useRef)(),Ur=Object(y.useRef)(),Sn=Object(y.useRef)(),Mi=function(){var it=Object(R.a)(L.a.mark(function ft(){var lt,gt;return L.a.wrap(function(At){for(;;)switch(At.prev=At.next){case 0:return At.next=2,Object(Pe.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:en.current}});case 2:gt=At.sent,gt!=null&&(lt=gt.attachments)!==null&<!==void 0&<.length&&(console.log("cm:",je,kr),gt.attachments.map(function(yt){yt.content_type.indexOf("image")>-1?je.replaceSelection("![,](/api/attachments/".concat(yt.id,"?type=").concat(yt.content_type,")")):yt.content_type.indexOf("video")>-1?je.replaceSelection('')):yt.content_type.indexOf("pdf")>-1?je.replaceSelection('
    ').concat(yt.name,"")):je.replaceSelection("[".concat(yt.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(yt.id,"?type=").concat(yt.content_type,")"))}));case 4:case"end":return At.stop()}},ft)}));return function(){return it.apply(this,arguments)}}();Object(y.useEffect)(function(){vr(yn),je==null||je.setValue(yn)},[yn]),Object(y.useEffect)(function(){Mr==null||Mr(br)},[br]),Object(y.useEffect)(function(){if(kr.current){var it=C.a.fromTextArea(kr.current,{mode:Rr,lineNumbers:!Ct,lineWrapping:!0,value:_e,autoCloseTags:!0,autoCloseBrackets:!0});Bt&&it.focus();function ft(lt,gt){if(Gn){gt.preventDefault();return}var xt=gt.clipboardData;if(xt){var At=xt.types.toString(),yt=xt.items;if(At==="Files"||xt.types.indexOf("Files")>-1){if(gt.preventDefault(),Rr=="stex")return;try{var Ft,qt=yt[1];((Ft=yt[0])===null||Ft===void 0?void 0:Ft.kind)==="file"&&(qt=yt[0]);var vt=qt.getAsFile(),Fr=vt.name.split(".").pop();J(vt,function(St){if(St.id){var er,Vt,mr;(vt==null||((er=vt.type)===null||er===void 0)?void 0:er.indexOf("image"))>-1?it.replaceSelection("![,](/api/attachments/".concat(St.id,"?type=").concat(St.content_type,")")):(vt==null||((Vt=vt.type)===null||Vt===void 0)?void 0:Vt.indexOf("video"))>-1?it.replaceSelection('')):(vt==null||((mr=vt.type)===null||mr===void 0)?void 0:mr.indexOf("pdf"))>-1?it.replaceSelection('').concat(vt.name,"")):$.includes(Fr)?it.replaceSelection('').concat(vt.name,"")):it.replaceSelection("[".concat(vt.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(St.id,"?type=").concat(St.content_type,")"))}else(St==null?void 0:St.status)===401&&(document.location.href="/user/login")})}catch(St){I.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return it.on("paste",ft),it.on("dragleave",function(lt,gt){Ir.current.classList.remove("mouse-hover-md")}),it.on("dragover",function(lt,gt){Ir.current.classList.add("mouse-hover-md")}),it.on("drop",function(lt,gt){Ir.current.classList.add("mouse-hover-md");var xt;if(xt=gt.dataTransfer.files,xt.length>0){gt.preventDefault(),gt.stopPropagation();for(var At=function(qt){var vt=xt[qt],Fr=vt.name.split(".").pop();J(vt,function(St){if(St.id){var er,Vt,mr;(vt==null||((er=vt.type)===null||er===void 0)?void 0:er.indexOf("image"))>-1?it.replaceSelection("![,](/api/attachments/".concat(St.id,"?type=").concat(St.content_type,")")):(vt==null||((Vt=vt.type)===null||Vt===void 0)?void 0:Vt.indexOf("video"))>-1?it.replaceSelection('')):(vt==null||((mr=vt.type)===null||mr===void 0)?void 0:mr.indexOf("pdf"))>-1?it.replaceSelection('').concat(vt.name,"")):$.includes(Fr)?it.replaceSelection('').concat(vt.name,"")):it.replaceSelection("[".concat(vt.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(St.id,"?type=").concat(St.content_type,")"))}else(St==null?void 0:St.status)===401&&(document.location.href="/user/login")})},yt=0;yt0||yt.target.offsetWidth>0)&&(ur(),je.setSize("100%","100%"),je.refresh())}}catch(Ft){xt.e(Ft)}finally{xt.f()}});return lt.observe(kr.current.parentElement),lt}if(je){var ft=it();return function(){ft.unobserve(kr.current.parentElement)}}},[je,ur]),Object(y.useEffect)(function(){if(je){for(var it=[],ft=function(){var yt=gt[lt];xt=Object(B.a)(yt,2);var Ft=xt[0],qt=xt[1],vt=Object(U.a)({},Ft,function(){ki(qt)});it.push(vt),je.addKeyMap(vt)},lt=0,gt=Object.entries(Z);lt0){var it=new Date().getTime(),ft=window.sessionStorage.getItem(pr);it>=Er+Ke&&(!ft||ft!==Qr)&&(window.sessionStorage.setItem(pr,Qr),xn(!0))}},Ke),Object(y.useEffect)(function(){Yn(Ut)},[je,Ut]),Object(y.useEffect)(function(){je&&(Bt&&je.focus())},[je,Bt]),Object(y.useEffect)(function(){if(yr&&je){var it=je.getScrollerElement();function ft(lt){var gt=lt.target;if(Sn.current){var xt=gt.scrollTop/gt.scrollHeight;Sn.current.scrollTop=Sn.current.scrollHeight*xt}}return it.addEventListener("scroll",ft),function(){it.removeEventListener("scroll",ft)}}},[je,yr]),Object(y.useEffect)(function(){if(je&&gr){function it(ft,lt){gr(ft,lt)}return je.on("beforeChange",it),function(){je.off("beforeChange",it)}}},[je,gr]),Object(y.useEffect)(function(){if(je&&Tt){function it(){Tt(je.getValue())}return je.on("blur",it),function(){je.off("blur",it)}}},[je,Tt]),Object(y.useEffect)(function(){if(je){function it(ft){var lt=ft.getValue();vr(lt),Zn(new Date().getTime()),ft.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),Ue&&Ue(lt)}return je.on("change",it),function(){je.off("change",it)}}},[je,Ue]),Object(y.useEffect)(function(){je&&(_e==null?(je.setValue(""),vr("")):_e!==je.getValue()&&(je.setValue(_e),vr(_e),je.setCursor(je.lineCount(),0)))},[je,_e]);var ki=Object(y.useCallback)(function(it){var ft=je.getCursor(),lt=je.getSelection(),gt=lt.split(` `);switch(it){case"bold":return je.replaceSelection("**"+lt+"**"),lt===""&&je.setCursor(ft.line,ft.ch+2),je.focus();case"italic":return je.replaceSelection("*"+lt+"*"),lt===""&&je.setCursor(ft.line,ft.ch+1),je.focus();case"code":return je.replaceSelection("`"+lt+"`"),lt===""&&je.setCursor(ft.line,ft.ch+1),je.focus();case"inline-latex":return je.replaceSelection("`$$"+lt+"$$`"),lt===""&&je.setCursor(ft.line,ft.ch+3),je.focus();case"latex":return je.replaceSelection("```latex\n"+lt+"\n```"),je.setCursor(ft.line+1,lt.length+1),je.focus();case"line-break":return je.replaceSelection(`
    `),je.focus();case"list-ul":return lt===""?je.replaceSelection("- "+lt):je.replaceSelection(gt.map(function(xt){return xt===""?"":"- ".concat(xt)}).join(` `)),je.focus();case"list-ol":return lt===""?je.replaceSelection("1. "+lt):je.replaceSelection(gt.map(function(xt,At){return xt===""?"":"".concat(At+1,". ").concat(xt)}).join(` `)),je.focus();case"add-null-ch":return lt===""&&je.setCursor(ft.line,ft.ch+1),je.replaceSelection(Le),je.focus();case"inster-template-1":return lt===""&&je.setCursor(ft.line,ft.ch),je.replaceSelection(Ie),je.focus();case"eraser":return je.setValue(""),je.focus();case"trigger-watch":return Yn(!yr),je.focus();case"trigger-full-screen":return Li(!br),je.focus();case Oe:Wr(Oe);return;case Ge:Wr(Ge);return;case Re:Wr(Re);return;case $e:Wr($e);return;default:throw new Error}},[je,yr,br]),wn=Object(y.useCallback)(function(it){Wr("");switch($t){case Oe:var ft=it.title,lt=it.link;return je.replaceSelection("[".concat(ft,"](").concat(lt,")")),je.focus();case Ge:var gt=it.language,xt=it.content;return je.replaceSelection(["```"+gt,xt,"```"].join(` `)),je.focus();case Re:var At=it.src,yt=it.alt;return yt?je.replaceSelection("![ ".concat(yt," ]( ").concat(At,' "').concat(yt,'" )')):je.replaceSelection("![,](".concat(At,")")),je.focus();case $e:for(var Ft=it.row,qt=it.col,vt=it.align,Fr=` `,St=0;St300&&(Ft=300);var qt=dt+Ft+"px";En(qt)}}return it.addEventListener("mousedown",gt),document.addEventListener("mousemove",At),document.addEventListener("mouseup",xt),function(){it.removeEventListener("mousedown",gt),document.removeEventListener("mousemove",At),document.removeEventListener("mouseup",xt)}}},[je,Ur]),Object(y.useEffect)(function(){En(dt)},[dt]);var Ar=pe(Ve),qn=pe(Oi),xr={width:Ar,height:qn},ei=Object(y.useMemo)(function(){if(Er){var it=new Date(Er),ft=it.getHours(),lt=it.getMinutes(),gt=it.getSeconds();return ft=ft<10?"0"+ft:ft,lt=lt<10?"0"+lt:lt,gt=gt<10?"0"+gt:gt,"".concat(ft,":").concat(lt,":").concat(gt)}return 0},[Er]);function Ii(){window.sessionStorage.removeItem(pr),xn(!1),Zn(0)}function rn(){xn(!1),Zn(0),je.setValue(window.sessionStorage.getItem(pr))}function ua(it,ft){var lt=je.getValue();lt=lt.replace(it,ft),vr(lt),je==null||je.setValue(lt)}return x.a.createElement(y.Fragment,null,x.a.createElement("div",{className:"markdown-editor-wrapper",ref:Ir},x.a.createElement("div",{className:"markdown-editor-container ".concat(Ne," ").concat(yr?"on-preview":""," ").concat(Ct?"mini":""," ").concat(br?"full-screen":""),style:xr},x.a.createElement(E,{insertTemp:Et,watch:yr,fullScreen:br,showNullButton:Rt,onActionCallback:ki,hidetoolBar:Pr,uuid:en.current,setOpenPhones:function(){tn.current=!0}}),x.a.createElement("div",{className:"markdown-editor-body"},x.a.createElement("div",{className:"codemirror-container"},x.a.createElement("textarea",{ref:kr,placeholder:vn})),yr?x.a.createElement("div",{ref:Sn,className:"preview-container"},Rr==="stex"&&x.a.createElement(_,{value:Qr}),Rr!=="stex"&&x.a.createElement(f.a,{edit:!0,value:Qr,replaces:ua})):null))),ia?x.a.createElement("a",{ref:Ur,className:"editor-resize"}):null,x.a.createElement(M.a,null,te[$t]?x.a.createElement(V.a,{centered:!0,title:te[$t],visible:!0,onCancel:Hr,footer:null,className:"markdown-popup-form"},Qn):null))}},SJMd:function(st,ze){/** * @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 q,re,V,A=!1,G,I;window.PR_SHOULD_USE_CONTINUATION=!0;var R,B;(function(){var U=window,k=["break,continue,do,else,for,if,return,while"],L=[k,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,restrict,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],y=[L,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],x=[y,"alignas,alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,noexcept,noreturn,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],O=[y,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],C=[y,"abstract,add,alias,as,ascending,async,await,base,bool,by,byte,checked,decimal,delegate,descending,dynamic,event,finally,fixed,foreach,from,get,global,group,implicit,in,interface,internal,into,is,join,let,lock,null,object,out,override,orderby,params,partial,readonly,ref,remove,sbyte,sealed,select,set,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,value,var,virtual,where,yield"],T="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",g=[y,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],d="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",o=[k,"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"],u=[k,"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"],s=[k,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],w=[x,C,O,g,d,o,u,s],p=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,f="str",_="kwd",b="com",h="typ",c="lit",l="pun",a="pln",v="tag",m="dec",E="src",M="atn",F="atv",j="nocode",W="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function D(ye){for(var we=0,De=!1,Pe=!1,ke=0,Oe=ye.length;ke122||($<65||de>90||Ze.push([Math.max(65,de)|32,Math.min($,90)|32]),$<97||de>122||Ze.push([Math.max(97,de)&~32,Math.min($,122)&~32]))}}Ze.sort(function(ce,Ae){return ce[0]-Ae[0]||Ae[1]-ce[1]});for(var Z=[],te=[],Ie=0;Iele[0]&&(le[1]+1>le[0]&&Le.push("-"),Le.push(Be(le[1])))}return Le.push("]"),Le.join("")}function rt(qe){for(var Se=qe.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")),Ze=Se.length,Ke=[],Le=0,Ie=0;Le=2&&de==="["?Se[Le]=He(pe):de!=="\\"&&(Se[Le]=pe.replace(/[a-zA-Z]/g,function(te){var le=te.charCodeAt(0);return"["+String.fromCharCode(le&~32,le|32)+"]"}))}return Se.join("")}for(var Je=[],ke=0,Oe=ye.length;ke=0;)De[Je.charAt(qe)]=rt;var Se=rt[1],Ze=""+Se;$e.hasOwnProperty(Ze)||(Ge.push(Se),$e[Ze]=null)}Ge.push(/[\0-\uffff]/),Pe=D(Ge)})();var ke=we.length,Oe=function(Re){for(var Ge=Re.sourceCode,$e=Re.basePos,Be=Re.sourceNode,He=[$e,a],rt=0,Je=Ge.match(Pe)||[],qe={},Se=0,Ze=Je.length;Se=5&&Le.substring(0,5)==="lang-",pe&&!(Ie&&typeof Ie[1]=="string")&&(pe=!1,Le=E),pe||(qe[Ke]=Le)}var $=rt;if(rt+=Ke.length,!pe)He.push($e+$,Le);else{var Z=Ie[1],te=Ke.indexOf(Z),le=te+Z.length;Ie[2]&&(le=Ke.length-Ie[2].length,te=le-Z.length);var ce=Le.substring(5);H(Be,$e+$,Ke.substring(0,te),Oe,He),H(Be,$e+$+te,Z,me(ce,Z),He),H(Be,$e+$+le,Ke.substring(le),Oe,He)}}Re.decorations=He};return Oe}function Te(ye){var we=[],De=[];ye.tripleQuotedStrings?we.push([f,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):ye.multiLineStrings?we.push([f,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):we.push([f,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),ye.verbatimStrings&&De.push([f,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Pe=ye.hashComments;Pe&&(ye.cStyleComments?(Pe>1?we.push([b,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):we.push([b,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),De.push([f,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):we.push([b,/^#[^\r\n]*/,null,"#"])),ye.cStyleComments&&(De.push([b,/^\/\/[^\r\n]*/,null]),De.push([b,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var ke=ye.regexLiterals;if(ke){var Oe=ke>1?"":` \r`,Re=Oe?".":"[\\S\\s]",Ge="/(?=[^/*"+Oe+"])(?:[^/\\x5B\\x5C"+Oe+"]|\\x5C"+Re+"|\\x5B(?:[^\\x5C\\x5D"+Oe+"]|\\x5C"+Re+")*(?:\\x5D|$))+/";De.push(["lang-regex",RegExp("^"+W+"("+Ge+")")])}var $e=ye.types;$e&&De.push([h,$e]);var Be=(""+ye.keywords).replace(/^ | $/g,"");Be.length&&De.push([_,new RegExp("^(?:"+Be.replace(/[\s,]+/g,"|")+")\\b"),null]),we.push([a,/^\s+/,null,` \r \xA0`]);var He="^.[^\\s\\w.$@'\"`/\\\\]*";return ye.regexLiterals&&(He+="(?!s*/)"),De.push([c,/^@[a-z_$][a-z_$@0-9]*/i,null],[h,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[a,/^[a-z_$][a-z_$@0-9]*/i,null],[c,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[a,/^\\[\s\S]?/,null],[l,new RegExp(He),null]),oe(we,De)}var ve=Te({keywords:w,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function ge(ye,we,De){for(var Pe=/(?:^|\s)nocode(?:\s|$)/,ke=/\r\n?|\n/,Oe=ye.ownerDocument,Re=Oe.createElement("li");ye.firstChild;)Re.appendChild(ye.firstChild);var Ge=[Re];function $e(Se){var Ze=Se.nodeType;if(Ze==1&&!Pe.test(Se.className))if(Se.nodeName==="br")Be(Se),Se.parentNode&&Se.parentNode.removeChild(Se);else for(var Ke=Se.firstChild;Ke;Ke=Ke.nextSibling)$e(Ke);else if((Ze==3||Ze==4)&&De){var Le=Se.nodeValue,Ie=Le.match(ke);if(Ie){var pe=Le.substring(0,Ie.index);Se.nodeValue=pe;var se=Le.substring(Ie.index+Ie[0].length);if(se){var de=Se.parentNode;de.insertBefore(Oe.createTextNode(se),Se.nextSibling)}Be(Se),pe||Se.parentNode.removeChild(Se)}}}function Be(Se){for(;!Se.nextSibling;)if(Se=Se.parentNode,!Se)return;function Ze(Ie,pe){var se=pe?Ie.cloneNode(!1):Ie,de=Ie.parentNode;if(de){var $=Ze(de,1),Z=Ie.nextSibling;$.appendChild(se);for(var te=Z;te;te=Z)Z=te.nextSibling,$.appendChild(te)}return se}for(var Ke=Ze(Se.nextSibling,0),Le;(Le=Ke.parentNode)&&Le.nodeType===1;)Ke=Le;Ge.push(Ke)}for(var He=0;He=de&&($e+=2),Oe>=$&&(rt+=2)}}finally{Le&&(Le.style.display=Ie)}}var fe={};function ae(ye,we){for(var De=we.length;--De>=0;){var Pe=we[De];fe.hasOwnProperty(Pe)?U.console&&console.warn("cannot override language handler %s",Pe):fe[Pe]=ye}}function me(ye,we){return ye&&fe.hasOwnProperty(ye)||(ye=/^\s*]*(?:>|$)/],[b,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[l,/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),ae(oe([[a,/^[\s]+/,null,` \r `],[F,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[v,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[M,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[l,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]),ae(oe([],[[F,/^[\s\S]+/]]),["uq.val"]),ae(Te({keywords:x,hashComments:!0,cStyleComments:!0,types:p}),["c","cc","cpp","cxx","cyc","m"]),ae(Te({keywords:"null,true,false"}),["json"]),ae(Te({keywords:C,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:p}),["cs"]),ae(Te({keywords:O,cStyleComments:!0}),["java"]),ae(Te({keywords:s,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),ae(Te({keywords:o,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),ae(Te({keywords:d,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),ae(Te({keywords:u,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),ae(Te({keywords:g,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),ae(Te({keywords:T,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),ae(oe([],[[f,/^[\s\S]+/]]),["regex"]);function J(ye){var we=ye.langExtension;try{var De=P(ye.sourceNode,ye.pre),Pe=De.sourceCode;ye.sourceCode=Pe,ye.spans=De.spans,ye.basePos=0,me(we,Pe)(ye),he(ye)}catch(ke){U.console&&console.log(ke&&ke.stack||ke)}}function ne(ye,we,De){var Pe=De||!1,ke=we||null,Oe=document.createElement("div");Oe.innerHTML="
    "+ye+"
    ",Oe=Oe.firstChild,Pe&&ge(Oe,Pe,!0);var Re={langExtension:ke,numberLines:Pe,sourceNode:Oe,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return J(Re),Oe.innerHTML}function Q(ye,we){var De=we||document.body,Pe=De.ownerDocument||document;function ke(se){return De.getElementsByTagName(se)}for(var Oe=[ke("pre"),ke("code"),ke("xmp")],Re=[],Ge=0;Ge=15&&(x=!1,k=!0);var f=u&&(L||x&&(p==null||p<12.11)),_=A||B&&U>=9;function b(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var h=function(e,t){var n=e.className,r=b(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 c(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function l(e,t){return c(e).appendChild(t)}function a(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 S=0;S=t)return N+(t-S);N+=K-S,N+=n-N%n,S=K+1}}var Y=function(){this.id=null,this.f=null,this.time=0,this.handler=D(this.onTimeout,this)};Y.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},Y.prototype.set=function(e,t){this.f=t;var n=+new Date+e;(!this.id||n=t)return r+Math.min(N,t-i);if(i+=S-r,i+=n-i%n,r=S+1,i>=t)return r}}var ae=[""];function me(e){for(;ae.length<=e;)ae.push(J(ae)+" ");return ae[e]}function J(e){return e[e.length-1]}function ne(e,t){for(var n=[],r=0;r"\x80"&&(e.toUpperCase()!=e.toLowerCase()||ye.test(e))}function De(e,t){return t?t.source.indexOf("\\w")>-1&&we(e)?!0:t.test(e):we(e)}function Pe(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var ke=/[\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 Oe(e){return e.charCodeAt(0)>=768&&ke.test(e)}function Re(e,t,n){for(;(n<0?t>0:tn?-1:1;;){if(t==n)return t;var i=(t+n)/2,S=r<0?Math.ceil(i):Math.floor(i);if(S==t)return e(S)?t:n;e(S)?n=S:t=S+r}}function $e(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var i=!1,S=0;St||t==n&&N.to==t)&&(r(Math.max(N.from,t),Math.min(N.to,n),N.level==1?"rtl":"ltr",S),i=!0)}i||r(t,n,"ltr")}var Be=null;function He(e,t,n){var r;Be=null;for(var i=0;it)return i;S.to==t&&(S.from!=S.to&&n=="before"?r=i:Be=i),S.from==t&&(S.from!=S.to&&n!="before"?r=i:Be=i)}return r!=null?r:Be}var rt=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n(X){return X<=247?e.charAt(X):1424<=X&&X<=1524?"R":1536<=X&&X<=1785?t.charAt(X-1536):1774<=X&&X<=2220?"r":8192<=X&&X<=8203?"w":X==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,S=/[LRr]/,N=/[Lb1n]/,K=/[1n]/;function z(X,ie,ue){this.level=X,this.from=ie,this.to=ue}return function(X,ie){var ue=ie=="ltr"?"L":"R";if(X.length==0||ie=="ltr"&&!r.test(X))return!1;for(var xe=X.length,be=[],Me=0;Me-1&&(r[t]=i.slice(0,S).concat(i.slice(S+1)))}}}function Le(e,t){var n=Ze(e,t);if(!n.length)return;for(var r=Array.prototype.slice.call(arguments,2),i=0;i0}function de(e){e.prototype.on=function(t,n){Se(this,t,n)},e.prototype.off=function(t,n){Ke(this,t,n)}}function $(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Z(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function te(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function le(e){$(e),Z(e)}function ce(e){return e.target||e.srcElement}function Ae(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),u&&e.ctrlKey&&t==1&&(t=3),t}var _e=function(){if(B&&U<9)return!1;var e=a("div");return"draggable"in e||"dragDrop"in e}(),Ue;function Qe(e){if(Ue==null){var t=a("span","\u200B");l(e,a("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(Ue=t.offsetWidth<=1&&t.offsetHeight>2&&!(B&&U<8))}var n=Ue?a("span","\u200B"):a("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var Ve;function mt(e){if(Ve!=null)return Ve;var t=l(e,document.createTextNode("A\u062EA")),n=m(t,0,1).getBoundingClientRect(),r=m(t,1,2).getBoundingClientRect();return c(e),!n||n.left==n.right?!1:Ve=r.right-n.right<3}var dt=` 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 S=e.slice(t,e.charAt(i-1)=="\r"?i-1:i),N=S.indexOf("\r");N!=-1?(n.push(S.slice(0,N)),t+=N+1):(n.push(S),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},ot=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},Ct=function(){var e=a("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),bt=null;function Bt(e){if(bt!=null)return bt;var t=l(e,a("span","x")),n=t.getBoundingClientRect(),r=m(t,0,1).getBoundingClientRect();return bt=Math.abs(n.left-r.left)>1}var Ut={},Et={};function Cr(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Ut[e]=t}function Rr(e,t){Et[e]=t}function lr(e){if(typeof e=="string"&&Et.hasOwnProperty(e))e=Et[e];else if(e&&typeof e.name=="string"&&Et.hasOwnProperty(e.name)){var t=Et[e.name];typeof t=="string"&&(t={name:t}),e=Ce(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return lr("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return lr("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function pr(e,t){t=lr(t);var n=Ut[t.name];if(!n)return pr(e,"text/plain");var r=n(e,t);if(fr.hasOwnProperty(t.name)){var i=fr[t.name];for(var S in i){if(!i.hasOwnProperty(S))continue;r.hasOwnProperty(S)&&(r["_"+S]=r[S]),r[S]=i[S]}}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var N in t.modeProps)r[N]=t.modeProps[N];return r}var fr={};function ia(e,t){var n=fr.hasOwnProperty(e)?fr[e]:fr[e]={};P(t,n)}function _r(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 Hn(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 Kn(e,t,n){return e.startState?e.startState(t,n):!0}var Rt=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};Rt.prototype.eol=function(){return this.pos>=this.string.length},Rt.prototype.sol=function(){return this.pos==this.lineStart},Rt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Rt.prototype.next=function(){if(this.post},Rt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Rt.prototype.skipToEnd=function(){this.pos=this.string.length},Rt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Rt.prototype.backUp=function(e){this.pos-=e},Rt.prototype.column=function(){return this.lastColumnPos0?null:(S&&t!==!1&&(this.pos+=S[0].length),S)}},Rt.prototype.current=function(){return this.string.slice(this.start,this.pos)},Rt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Rt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Rt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function nt(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],S=i.chunkSize();if(t=e.first&&tn?Ne(n,nt(e,n).text.length):_i(t,nt(e,t.line).text.length)}function _i(e,t){var n=e.ch;return n==null||n>t?Ne(e.line,t):n<0?Ne(e.line,0):e}function je(e,t){for(var n=[],r=0;rthis.maxLookAhead&&(this.maxLookAhead=e),t},hr.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}},hr.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},hr.fromSaved=function(e,t,n){return t instanceof bn?new hr(e,_r(e.mode,t.state),n,t.lookAhead):new hr(e,_r(e.mode,t),n)},hr.prototype.save=function(e){var t=e!==!1?_r(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new bn(t,this.maxLookAhead):t};function zn(e,t,n,r){var i=[e.state.modeGen],S={};br(e,t.text,e.doc.mode,n,function(X,ie){return i.push(X,ie)},S,r);for(var N=n.state,K=function(X){n.baseTokens=i;var ie=e.state.overlays[X],ue=1,xe=0;n.state=!0,br(e,t.text,ie.mode,n,function(be,Me){for(var Fe=ue;xebe&&i.splice(ue,1,be,i[ue+1],We),ue+=2,xe=Math.min(be,We)}if(!Me)return;if(ie.opaque)i.splice(Fe,ue-Fe,be,"overlay "+Me),ue=Fe+2;else for(;Fee.options.maxHighlightLength&&_r(e.doc.mode,r.state),S=zn(e,t,r);i&&(r.state=i),t.stateAfter=r.save(!i),t.styles=S.styles,S.classes?t.styleClasses=S.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 vr(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new hr(r,!0,t);var S=Li(e,t,n),N=S>r.first&&nt(r,S-1).stateAfter,K=N?hr.fromSaved(r,N,S):new hr(r,Kn(r.mode),S);return r.iter(S,t,function(z){Vn(e,z.text,K);var X=K.line;z.stateAfter=X==t-1||X%5==0||X>=i.viewFrom&&Xt.start)return S}throw new Error("Mode "+e.name+" failed to advance stream.")}var Yn=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function Ai(e,t,n,r){var i=e.doc,S=i.mode,N;t=ht(i,t);var K=nt(i,t.line),z=vr(e,t.line,n),X=new Rt(K.text,e.options.tabSize,z),ie;for(r&&(ie=[]);(r||X.pose.options.maxHighlightLength?(K=!1,N&&Vn(e,t,r,ie.pos),ie.pos=t.length,ue=null):ue=$n(yr(n,ie,r.state,xe),S),xe){var be=xe[0].name;be&&(ue="m-"+(ue?be+" "+ue:be))}if(!K||X!=ue){for(;zN;--K){if(K<=S.first)return S.first;var z=nt(S,K-1),X=z.stateAfter;if(X&&(!n||K+(X instanceof bn?X.lookAhead:0)<=S.modeFrontier))return K;var ie=H(z.text,null,e.options.tabSize);(i==null||r>ie)&&(i=K-1,r=ie)}return i}function aa(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),e.highlightFrontiern;r--){var i=nt(e,r).stateAfter;if(i&&(!(i instanceof bn)||r+i.lookAhead=t:S.to>t);(r||(r=[])).push(new qr(N,S.from,z?null:S.to))}}return r}function Oi(e,t,n){var r;if(e)for(var i=0;i=t:S.to>t);if(K||S.from==t&&N.type=="bookmark"&&(!n||S.marker.insertLeft)){var z=S.from==null||(N.inclusiveLeft?S.from<=t:S.from0&&K)for(var tt=0;tt0)continue;var ie=[z,1],ue=ct(X.from,K.from),xe=ct(X.to,K.to);(ue<0||!N.inclusiveLeft&&!ue)&&ie.push({from:X.from,to:K.from}),(xe>0||!N.inclusiveRight&&!xe)&&ie.push({from:K.to,to:X.to}),i.splice.apply(i,ie),z+=ie.length-3}return i}function la(e){var t=e.markedSpans;if(!t)return;for(var n=0;nt)&&(!r||Tn(r,S.marker)<0)&&(r=S.marker)}return r}function Mi(e,t,n,r,i){var S=nt(e,t),N=$t&&S.markedSpans;if(N)for(var K=0;K=0&&ue<=0||ie<=0&&ue>=0)continue;if(ie<=0&&(z.marker.inclusiveRight&&i.inclusiveLeft?ct(X.to,n)>=0:ct(X.to,n)>0)||ie>=0&&(z.marker.inclusiveRight&&i.inclusiveLeft?ct(X.from,r)<=0:ct(X.from,r)<0))return!0}}function ur(e){for(var t;t=Ir(e);)e=t.find(-1,!0).line;return e}function ki(e){for(var t;t=Ur(e);)e=t.find(1,!0).line;return e}function wn(e){for(var t,n;t=Ur(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function Qn(e,t){var n=nt(e,t),r=ur(n);return n==r?t:Tt(r)}function Hr(e,t){if(t>e.lastLine())return t;var n=nt(e,t),r;if(!Ar(e,n))return t;for(;r=Ur(n);)n=r.find(1,!0).line;return Tt(n)+1}function Ar(e,t){var n=$t&&t.markedSpans;if(n)for(var r=void 0,i=0;it.maxLineLength&&(t.maxLineLength=i,t.maxLine=r)})}var rn=function(e,t,n){this.text=e,xn(this,t),this.height=n?n(this):1};rn.prototype.lineNo=function(){return Tt(this)},de(rn);function ua(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),la(e),xn(e,n);var i=r?r(e):1;i!=e.height&&Qt(e,i)}function it(e){e.parent=null,la(e)}var ft={},lt={};function gt(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?lt:ft;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function xt(e,t){var n=v("span",null,null,k?"padding-right: .1px":null),r={pre:v("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 S=i?t.rest[i-1]:t.line,N=void 0;r.pos=0,r.addToken=yt,mt(e.display.measure)&&(N=Je(S,e.doc.direction))&&(r.addToken=qt(r.addToken,N)),r.map=[];var K=t!=e.display.externalMeasured&&Tt(S);Fr(S,r,Qr(e,S,K)),S.styleClasses&&(S.styleClasses.bgClass&&(r.bgClass=j(S.styleClasses.bgClass,r.bgClass||"")),S.styleClasses.textClass&&(r.textClass=j(S.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(Qe(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(k){var z=r.content.lastChild;(/\bcm-tab\b/.test(z.className)||z.querySelector&&z.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return Le(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=j(r.pre.className,r.textClass||"")),r}function At(e){var t=a("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function yt(e,t,n,r,i,S,N){if(!t)return;var K=e.splitSpaces?Ft(t,e.trailingSpace):t,z=e.cm.state.specialChars,X=!1,ie;if(!z.test(t))e.col+=t.length,ie=document.createTextNode(K),e.map.push(e.pos,e.pos+t.length,ie),B&&U<9&&(X=!0),e.pos+=t.length;else{ie=document.createDocumentFragment();for(var ue=0;;){z.lastIndex=ue;var xe=z.exec(t),be=xe?xe.index-ue:t.length-ue;if(be){var Me=document.createTextNode(K.slice(ue,ue+be));B&&U<9?ie.appendChild(a("span",[Me])):ie.appendChild(Me),e.map.push(e.pos,e.pos+be,Me),e.col+=be,e.pos+=be}if(!xe)break;ue+=be+1;var Fe=void 0;if(xe[0]==" "){var We=e.cm.options.tabSize,Xe=We-e.col%We;Fe=ie.appendChild(a("span",me(Xe),"cm-tab")),Fe.setAttribute("role","presentation"),Fe.setAttribute("cm-text"," "),e.col+=Xe}else xe[0]=="\r"||xe[0]==` `?(Fe=ie.appendChild(a("span",xe[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Fe.setAttribute("cm-text",xe[0]),e.col+=1):(Fe=e.cm.options.specialCharPlaceholder(xe[0]),Fe.setAttribute("cm-text",xe[0]),B&&U<9?ie.appendChild(a("span",[Fe])):ie.appendChild(Fe),e.col+=1);e.map.push(e.pos,e.pos+1,Fe),e.pos++}}if(e.trailingSpace=K.charCodeAt(t.length-1)==32,n||r||i||X||S||N){var et=n||"";r&&(et+=r),i&&(et+=i);var Ye=a("span",[ie],et,S);if(N)for(var tt in N)N.hasOwnProperty(tt)&&tt!="style"&&tt!="class"&&Ye.setAttribute(tt,N[tt]);return e.content.appendChild(Ye)}e.content.appendChild(ie)}function Ft(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",i=0;iX&&ue.from<=X);xe++);if(ue.to>=ie)return e(n,r,i,S,N,K,z);e(n,r.slice(0,ue.to-X),i,S,null,K,z),S=null,r=r.slice(ue.to-X),X=ue.to}}}function vt(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 Fr(e,t,n){var r=e.markedSpans,i=e.text,S=0;if(!r){for(var N=1;Nz||pt.collapsed&&at.to==z&&at.from==z)){if(at.to!=null&&at.to!=z&&be>at.to&&(be=at.to,Fe=""),pt.className&&(Me+=" "+pt.className),pt.css&&(xe=(xe?xe+";":"")+pt.css),pt.startStyle&&at.from==z&&(We+=" "+pt.startStyle),pt.endStyle&&at.to==be&&(tt||(tt=[])).push(pt.endStyle,at.to),pt.title&&((et||(et={})).title=pt.title),pt.attributes)for(var Lt in pt.attributes)(et||(et={}))[Lt]=pt.attributes[Lt];pt.collapsed&&(!Xe||Tn(Xe.marker,pt)<0)&&(Xe=at)}else at.from>z&&be>at.from&&(be=at.from)}if(tt)for(var Ht=0;Ht=K)break;for(var sr=Math.min(K,be);;){if(ie){var nr=z+ie.length;if(!Xe){var kt=nr>sr?ie.slice(0,sr-z):ie;t.addToken(t,kt,ue?ue+Me:Me,We,z+kt.length==be?Fe:"",xe,et)}if(nr>=sr){ie=ie.slice(sr-z),z=sr;break}z=nr,We=""}ie=i.slice(S,S=n[X++]),ue=gt(n[X++],t.cm.options)}}}function St(e,t,n){this.line=t,this.rest=wn(t),this.size=this.rest?Tt(J(this.rest))-n+1:1,this.node=this.text=null,this.hidden=Ar(e,t)}function er(e,t,n){for(var r=[],i,S=t;S2&&S.push((z.bottom+X.top)/2-n.top)}}S.push(n.bottom-n.top)}}function eo(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var r=0;rn)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function Bs(e,t){t=ur(t);var n=Tt(t),r=e.display.externalMeasured=new St(e.doc,t,n);r.lineN=n;var i=r.built=xt(e,r);return r.text=i.pre,l(e.display.lineMeasure,i.pre),r}function to(e,t,n,r){return Dr(e,Cn(e,t),n,r)}function ha(e,t){if(t>=e.display.viewFrom&&t=n.lineN&&tt)&&(S=z-K,i=S-1,t>=z&&(N="right")),i!=null){if(r=e[X+2],K==z&&n==(r.insertLeft?"left":"right")&&(N=n),n=="left"&&i==0)for(;X&&e[X-2]==e[X-3]&&e[X-1].insertLeft;)r=e[(X-=3)+2],N="left";if(n=="right"&&i==z-K)for(;X=0&&!((n=e[i]).left!=n.right);i--);return n}function Ws(e,t,n,r){var i=no(t.map,n,r),S=i.node,N=i.start,K=i.end,z=i.collapse,X;if(S.nodeType==3){for(var ie=0;ie<4;ie++){for(;N&&Oe(t.line.text.charAt(i.coverStart+N));)--N;for(;i.coverStart+K0&&(z=r="right");var ue;e.options.lineWrapping&&(ue=S.getClientRects()).length>1?X=ue[r=="right"?ue.length-1:0]:X=S.getBoundingClientRect()}if(B&&U<9&&!N&&(!X||!X.left&&!X.right)){var xe=S.parentNode.getClientRects()[0];xe?X={left:xe.left,right:xe.left+An(e.display),top:xe.top,bottom:xe.bottom}:X=ro}for(var be=X.top-t.rect.top,Me=X.bottom-t.rect.top,Fe=(be+Me)/2,We=t.view.measure.heights,Xe=0;Xe=r.text.length?(z=r.text.length,X="before"):z<=0&&(z=0,X="after"),!K)return N(X=="before"?z-1:z,X=="before");function ie(Me,Fe,We){var Xe=K[Fe],et=Xe.level==1;return N(We?Me-1:Me,et!=We)}var ue=He(K,z,X),xe=Be,be=ie(z,ue,X=="before");return xe!=null&&(be.other=ie(z,xe,X!="before")),be}function uo(e,t){var n=0;t=ht(e.doc,t),e.options.lineWrapping||(n=An(e.display)*t.ch);var r=nt(e.doc,t.line),i=xr(r)+Ui(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function ga(e,t,n,r,i){var S=Ne(e,t,n);return S.xRel=i,r&&(S.outside=r),S}function va(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,n<0)return ga(r.first,0,null,-1,-1);var i=gr(r,n),S=r.first+r.size-1;if(i>S)return ga(r.first+r.size-1,nt(r,S).text.length,null,1,1);t<0&&(t=0);for(var N=nt(r,i);;){var K=Ks(e,N,i,t,n),z=Sn(N,K.ch+(K.xRel>0||K.outside>0?1:0));if(!z)return K;var X=z.find(1);if(X.line==i)return X;N=nt(r,i=X.line)}}function co(e,t,n,r){r-=ma(t);var i=t.text.length,S=Ge(function(N){return Dr(e,n,N-1).bottom<=r},i,0);return i=Ge(function(N){return Dr(e,n,N).top>r},S,i),{begin:S,end:i}}function fo(e,t,n,r){n||(n=Cn(e,t));var i=Fi(e,t,Dr(e,n,r),"line").top;return co(e,t,n,i)}function ya(e,t,n,r){return e.bottom<=n?!1:e.top>n?!0:(r?e.left:e.right)>t}function Ks(e,t,n,r,i){i-=xr(t);var S=Cn(e,t),N=ma(t),K=0,z=t.text.length,X=!0,ie=Je(t,e.doc.direction);if(ie){var ue=(e.options.lineWrapping?zs:Gs)(e,t,n,S,ie,r,i);X=ue.level!=1,K=X?ue.from:ue.to-1,z=X?ue.to:ue.from-1}var xe=null,be=null,Me=Ge(function(ut){var at=Dr(e,S,ut);return at.top+=N,at.bottom+=N,ya(at,r,i,!1)?(at.top<=i&&at.left<=r&&(xe=ut,be=at),!0):!1},K,z),Fe,We,Xe=!1;if(be){var et=r-be.left=tt.bottom?1:0}return Me=Re(t.text,Me,1),ga(n,Me,We,Xe,r-Fe)}function Gs(e,t,n,r,i,S,N){var K=Ge(function(ue){var xe=i[ue],be=xe.level!=1;return ya(Tr(e,Ne(n,be?xe.to:xe.from,be?"before":"after"),"line",t,r),S,N,!0)},0,i.length-1),z=i[K];if(K>0){var X=z.level!=1,ie=Tr(e,Ne(n,X?z.from:z.to,X?"after":"before"),"line",t,r);ya(ie,S,N,!0)&&ie.top>N&&(z=i[K-1])}return z}function zs(e,t,n,r,i,S,N){var K=co(e,t,r,N),z=K.begin,X=K.end;/\s/.test(t.text.charAt(X-1))&&X--;for(var ie=null,ue=null,xe=0;xe=X||be.to<=z)continue;var Me=be.level!=1,Fe=Dr(e,r,Me?Math.min(X,be.to)-1:Math.max(z,be.from)).right,We=FeWe)&&(ie=be,ue=We)}return ie||(ie=i[i.length-1]),ie.fromX&&(ie={from:ie.from,to:X,level:ie.level}),ie}var an;function _n(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(an==null){an=a("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)an.appendChild(document.createTextNode("x")),an.appendChild(a("br"));an.appendChild(document.createTextNode("x"))}l(e.measure,an);var n=an.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),c(e.measure),n||1}function An(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=a("span","xxxxxxxxxx"),n=a("pre",[t],"CodeMirror-line-like");l(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function ba(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,S=t.gutters.firstChild,N=0;S;S=S.nextSibling,++N){var K=e.display.gutterSpecs[N].className;n[K]=S.offsetLeft+S.clientLeft+i,r[K]=S.clientWidth}return{fixedPos:Ea(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Ea(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function ho(e){var t=_n(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/An(e.display)-3);return function(i){if(Ar(e.doc,i))return 0;var S=0;if(i.widgets)for(var N=0;N0&&(X=nt(e.doc,z.line).text).length==z.ch){var ie=H(X,X.length,e.options.tabSize)-X.length;z=Ne(z.line,Math.max(0,Math.round((S-qa(e.display).left)/An(e.display))-ie))}return z}function sn(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;rt)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)$t&&Qn(e.doc,t)i.viewFrom?Gr(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)Gr(e);else if(t<=i.viewFrom){var S=Ni(e,n,n+r,1);S?(i.view=i.view.slice(S.index),i.viewFrom=S.lineN,i.viewTo+=r):Gr(e)}else if(n>=i.viewTo){var N=Ni(e,t,t,-1);N?(i.view=i.view.slice(0,N.index),i.viewTo=N.lineN):Gr(e)}else{var K=Ni(e,t,t,-1),z=Ni(e,n,n+r,1);K&&z?(i.view=i.view.slice(0,K.index).concat(er(e,K.lineN,z.lineN)).concat(i.view.slice(z.index)),i.viewTo+=r):Gr(e)}var X=i.externalMeasured;X&&(n=i.lineN&&t=r.viewTo)return;var S=r.view[sn(e,t)];if(S.node==null)return;var N=S.changes||(S.changes=[]);ee(N,n)==-1&&N.push(n)}function Gr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Ni(e,t,n,r){var i=sn(e,t),S,N=e.display.view;if(!$t||n==e.doc.first+e.doc.size)return{index:i,lineN:n};for(var K=e.display.viewFrom,z=0;z0){if(i==N.length-1)return null;S=K+N[i].size-t,i++}else S=K-t;t+=S,n+=S}for(;Qn(e.doc,n)!=n;){if(i==(r<0?0:N.length-1))return null;n+=r*N[i-(r<0?1:0)].size,i+=r}return{index:i,lineN:n}}function Vs(e,t,n){var r=e.display,i=r.view;i.length==0||t>=r.viewTo||n<=r.viewFrom?(r.view=er(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=er(e,t,r.viewFrom).concat(r.view):r.viewFromn&&(r.view=r.view.slice(0,sn(e,n)))),r.viewTo=n}function mo(e){for(var t=e.display.view,n=0,r=0;r=e.display.viewTo||K.to().line0?t.blinker=setInterval(function(){e.hasFocus()||Ln(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function vo(e){e.state.focused||(e.display.input.focus(),Sa(e))}function yo(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Ln(e))},100)}function Sa(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(Le(e,"focus",e,t),e.state.focused=!0,F(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),k&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Ta(e)}function Ln(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(Le(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 ji(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;r.005||ie<-.005)&&(Qt(i.line,N),bo(i.line),i.rest))for(var ue=0;uee.display.sizerWidth){var xe=Math.ceil(K/An(e.display));xe>e.display.maxLineLength&&(e.display.maxLineLength=xe,e.display.maxLine=i.line,e.display.maxLineChanged=!0)}}}function bo(e){if(e.widgets)for(var t=0;t=N&&(S=gr(t,xr(nt(t,z))-e.wrapper.clientHeight),N=z)}return{from:S,to:Math.max(N,S+1)}}function Ys(e,t){if(Ie(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&&!T){var S=a("div","\u200B",null,`position: absolute; top: `+(t.top-n.viewOffset-Ui(e.display))+`px; height: `+(t.bottom-t.top+Lr(e)+n.barHeight)+`px; left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(S),S.scrollIntoView(i),e.display.lineSpace.removeChild(S)}}function $s(e,t,n,r){r==null&&(r=0);var i;!e.options.lineWrapping&&t==n&&(t=t.ch?Ne(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,n=t.sticky=="before"?Ne(t.line,t.ch+1,"before"):t);for(var S=0;S<5;S++){var N=!1,K=Tr(e,t),z=!n||n==t?K:Tr(e,n);i={left:Math.min(K.left,z.left),top:Math.min(K.top,z.top)-r,right:Math.max(K.left,z.left),bottom:Math.max(K.bottom,z.bottom)+r};var X=wa(e,i),ie=e.doc.scrollTop,ue=e.doc.scrollLeft;if(X.scrollTop!=null&&(si(e,X.scrollTop),Math.abs(e.doc.scrollTop-ie)>1&&(N=!0)),X.scrollLeft!=null&&(ln(e,X.scrollLeft),Math.abs(e.doc.scrollLeft-ue)>1&&(N=!0)),!N)break}return i}function Js(e,t){var n=wa(e,t);n.scrollTop!=null&&si(e,n.scrollTop),n.scrollLeft!=null&&ln(e,n.scrollLeft)}function wa(e,t){var n=e.display,r=_n(e.display);t.top<0&&(t.top=0);var i=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop,S=fa(e),N={};t.bottom-t.top>S&&(t.bottom=t.top+S);var K=e.doc.height+ca(n),z=t.topK-r;if(t.topi+S){var ie=Math.min(t.top,(X?K:t.bottom)-S);ie!=i&&(N.scrollTop=ie)}var ue=e.options.fixedGutter?0:n.gutters.offsetWidth,xe=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-ue,be=nn(e)-n.gutters.offsetWidth,Me=t.right-t.left>be;return Me&&(t.right=t.left+be),t.left<10?N.scrollLeft=0:t.leftbe+xe-3&&(N.scrollLeft=t.right+(Me?0:10)-be),N}function Ca(e,t){if(t==null)return;Hi(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function Dn(e){Hi(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function oi(e,t,n){(t!=null||n!=null)&&Hi(e),t!=null&&(e.curOp.scrollLeft=t),n!=null&&(e.curOp.scrollTop=n)}function Zs(e,t){Hi(e),e.curOp.scrollToPos=t}function Hi(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=uo(e,t.from),r=uo(e,t.to);Eo(e,n,r,t.margin)}}function Eo(e,t,n,r){var i=wa(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});oi(e,i.scrollLeft,i.scrollTop)}function si(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;A||Aa(e,{top:t}),xo(e,t,!0),A&&Aa(e),di(e,100)}function xo(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 ln(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,_o(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function li(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+ca(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:r,scrollHeight:r+Lr(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var un=function(e,t,n){this.cm=n;var r=this.vert=a("div",[a("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=a("div",[a("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=i.tabIndex=-1,e(r),e(i),Se(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),Se(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,B&&U<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};un.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 S=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+S)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(r==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?r:0,bottom:t?r:0}},un.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},un.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},un.prototype.zeroWidthHack=function(){var e=u&&!C?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new Y,this.disableVert=new Y},un.prototype.enableZeroWidthBar=function(e,t,n){e.style.pointerEvents="auto";function r(){var i=e.getBoundingClientRect(),S=n=="vert"?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1);S!=e?e.style.pointerEvents="none":t.set(1e3,r)}t.set(1e3,r)},un.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var ui=function(){};ui.prototype.update=function(){return{bottom:0,right:0}},ui.prototype.setScrollLeft=function(){},ui.prototype.setScrollTop=function(){},ui.prototype.clear=function(){};function On(e,t){t||(t=li(e));var n=e.display.barWidth,r=e.display.barHeight;To(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&ji(e),To(e,li(e)),n=e.display.barWidth,r=e.display.barHeight}function To(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 So={native:un,null:ui};function wo(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&h(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new So[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Se(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"?ln(e,t):si(e,t)},e),e.display.scrollbars.addClass&&F(e.display.wrapper,e.display.scrollbars.addClass)}var Qs=0;function dn(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Qs},mr(e.curOp)}function cn(e){var t=e.curOp;t&&Rs(t,function(n){for(var r=0;r=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new Ki(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&_a(e.cm,e.update)}function rl(e){var t=e.cm,n=t.display;e.updatedDisplay&&ji(t),e.barMeasure=li(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=to(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+Lr(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-nn(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function nl(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft=e.display.viewTo)return;var n=+new Date+e.options.workTime,r=vr(e,t.highlightFrontier),i=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(S){if(r.line>=e.display.viewFrom){var N=S.styles,K=S.text.length>e.options.maxHighlightLength?_r(t.mode,r.state):null,z=zn(e,S,r,!0);K&&(r.state=K),S.styles=z.styles;var X=S.styleClasses,ie=z.classes;ie?S.styleClasses=ie:X&&(S.styleClasses=null);for(var ue=!N||N.length!=S.styles.length||X!=ie&&(!X||!ie||X.bgClass!=ie.bgClass||X.textClass!=ie.textClass),xe=0;!ue&&xen)return di(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),i.length&&or(e,function(){for(var S=0;S=n.viewFrom&&t.visible.to<=n.viewTo&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&mo(e)==0)return!1;Ao(e)&&(Gr(e),t.dims=ba(e));var i=r.first+r.size,S=Math.max(t.visible.from-e.options.viewportMargin,r.first),N=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFromN&&n.viewTo-N<20&&(N=Math.min(i,n.viewTo)),$t&&(S=Qn(e.doc,S),N=Hr(e.doc,N));var K=S!=n.viewFrom||N!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Vs(e,S,N),n.viewOffset=xr(nt(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var z=mo(e);if(!K&&z==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;var X=sl(e);return z>4&&(n.lineDiv.style.display="none"),ul(e,n.updateLineNumbers,t.dims),z>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,ll(X),c(n.cursorDiv),c(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,K&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,di(e,400)),n.updateLineNumbers=null,!0}function Co(e,t){for(var n=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==nn(e)){if(n&&n.top!=null&&(n={top:Math.min(e.doc.height+ca(e.display)-fa(e),n.top)}),t.visible=Wi(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=Wi(e.display,e.doc,n));if(!_a(e,t))break;ji(e);var i=li(e);ai(e),On(e,i),Da(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 Aa(e,t){var n=new Ki(e,t);if(_a(e,n)){ji(e),Co(e,n);var r=li(e);ai(e),On(e,r),Da(e,r),n.finish()}}function ul(e,t,n){var r=e.display,i=e.options.lineNumbers,S=r.lineDiv,N=S.firstChild;function K(Me){var Fe=Me.nextSibling;return k&&u&&e.display.currentWheelTarget==Me?Me.style.display="none":Me.parentNode.removeChild(Me),Fe}for(var z=r.view,X=r.viewFrom,ie=0;ie-1&&(be=!1),Ya(e,ue,X,n)),be&&(c(ue.lineNumber),ue.lineNumber.appendChild(document.createTextNode(pn(e.options,X)))),N=ue.node.nextSibling}X+=ue.size}for(;N;)N=K(N)}function La(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Da(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+Lr(e)+"px"}function _o(e){var t=e.display,n=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var r=Ea(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,S=r+"px",N=0;NN.clientWidth,z=N.scrollHeight>N.clientHeight;if(!(r&&K||i&&z))return;if(i&&u&&k){e:for(var X=t.target,ie=S.view;X!=N;X=X.parentNode)for(var ue=0;ue=0&&ct(e,r.to())<=0)return n}return-1};var wt=function(e,t){this.anchor=e,this.head=t};wt.prototype.from=function(){return Zr(this.anchor,this.head)},wt.prototype.to=function(){return vn(this.anchor,this.head)},wt.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Sr(e,t,n){var r=e&&e.options.selectionsMayTouch,i=t[n];t.sort(function(xe,be){return ct(xe.from(),be.from())}),n=ee(t,i);for(var S=1;S0:z>=0){var X=Zr(K.from(),N.from()),ie=vn(K.to(),N.to()),ue=K.empty()?N.from()==N.head:K.from()==K.head;S<=n&&--n,t.splice(--S,2,new wt(ue?ie:X,ue?X:ie))}}return new cr(t,n)}function zr(e,t){return new cr([new wt(e,t||e)],0)}function Vr(e){return e.text?Ne(e.from.line+e.text.length-1,J(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Ro(e,t){if(ct(e,t.from)<0)return e;if(ct(e,t.to)<=0)return Vr(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+=Vr(t).ch-t.to.ch),Ne(n,r)}function Ra(e,t){for(var n=[],r=0;r1&&e.remove(K.line+1,Me-1),e.insert(K.line+1,Xe)}Gt(e,"change",e,t)}function Xr(e,t,n){function r(i,S,N){if(i.linked)for(var K=0;K1&&!e.done[e.done.length-2].ranges)return e.done.pop(),J(e.done)}function Fo(e,t,n,r){var i=e.history;i.undone.length=0;var S=+new Date,N,K;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&i.lastModTime>S-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(N=ml(i,i.lastOp==r)))K=J(N.changes),ct(t.from,t.to)==0&&ct(t.from,K.to)==0?K.to=Vr(t):N.changes.push(ka(e,t));else{var z=J(i.done);for((!z||!z.ranges)&&Vi(e.sel,i.done),N={changes:[ka(e,t)],generation:i.generation},i.done.push(N);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=S,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,K||Le(e,"historyAdded")}function pl(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,S=r&&r.origin;n==i.lastSelOp||S&&i.lastSelOrigin==S&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==S||pl(e,S,J(i.done),t))?i.done[i.done.length-1]=t:Vi(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=S,i.lastSelOp=n,r&&r.clearRedo!==!1&&Uo(i.undone)}function Vi(e,t){var n=J(t);n&&n.ranges&&n.equals(e)||t.push(e)}function No(e,t,n,r){var i=t["spans_"+e.id],S=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(N){N.markedSpans&&((i||(i=t["spans_"+e.id]={}))[S]=N.markedSpans),++S})}function vl(e){if(!e)return null;for(var t,n=0;n-1&&(J(K)[ue]=X[ue],delete X[ue]))}}return r}function Ia(e,t,n,r){if(r){var i=e.anchor;if(n){var S=ct(t,i)<0;S!=ct(n,i)<0?(i=t,t=n):S!=ct(t,n)<0&&(t=n)}return new wt(i,t)}else return new wt(n||t,t)}function Xi(e,t,n,r,i){i==null&&(i=e.cm&&(e.cm.display.shift||e.extend)),Xt(e,new cr([Ia(e.sel.primary(),t,n,i)],0),r)}function jo(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),S=0;S=t.ch:K.to>t.ch))){if(i&&(Le(z,"beforeCursorEnter"),z.explicitlyCleared))if(S.markedSpans){--N;continue}else break;if(!z.atomic)continue;if(n){var ue=z.find(r<0?1:-1),xe=void 0;if((r<0?ie:X)&&(ue=Vo(e,ue,-r,ue&&ue.line==t.line?S:null)),ue&&ue.line==t.line&&(xe=ct(ue,n))&&(r<0?xe<0:xe>0))return Pn(e,ue,t,r,i)}var be=z.find(r<0?-1:1);return(r<0?X:ie)&&(be=Vo(e,be,r,be.line==t.line?S:null)),be?Pn(e,be,t,r,i):null}}return t}function $i(e,t,n,r,i){var S=r||1,N=Pn(e,t,n,S,i)||!i&&Pn(e,t,n,S,!0)||Pn(e,t,n,-S,i)||!i&&Pn(e,t,n,-S,!0);return N||(e.cantEdit=!0,Ne(e.first,0))}function Vo(e,t,n,r){return n<0&&t.ch==0?t.line>e.first?ht(e,Ne(t.line-1)):null:n>0&&t.ch==(r||nt(e,t.line)).text.length?t.line=0;--i)$o(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else $o(e,t)}function $o(e,t){if(t.text.length==1&&t.text[0]==""&&ct(t.from,t.to)==0)return;var n=Ra(e,t);Fo(e,t,n,e.cm?e.cm.curOp.id:NaN),hi(e,t,n,En(e,t));var r=[];Xr(e,function(i,S){!S&&ee(r,i.history)==-1&&(qo(i.history,t),r.push(i.history)),hi(i,t,null,En(i,t))})}function Ji(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(r&&!n)return;for(var i=e.history,S,N=e.sel,K=t=="undo"?i.done:i.undone,z=t=="undo"?i.undone:i.done,X=0;X=0;--be){var Me=xe(be);if(Me)return Me.v}}function Jo(e,t){if(t==0)return;if(e.first+=t,e.sel=new cr(ne(e.sel.ranges,function(i){return new wt(Ne(i.anchor.line+t,i.anchor.ch),Ne(i.head.line+t,i.head.ch))}),e.sel.primIndex),e.cm){tr(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;re.lastLine())return;if(t.from.lineS&&(t={from:t.from,to:Ne(S,nt(e,S).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Pr(e,t.from,t.to),n||(n=Ra(e,t)),e.cm?El(e.cm,t,r):Ma(e,t,r),Yi(e,n,ve),e.cantEdit&&$i(e,Ne(e.firstLine(),0))&&(e.cantEdit=!1)}function El(e,t,n){var r=e.doc,i=e.display,S=t.from,N=t.to,K=!1,z=S.line;e.options.lineWrapping||(z=Tt(ur(nt(r,S.line))),r.iter(z,N.line+1,function(be){if(be==i.maxLine)return K=!0,!0})),r.sel.contains(t.from,t.to)>-1&&pe(e),Ma(r,t,n,ho(e)),e.options.lineWrapping||(r.iter(z,S.line+t.text.length,function(be){var Me=ei(be);Me>i.maxLineLength&&(i.maxLine=be,i.maxLineLength=Me,i.maxLineChanged=!0,K=!1)}),K&&(e.curOp.updateMaxLine=!0)),aa(r,S.line),di(e,400);var X=t.text.length-(N.line-S.line)-1;t.full?tr(e):S.line==N.line&&t.text.length==1&&!Mo(e.doc,t)?Kr(e,S.line,"text"):tr(e,S.line,N.line+1,X);var ie=se(e,"changes"),ue=se(e,"change");if(ue||ie){var xe={from:S,to:N,text:t.text,removed:t.removed,origin:t.origin};ue&&Gt(e,"change",e,xe),ie&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(xe)}e.display.selForContextMenu=null}function kn(e,t,n,r,i){var S;r||(r=n),ct(r,n)<0&&(S=[r,n],n=S[0],r=S[1]),typeof t=="string"&&(t=e.splitLines(t)),Mn(e,{from:n,to:r,text:t,origin:i})}function Zo(e,t,n,r){n1||!(this.children[0]instanceof pi))){var K=[];this.collapse(K),this.children=[new pi(K)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t50){for(var N=i.lines.length%25+25,K=N;K10);e.parent.maybeSpill()},iterN:function(e,t,n){for(var r=0;re.display.maxLineLength&&(e.display.maxLine=X,e.display.maxLineLength=ie,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&tr(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Go(e.doc)),e&&Gt(e,"markerCleared",e,this,r,i),t&&cn(e),this.parent&&this.parent.clear()},Yr.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var n,r,i=0;i0||N==0&&S.clearWhenEmpty!==!1)return S;if(S.replacedWith&&(S.collapsed=!0,S.widgetNode=v("span",[S.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||S.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(S.widgetNode.insertLeft=!0)),S.collapsed){if(Mi(e,t.line,t,n,S)||t.line!=n.line&&Mi(e,n.line,t,n,S))throw new Error("Inserting collapsed marker partially overlapping an existing one");oa()}S.addToHistory&&Fo(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var K=t.line,z=e.cm,X;if(e.iter(K,n.line+1,function(ue){z&&S.collapsed&&!z.options.lineWrapping&&ur(ue)==z.display.maxLine&&(X=!0),S.collapsed&&K!=t.line&&Qt(ue,0),sa(ue,new qr(S,K==t.line?t.ch:null,K==n.line?n.ch:null)),++K}),S.collapsed&&e.iter(t.line,n.line+1,function(ue){Ar(e,ue)&&Qt(ue,0)}),S.clearOnEnter&&Se(S,"beforeCursorEnter",function(){return S.clear()}),S.readOnly&&(Wr(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),S.collapsed&&(S.id=++ts,S.atomic=!0),z){if(X&&(z.curOp.updateMaxLine=!0),S.collapsed)tr(z,t.line,n.line+1);else if(S.className||S.startStyle||S.endStyle||S.css||S.attributes||S.title)for(var ie=t.line;ie<=n.line;ie++)Kr(z,ie,"text");S.atomic&&Go(z.doc),Gt(z,"markerAdded",z,S)}return S}var yi=function(e,t){this.markers=e,this.primary=t;for(var n=0;n=0;z--)Mn(this,r[z]);K?Ho(this,K):this.cm&&Dn(this.cm)}),undo:Wt(function(){Ji(this,"undo")}),redo:Wt(function(){Ji(this,"redo")}),undoSelection:Wt(function(){Ji(this,"undo",!0)}),redoSelection:Wt(function(){Ji(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.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,n){e=ht(this,e),t=ht(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,function(S){var N=S.markedSpans;if(N)for(var K=0;K=z.to||z.from==null&&i!=e.line||z.from!=null&&i==t.line&&z.from>=t.ch)&&(!n||n(z.marker))&&r.push(z.marker.parent||z.marker)}++i}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var n=t.markedSpans;if(n)for(var r=0;re)return t=e,!0;e-=S,++n}),ht(this,Ne(n,t))},indexFromPos:function(e){e=ht(this,e);var t=e.ch;if(e.linet&&(t=e.from),e.to!=null&&e.to-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var ie=e.dataTransfer.getData("Text");if(ie){var ue;if(t.state.draggingText&&!t.state.draggingText.copy&&(ue=t.listSelections()),Yi(t.doc,zr(n,n)),ue)for(var xe=0;xe=0;K--)kn(e.doc,"",r[K].from,r[K].to,"+delete");Dn(e)})}function Fa(e,t,n){var r=Re(e.text,t+n,n);return r<0||r>e.text.length?null:r}function Na(e,t,n){var r=Fa(e,t.ch,n);return r==null?null:new Ne(t.line,r,n<0?"after":"before")}function Ba(e,t,n,r,i){if(e){t.doc.direction=="rtl"&&(i=-i);var S=Je(n,t.doc.direction);if(S){var N=i<0?J(S):S[0],K=i<0==(N.level==1),z=K?"after":"before",X;if(N.level>0||t.doc.direction=="rtl"){var ie=Cn(t,n);X=i<0?n.text.length-1:0;var ue=Dr(t,ie,X).top;X=Ge(function(xe){return Dr(t,ie,xe).top==ue},i<0==(N.level==1)?N.from:N.to-1,X),z=="before"&&(X=Fa(n,X,1))}else X=i<0?N.to:N.from;return new Ne(r,X,z)}}return new Ne(r,i<0?n.text.length:0,i<0?"before":"after")}function kl(e,t,n,r){var i=Je(t,e.doc.direction);if(!i)return Na(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 S=He(i,n.ch,n.sticky),N=i[S];if(e.doc.direction=="ltr"&&N.level%2==0&&(r>0?N.to>n.ch:N.from=N.from&&xe>=ie.begin)){var be=ue?"before":"after";return new Ne(n.line,xe,be)}}var Me=function(Xe,et,Ye){for(var tt=function(Lt,Ht){return Ht?new Ne(n.line,K(Lt,1),"before"):new Ne(n.line,Lt,"after")};Xe>=0&&Xe0==(ut.level!=1),pt=at?Ye.begin:K(Ye.end,-1);if(ut.from<=pt&&pt0?ie.end:K(ie.begin,-1);return We!=null&&!(r>0&&We==t.text.length)&&(Fe=Me(r>0?0:i.length-1,r,X(We)),Fe)?Fe:null}var xi={selectAll:Xo,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),ve)},killLine:function(e){return Fn(e,function(t){if(t.empty()){var n=nt(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line0)i=new Ne(i.line,i.ch+1),e.replaceRange(S.charAt(i.ch-1)+S.charAt(i.ch-2),Ne(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var N=nt(e.doc,i.line-1).text;N&&(i=new Ne(i.line,1),e.replaceRange(S.charAt(0)+e.doc.lineSeparator()+N.charAt(N.length-1),Ne(i.line-1,N.length-1),i,"+transpose"))}}n.push(new wt(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){return or(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;re&&ct(t,this.pos)==0&&n==this.button};var Si,wi;function Wl(e,t){var n=+new Date;return wi&&wi.compare(n,e,t)?(Si=wi=null,"triple"):Si&&Si.compare(n,e,t)?(wi=new Wa(n,e,t),Si=null,"double"):(Si=new Wa(n,e,t),wi=null,"single")}function vs(e){var t=this,n=t.display;if(Ie(t,e)||n.activeTouch&&n.input.supportsTouch())return;if(n.input.ensurePolled(),n.shift=e.shiftKey,Nr(n,e)){k||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if(Ha(t,e))return;var r=on(t,e),i=Ae(e),S=r?Wl(r,i):"single";if(window.focus(),i==1&&t.state.selectingText&&t.state.selectingText(e),r&&Hl(t,i,r,S,e))return;i==1?r?Gl(t,r,S,e):ce(e)==n.scroller&&$(e):i==2?(r&&Xi(t.doc,r),setTimeout(function(){return n.input.focus()},20)):i==3&&(_?t.display.input.onContextMenu(e):yo(t))}function Hl(e,t,n,r,i){var S="Click";return r=="double"?S="Double"+S:r=="triple"&&(S="Triple"+S),S=(t==1?"Left":t==2?"Middle":"Right")+S,Ti(e,ls(S,i),i,function(N){if(typeof N=="string"&&(N=xi[N]),!N)return!1;var K=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),K=N(e,n)!=Te}finally{e.state.suppressEdits=!1}return K})}function Kl(e,t,n){var r=e.getOption("configureMouse"),i=r?r(e,t,n):{};if(i.unit==null){var S=s?n.shiftKey&&n.metaKey:n.altKey;i.unit=S?"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=u?n.metaKey:n.ctrlKey),i.moveOnDrag==null&&(i.moveOnDrag=!(u?n.altKey:n.ctrlKey)),i}function Gl(e,t,n,r){B?setTimeout(D(vo,e),0):e.curOp.focus=M();var i=Kl(e,n,r),S=e.doc.sel,N;e.options.dragDrop&&_e&&!e.isReadOnly()&&n=="single"&&(N=S.contains(t))>-1&&(ct((N=S.ranges[N]).from(),t)<0||t.xRel>0)&&(ct(N.to(),t)>0||t.xRel<0)?zl(e,r,t,i):Vl(e,r,t,i)}function zl(e,t,n,r){var i=e.display,S=!1,N=jt(e,function(X){k&&(i.scroller.draggable=!1),e.state.draggingText=!1,Ke(i.wrapper.ownerDocument,"mouseup",N),Ke(i.wrapper.ownerDocument,"mousemove",K),Ke(i.scroller,"dragstart",z),Ke(i.scroller,"drop",N),S||($(X),r.addNew||Xi(e.doc,n,null,null,r.extend),k&&!O||B&&U==9?setTimeout(function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()},20):i.input.focus())}),K=function(X){S=S||Math.abs(t.clientX-X.clientX)+Math.abs(t.clientY-X.clientY)>=10},z=function(){return S=!0};k&&(i.scroller.draggable=!0),e.state.draggingText=N,N.copy=!r.moveOnDrag,i.scroller.dragDrop&&i.scroller.dragDrop(),Se(i.wrapper.ownerDocument,"mouseup",N),Se(i.wrapper.ownerDocument,"mousemove",K),Se(i.scroller,"dragstart",z),Se(i.scroller,"drop",N),yo(e),setTimeout(function(){return i.input.focus()},20)}function ys(e,t,n){if(n=="char")return new wt(t,t);if(n=="word")return e.findWordAt(t);if(n=="line")return new wt(Ne(t.line,0),ht(e.doc,Ne(t.line+1,0)));var r=n(e,t);return new wt(r.from,r.to)}function Vl(e,t,n,r){var i=e.display,S=e.doc;$(t);var N,K,z=S.sel,X=z.ranges;if(r.addNew&&!r.extend?(K=S.sel.contains(n),K>-1?N=X[K]:N=new wt(n,n)):(N=S.sel.primary(),K=S.sel.primIndex),r.unit=="rectangle")r.addNew||(N=new wt(n,n)),n=on(e,t,!0,!0),K=-1;else{var ie=ys(e,n,r.unit);r.extend?N=Ia(N,ie.anchor,ie.head,r.extend):N=ie}r.addNew?K==-1?(K=X.length,Xt(S,Sr(e,X.concat([N]),K),{scroll:!1,origin:"*mouse"})):X.length>1&&X[K].empty()&&r.unit=="char"&&!r.extend?(Xt(S,Sr(e,X.slice(0,K).concat(X.slice(K+1)),0),{scroll:!1,origin:"*mouse"}),z=S.sel):Ua(S,K,N,ge):(K=0,Xt(S,new cr([N],0),ge),z=S.sel);var ue=n;function xe(Ye){if(ct(ue,Ye)==0)return;if(ue=Ye,r.unit=="rectangle"){for(var tt=[],ut=e.options.tabSize,at=H(nt(S,n.line).text,n.ch,ut),pt=H(nt(S,Ye.line).text,Ye.ch,ut),Lt=Math.min(at,pt),Ht=Math.max(at,pt),Ot=Math.min(n.line,Ye.line),sr=Math.min(e.lastLine(),Math.max(n.line,Ye.line));Ot<=sr;Ot++){var nr=nt(S,Ot).text,kt=fe(nr,Lt,ut);Lt==Ht?tt.push(new wt(Ne(Ot,kt),Ne(Ot,kt))):nr.length>kt&&tt.push(new wt(Ne(Ot,kt),Ne(Ot,fe(nr,Ht,ut))))}tt.length||tt.push(new wt(n,n)),Xt(S,Sr(e,z.ranges.slice(0,K).concat(tt),K),{origin:"*mouse",scroll:!1}),e.scrollIntoView(Ye)}else{var ir=N,zt=ys(e,Ye,r.unit),Nt=ir.anchor,It;ct(zt.anchor,Nt)>0?(It=zt.head,Nt=Zr(ir.from(),zt.anchor)):(It=zt.anchor,Nt=vn(ir.to(),zt.head));var Pt=z.ranges.slice(0);Pt[K]=Xl(e,new wt(ht(S,Nt),It)),Xt(S,Sr(e,Pt,K),ge)}}var be=i.wrapper.getBoundingClientRect(),Me=0;function Fe(Ye){var tt=++Me,ut=on(e,Ye,!0,r.unit=="rectangle");if(!ut)return;if(ct(ut,ue)!=0){e.curOp.focus=M(),xe(ut);var at=Wi(i,S);(ut.line>=at.to||ut.linebe.bottom?20:0;pt&&setTimeout(jt(e,function(){if(Me!=tt)return;i.scroller.scrollTop+=pt,Fe(Ye)}),50)}}function We(Ye){e.state.selectingText=!1,Me=Infinity,Ye&&($(Ye),i.input.focus()),Ke(i.wrapper.ownerDocument,"mousemove",Xe),Ke(i.wrapper.ownerDocument,"mouseup",et),S.history.lastSelOrigin=null}var Xe=jt(e,function(Ye){Ye.buttons===0||!Ae(Ye)?We(Ye):Fe(Ye)}),et=jt(e,We);e.state.selectingText=et,Se(i.wrapper.ownerDocument,"mousemove",Xe),Se(i.wrapper.ownerDocument,"mouseup",et)}function Xl(e,t){var n=t.anchor,r=t.head,i=nt(e.doc,n.line);if(ct(n,r)==0&&n.sticky==r.sticky)return t;var S=Je(i);if(!S)return t;var N=He(S,n.ch,n.sticky),K=S[N];if(K.from!=n.ch&&K.to!=n.ch)return t;var z=N+(K.from==n.ch==(K.level!=1)?0:1);if(z==0||z==S.length)return t;var X;if(r.line!=n.line)X=(r.line-n.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var ie=He(S,r.ch,r.sticky),ue=ie-N||(r.ch-n.ch)*(K.level==1?-1:1);ie==z-1||ie==z?X=ue<0:X=ue>0}var xe=S[z+(X?-1:0)],be=X==(xe.level==1),Me=be?xe.from:xe.to,Fe=be?"after":"before";return n.ch==Me&&n.sticky==Fe?t:new wt(new Ne(n.line,Me,Fe),r)}function bs(e,t,n,r){var i,S;if(t.touches)i=t.touches[0].clientX,S=t.touches[0].clientY;else try{i=t.clientX,S=t.clientY}catch(xe){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&$(t);var N=e.display,K=N.lineDiv.getBoundingClientRect();if(S>K.bottom||!se(e,n))return te(t);S-=K.top-N.viewOffset;for(var z=0;z=i){var ie=gr(e.doc,S),ue=e.display.gutterSpecs[z];return Le(e,n,e,ie,ue.className,t),te(t)}}}function Ha(e,t){return bs(e,t,"gutterClick",!0)}function Es(e,t){if(Nr(e.display,t)||Yl(e,t))return;if(Ie(e,t,"contextmenu"))return;_||e.display.input.onContextMenu(t)}function Yl(e,t){return se(e,"gutterContextMenu")?bs(e,t,"gutterContextMenu",!1):!1}function xs(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),ii(e)}var Nn={toString:function(){return"CodeMirror.Init"}},Ts={},ea={};function $l(e){var t=e.optionHandlers;function n(r,i,S,N){e.defaults[r]=i,S&&(t[r]=N?function(K,z,X){X!=Nn&&S(K,z,X)}:S)}e.defineOption=n,e.Init=Nn,n("value","",function(r,i){return r.setValue(i)},!0),n("mode",null,function(r,i){r.doc.modeOption=i,Pa(r)},!0),n("indentUnit",2,Pa,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(r){fi(r),ii(r),tr(r)},!0),n("lineSeparator",null,function(r,i){if(r.doc.lineSep=i,!i)return;var S=[],N=r.doc.first;r.doc.iter(function(z){for(var X=0;;){var ie=z.text.indexOf(i,X);if(ie==-1)break;X=ie+i.length,S.push(Ne(N,ie))}N++});for(var K=S.length-1;K>=0;K--)kn(r.doc,i,S[K],Ne(S[K].line,S[K].ch+i.length))}),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(r,i,S){r.state.specialChars=new RegExp(i.source+(i.test(" ")?"":"| "),"g"),S!=Nn&&r.refresh()}),n("specialCharPlaceholder",At,function(r){return r.refresh()},!0),n("electricChars",!0),n("inputStyle",o?"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",!w),n("wholeLineUpdateBefore",!0),n("theme","default",function(r){xs(r),ci(r)},!0),n("keyMap","default",function(r,i,S){var N=Qi(i),K=S!=Nn&&Qi(S);K&&K.detach&&K.detach(r,N),N.attach&&N.attach(r,K||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Zl,!0),n("gutters",[],function(r,i){r.display.gutterSpecs=Oa(i,r.options.lineNumbers),ci(r)},!0),n("fixedGutter",!0,function(r,i){r.display.gutters.style.left=i?Ea(r.display)+"px":"0",r.refresh()},!0),n("coverGutterNextToScrollbar",!1,function(r){return On(r)},!0),n("scrollbarStyle","native",function(r){wo(r),On(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=Oa(r.options.gutters,i),ci(r)},!0),n("firstLineNumber",1,ci,!0),n("lineNumberFormatter",function(r){return r},ci,!0),n("showCursorWhenSelecting",!1,ai,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,function(r,i){i=="nocursor"&&(Ln(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,Jl),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,ai,!0),n("singleCursorHeightPerLine",!0,ai,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,fi,!0),n("addModeClass",!1,fi,!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,fi,!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 Jl(e,t,n){var r=n&&n!=Nn;if(!t!=!r){var i=e.display.dragFunctions,S=t?Se:Ke;S(e.display.scroller,"dragstart",i.start),S(e.display.scroller,"dragenter",i.enter),S(e.display.scroller,"dragover",i.over),S(e.display.scroller,"dragleave",i.leave),S(e.display.scroller,"drop",i.drop)}}function Zl(e){e.options.lineWrapping?(F(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(h(e.display.wrapper,"CodeMirror-wrap"),Ii(e)),xa(e),tr(e),ii(e),setTimeout(function(){return On(e)},100)}function Dt(e,t){var n=this;if(!(this instanceof Dt))return new Dt(e,t);this.options=t=t?P(t):{},P(Ts,t,!1);var r=t.value;typeof r=="string"?r=new rr(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var i=new Dt.inputStyles[t.inputStyle](this),S=this.display=new dl(e,r,i,t);S.wrapper.CodeMirror=this,xs(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),wo(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new Y,keySeq:null,specialChars:null},t.autofocus&&!o&&S.input.focus(),B&&U<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Ql(this),Dl(),dn(this),this.curOp.forceUpdate=!0,ko(this,r),t.autofocus&&!o||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&Sa(n)},20):Ln(this);for(var N in ea)ea.hasOwnProperty(N)&&ea[N](this,t[N],Nn);Ao(this),t.finishInit&&t.finishInit(this);for(var K=0;K20*20}Se(t.scroller,"touchstart",function(z){if(!Ie(e,z)&&!S(z)&&!Ha(e,z)){t.input.ensurePolled(),clearTimeout(n);var X=+new Date;t.activeTouch={start:X,moved:!1,prev:X-r.end<=300?r:null},z.touches.length==1&&(t.activeTouch.left=z.touches[0].pageX,t.activeTouch.top=z.touches[0].pageY)}}),Se(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Se(t.scroller,"touchend",function(z){var X=t.activeTouch;if(X&&!Nr(t,z)&&X.left!=null&&!X.moved&&new Date-X.start<300){var ie=e.coordsChar(t.activeTouch,"page"),ue;!X.prev||N(X,X.prev)?ue=new wt(ie,ie):!X.prev.prev||N(X,X.prev.prev)?ue=e.findWordAt(ie):ue=new wt(Ne(ie.line,0),ht(e.doc,Ne(ie.line+1,0))),e.setSelection(ue.anchor,ue.head),e.focus(),$(z)}i()}),Se(t.scroller,"touchcancel",i),Se(t.scroller,"scroll",function(){t.scroller.clientHeight&&(si(e,t.scroller.scrollTop),ln(e,t.scroller.scrollLeft,!0),Le(e,"scroll",e))}),Se(t.scroller,"mousewheel",function(z){return Oo(e,z)}),Se(t.scroller,"DOMMouseScroll",function(z){return Oo(e,z)}),Se(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(z){Ie(e,z)||le(z)},over:function(z){Ie(e,z)||(Ll(e,z),le(z))},start:function(z){return Al(e,z)},drop:jt(e,_l),leave:function(z){Ie(e,z)||is(e)}};var K=t.input.getField();Se(K,"keyup",function(z){return ps.call(e,z)}),Se(K,"keydown",jt(e,ms)),Se(K,"keypress",jt(e,gs)),Se(K,"focus",function(z){return Sa(e,z)}),Se(K,"blur",function(z){return Ln(e,z)})}var Ka=[];Dt.defineInitHook=function(e){return Ka.push(e)};function Ci(e,t,n,r){var i=e.doc,S;n==null&&(n="add"),n=="smart"&&(i.mode.indent?S=vr(e,t).state:n="prev");var N=e.options.tabSize,K=nt(i,t),z=H(K.text,null,N);K.stateAfter&&(K.stateAfter=null);var X=K.text.match(/^\s*/)[0],ie;if(!r&&!/\S/.test(K.text))ie=0,n="not";else if(n=="smart"&&(ie=i.mode.indent(S,K.text.slice(X.length),K.text),ie==Te||ie>150)){if(!r)return;n="prev"}n=="prev"?t>i.first?ie=H(nt(i,t-1).text,null,N):ie=0:n=="add"?ie=z+e.options.indentUnit:n=="subtract"?ie=z-e.options.indentUnit:typeof n=="number"&&(ie=z+n),ie=Math.max(0,ie);var ue="",xe=0;if(e.options.indentWithTabs)for(var be=Math.floor(ie/N);be;--be)xe+=N,ue+=" ";if(xeN,z=dt(t),X=null;if(K&&r.ranges.length>1)if(wr&&wr.text.join(` `)==t){if(r.ranges.length%wr.text.length==0){X=[];for(var ie=0;ie=0;xe--){var be=r.ranges[xe],Me=be.from(),Fe=be.to();be.empty()&&(n&&n>0?Me=Ne(Me.line,Me.ch-n):e.state.overwrite&&!K?Fe=Ne(Fe.line,Math.min(nt(S,Fe.line).text.length,Fe.ch+J(z).length)):K&&wr&&wr.lineWise&&wr.text.join(` `)==z.join(` `)&&(Me=Fe=Ne(Me.line,0)));var We={from:Me,to:Fe,text:X?X[xe%X.length]:z,origin:i||(K?"paste":e.state.cutIncoming>N?"cut":"+input")};Mn(e.doc,We),Gt(e,"inputRead",e,We)}t&&!K&&ws(e,t),Dn(e),e.curOp.updateInput<2&&(e.curOp.updateInput=ue),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Ss(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&or(t,function(){return Ga(t,n,0,null,"paste")}),!0}function ws(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 S=e.getModeAt(i.head),N=!1;if(S.electricChars){for(var K=0;K-1){N=Ci(e,i.head.line,"smart");break}}else S.electricInput&&(S.electricInput.test(nt(e.doc,i.head.line).text.slice(0,i.head.ch))&&(N=Ci(e,i.head.line,"smart")));N&&Gt(e,"electricInput",e,i.head.line)}}function Cs(e){for(var t=[],n=[],r=0;rS&&(Ci(this,K.head.line,r,!0),S=K.head.line,N==this.doc.sel.primIndex&&Dn(this));else{var z=K.from(),X=K.to(),ie=Math.max(S,z.line);S=Math.min(this.lastLine(),X.line-(X.ch?0:1))+1;for(var ue=ie;ue0&&Ua(this.doc,N,new wt(z,xe[N].to()),ve)}}}),getTokenAt:function(r,i){return Ai(this,r,i)},getLineTokens:function(r,i){return Ai(this,Ne(r),i,!0)},getTokenTypeAt:function(r){r=ht(this.doc,r);var i=Qr(this,nt(this.doc,r.line)),S=0,N=(i.length-1)/2,K=r.ch,z;if(K==0)z=i[2];else for(;;){var X=S+N>>1;if((X?i[X*2-1]:0)>=K)N=X;else if(i[X*2+1]z&&(r=z,N=!0),K=nt(this.doc,r)}else K=r;return Fi(this,K,{top:0,left:0},i||"page",S||N).top+(N?this.doc.height-xr(K):0)},defaultTextHeight:function(){return _n(this.display)},defaultCharWidth:function(){return An(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,i,S,N,K){var z=this.display;r=Tr(this,ht(this.doc,r));var X=r.bottom,ie=r.left;if(i.style.position="absolute",i.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(i),z.sizer.appendChild(i),N=="over")X=r.top;else if(N=="above"||N=="near"){var ue=Math.max(z.wrapper.clientHeight,this.doc.height),xe=Math.max(z.sizer.clientWidth,z.lineSpace.clientWidth);(N=="above"||r.bottom+i.offsetHeight>ue)&&r.top>i.offsetHeight?X=r.top-i.offsetHeight:r.bottom+i.offsetHeight<=ue&&(X=r.bottom),ie+i.offsetWidth>xe&&(ie=xe-i.offsetWidth)}i.style.top=X+"px",i.style.left=i.style.right="",K=="right"?(ie=z.sizer.clientWidth-i.offsetWidth,i.style.right="0px"):(K=="left"?ie=0:K=="middle"&&(ie=(z.sizer.clientWidth-i.offsetWidth)/2),i.style.left=ie+"px"),S&&Js(this,{left:ie,top:X,right:ie+i.offsetWidth,bottom:X+i.offsetHeight})},triggerOnKeyDown:Jt(ms),triggerOnKeyPress:Jt(gs),triggerOnKeyUp:ps,triggerOnMouseDown:Jt(vs),execCommand:function(r){if(xi.hasOwnProperty(r))return xi[r].call(null,this)},triggerElectric:Jt(function(r){ws(this,r)}),findPosH:function(r,i,S,N){var K=1;i<0&&(K=-1,i=-i);for(var z=ht(this.doc,r),X=0;X0&&ie(S.charAt(N-1));)--N;for(;K.5||this.options.lineWrapping)&&xa(this),Le(this,"refresh",this)}),swapDoc:Jt(function(r){var i=this.doc;return i.cm=null,this.state.selectingText&&this.state.selectingText(),ko(this,r),ii(this),this.display.input.reset(),oi(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,Gt(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}},de(e),e.registerHelper=function(r,i,S){n.hasOwnProperty(r)||(n[r]=e[r]={_global:[]}),n[r][i]=S},e.registerGlobalHelper=function(r,i,S,N){e.registerHelper(r,i,N),n[r]._global.push({pred:S,val:N})}}function za(e,t,n,r,i){var S=t,N=n,K=nt(e,t.line),z=i&&e.direction=="rtl"?-n:n;function X(){var et=t.line+z;return et=e.first+e.size?!1:(t=new Ne(et,t.ch,t.sticky),K=nt(e,et))}function ie(et){var Ye;if(r=="codepoint"){var tt=K.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(tt)?Ye=null:Ye=new Ne(t.line,Math.max(0,Math.min(K.text.length,t.ch+n*(tt>=55296&&tt<56320?2:1))),-n)}else i?Ye=kl(e.cm,K,t,n):Ye=Na(K,t,n);if(Ye==null)if(!et&&X())t=Ba(i,e.cm,K,t.line,z);else return!1;else t=Ye;return!0}if(r=="char"||r=="codepoint")ie();else if(r=="column")ie(!0);else if(r=="word"||r=="group")for(var ue=null,xe=r=="group",be=e.cm&&e.cm.getHelper(t,"wordChars"),Me=!0;!(n<0&&!ie(!Me));Me=!1){var Fe=K.text.charAt(t.ch)||` `,We=De(Fe,be)?"w":xe&&Fe==` `?"n":!xe||/\s/.test(Fe)?null:"p";if(xe&&!Me&&!We&&(We="s"),ue&&ue!=We){n<0&&(n=1,ie(),t.sticky="after");break}if(We&&(ue=We),n>0&&!ie(!Me))break}var Xe=$i(e,t,S,N,!0);return Gn(S,Xe)&&(Xe.hitSide=!0),Xe}function Ls(e,t,n,r){var i=e.doc,S=t.left,N;if(r=="page"){var K=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),z=Math.max(K-.5*_n(e.display),3);N=(n>0?t.bottom:t.top)+n*z}else r=="line"&&(N=n>0?t.bottom+3:t.top-3);for(var X;!(X=va(e,S,N),!X.outside);){if(n<0?N<=0:N>=i.height){X.hitSide=!0;break}N+=n*5}return X}var _t=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new Y,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};_t.prototype.init=function(e){var t=this,n=this,r=n.cm,i=n.div=e.lineDiv;_s(i,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function S(K){for(var z=K.target;z;z=z.parentNode){if(z==i)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(z.className))break}return!1}Se(i,"paste",function(K){if(!S(K)||Ie(r,K)||Ss(K,r))return;U<=11&&setTimeout(jt(r,function(){return t.updateFromDOM()}),20)}),Se(i,"compositionstart",function(K){t.composing={data:K.data,done:!1}}),Se(i,"compositionupdate",function(K){t.composing||(t.composing={data:K.data,done:!1})}),Se(i,"compositionend",function(K){t.composing&&(K.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Se(i,"touchstart",function(){return n.forceCompositionEnd()}),Se(i,"input",function(){t.composing||t.readFromDOMSoon()});function N(K){if(!S(K)||Ie(r,K))return;if(r.somethingSelected())ta({lineWise:!1,text:r.getSelections()}),K.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var z=Cs(r);ta({lineWise:!0,text:z.text}),K.type=="cut"&&r.operation(function(){r.setSelections(z.ranges,0,ve),r.replaceSelection("",null,"cut")})}else return;if(K.clipboardData){K.clipboardData.clearData();var X=wr.text.join(` `);if(K.clipboardData.setData("Text",X),K.clipboardData.getData("Text")==X){K.preventDefault();return}}var ie=As(),ue=ie.firstChild;r.display.lineSpace.insertBefore(ie,r.display.lineSpace.firstChild),ue.value=wr.text.join(` `);var xe=document.activeElement;W(ue),setTimeout(function(){r.display.lineSpace.removeChild(ie),xe.focus(),xe==i&&n.showPrimarySelection()},50)}Se(i,"copy",N),Se(i,"cut",N)},_t.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},_t.prototype.prepareSelection=function(){var e=po(this.cm,!1);return e.focus=document.activeElement==this.div,e},_t.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},_t.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},_t.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&&Ds(t,r)||{node:K[0].measure.map[2],offset:0},X=i.linee.firstLine()&&(r=Ne(r.line-1,nt(e.doc,r.line-1).length)),i.ch==nt(e.doc,i.line).text.length&&i.linet.viewTo-1)return!1;var S,N,K;r.line==t.viewFrom||(S=sn(e,r.line))==0?(N=Tt(t.view[0].line),K=t.view[0].node):(N=Tt(t.view[S].line),K=t.view[S-1].node.nextSibling);var z=sn(e,i.line),X,ie;if(z==t.view.length-1?(X=t.viewTo-1,ie=t.lineDiv.lastChild):(X=Tt(t.view[z+1].line)-1,ie=t.view[z+1].node.previousSibling),!K)return!1;for(var ue=e.doc.splitLines(tu(e,K,ie,N,X)),xe=Pr(e.doc,Ne(N,0),Ne(X,nt(e.doc,X).text.length));ue.length>1&&xe.length>1;)if(J(ue)==J(xe))ue.pop(),xe.pop(),X--;else if(ue[0]==xe[0])ue.shift(),xe.shift(),N++;else break;for(var be=0,Me=0,Fe=ue[0],We=xe[0],Xe=Math.min(Fe.length,We.length);ber.ch&&et.charCodeAt(et.length-Me-1)==Ye.charCodeAt(Ye.length-Me-1);)be--,Me++;ue[ue.length-1]=et.slice(0,et.length-Me).replace(/^\u200b+/,""),ue[0]=ue[0].slice(be).replace(/\u200b+$/,"");var ut=Ne(N,be),at=Ne(X,xe.length?J(xe).length-Me:0);if(ue.length>1||ue[0]||ct(ut,at))return kn(e.doc,ue,ut,at,"+input"),!0},_t.prototype.ensurePolled=function(){this.forceCompositionEnd()},_t.prototype.reset=function(){this.forceCompositionEnd()},_t.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},_t.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)},_t.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&or(this.cm,function(){return tr(e.cm)})},_t.prototype.setUneditable=function(e){e.contentEditable="false"},_t.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||jt(this.cm,Ga)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},_t.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},_t.prototype.onContextMenu=function(){},_t.prototype.resetPosition=function(){},_t.prototype.needsContentAttribute=!0;function Ds(e,t){var n=ha(e,t.line);if(!n||n.hidden)return null;var r=nt(e.doc,t.line),i=eo(n,r,t.line),S=Je(r,e.doc.direction),N="left";if(S){var K=He(S,t.ch);N=K%2?"right":"left"}var z=no(i.map,t.ch,N);return z.offset=z.collapse=="right"?z.end:z.start,z}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function Bn(e,t){return t&&(e.bad=!0),e}function tu(e,t,n,r,i){var S="",N=!1,K=e.doc.lineSeparator(),z=!1;function X(be){return function(Me){return Me.id==be}}function ie(){N&&(S+=K,z&&(S+=K),N=z=!1)}function ue(be){be&&(ie(),S+=be)}function xe(be){if(be.nodeType==1){var Me=be.getAttribute("cm-text");if(Me){ue(Me);return}var Fe=be.getAttribute("cm-marker"),We;if(Fe){var Xe=e.findMarks(Ne(r,0),Ne(i+1,0),X(+Fe));Xe.length&&(We=Xe[0].find(0))&&ue(Pr(e.doc,We.from,We.to).join(K));return}if(be.getAttribute("contenteditable")=="false")return;var et=/^(pre|div|p|li|table|br)$/i.test(be.nodeName);if(!/^br$/i.test(be.nodeName)&&be.textContent.length==0)return;et&&ie();for(var Ye=0;Ye=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),Se(i,"paste",function(N){if(Ie(r,N)||Ss(N,r))return;r.state.pasteIncoming=+new Date,n.fastPoll()});function S(N){if(Ie(r,N))return;if(r.somethingSelected())ta({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var K=Cs(r);ta({lineWise:!0,text:K.text}),N.type=="cut"?r.setSelections(K.ranges,null,ve):(n.prevInput="",i.value=K.text.join(` `),W(i))}else return;N.type=="cut"&&(r.state.cutIncoming=+new Date)}Se(i,"cut",S),Se(i,"copy",S),Se(e.scroller,"paste",function(N){if(Nr(e,N)||Ie(r,N))return;if(!i.dispatchEvent){r.state.pasteIncoming=+new Date,n.focus();return}var K=new Event("paste");K.clipboardData=N.clipboardData,i.dispatchEvent(K)}),Se(e.lineSpace,"selectstart",function(N){Nr(e,N)||$(N)}),Se(i,"compositionstart",function(){var N=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:N,range:r.markText(N,r.getCursor("to"),{className:"CodeMirror-composing"})}}),Se(i,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},Mt.prototype.createField=function(e){this.wrapper=As(),this.textarea=this.wrapper.firstChild},Mt.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},Mt.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=po(e);if(e.options.moveInputWithCursor){var i=Tr(e,n.sel.primary().head,"div"),S=t.wrapper.getBoundingClientRect(),N=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+N.top-S.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+N.left-S.left))}return r},Mt.prototype.showSelection=function(e){var t=this.cm,n=t.display;l(n.cursorDiv,e.cursors),l(n.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Mt.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&&W(this.textarea),B&&U>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",B&&U>=9&&(this.hasSelection=null))},Mt.prototype.getField=function(){return this.textarea},Mt.prototype.supportsTouch=function(){return!1},Mt.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!o||M()!=this.textarea))try{this.textarea.focus()}catch(e){}},Mt.prototype.blur=function(){this.textarea.blur()},Mt.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Mt.prototype.receivedFocus=function(){this.slowPoll()},Mt.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()})},Mt.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)},Mt.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||ot(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(B&&U>=9&&this.hasSelection===i||u&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var S=i.charCodeAt(0);if(S==8203&&!r&&(r="\u200B"),S==8666)return this.reset(),this.cm.execCommand("undo")}for(var N=0,K=Math.min(r.length,i.length);N1e3||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},Mt.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Mt.prototype.onKeyPress=function(){B&&U>=9&&(this.hasSelection=null),this.fastPoll()},Mt.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var S=on(n,e),N=r.scroller.scrollTop;if(!S||x)return;var K=n.options.resetSelectionOnContextMenu;K&&n.doc.sel.contains(S)==-1&&jt(n,Xt)(n.doc,zr(S),ve);var z=i.style.cssText,X=t.wrapper.style.cssText,ie=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",i.style.cssText=`position: absolute; width: 30px; height: 30px; top: `+(e.clientY-ie.top-5)+"px; left: "+(e.clientX-ie.left-5)+`px; z-index: 1000; background: `+(B?"rgba(255, 255, 255, .05)":"transparent")+`; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var ue;k&&(ue=window.scrollY),r.input.focus(),k&&window.scrollTo(null,ue),r.input.reset(),n.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=be,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll);function xe(){if(i.selectionStart!=null){var Fe=n.somethingSelected(),We="\u200B"+(Fe?i.value:"");i.value="\u21DA",i.value=We,t.prevInput=Fe?"":"\u200B",i.selectionStart=1,i.selectionEnd=We.length,r.selForContextMenu=n.doc.sel}}function be(){if(t.contextMenuPending!=be)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=X,i.style.cssText=z,B&&U<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=N),i.selectionStart!=null){(!B||B&&U<9)&&xe();var Fe=0,We=function(){r.selForContextMenu==n.doc.sel&&i.selectionStart==0&&i.selectionEnd>0&&t.prevInput=="\u200B"?jt(n,Xo)(n):Fe++<10?r.detectingSelectAll=setTimeout(We,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(We,200)}}if(B&&U>=9&&xe(),_){le(e);var Me=function(){Ke(window,"mouseup",Me),setTimeout(be,20)};Se(window,"mouseup",Me)}else setTimeout(be,50)},Mt.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},Mt.prototype.setUneditable=function(){},Mt.prototype.needsContentAttribute=!1;function nu(e,t){if(t=t?P(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=M();t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}function r(){e.value=K.getValue()}var i;if(e.form&&(Se(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var S=e.form;i=S.submit;try{var N=S.submit=function(){r(),S.submit=i,S.submit(),S.submit=N}}catch(z){}}t.finishInit=function(z){z.save=r,z.getTextArea=function(){return e},z.toTextArea=function(){z.toTextArea=isNaN,r(),e.parentNode.removeChild(z.getWrapperElement()),e.style.display="",e.form&&(Ke(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=i))}},e.style.display="none";var K=Dt(function(z){return e.parentNode.insertBefore(z,e.nextSibling)},t);return K}function iu(e){e.off=Ke,e.on=Se,e.wheelEventPixels=cl,e.Doc=rr,e.splitLines=dt,e.countColumn=H,e.findColumn=fe,e.isWordChar=we,e.Pass=Te,e.signal=Le,e.Line=rn,e.changeEnd=Vr,e.scrollbarModel=So,e.Pos=Ne,e.cmpPos=ct,e.modes=Ut,e.mimeModes=Et,e.resolveMode=lr,e.getMode=pr,e.modeExtensions=fr,e.extendMode=ia,e.copyState=_r,e.startState=Kn,e.innerMode=Hn,e.commands=xi,e.keyMap=Br,e.keyName=us,e.isModifierKey=ss,e.lookupKey=Un,e.normalizeKeyMap=Ml,e.StringStream=Rt,e.SharedTextMarker=yi,e.TextMarker=Yr,e.LineWidget=vi,e.e_preventDefault=$,e.e_stopPropagation=Z,e.e_stop=le,e.addClass=F,e.contains=E,e.rmClass=h,e.keyNames=$r}$l(Dt),ql(Dt);var au="iter insert remove copy getEditor constructor".split(" ");for(var na in rr.prototype)rr.prototype.hasOwnProperty(na)&&ee(au,na)<0&&(Dt.prototype[na]=function(e){return function(){return e.apply(this.doc,arguments)}}(rr.prototype[na]));return de(rr),Dt.inputStyles={textarea:Mt,contenteditable:_t},Dt.defineMode=function(e){!Dt.defaults.mode&&e!="null"&&(Dt.defaults.mode=e),Cr.apply(this,arguments)},Dt.defineMIME=Rr,Dt.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Dt.defineMIME("text/plain","null"),Dt.defineExtension=function(e,t){Dt.prototype[e]=t},Dt.defineDocExtension=function(e,t){rr.prototype[e]=t},Dt.fromTextArea=nu,iu(Dt),Dt.version="5.58.2",Dt})},Y1PL:function(st,ze,q){"use strict";q.r(ze),q.d(ze,"ResizableTextArea",function(){return ee});var re=q("wx14"),V=q("1OyB"),A=q("vuIU"),G=q("Ji7U"),I=q("LK+K"),R=q("cDcd"),B=q("VTBJ"),U=q("rePB"),k=q("Zm9Q"),L=q("Kwbf"),y=q("c+Xe"),x=q("m+aA"),O=q("bdgK"),C=new Map;function T(ve){ve.forEach(function(ge){var he,fe=ge.target;(he=C.get(fe))===null||he===void 0||he.forEach(function(ae){return ae(fe)})})}var g=new O.default(T),d=null,o=null;function u(ve,ge){C.has(ve)||(C.set(ve,new Set),g.observe(ve)),C.get(ve).add(ge)}function s(ve,ge){C.has(ve)&&(C.get(ve).delete(ge),C.get(ve).size||(g.unobserve(ve),C.delete(ve)))}var w=function(ve){Object(G.a)(he,ve);var ge=Object(I.a)(he);function he(){return Object(V.a)(this,he),ge.apply(this,arguments)}return Object(A.a)(he,[{key:"render",value:function(){return this.props.children}}]),he}(R.Component),p=R.createContext(null);function f(ve){var ge=ve.children,he=ve.onBatchResize,fe=R.useRef(0),ae=R.useRef([]),me=R.useContext(p),J=R.useCallback(function(ne,Q,Ee){fe.current+=1;var Ce=fe.current;ae.current.push({size:ne,element:Q,data:Ee}),Promise.resolve().then(function(){Ce===fe.current&&(he==null||he(ae.current),ae.current=[])}),me==null||me(ne,Q,Ee)},[he,me]);return R.createElement(p.Provider,{value:J},ge)}function _(ve){var ge=ve.children,he=ve.disabled,fe=R.useRef(null),ae=R.useRef(null),me=R.useContext(p),J=R.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),ne=R.isValidElement(ge)&&Object(y.c)(ge),Q=ne?ge.ref:null,Ee=R.useMemo(function(){return Object(y.a)(Q,fe)},[Q,fe]),Ce=R.useRef(ve);Ce.current=ve;var ye=R.useCallback(function(we){var De=Ce.current,Pe=De.onResize,ke=De.data,Oe=we.getBoundingClientRect(),Re=Oe.width,Ge=Oe.height,$e=we.offsetWidth,Be=we.offsetHeight,He=Math.floor(Re),rt=Math.floor(Ge);if(J.current.width!==He||J.current.height!==rt||J.current.offsetWidth!==$e||J.current.offsetHeight!==Be){var Je={width:He,height:rt,offsetWidth:$e,offsetHeight:Be};J.current=Je;var qe=$e===Math.round(Re)?Re:$e,Se=Be===Math.round(Ge)?Ge:Be,Ze=Object(B.a)(Object(B.a)({},Je),{},{offsetWidth:qe,offsetHeight:Se});me==null||me(Ze,we,ke),Pe&&Promise.resolve().then(function(){Pe(Ze,we)})}},[]);return R.useEffect(function(){var we=Object(x.a)(fe.current)||Object(x.a)(ae.current);return we&&!he&&u(we,ye),function(){return s(we,ye)}},[fe.current,he]),R.createElement(w,{ref:ae},ne?R.cloneElement(ge,{ref:Ee}):ge)}var b="rc-observer-key";function h(ve){var ge=ve.children,he=Object(k.a)(ge);return he.map(function(fe,ae){var me=(fe==null?void 0:fe.key)||"".concat(b,"-").concat(ae);return R.createElement(_,Object(re.a)({},ve,{key:me}),fe)})}h.Collection=f;var c=h,l=q("bT9E"),a=q("TSYQ"),v=q.n(a),m=` min-height:0 !important; max-height:none !important; height:0 !important; visibility:hidden !important; overflow:hidden !important; position:absolute !important; z-index:-1000 !important; top:0 !important; right:0 !important `,E=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","font-variant","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing","word-break"],M={},F;function j(ve){var ge=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,he=ve.getAttribute("id")||ve.getAttribute("data-reactid")||ve.getAttribute("name");if(ge&&M[he])return M[he];var fe=window.getComputedStyle(ve),ae=fe.getPropertyValue("box-sizing")||fe.getPropertyValue("-moz-box-sizing")||fe.getPropertyValue("-webkit-box-sizing"),me=parseFloat(fe.getPropertyValue("padding-bottom"))+parseFloat(fe.getPropertyValue("padding-top")),J=parseFloat(fe.getPropertyValue("border-bottom-width"))+parseFloat(fe.getPropertyValue("border-top-width")),ne=E.map(function(Ee){return"".concat(Ee,":").concat(fe.getPropertyValue(Ee))}).join(";"),Q={sizingStyle:ne,paddingSize:me,borderSize:J,boxSizing:ae};return ge&&he&&(M[he]=Q),Q}function W(ve){var ge=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,he=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,fe=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;F||(F=document.createElement("textarea"),F.setAttribute("tab-index","-1"),F.setAttribute("aria-hidden","true"),document.body.appendChild(F)),ve.getAttribute("wrap")?F.setAttribute("wrap",ve.getAttribute("wrap")):F.removeAttribute("wrap");var ae=j(ve,ge),me=ae.paddingSize,J=ae.borderSize,ne=ae.boxSizing,Q=ae.sizingStyle;F.setAttribute("style","".concat(Q,";").concat(m)),F.value=ve.value||ve.placeholder||"";var Ee=Number.MIN_SAFE_INTEGER,Ce=Number.MAX_SAFE_INTEGER,ye=F.scrollHeight,we;if(ne==="border-box"?ye+=J:ne==="content-box"&&(ye-=me),he!==null||fe!==null){F.value=" ";var De=F.scrollHeight-me;he!==null&&(Ee=De*he,ne==="border-box"&&(Ee=Ee+me+J),ye=Math.max(Ee,ye)),fe!==null&&(Ce=De*fe,ne==="border-box"&&(Ce=Ce+me+J),we=ye>Ce?"":"hidden",ye=Math.min(Ce,ye))}return{height:ye,minHeight:Ee,maxHeight:Ce,overflowY:we,resize:"none"}}var D=q("Gytx"),P=q.n(D),H;(function(ve){ve[ve.NONE=0]="NONE",ve[ve.RESIZING=1]="RESIZING",ve[ve.RESIZED=2]="RESIZED"})(H||(H={}));var Y=function(ve){Object(G.a)(he,ve);var ge=Object(I.a)(he);function he(fe){var ae;return Object(V.a)(this,he),ae=ge.call(this,fe),ae.nextFrameActionId=void 0,ae.resizeFrameId=void 0,ae.textArea=void 0,ae.saveTextArea=function(me){ae.textArea=me},ae.handleResize=function(me){var J=ae.state.resizeStatus,ne=ae.props,Q=ne.autoSize,Ee=ne.onResize;if(J!==H.NONE)return;typeof Ee=="function"&&Ee(me),Q&&ae.resizeOnNextFrame()},ae.resizeOnNextFrame=function(){cancelAnimationFrame(ae.nextFrameActionId),ae.nextFrameActionId=requestAnimationFrame(ae.resizeTextarea)},ae.resizeTextarea=function(){var me=ae.props.autoSize;if(!me||!ae.textArea)return;var J=me.minRows,ne=me.maxRows,Q=W(ae.textArea,!1,J,ne);ae.setState({textareaStyles:Q,resizeStatus:H.RESIZING},function(){cancelAnimationFrame(ae.resizeFrameId),ae.resizeFrameId=requestAnimationFrame(function(){ae.setState({resizeStatus:H.RESIZED},function(){ae.resizeFrameId=requestAnimationFrame(function(){ae.setState({resizeStatus:H.NONE}),ae.fixFirefoxAutoScroll()})})})})},ae.renderTextArea=function(){var me=ae.props,J=me.prefixCls,ne=J===void 0?"rc-textarea":J,Q=me.autoSize,Ee=me.onResize,Ce=me.className,ye=me.disabled,we=ae.state,De=we.textareaStyles,Pe=we.resizeStatus,ke=Object(l.a)(ae.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Oe=v()(ne,Ce,Object(U.a)({},"".concat(ne,"-disabled"),ye));"value"in ke&&(ke.value=ke.value||"");var Re=Object(B.a)(Object(B.a)(Object(B.a)({},ae.props.style),De),Pe===H.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return R.createElement(c,{onResize:ae.handleResize,disabled:!(Q||Ee)},R.createElement("textarea",Object(re.a)({},ke,{className:Oe,style:Re,ref:ae.saveTextArea})))},ae.state={textareaStyles:{},resizeStatus:H.NONE},ae}return Object(A.a)(he,[{key:"componentDidUpdate",value:function(ae){(ae.value!==this.props.value||!P()(ae.autoSize,this.props.autoSize))&&this.resizeTextarea()}},{key:"componentWillUnmount",value:function(){cancelAnimationFrame(this.nextFrameActionId),cancelAnimationFrame(this.resizeFrameId)}},{key:"fixFirefoxAutoScroll",value:function(){try{if(document.activeElement===this.textArea){var ae=this.textArea.selectionStart,me=this.textArea.selectionEnd;this.textArea.setSelectionRange(ae,me)}}catch(J){}}},{key:"render",value:function(){return this.renderTextArea()}}]),he}(R.Component),ee=Y,oe=function(ve){Object(G.a)(he,ve);var ge=Object(I.a)(he);function he(fe){var ae;Object(V.a)(this,he),ae=ge.call(this,fe),ae.resizableTextArea=void 0,ae.focus=function(){ae.resizableTextArea.textArea.focus()},ae.saveTextArea=function(J){ae.resizableTextArea=J},ae.handleChange=function(J){var ne=ae.props.onChange;ae.setValue(J.target.value,function(){ae.resizableTextArea.resizeTextarea()}),ne&&ne(J)},ae.handleKeyDown=function(J){var ne=ae.props,Q=ne.onPressEnter,Ee=ne.onKeyDown;J.keyCode===13&&Q&&Q(J),Ee&&Ee(J)};var me=typeof fe.value=="undefined"||fe.value===null?fe.defaultValue:fe.value;return ae.state={value:me},ae}return Object(A.a)(he,[{key:"setValue",value:function(ae,me){"value"in this.props||this.setState({value:ae},me)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return R.createElement(ee,Object(re.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(ae){return"value"in ae?{value:ae.value}:null}}]),he}(R.Component),Te=ze.default=oe},ZW9T:function(st,ze,q){"use strict";q.d(ze,"a",function(){return p});var re=q("k1fw"),V=q("miYZ"),A=q("tsqr"),G=q("rAM+"),I=q("tJVT"),R=q("PpiC"),B=q("cDcd"),U=q.n(B),k=q("bdgK");function L(f,_,b,h,c){var l=_.getWordUntilPosition(b),a={startLineNumber:b.lineNumber,endLineNumber:b.lineNumber,startColumn:l.startColumn,endColumn:l.endColumn},v=h.map(function(m){return{label:m,kind:f.languages.CompletionItemKind.Keyword,insertText:m,insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:a}});return c.map(function(m){v.push(Object(re.a)(Object(re.a)({},m),{},{range:a}))}),v}var y=function(f){var _={label:"ifelse",kind:f.languages.CompletionItemKind.Method,insertText:["if (${1:condition}) {"," $0","} else {"," ","}"].join(` `),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet},b=["auto","break","case","char","const","continue","default","do","double","else","enum","extern","float","for","goto","if","int","long","register","return","short","signed","sizeof","static","struct","switch","typedef","union","unsigned","void","volatile","while","inline","restrict","_Bool","_Complex","_Imaginary","_Alignas","_Alignof","_Atomic","_Static_assert","_Noreturn","_Thread_local","_Generic"];f.languages.registerCompletionItemProvider("cpp",{provideCompletionItems:function(a,v){var m=L(f,a,v,b,[_]);return{suggestions:m}}});var h=["False","None","True","and","as","assert","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","nonlocal","not","or","pass","raise","return","try","while","with","yield"];f.languages.registerCompletionItemProvider("python",{provideCompletionItems:function(a,v){var m=[{label:"print",kind:f.languages.CompletionItemKind.Snippet,insertText:["print($0)"].join(` `),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet}],E=L(f,a,v,h,m);return{suggestions:E}}});var c=["abstract","assert","boolean","break","byte","case","catch","char","class","const","continue","default","do","double","else","enum","extends","final","finally","float","for","goto","if","implements","import","instance of","int","interface","long","native","new","package","private","protected","public","return","strictfp","short","static","super","switch","synchronized","this","throw","throws","transient","try","void","volatile","while"];f.languages.registerCompletionItemProvider("java",{provideCompletionItems:function(a,v){var m=[_,{label:"main",kind:f.languages.CompletionItemKind.Snippet,insertText:["public static void main(String[] args) {"," $0","}"].join(` `),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"System.out.print",kind:f.languages.CompletionItemKind.Snippet,insertText:["System.out.print($0)"].join(` `),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet}],E=L(f,a,v,c,m);return{suggestions:E}}})},x="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",O=q("LvDl"),C=q("+ua5");function T(f){return/^\d+$/.test(f)?"".concat(f,"px"):f}function g(){}var d=!1,o={"Python3.6":"python","Python2.7":"python",Dynamips:"cpp",Java:"java",Web:"php",Html:"html",Hive:"sql",Hadoop:"java",SDL:"cpp",PHP:"php",Matlab:"python",Git:"python",Python:"python","C/C++":"cpp","C++":"cpp",C:"cpp",Ruby:"ruby",Shell:"shell",JavaScript:"javascript",Perl6:"perl",Kotlin:"kotlin",Elixir:"elixir",Android:"java",JavaWeb:"java",Go:"go",Spark:"sql",MachineLearning:"python",Verilog:"xml","Verilog/VNC":"xml",Docker:"dockerfile","C#":"csharp",SQLite3:"sql",Oracle:"sql",Vhdl:"vhdl",R:"r",Swift:"swift",SQLServer:"mysql",MySQL:"mysql",Mongo:"sql",PostgreSql:"pgsql",Hbase:"powershell",Sqoop:"sql",Nasm:"cpp",Kafka:"java",Flink:"java",Sml:"javascript",OpenGL:"cpp",Perl5:"perl",Orange:"python"};function u(){var f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],_=f;if(Array.isArray(f)){for(var b=0;b0||mt.target.offsetWidth>0)&&Pe.current.instance.layout()}}catch(dt){Qe.e(dt)}finally{Qe.f()}}),_e.observe(De.current)),_e}function Je(){A.b.warn(decodeURIComponent(x))}var qe=function(){var Ue=Pe.current.instance;if(l!=null&&Ue&&Be){var Qe=Ue.getModel();Qe&&l!==Qe.getValue()&&(d=!0,Qe.setValue(l),Ue.layout(),d=!1)}};Object(B.useEffect)(function(){ke.current&&clearTimeout(ke.current),ke.current=setTimeout(function(){qe()},500)},[l,Be,Pe.current]),Object(B.useEffect)(function(){if(Ee&&Pe.current&&Pe.current.instance){var _e=Pe.current.instance;_e.changeViewZones(function(Qe){var Ve=document.createElement("div");Ve.style.padding="10px 20px",Ve.style.width="calc(100% - 20px)",Ve.className="my-error-line-wrp",Ve.innerHTML=ye,Qe.addZone({afterLineNumber:Ee||11,heightInLines:3,domNode:Ve})});var Ue={domNode:null,getId:function(){return"my.overlay.widget"},getDomNode:function(){return this.domNode||(this.domNode=document.createElement("div"),this.domNode.innerHTML="",this.domNode.style.width="100%",this.domNode.style.padding="20px 100px",this.domNode.style.right="0px",this.domNode.style.top="50px",this.domNode.style.position="relative",this.domNode.style.color="#333"),this.domNode},getPosition:function(){return null}};_e.addOverlayWidget(Ue),_e.revealPositionInCenter({lineNumber:20,column:1})}},[Ee,Pe.current,Be]);function Se(){var _e=Pe.current.instance;if(_e){var Ue=_e.getSelection(),Qe=Pe.current.pastePos||{},Ve=new s.Range(Qe.startLineNumber||Ue.endLineNumber,Qe.startColumn||Ue.endColumn,Qe.endLineNumber||Ue.endLineNumber,Qe.endColumn||Ue.endColumn);setTimeout(function(){_e.executeEdits("",[{range:Ve,text:""}])},300)}}function Ze(_e){(window.navigator.platform.match("Mac")?_e.metaKey:_e.ctrlKey)&&_e.keyCode==83&&(_e.preventDefault(),Y())}var Ke=function(){if(oe&&Pe.current.instance){var Ue=Pe.current.instance.getContentHeight();ce(Ue0||fe.target.offsetWidth>0)&&oe.layout()}}catch(ae){ge.e(ae)}finally{ge.f()}}),Te.observe(M.current)),Te}Object(B.useEffect)(function(){M.current&&q.e(27).then(q.t.bind(null,"M/lh",7)).then(function(oe){s=oe;var Te=s.editor.createDiffEditor(M.current,Object(re.a)(Object(re.a)({enableSplitViewResizing:!1,scrollBeyondLastLine:!1,roundedSelection:!1,renderIndicators:!1,useShadows:!1,horizontal:"hidden",lineNumbers:"off",ignoreTrimWhitespace:!1,followsCaret:!0,ignoreCharChanges:!0,minimap:{enabled:!1},readOnly:!0},E),{},{wordWrap:!0}));D(Te);var ve=P(Te);return function(){Te.dispose();var ge=Te.getModel();ge&&ge.dispose(),ve.unobserve(M.current)}})},[]),Object(B.useEffect)(function(){W&&W.setModel({original:s.editor.createModel(l,v),modified:s.editor.createModel(a,v)})},[l,a,v,W]);var H=T(b),Y=T(c),ee={width:H,height:Y};return U.a.createElement("div",{className:"my-diff-editor",ref:M,style:ee})}},ZpRC:function(st,ze,q){"use strict";function re(y){return typeof y=="object"&&y!=null&&y.nodeType===1}function V(y,x){return(!x||y!=="hidden")&&y!=="visible"&&y!=="clip"}function A(y,x){if(y.clientHeightx||g>y&&d=x&&o>=O?g-y-C:d>x&&oO?d-x+T:0}var I=function(y,x){var O=window,C=x.scrollMode,T=x.block,g=x.inline,d=x.boundary,o=x.skipOverflowHiddenElements,u=typeof d=="function"?d:function(De){return De!==d};if(!re(y))throw new TypeError("Invalid target");for(var s=document.scrollingElement||document.documentElement,w=[],p=y;re(p)&&u(p);){if((p=p.parentElement)===s){w.push(p);break}p!=null&&p===document.body&&A(p)&&!A(document.documentElement)||p!=null&&A(p,o)&&w.push(p)}for(var f=O.visualViewport?O.visualViewport.width:innerWidth,_=O.visualViewport?O.visualViewport.height:innerHeight,b=window.scrollX||pageXOffset,h=window.scrollY||pageYOffset,c=y.getBoundingClientRect(),l=c.height,a=c.width,v=c.top,m=c.right,E=c.bottom,M=c.left,F=T==="start"||T==="nearest"?v:T==="end"?E:v+l/2,j=g==="center"?M+a/2:g==="end"?m:M,W=[],D=0;D=0&&M>=0&&E<=_&&m<=f&&v>=oe&&E<=ve&&M>=ge&&m<=Te)return W;var he=getComputedStyle(P),fe=parseInt(he.borderLeftWidth,10),ae=parseInt(he.borderTopWidth,10),me=parseInt(he.borderRightWidth,10),J=parseInt(he.borderBottomWidth,10),ne=0,Q=0,Ee="offsetWidth"in P?P.offsetWidth-P.clientWidth-fe-me:0,Ce="offsetHeight"in P?P.offsetHeight-P.clientHeight-ae-J:0;if(s===P)ne=T==="start"?F:T==="end"?F-_:T==="nearest"?G(h,h+_,_,ae,J,h+F,h+F+l,l):F-_/2,Q=g==="start"?j:g==="center"?j-f/2:g==="end"?j-f:G(b,b+f,f,fe,me,b+j,b+j+a,a),ne=Math.max(0,ne+h),Q=Math.max(0,Q+b);else{ne=T==="start"?F-oe-ae:T==="end"?F-ve+J+Ce:T==="nearest"?G(oe,ve,Y,ae,J+Ce,F,F+l,l):F-(oe+Y/2)+Ce/2,Q=g==="start"?j-ge-fe:g==="center"?j-(ge+ee/2)+Ee/2:g==="end"?j-Te+me+Ee:G(ge,Te,ee,fe,me+Ee,j,j+a,a);var ye=P.scrollLeft,we=P.scrollTop;F+=we-(ne=Math.max(0,Math.min(we+ne,P.scrollHeight-Y+Ce))),j+=ye-(Q=Math.max(0,Math.min(ye+Q,P.scrollWidth-ee+Ee)))}W.push({el:P,top:ne,left:Q})}return W};function R(y){return y===Object(y)&&Object.keys(y).length!==0}function B(y,x){x===void 0&&(x="auto");var O="scrollBehavior"in document.body.style;y.forEach(function(C){var T=C.el,g=C.top,d=C.left;T.scroll&&O?T.scroll({top:g,left:d,behavior:x}):(T.scrollTop=g,T.scrollLeft=d)})}function U(y){return y===!1?{block:"end",inline:"nearest"}:R(y)?y:{block:"start",inline:"nearest"}}function k(y,x){var O=!y.ownerDocument.documentElement.contains(y);if(R(x)&&typeof x.behavior=="function")return x.behavior(O?[]:I(y,x));if(O)return;var C=U(x);return B(I(y,C),C.behavior)}var L=ze.a=k},Zss7:function(st,ze,q){var re;(function(V){var A=/^\s+/,G=/\s+$/,I=0,R=V.round,B=V.min,U=V.max,k=V.random;function L(J,ne){if(J=J||"",ne=ne||{},J instanceof L)return J;if(!(this instanceof L))return new L(J,ne);var Q=y(J);this._originalInput=J,this._r=Q.r,this._g=Q.g,this._b=Q.b,this._a=Q.a,this._roundA=R(100*this._a)/100,this._format=ne.format||Q.format,this._gradientType=ne.gradientType,this._r<1&&(this._r=R(this._r)),this._g<1&&(this._g=R(this._g)),this._b<1&&(this._b=R(this._b)),this._ok=Q.ok,this._tc_id=I++}L.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var J=this.toRgb();return(J.r*299+J.g*587+J.b*114)/1e3},getLuminance:function(){var J=this.toRgb(),ne,Q,Ee,Ce,ye,we;return ne=J.r/255,Q=J.g/255,Ee=J.b/255,ne<=.03928?Ce=ne/12.92:Ce=V.pow((ne+.055)/1.055,2.4),Q<=.03928?ye=Q/12.92:ye=V.pow((Q+.055)/1.055,2.4),Ee<=.03928?we=Ee/12.92:we=V.pow((Ee+.055)/1.055,2.4),.2126*Ce+.7152*ye+.0722*we},setAlpha:function(J){return this._a=W(J),this._roundA=R(100*this._a)/100,this},toHsv:function(){var J=T(this._r,this._g,this._b);return{h:J.h*360,s:J.s,v:J.v,a:this._a}},toHsvString:function(){var J=T(this._r,this._g,this._b),ne=R(J.h*360),Q=R(J.s*100),Ee=R(J.v*100);return this._a==1?"hsv("+ne+", "+Q+"%, "+Ee+"%)":"hsva("+ne+", "+Q+"%, "+Ee+"%, "+this._roundA+")"},toHsl:function(){var J=O(this._r,this._g,this._b);return{h:J.h*360,s:J.s,l:J.l,a:this._a}},toHslString:function(){var J=O(this._r,this._g,this._b),ne=R(J.h*360),Q=R(J.s*100),Ee=R(J.l*100);return this._a==1?"hsl("+ne+", "+Q+"%, "+Ee+"%)":"hsla("+ne+", "+Q+"%, "+Ee+"%, "+this._roundA+")"},toHex:function(J){return d(this._r,this._g,this._b,J)},toHexString:function(J){return"#"+this.toHex(J)},toHex8:function(J){return o(this._r,this._g,this._b,this._a,J)},toHex8String:function(J){return"#"+this.toHex8(J)},toRgb:function(){return{r:R(this._r),g:R(this._g),b:R(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+R(this._r)+", "+R(this._g)+", "+R(this._b)+")":"rgba("+R(this._r)+", "+R(this._g)+", "+R(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:R(D(this._r,255)*100)+"%",g:R(D(this._g,255)*100)+"%",b:R(D(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+R(D(this._r,255)*100)+"%, "+R(D(this._g,255)*100)+"%, "+R(D(this._b,255)*100)+"%)":"rgba("+R(D(this._r,255)*100)+"%, "+R(D(this._g,255)*100)+"%, "+R(D(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:F[d(this._r,this._g,this._b,!0)]||!1},toFilter:function(J){var ne="#"+u(this._r,this._g,this._b,this._a),Q=ne,Ee=this._gradientType?"GradientType = 1, ":"";if(J){var Ce=L(J);Q="#"+u(Ce._r,Ce._g,Ce._b,Ce._a)}return"progid:DXImageTransform.Microsoft.gradient("+Ee+"startColorstr="+ne+",endColorstr="+Q+")"},toString:function(J){var ne=!!J;J=J||this._format;var Q=!1,Ee=this._a<1&&this._a>=0,Ce=!ne&&Ee&&(J==="hex"||J==="hex6"||J==="hex3"||J==="hex4"||J==="hex8"||J==="name");return Ce?J==="name"&&this._a===0?this.toName():this.toRgbString():(J==="rgb"&&(Q=this.toRgbString()),J==="prgb"&&(Q=this.toPercentageRgbString()),(J==="hex"||J==="hex6")&&(Q=this.toHexString()),J==="hex3"&&(Q=this.toHexString(!0)),J==="hex4"&&(Q=this.toHex8String(!0)),J==="hex8"&&(Q=this.toHex8String()),J==="name"&&(Q=this.toName()),J==="hsl"&&(Q=this.toHslString()),J==="hsv"&&(Q=this.toHsvString()),Q||this.toHexString())},clone:function(){return L(this.toString())},_applyModification:function(J,ne){var Q=J.apply(null,[this].concat([].slice.call(ne)));return this._r=Q._r,this._g=Q._g,this._b=Q._b,this.setAlpha(Q._a),this},lighten:function(){return this._applyModification(f,arguments)},brighten:function(){return this._applyModification(_,arguments)},darken:function(){return this._applyModification(b,arguments)},desaturate:function(){return this._applyModification(s,arguments)},saturate:function(){return this._applyModification(w,arguments)},greyscale:function(){return this._applyModification(p,arguments)},spin:function(){return this._applyModification(h,arguments)},_applyCombination:function(J,ne){return J.apply(null,[this].concat([].slice.call(ne)))},analogous:function(){return this._applyCombination(m,arguments)},complement:function(){return this._applyCombination(c,arguments)},monochromatic:function(){return this._applyCombination(E,arguments)},splitcomplement:function(){return this._applyCombination(v,arguments)},triad:function(){return this._applyCombination(l,arguments)},tetrad:function(){return this._applyCombination(a,arguments)}},L.fromRatio=function(J,ne){if(typeof J=="object"){var Q={};for(var Ee in J)J.hasOwnProperty(Ee)&&(Ee==="a"?Q[Ee]=J[Ee]:Q[Ee]=Te(J[Ee]));J=Q}return L(J,ne)};function y(J){var ne={r:0,g:0,b:0},Q=1,Ee=null,Ce=null,ye=null,we=!1,De=!1;return typeof J=="string"&&(J=ae(J)),typeof J=="object"&&(fe(J.r)&&fe(J.g)&&fe(J.b)?(ne=x(J.r,J.g,J.b),we=!0,De=String(J.r).substr(-1)==="%"?"prgb":"rgb"):fe(J.h)&&fe(J.s)&&fe(J.v)?(Ee=Te(J.s),Ce=Te(J.v),ne=g(J.h,Ee,Ce),we=!0,De="hsv"):fe(J.h)&&fe(J.s)&&fe(J.l)&&(Ee=Te(J.s),ye=Te(J.l),ne=C(J.h,Ee,ye),we=!0,De="hsl"),J.hasOwnProperty("a")&&(Q=J.a)),Q=W(Q),{ok:we,format:J.format||De,r:B(255,U(ne.r,0)),g:B(255,U(ne.g,0)),b:B(255,U(ne.b,0)),a:Q}}function x(J,ne,Q){return{r:D(J,255)*255,g:D(ne,255)*255,b:D(Q,255)*255}}function O(J,ne,Q){J=D(J,255),ne=D(ne,255),Q=D(Q,255);var Ee=U(J,ne,Q),Ce=B(J,ne,Q),ye,we,De=(Ee+Ce)/2;if(Ee==Ce)ye=we=0;else{var Pe=Ee-Ce;we=De>.5?Pe/(2-Ee-Ce):Pe/(Ee+Ce);switch(Ee){case J:ye=(ne-Q)/Pe+(ne1&&(Re-=1),Re<1/6?ke+(Oe-ke)*6*Re:Re<1/2?Oe:Re<2/3?ke+(Oe-ke)*(2/3-Re)*6:ke}if(ne===0)Ee=Ce=ye=Q;else{var De=Q<.5?Q*(1+ne):Q+ne-Q*ne,Pe=2*Q-De;Ee=we(Pe,De,J+1/3),Ce=we(Pe,De,J),ye=we(Pe,De,J-1/3)}return{r:Ee*255,g:Ce*255,b:ye*255}}function T(J,ne,Q){J=D(J,255),ne=D(ne,255),Q=D(Q,255);var Ee=U(J,ne,Q),Ce=B(J,ne,Q),ye,we,De=Ee,Pe=Ee-Ce;if(we=Ee===0?0:Pe/Ee,Ee==Ce)ye=0;else{switch(Ee){case J:ye=(ne-Q)/Pe+(ne>1)+720)%360;--ne;)Ee.h=(Ee.h+Ce)%360,ye.push(L(Ee));return ye}function E(J,ne){ne=ne||6;for(var Q=L(J).toHsv(),Ee=Q.h,Ce=Q.s,ye=Q.v,we=[],De=1/ne;ne--;)we.push(L({h:Ee,s:Ce,v:ye})),ye=(ye+De)%1;return we}L.mix=function(J,ne,Q){Q=Q===0?0:Q||50;var Ee=L(J).toRgb(),Ce=L(ne).toRgb(),ye=Q/100,we={r:(Ce.r-Ee.r)*ye+Ee.r,g:(Ce.g-Ee.g)*ye+Ee.g,b:(Ce.b-Ee.b)*ye+Ee.b,a:(Ce.a-Ee.a)*ye+Ee.a};return L(we)},L.readability=function(J,ne){var Q=L(J),Ee=L(ne);return(V.max(Q.getLuminance(),Ee.getLuminance())+.05)/(V.min(Q.getLuminance(),Ee.getLuminance())+.05)},L.isReadable=function(J,ne,Q){var Ee=L.readability(J,ne),Ce,ye;ye=!1,Ce=me(Q);switch(Ce.level+Ce.size){case"AAsmall":case"AAAlarge":ye=Ee>=4.5;break;case"AAlarge":ye=Ee>=3;break;case"AAAsmall":ye=Ee>=7;break}return ye},L.mostReadable=function(J,ne,Q){var Ee=null,Ce=0,ye,we,De,Pe;Q=Q||{},we=Q.includeFallbackColors,De=Q.level,Pe=Q.size;for(var ke=0;keCe&&(Ce=ye,Ee=L(ne[ke]));return L.isReadable(J,Ee,{level:De,size:Pe})||!we?Ee:(Q.includeFallbackColors=!1,L.mostReadable(J,["#fff","#000"],Q))};var M=L.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},F=L.hexNames=j(M);function j(J){var ne={};for(var Q in J)J.hasOwnProperty(Q)&&(ne[J[Q]]=Q);return ne}function W(J){return J=parseFloat(J),(isNaN(J)||J<0||J>1)&&(J=1),J}function D(J,ne){Y(J)&&(J="100%");var Q=ee(J);return J=B(ne,U(0,parseFloat(J))),Q&&(J=parseInt(J*ne,10)/100),V.abs(J-ne)<1e-6?1:J%ne/parseFloat(ne)}function P(J){return B(1,U(0,J))}function H(J){return parseInt(J,16)}function Y(J){return typeof J=="string"&&J.indexOf(".")!=-1&&parseFloat(J)===1}function ee(J){return typeof J=="string"&&J.indexOf("%")!=-1}function oe(J){return J.length==1?"0"+J:""+J}function Te(J){return J<=1&&(J=J*100+"%"),J}function ve(J){return V.round(parseFloat(J)*255).toString(16)}function ge(J){return H(J)/255}var he=function(){var J="[-\\+]?\\d+%?",ne="[-\\+]?\\d*\\.\\d+%?",Q="(?:"+ne+")|(?:"+J+")",Ee="[\\s|\\(]+("+Q+")[,|\\s]+("+Q+")[,|\\s]+("+Q+")\\s*\\)?",Ce="[\\s|\\(]+("+Q+")[,|\\s]+("+Q+")[,|\\s]+("+Q+")[,|\\s]+("+Q+")\\s*\\)?";return{CSS_UNIT:new RegExp(Q),rgb:new RegExp("rgb"+Ee),rgba:new RegExp("rgba"+Ce),hsl:new RegExp("hsl"+Ee),hsla:new RegExp("hsla"+Ce),hsv:new RegExp("hsv"+Ee),hsva:new RegExp("hsva"+Ce),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function fe(J){return!!he.CSS_UNIT.exec(J)}function ae(J){J=J.replace(A,"").replace(G,"").toLowerCase();var ne=!1;if(M[J])J=M[J],ne=!0;else if(J=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var Q;return(Q=he.rgb.exec(J))?{r:Q[1],g:Q[2],b:Q[3]}:(Q=he.rgba.exec(J))?{r:Q[1],g:Q[2],b:Q[3],a:Q[4]}:(Q=he.hsl.exec(J))?{h:Q[1],s:Q[2],l:Q[3]}:(Q=he.hsla.exec(J))?{h:Q[1],s:Q[2],l:Q[3],a:Q[4]}:(Q=he.hsv.exec(J))?{h:Q[1],s:Q[2],v:Q[3]}:(Q=he.hsva.exec(J))?{h:Q[1],s:Q[2],v:Q[3],a:Q[4]}:(Q=he.hex8.exec(J))?{r:H(Q[1]),g:H(Q[2]),b:H(Q[3]),a:ge(Q[4]),format:ne?"name":"hex8"}:(Q=he.hex6.exec(J))?{r:H(Q[1]),g:H(Q[2]),b:H(Q[3]),format:ne?"name":"hex"}:(Q=he.hex4.exec(J))?{r:H(Q[1]+""+Q[1]),g:H(Q[2]+""+Q[2]),b:H(Q[3]+""+Q[3]),a:ge(Q[4]+""+Q[4]),format:ne?"name":"hex8"}:(Q=he.hex3.exec(J))?{r:H(Q[1]+""+Q[1]),g:H(Q[2]+""+Q[2]),b:H(Q[3]+""+Q[3]),format:ne?"name":"hex"}:!1}function me(J){var ne,Q;return J=J||{level:"AA",size:"small"},ne=(J.level||"AA").toUpperCase(),Q=(J.size||"small").toLowerCase(),ne!=="AA"&&ne!=="AAA"&&(ne="AA"),Q!=="small"&&Q!=="large"&&(Q="small"),{level:ne,size:Q}}st.exports?st.exports=L:!(re=function(){return L}.call(ze,q,ze,st),re!==void 0&&(st.exports=re))})(Math)},bT9E:function(st,ze,q){"use strict";q.d(ze,"a",function(){return V});var re=q("VTBJ");function V(A,G){var I=Object(re.a)({},A);return Array.isArray(G)&&G.forEach(function(R){delete I[R]}),I}},c5Ni:function(st,ze,q){},dejd:function(st,ze,q){},dmUQ:function(st,ze,q){"use strict";var re=q("Ff2n"),V=q("rePB"),A=q("1OyB"),G=q("vuIU"),I=q("Ji7U"),R=q("md7G"),B=q("foSv"),U=q("cDcd"),k=q.n(U),L=q("TSYQ"),y=q.n(L),x=q("4IlW");function O(l,a){var v=Object.keys(l);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(l);a&&(m=m.filter(function(E){return Object.getOwnPropertyDescriptor(l,E).enumerable})),v.push.apply(v,m)}return v}function C(l){for(var a=1;a1?ee-1:0),Te=1;Te1?D-1:0),H=1;H=0)return parseInt(W.slice(W.indexOf("e-")+2),10);var D=0;return W.indexOf(".")>=0&&(D=W.length-W.indexOf(".")-1),D},E.getInputDisplayValue=function(j){var W=j||E.state,D=W.focused,P=W.inputValue,H=W.value,Y;D?Y=P:Y=E.toPrecisionAsStep(H),Y==null&&(Y="");var ee=E.formatWrapper(Y);return f(E.props.decimalSeparator)&&(ee=ee.toString().replace(".",E.props.decimalSeparator)),ee},E.recordCursorPosition=function(){try{E.cursorStart=E.input.selectionStart,E.cursorEnd=E.input.selectionEnd,E.currentValue=E.input.value,E.cursorBefore=E.input.value.substring(0,E.cursorStart),E.cursorAfter=E.input.value.substring(E.cursorEnd)}catch(j){}},E.restoreByAfter=function(j){if(j===void 0)return!1;var W=E.input.value,D=W.lastIndexOf(j);if(D===-1)return!1;var P=E.cursorBefore.length;return E.lastKeyCode===x.a.DELETE&&E.cursorBefore.charAt(P-1)===j[0]?(E.fixCaret(P,P),!0):D+j.length===W.length?(E.fixCaret(D,D),!0):!1},E.partRestoreByAfter=function(j){return j===void 0?!1:Array.prototype.some.call(j,function(W,D){var P=j.substring(D);return E.restoreByAfter(P)})},E.isNotCompleteNumber=function(j){return isNaN(j)||j===""||j===null||j&&j.toString().indexOf(".")===j.toString().length-1},E.stop=function(){E.autoStepTimer&&clearTimeout(E.autoStepTimer)},E.down=function(j,W,D){E.pressingUpOrDown=!0,E.step("down",j,W,D)},E.up=function(j,W,D){E.pressingUpOrDown=!0,E.step("up",j,W,D)},E.saveInput=function(j){E.input=j};var M=m.value;M===void 0&&(M=m.defaultValue),E.state={focused:m.autoFocus};var F=E.getValidValue(E.toNumber(M));return E.state=C(C({},E.state),{},{inputValue:E.toPrecisionAsStep(F),value:F}),E}return Object(G.a)(v,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(E){var M=this.props,F=M.value,j=M.onChange,W=M.max,D=M.min,P=this.state.focused;if(E){if(!_(E.value,F)||!_(E.max,W)||!_(E.min,D)){var H=P?F:this.getValidValue(F),Y;this.pressingUpOrDown?Y=H:this.inputting?Y=this.rawInput:Y=this.toPrecisionAsStep(H),this.setState({value:H,inputValue:Y})}var ee="value"in this.props?F:this.state.value;"max"in this.props&&E.max!==W&&typeof ee=="number"&&ee>W&&j&&j(W),"min"in this.props&&E.min!==D&&typeof ee=="number"&&ee1&&arguments[1]!==void 0?arguments[1]:this.props.min,F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,j=parseFloat(E);return isNaN(j)?E:(jF&&(j=F),j)}},{key:"setValue",value:function(E,M){var F=this.props.precision,j=this.isNotCompleteNumber(parseFloat(E))?null:parseFloat(E),W=this.state.value,D=W===void 0?null:W,P=this.state.inputValue,H=P===void 0?null:P,Y=typeof j=="number"?j.toFixed(F):"".concat(j),ee=j!==D||Y!=="".concat(H);return"value"in this.props?(H=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:H},M)):this.setState({value:j,inputValue:this.toPrecisionAsStep(E)},M),ee&&this.props.onChange(j),j}},{key:"getMaxPrecision",value:function(E){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,F=this.props,j=F.precision,W=F.step;if(f(j))return j;var D=this.getPrecision(M),P=this.getPrecision(W),H=this.getPrecision(E);return E?Math.max(H,D+P):D+P}},{key:"getPrecisionFactor",value:function(E){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,F=this.getMaxPrecision(E,M);return Math.pow(10,F)}},{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(E){return this.props.formatter?this.props.formatter(E):E}},{key:"toPrecisionAsStep",value:function(E){if(this.isNotCompleteNumber(E)||E==="")return E;var M=Math.abs(this.getMaxPrecision(E));return isNaN(M)?E.toString():Number(E).toFixed(M)}},{key:"toNumber",value:function(E){var M=this.props.precision,F=this.state.focused,j=E&&E.length>16&&F;return this.isNotCompleteNumber(E)||j?E:f(M)?Math.round(E*Math.pow(10,M))/Math.pow(10,M):Number(E)}},{key:"upStep",value:function(E,M){var F=this.props.step,j=this.getPrecisionFactor(E,M),W=Math.abs(this.getMaxPrecision(E,M)),D=((j*E+j*F*M)/j).toFixed(W);return this.toNumber(D)}},{key:"downStep",value:function(E,M){var F=this.props.step,j=this.getPrecisionFactor(E,M),W=Math.abs(this.getMaxPrecision(E,M)),D=((j*E-j*F*M)/j).toFixed(W);return this.toNumber(D)}},{key:"step",value:function(E,M){var F=this,j=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,W=arguments.length>3?arguments[3]:void 0;this.stop(),M&&(M.persist(),M.preventDefault());var D=this.props;if(D.disabled)return;var P=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(P))return;var H=this["".concat(E,"Step")](P,j),Y=H>D.max||HD.max?H=D.max:H=oe),Ie=(rt||rt===0)&&(isNaN(rt)||Number(rt)<=Te),pe=Le||j||W,se=Ie||j||W,de=y()("".concat(F,"-handler"),"".concat(F,"-handler-up"),Object(V.a)({},"".concat(F,"-handler-up-disabled"),pe)),$=y()("".concat(F,"-handler"),"".concat(F,"-handler-down"),Object(V.a)({},"".concat(F,"-handler-down-disabled"),se)),Z=D?{onTouchStart:pe?d:this.up,onTouchEnd:this.stop}:{onMouseDown:pe?d:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},te=D?{onTouchStart:se?d:this.down,onTouchEnd:this.stop}:{onMouseDown:se?d:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return k.a.createElement("div",{className:qe,style:ve,title:ge,onMouseEnter:he,onMouseLeave:fe,onMouseOver:ae,onMouseOut:me,onFocus:function(){return null},onBlur:function(){return null}},k.a.createElement("div",{className:"".concat(F,"-handler-wrap")},k.a.createElement("span",Object.assign({unselectable:"on"},Z,{role:"button","aria-label":"Increase Value","aria-disabled":pe,className:de}),H||k.a.createElement("span",{unselectable:"on",className:"".concat(F,"-handler-up-inner"),onClick:o})),k.a.createElement("span",Object.assign({unselectable:"on"},te,{role:"button","aria-label":"Decrease Value","aria-disabled":se,className:$}),Y||k.a.createElement("span",{unselectable:"on",className:"".concat(F,"-handler-down-inner"),onClick:o}))),k.a.createElement("div",{className:"".concat(F,"-input-wrap")},k.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":Te,"aria-valuemax":oe,"aria-valuenow":rt,required:J,type:Ee,placeholder:Ce,onPaste:Ge,onClick:ne,onMouseUp:this.onMouseUp,className:"".concat(F,"-input"),tabIndex:Q,autoComplete:P,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:Ze?this.onKeyDown:d,onKeyUp:Ze?this.onKeyUp:d,autoFocus:Oe,maxLength:ke,readOnly:W,disabled:j,max:oe,min:Te,step:Pe,name:Re,title:ge,id:ye,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(Ke),pattern:De,inputMode:we,onInput:$e},Se))))}}]),v}(k.a.Component);b.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:p,min:-p,step:1,style:{},onChange:d,onKeyDown:d,onPressEnter:d,onFocus:d,onBlur:d,parser:u,required:!1,autoComplete:"off"};var h=b,c=ze.a=h},h78n:function(st,ze,q){"use strict";q.d(ze,"a",function(){return E});var re=q("cDcd"),V=q.n(re),A=q("TSYQ"),G=q.n(A),I={className:"",percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,style:{},trailColor:"#D9D9D9",trailWidth:1},R=function(j){var W=j.map(function(){return Object(re.useRef)()}),D=Object(re.useRef)();return Object(re.useEffect)(function(){var P=Date.now(),H=!1;Object.keys(W).forEach(function(Y){var ee=W[Y].current;if(!ee)return;H=!0;var oe=ee.style;oe.transitionDuration=".3s, .3s, .3s, .06s",D.current&&P-D.current<100&&(oe.transitionDuration="0s, 0s")}),H&&(D.current=Date.now())}),[W]};function B(){return B=Object.assign||function(F){for(var j=1;jF.length)&&(j=F.length);for(var W=0,D=new Array(j);W=0)continue;if(!Object.prototype.propertyIsEnumerable.call(F,D))continue;W[D]=F[D]}}return W}function T(F,j){if(F==null)return{};var W={},D=Object.keys(F),P,H;for(H=0;H=0)continue;W[P]=F[P]}return W}var g=function(j){var W=j.className,D=j.percent,P=j.prefixCls,H=j.strokeColor,Y=j.strokeLinecap,ee=j.strokeWidth,oe=j.style,Te=j.trailColor,ve=j.trailWidth,ge=j.transition,he=C(j,["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"]);delete he.gapPosition;var fe=Array.isArray(D)?D:[D],ae=Array.isArray(H)?H:[H],me=R(fe),J=U(me,1),ne=J[0],Q=ee/2,Ee=100-ee/2,Ce="M ".concat(Y==="round"?Q:0,",").concat(Q,` L `).concat(Y==="round"?Ee:100,",").concat(Q),ye="0 0 100 ".concat(ee),we=0;return V.a.createElement("svg",B({className:G()("".concat(P,"-line"),W),viewBox:ye,preserveAspectRatio:"none",style:oe},he),V.a.createElement("path",{className:"".concat(P,"-line-trail"),d:Ce,strokeLinecap:Y,stroke:Te,strokeWidth:ve||ee,fillOpacity:"0"}),fe.map(function(De,Pe){var ke={strokeDasharray:"".concat(De,"px, 100px"),strokeDashoffset:"-".concat(we,"px"),transition:ge||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},Oe=ae[Pe]||ae[ae.length-1];return we+=De,V.a.createElement("path",{key:Pe,className:"".concat(P,"-line-path"),d:Ce,strokeLinecap:Y,stroke:Oe,strokeWidth:ee,fillOpacity:"0",ref:ne[Pe],style:ke})}))};g.defaultProps=I;var d=g;function o(){return o=Object.assign||function(F){for(var j=1;jF.length)&&(j=F.length);for(var W=0,D=new Array(j);W=0)continue;if(!Object.prototype.propertyIsEnumerable.call(F,D))continue;W[D]=F[D]}}return W}function h(F,j){if(F==null)return{};var W={},D=Object.keys(F),P,H;for(H=0;H=0)continue;W[P]=F[P]}return W}var c=0;function l(F){return+F.replace("%","")}function a(F){return Array.isArray(F)?F:[F]}function v(F,j,W,D){var P=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,H=arguments.length>5?arguments[5]:void 0,Y=50-D/2,ee=0,oe=-Y,Te=0,ve=-2*Y;switch(H){case"left":ee=-Y,oe=0,Te=2*Y,ve=0;break;case"right":ee=Y,oe=0,Te=-2*Y,ve=0;break;case"bottom":oe=Y,ve=2*Y;break;default:}var ge="M 50,50 m ".concat(ee,",").concat(oe,` a `).concat(Y,",").concat(Y," 0 1 1 ").concat(Te,",").concat(-ve,` a `).concat(Y,",").concat(Y," 0 1 1 ").concat(-Te,",").concat(ve),he=Math.PI*2*Y,fe={stroke:W,strokeDasharray:"".concat(j/100*(he-P),"px ").concat(he,"px"),strokeDashoffset:"-".concat(P/2+F/100*(he-P),"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"};return{pathString:ge,pathStyle:fe}}var m=function(j){var W=j.prefixCls,D=j.strokeWidth,P=j.trailWidth,H=j.gapDegree,Y=j.gapPosition,ee=j.trailColor,oe=j.strokeLinecap,Te=j.style,ve=j.className,ge=j.strokeColor,he=j.percent,fe=b(j,["prefixCls","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"]),ae=Object(re.useMemo)(function(){return c+=1,c},[]),me=v(0,100,ee,D,H,Y),J=me.pathString,ne=me.pathStyle,Q=a(he),Ee=a(ge),Ce=Ee.find(function(ke){return Object.prototype.toString.call(ke)==="[object Object]"}),ye=R(Q),we=u(ye,1),De=we[0],Pe=function(){var Oe=0;return Q.map(function(Re,Ge){var $e=Ee[Ge]||Ee[Ee.length-1],Be=Object.prototype.toString.call($e)==="[object Object]"?"url(#".concat(W,"-gradient-").concat(ae,")"):"",He=v(Oe,Re,$e,D,H,Y);return Oe+=Re,V.a.createElement("path",{key:Ge,className:"".concat(W,"-circle-path"),d:He.pathString,stroke:Be,strokeLinecap:oe,strokeWidth:D,opacity:Re===0?0:1,fillOpacity:"0",style:He.pathStyle,ref:De[Ge]})})};return V.a.createElement("svg",o({className:G()("".concat(W,"-circle"),ve),viewBox:"0 0 100 100",style:Te},fe),Ce&&V.a.createElement("defs",null,V.a.createElement("linearGradient",{id:"".concat(W,"-gradient-").concat(ae),x1:"100%",y1:"0%",x2:"0%",y2:"0%"},Object.keys(Ce).sort(function(ke,Oe){return l(ke)-l(Oe)}).map(function(ke,Oe){return V.a.createElement("stop",{key:Oe,offset:ke,stopColor:Ce[ke]})}))),V.a.createElement("path",{className:"".concat(W,"-circle-trail"),d:J,stroke:ee,strokeLinecap:oe,strokeWidth:P||D,fillOpacity:"0",style:ne}),Pe().reverse())};m.defaultProps=I;var E=m,M={Line:d,Circle:E}},kSUc:function(st,ze,q){},lZu9:function(st,ze,q){(function(re){re(q("VrN/"),q("1eCo"),q("8EBN"))})(function(re){"use strict";re.defineMode("markdown",function(V,A){var G=re.getMode(V,"text/html"),I=G.name=="null";function R(D){if(re.findModeByName){var P=re.findModeByName(D);P&&(D=P.mime||P.mimes[0])}var H=re.getMode(V,D);return H.name=="null"?null:H}A.highlightFormatting===void 0&&(A.highlightFormatting=!1),A.maxBlockquoteDepth===void 0&&(A.maxBlockquoteDepth=0),A.taskLists===void 0&&(A.taskLists=!1),A.strikethrough===void 0&&(A.strikethrough=!1),A.emoji===void 0&&(A.emoji=!1),A.fencedCodeBlockHighlighting===void 0&&(A.fencedCodeBlockHighlighting=!0),A.fencedCodeBlockDefaultMode===void 0&&(A.fencedCodeBlockDefaultMode="text/plain"),A.xml===void 0&&(A.xml=!0),A.tokenTypeOverrides===void 0&&(A.tokenTypeOverrides={});var B={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough",emoji:"builtin"};for(var U in B)B.hasOwnProperty(U)&&A.tokenTypeOverrides[U]&&(B[U]=A.tokenTypeOverrides[U]);var k=/^([*\-_])(?:\s*\1){2,}\s*$/,L=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,y=/^\[(x| )\](?=\s)/i,x=A.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,O=/^ {0,3}(?:\={1,}|-{2,})\s*$/,C=/^[^#!\[\]*_\\<>` "'(~:]+/,T=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,g=/^\s*\[[^\]]+?\]:.*$/,d=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,o=" ";function u(D,P,H){return P.f=P.inline=H,H(D,P)}function s(D,P,H){return P.f=P.block=H,H(D,P)}function w(D){return!D||!/\S/.test(D.string)}function p(D){if(D.linkTitle=!1,D.linkHref=!1,D.linkText=!1,D.em=!1,D.strong=!1,D.strikethrough=!1,D.quote=0,D.indentedCode=!1,D.f==_){var P=I;if(!P){var H=re.innerMode(G,D.htmlState);P=H.mode.name=="xml"&&H.state.tagStart===null&&!H.state.context&&H.state.tokenize.isInText}P&&(D.f=l,D.block=f,D.htmlState=null)}return D.trailingSpace=0,D.trailingSpaceNewLine=!1,D.prevLine=D.thisLine,D.thisLine={stream:null},null}function f(D,P){var H=D.column()===P.indentation,Y=w(P.prevLine.stream),ee=P.indentedCode,oe=P.prevLine.hr,Te=P.list!==!1,ve=(P.listStack[P.listStack.length-1]||0)+3;P.indentedCode=!1;var ge=P.indentation;if(P.indentationDiff===null&&(P.indentationDiff=P.indentation,Te)){for(P.list=null;ge=4&&(ee||P.prevLine.fencedCodeEnd||P.prevLine.header||Y))return D.skipToEnd(),P.indentedCode=!0,B.code;if(D.eatSpace())return null;if(H&&P.indentation<=ve&&(ae=D.match(x))&&ae[1].length<=6)return P.quote=0,P.header=ae[1].length,P.thisLine.header=!0,A.highlightFormatting&&(P.formatting="header"),P.f=P.inline,h(P);if(P.indentation<=ve&&D.eat(">"))return P.quote=H?1:P.quote+1,A.highlightFormatting&&(P.formatting="quote"),D.eatSpace(),h(P);if(!fe&&!P.setext&&H&&P.indentation<=ve&&(ae=D.match(L))){var me=ae[1]?"ol":"ul";return P.indentation=ge+D.current().length,P.list=!0,P.quote=0,P.listStack.push(P.indentation),P.em=!1,P.strong=!1,P.code=!1,P.strikethrough=!1,A.taskLists&&D.match(y,!1)&&(P.taskList=!0),P.f=P.inline,A.highlightFormatting&&(P.formatting=["list","list-"+me]),h(P)}else{if(H&&P.indentation<=ve&&(ae=D.match(T,!0)))return P.quote=0,P.fencedEndRE=new RegExp(ae[1]+"+ *$"),P.localMode=A.fencedCodeBlockHighlighting&&R(ae[2]||A.fencedCodeBlockDefaultMode),P.localMode&&(P.localState=re.startState(P.localMode)),P.f=P.block=b,A.highlightFormatting&&(P.formatting="code-block"),P.code=-1,h(P);if(P.setext||(!he||!Te)&&!P.quote&&P.list===!1&&!P.code&&!fe&&!g.test(D.string)&&(ae=D.lookAhead(1))&&(ae=ae.match(O)))return P.setext?(P.header=P.setext,P.setext=0,D.skipToEnd(),A.highlightFormatting&&(P.formatting="header")):(P.header=ae[0].charAt(0)=="="?1:2,P.setext=P.header),P.thisLine.header=!0,P.f=P.inline,h(P);if(fe)return D.skipToEnd(),P.hr=!0,P.thisLine.hr=!0,B.hr;if(D.peek()==="[")return u(D,P,M)}return u(D,P,P.inline)}function _(D,P){var H=G.token(D,P.htmlState);if(!I){var Y=re.innerMode(G,P.htmlState);(Y.mode.name=="xml"&&Y.state.tagStart===null&&!Y.state.context&&Y.state.tokenize.isInText||P.md_inside&&D.current().indexOf(">")>-1)&&(P.f=l,P.block=f,P.htmlState=null)}return H}function b(D,P){var H=P.listStack[P.listStack.length-1]||0,Y=P.indentation=D.quote?P.push(B.formatting+"-"+D.formatting[H]+"-"+D.quote):P.push("error"))}if(D.taskOpen)return P.push("meta"),P.length?P.join(" "):null;if(D.taskClosed)return P.push("property"),P.length?P.join(" "):null;if(D.linkHref?P.push(B.linkHref,"url"):(D.strong&&P.push(B.strong),D.em&&P.push(B.em),D.strikethrough&&P.push(B.strikethrough),D.emoji&&P.push(B.emoji),D.linkText&&P.push(B.linkText),D.code&&P.push(B.code),D.image&&P.push(B.image),D.imageAltText&&P.push(B.imageAltText,"link"),D.imageMarker&&P.push(B.imageMarker)),D.header&&P.push(B.header,B.header+"-"+D.header),D.quote&&(P.push(B.quote),!A.maxBlockquoteDepth||A.maxBlockquoteDepth>=D.quote?P.push(B.quote+"-"+D.quote):P.push(B.quote+"-"+A.maxBlockquoteDepth)),D.list!==!1){var Y=(D.listStack.length-1)%3;Y?Y===1?P.push(B.list2):P.push(B.list3):P.push(B.list1)}return D.trailingSpaceNewLine?P.push("trailing-space-new-line"):D.trailingSpace&&P.push("trailing-space-"+(D.trailingSpace%2?"a":"b")),P.length?P.join(" "):null}function c(D,P){return D.match(C,!0)?h(P):void 0}function l(D,P){var H=P.text(D,P);if(typeof H!="undefined")return H;if(P.list)return P.list=null,h(P);if(P.taskList){var Y=D.match(y,!0)[1]===" ";return Y?P.taskOpen=!0:P.taskClosed=!0,A.highlightFormatting&&(P.formatting="task"),P.taskList=!1,h(P)}if(P.taskOpen=!1,P.taskClosed=!1,P.header&&D.match(/^#+$/,!0))return A.highlightFormatting&&(P.formatting="header"),h(P);var ee=D.next();if(P.linkTitle){P.linkTitle=!1;var oe=ee;ee==="("&&(oe=")"),oe=(oe+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var Te="^\\s*(?:[^"+oe+"\\\\]+|\\\\\\\\|\\\\.)"+oe;if(D.match(new RegExp(Te),!0))return B.linkHref}if(ee==="`"){var ve=P.formatting;A.highlightFormatting&&(P.formatting="code"),D.eatWhile("`");var ge=D.current().length;if(P.code==0&&(!P.quote||ge==1))return P.code=ge,h(P);if(ge==P.code){var he=h(P);return P.code=0,he}else return P.formatting=ve,h(P)}else if(P.code)return h(P);if(ee==="\\"&&(D.next(),A.highlightFormatting)){var fe=h(P),ae=B.formatting+"-escape";return fe?fe+" "+ae:ae}if(ee==="!"&&D.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return P.imageMarker=!0,P.image=!0,A.highlightFormatting&&(P.formatting="image"),h(P);if(ee==="["&&P.imageMarker&&D.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return P.imageMarker=!1,P.imageAltText=!0,A.highlightFormatting&&(P.formatting="image"),h(P);if(ee==="]"&&P.imageAltText){A.highlightFormatting&&(P.formatting="image");var fe=h(P);return P.imageAltText=!1,P.image=!1,P.inline=P.f=v,fe}if(ee==="["&&!P.image)return P.linkText&&D.match(/^.*?\]/)||(P.linkText=!0,A.highlightFormatting&&(P.formatting="link")),h(P);if(ee==="]"&&P.linkText){A.highlightFormatting&&(P.formatting="link");var fe=h(P);return P.linkText=!1,P.inline=P.f=D.match(/\(.*?\)| ?\[.*?\]/,!1)?v:l,fe}if(ee==="<"&&D.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){P.f=P.inline=a,A.highlightFormatting&&(P.formatting="link");var fe=h(P);return fe?fe+=" ":fe="",fe+B.linkInline}if(ee==="<"&&D.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){P.f=P.inline=a,A.highlightFormatting&&(P.formatting="link");var fe=h(P);return fe?fe+=" ":fe="",fe+B.linkEmail}if(A.xml&&ee==="<"&&D.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var me=D.string.indexOf(">",D.pos);if(me!=-1){var J=D.string.substring(D.start,me);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(J)&&(P.md_inside=!0)}return D.backUp(1),P.htmlState=re.startState(G),s(D,P,_)}if(A.xml&&ee==="<"&&D.match(/^\/\w*?>/))return P.md_inside=!1,"tag";if(ee==="*"||ee==="_"){for(var ne=1,Q=D.pos==1?" ":D.string.charAt(D.pos-2);ne<3&&D.eat(ee);)ne++;var Ee=D.peek()||" ",Ce=!/\s/.test(Ee)&&(!d.test(Ee)||/\s/.test(Q)||d.test(Q)),ye=!/\s/.test(Q)&&(!d.test(Q)||/\s/.test(Ee)||d.test(Ee)),we=null,De=null;if(ne%2&&(!P.em&&Ce&&(ee==="*"||!ye||d.test(Q))?we=!0:P.em==ee&&ye&&(ee==="*"||!Ce||d.test(Ee))&&(we=!1)),ne>1&&(!P.strong&&Ce&&(ee==="*"||!ye||d.test(Q))?De=!0:P.strong==ee&&ye&&(ee==="*"||!Ce||d.test(Ee))&&(De=!1)),De!=null||we!=null){A.highlightFormatting&&(P.formatting=we==null?"strong":De==null?"em":"strong em"),we===!0&&(P.em=ee),De===!0&&(P.strong=ee);var he=h(P);return we===!1&&(P.em=!1),De===!1&&(P.strong=!1),he}}else if(ee===" "&&(D.eat("*")||D.eat("_"))){if(D.peek()===" ")return h(P);D.backUp(1)}if(A.strikethrough){if(ee==="~"&&D.eatWhile(ee)){if(P.strikethrough){A.highlightFormatting&&(P.formatting="strikethrough");var he=h(P);return P.strikethrough=!1,he}else if(D.match(/^[^\s]/,!1))return P.strikethrough=!0,A.highlightFormatting&&(P.formatting="strikethrough"),h(P)}else if(ee===" "&&D.match(/^~~/,!0)){if(D.peek()===" ")return h(P);D.backUp(2)}}if(A.emoji&&ee===":"&&D.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){P.emoji=!0,A.highlightFormatting&&(P.formatting="emoji");var Pe=h(P);return P.emoji=!1,Pe}return ee===" "&&(D.match(/^ +$/,!1)?P.trailingSpace++:P.trailingSpace&&(P.trailingSpaceNewLine=!0)),h(P)}function a(D,P){var H=D.next();if(H===">"){P.f=P.inline=l,A.highlightFormatting&&(P.formatting="link");var Y=h(P);return Y?Y+=" ":Y="",Y+B.linkInline}return D.match(/^[^>]+/,!0),B.linkInline}function v(D,P){if(D.eatSpace())return null;var H=D.next();return H==="("||H==="["?(P.f=P.inline=E(H==="("?")":"]"),A.highlightFormatting&&(P.formatting="link-string"),P.linkHref=!0,h(P)):"error"}var m={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function E(D){return function(P,H){var Y=P.next();if(Y===D){H.f=H.inline=l,A.highlightFormatting&&(H.formatting="link-string");var ee=h(H);return H.linkHref=!1,ee}return P.match(m[D]),H.linkHref=!0,h(H)}}function M(D,P){return D.match(/^([^\]\\]|\\.)*\]:/,!1)?(P.f=F,D.next(),A.highlightFormatting&&(P.formatting="link"),P.linkText=!0,h(P)):u(D,P,l)}function F(D,P){if(D.match(/^\]:/,!0)){P.f=P.inline=j,A.highlightFormatting&&(P.formatting="link");var H=h(P);return P.linkText=!1,H}return D.match(/^([^\]\\]|\\.)+/,!0),B.linkText}function j(D,P){return D.eatSpace()?null:(D.match(/^[^\s]+/,!0),D.peek()===void 0?P.linkTitle=!0:D.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),P.f=P.inline=l,B.linkHref+" url")}var W={startState:function(){return{f,prevLine:{stream:null},thisLine:{stream:null},block:f,htmlState:null,indentation:0,inline:l,text:c,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(D){return{f:D.f,prevLine:D.prevLine,thisLine:D.thisLine,block:D.block,htmlState:D.htmlState&&re.copyState(G,D.htmlState),indentation:D.indentation,localMode:D.localMode,localState:D.localMode?re.copyState(D.localMode,D.localState):null,inline:D.inline,text:D.text,formatting:!1,linkText:D.linkText,linkTitle:D.linkTitle,linkHref:D.linkHref,code:D.code,em:D.em,strong:D.strong,strikethrough:D.strikethrough,emoji:D.emoji,header:D.header,setext:D.setext,hr:D.hr,taskList:D.taskList,list:D.list,listStack:D.listStack.slice(0),quote:D.quote,indentedCode:D.indentedCode,trailingSpace:D.trailingSpace,trailingSpaceNewLine:D.trailingSpaceNewLine,md_inside:D.md_inside,fencedEndRE:D.fencedEndRE}},token:function(D,P){if(P.formatting=!1,D!=P.thisLine.stream){if(P.header=0,P.hr=!1,D.match(/^\s*$/,!0))return p(P),null;if(P.prevLine=P.thisLine,P.thisLine={stream:D},P.taskList=!1,P.trailingSpace=0,P.trailingSpaceNewLine=!1,!P.localState&&(P.f=P.block,P.f!=_)){var H=D.match(/^\s*/,!0)[0].replace(/\t/g,o).length;if(P.indentation=H,P.indentationDiff=null,H>0)return null}}return P.f(D,P)},innerMode:function(D){return D.block==_?{state:D.htmlState,mode:G}:D.localState?{state:D.localState,mode:D.localMode}:{state:D,mode:W}},indent:function(D,P,H){return D.block==_&&G.indent?G.indent(D.htmlState,P,H):D.localState&&D.localMode.indent?D.localMode.indent(D.localState,P,H):re.Pass},blankLine:p,getType:h,blockCommentStart:"",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return W},"xml"),re.defineMIME("text/markdown","markdown"),re.defineMIME("text/x-markdown","markdown")})},osHv:function(st,ze,q){(function(re){re(q("VrN/"))})(function(re){"use strict";var V=re.Pos;function A(d,o){return d.line-o.line||d.ch-o.ch}var G="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",I=G+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",R=new RegExp("<(/?)(["+G+"]["+I+"]*)","g");function B(d,o,u,s){this.line=o,this.ch=u,this.cm=d,this.text=d.getLine(o),this.min=s?Math.max(s.from,d.firstLine()):d.firstLine(),this.max=s?Math.min(s.to-1,d.lastLine()):d.lastLine()}function U(d,o){var u=d.cm.getTokenTypeAt(V(d.line,o));return u&&/\btag\b/.test(u)}function k(d){return d.line>=d.max?void 0:(d.ch=0,d.text=d.cm.getLine(++d.line),!0)}function L(d){return d.line<=d.min?void 0:(d.text=d.cm.getLine(--d.line),d.ch=d.text.length,!0)}function y(d){for(;;){var o=d.text.indexOf(">",d.ch);if(o==-1){if(k(d))continue;return}if(!U(d,o+1)){d.ch=o+1;continue}var u=d.text.lastIndexOf("/",o),s=u>-1&&!/\S/.test(d.text.slice(u+1,o));return d.ch=o+1,s?"selfClose":"regular"}}function x(d){for(;;){var o=d.ch?d.text.lastIndexOf("<",d.ch-1):-1;if(o==-1){if(L(d))continue;return}if(!U(d,o+1)){d.ch=o;continue}R.lastIndex=o,d.ch=o;var u=R.exec(d.text);if(u&&u.index==o)return u}}function O(d){for(;;){R.lastIndex=d.ch;var o=R.exec(d.text);if(!o){if(k(d))continue;return}if(!U(d,o.index+1)){d.ch=o.index+1;continue}return d.ch=o.index+o[0].length,o}}function C(d){for(;;){var o=d.ch?d.text.lastIndexOf(">",d.ch-1):-1;if(o==-1){if(L(d))continue;return}if(!U(d,o+1)){d.ch=o;continue}var u=d.text.lastIndexOf("/",o),s=u>-1&&!/\S/.test(d.text.slice(u+1,o));return d.ch=o+1,s?"selfClose":"regular"}}function T(d,o){for(var u=[];;){var s=O(d),w,p=d.line,f=d.ch-(s?s[0].length:0);if(!s||!(w=y(d)))return;if(w=="selfClose")continue;if(s[1]){for(var _=u.length-1;_>=0;--_)if(u[_]==s[2]){u.length=_;break}if(_<0&&(!o||o==s[2]))return{tag:s[2],from:V(p,f),to:V(d.line,d.ch)}}else u.push(s[2])}}function g(d,o){for(var u=[];;){var s=C(d);if(!s)return;if(s=="selfClose"){x(d);continue}var w=d.line,p=d.ch,f=x(d);if(!f)return;if(f[1])u.push(f[2]);else{for(var _=u.length-1;_>=0;--_)if(u[_]==f[2]){u.length=_;break}if(_<0&&(!o||o==f[2]))return{tag:f[2],from:V(d.line,d.ch),to:V(w,p)}}}}re.registerHelper("fold","xml",function(d,o){for(var u=new B(d,o.line,0);;){var s=O(u);if(!s||u.line!=o.line)return;var w=y(u);if(!w)return;if(!s[1]&&w!="selfClose"){var p=V(u.line,u.ch),f=T(u,s[2]);return f&&A(f.from,p)>0?{from:p,to:f.from}:null}}}),re.findMatchingTag=function(d,o,u){var s=new B(d,o.line,o.ch,u);if(s.text.indexOf(">")==-1&&s.text.indexOf("<")==-1)return;var w=y(s),p=w&&V(s.line,s.ch),f=w&&x(s);if(!w||!f||A(s,o)>0)return;var _={from:V(s.line,s.ch),to:p,tag:f[2]};return w=="selfClose"?{open:_,close:null,at:"open"}:f[1]?{open:g(s,f[2]),close:_,at:"close"}:(s=new B(d,p.line,p.ch,u),{open:_,close:T(s,f[2]),at:"open"})},re.findEnclosingTag=function(d,o,u,s){for(var w=new B(d,o.line,o.ch,u);;){var p=g(w,s);if(!p)break;var f=new B(d,o.line,o.ch,u),_=T(f,p.tag);if(_)return{open:p,close:_}}},re.scanForClosingTag=function(d,o,u,s){var w=new B(d,o.line,o.ch,s?{from:0,to:s}:null);return T(w,u)}})},p5ED:function(st,ze,q){"use strict";var re=q("+L6B"),V=q("2/Rp"),A=q("5Dmo"),G=q("3S7+"),I=q("k1fw"),R=q("tJVT"),B=q("cDcd"),U=q.n(B),k=q("vHTk"),L=q.n(k),y=q("yEEn"),x=q("ZW9T"),O=q("1vsH");ze.a=function(C){var T=C.name,g=C.data,d=C.theme,o=C.type,u=C.filename,s=C.monacoEditor,w=C.className,p=C.style,f=C.close,_=C.onClose,b=C.hasMask,h=Object(B.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),c=Object(R.a)(h,2),l=c[0],a=c[1],v=Object(B.useState)(""),m=Object(R.a)(v,2),E=m[0],M=m[1],F,j=1024*1024,W=10*j,D=Object(B.useRef)();o==="office"&&(F=Object(O.V)(g).filesize,F>W&&(o="other")),u&&(s.filename=u),Object(B.useEffect)(function(){var Y,ee,oe=(Y=document.cookie)===null||Y===void 0||((ee=Y.replace(/\s/g,""))===null||ee===void 0)?void 0:ee.split(";");oe==null||oe.map(function(Te){var ve=Te.split("=");ve[0]==="_educoder_session"&&M(ve[1])})},[]);var P=function(){if(g.startsWith("http")||g.startsWith("/")){H();return}Object(O.z)(u||"educoder",g,u)},H=function(){Object(O.x)(u||T,g)};return console.log("data:",g,"fileanme:",u," name:",T),U.a.createElement("div",{style:Object(I.a)({},p||{}),className:"".concat(b&&L.a.bgBlack," ").concat(o?L.a.wrp:"hide")},f&&U.a.createElement("div",{className:L.a.close,ref:D},U.a.createElement(G.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return D.current}},U.a.createElement("span",{onClick:H},U.a.createElement("i",{className:"icon-quxiaozhiding"}))),U.a.createElement(G.a,{title:"\u5173\u95ED",getPopupContainer:function(){return D.current}},U.a.createElement("span",{className:"",onClick:_},U.a.createElement("i",{className:"icon-guanbi1"})))),U.a.createElement("div",{className:"".concat(L.a[w]," ").concat(w," ").concat(L.a.monaco," ").concat(o==="txt"?"show":"hide")},o==="txt"&&U.a.createElement(x.b,s)),o==="audio"&&U.a.createElement("audio",{src:"".concat(g!=null&&g.startsWith("/")||(g==null?void 0:g.indexOf("https://"))>-1?g:"data:audio/mp3;base64,").concat(g),autoPlay:!0}),o==="video"&&U.a.createElement(U.a.Fragment,null,g!=null&&g.startsWith("/")?U.a.createElement("video",{controls:!0,src:"".concat(g),autoPlay:!0}):U.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(g),autoPlay:!0})),o==="html"&&U.a.createElement("iframe",{src:g+"&disposition=inline"}),o==="pdf"&&U.a.createElement("embed",{className:L.a.embed,src:g}),o==="image"&&U.a.createElement(U.a.Fragment,null,U.a.createElement("img",{src:"".concat(g!=null&&g.startsWith("/")||(g==null?void 0:g.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(g)})),o==="other"&&U.a.createElement("div",null,U.a.createElement(V.a,{type:"primary",size:"large",onClick:P},U.a.createElement(y.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),(o==="download"||o==="office")&&U.a.createElement(V.a,{type:"primary",size:"large",onClick:P},U.a.createElement(y.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(st,ze,q){},"rAM+":function(st,ze,q){"use strict";q.d(ze,"a",function(){return V});var re=q("Qw5x");function V(A,G){var I;if(typeof Symbol=="undefined"||A[Symbol.iterator]==null){if(Array.isArray(A)||(I=Object(re.a)(A))||G&&A&&typeof A.length=="number"){I&&(A=I);var R=0,B=function(){};return{s:B,n:function(){return R>=A.length?{done:!0}:{done:!1,value:A[R++]}},e:function(x){throw x},f:B}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var U=!0,k=!1,L;return{s:function(){I=A[Symbol.iterator]()},n:function(){var x=I.next();return U=x.done,x},e:function(x){k=!0,L=x},f:function(){try{!U&&I.return!=null&&I.return()}finally{if(k)throw L}}}}},rUJ1:function(st,ze){const q=/[&<>"']/,re=/[&<>"']/g,V=/[<>"']|&(?!#?\w+;)/,A=/[<>"']|&(?!#?\w+;)/g,G={"&":"&","<":"<",">":">",'"':""","'":"'"},I=b=>G[b];function R(b,h){if(h){if(q.test(b))return b.replace(re,I)}else if(V.test(b))return b.replace(A,I);return b}const B=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function U(b){return b.replace(B,(h,c)=>(c=c.toLowerCase(),c==="colon"?":":c.charAt(0)==="#"?c.charAt(1)==="x"?String.fromCharCode(parseInt(c.substring(2),16)):String.fromCharCode(+c.substring(1)):""))}const k=/(^|[^\[])\^/g;function L(b,h){b=b.source||b,h=h||"";const c={replace:(l,a)=>(a=a.source||a,a=a.replace(k,"$1"),b=b.replace(l,a),c),getRegex:()=>new RegExp(b,h)};return c}const y=/[^\w:]/g,x=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function O(b,h,c){if(b){let l;try{l=decodeURIComponent(U(c)).replace(y,"").toLowerCase()}catch(a){return null}if(l.indexOf("javascript:")===0||l.indexOf("vbscript:")===0||l.indexOf("data:")===0)return null}h&&!x.test(c)&&(c=o(h,c));try{c=encodeURI(c).replace(/%25/g,"%")}catch(l){return null}return c}const C={},T=/^[^:]+:\/*[^/]*$/,g=/^([^:]+:)[\s\S]*$/,d=/^([^:]+:\/*[^/]*)[\s\S]*$/;function o(b,h){C[" "+b]||(T.test(b)?C[" "+b]=b+"/":C[" "+b]=p(b,"/",!0)),b=C[" "+b];const c=b.indexOf(":")===-1;return h.substring(0,2)==="//"?c?h:b.replace(g,"$1")+h:h.charAt(0)==="/"?c?h:b.replace(d,"$1")+h:b+h}const u={exec:function(){}};function s(b){let h=1,c,l;for(;h{let M=!1,F=m;for(;--F>=0&&E[F]==="\\";)M=!M;return M?"|":" |"}),l=c.split(/ \|/);let a=0;if(l.length>h)l.splice(h);else for(;l.length0},!1)}function y(x,O){for(var C={main:[O]},T={main:[]},g={main:{}};L(C);)for(var d=Object.keys(C),o=0;o=2*_/h||E<=F)return;var j=Number.POSITIVE_INFINITY,W;for(W=d.level-1;W>l;W--){var D=c[W].maxBitrate;if(j=_*D/(8*.8*m),j=E)return;var P=this.bwEstimator.getEstimate();L.logger.warn("Fragment "+d.sn+(o?" part "+o.index:"")+" of level "+d.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+W+` Current BW estimate: `+(Object(G.isFiniteNumber)(P)?(P/1024).toFixed(3):"Unknown")+` Kb/s Estimated load time for current fragment: `+E.toFixed(3)+` s Estimated load time for the next fragment: `+j.toFixed(3)+` s Time to underbuffer: `+F.toFixed(3)+" s"),u.nextLoadLevel=W,this.bwEstimator.sample(b,f.loaded),this.clearTimer(),d.loader&&(this.fragCurrent=this.partCurrent=null,d.loader.abort()),u.trigger(R.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:d,part:o,stats:f})},T.onFragLoaded=function(d,o){var u=o.frag,s=o.part;if(u.type===k.PlaylistLevelType.MAIN&&Object(G.isFiniteNumber)(u.sn)){var w=s?s.stats:u.stats,p=s?s.duration:u.duration;if(this.clearTimer(),this.lastLoadedFragLevel=u.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var f=this.hls.levels[u.level],_=(f.loaded?f.loaded.bytes:0)+w.loaded,b=(f.loaded?f.loaded.duration:0)+p;f.loaded={bytes:_,duration:b},f.realBitrate=Math.round(8*_/b)}if(u.bitrateTest){var h={stats:w,frag:u,part:s,id:u.type};this.onFragBuffered(R.Events.FRAG_BUFFERED,h),u.bitrateTest=!1}}},T.onFragBuffered=function(d,o){var u=o.frag,s=o.part,w=s?s.stats:u.stats;if(w.aborted)return;if(u.type!==k.PlaylistLevelType.MAIN||u.sn==="initSegment")return;var p=w.parsing.end-w.loading.start;this.bwEstimator.sample(p,w.loaded),w.bwEstimate=this.bwEstimator.getEstimate(),u.bitrateTest?this.bitrateTestDelay=p/1e3:this.bitrateTestDelay=0},T.onError=function(d,o){switch(o.details){case U.ErrorDetails.FRAG_LOAD_ERROR:case U.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},T.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},T.getNextABRAutoLevel=function(){var d=this.fragCurrent,o=this.partCurrent,u=this.hls,s=u.maxAutoLevel,w=u.config,p=u.minAutoLevel,f=u.media,_=o?o.duration:d?d.duration:0,b=f?f.currentTime:0,h=f&&f.playbackRate!==0?Math.abs(f.playbackRate):1,c=this.bwEstimator?this.bwEstimator.getEstimate():w.abrEwmaDefaultEstimate,l=(B.BufferHelper.bufferInfo(f,b,w.maxBufferHole).end-b)/h,a=this.findBestLevel(c,p,s,l,w.abrBandWidthFactor,w.abrBandWidthUpFactor);if(a>=0)return a;L.logger.trace((l?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var v=_?Math.min(_,w.maxStarvationDelay):w.maxStarvationDelay,m=w.abrBandWidthFactor,E=w.abrBandWidthUpFactor;if(!l){var M=this.bitrateTestDelay;if(M){var F=_?Math.min(_,w.maxLoadingDelay):w.maxLoadingDelay;v=F-M,L.logger.trace("bitrate test took "+Math.round(1e3*M)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*v)+" ms"),m=E=1}}return a=this.findBestLevel(c,p,s,l+v,m,E),Math.max(a,0)},T.findBestLevel=function(d,o,u,s,w,p){for(var f,_=this.fragCurrent,b=this.partCurrent,h=this.lastLoadedFragLevel,c=this.hls.levels,l=c[h],a=!!(l!=null&&(f=l.details)!==null&&f!==void 0&&f.live),v=l==null?void 0:l.codecSet,m=b?b.duration:_?_.duration:0,E=u;E>=o;E--){var M=c[E];if(!M||v&&M.codecSet!==v)continue;var F=M.details,j=(b?F==null?void 0:F.partTarget:F==null?void 0:F.averagetargetduration)||m,W=void 0;E<=h?W=w*d:W=p*d;var D=c[E].maxBitrate,P=D*j/W;if(L.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+E+"/"+Math.round(W)+"/"+D+"/"+j+"/"+s+"/"+P),W>D&&(!P||a&&!this.bitrateTestDelay||P0&&l===-1?(this.log("Override startPosition with lastCurrentTime @"+a.toFixed(3)),this.state=I.State.IDLE):(this.loadedmetadata=!1,this.state=I.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=l,this.tick()},h.doTick=function(){switch(this.state){case I.State.IDLE:this.doTickIdle();break;case I.State.WAITING_TRACK:{var l,a=this.levels,v=this.trackId,m=a==null||((l=a[v])===null||l===void 0)?void 0:l.details;if(m){if(this.waitForCdnTuneIn(m))break;this.state=I.State.WAITING_INIT_PTS}break}case I.State.FRAG_LOADING_WAITING_RETRY:{var E,M=performance.now(),F=this.retryDate;(!F||M>=F||(E=this.media)!==null&&E!==void 0&&E.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=I.State.IDLE);break}case I.State.WAITING_INIT_PTS:{var j=this.waitingData;if(j){var W=j.frag,D=j.part,P=j.cache,H=j.complete;if(this.initPTS[W.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=I.State.FRAG_LOADING;var Y=P.flush(),ee={frag:W,part:D,payload:Y,networkDetails:null};this._handleFragmentLoadProgress(ee),H&&_.prototype._handleFragmentLoadComplete.call(this,ee)}else if(this.videoTrackCC!==this.waitingVideoCC)o.logger.log("Waiting fragment cc ("+W.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var oe=this.getLoadPosition(),Te=B.BufferHelper.bufferInfo(this.mediaBuffer,oe,this.config.maxBufferHole),ve=Object(T.fragmentWithinToleranceTest)(Te.end,this.config.maxFragLookUpTolerance,W);ve<0&&(o.logger.log("Waiting fragment cc ("+W.cc+") @ "+W.start+" cancelled because another fragment at "+Te.end+" is needed"),this.clearWaitingFragment())}}else this.state=I.State.IDLE}}this.onTickEnd()},h.clearWaitingFragment=function(){var l=this.waitingData;l&&(this.fragmentTracker.removeFragment(l.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=I.State.IDLE)},h.onTickEnd=function(){var l=this.media;if(!l||!l.readyState)return;var a=this.mediaBuffer?this.mediaBuffer:l,v=a.buffered;!this.loadedmetadata&&v.length&&(this.loadedmetadata=!0),this.lastCurrentTime=l.currentTime},h.doTickIdle=function(){var l,a,v=this.hls,m=this.levels,E=this.media,M=this.trackId,F=v.config;if(!m||!m[M])return;if(!E&&(this.startFragRequested||!F.startFragPrefetch))return;var j=m[M],W=j.details;if(!W||W.live&&this.levelLastLoaded!==M||this.waitForCdnTuneIn(W)){this.state=I.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,y.ElementaryStreamTypes.AUDIO,L.PlaylistLevelType.AUDIO));var D=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,L.PlaylistLevelType.AUDIO);if(D===null)return;var P=D.len,H=this.getMaxBufferLength(),Y=this.audioSwitch;if(P>=H&&!Y)return;if(!Y&&this._streamEnded(D,W)){v.trigger(R.Events.BUFFER_EOS,{type:"audio"}),this.state=I.State.ENDED;return}var ee=W.fragments,oe=ee[0].start,Te=D.end;if(Y){var ve=this.getLoadPosition();Te=ve,W.PTSKnown&&veoe||D.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),E.currentTime=oe+.05))}var ge=this.getNextFragment(Te,W);if(!ge){this.bufferFlushed=!0;return}((l=ge.decryptdata)===null||l===void 0?void 0:l.keyFormat)==="identity"&&!((a=ge.decryptdata)!==null&&a!==void 0&&a.key)?this.loadKey(ge,W):this.loadFragment(ge,W,Te)},h.getMaxBufferLength=function(){var l=_.prototype.getMaxBufferLength.call(this),a=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,L.PlaylistLevelType.MAIN);return a===null?l:Math.max(l,a.len)},h.onMediaDetaching=function(){this.videoBuffer=null,_.prototype.onMediaDetaching.call(this)},h.onAudioTracksUpdated=function(l,a){var v=a.audioTracks;this.resetTransmuxer(),this.levels=v.map(function(m){return new k.Level(m)})},h.onAudioTrackSwitching=function(l,a){var v=!!a.url;this.trackId=a.id;var m=this.fragCurrent;m!=null&&m.loader&&m.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),v?this.setInterval(p):this.resetTransmuxer(),v?(this.audioSwitch=!0,this.state=I.State.IDLE):this.state=I.State.STOPPED,this.tick()},h.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},h.onLevelLoaded=function(l,a){this.mainDetails=a.details},h.onAudioTrackLoaded=function(l,a){var v,m=this.levels,E=a.details,M=a.id;if(!m){this.warn("Audio tracks were reset while loading level "+M);return}this.log("Track "+M+" loaded ["+E.startSN+","+E.endSN+"],duration:"+E.totalduration);var F=m[M],j=0;if(E.live||(v=F.details)!==null&&v!==void 0&&v.live){var W=this.mainDetails;if(E.fragments[0]||(E.deltaUpdateFailed=!0),E.deltaUpdateFailed||!W)return;!F.details&&E.hasProgramDateTime&&W.hasProgramDateTime?(Object(g.alignMediaPlaylistByPDT)(E,W),j=E.fragments[0].start):j=this.alignPlaylists(E,F.details)}F.details=E,this.levelLastLoaded=M,!this.startFragRequested&&(this.mainDetails||!E.live)&&this.setStartPosition(F.details,j),this.state===I.State.WAITING_TRACK&&!this.waitForCdnTuneIn(E)&&(this.state=I.State.IDLE),this.tick()},h._handleFragmentLoadProgress=function(l){var a,v=l.frag,m=l.part,E=l.payload,M=this.config,F=this.trackId,j=this.levels;if(!j){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+v.sn+" of level "+v.level+" will not be buffered");return}var W=j[F];console.assert(W,"Audio track is defined on fragment load progress");var D=W.details;console.assert(D,"Audio track details are defined on fragment load progress");var P=M.defaultAudioCodec||W.audioCodec||"mp4a.40.2",H=this.transmuxer;H||(H=this.transmuxer=new O.default(this.hls,L.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var Y=this.initPTS[v.cc],ee=(a=v.initSegment)===null||a===void 0?void 0:a.data;if(Y!==void 0){var oe=!1,Te=m?m.index:-1,ve=Te!==-1,ge=new C.ChunkMetadata(v.level,v.sn,v.stats.chunkCount,E.byteLength,Te,ve);H.push(E,ee,P,"",v,m,D.totalduration,oe,ge,Y)}else{o.logger.log("Unknown video PTS for cc "+v.cc+", waiting for video PTS before demuxing audio frag "+v.sn+" of ["+D.startSN+" ,"+D.endSN+"],track "+F);var he=this.waitingData=this.waitingData||{frag:v,part:m,cache:new x.default,complete:!1},fe=he.cache;fe.push(new Uint8Array(E)),this.waitingVideoCC=this.videoTrackCC,this.state=I.State.WAITING_INIT_PTS}},h._handleFragmentLoadComplete=function(l){if(this.waitingData){this.waitingData.complete=!0;return}_.prototype._handleFragmentLoadComplete.call(this,l)},h.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},h.onBufferCreated=function(l,a){var v=a.tracks.audio;v&&(this.mediaBuffer=v.buffer),a.tracks.video&&(this.videoBuffer=a.tracks.video.buffer)},h.onFragBuffered=function(l,a){var v=a.frag,m=a.part;if(v.type!==L.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(v)){this.warn("Fragment "+v.sn+(m?" p: "+m.index:"")+" of level "+v.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}v.sn!=="initSegment"&&(this.fragPrevious=v,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(R.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(v,m)},h.onError=function(l,a){switch(a.details){case d.ErrorDetails.FRAG_LOAD_ERROR:case d.ErrorDetails.FRAG_LOAD_TIMEOUT:case d.ErrorDetails.KEY_LOAD_ERROR:case d.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(L.PlaylistLevelType.AUDIO,a);break;case d.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case d.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==I.State.ERROR&&this.state!==I.State.STOPPED&&(this.state=a.fatal?I.State.ERROR:I.State.IDLE,this.warn(a.details+" while loading frag, switching to "+this.state+" state"));break;case d.ErrorDetails.BUFFER_FULL_ERROR:if(a.parent==="audio"&&(this.state===I.State.PARSING||this.state===I.State.PARSED)){var v=!0,m=this.getFwdBufferInfo(this.mediaBuffer,L.PlaylistLevelType.AUDIO);m&&m.len>.5&&(v=!this.reduceMaxBufferLength(m.len)),v&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,_.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},h.onBufferFlushed=function(l,a){var v=a.type;v===y.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},h._handleTransmuxComplete=function(l){var a,v="audio",m=this.hls,E=l.remuxResult,M=l.chunkMeta,F=this.getCurrentContext(M);if(!F){this.warn("The loading context changed while buffering fragment "+M.sn+" of level "+M.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(M.level);return}var j=F.frag,W=F.part,D=E.audio,P=E.text,H=E.id3,Y=E.initSegment;if(this.fragContextChanged(j))return;if(this.state=I.State.PARSING,this.audioSwitch&&D&&this.completeAudioSwitch(),Y!=null&&Y.tracks&&(this._bufferInitSegment(Y.tracks,j,M),m.trigger(R.Events.FRAG_PARSING_INIT_SEGMENT,{frag:j,id:v,tracks:Y.tracks})),D){var ee=D.startPTS,oe=D.endPTS,Te=D.startDTS,ve=D.endDTS;W&&(W.elementaryStreams[y.ElementaryStreamTypes.AUDIO]={startPTS:ee,endPTS:oe,startDTS:Te,endDTS:ve}),j.setElementaryStreamInfo(y.ElementaryStreamTypes.AUDIO,ee,oe,Te,ve),this.bufferFragmentData(D,j,W,M)}if(H!=null&&(a=H.samples)!==null&&a!==void 0&&a.length){var ge=u({frag:j,id:v},H);m.trigger(R.Events.FRAG_PARSING_METADATA,ge)}if(P){var he=u({frag:j,id:v},P);m.trigger(R.Events.FRAG_PARSING_USERDATA,he)}},h._bufferInitSegment=function(l,a,v){if(this.state!==I.State.PARSING)return;l.video&&delete l.video;var m=l.audio;if(!m)return;m.levelCodec=m.codec,m.id="audio",this.log("Init audio buffer, container:"+m.container+", codecs[parsed]=["+m.codec+"]"),this.hls.trigger(R.Events.BUFFER_CODECS,l);var E=m.initSegment;if(E!=null&&E.byteLength){var M={type:"audio",frag:a,part:null,chunkMeta:v,parent:a.type,data:E};this.hls.trigger(R.Events.BUFFER_APPENDING,M)}this.tick()},h.loadFragment=function(l,a,v){var m=this.fragmentTracker.getState(l);this.fragCurrent=l,(this.audioSwitch||m===U.FragmentState.NOT_LOADED||m===U.FragmentState.PARTIAL)&&(l.sn==="initSegment"?this._loadInitSegment(l):a.live&&!Object(G.isFiniteNumber)(this.initPTS[l.cc])?(this.log("Waiting for video PTS in continuity counter "+l.cc+" of live stream before loading audio fragment "+l.sn+" of level "+this.trackId),this.state=I.State.WAITING_INIT_PTS):(this.startFragRequested=!0,_.prototype.loadFragment.call(this,l,a,v)))},h.completeAudioSwitch=function(){var l=this.hls,a=this.media,v=this.trackId;a&&(this.log("Switching audio track : flushing all audio"),_.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,l.trigger(R.Events.AUDIO_TRACK_SWITCHED,{id:v})},b}(I.default);V.default=f},"./src/controller/audio-track-controller.ts":function(re,V,A){"use strict";A.r(V);var G=A("./src/events.ts"),I=A("./src/errors.ts"),R=A("./src/controller/base-playlist-controller.ts"),B=A("./src/types/loader.ts");function U(O,C){for(var T=0;T=o.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var u=o[this.trackId];this.log("Now switching to audio-track index "+d);var s=o[d],w=s.id,p=s.groupId,f=p===void 0?"":p,_=s.name,b=s.type,h=s.url;if(this.trackId=d,this.trackName=_,this.selectDefaultTrack=!1,this.hls.trigger(G.Events.AUDIO_TRACK_SWITCHING,{id:w,groupId:f,name:_,type:b,url:h}),s.details&&!s.details.live)return;var c=this.switchParams(s.url,u==null?void 0:u.details);this.loadPlaylist(c)},T.selectInitialTrack=function(){var d=this.tracksInGroup;console.assert(d.length,"Initial audio track should be selected when tracks are known");var o=this.trackName,u=this.findTrackId(o)||this.findTrackId();u!==-1?this.setAudioTrack(u):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(G.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},T.findTrackId=function(d){for(var o=this.tracksInGroup,u=0;uC.partTarget&&(s+=1)}if(Object(G.isFiniteNumber)(u))return new I.HlsUrlParameters(u,Object(G.isFiniteNumber)(s)?s:void 0,I.HlsSkip.No)}}},y.loadPlaylist=function(O){},y.shouldLoadTrack=function(O){return this.canLoad&&O&&!!O.url&&(!O.details||O.details.live)},y.playlistLoaded=function(O,C,T){var g=this,d=C.details,o=C.stats,u=o.loading.end?Math.max(0,self.performance.now()-o.loading.end):0;if(d.advancedDateTime=Date.now()-u,d.live||T!=null&&T.live){if(d.reloaded(T),T&&this.log("live playlist "+O+" "+(d.advanced?"REFRESHED "+d.lastPartSn+"-"+d.lastPartIndex:"MISSED")),T&&d.fragments.length>0&&Object(R.mergeDetails)(T,d),!this.canLoad||!d.live)return;var s,w=void 0,p=void 0;if(d.canBlockReload&&d.endSN&&d.advanced){var f=this.hls.config.lowLatencyMode,_=d.lastPartSn,b=d.endSN,h=d.lastPartIndex,c=h!==-1,l=_===b,a=f?0:h;c?(w=l?b+1:_,p=l?a:h+1):w=b+1;var v=d.age,m=v+d.ageHeader,E=Math.min(m-d.partTarget,d.targetduration*1.5);if(E>0){if(T&&E>T.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+T.tuneInGoal+" to: "+E+" with playlist age: "+d.age),E=0;else{var M=Math.floor(E/d.targetduration);if(w+=M,p!==void 0){var F=Math.round(E%d.targetduration/d.partTarget);p+=F}this.log("CDN Tune-in age: "+d.ageHeader+"s last advanced "+v.toFixed(2)+"s goal: "+E+" skip sn "+M+" to part "+p)}d.tuneInGoal=E}if(s=this.getDeliveryDirectives(d,C.deliveryDirectives,w,p),f||!l){this.loadPlaylist(s);return}}else s=this.getDeliveryDirectives(d,C.deliveryDirectives,w,p);var j=Object(R.computeReloadInterval)(d,o);w!==void 0&&d.canBlockReload&&(j-=d.partTarget||1),this.log("reload live playlist "+O+" in "+Math.round(j)+" ms"),this.timer=self.setTimeout(function(){return g.loadPlaylist(s)},j)}else this.clearTimer()},y.getDeliveryDirectives=function(O,C,T,g){var d=Object(I.getSkipValue)(O,T);return C!=null&&C.skip&&O.deltaUpdateFailed&&(T=C.msn,g=C.part,d=I.HlsSkip.No),new I.HlsUrlParameters(T,g,d)},y.retryLoadingOrFail=function(O){var C=this,T=this.hls.config,g=this.retryCount-1&&(d=O.context)!==null&&d!==void 0&&d.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+O.details+'"'),this.loadPlaylist();else{var o=Math.min(Math.pow(2,this.retryCount)*T.levelLoadingRetryDelay,T.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return C.loadPlaylist()},o),this.warn("retry playlist loading #"+this.retryCount+" in "+o+' ms after "'+O.details+'"')}}else this.warn('cannot recover from error "'+O.details+'"'),this.clearTimer(),O.fatal=!0;return g},L}()},"./src/controller/base-stream-controller.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"State",function(){return b}),A.d(V,"default",function(){return h});var G=A("./src/polyfills/number.ts"),I=A("./src/task-loop.ts"),R=A("./src/controller/fragment-tracker.ts"),B=A("./src/utils/buffer-helper.ts"),U=A("./src/utils/logger.ts"),k=A("./src/events.ts"),L=A("./src/errors.ts"),y=A("./src/types/transmuxer.ts"),x=A("./src/utils/mp4-tools.ts"),O=A("./src/utils/discontinuities.ts"),C=A("./src/controller/fragment-finders.ts"),T=A("./src/controller/level-helper.ts"),g=A("./src/loader/fragment-loader.ts"),d=A("./src/crypt/decrypter.ts"),o=A("./src/utils/time-ranges.ts"),u=A("./src/types/loader.ts");function s(c,l){for(var a=0;aY;(W0&&W&&W.key&&W.iv&&W.method==="AES-128"){var D=self.performance.now();return E.decrypter.webCryptoDecrypt(new Uint8Array(j),W.key.buffer,W.iv.buffer).then(function(P){var H=self.performance.now();return F.trigger(k.Events.FRAG_DECRYPTED,{frag:m,payload:P,stats:{tstart:D,tdecrypt:H}}),M.payload=P,M})}return M}).then(function(M){var F=E.fragCurrent,j=E.hls,W=E.levels;if(!W)throw new Error("init load aborted, missing levels");var D=W[m.level].details;console.assert(D,"Level details are defined when init segment is loaded");var P=m.stats;E.state=b.IDLE,E.fragLoadError=0,m.data=new Uint8Array(M.payload),P.parsing.start=P.buffering.start=self.performance.now(),P.parsing.end=P.buffering.end=self.performance.now(),M.frag===F&&j.trigger(k.Events.FRAG_BUFFERED,{stats:P,frag:F,part:null,id:m.type}),E.tick()}).catch(function(M){E.warn(M),E.resetFragmentLoading(m)})},a.fragContextChanged=function(m){var E=this.fragCurrent;return!m||!E||m.level!==E.level||m.sn!==E.sn||m.urlId!==E.urlId},a.fragBufferedComplete=function(m,E){var M=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+m.type+" sn: "+m.sn+(E?" part: "+E.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+m.level+" "+o.default.toString(B.BufferHelper.getBuffered(M))),this.state=b.IDLE,this.tick()},a._handleFragmentLoadComplete=function(m){var E=this.transmuxer;if(!E)return;var M=m.frag,F=m.part,j=m.partsLoaded,W=!j||j.length===0||j.some(function(P){return!P}),D=new y.ChunkMetadata(M.level,M.sn,M.stats.chunkCount+1,0,F?F.index:-1,!W);E.flush(D)},a._handleFragmentLoadProgress=function(m){},a._doFragLoad=function(m,E,M,F){var j=this;if(M===void 0&&(M=null),!this.levels)throw new Error("frag load aborted, missing levels");if(M=Math.max(m.start,M||0),this.config.lowLatencyMode&&E){var W=E.partList;if(W&&F){M>m.end&&E.fragmentHint&&(m=E.fragmentHint);var D=this.getNextPart(W,m,M);if(D>-1){var P=W[D];return this.log("Loading part sn: "+m.sn+" p: "+P.index+" cc: "+m.cc+" of playlist ["+E.startSN+"-"+E.endSN+"] parts [0-"+D+"-"+(W.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+m.level+", target: "+parseFloat(M.toFixed(3))),this.nextLoadPosition=P.start+P.duration,this.state=b.FRAG_LOADING,this.hls.trigger(k.Events.FRAG_LOADING,{frag:m,part:W[D],targetBufferTime:M}),this.doFragPartsLoad(m,W,D,F).catch(function(H){return j.handleFragLoadError(H)})}else if(!m.url||this.loadedEndOfParts(W,M))return Promise.resolve(null)}}return this.log("Loading fragment "+m.sn+" cc: "+m.cc+" "+(E?"of ["+E.startSN+"-"+E.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+m.level+", target: "+parseFloat(M.toFixed(3))),Object(G.isFiniteNumber)(m.sn)&&!this.bitrateTest&&(this.nextLoadPosition=m.start+m.duration),this.state=b.FRAG_LOADING,this.hls.trigger(k.Events.FRAG_LOADING,{frag:m,targetBufferTime:M}),this.fragmentLoader.load(m,F).catch(function(H){return j.handleFragLoadError(H)})},a.doFragPartsLoad=function(m,E,M,F){var j=this;return new Promise(function(W,D){var P=[],H=function Y(ee){var oe=E[ee];j.fragmentLoader.loadPart(m,oe,F).then(function(Te){P[oe.index]=Te;var ve=Te.part;j.hls.trigger(k.Events.FRAG_LOADED,Te);var ge=E[ee+1];if(ge&&ge.fragment===m)Y(ee+1);else return W({frag:m,part:ve,partsLoaded:P})}).catch(D)};H(M)})},a.handleFragLoadError=function(m){var E=m.data;return E&&E.details===L.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(E.frag,E.part):this.hls.trigger(k.Events.ERROR,E),null},a._handleTransmuxerFlush=function(m){var E=this.getCurrentContext(m);if(!E||this.state!==b.PARSING){this.fragCurrent||(this.state=b.IDLE);return}var M=E.frag,F=E.part,j=E.level,W=self.performance.now();M.stats.parsing.end=W,F&&(F.stats.parsing.end=W),this.updateLevelTiming(M,F,j,m.partial)},a.getCurrentContext=function(m){var E=this.levels,M=m.level,F=m.sn,j=m.part;if(!E||!E[M])return this.warn("Levels object was unset while buffering fragment "+F+" of level "+M+". The current chunk will not be buffered."),null;var W=E[M],D=j>-1?Object(T.getPartWith)(W,F,j):null,P=D?D.fragment:Object(T.getFragmentWithSN)(W,F,this.fragCurrent);return P?{frag:P,part:D,level:W}:null},a.bufferFragmentData=function(m,E,M,F){if(!m||this.state!==b.PARSING)return;var j=m.data1,W=m.data2,D=j;if(j&&W&&(D=Object(x.appendUint8Array)(j,W)),!D||!D.length)return;var P={type:m.type,frag:E,part:M,chunkMeta:F,parent:E.type,data:D};this.hls.trigger(k.Events.BUFFER_APPENDING,P),m.dropped&&m.independent&&!M&&this.flushBufferGap(E)},a.flushBufferGap=function(m){var E=this.media;if(!E)return;if(!B.BufferHelper.isBuffered(E,E.currentTime)){this.flushMainBuffer(0,m.start);return}var M=E.currentTime,F=B.BufferHelper.bufferInfo(E,M,0),j=m.duration,W=Math.min(this.config.maxFragLookUpTolerance*2,j*.25),D=Math.max(Math.min(m.start-W,F.end-W),M+W);m.start-D>W&&this.flushMainBuffer(D,m.start)},a.getFwdBufferInfo=function(m,E){var M=this.config,F=this.getLoadPosition();if(!Object(G.isFiniteNumber)(F))return null;var j=B.BufferHelper.bufferInfo(m,F,M.maxBufferHole);if(j.len===0&&j.nextStart!==void 0){var W=this.fragmentTracker.getBufferedFrag(F,E);if(W&&j.nextStart=M?(E.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+E.maxMaxBufferLength+"s"),!0):!1},a.getNextFragment=function(m,E){var M,F,j=E.fragments,W=j.length;if(!W)return null;var D=this.config,P=j[0].start,H;if(E.live){var Y=D.initialLiveManifestSize;if(W-1&&MM.start&&M.loaded},a.getInitialLiveFragment=function(m,E){var M=this.fragPrevious,F=null;if(M){if(m.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+M.programDateTime),F=Object(C.findFragmentByPDT)(E,M.endProgramDateTime,this.config.maxFragLookUpTolerance)),!F){var j=M.sn+1;if(j>=m.startSN&&j<=m.endSN){var W=E[j-m.startSN];M.cc===W.cc&&(F=W,this.log("Live playlist, switching playlist, load frag with next SN: "+F.sn))}F||(F=Object(C.findFragWithCC)(E,M.cc),F&&this.log("Live playlist, switching playlist, load frag with same CC: "+F.sn))}}else{var D=this.hls.liveSyncPosition;D!==null&&(F=this.getFragmentAtPosition(D,this.bitrateTest?m.fragmentEnd:m.edge,m))}return F},a.getFragmentAtPosition=function(m,E,M){var F=this.config,j=this.fragPrevious,W=M.fragments,D=M.endSN,P=M.fragmentHint,H=F.maxFragLookUpTolerance,Y=!!(F.lowLatencyMode&&M.partList&&P);Y&&P&&!this.bitrateTest&&(W=W.concat(P),D=P.sn);var ee;if(mE-H?0:H;ee=Object(C.findFragmentByPTS)(j,W,m,oe)}else ee=W[W.length-1];if(ee){var Te=ee.sn-M.startSN,ve=j&&ee.level===j.level,ge=W[Te+1],he=this.fragmentTracker.getState(ee);if(he===R.FragmentState.BACKTRACKED){ee=null;for(var fe=Te;W[fe]&&this.fragmentTracker.getState(W[fe])===R.FragmentState.BACKTRACKED;)j?ee=W[fe--]:ee=W[--fe];ee||(ee=ge)}else j&&ee.sn===j.sn&&!Y&&(ve&&(ee.sn=W-E.maxFragLookUpTolerance&&j<=D;if(F!==null&&M.duration>F&&(j"+m.startSN+" prev-sn: "+(j?j.sn:"na")+" fragments: "+D),ee}return P},a.waitForCdnTuneIn=function(m){var E=3;return m.live&&m.canBlockReload&&m.tuneInGoal>Math.max(m.partHoldBack,m.partTarget*E)},a.setStartPosition=function(m,E){var M=this.startPosition;if(M"+m))}}]),l}(I.default)},"./src/controller/buffer-controller.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"default",function(){return C});var G=A("./src/polyfills/number.ts"),I=A("./src/events.ts"),R=A("./src/utils/logger.ts"),B=A("./src/errors.ts"),U=A("./src/utils/buffer-helper.ts"),k=A("./src/utils/mediasource-helper.ts"),L=A("./src/loader/fragment.ts"),y=A("./src/controller/buffer-operation-queue.ts"),x=Object(k.getMediaSource)(),O=/([ha]vc.)(?:\.[^.,]+)+/,C=function(){function T(d){var o=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var u=o.hls,s=o.media,w=o.mediaSource;R.logger.log("[buffer-controller]: Media source opened"),s&&(o.updateMediaElementDuration(),u.trigger(I.Events.MEDIA_ATTACHED,{media:s})),w&&w.removeEventListener("sourceopen",o._onMediaSourceOpen),o.checkPendingTracks()},this._onMediaSourceClose=function(){R.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){R.logger.log("[buffer-controller]: Media source ended")},this.hls=d,this._initSourceBuffer(),this.registerListeners()}var g=T.prototype;return g.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},g.destroy=function(){this.unregisterListeners(),this.details=null},g.registerListeners=function(){var o=this.hls;o.on(I.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.on(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(I.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(I.Events.BUFFER_RESET,this.onBufferReset,this),o.on(I.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.on(I.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.on(I.Events.BUFFER_EOS,this.onBufferEos,this),o.on(I.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.on(I.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.on(I.Events.FRAG_PARSED,this.onFragParsed,this),o.on(I.Events.FRAG_CHANGED,this.onFragChanged,this)},g.unregisterListeners=function(){var o=this.hls;o.off(I.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.off(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(I.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(I.Events.BUFFER_RESET,this.onBufferReset,this),o.off(I.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.off(I.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.off(I.Events.BUFFER_EOS,this.onBufferEos,this),o.off(I.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.off(I.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.off(I.Events.FRAG_PARSED,this.onFragParsed,this),o.off(I.Events.FRAG_CHANGED,this.onFragChanged,this)},g._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new y.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},g.onManifestParsed=function(o,u){var s=2;(u.audio&&!u.video||!u.altAudio)&&(s=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=s,this.details=null,R.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},g.onMediaAttaching=function(o,u){var s=this.media=u.media;if(s&&x){var w=this.mediaSource=new x;w.addEventListener("sourceopen",this._onMediaSourceOpen),w.addEventListener("sourceended",this._onMediaSourceEnded),w.addEventListener("sourceclose",this._onMediaSourceClose),s.src=self.URL.createObjectURL(w),this._objectUrl=s.src}},g.onMediaDetaching=function(){var o=this.media,u=this.mediaSource,s=this._objectUrl;if(u){if(R.logger.log("[buffer-controller]: media source detaching"),u.readyState==="open")try{u.endOfStream()}catch(w){R.logger.warn("[buffer-controller]: onMediaDetaching: "+w.message+" while calling endOfStream")}this.onBufferReset(),u.removeEventListener("sourceopen",this._onMediaSourceOpen),u.removeEventListener("sourceended",this._onMediaSourceEnded),u.removeEventListener("sourceclose",this._onMediaSourceClose),o&&(s&&self.URL.revokeObjectURL(s),o.src===s?(o.removeAttribute("src"),o.load()):R.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(I.Events.MEDIA_DETACHED,void 0)},g.onBufferReset=function(){var o=this;this.getSourceBufferTypes().forEach(function(u){var s=o.sourceBuffer[u];try{s&&(o.removeBufferListeners(u),o.mediaSource&&o.mediaSource.removeSourceBuffer(s),o.sourceBuffer[u]=void 0)}catch(w){R.logger.warn("[buffer-controller]: Failed to reset the "+u+" buffer",w)}}),this._initSourceBuffer()},g.onBufferCodecs=function(o,u){var s=this,w=this.getSourceBufferTypes().length;if(Object.keys(u).forEach(function(p){if(w){var f=s.tracks[p];if(f&&typeof f.buffer.changeType=="function"){var _=u[p],b=_.codec,h=_.levelCodec,c=_.container,l=(f.levelCodec||f.codec).replace(O,"$1"),a=(h||b).replace(O,"$1");if(l!==a){var v=c+";codecs="+(h||b);s.appendChangeType(p,v)}}}else s.pendingTracks[p]=u[p]}),w)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},g.appendChangeType=function(o,u){var s=this,w=this.operationQueue,p={execute:function(){var _=s.sourceBuffer[o];_&&(R.logger.log("[buffer-controller]: changing "+o+" sourceBuffer type to "+u),_.changeType(u)),w.shiftAndExecuteNext(o)},onStart:function(){},onComplete:function(){},onError:function(_){R.logger.warn("[buffer-controller]: Failed to change "+o+" SourceBuffer type",_)}};w.append(p,o)},g.onBufferAppending=function(o,u){var s=this,w=this.hls,p=this.operationQueue,f=this.tracks,_=u.data,b=u.type,h=u.frag,c=u.part,l=u.chunkMeta,a=l.buffering[b],v=self.performance.now();a.start=v;var m=h.stats.buffering,E=c?c.stats.buffering:null;m.start===0&&(m.start=v),E&&E.start===0&&(E.start=v);var M=f.audio,F=b==="audio"&&l.id===1&&(M==null?void 0:M.container)==="audio/mpeg",j={execute:function(){if(a.executeStart=self.performance.now(),F){var D=s.sourceBuffer[b];if(D){var P=h.start-D.timestampOffset;Math.abs(P)>=.1&&(R.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+h.start+" (delta: "+P+") sn: "+h.sn+")"),D.timestampOffset=h.start)}}s.appendExecutor(_,b)},onStart:function(){},onComplete:function(){var D=self.performance.now();a.executeEnd=a.end=D,m.first===0&&(m.first=D),E&&E.first===0&&(E.first=D);var P=s.sourceBuffer,H={};for(var Y in P)H[Y]=U.BufferHelper.getBuffered(P[Y]);s.appendError=0,s.hls.trigger(I.Events.BUFFER_APPENDED,{type:b,frag:h,part:c,chunkMeta:l,parent:h.type,timeRanges:H})},onError:function(D){R.logger.error("[buffer-controller]: Error encountered while trying to append to the "+b+" SourceBuffer",D);var P={type:B.ErrorTypes.MEDIA_ERROR,parent:h.type,details:B.ErrorDetails.BUFFER_APPEND_ERROR,err:D,fatal:!1};D.code===DOMException.QUOTA_EXCEEDED_ERR?P.details=B.ErrorDetails.BUFFER_FULL_ERROR:(s.appendError++,P.details=B.ErrorDetails.BUFFER_APPEND_ERROR,s.appendError>w.config.appendErrorMaxRetry&&(R.logger.error("[buffer-controller]: Failed "+w.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),P.fatal=!0)),w.trigger(I.Events.ERROR,P)}};p.append(j,b)},g.onBufferFlushing=function(o,u){var s=this,w=this.operationQueue,p=function(_){return{execute:s.removeExecutor.bind(s,_,u.startOffset,u.endOffset),onStart:function(){},onComplete:function(){s.hls.trigger(I.Events.BUFFER_FLUSHED,{type:_})},onError:function(h){R.logger.warn("[buffer-controller]: Failed to remove from "+_+" SourceBuffer",h)}}};u.type?w.append(p(u.type),u.type):this.getSourceBufferTypes().forEach(function(f){w.append(p(f),f)})},g.onFragParsed=function(o,u){var s=this,w=u.frag,p=u.part,f=[],_=p?p.elementaryStreams:w.elementaryStreams;_[L.ElementaryStreamTypes.AUDIOVIDEO]?f.push("audiovideo"):(_[L.ElementaryStreamTypes.AUDIO]&&f.push("audio"),_[L.ElementaryStreamTypes.VIDEO]&&f.push("video"));var b=function(){var c=self.performance.now();w.stats.buffering.end=c,p&&(p.stats.buffering.end=c);var l=p?p.stats:w.stats;s.hls.trigger(I.Events.FRAG_BUFFERED,{frag:w,part:p,stats:l,id:w.type})};f.length===0&&R.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+w.type+" level: "+w.level+" sn: "+w.sn),this.blockBuffers(b,f)},g.onFragChanged=function(o,u){this.flushBackBuffer()},g.onBufferEos=function(o,u){var s=this,w=this.getSourceBufferTypes().reduce(function(p,f){var _=s.sourceBuffer[f];return(!u.type||u.type===f)&&(_&&!_.ended&&(_.ended=!0,R.logger.log("[buffer-controller]: "+f+" sourceBuffer now EOS"))),p&&!!(!_||_.ended)},!0);w&&this.blockBuffers(function(){var p=s.mediaSource;if(!p||p.readyState!=="open")return;p.endOfStream()})},g.onLevelUpdated=function(o,u){var s=u.details;if(!s.fragments.length)return;this.details=s,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},g.flushBackBuffer=function(){var o=this.hls,u=this.details,s=this.media,w=this.sourceBuffer;if(!s||u===null)return;var p=this.getSourceBufferTypes();if(!p.length)return;var f=u.live&&o.config.liveBackBufferLength!==null?o.config.liveBackBufferLength:o.config.backBufferLength;if(!Object(G.isFiniteNumber)(f)||f<0)return;var _=s.currentTime,b=u.levelTargetDuration,h=Math.max(f,b),c=Math.floor(_/b)*b-h;p.forEach(function(l){var a=w[l];if(a){var v=U.BufferHelper.getBuffered(a);v.length>0&&c>v.start(0)&&(o.trigger(I.Events.BACK_BUFFER_REACHED,{bufferEnd:c}),u.live&&o.trigger(I.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:c}),o.trigger(I.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:c,type:l}))}})},g.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var o=this.details,u=this.hls,s=this.media,w=this.mediaSource,p=o.fragments[0].start+o.totalduration,f=s.duration,_=Object(G.isFiniteNumber)(w.duration)?w.duration:0;o.live&&u.config.liveDurationInfinity?(R.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),w.duration=Infinity,this.updateSeekableRange(o)):(p>_&&p>f||!Object(G.isFiniteNumber)(f))&&(R.logger.log("[buffer-controller]: Updating Media Source duration to "+p.toFixed(3)),w.duration=p)},g.updateSeekableRange=function(o){var u=this.mediaSource,s=o.fragments,w=s.length;if(w&&o.live&&u!==null&&u!==void 0&&u.setLiveSeekableRange){var p=Math.max(0,s[0].start),f=Math.max(p,p+o.totalduration);u.setLiveSeekableRange(p,f)}},g.checkPendingTracks=function(){var o=this.bufferCodecEventsExpected,u=this.operationQueue,s=this.pendingTracks,w=Object.keys(s).length;if(w&&!o||w===2){this.createSourceBuffers(s),this.pendingTracks={};var p=this.getSourceBufferTypes();if(p.length===0){this.hls.trigger(I.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}p.forEach(function(f){u.executeNext(f)})}},g.createSourceBuffers=function(o){var u=this.sourceBuffer,s=this.mediaSource;if(!s)throw Error("createSourceBuffers called when mediaSource was null");var w=0;for(var p in o)if(!u[p]){var f=o[p];if(!f)throw Error("source buffer exists for track "+p+", however track does not");var _=f.levelCodec||f.codec,b=f.container+";codecs="+_;R.logger.log("[buffer-controller]: creating sourceBuffer("+b+")");try{var h=u[p]=s.addSourceBuffer(b),c=p;this.addBufferListener(c,"updatestart",this._onSBUpdateStart),this.addBufferListener(c,"updateend",this._onSBUpdateEnd),this.addBufferListener(c,"error",this._onSBUpdateError),this.tracks[p]={buffer:h,codec:_,container:f.container,levelCodec:f.levelCodec,id:f.id},w++}catch(l){R.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+l.message),this.hls.trigger(I.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:l,mimeType:b})}}w&&this.hls.trigger(I.Events.BUFFER_CREATED,{tracks:this.tracks})},g._onSBUpdateStart=function(o){var u=this.operationQueue,s=u.current(o);s.onStart()},g._onSBUpdateEnd=function(o){var u=this.operationQueue,s=u.current(o);s.onComplete(),u.shiftAndExecuteNext(o)},g._onSBUpdateError=function(o,u){R.logger.error("[buffer-controller]: "+o+" SourceBuffer error",u),this.hls.trigger(I.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var s=this.operationQueue.current(o);s&&s.onError(u)},g.removeExecutor=function(o,u,s){var w=this.media,p=this.mediaSource,f=this.operationQueue,_=this.sourceBuffer,b=_[o];if(!w||!p||!b){R.logger.warn("[buffer-controller]: Attempting to remove from the "+o+" SourceBuffer, but it does not exist"),f.shiftAndExecuteNext(o);return}var h=Object(G.isFiniteNumber)(w.duration)?w.duration:Infinity,c=Object(G.isFiniteNumber)(p.duration)?p.duration:Infinity,l=Math.max(0,u),a=Math.min(s,h,c);a>l?(R.logger.log("[buffer-controller]: Removing ["+l+","+a+"] from the "+o+" SourceBuffer"),console.assert(!b.updating,o+" sourceBuffer must not be updating"),b.remove(l,a)):f.shiftAndExecuteNext(o)},g.appendExecutor=function(o,u){var s=this.operationQueue,w=this.sourceBuffer,p=w[u];if(!p){R.logger.warn("[buffer-controller]: Attempting to append to the "+u+" SourceBuffer, but it does not exist"),s.shiftAndExecuteNext(u);return}p.ended=!1,console.assert(!p.updating,u+" sourceBuffer must not be updating"),p.appendBuffer(o)},g.blockBuffers=function(o,u){var s=this;if(u===void 0&&(u=this.getSourceBufferTypes()),!u.length){R.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(o);return}var w=this.operationQueue,p=u.map(function(f){return w.appendBlocker(f)});Promise.all(p).then(function(){o(),u.forEach(function(f){var _=s.sourceBuffer[f];(!_||!_.updating)&&w.shiftAndExecuteNext(f)})})},g.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},g.addBufferListener=function(o,u,s){var w=this.sourceBuffer[o];if(!w)return;var p=s.bind(this,o);this.listeners[o].push({event:u,listener:p}),w.addEventListener(u,p)},g.removeBufferListeners=function(o){var u=this.sourceBuffer[o];if(!u)return;this.listeners[o].forEach(function(s){u.removeEventListener(s.event,s.listener)})},T}()},"./src/controller/buffer-operation-queue.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"default",function(){return I});var G=A("./src/utils/logger.ts"),I=function(){function R(U){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=U}var B=R.prototype;return B.append=function(k,L){var y=this.queues[L];y.push(k),y.length===1&&this.buffers[L]&&this.executeNext(L)},B.insertAbort=function(k,L){var y=this.queues[L];y.unshift(k),this.executeNext(L)},B.appendBlocker=function(k){var L,y=new Promise(function(O){L=O}),x={execute:L,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(x,k),y},B.executeNext=function(k){var L=this.buffers,y=this.queues,x=L[k],O=y[k];if(O.length){var C=O[0];try{C.execute()}catch(T){G.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),C.onError(T),(!x||!x.updating)&&(O.shift(),this.executeNext(k))}}},B.shiftAndExecuteNext=function(k){this.queues[k].shift(),this.executeNext(k)},B.current=function(k){return this.queues[k][0]},R}()},"./src/controller/cap-level-controller.ts":function(re,V,A){"use strict";A.r(V);var G=A("./src/events.ts");function I(U,k){for(var L=0;L0&&this.mediaWidth>0){var y=this.hls.levels;if(y.length){var x=this.hls;x.autoLevelCapping=this.getMaxLevel(y.length-1),x.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=x.autoLevelCapping}}},k.getMaxLevel=function(y){var x=this,O=this.hls.levels;if(!O.length)return-1;var C=O.filter(function(T,g){return U.isLevelAllowed(g,x.restrictedLevels)&&g<=y});return this.clientRect=null,U.getMaxLevelByMediaSize(C,this.mediaWidth,this.mediaHeight)},k.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()},k.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},k.getDimensions=function(){if(this.clientRect)return this.clientRect;var y=this.media,x={width:0,height:0};if(y){var O=y.getBoundingClientRect();x.width=O.width,x.height=O.height,!x.width&&!x.height&&(x.width=O.right-O.left||y.width||0,x.height=O.bottom-O.top||y.height||0)}return this.clientRect=x,x},U.isLevelAllowed=function(y,x){return x===void 0&&(x=[]),x.indexOf(y)===-1},U.getMaxLevelByMediaSize=function(y,x,O){if(!y||!y.length)return-1;for(var C=function(u,s){return s?u.width!==s.width||u.height!==s.height:!0},T=y.length-1,g=0;g=x||d.height>=O)&&C(d,y[g+1])){T=g;break}}return T},R(U,[{key:"mediaWidth",get:function(){return this.getDimensions().width*U.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*U.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var y=1;try{y=self.devicePixelRatio}catch(x){}return y}}]),U}();V.default=B},"./src/controller/cmcd-controller.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"default",function(){return C});var G=A("./src/events.ts"),I=A("./src/types/cmcd.ts"),R=A("./src/utils/buffer-helper.ts"),B=A("./src/utils/logger.ts");function U(T,g){for(var d=0;d=T.length?{done:!0}:{done:!1,value:T[o++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function y(T,g){if(!T)return;if(typeof T=="string")return x(T,g);var d=Object.prototype.toString.call(T).slice(8,-1);if(d==="Object"&&T.constructor&&(d=T.constructor.name),d==="Map"||d==="Set")return Array.from(T);if(d==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(d))return x(T,g)}function x(T,g){(g==null||g>T.length)&&(g=T.length);for(var d=0,o=new Array(g);du&&(u=f.bitrate)}return u>0?u:NaN},g.getBufferLength=function(o){var u=this.hls.media,s=o===I.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!s||!u)return NaN;var w=R.BufferHelper.bufferInfo(s,u.currentTime,this.config.maxBufferHole);return w.len*1e3},g.createPlaylistLoader=function(){var o=this.config.pLoader,u=this.applyPlaylistData,s=o||this.config.loader;return function(){function w(f){this.loader=void 0,this.loader=new s(f)}var p=w.prototype;return p.destroy=function(){this.loader.destroy()},p.abort=function(){this.loader.abort()},p.load=function(_,b,h){u(_),this.loader.load(_,b,h)},k(w,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),w}()},g.createFragmentLoader=function(){var o=this.config.fLoader,u=this.applyFragmentData,s=o||this.config.loader;return function(){function w(f){this.loader=void 0,this.loader=new s(f)}var p=w.prototype;return p.destroy=function(){this.loader.destroy()},p.abort=function(){this.loader.abort()},p.load=function(_,b,h){u(_),this.loader.load(_,b,h)},k(w,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),w}()},T.uuid=function(){var o=URL.createObjectURL(new Blob),u=o.toString();return URL.revokeObjectURL(o),u.substr(u.lastIndexOf("/")+1)},T.serialize=function(o){for(var u=[],s=function(F){return!Number.isNaN(F)&&F!=null&&F!==""&&F!==!1},w=function(F){return Math.round(F)},p=function(F){return w(F/100)*100},f=function(F){return encodeURIComponent(F)},_={br:w,d:w,bl:p,dl:p,mtp:p,nor:f,rtp:p,tb:w},b=Object.keys(o||{}).sort(),h=L(b),c;!(c=h()).done;){var l=c.value,a=o[l];if(!s(a))continue;if(l==="v"&&a===1)continue;if(l=="pr"&&a===1)continue;var v=_[l];v&&(a=v(a));var m=typeof a,E=void 0;l==="ot"||l==="sf"||l==="st"?E=l+"="+a:m==="boolean"?E=l:m==="number"?E=l+"="+a:E=l+"="+JSON.stringify(a),u.push(E)}return u.join(",")},T.toHeaders=function(o){for(var u=Object.keys(o),s={},w=["Object","Request","Session","Status"],p=[{},{},{},{}],f={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},_=0,b=u;_L){this.hls.trigger(G.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var f=L-this._requestLicenseFailureCount+1;R.logger.warn("Retrying license request, "+f+" attempts left"),this._requestLicense(u,s)}break}},T._generateLicenseRequestChallenge=function(d,o){switch(d.mediaKeySystemDomain){case B.KeySystems.WIDEVINE:return o}throw new Error("unsupported key-system: "+d.mediaKeySystemDomain)},T._requestLicense=function(d,o){R.logger.log("Requesting content license for key-system");var u=this._mediaKeysList[0];if(!u){R.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(G.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var s=this.getLicenseServerUrl(u.mediaKeySystemDomain),w=this._createLicenseXhr(s,d,o);R.logger.log("Sending license request to URL: "+s);var p=this._generateLicenseRequestChallenge(u,d);w.send(p)}catch(f){R.logger.error("Failure requesting DRM license: "+f),this.hls.trigger(G.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},T.onMediaAttached=function(d,o){if(!this._emeEnabled)return;var u=o.media;this._media=u,u.addEventListener("encrypted",this._onMediaEncrypted)},T.onMediaDetached=function(){var d=this._media,o=this._mediaKeysList;if(!d)return;d.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(o.map(function(u){if(u.mediaKeysSession)return u.mediaKeysSession.close().catch(function(){})})).then(function(){return d.setMediaKeys(null)}).catch(function(){})},T.onManifestParsed=function(d,o){if(!this._emeEnabled)return;var u=o.levels.map(function(w){return w.audioCodec}).filter(function(w){return!!w}),s=o.levels.map(function(w){return w.videoCodec}).filter(function(w){return!!w});this._attemptKeySystemAccess(B.KeySystems.WIDEVINE,u,s)},k(C,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),C}();V.default=O},"./src/controller/fps-controller.ts":function(re,V,A){"use strict";A.r(V);var G=A("./src/events.ts"),I=A("./src/utils/logger.ts"),R=function(){function B(k){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=k,this.registerListeners()}var U=B.prototype;return U.setStreamController=function(L){this.streamController=L},U.registerListeners=function(){this.hls.on(G.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},U.unregisterListeners=function(){this.hls.off(G.Events.MEDIA_ATTACHING,this.onMediaAttaching)},U.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},U.onMediaAttaching=function(L,y){var x=this.hls.config;if(x.capLevelOnFPSDrop){var O=y.media instanceof self.HTMLVideoElement?y.media:null;this.media=O,O&&typeof O.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),x.fpsDroppedMonitoringPeriod)}},U.checkFPS=function(L,y,x){var O=performance.now();if(y){if(this.lastTime){var C=O-this.lastTime,T=x-this.lastDroppedFrames,g=y-this.lastDecodedFrames,d=1e3*T/C,o=this.hls;if(o.trigger(G.Events.FPS_DROP,{currentDropped:T,currentDecoded:g,totalDroppedFrames:x}),d>0&&T>o.config.fpsDroppedMonitoringThreshold*g){var u=o.currentLevel;I.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+u),u>0&&(o.autoLevelCapping===-1||o.autoLevelCapping>=u)&&(u=u-1,o.trigger(G.Events.FPS_DROP_LEVEL_CAPPING,{level:u,droppedLevel:o.currentLevel}),o.autoLevelCapping=u,this.streamController.nextLevelSwitch())}}this.lastTime=O,this.lastDroppedFrames=x,this.lastDecodedFrames=y}},U.checkFPSInterval=function(){var L=this.media;if(L)if(this.isVideoPlaybackQualityAvailable){var y=L.getVideoPlaybackQuality();this.checkFPS(L,y.totalVideoFrames,y.droppedVideoFrames)}else this.checkFPS(L,L.webkitDecodedFrameCount,L.webkitDroppedFrameCount)},B}();V.default=R},"./src/controller/fragment-finders.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"findFragmentByPDT",function(){return R}),A.d(V,"findFragmentByPTS",function(){return B}),A.d(V,"fragmentWithinToleranceTest",function(){return U}),A.d(V,"pdtWithinToleranceTest",function(){return k}),A.d(V,"findFragWithCC",function(){return L});var G=A("./src/polyfills/number.ts"),I=A("./src/utils/binary-search.ts");function R(y,x,O){if(x===null||!Array.isArray(y)||!y.length||!Object(G.isFiniteNumber)(x))return null;var C=y[0].programDateTime;if(x<(C||0))return null;var T=y[y.length-1].endProgramDateTime;if(x>=(T||0))return null;O=O||0;for(var g=0;gy&&O.start?-1:0}function k(y,x,O){var C=Math.min(x,O.duration+(O.deltaPTS?O.deltaPTS:0))*1e3,T=O.endProgramDateTime||0;return T-C>y}function L(y,x){return I.default.search(y,function(O){return O.ccx?-1:0})}},"./src/controller/fragment-tracker.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"FragmentState",function(){return R}),A.d(V,"FragmentTracker",function(){return B});var G=A("./src/events.ts"),I=A("./src/types/loader.ts"),R;(function(L){L.NOT_LOADED="NOT_LOADED",L.BACKTRACKED="BACKTRACKED",L.APPENDING="APPENDING",L.PARTIAL="PARTIAL",L.OK="OK"})(R||(R={}));var B=function(){function L(x){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=x,this._registerListeners()}var y=L.prototype;return y._registerListeners=function(){var O=this.hls;O.on(G.Events.BUFFER_APPENDED,this.onBufferAppended,this),O.on(G.Events.FRAG_BUFFERED,this.onFragBuffered,this),O.on(G.Events.FRAG_LOADED,this.onFragLoaded,this)},y._unregisterListeners=function(){var O=this.hls;O.off(G.Events.BUFFER_APPENDED,this.onBufferAppended,this),O.off(G.Events.FRAG_BUFFERED,this.onFragBuffered,this),O.off(G.Events.FRAG_LOADED,this.onFragLoaded,this)},y.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},y.getAppendedFrag=function(O,C){if(C===I.PlaylistLevelType.MAIN){var T=this.activeFragment,g=this.activeParts;if(!T)return null;if(g)for(var d=g.length;d--;){var o=g[d],u=o?o.end:T.appendedPTS;if(o.start<=O&&u!==void 0&&O<=u)return d>9&&(this.activeParts=g.slice(d-9)),o}else if(T.start<=O&&T.appendedPTS!==void 0&&O<=T.appendedPTS)return T}return this.getBufferedFrag(O,C)},y.getBufferedFrag=function(O,C){for(var T=this.fragments,g=Object.keys(T),d=g.length;d--;){var o=T[g[d]];if((o==null?void 0:o.body.type)===C&&o.buffered){var u=o.body;if(u.start<=O&&O<=u.end)return u}}return null},y.detectEvictedFragments=function(O,C,T){var g=this;Object.keys(this.fragments).forEach(function(d){var o=g.fragments[d];if(!o)return;if(!o.buffered){o.body.type===T&&g.removeFragment(o.body);return}var u=o.range[O];if(!u)return;u.time.some(function(s){var w=!g.isTimeBuffered(s.startPTS,s.endPTS,C);return w&&g.removeFragment(o.body),w})})},y.detectPartialFragments=function(O){var C=this,T=this.timeRanges,g=O.frag,d=O.part;if(!T||g.sn==="initSegment")return;var o=k(g),u=this.fragments[o];if(!u)return;Object.keys(T).forEach(function(s){var w=g.elementaryStreams[s];if(!w)return;var p=T[s],f=d!==null||w.partial===!0;u.range[s]=C.getBufferedTimes(g,d,f,p)}),u.backtrack=u.loaded=null,Object.keys(u.range).length?u.buffered=!0:this.removeFragment(u.body)},y.fragBuffered=function(O){var C=k(O),T=this.fragments[C];T&&(T.backtrack=T.loaded=null,T.buffered=!0)},y.getBufferedTimes=function(O,C,T,g){for(var d={time:[],partial:T},o=C?C.start:O.start,u=C?C.end:O.end,s=O.minEndPTS||u,w=O.maxStartPTS||o,p=0;p=f&&s<=_){d.time.push({startPTS:Math.max(o,g.start(p)),endPTS:Math.min(u,g.end(p))});break}else if(o<_&&u>f)d.partial=!0,d.time.push({startPTS:Math.max(o,g.start(p)),endPTS:Math.min(u,g.end(p))});else if(u<=f)break}return d},y.getPartialFragment=function(O){var C=null,T,g,d,o=0,u=this.bufferPadding,s=this.fragments;return Object.keys(s).forEach(function(w){var p=s[w];if(!p)return;U(p)&&(g=p.body.start-u,d=p.body.end+u,O>=g&&O<=d&&(T=Math.min(O-g,d-O),o<=T&&(C=p.body,o=T)))}),C},y.getState=function(O){var C=k(O),T=this.fragments[C];return T?T.buffered?U(T)?R.PARTIAL:R.OK:T.backtrack?R.BACKTRACKED:R.APPENDING:R.NOT_LOADED},y.backtrack=function(O,C){var T=k(O),g=this.fragments[T];if(!g||g.backtrack)return null;var d=g.backtrack=C||g.loaded;return g.loaded=null,d},y.getBacktrackData=function(O){var C=k(O),T=this.fragments[C];if(T){var g,d=T.backtrack;if(d!=null&&(g=d.payload)!==null&&g!==void 0&&g.byteLength)return d;this.removeFragment(O)}return null},y.isTimeBuffered=function(O,C,T){for(var g,d,o=0;o=g&&C<=d)return!0;if(C<=g)return!1}return!1},y.onFragLoaded=function(O,C){var T=C.frag,g=C.part;if(T.sn==="initSegment"||T.bitrateTest||g)return;var d=k(T);this.fragments[d]={body:T,loaded:C,backtrack:null,buffered:!1,range:Object.create(null)}},y.onBufferAppended=function(O,C){var T=this,g=C.frag,d=C.part,o=C.timeRanges;if(g.type===I.PlaylistLevelType.MAIN)if(this.activeFragment=g,d){var u=this.activeParts;u||(this.activeParts=u=[]),u.push(d)}else this.activeParts=null;this.timeRanges=o,Object.keys(o).forEach(function(s){var w=o[s];if(T.detectEvictedFragments(s,w),!d)for(var p=0;pO&&g.removeFragment(u)}})},y.removeFragment=function(O){var C=k(O);O.stats.loaded=0,O.clearElementaryStreamInfo(),delete this.fragments[C]},y.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},L}();function U(L){var y,x;return L.buffered&&(((y=L.range.video)===null||y===void 0?void 0:y.partial)||((x=L.range.audio)===null||x===void 0?void 0:x.partial))}function k(L){return L.type+"_"+L.level+"_"+L.urlId+"_"+L.sn}},"./src/controller/gap-controller.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"STALL_MINIMUM_DURATION_MS",function(){return U}),A.d(V,"MAX_START_GAP_JUMP",function(){return k}),A.d(V,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return L}),A.d(V,"SKIP_BUFFER_RANGE_START",function(){return y}),A.d(V,"default",function(){return x});var G=A("./src/utils/buffer-helper.ts"),I=A("./src/errors.ts"),R=A("./src/events.ts"),B=A("./src/utils/logger.ts"),U=250,k=2,L=.1,y=.05,x=function(){function O(T,g,d,o){this.config=void 0,this.media=void 0,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=T,this.media=g,this.fragmentTracker=d,this.hls=o}var C=O.prototype;return C.destroy=function(){this.hls=this.fragmentTracker=this.media=null},C.poll=function(g){var d=this.config,o=this.media,u=this.stalled,s=o.currentTime,w=o.seeking,p=this.seeking&&!w,f=!this.seeking&&w;if(this.seeking=w,s!==g){if(this.moved=!0,u!==null){if(this.stallReported){var _=self.performance.now()-u;B.logger.warn("playback not stuck anymore @"+s+", after "+Math.round(_)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((f||p)&&(this.stalled=null),o.paused||o.ended||o.playbackRate===0||!G.BufferHelper.getBuffered(o).length)return;var b=G.BufferHelper.bufferInfo(o,s,0),h=b.len>0,c=b.nextStart||0;if(!h&&!c)return;if(w){var l=b.len>k,a=!c||c-s>k&&!this.fragmentTracker.getPartialFragment(s);if(l||a)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var v,m=Math.max(c,b.start||0)-s,E=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,M=E==null||((v=E.details)===null||v===void 0)?void 0:v.live,F=M?E.details.targetduration*2:k;if(m>0&&m<=F){this._trySkipBufferHole(null);return}}var j=self.performance.now();if(u===null){this.stalled=j;return}var W=j-u;!w&&W>=U&&this._reportStall(b.len);var D=G.BufferHelper.bufferInfo(o,s,d.maxBufferHole);this._tryFixBufferStall(D,W)},C._tryFixBufferStall=function(g,d){var o=this.config,u=this.fragmentTracker,s=this.media,w=s.currentTime,p=u.getPartialFragment(w);if(p){var f=this._trySkipBufferHole(p);if(f)return}g.len>o.maxBufferHole&&d>o.highBufferWatchdogPeriod*1e3&&(B.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},C._reportStall=function(g){var d=this.hls,o=this.media,u=this.stallReported;u||(this.stallReported=!0,B.logger.warn("Playback stalling at @"+o.currentTime+" due to low buffer (buffer="+g+")"),d.trigger(R.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:g}))},C._trySkipBufferHole=function(g){for(var d=this.config,o=this.hls,u=this.media,s=u.currentTime,w=0,p=G.BufferHelper.getBuffered(u),f=0;f=w&&s<_){var b=Math.max(_+y,u.currentTime+L);return B.logger.warn("skipping hole, adjusting currentTime from "+s+" to "+b),this.moved=!0,this.stalled=null,u.currentTime=b,g&&o.trigger(R.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+s+" to "+b,frag:g}),b}w=p.end(f)}return 0},C._tryNudgeBuffer=function(){var g=this.config,d=this.hls,o=this.media,u=o.currentTime,s=(this.nudgeRetry||0)+1;if(this.nudgeRetry=s,s.05&&this.forwardBufferLength>1){var f=Math.min(2,Math.max(1,o)),_=Math.round(2/(1+Math.exp(-.75*s-this.edgeStalled))*20)/20;O.playbackRate=Math.min(f,Math.max(1,_))}else O.playbackRate!==1&&O.playbackRate!==0&&(O.playbackRate=1)},y.estimateLiveEdge=function(){var O=this.levelDetails;return O===null?null:O.edge+O.age},y.computeLatency=function(){var O=this.estimateLiveEdge();return O===null?null:O-this.currentTime},U(L,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var O=this.config,C=this.levelDetails;return O.liveMaxLatencyDuration!==void 0?O.liveMaxLatencyDuration:C?O.liveMaxLatencyDurationCount*C.targetduration:0}},{key:"targetLatency",get:function(){var O=this.levelDetails;if(O===null)return null;var C=O.holdBack,T=O.partHoldBack,g=O.targetduration,d=this.config,o=d.liveSyncDuration,u=d.liveSyncDurationCount,s=d.lowLatencyMode,w=this.hls.userConfig,p=s&&T||C;(w.liveSyncDuration||w.liveSyncDurationCount||p===0)&&(p=o!==void 0?o:u*g);var f=g,_=1;return p+Math.min(this.stallCount*_,f)}},{key:"liveSyncPosition",get:function(){var O=this.estimateLiveEdge(),C=this.targetLatency,T=this.levelDetails;if(O===null||C===null||T===null)return null;var g=T.edge,d=O-C-this.edgeStalled,o=g-T.totalduration,u=g-(this.config.lowLatencyMode&&T.partTarget||T.targetduration);return Math.min(Math.max(o,d),u)}},{key:"drift",get:function(){var O=this.levelDetails;return O===null?1:O.drift}},{key:"edgeStalled",get:function(){var O=this.levelDetails;if(O===null)return 0;var C=(this.config.lowLatencyMode&&O.partTarget||O.targetduration)*3;return Math.max(O.age-C,0)}},{key:"forwardBufferLength",get:function(){var O=this.media,C=this.levelDetails;if(!O||!C)return 0;var T=O.buffered.length;return T?O.buffered.end(T-1):C.edge-this.currentTime}}]),L}()},"./src/controller/level-controller.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"default",function(){return d});var G=A("./src/types/level.ts"),I=A("./src/events.ts"),R=A("./src/errors.ts"),B=A("./src/utils/codecs.ts"),U=A("./src/controller/level-helper.ts"),k=A("./src/controller/base-playlist-controller.ts"),L=A("./src/types/loader.ts");function y(){return y=Object.assign||function(o){for(var u=1;u0){c=_[0].bitrate,_.sort(function(W,D){return W.bitrate-D.bitrate}),this._levels=_;for(var M=0;M<_.length;M++)if(_[M].bitrate===c){this._firstLevel=M,this.log("manifest loaded, "+_.length+" level(s) found, first bitrate: "+c);break}var F=E&&!m,j={levels:_,audioTracks:b,subtitleTracks:h,firstLevel:this._firstLevel,stats:f.stats,audio:E,video:m,altAudio:!F&&b.some(function(W){return!!W.url})};this.hls.trigger(I.Events.MANIFEST_PARSED,j),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(I.Events.ERROR,{type:R.ErrorTypes.MEDIA_ERROR,details:R.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:f.url,reason:"no level with compatible codecs found in manifest"})},s.onError=function(p,f){if(o.prototype.onError.call(this,p,f),f.fatal)return;var _=f.context,b=this._levels[this.currentLevelIndex];if(_&&(_.type===L.PlaylistContextType.AUDIO_TRACK&&b.audioGroupIds&&_.groupId===b.audioGroupIds[b.urlId]||_.type===L.PlaylistContextType.SUBTITLE_TRACK&&b.textGroupIds&&_.groupId===b.textGroupIds[b.urlId])){this.redundantFailover(this.currentLevelIndex);return}var h=!1,c=!0,l;switch(f.details){case R.ErrorDetails.FRAG_LOAD_ERROR:case R.ErrorDetails.FRAG_LOAD_TIMEOUT:case R.ErrorDetails.KEY_LOAD_ERROR:case R.ErrorDetails.KEY_LOAD_TIMEOUT:if(f.frag){var a=this._levels[f.frag.level];a?(a.fragmentError++,a.fragmentError>this.hls.config.fragLoadingMaxRetry&&(l=f.frag.level)):l=f.frag.level}break;case R.ErrorDetails.LEVEL_LOAD_ERROR:case R.ErrorDetails.LEVEL_LOAD_TIMEOUT:_&&(_.deliveryDirectives&&(c=!1),l=_.level),h=!0;break;case R.ErrorDetails.REMUX_ALLOC_ERROR:l=f.level,h=!0;break}l!==void 0&&this.recoverLevel(f,l,h,c)},s.recoverLevel=function(p,f,_,b){var h=p.details,c=this._levels[f];if(c.loadError++,_){var l=this.retryLoadingOrFail(p);if(l)p.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(b){var a=c.url.length;if(a>1&&c.loadError1){var b=(f.urlId+1)%_;this.warn("Switching to redundant URL-id "+b),this._levels.forEach(function(h){h.urlId=b}),this.level=p}},s.onFragLoaded=function(p,f){var _=f.frag;if(_!==void 0&&_.type===L.PlaylistLevelType.MAIN){var b=this._levels[_.level];b!==void 0&&(b.fragmentError=0,b.loadError=0)}},s.onLevelLoaded=function(p,f){var _,b=f.level,h=f.details,c=this._levels[b];if(!c){var l;this.warn("Invalid level index "+b),(l=f.deliveryDirectives)!==null&&l!==void 0&&l.skip&&(h.deltaUpdateFailed=!0);return}b===this.currentLevelIndex?(c.fragmentError===0&&(c.loadError=0,this.retryCount=0),this.playlistLoaded(b,f,c.details)):(_=f.deliveryDirectives)!==null&&_!==void 0&&_.skip&&(h.deltaUpdateFailed=!0)},s.onAudioTrackSwitched=function(p,f){var _=this.hls.levels[this.currentLevelIndex];if(!_)return;if(_.audioGroupIds){for(var b=-1,h=this.hls.audioTracks[f.id].groupId,c=0;c<_.audioGroupIds.length;c++)if(_.audioGroupIds[c]===h){b=c;break}b!==_.urlId&&(_.urlId=b,this.startLoad())}},s.loadPlaylist=function(p){var f=this.currentLevelIndex,_=this._levels[f];if(this.canLoad&&_&&_.url.length>0){var b=_.urlId,h=_.url[b];if(p)try{h=p.addDirectives(h)}catch(c){this.warn("Could not construct new URL with HLS Delivery Directives: "+c)}this.log("Attempt loading level index "+f+(p?" at sn "+p.msn+" part "+p.part:"")+" with URL-id "+b+" "+h),this.clearTimer(),this.hls.trigger(I.Events.LEVEL_LOADING,{url:h,level:f,id:b,deliveryDirectives:p||null})}},s.removeLevel=function(p,f){var _=function(c,l){return l!==f},b=this._levels.filter(function(h,c){return c!==p?!0:h.url.length>1&&f!==void 0?(h.url=h.url.filter(_),h.audioGroupIds&&(h.audioGroupIds=h.audioGroupIds.filter(_)),h.textGroupIds&&(h.textGroupIds=h.textGroupIds.filter(_)),h.urlId=0,!0):!1}).map(function(h,c){var l=h.details;return l!=null&&l.fragments&&l.fragments.forEach(function(a){a.level=c}),h});this._levels=b,this.hls.trigger(I.Events.LEVELS_UPDATED,{levels:b})},O(u,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(p){var f,_=this._levels;if(_.length===0)return;if(this.currentLevelIndex===p&&(f=_[p])!==null&&f!==void 0&&f.details)return;if(p<0||p>=_.length){var b=p<0;if(this.hls.trigger(I.Events.ERROR,{type:R.ErrorTypes.OTHER_ERROR,details:R.ErrorDetails.LEVEL_SWITCH_ERROR,level:p,fatal:b,reason:"invalid level idx"}),b)return;p=Math.min(p,_.length-1)}this.clearTimer();var h=this.currentLevelIndex,c=_[h],l=_[p];this.log("switching to level "+p+" from "+h),this.currentLevelIndex=p;var a=y({},l,{level:p,maxBitrate:l.maxBitrate,uri:l.uri,urlId:l.urlId});delete a._urlId,this.hls.trigger(I.Events.LEVEL_SWITCHING,a);var v=l.details;if(!v||v.live){var m=this.switchParams(l.uri,c==null?void 0:c.details);this.loadPlaylist(m)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(p){this.manualLevelIndex=p,this._startLevel===void 0&&(this._startLevel=p),p!==-1&&(this.level=p)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(p){this._firstLevel=p}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var p=this.hls.config.startLevel;return p!==void 0?p:this._firstLevel}else return this._startLevel},set:function(p){this._startLevel=p}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(p){this.level=p,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=p)}}]),u}(k.default)},"./src/controller/level-helper.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"addGroupId",function(){return R}),A.d(V,"assignTrackIdsByGroup",function(){return B}),A.d(V,"updatePTS",function(){return U}),A.d(V,"updateFragPTSDTS",function(){return L}),A.d(V,"mergeDetails",function(){return y}),A.d(V,"mapPartIntersection",function(){return x}),A.d(V,"mapFragmentIntersection",function(){return O}),A.d(V,"adjustSliding",function(){return C}),A.d(V,"addSliding",function(){return T}),A.d(V,"computeReloadInterval",function(){return g}),A.d(V,"getFragmentWithSN",function(){return d}),A.d(V,"getPartWith",function(){return o});var G=A("./src/polyfills/number.ts"),I=A("./src/utils/logger.ts");function R(u,s,w){switch(s){case"audio":u.audioGroupIds||(u.audioGroupIds=[]),u.audioGroupIds.push(w);break;case"text":u.textGroupIds||(u.textGroupIds=[]),u.textGroupIds.push(w);break}}function B(u){var s={};u.forEach(function(w){var p=w.groupId||"";w.id=s[p]=s[p]||0,s[p]++})}function U(u,s,w){var p=u[s],f=u[w];k(p,f)}function k(u,s){var w=s.startPTS;if(Object(G.isFiniteNumber)(w)){var p=0,f;s.sn>u.sn?(p=w-u.start,f=u):(p=u.start-w,f=s),f.duration!==p&&(f.duration=p)}else if(s.sn>u.sn){var _=u.cc===s.cc;_&&u.minEndPTS?s.start=u.start+(u.minEndPTS-u.start):s.start=u.start+u.duration}else s.start=Math.max(u.start-s.duration,0)}function L(u,s,w,p,f,_){var b=p-w;b<=0&&(I.logger.warn("Fragment should have a positive duration",s),p=w+s.duration,_=f+s.duration);var h=w,c=p,l=s.startPTS,a=s.endPTS;if(Object(G.isFiniteNumber)(l)){var v=Math.abs(l-w);Object(G.isFiniteNumber)(s.deltaPTS)?s.deltaPTS=Math.max(v,s.deltaPTS):s.deltaPTS=v,h=Math.max(w,l),w=Math.min(w,l),f=Math.min(f,s.startDTS),c=Math.min(p,a),p=Math.max(p,a),_=Math.max(_,s.endDTS)}s.duration=p-w;var m=w-s.start;s.appendedPTS=p,s.start=s.startPTS=w,s.maxStartPTS=h,s.startDTS=f,s.endPTS=p,s.minEndPTS=c,s.endDTS=_;var E=s.sn;if(!u||Eu.endSN)return 0;var M,F=E-u.startSN,j=u.fragments;for(j[F]=s,M=F;M>0;M--)k(j[M],j[M-1]);for(M=F;M=0;f--){var _=p[f].initSegment;if(_){w=_;break}}u.fragmentHint&&delete u.fragmentHint.endPTS;var b=0,h;if(O(u,s,function(M,F){M.relurl&&(b=M.cc-F.cc),Object(G.isFiniteNumber)(M.startPTS)&&Object(G.isFiniteNumber)(M.endPTS)&&(F.start=F.startPTS=M.startPTS,F.startDTS=M.startDTS,F.appendedPTS=M.appendedPTS,F.maxStartPTS=M.maxStartPTS,F.endPTS=M.endPTS,F.endDTS=M.endDTS,F.minEndPTS=M.minEndPTS,F.duration=M.endPTS-M.startPTS,F.duration&&(h=F),s.PTSKnown=s.alignedSliding=!0),F.elementaryStreams=M.elementaryStreams,F.loader=M.loader,F.stats=M.stats,F.urlId=M.urlId,M.initSegment&&(F.initSegment=M.initSegment,w=M.initSegment)}),w){var c=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments;c.forEach(function(M){var F;(!M.initSegment||M.initSegment.relurl===((F=w)===null||F===void 0?void 0:F.relurl))&&(M.initSegment=w)})}if(s.skippedSegments&&(s.deltaUpdateFailed=s.fragments.some(function(M){return!M}),s.deltaUpdateFailed)){I.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var l=s.skippedSegments;l--;)s.fragments.shift();s.startSN=s.fragments[0].sn,s.startCC=s.fragments[0].cc}var a=s.fragments;if(b){I.logger.warn("discontinuity sliding from playlist, take drift into account");for(var v=0;v=p.length)return;T(s,p[w].start)}function T(u,s){if(s){for(var w=u.fragments,p=u.skippedSegments;p0&&f0&&c===-1&&(this.log("Override startPosition with lastCurrentTime @"+l.toFixed(3)),c=l),this.state=I.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=c,this.tick()}else this._forceStartLoad=!0,this.state=I.State.STOPPED},b.stopLoad=function(){this._forceStartLoad=!1,f.prototype.stopLoad.call(this)},b.doTick=function(){switch(this.state){case I.State.IDLE:this.doTickIdle();break;case I.State.WAITING_LEVEL:{var c,l=this.levels,a=this.level,v=l==null||((c=l[a])===null||c===void 0)?void 0:c.details;if(v&&(!v.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(v))break;this.state=I.State.IDLE;break}break}case I.State.FRAG_LOADING_WAITING_RETRY:{var m,E=self.performance.now(),M=this.retryDate;(!M||E>=M||(m=this.media)!==null&&m!==void 0&&m.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=I.State.IDLE)}break;default:break}this.onTickEnd()},b.onTickEnd=function(){f.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},b.doTickIdle=function(){var c,l,a=this.hls,v=this.levelLastLoaded,m=this.levels,E=this.media,M=a.config,F=a.nextLoadLevel;if(v===null||!E&&(this.startFragRequested||!M.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!m||!m[F])return;var j=m[F];this.level=a.nextLoadLevel=F;var W=j.details;if(!W||this.state===I.State.WAITING_LEVEL||W.live&&this.levelLastLoaded!==F){this.state=I.State.WAITING_LEVEL;return}var D=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:E,L.PlaylistLevelType.MAIN);if(D===null)return;var P=D.len,H=this.getMaxBufferLength(j.maxBitrate);if(P>=H)return;if(this._streamEnded(D,W)){var Y={};this.altAudio&&(Y.type="video"),this.hls.trigger(B.Events.BUFFER_EOS,Y),this.state=I.State.ENDED;return}var ee=D.end,oe=this.getNextFragment(ee,W);if(this.couldBacktrack&&!this.fragPrevious&&oe&&oe.sn!=="initSegment"){var Te=oe.sn-W.startSN;Te>1&&(oe=W.fragments[Te-1],this.fragmentTracker.removeFragment(oe))}if(oe&&this.fragmentTracker.getState(oe)===k.FragmentState.OK&&this.nextLoadPosition>ee){var ve=this.audioOnly&&!this.altAudio?y.ElementaryStreamTypes.AUDIO:y.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(E,ve,L.PlaylistLevelType.MAIN),oe=this.getNextFragment(this.nextLoadPosition,W)}if(!oe)return;oe.initSegment&&!oe.initSegment.data&&!this.bitrateTest&&(oe=oe.initSegment),((c=oe.decryptdata)===null||c===void 0?void 0:c.keyFormat)==="identity"&&!((l=oe.decryptdata)!==null&&l!==void 0&&l.key)?this.loadKey(oe,W):this.loadFragment(oe,W,ee)},b.loadFragment=function(c,l,a){var v,m=this.fragmentTracker.getState(c);if(this.fragCurrent=c,m===k.FragmentState.BACKTRACKED){var E=this.fragmentTracker.getBacktrackData(c);if(E){this._handleFragmentLoadProgress(E),this._handleFragmentLoadComplete(E);return}else m=k.FragmentState.NOT_LOADED}m===k.FragmentState.NOT_LOADED||m===k.FragmentState.PARTIAL?c.sn==="initSegment"?this._loadInitSegment(c):this.bitrateTest?(c.bitrateTest=!0,this.log("Fragment "+c.sn+" of level "+c.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(c)):(this.startFragRequested=!0,f.prototype.loadFragment.call(this,c,l,a)):m===k.FragmentState.APPENDING?this.reduceMaxBufferLength(c.duration)&&this.fragmentTracker.removeFragment(c):((v=this.media)===null||v===void 0?void 0:v.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},b.getAppendedFrag=function(c){var l=this.fragmentTracker.getAppendedFrag(c,L.PlaylistLevelType.MAIN);return l&&"fragment"in l?l.fragment:l},b.getBufferedFrag=function(c){return this.fragmentTracker.getBufferedFrag(c,L.PlaylistLevelType.MAIN)},b.followingBufferedFrag=function(c){return c?this.getBufferedFrag(c.end+.5):null},b.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},b.nextLevelSwitch=function(){var c=this.levels,l=this.media;if(l!=null&&l.readyState){var a,v=this.getAppendedFrag(l.currentTime);if(v&&v.start>1&&this.flushMainBuffer(0,v.start-1),!l.paused&&c){var m=this.hls.nextLoadLevel,E=c[m],M=this.fragLastKbps;M&&this.fragCurrent?a=this.fragCurrent.duration*E.maxBitrate/(1e3*M)+1:a=0}else a=0;var F=this.getBufferedFrag(l.currentTime+a);if(F){var j=this.followingBufferedFrag(F);if(j){this.abortCurrentFrag();var W=j.maxStartPTS?j.maxStartPTS:j.start,D=j.duration,P=Math.max(F.end,W+Math.min(Math.max(D-this.config.maxFragLookUpTolerance,D*.5),D*.75));this.flushMainBuffer(P,Number.POSITIVE_INFINITY)}}}},b.abortCurrentFrag=function(){var c=this.fragCurrent;this.fragCurrent=null,c!=null&&c.loader&&c.loader.abort(),this.state===I.State.KEY_LOADING&&(this.state=I.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},b.flushMainBuffer=function(c,l){f.prototype.flushMainBuffer.call(this,c,l,this.altAudio?"video":null)},b.onMediaAttached=function(c,l){f.prototype.onMediaAttached.call(this,c,l);var a=l.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),a.addEventListener("playing",this.onvplaying),a.addEventListener("seeked",this.onvseeked),this.gapController=new C.default(this.config,a,this.fragmentTracker,this.hls)},b.onMediaDetaching=function(){var c=this.media;c&&(c.removeEventListener("playing",this.onvplaying),c.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),f.prototype.onMediaDetaching.call(this)},b.onMediaPlaying=function(){this.tick()},b.onMediaSeeked=function(){var c=this.media,l=c?c.currentTime:null;Object(G.isFiniteNumber)(l)&&this.log("Media seeked to "+l.toFixed(3)),this.tick()},b.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(B.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},b.onManifestParsed=function(c,l){var a=!1,v=!1,m;l.levels.forEach(function(E){m=E.audioCodec,m&&(m.indexOf("mp4a.40.2")!==-1&&(a=!0),m.indexOf("mp4a.40.5")!==-1&&(v=!0))}),this.audioCodecSwitch=a&&v&&!Object(R.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=l.levels,this.startFragRequested=!1},b.onLevelLoading=function(c,l){var a=this.levels;if(!a||this.state!==I.State.IDLE)return;var v=a[l.level];(!v.details||v.details.live&&this.levelLastLoaded!==l.level||this.waitForCdnTuneIn(v.details))&&(this.state=I.State.WAITING_LEVEL)},b.onLevelLoaded=function(c,l){var a,v=this.levels,m=l.level,E=l.details,M=E.totalduration;if(!v){this.warn("Levels were reset while loading level "+m);return}this.log("Level "+m+" loaded ["+E.startSN+","+E.endSN+"], cc ["+E.startCC+", "+E.endCC+"] duration:"+M);var F=this.fragCurrent;F&&(this.state===I.State.FRAG_LOADING||this.state===I.State.FRAG_LOADING_WAITING_RETRY)&&(F.level!==l.level&&F.loader&&(this.state=I.State.IDLE,F.loader.abort()));var j=v[m],W=0;if(E.live||(a=j.details)!==null&&a!==void 0&&a.live){if(E.fragments[0]||(E.deltaUpdateFailed=!0),E.deltaUpdateFailed)return;W=this.alignPlaylists(E,j.details)}if(j.details=E,this.levelLastLoaded=m,this.hls.trigger(B.Events.LEVEL_UPDATED,{details:E,level:m}),this.state===I.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(E))return;this.state=I.State.IDLE}this.startFragRequested?E.live&&this.synchronizeToLiveEdge(E):this.setStartPosition(E,W),this.tick()},b._handleFragmentLoadProgress=function(c){var l,a=c.frag,v=c.part,m=c.payload,E=this.levels;if(!E){this.warn("Levels were reset while fragment load was in progress. Fragment "+a.sn+" of level "+a.level+" will not be buffered");return}var M=E[a.level],F=M.details;if(!F){this.warn("Dropping fragment "+a.sn+" of level "+a.level+" after level details were reset");return}var j=M.videoCodec,W=F.PTSKnown||!F.live,D=(l=a.initSegment)===null||l===void 0?void 0:l.data,P=this._getAudioCodec(M),H=this.transmuxer=this.transmuxer||new x.default(this.hls,L.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),Y=v?v.index:-1,ee=Y!==-1,oe=new O.ChunkMetadata(a.level,a.sn,a.stats.chunkCount,m.byteLength,Y,ee),Te=this.initPTS[a.cc];H.push(m,D,P,j,a,v,F.totalduration,W,oe,Te)},b.onAudioTrackSwitching=function(c,l){var a=this.altAudio,v=!!l.url,m=l.id;if(!v){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var E=this.fragCurrent;E!=null&&E.loader&&(this.log("Switching to main audio track, cancel main fragment load"),E.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var M=this.hls;a&&M.trigger(B.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),M.trigger(B.Events.AUDIO_TRACK_SWITCHED,{id:m})}},b.onAudioTrackSwitched=function(c,l){var a=l.id,v=!!this.hls.audioTracks[a].url;if(v){var m=this.videoBuffer;m&&this.mediaBuffer!==m&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=m)}this.altAudio=v,this.tick()},b.onBufferCreated=function(c,l){var a=l.tracks,v,m,E=!1;for(var M in a){var F=a[M];if(F.id==="main"){if(m=M,v=F,M==="video"){var j=a[M];j&&(this.videoBuffer=j.buffer)}}else E=!0}E&&v?(this.log("Alternate track found, use "+m+".buffered to schedule main fragment loading"),this.mediaBuffer=v.buffer):this.mediaBuffer=this.media},b.onFragBuffered=function(c,l){var a=l.frag,v=l.part;if(a&&a.type!==L.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(a)){this.warn("Fragment "+a.sn+(v?" p: "+v.index:"")+" of level "+a.level+" finished buffering, but was aborted. state: "+this.state),this.state===I.State.PARSED&&(this.state=I.State.IDLE);return}var m=v?v.stats:a.stats;this.fragLastKbps=Math.round(8*m.total/(m.buffering.end-m.loading.first)),a.sn!=="initSegment"&&(this.fragPrevious=a),this.fragBufferedComplete(a,v)},b.onError=function(c,l){switch(l.details){case T.ErrorDetails.FRAG_LOAD_ERROR:case T.ErrorDetails.FRAG_LOAD_TIMEOUT:case T.ErrorDetails.KEY_LOAD_ERROR:case T.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(L.PlaylistLevelType.MAIN,l);break;case T.ErrorDetails.LEVEL_LOAD_ERROR:case T.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==I.State.ERROR&&(l.fatal?(this.warn(""+l.details),this.state=I.State.ERROR):!l.levelRetry&&this.state===I.State.WAITING_LEVEL&&(this.state=I.State.IDLE));break;case T.ErrorDetails.BUFFER_FULL_ERROR:if(l.parent==="main"&&(this.state===I.State.PARSING||this.state===I.State.PARSED)){var a=!0,v=this.getFwdBufferInfo(this.media,L.PlaylistLevelType.MAIN);v&&v.len>.5&&(a=!this.reduceMaxBufferLength(v.len)),a&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},b.checkBuffer=function(){var c=this.media,l=this.gapController;if(!c||!l||!c.readyState)return;var a=U.BufferHelper.getBuffered(c);!this.loadedmetadata&&a.length?(this.loadedmetadata=!0,this.seekToStartPos()):l.poll(this.lastCurrentTime),this.lastCurrentTime=c.currentTime},b.onFragLoadEmergencyAborted=function(){this.state=I.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},b.onBufferFlushed=function(c,l){var a=l.type;if(a!==y.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var v=(a===y.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(v,a,L.PlaylistLevelType.MAIN)}},b.onLevelsUpdated=function(c,l){this.levels=l.levels},b.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},b.seekToStartPos=function(){var c=this.media,l=c.currentTime,a=this.startPosition;if(a>=0&&l0&&(E1&&c.seeking===!1){var a=c.currentTime;if(U.BufferHelper.isBuffered(c,a)?l=this.getAppendedFrag(a):U.BufferHelper.isBuffered(c,a+.1)&&(l=this.getAppendedFrag(a+.1)),l){var v=this.fragPlaying,m=l.level;(!v||l.sn!==v.sn||v.level!==m||l.urlId!==v.urlId)&&(this.hls.trigger(B.Events.FRAG_CHANGED,{frag:l}),(!v||v.level!==m)&&this.hls.trigger(B.Events.LEVEL_SWITCHED,{level:m}),this.fragPlaying=l)}}},o(_,[{key:"nextLevel",get:function(){var c=this.nextBufferedFrag;return c?c.level:-1}},{key:"currentLevel",get:function(){var c=this.media;if(c){var l=this.getAppendedFrag(c.currentTime);if(l)return l.level}return-1}},{key:"nextBufferedFrag",get:function(){var c=this.media;if(c){var l=this.getAppendedFrag(c.currentTime);return this.followingBufferedFrag(l)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),_}(I.default)},"./src/controller/subtitle-stream-controller.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"SubtitleStreamController",function(){return u});var G=A("./src/events.ts"),I=A("./src/utils/logger.ts"),R=A("./src/utils/buffer-helper.ts"),B=A("./src/controller/fragment-finders.ts"),U=A("./src/utils/discontinuities.ts"),k=A("./src/controller/level-helper.ts"),L=A("./src/controller/fragment-tracker.ts"),y=A("./src/controller/base-stream-controller.ts"),x=A("./src/types/loader.ts"),O=A("./src/types/level.ts");function C(s,w){for(var p=0;p=l[m].start&&v<=l[m].end){a=l[m];break}var E=h.start+h.duration;a?a.end=E:(a={start:v,end:E},l.push(a)),this.fragmentTracker.fragBuffered(h)},p.onBufferFlushing=function(_,b){var h=b.startOffset,c=b.endOffset;if(h===0&&c!==Number.POSITIVE_INFINITY){var l=this.currentTrackId,a=this.levels;if(!a.length||!a[l]||!a[l].details)return;var v=a[l].details,m=v.targetduration,E=c-m;if(E<=0)return;b.endOffsetSubtitles=Math.max(0,E),this.tracksBuffered.forEach(function(M){for(var F=0;F=v.length||l!==a||!m)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,c.live||(h=m.details)!==null&&h!==void 0&&h.live){var E=this.mainDetails;if(c.deltaUpdateFailed||!E)return;var M=E.fragments[0];if(!m.details)c.hasProgramDateTime&&E.hasProgramDateTime?Object(U.alignMediaPlaylistByPDT)(c,E):M&&Object(k.addSliding)(c,M.start);else{var F=this.alignPlaylists(c,m.details);F===0&&M&&Object(k.addSliding)(c,M.start)}}if(m.details=c,this.levelLastLoaded=l,this.tick(),c.live&&!this.fragCurrent&&this.media&&this.state===y.State.IDLE){var j=Object(B.findFragmentByPTS)(null,c.fragments,this.media.currentTime,0);j||(this.warn("Subtitle playlist not aligned with playback"),m.details=void 0)}},p._handleFragmentLoadComplete=function(_){var b=_.frag,h=_.payload,c=b.decryptdata,l=this.hls;if(this.fragContextChanged(b))return;if(h&&h.byteLength>0&&c&&c.key&&c.iv&&c.method==="AES-128"){var a=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(h),c.key.buffer,c.iv.buffer).then(function(v){var m=performance.now();l.trigger(G.Events.FRAG_DECRYPTED,{frag:b,payload:v,stats:{tstart:a,tdecrypt:m}})})}},p.doTick=function(){if(!this.media){this.state=y.State.IDLE;return}if(this.state===y.State.IDLE){var _,b=this.currentTrackId,h=this.levels;if(!h.length||!h[b]||!h[b].details)return;var c=h[b].details,l=c.targetduration,a=this.config,v=this.media,m=R.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,v.currentTime-l,a.maxBufferHole),E=m.end,M=m.len,F=this.getMaxBufferLength()+l;if(M>F)return;console.assert(c,"Subtitle track details are defined on idle subtitle stream controller tick");var j=c.fragments,W=j.length,D=c.edge,P,H=this.fragPrevious;if(E-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)},g.pollTrackChange=function(o){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,o)},g.onMediaDetaching=function(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId);var o=O(this.media.textTracks);o.forEach(function(u){Object(I.clearCurrentCues)(u)}),this.subtitleTrack=-1,this.media=null},g.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},g.onManifestParsed=function(o,u){this.tracks=u.subtitleTracks},g.onSubtitleTrackLoaded=function(o,u){var s=u.id,w=u.details,p=this.trackId,f=this.tracksInGroup[p];if(!f){this.warn("Invalid subtitle track id "+s);return}var _=f.details;f.details=u.details,this.log("subtitle track "+s+" loaded ["+w.startSN+"-"+w.endSN+"]"),s===this.trackId&&(this.retryCount=0,this.playlistLoaded(s,u,_))},g.onLevelLoading=function(o,u){this.switchLevel(u.level)},g.onLevelSwitching=function(o,u){this.switchLevel(u.level)},g.switchLevel=function(o){var u=this.hls.levels[o];if(!(u!=null&&u.textGroupIds))return;var s=u.textGroupIds[u.urlId];if(this.groupId!==s){var w=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,p=this.tracks.filter(function(b){return!s||b.groupId===s});this.tracksInGroup=p;var f=this.findTrackId(w==null?void 0:w.name)||this.findTrackId();this.groupId=s;var _={subtitleTracks:p};this.log("Updating subtitle tracks, "+p.length+' track(s) found in "'+s+'" group-id'),this.hls.trigger(G.Events.SUBTITLE_TRACKS_UPDATED,_),f!==-1&&this.setSubtitleTrack(f,w)}},g.findTrackId=function(o){for(var u=this.tracksInGroup,s=0;s=w.length)return;this.clearTimer();var p=w[o];if(this.log("Switching to subtitle track "+o),this.trackId=o,p){var f=p.id,_=p.groupId,b=_===void 0?"":_,h=p.name,c=p.type,l=p.url;this.hls.trigger(G.Events.SUBTITLE_TRACK_SWITCH,{id:f,groupId:b,name:h,type:c,url:l});var a=this.switchParams(p.url,u==null?void 0:u.details);this.loadPlaylist(a)}else this.hls.trigger(G.Events.SUBTITLE_TRACK_SWITCH,{id:o})},g.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var o=-1,u=O(this.media.textTracks),s=0;s=0&&(c[0]=Math.min(c[0],w),c[1]=Math.max(c[1],p),b=!0,l/(p-w)>.5))return}if(b||_.push([w,p]),this.config.renderTextTracksNatively){var a=this.captionsTracks[s];this.Cues.newCue(a,w,p,f)}else{var v=this.Cues.newCue(null,w,p,f);this.hls.trigger(I.Events.CUES_PARSED,{type:"captions",cues:v,track:s})}},o.onInitPtsFound=function(s,w){var p=this,f=w.frag,_=w.id,b=w.initPTS,h=w.timescale,c=this.unparsedVttFrags;_==="main"&&(this.initPTS[f.cc]=b,this.timescale[f.cc]=h),c.length&&(this.unparsedVttFrags=[],c.forEach(function(l){p.onFragLoaded(I.Events.FRAG_LOADED,l)}))},o.getExistingTrack=function(s){var w=this.media;if(w)for(var p=0;p>>8^h&255^99,L[f]=h,y[h]=f;var c=p[f],l=p[c],a=p[l],v=p[h]*257^h*16843008;O[f]=v<<24|v>>>8,C[f]=v<<16|v>>>16,T[f]=v<<8|v>>>24,g[f]=v,v=a*16843009^l*65537^c*257^f*16843008,o[h]=v<<24|v>>>8,u[h]=v<<16|v>>>16,s[h]=v<<8|v>>>24,w[h]=v,f?(f=c^p[p[p[a^c]]],_^=p[p[_]]):f=_=1}},U.expandKey=function(L){for(var y=this.uint8ArrayToUint32Array_(L),x=!0,O=0;O>>6)+1;var v=(s[w+2]&60)>>>2;if(v>a.length-1){u.trigger(R.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+v});return}return b=(s[w+2]&1)<<2,b|=(s[w+3]&192)>>>6,G.logger.log("manifest codec:"+p+", ADTS type:"+f+", samplingIndex:"+v),/firefox/i.test(c)?v>=6?(f=5,h=new Array(4),_=v-3):(f=2,h=new Array(2),_=v):c.indexOf("android")!==-1?(f=2,h=new Array(2),_=v):(f=5,h=new Array(4),p&&(p.indexOf("mp4a.40.29")!==-1||p.indexOf("mp4a.40.5")!==-1)||!p&&v>=6?_=v-3:((p&&p.indexOf("mp4a.40.2")!==-1&&(v>=6&&b===1||/vivaldi/i.test(c))||!p&&b===1)&&(f=2,h=new Array(2)),_=v)),h[0]=f<<3,h[0]|=(v&14)>>1,h[1]|=(v&1)<<7,h[1]|=b<<3,f===5&&(h[1]|=(_&14)>>1,h[2]=(_&1)<<7,h[2]|=2<<2,h[3]=0),{config:h,samplerate:a[v],channelCount:b,codec:"mp4a.40."+f,manifestCodec:l}}function U(u,s){return u[s]===255&&(u[s+1]&246)===240}function k(u,s){return u[s+1]&1?7:9}function L(u,s){return(u[s+3]&3)<<11|u[s+4]<<3|(u[s+5]&224)>>>5}function y(u,s){return s+5=u.length)return!1;var p=L(u,s);if(p<=w)return!1;var f=s+p;return f===u.length||x(u,f)}return!1}function T(u,s,w,p,f){if(!u.samplerate){var _=B(s,w,p,f);if(!_)return;u.config=_.config,u.samplerate=_.samplerate,u.channelCount=_.channelCount,u.codec=_.codec,u.manifestCodec=_.manifestCodec,G.logger.log("parsed codec:"+u.codec+", rate:"+_.samplerate+", channels:"+_.channelCount)}}function g(u){return 1024*9e4/u}function d(u,s,w,p,f){var _=k(u,s),b=L(u,s);if(b-=_,b>0){var h=w+p*f;return{headerLength:_,frameLength:b,stamp:h}}}function o(u,s,w,p,f){var _=g(u.samplerate),b=d(s,w,p,f,_);if(b){var h=b.frameLength,c=b.headerLength,l=b.stamp,a=c+h,v=Math.max(0,w+a-s.length),m;v?(m=new Uint8Array(a-c),m.set(s.subarray(w+c,s.length),0)):m=s.subarray(w+c,w+a);var E={unit:m,pts:l};return v||u.samples.push(E),{sample:E,length:a,missing:v}}}},"./src/demux/base-audio-demuxer.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"initPTSFn",function(){return L});var G=A("./src/polyfills/number.ts"),I=A("./src/demux/id3.ts"),R=A("./src/demux/dummy-demuxed-track.ts"),B=A("./src/utils/mp4-tools.ts"),U=A("./src/utils/typed-array.ts"),k=function(){function y(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var x=y.prototype;return x.resetInitSegment=function(C,T,g){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},x.resetTimeStamp=function(){},x.resetContiguity=function(){},x.canParse=function(C,T){return!1},x.appendFrame=function(C,T,g){},x.demux=function(C,T){this.cachedData&&(C=Object(B.appendUint8Array)(this.cachedData,C),this.cachedData=null);var g=I.getID3Data(C,0),d=g?g.length:0,o,u,s=this._audioTrack,w=this._id3Track,p=g?I.getTimeStamp(g):void 0,f=C.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=L(p,T)),g&&g.length>0&&w.samples.push({pts:this.initPTS,dts:this.initPTS,data:g}),u=this.initPTS;dk?(this.word<<=k,this.bitsAvailable-=k):(k-=this.bitsAvailable,L=k>>3,k-=L>>3,this.bytesAvailable-=L,this.loadWord(),this.word<<=k,this.bitsAvailable-=k)},B.readBits=function(k){var L=Math.min(this.bitsAvailable,k),y=this.word>>>32-L;return k>32&&G.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=L,this.bitsAvailable>0?this.word<<=L:this.bytesAvailable>0&&this.loadWord(),L=k-L,L>0&&this.bitsAvailable?y<>>k)!==0)return this.word<<=k,this.bitsAvailable-=k,k;return this.loadWord(),k+this.skipLZ()},B.skipUEG=function(){this.skipBits(1+this.skipLZ())},B.skipEG=function(){this.skipBits(1+this.skipLZ())},B.readUEG=function(){var k=this.skipLZ();return this.readBits(k+1)-1},B.readEG=function(){var k=this.readUEG();return 1&k?1+k>>>1:-1*(k>>>1)},B.readBoolean=function(){return this.readBits(1)===1},B.readUByte=function(){return this.readBits(8)},B.readUShort=function(){return this.readBits(16)},B.readUInt=function(){return this.readBits(32)},B.skipScalingList=function(k){for(var L=8,y=8,x,O=0;O0?f.subarray(b,b+h):void 0},B=function(f,_){var b=0;return b=(f[_]&127)<<21,b|=(f[_+1]&127)<<14,b|=(f[_+2]&127)<<7,b|=f[_+3]&127,b},U=function(f,_){return G(f,_)&&B(f,_+6)+10<=f.length-_},k=function(f){for(var _=x(f),b=0;b<_.length;b++){var h=_[b];if(L(h))return d(h)}return},L=function(f){return f&&f.key==="PRIV"&&f.info==="com.apple.streaming.transportStreamTimestamp"},y=function(f){var _=String.fromCharCode(f[0],f[1],f[2],f[3]),b=B(f,4),h=10;return{type:_,size:b,data:f.subarray(h,h+b)}},x=function(f){for(var _=0,b=[];G(f,_);){var h=B(f,_+6);_+=10;for(var c=_+h;_+8>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:E+=String.fromCharCode(a);break;case 12:case 13:v=f[M++],E+=String.fromCharCode((a&31)<<6|v&63);break;case 14:v=f[M++],m=f[M++],E+=String.fromCharCode((a&15)<<12|(v&63)<<6|(m&63)<<0);break;default:}}return E},u={decodeTextFrame:T},s;function w(){return!s&&typeof self.TextDecoder!="undefined"&&(s=new self.TextDecoder("utf-8")),s}},"./src/demux/mp3demuxer.ts":function(re,V,A){"use strict";A.r(V);var G=A("./src/demux/base-audio-demuxer.ts"),I=A("./src/demux/id3.ts"),R=A("./src/utils/logger.ts"),B=A("./src/demux/mpegaudio.ts");function U(y,x){y.prototype=Object.create(x.prototype),y.prototype.constructor=y,k(y,x)}function k(y,x){return k=Object.setPrototypeOf||function(C,T){return C.__proto__=T,C},k(y,x)}var L=function(y){U(x,y);function x(){return y.apply(this,arguments)||this}var O=x.prototype;return O.resetInitSegment=function(T,g,d){y.prototype.resetInitSegment.call(this,T,g,d),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:T,duration:d,inputTimeScale:9e4,dropped:0}},x.probe=function(T){if(!T)return!1;for(var g=I.getID3Data(T,0)||[],d=g.length,o=T.length;d0},U.demux=function(L){var y=L,x=Object(I.dummyTrack)();if(this.config.progressive){this.remainderData&&(y=Object(G.appendUint8Array)(this.remainderData,L));var O=Object(G.segmentValidRange)(y);this.remainderData=O.remainder,x.samples=O.valid||new Uint8Array}else x.samples=y;return{audioTrack:Object(I.dummyTrack)(),avcTrack:x,id3Track:Object(I.dummyTrack)(),textTrack:Object(I.dummyTrack)()}},U.flush=function(){var L=Object(I.dummyTrack)();return L.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(I.dummyTrack)(),avcTrack:L,id3Track:Object(I.dummyTrack)(),textTrack:Object(I.dummyTrack)()}},U.demuxSampleAes=function(L,y,x){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},U.destroy=function(){},B}();R.minProbeByteLength=1024,V.default=R},"./src/demux/mpegaudio.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"appendFrame",function(){return k}),A.d(V,"parseHeader",function(){return L}),A.d(V,"isHeaderPattern",function(){return y}),A.d(V,"isHeader",function(){return x}),A.d(V,"canParse",function(){return O}),A.d(V,"probe",function(){return C});var G=null,I=[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],R=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],B=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],U=[0,1,1,4];function k(T,g,d,o,u){if(d+24>g.length)return;var s=L(g,d);if(s&&d+s.frameLength<=g.length){var w=s.samplesPerFrame*9e4/s.sampleRate,p=o+u*w,f={unit:g.subarray(d,d+s.frameLength),pts:p,dts:p};return T.config=[],T.channelCount=s.channelCount,T.samplerate=s.sampleRate,T.samples.push(f),{sample:f,length:s.frameLength,missing:0}}}function L(T,g){var d=T[g+1]>>3&3,o=T[g+1]>>1&3,u=T[g+2]>>4&15,s=T[g+2]>>2&3;if(d!==1&&u!==0&&u!==15&&s!==3){var w=T[g+2]>>1&1,p=T[g+3]>>6,f=d===3?3-o:o===3?3:4,_=I[f*14+u-1]*1e3,b=d===3?0:d===2?1:2,h=R[b*3+s],c=p===3?1:2,l=B[d][o],a=U[o],v=l*8*a,m=Math.floor(l*_/h+w)*a;if(G===null){var E=navigator.userAgent||"",M=E.match(/Chrome\/(\d+)/i);G=M?parseInt(M[1]):0}var F=!!G&&G<=87;return F&&o===2&&_>=224e3&&p===0&&(T[g+3]=T[g+3]|128),{sampleRate:h,channelCount:c,frameLength:m,samplesPerFrame:v}}}function y(T,g){return T[g]===255&&(T[g+1]&224)===224&&(T[g+1]&6)!==0}function x(T,g){return g+1=L.length){x();return}if(L[y].unit.length<32)continue;var O=this.decrypter.isSync();if(this.decryptAacSample(L,y,x,O),!O)return}},U.getAvcEncryptedData=function(L){for(var y=Math.floor((L.length-48)/160)*16+16,x=new Int8Array(y),O=0,C=32;C<=L.length-16;C+=160,O+=16)x.set(L.subarray(C,C+16),O);return x},U.getAvcDecryptedUnit=function(L,y){for(var x=new Uint8Array(y),O=0,C=32;C<=L.length-16;C+=160,O+=16)L.set(x.subarray(O,O+16),C);return L},U.decryptAvcSample=function(L,y,x,O,C,T){var g=Object(I.discardEPB)(C.data),d=this.getAvcEncryptedData(g),o=this;this.decryptBuffer(d.buffer,function(u){C.data=o.getAvcDecryptedUnit(g,u),T||o.decryptAvcSamples(L,y,x+1,O)})},U.decryptAvcSamples=function(L,y,x,O){if(L instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;y++,x=0){if(y>=L.length){O();return}for(var C=L[y].units;!(x>=C.length);x++){var T=C[x];if(T.data.length<=48||T.type!==1&&T.type!==5)continue;var g=this.decrypter.isSync();if(this.decryptAvcSample(L,y,x,O,T,g),!g)return}}},B}();V.default=R},"./src/demux/transmuxer-interface.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"default",function(){return C});var G=A("./node_modules/webworkify-webpack/index.js"),I=A.n(G),R=A("./src/events.ts"),B=A("./src/demux/transmuxer.ts"),U=A("./src/utils/logger.ts"),k=A("./src/errors.ts"),L=A("./src/utils/mediasource-helper.ts"),y=A("./node_modules/eventemitter3/index.js"),x=A.n(y),O=Object(L.getMediaSource)()||{isTypeSupported:function(){return!1}},C=function(){function T(d,o,u,s){var w=this;this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.hls=d,this.id=o,this.onTransmuxComplete=u,this.onFlush=s;var p=d.config,f=function(l,a){a=a||{},a.frag=w.frag,a.id=w.id,d.trigger(l,a)};this.observer=new y.EventEmitter,this.observer.on(R.Events.FRAG_DECRYPTED,f),this.observer.on(R.Events.ERROR,f);var _={mp4:O.isTypeSupported("video/mp4"),mpeg:O.isTypeSupported("audio/mpeg"),mp3:O.isTypeSupported('audio/mp4; codecs="mp3"')},b=navigator.vendor;if(p.enableWorker&&typeof Worker!="undefined"){U.logger.log("demuxing in webworker");var h;try{h=this.worker=G("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),h.addEventListener("message",this.onwmsg),h.onerror=function(c){d.trigger(R.Events.ERROR,{type:k.ErrorTypes.OTHER_ERROR,details:k.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(c.message+" ("+c.filename+":"+c.lineno+")")})},h.postMessage({cmd:"init",typeSupported:_,vendor:b,id:o,config:JSON.stringify(p)})}catch(c){U.logger.warn("Error in worker:",c),U.logger.error("Error while initializing DemuxerWorker, fallback to inline"),h&&self.URL.revokeObjectURL(h.objectURL),this.transmuxer=new B.default(this.observer,_,p,b,o),this.worker=null}}else this.transmuxer=new B.default(this.observer,_,p,b,o)}var g=T.prototype;return g.destroy=function(){var o=this.worker;if(o)o.removeEventListener("message",this.onwmsg),o.terminate(),this.worker=null;else{var u=this.transmuxer;u&&(u.destroy(),this.transmuxer=null)}var s=this.observer;s&&s.removeAllListeners(),this.observer=null},g.push=function(o,u,s,w,p,f,_,b,h,c){var l=this;h.transmuxing.start=self.performance.now();var a=this.transmuxer,v=this.worker,m=f?f.start:p.start,E=p.decryptdata,M=this.frag,F=!(M&&p.cc===M.cc),j=!(M&&h.level===M.level),W=M?h.sn-M.sn:-1,D=this.part?h.part-this.part.index:1,P=!j&&(W===1||W===0&&D===1),H=self.performance.now();(j||W||p.stats.parsing.start===0)&&(p.stats.parsing.start=H),f&&(D||!P)&&(f.stats.parsing.start=H);var Y=new B.TransmuxState(F,P,b,j,m);if(!P||F){U.logger.log("[transmuxer-interface, "+p.type+"]: Starting new transmux session for sn: "+h.sn+" p: "+h.part+" level: "+h.level+" id: "+h.id+` discontinuity: `+F+` trackSwitch: `+j+` contiguous: `+P+` accurateTimeOffset: `+b+` timeOffset: `+m);var ee=new B.TransmuxConfig(s,w,u,_,c);this.configureTransmuxer(ee)}if(this.frag=p,this.part=f,v)v.postMessage({cmd:"demux",data:o,decryptdata:E,chunkMeta:h,state:Y},o instanceof ArrayBuffer?[o]:[]);else if(a){var oe=a.push(o,E,h,Y);Object(B.isPromise)(oe)?oe.then(function(Te){l.handleTransmuxComplete(Te)}):this.handleTransmuxComplete(oe)}},g.flush=function(o){var u=this;o.transmuxing.start=self.performance.now();var s=this.transmuxer,w=this.worker;if(w)w.postMessage({cmd:"flush",chunkMeta:o});else if(s){var p=s.flush(o);Object(B.isPromise)(p)?p.then(function(f){u.handleFlushResult(f,o)}):this.handleFlushResult(p,o)}},g.handleFlushResult=function(o,u){var s=this;o.forEach(function(w){s.handleTransmuxComplete(w)}),this.onFlush(u)},g.onWorkerMessage=function(o){var u=o.data,s=this.hls;switch(u.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(u.data);break}case"flush":{this.onFlush(u.data);break}default:{u.data=u.data||{},u.data.frag=this.frag,u.data.id=this.id,s.trigger(u.event,u.data);break}}},g.configureTransmuxer=function(o){var u=this.worker,s=this.transmuxer;u?u.postMessage({cmd:"configure",config:o}):s&&s.configure(o)},g.handleTransmuxComplete=function(o){o.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(o)},T}()},"./src/demux/transmuxer-worker.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"default",function(){return k});var G=A("./src/demux/transmuxer.ts"),I=A("./src/events.ts"),R=A("./src/utils/logger.ts"),B=A("./node_modules/eventemitter3/index.js"),U=A.n(B);function k(C){var T=new B.EventEmitter,g=function(o,u){C.postMessage({event:o,data:u})};T.on(I.Events.FRAG_DECRYPTED,g),T.on(I.Events.ERROR,g),C.addEventListener("message",function(d){var o=d.data;switch(o.cmd){case"init":{var u=JSON.parse(o.config);C.transmuxer=new G.default(T,o.typeSupported,u,o.vendor,o.id),Object(R.enableLogs)(u.debug),g("init",null);break}case"configure":{C.transmuxer.configure(o.config);break}case"demux":{var s=C.transmuxer.push(o.data,o.decryptdata,o.chunkMeta,o.state);Object(G.isPromise)(s)?s.then(function(f){L(C,f)}):L(C,s);break}case"flush":{var w=o.chunkMeta,p=C.transmuxer.flush(w);Object(G.isPromise)(p)?p.then(function(f){x(C,f,w)}):x(C,p,w);break}default:break}})}function L(C,T){if(O(T.remuxResult))return;var g=[],d=T.remuxResult,o=d.audio,u=d.video;o&&y(g,o),u&&y(g,u),C.postMessage({event:"transmuxComplete",data:T},g)}function y(C,T){T.data1&&C.push(T.data1.buffer),T.data2&&C.push(T.data2.buffer)}function x(C,T,g){T.forEach(function(d){L(C,d)}),C.postMessage({event:"flush",data:g})}function O(C){return!C.audio&&!C.video&&!C.text&&!C.id3&&!C.initSegment}},"./src/demux/transmuxer.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"default",function(){return u}),A.d(V,"isPromise",function(){return p}),A.d(V,"TransmuxConfig",function(){return f}),A.d(V,"TransmuxState",function(){return _});var G=A("./src/events.ts"),I=A("./src/errors.ts"),R=A("./src/crypt/decrypter.ts"),B=A("./src/demux/aacdemuxer.ts"),U=A("./src/demux/mp4demuxer.ts"),k=A("./src/demux/tsdemuxer.ts"),L=A("./src/demux/mp3demuxer.ts"),y=A("./src/remux/mp4-remuxer.ts"),x=A("./src/remux/passthrough-remuxer.ts"),O=A("./src/demux/chunk-cache.ts"),C=A("./src/utils/mp4-tools.ts"),T=A("./src/utils/logger.ts"),g;try{g=self.performance.now.bind(self.performance)}catch(b){T.logger.debug("Unable to use Performance API on this environment"),g=self.Date.now}var d=[{demux:k.default,remux:y.default},{demux:U.default,remux:x.default},{demux:B.default,remux:y.default},{demux:L.default,remux:y.default}],o=1024;d.forEach(function(b){var h=b.demux;o=Math.max(o,h.minProbeByteLength)});var u=function(){function b(c,l,a,v,m){this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.cache=new O.default,this.observer=c,this.typeSupported=l,this.config=a,this.vendor=v,this.id=m}var h=b.prototype;return h.configure=function(l){this.transmuxConfig=l,this.decrypter&&this.decrypter.reset()},h.push=function(l,a,v,m){var E=this,M=v.transmuxing;M.executeStart=g();var F=new Uint8Array(l),j=this.cache,W=this.config,D=this.currentTransmuxState,P=this.transmuxConfig;m&&(this.currentTransmuxState=m);var H=s(F,a);if(H&&H.method==="AES-128"){var Y=this.getDecrypter();if(W.enableSoftwareAES){var ee=Y.softwareDecrypt(F,H.key.buffer,H.iv.buffer);if(!ee)return M.executeEnd=g(),w(v);F=new Uint8Array(ee)}else return this.decryptionPromise=Y.webCryptoDecrypt(F,H.key.buffer,H.iv.buffer).then(function(we){var De=E.push(we,null,v);return E.decryptionPromise=null,De}),this.decryptionPromise}var oe=m||D,Te=oe.contiguous,ve=oe.discontinuity,ge=oe.trackSwitch,he=oe.accurateTimeOffset,fe=oe.timeOffset,ae=P.audioCodec,me=P.videoCodec,J=P.defaultInitPts,ne=P.duration,Q=P.initSegmentData;if((ve||ge)&&this.resetInitSegment(Q,ae,me,ne),ve&&this.resetInitialTimestamp(J),Te||this.resetContiguity(),this.needsProbing(F,ve,ge)){if(j.dataLength){var Ee=j.flush();F=Object(C.appendUint8Array)(Ee,F)}this.configureTransmuxer(F,P)}var Ce=this.transmux(F,H,fe,he,v),ye=this.currentTransmuxState;return ye.contiguous=!0,ye.discontinuity=!1,ye.trackSwitch=!1,M.executeEnd=g(),Ce},h.flush=function(l){var a=this,v=l.transmuxing;v.executeStart=g();var m=this.decrypter,E=this.cache,M=this.currentTransmuxState,F=this.decryptionPromise;if(F)return F.then(function(){return a.flush(l)});var j=[],W=M.timeOffset;if(m){var D=m.flush();D&&j.push(this.push(D,null,l))}var P=E.dataLength;E.reset();var H=this.demuxer,Y=this.remuxer;if(!H||!Y)return P>=o&&this.observer.emit(G.Events.ERROR,G.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),v.executeEnd=g(),[w(l)];var ee=H.flush(W);return p(ee)?ee.then(function(oe){return a.flushRemux(j,oe,l),j}):(this.flushRemux(j,ee,l),j)},h.flushRemux=function(l,a,v){var m=a.audioTrack,E=a.avcTrack,M=a.id3Track,F=a.textTrack,j=this.currentTransmuxState,W=j.accurateTimeOffset,D=j.timeOffset;T.logger.log("[transmuxer.ts]: Flushed fragment "+v.sn+(v.part>-1?" p: "+v.part:"")+" of level "+v.level);var P=this.remuxer.remux(m,E,M,F,D,W,!0,this.id);l.push({remuxResult:P,chunkMeta:v}),v.transmuxing.executeEnd=g()},h.resetInitialTimestamp=function(l){var a=this.demuxer,v=this.remuxer;if(!a||!v)return;a.resetTimeStamp(l),v.resetTimeStamp(l)},h.resetContiguity=function(){var l=this.demuxer,a=this.remuxer;if(!l||!a)return;l.resetContiguity(),a.resetNextTimestamp()},h.resetInitSegment=function(l,a,v,m){var E=this.demuxer,M=this.remuxer;if(!E||!M)return;E.resetInitSegment(a,v,m),M.resetInitSegment(l,a,v)},h.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},h.transmux=function(l,a,v,m,E){var M;return a&&a.method==="SAMPLE-AES"?M=this.transmuxSampleAes(l,a,v,m,E):M=this.transmuxUnencrypted(l,v,m,E),M},h.transmuxUnencrypted=function(l,a,v,m){var E=this.demuxer.demux(l,a,!1,!this.config.progressive),M=E.audioTrack,F=E.avcTrack,j=E.id3Track,W=E.textTrack,D=this.remuxer.remux(M,F,j,W,a,v,!1,this.id);return{remuxResult:D,chunkMeta:m}},h.transmuxSampleAes=function(l,a,v,m,E){var M=this;return this.demuxer.demuxSampleAes(l,a,v).then(function(F){var j=M.remuxer.remux(F.audioTrack,F.avcTrack,F.id3Track,F.textTrack,v,m,!1,M.id);return{remuxResult:j,chunkMeta:E}})},h.configureTransmuxer=function(l,a){for(var v=this.config,m=this.observer,E=this.typeSupported,M=this.vendor,F=a.audioCodec,j=a.defaultInitPts,W=a.duration,D=a.initSegmentData,P=a.videoCodec,H,Y=0,ee=d.length;Y0&&h!=null&&h.key!=null&&h.iv!==null&&h.method!=null&&(c=h),c}var w=function(h){return{remuxResult:{},chunkMeta:h}};function p(b){return"then"in b&&b.then instanceof Function}var f=function(h,c,l,a,v){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=c,this.initSegmentData=l,this.duration=a,this.defaultInitPts=v},_=function(h,c,l,a,v){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=c,this.accurateTimeOffset=l,this.trackSwitch=a,this.timeOffset=v}},"./src/demux/tsdemuxer.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"discardEPB",function(){return w});var G=A("./src/demux/adts.ts"),I=A("./src/demux/mpegaudio.ts"),R=A("./src/demux/exp-golomb.ts"),B=A("./src/demux/id3.ts"),U=A("./src/demux/sample-aes.ts"),k=A("./src/events.ts"),L=A("./src/utils/mp4-tools.ts"),y=A("./src/utils/logger.ts"),x=A("./src/errors.ts"),O={video:1,audio:2,id3:3,text:4},C=function(){function p(_,b,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=_,this.config=b,this.typeSupported=h}p.probe=function(b){var h=p.syncOffset(b);return h<0?!1:(h&&y.logger.warn("MPEG2-TS detected but first sync word found @ offset "+h+", junk ahead ?"),!0)},p.syncOffset=function(b){for(var h=Math.min(1e3,b.length-3*188),c=0;c>4,ae=void 0;if(fe>1){if(ae=ve+5+b[ve+4],ae===ve+188)continue}else ae=ve+4;switch(he){case M:ge&&(F&&(a=o(F))&&this.parseAVCPES(a,!1),F={data:[],size:0}),F&&(F.data.push(b.subarray(ae,ve+188)),F.size+=ve+188-ae);break;case j:ge&&(D&&(a=o(D))&&(m.isAAC?this.parseAACPES(a):this.parseMPEGPES(a)),D={data:[],size:0}),D&&(D.data.push(b.subarray(ae,ve+188)),D.size+=ve+188-ae);break;case W:ge&&(P&&(a=o(P))&&this.parseID3PES(a),P={data:[],size:0}),P&&(P.data.push(b.subarray(ae,ve+188)),P.size+=ve+188-ae);break;case 0:ge&&(ae+=b[ae]+1),ee=this._pmtId=g(b,ae);break;case ee:{ge&&(ae+=b[ae]+1);var me=d(b,ae,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,c);M=me.avc,M>0&&(v.pid=M),j=me.audio,j>0&&(m.pid=j,m.isAAC=me.isAAC),W=me.id3,W>0&&(E.pid=W),H&&!Y&&(y.logger.log("reparse from beginning"),H=!1,ve=Te-188),Y=this.pmtParsed=!0;break}case 17:case 8191:break;default:H=!0;break}}else this.observer.emit(k.Events.ERROR,k.Events.ERROR,{type:x.ErrorTypes.MEDIA_ERROR,details:x.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});v.pesData=F,m.pesData=D,E.pesData=P;var J={audioTrack:m,avcTrack:v,id3Track:E,textTrack:this._txtTrack};return l&&this.extractRemainingSamples(J),J},f.flush=function(){var b=this.remainderData;this.remainderData=null;var h;return b?h=this.demux(b,-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},f.extractRemainingSamples=function(b){var h=b.audioTrack,c=b.avcTrack,l=b.id3Track,a=c.pesData,v=h.pesData,m=l.pesData,E;a&&(E=o(a))?(this.parseAVCPES(E,!0),c.pesData=null):c.pesData=a,v&&(E=o(v))?(h.isAAC?this.parseAACPES(E):this.parseMPEGPES(E),h.pesData=null):(v!=null&&v.size&&y.logger.log("last AAC PES packet truncated,might overlap between fragments"),h.pesData=v),m&&(E=o(m))?(this.parseID3PES(E),l.pesData=null):l.pesData=m},f.demuxSampleAes=function(b,h,c){var l=this.demux(b,c,!0,!this.config.progressive),a=this.sampleAes=new U.default(this.observer,this.config,h);return this.decrypt(l,a)},f.decrypt=function(b,h){return new Promise(function(c){var l=b.audioTrack,a=b.avcTrack;l.samples&&l.isAAC?h.decryptAacSamples(l.samples,0,function(){a.samples?h.decryptAvcSamples(a.samples,0,0,function(){c(b)}):c(b)}):a.samples&&h.decryptAvcSamples(a.samples,0,0,function(){c(b)})})},f.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},f.parseAVCPES=function(b,h){var c=this,l=this._avcTrack,a=this.parseAVCNALu(b.data),v=!1,m=this.avcSample,E,M=!1;b.data=null,m&&a.length&&!l.audFound&&(u(m,l),m=this.avcSample=T(!1,b.pts,b.dts,"")),a.forEach(function(F){switch(F.type){case 1:{E=!0,m||(m=c.avcSample=T(!0,b.pts,b.dts,"")),v&&(m.debug+="NDR "),m.frame=!0;var j=F.data;if(M&&j.length>4){var W=new R.default(j).readSliceType();(W===2||W===4||W===7||W===9)&&(m.key=!0)}break}case 5:E=!0,m||(m=c.avcSample=T(!0,b.pts,b.dts,"")),v&&(m.debug+="IDR "),m.key=!0,m.frame=!0;break;case 6:{E=!0,v&&m&&(m.debug+="SEI ");var D=new R.default(w(F.data));D.readUByte();for(var P=0,H=0,Y=!1,ee=0;!Y&&D.bytesAvailable>1;){P=0;do ee=D.readUByte(),P+=ee;while(ee===255);H=0;do ee=D.readUByte(),H+=ee;while(ee===255);if(P===4&&D.bytesAvailable!==0){Y=!0;var oe=D.readUByte();if(oe===181){var Te=D.readUShort();if(Te===49){var ve=D.readUInt();if(ve===1195456820){var ge=D.readUByte();if(ge===3){for(var he=D.readUByte(),fe=D.readUByte(),ae=31&he,me=[he,fe],J=0;J16){for(var ne=[],Q=0;Q<16;Q++)ne.push(D.readUByte().toString(16)),(Q===3||Q===5||Q===7||Q===9)&&ne.push("-");for(var Ee=H-16,Ce=new Uint8Array(Ee),ye=0;ye=0){var D={data:b.subarray(j,m-l-1),type:W};v.push(D)}else{var P=this.getLastNalUnit();if(P&&(a&&m<=4-a&&(P.state&&(P.data=P.data.subarray(0,P.data.byteLength-a))),M=m-l-1,M>0)){var H=new Uint8Array(P.data.byteLength+M);H.set(P.data,0),H.set(b.subarray(0,M),P.data.byteLength),P.data=H,P.state=0}}m=0&&l>=0){var Y={data:b.subarray(j,h),type:W,state:l};v.push(Y)}if(v.length===0){var ee=this.getLastNalUnit();if(ee){var oe=new Uint8Array(ee.data.byteLength+b.byteLength);oe.set(ee.data,0),oe.set(b,ee.data.byteLength),ee.data=oe}}return c.naluState=l,v},f.parseAACPES=function(b){var h=0,c=this._audioTrack,l=this.aacOverFlow,a=b.data;if(l){this.aacOverFlow=null;var v=l.sample.unit.byteLength,m=Math.min(l.missing,v),E=v-m;l.sample.unit.set(a.subarray(0,m),E),c.samples.push(l.sample),h=l.missing}var M,F;for(M=h,F=a.length;M1;){var v=new Uint8Array(a[0].length+a[1].length);v.set(a[0]),v.set(a[1],a[0].length),a[0]=v,a.splice(1,1)}_=a[0];var m=(_[0]<<16)+(_[1]<<8)+_[2];if(m===1){if(b=(_[4]<<8)+_[5],b&&b>p.size-6)return null;var E=_[7];E&192&&(c=(_[9]&14)*536870912+(_[10]&255)*4194304+(_[11]&254)*16384+(_[12]&255)*128+(_[13]&254)/2,E&64?(l=(_[14]&14)*536870912+(_[15]&255)*4194304+(_[16]&254)*16384+(_[17]&255)*128+(_[18]&254)/2,c-l>60*9e4&&(y.logger.warn(Math.round((c-l)/9e4)+"s delta between PTS and DTS, align them"),c=l)):l=c),h=_[8];var M=h+9;if(p.size<=M)return null;p.size-=M;for(var F=new Uint8Array(p.size),j=0,W=a.length;jD){M-=D;continue}else _=_.subarray(M),D-=M,M=0;F.set(_,f),f+=D}return b&&(b-=h+3),{data:F,pts:c,dts:l,len:b}}return null}function u(p,f){if(p.units.length&&p.frame){if(p.pts===void 0){var _=f.samples,b=_.length;if(b){var h=_[b-1];p.pts=h.pts,p.dts=h.dts}else{f.dropped++;return}}f.samples.push(p)}p.debug.length&&y.logger.log(p.pts+"/"+p.dts+":"+p.debug)}function s(p,f){var _=p.length;if(_>0){if(f.pts>=p[_-1].pts)p.push(f);else for(var b=_-1;b>=0;b--)if(f.ptsc)return a;return 0}},{key:"maxAutoLevel",get:function(){var h=this.levels,c=this.autoLevelCapping,l;return c===-1&&h&&h.length?l=h.length-1:l=c,l}},{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 c=this.audioTrackController;c&&(c.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 c=this.subtitleTrackController;c&&(c.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 c=this.subtitleTrackController;c&&(c.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 o.Events}},{key:"ErrorTypes",get:function(){return u.ErrorTypes}},{key:"ErrorDetails",get:function(){return u.ErrorDetails}},{key:"DefaultConfig",get:function(){return f.defaultConfig?f.defaultConfig:T.hlsDefaultConfig},set:function(h){f.defaultConfig=h}}]),f}();p.defaultConfig=void 0},"./src/is-supported.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"isSupported",function(){return R}),A.d(V,"changeTypeSupported",function(){return B});var G=A("./src/utils/mediasource-helper.ts");function I(){return self.SourceBuffer||self.WebKitSourceBuffer}function R(){var U=Object(G.getMediaSource)();if(!U)return!1;var k=I(),L=U&&typeof U.isTypeSupported=="function"&&U.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),y=!k||k.prototype&&typeof k.prototype.appendBuffer=="function"&&typeof k.prototype.remove=="function";return!!L&&!!y}function B(){var U,k=I();return typeof(k==null||((U=k.prototype)===null||U===void 0)?void 0:U.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"default",function(){return C}),A.d(V,"LoadError",function(){return g});var G=A("./src/polyfills/number.ts"),I=A("./src/errors.ts");function R(d,o){d.prototype=Object.create(o.prototype),d.prototype.constructor=d,y(d,o)}function B(d){var o=typeof Map=="function"?new Map:void 0;return B=function(s){if(s===null||!L(s))return s;if(typeof s!="function")throw new TypeError("Super expression must either be null or a function");if(typeof o!="undefined"){if(o.has(s))return o.get(s);o.set(s,w)}function w(){return U(s,arguments,x(this).constructor)}return w.prototype=Object.create(s.prototype,{constructor:{value:w,enumerable:!1,writable:!0,configurable:!0}}),y(w,s)},B(d)}function U(d,o,u){return k()?U=Reflect.construct:U=function(w,p,f){var _=[null];_.push.apply(_,p);var b=Function.bind.apply(w,_),h=new b;return f&&y(h,f.prototype),h},U.apply(null,arguments)}function k(){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 L(d){return Function.toString.call(d).indexOf("[native code]")!==-1}function y(d,o){return y=Object.setPrototypeOf||function(s,w){return s.__proto__=w,s},y(d,o)}function x(d){return x=Object.setPrototypeOf?Object.getPrototypeOf:function(u){return u.__proto__||Object.getPrototypeOf(u)},x(d)}var O=Math.pow(2,17),C=function(){function d(u){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=u}var o=d.prototype;return o.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},o.abort=function(){this.loader&&this.loader.abort()},o.load=function(s,w){var p=this,f=s.url;if(!f)return Promise.reject(new g({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:s,networkDetails:null},"Fragment does not have a "+(f?"part list":"url")));this.abort();var _=this.config,b=_.fLoader,h=_.loader;return new Promise(function(c,l){p.loader&&p.loader.destroy();var a=p.loader=s.loader=b?new b(_):new h(_),v=T(s),m={timeout:_.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:_.fragLoadingMaxRetryTimeout,highWaterMark:O};s.stats=a.stats,a.load(v,m,{onSuccess:function(M,F,j,W){p.resetLoader(s,a),c({frag:s,part:null,payload:M.data,networkDetails:W})},onError:function(M,F,j){p.resetLoader(s,a),l(new g({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:s,response:M,networkDetails:j}))},onAbort:function(M,F,j){p.resetLoader(s,a),l(new g({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:s,networkDetails:j}))},onTimeout:function(M,F,j){p.resetLoader(s,a),l(new g({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:s,networkDetails:j}))},onProgress:function(M,F,j,W){w&&w({frag:s,part:null,payload:j,networkDetails:W})}})})},o.loadPart=function(s,w,p){var f=this;this.abort();var _=this.config,b=_.fLoader,h=_.loader;return new Promise(function(c,l){f.loader&&f.loader.destroy();var a=f.loader=s.loader=b?new b(_):new h(_),v=T(s,w),m={timeout:_.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:_.fragLoadingMaxRetryTimeout,highWaterMark:O};w.stats=a.stats,a.load(v,m,{onSuccess:function(M,F,j,W){f.resetLoader(s,a),f.updateStatsFromPart(s,w);var D={frag:s,part:w,payload:M.data,networkDetails:W};p(D),c(D)},onError:function(M,F,j){f.resetLoader(s,a),l(new g({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:s,part:w,response:M,networkDetails:j}))},onAbort:function(M,F,j){s.stats.aborted=w.stats.aborted,f.resetLoader(s,a),l(new g({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:s,part:w,networkDetails:j}))},onTimeout:function(M,F,j){f.resetLoader(s,a),l(new g({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:s,part:w,networkDetails:j}))}})})},o.updateStatsFromPart=function(s,w){var p=s.stats,f=w.stats,_=f.total;if(p.loaded+=f.loaded,_){var b=Math.round(s.duration/w.duration),h=Math.min(Math.round(p.loaded/_),b),c=b-h,l=c*Math.round(p.loaded/h);p.total=p.loaded+l}else p.total=Math.max(p.loaded,p.total);var a=p.loading,v=f.loading;a.start?a.first+=v.first-v.start:(a.start=v.start,a.first=v.first),a.end=v.end},o.resetLoader=function(s,w){s.loader=null,this.loader===w&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),w.destroy()},d}();function T(d,o){o===void 0&&(o=null);var u=o||d,s={frag:d,part:o,responseType:"arraybuffer",url:u.url,headers:{},rangeStart:0,rangeEnd:0},w=u.byteRangeStartOffset,p=u.byteRangeEndOffset;return Object(G.isFiniteNumber)(w)&&Object(G.isFiniteNumber)(p)&&(s.rangeStart=w,s.rangeEnd=p),s}var g=function(d){R(o,d);function o(u){for(var s,w=arguments.length,p=new Array(w>1?w-1:0),f=1;f>8*(15-_)&255;return f},s.setDecryptDataFromLevelKey=function(p,f){var _=p;return(p==null?void 0:p.method)==="AES-128"&&p.uri&&!p.iv&&(_=U.LevelKey.fromURI(p.uri),_.method=p.method,_.iv=this.createInitializationVector(f),_.keyFormat="identity"),_},s.setElementaryStreamInfo=function(p,f,_,b,h,c){c===void 0&&(c=!1);var l=this.elementaryStreams,a=l[p];if(!a){l[p]={startPTS:f,endPTS:_,startDTS:b,endDTS:h,partial:c};return}a.startPTS=Math.min(a.startPTS,f),a.endPTS=Math.max(a.endPTS,_),a.startDTS=Math.min(a.startDTS,b),a.endDTS=Math.max(a.endDTS,h)},s.clearElementaryStreamInfo=function(){var p=this.elementaryStreams;p[C.AUDIO]=null,p[C.VIDEO]=null,p[C.AUDIOVIDEO]=null},O(u,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var p=this.sn;typeof p!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&B.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),p=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,p)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(G.isFiniteNumber)(this.programDateTime))return null;var p=Object(G.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+p*1e3}},{key:"encrypted",get:function(){var p;return!!((p=this.decryptdata)!==null&&p!==void 0&&p.keyFormat&&this.decryptdata.uri)}}]),u}(T),d=function(o){L(u,o);function u(s,w,p,f,_){var b;b=o.call(this,p)||this,b.fragOffset=0,b.duration=0,b.gap=!1,b.independent=!1,b.relurl=void 0,b.fragment=void 0,b.index=void 0,b.stats=new k.LoadStats,b.duration=s.decimalFloatingPoint("DURATION"),b.gap=s.bool("GAP"),b.independent=s.bool("INDEPENDENT"),b.relurl=s.enumeratedString("URI"),b.fragment=w,b.index=f;var h=s.enumeratedString("BYTERANGE");return h&&b.setByteRange(h,_),_&&(b.fragOffset=_.fragOffset+_.duration),b}return O(u,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var w=this.elementaryStreams;return!!(w.audio||w.video||w.audiovideo)}}]),u}(T)},"./src/loader/key-loader.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"default",function(){return B});var G=A("./src/events.ts"),I=A("./src/errors.ts"),R=A("./src/utils/logger.ts"),B=function(){function U(L){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=L,this._registerListeners()}var k=U.prototype;return k._registerListeners=function(){this.hls.on(G.Events.KEY_LOADING,this.onKeyLoading,this)},k._unregisterListeners=function(){this.hls.off(G.Events.KEY_LOADING,this.onKeyLoading)},k.destroy=function(){this._unregisterListeners();for(var y in this.loaders){var x=this.loaders[y];x&&x.destroy()}this.loaders={}},k.onKeyLoading=function(y,x){var O=x.frag,C=O.type,T=this.loaders[C];if(!O.decryptdata){R.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var g=O.decryptdata.uri;if(g!==this.decrypturl||this.decryptkey===null){var d=this.hls.config;if(T&&(R.logger.warn("abort previous key loader for type:"+C),T.abort()),!g){R.logger.warn("key uri is falsy");return}var o=d.loader,u=O.loader=this.loaders[C]=new o(d);this.decrypturl=g,this.decryptkey=null;var s={url:g,frag:O,responseType:"arraybuffer"},w={timeout:d.fragLoadingTimeOut,maxRetry:0,retryDelay:d.fragLoadingRetryDelay,maxRetryDelay:d.fragLoadingMaxRetryTimeout,highWaterMark:0},p={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};u.load(s,w,p)}else this.decryptkey&&(O.decryptdata.key=this.decryptkey,this.hls.trigger(G.Events.KEY_LOADED,{frag:O}))},k.loadsuccess=function(y,x,O){var C=O.frag;if(!C.decryptdata){R.logger.error("after key load, decryptdata unset");return}this.decryptkey=C.decryptdata.key=new Uint8Array(y.data),C.loader=null,delete this.loaders[C.type],this.hls.trigger(G.Events.KEY_LOADED,{frag:C})},k.loaderror=function(y,x){var O=x.frag,C=O.loader;C&&C.abort(),delete this.loaders[O.type],this.hls.trigger(G.Events.ERROR,{type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:O,response:y})},k.loadtimeout=function(y,x){var O=x.frag,C=O.loader;C&&C.abort(),delete this.loaders[O.type],this.hls.trigger(G.Events.ERROR,{type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:O})},U}()},"./src/loader/level-details.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"LevelDetails",function(){return U});var G=A("./src/polyfills/number.ts");function I(k,L){for(var y=0;yx.endSN||O>0||O===0&&C>0,this.updated||this.advanced?this.misses=Math.floor(x.misses*.6):this.misses=x.misses+1,this.availabilityDelay=x.availabilityDelay},R(k,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(G.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||B}},{key:"drift",get:function(){var x=this.driftEndTime-this.driftStartTime;if(x>0){var O=this.driftEnd-this.driftStart;return O*1e3/x}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var x;return(x=this.partList)!==null&&x!==void 0&&x.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var x;return(x=this.fragments)!==null&&x!==void 0&&x.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 x;return(x=this.partList)!==null&&x!==void 0&&x.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var x;return(x=this.partList)!==null&&x!==void 0&&x.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),k}()},"./src/loader/level-key.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"LevelKey",function(){return U});var G=A("./node_modules/url-toolkit/src/url-toolkit.js"),I=A.n(G);function R(k,L){for(var y=0;y2){var l=c.shift()+".";return l+=parseInt(c.shift()).toString(16),l+=("000"+parseInt(c.shift()).toString(16)).substr(-4),l}return h},_.resolve=function(h,c){return I.buildAbsoluteURL(c,h,{alwaysNormalize:!0})},_.parseMasterPlaylist=function(h,c){var l=[],a={},v=!1;O.lastIndex=0;for(var m;(m=O.exec(h))!=null;)if(m[1]){var E=new L.AttrList(m[1]),M={attrs:E,bitrate:E.decimalInteger("AVERAGE-BANDWIDTH")||E.decimalInteger("BANDWIDTH"),name:E.NAME,url:_.resolve(m[2],c)},F=E.decimalResolution("RESOLUTION");F&&(M.width=F.width,M.height=F.height),s((E.CODECS||"").split(/[ ,]+/).filter(function(W){return W}),M),M.videoCodec&&M.videoCodec.indexOf("avc1")!==-1&&(M.videoCodec=_.convertAVC1ToAVCOTI(M.videoCodec)),l.push(M)}else if(m[3]){var j=new L.AttrList(m[3]);j["DATA-ID"]&&(v=!0,a[j["DATA-ID"]]=j)}return{levels:l,sessionData:v?a:null}},_.parseMasterPlaylistMedia=function(h,c,l,a){a===void 0&&(a=[]);var v,m=[],E=0;for(C.lastIndex=0;(v=C.exec(h))!==null;){var M=new L.AttrList(v[1]);if(M.TYPE===l){var F={attrs:M,bitrate:0,id:E++,groupId:M["GROUP-ID"],instreamId:M["INSTREAM-ID"],name:M.NAME||M.LANGUAGE||"",type:l,default:M.bool("DEFAULT"),autoselect:M.bool("AUTOSELECT"),forced:M.bool("FORCED"),lang:M.LANGUAGE,url:M.URI?_.resolve(M.URI,c):""};if(a.length){var j=_.findGroup(a,F.groupId)||a[0];w(F,j,"audioCodec"),w(F,j,"textCodec")}m.push(F)}}return m},_.parseLevelPlaylist=function(h,c,l,a,v){var m=new U.LevelDetails(c),E=m.fragments,M=null,F=0,j=0,W=0,D=0,P=null,H=new B.Fragment(a,c),Y,ee,oe,Te=-1,ve=!1;for(T.lastIndex=0,m.m3u8=h;(Y=T.exec(h))!==null;){ve&&(ve=!1,H=new B.Fragment(a,c),H.start=W,H.sn=F,H.cc=D,H.level=l,M&&(H.initSegment=M,H.rawProgramDateTime=M.rawProgramDateTime));var ge=Y[1];if(ge){H.duration=parseFloat(ge);var he=(" "+Y[2]).slice(1);H.title=he||null,H.tagList.push(he?["INF",ge,he]:["INF",ge])}else if(Y[3])Object(G.isFiniteNumber)(H.duration)&&(H.start=W,oe&&(H.levelkey=oe),H.sn=F,H.level=l,H.cc=D,H.urlId=v,E.push(H),H.relurl=(" "+Y[3]).slice(1),f(H,P),P=H,W+=H.duration,F++,j=0,ve=!0);else if(Y[4]){var fe=(" "+Y[4]).slice(1);P?H.setByteRange(fe,P):H.setByteRange(fe)}else if(Y[5])H.rawProgramDateTime=(" "+Y[5]).slice(1),H.tagList.push(["PROGRAM-DATE-TIME",H.rawProgramDateTime]),Te===-1&&(Te=E.length);else{if(Y=Y[0].match(g),!Y){y.logger.warn("No matches on slow regex match for level playlist!");continue}for(ee=1;ee-1){y.logger.warn("Keyformat "+Ge+" is not supported from the manifest");continue}else if(Ge!=="identity")continue;De&&(oe=k.LevelKey.fromURL(c,Pe),Pe&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(De)>=0&&(oe.method=De,oe.keyFormat=Ge,Re&&(oe.keyID=Re),Oe&&(oe.keyFormatVersions=Oe),oe.iv=ke));break}case"START":{var Be=new L.AttrList(me),He=Be.decimalFloatingPoint("TIME-OFFSET");Object(G.isFiniteNumber)(He)&&(m.startTimeOffset=He);break}case"MAP":{var rt=new L.AttrList(me);H.relurl=rt.URI,rt.BYTERANGE&&H.setByteRange(rt.BYTERANGE),H.level=l,H.sn="initSegment",oe&&(H.levelkey=oe),H.initSegment=null,M=H,ve=!0;break}case"SERVER-CONTROL":{var Je=new L.AttrList(me);m.canBlockReload=Je.bool("CAN-BLOCK-RELOAD"),m.canSkipUntil=Je.optionalFloat("CAN-SKIP-UNTIL",0),m.canSkipDateRanges=m.canSkipUntil>0&&Je.bool("CAN-SKIP-DATERANGES"),m.partHoldBack=Je.optionalFloat("PART-HOLD-BACK",0),m.holdBack=Je.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var qe=new L.AttrList(me);m.partTarget=qe.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Se=m.partList;Se||(Se=m.partList=[]);var Ze=j>0?Se[Se.length-1]:void 0,Ke=j++,Le=new B.Part(new L.AttrList(me),H,c,Ke,Ze);Se.push(Le),H.duration+=Le.duration;break}case"PRELOAD-HINT":{var Ie=new L.AttrList(me);m.preloadHint=Ie;break}case"RENDITION-REPORT":{var pe=new L.AttrList(me);m.renditionReports=m.renditionReports||[],m.renditionReports.push(pe);break}default:y.logger.warn("line parsed but not handled: "+Y);break}}}P&&!P.relurl?(E.pop(),W-=P.duration,m.partList&&(m.fragmentHint=P)):m.partList&&(f(H,P),H.cc=D,m.fragmentHint=H);var se=E.length,de=E[0],$=E[se-1];if(W+=m.skippedSegments*m.targetduration,W>0&&se&&$){m.averagetargetduration=W/se;var Z=$.sn;m.endSN=Z!=="initSegment"?Z:0,de&&(m.startCC=de.cc,de.initSegment||m.fragments.every(function(te){return te.relurl&&o(te.relurl)})&&(y.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),H=new B.Fragment(a,c),H.relurl=$.relurl,H.level=l,H.sn="initSegment",de.initSegment=H,m.needSidxRanges=!0))}else m.endSN=0,m.startCC=0;return m.fragmentHint&&(W+=m.fragmentHint.duration),m.totalduration=W,m.endCC=D,Te>0&&p(E,Te),m},_}();function s(_,b){["video","audio","text"].forEach(function(h){var c=_.filter(function(a){return Object(x.isCodecType)(a,h)});if(c.length){var l=c.filter(function(a){return a.lastIndexOf("avc1",0)===0||a.lastIndexOf("mp4a",0)===0});b[h+"Codec"]=l.length>0?l[0]:c[0],_=_.filter(function(a){return c.indexOf(a)===-1})}}),b.unknownCodecs=_}function w(_,b,h){var c=b[h];c&&(_[h]=c)}function p(_,b){for(var h=_[b],c=b;c--;){var l=_[c];if(!l)return;l.programDateTime=h.programDateTime-l.duration*1e3,h=l}}function f(_,b){_.rawProgramDateTime?_.programDateTime=Date.parse(_.rawProgramDateTime):b!=null&&b.programDateTime&&(_.programDateTime=b.endProgramDateTime),Object(G.isFiniteNumber)(_.programDateTime)||(_.programDateTime=null,_.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(re,V,A){"use strict";A.r(V);var G=A("./src/polyfills/number.ts"),I=A("./src/events.ts"),R=A("./src/errors.ts"),B=A("./src/utils/logger.ts"),U=A("./src/utils/mp4-tools.ts"),k=A("./src/loader/m3u8-parser.ts"),L=A("./src/types/loader.ts"),y=A("./src/utils/attr-list.ts");function x(T){var g=T.type;switch(g){case L.PlaylistContextType.AUDIO_TRACK:return L.PlaylistLevelType.AUDIO;case L.PlaylistContextType.SUBTITLE_TRACK:return L.PlaylistLevelType.SUBTITLE;default:return L.PlaylistLevelType.MAIN}}function O(T,g){var d=T.url;return(d===void 0||d.indexOf("data:")===0)&&(d=g.url),d}var C=function(){function T(d){this.hls=void 0,this.loaders=Object.create(null),this.hls=d,this.registerListeners()}var g=T.prototype;return g.registerListeners=function(){var o=this.hls;o.on(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(I.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(I.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.on(I.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},g.unregisterListeners=function(){var o=this.hls;o.off(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(I.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(I.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.off(I.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},g.createInternalLoader=function(o){var u=this.hls.config,s=u.pLoader,w=u.loader,p=s||w,f=new p(u);return o.loader=f,this.loaders[o.type]=f,f},g.getInternalLoader=function(o){return this.loaders[o.type]},g.resetInternalLoader=function(o){this.loaders[o]&&delete this.loaders[o]},g.destroyInternalLoaders=function(){for(var o in this.loaders){var u=this.loaders[o];u&&u.destroy(),this.resetInternalLoader(o)}},g.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},g.onManifestLoading=function(o,u){var s=u.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:L.PlaylistContextType.MANIFEST,url:s,deliveryDirectives:null})},g.onLevelLoading=function(o,u){var s=u.id,w=u.level,p=u.url,f=u.deliveryDirectives;this.load({id:s,groupId:null,level:w,responseType:"text",type:L.PlaylistContextType.LEVEL,url:p,deliveryDirectives:f})},g.onAudioTrackLoading=function(o,u){var s=u.id,w=u.groupId,p=u.url,f=u.deliveryDirectives;this.load({id:s,groupId:w,level:null,responseType:"text",type:L.PlaylistContextType.AUDIO_TRACK,url:p,deliveryDirectives:f})},g.onSubtitleTrackLoading=function(o,u){var s=u.id,w=u.groupId,p=u.url,f=u.deliveryDirectives;this.load({id:s,groupId:w,level:null,responseType:"text",type:L.PlaylistContextType.SUBTITLE_TRACK,url:p,deliveryDirectives:f})},g.load=function(o){var u,s=this.hls.config,w=this.getInternalLoader(o);if(w){var p=w.context;if(p&&p.url===o.url){B.logger.trace("[playlist-loader]: playlist request ongoing");return}B.logger.log("[playlist-loader]: aborting previous loader for type: "+o.type),w.abort()}var f,_,b,h;switch(o.type){case L.PlaylistContextType.MANIFEST:f=s.manifestLoadingMaxRetry,_=s.manifestLoadingTimeOut,b=s.manifestLoadingRetryDelay,h=s.manifestLoadingMaxRetryTimeout;break;case L.PlaylistContextType.LEVEL:case L.PlaylistContextType.AUDIO_TRACK:case L.PlaylistContextType.SUBTITLE_TRACK:f=0,_=s.levelLoadingTimeOut;break;default:f=s.levelLoadingMaxRetry,_=s.levelLoadingTimeOut,b=s.levelLoadingRetryDelay,h=s.levelLoadingMaxRetryTimeout;break}if(w=this.createInternalLoader(o),(u=o.deliveryDirectives)!==null&&u!==void 0&&u.part){var c;if(o.type===L.PlaylistContextType.LEVEL&&o.level!==null?c=this.hls.levels[o.level].details:o.type===L.PlaylistContextType.AUDIO_TRACK&&o.id!==null?c=this.hls.audioTracks[o.id].details:o.type===L.PlaylistContextType.SUBTITLE_TRACK&&o.id!==null&&(c=this.hls.subtitleTracks[o.id].details),c){var l=c.partTarget,a=c.targetduration;l&&a&&(_=Math.min(Math.max(l*3,a*.8)*1e3,_))}}var v={timeout:_,maxRetry:f,retryDelay:b,maxRetryDelay:h,highWaterMark:0},m={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};w.load(o,v,m)},g.loadsuccess=function(o,u,s,w){if(w===void 0&&(w=null),s.isSidxRequest){this.handleSidxRequest(o,s),this.handlePlaylistLoaded(o,u,s,w);return}this.resetInternalLoader(s.type);var p=o.data;if(p.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(o,s,"no EXTM3U delimiter",w);return}u.parsing.start=performance.now(),p.indexOf("#EXTINF:")>0||p.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(o,u,s,w):this.handleMasterPlaylist(o,u,s,w)},g.loaderror=function(o,u,s){s===void 0&&(s=null),this.handleNetworkError(u,s,!1,o)},g.loadtimeout=function(o,u,s){s===void 0&&(s=null),this.handleNetworkError(u,s,!0)},g.handleMasterPlaylist=function(o,u,s,w){var p=this.hls,f=o.data,_=O(o,s),b=k.default.parseMasterPlaylist(f,_),h=b.levels,c=b.sessionData;if(!h.length){this.handleManifestParsingError(o,s,"no level found in manifest",w);return}var l=h.map(function(F){return{id:F.attrs.AUDIO,audioCodec:F.audioCodec}}),a=h.map(function(F){return{id:F.attrs.SUBTITLES,textCodec:F.textCodec}}),v=k.default.parseMasterPlaylistMedia(f,_,"AUDIO",l),m=k.default.parseMasterPlaylistMedia(f,_,"SUBTITLES",a),E=k.default.parseMasterPlaylistMedia(f,_,"CLOSED-CAPTIONS");if(v.length){var M=v.some(function(F){return!F.url});!M&&h[0].audioCodec&&!h[0].attrs.AUDIO&&(B.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),v.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new y.AttrList({}),bitrate:0,url:""}))}p.trigger(I.Events.MANIFEST_LOADED,{levels:h,audioTracks:v,subtitles:m,captions:E,url:_,stats:u,networkDetails:w,sessionData:c})},g.handleTrackOrLevelPlaylist=function(o,u,s,w){var p=this.hls,f=s.id,_=s.level,b=s.type,h=O(o,s),c=Object(G.isFiniteNumber)(f)?f:0,l=Object(G.isFiniteNumber)(_)?_:c,a=x(s),v=k.default.parseLevelPlaylist(o.data,h,l,a,c);if(!v.fragments.length){p.trigger(I.Events.ERROR,{type:R.ErrorTypes.NETWORK_ERROR,details:R.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:h,reason:"no fragments found in level",level:typeof s.level=="number"?s.level:void 0});return}if(b===L.PlaylistContextType.MANIFEST){var m={attrs:new y.AttrList({}),bitrate:0,details:v,name:"",url:h};p.trigger(I.Events.MANIFEST_LOADED,{levels:[m],audioTracks:[],url:h,stats:u,networkDetails:w,sessionData:null})}if(u.parsing.end=performance.now(),v.needSidxRanges){var E,M=(E=v.fragments[0].initSegment)===null||E===void 0?void 0:E.url;this.load({url:M,isSidxRequest:!0,type:b,level:_,levelDetails:v,id:f,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}s.levelDetails=v,this.handlePlaylistLoaded(o,u,s,w)},g.handleSidxRequest=function(o,u){var s=Object(U.parseSegmentIndex)(new Uint8Array(o.data));if(!s)return;var w=s.references,p=u.levelDetails;w.forEach(function(f,_){var b=f.info,h=p.fragments[_];h.byteRange.length===0&&h.setByteRange(String(1+b.end-b.start)+"@"+String(b.start)),h.initSegment&&h.initSegment.setByteRange(String(s.moovEndOffset)+"@0")})},g.handleManifestParsingError=function(o,u,s,w){this.hls.trigger(I.Events.ERROR,{type:R.ErrorTypes.NETWORK_ERROR,details:R.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:u.type===L.PlaylistContextType.MANIFEST,url:o.url,reason:s,response:o,context:u,networkDetails:w})},g.handleNetworkError=function(o,u,s,w){s===void 0&&(s=!1),B.logger.warn("[playlist-loader]: A network "+(s?"timeout":"error")+" occurred while loading "+o.type+" level: "+o.level+" id: "+o.id+' group-id: "'+o.groupId+'"');var p=R.ErrorDetails.UNKNOWN,f=!1,_=this.getInternalLoader(o);switch(o.type){case L.PlaylistContextType.MANIFEST:p=s?R.ErrorDetails.MANIFEST_LOAD_TIMEOUT:R.ErrorDetails.MANIFEST_LOAD_ERROR,f=!0;break;case L.PlaylistContextType.LEVEL:p=s?R.ErrorDetails.LEVEL_LOAD_TIMEOUT:R.ErrorDetails.LEVEL_LOAD_ERROR,f=!1;break;case L.PlaylistContextType.AUDIO_TRACK:p=s?R.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:R.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,f=!1;break;case L.PlaylistContextType.SUBTITLE_TRACK:p=s?R.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:R.ErrorDetails.SUBTITLE_LOAD_ERROR,f=!1;break}_&&this.resetInternalLoader(o.type);var b={type:R.ErrorTypes.NETWORK_ERROR,details:p,fatal:f,url:o.url,loader:_,context:o,networkDetails:u};w&&(b.response=w),this.hls.trigger(I.Events.ERROR,b)},g.handlePlaylistLoaded=function(o,u,s,w){var p=s.type,f=s.level,_=s.id,b=s.groupId,h=s.loader,c=s.levelDetails,l=s.deliveryDirectives;if(!(c!=null&&c.targetduration)){this.handleManifestParsingError(o,s,"invalid target duration",w);return}if(!h)return;c.live&&(h.getCacheAge&&(c.ageHeader=h.getCacheAge()||0),(!h.getCacheAge||isNaN(c.ageHeader))&&(c.ageHeader=0));switch(p){case L.PlaylistContextType.MANIFEST:case L.PlaylistContextType.LEVEL:this.hls.trigger(I.Events.LEVEL_LOADED,{details:c,level:f||0,id:_||0,stats:u,networkDetails:w,deliveryDirectives:l});break;case L.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(I.Events.AUDIO_TRACK_LOADED,{details:c,id:_||0,groupId:b||"",stats:u,networkDetails:w,deliveryDirectives:l});break;case L.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(I.Events.SUBTITLE_TRACK_LOADED,{details:c,id:_||0,groupId:b||"",stats:u,networkDetails:w,deliveryDirectives:l});break}},T}();V.default=C},"./src/polyfills/number.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"isFiniteNumber",function(){return G}),A.d(V,"MAX_SAFE_INTEGER",function(){return I});var G=Number.isFinite||function(R){return typeof R=="number"&&isFinite(R)},I=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(re,V,A){"use strict";A.r(V);var G=function(){function I(){}return I.getSilentFrame=function(B,U){switch(B){case"mp4a.40.2":if(U===1)return new Uint8Array([0,200,0,128,35,128]);if(U===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(U===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(U===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(U===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(U===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(U===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(U===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(U===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}return},I}();V.default=G},"./src/remux/mp4-generator.ts":function(re,V,A){"use strict";A.r(V);var G=Math.pow(2,32)-1,I=function(){function R(){}return R.init=function(){R.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var U;for(U in R.types)R.types.hasOwnProperty(U)&&(R.types[U]=[U.charCodeAt(0),U.charCodeAt(1),U.charCodeAt(2),U.charCodeAt(3)]);var k=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]),L=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]);R.HDLR_TYPES={video:k,audio:L};var y=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),x=new Uint8Array([0,0,0,0,0,0,0,0]);R.STTS=R.STSC=R.STCO=x,R.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),R.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),R.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),R.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var O=new Uint8Array([105,115,111,109]),C=new Uint8Array([97,118,99,49]),T=new Uint8Array([0,0,0,1]);R.FTYP=R.box(R.types.ftyp,O,T,O,C),R.DINF=R.box(R.types.dinf,R.box(R.types.dref,y))},R.box=function(U){for(var k=8,L=arguments.length,y=new Array(L>1?L-1:0),x=1;x>24&255,T[1]=k>>16&255,T[2]=k>>8&255,T[3]=k&255,T.set(U,4),O=0,k=8;O>24&255,U>>16&255,U>>8&255,U&255,L>>24,L>>16&255,L>>8&255,L&255,y>>24,y>>16&255,y>>8&255,y&255,85,196,0,0]))},R.mdia=function(U){return R.box(R.types.mdia,R.mdhd(U.timescale,U.duration),R.hdlr(U.type),R.minf(U))},R.mfhd=function(U){return R.box(R.types.mfhd,new Uint8Array([0,0,0,0,U>>24,U>>16&255,U>>8&255,U&255]))},R.minf=function(U){return U.type==="audio"?R.box(R.types.minf,R.box(R.types.smhd,R.SMHD),R.DINF,R.stbl(U)):R.box(R.types.minf,R.box(R.types.vmhd,R.VMHD),R.DINF,R.stbl(U))},R.moof=function(U,k,L){return R.box(R.types.moof,R.mfhd(U),R.traf(L,k))},R.moov=function(U){for(var k=U.length,L=[];k--;)L[k]=R.trak(U[k]);return R.box.apply(null,[R.types.moov,R.mvhd(U[0].timescale,U[0].duration)].concat(L).concat(R.mvex(U)))},R.mvex=function(U){for(var k=U.length,L=[];k--;)L[k]=R.trex(U[k]);return R.box.apply(null,[R.types.mvex].concat(L))},R.mvhd=function(U,k){k*=U;var L=Math.floor(k/(G+1)),y=Math.floor(k%(G+1)),x=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,U>>24&255,U>>16&255,U>>8&255,U&255,L>>24,L>>16&255,L>>8&255,L&255,y>>24,y>>16&255,y>>8&255,y&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return R.box(R.types.mvhd,x)},R.sdtp=function(U){var k=U.samples||[],L=new Uint8Array(4+k.length),y,x;for(y=0;y>>8&255),k.push(O&255),k=k.concat(Array.prototype.slice.call(x));for(y=0;y>>8&255),L.push(O&255),L=L.concat(Array.prototype.slice.call(x));var C=R.box(R.types.avcC,new Uint8Array([1,k[3],k[4],k[5],252|3,224|U.sps.length].concat(k).concat([U.pps.length]).concat(L))),T=U.width,g=U.height,d=U.pixelRatio[0],o=U.pixelRatio[1];return R.box(R.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,T>>8&255,T&255,g>>8&255,g&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]),C,R.box(R.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),R.box(R.types.pasp,new Uint8Array([d>>24,d>>16&255,d>>8&255,d&255,o>>24,o>>16&255,o>>8&255,o&255])))},R.esds=function(U){var k=U.config.length;return new Uint8Array([0,0,0,0,3,23+k,0,1,0,4,15+k,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([k]).concat(U.config).concat([6,1,2]))},R.mp4a=function(U){var k=U.samplerate;return R.box(R.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,U.channelCount,0,16,0,0,0,0,k>>8&255,k&255,0,0]),R.box(R.types.esds,R.esds(U)))},R.mp3=function(U){var k=U.samplerate;return R.box(R.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,U.channelCount,0,16,0,0,0,0,k>>8&255,k&255,0,0]))},R.stsd=function(U){return U.type==="audio"?!U.isAAC&&U.codec==="mp3"?R.box(R.types.stsd,R.STSD,R.mp3(U)):R.box(R.types.stsd,R.STSD,R.mp4a(U)):R.box(R.types.stsd,R.STSD,R.avc1(U))},R.tkhd=function(U){var k=U.id,L=U.duration*U.timescale,y=U.width,x=U.height,O=Math.floor(L/(G+1)),C=Math.floor(L%(G+1));return R.box(R.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,k>>24&255,k>>16&255,k>>8&255,k&255,0,0,0,0,O>>24,O>>16&255,O>>8&255,O&255,C>>24,C>>16&255,C>>8&255,C&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,y>>8&255,y&255,0,0,x>>8&255,x&255,0,0]))},R.traf=function(U,k){var L=R.sdtp(U),y=U.id,x=Math.floor(k/(G+1)),O=Math.floor(k%(G+1));return R.box(R.types.traf,R.box(R.types.tfhd,new Uint8Array([0,0,0,0,y>>24,y>>16&255,y>>8&255,y&255])),R.box(R.types.tfdt,new Uint8Array([1,0,0,0,x>>24,x>>16&255,x>>8&255,x&255,O>>24,O>>16&255,O>>8&255,O&255])),R.trun(U,L.length+16+20+8+16+8+8),L)},R.trak=function(U){return U.duration=U.duration||4294967295,R.box(R.types.trak,R.tkhd(U),R.mdia(U))},R.trex=function(U){var k=U.id;return R.box(R.types.trex,new Uint8Array([0,0,0,0,k>>24,k>>16&255,k>>8&255,k&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},R.trun=function(U,k){var L=U.samples||[],y=L.length,x=12+16*y,O=new Uint8Array(x),C,T,g,d,o,u;for(k+=8+x,O.set([0,0,15,1,y>>>24&255,y>>>16&255,y>>>8&255,y&255,k>>>24&255,k>>>16&255,k>>>8&255,k&255],0),C=0;C>>24&255,g>>>16&255,g>>>8&255,g&255,d>>>24&255,d>>>16&255,d>>>8&255,d&255,o.isLeading<<2|o.dependsOn,o.isDependedOn<<6|o.hasRedundancy<<4|o.paddingValue<<1|o.isNonSync,o.degradPrio&240<<8,o.degradPrio&15,u>>>24&255,u>>>16&255,u>>>8&255,u&255],12+16*C);return R.box(R.types.trun,O)},R.initSegment=function(U){R.types||R.init();var k=R.moov(U),L=new Uint8Array(R.FTYP.byteLength+k.byteLength);return L.set(R.FTYP),L.set(k,R.FTYP.byteLength),L},R}();I.types=void 0,I.HDLR_TYPES=void 0,I.STTS=void 0,I.STSC=void 0,I.STCO=void 0,I.STSZ=void 0,I.VMHD=void 0,I.SMHD=void 0,I.STSD=void 0,I.FTYP=void 0,I.DINF=void 0,V.default=I},"./src/remux/mp4-remuxer.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"default",function(){return u}),A.d(V,"normalizePts",function(){return s});var G=A("./src/polyfills/number.ts"),I=A("./src/remux/aac-helper.ts"),R=A("./src/remux/mp4-generator.ts"),B=A("./src/events.ts"),U=A("./src/errors.ts"),k=A("./src/utils/logger.ts"),L=A("./src/types/loader.ts"),y=A("./src/utils/timescale-conversion.ts");function x(){return x=Object.assign||function(_){for(var b=1;b0?v:m.pts},c[0].pts);return l&&k.logger.debug("PTS rollover detected"),a},b.remux=function(c,l,a,v,m,E,M,F){var j,W,D,P,H,Y,ee=m,oe=m,Te=c.pid>-1,ve=l.pid>-1,ge=l.samples.length,he=c.samples.length>0,fe=ge>1,ae=(!Te||he)&&(!ve||fe)||this.ISGenerated||M;if(ae){this.ISGenerated||(D=this.generateIS(c,l,m));var me=this.isVideoContiguous,J=-1;if(fe&&(J=w(l.samples),!me&&this.config.forceKeyFrameOnDiscontinuity))if(Y=!0,J>0){k.logger.warn("[mp4-remuxer]: Dropped "+J+" out of "+ge+" video samples due to a missing keyframe");var ne=this.getVideoStartPts(l.samples);l.samples=l.samples.slice(J),l.dropped+=J,oe+=(l.samples[0].pts-ne)/(l.timescale||9e4)}else J===-1&&(k.logger.warn("[mp4-remuxer]: No keyframe found out of "+ge+" video samples"),Y=!1);if(this.ISGenerated){if(he&&fe){var Q=this.getVideoStartPts(l.samples),Ee=s(c.samples[0].pts,Q)-Q,Ce=Ee/l.inputTimeScale;ee+=Math.max(0,Ce),oe+=Math.max(0,-Ce)}if(he){if(c.samplerate||(k.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),D=this.generateIS(c,l,m)),W=this.remuxAudio(c,ee,this.isAudioContiguous,E,ve||fe||F===L.PlaylistLevelType.AUDIO?oe:void 0),fe){var ye=W?W.endPTS-W.startPTS:0;l.inputTimeScale||(k.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),D=this.generateIS(c,l,m)),j=this.remuxVideo(l,oe,me,ye)}}else fe&&(j=this.remuxVideo(l,oe,me,0));j&&(j.firstKeyFrame=J,j.independent=J!==-1)}}return this.ISGenerated&&(a.samples.length&&(H=this.remuxID3(a,m)),v.samples.length&&(P=this.remuxText(v,m))),{audio:W,video:j,initSegment:D,independent:Y,text:P,id3:H}},b.generateIS=function(c,l,a){var v=c.samples,m=l.samples,E=this.typeSupported,M={},F=!Object(G.isFiniteNumber)(this._initPTS),j="audio/mp4",W,D,P;if(F&&(W=D=Infinity),c.config&&v.length&&(c.timescale=c.samplerate,c.isAAC||(E.mpeg?(j="audio/mpeg",c.codec=""):E.mp3&&(c.codec="mp3")),M.audio={id:"audio",container:j,codec:c.codec,initSegment:!c.isAAC&&E.mpeg?new Uint8Array(0):R.default.initSegment([c]),metadata:{channelCount:c.channelCount}},F&&(P=c.inputTimeScale,W=D=v[0].pts-Math.round(P*a))),l.sps&&l.pps&&m.length&&(l.timescale=l.inputTimeScale,M.video={id:"main",container:"video/mp4",codec:l.codec,initSegment:R.default.initSegment([l]),metadata:{width:l.width,height:l.height}},F)){P=l.inputTimeScale;var H=this.getVideoStartPts(m),Y=Math.round(P*a);D=Math.min(D,s(m[0].dts,H)-Y),W=Math.min(W,H-Y)}if(Object.keys(M).length)return this.ISGenerated=!0,F&&(this._initPTS=W,this._initDTS=D),{tracks:M,initPTS:W,timescale:P}},b.remuxVideo=function(c,l,a,v){var m=c.inputTimeScale,E=c.samples,M=[],F=E.length,j=this._initPTS,W=this.nextAvcDts,D=8,P,H,Y,ee=Number.POSITIVE_INFINITY,oe=Number.NEGATIVE_INFINITY,Te=0,ve=!1;if(!a||W===null){var ge=l*m,he=E[0].pts-s(E[0].dts,E[0].pts);W=ge-he}for(var fe=0;feae.pts){var me=9e4*.2;Te=Math.max(Math.min(Te,ae.pts-ae.dts),-1*me)}ae.dts0?fe-1:fe].dts&&(ve=!0)}ve&&E.sort(function(mt,dt){var ot=mt.dts-dt.dts,Ct=mt.pts-dt.pts;return ot||Ct}),H=E[0].dts,Y=E[E.length-1].dts;var J=Math.round((Y-H)/(F-1));if(Te<0){if(TeJ,we=Ce<-1;if(ye||we){ye?k.logger.warn("AVC: "+Object(y.toMsFromMpegTsClock)(Ce,!0)+" ms ("+Ce+"dts) hole between fragments detected, filling it"):k.logger.warn("AVC: "+Object(y.toMsFromMpegTsClock)(-Ce,!0)+" ms ("+Ce+"dts) overlapping between fragments detected"),H=W;var De=E[0].pts-Ce;E[0].dts=H,E[0].pts=De,k.logger.log("Video: First PTS/DTS adjusted: "+Object(y.toMsFromMpegTsClock)(De,!0)+"/"+Object(y.toMsFromMpegTsClock)(H,!0)+", delta: "+Object(y.toMsFromMpegTsClock)(Ce,!0)+" ms")}}o&&(H=Math.max(0,H));for(var Pe=0,ke=0,Oe=0;Oe0?Se-1:Se].dts;if(Z.stretchShortVideoTrack&&this.nextAudioPts!==null){var le=Math.floor(Z.maxBufferHole*m),ce=(v?ee+v*m:this.nextAudioPts)-Ze.pts;ce>le?(P=ce-te,P<0&&(P=te),k.logger.log("[mp4-remuxer]: It is approximately "+ce/90+" ms to the next segment; using duration "+P/90+" ms for the last video frame.")):P=te}else P=te}var Ae=Math.round(Ze.pts-Ze.dts);M.push(new p(Ze.key,P,Le,Ae))}if(M.length&&g&&g<70){var _e=M[0].flags;_e.dependsOn=2,_e.isNonSync=0}console.assert(P!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=W=Y+P,this.isVideoContiguous=!0;var Ue=R.default.moof(c.sequenceNumber++,H,x({},c,{samples:M})),Qe="video",Ve={data1:Ue,data2:Je,startPTS:ee/m,endPTS:(oe+P)/m,startDTS:H/m,endDTS:W/m,type:Qe,hasAudio:!1,hasVideo:!0,nb:M.length,dropped:c.dropped};return c.samples=[],c.dropped=0,console.assert(Je.length,"MDAT length must not be zero"),Ve},b.remuxAudio=function(c,l,a,v,m){var E=c.inputTimeScale,M=c.samplerate?c.samplerate:E,F=E/M,j=c.isAAC?C:T,W=j*F,D=this._initPTS,P=!c.isAAC&&this.typeSupported.mpeg,H=[],Y=c.samples,ee=P?0:8,oe=this.nextAudioPts||-1,Te=l*E;if(this.isAudioContiguous=a=a||Y.length&&oe>0&&(v&&Math.abs(Te-oe)<9e3||Math.abs(s(Y[0].pts-D,Te)-oe)<20*W),Y.forEach(function(de){de.pts=s(de.pts-D,Te)}),!a||oe<0){if(Y=Y.filter(function(de){return de.pts>=0}),!Y.length)return;m===0?oe=0:v?oe=Math.max(0,Te):oe=Y[0].pts}if(c.isAAC)for(var ve=m!==void 0,ge=this.config.maxAudioFramesDrift,he=0,fe=oe;he=ge*W&&ne0){ke+=ee;try{Pe=new Uint8Array(ke)}catch(de){this.observer.emit(B.Events.ERROR,B.Events.ERROR,{type:U.ErrorTypes.MUX_ERROR,details:U.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:ke,reason:"fail allocating audio mdat "+ke});return}if(!P){var Je=new DataView(Pe.buffer);Je.setUint32(0,ke),Pe.set(R.default.types.mdat,4)}}else return;Pe.set(Be,ee);var qe=Be.byteLength;ee+=qe,H.push(new p(!0,j,qe,0)),De=He}var Se=H.length;if(!Se)return;var Ze=H[H.length-1];this.nextAudioPts=oe=De+F*Ze.duration;var Ke=P?new Uint8Array(0):R.default.moof(c.sequenceNumber++,we/F,x({},c,{samples:H}));c.samples=[];var Le=we/E,Ie=oe/E,pe="audio",se={data1:Ke,data2:Pe,startPTS:Le,endPTS:Ie,startDTS:Le,endDTS:Ie,type:pe,hasAudio:!0,hasVideo:!1,nb:Se};return this.isAudioContiguous=!0,console.assert(Pe.length,"MDAT length must not be zero"),se},b.remuxEmptyAudio=function(c,l,a,v){var m=c.inputTimeScale,E=c.samplerate?c.samplerate:m,M=m/E,F=this.nextAudioPts,j=(F!==null?F:v.startDTS*m)+this._initDTS,W=v.endDTS*m+this._initDTS,D=M*C,P=Math.ceil((W-j)/D),H=I.default.getSilentFrame(c.manifestCodec||c.codec,c.channelCount);if(k.logger.warn("[mp4-remuxer]: remux empty Audio"),!H){k.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var Y=[],ee=0;ee4294967296;)_+=h;return _}function w(_){for(var b=0;b<_.length;b++)if(_[b].key)return b;return-1}var p=function(b,h,c,l){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=h,this.size=c,this.cts=l,this.flags=new f(b)},f=function(b){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=b?2:1,this.isNonSync=b?0:1}},"./src/remux/passthrough-remuxer.ts":function(re,V,A){"use strict";A.r(V);var G=A("./src/polyfills/number.ts"),I=A("./src/utils/mp4-tools.ts"),R=A("./src/loader/fragment.ts"),B=A("./src/utils/logger.ts"),U=function(){function y(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=void 0,this.initTracks=void 0,this.lastEndDTS=null}var x=y.prototype;return x.destroy=function(){},x.resetTimeStamp=function(C){this.initPTS=C,this.lastEndDTS=null},x.resetNextTimestamp=function(){this.lastEndDTS=null},x.resetInitSegment=function(C,T,g){this.audioCodec=T,this.videoCodec=g,this.generateInitSegment(C),this.emitInitSegment=!0},x.generateInitSegment=function(C){var T=this.audioCodec,g=this.videoCodec;if(!C||!C.byteLength){this.initTracks=void 0,this.initData=void 0;return}var d=this.initData=Object(I.parseInitSegment)(C);T||(T=L(d.audio,R.ElementaryStreamTypes.AUDIO)),g||(g=L(d.video,R.ElementaryStreamTypes.VIDEO));var o={};d.audio&&d.video?o.audiovideo={container:"video/mp4",codec:T+","+g,initSegment:C,id:"main"}:d.audio?o.audio={container:"audio/mp4",codec:T,initSegment:C,id:"audio"}:d.video?o.video={container:"video/mp4",codec:g,initSegment:C,id:"main"}:B.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=o},x.remux=function(C,T,g,d,o){var u=this.initPTS,s=this.lastEndDTS,w={audio:void 0,video:void 0,text:d,id3:g,initSegment:void 0};Object(G.isFiniteNumber)(s)||(s=this.lastEndDTS=o||0);var p=T.samples;if(!p||!p.length)return w;var f={initPTS:void 0,timescale:1},_=this.initData;if((!_||!_.length)&&(this.generateInitSegment(p),_=this.initData),!_||!_.length)return B.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),w;this.emitInitSegment&&(f.tracks=this.initTracks,this.emitInitSegment=!1),Object(G.isFiniteNumber)(u)||(this.initPTS=f.initPTS=u=k(_,p,s));var b=Object(I.getDuration)(p,_),h=s,c=b+h;Object(I.offsetStartDTS)(_,p,u),b>0?this.lastEndDTS=c:(B.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var l=!!_.audio,a=!!_.video,v="";l&&(v+="audio"),a&&(v+="video");var m={data1:p,startPTS:h,startDTS:h,endPTS:c,endDTS:c,type:v,hasAudio:l,hasVideo:a,nb:1,dropped:0};return w.audio=m.type==="audio"?m:void 0,w.video=m.type!=="audio"?m:void 0,w.text=d,w.id3=g,w.initSegment=f,w},y}(),k=function(x,O,C){return Object(I.getStartDTS)(x,O)-C};function L(y,x){var O=y==null?void 0:y.codec;return O&&O.length>4?O:O==="hvc1"?"hvc1.1.c.L120.90":O==="av01"?"av01.0.04M.08":O==="avc1"||x===R.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}V.default=U},"./src/task-loop.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"default",function(){return G});var G=function(){function I(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var R=I.prototype;return R.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},R.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},R.onHandlerDestroyed=function(){},R.hasInterval=function(){return!!this._tickInterval},R.hasNextTick=function(){return!!this._tickTimer},R.setInterval=function(U){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,U),!0)},R.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},R.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},R.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},R.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},R.doTick=function(){},I}()},"./src/types/cmcd.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"CMCDVersion",function(){return G}),A.d(V,"CMCDObjectType",function(){return I}),A.d(V,"CMCDStreamingFormat",function(){return R}),A.d(V,"CMCDStreamType",function(){return B});var G=1,I;(function(U){U.MANIFEST="m",U.AUDIO="a",U.VIDEO="v",U.MUXED="av",U.INIT="i",U.CAPTION="c",U.TIMED_TEXT="tt",U.KEY="k",U.OTHER="o"})(I||(I={}));var R;(function(U){U.DASH="d",U.HLS="h",U.SMOOTH="s",U.OTHER="o"})(R||(R={}));var B;(function(U){U.VOD="v",U.LIVE="l"})(B||(B={}))},"./src/types/level.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"HlsSkip",function(){return R}),A.d(V,"getSkipValue",function(){return B}),A.d(V,"HlsUrlParameters",function(){return U}),A.d(V,"Level",function(){return k});function G(L,y){for(var x=0;xNumber.MAX_SAFE_INTEGER?Infinity:y},U.hexadecimalInteger=function(L){if(this[L]){var y=(this[L]||"0x").slice(2);y=(y.length&1?"0":"")+y;for(var x=new Uint8Array(y.length/2),O=0;ONumber.MAX_SAFE_INTEGER?Infinity:y},U.decimalFloatingPoint=function(L){return parseFloat(this[L])},U.optionalFloat=function(L,y){var x=this[L];return x?parseFloat(x):y},U.enumeratedString=function(L){return this[L]},U.bool=function(L){return this[L]==="YES"},U.decimalResolution=function(L){var y=G.exec(this[L]);return y===null?void 0:{width:parseInt(y[1],10),height:parseInt(y[2],10)}},B.parseAttrList=function(L){var y,x={},O='"';for(I.lastIndex=0;(y=I.exec(L))!==null;){var C=y[2];C.indexOf(O)===0&&C.lastIndexOf(O)===C.length-1&&(C=C.slice(1,-1)),x[y[1]]=C}return x},B}()},"./src/utils/binary-search.ts":function(re,V,A){"use strict";A.r(V);var G={search:function(R,B){for(var U=0,k=R.length-1,L=null,y=null;U<=k;){L=(U+k)/2|0,y=R[L];var x=B(y);if(x>0)U=L+1;else if(x<0)k=L-1;else return y}return null}};V.default=G},"./src/utils/buffer-helper.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"BufferHelper",function(){return R});var G=A("./src/utils/logger.ts"),I={length:0,start:function(){return 0},end:function(){return 0}},R=function(){function B(){}return B.isBuffered=function(k,L){try{if(k){for(var y=B.getBuffered(k),x=0;x=y.start(x)&&L<=y.end(x))return!0}}catch(O){}return!1},B.bufferInfo=function(k,L,y){try{if(k){var x=B.getBuffered(k),O=[],C;for(C=0;CT&&(x[C-1].end=k[O].end):x.push(k[O])}else x.push(k[O])}else x=k;for(var g=0,d,o=L,u=L,s=0;s=w&&L=a&&G.logger.log(this.time+" ["+a+"] "+v)},h}(),g=function(c){for(var l=[],a=0;aU&&(this.logger.log(C.DEBUG,"Too large cursor position "+this.pos),this.pos=U)},c.moveCursor=function(a){var v=this.pos+a;if(a>1)for(var m=this.pos+1;m=144&&this.backSpace();var v=R(a);if(this.pos>=U){this.logger.log(C.ERROR,"Cannot insert "+a.toString(16)+" ("+v+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(v,this.currPenState),this.moveCursor(1)},c.clearFromPos=function(a){var v;for(v=a;v0&&(a?m="["+v.join(" | ")+"]":m=v.join(` `)),m},c.getTextAndFormat=function(){return this.rows},h}(),w=function(){function h(l,a,v){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=l,this.outputFilter=a,this.mode=null,this.verbose=0,this.displayedMemory=new s(v),this.nonDisplayedMemory=new s(v),this.lastOutputScreen=new s(v),this.currRollUpRow=this.displayedMemory.rows[B-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=v}var c=h.prototype;return c.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[B-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},c.getHandler=function(){return this.outputFilter},c.setHandler=function(a){this.outputFilter=a},c.setPAC=function(a){this.writeScreen.setPAC(a)},c.setBkgData=function(a){this.writeScreen.setBkgData(a)},c.setMode=function(a){if(a===this.mode)return;this.mode=a,this.logger.log(C.INFO,"MODE="+a),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=a},c.insertChars=function(a){for(var v=0;v=46,v.italics)v.foreground="white";else{var m=Math.floor(a/2)-16,E=["white","green","blue","cyan","red","yellow","magenta"];v.foreground=E[m]}this.logger.log(C.INFO,"MIDROW: "+JSON.stringify(v)),this.writeScreen.setPen(v)},c.outputDataUpdate=function(a){a===void 0&&(a=!1);var v=this.logger.time;if(v===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=v:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,v,this.lastOutputScreen),a&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:v),this.lastOutputScreen.copy(this.displayedMemory))},c.cueSplitAtTime=function(a){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,a,this.displayedMemory),this.cueStartTime=a))},h}(),p=function(){function h(l,a,v){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var m=new T;this.channels=[null,new w(l,a,m),new w(l+1,v,m)],this.cmdHistory=b(),this.logger=m}var c=h.prototype;return c.getHandler=function(a){return this.channels[a].getHandler()},c.setHandler=function(a,v){this.channels[a].setHandler(v)},c.addData=function(a,v){var m,E,M,F=!1;this.logger.time=a;for(var j=0;j ("+g([E,M])+")"),m=this.parseCmd(E,M),m||(m=this.parseMidrow(E,M)),m||(m=this.parsePAC(E,M)),m||(m=this.parseBackgroundAttributes(E,M)),!m&&(F=this.parseChars(E,M),F)){var W=this.currentChannel;if(W&&W>0){var D=this.channels[W];D.insertChars(F)}else this.logger.log(C.WARNING,"No channel found yet. TEXT-MODE?")}!m&&!F&&this.logger.log(C.WARNING,"Couldn't parse cleaned data "+g([E,M])+" orig: "+g([v[j],v[j+1]]))}},c.parseCmd=function(a,v){var m=this.cmdHistory,E=(a===20||a===28||a===21||a===29)&&v>=32&&v<=47,M=(a===23||a===31)&&v>=33&&v<=35;if(!(E||M))return!1;if(_(a,v,m))return f(null,null,m),this.logger.log(C.DEBUG,"Repeated command ("+g([a,v])+") is dropped"),!0;var F=a===20||a===21||a===23?1:2,j=this.channels[F];return a===20||a===21||a===28||a===29?v===32?j.ccRCL():v===33?j.ccBS():v===34?j.ccAOF():v===35?j.ccAON():v===36?j.ccDER():v===37?j.ccRU(2):v===38?j.ccRU(3):v===39?j.ccRU(4):v===40?j.ccFON():v===41?j.ccRDC():v===42?j.ccTR():v===43?j.ccRTD():v===44?j.ccEDM():v===45?j.ccCR():v===46?j.ccENM():v===47&&j.ccEOC():j.ccTO(v-32),f(a,v,m),this.currentChannel=F,!0},c.parseMidrow=function(a,v){var m=0;if((a===17||a===25)&&v>=32&&v<=47){if(a===17?m=1:m=2,m!==this.currentChannel)return this.logger.log(C.ERROR,"Mismatch channel in midrow parsing"),!1;var E=this.channels[m];return E?(E.ccMIDROW(v),this.logger.log(C.DEBUG,"MIDROW ("+g([a,v])+")"),!0):!1}return!1},c.parsePAC=function(a,v){var m,E=this.cmdHistory,M=(a>=17&&a<=23||a>=25&&a<=31)&&v>=64&&v<=127,F=(a===16||a===24)&&v>=64&&v<=95;if(!(M||F))return!1;if(_(a,v,E))return f(null,null,E),!0;var j=a<=23?1:2;v>=64&&v<=95?m=j===1?k[a]:y[a]:m=j===1?L[a]:x[a];var W=this.channels[j];return W?(W.setPAC(this.interpretPAC(m,v)),f(a,v,E),this.currentChannel=j,!0):!1},c.interpretPAC=function(a,v){var m,E={color:null,italics:!1,indent:null,underline:!1,row:a};return v>95?m=v-96:m=v-64,E.underline=(m&1)===1,m<=13?E.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(m/2)]:m<=15?(E.italics=!0,E.color="white"):E.indent=Math.floor((m-16)/2)*4,E},c.parseChars=function(a,v){var m,E=null,M=null;if(a>=25?(m=2,M=a-8):(m=1,M=a),M>=17&&M<=19){var F;M===17?F=v+80:M===18?F=v+112:F=v+144,this.logger.log(C.INFO,"Special char '"+R(F)+"' in channel "+m),E=[F]}else a>=32&&a<=127&&(E=v===0?[a]:[a,v]);if(E){var j=g(E);this.logger.log(C.DEBUG,"Char codes = "+j.join(",")),f(a,v,this.cmdHistory)}return E},c.parseBackgroundAttributes=function(a,v){var m=(a===16||a===24)&&v>=32&&v<=47,E=(a===23||a===31)&&v>=45&&v<=47;if(!(m||E))return!1;var M,F={};a===16||a===24?(M=Math.floor((v-32)/2),F.background=O[M],v%2===1&&(F.background=F.background+"_semi")):v===45?F.background="transparent":(F.foreground="black",v===47&&(F.underline=!0));var j=a<=23?1:2,W=this.channels[j];return W.setBkgData(F),f(a,v,this.cmdHistory),!0},c.reset=function(){for(var a=0;a=16?o--:o++;var f=Object(G.fixLineBreaks)(u.trim()),_=Object(I.generateCueId)(y,x,f);(!L||!L.cues||!L.cues.getCueById(_))&&(g=new s(y,x,f),g.id=_,g.line=w+1,g.align="left",g.position=10+Math.min(80,Math.floor(o*8/32)*10),C.push(g))}return L&&C.length&&(C.sort(function(b,h){return b.line==="auto"||h.line==="auto"?0:b.line>8&&h.line>8?h.line-b.line:b.line-h.line}),C.forEach(function(b){return Object(R.addCueToTrack)(L,b)})),C}};V.default=U},"./src/utils/discontinuities.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"findFirstFragWithCC",function(){return B}),A.d(V,"shouldAlignOnDiscontinuities",function(){return U}),A.d(V,"findDiscontinuousReferenceFrag",function(){return k}),A.d(V,"adjustSlidingStart",function(){return y}),A.d(V,"alignStream",function(){return x}),A.d(V,"alignPDT",function(){return C}),A.d(V,"alignFragmentByPDTDelta",function(){return T}),A.d(V,"alignMediaPlaylistByPDT",function(){return g});var G=A("./src/polyfills/number.ts"),I=A("./src/utils/logger.ts"),R=A("./src/controller/level-helper.ts");function B(d,o){for(var u=null,s=0,w=d.length;su.startCC||d&&d.cc=this.minWeight_},B.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},B.destroy=function(){},R}();V.default=I},"./src/utils/ewma.ts":function(re,V,A){"use strict";A.r(V);var G=function(){function I(B,U,k){U===void 0&&(U=0),k===void 0&&(k=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=B,this.alpha_=B?Math.exp(Math.log(.5)/B):0,this.estimate_=U,this.totalWeight_=k}var R=I.prototype;return R.sample=function(U,k){var L=Math.pow(this.alpha_,U);this.estimate_=k*(1-L)+L*this.estimate_,this.totalWeight_+=U},R.getTotalWeight=function(){return this.totalWeight_},R.getEstimate=function(){if(this.alpha_){var U=1-Math.pow(this.alpha_,this.totalWeight_);if(U)return this.estimate_/U}return this.estimate_},I}();V.default=G},"./src/utils/fetch-loader.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"fetchSupported",function(){return T});var G=A("./src/polyfills/number.ts"),I=A("./src/loader/load-stats.ts"),R=A("./src/demux/chunk-cache.ts");function B(s,w){s.prototype=Object.create(w.prototype),s.prototype.constructor=s,x(s,w)}function U(s){var w=typeof Map=="function"?new Map:void 0;return U=function(f){if(f===null||!y(f))return f;if(typeof f!="function")throw new TypeError("Super expression must either be null or a function");if(typeof w!="undefined"){if(w.has(f))return w.get(f);w.set(f,_)}function _(){return k(f,arguments,O(this).constructor)}return _.prototype=Object.create(f.prototype,{constructor:{value:_,enumerable:!1,writable:!0,configurable:!0}}),x(_,f)},U(s)}function k(s,w,p){return L()?k=Reflect.construct:k=function(_,b,h){var c=[null];c.push.apply(c,b);var l=Function.bind.apply(_,c),a=new l;return h&&x(a,h.prototype),a},k.apply(null,arguments)}function L(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(s){return!1}}function y(s){return Function.toString.call(s).indexOf("[native code]")!==-1}function x(s,w){return x=Object.setPrototypeOf||function(f,_){return f.__proto__=_,f},x(s,w)}function O(s){return O=Object.setPrototypeOf?Object.getPrototypeOf:function(p){return p.__proto__||Object.getPrototypeOf(p)},O(s)}function C(){return C=Object.assign||function(s){for(var w=1;w=h&&c(_,b,l.flush(),f)):c(_,b,M,f),m()}).catch(function(){return Promise.reject()})};return v()},s}();function d(s,w){var p={method:"GET",mode:"cors",credentials:"same-origin",signal:w,headers:new self.Headers(C({},s.headers))};return s.rangeEnd&&p.headers.set("Range","bytes="+s.rangeStart+"-"+String(s.rangeEnd-1)),p}function o(s,w){return new self.Request(s.url,w)}var u=function(s){B(w,s);function w(p,f,_){var b;return b=s.call(this,p)||this,b.code=void 0,b.details=void 0,b.code=f,b.details=_,b}return w}(U(Error));V.default=g},"./src/utils/imsc1-ttml-parser.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"IMSC1_CODEC",function(){return y}),A.d(V,"parseIMSC1",function(){return T});var G=A("./src/utils/mp4-tools.ts"),I=A("./src/utils/vttparser.ts"),R=A("./src/utils/vttcue.ts"),B=A("./src/demux/id3.ts"),U=A("./src/utils/timescale-conversion.ts"),k=A("./src/utils/webvtt-parser.ts");function L(){return L=Object.assign||function(h){for(var c=1;c"):G}function U(y){for(var x=arguments.length,O=new Array(x>1?x-1:0),C=1;C>24,w[p+1]=f>>16&255,w[p+2]=f>>8&255,w[p+3]=f&255}function x(w,p){var f=[];if(!p.length)return f;var _,b,h;"data"in w?(_=w.data,b=w.start,h=w.end):(_=w,b=0,h=_.byteLength);for(var c=b;c1?c+l:h;if(a===p[0])if(p.length===1)f.push({data:_,start:c+8,end:v});else{var m=x({data:_,start:c+8,end:v},p.slice(1));m.length&&B.apply(f,m)}c=v}return f}function O(w){var p=x(w,["moov"]),f=p[0],_=f?f.end:null,b=x(w,["sidx"]);if(!b||!b[0])return null;var h=[],c=b[0],l=c.data[0],a=l===0?8:16,v=L(c,a);a+=4;var m=0,E=0;l===0?a+=8:a+=16,a+=2;var M=c.end+E,F=k(c,a);a+=2;for(var j=0;j>>31;if(H===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var Y=L(c,W);W+=4,h.push({referenceSize:P,subsegmentDuration:Y,info:{duration:Y/v,start:M,end:M+P-1}}),M+=P,W+=4,a=W}return{earliestPresentationTime:m,timescale:v,version:l,referencesCount:F,references:h,moovEndOffset:_}}function C(w){for(var p=[],f=x(w,["moov","trak"]),_=0;_U)&&(this.startTime=U),this.endTime=k,this.screen=L,this.timelineController.createCaptionsTrack(this.trackName)},R.reset=function(){this.cueRanges=[]},I}()},"./src/utils/texttrack-utils.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"sendAddTrackEvent",function(){return I}),A.d(V,"addCueToTrack",function(){return R}),A.d(V,"clearCurrentCues",function(){return B}),A.d(V,"removeCuesInRange",function(){return U}),A.d(V,"getCuesInRange",function(){return L});var G=A("./src/utils/logger.ts");function I(y,x){var O;try{O=new Event("addtrack")}catch(C){O=document.createEvent("Event"),O.initEvent("addtrack",!1,!1)}O.track=y,x.dispatchEvent(O)}function R(y,x){var O=y.mode;if(O==="disabled"&&(y.mode="hidden"),y.cues&&!y.cues.getCueById(x.id))try{if(y.addCue(x),!y.cues.getCueById(x.id))throw new Error("addCue is failed for: "+x)}catch(T){G.logger.debug("[texttrack-utils]: "+T);var C=new self.TextTrackCue(x.startTime,x.endTime,x.text);C.id=x.id,y.addCue(C)}O==="disabled"&&(y.mode=O)}function B(y){var x=y.mode;if(x==="disabled"&&(y.mode="hidden"),y.cues)for(var O=y.cues.length;O--;)y.removeCue(y.cues[O]);x==="disabled"&&(y.mode=x)}function U(y,x,O){var C=y.mode;if(C==="disabled"&&(y.mode="hidden"),y.cues&&y.cues.length>0)for(var T=L(y.cues,x,O),g=0;gy[O].endTime)return-1;for(var C=0,T=O;C<=T;){var g=Math.floor((T+C)/2);if(xy[g].startTime&&C-1)for(var g=T,d=y.length;g=x&&o.endTime<=O)C.push(o);else if(o.startTime>O)return C}return C}},"./src/utils/time-ranges.ts":function(re,V,A){"use strict";A.r(V);var G={toString:function(R){for(var B="",U=R.length,k=0;k1?x-1:0),C=1;C100)throw new Error("Position must be between 0 and 100.");h=m,this.hasBeenReset=!0}})),Object.defineProperty(C,"positionAlign",k({},T,{get:function(){return c},set:function(m){var E=U(m);if(!E)throw new SyntaxError("An invalid or illegal string was specified.");c=E,this.hasBeenReset=!0}})),Object.defineProperty(C,"size",k({},T,{get:function(){return l},set:function(m){if(m<0||m>100)throw new Error("Size must be between 0 and 100.");l=m,this.hasBeenReset=!0}})),Object.defineProperty(C,"align",k({},T,{get:function(){return a},set:function(m){var E=U(m);if(!E)throw new SyntaxError("An invalid or illegal string was specified.");a=E,this.hasBeenReset=!0}})),C.displayState=void 0}return L.prototype.getCueAsHTML=function(){var y=self.WebVTT;return y.convertCueToDOMTree(self,this.text)},L}()},"./src/utils/vttparser.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"parseTimeStamp",function(){return R}),A.d(V,"fixLineBreaks",function(){return x}),A.d(V,"VTTParser",function(){return O});var G=A("./src/utils/vttcue.ts"),I=function(){function C(){}var T=C.prototype;return T.decode=function(d,o){if(!d)return"";if(typeof d!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(d))},C}();function R(C){function T(d,o,u,s){return(d|0)*3600+(o|0)*60+(u|0)+parseFloat(s||0)}var g=C.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return g?parseFloat(g[2])>59?T(g[2],g[3],0,g[4]):T(g[1],g[2],g[3],g[4]):null}var B=function(){function C(){this.values=Object.create(null)}var T=C.prototype;return T.set=function(d,o){!this.get(d)&&o!==""&&(this.values[d]=o)},T.get=function(d,o,u){return u?this.has(d)?this.values[d]:o[u]:this.has(d)?this.values[d]:o},T.has=function(d){return d in this.values},T.alt=function(d,o,u){for(var s=0;s=0&&u<=100)return this.set(d,u),!0}return!1},C}();function U(C,T,g,d){var o=d?C.split(d):[C];for(var u in o){if(typeof o[u]!="string")continue;var s=o[u].split(g);if(s.length!==2)continue;var w=s[0],p=s[1];T(w,p)}}var k=new G.default(0,0,""),L=k.align==="middle"?"middle":"center";function y(C,T,g){var d=C;function o(){var w=R(C);if(w===null)throw new Error("Malformed timestamp: "+d);return C=C.replace(/^[^\sa-zA-Z-]+/,""),w}function u(w,p){var f=new B;U(w,function(h,c){var l;switch(h){case"region":for(var a=g.length-1;a>=0;a--)if(g[a].id===c){f.set(h,g[a].region);break}break;case"vertical":f.alt(h,c,["rl","lr"]);break;case"line":l=c.split(","),f.integer(h,l[0]),f.percent(h,l[0])&&f.set("snapToLines",!1),f.alt(h,l[0],["auto"]),l.length===2&&f.alt("lineAlign",l[1],["start",L,"end"]);break;case"position":l=c.split(","),f.percent(h,l[0]),l.length===2&&f.alt("positionAlign",l[1],["start",L,"end","line-left","line-right","auto"]);break;case"size":f.percent(h,c);break;case"align":f.alt(h,c,["start",L,"end","left","right"]);break}},/:/,/\s/),p.region=f.get("region",null),p.vertical=f.get("vertical","");var _=f.get("line","auto");_==="auto"&&k.line===-1&&(_=-1),p.line=_,p.lineAlign=f.get("lineAlign","start"),p.snapToLines=f.get("snapToLines",!0),p.size=f.get("size",100),p.align=f.get("align",L);var b=f.get("position","auto");b==="auto"&&k.position===50&&(b=p.align==="start"||p.align==="left"?0:p.align==="end"||p.align==="right"?100:50),p.position=b}function s(){C=C.replace(/^\s+/,"")}if(s(),T.startTime=o(),s(),C.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+d);C=C.substr(3),s(),T.endTime=o(),s(),u(C,T)}function x(C){return C.replace(//gi,` `)}var O=function(){function C(){this.state="INITIAL",this.buffer="",this.decoder=new I,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var T=C.prototype;return T.parse=function(d){var o=this;d&&(o.buffer+=o.decoder.decode(d,{stream:!0}));function u(){var b=o.buffer,h=0;for(b=x(b);h")===-1){o.cue.id=w;continue}case"CUE":if(!o.cue){o.state="BADCUE";continue}try{y(w,o.cue,o.regionList)}catch(b){o.cue=null,o.state="BADCUE";continue}o.state="CUETEXT";continue;case"CUETEXT":{var _=w.indexOf("-->")!==-1;if(!w||_&&(f=!0)){o.oncue&&o.cue&&o.oncue(o.cue),o.cue=null,o.state="ID";continue}if(o.cue===null)continue;o.cue.text&&(o.cue.text+=` `),o.cue.text+=w}continue;case"BADCUE":w||(o.state="ID")}}}catch(b){o.state==="CUETEXT"&&o.cue&&o.oncue&&o.oncue(o.cue),o.cue=null,o.state=o.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},T.flush=function(){var d=this;try{if((d.cue||d.state==="HEADER")&&(d.buffer+=` `,d.parse()),d.state==="INITIAL"||d.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(o){d.onparsingerror&&d.onparsingerror(o)}return d.onflush&&d.onflush(),this},C}()},"./src/utils/webvtt-parser.ts":function(re,V,A){"use strict";A.r(V),A.d(V,"generateCueId",function(){return O}),A.d(V,"parseWebVTT",function(){return T});var G=A("./src/polyfills/number.ts"),I=A("./src/utils/vttparser.ts"),R=A("./src/demux/id3.ts"),B=A("./src/utils/timescale-conversion.ts"),U=A("./src/remux/mp4-remuxer.ts"),k=/\r\n|\n\r|\n|\r/g,L=function(d,o,u){return u===void 0&&(u=0),d.substr(u,o.length)===o},y=function(d){var o=parseInt(d.substr(-3)),u=parseInt(d.substr(-6,2)),s=parseInt(d.substr(-9,2)),w=d.length>9?parseInt(d.substr(0,d.indexOf(":"))):0;if(!Object(G.isFiniteNumber)(o)||!Object(G.isFiniteNumber)(u)||!Object(G.isFiniteNumber)(s)||!Object(G.isFiniteNumber)(w))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+d);return o+=1e3*u,o+=60*1e3*s,o+=60*60*1e3*w,o},x=function(d){for(var o=5381,u=d.length;u;)o=o*33^d.charCodeAt(--u);return(o>>>0).toString()};function O(g,d,o){return x(g.toString())+x(d.toString())+x(o)}var C=function(d,o,u){var s=d[o],w=d[s.prevCC];if(!w||!w.new&&s.new){d.ccOffset=d.presentationOffset=s.start,s.new=!1;return}for(;(p=w)!==null&&p!==void 0&&p.new;){var p;d.ccOffset+=s.start-w.start,s.new=!1,s=w,w=d[s.prevCC]}d.presentationOffset=u};function T(g,d,o,u,s,w,p,f){var _=new I.VTTParser,b=Object(R.utf8ArrayToStr)(new Uint8Array(g)).trim().replace(k,` `).split(` `),h=[],c=Object(B.toMpegTsClockFromTimescale)(d,o),l="00:00.000",a=0,v=0,m,E=!0,M=!1;_.oncue=function(F){var j=u[s],W=u.ccOffset,D=(a-c)/9e4;if(j!=null&&j.new&&(v!==void 0?W=u.ccOffset=j.start:C(u,s,D)),D&&(W=D-u.presentationOffset),M){var P=F.endTime-F.startTime,H=Object(U.normalizePts)((F.startTime+W-v)*9e4,w*9e4)/9e4;F.startTime=H,F.endTime=H+P}var Y=F.text.trim();F.text=decodeURIComponent(encodeURIComponent(Y)),F.id||(F.id=O(F.startTime,F.endTime,Y)),F.endTime>0&&h.push(F)},_.onparsingerror=function(F){m=F},_.onflush=function(){if(m){f(m);return}p(h)},b.forEach(function(F){if(E)if(L(F,"X-TIMESTAMP-MAP=")){E=!1,M=!0,F.substr(16).split(",").forEach(function(j){L(j,"LOCAL:")?l=j.substr(6):L(j,"MPEGTS:")&&(a=parseInt(j.substr(7)))});try{v=y(l)/1e3}catch(j){M=!1,m=j}return}else F===""&&(E=!1);_.parse(F+` `)}),_.flush()}},"./src/utils/xhr-loader.ts":function(re,V,A){"use strict";A.r(V);var G=A("./src/utils/logger.ts"),I=A("./src/loader/load-stats.ts"),R=/^age:\s*[\d.]+\s*$/m,B=function(){function U(L){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=L?L.xhrSetup:null,this.stats=new I.LoadStats,this.retryDelay=0}var k=U.prototype;return k.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},k.abortInternal=function(){var y=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),y&&(y.onreadystatechange=null,y.onprogress=null,y.readyState!==4&&(this.stats.aborted=!0,y.abort()))},k.abort=function(){var y;this.abortInternal(),(y=this.callbacks)!==null&&y!==void 0&&y.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},k.load=function(y,x,O){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=y,this.config=x,this.callbacks=O,this.retryDelay=x.retryDelay,this.loadInternal()},k.loadInternal=function(){var y=this.config,x=this.context;if(!y)return;var O=this.loader=new self.XMLHttpRequest,C=this.stats;C.loading.first=0,C.loaded=0;var T=this.xhrSetup;try{if(T)try{T(O,x.url)}catch(o){O.open("GET",x.url,!0),T(O,x.url)}O.readyState||O.open("GET",x.url,!0);var g=this.context.headers;if(g)for(var d in g)O.setRequestHeader(d,g[d])}catch(o){this.callbacks.onError({code:O.status,text:o.message},x,O);return}x.rangeEnd&&O.setRequestHeader("Range","bytes="+x.rangeStart+"-"+(x.rangeEnd-1)),O.onreadystatechange=this.readystatechange.bind(this),O.onprogress=this.loadprogress.bind(this),O.responseType=x.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),y.timeout),O.send()},k.readystatechange=function(){var y=this.context,x=this.loader,O=this.stats;if(!y||!x)return;var C=x.readyState,T=this.config;if(O.aborted)return;if(C>=2)if(self.clearTimeout(this.requestTimeout),O.loading.first===0&&(O.loading.first=Math.max(self.performance.now(),O.loading.start)),C===4){x.onreadystatechange=null,x.onprogress=null;var g=x.status;if(g>=200&&g<300){O.loading.end=Math.max(self.performance.now(),O.loading.first);var d,o;if(y.responseType==="arraybuffer"?(d=x.response,o=d.byteLength):(d=x.responseText,o=d.length),O.loaded=O.total=o,!this.callbacks)return;var u=this.callbacks.onProgress;if(u&&u(O,y,d,x),!this.callbacks)return;var s={url:x.responseURL,data:d};this.callbacks.onSuccess(s,O,y,x)}else O.retry>=T.maxRetry||g>=400&&g<499?(G.logger.error(g+" while loading "+y.url),this.callbacks.onError({code:g,text:x.statusText},y,x)):(G.logger.warn(g+" while loading "+y.url+", retrying in "+this.retryDelay+"..."),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,T.maxRetryDelay),O.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),T.timeout)},k.loadtimeout=function(){G.logger.warn("timeout while loading "+this.context.url);var y=this.callbacks;y&&(this.abortInternal(),y.onTimeout(this.stats,this.context,this.loader))},k.loadprogress=function(y){var x=this.stats;x.loaded=y.loaded,y.lengthComputable&&(x.total=y.total)},k.getCacheAge=function(){var y=null;if(this.loader&&R.test(this.loader.getAllResponseHeaders())){var x=this.loader.getResponseHeader("age");y=x?parseFloat(x):null}return y},U}();V.default=B}}).default})},vHTk:function(st,ze,q){st.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}},wzkS:function(st,ze,q){"use strict";q.d(ze,"c",function(){return I}),q.d(ze,"b",function(){return R}),q.d(ze,"d",function(){return B}),q.d(ze,"a",function(){return k}),q.d(ze,"e",function(){return L});var re=q("9og8"),V=q("WmNS"),A=q.n(V),G=q("ErOA");function I(y){return Object(G.c)("libraries/".concat(y,".json"))}function R(){return Object(G.c)("library_tags.json")}function B(y){return U.apply(this,arguments)}function U(){return U=Object(re.a)(A.a.mark(function y(x){var O;return A.a.wrap(function(T){for(;;)switch(T.prev=T.next){case 0:return T.next=2,Object(G.b)("attachments/".concat(x,".json"));case 2:return O=T.sent,T.abrupt("return",O.status===0);case 4:case"end":return T.stop()}},y)})),U.apply(this,arguments)}function k(y){return Object(G.f)("libraries.json",y)}function L(y,x){return Object(G.g)("libraries/".concat(y,".json"),x)}},y5JW:function(st,ze,q){"use strict";q.d(ze,"c",function(){return g}),q.d(ze,"a",function(){return d});var re=q("DZo9"),V=q("8z0m"),A=q("+L6B"),G=q("2/Rp"),I=q("9og8"),R=q("miYZ"),B=q("tsqr"),U=q("k1fw"),k=q("oBTY"),L=q("WmNS"),y=q.n(L),x=q("cDcd"),O=q.n(x),C=q("m3rI"),T=q("wzkS"),g="\u3000\u3000";function d(o){var u=["Bytes","KB","MB","GB","TB"];if(o==0)return"0 Byte";var s=parseInt(""+Math.floor(Math.log(o)/Math.log(1024)),10);return(o/Math.pow(1024,s)).toFixed(1)+" "+u[s]}ze.b=function(o){var u=o.value,s=u===void 0?[]:u,w=o.action,p=o.onChange,f=o.className,_=o.maxSize,b=_===void 0?150:_,h=o.title,c=h===void 0?"\u6587\u4EF6\u4E0A\u4F20":h,l=o.accept,a=l===void 0?null:l,v={multiple:!1,fileList:s,accept:a,withCredentials:!0,beforeUpload:function(M){var F=M.size/1024/1024;return!0},action:"".concat(C.a.API_SERVER,"/api/attachments.json"),onChange:function(M){var F,j,W=Object(k.a)(M.fileList);if(W=W.map(function(H){return H.name.indexOf(g)===-1&&(H.name="".concat(H.name).concat(g).concat(d(H.size))),Object(U.a)({},H)}),M.file.status==="done"&&((F=M.file)===null||F===void 0||((j=F.response)===null||j===void 0)?void 0:j.status)===-1){var D,P;B.b.error((D=M.file)===null||D===void 0||((P=D.response)===null||P===void 0)?void 0:P.message),p([]);return}p(W)},onRemove:function(){var E=Object(I.a)(y.a.mark(function F(j){var W,D,P;return y.a.wrap(function(Y){for(;;)switch(Y.prev=Y.next){case 0:if(W=j.size/1024/1024,!(j.status==="uploading")){Y.next=3;break}return Y.abrupt("return",!0);case 3:if(W0?"\u6BCF\u6B21\u53EA\u80FD\u4E0A\u4F20\u4E00\u4E2A\u8D44\u6E90\uFF0C \u5220\u9664\u4E0B\u9762\u8D44\u6E90\u53EF\u91CD\u65B0\u4E0A\u4F20 ":"",disabled:s.length>0,ghost:!0},c),O.a.createElement("span",{onClick:m,style:{marginLeft:10}},"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927",b,"M)"," ")))}}}]);